@svgrid/grid 3.0.2 → 3.0.4

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 (281) hide show
  1. package/README.md +2 -1
  2. package/dist/GridMenus.svelte +44 -2
  3. package/dist/SvChartMenu.svelte +69 -0
  4. package/dist/SvChartMenu.svelte.d.ts +11 -0
  5. package/dist/SvChartPanes.svelte +113 -0
  6. package/dist/SvChartPanes.svelte.d.ts +20 -0
  7. package/dist/SvGrid.controller.svelte.d.ts +110 -39
  8. package/dist/SvGrid.controller.svelte.js +655 -200
  9. package/dist/SvGrid.css +105 -2
  10. package/dist/SvGrid.svelte +386 -514
  11. package/dist/SvGrid.types.d.ts +210 -9
  12. package/dist/SvGridCellEditor.svelte +17 -0
  13. package/dist/SvGridChart.svelte +2257 -329
  14. package/dist/SvGridChart.svelte.d.ts +6 -106
  15. package/dist/SvGridChart.types.d.ts +338 -0
  16. package/dist/SvGridChart.types.js +1 -0
  17. package/dist/SvGridChartBuilder.svelte +323 -0
  18. package/dist/SvGridChartBuilder.svelte.d.ts +34 -0
  19. package/dist/SvGridChartPanel.svelte +221 -275
  20. package/dist/SvGridChartPickers.svelte +417 -0
  21. package/dist/SvGridChartPickers.svelte.d.ts +70 -0
  22. package/dist/SvGridChartView.svelte +13 -14
  23. package/dist/SvModal.svelte +7 -1
  24. package/dist/SvModal.svelte.d.ts +5 -0
  25. package/dist/ai.d.ts +40 -8
  26. package/dist/ai.js +135 -24
  27. package/dist/aria.d.ts +11 -0
  28. package/dist/build-api.js +108 -22
  29. package/dist/cdn/GridMenus-7kbpnnBW.js +635 -0
  30. package/dist/cdn/GridMenus-BL7ZgQvU.js +636 -0
  31. package/dist/cdn/SvChartMenu-Bl6PBbkT.js +58 -0
  32. package/dist/cdn/SvChartMenu-FBSMINA6.js +59 -0
  33. package/dist/cdn/{SvDateRangeInput-DMLKmGEc.js → SvDateRangeInput-BeU_TkbQ.js} +15 -14
  34. package/dist/cdn/{SvDateRangeInput-CaOuMs8O.js → SvDateRangeInput-yX8vzleW.js} +38 -37
  35. package/dist/cdn/{SvDateTimePicker-sonaH0oh.js → SvDateTimePicker-DQwt4UAs.js} +139 -180
  36. package/dist/cdn/SvDateTimePicker-vNU6bZ-q.js +775 -0
  37. package/dist/cdn/{SvGridCellEditor-CjEJMJKc.js → SvGridCellEditor-B1p-vCK5.js} +188 -178
  38. package/dist/cdn/{SvGridCellEditor-BWnTi2N7.js → SvGridCellEditor-D_0q4xAu.js} +98 -88
  39. package/dist/cdn/SvGridChart-C3EWAZaM.js +3574 -0
  40. package/dist/cdn/SvGridChart-DzLkSwCH.js +3572 -0
  41. package/dist/cdn/SvGridChartBuilder-BE2T1ykB.js +783 -0
  42. package/dist/cdn/SvGridChartBuilder-CfII62sZ.js +784 -0
  43. package/dist/cdn/SvGridChartPanel-CCX5_Wgd.js +675 -0
  44. package/dist/cdn/SvGridChartPanel-xf4sWVTo.js +699 -0
  45. package/dist/cdn/SvGridChartView-CfuXmY5I.js +48 -0
  46. package/dist/cdn/SvGridChartView-DYwabQWj.js +47 -0
  47. package/dist/cdn/SvMenuList-CLN8OuIK.js +452 -0
  48. package/dist/cdn/SvMenuList-DkGhNKjf.js +451 -0
  49. package/dist/cdn/SvModal-BAE-pjZX.js +396 -0
  50. package/dist/cdn/SvModal-CIZWCcad.js +397 -0
  51. package/dist/cdn/chart-Dz7SqMXH.js +4341 -0
  52. package/dist/cdn/chart-export-BXqueeWJ.js +135 -0
  53. package/dist/cdn/chart-export-pdf-DONFUnNY.js +110 -0
  54. package/dist/cdn/chart-panel-messages-CUbf2R4i.js +1052 -0
  55. package/dist/cdn/chart-panel-messages-CmNrMdsr.js +1053 -0
  56. package/dist/cdn/chart-summary-BJW_tg_X.js +138 -0
  57. package/dist/cdn/chart-trend-CaN9mDEV.js +50 -0
  58. package/dist/cdn/chart-validate-HcOVFAfJ.js +188 -0
  59. package/dist/cdn/{column-resize-DsfNXMom.js → column-resize-DpmOLfRp.js} +3 -3
  60. package/dist/cdn/{date-format-BnnHlqGw.js → date-format-CtquV-p3.js} +583 -603
  61. package/dist/cdn/{date-format-BNii4zeD.js → date-format-D6KFzU_W.js} +347 -367
  62. package/dist/cdn/dismissable-DAHetSNk.js +44 -0
  63. package/dist/cdn/editor-contract-LXgQJAgd.js +22 -0
  64. package/dist/cdn/focus-trap-BBOQYBma.js +65 -0
  65. package/dist/cdn/{row-resize-BRcimkUT.js → row-resize-niQCp040.js} +44 -36
  66. package/dist/cdn/{src-DNbz94Ct.js → src-BKhZ6eXd.js} +10227 -9787
  67. package/dist/cdn/{src-BJ2opd0j.js → src-V1uu8iE9.js} +6568 -6128
  68. package/dist/cdn/svgrid.js +26 -15
  69. package/dist/cdn/svgrid.svelte-external.js +26 -15
  70. package/dist/chart-axes.d.ts +53 -0
  71. package/dist/chart-axes.js +351 -0
  72. package/dist/chart-cartesian.d.ts +88 -0
  73. package/dist/chart-cartesian.js +1862 -0
  74. package/dist/chart-decimate.d.ts +51 -0
  75. package/dist/chart-decimate.js +199 -0
  76. package/dist/chart-export-pdf.d.ts +47 -0
  77. package/dist/chart-export-pdf.js +187 -0
  78. package/dist/chart-export.d.ts +2 -1
  79. package/dist/chart-export.js +18 -3
  80. package/dist/chart-financial.d.ts +91 -0
  81. package/dist/chart-financial.js +175 -0
  82. package/dist/chart-flow.d.ts +10 -0
  83. package/dist/chart-flow.js +298 -0
  84. package/dist/chart-format.d.ts +18 -0
  85. package/dist/chart-format.js +65 -0
  86. package/dist/chart-grid.d.ts +8 -0
  87. package/dist/chart-grid.js +190 -0
  88. package/dist/chart-hierarchy.d.ts +17 -0
  89. package/dist/chart-hierarchy.js +146 -0
  90. package/dist/chart-indicators.d.ts +115 -0
  91. package/dist/chart-indicators.js +389 -0
  92. package/dist/chart-messages.d.ts +95 -0
  93. package/dist/chart-messages.js +92 -0
  94. package/dist/chart-motion.d.ts +16 -0
  95. package/dist/chart-motion.js +141 -0
  96. package/dist/chart-panel-messages.d.ts +265 -0
  97. package/dist/chart-panel-messages.js +285 -0
  98. package/dist/chart-pivot.d.ts +87 -0
  99. package/dist/chart-pivot.js +156 -0
  100. package/dist/chart-polar.d.ts +25 -0
  101. package/dist/chart-polar.js +700 -0
  102. package/dist/chart-samples.d.ts +16 -0
  103. package/dist/chart-samples.js +153 -0
  104. package/dist/chart-scale.d.ts +113 -0
  105. package/dist/chart-scale.js +405 -0
  106. package/dist/chart-stats.d.ts +111 -0
  107. package/dist/chart-stats.js +419 -0
  108. package/dist/chart-stream.d.ts +45 -0
  109. package/dist/chart-stream.js +91 -0
  110. package/dist/chart-summary.d.ts +27 -0
  111. package/dist/chart-summary.js +205 -0
  112. package/dist/chart-sync.svelte.d.ts +32 -0
  113. package/dist/chart-sync.svelte.js +23 -0
  114. package/dist/chart-table.d.ts +35 -0
  115. package/dist/chart-table.js +165 -0
  116. package/dist/chart-trend.d.ts +19 -0
  117. package/dist/chart-trend.js +61 -0
  118. package/dist/chart-types.d.ts +1456 -0
  119. package/dist/chart-types.js +6 -0
  120. package/dist/chart-validate.d.ts +43 -0
  121. package/dist/chart-validate.js +272 -0
  122. package/dist/chart-zoom.d.ts +40 -0
  123. package/dist/chart-zoom.js +145 -0
  124. package/dist/chart.d.ts +186 -865
  125. package/dist/chart.js +460 -2204
  126. package/dist/clipboard.d.ts +1 -0
  127. package/dist/clipboard.js +137 -18
  128. package/dist/column-resize.d.ts +3 -0
  129. package/dist/column-resize.js +4 -1
  130. package/dist/columns.js +3 -0
  131. package/dist/command-context.d.ts +19 -0
  132. package/dist/command-context.js +116 -0
  133. package/dist/core.d.ts +7 -0
  134. package/dist/createPopoverSelect.svelte.d.ts +2 -2
  135. package/dist/editing.d.ts +2 -8
  136. package/dist/editing.js +262 -33
  137. package/dist/fill-patterns.d.ts +0 -5
  138. package/dist/fill-patterns.js +56 -2
  139. package/dist/grid-messages.d.ts +10 -3
  140. package/dist/grid-messages.js +5 -0
  141. package/dist/history.d.ts +83 -0
  142. package/dist/history.js +133 -0
  143. package/dist/index.d.ts +24 -6
  144. package/dist/index.js +20 -2
  145. package/dist/keyboard-handlers.js +88 -31
  146. package/dist/keyboard.d.ts +55 -0
  147. package/dist/keyboard.js +132 -0
  148. package/dist/menus.d.ts +3 -1
  149. package/dist/menus.js +7 -2
  150. package/dist/merges.d.ts +97 -0
  151. package/dist/merges.js +147 -0
  152. package/dist/row-resize.d.ts +3 -0
  153. package/dist/row-resize.js +14 -0
  154. package/dist/scroll-sync.d.ts +1 -0
  155. package/dist/scroll-sync.js +24 -0
  156. package/dist/selection.d.ts +16 -0
  157. package/dist/selection.js +108 -16
  158. package/dist/shortcut-registry.d.ts +145 -0
  159. package/dist/shortcut-registry.js +44 -0
  160. package/dist/svgrid-wrapper.types.d.ts +213 -22
  161. package/dist/virtualization/virtualizer.js +38 -17
  162. package/package.json +6 -1
  163. package/src/GridMenus.svelte +44 -2
  164. package/src/SvChartMenu.svelte +69 -0
  165. package/src/SvChartPanes.svelte +113 -0
  166. package/src/SvChartPanes.test.ts +66 -0
  167. package/src/SvGrid.controller.svelte.ts +629 -172
  168. package/src/SvGrid.css +105 -2
  169. package/src/SvGrid.svelte +386 -514
  170. package/src/SvGrid.types.ts +188 -8
  171. package/src/SvGridCellEditor.svelte +17 -0
  172. package/src/SvGridChart.svelte +2257 -329
  173. package/src/SvGridChart.test.ts +1419 -1
  174. package/src/SvGridChart.types.ts +336 -0
  175. package/src/SvGridChartBuilder.svelte +323 -0
  176. package/src/SvGridChartPanel.svelte +221 -275
  177. package/src/SvGridChartPickers.svelte +417 -0
  178. package/src/SvGridChartView.svelte +13 -14
  179. package/src/SvModal.svelte +7 -1
  180. package/src/SvModal.test.ts +9 -0
  181. package/src/ai.test.ts +57 -2
  182. package/src/ai.ts +166 -22
  183. package/src/aria.d.ts +11 -0
  184. package/src/build-api.coverage.test.ts +184 -0
  185. package/src/build-api.ts +107 -18
  186. package/src/chart-axes.test.ts +573 -0
  187. package/src/chart-axes.ts +342 -0
  188. package/src/chart-cartesian.ts +1863 -0
  189. package/src/chart-decimate.test.ts +249 -0
  190. package/src/chart-decimate.ts +186 -0
  191. package/src/chart-export-pdf.test.ts +91 -0
  192. package/src/chart-export-pdf.ts +207 -0
  193. package/src/chart-export.test.ts +14 -0
  194. package/src/chart-export.ts +13 -3
  195. package/src/chart-financial.ts +208 -0
  196. package/src/chart-flow.ts +286 -0
  197. package/src/chart-format.ts +67 -0
  198. package/src/chart-grid.ts +179 -0
  199. package/src/chart-hierarchy.ts +135 -0
  200. package/src/chart-indicators.test.ts +443 -0
  201. package/src/chart-indicators.ts +384 -0
  202. package/src/chart-messages.test.ts +21 -0
  203. package/src/chart-messages.ts +184 -0
  204. package/src/chart-motion.test.ts +71 -0
  205. package/src/chart-motion.ts +148 -0
  206. package/src/chart-panel-messages.test.ts +29 -0
  207. package/src/chart-panel-messages.ts +550 -0
  208. package/src/chart-pivot.test.ts +54 -0
  209. package/src/chart-pivot.ts +225 -0
  210. package/src/chart-polar.ts +674 -0
  211. package/src/chart-samples.ts +106 -0
  212. package/src/chart-scale.ts +394 -0
  213. package/src/chart-series-types.test.ts +714 -0
  214. package/src/chart-stats.ts +409 -0
  215. package/src/chart-stream.test.ts +75 -0
  216. package/src/chart-stream.ts +114 -0
  217. package/src/chart-summary.test.ts +90 -0
  218. package/src/chart-summary.ts +197 -0
  219. package/src/chart-sync.svelte.ts +41 -0
  220. package/src/chart-table.test.ts +76 -0
  221. package/src/chart-table.ts +178 -0
  222. package/src/chart-trend.ts +47 -0
  223. package/src/chart-types.ts +1309 -0
  224. package/src/chart-validate.test.ts +100 -0
  225. package/src/chart-validate.ts +247 -0
  226. package/src/chart-zoom.test.ts +137 -0
  227. package/src/chart-zoom.ts +124 -0
  228. package/src/chart.coverage.test.ts +81 -0
  229. package/src/chart.test.ts +56 -3
  230. package/src/chart.ts +557 -2784
  231. package/src/clipboard.test.ts +151 -0
  232. package/src/clipboard.ts +145 -16
  233. package/src/column-resize.ts +7 -1
  234. package/src/columns.ts +2 -0
  235. package/src/command-context.test.ts +200 -0
  236. package/src/command-context.ts +137 -0
  237. package/src/core.ts +7 -0
  238. package/src/editing.test.ts +281 -3
  239. package/src/editing.ts +256 -38
  240. package/src/fill-patterns.test.ts +35 -0
  241. package/src/fill-patterns.ts +56 -2
  242. package/src/grid-messages.ts +16 -3
  243. package/src/history.test.ts +196 -0
  244. package/src/history.ts +162 -0
  245. package/src/icon-seam.test.ts +3 -2
  246. package/src/index.ts +150 -2
  247. package/src/keyboard-handlers.coverage.test.ts +126 -6
  248. package/src/keyboard-handlers.ts +91 -30
  249. package/src/keyboard-shortcuts.seam.test.ts +200 -0
  250. package/src/keyboard.test.ts +124 -1
  251. package/src/keyboard.ts +142 -0
  252. package/src/menus.test.ts +26 -0
  253. package/src/menus.ts +10 -3
  254. package/src/merges.test.ts +112 -0
  255. package/src/merges.ts +168 -0
  256. package/src/pivot.grid.test.ts +40 -5
  257. package/src/row-resize.test.ts +44 -0
  258. package/src/row-resize.ts +17 -0
  259. package/src/scroll-sync.test.ts +42 -1
  260. package/src/scroll-sync.ts +25 -0
  261. package/src/selection.multi-range.test.ts +34 -0
  262. package/src/selection.test.ts +30 -2
  263. package/src/selection.ts +111 -19
  264. package/src/shortcut-registry.test.ts +97 -0
  265. package/src/shortcut-registry.ts +181 -0
  266. package/src/svgrid-wrapper.types.ts +184 -13
  267. package/src/svgrid.behavior.test.ts +135 -0
  268. package/src/svgrid.charting.test.ts +513 -3
  269. package/src/svgrid.context-menu.test.ts +31 -0
  270. package/src/svgrid.new-features.wrapper.test.ts +10 -3
  271. package/src/virtualization/virtualizer.ts +39 -17
  272. package/dist/cdn/GridMenus-DyFA-QxA.js +0 -602
  273. package/dist/cdn/GridMenus-M2XP9t0_.js +0 -603
  274. package/dist/cdn/SvDateTimePicker-CCbDZNZB.js +0 -816
  275. package/dist/cdn/SvGridChart-DAb9RbRs.js +0 -1480
  276. package/dist/cdn/SvGridChart-Yl-IXZFO.js +0 -1481
  277. package/dist/cdn/SvGridChartPanel-DayQpDsR.js +0 -834
  278. package/dist/cdn/SvGridChartPanel-aqf8n-vJ.js +0 -810
  279. package/dist/cdn/SvGridChartView-CxfakxR0.js +0 -56
  280. package/dist/cdn/SvGridChartView-Dm_YEx9L.js +0 -55
  281. package/dist/cdn/chart-CKJRCPOk.js +0 -1652
