@astrato-io/visualizations 0.11.0 → 0.12.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.
- package/CHANGELOG.md +19 -0
- package/README.md +129 -4
- package/VISUALIZATION_DEFINITIONS.md +3 -1
- package/chunks/{Button-CPG4WX8X.js → Button-CQdoKSXX.js} +3 -3
- package/chunks/{CircularProgress-PSLW8HmD.js → CircularProgress-DpT1lwWw.js} +18 -18
- package/chunks/FieldTypeIcon-Cg4F9Q5D.js +22 -0
- package/chunks/{LinearProgress-KQ2EQlGL.js → LinearProgress-B7S0Q26A.js} +8 -8
- package/chunks/{MenuOption-B-6K7kks.js → MenuOption-DpKFJxmo.js} +133 -133
- package/chunks/{Title-BmvwZYkh.js → Title-m5damhc0.js} +10 -10
- package/chunks/{_createAggregator-CFmH6gUN.js → _createAggregator-BA8_iU9q.js} +7 -7
- package/chunks/{app-filter-bar.compiler-BY5-T16I.js → app-filter-bar.compiler--T4Qz3Wu.js} +3 -3
- package/chunks/{bar-layout-BNou0dZF.js → bar-layout-OFhxn2Go.js} +2 -2
- package/chunks/{bar.compiler-BkhO7sDd.js → bar.compiler-hWZBYYvV.js} +62 -62
- package/chunks/{builder-CNjuqD2z.js → builder-7w_bgV_h.js} +31 -31
- package/chunks/{coloring-BOiP0rmn.js → coloring-Cd6p0GQJ.js} +88 -83
- package/chunks/{createSimplePaletteValueFilter-BkgQ7MFE.js → createSimplePaletteValueFilter-CiJT8s1s.js} +55 -55
- package/chunks/defaults-CMFqXvaJ.js +3 -0
- package/chunks/{definitions-AS9GcavE.js → definitions-DTauTjIX.js} +412 -406
- package/chunks/{escobar-cQ1eQ64G.js → escobar-CMvphKSK.js} +4787 -4717
- package/chunks/{extend-preset-BlCbcXKR.js → extend-preset-BpXttHFk.js} +371 -372
- package/chunks/{filter.compiler-CI7dDNM1.js → filter.compiler-DOGFweJz.js} +4 -4
- package/chunks/{filtering-Dwi7hDPZ.js → filtering-NOnDcGbo.js} +183 -183
- package/chunks/handlers-CyYFSfhM.js +15393 -0
- package/chunks/{icon-picker-styles-CBlxEu3s.js → icon-picker-styles-DuSERhBU.js} +2 -2
- package/chunks/{isEqual-BdHo6wqq.js → isEqual-4f8yUUtC.js} +1 -1
- package/chunks/{isFocusVisible-C1nlVUwL.js → isFocusVisible-Czm70MGc.js} +1 -1
- package/chunks/line.compiler-B-4H55_T.js +203 -0
- package/chunks/{logger-Bc-DqDM_.js → logger-Cioob-QV.js} +71 -70
- package/chunks/{map.compiler-CRO6XpdI.js → map.compiler-Cv5V6EhF.js} +13 -13
- package/chunks/measure-axis-label-format-COy8U_dd.js +27 -0
- package/chunks/{measure-format-default-B6ghxih7.js → measure-format-default-B_kuGSzi.js} +7 -3
- package/chunks/{metadata-CtkvZEhS.js → metadata-dGSe5UWy.js} +5 -5
- package/chunks/{number.compiler-kV4lobCZ.js → number.compiler-D7nMcEMv.js} +8 -8
- package/chunks/{operations-COl9wgqi.js → operations-CgfehCad.js} +11462 -11223
- package/chunks/{range-CMJ5yc5Z.js → range-Dmwp9kVB.js} +2 -2
- package/chunks/{react-dom-BjsCbYHq.js → react-dom-CfuL-m78.js} +24 -24
- package/chunks/{render-wrappers-DFHi3Wkr.js → render-wrappers--g-zPFBW.js} +1 -1
- package/chunks/{requirements-C5YLmHKe.js → requirements-DHayNJ2C.js} +83 -83
- package/chunks/{shared-DyqxOie0.js → shared-DoEN9nNM.js} +282 -277
- package/chunks/standalone-B3hRGgYi.js +773 -0
- package/chunks/{standalone-BYK2U0Vd.js → standalone-BPNXgFft.js} +380 -380
- package/chunks/standalone-BPTT8XEu.js +424 -0
- package/chunks/standalone-BgAeHROc.js +2 -0
- package/chunks/{standalone-I5kRIsp8.js → standalone-BkQxag7M.js} +81 -81
- package/chunks/{standalone-DYVYccmY.js → standalone-Bxa3x6dg.js} +913 -913
- package/chunks/standalone-C0If-V6O.js +773 -0
- package/chunks/standalone-C1TOyflX.js +287 -0
- package/chunks/{standalone-DaNxWIKn.js → standalone-CE5PwJN0.js} +21 -21
- package/chunks/{standalone-K2OvRAQM.js → standalone-CG7IFN6n.js} +121 -121
- package/chunks/{standalone-Db_HNuWx.js → standalone-CKlgGu80.js} +44 -44
- package/chunks/standalone-CNf-oA2U.js +355 -0
- package/chunks/{standalone-9jrQ3zJT.js → standalone-CXPdWFlw.js} +10 -10
- package/chunks/{standalone-c4CPN6ug.js → standalone-Cf0_5tbu.js} +5783 -5785
- package/chunks/{standalone-Bp4G3MDx.js → standalone-DMi4-Vp3.js} +118 -118
- package/chunks/{standalone-BrjtMIdd.js → standalone-DTEX67C8.js} +108 -108
- package/chunks/{standalone-iOnJhCvA.js → standalone-DU46-kYv.js} +181 -181
- package/chunks/standalone-Dbn3jSH6.js +690 -0
- package/chunks/{standalone-CS5VGoja.js → standalone-DdcAL_k_.js} +833 -837
- package/chunks/standalone-DwCIA0UG.js +1057 -0
- package/chunks/standalone-Dz13tl3P.js +357 -0
- package/chunks/{standalone-CIjNYyya.js → standalone-H9GFzFk_.js} +937 -938
- package/chunks/{standalone-ChfEHb28.js → standalone-MduR0qre.js} +1279 -1279
- package/chunks/standalone-ejTz66P3.js +2 -0
- package/chunks/{standalone-D9k5SCd8.js → standalone-keB-0wK3.js} +189 -189
- package/chunks/{standalone-Bsfz5vnJ.js → standalone-nnkuQd0K.js} +35 -35
- package/chunks/standalone-vGGR6Vcn.js +6 -0
- package/chunks/{table.compiler-CMH_dtYs.js → table.compiler-mS4UvhLT.js} +12 -12
- package/chunks/theme-MYp6Rj1J.js +232 -0
- package/chunks/{useFieldName-BfxBzhhH.js → useFieldName-AdSak4Ch.js} +1 -1
- package/chunks/{utils-BdJrEeIQ.js → utils-CUKgR7it.js} +3265 -3133
- package/chunks/{view-Q-_XIrWE.js → view-BeYwpcVD.js} +478 -478
- package/chunks/{visualization-filters-BwS0xUqs.js → visualization-filters-B9qik5_K.js} +2706 -2384
- package/chunks/{with-html-element-D_ooGNWI.js → with-html-element-1GSeLT59.js} +3888 -3870
- package/definitions.js +2 -2
- package/docs/operations/astrato-app-filter-bar.md +1 -1
- package/docs/operations/bar.md +115 -32
- package/docs/operations/combo.md +50 -17
- package/docs/operations/date-picker.md +4 -4
- package/docs/operations/distribution-gauge.md +18 -16
- package/docs/operations/dot.md +107 -24
- package/docs/operations/filter.md +10 -8
- package/docs/operations/gauge.md +20 -18
- package/docs/operations/heatMap.md +73 -21
- package/docs/operations/histogram.md +45 -12
- package/docs/operations/iframe.md +1 -1
- package/docs/operations/image.md +1 -1
- package/docs/operations/index.md +11 -11
- package/docs/operations/line.md +57 -24
- package/docs/operations/map.md +16 -16
- package/docs/operations/number.md +10 -9
- package/docs/operations/pie.md +23 -21
- package/docs/operations/radar.md +13 -11
- package/docs/operations/sankey.md +19 -17
- package/docs/operations/scatter.md +111 -28
- package/docs/operations/shape.md +5 -5
- package/docs/operations/simpleTextObject.md +4 -4
- package/docs/operations/slider.md +1 -1
- package/docs/operations/table.md +27 -25
- package/docs/operations/tree.md +5 -3
- package/docs/operations/treemap.md +70 -18
- package/docs/operations/waterfall.md +40 -7
- package/docs/operations/word-cloud.md +69 -17
- package/getters.js +2 -2
- package/index.js +474 -525
- package/metadata.js +2 -2
- package/operations.js +24 -17
- package/package.json +71 -72
- package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +1 -1
- package/src/definitions/model/definitions/schema-registry.d.ts +13 -12
- package/src/definitions/model/definitions/schemas/bar.schema.d.ts +2 -2
- package/src/definitions/model/definitions/schemas/common.schema.d.ts +5 -4
- package/src/definitions/model/definitions/schemas/line.schema.d.ts +3 -2
- package/src/definitions/model/definitions/schemas/number.schema.d.ts +1 -1
- package/src/definitions/model/definitions/schemas/table.schema.d.ts +14 -14
- package/src/index.d.ts +1 -1
- package/src/operations/index.d.ts +11 -1
- package/src/types.d.ts +166 -1
- package/chunks/FieldTypeIcon-5k2bkqd0.js +0 -22
- package/chunks/category-axis-D1OVyMrr.js +0 -20
- package/chunks/color-rules-DYJL4fIW.js +0 -15
- package/chunks/color-settings-DJFoFTip.js +0 -5
- package/chunks/defaults-B5_8S-J-.js +0 -3
- package/chunks/handlers-C63NVo7i.js +0 -15433
- package/chunks/line.compiler-DCv3h42f.js +0 -198
- package/chunks/standalone-06i1wmIX.js +0 -6
- package/chunks/standalone-B6zUvxNQ.js +0 -357
- package/chunks/standalone-Be5APcVv.js +0 -762
- package/chunks/standalone-BuXpKMnc.js +0 -2
- package/chunks/standalone-CUGt2FUF.js +0 -2
- package/chunks/standalone-CnF2OYLQ.js +0 -355
- package/chunks/standalone-CznEEiq3.js +0 -422
- package/chunks/standalone-DcuE8KBa.js +0 -287
- package/chunks/standalone-pCrzBiTy.js +0 -773
- package/chunks/standalone-qrZaimgC.js +0 -689
- package/chunks/standalone-yqDJ8h3K.js +0 -1012
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { o as e } from "./rolldown-runtime-DleVn1XH.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { Fo as t, Ms as n, Po as r, Sa as i, Uc as a } from "./visualization-filters-B9qik5_K.js";
|
|
3
|
+
import { G as o, Mt as s, Ur as c, W as l, f as u, fi as d } from "./utils-CUKgR7it.js";
|
|
4
4
|
import { t as f } from "./stroke-dash-UgMEcCS4.js";
|
|
5
|
-
import { c as p } from "./coloring-
|
|
6
|
-
var m = /* @__PURE__ */ e(d()), h = (e) => e ===
|
|
7
|
-
shape:
|
|
5
|
+
import { c as p } from "./coloring-Cd6p0GQJ.js";
|
|
6
|
+
var m = /* @__PURE__ */ e(d()), h = (e) => e === t.Line || e === t.Elbow, g = {
|
|
7
|
+
shape: t.Square,
|
|
8
8
|
backgroundColor: { code: "#c4c4c4" },
|
|
9
9
|
backgroundType: "color",
|
|
10
10
|
lineThickness: 2,
|
|
@@ -19,30 +19,30 @@ var m = /* @__PURE__ */ e(d()), h = (e) => e === a.Line || e === a.Elbow, g = {
|
|
|
19
19
|
scale: 1,
|
|
20
20
|
rotate: 0,
|
|
21
21
|
heightBasedSize: !1
|
|
22
|
-
}, _ = (e,
|
|
23
|
-
let
|
|
24
|
-
(
|
|
25
|
-
let c =
|
|
26
|
-
|
|
27
|
-
let l =
|
|
22
|
+
}, _ = (e, r) => {
|
|
23
|
+
let i = { ...e?.shapeSettings }, a = 0, o = 0, s = i?.borderEnabled ?? g.borderEnabled;
|
|
24
|
+
(i?.shape === t.Square || i?.shape === t.Rectangle) && i?.borderRadius && (a = i?.borderRadius, o = a, !i?.preserveAspectRatio && r && (r.width > r.height ? o = (r.width || 1) / (r.height || 1) * o : a = (r.height || 1) / (r.width || 1) * a)), h(i?.shape) && (i.backgroundColor = { code: "none" }, s = !0);
|
|
25
|
+
let c = i?.rotate ?? g.rotate;
|
|
26
|
+
i?.shape === t.Line && i?.heightBasedSize && (c += 90);
|
|
27
|
+
let l = i?.borderStyle === n.Line ? void 0 : i?.strokeDash ?? g.strokeDash;
|
|
28
28
|
return {
|
|
29
|
-
backgroundType:
|
|
30
|
-
shape:
|
|
31
|
-
backgroundColor:
|
|
32
|
-
imageURL:
|
|
33
|
-
imageFit:
|
|
29
|
+
backgroundType: i?.backgroundType ?? "color",
|
|
30
|
+
shape: i?.shape ?? g.shape,
|
|
31
|
+
backgroundColor: i?.backgroundColor?.code ? i?.backgroundColor : g.backgroundColor,
|
|
32
|
+
imageURL: i?.imageURL ?? g.imageURL,
|
|
33
|
+
imageFit: i?.imageFit ?? g.imageFit,
|
|
34
34
|
strokeDash: l,
|
|
35
|
-
lineThickness:
|
|
35
|
+
lineThickness: i?.lineThickness ?? g.lineThickness,
|
|
36
36
|
borderEnabled: s,
|
|
37
|
-
strokeColor:
|
|
38
|
-
preserveAspectRatio:
|
|
39
|
-
scale:
|
|
37
|
+
strokeColor: i?.strokeColor?.code ? i?.strokeColor : g.strokeColor,
|
|
38
|
+
preserveAspectRatio: i?.preserveAspectRatio ?? g.preserveAspectRatio,
|
|
39
|
+
scale: i?.scale ?? g.scale,
|
|
40
40
|
rotate: c,
|
|
41
|
-
heightBasedSize:
|
|
42
|
-
borderRadiusX:
|
|
41
|
+
heightBasedSize: i?.heightBasedSize ?? g.heightBasedSize,
|
|
42
|
+
borderRadiusX: a,
|
|
43
43
|
borderRadiusY: o
|
|
44
44
|
};
|
|
45
|
-
}, v =
|
|
45
|
+
}, v = c(), y = ({ ...e }) => /* @__PURE__ */ (0, v.jsx)("path", {
|
|
46
46
|
d: "M0,50 L70,40 L70,20 L100,50 L70,80 L70,60 Z",
|
|
47
47
|
vectorEffect: "non-scaling-stroke",
|
|
48
48
|
...e
|
|
@@ -83,17 +83,17 @@ var m = /* @__PURE__ */ e(d()), h = (e) => e === a.Line || e === a.Elbow, g = {
|
|
|
83
83
|
...e
|
|
84
84
|
}), E = (e) => {
|
|
85
85
|
switch (e) {
|
|
86
|
-
case
|
|
87
|
-
case
|
|
88
|
-
case
|
|
89
|
-
case
|
|
90
|
-
case
|
|
91
|
-
case
|
|
92
|
-
case
|
|
93
|
-
case
|
|
86
|
+
case t.Circle: return b;
|
|
87
|
+
case t.Rectangle:
|
|
88
|
+
case t.Square: return w;
|
|
89
|
+
case t.Triangle: return T;
|
|
90
|
+
case t.Hexagon: return S;
|
|
91
|
+
case t.Line: return C;
|
|
92
|
+
case t.Arrow: return y;
|
|
93
|
+
case t.Elbow: return x;
|
|
94
94
|
default: return w;
|
|
95
95
|
}
|
|
96
|
-
}, D =
|
|
96
|
+
}, D = o({
|
|
97
97
|
mainContainer: {
|
|
98
98
|
width: "100%",
|
|
99
99
|
height: "100%",
|
|
@@ -128,8 +128,8 @@ var m = /* @__PURE__ */ e(d()), h = (e) => e === a.Line || e === a.Elbow, g = {
|
|
|
128
128
|
onLoad: n,
|
|
129
129
|
onError: n
|
|
130
130
|
})
|
|
131
|
-
}) }), k =
|
|
132
|
-
let o =
|
|
131
|
+
}) }), k = s(({ vSpec: e, vTheme: n, elementSize: r }) => {
|
|
132
|
+
let o = n || i, s = _(e && a(e) ? e : void 0, r), c = D(), d = u(), y = E(s.shape), b = `${l()}-background-image-fill`, x = `${l()}-insideStroke`, S = p(o, s.backgroundColor?.code), C = p(o, s.strokeColor?.code), w = f(s.strokeDash), T = s.lineThickness ?? g.lineThickness, k = s.shape === t.Line ? T / 2 : T;
|
|
133
133
|
return (0, m.useEffect)(() => {
|
|
134
134
|
(!s.imageURL || s.backgroundType === "color") && d();
|
|
135
135
|
}, []), /* @__PURE__ */ (0, v.jsx)("div", {
|
|
@@ -168,7 +168,7 @@ var m = /* @__PURE__ */ e(d()), h = (e) => e === a.Line || e === a.Elbow, g = {
|
|
|
168
168
|
children: /* @__PURE__ */ (0, v.jsx)(y, {
|
|
169
169
|
rx: `${s.borderRadiusX ?? 0}px`,
|
|
170
170
|
ry: `${s.borderRadiusY ?? 0}px`,
|
|
171
|
-
...s.shape ===
|
|
171
|
+
...s.shape === t.Line ? { heightBasedSize: s.heightBasedSize } : {}
|
|
172
172
|
})
|
|
173
173
|
})
|
|
174
174
|
})
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import "./rolldown-runtime-DleVn1XH.js";
|
|
2
|
+
import { Mt as e, Ur as t, fi as n } from "./utils-CUKgR7it.js";
|
|
3
|
+
import { n as r } from "./standalone-DwCIA0UG.js";
|
|
4
|
+
n();
|
|
5
|
+
var i = t(), a = e((e) => /* @__PURE__ */ (0, i.jsx)(r, { ...e }));
|
|
6
|
+
export { a as HistogramChart };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { C as i, D as a, F as o, T as s, d as c, g as l, h as u, i as d, j as f, k as p, o as m, p as h, s as g, t as _, u as v, v as y, x as b, y as x } from "./shared-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { Hs as e, Zc as t, d as n, il as r } from "./visualization-filters-B9qik5_K.js";
|
|
2
|
+
import { C as i, D as a, F as o, T as s, d as c, g as l, h as u, i as d, j as f, k as p, o as m, p as h, s as g, t as _, u as v, v as y, x as b, y as x } from "./shared-DoEN9nNM.js";
|
|
3
|
+
import { Fp as S, nm as C } from "./handlers-CyYFSfhM.js";
|
|
4
|
+
import { v as w } from "./operations-CgfehCad.js";
|
|
5
5
|
n();
|
|
6
6
|
var T = {
|
|
7
7
|
all: e.ShowAll,
|
|
@@ -117,9 +117,9 @@ var T = {
|
|
|
117
117
|
}
|
|
118
118
|
], L = (e) => {
|
|
119
119
|
if (!(!("structure" in e) || e.structure === void 0)) switch (e.structure) {
|
|
120
|
-
case "normal": return
|
|
121
|
-
case "expandable": return
|
|
122
|
-
case "pivot": return
|
|
120
|
+
case "normal": return t.Normal;
|
|
121
|
+
case "expandable": return t.Hierarchical;
|
|
122
|
+
case "pivot": return t.Pivot;
|
|
123
123
|
}
|
|
124
124
|
}, R = (e, t) => u(e, t.flatMap((t) => t.role !== "dimension" || t.showNullValues === void 0 ? [] : [{
|
|
125
125
|
name: w.SET_COLUMN_SHOW_NULL_VALUES,
|
|
@@ -127,7 +127,7 @@ var T = {
|
|
|
127
127
|
...x(e.resolvedRefs[t.ref]),
|
|
128
128
|
showNullValues: t.showNullValues
|
|
129
129
|
}
|
|
130
|
-
}]), ["data"]), z = (e,
|
|
130
|
+
}]), ["data"]), z = (e, t, n) => {
|
|
131
131
|
let i = [
|
|
132
132
|
"formatType",
|
|
133
133
|
"formatString",
|
|
@@ -135,11 +135,11 @@ var T = {
|
|
|
135
135
|
"currencyIsPrefix",
|
|
136
136
|
"negativeType"
|
|
137
137
|
];
|
|
138
|
-
return u(e,
|
|
139
|
-
let a = e.availableFields.find((e) => e.key ===
|
|
138
|
+
return u(e, t.flatMap((t) => {
|
|
139
|
+
let a = e.availableFields.find((e) => e.key === t.fieldKey), o = a ? r(a) : t.fieldKey;
|
|
140
140
|
return i.flatMap((e) => {
|
|
141
|
-
let
|
|
142
|
-
return
|
|
141
|
+
let r = t.format?.[e], i = n[e];
|
|
142
|
+
return r !== void 0 && i ? [h(i, o, t.ref, t.path, e, r, t.role)] : [];
|
|
143
143
|
});
|
|
144
144
|
}), ["data"]);
|
|
145
145
|
}, B = async (e) => {
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { Sa as e, c as t, i as n, r } from "./visualization-filters-B9qik5_K.js";
|
|
2
|
+
var i = "system-ui, sans-serif", a = ["--astrato-font-family", "--font-family"], o = 3e3, s = 250, c = "Aa0 ", l = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new Set([
|
|
3
|
+
"serif",
|
|
4
|
+
"sans-serif",
|
|
5
|
+
"monospace",
|
|
6
|
+
"cursive",
|
|
7
|
+
"fantasy",
|
|
8
|
+
"system-ui",
|
|
9
|
+
"ui-serif",
|
|
10
|
+
"ui-sans-serif",
|
|
11
|
+
"ui-monospace",
|
|
12
|
+
"ui-rounded",
|
|
13
|
+
"emoji",
|
|
14
|
+
"math",
|
|
15
|
+
"fangsong"
|
|
16
|
+
]), d = (e) => {
|
|
17
|
+
let t = e.trim().replace(/[,;\s]+$/, "");
|
|
18
|
+
return t ? /(^|,)\s*(sans-serif|system-ui)\s*(,|$)/i.test(t) ? t : `${t}, ${i}` : i;
|
|
19
|
+
}, f = (e) => {
|
|
20
|
+
let t = e ?? (typeof document > "u" ? void 0 : document), n = t?.defaultView;
|
|
21
|
+
if (!t || !n) return;
|
|
22
|
+
let r = n.getComputedStyle(t.documentElement);
|
|
23
|
+
for (let e of a) {
|
|
24
|
+
let t = r.getPropertyValue(e).trim();
|
|
25
|
+
if (t) return t;
|
|
26
|
+
}
|
|
27
|
+
return (t.body ? n.getComputedStyle(t.body).fontFamily.trim() : "") || void 0;
|
|
28
|
+
}, p = (e, t) => d(e?.trim() || f(t) || "system-ui, sans-serif"), m = (e) => e.trim().replace(/^["']|["']$/g, "").toLowerCase(), h = (e) => (e ?? (typeof document > "u" ? void 0 : document))?.fonts, g = (e) => (e.match(/"[^"]*"|'[^']*'|[^,]+/g) ?? []).map((e) => e.trim()).filter((e) => e && !u.has(m(e))), _ = (e, t) => {
|
|
29
|
+
let n = /* @__PURE__ */ new Set();
|
|
30
|
+
return t.forEach((e) => n.add(m(e.family))), g(e).find((e) => n.has(m(e)));
|
|
31
|
+
}, v = async (e, t) => {
|
|
32
|
+
let n = h(t), r = n?.load ? _(e, n) : void 0;
|
|
33
|
+
if (!n || !r) return;
|
|
34
|
+
let i = l.get(n);
|
|
35
|
+
i || (i = /* @__PURE__ */ new Map(), l.set(n, i));
|
|
36
|
+
let a = m(r), s = i.get(a);
|
|
37
|
+
if (!s) {
|
|
38
|
+
let e = i;
|
|
39
|
+
s = (async () => {
|
|
40
|
+
let t;
|
|
41
|
+
try {
|
|
42
|
+
let i = Promise.resolve().then(() => n.load(`12px ${r}`, c));
|
|
43
|
+
i.then(() => e.delete(a), () => e.delete(a)), await Promise.race([i, new Promise((e) => {
|
|
44
|
+
t = setTimeout(e, o);
|
|
45
|
+
})]);
|
|
46
|
+
} catch {
|
|
47
|
+
e.delete(a);
|
|
48
|
+
} finally {
|
|
49
|
+
clearTimeout(t);
|
|
50
|
+
}
|
|
51
|
+
})(), i.set(a, s);
|
|
52
|
+
}
|
|
53
|
+
await s;
|
|
54
|
+
}, y = (e, t, n) => {
|
|
55
|
+
let r = h(n), i = new Set(g(e).map(m));
|
|
56
|
+
if (!r?.addEventListener || !i.size) return () => void 0;
|
|
57
|
+
let a = !0, o = t, c, l = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), d = (e) => {
|
|
58
|
+
let t = e.filter((e) => i.has(m(e.family)) && !u.has(e));
|
|
59
|
+
a && t.length && (t.forEach((e) => u.add(e)), o?.());
|
|
60
|
+
}, f = (e = !1) => {
|
|
61
|
+
r.forEach((t) => {
|
|
62
|
+
!i.has(m(t.family)) || l.has(t) || (l.add(t), t.status === "loaded" ? e ? u.add(t) : d([t]) : t.loaded?.then(() => d([t]), () => void 0));
|
|
63
|
+
});
|
|
64
|
+
}, p = () => {
|
|
65
|
+
clearTimeout(c), f(), a && r.status === "loading" && (c = setTimeout(p, s));
|
|
66
|
+
}, _ = (e) => {
|
|
67
|
+
d(e.fontfaces ?? []), p();
|
|
68
|
+
};
|
|
69
|
+
return r.addEventListener("loading", p), r.addEventListener("loadingdone", _), f(!0), p(), () => {
|
|
70
|
+
a = !1, o = void 0, clearTimeout(c), l.clear(), u.clear(), r.removeEventListener("loading", p), r.removeEventListener("loadingdone", _);
|
|
71
|
+
};
|
|
72
|
+
}, b = d(e.fonts.general.fontFamily ?? ""), x = "light", S = {
|
|
73
|
+
light: {
|
|
74
|
+
text: e.fonts.general.color ?? "",
|
|
75
|
+
surface: e.colors.sheetBackgroundColor ?? "",
|
|
76
|
+
gridline: e.objectStyles.gridLines.color ?? "",
|
|
77
|
+
axisLine: e.axis.dimension.lineColor,
|
|
78
|
+
axisLabel: e.axis.dimension.labelColor
|
|
79
|
+
},
|
|
80
|
+
dark: {
|
|
81
|
+
text: "#e4e4ea",
|
|
82
|
+
surface: "#1e1e24",
|
|
83
|
+
gridline: "#4a4a52",
|
|
84
|
+
axisLine: "#4a4a52",
|
|
85
|
+
axisLabel: "#a6a6b0"
|
|
86
|
+
}
|
|
87
|
+
}, C = "#2e2e36", w = (e) => typeof e == "object" && !!e && !Array.isArray(e), T = (e) => w(e) && "light" in e && "dark" in e, E = (e) => e === "light" || e === "dark", D = (e, t) => T(e) ? e[t] : e, O = (e, t) => e?.map((e) => ({
|
|
88
|
+
id: e.id,
|
|
89
|
+
name: e.name ?? e.id,
|
|
90
|
+
colors: D(e.colors, t) ?? []
|
|
91
|
+
})), k = (e, t) => ({
|
|
92
|
+
...e,
|
|
93
|
+
fontFamily: t
|
|
94
|
+
}), A = (e) => {
|
|
95
|
+
let t = Object.entries(e).filter(([, e]) => e !== void 0);
|
|
96
|
+
return t.length ? Object.fromEntries(t) : void 0;
|
|
97
|
+
}, j = (e, t, n) => {
|
|
98
|
+
let r = e?.colors, i = (e) => t === "dark" ? e : void 0, a = A({
|
|
99
|
+
hoverStroke: n(r?.selection?.hoverStroke) ?? i(S.dark.text),
|
|
100
|
+
mutedFill: n(r?.selection?.mutedFill),
|
|
101
|
+
mutedOpacity: e?.mutedOpacity
|
|
102
|
+
});
|
|
103
|
+
return A({
|
|
104
|
+
fontSizes: A({ ...e?.fontSizes }),
|
|
105
|
+
tooltip: A({
|
|
106
|
+
background: n(r?.tooltip?.background),
|
|
107
|
+
text: n(r?.tooltip?.text)
|
|
108
|
+
}),
|
|
109
|
+
dataLabel: A({
|
|
110
|
+
onDark: n(r?.dataLabel?.onDark),
|
|
111
|
+
onLight: n(r?.dataLabel?.onLight)
|
|
112
|
+
}),
|
|
113
|
+
selection: a,
|
|
114
|
+
status: A({
|
|
115
|
+
positive: n(r?.status?.positive),
|
|
116
|
+
negative: n(r?.status?.negative),
|
|
117
|
+
total: n(r?.status?.total)
|
|
118
|
+
}),
|
|
119
|
+
table: A({ rowHighlight: n(r?.table?.rowHighlight) ?? i(C) }),
|
|
120
|
+
null: n(r?.null),
|
|
121
|
+
others: n(r?.others)
|
|
122
|
+
});
|
|
123
|
+
}, M = ({ fontFamily: t, titleFontFamily: n = t, theme: r, mode: i = x }) => {
|
|
124
|
+
let a = S[i], o = r?.colors, s = r?.palettes, c = (e) => D(e, i), l = c(o?.primary), u = D(o?.brand, i), d = l || u?.length ? [...l ? [l] : [], ...u ?? []] : void 0, f = O(s?.categorical, i), p = O(s?.sequential, i), m = O(s?.diverging, i), h = c(o?.text) ?? a.text, g = c(o?.surface), _ = c(o?.axis?.line) ?? a.axisLine, v = {
|
|
125
|
+
lineColor: _,
|
|
126
|
+
tickColor: c(o?.axis?.tick) ?? _,
|
|
127
|
+
labelColor: c(o?.axis?.label) ?? a.axisLabel,
|
|
128
|
+
titleColor: c(o?.axis?.title) ?? c(o?.axis?.label) ?? a.axisLabel
|
|
129
|
+
}, y = j(r, i, c);
|
|
130
|
+
return {
|
|
131
|
+
...e,
|
|
132
|
+
...y ? { chart: y } : {},
|
|
133
|
+
colors: {
|
|
134
|
+
...e.colors,
|
|
135
|
+
brandColors: d ?? e.colors.brandColors,
|
|
136
|
+
categorical: f?.length ? f : e.colors.categorical,
|
|
137
|
+
defaultCategorical: s?.defaultCategorical ?? f?.[0]?.id ?? e.colors.defaultCategorical,
|
|
138
|
+
gradient: p?.length ? p : e.colors.gradient,
|
|
139
|
+
defaultGradient: s?.defaultSequential ?? p?.[0]?.id ?? e.colors.defaultGradient,
|
|
140
|
+
sheetBackgroundColor: g ?? a.surface,
|
|
141
|
+
...m?.length ? { diverging: m } : {},
|
|
142
|
+
...s?.defaultDiverging || m?.length ? { defaultDiverging: s?.defaultDiverging ?? m?.[0]?.id } : {}
|
|
143
|
+
},
|
|
144
|
+
fonts: {
|
|
145
|
+
general: {
|
|
146
|
+
color: h,
|
|
147
|
+
fontFamily: t
|
|
148
|
+
},
|
|
149
|
+
title: {
|
|
150
|
+
color: c(o?.title) ?? e.fonts.title.color,
|
|
151
|
+
fontFamily: n
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
navigation: {
|
|
155
|
+
...e.navigation,
|
|
156
|
+
activeItem: {
|
|
157
|
+
...e.navigation.activeItem,
|
|
158
|
+
font: k(e.navigation.activeItem.font, t)
|
|
159
|
+
},
|
|
160
|
+
item: {
|
|
161
|
+
...e.navigation.item,
|
|
162
|
+
font: k(e.navigation.item.font, t)
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
objectStyles: {
|
|
166
|
+
...e.objectStyles,
|
|
167
|
+
backgroundColor: g ?? e.objectStyles.backgroundColor,
|
|
168
|
+
border: { color: c(o?.border) ?? e.objectStyles.border.color },
|
|
169
|
+
gridLines: { color: c(o?.gridline) ?? a.gridline }
|
|
170
|
+
},
|
|
171
|
+
axis: {
|
|
172
|
+
dimension: { ...v },
|
|
173
|
+
measure: { ...v }
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
}, N = (e, t) => {
|
|
177
|
+
if (e !== void 0 && typeof e != "string") throw TypeError(`theme.${t} must be a string.`);
|
|
178
|
+
}, P = (e, t, n, r) => {
|
|
179
|
+
if (e !== void 0 && !(T(e) ? [e.light, e.dark] : [e]).every(n)) throw TypeError(`theme.${t} must be ${r}, or a { light, dark } pair of them.`);
|
|
180
|
+
}, F = (e) => typeof e == "string", I = /* @__PURE__ */ new Set([
|
|
181
|
+
"axis",
|
|
182
|
+
"tooltip",
|
|
183
|
+
"dataLabel",
|
|
184
|
+
"selection",
|
|
185
|
+
"status",
|
|
186
|
+
"table"
|
|
187
|
+
]), L = (e) => Array.isArray(e) && e.every(F), R = (e) => L(e) && e.length > 0, z = (e, t) => {
|
|
188
|
+
if (e !== void 0) {
|
|
189
|
+
if (!Array.isArray(e)) throw TypeError(`theme.palettes.${t} must be an array of palettes.`);
|
|
190
|
+
e.forEach((e, n) => {
|
|
191
|
+
if (!w(e) || typeof e.id != "string" || !e.id) throw TypeError(`theme.palettes.${t}[${n}] needs an id string.`);
|
|
192
|
+
if (N(e.name, `palettes.${t}[${n}].name`), P(e.colors, `palettes.${t}[${n}].colors`, R, "a non-empty array of colors"), e.colors === void 0) throw TypeError(`theme.palettes.${t}[${n}] needs colors.`);
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}, B = (e) => {
|
|
196
|
+
if (e !== void 0) {
|
|
197
|
+
if (!w(e)) throw TypeError("The visualization theme must be an object.");
|
|
198
|
+
if (N(e.fontFamily, "fontFamily"), N(e.titleFontFamily, "titleFontFamily"), e.colors !== void 0) {
|
|
199
|
+
if (!w(e.colors)) throw TypeError("theme.colors must be an object.");
|
|
200
|
+
let { brand: t, ...n } = e.colors;
|
|
201
|
+
Object.entries(n).forEach(([e, t]) => {
|
|
202
|
+
if (!I.has(e)) {
|
|
203
|
+
P(t, `colors.${e}`, F, "a color string");
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (t !== void 0) {
|
|
207
|
+
if (!w(t)) throw TypeError(`theme.colors.${e} must be an object.`);
|
|
208
|
+
Object.entries(t).forEach(([t, n]) => P(n, `colors.${e}.${t}`, F, "a color string"));
|
|
209
|
+
}
|
|
210
|
+
}), P(t, "colors.brand", L, "an array of colors");
|
|
211
|
+
}
|
|
212
|
+
if (e.fontSizes !== void 0) {
|
|
213
|
+
if (!w(e.fontSizes)) throw TypeError("theme.fontSizes must be an object.");
|
|
214
|
+
Object.entries(e.fontSizes).forEach(([e, t]) => {
|
|
215
|
+
if (t !== void 0 && (typeof t != "number" || !Number.isFinite(t) || t <= 0)) throw TypeError(`theme.fontSizes.${e} must be a positive number of pixels.`);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
if (e.mutedOpacity !== void 0 && (typeof e.mutedOpacity != "number" || !(e.mutedOpacity >= 0 && e.mutedOpacity <= 1))) throw TypeError("theme.mutedOpacity must be a number from 0 to 1.");
|
|
219
|
+
if (e.palettes !== void 0) {
|
|
220
|
+
if (!w(e.palettes)) throw TypeError("theme.palettes must be an object.");
|
|
221
|
+
z(e.palettes.categorical, "categorical"), z(e.palettes.sequential, "sequential"), z(e.palettes.diverging, "diverging"), N(e.palettes.defaultDiverging, "palettes.defaultDiverging"), N(e.palettes.defaultCategorical, "palettes.defaultCategorical"), N(e.palettes.defaultSequential, "palettes.defaultSequential");
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}, V = (i) => {
|
|
225
|
+
let a = [], o = (e, t, n, r) => {
|
|
226
|
+
e !== void 0 && ([...t ?? [], ...n].some((t) => t.id === e) || a.push(`theme.palettes.${r} "${e}" matches no palette; charts fall back to the built-in default.`));
|
|
227
|
+
};
|
|
228
|
+
return o(i?.palettes?.defaultCategorical, i?.palettes?.categorical, [...r, ...e.colors.categorical], "defaultCategorical"), o(i?.palettes?.defaultSequential, i?.palettes?.sequential, [...t, ...e.colors.gradient], "defaultSequential"), o(i?.palettes?.defaultDiverging, i?.palettes?.diverging, n, "defaultDiverging"), a;
|
|
229
|
+
}, H = (e) => {
|
|
230
|
+
if (!E(e)) throw TypeError("The visualization theme mode must be 'light' or 'dark'.");
|
|
231
|
+
};
|
|
232
|
+
export { x as a, v as c, b as i, y as l, H as n, V as o, M as r, p as s, B as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { o as e } from "./rolldown-runtime-DleVn1XH.js";
|
|
2
|
-
import { I as t,
|
|
2
|
+
import { I as t, fi as n } from "./utils-CUKgR7it.js";
|
|
3
3
|
var r = /* @__PURE__ */ e(n()), i = (e) => {
|
|
4
4
|
let n = t(), i = (0, r.useMemo)(() => n.reduce((e, t) => (e[t.key] = t.name, e), {}), e ?? [n]);
|
|
5
5
|
return (e) => i[e];
|