@astrato-io/visualizations 0.9.0 → 0.10.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 (145) hide show
  1. package/README.md +8 -4
  2. package/THIRD_PARTY_NOTICES.md +163 -14
  3. package/VISUALIZATION_DEFINITIONS.md +319 -32
  4. package/chunks/{Button-5CxPEACP.js → Button-CCF851ea.js} +4 -4
  5. package/chunks/{CircularProgress-DFS-LQb7.js → CircularProgress-yupH6YWs.js} +39 -39
  6. package/chunks/FieldTypeIcon-D_MzsdfY.js +22 -0
  7. package/chunks/{LinearProgress-CjIQfkNA.js → LinearProgress-CyFjN4px.js} +9 -9
  8. package/chunks/{MenuOption-Cb7B7x6z.js → MenuOption-CQpT79AP.js} +143 -142
  9. package/chunks/{Title-CtFw1bVg.js → Title-C-p4ZarD.js} +22 -22
  10. package/chunks/_createAggregator-BF4qG9XK.js +50 -0
  11. package/chunks/{app-filter-bar.compiler-B9775gLJ.js → app-filter-bar.compiler-8fxCo2q7.js} +10 -10
  12. package/chunks/bar-layout-DStC-GNV.js +9 -0
  13. package/chunks/{bar.compiler-B7wlH_Ro.js → bar.compiler-CQAu8KL8.js} +102 -84
  14. package/chunks/{builder-Dxo7D7c6.js → builder-CScg1TOS.js} +71 -38
  15. package/chunks/color-rules-DYJL4fIW.js +15 -0
  16. package/chunks/color-settings-DJFoFTip.js +5 -0
  17. package/chunks/{coloring-B-Wa8D5P.js → coloring-9jU3s_-p.js} +41 -41
  18. package/chunks/createSimplePaletteValueFilter-C4hZpCdn.js +2005 -0
  19. package/chunks/defaults-cyNhn37t.js +3 -0
  20. package/chunks/{definitions-DNpzD9tY.js → definitions-C4grxhye.js} +613 -401
  21. package/chunks/{escobar-C4Nm3eJ7.js → escobar-CjirINHP.js} +5326 -5079
  22. package/chunks/{extend-preset-BVKFtoe-.js → extend-preset-D-l9u_we.js} +974 -909
  23. package/chunks/{filter.compiler-BlS3zoy_.js → filter.compiler-lji2Acgn.js} +10 -10
  24. package/chunks/{filtering-CGuLpg7u.js → filtering-C1zakrrX.js} +385 -429
  25. package/chunks/handlers-ZviIUC-j.js +15387 -0
  26. package/chunks/{icon-picker-styles-DYQgVEKG.js → icon-picker-styles-Bj80ZUBK.js} +11 -11
  27. package/chunks/isEqual-Ch9OEye3.js +16 -0
  28. package/chunks/{isFocusVisible-B1_z03UT.js → isFocusVisible-CgMP0qkR.js} +1 -1
  29. package/chunks/label-format-type-C46pzgx7.js +17 -0
  30. package/chunks/{line.compiler-Bo9i9qag.js → line.compiler-De5fiKuR.js} +9 -9
  31. package/chunks/{logger-3lng-wOw.js → logger-CKRjhSHQ.js} +71 -64
  32. package/chunks/map.compiler-CKzorLgK.js +345 -0
  33. package/chunks/{metadata-Fmx1swpK.js → metadata-Bb9pTXrq.js} +1 -1
  34. package/chunks/{number.compiler-CdLd5aGW.js → number.compiler-CaTmJkmi.js} +7 -7
  35. package/chunks/operations-DZoY50VX.js +31297 -0
  36. package/chunks/{range-CzO4isKK.js → range-D1BTmFMp.js} +2 -2
  37. package/chunks/{react-dom-BwZT0N3F.js → react-dom-Dgv2azN2.js} +70 -70
  38. package/chunks/{render-wrappers-CAuvgMxi.js → render-wrappers-_P3xwu5A.js} +1 -1
  39. package/chunks/{requirements-CYpVh65U.js → requirements-NHNrR8Ie.js} +59 -57
  40. package/chunks/shared-UitWpq1J.js +1331 -0
  41. package/chunks/{standalone-CoQxJ6ov.js → standalone-B0U6c3su.js} +804 -804
  42. package/chunks/{standalone-C6XDHYAM.js → standalone-BBu90BhK.js} +109 -109
  43. package/chunks/standalone-BEekPuA12.js +357 -0
  44. package/chunks/{standalone-CPUiiWNP.js → standalone-BOzHA_d4.js} +41 -41
  45. package/chunks/standalone-BR2JuRIC.js +422 -0
  46. package/chunks/{standalone-DuwTOBXH.js → standalone-BapqaniK.js} +592 -592
  47. package/chunks/{standalone-DWPfdP0A.js → standalone-Bnnr87pc.js} +523 -523
  48. package/chunks/standalone-BwJqDj2Z.js +396 -0
  49. package/chunks/{standalone-LFVgLhia.js → standalone-ByKKqT5L.js} +266 -258
  50. package/chunks/{standalone-BDrQMxLi.js → standalone-CRdDZYeM.js} +1788 -1004
  51. package/chunks/standalone-CRfDOO1x.js +287 -0
  52. package/chunks/{standalone-BvWdpUL3.js → standalone-CVknVdUC.js} +21 -18
  53. package/chunks/standalone-CbPk8bKn.js +580 -0
  54. package/chunks/{standalone-r4ObFvys.js → standalone-Ck63MZzj.js} +218 -216
  55. package/chunks/{standalone-Cu73fzSr.js → standalone-DCFY1MAV.js} +6040 -5820
  56. package/chunks/{standalone-CiaaibTa.js → standalone-DZDGX3aa.js} +174 -174
  57. package/chunks/standalone-DhfgeJIk.js +1012 -0
  58. package/chunks/standalone-DibjA73M.js +6 -0
  59. package/chunks/{standalone-CXniic5x.js → standalone-DtBk_iUz.js} +6 -5
  60. package/chunks/standalone-DxBAyqAu.js +772 -0
  61. package/chunks/standalone-KMQPsNsq.js +2 -0
  62. package/chunks/standalone-MBLSvsrY.js +2 -0
  63. package/chunks/standalone-U0WJwFlG.js +354 -0
  64. package/chunks/{standalone-CNkHsynO.js → standalone-swGs70tD.js} +54 -56
  65. package/chunks/standalone-wgFAVnnm.js +355 -0
  66. package/chunks/standalone-xGV0dqPV.js +689 -0
  67. package/chunks/{table.compiler-C1qjqXaT.js → table.compiler-OWSx5MOq.js} +4 -4
  68. package/chunks/{useFieldName-mWrD_uk_.js → useFieldName-B8iCYyw1.js} +1 -1
  69. package/chunks/{utils-DYYD4Zzf.js → utils-3Igg6xmO.js} +4740 -4737
  70. package/chunks/{view-7fH6mGmY.js → view-DdMLZySj.js} +1988 -1632
  71. package/chunks/{visualization-filters-mVnsnvLP.js → visualization-filters-CzvFHE6M.js} +3158 -2417
  72. package/chunks/{with-html-element-B0Clt4jY.js → with-html-element-DOfkR3C1.js} +3353 -3160
  73. package/definitions.js +2 -2
  74. package/docs/operations/astrato-app-filter-bar.md +1 -1
  75. package/docs/operations/bar.md +303 -2
  76. package/docs/operations/combo.md +262 -1
  77. package/docs/operations/date-picker.md +1 -1
  78. package/docs/operations/distribution-gauge.md +1 -1
  79. package/docs/operations/dot.md +148 -1
  80. package/docs/operations/filter.md +1 -1
  81. package/docs/operations/gauge.md +1 -1
  82. package/docs/operations/heatMap.md +1 -1
  83. package/docs/operations/histogram.md +262 -1
  84. package/docs/operations/iframe.md +1 -1
  85. package/docs/operations/image.md +1 -1
  86. package/docs/operations/index.md +7 -7
  87. package/docs/operations/line.md +262 -1
  88. package/docs/operations/number.md +1 -1
  89. package/docs/operations/pie.md +1 -1
  90. package/docs/operations/radar.md +1 -1
  91. package/docs/operations/sankey.md +1 -1
  92. package/docs/operations/scatter.md +148 -1
  93. package/docs/operations/shape.md +1 -1
  94. package/docs/operations/simpleTextObject.md +1 -1
  95. package/docs/operations/slider.md +1 -1
  96. package/docs/operations/table.md +374 -157
  97. package/docs/operations/tree.md +1 -1
  98. package/docs/operations/treemap.md +1 -1
  99. package/docs/operations/waterfall.md +1 -1
  100. package/docs/operations/word-cloud.md +1 -1
  101. package/getters.js +2 -2
  102. package/index.js +507 -459
  103. package/metadata.js +2 -2
  104. package/operations.js +5 -5
  105. package/package.json +72 -67
  106. package/src/definitions/index.d.ts +1 -1
  107. package/src/definitions/model/definitions/available-fields.d.ts +2 -2
  108. package/src/definitions/model/definitions/compilers/compile.d.ts +1 -0
  109. package/src/definitions/model/definitions/data-item-resolution.d.ts +3 -3
  110. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +188 -2
  111. package/src/definitions/model/definitions/index.d.ts +2 -1
  112. package/src/definitions/model/definitions/schema-registry.d.ts +305 -0
  113. package/src/definitions/model/definitions/schemas/bar.schema.d.ts +2 -0
  114. package/src/definitions/model/definitions/schemas/common.schema.d.ts +4 -3
  115. package/src/definitions/model/definitions/schemas/index.d.ts +1 -0
  116. package/src/definitions/model/definitions/schemas/map.schema.d.ts +590 -0
  117. package/src/definitions/model/definitions/types/compilation.types.d.ts +7 -2
  118. package/src/definitions/model/definitions/types/definition.types.d.ts +2 -2
  119. package/src/definitions/model/definitions/types/index.d.ts +1 -1
  120. package/src/index.d.ts +1 -1
  121. package/src/operations/index.d.ts +1 -1
  122. package/src/types.d.ts +45 -41
  123. package/chunks/FieldTypeIcon-pSVQFemC.js +0 -22
  124. package/chunks/ToggleButton-Br9HCPCv.js +0 -150
  125. package/chunks/color-rules-CN7TcGrC.js +0 -6
  126. package/chunks/color-settings-3VRlf_Vw.js +0 -6
  127. package/chunks/handlers-CMbyj5y1.js +0 -12930
  128. package/chunks/isEqual-DBg_b35N.js +0 -12
  129. package/chunks/label-format-type-weq1XfcX.js +0 -8
  130. package/chunks/operations-HSqnCRvv.js +0 -26324
  131. package/chunks/shared-DFoJxjVN.js +0 -1218
  132. package/chunks/standalone-530a5lvf.js +0 -1003
  133. package/chunks/standalone-5DnapeHH.js +0 -420
  134. package/chunks/standalone-B4jrf4KE.js +0 -354
  135. package/chunks/standalone-B6s_xG2u.js +0 -354
  136. package/chunks/standalone-BMoJXGYe.js +0 -2
  137. package/chunks/standalone-BfvGggeM2.js +0 -355
  138. package/chunks/standalone-CMJJIi9v.js +0 -2
  139. package/chunks/standalone-C_Jd4gkj.js +0 -6
  140. package/chunks/standalone-DBeXQrwH.js +0 -468
  141. package/chunks/standalone-DMCwtebn.js +0 -396
  142. package/chunks/standalone-DpSRmAWx.js +0 -287
  143. package/chunks/standalone-kzAhwH19.js +0 -689
  144. package/chunks/standalone-mb7LwEiq.js +0 -3874
  145. /package/chunks/{src-BOS6SqkZ2.js → src-BOS6SqkZ.js} +0 -0
