@mintplayer/web-components 2.15.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.
Files changed (126) hide show
  1. package/accordion/index.mjs +5 -5
  2. package/calendar/index.mjs +1 -1
  3. package/carousel/index.mjs +57 -143
  4. package/charts/core/index.mjs +30 -20
  5. package/charts/core/src/attributes.d.ts +18 -0
  6. package/charts/core/src/index.d.ts +2 -0
  7. package/charts/core/src/view-window.d.ts +46 -0
  8. package/charts/hierarchy/index.mjs +245 -256
  9. package/charts/hierarchy/src/components/mp-hierarchy-chart.d.ts +1 -3
  10. package/charts/sparkline/index.mjs +27 -26
  11. package/charts/trend/index.mjs +21 -20
  12. package/checkbox/index.mjs +1 -1
  13. package/checkbox/src/components/mp-checkbox.d.ts +1 -0
  14. package/chunks/attributes-L3eKsbdy.mjs +16 -0
  15. package/chunks/color-mode-warning-71FmlzWX.mjs +13 -0
  16. package/chunks/{form-check.styles-B0pxJ6YC.mjs → form-check.styles-DqvBnspm.mjs} +24 -3
  17. package/chunks/{mp-calendar.element-CJ8-t-Zn.mjs → mp-calendar.element-BIHS9SZZ.mjs} +11 -6
  18. package/chunks/{mp-checkbox-CzwS7Y_t.mjs → mp-checkbox-zV83gILn.mjs} +44 -36
  19. package/chunks/mp-datatable-eRpl7-2V.mjs +2238 -0
  20. package/chunks/{mp-datetime-picker.element-D1CiLbHm.mjs → mp-datetime-picker.element-Cxu5-qRE.mjs} +29 -32
  21. package/chunks/{mp-pagination-Dea75mD4.mjs → mp-pagination-hGy4dL7p.mjs} +9 -4
  22. package/chunks/{mp-radio-cL46sUA0.mjs → mp-radio-BhRVNdKp.mjs} +32 -28
  23. package/chunks/{mp-select-BNrbPwN4.mjs → mp-select-CgqYFvUj.mjs} +41 -26
  24. package/chunks/{mp-splitter-Ckn1kN4v.mjs → mp-splitter-DLehrw3Y.mjs} +144 -120
  25. package/chunks/{mp-timepicker.element-COZEUIoE.mjs → mp-timepicker.element-BiB9lkgc.mjs} +58 -45
  26. package/chunks/{mp-toggle-button-eo_aTQtu.mjs → mp-toggle-button-CaS9uYLE.mjs} +26 -24
  27. package/chunks/{mp-treeview-C8iltDbq.mjs → mp-treeview-CaMTDrvY.mjs} +51 -50
  28. package/chunks/{overlay-controller-D6agzzOI.mjs → overlay-controller-BHDagokg.mjs} +130 -70
  29. package/chunks/{id-DNZVAnGC.mjs → resource.service--lqLwEqk.mjs} +144 -206
  30. package/chunks/view-window-DGvFiDnW.mjs +263 -0
  31. package/code-snippet/index.mjs +70 -66
  32. package/code-snippet/src/hljs-loaders.generated.d.ts +1 -1
  33. package/custom-elements.json +65750 -0
  34. package/datatable/index.mjs +6 -5
  35. package/datatable/src/components/column-resize.d.ts +11 -0
  36. package/datatable/src/components/mp-datatable.d.ts +206 -1
  37. package/datatable/src/index.d.ts +3 -1
  38. package/datatable/src/types/column-def.d.ts +61 -0
  39. package/datatable/src/types/filter.d.ts +138 -0
  40. package/datatable/src/types/index.d.ts +3 -2
  41. package/datatable/src/types/labels.d.ts +58 -0
  42. package/datepicker/index.mjs +10 -9
  43. package/datetime-picker/index.mjs +1 -1
  44. package/datetime-picker/src/mp-datetime-picker.element.d.ts +3 -0
  45. package/dock/index.mjs +430 -463
  46. package/dock/src/components/mint-dock-manager.element.d.ts +25 -2
  47. package/dock/src/core/resize.d.ts +60 -0
  48. package/dropdown-menu/index.mjs +4 -2
  49. package/dropdown-menu/src/components/mp-dropdown-menu.d.ts +6 -1
  50. package/dropdown-menu/src/index.d.ts +1 -1
  51. package/dropdown-menu/src/types/dropdown.d.ts +14 -1
  52. package/dropdown-menu/src/types/index.d.ts +1 -1
  53. package/file-manager/index.mjs +63 -61
  54. package/file-manager/src/components/mp-file-manager.d.ts +4 -3
  55. package/multi-range/index.mjs +56 -50
  56. package/multi-range/src/mint-multi-range.element.d.ts +4 -10
  57. package/multi-range/src/pointer-geometry.d.ts +31 -0
  58. package/navbar/index.mjs +89 -439
  59. package/overlay/index.mjs +5 -2
  60. package/overlay/src/index.d.ts +2 -0
  61. package/overlay/src/overlay-controller.d.ts +27 -14
  62. package/overlay/src/overlay-portal.d.ts +53 -0
  63. package/overlay/src/placement.d.ts +48 -0
  64. package/package.json +7 -1
  65. package/pagination/index.mjs +1 -1
  66. package/phone-input/index.mjs +44 -40
  67. package/phone-input/src/components/stack.d.ts +8 -0
  68. package/query-builder/index.mjs +418 -466
  69. package/query-builder/src/dnd/drag-controller.d.ts +12 -8
  70. package/query-builder/src/mp-query-builder.element.d.ts +5 -1
  71. package/query-builder/src/mp-query-condition.element.d.ts +1 -0
  72. package/radio/index.mjs +1 -1
  73. package/radio-group/index.mjs +1 -1
  74. package/ribbon/index.mjs +477 -498
  75. package/ribbon/src/core/band-text-color.d.ts +10 -0
  76. package/ribbon/src/core/key-tip-allocator.d.ts +10 -0
  77. package/ribbon/src/core/plan-reduce-steps.d.ts +62 -0
  78. package/ribbon/src/mp-ribbon.element.d.ts +0 -27
  79. package/scheduler/index.mjs +726 -711
  80. package/scheduler/src/components/mp-scheduler.d.ts +19 -3
  81. package/scheduler/src/drag/drag-manager.d.ts +1 -9
  82. package/scheduler/src/input/input-handler.d.ts +12 -2
  83. package/scheduler/src/utils/geometry.d.ts +39 -0
  84. package/scheduler/src/views/timeline-view.d.ts +0 -1
  85. package/scheduler-core/index.mjs +84 -71
  86. package/scheduler-core/src/services/resource.service.d.ts +0 -12
  87. package/scheduler-core/src/services/timeline.service.d.ts +0 -9
  88. package/select/index.mjs +1 -1
  89. package/select/src/components/mp-select.d.ts +1 -0
  90. package/signature-pad/index.mjs +21 -23
  91. package/signature-pad/src/canvas-point.d.ts +26 -0
  92. package/signature-pad/src/mp-signature-pad.element.d.ts +1 -7
  93. package/splitter/index.mjs +1 -1
  94. package/splitter/src/components/mp-splitter.d.ts +16 -0
  95. package/splitter/src/managers/index.d.ts +1 -0
  96. package/splitter/src/managers/rescale-panel-sizes.d.ts +14 -0
  97. package/swiper-core/index.mjs +2 -2
  98. package/theming/bs-theme-preboot.js +1 -0
  99. package/theming/color-mode.css +36 -0
  100. package/theming/index.d.ts +1 -0
  101. package/theming/index.mjs +327 -0
  102. package/theming/src/components/mp-theme-toggle.d.ts +71 -0
  103. package/theming/src/cookie.d.ts +31 -0
  104. package/theming/src/index.d.ts +5 -0
  105. package/theming/src/preboot.d.ts +1 -0
  106. package/theming/src/resolve.d.ts +36 -0
  107. package/theming/src/store.d.ts +27 -0
  108. package/theming/src/styles/theme-toggle.styles.d.ts +2 -0
  109. package/theming/src/testing/fake-broadcast-channel.d.ts +35 -0
  110. package/theming/src/toggle-modes.d.ts +23 -0
  111. package/tile-manager/index.mjs +252 -211
  112. package/tile-manager/src/components/mint-tile-manager.element.d.ts +8 -0
  113. package/tile-manager/src/utils/grid-geometry.d.ts +49 -0
  114. package/timeline/index.mjs +156 -164
  115. package/timeline/src/components/mp-timeline.d.ts +41 -7
  116. package/timepicker/index.mjs +7 -4
  117. package/timepicker/src/mp-time-list.element.d.ts +26 -0
  118. package/timepicker/src/mp-timepicker.element.d.ts +3 -0
  119. package/toggle-button/index.mjs +1 -1
  120. package/tree-select/index.mjs +21 -9
  121. package/treeview/index.mjs +1 -1
  122. package/treeview/src/components/mp-treeview.d.ts +6 -4
  123. package/chunks/color-DIeST-IS.mjs +0 -224
  124. package/chunks/mp-datatable-UJI8E73X.mjs +0 -1400
  125. package/datatable/src/styles/datatable.styles.d.ts +0 -2
  126. package/query-builder/src/mp-query-condition.element.template.d.ts +0 -2
