@m3e/web 2.5.6 → 2.5.7

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/dist/all.js CHANGED
@@ -24376,6 +24376,7 @@ let M3eSlideGroupElement = class M3eSlideGroupElement extends ReconnectedCallbac
24376
24376
  }
24377
24377
  /** @private */
24378
24378
  _updatePaging() {
24379
+ const canPage = this._canPage;
24379
24380
  if (this.disabled) {
24380
24381
  this._canPage = false;
24381
24382
  } else if (!this.vertical) {
@@ -24394,6 +24395,10 @@ let M3eSlideGroupElement = class M3eSlideGroupElement extends ReconnectedCallbac
24394
24395
  if (!this._canPage) {
24395
24396
  this._canPageStart = this._canPageEnd = false;
24396
24397
  }
24398
+ if (canPage != this._canPage) {
24399
+ // Emit internal (undocumented) event for use with tabs.
24400
+ this.dispatchEvent(new CustomEvent("pagination-changed"));
24401
+ }
24397
24402
  }
24398
24403
  };
24399
24404
  _M3eSlideGroupElement_directionalitySubscription = new WeakMap();
@@ -24442,7 +24447,7 @@ _M3eSlideGroupElement_pageEnd = function _M3eSlideGroupElement_pageEnd() {
24442
24447
  }
24443
24448
  };
24444
24449
  /** The styles of the element. */
24445
- M3eSlideGroupElement.styles = css`:host { display: flex; flex-wrap: nowrap; overflow: hidden; } :host([vertical]) { flex-direction: column; } .prev-button, .next-button { flex: none; --m3e-icon-button-small-shape-round: 0px; --m3e-icon-button-small-shape-square: 0px; --m3e-icon-button-small-shape-pressed-morph: 0px; --m3e-focus-ring-visibility: hidden; } ::slotted(prev-icon), ::slotted(next-icon), .icon { width: 1em; font-size: var(--m3e-slide-group-button-icon-size, var(--m3e-icon-button-small-icon-size, 1.5rem)) !important; } :host(:not([vertical])) .prev-button, :host(:not([vertical])) .next-button { --m3e-icon-button-small-container-height: 100%; width: var(--m3e-slide-group-button-size, 2.5rem); } :host([vertical]) .prev-button, :host([vertical]) .next-button { width: unset; --m3e-icon-button-small-container-height: var(--m3e-slide-group-button-size, 2.5rem); } :host([vertical]) .prev-button .icon, :host([vertical]) .next-button .icon { transform: rotate(90deg); } .content { flex: 1 1 auto; display: inherit; flex-wrap: inherit; flex-direction: inherit; overflow: inherit; position: relative; border-top: var(--m3e-slide-group-divider-top); border-bottom: var(--m3e-slide-group-divider-bottom); }`;
24450
+ M3eSlideGroupElement.styles = css`:host { display: flex; flex-wrap: nowrap; } :host([vertical]) { flex-direction: column; } .prev-button, .next-button { flex: none; --m3e-icon-button-small-shape-round: 0px; --m3e-icon-button-small-shape-square: 0px; --m3e-icon-button-small-shape-pressed-morph: 0px; --m3e-focus-ring-visibility: hidden; } ::slotted(prev-icon), ::slotted(next-icon), .icon { width: 1em; font-size: var(--m3e-slide-group-button-icon-size, var(--m3e-icon-button-small-icon-size, 1.5rem)) !important; } :host(:not([vertical])) .prev-button, :host(:not([vertical])) .next-button { --m3e-icon-button-small-container-height: 100%; width: var(--m3e-slide-group-button-size, 2.5rem); } :host([vertical]) .prev-button, :host([vertical]) .next-button { width: unset; --m3e-icon-button-small-container-height: var(--m3e-slide-group-button-size, 2.5rem); } :host([vertical]) .prev-button .icon, :host([vertical]) .next-button .icon { transform: rotate(90deg); } .content { flex: 1 1 auto; display: inherit; flex-wrap: inherit; flex-direction: inherit; position: relative; border-top: var(--m3e-slide-group-divider-top); border-bottom: var(--m3e-slide-group-divider-bottom); scrollbar-width: none; } .content::-webkit-scrollbar { display: none; } :host([vertical]) .content { overflow-x: hidden; overflow-y: auto; } :host(:not([vertical])) .content { overflow-x: auto; overflow-y: hidden; }`;
24446
24451
  __decorate([query(".content")], M3eSlideGroupElement.prototype, "scrollContainer", void 0);
24447
24452
  __decorate([state()], M3eSlideGroupElement.prototype, "_canPage", void 0);
24448
24453
  __decorate([state()], M3eSlideGroupElement.prototype, "_canPageStart", void 0);