@@ -0,0 +1,2 @@
1
+ import { n as e } from "./standalone-wgFAVnnm.js";
2
+ export { e as DistributionGaugeChart };
@@ -0,0 +1,2 @@
1
+ import { t as e } from "./view-DdMLZySj.js";
2
+ export { e as DatePicker };
@@ -0,0 +1,354 @@
1
+ import { o as e } from "./rolldown-runtime-DleVn1XH.js";
2
+ import { Fa as t, Fo as n, Ia as r, Pa as i, Pc as a, Qr as o, Ra as s, Ut as c, fs as l, nc as u, oa as d, ps as f, ti as p } from "./visualization-filters-CzvFHE6M.js";
3
+ import { Ut as m, W as h, ci as g, f as _, jt as v, sn as y, xn as b, zr as x } from "./utils-3Igg6xmO.js";
4
+ import { s as S } from "./coloring-9jU3s_-p.js";
5
+ import { n as C, r as w, t as T } from "./icon-picker-styles-Bj80ZUBK.js";
6
+ var E = /* @__PURE__ */ e(g()), D = x(), O = (e) => {
7
+ let t = C[e];
8
+ return t ? String.fromCodePoint(parseInt(t, 16)) : null;
9
+ }, k = ({ className: e, name: t, onClick: n, style: r, testId: i, displayNullIcon: a, displayNullTooltip: o, role: s }) => {
10
+ let c = T(), l = O(t);
11
+ return !l && a ? /* @__PURE__ */ (0, D.jsxs)("div", {
12
+ role: s,
13
+ className: y({
14
+ [c.nullIconWrapper]: !0,
15
+ [e ?? ""]: !!e
16
+ }),
17
+ onClick: n,
18
+ children: [o ? /* @__PURE__ */ (0, D.jsx)("div", {
19
+ className: c.tooltip,
20
+ children: "No icon"
21
+ }) : null, /* @__PURE__ */ (0, D.jsx)("img", {
22
+ style: {
23
+ position: "absolute",
24
+ top: 1,
25
+ left: 1
26
+ },
27
+ src: w,
28
+ alt: "no icon"
29
+ })]
30
+ }) : l ? /* @__PURE__ */ (0, D.jsx)("span", {
31
+ role: s,
32
+ className: y({
33
+ "material-icons": !0,
34
+ [e ?? ""]: !!e
35
+ }),
36
+ style: r,
37
+ "data-testid": i,
38
+ onClick: n,
39
+ children: l
40
+ }) : null;
41
+ }, A = (e, t) => {
42
+ switch (e.thresholdType) {
43
+ case r.Range: return M(t, e.rangeThresholds ?? []);
44
+ case r.Target: return j(t, e.targetThreshold);
45
+ case r.None: return {};
46
+ }
47
+ }, j = (e, t) => {
48
+ if (!t) return {};
49
+ let n = c(t.target, 0) ?? 0, { belowTargetColorAndIcon: r, targetColorAndIcon: i, aboveTargetColorAndIcon: a } = t;
50
+ return e < n * (1 - t.targetTolerance) ? r : e > n * (1 + t.targetTolerance) ? a : i;
51
+ }, M = (e, t) => [...t].sort((e, t) => (c(t.rangeTo, 0) ?? 0) - (c(e.rangeTo, 0) ?? 0)).reduce((t, n) => e < (c(n.rangeTo, 0) ?? 0) ? n.colorAndIcon : t, {}), N = (e) => {
52
+ let t = ["numberColor"], n = ["comparisonColor"];
53
+ switch (e) {
54
+ case "main": return t;
55
+ case "comparison": return n;
56
+ case "both": return [...t, ...n];
57
+ }
58
+ }, P = (e, t, n) => n.reduce((n, r) => t in e ? {
59
+ ...n,
60
+ [r]: e[t]
61
+ } : n, {}), F = {
62
+ numberColor: "#1f1c3b",
63
+ iconColor: "#1f1c3b",
64
+ iconPosition: n.Left,
65
+ comparisonColor: "#1f1c3b",
66
+ comparisonPosition: n.Bottom
67
+ }, I = {
68
+ numberValue: 0,
69
+ textAlign: l.Center,
70
+ horizontalAlign: l.Center,
71
+ verticalAlign: f.Middle,
72
+ numberStyle: {
73
+ fontSize: 12,
74
+ fontFamily: "Roboto",
75
+ bold: !1,
76
+ italic: !1,
77
+ underlined: !1,
78
+ strikethrough: !1
79
+ },
80
+ comparisonStyle: {
81
+ relativeFontSizePercentage: p.relativeFontSizePercentage,
82
+ fontFamily: "Roboto",
83
+ bold: !1,
84
+ italic: !1,
85
+ underlined: !1,
86
+ strikethrough: !1
87
+ },
88
+ comparisonGap: i.SmallGap,
89
+ ...F
90
+ }, L = (e, t, n) => {
91
+ if (!n?.length || !e) return I;
92
+ let r = t || d, i = r.fonts.general.fontFamily ?? void 0, { numberValue: a, numberFormat: c, comparisonNumberValue: l, comparisonFormat: u } = R(e, n);
93
+ return {
94
+ ...B(e, r, H(n, e.measures.find((e) => o(e) && e.role === s.NUMBER_MEASURE), !0), z(e, n)),
95
+ numberValue: a,
96
+ numberFormat: c,
97
+ comparisonNumberValue: l,
98
+ comparisonFormat: u,
99
+ numberStyle: {
100
+ fontSize: e.numberSettings?.numberStyle?.fontSize ?? I.numberStyle.fontSize,
101
+ fontFamily: e.numberSettings?.numberStyle?.fontFamily ?? i,
102
+ bold: e.numberSettings?.numberStyle?.bold ?? I.numberStyle.bold,
103
+ weight: e.numberSettings?.numberStyle?.weight ?? void 0,
104
+ italic: e.numberSettings?.numberStyle?.italic ?? I.numberStyle.italic,
105
+ underlined: e.numberSettings?.numberStyle?.underlined ?? I.numberStyle.underlined,
106
+ strikethrough: e.numberSettings?.numberStyle?.strikethrough ?? I.numberStyle.strikethrough
107
+ },
108
+ comparisonStyle: {
109
+ relativeFontSizePercentage: e.numberSettings?.comparisonStyle?.relativeFontSizePercentage ?? I.comparisonStyle.relativeFontSizePercentage,
110
+ fontFamily: e.numberSettings?.comparisonStyle?.fontFamily ?? i,
111
+ bold: e.numberSettings?.comparisonStyle?.bold ?? I.comparisonStyle.bold,
112
+ weight: e.numberSettings?.comparisonStyle?.weight ?? void 0,
113
+ italic: e.numberSettings?.comparisonStyle?.italic ?? I.comparisonStyle.italic,
114
+ underlined: e.numberSettings?.comparisonStyle?.underlined ?? I.comparisonStyle.underlined,
115
+ strikethrough: e.numberSettings?.comparisonStyle?.strikethrough ?? I.comparisonStyle.strikethrough
116
+ },
117
+ textAlign: e.numberSettings?.position?.textAlign ?? I.textAlign,
118
+ horizontalAlign: e.numberSettings?.position?.numberHorizontalAlign ?? I.horizontalAlign,
119
+ verticalAlign: e.numberSettings?.position?.numberVerticalAlign ?? I.verticalAlign,
120
+ comparisonGap: e.numberSettings?.position?.comparisonGap ?? I.comparisonGap
121
+ };
122
+ }, R = (e, t) => {
123
+ let n, r, i, a, c = e.measures.filter(o), l = c.filter((e) => e.role === s.NUMBER_MEASURE), u = c.filter((e) => e.role === s.NUMBER_COMPARISON), d = l[0], f = u[0];
124
+ return n = H(t, d, !0), i = z(e, t), d?.formatter && typeof d?.formatter?.format != "string" && (r = d.formatter), f?.formatter && typeof f?.formatter?.format != "string" && (a = f.formatter), f && i !== void 0 && e.numberSettings?.data?.showOnlyComparison && (n = i, r = a, i = void 0, a = void 0), {
125
+ numberValue: n,
126
+ numberFormat: r,
127
+ comparisonNumberValue: i,
128
+ comparisonFormat: a
129
+ };
130
+ }, z = (e, n) => {
131
+ let r = e.measures.filter(o), i = r.filter((e) => e.role === s.NUMBER_MEASURE), a = r.filter((e) => e.role === s.NUMBER_COMPARISON), c = i[0], l = a[0];
132
+ if (!l) return;
133
+ let u = H(n, c), d = H(n, l), f = e.numberSettings?.data?.comparisonType, p = f === t.PercentageToComparison || f === t.PercentageAboveBelow || f === t.Difference;
134
+ if (d === null || p && u === null) return null;
135
+ let m = Number(u), h = +d, g = Math.abs(h);
136
+ return f === t.PercentageToComparison ? m === 0 && h === 0 ? 1 : m / g : f === t.PercentageAboveBelow ? m === 0 && h === 0 ? 0 : (m - h) / g : f === t.Difference ? m - h : h;
137
+ }, B = (e, t, n, i) => {
138
+ let a = e.measures.filter(o), c = a.filter((e) => e.role === s.NUMBER_MEASURE), l = a.filter((e) => e.role === s.NUMBER_COMPARISON), u = c[0], d = l[0];
139
+ return (e.numberSettings?.thresholds ?? []).filter((e) => e.thresholdType !== r.None).reduce((e, t) => {
140
+ let r = t.measureRule === "main" ? u : d, a = n === null ? null : Number(n), o = t.measureRule === "main" ? a : i;
141
+ if (r && o != null) {
142
+ let n = A(t, o), r = {
143
+ ...e,
144
+ ...P(n, "icon", ["icon"]),
145
+ ...P(n, "iconColor", ["iconColor"]),
146
+ ...P(n, "numberColor", N(t.colorRule)),
147
+ backgroundColor: n.backgroundColor ?? e.backgroundColor
148
+ };
149
+ return {
150
+ ...r,
151
+ numberColor: r.numberColor ?? "",
152
+ iconColor: r.iconColor ?? void 0,
153
+ comparisonColor: r.comparisonColor ?? void 0
154
+ };
155
+ }
156
+ return e;
157
+ }, V(e, t));
158
+ }, V = (e, t) => {
159
+ let { icon: r, iconColor: i } = e.numberSettings?.colorAndIcon || {};
160
+ return {
161
+ icon: r,
162
+ iconColor: S(t, i ?? "black"),
163
+ iconPosition: e?.numberSettings?.position?.iconPosition ?? n.Left,
164
+ numberColor: S(t, e?.numberSettings?.numberStyle?.fontColor ?? t.fonts.general.color),
165
+ ...U(e, t, e.numberSettings?.comparisonStyle?.fontColor)
166
+ };
167
+ }, H = (e, t, n = !1) => {
168
+ let r = a(t?.dataItem), i = (e?.[0])?.items?.[0], o = r === null ? void 0 : i?.[r];
169
+ if (o == null || o === "") return null;
170
+ let s = +`${o}`, c = n && (!t?.formatter || t?.formatter?.format === "string") ? `${o}` : 0;
171
+ return isNaN(s) ? c : s;
172
+ }, U = (e, t, r) => !e.measures.filter(o).filter((e) => e.role === s.NUMBER_COMPARISON)[0] || e.numberSettings?.data?.showOnlyComparison ? {
173
+ comparisonPosition: void 0,
174
+ comparisonColor: void 0
175
+ } : {
176
+ comparisonColor: S(t, r ?? t.fonts.general.color),
177
+ comparisonPosition: e.numberSettings?.position?.comparisonPosition ?? n.Left
178
+ }, W = h({
179
+ mainContainer: {
180
+ width: "100%",
181
+ height: "100%",
182
+ display: "flex",
183
+ lineHeight: 1,
184
+ overflow: "hidden"
185
+ },
186
+ numbersContainer: {
187
+ display: "flex",
188
+ justifyContent: "center",
189
+ letterSpacing: "0.05em"
190
+ },
191
+ number: { fontSize: "1em" },
192
+ comparisonIconContainer: {
193
+ display: "flex",
194
+ justifyContent: "center"
195
+ }
196
+ }), G = (e) => {
197
+ switch (e) {
198
+ case f.Top:
199
+ case l.Left: return "flex-start";
200
+ case f.Bottom:
201
+ case l.Right: return "flex-end";
202
+ default: return "center";
203
+ }
204
+ }, K = (e) => {
205
+ let t = e.comparisonPosition ?? e.iconPosition;
206
+ return t === n.Top || t === n.Bottom ? G(e.textAlign) : "center";
207
+ }, q = (e, t, n, r = !1) => {
208
+ let i, a, o = 0;
209
+ r && Math.floor(e) !== e && (o = e.toString().split(".")[1].length || 0);
210
+ let s = async (c) => {
211
+ a === void 0 && (a = c);
212
+ let l = c - a, u = Math.min(l / 500, 1), d = t + (e - t) * u;
213
+ r && (d = Number(d.toFixed(o))), n(d), l < 500 ? i = requestAnimationFrame(s) : (n(e), cancelAnimationFrame(i));
214
+ };
215
+ return e !== t && (i = requestAnimationFrame(s)), () => cancelAnimationFrame(i);
216
+ }, J = .5, Y = `${J}em`, ee = (e, t) => !(t === n.Left || t === n.Right) || !e || e === i.None ? {} : e === i.SmallGap ? { gap: Y } : {
217
+ width: "100%",
218
+ justifyContent: e
219
+ }, te = (e, t) => e ? t === n.Top || t === n.Bottom ? "0.33em" : "0.5em" : t === n.Top || t === n.Bottom ? "0.5em" : "1.0em", X = (e) => {
220
+ switch (e) {
221
+ case n.Top: return "column";
222
+ case n.Bottom: return "column-reverse";
223
+ case n.Right: return "row-reverse";
224
+ default: return "row";
225
+ }
226
+ }, Z = (e, t) => !e && !t ? "inherit" : `${e ? "underline" : ""} ${t ? "line-through" : ""}`, ne = ({ numberSize: e, comparisonNumberSize: t, numberProps: r, elementSize: a, fontSize: o }) => {
227
+ let s = r.comparisonNumberValue != null && !!t && (r.comparisonPosition === n.Left || r.comparisonPosition === n.Right), c = !!r.icon && (r.iconPosition === n.Left || r.iconPosition === n.Right), l = s ? e.width + t.width : Math.max(e.width, t?.width ?? 0);
228
+ return s && r.comparisonGap === i.SmallGap && (l += J * o), c && (l += e.height), l <= a.width;
229
+ }, re = ({ numberSize: e, comparisonNumberSize: t, numberProps: r, elementSize: i }) => {
230
+ let a = r.comparisonNumberValue != null && !!t && (r.comparisonPosition === n.Top || r.comparisonPosition === n.Bottom), o = !!r.icon && (r.iconPosition === n.Top || r.iconPosition === n.Bottom), s = a ? e.height + t.height : Math.max(e.height, t?.height ?? 0);
231
+ return o && (s += e.height), s <= i.height;
232
+ }, Q = 1.2, ie = ({ number: e, comparisonNumber: t }, n, r) => {
233
+ let { numberStyle: i, comparisonStyle: a } = n, o = i.fontSize ?? 14;
234
+ if (!e || r.width === 0) return o;
235
+ let s = b(), c = (a.relativeFontSizePercentage ?? p.relativeFontSizePercentage) / 100, l = 1;
236
+ for (let u = o; u >= 1; --u) {
237
+ let o = {
238
+ width: s.getTextSize({
239
+ size: u,
240
+ label: e,
241
+ fontFamily: i.fontFamily ?? "inherit",
242
+ letterSpacing: "0.05em",
243
+ fontWeight: 400
244
+ }).width,
245
+ height: u * Q
246
+ }, d;
247
+ if (t) {
248
+ let e = u * c;
249
+ d = {
250
+ width: s.getTextSize({
251
+ size: e,
252
+ label: t,
253
+ fontFamily: a.fontFamily ?? "inherit",
254
+ letterSpacing: "0.05em",
255
+ fontWeight: 400
256
+ }).width,
257
+ height: e * Q
258
+ };
259
+ }
260
+ if (ne({
261
+ numberSize: o,
262
+ comparisonNumberSize: d,
263
+ numberProps: n,
264
+ elementSize: r,
265
+ fontSize: u
266
+ }) && re({
267
+ numberSize: o,
268
+ comparisonNumberSize: d,
269
+ numberProps: n,
270
+ elementSize: r,
271
+ fontSize: u
272
+ })) {
273
+ l = u;
274
+ break;
275
+ }
276
+ }
277
+ return s.cleanDOM(), l;
278
+ }, $ = v((0, E.memo)(({ vSpec: e, vTheme: t, elementSize: r, data: i, vizProperties: a }) => {
279
+ let [o, s] = (0, E.useState)(0), c = W(), l = _(), u = L(e, t, i ?? void 0), { numberValue: d, numberFormat: f, comparisonNumberValue: h, comparisonFormat: g, backgroundColor: v } = u, y = u.iconPosition ?? n.Left, b = o, x = d === null ? null : o, S = f && x !== null ? m(f, x) : x, C = g && h !== null ? m(g, h) : h, w = S === "" || S == null, T = w ? void 0 : `${S}`, O = C === "" || C == null ? void 0 : `${C}`, A = w || !r ? u.numberStyle.fontSize || 14 : ie({
280
+ number: T,
281
+ comparisonNumber: O
282
+ }, u, r);
283
+ return (0, E.useEffect)(() => {
284
+ let e;
285
+ return !a?.disable?.animations && typeof d == "number" ? (typeof b != "number" && (s(0), b = 0), e = q(d, b, s, !f)) : s(d), () => {
286
+ e && e();
287
+ };
288
+ }, [d]), (0, E.useEffect)(() => {
289
+ e && l();
290
+ }, [e]), /* @__PURE__ */ (0, D.jsx)("div", {
291
+ className: c.mainContainer,
292
+ style: {
293
+ fontSize: `${A}px`,
294
+ alignItems: G(u.verticalAlign),
295
+ justifyContent: G(u.horizontalAlign),
296
+ backgroundColor: v
297
+ },
298
+ children: /* @__PURE__ */ (0, D.jsxs)("div", {
299
+ className: c.numbersContainer,
300
+ style: {
301
+ alignItems: K(u),
302
+ flexDirection: X(u.comparisonPosition ?? y),
303
+ ...ee(u.comparisonGap, u.comparisonPosition)
304
+ },
305
+ children: [/* @__PURE__ */ (0, D.jsxs)("div", {
306
+ className: c.comparisonIconContainer,
307
+ style: {
308
+ alignItems: G(u.textAlign),
309
+ flexDirection: X(y)
310
+ },
311
+ children: [/* @__PURE__ */ (0, D.jsx)(k, {
312
+ name: u.icon ?? "",
313
+ testId: "indicator-icon",
314
+ style: {
315
+ fontSize: te(u.comparisonPosition, y),
316
+ color: u.iconColor ?? "inherit"
317
+ }
318
+ }), /* @__PURE__ */ (0, D.jsx)("div", {
319
+ "data-testid": "number-comparison",
320
+ style: {
321
+ fontSize: `${(u.comparisonStyle.relativeFontSizePercentage ?? p.relativeFontSizePercentage) / 100}em`,
322
+ fontFamily: u.comparisonStyle.fontFamily,
323
+ fontStyle: u.comparisonStyle.italic ? "italic" : "normal",
324
+ fontWeight: u.comparisonStyle.weight || (u.comparisonStyle.bold ? "bold" : "normal"),
325
+ textDecoration: Z(u.comparisonStyle.underlined ?? !1, u.comparisonStyle.strikethrough ?? !1),
326
+ color: u.comparisonColor ?? "inherit"
327
+ },
328
+ children: O
329
+ })]
330
+ }), /* @__PURE__ */ (0, D.jsx)("div", {
331
+ className: c.number,
332
+ "data-testid": "number-base",
333
+ style: {
334
+ fontFamily: u.numberStyle.fontFamily,
335
+ fontStyle: u.numberStyle.italic ? "italic" : "normal",
336
+ fontWeight: u.numberStyle.weight || (u.numberStyle.bold ? "bold" : "normal"),
337
+ textDecoration: Z(u.numberStyle.underlined ?? !1, u.numberStyle.strikethrough ?? !1),
338
+ color: u.numberColor
339
+ },
340
+ children: f && typeof x == "number" ? m(f, x) : x
341
+ })]
342
+ })
343
+ });
344
+ })), ae = (e) => {
345
+ let { vSpec: t } = e;
346
+ return t === null ? (0, E.createElement)($, {
347
+ ...e,
348
+ vSpec: null
349
+ }) : u(t) ? (0, E.createElement)($, {
350
+ ...e,
351
+ vSpec: t
352
+ }) : null;
353
+ };
354
+ export { $ as Number, ae as NumberView };
@@ -1,10 +1,10 @@
1
1
  import { a as e, o as t, t as n } from "./rolldown-runtime-DleVn1XH.js";
