@cpsoft13/z-agent-ui 0.2.1 → 0.3.0

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 (165) hide show
  1. package/bin/lines-baseline.json +1 -15
  2. package/bin/text-baseline.json +1 -2
  3. package/dist/build-info.json +2 -2
  4. package/dist/components/context-menu/ContextMenu.js +7 -7
  5. package/dist/components/context-menu/ContextMenu.js.map +1 -1
  6. package/dist/components/date-range/DateRange.js +4 -4
  7. package/dist/components/date-range/DateRange.js.map +1 -1
  8. package/dist/components/datepicker/Datepicker.js +207 -332
  9. package/dist/components/datepicker/Datepicker.js.map +1 -1
  10. package/dist/components/datepicker/datepicker-keyboard.js +66 -0
  11. package/dist/components/datepicker/datepicker-keyboard.js.map +1 -0
  12. package/dist/components/datepicker/datepicker-panel-render.js +78 -0
  13. package/dist/components/datepicker/datepicker-panel-render.js.map +1 -0
  14. package/dist/components/form/Form.js +69 -47
  15. package/dist/components/form/Form.js.map +1 -1
  16. package/dist/components/form/form-context.js +9 -0
  17. package/dist/components/form/form-context.js.map +1 -0
  18. package/dist/components/form.js +2 -0
  19. package/dist/components/form.js.map +1 -1
  20. package/dist/components/menu/Menu.js +27 -27
  21. package/dist/components/menu/Menu.js.map +1 -1
  22. package/dist/components/popover/Popover.js +1 -1
  23. package/dist/components/popover/Popover.js.map +1 -1
  24. package/dist/components/select/Select.js +235 -351
  25. package/dist/components/select/Select.js.map +1 -1
  26. package/dist/components/select/option-search.js +49 -0
  27. package/dist/components/select/option-search.js.map +1 -0
  28. package/dist/components/select/select-render.js +75 -0
  29. package/dist/components/select/select-render.js.map +1 -0
  30. package/dist/components/select/selection-strategy.js +151 -0
  31. package/dist/components/select/selection-strategy.js.map +1 -0
  32. package/dist/components/time-picker/TimePicker.js +1 -1
  33. package/dist/components/time-picker/TimePicker.js.map +1 -1
  34. package/dist/components/tooltip/Tooltip.js +16 -16
  35. package/dist/components/tooltip/Tooltip.js.map +1 -1
  36. package/dist/core/BaseElement.js +96 -77
  37. package/dist/core/BaseElement.js.map +1 -1
  38. package/dist/core/context.js +68 -0
  39. package/dist/core/context.js.map +1 -0
  40. package/dist/core/controller.js +2 -0
  41. package/dist/core/controller.js.map +1 -0
  42. package/dist/core/public.js +35 -30
  43. package/dist/core/public.js.map +1 -1
  44. package/dist/core.js +95 -90
  45. package/dist/core.js.map +1 -1
  46. package/dist/doc/doc-template-editor-core.js +12 -11
  47. package/dist/doc/doc-template-editor-core.js.map +1 -1
  48. package/dist/doc/doc-template-editor-panel.css.js +202 -0
  49. package/dist/doc/doc-template-editor-panel.css.js.map +1 -0
  50. package/dist/doc/doc-template-editor.css.js +1 -200
  51. package/dist/doc/doc-template-editor.css.js.map +1 -1
  52. package/dist/flow/Flow.js +104 -195
  53. package/dist/flow/Flow.js.map +1 -1
  54. package/dist/flow/flow-keyboard-controller.js +101 -0
  55. package/dist/flow/flow-keyboard-controller.js.map +1 -0
  56. package/dist/primitives/overlay/floatingPanel.js +6 -2
  57. package/dist/primitives/overlay/floatingPanel.js.map +1 -1
  58. package/dist/report/chart/Chart.js +271 -761
  59. package/dist/report/chart/Chart.js.map +1 -1
  60. package/dist/report/chart/chart-brush-controller.js +187 -0
  61. package/dist/report/chart/chart-brush-controller.js.map +1 -0
  62. package/dist/report/chart/chart-layout-pipeline.js +158 -0
  63. package/dist/report/chart/chart-layout-pipeline.js.map +1 -0
  64. package/dist/report/chart/chart-zoom.js +79 -0
  65. package/dist/report/chart/chart-zoom.js.map +1 -0
  66. package/dist/report/chart/geometry/build.js +41 -26
  67. package/dist/report/chart/geometry/build.js.map +1 -1
  68. package/dist/report/chart/geometry/extra-flow-dist.js +283 -0
  69. package/dist/report/chart/geometry/extra-flow-dist.js.map +1 -0
  70. package/dist/report/chart/geometry/extra-radial-grid.js +280 -0
  71. package/dist/report/chart/geometry/extra-radial-grid.js.map +1 -0
  72. package/dist/report/chart/geometry/extra-shared.js +36 -0
  73. package/dist/report/chart/geometry/extra-shared.js.map +1 -0
  74. package/dist/report/chart/geometry/extra.js +20 -583
  75. package/dist/report/chart/geometry/extra.js.map +1 -1
  76. package/dist/report/chart/geometry/registry.js +20 -0
  77. package/dist/report/chart/geometry/registry.js.map +1 -0
  78. package/dist/report/chart.js +12 -6
  79. package/dist/report/chart.js.map +1 -1
  80. package/dist/report/gantt/Gantt.js +199 -308
  81. package/dist/report/gantt/Gantt.js.map +1 -1
  82. package/dist/report/gantt/gantt-bars.css.js +247 -0
  83. package/dist/report/gantt/gantt-bars.css.js.map +1 -0
  84. package/dist/report/gantt/gantt-edit-controller.js +94 -0
  85. package/dist/report/gantt/gantt-edit-controller.js.map +1 -0
  86. package/dist/report/gantt/gantt.css.js +0 -272
  87. package/dist/report/gantt/gantt.css.js.map +1 -1
  88. package/dist/report/table/ReportTable.js +336 -493
  89. package/dist/report/table/ReportTable.js.map +1 -1
  90. package/dist/report/table/report-table-config.css.js +172 -0
  91. package/dist/report/table/report-table-config.css.js.map +1 -0
  92. package/dist/report/table/report-table-types.js.map +1 -1
  93. package/dist/report/table/report-table.css.js +0 -176
  94. package/dist/report/table/report-table.css.js.map +1 -1
  95. package/dist/report/table/table-cell-registry.js +29 -0
  96. package/dist/report/table/table-cell-registry.js.map +1 -0
  97. package/dist/report/table/table-keyboard-controller.js +96 -0
  98. package/dist/report/table/table-keyboard-controller.js.map +1 -0
  99. package/dist/report/table/table-pipeline.js +36 -0
  100. package/dist/report/table/table-pipeline.js.map +1 -0
  101. package/dist/report/table/table-render.js +97 -96
  102. package/dist/report/table/table-render.js.map +1 -1
  103. package/dist/report/table/table-scroll-controller.js +33 -0
  104. package/dist/report/table/table-scroll-controller.js.map +1 -0
  105. package/dist/report/table.js +7 -2
  106. package/dist/report/table.js.map +1 -1
  107. package/dist/report.js +39 -28
  108. package/dist/report.js.map +1 -1
  109. package/dist/types/components/datepicker/Datepicker.d.ts +1 -109
  110. package/dist/types/components/datepicker/datepicker-keyboard.d.ts +21 -0
  111. package/dist/types/components/datepicker/datepicker-panel-render.d.ts +25 -0
  112. package/dist/types/components/form/Form.d.ts +7 -2
  113. package/dist/types/components/form/form-context.d.ts +11 -0
  114. package/dist/types/components/form/index.d.ts +1 -1
  115. package/dist/types/components/select/Select.d.ts +7 -110
  116. package/dist/types/components/select/option-search.d.ts +38 -0
  117. package/dist/types/components/select/select-render.d.ts +39 -0
  118. package/dist/types/components/select/selection-strategy.d.ts +86 -0
  119. package/dist/types/core/BaseElement.d.ts +7 -1
  120. package/dist/types/core/context.d.ts +66 -0
  121. package/dist/types/core/controller.d.ts +22 -0
  122. package/dist/types/core/public.d.ts +2 -0
  123. package/dist/types/flow/Flow.d.ts +3 -76
  124. package/dist/types/flow/flow-keyboard-controller.d.ts +35 -0
  125. package/dist/types/primitives/overlay/floatingPanel.d.ts +2 -0
  126. package/dist/types/report/chart/Chart.d.ts +2 -245
  127. package/dist/types/report/chart/chart-brush-controller.d.ts +59 -0
  128. package/dist/types/report/chart/chart-layout-pipeline.d.ts +42 -0
  129. package/dist/types/report/chart/chart-zoom.d.ts +12 -0
  130. package/dist/types/report/chart/geometry/build.d.ts +2 -0
  131. package/dist/types/report/chart/geometry/extra-flow-dist.d.ts +6 -0
  132. package/dist/types/report/chart/geometry/extra-radial-grid.d.ts +6 -0
  133. package/dist/types/report/chart/geometry/extra-shared.d.ts +24 -0
  134. package/dist/types/report/chart/geometry/extra.d.ts +2 -34
  135. package/dist/types/report/chart/geometry/registry.d.ts +26 -0
  136. package/dist/types/report/chart/index.d.ts +1 -0
  137. package/dist/types/report/gantt/Gantt.d.ts +7 -97
  138. package/dist/types/report/gantt/gantt-edit-controller.d.ts +34 -0
  139. package/dist/types/report/table/ReportTable.d.ts +9 -180
  140. package/dist/types/report/table/index.d.ts +1 -0
  141. package/dist/types/report/table/report-table-types.d.ts +2 -0
  142. package/dist/types/report/table/table-cell-registry.d.ts +17 -0
  143. package/dist/types/report/table/table-keyboard-controller.d.ts +30 -0
  144. package/dist/types/report/table/table-pipeline.d.ts +33 -0
  145. package/dist/types/report/table/table-scroll-controller.d.ts +25 -0
  146. package/dist/z-agent-ui.js +35 -30
  147. package/dist/z-agent-ui.js.map +1 -1
  148. package/package.json +1 -1
  149. package/registry/component-manifest.json +39 -7
  150. package/src/components/context-menu/ContextMenu.ts +1 -1
  151. package/src/components/date-range/DateRange.ts +1 -1
  152. package/src/components/datepicker/Datepicker.ts +99 -417
  153. package/src/components/datepicker/datepicker-keyboard.ts +94 -0
  154. package/src/components/datepicker/datepicker-panel-render.ts +169 -0
  155. package/src/components/form/Form.ts +39 -11
  156. package/src/components/form/form-context.ts +11 -0
  157. package/src/components/form/index.ts +1 -1
  158. package/src/components/menu/Menu.ts +1 -1
  159. package/src/components/popover/Popover.ts +1 -1
  160. package/src/components/select/Select.ts +140 -525
  161. package/src/components/select/option-search.ts +114 -0
  162. package/src/components/select/select-render.ts +161 -0
  163. package/src/components/select/selection-strategy.ts +245 -0
  164. package/src/components/time-picker/TimePicker.ts +1 -1
  165. package/src/components/tooltip/Tooltip.ts +1 -1
