@m3e/web 2.5.1 → 2.5.3

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 (63) hide show
  1. package/dist/all.js +1046 -10
  2. package/dist/all.js.map +1 -1
  3. package/dist/all.min.js +156 -43
  4. package/dist/all.min.js.map +1 -1
  5. package/dist/breadcrumb.js +1 -0
  6. package/dist/breadcrumb.js.map +1 -1
  7. package/dist/breadcrumb.min.js.map +1 -1
  8. package/dist/calendar.js +18 -2
  9. package/dist/calendar.js.map +1 -1
  10. package/dist/calendar.min.js +5 -5
  11. package/dist/calendar.min.js.map +1 -1
  12. package/dist/core.js +2 -0
  13. package/dist/core.js.map +1 -1
  14. package/dist/core.min.js.map +1 -1
  15. package/dist/css-custom-data.json +333 -333
  16. package/dist/custom-elements.json +3863 -3780
  17. package/dist/datepicker.js +6 -0
  18. package/dist/datepicker.js.map +1 -1
  19. package/dist/datepicker.min.js +1 -1
  20. package/dist/datepicker.min.js.map +1 -1
  21. package/dist/html-custom-data.json +139 -139
  22. package/dist/list.js +1 -1
  23. package/dist/list.js.map +1 -1
  24. package/dist/list.min.js +1 -1
  25. package/dist/list.min.js.map +1 -1
  26. package/dist/nav-bar.js +7 -4
  27. package/dist/nav-bar.js.map +1 -1
  28. package/dist/nav-bar.min.js +1 -1
  29. package/dist/nav-bar.min.js.map +1 -1
  30. package/dist/search.js +2 -2
  31. package/dist/search.js.map +1 -1
  32. package/dist/search.min.js +1 -1
  33. package/dist/search.min.js.map +1 -1
  34. package/dist/slider.js +2 -0
  35. package/dist/slider.js.map +1 -1
  36. package/dist/slider.min.js.map +1 -1
  37. package/dist/src/breadcrumb/BreadcrumbItemElement.d.ts +1 -0
  38. package/dist/src/breadcrumb/BreadcrumbItemElement.d.ts.map +1 -1
  39. package/dist/src/calendar/CalendarElement.d.ts.map +1 -1
  40. package/dist/src/calendar/MonthViewElement.d.ts.map +1 -1
  41. package/dist/src/core/shared/primitives/SlideElement.d.ts +2 -0
  42. package/dist/src/core/shared/primitives/SlideElement.d.ts.map +1 -1
  43. package/dist/src/datepicker/DatepickerElement.d.ts.map +1 -1
  44. package/dist/src/list/ListItemButtonElement.d.ts +0 -5
  45. package/dist/src/list/ListItemButtonElement.d.ts.map +1 -1
  46. package/dist/src/nav-bar/NavItemElement.d.ts.map +1 -1
  47. package/dist/src/slider/SliderElement.d.ts +2 -0
  48. package/dist/src/slider/SliderElement.d.ts.map +1 -1
  49. package/dist/src/theme/ThemeElement.d.ts +2 -0
  50. package/dist/src/theme/ThemeElement.d.ts.map +1 -1
  51. package/dist/src/theme/getColorFromImage.d.ts +12 -0
  52. package/dist/src/theme/getColorFromImage.d.ts.map +1 -0
  53. package/dist/src/theme/index.d.ts +1 -0
  54. package/dist/src/theme/index.d.ts.map +1 -1
  55. package/dist/theme.js +1007 -1
  56. package/dist/theme.js.map +1 -1
  57. package/dist/theme.min.js +133 -20
  58. package/dist/theme.min.js.map +1 -1
  59. package/dist/toc.js +1 -1
  60. package/dist/toc.js.map +1 -1
  61. package/dist/toc.min.js +1 -1
  62. package/dist/toc.min.js.map +1 -1
  63. package/package.json +1 -1
package/dist/all.js CHANGED
@@ -2351,6 +2351,7 @@ var _M3eBreadcrumbItemElement_instances, _M3eBreadcrumbItemElement_defaultSepara
2351
2351
  * @tag m3e-breadcrumb-item
2352
2352
  *
2353
2353
  * @slot - Renders the content of the breadcrumb item.
2354
+ * @slot icon - Renders an icon before the item's label.
2354
2355
  *
2355
2356
  * @attr item-label - The accessible label used by the internal breadcrumb button.
2356
2357
  * @attr disabled - Whether the breadcrumb item is disabled.
@@ -4229,7 +4230,11 @@ _M3eMonthViewElement_handleItemClick = function _M3eMonthViewElement_handleItemC
4229
4230
  if (item.ariaDisabled === "true" || !item.dataset["value"]) return;
4230
4231
  this.activeDate = new Date(item.dataset["value"]);
4231
4232
  this.activeDate = clampDate(this.activeDate, this.minDate, this.maxDate);
