-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6a93e48
commit 22a2b81
Showing
17 changed files
with
517 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 16 additions & 13 deletions
29
assets/bower_components/polymer/bower_components/web-component-tester/browser.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
assets/bower_components/polymer/bower_components/web-component-tester/browser.js.map
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
assets/bower_components/vega-elements/bower_components/d3-cloud/bower.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
assets/bower_components/vega-elements/bower_components/d3-dispatch/.bower.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "d3-dispatch", | ||
"homepage": "https://github.com/d3/d3-dispatch", | ||
"version": "0.2.6", | ||
"_release": "0.2.6", | ||
"_resolution": { | ||
"type": "version", | ||
"tag": "v0.2.6", | ||
"commit": "bd1ead61f8f15eb0de5dde145bb07d06167d98b4" | ||
}, | ||
"_source": "https://github.com/d3/d3-dispatch.git", | ||
"_target": "0.2.x", | ||
"_originalSource": "d3-dispatch" | ||
} |
12 changes: 12 additions & 0 deletions
12
assets/bower_components/vega-elements/bower_components/d3-dispatch/.eslintrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
ecmaFeatures: | ||
modules: true | ||
|
||
env: | ||
es6: true | ||
browser: true | ||
|
||
extends: | ||
"eslint:recommended" | ||
|
||
rules: | ||
no-cond-assign: 0 |
5 changes: 5 additions & 0 deletions
5
assets/bower_components/vega-elements/bower_components/d3-dispatch/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*.sublime-workspace | ||
.DS_Store | ||
build/ | ||
node_modules | ||
npm-debug.log |
3 changes: 3 additions & 0 deletions
3
assets/bower_components/vega-elements/bower_components/d3-dispatch/.npmignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.sublime-* | ||
build/*.zip | ||
test/ |
27 changes: 27 additions & 0 deletions
27
assets/bower_components/vega-elements/bower_components/d3-dispatch/LICENSE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Copyright 2010-2015 Mike Bostock | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
* Neither the name of the author nor the names of contributors may be used to | ||
endorse or promote products derived from this software without specific prior | ||
written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
63 changes: 63 additions & 0 deletions
63
assets/bower_components/vega-elements/bower_components/d3-dispatch/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# d3-dispatch | ||
|
||
Dispatching is a convenient mechanism for separating concerns with loosely-coupled code: register named callbacks and then call them with arbitrary arguments. A variety of D3 components, such as [d3-request](https://github.com/d3/d3-request), use this mechanism to emit events to listeners. Think of this like Node’s [EventEmitter](https://nodejs.org/api/events.html), except every listener has a well-defined name so it’s easy to remove or replace them. | ||
|
||
For example, to create a dispatch for *start* and *end* events: | ||
|
||
```js | ||
var dispatch = d3.dispatch("start", "end"); | ||
``` | ||
|
||
You can then register callbacks for these events using [*dispatch*.on](#dispatch_on): | ||
|
||
```js | ||
dispatch.on("start", callback1); | ||
dispatch.on("start.foo", callback2); | ||
dispatch.on("end", callback3); | ||
``` | ||
|
||
Then, you can dispatch a *start* event using [*dispatch*.*type*](#dispatch_type): | ||
|
||
```js | ||
dispatch.start("pass arguments to callbacks here"); | ||
``` | ||
|
||
Want a more involved example? See how to use [d3-dispatch for coordinated views](http://bl.ocks.org/mbostock/5872848). | ||
|
||
## Installing | ||
|
||
If you use NPM, `npm install d3-dispatch`. Otherwise, download the [latest release](https://github.com/d3/d3-dispatch/releases/latest). The released bundle supports AMD, CommonJS, and vanilla environments. Create a custom build using [Rollup](https://github.com/rollup/rollup) or your preferred bundler. You can also load directly from [d3js.org](https://d3js.org): | ||
|
||
```html | ||
<script src="https://d3js.org/d3-dispatch.v0.2.min.js"></script> | ||
``` | ||
|
||
In a vanilla environment, a `d3_dispatch` global is exported. [Try d3-dispatch in your browser.](https://tonicdev.com/npm/d3-dispatch) | ||
|
||
## API Reference | ||
|
||
<a name="dispatch" href="#dispatch">#</a> d3.<b>dispatch</b>(<i>types…</i>) | ||
|
||
Creates a new dispatch for the specified event *types*. Each *type* is a string, such as `"start"` or `"end"`; for each type, [a method](#dispatch_type) is exposed on the returned dispatch for invoking the callbacks of that type. | ||
|
||
<a name="dispatch_on" href="#dispatch_on">#</a> *dispatch*.<b>on</b>(<i>name</i>[, <i>callback</i>]) | ||
|
||
Adds, removes or gets a *callback* of the specified *name*. | ||
|
||
The *name* is a string, such as `"start"` or `"end"`. A name consists of a event type optionally followed by a period (“.”) and a namespace; the optional namespace allows multiple callbacks to be registered to receive events of the same type, such as `"start.foo"` and `"start.bar"`. You can remove all callbacks for the namespace “foo” by saying `dispatch.on(".foo", null)`. | ||
|
||
If a *callback* function is specified, it is registered for the specified (fully-qualified) *name*. If a callback was already registered for the same name, the existing callback is removed before the new callback is added. If *callback* is not specified, returns the current callback for the specified *name*, if any. The specified *callback* is invoked with the context and arguments specified by the caller; see [*dispatch*.*type*](#dispatch_type). | ||
|
||
<a name="dispatch_type" href="#dispatch_type">#</a> *dispatch*.<b>*type*</b>(<i>arguments…</i>) | ||
|
||
The *type* method (such as `dispatch.start` for the *start* event) invokes each registered callback for the given type, passing the callback the specified *arguments*. The `this` context will be used as the context of the registered callbacks. | ||
|
||
For example, if you wanted to dispatch your *custom* callbacks after handling a native *click* event, while preserving the current `this` context and arguments, you could say: | ||
|
||
```js | ||
selection.on("click", function() { | ||
dispatch.custom.apply(this, arguments); | ||
}); | ||
``` | ||
|
||
You can pass whatever arguments you want to callbacks; most commonly, you might create an object that represents an event, or pass the current datum (*d*) and index (*i*). See [function.call](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/Call) and [function.apply](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/Apply) for further information. |
13 changes: 13 additions & 0 deletions
13
...s/bower_components/vega-elements/bower_components/d3-dispatch/d3-dispatch.sublime-project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"folders": [ | ||
{ | ||
"path": ".", | ||
"file_exclude_patterns": [ | ||
"*.sublime-workspace" | ||
], | ||
"folder_exclude_patterns": [ | ||
"build" | ||
] | ||
} | ||
] | ||
} |
1 change: 1 addition & 0 deletions
1
assets/bower_components/vega-elements/bower_components/d3-dispatch/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export {default as dispatch} from "./src/dispatch"; |
35 changes: 35 additions & 0 deletions
35
assets/bower_components/vega-elements/bower_components/d3-dispatch/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"name": "d3-dispatch", | ||
"version": "0.2.6", | ||
"description": "Register named callbacks and call them with arguments.", | ||
"keywords": [ | ||
"d3", | ||
"event", | ||
"listener", | ||
"dispatch" | ||
], | ||
"homepage": "https://github.com/d3/d3-dispatch", | ||
"license": "BSD-3-Clause", | ||
"author": { | ||
"name": "Mike Bostock", | ||
"url": "http://bost.ocks.org/mike" | ||
}, | ||
"main": "build/d3-dispatch.js", | ||
"jsnext:main": "index", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/d3/d3-dispatch.git" | ||
}, | ||
"scripts": { | ||
"pretest": "mkdir -p build && node -e 'process.stdout.write(\"var version = \\\"\" + require(\"./package.json\").version + \"\\\"; export * from \\\"../index\\\"; export {version};\");' > build/bundle.js && rollup -f umd -n d3_dispatch -o build/d3-dispatch.js -- build/bundle.js", | ||
"test": "faucet `find test -name '*-test.js'` && eslint index.js src", | ||
"prepublish": "npm run test && uglifyjs build/d3-dispatch.js -c -m -o build/d3-dispatch.min.js && rm -f build/d3-dispatch.zip && zip -j build/d3-dispatch.zip -- LICENSE README.md build/d3-dispatch.js build/d3-dispatch.min.js", | ||
"postpublish": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'`; git push && git tag -am \"Release $VERSION.\" v${VERSION} && git push --tags && cp build/d3-dispatch.js ../d3.github.com/d3-dispatch.v0.2.js && cp build/d3-dispatch.min.js ../d3.github.com/d3-dispatch.v0.2.min.js && cd ../d3.github.com && git add d3-dispatch.v0.2.js d3-dispatch.v0.2.min.js && git commit -m \"d3-dispatch ${VERSION}\" && git push" | ||
}, | ||
"devDependencies": { | ||
"faucet": "0.0", | ||
"rollup": "0.25", | ||
"tape": "4", | ||
"uglify-js": "2" | ||
} | ||
} |
93 changes: 93 additions & 0 deletions
93
assets/bower_components/vega-elements/bower_components/d3-dispatch/src/dispatch.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
function dispatch() { | ||
return new Dispatch(arguments); | ||
} | ||
|
||
function Dispatch(types) { | ||
var i = -1, | ||
n = types.length, | ||
callbacksByType = {}, | ||
callbackByName = {}, | ||
type, | ||
that = this; | ||
|
||
that.on = function(type, callback) { | ||
type = parseType(type); | ||
|
||
// Return the current callback, if any. | ||
if (arguments.length < 2) { | ||
return (callback = callbackByName[type.name]) && callback.value; | ||
} | ||
|
||
// If a type was specified… | ||
if (type.type) { | ||
var callbacks = callbacksByType[type.type], | ||
callback0 = callbackByName[type.name], | ||
i; | ||
|
||
// Remove the current callback, if any, using copy-on-remove. | ||
if (callback0) { | ||
callback0.value = null; | ||
i = callbacks.indexOf(callback0); | ||
callbacksByType[type.type] = callbacks = callbacks.slice(0, i).concat(callbacks.slice(i + 1)); | ||
delete callbackByName[type.name]; | ||
} | ||
|
||
// Add the new callback, if any. | ||
if (callback) { | ||
callback = {value: callback}; | ||
callbackByName[type.name] = callback; | ||
callbacks.push(callback); | ||
} | ||
} | ||
|
||
// Otherwise, if a null callback was specified, remove all callbacks with the given name. | ||
else if (callback == null) { | ||
for (var otherType in callbacksByType) { | ||
if (callback = callbackByName[otherType + type.name]) { | ||
callback.value = null; | ||
callbacks = callbacksByType[otherType]; | ||
i = callbacks.indexOf(callback); | ||
callbacksByType[otherType] = callbacks.slice(0, i).concat(callbacks.slice(i + 1)); | ||
delete callbackByName[callback.name]; | ||
} | ||
} | ||
} | ||
|
||
return that; | ||
}; | ||
|
||
while (++i < n) { | ||
type = types[i] + ""; | ||
if (!type || (type in that)) throw new Error("illegal or duplicate type: " + type); | ||
callbacksByType[type] = []; | ||
that[type] = applier(type); | ||
} | ||
|
||
function parseType(type) { | ||
var i = (type += "").indexOf("."), name = type; | ||
if (i >= 0) type = type.slice(0, i); else name += "."; | ||
if (type && !callbacksByType.hasOwnProperty(type)) throw new Error("unknown type: " + type); | ||
return {type: type, name: name}; | ||
} | ||
|
||
function applier(type) { | ||
return function() { | ||
var callbacks = callbacksByType[type], // Defensive reference; copy-on-remove. | ||
callbackValue, | ||
i = -1, | ||
n = callbacks.length; | ||
|
||
while (++i < n) { | ||
if (callbackValue = callbacks[i].value) { | ||
callbackValue.apply(this, arguments); | ||
} | ||
} | ||
|
||
return that; | ||
}; | ||
} | ||
} | ||
|
||
dispatch.prototype = Dispatch.prototype; // allow instanceof | ||
|
||
export default dispatch; |
Oops, something went wrong.