@mintplayer/web-components 2.16.0 → 2.17.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/accordion/index.mjs +5 -5
- package/calendar/index.mjs +1 -1
- package/carousel/index.mjs +57 -143
- package/charts/core/index.mjs +30 -20
- package/charts/core/src/attributes.d.ts +18 -0
- package/charts/core/src/index.d.ts +2 -0
- package/charts/core/src/view-window.d.ts +46 -0
- package/charts/hierarchy/index.mjs +245 -256
- package/charts/hierarchy/src/components/mp-hierarchy-chart.d.ts +1 -3
- package/charts/sparkline/index.mjs +27 -26
- package/charts/trend/index.mjs +21 -20
- package/checkbox/index.mjs +1 -1
- package/checkbox/src/components/mp-checkbox.d.ts +1 -0
- package/chunks/attributes-L3eKsbdy.mjs +16 -0
- package/chunks/color-mode-warning-71FmlzWX.mjs +13 -0
- package/chunks/{form-check.styles-B0pxJ6YC.mjs → form-check.styles-DqvBnspm.mjs} +24 -3
- package/chunks/{mp-calendar.element-CJ8-t-Zn.mjs → mp-calendar.element-BIHS9SZZ.mjs} +11 -6
- package/chunks/{mp-checkbox-CzwS7Y_t.mjs → mp-checkbox-zV83gILn.mjs} +44 -36
- package/chunks/{mp-datatable-B7st6G-I.mjs → mp-datatable-eRpl7-2V.mjs} +173 -173
- package/chunks/{mp-datetime-picker.element-DsWA1AFs.mjs → mp-datetime-picker.element-Cxu5-qRE.mjs} +29 -32
- package/chunks/{mp-pagination-Dea75mD4.mjs → mp-pagination-hGy4dL7p.mjs} +9 -4
- package/chunks/{mp-radio-cL46sUA0.mjs → mp-radio-BhRVNdKp.mjs} +32 -28
- package/chunks/{mp-select-BNrbPwN4.mjs → mp-select-CgqYFvUj.mjs} +41 -26
- package/chunks/{mp-splitter-Ckn1kN4v.mjs → mp-splitter-DLehrw3Y.mjs} +144 -120
- package/chunks/{mp-timepicker.element-CwaAAOcm.mjs → mp-timepicker.element-BiB9lkgc.mjs} +58 -45
- package/chunks/{mp-toggle-button-eo_aTQtu.mjs → mp-toggle-button-CaS9uYLE.mjs} +26 -24
- package/chunks/{mp-treeview-C8iltDbq.mjs → mp-treeview-CaMTDrvY.mjs} +51 -50
- package/chunks/{overlay-controller-DifgO6jT.mjs → overlay-controller-BHDagokg.mjs} +96 -92
- package/chunks/{id-DNZVAnGC.mjs → resource.service--lqLwEqk.mjs} +144 -206
- package/chunks/view-window-DGvFiDnW.mjs +263 -0
- package/code-snippet/index.mjs +70 -66
- package/code-snippet/src/hljs-loaders.generated.d.ts +1 -1
- package/custom-elements.json +65750 -0
- package/datatable/index.mjs +1 -1
- package/datatable/src/components/column-resize.d.ts +11 -0
- package/datatable/src/components/mp-datatable.d.ts +5 -0
- package/datepicker/index.mjs +10 -9
- package/datetime-picker/index.mjs +1 -1
- package/datetime-picker/src/mp-datetime-picker.element.d.ts +3 -0
- package/dock/index.mjs +430 -463
- package/dock/src/components/mint-dock-manager.element.d.ts +25 -2
- package/dock/src/core/resize.d.ts +60 -0
- package/dropdown-menu/index.mjs +4 -2
- package/dropdown-menu/src/components/mp-dropdown-menu.d.ts +6 -1
- package/dropdown-menu/src/index.d.ts +1 -1
- package/dropdown-menu/src/types/dropdown.d.ts +14 -1
- package/dropdown-menu/src/types/index.d.ts +1 -1
- package/file-manager/index.mjs +63 -61
- package/file-manager/src/components/mp-file-manager.d.ts +4 -3
- package/multi-range/index.mjs +56 -50
- package/multi-range/src/mint-multi-range.element.d.ts +4 -10
- package/multi-range/src/pointer-geometry.d.ts +31 -0
- package/navbar/index.mjs +89 -439
- package/overlay/index.mjs +1 -1
- package/overlay/src/overlay-controller.d.ts +0 -14
- package/overlay/src/placement.d.ts +48 -0
- package/package.json +7 -1
- package/pagination/index.mjs +1 -1
- package/phone-input/index.mjs +44 -40
- package/phone-input/src/components/stack.d.ts +8 -0
- package/query-builder/index.mjs +418 -466
- package/query-builder/src/dnd/drag-controller.d.ts +12 -8
- package/query-builder/src/mp-query-builder.element.d.ts +5 -1
- package/query-builder/src/mp-query-condition.element.d.ts +1 -0
- package/radio/index.mjs +1 -1
- package/radio-group/index.mjs +1 -1
- package/ribbon/index.mjs +477 -498
- package/ribbon/src/core/band-text-color.d.ts +10 -0
- package/ribbon/src/core/key-tip-allocator.d.ts +10 -0
- package/ribbon/src/core/plan-reduce-steps.d.ts +62 -0
- package/ribbon/src/mp-ribbon.element.d.ts +0 -27
- package/scheduler/index.mjs +726 -711
- package/scheduler/src/components/mp-scheduler.d.ts +19 -3
- package/scheduler/src/drag/drag-manager.d.ts +1 -9
- package/scheduler/src/input/input-handler.d.ts +12 -2
- package/scheduler/src/utils/geometry.d.ts +39 -0
- package/scheduler/src/views/timeline-view.d.ts +0 -1
- package/scheduler-core/index.mjs +84 -71
- package/scheduler-core/src/services/resource.service.d.ts +0 -12
- package/scheduler-core/src/services/timeline.service.d.ts +0 -9
- package/select/index.mjs +1 -1
- package/select/src/components/mp-select.d.ts +1 -0
- package/signature-pad/index.mjs +21 -23
- package/signature-pad/src/canvas-point.d.ts +26 -0
- package/signature-pad/src/mp-signature-pad.element.d.ts +1 -7
- package/splitter/index.mjs +1 -1
- package/splitter/src/components/mp-splitter.d.ts +16 -0
- package/splitter/src/managers/index.d.ts +1 -0
- package/splitter/src/managers/rescale-panel-sizes.d.ts +14 -0
- package/swiper-core/index.mjs +2 -2
- package/theming/bs-theme-preboot.js +1 -0
- package/theming/color-mode.css +36 -0
- package/theming/index.d.ts +1 -0
- package/theming/index.mjs +327 -0
- package/theming/src/components/mp-theme-toggle.d.ts +71 -0
- package/theming/src/cookie.d.ts +31 -0
- package/theming/src/index.d.ts +5 -0
- package/theming/src/preboot.d.ts +1 -0
- package/theming/src/resolve.d.ts +36 -0
- package/theming/src/store.d.ts +27 -0
- package/theming/src/styles/theme-toggle.styles.d.ts +2 -0
- package/theming/src/testing/fake-broadcast-channel.d.ts +35 -0
- package/theming/src/toggle-modes.d.ts +23 -0
- package/tile-manager/index.mjs +252 -211
- package/tile-manager/src/components/mint-tile-manager.element.d.ts +8 -0
- package/tile-manager/src/utils/grid-geometry.d.ts +49 -0
- package/timeline/index.mjs +156 -164
- package/timeline/src/components/mp-timeline.d.ts +41 -7
- package/timepicker/index.mjs +7 -4
- package/timepicker/src/mp-time-list.element.d.ts +26 -0
- package/timepicker/src/mp-timepicker.element.d.ts +3 -0
- package/toggle-button/index.mjs +1 -1
- package/tree-select/index.mjs +21 -9
- package/treeview/index.mjs +1 -1
- package/treeview/src/components/mp-treeview.d.ts +6 -4
- package/chunks/color-DIeST-IS.mjs +0 -224
- package/query-builder/src/mp-query-condition.element.template.d.ts +0 -2
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { unsafeCSS as
|
|
2
|
-
import { repeat as
|
|
1
|
+
import { unsafeCSS as C, LitElement as U, html as c, nothing as d, svg as z } from "lit";
|
|
2
|
+
import { repeat as g } from "lit/directives/repeat.js";
|
|
3
3
|
import { styleMap as v } from "lit/directives/style-map.js";
|
|
4
|
-
import { L as
|
|
5
|
-
import {
|
|
6
|
-
|
|
4
|
+
import { L as q } from "../../chunks/live-announcer-Bi0orG4n.mjs";
|
|
5
|
+
import { e as k, F as $, c as L, q as R, o as S, f as A, g as I, z as O, p as D, n as E, m as P, k as m, j as T, a as B, b as N, h as H, l as Z, s as G, i as X } from "../../chunks/view-window-DGvFiDnW.mjs";
|
|
6
|
+
import { b as F, n as b } from "../../chunks/attributes-L3eKsbdy.mjs";
|
|
7
|
+
const Y = C(`@charset "UTF-8";
|
|
7
8
|
:host {
|
|
8
9
|
/* Flex column so the optional breadcrumb takes its own row; without it the
|
|
9
10
|
chart is the only child and fills the host exactly as before. */
|
|
@@ -316,15 +317,15 @@ svg {
|
|
|
316
317
|
animation: none !important;
|
|
317
318
|
}
|
|
318
319
|
}`), u = 1e3, y = 2 * Math.PI;
|
|
319
|
-
function
|
|
320
|
+
function K() {
|
|
320
321
|
return typeof matchMedia < "u" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
321
322
|
}
|
|
322
|
-
class x extends
|
|
323
|
+
class x extends U {
|
|
323
324
|
constructor() {
|
|
324
|
-
super(...arguments), this._layout = "sunburst", this._maxDepth = void 0, this._minAngle = 0.2, this._minSize = 4, this._showLabels = !0, this._labelFontSize = 12, this._backdrop = "#ffffff", this._hostScale = 0.42, this._colorMin = 0, this._colorMax = 100, this._colorStart = "#fe0000", this._colorEnd = "#21b577", this._inputLabel = null, this._transitionDuration = 300, this._loadingIds = /* @__PURE__ */ new Set(), this._failedIds = /* @__PURE__ */ new Set(), this._loadedIds = /* @__PURE__ */ new Set(), this._loadingLabel = "Loading", this._fill =
|
|
325
|
+
super(...arguments), this._layout = "sunburst", this._maxDepth = void 0, this._minAngle = 0.2, this._minSize = 4, this._showLabels = !0, this._labelFontSize = 12, this._backdrop = "#ffffff", this._hostScale = 0.42, this._colorMin = 0, this._colorMax = 100, this._colorStart = "#fe0000", this._colorEnd = "#21b577", this._inputLabel = null, this._transitionDuration = 300, this._loadingIds = /* @__PURE__ */ new Set(), this._failedIds = /* @__PURE__ */ new Set(), this._loadedIds = /* @__PURE__ */ new Set(), this._loadingLabel = "Loading", this._fill = k(this._colorMin, this._colorMax, this._colorStart, this._colorEnd), this._prevSpans = /* @__PURE__ */ new Map(), this._tween = 1, this._tweenFrame = 0, this._hoveredId = null, this._focusedId = null, this._restoreFocus = !1, this._rendered = [], this._typeahead = "", this._typeaheadTimer = 0, this._zoomOutLabel = "Zoom out one level", this._metricUnitLabel = "%", this._valueUnitLabel = "", this.liveAnnouncer = new q(this, { omitRole: !0 }), this._showBreadcrumb = !1, this._breadcrumbLabel = "Chart path", this._gestures = /* @__PURE__ */ new Set(["wheel", "pinch"]), this._hintVisible = !1, this._hintTimer = 0, this._wheelListener = (e) => this.onWheel(e), this._view = $, this._pinchPointers = /* @__PURE__ */ new Map(), this._dragPointer = null, this._dragLast = { x: 0, y: 0 }, this._dragTotal = 0, this._dragMoved = !1, this._dismissedForId = null;
|
|
325
326
|
}
|
|
326
327
|
static {
|
|
327
|
-
this.styles = [
|
|
328
|
+
this.styles = [Y];
|
|
328
329
|
}
|
|
329
330
|
static get observedAttributes() {
|
|
330
331
|
return [
|
|
@@ -361,7 +362,7 @@ class x extends F {
|
|
|
361
362
|
return this._data;
|
|
362
363
|
}
|
|
363
364
|
set data(e) {
|
|
364
|
-
this._data = e, this._index = e ?
|
|
365
|
+
this._data = e, this._index = e ? L(e) : void 0, this.resetZoom();
|
|
365
366
|
}
|
|
366
367
|
get layout() {
|
|
367
368
|
return this._layout;
|
|
@@ -373,8 +374,8 @@ class x extends F {
|
|
|
373
374
|
return this._rootId;
|
|
374
375
|
}
|
|
375
376
|
set rootId(e) {
|
|
376
|
-
const
|
|
377
|
-
|
|
377
|
+
const i = e || void 0;
|
|
378
|
+
i !== this._rootId && (this.beginTween(), this._rootId = i, i === void 0 ? this.removeAttribute("root-id") : this.setAttribute("root-id", i), this.requestUpdate());
|
|
378
379
|
}
|
|
379
380
|
/**
|
|
380
381
|
* Levels rendered outward from the focus node, or `'auto'` for every loaded
|
|
@@ -401,7 +402,7 @@ class x extends F {
|
|
|
401
402
|
*/
|
|
402
403
|
get renderedDepth() {
|
|
403
404
|
const e = this.maxDepth;
|
|
404
|
-
return e !== "auto" ? e : this._index ? Math.max(1,
|
|
405
|
+
return e !== "auto" ? e : this._index ? Math.max(1, R(this._index, this._rootId)) : 1;
|
|
405
406
|
}
|
|
406
407
|
get minAngle() {
|
|
407
408
|
return this._minAngle;
|
|
@@ -507,81 +508,81 @@ class x extends F {
|
|
|
507
508
|
this._loadingLabel = e ?? "Loading";
|
|
508
509
|
}
|
|
509
510
|
rebuildScale() {
|
|
510
|
-
this._fill =
|
|
511
|
+
this._fill = k(this._colorMin, this._colorMax, this._colorStart, this._colorEnd), this.requestUpdate();
|
|
511
512
|
}
|
|
512
|
-
attributeChangedCallback(e,
|
|
513
|
-
switch (super.attributeChangedCallback(e,
|
|
513
|
+
attributeChangedCallback(e, i, t) {
|
|
514
|
+
switch (super.attributeChangedCallback(e, i, t), e) {
|
|
514
515
|
case "layout":
|
|
515
|
-
this.layout =
|
|
516
|
+
this.layout = t ?? "sunburst";
|
|
516
517
|
break;
|
|
517
518
|
case "root-id":
|
|
518
|
-
this.rootId =
|
|
519
|
+
this.rootId = t ?? void 0;
|
|
519
520
|
break;
|
|
520
521
|
case "max-depth":
|
|
521
|
-
|
|
522
|
+
t === null ? (this._maxDepth = void 0, this.requestUpdate()) : this.maxDepth = t === "auto" ? "auto" : Number(t);
|
|
522
523
|
break;
|
|
523
524
|
case "min-angle":
|
|
524
|
-
this.minAngle =
|
|
525
|
+
this.minAngle = b(t, 0.2);
|
|
525
526
|
break;
|
|
526
527
|
case "min-size":
|
|
527
|
-
this.minSize =
|
|
528
|
+
this.minSize = b(t, 4);
|
|
528
529
|
break;
|
|
529
530
|
case "show-labels":
|
|
530
|
-
this.showLabels =
|
|
531
|
+
this.showLabels = F(t, !0);
|
|
531
532
|
break;
|
|
532
533
|
case "label-font-size":
|
|
533
|
-
this.labelFontSize =
|
|
534
|
+
this.labelFontSize = b(t, 12);
|
|
534
535
|
break;
|
|
535
536
|
case "backdrop":
|
|
536
|
-
this.backdrop =
|
|
537
|
+
this.backdrop = t ?? void 0;
|
|
537
538
|
break;
|
|
538
539
|
case "color-min":
|
|
539
|
-
this.colorMin =
|
|
540
|
+
this.colorMin = b(t, 0);
|
|
540
541
|
break;
|
|
541
542
|
case "color-max":
|
|
542
|
-
this.colorMax =
|
|
543
|
+
this.colorMax = b(t, 100);
|
|
543
544
|
break;
|
|
544
545
|
case "color-start":
|
|
545
|
-
this.colorStart =
|
|
546
|
+
this.colorStart = t ?? "#fe0000";
|
|
546
547
|
break;
|
|
547
548
|
case "color-end":
|
|
548
|
-
this.colorEnd =
|
|
549
|
+
this.colorEnd = t ?? "#21b577";
|
|
549
550
|
break;
|
|
550
551
|
case "transition-duration":
|
|
551
|
-
this.transitionDuration =
|
|
552
|
+
this.transitionDuration = b(t, 300);
|
|
552
553
|
break;
|
|
553
554
|
case "locale":
|
|
554
|
-
this.locale =
|
|
555
|
+
this.locale = t ?? void 0;
|
|
555
556
|
break;
|
|
556
557
|
case "zoom-gestures":
|
|
557
|
-
this.zoomGestures =
|
|
558
|
+
this.zoomGestures = t ?? "wheel pinch";
|
|
558
559
|
break;
|
|
559
560
|
case "zoom-hint-label":
|
|
560
|
-
this._zoomHintLabel =
|
|
561
|
+
this._zoomHintLabel = t ?? void 0;
|
|
561
562
|
break;
|
|
562
563
|
case "show-breadcrumb":
|
|
563
|
-
this.showBreadcrumb =
|
|
564
|
+
this.showBreadcrumb = F(t, !1);
|
|
564
565
|
break;
|
|
565
566
|
case "breadcrumb-label":
|
|
566
|
-
this._breadcrumbLabel =
|
|
567
|
+
this._breadcrumbLabel = t ?? "Chart path", this.requestUpdate();
|
|
567
568
|
break;
|
|
568
569
|
case "zoom-out-label":
|
|
569
|
-
this._zoomOutLabel =
|
|
570
|
+
this._zoomOutLabel = t ?? "Zoom out one level", this.requestUpdate();
|
|
570
571
|
break;
|
|
571
572
|
case "loading-label":
|
|
572
|
-
this._loadingLabel =
|
|
573
|
+
this._loadingLabel = t ?? "Loading";
|
|
573
574
|
break;
|
|
574
575
|
case "metric-unit-label":
|
|
575
|
-
this._metricUnitLabel =
|
|
576
|
+
this._metricUnitLabel = t ?? "%", this.requestUpdate();
|
|
576
577
|
break;
|
|
577
578
|
case "value-unit-label":
|
|
578
|
-
this._valueUnitLabel =
|
|
579
|
+
this._valueUnitLabel = t ?? "", this.requestUpdate();
|
|
579
580
|
break;
|
|
580
581
|
case "aria-label":
|
|
581
582
|
this.requestUpdate();
|
|
582
583
|
break;
|
|
583
584
|
case "input-label":
|
|
584
|
-
this.inputLabel =
|
|
585
|
+
this.inputLabel = t;
|
|
585
586
|
break;
|
|
586
587
|
}
|
|
587
588
|
}
|
|
@@ -622,15 +623,15 @@ class x extends F {
|
|
|
622
623
|
}
|
|
623
624
|
/** The node the chart is rooted on right now (tree root when root-id is unset). */
|
|
624
625
|
get focusedRoot() {
|
|
625
|
-
return this._index ?
|
|
626
|
+
return this._index ? S(this._index, this._rootId) : void 0;
|
|
626
627
|
}
|
|
627
628
|
/* ---------- rendered size + backdrop (label contrast inputs) ---------- */
|
|
628
629
|
connectedCallback() {
|
|
629
630
|
super.connectedCallback(), this.addEventListener("wheel", this._wheelListener, { passive: !1 }), typeof ResizeObserver < "u" && (this._resizeObserver = new ResizeObserver((e) => {
|
|
630
|
-
const
|
|
631
|
-
if (!
|
|
632
|
-
const
|
|
633
|
-
Math.abs(
|
|
631
|
+
const i = e[e.length - 1]?.contentRect.width;
|
|
632
|
+
if (!i) return;
|
|
633
|
+
const t = i / u;
|
|
634
|
+
Math.abs(t - this._hostScale) > 1e-3 && (this._hostScale = t, this.requestUpdate());
|
|
634
635
|
}), this._resizeObserver.observe(this));
|
|
635
636
|
}
|
|
636
637
|
disconnectedCallback() {
|
|
@@ -652,31 +653,31 @@ class x extends F {
|
|
|
652
653
|
if (typeof getComputedStyle != "function") return;
|
|
653
654
|
let e = this;
|
|
654
655
|
for (; e; ) {
|
|
655
|
-
const
|
|
656
|
-
if (
|
|
657
|
-
this._backdrop =
|
|
656
|
+
const i = getComputedStyle(e).backgroundColor;
|
|
657
|
+
if (j(i)) {
|
|
658
|
+
this._backdrop = i;
|
|
658
659
|
return;
|
|
659
660
|
}
|
|
660
|
-
const
|
|
661
|
-
e = e.parentElement ?? (
|
|
661
|
+
const t = e.getRootNode();
|
|
662
|
+
e = e.parentElement ?? (t instanceof ShadowRoot ? t.host : null);
|
|
662
663
|
}
|
|
663
664
|
}
|
|
664
665
|
/** Which token bucket a label over this node should use: the surface's tone. */
|
|
665
|
-
surfaceToneOf(e,
|
|
666
|
-
const
|
|
666
|
+
surfaceToneOf(e, i) {
|
|
667
|
+
const t = this.fillOf(e), r = t ? A(t, this._backdrop, i) : void 0;
|
|
667
668
|
return this.toneOfSurface(r);
|
|
668
669
|
}
|
|
669
670
|
toneOfSurface(e) {
|
|
670
|
-
return ((e !== void 0 ?
|
|
671
|
+
return ((e !== void 0 ? I(e) : void 0) ?? I(this._backdrop) ?? "dark") === "dark" ? "light" : "dark";
|
|
671
672
|
}
|
|
672
673
|
/** Space-separated gesture allowlist: 'wheel pinch' (default) | 'wheel' | 'pinch' | 'none'. */
|
|
673
674
|
get zoomGestures() {
|
|
674
675
|
return this._gestures.size ? [...this._gestures].join(" ") : "none";
|
|
675
676
|
}
|
|
676
677
|
set zoomGestures(e) {
|
|
677
|
-
const
|
|
678
|
+
const i = (e ?? "").toLowerCase().split(/\s+/);
|
|
678
679
|
this._gestures = new Set(
|
|
679
|
-
|
|
680
|
+
i.filter((t) => t === "wheel" || t === "pinch")
|
|
680
681
|
);
|
|
681
682
|
}
|
|
682
683
|
get zoomHintLabel() {
|
|
@@ -690,41 +691,32 @@ class x extends F {
|
|
|
690
691
|
}
|
|
691
692
|
/** Current geometric magnification (1 = fitted). Read-only state for consumers/tests. */
|
|
692
693
|
get zoomLevel() {
|
|
693
|
-
return this.
|
|
694
|
+
return this._view.zoom;
|
|
694
695
|
}
|
|
695
696
|
/** Programmatic geometric zoom, anchored at chart fractions (default: center). */
|
|
696
|
-
setZoomLevel(e,
|
|
697
|
-
|
|
698
|
-
this._viewZoom = r, this._viewX = g(s - t / r, r), this._viewY = g(a - i / r, r), this.requestUpdate();
|
|
697
|
+
setZoomLevel(e, i = 0.5, t = 0.5) {
|
|
698
|
+
this._view = O(this._view, e, i, t, x.MAX_ZOOM), this.requestUpdate();
|
|
699
699
|
}
|
|
700
700
|
resetZoom() {
|
|
701
|
-
this.
|
|
701
|
+
this._view = $, this.requestUpdate();
|
|
702
702
|
}
|
|
703
703
|
/** Pan by chart-screen fractions (drag / two-finger move). */
|
|
704
|
-
panBy(e,
|
|
705
|
-
|
|
704
|
+
panBy(e, i) {
|
|
705
|
+
const t = D(this._view, e, i);
|
|
706
|
+
t !== this._view && (this._view = t, this.requestUpdate());
|
|
706
707
|
}
|
|
707
708
|
/** Map a normalized content rect through the view window to chart fractions. */
|
|
708
|
-
viewRect(e,
|
|
709
|
-
|
|
710
|
-
return {
|
|
711
|
-
x0: (e - this._viewX) * s,
|
|
712
|
-
y0: (t - this._viewY) * s,
|
|
713
|
-
x1: (i - this._viewX) * s,
|
|
714
|
-
y1: (r - this._viewY) * s
|
|
715
|
-
};
|
|
709
|
+
viewRect(e, i, t, r) {
|
|
710
|
+
return E(this._view, e, i, t, r);
|
|
716
711
|
}
|
|
717
712
|
/** Pointer position as chart fractions, for anchor-at-cursor zooming. */
|
|
718
713
|
chartAnchor(e) {
|
|
719
|
-
const
|
|
720
|
-
return
|
|
721
|
-
x: Math.min(1, Math.max(0, (e.clientX - t.left) / t.width)),
|
|
722
|
-
y: Math.min(1, Math.max(0, (e.clientY - t.top) / t.height))
|
|
723
|
-
};
|
|
714
|
+
const i = this.shadowRoot?.querySelector(".chart")?.getBoundingClientRect();
|
|
715
|
+
return P(i, e.clientX, e.clientY);
|
|
724
716
|
}
|
|
725
717
|
/** Device px per normalized content unit — the label fit tests' scale. */
|
|
726
718
|
get effectiveScale() {
|
|
727
|
-
return this._hostScale * this.
|
|
719
|
+
return this._hostScale * this._view.zoom;
|
|
728
720
|
}
|
|
729
721
|
onWheel(e) {
|
|
730
722
|
if (!this._gestures.has("wheel") || !this._index) return;
|
|
@@ -733,16 +725,16 @@ class x extends F {
|
|
|
733
725
|
return;
|
|
734
726
|
}
|
|
735
727
|
e.preventDefault();
|
|
736
|
-
const
|
|
737
|
-
this.setZoomLevel(this.
|
|
728
|
+
const i = e.deltaMode === 1 ? 16 : e.deltaMode === 2 ? this.clientHeight || 400 : 1, t = Math.max(-100, Math.min(100, e.deltaY * i)), r = this.chartAnchor(e);
|
|
729
|
+
this.setZoomLevel(this._view.zoom * Math.exp(-t * 5e-3), r.x, r.y);
|
|
738
730
|
}
|
|
739
731
|
pinchDistance() {
|
|
740
|
-
const [e,
|
|
741
|
-
return Math.hypot(
|
|
732
|
+
const [e, i] = [...this._pinchPointers.values()];
|
|
733
|
+
return Math.hypot(i.x - e.x, i.y - e.y);
|
|
742
734
|
}
|
|
743
735
|
pinchMidpoint() {
|
|
744
|
-
const [e,
|
|
745
|
-
return { x: (e.x +
|
|
736
|
+
const [e, i] = [...this._pinchPointers.values()];
|
|
737
|
+
return { x: (e.x + i.x) / 2, y: (e.y + i.y) / 2 };
|
|
746
738
|
}
|
|
747
739
|
onPointerDown(e) {
|
|
748
740
|
if (e.pointerType === "touch") {
|
|
@@ -750,27 +742,27 @@ class x extends F {
|
|
|
750
742
|
this._pinchPointers.set(e.pointerId, { x: e.clientX, y: e.clientY });
|
|
751
743
|
return;
|
|
752
744
|
}
|
|
753
|
-
this.
|
|
745
|
+
this._view.zoom > 1 && e.button === 0 && (this._dragPointer = e.pointerId, this._dragLast = { x: e.clientX, y: e.clientY }, this._dragTotal = 0, this._dragMoved = !1);
|
|
754
746
|
}
|
|
755
747
|
/** @returns true when the move belonged to a pinch or drag (skip hover handling). */
|
|
756
748
|
trackViewGesture(e) {
|
|
757
749
|
if (e.pointerType === "touch" && this._pinchPointers.has(e.pointerId)) {
|
|
758
750
|
if (this._pinchPointers.size !== 2)
|
|
759
751
|
return this._pinchPointers.set(e.pointerId, { x: e.clientX, y: e.clientY }), !1;
|
|
760
|
-
const
|
|
761
|
-
if (this._pinchPointers.set(e.pointerId, { x: e.clientX, y: e.clientY }),
|
|
762
|
-
const r = this.pinchMidpoint(),
|
|
763
|
-
this.setZoomLevel(this.
|
|
752
|
+
const i = this.pinchDistance(), t = this.pinchMidpoint();
|
|
753
|
+
if (this._pinchPointers.set(e.pointerId, { x: e.clientX, y: e.clientY }), i > 0) {
|
|
754
|
+
const r = this.pinchMidpoint(), o = this.chartAnchor({ clientX: r.x, clientY: r.y });
|
|
755
|
+
this.setZoomLevel(this._view.zoom * (this.pinchDistance() / i), o.x, o.y);
|
|
764
756
|
const a = this.shadowRoot?.querySelector(".chart")?.getBoundingClientRect();
|
|
765
|
-
a?.width && a.height && this.panBy((r.x -
|
|
757
|
+
a?.width && a.height && this.panBy((r.x - t.x) / a.width, (r.y - t.y) / a.height);
|
|
766
758
|
}
|
|
767
759
|
return !0;
|
|
768
760
|
}
|
|
769
761
|
if (this._dragPointer === e.pointerId) {
|
|
770
|
-
const
|
|
771
|
-
this._dragLast = { x: e.clientX, y: e.clientY }, this._dragTotal += Math.abs(
|
|
762
|
+
const i = e.clientX - this._dragLast.x, t = e.clientY - this._dragLast.y;
|
|
763
|
+
this._dragLast = { x: e.clientX, y: e.clientY }, this._dragTotal += Math.abs(i) + Math.abs(t), this._dragTotal > 3 && (this._dragMoved = !0);
|
|
772
764
|
const r = this.shadowRoot?.querySelector(".chart")?.getBoundingClientRect();
|
|
773
|
-
return r?.width && r.height && this.panBy(
|
|
765
|
+
return r?.width && r.height && this.panBy(i / r.width, t / r.height), !0;
|
|
774
766
|
}
|
|
775
767
|
return !1;
|
|
776
768
|
}
|
|
@@ -786,57 +778,57 @@ class x extends F {
|
|
|
786
778
|
/* ---------- zoom ---------- */
|
|
787
779
|
/** Re-root on a node id (undefined = tree root) and emit `hierarchy-zoom`. */
|
|
788
780
|
zoomTo(e) {
|
|
789
|
-
const
|
|
790
|
-
if (!
|
|
791
|
-
const
|
|
792
|
-
|
|
781
|
+
const i = this._index;
|
|
782
|
+
if (!i) return;
|
|
783
|
+
const t = S(i, e);
|
|
784
|
+
t !== this.focusedRoot && (this.resetZoom(), this.rootId = t === i.root ? void 0 : t.id, this.liveAnnouncer.announce(this.labelText(t)), this.emit("hierarchy-zoom", { node: t, path: m(i, t) }));
|
|
793
785
|
}
|
|
794
786
|
/** Move the roving tabindex (and DOM focus) to a rendered node. */
|
|
795
787
|
focusNode(e) {
|
|
796
|
-
this._rendered.some((
|
|
788
|
+
this._rendered.some((i) => i.id === e) && (this._focusedId = e, this._restoreFocus = !0, this.requestUpdate());
|
|
797
789
|
}
|
|
798
790
|
zoomOut() {
|
|
799
|
-
const e = this._index,
|
|
800
|
-
!e || !
|
|
791
|
+
const e = this._index, i = this.focusedRoot;
|
|
792
|
+
!e || !i || i === e.root || this.zoomTo(e.parents.get(i.id)?.id);
|
|
801
793
|
}
|
|
802
794
|
/* ---------- sunburst tween ---------- */
|
|
803
795
|
beginTween() {
|
|
804
|
-
if (this._transitionDuration <= 0 ||
|
|
796
|
+
if (this._transitionDuration <= 0 || K() || this._layout !== "sunburst" || !this._prevSpans.size) return;
|
|
805
797
|
cancelAnimationFrame(this._tweenFrame);
|
|
806
|
-
const e = performance.now(),
|
|
807
|
-
this._tween = Math.min(1, (
|
|
798
|
+
const e = performance.now(), i = (t) => {
|
|
799
|
+
this._tween = Math.min(1, (t - e) / this._transitionDuration), this.requestUpdate(), this._tween < 1 && (this._tweenFrame = requestAnimationFrame(i));
|
|
808
800
|
};
|
|
809
|
-
this._tween = 0, this._tweenFrame = requestAnimationFrame(
|
|
801
|
+
this._tween = 0, this._tweenFrame = requestAnimationFrame(i);
|
|
810
802
|
}
|
|
811
803
|
tweenedSpan(e) {
|
|
812
804
|
if (this._tween >= 1) return e;
|
|
813
|
-
const
|
|
805
|
+
const i = 1 - (1 - this._tween) * (1 - this._tween), t = this._prevSpans.get(e.node.id) ?? { x0: e.x0, x1: e.x0 };
|
|
814
806
|
return {
|
|
815
|
-
x0:
|
|
816
|
-
x1:
|
|
807
|
+
x0: t.x0 + (e.x0 - t.x0) * i,
|
|
808
|
+
x1: t.x1 + (e.x1 - t.x1) * i
|
|
817
809
|
};
|
|
818
810
|
}
|
|
819
811
|
/* ---------- pointer interaction ---------- */
|
|
820
812
|
nodeFromEvent(e) {
|
|
821
|
-
const
|
|
822
|
-
return
|
|
813
|
+
const t = e.composedPath()[0]?.closest?.("[data-id]")?.getAttribute("data-id");
|
|
814
|
+
return t ? this._index?.byId.get(t) : void 0;
|
|
823
815
|
}
|
|
824
816
|
onClick(e) {
|
|
825
817
|
if (this._dragMoved) {
|
|
826
818
|
this._dragMoved = !1;
|
|
827
819
|
return;
|
|
828
820
|
}
|
|
829
|
-
const
|
|
830
|
-
if (!(!
|
|
831
|
-
if (
|
|
821
|
+
const i = this._index, t = this.nodeFromEvent(e);
|
|
822
|
+
if (!(!i || !t)) {
|
|
823
|
+
if (t === this.focusedRoot) {
|
|
832
824
|
this.zoomOut();
|
|
833
825
|
return;
|
|
834
826
|
}
|
|
835
|
-
if (this._failedIds.delete(
|
|
836
|
-
this.zoomTo(
|
|
827
|
+
if (this._failedIds.delete(t.id), this._loadedIds.delete(t.id), t.children?.length || t.hasChildren && this._loadChildren) {
|
|
828
|
+
this.zoomTo(t.id);
|
|
837
829
|
return;
|
|
838
830
|
}
|
|
839
|
-
this.emit("hierarchy-node-select", { node:
|
|
831
|
+
this.emit("hierarchy-node-select", { node: t, path: m(i, t) });
|
|
840
832
|
}
|
|
841
833
|
}
|
|
842
834
|
get tooltipEl() {
|
|
@@ -846,57 +838,57 @@ class x extends F {
|
|
|
846
838
|
return this.tooltipEl?.hasAttribute("data-visible") ?? !1;
|
|
847
839
|
}
|
|
848
840
|
/** Show the tooltip for a node at chart-relative coordinates, clamped inside the chart. */
|
|
849
|
-
showTooltip(e,
|
|
850
|
-
const r = this.tooltipEl,
|
|
851
|
-
if (!r || !
|
|
841
|
+
showTooltip(e, i, t) {
|
|
842
|
+
const r = this.tooltipEl, o = this.shadowRoot?.querySelector(".chart");
|
|
843
|
+
if (!r || !o) return;
|
|
852
844
|
r.textContent = this.tooltipText(e), r.setAttribute("data-visible", "");
|
|
853
|
-
const a = r.offsetWidth,
|
|
854
|
-
r.style.left = `${Math.max(0, Math.min(
|
|
845
|
+
const a = r.offsetWidth, s = r.offsetHeight;
|
|
846
|
+
r.style.left = `${Math.max(0, Math.min(i + 12, o.clientWidth - a))}px`, r.style.top = `${Math.max(0, Math.min(t + 12, o.clientHeight - s))}px`;
|
|
855
847
|
}
|
|
856
848
|
hideTooltip() {
|
|
857
849
|
this.tooltipEl?.removeAttribute("data-visible");
|
|
858
850
|
}
|
|
859
851
|
onPointerMove(e) {
|
|
860
|
-
const
|
|
861
|
-
if (!
|
|
862
|
-
const
|
|
863
|
-
if (!
|
|
852
|
+
const i = this._index;
|
|
853
|
+
if (!i || this.trackViewGesture(e)) return;
|
|
854
|
+
const t = this.nodeFromEvent(e);
|
|
855
|
+
if (!t || t === this.focusedRoot) {
|
|
864
856
|
this.clearHover();
|
|
865
857
|
return;
|
|
866
858
|
}
|
|
867
|
-
if (
|
|
859
|
+
if (t.id !== this._dismissedForId) {
|
|
868
860
|
this._dismissedForId = null;
|
|
869
861
|
const r = this.shadowRoot?.querySelector(".chart")?.getBoundingClientRect();
|
|
870
|
-
r && this.showTooltip(
|
|
862
|
+
r && this.showTooltip(t, e.clientX - r.left, e.clientY - r.top);
|
|
871
863
|
}
|
|
872
|
-
this._hoveredId !==
|
|
864
|
+
this._hoveredId !== t.id && (this._hoveredId = t.id, this.emit("hierarchy-node-hover", { node: t, path: m(i, t) }));
|
|
873
865
|
}
|
|
874
866
|
clearHover() {
|
|
875
867
|
this.hideTooltip(), this._dismissedForId = null, this._hoveredId !== null && (this._hoveredId = null, this.emit("hierarchy-node-hover", { node: null, path: [] }));
|
|
876
868
|
}
|
|
877
869
|
/** Keyboard parity for the hover tooltip (1.4.13): show on focus, hide on blur. */
|
|
878
870
|
onFocusIn(e) {
|
|
879
|
-
const
|
|
871
|
+
const i = e.composedPath()[0]?.closest?.('[role="treeitem"][data-id]'), t = i?.getAttribute("data-id"), r = t ? this._index?.byId.get(t) : void 0;
|
|
880
872
|
if (!r || r === this.focusedRoot || r.id === this._dismissedForId) return;
|
|
881
873
|
this._dismissedForId = null;
|
|
882
|
-
const
|
|
883
|
-
!
|
|
874
|
+
const o = this.shadowRoot?.querySelector(".chart")?.getBoundingClientRect(), a = i?.getBoundingClientRect();
|
|
875
|
+
!o || !a || this.showTooltip(
|
|
884
876
|
r,
|
|
885
|
-
a.left -
|
|
886
|
-
a.top -
|
|
877
|
+
a.left - o.left + a.width / 2,
|
|
878
|
+
a.top - o.top + a.height / 2
|
|
887
879
|
);
|
|
888
880
|
}
|
|
889
881
|
onFocusOut() {
|
|
890
882
|
this.hideTooltip();
|
|
891
883
|
}
|
|
892
884
|
tooltipText(e) {
|
|
893
|
-
const
|
|
894
|
-
if (
|
|
895
|
-
const
|
|
885
|
+
const i = this._tooltipFormatter?.(e);
|
|
886
|
+
if (i !== void 0) return i;
|
|
887
|
+
const t = new Intl.NumberFormat(this._locale || this.closest("[lang]")?.getAttribute("lang") || void 0), r = this._index?.colorValues.get(e.id), o = this._index?.values.get(e.id);
|
|
896
888
|
return [
|
|
897
889
|
e.name,
|
|
898
|
-
r !== void 0 ? `${
|
|
899
|
-
|
|
890
|
+
r !== void 0 ? `${t.format(Math.round(r * 10) / 10)}%` : void 0,
|
|
891
|
+
o !== void 0 && o > 0 ? t.format(o) : void 0
|
|
900
892
|
].filter((a) => a !== void 0).join(" — ");
|
|
901
893
|
}
|
|
902
894
|
labelText(e) {
|
|
@@ -904,46 +896,46 @@ class x extends F {
|
|
|
904
896
|
}
|
|
905
897
|
/** Localized per-node accessible name: "components, 82%, 1,234 lines". */
|
|
906
898
|
accessibleName(e) {
|
|
907
|
-
const
|
|
899
|
+
const i = new Intl.NumberFormat(this._locale || this.closest("[lang]")?.getAttribute("lang") || void 0), t = this._index?.colorValues.get(e.id), r = this._index?.values.get(e.id);
|
|
908
900
|
return [
|
|
909
901
|
this.labelText(e),
|
|
910
|
-
|
|
911
|
-
r !== void 0 && r > 0 ? `${
|
|
912
|
-
].filter((
|
|
902
|
+
t !== void 0 ? `${i.format(Math.round(t * 10) / 10)}${this._metricUnitLabel}` : void 0,
|
|
903
|
+
r !== void 0 && r > 0 ? `${i.format(r)}${this._valueUnitLabel ? ` ${this._valueUnitLabel}` : ""}` : void 0
|
|
904
|
+
].filter((o) => o !== void 0).join(", ");
|
|
913
905
|
}
|
|
914
|
-
emit(e,
|
|
915
|
-
this.dispatchEvent(new CustomEvent(e, { detail:
|
|
906
|
+
emit(e, i) {
|
|
907
|
+
this.dispatchEvent(new CustomEvent(e, { detail: i, bubbles: !0, composed: !0 }));
|
|
916
908
|
}
|
|
917
909
|
/* ---------- keyboard (APG tree, adapted: siblings wrap, Down = outward) ---------- */
|
|
918
910
|
onKeyDown(e) {
|
|
919
|
-
const
|
|
920
|
-
if (!
|
|
921
|
-
const
|
|
911
|
+
const i = this._index, r = e.composedPath()[0]?.closest?.('[role="treeitem"][data-id]')?.getAttribute("data-id");
|
|
912
|
+
if (!i || !r) return;
|
|
913
|
+
const o = (h) => {
|
|
922
914
|
h !== void 0 && (this._focusedId = h, this._restoreFocus = !0, this.requestUpdate());
|
|
923
|
-
}, a = this._rendered.find((h) => h.id === r),
|
|
915
|
+
}, a = this._rendered.find((h) => h.id === r), s = this._rendered.filter((h) => h.parentId === a?.parentId), n = s.findIndex((h) => h.id === r);
|
|
924
916
|
switch (e.key) {
|
|
925
917
|
case "ArrowRight":
|
|
926
|
-
s
|
|
918
|
+
o(s[(n + 1) % s.length]?.id);
|
|
927
919
|
break;
|
|
928
920
|
case "ArrowLeft":
|
|
929
|
-
s
|
|
921
|
+
o(s[(n - 1 + s.length) % s.length]?.id);
|
|
930
922
|
break;
|
|
931
923
|
case "ArrowDown":
|
|
932
|
-
|
|
924
|
+
o(this._rendered.find((h) => h.parentId === r)?.id);
|
|
933
925
|
break;
|
|
934
926
|
case "ArrowUp":
|
|
935
|
-
|
|
927
|
+
o(this._rendered.some((h) => h.id === a?.parentId) ? a?.parentId ?? void 0 : void 0);
|
|
936
928
|
break;
|
|
937
929
|
case "Home":
|
|
938
|
-
s
|
|
930
|
+
o(s[0]?.id);
|
|
939
931
|
break;
|
|
940
932
|
case "End":
|
|
941
|
-
s
|
|
933
|
+
o(s[s.length - 1]?.id);
|
|
942
934
|
break;
|
|
943
935
|
case "Enter": {
|
|
944
|
-
const h =
|
|
936
|
+
const h = i.byId.get(r);
|
|
945
937
|
if (!h) return;
|
|
946
|
-
this._failedIds.delete(h.id), this._loadedIds.delete(h.id), h === this.focusedRoot ? this.zoomOut() : h.children?.length || h.hasChildren && this._loadChildren ? this.zoomTo(h.id) : this.emit("hierarchy-node-select", { node: h, path: m(
|
|
938
|
+
this._failedIds.delete(h.id), this._loadedIds.delete(h.id), h === this.focusedRoot ? this.zoomOut() : h.children?.length || h.hasChildren && this._loadChildren ? this.zoomTo(h.id) : this.emit("hierarchy-node-select", { node: h, path: m(i, h) });
|
|
947
939
|
break;
|
|
948
940
|
}
|
|
949
941
|
case "Escape":
|
|
@@ -951,7 +943,7 @@ class x extends F {
|
|
|
951
943
|
this.hideTooltip(), this._dismissedForId = r;
|
|
952
944
|
break;
|
|
953
945
|
}
|
|
954
|
-
if (this.
|
|
946
|
+
if (this._view.zoom > 1) {
|
|
955
947
|
this.resetZoom();
|
|
956
948
|
break;
|
|
957
949
|
}
|
|
@@ -966,11 +958,11 @@ class x extends F {
|
|
|
966
958
|
// anchored on the focused node so it stays in view.
|
|
967
959
|
case "+":
|
|
968
960
|
case "=":
|
|
969
|
-
this.zoomKeyboard(r, this.
|
|
961
|
+
this.zoomKeyboard(r, this._view.zoom * 1.5);
|
|
970
962
|
break;
|
|
971
963
|
case "-":
|
|
972
964
|
case "_":
|
|
973
|
-
this.zoomKeyboard(r, this.
|
|
965
|
+
this.zoomKeyboard(r, this._view.zoom / 1.5);
|
|
974
966
|
break;
|
|
975
967
|
case "0":
|
|
976
968
|
this.resetZoom();
|
|
@@ -982,20 +974,20 @@ class x extends F {
|
|
|
982
974
|
e.preventDefault(), e.stopPropagation();
|
|
983
975
|
}
|
|
984
976
|
/** Zoom anchored on a node's on-screen center (falls back to the chart center). */
|
|
985
|
-
zoomKeyboard(e,
|
|
986
|
-
const
|
|
987
|
-
this.setZoomLevel(
|
|
977
|
+
zoomKeyboard(e, i) {
|
|
978
|
+
const t = this.shadowRoot?.querySelector(`[role="treeitem"][data-id="${M(e)}"]`), r = this.shadowRoot?.querySelector(".chart")?.getBoundingClientRect(), o = t?.getBoundingClientRect(), a = r?.width && o?.width ? this.chartAnchor({ clientX: o.left + o.width / 2, clientY: o.top + o.height / 2 }) : { x: 0.5, y: 0.5 };
|
|
979
|
+
this.setZoomLevel(i, a.x, a.y);
|
|
988
980
|
}
|
|
989
|
-
handleTypeahead(e,
|
|
981
|
+
handleTypeahead(e, i) {
|
|
990
982
|
if (e.key.length !== 1 || e.ctrlKey || e.metaKey || e.altKey) return;
|
|
991
983
|
clearTimeout(this._typeaheadTimer), this._typeahead += e.key.toLowerCase(), this._typeaheadTimer = setTimeout(() => this._typeahead = "", 500);
|
|
992
|
-
const
|
|
993
|
-
if (!
|
|
994
|
-
const r = this._rendered,
|
|
995
|
-
const h =
|
|
984
|
+
const t = this._index;
|
|
985
|
+
if (!t) return;
|
|
986
|
+
const r = this._rendered, o = r.findIndex((n) => n.id === i), s = [...r.slice(o + 1), ...r.slice(0, o + 1)].find((n) => {
|
|
987
|
+
const h = t.byId.get(n.id);
|
|
996
988
|
return h ? this.labelText(h).toLowerCase().startsWith(this._typeahead) : !1;
|
|
997
989
|
});
|
|
998
|
-
|
|
990
|
+
s && (this._focusedId = s.id, this._restoreFocus = !0, this.requestUpdate(), e.preventDefault());
|
|
999
991
|
}
|
|
1000
992
|
/**
|
|
1001
993
|
* Roving tabindex target for this render: the focused node while it is
|
|
@@ -1003,9 +995,9 @@ class x extends F {
|
|
|
1003
995
|
* zoom announce that caused the window to change).
|
|
1004
996
|
*/
|
|
1005
997
|
resolveTabFocus() {
|
|
1006
|
-
if (!(this._focusedId && this._rendered.some((
|
|
1007
|
-
const
|
|
1008
|
-
this._focusedId =
|
|
998
|
+
if (!(this._focusedId && this._rendered.some((i) => i.id === this._focusedId))) {
|
|
999
|
+
const i = this._rendered[0]?.id, t = !!this.shadowRoot?.activeElement;
|
|
1000
|
+
this._focusedId = i ?? null, t && i && (this._restoreFocus = !0);
|
|
1009
1001
|
}
|
|
1010
1002
|
return this._focusedId ?? void 0;
|
|
1011
1003
|
}
|
|
@@ -1018,34 +1010,34 @@ class x extends F {
|
|
|
1018
1010
|
}
|
|
1019
1011
|
/** Kick a load for every lazy node whose CHILD ring is inside the rendered window. */
|
|
1020
1012
|
loadLazyCandidates() {
|
|
1021
|
-
const e = this._loadChildren,
|
|
1022
|
-
if (!e || !
|
|
1023
|
-
const
|
|
1024
|
-
...this.isLazy(
|
|
1025
|
-
...this._rendered.filter((
|
|
1026
|
-
].filter((
|
|
1027
|
-
a.map((
|
|
1013
|
+
const e = this._loadChildren, i = this._index;
|
|
1014
|
+
if (!e || !i) return;
|
|
1015
|
+
const t = this.focusedRoot, r = this.maxDepth === "auto", o = this.renderedDepth, a = [
|
|
1016
|
+
...this.isLazy(t) ? [t] : [],
|
|
1017
|
+
...this._rendered.filter((s) => r || s.depth < o).map((s) => i.byId.get(s.id)).filter((s) => this.isLazy(s))
|
|
1018
|
+
].filter((s) => !this._loadingIds.has(s.id) && !this._failedIds.has(s.id));
|
|
1019
|
+
a.map((s) => (this._loadingIds.add(s.id), s === t && this.liveAnnouncer.announce(`${this._loadingLabel} ${this.labelText(s)}`), e(s).then(
|
|
1028
1020
|
(n) => {
|
|
1029
|
-
|
|
1021
|
+
s.children = n, this._loadingIds.delete(s.id), this._loadedIds.add(s.id), this._data && (this._index = L(this._data)), this.requestUpdate();
|
|
1030
1022
|
},
|
|
1031
1023
|
(n) => {
|
|
1032
|
-
this._loadingIds.delete(
|
|
1024
|
+
this._loadingIds.delete(s.id), this._failedIds.add(s.id), this.emit("hierarchy-node-load-error", { node: s, error: n }), this.requestUpdate();
|
|
1033
1025
|
}
|
|
1034
|
-
),
|
|
1026
|
+
), s)), a.length && this.requestUpdate();
|
|
1035
1027
|
}
|
|
1036
1028
|
fillOf(e) {
|
|
1037
1029
|
if (e.color) return e.color;
|
|
1038
|
-
const
|
|
1039
|
-
return
|
|
1030
|
+
const i = this._index?.colorValues.get(e.id);
|
|
1031
|
+
return i !== void 0 ? this._fill(i) : void 0;
|
|
1040
1032
|
}
|
|
1041
1033
|
treeLabel() {
|
|
1042
1034
|
return this.getAttribute("aria-label") ?? this._inputLabel;
|
|
1043
1035
|
}
|
|
1044
1036
|
/** The focus path as buttons, OUTSIDE any role=tree container (trees own only treeitems). */
|
|
1045
|
-
renderBreadcrumb(e,
|
|
1046
|
-
const
|
|
1037
|
+
renderBreadcrumb(e, i) {
|
|
1038
|
+
const t = m(e, i);
|
|
1047
1039
|
return c`<nav class="breadcrumb" aria-label=${this._breadcrumbLabel}>
|
|
1048
|
-
${
|
|
1040
|
+
${t.map((r, o) => o === t.length - 1 ? c`<span class="crumb-current" aria-current="location">${this.labelText(r)}</span>` : c`<button
|
|
1049
1041
|
type="button"
|
|
1050
1042
|
class="crumb"
|
|
1051
1043
|
@click=${() => this.zoomTo(r === e.root ? void 0 : r.id)}
|
|
@@ -1053,8 +1045,8 @@ class x extends F {
|
|
|
1053
1045
|
</nav>`;
|
|
1054
1046
|
}
|
|
1055
1047
|
render() {
|
|
1056
|
-
const e = this._index,
|
|
1057
|
-
return !e || !
|
|
1048
|
+
const e = this._index, i = this.focusedRoot;
|
|
1049
|
+
return !e || !i ? c`<div class="chart"></div>` : c`${this._showBreadcrumb ? this.renderBreadcrumb(e, i) : d}<div
|
|
1058
1050
|
class="chart ${this._gestures.has("pinch") ? "pinch" : ""}"
|
|
1059
1051
|
@click=${this.onClick}
|
|
1060
1052
|
@keydown=${this.onKeyDown}
|
|
@@ -1066,49 +1058,49 @@ class x extends F {
|
|
|
1066
1058
|
@focusin=${this.onFocusIn}
|
|
1067
1059
|
@focusout=${this.onFocusOut}
|
|
1068
1060
|
>
|
|
1069
|
-
${this._layout === "sunburst" ? this.renderSunburst(e) : this._layout === "icicle" ? this.renderIcicle(e,
|
|
1061
|
+
${this._layout === "sunburst" ? this.renderSunburst(e) : this._layout === "icicle" ? this.renderIcicle(e, i) : this.renderTreemap(e, i)}
|
|
1070
1062
|
<div class="chart-tooltip" aria-hidden="true"></div>
|
|
1071
1063
|
${this._hintVisible && this._gestures.has("wheel") ? c`<div class="zoom-hint" aria-hidden="true">${this.zoomHintLabel}</div>` : d}
|
|
1072
1064
|
${this.liveAnnouncer.template()}
|
|
1073
1065
|
</div>`;
|
|
1074
1066
|
}
|
|
1075
|
-
captureRendered(e,
|
|
1076
|
-
this._rendered = e.map((
|
|
1077
|
-
id:
|
|
1078
|
-
parentId: this._index?.parents.get(
|
|
1079
|
-
depth:
|
|
1067
|
+
captureRendered(e, i) {
|
|
1068
|
+
this._rendered = e.map((t) => ({
|
|
1069
|
+
id: t.node.id,
|
|
1070
|
+
parentId: this._index?.parents.get(t.node.id)?.id ?? i,
|
|
1071
|
+
depth: t.depth
|
|
1080
1072
|
})), this._tabFocusId = this.resolveTabFocus();
|
|
1081
1073
|
}
|
|
1082
1074
|
/* ---------- sunburst ---------- */
|
|
1083
1075
|
renderSunburst(e) {
|
|
1084
|
-
const
|
|
1085
|
-
maxDepth:
|
|
1076
|
+
const i = this.focusedRoot, t = this.renderedDepth, r = T(e, this._rootId, {
|
|
1077
|
+
maxDepth: t,
|
|
1086
1078
|
// The cull relaxes with magnification: a sliver you zoomed into is no
|
|
1087
1079
|
// longer a sliver on screen.
|
|
1088
|
-
minFraction: this._minAngle / 360 / this.
|
|
1089
|
-
}),
|
|
1080
|
+
minFraction: this._minAngle / 360 / this._view.zoom
|
|
1081
|
+
}), o = u / 2 / (t + 1), a = this.treeLabel(), s = new Map(r.map((l) => [l.node.id, this.tweenedSpan(l)]));
|
|
1090
1082
|
this._prevSpans = new Map(
|
|
1091
|
-
[...
|
|
1092
|
-
), this.captureRendered(r,
|
|
1093
|
-
const n =
|
|
1083
|
+
[...s.entries()].map(([l, _]) => [l, { ..._, depth: 0 }])
|
|
1084
|
+
), this.captureRendered(r, i?.id ?? "");
|
|
1085
|
+
const n = i === e.root, h = 100 / (t + 1) * 0.9, f = this._view.zoom, w = this.viewRect(0.5, 0.5, 0.5, 0.5);
|
|
1094
1086
|
return c`<svg
|
|
1095
|
-
viewBox="${this.
|
|
1087
|
+
viewBox="${this._view.x * u} ${this._view.y * u} ${u / f} ${u / f}"
|
|
1096
1088
|
role="tree"
|
|
1097
1089
|
aria-label=${a ?? d}
|
|
1098
1090
|
>
|
|
1099
1091
|
<!-- role=none: this group only centres the geometry, and an unroled node
|
|
1100
1092
|
between role=tree and its treeitems is an aria-required-parent risk. -->
|
|
1101
1093
|
<g role="none" transform="translate(${u / 2},${u / 2})">
|
|
1102
|
-
${
|
|
1103
|
-
${this._showLabels && this._tween >= 1 ?
|
|
1104
|
-
r.map((l) => ({ n: l, fit: this.arcLabelFit(l,
|
|
1094
|
+
${g(r, (l) => l.node.id, (l) => this.renderArc(l, s.get(l.node.id) ?? l, o))}
|
|
1095
|
+
${this._showLabels && this._tween >= 1 ? g(
|
|
1096
|
+
r.map((l) => ({ n: l, fit: this.arcLabelFit(l, o) })).filter(({ fit: l }) => l.visible),
|
|
1105
1097
|
({ n: l }) => `label-${l.node.id}`,
|
|
1106
|
-
({ n: l, fit: _ }) =>
|
|
1098
|
+
({ n: l, fit: _ }) => z`<text
|
|
1107
1099
|
class="arc-label"
|
|
1108
1100
|
aria-hidden="true"
|
|
1109
1101
|
font-size=${Math.round(this._labelFontSize / this.effectiveScale * 100) / 100}
|
|
1110
1102
|
data-surface=${this.surfaceToneOf(l.node, l.hasChildren ? 1 : 0.6)}
|
|
1111
|
-
transform=${
|
|
1103
|
+
transform=${B(l.x0, l.x1, (l.depth + 0.5) * o, _.orientation)}
|
|
1112
1104
|
>${_.text}</text>`
|
|
1113
1105
|
) : d}
|
|
1114
1106
|
</g>
|
|
@@ -1121,24 +1113,24 @@ class x extends F {
|
|
|
1121
1113
|
style=${v({
|
|
1122
1114
|
left: `${w.x0 * 100}%`,
|
|
1123
1115
|
top: `${w.y0 * 100}%`,
|
|
1124
|
-
width: `${h *
|
|
1125
|
-
height: `${h *
|
|
1116
|
+
width: `${h * f}%`,
|
|
1117
|
+
height: `${h * f}%`
|
|
1126
1118
|
})}
|
|
1127
1119
|
@click=${this.zoomOut}
|
|
1128
|
-
>${
|
|
1120
|
+
>${i ? this.labelText(i) : ""}</button>`;
|
|
1129
1121
|
}
|
|
1130
|
-
renderArc(e,
|
|
1131
|
-
const r =
|
|
1122
|
+
renderArc(e, i, t) {
|
|
1123
|
+
const r = N(0, 0, e.depth * t, (e.depth + 1) * t, i.x0 * y, i.x1 * y, {
|
|
1132
1124
|
padAngle: 5e-3
|
|
1133
|
-
}),
|
|
1134
|
-
return
|
|
1125
|
+
}), o = this.fillOf(e.node);
|
|
1126
|
+
return z`<path
|
|
1135
1127
|
class="ring"
|
|
1136
1128
|
data-id=${e.node.id}
|
|
1137
1129
|
?data-leaf=${!e.hasChildren}
|
|
1138
1130
|
?data-loading=${this._loadingIds.has(e.node.id)}
|
|
1139
1131
|
?data-load-error=${this._failedIds.has(e.node.id)}
|
|
1140
1132
|
d=${r}
|
|
1141
|
-
fill=${
|
|
1133
|
+
fill=${o ?? "var(--mp-hierarchy-chart-node-fill)"}
|
|
1142
1134
|
role="treeitem"
|
|
1143
1135
|
tabindex=${e.node.id === this._tabFocusId ? "0" : "-1"}
|
|
1144
1136
|
aria-label=${this.accessibleName(e.node)}
|
|
@@ -1154,73 +1146,73 @@ class x extends F {
|
|
|
1154
1146
|
* needs a bigger arc on a small host, and re-rooting is what makes arcs big
|
|
1155
1147
|
* enough, so labels appear as you zoom in.
|
|
1156
1148
|
*/
|
|
1157
|
-
arcLabelFit(e,
|
|
1158
|
-
return
|
|
1149
|
+
arcLabelFit(e, i) {
|
|
1150
|
+
return H(
|
|
1159
1151
|
this.labelText(e.node),
|
|
1160
1152
|
(e.x1 - e.x0) * y,
|
|
1161
|
-
e.depth *
|
|
1162
|
-
(e.depth + 1) *
|
|
1153
|
+
e.depth * i * this.effectiveScale,
|
|
1154
|
+
(e.depth + 1) * i * this.effectiveScale,
|
|
1163
1155
|
this._labelFontSize
|
|
1164
1156
|
);
|
|
1165
1157
|
}
|
|
1166
1158
|
/* ---------- icicle ---------- */
|
|
1167
|
-
renderIcicle(e,
|
|
1168
|
-
const
|
|
1169
|
-
maxDepth:
|
|
1170
|
-
minFraction: this._minSize / u / this.
|
|
1171
|
-
}),
|
|
1172
|
-
this.captureRendered(r,
|
|
1173
|
-
const
|
|
1159
|
+
renderIcicle(e, i) {
|
|
1160
|
+
const t = this.renderedDepth, r = T(e, this._rootId, {
|
|
1161
|
+
maxDepth: t,
|
|
1162
|
+
minFraction: this._minSize / u / this._view.zoom
|
|
1163
|
+
}), o = t + 1, a = this.treeLabel();
|
|
1164
|
+
this.captureRendered(r, i.id);
|
|
1165
|
+
const s = this.viewRect(0, 0, 1 / o, 1);
|
|
1174
1166
|
return c`<div class="icicle" role="tree" aria-label=${a ?? d}>
|
|
1175
1167
|
<div
|
|
1176
1168
|
class="cell focus-cell"
|
|
1177
|
-
data-id=${
|
|
1169
|
+
data-id=${i.id}
|
|
1178
1170
|
data-surface=${this.toneOfSurface(void 0)}
|
|
1179
1171
|
role="treeitem"
|
|
1180
1172
|
tabindex="-1"
|
|
1181
|
-
aria-label=${this.accessibleName(
|
|
1182
|
-
aria-level=${
|
|
1173
|
+
aria-label=${this.accessibleName(i)}
|
|
1174
|
+
aria-level=${Z(e, i)}
|
|
1183
1175
|
aria-setsize="1"
|
|
1184
1176
|
aria-posinset="1"
|
|
1185
1177
|
aria-expanded="true"
|
|
1186
|
-
title=${
|
|
1187
|
-
style=${v({ ...this.cellGeometry(
|
|
1188
|
-
>${this._showLabels && this.cellLabelFits(
|
|
1189
|
-
${
|
|
1178
|
+
title=${i === e.root ? d : this._zoomOutLabel}
|
|
1179
|
+
style=${v({ ...this.cellGeometry(s), fontSize: `${this._labelFontSize}px` })}
|
|
1180
|
+
>${this._showLabels && this.cellLabelFits(s) ? c`<span class="cell-label">${this.labelText(i)}</span>` : d}</div>
|
|
1181
|
+
${g(
|
|
1190
1182
|
r,
|
|
1191
1183
|
(n) => n.node.id,
|
|
1192
1184
|
(n) => this.renderCell(
|
|
1193
1185
|
n,
|
|
1194
|
-
this.viewRect(n.depth /
|
|
1186
|
+
this.viewRect(n.depth / o, n.x0, (n.depth + 1) / o, n.x1),
|
|
1195
1187
|
n.hasChildren && n.depth < this.renderedDepth && !!n.node.children?.length
|
|
1196
1188
|
)
|
|
1197
1189
|
)}
|
|
1198
1190
|
</div>`;
|
|
1199
1191
|
}
|
|
1200
1192
|
/* ---------- treemap ---------- */
|
|
1201
|
-
renderTreemap(e,
|
|
1202
|
-
const
|
|
1203
|
-
maxDepth:
|
|
1204
|
-
minArea: (this._minSize / u) ** 2 / (this.
|
|
1193
|
+
renderTreemap(e, i) {
|
|
1194
|
+
const t = this.renderedDepth, r = G(e, this._rootId, {
|
|
1195
|
+
maxDepth: t,
|
|
1196
|
+
minArea: (this._minSize / u) ** 2 / (this._view.zoom * this._view.zoom),
|
|
1205
1197
|
childPadding: 4e-3,
|
|
1206
1198
|
childHeaderSpace: 0.028
|
|
1207
|
-
}),
|
|
1208
|
-
return this.captureRendered(r,
|
|
1199
|
+
}), o = this.treeLabel(), a = m(e, i).map((s) => this.labelText(s)).join(" / ");
|
|
1200
|
+
return this.captureRendered(r, i.id), c`<div class="treemap">
|
|
1209
1201
|
<button
|
|
1210
1202
|
class="treemap-header"
|
|
1211
1203
|
aria-label=${this._zoomOutLabel}
|
|
1212
1204
|
title=${a}
|
|
1213
|
-
?disabled=${
|
|
1205
|
+
?disabled=${i === e.root}
|
|
1214
1206
|
@click=${this.zoomOut}
|
|
1215
1207
|
>${a}</button>
|
|
1216
|
-
<div class="treemap-body" role="tree" aria-label=${
|
|
1217
|
-
${
|
|
1208
|
+
<div class="treemap-body" role="tree" aria-label=${o ?? d}>
|
|
1209
|
+
${g(
|
|
1218
1210
|
r,
|
|
1219
|
-
(
|
|
1220
|
-
(
|
|
1221
|
-
|
|
1222
|
-
this.viewRect(
|
|
1223
|
-
|
|
1211
|
+
(s) => s.node.id,
|
|
1212
|
+
(s) => this.renderCell(
|
|
1213
|
+
s,
|
|
1214
|
+
this.viewRect(s.x0, s.y0, s.x1, s.y1),
|
|
1215
|
+
s.hasChildren && s.depth < this.renderedDepth && !!s.node.children?.length
|
|
1224
1216
|
)
|
|
1225
1217
|
)}
|
|
1226
1218
|
</div>
|
|
@@ -1235,11 +1227,11 @@ class x extends F {
|
|
|
1235
1227
|
};
|
|
1236
1228
|
}
|
|
1237
1229
|
cellLabelFits(e) {
|
|
1238
|
-
const
|
|
1239
|
-
return
|
|
1230
|
+
const i = u * this._hostScale;
|
|
1231
|
+
return X((e.x1 - e.x0) * i, (e.y1 - e.y0) * i, this._labelFontSize);
|
|
1240
1232
|
}
|
|
1241
|
-
renderCell(e,
|
|
1242
|
-
const r = this._layout === "treemap" &&
|
|
1233
|
+
renderCell(e, i, t) {
|
|
1234
|
+
const r = this._layout === "treemap" && t, o = r ? void 0 : this.fillOf(e.node), a = this._showLabels && this.cellLabelFits(i);
|
|
1243
1235
|
return c`<div
|
|
1244
1236
|
class="cell"
|
|
1245
1237
|
data-id=${e.node.id}
|
|
@@ -1247,27 +1239,24 @@ class x extends F {
|
|
|
1247
1239
|
?data-branch=${r}
|
|
1248
1240
|
?data-loading=${this._loadingIds.has(e.node.id)}
|
|
1249
1241
|
?data-load-error=${this._failedIds.has(e.node.id)}
|
|
1250
|
-
data-surface=${
|
|
1242
|
+
data-surface=${o ? this.surfaceToneOf(e.node, 1) : this.toneOfSurface(void 0)}
|
|
1251
1243
|
role="treeitem"
|
|
1252
1244
|
tabindex=${e.node.id === this._tabFocusId ? "0" : "-1"}
|
|
1253
1245
|
aria-label=${this.accessibleName(e.node)}
|
|
1254
1246
|
aria-level=${e.level}
|
|
1255
1247
|
aria-setsize=${e.setsize}
|
|
1256
1248
|
aria-posinset=${e.posinset}
|
|
1257
|
-
aria-expanded=${e.hasChildren ? String(
|
|
1249
|
+
aria-expanded=${e.hasChildren ? String(t) : d}
|
|
1258
1250
|
aria-busy=${this._loadingIds.has(e.node.id) ? "true" : d}
|
|
1259
1251
|
style=${v({
|
|
1260
|
-
...this.cellGeometry(
|
|
1252
|
+
...this.cellGeometry(i),
|
|
1261
1253
|
fontSize: `${this._labelFontSize}px`,
|
|
1262
|
-
...
|
|
1254
|
+
...o ? { background: o } : {}
|
|
1263
1255
|
})}
|
|
1264
1256
|
>${a ? c`<span class="cell-label">${this.labelText(e.node)}</span>` : d}</div>`;
|
|
1265
1257
|
}
|
|
1266
1258
|
}
|
|
1267
|
-
function
|
|
1268
|
-
return Math.min(1 - 1 / e, Math.max(0, p));
|
|
1269
|
-
}
|
|
1270
|
-
function B(p) {
|
|
1259
|
+
function j(p) {
|
|
1271
1260
|
if (!p || p === "transparent") return !1;
|
|
1272
1261
|
const e = p.match(/^rgba\([^)]+,\s*([\d.]+)\s*\)$/i)?.[1];
|
|
1273
1262
|
return e !== void 0 ? Number(e) >= 1 : /^(rgb\(|#|hsl\()/i.test(p);
|