@guardian/interactive-component-library 0.2.0-rc2 → 0.2.0-rc4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/molecules/canvas-map/lib/Map.js +2 -2
- package/dist/components/molecules/canvas-map/lib/projection/index.js +1 -1
- package/dist/components/molecules/canvas-map/lib/renderers/MapRenderer.js +1 -1
- package/dist/components/molecules/canvas-map/lib/sources/VectorSource.js +2 -2
- package/dist/components/molecules/modal/index.js +2 -2
- package/dist/components/molecules/result-summary/index.js +3 -1
- package/dist/components/molecules/svg-map/index.js +2 -1
- package/dist/components/molecules/svg-map/layers/Polygon.js +1 -1
- package/dist/components/particles/relative-time-sentence/index.js +2 -2
- package/package.json +14 -2
- package/dist/_virtual/_commonjsHelpers.js +0 -8
- package/dist/_virtual/dayjs.min.js +0 -4
- package/dist/_virtual/relativeTime.js +0 -4
- package/dist/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/color.js +0 -338
- package/dist/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/define.js +0 -13
- package/dist/node_modules/.pnpm/d3-composite-projections@1.4.0/node_modules/d3-composite-projections/src/albersUk.js +0 -108
- package/dist/node_modules/.pnpm/d3-composite-projections@1.4.0/node_modules/d3-composite-projections/src/bounds.js +0 -24
- package/dist/node_modules/.pnpm/d3-composite-projections@1.4.0/node_modules/d3-composite-projections/src/fit.js +0 -18
- package/dist/node_modules/.pnpm/d3-composite-projections@1.4.0/node_modules/d3-composite-projections/src/math.js +0 -4
- package/dist/node_modules/.pnpm/d3-dispatch@3.0.1/node_modules/d3-dispatch/src/dispatch.js +0 -70
- package/dist/node_modules/.pnpm/d3-ease@3.0.1/node_modules/d3-ease/src/cubic.js +0 -6
- package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/color.js +0 -24
- package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/constant.js +0 -4
- package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/number.js +0 -8
- package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/rgb.js +0 -20
- package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/string.js +0 -43
- package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/decompose.js +0 -28
- package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/index.js +0 -59
- package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/parse.js +0 -18
- package/dist/node_modules/.pnpm/d3-path@2.0.0/node_modules/d3-path/src/path.js +0 -73
- package/dist/node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timeout.js +0 -13
- package/dist/node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timer.js +0 -96
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/interrupt.js +0 -21
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/index.js +0 -5
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/interrupt.js +0 -9
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/transition.js +0 -39
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/attr.js +0 -55
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/attrTween.js +0 -42
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/delay.js +0 -18
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/duration.js +0 -18
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/ease.js +0 -14
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/easeVarying.js +0 -15
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/end.js +0 -23
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/filter.js +0 -16
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/index.js +0 -68
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/interpolate.js +0 -11
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/merge.js +0 -18
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/on.js +0 -23
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/remove.js +0 -13
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/schedule.js +0 -125
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/select.js +0 -20
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/selectAll.js +0 -24
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/selection.js +0 -8
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/style.js +0 -47
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/styleTween.js +0 -25
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/text.js +0 -18
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/textTween.js +0 -25
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/transition.js +0 -22
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/tween.js +0 -64
- package/dist/node_modules/.pnpm/dayjs@1.11.12/node_modules/dayjs/dayjs.min.js +0 -282
- package/dist/node_modules/.pnpm/dayjs@1.11.12/node_modules/dayjs/plugin/relativeTime.js +0 -48
- package/dist/node_modules/.pnpm/flatbush@4.4.0/node_modules/flatbush/index.js +0 -339
- package/dist/node_modules/.pnpm/flatqueue@2.0.3/node_modules/flatqueue/index.js +0 -67
- package/dist/node_modules/.pnpm/preact-merge-refs@1.0.2_preact@10.21.0/node_modules/preact-merge-refs/lib/preact-merge-refs.modern.js +0 -10
- package/dist/node_modules/.pnpm/preact-transitioning@1.4.1_preact@10.21.0/node_modules/preact-transitioning/lib/preact-transitioning.modern.js +0 -63
- package/dist/node_modules/.pnpm/quickselect@2.0.0/node_modules/quickselect/index.js +0 -47
- package/dist/node_modules/.pnpm/rbush-knn@4.0.0/node_modules/rbush-knn/index.js +0 -42
- package/dist/node_modules/.pnpm/rbush@4.0.0/node_modules/rbush/index.js +0 -378
- package/dist/node_modules/.pnpm/tinyqueue@2.0.3/node_modules/tinyqueue/index.js +0 -65
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { get, set } from "./schedule.js";
|
|
2
|
-
function durationFunction(id, value) {
|
|
3
|
-
return function() {
|
|
4
|
-
set(this, id).duration = +value.apply(this, arguments);
|
|
5
|
-
};
|
|
6
|
-
}
|
|
7
|
-
function durationConstant(id, value) {
|
|
8
|
-
return value = +value, function() {
|
|
9
|
-
set(this, id).duration = value;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
function transition_duration(value) {
|
|
13
|
-
var id = this._id;
|
|
14
|
-
return arguments.length ? this.each((typeof value === "function" ? durationFunction : durationConstant)(id, value)) : get(this.node(), id).duration;
|
|
15
|
-
}
|
|
16
|
-
export {
|
|
17
|
-
transition_duration as default
|
|
18
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { get, set } from "./schedule.js";
|
|
2
|
-
function easeConstant(id, value) {
|
|
3
|
-
if (typeof value !== "function") throw new Error();
|
|
4
|
-
return function() {
|
|
5
|
-
set(this, id).ease = value;
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
function transition_ease(value) {
|
|
9
|
-
var id = this._id;
|
|
10
|
-
return arguments.length ? this.each(easeConstant(id, value)) : get(this.node(), id).ease;
|
|
11
|
-
}
|
|
12
|
-
export {
|
|
13
|
-
transition_ease as default
|
|
14
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { set } from "./schedule.js";
|
|
2
|
-
function easeVarying(id, value) {
|
|
3
|
-
return function() {
|
|
4
|
-
var v = value.apply(this, arguments);
|
|
5
|
-
if (typeof v !== "function") throw new Error();
|
|
6
|
-
set(this, id).ease = v;
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
function transition_easeVarying(value) {
|
|
10
|
-
if (typeof value !== "function") throw new Error();
|
|
11
|
-
return this.each(easeVarying(this._id, value));
|
|
12
|
-
}
|
|
13
|
-
export {
|
|
14
|
-
transition_easeVarying as default
|
|
15
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { set } from "./schedule.js";
|
|
2
|
-
function transition_end() {
|
|
3
|
-
var on0, on1, that = this, id = that._id, size = that.size();
|
|
4
|
-
return new Promise(function(resolve, reject) {
|
|
5
|
-
var cancel = { value: reject }, end = { value: function() {
|
|
6
|
-
if (--size === 0) resolve();
|
|
7
|
-
} };
|
|
8
|
-
that.each(function() {
|
|
9
|
-
var schedule = set(this, id), on = schedule.on;
|
|
10
|
-
if (on !== on0) {
|
|
11
|
-
on1 = (on0 = on).copy();
|
|
12
|
-
on1._.cancel.push(cancel);
|
|
13
|
-
on1._.interrupt.push(cancel);
|
|
14
|
-
on1._.end.push(end);
|
|
15
|
-
}
|
|
16
|
-
schedule.on = on1;
|
|
17
|
-
});
|
|
18
|
-
if (size === 0) resolve();
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
export {
|
|
22
|
-
transition_end as default
|
|
23
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { matcher } from "d3-selection";
|
|
2
|
-
import { Transition } from "./index.js";
|
|
3
|
-
function transition_filter(match) {
|
|
4
|
-
if (typeof match !== "function") match = matcher(match);
|
|
5
|
-
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
|
|
6
|
-
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {
|
|
7
|
-
if ((node = group[i]) && match.call(node, node.__data__, i, group)) {
|
|
8
|
-
subgroup.push(node);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
return new Transition(subgroups, this._parents, this._name, this._id);
|
|
13
|
-
}
|
|
14
|
-
export {
|
|
15
|
-
transition_filter as default
|
|
16
|
-
};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { selection } from "d3-selection";
|
|
2
|
-
import transition_attr from "./attr.js";
|
|
3
|
-
import transition_attrTween from "./attrTween.js";
|
|
4
|
-
import transition_delay from "./delay.js";
|
|
5
|
-
import transition_duration from "./duration.js";
|
|
6
|
-
import transition_ease from "./ease.js";
|
|
7
|
-
import transition_easeVarying from "./easeVarying.js";
|
|
8
|
-
import transition_filter from "./filter.js";
|
|
9
|
-
import transition_merge from "./merge.js";
|
|
10
|
-
import transition_on from "./on.js";
|
|
11
|
-
import transition_remove from "./remove.js";
|
|
12
|
-
import transition_select from "./select.js";
|
|
13
|
-
import transition_selectAll from "./selectAll.js";
|
|
14
|
-
import transition_selection from "./selection.js";
|
|
15
|
-
import transition_style from "./style.js";
|
|
16
|
-
import transition_styleTween from "./styleTween.js";
|
|
17
|
-
import transition_text from "./text.js";
|
|
18
|
-
import transition_textTween from "./textTween.js";
|
|
19
|
-
import transition_transition from "./transition.js";
|
|
20
|
-
import transition_tween from "./tween.js";
|
|
21
|
-
import transition_end from "./end.js";
|
|
22
|
-
var id = 0;
|
|
23
|
-
function Transition(groups, parents, name, id2) {
|
|
24
|
-
this._groups = groups;
|
|
25
|
-
this._parents = parents;
|
|
26
|
-
this._name = name;
|
|
27
|
-
this._id = id2;
|
|
28
|
-
}
|
|
29
|
-
function newId() {
|
|
30
|
-
return ++id;
|
|
31
|
-
}
|
|
32
|
-
var selection_prototype = selection.prototype;
|
|
33
|
-
Transition.prototype = {
|
|
34
|
-
constructor: Transition,
|
|
35
|
-
select: transition_select,
|
|
36
|
-
selectAll: transition_selectAll,
|
|
37
|
-
selectChild: selection_prototype.selectChild,
|
|
38
|
-
selectChildren: selection_prototype.selectChildren,
|
|
39
|
-
filter: transition_filter,
|
|
40
|
-
merge: transition_merge,
|
|
41
|
-
selection: transition_selection,
|
|
42
|
-
transition: transition_transition,
|
|
43
|
-
call: selection_prototype.call,
|
|
44
|
-
nodes: selection_prototype.nodes,
|
|
45
|
-
node: selection_prototype.node,
|
|
46
|
-
size: selection_prototype.size,
|
|
47
|
-
empty: selection_prototype.empty,
|
|
48
|
-
each: selection_prototype.each,
|
|
49
|
-
on: transition_on,
|
|
50
|
-
attr: transition_attr,
|
|
51
|
-
attrTween: transition_attrTween,
|
|
52
|
-
style: transition_style,
|
|
53
|
-
styleTween: transition_styleTween,
|
|
54
|
-
text: transition_text,
|
|
55
|
-
textTween: transition_textTween,
|
|
56
|
-
remove: transition_remove,
|
|
57
|
-
tween: transition_tween,
|
|
58
|
-
delay: transition_delay,
|
|
59
|
-
duration: transition_duration,
|
|
60
|
-
ease: transition_ease,
|
|
61
|
-
easeVarying: transition_easeVarying,
|
|
62
|
-
end: transition_end,
|
|
63
|
-
[Symbol.iterator]: selection_prototype[Symbol.iterator]
|
|
64
|
-
};
|
|
65
|
-
export {
|
|
66
|
-
Transition,
|
|
67
|
-
newId
|
|
68
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import interpolateNumber from "../../../../../d3-interpolate@3.0.1/node_modules/d3-interpolate/src/number.js";
|
|
2
|
-
import color from "../../../../../d3-color@3.1.0/node_modules/d3-color/src/color.js";
|
|
3
|
-
import interpolateRgb from "../../../../../d3-interpolate@3.0.1/node_modules/d3-interpolate/src/rgb.js";
|
|
4
|
-
import interpolateString from "../../../../../d3-interpolate@3.0.1/node_modules/d3-interpolate/src/string.js";
|
|
5
|
-
function interpolate(a, b) {
|
|
6
|
-
var c;
|
|
7
|
-
return (typeof b === "number" ? interpolateNumber : b instanceof color ? interpolateRgb : (c = color(b)) ? (b = c, interpolateRgb) : interpolateString)(a, b);
|
|
8
|
-
}
|
|
9
|
-
export {
|
|
10
|
-
interpolate as default
|
|
11
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Transition } from "./index.js";
|
|
2
|
-
function transition_merge(transition) {
|
|
3
|
-
if (transition._id !== this._id) throw new Error();
|
|
4
|
-
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) {
|
|
5
|
-
for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {
|
|
6
|
-
if (node = group0[i] || group1[i]) {
|
|
7
|
-
merge[i] = node;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
for (; j < m0; ++j) {
|
|
12
|
-
merges[j] = groups0[j];
|
|
13
|
-
}
|
|
14
|
-
return new Transition(merges, this._parents, this._name, this._id);
|
|
15
|
-
}
|
|
16
|
-
export {
|
|
17
|
-
transition_merge as default
|
|
18
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { get, init, set } from "./schedule.js";
|
|
2
|
-
function start(name) {
|
|
3
|
-
return (name + "").trim().split(/^|\s+/).every(function(t) {
|
|
4
|
-
var i = t.indexOf(".");
|
|
5
|
-
if (i >= 0) t = t.slice(0, i);
|
|
6
|
-
return !t || t === "start";
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
function onFunction(id, name, listener) {
|
|
10
|
-
var on0, on1, sit = start(name) ? init : set;
|
|
11
|
-
return function() {
|
|
12
|
-
var schedule = sit(this, id), on = schedule.on;
|
|
13
|
-
if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener);
|
|
14
|
-
schedule.on = on1;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function transition_on(name, listener) {
|
|
18
|
-
var id = this._id;
|
|
19
|
-
return arguments.length < 2 ? get(this.node(), id).on.on(name) : this.each(onFunction(id, name, listener));
|
|
20
|
-
}
|
|
21
|
-
export {
|
|
22
|
-
transition_on as default
|
|
23
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
function removeFunction(id) {
|
|
2
|
-
return function() {
|
|
3
|
-
var parent = this.parentNode;
|
|
4
|
-
for (var i in this.__transition) if (+i !== id) return;
|
|
5
|
-
if (parent) parent.removeChild(this);
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
function transition_remove() {
|
|
9
|
-
return this.on("end.remove", removeFunction(this._id));
|
|
10
|
-
}
|
|
11
|
-
export {
|
|
12
|
-
transition_remove as default
|
|
13
|
-
};
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import dispatch from "../../../../../d3-dispatch@3.0.1/node_modules/d3-dispatch/src/dispatch.js";
|
|
2
|
-
import { timer } from "../../../../../d3-timer@3.0.1/node_modules/d3-timer/src/timer.js";
|
|
3
|
-
import timeout from "../../../../../d3-timer@3.0.1/node_modules/d3-timer/src/timeout.js";
|
|
4
|
-
var emptyOn = dispatch("start", "end", "cancel", "interrupt");
|
|
5
|
-
var emptyTween = [];
|
|
6
|
-
var CREATED = 0;
|
|
7
|
-
var SCHEDULED = 1;
|
|
8
|
-
var STARTING = 2;
|
|
9
|
-
var STARTED = 3;
|
|
10
|
-
var RUNNING = 4;
|
|
11
|
-
var ENDING = 5;
|
|
12
|
-
var ENDED = 6;
|
|
13
|
-
function schedule(node, name, id, index, group, timing) {
|
|
14
|
-
var schedules = node.__transition;
|
|
15
|
-
if (!schedules) node.__transition = {};
|
|
16
|
-
else if (id in schedules) return;
|
|
17
|
-
create(node, id, {
|
|
18
|
-
name,
|
|
19
|
-
index,
|
|
20
|
-
// For context during callback.
|
|
21
|
-
group,
|
|
22
|
-
// For context during callback.
|
|
23
|
-
on: emptyOn,
|
|
24
|
-
tween: emptyTween,
|
|
25
|
-
time: timing.time,
|
|
26
|
-
delay: timing.delay,
|
|
27
|
-
duration: timing.duration,
|
|
28
|
-
ease: timing.ease,
|
|
29
|
-
timer: null,
|
|
30
|
-
state: CREATED
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
function init(node, id) {
|
|
34
|
-
var schedule2 = get(node, id);
|
|
35
|
-
if (schedule2.state > CREATED) throw new Error("too late; already scheduled");
|
|
36
|
-
return schedule2;
|
|
37
|
-
}
|
|
38
|
-
function set(node, id) {
|
|
39
|
-
var schedule2 = get(node, id);
|
|
40
|
-
if (schedule2.state > STARTED) throw new Error("too late; already running");
|
|
41
|
-
return schedule2;
|
|
42
|
-
}
|
|
43
|
-
function get(node, id) {
|
|
44
|
-
var schedule2 = node.__transition;
|
|
45
|
-
if (!schedule2 || !(schedule2 = schedule2[id])) throw new Error("transition not found");
|
|
46
|
-
return schedule2;
|
|
47
|
-
}
|
|
48
|
-
function create(node, id, self) {
|
|
49
|
-
var schedules = node.__transition, tween;
|
|
50
|
-
schedules[id] = self;
|
|
51
|
-
self.timer = timer(schedule2, 0, self.time);
|
|
52
|
-
function schedule2(elapsed) {
|
|
53
|
-
self.state = SCHEDULED;
|
|
54
|
-
self.timer.restart(start, self.delay, self.time);
|
|
55
|
-
if (self.delay <= elapsed) start(elapsed - self.delay);
|
|
56
|
-
}
|
|
57
|
-
function start(elapsed) {
|
|
58
|
-
var i, j, n, o;
|
|
59
|
-
if (self.state !== SCHEDULED) return stop();
|
|
60
|
-
for (i in schedules) {
|
|
61
|
-
o = schedules[i];
|
|
62
|
-
if (o.name !== self.name) continue;
|
|
63
|
-
if (o.state === STARTED) return timeout(start);
|
|
64
|
-
if (o.state === RUNNING) {
|
|
65
|
-
o.state = ENDED;
|
|
66
|
-
o.timer.stop();
|
|
67
|
-
o.on.call("interrupt", node, node.__data__, o.index, o.group);
|
|
68
|
-
delete schedules[i];
|
|
69
|
-
} else if (+i < id) {
|
|
70
|
-
o.state = ENDED;
|
|
71
|
-
o.timer.stop();
|
|
72
|
-
o.on.call("cancel", node, node.__data__, o.index, o.group);
|
|
73
|
-
delete schedules[i];
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
timeout(function() {
|
|
77
|
-
if (self.state === STARTED) {
|
|
78
|
-
self.state = RUNNING;
|
|
79
|
-
self.timer.restart(tick, self.delay, self.time);
|
|
80
|
-
tick(elapsed);
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
self.state = STARTING;
|
|
84
|
-
self.on.call("start", node, node.__data__, self.index, self.group);
|
|
85
|
-
if (self.state !== STARTING) return;
|
|
86
|
-
self.state = STARTED;
|
|
87
|
-
tween = new Array(n = self.tween.length);
|
|
88
|
-
for (i = 0, j = -1; i < n; ++i) {
|
|
89
|
-
if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) {
|
|
90
|
-
tween[++j] = o;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
tween.length = j + 1;
|
|
94
|
-
}
|
|
95
|
-
function tick(elapsed) {
|
|
96
|
-
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;
|
|
97
|
-
while (++i < n) {
|
|
98
|
-
tween[i].call(node, t);
|
|
99
|
-
}
|
|
100
|
-
if (self.state === ENDING) {
|
|
101
|
-
self.on.call("end", node, node.__data__, self.index, self.group);
|
|
102
|
-
stop();
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
function stop() {
|
|
106
|
-
self.state = ENDED;
|
|
107
|
-
self.timer.stop();
|
|
108
|
-
delete schedules[id];
|
|
109
|
-
for (var i in schedules) return;
|
|
110
|
-
delete node.__transition;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
export {
|
|
114
|
-
CREATED,
|
|
115
|
-
ENDED,
|
|
116
|
-
ENDING,
|
|
117
|
-
RUNNING,
|
|
118
|
-
SCHEDULED,
|
|
119
|
-
STARTED,
|
|
120
|
-
STARTING,
|
|
121
|
-
schedule as default,
|
|
122
|
-
get,
|
|
123
|
-
init,
|
|
124
|
-
set
|
|
125
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { selector } from "d3-selection";
|
|
2
|
-
import { Transition } from "./index.js";
|
|
3
|
-
import schedule, { get } from "./schedule.js";
|
|
4
|
-
function transition_select(select) {
|
|
5
|
-
var name = this._name, id = this._id;
|
|
6
|
-
if (typeof select !== "function") select = selector(select);
|
|
7
|
-
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
|
|
8
|
-
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {
|
|
9
|
-
if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
|
|
10
|
-
if ("__data__" in node) subnode.__data__ = node.__data__;
|
|
11
|
-
subgroup[i] = subnode;
|
|
12
|
-
schedule(subgroup[i], name, id, i, subgroup, get(node, id));
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return new Transition(subgroups, this._parents, name, id);
|
|
17
|
-
}
|
|
18
|
-
export {
|
|
19
|
-
transition_select as default
|
|
20
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { selectorAll } from "d3-selection";
|
|
2
|
-
import { Transition } from "./index.js";
|
|
3
|
-
import schedule, { get } from "./schedule.js";
|
|
4
|
-
function transition_selectAll(select) {
|
|
5
|
-
var name = this._name, id = this._id;
|
|
6
|
-
if (typeof select !== "function") select = selectorAll(select);
|
|
7
|
-
for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
|
|
8
|
-
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
|
9
|
-
if (node = group[i]) {
|
|
10
|
-
for (var children = select.call(node, node.__data__, i, group), child, inherit = get(node, id), k = 0, l = children.length; k < l; ++k) {
|
|
11
|
-
if (child = children[k]) {
|
|
12
|
-
schedule(child, name, id, k, children, inherit);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
subgroups.push(children);
|
|
16
|
-
parents.push(node);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return new Transition(subgroups, parents, name, id);
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
transition_selectAll as default
|
|
24
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { style } from "d3-selection";
|
|
2
|
-
import { set } from "./schedule.js";
|
|
3
|
-
import { tweenValue } from "./tween.js";
|
|
4
|
-
import interpolate from "./interpolate.js";
|
|
5
|
-
import { interpolateTransformCss } from "../../../../../d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/index.js";
|
|
6
|
-
function styleNull(name, interpolate2) {
|
|
7
|
-
var string00, string10, interpolate0;
|
|
8
|
-
return function() {
|
|
9
|
-
var string0 = style(this, name), string1 = (this.style.removeProperty(name), style(this, name));
|
|
10
|
-
return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : interpolate0 = interpolate2(string00 = string0, string10 = string1);
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
function styleRemove(name) {
|
|
14
|
-
return function() {
|
|
15
|
-
this.style.removeProperty(name);
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
function styleConstant(name, interpolate2, value1) {
|
|
19
|
-
var string00, string1 = value1 + "", interpolate0;
|
|
20
|
-
return function() {
|
|
21
|
-
var string0 = style(this, name);
|
|
22
|
-
return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate2(string00 = string0, value1);
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
function styleFunction(name, interpolate2, value) {
|
|
26
|
-
var string00, string10, interpolate0;
|
|
27
|
-
return function() {
|
|
28
|
-
var string0 = style(this, name), value1 = value(this), string1 = value1 + "";
|
|
29
|
-
if (value1 == null) string1 = value1 = (this.style.removeProperty(name), style(this, name));
|
|
30
|
-
return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate2(string00 = string0, value1));
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function styleMaybeRemove(id, name) {
|
|
34
|
-
var on0, on1, listener0, key = "style." + name, event = "end." + key, remove;
|
|
35
|
-
return function() {
|
|
36
|
-
var schedule = set(this, id), on = schedule.on, listener = schedule.value[key] == null ? remove || (remove = styleRemove(name)) : void 0;
|
|
37
|
-
if (on !== on0 || listener0 !== listener) (on1 = (on0 = on).copy()).on(event, listener0 = listener);
|
|
38
|
-
schedule.on = on1;
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
function transition_style(name, value, priority) {
|
|
42
|
-
var i = (name += "") === "transform" ? interpolateTransformCss : interpolate;
|
|
43
|
-
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);
|
|
44
|
-
}
|
|
45
|
-
export {
|
|
46
|
-
transition_style as default
|
|
47
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
function styleInterpolate(name, i, priority) {
|
|
2
|
-
return function(t) {
|
|
3
|
-
this.style.setProperty(name, i.call(this, t), priority);
|
|
4
|
-
};
|
|
5
|
-
}
|
|
6
|
-
function styleTween(name, value, priority) {
|
|
7
|
-
var t, i0;
|
|
8
|
-
function tween() {
|
|
9
|
-
var i = value.apply(this, arguments);
|
|
10
|
-
if (i !== i0) t = (i0 = i) && styleInterpolate(name, i, priority);
|
|
11
|
-
return t;
|
|
12
|
-
}
|
|
13
|
-
tween._value = value;
|
|
14
|
-
return tween;
|
|
15
|
-
}
|
|
16
|
-
function transition_styleTween(name, value, priority) {
|
|
17
|
-
var key = "style." + (name += "");
|
|
18
|
-
if (arguments.length < 2) return (key = this.tween(key)) && key._value;
|
|
19
|
-
if (value == null) return this.tween(key, null);
|
|
20
|
-
if (typeof value !== "function") throw new Error();
|
|
21
|
-
return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
|
|
22
|
-
}
|
|
23
|
-
export {
|
|
24
|
-
transition_styleTween as default
|
|
25
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { tweenValue } from "./tween.js";
|
|
2
|
-
function textConstant(value) {
|
|
3
|
-
return function() {
|
|
4
|
-
this.textContent = value;
|
|
5
|
-
};
|
|
6
|
-
}
|
|
7
|
-
function textFunction(value) {
|
|
8
|
-
return function() {
|
|
9
|
-
var value1 = value(this);
|
|
10
|
-
this.textContent = value1 == null ? "" : value1;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
function transition_text(value) {
|
|
14
|
-
return this.tween("text", typeof value === "function" ? textFunction(tweenValue(this, "text", value)) : textConstant(value == null ? "" : value + ""));
|
|
15
|
-
}
|
|
16
|
-
export {
|
|
17
|
-
transition_text as default
|
|
18
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
function textInterpolate(i) {
|
|
2
|
-
return function(t) {
|
|
3
|
-
this.textContent = i.call(this, t);
|
|
4
|
-
};
|
|
5
|
-
}
|
|
6
|
-
function textTween(value) {
|
|
7
|
-
var t0, i0;
|
|
8
|
-
function tween() {
|
|
9
|
-
var i = value.apply(this, arguments);
|
|
10
|
-
if (i !== i0) t0 = (i0 = i) && textInterpolate(i);
|
|
11
|
-
return t0;
|
|
12
|
-
}
|
|
13
|
-
tween._value = value;
|
|
14
|
-
return tween;
|
|
15
|
-
}
|
|
16
|
-
function transition_textTween(value) {
|
|
17
|
-
var key = "text";
|
|
18
|
-
if (arguments.length < 1) return (key = this.tween(key)) && key._value;
|
|
19
|
-
if (value == null) return this.tween(key, null);
|
|
20
|
-
if (typeof value !== "function") throw new Error();
|
|
21
|
-
return this.tween(key, textTween(value));
|
|
22
|
-
}
|
|
23
|
-
export {
|
|
24
|
-
transition_textTween as default
|
|
25
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Transition, newId } from "./index.js";
|
|
2
|
-
import schedule, { get } from "./schedule.js";
|
|
3
|
-
function transition_transition() {
|
|
4
|
-
var name = this._name, id0 = this._id, id1 = newId();
|
|
5
|
-
for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {
|
|
6
|
-
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
|
7
|
-
if (node = group[i]) {
|
|
8
|
-
var inherit = get(node, id0);
|
|
9
|
-
schedule(node, name, id1, i, group, {
|
|
10
|
-
time: inherit.time + inherit.delay + inherit.duration,
|
|
11
|
-
delay: 0,
|
|
12
|
-
duration: inherit.duration,
|
|
13
|
-
ease: inherit.ease
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return new Transition(groups, this._parents, name, id1);
|
|
19
|
-
}
|
|
20
|
-
export {
|
|
21
|
-
transition_transition as default
|
|
22
|
-
};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { get, set } from "./schedule.js";
|
|
2
|
-
function tweenRemove(id, name) {
|
|
3
|
-
var tween0, tween1;
|
|
4
|
-
return function() {
|
|
5
|
-
var schedule = set(this, id), tween = schedule.tween;
|
|
6
|
-
if (tween !== tween0) {
|
|
7
|
-
tween1 = tween0 = tween;
|
|
8
|
-
for (var i = 0, n = tween1.length; i < n; ++i) {
|
|
9
|
-
if (tween1[i].name === name) {
|
|
10
|
-
tween1 = tween1.slice();
|
|
11
|
-
tween1.splice(i, 1);
|
|
12
|
-
break;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
schedule.tween = tween1;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
function tweenFunction(id, name, value) {
|
|
20
|
-
var tween0, tween1;
|
|
21
|
-
if (typeof value !== "function") throw new Error();
|
|
22
|
-
return function() {
|
|
23
|
-
var schedule = set(this, id), tween = schedule.tween;
|
|
24
|
-
if (tween !== tween0) {
|
|
25
|
-
tween1 = (tween0 = tween).slice();
|
|
26
|
-
for (var t = { name, value }, i = 0, n = tween1.length; i < n; ++i) {
|
|
27
|
-
if (tween1[i].name === name) {
|
|
28
|
-
tween1[i] = t;
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
if (i === n) tween1.push(t);
|
|
33
|
-
}
|
|
34
|
-
schedule.tween = tween1;
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
function transition_tween(name, value) {
|
|
38
|
-
var id = this._id;
|
|
39
|
-
name += "";
|
|
40
|
-
if (arguments.length < 2) {
|
|
41
|
-
var tween = get(this.node(), id).tween;
|
|
42
|
-
for (var i = 0, n = tween.length, t; i < n; ++i) {
|
|
43
|
-
if ((t = tween[i]).name === name) {
|
|
44
|
-
return t.value;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));
|
|
50
|
-
}
|
|
51
|
-
function tweenValue(transition, name, value) {
|
|
52
|
-
var id = transition._id;
|
|
53
|
-
transition.each(function() {
|
|
54
|
-
var schedule = set(this, id);
|
|
55
|
-
(schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);
|
|
56
|
-
});
|
|
57
|
-
return function(node) {
|
|
58
|
-
return get(node, id).value[name];
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
export {
|
|
62
|
-
transition_tween as default,
|
|
63
|
-
tweenValue
|
|
64
|
-
};
|