@@ -1,9 +1,10 @@
1
- import { unsafeCSS as T, LitElement as F, html as c, nothing as d, svg as k } from "lit";
2
- import { repeat as f } from "lit/directives/repeat.js";
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 C } from "../../chunks/live-announcer-Bi0orG4n.mjs";
5
- import { d as z, c as $, k as U, j as L, e as q, f as S, i as m, p as I, a as R, b as O, g as A, l as D, s as Z, h as E } from "../../chunks/color-DIeST-IS.mjs";
6
- const P = T(`@charset "UTF-8";
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 N() {
320
+ function K() {
320
321
  return typeof matchMedia < "u" && matchMedia("(prefers-reduced-motion: reduce)").matches;
321
322
  }
322
- class x extends F {
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 = z(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 C(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._viewZoom = 1, this._viewX = 0, this._viewY = 0, this._pinchPointers = /* @__PURE__ */ new Map(), this._dragPointer = null, this._dragLast = { x: 0, y: 0 }, this._dragTotal = 0, this._dragMoved = !1, this._dismissedForId = null;
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 = [P];
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 ? $(e) : void 0, this.resetZoom();
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 t = e || void 0;
377
- t !== this._rootId && (this.beginTween(), this._rootId = t, t === void 0 ? this.removeAttribute("root-id") : this.setAttribute("root-id", t), this.requestUpdate());
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, U(this._index, this._rootId)) : 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 = z(this._colorMin, this._colorMax, this._colorStart, this._colorEnd), this.requestUpdate();
511
+ this._fill = k(this._colorMin, this._colorMax, this._colorStart, this._colorEnd), this.requestUpdate();
511
512
  }
512
- attributeChangedCallback(e, t, i) {
513
- switch (super.attributeChangedCallback(e, t, i), e) {
513
+ attributeChangedCallback(e, i, t) {
514
+ switch (super.attributeChangedCallback(e, i, t), e) {
514
515
  case "layout":
515
- this.layout = i ?? "sunburst";
516
+ this.layout = t ?? "sunburst";
516
517
  break;
517
518
  case "root-id":
518
- this.rootId = i ?? void 0;
519
+ this.rootId = t ?? void 0;
519
520
  break;
520
521
  case "max-depth":
521
- i === null ? (this._maxDepth = void 0, this.requestUpdate()) : this.maxDepth = i === "auto" ? "auto" : Number(i);
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 = Number(i ?? 0.2);
525
+ this.minAngle = b(t, 0.2);
525
526
  break;
526
527
  case "min-size":
527
- this.minSize = Number(i ?? 4);
528
+ this.minSize = b(t, 4);
528
529
  break;
529
530
  case "show-labels":
530
- this.showLabels = i !== "false" && i !== null;
531
+ this.showLabels = F(t, !0);
531
532
  break;
532
533
  case "label-font-size":
533
- this.labelFontSize = Number(i ?? 12);
534
+ this.labelFontSize = b(t, 12);
534
535
  break;
535
536
  case "backdrop":
536
- this.backdrop = i ?? void 0;
537
+ this.backdrop = t ?? void 0;
537
538
  break;
538
539
  case "color-min":
539
- this.colorMin = Number(i ?? 0);
540
+ this.colorMin = b(t, 0);
540
541
  break;
541
542
  case "color-max":
542
- this.colorMax = Number(i ?? 100);
543
+ this.colorMax = b(t, 100);
543
544
  break;
544
545
  case "color-start":
545
- this.colorStart = i ?? "#fe0000";
546
+ this.colorStart = t ?? "#fe0000";
546
547
  break;
547
548
  case "color-end":
548
- this.colorEnd = i ?? "#21b577";
549
+ this.colorEnd = t ?? "#21b577";
549
550
  break;
550
551
  case "transition-duration":
551
- this.transitionDuration = Number(i ?? 300);
552
+ this.transitionDuration = b(t, 300);
552
553
  break;
553
554
  case "locale":
554
- this.locale = i ?? void 0;
555
+ this.locale = t ?? void 0;
555
556
  break;
556
557
  case "zoom-gestures":
557
- this.zoomGestures = i ?? "wheel pinch";
558
+ this.zoomGestures = t ?? "wheel pinch";
558
559
  break;
559
560
  case "zoom-hint-label":
560
- this._zoomHintLabel = i ?? void 0;
561
+ this._zoomHintLabel = t ?? void 0;
561
562
  break;
562
563
  case "show-breadcrumb":
563
- this.showBreadcrumb = i !== "false" && i !== null;
564
+ this.showBreadcrumb = F(t, !1);
564
565
  break;
565
566
  case "breadcrumb-label":
566
- this._breadcrumbLabel = i ?? "Chart path", this.requestUpdate();
567
+ this._breadcrumbLabel = t ?? "Chart path", this.requestUpdate();
567
568
  break;
568
569
  case "zoom-out-label":
569
- this._zoomOutLabel = i ?? "Zoom out one level", this.requestUpdate();
570
+ this._zoomOutLabel = t ?? "Zoom out one level", this.requestUpdate();
570
571
  break;
571
572
  case "loading-label":
572
- this._loadingLabel = i ?? "Loading";
573
+ this._loadingLabel = t ?? "Loading";
573
574
  break;
574
575
  case "metric-unit-label":
575
- this._metricUnitLabel = i ?? "%", this.requestUpdate();
576
+ this._metricUnitLabel = t ?? "%", this.requestUpdate();
576
577
  break;
577
578
  case "value-unit-label":
578
- this._valueUnitLabel = i ?? "", this.requestUpdate();
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 = i;
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 ? L(this._index, this._rootId) : void 0;
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 t = e[e.length - 1]?.contentRect.width;
631
- if (!t) return;
632
- const i = t / u;
633
- Math.abs(i - this._hostScale) > 1e-3 && (this._hostScale = i, this.requestUpdate());
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 t = getComputedStyle(e).backgroundColor;
656
- if (B(t)) {
657
- this._backdrop = t;
656
+ const i = getComputedStyle(e).backgroundColor;
657
+ if (j(i)) {
658
+ this._backdrop = i;
658
659
  return;
659
660
  }
660
- const i = e.getRootNode();
661
- e = e.parentElement ?? (i instanceof ShadowRoot ? i.host : null);
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, t) {
666
- const i = this.fillOf(e), r = i ? q(i, this._backdrop, t) : void 0;
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 ? S(e) : void 0) ?? S(this._backdrop) ?? "dark") === "dark" ? "light" : "dark";
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 t = (e ?? "").toLowerCase().split(/\s+/);
678
+ const i = (e ?? "").toLowerCase().split(/\s+/);
678
679
  this._gestures = new Set(
679
- t.filter((i) => i === "wheel" || i === "pinch")
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._viewZoom;
694
+ return this._view.zoom;
694
695
  }
695
696
  /** Programmatic geometric zoom, anchored at chart fractions (default: center). */
696
- setZoomLevel(e, t = 0.5, i = 0.5) {
697
- const r = Math.min(x.MAX_ZOOM, Math.max(1, Number(e) || 1)), s = this._viewX + t / this._viewZoom, a = this._viewY + i / this._viewZoom;
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._viewZoom = 1, this._viewX = 0, this._viewY = 0, this.requestUpdate();
701
+ this._view = $, this.requestUpdate();
702
702
  }
703
703
  /** Pan by chart-screen fractions (drag / two-finger move). */
704
- panBy(e, t) {
705
- this._viewZoom <= 1 || (this._viewX = g(this._viewX - e / this._viewZoom, this._viewZoom), this._viewY = g(this._viewY - t / this._viewZoom, this._viewZoom), this.requestUpdate());
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, t, i, r) {
709
- const s = this._viewZoom;
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 t = this.shadowRoot?.querySelector(".chart")?.getBoundingClientRect();
720
- return !t || !t.width || !t.height ? { x: 0.5, y: 0.5 } : {
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._viewZoom;
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 t = e.deltaMode === 1 ? 16 : e.deltaMode === 2 ? this.clientHeight || 400 : 1, i = Math.max(-100, Math.min(100, e.deltaY * t)), r = this.chartAnchor(e);
737
- this.setZoomLevel(this._viewZoom * Math.exp(-i * 5e-3), r.x, r.y);
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, t] = [...this._pinchPointers.values()];
741
- return Math.hypot(t.x - e.x, t.y - e.y);
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, t] = [...this._pinchPointers.values()];
745
- return { x: (e.x + t.x) / 2, y: (e.y + t.y) / 2 };
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._viewZoom > 1 && e.button === 0 && (this._dragPointer = e.pointerId, this._dragLast = { x: e.clientX, y: e.clientY }, this._dragTotal = 0, this._dragMoved = !1);
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 t = this.pinchDistance(), i = this.pinchMidpoint();
761
- if (this._pinchPointers.set(e.pointerId, { x: e.clientX, y: e.clientY }), t > 0) {
762
- const r = this.pinchMidpoint(), s = this.chartAnchor({ clientX: r.x, clientY: r.y });
763
- this.setZoomLevel(this._viewZoom * (this.pinchDistance() / t), s.x, s.y);
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 - i.x) / a.width, (r.y - i.y) / a.height);
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 t = e.clientX - this._dragLast.x, i = e.clientY - this._dragLast.y;
771
- this._dragLast = { x: e.clientX, y: e.clientY }, this._dragTotal += Math.abs(t) + Math.abs(i), this._dragTotal > 3 && (this._dragMoved = !0);
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(t / r.width, i / r.height), !0;
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 t = this._index;
790
- if (!t) return;
791
- const i = L(t, e);
792
- i !== this.focusedRoot && (this.resetZoom(), this.rootId = i === t.root ? void 0 : i.id, this.liveAnnouncer.announce(this.labelText(i)), this.emit("hierarchy-zoom", { node: i, path: m(t, i) }));
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((t) => t.id === e) && (this._focusedId = e, this._restoreFocus = !0, this.requestUpdate());
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, t = this.focusedRoot;
800
- !e || !t || t === e.root || this.zoomTo(e.parents.get(t.id)?.id);
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 || N() || this._layout !== "sunburst" || !this._prevSpans.size) return;
796
+ if (this._transitionDuration <= 0 || K() || this._layout !== "sunburst" || !this._prevSpans.size) return;
805
797
  cancelAnimationFrame(this._tweenFrame);
806
- const e = performance.now(), t = (i) => {
807
- this._tween = Math.min(1, (i - e) / this._transitionDuration), this.requestUpdate(), this._tween < 1 && (this._tweenFrame = requestAnimationFrame(t));
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(t);
801
+ this._tween = 0, this._tweenFrame = requestAnimationFrame(i);
810
802
  }
811
803
  tweenedSpan(e) {
812
804
  if (this._tween >= 1) return e;
813
- const t = 1 - (1 - this._tween) * (1 - this._tween), i = this._prevSpans.get(e.node.id) ?? { x0: e.x0, x1: e.x0 };
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: i.x0 + (e.x0 - i.x0) * t,
816
- x1: i.x1 + (e.x1 - i.x1) * t
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 i = e.composedPath()[0]?.closest?.("[data-id]")?.getAttribute("data-id");
822
- return i ? this._index?.byId.get(i) : void 0;
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 t = this._index, i = this.nodeFromEvent(e);
830
- if (!(!t || !i)) {
831
- if (i === this.focusedRoot) {
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(i.id), this._loadedIds.delete(i.id), i.children?.length || i.hasChildren && this._loadChildren) {
836
- this.zoomTo(i.id);
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: i, path: m(t, i) });
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, t, i) {
850
- const r = this.tooltipEl, s = this.shadowRoot?.querySelector(".chart");
851
- if (!r || !s) return;
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, o = r.offsetHeight;
854
- r.style.left = `${Math.max(0, Math.min(t + 12, s.clientWidth - a))}px`, r.style.top = `${Math.max(0, Math.min(i + 12, s.clientHeight - o))}px`;
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 t = this._index;
861
- if (!t || this.trackViewGesture(e)) return;
862
- const i = this.nodeFromEvent(e);
863
- if (!i || i === this.focusedRoot) {
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 (i.id !== this._dismissedForId) {
859
+ if (t.id !== this._dismissedForId) {
868
860
  this._dismissedForId = null;
869
861
  const r = this.shadowRoot?.querySelector(".chart")?.getBoundingClientRect();
870
- r && this.showTooltip(i, e.clientX - r.left, e.clientY - r.top);
862
+ r && this.showTooltip(t, e.clientX - r.left, e.clientY - r.top);
871
863
  }
872
- this._hoveredId !== i.id && (this._hoveredId = i.id, this.emit("hierarchy-node-hover", { node: i, path: m(t, i) }));
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 t = e.composedPath()[0]?.closest?.('[role="treeitem"][data-id]'), i = t?.getAttribute("data-id"), r = i ? this._index?.byId.get(i) : void 0;
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 s = this.shadowRoot?.querySelector(".chart")?.getBoundingClientRect(), a = t?.getBoundingClientRect();
883
- !s || !a || this.showTooltip(
874
+ const o = this.shadowRoot?.querySelector(".chart")?.getBoundingClientRect(), a = i?.getBoundingClientRect();
875
+ !o || !a || this.showTooltip(
884
876
  r,
885
- a.left - s.left + a.width / 2,
886
- a.top - s.top + a.height / 2
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 t = this._tooltipFormatter?.(e);
894
- if (t !== void 0) return t;
895
- const i = new Intl.NumberFormat(this._locale || this.closest("[lang]")?.getAttribute("lang") || void 0), r = this._index?.colorValues.get(e.id), s = this._index?.values.get(e.id);
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 ? `${i.format(Math.round(r * 10) / 10)}%` : void 0,
899
- s !== void 0 && s > 0 ? i.format(s) : void 0
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 t = new Intl.NumberFormat(this._locale || this.closest("[lang]")?.getAttribute("lang") || void 0), i = this._index?.colorValues.get(e.id), r = this._index?.values.get(e.id);
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
- i !== void 0 ? `${t.format(Math.round(i * 10) / 10)}${this._metricUnitLabel}` : void 0,
911
- r !== void 0 && r > 0 ? `${t.format(r)}${this._valueUnitLabel ? ` ${this._valueUnitLabel}` : ""}` : void 0
912
- ].filter((s) => s !== void 0).join(", ");
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, t) {
915
- this.dispatchEvent(new CustomEvent(e, { detail: t, bubbles: !0, composed: !0 }));
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 t = this._index, r = e.composedPath()[0]?.closest?.('[role="treeitem"][data-id]')?.getAttribute("data-id");
920
- if (!t || !r) return;
921
- const s = (h) => {
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), o = this._rendered.filter((h) => h.parentId === a?.parentId), n = o.findIndex((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(o[(n + 1) % o.length]?.id);
918
+ o(s[(n + 1) % s.length]?.id);
927
919
  break;
928
920
  case "ArrowLeft":
929
- s(o[(n - 1 + o.length) % o.length]?.id);
921
+ o(s[(n - 1 + s.length) % s.length]?.id);
930
922
  break;
931
923
  case "ArrowDown":
932
- s(this._rendered.find((h) => h.parentId === r)?.id);
924
+ o(this._rendered.find((h) => h.parentId === r)?.id);
933
925
  break;
934
926
  case "ArrowUp":
935
- s(this._rendered.some((h) => h.id === a?.parentId) ? a?.parentId ?? void 0 : void 0);
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(o[0]?.id);
930
+ o(s[0]?.id);
939
931
  break;
940
932
  case "End":
941
- s(o[o.length - 1]?.id);
933
+ o(s[s.length - 1]?.id);
942
934
  break;
943
935
  case "Enter": {
944
- const h = t.byId.get(r);
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(t, h) });
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._viewZoom > 1) {
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._viewZoom * 1.5);
961
+ this.zoomKeyboard(r, this._view.zoom * 1.5);
970
962
  break;
971
963
  case "-":
972
964
  case "_":
973
- this.zoomKeyboard(r, this._viewZoom / 1.5);
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, t) {
986
- const i = this.shadowRoot?.querySelector(`[role="treeitem"][data-id="${M(e)}"]`), r = this.shadowRoot?.querySelector(".chart")?.getBoundingClientRect(), s = i?.getBoundingClientRect(), a = r?.width && s?.width ? this.chartAnchor({ clientX: s.left + s.width / 2, clientY: s.top + s.height / 2 }) : { x: 0.5, y: 0.5 };
987
- this.setZoomLevel(t, a.x, a.y);
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, t) {
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 i = this._index;
993
- if (!i) return;
994
- const r = this._rendered, s = r.findIndex((n) => n.id === t), o = [...r.slice(s + 1), ...r.slice(0, s + 1)].find((n) => {
995
- const h = i.byId.get(n.id);
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
- o && (this._focusedId = o.id, this._restoreFocus = !0, this.requestUpdate(), e.preventDefault());
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((t) => t.id === this._focusedId))) {
1007
- const t = this._rendered[0]?.id, i = !!this.shadowRoot?.activeElement;
1008
- this._focusedId = t ?? null, i && t && (this._restoreFocus = !0);
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, t = this._index;
1022
- if (!e || !t) return;
1023
- const i = this.focusedRoot, r = this.maxDepth === "auto", s = this.renderedDepth, a = [
1024
- ...this.isLazy(i) ? [i] : [],
1025
- ...this._rendered.filter((o) => r || o.depth < s).map((o) => t.byId.get(o.id)).filter((o) => this.isLazy(o))
1026
- ].filter((o) => !this._loadingIds.has(o.id) && !this._failedIds.has(o.id));
1027
- a.map((o) => (this._loadingIds.add(o.id), o === i && this.liveAnnouncer.announce(`${this._loadingLabel} ${this.labelText(o)}`), e(o).then(
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
- o.children = n, this._loadingIds.delete(o.id), this._loadedIds.add(o.id), this._data && (this._index = $(this._data)), this.requestUpdate();
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(o.id), this._failedIds.add(o.id), this.emit("hierarchy-node-load-error", { node: o, error: n }), this.requestUpdate();
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
- ), o)), a.length && this.requestUpdate();
1026
+ ), s)), a.length && this.requestUpdate();
1035
1027
  }
1036
1028
  fillOf(e) {
1037
1029
  if (e.color) return e.color;
1038
- const t = this._index?.colorValues.get(e.id);
1039
- return t !== void 0 ? this._fill(t) : void 0;
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, t) {
1046
- const i = m(e, t);
1037
+ renderBreadcrumb(e, i) {
1038
+ const t = m(e, i);
1047
1039
  return c`<nav class="breadcrumb" aria-label=${this._breadcrumbLabel}>
1048
- ${i.map((r, s) => s === i.length - 1 ? c`<span class="crumb-current" aria-current="location">${this.labelText(r)}</span>` : c`<button
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, t = this.focusedRoot;
1057
- return !e || !t ? c`<div class="chart"></div>` : c`${this._showBreadcrumb ? this.renderBreadcrumb(e, t) : d}<div
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, t) : this.renderTreemap(e, t)}
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, t) {
1076
- this._rendered = e.map((i) => ({
1077
- id: i.node.id,
1078
- parentId: this._index?.parents.get(i.node.id)?.id ?? t,
1079
- depth: i.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 t = this.focusedRoot, i = this.renderedDepth, r = I(e, this._rootId, {
1085
- maxDepth: i,
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._viewZoom
1089
- }), s = u / 2 / (i + 1), a = this.treeLabel(), o = new Map(r.map((l) => [l.node.id, this.tweenedSpan(l)]));
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
- [...o.entries()].map(([l, _]) => [l, { ..._, depth: 0 }])
1092
- ), this.captureRendered(r, t?.id ?? "");
1093
- const n = t === e.root, h = 100 / (i + 1) * 0.9, b = this._viewZoom, w = this.viewRect(0.5, 0.5, 0.5, 0.5);
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._viewX * u} ${this._viewY * u} ${u / b} ${u / b}"
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
- ${f(r, (l) => l.node.id, (l) => this.renderArc(l, o.get(l.node.id) ?? l, s))}
1103
- ${this._showLabels && this._tween >= 1 ? f(
1104
- r.map((l) => ({ n: l, fit: this.arcLabelFit(l, s) })).filter(({ fit: l }) => l.visible),
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: _ }) => k`<text
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=${R(l.x0, l.x1, (l.depth + 0.5) * s, _.orientation)}
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 * b}%`,
1125
- height: `${h * b}%`
1116
+ width: `${h * f}%`,
1117
+ height: `${h * f}%`
1126
1118
  })}
