@astrato-io/visualizations 0.0.0-stage → 0.6.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 (145) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/LICENSE +93 -0
  3. package/README.md +843 -2
  4. package/THIRD_PARTY_NOTICES.md +8387 -0
  5. package/VISUALIZATION_DEFINITIONS.md +2378 -0
  6. package/chunks/LinearProgress-CUZ0D8_t.js +253 -0
  7. package/chunks/Radio-Ciu-F4CU.js +957 -0
  8. package/chunks/ToggleButton-BCJc3Jlc.js +153 -0
  9. package/chunks/_baseFlatten-DPXPOrea.js +7076 -0
  10. package/chunks/accessors-DemrDevR.js +128 -0
  11. package/chunks/app-filter-bar.compiler-j_CVoWTa.js +55 -0
  12. package/chunks/bar.compiler-oqaPzIut.js +370 -0
  13. package/chunks/color-settings-ZIvgNTq1.js +10 -0
  14. package/chunks/coloring-C16AUZEi.js +663 -0
  15. package/chunks/data-item-resolution-1lvYB5ln.js +53 -0
  16. package/chunks/debounce-fn-CUixuz45.js +7 -0
  17. package/chunks/escobar-BGqT1EsE.js +34580 -0
  18. package/chunks/event-bus-KiSiCJrC.js +2683 -0
  19. package/chunks/events-WZut5Ow6.js +4 -0
  20. package/chunks/extend-BKUkc4_i.js +37 -0
  21. package/chunks/filter.compiler-CuLtc_02.js +60 -0
  22. package/chunks/filtering-Yq4DEa0t.js +953 -0
  23. package/chunks/gauge-target-type-BkKXAqkX.js +4 -0
  24. package/chunks/grouping-type-BX_9Ix5q.js +3 -0
  25. package/chunks/interfaces-VUY4_yVO.js +8742 -0
  26. package/chunks/line-settings-DfYTUyPz.js +4 -0
  27. package/chunks/line.compiler-BpA_6Tc7.js +188 -0
  28. package/chunks/metadata-CPXdYoln.js +28 -0
  29. package/chunks/number.compiler-DbkWcG4S.js +44 -0
  30. package/chunks/pie-uv42Eqal.js +10 -0
  31. package/chunks/range-DrzdfBX4.js +22 -0
  32. package/chunks/registry-CExpGJ1N.js +920 -0
  33. package/chunks/requirements-DNhuShLS.js +6 -0
  34. package/chunks/rolldown-runtime-DleVn1XH.js +28 -0
  35. package/chunks/set-coloring-datafield-B3uIS1Pe.js +8 -0
  36. package/chunks/shared-CKDL4hx9.js +1171 -0
  37. package/chunks/src-BC7cGcJ-.js +2024 -0
  38. package/chunks/src-BOS6SqkZ.js +67 -0
  39. package/chunks/src-C0LgoUWY.js +26105 -0
  40. package/chunks/src-Cum_2NLV.js +12145 -0
  41. package/chunks/src-D9XogOrc.js +422 -0
  42. package/chunks/src-Dun_jXtz.js +10295 -0
  43. package/chunks/src-DvX5LU9T.js +14742 -0
  44. package/chunks/standalone-87YV_m9n.js +687 -0
  45. package/chunks/standalone-BDCwI6Hn.js +4619 -0
  46. package/chunks/standalone-BH5NqDwp.js +1763 -0
  47. package/chunks/standalone-BLVAWLNJ.js +385 -0
  48. package/chunks/standalone-BPomtAVs.js +2 -0
  49. package/chunks/standalone-BXyBcUOQ.js +2 -0
  50. package/chunks/standalone-BYm1UjLr.js +140 -0
  51. package/chunks/standalone-BllF4rDp.js +383 -0
  52. package/chunks/standalone-BmfMt74U.js +726 -0
  53. package/chunks/standalone-BqWyrnZI.js +281 -0
  54. package/chunks/standalone-C85u7U6I.js +340 -0
  55. package/chunks/standalone-CCNtaJ7s.js +741 -0
  56. package/chunks/standalone-CDQnr6qT.js +345 -0
  57. package/chunks/standalone-CNyNHKVx.js +674 -0
  58. package/chunks/standalone-CY57qwZ-.js +1129 -0
  59. package/chunks/standalone-CZynjFG7.js +12979 -0
  60. package/chunks/standalone-D5vnf-9y.js +3943 -0
  61. package/chunks/standalone-DFPva_ku.js +299 -0
  62. package/chunks/standalone-DQxxNwF8.js +675 -0
  63. package/chunks/standalone-DS9T0FZ-.js +830 -0
  64. package/chunks/standalone-Dx3MLlrO.js +512 -0
  65. package/chunks/standalone-DzixzZAL.js +411 -0
  66. package/chunks/standalone-QJ1kKMnO.js +6 -0
  67. package/chunks/standalone-jiz0L2Dg.js +3855 -0
  68. package/chunks/standalone-lBm9hQ-q.js +179 -0
  69. package/chunks/standalone-rJ45Zfl1.js +68 -0
  70. package/chunks/stroke-dash-UgMEcCS4.js +6 -0
  71. package/chunks/table.compiler-BrXkm4Fz.js +213 -0
  72. package/chunks/toInteger-DVZr-D1j.js +11 -0
  73. package/chunks/treemap-x_zmJoG7.js +23 -0
  74. package/chunks/typeof-CJDtcySz.js +13 -0
  75. package/chunks/types-dVVCsDWD.js +4 -0
  76. package/chunks/ui-D1HQNIBy.js +54039 -0
  77. package/chunks/url-utils-B17gj_mr.js +5501 -0
  78. package/chunks/useFieldName-oqQ3bvnO.js +7 -0
  79. package/chunks/utils-Ba9T0TqC.js +31097 -0
  80. package/chunks/view-CLqWMV7Z.js +156 -0
  81. package/definitions.js +3 -0
  82. package/docs/operations/astrato-app-filter-bar.md +161 -0
  83. package/docs/operations/bar.md +7050 -0
  84. package/docs/operations/combo.md +5825 -0
  85. package/docs/operations/date-picker.md +644 -0
  86. package/docs/operations/distribution-gauge.md +3218 -0
  87. package/docs/operations/dot.md +5662 -0
  88. package/docs/operations/filter.md +1507 -0
  89. package/docs/operations/gauge.md +3452 -0
  90. package/docs/operations/heatMap.md +6026 -0
  91. package/docs/operations/histogram.md +1870 -0
  92. package/docs/operations/iframe.md +56 -0
  93. package/docs/operations/image.md +177 -0
  94. package/docs/operations/index.md +46 -0
  95. package/docs/operations/line.md +6468 -0
  96. package/docs/operations/number.md +3969 -0
  97. package/docs/operations/pie.md +6089 -0
  98. package/docs/operations/radar.md +4646 -0
  99. package/docs/operations/sankey.md +3210 -0
  100. package/docs/operations/scatter.md +6075 -0
  101. package/docs/operations/shape.md +315 -0
  102. package/docs/operations/simpleTextObject.md +706 -0
  103. package/docs/operations/slider.md +230 -0
  104. package/docs/operations/table.md +8790 -0
  105. package/docs/operations/tree.md +2874 -0
  106. package/docs/operations/treemap.md +3619 -0
  107. package/docs/operations/waterfall.md +2938 -0
  108. package/docs/operations/word-cloud.md +3071 -0
  109. package/getters.js +18 -0
  110. package/index.js +1183 -0
  111. package/metadata.js +20 -0
  112. package/operations.js +64 -0
  113. package/package.json +191 -4
  114. package/src/definitions/index.d.ts +2 -0
  115. package/src/definitions/shared/index.d.ts +5 -0
  116. package/src/definitions/shared/lib/available-fields.d.ts +36 -0
  117. package/src/definitions/shared/lib/compilers/index.d.ts +7 -0
  118. package/src/definitions/shared/lib/registry/compile.d.ts +2 -0
  119. package/src/definitions/shared/lib/registry/descriptor-registry.d.ts +587 -0
  120. package/src/definitions/shared/lib/registry/index.d.ts +3 -0
  121. package/src/definitions/shared/lib/registry/validation.d.ts +3 -0
  122. package/src/definitions/shared/lib/schemas/app-filter-bar.schema.d.ts +22 -0
  123. package/src/definitions/shared/lib/schemas/bar.schema.d.ts +73 -0
  124. package/src/definitions/shared/lib/schemas/broad-chart.schema.d.ts +68 -0
  125. package/src/definitions/shared/lib/schemas/common.schema.d.ts +304 -0
  126. package/src/definitions/shared/lib/schemas/filter.schema.d.ts +22 -0
  127. package/src/definitions/shared/lib/schemas/index.d.ts +9 -0
  128. package/src/definitions/shared/lib/schemas/line.schema.d.ts +72 -0
  129. package/src/definitions/shared/lib/schemas/number.schema.d.ts +21 -0
  130. package/src/definitions/shared/lib/schemas/object.schema.d.ts +215 -0
  131. package/src/definitions/shared/lib/schemas/table.schema.d.ts +458 -0
  132. package/src/definitions/shared/lib/types/compilation.types.d.ts +36 -0
  133. package/src/definitions/shared/lib/types/definition.types.d.ts +2 -0
  134. package/src/definitions/shared/lib/types/descriptor.types.d.ts +39 -0
  135. package/src/definitions/shared/lib/types/index.d.ts +3 -0
  136. package/src/getters/index.d.ts +30 -0
  137. package/src/index.d.ts +4 -0
  138. package/src/metadata/index.d.ts +4 -0
  139. package/src/operations/index.d.ts +30 -0
  140. package/src/registry/index.d.ts +6 -0
  141. package/src/runtime/index.d.ts +2 -0
  142. package/src/types.d.ts +307 -0
  143. package/src/visualization-catalog.d.ts +82 -0
  144. package/src/web-components/index.d.ts +12 -0
  145. package/styles.css +2 -0
