@nova-lab/charts 0.0.0-stage → 1.0.0-dev.32
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/LICENSE +202 -0
- package/README.md +158 -2
- package/dist/GeometryIndex-DDQ34Jf4.js +104 -0
- package/dist/MarkSeries-CQCAnV4s.js +245 -0
- package/dist/aggregation.d.ts +6 -0
- package/dist/aggregation.js +124 -0
- package/dist/annotations.d.ts +34 -0
- package/dist/annotations.js +71 -0
- package/dist/api/camera.d.ts +8 -0
- package/dist/api/cartesian.d.ts +21 -0
- package/dist/api/events.d.ts +13 -0
- package/dist/api/font.d.ts +3 -0
- package/dist/api/handle.d.ts +5 -0
- package/dist/api/host.d.ts +23 -0
- package/dist/api/internal.d.ts +41 -0
- package/dist/api/map-background.d.ts +12 -0
- package/dist/api/mark-paint.d.ts +5 -0
- package/dist/api/mark-style.d.ts +4 -0
- package/dist/api/navigation.d.ts +4 -0
- package/dist/api/overlay.d.ts +7 -0
- package/dist/api/partition.d.ts +11 -0
- package/dist/api/scene.d.ts +42 -0
- package/dist/api/state.d.ts +34 -0
- package/dist/api/types.d.ts +743 -0
- package/dist/area.d.ts +9 -0
- package/dist/area.js +706 -0
- package/dist/bar.d.ts +9 -0
- package/dist/bar.js +554 -0
- package/dist/brush.d.ts +17 -0
- package/dist/brush.js +86 -0
- package/dist/bubble.d.ts +8 -0
- package/dist/bubble.js +434 -0
- package/dist/camera-CUJAMfpx.js +57 -0
- package/dist/candlestick.d.ts +8 -0
- package/dist/candlestick.js +42 -0
- package/dist/cartesian-k_WIYsGp.js +1139 -0
- package/dist/chart-runtime-resolver-DwwXp3X8.js +20 -0
- package/dist/chart-series-runtime-C0P7h8Tl.js +127 -0
- package/dist/charts.js +1 -0
- package/dist/composed.d.ts +2 -0
- package/dist/composed.js +4 -0
- package/dist/crosshair.d.ts +23 -0
- package/dist/crosshair.js +60 -0
- package/dist/donut.d.ts +5 -0
- package/dist/donut.js +7 -0
- package/dist/funnel.d.ts +5 -0
- package/dist/funnel.js +40 -0
- package/dist/graph.d.ts +6 -0
- package/dist/graph.js +260 -0
- package/dist/heatmap.d.ts +8 -0
- package/dist/heatmap.js +37 -0
- package/dist/host-DLDeDU5k.js +4373 -0
- package/dist/index.d.ts +1 -0
- package/dist/internal-I5BDhahD.js +4 -0
- package/dist/layout-donut-BG4ubBtU.js +39 -0
- package/dist/line.d.ts +9 -0
- package/dist/line.js +452 -0
- package/dist/mark-paint-CMHKGegE.js +14 -0
- package/dist/mark-style-Cpl-ARQM.js +10 -0
- package/dist/model/area/create-area-series-layout.d.ts +15 -0
- package/dist/model/area/hit-test-area-layout.d.ts +2 -0
- package/dist/model/axis/ChartAxisModel.d.ts +28 -0
- package/dist/model/bar/create-bar-series-layout.d.ts +19 -0
- package/dist/model/bar/hit-test-bar-layout.d.ts +2 -0
- package/dist/model/bubble/create-bubble-series-layout.d.ts +15 -0
- package/dist/model/bubble/hit-test-bubble-layout.d.ts +2 -0
- package/dist/model/cartesian/append-line-contours.d.ts +4 -0
- package/dist/model/cartesian/axis-line-batch.d.ts +3 -0
- package/dist/model/cartesian/numeric-window.d.ts +7 -0
- package/dist/model/cartesian/point-series.d.ts +54 -0
- package/dist/model/cartesian/sample-extrema.d.ts +7 -0
- package/dist/model/cartesian/smooth-y.d.ts +4 -0
- package/dist/model/cartesian/translation-window.d.ts +17 -0
- package/dist/model/context/nova-chart-runtime.d.ts +54 -0
- package/dist/model/customization/chart-customization.d.ts +47 -0
- package/dist/model/customization/chart-presets.d.ts +6 -0
- package/dist/model/customization/chart-style-sheet.d.ts +9 -0
- package/dist/model/data/ChartDataStore.d.ts +113 -0
- package/dist/model/exploration/create-graph-layout.d.ts +11 -0
- package/dist/model/exploration/exploration-chart.types.d.ts +150 -0
- package/dist/model/exploration/force-layout.d.ts +9 -0
- package/dist/model/exploration/presets/airplane.d.ts +2 -0
- package/dist/model/exploration/presets/apartment.d.ts +2 -0
- package/dist/model/exploration/presets/botanical-park.d.ts +2 -0
- package/dist/model/exploration/presets/ferry.d.ts +2 -0
- package/dist/model/exploration/presets/ice-arena.d.ts +2 -0
- package/dist/model/exploration/presets/planetarium.d.ts +2 -0
- package/dist/model/exploration/presets/science-museum.d.ts +2 -0
- package/dist/model/exploration/presets/train.d.ts +2 -0
- package/dist/model/exploration/route-geometry.d.ts +9 -0
- package/dist/model/exploration/seat-shape.d.ts +7 -0
- package/dist/model/interaction/GeometryIndex.d.ts +14 -0
- package/dist/model/line/create-line-series-layout.d.ts +15 -0
- package/dist/model/line/hit-test-line-layout.d.ts +2 -0
- package/dist/model/novel/create-novel-layout.d.ts +5 -0
- package/dist/model/novel/hit-test-novel-layout.d.ts +3 -0
- package/dist/model/novel/layout-candlestick.d.ts +3 -0
- package/dist/model/novel/layout-donut.d.ts +3 -0
- package/dist/model/novel/layout-funnel.d.ts +3 -0
- package/dist/model/novel/layout-heatmap.d.ts +3 -0
- package/dist/model/novel/layout-input.d.ts +12 -0
- package/dist/model/novel/layout-radar.d.ts +3 -0
- package/dist/model/novel/layout-tree.d.ts +3 -0
- package/dist/model/novel/layout-treemap.d.ts +3 -0
- package/dist/model/novel/layout-values.d.ts +10 -0
- package/dist/model/novel/novel-chart.types.d.ts +140 -0
- package/dist/model/novel/novel-domains.d.ts +5 -0
- package/dist/model/scale/BandScale.d.ts +86 -0
- package/dist/model/scale/ChartScaleRegistry.d.ts +45 -0
- package/dist/model/scale/LinearScale.d.ts +48 -0
- package/dist/model/scale/TimeScale.d.ts +48 -0
- package/dist/model/scale/create-chart-scale.d.ts +3 -0
- package/dist/model/scale/resolve-chart-scale.d.ts +5 -0
- package/dist/model/scatter/create-scatter-series-layout.d.ts +14 -0
- package/dist/model/scatter/hit-test-scatter-layout.d.ts +4 -0
- package/dist/model/time/calendar-time.d.ts +16 -0
- package/dist/model/types/chart-axis.types.d.ts +43 -0
- package/dist/model/types/chart-components.types.d.ts +1393 -0
- package/dist/model/types/chart-scale.types.d.ts +78 -0
- package/dist/model/viewport-controller/viewport-controller.d.ts +5 -0
- package/dist/novel-domains-DBpA_AOT.js +24 -0
- package/dist/partition-D-0LTCr3.js +221 -0
- package/dist/presets/route-map/apartment.d.ts +2 -0
- package/dist/presets/route-map/apartment.js +116 -0
- package/dist/presets/route-map/botanical-park.d.ts +2 -0
- package/dist/presets/route-map/botanical-park.js +116 -0
- package/dist/presets/route-map/science-museum.d.ts +2 -0
- package/dist/presets/route-map/science-museum.js +45 -0
- package/dist/presets/seat-map/airplane.d.ts +2 -0
- package/dist/presets/seat-map/airplane.js +95 -0
- package/dist/presets/seat-map/ferry.d.ts +2 -0
- package/dist/presets/seat-map/ferry.js +54 -0
- package/dist/presets/seat-map/ice-arena.d.ts +2 -0
- package/dist/presets/seat-map/ice-arena.js +67 -0
- package/dist/presets/seat-map/planetarium.d.ts +2 -0
- package/dist/presets/seat-map/planetarium.js +54 -0
- package/dist/presets/seat-map/train.d.ts +2 -0
- package/dist/presets/seat-map/train.js +66 -0
- package/dist/presets.d.ts +78 -0
- package/dist/presets.js +14 -0
- package/dist/public.d.ts +2 -0
- package/dist/radar.d.ts +5 -0
- package/dist/radar.js +47 -0
- package/dist/rose.d.ts +5 -0
- package/dist/rose.js +7 -0
- package/dist/route-map.d.ts +6 -0
- package/dist/route-map.js +200 -0
- package/dist/scatter.d.ts +8 -0
- package/dist/scatter.js +433 -0
- package/dist/scene-CPvPzTaB.js +137 -0
- package/dist/seat-map.d.ts +6 -0
- package/dist/seat-map.js +84 -0
- package/dist/seat-shape--kEFiUXX.js +66 -0
- package/dist/state-C5pICb11.js +134 -0
- package/dist/sync.d.ts +82 -0
- package/dist/sync.js +326 -0
- package/dist/translation-window-Ca_rCenJ.js +57 -0
- package/dist/tree.d.ts +6 -0
- package/dist/tree.js +114 -0
- package/dist/treemap.d.ts +5 -0
- package/dist/treemap.js +85 -0
- package/dist/ui/area-series/AreaSeries.d.ts +44 -0
- package/dist/ui/area-series/area-series.config.d.ts +10 -0
- package/dist/ui/area-series/area-series.registry.d.ts +4 -0
- package/dist/ui/axis/Axis.d.ts +55 -0
- package/dist/ui/axis/axis.config.d.ts +10 -0
- package/dist/ui/axis/axis.registry.d.ts +4 -0
- package/dist/ui/bar-chart/BarChart.d.ts +124 -0
- package/dist/ui/bar-chart/bar-chart.config.d.ts +10 -0
- package/dist/ui/bar-chart/bar-chart.registry.d.ts +2 -0
- package/dist/ui/bar-series/BarSeries.d.ts +102 -0
- package/dist/ui/bar-series/bar-series.config.d.ts +10 -0
- package/dist/ui/bar-series/bar-series.registry.d.ts +4 -0
- package/dist/ui/bubble-series/BubbleSeries.d.ts +33 -0
- package/dist/ui/bubble-series/bubble-series.config.d.ts +10 -0
- package/dist/ui/bubble-series/bubble-series.registry.d.ts +4 -0
- package/dist/ui/composed-chart/ComposedChart.d.ts +41 -0
- package/dist/ui/composed-chart/composed-chart.config.d.ts +10 -0
- package/dist/ui/composed-chart/composed-chart.registry.d.ts +4 -0
- package/dist/ui/exploration-chart/ExplorationChart.d.ts +83 -0
- package/dist/ui/exploration-chart/exploration-chart.config.d.ts +7 -0
- package/dist/ui/exploration-chart/exploration-chart.registry.d.ts +6 -0
- package/dist/ui/grid/Grid.d.ts +35 -0
- package/dist/ui/grid/grid.config.d.ts +10 -0
- package/dist/ui/grid/grid.registry.d.ts +4 -0
- package/dist/ui/interaction/Interaction.d.ts +53 -0
- package/dist/ui/interaction/interaction.config.d.ts +10 -0
- package/dist/ui/interaction/interaction.registry.d.ts +4 -0
- package/dist/ui/legend/Legend.d.ts +38 -0
- package/dist/ui/legend/legend.config.d.ts +10 -0
- package/dist/ui/legend/legend.registry.d.ts +2 -0
- package/dist/ui/line-series/LineSeries.d.ts +67 -0
- package/dist/ui/line-series/line-series.config.d.ts +10 -0
- package/dist/ui/line-series/line-series.registry.d.ts +4 -0
- package/dist/ui/mark-series/MarkSeries.d.ts +55 -0
- package/dist/ui/novel-series/NovelSeries.d.ts +34 -0
- package/dist/ui/novel-series/novel-series.config.d.ts +9 -0
- package/dist/ui/novel-series/novel-series.registry.d.ts +4 -0
- package/dist/ui/partition-chart/PartitionChart.d.ts +24 -0
- package/dist/ui/partition-chart/partition-chart.config.d.ts +7 -0
- package/dist/ui/partition-chart/partition-chart.registry.d.ts +9 -0
- package/dist/ui/plot/Plot.d.ts +64 -0
- package/dist/ui/plot/plot.config.d.ts +10 -0
- package/dist/ui/plot/plot.registry.d.ts +4 -0
- package/dist/ui/root/Root.d.ts +206 -0
- package/dist/ui/root/root.config.d.ts +10 -0
- package/dist/ui/root/root.registry.d.ts +5 -0
- package/dist/ui/scale/Scale.d.ts +55 -0
- package/dist/ui/scale/scale.config.d.ts +10 -0
- package/dist/ui/scale/scale.registry.d.ts +4 -0
- package/dist/ui/scatter-series/ScatterSeries.d.ts +33 -0
- package/dist/ui/scatter-series/scatter-series.config.d.ts +10 -0
- package/dist/ui/scatter-series/scatter-series.registry.d.ts +4 -0
- package/dist/ui/shared/chart-props.d.ts +150 -0
- package/dist/ui/shared/chart-runtime-resolver.d.ts +4 -0
- package/dist/ui/shared/chart-semantic-marks.d.ts +20 -0
- package/dist/ui/shared/chart-series-runtime.d.ts +48 -0
- package/dist/ui/shared/schema-types.d.ts +34 -0
- package/dist/ui/tooltip/Tooltip.d.ts +64 -0
- package/dist/ui/tooltip/tooltip.config.d.ts +10 -0
- package/dist/ui/tooltip/tooltip.registry.d.ts +4 -0
- package/dist/ui/viewport/Viewport.d.ts +81 -0
- package/dist/ui/viewport/viewport.config.d.ts +10 -0
- package/dist/ui/viewport/viewport.registry.d.ts +2 -0
- package/dist/ui/viewport-controller/ViewportController.d.ts +30 -0
- package/dist/ui/viewport-controller/viewport-controller.config.d.ts +10 -0
- package/dist/ui/viewport-controller/viewport-controller.registry.d.ts +2 -0
- package/package.json +179 -4
package/dist/sync.js
ADDED
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
var q = Object.defineProperty;
|
|
2
|
+
var z = (d, e, t) => e in d ? q(d, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[e] = t;
|
|
3
|
+
var S = (d, e, t) => z(d, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { NovaSyncScope as M } from "@nova-lab/core";
|
|
5
|
+
import { c as A } from "./internal-I5BDhahD.js";
|
|
6
|
+
import { r as $ } from "./state-C5pICb11.js";
|
|
7
|
+
const x = (d) => d === "drilldown" ? "navigation" : d;
|
|
8
|
+
let P = 0;
|
|
9
|
+
class I {
|
|
10
|
+
constructor(e = {}) {
|
|
11
|
+
S(this, "_scope");
|
|
12
|
+
S(this, "_members", /* @__PURE__ */ new Map());
|
|
13
|
+
S(this, "_links", /* @__PURE__ */ new Map());
|
|
14
|
+
S(this, "_paused", !1);
|
|
15
|
+
S(this, "_disposed", !1);
|
|
16
|
+
this._options = e, this._scope = new M({ scheduler: e.schedule ?? "frame", onError: e.onError });
|
|
17
|
+
try {
|
|
18
|
+
for (const [t, r] of Object.entries(e.participants ?? {}))
|
|
19
|
+
this.add(t, r);
|
|
20
|
+
for (const t of e.links ?? [])
|
|
21
|
+
this.link(t);
|
|
22
|
+
} catch (t) {
|
|
23
|
+
throw this.dispose(), t;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
static create(e = {}) {
|
|
27
|
+
return new I(e);
|
|
28
|
+
}
|
|
29
|
+
add(e, t) {
|
|
30
|
+
if (this._alive(), !e.trim() || this._members.has(e))
|
|
31
|
+
throw new Error(`[ChartSync] Duplicate or empty participant "${e}"`);
|
|
32
|
+
const r = A.get(t) ?? (D(t) ? t : void 0);
|
|
33
|
+
if (!r)
|
|
34
|
+
throw new Error("[ChartSync] Expected a live chart handle or NovaSyncParticipant");
|
|
35
|
+
const s = `chart-sync-member-${++P}`, o = [], c = { target: t, participant: r, endpoint: s, cleanup: o, unregister: this._scope.registerEndpoint(s, r.ports) };
|
|
36
|
+
o.push(() => c.unregister()), this._members.set(e, c);
|
|
37
|
+
try {
|
|
38
|
+
o.push(r.subscribe((a, n) => {
|
|
39
|
+
if (!(this._disposed || this._members.get(e) !== c))
|
|
40
|
+
if (a === "@ports") {
|
|
41
|
+
c.unregister(), c.unregister = this._scope.registerEndpoint(s, r.ports);
|
|
42
|
+
for (const h of [...this._links.values()])
|
|
43
|
+
this._ids(h).includes(e) && !r.ports[x(h.options.channel)] ? h.handle.dispose() : this._wire(h);
|
|
44
|
+
} else
|
|
45
|
+
this._scope.notify(`${s}.${a}`, r.ports[a].read(), n);
|
|
46
|
+
})), o.push(r.onDispose(() => this.remove(e)));
|
|
47
|
+
for (const a of this._links.values())
|
|
48
|
+
this._wire(a);
|
|
49
|
+
} catch (a) {
|
|
50
|
+
throw this.remove(e), a;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
remove(e) {
|
|
54
|
+
if (this._disposed)
|
|
55
|
+
return;
|
|
56
|
+
const t = this._members.get(e);
|
|
57
|
+
if (!t)
|
|
58
|
+
return;
|
|
59
|
+
this._members.delete(e);
|
|
60
|
+
const r = [];
|
|
61
|
+
for (const s of t.cleanup.reverse())
|
|
62
|
+
try {
|
|
63
|
+
s();
|
|
64
|
+
} catch (o) {
|
|
65
|
+
r.push(o);
|
|
66
|
+
}
|
|
67
|
+
for (const s of this._links.values()) {
|
|
68
|
+
s.baseline.delete(e);
|
|
69
|
+
try {
|
|
70
|
+
this._wire(s);
|
|
71
|
+
} catch (o) {
|
|
72
|
+
r.push(o);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (r.length)
|
|
76
|
+
throw new AggregateError(r, "[ChartSync] Participant cleanup failed");
|
|
77
|
+
}
|
|
78
|
+
link(e) {
|
|
79
|
+
var r;
|
|
80
|
+
if (this._alive(), !e.id.trim() || this._links.has(e.id))
|
|
81
|
+
throw new Error(`[ChartSync] Duplicate or empty link "${e.id}"`);
|
|
82
|
+
for (const s of e.participants ?? [])
|
|
83
|
+
if (!this._members.has(s))
|
|
84
|
+
throw new Error(`[ChartSync] Unknown participant "${s}"`);
|
|
85
|
+
if (e.direction === "leader" && !e.leader)
|
|
86
|
+
throw new Error("[ChartSync] Leader direction requires leader");
|
|
87
|
+
if (e.leader && !(e.participants ?? [...this._members.keys()]).includes(e.leader))
|
|
88
|
+
throw new Error("[ChartSync] Leader must belong to the link");
|
|
89
|
+
if (((r = e.selection) == null ? void 0 : r.match) === "business" && !e.selection.key)
|
|
90
|
+
throw new Error("[ChartSync] Business key matching requires key(item, participant)");
|
|
91
|
+
const t = { options: { ...e }, paused: !1, connections: [], baseline: /* @__PURE__ */ new Map(), handle: {
|
|
92
|
+
id: e.id,
|
|
93
|
+
getOptions: () => ({ ...t.options }),
|
|
94
|
+
isPaused: () => t.paused || this._paused,
|
|
95
|
+
pause: () => {
|
|
96
|
+
this._alive(), t.paused = !0, this._disconnect(t);
|
|
97
|
+
},
|
|
98
|
+
resume: () => {
|
|
99
|
+
this._alive(), t.paused = !1, this._wire(t);
|
|
100
|
+
},
|
|
101
|
+
resync: (s) => {
|
|
102
|
+
this._alive(), this._resync(t, s);
|
|
103
|
+
},
|
|
104
|
+
dispose: () => {
|
|
105
|
+
this._links.delete(e.id), t.baseline.clear(), this._disconnect(t);
|
|
106
|
+
}
|
|
107
|
+
} };
|
|
108
|
+
this._links.set(e.id, t);
|
|
109
|
+
try {
|
|
110
|
+
this._wire(t);
|
|
111
|
+
} catch (s) {
|
|
112
|
+
throw t.handle.dispose(), s;
|
|
113
|
+
}
|
|
114
|
+
return t.handle;
|
|
115
|
+
}
|
|
116
|
+
getLinks() {
|
|
117
|
+
return this._alive(), [...this._links.values()].map((e) => e.handle);
|
|
118
|
+
}
|
|
119
|
+
pause() {
|
|
120
|
+
this._alive(), this._paused = !0;
|
|
121
|
+
for (const e of this._links.values())
|
|
122
|
+
this._disconnect(e);
|
|
123
|
+
}
|
|
124
|
+
resume() {
|
|
125
|
+
this._alive(), this._paused = !1;
|
|
126
|
+
for (const e of this._links.values())
|
|
127
|
+
this._wire(e);
|
|
128
|
+
}
|
|
129
|
+
resync(e) {
|
|
130
|
+
if (this._alive(), e && !this._members.has(e))
|
|
131
|
+
throw new Error(`[ChartSync] Unknown participant "${e}"`);
|
|
132
|
+
for (const t of this._links.values())
|
|
133
|
+
(!e || this._ids(t).includes(e)) && this._resync(t, e);
|
|
134
|
+
}
|
|
135
|
+
dispose() {
|
|
136
|
+
if (this._disposed)
|
|
137
|
+
return;
|
|
138
|
+
const e = [];
|
|
139
|
+
for (const t of this._links.values())
|
|
140
|
+
try {
|
|
141
|
+
this._disconnect(t);
|
|
142
|
+
} catch (r) {
|
|
143
|
+
e.push(r);
|
|
144
|
+
}
|
|
145
|
+
this._links.clear();
|
|
146
|
+
for (const t of [...this._members.keys()])
|
|
147
|
+
try {
|
|
148
|
+
this.remove(t);
|
|
149
|
+
} catch (r) {
|
|
150
|
+
e.push(r);
|
|
151
|
+
}
|
|
152
|
+
try {
|
|
153
|
+
this._scope.dispose();
|
|
154
|
+
} catch (t) {
|
|
155
|
+
e.push(t);
|
|
156
|
+
}
|
|
157
|
+
if (this._disposed = !0, e.length)
|
|
158
|
+
throw new AggregateError(e, "[ChartSync] Disposal failed");
|
|
159
|
+
}
|
|
160
|
+
_ids(e) {
|
|
161
|
+
return e.options.participants ? [...e.options.participants].filter((t) => this._members.has(t)) : [...this._members.keys()];
|
|
162
|
+
}
|
|
163
|
+
_disconnect(e) {
|
|
164
|
+
const t = [];
|
|
165
|
+
for (const r of e.connections.splice(0))
|
|
166
|
+
try {
|
|
167
|
+
r.dispose();
|
|
168
|
+
} catch (s) {
|
|
169
|
+
t.push(s);
|
|
170
|
+
}
|
|
171
|
+
if (t.length)
|
|
172
|
+
throw new AggregateError(t, "[ChartSync] Connection cleanup failed");
|
|
173
|
+
}
|
|
174
|
+
_wire(e) {
|
|
175
|
+
var o, c;
|
|
176
|
+
this._disconnect(e);
|
|
177
|
+
const t = this._ids(e), r = x(e.options.channel);
|
|
178
|
+
for (const a of t) {
|
|
179
|
+
const h = this._members.get(a).participant.ports[r];
|
|
180
|
+
if (!h)
|
|
181
|
+
throw new Error(`[ChartSync] Participant "${a}" does not support "${e.options.channel}"`);
|
|
182
|
+
if (e.baseline.has(a) || e.baseline.set(a, h.read()), r === "selection" && ((o = h.meta) == null ? void 0 : o.kind) === "aggregation" && !((c = e.options.selection) != null && c.aggregates) && !e.options.map)
|
|
183
|
+
throw new Error("[ChartSync] Aggregate selection requires an explicit aggregates policy or mapper");
|
|
184
|
+
if (r === "filters" && !e.options.map && O(h.read()), r === "cursor" && !e.options.map) {
|
|
185
|
+
const y = t.map((u) => {
|
|
186
|
+
var m, w;
|
|
187
|
+
return ((w = (m = this._members.get(u).participant.ports.cursor) == null ? void 0 : m.meta) == null ? void 0 : w.format) ?? "ref";
|
|
188
|
+
});
|
|
189
|
+
if (y.some((u) => u !== y[0]))
|
|
190
|
+
throw new Error("[ChartSync] Cursor formats differ; attach Crosshair to both charts or provide a mapper");
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
if (this._paused || e.paused)
|
|
194
|
+
return;
|
|
195
|
+
const s = e.options.direction === "leader" ? t.filter((a) => a === e.options.leader) : t;
|
|
196
|
+
for (const a of s)
|
|
197
|
+
for (const n of t) {
|
|
198
|
+
if (a === n)
|
|
199
|
+
continue;
|
|
200
|
+
const h = this._members.get(a), y = this._members.get(n);
|
|
201
|
+
e.connections.push(this._scope.link({ from: `${h.endpoint}.${r}`, to: `${y.endpoint}.${r}`, schedule: this._options.schedule ?? "frame", transform: (u, m) => this._map(e, a, n, u, m) }));
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
_map(e, t, r, s, o) {
|
|
205
|
+
var h, y, u, m, w, g, E, v, f;
|
|
206
|
+
const c = this._members.get(t), a = this._members.get(r), n = e.options;
|
|
207
|
+
if (n.map)
|
|
208
|
+
return n.map(s, { from: t, to: r, source: c.target, target: a.target });
|
|
209
|
+
if (n.channel === "filters")
|
|
210
|
+
return O(s), s;
|
|
211
|
+
if (n.channel === "viewport")
|
|
212
|
+
return N(s, a.participant.ports.viewport.read(), e.baseline.get(t), e.baseline.get(r), t, r, n.viewport);
|
|
213
|
+
if (n.channel === "camera") {
|
|
214
|
+
const i = s, l = e.baseline.get(t), p = e.baseline.get(r);
|
|
215
|
+
return { center: ((h = n.camera) == null ? void 0 : h.mode) === "offset" || ((y = n.camera) == null ? void 0 : y.mode) === "relative" ? { x: p.center.x + i.center.x - l.center.x, y: p.center.y + i.center.y - l.center.y } : { ...i.center }, zoom: ((u = n.camera) == null ? void 0 : u.mode) === "relative" ? p.zoom * i.zoom / l.zoom : i.zoom };
|
|
216
|
+
}
|
|
217
|
+
if (n.channel === "playback") {
|
|
218
|
+
const i = s, l = a.participant.ports.playback.read();
|
|
219
|
+
return { ...l, status: i.status, rate: i.rate, loop: i.loop, position: ((m = n.playback) == null ? void 0 : m.mode) === "relative" ? l.duration * i.position / i.duration : i.position };
|
|
220
|
+
}
|
|
221
|
+
if (n.channel === "cursor" && ((g = (w = c.participant.ports.cursor) == null ? void 0 : w.meta) == null ? void 0 : g.format) === "values") {
|
|
222
|
+
if (s === null)
|
|
223
|
+
return null;
|
|
224
|
+
const i = s, l = ((E = n.viewport) == null ? void 0 : E.scales) ?? Object.fromEntries(Object.keys(i.values).map((C) => [C, { [t]: C, [r]: C }])), p = {};
|
|
225
|
+
for (const [C, _] of Object.entries(l)) {
|
|
226
|
+
const b = i.values[_[t]];
|
|
227
|
+
if (b === void 0 || !_[r])
|
|
228
|
+
throw new Error(`[ChartSync] Missing cursor scale mapping "${C}"`);
|
|
229
|
+
const k = typeof b == "number" && ((v = n.viewport) != null && v.toCanonical) ? n.viewport.toCanonical(b, t, C) : b;
|
|
230
|
+
p[_[r]] = typeof k == "number" && ((f = n.viewport) != null && f.fromCanonical) ? n.viewport.fromCanonical(k, r, C) : k;
|
|
231
|
+
}
|
|
232
|
+
return { values: p, item: i.item ? j([i.item], c.participant.ports.selection, a.participant.ports.selection, t, r, n.selection)[0] ?? null : null };
|
|
233
|
+
}
|
|
234
|
+
if (n.channel === "selection" || n.channel === "cursor") {
|
|
235
|
+
const i = n.channel === "cursor" ? s ? [s] : [] : s, l = c.participant.ports.selection, p = j(i, l, a.participant.ports.selection, t, r, n.selection);
|
|
236
|
+
return n.channel === "cursor" ? p[0] ?? null : p;
|
|
237
|
+
}
|
|
238
|
+
return s;
|
|
239
|
+
}
|
|
240
|
+
_resync(e, t) {
|
|
241
|
+
if (this._paused || e.paused)
|
|
242
|
+
return;
|
|
243
|
+
const r = t ?? e.options.leader ?? this._ids(e)[0];
|
|
244
|
+
if (!r || !this._ids(e).includes(r))
|
|
245
|
+
throw new Error("[ChartSync] resync requires a participating source");
|
|
246
|
+
if (e.options.direction === "leader" && r !== e.options.leader)
|
|
247
|
+
throw new Error("[ChartSync] Only the leader can resync this link");
|
|
248
|
+
const s = this._members.get(r);
|
|
249
|
+
this._scope.notify(`${s.endpoint}.${x(e.options.channel)}`);
|
|
250
|
+
}
|
|
251
|
+
_alive() {
|
|
252
|
+
if (this._disposed)
|
|
253
|
+
throw new Error("[ChartSync] Scope has been disposed");
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
function D(d) {
|
|
257
|
+
return "ports" in d && "subscribe" in d && "onDispose" in d;
|
|
258
|
+
}
|
|
259
|
+
function O(d) {
|
|
260
|
+
for (const e of Object.values(d))
|
|
261
|
+
if (e.type === "predicate" || "field" in e && typeof e.field == "function")
|
|
262
|
+
throw new Error("[ChartSync] Functional filters require an explicit mapper");
|
|
263
|
+
}
|
|
264
|
+
function j(d, e, t, r, s, o = {}) {
|
|
265
|
+
var m, w, g, E, v;
|
|
266
|
+
const c = (m = e.meta) == null ? void 0 : m.getItem, a = (w = t.meta) == null ? void 0 : w.getItem, n = (g = t.meta) == null ? void 0 : g.getItems, h = /* @__PURE__ */ new Map(), y = (f, i) => o.match === "business" ? o.key(f, i) : o.match === "value" ? f.value : o.match === "category" ? f.label : f.ref.key, u = o.match && o.match !== "key" ? (n == null ? void 0 : n()) ?? [] : [];
|
|
267
|
+
for (const f of d) {
|
|
268
|
+
if (f.type === "bucket") {
|
|
269
|
+
if (!o.aggregates)
|
|
270
|
+
throw new Error("[ChartSync] Aggregate selection requires an explicit policy");
|
|
271
|
+
if (o.aggregates === "reject")
|
|
272
|
+
continue;
|
|
273
|
+
if (o.aggregates === "members") {
|
|
274
|
+
const i = c == null ? void 0 : c(f);
|
|
275
|
+
for (const l of (i == null ? void 0 : i.members) ?? []) {
|
|
276
|
+
const p = { type: "datum", seriesId: ((E = o.series) == null ? void 0 : E[s]) ?? f.seriesId, key: l };
|
|
277
|
+
(!a || a(p)) && h.set($(p), p);
|
|
278
|
+
}
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
if (!o.match || o.match === "key") {
|
|
283
|
+
const i = "seriesId" in f ? { ...f, seriesId: ((v = o.series) == null ? void 0 : v[s]) ?? f.seriesId } : { ...f };
|
|
284
|
+
(!a || a(i)) && h.set($(i), i);
|
|
285
|
+
} else {
|
|
286
|
+
const i = c == null ? void 0 : c(f);
|
|
287
|
+
if (!i)
|
|
288
|
+
continue;
|
|
289
|
+
const l = y(i, r);
|
|
290
|
+
for (const p of u)
|
|
291
|
+
Object.is(y(p, s), l) && h.set($(p.ref), p.ref);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return [...h.values()];
|
|
295
|
+
}
|
|
296
|
+
function N(d, e, t, r, s, o, c = {}) {
|
|
297
|
+
const a = { ...e.ranges }, n = c.scales ?? Object.fromEntries(Object.keys(d.ranges).map((h) => [h, { [s]: h, [o]: h }]));
|
|
298
|
+
for (const [h, y] of Object.entries(n)) {
|
|
299
|
+
const u = y[s], m = y[o];
|
|
300
|
+
if (!u || !m || !d.ranges[u] || !e.ranges[m])
|
|
301
|
+
throw new Error(`[ChartSync] Missing scale mapping "${h}" for ${s} -> ${o}`);
|
|
302
|
+
const w = d.ranges[u];
|
|
303
|
+
if (typeof w[0] != "number") {
|
|
304
|
+
if (c.mode && c.mode !== "range")
|
|
305
|
+
throw new Error("[ChartSync] Band offset/relative synchronization requires an explicit mapper");
|
|
306
|
+
a[m] = [...w];
|
|
307
|
+
continue;
|
|
308
|
+
}
|
|
309
|
+
const g = (_, b) => _.map((k) => c.toCanonical ? c.toCanonical(Number(k), b, h) : Number(k)), E = g(w, s), v = g(t.ranges[u], s), f = g(r.ranges[m], o), i = g(e.ranges[m], o);
|
|
310
|
+
let l = E[0], p = E[1];
|
|
311
|
+
if (c.mode === "center") {
|
|
312
|
+
const _ = (l + p) / 2, b = i[1] - i[0];
|
|
313
|
+
l = _ - b / 2, p = _ + b / 2;
|
|
314
|
+
}
|
|
315
|
+
if (c.mode === "offset" || c.mode === "relative") {
|
|
316
|
+
const _ = (f[0] + f[1]) / 2 + (l + p - v[0] - v[1]) / 2, b = c.mode === "relative" ? (f[1] - f[0]) * (p - l) / Math.max(1e-12, v[1] - v[0]) : p - l;
|
|
317
|
+
l = _ - b / 2, p = _ + b / 2;
|
|
318
|
+
}
|
|
319
|
+
const C = [l, p].map((_) => c.fromCanonical ? c.fromCanonical(_, o, h) : _);
|
|
320
|
+
a[m] = [C[0], C[1]];
|
|
321
|
+
}
|
|
322
|
+
return { ...e, ranges: a };
|
|
323
|
+
}
|
|
324
|
+
export {
|
|
325
|
+
I as ChartSync
|
|
326
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
var p = Object.defineProperty;
|
|
2
|
+
var R = (s, e, t) => e in s ? p(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var D = (s, e, t) => R(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
function S(s, e, t) {
|
|
5
|
+
let a = null, n = "", o = "", r = 0, m = 1, f;
|
|
6
|
+
for (const c of e) {
|
|
7
|
+
const i = t(c), y = i.color ?? i.stroke ?? c.color, g = i.width ?? i.strokeWidth ?? 1, x = i.opacity ?? 1, l = a == null ? void 0 : a.points.at(-1), h = i.dashPattern;
|
|
8
|
+
(!a || n !== c.seriesKey || o !== y || r !== g || m !== x || h !== f || (l == null ? void 0 : l.x) !== c.x1 || (l == null ? void 0 : l.y) !== c.y1) && (a = { points: [{ x: c.x1, y: c.y1 }], closed: !1, styles: { stroke: y, lineWidth: g, opacity: x, dashPattern: h } }, s.push({ type: "polygon", ...a }), n = c.seriesKey, o = y, r = g, m = x, f = h), a.points.push({ x: c.x2, y: c.y2 });
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
class k {
|
|
12
|
+
constructor() {
|
|
13
|
+
D(this, "_snapshot", null);
|
|
14
|
+
}
|
|
15
|
+
clear() {
|
|
16
|
+
this._snapshot = null;
|
|
17
|
+
}
|
|
18
|
+
capture(e) {
|
|
19
|
+
if (e.xScale.type === "band") {
|
|
20
|
+
this.clear();
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const t = e.xScale.getDomain(), a = t[1] - t[0], n = e.xScale.getRange();
|
|
24
|
+
if (Number(e.xScale.toPx(t[0] - a)) !== n[0] - (n[1] - n[0])) {
|
|
25
|
+
this.clear();
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const o = (t[1] - t[0]) * e.overscanPx / Math.max(1, e.width);
|
|
29
|
+
this._snapshot = {
|
|
30
|
+
key: e.key,
|
|
31
|
+
xScale: e.xScale,
|
|
32
|
+
yScale: e.yScale,
|
|
33
|
+
xDomain: [...t],
|
|
34
|
+
xRange: [...e.xScale.getRange()],
|
|
35
|
+
yDomain: [...e.yScale.getDomain()],
|
|
36
|
+
yRange: [...e.yScale.getRange()],
|
|
37
|
+
coverage: [t[0] - o <= e.extent[0] ? -1 / 0 : t[0] - o, t[1] + o >= e.extent[1] ? 1 / 0 : t[1] + o]
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
offset(e, t, a) {
|
|
41
|
+
const n = this._snapshot;
|
|
42
|
+
if (!n || n.key !== e || n.xScale !== t || n.yScale !== a || t.type === "band")
|
|
43
|
+
return null;
|
|
44
|
+
const o = t.getDomain();
|
|
45
|
+
if (o[1] - o[0] !== n.xDomain[1] - n.xDomain[0] || o[0] < n.coverage[0] || o[1] > n.coverage[1] || !d(n.xRange, t.getRange()) || !d(n.yRange, a.getRange()) || !d(n.yDomain, a.getDomain()))
|
|
46
|
+
return null;
|
|
47
|
+
const r = Number(t.toPx(n.xDomain[0])) - n.xRange[0];
|
|
48
|
+
return Number.isFinite(r) ? r : null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function d(s, e) {
|
|
52
|
+
return s.length === e.length && s.every((t, a) => Object.is(t, e[a]));
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
k as T,
|
|
56
|
+
S as a
|
|
57
|
+
};
|
package/dist/tree.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const TreeChart: {
|
|
2
|
+
mount: <T>(target: string | HTMLElement, options: import('./public').PartitionOptions<T, import('./public').NodeRef>) => import('./public').TreeHandle<T>;
|
|
3
|
+
attach: <T>(target: import('./public').ChartAttachTarget, options: import('./public').PartitionOptions<T, import('./public').NodeRef>) => import('./public').TreeHandle<T>;
|
|
4
|
+
};
|
|
5
|
+
export type { TreeHandle as TreeChartHandle } from './api/types';
|
|
6
|
+
export type TreeChartOptions<T> = import('./api/types').PartitionOptions<T, import('./api/types').NodeRef>;
|
package/dist/tree.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { c as N } from "./partition-D-0LTCr3.js";
|
|
2
|
+
import { c as T } from "./MarkSeries-CQCAnV4s.js";
|
|
3
|
+
function O(i) {
|
|
4
|
+
const { props: o, dataStore: c, width: s, height: h } = i;
|
|
5
|
+
if (!o.categoryField || !o.parentField)
|
|
6
|
+
return [];
|
|
7
|
+
const n = /* @__PURE__ */ new Map();
|
|
8
|
+
c.getData().forEach((e, t) => {
|
|
9
|
+
var w;
|
|
10
|
+
const a = JSON.stringify([typeof c.getRowKey(e, t), c.getRowKey(e, t)]);
|
|
11
|
+
if (n.has(a))
|
|
12
|
+
return;
|
|
13
|
+
const r = c.readField(e, t, o.parentField), S = o.collapsedField ? c.readField(e, t, o.collapsedField) === !0 : !1;
|
|
14
|
+
n.set(a, {
|
|
15
|
+
row: e,
|
|
16
|
+
index: t,
|
|
17
|
+
parent: r == null ? void 0 : JSON.stringify([typeof r, r]),
|
|
18
|
+
children: [],
|
|
19
|
+
collapsed: ((w = i.collapsedOverrides) == null ? void 0 : w.get(a)) ?? S,
|
|
20
|
+
depth: 0,
|
|
21
|
+
y: 0
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
const p = /* @__PURE__ */ new Set();
|
|
25
|
+
for (const e of n.keys()) {
|
|
26
|
+
let t = e;
|
|
27
|
+
const a = /* @__PURE__ */ new Set();
|
|
28
|
+
for (; t && n.has(t) && !p.has(t); ) {
|
|
29
|
+
if (a.has(t)) {
|
|
30
|
+
n.get(t).parent = void 0;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
a.add(t), t = n.get(t).parent;
|
|
34
|
+
}
|
|
35
|
+
for (const r of a)
|
|
36
|
+
p.add(r);
|
|
37
|
+
}
|
|
38
|
+
for (const [e, t] of n)
|
|
39
|
+
!t.parent || !n.has(t.parent) ? t.parent = void 0 : n.get(t.parent).children.push(e);
|
|
40
|
+
const m = [...n].filter(([, e]) => !e.parent).map(([e]) => e);
|
|
41
|
+
let f = 1;
|
|
42
|
+
const g = [...m];
|
|
43
|
+
for (let e = 0; e < g.length; e++) {
|
|
44
|
+
const t = n.get(g[e]);
|
|
45
|
+
f = Math.max(f, t.depth);
|
|
46
|
+
for (const a of t.children)
|
|
47
|
+
n.get(a).depth = t.depth + 1, g.push(a);
|
|
48
|
+
}
|
|
49
|
+
let u = 0;
|
|
50
|
+
const M = /* @__PURE__ */ new Set(), y = [], l = [...m].reverse();
|
|
51
|
+
for (; l.length; ) {
|
|
52
|
+
const e = l.pop(), t = n.get(e);
|
|
53
|
+
M.add(e);
|
|
54
|
+
const a = t.collapsed ? [] : t.children;
|
|
55
|
+
if (a.length === 0)
|
|
56
|
+
t.y = u++;
|
|
57
|
+
else {
|
|
58
|
+
y.push(e);
|
|
59
|
+
for (let r = a.length - 1; r >= 0; r--)
|
|
60
|
+
l.push(a[r]);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
for (let e = y.length - 1; e >= 0; e--) {
|
|
64
|
+
const t = n.get(y[e]);
|
|
65
|
+
t.y = (n.get(t.children[0]).y + n.get(t.children.at(-1)).y) / 2;
|
|
66
|
+
}
|
|
67
|
+
const d = Math.max(110, s * 0.08), v = Math.max(240, s * 0.2), F = Math.max(28, Math.min(72, h * 0.035)), x = 6, C = Math.max(9, Math.min(14, (h - F * 2) / Math.max(1, u - 1) * 0.8));
|
|
68
|
+
return [...n].flatMap(([e, t]) => {
|
|
69
|
+
if (!M.has(e))
|
|
70
|
+
return [];
|
|
71
|
+
const a = d + t.depth / f * Math.max(0, s - d - v), r = F + t.y / Math.max(1, u - 1) * Math.max(0, h - F * 2), S = String(c.readField(t.row, t.index, o.categoryField) ?? e), w = o.valueField ? Number(c.readField(t.row, t.index, o.valueField)) : 0, b = t.children.length > 0, K = b ? Math.min(200, a - 18) : Math.min(250, s - a - 20);
|
|
72
|
+
return [{
|
|
73
|
+
kind: "tree",
|
|
74
|
+
key: e,
|
|
75
|
+
row: t.row,
|
|
76
|
+
label: S,
|
|
77
|
+
value: Number.isFinite(w) ? w : 0,
|
|
78
|
+
color: T(o.palette, 0),
|
|
79
|
+
x: a - x,
|
|
80
|
+
y: r - x,
|
|
81
|
+
width: x * 2,
|
|
82
|
+
height: x * 2,
|
|
83
|
+
parentKey: t.parent,
|
|
84
|
+
depth: t.depth,
|
|
85
|
+
hasChildren: b,
|
|
86
|
+
collapsed: b && t.collapsed,
|
|
87
|
+
fontSize: C,
|
|
88
|
+
labelBounds: {
|
|
89
|
+
x: b ? a - x - 8 - K : a + x + 8,
|
|
90
|
+
y: r - 11,
|
|
91
|
+
width: K,
|
|
92
|
+
height: 22
|
|
93
|
+
}
|
|
94
|
+
}];
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
const k = N({ kind: "tree", layout: O, labels: !0, mark: (i, o) => [{ type: "circle", x: i.x + i.width / 2, y: i.y + i.height / 2, radius: i.width / 2, styles: { background: i.collapsed ? o : "#ffffff", border: { color: o, width: 2 } } }], decoration(i) {
|
|
98
|
+
const o = [], c = new Map(i.map((s) => [s.key, s]));
|
|
99
|
+
for (const s of i) {
|
|
100
|
+
const h = s.parentKey ? c.get(s.parentKey) : void 0;
|
|
101
|
+
if (!h)
|
|
102
|
+
continue;
|
|
103
|
+
const n = h.x + h.width / 2, p = h.y + h.height / 2, m = s.x + s.width / 2, f = s.y + s.height / 2, g = (n + m) / 2, u = [{ x: n, y: p }], M = Math.max(18, Math.min(36, Math.ceil(Math.abs(f - p) / 14)));
|
|
104
|
+
for (let y = 1; y <= M; y++) {
|
|
105
|
+
const l = y / M, d = 1 - l, v = { x: d ** 3 * n + 3 * d ** 2 * l * g + 3 * d * l ** 2 * g + l ** 3 * m, y: d ** 3 * p + 3 * d ** 2 * l * p + 3 * d * l ** 2 * f + l ** 3 * f };
|
|
106
|
+
u.push(v);
|
|
107
|
+
}
|
|
108
|
+
o.push({ type: "polygon", points: u, closed: !1, styles: { stroke: "#c8cdd5", lineWidth: 1.5 } });
|
|
109
|
+
}
|
|
110
|
+
return o;
|
|
111
|
+
} }), P = { mount: k.mountTree, attach: k.attachTree };
|
|
112
|
+
export {
|
|
113
|
+
P as TreeChart
|
|
114
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const TreemapChart: {
|
|
2
|
+
mount: <T>(target: string | HTMLElement, options: import('./public').PartitionOptions<T>) => import('./public').TreemapHandle<T>;
|
|
3
|
+
attach: <T>(target: import('./public').ChartAttachTarget, options: import('./public').PartitionOptions<T>) => import('./public').TreemapHandle<T>;
|
|
4
|
+
};
|
|
5
|
+
export type { TreemapHandle as TreemapChartHandle, PartitionOptions as TreemapChartOptions } from './api/types';
|
package/dist/treemap.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { r as S } from "./mark-paint-CMHKGegE.js";
|
|
2
|
+
import { c as N } from "./partition-D-0LTCr3.js";
|
|
3
|
+
import { p as R, c as C } from "./MarkSeries-CQCAnV4s.js";
|
|
4
|
+
function O(w) {
|
|
5
|
+
var M;
|
|
6
|
+
const { props: c, dataStore: h, width: K, height: T } = w;
|
|
7
|
+
if (!c.categoryField || !c.valueField)
|
|
8
|
+
return [];
|
|
9
|
+
const m = (c.parentField ? h.getData().flatMap((i, n) => {
|
|
10
|
+
const r = Number(h.readField(i, n, c.valueField));
|
|
11
|
+
return Number.isFinite(r) && r >= 0 ? [{ row: i, index: n, value: r, label: String(h.readField(i, n, c.categoryField) ?? "") }] : [];
|
|
12
|
+
}) : R(w)).sort((i, n) => n.value - i.value), p = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map();
|
|
13
|
+
let g = m;
|
|
14
|
+
if (c.parentField) {
|
|
15
|
+
const i = new Map(m.map((e) => [h.getRowKey(e.row, e.index), e]));
|
|
16
|
+
g = [];
|
|
17
|
+
for (const e of m) {
|
|
18
|
+
const t = h.readField(e.row, e.index, c.parentField), a = i.get(t);
|
|
19
|
+
if (!a || a === e) {
|
|
20
|
+
g.push(e);
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
x.set(e, a);
|
|
24
|
+
let l = p.get(a);
|
|
25
|
+
l || (l = [], p.set(a, l)), l.push(e);
|
|
26
|
+
}
|
|
27
|
+
const n = new Map(m.map((e) => {
|
|
28
|
+
var t;
|
|
29
|
+
return [e, ((t = p.get(e)) == null ? void 0 : t.length) ?? 0];
|
|
30
|
+
})), r = m.filter((e) => n.get(e) === 0);
|
|
31
|
+
for (const e of m)
|
|
32
|
+
p.has(e) && (e.value = 0);
|
|
33
|
+
for (let e = 0; e < r.length; e++) {
|
|
34
|
+
const t = r[e], a = x.get(t);
|
|
35
|
+
a && (a.value += t.value, n.set(a, n.get(a) - 1), n.get(a) || r.push(a));
|
|
36
|
+
}
|
|
37
|
+
g = g.filter((e) => e.value > 0).sort((e, t) => t.value - e.value);
|
|
38
|
+
for (const [e, t] of p)
|
|
39
|
+
p.set(e, t.filter((a) => a.value > 0).sort((a, l) => l.value - a.value));
|
|
40
|
+
}
|
|
41
|
+
const d = [], f = [{ items: g, x: 0, y: 0, w: K, h: T }];
|
|
42
|
+
for (; f.length; ) {
|
|
43
|
+
const { items: i, x: n, y: r, w: e, h: t } = f.pop();
|
|
44
|
+
if (i.length === 0 || e <= 0 || t <= 0)
|
|
45
|
+
continue;
|
|
46
|
+
if (i.length === 1) {
|
|
47
|
+
const o = i[0], s = Math.min(c.gap, e / 4, t / 4);
|
|
48
|
+
d.push({
|
|
49
|
+
kind: "treemap",
|
|
50
|
+
key: String(h.getRowKey(o.row, o.index)),
|
|
51
|
+
row: o.row,
|
|
52
|
+
label: o.label,
|
|
53
|
+
value: o.value,
|
|
54
|
+
color: C(c.palette, o.index),
|
|
55
|
+
x: n + s,
|
|
56
|
+
y: r + s,
|
|
57
|
+
width: Math.max(0, e - s * 2),
|
|
58
|
+
height: Math.max(0, t - s * 2)
|
|
59
|
+
});
|
|
60
|
+
const b = h.getRowKey(o.row, o.index), y = p.get(o);
|
|
61
|
+
if (y != null && y.length && !((M = w.collapsedOverrides) != null && M.get(JSON.stringify([typeof b, b])))) {
|
|
62
|
+
const v = Math.min(18, t / 5);
|
|
63
|
+
f.push({ items: y, x: n + s * 2, y: r + s * 2 + v, w: Math.max(0, e - s * 4), h: Math.max(0, t - s * 4 - v) }), d[d.length - 1].labelBounds = { x: n + s * 2, y: r + s, width: e - s * 4, height: v };
|
|
64
|
+
}
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
const a = i.reduce((o, s) => o + s.value, 0);
|
|
68
|
+
let l = 0, u = 0;
|
|
69
|
+
for (; u < i.length - 1 && l < a / 2; )
|
|
70
|
+
l += i[u].value, u += 1;
|
|
71
|
+
const F = l / a;
|
|
72
|
+
if (e >= t) {
|
|
73
|
+
const o = e * F;
|
|
74
|
+
f.push({ items: i.slice(u), x: n + o, y: r, w: e - o, h: t }, { items: i.slice(0, u), x: n, y: r, w: o, h: t });
|
|
75
|
+
} else {
|
|
76
|
+
const o = t * F;
|
|
77
|
+
f.push({ items: i.slice(u), x: n, y: r + o, w: e, h: t - o }, { items: i.slice(0, u), x: n, y: r, w: e, h: o });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return d;
|
|
81
|
+
}
|
|
82
|
+
const k = N({ kind: "treemap", layout: O, mark: S, labels: !0 }), B = { mount: k.mountTreemap, attach: k.attachTreemap };
|
|
83
|
+
export {
|
|
84
|
+
B as TreemapChart
|
|
85
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { EventList } from '@endge/utils';
|
|
2
|
+
import { NovaApp, NovaSurface } from '@nova-lab/core';
|
|
3
|
+
import { NovaChartAreaSeriesApi, NovaChartAreaSeriesProps, NovaChartAreaSeriesResolvedProps, NovaChartPointSeriesVirtualizationOptions } from '../../model/types/chart-components.types';
|
|
4
|
+
import { ChartAreaSeriesDescriptor } from './area-series.config';
|
|
5
|
+
import { NovaUiComponentNode } from '@nova-lab/ui-kit';
|
|
6
|
+
/**
|
|
7
|
+
* AreaSeries рендерит polygon fill и outline на shared cartesian scales.
|
|
8
|
+
*/
|
|
9
|
+
export declare class ChartAreaSeries<TData = Record<string, unknown>, E extends EventList = Record<string, any>> extends NovaUiComponentNode<NovaChartAreaSeriesResolvedProps<TData>, NovaChartAreaSeriesApi<TData>, NovaChartAreaSeriesProps<TData>, E> {
|
|
10
|
+
private _layoutPlan;
|
|
11
|
+
private readonly _api;
|
|
12
|
+
private readonly _runtimeBinding;
|
|
13
|
+
private _layoutEpoch;
|
|
14
|
+
private _computedEpoch;
|
|
15
|
+
private readonly _translationWindow;
|
|
16
|
+
private readonly _translationMatrix;
|
|
17
|
+
private _translationX;
|
|
18
|
+
private _projectedPlan;
|
|
19
|
+
private _schema;
|
|
20
|
+
constructor(app: NovaApp<E>, surface: NovaSurface<E>, props: NovaChartAreaSeriesResolvedProps<TData>, options?: {
|
|
21
|
+
componentId?: string;
|
|
22
|
+
}, descriptor?: ChartAreaSeriesDescriptor<TData>);
|
|
23
|
+
setProps(patch: Partial<NovaChartAreaSeriesResolvedProps<TData>>): this;
|
|
24
|
+
getApi(): NovaChartAreaSeriesApi<TData>;
|
|
25
|
+
update(): void;
|
|
26
|
+
render(): void;
|
|
27
|
+
setVirtualization(options: NovaChartPointSeriesVirtualizationOptions): void;
|
|
28
|
+
protected onMount(): void;
|
|
29
|
+
protected onUnmount(): void;
|
|
30
|
+
protected onPropsChanged(changedKeys: Array<keyof NovaChartAreaSeriesResolvedProps<TData>>): void;
|
|
31
|
+
private _canRetainSchema;
|
|
32
|
+
private _readLayoutPlan;
|
|
33
|
+
private _hitTestSeries;
|
|
34
|
+
private _refresh;
|
|
35
|
+
private _computeLayout;
|
|
36
|
+
private _resolveAreaFill;
|
|
37
|
+
private _publishSchemaDiagnostics;
|
|
38
|
+
private _createAreaStyleContext;
|
|
39
|
+
private _createOutlineStyleContext;
|
|
40
|
+
private _createMarkerStyleContext;
|
|
41
|
+
private _resolveAreaStyle;
|
|
42
|
+
private _resolveOutlineStyle;
|
|
43
|
+
private _resolveMarkerStyle;
|
|
44
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EventList } from '@endge/utils';
|
|
2
|
+
import { NovaComponentCreateContext, NovaComponentDescriptor, NovaComponentNode, NovaComponentSchema } from '@nova-lab/core';
|
|
3
|
+
import { NovaChartAreaSeriesApi, NovaChartAreaSeriesProps, NovaChartAreaSeriesResolvedProps } from '../../model/types/chart-components.types';
|
|
4
|
+
import { normalizeChartAreaSeriesProps } from '../shared/chart-props';
|
|
5
|
+
export type ChartAreaSeriesDescriptor<TData = Record<string, unknown>> = NovaComponentDescriptor<NovaChartAreaSeriesResolvedProps<TData>, NovaChartAreaSeriesApi<TData>, Record<string, never>, NovaChartAreaSeriesProps<TData>>;
|
|
6
|
+
export type ChartAreaSeriesNodeFactory = <E extends EventList>(context: NovaComponentCreateContext<E>, schema: NovaComponentSchema<NovaChartAreaSeriesProps>) => NovaComponentNode<any, any, any, any, E>;
|
|
7
|
+
export declare const CHART_AREA_SERIES_SCHEMA_TYPE = "NovaCharts.AreaSeries";
|
|
8
|
+
export declare function createChartAreaSeriesDescriptor(createNode?: ChartAreaSeriesNodeFactory): ChartAreaSeriesDescriptor;
|
|
9
|
+
export declare const CHART_AREA_SERIES_NODE_DESCRIPTOR: ChartAreaSeriesDescriptor<Record<string, unknown>>;
|
|
10
|
+
export { normalizeChartAreaSeriesProps };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { NovaSchemaRegistry } from '@nova-lab/core';
|
|
2
|
+
import { ChartAreaSeriesDescriptor } from './area-series.config';
|
|
3
|
+
export declare const CHART_AREA_SERIES_DESCRIPTOR: ChartAreaSeriesDescriptor;
|
|
4
|
+
export declare function registerChartAreaSeries(registry: NovaSchemaRegistry): void;
|