add lisp packages
This commit is contained in:
58
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/LICENSE
generated
vendored
Normal file
58
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
Copyright (c) 2010-2015, Michael 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.
|
||||
|
||||
* The name Michael Bostock may not 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 MICHAEL BOSTOCK 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.
|
||||
|
||||
TERMS OF USE - EASING EQUATIONS
|
||||
|
||||
Open source under the BSD License.
|
||||
|
||||
Copyright 2001 Robert Penner
|
||||
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.
|
||||
448
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/README.md
generated
vendored
Normal file
448
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/README.md
generated
vendored
Normal file
@@ -0,0 +1,448 @@
|
||||
# d3-transition
|
||||
|
||||
A transition is a [selection](https://github.com/d3/d3-selection)-like interface for animating changes to the DOM. Instead of applying changes instantaneously, transitions smoothly interpolate the DOM from its current state to the desired target state over a given duration.
|
||||
|
||||
To apply a transition, select elements, call [*selection*.transition](#selection_transition), and then make the desired changes. For example:
|
||||
|
||||
```js
|
||||
d3.select("body")
|
||||
.transition()
|
||||
.style("background-color", "red");
|
||||
```
|
||||
|
||||
Transitions support most selection methods (such as [*transition*.attr](#transition_attr) and [*transition*.style](#transition_style) in place of [*selection*.attr](https://github.com/d3/d3-selection#selection_attr) and [*selection*.style](https://github.com/d3/d3-selection#selection_style)), but not all methods are supported; for example, you must [append](https://github.com/d3/d3-selection#selection_append) elements or [bind data](https://github.com/d3/d3-selection#joining-data) before a transition starts. A [*transition*.remove](#transition_remove) operator is provided for convenient removal of elements when the transition ends.
|
||||
|
||||
To compute intermediate state, transitions leverage a variety of [built-in interpolators](https://github.com/d3/d3-interpolate). [Colors](https://github.com/d3/d3-interpolate#interpolateRgb), [numbers](https://github.com/d3/d3-interpolate#interpolateNumber), and [transforms](https://github.com/d3/d3-interpolate#interpolateTransform) are automatically detected. [Strings](https://github.com/d3/d3-interpolate#interpolateString) with embedded numbers are also detected, as is common with many styles (such as padding or font sizes) and paths. To specify a custom interpolator, use [*transition*.attrTween](#transition_attrTween), [*transition*.styleTween](#transition_styleTween) or [*transition*.tween](#transition_tween).
|
||||
|
||||
## Installing
|
||||
|
||||
If you use NPM, `npm install d3-transition`. Otherwise, download the [latest release](https://github.com/d3/d3-transition/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-transition.v1.min.js) or as part of [D3](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported:
|
||||
|
||||
```html
|
||||
<script src="https://d3js.org/d3-color.v1.min.js"></script>
|
||||
<script src="https://d3js.org/d3-dispatch.v1.min.js"></script>
|
||||
<script src="https://d3js.org/d3-ease.v1.min.js"></script>
|
||||
<script src="https://d3js.org/d3-interpolate.v1.min.js"></script>
|
||||
<script src="https://d3js.org/d3-selection.v1.min.js"></script>
|
||||
<script src="https://d3js.org/d3-timer.v1.min.js"></script>
|
||||
<script src="https://d3js.org/d3-transition.v1.min.js"></script>
|
||||
<script>
|
||||
|
||||
var transition = d3.transition();
|
||||
|
||||
</script>
|
||||
```
|
||||
|
||||
[Try d3-transition in your browser.](https://tonicdev.com/npm/d3-transition)
|
||||
|
||||
## API Reference
|
||||
|
||||
* [Selecting Elements](#selecting-elements)
|
||||
* [Modifying Elements](#modifying-elements)
|
||||
* [Timing](#timing)
|
||||
* [Control Flow](#control-flow)
|
||||
* [The Life of a Transition](#the-life-of-a-transition)
|
||||
|
||||
### Selecting Elements
|
||||
|
||||
Transitions are derived from [selections](https://github.com/d3/d3-selection) via [*selection*.transition](#selection_transition). You can also create a transition on the document root element using [d3.transition](#transition).
|
||||
|
||||
<a name="selection_transition" href="#selection_transition">#</a> <i>selection</i>.<b>transition</b>([<i>name</i>]) [<>](https://github.com/d3/d3-transition/blob/master/src/selection/transition.js "Source")
|
||||
|
||||
Returns a new transition on the given *selection* with the specified *name*. If a *name* is not specified, null is used. The new transition is only exclusive with other transitions of the same name.
|
||||
|
||||
If the *name* is a [transition](#transition) instance, the returned transition has the same id and name as the specified transition. If a transition with the same id already exists on a selected element, the existing transition is returned for that element. Otherwise, the timing of the returned transition is inherited from the existing transition of the same id on the nearest ancestor of each selected element. Thus, this method can be used to synchronize a transition across multiple selections, or to re-select a transition for specific elements and modify its configuration. For example:
|
||||
|
||||
```js
|
||||
var t = d3.transition()
|
||||
.duration(750)
|
||||
.ease(d3.easeLinear);
|
||||
|
||||
d3.selectAll(".apple").transition(t)
|
||||
.style("fill", "red");
|
||||
|
||||
d3.selectAll(".orange").transition(t)
|
||||
.style("fill", "orange");
|
||||
```
|
||||
|
||||
If the specified *transition* is not found on a selected node or its ancestors (such as if the transition [already ended](#the-life-of-a-transition)), the default timing parameters are used; however, in a future release, this will likely be changed to throw an error. See [#59](https://github.com/d3/d3-transition/issues/59).
|
||||
|
||||
<a name="selection_interrupt" href="#selection_interrupt">#</a> <i>selection</i>.<b>interrupt</b>([<i>name</i>]) [<>](https://github.com/d3/d3-transition/blob/master/src/selection/interrupt.js "Source")
|
||||
|
||||
Interrupts the active transition of the specified *name* on the selected elements, and cancels any pending transitions with the specified *name*, if any. If a name is not specified, null is used.
|
||||
|
||||
Interrupting a transition on an element has no effect on any transitions on any descendant elements. For example, an [axis transition](https://github.com/d3/d3-axis) consists of multiple independent, synchronized transitions on the descendants of the axis [G element](https://www.w3.org/TR/SVG/struct.html#Groups) (the tick lines, the tick labels, the domain path, *etc.*). To interrupt the axis transition, you must therefore interrupt the descendants:
|
||||
|
||||
```js
|
||||
selection.selectAll("*").interrupt();
|
||||
```
|
||||
|
||||
The [universal selector](https://developer.mozilla.org/en-US/docs/Web/CSS/Universal_selectors), `*`, selects all descendant elements. If you also want to interrupt the G element itself:
|
||||
|
||||
```js
|
||||
selection.interrupt().selectAll("*").interrupt();
|
||||
```
|
||||
|
||||
<a name="interrupt" href="#interrupt">#</a> d3.<b>interrupt</b>(<i>node</i>[, <i>name</i>]) [<>](https://github.com/d3/d3-transition/blob/master/src/interrupt.js "Source")
|
||||
|
||||
Interrupts the active transition of the specified *name* on the specified *node*, and cancels any pending transitions with the specified *name*, if any. If a name is not specified, null is used. See also [*selection*.interrupt](#selection_interrupt).
|
||||
|
||||
<a name="transition" href="#transition">#</a> d3.<b>transition</b>([<i>name</i>]) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/index.js#L29 "Source")
|
||||
|
||||
Returns a new transition on the root element, `document.documentElement`, with the specified *name*. If a *name* is not specified, null is used. The new transition is only exclusive with other transitions of the same name. The *name* may also be a [transition](#transition) instance; see [*selection*.transition](#selection_transition). This method is equivalent to:
|
||||
|
||||
```js
|
||||
d3.selection()
|
||||
.transition(name)
|
||||
```
|
||||
|
||||
This function can also be used to test for transitions (`instanceof d3.transition`) or to extend the transition prototype.
|
||||
|
||||
<a name="transition_select" href="#transition_select">#</a> <i>transition</i>.<b>select</b>(<i>selector</i>) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/select.js "Source")
|
||||
|
||||
For each selected element, selects the first descendant element that matches the specified *selector* string, if any, and returns a transition on the resulting selection. The *selector* may be specified either as a selector string or a function. If a function, it is evaluated for each selected element, in order, being passed the current datum `d` and index `i`, with the `this` context as the current DOM element. The new transition has the same id, name and timing as this transition; however, if a transition with the same id already exists on a selected element, the existing transition is returned for that element.
|
||||
|
||||
This method is equivalent to deriving the selection for this transition via [*transition*.selection](#transition_selection), creating a subselection via [*selection*.select](https://github.com/d3/d3-selection#selection_select), and then creating a new transition via [*selection*.transition](#selection_transition):
|
||||
|
||||
```js
|
||||
transition
|
||||
.selection()
|
||||
.select(selector)
|
||||
.transition(transition)
|
||||
```
|
||||
|
||||
<a name="transition_selectAll" href="#transition_selectAll">#</a> <i>transition</i>.<b>selectAll</b>(<i>selector</i>) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/selectAll.js "Source")
|
||||
|
||||
For each selected element, selects all descendant elements that match the specified *selector* string, if any, and returns a transition on the resulting selection. The *selector* may be specified either as a selector string or a function. If a function, it is evaluated for each selected element, in order, being passed the current datum `d` and index `i`, with the `this` context as the current DOM element. The new transition has the same id, name and timing as this transition; however, if a transition with the same id already exists on a selected element, the existing transition is returned for that element.
|
||||
|
||||
This method is equivalent to deriving the selection for this transition via [*transition*.selection](#transition_selection), creating a subselection via [*selection*.selectAll](https://github.com/d3/d3-selection#selection_selectAll), and then creating a new transition via [*selection*.transition](#selection_transition):
|
||||
|
||||
```js
|
||||
transition
|
||||
.selection()
|
||||
.selectAll(selector)
|
||||
.transition(transition)
|
||||
```
|
||||
|
||||
<a name="transition_filter" href="#transition_filter">#</a> <i>transition</i>.<b>filter</b>(<i>filter</i>) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/filter.js "Source")
|
||||
|
||||
For each selected element, selects only the elements that match the specified *filter*, and returns a transition on the resulting selection. The *filter* may be specified either as a selector string or a function. If a function, it is evaluated for each selected element, in order, being passed the current datum `d` and index `i`, with the `this` context as the current DOM element. The new transition has the same id, name and timing as this transition; however, if a transition with the same id already exists on a selected element, the existing transition is returned for that element.
|
||||
|
||||
This method is equivalent to deriving the selection for this transition via [*transition*.selection](#transition_selection), creating a subselection via [*selection*.filter](https://github.com/d3/d3-selection#selection_filter), and then creating a new transition via [*selection*.transition](#selection_transition):
|
||||
|
||||
```js
|
||||
transition
|
||||
.selection()
|
||||
.filter(filter)
|
||||
.transition(transition)
|
||||
```
|
||||
|
||||
<a name="transition_merge" href="#transition_merge">#</a> <i>transition</i>.<b>merge</b>(<i>other</i>) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/merge.js "Source")
|
||||
|
||||
Returns a new transition merging this transition with the specified *other* transition, which must have the same id as this transition. The returned transition has the same number of groups, the same parents, the same name and the same id as this transition. Any missing (null) elements in this transition are filled with the corresponding element, if present (not null), from the *other* transition.
|
||||
|
||||
This method is equivalent to deriving the selection for this transition via [*transition*.selection](#transition_selection), merging with the selection likewise derived from the *other* transition via [*selection*.merge](https://github.com/d3/d3-selection#selection_merge), and then creating a new transition via [*selection*.transition](#selection_transition):
|
||||
|
||||
```js
|
||||
transition
|
||||
.selection()
|
||||
.merge(other.selection())
|
||||
.transition(transition)
|
||||
```
|
||||
|
||||
<a name="transition_transition" href="#transition_transition">#</a> <i>transition</i>.<b>transition</b>() [<>](https://github.com/d3/d3-transition/blob/master/src/transition/transition.js "Source")
|
||||
|
||||
Returns a new transition on the same selected elements as this transition, scheduled to start when this transition ends. The new transition inherits a reference time equal to this transition’s time plus its [delay](#transition_delay) and [duration](#transition_duration). The new transition also inherits this transition’s name, duration, and [easing](#transition_ease). This method can be used to schedule a sequence of chained transitions. For example:
|
||||
|
||||
```js
|
||||
d3.selectAll(".apple")
|
||||
.transition() // First fade to green.
|
||||
.style("fill", "green")
|
||||
.transition() // Then red.
|
||||
.style("fill", "red")
|
||||
.transition() // Wait one second. Then brown, and remove.
|
||||
.delay(1000)
|
||||
.style("fill", "brown")
|
||||
.remove();
|
||||
```
|
||||
|
||||
The delay for each transition is relative to its previous transition. Thus, in the above example, apples will stay red for one second before the last transition to brown starts.
|
||||
|
||||
<a name="transition_selection" href="#transition_selection">#</a> <i>transition</i>.<b>selection</b>() [<>](https://github.com/d3/d3-transition/blob/master/src/transition/selection.js "Source")
|
||||
|
||||
Returns the [selection](https://github.com/d3/d3-selection#selection) corresponding to this transition.
|
||||
|
||||
<a name="active" href="#active">#</a> d3.<b>active</b>(<i>node</i>[, <i>name</i>]) [<>](https://github.com/d3/d3-transition/blob/master/src/active.js "Source")
|
||||
|
||||
Returns the active transition on the specified *node* with the specified *name*, if any. If no *name* is specified, null is used. Returns null if there is no such active transition on the specified node. This method is useful for creating chained transitions. For example, to initiate disco mode:
|
||||
|
||||
```js
|
||||
d3.selectAll("circle").transition()
|
||||
.delay(function(d, i) { return i * 50; })
|
||||
.on("start", function repeat() {
|
||||
d3.active(this)
|
||||
.style("fill", "red")
|
||||
.transition()
|
||||
.style("fill", "green")
|
||||
.transition()
|
||||
.style("fill", "blue")
|
||||
.transition()
|
||||
.on("start", repeat);
|
||||
});
|
||||
```
|
||||
|
||||
See [chained transitions](http://bl.ocks.org/mbostock/70d5541b547cc222aa02) for an example.
|
||||
|
||||
### Modifying Elements
|
||||
|
||||
After selecting elements and creating a transition with [*selection*.transition](#selection_transition), use the transition’s transformation methods to affect document content.
|
||||
|
||||
<a name="transition_attr" href="#transition_attr">#</a> <i>transition</i>.<b>attr</b>(<i>name</i>, <i>value</i>) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/attr.js "Source")
|
||||
|
||||
For each selected element, assigns the [attribute tween](#transition_attrTween) for the attribute with the specified *name* to the specified target *value*. The starting value of the tween is the attribute’s value when the transition starts. The target *value* may be specified either as a constant or a function. If a function, it is immediately evaluated for each selected element, in order, being passed the current datum `d` and index `i`, with the `this` context as the current DOM element.
|
||||
|
||||
If the target value is null, the attribute is removed when the transition starts. Otherwise, an interpolator is chosen based on the type of the target value, using the following algorithm:
|
||||
|
||||
1. If *value* is a number, use [interpolateNumber](https://github.com/d3/d3-interpolate#interpolateNumber).
|
||||
2. If *value* is a [color](https://github.com/d3/d3-color#color) or a string coercible to a color, use [interpolateRgb](https://github.com/d3/d3-interpolate#interpolateRgb).
|
||||
3. Use [interpolateString](https://github.com/d3/d3-interpolate#interpolateString).
|
||||
|
||||
To apply a different interpolator, use [*transition*.attrTween](#transition_attrTween).
|
||||
|
||||
<a name="transition_attrTween" href="#transition_attrTween">#</a> <i>transition</i>.<b>attrTween</b>(<i>name</i>[, <i>factory</i>]) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/attrTween.js "Source")
|
||||
|
||||
If *factory* is specified and not null, assigns the attribute [tween](#transition_tween) for the attribute with the specified *name* to the specified interpolator *factory*. An interpolator factory is a function that returns an [interpolator](https://github.com/d3/d3-interpolate); when the transition starts, the *factory* is evaluated for each selected element, in order, being passed the current datum `d` and index `i`, with the `this` context as the current DOM element. The returned interpolator will then be invoked for each frame of the transition, in order, being passed the [eased](#transition_ease) time *t*, typically in the range [0, 1]. Lastly, the return value of the interpolator will be used to set the attribute value. The interpolator must return a string. (To remove an attribute at the start of a transition, use [*transition*.attr](#transition_attr); to remove an attribute at the end of a transition, use [*transition*.on](#transition_on) to listen for the *end* event.)
|
||||
|
||||
If the specified *factory* is null, removes the previously-assigned attribute tween of the specified *name*, if any. If *factory* is not specified, returns the current interpolator factory for attribute with the specified *name*, or undefined if no such tween exists.
|
||||
|
||||
For example, to interpolate the fill attribute from red to blue:
|
||||
|
||||
```js
|
||||
transition.attrTween("fill", function() {
|
||||
return d3.interpolateRgb("red", "blue");
|
||||
});
|
||||
```
|
||||
|
||||
Or to interpolate from the current fill to blue, like [*transition*.attr](#transition_attr):
|
||||
|
||||
```js
|
||||
transition.attrTween("fill", function() {
|
||||
return d3.interpolateRgb(this.getAttribute("fill"), "blue");
|
||||
});
|
||||
```
|
||||
|
||||
Or to apply a custom rainbow interpolator:
|
||||
|
||||
```js
|
||||
transition.attrTween("fill", function() {
|
||||
return function(t) {
|
||||
return "hsl(" + t * 360 + ",100%,50%)";
|
||||
};
|
||||
});
|
||||
```
|
||||
|
||||
This method is useful to specify a custom interpolator, such as one that understands [SVG paths](http://bl.ocks.org/mbostock/3916621). A useful technique is *data interpolation*, where [d3.interpolateObject](https://github.com/d3/d3-interpolate#interpolateObject) is used to interpolate two data values, and the resulting value is then used (say, with a [shape](https://github.com/d3/d3-shape)) to compute the new attribute value.
|
||||
|
||||
<a name="transition_style" href="#transition_style">#</a> <i>transition</i>.<b>style</b>(<i>name</i>, <i>value</i>[, <i>priority</i>]) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/style.js "Source")
|
||||
|
||||
For each selected element, assigns the [style tween](#transition_styleTween) for the style with the specified *name* to the specified target *value* with the specified *priority*. The starting value of the tween is the style’s inline value if present, and otherwise its computed value, when the transition starts. The target *value* may be specified either as a constant or a function. If a function, it is immediately evaluated for each selected element, in order, being passed the current datum `d` and index `i`, with the `this` context as the current DOM element.
|
||||
|
||||
If the target value is null, the style is removed when the transition starts. Otherwise, an interpolator is chosen based on the type of the target value, using the following algorithm:
|
||||
|
||||
1. If *value* is a number, use [interpolateNumber](https://github.com/d3/d3-interpolate#interpolateNumber).
|
||||
2. If *value* is a [color](https://github.com/d3/d3-color#color) or a string coercible to a color, use [interpolateRgb](https://github.com/d3/d3-interpolate#interpolateRgb).
|
||||
3. Use [interpolateString](https://github.com/d3/d3-interpolate#interpolateString).
|
||||
|
||||
To apply a different interpolator, use [*transition*.styleTween](#transition_styleTween).
|
||||
|
||||
<a name="transition_styleTween" href="#transition_styleTween">#</a> <i>transition</i>.<b>styleTween</b>(<i>name</i>[, <i>factory</i>[, <i>priority</i>]])) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/styleTween.js "Source")
|
||||
|
||||
If *factory* is specified and not null, assigns the style [tween](#transition_tween) for the style with the specified *name* to the specified interpolator *factory*. An interpolator factory is a function that returns an [interpolator](https://github.com/d3/d3-interpolate); when the transition starts, the *factory* is evaluated for each selected element, in order, being passed the current datum `d` and index `i`, with the `this` context as the current DOM element. The returned interpolator will then be invoked for each frame of the transition, in order, being passed the [eased](#transition_ease) time *t*, typically in the range [0, 1]. Lastly, the return value of the interpolator will be used to set the style value with the specified *priority*. The interpolator must return a string. (To remove an style at the start of a transition, use [*transition*.style](#transition_style); to remove an style at the end of a transition, use [*transition*.on](#transition_on) to listen for the *end* event.)
|
||||
|
||||
If the specified *factory* is null, removes the previously-assigned style tween of the specified *name*, if any. If *factory* is not specified, returns the current interpolator factory for style with the specified *name*, or undefined if no such tween exists.
|
||||
|
||||
For example, to interpolate the fill style from red to blue:
|
||||
|
||||
```js
|
||||
transition.styleTween("fill", function() {
|
||||
return d3.interpolateRgb("red", "blue");
|
||||
});
|
||||
```
|
||||
|
||||
Or to interpolate from the current fill to blue, like [*transition*.style](#transition_style):
|
||||
|
||||
```js
|
||||
transition.styleTween("fill", function() {
|
||||
return d3.interpolateRgb(this.style.fill, "blue");
|
||||
});
|
||||
```
|
||||
|
||||
Or to apply a custom rainbow interpolator:
|
||||
|
||||
```js
|
||||
transition.styleTween("fill", function() {
|
||||
return function(t) {
|
||||
return "hsl(" + t * 360 + ",100%,50%)";
|
||||
};
|
||||
});
|
||||
```
|
||||
|
||||
This method is useful to specify a custom interpolator, such as with *data interpolation*, where [d3.interpolateObject](https://github.com/d3/d3-interpolate#interpolateObject) is used to interpolate two data values, and the resulting value is then used to compute the new style value.
|
||||
|
||||
<a name="transition_text" href="#transition_text">#</a> <i>transition</i>.<b>text</b>(<i>value</i>) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/text.js "Source")
|
||||
|
||||
For each selected element, sets the [text content](http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-textContent) to the specified target *value* when the transition starts. The *value* may be specified either as a constant or a function. If a function, it is immediately evaluated for each selected element, in order, being passed the current datum `d` and index `i`, with the `this` context as the current DOM element. The function’s return value is then used to set each element’s text content. A null value will clear the content.
|
||||
|
||||
To interpolate text rather than to set it on start, use [*transition*.textTween](#transition_textTween) ([for example](http://bl.ocks.org/mbostock/7004f92cac972edef365)) or append a replacement element and cross-fade opacity ([for example](http://bl.ocks.org/mbostock/f7dcecb19c4af317e464)). Text is not interpolated by default because it is usually undesirable.
|
||||
|
||||
<a name="transition_textTween" href="#transition_textTween">#</a> <i>transition</i>.<b>textTween</b>(<i>factory</i>) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/textTween.js "Source")
|
||||
|
||||
If *factory* is specified and not null, assigns the text [tween](#transition_tween) to the specified interpolator *factory*. An interpolator factory is a function that returns an [interpolator](https://github.com/d3/d3-interpolate); when the transition starts, the *factory* is evaluated for each selected element, in order, being passed the current datum `d` and index `i`, with the `this` context as the current DOM element. The returned interpolator will then be invoked for each frame of the transition, in order, being passed the [eased](#transition_ease) time *t*, typically in the range [0, 1]. Lastly, the return value of the interpolator will be used to set the text. The interpolator must return a string.
|
||||
|
||||
For example, to interpolate the text with integers from 0 to 100:
|
||||
|
||||
```js
|
||||
transition.textTween(function() {
|
||||
return d3.interpolateRound(0, 100);
|
||||
});
|
||||
```
|
||||
|
||||
If the specified *factory* is null, removes the previously-assigned text tween, if any. If *factory* is not specified, returns the current interpolator factory for text, or undefined if no such tween exists.
|
||||
|
||||
<a name="transition_remove" href="#transition_remove">#</a> <i>transition</i>.<b>remove</b>() [<>](https://github.com/d3/d3-transition/blob/master/src/transition/remove.js "Source")
|
||||
|
||||
For each selected element, [removes](https://github.com/d3/d3-selection#selection_remove) the element when the transition ends, as long as the element has no other active or pending transitions. If the element has other active or pending transitions, does nothing.
|
||||
|
||||
<a name="transition_tween" href="#transition_tween">#</a> <i>transition</i>.<b>tween</b>(<i>name</i>[, <i>value</i>]) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/tween.js "Source")
|
||||
|
||||
For each selected element, assigns the tween with the specified *name* with the specified *value* function. The *value* must be specified as a function that returns a function. When the transition starts, the *value* function is evaluated for each selected element, in order, being passed the current datum `d` and index `i`, with the `this` context as the current DOM element. The returned function is then invoked for each frame of the transition, in order, being passed the [eased](#transition_ease) time *t*, typically in the range [0, 1]. If the specified *value* is null, removes the previously-assigned tween of the specified *name*, if any.
|
||||
|
||||
For example, to interpolate the fill attribute to blue, like [*transition*.attr](#transition_attr):
|
||||
|
||||
```js
|
||||
transition.tween("attr.fill", function() {
|
||||
var i = d3.interpolateRgb(this.getAttribute("fill"), "blue");
|
||||
return function(t) {
|
||||
this.setAttribute("fill", i(t));
|
||||
};
|
||||
});
|
||||
```
|
||||
|
||||
This method is useful to specify a custom interpolator, or to perform side-effects, say to animate the [scroll offset](http://bl.ocks.org/mbostock/1649463).
|
||||
|
||||
### Timing
|
||||
|
||||
The [easing](#transition_ease), [delay](#transition_delay) and [duration](#transition_duration) of a transition is configurable. For example, a per-element delay can be used to [stagger the reordering](http://bl.ocks.org/mbostock/3885705) of elements, improving perception. See [Animated Transitions in Statistical Data Graphics](http://vis.berkeley.edu/papers/animated_transitions/) for recommendations.
|
||||
|
||||
<a name="transition_delay" href="#transition_delay">#</a> <i>transition</i>.<b>delay</b>([<i>value</i>]) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/delay.js "Source")
|
||||
|
||||
For each selected element, sets the transition delay to the specified *value* in milliseconds. The *value* may be specified either as a constant or a function. If a function, it is immediately evaluated for each selected element, in order, being passed the current datum `d` and index `i`, with the `this` context as the current DOM element. The function’s return value is then used to set each element’s transition delay. If a delay is not specified, it defaults to zero.
|
||||
|
||||
If a *value* is not specified, returns the current value of the delay for the first (non-null) element in the transition. This is generally useful only if you know that the transition contains exactly one element.
|
||||
|
||||
Setting the delay to a multiple of the index `i` is a convenient way to stagger transitions across a set of elements. For example:
|
||||
|
||||
```js
|
||||
transition.delay(function(d, i) { return i * 10; });
|
||||
```
|
||||
|
||||
Of course, you can also compute the delay as a function of the data, or [sort the selection](https://github.com/d3/d3-selection#selection_sort) before computed an index-based delay.
|
||||
|
||||
<a name="transition_duration" href="#transition_duration">#</a> <i>transition</i>.<b>duration</b>([<i>value</i>]) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/duration.js "Source")
|
||||
|
||||
For each selected element, sets the transition duration to the specified *value* in milliseconds. The *value* may be specified either as a constant or a function. If a function, it is immediately evaluated for each selected element, in order, being passed the current datum `d` and index `i`, with the `this` context as the current DOM element. The function’s return value is then used to set each element’s transition duration. If a duration is not specified, it defaults to 250ms.
|
||||
|
||||
If a *value* is not specified, returns the current value of the duration for the first (non-null) element in the transition. This is generally useful only if you know that the transition contains exactly one element.
|
||||
|
||||
<a name="transition_ease" href="#transition_ease">#</a> <i>transition</i>.<b>ease</b>([<i>value</i>]) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/ease.js "Source")
|
||||
|
||||
Specifies the transition [easing function](https://github.com/d3/d3-ease) for all selected elements. The *value* must be specified as a function. The easing function is invoked for each frame of the animation, being passed the normalized time *t* in the range [0, 1]; it must then return the eased time *tʹ* which is typically also in the range [0, 1]. A good easing function should return 0 if *t* = 0 and 1 if *t* = 1. If an easing function is not specified, it defaults to [d3.easeCubic](https://github.com/d3/d3-ease#easeCubic).
|
||||
|
||||
If a *value* is not specified, returns the current easing function for the first (non-null) element in the transition. This is generally useful only if you know that the transition contains exactly one element.
|
||||
|
||||
### Control Flow
|
||||
|
||||
For advanced usage, transitions provide methods for custom control flow.
|
||||
|
||||
<a name="transition_end" href="#transition_end">#</a> <i>transition</i>.<b>end</b>() [<>](https://github.com/d3/d3-transition/blob/master/src/transition/end.js "Source")
|
||||
|
||||
Returns a promise that resolves when every selected element finishes transitioning. If any element’s transition is cancelled or interrupted, the promise rejects.
|
||||
|
||||
<a name="transition_on" href="#transition_on">#</a> <i>transition</i>.<b>on</b>(<i>typenames</i>[, <i>listener</i>]) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/on.js "Source")
|
||||
|
||||
Adds or removes a *listener* to each selected element for the specified event *typenames*. The *typenames* is one of the following string event types:
|
||||
|
||||
* `start` - when the transition starts.
|
||||
* `end` - when the transition ends.
|
||||
* `interrupt` - when the transition is interrupted.
|
||||
* `cancel` - when the transition is cancelled.
|
||||
|
||||
See [The Life of a Transition](#the-life-of-a-transition) for more. Note that these are *not* native DOM events as implemented by [*selection*.on](https://github.com/d3/d3-selection#selection_on) and [*selection*.dispatch](https://github.com/d3/d3-selection#selection_dispatch), but transition events!
|
||||
|
||||
The type may be optionally followed by a period (`.`) and a name; the optional name allows multiple callbacks to be registered to receive events of the same type, such as `start.foo` and `start.bar`. To specify multiple typenames, separate typenames with spaces, such as `interrupt end` or `start.foo start.bar`.
|
||||
|
||||
When a specified transition event is dispatched on a selected node, the specified *listener* will be invoked for the transitioning element, being passed the current datum `d` and index `i`, with the `this` context as the current DOM element. Listeners always see the latest datum for their element, but the index is a property of the selection and is fixed when the listener is assigned; to update the index, re-assign the listener.
|
||||
|
||||
If an event listener was previously registered for the same *typename* on a selected element, the old listener is removed before the new listener is added. To remove a listener, pass null as the *listener*. To remove all listeners for a given name, pass null as the *listener* and `.foo` as the *typename*, where `foo` is the name; to remove all listeners with no name, specify `.` as the *typename*.
|
||||
|
||||
If a *listener* is not specified, returns the currently-assigned listener for the specified event *typename* on the first (non-null) selected element, if any. If multiple typenames are specified, the first matching listener is returned.
|
||||
|
||||
<a name="transition_each" href="#transition_each">#</a> <i>transition</i>.<b>each</b>(<i>function</i>) [<>](https://github.com/d3/d3-selection/blob/master/src/selection/each.js "Source")
|
||||
|
||||
Invokes the specified *function* for each selected element, passing in the current datum `d` and index `i`, with the `this` context of the current DOM element. This method can be used to invoke arbitrary code for each selected element, and is useful for creating a context to access parent and child data simultaneously. Equivalent to [*selection*.each](https://github.com/d3/d3-selection#selection_each).
|
||||
|
||||
<a name="transition_call" href="#transition_call">#</a> <i>transition</i>.<b>call</b>(<i>function</i>[, <i>arguments…</i>]) [<>](https://github.com/d3/d3-selection/blob/master/src/selection/call.js "Source")
|
||||
|
||||
Invokes the specified *function* exactly once, passing in this transition along with any optional *arguments*. Returns this transition. This is equivalent to invoking the function by hand but facilitates method chaining. For example, to set several attributes in a reusable function:
|
||||
|
||||
```js
|
||||
function color(transition, fill, stroke) {
|
||||
transition
|
||||
.style("fill", fill)
|
||||
.style("stroke", stroke);
|
||||
}
|
||||
```
|
||||
|
||||
Now say:
|
||||
|
||||
```js
|
||||
d3.selectAll("div").transition().call(color, "red", "blue");
|
||||
```
|
||||
|
||||
This is equivalent to:
|
||||
|
||||
```js
|
||||
color(d3.selectAll("div").transition(), "red", "blue");
|
||||
```
|
||||
|
||||
Equivalent to [*selection*.call](https://github.com/d3/d3-selection#selection_call).
|
||||
|
||||
<a name="transition_empty" href="#transition_empty">#</a> <i>transition</i>.<b>empty</b>() [<>](https://github.com/d3/d3-selection/blob/master/src/selection/empty.js "Source")
|
||||
|
||||
Returns true if this transition contains no (non-null) elements. Equivalent to [*selection*.empty](https://github.com/d3/d3-selection#selection_empty).
|
||||
|
||||
<a name="transition_nodes" href="#transition_nodes">#</a> <i>transition</i>.<b>nodes</b>() [<>](https://github.com/d3/d3-selection/blob/master/src/selection/nodes.js "Source")
|
||||
|
||||
Returns an array of all (non-null) elements in this transition. Equivalent to [*selection*.nodes](https://github.com/d3/d3-selection#selection_nodes).
|
||||
|
||||
<a name="transition_node" href="#transition_node">#</a> <i>transition</i>.<b>node</b>() [<>](https://github.com/d3/d3-selection/blob/master/src/selection/node.js "Source")
|
||||
|
||||
Returns the first (non-null) element in this transition. If the transition is empty, returns null. Equivalent to [*selection*.node](https://github.com/d3/d3-selection#selection_node).
|
||||
|
||||
<a name="transition_size" href="#transition_size">#</a> <i>transition</i>.<b>size</b>() [<>](https://github.com/d3/d3-selection/blob/master/src/selection/size.js "Source")
|
||||
|
||||
Returns the total number of elements in this transition. Equivalent to [*selection*.size](https://github.com/d3/d3-selection#selection_size).
|
||||
|
||||
### The Life of a Transition
|
||||
|
||||
Immediately after creating a transition, such as by [*selection*.transition](#selection_transition) or [*transition*.transition](#transition_transition), you may configure the transition using methods such as [*transition*.delay](#transition_delay), [*transition*.duration](#transition_duration), [*transition*.attr](#transition_attr) and [*transition*.style](#transition_style). Methods that specify target values (such as *transition*.attr) are evaluated synchronously; however, methods that require the starting value for interpolation, such as [*transition*.attrTween](#transition_attrTween) and [*transition*.styleTween](#transition_styleTween), must be deferred until the transition starts.
|
||||
|
||||
Shortly after creation, either at the end of the current frame or during the next frame, the transition is scheduled. At this point, the delay and `start` event listeners may no longer be changed; attempting to do so throws an error with the message “too late: already scheduled” (or if the transition has ended, “transition not found”).
|
||||
|
||||
When the transition subsequently starts, it interrupts the active transition of the same name on the same element, if any, dispatching an `interrupt` event to registered listeners. (Note that interrupts happen on start, not creation, and thus even a zero-delay transition will not immediately interrupt the active transition: the old transition is given a final frame. Use [*selection*.interrupt](#selection_interrupt) to interrupt immediately.) The starting transition also cancels any pending transitions of the same name on the same element that were created before the starting transition. The transition then dispatches a `start` event to registered listeners. This is the last moment at which the transition may be modified: the transition’s timing, tweens, and listeners may not be changed when it is running; attempting to do so throws an error with the message “too late: already running” (or if the transition has ended, “transition not found”). The transition initializes its tweens immediately after starting.
|
||||
|
||||
During the frame the transition starts, but *after* all transitions starting this frame have been started, the transition invokes its tweens for the first time. Batching tween initialization, which typically involves reading from the DOM, improves performance by avoiding interleaved DOM reads and writes.
|
||||
|
||||
For each frame that a transition is active, it invokes its tweens with an [eased](#transition_ease) *t*-value ranging from 0 to 1. Within each frame, the transition invokes its tweens in the order they were registered.
|
||||
|
||||
When a transition ends, it invokes its tweens a final time with a (non-eased) *t*-value of 1. It then dispatches an `end` event to registered listeners. This is the last moment at which the transition may be inspected: after ending, the transition is deleted from the element, and its configuration is destroyed. (A transition’s configuration is also destroyed on interrupt or cancel.) Attempting to inspect a transition after it is destroyed throws an error with the message “transition not found”.
|
||||
880
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/dist/d3-transition.js
generated
vendored
Normal file
880
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/dist/d3-transition.js
generated
vendored
Normal file
@@ -0,0 +1,880 @@
|
||||
// https://d3js.org/d3-transition/ v1.3.2 Copyright 2019 Mike Bostock
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-selection'), require('d3-dispatch'), require('d3-timer'), require('d3-interpolate'), require('d3-color'), require('d3-ease')) :
|
||||
typeof define === 'function' && define.amd ? define(['exports', 'd3-selection', 'd3-dispatch', 'd3-timer', 'd3-interpolate', 'd3-color', 'd3-ease'], factory) :
|
||||
(global = global || self, factory(global.d3 = global.d3 || {}, global.d3, global.d3, global.d3, global.d3, global.d3, global.d3));
|
||||
}(this, function (exports, d3Selection, d3Dispatch, d3Timer, d3Interpolate, d3Color, d3Ease) { 'use strict';
|
||||
|
||||
var emptyOn = d3Dispatch.dispatch("start", "end", "cancel", "interrupt");
|
||||
var emptyTween = [];
|
||||
|
||||
var CREATED = 0;
|
||||
var SCHEDULED = 1;
|
||||
var STARTING = 2;
|
||||
var STARTED = 3;
|
||||
var RUNNING = 4;
|
||||
var ENDING = 5;
|
||||
var ENDED = 6;
|
||||
|
||||
function schedule(node, name, id, index, group, timing) {
|
||||
var schedules = node.__transition;
|
||||
if (!schedules) node.__transition = {};
|
||||
else if (id in schedules) return;
|
||||
create(node, id, {
|
||||
name: name,
|
||||
index: index, // For context during callback.
|
||||
group: group, // For context during callback.
|
||||
on: emptyOn,
|
||||
tween: emptyTween,
|
||||
time: timing.time,
|
||||
delay: timing.delay,
|
||||
duration: timing.duration,
|
||||
ease: timing.ease,
|
||||
timer: null,
|
||||
state: CREATED
|
||||
});
|
||||
}
|
||||
|
||||
function init(node, id) {
|
||||
var schedule = get(node, id);
|
||||
if (schedule.state > CREATED) throw new Error("too late; already scheduled");
|
||||
return schedule;
|
||||
}
|
||||
|
||||
function set(node, id) {
|
||||
var schedule = get(node, id);
|
||||
if (schedule.state > STARTED) throw new Error("too late; already running");
|
||||
return schedule;
|
||||
}
|
||||
|
||||
function get(node, id) {
|
||||
var schedule = node.__transition;
|
||||
if (!schedule || !(schedule = schedule[id])) throw new Error("transition not found");
|
||||
return schedule;
|
||||
}
|
||||
|
||||
function create(node, id, self) {
|
||||
var schedules = node.__transition,
|
||||
tween;
|
||||
|
||||
// Initialize the self timer when the transition is created.
|
||||
// Note the actual delay is not known until the first callback!
|
||||
schedules[id] = self;
|
||||
self.timer = d3Timer.timer(schedule, 0, self.time);
|
||||
|
||||
function schedule(elapsed) {
|
||||
self.state = SCHEDULED;
|
||||
self.timer.restart(start, self.delay, self.time);
|
||||
|
||||
// If the elapsed delay is less than our first sleep, start immediately.
|
||||
if (self.delay <= elapsed) start(elapsed - self.delay);
|
||||
}
|
||||
|
||||
function start(elapsed) {
|
||||
var i, j, n, o;
|
||||
|
||||
// If the state is not SCHEDULED, then we previously errored on start.
|
||||
if (self.state !== SCHEDULED) return stop();
|
||||
|
||||
for (i in schedules) {
|
||||
o = schedules[i];
|
||||
if (o.name !== self.name) continue;
|
||||
|
||||
// While this element already has a starting transition during this frame,
|
||||
// defer starting an interrupting transition until that transition has a
|
||||
// chance to tick (and possibly end); see d3/d3-transition#54!
|
||||
if (o.state === STARTED) return d3Timer.timeout(start);
|
||||
|
||||
// Interrupt the active transition, if any.
|
||||
if (o.state === RUNNING) {
|
||||
o.state = ENDED;
|
||||
o.timer.stop();
|
||||
o.on.call("interrupt", node, node.__data__, o.index, o.group);
|
||||
delete schedules[i];
|
||||
}
|
||||
|
||||
// Cancel any pre-empted transitions.
|
||||
else if (+i < id) {
|
||||
o.state = ENDED;
|
||||
o.timer.stop();
|
||||
o.on.call("cancel", node, node.__data__, o.index, o.group);
|
||||
delete schedules[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Defer the first tick to end of the current frame; see d3/d3#1576.
|
||||
// Note the transition may be canceled after start and before the first tick!
|
||||
// Note this must be scheduled before the start event; see d3/d3-transition#16!
|
||||
// Assuming this is successful, subsequent callbacks go straight to tick.
|
||||
d3Timer.timeout(function() {
|
||||
if (self.state === STARTED) {
|
||||
self.state = RUNNING;
|
||||
self.timer.restart(tick, self.delay, self.time);
|
||||
tick(elapsed);
|
||||
}
|
||||
});
|
||||
|
||||
// Dispatch the start event.
|
||||
// Note this must be done before the tween are initialized.
|
||||
self.state = STARTING;
|
||||
self.on.call("start", node, node.__data__, self.index, self.group);
|
||||
if (self.state !== STARTING) return; // interrupted
|
||||
self.state = STARTED;
|
||||
|
||||
// Initialize the tween, deleting null tween.
|
||||
tween = new Array(n = self.tween.length);
|
||||
for (i = 0, j = -1; i < n; ++i) {
|
||||
if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) {
|
||||
tween[++j] = o;
|
||||
}
|
||||
}
|
||||
tween.length = j + 1;
|
||||
}
|
||||
|
||||
function tick(elapsed) {
|
||||
var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1),
|
||||
i = -1,
|
||||
n = tween.length;
|
||||
|
||||
while (++i < n) {
|
||||
tween[i].call(node, t);
|
||||
}
|
||||
|
||||
// Dispatch the end event.
|
||||
if (self.state === ENDING) {
|
||||
self.on.call("end", node, node.__data__, self.index, self.group);
|
||||
stop();
|
||||
}
|
||||
}
|
||||
|
||||
function stop() {
|
||||
self.state = ENDED;
|
||||
self.timer.stop();
|
||||
delete schedules[id];
|
||||
for (var i in schedules) return; // eslint-disable-line no-unused-vars
|
||||
delete node.__transition;
|
||||
}
|
||||
}
|
||||
|
||||
function interrupt(node, name) {
|
||||
var schedules = node.__transition,
|
||||
schedule,
|
||||
active,
|
||||
empty = true,
|
||||
i;
|
||||
|
||||
if (!schedules) return;
|
||||
|
||||
name = name == null ? null : name + "";
|
||||
|
||||
for (i in schedules) {
|
||||
if ((schedule = schedules[i]).name !== name) { empty = false; continue; }
|
||||
active = schedule.state > STARTING && schedule.state < ENDING;
|
||||
schedule.state = ENDED;
|
||||
schedule.timer.stop();
|
||||
schedule.on.call(active ? "interrupt" : "cancel", node, node.__data__, schedule.index, schedule.group);
|
||||
delete schedules[i];
|
||||
}
|
||||
|
||||
if (empty) delete node.__transition;
|
||||
}
|
||||
|
||||
function selection_interrupt(name) {
|
||||
return this.each(function() {
|
||||
interrupt(this, name);
|
||||
});
|
||||
}
|
||||
|
||||
function tweenRemove(id, name) {
|
||||
var tween0, tween1;
|
||||
return function() {
|
||||
var schedule = set(this, id),
|
||||
tween = schedule.tween;
|
||||
|
||||
// If this node shared tween with the previous node,
|
||||
// just assign the updated shared tween and we’re done!
|
||||
// Otherwise, copy-on-write.
|
||||
if (tween !== tween0) {
|
||||
tween1 = tween0 = tween;
|
||||
for (var i = 0, n = tween1.length; i < n; ++i) {
|
||||
if (tween1[i].name === name) {
|
||||
tween1 = tween1.slice();
|
||||
tween1.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
schedule.tween = tween1;
|
||||
};
|
||||
}
|
||||
|
||||
function tweenFunction(id, name, value) {
|
||||
var tween0, tween1;
|
||||
if (typeof value !== "function") throw new Error;
|
||||
return function() {
|
||||
var schedule = set(this, id),
|
||||
tween = schedule.tween;
|
||||
|
||||
// If this node shared tween with the previous node,
|
||||
// just assign the updated shared tween and we’re done!
|
||||
// Otherwise, copy-on-write.
|
||||
if (tween !== tween0) {
|
||||
tween1 = (tween0 = tween).slice();
|
||||
for (var t = {name: name, value: value}, i = 0, n = tween1.length; i < n; ++i) {
|
||||
if (tween1[i].name === name) {
|
||||
tween1[i] = t;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i === n) tween1.push(t);
|
||||
}
|
||||
|
||||
schedule.tween = tween1;
|
||||
};
|
||||
}
|
||||
|
||||
function transition_tween(name, value) {
|
||||
var id = this._id;
|
||||
|
||||
name += "";
|
||||
|
||||
if (arguments.length < 2) {
|
||||
var tween = get(this.node(), id).tween;
|
||||
for (var i = 0, n = tween.length, t; i < n; ++i) {
|
||||
if ((t = tween[i]).name === name) {
|
||||
return t.value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));
|
||||
}
|
||||
|
||||
function tweenValue(transition, name, value) {
|
||||
var id = transition._id;
|
||||
|
||||
transition.each(function() {
|
||||
var schedule = set(this, id);
|
||||
(schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);
|
||||
});
|
||||
|
||||
return function(node) {
|
||||
return get(node, id).value[name];
|
||||
};
|
||||
}
|
||||
|
||||
function interpolate(a, b) {
|
||||
var c;
|
||||
return (typeof b === "number" ? d3Interpolate.interpolateNumber
|
||||
: b instanceof d3Color.color ? d3Interpolate.interpolateRgb
|
||||
: (c = d3Color.color(b)) ? (b = c, d3Interpolate.interpolateRgb)
|
||||
: d3Interpolate.interpolateString)(a, b);
|
||||
}
|
||||
|
||||
function attrRemove(name) {
|
||||
return function() {
|
||||
this.removeAttribute(name);
|
||||
};
|
||||
}
|
||||
|
||||
function attrRemoveNS(fullname) {
|
||||
return function() {
|
||||
this.removeAttributeNS(fullname.space, fullname.local);
|
||||
};
|
||||
}
|
||||
|
||||
function attrConstant(name, interpolate, value1) {
|
||||
var string00,
|
||||
string1 = value1 + "",
|
||||
interpolate0;
|
||||
return function() {
|
||||
var string0 = this.getAttribute(name);
|
||||
return string0 === string1 ? null
|
||||
: string0 === string00 ? interpolate0
|
||||
: interpolate0 = interpolate(string00 = string0, value1);
|
||||
};
|
||||
}
|
||||
|
||||
function attrConstantNS(fullname, interpolate, value1) {
|
||||
var string00,
|
||||
string1 = value1 + "",
|
||||
interpolate0;
|
||||
return function() {
|
||||
var string0 = this.getAttributeNS(fullname.space, fullname.local);
|
||||
return string0 === string1 ? null
|
||||
: string0 === string00 ? interpolate0
|
||||
: interpolate0 = interpolate(string00 = string0, value1);
|
||||
};
|
||||
}
|
||||
|
||||
function attrFunction(name, interpolate, value) {
|
||||
var string00,
|
||||
string10,
|
||||
interpolate0;
|
||||
return function() {
|
||||
var string0, value1 = value(this), string1;
|
||||
if (value1 == null) return void this.removeAttribute(name);
|
||||
string0 = this.getAttribute(name);
|
||||
string1 = value1 + "";
|
||||
return string0 === string1 ? null
|
||||
: string0 === string00 && string1 === string10 ? interpolate0
|
||||
: (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
|
||||
};
|
||||
}
|
||||
|
||||
function attrFunctionNS(fullname, interpolate, value) {
|
||||
var string00,
|
||||
string10,
|
||||
interpolate0;
|
||||
return function() {
|
||||
var string0, value1 = value(this), string1;
|
||||
if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);
|
||||
string0 = this.getAttributeNS(fullname.space, fullname.local);
|
||||
string1 = value1 + "";
|
||||
return string0 === string1 ? null
|
||||
: string0 === string00 && string1 === string10 ? interpolate0
|
||||
: (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
|
||||
};
|
||||
}
|
||||
|
||||
function transition_attr(name, value) {
|
||||
var fullname = d3Selection.namespace(name), i = fullname === "transform" ? d3Interpolate.interpolateTransformSvg : interpolate;
|
||||
return this.attrTween(name, typeof value === "function"
|
||||
? (fullname.local ? attrFunctionNS : attrFunction)(fullname, i, tweenValue(this, "attr." + name, value))
|
||||
: value == null ? (fullname.local ? attrRemoveNS : attrRemove)(fullname)
|
||||
: (fullname.local ? attrConstantNS : attrConstant)(fullname, i, value));
|
||||
}
|
||||
|
||||
function attrInterpolate(name, i) {
|
||||
return function(t) {
|
||||
this.setAttribute(name, i.call(this, t));
|
||||
};
|
||||
}
|
||||
|
||||
function attrInterpolateNS(fullname, i) {
|
||||
return function(t) {
|
||||
this.setAttributeNS(fullname.space, fullname.local, i.call(this, t));
|
||||
};
|
||||
}
|
||||
|
||||
function attrTweenNS(fullname, value) {
|
||||
var t0, i0;
|
||||
function tween() {
|
||||
var i = value.apply(this, arguments);
|
||||
if (i !== i0) t0 = (i0 = i) && attrInterpolateNS(fullname, i);
|
||||
return t0;
|
||||
}
|
||||
tween._value = value;
|
||||
return tween;
|
||||
}
|
||||
|
||||
function attrTween(name, value) {
|
||||
var t0, i0;
|
||||
function tween() {
|
||||
var i = value.apply(this, arguments);
|
||||
if (i !== i0) t0 = (i0 = i) && attrInterpolate(name, i);
|
||||
return t0;
|
||||
}
|
||||
tween._value = value;
|
||||
return tween;
|
||||
}
|
||||
|
||||
function transition_attrTween(name, value) {
|
||||
var key = "attr." + name;
|
||||
if (arguments.length < 2) return (key = this.tween(key)) && key._value;
|
||||
if (value == null) return this.tween(key, null);
|
||||
if (typeof value !== "function") throw new Error;
|
||||
var fullname = d3Selection.namespace(name);
|
||||
return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
|
||||
}
|
||||
|
||||
function delayFunction(id, value) {
|
||||
return function() {
|
||||
init(this, id).delay = +value.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
function delayConstant(id, value) {
|
||||
return value = +value, function() {
|
||||
init(this, id).delay = value;
|
||||
};
|
||||
}
|
||||
|
||||
function transition_delay(value) {
|
||||
var id = this._id;
|
||||
|
||||
return arguments.length
|
||||
? this.each((typeof value === "function"
|
||||
? delayFunction
|
||||
: delayConstant)(id, value))
|
||||
: get(this.node(), id).delay;
|
||||
}
|
||||
|
||||
function durationFunction(id, value) {
|
||||
return function() {
|
||||
set(this, id).duration = +value.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
function durationConstant(id, value) {
|
||||
return value = +value, function() {
|
||||
set(this, id).duration = value;
|
||||
};
|
||||
}
|
||||
|
||||
function transition_duration(value) {
|
||||
var id = this._id;
|
||||
|
||||
return arguments.length
|
||||
? this.each((typeof value === "function"
|
||||
? durationFunction
|
||||
: durationConstant)(id, value))
|
||||
: get(this.node(), id).duration;
|
||||
}
|
||||
|
||||
function easeConstant(id, value) {
|
||||
if (typeof value !== "function") throw new Error;
|
||||
return function() {
|
||||
set(this, id).ease = value;
|
||||
};
|
||||
}
|
||||
|
||||
function transition_ease(value) {
|
||||
var id = this._id;
|
||||
|
||||
return arguments.length
|
||||
? this.each(easeConstant(id, value))
|
||||
: get(this.node(), id).ease;
|
||||
}
|
||||
|
||||
function transition_filter(match) {
|
||||
if (typeof match !== "function") match = d3Selection.matcher(match);
|
||||
|
||||
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
|
||||
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {
|
||||
if ((node = group[i]) && match.call(node, node.__data__, i, group)) {
|
||||
subgroup.push(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Transition(subgroups, this._parents, this._name, this._id);
|
||||
}
|
||||
|
||||
function transition_merge(transition) {
|
||||
if (transition._id !== this._id) throw new Error;
|
||||
|
||||
for (var groups0 = this._groups, groups1 = transition._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {
|
||||
for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {
|
||||
if (node = group0[i] || group1[i]) {
|
||||
merge[i] = node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (; j < m0; ++j) {
|
||||
merges[j] = groups0[j];
|
||||
}
|
||||
|
||||
return new Transition(merges, this._parents, this._name, this._id);
|
||||
}
|
||||
|
||||
function start(name) {
|
||||
return (name + "").trim().split(/^|\s+/).every(function(t) {
|
||||
var i = t.indexOf(".");
|
||||
if (i >= 0) t = t.slice(0, i);
|
||||
return !t || t === "start";
|
||||
});
|
||||
}
|
||||
|
||||
function onFunction(id, name, listener) {
|
||||
var on0, on1, sit = start(name) ? init : set;
|
||||
return function() {
|
||||
var schedule = sit(this, id),
|
||||
on = schedule.on;
|
||||
|
||||
// If this node shared a dispatch with the previous node,
|
||||
// just assign the updated shared dispatch and we’re done!
|
||||
// Otherwise, copy-on-write.
|
||||
if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener);
|
||||
|
||||
schedule.on = on1;
|
||||
};
|
||||
}
|
||||
|
||||
function transition_on(name, listener) {
|
||||
var id = this._id;
|
||||
|
||||
return arguments.length < 2
|
||||
? get(this.node(), id).on.on(name)
|
||||
: this.each(onFunction(id, name, listener));
|
||||
}
|
||||
|
||||
function removeFunction(id) {
|
||||
return function() {
|
||||
var parent = this.parentNode;
|
||||
for (var i in this.__transition) if (+i !== id) return;
|
||||
if (parent) parent.removeChild(this);
|
||||
};
|
||||
}
|
||||
|
||||
function transition_remove() {
|
||||
return this.on("end.remove", removeFunction(this._id));
|
||||
}
|
||||
|
||||
function transition_select(select) {
|
||||
var name = this._name,
|
||||
id = this._id;
|
||||
|
||||
if (typeof select !== "function") select = d3Selection.selector(select);
|
||||
|
||||
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
|
||||
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {
|
||||
if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
|
||||
if ("__data__" in node) subnode.__data__ = node.__data__;
|
||||
subgroup[i] = subnode;
|
||||
schedule(subgroup[i], name, id, i, subgroup, get(node, id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Transition(subgroups, this._parents, name, id);
|
||||
}
|
||||
|
||||
function transition_selectAll(select) {
|
||||
var name = this._name,
|
||||
id = this._id;
|
||||
|
||||
if (typeof select !== "function") select = d3Selection.selectorAll(select);
|
||||
|
||||
for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
|
||||
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
||||
if (node = group[i]) {
|
||||
for (var children = select.call(node, node.__data__, i, group), child, inherit = get(node, id), k = 0, l = children.length; k < l; ++k) {
|
||||
if (child = children[k]) {
|
||||
schedule(child, name, id, k, children, inherit);
|
||||
}
|
||||
}
|
||||
subgroups.push(children);
|
||||
parents.push(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Transition(subgroups, parents, name, id);
|
||||
}
|
||||
|
||||
var Selection = d3Selection.selection.prototype.constructor;
|
||||
|
||||
function transition_selection() {
|
||||
return new Selection(this._groups, this._parents);
|
||||
}
|
||||
|
||||
function styleNull(name, interpolate) {
|
||||
var string00,
|
||||
string10,
|
||||
interpolate0;
|
||||
return function() {
|
||||
var string0 = d3Selection.style(this, name),
|
||||
string1 = (this.style.removeProperty(name), d3Selection.style(this, name));
|
||||
return string0 === string1 ? null
|
||||
: string0 === string00 && string1 === string10 ? interpolate0
|
||||
: interpolate0 = interpolate(string00 = string0, string10 = string1);
|
||||
};
|
||||
}
|
||||
|
||||
function styleRemove(name) {
|
||||
return function() {
|
||||
this.style.removeProperty(name);
|
||||
};
|
||||
}
|
||||
|
||||
function styleConstant(name, interpolate, value1) {
|
||||
var string00,
|
||||
string1 = value1 + "",
|
||||
interpolate0;
|
||||
return function() {
|
||||
var string0 = d3Selection.style(this, name);
|
||||
return string0 === string1 ? null
|
||||
: string0 === string00 ? interpolate0
|
||||
: interpolate0 = interpolate(string00 = string0, value1);
|
||||
};
|
||||
}
|
||||
|
||||
function styleFunction(name, interpolate, value) {
|
||||
var string00,
|
||||
string10,
|
||||
interpolate0;
|
||||
return function() {
|
||||
var string0 = d3Selection.style(this, name),
|
||||
value1 = value(this),
|
||||
string1 = value1 + "";
|
||||
if (value1 == null) string1 = value1 = (this.style.removeProperty(name), d3Selection.style(this, name));
|
||||
return string0 === string1 ? null
|
||||
: string0 === string00 && string1 === string10 ? interpolate0
|
||||
: (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
|
||||
};
|
||||
}
|
||||
|
||||
function styleMaybeRemove(id, name) {
|
||||
var on0, on1, listener0, key = "style." + name, event = "end." + key, remove;
|
||||
return function() {
|
||||
var schedule = set(this, id),
|
||||
on = schedule.on,
|
||||
listener = schedule.value[key] == null ? remove || (remove = styleRemove(name)) : undefined;
|
||||
|
||||
// If this node shared a dispatch with the previous node,
|
||||
// just assign the updated shared dispatch and we’re done!
|
||||
// Otherwise, copy-on-write.
|
||||
if (on !== on0 || listener0 !== listener) (on1 = (on0 = on).copy()).on(event, listener0 = listener);
|
||||
|
||||
schedule.on = on1;
|
||||
};
|
||||
}
|
||||
|
||||
function transition_style(name, value, priority) {
|
||||
var i = (name += "") === "transform" ? d3Interpolate.interpolateTransformCss : interpolate;
|
||||
return value == null ? this
|
||||
.styleTween(name, styleNull(name, i))
|
||||
.on("end.style." + name, styleRemove(name))
|
||||
: typeof value === "function" ? this
|
||||
.styleTween(name, styleFunction(name, i, tweenValue(this, "style." + name, value)))
|
||||
.each(styleMaybeRemove(this._id, name))
|
||||
: this
|
||||
.styleTween(name, styleConstant(name, i, value), priority)
|
||||
.on("end.style." + name, null);
|
||||
}
|
||||
|
||||
function styleInterpolate(name, i, priority) {
|
||||
return function(t) {
|
||||
this.style.setProperty(name, i.call(this, t), priority);
|
||||
};
|
||||
}
|
||||
|
||||
function styleTween(name, value, priority) {
|
||||
var t, i0;
|
||||
function tween() {
|
||||
var i = value.apply(this, arguments);
|
||||
if (i !== i0) t = (i0 = i) && styleInterpolate(name, i, priority);
|
||||
return t;
|
||||
}
|
||||
tween._value = value;
|
||||
return tween;
|
||||
}
|
||||
|
||||
function transition_styleTween(name, value, priority) {
|
||||
var key = "style." + (name += "");
|
||||
if (arguments.length < 2) return (key = this.tween(key)) && key._value;
|
||||
if (value == null) return this.tween(key, null);
|
||||
if (typeof value !== "function") throw new Error;
|
||||
return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
|
||||
}
|
||||
|
||||
function textConstant(value) {
|
||||
return function() {
|
||||
this.textContent = value;
|
||||
};
|
||||
}
|
||||
|
||||
function textFunction(value) {
|
||||
return function() {
|
||||
var value1 = value(this);
|
||||
this.textContent = value1 == null ? "" : value1;
|
||||
};
|
||||
}
|
||||
|
||||
function transition_text(value) {
|
||||
return this.tween("text", typeof value === "function"
|
||||
? textFunction(tweenValue(this, "text", value))
|
||||
: textConstant(value == null ? "" : value + ""));
|
||||
}
|
||||
|
||||
function textInterpolate(i) {
|
||||
return function(t) {
|
||||
this.textContent = i.call(this, t);
|
||||
};
|
||||
}
|
||||
|
||||
function textTween(value) {
|
||||
var t0, i0;
|
||||
function tween() {
|
||||
var i = value.apply(this, arguments);
|
||||
if (i !== i0) t0 = (i0 = i) && textInterpolate(i);
|
||||
return t0;
|
||||
}
|
||||
tween._value = value;
|
||||
return tween;
|
||||
}
|
||||
|
||||
function transition_textTween(value) {
|
||||
var key = "text";
|
||||
if (arguments.length < 1) return (key = this.tween(key)) && key._value;
|
||||
if (value == null) return this.tween(key, null);
|
||||
if (typeof value !== "function") throw new Error;
|
||||
return this.tween(key, textTween(value));
|
||||
}
|
||||
|
||||
function transition_transition() {
|
||||
var name = this._name,
|
||||
id0 = this._id,
|
||||
id1 = newId();
|
||||
|
||||
for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {
|
||||
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
||||
if (node = group[i]) {
|
||||
var inherit = get(node, id0);
|
||||
schedule(node, name, id1, i, group, {
|
||||
time: inherit.time + inherit.delay + inherit.duration,
|
||||
delay: 0,
|
||||
duration: inherit.duration,
|
||||
ease: inherit.ease
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Transition(groups, this._parents, name, id1);
|
||||
}
|
||||
|
||||
function transition_end() {
|
||||
var on0, on1, that = this, id = that._id, size = that.size();
|
||||
return new Promise(function(resolve, reject) {
|
||||
var cancel = {value: reject},
|
||||
end = {value: function() { if (--size === 0) resolve(); }};
|
||||
|
||||
that.each(function() {
|
||||
var schedule = set(this, id),
|
||||
on = schedule.on;
|
||||
|
||||
// If this node shared a dispatch with the previous node,
|
||||
// just assign the updated shared dispatch and we’re done!
|
||||
// Otherwise, copy-on-write.
|
||||
if (on !== on0) {
|
||||
on1 = (on0 = on).copy();
|
||||
on1._.cancel.push(cancel);
|
||||
on1._.interrupt.push(cancel);
|
||||
on1._.end.push(end);
|
||||
}
|
||||
|
||||
schedule.on = on1;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
var id = 0;
|
||||
|
||||
function Transition(groups, parents, name, id) {
|
||||
this._groups = groups;
|
||||
this._parents = parents;
|
||||
this._name = name;
|
||||
this._id = id;
|
||||
}
|
||||
|
||||
function transition(name) {
|
||||
return d3Selection.selection().transition(name);
|
||||
}
|
||||
|
||||
function newId() {
|
||||
return ++id;
|
||||
}
|
||||
|
||||
var selection_prototype = d3Selection.selection.prototype;
|
||||
|
||||
Transition.prototype = transition.prototype = {
|
||||
constructor: Transition,
|
||||
select: transition_select,
|
||||
selectAll: transition_selectAll,
|
||||
filter: transition_filter,
|
||||
merge: transition_merge,
|
||||
selection: transition_selection,
|
||||
transition: transition_transition,
|
||||
call: selection_prototype.call,
|
||||
nodes: selection_prototype.nodes,
|
||||
node: selection_prototype.node,
|
||||
size: selection_prototype.size,
|
||||
empty: selection_prototype.empty,
|
||||
each: selection_prototype.each,
|
||||
on: transition_on,
|
||||
attr: transition_attr,
|
||||
attrTween: transition_attrTween,
|
||||
style: transition_style,
|
||||
styleTween: transition_styleTween,
|
||||
text: transition_text,
|
||||
textTween: transition_textTween,
|
||||
remove: transition_remove,
|
||||
tween: transition_tween,
|
||||
delay: transition_delay,
|
||||
duration: transition_duration,
|
||||
ease: transition_ease,
|
||||
end: transition_end
|
||||
};
|
||||
|
||||
var defaultTiming = {
|
||||
time: null, // Set on use.
|
||||
delay: 0,
|
||||
duration: 250,
|
||||
ease: d3Ease.easeCubicInOut
|
||||
};
|
||||
|
||||
function inherit(node, id) {
|
||||
var timing;
|
||||
while (!(timing = node.__transition) || !(timing = timing[id])) {
|
||||
if (!(node = node.parentNode)) {
|
||||
return defaultTiming.time = d3Timer.now(), defaultTiming;
|
||||
}
|
||||
}
|
||||
return timing;
|
||||
}
|
||||
|
||||
function selection_transition(name) {
|
||||
var id,
|
||||
timing;
|
||||
|
||||
if (name instanceof Transition) {
|
||||
id = name._id, name = name._name;
|
||||
} else {
|
||||
id = newId(), (timing = defaultTiming).time = d3Timer.now(), name = name == null ? null : name + "";
|
||||
}
|
||||
|
||||
for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {
|
||||
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
||||
if (node = group[i]) {
|
||||
schedule(node, name, id, i, group, timing || inherit(node, id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Transition(groups, this._parents, name, id);
|
||||
}
|
||||
|
||||
d3Selection.selection.prototype.interrupt = selection_interrupt;
|
||||
d3Selection.selection.prototype.transition = selection_transition;
|
||||
|
||||
var root = [null];
|
||||
|
||||
function active(node, name) {
|
||||
var schedules = node.__transition,
|
||||
schedule,
|
||||
i;
|
||||
|
||||
if (schedules) {
|
||||
name = name == null ? null : name + "";
|
||||
for (i in schedules) {
|
||||
if ((schedule = schedules[i]).state > SCHEDULED && schedule.name === name) {
|
||||
return new Transition([[node]], root, name, +i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
exports.active = active;
|
||||
exports.interrupt = interrupt;
|
||||
exports.transition = transition;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
}));
|
||||
2
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/dist/d3-transition.min.js
generated
vendored
Normal file
2
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/dist/d3-transition.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
52
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/package.json
generated
vendored
Normal file
52
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/package.json
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"name": "d3-transition",
|
||||
"version": "1.3.2",
|
||||
"description": "Animated transitions for D3 selections.",
|
||||
"keywords": [
|
||||
"d3",
|
||||
"d3-module",
|
||||
"dom",
|
||||
"transition",
|
||||
"animation"
|
||||
],
|
||||
"homepage": "https://d3js.org/d3-transition/",
|
||||
"license": "BSD-3-Clause",
|
||||
"author": {
|
||||
"name": "Mike Bostock",
|
||||
"url": "https://bost.ocks.org/mike"
|
||||
},
|
||||
"main": "dist/d3-transition.js",
|
||||
"unpkg": "dist/d3-transition.min.js",
|
||||
"jsdelivr": "dist/d3-transition.min.js",
|
||||
"module": "src/index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/d3/d3-transition.git"
|
||||
},
|
||||
"files": [
|
||||
"dist/**/*.js",
|
||||
"src/**/*.js"
|
||||
],
|
||||
"scripts": {
|
||||
"pretest": "rollup -c",
|
||||
"test": "tape 'test/**/*-test.js' && eslint src",
|
||||
"prepublishOnly": "rm -rf dist && yarn test",
|
||||
"postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../${npm_package_name}/dist/${npm_package_name}.js ${npm_package_name}.v${npm_package_version%%.*}.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git add ${npm_package_name}.v${npm_package_version%%.*}.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git commit -m \"${npm_package_name} ${npm_package_version}\" && git push && cd - && zip -j dist/${npm_package_name}.zip -- LICENSE README.md dist/${npm_package_name}.js dist/${npm_package_name}.min.js"
|
||||
},
|
||||
"sideEffects": true,
|
||||
"dependencies": {
|
||||
"d3-color": "1",
|
||||
"d3-dispatch": "1",
|
||||
"d3-ease": "1",
|
||||
"d3-interpolate": "1",
|
||||
"d3-selection": "^1.1.0",
|
||||
"d3-timer": "1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "6",
|
||||
"jsdom": "15",
|
||||
"rollup": "1",
|
||||
"rollup-plugin-terser": "5",
|
||||
"tape": "4"
|
||||
}
|
||||
}
|
||||
21
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/active.js
generated
vendored
Normal file
21
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/active.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import {Transition} from "./transition/index.js";
|
||||
import {SCHEDULED} from "./transition/schedule.js";
|
||||
|
||||
var root = [null];
|
||||
|
||||
export default function(node, name) {
|
||||
var schedules = node.__transition,
|
||||
schedule,
|
||||
i;
|
||||
|
||||
if (schedules) {
|
||||
name = name == null ? null : name + "";
|
||||
for (i in schedules) {
|
||||
if ((schedule = schedules[i]).state > SCHEDULED && schedule.name === name) {
|
||||
return new Transition([[node]], root, name, +i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
4
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/index.js
generated
vendored
Normal file
4
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import "./selection/index.js";
|
||||
export {default as transition} from "./transition/index.js";
|
||||
export {default as active} from "./active.js";
|
||||
export {default as interrupt} from "./interrupt.js";
|
||||
24
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/interrupt.js
generated
vendored
Normal file
24
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/interrupt.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import {STARTING, ENDING, ENDED} from "./transition/schedule.js";
|
||||
|
||||
export default function(node, name) {
|
||||
var schedules = node.__transition,
|
||||
schedule,
|
||||
active,
|
||||
empty = true,
|
||||
i;
|
||||
|
||||
if (!schedules) return;
|
||||
|
||||
name = name == null ? null : name + "";
|
||||
|
||||
for (i in schedules) {
|
||||
if ((schedule = schedules[i]).name !== name) { empty = false; continue; }
|
||||
active = schedule.state > STARTING && schedule.state < ENDING;
|
||||
schedule.state = ENDED;
|
||||
schedule.timer.stop();
|
||||
schedule.on.call(active ? "interrupt" : "cancel", node, node.__data__, schedule.index, schedule.group);
|
||||
delete schedules[i];
|
||||
}
|
||||
|
||||
if (empty) delete node.__transition;
|
||||
}
|
||||
6
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/selection/index.js
generated
vendored
Normal file
6
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/selection/index.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import {selection} from "d3-selection";
|
||||
import selection_interrupt from "./interrupt.js";
|
||||
import selection_transition from "./transition.js";
|
||||
|
||||
selection.prototype.interrupt = selection_interrupt;
|
||||
selection.prototype.transition = selection_transition;
|
||||
7
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/selection/interrupt.js
generated
vendored
Normal file
7
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/selection/interrupt.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import interrupt from "../interrupt.js";
|
||||
|
||||
export default function(name) {
|
||||
return this.each(function() {
|
||||
interrupt(this, name);
|
||||
});
|
||||
}
|
||||
42
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/selection/transition.js
generated
vendored
Normal file
42
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/selection/transition.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
import {Transition, newId} from "../transition/index.js";
|
||||
import schedule from "../transition/schedule.js";
|
||||
import {easeCubicInOut} from "d3-ease";
|
||||
import {now} from "d3-timer";
|
||||
|
||||
var defaultTiming = {
|
||||
time: null, // Set on use.
|
||||
delay: 0,
|
||||
duration: 250,
|
||||
ease: easeCubicInOut
|
||||
};
|
||||
|
||||
function inherit(node, id) {
|
||||
var timing;
|
||||
while (!(timing = node.__transition) || !(timing = timing[id])) {
|
||||
if (!(node = node.parentNode)) {
|
||||
return defaultTiming.time = now(), defaultTiming;
|
||||
}
|
||||
}
|
||||
return timing;
|
||||
}
|
||||
|
||||
export default function(name) {
|
||||
var id,
|
||||
timing;
|
||||
|
||||
if (name instanceof Transition) {
|
||||
id = name._id, name = name._name;
|
||||
} else {
|
||||
id = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + "";
|
||||
}
|
||||
|
||||
for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {
|
||||
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
||||
if (node = group[i]) {
|
||||
schedule(node, name, id, i, group, timing || inherit(node, id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Transition(groups, this._parents, name, id);
|
||||
}
|
||||
78
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/attr.js
generated
vendored
Normal file
78
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/attr.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
import {interpolateTransformSvg as interpolateTransform} from "d3-interpolate";
|
||||
import {namespace} from "d3-selection";
|
||||
import {tweenValue} from "./tween.js";
|
||||
import interpolate from "./interpolate.js";
|
||||
|
||||
function attrRemove(name) {
|
||||
return function() {
|
||||
this.removeAttribute(name);
|
||||
};
|
||||
}
|
||||
|
||||
function attrRemoveNS(fullname) {
|
||||
return function() {
|
||||
this.removeAttributeNS(fullname.space, fullname.local);
|
||||
};
|
||||
}
|
||||
|
||||
function attrConstant(name, interpolate, value1) {
|
||||
var string00,
|
||||
string1 = value1 + "",
|
||||
interpolate0;
|
||||
return function() {
|
||||
var string0 = this.getAttribute(name);
|
||||
return string0 === string1 ? null
|
||||
: string0 === string00 ? interpolate0
|
||||
: interpolate0 = interpolate(string00 = string0, value1);
|
||||
};
|
||||
}
|
||||
|
||||
function attrConstantNS(fullname, interpolate, value1) {
|
||||
var string00,
|
||||
string1 = value1 + "",
|
||||
interpolate0;
|
||||
return function() {
|
||||
var string0 = this.getAttributeNS(fullname.space, fullname.local);
|
||||
return string0 === string1 ? null
|
||||
: string0 === string00 ? interpolate0
|
||||
: interpolate0 = interpolate(string00 = string0, value1);
|
||||
};
|
||||
}
|
||||
|
||||
function attrFunction(name, interpolate, value) {
|
||||
var string00,
|
||||
string10,
|
||||
interpolate0;
|
||||
return function() {
|
||||
var string0, value1 = value(this), string1;
|
||||
if (value1 == null) return void this.removeAttribute(name);
|
||||
string0 = this.getAttribute(name);
|
||||
string1 = value1 + "";
|
||||
return string0 === string1 ? null
|
||||
: string0 === string00 && string1 === string10 ? interpolate0
|
||||
: (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
|
||||
};
|
||||
}
|
||||
|
||||
function attrFunctionNS(fullname, interpolate, value) {
|
||||
var string00,
|
||||
string10,
|
||||
interpolate0;
|
||||
return function() {
|
||||
var string0, value1 = value(this), string1;
|
||||
if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);
|
||||
string0 = this.getAttributeNS(fullname.space, fullname.local);
|
||||
string1 = value1 + "";
|
||||
return string0 === string1 ? null
|
||||
: string0 === string00 && string1 === string10 ? interpolate0
|
||||
: (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
|
||||
};
|
||||
}
|
||||
|
||||
export default function(name, value) {
|
||||
var fullname = namespace(name), i = fullname === "transform" ? interpolateTransform : interpolate;
|
||||
return this.attrTween(name, typeof value === "function"
|
||||
? (fullname.local ? attrFunctionNS : attrFunction)(fullname, i, tweenValue(this, "attr." + name, value))
|
||||
: value == null ? (fullname.local ? attrRemoveNS : attrRemove)(fullname)
|
||||
: (fullname.local ? attrConstantNS : attrConstant)(fullname, i, value));
|
||||
}
|
||||
44
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/attrTween.js
generated
vendored
Normal file
44
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/attrTween.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
import {namespace} from "d3-selection";
|
||||
|
||||
function attrInterpolate(name, i) {
|
||||
return function(t) {
|
||||
this.setAttribute(name, i.call(this, t));
|
||||
};
|
||||
}
|
||||
|
||||
function attrInterpolateNS(fullname, i) {
|
||||
return function(t) {
|
||||
this.setAttributeNS(fullname.space, fullname.local, i.call(this, t));
|
||||
};
|
||||
}
|
||||
|
||||
function attrTweenNS(fullname, value) {
|
||||
var t0, i0;
|
||||
function tween() {
|
||||
var i = value.apply(this, arguments);
|
||||
if (i !== i0) t0 = (i0 = i) && attrInterpolateNS(fullname, i);
|
||||
return t0;
|
||||
}
|
||||
tween._value = value;
|
||||
return tween;
|
||||
}
|
||||
|
||||
function attrTween(name, value) {
|
||||
var t0, i0;
|
||||
function tween() {
|
||||
var i = value.apply(this, arguments);
|
||||
if (i !== i0) t0 = (i0 = i) && attrInterpolate(name, i);
|
||||
return t0;
|
||||
}
|
||||
tween._value = value;
|
||||
return tween;
|
||||
}
|
||||
|
||||
export default function(name, value) {
|
||||
var key = "attr." + name;
|
||||
if (arguments.length < 2) return (key = this.tween(key)) && key._value;
|
||||
if (value == null) return this.tween(key, null);
|
||||
if (typeof value !== "function") throw new Error;
|
||||
var fullname = namespace(name);
|
||||
return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
|
||||
}
|
||||
23
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/delay.js
generated
vendored
Normal file
23
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/delay.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import {get, init} from "./schedule.js";
|
||||
|
||||
function delayFunction(id, value) {
|
||||
return function() {
|
||||
init(this, id).delay = +value.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
function delayConstant(id, value) {
|
||||
return value = +value, function() {
|
||||
init(this, id).delay = value;
|
||||
};
|
||||
}
|
||||
|
||||
export default function(value) {
|
||||
var id = this._id;
|
||||
|
||||
return arguments.length
|
||||
? this.each((typeof value === "function"
|
||||
? delayFunction
|
||||
: delayConstant)(id, value))
|
||||
: get(this.node(), id).delay;
|
||||
}
|
||||
23
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/duration.js
generated
vendored
Normal file
23
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/duration.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import {get, set} from "./schedule.js";
|
||||
|
||||
function durationFunction(id, value) {
|
||||
return function() {
|
||||
set(this, id).duration = +value.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
function durationConstant(id, value) {
|
||||
return value = +value, function() {
|
||||
set(this, id).duration = value;
|
||||
};
|
||||
}
|
||||
|
||||
export default function(value) {
|
||||
var id = this._id;
|
||||
|
||||
return arguments.length
|
||||
? this.each((typeof value === "function"
|
||||
? durationFunction
|
||||
: durationConstant)(id, value))
|
||||
: get(this.node(), id).duration;
|
||||
}
|
||||
16
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/ease.js
generated
vendored
Normal file
16
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/ease.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import {get, set} from "./schedule.js";
|
||||
|
||||
function easeConstant(id, value) {
|
||||
if (typeof value !== "function") throw new Error;
|
||||
return function() {
|
||||
set(this, id).ease = value;
|
||||
};
|
||||
}
|
||||
|
||||
export default function(value) {
|
||||
var id = this._id;
|
||||
|
||||
return arguments.length
|
||||
? this.each(easeConstant(id, value))
|
||||
: get(this.node(), id).ease;
|
||||
}
|
||||
26
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/end.js
generated
vendored
Normal file
26
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/end.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import {set} from "./schedule.js";
|
||||
|
||||
export default function() {
|
||||
var on0, on1, that = this, id = that._id, size = that.size();
|
||||
return new Promise(function(resolve, reject) {
|
||||
var cancel = {value: reject},
|
||||
end = {value: function() { if (--size === 0) resolve(); }};
|
||||
|
||||
that.each(function() {
|
||||
var schedule = set(this, id),
|
||||
on = schedule.on;
|
||||
|
||||
// If this node shared a dispatch with the previous node,
|
||||
// just assign the updated shared dispatch and we’re done!
|
||||
// Otherwise, copy-on-write.
|
||||
if (on !== on0) {
|
||||
on1 = (on0 = on).copy();
|
||||
on1._.cancel.push(cancel);
|
||||
on1._.interrupt.push(cancel);
|
||||
on1._.end.push(end);
|
||||
}
|
||||
|
||||
schedule.on = on1;
|
||||
});
|
||||
});
|
||||
}
|
||||
16
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/filter.js
generated
vendored
Normal file
16
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/filter.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import {matcher} from "d3-selection";
|
||||
import {Transition} from "./index.js";
|
||||
|
||||
export default function(match) {
|
||||
if (typeof match !== "function") match = matcher(match);
|
||||
|
||||
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
|
||||
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {
|
||||
if ((node = group[i]) && match.call(node, node.__data__, i, group)) {
|
||||
subgroup.push(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Transition(subgroups, this._parents, this._name, this._id);
|
||||
}
|
||||
68
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/index.js
generated
vendored
Normal file
68
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/index.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
import {selection} from "d3-selection";
|
||||
import transition_attr from "./attr.js";
|
||||
import transition_attrTween from "./attrTween.js";
|
||||
import transition_delay from "./delay.js";
|
||||
import transition_duration from "./duration.js";
|
||||
import transition_ease from "./ease.js";
|
||||
import transition_filter from "./filter.js";
|
||||
import transition_merge from "./merge.js";
|
||||
import transition_on from "./on.js";
|
||||
import transition_remove from "./remove.js";
|
||||
import transition_select from "./select.js";
|
||||
import transition_selectAll from "./selectAll.js";
|
||||
import transition_selection from "./selection.js";
|
||||
import transition_style from "./style.js";
|
||||
import transition_styleTween from "./styleTween.js";
|
||||
import transition_text from "./text.js";
|
||||
import transition_textTween from "./textTween.js";
|
||||
import transition_transition from "./transition.js";
|
||||
import transition_tween from "./tween.js";
|
||||
import transition_end from "./end.js";
|
||||
|
||||
var id = 0;
|
||||
|
||||
export function Transition(groups, parents, name, id) {
|
||||
this._groups = groups;
|
||||
this._parents = parents;
|
||||
this._name = name;
|
||||
this._id = id;
|
||||
}
|
||||
|
||||
export default function transition(name) {
|
||||
return selection().transition(name);
|
||||
}
|
||||
|
||||
export function newId() {
|
||||
return ++id;
|
||||
}
|
||||
|
||||
var selection_prototype = selection.prototype;
|
||||
|
||||
Transition.prototype = transition.prototype = {
|
||||
constructor: Transition,
|
||||
select: transition_select,
|
||||
selectAll: transition_selectAll,
|
||||
filter: transition_filter,
|
||||
merge: transition_merge,
|
||||
selection: transition_selection,
|
||||
transition: transition_transition,
|
||||
call: selection_prototype.call,
|
||||
nodes: selection_prototype.nodes,
|
||||
node: selection_prototype.node,
|
||||
size: selection_prototype.size,
|
||||
empty: selection_prototype.empty,
|
||||
each: selection_prototype.each,
|
||||
on: transition_on,
|
||||
attr: transition_attr,
|
||||
attrTween: transition_attrTween,
|
||||
style: transition_style,
|
||||
styleTween: transition_styleTween,
|
||||
text: transition_text,
|
||||
textTween: transition_textTween,
|
||||
remove: transition_remove,
|
||||
tween: transition_tween,
|
||||
delay: transition_delay,
|
||||
duration: transition_duration,
|
||||
ease: transition_ease,
|
||||
end: transition_end
|
||||
};
|
||||
10
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/interpolate.js
generated
vendored
Normal file
10
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/interpolate.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import {color} from "d3-color";
|
||||
import {interpolateNumber, interpolateRgb, interpolateString} from "d3-interpolate";
|
||||
|
||||
export default function(a, b) {
|
||||
var c;
|
||||
return (typeof b === "number" ? interpolateNumber
|
||||
: b instanceof color ? interpolateRgb
|
||||
: (c = color(b)) ? (b = c, interpolateRgb)
|
||||
: interpolateString)(a, b);
|
||||
}
|
||||
19
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/merge.js
generated
vendored
Normal file
19
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/merge.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import {Transition} from "./index.js";
|
||||
|
||||
export default function(transition) {
|
||||
if (transition._id !== this._id) throw new Error;
|
||||
|
||||
for (var groups0 = this._groups, groups1 = transition._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {
|
||||
for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {
|
||||
if (node = group0[i] || group1[i]) {
|
||||
merge[i] = node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (; j < m0; ++j) {
|
||||
merges[j] = groups0[j];
|
||||
}
|
||||
|
||||
return new Transition(merges, this._parents, this._name, this._id);
|
||||
}
|
||||
32
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/on.js
generated
vendored
Normal file
32
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/on.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import {get, set, init} from "./schedule.js";
|
||||
|
||||
function start(name) {
|
||||
return (name + "").trim().split(/^|\s+/).every(function(t) {
|
||||
var i = t.indexOf(".");
|
||||
if (i >= 0) t = t.slice(0, i);
|
||||
return !t || t === "start";
|
||||
});
|
||||
}
|
||||
|
||||
function onFunction(id, name, listener) {
|
||||
var on0, on1, sit = start(name) ? init : set;
|
||||
return function() {
|
||||
var schedule = sit(this, id),
|
||||
on = schedule.on;
|
||||
|
||||
// If this node shared a dispatch with the previous node,
|
||||
// just assign the updated shared dispatch and we’re done!
|
||||
// Otherwise, copy-on-write.
|
||||
if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener);
|
||||
|
||||
schedule.on = on1;
|
||||
};
|
||||
}
|
||||
|
||||
export default function(name, listener) {
|
||||
var id = this._id;
|
||||
|
||||
return arguments.length < 2
|
||||
? get(this.node(), id).on.on(name)
|
||||
: this.each(onFunction(id, name, listener));
|
||||
}
|
||||
11
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/remove.js
generated
vendored
Normal file
11
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/remove.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
function removeFunction(id) {
|
||||
return function() {
|
||||
var parent = this.parentNode;
|
||||
for (var i in this.__transition) if (+i !== id) return;
|
||||
if (parent) parent.removeChild(this);
|
||||
};
|
||||
}
|
||||
|
||||
export default function() {
|
||||
return this.on("end.remove", removeFunction(this._id));
|
||||
}
|
||||
153
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/schedule.js
generated
vendored
Normal file
153
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/schedule.js
generated
vendored
Normal file
@@ -0,0 +1,153 @@
|
||||
import {dispatch} from "d3-dispatch";
|
||||
import {timer, timeout} from "d3-timer";
|
||||
|
||||
var emptyOn = dispatch("start", "end", "cancel", "interrupt");
|
||||
var emptyTween = [];
|
||||
|
||||
export var CREATED = 0;
|
||||
export var SCHEDULED = 1;
|
||||
export var STARTING = 2;
|
||||
export var STARTED = 3;
|
||||
export var RUNNING = 4;
|
||||
export var ENDING = 5;
|
||||
export var ENDED = 6;
|
||||
|
||||
export default function(node, name, id, index, group, timing) {
|
||||
var schedules = node.__transition;
|
||||
if (!schedules) node.__transition = {};
|
||||
else if (id in schedules) return;
|
||||
create(node, id, {
|
||||
name: name,
|
||||
index: index, // For context during callback.
|
||||
group: group, // For context during callback.
|
||||
on: emptyOn,
|
||||
tween: emptyTween,
|
||||
time: timing.time,
|
||||
delay: timing.delay,
|
||||
duration: timing.duration,
|
||||
ease: timing.ease,
|
||||
timer: null,
|
||||
state: CREATED
|
||||
});
|
||||
}
|
||||
|
||||
export function init(node, id) {
|
||||
var schedule = get(node, id);
|
||||
if (schedule.state > CREATED) throw new Error("too late; already scheduled");
|
||||
return schedule;
|
||||
}
|
||||
|
||||
export function set(node, id) {
|
||||
var schedule = get(node, id);
|
||||
if (schedule.state > STARTED) throw new Error("too late; already running");
|
||||
return schedule;
|
||||
}
|
||||
|
||||
export function get(node, id) {
|
||||
var schedule = node.__transition;
|
||||
if (!schedule || !(schedule = schedule[id])) throw new Error("transition not found");
|
||||
return schedule;
|
||||
}
|
||||
|
||||
function create(node, id, self) {
|
||||
var schedules = node.__transition,
|
||||
tween;
|
||||
|
||||
// Initialize the self timer when the transition is created.
|
||||
// Note the actual delay is not known until the first callback!
|
||||
schedules[id] = self;
|
||||
self.timer = timer(schedule, 0, self.time);
|
||||
|
||||
function schedule(elapsed) {
|
||||
self.state = SCHEDULED;
|
||||
self.timer.restart(start, self.delay, self.time);
|
||||
|
||||
// If the elapsed delay is less than our first sleep, start immediately.
|
||||
if (self.delay <= elapsed) start(elapsed - self.delay);
|
||||
}
|
||||
|
||||
function start(elapsed) {
|
||||
var i, j, n, o;
|
||||
|
||||
// If the state is not SCHEDULED, then we previously errored on start.
|
||||
if (self.state !== SCHEDULED) return stop();
|
||||
|
||||
for (i in schedules) {
|
||||
o = schedules[i];
|
||||
if (o.name !== self.name) continue;
|
||||
|
||||
// While this element already has a starting transition during this frame,
|
||||
// defer starting an interrupting transition until that transition has a
|
||||
// chance to tick (and possibly end); see d3/d3-transition#54!
|
||||
if (o.state === STARTED) return timeout(start);
|
||||
|
||||
// Interrupt the active transition, if any.
|
||||
if (o.state === RUNNING) {
|
||||
o.state = ENDED;
|
||||
o.timer.stop();
|
||||
o.on.call("interrupt", node, node.__data__, o.index, o.group);
|
||||
delete schedules[i];
|
||||
}
|
||||
|
||||
// Cancel any pre-empted transitions.
|
||||
else if (+i < id) {
|
||||
o.state = ENDED;
|
||||
o.timer.stop();
|
||||
o.on.call("cancel", node, node.__data__, o.index, o.group);
|
||||
delete schedules[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Defer the first tick to end of the current frame; see d3/d3#1576.
|
||||
// Note the transition may be canceled after start and before the first tick!
|
||||
// Note this must be scheduled before the start event; see d3/d3-transition#16!
|
||||
// Assuming this is successful, subsequent callbacks go straight to tick.
|
||||
timeout(function() {
|
||||
if (self.state === STARTED) {
|
||||
self.state = RUNNING;
|
||||
self.timer.restart(tick, self.delay, self.time);
|
||||
tick(elapsed);
|
||||
}
|
||||
});
|
||||
|
||||
// Dispatch the start event.
|
||||
// Note this must be done before the tween are initialized.
|
||||
self.state = STARTING;
|
||||
self.on.call("start", node, node.__data__, self.index, self.group);
|
||||
if (self.state !== STARTING) return; // interrupted
|
||||
self.state = STARTED;
|
||||
|
||||
// Initialize the tween, deleting null tween.
|
||||
tween = new Array(n = self.tween.length);
|
||||
for (i = 0, j = -1; i < n; ++i) {
|
||||
if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) {
|
||||
tween[++j] = o;
|
||||
}
|
||||
}
|
||||
tween.length = j + 1;
|
||||
}
|
||||
|
||||
function tick(elapsed) {
|
||||
var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1),
|
||||
i = -1,
|
||||
n = tween.length;
|
||||
|
||||
while (++i < n) {
|
||||
tween[i].call(node, t);
|
||||
}
|
||||
|
||||
// Dispatch the end event.
|
||||
if (self.state === ENDING) {
|
||||
self.on.call("end", node, node.__data__, self.index, self.group);
|
||||
stop();
|
||||
}
|
||||
}
|
||||
|
||||
function stop() {
|
||||
self.state = ENDED;
|
||||
self.timer.stop();
|
||||
delete schedules[id];
|
||||
for (var i in schedules) return; // eslint-disable-line no-unused-vars
|
||||
delete node.__transition;
|
||||
}
|
||||
}
|
||||
22
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/select.js
generated
vendored
Normal file
22
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/select.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import {selector} from "d3-selection";
|
||||
import {Transition} from "./index.js";
|
||||
import schedule, {get} from "./schedule.js";
|
||||
|
||||
export default function(select) {
|
||||
var name = this._name,
|
||||
id = this._id;
|
||||
|
||||
if (typeof select !== "function") select = selector(select);
|
||||
|
||||
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
|
||||
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {
|
||||
if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
|
||||
if ("__data__" in node) subnode.__data__ = node.__data__;
|
||||
subgroup[i] = subnode;
|
||||
schedule(subgroup[i], name, id, i, subgroup, get(node, id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Transition(subgroups, this._parents, name, id);
|
||||
}
|
||||
26
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/selectAll.js
generated
vendored
Normal file
26
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/selectAll.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import {selectorAll} from "d3-selection";
|
||||
import {Transition} from "./index.js";
|
||||
import schedule, {get} from "./schedule.js";
|
||||
|
||||
export default function(select) {
|
||||
var name = this._name,
|
||||
id = this._id;
|
||||
|
||||
if (typeof select !== "function") select = selectorAll(select);
|
||||
|
||||
for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
|
||||
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
||||
if (node = group[i]) {
|
||||
for (var children = select.call(node, node.__data__, i, group), child, inherit = get(node, id), k = 0, l = children.length; k < l; ++k) {
|
||||
if (child = children[k]) {
|
||||
schedule(child, name, id, k, children, inherit);
|
||||
}
|
||||
}
|
||||
subgroups.push(children);
|
||||
parents.push(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Transition(subgroups, parents, name, id);
|
||||
}
|
||||
7
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/selection.js
generated
vendored
Normal file
7
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/selection.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import {selection} from "d3-selection";
|
||||
|
||||
var Selection = selection.prototype.constructor;
|
||||
|
||||
export default function() {
|
||||
return new Selection(this._groups, this._parents);
|
||||
}
|
||||
80
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/style.js
generated
vendored
Normal file
80
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/style.js
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
import {interpolateTransformCss as interpolateTransform} from "d3-interpolate";
|
||||
import {style} from "d3-selection";
|
||||
import {set} from "./schedule.js";
|
||||
import {tweenValue} from "./tween.js";
|
||||
import interpolate from "./interpolate.js";
|
||||
|
||||
function styleNull(name, interpolate) {
|
||||
var string00,
|
||||
string10,
|
||||
interpolate0;
|
||||
return function() {
|
||||
var string0 = style(this, name),
|
||||
string1 = (this.style.removeProperty(name), style(this, name));
|
||||
return string0 === string1 ? null
|
||||
: string0 === string00 && string1 === string10 ? interpolate0
|
||||
: interpolate0 = interpolate(string00 = string0, string10 = string1);
|
||||
};
|
||||
}
|
||||
|
||||
function styleRemove(name) {
|
||||
return function() {
|
||||
this.style.removeProperty(name);
|
||||
};
|
||||
}
|
||||
|
||||
function styleConstant(name, interpolate, value1) {
|
||||
var string00,
|
||||
string1 = value1 + "",
|
||||
interpolate0;
|
||||
return function() {
|
||||
var string0 = style(this, name);
|
||||
return string0 === string1 ? null
|
||||
: string0 === string00 ? interpolate0
|
||||
: interpolate0 = interpolate(string00 = string0, value1);
|
||||
};
|
||||
}
|
||||
|
||||
function styleFunction(name, interpolate, value) {
|
||||
var string00,
|
||||
string10,
|
||||
interpolate0;
|
||||
return function() {
|
||||
var string0 = style(this, name),
|
||||
value1 = value(this),
|
||||
string1 = value1 + "";
|
||||
if (value1 == null) string1 = value1 = (this.style.removeProperty(name), style(this, name));
|
||||
return string0 === string1 ? null
|
||||
: string0 === string00 && string1 === string10 ? interpolate0
|
||||
: (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
|
||||
};
|
||||
}
|
||||
|
||||
function styleMaybeRemove(id, name) {
|
||||
var on0, on1, listener0, key = "style." + name, event = "end." + key, remove;
|
||||
return function() {
|
||||
var schedule = set(this, id),
|
||||
on = schedule.on,
|
||||
listener = schedule.value[key] == null ? remove || (remove = styleRemove(name)) : undefined;
|
||||
|
||||
// If this node shared a dispatch with the previous node,
|
||||
// just assign the updated shared dispatch and we’re done!
|
||||
// Otherwise, copy-on-write.
|
||||
if (on !== on0 || listener0 !== listener) (on1 = (on0 = on).copy()).on(event, listener0 = listener);
|
||||
|
||||
schedule.on = on1;
|
||||
};
|
||||
}
|
||||
|
||||
export default function(name, value, priority) {
|
||||
var i = (name += "") === "transform" ? interpolateTransform : interpolate;
|
||||
return value == null ? this
|
||||
.styleTween(name, styleNull(name, i))
|
||||
.on("end.style." + name, styleRemove(name))
|
||||
: typeof value === "function" ? this
|
||||
.styleTween(name, styleFunction(name, i, tweenValue(this, "style." + name, value)))
|
||||
.each(styleMaybeRemove(this._id, name))
|
||||
: this
|
||||
.styleTween(name, styleConstant(name, i, value), priority)
|
||||
.on("end.style." + name, null);
|
||||
}
|
||||
24
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/styleTween.js
generated
vendored
Normal file
24
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/styleTween.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
function styleInterpolate(name, i, priority) {
|
||||
return function(t) {
|
||||
this.style.setProperty(name, i.call(this, t), priority);
|
||||
};
|
||||
}
|
||||
|
||||
function styleTween(name, value, priority) {
|
||||
var t, i0;
|
||||
function tween() {
|
||||
var i = value.apply(this, arguments);
|
||||
if (i !== i0) t = (i0 = i) && styleInterpolate(name, i, priority);
|
||||
return t;
|
||||
}
|
||||
tween._value = value;
|
||||
return tween;
|
||||
}
|
||||
|
||||
export default function(name, value, priority) {
|
||||
var key = "style." + (name += "");
|
||||
if (arguments.length < 2) return (key = this.tween(key)) && key._value;
|
||||
if (value == null) return this.tween(key, null);
|
||||
if (typeof value !== "function") throw new Error;
|
||||
return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
|
||||
}
|
||||
20
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/text.js
generated
vendored
Normal file
20
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/text.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import {tweenValue} from "./tween.js";
|
||||
|
||||
function textConstant(value) {
|
||||
return function() {
|
||||
this.textContent = value;
|
||||
};
|
||||
}
|
||||
|
||||
function textFunction(value) {
|
||||
return function() {
|
||||
var value1 = value(this);
|
||||
this.textContent = value1 == null ? "" : value1;
|
||||
};
|
||||
}
|
||||
|
||||
export default function(value) {
|
||||
return this.tween("text", typeof value === "function"
|
||||
? textFunction(tweenValue(this, "text", value))
|
||||
: textConstant(value == null ? "" : value + ""));
|
||||
}
|
||||
24
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/textTween.js
generated
vendored
Normal file
24
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/textTween.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
function textInterpolate(i) {
|
||||
return function(t) {
|
||||
this.textContent = i.call(this, t);
|
||||
};
|
||||
}
|
||||
|
||||
function textTween(value) {
|
||||
var t0, i0;
|
||||
function tween() {
|
||||
var i = value.apply(this, arguments);
|
||||
if (i !== i0) t0 = (i0 = i) && textInterpolate(i);
|
||||
return t0;
|
||||
}
|
||||
tween._value = value;
|
||||
return tween;
|
||||
}
|
||||
|
||||
export default function(value) {
|
||||
var key = "text";
|
||||
if (arguments.length < 1) return (key = this.tween(key)) && key._value;
|
||||
if (value == null) return this.tween(key, null);
|
||||
if (typeof value !== "function") throw new Error;
|
||||
return this.tween(key, textTween(value));
|
||||
}
|
||||
24
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/transition.js
generated
vendored
Normal file
24
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/transition.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import {Transition, newId} from "./index.js";
|
||||
import schedule, {get} from "./schedule.js";
|
||||
|
||||
export default function() {
|
||||
var name = this._name,
|
||||
id0 = this._id,
|
||||
id1 = newId();
|
||||
|
||||
for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {
|
||||
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
||||
if (node = group[i]) {
|
||||
var inherit = get(node, id0);
|
||||
schedule(node, name, id1, i, group, {
|
||||
time: inherit.time + inherit.delay + inherit.duration,
|
||||
delay: 0,
|
||||
duration: inherit.duration,
|
||||
ease: inherit.ease
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Transition(groups, this._parents, name, id1);
|
||||
}
|
||||
81
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/tween.js
generated
vendored
Normal file
81
lisp/emacs-application-framework/app/mermaid/node_modules/d3-transition/src/transition/tween.js
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
import {get, set} from "./schedule.js";
|
||||
|
||||
function tweenRemove(id, name) {
|
||||
var tween0, tween1;
|
||||
return function() {
|
||||
var schedule = set(this, id),
|
||||
tween = schedule.tween;
|
||||
|
||||
// If this node shared tween with the previous node,
|
||||
// just assign the updated shared tween and we’re done!
|
||||
// Otherwise, copy-on-write.
|
||||
if (tween !== tween0) {
|
||||
tween1 = tween0 = tween;
|
||||
for (var i = 0, n = tween1.length; i < n; ++i) {
|
||||
if (tween1[i].name === name) {
|
||||
tween1 = tween1.slice();
|
||||
tween1.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
schedule.tween = tween1;
|
||||
};
|
||||
}
|
||||
|
||||
function tweenFunction(id, name, value) {
|
||||
var tween0, tween1;
|
||||
if (typeof value !== "function") throw new Error;
|
||||
return function() {
|
||||
var schedule = set(this, id),
|
||||
tween = schedule.tween;
|
||||
|
||||
// If this node shared tween with the previous node,
|
||||
// just assign the updated shared tween and we’re done!
|
||||
// Otherwise, copy-on-write.
|
||||
if (tween !== tween0) {
|
||||
tween1 = (tween0 = tween).slice();
|
||||
for (var t = {name: name, value: value}, i = 0, n = tween1.length; i < n; ++i) {
|
||||
if (tween1[i].name === name) {
|
||||
tween1[i] = t;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i === n) tween1.push(t);
|
||||
}
|
||||
|
||||
schedule.tween = tween1;
|
||||
};
|
||||
}
|
||||
|
||||
export default function(name, value) {
|
||||
var id = this._id;
|
||||
|
||||
name += "";
|
||||
|
||||
if (arguments.length < 2) {
|
||||
var tween = get(this.node(), id).tween;
|
||||
for (var i = 0, n = tween.length, t; i < n; ++i) {
|
||||
if ((t = tween[i]).name === name) {
|
||||
return t.value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));
|
||||
}
|
||||
|
||||
export function tweenValue(transition, name, value) {
|
||||
var id = transition._id;
|
||||
|
||||
transition.each(function() {
|
||||
var schedule = set(this, id);
|
||||
(schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);
|
||||
});
|
||||
|
||||
return function(node) {
|
||||
return get(node, id).value[name];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user