@astrato-io/visualizations 0.0.0-stage → 0.6.5

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 (139) 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 +8477 -0
  5. package/VISUALIZATION_DEFINITIONS.md +2378 -0
  6. package/chunks/ClickAwayListener-BbeNMAvj.js +52 -0
  7. package/chunks/LinearProgress-B1FeWaen.js +253 -0
  8. package/chunks/accessors-DemrDevR.js +128 -0
  9. package/chunks/app-filter-bar.compiler-BGJ7HAbr.js +64 -0
  10. package/chunks/bar.compiler-CT0ZbQKc.js +374 -0
  11. package/chunks/builder-B6dWSIdD.js +12289 -0
  12. package/chunks/color-settings-ZIvgNTq1.js +10 -0
  13. package/chunks/coloring-B1XAfg6b.js +664 -0
  14. package/chunks/debounce-fn-CUixuz45.js +7 -0
  15. package/chunks/definitions-D3OVqmXl.js +2102 -0
  16. package/chunks/escobar-eDjtGpkC.js +34606 -0
  17. package/chunks/events-WZut5Ow6.js +4 -0
  18. package/chunks/extend-BKUkc4_i.js +37 -0
  19. package/chunks/filter.compiler-DBsyRBJt.js +70 -0
  20. package/chunks/filtering-tqjAyJH5.js +1072 -0
  21. package/chunks/grouping-type-On4s9Thj.js +3 -0
  22. package/chunks/handlers-VTBfIZYZ.js +13072 -0
  23. package/chunks/isEqual-BDxAhUo8.js +7514 -0
  24. package/chunks/line.compiler-CzdM5Ld0.js +198 -0
  25. package/chunks/metadata-BGElBy5Z.js +28 -0
  26. package/chunks/number.compiler-G-R7y16P.js +53 -0
  27. package/chunks/operations-CTNUX6Sy.js +26249 -0
  28. package/chunks/range-CiwTbMig.js +22 -0
  29. package/chunks/registry-CsQQzukD.js +920 -0
  30. package/chunks/requirements-DYjZCFyf.js +6 -0
  31. package/chunks/rolldown-runtime-DleVn1XH.js +28 -0
  32. package/chunks/set-coloring-datafield-B3uIS1Pe.js +8 -0
  33. package/chunks/shared-CBvcC5YV.js +1218 -0
  34. package/chunks/src-BOS6SqkZ.js +67 -0
  35. package/chunks/src-D9XogOrc.js +422 -0
  36. package/chunks/standalone-0M4HlmDW2.js +3944 -0
  37. package/chunks/standalone-0ashe9w1.js +411 -0
  38. package/chunks/standalone-B7jax8wa.js +339 -0
  39. package/chunks/standalone-BK0VYU-l.js +463 -0
  40. package/chunks/standalone-BMIbT1b2.js +4619 -0
  41. package/chunks/standalone-BZV5vOwA.js +6 -0
  42. package/chunks/standalone-BhDrWj4p.js +1980 -0
  43. package/chunks/standalone-BtSHCp2U2.js +673 -0
  44. package/chunks/standalone-BvaKdky9.js +344 -0
  45. package/chunks/standalone-BwtM31-f.js +2 -0
  46. package/chunks/standalone-C3gg736V.js +1129 -0
  47. package/chunks/standalone-CC1VUjO32.js +299 -0
  48. package/chunks/standalone-C_rYnZ0N.js +741 -0
  49. package/chunks/standalone-CoLrAxRV.js +13198 -0
  50. package/chunks/standalone-DC-aUgXC.js +3855 -0
  51. package/chunks/standalone-DCtRoTWg.js +675 -0
  52. package/chunks/standalone-DUDFTBqL.js +833 -0
  53. package/chunks/standalone-DhZkX9Td.js +2 -0
  54. package/chunks/standalone-DtLElfuM.js +512 -0
  55. package/chunks/standalone-G9Q4Uczu.js +726 -0
  56. package/chunks/standalone-JuLF-OoH.js +1762 -0
  57. package/chunks/standalone-_DeX21JJ.js +383 -0
  58. package/chunks/standalone-gFhKZh8m.js +179 -0
  59. package/chunks/standalone-tDNy-SFH.js +281 -0
  60. package/chunks/standalone-v1oxfU20.js +68 -0
  61. package/chunks/standalone-vzBY6q0I2.js +140 -0
  62. package/chunks/stroke-dash-UgMEcCS4.js +6 -0
  63. package/chunks/table.compiler-tb914oj3.js +222 -0
  64. package/chunks/typeof-CJDtcySz.js +13 -0
  65. package/chunks/ui-DQWtv2iM.js +63551 -0
  66. package/chunks/url-utils-B17gj_mr.js +5501 -0
  67. package/chunks/useFieldName-BvdcoJRl.js +7 -0
  68. package/chunks/utils-Bg7K-t6K.js +32379 -0
  69. package/chunks/view-Bn83C8d9.js +12466 -0
  70. package/definitions.js +3 -0
  71. package/docs/operations/astrato-app-filter-bar.md +161 -0
  72. package/docs/operations/bar.md +6968 -0
  73. package/docs/operations/combo.md +5804 -0
  74. package/docs/operations/date-picker.md +644 -0
  75. package/docs/operations/distribution-gauge.md +3082 -0
  76. package/docs/operations/dot.md +5570 -0
  77. package/docs/operations/filter.md +1483 -0
  78. package/docs/operations/gauge.md +3316 -0
  79. package/docs/operations/heatMap.md +5944 -0
  80. package/docs/operations/histogram.md +1856 -0
  81. package/docs/operations/iframe.md +56 -0
  82. package/docs/operations/image.md +177 -0
  83. package/docs/operations/index.md +46 -0
  84. package/docs/operations/line.md +6391 -0
  85. package/docs/operations/number.md +3903 -0
  86. package/docs/operations/pie.md +5956 -0
  87. package/docs/operations/radar.md +4566 -0
  88. package/docs/operations/sankey.md +3088 -0
  89. package/docs/operations/scatter.md +5969 -0
  90. package/docs/operations/shape.md +315 -0
  91. package/docs/operations/simpleTextObject.md +699 -0
  92. package/docs/operations/slider.md +220 -0
  93. package/docs/operations/table.md +8800 -0
  94. package/docs/operations/tree.md +2867 -0
  95. package/docs/operations/treemap.md +3527 -0
  96. package/docs/operations/waterfall.md +2928 -0
  97. package/docs/operations/word-cloud.md +3000 -0
  98. package/getters.js +18 -0
  99. package/index.js +1183 -0
  100. package/metadata.js +20 -0
  101. package/operations.js +64 -0
  102. package/package.json +185 -4
  103. package/src/definitions/index.d.ts +2 -0
  104. package/src/definitions/model/definitions/available-fields.d.ts +35 -0
  105. package/src/definitions/model/definitions/compilers/compile.d.ts +7 -0
  106. package/src/definitions/model/definitions/data-item-resolution.d.ts +19 -0
  107. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +1341 -0
  108. package/src/definitions/model/definitions/descriptors/json-schema.d.ts +2 -0
  109. package/src/definitions/model/definitions/diagnostics.d.ts +5 -0
  110. package/src/definitions/model/definitions/field-suggestions.d.ts +2 -0
  111. package/src/definitions/model/definitions/index.d.ts +23 -0
  112. package/src/definitions/model/definitions/registry/compile.d.ts +2 -0
  113. package/src/definitions/model/definitions/registry/descriptor-registry.d.ts +3 -0
  114. package/src/definitions/model/definitions/schema-registry.d.ts +660 -0
  115. package/src/definitions/model/definitions/schemas/app-filter-bar.schema.d.ts +22 -0
  116. package/src/definitions/model/definitions/schemas/bar.schema.d.ts +73 -0
  117. package/src/definitions/model/definitions/schemas/broad-chart.schema.d.ts +68 -0
  118. package/src/definitions/model/definitions/schemas/common.schema.d.ts +303 -0
  119. package/src/definitions/model/definitions/schemas/filter.schema.d.ts +22 -0
  120. package/src/definitions/model/definitions/schemas/index.d.ts +9 -0
  121. package/src/definitions/model/definitions/schemas/line.schema.d.ts +72 -0
  122. package/src/definitions/model/definitions/schemas/number.schema.d.ts +21 -0
  123. package/src/definitions/model/definitions/schemas/object.schema.d.ts +215 -0
  124. package/src/definitions/model/definitions/schemas/table.schema.d.ts +458 -0
  125. package/src/definitions/model/definitions/types/compilation.types.d.ts +36 -0
  126. package/src/definitions/model/definitions/types/definition.types.d.ts +2 -0
  127. package/src/definitions/model/definitions/types/descriptor.types.d.ts +39 -0
  128. package/src/definitions/model/definitions/types/index.d.ts +3 -0
  129. package/src/definitions/model/definitions/validation.d.ts +3 -0
  130. package/src/getters/index.d.ts +30 -0
  131. package/src/index.d.ts +4 -0
  132. package/src/metadata/index.d.ts +4 -0
  133. package/src/operations/index.d.ts +30 -0
  134. package/src/registry/index.d.ts +6 -0
  135. package/src/runtime/index.d.ts +2 -0
  136. package/src/types.d.ts +307 -0
  137. package/src/visualization-catalog.d.ts +82 -0
  138. package/src/web-components/index.d.ts +12 -0
  139. package/styles.css +2 -0