@@ -27411,7 +27416,7 @@ let M3eTabPanelElement = class M3eTabPanelElement extends Role$1(LitElement, "ta
27411
27416
  M3eTabPanelElement.styles = css`:host { display: block; overflow-y: auto; scrollbar-width: ${DesignToken$1.scrollbar.width}; scrollbar-color: ${DesignToken$1.scrollbar.color}; }`;
27412
27417
  M3eTabPanelElement = __decorate([customElement$1("m3e-tab-panel")], M3eTabPanelElement);
27413
27418
 
27414
- var _M3eTabsElement_instances, _M3eTabsElement_directionalitySubscription, _M3eTabsElement_renderHeader, _M3eTabsElement_handleSlotChange, _M3eTabsElement_handleKeyDown, _M3eTabsElement_handleChange, _M3eTabsElement_handleSelectedChange, _M3eTabsElement_updateInkBar, _a$2;
27419
+ var _M3eTabsElement_instances, _M3eTabsElement_directionalitySubscription, _M3eTabsElement_swipe, _M3eTabsElement_velocityTracker, _M3eTabsElement_renderHeader, _M3eTabsElement_handleSlotChange, _M3eTabsElement_handleKeyDown, _M3eTabsElement_handleChange, _M3eTabsElement_handleSelectedChange, _M3eTabsElement_handleActiveItemChange, _M3eTabsElement_handleTabsPaginationChange, _M3eTabsElement_handleTabsPointerDown, _M3eTabsElement_handleTabsPointerMove, _M3eTabsElement_handleTabsPointerUp, _M3eTabsElement_handleTabsPointerCancel, _M3eTabsElement_handleTabsLostPointerCapture, _M3eTabsElement_endSwipeGesture, _M3eTabsElement_scrollTabIntoView, _M3eTabsElement_updateInkBar, _a$2;
27415
27420
  const MIN_PRIMARY_TAB_WIDTH = 24;
27416
27421
  /**
27417
27422
  * Organizes content into separate views where only one view can be visible at a time.
@@ -27473,13 +27478,12 @@ let M3eTabsElement = class M3eTabsElement extends AttachInternals$1(LitElement)
27473
27478
  _M3eTabsElement_directionalitySubscription.set(this, void 0);
27474
27479
  /** @private */
27475
27480
  this._selectedIndex = null;
27481
+ /** @private */
27482
+ _M3eTabsElement_swipe.set(this, void 0);
27483
+ /** @private */
27484
+ _M3eTabsElement_velocityTracker.set(this, new VelocityTracker$1());
27476
27485
  /** @internal */
27477
- this[_a$2] = new SelectionManager().onSelectedItemsChange(() => __classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_handleSelectedChange).call(this)).withHomeAndEnd().withWrap().withDirectionality(M3eDirectionality.current);
27478
- /**
27479
- * Whether scroll buttons are disabled.
27480
- * @default false
27481
- */
27482
- this.disablePagination = false;
27486
+ this[_a$2] = new SelectionManager().onSelectedItemsChange(() => __classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_handleSelectedChange).call(this)).onActiveItemChange(() => __classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_handleActiveItemChange).call(this)).withHomeAndEnd().withWrap().withDirectionality(M3eDirectionality.current);
27483
27487
  /**
27484
27488
  * The position of the tab headers.
27485
27489
  * @default "before"
@@ -27509,10 +27513,43 @@ let M3eTabsElement = class M3eTabsElement extends AttachInternals$1(LitElement)
27509
27513
  skipInitial: true,
27510
27514
  callback: () => {
27511
27515
  addCustomState$1(this, "--no-animate");
27512
- __classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_updateInkBar).call(this);
27516
+ const activeTab = this[selectionManager].activeItem ?? this.selectedTab;
27517
+ if (activeTab) {
27518
+ __classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_scrollTabIntoView).call(this, activeTab, true);
27519
+ } else {
27520
+ __classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_updateInkBar).call(this);
27521
+ }
27513
27522
  }
27514
27523
  });
27515
27524
  }
27525
+ /**
27526
+ * Whether scroll buttons are disabled.
27527
+ * @default false
27528
+ */
27529
+ get disablePagination() {
27530
+ switch (this.getAttribute("disable-pagination")) {
27531
+ case "auto":
27532
+ return "auto";
27533
+ case "":
27534
+ case "true":
27535
+ return true;
27536
+ default:
27537
+ return false;
27538
+ }
27539
+ }
27540
+ set disablePagination(value) {
27541
+ switch (value) {
27542
+ case false:
27543
+ this.removeAttribute("disable-pagination");
27544
+ break;
27545
+ case true:
27546
+ this.toggleAttribute("disable-pagination", true);
27547
+ break;
27548
+ case "auto":
27549
+ this.setAttribute("disable-pagination", "auto");
27550
+ break;
27551
+ }
27552
+ }
27516
27553
  /** The tabs. */
27517
27554
  get tabs() {
27518
27555
  return this[selectionManager]?.items ?? [];
@@ -27565,14 +27602,16 @@ let M3eTabsElement = class M3eTabsElement extends AttachInternals$1(LitElement)
27565
27602
  panelIndex = undefined;
27566
27603
  }
27567
27604
  }