@@ -0,0 +1,283 @@
1
+ import { estimateTextWidth as R } from "../layout/layout.js";
2
+ import { makeFormatter as j } from "../format/format.js";
3
+ import { emptyModel as B, colorOf as K, fitLabel as U } from "./extra-shared.js";
4
+ function Z(d, n, m) {
5
+ if (d.length === 0) return;
6
+ if (d.length === 1) {
7
+ m.push({ ...n, index: d[0].index });
8
+ return;
9
+ }
10
+ const h = d.reduce((r, k) => r + k.value, 0) || 1;
11
+ let w = 0, y = 0;
12
+ for (; y < d.length - 1 && !(w + d[y].value >= h / 2); y++)
13
+ w += d[y].value;
14
+ const o = Math.min(Math.max(y + 1, 1), d.length - 1), c = d.slice(0, o), M = d.slice(o), S = c.reduce((r, k) => r + k.value, 0) || 1, l = Math.max(Math.min(S / h, 0.95), 0.05);
15
+ n.w >= n.h ? (Z(c, { ...n, w: n.w * l }, m), Z(M, { x: n.x + n.w * l, y: n.y, w: n.w * (1 - l), h: n.h }, m)) : (Z(c, { ...n, h: n.h * l }, m), Z(M, { x: n.x, y: n.y + n.h * l, w: n.w, h: n.h * (1 - l) }, m));
16
+ }
17
+ function nt(d, n, m, h, w, y) {
18
+ const o = d.find((a) => a.visible) ?? d[0], c = ((o == null ? void 0 : o.data) ?? []).map((a, e) => ({ index: e, value: a.value, label: a.label })).filter((a) => Number.isFinite(a.value) && a.value > 0);
19
+ if (c.length === 0) return B();
20
+ const M = j((o == null ? void 0 : o.format) ?? "auto", w.locale), S = parseFloat(m.labelFontSize) || 12, l = [];
21
+ Z(
22
+ [...c].sort((a, e) => e.value - a.value),
23
+ { x: n.plot.x, y: n.plot.y, w: n.plot.width, h: n.plot.height },
24
+ l
25
+ );
26
+ const r = [], k = [], F = c.reduce((a, e) => a + e.value, 0) || 1;
27
+ for (const a of l) {
28
+ const e = c.find((T) => T.index === a.index), g = a.x + 1.5, v = a.y + 1.5, x = Math.max(a.w - 3, 0), L = Math.max(a.h - 3, 0);
29
+ if (x < 2 || L < 2) continue;
30
+ const A = K(w, e.index, o.color);
31
+ if (r.push({
32
+ kind: "rect",
33
+ seriesIndex: o.index,
34
+ dataIndex: e.index,
35
+ x: g,
36
+ y: v,
37
+ width: x,
38
+ height: L,
39
+ color: A,
40
+ visible: !0
41
+ }), x >= 34 && L >= 20) {
42
+ const T = Math.min(S, 12), O = U(String(e.label ?? ""), x - 10, T);
43
+ if (O && r.push({
44
+ kind: "text",
45
+ seriesIndex: o.index,
46
+ dataIndex: e.index,
47
+ cx: g + 5,
48
+ cy: v + S + 3,
49
+ color: "#ffffff",
50
+ label: O,
51
+ textAnchor: "start",
52
+ fontSize: T,
53
+ opacity: h,
54
+ visible: !0
55
+ }), L >= 34) {
56
+ const D = `${M(e.value)} (${(e.value / F * 100).toFixed(0)}%)`, N = R(D, 10) <= x - 10 ? D : R(M(e.value), 10) <= x - 10 ? M(e.value) : "";
57
+ N && r.push({
58
+ kind: "text",
59
+ seriesIndex: o.index,
60
+ dataIndex: e.index,
61
+ cx: g + 5,
62
+ cy: v + S * 2 + 5,
63
+ color: "#ffffff",
64
+ label: N,
65
+ textAnchor: "start",
66
+ fontSize: 10,
67
+ opacity: h,
68
+ visible: !0
69
+ });
70
+ }
71
+ }
72
+ k.push({
73
+ seriesIndex: o.index,
74
+ dataIndex: e.index,
75
+ label: String(e.label ?? e.index + 1),
76
+ values: [
77
+ { name: o.name || y.value, value: e.value, formatted: M(e.value), color: A },
78
+ { name: y.share, value: e.value / F * 100, formatted: `${(e.value / F * 100).toFixed(1)}%`, color: A }
79
+ ],
80
+ x: g,
81
+ y: v,
82
+ w: x,
83
+ h: L
84
+ });
85
+ }
86
+ return { marks: r, gridLines: [], axes: [], legend: [], tooltipTargets: k, noData: !1 };
87
+ }
88
+ const V = ["→", "->", ">", "|"];
89
+ function ot(d, n, m, h, w, y) {
90
+ const o = d.find((t) => t.visible) ?? d[0], c = [];
91
+ if (((o == null ? void 0 : o.data) ?? []).forEach((t, p) => {
92
+ if (!Number.isFinite(t.value) || t.value <= 0) return;
93
+ const $ = String(t.label ?? ""), s = V.find((z) => $.includes(z));
94
+ if (!s) return;
95
+ const u = $.split(s), b = (u[0] ?? "").trim(), I = (u[1] ?? "").trim();
96
+ !b || !I || c.push({ from: b, to: I, value: t.value, index: p });
97
+ }), c.length === 0) return B();
98
+ const M = j((o == null ? void 0 : o.format) ?? "auto", w.locale), S = parseFloat(m.labelFontSize) || 12, l = [], r = [];
99
+ for (const t of c)
100
+ l.includes(t.from) || l.push(t.from), r.includes(t.to) || r.push(t.to);
101
+ const k = c.reduce((t, p) => t + p.value, 0) || 1, F = k, a = Math.min(78, n.plot.width * 0.22), e = n.plot.x + a, g = Math.max(n.plot.width - a * 2, 20), v = 10, x = 4, L = n.plot.height - x * Math.max(l.length - 1, 0), A = n.plot.height - x * Math.max(r.length - 1, 0), T = (t, p) => c.filter(($) => (p === "from" ? $.from : $.to) === t).reduce(($, s) => $ + s.value, 0), O = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Map();
102
+ for (const t of l) O.set(t, Math.max(T(t, "from") / k * L, 1));
103
+ for (const t of r) D.set(t, Math.max(T(t, "to") / F * A, 1));
104
+ const N = /* @__PURE__ */ new Map();
105
+ let H = n.plot.y;
106
+ for (const t of l)
107
+ N.set(t, H), H += O.get(t) + x;
108
+ const Y = /* @__PURE__ */ new Map();
109
+ H = n.plot.y;
110
+ for (const t of r)
111
+ Y.set(t, H), H += D.get(t) + x;
112
+ const i = [], Q = [];
113
+ for (const t of l)
114
+ i.push({
115
+ kind: "rect",
116
+ seriesIndex: o.index,
117
+ dataIndex: -1,
118
+ x: e,
119
+ y: N.get(t),
120
+ width: v,
121
+ height: O.get(t),
122
+ color: K(w, l.indexOf(t), o.color),
123
+ visible: !0
124
+ }), i.push({
125
+ kind: "text",
126
+ seriesIndex: o.index,
127
+ dataIndex: -1,
128
+ cx: e - 6,
129
+ cy: N.get(t) + O.get(t) / 2 + S * 0.36,
130
+ color: m.text,
131
+ label: t,
132
+ textAnchor: "end",
133
+ fontSize: S,
134
+ opacity: h,
135
+ visible: !0
136
+ });
137
+ for (const t of r)
138
+ i.push({
139
+ kind: "rect",
140
+ seriesIndex: o.index,
141
+ dataIndex: -1,
142
+ x: e + g - v,
143
+ y: Y.get(t),
144
+ width: v,
145
+ height: D.get(t),
146
+ color: K(w, r.indexOf(t), o.color),
147
+ visible: !0
148
+ }), i.push({
149
+ kind: "text",
150
+ seriesIndex: o.index,
151
+ dataIndex: -1,
152
+ cx: e + g + 6,
153
+ cy: Y.get(t) + D.get(t) / 2 + S * 0.36,
154
+ color: m.text,
155
+ label: t,
156
+ textAnchor: "start",
157
+ fontSize: S,
158
+ opacity: h,
159
+ visible: !0
160
+ });
161
+ const C = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map();
162
+ for (const t of l) C.set(t, N.get(t));
163
+ for (const t of r) E.set(t, Y.get(t));
164
+ for (const t of c) {
165
+ const p = t.value / k * L, $ = t.value / F * A, s = C.get(t.from), u = E.get(t.to);
166
+ C.set(t.from, s + p), E.set(t.to, u + $);
167
+ const b = e + v, I = e + g - v, z = (b + I) / 2, q = `M ${b} ${s} C ${z} ${s}, ${z} ${u}, ${I} ${u} L ${I} ${u + $} C ${z} ${u + $}, ${z} ${s + p}, ${b} ${s + p} Z`, W = K(w, c.indexOf(t), o.color);
168
+ i.push({
169
+ kind: "path",
170
+ seriesIndex: o.index,
171
+ dataIndex: t.index,
172
+ d: q,
173
+ color: W,
174
+ fillOpacity: 0.32 * Math.max(h, 1e-3),
175
+ visible: !0
176
+ }), Q.push({
177
+ seriesIndex: o.index,
178
+ dataIndex: t.index,
179
+ label: `${t.from} → ${t.to}`,
180
+ values: [
181
+ { name: y.flow, value: t.value, formatted: M(t.value), color: W },
182
+ { name: y.sourceShare, value: t.value, formatted: `${(t.value / (T(t.from, "from") || 1) * 100).toFixed(1)}%`, color: W }
183
+ ],
184
+ x: Math.min(b, I),
185
+ y: Math.min(s, u),
186
+ w: Math.abs(I - b),
187
+ h: Math.max(Math.abs(u - s) + p, 1)
188
+ });
189
+ }
190
+ return { marks: i, gridLines: [], axes: [], legend: [], tooltipTargets: Q, noData: !1 };
191
+ }
192
+ function at(d, n, m, h, w, y, o) {
193
+ var T, O, D, N, H, Y;
194
+ const c = d.filter((i) => i.visible);
195
+ if (!m || c.length < 5) return B();
196
+ const [M, S, l, r, k] = c.slice(0, 5), F = M.data.length;
197
+ if (F === 0) return B();
198
+ const { plot: a } = n, e = a.width / Math.max(F, 1) * 0.5, g = j(l.format ?? "auto", y.locale), v = (i) => {
199
+ const Q = m.leftDomain[1] - m.leftDomain[0] || 1;
200
+ return a.y + a.height - (i - m.leftDomain[0]) / Q * a.height;
201
+ }, x = [], L = [];
202
+ for (let i = 0; i < F; i++) {
203
+ const Q = (T = M.data[i]) == null ? void 0 : T.value, C = (O = S.data[i]) == null ? void 0 : O.value, E = (D = l.data[i]) == null ? void 0 : D.value, t = (N = r.data[i]) == null ? void 0 : N.value, p = (H = k.data[i]) == null ? void 0 : H.value;
204
+ if (![Q, C, E, t, p].every((_) => Number.isFinite(_))) continue;
205
+ const $ = a.width / Math.max(F, 1), s = a.x + $ * i + $ / 2, u = s - e / 2, b = v(Q), I = v(C), z = v(E), q = v(t), W = v(p), f = (_) => z + (_ - z) * Math.max(w, 1e-3), P = Math.min(f(I), f(q)), J = Math.abs(f(q) - f(I)), G = K(y, 0, l.color);
206
+ x.push({
207
+ kind: "path",
208
+ seriesIndex: l.index,
209
+ dataIndex: i,
210
+ d: `M ${u} ${P} L ${u + e} ${P} L ${u + e} ${P + J} L ${u} ${P + J} Z`,
211
+ color: G,
212
+ fillOpacity: 0.22,
213
+ strokeWidth: 1.5,
214
+ visible: !0
215
+ }), x.push({
216
+ kind: "path",
217
+ seriesIndex: l.index,
218
+ dataIndex: i,
219
+ d: `M ${u} ${f(z)} L ${u + e} ${f(z)}`,
220
+ color: G,
221
+ strokeWidth: 2,
222
+ visible: !0
223
+ }), x.push({
224
+ kind: "path",
225
+ seriesIndex: l.index,
226
+ dataIndex: i,
227
+ d: `M ${s} ${f(W)} L ${s} ${f(q)} M ${s} ${f(I)} L ${s} ${f(b)} M ${s - e / 4} ${f(W)} L ${s + e / 4} ${f(W)} M ${s - e / 4} ${f(b)} L ${s + e / 4} ${f(b)}`,
228
+ color: G,
229
+ strokeWidth: 1.2,
230
+ visible: !0
231
+ }), L.push({
232
+ seriesIndex: l.index,
233
+ dataIndex: i,
234
+ label: ((Y = M.data[i]) == null ? void 0 : Y.label) ?? String(i + 1),
235
+ values: [
236
+ { name: o.max, value: p, formatted: g(p), color: G },
237
+ { name: "Q3", value: t, formatted: g(t), color: G },
238
+ { name: o.median, value: E, formatted: g(E), color: G },
239
+ { name: "Q1", value: C, formatted: g(C), color: G },
240
+ { name: o.min, value: Q, formatted: g(Q), color: G }
241
+ ],
242
+ x: u,
243
+ y: Math.min(f(W), f(b)),
244
+ w: e,
245
+ h: Math.max(Math.abs(f(b) - f(W)), 1)
246
+ });
247
+ }
248
+ if (x.length === 0) return B();
249
+ const A = [
250
+ {
251
+ position: "bottom",
252
+ kind: "category",
253
+ title: "",
254
+ ticks: n.xTicks,
255
+ color: h.textSecondary,
256
+ fontFamily: h.fontFamily,
257
+ fontSize: h.labelFontSize
258
+ },
259
+ {
260
+ position: "left",
261
+ kind: "value",
262
+ title: "",
263
+ ticks: n.yTicks.left,
264
+ color: h.textSecondary,
265
+ fontFamily: h.fontFamily,
266
+ fontSize: h.labelFontSize
267
+ }
268
+ ];
269
+ return {
270
+ marks: x,
271
+ gridLines: n.yTicks.left.filter((i) => i.y > a.y + 0.5 && i.y < a.y + a.height - 0.5).map((i) => ({ x1: a.x, y1: i.y, x2: a.x + a.width, y2: i.y, color: h.grid })),
272
+ axes: A,
273
+ legend: [],
274
+ tooltipTargets: L,
275
+ noData: !1
276
+ };
277
+ }
278
+ export {
279
+ at as buildBoxplotGeometry,
280
+ ot as buildSankeyGeometry,
281
+ nt as buildTreemapGeometry
282
+ };
283
+ //# sourceMappingURL=extra-flow-dist.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extra-flow-dist.js","sources":["../../../../src/report/chart/geometry/extra-flow-dist.ts"],"sourcesContent":["import type {\n AxisModel,\n GeometryModel,\n Mark,\n ResolvedTheme,\n SeriesModel,\n TooltipTarget,\n} from \"../types.js\";\nimport type { ComputedFrame, Domains } from \"../layout/layout.js\";\nimport { estimateTextWidth } from \"../layout/layout.js\";\nimport { makeFormatter } from \"../format/format.js\";\nimport {\n colorOf,\n emptyModel,\n fitLabel,\n type ExtraContext,\n type ExtraLabels,\n} from \"./extra-shared.js\";\n\ninterface TreeCell {\n x: number;\n y: number;\n w: number;\n h: number;\n index: number;\n}\n\nfunction splitTreemap(\n items: Array<{ index: number; value: number }>,\n rect: { x: number; y: number; w: number; h: number },\n out: TreeCell[],\n): void {\n if (items.length === 0) return;\n if (items.length === 1) {\n out.push({ ...rect, index: items[0].index });\n return;\n }\n const total = items.reduce((s, i) => s + i.value, 0) || 1;\n let acc = 0;\n let k = 0;\n for (; k < items.length - 1; k++) {\n if (acc + items[k].value >= total / 2) break;\n acc += items[k].value;\n }\n const cut = Math.min(Math.max(k + 1, 1), items.length - 1);\n const a = items.slice(0, cut);\n const b = items.slice(cut);\n const aSum = a.reduce((s, i) => s + i.value, 0) || 1;\n const frac = Math.max(Math.min(aSum / total, 0.95), 0.05);\n if (rect.w >= rect.h) {\n splitTreemap(a, { ...rect, w: rect.w * frac }, out);\n splitTreemap(b, { x: rect.x + rect.w * frac, y: rect.y, w: rect.w * (1 - frac), h: rect.h }, out);\n } else {\n splitTreemap(a, { ...rect, h: rect.h * frac }, out);\n splitTreemap(b, { x: rect.x, y: rect.y + rect.h * frac, w: rect.w, h: rect.h * (1 - frac) }, out);\n }\n}\n\nexport function buildTreemapGeometry(\n series: SeriesModel[],\n frame: ComputedFrame,\n theme: ResolvedTheme,\n progress: number,\n ctx: ExtraContext,\n labels: ExtraLabels,\n): GeometryModel {\n const s = series.find((x) => x.visible) ?? series[0];\n const points = (s?.data ?? [])\n .map((p, index) => ({ index, value: p.value, label: p.label }))\n .filter((p) => Number.isFinite(p.value) && p.value > 0);\n if (points.length === 0) return emptyModel();\n\n const fmt = makeFormatter(s?.format ?? \"auto\", ctx.locale);\n const fontSize = parseFloat(theme.labelFontSize) || 12;\n const cells: TreeCell[] = [];\n splitTreemap(\n [...points].sort((a, b) => b.value - a.value),\n { x: frame.plot.x, y: frame.plot.y, w: frame.plot.width, h: frame.plot.height },\n cells,\n );\n\n const marks: Mark[] = [];\n const tooltipTargets: TooltipTarget[] = [];\n const total = points.reduce((acc, p) => acc + p.value, 0) || 1;\n\n for (const cell of cells) {\n const p = points.find((x) => x.index === cell.index)!;\n const x = cell.x + 1.5;\n const y = cell.y + 1.5;\n const w = Math.max(cell.w - 3, 0);\n const h = Math.max(cell.h - 3, 0);\n if (w < 2 || h < 2) continue;\n const color = colorOf(ctx, p.index, s.color);\n marks.push({\n kind: \"rect\", seriesIndex: s.index, dataIndex: p.index,\n x, y, width: w, height: h, color, visible: true,\n });\n if (w >= 34 && h >= 20) {\n const nameSize = Math.min(fontSize, 12);\n const nameLabel = fitLabel(String(p.label ?? \"\"), w - 10, nameSize);\n if (nameLabel) {\n marks.push({\n kind: \"text\", seriesIndex: s.index, dataIndex: p.index,\n cx: x + 5, cy: y + fontSize + 3,\n color: \"#ffffff\", label: nameLabel,\n textAnchor: \"start\", fontSize: nameSize,\n opacity: progress, visible: true,\n });\n }\n if (h >= 34) {\n const pct = `${fmt(p.value)} (${((p.value / total) * 100).toFixed(0)}%)`;\n const valueLabel =\n estimateTextWidth(pct, 10) <= w - 10\n ? pct\n : estimateTextWidth(fmt(p.value), 10) <= w - 10\n ? fmt(p.value)\n : \"\";\n if (valueLabel) {\n marks.push({\n kind: \"text\", seriesIndex: s.index, dataIndex: p.index,\n cx: x + 5, cy: y + fontSize * 2 + 5,\n color: \"#ffffff\", label: valueLabel,\n textAnchor: \"start\", fontSize: 10, opacity: progress, visible: true,\n });\n }\n }\n }\n tooltipTargets.push({\n seriesIndex: s.index, dataIndex: p.index,\n label: String(p.label ?? p.index + 1),\n values: [\n { name: s.name || labels.value, value: p.value, formatted: fmt(p.value), color },\n { name: labels.share, value: (p.value / total) * 100, formatted: `${((p.value / total) * 100).toFixed(1)}%`, color },\n ],\n x, y, w, h,\n });\n }\n\n return { marks, gridLines: [], axes: [], legend: [], tooltipTargets, noData: false };\n}\n\nconst SANKEY_SEPS = [\"→\", \"->\", \">\", \"|\"];\n\nexport function buildSankeyGeometry(\n series: SeriesModel[],\n frame: ComputedFrame,\n theme: ResolvedTheme,\n progress: number,\n ctx: ExtraContext,\n labels: ExtraLabels,\n): GeometryModel {\n const s = series.find((x) => x.visible) ?? series[0];\n const links: Array<{ from: string; to: string; value: number; index: number }> = [];\n (s?.data ?? []).forEach((p, i) => {\n if (!Number.isFinite(p.value) || p.value <= 0) return;\n const raw = String(p.label ?? \"\");\n const sep = SANKEY_SEPS.find((x) => raw.includes(x));\n if (!sep) return;\n const parts = raw.split(sep);\n const from = (parts[0] ?? \"\").trim();\n const to = (parts[1] ?? \"\").trim();\n if (!from || !to) return;\n links.push({ from, to, value: p.value, index: i });\n });\n if (links.length === 0) return emptyModel();\n\n const fmt = makeFormatter(s?.format ?? \"auto\", ctx.locale);\n const fontSize = parseFloat(theme.labelFontSize) || 12;\n\n const leftNames: string[] = [];\n const rightNames: string[] = [];\n for (const l of links) {\n if (!leftNames.includes(l.from)) leftNames.push(l.from);\n if (!rightNames.includes(l.to)) rightNames.push(l.to);\n }\n const leftSum = links.reduce((acc, l) => acc + l.value, 0) || 1;\n const rightSum = leftSum;\n\n const labelW = Math.min(78, frame.plot.width * 0.22);\n const px = frame.plot.x + labelW;\n const pw = Math.max(frame.plot.width - labelW * 2, 20);\n const nodeW = 10;\n const gap = 4;\n const leftTotalH = frame.plot.height - gap * Math.max(leftNames.length - 1, 0);\n const rightTotalH = frame.plot.height - gap * Math.max(rightNames.length - 1, 0);\n\n const sumOf = (name: string, side: \"from\" | \"to\") =>\n links.filter((l) => (side === \"from\" ? l.from : l.to) === name).reduce((acc, l) => acc + l.value, 0);\n\n const leftH = new Map<string, number>();\n const rightH = new Map<string, number>();\n for (const n of leftNames) leftH.set(n, Math.max((sumOf(n, \"from\") / leftSum) * leftTotalH, 1));\n for (const n of rightNames) rightH.set(n, Math.max((sumOf(n, \"to\") / rightSum) * rightTotalH, 1));\n\n const leftY = new Map<string, number>();\n let cursor = frame.plot.y;\n for (const n of leftNames) {\n leftY.set(n, cursor);\n cursor += leftH.get(n)! + gap;\n }\n const rightY = new Map<string, number>();\n cursor = frame.plot.y;\n for (const n of rightNames) {\n rightY.set(n, cursor);\n cursor += rightH.get(n)! + gap;\n }\n\n const marks: Mark[] = [];\n const tooltipTargets: TooltipTarget[] = [];\n\n for (const n of leftNames) {\n marks.push({\n kind: \"rect\", seriesIndex: s.index, dataIndex: -1,\n x: px, y: leftY.get(n)!, width: nodeW, height: leftH.get(n)!,\n color: colorOf(ctx, leftNames.indexOf(n), s.color), visible: true,\n });\n marks.push({\n kind: \"text\", seriesIndex: s.index, dataIndex: -1,\n cx: px - 6, cy: leftY.get(n)! + leftH.get(n)! / 2 + fontSize * 0.36,\n color: theme.text, label: n, textAnchor: \"end\", fontSize,\n opacity: progress, visible: true,\n });\n }\n for (const n of rightNames) {\n marks.push({\n kind: \"rect\", seriesIndex: s.index, dataIndex: -1,\n x: px + pw - nodeW, y: rightY.get(n)!, width: nodeW, height: rightH.get(n)!,\n color: colorOf(ctx, rightNames.indexOf(n), s.color), visible: true,\n });\n marks.push({\n kind: \"text\", seriesIndex: s.index, dataIndex: -1,\n cx: px + pw + 6, cy: rightY.get(n)! + rightH.get(n)! / 2 + fontSize * 0.36,\n color: theme.text, label: n, textAnchor: \"start\", fontSize,\n opacity: progress, visible: true,\n });\n }\n\n const leftCur = new Map<string, number>();\n const rightCur = new Map<string, number>();\n for (const n of leftNames) leftCur.set(n, leftY.get(n)!);\n for (const n of rightNames) rightCur.set(n, rightY.get(n)!);\n\n for (const l of links) {\n const lh = (l.value / leftSum) * leftTotalH;\n const rh = (l.value / rightSum) * rightTotalH;\n const y0 = leftCur.get(l.from)!;\n const y1 = rightCur.get(l.to)!;\n leftCur.set(l.from, y0 + lh);\n rightCur.set(l.to, y1 + rh);\n\n const x0 = px + nodeW;\n const x1 = px + pw - nodeW;\n const xm = (x0 + x1) / 2;\n const d =\n `M ${x0} ${y0} C ${xm} ${y0}, ${xm} ${y1}, ${x1} ${y1}` +\n ` L ${x1} ${y1 + rh} C ${xm} ${y1 + rh}, ${xm} ${y0 + lh}, ${x0} ${y0 + lh} Z`;\n const color = colorOf(ctx, links.indexOf(l), s.color);\n marks.push({\n kind: \"path\", seriesIndex: s.index, dataIndex: l.index, d,\n color, fillOpacity: 0.32 * Math.max(progress, 0.001), visible: true,\n });\n tooltipTargets.push({\n seriesIndex: s.index, dataIndex: l.index,\n label: `${l.from} → ${l.to}`,\n values: [\n { name: labels.flow, value: l.value, formatted: fmt(l.value), color },\n { name: labels.sourceShare, value: l.value, formatted: `${((l.value / (sumOf(l.from, \"from\") || 1)) * 100).toFixed(1)}%`, color },\n ],\n x: Math.min(x0, x1), y: Math.min(y0, y1), w: Math.abs(x1 - x0), h: Math.max(Math.abs(y1 - y0) + lh, 1),\n });\n }\n\n return { marks, gridLines: [], axes: [], legend: [], tooltipTargets, noData: false };\n}\n\nexport function buildBoxplotGeometry(\n series: SeriesModel[],\n frame: ComputedFrame,\n domains: Domains | null,\n theme: ResolvedTheme,\n progress: number,\n ctx: ExtraContext,\n labels: ExtraLabels,\n): GeometryModel {\n const visible = series.filter((x) => x.visible);\n if (!domains || visible.length < 5) return emptyModel();\n\n const [minS, q1S, medS, q3S, maxS] = visible.slice(0, 5);\n const n = minS.data.length;\n if (n === 0) return emptyModel();\n\n const { plot } = frame;\n const slot = (plot.width / Math.max(n, 1)) * 0.5;\n const fmt = makeFormatter(medS.format ?? \"auto\", ctx.locale);\n\n const yFor = (v: number) => {\n const span = domains.leftDomain[1] - domains.leftDomain[0] || 1;\n return plot.y + plot.height - ((v - domains.leftDomain[0]) / span) * plot.height;\n };\n\n const marks: Mark[] = [];\n const tooltipTargets: TooltipTarget[] = [];\n\n for (let i = 0; i < n; i++) {\n const vMin = minS.data[i]?.value;\n const vQ1 = q1S.data[i]?.value;\n const vMed = medS.data[i]?.value;\n const vQ3 = q3S.data[i]?.value;\n const vMax = maxS.data[i]?.value;\n if (![vMin, vQ1, vMed, vQ3, vMax].every((v) => Number.isFinite(v))) continue;\n\n const step = plot.width / Math.max(n, 1);\n const cx = plot.x + step * i + step / 2;\n const x0 = cx - slot / 2;\n const yMin = yFor(vMin);\n const yQ1 = yFor(vQ1);\n const yMed = yFor(vMed);\n const yQ3 = yFor(vQ3);\n const yMax = yFor(vMax);\n const grow = (y: number) => yMed + (y - yMed) * Math.max(progress, 0.001);\n\n const boxTop = Math.min(grow(yQ1), grow(yQ3));\n const boxH = Math.abs(grow(yQ3) - grow(yQ1));\n const color = colorOf(ctx, 0, medS.color);\n\n marks.push({\n kind: \"path\", seriesIndex: medS.index, dataIndex: i,\n d: `M ${x0} ${boxTop} L ${x0 + slot} ${boxTop} L ${x0 + slot} ${boxTop + boxH} L ${x0} ${boxTop + boxH} Z`,\n color, fillOpacity: 0.22, strokeWidth: 1.5, visible: true,\n });\n marks.push({\n kind: \"path\", seriesIndex: medS.index, dataIndex: i,\n d: `M ${x0} ${grow(yMed)} L ${x0 + slot} ${grow(yMed)}`,\n color, strokeWidth: 2, visible: true,\n });\n marks.push({\n kind: \"path\", seriesIndex: medS.index, dataIndex: i,\n d:\n `M ${cx} ${grow(yMax)} L ${cx} ${grow(yQ3)}` +\n ` M ${cx} ${grow(yQ1)} L ${cx} ${grow(yMin)}` +\n ` M ${cx - slot / 4} ${grow(yMax)} L ${cx + slot / 4} ${grow(yMax)}` +\n ` M ${cx - slot / 4} ${grow(yMin)} L ${cx + slot / 4} ${grow(yMin)}`,\n color, strokeWidth: 1.2, visible: true,\n });\n\n tooltipTargets.push({\n seriesIndex: medS.index, dataIndex: i,\n label: minS.data[i]?.label ?? String(i + 1),\n values: [\n { name: labels.max, value: vMax, formatted: fmt(vMax), color },\n { name: \"Q3\", value: vQ3, formatted: fmt(vQ3), color },\n { name: labels.median, value: vMed, formatted: fmt(vMed), color },\n { name: \"Q1\", value: vQ1, formatted: fmt(vQ1), color },\n { name: labels.min, value: vMin, formatted: fmt(vMin), color },\n ],\n x: x0, y: Math.min(grow(yMax), grow(yMin)), w: slot,\n h: Math.max(Math.abs(grow(yMin) - grow(yMax)), 1),\n });\n }\n\n if (marks.length === 0) return emptyModel();\n\n const axes: AxisModel[] = [\n {\n position: \"bottom\", kind: \"category\", title: \"\",\n ticks: frame.xTicks, color: theme.textSecondary,\n fontFamily: theme.fontFamily, fontSize: theme.labelFontSize,\n },\n {\n position: \"left\", kind: \"value\", title: \"\",\n ticks: frame.yTicks.left, color: theme.textSecondary,\n fontFamily: theme.fontFamily, fontSize: theme.labelFontSize,\n },\n ];\n\n return {\n marks,\n gridLines: frame.yTicks.left\n .filter((t) => t.y > plot.y + 0.5 && t.y < plot.y + plot.height - 0.5)\n .map((t) => ({ x1: plot.x, y1: t.y, x2: plot.x + plot.width, y2: t.y, color: theme.grid })),\n axes,\n legend: [],\n tooltipTargets,\n noData: false,\n };\n}\n"],"names":["splitTreemap","items","rect","out","total","s","i","acc","k","cut","a","b","aSum","frac","buildTreemapGeometry","series","frame","theme","progress","ctx","labels","x","points","p","index","emptyModel","fmt","makeFormatter","fontSize","cells","marks","tooltipTargets","cell","y","w","h","color","colorOf","nameSize","nameLabel","fitLabel","pct","valueLabel","estimateTextWidth","SANKEY_SEPS","buildSankeyGeometry","links","raw","sep","parts","from","to","leftNames","rightNames","l","leftSum","rightSum","labelW","px","pw","nodeW","gap","leftTotalH","rightTotalH","sumOf","name","side","leftH","rightH","n","leftY","cursor","rightY","leftCur","rightCur","lh","rh","y0","y1","x0","x1","xm","d","buildBoxplotGeometry","domains","visible","minS","q1S","medS","q3S","maxS","plot","slot","yFor","v","span","vMin","_a","vQ1","_b","vMed","_c","vQ3","_d","vMax","_e","step","cx","yMin","yQ1","yMed","yQ3","yMax","grow","boxTop","boxH","_f","axes","t"],"mappings":";;;AA2BA,SAASA,EACPC,GACAC,GACAC,GACM;AACN,MAAIF,EAAM,WAAW,EAAG;AACxB,MAAIA,EAAM,WAAW,GAAG;AACtB,IAAAE,EAAI,KAAK,EAAE,GAAGD,GAAM,OAAOD,EAAM,CAAC,EAAE,OAAO;AAC3C;AAAA,EACF;AACA,QAAMG,IAAQH,EAAM,OAAO,CAACI,GAAGC,MAAMD,IAAIC,EAAE,OAAO,CAAC,KAAK;AACxD,MAAIC,IAAM,GACNC,IAAI;AACR,SAAOA,IAAIP,EAAM,SAAS,KACpB,EAAAM,IAAMN,EAAMO,CAAC,EAAE,SAASJ,IAAQ,IADTI;AAE3B,IAAAD,KAAON,EAAMO,CAAC,EAAE;AAElB,QAAMC,IAAM,KAAK,IAAI,KAAK,IAAID,IAA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E,UAAU;AAAA,MAAU,MAAM;AAAA,MAAY,OAAO;AAAA,MAC7C,OAAOrG,EAAM;AAAA,MAAQ,OAAOC,EAAM;AAAA,MAClC,YAAYA,EAAM;AAAA,MAAY,UAAUA,EAAM;AAAA,IAAA;AAAA,IAEhD;AAAA,MACE,UAAU;AAAA,MAAQ,MAAM;AAAA,MAAS,OAAO;AAAA,MACxC,OAAOD,EAAM,OAAO;AAAA,MAAM,OAAOC,EAAM;AAAA,MACvC,YAAYA,EAAM;AAAA,MAAY,UAAUA,EAAM;AAAA,IAAA;AAAA,EAChD;AAGF,SAAO;AAAA,IACL,OAAAa;AAAA,IACA,WAAWd,EAAM,OAAO,KACrB,OAAO,CAACsG,MAAMA,EAAE,IAAI3B,EAAK,IAAI,OAAO2B,EAAE,IAAI3B,EAAK,IAAIA,EAAK,SAAS,GAAG,EACpE,IAAI,CAAC2B,OAAO,EAAE,IAAI3B,EAAK,GAAG,IAAI2B,EAAE,GAAG,IAAI3B,EAAK,IAAIA,EAAK,OAAO,IAAI2B,EAAE,GAAG,OAAOrG,EAAM,OAAO;AAAA,IAC5F,MAAAoG;AAAA,IACA,QAAQ,CAAA;AAAA,IACR,gBAAAtF;AAAA,IACA,QAAQ;AAAA,EAAA;AAEZ;"}
@@ -0,0 +1,280 @@
1
+ import { estimateTextWidth as C } from "../layout/layout.js";
2
+ import { quantize as et, SEQUENTIAL_DARK as at, SEQUENTIAL_LIGHT as nt } from "../palette.js";
3
+ import { makeFormatter as Q } from "../format/format.js";
4
+ import { emptyModel as U, arcPath as K, readableOn as ot, colorOf as B } from "./extra-shared.js";
5
+ function dt(z, F, n, f, h, L) {
6
+ const t = z.find((o) => o.visible) ?? z[0], i = ((t == null ? void 0 : t.data) ?? []).filter((o) => Number.isFinite(o.value) && o.value >= 0);
7
+ if (i.length === 0) return U();
8
+ const { plot: l } = F, y = Math.min(l.width * 0.28, 120), I = Math.max(l.width - y * 2, 20), g = l.x + y, k = g + I, a = g + I / 2, c = Math.max(...i.map((o) => o.value), 1), x = i.length, b = 2, v = Math.max((l.height - b * (x - 1)) / x, 1), M = Q((t == null ? void 0 : t.format) ?? "auto", h.locale), s = parseFloat(n.labelFontSize) || 12, r = [], S = [];
9
+ return i.forEach((o, d) => {
10
+ const p = l.y + (v + b) * d, m = v * Math.max(f, 1e-3), $ = o.value / c * I, N = (d + 1 < x ? i[d + 1].value : o.value) / c * I, E = v > 0 ? m / v : 1, W = $ + (N - $) * E, D = `M ${a - $ / 2} ${p} L ${a + $ / 2} ${p} L ${a + W / 2} ${p + m} L ${a - W / 2} ${p + m} Z`;
11
+ r.push({
12
+ kind: "path",
13
+ seriesIndex: t.index,
14
+ dataIndex: d,
15
+ d: D,
16
+ color: B(h, d, t.color),
17
+ fillOpacity: 0.92,
18
+ visible: !0
19
+ });
20
+ const H = p + v / 2 + s * 0.36;
21
+ r.push({
22
+ kind: "text",
23
+ seriesIndex: t.index,
24
+ dataIndex: d,
25
+ cx: g - 8,
26
+ cy: H,
27
+ color: n.text,
28
+ label: o.label ?? String(d + 1),
29
+ textAnchor: "end",
30
+ fontSize: s,
31
+ opacity: f,
32
+ visible: !0
33
+ });
34
+ const T = c > 0 ? o.value / c * 100 : 0;
35
+ r.push({
36
+ kind: "text",
37
+ seriesIndex: t.index,
38
+ dataIndex: d,
39
+ cx: k + 8,
40
+ cy: H,
41
+ color: n.text,
42
+ label: `${M(o.value)} ${T.toFixed(0)}%`,
43
+ textAnchor: "start",
44
+ fontSize: s,
45
+ opacity: f,
46
+ visible: !0
47
+ });
48
+ const O = Math.max($, W);
49
+ S.push({
50
+ seriesIndex: t.index,
51
+ dataIndex: d,
52
+ label: o.label ?? String(d + 1),
53
+ values: [
54
+ { name: t.name || L.value, value: o.value, formatted: M(o.value), color: B(h, d, t.color) },
55
+ { name: L.share, value: T, formatted: `${T.toFixed(1)}%`, color: B(h, d, t.color) }
56
+ ],
57
+ x: a - O / 2,
58
+ y: p,
59
+ w: O,
60
+ h: Math.max(m, 1)
61
+ });
62
+ }), { marks: r, gridLines: [], axes: [], legend: [], tooltipTargets: S, noData: !1 };
63
+ }
64
+ function rt(z, F, n, f, h, L) {
65
+ var Y;
66
+ const t = z.filter((e) => e.visible), i = [];
67
+ for (const e of t)
68
+ for (const u of e.data) {
69
+ const A = u.label ?? "";
70
+ A && !i.includes(A) && i.push(A);
71
+ }
72
+ if (t.length === 0 || i.length === 0) return U();
73
+ const l = parseFloat(n.labelFontSize) || 12, y = Q(((Y = t[0]) == null ? void 0 : Y.format) ?? "auto", h.locale), I = Math.max(...t.map((e) => C(e.name, l))) + 10, g = l + 8, k = 12 + l, a = F.plot.x + I, c = F.plot.y, x = Math.max(F.plot.width - I - 4, 10), b = Math.max(F.plot.height - g - k, 10), v = t.length, M = i.length, s = x / M, r = b / v, S = [];
74
+ for (const e of t) for (const u of e.data) Number.isFinite(u.value) && S.push(u.value);
75
+ const o = 7, d = et(S, o, { min: h.clampMin, max: h.clampMax }), p = n.dark ? at : nt, m = [], $ = [];
76
+ t.forEach((e, u) => {
77
+ i.forEach((A, j) => {
78
+ const w = e.data.find((tt) => (tt.label ?? "") === A);
79
+ if (!w || !Number.isFinite(w.value)) return;
80
+ const J = d.bucketIndex(w.value), _ = p[Math.min(J, p.length - 1)], P = a + s * j, R = c + r * u, V = Math.max(s - 1, 1), q = Math.max(r - 1, 1);
81
+ m.push({
82
+ kind: "rect",
83
+ seriesIndex: e.index,
84
+ dataIndex: e.data.indexOf(w),
85
+ x: P,
86
+ y: R,
87
+ width: V,
88
+ height: q,
89
+ color: _,
90
+ visible: !0
91
+ }), s >= 38 && r >= 18 && h.labels !== !1 && m.push({
92
+ kind: "text",
93
+ seriesIndex: e.index,
94
+ dataIndex: e.data.indexOf(w),
95
+ cx: P + V / 2,
96
+ cy: R + q / 2 + l * 0.36,
97
+ color: ot(_),
98
+ label: y(w.value),
99
+ textAnchor: "middle",
100
+ fontSize: 10,
101
+ opacity: f,
102
+ visible: !0
103
+ }), $.push({
104
+ seriesIndex: e.index,
105
+ dataIndex: e.data.indexOf(w),
106
+ label: `${e.name} · ${A}`,
107
+ values: [{ name: e.name || L.value, value: w.value, formatted: y(w.value), color: _ }],
108
+ x: P,
109
+ y: R,
110
+ w: V,
111
+ h: q
112
+ });
113
+ });
114
+ });
115
+ const G = c + b + g - 2, N = x / o;
116
+ for (let e = 0; e < o; e++)
117
+ m.push({
118
+ kind: "rect",
119
+ seriesIndex: -1,
120
+ dataIndex: -1,
121
+ x: a + N * e,
122
+ y: G,
123
+ width: Math.max(N - 1, 1),
124
+ height: 8,
125
+ color: p[Math.min(e, p.length - 1)],
126
+ visible: !0
127
+ });
128
+ const E = G + 8 + l - 1;
129
+ m.push({
130
+ kind: "text",
131
+ seriesIndex: -1,
132
+ dataIndex: -1,
133
+ cx: a,
134
+ cy: E,
135
+ color: n.textSecondary,
136
+ label: y(d.min),
137
+ textAnchor: "start",
138
+ fontSize: l - 2,
139
+ opacity: f,
140
+ visible: !0
141
+ }), m.push({
142
+ kind: "text",
143
+ seriesIndex: -1,
144
+ dataIndex: -1,
145
+ cx: a + x,
146
+ cy: E,
147
+ color: n.textSecondary,
148
+ label: y(d.max),
149
+ textAnchor: "end",
150
+ fontSize: l - 2,
151
+ opacity: f,
152
+ visible: !0
153
+ });
154
+ const W = Math.max(...i.map((e) => C(e, l)), 1) + 8, D = Math.max(1, Math.ceil(W / Math.max(s, 1))), H = i.map((e, u) => ({ value: u, label: e, x: a + s * u + s / 2, y: c + b })).filter((e, u) => u % D === 0), T = l + 2, O = Math.max(1, Math.ceil(T / Math.max(r, 1))), X = t.map((e, u) => ({ value: u, label: e.name, x: a, y: c + r * u + r / 2 })).filter((e, u) => u % O === 0), Z = [
155
+ {
156
+ position: "bottom",
157
+ kind: "category",
158
+ title: "",
159
+ ticks: H,
160
+ color: n.textSecondary,
161
+ fontFamily: n.fontFamily,
162
+ fontSize: n.labelFontSize
163
+ },
164
+ {
165
+ position: "left",
166
+ kind: "category",
167
+ title: "",
168
+ ticks: X,
169
+ color: n.textSecondary,
170
+ fontFamily: n.fontFamily,
171
+ fontSize: n.labelFontSize
172
+ }
173
+ ];
174
+ return { marks: m, gridLines: [], axes: Z, legend: [], tooltipTargets: $, noData: !1 };
175
+ }
176
+ function xt(z, F, n, f, h, L) {
177
+ var p;
178
+ const t = z.find((m) => m.visible) ?? z[0], i = (p = t == null ? void 0 : t.data) == null ? void 0 : p.find((m) => Number.isFinite(m.value));
179
+ if (!i) return U();
180
+ const l = Number.isFinite(h.gaugeMin) ? h.gaugeMin : 0, y = Number.isFinite(h.gaugeMax) ? h.gaugeMax : void 0, I = y !== void 0 && y > l ? y : Math.max(i.value * 1.25, l + 1), g = Math.max(0, Math.min(1, (i.value - l) / (I - l || 1))), { plot: k } = F, a = Math.max(Math.min(k.width / 2 - 16, k.height * 0.58), 12), c = k.x + k.width / 2, x = k.y + k.height * 0.66, b = Math.max(a * 0.16, 6), v = Q((t == null ? void 0 : t.format) ?? "auto", h.locale), M = parseFloat(n.labelFontSize) || 12, s = [], r = Math.PI, S = Math.PI * 2;
181
+ s.push({
182
+ kind: "path",
183
+ seriesIndex: t.index,
184
+ dataIndex: 0,
185
+ d: K(c, x, a, r, S),
186
+ color: n.grid,
187
+ strokeWidth: b,
188
+ opacity: 1,
189
+ visible: !0
190
+ }), g > 0 && s.push({
191
+ kind: "path",
192
+ seriesIndex: t.index,
193
+ dataIndex: 0,
194
+ d: K(c, x, a, r, r + (S - r) * g * Math.max(f, 1e-3)),
195
+ color: t.color,
196
+ strokeWidth: b,
197
+ opacity: 1,
198
+ visible: !0
199
+ });
200
+ const o = r + (S - r) * g, d = a - b - 4;
201
+ return s.push({
202
+ kind: "path",
203
+ seriesIndex: t.index,
204
+ dataIndex: 0,
205
+ d: `M ${c} ${x} L ${c + d * Math.cos(o)} ${x + d * Math.sin(o)}`,
206
+ color: n.text,
207
+ strokeWidth: 2,
208
+ opacity: f,
209
+ visible: !0
210
+ }), s.push({
211
+ kind: "circle",
212
+ seriesIndex: t.index,
213
+ dataIndex: 0,
214
+ cx: c,
215
+ cy: x,
216
+ r: Math.max(b * 0.5, 3),
217
+ color: n.text,
218
+ opacity: f,
219
+ visible: !0
220
+ }), s.push({
221
+ kind: "text",
222
+ seriesIndex: t.index,
223
+ dataIndex: 0,
224
+ cx: c,
225
+ cy: x + M * 2.6,
226
+ color: n.text,
227
+ label: v(i.value),
228
+ textAnchor: "middle",
229
+ fontSize: Math.max(M * 1.6, 16),
230
+ fontWeight: 600,
231
+ opacity: f,
232
+ visible: !0
233
+ }), s.push({
234
+ kind: "text",
235
+ seriesIndex: t.index,
236
+ dataIndex: 0,
237
+ cx: c - a,
238
+ cy: x + b * 0.5 + M * 0.9,
239
+ color: n.textSecondary,
240
+ label: v(l),
241
+ textAnchor: "middle",
242
+ fontSize: M,
243
+ opacity: f,
244
+ visible: !0
245
+ }), s.push({
246
+ kind: "text",
247
+ seriesIndex: t.index,
248
+ dataIndex: 0,
249
+ cx: c + a,
250
+ cy: x + b * 0.5 + M * 0.9,
251
+ color: n.textSecondary,
252
+ label: v(I),
253
+ textAnchor: "middle",
254
+ fontSize: M,
255
+ opacity: f,
256
+ visible: !0
257
+ }), {
258
+ marks: s,
259
+ gridLines: [],
260
+ axes: [],
261
+ legend: [],
262
+ tooltipTargets: [{
263
+ seriesIndex: t.index,
264
+ dataIndex: 0,
265
+ label: i.label ?? t.name ?? "",
266
+ values: [{ name: t.name || L.value, value: i.value, formatted: v(i.value), color: t.color }],
267
+ x: c - a,
268
+ y: x - a,
269
+ w: a * 2,
270
+ h: a + b
271
+ }],
272
+ noData: !1
273
+ };
274
+ }
275
+ export {
276
+ dt as buildFunnelGeometry,
277
+ xt as buildGaugeGeometry,
278
+ rt as buildHeatmapGeometry
279
+ };
280
+ //# sourceMappingURL=extra-radial-grid.js.map