@m3e/web 2.0.5 → 2.1.1

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 (137) hide show
  1. package/dist/all.js +801 -473
  2. package/dist/all.js.map +1 -1
  3. package/dist/all.min.js +52 -58
  4. package/dist/all.min.js.map +1 -1
  5. package/dist/autocomplete.js +342 -69
  6. package/dist/autocomplete.js.map +1 -1
  7. package/dist/autocomplete.min.js +1 -1
  8. package/dist/autocomplete.min.js.map +1 -1
  9. package/dist/chips.js +18 -4
  10. package/dist/chips.js.map +1 -1
  11. package/dist/chips.min.js +1 -1
  12. package/dist/chips.min.js.map +1 -1
  13. package/dist/core-a11y.js +3 -118
  14. package/dist/core-a11y.js.map +1 -1
  15. package/dist/core-a11y.min.js +13 -4
  16. package/dist/core-a11y.min.js.map +1 -1
  17. package/dist/core-anchoring.js +193 -1
  18. package/dist/core-anchoring.js.map +1 -1
  19. package/dist/core-anchoring.min.js +1 -1
  20. package/dist/core-anchoring.min.js.map +1 -1
  21. package/dist/core.js +147 -91
  22. package/dist/core.js.map +1 -1
  23. package/dist/core.min.js +1 -1
  24. package/dist/core.min.js.map +1 -1
  25. package/dist/css-custom-data.json +408 -328
  26. package/dist/custom-elements.json +5820 -4150
  27. package/dist/html-custom-data.json +174 -99
  28. package/dist/loading-indicator.js +1 -0
  29. package/dist/loading-indicator.js.map +1 -1
  30. package/dist/loading-indicator.min.js +1 -1
  31. package/dist/loading-indicator.min.js.map +1 -1
  32. package/dist/menu.js +1 -1
  33. package/dist/menu.js.map +1 -1
  34. package/dist/menu.min.js +1 -1
  35. package/dist/menu.min.js.map +1 -1
  36. package/dist/option.js +94 -121
  37. package/dist/option.js.map +1 -1
  38. package/dist/option.min.js +1 -1
  39. package/dist/option.min.js.map +1 -1
  40. package/dist/progress-indicator.js +2 -0
  41. package/dist/progress-indicator.js.map +1 -1
  42. package/dist/progress-indicator.min.js +2 -2
  43. package/dist/progress-indicator.min.js.map +1 -1
  44. package/dist/select.js +59 -23
  45. package/dist/select.js.map +1 -1
  46. package/dist/select.min.js +1 -1
  47. package/dist/select.min.js.map +1 -1
  48. package/dist/src/autocomplete/AutocompleteElement.d.ts +71 -2
  49. package/dist/src/autocomplete/AutocompleteElement.d.ts.map +1 -1
  50. package/dist/src/autocomplete/AutocompleteFilterMode.d.ts +3 -0
  51. package/dist/src/autocomplete/AutocompleteFilterMode.d.ts.map +1 -0
  52. package/dist/src/autocomplete/QueryEventDetail.d.ts +12 -0
  53. package/dist/src/autocomplete/QueryEventDetail.d.ts.map +1 -0
  54. package/dist/src/autocomplete/index.d.ts +2 -0
  55. package/dist/src/autocomplete/index.d.ts.map +1 -1
  56. package/dist/src/chips/ChipElement.d.ts +2 -0
  57. package/dist/src/chips/ChipElement.d.ts.map +1 -1
  58. package/dist/src/chips/InputChipSetChangeEventDetail.d.ts +13 -0
  59. package/dist/src/chips/InputChipSetChangeEventDetail.d.ts.map +1 -0
  60. package/dist/src/chips/InputChipSetElement.d.ts +10 -0
  61. package/dist/src/chips/InputChipSetElement.d.ts.map +1 -1
  62. package/dist/src/chips/index.d.ts +1 -0
  63. package/dist/src/chips/index.d.ts.map +1 -1
  64. package/dist/src/core/a11y/FocusTrapElement.d.ts +1 -1
  65. package/dist/src/core/a11y/list-key/ListKeyManager.d.ts.map +1 -1
  66. package/dist/src/core/a11y/list-key/RadioKeyManager.d.ts +1 -2
  67. package/dist/src/core/a11y/list-key/RadioKeyManager.d.ts.map +1 -1
  68. package/dist/src/core/a11y/list-key/SelectionManager.d.ts +1 -2
  69. package/dist/src/core/a11y/list-key/SelectionManager.d.ts.map +1 -1
  70. package/dist/src/core/a11y/list-key/Typeahead.d.ts.map +1 -1
  71. package/dist/src/core/anchoring/FloatingPanelElement.d.ts +74 -0
  72. package/dist/src/core/anchoring/FloatingPanelElement.d.ts.map +1 -0
  73. package/dist/src/core/anchoring/index.d.ts +1 -0
  74. package/dist/src/core/anchoring/index.d.ts.map +1 -1
  75. package/dist/src/core/shared/controllers/MutationController.d.ts.map +1 -1
  76. package/dist/src/core/shared/controllers/ResizeController.d.ts.map +1 -1
  77. package/dist/src/core/shared/mixins/AttachInternals.d.ts.map +1 -1
  78. package/dist/src/core/shared/primitives/TextHighlightElement.d.ts +9 -2
  79. package/dist/src/core/shared/primitives/TextHighlightElement.d.ts.map +1 -1
  80. package/dist/src/core/shared/primitives/TextHighlightMode.d.ts +3 -0
  81. package/dist/src/core/shared/primitives/TextHighlightMode.d.ts.map +1 -0
  82. package/dist/src/core/shared/primitives/index.d.ts +2 -1
  83. package/dist/src/core/shared/primitives/index.d.ts.map +1 -1
  84. package/dist/src/loading-indicator/LoadingIndicatorElement.d.ts.map +1 -1
  85. package/dist/src/menu/MenuItemElementBase.d.ts.map +1 -1
  86. package/dist/src/option/OptionElement.d.ts +21 -1
  87. package/dist/src/option/OptionElement.d.ts.map +1 -1
  88. package/dist/src/option/OptionPanelElement.d.ts +11 -34
  89. package/dist/src/option/OptionPanelElement.d.ts.map +1 -1
  90. package/dist/src/option/OptionPanelState.d.ts +3 -0
  91. package/dist/src/option/OptionPanelState.d.ts.map +1 -0
  92. package/dist/src/option/index.d.ts +1 -0
  93. package/dist/src/option/index.d.ts.map +1 -1
  94. package/dist/src/progress-indicator/CircularProgressIndicatorElement.d.ts.map +1 -1
  95. package/dist/src/progress-indicator/LinearProgressIndicatorElement.d.ts.map +1 -1
  96. package/dist/src/select/SelectElement.d.ts +3 -2
  97. package/dist/src/select/SelectElement.d.ts.map +1 -1
  98. package/dist/src/toc/TocElement.d.ts.map +1 -1
  99. package/dist/toc.js +0 -1
  100. package/dist/toc.js.map +1 -1
  101. package/dist/toc.min.js +1 -1
  102. package/dist/toc.min.js.map +1 -1
  103. package/package.json +1 -1
  104. package/dist/datepicker.js +0 -2346
  105. package/dist/datepicker.js.map +0 -1
  106. package/dist/datepicker.min.js +0 -102
  107. package/dist/datepicker.min.js.map +0 -1
  108. package/dist/src/core/shared/decorators/component.d.ts +0 -19
  109. package/dist/src/core/shared/decorators/component.d.ts.map +0 -1
  110. package/dist/src/core/shared/decorators/element.d.ts +0 -19
  111. package/dist/src/core/shared/decorators/element.d.ts.map +0 -1
  112. package/dist/src/core/shared/utils/getState.d.ts +0 -15
  113. package/dist/src/core/shared/utils/getState.d.ts.map +0 -1
  114. package/dist/src/datepicker/CalendarElement.d.ts +0 -203
  115. package/dist/src/datepicker/CalendarElement.d.ts.map +0 -1
  116. package/dist/src/datepicker/CalendarView.d.ts +0 -3
  117. package/dist/src/datepicker/CalendarView.d.ts.map +0 -1
  118. package/dist/src/datepicker/CalendarViewElementBase.d.ts +0 -28
  119. package/dist/src/datepicker/CalendarViewElementBase.d.ts.map +0 -1
  120. package/dist/src/datepicker/DateAdapter.d.ts +0 -4
  121. package/dist/src/datepicker/DateAdapter.d.ts.map +0 -1
  122. package/dist/src/datepicker/DatepickerElement.d.ts +0 -180
  123. package/dist/src/datepicker/DatepickerElement.d.ts.map +0 -1
  124. package/dist/src/datepicker/DatepickerToggleElement.d.ts +0 -21
  125. package/dist/src/datepicker/DatepickerToggleElement.d.ts.map +0 -1
  126. package/dist/src/datepicker/DatepickerVariant.d.ts +0 -3
  127. package/dist/src/datepicker/DatepickerVariant.d.ts.map +0 -1
  128. package/dist/src/datepicker/MonthViewElement.d.ts +0 -35
  129. package/dist/src/datepicker/MonthViewElement.d.ts.map +0 -1
  130. package/dist/src/datepicker/MultiYearViewElement.d.ts +0 -27
  131. package/dist/src/datepicker/MultiYearViewElement.d.ts.map +0 -1
  132. package/dist/src/datepicker/YearViewElement.d.ts +0 -27
  133. package/dist/src/datepicker/YearViewElement.d.ts.map +0 -1
  134. package/dist/src/datepicker/index.d.ts +0 -10
  135. package/dist/src/datepicker/index.d.ts.map +0 -1
  136. package/dist/src/datepicker/utils.d.ts +0 -26
  137. package/dist/src/datepicker/utils.d.ts.map +0 -1