27568
- return html`${this.headerPosition === "before" ? __classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_renderHeader).call(this) : nothing}<m3e-slide class="tabs" selected-index="${ifDefined(panelIndex)}"><slot name="panel"></slot></m3e-slide>${this.headerPosition === "after" ? __classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_renderHeader).call(this) : nothing}`;
27605
+ return html`${this.headerPosition === "before" ? __classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_renderHeader).call(this) : nothing}<m3e-slide class="tabs" selected-index="${ifDefined(panelIndex)}" @pointerdown="${__classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_handleTabsPointerDown)}" @pointermove="${__classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_handleTabsPointerMove)}" @pointerup="${__classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_handleTabsPointerUp)}" @pointercancel="${__classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_handleTabsPointerCancel)}" @lostpointercapture="${__classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_handleTabsLostPointerCapture)}"><slot name="panel"></slot></m3e-slide>${this.headerPosition === "after" ? __classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_renderHeader).call(this) : nothing}`;
27569
27606
  }
27570
27607
  };
27571
27608
  _M3eTabsElement_directionalitySubscription = new WeakMap();
27609
+ _M3eTabsElement_swipe = new WeakMap();
27610
+ _M3eTabsElement_velocityTracker = new WeakMap();
27572
27611
  _M3eTabsElement_instances = new WeakSet();
27573
27612
  _a$2 = selectionManager;
27574
27613
  _M3eTabsElement_renderHeader = function _M3eTabsElement_renderHeader() {
27575
- return html`<m3e-slide-group class="tablist" threshold="8" previous-page-label="${this.previousPageLabel}" next-page-label="${this.nextPageLabel}" ?disabled="${this.disablePagination}"><slot name="prev-icon" slot="prev-icon">${M3eDirectionality.current === "ltr" ? html`<svg class="prev icon" viewBox="0 -960 960 960" fill="currentColor"><path d="M640-80 240-480l400-400 71 71-329 329 329 329-71 71Z"/></svg>` : html`<svg class="next icon" viewBox="0 -960 960 960" fill="currentColor"><path d="m321-80-71-71 329-329-329-329 71-71 400 400L321-80Z"/></svg>`}</slot><slot name="next-icon" slot="next-icon">${M3eDirectionality.current === "ltr" ? html`<svg class="next icon" viewBox="0 -960 960 960" fill="currentColor"><path d="m321-80-71-71 329-329-329-329 71-71 400 400L321-80Z"/></svg>` : html`<svg class="prev icon" viewBox="0 -960 960 960" fill="currentColor"><path d="M640-80 240-480l400-400 71 71-329 329 329 329-71 71Z"/></svg>`}</slot><div class="header" role="tablist"><div class="tabs"><slot @slotchange="${__classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_handleSlotChange)}" @keydown="${__classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_handleKeyDown)}" @change="${__classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_handleChange)}"></slot></div><div class="ink-bar" aria-hidden="true"><div class="active-indicator"></div></div></div></m3e-slide-group>`;
27614
+ return html`<m3e-slide-group class="tablist" threshold="8" previous-page-label="${this.previousPageLabel}" next-page-label="${this.nextPageLabel}" ?disabled="${this.disablePagination === "auto" ? matchMedia("(hover: none) and (pointer: coarse)").matches : this.disablePagination}" @pagination-changed="${__classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_handleTabsPaginationChange)}"><slot name="prev-icon" slot="prev-icon">${M3eDirectionality.current === "ltr" ? html`<svg class="prev icon" viewBox="0 -960 960 960" fill="currentColor"><path d="M640-80 240-480l400-400 71 71-329 329 329 329-71 71Z"/></svg>` : html`<svg class="next icon" viewBox="0 -960 960 960" fill="currentColor"><path d="m321-80-71-71 329-329-329-329 71-71 400 400L321-80Z"/></svg>`}</slot><slot name="next-icon" slot="next-icon">${M3eDirectionality.current === "ltr" ? html`<svg class="next icon" viewBox="0 -960 960 960" fill="currentColor"><path d="m321-80-71-71 329-329-329-329 71-71 400 400L321-80Z"/></svg>` : html`<svg class="prev icon" viewBox="0 -960 960 960" fill="currentColor"><path d="M640-80 240-480l400-400 71 71-329 329 329 329-71 71Z"/></svg>`}</slot><div class="header" role="tablist"><div class="tabs"><slot @slotchange="${__classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_handleSlotChange)}" @keydown="${__classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_handleKeyDown)}" @change="${__classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_handleChange)}"></slot></div><div class="ink-bar" aria-hidden="true"><div class="active-indicator"></div></div></div></m3e-slide-group>`;
27576
27615
  };
27577
27616
  _M3eTabsElement_handleSlotChange = function _M3eTabsElement_handleSlotChange() {
27578
27617
  this[selectionManager].setItems([...this.querySelectorAll("m3e-tab")]);
@@ -27593,6 +27632,142 @@ _M3eTabsElement_handleSelectedChange = function _M3eTabsElement_handleSelectedCh
27593
27632
  selectedIndex = null;
27594
27633
  }
27595
27634
  this._selectedIndex = selectedIndex;