@@ -0,0 +1,726 @@
1
+ import { o as e, t } from "./rolldown-runtime-DleVn1XH.js";
2
+ import { Gn as n, Ks as r, Mo as i, O as a, Qa as o, S as s, Sa as c, Si as l, T as u, Ta as d, Uc as f, Ys as p, Zr as m, fc as h, k as g, tn as _ } from "./isEqual-BDxAhUo8.js";
3
+ import { $t as v, Ei as y, I as b, P as x, Yi as S, o as C } from "./utils-Bg7K-t6K.js";
4
+ import { vm as w, ym as T } from "./handlers-VTBfIZYZ.js";
5
+ import { Vt as E, mt as D } from "./ui-DQWtv2iM.js";
6
+ import { Jt as O, M as ee, St as te, Vt as k, X as ne, Z as re, _t as ie, cn as ae, dn as A, et as oe, i as se, in as j, j as ce, ln as le, n as ue, nn as de, rn as M, rt as fe, tn as pe, un as me, wt as he } from "./escobar-eDjtGpkC.js";
7
+ import { t as ge } from "./coloring-B1XAfg6b.js";
8
+ import { t as _e } from "./set-coloring-datafield-B3uIS1Pe.js";
9
+ import { a as ve, n as ye } from "./accessors-DemrDevR.js";
10
+ function N() {
11
+ return 0;
12
+ }
13
+ function P(e) {
14
+ return function() {
15
+ return e;
16
+ };
17
+ }
18
+ function be(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 xe(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 Se(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 Ce = (1 + Math.sqrt(5)) / 2;
28
+ function we(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 ? xe(c, n, r, i, h ? r += m * g / h : a) : Se(c, n, r, h ? n += p * g / h : i, a), h -= g, u = d;
46
+ }
47
+ return o;
48
+ }
49
+ var Te = (function e(t) {
50
+ function n(e, n, r, i, a) {
51
+ we(t, e, n, r, i, a);
52
+ }
53
+ return n.ratio = function(t) {
54
+ return e((t = +t) > 1 ? t : 1);
55
+ }, n;
56
+ })(Ce);
57
+ function Ee() {
58
+ var e = Te, t = !1, n = 1, r = 1, i = [0], a = N, o = N, s = N, c = N, l = N;
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(be), 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 = ye(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 : P(+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 : P(+e), u) : o;
80
+ }, u.paddingRight = function(e) {
81
+ return arguments.length ? (s = typeof e == "function" ? e : P(+e), u) : s;
82
+ }, u.paddingBottom = function(e) {
83
+ return arguments.length ? (c = typeof e == "function" ? e : P(+e), u) : c;
84
+ }, u.paddingLeft = function(e) {
85
+ return arguments.length ? (l = typeof e == "function" ? e : P(+e), u) : l;
86
+ }, u;
87
+ }
88
+ var De = /* @__PURE__ */ e(S()), F = /* @__PURE__ */ function(e) {
89
+ return e.cells = "key-cells", e.labels = "key-labels", e.selection = "key-selection", e;
90
+ }({}), I = /* @__PURE__ */ function(e) {
91
+ return e.CellValue = "cellValue", e.Color = "color", e;
92
+ }({}), L = /* @__PURE__ */ function(e) {
93
+ return e.MeasureFormatter = "total", e;
94
+ }({}), R = /* @__PURE__ */ function(e) {
95
+ return e.Leaf = "leaf", e.Header = "header", e;
96
+ }({}), Oe = (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
+ [I.CellValue]: { field: u },
105
+ ...g,
106
+ [u]: { field: u },
107
+ ...d
108
+ }
109
+ }], v = e.coloring ? he(e, o) : null;
110
+ v && (_[0].props[I.Color] = { field: v });
111
+ let y = [{
112
+ key: "coll",
113
+ data: { extract: [..._] }
114
+ }];
115
+ return {
116
+ ...n,
117
+ collections: y,
118
+ formatters: { [L.MeasureFormatter]: e.measures[0].formatter ?? {
119
+ type: "excel-format",
120
+ format: void 0
121
+ } }
122
+ };
123
+ }, z = "treemap-alternates-switcher", B = "treemap-alternates-switcher", ke = new D(E.fontLight), Ae = new D(E.fontDark), V = (e) => n(e) || e.label || e.dataItem?.name || "Field", je = (e, t, n, r) => {
124
+ let i = n ? h(n.dataItem) : void 0;
125
+ return {
126
+ type: "native",
127
+ key: `${B}-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: B,
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(A.Text, "click", `text-${i}`, a, c, {
141
+ dataItemType: f.Measure,
142
+ dataItemRole: n.role
143
+ });
144
+ return;
145
+ }
146
+ c?.data?.target === "dimension" && e && r(A.Text, "click", `text-${e}`, a, c, {
147
+ dataItemType: f.Dimension,
148
+ dataItemRole: t
149
+ });
150
+ } }
151
+ };
152
+ }, Me = (e, t, n, r, a, o, s, c) => {
153
+ let u = e.dimensions.filter(l), d = e.measures.filter(l), p = u[0], g = d[0], _ = p ? h(p.dataItem) : void 0;
154
+ if (!p && !g) return n;
155
+ let v = m(e.dimensions, e.enableAlternate, o.isPrintMode), y = m(e.measures, e.enableAlternate, o.isPrintMode);
156
+ if (!v && !y) return n;
157
+ let b = o?.isPrintMode ?? !1, x = v ? u.map((e) => V(e)).join(", ") : void 0, S = y && g ? V(g) : void 0, C = e.treemapSettings.branchColor ?? "rgba(150, 150, 150, 0.3)", w = new D(C).betterContrast(new D(t.fonts.general.color), ke, Ae).rgb(), T = {
158
+ type: z,
159
+ key: B,
160
+ dimensionDataItemType: _ ? f.Dimension : void 0,
161
+ dimensionDataItemRole: p?.role,
162
+ measureDataItemType: g ? f.Measure : void 0,
163
+ measureDataItemRole: g?.role,
164
+ layout: {
165
+ dock: i.Bottom,
166
+ displayOrder: 0
167
+ },
168
+ settings: {
169
+ dimensionLabel: x ? k(x) : void 0,
170
+ measureLabel: S ? k(S) : void 0,
171
+ backgroundColor: C,
172
+ fontFamily: t.fonts.general.fontFamily,
173
+ fontSize: `${E.fieldTitle.fontSize}px`,
174
+ color: w,
175
+ paddingLeft: 5,
176
+ paddingRight: 5,
177
+ paddingVertical: 5,
178
+ labelGap: 12
179
+ }
180
+ }, O = c && !b ? [je(_, p?.role, g, c)] : [];
181
+ return {
182
+ ...n,
183
+ components: [...n.components, T],
184
+ interactions: n.interactions ? [...n.interactions, ...O] : [...O]
185
+ };
186
+ }, Ne = /* @__PURE__ */ t(((e, t) => {
187
+ var n = g(), r = _();
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
+ })), H = /* @__PURE__ */ e((/* @__PURE__ */ t(((e, t) => {
193
+ var n = a(), r = u(), i = Ne(), o = s();
194
+ t.exports = r(function(e) {
195
+ return e.push(void 0, i), n(o, void 0, e);
196
+ });
197
+ })))()), Pe = () => ({
198
+ trigger: [{
199
+ on: le.Tap,
200
+ action: ae.Toggle,
201
+ globalPropagation: "stop",
202
+ propagation: "stop",
203
+ contexts: [j.Selection]
204
+ }, {
205
+ on: le.Over,
206
+ action: ae.Set,
207
+ globalPropagation: "stop",
208
+ propagation: "stop",
209
+ contexts: [j.Highlight]
210
+ }],
211
+ consume: [{
212
+ context: j.Selection,
213
+ data: [""],
214
+ mode: me.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 pe(de(e.fill), .25);
220
+ }
221
+ } } }
222
+ }]
223
+ }), Fe = (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 ge(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: d } = e.treemapSettings, f = (0, H.default)({}, d?.header, T.labeling.header), m = (0, H.default)({}, d?.leaf, T.labeling.leaf), g = {
229
+ key: F.cells,
230
+ type: A.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: f.show,
240
+ numLevels: f.numLevels,
241
+ fontSize: O(f.fontSize, void 0, w.labelFontSizeMin, w.labelFontSizeMax)
242
+ },
243
+ leafLabels: {
244
+ show: m.show,
245
+ fontSize: O(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: I.Color,
252
+ dataItemId: e.coloring.type === p.Single ? s[0] : void 0,
253
+ overwriteSources: u
254
+ }) }
255
+ },
256
+ brush: a.disable?.brushing === !0 ? void 0 : Pe(),
257
+ animations: {
258
+ presetId: "simple-opacity",
259
+ enabled: !0
260
+ }
261
+ };
262
+ return {
263
+ ...n,
264
+ components: [...n.components, g]
265
+ };
266
+ }, U = new D(E.fontLight), W = new D(E.fontDark), Ie = (e, t, n) => {
267
+ let r = new D(n.fonts.general.color), { showDimensionValue: i, showMeasureValue: a, fontSize: o, dynamicFontSizeEnabled: s, show: c } = t.leaf, l = s ? ({ node: e }) => e.desc.dynamicFontSize : O(o, void 0, w.labelFontSizeMin, w.labelFontSizeMax);
268
+ return {
269
+ component: F.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 D(e.desc.background).betterContrast(r, U, W).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 D(e.desc.background).betterContrast(r, U, W).rgb();
297
+ },
298
+ linkData({ node: e }) {
299
+ return e.data;
300
+ },
301
+ label({ node: e, formatter: t }) {
302
+ return t(L.MeasureFormatter)(e.desc?.total, void 0, e.data);
303
+ }
304
+ } : null].filter(Boolean)
305
+ }
306
+ }
307
+ };
308
+ }, G = 128, Le = (e, t, n) => {
309
+ let r = new D(n.fonts.general.color), i = O(t.header.fontSize, void 0, w.labelFontSizeMin, w.labelFontSizeMax), { showDimensionValue: a, showMeasureValue: o } = t.header;
310
+ return {
311
+ component: F.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 D(e.desc.background).betterContrast(r, U, W).rgb();
326
+ },
327
+ linkData({ node: e }) {
328
+ return e.data;
329
+ },
330
+ label({ node: e, formatter: t }) {
331
+ let n = o ? t(L.MeasureFormatter)(e.desc?.total) : void 0;
332
+ return [a ? e.desc?.label?.length > G - 1 ? `${e.desc?.label?.substring(0, G - 1).replace(/\s+$/, "")}…` : e.desc?.label : void 0, n].filter(Boolean).join(": ");
333
+ }
334
+ }]
335
+ }
336
+ }
337
+ };
338
+ }, Re = (e, t, n, r, i, a) => {
339
+ let o = (0, H.default)({}, e.treemapSettings?.labeling, T.labeling), s = {
340
+ type: A.Labels,
341
+ key: F.labels,
342
+ layout: { displayOrder: 2 },
343
+ settings: { sources: [Ie(`.${R.Leaf}`, o, t), Le(`.${R.Header}`, o, t)] },
344
+ style: { label: "$label" },
345
+ brush: a.disable?.brushing === !0 ? void 0 : { consume: [{
346
+ context: j.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
+ }, ze = () => ({ consume: [{
360
+ context: j.Selection,
361
+ data: [""],
362
+ mode: me.Or,
363
+ style: {
364
+ active: {
365
+ strokeWidth: 2,
366
+ stroke: d.mainDarkNavy
367
+ },
368
+ inactive: { strokeWidth: 0 }
369
+ }
370
+ }] }), Be = (e, t, n, r, i, a) => {
371
+ let o = {
372
+ key: F.selection,
373
+ type: A.Deferred,
374
+ layout: { displayOrder: 10 },
375
+ settings: { sources: [{
376
+ component: F.cells,
377
+ selector: M.Rect
378
+ }] },
379
+ brush: a.disable?.brushing === !0 ? void 0 : ze(),
380
+ animations: {
381
+ presetId: "simple-opacity",
382
+ enabled: !0
383
+ }
384
+ };
385
+ return {
386
+ ...n,
387
+ components: [...n.components, o]
388
+ };
389
+ }, Ve = (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[I.Color], c;
392
+ s?.field && (c = s?.field);
393
+ let u = {};
394
+ return u = te(_e(e, c), t, u, n.collections, o), {
395
+ ...n,
396
+ scales: u
397
+ };
398
+ }, He = (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: `${E.fieldTitle.fontSize}px`,
414
+ padding: 4
415
+ }
416
+ };
417
+ return {
418
+ ...n,
419
+ style: a
420
+ };
421
+ }, Ue = (e, t) => t.data.label, K = (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
+ }, We = (e, t, r, i, a, o, s, c) => {
428
+ let u = [], d = e.filter(l), f = oe(r), p = d.filter((e) => !f.has(h(e.dataItem)))[0] ?? d[0], m = (p ? n(p) : "") || p?.label || p?.dataItem.name || "", g = p ? m : "Count", _ = Number(t.desc?.total), v = t.data[I.CellValue]?.source ? t.data : void 0;
429
+ return u.push(K(g, _, r, c, L.MeasureFormatter, v)), d.filter((e) => f.has(h(e.dataItem))).forEach((e) => {
430
+ let i = h(e.dataItem), a = Object.keys(t.data).find((e) => t.data[e]?.source?.field === i);
431
+ if (!a) return;
432
+ let o = n(e) || e.label || e.dataItem.name || "", s = Number(t.data[a]?.value);
433
+ u.push(K(o, s, r, c, e.formatter, t.data));
434
+ }), u;
435
+ }, Ge = (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 !== M.Text && e.key === F.cells)
442
+ };
443
+ return a.extract = re(e, t, We, Ue), ne(e, t, n, a, "tooltip", i);
444
+ }, Ke = class extends ce {
445
+ constructor() {
446
+ super([
447
+ Oe,
448
+ Ve,
449
+ Fe,
450
+ Be,
451
+ ie,
452
+ Me,
453
+ Re,
454
+ He,
455
+ Ge
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
+ }, q = {
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: d.mainDarkNavy }
481
+ }, J = (e) => Array(Math.max(0, e - 1)).fill(0).map((e, t) => `dim${t}`), qe = "__virtual__::__root__", Je = (e, t) => {
482
+ let n = J(e.numDimensions), r = {
483
+ data: {
484
+ label: "__root__",
485
+ value: null
486
+ },
487
+ id: qe,
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 = ve(r);
507
+ return o.each((e) => delete e.data.children), o;
508
+ }, Y = (e) => e + Math.max(12, e * .5), X = (e, t, n) => e.y1 - e.y0 >= t + 12 && e.x1 - e.x0 >= n * 2;
509
+ function Ye(e) {
510
+ let { cellPadding: t, headerLabels: n } = e, { fontSize: r } = n, i = Y(r);
511
+ Ee().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 && X(n, i, r) ? t + i : n.depth ? t : 0)(e.root);
512
+ }
513
+ var Xe = 8, Ze = "rgba(250, 250, 250, 0.8)", Qe = "rgba(60, 60, 60, 0.8)", $e = .12, et = 24, tt = (e, t) => {
514
+ let n = null, r = null;
515
+ return !e.height && t.leafLabels.show ? (r = $e * Math.sqrt((e.y1 - e.y0) * (e.x1 - e.x0)), n = t.leafLabels.dynamicFontSizeEnabled && r < Xe ? null : R.Leaf) : e.height && t.headerLabels.show && t.headerLabels.numLevels >= e.depth && (n = R.Header), {
516
+ labelTarget: n,
517
+ leafDynamicFontSize: r
518
+ };
519
+ }, nt = (e, t) => {
520
+ let n = [...J(e.numDimensions), "cell"].map((t, n) => Math.max(0, e.cellRadius - e.cellPadding * n * .25)), r = new D(e.branchColor ?? "rgba(150, 150, 150, 0.3)").isDark() ? Qe : Ze, i = Y(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, o = t.y1 - t.y0, { labelTarget: s, leafDynamicFontSize: c } = tt(t, e), l = t.data.fill || d.black, u = n[t.depth - 1];
523
+ return {
524
+ id: t.data.id,
525
+ type: M.Rect,
526
+ tag: s === R.Header ? X(t, i, e.headerLabels.fontSize) ? s : void 0 : s && o >= et ? s : void 0,
527
+ x: t.x0,
528
+ y: t.y0,
529
+ rx: u,
530
+ ry: u,
531
+ width: t.x1 - t.x0,
532
+ height: t.y1 - t.y0,
533
+ fill: l,
534
+ stroke: r,
535
+ strokeWidth: +!a,
536
+ opacity: t.data.opacity ?? 1,
537
+ desc: {
538
+ background: l,
539
+ label: t.data.data.label,
540
+ total: t.value,
541
+ dynamicFontSize: c
542
+ },
543
+ data: t.data.data
544
+ };
545
+ });
546
+ }, Z = {
547
+ [o.DESC]: (e, t) => t.height - e.height || t.value - e.value,
548
+ [o.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: q,
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: { ...q.leaf },
566
+ settings: { ...t.leaf }
567
+ }), r = Je(t, n);
568
+ return r.sum((e) => e.children?.length ? 0 : e.data.cellValue?.value || 0), t.cellOrder && Z[t.cellOrder] && r.sort(Z[t.cellOrder]), Ye({
569
+ cellPadding: t.cellPadding,
570
+ rect: this.rect,
571
+ root: r,
572
+ headerLabels: t.headerLabels
573
+ }), nt(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: q.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(A.Treemap, rt), e.component(z, 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: M.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: d.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(A.Deferred, ct);
700
+ }
701
+ var ut = y(), dt = v(({ vSpec: e, vTheme: t, data: n, elementSize: i, vizProperties: a }) => {
702
+ let o = x(), [s] = (0, De.useState)(() => new Ke()), l = b(), u = t || c, d = C(), f = ue(), p = d.targetDataItemId;
703
+ if (!p && d.targetInternalKey) {
704
+ let t = e.dimensions.find((e) => e.dataItem.internalKey === d.targetInternalKey);
705
+ t && (p = h(t.dataItem));
706
+ }
707
+ let m = {
708
+ ...a,
709
+ valuePickerMode: !!d.activeKey,
710
+ valuePickerTargetDataItemId: p
711
+ }, g = {
712
+ ...a,
713
+ disable: {
714
+ ...a.disable,
715
+ multiDimSelection: !0
716
+ }
717
+ }, _ = s.compile(e, u, n, i, m, r.Treemap, o, l, f);
718
+ return _ ? /* @__PURE__ */ (0, ut.jsx)(se, {
719
+ config: g,
720
+ definition: _,
721
+ size: i,
722
+ vSpec: e,
723
+ escobarPlugins: [st, lt]
724
+ }) : null;
725
+ });
726
+ export { dt as Treemap };