4232
- if (this.rangeStart) {
4233
+ if (this.rangeEnd) {
4234
+ this.rangeStart = this.activeDate;
4235
+ this.rangeEnd = null;
4236
+ __classPrivateFieldGet(this, _M3eMonthViewElement_instances, "m", _M3eMonthViewElement_clearRangeHighlight).call(this);
4237
+ } else if (this.rangeStart) {
4233
4238
  if (compareDate(this.activeDate, this.rangeStart) < 0) {
4234
4239
  this.rangeStart = this.activeDate;
4235
4240
  this.rangeEnd = null;
@@ -4294,7 +4299,7 @@ _M3eMonthViewElement_handleItemFocus = function _M3eMonthViewElement_handleItemF
4294
4299
  };
4295
4300
  _M3eMonthViewElement_setRangeHighlight = function _M3eMonthViewElement_setRangeHighlight(item) {
4296
4301
  __classPrivateFieldGet(this, _M3eMonthViewElement_instances, "m", _M3eMonthViewElement_clearRangeHighlight).call(this);
4297
- if (this.rangeStart && item.dataset["value"]) {
4302
+ if (this.rangeStart && !this.rangeEnd && item.dataset["value"]) {
4298
4303
  if (compareDate(new Date(item.dataset["value"]), this.rangeStart) > 0) {
4299
4304
  item.parentElement.classList.add("range-highlight-end");
4300
4305
  }
@@ -4857,6 +4862,18 @@ let M3eCalendarElement = class M3eCalendarElement extends LitElement {
4857
4862
  if (changedProperties.has("startAt")) {
4858
4863
  this._activeDate = new Date(this.startAt ?? this.date ?? this._today);
4859
4864
  }
4865
+ if (changedProperties.has("rangeStart") && this.rangeStart) {
4866
+ this._activeDate = new Date(this.rangeStart);
4867
+ if (!changedProperties.has("date")) {
4868
+ this.date = new Date(this.rangeStart);
4869
+ }
4870
+ }
4871
+ if (changedProperties.has("rangeEnd") && this.rangeEnd) {
4872
+ this._activeDate = new Date(this.rangeEnd);
4873
+ if (!changedProperties.has("date")) {
4874
+ this.date = new Date(this.rangeEnd);
4875
+ }
4876
+ }
4860
4877
  if (changedProperties.has("startView")) {
4861
4878
  this._activeView = this.startView;
4862
4879
  }
@@ -11400,6 +11417,8 @@ var _M3eSlideElement_instances, _M3eSlideElement_items, _M3eSlideElement_handleS
11400
11417
  *
11401
11418
  * @tag m3e-slide
11402
11419
  *
11420
+ * @slot - Renders the items through which to cycle.
11421
+ *
11403
11422
  * @attr selected-index - The zero-based index of the visible item.
11404
11423
  *
11405
11424
  * @cssprop --m3e-slide-animation-duration - The duration of transitions between slotted items.
@@ -12217,6 +12236,12 @@ let M3eDatepickerElement = M3eDatepickerElement_1 = class M3eDatepickerElement e
12217
12236
  if (["date", "rangeStart", "rangeEnd"].some(x => changedProperties.has(x))) {
12218
12237
  __classPrivateFieldGet(this, _M3eDatepickerElement_instances, "m", _M3eDatepickerElement_clearSelectionState).call(this);
12219
12238
  }
12239
+ if (changedProperties.has("rangeStart") && this.rangeStart && !changedProperties.has("date")) {
12240
+ this.date = new Date(this.rangeStart);
12241
+ }
12242
+ if (changedProperties.has("rangeEnd") && this.rangeEnd && !changedProperties.has("date")) {
12243
+ this.date = new Date(this.rangeEnd);
12244
+ }
12220
12245
  if (changedProperties.has("variant")) {
12221
12246
  __classPrivateFieldGet(this, _M3eDatepickerElement_breakpointUnobserve, "f")?.call(this);
12222
12247
  if (this.variant === "auto") {
@@ -18120,7 +18145,7 @@ _M3eListOptionElement_handleClick = function _M3eListOptionElement_handleClick(e
18120
18145
  }
18121
18146
  };
18122
18147
  /** The styles of the element. */
18123
- M3eListOptionElement.styles = [M3eListItemElement.styles, css`:host { outline: none; user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } .base { position: relative; } .indicator { min-width: 1.5rem; min-height: 1.5rem; display: flex; align-items: center; justify-content: center; } :host(:not(:disabled)) { cursor: pointer; } :host(:state(-three-line)) .indicator { align-self: flex-start; margin-top: var(--m3e-list-item-three-line-top-offset, 0.25rem); } :host([selected]) .base, :host([selected]) .state-layer, :host([selected]) .ripple, :host([selected]) .focus-ring { border-radius: var(--m3e-list-item-selected-container-shape, ${DesignToken$1.shape.corner.large}); } :host([selected]:not(:disabled)) .base { color: var(--m3e-list-item-selected-label-text-color, ${DesignToken$1.color.onSecondaryContainer}); } :host([selected]:not(:disabled)) ::slotted([slot="overline"]) { color: var(--m3e-list-item-selected-overline-color, ${DesignToken$1.color.onSecondaryContainer}); } :host([selected]:not(:disabled)) ::slotted([slot="supporting-text"]) { color: var(--m3e-list-item-selected-supporting-text-color, ${DesignToken$1.color.onSecondaryContainer}); } :host([selected]:not(:disabled)) ::slotted([slot="leading"]) { color: var(--m3e-list-item-selected-leading-color, ${DesignToken$1.color.onSecondaryContainer}); } :host([selected]:not(:disabled)) ::slotted([slot="trailing"]) { color: var(--m3e-list-item-selected-trailing-color, ${DesignToken$1.color.onSecondaryContainer}); } :host([selected]:not(:disabled)) .base { background-color: var(--m3e-list-item-selected-container-color, ${DesignToken$1.color.secondaryContainer}); } :host([selected]:disabled) .base { background-color: color-mix( in srgb, var(--m3e-list-item-selected-disabled-container-color, ${DesignToken$1.color.onSurface}) var(--m3e-list-item-selected-disabled-container-opacity, 10%), transparent ); } :host([selected]:not(:disabled)) .state-layer { --m3e-state-layer-hover-color: var( --m3e-list-item-selected-hover-state-layer-color, ${DesignToken$1.color.onSurface} ); --m3e-state-layer-hover-opacity: var( --m3e-list-item-selected-hover-state-layer-opacity, ${DesignToken$1.state.hoverStateLayerOpacity} ); --m3e-state-layer-focus-color: var( --m3e-list-item-selected-focus-state-layer-color, ${DesignToken$1.color.onSurface} ); --m3e-state-layer-focus-opacity: var( --m3e-list-item-selected-focus-state-layer-opacity, ${DesignToken$1.state.focusStateLayerOpacity} ); } :host([selected]:not(:disabled)) .ripple { --m3e-ripple-color: var(--m3e-list-item-selected-pressed-state-layer-color, ${DesignToken$1.color.onSurface}); --m3e-ripple-opacity: var( --m3e-list-item-selected-pressed-state-layer-opacity, ${DesignToken$1.state.pressedStateLayerOpacity} ); } :host(:state(-hide-selection)) .indicator, :host(:not(:state(-hide-selection))) ::slotted([slot="trailing"]) { display: none; } @media (forced-colors: active) { :host([selected]:not(:disabled)) .content, :host([selected]:not(:disabled)) ::slotted([slot="overline"]), :host([selected]:not(:disabled)) ::slotted([slot="supporting-text"]), :host([selected]:not(:disabled)) ::slotted([slot="leading"]), :host([selected]:not(:disabled)) ::slotted([slot="trailing"]) { color: HighlightText; forced-color-adjust: none; } :host([selected]:not(:disabled)) .base { background-color: Highlight; } }`];
18148
+ M3eListOptionElement.styles = [M3eListItemElement.styles, css`:host { outline: none; user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } .base { position: relative; } .indicator { min-width: 1.5rem; min-height: 1.5rem; display: flex; align-items: center; justify-content: center; } :host(:not(:disabled)) { cursor: pointer; } :host(:state(-three-line)) .indicator { align-self: flex-start; margin-top: var(--m3e-list-item-three-line-top-offset, 0.25rem); } :host([selected]) .base, :host([selected]) .state-layer, :host([selected]) .ripple, :host([selected]) .focus-ring { border-radius: var(--m3e-list-item-selected-container-shape, ${DesignToken$1.shape.corner.large}); } :host([selected]:not(:disabled)) .content { color: var(--m3e-list-item-selected-label-text-color, ${DesignToken$1.color.onSecondaryContainer}); } :host([selected]:not(:disabled)) ::slotted([slot="overline"]) { color: var(--m3e-list-item-selected-overline-color, ${DesignToken$1.color.onSecondaryContainer}); } :host([selected]:not(:disabled)) ::slotted([slot="supporting-text"]) { color: var(--m3e-list-item-selected-supporting-text-color, ${DesignToken$1.color.onSecondaryContainer}); } :host([selected]:not(:disabled)) ::slotted([slot="leading"]) { color: var(--m3e-list-item-selected-leading-color, ${DesignToken$1.color.onSecondaryContainer}); } :host([selected]:not(:disabled)) ::slotted([slot="trailing"]) { color: var(--m3e-list-item-selected-trailing-color, ${DesignToken$1.color.onSecondaryContainer}); } :host([selected]:not(:disabled)) .base { background-color: var(--m3e-list-item-selected-container-color, ${DesignToken$1.color.secondaryContainer}); } :host([selected]:disabled) .base { background-color: color-mix( in srgb, var(--m3e-list-item-selected-disabled-container-color, ${DesignToken$1.color.onSurface}) var(--m3e-list-item-selected-disabled-container-opacity, 10%), transparent ); } :host([selected]:not(:disabled)) .state-layer { --m3e-state-layer-hover-color: var( --m3e-list-item-selected-hover-state-layer-color, ${DesignToken$1.color.onSurface} ); --m3e-state-layer-hover-opacity: var( --m3e-list-item-selected-hover-state-layer-opacity, ${DesignToken$1.state.hoverStateLayerOpacity} ); --m3e-state-layer-focus-color: var( --m3e-list-item-selected-focus-state-layer-color, ${DesignToken$1.color.onSurface} ); --m3e-state-layer-focus-opacity: var( --m3e-list-item-selected-focus-state-layer-opacity, ${DesignToken$1.state.focusStateLayerOpacity} ); } :host([selected]:not(:disabled)) .ripple { --m3e-ripple-color: var(--m3e-list-item-selected-pressed-state-layer-color, ${DesignToken$1.color.onSurface}); --m3e-ripple-opacity: var( --m3e-list-item-selected-pressed-state-layer-opacity, ${DesignToken$1.state.pressedStateLayerOpacity} ); } :host(:state(-hide-selection)) .indicator, :host(:not(:state(-hide-selection))) ::slotted([slot="trailing"]) { display: none; } @media (forced-colors: active) { :host([selected]:not(:disabled)) .content, :host([selected]:not(:disabled)) ::slotted([slot="overline"]), :host([selected]:not(:disabled)) ::slotted([slot="supporting-text"]), :host([selected]:not(:disabled)) ::slotted([slot="leading"]), :host([selected]:not(:disabled)) ::slotted([slot="trailing"]) { color: HighlightText; forced-color-adjust: none; } :host([selected]:not(:disabled)) .base { background-color: Highlight; } }`];
18124
18149
  __decorate([query(".focus-ring")], M3eListOptionElement.prototype, "_focusRing", void 0);
18125
18150
  __decorate([query(".state-layer")], M3eListOptionElement.prototype, "_stateLayer", void 0);
18126
18151
  __decorate([query(".ripple")], M3eListOptionElement.prototype, "_ripple", void 0);
@@ -19563,7 +19588,7 @@ __decorate([property({
19563
19588
  })], M3eNavBarElement.prototype, "mode", void 0);
19564
19589
  M3eNavBarElement = __decorate([customElement$1("m3e-nav-bar")], M3eNavBarElement);
19565
19590
 
19566
- var _M3eNavItemElement_instances, _M3eNavItemElement_clickHandler, _M3eNavItemElement_handleClick;
19591
+ var _M3eNavItemElement_instances, _M3eNavItemElement_clickHandler, _M3eNavItemElement_handleClick, _M3eNavItemElement_handleSelectedIconSlotChange;
19567
19592
  /**
19568
19593
  * An item, placed in a navigation bar or rail, used to navigate to destinations in an application.
19569
19594
  *
@@ -19689,7 +19714,7 @@ let M3eNavItemElement = class M3eNavItemElement extends LinkButton$1(Selected$1(
19689
19714
  /** @inheritdoc */
19690
19715
  render() {
19691
19716
  const disabled = this.disabled || this.disabledInteractive;
19692
- return html`${this.orientation === "vertical" ? html`<m3e-focus-ring class="focus-ring" inward></m3e-focus-ring>` : nothing}<div class="outer">${this[renderPseudoLink$1]()}<div class="inner">${this.orientation === "horizontal" ? html`<m3e-focus-ring class="focus-ring"></m3e-focus-ring>` : nothing}<m3e-state-layer class="state-layer" ?disabled="${disabled}"></m3e-state-layer><m3e-ripple class="ripple" centered ?disabled="${disabled}"></m3e-ripple><div class="touch" aria-hidden="true"></div><div class="base"><div class="icon-wrapper" aria-hidden="true"><div class="icon"><slot name="icon" aria-hidden="true"></slot></div></div><div class="label"><slot></slot></div></div></div></div>`;
19717
+ return html`${this.orientation === "vertical" ? html`<m3e-focus-ring class="focus-ring" inward></m3e-focus-ring>` : nothing}<div class="outer">${this[renderPseudoLink$1]()}<div class="inner">${this.orientation === "horizontal" ? html`<m3e-focus-ring class="focus-ring"></m3e-focus-ring>` : nothing}<m3e-state-layer class="state-layer" ?disabled="${disabled}"></m3e-state-layer><m3e-ripple class="ripple" centered ?disabled="${disabled}"></m3e-ripple><div class="touch" aria-hidden="true"></div><div class="base"><div class="icon-wrapper" aria-hidden="true"><div class="icon" aria-hidden="true"><slot name="icon"></slot><slot name="selected-icon" @slotchange="${__classPrivateFieldGet(this, _M3eNavItemElement_instances, "m", _M3eNavItemElement_handleSelectedIconSlotChange)}"></slot></div></div><div class="label"><slot></slot></div></div></div></div>`;
19693
19718
  }
19694
19719
  };
19695
19720
  _M3eNavItemElement_clickHandler = new WeakMap();
@@ -19710,8 +19735,11 @@ _M3eNavItemElement_handleClick = function _M3eNavItemElement_handleClick(e) {
19710
19735
  this.selected = false;
19711
19736
  }
19712
19737
  };
19738
+ _M3eNavItemElement_handleSelectedIconSlotChange = function _M3eNavItemElement_handleSelectedIconSlotChange(e) {
19739
+ setCustomState$1(this, "-with-selected-icon", hasAssignedNodes$1(e.target));
19740
+ };
19713
19741
  /** The styles of the element. */
19714
- M3eNavItemElement.styles = css`:host { display: inline-block; vertical-align: middle; position: relative; outline: none; user-select: none; flex: 1; font-size: var(--m3e-nav-item-label-text-font-size, ${DesignToken$1.typescale.standard.label.medium.fontSize}); font-weight: var( --m3e-nav-item-label-text-font-weight, ${DesignToken$1.typescale.standard.label.medium.fontWeight} ); line-height: var( --m3e-nav-item-label-text-line-height, ${DesignToken$1.typescale.standard.label.medium.lineHeight} ); letter-spacing: var(--m3e-nav-item-label-text-tracking, ${DesignToken$1.typescale.standard.label.medium.tracking}); border-radius: var(--m3e-nav-item-shape, ${DesignToken$1.shape.corner.full}); min-width: var(--_nav-item-min-width); align-self: var(--_nav-item-align-self); -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } :host([orientation="horizontal"]) { max-width: fit-content; } :host(:not(:disabled):not([disabled-interactive])) { cursor: pointer; } :host([disabled-interactive]) { cursor: not-allowed; } .outer { height: 100%; } .outer, .inner { display: flex; align-items: center; justify-content: var(--_nav-item-justify-content, center); position: relative; border-radius: inherit; } .icon-wrapper { position: relative; flex: none; } .base { justify-content: unset; box-sizing: border-box; vertical-align: middle; display: inline-flex; align-items: center; justify-content: center; position: relative; width: 100%; } .icon { position: absolute; } .label { vertical-align: middle; } ::slotted([slot="icon"]), ::slotted([slot="selected-icon"]) { width: 1em; font-size: var(--m3e-nav-item-icon-size, 1.5rem) !important; } :host(:not([selected]):not(:disabled):not([disabled-interactive])) .outer { --m3e-state-layer-hover-color: var( --m3e-nav-item-inactive-hover-state-layer-color, ${DesignToken$1.color.onSecondaryContainer} ); --m3e-state-layer-focus-color: var( --m3e-nav-item-inactive-focus-state-layer-color, ${DesignToken$1.color.onSecondaryContainer} ); --m3e-ripple-color: var( --m3e-nav-item-inactive-pressed-state-layer-color, ${DesignToken$1.color.onSecondaryContainer} ); } :host(:not([selected]):not(:disabled):not([disabled-interactive])) .label { color: var(--m3e-nav-item-inactive-label-text-color, ${DesignToken$1.color.onSurfaceVariant}); } :host(:not([selected]):not(:disabled):not([disabled-interactive])) .icon { color: var(--m3e-nav-item-inactive-icon-color, ${DesignToken$1.color.onSecondaryContainer}); } :host([selected]:not(:disabled):not([disabled-interactive])) .outer { --m3e-state-layer-hover-color: var( --m3e-nav-item-active-hover-state-layer-color, ${DesignToken$1.color.onSecondaryContainer} ); --m3e-state-layer-focus-color: var( --m3e-nav-item-active-focus-state-layer-color, ${DesignToken$1.color.onSecondaryContainer} ); --m3e-ripple-color: var( --m3e-nav-item-active-pressed-state-layer-color, ${DesignToken$1.color.onSecondaryContainer} ); } :host([selected]:not(:disabled):not([disabled-interactive])) .label { color: var(--m3e-nav-item-active-label-text-color, ${DesignToken$1.color.secondary}); } :host([selected]:not(:disabled):not([disabled-interactive])) .state-layer { background-color: var(--m3e-nav-item-active-container-color, ${DesignToken$1.color.secondaryContainer}); } :host([selected]:not(:disabled):not([disabled-interactive])) .icon { color: var(--m3e-nav-item-active-icon-color, ${DesignToken$1.color.onSecondaryContainer}); } :host([orientation="vertical"]) .outer { align-self: stretch; align-items: flex-start; } :host([orientation="vertical"]) .label { text-align: center; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-clamp: 2; } :host([orientation="vertical"]) .base { flex-direction: column; row-gap: var(--m3e-nav-item-spacing, 0.25rem); } :host([orientation="vertical"]) .base { margin-block: var(--m3e-vertical-nav-item-active-indicator-margin, 0.375rem); } :host([orientation="vertical"]) .state-layer, :host([orientation="vertical"]) .ripple { top: var(--m3e-vertical-nav-item-active-indicator-margin, 0.375rem); bottom: unset; } :host([orientation="vertical"]) .state-layer, :host([orientation="vertical"]) .ripple, :host([orientation="vertical"]) .icon-wrapper { width: var(--m3e-vertical-nav-item-active-indicator-width, 3.5rem); } :host([orientation="vertical"]) .state-layer, :host([orientation="vertical"]) .ripple, :host([orientation="vertical"]) .icon-wrapper { height: var(--m3e-vertical-nav-item-active-indicator-height, 2rem); } :host([orientation="vertical"]) .icon { top: calc( calc(var(--m3e-vertical-nav-item-active-indicator-height, 2rem) / 2) - calc( var(--m3e-nav-item-icon-size, 1.5rem) / 2 ) ); left: calc( calc(var(--m3e-vertical-nav-item-active-indicator-width, 3.5rem) / 2) - calc( var(--m3e-nav-item-icon-size, 1.5rem) / 2 ) ); } :host([orientation="vertical"]) .focus-ring { border-radius: var(--m3e-nav-item-focus-ring-shape, ${DesignToken$1.shape.corner.medium}); } :host([orientation="horizontal"]) .icon-wrapper { width: var(--m3e-nav-item-icon-size, 1.5rem); height: var(--m3e-nav-item-icon-size, 1.5rem); } :host([orientation="horizontal"]) .base { padding: var(--m3e-horizontal-nav-item-padding, 1rem); } :host([orientation="horizontal"]) .label { flex: 1 1 auto; } :host([orientation="horizontal"]) .base { column-gap: var(--m3e-nav-item-spacing, 0.25rem); } :host([orientation="horizontal"]) .inner { height: var(--m3e-horizontal-nav-item-active-indicator-height, 2.5rem); width: fit-content; } .state-layer, .ripple { margin-inline: auto; } :host(:disabled) .label, :host([disabled-interactive]) .label { color: color-mix( in srgb, var(--m3e-nav-item-disabled-label-text-color, ${DesignToken$1.color.onSurface}) var(--m3e-nav-item-disabled-label-text-opacity, 38%), transparent ); } :host(:disabled) .icon, :host([disabled-interactive]) .icon { color: color-mix( in srgb, var(--m3e-nav-item-disabled-icon-color, ${DesignToken$1.color.onSurface}) var(--m3e-nav-item-disabled-icon-opacity, 38%), transparent ); } a { all: unset; display: block; position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; z-index: 1; } @media (forced-colors: active) { :host(:disabled) .label, :host([disabled-interactive]) .label, :host(:disabled) .icon, :host([disabled-interactive]) .icon { color: GrayText; } :host(:not([selected]):not(:disabled):not([disabled-interactive])) .label, :host(:not([selected]):not(:disabled):not([disabled-interactive])) .icon { color: ButtonText; } :host([selected]:not(:disabled):not([disabled-interactive])) .state-layer { background-color: ButtonText; } :host([orientation="vertical"][selected]:not(:disabled):not([disabled-interactive])) .label { color: ButtonText; } :host([orientation="horizontal"][selected]:not(:disabled):not([disabled-interactive])) .label, :host([selected]:not(:disabled):not([disabled-interactive])) .icon { forced-color-adjust: none; color: ButtonFace; } }`;
19742
+ M3eNavItemElement.styles = css`:host { display: inline-block; vertical-align: middle; position: relative; outline: none; user-select: none; flex: 1; font-size: var(--m3e-nav-item-label-text-font-size, ${DesignToken$1.typescale.standard.label.medium.fontSize}); font-weight: var( --m3e-nav-item-label-text-font-weight, ${DesignToken$1.typescale.standard.label.medium.fontWeight} ); line-height: var( --m3e-nav-item-label-text-line-height, ${DesignToken$1.typescale.standard.label.medium.lineHeight} ); letter-spacing: var(--m3e-nav-item-label-text-tracking, ${DesignToken$1.typescale.standard.label.medium.tracking}); border-radius: var(--m3e-nav-item-shape, ${DesignToken$1.shape.corner.full}); min-width: var(--_nav-item-min-width); align-self: var(--_nav-item-align-self); -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } :host([orientation="horizontal"]) { max-width: fit-content; } :host(:not(:disabled):not([disabled-interactive])) { cursor: pointer; } :host([disabled-interactive]) { cursor: not-allowed; } .outer { height: 100%; } .outer, .inner { display: flex; align-items: center; justify-content: var(--_nav-item-justify-content, center); position: relative; border-radius: inherit; } .icon-wrapper { position: relative; flex: none; } .base { justify-content: unset; box-sizing: border-box; vertical-align: middle; display: inline-flex; align-items: center; justify-content: center; position: relative; width: 100%; } .icon { position: absolute; } .label { vertical-align: middle; } ::slotted([slot="icon"]), ::slotted([slot="selected-icon"]) { width: 1em; font-size: var(--m3e-nav-item-icon-size, 1.5rem) !important; } :host(:not([selected])) slot[name="selected-icon"], :host(:not(:state(-with-selected-icon))) slot[name="selected-icon"], :host([selected]:state(-with-selected-icon)) slot[name="icon"] { display: none; } :host(:not([selected]):not(:disabled):not([disabled-interactive])) .outer { --m3e-state-layer-hover-color: var( --m3e-nav-item-inactive-hover-state-layer-color, ${DesignToken$1.color.onSecondaryContainer} ); --m3e-state-layer-focus-color: var( --m3e-nav-item-inactive-focus-state-layer-color, ${DesignToken$1.color.onSecondaryContainer} ); --m3e-ripple-color: var( --m3e-nav-item-inactive-pressed-state-layer-color, ${DesignToken$1.color.onSecondaryContainer} ); } :host(:not([selected]):not(:disabled):not([disabled-interactive])) .label { color: var(--m3e-nav-item-inactive-label-text-color, ${DesignToken$1.color.onSurfaceVariant}); } :host(:not([selected]):not(:disabled):not([disabled-interactive])) .icon { color: var(--m3e-nav-item-inactive-icon-color, ${DesignToken$1.color.onSurfaceVariant}); } :host([selected]:not(:disabled):not([disabled-interactive])) .outer { --m3e-state-layer-hover-color: var( --m3e-nav-item-active-hover-state-layer-color, ${DesignToken$1.color.onSecondaryContainer} ); --m3e-state-layer-focus-color: var( --m3e-nav-item-active-focus-state-layer-color, ${DesignToken$1.color.onSecondaryContainer} ); --m3e-ripple-color: var( --m3e-nav-item-active-pressed-state-layer-color, ${DesignToken$1.color.onSecondaryContainer} ); } :host([selected]:not(:disabled):not([disabled-interactive]):not([orientation="horizontal"])) .label { color: var(--m3e-nav-item-active-label-text-color, ${DesignToken$1.color.secondary}); } :host([selected]:not(:disabled):not([disabled-interactive])) .state-layer { background-color: var(--m3e-nav-item-active-container-color, ${DesignToken$1.color.secondaryContainer}); } :host([selected]:not(:disabled):not([disabled-interactive])[orientation="horizontal"]) .label, :host([selected]:not(:disabled):not([disabled-interactive])) .icon { color: var(--m3e-nav-item-active-icon-color, ${DesignToken$1.color.onSecondaryContainer}); } :host([orientation="vertical"]) .outer { align-self: stretch; align-items: flex-start; } :host([orientation="vertical"]) .label { text-align: center; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-clamp: 2; } :host([orientation="vertical"]) .base { flex-direction: column; row-gap: var(--m3e-nav-item-spacing, 0.25rem); } :host([orientation="vertical"]) .base { margin-block: var(--m3e-vertical-nav-item-active-indicator-margin, 0.375rem); } :host([orientation="vertical"]) .state-layer, :host([orientation="vertical"]) .ripple { top: var(--m3e-vertical-nav-item-active-indicator-margin, 0.375rem); bottom: unset; } :host([orientation="vertical"]) .state-layer, :host([orientation="vertical"]) .ripple, :host([orientation="vertical"]) .icon-wrapper { width: var(--m3e-vertical-nav-item-active-indicator-width, 3.5rem); } :host([orientation="vertical"]) .state-layer, :host([orientation="vertical"]) .ripple, :host([orientation="vertical"]) .icon-wrapper { height: var(--m3e-vertical-nav-item-active-indicator-height, 2rem); } :host([orientation="vertical"]) .icon { top: calc( calc(var(--m3e-vertical-nav-item-active-indicator-height, 2rem) / 2) - calc( var(--m3e-nav-item-icon-size, 1.5rem) / 2 ) ); left: calc( calc(var(--m3e-vertical-nav-item-active-indicator-width, 3.5rem) / 2) - calc( var(--m3e-nav-item-icon-size, 1.5rem) / 2 ) ); } :host([orientation="vertical"]) .focus-ring { border-radius: var(--m3e-nav-item-focus-ring-shape, ${DesignToken$1.shape.corner.medium}); } :host([orientation="horizontal"]) .icon-wrapper { width: var(--m3e-nav-item-icon-size, 1.5rem); height: var(--m3e-nav-item-icon-size, 1.5rem); } :host([orientation="horizontal"]) .base { padding: var(--m3e-horizontal-nav-item-padding, 1rem); } :host([orientation="horizontal"]) .label { flex: 1 1 auto; } :host([orientation="horizontal"]) .base { column-gap: var(--m3e-nav-item-spacing, 0.25rem); } :host([orientation="horizontal"]) .inner { height: var(--m3e-horizontal-nav-item-active-indicator-height, 2.5rem); width: fit-content; } .state-layer, .ripple { margin-inline: auto; } :host(:disabled) .label, :host([disabled-interactive]) .label { color: color-mix( in srgb, var(--m3e-nav-item-disabled-label-text-color, ${DesignToken$1.color.onSurface}) var(--m3e-nav-item-disabled-label-text-opacity, 38%), transparent ); } :host(:disabled) .icon, :host([disabled-interactive]) .icon { color: color-mix( in srgb, var(--m3e-nav-item-disabled-icon-color, ${DesignToken$1.color.onSurface}) var(--m3e-nav-item-disabled-icon-opacity, 38%), transparent ); } a { all: unset; display: block; position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; z-index: 1; } @media (forced-colors: active) { :host(:disabled) .label, :host([disabled-interactive]) .label, :host(:disabled) .icon, :host([disabled-interactive]) .icon { color: GrayText; } :host(:not([selected]):not(:disabled):not([disabled-interactive])) .label, :host(:not([selected]):not(:disabled):not([disabled-interactive])) .icon { color: ButtonText; } :host([selected]:not(:disabled):not([disabled-interactive])) .state-layer { background-color: ButtonText; } :host([orientation="vertical"][selected]:not(:disabled):not([disabled-interactive])) .label { color: ButtonText; } :host([orientation="horizontal"][selected]:not(:disabled):not([disabled-interactive])) .label, :host([selected]:not(:disabled):not([disabled-interactive])) .icon { forced-color-adjust: none; color: ButtonFace; } }`;
19715
19743
  __decorate([query(".focus-ring")], M3eNavItemElement.prototype, "_focusRing", void 0);
19716
19744
  __decorate([query(".state-layer")], M3eNavItemElement.prototype, "_stateLayer", void 0);
19717
19745
  __decorate([query(".ripple")], M3eNavItemElement.prototype, "_ripple", void 0);
@@ -22271,9 +22299,9 @@ const SearchViewLightDomStyle = css`m3e-search-view input[slot="input"]::placeho
22271
22299
  * Styles for `M3eSearchViewElement`.
22272
22300
  * @internal
22273
22301
  */
22274
- const SearchViewStyle = css`:host { display: block; } .base { position: relative; width: 100%; } .anchor { position: absolute; width: 100%; visibility: hidden; } .view { display: flex; flex-direction: column; box-sizing: border-box; width: 100%; outline: none; padding: unset; margin: unset; border: unset; } .header { flex: none; display: flex; align-items: center; } .bar { flex: 1 1 auto; } :host(:state(-fullscreen)) .bar { transition: ${unsafeCSS(`margin ${DesignToken$1.motion.duration.short2} ${DesignToken$1.motion.easing.standard}`)}; } :host(:state(-fullscreen)[contained]:not([open])) .bar { margin-inline-start: ${SearchViewToken.containedLeadingMargin}; margin-inline-end: ${SearchViewToken.containedTrailingMargin}; } :host(:state(-fullscreen)[contained][open]) .bar, :host(:state(-fullscreen)[contained][open]) .results { margin-inline-start: ${SearchViewToken.containedFocusedLeadingMargin}; margin-inline-end: ${SearchViewToken.containedFocusedTrailingMargin}; } .icon { display: flex; align-items: center; justify-content: center; box-sizing: border-box; min-width: 3rem; } ::slotted([slot="search-icon"]), .search-icon, ::slotted([slot="close-icon"]), .close-icon { width: 1em; font-size: ${SearchBarToken.iconSize} !important; } .results { overflow: hidden; flex: 1 1 auto; display: flex; flex-direction: column; } .scroll-container { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; scrollbar-color: ${DesignToken$1.scrollbar.color}; } .view:not(:popover-open) .results, .view.closing .results { display: none; } :host(:not(:is(:state(-clearable), [open]))) .clear { display: none; } ::slotted([slot="clear-icon"]), .clear-icon { width: 1em; font-size: ${SearchBarToken.iconSize} !important; } slot[name="clear-icon"] { --m3e-icon-size: ${SearchBarToken.iconSize}; } :host(:state(-fullscreen)) .header { transition: height 150ms cubic-bezier(0.2, 0, 0, 1); } :host(:state(-fullscreen)) .view:popover-open:not(.closing) .header { height: ${SearchViewToken.fullScreenHeaderContainerHeight}; } :host(:state(-fullscreen):not([open])) .header, :host(:state(-fullscreen)[open]) .view.closing .header { height: ${SearchViewToken.containedFullScreenBarContainerHeight}; } :host(:state(-fullscreen)[open]) .bar { --m3e-search-bar-container-height: ${SearchViewToken.containedFullScreenBarContainerHeight}; } :host(:state(-fullscreen)) .anchor { height: ${SearchViewToken.containedFullScreenBarContainerHeight}; } :host(:state(-fullscreen)) .view:popover-open { border-radius: ${SearchViewToken.fullScreenContainerShape}; } :host(:state(-fullscreen)[contained]) .view:popover-open { background-color: ${SearchViewToken.containedContainerColor}; } :host(:state(-fullscreen):not([contained])) .view:popover-open { background-color: ${SearchViewToken.containerColor}; } :host(:state(-docked)[open]) .header, :host(:state(-docked)) .anchor { height: ${SearchViewToken.dockedHeaderContainerHeight}; } :host(:not([contained])[open]) .results { border-top-width: ${SearchViewToken.dividerThickness}; border-top-style: solid; border-top-color: ${SearchViewToken.dividerColor}; } :host(:state(-docked)[contained]) .results { margin-top: ${SearchViewToken.containedDockedBarResultsGap}; } :host(:state(-docked):not([contained])[open]) .view { background-color: ${SearchViewToken.containerColor}; --m3e-search-bar-container-color: ${SearchViewToken.containerColor}; } :host(:state(-docked)[contained]) .results { background-color: ${SearchViewToken.containerColor}; } :host(:state(-docked):not([contained])[open]) .view, :host(:state(-docked)[contained]) .results { border-radius: ${SearchViewToken.dockedContainerShape}; } :host(:state(-docked)) .results { min-height: calc(${SearchViewToken.dockedContainerMinHeight} - ${SearchViewToken.dockedHeaderContainerHeight}); max-height: calc(${SearchViewToken.dockedContainerMaxHeight} - ${SearchViewToken.dockedHeaderContainerHeight}); } :host(:state(-docked)) .scroll-container { scrollbar-width: ${DesignToken$1.scrollbar.thinWidth}; } :host(:state(-docked):not([contained])) .scroll-container { padding-bottom: ${SearchViewToken.dockedResultsBottomSpace}; } :host(:state(-docked)[contained]) .scroll-container { padding: ${SearchViewToken.containedDockedResultsSpace}; } :host(:state(-docked)) .results { transform-origin: top; transition: ${unsafeCSS(`transform ${DesignToken$1.motion.duration.short2} ${DesignToken$1.motion.easing.standard},
22302
+ const SearchViewStyle = css`:host { display: block; } .base { position: relative; width: 100%; } .anchor { position: absolute; width: 100%; visibility: hidden; } .view { display: flex; flex-direction: column; box-sizing: border-box; width: 100%; outline: none; padding: unset; margin: unset; border: unset; } .header { flex: none; display: flex; align-items: center; } .bar { flex: 1 1 auto; } :host(:state(-fullscreen)) .bar { transition: ${unsafeCSS(`margin ${DesignToken$1.motion.duration.short2} ${DesignToken$1.motion.easing.standard}`)}; } :host(:state(-fullscreen)[contained]:not([open])) .bar { margin-inline-start: ${SearchViewToken.containedLeadingMargin}; margin-inline-end: ${SearchViewToken.containedTrailingMargin}; } :host(:state(-fullscreen)[contained][open]) .bar, :host(:state(-fullscreen)[contained][open]) .results { margin-inline-start: ${SearchViewToken.containedFocusedLeadingMargin}; margin-inline-end: ${SearchViewToken.containedFocusedTrailingMargin}; } .icon { display: flex; align-items: center; justify-content: center; box-sizing: border-box; min-width: 3rem; } ::slotted([slot="search-icon"]), .search-icon, ::slotted([slot="close-icon"]), .close-icon { width: 1em; font-size: ${SearchBarToken.iconSize} !important; } .results { overflow: hidden; flex: 1 1 auto; display: flex; flex-direction: column; } .scroll-container { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; scrollbar-color: ${DesignToken$1.scrollbar.color}; } .view:not(:popover-open) .results, .view.closing .results { display: none; } :host(:not(:is(:state(-clearable), [open]))) .clear { display: none; } ::slotted([slot="clear-icon"]), .clear-icon { width: 1em; font-size: ${SearchBarToken.iconSize} !important; } slot[name="clear-icon"] { --m3e-icon-size: ${SearchBarToken.iconSize}; } :host(:state(-fullscreen)) .header { transition: height 150ms cubic-bezier(0.2, 0, 0, 1); } :host(:state(-fullscreen)) .view:popover-open:not(.closing) .header { height: ${SearchViewToken.fullScreenHeaderContainerHeight}; } :host(:state(-fullscreen):not([open])) .header, :host(:state(-fullscreen)[open]) .view.closing .header { height: ${SearchViewToken.containedFullScreenBarContainerHeight}; } :host(:state(-fullscreen)[open]) .bar { --m3e-search-bar-container-height: ${SearchViewToken.containedFullScreenBarContainerHeight}; } :host(:state(-fullscreen)) .anchor { height: ${SearchViewToken.containedFullScreenBarContainerHeight}; } :host(:state(-fullscreen)) .view:popover-open { border-radius: ${SearchViewToken.fullScreenContainerShape}; } :host(:state(-fullscreen)[contained]) .view:popover-open { background-color: ${SearchViewToken.containedContainerColor}; } :host(:state(-fullscreen):not([contained])) .view:popover-open { background-color: ${SearchViewToken.containerColor}; } :host(:state(-docked)[open]) .header, :host(:state(-docked)) .anchor { height: ${SearchViewToken.dockedHeaderContainerHeight}; } :host(:not([contained])[open]) .results { border-top-width: ${SearchViewToken.dividerThickness}; border-top-style: solid; border-top-color: ${SearchViewToken.dividerColor}; } :host(:state(-docked)[contained]) .results { margin-top: ${SearchViewToken.containedDockedBarResultsGap}; } :host(:state(-docked):not([contained])[open]) .view { background-color: ${SearchViewToken.containerColor}; --m3e-search-bar-container-color: ${SearchViewToken.containerColor}; } :host(:state(-docked)[contained]) .results { background-color: ${SearchViewToken.containerColor}; } :host(:state(-docked):not([contained])) .view, :host(:state(-docked)[contained]) .results { border-radius: ${SearchViewToken.dockedContainerShape}; } :host(:state(-docked)) .results { min-height: calc(${SearchViewToken.dockedContainerMinHeight} - ${SearchViewToken.dockedHeaderContainerHeight}); max-height: calc(${SearchViewToken.dockedContainerMaxHeight} - ${SearchViewToken.dockedHeaderContainerHeight}); } :host(:state(-docked)) .scroll-container { scrollbar-width: ${DesignToken$1.scrollbar.thinWidth}; } :host(:state(-docked):not([contained])) .scroll-container { padding-bottom: ${SearchViewToken.dockedResultsBottomSpace}; } :host(:state(-docked)[contained]) .scroll-container { padding: ${SearchViewToken.containedDockedResultsSpace}; } :host(:state(-docked)) .results { transform-origin: top; transition: ${unsafeCSS(`transform ${DesignToken$1.motion.duration.short2} ${DesignToken$1.motion.easing.standard},
22275
22303
  overlay ${DesignToken$1.motion.duration.short2} ${DesignToken$1.motion.easing.standard} allow-discrete,
22276
- display ${DesignToken$1.motion.duration.short2} ${DesignToken$1.motion.easing.standard} allow-discrete`)}; } :host(:state(-docked):not([open])) .results { transform: scaleY(0.8); } :host(:state(-docked)[open]) .results { transform: scaleY(1); } @starting-style { :host(:state(-docked)[open]) .results { transform: scaleY(0.8); } } :host(:state(-docked)[contained]) .view { background-color: transparent; } :host(:state(-docked):not([open])) .view { transition: ${unsafeCSS(`border-radius ${DesignToken$1.motion.duration.long2} ${DesignToken$1.motion.easing.standard},
22304
+ display ${DesignToken$1.motion.duration.short2} ${DesignToken$1.motion.easing.standard} allow-discrete`)}; } :host(:state(-docked):not([open])) .results { transform: scaleY(0.8); } :host(:state(-docked)[open]) .results { transform: scaleY(1); } @starting-style { :host(:state(-docked)[open]) .results { transform: scaleY(0.8); } } :host(:state(-docked)) .view { background-color: transparent; } :host(:state(-docked):not([open])) .view { transition: ${unsafeCSS(`border-radius ${DesignToken$1.motion.duration.long2} ${DesignToken$1.motion.easing.standard},
22277
22305
  background-color ${DesignToken$1.motion.duration.long2} ${DesignToken$1.motion.easing.standard}`)}; } :host(:state(-docked):not([open])) .view::backdrop { transition: ${unsafeCSS(`background-color ${DesignToken$1.motion.duration.short3} ${DesignToken$1.motion.easing.standard},
22278
22306
  overlay ${DesignToken$1.motion.duration.short3} ${DesignToken$1.motion.easing.standard} allow-discrete,
22279
22307
  visibility ${DesignToken$1.motion.duration.short3} ${DesignToken$1.motion.easing.standard} allow-discrete`)}; } :host(:state(-docked)) .view::backdrop { background-color: color-mix(in srgb, ${SearchViewToken.dockedScrimColor} 0%, transparent); margin-inline-end: -20px; } :host(:state(-docked)[open]) .view::backdrop { background-color: color-mix( in srgb, ${SearchViewToken.dockedScrimColor} ${SearchViewToken.dockedScrimOpacity}, transparent ); transition: ${unsafeCSS(`background-color ${DesignToken$1.motion.duration.long2} ${DesignToken$1.motion.easing.standard},
@@ -24495,6 +24523,8 @@ var _M3eSliderElement_instances, _M3eSliderElement_directionalitySubscription, _
24495
24523
  *
24496
24524
  * @tag m3e-slider
24497
24525
  *
24526
+ * @slot - Renders the thumbs of the slider.
24527
+ *
24498
24528
  * @attr disabled - Whether the element is disabled.
24499
24529
  * @attr discrete - Whether to show tick marks.
24500
24530
  * @attr labelled - Whether to show value labels when activated.
@@ -27844,6 +27874,19 @@ function clampDouble(min, max, input) {
27844
27874
  }
27845
27875
  return input;
27846
27876
  }
27877
+ /**
27878
+ * Sanitizes a degree measure as an integer.
27879
+ *
27880
+ * @return a degree measure between 0 (inclusive) and 360
27881
+ * (exclusive).
27882
+ */
27883
+ function sanitizeDegreesInt(degrees) {
27884
+ degrees = degrees % 360;
27885
+ if (degrees < 0) {
27886
+ degrees = degrees + 360;
27887
+ }
27888
+ return degrees;
27889
+ }
27847
27890
  /**
27848
27891
  * Sanitizes a degree measure as a floating-point number.
27849
27892
  *
@@ -27857,6 +27900,12 @@ function sanitizeDegreesDouble(degrees) {
27857
27900
  }
27858
27901
  return degrees;
27859
27902
  }
27903
+ /**
27904
+ * Distance of two points on a circle, represented using degrees.
27905
+ */
27906
+ function differenceDegrees(a, b) {
27907
+ return 180.0 - Math.abs(Math.abs(a - b) - 180.0);
27908
+ }
27860
27909
  /**
27861
27910
  * Multiplies a 1x3 row vector with a 3x3 matrix.
27862
27911
  */
@@ -27908,6 +27957,12 @@ function argbFromLinrgb(linrgb) {
27908
27957
  const b = delinearized(linrgb[2]);
27909
27958
  return argbFromRgb(r, g, b);
27910
27959
  }
27960
+ /**
27961
+ * Returns the alpha component of a color in ARGB format.
27962
+ */
27963
+ function alphaFromArgb(argb) {
27964
+ return argb >> 24 & 255;
27965
+ }
27911
27966
  /**
27912
27967
  * Returns the red component of a color in ARGB format.
27913
27968
  */
@@ -27948,6 +28003,50 @@ function xyzFromArgb(argb) {
27948
28003
  const b = linearized(blueFromArgb(argb));
27949
28004
  return matrixMultiply([r, g, b], SRGB_TO_XYZ);
27950
28005
  }
28006
+ /**
28007
+ * Converts a color represented in Lab color space into an ARGB
28008
+ * integer.
28009
+ */
28010
+ function argbFromLab(l, a, b) {
28011
+ const whitePoint = WHITE_POINT_D65;
28012
+ const fy = (l + 16.0) / 116.0;
28013
+ const fx = a / 500.0 + fy;
28014
+ const fz = fy - b / 200.0;
28015
+ const xNormalized = labInvf(fx);
28016
+ const yNormalized = labInvf(fy);
28017
+ const zNormalized = labInvf(fz);
28018
+ const x = xNormalized * whitePoint[0];
28019
+ const y = yNormalized * whitePoint[1];
28020
+ const z = zNormalized * whitePoint[2];
28021
+ return argbFromXyz(x, y, z);
28022
+ }
28023
+ /**
28024
+ * Converts a color from ARGB representation to L*a*b*
28025
+ * representation.
28026
+ *
28027
+ * @param argb the ARGB representation of a color
28028
+ * @return a Lab object representing the color
28029
+ */
28030
+ function labFromArgb(argb) {
28031
+ const linearR = linearized(redFromArgb(argb));
28032
+ const linearG = linearized(greenFromArgb(argb));
28033
+ const linearB = linearized(blueFromArgb(argb));
28034
+ const matrix = SRGB_TO_XYZ;
28035
+ const x = matrix[0][0] * linearR + matrix[0][1] * linearG + matrix[0][2] * linearB;
28036
+ const y = matrix[1][0] * linearR + matrix[1][1] * linearG + matrix[1][2] * linearB;
28037
+ const z = matrix[2][0] * linearR + matrix[2][1] * linearG + matrix[2][2] * linearB;
28038
+ const whitePoint = WHITE_POINT_D65;
28039
+ const xNormalized = x / whitePoint[0];
28040
+ const yNormalized = y / whitePoint[1];
28041
+ const zNormalized = z / whitePoint[2];
28042
+ const fx = labF(xNormalized);
28043
+ const fy = labF(yNormalized);
28044
+ const fz = labF(zNormalized);
28045
+ const l = 116.0 * fy - 16;
28046
+ const a = 500.0 * (fx - fy);
28047
+ const b = 200.0 * (fy - fz);
28048
+ return [l, a, b];
28049
+ }
27951
28050
  /**
27952
28051
  * Converts an L* value to an ARGB representation.
27953
28052
  *
@@ -30655,6 +30754,712 @@ class CorePalette {
30655
30754
  }
30656
30755
  }
30657
30756
 
30757
+ /**
30758
+ * @license
30759
+ * Copyright 2021 Google LLC
30760
+ *
30761
+ * Licensed under the Apache License, Version 2.0 (the "License");
30762
+ * you may not use this file except in compliance with the License.
30763
+ * You may obtain a copy of the License at
30764
+ *
30765
+ * http://www.apache.org/licenses/LICENSE-2.0
30766
+ *
30767
+ * Unless required by applicable law or agreed to in writing, software
30768
+ * distributed under the License is distributed on an "AS IS" BASIS,
30769
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30770
+ * See the License for the specific language governing permissions and
30771
+ * limitations under the License.
30772
+ */
30773
+ /**
30774
+ * Provides conversions needed for K-Means quantization. Converting input to
30775
+ * points, and converting the final state of the K-Means algorithm to colors.
30776
+ */
30777
+ class LabPointProvider {
30778
+ /**
30779
+ * Convert a color represented in ARGB to a 3-element array of L*a*b*
30780
+ * coordinates of the color.
30781
+ */
30782
+ fromInt(argb) {
30783
+ return labFromArgb(argb);
30784
+ }
30785
+ /**
30786
+ * Convert a 3-element array to a color represented in ARGB.
30787
+ */
30788
+ toInt(point) {
30789
+ return argbFromLab(point[0], point[1], point[2]);
30790
+ }
30791
+ /**
30792
+ * Standard CIE 1976 delta E formula also takes the square root, unneeded
30793
+ * here. This method is used by quantization algorithms to compare distance,
30794
+ * and the relative ordering is the same, with or without a square root.
30795
+ *
30796
+ * This relatively minor optimization is helpful because this method is
30797
+ * called at least once for each pixel in an image.
30798
+ */
30799
+ distance(from, to) {
30800
+ const dL = from[0] - to[0];
30801
+ const dA = from[1] - to[1];
30802
+ const dB = from[2] - to[2];
30803
+ return dL * dL + dA * dA + dB * dB;
30804
+ }
30805
+ }
30806
+
30807
+ /**
30808
+ * @license
30809
+ * Copyright 2021 Google LLC
30810
+ *
30811
+ * Licensed under the Apache License, Version 2.0 (the "License");
30812
+ * you may not use this file except in compliance with the License.
30813
+ * You may obtain a copy of the License at
30814
+ *
30815
+ * http://www.apache.org/licenses/LICENSE-2.0
30816
+ *
30817
+ * Unless required by applicable law or agreed to in writing, software
30818
+ * distributed under the License is distributed on an "AS IS" BASIS,
30819
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30820
+ * See the License for the specific language governing permissions and
30821
+ * limitations under the License.
30822
+ */
30823
+ const MAX_ITERATIONS = 10;
30824
+ const MIN_MOVEMENT_DISTANCE = 3.0;
30825
+ /**
30826
+ * An image quantizer that improves on the speed of a standard K-Means algorithm
30827
+ * by implementing several optimizations, including deduping identical pixels
30828
+ * and a triangle inequality rule that reduces the number of comparisons needed
30829
+ * to identify which cluster a point should be moved to.
30830
+ *
30831
+ * Wsmeans stands for Weighted Square Means.
30832
+ *
30833
+ * This algorithm was designed by M. Emre Celebi, and was found in their 2011
30834
+ * paper, Improving the Performance of K-Means for Color Quantization.
30835
+ * https://arxiv.org/abs/1101.0395
30836
+ */
30837
+ // material_color_utilities is designed to have a consistent API across
30838
+ // platforms and modular components that can be moved around easily. Using a
30839
+ // class as a namespace facilitates this.
30840
+ //
30841
+ // tslint:disable-next-line:class-as-namespace
30842
+ class QuantizerWsmeans {
30843
+ /**
30844
+ * @param inputPixels Colors in ARGB format.
30845
+ * @param startingClusters Defines the initial state of the quantizer. Passing
30846
+ * an empty array is fine, the implementation will create its own initial
30847
+ * state that leads to reproducible results for the same inputs.
30848
+ * Passing an array that is the result of Wu quantization leads to higher
30849
+ * quality results.
30850
+ * @param maxColors The number of colors to divide the image into. A lower
30851
+ * number of colors may be returned.
30852
+ * @return Colors in ARGB format.
30853
+ */
30854
+ static quantize(inputPixels, startingClusters, maxColors) {
30855
+ const pixelToCount = new Map();
30856
+ const points = new Array();
30857
+ const pixels = new Array();
30858
+ const pointProvider = new LabPointProvider();
30859
+ let pointCount = 0;
30860
+ for (let i = 0; i < inputPixels.length; i++) {
30861
+ const inputPixel = inputPixels[i];
30862
+ const pixelCount = pixelToCount.get(inputPixel);
30863
+ if (pixelCount === undefined) {
30864
+ pointCount++;
30865
+ points.push(pointProvider.fromInt(inputPixel));
30866
+ pixels.push(inputPixel);
30867
+ pixelToCount.set(inputPixel, 1);
30868
+ } else {
30869
+ pixelToCount.set(inputPixel, pixelCount + 1);
30870
+ }
30871
+ }
30872
+ const counts = new Array();
30873
+ for (let i = 0; i < pointCount; i++) {
30874
+ const pixel = pixels[i];
30875
+ const count = pixelToCount.get(pixel);
30876
+ if (count !== undefined) {
30877
+ counts[i] = count;
30878
+ }
30879
+ }
30880
+ let clusterCount = Math.min(maxColors, pointCount);
30881
+ if (startingClusters.length > 0) {
30882
+ clusterCount = Math.min(clusterCount, startingClusters.length);
30883
+ }
30884
+ const clusters = new Array();
30885
+ for (let i = 0; i < startingClusters.length; i++) {
30886
+ clusters.push(pointProvider.fromInt(startingClusters[i]));
30887
+ }
30888
+ const additionalClustersNeeded = clusterCount - clusters.length;
30889
+ if (startingClusters.length === 0 && additionalClustersNeeded > 0) {
30890
+ for (let i = 0; i < additionalClustersNeeded; i++) {
30891
+ const l = Math.random() * 100.0;
30892
+ const a = Math.random() * (100.0 - -100 + 1) + -100;
30893
+ const b = Math.random() * (100.0 - -100 + 1) + -100;
30894
+ clusters.push(new Array(l, a, b));
30895
+ }
30896
+ }
30897
+ const clusterIndices = new Array();
30898
+ for (let i = 0; i < pointCount; i++) {
30899
+ clusterIndices.push(Math.floor(Math.random() * clusterCount));
30900
+ }
30901
+ const indexMatrix = new Array();
30902
+ for (let i = 0; i < clusterCount; i++) {
30903
+ indexMatrix.push(new Array());
30904
+ for (let j = 0; j < clusterCount; j++) {
30905
+ indexMatrix[i].push(0);
30906
+ }
30907
+ }
30908
+ const distanceToIndexMatrix = new Array();
30909
+ for (let i = 0; i < clusterCount; i++) {
30910
+ distanceToIndexMatrix.push(new Array());
30911
+ for (let j = 0; j < clusterCount; j++) {
30912
+ distanceToIndexMatrix[i].push(new DistanceAndIndex());
30913
+ }
30914
+ }
30915
+ const pixelCountSums = new Array();
30916
+ for (let i = 0; i < clusterCount; i++) {
30917
+ pixelCountSums.push(0);
30918
+ }
30919
+ for (let iteration = 0; iteration < MAX_ITERATIONS; iteration++) {
30920
+ for (let i = 0; i < clusterCount; i++) {
30921
+ for (let j = i + 1; j < clusterCount; j++) {
30922
+ const distance = pointProvider.distance(clusters[i], clusters[j]);
30923
+ distanceToIndexMatrix[j][i].distance = distance;
30924
+ distanceToIndexMatrix[j][i].index = i;
30925
+ distanceToIndexMatrix[i][j].distance = distance;
30926
+ distanceToIndexMatrix[i][j].index = j;
30927
+ }
30928
+ distanceToIndexMatrix[i].sort();
30929
+ for (let j = 0; j < clusterCount; j++) {
30930
+ indexMatrix[i][j] = distanceToIndexMatrix[i][j].index;
30931
+ }
30932
+ }
30933
+ let pointsMoved = 0;
30934
+ for (let i = 0; i < pointCount; i++) {
30935
+ const point = points[i];
30936
+ const previousClusterIndex = clusterIndices[i];
30937
+ const previousCluster = clusters[previousClusterIndex];
30938
+ const previousDistance = pointProvider.distance(point, previousCluster);
30939
+ let minimumDistance = previousDistance;
30940
+ let newClusterIndex = -1;
30941
+ for (let j = 0; j < clusterCount; j++) {
30942
+ if (distanceToIndexMatrix[previousClusterIndex][j].distance >= 4 * previousDistance) {
30943
+ continue;
30944
+ }
30945
+ const distance = pointProvider.distance(point, clusters[j]);
30946
+ if (distance < minimumDistance) {
30947
+ minimumDistance = distance;
30948
+ newClusterIndex = j;
30949
+ }
30950
+ }
30951
+ if (newClusterIndex !== -1) {
30952
+ const distanceChange = Math.abs(Math.sqrt(minimumDistance) - Math.sqrt(previousDistance));
30953
+ if (distanceChange > MIN_MOVEMENT_DISTANCE) {
30954
+ pointsMoved++;
30955
+ clusterIndices[i] = newClusterIndex;
30956
+ }
30957
+ }
30958
+ }
30959
+ if (pointsMoved === 0 && iteration !== 0) {
30960
+ break;
30961
+ }
30962
+ const componentASums = new Array(clusterCount).fill(0);
30963
+ const componentBSums = new Array(clusterCount).fill(0);
30964
+ const componentCSums = new Array(clusterCount).fill(0);
30965
+ for (let i = 0; i < clusterCount; i++) {
30966
+ pixelCountSums[i] = 0;
30967
+ }
30968
+ for (let i = 0; i < pointCount; i++) {
30969
+ const clusterIndex = clusterIndices[i];
30970
+ const point = points[i];
30971
+ const count = counts[i];
30972
+ pixelCountSums[clusterIndex] += count;
30973
+ componentASums[clusterIndex] += point[0] * count;
30974
+ componentBSums[clusterIndex] += point[1] * count;
30975
+ componentCSums[clusterIndex] += point[2] * count;
30976
+ }
30977
+ for (let i = 0; i < clusterCount; i++) {
30978
+ const count = pixelCountSums[i];
30979
+ if (count === 0) {
30980
+ clusters[i] = [0.0, 0.0, 0.0];
30981
+ continue;
30982
+ }
30983
+ const a = componentASums[i] / count;
30984
+ const b = componentBSums[i] / count;
30985
+ const c = componentCSums[i] / count;
30986
+ clusters[i] = [a, b, c];
30987
+ }
30988
+ }
30989
+ const argbToPopulation = new Map();
30990
+ for (let i = 0; i < clusterCount; i++) {
30991
+ const count = pixelCountSums[i];
30992
+ if (count === 0) {
30993
+ continue;
30994
+ }
30995
+ const possibleNewCluster = pointProvider.toInt(clusters[i]);
30996
+ if (argbToPopulation.has(possibleNewCluster)) {
30997
+ continue;
30998
+ }
30999
+ argbToPopulation.set(possibleNewCluster, count);
31000
+ }
31001
+ return argbToPopulation;
31002
+ }
31003
+ }
31004
+ /**
31005
+ * A wrapper for maintaining a table of distances between K-Means clusters.
31006
+ */
31007
+ class DistanceAndIndex {
31008
+ constructor() {
31009
+ this.distance = -1;
31010
+ this.index = -1;
31011
+ }
31012
+ }
31013
+
31014
+ /**
31015
+ * @license
31016
+ * Copyright 2021 Google LLC
31017
+ *
31018
+ * Licensed under the Apache License, Version 2.0 (the "License");
31019
+ * you may not use this file except in compliance with the License.
31020
+ * You may obtain a copy of the License at
31021
+ *
31022
+ * http://www.apache.org/licenses/LICENSE-2.0
31023
+ *
31024
+ * Unless required by applicable law or agreed to in writing, software
31025
+ * distributed under the License is distributed on an "AS IS" BASIS,
31026
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31027
+ * See the License for the specific language governing permissions and
31028
+ * limitations under the License.
31029
+ */
31030
+ /**
31031
+ * Quantizes an image into a map, with keys of ARGB colors, and values of the
31032
+ * number of times that color appears in the image.
31033
+ */
31034
+ // material_color_utilities is designed to have a consistent API across
31035
+ // platforms and modular components that can be moved around easily. Using a
31036
+ // class as a namespace facilitates this.
31037
+ //
31038
+ // tslint:disable-next-line:class-as-namespace
31039
+ class QuantizerMap {
31040
+ /**
31041
+ * @param pixels Colors in ARGB format.
31042
+ * @return A Map with keys of ARGB colors, and values of the number of times
31043
+ * the color appears in the image.
31044
+ */
31045
+ static quantize(pixels) {
31046
+ const countByColor = new Map();
31047
+ for (let i = 0; i < pixels.length; i++) {
31048
+ const pixel = pixels[i];
31049
+ const alpha = alphaFromArgb(pixel);
31050
+ if (alpha < 255) {
31051
+ continue;
31052
+ }
31053
+ countByColor.set(pixel, (countByColor.get(pixel) ?? 0) + 1);
31054
+ }
31055
+ return countByColor;
31056
+ }
31057
+ }
31058
+
31059
+ /**
31060
+ * @license
31061
+ * Copyright 2021 Google LLC
31062
+ *
31063
+ * Licensed under the Apache License, Version 2.0 (the "License");
31064
+ * you may not use this file except in compliance with the License.
31065
+ * You may obtain a copy of the License at
31066
+ *
31067
+ * http://www.apache.org/licenses/LICENSE-2.0
31068
+ *
31069
+ * Unless required by applicable law or agreed to in writing, software
31070
+ * distributed under the License is distributed on an "AS IS" BASIS,
31071
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31072
+ * See the License for the specific language governing permissions and
31073
+ * limitations under the License.
31074
+ */
31075
+ const INDEX_BITS = 5;
31076
+ const SIDE_LENGTH = 33; // ((1 << INDEX_INDEX_BITS) + 1)
31077
+ const TOTAL_SIZE = 35937; // SIDE_LENGTH * SIDE_LENGTH * SIDE_LENGTH
31078
+ const directions = {
31079
+ RED: 'red',
31080
+ GREEN: 'green',
31081
+ BLUE: 'blue'
31082
+ };
31083
+ /**
31084
+ * An image quantizer that divides the image's pixels into clusters by
31085
+ * recursively cutting an RGB cube, based on the weight of pixels in each area
31086
+ * of the cube.
31087
+ *
31088
+ * The algorithm was described by Xiaolin Wu in Graphic Gems II, published in
31089
+ * 1991.
31090
+ */
31091
+ class QuantizerWu {
31092
+ constructor(weights = [], momentsR = [], momentsG = [], momentsB = [], moments = [], cubes = []) {
31093
+ this.weights = weights;
31094
+ this.momentsR = momentsR;
31095
+ this.momentsG = momentsG;
31096
+ this.momentsB = momentsB;
31097
+ this.moments = moments;
31098
+ this.cubes = cubes;
31099
+ }
31100
+ /**
31101
+ * @param pixels Colors in ARGB format.
31102
+ * @param maxColors The number of colors to divide the image into. A lower
31103
+ * number of colors may be returned.
31104
+ * @return Colors in ARGB format.
31105
+ */
31106
+ quantize(pixels, maxColors) {
31107
+ this.constructHistogram(pixels);
31108
+ this.computeMoments();
31109
+ const createBoxesResult = this.createBoxes(maxColors);
31110
+ const results = this.createResult(createBoxesResult.resultCount);
31111
+ return results;
31112
+ }
31113
+ constructHistogram(pixels) {
31114
+ this.weights = Array.from({
31115
+ length: TOTAL_SIZE
31116
+ }).fill(0);
31117
+ this.momentsR = Array.from({
31118
+ length: TOTAL_SIZE
31119
+ }).fill(0);
31120
+ this.momentsG = Array.from({
31121
+ length: TOTAL_SIZE
31122
+ }).fill(0);
31123
+ this.momentsB = Array.from({
31124
+ length: TOTAL_SIZE
31125
+ }).fill(0);
31126
+ this.moments = Array.from({
31127
+ length: TOTAL_SIZE
31128
+ }).fill(0);
31129
+ const countByColor = QuantizerMap.quantize(pixels);
31130
+ for (const [pixel, count] of countByColor.entries()) {
31131
+ const red = redFromArgb(pixel);
31132
+ const green = greenFromArgb(pixel);
31133
+ const blue = blueFromArgb(pixel);
31134
+ const bitsToRemove = 8 - INDEX_BITS;
31135
+ const iR = (red >> bitsToRemove) + 1;
31136
+ const iG = (green >> bitsToRemove) + 1;
31137
+ const iB = (blue >> bitsToRemove) + 1;
31138
+ const index = this.getIndex(iR, iG, iB);
31139
+ this.weights[index] = (this.weights[index] ?? 0) + count;
31140
+ this.momentsR[index] += count * red;
31141
+ this.momentsG[index] += count * green;
31142
+ this.momentsB[index] += count * blue;
31143
+ this.moments[index] += count * (red * red + green * green + blue * blue);
31144
+ }
31145
+ }
31146
+ computeMoments() {
31147
+ for (let r = 1; r < SIDE_LENGTH; r++) {
31148
+ const area = Array.from({
31149
+ length: SIDE_LENGTH
31150
+ }).fill(0);
31151
+ const areaR = Array.from({
31152
+ length: SIDE_LENGTH
31153
+ }).fill(0);
31154
+ const areaG = Array.from({
31155
+ length: SIDE_LENGTH
31156
+ }).fill(0);
31157
+ const areaB = Array.from({
31158
+ length: SIDE_LENGTH
31159
+ }).fill(0);
31160
+ const area2 = Array.from({
31161
+ length: SIDE_LENGTH
31162
+ }).fill(0.0);
31163
+ for (let g = 1; g < SIDE_LENGTH; g++) {
31164
+ let line = 0;
31165
+ let lineR = 0;
31166
+ let lineG = 0;
31167
+ let lineB = 0;
31168
+ let line2 = 0.0;
31169
+ for (let b = 1; b < SIDE_LENGTH; b++) {
31170
+ const index = this.getIndex(r, g, b);
31171
+ line += this.weights[index];
31172
+ lineR += this.momentsR[index];
31173
+ lineG += this.momentsG[index];
31174
+ lineB += this.momentsB[index];
31175
+ line2 += this.moments[index];
31176
+ area[b] += line;
31177
+ areaR[b] += lineR;
31178
+ areaG[b] += lineG;
31179
+ areaB[b] += lineB;
31180
+ area2[b] += line2;
31181
+ const previousIndex = this.getIndex(r - 1, g, b);
31182
+ this.weights[index] = this.weights[previousIndex] + area[b];
31183
+ this.momentsR[index] = this.momentsR[previousIndex] + areaR[b];
31184
+ this.momentsG[index] = this.momentsG[previousIndex] + areaG[b];
31185
+ this.momentsB[index] = this.momentsB[previousIndex] + areaB[b];
31186
+ this.moments[index] = this.moments[previousIndex] + area2[b];
31187
+ }
31188
+ }
31189
+ }
31190
+ }
31191
+ createBoxes(maxColors) {
31192
+ this.cubes = Array.from({
31193
+ length: maxColors
31194
+ }).fill(0).map(() => new Box());
31195
+ const volumeVariance = Array.from({
31196
+ length: maxColors
31197
+ }).fill(0.0);
31198
+ this.cubes[0].r0 = 0;
31199
+ this.cubes[0].g0 = 0;
31200
+ this.cubes[0].b0 = 0;
31201
+ this.cubes[0].r1 = SIDE_LENGTH - 1;
31202
+ this.cubes[0].g1 = SIDE_LENGTH - 1;
31203
+ this.cubes[0].b1 = SIDE_LENGTH - 1;
31204
+ let generatedColorCount = maxColors;
31205
+ let next = 0;
31206
+ for (let i = 1; i < maxColors; i++) {
31207
+ if (this.cut(this.cubes[next], this.cubes[i])) {
31208
+ volumeVariance[next] = this.cubes[next].vol > 1 ? this.variance(this.cubes[next]) : 0.0;
31209
+ volumeVariance[i] = this.cubes[i].vol > 1 ? this.variance(this.cubes[i]) : 0.0;
31210
+ } else {
31211
+ volumeVariance[next] = 0.0;
31212
+ i--;
31213
+ }
31214
+ next = 0;
31215
+ let temp = volumeVariance[0];
31216
+ for (let j = 1; j <= i; j++) {
31217
+ if (volumeVariance[j] > temp) {
31218
+ temp = volumeVariance[j];
31219
+ next = j;
31220
+ }
31221
+ }
31222
+ if (temp <= 0.0) {
31223
+ generatedColorCount = i + 1;
31224
+ break;
31225
+ }
31226
+ }
31227
+ return new CreateBoxesResult(maxColors, generatedColorCount);
31228
+ }
31229
+ createResult(colorCount) {
31230
+ const colors = [];
31231
+ for (let i = 0; i < colorCount; ++i) {
31232
+ const cube = this.cubes[i];
31233
+ const weight = this.volume(cube, this.weights);
31234
+ if (weight > 0) {
31235
+ const r = Math.round(this.volume(cube, this.momentsR) / weight);
31236
+ const g = Math.round(this.volume(cube, this.momentsG) / weight);
31237
+ const b = Math.round(this.volume(cube, this.momentsB) / weight);
31238
+ const color = 255 << 24 | (r & 0x0ff) << 16 | (g & 0x0ff) << 8 | b & 0x0ff;
31239
+ colors.push(color);
31240
+ }
31241
+ }
31242
+ return colors;
31243
+ }
31244
+ variance(cube) {
31245
+ const dr = this.volume(cube, this.momentsR);
31246
+ const dg = this.volume(cube, this.momentsG);
31247
+ const db = this.volume(cube, this.momentsB);
31248
+ const xx = this.moments[this.getIndex(cube.r1, cube.g1, cube.b1)] - this.moments[this.getIndex(cube.r1, cube.g1, cube.b0)] - this.moments[this.getIndex(cube.r1, cube.g0, cube.b1)] + this.moments[this.getIndex(cube.r1, cube.g0, cube.b0)] - this.moments[this.getIndex(cube.r0, cube.g1, cube.b1)] + this.moments[this.getIndex(cube.r0, cube.g1, cube.b0)] + this.moments[this.getIndex(cube.r0, cube.g0, cube.b1)] - this.moments[this.getIndex(cube.r0, cube.g0, cube.b0)];
31249
+ const hypotenuse = dr * dr + dg * dg + db * db;
31250
+ const volume = this.volume(cube, this.weights);
31251
+ return xx - hypotenuse / volume;
31252
+ }
31253
+ cut(one, two) {
31254
+ const wholeR = this.volume(one, this.momentsR);
31255
+ const wholeG = this.volume(one, this.momentsG);
31256
+ const wholeB = this.volume(one, this.momentsB);
31257
+ const wholeW = this.volume(one, this.weights);
31258
+ const maxRResult = this.maximize(one, directions.RED, one.r0 + 1, one.r1, wholeR, wholeG, wholeB, wholeW);
31259
+ const maxGResult = this.maximize(one, directions.GREEN, one.g0 + 1, one.g1, wholeR, wholeG, wholeB, wholeW);
31260
+ const maxBResult = this.maximize(one, directions.BLUE, one.b0 + 1, one.b1, wholeR, wholeG, wholeB, wholeW);
31261
+ let direction;
31262
+ const maxR = maxRResult.maximum;
31263
+ const maxG = maxGResult.maximum;
31264
+ const maxB = maxBResult.maximum;
31265
+ if (maxR >= maxG && maxR >= maxB) {
31266
+ if (maxRResult.cutLocation < 0) {
31267
+ return false;
31268
+ }
31269
+ direction = directions.RED;
31270
+ } else if (maxG >= maxR && maxG >= maxB) {
31271
+ direction = directions.GREEN;
31272
+ } else {
31273
+ direction = directions.BLUE;
31274
+ }
31275
+ two.r1 = one.r1;
31276
+ two.g1 = one.g1;
31277
+ two.b1 = one.b1;
31278
+ switch (direction) {
31279
+ case directions.RED:
31280
+ one.r1 = maxRResult.cutLocation;
31281
+ two.r0 = one.r1;
31282
+ two.g0 = one.g0;
31283
+ two.b0 = one.b0;
31284
+ break;
31285
+ case directions.GREEN:
31286
+ one.g1 = maxGResult.cutLocation;
31287
+ two.r0 = one.r0;
31288
+ two.g0 = one.g1;
31289
+ two.b0 = one.b0;
31290
+ break;
31291
+ case directions.BLUE:
31292
+ one.b1 = maxBResult.cutLocation;
31293
+ two.r0 = one.r0;
31294
+ two.g0 = one.g0;
31295
+ two.b0 = one.b1;
31296
+ break;
31297
+ default:
31298
+ throw new Error('unexpected direction ' + direction);
31299
+ }
31300
+ one.vol = (one.r1 - one.r0) * (one.g1 - one.g0) * (one.b1 - one.b0);
31301
+ two.vol = (two.r1 - two.r0) * (two.g1 - two.g0) * (two.b1 - two.b0);
31302
+ return true;
31303
+ }
31304
+ maximize(cube, direction, first, last, wholeR, wholeG, wholeB, wholeW) {
31305
+ const bottomR = this.bottom(cube, direction, this.momentsR);
31306
+ const bottomG = this.bottom(cube, direction, this.momentsG);
31307
+ const bottomB = this.bottom(cube, direction, this.momentsB);
31308
+ const bottomW = this.bottom(cube, direction, this.weights);
31309
+ let max = 0.0;
31310
+ let cut = -1;
31311
+ let halfR = 0;
31312
+ let halfG = 0;
31313
+ let halfB = 0;
31314
+ let halfW = 0;
31315
+ for (let i = first; i < last; i++) {
31316
+ halfR = bottomR + this.top(cube, direction, i, this.momentsR);
31317
+ halfG = bottomG + this.top(cube, direction, i, this.momentsG);
31318
+ halfB = bottomB + this.top(cube, direction, i, this.momentsB);
31319
+ halfW = bottomW + this.top(cube, direction, i, this.weights);
31320
+ if (halfW === 0) {
31321
+ continue;
31322
+ }
31323
+ let tempNumerator = (halfR * halfR + halfG * halfG + halfB * halfB) * 1.0;
31324
+ let tempDenominator = halfW * 1.0;
31325
+ let temp = tempNumerator / tempDenominator;
31326
+ halfR = wholeR - halfR;
31327
+ halfG = wholeG - halfG;
31328
+ halfB = wholeB - halfB;
31329
+ halfW = wholeW - halfW;
31330
+ if (halfW === 0) {
31331
+ continue;
31332
+ }
31333
+ tempNumerator = (halfR * halfR + halfG * halfG + halfB * halfB) * 1.0;
31334
+ tempDenominator = halfW * 1.0;
31335
+ temp += tempNumerator / tempDenominator;
31336
+ if (temp > max) {
31337
+ max = temp;
31338
+ cut = i;
31339
+ }
31340
+ }
31341
+ return new MaximizeResult(cut, max);
31342
+ }
31343
+ volume(cube, moment) {
31344
+ return moment[this.getIndex(cube.r1, cube.g1, cube.b1)] - moment[this.getIndex(cube.r1, cube.g1, cube.b0)] - moment[this.getIndex(cube.r1, cube.g0, cube.b1)] + moment[this.getIndex(cube.r1, cube.g0, cube.b0)] - moment[this.getIndex(cube.r0, cube.g1, cube.b1)] + moment[this.getIndex(cube.r0, cube.g1, cube.b0)] + moment[this.getIndex(cube.r0, cube.g0, cube.b1)] - moment[this.getIndex(cube.r0, cube.g0, cube.b0)];
31345
+ }
31346
+ bottom(cube, direction, moment) {
31347
+ switch (direction) {
31348
+ case directions.RED:
31349
+ return -moment[this.getIndex(cube.r0, cube.g1, cube.b1)] + moment[this.getIndex(cube.r0, cube.g1, cube.b0)] + moment[this.getIndex(cube.r0, cube.g0, cube.b1)] - moment[this.getIndex(cube.r0, cube.g0, cube.b0)];
31350
+ case directions.GREEN:
31351
+ return -moment[this.getIndex(cube.r1, cube.g0, cube.b1)] + moment[this.getIndex(cube.r1, cube.g0, cube.b0)] + moment[this.getIndex(cube.r0, cube.g0, cube.b1)] - moment[this.getIndex(cube.r0, cube.g0, cube.b0)];
31352
+ case directions.BLUE:
31353
+ return -moment[this.getIndex(cube.r1, cube.g1, cube.b0)] + moment[this.getIndex(cube.r1, cube.g0, cube.b0)] + moment[this.getIndex(cube.r0, cube.g1, cube.b0)] - moment[this.getIndex(cube.r0, cube.g0, cube.b0)];
31354
+ default:
31355
+ throw new Error('unexpected direction $direction');
31356
+ }
31357
+ }
31358
+ top(cube, direction, position, moment) {
31359
+ switch (direction) {
31360
+ case directions.RED:
31361
+ return moment[this.getIndex(position, cube.g1, cube.b1)] - moment[this.getIndex(position, cube.g1, cube.b0)] - moment[this.getIndex(position, cube.g0, cube.b1)] + moment[this.getIndex(position, cube.g0, cube.b0)];
31362
+ case directions.GREEN:
31363
+ return moment[this.getIndex(cube.r1, position, cube.b1)] - moment[this.getIndex(cube.r1, position, cube.b0)] - moment[this.getIndex(cube.r0, position, cube.b1)] + moment[this.getIndex(cube.r0, position, cube.b0)];
31364
+ case directions.BLUE:
31365
+ return moment[this.getIndex(cube.r1, cube.g1, position)] - moment[this.getIndex(cube.r1, cube.g0, position)] - moment[this.getIndex(cube.r0, cube.g1, position)] + moment[this.getIndex(cube.r0, cube.g0, position)];
31366
+ default:
31367
+ throw new Error('unexpected direction $direction');
31368
+ }
31369
+ }
31370
+ getIndex(r, g, b) {
31371
+ return (r << INDEX_BITS * 2) + (r << INDEX_BITS + 1) + r + (g << INDEX_BITS) + g + b;
31372
+ }
31373
+ }
31374
+ /**
31375
+ * Keeps track of the state of each box created as the Wu quantization
31376
+ * algorithm progresses through dividing the image's pixels as plotted in RGB.
31377
+ */
31378
+ class Box {
31379
+ constructor(r0 = 0, r1 = 0, g0 = 0, g1 = 0, b0 = 0, b1 = 0, vol = 0) {
31380
+ this.r0 = r0;
31381
+ this.r1 = r1;
31382
+ this.g0 = g0;
31383
+ this.g1 = g1;
31384
+ this.b0 = b0;
31385
+ this.b1 = b1;
31386
+ this.vol = vol;
31387
+ }
31388
+ }
31389
+ /**
31390
+ * Represents final result of Wu algorithm.
31391
+ */
31392
+ class CreateBoxesResult {
31393
+ /**
31394
+ * @param requestedCount how many colors the caller asked to be returned from
31395
+ * quantization.
31396
+ * @param resultCount the actual number of colors achieved from quantization.
31397
+ * May be lower than the requested count.
31398
+ */
31399
+ constructor(requestedCount, resultCount) {
31400
+ this.requestedCount = requestedCount;
31401
+ this.resultCount = resultCount;
31402
+ }
31403
+ }
31404
+ /**
31405
+ * Represents the result of calculating where to cut an existing box in such
31406
+ * a way to maximize variance between the two new boxes created by a cut.
31407
+ */
31408
+ class MaximizeResult {
31409
+ constructor(cutLocation, maximum) {
31410
+ this.cutLocation = cutLocation;
31411
+ this.maximum = maximum;
31412
+ }
31413
+ }
31414
+
31415
+ /**
31416
+ * @license
31417
+ * Copyright 2021 Google LLC
31418
+ *
31419
+ * Licensed under the Apache License, Version 2.0 (the "License");
31420
+ * you may not use this file except in compliance with the License.
31421
+ * You may obtain a copy of the License at
31422
+ *
31423
+ * http://www.apache.org/licenses/LICENSE-2.0
31424
+ *
31425
+ * Unless required by applicable law or agreed to in writing, software
31426
+ * distributed under the License is distributed on an "AS IS" BASIS,
31427
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31428
+ * See the License for the specific language governing permissions and
31429
+ * limitations under the License.
31430
+ */
31431
+ /**
31432
+ * An image quantizer that improves on the quality of a standard K-Means
31433
+ * algorithm by setting the K-Means initial state to the output of a Wu
31434
+ * quantizer, instead of random centroids. Improves on speed by several
31435
+ * optimizations, as implemented in Wsmeans, or Weighted Square Means, K-Means
31436
+ * with those optimizations.
31437
+ *
31438
+ * This algorithm was designed by M. Emre Celebi, and was found in their 2011
31439
+ * paper, Improving the Performance of K-Means for Color Quantization.
31440
+ * https://arxiv.org/abs/1101.0395
31441
+ */
31442
+ // material_color_utilities is designed to have a consistent API across
31443
+ // platforms and modular components that can be moved around easily. Using a
31444
+ // class as a namespace facilitates this.
31445
+ //
31446
+ // tslint:disable-next-line:class-as-namespace
31447
+ class QuantizerCelebi {
31448
+ /**
31449
+ * @param pixels Colors in ARGB format.
31450
+ * @param maxColors The number of colors to divide the image into. A lower
31451
+ * number of colors may be returned.
31452
+ * @return Map with keys of colors in ARGB format, and values of number of
31453
+ * pixels in the original image that correspond to the color in the
31454
+ * quantized image.
31455
+ */
31456
+ static quantize(pixels, maxColors) {
31457
+ const wu = new QuantizerWu();
31458
+ const wuResult = wu.quantize(pixels, maxColors);
31459
+ return QuantizerWsmeans.quantize(pixels, wuResult, maxColors);
31460
+ }
31461
+ }
31462
+
30658
31463
  /**
30659
31464
  * @license
30660
31465
  * Copyright 2022 Google LLC
@@ -30756,6 +31561,145 @@ SchemeVibrant.secondaryRotations = [18.0, 15.0, 10.0, 12.0, 15.0, 18.0, 15.0, 12
30756
31561
  */
30757
31562
  SchemeVibrant.tertiaryRotations = [35.0, 30.0, 20.0, 25.0, 30.0, 35.0, 30.0, 25.0, 25.0];
30758
31563
 
31564
+ /**
31565
+ * @license
31566
+ * Copyright 2021 Google LLC
31567
+ *
31568
+ * Licensed under the Apache License, Version 2.0 (the "License");
31569
+ * you may not use this file except in compliance with the License.
31570
+ * You may obtain a copy of the License at
31571
+ *
31572
+ * http://www.apache.org/licenses/LICENSE-2.0
31573
+ *
31574
+ * Unless required by applicable law or agreed to in writing, software
31575
+ * distributed under the License is distributed on an "AS IS" BASIS,
31576
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31577
+ * See the License for the specific language governing permissions and
31578
+ * limitations under the License.
31579
+ */
31580
+ const SCORE_OPTION_DEFAULTS = {
31581
+ desired: 4,
31582
+ fallbackColorARGB: 0xff4285f4,
31583
+ filter: true // Avoid unsuitable colors.
31584
+ };
31585
+ function compare(a, b) {
31586
+ if (a.score > b.score) {
31587
+ return -1;
31588
+ } else if (a.score < b.score) {
31589
+ return 1;
31590
+ }
31591
+ return 0;
31592
+ }
31593
+ /**
31594
+ * Given a large set of colors, remove colors that are unsuitable for a UI
31595
+ * theme, and rank the rest based on suitability.
31596
+ *
31597
+ * Enables use of a high cluster count for image quantization, thus ensuring
31598
+ * colors aren't muddied, while curating the high cluster count to a much
31599
+ * smaller number of appropriate choices.
31600
+ */
31601
+ class Score {
31602
+ constructor() {}
31603
+ /**
31604
+ * Given a map with keys of colors and values of how often the color appears,
31605
+ * rank the colors based on suitability for being used for a UI theme.
31606
+ *
31607
+ * @param colorsToPopulation map with keys of colors and values of how often
31608
+ * the color appears, usually from a source image.
31609
+ * @param {ScoreOptions} options optional parameters.
31610
+ * @return Colors sorted by suitability for a UI theme. The most suitable
31611
+ * color is the first item, the least suitable is the last. There will
31612
+ * always be at least one color returned. If all the input colors
31613
+ * were not suitable for a theme, a default fallback color will be
31614
+ * provided, Google Blue.
31615
+ */
31616
+ static score(colorsToPopulation, options) {
31617
+ const {
31618
+ desired,
31619
+ fallbackColorARGB,
31620
+ filter
31621
+ } = {
31622
+ ...SCORE_OPTION_DEFAULTS,
31623
+ ...options
31624
+ };
31625
+ // Get the HCT color for each Argb value, while finding the per hue count and
31626
+ // total count.
31627
+ const colorsHct = [];
31628
+ const huePopulation = new Array(360).fill(0);
31629
+ let populationSum = 0;
31630
+ for (const [argb, population] of colorsToPopulation.entries()) {
31631
+ const hct = Hct.fromInt(argb);
31632
+ colorsHct.push(hct);
31633
+ const hue = Math.floor(hct.hue);
31634
+ huePopulation[hue] += population;
31635
+ populationSum += population;
31636
+ }
31637
+ // Hues with more usage in neighboring 30 degree slice get a larger number.
31638
+ const hueExcitedProportions = new Array(360).fill(0.0);
31639
+ for (let hue = 0; hue < 360; hue++) {
31640
+ const proportion = huePopulation[hue] / populationSum;
31641
+ for (let i = hue - 14; i < hue + 16; i++) {
31642
+ const neighborHue = sanitizeDegreesInt(i);
31643
+ hueExcitedProportions[neighborHue] += proportion;
31644
+ }
31645
+ }
31646
+ // Scores each HCT color based on usage and chroma, while optionally
31647
+ // filtering out values that do not have enough chroma or usage.
31648
+ const scoredHct = new Array();
31649
+ for (const hct of colorsHct) {
31650
+ const hue = sanitizeDegreesInt(Math.round(hct.hue));
31651
+ const proportion = hueExcitedProportions[hue];
31652
+ if (filter && (hct.chroma < Score.CUTOFF_CHROMA || proportion <= Score.CUTOFF_EXCITED_PROPORTION)) {
31653
+ continue;
31654
+ }
31655
+ const proportionScore = proportion * 100.0 * Score.WEIGHT_PROPORTION;
31656
+ const chromaWeight = hct.chroma < Score.TARGET_CHROMA ? Score.WEIGHT_CHROMA_BELOW : Score.WEIGHT_CHROMA_ABOVE;
31657
+ const chromaScore = (hct.chroma - Score.TARGET_CHROMA) * chromaWeight;
31658
+ const score = proportionScore + chromaScore;
31659
+ scoredHct.push({
31660
+ hct,
31661
+ score
31662
+ });
31663
+ }
31664
+ // Sorted so that colors with higher scores come first.
31665
+ scoredHct.sort(compare);
31666
+ // Iterates through potential hue differences in degrees in order to select
31667
+ // the colors with the largest distribution of hues possible. Starting at
31668
+ // 90 degrees(maximum difference for 4 colors) then decreasing down to a
31669
+ // 15 degree minimum.
31670
+ const chosenColors = [];
31671
+ for (let differenceDegrees$1 = 90; differenceDegrees$1 >= 15; differenceDegrees$1--) {
31672
+ chosenColors.length = 0;
31673
+ for (const {
31674
+ hct
31675
+ } of scoredHct) {
31676
+ const duplicateHue = chosenColors.find(chosenHct => {
31677
+ return differenceDegrees(hct.hue, chosenHct.hue) < differenceDegrees$1;
31678
+ });
31679
+ if (!duplicateHue) {
31680
+ chosenColors.push(hct);
31681
+ }
31682
+ if (chosenColors.length >= desired) break;
31683
+ }
31684
+ if (chosenColors.length >= desired) break;
31685
+ }
31686
+ const colors = [];
31687
+ if (chosenColors.length === 0) {
31688
+ colors.push(fallbackColorARGB);
31689
+ }
31690
+ for (const chosenHct of chosenColors) {
31691
+ colors.push(chosenHct.toInt());
31692
+ }
31693
+ return colors;
31694
+ }
31695
+ }
31696
+ Score.TARGET_CHROMA = 48.0; // A1 Chroma
31697
+ Score.WEIGHT_PROPORTION = 0.7;
31698
+ Score.WEIGHT_CHROMA_ABOVE = 0.3;
31699
+ Score.WEIGHT_CHROMA_BELOW = 0.1;
31700
+ Score.CUTOFF_CHROMA = 5.0;
31701
+ Score.CUTOFF_EXCITED_PROPORTION = 0.01;
31702
+
30759
31703
  /**
30760
31704
  * @license
30761
31705
  * Copyright 2021 Google LLC
@@ -30829,6 +31773,96 @@ function parseIntHex(value) {
30829
31773
  return parseInt(value, 16);
30830
31774
  }
30831
31775
 
31776
+ /**
31777
+ * @license
31778
+ * Copyright 2021 Google LLC
31779
+ *
31780
+ * Licensed under the Apache License, Version 2.0 (the "License");
31781
+ * you may not use this file except in compliance with the License.
31782
+ * You may obtain a copy of the License at
31783
+ *
31784
+ * http://www.apache.org/licenses/LICENSE-2.0
31785
+ *
31786
+ * Unless required by applicable law or agreed to in writing, software
31787
+ * distributed under the License is distributed on an "AS IS" BASIS,
31788
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31789
+ * See the License for the specific language governing permissions and
31790
+ * limitations under the License.
31791
+ */
31792
+ /**
31793
+ * Get the source color from an image.
31794
+ *
31795
+ * @param image The image element
31796
+ * @return Source color - the color most suitable for creating a UI theme
31797
+ */
31798
+ async function sourceColorFromImage(image) {
31799
+ // Convert Image data to Pixel Array
31800
+ const imageBytes = await new Promise((resolve, reject) => {
31801
+ const canvas = document.createElement('canvas');
31802
+ const context = canvas.getContext('2d');
31803
+ if (!context) {
31804
+ reject(new Error('Could not get canvas context'));
31805
+ return;
31806
+ }
31807
+ const loadCallback = () => {
31808
+ canvas.width = image.width;
31809
+ canvas.height = image.height;
31810
+ context.drawImage(image, 0, 0);
31811
+ let rect = [0, 0, image.width, image.height];
31812
+ const area = image.dataset['area'];
31813
+ if (area && /^\d+(\s*,\s*\d+){3}$/.test(area)) {
31814
+ rect = area.split(/\s*,\s*/).map(s => {
31815
+ // tslint:disable-next-line:ban
31816
+ return parseInt(s, 10);
31817
+ });
31818
+ }
31819
+ const [sx, sy, sw, sh] = rect;
31820
+ resolve(context.getImageData(sx, sy, sw, sh).data);
31821
+ };
31822
+ const errorCallback = () => {
31823
+ reject(new Error('Image load failed'));
31824
+ };
31825
+ if (image.complete) {
31826
+ loadCallback();
31827
+ } else {
31828
+ image.onload = loadCallback;
31829
+ image.onerror = errorCallback;
31830
+ }
31831
+ });
31832
+ // Convert Image data to Pixel Array
31833
+ const pixels = [];
31834
+ for (let i = 0; i < imageBytes.length; i += 4) {
31835
+ const r = imageBytes[i];
31836
+ const g = imageBytes[i + 1];
31837
+ const b = imageBytes[i + 2];
31838
+ const a = imageBytes[i + 3];
31839
+ if (a < 255) {
31840
+ continue;
31841
+ }
31842
+ const argb = argbFromRgb(r, g, b);
31843
+ pixels.push(argb);
31844
+ }
31845
+ // Convert Pixels to Material Colors
31846
+ const result = QuantizerCelebi.quantize(pixels, 128);
31847
+ const ranked = Score.score(result);
31848
+ const top = ranked[0];
31849
+ return top;
31850
+ }
31851
+
31852
+ /**
31853
+ * Extracts the Material source color from an image and returns it as a hex string.
31854
+ * @param {HTMLImageElement} image - A fully loaded image element. Pixel data is sampled to derive the source color.
31855
+ * @returns {Promise<string>} A hex color string (`#RRGGBB`) representing the extracted source color.
31856
+ *
31857
+ * @example
31858
+ * const img = document.querySelector("img");
31859
+ * const color = await getColorFromImage(img);
31860
+ * // "#6750A4"
31861
+ */
31862
+ async function getColorFromImage(image) {
31863
+ return hexFromArgb(await sourceColorFromImage(image));
31864
+ }
31865
+
30832
31866
  var _M3eThemeElement_instances, _M3eThemeElement_styleSheet, _M3eThemeElement_firstUpdated, _M3eThemeElement_light, _M3eThemeElement_dark, _M3eThemeElement_forcedColor, _M3eThemeElement_colorSchemeChangeHandler, _M3eThemeElement_apply, _M3eThemeElement_getContrastLevel;
30833
31867
  /**
30834
31868
  * A non-visual element responsible for application-level theming.
@@ -30857,6 +31891,8 @@ var _M3eThemeElement_instances, _M3eThemeElement_styleSheet, _M3eThemeElement_fi
30857
31891
  * ```
30858
31892
  * @tag m3e-theme
30859
31893
  *
31894
+ * @slot - Renders content styled by the theme.
31895
+ *
30860
31896
  * @attr color - The hex color from which to derive dynamic color palettes.
30861
31897
  * @attr contrast - The contrast level of the theme.
30862
31898
  * @attr density - The density scale (0, -1, -2).
@@ -31118,7 +32154,7 @@ let M3eTocItemElement = class M3eTocItemElement extends Selected$1(Disabled$1(At
31118
32154
  }
31119
32155
  };
31120
32156
  /** The styles of the element. */
31121
- M3eTocItemElement.styles = css`:host { display: inline-block; position: relative; user-select: none; outline: none; border-radius: var(--m3e-toc-item-shape, ${DesignToken$1.shape.corner.largeIncreased}); padding-block: var(--m3e-toc-item-padding-block, 0.5rem); -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } :host(:not(:disabled)) { cursor: pointer; } .base { padding-inline-start: calc( var(--m3e-toc-item-padding, 1rem) + calc(var(--m3e-toc-item-inset, 0.75rem) * var(--_level, 0)) ); padding-inline-end: var(--m3e-toc-item-padding, 1rem); transition: ${unsafeCSS(`color var(--m3e-toc-active-indicator-animation-duration, ${DesignToken$1.motion.duration.long1}) ${DesignToken$1.motion.easing.standard}`)}; } :host(:not([selected])) { font-size: var(--m3e-toc-item-font-size, ${DesignToken$1.typescale.standard.body.large.fontSize}); font-weight: var(--m3e-toc-item-font-weight, ${DesignToken$1.typescale.standard.body.large.fontWeight}); line-height: var(--m3e-toc-item-line-height, ${DesignToken$1.typescale.standard.body.large.lineHeight}); letter-spacing: var(--m3e-toc-item-tracking, ${DesignToken$1.typescale.standard.body.large.tracking}); color: var(--m3e-toc-item-color, ${DesignToken$1.color.onSurfaceVariant}); } :host([selected]) { font-size: var(--m3e-toc-item-selected-font-size, ${DesignToken$1.typescale.emphasized.body.large.fontSize}); font-weight: var(--m3e-toc-item-selected-font-weight, ${DesignToken$1.typescale.emphasized.body.large.fontWeight}); line-height: var(--m3e-toc-item-selected-line-height, ${DesignToken$1.typescale.emphasized.body.large.lineHeight}); letter-spacing: var(--m3e-toc-item-selected-tracking, ${DesignToken$1.typescale.emphasized.body.large.tracking}); color: var(--m3e-toc-item-selected-color, ${DesignToken$1.color.onSecondaryContainer}); } .base { justify-content: unset; } .state-layer { --m3e-state-layer-focus-opacity: 0; } @media (prefers-reduced-motion) { .base { transition: none; } }`;
32157
+ M3eTocItemElement.styles = css`:host { display: inline-block; position: relative; user-select: none; outline: none; border-radius: var(--m3e-toc-item-shape, ${DesignToken$1.shape.corner.largeIncreased}); padding-block: var(--m3e-toc-item-padding-block, 0.5rem); -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } :host(:not(:disabled)) { cursor: pointer; } .base { padding-inline-start: calc( var(--m3e-toc-item-padding, 1rem) + calc(var(--m3e-toc-item-inset, 0.75rem) * var(--_level, 0)) ); padding-inline-end: var(--m3e-toc-item-padding, 1rem); transition: ${unsafeCSS(`color var(--m3e-toc-active-indicator-animation-duration, ${DesignToken$1.motion.duration.long1}) ${DesignToken$1.motion.easing.standard}`)}; } :host(:not([selected])) { font-size: var(--m3e-toc-item-font-size, ${DesignToken$1.typescale.standard.body.large.fontSize}); font-weight: var(--m3e-toc-item-font-weight, ${DesignToken$1.typescale.standard.body.large.fontWeight}); line-height: var(--m3e-toc-item-line-height, ${DesignToken$1.typescale.standard.body.large.lineHeight}); letter-spacing: var(--m3e-toc-item-tracking, ${DesignToken$1.typescale.standard.body.large.tracking}); color: var(--m3e-toc-item-color, ${DesignToken$1.color.onSurfaceVariant}); } :host([selected]) { font-size: var(--m3e-toc-item-selected-font-size, ${DesignToken$1.typescale.emphasized.body.large.fontSize}); font-weight: var(--m3e-toc-item-selected-font-weight, ${DesignToken$1.typescale.emphasized.body.large.fontWeight}); line-height: var(--m3e-toc-item-selected-line-height, ${DesignToken$1.typescale.emphasized.body.large.lineHeight}); letter-spacing: var(--m3e-toc-item-selected-tracking, ${DesignToken$1.typescale.emphasized.body.large.tracking}); color: var(--m3e-toc-item-selected-color, ${DesignToken$1.color.onSurface}); } .base { justify-content: unset; } .state-layer { --m3e-state-layer-focus-opacity: 0; } @media (prefers-reduced-motion) { .base { transition: none; } }`;
31122
32158
  __decorate([query(".base")], M3eTocItemElement.prototype, "_base", void 0);
31123
32159
  __decorate([query(".state-layer")], M3eTocItemElement.prototype, "_stateLayer", void 0);
31124
32160
  __decorate([state()], M3eTocItemElement.prototype, "node", void 0);
@@ -32882,5 +33918,5 @@ __decorate([property({
32882
33918
  })], M3eTreeElement.prototype, "cascade", void 0);
32883
33919
  M3eTreeElement = M3eTreeElement_1 = __decorate([customElement$1("m3e-tree")], M3eTreeElement);
32884
33920
 
32885
- export { ActionElementBase, AnimationLoopController, AttachInternals, CalendarViewElementBase, Checked, CheckedIndeterminate, ConstraintValidation, DesignToken, Dirty, Disabled, DisabledInteractive, EventAttribute, FocusController, Focusable, FormAssociated, FormSubmitter, HoverController, HtmlFor, InertController, IntersectionController, KeyboardClick, Labelled, LinkButton, LongPressController, M3eAccordionElement, M3eActionListElement, M3eAppBarElement, M3eAssistChipElement, M3eAutocompleteElement, M3eAvatarElement, M3eBadgeElement, M3eBottomSheetActionElement, M3eBottomSheetElement, M3eBottomSheetTriggerElement, M3eBreadcrumbElement, M3eBreadcrumbItemElement, M3eButtonElement, M3eButtonGroupElement, M3eButtonSegmentElement, M3eCalendarElement, M3eCardElement, M3eCheckboxElement, M3eChipElement, M3eChipSetElement, M3eCircularProgressIndicatorElement, M3eCollapsibleElement, M3eContentPaneElement, M3eDatepickerElement, M3eDatepickerToggleElement, M3eDialogActionElement, M3eDialogElement, M3eDialogTriggerElement, M3eDividerElement, M3eDrawerContainerElement, M3eDrawerToggleElement, M3eElevationElement, M3eExpandableListItemElement, M3eExpansionHeaderElement, M3eExpansionPanelElement, M3eFabElement, M3eFabMenuElement, M3eFabMenuItemElement, M3eFabMenuTriggerElement, M3eFilterChipElement, M3eFilterChipSetElement, M3eFocusRingElement, M3eFormFieldElement, M3eHeadingElement, M3eIconButtonElement, M3eIconElement, M3eInputChipElement, M3eInputChipSetElement, M3eLinearProgressIndicatorElement, M3eListActionElement, M3eListElement, M3eListItemElement, M3eListOptionElement, M3eLoadingIndicatorElement, M3eMenuElement, M3eMenuItemCheckboxElement, M3eMenuItemElement, M3eMenuItemGroupElement, M3eMenuItemRadioElement, M3eMenuTriggerElement, M3eMonthViewElement, M3eMultiYearViewElement, M3eNavBarElement, M3eNavItemElement, M3eNavMenuElement, M3eNavMenuItemElement, M3eNavMenuItemGroupElement, M3eNavRailElement, M3eNavRailToggleElement, M3eOptGroupElement, M3eOptionElement, M3eOptionPanelElement, M3ePaginatorElement, M3ePseudoCheckboxElement, M3ePseudoRadioElement, M3eRadioElement, M3eRadioGroupElement, M3eRichTooltipActionElement, M3eRichTooltipElement, M3eRippleElement, M3eScrollContainerElement, M3eSearchBarElement, M3eSearchViewElement, M3eSegmentedButtonElement, M3eSelectElement, M3eSelectionListElement, M3eShapeElement, M3eSkeletonElement, M3eSlideElement, M3eSlideGroupElement, M3eSliderElement, M3eSliderThumbElement, M3eSnackbar, M3eSnackbarElement, M3eSplitButtonElement, M3eSplitPaneElement, M3eStateLayerElement, M3eStepElement, M3eStepPanelElement, M3eStepperElement, M3eStepperNextElement, M3eStepperPreviousElement, M3eStepperResetElement, M3eSuggestionChipElement, M3eSwitchElement, M3eTabElement, M3eTabPanelElement, M3eTabsElement, M3eTextHighlightElement, M3eTextOverflowElement, M3eTextareaAutosizeElement, M3eThemeElement, M3eTocElement, M3eTocItemElement, M3eToolbarElement, M3eTooltipElement, M3eTreeElement, M3eTreeItemElement, M3eYearViewElement, MutationController, PressedController, ProgressElementIndicatorBase, ReadOnly, ReconnectedCallback, Required, RequiredConstraintValidation, ResizeController, Role, ScrollController, ScrollLockController, Selected, StepperButtonElementBase, SuppressInitialAnimation, TocGenerator, TooltipElementBase, Touched, VelocityTracker, Vertical, addCustomState, checkOrSelect, computeCssSize, computeLineCount, customElement, dateConverter, debounce, defaultValue, deleteCustomState, findFormFieldControl, focusWhenReady, forcedColorsActive, formValue, generateClipPaths, getScrollbarWidth, getTextContent, guid, hasAssignedNodes, hasCustomState, hasKeys, interceptProperty, internals, isAttachInternalsMixin, isCheckedIndeterminateMixin, isCheckedMixin, isCheckedOrSelected, isCheckedOrSelectedMixin, isConstraintValidationMixin, isDirtyMixin, isDisabledInteractiveMixin, isDisabledMixin, isFormAssociatedMixin, isFormFieldControl, isFormSubmitterMixin, isHtmlForMixin, isLabelledMixin, isLinkButtonMixin, isReadOnlyMixin, isRequiredConstraintValidationMixin, isRequiredMixin, isSelectedMixin, isTouchedMixin, isVerticalMixin, prefersReducedMotion, registerIcon, registerStyleSheet, renderPseudoLink, resolveElementById, resolveFragmentUrl, safeStyleMap, scrollIntoViewIfNeeded, setCustomState, spaceSeparatedStringConverter, updateLabels, validate, waitForUpgrade };
33921
+ export { ActionElementBase, AnimationLoopController, AttachInternals, CalendarViewElementBase, Checked, CheckedIndeterminate, ConstraintValidation, DesignToken, Dirty, Disabled, DisabledInteractive, EventAttribute, FocusController, Focusable, FormAssociated, FormSubmitter, HoverController, HtmlFor, InertController, IntersectionController, KeyboardClick, Labelled, LinkButton, LongPressController, M3eAccordionElement, M3eActionListElement, M3eAppBarElement, M3eAssistChipElement, M3eAutocompleteElement, M3eAvatarElement, M3eBadgeElement, M3eBottomSheetActionElement, M3eBottomSheetElement, M3eBottomSheetTriggerElement, M3eBreadcrumbElement, M3eBreadcrumbItemElement, M3eButtonElement, M3eButtonGroupElement, M3eButtonSegmentElement, M3eCalendarElement, M3eCardElement, M3eCheckboxElement, M3eChipElement, M3eChipSetElement, M3eCircularProgressIndicatorElement, M3eCollapsibleElement, M3eContentPaneElement, M3eDatepickerElement, M3eDatepickerToggleElement, M3eDialogActionElement, M3eDialogElement, M3eDialogTriggerElement, M3eDividerElement, M3eDrawerContainerElement, M3eDrawerToggleElement, M3eElevationElement, M3eExpandableListItemElement, M3eExpansionHeaderElement, M3eExpansionPanelElement, M3eFabElement, M3eFabMenuElement, M3eFabMenuItemElement, M3eFabMenuTriggerElement, M3eFilterChipElement, M3eFilterChipSetElement, M3eFocusRingElement, M3eFormFieldElement, M3eHeadingElement, M3eIconButtonElement, M3eIconElement, M3eInputChipElement, M3eInputChipSetElement, M3eLinearProgressIndicatorElement, M3eListActionElement, M3eListElement, M3eListItemElement, M3eListOptionElement, M3eLoadingIndicatorElement, M3eMenuElement, M3eMenuItemCheckboxElement, M3eMenuItemElement, M3eMenuItemGroupElement, M3eMenuItemRadioElement, M3eMenuTriggerElement, M3eMonthViewElement, M3eMultiYearViewElement, M3eNavBarElement, M3eNavItemElement, M3eNavMenuElement, M3eNavMenuItemElement, M3eNavMenuItemGroupElement, M3eNavRailElement, M3eNavRailToggleElement, M3eOptGroupElement, M3eOptionElement, M3eOptionPanelElement, M3ePaginatorElement, M3ePseudoCheckboxElement, M3ePseudoRadioElement, M3eRadioElement, M3eRadioGroupElement, M3eRichTooltipActionElement, M3eRichTooltipElement, M3eRippleElement, M3eScrollContainerElement, M3eSearchBarElement, M3eSearchViewElement, M3eSegmentedButtonElement, M3eSelectElement, M3eSelectionListElement, M3eShapeElement, M3eSkeletonElement, M3eSlideElement, M3eSlideGroupElement, M3eSliderElement, M3eSliderThumbElement, M3eSnackbar, M3eSnackbarElement, M3eSplitButtonElement, M3eSplitPaneElement, M3eStateLayerElement, M3eStepElement, M3eStepPanelElement, M3eStepperElement, M3eStepperNextElement, M3eStepperPreviousElement, M3eStepperResetElement, M3eSuggestionChipElement, M3eSwitchElement, M3eTabElement, M3eTabPanelElement, M3eTabsElement, M3eTextHighlightElement, M3eTextOverflowElement, M3eTextareaAutosizeElement, M3eThemeElement, M3eTocElement, M3eTocItemElement, M3eToolbarElement, M3eTooltipElement, M3eTreeElement, M3eTreeItemElement, M3eYearViewElement, MutationController, PressedController, ProgressElementIndicatorBase, ReadOnly, ReconnectedCallback, Required, RequiredConstraintValidation, ResizeController, Role, ScrollController, ScrollLockController, Selected, StepperButtonElementBase, SuppressInitialAnimation, TocGenerator, TooltipElementBase, Touched, VelocityTracker, Vertical, addCustomState, checkOrSelect, computeCssSize, computeLineCount, customElement, dateConverter, debounce, defaultValue, deleteCustomState, findFormFieldControl, focusWhenReady, forcedColorsActive, formValue, generateClipPaths, getColorFromImage, getScrollbarWidth, getTextContent, guid, hasAssignedNodes, hasCustomState, hasKeys, interceptProperty, internals, isAttachInternalsMixin, isCheckedIndeterminateMixin, isCheckedMixin, isCheckedOrSelected, isCheckedOrSelectedMixin, isConstraintValidationMixin, isDirtyMixin, isDisabledInteractiveMixin, isDisabledMixin, isFormAssociatedMixin, isFormFieldControl, isFormSubmitterMixin, isHtmlForMixin, isLabelledMixin, isLinkButtonMixin, isReadOnlyMixin, isRequiredConstraintValidationMixin, isRequiredMixin, isSelectedMixin, isTouchedMixin, isVerticalMixin, prefersReducedMotion, registerIcon, registerStyleSheet, renderPseudoLink, resolveElementById, resolveFragmentUrl, safeStyleMap, scrollIntoViewIfNeeded, setCustomState, spaceSeparatedStringConverter, updateLabels, validate, waitForUpgrade };
32886
33922
  //# sourceMappingURL=all.js.map