@@ -0,0 +1,726 @@
1
+ import { o as e, t } from "./rolldown-runtime-DleVn1XH.js";
2
+ import { A as n, D as r, N as i, No as a, Oa as o, P as s, Ta as c, Ti as l, Wc as u, Xs as d, Yn as f, eo as p, on as m, pc as h, qs as g, ti as _ } from "./interfaces-VUY4_yVO.js";
3
+ import { I as v, Ki as y, P as b, Zt as x, o as S, wi as C } from "./utils-Ba9T0TqC.js";
4
+ import { n as w, r as T } from "./treemap-x_zmJoG7.js";
5
+ import { Jt as E, M as ee, St as te, Vt as D, X as ne, Z as re, _t as ie, cn as ae, en as oe, et as se, i as ce, j as le, ln as ue, n as de, nn as O, rn as k, rt as fe, sn as A, tn as pe, un as j, wt as me } from "./escobar-BGqT1EsE.js";
6
+ import { l as M, vt as N } from "./_baseFlatten-DPXPOrea.js";
7
+ import { t as he } from "./coloring-C16AUZEi.js";
8
+ import { t as ge } from "./set-coloring-datafield-B3uIS1Pe.js";
9
+ import { a as _e, n as ve } from "./accessors-DemrDevR.js";
10
+ function P() {
11
+ return 0;
12
+ }
13
+ function F(e) {
14
+ return function() {
15
+ return e;
16
+ };
17
+ }
18
+ function ye(e) {
19
+ e.x0 = Math.round(e.x0), e.y0 = Math.round(e.y0), e.x1 = Math.round(e.x1), e.y1 = Math.round(e.y1);
20
+ }
21
+ function be(e, t, n, r, i) {
22
+ for (var a = e.children, o, s = -1, c = a.length, l = e.value && (r - t) / e.value; ++s < c;) o = a[s], o.y0 = n, o.y1 = i, o.x0 = t, o.x1 = t += o.value * l;
23
+ }
24
+ function xe(e, t, n, r, i) {
25
+ for (var a = e.children, o, s = -1, c = a.length, l = e.value && (i - n) / e.value; ++s < c;) o = a[s], o.x0 = t, o.x1 = r, o.y0 = n, o.y1 = n += o.value * l;
26
+ }
27
+ var Se = (1 + Math.sqrt(5)) / 2;
28
+ function Ce(e, t, n, r, i, a) {
29
+ for (var o = [], s = t.children, c, l, u = 0, d = 0, f = s.length, p, m, h = t.value, g, _, v, y, b, x, S; u < f;) {
30
+ p = i - n, m = a - r;
31
+ do
32
+ g = s[d++].value;
33
+ while (!g && d < f);
34
+ for (_ = v = g, x = Math.max(m / p, p / m) / (h * e), S = g * g * x, b = Math.max(v / S, S / _); d < f; ++d) {
35
+ if (g += l = s[d].value, l < _ && (_ = l), l > v && (v = l), S = g * g * x, y = Math.max(v / S, S / _), y > b) {
36
+ g -= l;
37
+ break;
38
+ }
39
+ b = y;
40
+ }
41
+ o.push(c = {
42
+ value: g,
43
+ dice: p < m,
44
+ children: s.slice(u, d)
45
+ }), c.dice ? be(c, n, r, i, h ? r += m * g / h : a) : xe(c, n, r, h ? n += p * g / h : i, a), h -= g, u = d;
46
+ }
47
+ return o;
48
+ }
49
+ var we = (function e(t) {
50
+ function n(e, n, r, i, a) {
51
+ Ce(t, e, n, r, i, a);
52
+ }
53
+ return n.ratio = function(t) {
54
+ return e((t = +t) > 1 ? t : 1);
55
+ }, n;
56
+ })(Se);
57
+ function Te() {
58
+ var e = we, t = !1, n = 1, r = 1, i = [0], a = P, o = P, s = P, c = P, l = P;
59
+ function u(e) {
60
+ return e.x0 = e.y0 = 0, e.x1 = n, e.y1 = r, e.eachBefore(d), i = [0], t && e.eachBefore(ye), e;
61
+ }
62
+ function d(t) {
63
+ var n = i[t.depth], r = t.x0 + n, u = t.y0 + n, d = t.x1 - n, f = t.y1 - n;
64
+ d < r && (r = d = (r + d) / 2), f < u && (u = f = (u + f) / 2), t.x0 = r, t.y0 = u, t.x1 = d, t.y1 = f, t.children && (n = i[t.depth + 1] = a(t) / 2, r += l(t) - n, u += o(t) - n, d -= s(t) - n, f -= c(t) - n, d < r && (r = d = (r + d) / 2), f < u && (u = f = (u + f) / 2), e(t, r, u, d, f));
65
+ }
66
+ return u.round = function(e) {
67
+ return arguments.length ? (t = !!e, u) : t;
68
+ }, u.size = function(e) {
69
+ return arguments.length ? (n = +e[0], r = +e[1], u) : [n, r];
70
+ }, u.tile = function(t) {
71
+ return arguments.length ? (e = ve(t), u) : e;
72
+ }, u.padding = function(e) {
73
+ return arguments.length ? u.paddingInner(e).paddingOuter(e) : u.paddingInner();
74
+ }, u.paddingInner = function(e) {
75
+ return arguments.length ? (a = typeof e == "function" ? e : F(+e), u) : a;
76
+ }, u.paddingOuter = function(e) {
77
+ return arguments.length ? u.paddingTop(e).paddingRight(e).paddingBottom(e).paddingLeft(e) : u.paddingTop();
78
+ }, u.paddingTop = function(e) {
79
+ return arguments.length ? (o = typeof e == "function" ? e : F(+e), u) : o;
80
+ }, u.paddingRight = function(e) {
81
+ return arguments.length ? (s = typeof e == "function" ? e : F(+e), u) : s;
82
+ }, u.paddingBottom = function(e) {
83
+ return arguments.length ? (c = typeof e == "function" ? e : F(+e), u) : c;
84
+ }, u.paddingLeft = function(e) {
85
+ return arguments.length ? (l = typeof e == "function" ? e : F(+e), u) : l;
86
+ }, u;
87
+ }
88
+ var Ee = /* @__PURE__ */ e(y()), I = /* @__PURE__ */ function(e) {
89
+ return e.cells = "key-cells", e.labels = "key-labels", e.selection = "key-selection", e;
90
+ }({}), L = /* @__PURE__ */ function(e) {
91
+ return e.CellValue = "cellValue", e.Color = "color", e;
92
+ }({}), R = /* @__PURE__ */ function(e) {
93
+ return e.MeasureFormatter = "total", e;
94
+ }({}), z = /* @__PURE__ */ function(e) {
95
+ return e.Leaf = "leaf", e.Header = "header", e;
96
+ }({}), De = (e, t, n, r, i, a, o) => {
97
+ let s = e.measures.filter(l), c = (e.supportingMeasures ?? []).filter((e) => l(e)), u = h(s[0].dataItem), d = ee(c), f = e.dimensions.filter(l).map((e) => h(e.dataItem)), p = f[f.length - 1], m = f.slice(0, f.length - 1), g = {};
98
+ m.forEach((e, t) => {
99
+ g[`dim${t}`] = { field: e };
100
+ });
101
+ let _ = [{
102
+ field: p,
103
+ props: {
104
+ [L.CellValue]: { field: u },
105
+ ...g,
106
+ [u]: { field: u },
107
+ ...d
108
+ }
109
+ }], v = e.coloring ? me(e, o) : null;
110
+ v && (_[0].props[L.Color] = { field: v });
111
+ let y = [{
112
+ key: "coll",
113
+ data: { extract: [..._] }
114
+ }];
115
+ return {
116
+ ...n,
117
+ collections: y,
118
+ formatters: { [R.MeasureFormatter]: e.measures[0].formatter ?? {
119
+ type: "excel-format",
120
+ format: void 0
121
+ } }
122
+ };
123
+ }, B = "treemap-alternates-switcher", V = "treemap-alternates-switcher", Oe = new M(N.fontLight), ke = new M(N.fontDark), H = (e) => f(e) || e.label || e.dataItem?.name || "Field", Ae = (e, t, n, r) => {
124
+ let i = n ? h(n.dataItem) : void 0;
125
+ return {
126
+ type: "native",
127
+ key: `${V}-interaction`,
128
+ events: { click(a) {
129
+ let o = this.element.getBoundingClientRect(), s = {
130
+ x: a.clientX - o.left,
131
+ y: a.clientY - o.top
132
+ }, c = this.chart.shapesAt(s, {
133
+ components: [{
134
+ key: V,
135
+ propagation: "stop"
136
+ }],
137
+ propagation: "stop"
138
+ }).find((e) => e.data?.target === "measure" || e.data?.target === "dimension");
139
+ if (c?.data?.target === "measure" && n && i) {
140
+ r(j.Text, "click", `text-${i}`, a, c, {
141
+ dataItemType: u.Measure,
142
+ dataItemRole: n.role
143
+ });
144
+ return;
145
+ }
146
+ c?.data?.target === "dimension" && e && r(j.Text, "click", `text-${e}`, a, c, {
147
+ dataItemType: u.Dimension,
148
+ dataItemRole: t
149
+ });
150
+ } }
151
+ };
152
+ }, je = (e, t, n, r, i, o, s, c) => {
153
+ let d = e.dimensions.filter(l), f = e.measures.filter(l), p = d[0], m = f[0], g = p ? h(p.dataItem) : void 0;
154
+ if (!p && !m) return n;
155
+ let v = _(e.dimensions, e.enableAlternate, o.isPrintMode), y = _(e.measures, e.enableAlternate, o.isPrintMode);
156
+ if (!v && !y) return n;
157
+ let b = o?.isPrintMode ?? !1, x = v ? d.map((e) => H(e)).join(", ") : void 0, S = y && m ? H(m) : void 0, C = e.treemapSettings.branchColor ?? "rgba(150, 150, 150, 0.3)", w = new M(C).betterContrast(new M(t.fonts.general.color), Oe, ke).rgb(), T = {
158
+ type: B,
159
+ key: V,
160
+ dimensionDataItemType: g ? u.Dimension : void 0,
161
+ dimensionDataItemRole: p?.role,
162
+ measureDataItemType: m ? u.Measure : void 0,
163
+ measureDataItemRole: m?.role,
164
+ layout: {
165
+ dock: a.Bottom,
166
+ displayOrder: 0
167
+ },
168
+ settings: {
169
+ dimensionLabel: x ? D(x) : void 0,
170
+ measureLabel: S ? D(S) : void 0,
171
+ backgroundColor: C,
172
+ fontFamily: t.fonts.general.fontFamily,
173
+ fontSize: `${N.fieldTitle.fontSize}px`,
174
+ color: w,
175
+ paddingLeft: 5,
176
+ paddingRight: 5,
177
+ paddingVertical: 5,
178
+ labelGap: 12
179
+ }
180
+ }, E = c && !b ? [Ae(g, p?.role, m, c)] : [];
181
+ return {
182
+ ...n,
183
+ components: [...n.components, T],
184
+ interactions: n.interactions ? [...n.interactions, ...E] : [...E]
185
+ };
186
+ }, Me = /* @__PURE__ */ t(((e, t) => {
187
+ var n = s(), r = m();
188
+ function i(e, t, a, o, s, c) {
189
+ return r(e) && r(t) && (c.set(t, e), n(e, t, void 0, i, c), c.delete(t)), e;
190
+ }
191
+ t.exports = i;
192
+ })), U = /* @__PURE__ */ e((/* @__PURE__ */ t(((e, t) => {
193
+ var a = i(), o = n(), s = Me(), c = r();
194
+ t.exports = o(function(e) {
195
+ return e.push(void 0, s), a(c, void 0, e);
196
+ });
197
+ })))()), Ne = () => ({
198
+ trigger: [{
199
+ on: ae.Tap,
200
+ action: A.Toggle,
201
+ globalPropagation: "stop",
202
+ propagation: "stop",
203
+ contexts: [k.Selection]
204
+ }, {
205
+ on: ae.Over,
206
+ action: A.Set,
207
+ globalPropagation: "stop",
208
+ propagation: "stop",
209
+ contexts: [k.Highlight]
210
+ }],
211
+ consume: [{
212
+ context: k.Selection,
213
+ data: [""],
214
+ mode: ue.Or,
215
+ style: { inactive: { fill: (e) => {
216
+ let t = !e.fill || e.fill === "none" || e.fill === "transparent";
217
+ switch (!0) {
218
+ case t: return e.fill;
219
+ default: return oe(pe(e.fill), .25);
220
+ }
221
+ } } }
222
+ }]
223
+ }), Pe = (e, t, n, r, i, a) => {
224
+ let o = e.dimensions.filter(l), s = e.measures.filter(l).map((e) => h(e.dataItem)), c = new he(e, t, i?.[0]?.itemsNotAffectedByFiltering), u = [c.MAIN_FIELD];
225
+ o.slice(0, o.length - 1).forEach((e, t) => {
226
+ u.push(`dim${t}`);
227
+ });
228
+ let { labeling: f } = e.treemapSettings, p = (0, U.default)({}, f?.header, T.labeling.header), m = (0, U.default)({}, f?.leaf, T.labeling.leaf), g = {
229
+ key: I.cells,
230
+ type: j.Treemap,
231
+ data: { collection: "coll" },
232
+ settings: {
233
+ numDimensions: o.length || 0,
234
+ cellPadding: e.treemapSettings.cellPadding,
235
+ cellRadius: e.treemapSettings.cellRadius,
236
+ cellOrder: e.treemapSettings.cellOrder,
237
+ branchColor: e.treemapSettings.branchColor,
238
+ headerLabels: {
239
+ show: p.show,
240
+ numLevels: p.numLevels,
241
+ fontSize: E(p.fontSize, void 0, w.labelFontSizeMin, w.labelFontSizeMax)
242
+ },
243
+ leafLabels: {
244
+ show: m.show,
245
+ fontSize: E(m.fontSize, void 0, w.labelFontSizeMin, w.labelFontSizeMax),
246
+ showDimension: m.showDimensionValue,
247
+ showMeasure: m.showMeasureValue,
248
+ dynamicFontSizeEnabled: m.dynamicFontSizeEnabled
249
+ },
250
+ leaf: { fill: c.getColorDefinition({
251
+ ref: L.Color,
252
+ dataItemId: e.coloring.type === d.Single ? s[0] : void 0,
253
+ overwriteSources: u
254
+ }) }
255
+ },
256
+ brush: a.disable?.brushing === !0 ? void 0 : Ne(),
257
+ animations: {
258
+ presetId: "simple-opacity",
259
+ enabled: !0
260
+ }
261
+ };
262
+ return {
263
+ ...n,
264
+ components: [...n.components, g]
265
+ };
266
+ }, W = new M(N.fontLight), G = new M(N.fontDark), Fe = (e, t, n) => {
267
+ let r = new M(n.fonts.general.color), { showDimensionValue: i, showMeasureValue: a, fontSize: o, dynamicFontSizeEnabled: s, show: c } = t.leaf, l = s ? ({ node: e }) => e.desc.dynamicFontSize : E(o, void 0, w.labelFontSizeMin, w.labelFontSizeMax);
268
+ return {
269
+ component: I.cells,
270
+ selector: e,
271
+ strategy: {
272
+ type: "rows",
273
+ settings: {
274
+ justify: 0,
275
+ align: 0,
276
+ fontSize: l,
277
+ padding: 4,
278
+ labels: [i && c !== !1 ? {
279
+ id({ node: e }) {
280
+ return e.attrs?.id;
281
+ },
282
+ fill({ node: e }) {
283
+ return new M(e.desc.background).betterContrast(r, W, G).rgb();
284
+ },
285
+ linkData({ node: e }) {
286
+ return e.data;
287
+ },
288
+ label({ node: e }) {
289
+ return e.desc?.label;
290
+ }
291
+ } : null, a && c !== !1 ? {
292
+ id({ node: e }) {
293
+ return `${e.attrs?.id}::value`;
294
+ },
295
+ fill({ node: e }) {
296
+ return new M(e.desc.background).betterContrast(r, W, G).rgb();
297
+ },
298
+ linkData({ node: e }) {
299
+ return e.data;
300
+ },
301
+ label({ node: e, formatter: t }) {
302
+ return t(R.MeasureFormatter)(e.desc?.total, void 0, e.data);
303
+ }
304
+ } : null].filter(Boolean)
305
+ }
306
+ }
307
+ };
308
+ }, K = 128, Ie = (e, t, n) => {
309
+ let r = new M(n.fonts.general.color), i = E(t.header.fontSize, void 0, w.labelFontSizeMin, w.labelFontSizeMax), { showDimensionValue: a, showMeasureValue: o } = t.header;
310
+ return {
311
+ component: I.cells,
312
+ selector: e,
313
+ strategy: {
314
+ type: "rows",
315
+ settings: {
316
+ justify: 0,
317
+ align: 0,
318
+ fontSize: i,
319
+ padding: 4,
320
+ labels: [{
321
+ id({ node: e }) {
322
+ return e.attrs?.id;
323
+ },
324
+ fill({ node: e }) {
325
+ return new M(e.desc.background).betterContrast(r, W, G).rgb();
326
+ },
327
+ linkData({ node: e }) {
328
+ return e.data;
329
+ },
330
+ label({ node: e, formatter: t }) {
331
+ let n = o ? t(R.MeasureFormatter)(e.desc?.total) : void 0;
332
+ return [a ? e.desc?.label?.length > K - 1 ? `${e.desc?.label?.substring(0, K - 1).replace(/\s+$/, "")}…` : e.desc?.label : void 0, n].filter(Boolean).join(": ");
333
+ }
334
+ }]
335
+ }
336
+ }
337
+ };
338
+ }, Le = (e, t, n, r, i, a) => {
339
+ let o = (0, U.default)({}, e.treemapSettings?.labeling, T.labeling), s = {
340
+ type: j.Labels,
341
+ key: I.labels,
342
+ layout: { displayOrder: 2 },
343
+ settings: { sources: [Fe(`.${z.Leaf}`, o, t), Ie(`.${z.Header}`, o, t)] },
344
+ style: { label: "$label" },
345
+ brush: a.disable?.brushing === !0 ? void 0 : { consume: [{
346
+ context: k.Selection,
347
+ data: [""],
348
+ style: { inactive: { opacity: .3 } }
349
+ }] },
350
+ animations: {
351
+ presetId: "simple-opacity",
352
+ enabled: !0
353
+ }
354
+ };
355
+ return {
356
+ ...n,
357
+ components: [...n.components, s]
358
+ };
359
+ }, Re = () => ({ consume: [{
360
+ context: k.Selection,
361
+ data: [""],
362
+ mode: ue.Or,
363
+ style: {
364
+ active: {
365
+ strokeWidth: 2,
366
+ stroke: o.mainDarkNavy
367
+ },
368
+ inactive: { strokeWidth: 0 }
369
+ }
370
+ }] }), ze = (e, t, n, r, i, a) => {
371
+ let o = {
372
+ key: I.selection,
373
+ type: j.Deferred,
374
+ layout: { displayOrder: 10 },
375
+ settings: { sources: [{
376
+ component: I.cells,
377
+ selector: O.Rect
378
+ }] },
379
+ brush: a.disable?.brushing === !0 ? void 0 : Re(),
380
+ animations: {
381
+ presetId: "simple-opacity",
382
+ enabled: !0
383
+ }
384
+ };
385
+ return {
386
+ ...n,
387
+ components: [...n.components, o]
388
+ };
389
+ }, Be = (e, t, n, r, i, a, o) => {
390
+ if (!e.dimensions.filter(l)[0]) return n;
391
+ let s = n.collections[0]?.data.extract[0]?.props[L.Color], c;
392
+ s?.field && (c = s?.field);
393
+ let u = {};
394
+ return u = te(ge(e, c), t, u, n.collections, o), {
395
+ ...n,
396
+ scales: u
397
+ };
398
+ }, Ve = (e, t, n) => {
399
+ let r = e.dimensions.filter(l), i = e.measures.filter(l);
400
+ if (!r[0] || !i[0]) return n;
401
+ let a = {
402
+ "$font-family": t.fonts.general.fontFamily,
403
+ "$font-color": t.fonts.general.color,
404
+ "$font-size": "12px",
405
+ $label: {
406
+ fontSize: "$font-size",
407
+ fontFamily: "$font-family",
408
+ fill: "$font-color",
409
+ padding: 2
410
+ },
411
+ $title: {
412
+ "@extend": "$label",
413
+ fontSize: `${N.fieldTitle.fontSize}px`,
414
+ padding: 4
415
+ }
416
+ };
417
+ return {
418
+ ...n,
419
+ style: a
420
+ };
421
+ }, He = (e, t) => t.data.label, q = (e, t, n, r, i, a) => {
422
+ let o = t;
423
+ return !r && i ? o = n.formatter(i)(t, void 0, a) : r && (o = n.formatter(fe(i))(t, void 0, a)), {
424
+ label: e,
425
+ value: o
426
+ };
427
+ }, Ue = (e, t, n, r, i, a, o, s) => {
428
+ let c = [], u = e.filter(l), d = se(n), p = u.filter((e) => !d.has(h(e.dataItem)))[0] ?? u[0], m = (p ? f(p) : "") || p?.label || p?.dataItem.name || "", g = p ? m : "Count", _ = Number(t.desc?.total), v = t.data[L.CellValue]?.source ? t.data : void 0;
429
+ return c.push(q(g, _, n, s, R.MeasureFormatter, v)), u.filter((e) => d.has(h(e.dataItem))).forEach((e) => {
430
+ let r = h(e.dataItem), i = Object.keys(t.data).find((e) => t.data[e]?.source?.field === r);
431
+ if (!i) return;
432
+ let a = f(e) || e.label || e.dataItem.name || "", o = Number(t.data[i]?.value);
433
+ c.push(q(a, o, n, s, e.formatter, t.data));
434
+ }), c;
435
+ }, We = (e, t, n, r, i) => {
436
+ let a = {
437
+ placement: () => ({
438
+ area: "target",
439
+ type: "pointer"
440
+ }),
441
+ filter: (e) => e.filter((e) => e.type !== O.Text && e.key === I.cells)
442
+ };
443
+ return a.extract = re(e, t, Ue, He), ne(e, t, n, a, "tooltip", i);
444
+ }, Ge = class extends le {
445
+ constructor() {
446
+ super([
447
+ De,
448
+ Be,
449
+ Pe,
450
+ ze,
451
+ ie,
452
+ je,
453
+ Le,
454
+ Ve,
455
+ We
456
+ ]);
457
+ }
458
+ preCompile(e, t) {
459
+ let n = e.measures.filter(l)[0];
460
+ if (!n) return;
461
+ let r = h(n.dataItem);
462
+ t.forEach((e) => {
463
+ if (e.items?.length && (e.items = e.items.filter((e) => e[r] > 0), !e.items.length)) throw Error("Current data query resulted in only negative and/or null values which can not be displayed in this chart.");
464
+ });
465
+ }
466
+ }, J = {
467
+ numDimensions: 0,
468
+ cellPadding: 2,
469
+ cellRadius: 0,
470
+ leafLabels: {
471
+ showDimension: !0,
472
+ showMeasure: !0,
473
+ show: !0
474
+ },
475
+ headerLabels: {
476
+ show: !0,
477
+ fontSize: 11,
478
+ numLevels: 1
479
+ },
480
+ leaf: { fill: o.mainDarkNavy }
481
+ }, Y = (e) => Array(Math.max(0, e - 1)).fill(0).map((e, t) => `dim${t}`), Ke = "__virtual__::__root__", qe = (e, t) => {
482
+ let n = Y(e.numDimensions), r = {
483
+ data: {
484
+ label: "__root__",
485
+ value: null
486
+ },
487
+ id: Ke,
488
+ children: [],
489
+ fill: "",
490
+ opacity: 0
491
+ }, i = {};
492
+ function a(e) {
493
+ let t = "", n = r;
494
+ for (let r = 0; r < e.length; r++) {
495
+ let a = e[r];
496
+ t += `${a.data.value}`, i[t] ? a = i[t] : (a.id = t, a.children = [], i[t] = a, n.children.push(a)), n = a, t += ":::";
497
+ }
498
+ }
499
+ t.forEach((t) => {
500
+ a([...n.map((n) => ({
501
+ data: t.data[n],
502
+ opacity: 1,
503
+ fill: e.branchColor ?? "rgba(150, 150, 150, 0.3)"
504
+ })), t]);
505
+ });
506
+ let o = _e(r);
507
+ return o.each((e) => delete e.data.children), o;
508
+ }, X = (e) => e + Math.max(12, e * .5), Z = (e, t, n) => e.y1 - e.y0 >= t + 12 && e.x1 - e.x0 >= n * 2;
509
+ function Je(e) {
510
+ let { cellPadding: t, headerLabels: n } = e, { fontSize: r } = n, i = X(r);
511
+ Te().size([e.rect.width, e.rect.height]).paddingInner((e) => e.height > 1 ? t : 0).paddingOuter((e) => e.depth ? t : 0).paddingTop((n) => n.height && n.depth && e.headerLabels.show && e.headerLabels.numLevels >= n.depth && Z(n, i, r) ? t + i : n.depth ? t : 0)(e.root);
512
+ }
513
+ var Ye = 8, Xe = "rgba(250, 250, 250, 0.8)", Ze = "rgba(60, 60, 60, 0.8)", Qe = .12, $e = 24, et = (e, t) => {
514
+ let n = null, r = null;
515
+ return !e.height && t.leafLabels.show ? (r = Qe * Math.sqrt((e.y1 - e.y0) * (e.x1 - e.x0)), n = t.leafLabels.dynamicFontSizeEnabled && r < Ye ? null : z.Leaf) : e.height && t.headerLabels.show && t.headerLabels.numLevels >= e.depth && (n = z.Header), {
516
+ labelTarget: n,
517
+ leafDynamicFontSize: r
518
+ };
519
+ }, tt = (e, t) => {
520
+ let n = [...Y(e.numDimensions), "cell"].map((t, n) => Math.max(0, e.cellRadius - e.cellPadding * n * .25)), r = new M(e.branchColor ?? "rgba(150, 150, 150, 0.3)").isDark() ? Ze : Xe, i = X(e.headerLabels.fontSize);
521
+ return t.descendants().slice(1).filter((e) => (e.x1 - e.x0) * (e.y1 - e.y0) >= 1).map((t) => {
522
+ let a = t.children?.length > 0, s = t.y1 - t.y0, { labelTarget: c, leafDynamicFontSize: l } = et(t, e), u = t.data.fill || o.black, d = n[t.depth - 1];
523
+ return {
524
+ id: t.data.id,
525
+ type: O.Rect,
526
+ tag: c === z.Header ? Z(t, i, e.headerLabels.fontSize) ? c : void 0 : c && s >= $e ? c : void 0,
527
+ x: t.x0,
528
+ y: t.y0,
529
+ rx: d,
530
+ ry: d,
531
+ width: t.x1 - t.x0,
532
+ height: t.y1 - t.y0,
533
+ fill: u,
534
+ stroke: r,
535
+ strokeWidth: +!a,
536
+ opacity: t.data.opacity ?? 1,
537
+ desc: {
538
+ background: u,
539
+ label: t.data.data.label,
540
+ total: t.value,
541
+ dynamicFontSize: l
542
+ },
543
+ data: t.data.data
544
+ };
545
+ });
546
+ }, nt = {
547
+ [p.DESC]: (e, t) => t.height - e.height || t.value - e.value,
548
+ [p.ASC]: (e, t) => t.height - e.height || e.value - t.value
549
+ }, rt = {
550
+ require: [
551
+ "resolver",
552
+ "chart",
553
+ "renderer"
554
+ ],
555
+ defaultSettings: {
556
+ settings: J,
557
+ style: {
558
+ title: "$title",
559
+ label: "$label"
560
+ }
561
+ },
562
+ render({ data: e }) {
563
+ let { settings: t } = this.settings, { items: n } = this.resolver.resolve({
564
+ data: { items: e.items },
565
+ defaults: { ...J.leaf },
566
+ settings: { ...t.leaf }
567
+ }), r = qe(t, n);
568
+ return r.sum((e) => e.children?.length ? 0 : e.data.cellValue?.value || 0), t.cellOrder && nt[t.cellOrder] && r.sort(nt[t.cellOrder]), Je({
569
+ cellPadding: t.cellPadding,
570
+ rect: this.rect,
571
+ root: r,
572
+ headerLabels: t.headerLabels
573
+ }), tt(t, r);
574
+ }
575
+ }, it = " ▼", Q = "...", $ = (e, t, n, r) => {
576
+ let i = {
577
+ text: t,
578
+ fontFamily: n,
579
+ fontSize: r
580
+ };
581
+ return e.measureText(i).width;
582
+ }, at = (e, t, n, r, i) => {
583
+ if (t <= 0 || $(n, e, r, i) <= t) return e;
584
+ let a = e.endsWith(it), o = a ? it : "", s = a ? e.slice(0, -2) : e;
585
+ if ($(n, `${Q}${o}`, r, i) > t) return Q;
586
+ let c = 0, l = s.length;
587
+ for (; c < l;) {
588
+ let e = Math.ceil((c + l) / 2);
589
+ $(n, `${s.slice(0, e)}${Q}${o}`, r, i) <= t ? c = e : l = e - 1;
590
+ }
591
+ return `${s.slice(0, c)}${Q}${o}`;
592
+ }, ot = {
593
+ require: ["renderer"],
594
+ defaultSettings: { settings: {
595
+ dimensionLabel: "",
596
+ measureLabel: "",
597
+ backgroundColor: J.branchColor,
598
+ fontSize: "12px",
599
+ color: "#000",
600
+ paddingLeft: 5,
601
+ paddingRight: 5,
602
+ paddingVertical: 5,
603
+ labelGap: 12
604
+ } },
605
+ preferredSize() {
606
+ let { fontFamily: e = "Arial", fontSize: t, paddingVertical: n } = this.settings.settings;
607
+ return this.renderer.measureText({
608
+ fontFamily: e,
609
+ fontSize: t
610
+ }).height + n * 2;
611
+ },
612
+ render() {
613
+ let { dimensionLabel: e, measureLabel: t, backgroundColor: n, fontFamily: r = "Arial", fontSize: i, color: a, paddingLeft: o, paddingRight: s, labelGap: c } = this.settings.settings, l = t ? $(this.renderer, t, r, i) : 0, u = this.rect.width - s, d = u - l, f = Math.max(Math.min(t ? d - c - o : this.rect.width - o - s, this.rect.width / 2), 0), p = e ? at(e, f, this.renderer, r, i) : "", m = p ? $(this.renderer, p, r, i) : 0, h = [{
614
+ type: "rect",
615
+ x: 0,
616
+ y: 0,
617
+ width: this.rect.width,
618
+ height: this.rect.height,
619
+ fill: n,
620
+ strokeWidth: 0
621
+ }];
622
+ return t && h.push({
623
+ type: "rect",
624
+ x: Math.max(d, 0),
625
+ y: 0,
626
+ width: Math.min(l, this.rect.width),
627
+ height: this.rect.height,
628
+ fill: "rgba(0, 0, 0, 0)",
629
+ strokeWidth: 0,
630
+ data: { target: "measure" }
631
+ }), e && (h.push({
632
+ type: "rect",
633
+ x: o,
634
+ y: 0,
635
+ width: m,
636
+ height: this.rect.height,
637
+ fill: "rgba(0, 0, 0, 0)",
638
+ strokeWidth: 0,
639
+ data: { target: "dimension" }
640
+ }), h.push({
641
+ type: "text",
642
+ text: p,
643
+ x: o,
644
+ y: this.rect.height / 2,
645
+ anchor: "start",
646
+ baseline: "central",
647
+ fontFamily: r,
648
+ fontSize: i,
649
+ fill: a,
650
+ maxWidth: f,
651
+ data: { target: "dimension" }
652
+ })), t && h.push({
653
+ type: "text",
654
+ text: t,
655
+ x: u,
656
+ y: this.rect.height / 2,
657
+ anchor: "end",
658
+ baseline: "central",
659
+ fontFamily: r,
660
+ fontSize: i,
661
+ fill: a,
662
+ data: { target: "measure" }
663
+ }), h;
664
+ }
665
+ };
666
+ function st(e) {
667
+ e.component(j.Treemap, rt), e.component(B, ot);
668
+ }
669
+ var ct = {
670
+ require: [
671
+ "resolver",
672
+ "chart",
673
+ "renderer"
674
+ ],
675
+ defaultSettings: { settings: { sources: [] } },
676
+ render() {
677
+ let { settings: e } = this.settings, t = [];
678
+ return e.sources.forEach((e) => {
679
+ this.chart.component(e.component) && this.chart.findShapes(e.selector).filter((t) => t.key === e.component).forEach((e) => {
680
+ t.push({
681
+ type: O.Rect,
682
+ height: e.attrs.height,
683
+ width: e.attrs.width,
684
+ x: e.attrs.x,
685
+ y: e.attrs.y,
686
+ rx: e.attrs.rx,
687
+ ry: e.attrs.ry,
688
+ fill: "transparent",
689
+ stroke: o.mainDarkNavy,
690
+ strokeWidth: 0,
691
+ data: e.data,
692
+ collider: { type: null }
693
+ });
694
+ });
695
+ }), t;
696
+ }
697
+ };
698
+ function lt(e) {
699
+ e.component(j.Deferred, ct);
700
+ }
701
+ var ut = C(), dt = x(({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: i }) => {
702
+ let a = b(), [o] = (0, Ee.useState)(() => new Ge()), s = v(), l = t || c, u = S(), d = de(), f = u.targetDataItemId;
703
+ if (!f && u.targetInternalKey) {
704
+ let t = e.dimensions.find((e) => e.dataItem.internalKey === u.targetInternalKey);
705
+ t && (f = h(t.dataItem));
706
+ }
707
+ let p = {
708
+ ...i,
709
+ valuePickerMode: !!u.activeKey,
710
+ valuePickerTargetDataItemId: f
711
+ }, m = {
712
+ ...i,
713
+ disable: {
714
+ ...i.disable,
715
+ multiDimSelection: !0
716
+ }
717
+ }, _ = o.compile(e, l, n, r, p, g.Treemap, a, s, d);
718
+ return _ ? /* @__PURE__ */ (0, ut.jsx)(ce, {
719
+ config: m,
720
+ definition: _,
721
+ size: r,
722
+ vSpec: e,
723
+ escobarPlugins: [st, lt]
724
+ }) : null;
725
+ });
726
+ export { dt as Treemap };