package/dist/core.js CHANGED
@@ -1034,7 +1034,7 @@ _LongPressController_callback = new WeakMap(), _LongPressController_threshold =
1034
1034
  }
1035
1035
  };
1036
1036
 
1037
- var _MutationController_host, _MutationController_callback, _MutationController_skipInitial, _MutationController_config, _MutationController_observer, _MutationController_unobservedUpdate;
1037
+ var _MutationController_callback, _MutationController_skipInitial, _MutationController_config, _MutationController_observer, _MutationController_unobservedUpdate;
1038
1038
  /**
1039
1039
  * A `ReactiveController` that integrates a `MutationObserver` with an element's reactive update lifecycle
1040
1040
  * to detect arbitrary changes to DOM, including nodes being added or removed and attributes changing.
@@ -1048,8 +1048,6 @@ class MutationController extends MonitorControllerBase {
1048
1048
  constructor(host, options) {
1049
1049
  super(host, options);
1050
1050
  /** @private */
1051
- _MutationController_host.set(this, void 0);
1052
- /** @private */
1053
1051
  _MutationController_callback.set(this, void 0);
1054
1052
  /** @private */
1055
1053
  _MutationController_skipInitial.set(this, false);
@@ -1059,7 +1057,6 @@ class MutationController extends MonitorControllerBase {
1059
1057
  _MutationController_observer.set(this, void 0);
1060
1058
  /** @private */
1061
1059
  _MutationController_unobservedUpdate.set(this, true);
1062
- __classPrivateFieldSet(this, _MutationController_host, host, "f");
1063
1060
  __classPrivateFieldSet(this, _MutationController_callback, options.callback, "f");
1064
1061
  __classPrivateFieldSet(this, _MutationController_skipInitial, options.skipInitial ?? false, "f");
1065
1062
  __classPrivateFieldSet(this, _MutationController_config, options.config, "f");
@@ -1068,10 +1065,7 @@ class MutationController extends MonitorControllerBase {
1068
1065
  console.warn("MutationController error: the browser does not support MutationObserver.");
1069
1066
  return;
1070
1067
  }
1071
- __classPrivateFieldSet(this, _MutationController_observer, new MutationObserver((records, observer) => {
1072
- __classPrivateFieldGet(this, _MutationController_callback, "f").call(this, records, observer);
1073
- __classPrivateFieldGet(this, _MutationController_host, "f").requestUpdate();
1074
- }), "f");
1068
+ __classPrivateFieldSet(this, _MutationController_observer, new MutationObserver((records, observer) => __classPrivateFieldGet(this, _MutationController_callback, "f").call(this, records, observer)), "f");
1075
1069
  }