27635
+ if (selected) {
27636
+ __classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_scrollTabIntoView).call(this, selected, hasCustomState$1(this, "--no-animate"));
27637
+ } else {
27638
+ __classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_updateInkBar).call(this);
27639
+ }
27640
+ };
27641
+ _M3eTabsElement_handleActiveItemChange = function _M3eTabsElement_handleActiveItemChange() {
27642
+ if (this[selectionManager].activeItem) {
27643
+ __classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_scrollTabIntoView).call(this, this[selectionManager].activeItem, hasCustomState$1(this, "--no-animate"));
27644
+ }
27645
+ };
27646
+ _M3eTabsElement_handleTabsPaginationChange = function _M3eTabsElement_handleTabsPaginationChange() {
27647
+ if (this.disablePagination) return;
27648
+ const activeTab = this[selectionManager].activeItem ?? this.selectedTab;
27649
+ if (activeTab) {
27650
+ __classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_scrollTabIntoView).call(this, activeTab, true);
27651
+ }
27652
+ };
27653
+ _M3eTabsElement_handleTabsPointerDown = function _M3eTabsElement_handleTabsPointerDown(e) {
27654
+ if (e.pointerType !== "touch") {
27655
+ return; // swipe only supported for touch
27656
+ }
27657
+ e.currentTarget.setPointerCapture(e.pointerId);
27658
+ __classPrivateFieldSet(this, _M3eTabsElement_swipe, {
27659
+ x: e.clientX,
27660
+ y: e.clientY
27661
+ }, "f");
27662
+ __classPrivateFieldGet(this, _M3eTabsElement_velocityTracker, "f").reset();
27663
+ __classPrivateFieldGet(this, _M3eTabsElement_velocityTracker, "f").add(e.clientX);
27664
+ };
27665
+ _M3eTabsElement_handleTabsPointerMove = function _M3eTabsElement_handleTabsPointerMove(e) {
27666
+ if (!__classPrivateFieldGet(this, _M3eTabsElement_swipe, "f") || !e.currentTarget.hasPointerCapture(e.pointerId)) {
27667
+ return;
27668
+ }
27669
+ let dx = e.clientX - __classPrivateFieldGet(this, _M3eTabsElement_swipe, "f").x;
27670
+ const dy = e.clientY - __classPrivateFieldGet(this, _M3eTabsElement_swipe, "f").y;
27671
+ if (this.selectedIndex === 0 && dx > 0) {
27672
+ dx = 0;
27673
+ }
27674
+ if (this.selectedIndex === this.tabs.length - 1 && dx < 0) {
27675
+ dx = 0;
27676
+ }
27677
+ if (!__classPrivateFieldGet(this, _M3eTabsElement_swipe, "f").dir) {
27678
+ if (Math.abs(dx) > 10) {
27679
+ __classPrivateFieldGet(this, _M3eTabsElement_swipe, "f").dir = "horizontal";
27680
+ } else if (Math.abs(dy) > 10) {
27681
+ __classPrivateFieldGet(this, _M3eTabsElement_swipe, "f").dir = "vertical";
27682
+ } else {
27683
+ return;
27684
+ }
27685
+ }
27686
+ if (__classPrivateFieldGet(this, _M3eTabsElement_swipe, "f").dir === "vertical") {
27687
+ return;
27688
+ }
27689
+ __classPrivateFieldGet(this, _M3eTabsElement_velocityTracker, "f").add(e.clientX);
27690
+ __classPrivateFieldGet(this, _M3eTabsElement_swipe, "f").currentX = dx;
27691
+ this.shadowRoot?.querySelector("m3e-slide")?.classList.add("sliding");
27692
+ this.selectedTab?.control?.style.setProperty("--_tabs-slide-offset-x", `${dx}px`);
27693
+ const nextTab = this.tabs[dx > 0 ? this.selectedIndex - 1 : this.selectedIndex + 1];
27694
+ nextTab?.control?.style.setProperty("--_tabs-slide-offset-x", `${dx}px`);
27695
+ nextTab?.control?.style.setProperty("--_tabs-slide-visibility", "visible");
27696
+ const prevTab = this.tabs[dx > 0 ? this.selectedIndex + 1 : this.selectedIndex - 1];
27697
+ prevTab?.control?.style.removeProperty("--_tabs-slide-offset-x");
27698
+ prevTab?.control?.style.removeProperty("--_tabs-slide-visibility");
27699
+ };
27700
+ _M3eTabsElement_handleTabsPointerUp = function _M3eTabsElement_handleTabsPointerUp(e) {
27701
+ if (!e.currentTarget.hasPointerCapture(e.pointerId)) {
27702
+ return;
27703
+ }
27704
+ e.currentTarget.releasePointerCapture(e.pointerId);
27705
+ if (__classPrivateFieldGet(this, _M3eTabsElement_swipe, "f") && __classPrivateFieldGet(this, _M3eTabsElement_swipe, "f").dir === "horizontal" && __classPrivateFieldGet(this, _M3eTabsElement_swipe, "f").currentX !== undefined) {
27706
+ const dx = __classPrivateFieldGet(this, _M3eTabsElement_swipe, "f").currentX;
27707
+ const threshold = this.clientWidth * 0.33;
27708
+ const velocity = __classPrivateFieldGet(this, _M3eTabsElement_velocityTracker, "f").getVelocity();
27709
+ const significantVelocityThreshold = e.pointerType === "touch" ? 1200 : 500;
27710
+ __classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_endSwipeGesture).call(this);
27711
+ if (Math.abs(dx) > threshold || Math.abs(velocity) > significantVelocityThreshold) {
27712
+ if (dx > threshold) {
27713
+ // go to the previous tab only if its not disabled.
27714
+ if (this.selectedIndex > 0 && this.tabs.length > 1 && !this.tabs[this.selectedIndex - 1].disabled) {
27715
+ this.selectedIndex--;
27716
+ }
27717
+ } else if (dx < -threshold) {
27718
+ // go to the next tab only if its not disabled.
27719
+ if (this.selectedIndex < this.tabs.length - 1 && !this.tabs[this.selectedIndex + 1].disabled) {
27720
+ this.selectedIndex++;
27721
+ }
27722
+ }
27723
+ }
27724
+ } else {
27725
+ __classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_endSwipeGesture).call(this);
27726
+ }
27727
+ };
27728
+ _M3eTabsElement_handleTabsPointerCancel = function _M3eTabsElement_handleTabsPointerCancel(e) {
27729
+ if (e.currentTarget.hasPointerCapture(e.pointerId)) {
27730
+ e.currentTarget.releasePointerCapture(e.pointerId);
27731
+ __classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_endSwipeGesture).call(this);
27732
+ }
27733
+ };
27734
+ _M3eTabsElement_handleTabsLostPointerCapture = function _M3eTabsElement_handleTabsLostPointerCapture() {
27735
+ __classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_endSwipeGesture).call(this);
27736
+ };
27737
+ _M3eTabsElement_endSwipeGesture = function _M3eTabsElement_endSwipeGesture() {
27738
+ __classPrivateFieldSet(this, _M3eTabsElement_swipe, undefined, "f");
27739
+ __classPrivateFieldGet(this, _M3eTabsElement_velocityTracker, "f").reset();
27740
+ const slide = this.shadowRoot?.querySelector("m3e-slide");
27741
+ if (!slide || !slide.classList.contains("sliding")) {
27742
+ return;
27743
+ }
27744
+ slide.classList.add("snap");
27745
+ if (!prefersReducedMotion$1()) {
27746
+ slide.addEventListener("transitionend", () => slide.classList.remove("snap"), {
27747
+ once: true
27748
+ });
27749
+ }
27750
+ slide.classList.remove("sliding");
27751
+ this.tabs.forEach(x => {
27752
+ x.control?.style.removeProperty("--_tabs-slide-offset-x");
27753
+ x.control?.style.removeProperty("--_tabs-slide-visibility");
27754
+ });
27755
+ };
27756
+ _M3eTabsElement_scrollTabIntoView = /** @private */
27757
+ async function _M3eTabsElement_scrollTabIntoView(tab, instant) {
27758
+ await this.updateComplete;
27759
+ for (const tab of this.tabs) {
27760
+ await tab.updateComplete;
27761
+ }
27762
+ await this._tablist?.updateComplete;
27763
+ const scrollMargin = 48;
27764
+ const scrollContainer = this._tablist?.scrollContainer;
27765
+ if (!scrollContainer) return;
27766
+ scrollContainer?.scrollTo({
27767
+ behavior: instant ? "instant" : "smooth",
27768
+ top: 0,
27769
+ left: Math.min(tab.offsetLeft - scrollContainer.offsetLeft - scrollMargin, Math.max(tab.offsetLeft + tab.offsetWidth - scrollContainer.offsetWidth - scrollContainer.offsetLeft + scrollMargin, scrollContainer.scrollLeft))
27770
+ });
27596
27771
  __classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_updateInkBar).call(this);