1127
1119
  @click=${this.zoomOut}
1128
- >${t ? this.labelText(t) : ""}</button>`;
1120
+ >${i ? this.labelText(i) : ""}</button>`;
1129
1121
  }
1130
- renderArc(e, t, i) {
1131
- const r = O(0, 0, e.depth * i, (e.depth + 1) * i, t.x0 * y, t.x1 * y, {
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
- }), s = this.fillOf(e.node);
1134
- return k`<path
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=${s ?? "var(--mp-hierarchy-chart-node-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, t) {
1158
- return A(
1149
+ arcLabelFit(e, i) {
1150
+ return H(
1159
1151
  this.labelText(e.node),
1160
1152
  (e.x1 - e.x0) * y,
1161
- e.depth * t * this.effectiveScale,
1162
- (e.depth + 1) * t * this.effectiveScale,
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, t) {
1168
- const i = this.renderedDepth, r = I(e, this._rootId, {
1169
- maxDepth: i,
1170
- minFraction: this._minSize / u / this._viewZoom
1171
- }), s = i + 1, a = this.treeLabel();
1172
- this.captureRendered(r, t.id);
1173
- const o = this.viewRect(0, 0, 1 / s, 1);
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=${t.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(t)}
1182
- aria-level=${D(e, t)}
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=${t === e.root ? d : this._zoomOutLabel}
1187
- style=${v({ ...this.cellGeometry(o), fontSize: `${this._labelFontSize}px` })}
1188
- >${this._showLabels && this.cellLabelFits(o) ? c`<span class="cell-label">${this.labelText(t)}</span>` : d}</div>
1189
- ${f(
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 / s, n.x0, (n.depth + 1) / s, n.x1),
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, t) {
1202
- const i = this.renderedDepth, r = Z(e, this._rootId, {
1203
- maxDepth: i,
1204
- minArea: (this._minSize / u) ** 2 / (this._viewZoom * this._viewZoom),
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
- }), s = this.treeLabel(), a = m(e, t).map((o) => this.labelText(o)).join(" / ");
1208
- return this.captureRendered(r, t.id), c`<div class="treemap">
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=${t === e.root}
1205
+ ?disabled=${i === e.root}
1214
1206
  @click=${this.zoomOut}
1215
1207
  >${a}</button>
1216
- <div class="treemap-body" role="tree" aria-label=${s ?? d}>
1217
- ${f(
1208
+ <div class="treemap-body" role="tree" aria-label=${o ?? d}>
1209
+ ${g(
1218
1210
  r,
1219
- (o) => o.node.id,
1220
- (o) => this.renderCell(
1221
- o,
1222
- this.viewRect(o.x0, o.y0, o.x1, o.y1),
1223
- o.hasChildren && o.depth < this.renderedDepth && !!o.node.children?.length
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 t = u * this._hostScale;
1239
- return E((e.x1 - e.x0) * t, (e.y1 - e.y0) * t, this._labelFontSize);
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, t, i) {
1242
- const r = this._layout === "treemap" && i, s = r ? void 0 : this.fillOf(e.node), a = this._showLabels && this.cellLabelFits(t);
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=${s ? this.surfaceToneOf(e.node, 1) : this.toneOfSurface(void 0)}
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(i) : d}
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(t),
1252
+ ...this.cellGeometry(i),
1261
1253
  fontSize: `${this._labelFontSize}px`,
1262
- ...s ? { background: s } : {}
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 g(p, e) {
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);