1076
1070
  /** @inheritdoc */
1077
1071
  async hostUpdated() {
@@ -1092,7 +1086,6 @@ class MutationController extends MonitorControllerBase {
1092
1086
  _observe(target) {
1093
1087
  __classPrivateFieldGet(this, _MutationController_observer, "f")?.observe(target, __classPrivateFieldGet(this, _MutationController_config, "f"));
1094
1088
  __classPrivateFieldSet(this, _MutationController_unobservedUpdate, true, "f");
1095
- __classPrivateFieldGet(this, _MutationController_host, "f").requestUpdate();
1096
1089
  }
1097
1090
  /** @inheritdoc */
1098
1091
  _unobserve() {
@@ -1102,7 +1095,7 @@ class MutationController extends MonitorControllerBase {
1102
1095
  }
1103
1096
  }
1104
1097
  }
1105
- _MutationController_host = new WeakMap(), _MutationController_callback = new WeakMap(), _MutationController_skipInitial = new WeakMap(), _MutationController_config = new WeakMap(), _MutationController_observer = new WeakMap(), _MutationController_unobservedUpdate = new WeakMap();
1098
+ _MutationController_callback = new WeakMap(), _MutationController_skipInitial = new WeakMap(), _MutationController_config = new WeakMap(), _MutationController_observer = new WeakMap(), _MutationController_unobservedUpdate = new WeakMap();
1106
1099
 
1107
1100
  var _PressedController_instances, _PressedController_capture, _PressedController_callback, _PressedController_isPressedKey, _PressedController_pressedTargets, _PressedController_minPressedDuration, _PressedController_pointerDownHandler, _PressedController_pointerUpHandler, _PressedController_touchEndHandler, _PressedController_keyDownHandler, _PressedController_keyUpHandler, _PressedController_handlePointerDown, _PressedController_handlePointerUp, _PressedController_handleTouchEnd, _PressedController_handleKeyDown, _PressedController_handleKeyUp, _PressedController_clearPressedTargets;
1108
1101
  /** A `ReactiveController` used to monitor the pressed state of one or more elements. */
@@ -1279,7 +1272,7 @@ _PressedController_capture = new WeakMap(), _PressedController_callback = new We
1279
1272
  }
