kanto-ds 1.2.0 → 1.4.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/README.md +24 -6
- package/dist/chunks/{defaults-DKzFsNbv.js → defaults-BwgjMcww.js} +27 -26
- package/dist/chunks/{defaults-DKzFsNbv.js.map → defaults-BwgjMcww.js.map} +1 -1
- package/dist/chunks/index-DSSLJirw.js +79 -0
- package/dist/chunks/index-DSSLJirw.js.map +1 -0
- package/dist/chunks/kt-element-E-tfJpGQ.js +52 -0
- package/dist/chunks/kt-element-E-tfJpGQ.js.map +1 -0
- package/dist/components/core/kt-avatar/kt-avatar.js +8 -7
- package/dist/components/core/kt-avatar/kt-avatar.js.map +1 -1
- package/dist/components/core/kt-badge/kt-badge.js +7 -6
- package/dist/components/core/kt-badge/kt-badge.js.map +1 -1
- package/dist/components/core/kt-button/kt-button.js +1 -1
- package/dist/components/core/kt-card/kt-card.js +1 -1
- package/dist/components/core/kt-code/kt-code.js +31 -30
- package/dist/components/core/kt-code/kt-code.js.map +1 -1
- package/dist/components/core/kt-icon/kt-icon.js +2 -2
- package/dist/components/core/kt-kbd/kt-kbd.js +1 -1
- package/dist/components/core/kt-split-button/kt-split-button.d.ts +2 -2
- package/dist/components/core/kt-split-button/kt-split-button.js +27 -26
- package/dist/components/core/kt-split-button/kt-split-button.js.map +1 -1
- package/dist/components/data/kt-chart/kt-chart.d.ts +2 -2
- package/dist/components/data/kt-chart/kt-chart.js +222 -221
- package/dist/components/data/kt-chart/kt-chart.js.map +1 -1
- package/dist/components/data/kt-meter/kt-meter.js +1 -1
- package/dist/components/data/kt-pagination/kt-pagination.d.ts +1 -1
- package/dist/components/data/kt-pagination/kt-pagination.js +29 -28
- package/dist/components/data/kt-pagination/kt-pagination.js.map +1 -1
- package/dist/components/data/kt-stat/kt-stat.js +1 -1
- package/dist/components/data/kt-table/kt-table.d.ts +2 -2
- package/dist/components/data/kt-table/kt-table.js +30 -29
- package/dist/components/data/kt-table/kt-table.js.map +1 -1
- package/dist/components/data/kt-timeline/kt-timeline.js +1 -1
- package/dist/components/feedback/kt-alert/kt-alert.js +17 -16
- package/dist/components/feedback/kt-alert/kt-alert.js.map +1 -1
- package/dist/components/feedback/kt-empty-state/kt-empty-state.js +1 -1
- package/dist/components/feedback/kt-progress-bar/kt-progress-bar.js +1 -1
- package/dist/components/feedback/kt-skeleton/kt-skeleton.js +1 -1
- package/dist/components/feedback/kt-toast/kt-toast.js +25 -19
- package/dist/components/feedback/kt-toast/kt-toast.js.map +1 -1
- package/dist/components/feedback/kt-toast-container/kt-toast-container.js +1 -1
- package/dist/components/feedback/kt-tooltip/kt-tooltip.js +1 -1
- package/dist/components/forms/kt-checkbox/kt-checkbox.d.ts +66 -0
- package/dist/components/forms/kt-checkbox/kt-checkbox.js +198 -0
- package/dist/components/forms/kt-checkbox/kt-checkbox.js.map +1 -0
- package/dist/components/forms/kt-drag-drop/kt-drag-drop.d.ts +2 -2
- package/dist/components/forms/kt-drag-drop/kt-drag-drop.js +60 -57
- package/dist/components/forms/kt-drag-drop/kt-drag-drop.js.map +1 -1
- package/dist/components/forms/kt-form/kt-form.js +11 -10
- package/dist/components/forms/kt-form/kt-form.js.map +1 -1
- package/dist/components/forms/kt-input/kt-input.js +56 -55
- package/dist/components/forms/kt-input/kt-input.js.map +1 -1
- package/dist/components/forms/kt-input-menu/kt-input-menu.d.ts +1 -1
- package/dist/components/forms/kt-input-menu/kt-input-menu.js +57 -56
- package/dist/components/forms/kt-input-menu/kt-input-menu.js.map +1 -1
- package/dist/components/forms/kt-label-input/kt-label-input.js +1 -1
- package/dist/components/forms/kt-radio-group/kt-radio-group.d.ts +103 -0
- package/dist/components/forms/kt-radio-group/kt-radio-group.js +265 -0
- package/dist/components/forms/kt-radio-group/kt-radio-group.js.map +1 -0
- package/dist/components/forms/kt-select/kt-select.d.ts +2 -2
- package/dist/components/forms/kt-select/kt-select.js +62 -61
- package/dist/components/forms/kt-select/kt-select.js.map +1 -1
- package/dist/components/forms/kt-textarea/kt-textarea.js +9 -8
- package/dist/components/forms/kt-textarea/kt-textarea.js.map +1 -1
- package/dist/components/forms/kt-toggle/kt-toggle.js +1 -1
- package/dist/components/navigation/kt-breadcrumb/kt-breadcrumb.d.ts +1 -1
- package/dist/components/navigation/kt-breadcrumb/kt-breadcrumb.js +6 -5
- package/dist/components/navigation/kt-breadcrumb/kt-breadcrumb.js.map +1 -1
- package/dist/components/navigation/kt-header/kt-header.js +11 -10
- package/dist/components/navigation/kt-header/kt-header.js.map +1 -1
- package/dist/components/navigation/kt-page-header/kt-page-header.js +1 -1
- package/dist/components/navigation/kt-segmented-control/kt-segmented-control.js +44 -43
- package/dist/components/navigation/kt-segmented-control/kt-segmented-control.js.map +1 -1
- package/dist/components/navigation/kt-sub-menu-navigation/kt-sub-menu-navigation.d.ts +1 -1
- package/dist/components/navigation/kt-sub-menu-navigation/kt-sub-menu-navigation.js +6 -5
- package/dist/components/navigation/kt-sub-menu-navigation/kt-sub-menu-navigation.js.map +1 -1
- package/dist/components/navigation/kt-tabs/kt-tabs.js +1 -1
- package/dist/components/navigation/kt-toggle-button/kt-toggle-button.js +1 -1
- package/dist/components/navigation/kt-toggle-button-group/kt-toggle-button-group.js +12 -6
- package/dist/components/navigation/kt-toggle-button-group/kt-toggle-button-group.js.map +1 -1
- package/dist/components/overlays/kt-collapsible/kt-collapsible.js +1 -1
- package/dist/components/overlays/kt-confirm-dialog/kt-confirm-dialog.d.ts +3 -3
- package/dist/components/overlays/kt-confirm-dialog/kt-confirm-dialog.js +30 -27
- package/dist/components/overlays/kt-confirm-dialog/kt-confirm-dialog.js.map +1 -1
- package/dist/components/overlays/kt-dropdown/kt-dropdown.d.ts +1 -1
- package/dist/components/overlays/kt-dropdown/kt-dropdown.js +8 -7
- package/dist/components/overlays/kt-dropdown/kt-dropdown.js.map +1 -1
- package/dist/components/overlays/kt-modal/kt-modal.js +5 -4
- package/dist/components/overlays/kt-modal/kt-modal.js.map +1 -1
- package/dist/components/overlays/kt-side-panel/kt-side-panel.d.ts +1 -1
- package/dist/components/overlays/kt-side-panel/kt-side-panel.js +24 -23
- package/dist/components/overlays/kt-side-panel/kt-side-panel.js.map +1 -1
- package/dist/custom-elements.json +1870 -1071
- package/dist/icons/defaults.d.ts +1 -0
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +93 -83
- package/dist/index.js.map +1 -1
- package/dist/internal/kt-element.d.ts +6 -1
- package/dist/internal/strings.d.ts +103 -0
- package/dist/react/index.d.ts +13 -0
- package/dist/react/index.js +176 -157
- package/dist/react/index.js.map +1 -1
- package/dist/react/jsx.d.ts +12 -1
- package/dist/strings/index.d.ts +11 -0
- package/dist/strings/index.js +8 -0
- package/dist/strings/index.js.map +1 -0
- package/dist/tokens/base.css +56 -0
- package/dist/vscode.css-custom-data.json +12 -0
- package/dist/vscode.html-custom-data.json +85 -0
- package/dist/vue/index.d.ts +6 -0
- package/dist/vue/index.js +9 -7
- package/dist/vue/index.js.map +1 -1
- package/dist/web-types.json +263 -39
- package/package.json +19 -3
- package/dist/chunks/kt-element-B_jjQDhg.js +0 -38
- package/dist/chunks/kt-element-B_jjQDhg.js.map +0 -1
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import { svg as b, nothing as A, css as
|
|
2
|
-
import { query as
|
|
3
|
-
import { classMap as
|
|
4
|
-
import { K as
|
|
5
|
-
import { u as
|
|
6
|
-
|
|
1
|
+
import { svg as b, nothing as A, css as vt, html as G } from "lit";
|
|
2
|
+
import { query as kt, state as et, property as B } from "lit/decorators.js";
|
|
3
|
+
import { classMap as wt } from "lit/directives/class-map.js";
|
|
4
|
+
import { K as nt, d as Mt } from "../../../chunks/kt-element-E-tfJpGQ.js";
|
|
5
|
+
import { u as At, e as lt } from "../../../chunks/events-Bjl5Zmmq.js";
|
|
6
|
+
import { s as E } from "../../../chunks/index-DSSLJirw.js";
|
|
7
|
+
function St(s) {
|
|
7
8
|
const t = Math.floor(Math.log10(s)), e = s / 10 ** t;
|
|
8
9
|
return (e < 1.5 ? 1 : e < 3 ? 2 : e < 7 ? 5 : 10) * 10 ** t;
|
|
9
10
|
}
|
|
10
|
-
function
|
|
11
|
+
function ot(s, t, e) {
|
|
11
12
|
if (t === s) {
|
|
12
13
|
const c = Math.abs(s) || 1;
|
|
13
14
|
s -= c, t += c;
|
|
14
15
|
}
|
|
15
|
-
const a =
|
|
16
|
+
const a = St((t - s) / Math.max(1, e - 1)), o = Math.max(0, -Math.floor(Math.log10(a))), i = (c) => Number(c.toFixed(o)) || 0, n = i(Math.floor(s / a) * a), r = i(Math.ceil(t / a) * a), h = [];
|
|
16
17
|
for (let c = 0; n + c * a <= r + a / 2; c += 1)
|
|
17
18
|
h.push(i(n + c * a));
|
|
18
19
|
return { min: n, max: r, step: a, values: h };
|
|
19
20
|
}
|
|
20
|
-
function
|
|
21
|
+
function Lt(s, t, { includeZero: e }) {
|
|
21
22
|
const a = t.flat();
|
|
22
23
|
for (const r of s) {
|
|
23
24
|
const h = Math.max(0, ...r.map((c) => c.length));
|
|
@@ -35,8 +36,8 @@ function St(s, t, { includeZero: e }) {
|
|
|
35
36
|
let i = Math.min(...o), n = Math.max(...o);
|
|
36
37
|
return e && (i = Math.min(i, 0), n = Math.max(n, 0)), { lo: i, hi: n };
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
-
const o =
|
|
39
|
+
function F(s, t, e, a) {
|
|
40
|
+
const o = ot(a.min ?? s, a.max ?? t, e), i = a.min ?? o.min, n = a.max ?? o.max;
|
|
40
41
|
return n <= i ? o : {
|
|
41
42
|
min: i,
|
|
42
43
|
max: n,
|
|
@@ -44,17 +45,17 @@ function Y(s, t, e, a) {
|
|
|
44
45
|
values: o.values.filter((r) => r >= i && r <= n)
|
|
45
46
|
};
|
|
46
47
|
}
|
|
47
|
-
function
|
|
48
|
+
function X(s, t, e, a) {
|
|
48
49
|
return e + (s - t.min) / (t.max - t.min) * (a - e);
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
+
function W(s, t) {
|
|
51
52
|
return Math.min(6, Math.max(3, Math.round(s / t)));
|
|
52
53
|
}
|
|
53
|
-
const
|
|
54
|
-
function
|
|
54
|
+
const H = Math.PI * 2, V = (s) => Math.round(s * 100) / 100 || 0, P = ([s, t]) => `${V(s)},${V(t)}`;
|
|
55
|
+
function j(s, t = !0) {
|
|
55
56
|
return s.map((e, a) => `${a === 0 && t ? "M" : "L"}${P(e)}`).join(" ");
|
|
56
57
|
}
|
|
57
|
-
function
|
|
58
|
+
function Pt(s) {
|
|
58
59
|
const t = s.length;
|
|
59
60
|
if (t < 3) return [];
|
|
60
61
|
const e = s.slice(0, -1).map(([o, i], n) => {
|
|
@@ -86,36 +87,36 @@ function Lt(s) {
|
|
|
86
87
|
};
|
|
87
88
|
});
|
|
88
89
|
}
|
|
89
|
-
function
|
|
90
|
-
return s.length < 3 ?
|
|
90
|
+
function Ct(s, t = !0) {
|
|
91
|
+
return s.length < 3 ? j(s, t) : [
|
|
91
92
|
t ? `M${P(s[0])}` : `L${P(s[0])}`,
|
|
92
|
-
...
|
|
93
|
+
...Pt(s).map(({ c1: a, c2: o, to: i }) => `C${P(a)} ${P(o)} ${P(i)}`)
|
|
93
94
|
].join(" ");
|
|
94
95
|
}
|
|
95
|
-
function
|
|
96
|
+
function D(s, t, e, a) {
|
|
96
97
|
return [s + e * Math.sin(a), t - e * Math.cos(a)];
|
|
97
98
|
}
|
|
98
|
-
function
|
|
99
|
+
function Ot(s, t, e, a, o, i) {
|
|
99
100
|
const n = i - o;
|
|
100
101
|
if (n <= 0 || a <= 0) return "";
|
|
101
|
-
if (n >=
|
|
102
|
+
if (n >= H - 1e-6) {
|
|
102
103
|
const l = (d, u) => {
|
|
103
|
-
const m =
|
|
104
|
+
const m = D(s, t, d, 0), y = D(s, t, d, Math.PI), k = `A${V(d)},${V(d)} 0 1 ${u}`;
|
|
104
105
|
return `M${P(m)} ${k} ${P(y)} ${k} ${P(m)} Z`;
|
|
105
106
|
};
|
|
106
107
|
return e > 0 ? `${l(a, 1)} ${l(e, 0)}` : l(a, 1);
|
|
107
108
|
}
|
|
108
|
-
const r = n > Math.PI ? 1 : 0, h = `A${
|
|
109
|
+
const r = n > Math.PI ? 1 : 0, h = `A${V(a)},${V(a)} 0 ${r} 1 ${P(D(s, t, a, i))}`;
|
|
109
110
|
if (e <= 0)
|
|
110
|
-
return `M${P([s, t])} L${P(
|
|
111
|
-
const c = `A${
|
|
112
|
-
return `M${P(
|
|
111
|
+
return `M${P([s, t])} L${P(D(s, t, a, o))} ${h} Z`;
|
|
112
|
+
const c = `A${V(e)},${V(e)} 0 ${r} 0 ${P(D(s, t, e, o))}`;
|
|
113
|
+
return `M${P(D(s, t, a, o))} ${h} L${P(D(s, t, e, i))} ${c} Z`;
|
|
113
114
|
}
|
|
114
|
-
function
|
|
115
|
+
function ct(s, t, e, a, o, i) {
|
|
115
116
|
const r = Math.max(
|
|
116
117
|
0,
|
|
117
118
|
i === "top" || i === "bottom" ? Math.min(o, e / 2, a) : Math.min(o, a / 2, e)
|
|
118
|
-
), [h, c, l, d] = [s, t, s + e, t + a], u = (y) => `A${
|
|
119
|
+
), [h, c, l, d] = [s, t, s + e, t + a], u = (y) => `A${V(r)},${V(r)} 0 0 1 ${P(y)}`, m = (y) => `L${P(y)}`;
|
|
119
120
|
if (i === "none" || r === 0)
|
|
120
121
|
return `M${P([h, c])} ${m([l, c])} ${m([l, d])} ${m([h, d])} Z`;
|
|
121
122
|
switch (i) {
|
|
@@ -129,16 +130,16 @@ function lt(s, t, e, a, o, i) {
|
|
|
129
130
|
return `M${P([l, c])} ${m([l, d])} ${m([h + r, d])} ${u([h, d - r])} ${m([h, c + r])} ${u([h + r, c])} Z`;
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
|
-
const
|
|
133
|
-
function
|
|
134
|
-
const { series: t, hidden: e, labels: a, measure: o, format: i, noAxis: n, width: r, height: h } = s, c = t.map((v) => v.type ?? s.type), l = t.map((v, O) => O).filter((v) => !e.has(v)), d = l.map((v) => c[v]), u = Math.max(a.length, 0, ...t.map((v) =>
|
|
133
|
+
const R = { top: 12, right: 8, bottom: 24 }, J = 12, ht = { vertical: 48, horizontal: 96 }, Z = (s) => s?.values ?? [];
|
|
134
|
+
function _t(s) {
|
|
135
|
+
const { series: t, hidden: e, labels: a, measure: o, format: i, noAxis: n, width: r, height: h } = s, c = t.map((v) => v.type ?? s.type), l = t.map((v, O) => O).filter((v) => !e.has(v)), d = l.map((v) => c[v]), u = Math.max(a.length, 0, ...t.map((v) => Z(v).length)), m = d.length > 0 ? d.includes("bar") : s.type === "bar", y = s.horizontal && m && (d.length === 0 || d.every((v) => v === "bar")), k = (v) => l.filter((O) => c[O] === v).map((O) => Z(t[O])), f = s.stacked ? [k("bar"), k("area")].filter((v) => v.length) : [], g = s.stacked ? k("line") : l.map((v) => Z(t[v])), x = d.length > 0 ? d.some((v) => v !== "line") : s.type !== "line", { lo: _, hi: w } = Lt(f, g, { includeZero: x }), p = { min: s.min, max: s.max };
|
|
135
136
|
if (!y) {
|
|
136
|
-
const v = Math.max(0, h -
|
|
137
|
+
const v = Math.max(0, h - R.top - R.bottom), O = F(_, w, W(v, ht.vertical), p), q = n ? 0 : Math.max(0, ...O.values.map((gt) => o(i(gt)))), rt = n ? 4 : Math.ceil(q) + J;
|
|
137
138
|
return {
|
|
138
139
|
box: {
|
|
139
|
-
x:
|
|
140
|
-
y:
|
|
141
|
-
width: Math.max(0, r -
|
|
140
|
+
x: rt,
|
|
141
|
+
y: R.top,
|
|
142
|
+
width: Math.max(0, r - rt - R.right),
|
|
142
143
|
height: v
|
|
143
144
|
},
|
|
144
145
|
ticks: O,
|
|
@@ -149,13 +150,13 @@ function Ot(s) {
|
|
|
149
150
|
visible: l
|
|
150
151
|
};
|
|
151
152
|
}
|
|
152
|
-
const
|
|
153
|
+
const $ = Math.max(0, ...a.map(o)), M = Math.ceil(Math.min($, r * 0.4)) + J, L = Math.max(0, r - M - R.right), z = F(_, w, W(L, ht.horizontal), p), T = n ? R.right : Math.max(R.right, o(i(z.max)) / 2);
|
|
153
154
|
return {
|
|
154
155
|
box: {
|
|
155
156
|
x: M,
|
|
156
|
-
y:
|
|
157
|
-
width: Math.max(0, r - M -
|
|
158
|
-
height: Math.max(0, h -
|
|
157
|
+
y: R.top,
|
|
158
|
+
width: Math.max(0, r - M - T),
|
|
159
|
+
height: Math.max(0, h - R.top - (n ? 4 : R.bottom))
|
|
159
160
|
},
|
|
160
161
|
ticks: z,
|
|
161
162
|
count: u,
|
|
@@ -165,15 +166,15 @@ function Ot(s) {
|
|
|
165
166
|
visible: l
|
|
166
167
|
};
|
|
167
168
|
}
|
|
168
|
-
function
|
|
169
|
+
function N(s, t) {
|
|
169
170
|
const { box: e, count: a, horizontal: o, banded: i } = s, n = o ? e.y : e.x, r = o ? e.height : e.width;
|
|
170
171
|
return i ? n + (t + 0.5) * r / Math.max(1, a) : a <= 1 ? n + r / 2 : n + t / (a - 1) * r;
|
|
171
172
|
}
|
|
172
|
-
function
|
|
173
|
+
function I(s, t) {
|
|
173
174
|
const { box: e, ticks: a, horizontal: o } = s;
|
|
174
|
-
return o ?
|
|
175
|
+
return o ? X(t, a, e.x, e.x + e.width) : X(t, a, e.y + e.height, e.y);
|
|
175
176
|
}
|
|
176
|
-
function
|
|
177
|
+
function zt(s, t, e) {
|
|
177
178
|
const { box: a, count: o, horizontal: i, banded: n } = s;
|
|
178
179
|
if (o === 0) return -1;
|
|
179
180
|
const r = i ? e - a.y : t - a.x, h = i ? a.height : a.width;
|
|
@@ -181,32 +182,32 @@ function _t(s, t, e) {
|
|
|
181
182
|
const c = n ? Math.floor(r / (h / o)) : Math.round(r / h * (o - 1));
|
|
182
183
|
return Math.min(Math.max(c, 0), o - 1);
|
|
183
184
|
}
|
|
184
|
-
const
|
|
185
|
-
function
|
|
185
|
+
const Gt = 0.64, st = 2, dt = 4, ut = { grouped: 40, stacked: 48 }, Bt = 12;
|
|
186
|
+
function mt(s, t) {
|
|
186
187
|
for (let e = s.length - 1; e >= 0; e -= 1)
|
|
187
188
|
if (t(s[e])) return e;
|
|
188
189
|
return -1;
|
|
189
190
|
}
|
|
190
|
-
function
|
|
191
|
+
function Dt(s, t, e) {
|
|
191
192
|
if (e(s) <= t) return s;
|
|
192
193
|
let a = s;
|
|
193
194
|
for (; a.length > 1 && e(`${a}…`) > t; ) a = a.slice(0, -1);
|
|
194
195
|
return `${a}…`;
|
|
195
196
|
}
|
|
196
|
-
function
|
|
197
|
+
function Et(s) {
|
|
197
198
|
const { layout: t, noGrid: e, noAxis: a, format: o } = s, { box: i, ticks: n, horizontal: r } = t, h = e ? A : n.values.map((d) => {
|
|
198
|
-
const u =
|
|
199
|
+
const u = I(t, d);
|
|
199
200
|
return r ? b`<line class="grid" x1=${u} y1=${i.y} x2=${u} y2=${i.y + i.height} />` : b`<line class="grid" x1=${i.x} y1=${u} x2=${i.x + i.width} y2=${u} />`;
|
|
200
201
|
}), c = n.min < 0 && n.max > 0 ? (() => {
|
|
201
|
-
const d =
|
|
202
|
+
const d = I(t, 0);
|
|
202
203
|
return r ? b`<line class="baseline" x1=${d} y1=${i.y} x2=${d} y2=${i.y + i.height} />` : b`<line class="baseline" x1=${i.x} y1=${d} x2=${i.x + i.width} y2=${d} />`;
|
|
203
204
|
})() : A, l = a ? A : n.values.map((d) => {
|
|
204
|
-
const u =
|
|
205
|
+
const u = I(t, d);
|
|
205
206
|
return r ? b`<text class="tick-label" x=${u} y=${i.y + i.height + 16} text-anchor="middle">${o(d)}</text>` : b`<text class="tick-label" x=${i.x - 8} y=${u} text-anchor="end" dominant-baseline="middle">${o(d)}</text>`;
|
|
206
207
|
});
|
|
207
208
|
return b`${h}${c}${l}`;
|
|
208
209
|
}
|
|
209
|
-
function
|
|
210
|
+
function Tt(s) {
|
|
210
211
|
const { layout: t, labels: e, measure: a } = s, { box: o, count: i, horizontal: n, banded: r } = t;
|
|
211
212
|
if (n) {
|
|
212
213
|
const l = Math.max(1, Math.ceil(i / Math.max(1, Math.floor(o.height / 18))));
|
|
@@ -214,46 +215,46 @@ function Et(s) {
|
|
|
214
215
|
(d, u) => u % l === 0 ? b`<text
|
|
215
216
|
class="axis-label"
|
|
216
217
|
x=${o.x - 8}
|
|
217
|
-
y=${
|
|
218
|
+
y=${N(t, u)}
|
|
218
219
|
text-anchor="end"
|
|
219
220
|
dominant-baseline="middle"
|
|
220
|
-
>${
|
|
221
|
+
>${Dt(d, o.x - J, a)}</text>` : A
|
|
221
222
|
)}`;
|
|
222
223
|
}
|
|
223
|
-
const h = Math.max(0, ...e.map(a)) +
|
|
224
|
+
const h = Math.max(0, ...e.map(a)) + J, c = Math.max(1, Math.ceil(i / Math.max(1, Math.floor(o.width / h))));
|
|
224
225
|
return b`${e.map((l, d) => {
|
|
225
226
|
if (d % c !== 0) return A;
|
|
226
227
|
const u = r || i <= 1 ? "middle" : d === 0 ? "start" : d === i - 1 ? "end" : "middle";
|
|
227
228
|
return b`<text
|
|
228
229
|
class="axis-label"
|
|
229
|
-
x=${
|
|
230
|
+
x=${N(t, d)}
|
|
230
231
|
y=${o.y + o.height + 16}
|
|
231
232
|
text-anchor=${u}
|
|
232
233
|
>${l}</text>`;
|
|
233
234
|
})}`;
|
|
234
235
|
}
|
|
235
|
-
function
|
|
236
|
+
function Rt(s, t, e) {
|
|
236
237
|
return t.map((a, o) => [
|
|
237
|
-
|
|
238
|
-
|
|
238
|
+
N(s.layout, o),
|
|
239
|
+
I(s.layout, a + (e?.[o] ?? 0))
|
|
239
240
|
]);
|
|
240
241
|
}
|
|
241
|
-
function
|
|
242
|
-
return s.smooth ?
|
|
242
|
+
function at(s, t, e = !0) {
|
|
243
|
+
return s.smooth ? Ct(t, e) : j(t, e);
|
|
243
244
|
}
|
|
244
|
-
function
|
|
245
|
-
const { layout: t, series: e, colorOf: a, active: o, idPrefix: i, stacked: n, smooth: r } = s, { box: h, count: c, visible: l, marks: d } = t, u =
|
|
245
|
+
function Vt(s) {
|
|
246
|
+
const { layout: t, series: e, colorOf: a, active: o, idPrefix: i, stacked: n, smooth: r } = s, { box: h, count: c, visible: l, marks: d } = t, u = I(t, Math.min(Math.max(0, t.ticks.min), t.ticks.max)), m = new Array(c).fill(0), y = [], k = [];
|
|
246
247
|
for (const g of l) {
|
|
247
|
-
const
|
|
248
|
-
if (
|
|
249
|
-
const _ =
|
|
248
|
+
const x = d[g];
|
|
249
|
+
if (x === "bar") continue;
|
|
250
|
+
const _ = Z(e[g]);
|
|
250
251
|
if (_.length === 0) continue;
|
|
251
|
-
const w = a(g),
|
|
252
|
-
if (
|
|
253
|
-
const L = `${i}-fill-${g}`, z =
|
|
252
|
+
const w = a(g), $ = x === "area" && n ? [...m] : void 0, M = Rt(s, _, $);
|
|
253
|
+
if (x === "area") {
|
|
254
|
+
const L = `${i}-fill-${g}`, z = $ ? _.map((v, O) => [N(t, O), I(t, $[O])]) : [
|
|
254
255
|
[M.at(-1)[0], u],
|
|
255
256
|
[M[0][0], u]
|
|
256
|
-
],
|
|
257
|
+
], T = $ ? at(s, [...z].reverse(), !1) : j(z, !1);
|
|
257
258
|
y.push(b`
|
|
258
259
|
<defs>
|
|
259
260
|
<linearGradient id=${L} x1="0" y1="0" x2="0" y2="1">
|
|
@@ -261,11 +262,11 @@ function Rt(s) {
|
|
|
261
262
|
<stop offset="100%" stop-color=${w} stop-opacity="0.02" />
|
|
262
263
|
</linearGradient>
|
|
263
264
|
</defs>
|
|
264
|
-
<path class="area" d=${`${
|
|
265
|
+
<path class="area" d=${`${at(s, M)} ${T} Z`} fill=${`url(#${L})`} />`), $ && _.forEach((v, O) => m[O] = $[O] + v);
|
|
265
266
|
}
|
|
266
267
|
if (k.push(
|
|
267
|
-
b`<path class="line" d=${
|
|
268
|
-
), c <=
|
|
268
|
+
b`<path class="line" d=${at(s, M)} stroke=${w} pathLength="1" />`
|
|
269
|
+
), c <= Bt && !r && k.push(
|
|
269
270
|
b`${M.map(([L, z]) => b`<circle class="point" cx=${L} cy=${z} r="3" fill=${w} />`)}`
|
|
270
271
|
), o >= 0 && M[o]) {
|
|
271
272
|
const [L, z] = M[o];
|
|
@@ -273,16 +274,16 @@ function Rt(s) {
|
|
|
273
274
|
}
|
|
274
275
|
}
|
|
275
276
|
const f = o >= 0 && !t.banded ? b`<line class="crosshair"
|
|
276
|
-
x1=${
|
|
277
|
-
x2=${
|
|
277
|
+
x1=${N(t, o)} y1=${h.y}
|
|
278
|
+
x2=${N(t, o)} y2=${h.y + h.height} />` : A;
|
|
278
279
|
return b`${y}${f}${k}`;
|
|
279
280
|
}
|
|
280
|
-
function
|
|
281
|
+
function ft(s, t) {
|
|
281
282
|
const { layout: e, active: a, colorOf: o } = s, { from: i, to: n, offset: r, thickness: h, outer: c, series: l, index: d } = t, u = n < i;
|
|
282
|
-
let m =
|
|
283
|
+
let m = I(e, i), y = I(e, n);
|
|
283
284
|
const k = 0.5, f = Math.sign(y - m) || 1;
|
|
284
285
|
i !== 0 && (m += k * f), c || (y -= k * f), Math.abs(y - m) < 1 && (y = m + f);
|
|
285
|
-
const g = Math.min(m, y),
|
|
286
|
+
const g = Math.min(m, y), x = Math.abs(y - m), _ = c ? e.horizontal ? u ? "left" : "right" : u ? "bottom" : "top" : "none", w = e.horizontal ? ct(g, r, x, h, dt, _) : ct(r, g, h, x, dt, _);
|
|
286
287
|
return b`<path
|
|
287
288
|
class=${`bar${u ? " negative" : ""}${e.horizontal ? " sideways" : ""}`}
|
|
288
289
|
d=${w}
|
|
@@ -292,25 +293,25 @@ function mt(s, t) {
|
|
|
292
293
|
opacity=${a === -1 || a === d ? 1 : 0.45}
|
|
293
294
|
/>`;
|
|
294
295
|
}
|
|
295
|
-
function
|
|
296
|
+
function It(s) {
|
|
296
297
|
const { layout: t, series: e } = s, { box: a, count: o, horizontal: i, visible: n, marks: r } = t, h = n.filter((u) => r[u] === "bar");
|
|
297
298
|
if (h.length === 0 || o === 0) return A;
|
|
298
|
-
const l = (i ? a.height : a.width) / o *
|
|
299
|
+
const l = (i ? a.height : a.width) / o * Gt, d = [];
|
|
299
300
|
for (let u = 0; u < o; u += 1) {
|
|
300
|
-
const m =
|
|
301
|
+
const m = N(t, u);
|
|
301
302
|
if (s.stacked) {
|
|
302
|
-
const f = Math.max(2, Math.min(
|
|
303
|
+
const f = Math.max(2, Math.min(ut.stacked, l)), g = h.map(($) => Z(e[$])[u] ?? 0), x = mt(g, ($) => $ > 0), _ = mt(g, ($) => $ < 0);
|
|
303
304
|
let w = 0, p = 0;
|
|
304
|
-
g.forEach((
|
|
305
|
-
if (
|
|
306
|
-
const L =
|
|
307
|
-
|
|
308
|
-
|
|
305
|
+
g.forEach(($, M) => {
|
|
306
|
+
if ($ === 0) return;
|
|
307
|
+
const L = $ > 0 ? w : p, z = L + $;
|
|
308
|
+
$ > 0 ? w = z : p = z, d.push(
|
|
309
|
+
ft(s, {
|
|
309
310
|
from: L,
|
|
310
311
|
to: z,
|
|
311
312
|
offset: m - f / 2,
|
|
312
313
|
thickness: f,
|
|
313
|
-
outer: M === (
|
|
314
|
+
outer: M === ($ > 0 ? x : _),
|
|
314
315
|
series: h[M],
|
|
315
316
|
index: u
|
|
316
317
|
})
|
|
@@ -320,15 +321,15 @@ function Vt(s) {
|
|
|
320
321
|
}
|
|
321
322
|
const y = Math.max(
|
|
322
323
|
2,
|
|
323
|
-
Math.min(
|
|
324
|
-
), k = y * h.length +
|
|
324
|
+
Math.min(ut.grouped, (l - st * (h.length - 1)) / h.length)
|
|
325
|
+
), k = y * h.length + st * (h.length - 1);
|
|
325
326
|
h.forEach((f, g) => {
|
|
326
|
-
const
|
|
327
|
-
|
|
328
|
-
|
|
327
|
+
const x = Z(e[f])[u];
|
|
328
|
+
x === void 0 || x === 0 || d.push(
|
|
329
|
+
ft(s, {
|
|
329
330
|
from: 0,
|
|
330
|
-
to:
|
|
331
|
-
offset: m - k / 2 + g * (y +
|
|
331
|
+
to: x,
|
|
332
|
+
offset: m - k / 2 + g * (y + st),
|
|
332
333
|
thickness: y,
|
|
333
334
|
outer: !0,
|
|
334
335
|
series: f,
|
|
@@ -339,15 +340,15 @@ function Vt(s) {
|
|
|
339
340
|
}
|
|
340
341
|
return b`${d}`;
|
|
341
342
|
}
|
|
342
|
-
function
|
|
343
|
+
function Xt(s) {
|
|
343
344
|
return b`
|
|
344
|
-
${
|
|
345
|
+
${Et(s)}
|
|
346
|
+
${It(s)}
|
|
345
347
|
${Vt(s)}
|
|
346
|
-
${
|
|
347
|
-
${Et(s)}`;
|
|
348
|
+
${Tt(s)}`;
|
|
348
349
|
}
|
|
349
|
-
function
|
|
350
|
-
const { layout: t, series: e, active: a, stacked: o } = s, i = (c) =>
|
|
350
|
+
function Nt(s) {
|
|
351
|
+
const { layout: t, series: e, active: a, stacked: o } = s, i = (c) => Z(e[c])[a] ?? 0;
|
|
351
352
|
let n = t.ticks.min;
|
|
352
353
|
for (const c of ["bar", "area", "line"]) {
|
|
353
354
|
const l = t.visible.filter((u) => t.marks[u] === c).map(i);
|
|
@@ -355,121 +356,121 @@ function Xt(s) {
|
|
|
355
356
|
const d = o && c !== "line" ? l.filter((u) => u > 0).reduce((u, m) => u + m, 0) : Math.max(...l);
|
|
356
357
|
n = Math.max(n, d);
|
|
357
358
|
}
|
|
358
|
-
const r =
|
|
359
|
+
const r = N(t, a), h = I(t, Math.min(n, t.ticks.max));
|
|
359
360
|
return t.horizontal ? { x: h, y: r } : { x: r, y: h };
|
|
360
361
|
}
|
|
361
|
-
const
|
|
362
|
-
function
|
|
363
|
-
return s.series.flatMap((t, e) => s.hidden.has(e) ? [] :
|
|
362
|
+
const U = { top: 16, right: 16, bottom: 24 }, Zt = 12, Ut = 24, pt = 3, Ht = 4, jt = 24, K = (s) => s?.points ?? [];
|
|
363
|
+
function Kt(s) {
|
|
364
|
+
return s.series.flatMap((t, e) => s.hidden.has(e) ? [] : K(t));
|
|
364
365
|
}
|
|
365
|
-
function
|
|
366
|
+
function bt(s) {
|
|
366
367
|
return s.length === 0 ? [0, 1] : [Math.min(...s), Math.max(...s)];
|
|
367
368
|
}
|
|
368
|
-
function
|
|
369
|
-
const { width: t, height: e, measure: a, format: o, formatX: i, noAxis: n } = s, r =
|
|
369
|
+
function qt(s) {
|
|
370
|
+
const { width: t, height: e, measure: a, format: o, formatX: i, noAxis: n } = s, r = Kt(s), h = Math.max(0, e - U.top - U.bottom), [c, l] = bt(r.map((x) => x.y)), d = F(c, l, W(h, 48), { min: s.min, max: s.max }), u = n ? 0 : Math.max(0, ...d.values.map((x) => a(o(x)))), m = n ? 4 : Math.ceil(u) + Zt, [y, k] = bt(r.map((x) => x.x)), f = F(y, k, W(Math.max(0, t - m - U.right), 96), {
|
|
370
371
|
min: null,
|
|
371
372
|
max: null
|
|
372
|
-
}), g = n ?
|
|
373
|
+
}), g = n ? U.right : Math.max(U.right, a(i(f.max)) / 2);
|
|
373
374
|
return {
|
|
374
375
|
box: {
|
|
375
376
|
x: m,
|
|
376
|
-
y:
|
|
377
|
+
y: U.top,
|
|
377
378
|
width: Math.max(0, t - m - g),
|
|
378
379
|
height: h
|
|
379
380
|
},
|
|
380
381
|
x: f,
|
|
381
382
|
y: d,
|
|
382
|
-
maxR: s.bubble ? Math.max(0, ...r.map((
|
|
383
|
+
maxR: s.bubble ? Math.max(0, ...r.map((x) => x.r ?? 0)) : 0
|
|
383
384
|
};
|
|
384
385
|
}
|
|
385
|
-
function
|
|
386
|
+
function Q(s, t) {
|
|
386
387
|
const { box: e } = s;
|
|
387
388
|
return [
|
|
388
|
-
|
|
389
|
-
|
|
389
|
+
X(t.x, s.x, e.x, e.x + e.width),
|
|
390
|
+
X(t.y, s.y, e.y + e.height, e.y)
|
|
390
391
|
];
|
|
391
392
|
}
|
|
392
|
-
function
|
|
393
|
-
return s === void 0 || t <= 0 || s <= 0 ?
|
|
393
|
+
function Yt(s, t) {
|
|
394
|
+
return s === void 0 || t <= 0 || s <= 0 ? pt : Math.max(pt, Ut * Math.sqrt(s / t));
|
|
394
395
|
}
|
|
395
|
-
function
|
|
396
|
-
return s.bubble ?
|
|
396
|
+
function it(s, t, e) {
|
|
397
|
+
return s.bubble ? Yt(e.r, t.maxR) : Ht;
|
|
397
398
|
}
|
|
398
|
-
function
|
|
399
|
+
function Ft(s, t, e, a) {
|
|
399
400
|
let o = null, i = 1 / 0;
|
|
400
401
|
return s.series.forEach((n, r) => {
|
|
401
|
-
s.hidden.has(r) ||
|
|
402
|
-
const [l, d] =
|
|
402
|
+
s.hidden.has(r) || K(n).forEach((h, c) => {
|
|
403
|
+
const [l, d] = Q(t, h), u = Math.hypot(l - e, d - a), m = Math.max(jt, it(s, t, h) + 4);
|
|
403
404
|
u <= m && u < i && (o = { series: r, index: c }, i = u);
|
|
404
405
|
});
|
|
405
406
|
}), o;
|
|
406
407
|
}
|
|
407
|
-
function
|
|
408
|
-
const t =
|
|
408
|
+
function $t(s) {
|
|
409
|
+
const t = K(s);
|
|
409
410
|
return t.map((e, a) => a).sort((e, a) => t[e].x - t[a].x);
|
|
410
411
|
}
|
|
411
|
-
function
|
|
412
|
+
function Wt(s) {
|
|
412
413
|
const { layout: t, noGrid: e, noAxis: a, format: o, formatX: i, bubble: n, colorOf: r, active: h, activeSeries: c } = s, { box: l } = t, d = e ? A : b`
|
|
413
414
|
${t.y.values.map((f) => {
|
|
414
|
-
const g =
|
|
415
|
+
const g = X(f, t.y, l.y + l.height, l.y);
|
|
415
416
|
return b`<line class="grid" x1=${l.x} y1=${g} x2=${l.x + l.width} y2=${g} />`;
|
|
416
417
|
})}
|
|
417
418
|
${t.x.values.map((f) => {
|
|
418
|
-
const g =
|
|
419
|
+
const g = X(f, t.x, l.x, l.x + l.width);
|
|
419
420
|
return b`<line class="grid" x1=${g} y1=${l.y} x2=${g} y2=${l.y + l.height} />`;
|
|
420
421
|
})}`, u = a ? A : b`
|
|
421
422
|
${t.y.values.map(
|
|
422
|
-
(f) => b`<text class="tick-label" x=${l.x - 8} y=${
|
|
423
|
+
(f) => b`<text class="tick-label" x=${l.x - 8} y=${X(f, t.y, l.y + l.height, l.y)}
|
|
423
424
|
text-anchor="end" dominant-baseline="middle">${o(f)}</text>`
|
|
424
425
|
)}
|
|
425
426
|
${t.x.values.map(
|
|
426
|
-
(f) => b`<text class="tick-label" x=${
|
|
427
|
+
(f) => b`<text class="tick-label" x=${X(f, t.x, l.x, l.x + l.width)}
|
|
427
428
|
y=${l.y + l.height + 16} text-anchor="middle">${i(f)}</text>`
|
|
428
429
|
)}`, y = s.series.flatMap(
|
|
429
|
-
(f, g) => s.hidden.has(g) ? [] :
|
|
430
|
-
point:
|
|
430
|
+
(f, g) => s.hidden.has(g) ? [] : K(f).map((x, _) => ({
|
|
431
|
+
point: x,
|
|
431
432
|
index: _,
|
|
432
433
|
seriesIndex: g,
|
|
433
|
-
radius:
|
|
434
|
+
radius: it(s, t, x)
|
|
434
435
|
}))
|
|
435
|
-
).sort((f, g) => g.radius - f.radius).map(({ point: f, index: g, seriesIndex:
|
|
436
|
-
const [w, p] =
|
|
436
|
+
).sort((f, g) => g.radius - f.radius).map(({ point: f, index: g, seriesIndex: x, radius: _ }) => {
|
|
437
|
+
const [w, p] = Q(t, f), $ = r(x);
|
|
437
438
|
return b`<circle
|
|
438
439
|
class="dot"
|
|
439
440
|
cx=${w}
|
|
440
441
|
cy=${p}
|
|
441
442
|
r=${_}
|
|
442
|
-
fill=${
|
|
443
|
+
fill=${$}
|
|
443
444
|
fill-opacity=${n ? 0.55 : 0.85}
|
|
444
|
-
stroke=${n ?
|
|
445
|
+
stroke=${n ? $ : "var(--surface-card)"}
|
|
445
446
|
stroke-width=${n ? 1.5 : 2}
|
|
446
|
-
data-series=${
|
|
447
|
+
data-series=${x}
|
|
447
448
|
data-index=${g}
|
|
448
449
|
/>`;
|
|
449
450
|
}), k = (() => {
|
|
450
|
-
const f =
|
|
451
|
+
const f = K(s.series[c])[h];
|
|
451
452
|
if (!f || s.hidden.has(c)) return A;
|
|
452
|
-
const [g,
|
|
453
|
-
return b`<circle class="focus-ring" cx=${g} cy=${
|
|
454
|
-
r=${
|
|
453
|
+
const [g, x] = Q(t, f);
|
|
454
|
+
return b`<circle class="focus-ring" cx=${g} cy=${x}
|
|
455
|
+
r=${it(s, t, f) + 4} fill="none" stroke=${r(c)} stroke-width="2" />`;
|
|
455
456
|
})();
|
|
456
457
|
return b`${d}${u}${y}${k}`;
|
|
457
458
|
}
|
|
458
|
-
const
|
|
459
|
-
function
|
|
459
|
+
const Jt = 8, Qt = 0.62, xt = 4, tt = 12;
|
|
460
|
+
function te(s) {
|
|
460
461
|
const { width: t, height: e, kind: a, series: o, hidden: i, labels: n, measure: r } = s, h = t / 2, c = e / 2;
|
|
461
462
|
if (a === "radar") {
|
|
462
463
|
const w = o.flatMap(
|
|
463
464
|
(v, O) => i.has(O) ? [] : v.values ?? []
|
|
464
|
-
), p = Math.min(0, ...w),
|
|
465
|
+
), p = Math.min(0, ...w), $ = Math.max(0, ...w), M = ot(p, $ === p ? p + 1 : $, xt), L = Math.min(Math.max(0, ...n.map(r)), t * 0.25) + tt, z = Math.max(0, Math.min(h - L, c - tt * 2)), T = Math.max(n.length, ...o.map((v) => v.values?.length ?? 0));
|
|
465
466
|
return {
|
|
466
467
|
cx: h,
|
|
467
468
|
cy: c,
|
|
468
469
|
outer: z,
|
|
469
470
|
inner: 0,
|
|
470
|
-
slices: Array.from({ length:
|
|
471
|
-
const
|
|
472
|
-
return { index: O, value: 0, start:
|
|
471
|
+
slices: Array.from({ length: T }, (v, O) => {
|
|
472
|
+
const q = O * H / Math.max(1, T);
|
|
473
|
+
return { index: O, value: 0, start: q, end: q, outer: z };
|
|
473
474
|
}),
|
|
474
475
|
ticks: M,
|
|
475
476
|
total: 0
|
|
@@ -478,44 +479,44 @@ function Qt(s) {
|
|
|
478
479
|
const l = o[0]?.values ?? [], d = Math.max(n.length, l.length), u = (w) => i.has(w) ? 0 : Math.max(0, l[w] ?? 0), m = Array.from({ length: d }, (w, p) => u(p)).reduce(
|
|
479
480
|
(w, p) => w + p,
|
|
480
481
|
0
|
|
481
|
-
), y = Math.max(0, Math.min(t, e) / 2 -
|
|
482
|
+
), y = Math.max(0, Math.min(t, e) / 2 - Jt), k = Math.max(0, ...Array.from({ length: d }, (w, p) => u(p))), f = ot(0, k || 1, xt), g = Array.from({ length: d }, (w, p) => p).filter(
|
|
482
483
|
(w) => !i.has(w)
|
|
483
484
|
).length;
|
|
484
|
-
let
|
|
485
|
+
let x = 0;
|
|
485
486
|
const _ = Array.from({ length: d }, (w, p) => {
|
|
486
|
-
const
|
|
487
|
-
return a === "polar-area" ? (i.has(p) || (
|
|
487
|
+
const $ = u(p), M = x;
|
|
488
|
+
return a === "polar-area" ? (i.has(p) || (x += H / Math.max(1, g)), { index: p, value: $, start: M, end: x, outer: y * Math.sqrt($ / f.max) }) : (x += m > 0 ? $ / m * H : 0, { index: p, value: $, start: M, end: x, outer: y });
|
|
488
489
|
});
|
|
489
|
-
return { cx: h, cy: c, outer: y, inner: a === "doughnut" ? y *
|
|
490
|
+
return { cx: h, cy: c, outer: y, inner: a === "doughnut" ? y * Qt : 0, slices: _, ticks: f, total: m };
|
|
490
491
|
}
|
|
491
|
-
function
|
|
492
|
+
function ee(s, t, e, a) {
|
|
492
493
|
const o = e - s.cx, i = a - s.cy, n = Math.hypot(o, i);
|
|
493
494
|
let r = Math.atan2(o, -i);
|
|
494
|
-
if (r < 0 && (r +=
|
|
495
|
+
if (r < 0 && (r += H), t === "radar") {
|
|
495
496
|
const c = s.slices.length;
|
|
496
|
-
return c === 0 || n > s.outer +
|
|
497
|
+
return c === 0 || n > s.outer + tt * 2 ? -1 : Math.round(r / (H / c)) % c;
|
|
497
498
|
}
|
|
498
499
|
return n > s.outer || n < s.inner ? -1 : s.slices.find(
|
|
499
500
|
({ start: c, end: l }) => l > c && r >= c && r < l
|
|
500
501
|
)?.index ?? -1;
|
|
501
502
|
}
|
|
502
|
-
function
|
|
503
|
+
function se(s, t) {
|
|
503
504
|
const e = s.slices[t];
|
|
504
505
|
if (!e) return [s.cx, s.cy];
|
|
505
506
|
const a = (e.start + e.end) / 2, o = s.inner > 0 ? (s.inner + e.outer) / 2 : e.outer * 0.6;
|
|
506
|
-
return
|
|
507
|
+
return D(s.cx, s.cy, o, a);
|
|
507
508
|
}
|
|
508
|
-
function
|
|
509
|
+
function Y(s, t) {
|
|
509
510
|
const { ticks: e, outer: a } = s;
|
|
510
511
|
return (t - e.min) / (e.max - e.min) * a;
|
|
511
512
|
}
|
|
512
|
-
function
|
|
513
|
+
function ae(s) {
|
|
513
514
|
const { layout: t, active: e, sliceColor: a, kind: o, noGrid: i, format: n, centerLabel: r } = s, { cx: h, cy: c, inner: l, ticks: d } = t, u = o === "polar-area" && !i ? d.values.filter((f) => f > 0).map(
|
|
514
515
|
(f) => b`<circle class="grid" cx=${h} cy=${c} r=${t.outer * Math.sqrt(f / d.max)} fill="none" />`
|
|
515
516
|
) : A, m = t.slices.filter((f) => f.end > f.start && f.outer > 0), y = m.map(
|
|
516
517
|
(f) => b`<path
|
|
517
518
|
class="slice"
|
|
518
|
-
d=${
|
|
519
|
+
d=${Ot(h, c, l, f.outer, f.start, f.end)}
|
|
519
520
|
fill=${a(f.index)}
|
|
520
521
|
fill-rule="evenodd"
|
|
521
522
|
stroke="var(--surface-card)"
|
|
@@ -529,48 +530,48 @@ function se(s) {
|
|
|
529
530
|
${l > 36 ? b`<text class="center-label" x=${h} y=${c + 20} text-anchor="middle" dominant-baseline="middle">${r}</text>` : A}` : A;
|
|
530
531
|
return b`${u}${y}${k}`;
|
|
531
532
|
}
|
|
532
|
-
function
|
|
533
|
+
function oe(s) {
|
|
533
534
|
const { layout: t, series: e, hidden: a, labels: o, colorOf: i, active: n, noGrid: r, noAxis: h, format: c } = s, { cx: l, cy: d, outer: u, ticks: m, slices: y } = t, k = y.map((p) => p.start), f = r ? A : b`
|
|
534
535
|
${m.values.filter((p) => p > m.min).map((p) => {
|
|
535
|
-
const
|
|
536
|
-
return b`<path class="grid" fill="none" d=${`${
|
|
536
|
+
const $ = Y(t, p);
|
|
537
|
+
return b`<path class="grid" fill="none" d=${`${j(k.map((M) => D(l, d, $, M)))} Z`} />`;
|
|
537
538
|
})}
|
|
538
539
|
${k.map((p) => {
|
|
539
|
-
const [
|
|
540
|
-
return b`<line class="grid" x1=${l} y1=${d} x2=${
|
|
540
|
+
const [$, M] = D(l, d, u, p);
|
|
541
|
+
return b`<line class="grid" x1=${l} y1=${d} x2=${$} y2=${M} />`;
|
|
541
542
|
})}`, g = h ? A : m.values.filter((p) => p > m.min).map(
|
|
542
|
-
(p) => b`<text class="tick-label ring-label" x=${l + 4} y=${d -
|
|
543
|
-
),
|
|
544
|
-
const M = Math.sin(p), L = Math.cos(p), z = M > 0.1 ? "start" : M < -0.1 ? "end" : "middle", [
|
|
545
|
-
return b`<text class="axis-label" x=${
|
|
546
|
-
}), _ = e.map((p,
|
|
547
|
-
if (a.has(
|
|
548
|
-
const M = i(
|
|
549
|
-
(
|
|
543
|
+
(p) => b`<text class="tick-label ring-label" x=${l + 4} y=${d - Y(t, p) + 3} dominant-baseline="hanging">${c(p)}</text>`
|
|
544
|
+
), x = k.map((p, $) => {
|
|
545
|
+
const M = Math.sin(p), L = Math.cos(p), z = M > 0.1 ? "start" : M < -0.1 ? "end" : "middle", [T, v] = D(l, d, u + (Math.abs(L) > 0.5 ? 8 : tt), p), O = L > 0.5 ? "auto" : L < -0.5 ? "hanging" : "middle";
|
|
546
|
+
return b`<text class="axis-label" x=${T} y=${v} text-anchor=${z} dominant-baseline=${O}>${o[$] ?? ""}</text>`;
|
|
547
|
+
}), _ = e.map((p, $) => {
|
|
548
|
+
if (a.has($)) return A;
|
|
549
|
+
const M = i($), L = k.map(
|
|
550
|
+
(T, v) => D(l, d, Y(t, p.values?.[v] ?? m.min), T)
|
|
550
551
|
), z = n >= 0 && L[n] ? b`<circle class="marker" cx=${L[n][0]} cy=${L[n][1]} r="5" fill=${M} />` : A;
|
|
551
552
|
return b`
|
|
552
|
-
<path class="radar" d=${`${
|
|
553
|
+
<path class="radar" d=${`${j(L)} Z`} stroke=${M} fill=${M} />
|
|
553
554
|
${z}`;
|
|
554
555
|
}), w = n >= 0 && k[n] !== void 0 ? (() => {
|
|
555
|
-
const [p,
|
|
556
|
-
return b`<line class="crosshair" x1=${l} y1=${d} x2=${p} y2=${
|
|
556
|
+
const [p, $] = D(l, d, u, k[n]);
|
|
557
|
+
return b`<line class="crosshair" x1=${l} y1=${d} x2=${p} y2=${$} />`;
|
|
557
558
|
})() : A;
|
|
558
|
-
return b`${f}${w}${_}${g}${
|
|
559
|
+
return b`${f}${w}${_}${g}${x}`;
|
|
559
560
|
}
|
|
560
|
-
function
|
|
561
|
-
return s.kind === "radar" ?
|
|
561
|
+
function ie(s) {
|
|
562
|
+
return s.kind === "radar" ? oe(s) : ae(s);
|
|
562
563
|
}
|
|
563
|
-
var
|
|
564
|
+
var re = Object.defineProperty, C = (s, t, e, a) => {
|
|
564
565
|
for (var o = void 0, i = s.length - 1, n; i >= 0; i--)
|
|
565
566
|
(n = s[i]) && (o = n(t, e, o) || o);
|
|
566
|
-
return o &&
|
|
567
|
+
return o && re(t, e, o), o;
|
|
567
568
|
};
|
|
568
|
-
const
|
|
569
|
-
class S extends
|
|
569
|
+
const yt = 8;
|
|
570
|
+
class S extends nt {
|
|
570
571
|
constructor() {
|
|
571
|
-
super(...arguments), this.tableId =
|
|
572
|
+
super(...arguments), this.tableId = At("kt-chart-table"), this.box = { width: 0, height: 0 }, this.active = -1, this.activeSeries = -1, this.hiddenSeries = /* @__PURE__ */ new Set(), this.type = "area", this.series = [], this.labels = [], this.height = 200, this.format = (t) => String(t), this.formatX = (t) => String(t), this.noGrid = !1, this.noAxis = !1, this.showTable = !1, this.smooth = !1, this.stacked = !1, this.horizontal = !1, this.min = null, this.max = null, this.centerLabel = void 0, this.totalLabel = void 0, this.label = "", this.colorOf = (t) => {
|
|
572
573
|
const e = this.series[t];
|
|
573
|
-
return e?.color ? e.color : this.series.length === 1 ? "var(--color-primary-base)" : `var(--chart-series-${t %
|
|
574
|
+
return e?.color ? e.color : this.series.length === 1 ? "var(--color-primary-base)" : `var(--chart-series-${t % yt + 1})`;
|
|
574
575
|
}, this.measure = (t) => {
|
|
575
576
|
if (this.measureContext === void 0)
|
|
576
577
|
try {
|
|
@@ -580,12 +581,12 @@ class S extends rt {
|
|
|
580
581
|
this.measureContext = null;
|
|
581
582
|
}
|
|
582
583
|
return this.measureContext ? this.measureContext.measureText(t).width : t.length * 6.5;
|
|
583
|
-
}, this.sliceColor = (t) => `var(--chart-series-${t %
|
|
584
|
+
}, this.sliceColor = (t) => `var(--chart-series-${t % yt + 1})`;
|
|
584
585
|
}
|
|
585
586
|
static {
|
|
586
587
|
this.styles = [
|
|
587
|
-
|
|
588
|
-
|
|
588
|
+
nt.styles,
|
|
589
|
+
vt`
|
|
589
590
|
:host {
|
|
590
591
|
display: block;
|
|
591
592
|
position: relative;
|
|
@@ -920,7 +921,7 @@ class S extends rt {
|
|
|
920
921
|
};
|
|
921
922
|
return {
|
|
922
923
|
...t,
|
|
923
|
-
layout:
|
|
924
|
+
layout: _t(t),
|
|
924
925
|
active: this.active,
|
|
925
926
|
smooth: this.smooth,
|
|
926
927
|
noGrid: this.noGrid,
|
|
@@ -944,7 +945,7 @@ class S extends rt {
|
|
|
944
945
|
};
|
|
945
946
|
return {
|
|
946
947
|
...t,
|
|
947
|
-
layout:
|
|
948
|
+
layout: qt(t),
|
|
948
949
|
active: this.active,
|
|
949
950
|
activeSeries: this.activeSeries,
|
|
950
951
|
noGrid: this.noGrid,
|
|
@@ -967,11 +968,11 @@ class S extends rt {
|
|
|
967
968
|
};
|
|
968
969
|
return {
|
|
969
970
|
...t,
|
|
970
|
-
layout:
|
|
971
|
+
layout: te(t),
|
|
971
972
|
active: this.active,
|
|
972
973
|
noGrid: this.noGrid,
|
|
973
974
|
noAxis: this.noAxis,
|
|
974
|
-
centerLabel: this.centerLabel,
|
|
975
|
+
centerLabel: this.centerLabel ?? E().total,
|
|
975
976
|
format: this.format,
|
|
976
977
|
colorOf: this.colorOf,
|
|
977
978
|
sliceColor: this.sliceColor
|
|
@@ -982,19 +983,19 @@ class S extends rt {
|
|
|
982
983
|
return this.family === "point" ? this.series.some((t) => (t.points?.length ?? 0) > 0) : this.pointCount > 0;
|
|
983
984
|
}
|
|
984
985
|
setActive(t, e = -1) {
|
|
985
|
-
t === this.active && e === this.activeSeries || (this.active = t, this.activeSeries = e,
|
|
986
|
+
t === this.active && e === this.activeSeries || (this.active = t, this.activeSeries = e, lt(this, "kt-point-hover", { index: t, series: e }));
|
|
986
987
|
}
|
|
987
988
|
/* --------------------------------------------------------- interaction */
|
|
988
989
|
onPointerMove(t) {
|
|
989
990
|
if (this.box.width !== 0) {
|
|
990
991
|
if (this.family === "cartesian") {
|
|
991
|
-
const e =
|
|
992
|
+
const e = zt(this.cartesianView.layout, t.offsetX, t.offsetY);
|
|
992
993
|
this.setActive(e);
|
|
993
994
|
} else if (this.family === "radial") {
|
|
994
995
|
const e = this.radialView;
|
|
995
|
-
this.setActive(
|
|
996
|
+
this.setActive(ee(e.layout, e.kind, t.offsetX, t.offsetY));
|
|
996
997
|
} else if (this.family === "point") {
|
|
997
|
-
const e = this.pointView, a =
|
|
998
|
+
const e = this.pointView, a = Ft(e, e.layout, t.offsetX, t.offsetY);
|
|
998
999
|
this.setActive(a?.index ?? -1, a?.series ?? -1);
|
|
999
1000
|
}
|
|
1000
1001
|
}
|
|
@@ -1045,9 +1046,9 @@ class S extends rt {
|
|
|
1045
1046
|
this.setActive(-1);
|
|
1046
1047
|
return;
|
|
1047
1048
|
}
|
|
1048
|
-
const a = e.indexOf(this.activeSeries), o = a < 0 ? e[0] : this.activeSeries, i =
|
|
1049
|
+
const a = e.indexOf(this.activeSeries), o = a < 0 ? e[0] : this.activeSeries, i = $t(this.series[o]), n = a < 0 ? -1 : i.indexOf(this.active), r = i.length - 1, h = (c) => {
|
|
1049
1050
|
const l = e[Math.min(Math.max((a < 0 ? 0 : a) + c, 0), e.length - 1)];
|
|
1050
|
-
this.setActive(
|
|
1051
|
+
this.setActive($t(this.series[l])[0], l);
|
|
1051
1052
|
};
|
|
1052
1053
|
switch (t.key) {
|
|
1053
1054
|
case "ArrowRight":
|
|
@@ -1075,13 +1076,13 @@ class S extends rt {
|
|
|
1075
1076
|
}
|
|
1076
1077
|
toggle(t) {
|
|
1077
1078
|
const e = !this.hiddenSeries.has(t);
|
|
1078
|
-
if (
|
|
1079
|
+
if (lt(this, "kt-series-toggle", { series: t, hidden: e }).defaultPrevented) return;
|
|
1079
1080
|
const a = new Set(this.hiddenSeries);
|
|
1080
1081
|
e ? a.add(t) : a.delete(t), this.hiddenSeries = a, this.setActive(-1);
|
|
1081
1082
|
}
|
|
1082
1083
|
/* ----------------------------------------------------------- rendering */
|
|
1083
1084
|
renderMarks() {
|
|
1084
|
-
return this.family === "cartesian" ?
|
|
1085
|
+
return this.family === "cartesian" ? Xt(this.cartesianView) : this.family === "point" ? Wt(this.pointView) : ie(this.radialView);
|
|
1085
1086
|
}
|
|
1086
1087
|
get tooltip() {
|
|
1087
1088
|
if (this.active < 0 || this.box.width === 0) return null;
|
|
@@ -1090,7 +1091,7 @@ class S extends rt {
|
|
|
1090
1091
|
color: this.colorOf(r),
|
|
1091
1092
|
name: this.series[r].name,
|
|
1092
1093
|
value: this.format(this.series[r].values?.[this.active] ?? 0)
|
|
1093
|
-
})), { x: a, y: o } =
|
|
1094
|
+
})), { x: a, y: o } = Nt(t), i = t.layout.visible.filter(
|
|
1094
1095
|
(r) => this.stacked && t.layout.marks[r] !== "line"
|
|
1095
1096
|
), n = i.length > 1 ? this.format(
|
|
1096
1097
|
i.reduce(
|
|
@@ -1108,7 +1109,7 @@ class S extends rt {
|
|
|
1108
1109
|
};
|
|
1109
1110
|
}
|
|
1110
1111
|
if (this.sliced) {
|
|
1111
|
-
const t = this.radialView.layout, e = this.series[0]?.values?.[this.active] ?? 0, a = t.total > 0 ? Math.round(Math.max(0, e) / t.total * 100) : 0, [o, i] =
|
|
1112
|
+
const t = this.radialView.layout, e = this.series[0]?.values?.[this.active] ?? 0, a = t.total > 0 ? Math.round(Math.max(0, e) / t.total * 100) : 0, [o, i] = se(t, this.active);
|
|
1112
1113
|
return {
|
|
1113
1114
|
title: this.labels[this.active] ?? `#${this.active + 1}`,
|
|
1114
1115
|
rows: [
|
|
@@ -1127,7 +1128,7 @@ class S extends rt {
|
|
|
1127
1128
|
const t = this.radialView.layout, e = this.series.map((r, h) => h).filter((r) => !this.hiddenSeries.has(r)), a = Math.max(
|
|
1128
1129
|
t.ticks.min,
|
|
1129
1130
|
...e.map((r) => this.series[r].values?.[this.active] ?? t.ticks.min)
|
|
1130
|
-
), o = t.slices[this.active]?.start ?? 0, [i, n] =
|
|
1131
|
+
), o = t.slices[this.active]?.start ?? 0, [i, n] = D(t.cx, t.cy, Y(t, a), o);
|
|
1131
1132
|
return {
|
|
1132
1133
|
title: this.labels[this.active] ?? `#${this.active + 1}`,
|
|
1133
1134
|
rows: e.map((r) => ({
|
|
@@ -1143,7 +1144,7 @@ class S extends rt {
|
|
|
1143
1144
|
if (this.family === "point") {
|
|
1144
1145
|
const t = this.series[this.activeSeries], e = t?.points?.[this.active];
|
|
1145
1146
|
if (!t || !e) return null;
|
|
1146
|
-
const [a, o] =
|
|
1147
|
+
const [a, o] = Q(this.pointView.layout, e), i = this.colorOf(this.activeSeries), n = [
|
|
1147
1148
|
{ color: i, name: "x", value: this.formatX(e.x) },
|
|
1148
1149
|
{ color: i, name: "y", value: this.format(e.y) }
|
|
1149
1150
|
];
|
|
@@ -1177,7 +1178,7 @@ class S extends rt {
|
|
|
1177
1178
|
</span>`
|
|
1178
1179
|
)}
|
|
1179
1180
|
${t.total ? G`<span class="tooltip-total"
|
|
1180
|
-
><span>${this.totalLabel}</span><span>${t.total}</span></span
|
|
1181
|
+
><span>${this.totalLabel ?? E().total}</span><span>${t.total}</span></span
|
|
1181
1182
|
>` : A}
|
|
1182
1183
|
</div>`;
|
|
1183
1184
|
}
|
|
@@ -1196,7 +1197,7 @@ class S extends rt {
|
|
|
1196
1197
|
@click=${() => this.toggle(a)}
|
|
1197
1198
|
>
|
|
1198
1199
|
<span
|
|
1199
|
-
class=${
|
|
1200
|
+
class=${wt({ swatch: !0, hollow: o })}
|
|
1200
1201
|
style=${`--swatch:${e.color}`}
|
|
1201
1202
|
></span>
|
|
1202
1203
|
${e.name}
|
|
@@ -1209,12 +1210,12 @@ class S extends rt {
|
|
|
1209
1210
|
return G`<div part="table" class="table" id=${this.tableId}>
|
|
1210
1211
|
<table>
|
|
1211
1212
|
<caption>
|
|
1212
|
-
${this.label ||
|
|
1213
|
+
${this.label || E().chartData}
|
|
1213
1214
|
</caption>
|
|
1214
1215
|
<thead>
|
|
1215
1216
|
<tr>
|
|
1216
|
-
<th scope="col"
|
|
1217
|
-
<th scope="col"
|
|
1217
|
+
<th scope="col">${E().chartSeries}</th>
|
|
1218
|
+
<th scope="col">${E().chartPoint}</th>
|
|
1218
1219
|
<th scope="col">x</th>
|
|
1219
1220
|
<th scope="col">y</th>
|
|
1220
1221
|
${t ? G`<th scope="col">r</th>` : A}
|
|
@@ -1241,13 +1242,13 @@ class S extends rt {
|
|
|
1241
1242
|
return G`<div part="table" class="table" id=${this.tableId}>
|
|
1242
1243
|
<table>
|
|
1243
1244
|
<caption>
|
|
1244
|
-
${this.label ||
|
|
1245
|
+
${this.label || E().chartData}
|
|
1245
1246
|
</caption>
|
|
1246
1247
|
<thead>
|
|
1247
1248
|
<tr>
|
|
1248
|
-
<th scope="col"
|
|
1249
|
-
<th scope="col">${this.series[0]?.name ??
|
|
1250
|
-
<th scope="col"
|
|
1249
|
+
<th scope="col">${E().chartSlice}</th>
|
|
1250
|
+
<th scope="col">${this.series[0]?.name ?? E().chartValue}</th>
|
|
1251
|
+
<th scope="col">${E().chartShare}</th>
|
|
1251
1252
|
</tr>
|
|
1252
1253
|
</thead>
|
|
1253
1254
|
<tbody>
|
|
@@ -1273,13 +1274,13 @@ class S extends rt {
|
|
|
1273
1274
|
return G`<div part="table" class="table" id=${this.tableId}>
|
|
1274
1275
|
<table>
|
|
1275
1276
|
<caption>
|
|
1276
|
-
${this.label ||
|
|
1277
|
+
${this.label || E().chartData}
|
|
1277
1278
|
</caption>
|
|
1278
1279
|
<thead>
|
|
1279
1280
|
<tr>
|
|
1280
|
-
<th scope="col"
|
|
1281
|
+
<th scope="col">${E().chartPoint}</th>
|
|
1281
1282
|
${this.series.map((a) => G`<th scope="col">${a.name}</th>`)}
|
|
1282
|
-
${t ? G`<th scope="col">${this.totalLabel}</th>` : A}
|
|
1283
|
+
${t ? G`<th scope="col">${this.totalLabel ?? E().total}</th>` : A}
|
|
1283
1284
|
</tr>
|
|
1284
1285
|
</thead>
|
|
1285
1286
|
<tbody>
|
|
@@ -1321,19 +1322,19 @@ class S extends rt {
|
|
|
1321
1322
|
}
|
|
1322
1323
|
}
|
|
1323
1324
|
C([
|
|
1324
|
-
|
|
1325
|
+
kt(".plot")
|
|
1325
1326
|
], S.prototype, "plot");
|
|
1326
1327
|
C([
|
|
1327
|
-
|
|
1328
|
+
et()
|
|
1328
1329
|
], S.prototype, "box");
|
|
1329
1330
|
C([
|
|
1330
|
-
|
|
1331
|
+
et()
|
|
1331
1332
|
], S.prototype, "active");
|
|
1332
1333
|
C([
|
|
1333
|
-
|
|
1334
|
+
et()
|
|
1334
1335
|
], S.prototype, "activeSeries");
|
|
1335
1336
|
C([
|
|
1336
|
-
|
|
1337
|
+
et()
|
|
1337
1338
|
], S.prototype, "hiddenSeries");
|
|
1338
1339
|
C([
|
|
1339
1340
|
B({ type: String, reflect: !0 })
|
|
@@ -1386,7 +1387,7 @@ C([
|
|
|
1386
1387
|
C([
|
|
1387
1388
|
B({ type: String })
|
|
1388
1389
|
], S.prototype, "label");
|
|
1389
|
-
|
|
1390
|
+
Mt("kt-chart", S);
|
|
1390
1391
|
export {
|
|
1391
1392
|
S as KtChart
|
|
1392
1393
|
};
|