@mintplayer/web-components 2.11.0 → 2.13.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/charts/core/index.mjs +19 -15
- package/charts/core/src/arc.d.ts +5 -6
- package/charts/core/src/color.d.ts +21 -2
- package/charts/core/src/index.d.ts +1 -0
- package/charts/core/src/label-fit.d.ts +31 -0
- package/charts/hierarchy/index.mjs +678 -213
- package/charts/hierarchy/src/components/mp-hierarchy-chart.d.ts +142 -8
- package/chunks/color-DIeST-IS.mjs +224 -0
- package/code-snippet/index.mjs +786 -176
- package/code-snippet/src/core/highlighter.d.ts +39 -0
- package/code-snippet/src/core/split-lines.d.ts +44 -0
- package/code-snippet/src/hljs-loaders.generated.d.ts +14 -0
- package/code-snippet/src/index.d.ts +2 -0
- package/code-snippet/src/mp-code-snippet.element.d.ts +172 -2
- package/code-snippet/src/styles/code-snippet.styles.d.ts +2 -0
- package/code-snippet/src/styles/index.d.ts +1 -0
- package/code-snippet/src/types/code-line-annotation.d.ts +29 -0
- package/code-snippet/src/types/index.d.ts +1 -0
- package/package.json +1 -1
- package/phone-input/index.mjs +24 -10
- package/phone-input/src/components/mp-phone-input.d.ts +9 -0
- package/chunks/color-5yPBn70k.mjs +0 -179
|
@@ -20,6 +20,15 @@ export type HierarchyChildrenLoader = (node: HierarchyNode) => Promise<Hierarchy
|
|
|
20
20
|
* color metric — sizing by a percentage inverts salience, PRD charts-wc §1.1),
|
|
21
21
|
* color follows `colorValue` through a clamped two-stop scale.
|
|
22
22
|
*
|
|
23
|
+
* Two kinds of zoom, deliberately distinct:
|
|
24
|
+
* - SEMANTIC re-root (click/Enter/tap/breadcrumb): the subtree takes the full
|
|
25
|
+
* chart; controlled via `root-id` + `hierarchy-zoom`.
|
|
26
|
+
* - GEOMETRIC magnification (ctrl/cmd+wheel, touch pinch, `+`/`-`/`0` keys,
|
|
27
|
+
* drag or two-finger pan): a view window mapped through the sunburst's
|
|
28
|
+
* viewBox / the div layouts' percentages — never a CSS transform. Labels
|
|
29
|
+
* hold their device-px size, so magnifying is what reveals small segments'
|
|
30
|
+
* captions. Resets on re-root, layout switch and data writes.
|
|
31
|
+
*
|
|
23
32
|
* No-JS tier: none (a proportional chart is meaningless without computed
|
|
24
33
|
* geometry); the demo registers in axe.spec.ts only.
|
|
25
34
|
*
|
|
@@ -27,7 +36,9 @@ export type HierarchyChildrenLoader = (node: HierarchyNode) => Promise<Hierarchy
|
|
|
27
36
|
* - `data: HierarchyNode` (property only)
|
|
28
37
|
* - `root-id` / `rootId` — controlled focus node (two-way via `hierarchy-zoom`)
|
|
29
38
|
* - `max-depth`, `min-angle` (deg), `min-size` (logical px), `show-labels`,
|
|
30
|
-
* `label-
|
|
39
|
+
* `label-font-size` (device px — constant across host size and zoom),
|
|
40
|
+
* `backdrop` (overrides backdrop auto-detection for label contrast),
|
|
41
|
+
* `color-min`, `color-max`, `color-start`, `color-end`
|
|
31
42
|
* - `input-label` / `aria-label` — accessible name for the in-shadow tree
|
|
32
43
|
*
|
|
33
44
|
* Events: `hierarchy-zoom`, `hierarchy-node-select`, `hierarchy-node-hover`,
|
|
@@ -44,7 +55,17 @@ export declare class MpHierarchyChart extends LitElement {
|
|
|
44
55
|
private _minAngle;
|
|
45
56
|
private _minSize;
|
|
46
57
|
private _showLabels;
|
|
47
|
-
private
|
|
58
|
+
private _labelFontSize;
|
|
59
|
+
private _backdropOverride;
|
|
60
|
+
/** The opaque surface behind the chart; labels contrast against fill composited over this. */
|
|
61
|
+
private _backdrop;
|
|
62
|
+
/**
|
|
63
|
+
* Device px per viewBox unit, measured by a ResizeObserver. The fallback is
|
|
64
|
+
* a representative 420px host so environments without ResizeObserver (jsdom)
|
|
65
|
+
* stay deterministic for the fit specs.
|
|
66
|
+
*/
|
|
67
|
+
private _hostScale;
|
|
68
|
+
private _resizeObserver;
|
|
48
69
|
private _colorMin;
|
|
49
70
|
private _colorMax;
|
|
50
71
|
private _colorStart;
|
|
@@ -89,9 +110,15 @@ export declare class MpHierarchyChart extends LitElement {
|
|
|
89
110
|
set rootId(value: string | undefined);
|
|
90
111
|
/**
|
|
91
112
|
* Levels rendered outward from the focus node, or `'auto'` for every loaded
|
|
92
|
-
* level.
|
|
93
|
-
*
|
|
94
|
-
*
|
|
113
|
+
* level. Any positive number is valid.
|
|
114
|
+
*
|
|
115
|
+
* Left unset it resolves to `'auto'` — a chart given a whole tree should draw
|
|
116
|
+
* the tree it was given — EXCEPT when a `loadChildren` loader is present:
|
|
117
|
+
* `'auto'` treats the deepest rendered ring as a load candidate, so an
|
|
118
|
+
* unbounded lazy chart walks the entire remote tree one level per render (see
|
|
119
|
+
* `loadLazyCandidates`). Lazy charts therefore keep the bounded 2-level
|
|
120
|
+
* window (codecov's) unless the consumer asks for `'auto'` explicitly and
|
|
121
|
+
* means it.
|
|
95
122
|
*/
|
|
96
123
|
get maxDepth(): number | 'auto';
|
|
97
124
|
set maxDepth(value: number | 'auto');
|
|
@@ -107,8 +134,17 @@ export declare class MpHierarchyChart extends LitElement {
|
|
|
107
134
|
set minSize(value: number);
|
|
108
135
|
get showLabels(): boolean;
|
|
109
136
|
set showLabels(value: boolean);
|
|
110
|
-
|
|
111
|
-
|
|
137
|
+
/** Label font size in DEVICE px — held constant across host size and zoom state. */
|
|
138
|
+
get labelFontSize(): number;
|
|
139
|
+
set labelFontSize(value: number);
|
|
140
|
+
/**
|
|
141
|
+
* Opaque CSS color behind the chart, used to composite translucent fills
|
|
142
|
+
* before picking a contrasting label color. Unset = auto-detected from the
|
|
143
|
+
* nearest opaque ancestor background (set it when the walk cannot see the
|
|
144
|
+
* real backdrop: images, gradients, cross-document embedding).
|
|
145
|
+
*/
|
|
146
|
+
get backdrop(): string | undefined;
|
|
147
|
+
set backdrop(value: string | undefined);
|
|
112
148
|
get colorMin(): number;
|
|
113
149
|
set colorMin(value: number);
|
|
114
150
|
get colorMax(): number;
|
|
@@ -133,6 +169,17 @@ export declare class MpHierarchyChart extends LitElement {
|
|
|
133
169
|
set loadingLabel(value: string);
|
|
134
170
|
private rebuildScale;
|
|
135
171
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
172
|
+
private _showBreadcrumb;
|
|
173
|
+
private _breadcrumbLabel;
|
|
174
|
+
/**
|
|
175
|
+
* Renders the focus path as real buttons above the chart: a single-pointer,
|
|
176
|
+
* keyboard-operable way back up, and the visible statement of zoom state
|
|
177
|
+
* (PRD hierarchy-chart-zoom-labels B1). Off by default.
|
|
178
|
+
*/
|
|
179
|
+
get showBreadcrumb(): boolean;
|
|
180
|
+
set showBreadcrumb(value: boolean);
|
|
181
|
+
get breadcrumbLabel(): string;
|
|
182
|
+
set breadcrumbLabel(value: string);
|
|
136
183
|
get zoomOutLabel(): string;
|
|
137
184
|
set zoomOutLabel(value: string);
|
|
138
185
|
get metricUnitLabel(): string;
|
|
@@ -141,6 +188,69 @@ export declare class MpHierarchyChart extends LitElement {
|
|
|
141
188
|
set valueUnitLabel(value: string);
|
|
142
189
|
/** The node the chart is rooted on right now (tree root when root-id is unset). */
|
|
143
190
|
private get focusedRoot();
|
|
191
|
+
connectedCallback(): void;
|
|
192
|
+
disconnectedCallback(): void;
|
|
193
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
194
|
+
/**
|
|
195
|
+
* The first opaque computed background-color above the host (shadow roots
|
|
196
|
+
* crossed via .host). A live theme flip is picked up on the next render —
|
|
197
|
+
* one frame of suboptimal-but-legible contrast, self-correcting.
|
|
198
|
+
*/
|
|
199
|
+
private resolveBackdrop;
|
|
200
|
+
/** Which token bucket a label over this node should use: the surface's tone. */
|
|
201
|
+
private surfaceToneOf;
|
|
202
|
+
private toneOfSurface;
|
|
203
|
+
private _gestures;
|
|
204
|
+
private _zoomHintLabel;
|
|
205
|
+
private _hintVisible;
|
|
206
|
+
private _hintTimer;
|
|
207
|
+
private readonly _wheelListener;
|
|
208
|
+
/** Space-separated gesture allowlist: 'wheel pinch' (default) | 'wheel' | 'pinch' | 'none'. */
|
|
209
|
+
get zoomGestures(): string;
|
|
210
|
+
set zoomGestures(value: string);
|
|
211
|
+
get zoomHintLabel(): string;
|
|
212
|
+
set zoomHintLabel(value: string | undefined);
|
|
213
|
+
/**
|
|
214
|
+
* GEOMETRIC view state (user decision 2026-08-14): ctrl/cmd+wheel and pinch
|
|
215
|
+
* magnify the chart itself — labels hold their device-px size, so zooming
|
|
216
|
+
* in is what makes small segments' captions fit (the fit test re-runs per
|
|
217
|
+
* zoom state). Implemented as a view window over normalized content
|
|
218
|
+
* coordinates — the sunburst maps it to its viewBox, the div layouts map
|
|
219
|
+
* their percentage geometry through it — never a CSS transform, so text
|
|
220
|
+
* stays crisp and nothing re-rasterizes. Click/Enter/breadcrumb keep the
|
|
221
|
+
* SEMANTIC re-root, which resets the view (the subtree fills the chart).
|
|
222
|
+
*/
|
|
223
|
+
private _viewZoom;
|
|
224
|
+
private _viewX;
|
|
225
|
+
private _viewY;
|
|
226
|
+
private static readonly MAX_ZOOM;
|
|
227
|
+
/** Current geometric magnification (1 = fitted). Read-only state for consumers/tests. */
|
|
228
|
+
get zoomLevel(): number;
|
|
229
|
+
/** Programmatic geometric zoom, anchored at chart fractions (default: center). */
|
|
230
|
+
setZoomLevel(zoom: number, anchorX?: number, anchorY?: number): void;
|
|
231
|
+
resetZoom(): void;
|
|
232
|
+
/** Pan by chart-screen fractions (drag / two-finger move). */
|
|
233
|
+
private panBy;
|
|
234
|
+
/** Map a normalized content rect through the view window to chart fractions. */
|
|
235
|
+
private viewRect;
|
|
236
|
+
/** Pointer position as chart fractions, for anchor-at-cursor zooming. */
|
|
237
|
+
private chartAnchor;
|
|
238
|
+
/** Device px per normalized content unit — the label fit tests' scale. */
|
|
239
|
+
private get effectiveScale();
|
|
240
|
+
private onWheel;
|
|
241
|
+
private readonly _pinchPointers;
|
|
242
|
+
private _dragPointer;
|
|
243
|
+
private _dragLast;
|
|
244
|
+
private _dragTotal;
|
|
245
|
+
private _dragMoved;
|
|
246
|
+
private pinchDistance;
|
|
247
|
+
private pinchMidpoint;
|
|
248
|
+
private onPointerDown;
|
|
249
|
+
/** @returns true when the move belonged to a pinch or drag (skip hover handling). */
|
|
250
|
+
private trackViewGesture;
|
|
251
|
+
/** pointerup ends the gesture; pointercancel abandons it (divergent engines degrade to tap). */
|
|
252
|
+
private endViewGesture;
|
|
253
|
+
private showZoomHint;
|
|
144
254
|
/** Re-root on a node id (undefined = tree root) and emit `hierarchy-zoom`. */
|
|
145
255
|
zoomTo(id: string | undefined): void;
|
|
146
256
|
/** Move the roving tabindex (and DOM focus) to a rendered node. */
|
|
@@ -150,14 +260,29 @@ export declare class MpHierarchyChart extends LitElement {
|
|
|
150
260
|
private tweenedSpan;
|
|
151
261
|
private nodeFromEvent;
|
|
152
262
|
private onClick;
|
|
263
|
+
/**
|
|
264
|
+
* Escape hides the tooltip (WCAG 1.4.13 dismissable) BEFORE zooming out;
|
|
265
|
+
* it stays hidden for that node until the pointer/focus moves elsewhere.
|
|
266
|
+
*/
|
|
267
|
+
private _dismissedForId;
|
|
268
|
+
private get tooltipEl();
|
|
269
|
+
private isTooltipVisible;
|
|
270
|
+
/** Show the tooltip for a node at chart-relative coordinates, clamped inside the chart. */
|
|
271
|
+
private showTooltip;
|
|
272
|
+
private hideTooltip;
|
|
153
273
|
private onPointerMove;
|
|
154
274
|
private clearHover;
|
|
275
|
+
/** Keyboard parity for the hover tooltip (1.4.13): show on focus, hide on blur. */
|
|
276
|
+
private onFocusIn;
|
|
277
|
+
private onFocusOut;
|
|
155
278
|
private tooltipText;
|
|
156
279
|
private labelText;
|
|
157
280
|
/** Localized per-node accessible name: "components, 82%, 1,234 lines". */
|
|
158
281
|
private accessibleName;
|
|
159
282
|
private emit;
|
|
160
283
|
private onKeyDown;
|
|
284
|
+
/** Zoom anchored on a node's on-screen center (falls back to the chart center). */
|
|
285
|
+
private zoomKeyboard;
|
|
161
286
|
private handleTypeahead;
|
|
162
287
|
/**
|
|
163
288
|
* Roving tabindex target for this render: the focused node while it is
|
|
@@ -171,14 +296,23 @@ export declare class MpHierarchyChart extends LitElement {
|
|
|
171
296
|
private loadLazyCandidates;
|
|
172
297
|
private fillOf;
|
|
173
298
|
private treeLabel;
|
|
299
|
+
/** The focus path as buttons, OUTSIDE any role=tree container (trees own only treeitems). */
|
|
300
|
+
private renderBreadcrumb;
|
|
174
301
|
render(): TemplateResult;
|
|
175
302
|
private _tabFocusId;
|
|
176
303
|
private captureRendered;
|
|
177
304
|
private renderSunburst;
|
|
178
305
|
private renderArc;
|
|
179
|
-
|
|
306
|
+
/**
|
|
307
|
+
* Fit the (formatted) name into the arc IN DEVICE PX — the same 12px label
|
|
308
|
+
* needs a bigger arc on a small host, and re-rooting is what makes arcs big
|
|
309
|
+
* enough, so labels appear as you zoom in.
|
|
310
|
+
*/
|
|
311
|
+
private arcLabelFit;
|
|
180
312
|
private renderIcicle;
|
|
181
313
|
private renderTreemap;
|
|
314
|
+
private cellGeometry;
|
|
315
|
+
private cellLabelFits;
|
|
182
316
|
private renderCell;
|
|
183
317
|
}
|
|
184
318
|
declare global {
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
function Q(t) {
|
|
2
|
+
const s = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), o = (a, u) => {
|
|
3
|
+
s.set(a.id, a), r.set(a.id, u);
|
|
4
|
+
const l = a.children?.length ? a.children.map((i) => o(i, a)).reduce((i, f) => i + f, 0) : a.value ?? 0;
|
|
5
|
+
n.set(a.id, l);
|
|
6
|
+
const c = (a.children ?? []).filter((i) => e.get(i.id) !== void 0), h = c.map((i) => n.get(i.id) ?? 0).reduce((i, f) => i + f, 0);
|
|
7
|
+
return e.set(
|
|
8
|
+
a.id,
|
|
9
|
+
a.colorValue !== void 0 ? a.colorValue : h > 0 ? c.map((i) => (e.get(i.id) ?? 0) * (n.get(i.id) ?? 0)).reduce((i, f) => i + f, 0) / h : void 0
|
|
10
|
+
), l;
|
|
11
|
+
};
|
|
12
|
+
return o(t, null), { root: t, byId: s, parents: r, values: n, colorValues: e };
|
|
13
|
+
}
|
|
14
|
+
function V(t, s) {
|
|
15
|
+
const r = (n) => n ? [...r(t.parents.get(n.id)), n] : [];
|
|
16
|
+
return r(s);
|
|
17
|
+
}
|
|
18
|
+
function q(t, s) {
|
|
19
|
+
return V(t, s).length;
|
|
20
|
+
}
|
|
21
|
+
const O = (t) => !!(t.children?.length || t.hasChildren);
|
|
22
|
+
function W(t, s) {
|
|
23
|
+
return [...s.children ?? []].sort(
|
|
24
|
+
(r, n) => (t.values.get(n.id) ?? 0) - (t.values.get(r.id) ?? 0)
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
function D(t, s) {
|
|
28
|
+
return s !== void 0 && t.byId.get(s) || t.root;
|
|
29
|
+
}
|
|
30
|
+
function X(t, s) {
|
|
31
|
+
const r = (n) => n.children?.length ? 1 + Math.max(...n.children.map(r)) : 0;
|
|
32
|
+
return r(D(t, s));
|
|
33
|
+
}
|
|
34
|
+
function Y(t, s, r = {}) {
|
|
35
|
+
const { maxDepth: n = 2, minFraction: e = 0 } = r, o = D(t, s), a = [], u = (l, c, h, i, f) => {
|
|
36
|
+
if (i > n) return;
|
|
37
|
+
const g = W(t, l);
|
|
38
|
+
if (!g.length) return;
|
|
39
|
+
const M = g.map((m) => t.values.get(m.id) ?? 0).reduce((m, $) => m + $, 0);
|
|
40
|
+
g.reduce((m, $, y) => {
|
|
41
|
+
const x = M > 0 ? (t.values.get($.id) ?? 0) / M : 1 / g.length, p = m + (h - c) * x;
|
|
42
|
+
return p - m >= e && p > m && (a.push({
|
|
43
|
+
node: $,
|
|
44
|
+
x0: m,
|
|
45
|
+
x1: p,
|
|
46
|
+
depth: i,
|
|
47
|
+
level: f + 1,
|
|
48
|
+
setsize: g.length,
|
|
49
|
+
posinset: y + 1,
|
|
50
|
+
hasChildren: O($)
|
|
51
|
+
}), u($, m, p, i + 1, f + 1)), p;
|
|
52
|
+
}, c);
|
|
53
|
+
};
|
|
54
|
+
return u(o, 0, 1, 1, q(t, o)), a;
|
|
55
|
+
}
|
|
56
|
+
function S(t, s) {
|
|
57
|
+
const r = t.reduce((u, l) => u + l, 0);
|
|
58
|
+
if (r === 0 || s === 0) return 1 / 0;
|
|
59
|
+
const n = Math.max(...t), e = Math.min(...t), o = r * r, a = s * s;
|
|
60
|
+
return Math.max(a * n / o, o / (a * e));
|
|
61
|
+
}
|
|
62
|
+
function _(t, s) {
|
|
63
|
+
const r = /* @__PURE__ */ new Map();
|
|
64
|
+
let n = { ...s }, e = t.filter((u) => u.area > 0);
|
|
65
|
+
const o = (u) => {
|
|
66
|
+
const l = u.reduce((i, f) => i + f.area, 0), c = n.x1 - n.x0, h = n.y1 - n.y0;
|
|
67
|
+
if (!(l <= 0 || c <= 0 || h <= 0))
|
|
68
|
+
if (c >= h) {
|
|
69
|
+
const i = l / h;
|
|
70
|
+
u.reduce((f, g) => {
|
|
71
|
+
const M = g.area / i;
|
|
72
|
+
return r.set(g.id, { x0: n.x0, y0: f, x1: n.x0 + i, y1: f + M }), f + M;
|
|
73
|
+
}, n.y0), n = { ...n, x0: n.x0 + i };
|
|
74
|
+
} else {
|
|
75
|
+
const i = l / c;
|
|
76
|
+
u.reduce((f, g) => {
|
|
77
|
+
const M = g.area / i;
|
|
78
|
+
return r.set(g.id, { x0: f, y0: n.y0, x1: f + M, y1: n.y0 + i }), f + M;
|
|
79
|
+
}, n.x0), n = { ...n, y0: n.y0 + i };
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
let a = [];
|
|
83
|
+
for (; e.length; ) {
|
|
84
|
+
const u = Math.min(n.x1 - n.x0, n.y1 - n.y0), l = [...a, e[0]];
|
|
85
|
+
!a.length || S(l.map((c) => c.area), u) <= S(a.map((c) => c.area), u) ? (a = l, e = e.slice(1)) : (o(a), a = []);
|
|
86
|
+
}
|
|
87
|
+
return o(a), r;
|
|
88
|
+
}
|
|
89
|
+
function tt(t, s, r = {}) {
|
|
90
|
+
const { maxDepth: n = 2, minArea: e = 0, childPadding: o = 0, childHeaderSpace: a = 0 } = r, u = D(t, s), l = [], c = (i) => {
|
|
91
|
+
const f = {
|
|
92
|
+
x0: i.x0 + o,
|
|
93
|
+
y0: i.y0 + o + a,
|
|
94
|
+
x1: i.x1 - o,
|
|
95
|
+
y1: i.y1 - o
|
|
96
|
+
};
|
|
97
|
+
return f.x1 - f.x0 > 0 && f.y1 - f.y0 > 0 ? f : null;
|
|
98
|
+
}, h = (i, f, g, M) => {
|
|
99
|
+
if (g > n) return;
|
|
100
|
+
const m = g === 1 ? f : c(f);
|
|
101
|
+
if (!m) return;
|
|
102
|
+
const $ = W(t, i);
|
|
103
|
+
if (!$.length) return;
|
|
104
|
+
const y = (m.x1 - m.x0) * (m.y1 - m.y0), x = $.map((d) => t.values.get(d.id) ?? 0).reduce((d, L) => d + L, 0), p = $.map((d) => ({
|
|
105
|
+
id: d.id,
|
|
106
|
+
area: x > 0 ? (t.values.get(d.id) ?? 0) / x * y : y / $.length
|
|
107
|
+
})), w = _(p, m);
|
|
108
|
+
$.map((d, L) => ({ kid: d, i: L, r: w.get(d.id) })).filter((d) => !!d.r && (d.r.x1 - d.r.x0) * (d.r.y1 - d.r.y0) >= e).map((d) => (l.push({
|
|
109
|
+
node: d.kid,
|
|
110
|
+
...d.r,
|
|
111
|
+
depth: g,
|
|
112
|
+
level: M + 1,
|
|
113
|
+
setsize: $.length,
|
|
114
|
+
posinset: d.i + 1,
|
|
115
|
+
hasChildren: O(d.kid)
|
|
116
|
+
}), h(d.kid, d.r, g + 1, M + 1), d));
|
|
117
|
+
};
|
|
118
|
+
return h(u, { x0: 0, y0: 0, x1: 1, y1: 1 }, 1, q(t, u)), l;
|
|
119
|
+
}
|
|
120
|
+
const j = 2 * Math.PI, I = 1e-6, b = (t, s, r) => A(t + s * Math.sin(r)), v = (t, s, r) => A(t - s * Math.cos(r)), A = (t) => Math.round(t * 1e3) / 1e3;
|
|
121
|
+
function z(t, s, r, n) {
|
|
122
|
+
const e = `M ${b(t, n, 0)} ${v(s, n, 0)} A ${n} ${n} 0 1 1 ${b(t, n, Math.PI)} ${v(s, n, Math.PI)} A ${n} ${n} 0 1 1 ${b(t, n, 0)} ${v(s, n, 0)} Z`;
|
|
123
|
+
if (r <= I) return e;
|
|
124
|
+
const o = `M ${b(t, r, 0)} ${v(s, r, 0)} A ${r} ${r} 0 1 0 ${b(t, r, Math.PI)} ${v(s, r, Math.PI)} A ${r} ${r} 0 1 0 ${b(t, r, 0)} ${v(s, r, 0)} Z`;
|
|
125
|
+
return `${e} ${o}`;
|
|
126
|
+
}
|
|
127
|
+
function nt(t, s, r, n, e, o, a = {}) {
|
|
128
|
+
const { padAngle: u = 0, ringGap: l = 1 } = a, c = Math.max(0, r), h = Math.max(c, n - l);
|
|
129
|
+
if (h - c <= I || o - e <= I) return "";
|
|
130
|
+
if (o - e >= j - I) return z(t, s, c, h);
|
|
131
|
+
const i = Math.min((o - e) / 2, u) / 2, f = i > 0 ? a.padRadius ?? Math.sqrt(c * c + h * h) : 0, g = (H) => H > I ? Math.asin(Math.min(1, f * Math.sin(i) / H)) : 0, M = (e + o) / 2, m = (H, R) => R > H ? [H, R] : [M, M + I], [$, y] = m(e + g(h), o - g(h)), x = y - $ > Math.PI ? 1 : 0, p = `M ${b(t, h, $)} ${v(s, h, $)} A ${h} ${h} 0 ${x} 1 ${b(t, h, y)} ${v(s, h, y)}`;
|
|
132
|
+
if (c <= I) return `${p} L ${A(t)} ${A(s)} Z`;
|
|
133
|
+
const [w, d] = m(e + g(c), o - g(c)), L = d - w > Math.PI ? 1 : 0;
|
|
134
|
+
return `${p} L ${b(t, c, d)} ${v(s, c, d)} A ${c} ${c} 0 ${L} 0 ${b(t, c, w)} ${v(s, c, w)} Z`;
|
|
135
|
+
}
|
|
136
|
+
function st(t, s, r, n = "radial") {
|
|
137
|
+
const e = (t + s) / 2 * 360 % 360, o = n === "radial" ? e < 180 ? 0 : 180 : e > 90 && e < 270 ? 270 : 90;
|
|
138
|
+
return `rotate(${A(e - 90)}) translate(${A(r)},0) rotate(${o})`;
|
|
139
|
+
}
|
|
140
|
+
const Z = 0.6, F = 1.2, C = 8, U = 4, K = "…", G = { visible: !1, text: "", orientation: "tangential" }, E = (t, s, r) => !t.length || s < U ? G : s >= t.length ? { visible: !0, text: t, orientation: r } : { visible: !0, text: t.slice(0, s - 1) + K, orientation: r };
|
|
141
|
+
function rt(t, s, r, n, e) {
|
|
142
|
+
const o = n - r, a = (r + n) / 2;
|
|
143
|
+
if (o <= 0 || s <= 0 || e <= 0) return G;
|
|
144
|
+
const u = a * s, l = Z * e, c = F * e, h = u >= c ? Math.floor((o - C) / l) : 0, i = 2 * a * Math.sin(Math.min(s, Math.PI) / 2), f = o >= c ? Math.floor((Math.min(u, i) - C) / l) : 0;
|
|
145
|
+
return f >= h ? E(t, f, "tangential") : E(t, h, "radial");
|
|
146
|
+
}
|
|
147
|
+
function et(t, s, r) {
|
|
148
|
+
return s >= 1.4 * r && t - C >= 3 * Z * r;
|
|
149
|
+
}
|
|
150
|
+
function B(t, s, r) {
|
|
151
|
+
const n = (t % 360 + 360) % 360, e = (1 - Math.abs(2 * r - 1)) * s, o = e * (1 - Math.abs(n / 60 % 2 - 1)), a = r - e / 2, u = Math.floor(n / 60), [l, c, h] = u === 0 ? [e, o, 0] : u === 1 ? [o, e, 0] : u === 2 ? [0, e, o] : u === 3 ? [0, o, e] : u === 4 ? [o, 0, e] : [e, 0, o];
|
|
152
|
+
return [(l + a) * 255, (c + a) * 255, (h + a) * 255];
|
|
153
|
+
}
|
|
154
|
+
function P(t) {
|
|
155
|
+
const s = t.trim().match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i)?.[1];
|
|
156
|
+
if (s) {
|
|
157
|
+
const e = s.length === 3 ? [...s].map((o) => o + o).join("") : s;
|
|
158
|
+
return [0, 2, 4].map((o) => parseInt(e.slice(o, o + 2), 16));
|
|
159
|
+
}
|
|
160
|
+
const r = t.trim().match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*[\d.]+\s*)?\)$/i);
|
|
161
|
+
if (r) return [Number(r[1]), Number(r[2]), Number(r[3])];
|
|
162
|
+
const n = t.trim().match(/^hsl\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%\s*\)$/i);
|
|
163
|
+
if (n) return B(Number(n[1]), Number(n[2]) / 100, Number(n[3]) / 100);
|
|
164
|
+
throw new Error(`Unsupported color: "${t}" (use #rrggbb, rgb(r, g, b) or hsl(h, s%, l%))`);
|
|
165
|
+
}
|
|
166
|
+
function T(t) {
|
|
167
|
+
try {
|
|
168
|
+
return P(t);
|
|
169
|
+
} catch {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function k([t, s, r]) {
|
|
174
|
+
const n = t / 255, e = s / 255, o = r / 255, a = Math.max(n, e, o), u = Math.min(n, e, o), l = (a + u) / 2;
|
|
175
|
+
if (a === u) return { h: 0, s: 0, l };
|
|
176
|
+
const c = a - u, h = l > 0.5 ? c / (2 - a - u) : c / (a + u);
|
|
177
|
+
return { h: (a === n ? (e - o) / c + (e < o ? 6 : 0) : a === e ? (o - n) / c + 2 : (n - e) / c + 4) * 60, s: h, l };
|
|
178
|
+
}
|
|
179
|
+
function ot(t, s, r, n) {
|
|
180
|
+
const e = k(P(r)), o = k(P(n)), a = s - t;
|
|
181
|
+
return (u) => {
|
|
182
|
+
const l = a === 0 ? 0 : Math.min(1, Math.max(0, (u - t) / a)), c = e.h + (o.h - e.h) * l, h = e.s + (o.s - e.s) * l, i = e.l + (o.l - e.l) * l;
|
|
183
|
+
return `hsl(${N(c)}, ${N(h * 100)}%, ${N(i * 100)}%)`;
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
const N = (t) => Math.round(t * 10) / 10;
|
|
187
|
+
function J(t) {
|
|
188
|
+
const s = T(t);
|
|
189
|
+
if (!s) return;
|
|
190
|
+
const [r, n, e] = s.map((o) => {
|
|
191
|
+
const a = o / 255;
|
|
192
|
+
return a <= 0.03928 ? a / 12.92 : Math.pow((a + 0.055) / 1.055, 2.4);
|
|
193
|
+
});
|
|
194
|
+
return 0.2126 * r + 0.7152 * n + 0.0722 * e;
|
|
195
|
+
}
|
|
196
|
+
function at(t, s, r) {
|
|
197
|
+
const n = T(t), e = T(s);
|
|
198
|
+
if (!n || !e) return;
|
|
199
|
+
const o = Math.min(1, Math.max(0, r)), a = n.map((u, l) => Math.round(u * o + e[l] * (1 - o)));
|
|
200
|
+
return `rgb(${a[0]}, ${a[1]}, ${a[2]})`;
|
|
201
|
+
}
|
|
202
|
+
function ct(t) {
|
|
203
|
+
const s = J(t);
|
|
204
|
+
if (s === void 0) return;
|
|
205
|
+
const r = (s + 0.05) / 0.05, n = 1.05 / (s + 0.05);
|
|
206
|
+
return r >= n ? "dark" : "light";
|
|
207
|
+
}
|
|
208
|
+
export {
|
|
209
|
+
st as a,
|
|
210
|
+
nt as b,
|
|
211
|
+
Q as c,
|
|
212
|
+
ot as d,
|
|
213
|
+
at as e,
|
|
214
|
+
ct as f,
|
|
215
|
+
rt as g,
|
|
216
|
+
et as h,
|
|
217
|
+
V as i,
|
|
218
|
+
D as j,
|
|
219
|
+
X as k,
|
|
220
|
+
q as l,
|
|
221
|
+
Y as p,
|
|
222
|
+
J as r,
|
|
223
|
+
tt as s
|
|
224
|
+
};
|