@@ -1,834 +0,0 @@
1
- import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { B as t, C as n, E as r, F as i, G as a, H as o, L as s, N as c, R as l, U as u, V as d, X as f, Y as p, _ as m, a as h, at as g, d as _, et as v, f as y, ft as b, g as x, h as S, i as C, it as w, k as T, lt as E, nt as D, o as ee, pt as O, st as k, t as te, tt as ne, u as A, ut as re, v as j } from "./disclose-version-Dr7rEVv-.js";
3
- import { t as ie } from "./SvGridChart-DAb9RbRs.js";
4
- //#region ../../node_modules/.pnpm/svelte@5.55.9_@typescript-eslint+types@8.67.0/node_modules/svelte/src/transition/index.js
5
- function M(e) {
6
- let t = e - 1;
7
- return t * t * t + 1;
8
- }
9
- function N(e) {
10
- let t = typeof e == "string" && e.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);
11
- return t ? [parseFloat(t[1]), t[2] || "px"] : [e, "px"];
12
- }
13
- function P(e, { delay: t = 0, duration: n = 400, easing: r = M, x: i = 0, y: a = 0, opacity: o = 0 } = {}) {
14
- let s = getComputedStyle(e), c = +s.opacity, l = s.transform === "none" ? "" : s.transform, u = c * (1 - o), [d, f] = N(i), [p, m] = N(a);
15
- return {
16
- delay: t,
17
- duration: n,
18
- easing: r,
19
- css: (e, t) => `
20
- transform: ${l} translate(${(1 - e) * d}${f}, ${(1 - e) * p}${m});
21
- opacity: ${c - u * t}`
22
- };
23
- }
24
- //#endregion
25
- //#region ../../node_modules/.pnpm/svelte@5.55.9_@typescript-eslint+types@8.67.0/node_modules/svelte/src/easing/index.js
26
- function ae(e) {
27
- let t = e - 1;
28
- return t * t * t + 1;
29
- }
30
- //#endregion
31
- //#region src/chart-export.ts
32
- function F(e) {
33
- return e instanceof SVGSVGElement ? e : e.querySelector("svg.sv-grid-chart-svg") ?? e.querySelector("svg");
34
- }
35
- function I(e, t, n) {
36
- return getComputedStyle(e).getPropertyValue(t).trim() || n;
37
- }
38
- function L(e, t = {}) {
39
- let n = F(e);
40
- if (!n) throw Error("chartToSvgString: no <svg> found");
41
- let r = I(n, "--sg-fg", "#0f172a"), i = I(n, "--sg-muted", "#64748b"), a = I(n, "--sg-border", "#e2e8f0"), o = t.background ?? I(n, "--sg-bg", "#ffffff"), s = n.viewBox.baseVal, c = s && s.width ? s.width : n.clientWidth || 520, l = s && s.height ? s.height : n.clientHeight || 300, u = n.cloneNode(!0);
42
- u.setAttribute("width", String(c)), u.setAttribute("height", String(l)), u.setAttribute("xmlns", "http://www.w3.org/2000/svg");
43
- let d = [
44
- "fill",
45
- "fill-opacity",
46
- "stroke",
47
- "stroke-width",
48
- "stroke-opacity",
49
- "stroke-dasharray",
50
- "stroke-linecap",
51
- "stroke-linejoin",
52
- "opacity",
53
- "font-size",
54
- "font-family",
55
- "font-weight",
56
- "text-anchor"
57
- ], f = n.querySelectorAll("*"), p = u.querySelectorAll("*");
58
- for (let e = 0; e < f.length; e += 1) {
59
- let t = p[e];
60
- if (!t || !t.style) continue;
61
- let n = getComputedStyle(f[e]);
62
- for (let e of d) {
63
- let r = n.getPropertyValue(e);
64
- r && r !== "normal" && t.style.setProperty(e, r);
65
- }
66
- }
67
- u.querySelectorAll(".sv-grid-chart-hit").forEach((e) => e.remove());
68
- let m = document.createElementNS("http://www.w3.org/2000/svg", "style");
69
- m.textContent = `
70
- .sv-grid-chart-axis { fill: ${i}; font-size: 10px; font-family: sans-serif; }
71
- .sv-grid-chart-gridline { stroke: ${a}; stroke-width: 1; opacity: 0.6; }
72
- .sv-grid-chart-gridline.is-zero { stroke: ${i}; opacity: 0.9; }
73
- .sv-grid-chart-datalabel { fill: ${r}; font-size: 9.5px; font-weight: 600; font-family: sans-serif; }
74
- .sv-grid-chart-datalabel.on-bar { fill: #fff; }
75
- .sv-grid-chart-donut-total { fill: ${r}; font-size: 16px; font-weight: 800; font-family: sans-serif; }
76
- .sv-grid-chart-donut-label { fill: ${i}; font-size: 10px; font-family: sans-serif; }
77
- `, u.insertBefore(m, u.firstChild);
78
- let h = document.createElementNS("http://www.w3.org/2000/svg", "rect");
79
- return h.setAttribute("x", "0"), h.setAttribute("y", "0"), h.setAttribute("width", String(c)), h.setAttribute("height", String(l)), h.setAttribute("fill", o), u.insertBefore(h, m.nextSibling), new XMLSerializer().serializeToString(u);
80
- }
81
- function R(e, t) {
82
- let n = document.createElement("a");
83
- n.href = e, n.download = t, document.body.appendChild(n), n.click(), n.remove();
84
- }
85
- function oe(e, t = "chart.svg", n = {}) {
86
- let r = L(e, n), i = URL.createObjectURL(new Blob([r], { type: "image/svg+xml" }));
87
- R(i, t), setTimeout(() => URL.revokeObjectURL(i), 1e3);
88
- }
89
- function se(e, t = {}) {
90
- let n = L(e, t), r = t.scale ?? 2, i = F(e), a = i.viewBox.baseVal, o = (a && a.width ? a.width : i.clientWidth || 520) * r, s = (a && a.height ? a.height : i.clientHeight || 300) * r;
91
- return new Promise((e, t) => {
92
- let r = URL.createObjectURL(new Blob([n], { type: "image/svg+xml" })), i = new Image();
93
- i.onload = () => {
94
- let n = document.createElement("canvas");
95
- n.width = Math.round(o), n.height = Math.round(s);
96
- let a = n.getContext("2d");
97
- if (!a) {
98
- URL.revokeObjectURL(r), t(/* @__PURE__ */ Error("canvas 2d context unavailable"));
99
- return;
100
- }
101
- a.drawImage(i, 0, 0, n.width, n.height), URL.revokeObjectURL(r), n.toBlob((n) => n ? e(n) : t(/* @__PURE__ */ Error("toBlob failed")), "image/png");
102
- }, i.onerror = () => {
103
- URL.revokeObjectURL(r), t(/* @__PURE__ */ Error("failed to rasterize chart SVG"));
104
- }, i.src = r;
105
- });
106
- }
107
- async function z(e, t = "chart.png", n = {}) {
108
- let r = await se(e, n), i = URL.createObjectURL(r);
109
- R(i, t), setTimeout(() => URL.revokeObjectURL(i), 1e3);
110
- }
111
- var B = (e) => {
112
- let t = e == null ? "" : String(e);
113
- return /[",\n]/.test(t) ? `"${t.replace(/"/g, "\"\"")}"` : t;
114
- };
115
- function V(e) {
116
- let t = e.series ?? [];
117
- if (t.some((e) => e.points?.length)) {
118
- let e = [
119
- "Series",
120
- "X",
121
- "Y",
122
- "Size",
123
- "Label"
124
- ].map(B).join(","), n = [];
125
- for (let e of t) for (let t of e.points ?? []) n.push([
126
- e.label,
127
- t.x,
128
- t.y,
129
- t.r ?? "",
130
- t.label ?? ""
131
- ].map(B).join(","));
132
- return n.length ? [e, ...n].join("\n") : "";
133
- }
134
- let n = e.categories ?? [];
135
- if (!n.length || !t.length) return "";
136
- let r = ["Category"];
137
- for (let e of t) e.ohlc ? r.push(`${e.label} Open`, `${e.label} High`, `${e.label} Low`, `${e.label} Close`) : e.boxes ? r.push(`${e.label} Min`, `${e.label} Q1`, `${e.label} Median`, `${e.label} Q3`, `${e.label} Max`, `${e.label} Outliers`) : e.errors ? r.push(e.label, `${e.label} Low`, `${e.label} High`) : r.push(e.label);
138
- let i = n.map((e, n) => {
139
- let r = [e];
140
- for (let e of t) if (e.ohlc) {
141
- let t = e.ohlc[n];
142
- r.push(t?.o ?? "", t?.h ?? "", t?.l ?? "", t?.c ?? "");
143
- } else if (e.boxes) {
144
- let t = e.boxes[n];
145
- r.push(t?.min ?? "", t?.q1 ?? "", t?.median ?? "", t?.q3 ?? "", t?.max ?? "", t?.outliers?.join(" ") ?? "");
146
- } else if (e.errors) {
147
- let t = e.values[n], i = e.errors[n], a = i == null ? "" : typeof i == "number" ? (t ?? 0) - Math.abs(i) : Math.min(i.lo, i.hi), o = i == null ? "" : typeof i == "number" ? (t ?? 0) + Math.abs(i) : Math.max(i.lo, i.hi);
148
- r.push(t ?? "", a, o);
149
- } else r.push(e.values[n] ?? "");
150
- return r.map(B).join(",");
151
- });
152
- return [r.map(B).join(","), ...i].join("\n");
153
- }
154
- function H(e) {
155
- let t = e.series ?? [];
156
- return t.some((e) => e.points?.length) ? !0 : !!(e.categories?.length && t.length);
157
- }
158
- function ce(e, t = "chart.csv") {
159
- let n = V(e);
160
- if (!n) return !1;
161
- let r = URL.createObjectURL(new Blob([n], { type: "text/csv;charset=utf-8" }));
162
- return R(r, t), setTimeout(() => URL.revokeObjectURL(r), 1e3), !0;
163
- }
164
- //#endregion
165
- //#region src/SvGridChartPanel.svelte
166
- var U = /* @__PURE__ */ e({ default: () => W }), le = s("<div role=\"separator\" aria-label=\"Resize chart panel\"></div>"), ue = s("<button type=\"button\" class=\"sv-grid-chart-btn\">Clear filter</button>"), de = l("<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><polyline points=\"20 6 9 17 4 12\"></polyline></svg>"), fe = l("<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\"></path><polyline points=\"7 10 12 15 17 10\"></polyline><line x1=\"12\" y1=\"15\" x2=\"12\" y2=\"3\"></line></svg>"), pe = s("<div class=\"sv-grid-chart-export-menu\" role=\"menu\"><button type=\"button\" role=\"menuitem\">PNG image</button> <button type=\"button\" role=\"menuitem\">SVG vector</button> <button type=\"button\" role=\"menuitem\">CSV data</button> <button type=\"button\" role=\"menuitem\">Copy to clipboard</button></div>"), me = s("<button type=\"button\" aria-label=\"Chart with AI\" title=\"Chart with AI\"><svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\"><path d=\"M12 2l1.9 4.6L18.5 8.5 13.9 10.4 12 15l-1.9-4.6L5.5 8.5l4.6-1.9L12 2zm6 11l1 2.4 2.4 1-2.4 1L18 21l-1-2.6-2.4-1 2.4-1L18 13zM6 14l.8 2 2 .8-2 .8L6 20l-.8-2.4-2-.8 2-.8L6 14z\"></path></svg> AI</button>"), he = s("<button type=\"button\" class=\"sv-grid-chart-icon-btn\" aria-label=\"Add chart\" title=\"Add chart\"><svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"></line><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"></line></svg></button>"), ge = l("<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M8 3v3a2 2 0 0 1-2 2H3\"></path><path d=\"M21 8h-3a2 2 0 0 1-2-2V3\"></path><path d=\"M3 16h3a2 2 0 0 1 2 2v3\"></path><path d=\"M16 21v-3a2 2 0 0 1 2-2h3\"></path></svg>"), _e = l("<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M8 3H5a2 2 0 0 0-2 2v3\"></path><path d=\"M21 8V5a2 2 0 0 0-2-2h-3\"></path><path d=\"M3 16v3a2 2 0 0 0 2 2h3\"></path><path d=\"M16 21h3a2 2 0 0 0 2-2v-3\"></path></svg>"), ve = s("<button type=\"button\" class=\"sv-grid-chart-icon-btn\"><!></button> <button type=\"button\" class=\"sv-grid-chart-icon-btn\" aria-label=\"Dock chart\" title=\"Dock\"><svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"></rect><line x1=\"15\" y1=\"3\" x2=\"15\" y2=\"21\"></line></svg></button>", 1), ye = s("<button type=\"button\" class=\"sv-grid-chart-icon-btn\" aria-label=\"Pop out chart\" title=\"Pop out\"><svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M15 3h6v6\"></path><path d=\"M10 14 21 3\"></path><path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\"></path></svg></button>"), be = s("<div><button type=\"button\" class=\"sv-grid-chart-tab-label\" role=\"tab\"> </button> <button type=\"button\" class=\"sv-grid-chart-tab-x\" title=\"Remove\">&times;</button></div>"), xe = s("<div class=\"sv-grid-chart-tabs\" role=\"tablist\" aria-label=\"Charts\"></div>"), Se = s("<p class=\"sv-grid-chart-ai-msg is-error\"> </p>"), Ce = s("<p class=\"sv-grid-chart-ai-msg\"> </p>"), we = s("<div class=\"sv-grid-chart-ai\"><form class=\"sv-grid-chart-ai-row\"><input class=\"sv-grid-chart-ai-input\" type=\"text\" placeholder=\"Describe a chart, e.g. revenue by region stacked by product\"/> <button type=\"submit\" class=\"sv-grid-chart-btn\"> </button></form> <!></div>"), Te = s("<option> </option>"), Ee = s("<optgroup></optgroup>"), De = s("<option> </option>"), Oe = s("<label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\"> </span> <select></select></label>"), ke = s("<option> </option>"), Ae = s("<label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\"> </span> <select><option>(none)</option><!></select></label>"), je = s("<option> </option>"), Me = s("<option> </option>"), Ne = s("<label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\">Y</span> <select></select></label>"), Pe = s("<option> </option>"), Fe = s("<label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\">Aggregate</span> <select></select></label>"), Ie = s("<option> </option>"), Le = s("<label class=\"sv-grid-chart-toggle\"><input type=\"checkbox\"/> Stacked</label> <label class=\"sv-grid-chart-toggle\" title=\"Normalise each category to 100 percent\"><input type=\"checkbox\"/> 100%</label>", 1), Re = s("<label class=\"sv-grid-chart-toggle\" title=\"Bars grow rightwards - suits long category labels\"><input type=\"checkbox\"/> Horizontal</label>"), ze = s("<label class=\"sv-grid-chart-toggle\"><input type=\"checkbox\"/> Donut</label>"), Be = s("<option> </option>"), Ve = s("<label class=\"sv-grid-chart-toggle\"><input type=\"checkbox\"/> Labels</label>"), He = s("<label class=\"sv-grid-chart-toggle\" title=\"Logarithmic value axis - flattens wide-range data\"><input type=\"checkbox\"/> Log scale</label>"), Ue = s("<label class=\"sv-grid-chart-toggle\" title=\"Space points by actual date - real time ticks and proportional gaps\"><input type=\"checkbox\"/> Date axis</label>"), We = s("<label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\">Type</span> <select></select></label> <!> <!> <label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\"> </span> <select></select></label> <!> <!> <label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\">Format</span> <select></select></label> <!> <!> <!> <label class=\"sv-grid-chart-ctl\"><span class=\"sv-grid-chart-ctl-lbl\">Colours</span> <select></select></label> <!> <!> <!>", 1), Ge = s("<p class=\"sv-grid-chart-hint\" role=\"note\"> </p>"), Ke = s("<p class=\"sv-grid-chart-empty\"><!></p>"), qe = s("<div class=\"sv-grid-chart-float-resizer\" role=\"separator\" aria-label=\"Resize chart window\"></div>"), Je = s("<section aria-label=\"Chart\"><!> <header class=\"sv-grid-chart-panel-head\"><div><svg class=\"sv-grid-chart-title-icon\" width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><line x1=\"12\" y1=\"20\" x2=\"12\" y2=\"10\"></line><line x1=\"18\" y1=\"20\" x2=\"18\" y2=\"4\"></line><line x1=\"6\" y1=\"20\" x2=\"6\" y2=\"16\"></line></svg> <span class=\"sv-grid-chart-title\">Chart</span> <div class=\"sv-grid-chart-actions\"><!> <div class=\"sv-grid-chart-export\"><button type=\"button\" class=\"sv-grid-chart-icon-btn\" aria-label=\"Export chart\" title=\"Export\"><!></button> <!></div> <!> <!> <!> <button type=\"button\" class=\"sv-grid-chart-close\" aria-label=\"Close chart\">&times;</button></div></div> <!> <!> <div class=\"sv-grid-chart-controls\"><!> <!></div></header> <div class=\"sv-grid-chart-panel-body\"><!></div> <!></section>");
167
- function W(e, s) {
168
- re(s, !0);
169
- let l = te(s, "ctrl", 7), d = k(() => l().chartingConfig), M = k(() => l().chartCfg), N = k(() => l().chartIsCustom), F = k(() => a(d)?.position ?? "bottom"), I = k(() => a(d)?.crossFilter !== !1), L = k(() => l().chartSpec), R = k(() => l().chartableColumns), B = k(() => l().chartSize ?? (a(F) === "right" ? a(d)?.width ?? 340 : a(d)?.height ?? 260)), V = k(() => l().chartFloating), U = k(() => l().chartMaximized), W = k(() => l().chartFloatRect), Ye = g(null);
170
- function Xe() {
171
- let e = a(Ye)?.offsetParent;
172
- return {
173
- w: e?.clientWidth ?? 800,
174
- h: e?.clientHeight ?? 520
175
- };
176
- }
177
- function Ze() {
178
- if (!l().chartFloatRect) {
179
- let { w: e, h: t } = Xe(), n = Math.min(600, Math.max(360, e - 80)), r = Math.min(430, Math.max(260, t - 90));
180
- l().chartFloatRect = {
181
- x: Math.round((e - n) / 2),
182
- y: Math.round((t - r) / 2),
183
- w: n,
184
- h: r
185
- };
186
- }
187
- l().chartFloating = !0;
188
- }
189
- function Qe() {
190
- l().chartFloating = !1, l().chartMaximized = !1;
191
- }
192
- let $e = () => l().chartMaximized = !l().chartMaximized;
193
- function et(e) {
194
- if (!a(V) || a(U) || e.target?.closest("button")) return;
195
- let t = l().chartFloatRect;
196
- if (!t) return;
197
- e.preventDefault();
198
- let n = e.clientX, r = e.clientY, { w: i, h: o } = Xe(), s = (e) => {
199
- let a = Math.max(0, Math.min(i - t.w, t.x + e.clientX - n)), s = Math.max(0, Math.min(o - t.h, t.y + e.clientY - r));
200
- l().chartFloatRect = {
201
- x: a,
202
- y: s,
203
- w: t.w,
204
- h: t.h
205
- };
206
- }, c = () => {
207
- window.removeEventListener("pointermove", s), window.removeEventListener("pointerup", c);
208
- };
209
- window.addEventListener("pointermove", s), window.addEventListener("pointerup", c);
210
- }
211
- function tt(e) {
212
- let t = l().chartFloatRect;
213
- if (!t) return;
214
- e.preventDefault(), e.stopPropagation();
215
- let n = e.clientX, r = e.clientY;
216
- e.target.setPointerCapture?.(e.pointerId);
217
- let i = (e) => {
218
- l().chartFloatRect = {
219
- x: t.x,
220
- y: t.y,
221
- w: Math.max(300, t.w + e.clientX - n),
222
- h: Math.max(220, t.h + e.clientY - r)
223
- };
224
- }, a = () => {
225
- window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", a);
226
- };
227
- window.addEventListener("pointermove", i), window.addEventListener("pointerup", a);
228
- }
229
- let nt = k(() => a(V) ? a(U) ? "left:12px; top:12px; right:12px; bottom:12px; width:auto; height:auto;" : a(W) ? `left:${a(W).x}px; top:${a(W).y}px; width:${a(W).w}px; height:${a(W).h}px;` : "" : a(F) === "right" ? `width:${a(B)}px` : `height:${a(B)}px`), rt = g(0), it = g(0), at = k(() => a(L) ? a(L).type === "pie" ? a(L).categories.length : a(L).series.length : 0), ot = k(() => (a(at) > 1 ? 36 : 0) + (a(M)?.export === !0 ? 30 : 0)), st = k(() => a(rt) > 24 ? a(rt) - 8 : void 0), ct = k(() => a(it) > 24 ? Math.max(120, a(it) - 8 - a(ot)) : void 0), lt = [
230
- {
231
- value: "bar",
232
- label: "Bar",
233
- group: "Compare"
234
- },
235
- {
236
- value: "line",
237
- label: "Line",
238
- group: "Compare"
239
- },
240
- {
241
- value: "area",
242
- label: "Area",
243
- group: "Compare"
244
- },
245
- {
246
- value: "pie",
247
- label: "Pie",
248
- group: "Part of a whole"
249
- },
250
- {
251
- value: "treemap",
252
- label: "Tree map",
253
- group: "Part of a whole"
254
- },
255
- {
256
- value: "funnel",
257
- label: "Funnel",
258
- group: "Flow"
259
- },
260
- {
261
- value: "waterfall",
262
- label: "Waterfall",
263
- group: "Flow"
264
- },
265
- {
266
- value: "sankey",
267
- label: "Sankey",
268
- group: "Flow",
269
- needs: (e) => e.dims.length >= 2
270
- },
271
- {
272
- value: "radar",
273
- label: "Radar",
274
- group: "Distribution"
275
- },
276
- {
277
- value: "heatmap",
278
- label: "Heat map",
279
- group: "Distribution",
280
- needs: (e) => e.dims.length >= 2
281
- },
282
- {
283
- value: "scatter",
284
- label: "Scatter",
285
- group: "Distribution",
286
- needs: (e) => e.measures.length >= 2
287
- },
288
- {
289
- value: "boxplot",
290
- label: "Box plot",
291
- group: "Distribution"
292
- },
293
- {
294
- value: "gauge",
295
- label: "Gauge",
296
- group: "Single value"
297
- },
298
- {
299
- value: "calendar",
300
- label: "Calendar",
301
- group: "Over time",
302
- needs: (e) => e.dates.length >= 1
303
- }
304
- ], ut = k(() => lt.filter((e) => !e.needs || e.needs(a(R)))), dt = [
305
- "bar",
306
- "line",
307
- "area"
308
- ], ft = [
309
- {
310
- key: "theme",
311
- label: "Theme",
312
- colors: null
313
- },
314
- {
315
- key: "ocean",
316
- label: "Ocean",
317
- colors: [
318
- "#0ea5e9",
319
- "#14b8a6",
320
- "#6366f1",
321
- "#8b5cf6",
322
- "#06b6d4"
323
- ]
324
- },
325
- {
326
- key: "sunset",
327
- label: "Sunset",
328
- colors: [
329
- "#f59e0b",
330
- "#ef4444",
331
- "#ec4899",
332
- "#8b5cf6",
333
- "#f97316"
334
- ]
335
- },
336
- {
337
- key: "forest",
338
- label: "Forest",
339
- colors: [
340
- "#16a34a",
341
- "#65a30d",
342
- "#0d9488",
343
- "#4d7c0f",
344
- "#0891b2"
345
- ]
346
- },
347
- {
348
- key: "slate",
349
- label: "Slate",
350
- colors: [
351
- "#475569",
352
- "#0ea5e9",
353
- "#64748b",
354
- "#38bdf8",
355
- "#94a3b8"
356
- ]
357
- }
358
- ], pt = k(() => ft.find((e) => e.colors && l().chartPalette && e.colors.join() === l().chartPalette.join())?.key ?? "theme"), mt = k(() => l().chartType === "bar"), ht = k(() => l().chartType === "pie"), gt = k(() => l().chartType !== "gauge"), _t = k(() => a(R).dims.length > 1 && ![
359
- "pie",
360
- "gauge",
361
- "waterfall",
362
- "funnel",
363
- "calendar"
364
- ].includes(l().chartType)), vt = k(() => dt.includes(l().chartType)), yt = k(() => dt.includes(l().chartType) || l().chartType === "scatter" || l().chartType === "boxplot"), bt = k(() => ![
365
- "gauge",
366
- "sankey",
367
- "calendar",
368
- "treemap",
369
- "scatter",
370
- "boxplot"
371
- ].includes(l().chartType)), xt = k(() => l().chartType === "scatter"), St = k(() => !a(xt) && l().chartType !== "boxplot"), Ct = k(() => [...new Set(a(ut).map((e) => e.group))]), wt = k(() => {
372
- let e = l().chartType, t = l().chartSpec?.categories.length ?? 0;
373
- return e === "heatmap" && !l().chartSeriesId && a(R).dims.length > 1 ? "Heat map needs a Split by column for its rows." : e === "sankey" && !l().chartSeriesId ? "Sankey needs a Split by column: Group by is the source, Split by the target." : e === "radar" && t > 0 && t < 3 ? "Radar needs at least 3 groups." : e === "funnel" && t === 1 ? "Funnel needs at least 2 stages." : null;
374
- }), Tt = [
375
- {
376
- value: "sum",
377
- label: "Sum"
378
- },
379
- {
380
- value: "avg",
381
- label: "Average"
382
- },
383
- {
384
- value: "count",
385
- label: "Count"
386
- }
387
- ], Et = [
388
- {
389
- value: "number",
390
- label: "Number"
391
- },
392
- {
393
- value: "currency",
394
- label: "Currency"
395
- },
396
- {
397
- value: "percent",
398
- label: "Percent"
399
- }
400
- ];
401
- function Dt(e) {
402
- a(I) && e.category != null && l().applyChartCrossFilter(String(e.category));
403
- }
404
- let Ot = g(null), G = g(!1), kt = g(!1), At = () => a(Ot)?.querySelector("svg") ?? null, jt = k(() => !!a(L) && H(a(L)));
405
- function Mt() {
406
- let e = At();
407
- e && z(e, "chart.png"), w(G, !1);
408
- }
409
- function Nt() {
410
- let e = At();
411
- e && oe(e, "chart.svg"), w(G, !1);
412
- }
413
- function Pt() {
414
- a(L) && ce(a(L), "chart.csv"), w(G, !1);
415
- }
416
- async function Ft() {
417
- let e = At();
418
- if (w(G, !1), !(!e || typeof ClipboardItem > "u" || !navigator.clipboard?.write)) try {
419
- let t = await se(e);
420
- await navigator.clipboard.write([new ClipboardItem({ "image/png": t })]), w(kt, !0), setTimeout(() => w(kt, !1), 1400);
421
- } catch {}
422
- }
423
- f(() => {
424
- if (!a(G)) return;
425
- let e = (e) => {
426
- e.target?.closest(".sv-grid-chart-export") || w(G, !1);
427
- };
428
- return window.addEventListener("pointerdown", e), () => window.removeEventListener("pointerdown", e);
429
- });
430
- let It = k(() => !!l().chartAiHandler), K = g(!1), q = g(""), J = g(!1), Y = g(""), Lt = g("");
431
- async function Rt() {
432
- let e = l().chartAiHandler, t = a(q).trim();
433
- if (!(!e || !t || a(J))) {
434
- w(J, !0), w(Y, ""), w(Lt, "");
435
- try {
436
- let n = await e(t);
437
- n ? (l().applyChartConfig(n), w(Lt, typeof n.rationale == "string" ? n.rationale : "", !0)) : w(Y, "Couldn't build a chart from that request.");
438
- } catch (e) {
439
- w(Y, e instanceof Error ? e.message : "Something went wrong.", !0);
440
- } finally {
441
- w(J, !1);
442
- }
443
- }
444
- }
445
- let zt = g(!1);
446
- function Bt(e) {
447
- e.preventDefault(), w(zt, !0);
448
- let t = a(F) === "right" ? e.clientX : e.clientY, n = a(B);
449
- e.target.setPointerCapture?.(e.pointerId);
450
- let r = (e) => {
451
- let r = a(F) === "right" ? t - e.clientX : t - e.clientY;
452
- l().chartSize = Math.max(160, Math.min(720, n + r));
453
- }, i = () => {
454
- w(zt, !1), window.removeEventListener("pointermove", r), window.removeEventListener("pointerup", i);
455
- };
456
- window.addEventListener("pointermove", r), window.addEventListener("pointerup", i);
457
- }
458
- var X = Je();
459
- let Vt;
460
- var Ht = v(X), Ut = (e) => {
461
- var t = le();
462
- let n;
463
- p(() => {
464
- n = j(t, 1, "sv-grid-chart-resizer", null, n, { "is-dragging": a(zt) }), _(t, "aria-orientation", a(F) === "right" ? "vertical" : "horizontal");
465
- }), o("pointerdown", t, Bt), i(e, t);
466
- };
467
- T(Ht, (e) => {
468
- a(V) || e(Ut);
469
- });
470
- var Wt = D(Ht, 2), Z = v(Wt);
471
- let Gt;
472
- var Kt = D(v(Z), 4), qt = v(Kt), Jt = (e) => {
473
- var t = ue();
474
- o("click", t, () => l().clearChartCrossFilter()), i(e, t);
475
- };
476
- T(qt, (e) => {
477
- a(I) && !a(N) && e(Jt);
478
- });
479
- var Yt = D(qt, 2), Q = v(Yt), Xt = v(Q), Zt = (e) => {
480
- var t = de();
481
- i(e, t);
482
- }, Qt = (e) => {
483
- var t = fe();
484
- i(e, t);
485
- };
486
- T(Xt, (e) => {
487
- a(kt) ? e(Zt) : e(Qt, -1);
488
- }), O(Q);
489
- var $t = D(Q, 2), en = (e) => {
490
- var t = pe(), n = v(t), r = D(n, 2), s = D(r, 2), c = D(s, 2);
491
- O(t), p(() => s.disabled = !a(jt)), o("click", n, Mt), o("click", r, Nt), o("click", s, Pt), o("click", c, Ft), i(e, t);
492
- };
493
- T($t, (e) => {
494
- a(G) && e(en);
495
- }), O(Yt);
496
- var tn = D(Yt, 2), nn = (e) => {
497
- var t = me();
498
- let n;
499
- p(() => {
500
- n = j(t, 1, "sv-grid-chart-btn sv-grid-chart-ai-btn", null, n, { "is-active": a(K) }), _(t, "aria-expanded", a(K));
501
- }), o("click", t, () => w(K, !a(K))), i(e, t);
502
- };
503
- T(tn, (e) => {
504
- a(It) && !a(N) && e(nn);
505
- });
506
- var rn = D(tn, 2), an = (e) => {
507
- var t = he();
508
- o("click", t, () => l().addChart()), i(e, t);
509
- };
510
- T(rn, (e) => {
511
- a(N) || e(an);
512
- });
513
- var on = D(rn, 2), sn = (e) => {
514
- var t = ve(), n = ne(t), r = v(n), s = (e) => {
515
- var t = ge();
516
- i(e, t);
517
- }, c = (e) => {
518
- var t = _e();
519
- i(e, t);
520
- };
521
- T(r, (e) => {
522
- a(U) ? e(s) : e(c, -1);
523
- }), O(n);
524
- var l = D(n, 2);
525
- p(() => {
526
- _(n, "aria-label", a(U) ? "Restore" : "Maximize"), _(n, "title", a(U) ? "Restore" : "Maximize");
527
- }), o("click", n, $e), o("click", l, Qe), i(e, t);
528
- }, cn = (e) => {
529
- var t = ye();
530
- o("click", t, Ze), i(e, t);
531
- };
532
- T(on, (e) => {
533
- a(V) ? e(sn) : e(cn, -1);
534
- });
535
- var ln = D(on, 2);
536
- O(Kt), O(Z);
537
- var un = D(Z, 2), dn = (e) => {
538
- var t = xe();
539
- r(t, 23, () => l().charts, (e) => e.id, (e, t, n) => {
540
- var r = be();
541
- let s;
542
- var u = v(r), d = v(u, !0);
543
- O(u);
544
- var f = D(u, 2);
545
- O(r), p(() => {
546
- s = j(r, 1, "sv-grid-chart-tab", null, s, { "is-active": a(n) === l().activeChartIndex }), _(u, "aria-selected", a(n) === l().activeChartIndex), c(d, a(t).title), _(f, "aria-label", `Remove ${a(t).title}`);
547
- }), o("click", u, () => l().activeChartIndex = a(n)), o("click", f, () => l().removeChart(a(n))), i(e, r);
548
- }), O(t), i(e, t);
549
- };
550
- T(un, (e) => {
551
- !a(N) && l().charts.length > 1 && e(dn);
552
- });
553
- var fn = D(un, 2), pn = (e) => {
554
- var t = we(), n = v(t), r = v(n);
555
- A(r);
556
- var o = D(r, 2), s = v(o, !0);
557
- O(o), O(n);
558
- var l = D(n, 2), d = (e) => {
559
- var t = Se(), n = v(t, !0);
560
- O(t), p(() => c(n, a(Y))), i(e, t);
561
- }, f = (e) => {
562
- var t = Ce(), n = v(t, !0);
563
- O(t), p(() => c(n, a(Lt))), i(e, t);
564
- };
565
- T(l, (e) => {
566
- a(Y) ? e(d) : a(Lt) && e(f, 1);
567
- }), O(t), p((e) => {
568
- r.disabled = a(J), o.disabled = e, c(s, a(J) ? "Thinking..." : "Chart it");
569
- }, [() => a(J) || !a(q).trim()]), u("submit", n, (e) => {
570
- e.preventDefault(), Rt();
571
- }), ee(r, () => a(q), (e) => w(q, e)), i(e, t);
572
- };
573
- T(fn, (e) => {
574
- a(It) && a(K) && !a(N) && e(pn);
575
- });
576
- var mn = D(fn, 2), hn = v(mn), gn = (e) => {
577
- var t = We(), n = ne(t), s = D(v(n), 2);
578
- r(s, 20, () => a(Ct), (e) => e, (e, t) => {
579
- var n = Ee();
580
- r(n, 21, () => a(ut).filter((e) => e.group === t), (e) => e.value, (e, t) => {
581
- var n = Te(), r = v(n, !0);
582
- O(n);
583
- var o = {};
584
- p(() => {
585
- c(r, a(t).label), o !== (o = a(t).value) && (n.value = (n.__value = a(t).value) ?? "");
586
- }), i(e, n);
587
- }), O(n), p(() => _(n, "label", t)), i(e, n);
588
- }), O(s);
589
- var u;
590
- S(s), O(n);
591
- var d = D(n, 2), f = (e) => {
592
- var t = Oe(), n = v(t), s = v(n, !0);
593
- O(n);
594
- var u = D(n, 2);
595
- r(u, 21, () => a(R).dims, (e) => e.id, (e, t) => {
596
- var n = De(), r = v(n, !0);
597
- O(n);
598
- var o = {};
599
- p(() => {
600
- c(r, a(t).label), o !== (o = a(t).id) && (n.value = (n.__value = a(t).id) ?? "");
601
- }), i(e, n);
602
- }), O(u);
603
- var d;
604
- S(u), O(t), p(() => {
605
- c(s, l().chartType === "sankey" ? "From" : l().chartType === "heatmap" ? "Columns" : "Group by"), d !== (d = l().chartDimensionId ?? "") && (u.value = (u.__value = l().chartDimensionId ?? "") ?? "", x(u, l().chartDimensionId ?? ""));
606
- }), o("change", u, (e) => l().chartDimensionId = e.currentTarget.value || null), i(e, t);
607
- };
608
- T(d, (e) => {
609
- a(gt) && e(f);
610
- });
611
- var m = D(d, 2), h = (e) => {
612
- var t = Ae(), n = v(t), s = v(n, !0);
613
- O(n);
614
- var u = D(n, 2), d = v(u);
615
- d.value = d.__value = "";
616
- var f = D(d);
617
- r(f, 17, () => a(R).dims, (e) => e.id, (e, t) => {
618
- var n = ke(), r = v(n, !0);
619
- O(n);
620
- var o = {};
621
- p(() => {
622
- c(r, a(t).label), o !== (o = a(t).id) && (n.value = (n.__value = a(t).id) ?? "");
623
- }), i(e, n);
624
- }), O(u);
625
- var m;
626
- S(u), O(t), p(() => {
627
- c(s, l().chartType === "sankey" ? "To" : l().chartType === "heatmap" ? "Rows" : "Split by"), m !== (m = l().chartSeriesId ?? "") && (u.value = (u.__value = l().chartSeriesId ?? "") ?? "", x(u, l().chartSeriesId ?? ""));
628
- }), o("change", u, (e) => l().chartSeriesId = e.currentTarget.value || null), i(e, t);
629
- };
630
- T(m, (e) => {
631
- a(_t) && e(h);
632
- });
633
- var g = D(m, 2), C = v(g), w = v(C, !0);
634
- O(C);
635
- var E = D(C, 2);
636
- r(E, 21, () => a(R).measures, (e) => e.id, (e, t) => {
637
- var n = je(), r = v(n, !0);
638
- O(n);
639
- var o = {};
640
- p(() => {
641
- c(r, a(t).label), o !== (o = a(t).id) && (n.value = (n.__value = a(t).id) ?? "");
642
- }), i(e, n);
643
- }), O(E);
644
- var ee;
645
- S(E), O(g);
646
- var te = D(g, 2), re = (e) => {
647
- var t = Ne(), n = D(v(t), 2);
648
- r(n, 21, () => a(R).measures, (e) => e.id, (e, t) => {
649
- var n = Me(), r = v(n, !0);
650
- O(n);
651
- var o = {};
652
- p(() => {
653
- c(r, a(t).label), o !== (o = a(t).id) && (n.value = (n.__value = a(t).id) ?? "");
654
- }), i(e, n);
655
- }), O(n);
656
- var s;
657
- S(n), O(t), p(() => {
658
- s !== (s = l().effectiveChartMeasure2Id ?? "") && (n.value = (n.__value = l().effectiveChartMeasure2Id ?? "") ?? "", x(n, l().effectiveChartMeasure2Id ?? ""));
659
- }), o("change", n, (e) => l().chartMeasure2Id = e.currentTarget.value || null), i(e, t);
660
- };
661
- T(te, (e) => {
662
- a(xt) && e(re);
663
- });
664
- var j = D(te, 2), ie = (e) => {
665
- var t = Fe(), n = D(v(t), 2);
666
- r(n, 21, () => Tt, (e) => e.value, (e, t) => {
667
- var n = Pe(), r = v(n, !0);
668
- O(n);
669
- var o = {};
670
- p(() => {
671
- c(r, a(t).label), o !== (o = a(t).value) && (n.value = (n.__value = a(t).value) ?? "");
672
- }), i(e, n);
673
- }), O(n);
674
- var s;
675
- S(n), O(t), p(() => {
676
- s !== (s = l().chartReduce) && (n.value = (n.__value = l().chartReduce) ?? "", x(n, l().chartReduce));
677
- }), o("change", n, (e) => l().chartReduce = e.currentTarget.value), i(e, t);
678
- };
679
- T(j, (e) => {
680
- a(St) && e(ie);
681
- });
682
- var M = D(j, 2), N = D(v(M), 2);
683
- r(N, 21, () => Et, (e) => e.value, (e, t) => {
684
- var n = Ie(), r = v(n, !0);
685
- O(n);
686
- var o = {};
687
- p(() => {
688
- c(r, a(t).label), o !== (o = a(t).value) && (n.value = (n.__value = a(t).value) ?? "");
689
- }), i(e, n);
690
- }), O(N);
691
- var P;
692
- S(N), O(M);
693
- var ae = D(M, 2), F = (e) => {
694
- var t = Le(), n = ne(t), r = v(n);
695
- A(r), b(), O(n);
696
- var a = D(n, 2), s = v(a);
697
- A(s), b(), O(a), p(() => {
698
- y(r, l().chartStacked), y(s, l().chartStacked100);
699
- }), o("change", r, (e) => l().chartStacked = e.currentTarget.checked), o("change", s, (e) => l().chartStacked100 = e.currentTarget.checked), i(e, t);
700
- };
701
- T(ae, (e) => {
702
- a(vt) && e(F);
703
- });
704
- var I = D(ae, 2), L = (e) => {
705
- var t = Re(), n = v(t);
706
- A(n), b(), O(t), p(() => y(n, l().chartOrientation === "horizontal")), o("change", n, (e) => l().chartOrientation = e.currentTarget.checked ? "horizontal" : "vertical"), i(e, t);
707
- };
708
- T(I, (e) => {
709
- a(mt) && e(L);
710
- });
711
- var oe = D(I, 2), se = (e) => {
712
- var t = ze(), n = v(t);
713
- A(n), b(), O(t), p(() => y(n, l().chartDonut)), o("change", n, (e) => l().chartDonut = e.currentTarget.checked), i(e, t);
714
- };
715
- T(oe, (e) => {
716
- a(ht) && e(se);
717
- });
718
- var z = D(oe, 2), B = D(v(z), 2);
719
- r(B, 21, () => ft, (e) => e.key, (e, t) => {
720
- var n = Be(), r = v(n, !0);
721
- O(n);
722
- var o = {};
723
- p(() => {
724
- c(r, a(t).label), o !== (o = a(t).key) && (n.value = (n.__value = a(t).key) ?? "");
725
- }), i(e, n);
726
- }), O(B);
727
- var V;
728
- S(B), O(z);
729
- var H = D(z, 2), ce = (e) => {
730
- var t = Ve(), n = v(t);
731
- A(n), b(), O(t), p(() => y(n, l().chartDataLabels)), o("change", n, (e) => l().chartDataLabels = e.currentTarget.checked), i(e, t);
732
- };
733
- T(H, (e) => {
734
- a(bt) && e(ce);
735
- });
736
- var U = D(H, 2), le = (e) => {
737
- var t = He(), n = v(t);
738
- A(n), b(), O(t), p(() => y(n, l().chartLogScale)), o("change", n, (e) => l().chartLogScale = e.currentTarget.checked), i(e, t);
739
- };
740
- T(U, (e) => {
741
- a(yt) && e(le);
742
- });
743
- var ue = D(U, 2), de = (e) => {
744
- var t = Ue(), n = v(t);
745
- A(n), b(), O(t), p(() => y(n, l().chartTimeAxis)), o("change", n, (e) => l().chartTimeAxis = e.currentTarget.checked), i(e, t);
746
- }, fe = k(() => l().chartDimensionIsDate && dt.includes(l().chartType));
747
- T(ue, (e) => {
748
- a(fe) && e(de);
749
- }), p(() => {
750
- u !== (u = l().chartType) && (s.value = (s.__value = l().chartType) ?? "", x(s, l().chartType)), c(w, a(xt) ? "X" : l().chartType === "gauge" ? "Metric" : "Value"), ee !== (ee = l().chartMeasureId ?? "") && (E.value = (E.__value = l().chartMeasureId ?? "") ?? "", x(E, l().chartMeasureId ?? "")), P !== (P = l().chartValueFormat) && (N.value = (N.__value = l().chartValueFormat) ?? "", x(N, l().chartValueFormat)), V !== (V = a(pt)) && (B.value = (B.__value = a(pt)) ?? "", x(B, a(pt)));
751
- }), o("change", s, (e) => l().chartType = e.currentTarget.value), o("change", E, (e) => l().chartMeasureId = e.currentTarget.value || null), o("change", N, (e) => l().chartValueFormat = e.currentTarget.value), o("change", B, (e) => l().chartPalette = ft.find((t) => t.key === e.currentTarget.value)?.colors ?? null), i(e, t);
752
- };
753
- T(hn, (e) => {
754
- a(N) || e(gn);
755
- });
756
- var _n = D(hn, 2), vn = (e) => {
757
- var t = Ge(), n = v(t, !0);
758
- O(t), p(() => c(n, a(wt))), i(e, t);
759
- };
760
- T(_n, (e) => {
761
- a(wt) && e(vn);
762
- }), O(mn), O(Wt);
763
- var $ = D(Wt, 2), yn = v($), bn = (e) => {
764
- {
765
- let t = k(() => a(M)?.zoom === !0), n = k(() => a(M)?.brush === !0), r = k(() => a(M)?.export === !0 || void 0);
766
- ie(e, {
767
- get spec() {
768
- return a(L);
769
- },
770
- get width() {
771
- return a(st);
772
- },
773
- get height() {
774
- return a(ct);
775
- },
776
- onSelect: Dt,
777
- interactive: !0,
778
- legend: !0,
779
- get dataLabels() {
780
- return l().chartDataLabels;
781
- },
782
- get zoomable() {
783
- return a(t);
784
- },
785
- get brush() {
786
- return a(n);
787
- },
788
- get toolbar() {
789
- return a(r);
790
- }
791
- });
792
- }
793
- }, xn = (e) => {
794
- var n = Ke(), r = v(n), o = (e) => {
795
- var n = t("Charting needs at least one text column (to group by) and one numeric column (to measure).");
796
- i(e, n);
797
- }, s = (e) => {
798
- var n = t("No data to chart.");
799
- i(e, n);
800
- };
801
- T(r, (e) => {
802
- !a(R).dims.length || !a(R).measures.length ? e(o) : e(s, -1);
803
- }), O(n), i(e, n);
804
- };
805
- T(yn, (e) => {
806
- a(L) && (a(L).series.length || a(L).gaugeValue != null || a(N)) ? e(bn) : e(xn, -1);
807
- }), O($), C($, (e) => w(Ot, e), () => a(Ot));
808
- var Sn = D($, 2), Cn = (e) => {
809
- var t = qe();
810
- o("pointerdown", t, tt), i(e, t);
811
- };
812
- T(Sn, (e) => {
813
- a(V) && !a(U) && e(Cn);
814
- }), O(X), C(X, (e) => w(Ye, e), () => a(Ye)), p(() => {
815
- Vt = j(X, 1, "sv-grid-chart-panel", null, Vt, {
816
- "is-right": a(F) === "right" && !a(V),
817
- "is-bottom": a(F) === "bottom" && !a(V),
818
- "is-floating": a(V),
819
- "is-maximized": a(V) && a(U)
820
- }), m(X, a(nt)), Gt = j(Z, 1, "sv-grid-chart-drawer-title", null, Gt, { "is-drag-handle": a(V) && !a(U) }), _(Q, "aria-expanded", a(G));
821
- }), o("pointerdown", Z, et), o("click", Q, () => w(G, !a(G))), o("click", ln, () => l().chartPanelOpen = !1), h($, "clientWidth", (e) => w(rt, e)), h($, "clientHeight", (e) => w(it, e)), n(3, X, () => P, () => ({
822
- x: !a(V) && a(F) === "right" ? a(B) : 0,
823
- y: !a(V) && a(F) === "bottom" ? a(B) : 0,
824
- duration: 180,
825
- easing: ae
826
- })), i(e, X), E();
827
- }
828
- d([
829
- "pointerdown",
830
- "click",
831
- "change"
832
- ]);
833
- //#endregion
834
- export { se as a, z as c, V as i, oe as l, U as n, L as o, H as r, ce as s, W as t, P as u };