27597
27772
  };
27598
27773
  _M3eTabsElement_updateInkBar = function _M3eTabsElement_updateInkBar() {
@@ -27622,13 +27797,14 @@ _M3eTabsElement_updateInkBar = function _M3eTabsElement_updateInkBar() {
27622
27797
  };
27623
27798
  /** The styles of the element. */
27624
27799
  M3eTabsElement.styles = css`:host { display: flex; flex-direction: column; position: relative; } .tablist { position: relative; box-sizing: border-box; flex: none; } ::slotted(prev-icon), ::slotted(next-icon), .icon { width: 1em; font-size: var(--m3e-tabs-paginator-button-icon-size, var(--m3e-icon-button-icon-size, 1.5rem)) !important; } .header { display: flex; flex-direction: column; } .tabs { display: flex; flex-wrap: nowrap; align-items: center; } .ink-bar { box-sizing: border-box; height: var(--_tabs-active-indicator-thickness); } .active-indicator { position: relative; height: var(--_tabs-active-indicator-thickness); left: calc(var(--_tabs-active-tab-position) + var(--_tabs-activate-indicator-inset, 0px)); width: calc(var(--_tabs-active-tab-size) - calc(var(--_tabs-activate-indicator-inset, 0px) * 2)); background-color: var(--m3e-tabs-active-indicator-color, ${DesignToken$1.color.primary}); transition: ${unsafeCSS(`left var(--m3e-slide-animation-duration, ${DesignToken$1.motion.duration.long2}) ${DesignToken$1.motion.easing.standard},
27625
- width var(--m3e-slide-animation-duration, ${DesignToken$1.motion.duration.long2}) ${DesignToken$1.motion.easing.standard}`)}; } :host([header-position="after"]) .header { flex-direction: column-reverse; } :host([header-position="before"]) .ink-bar { margin-top: calc(0px - var(--_tabs-active-indicator-thickness)); } :host([header-position="before"]) .tablist { --m3e-slide-group-divider-bottom: var(--m3e-divider-thickness, 1px) solid var(--m3e-divider-color, ${DesignToken$1.color.outlineVariant}); } :host([header-position="after"]) .ink-bar { margin-bottom: calc(0px - var(--_tabs-active-indicator-thickness)); } :host([header-position="after"]) .tablist { --m3e-slide-group-divider-top: var(--m3e-divider-thickness, 1px) solid var(--m3e-divider-color, ${DesignToken$1.color.outlineVariant}); } :host([header-position="before"][variant="primary"]) .active-indicator { border-radius: var(--m3e-tabs-primary-before-active-indicator-shape, ${DesignToken$1.shape.corner.extraSmallTop}); } :host([header-position="after"][variant="primary"]) .active-indicator { border-radius: var(--m3e-tabs-primary-after-active-indicator-shape, ${DesignToken$1.shape.corner.extraSmallBottom}); } .tabs { flex: 1 1 auto; } :host([variant="primary"]) .tablist { --_tabs-activate-indicator-inset: var(--m3e-tabs-primary-active-indicator-inset, 0.125rem); --_tabs-active-indicator-thickness: var(--m3e-tabs-primary-active-indicator-thickness, 3px); --_tab-height: 4rem; } :host([header-position="before"]) .tablist { --_tab-focus-ring-bottom-offset: calc(var(--_tabs-active-indicator-thickness) + 1px); } :host([header-position="after"]) .tablist { --_tab-focus-ring-top-offset: calc(var(--_tabs-active-indicator-thickness) + 2px); } :host([header-position="before"][variant="primary"]) .tablist { --_tab-direction: column; } :host([header-position="after"][variant="primary"]) .tablist { --_tab-direction: column-reverse; } :host([variant="secondary"]) .tablist { --_tabs-active-indicator-thickness: var(--m3e-tabs-secondary-active-indicator-thickness, 2px); --_tab-height: 3rem; --_tab-selected-color: ${DesignToken$1.color.onSurface}; --_tab-selected-container-hover-color: ${DesignToken$1.color.onSurface}; --_tab-selected-container-focus-color: ${DesignToken$1.color.onSurface}; --_tab-selected-ripple-color: ${DesignToken$1.color.onSurface}; } :host([stretch]) .header { width: 100%; --_tab-grow: 1; } :host(:is(:state(--no-animate), :--no-animate)) .active-indicator { transition: none; } @media (prefers-reduced-motion) { .active-indicator { transition: none; } } @media (forced-colors: active) { .active-indicator { background-color: ButtonText; --m3e-divider-color: GrayText; } }`;
27800
+ width var(--m3e-slide-animation-duration, ${DesignToken$1.motion.duration.long2}) ${DesignToken$1.motion.easing.standard}`)}; } :host([header-position="after"]) .header { flex-direction: column-reverse; } :host([header-position="before"]) .ink-bar { margin-top: calc(0px - var(--_tabs-active-indicator-thickness)); } :host([header-position="before"]) .tablist { --m3e-slide-group-divider-bottom: var(--m3e-divider-thickness, 1px) solid var(--m3e-divider-color, ${DesignToken$1.color.outlineVariant}); } :host([header-position="after"]) .ink-bar { margin-bottom: calc(0px - var(--_tabs-active-indicator-thickness)); } :host([header-position="after"]) .tablist { --m3e-slide-group-divider-top: var(--m3e-divider-thickness, 1px) solid var(--m3e-divider-color, ${DesignToken$1.color.outlineVariant}); } :host([header-position="before"][variant="primary"]) .active-indicator { border-radius: var(--m3e-tabs-primary-before-active-indicator-shape, ${DesignToken$1.shape.corner.extraSmallTop}); } :host([header-position="after"][variant="primary"]) .active-indicator { border-radius: var(--m3e-tabs-primary-after-active-indicator-shape, ${DesignToken$1.shape.corner.extraSmallBottom}); } .tabs { flex: 1 1 auto; } :host([variant="primary"]) .tablist { --_tabs-activate-indicator-inset: var(--m3e-tabs-primary-active-indicator-inset, 0.125rem); --_tabs-active-indicator-thickness: var(--m3e-tabs-primary-active-indicator-thickness, 3px); --_tab-height: 4rem; } :host([header-position="before"]) .tablist { --_tab-focus-ring-bottom-offset: calc(var(--_tabs-active-indicator-thickness) + 1px); } :host([header-position="after"]) .tablist { --_tab-focus-ring-top-offset: calc(var(--_tabs-active-indicator-thickness) + 2px); } :host([header-position="before"][variant="primary"]) .tablist { --_tab-direction: column; } :host([header-position="after"][variant="primary"]) .tablist { --_tab-direction: column-reverse; } :host([variant="secondary"]) .tablist { --_tabs-active-indicator-thickness: var(--m3e-tabs-secondary-active-indicator-thickness, 2px); --_tab-height: 3rem; --_tab-selected-color: ${DesignToken$1.color.onSurface}; --_tab-selected-container-hover-color: ${DesignToken$1.color.onSurface}; --_tab-selected-container-focus-color: ${DesignToken$1.color.onSurface}; --_tab-selected-ripple-color: ${DesignToken$1.color.onSurface}; } :host([stretch]) .header { width: 100%; --_tab-grow: 1; } .tabs.sliding ::slotted([slot="panel"]) { transform: translateX(var(--_tabs-slide-offset-x)); visibility: var(--_tabs-slide-visibility, "hidden"); } .tabs.snap ::slotted([slot="panel"]) { transition: ${unsafeCSS(`inset-inline-start var(--m3e-slide-animation-duration, ${DesignToken$1.motion.duration.long2}) ${DesignToken$1.motion.easing.standard},
27801
+ transform var(--m3e-slide-animation-duration, ${DesignToken$1.motion.duration.long2}) ${DesignToken$1.motion.easing.standard},
27802
+ visibility var(--m3e-slide-animation-duration, ${DesignToken$1.motion.duration.long2}) ${DesignToken$1.motion.easing.standard} allow-discrete`)}; } .tabs:not(.sliding) ::slotted([slot="panel"]) { transform: translateX(0); } :host(:is(:state(--no-animate), :--no-animate)) .active-indicator { transition: none; } @media (prefers-reduced-motion) { .active-indicator { transition: none; } .tabs.snap ::slotted([slot="panel"]) { transition: none; } } @media (forced-colors: active) { .active-indicator { background-color: ButtonText; --m3e-divider-color: GrayText; } }`;
27626
27803
  __decorate([query(".tablist")], M3eTabsElement.prototype, "_tablist", void 0);
27627
27804
  __decorate([state()], M3eTabsElement.prototype, "_selectedIndex", void 0);
27628
27805
  __decorate([property({
27629
- attribute: "disable-pagination",
27630
- type: Boolean
27631
- })], M3eTabsElement.prototype, "disablePagination", void 0);
27806
+ attribute: false
27807
+ })], M3eTabsElement.prototype, "disablePagination", null);
27632
27808
  __decorate([property({
27633
27809
  attribute: "header-position",
27634
27810
  reflect: true
@@ -32081,8 +32257,20 @@ let M3eThemeElement = class M3eThemeElement extends LitElement {
32081
32257
  /** @inheritdoc */
32082
32258
  connectedCallback() {
32083
32259
  super.connectedCallback();
32084
- if (this.shadowRoot && !this.shadowRoot.adoptedStyleSheets.includes(__classPrivateFieldGet(this, _M3eThemeElement_styleSheet, "f"))) {
32085
- this.shadowRoot.adoptedStyleSheets = [...this.shadowRoot.adoptedStyleSheets, __classPrivateFieldGet(this, _M3eThemeElement_styleSheet, "f")];
32260
+ if (this.parentElement instanceof HTMLBodyElement) {
32261
+ if (this.shadowRoot?.adoptedStyleSheets.includes(__classPrivateFieldGet(this, _M3eThemeElement_styleSheet, "f"))) {
32262
+ this.shadowRoot.adoptedStyleSheets = this.shadowRoot.adoptedStyleSheets.filter(x => x !== __classPrivateFieldGet(this, _M3eThemeElement_styleSheet, "f"));
32263
+ }
32264
+ if (!document.adoptedStyleSheets.includes(__classPrivateFieldGet(this, _M3eThemeElement_styleSheet, "f"))) {
32265
+ document.adoptedStyleSheets = [__classPrivateFieldGet(this, _M3eThemeElement_styleSheet, "f"), ...document.adoptedStyleSheets];
32266
+ }
32267
+ } else {
32268
+ if (document.adoptedStyleSheets.includes(__classPrivateFieldGet(this, _M3eThemeElement_styleSheet, "f"))) {
32269
+ document.adoptedStyleSheets = document.adoptedStyleSheets.filter(x => x !== __classPrivateFieldGet(this, _M3eThemeElement_styleSheet, "f"));
32270
+ }
32271
+ if (this.shadowRoot && !this.shadowRoot.adoptedStyleSheets.includes(__classPrivateFieldGet(this, _M3eThemeElement_styleSheet, "f"))) {
32272
+ this.shadowRoot.adoptedStyleSheets = [__classPrivateFieldGet(this, _M3eThemeElement_styleSheet, "f"), ...this.shadowRoot.adoptedStyleSheets];
32273
+ }
32086
32274
  }
32087
32275
  __classPrivateFieldSet(this, _M3eThemeElement_light, matchMedia("(prefers-color-scheme: light)"), "f");
32088
32276
  __classPrivateFieldSet(this, _M3eThemeElement_dark, matchMedia("(prefers-color-scheme: dark)"), "f");
@@ -32094,6 +32282,9 @@ let M3eThemeElement = class M3eThemeElement extends LitElement {
32094
32282
  super.disconnectedCallback();
32095
32283
  [__classPrivateFieldGet(this, _M3eThemeElement_light, "f"), __classPrivateFieldGet(this, _M3eThemeElement_dark, "f"), __classPrivateFieldGet(this, _M3eThemeElement_forcedColor, "f")].forEach(x => x?.removeEventListener("change", __classPrivateFieldGet(this, _M3eThemeElement_colorSchemeChangeHandler, "f")));
32096
32284
  __classPrivateFieldSet(this, _M3eThemeElement_light, __classPrivateFieldSet(this, _M3eThemeElement_dark, __classPrivateFieldSet(this, _M3eThemeElement_forcedColor, undefined, "f"), "f"), "f");
32285
+ if (document.adoptedStyleSheets.includes(__classPrivateFieldGet(this, _M3eThemeElement_styleSheet, "f"))) {
32286
+ document.adoptedStyleSheets = document.adoptedStyleSheets.filter(x => x !== __classPrivateFieldGet(this, _M3eThemeElement_styleSheet, "f"));
32287
+ }
32097
32288
  }
32098
32289
  /** @inheritdoc */
32099
32290
  updated(_changedProperties) {
@@ -32151,9 +32342,20 @@ _M3eThemeElement_apply = function _M3eThemeElement_apply(forceReflow) {
32151
32342
  css += `--md-sys-density-scale: ${this.density};`;
32152
32343
  css += `--m3e-scrollbar-thumb-color: ${hexFromArgb(scheme.neutralPalette.tone(60))};`;
32153
32344
  css += `--m3e-focus-ring-visibility: ${this.strongFocus ? "visible" : "hidden"};`;
32154
- __classPrivateFieldGet(this, _M3eThemeElement_styleSheet, "f").replaceSync(`:host { ${css} }`);
32345
+ css += `font-size: ${DesignToken$1.typescale.standard.body.large.fontSize};`;
32346
+ css += `font-weight: ${DesignToken$1.typescale.standard.body.large.fontWeight};`;
32347
+ css += `line-height: ${DesignToken$1.typescale.standard.body.large.lineHeight};`;
32348
+ css += `letter-spacing: ${DesignToken$1.typescale.standard.body.large.tracking};`;
32155
32349
  if (this.parentElement instanceof HTMLBodyElement) {
32156
- const computedStyle = getComputedStyle(this);
32350
+ __classPrivateFieldGet(this, _M3eThemeElement_styleSheet, "f").replaceSync(`
32351
+ html { ${css} }
32352
+ @media not (forced-colors: active) {
32353
+ body {
32354
+ background-color: var(--md-sys-color-background);
32355
+ color: var(--md-sys-color-on-background);
32356
+ scrollbar-color: ${DesignToken$1.scrollbar.color};
32357
+ }
32358
+ }`);
32157
32359
  switch (this.scheme) {
32158
32360
  case "light":
32159
32361
  document.documentElement.style.colorScheme = "light";
@@ -32169,13 +32371,8 @@ _M3eThemeElement_apply = function _M3eThemeElement_apply(forceReflow) {
32169
32371
  break;
32170
32372
  }
32171
32373
  }
32172
- if (__classPrivateFieldGet(this, _M3eThemeElement_forcedColor, "f")?.matches) {
32173
- this.parentElement.style.backgroundColor = this.parentElement.style.color = this.parentElement.ownerDocument.documentElement.style.scrollbarColor = this.parentElement.style.scrollbarColor = "";
32174
- } else {
32175
- this.parentElement.style.backgroundColor = computedStyle.getPropertyValue("--md-sys-color-background");
32176
- this.parentElement.style.color = computedStyle.getPropertyValue("--md-sys-color-on-background");
32177
- this.parentElement.ownerDocument.documentElement.style.scrollbarColor = this.parentElement.style.scrollbarColor = `${computedStyle.getPropertyValue("--m3e-scrollbar-thumb-color")} ${computedStyle.getPropertyValue("--m3e-scrollbar-track-color")}`;
32178
- }
32374
+ } else {
32375
+ __classPrivateFieldGet(this, _M3eThemeElement_styleSheet, "f").replaceSync(`:host { ${css} }`);
32179
32376
  }
32180
32377
  if (__classPrivateFieldGet(this, _M3eThemeElement_firstUpdated, "f")) {
32181
32378
  this.dispatchEvent(new Event("change", {
@@ -32198,7 +32395,7 @@ _M3eThemeElement_getContrastLevel = function _M3eThemeElement_getContrastLevel()
32198
32395
  }
32199
32396
  };
32200
32397
  /** The styles of the element. */
32201
- M3eThemeElement.styles = css`:host { display: contents; font-size: ${DesignToken$1.typescale.standard.body.large.fontSize}; font-weight: ${DesignToken$1.typescale.standard.body.large.fontWeight}; line-height: ${DesignToken$1.typescale.standard.body.large.lineHeight}; letter-spacing: ${DesignToken$1.typescale.standard.body.large.tracking}; }`;
32398
+ M3eThemeElement.styles = css`:host { display: contents; }`;
32202
32399
  __decorate([property()], M3eThemeElement.prototype, "color", void 0);
32203
32400
  __decorate([property()], M3eThemeElement.prototype, "scheme", void 0);
32204
32401
  __decorate([property()], M3eThemeElement.prototype, "contrast", void 0);