@mintplayer/web-components 2.12.0 → 2.14.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/chunks/{mp-splitter-LszuRDbR.mjs → mp-splitter-Ckn1kN4v.mjs} +33 -19
- package/code-snippet/index.mjs +6 -8
- package/code-snippet/src/hljs-loaders.generated.d.ts +1 -1
- package/dock/index.mjs +841 -830
- package/dock/src/components/mint-dock-manager.element.d.ts +6 -34
- package/dock/src/core/geometry.d.ts +36 -0
- package/dock/src/core/index.d.ts +5 -0
- package/dock/src/core/layout-tree.d.ts +84 -0
- package/dock/src/core/resize.d.ts +83 -0
- package/dock/src/core/sizes.d.ts +31 -0
- package/dock/src/core/types.d.ts +44 -0
- package/file-manager/index.mjs +1 -1
- package/navbar/index.mjs +71 -44
- package/navbar/src/components/mp-navbar.d.ts +17 -1
- package/package.json +1 -1
- package/ribbon/index.mjs +7 -3
- package/ribbon/src/mp-quick-access-toolbar.element.d.ts +11 -0
- package/splitter/index.mjs +1 -1
- package/splitter/src/state/splitter-state.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
|
+
};
|
|
@@ -12,8 +12,22 @@ class R {
|
|
|
12
12
|
...e
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* A snapshot no caller can write back through.
|
|
17
|
+
*
|
|
18
|
+
* The arrays are copied, not just the envelope: every setter here already
|
|
19
|
+
* copies on the way IN, and a shallow spread on the way out quietly undid
|
|
20
|
+
* that — a subscriber holding `panelSizes` was holding the store's own array,
|
|
21
|
+
* so sorting or splicing it reordered the panels with no notification to
|
|
22
|
+
* anyone. The asymmetry is the bug; this is the other half of it.
|
|
23
|
+
*/
|
|
15
24
|
getState() {
|
|
16
|
-
return {
|
|
25
|
+
return {
|
|
26
|
+
...this.state,
|
|
27
|
+
panelSizes: [...this.state.panelSizes],
|
|
28
|
+
previewSizes: this.state.previewSizes ? [...this.state.previewSizes] : null,
|
|
29
|
+
resizeOperation: this.state.resizeOperation ? { ...this.state.resizeOperation, sizes: [...this.state.resizeOperation.sizes] } : null
|
|
30
|
+
};
|
|
17
31
|
}
|
|
18
32
|
subscribe(e) {
|
|
19
33
|
return this.listeners.add(e), () => {
|
|
@@ -153,8 +167,8 @@ class P {
|
|
|
153
167
|
};
|
|
154
168
|
}
|
|
155
169
|
calculatePreviewSizes(e, i, t) {
|
|
156
|
-
const { startPosition: s, sizes: n, indexBefore: a, indexAfter: o } = e, d = t === "horizontal" ? i.x - s.x : i.y - s.y, h = [...n], r = n[a],
|
|
157
|
-
let p = r + d, l =
|
|
170
|
+
const { startPosition: s, sizes: n, indexBefore: a, indexAfter: o } = e, d = t === "horizontal" ? i.x - s.x : i.y - s.y, h = [...n], r = n[a], m = n[o];
|
|
171
|
+
let p = r + d, l = m - d;
|
|
158
172
|
if (p < this.options.minPanelSize) {
|
|
159
173
|
const c = this.options.minPanelSize - p;
|
|
160
174
|
p = this.options.minPanelSize, l -= c;
|
|
@@ -172,7 +186,7 @@ class P {
|
|
|
172
186
|
return this.options.minPanelSize;
|
|
173
187
|
}
|
|
174
188
|
}
|
|
175
|
-
const
|
|
189
|
+
const O = S(`:host {
|
|
176
190
|
display: block;
|
|
177
191
|
width: 100%;
|
|
178
192
|
height: 100%;
|
|
@@ -314,10 +328,10 @@ const L = S(`:host {
|
|
|
314
328
|
transition: none !important;
|
|
315
329
|
}
|
|
316
330
|
}`);
|
|
317
|
-
let
|
|
331
|
+
let L = 0;
|
|
318
332
|
class C extends A {
|
|
319
333
|
constructor() {
|
|
320
|
-
super(), this.container = null, this.panelWrappers = [], this.dividers = [], this.slotElement = null, this.mutationObserver = null, this.containerResizeObserver = null, this.unsubscribeState = null, this.instanceId = `mp-splitter-${++
|
|
334
|
+
super(), this.container = null, this.panelWrappers = [], this.dividers = [], this.slotElement = null, this.mutationObserver = null, this.containerResizeObserver = null, this.unsubscribeState = null, this.instanceId = `mp-splitter-${++L}`, this.dividerFocusRestore = new w(() => this.shadowRoot, {
|
|
321
335
|
selector: ".divider",
|
|
322
336
|
keyOf: (e) => e.dataset.key ?? null
|
|
323
337
|
}), this.stateManager = new R(), this.resizeManager = new P(), this.inputHandler = new y({
|
|
@@ -328,7 +342,7 @@ class C extends A {
|
|
|
328
342
|
});
|
|
329
343
|
}
|
|
330
344
|
static {
|
|
331
|
-
this.styles = [
|
|
345
|
+
this.styles = [O];
|
|
332
346
|
}
|
|
333
347
|
static get observedAttributes() {
|
|
334
348
|
return [
|
|
@@ -441,8 +455,8 @@ class C extends A {
|
|
|
441
455
|
this.dividers.forEach((a, o) => {
|
|
442
456
|
const d = i[o], h = i[o + 1];
|
|
443
457
|
if (d === void 0 || h === void 0) return;
|
|
444
|
-
const r = Math.round(d / s * 100),
|
|
445
|
-
a.setAttribute("aria-valuenow", String(r)), a.setAttribute("aria-valuemin", String(
|
|
458
|
+
const r = Math.round(d / s * 100), m = Math.round(n / s * 100), p = d + h, l = Math.round((p - n) / s * 100);
|
|
459
|
+
a.setAttribute("aria-valuenow", String(r)), a.setAttribute("aria-valuemin", String(m)), a.setAttribute("aria-valuemax", String(l));
|
|
446
460
|
const c = Math.round(h / s * 100);
|
|
447
461
|
a.setAttribute("aria-valuetext", r + "% / " + c + "%");
|
|
448
462
|
});
|
|
@@ -520,11 +534,11 @@ class C extends A {
|
|
|
520
534
|
(l, c) => l + c.getBoundingClientRect()[s],
|
|
521
535
|
0
|
|
522
536
|
), a = this.orientation === "horizontal" ? "marginLeft" : "marginTop", o = this.orientation === "horizontal" ? "marginRight" : "marginBottom", d = this.panelWrappers.reduce((l, c) => {
|
|
523
|
-
const
|
|
524
|
-
return l + parseFloat(
|
|
537
|
+
const z = getComputedStyle(c);
|
|
538
|
+
return l + parseFloat(z[a]) + parseFloat(z[o]);
|
|
525
539
|
}, 0), h = Math.max(0, t - n - d), r = e.reduce((l, c) => l + c, 0);
|
|
526
540
|
if (r <= 0 || Math.abs(h - r) < 1) return;
|
|
527
|
-
const
|
|
541
|
+
const m = h / r, p = e.map((l) => l * m);
|
|
528
542
|
this.applyPanelSizes(p), this.stateManager.setPanelSizes(p), this.updateDividerAriaValues();
|
|
529
543
|
}
|
|
530
544
|
updateContainerOrientation() {
|
|
@@ -601,20 +615,20 @@ class C extends A {
|
|
|
601
615
|
if (a === void 0 || o === void 0) return;
|
|
602
616
|
const d = this.container.getBoundingClientRect(), h = this.orientation === "horizontal" ? d.width : d.height;
|
|
603
617
|
if (h <= 0) return;
|
|
604
|
-
const r = this.resizeManager.getMinPanelSize(),
|
|
618
|
+
const r = this.resizeManager.getMinPanelSize(), m = this.orientation === "horizontal", p = m ? "ArrowRight" : "ArrowDown", l = m ? "ArrowLeft" : "ArrowUp";
|
|
605
619
|
let c = 0;
|
|
606
620
|
e === p ? c = 1 : e === l && (c = -1);
|
|
607
|
-
let
|
|
621
|
+
let z, v;
|
|
608
622
|
if (e === "Home")
|
|
609
|
-
|
|
623
|
+
z = r, v = a + o - r;
|
|
610
624
|
else if (e === "End")
|
|
611
|
-
|
|
625
|
+
z = a + o - r, v = r;
|
|
612
626
|
else if (c !== 0) {
|
|
613
627
|
const f = (i ? 1 : 10) / 100 * h * c;
|
|
614
|
-
|
|
628
|
+
z = a + f, v = o - f, z < r ? (z = r, v = a + o - r) : v < r && (v = r, z = a + o - r);
|
|
615
629
|
} else
|
|
616
630
|
return;
|
|
617
|
-
|
|
631
|
+
z === a && v === o || (n[t] = z, n[t + 1] = v, this.applyPanelSizes(n), this.stateManager.setPanelSizes(n), this.updateDividerAriaValues(), s.classList.add("active"), queueMicrotask(() => s.classList.remove("active")), this.dispatchEvent(
|
|
618
632
|
new CustomEvent("resize-end", {
|
|
619
633
|
bubbles: !0,
|
|
620
634
|
detail: { sizes: n, orientation: this.orientation }
|
|
@@ -636,5 +650,5 @@ export {
|
|
|
636
650
|
R as S,
|
|
637
651
|
b as a,
|
|
638
652
|
g as n,
|
|
639
|
-
|
|
653
|
+
O as s
|
|
640
654
|
};
|
package/code-snippet/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { unsafeCSS as
|
|
1
|
+
import { unsafeCSS as k, LitElement as x, nothing as c, html as h } from "lit";
|
|
2
2
|
import { property as s, state as u } from "lit/decorators.js";
|
|
3
3
|
import { unsafeHTML as L } from "lit/directives/unsafe-html.js";
|
|
4
4
|
import d from "highlight.js/lib/core";
|
|
5
|
-
const $ =
|
|
5
|
+
const $ = k(`@charset "UTF-8";
|
|
6
6
|
:host {
|
|
7
7
|
--mp-code-bg: light-dark(#fefefe, #2b2b2b);
|
|
8
8
|
--mp-code-fg: light-dark(#545454, #f8f8f2);
|
|
@@ -82,7 +82,7 @@ const $ = j(`@charset "UTF-8";
|
|
|
82
82
|
|
|
83
83
|
.hljs-strong {
|
|
84
84
|
font-weight: bold;
|
|
85
|
-
}`), C =
|
|
85
|
+
}`), C = k(`:host {
|
|
86
86
|
display: flex;
|
|
87
87
|
flex-direction: column;
|
|
88
88
|
position: relative;
|
|
@@ -287,7 +287,7 @@ function y(t) {
|
|
|
287
287
|
}
|
|
288
288
|
return e.push(n + "</span>".repeat(i.length)), e;
|
|
289
289
|
}
|
|
290
|
-
const
|
|
290
|
+
const j = {
|
|
291
291
|
atom: () => import("highlight.js/lib/languages/xml").then((t) => t.default),
|
|
292
292
|
bash: () => import("highlight.js/lib/languages/bash").then((t) => t.default),
|
|
293
293
|
c: () => import("highlight.js/lib/languages/c").then((t) => t.default),
|
|
@@ -322,7 +322,6 @@ const k = {
|
|
|
322
322
|
javascript: () => import("highlight.js/lib/languages/javascript").then((t) => t.default),
|
|
323
323
|
js: () => import("highlight.js/lib/languages/javascript").then((t) => t.default),
|
|
324
324
|
json: () => import("highlight.js/lib/languages/json").then((t) => t.default),
|
|
325
|
-
json5: () => import("highlight.js/lib/languages/json").then((t) => t.default),
|
|
326
325
|
jsonc: () => import("highlight.js/lib/languages/json").then((t) => t.default),
|
|
327
326
|
jsp: () => import("highlight.js/lib/languages/java").then((t) => t.default),
|
|
328
327
|
jsx: () => import("highlight.js/lib/languages/javascript").then((t) => t.default),
|
|
@@ -428,7 +427,6 @@ const k = {
|
|
|
428
427
|
javascript: "javascript",
|
|
429
428
|
js: "javascript",
|
|
430
429
|
json: "json",
|
|
431
|
-
json5: "json",
|
|
432
430
|
jsonc: "json",
|
|
433
431
|
jsp: "java",
|
|
434
432
|
jsx: "javascript",
|
|
@@ -499,7 +497,7 @@ const k = {
|
|
|
499
497
|
yaml: "yaml",
|
|
500
498
|
yml: "yaml",
|
|
501
499
|
zsh: "bash"
|
|
502
|
-
}, f = /* @__PURE__ */ new Map(), w = (t) => t in
|
|
500
|
+
}, f = /* @__PURE__ */ new Map(), w = (t) => t in j, b = (t) => d.getLanguage(t) != null;
|
|
503
501
|
function K(t, e) {
|
|
504
502
|
d.registerLanguage(t, e);
|
|
505
503
|
}
|
|
@@ -511,7 +509,7 @@ async function q(t) {
|
|
|
511
509
|
if (!w(t)) return "unknown-language";
|
|
512
510
|
const e = H[t];
|
|
513
511
|
let i = f.get(e);
|
|
514
|
-
return i || (i =
|
|
512
|
+
return i || (i = j[t]().then((n) => (b(e) || d.registerLanguage(e, n), !0)).catch(() => (f.delete(e), !1)), f.set(e, i)), await i ? "ready" : "load-failed";
|
|
515
513
|
}
|
|
516
514
|
let g = null;
|
|
517
515
|
function A() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LanguageFn } from 'highlight.js';
|
|
2
2
|
/** Every language id and alias `<mp-code-snippet>` can load on demand. */
|
|
3
|
-
export type HljsLanguageKey = 'atom' | 'bash' | 'c' | 'c#' | 'c++' | 'cc' | 'cjs' | 'console' | 'cpp' | 'cs' | 'csharp' | 'css' | 'cts' | 'cxx' | 'diff' | 'gemspec' | 'go' | 'golang' | 'gql' | 'graphql' | 'gyp' | 'h' | 'h++' | 'hh' | 'hpp' | 'html' | 'hxx' | 'ini' | 'ipython' | 'irb' | 'java' | 'javascript' | 'js' | 'json' | '
|
|
3
|
+
export type HljsLanguageKey = 'atom' | 'bash' | 'c' | 'c#' | 'c++' | 'cc' | 'cjs' | 'console' | 'cpp' | 'cs' | 'csharp' | 'css' | 'cts' | 'cxx' | 'diff' | 'gemspec' | 'go' | 'golang' | 'gql' | 'graphql' | 'gyp' | 'h' | 'h++' | 'hh' | 'hpp' | 'html' | 'hxx' | 'ini' | 'ipython' | 'irb' | 'java' | 'javascript' | 'js' | 'json' | 'jsonc' | 'jsp' | 'jsx' | 'kotlin' | 'kt' | 'kts' | 'less' | 'lua' | 'mak' | 'make' | 'makefile' | 'markdown' | 'md' | 'mjs' | 'mk' | 'mkd' | 'mkdown' | 'mm' | 'mts' | 'obj-c' | 'obj-c++' | 'objc' | 'objective-c++' | 'objectivec' | 'patch' | 'perl' | 'php' | 'php-template' | 'pl' | 'plaintext' | 'plist' | 'pluto' | 'pm' | 'podspec' | 'py' | 'pycon' | 'python' | 'python-repl' | 'r' | 'rb' | 'rs' | 'rss' | 'ruby' | 'rust' | 'scss' | 'sh' | 'shell' | 'shellsession' | 'sql' | 'svg' | 'swift' | 'text' | 'thor' | 'toml' | 'ts' | 'tsx' | 'txt' | 'typescript' | 'vb' | 'vbnet' | 'wasm' | 'wsf' | 'xhtml' | 'xjb' | 'xml' | 'xsd' | 'xsl' | 'yaml' | 'yml' | 'zsh';
|
|
4
4
|
/**
|
|
5
5
|
* One lazy loader per language id AND alias, so `language="tsx"` and
|
|
6
6
|
* `language="html"` resolve rather than falling through to auto-detect.
|