@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.
- package/dist/all.js +801 -473
- package/dist/all.js.map +1 -1
- package/dist/all.min.js +52 -58
- package/dist/all.min.js.map +1 -1
- package/dist/autocomplete.js +342 -69
- package/dist/autocomplete.js.map +1 -1
- package/dist/autocomplete.min.js +1 -1
- package/dist/autocomplete.min.js.map +1 -1
- package/dist/chips.js +18 -4
- package/dist/chips.js.map +1 -1
- package/dist/chips.min.js +1 -1
- package/dist/chips.min.js.map +1 -1
- package/dist/core-a11y.js +3 -118
- package/dist/core-a11y.js.map +1 -1
- package/dist/core-a11y.min.js +13 -4
- package/dist/core-a11y.min.js.map +1 -1
- package/dist/core-anchoring.js +193 -1
- package/dist/core-anchoring.js.map +1 -1
- package/dist/core-anchoring.min.js +1 -1
- package/dist/core-anchoring.min.js.map +1 -1
- package/dist/core.js +147 -91
- package/dist/core.js.map +1 -1
- package/dist/core.min.js +1 -1
- package/dist/core.min.js.map +1 -1
- package/dist/css-custom-data.json +408 -328
- package/dist/custom-elements.json +5820 -4150
- package/dist/html-custom-data.json +174 -99
- package/dist/loading-indicator.js +1 -0
- package/dist/loading-indicator.js.map +1 -1
- package/dist/loading-indicator.min.js +1 -1
- package/dist/loading-indicator.min.js.map +1 -1
- package/dist/menu.js +1 -1
- package/dist/menu.js.map +1 -1
- package/dist/menu.min.js +1 -1
- package/dist/menu.min.js.map +1 -1
- package/dist/option.js +94 -121
- package/dist/option.js.map +1 -1
- package/dist/option.min.js +1 -1
- package/dist/option.min.js.map +1 -1
- package/dist/progress-indicator.js +2 -0
- package/dist/progress-indicator.js.map +1 -1
- package/dist/progress-indicator.min.js +2 -2
- package/dist/progress-indicator.min.js.map +1 -1
- package/dist/select.js +59 -23
- package/dist/select.js.map +1 -1
- package/dist/select.min.js +1 -1
- package/dist/select.min.js.map +1 -1
- package/dist/src/autocomplete/AutocompleteElement.d.ts +71 -2
- package/dist/src/autocomplete/AutocompleteElement.d.ts.map +1 -1
- package/dist/src/autocomplete/AutocompleteFilterMode.d.ts +3 -0
- package/dist/src/autocomplete/AutocompleteFilterMode.d.ts.map +1 -0
- package/dist/src/autocomplete/QueryEventDetail.d.ts +12 -0
- package/dist/src/autocomplete/QueryEventDetail.d.ts.map +1 -0
- package/dist/src/autocomplete/index.d.ts +2 -0
- package/dist/src/autocomplete/index.d.ts.map +1 -1
- package/dist/src/chips/ChipElement.d.ts +2 -0
- package/dist/src/chips/ChipElement.d.ts.map +1 -1
- package/dist/src/chips/InputChipSetChangeEventDetail.d.ts +13 -0
- package/dist/src/chips/InputChipSetChangeEventDetail.d.ts.map +1 -0
- package/dist/src/chips/InputChipSetElement.d.ts +10 -0
- package/dist/src/chips/InputChipSetElement.d.ts.map +1 -1
- package/dist/src/chips/index.d.ts +1 -0
- package/dist/src/chips/index.d.ts.map +1 -1
- package/dist/src/core/a11y/FocusTrapElement.d.ts +1 -1
- package/dist/src/core/a11y/list-key/ListKeyManager.d.ts.map +1 -1
- package/dist/src/core/a11y/list-key/RadioKeyManager.d.ts +1 -2
- package/dist/src/core/a11y/list-key/RadioKeyManager.d.ts.map +1 -1
- package/dist/src/core/a11y/list-key/SelectionManager.d.ts +1 -2
- package/dist/src/core/a11y/list-key/SelectionManager.d.ts.map +1 -1
- package/dist/src/core/a11y/list-key/Typeahead.d.ts.map +1 -1
- package/dist/src/core/anchoring/FloatingPanelElement.d.ts +74 -0
- package/dist/src/core/anchoring/FloatingPanelElement.d.ts.map +1 -0
- package/dist/src/core/anchoring/index.d.ts +1 -0
- package/dist/src/core/anchoring/index.d.ts.map +1 -1
- package/dist/src/core/shared/controllers/MutationController.d.ts.map +1 -1
- package/dist/src/core/shared/controllers/ResizeController.d.ts.map +1 -1
- package/dist/src/core/shared/mixins/AttachInternals.d.ts.map +1 -1
- package/dist/src/core/shared/primitives/TextHighlightElement.d.ts +9 -2
- package/dist/src/core/shared/primitives/TextHighlightElement.d.ts.map +1 -1
- package/dist/src/core/shared/primitives/TextHighlightMode.d.ts +3 -0
- package/dist/src/core/shared/primitives/TextHighlightMode.d.ts.map +1 -0
- package/dist/src/core/shared/primitives/index.d.ts +2 -1
- package/dist/src/core/shared/primitives/index.d.ts.map +1 -1
- package/dist/src/loading-indicator/LoadingIndicatorElement.d.ts.map +1 -1
- package/dist/src/menu/MenuItemElementBase.d.ts.map +1 -1
- package/dist/src/option/OptionElement.d.ts +21 -1
- package/dist/src/option/OptionElement.d.ts.map +1 -1
- package/dist/src/option/OptionPanelElement.d.ts +11 -34
- package/dist/src/option/OptionPanelElement.d.ts.map +1 -1
- package/dist/src/option/OptionPanelState.d.ts +3 -0
- package/dist/src/option/OptionPanelState.d.ts.map +1 -0
- package/dist/src/option/index.d.ts +1 -0
- package/dist/src/option/index.d.ts.map +1 -1
- package/dist/src/progress-indicator/CircularProgressIndicatorElement.d.ts.map +1 -1
- package/dist/src/progress-indicator/LinearProgressIndicatorElement.d.ts.map +1 -1
- package/dist/src/select/SelectElement.d.ts +3 -2
- package/dist/src/select/SelectElement.d.ts.map +1 -1
- package/dist/src/toc/TocElement.d.ts.map +1 -1
- package/dist/toc.js +0 -1
- package/dist/toc.js.map +1 -1
- package/dist/toc.min.js +1 -1
- package/dist/toc.min.js.map +1 -1
- package/package.json +1 -1
- package/dist/datepicker.js +0 -2346
- package/dist/datepicker.js.map +0 -1
- package/dist/datepicker.min.js +0 -102
- package/dist/datepicker.min.js.map +0 -1
- package/dist/src/core/shared/decorators/component.d.ts +0 -19
- package/dist/src/core/shared/decorators/component.d.ts.map +0 -1
- package/dist/src/core/shared/decorators/element.d.ts +0 -19
- package/dist/src/core/shared/decorators/element.d.ts.map +0 -1
- package/dist/src/core/shared/utils/getState.d.ts +0 -15
- package/dist/src/core/shared/utils/getState.d.ts.map +0 -1
- package/dist/src/datepicker/CalendarElement.d.ts +0 -203
- package/dist/src/datepicker/CalendarElement.d.ts.map +0 -1
- package/dist/src/datepicker/CalendarView.d.ts +0 -3
- package/dist/src/datepicker/CalendarView.d.ts.map +0 -1
- package/dist/src/datepicker/CalendarViewElementBase.d.ts +0 -28
- package/dist/src/datepicker/CalendarViewElementBase.d.ts.map +0 -1
- package/dist/src/datepicker/DateAdapter.d.ts +0 -4
- package/dist/src/datepicker/DateAdapter.d.ts.map +0 -1
- package/dist/src/datepicker/DatepickerElement.d.ts +0 -180
- package/dist/src/datepicker/DatepickerElement.d.ts.map +0 -1
- package/dist/src/datepicker/DatepickerToggleElement.d.ts +0 -21
- package/dist/src/datepicker/DatepickerToggleElement.d.ts.map +0 -1
- package/dist/src/datepicker/DatepickerVariant.d.ts +0 -3
- package/dist/src/datepicker/DatepickerVariant.d.ts.map +0 -1
- package/dist/src/datepicker/MonthViewElement.d.ts +0 -35
- package/dist/src/datepicker/MonthViewElement.d.ts.map +0 -1
- package/dist/src/datepicker/MultiYearViewElement.d.ts +0 -27
- package/dist/src/datepicker/MultiYearViewElement.d.ts.map +0 -1
- package/dist/src/datepicker/YearViewElement.d.ts +0 -27
- package/dist/src/datepicker/YearViewElement.d.ts.map +0 -1
- package/dist/src/datepicker/index.d.ts +0 -10
- package/dist/src/datepicker/index.d.ts.map +0 -1
- package/dist/src/datepicker/utils.d.ts +0 -26
- 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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1667
|
-
|
|
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
|
-
|
|
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 -
|
|
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
|
-
*
|
|
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
|
|
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.
|
|
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
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
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
|