add immoweb ui
This commit is contained in:
parent
7e8c79d3d1
commit
151da16c27
266 changed files with 264879 additions and 0 deletions
20
immoweb/node_modules/sightglass/LICENSE
generated
vendored
Normal file
20
immoweb/node_modules/sightglass/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
Copyright (c) 2014 Michael Richards
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
95
immoweb/node_modules/sightglass/README.md
generated
vendored
Normal file
95
immoweb/node_modules/sightglass/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
# sightglass
|
||||
|
||||
Observable keypath engine. Facilitaties building your own composable keypaths by way of defining adapters. This module was originally extracted from the [Rivets.js](http://rivetsjs.com) data binding + templating library.
|
||||
|
||||
## Installation
|
||||
|
||||
Install with [npm](https://www.npmjs.org/), [component(1)](http://component.io) or [bower](http://bower.io/) (recommended).
|
||||
|
||||
```
|
||||
$ bower install sightglass
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
#### sightglass.adapters
|
||||
|
||||
Before being able to observe an object with sightglass, you need to define at least one adapter to compose your keypaths with. Adapters are just objects that respond to `observe`, `unobserve` and `get`. Keys on the `sightglass.adapters` object are the separators you will use when composing your keypaths.
|
||||
|
||||
```
|
||||
sightglass.adapters['.'] = {
|
||||
observe: function(obj, key, callback) {},
|
||||
unobserve: function(obj, key, callback) {},
|
||||
get: function(obj, key) {},
|
||||
set: function(obj, key, value) {}
|
||||
}
|
||||
```
|
||||
|
||||
#### sightglass.root
|
||||
|
||||
Sightglass also needs to know about a default root adapter. This is only required for keypaths that aren't prepended with an adapter key. For example, if your default root adapter is set to `.`, then the keypath `hello:world` will get parsed as `.hello:world`.
|
||||
|
||||
```
|
||||
sightglass.root = '.'
|
||||
```
|
||||
|
||||
#### sightglass(obj, keypath, callback, [options])
|
||||
|
||||
Observes the full keypath on the provided object. The callback is called whenever the end value of the keypath changes (this could happen from any intermediary objects in the keypath changing, in addition to the property at the end of the keypath changing).
|
||||
|
||||
```
|
||||
sightglass(obj, 'user.address:city', function() {})
|
||||
```
|
||||
|
||||
You can optionally pass in a fourth argument to extend the default options. Adapters defined here will only be available locally to the observer. All globally defined adapters will also be available to the observer, unless overridden by using an existing separator key.
|
||||
|
||||
```
|
||||
sightglass(obj, keypath, callback, {
|
||||
root: ':',
|
||||
adapters: {':': {
|
||||
observe: function(obj, key, callback) {},
|
||||
unobserve: function(obj, key, callback) {},
|
||||
get: function(obj, key) {},
|
||||
set: function(obj, key, value) {}
|
||||
}}
|
||||
})
|
||||
```
|
||||
|
||||
Returns an `Observer` instance that you can hold on to for later (see *Observer API* below).
|
||||
|
||||
## Observer API
|
||||
|
||||
#### observer.value()
|
||||
|
||||
Reads the current end value of the observed keypath. Returns `undefined` if the full keypath is unreachable.
|
||||
|
||||
#### observer.setValue()
|
||||
|
||||
Sets the value on the tail property of the observed object (the last segment in the keypath). Calling `setValue` when the full keypath is unreachable is a no-op.
|
||||
|
||||
```
|
||||
observer.setValue('Vancouver')
|
||||
```
|
||||
|
||||
#### observer.update()
|
||||
|
||||
Recomputes the entire keypath, attaching observers for every key or correcting old observers on objects in the keypath that have since changed.
|
||||
|
||||
If your adapter's `subscribe` function is implemented properly, this function will get called automatically when any intermediary key in the keypath changes, so you shouldn't need to call this function. However, if your keypath makes use of an adapter that does not subscribe for changes, then you will need to call this function manually after making changes to that segment in your keypath.
|
||||
|
||||
#### observer.unobserve()
|
||||
|
||||
Unobserves the entire keypath.
|
||||
|
||||
## Contributing
|
||||
|
||||
#### Bug Reporting
|
||||
|
||||
1. Ensure the bug can be reproduced on the latest master.
|
||||
2. Open an issue on GitHub and include an isolated [JSFiddle](http://jsfiddle.net/) demonstration of the bug. The more information you provide, the easier it will be to validate and fix.
|
||||
|
||||
#### Pull Requests
|
||||
|
||||
1. Fork the repository and create a topic branch.
|
||||
2. Be sure to associate commits to their corresponding issue using `[#1]` or `[Closes #1]` if the commit resolves the issue.
|
||||
5. Push to your fork and submit a pull-request with an explanation and reference to the original issue (if there is one).
|
||||
17
immoweb/node_modules/sightglass/bower.json
generated
vendored
Normal file
17
immoweb/node_modules/sightglass/bower.json
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"name": "sightglass",
|
||||
"main": "index.js",
|
||||
"version": "0.2.6",
|
||||
"homepage": "https://github.com/mikeric/sightglass",
|
||||
"authors": [
|
||||
"Michael Richards"
|
||||
],
|
||||
"description": "Observable keypath engine.",
|
||||
"keywords": [
|
||||
"observe",
|
||||
"observable",
|
||||
"keypath",
|
||||
"engine"
|
||||
],
|
||||
"license": "MIT"
|
||||
}
|
||||
18
immoweb/node_modules/sightglass/component.json
generated
vendored
Normal file
18
immoweb/node_modules/sightglass/component.json
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"name": "sightglass",
|
||||
"repo": "mikeric/sightglass",
|
||||
"description": "Observable keypath engine.",
|
||||
"version": "0.2.6",
|
||||
"author": "Michael Richards",
|
||||
"twitter": "@mikeric",
|
||||
"keywords": [
|
||||
"observe",
|
||||
"observable",
|
||||
"keypath",
|
||||
"engine"
|
||||
],
|
||||
"scripts": [
|
||||
"index.js"
|
||||
],
|
||||
"license": "MIT"
|
||||
}
|
||||
214
immoweb/node_modules/sightglass/index.js
generated
vendored
Normal file
214
immoweb/node_modules/sightglass/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,214 @@
|
|||
(function() {
|
||||
// Public sightglass interface.
|
||||
function sightglass(obj, keypath, callback, options) {
|
||||
return new Observer(obj, keypath, callback, options)
|
||||
}
|
||||
|
||||
// Batteries not included.
|
||||
sightglass.adapters = {}
|
||||
|
||||
// Constructs a new keypath observer and kicks things off.
|
||||
function Observer(obj, keypath, callback, options) {
|
||||
this.options = options || {}
|
||||
this.options.adapters = this.options.adapters || {}
|
||||
this.obj = obj
|
||||
this.keypath = keypath
|
||||
this.callback = callback
|
||||
this.objectPath = []
|
||||
this.update = this.update.bind(this)
|
||||
this.parse()
|
||||
|
||||
if (isObject(this.target = this.realize())) {
|
||||
this.set(true, this.key, this.target, this.callback)
|
||||
}
|
||||
}
|
||||
|
||||
// Tokenizes the provided keypath string into interface + path tokens for the
|
||||
// observer to work with.
|
||||
Observer.tokenize = function(keypath, interfaces, root) {
|
||||
var tokens = []
|
||||
var current = {i: root, path: ''}
|
||||
var index, chr
|
||||
|
||||
for (index = 0; index < keypath.length; index++) {
|
||||
chr = keypath.charAt(index)
|
||||
|
||||
if (!!~interfaces.indexOf(chr)) {
|
||||
tokens.push(current)
|
||||
current = {i: chr, path: ''}
|
||||
} else {
|
||||
current.path += chr
|
||||
}
|
||||
}
|
||||
|
||||
tokens.push(current)
|
||||
return tokens
|
||||
}
|
||||
|
||||
// Parses the keypath using the interfaces defined on the view. Sets variables
|
||||
// for the tokenized keypath as well as the end key.
|
||||
Observer.prototype.parse = function() {
|
||||
var interfaces = this.interfaces()
|
||||
var root, path
|
||||
|
||||
if (!interfaces.length) {
|
||||
error('Must define at least one adapter interface.')
|
||||
}
|
||||
|
||||
if (!!~interfaces.indexOf(this.keypath[0])) {
|
||||
root = this.keypath[0]
|
||||
path = this.keypath.substr(1)
|
||||
} else {
|
||||
if (typeof (root = this.options.root || sightglass.root) === 'undefined') {
|
||||
error('Must define a default root adapter.')
|
||||
}
|
||||
|
||||
path = this.keypath
|
||||
}
|
||||
|
||||
this.tokens = Observer.tokenize(path, interfaces, root)
|
||||
this.key = this.tokens.pop()
|
||||
}
|
||||
|
||||
// Realizes the full keypath, attaching observers for every key and correcting
|
||||
// old observers to any changed objects in the keypath.
|
||||
Observer.prototype.realize = function() {
|
||||
var current = this.obj
|
||||
var unreached = false
|
||||
var prev
|
||||
|
||||
this.tokens.forEach(function(token, index) {
|
||||
if (isObject(current)) {
|
||||
if (typeof this.objectPath[index] !== 'undefined') {
|
||||
if (current !== (prev = this.objectPath[index])) {
|
||||
this.set(false, token, prev, this.update)
|
||||
this.set(true, token, current, this.update)
|
||||
this.objectPath[index] = current
|
||||
}
|
||||
} else {
|
||||
this.set(true, token, current, this.update)
|
||||
this.objectPath[index] = current
|
||||
}
|
||||
|
||||
current = this.get(token, current)
|
||||
} else {
|
||||
if (unreached === false) {
|
||||
unreached = index
|
||||
}
|
||||
|
||||
if (prev = this.objectPath[index]) {
|
||||
this.set(false, token, prev, this.update)
|
||||
}
|
||||
}
|
||||
}, this)
|
||||
|
||||
if (unreached !== false) {
|
||||
this.objectPath.splice(unreached)
|
||||
}
|
||||
|
||||
return current
|
||||
}
|
||||
|
||||
// Updates the keypath. This is called when any intermediary key is changed.
|
||||
Observer.prototype.update = function() {
|
||||
var next, oldValue
|
||||
|
||||
if ((next = this.realize()) !== this.target) {
|
||||
if (isObject(this.target)) {
|
||||
this.set(false, this.key, this.target, this.callback)
|
||||
}
|
||||
|
||||
if (isObject(next)) {
|
||||
this.set(true, this.key, next, this.callback)
|
||||
}
|
||||
|
||||
oldValue = this.value()
|
||||
this.target = next
|
||||
|
||||
// Always call callback if value is a function. If not a function, call callback only if value changed
|
||||
if (this.value() instanceof Function || this.value() !== oldValue) this.callback()
|
||||
}
|
||||
}
|
||||
|
||||
// Reads the current end value of the observed keypath. Returns undefined if
|
||||
// the full keypath is unreachable.
|
||||
Observer.prototype.value = function() {
|
||||
if (isObject(this.target)) {
|
||||
return this.get(this.key, this.target)
|
||||
}
|
||||
}
|
||||
|
||||
// Sets the current end value of the observed keypath. Calling setValue when
|
||||
// the full keypath is unreachable is a no-op.
|
||||
Observer.prototype.setValue = function(value) {
|
||||
if (isObject(this.target)) {
|
||||
this.adapter(this.key).set(this.target, this.key.path, value)
|
||||
}
|
||||
}
|
||||
|
||||
// Gets the provided key on an object.
|
||||
Observer.prototype.get = function(key, obj) {
|
||||
return this.adapter(key).get(obj, key.path)
|
||||
}
|
||||
|
||||
// Observes or unobserves a callback on the object using the provided key.
|
||||
Observer.prototype.set = function(active, key, obj, callback) {
|
||||
var action = active ? 'observe' : 'unobserve'
|
||||
this.adapter(key)[action](obj, key.path, callback)
|
||||
}
|
||||
|
||||
// Returns an array of all unique adapter interfaces available.
|
||||
Observer.prototype.interfaces = function() {
|
||||
var interfaces = Object.keys(this.options.adapters)
|
||||
|
||||
Object.keys(sightglass.adapters).forEach(function(i) {
|
||||
if (!~interfaces.indexOf(i)) {
|
||||
interfaces.push(i)
|
||||
}
|
||||
})
|
||||
|
||||
return interfaces
|
||||
}
|
||||
|
||||
// Convenience function to grab the adapter for a specific key.
|
||||
Observer.prototype.adapter = function(key) {
|
||||
return this.options.adapters[key.i] ||
|
||||
sightglass.adapters[key.i]
|
||||
}
|
||||
|
||||
// Unobserves the entire keypath.
|
||||
Observer.prototype.unobserve = function() {
|
||||
var obj
|
||||
|
||||
this.tokens.forEach(function(token, index) {
|
||||
if (obj = this.objectPath[index]) {
|
||||
this.set(false, token, obj, this.update)
|
||||
}
|
||||
}, this)
|
||||
|
||||
if (isObject(this.target)) {
|
||||
this.set(false, this.key, this.target, this.callback)
|
||||
}
|
||||
}
|
||||
|
||||
// Check if a value is an object than can be observed.
|
||||
function isObject(obj) {
|
||||
return typeof obj === 'object' && obj !== null
|
||||
}
|
||||
|
||||
// Error thrower.
|
||||
function error(message) {
|
||||
throw new Error('[sightglass] ' + message)
|
||||
}
|
||||
|
||||
// Export module for Node and the browser.
|
||||
if (typeof module !== 'undefined' && module.exports) {
|
||||
module.exports = sightglass
|
||||
} else if (typeof define === 'function' && define.amd) {
|
||||
define([], function() {
|
||||
return this.sightglass = sightglass
|
||||
})
|
||||
} else {
|
||||
this.sightglass = sightglass
|
||||
}
|
||||
}).call(this);
|
||||
49
immoweb/node_modules/sightglass/package.json
generated
vendored
Normal file
49
immoweb/node_modules/sightglass/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
"_from": "sightglass@~0.2.4",
|
||||
"_id": "sightglass@0.2.6",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-kSC7hS0lnPghJ0hWN1u9+QCYOEE=",
|
||||
"_location": "/sightglass",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "sightglass@~0.2.4",
|
||||
"name": "sightglass",
|
||||
"escapedName": "sightglass",
|
||||
"rawSpec": "~0.2.4",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~0.2.4"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/rivets"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/sightglass/-/sightglass-0.2.6.tgz",
|
||||
"_shasum": "9120bb852d259cf821274856375bbdf900983841",
|
||||
"_spec": "sightglass@~0.2.4",
|
||||
"_where": "/home/kadir/workspace/webimmo/node_modules/rivets",
|
||||
"author": {
|
||||
"name": "Michael Richards"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/mikeric/sightglass/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Observable keypath engine.",
|
||||
"homepage": "https://github.com/mikeric/sightglass#readme",
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/mikeric/sightglass/blob/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"main": "index.js",
|
||||
"name": "sightglass",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/mikeric/sightglass.git"
|
||||
},
|
||||
"url": "http://github.com/mikeric/sightglass",
|
||||
"version": "0.2.6"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue