ex4nicegui 0.3.2__py3-none-any.whl → 0.4.0__py3-none-any.whl

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.
Files changed (39) hide show
  1. ex4nicegui/__init__.py +1 -1
  2. ex4nicegui/bi/dataSource.py +4 -4
  3. ex4nicegui/bi/elements/ui_aggrid.py +1 -7
  4. ex4nicegui/bi/elements/ui_echarts.py +5 -9
  5. ex4nicegui/reactive/EChartsComponent/ECharts.js +44 -43982
  6. ex4nicegui/reactive/EChartsComponent/ECharts.py +69 -30
  7. ex4nicegui/reactive/__index.py +1 -0
  8. ex4nicegui/reactive/libs/__init__.py +0 -0
  9. ex4nicegui/reactive/libs/d3/__init__.py +0 -0
  10. ex4nicegui/reactive/libs/d3/d3-color.ems.js +7 -0
  11. ex4nicegui/reactive/libs/d3/d3-dispatch.ems.js +7 -0
  12. ex4nicegui/reactive/libs/d3/d3-drag.ems.js +7 -0
  13. ex4nicegui/reactive/libs/d3/d3-ease.ems.js +7 -0
  14. ex4nicegui/reactive/libs/d3/d3-interpolate.ems.js +7 -0
  15. ex4nicegui/reactive/libs/d3/d3-selection.ems.js +7 -0
  16. ex4nicegui/reactive/libs/d3/d3-timer.ems.js +7 -0
  17. ex4nicegui/reactive/libs/d3/d3-transition.ems.js +7 -0
  18. ex4nicegui/reactive/libs/d3/d3-zoom.ems.js +7 -0
  19. ex4nicegui/reactive/mermaid/__init__.py +0 -0
  20. ex4nicegui/reactive/mermaid/mermaid.js +75 -0
  21. ex4nicegui/reactive/mermaid/mermaid.py +64 -0
  22. ex4nicegui/reactive/officials/base.py +2 -1
  23. ex4nicegui/reactive/officials/checkbox.py +2 -1
  24. ex4nicegui/reactive/officials/date.py +2 -1
  25. ex4nicegui/reactive/officials/echarts.py +102 -5
  26. ex4nicegui/reactive/officials/input.py +2 -1
  27. ex4nicegui/reactive/officials/label.py +2 -2
  28. ex4nicegui/reactive/officials/radio.py +2 -1
  29. ex4nicegui/reactive/officials/select.py +3 -10
  30. ex4nicegui/reactive/officials/slider.py +2 -1
  31. ex4nicegui/reactive/officials/switch.py +2 -1
  32. ex4nicegui/reactive/officials/table.py +7 -10
  33. ex4nicegui/reactive/officials/textarea.py +2 -1
  34. ex4nicegui/utils/clientScope.py +3 -3
  35. {ex4nicegui-0.3.2.dist-info → ex4nicegui-0.4.0.dist-info}/METADATA +2 -2
  36. {ex4nicegui-0.3.2.dist-info → ex4nicegui-0.4.0.dist-info}/RECORD +39 -25
  37. {ex4nicegui-0.3.2.dist-info → ex4nicegui-0.4.0.dist-info}/LICENSE +0 -0
  38. {ex4nicegui-0.3.2.dist-info → ex4nicegui-0.4.0.dist-info}/WHEEL +0 -0
  39. {ex4nicegui-0.3.2.dist-info → ex4nicegui-0.4.0.dist-info}/top_level.txt +0 -0
@@ -1,8 +1,16 @@
1
- from typing import Any, Callable, Optional
1
+ from typing import Any, Callable, Dict, List, Optional, Union
2
+ from typing_extensions import Literal
2
3
  from dataclasses import dataclass
3
4
  from nicegui.dataclasses import KWONLY_SLOTS
4
5
  from nicegui.events import handle_event, UiEventArguments
5
6
  from nicegui.element import Element
7
+ from nicegui import context as ng_context
8
+ from pathlib import Path
9
+ import nicegui
10
+ import uuid
11
+
12
+ NG_ROOT = Path(nicegui.__file__).parent / "elements"
13
+ libraries = [NG_ROOT / "lib/echarts/echarts.min.js"]
6
14
 
7
15
 
8
16
  _Chart_Click_Args = [
@@ -20,7 +28,7 @@ _Chart_Click_Args = [
20
28
 
21
29
 
22
30
  @dataclass(**KWONLY_SLOTS)
23
- class EChartsClickEventArguments(UiEventArguments):
31
+ class EChartsMouseEventArguments(UiEventArguments):
24
32
  componentType: str
25
33
  seriesType: str
26
34
  seriesIndex: int
@@ -33,11 +41,51 @@ class EChartsClickEventArguments(UiEventArguments):
33
41
  color: str
34
42
 
35
43
 
36
- class echarts(Element, component="ECharts.js"):
44
+ _T_echats_on_callback = Callable[[EChartsMouseEventArguments], Any]
45
+ _T_mouse_event_name = Literal[
46
+ "click",
47
+ "dblclick",
48
+ "mousedown",
49
+ "mousemove",
50
+ "mouseup",
51
+ "mouseover",
52
+ "mouseout",
53
+ "globalout",
54
+ "contextmenu",
55
+ ]
56
+
57
+
58
+ class echarts(Element, component="ECharts.js", libraries=libraries): # type: ignore
37
59
  def __init__(self, options: dict) -> None:
38
60
  super().__init__()
39
61
  self._props["options"] = options
40
62
 
63
+ self._echarts_on_tasks: List[Callable] = []
64
+ self._echarts_on_callback_map: Dict[str, _T_echats_on_callback] = {}
65
+
66
+ async def on_client_connect(client: nicegui.Client) -> Any:
67
+ await client.connected()
68
+
69
+ for func in self._echarts_on_tasks:
70
+ func()
71
+
72
+ client.connect_handlers.remove(on_client_connect) # type: ignore
73
+
74
+ ng_context.get_client().on_connect(on_client_connect)
75
+
76
+ def echartsOn_handler(e):
77
+ callbackId = e.args["callbackId"]
78
+ params: Dict = e.args["params"]
79
+ params["dataType"] = params.get("dataType")
80
+
81
+ if callbackId in self._echarts_on_callback_map:
82
+ event_args = EChartsMouseEventArguments(e.sender, e.client, **params)
83
+ handler = self._echarts_on_callback_map[callbackId]
84
+
85
+ handle_event(handler, event_args)
86
+
87
+ self.on("event_on", echartsOn_handler)
88
+
41
89
  def update_options(self, options: dict, opts: Optional[dict] = None):
42
90
  """update chart options
43
91
 
@@ -60,41 +108,32 @@ class echarts(Element, component="ECharts.js"):
60
108
  self.update()
61
109
  return self
62
110
 
63
- def on_chart_click(
64
- self, handler: Optional[Callable[[EChartsClickEventArguments], Any]]
65
- ):
111
+ def on_click_blank(self, handler: Optional[Callable[[UiEventArguments], Any]]):
66
112
  def inner_handler(e):
67
- args = e.args
68
113
  handle_event(
69
114
  handler,
70
- EChartsClickEventArguments(
115
+ UiEventArguments(
71
116
  sender=self,
72
117
  client=self.client,
73
- componentType=args["componentType"],
74
- seriesType=args["seriesType"],
75
- seriesIndex=args["seriesIndex"],
76
- seriesName=args["seriesName"],
77
- name=args["name"],
78
- dataIndex=args["dataIndex"],
79
- data=args["data"],
80
- dataType=args["dataType"] if "dataType" in args else None,
81
- value=args["value"],
82
- color=args["color"],
83
118
  ),
84
119
  )
85
120
 
86
- self.on("chartClick", inner_handler, _Chart_Click_Args)
121
+ self.on("clickBlank", inner_handler, _Chart_Click_Args)
87
122
 
88
- def on_chart_click_blank(
89
- self, handler: Optional[Callable[[UiEventArguments], Any]]
123
+ def echarts_on(
124
+ self,
125
+ event_name: _T_mouse_event_name,
126
+ handler: _T_echats_on_callback,
127
+ query: Optional[Union[str, Dict]] = None,
90
128
  ):
91
- def inner_handler(e):
92
- handle_event(
93
- handler,
94
- UiEventArguments(
95
- sender=self,
96
- client=self.client,
97
- ),
98
- )
129
+ if not ng_context.get_client().has_socket_connection:
130
+
131
+ def task_func():
132
+ self.echarts_on(event_name, handler, query)
133
+
134
+ self._echarts_on_tasks.append(task_func)
135
+ return
99
136
 
100
- self.on("chartClickBlank", inner_handler, _Chart_Click_Args)
137
+ callback_id = uuid.uuid4().hex
138
+ self.run_method("echarts_on", event_name, query, callback_id)
139
+ self._echarts_on_callback_map[callback_id] = handler
@@ -9,3 +9,4 @@ from .useMouse.UseMouse import use_mouse
9
9
  from .usePagination import PaginationRef as use_pagination
10
10
  from .dropZone.dropZone import use_drag_zone
11
11
  from .fileWatcher import FilesWatcher
12
+ from .mermaid.mermaid import Mermaid as mermaid
File without changes
File without changes
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2.
3
+ * Original file: /npm/d3-color@3.1.0/src/index.js
4
+ *
5
+ * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
6
+ */
7
+ function t(t, e, i) { t.prototype = e.prototype = i, i.constructor = t } function e(t, e) { var i = Object.create(t.prototype); for (var n in e) i[n] = e[n]; return i } function i() { } var n = .7, r = 1 / n, a = "\\s*([+-]?\\d+)\\s*", s = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", h = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", o = /^#([0-9a-f]{3,8})$/, l = new RegExp(`^rgb\\(${a},${a},${a}\\)$`), u = new RegExp(`^rgb\\(${h},${h},${h}\\)$`), c = new RegExp(`^rgba\\(${a},${a},${a},${s}\\)$`), g = new RegExp(`^rgba\\(${h},${h},${h},${s}\\)$`), p = new RegExp(`^hsl\\(${s},${h},${h}\\)$`), b = new RegExp(`^hsla\\(${s},${h},${h},${s}\\)$`), d = { aliceblue: 15792383, antiquewhite: 16444375, aqua: 65535, aquamarine: 8388564, azure: 15794175, beige: 16119260, bisque: 16770244, black: 0, blanchedalmond: 16772045, blue: 255, blueviolet: 9055202, brown: 10824234, burlywood: 14596231, cadetblue: 6266528, chartreuse: 8388352, chocolate: 13789470, coral: 16744272, cornflowerblue: 6591981, cornsilk: 16775388, crimson: 14423100, cyan: 65535, darkblue: 139, darkcyan: 35723, darkgoldenrod: 12092939, darkgray: 11119017, darkgreen: 25600, darkgrey: 11119017, darkkhaki: 12433259, darkmagenta: 9109643, darkolivegreen: 5597999, darkorange: 16747520, darkorchid: 10040012, darkred: 9109504, darksalmon: 15308410, darkseagreen: 9419919, darkslateblue: 4734347, darkslategray: 3100495, darkslategrey: 3100495, darkturquoise: 52945, darkviolet: 9699539, deeppink: 16716947, deepskyblue: 49151, dimgray: 6908265, dimgrey: 6908265, dodgerblue: 2003199, firebrick: 11674146, floralwhite: 16775920, forestgreen: 2263842, fuchsia: 16711935, gainsboro: 14474460, ghostwhite: 16316671, gold: 16766720, goldenrod: 14329120, gray: 8421504, green: 32768, greenyellow: 11403055, grey: 8421504, honeydew: 15794160, hotpink: 16738740, indianred: 13458524, indigo: 4915330, ivory: 16777200, khaki: 15787660, lavender: 15132410, lavenderblush: 16773365, lawngreen: 8190976, lemonchiffon: 16775885, lightblue: 11393254, lightcoral: 15761536, lightcyan: 14745599, lightgoldenrodyellow: 16448210, lightgray: 13882323, lightgreen: 9498256, lightgrey: 13882323, lightpink: 16758465, lightsalmon: 16752762, lightseagreen: 2142890, lightskyblue: 8900346, lightslategray: 7833753, lightslategrey: 7833753, lightsteelblue: 11584734, lightyellow: 16777184, lime: 65280, limegreen: 3329330, linen: 16445670, magenta: 16711935, maroon: 8388608, mediumaquamarine: 6737322, mediumblue: 205, mediumorchid: 12211667, mediumpurple: 9662683, mediumseagreen: 3978097, mediumslateblue: 8087790, mediumspringgreen: 64154, mediumturquoise: 4772300, mediumvioletred: 13047173, midnightblue: 1644912, mintcream: 16121850, mistyrose: 16770273, moccasin: 16770229, navajowhite: 16768685, navy: 128, oldlace: 16643558, olive: 8421376, olivedrab: 7048739, orange: 16753920, orangered: 16729344, orchid: 14315734, palegoldenrod: 15657130, palegreen: 10025880, paleturquoise: 11529966, palevioletred: 14381203, papayawhip: 16773077, peachpuff: 16767673, peru: 13468991, pink: 16761035, plum: 14524637, powderblue: 11591910, purple: 8388736, rebeccapurple: 6697881, red: 16711680, rosybrown: 12357519, royalblue: 4286945, saddlebrown: 9127187, salmon: 16416882, sandybrown: 16032864, seagreen: 3050327, seashell: 16774638, sienna: 10506797, silver: 12632256, skyblue: 8900331, slateblue: 6970061, slategray: 7372944, slategrey: 7372944, snow: 16775930, springgreen: 65407, steelblue: 4620980, tan: 13808780, teal: 32896, thistle: 14204888, tomato: 16737095, turquoise: 4251856, violet: 15631086, wheat: 16113331, white: 16777215, whitesmoke: 16119285, yellow: 16776960, yellowgreen: 10145074 }; function f() { return this.rgb().formatHex() } function w() { return this.rgb().formatRgb() } function y(t) { var e, i; return t = (t + "").trim().toLowerCase(), (e = o.exec(t)) ? (i = e[1].length, e = parseInt(e[1], 16), 6 === i ? m(e) : 3 === i ? new M(e >> 8 & 15 | e >> 4 & 240, e >> 4 & 15 | 240 & e, (15 & e) << 4 | 15 & e, 1) : 8 === i ? $(e >> 24 & 255, e >> 16 & 255, e >> 8 & 255, (255 & e) / 255) : 4 === i ? $(e >> 12 & 15 | e >> 8 & 240, e >> 8 & 15 | e >> 4 & 240, e >> 4 & 15 | 240 & e, ((15 & e) << 4 | 15 & e) / 255) : null) : (e = l.exec(t)) ? new M(e[1], e[2], e[3], 1) : (e = u.exec(t)) ? new M(255 * e[1] / 100, 255 * e[2] / 100, 255 * e[3] / 100, 1) : (e = c.exec(t)) ? $(e[1], e[2], e[3], e[4]) : (e = g.exec(t)) ? $(255 * e[1] / 100, 255 * e[2] / 100, 255 * e[3] / 100, e[4]) : (e = p.exec(t)) ? E(e[1], e[2] / 100, e[3] / 100, 1) : (e = b.exec(t)) ? E(e[1], e[2] / 100, e[3] / 100, e[4]) : d.hasOwnProperty(t) ? m(d[t]) : "transparent" === t ? new M(NaN, NaN, NaN, 0) : null } function m(t) { return new M(t >> 16 & 255, t >> 8 & 255, 255 & t, 1) } function $(t, e, i, n) { return n <= 0 && (t = e = i = NaN), new M(t, e, i, n) } function N(t) { return t instanceof i || (t = y(t)), t ? new M((t = t.rgb()).r, t.g, t.b, t.opacity) : new M } function k(t, e, i, n) { return 1 === arguments.length ? N(t) : new M(t, e, i, null == n ? 1 : n) } function M(t, e, i, n) { this.r = +t, this.g = +e, this.b = +i, this.opacity = +n } function v() { return `#${R(this.r)}${R(this.g)}${R(this.b)}` } function x() { const t = q(this.opacity); return `${1 === t ? "rgb(" : "rgba("}${H(this.r)}, ${H(this.g)}, ${H(this.b)}${1 === t ? ")" : `, ${t})`}` } function q(t) { return isNaN(t) ? 1 : Math.max(0, Math.min(1, t)) } function H(t) { return Math.max(0, Math.min(255, Math.round(t) || 0)) } function R(t) { return ((t = H(t)) < 16 ? "0" : "") + t.toString(16) } function E(t, e, i, n) { return n <= 0 ? t = e = i = NaN : i <= 0 || i >= 1 ? t = e = NaN : e <= 0 && (t = NaN), new O(t, e, i, n) } function j(t) { if (t instanceof O) return new O(t.h, t.s, t.l, t.opacity); if (t instanceof i || (t = y(t)), !t) return new O; if (t instanceof O) return t; var e = (t = t.rgb()).r / 255, n = t.g / 255, r = t.b / 255, a = Math.min(e, n, r), s = Math.max(e, n, r), h = NaN, o = s - a, l = (s + a) / 2; return o ? (h = e === s ? (n - r) / o + 6 * (n < r) : n === s ? (r - e) / o + 2 : (e - n) / o + 4, o /= l < .5 ? s + a : 2 - s - a, h *= 60) : o = l > 0 && l < 1 ? 0 : h, new O(h, o, l, t.opacity) } function I(t, e, i, n) { return 1 === arguments.length ? j(t) : new O(t, e, i, null == n ? 1 : n) } function O(t, e, i, n) { this.h = +t, this.s = +e, this.l = +i, this.opacity = +n } function P(t) { return (t = (t || 0) % 360) < 0 ? t + 360 : t } function S(t) { return Math.max(0, Math.min(1, t || 0)) } function z(t, e, i) { return 255 * (t < 60 ? e + (i - e) * t / 60 : t < 180 ? i : t < 240 ? e + (i - e) * (240 - t) / 60 : e) } t(i, y, { copy(t) { return Object.assign(new this.constructor, this, t) }, displayable() { return this.rgb().displayable() }, hex: f, formatHex: f, formatHex8: function () { return this.rgb().formatHex8() }, formatHsl: function () { return j(this).formatHsl() }, formatRgb: w, toString: w }), t(M, k, e(i, { brighter(t) { return t = null == t ? r : Math.pow(r, t), new M(this.r * t, this.g * t, this.b * t, this.opacity) }, darker(t) { return t = null == t ? n : Math.pow(n, t), new M(this.r * t, this.g * t, this.b * t, this.opacity) }, rgb() { return this }, clamp() { return new M(H(this.r), H(this.g), H(this.b), q(this.opacity)) }, displayable() { return -.5 <= this.r && this.r < 255.5 && -.5 <= this.g && this.g < 255.5 && -.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1 }, hex: v, formatHex: v, formatHex8: function () { return `#${R(this.r)}${R(this.g)}${R(this.b)}${R(255 * (isNaN(this.opacity) ? 1 : this.opacity))}` }, formatRgb: x, toString: x })), t(O, I, e(i, { brighter(t) { return t = null == t ? r : Math.pow(r, t), new O(this.h, this.s, this.l * t, this.opacity) }, darker(t) { return t = null == t ? n : Math.pow(n, t), new O(this.h, this.s, this.l * t, this.opacity) }, rgb() { var t = this.h % 360 + 360 * (this.h < 0), e = isNaN(t) || isNaN(this.s) ? 0 : this.s, i = this.l, n = i + (i < .5 ? i : 1 - i) * e, r = 2 * i - n; return new M(z(t >= 240 ? t - 240 : t + 120, r, n), z(t, r, n), z(t < 120 ? t + 240 : t - 120, r, n), this.opacity) }, clamp() { return new O(P(this.h), S(this.s), S(this.l), q(this.opacity)) }, displayable() { return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1 }, formatHsl() { const t = q(this.opacity); return `${1 === t ? "hsl(" : "hsla("}${P(this.h)}, ${100 * S(this.s)}%, ${100 * S(this.l)}%${1 === t ? ")" : `, ${t})`}` } })); const C = Math.PI / 180, L = 180 / Math.PI, A = .96422, B = 1, D = .82521, F = 4 / 29, G = 6 / 29, J = 3 * G * G, K = G * G * G; function Q(t) { if (t instanceof V) return new V(t.l, t.a, t.b, t.opacity); if (t instanceof it) return nt(t); t instanceof M || (t = N(t)); var e, i, n = Z(t.r), r = Z(t.g), a = Z(t.b), s = W((.2225045 * n + .7168786 * r + .0606169 * a) / B); return n === r && r === a ? e = i = s : (e = W((.4360747 * n + .3850649 * r + .1430804 * a) / A), i = W((.0139322 * n + .0971045 * r + .7141733 * a) / D)), new V(116 * s - 16, 500 * (e - s), 200 * (s - i), t.opacity) } function T(t, e) { return new V(t, 0, 0, null == e ? 1 : e) } function U(t, e, i, n) { return 1 === arguments.length ? Q(t) : new V(t, e, i, null == n ? 1 : n) } function V(t, e, i, n) { this.l = +t, this.a = +e, this.b = +i, this.opacity = +n } function W(t) { return t > K ? Math.pow(t, 1 / 3) : t / J + F } function X(t) { return t > G ? t * t * t : J * (t - F) } function Y(t) { return 255 * (t <= .0031308 ? 12.92 * t : 1.055 * Math.pow(t, 1 / 2.4) - .055) } function Z(t) { return (t /= 255) <= .04045 ? t / 12.92 : Math.pow((t + .055) / 1.055, 2.4) } function _(t) { if (t instanceof it) return new it(t.h, t.c, t.l, t.opacity); if (t instanceof V || (t = Q(t)), 0 === t.a && 0 === t.b) return new it(NaN, 0 < t.l && t.l < 100 ? 0 : NaN, t.l, t.opacity); var e = Math.atan2(t.b, t.a) * L; return new it(e < 0 ? e + 360 : e, Math.sqrt(t.a * t.a + t.b * t.b), t.l, t.opacity) } function tt(t, e, i, n) { return 1 === arguments.length ? _(t) : new it(i, e, t, null == n ? 1 : n) } function et(t, e, i, n) { return 1 === arguments.length ? _(t) : new it(t, e, i, null == n ? 1 : n) } function it(t, e, i, n) { this.h = +t, this.c = +e, this.l = +i, this.opacity = +n } function nt(t) { if (isNaN(t.h)) return new V(t.l, 0, 0, t.opacity); var e = t.h * C; return new V(t.l, Math.cos(e) * t.c, Math.sin(e) * t.c, t.opacity) } t(V, U, e(i, { brighter(t) { return new V(this.l + 18 * (null == t ? 1 : t), this.a, this.b, this.opacity) }, darker(t) { return new V(this.l - 18 * (null == t ? 1 : t), this.a, this.b, this.opacity) }, rgb() { var t = (this.l + 16) / 116, e = isNaN(this.a) ? t : t + this.a / 500, i = isNaN(this.b) ? t : t - this.b / 200; return new M(Y(3.1338561 * (e = A * X(e)) - 1.6168667 * (t = B * X(t)) - .4906146 * (i = D * X(i))), Y(-.9787684 * e + 1.9161415 * t + .033454 * i), Y(.0719453 * e - .2289914 * t + 1.4052427 * i), this.opacity) } })), t(it, et, e(i, { brighter(t) { return new it(this.h, this.c, this.l + 18 * (null == t ? 1 : t), this.opacity) }, darker(t) { return new it(this.h, this.c, this.l - 18 * (null == t ? 1 : t), this.opacity) }, rgb() { return nt(this).rgb() } })); var rt = -.14861, at = 1.78277, st = -.29227, ht = -.90649, ot = 1.97294, lt = ot * ht, ut = ot * at, ct = at * st - ht * rt; function gt(t, e, i, n) { return 1 === arguments.length ? function (t) { if (t instanceof pt) return new pt(t.h, t.s, t.l, t.opacity); t instanceof M || (t = N(t)); var e = t.r / 255, i = t.g / 255, n = t.b / 255, r = (ct * n + lt * e - ut * i) / (ct + lt - ut), a = n - r, s = (ot * (i - r) - st * a) / ht, h = Math.sqrt(s * s + a * a) / (ot * r * (1 - r)), o = h ? Math.atan2(s, a) * L - 120 : NaN; return new pt(o < 0 ? o + 360 : o, h, r, t.opacity) }(t) : new pt(t, e, i, null == n ? 1 : n) } function pt(t, e, i, n) { this.h = +t, this.s = +e, this.l = +i, this.opacity = +n } t(pt, gt, e(i, { brighter(t) { return t = null == t ? r : Math.pow(r, t), new pt(this.h, this.s, this.l * t, this.opacity) }, darker(t) { return t = null == t ? n : Math.pow(n, t), new pt(this.h, this.s, this.l * t, this.opacity) }, rgb() { var t = isNaN(this.h) ? 0 : (this.h + 120) * C, e = +this.l, i = isNaN(this.s) ? 0 : this.s * e * (1 - e), n = Math.cos(t), r = Math.sin(t); return new M(255 * (e + i * (rt * n + at * r)), 255 * (e + i * (st * n + ht * r)), 255 * (e + i * (ot * n)), this.opacity) } })); export { y as color, gt as cubehelix, T as gray, et as hcl, I as hsl, U as lab, tt as lch, k as rgb }; export default null;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2.
3
+ * Original file: /npm/d3-dispatch@3.0.1/src/index.js
4
+ *
5
+ * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
6
+ */
7
+ var n = { value: () => { } }; function r() { for (var n, r = 0, e = arguments.length, o = {}; r < e; ++r) { if (!(n = arguments[r] + "") || n in o || /[\s.]/.test(n)) throw new Error("illegal type: " + n); o[n] = [] } return new t(o) } function t(n) { this._ = n } function e(n, r) { for (var t, e = 0, o = n.length; e < o; ++e)if ((t = n[e]).name === r) return t.value } function o(r, t, e) { for (var o = 0, i = r.length; o < i; ++o)if (r[o].name === t) { r[o] = n, r = r.slice(0, o).concat(r.slice(o + 1)); break } return null != e && r.push({ name: t, value: e }), r } t.prototype = r.prototype = { constructor: t, on: function (n, r) { var t, i, l = this._, a = (i = l, (n + "").trim().split(/^|\s+/).map((function (n) { var r = "", t = n.indexOf("."); if (t >= 0 && (r = n.slice(t + 1), n = n.slice(0, t)), n && !i.hasOwnProperty(n)) throw new Error("unknown type: " + n); return { type: n, name: r } }))), f = -1, u = a.length; if (!(arguments.length < 2)) { if (null != r && "function" != typeof r) throw new Error("invalid callback: " + r); for (; ++f < u;)if (t = (n = a[f]).type) l[t] = o(l[t], n.name, r); else if (null == r) for (t in l) l[t] = o(l[t], n.name, null); return this } for (; ++f < u;)if ((t = (n = a[f]).type) && (t = e(l[t], n.name))) return t }, copy: function () { var n = {}, r = this._; for (var e in r) n[e] = r[e].slice(); return new t(n) }, call: function (n, r) { if ((t = arguments.length - 2) > 0) for (var t, e, o = new Array(t), i = 0; i < t; ++i)o[i] = arguments[i + 2]; if (!this._.hasOwnProperty(n)) throw new Error("unknown type: " + n); for (i = 0, t = (e = this._[n]).length; i < t; ++i)e[i].value.apply(r, o) }, apply: function (n, r, t) { if (!this._.hasOwnProperty(n)) throw new Error("unknown type: " + n); for (var e = this._[n], o = 0, i = e.length; o < i; ++o)e[o].value.apply(r, t) } }; export { r as dispatch }; export default null;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2.
3
+ * Original file: /npm/d3-drag@3.0.0/src/index.js
4
+ *
5
+ * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
6
+ */
7
+ import { dispatch as e } from "d3-dispatch"; import { select as t, pointer as n } from "d3-selection"; const r = { passive: !1 }, o = { capture: !0, passive: !1 }; function a(e) { e.stopImmediatePropagation() } function i(e) { e.preventDefault(), e.stopImmediatePropagation() } function u(e) { var n = e.document.documentElement, r = t(e).on("dragstart.drag", i, o); "onselectstart" in n ? r.on("selectstart.drag", i, o) : (n.__noselect = n.style.MozUserSelect, n.style.MozUserSelect = "none") } function c(e, n) { var r = e.document.documentElement, a = t(e).on("dragstart.drag", null); n && (a.on("click.drag", i, o), setTimeout((function () { a.on("click.drag", null) }), 0)), "onselectstart" in r ? a.on("selectstart.drag", null) : (r.style.MozUserSelect = r.__noselect, delete r.__noselect) } var l = e => () => e; function s(e, { sourceEvent: t, subject: n, target: r, identifier: o, active: a, x: i, y: u, dx: c, dy: l, dispatch: s }) { Object.defineProperties(this, { type: { value: e, enumerable: !0, configurable: !0 }, sourceEvent: { value: t, enumerable: !0, configurable: !0 }, subject: { value: n, enumerable: !0, configurable: !0 }, target: { value: r, enumerable: !0, configurable: !0 }, identifier: { value: o, enumerable: !0, configurable: !0 }, active: { value: a, enumerable: !0, configurable: !0 }, x: { value: i, enumerable: !0, configurable: !0 }, y: { value: u, enumerable: !0, configurable: !0 }, dx: { value: c, enumerable: !0, configurable: !0 }, dy: { value: l, enumerable: !0, configurable: !0 }, _: { value: s } }) } function f(e) { return !e.ctrlKey && !e.button } function d() { return this.parentNode } function g(e, t) { return null == t ? { x: e.x, y: e.y } : t } function h() { return navigator.maxTouchPoints || "ontouchstart" in this } function m() { var m, v, p, b, y = f, x = d, _ = g, w = h, E = {}, T = e("start", "drag", "end"), j = 0, k = 0; function M(e) { e.on("mousedown.drag", P).filter(w).on("touchstart.drag", S).on("touchmove.drag", U, r).on("touchend.drag touchcancel.drag", I).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)") } function P(e, n) { if (!b && y.call(this, e, n)) { var r = X(this, x.call(this, e, n), e, n, "mouse"); r && (t(e.view).on("mousemove.drag", z, o).on("mouseup.drag", D, o), u(e.view), a(e), p = !1, m = e.clientX, v = e.clientY, r("start", e)) } } function z(e) { if (i(e), !p) { var t = e.clientX - m, n = e.clientY - v; p = t * t + n * n > k } E.mouse("drag", e) } function D(e) { t(e.view).on("mousemove.drag mouseup.drag", null), c(e.view, p), i(e), E.mouse("end", e) } function S(e, t) { if (y.call(this, e, t)) { var n, r, o = e.changedTouches, i = x.call(this, e, t), u = o.length; for (n = 0; n < u; ++n)(r = X(this, i, e, t, o[n].identifier, o[n])) && (a(e), r("start", e, o[n])) } } function U(e) { var t, n, r = e.changedTouches, o = r.length; for (t = 0; t < o; ++t)(n = E[r[t].identifier]) && (i(e), n("drag", e, r[t])) } function I(e) { var t, n, r = e.changedTouches, o = r.length; for (b && clearTimeout(b), b = setTimeout((function () { b = null }), 500), t = 0; t < o; ++t)(n = E[r[t].identifier]) && (a(e), n("end", e, r[t])) } function X(e, t, r, o, a, i) { var u, c, l, f = T.copy(), d = n(i || r, t); if (null != (l = _.call(e, new s("beforestart", { sourceEvent: r, target: M, identifier: a, active: j, x: d[0], y: d[1], dx: 0, dy: 0, dispatch: f }), o))) return u = l.x - d[0] || 0, c = l.y - d[1] || 0, function r(i, g, h) { var m, v = d; switch (i) { case "start": E[a] = r, m = j++; break; case "end": delete E[a], --j; case "drag": d = n(h || g, t), m = j }f.call(i, e, new s(i, { sourceEvent: g, subject: l, target: M, identifier: a, active: m, x: d[0] + u, y: d[1] + c, dx: d[0] - v[0], dy: d[1] - v[1], dispatch: f }), o) } } return M.filter = function (e) { return arguments.length ? (y = "function" == typeof e ? e : l(!!e), M) : y }, M.container = function (e) { return arguments.length ? (x = "function" == typeof e ? e : l(e), M) : x }, M.subject = function (e) { return arguments.length ? (_ = "function" == typeof e ? e : l(e), M) : _ }, M.touchable = function (e) { return arguments.length ? (w = "function" == typeof e ? e : l(!!e), M) : w }, M.on = function () { var e = T.on.apply(T, arguments); return e === T ? M : e }, M.clickDistance = function (e) { return arguments.length ? (k = (e = +e) * e, M) : Math.sqrt(k) }, M } s.prototype.on = function () { var e = this._.on.apply(this._, arguments); return e === this._ ? this : e }; export { m as drag, u as dragDisable, c as dragEnable }; export default null;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2.
3
+ * Original file: /npm/d3-ease@3.0.1/src/index.js
4
+ *
5
+ * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
6
+ */
7
+ const n = n => +n; function t(n) { return n * n } function e(n) { return n * (2 - n) } function a(n) { return ((n *= 2) <= 1 ? n * n : --n * (2 - n) + 1) / 2 } function u(n) { return n * n * n } function r(n) { return --n * n * n + 1 } function s(n) { return ((n *= 2) <= 1 ? n * n * n : (n -= 2) * n * n + 2) / 2 } var o = function n(t) { function e(n) { return Math.pow(n, t) } return t = +t, e.exponent = n, e }(3), i = function n(t) { function e(n) { return 1 - Math.pow(1 - n, t) } return t = +t, e.exponent = n, e }(3), c = function n(t) { function e(n) { return ((n *= 2) <= 1 ? Math.pow(n, t) : 2 - Math.pow(2 - n, t)) / 2 } return t = +t, e.exponent = n, e }(3), f = Math.PI, h = f / 2; function M(n) { return 1 == +n ? 1 : 1 - Math.cos(n * h) } function p(n) { return Math.sin(n * h) } function I(n) { return (1 - Math.cos(f * n)) / 2 } function l(n) { return 1.0009775171065494 * (Math.pow(2, -10 * n) - .0009765625) } function O(n) { return l(1 - +n) } function x(n) { return 1 - l(n) } function d(n) { return ((n *= 2) <= 1 ? l(1 - n) : 2 - l(n - 1)) / 2 } function v(n) { return 1 - Math.sqrt(1 - n * n) } function B(n) { return Math.sqrt(1 - --n * n) } function C(n) { return ((n *= 2) <= 1 ? 1 - Math.sqrt(1 - n * n) : Math.sqrt(1 - (n -= 2) * n) + 1) / 2 } var E = 4 / 11, m = 6 / 11, P = 8 / 11, w = 3 / 4, b = 9 / 11, k = 10 / 11, q = 15 / 16, y = 21 / 22, Q = 63 / 64, S = 1 / E / E; function L(n) { return 1 - g(1 - n) } function g(n) { return (n = +n) < E ? S * n * n : n < P ? S * (n -= m) * n + w : n < k ? S * (n -= b) * n + q : S * (n -= y) * n + Q } function j(n) { return ((n *= 2) <= 1 ? 1 - g(1 - n) : g(n - 1) + 1) / 2 } var z = 1.70158, A = function n(t) { function e(n) { return (n = +n) * n * (t * (n - 1) + n) } return t = +t, e.overshoot = n, e }(z), D = function n(t) { function e(n) { return --n * n * ((n + 1) * t + n) + 1 } return t = +t, e.overshoot = n, e }(z), F = function n(t) { function e(n) { return ((n *= 2) < 1 ? n * n * ((t + 1) * n - t) : (n -= 2) * n * ((t + 1) * n + t) + 2) / 2 } return t = +t, e.overshoot = n, e }(z), G = 2 * Math.PI, H = function n(t, e) { var a = Math.asin(1 / (t = Math.max(1, t))) * (e /= G); function u(n) { return t * l(- --n) * Math.sin((a - n) / e) } return u.amplitude = function (t) { return n(t, e * G) }, u.period = function (e) { return n(t, e) }, u }(1, .3), J = function n(t, e) { var a = Math.asin(1 / (t = Math.max(1, t))) * (e /= G); function u(n) { return 1 - t * l(n = +n) * Math.sin((n + a) / e) } return u.amplitude = function (t) { return n(t, e * G) }, u.period = function (e) { return n(t, e) }, u }(1, .3), K = function n(t, e) { var a = Math.asin(1 / (t = Math.max(1, t))) * (e /= G); function u(n) { return ((n = 2 * n - 1) < 0 ? t * l(-n) * Math.sin((a - n) / e) : 2 - t * l(n) * Math.sin((a + n) / e)) / 2 } return u.amplitude = function (t) { return n(t, e * G) }, u.period = function (e) { return n(t, e) }, u }(1, .3); export { F as easeBack, A as easeBackIn, F as easeBackInOut, D as easeBackOut, g as easeBounce, L as easeBounceIn, j as easeBounceInOut, g as easeBounceOut, C as easeCircle, v as easeCircleIn, C as easeCircleInOut, B as easeCircleOut, s as easeCubic, u as easeCubicIn, s as easeCubicInOut, r as easeCubicOut, J as easeElastic, H as easeElasticIn, K as easeElasticInOut, J as easeElasticOut, d as easeExp, O as easeExpIn, d as easeExpInOut, x as easeExpOut, n as easeLinear, c as easePoly, o as easePolyIn, c as easePolyInOut, i as easePolyOut, a as easeQuad, t as easeQuadIn, a as easeQuadInOut, e as easeQuadOut, I as easeSin, M as easeSinIn, I as easeSinInOut, p as easeSinOut }; export default null;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2.
3
+ * Original file: /npm/d3-interpolate@3.0.1/src/index.js
4
+ *
5
+ * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
6
+ */
7
+ import { rgb as t, color as n, hsl as r, lab as e, hcl as a, cubehelix as o } from "d3-color"; function u(t, n, r, e, a) { var o = t * t, u = o * t; return ((1 - 3 * t + 3 * o - u) * n + (4 - 6 * o + 3 * u) * r + (1 + 3 * t + 3 * o - 3 * u) * e + u * a) / 6 } function i(t) { var n = t.length - 1; return function (r) { var e = r <= 0 ? r = 0 : r >= 1 ? (r = 1, n - 1) : Math.floor(r * n), a = t[e], o = t[e + 1], i = e > 0 ? t[e - 1] : 2 * a - o, c = e < n - 1 ? t[e + 2] : 2 * o - a; return u((r - e / n) * n, i, a, o, c) } } function c(t) { var n = t.length; return function (r) { var e = Math.floor(((r %= 1) < 0 ? ++r : r) * n), a = t[(e + n - 1) % n], o = t[e % n], i = t[(e + 1) % n], c = t[(e + 2) % n]; return u((r - e / n) * n, a, o, i, c) } } var l = t => () => t; function s(t, n) { return function (r) { return t + r * n } } function f(t, n) { var r = n - t; return r ? s(t, r > 180 || r < -180 ? r - 360 * Math.round(r / 360) : r) : l(isNaN(t) ? n : t) } function h(t) { return 1 == (t = +t) ? p : function (n, r) { return r - n ? function (t, n, r) { return t = Math.pow(t, r), n = Math.pow(n, r) - t, r = 1 / r, function (e) { return Math.pow(t + e * n, r) } }(n, r, t) : l(isNaN(n) ? r : n) } } function p(t, n) { var r = n - t; return r ? s(t, r) : l(isNaN(t) ? n : t) } var v = function n(r) { var e = h(r); function a(n, r) { var a = e((n = t(n)).r, (r = t(r)).r), o = e(n.g, r.g), u = e(n.b, r.b), i = p(n.opacity, r.opacity); return function (t) { return n.r = a(t), n.g = o(t), n.b = u(t), n.opacity = i(t), n + "" } } return a.gamma = n, a }(1); function g(n) { return function (r) { var e, a, o = r.length, u = new Array(o), i = new Array(o), c = new Array(o); for (e = 0; e < o; ++e)a = t(r[e]), u[e] = a.r || 0, i[e] = a.g || 0, c[e] = a.b || 0; return u = n(u), i = n(i), c = n(c), a.opacity = 1, function (t) { return a.r = u(t), a.g = i(t), a.b = c(t), a + "" } } } var M = g(i), x = g(c); function y(t, n) { n || (n = []); var r, e = t ? Math.min(n.length, t.length) : 0, a = n.slice(); return function (o) { for (r = 0; r < e; ++r)a[r] = t[r] * (1 - o) + n[r] * o; return a } } function b(t) { return ArrayBuffer.isView(t) && !(t instanceof DataView) } function w(t, n) { return (b(n) ? y : m)(t, n) } function m(t, n) { var r, e = n ? n.length : 0, a = t ? Math.min(e, t.length) : 0, o = new Array(a), u = new Array(e); for (r = 0; r < a; ++r)o[r] = R(t[r], n[r]); for (; r < e; ++r)u[r] = n[r]; return function (t) { for (r = 0; r < a; ++r)u[r] = o[r](t); return u } } function d(t, n) { var r = new Date; return t = +t, n = +n, function (e) { return r.setTime(t * (1 - e) + n * e), r } } function X(t, n) { return t = +t, n = +n, function (r) { return t * (1 - r) + n * r } } function A(t, n) { var r, e = {}, a = {}; for (r in null !== t && "object" == typeof t || (t = {}), null !== n && "object" == typeof n || (n = {}), n) r in t ? e[r] = R(t[r], n[r]) : a[r] = n[r]; return function (t) { for (r in e) a[r] = e[r](t); return a } } var N = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, Y = new RegExp(N.source, "g"); function D(t, n) { var r, e, a, o = N.lastIndex = Y.lastIndex = 0, u = -1, i = [], c = []; for (t += "", n += ""; (r = N.exec(t)) && (e = Y.exec(n));)(a = e.index) > o && (a = n.slice(o, a), i[u] ? i[u] += a : i[++u] = a), (r = r[0]) === (e = e[0]) ? i[u] ? i[u] += e : i[++u] = e : (i[++u] = null, c.push({ i: u, x: X(r, e) })), o = Y.lastIndex; return o < n.length && (a = n.slice(o), i[u] ? i[u] += a : i[++u] = a), i.length < 2 ? c[0] ? function (t) { return function (n) { return t(n) + "" } }(c[0].x) : function (t) { return function () { return t } }(n) : (n = c.length, function (t) { for (var r, e = 0; e < n; ++e)i[(r = c[e]).i] = r.x(t); return i.join("") }) } function R(t, r) { var e, a = typeof r; return null == r || "boolean" === a ? l(r) : ("number" === a ? X : "string" === a ? (e = n(r)) ? (r = e, v) : D : r instanceof n ? v : r instanceof Date ? d : b(r) ? y : Array.isArray(r) ? m : "function" != typeof r.valueOf && "function" != typeof r.toString || isNaN(r) ? A : X)(t, r) } function S(t) { var n = t.length; return function (r) { return t[Math.max(0, Math.min(n - 1, Math.floor(r * n)))] } } function k(t, n) { var r = f(+t, +n); return function (t) { var n = r(t); return n - 360 * Math.floor(n / 360) } } function j(t, n) { return t = +t, n = +n, function (r) { return Math.round(t * (1 - r) + n * r) } } var q, B = 180 / Math.PI, C = { translateX: 0, translateY: 0, rotate: 0, skewX: 0, scaleX: 1, scaleY: 1 }; function H(t, n, r, e, a, o) { var u, i, c; return (u = Math.sqrt(t * t + n * n)) && (t /= u, n /= u), (c = t * r + n * e) && (r -= t * c, e -= n * c), (i = Math.sqrt(r * r + e * e)) && (r /= i, e /= i, c /= i), t * e < n * r && (t = -t, n = -n, c = -c, u = -u), { translateX: a, translateY: o, rotate: Math.atan2(n, t) * B, skewX: Math.atan(c) * B, scaleX: u, scaleY: i } } function I(t, n, r, e) { function a(t) { return t.length ? t.pop() + " " : "" } return function (o, u) { var i = [], c = []; return o = t(o), u = t(u), function (t, e, a, o, u, i) { if (t !== a || e !== o) { var c = u.push("translate(", null, n, null, r); i.push({ i: c - 4, x: X(t, a) }, { i: c - 2, x: X(e, o) }) } else (a || o) && u.push("translate(" + a + n + o + r) }(o.translateX, o.translateY, u.translateX, u.translateY, i, c), function (t, n, r, o) { t !== n ? (t - n > 180 ? n += 360 : n - t > 180 && (t += 360), o.push({ i: r.push(a(r) + "rotate(", null, e) - 2, x: X(t, n) })) : n && r.push(a(r) + "rotate(" + n + e) }(o.rotate, u.rotate, i, c), function (t, n, r, o) { t !== n ? o.push({ i: r.push(a(r) + "skewX(", null, e) - 2, x: X(t, n) }) : n && r.push(a(r) + "skewX(" + n + e) }(o.skewX, u.skewX, i, c), function (t, n, r, e, o, u) { if (t !== r || n !== e) { var i = o.push(a(o) + "scale(", null, ",", null, ")"); u.push({ i: i - 4, x: X(t, r) }, { i: i - 2, x: X(n, e) }) } else 1 === r && 1 === e || o.push(a(o) + "scale(" + r + "," + e + ")") }(o.scaleX, o.scaleY, u.scaleX, u.scaleY, i, c), o = u = null, function (t) { for (var n, r = -1, e = c.length; ++r < e;)i[(n = c[r]).i] = n.x(t); return i.join("") } } } var L = I((function (t) { const n = new ("function" == typeof DOMMatrix ? DOMMatrix : WebKitCSSMatrix)(t + ""); return n.isIdentity ? C : H(n.a, n.b, n.c, n.d, n.e, n.f) }), "px, ", "px)", "deg)"), O = I((function (t) { return null == t ? C : (q || (q = document.createElementNS("http://www.w3.org/2000/svg", "g")), q.setAttribute("transform", t), (t = q.transform.baseVal.consolidate()) ? H((t = t.matrix).a, t.b, t.c, t.d, t.e, t.f) : C) }), ", ", ")", ")"); function E(t) { return ((t = Math.exp(t)) + 1 / t) / 2 } var T = function t(n, r, e) { function a(t, a) { var o, u, i = t[0], c = t[1], l = t[2], s = a[0], f = a[1], h = a[2], p = s - i, v = f - c, g = p * p + v * v; if (g < 1e-12) u = Math.log(h / l) / n, o = function (t) { return [i + t * p, c + t * v, l * Math.exp(n * t * u)] }; else { var M = Math.sqrt(g), x = (h * h - l * l + e * g) / (2 * l * r * M), y = (h * h - l * l - e * g) / (2 * h * r * M), b = Math.log(Math.sqrt(x * x + 1) - x), w = Math.log(Math.sqrt(y * y + 1) - y); u = (w - b) / n, o = function (t) { var e, a = t * u, o = E(b), s = l / (r * M) * (o * (e = n * a + b, ((e = Math.exp(2 * e)) - 1) / (e + 1)) - function (t) { return ((t = Math.exp(t)) - 1 / t) / 2 }(b)); return [i + s * p, c + s * v, l * o / E(n * a + b)] } } return o.duration = 1e3 * u * n / Math.SQRT2, o } return a.rho = function (n) { var r = Math.max(.001, +n), e = r * r; return t(r, e, e * e) }, a }(Math.SQRT2, 2, 4); function V(t) { return function (n, e) { var a = t((n = r(n)).h, (e = r(e)).h), o = p(n.s, e.s), u = p(n.l, e.l), i = p(n.opacity, e.opacity); return function (t) { return n.h = a(t), n.s = o(t), n.l = u(t), n.opacity = i(t), n + "" } } } var Q = V(f), K = V(p); function P(t, n) { var r = p((t = e(t)).l, (n = e(n)).l), a = p(t.a, n.a), o = p(t.b, n.b), u = p(t.opacity, n.opacity); return function (n) { return t.l = r(n), t.a = a(n), t.b = o(n), t.opacity = u(n), t + "" } } function W(t) { return function (n, r) { var e = t((n = a(n)).h, (r = a(r)).h), o = p(n.c, r.c), u = p(n.l, r.l), i = p(n.opacity, r.opacity); return function (t) { return n.h = e(t), n.c = o(t), n.l = u(t), n.opacity = i(t), n + "" } } } var Z = W(f), z = W(p); function F(t) { return function n(r) { function e(n, e) { var a = t((n = o(n)).h, (e = o(e)).h), u = p(n.s, e.s), i = p(n.l, e.l), c = p(n.opacity, e.opacity); return function (t) { return n.h = a(t), n.s = u(t), n.l = i(Math.pow(t, r)), n.opacity = c(t), n + "" } } return r = +r, e.gamma = n, e }(1) } var G = F(f), J = F(p); function U(t, n) { void 0 === n && (n = t, t = R); for (var r = 0, e = n.length - 1, a = n[0], o = new Array(e < 0 ? 0 : e); r < e;)o[r] = t(a, a = n[++r]); return function (t) { var n = Math.max(0, Math.min(e - 1, Math.floor(t *= e))); return o[n](t - n) } } function $(t, n) { for (var r = new Array(n), e = 0; e < n; ++e)r[e] = t(e / (n - 1)); return r } export { R as interpolate, w as interpolateArray, i as interpolateBasis, c as interpolateBasisClosed, G as interpolateCubehelix, J as interpolateCubehelixLong, d as interpolateDate, S as interpolateDiscrete, Z as interpolateHcl, z as interpolateHclLong, Q as interpolateHsl, K as interpolateHslLong, k as interpolateHue, P as interpolateLab, X as interpolateNumber, y as interpolateNumberArray, A as interpolateObject, v as interpolateRgb, M as interpolateRgbBasis, x as interpolateRgbBasisClosed, j as interpolateRound, D as interpolateString, L as interpolateTransformCss, O as interpolateTransformSvg, T as interpolateZoom, U as piecewise, $ as quantize }; export default null;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2.
3
+ * Original file: /npm/d3-selection@3.0.0/src/index.js
4
+ *
5
+ * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
6
+ */
7
+ var t = "http://www.w3.org/1999/xhtml", n = { svg: "http://www.w3.org/2000/svg", xhtml: t, xlink: "http://www.w3.org/1999/xlink", xml: "http://www.w3.org/XML/1998/namespace", xmlns: "http://www.w3.org/2000/xmlns/" }; function e(t) { var e = t += "", r = e.indexOf(":"); return r >= 0 && "xmlns" !== (e = t.slice(0, r)) && (t = t.slice(r + 1)), n.hasOwnProperty(e) ? { space: n[e], local: t } : t } function r(n) { return function () { var e = this.ownerDocument, r = this.namespaceURI; return r === t && e.documentElement.namespaceURI === t ? e.createElement(n) : e.createElementNS(r, n) } } function i(t) { return function () { return this.ownerDocument.createElementNS(t.space, t.local) } } function o(t) { var n = e(t); return (n.local ? i : r)(n) } function u() { } function s(t) { return null == t ? u : function () { return this.querySelector(t) } } function c(t) { return null == t ? [] : Array.isArray(t) ? t : Array.from(t) } function a() { return [] } function l(t) { return null == t ? a : function () { return this.querySelectorAll(t) } } function f(t) { return function () { return this.matches(t) } } function h(t) { return function (n) { return n.matches(t) } } var p = Array.prototype.find; function _() { return this.firstElementChild } var d = Array.prototype.filter; function y() { return Array.from(this.children) } function v(t) { return new Array(t.length) } function m(t, n) { this.ownerDocument = t.ownerDocument, this.namespaceURI = t.namespaceURI, this._next = null, this._parent = t, this.__data__ = n } function g(t, n, e, r, i, o) { for (var u, s = 0, c = n.length, a = o.length; s < a; ++s)(u = n[s]) ? (u.__data__ = o[s], r[s] = u) : e[s] = new m(t, o[s]); for (; s < c; ++s)(u = n[s]) && (i[s] = u) } function w(t, n, e, r, i, o, u) { var s, c, a, l = new Map, f = n.length, h = o.length, p = new Array(f); for (s = 0; s < f; ++s)(c = n[s]) && (p[s] = a = u.call(c, c.__data__, s, n) + "", l.has(a) ? i[s] = c : l.set(a, c)); for (s = 0; s < h; ++s)a = u.call(t, o[s], s, o) + "", (c = l.get(a)) ? (r[s] = c, c.__data__ = o[s], l.delete(a)) : e[s] = new m(t, o[s]); for (s = 0; s < f; ++s)(c = n[s]) && l.get(p[s]) === c && (i[s] = c) } function A(t) { return t.__data__ } function x(t) { return "object" == typeof t && "length" in t ? t : Array.from(t) } function S(t, n) { return t < n ? -1 : t > n ? 1 : t >= n ? 0 : NaN } function b(t) { return function () { this.removeAttribute(t) } } function E(t) { return function () { this.removeAttributeNS(t.space, t.local) } } function N(t, n) { return function () { this.setAttribute(t, n) } } function C(t, n) { return function () { this.setAttributeNS(t.space, t.local, n) } } function L(t, n) { return function () { var e = n.apply(this, arguments); null == e ? this.removeAttribute(t) : this.setAttribute(t, e) } } function B(t, n) { return function () { var e = n.apply(this, arguments); null == e ? this.removeAttributeNS(t.space, t.local) : this.setAttributeNS(t.space, t.local, e) } } function P(t) { return t.ownerDocument && t.ownerDocument.defaultView || t.document && t || t.defaultView } function T(t) { return function () { this.style.removeProperty(t) } } function q(t, n, e) { return function () { this.style.setProperty(t, n, e) } } function M(t, n, e) { return function () { var r = n.apply(this, arguments); null == r ? this.style.removeProperty(t) : this.style.setProperty(t, r, e) } } function D(t, n) { return t.style.getPropertyValue(n) || P(t).getComputedStyle(t, null).getPropertyValue(n) } function V(t) { return function () { delete this[t] } } function O(t, n) { return function () { this[t] = n } } function R(t, n) { return function () { var e = n.apply(this, arguments); null == e ? delete this[t] : this[t] = e } } function j(t) { return t.trim().split(/^|\s+/) } function H(t) { return t.classList || new I(t) } function I(t) { this._node = t, this._names = j(t.getAttribute("class") || "") } function U(t, n) { for (var e = H(t), r = -1, i = n.length; ++r < i;)e.add(n[r]) } function X(t, n) { for (var e = H(t), r = -1, i = n.length; ++r < i;)e.remove(n[r]) } function G(t) { return function () { U(this, t) } } function Y(t) { return function () { X(this, t) } } function k(t, n) { return function () { (n.apply(this, arguments) ? U : X)(this, t) } } function z() { this.textContent = "" } function F(t) { return function () { this.textContent = t } } function J(t) { return function () { var n = t.apply(this, arguments); this.textContent = null == n ? "" : n } } function K() { this.innerHTML = "" } function Q(t) { return function () { this.innerHTML = t } } function W(t) { return function () { var n = t.apply(this, arguments); this.innerHTML = null == n ? "" : n } } function Z() { this.nextSibling && this.parentNode.appendChild(this) } function $() { this.previousSibling && this.parentNode.insertBefore(this, this.parentNode.firstChild) } function tt() { return null } function nt() { var t = this.parentNode; t && t.removeChild(this) } function et() { var t = this.cloneNode(!1), n = this.parentNode; return n ? n.insertBefore(t, this.nextSibling) : t } function rt() { var t = this.cloneNode(!0), n = this.parentNode; return n ? n.insertBefore(t, this.nextSibling) : t } function it(t) { return function () { var n = this.__on; if (n) { for (var e, r = 0, i = -1, o = n.length; r < o; ++r)e = n[r], t.type && e.type !== t.type || e.name !== t.name ? n[++i] = e : this.removeEventListener(e.type, e.listener, e.options); ++i ? n.length = i : delete this.__on } } } function ot(t, n, e) { return function () { var r, i = this.__on, o = function (t) { return function (n) { t.call(this, n, this.__data__) } }(n); if (i) for (var u = 0, s = i.length; u < s; ++u)if ((r = i[u]).type === t.type && r.name === t.name) return this.removeEventListener(r.type, r.listener, r.options), this.addEventListener(r.type, r.listener = o, r.options = e), void (r.value = n); this.addEventListener(t.type, o, e), r = { type: t.type, name: t.name, value: n, listener: o, options: e }, i ? i.push(r) : this.__on = [r] } } function ut(t, n, e) { var r = P(t), i = r.CustomEvent; "function" == typeof i ? i = new i(n, e) : (i = r.document.createEvent("Event"), e ? (i.initEvent(n, e.bubbles, e.cancelable), i.detail = e.detail) : i.initEvent(n, !1, !1)), t.dispatchEvent(i) } function st(t, n) { return function () { return ut(this, t, n) } } function ct(t, n) { return function () { return ut(this, t, n.apply(this, arguments)) } } m.prototype = { constructor: m, appendChild: function (t) { return this._parent.insertBefore(t, this._next) }, insertBefore: function (t, n) { return this._parent.insertBefore(t, n) }, querySelector: function (t) { return this._parent.querySelector(t) }, querySelectorAll: function (t) { return this._parent.querySelectorAll(t) } }, I.prototype = { add: function (t) { this._names.indexOf(t) < 0 && (this._names.push(t), this._node.setAttribute("class", this._names.join(" "))) }, remove: function (t) { var n = this._names.indexOf(t); n >= 0 && (this._names.splice(n, 1), this._node.setAttribute("class", this._names.join(" "))) }, contains: function (t) { return this._names.indexOf(t) >= 0 } }; var at = [null]; function lt(t, n) { this._groups = t, this._parents = n } function ft() { return new lt([[document.documentElement]], at) } function ht(t) { return "string" == typeof t ? new lt([[document.querySelector(t)]], [document.documentElement]) : new lt([[t]], at) } function pt(t) { return ht(o(t).call(document.documentElement)) } lt.prototype = ft.prototype = { constructor: lt, select: function (t) { "function" != typeof t && (t = s(t)); for (var n = this._groups, e = n.length, r = new Array(e), i = 0; i < e; ++i)for (var o, u, c = n[i], a = c.length, l = r[i] = new Array(a), f = 0; f < a; ++f)(o = c[f]) && (u = t.call(o, o.__data__, f, c)) && ("__data__" in o && (u.__data__ = o.__data__), l[f] = u); return new lt(r, this._parents) }, selectAll: function (t) { t = "function" == typeof t ? function (t) { return function () { return c(t.apply(this, arguments)) } }(t) : l(t); for (var n = this._groups, e = n.length, r = [], i = [], o = 0; o < e; ++o)for (var u, s = n[o], a = s.length, f = 0; f < a; ++f)(u = s[f]) && (r.push(t.call(u, u.__data__, f, s)), i.push(u)); return new lt(r, i) }, selectChild: function (t) { return this.select(null == t ? _ : function (t) { return function () { return p.call(this.children, t) } }("function" == typeof t ? t : h(t))) }, selectChildren: function (t) { return this.selectAll(null == t ? y : function (t) { return function () { return d.call(this.children, t) } }("function" == typeof t ? t : h(t))) }, filter: function (t) { "function" != typeof t && (t = f(t)); for (var n = this._groups, e = n.length, r = new Array(e), i = 0; i < e; ++i)for (var o, u = n[i], s = u.length, c = r[i] = [], a = 0; a < s; ++a)(o = u[a]) && t.call(o, o.__data__, a, u) && c.push(o); return new lt(r, this._parents) }, data: function (t, n) { if (!arguments.length) return Array.from(this, A); var e, r = n ? w : g, i = this._parents, o = this._groups; "function" != typeof t && (e = t, t = function () { return e }); for (var u = o.length, s = new Array(u), c = new Array(u), a = new Array(u), l = 0; l < u; ++l) { var f = i[l], h = o[l], p = h.length, _ = x(t.call(f, f && f.__data__, l, i)), d = _.length, y = c[l] = new Array(d), v = s[l] = new Array(d); r(f, h, y, v, a[l] = new Array(p), _, n); for (var m, S, b = 0, E = 0; b < d; ++b)if (m = y[b]) { for (b >= E && (E = b + 1); !(S = v[E]) && ++E < d;); m._next = S || null } } return (s = new lt(s, i))._enter = c, s._exit = a, s }, enter: function () { return new lt(this._enter || this._groups.map(v), this._parents) }, exit: function () { return new lt(this._exit || this._groups.map(v), this._parents) }, join: function (t, n, e) { var r = this.enter(), i = this, o = this.exit(); return "function" == typeof t ? (r = t(r)) && (r = r.selection()) : r = r.append(t + ""), null != n && (i = n(i)) && (i = i.selection()), null == e ? o.remove() : e(o), r && i ? r.merge(i).order() : i }, merge: function (t) { for (var n = t.selection ? t.selection() : t, e = this._groups, r = n._groups, i = e.length, o = r.length, u = Math.min(i, o), s = new Array(i), c = 0; c < u; ++c)for (var a, l = e[c], f = r[c], h = l.length, p = s[c] = new Array(h), _ = 0; _ < h; ++_)(a = l[_] || f[_]) && (p[_] = a); for (; c < i; ++c)s[c] = e[c]; return new lt(s, this._parents) }, selection: function () { return this }, order: function () { for (var t = this._groups, n = -1, e = t.length; ++n < e;)for (var r, i = t[n], o = i.length - 1, u = i[o]; --o >= 0;)(r = i[o]) && (u && 4 ^ r.compareDocumentPosition(u) && u.parentNode.insertBefore(r, u), u = r); return this }, sort: function (t) { function n(n, e) { return n && e ? t(n.__data__, e.__data__) : !n - !e } t || (t = S); for (var e = this._groups, r = e.length, i = new Array(r), o = 0; o < r; ++o) { for (var u, s = e[o], c = s.length, a = i[o] = new Array(c), l = 0; l < c; ++l)(u = s[l]) && (a[l] = u); a.sort(n) } return new lt(i, this._parents).order() }, call: function () { var t = arguments[0]; return arguments[0] = this, t.apply(null, arguments), this }, nodes: function () { return Array.from(this) }, node: function () { for (var t = this._groups, n = 0, e = t.length; n < e; ++n)for (var r = t[n], i = 0, o = r.length; i < o; ++i) { var u = r[i]; if (u) return u } return null }, size: function () { let t = 0; for (const n of this) ++t; return t }, empty: function () { return !this.node() }, each: function (t) { for (var n = this._groups, e = 0, r = n.length; e < r; ++e)for (var i, o = n[e], u = 0, s = o.length; u < s; ++u)(i = o[u]) && t.call(i, i.__data__, u, o); return this }, attr: function (t, n) { var r = e(t); if (arguments.length < 2) { var i = this.node(); return r.local ? i.getAttributeNS(r.space, r.local) : i.getAttribute(r) } return this.each((null == n ? r.local ? E : b : "function" == typeof n ? r.local ? B : L : r.local ? C : N)(r, n)) }, style: function (t, n, e) { return arguments.length > 1 ? this.each((null == n ? T : "function" == typeof n ? M : q)(t, n, null == e ? "" : e)) : D(this.node(), t) }, property: function (t, n) { return arguments.length > 1 ? this.each((null == n ? V : "function" == typeof n ? R : O)(t, n)) : this.node()[t] }, classed: function (t, n) { var e = j(t + ""); if (arguments.length < 2) { for (var r = H(this.node()), i = -1, o = e.length; ++i < o;)if (!r.contains(e[i])) return !1; return !0 } return this.each(("function" == typeof n ? k : n ? G : Y)(e, n)) }, text: function (t) { return arguments.length ? this.each(null == t ? z : ("function" == typeof t ? J : F)(t)) : this.node().textContent }, html: function (t) { return arguments.length ? this.each(null == t ? K : ("function" == typeof t ? W : Q)(t)) : this.node().innerHTML }, raise: function () { return this.each(Z) }, lower: function () { return this.each($) }, append: function (t) { var n = "function" == typeof t ? t : o(t); return this.select((function () { return this.appendChild(n.apply(this, arguments)) })) }, insert: function (t, n) { var e = "function" == typeof t ? t : o(t), r = null == n ? tt : "function" == typeof n ? n : s(n); return this.select((function () { return this.insertBefore(e.apply(this, arguments), r.apply(this, arguments) || null) })) }, remove: function () { return this.each(nt) }, clone: function (t) { return this.select(t ? rt : et) }, datum: function (t) { return arguments.length ? this.property("__data__", t) : this.node().__data__ }, on: function (t, n, e) { var r, i, o = function (t) { return t.trim().split(/^|\s+/).map((function (t) { var n = "", e = t.indexOf("."); return e >= 0 && (n = t.slice(e + 1), t = t.slice(0, e)), { type: t, name: n } })) }(t + ""), u = o.length; if (!(arguments.length < 2)) { for (s = n ? ot : it, r = 0; r < u; ++r)this.each(s(o[r], n, e)); return this } var s = this.node().__on; if (s) for (var c, a = 0, l = s.length; a < l; ++a)for (r = 0, c = s[a]; r < u; ++r)if ((i = o[r]).type === c.type && i.name === c.name) return c.value }, dispatch: function (t, n) { return this.each(("function" == typeof n ? ct : st)(t, n)) }, [Symbol.iterator]: function* () { for (var t = this._groups, n = 0, e = t.length; n < e; ++n)for (var r, i = t[n], o = 0, u = i.length; o < u; ++o)(r = i[o]) && (yield r) } }; var _t = 0; function dt() { return new yt } function yt() { this._ = "@" + (++_t).toString(36) } function vt(t) { let n; for (; n = t.sourceEvent;)t = n; return t } function mt(t, n) { if (t = vt(t), void 0 === n && (n = t.currentTarget), n) { var e = n.ownerSVGElement || n; if (e.createSVGPoint) { var r = e.createSVGPoint(); return r.x = t.clientX, r.y = t.clientY, [(r = r.matrixTransform(n.getScreenCTM().inverse())).x, r.y] } if (n.getBoundingClientRect) { var i = n.getBoundingClientRect(); return [t.clientX - i.left - n.clientLeft, t.clientY - i.top - n.clientTop] } } return [t.pageX, t.pageY] } function gt(t, n) { return t.target && (t = vt(t), void 0 === n && (n = t.currentTarget), t = t.touches || [t]), Array.from(t, (t => mt(t, n))) } function wt(t) { return "string" == typeof t ? new lt([document.querySelectorAll(t)], [document.documentElement]) : new lt([c(t)], at) } yt.prototype = dt.prototype = { constructor: yt, get: function (t) { for (var n = this._; !(n in t);)if (!(t = t.parentNode)) return; return t[n] }, set: function (t, n) { return t[this._] = n }, remove: function (t) { return this._ in t && delete t[this._] }, toString: function () { return this._ } }; export { pt as create, o as creator, dt as local, f as matcher, e as namespace, n as namespaces, mt as pointer, gt as pointers, ht as select, wt as selectAll, ft as selection, s as selector, l as selectorAll, D as style, P as window }; export default null;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2.
3
+ * Original file: /npm/d3-timer@3.0.1/src/index.js
4
+ *
5
+ * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
6
+ */
7
+ var t, n, e = 0, r = 0, o = 0, i = 1e3, a = 0, l = 0, u = 0, c = "object" == typeof performance && performance.now ? performance : Date, s = "object" == typeof window && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function (t) { setTimeout(t, 17) }; function f() { return l || (s(_), l = c.now() + u) } function _() { l = 0 } function w() { this._call = this._time = this._next = null } function m(t, n, e) { var r = new w; return r.restart(t, n, e), r } function p() { f(), ++e; for (var n, r = t; r;)(n = l - r._time) >= 0 && r._call.call(void 0, n), r = r._next; --e } function h() { l = (a = c.now()) + u, e = r = 0; try { p() } finally { e = 0, function () { var e, r, o = t, i = 1 / 0; for (; o;)o._call ? (i > o._time && (i = o._time), e = o, o = o._next) : (r = o._next, o._next = null, o = e ? e._next = r : t = r); n = e, x(i) }(), l = 0 } } function v() { var t = c.now(), n = t - a; n > i && (u -= n, a = t) } function x(t) { e || (r && (r = clearTimeout(r)), t - l > 24 ? (t < 1 / 0 && (r = setTimeout(h, t - c.now() - u)), o && (o = clearInterval(o))) : (o || (a = c.now(), o = setInterval(v, i)), e = 1, s(h))) } function y(t, n, e) { var r = new w; return n = null == n ? 0 : +n, r.restart((e => { r.stop(), t(e + n) }), n, e), r } function d(t, n, e) { var r = new w, o = n; return null == n ? (r.restart(t, n, e), r) : (r._restart = r.restart, r.restart = function (t, n, e) { n = +n, e = null == e ? f() : +e, r._restart((function i(a) { a += o, r._restart(i, o += n, e), t(a) }), n, e) }, r.restart(t, n, e), r) } w.prototype = m.prototype = { constructor: w, restart: function (e, r, o) { if ("function" != typeof e) throw new TypeError("callback is not a function"); o = (null == o ? f() : +o) + (null == r ? 0 : +r), this._next || n === this || (n ? n._next = this : t = this, n = this), this._call = e, this._time = o, x() }, stop: function () { this._call && (this._call = null, this._time = 1 / 0, x()) } }; export { d as interval, f as now, y as timeout, m as timer, p as timerFlush }; export default null;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.17.1.
3
+ * Original file: /npm/d3-transition@3.0.1/src/index.js
4
+ *
5
+ * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
6
+ */
7
+ import { namespace as t, matcher as n, selector as e, selectorAll as r, selection as i, style as o } from "d3-selection"; import { dispatch as u } from "d3-dispatch"; import { timer as a, timeout as s, now as l } from "d3-timer"; import { interpolateNumber as f, interpolateRgb as c, interpolateString as h, interpolateTransformSvg as _, interpolateTransformCss as p } from "d3-interpolate"; import { color as v } from "d3-color"; import { easeCubicInOut as d } from "d3-ease"; var m = u("start", "end", "cancel", "interrupt"), y = [], w = 0, g = 1, x = 2, A = 3, b = 4, E = 5, C = 6; function N(t, n, e, r, i, o) { var u = t.__transition; if (u) { if (e in u) return } else t.__transition = {}; !function (t, n, e) { var r, i = t.__transition; function o(t) { e.state = g, e.timer.restart(u, e.delay, e.time), e.delay <= t && u(t - e.delay) } function u(o) { var a, c, h, _; if (e.state !== g) return f(); for (a in i) if ((_ = i[a]).name === e.name) { if (_.state === A) return s(u); _.state === b ? (_.state = C, _.timer.stop(), _.on.call("interrupt", t, t.__data__, _.index, _.group), delete i[a]) : +a < n && (_.state = C, _.timer.stop(), _.on.call("cancel", t, t.__data__, _.index, _.group), delete i[a]) } if (s((function () { e.state === A && (e.state = b, e.timer.restart(l, e.delay, e.time), l(o)) })), e.state = x, e.on.call("start", t, t.__data__, e.index, e.group), e.state === x) { for (e.state = A, r = new Array(h = e.tween.length), a = 0, c = -1; a < h; ++a)(_ = e.tween[a].value.call(t, t.__data__, e.index, e.group)) && (r[++c] = _); r.length = c + 1 } } function l(n) { for (var i = n < e.duration ? e.ease.call(null, n / e.duration) : (e.timer.restart(f), e.state = E, 1), o = -1, u = r.length; ++o < u;)r[o].call(t, i); e.state === E && (e.on.call("end", t, t.__data__, e.index, e.group), f()) } function f() { for (var r in e.state = C, e.timer.stop(), delete i[n], i) return; delete t.__transition } i[n] = e, e.timer = a(o, 0, e.time) }(t, e, { name: n, index: r, group: i, on: m, tween: y, time: o.time, delay: o.delay, duration: o.duration, ease: o.ease, timer: null, state: w }) } function S(t, n) { var e = P(t, n); if (e.state > w) throw new Error("too late; already scheduled"); return e } function T(t, n) { var e = P(t, n); if (e.state > A) throw new Error("too late; already running"); return e } function P(t, n) { var e = t.__transition; if (!e || !(e = e[n])) throw new Error("transition not found"); return e } function z(t, n) { var e, r, i, o = t.__transition, u = !0; if (o) { for (i in n = null == n ? null : n + "", o) (e = o[i]).name === n ? (r = e.state > x && e.state < E, e.state = C, e.timer.stop(), e.on.call(r ? "interrupt" : "cancel", t, t.__data__, e.index, e.group), delete o[i]) : u = !1; u && delete t.__transition } } function k(t, n) { var e, r; return function () { var i = T(this, t), o = i.tween; if (o !== e) for (var u = 0, a = (r = e = o).length; u < a; ++u)if (r[u].name === n) { (r = r.slice()).splice(u, 1); break } i.tween = r } } function M(t, n, e) { var r, i; if ("function" != typeof e) throw new Error; return function () { var o = T(this, t), u = o.tween; if (u !== r) { i = (r = u).slice(); for (var a = { name: n, value: e }, s = 0, l = i.length; s < l; ++s)if (i[s].name === n) { i[s] = a; break } s === l && i.push(a) } o.tween = i } } function O(t, n, e) { var r = t._id; return t.each((function () { var t = T(this, r); (t.value || (t.value = {}))[n] = e.apply(this, arguments) })), function (t) { return P(t, r).value[n] } } function V(t, n) { var e; return ("number" == typeof n ? f : n instanceof v ? c : (e = v(n)) ? (n = e, c) : h)(t, n) } function $(t) { return function () { this.removeAttribute(t) } } function j(t) { return function () { this.removeAttributeNS(t.space, t.local) } } function q(t, n, e) { var r, i, o = e + ""; return function () { var u = this.getAttribute(t); return u === o ? null : u === r ? i : i = n(r = u, e) } } function B(t, n, e) { var r, i, o = e + ""; return function () { var u = this.getAttributeNS(t.space, t.local); return u === o ? null : u === r ? i : i = n(r = u, e) } } function D(t, n, e) { var r, i, o; return function () { var u, a, s = e(this); if (null != s) return (u = this.getAttribute(t)) === (a = s + "") ? null : u === r && a === i ? o : (i = a, o = n(r = u, s)); this.removeAttribute(t) } } function F(t, n, e) { var r, i, o; return function () { var u, a, s = e(this); if (null != s) return (u = this.getAttributeNS(t.space, t.local)) === (a = s + "") ? null : u === r && a === i ? o : (i = a, o = n(r = u, s)); this.removeAttributeNS(t.space, t.local) } } function G(t, n) { var e, r; function i() { var i = n.apply(this, arguments); return i !== r && (e = (r = i) && function (t, n) { return function (e) { this.setAttributeNS(t.space, t.local, n.call(this, e)) } }(t, i)), e } return i._value = n, i } function H(t, n) { var e, r; function i() { var i = n.apply(this, arguments); return i !== r && (e = (r = i) && function (t, n) { return function (e) { this.setAttribute(t, n.call(this, e)) } }(t, i)), e } return i._value = n, i } function I(t, n) { return function () { S(this, t).delay = +n.apply(this, arguments) } } function J(t, n) { return n = +n, function () { S(this, t).delay = n } } function K(t, n) { return function () { T(this, t).duration = +n.apply(this, arguments) } } function L(t, n) { return n = +n, function () { T(this, t).duration = n } } var Q = i.prototype.constructor; function R(t) { return function () { this.style.removeProperty(t) } } var U = 0; function W(t, n, e, r) { this._groups = t, this._parents = n, this._name = e, this._id = r } function X(t) { return i().transition(t) } function Y() { return ++U } var Z = i.prototype; W.prototype = X.prototype = { constructor: W, select: function (t) { var n = this._name, r = this._id; "function" != typeof t && (t = e(t)); for (var i = this._groups, o = i.length, u = new Array(o), a = 0; a < o; ++a)for (var s, l, f = i[a], c = f.length, h = u[a] = new Array(c), _ = 0; _ < c; ++_)(s = f[_]) && (l = t.call(s, s.__data__, _, f)) && ("__data__" in s && (l.__data__ = s.__data__), h[_] = l, N(h[_], n, r, _, h, P(s, r))); return new W(u, this._parents, n, r) }, selectAll: function (t) { var n = this._name, e = this._id; "function" != typeof t && (t = r(t)); for (var i = this._groups, o = i.length, u = [], a = [], s = 0; s < o; ++s)for (var l, f = i[s], c = f.length, h = 0; h < c; ++h)if (l = f[h]) { for (var _, p = t.call(l, l.__data__, h, f), v = P(l, e), d = 0, m = p.length; d < m; ++d)(_ = p[d]) && N(_, n, e, d, p, v); u.push(p), a.push(l) } return new W(u, a, n, e) }, selectChild: Z.selectChild, selectChildren: Z.selectChildren, filter: function (t) { "function" != typeof t && (t = n(t)); for (var e = this._groups, r = e.length, i = new Array(r), o = 0; o < r; ++o)for (var u, a = e[o], s = a.length, l = i[o] = [], f = 0; f < s; ++f)(u = a[f]) && t.call(u, u.__data__, f, a) && l.push(u); return new W(i, this._parents, this._name, this._id) }, merge: function (t) { if (t._id !== this._id) throw new Error; for (var n = this._groups, e = t._groups, r = n.length, i = e.length, o = Math.min(r, i), u = new Array(r), a = 0; a < o; ++a)for (var s, l = n[a], f = e[a], c = l.length, h = u[a] = new Array(c), _ = 0; _ < c; ++_)(s = l[_] || f[_]) && (h[_] = s); for (; a < r; ++a)u[a] = n[a]; return new W(u, this._parents, this._name, this._id) }, selection: function () { return new Q(this._groups, this._parents) }, transition: function () { for (var t = this._name, n = this._id, e = Y(), r = this._groups, i = r.length, o = 0; o < i; ++o)for (var u, a = r[o], s = a.length, l = 0; l < s; ++l)if (u = a[l]) { var f = P(u, n); N(u, t, e, l, a, { time: f.time + f.delay + f.duration, delay: 0, duration: f.duration, ease: f.ease }) } return new W(r, this._parents, t, e) }, call: Z.call, nodes: Z.nodes, node: Z.node, size: Z.size, empty: Z.empty, each: Z.each, on: function (t, n) { var e = this._id; return arguments.length < 2 ? P(this.node(), e).on.on(t) : this.each(function (t, n, e) { var r, i, o = function (t) { return (t + "").trim().split(/^|\s+/).every((function (t) { var n = t.indexOf("."); return n >= 0 && (t = t.slice(0, n)), !t || "start" === t })) }(n) ? S : T; return function () { var u = o(this, t), a = u.on; a !== r && (i = (r = a).copy()).on(n, e), u.on = i } }(e, t, n)) }, attr: function (n, e) { var r = t(n), i = "transform" === r ? _ : V; return this.attrTween(n, "function" == typeof e ? (r.local ? F : D)(r, i, O(this, "attr." + n, e)) : null == e ? (r.local ? j : $)(r) : (r.local ? B : q)(r, i, e)) }, attrTween: function (n, e) { var r = "attr." + n; if (arguments.length < 2) return (r = this.tween(r)) && r._value; if (null == e) return this.tween(r, null); if ("function" != typeof e) throw new Error; var i = t(n); return this.tween(r, (i.local ? G : H)(i, e)) }, style: function (t, n, e) { var r = "transform" == (t += "") ? p : V; return null == n ? this.styleTween(t, function (t, n) { var e, r, i; return function () { var u = o(this, t), a = (this.style.removeProperty(t), o(this, t)); return u === a ? null : u === e && a === r ? i : i = n(e = u, r = a) } }(t, r)).on("end.style." + t, R(t)) : "function" == typeof n ? this.styleTween(t, function (t, n, e) { var r, i, u; return function () { var a = o(this, t), s = e(this), l = s + ""; return null == s && (this.style.removeProperty(t), l = s = o(this, t)), a === l ? null : a === r && l === i ? u : (i = l, u = n(r = a, s)) } }(t, r, O(this, "style." + t, n))).each(function (t, n) { var e, r, i, o, u = "style." + n, a = "end." + u; return function () { var s = T(this, t), l = s.on, f = null == s.value[u] ? o || (o = R(n)) : void 0; l === e && i === f || (r = (e = l).copy()).on(a, i = f), s.on = r } }(this._id, t)) : this.styleTween(t, function (t, n, e) { var r, i, u = e + ""; return function () { var a = o(this, t); return a === u ? null : a === r ? i : i = n(r = a, e) } }(t, r, n), e).on("end.style." + t, null) }, styleTween: function (t, n, e) { var r = "style." + (t += ""); if (arguments.length < 2) return (r = this.tween(r)) && r._value; if (null == n) return this.tween(r, null); if ("function" != typeof n) throw new Error; return this.tween(r, function (t, n, e) { var r, i; function o() { var o = n.apply(this, arguments); return o !== i && (r = (i = o) && function (t, n, e) { return function (r) { this.style.setProperty(t, n.call(this, r), e) } }(t, o, e)), r } return o._value = n, o }(t, n, null == e ? "" : e)) }, text: function (t) { return this.tween("text", "function" == typeof t ? function (t) { return function () { var n = t(this); this.textContent = null == n ? "" : n } }(O(this, "text", t)) : function (t) { return function () { this.textContent = t } }(null == t ? "" : t + "")) }, textTween: function (t) { var n = "text"; if (arguments.length < 1) return (n = this.tween(n)) && n._value; if (null == t) return this.tween(n, null); if ("function" != typeof t) throw new Error; return this.tween(n, function (t) { var n, e; function r() { var r = t.apply(this, arguments); return r !== e && (n = (e = r) && function (t) { return function (n) { this.textContent = t.call(this, n) } }(r)), n } return r._value = t, r }(t)) }, remove: function () { return this.on("end.remove", function (t) { return function () { var n = this.parentNode; for (var e in this.__transition) if (+e !== t) return; n && n.removeChild(this) } }(this._id)) }, tween: function (t, n) { var e = this._id; if (t += "", arguments.length < 2) { for (var r, i = P(this.node(), e).tween, o = 0, u = i.length; o < u; ++o)if ((r = i[o]).name === t) return r.value; return null } return this.each((null == n ? k : M)(e, t, n)) }, delay: function (t) { var n = this._id; return arguments.length ? this.each(("function" == typeof t ? I : J)(n, t)) : P(this.node(), n).delay }, duration: function (t) { var n = this._id; return arguments.length ? this.each(("function" == typeof t ? K : L)(n, t)) : P(this.node(), n).duration }, ease: function (t) { var n = this._id; return arguments.length ? this.each(function (t, n) { if ("function" != typeof n) throw new Error; return function () { T(this, t).ease = n } }(n, t)) : P(this.node(), n).ease }, easeVarying: function (t) { if ("function" != typeof t) throw new Error; return this.each(function (t, n) { return function () { var e = n.apply(this, arguments); if ("function" != typeof e) throw new Error; T(this, t).ease = e } }(this._id, t)) }, end: function () { var t, n, e = this, r = e._id, i = e.size(); return new Promise((function (o, u) { var a = { value: u }, s = { value: function () { 0 == --i && o() } }; e.each((function () { var e = T(this, r), i = e.on; i !== t && ((n = (t = i).copy())._.cancel.push(a), n._.interrupt.push(a), n._.end.push(s)), e.on = n })), 0 === i && o() })) }, [Symbol.iterator]: Z[Symbol.iterator] }; var tt = { time: null, delay: 0, duration: 250, ease: d }; function nt(t, n) { for (var e; !(e = t.__transition) || !(e = e[n]);)if (!(t = t.parentNode)) throw new Error(`transition ${n} not found`); return e } i.prototype.interrupt = function (t) { return this.each((function () { z(this, t) })) }, i.prototype.transition = function (t) { var n, e; t instanceof W ? (n = t._id, t = t._name) : (n = Y(), (e = tt).time = l(), t = null == t ? null : t + ""); for (var r = this._groups, i = r.length, o = 0; o < i; ++o)for (var u, a = r[o], s = a.length, f = 0; f < s; ++f)(u = a[f]) && N(u, t, n, f, a, e || nt(u, n)); return new W(r, this._parents, t, n) }; var et = [null]; function rt(t, n) { var e, r, i = t.__transition; if (i) for (r in n = null == n ? null : n + "", i) if ((e = i[r]).state > g && e.name === n) return new W([[t]], et, n, +r); return null } export { rt as active, z as interrupt, X as transition }; export default null;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2.
3
+ * Original file: /npm/d3-zoom@3.0.0/src/index.js
4
+ *
5
+ * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
6
+ */
7
+ import { dispatch as t } from "d3-dispatch"; import { dragDisable as n, dragEnable as e } from "d3-drag"; import { interpolateZoom as o } from "d3-interpolate"; import { select as i, pointer as r } from "d3-selection"; import { interrupt as u } from "d3-transition"; var h = t => () => t; function s(t, { sourceEvent: n, target: e, transform: o, dispatch: i }) { Object.defineProperties(this, { type: { value: t, enumerable: !0, configurable: !0 }, sourceEvent: { value: n, enumerable: !0, configurable: !0 }, target: { value: e, enumerable: !0, configurable: !0 }, transform: { value: o, enumerable: !0, configurable: !0 }, _: { value: i } }) } function a(t, n, e) { this.k = t, this.x = n, this.y = e } a.prototype = { constructor: a, scale: function (t) { return 1 === t ? this : new a(this.k * t, this.x, this.y) }, translate: function (t, n) { return 0 === t & 0 === n ? this : new a(this.k, this.x + this.k * t, this.y + this.k * n) }, apply: function (t) { return [t[0] * this.k + this.x, t[1] * this.k + this.y] }, applyX: function (t) { return t * this.k + this.x }, applyY: function (t) { return t * this.k + this.y }, invert: function (t) { return [(t[0] - this.x) / this.k, (t[1] - this.y) / this.k] }, invertX: function (t) { return (t - this.x) / this.k }, invertY: function (t) { return (t - this.y) / this.k }, rescaleX: function (t) { return t.copy().domain(t.range().map(this.invertX, this).map(t.invert, t)) }, rescaleY: function (t) { return t.copy().domain(t.range().map(this.invertY, this).map(t.invert, t)) }, toString: function () { return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")" } }; var c = new a(1, 0, 0); function l(t) { for (; !t.__zoom;)if (!(t = t.parentNode)) return c; return t.__zoom } function f(t) { t.stopImmediatePropagation() } function m(t) { t.preventDefault(), t.stopImmediatePropagation() } function p(t) { return !(t.ctrlKey && "wheel" !== t.type || t.button) } function v() { var t = this; return t instanceof SVGElement ? (t = t.ownerSVGElement || t).hasAttribute("viewBox") ? [[(t = t.viewBox.baseVal).x, t.y], [t.x + t.width, t.y + t.height]] : [[0, 0], [t.width.baseVal.value, t.height.baseVal.value]] : [[0, 0], [t.clientWidth, t.clientHeight]] } function y() { return this.__zoom || c } function d(t) { return -t.deltaY * (1 === t.deltaMode ? .05 : t.deltaMode ? 1 : .002) * (t.ctrlKey ? 10 : 1) } function z() { return navigator.maxTouchPoints || "ontouchstart" in this } function _(t, n, e) { var o = t.invertX(n[0][0]) - e[0][0], i = t.invertX(n[1][0]) - e[1][0], r = t.invertY(n[0][1]) - e[0][1], u = t.invertY(n[1][1]) - e[1][1]; return t.translate(i > o ? (o + i) / 2 : Math.min(0, o) || Math.max(0, i), u > r ? (r + u) / 2 : Math.min(0, r) || Math.max(0, u)) } function g() { var l, g, k, x = p, w = v, b = _, T = d, M = z, E = [0, 1 / 0], Y = [[-1 / 0, -1 / 0], [1 / 0, 1 / 0]], X = 250, V = o, B = t("start", "zoom", "end"), D = 500, P = 150, I = 0, K = 10; function S(t) { t.property("__zoom", y).on("wheel.zoom", O, { passive: !1 }).on("mousedown.zoom", W).on("dblclick.zoom", Z).filter(M).on("touchstart.zoom", C).on("touchmove.zoom", F).on("touchend.zoom touchcancel.zoom", J).style("-webkit-tap-highlight-color", "rgba(0,0,0,0)") } function q(t, n) { return (n = Math.max(E[0], Math.min(E[1], n))) === t.k ? t : new a(n, t.x, t.y) } function G(t, n, e) { var o = n[0] - e[0] * t.k, i = n[1] - e[1] * t.k; return o === t.x && i === t.y ? t : new a(t.k, o, i) } function j(t) { return [(+t[0][0] + +t[1][0]) / 2, (+t[0][1] + +t[1][1]) / 2] } function A(t, n, e, o) { t.on("start.zoom", (function () { H(this, arguments).event(o).start() })).on("interrupt.zoom end.zoom", (function () { H(this, arguments).event(o).end() })).tween("zoom", (function () { var t = this, i = arguments, r = H(t, i).event(o), u = w.apply(t, i), h = null == e ? j(u) : "function" == typeof e ? e.apply(t, i) : e, s = Math.max(u[1][0] - u[0][0], u[1][1] - u[0][1]), c = t.__zoom, l = "function" == typeof n ? n.apply(t, i) : n, f = V(c.invert(h).concat(s / c.k), l.invert(h).concat(s / l.k)); return function (t) { if (1 === t) t = l; else { var n = f(t), e = s / n[2]; t = new a(e, h[0] - n[0] * e, h[1] - n[1] * e) } r.zoom(null, t) } })) } function H(t, n, e) { return !e && t.__zooming || new N(t, n) } function N(t, n) { this.that = t, this.args = n, this.active = 0, this.sourceEvent = null, this.extent = w.apply(t, n), this.taps = 0 } function O(t, ...n) { if (x.apply(this, arguments)) { var e = H(this, n).event(t), o = this.__zoom, i = Math.max(E[0], Math.min(E[1], o.k * Math.pow(2, T.apply(this, arguments)))), h = r(t); if (e.wheel) e.mouse[0][0] === h[0] && e.mouse[0][1] === h[1] || (e.mouse[1] = o.invert(e.mouse[0] = h)), clearTimeout(e.wheel); else { if (o.k === i) return; e.mouse = [h, o.invert(h)], u(this), e.start() } m(t), e.wheel = setTimeout((function () { e.wheel = null, e.end() }), P), e.zoom("mouse", b(G(q(o, i), e.mouse[0], e.mouse[1]), e.extent, Y)) } } function W(t, ...o) { if (!k && x.apply(this, arguments)) { var h = t.currentTarget, s = H(this, o, !0).event(t), a = i(t.view).on("mousemove.zoom", (function (t) { if (m(t), !s.moved) { var n = t.clientX - l, e = t.clientY - p; s.moved = n * n + e * e > I } s.event(t).zoom("mouse", b(G(s.that.__zoom, s.mouse[0] = r(t, h), s.mouse[1]), s.extent, Y)) }), !0).on("mouseup.zoom", (function (t) { a.on("mousemove.zoom mouseup.zoom", null), e(t.view, s.moved), m(t), s.event(t).end() }), !0), c = r(t, h), l = t.clientX, p = t.clientY; n(t.view), f(t), s.mouse = [c, this.__zoom.invert(c)], u(this), s.start() } } function Z(t, ...n) { if (x.apply(this, arguments)) { var e = this.__zoom, o = r(t.changedTouches ? t.changedTouches[0] : t, this), u = e.invert(o), h = e.k * (t.shiftKey ? .5 : 2), s = b(G(q(e, h), o, u), w.apply(this, n), Y); m(t), X > 0 ? i(this).transition().duration(X).call(A, s, o, t) : i(this).call(S.transform, s, o, t) } } function C(t, ...n) { if (x.apply(this, arguments)) { var e, o, i, h, s = t.touches, a = s.length, c = H(this, n, t.changedTouches.length === a).event(t); for (f(t), o = 0; o < a; ++o)i = s[o], h = [h = r(i, this), this.__zoom.invert(h), i.identifier], c.touch0 ? c.touch1 || c.touch0[2] === h[2] || (c.touch1 = h, c.taps = 0) : (c.touch0 = h, e = !0, c.taps = 1 + !!l); l && (l = clearTimeout(l)), e && (c.taps < 2 && (g = h[0], l = setTimeout((function () { l = null }), D)), u(this), c.start()) } } function F(t, ...n) { if (this.__zooming) { var e, o, i, u, h = H(this, n).event(t), s = t.changedTouches, a = s.length; for (m(t), e = 0; e < a; ++e)o = s[e], i = r(o, this), h.touch0 && h.touch0[2] === o.identifier ? h.touch0[0] = i : h.touch1 && h.touch1[2] === o.identifier && (h.touch1[0] = i); if (o = h.that.__zoom, h.touch1) { var c = h.touch0[0], l = h.touch0[1], f = h.touch1[0], p = h.touch1[1], v = (v = f[0] - c[0]) * v + (v = f[1] - c[1]) * v, y = (y = p[0] - l[0]) * y + (y = p[1] - l[1]) * y; o = q(o, Math.sqrt(v / y)), i = [(c[0] + f[0]) / 2, (c[1] + f[1]) / 2], u = [(l[0] + p[0]) / 2, (l[1] + p[1]) / 2] } else { if (!h.touch0) return; i = h.touch0[0], u = h.touch0[1] } h.zoom("touch", b(G(o, i, u), h.extent, Y)) } } function J(t, ...n) { if (this.__zooming) { var e, o, u = H(this, n).event(t), h = t.changedTouches, s = h.length; for (f(t), k && clearTimeout(k), k = setTimeout((function () { k = null }), D), e = 0; e < s; ++e)o = h[e], u.touch0 && u.touch0[2] === o.identifier ? delete u.touch0 : u.touch1 && u.touch1[2] === o.identifier && delete u.touch1; if (u.touch1 && !u.touch0 && (u.touch0 = u.touch1, delete u.touch1), u.touch0) u.touch0[1] = this.__zoom.invert(u.touch0[0]); else if (u.end(), 2 === u.taps && (o = r(o, this), Math.hypot(g[0] - o[0], g[1] - o[1]) < K)) { var a = i(this).on("dblclick.zoom"); a && a.apply(this, arguments) } } } return S.transform = function (t, n, e, o) { var i = t.selection ? t.selection() : t; i.property("__zoom", y), t !== i ? A(t, n, e, o) : i.interrupt().each((function () { H(this, arguments).event(o).start().zoom(null, "function" == typeof n ? n.apply(this, arguments) : n).end() })) }, S.scaleBy = function (t, n, e, o) { S.scaleTo(t, (function () { return this.__zoom.k * ("function" == typeof n ? n.apply(this, arguments) : n) }), e, o) }, S.scaleTo = function (t, n, e, o) { S.transform(t, (function () { var t = w.apply(this, arguments), o = this.__zoom, i = null == e ? j(t) : "function" == typeof e ? e.apply(this, arguments) : e, r = o.invert(i), u = "function" == typeof n ? n.apply(this, arguments) : n; return b(G(q(o, u), i, r), t, Y) }), e, o) }, S.translateBy = function (t, n, e, o) { S.transform(t, (function () { return b(this.__zoom.translate("function" == typeof n ? n.apply(this, arguments) : n, "function" == typeof e ? e.apply(this, arguments) : e), w.apply(this, arguments), Y) }), null, o) }, S.translateTo = function (t, n, e, o, i) { S.transform(t, (function () { var t = w.apply(this, arguments), i = this.__zoom, r = null == o ? j(t) : "function" == typeof o ? o.apply(this, arguments) : o; return b(c.translate(r[0], r[1]).scale(i.k).translate("function" == typeof n ? -n.apply(this, arguments) : -n, "function" == typeof e ? -e.apply(this, arguments) : -e), t, Y) }), o, i) }, N.prototype = { event: function (t) { return t && (this.sourceEvent = t), this }, start: function () { return 1 == ++this.active && (this.that.__zooming = this, this.emit("start")), this }, zoom: function (t, n) { return this.mouse && "mouse" !== t && (this.mouse[1] = n.invert(this.mouse[0])), this.touch0 && "touch" !== t && (this.touch0[1] = n.invert(this.touch0[0])), this.touch1 && "touch" !== t && (this.touch1[1] = n.invert(this.touch1[0])), this.that.__zoom = n, this.emit("zoom"), this }, end: function () { return 0 == --this.active && (delete this.that.__zooming, this.emit("end")), this }, emit: function (t) { var n = i(this.that).datum(); B.call(t, this.that, new s(t, { sourceEvent: this.sourceEvent, target: S, type: t, transform: this.that.__zoom, dispatch: B }), n) } }, S.wheelDelta = function (t) { return arguments.length ? (T = "function" == typeof t ? t : h(+t), S) : T }, S.filter = function (t) { return arguments.length ? (x = "function" == typeof t ? t : h(!!t), S) : x }, S.touchable = function (t) { return arguments.length ? (M = "function" == typeof t ? t : h(!!t), S) : M }, S.extent = function (t) { return arguments.length ? (w = "function" == typeof t ? t : h([[+t[0][0], +t[0][1]], [+t[1][0], +t[1][1]]]), S) : w }, S.scaleExtent = function (t) { return arguments.length ? (E[0] = +t[0], E[1] = +t[1], S) : [E[0], E[1]] }, S.translateExtent = function (t) { return arguments.length ? (Y[0][0] = +t[0][0], Y[1][0] = +t[1][0], Y[0][1] = +t[0][1], Y[1][1] = +t[1][1], S) : [[Y[0][0], Y[0][1]], [Y[1][0], Y[1][1]]] }, S.constrain = function (t) { return arguments.length ? (b = t, S) : b }, S.duration = function (t) { return arguments.length ? (X = +t, S) : X }, S.interpolate = function (t) { return arguments.length ? (V = t, S) : V }, S.on = function () { var t = B.on.apply(B, arguments); return t === B ? S : t }, S.clickDistance = function (t) { return arguments.length ? (I = (t = +t) * t, S) : Math.sqrt(I) }, S.tapDistance = function (t) { return arguments.length ? (K = +t, S) : K }, S } l.prototype = a.prototype; export { a as ZoomTransform, g as zoom, c as zoomIdentity, l as zoomTransform }; export default null;
File without changes
@@ -0,0 +1,75 @@
1
+ import mermaid from "mermaid";
2
+ import { select as d3Select } from "d3-selection";
3
+ import { zoom as d3Zoom, zoomIdentity } from "d3-zoom";
4
+
5
+
6
+ let is_running = false;
7
+ const queue = [];
8
+
9
+ export default {
10
+ template: `<div></div>`,
11
+ data: () => ({
12
+ last_content: "",
13
+ }),
14
+ mounted() {
15
+ //
16
+ let content = this.content
17
+
18
+
19
+ if (this.clickableNodes.length > 0) {
20
+ // The event triggered by mermaid must be global, but there may be multiple mermaid components on the page.
21
+ // Therefore, we need a unique function name for each component scenario.
22
+ const actionCallback = `mermaid_${this.currentId}_action`
23
+
24
+ const actionStem = this.clickableNodes.map(n => `click ${n} ${actionCallback}`).join('\n')
25
+ content = [content, actionStem].join('\n')
26
+
27
+ window[actionCallback] = (nodeId) => {
28
+ this.$emit('onNodeClick', { nodeId })
29
+ }
30
+ }
31
+
32
+ this.update(content);
33
+ },
34
+
35
+
36
+ methods: {
37
+ async update(content) {
38
+ if (this.last_content === content) return;
39
+ this.last_content = content;
40
+ this.$el.innerHTML = content;
41
+ this.$el.removeAttribute("data-processed");
42
+ queue.push(this.$el);
43
+ if (is_running) return;
44
+ is_running = true;
45
+
46
+ // startOnLoad prevents auto-execution of run, and securityLevel: 'loose' is required to execute click events.
47
+ mermaid.initialize({ startOnLoad: false, securityLevel: 'loose' });
48
+ while (queue.length) {
49
+ await mermaid.run({ nodes: [queue.shift()] });
50
+ }
51
+ is_running = false;
52
+
53
+ if (this.zoomMode) {
54
+ const svg = d3Select(this.$el).select('svg')
55
+ const zoomBox = svg.select('g.root')
56
+
57
+ var zoom = d3Zoom().on("zoom", function ({ transform }) {
58
+ zoomBox.attr("transform", transform);
59
+ });
60
+
61
+ svg.call(zoom);
62
+
63
+ svg.on('dblclick.zoom', () => {
64
+ svg.transition().duration(750).call(zoom.transform, zoomIdentity);
65
+ })
66
+ }
67
+ }
68
+ },
69
+ props: {
70
+ content: String,
71
+ currentId: String,
72
+ clickableNodes: Array,
73
+ zoomMode: Boolean
74
+ },
75
+ };
@@ -0,0 +1,64 @@
1
+ from typing import Callable, List, Optional
2
+ from nicegui.elements.mixins.content_element import ContentElement
3
+ from pathlib import Path
4
+ import nicegui
5
+ from dataclasses import dataclass
6
+ from nicegui.events import UiEventArguments
7
+ from nicegui.dataclasses import KWONLY_SLOTS
8
+
9
+ NG_ROOT = Path(nicegui.__file__).parent / "elements"
10
+
11
+
12
+ exposed_libraries = [
13
+ NG_ROOT / "lib/mermaid/mermaid.esm.min.mjs",
14
+ "../libs/d3/*.js",
15
+ ]
16
+ extra_libraries = [
17
+ NG_ROOT / "lib/mermaid/*.js",
18
+ ]
19
+
20
+
21
+ @dataclass(**KWONLY_SLOTS)
22
+ class NodeClickEventArguments(UiEventArguments):
23
+ nodeId: str
24
+
25
+
26
+ class Mermaid(
27
+ ContentElement,
28
+ component="mermaid.js",
29
+ exposed_libraries=exposed_libraries, # type: ignore
30
+ extra_libraries=extra_libraries, # type: ignore
31
+ ):
32
+ CONTENT_PROP = "content"
33
+
34
+ def __init__(
35
+ self, content: str, clickable_nodes: Optional[List[str]] = None, zoom_mode=False
36
+ ) -> None:
37
+ """Mermaid Diagrams
38
+
39
+ Renders diagrams and charts written in the Markdown-inspired `Mermaid <https://mermaid.js.org/>`_ language.
40
+ The mermaid syntax can also be used inside Markdown elements by providing the extension string 'mermaid' to the ``ui.markdown`` element.
41
+
42
+ :param content: the Mermaid content to be displayed
43
+ """
44
+ super().__init__(content=content)
45
+ self._props["currentId"] = str(self.id)
46
+ self._props["clickableNodes"] = clickable_nodes or []
47
+ self._props["zoomMode"] = zoom_mode
48
+
49
+ def on_content_change(self, content: str) -> None:
50
+ self._props[self.CONTENT_PROP] = content.strip()
51
+ self.run_method("update", content.strip())
52
+
53
+ def on_node_click(
54
+ self,
55
+ handler: Callable[[NodeClickEventArguments], None],
56
+ ):
57
+ def inner_handler(e):
58
+ handler(
59
+ NodeClickEventArguments(
60
+ sender=self, client=self.client, nodeId=e.args["nodeId"]
61
+ )
62
+ )
63
+
64
+ self.on("onNodeClick", inner_handler, ["nodeId"])
@@ -97,7 +97,8 @@ class BindableUi(Generic[TWidget]):
97
97
 
98
98
  @effect
99
99
  def _():
100
- cast(TextElement, self.element).on_text_change(ref_ui.value)
100
+ cast(TextElement, self.element).set_text(ref_ui.value)
101
+ self.element.update()
101
102
 
102
103
  @effect
103
104
  def _():
@@ -63,6 +63,7 @@ class CheckboxBindableUi(SingleValueBindableUi[bool, ui.checkbox]):
63
63
  def bind_value(self, ref_ui: ReadonlyRef[bool]):
64
64
  @effect
65
65
  def _():
66
- self.element.on_value_change(ref_ui.value)
66
+ self.element.set_value(ref_ui.value)
67
+ self.element.update()
67
68
 
68
69
  return self
@@ -80,6 +80,7 @@ class DateBindableUi(SingleValueBindableUi[_TDateValue, ui.date]):
80
80
  def bind_value(self, ref_ui: ReadonlyRef[bool]):
81
81
  @effect
82
82
  def _():
83
- self.element.on_value_change(ref_ui.value)
83
+ self.element.set_value(ref_ui.value)
84
+ self.element.update()
84
85
 
85
86
  return self