1280
1273
  };
1281
1274
 
1282
- var _ResizeController_host, _ResizeController_callback, _ResizeController_skipInitial, _ResizeController_config, _ResizeController_observer, _ResizeController_unobservedUpdate;
1275
+ var _ResizeController_callback, _ResizeController_skipInitial, _ResizeController_config, _ResizeController_observer, _ResizeController_unobservedUpdate;
1283
1276
  /** A `ReactiveController` used to monitor when an element is resized. */
1284
1277
  class ResizeController extends MonitorControllerBase {
1285
1278
  /**
@@ -1290,8 +1283,6 @@ class ResizeController extends MonitorControllerBase {
1290
1283
  constructor(host, options) {
1291
1284
  super(host, options);
1292
1285
  /** @private */
1293
- _ResizeController_host.set(this, void 0);
1294
- /** @private */
1295
1286
  _ResizeController_callback.set(this, void 0);
1296
1287
  /** @private */
1297
1288
  _ResizeController_skipInitial.set(this, void 0);
@@ -1301,7 +1292,6 @@ class ResizeController extends MonitorControllerBase {
1301
1292
  _ResizeController_observer.set(this, void 0);
1302
1293
  /** @private */
1303
1294
  _ResizeController_unobservedUpdate.set(this, true);
1304
- __classPrivateFieldSet(this, _ResizeController_host, host, "f");
1305
1295
  __classPrivateFieldSet(this, _ResizeController_callback, options.callback, "f");
1306
1296
  __classPrivateFieldSet(this, _ResizeController_skipInitial, options.skipInitial ?? false, "f");
1307
1297
  __classPrivateFieldSet(this, _ResizeController_config, options.config, "f");
@@ -1310,10 +1300,7 @@ class ResizeController extends MonitorControllerBase {
1310
1300
  console.warn("ResizeController error: the browser does not support ResizeObserver.");
1311
1301
  return;
1312
1302
  }
1313
- __classPrivateFieldSet(this, _ResizeController_observer, new ResizeObserver((entries, observer) => {
1314
- __classPrivateFieldGet(this, _ResizeController_callback, "f").call(this, entries, observer);
1315
- __classPrivateFieldGet(this, _ResizeController_host, "f").requestUpdate();
1316
- }), "f");
1303
+ __classPrivateFieldSet(this, _ResizeController_observer, new ResizeObserver((entries, observer) => __classPrivateFieldGet(this, _ResizeController_callback, "f").call(this, entries, observer)), "f");
1317
1304
  }
1318
1305
  /** @inheritdoc */
1319
1306
  async hostUpdated() {
@@ -1329,7 +1316,6 @@ class ResizeController extends MonitorControllerBase {
1329
1316
  _observe(target) {
1330
1317
  __classPrivateFieldGet(this, _ResizeController_observer, "f")?.observe(target, __classPrivateFieldGet(this, _ResizeController_config, "f"));
1331
1318
  __classPrivateFieldSet(this, _ResizeController_unobservedUpdate, true, "f");
1332
- __classPrivateFieldGet(this, _ResizeController_host, "f").requestUpdate();
1333
1319
  }
1334
1320
  /**
1335
1321
  * Stops observing the specified element.
@@ -1339,7 +1325,7 @@ class ResizeController extends MonitorControllerBase {
1339
1325
  __classPrivateFieldGet(this, _ResizeController_observer, "f")?.unobserve(target);
1340
1326
  }
1341
1327
  }
1342
- _ResizeController_host = new WeakMap(), _ResizeController_callback = new WeakMap(), _ResizeController_skipInitial = new WeakMap(), _ResizeController_config = new WeakMap(), _ResizeController_observer = new WeakMap(), _ResizeController_unobservedUpdate = new WeakMap();
1328
+ _ResizeController_callback = new WeakMap(), _ResizeController_skipInitial = new WeakMap(), _ResizeController_config = new WeakMap(), _ResizeController_observer = new WeakMap(), _ResizeController_unobservedUpdate = new WeakMap();
1343
1329
 
1344
1330
  /**
1345
1331
  * Class decorator factory that defines the decorated class as a custom element.
@@ -1630,6 +1616,9 @@ function isAttachInternalsMixin(value) {
1630
1616
  return hasKeys(value, internals);
1631
1617
  }
1632
1618
  const _internals = Symbol("_internals");
1619
+ // Since flushing custom state doesn't flush in Safari (affecting all iOS browsers),
1620
+ // a copy of custom state is retained locally so components can correctly read after write.
1621
+ const _customState = Symbol("_customState");
1633
1622
  /**
1634
1623
  * Mixin to augment an element with behavior that attaches to `ElementInternals`.
1635
1624
  * @template T The type of the base class.
@@ -1638,9 +1627,17 @@ const _internals = Symbol("_internals");
1638
1627
  * @returns {Constructor<AttachInternalsMixin> & T} A constructor that implements `AttachInternalsMixin`.
1639
1628
  */
1640
1629
  function AttachInternals(base, formAssociated) {
1630
+ var _a;
1641
1631
  class _AttachInternals extends base {
1632
+ constructor() {
1633
+ super(...arguments);
1634
+ // Since flushing custom state doesn't flush in Safari (affecting all iOS browsers),
1635
+ // a copy of custom state is retained locally so components can correctly read after write.
1636
+ /** @private */
1637
+ this[_a] = new Set();
1638
+ }
1642
1639
  /** @internal */
1643
- get [internals]() {
1640
+ get [(_a = _customState, internals)]() {
1644
1641
  return this[_internals] ?? (this[_internals] = this.attachInternals());
1645
1642
  }
1646
1643
  }
@@ -1655,7 +1652,14 @@ function AttachInternals(base, formAssociated) {
1655
1652
  * @returns {boolean} Whether `element` has `state`.
1656
1653
  */
1657
1654
  function hasCustomState(element, state) {
1658
- return isServer ? false : element[internals].states.has(state);
1655
+ // Since flushing custom state doesn't flush in Safari (affecting all iOS browsers),
1656
+ // a copy of custom state is retained locally so components can correctly read after write.
1657
+ if (_customState in element) {
1658
+ return element[_customState].has(state);
1659
+ }
1660
+ // This should never get called due to needing a local copy of custom state
1661
+ // since reading after write to flush doesn't work in Safari (affecting all iOS browsers).
1662
+ return element[internals].states.has(state);
1659
1663
  }
1660
1664
  /**
1661
1665
  * Convenience function used to add custom state to an element.
@@ -1663,9 +1667,13 @@ function hasCustomState(element, state) {
1663
1667
  * @param {string} state The custom state to add.
1664
1668
  */
1665
1669
  function addCustomState(element, state) {
1666
- if (!isServer) {
1667
- element[internals]?.states.add(state);
1670
+ // Since flushing custom state doesn't flush in Safari (affecting all iOS browsers),
1671
+ // a copy of custom state is retained locally so components can correctly read after write.
1672
+ if (_customState in element) {
1673
+ element[_customState].add(state);
1668
1674
  }
1675
+ element[internals]?.states.add(state);
1676
+ element[internals]?.states.has(state); // flush (even though this doesn't work in Safari)
1669
1677
  }
1670
1678
  /**
1671
1679
  * Convenience function used to delete custom state from an element.
@@ -1674,7 +1682,16 @@ function addCustomState(element, state) {
1674
1682
  * @returns {boolean} Whether `state` was removed from `element`.
1675
1683
  */
1676
1684
  function deleteCustomState(element, state) {
1677
- return !isServer && element[internals]?.states.delete(state);
1685
+ // Since flushing custom state doesn't flush in Safari (affecting all iOS browsers),
1686
+ // a copy of custom state is retained locally so components can correctly read after write.
1687
+ if (_customState in element) {
1688
+ element[_customState].delete(state);
1689
+ }
1690
+ if (element[internals]?.states.delete(state)) {
1691
+ element[internals]?.states.has(state); // flush (even though this doesn't work in Safari)
1692
+ return true;
1693
+ }
1694
+ return false;
1678
1695
  }
1679
1696
  /**
1680
1697
  * Convenience function used to add or delete custom state for an element.
@@ -4757,41 +4774,6 @@ __decorate([property({
4757
4774
  })], M3eStateLayerElement.prototype, "disableHover", void 0);
4758
4775
  M3eStateLayerElement = __decorate([customElement("m3e-state-layer")], M3eStateLayerElement);
4759
4776
 
4760
- /**
4761
- * An inline container which presents an ellipsis when content overflows.
4762
- *
4763
- * @description
4764
- * The `m3e-text-overflow` component truncates inline content with an ellipsis when it
4765
- * exceeds the available width. It's intended for use inside flex or otherwise
4766
- * constrained containers to preserve layout while providing predictable, single-line
4767
- * truncation behavior for long text.
4768
- *
4769
- * @example
4770
- * A typical usage inside a flex container where the heading and trailing actions are
4771
- * constrained, allowing the center text to truncate with an ellipsis.
4772
- *
4773
- * ```html
4774
- * <div style="display:flex;align-items:center;gap:12px;">
4775
- * <m3e-icon name="menu"></m3e-icon>
4776
- * <m3e-text-overflow>Very long title or breadcrumb that should truncate gracefully</m3e-text-overflow>
4777
- * <m3e-icon name="more_vert"></m3e-icon>
4778
- * </div>
4779
- * ```
4780
- *
4781
- * @tag m3e-text-overflow
4782
- *
4783
- * @slot - Renders the content to truncate with an ellipsis.
4784
- */
4785
- let M3eTextOverflowElement = class M3eTextOverflowElement extends LitElement {
4786
- /** @inheritdoc */
4787
- render() {
4788
- return html`<span class="base"><slot></slot></span>`;
4789
- }
4790
- };
4791
- /** The styles of the element. */
4792
- M3eTextOverflowElement.styles = css`:host { flex: 1 1 auto; display: inline-flex; align-items: center; flex-wrap: nowrap; min-width: 0; } .base { flex: 1 1 auto; display: inline; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }`;
4793
- M3eTextOverflowElement = __decorate([customElement("m3e-text-overflow")], M3eTextOverflowElement);
4794
-
4795
4777
  var _M3eTextHighlightElement_instances, _M3eTextHighlightElement_id, _M3eTextHighlightElement_ranges, _M3eTextHighlightElement_styles, _M3eTextHighlightElement_isTextNode, _M3eTextHighlightElement_findTextNodes, _M3eTextHighlightElement_highlight;
4796
4778
  var M3eTextHighlightElement_1;
4797
4779
  /**
@@ -4815,8 +4797,9 @@ var M3eTextHighlightElement_1;
4815
4797
  *
4816
4798
  * @slot - Renders the content to highlight.
4817
4799
  *
4818
- * @attr case-sensitive - A value indicating whether matching is case sensitive.
4800
+ * @attr case-sensitive - Whether matching is case sensitive.
4819
4801
  * @attr disabled - A value indicating whether text highlighting is disabled.
4802
+ * @attr mode - The mode in which to highlight text.
4820
4803
  * @attr term - The term to highlight.
4821
4804
  *
4822
4805
  * @fires highlight - Emitted when content is highlighted.
@@ -4847,10 +4830,15 @@ let M3eTextHighlightElement = M3eTextHighlightElement_1 = class M3eTextHighlight
4847
4830
  */
4848
4831
  this.term = "";
4849
4832
  /**
4850
- * A value indicating whether matching is case sensitive.
4833
+ * Whether matching is case sensitive.
4851
4834
  * @default false
4852
4835
  */
4853
4836
  this.caseSensitive = false;
4837
+ /**
4838
+ * The mode in which to highlight text.
4839
+ * @default "contains"
4840
+ */
4841
+ this.mode = "contains";
4854
4842
  if (this.isSupported) {
4855
4843
  __classPrivateFieldSet(this, _M3eTextHighlightElement_styles, new CSSStyleSheet(), "f");
4856
4844
  __classPrivateFieldGet(this, _M3eTextHighlightElement_styles, "f").replaceSync(css`::highlight(${unsafeCSS(__classPrivateFieldGet(this, _M3eTextHighlightElement_id, "f"))}) { background-color: var(--m3e-text-highlight-container-color, ${DesignToken.color.secondaryContainer}); color: var(--m3e-text-highlight-color, ${DesignToken.color.onSecondaryContainer}); text-decoration: var(--m3e-text-highlight-decoration); text-shadow: var(--m3e-text-highlight-shadow); }`.toString());
@@ -4888,11 +4876,11 @@ _M3eTextHighlightElement_ranges = new WeakMap();
4888
4876
  _M3eTextHighlightElement_styles = new WeakMap();
4889
4877
  _M3eTextHighlightElement_instances = new WeakSet();
4890
4878
  _M3eTextHighlightElement_isTextNode = function _M3eTextHighlightElement_isTextNode(node) {
4891
- return /^(\\s|\\n)+$/gi.test(node.data) ? false : true;
4879
+ return !/^\s*$/.test(node.data);
4892
4880
  };
4893
4881
  _M3eTextHighlightElement_findTextNodes = function _M3eTextHighlightElement_findTextNodes(parent, nodes) {
4894
4882
  if (parent instanceof HTMLSlotElement) {
4895
- parent.assignedElements({
4883
+ parent.assignedNodes({
4896
4884
  flatten: true
4897
4885
  }).forEach(x => {
4898
4886
  switch (x.nodeType) {
@@ -4936,33 +4924,65 @@ _M3eTextHighlightElement_highlight = function _M3eTextHighlightElement_highlight
4936
4924
  }
4937
4925
  const texts = new Array();
4938
4926
  __classPrivateFieldGet(this, _M3eTextHighlightElement_instances, "m", _M3eTextHighlightElement_findTextNodes).call(this, this, texts);
4939
- const term = !this.caseSensitive ? this.term.toLowerCase() : this.term;
4940
- __classPrivateFieldSet(this, _M3eTextHighlightElement_ranges, texts.map(x => {
4941
- return {
4942
- el: x,
4943
- text: (!this.caseSensitive ? x.textContent?.toLowerCase() : x.textContent) ?? ""
4944
- };
4945
- }).map(({
4946
- el,
4947
- text
4948
- }) => {
4949
- const indices = new Array();
4950
- let startPos = 0;
4951
- while (startPos < text.length) {
4952
- const index = text.indexOf(term, startPos);
4953
- if (index === -1) break;
4954
- indices.push(index);
4955
- startPos = index + term.length;
4956
- }
4957
- return indices.map(index => {
4958
- const range = new Range();
4959
- range.setStart(el, index);
4960
- range.setEnd(el, index + term.length);
4961
- return range;
4962
- });
4963
- }).flat(), "f");
4964
- if (__classPrivateFieldGet(this, _M3eTextHighlightElement_ranges, "f").length > 0) {
4965
- CSS.highlights.set(__classPrivateFieldGet(this, _M3eTextHighlightElement_id, "f"), new Highlight(...__classPrivateFieldGet(this, _M3eTextHighlightElement_ranges, "f")));
4927
+ if (texts.length > 0) {
4928
+ const term = !this.caseSensitive ? this.term.toLowerCase() : this.term;
4929
+ switch (this.mode) {
4930
+ case "starts-with":
4931
+ {
4932
+ const first = texts[0];
4933
+ const text = (this.caseSensitive ? first.textContent : first.textContent?.toLowerCase()) ?? "";
4934
+ if (text.startsWith(term)) {
4935
+ const range = new Range();
4936
+ range.setStart(first, 0);
4937
+ range.setEnd(first, term.length);
4938
+ __classPrivateFieldGet(this, _M3eTextHighlightElement_ranges, "f").push(range);
4939
+ }
4940
+ }
4941
+ break;
4942
+ case "ends-with":
4943
+ {
4944
+ const last = texts[texts.length - 1];
4945
+ const text = (this.caseSensitive ? last.textContent : last.textContent?.toLowerCase()) ?? "";
4946
+ if (text.endsWith(term)) {
4947
+ const start = text.length - term.length;
4948
+ const end = start + term.length;
4949
+ const range = new Range();
4950
+ range.setStart(last, start);
4951
+ range.setEnd(last, end);
4952
+ __classPrivateFieldGet(this, _M3eTextHighlightElement_ranges, "f").push(range);
4953
+ }
4954
+ }
4955
+ break;
4956
+ case "contains":
4957
+ __classPrivateFieldSet(this, _M3eTextHighlightElement_ranges, texts.map(x => {
4958
+ return {
4959
+ el: x,
4960
+ text: (!this.caseSensitive ? x.textContent?.toLowerCase() : x.textContent) ?? ""
4961
+ };
4962
+ }).map(({
4963
+ el,
4964
+ text
4965
+ }) => {
4966
+ const indices = new Array();
4967
+ let startPos = 0;
4968
+ while (startPos < text.length) {
4969
+ const index = text.indexOf(term, startPos);
4970
+ if (index === -1) break;
4971
+ indices.push(index);
4972
+ startPos = index + term.length;
4973
+ }
4974
+ return indices.map(index => {
4975
+ const range = new Range();
4976
+ range.setStart(el, index);
4977
+ range.setEnd(el, index + term.length);
4978
+ return range;
4979
+ });
4980
+ }).flat(), "f");
4981
+ break;
4982
+ }
4983
+ if (__classPrivateFieldGet(this, _M3eTextHighlightElement_ranges, "f").length > 0) {
4984
+ CSS.highlights.set(__classPrivateFieldGet(this, _M3eTextHighlightElement_id, "f"), new Highlight(...__classPrivateFieldGet(this, _M3eTextHighlightElement_ranges, "f")));
4985
+ }
4966
4986
  }
4967
4987
  this.dispatchEvent(new CustomEvent("highlight", {
4968
4988
  detail: [...__classPrivateFieldGet(this, _M3eTextHighlightElement_ranges, "f")],
@@ -4983,7 +5003,43 @@ __decorate([property({
4983
5003
  attribute: "case-sensitive",
4984
5004
  type: Boolean
4985
5005
  })], M3eTextHighlightElement.prototype, "caseSensitive", void 0);
5006
+ __decorate([property()], M3eTextHighlightElement.prototype, "mode", void 0);
4986
5007
  M3eTextHighlightElement = M3eTextHighlightElement_1 = __decorate([customElement("m3e-text-highlight")], M3eTextHighlightElement);
4987
5008
 
5009
+ /**
5010
+ * An inline container which presents an ellipsis when content overflows.
5011
+ *
5012
+ * @description
5013
+ * The `m3e-text-overflow` component truncates inline content with an ellipsis when it
5014
+ * exceeds the available width. It's intended for use inside flex or otherwise
5015
+ * constrained containers to preserve layout while providing predictable, single-line
5016
+ * truncation behavior for long text.
5017
+ *
5018
+ * @example
5019
+ * A typical usage inside a flex container where the heading and trailing actions are
5020
+ * constrained, allowing the center text to truncate with an ellipsis.
5021
+ *
5022
+ * ```html
5023
+ * <div style="display:flex;align-items:center;gap:12px;">
5024
+ * <m3e-icon name="menu"></m3e-icon>
5025
+ * <m3e-text-overflow>Very long title or breadcrumb that should truncate gracefully</m3e-text-overflow>
5026
+ * <m3e-icon name="more_vert"></m3e-icon>
5027
+ * </div>
5028
+ * ```
5029
+ *
5030
+ * @tag m3e-text-overflow
5031
+ *
5032
+ * @slot - Renders the content to truncate with an ellipsis.
5033
+ */
5034
+ let M3eTextOverflowElement = class M3eTextOverflowElement extends LitElement {
5035
+ /** @inheritdoc */
5036
+ render() {
5037
+ return html`<span class="base"><slot></slot></span>`;
5038
+ }
5039
+ };
5040
+ /** The styles of the element. */
5041
+ M3eTextOverflowElement.styles = css`:host { flex: 1 1 auto; display: inline-flex; align-items: center; flex-wrap: nowrap; min-width: 0; } .base { flex: 1 1 auto; display: inline; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }`;
5042
+ M3eTextOverflowElement = __decorate([customElement("m3e-text-overflow")], M3eTextOverflowElement);
5043
+
4988
5044
  export { ActionElementBase, AnimationLoopController, AttachInternals, Checked, CheckedIndeterminate, ConstraintValidation, DesignToken, Dirty, Disabled, DisabledInteractive, EventAttribute, FocusController, Focusable, FormAssociated, FormSubmitter, HoverController, HtmlFor, IntersectionController, KeyboardClick, Labelled, LinkButton, LongPressController, M3eCollapsibleElement, M3eElevationElement, M3eFocusRingElement, M3ePseudoCheckboxElement, M3ePseudoRadioElement, M3eRippleElement, M3eScrollContainerElement, M3eSlideElement, M3eStateLayerElement, M3eTextHighlightElement, M3eTextOverflowElement, MutationController, PressedController, ReadOnly, Required, RequiredConstraintValidation, ResizeController, Role, ScrollController, ScrollLockController, Selected, Touched, VelocityTracker, Vertical, addCustomState, checkOrSelect, computeCssSize, computeLineCount, customElement, debounce, defaultValue, deleteCustomState, focusWhenReady, forcedColorsActive, formValue, generateClipPaths, getTextContent, guid, hasAssignedNodes, hasCustomState, hasKeys, interceptProperty, internals, isAttachInternalsMixin, isCheckedIndeterminateMixin, isCheckedMixin, isCheckedOrSelected, isCheckedOrSelectedMixin, isConstraintValidationMixin, isDirtyMixin, isDisabledInteractiveMixin, isDisabledMixin, isFormAssociatedMixin, isFormSubmitterMixin, isHtmlForMixin, isLabelledMixin, isLinkButtonMixin, isReadOnlyMixin, isRequiredConstraintValidationMixin, isRequiredMixin, isSelectedMixin, isTouchedMixin, isVerticalMixin, prefersReducedMotion, renderPseudoLink, resolveElementById, resolveFragmentUrl, safeStyleMap, scrollIntoViewIfNeeded, setCustomState, spaceSeparatedStringConverter, updateLabels, validate };
4989
5045
  //# sourceMappingURL=core.js.map