2
- import { Ds as r, Kt as i, Us as a, fa as o, ha as s, ma as c, pa as l, ws as u, zi as d, zr as f } from "./visualization-filters-mVnsnvLP.js";
3
- import { N as p, Ot as m, Qt as h, ei as g, f as _, jr as v, s as y } from "./utils-DYYD4Zzf.js";
4
- import "./logger-3lng-wOw.js";
5
- import { Et as b, F as x, I as S, Yt as C, _n as w, et as T, i as E, ln as D, nt as O, st as k, tt as A } from "./escobar-C4Nm3eJ7.js";
6
- import { t as j } from "./coloring-B-Wa8D5P.js";
7
- import { n as M, t as N } from "./src-BOS6SqkZ2.js";
2
+ import { $a as r, Pc as i, Qa as a, Qr as o, Za as s, eo as c, hc as l, in as u, oa as d, vc as f } from "./visualization-filters-CzvFHE6M.js";
3
+ import { N as p, ci as m, f as h, jt as g, s as _, tn as v, zr as y } from "./utils-3Igg6xmO.js";
4
+ import "./logger-CKRjhSHQ.js";
5
+ import { Dt as b, I as x, L as S, Xt as C, ct as w, i as T, nt as E, rt as D, tt as O, un as k, vn as A } from "./escobar-CjirINHP.js";
6
+ import { t as j } from "./coloring-9jU3s_-p.js";
7
+ import { n as M, t as N } from "./src-BOS6SqkZ.js";
8
8
  var P = /* @__PURE__ */ n(((e, t) => {
9
9
  (function(e, t, n) {
10
10
  function r(e) {
@@ -285,48 +285,46 @@ var P = /* @__PURE__ */ n(((e, t) => {
285
285
  })), z = /* @__PURE__ */ n(((e, t) => {
286
286
  var n = P(), r = ee(), i = te(), a = F(), o = I(), s = ne(), c = R();
287
287
  c.alea = n, c.xor128 = r, c.xorwow = i, c.xorshift7 = a, c.xor4096 = o, c.tychei = s, t.exports = c;
288
- })), re = /* @__PURE__ */ t(g()), B = .7, V = 12 * B, H = /* @__PURE__ */ function(e) {
289
- return e.RenderDone = "render-done", e;
290
- }({}), U = /* @__PURE__ */ function(e) {
291
- return e.Minimum = "Minimum", e;
292
- }({}), W = /* @__PURE__ */ function(e) {
293
- return e.collectionKey = "coll", e.measureValue = "size", e;
294
- }({}), G = (e, t, n) => {
295
- let r = e.dimensions.filter((e) => f(e)), i = e.measures.filter((e) => f(e)), o = S((e.supportingMeasures ?? []).filter((e) => f(e)));
296
- if (!r[0] || !i[0]) return n;
297
- let s = a(r[0].dataItem), c = a(i[0].dataItem), l = [{
298
- key: "coll",
288
+ })), B = /* @__PURE__ */ t(m()), V = .7, re = 12 * V, H = { RenderDone: "render-done" }, U = { Minimum: "Minimum" }, W = {
289
+ collectionKey: "coll",
290
+ measureValue: "size"
291
+ }, G = (e, t, n) => {
292
+ let r = e.dimensions.filter((e) => o(e)), a = e.measures.filter((e) => o(e)), s = S((e.supportingMeasures ?? []).filter((e) => o(e)));
293
+ if (!r[0] || !a[0]) return n;
294
+ let c = i(r[0].dataItem), l = i(a[0].dataItem), u = [{
295
+ key: W.collectionKey,
299
296
  data: {
300
297
  extract: [{
301
- field: s,
298
+ field: c,
302
299
  props: {
303
- size: { field: c },
304
- [c]: { field: c },
305
- ...o
300
+ [W.measureValue]: { field: l },
301
+ [l]: { field: l },
302
+ ...s
306
303
  }
307
304
  }],
308
- filter: (e) => e.size.value != null && !isNaN(e.size.value)
305
+ filter: (e) => e[W.measureValue].value != null && !isNaN(e[W.measureValue].value)
309
306
  }
310
307
  }];
311
308
  return {
312
309
  ...n,
313
- collections: l
310
+ collections: u
314
311
  };
315
- }, K = /* @__PURE__ */ function(e) {
316
- return e.size = "size", e.gradient = "gradient", e;
317
- }({}), q = (e, t, n) => {
318
- let r = e.dimensions.filter((e) => f(e)), i = e.measures.filter((e) => f(e));
319
- if (!r[0] || !i[0]) return n;
320
- let o = { size: { data: { field: a(i[0].dataItem) } } };
321
- return o = b(e, t, o), {
312
+ }, K = {
313
+ size: "size",
314
+ gradient: "gradient"
315
+ }, q = (e, t, n) => {
316
+ let r = e.dimensions.filter((e) => o(e)), a = e.measures.filter((e) => o(e));
317
+ if (!r[0] || !a[0]) return n;
318
+ let s = { [K.size]: { data: { field: i(a[0].dataItem) } } };
319
+ return s = b(e, t, s), {
322
320
  ...n,
323
- scales: o
321
+ scales: s
324
322
  };
325
- }, J = (e, t, n, r, s, c, l, u) => e.filter(f).map((e, r) => {
326
- let s = Object.keys(t.data).find((n) => t.data[n]?.source?.field === a(e.dataItem)), c = (t.data[String(s)] || t.data[`measure${r}`])?.value, l = i(e) || e.label || e.dataItem.name || "", d = u && !o(e.formatter) ? k(e.formatter) : e.formatter;
323
+ }, J = (e, t, n, r, a, c, l, d) => e.filter(o).map((e, r) => {
324
+ let a = Object.keys(t.data).find((n) => t.data[n]?.source?.field === i(e.dataItem)), o = (t.data[String(a)] || t.data[`measure${r}`])?.value, c = u(e) || e.label || e.dataItem.name || "", l = d && !s(e.formatter) ? w(e.formatter) : e.formatter;
327
325
  return {
328
- label: l,
329
- value: d ? n.formatter(d)(c, void 0, t.data) : c
326
+ label: c,
327
+ value: l ? n.formatter(l)(o, void 0, t.data) : o
330
328
  };
331
329
  }), Y = (e, t, n, r, i) => {
332
330
  let a = {
@@ -336,13 +334,13 @@ var P = /* @__PURE__ */ n(((e, t) => {
336
334
  type: "bounds"
337
335
  }
338
336
  };
339
- return a.extract = A(e, t, J, O), T(e, t, n, a, "tooltip", i);
340
- }, ie = (e, t, n, i, o, s) => {
341
- let c = e.measures.filter((e) => f(e)), l = new j(e, t, o?.[0]?.itemsNotAffectedByFiltering), u = a(c[0].dataItem), d = C([""], s);
337
+ return a.extract = E(e, t, J, D), O(e, t, n, a, "tooltip", i);
338
+ }, ie = (e, t, n, r, a, s) => {
339
+ let c = e.measures.filter((e) => o(e)), l = new j(e, t, a?.[0]?.itemsNotAffectedByFiltering), u = i(c[0].dataItem), d = C([""], s);
342
340
  d?.trigger.forEach((e) => e.propagation = "stop");
343
341
  let p = {
344
342
  key: "word-cloud",
345
- type: w.WordCloud,
343
+ type: A.WordCloud,
346
344
  data: { collection: W.collectionKey },
347
345
  on: { [H.RenderDone]() {
348
346
  s?.onRenderDone?.();
@@ -361,8 +359,8 @@ var P = /* @__PURE__ */ n(((e, t) => {
361
359
  ref: W.measureValue
362
360
  },
363
361
  fill: l.getColorDefinition({
364
- ref: e.coloring?.type === r.Gradient ? W.measureValue : l.MAIN_FIELD,
365
- dataItemId: e.coloring?.type === r.Single ? u : void 0,
362
+ ref: e.coloring?.type === f.Gradient ? W.measureValue : l.MAIN_FIELD,
363
+ dataItemId: e.coloring?.type === f.Single ? u : void 0,
366
364
  overwriteSources: [l.MAIN_FIELD]
367
365
  })
368
366
  }
@@ -388,7 +386,7 @@ var P = /* @__PURE__ */ n(((e, t) => {
388
386
  };
389
387
  }
390
388
  preCompile(e) {
391
- let t = e.dimensions.filter((e) => f(e)), n = e.measures.filter((e) => f(e)), r = t[0], i = n[0];
389
+ let t = e.dimensions.filter((e) => o(e)), n = e.measures.filter((e) => o(e)), r = t[0], i = n[0];
392
390
  if (!r || !i) throw Error("Word cloud w/o a dimension or measure is not supported.");
393
391
  }
394
392
  postCompile(e) {
@@ -617,7 +615,7 @@ function de(e) {
617
615
  }
618
616
  }
619
617
  function fe(e, t, n) {
620
- let r = Math.max(1, Math.min(t.maxNumChars, Math.floor(n.width / V / 2))), i = de(t.fontScaling);
618
+ let r = Math.max(1, Math.min(t.maxNumChars, Math.floor(n.width / re / 2))), i = de(t.fontScaling);
621
619
  e.sort((e, t) => t.size - e.size);
622
620
  let a = 0;
623
621
  return [e.slice(0, 200).map((e) => {
@@ -630,7 +628,7 @@ function fe(e, t, n) {
630
628
  }), a];
631
629
  }
632
630
  function pe(e, t, n) {
633
- let r = Math.min(n.height / 2, n.width / (t * B)), i = r, a = 0;
631
+ let r = Math.min(n.height / 2, n.width / (t * V)), i = r, a = 0;
634
632
  e.forEach((e) => {
635
633
  a += r * e.scaledSize * r * e.adjustedLabel.length * e.scaledSize;
636
634
  });
@@ -639,7 +637,7 @@ function pe(e, t, n) {
639
637
  }
640
638
  function me(e) {
641
639
  return e.map((e) => ({
642
- type: D.Text,
640
+ type: k.Text,
643
641
  text: e.text,
644
642
  x: e.x,
645
643
  y: e.y,
@@ -660,9 +658,9 @@ function me(e) {
660
658
  }
661
659
  var Q = {
662
660
  fontFamily: "Arial",
663
- fontScaling: l.linear,
664
- fontStyle: c.normal,
665
- fontWeight: s.normal,
661
+ fontScaling: a.linear,
662
+ fontStyle: r.normal,
663
+ fontWeight: c.normal,
666
664
  seed: 1,
667
665
  maxNumChars: 32,
668
666
  word: {
@@ -718,20 +716,20 @@ var Q = {
718
716
  }
719
717
  };
720
718
  function ge(e) {
721
- e.component(w.WordCloud, he);
719
+ e.component(A.WordCloud, he);
722
720
  }
723
- var $ = v(), _e = () => {}, ve = m(({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: i }) => {
724
- let a = p(), o = _(), [s] = (0, re.useState)(() => new ae(o)), { activeKey: c } = y(), l = {
721
+ var $ = y(), _e = () => {}, ve = g(({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: i }) => {
722
+ let a = p(), o = h(), [s] = (0, B.useState)(() => new ae(o)), { activeKey: c } = _(), u = {
725
723
  ...i,
726
724
  valuePickerMode: !!c
727
725
  }, f = t || d, m = s.compile(e, f, n, r, {
728
- ...l,
726
+ ...u,
729
727
  onRenderDone: o
730
- }, u.WordCloud, a);
731
- return m ? /* @__PURE__ */ (0, $.jsx)(h.Provider, {
728
+ }, l.WordCloud, a);
729
+ return m ? /* @__PURE__ */ (0, $.jsx)(v.Provider, {
732
730
  value: _e,
733
- children: /* @__PURE__ */ (0, $.jsx)(E, {
734
- config: l,
731
+ children: /* @__PURE__ */ (0, $.jsx)(T, {
732
+ config: u,
735
733
  definition: m,
736
734
  size: r,
737
735
  vSpec: e,