@m3e/core 1.0.0-rc.1 → 1.0.0-rc.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.
- package/README.md +1 -2
- package/dist/a11y.js +6 -18
- package/dist/a11y.js.map +1 -1
- package/dist/a11y.min.js +5 -5
- package/dist/a11y.min.js.map +1 -1
- package/dist/css-custom-data.json +20 -0
- package/dist/custom-elements.json +3605 -3375
- package/dist/html-custom-data.json +36 -6
- package/dist/index.js +417 -33
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +95 -84
- package/dist/index.min.js.map +1 -1
- package/dist/src/a11y/FocusTrapElement.d.ts +1 -1
- package/dist/src/a11y/FocusTrapElement.d.ts.map +1 -1
- package/dist/src/shared/controllers/PressedController.d.ts +2 -0
- package/dist/src/shared/controllers/PressedController.d.ts.map +1 -1
- package/dist/src/shared/mixins/AttachInternals.d.ts.map +1 -1
- package/dist/src/shared/mixins/Checked.d.ts.map +1 -1
- package/dist/src/shared/mixins/CheckedIndeterminate.d.ts.map +1 -1
- package/dist/src/shared/mixins/ConstraintValidation.d.ts.map +1 -1
- package/dist/src/shared/mixins/Dirty.d.ts.map +1 -1
- package/dist/src/shared/mixins/Disabled.d.ts.map +1 -1
- package/dist/src/shared/mixins/DisabledInteractive.d.ts.map +1 -1
- package/dist/src/shared/mixins/EventAttribute.d.ts.map +1 -1
- package/dist/src/shared/mixins/Focusable.d.ts.map +1 -1
- package/dist/src/shared/mixins/FormAssociated.d.ts.map +1 -1
- package/dist/src/shared/mixins/FormSubmitter.d.ts +4 -1
- package/dist/src/shared/mixins/FormSubmitter.d.ts.map +1 -1
- package/dist/src/shared/mixins/HtmlFor.d.ts.map +1 -1
- package/dist/src/shared/mixins/KeyboardClick.d.ts.map +1 -1
- package/dist/src/shared/mixins/Labelled.d.ts.map +1 -1
- package/dist/src/shared/mixins/LinkButton.d.ts +13 -3
- package/dist/src/shared/mixins/LinkButton.d.ts.map +1 -1
- package/dist/src/shared/mixins/ReadOnly.d.ts.map +1 -1
- package/dist/src/shared/mixins/Required.d.ts.map +1 -1
- package/dist/src/shared/mixins/RequiredConstraintValidation.d.ts.map +1 -1
- package/dist/src/shared/mixins/Role.d.ts.map +1 -1
- package/dist/src/shared/mixins/Selected.d.ts.map +1 -1
- package/dist/src/shared/mixins/Touched.d.ts.map +1 -1
- package/dist/src/shared/mixins/Vertical.d.ts.map +1 -1
- package/dist/src/shared/primitives/CollapsibleElement.d.ts +1 -1
- package/dist/src/shared/primitives/CollapsibleElement.d.ts.map +1 -1
- package/dist/src/shared/primitives/ElevationElement.d.ts +0 -1
- package/dist/src/shared/primitives/ElevationElement.d.ts.map +1 -1
- package/dist/src/shared/primitives/FocusRingElement.d.ts +0 -1
- package/dist/src/shared/primitives/FocusRingElement.d.ts.map +1 -1
- package/dist/src/shared/primitives/PseudoCheckboxElement.d.ts +0 -1
- package/dist/src/shared/primitives/PseudoCheckboxElement.d.ts.map +1 -1
- package/dist/src/shared/primitives/PseudoRadioElement.d.ts +0 -1
- package/dist/src/shared/primitives/PseudoRadioElement.d.ts.map +1 -1
- package/dist/src/shared/primitives/RippleElement.d.ts +0 -1
- package/dist/src/shared/primitives/RippleElement.d.ts.map +1 -1
- package/dist/src/shared/primitives/ScrollContainerElement.d.ts +1 -4
- package/dist/src/shared/primitives/ScrollContainerElement.d.ts.map +1 -1
- package/dist/src/shared/primitives/SlideElement.d.ts +1 -3
- package/dist/src/shared/primitives/SlideElement.d.ts.map +1 -1
- package/dist/src/shared/primitives/StateLayerElement.d.ts +0 -1
- package/dist/src/shared/primitives/StateLayerElement.d.ts.map +1 -1
- package/dist/src/shared/primitives/TextHighlightElement.d.ts +81 -0
- package/dist/src/shared/primitives/TextHighlightElement.d.ts.map +1 -0
- package/dist/src/shared/primitives/TextOverflowElement.d.ts +0 -1
- package/dist/src/shared/primitives/TextOverflowElement.d.ts.map +1 -1
- package/dist/src/shared/primitives/index.d.ts +1 -0
- package/dist/src/shared/primitives/index.d.ts.map +1 -1
- package/dist/src/shared/utils/scrollIntoViewIfNeeded.d.ts +2 -2
- package/dist/src/shared/utils/scrollIntoViewIfNeeded.d.ts.map +1 -1
- package/package.json +1 -1
- package/cem.config.mjs +0 -16
- package/demo/index.html +0 -58
- package/eslint.config.mjs +0 -21
- package/rollup.config.js +0 -132
- package/src/a11y/AriaDescriber.ts +0 -130
- package/src/a11y/FocusTrapElement.ts +0 -136
- package/src/a11y/InteractivityChecker.ts +0 -62
- package/src/a11y/LiveAnnouncer.ts +0 -143
- package/src/a11y/aria-reference.ts +0 -51
- package/src/a11y/index.ts +0 -8
- package/src/a11y/keycodes/KeyCode.ts +0 -128
- package/src/a11y/keycodes/ModifierKeys.ts +0 -5
- package/src/a11y/keycodes/getKeyCode.ts +0 -8
- package/src/a11y/keycodes/hasModifierKey.ts +0 -11
- package/src/a11y/keycodes/index.ts +0 -5
- package/src/a11y/keycodes/isModifierAllowed.ts +0 -12
- package/src/a11y/list-key/FocusKeyManager.ts +0 -25
- package/src/a11y/list-key/ListKeyManager.ts +0 -350
- package/src/a11y/list-key/ListManager.ts +0 -66
- package/src/a11y/list-key/RadioKeyManager.ts +0 -49
- package/src/a11y/list-key/RovingTabIndexManager.ts +0 -56
- package/src/a11y/list-key/SelectionManager.ts +0 -132
- package/src/a11y/list-key/Typeahead.ts +0 -131
- package/src/a11y/list-key/index.ts +0 -7
- package/src/a11y/visuallyHide.ts +0 -18
- package/src/anchoring/AnchorOptions.ts +0 -19
- package/src/anchoring/AnchorPosition.ts +0 -14
- package/src/anchoring/index.ts +0 -3
- package/src/anchoring/positionAnchor.ts +0 -53
- package/src/bidi/Directionality.ts +0 -85
- package/src/bidi/index.ts +0 -1
- package/src/index.ts +0 -1
- package/src/layout/Breakpoint.ts +0 -26
- package/src/layout/BreakpointObserver.ts +0 -44
- package/src/layout/index.ts +0 -2
- package/src/platform/Platform.ts +0 -67
- package/src/platform/index.ts +0 -1
- package/src/shared/controllers/FocusController.ts +0 -60
- package/src/shared/controllers/HoverController.ts +0 -140
- package/src/shared/controllers/IntersectionController.ts +0 -81
- package/src/shared/controllers/LongPressController.ts +0 -87
- package/src/shared/controllers/MonitorControllerBase.ts +0 -99
- package/src/shared/controllers/MutationController.ts +0 -89
- package/src/shared/controllers/PressedController.ts +0 -137
- package/src/shared/controllers/ResizeController.ts +0 -83
- package/src/shared/controllers/ScrollController.ts +0 -100
- package/src/shared/controllers/index.ts +0 -8
- package/src/shared/decorators/debounce.ts +0 -19
- package/src/shared/decorators/index.ts +0 -1
- package/src/shared/directives/index.ts +0 -1
- package/src/shared/directives/safeStyleMap.ts +0 -108
- package/src/shared/index.ts +0 -7
- package/src/shared/mixins/AttachInternals.ts +0 -48
- package/src/shared/mixins/Checked.ts +0 -50
- package/src/shared/mixins/CheckedIndeterminate.ts +0 -47
- package/src/shared/mixins/CheckedOrSelected.ts +0 -36
- package/src/shared/mixins/ConstraintValidation.ts +0 -213
- package/src/shared/mixins/Constructor.ts +0 -2
- package/src/shared/mixins/Dirty.ts +0 -71
- package/src/shared/mixins/Disabled.ts +0 -49
- package/src/shared/mixins/DisabledInteractive.ts +0 -78
- package/src/shared/mixins/EventAttribute.ts +0 -25
- package/src/shared/mixins/Focusable.ts +0 -52
- package/src/shared/mixins/FormAssociated.ts +0 -152
- package/src/shared/mixins/FormSubmitter.ts +0 -123
- package/src/shared/mixins/HtmlFor.ts +0 -89
- package/src/shared/mixins/KeyboardClick.ts +0 -46
- package/src/shared/mixins/Labelled.ts +0 -88
- package/src/shared/mixins/LinkButton.ts +0 -169
- package/src/shared/mixins/ReadOnly.ts +0 -48
- package/src/shared/mixins/Required.ts +0 -50
- package/src/shared/mixins/RequiredConstraintValidation.ts +0 -45
- package/src/shared/mixins/Role.ts +0 -134
- package/src/shared/mixins/Selected.ts +0 -50
- package/src/shared/mixins/Touched.ts +0 -71
- package/src/shared/mixins/Vertical.ts +0 -44
- package/src/shared/mixins/hasKeys.ts +0 -10
- package/src/shared/mixins/index.ts +0 -24
- package/src/shared/primitives/CollapsibleElement.ts +0 -227
- package/src/shared/primitives/ElevationElement.ts +0 -254
- package/src/shared/primitives/ElevationLevel.ts +0 -2
- package/src/shared/primitives/ElevationToken.ts +0 -18
- package/src/shared/primitives/FocusRingElement.ts +0 -199
- package/src/shared/primitives/FocusRingToken.ts +0 -24
- package/src/shared/primitives/PseudoCheckboxElement.ts +0 -116
- package/src/shared/primitives/PseudoRadioElement.ts +0 -83
- package/src/shared/primitives/RippleElement.ts +0 -289
- package/src/shared/primitives/RippleToken.ts +0 -15
- package/src/shared/primitives/ScrollContainerElement.ts +0 -151
- package/src/shared/primitives/ScrollDividers.ts +0 -2
- package/src/shared/primitives/SlideElement.ts +0 -128
- package/src/shared/primitives/StateLayerElement.ts +0 -191
- package/src/shared/primitives/StateLayerToken.ts +0 -16
- package/src/shared/primitives/TextOverflowElement.ts +0 -60
- package/src/shared/primitives/index.ts +0 -12
- package/src/shared/tokens/ColorToken.ts +0 -142
- package/src/shared/tokens/DensityToken.ts +0 -23
- package/src/shared/tokens/DesignToken.ts +0 -35
- package/src/shared/tokens/ElevationToken.ts +0 -115
- package/src/shared/tokens/MotionToken.ts +0 -107
- package/src/shared/tokens/ScrollbarToken.ts +0 -13
- package/src/shared/tokens/ShapeToken.ts +0 -138
- package/src/shared/tokens/StateToken.ts +0 -13
- package/src/shared/tokens/TypescaleToken.ts +0 -230
- package/src/shared/tokens/index.ts +0 -1
- package/src/shared/utils/getTextContent.ts +0 -31
- package/src/shared/utils/guid.ts +0 -11
- package/src/shared/utils/hasAssignedNodes.ts +0 -8
- package/src/shared/utils/index.ts +0 -5
- package/src/shared/utils/prefersReducedMotion.ts +0 -9
- package/src/shared/utils/scrollIntoViewIfNeeded.ts +0 -18
- package/tsconfig.json +0 -9
package/dist/index.js
CHANGED
|
@@ -429,7 +429,7 @@ class MutationController extends MonitorControllerBase {
|
|
|
429
429
|
}
|
|
430
430
|
_MutationController_host = new WeakMap(), _MutationController_callback = new WeakMap(), _MutationController_skipInitial = new WeakMap(), _MutationController_config = new WeakMap(), _MutationController_observer = new WeakMap(), _MutationController_unobservedUpdate = new WeakMap();
|
|
431
431
|
|
|
432
|
-
var _PressedController_instances, _PressedController_capture, _PressedController_callback, _PressedController_isPressedKey, _PressedController_pressedTargets, _PressedController_pointerDownHandler, _PressedController_pointerUpHandler, _PressedController_keyDownHandler, _PressedController_keyUpHandler, _PressedController_handlePointerDown, _PressedController_handlePointerUp, _PressedController_handleKeyDown, _PressedController_handleKeyUp;
|
|
432
|
+
var _PressedController_instances, _PressedController_capture, _PressedController_callback, _PressedController_isPressedKey, _PressedController_pressedTargets, _PressedController_minPressedDuration, _PressedController_pointerDownHandler, _PressedController_pointerUpHandler, _PressedController_keyDownHandler, _PressedController_keyUpHandler, _PressedController_handlePointerDown, _PressedController_handlePointerUp, _PressedController_handleKeyDown, _PressedController_handleKeyUp;
|
|
433
433
|
/** A `ReactiveController` used to monitor the pressed state of one or more elements. */
|
|
434
434
|
class PressedController extends MonitorControllerBase {
|
|
435
435
|
/**
|
|
@@ -443,7 +443,8 @@ class PressedController extends MonitorControllerBase {
|
|
|
443
443
|
/** @private */ _PressedController_capture.set(this, void 0);
|
|
444
444
|
/** @private */ _PressedController_callback.set(this, void 0);
|
|
445
445
|
/** @private */ _PressedController_isPressedKey.set(this, void 0);
|
|
446
|
-
/** @private */ _PressedController_pressedTargets.set(this, new
|
|
446
|
+
/** @private */ _PressedController_pressedTargets.set(this, new Map());
|
|
447
|
+
/** @private */ _PressedController_minPressedDuration.set(this, void 0);
|
|
447
448
|
/** @private */ _PressedController_pointerDownHandler.set(this, (e) => __classPrivateFieldGet(this, _PressedController_instances, "m", _PressedController_handlePointerDown).call(this, e));
|
|
448
449
|
/** @private */ _PressedController_pointerUpHandler.set(this, (e) => __classPrivateFieldGet(this, _PressedController_instances, "m", _PressedController_handlePointerUp).call(this, e));
|
|
449
450
|
/** @private */ _PressedController_keyDownHandler.set(this, (e) => __classPrivateFieldGet(this, _PressedController_instances, "m", _PressedController_handleKeyDown).call(this, e));
|
|
@@ -451,6 +452,7 @@ class PressedController extends MonitorControllerBase {
|
|
|
451
452
|
__classPrivateFieldSet(this, _PressedController_capture, options.capture, "f");
|
|
452
453
|
__classPrivateFieldSet(this, _PressedController_callback, options.callback, "f");
|
|
453
454
|
__classPrivateFieldSet(this, _PressedController_isPressedKey, options.isPressedKey, "f");
|
|
455
|
+
__classPrivateFieldSet(this, _PressedController_minPressedDuration, options.minPressedDuration ?? 0, "f");
|
|
454
456
|
}
|
|
455
457
|
/** @inheritdoc */
|
|
456
458
|
hostConnected() {
|
|
@@ -486,37 +488,63 @@ class PressedController extends MonitorControllerBase {
|
|
|
486
488
|
}
|
|
487
489
|
}
|
|
488
490
|
}
|
|
489
|
-
_PressedController_capture = new WeakMap(), _PressedController_callback = new WeakMap(), _PressedController_isPressedKey = new WeakMap(), _PressedController_pressedTargets = new WeakMap(), _PressedController_pointerDownHandler = new WeakMap(), _PressedController_pointerUpHandler = new WeakMap(), _PressedController_keyDownHandler = new WeakMap(), _PressedController_keyUpHandler = new WeakMap(), _PressedController_instances = new WeakSet(), _PressedController_handlePointerDown = function _PressedController_handlePointerDown(e) {
|
|
491
|
+
_PressedController_capture = new WeakMap(), _PressedController_callback = new WeakMap(), _PressedController_isPressedKey = new WeakMap(), _PressedController_pressedTargets = new WeakMap(), _PressedController_minPressedDuration = new WeakMap(), _PressedController_pointerDownHandler = new WeakMap(), _PressedController_pointerUpHandler = new WeakMap(), _PressedController_keyDownHandler = new WeakMap(), _PressedController_keyUpHandler = new WeakMap(), _PressedController_instances = new WeakSet(), _PressedController_handlePointerDown = function _PressedController_handlePointerDown(e) {
|
|
490
492
|
if (e.pointerType === "mouse" && e.button > 1)
|
|
491
493
|
return;
|
|
492
494
|
for (const target of e.composedPath()) {
|
|
493
495
|
if (target instanceof HTMLElement && this.isObserving(target)) {
|
|
494
|
-
__classPrivateFieldGet(this, _PressedController_pressedTargets, "f").
|
|
495
|
-
|
|
496
|
+
if (!__classPrivateFieldGet(this, _PressedController_pressedTargets, "f").has(target)) {
|
|
497
|
+
__classPrivateFieldGet(this, _PressedController_pressedTargets, "f").set(target, performance.now());
|
|
498
|
+
__classPrivateFieldGet(this, _PressedController_callback, "f").call(this, true, { x: e.x, y: e.y }, target);
|
|
499
|
+
}
|
|
496
500
|
break;
|
|
497
501
|
}
|
|
498
502
|
}
|
|
499
503
|
}, _PressedController_handlePointerUp = function _PressedController_handlePointerUp(e) {
|
|
500
504
|
if (e.pointerType === "mouse" && e.button > 1)
|
|
501
505
|
return;
|
|
502
|
-
|
|
503
|
-
|
|
506
|
+
const x = e.x;
|
|
507
|
+
const y = e.y;
|
|
508
|
+
for (const target of __classPrivateFieldGet(this, _PressedController_pressedTargets, "f").keys()) {
|
|
509
|
+
const remainingTime = __classPrivateFieldGet(this, _PressedController_minPressedDuration, "f") - (performance.now() - __classPrivateFieldGet(this, _PressedController_pressedTargets, "f").get(target));
|
|
510
|
+
if (remainingTime > 0) {
|
|
511
|
+
setTimeout(() => {
|
|
512
|
+
__classPrivateFieldGet(this, _PressedController_pressedTargets, "f").delete(target);
|
|
513
|
+
__classPrivateFieldGet(this, _PressedController_callback, "f").call(this, false, { x, y }, target);
|
|
514
|
+
}, remainingTime);
|
|
515
|
+
}
|
|
516
|
+
else {
|
|
517
|
+
__classPrivateFieldGet(this, _PressedController_pressedTargets, "f").delete(target);
|
|
518
|
+
__classPrivateFieldGet(this, _PressedController_callback, "f").call(this, false, { x, y }, target);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
504
521
|
}, _PressedController_handleKeyDown = function _PressedController_handleKeyDown(e) {
|
|
505
|
-
|
|
522
|
+
if (e.target !== e.currentTarget)
|
|
523
|
+
return;
|
|
524
|
+
const target = e.currentTarget;
|
|
506
525
|
if (!__classPrivateFieldGet(this, _PressedController_pressedTargets, "f").has(target) && __classPrivateFieldGet(this, _PressedController_isPressedKey, "f")?.call(this, e.key)) {
|
|
507
526
|
if (e.key === " ") {
|
|
508
527
|
e.preventDefault();
|
|
509
528
|
}
|
|
510
|
-
__classPrivateFieldGet(this, _PressedController_pressedTargets, "f").
|
|
529
|
+
__classPrivateFieldGet(this, _PressedController_pressedTargets, "f").set(target, performance.now());
|
|
511
530
|
const bounds = target.getBoundingClientRect();
|
|
512
531
|
__classPrivateFieldGet(this, _PressedController_callback, "f").call(this, true, { x: bounds.x + bounds.width / 2, y: bounds.y + bounds.height / 2 }, target);
|
|
513
532
|
}
|
|
514
533
|
}, _PressedController_handleKeyUp = function _PressedController_handleKeyUp(e) {
|
|
515
534
|
const target = e.target;
|
|
516
535
|
if (__classPrivateFieldGet(this, _PressedController_pressedTargets, "f").has(target) && __classPrivateFieldGet(this, _PressedController_isPressedKey, "f")?.call(this, e.key)) {
|
|
517
|
-
__classPrivateFieldGet(this, _PressedController_pressedTargets, "f").
|
|
536
|
+
const remainingTime = __classPrivateFieldGet(this, _PressedController_minPressedDuration, "f") - (performance.now() - __classPrivateFieldGet(this, _PressedController_pressedTargets, "f").get(target));
|
|
518
537
|
const bounds = target.getBoundingClientRect();
|
|
519
|
-
|
|
538
|
+
if (remainingTime > 0) {
|
|
539
|
+
setTimeout(() => {
|
|
540
|
+
__classPrivateFieldGet(this, _PressedController_pressedTargets, "f").delete(target);
|
|
541
|
+
__classPrivateFieldGet(this, _PressedController_callback, "f").call(this, false, { x: bounds.x + bounds.width / 2, y: bounds.y + bounds.height / 2 }, target);
|
|
542
|
+
}, remainingTime);
|
|
543
|
+
}
|
|
544
|
+
else {
|
|
545
|
+
__classPrivateFieldGet(this, _PressedController_pressedTargets, "f").delete(target);
|
|
546
|
+
__classPrivateFieldGet(this, _PressedController_callback, "f").call(this, false, { x: bounds.x + bounds.width / 2, y: bounds.y + bounds.height / 2 }, target);
|
|
547
|
+
}
|
|
520
548
|
}
|
|
521
549
|
};
|
|
522
550
|
|
|
@@ -787,10 +815,12 @@ const _internals = Symbol("_internals");
|
|
|
787
815
|
*/
|
|
788
816
|
function AttachInternals(base, formAssociated) {
|
|
789
817
|
class _AttachInternals extends base {
|
|
818
|
+
/** @internal */
|
|
790
819
|
get [internals]() {
|
|
791
820
|
return this[_internals] ?? (this[_internals] = this.attachInternals());
|
|
792
821
|
}
|
|
793
822
|
}
|
|
823
|
+
/** Indicates that this custom element participates in form submission, validation, and form state restoration. */
|
|
794
824
|
_AttachInternals.formAssociated = formAssociated;
|
|
795
825
|
return _AttachInternals;
|
|
796
826
|
}
|
|
@@ -858,8 +888,13 @@ function Checked(base) {
|
|
|
858
888
|
class _CheckedMixin extends base {
|
|
859
889
|
constructor() {
|
|
860
890
|
super(...arguments);
|
|
891
|
+
/**
|
|
892
|
+
* Whether the element is checked.
|
|
893
|
+
* @default false
|
|
894
|
+
*/
|
|
861
895
|
this.checked = false;
|
|
862
896
|
}
|
|
897
|
+
/** @inheritdoc */
|
|
863
898
|
update(changedProperties) {
|
|
864
899
|
super.update(changedProperties);
|
|
865
900
|
if (changedProperties.has("checked")) {
|
|
@@ -898,8 +933,13 @@ function CheckedIndeterminate(base) {
|
|
|
898
933
|
class _CheckedIndeterminateMixin extends Checked(base) {
|
|
899
934
|
constructor() {
|
|
900
935
|
super(...arguments);
|
|
936
|
+
/**
|
|
937
|
+
* Whether the element's checked state is indeterminate.
|
|
938
|
+
* @default false
|
|
939
|
+
*/
|
|
901
940
|
this.indeterminate = false;
|
|
902
941
|
}
|
|
942
|
+
/** @inheritdoc */
|
|
903
943
|
update(changedProperties) {
|
|
904
944
|
super.update(changedProperties);
|
|
905
945
|
if (changedProperties.has("indeterminate") && this.role && this.role !== "none" && this.role !== "presentation") {
|
|
@@ -931,8 +971,13 @@ function Selected(base) {
|
|
|
931
971
|
class _SelectedMixin extends base {
|
|
932
972
|
constructor() {
|
|
933
973
|
super(...arguments);
|
|
974
|
+
/**
|
|
975
|
+
* Whether the element is selected.
|
|
976
|
+
* @default false
|
|
977
|
+
*/
|
|
934
978
|
this.selected = false;
|
|
935
979
|
}
|
|
980
|
+
/** @inheritdoc */
|
|
936
981
|
update(changedProperties) {
|
|
937
982
|
super.update(changedProperties);
|
|
938
983
|
if (changedProperties.has("selected")) {
|
|
@@ -1003,26 +1048,33 @@ function Dirty(base) {
|
|
|
1003
1048
|
class _Dirty extends base {
|
|
1004
1049
|
constructor() {
|
|
1005
1050
|
super(...arguments);
|
|
1051
|
+
/** @private */
|
|
1006
1052
|
this[_a] = () => this.markAsDirty();
|
|
1007
1053
|
}
|
|
1054
|
+
/** Whether the user has modified the value of the element. */
|
|
1008
1055
|
get dirty() {
|
|
1009
1056
|
return this.classList.contains("-dirty");
|
|
1010
1057
|
}
|
|
1058
|
+
/** Whether the user has not modified the value of the element. */
|
|
1011
1059
|
get pristine() {
|
|
1012
1060
|
return !this.dirty;
|
|
1013
1061
|
}
|
|
1062
|
+
/** @inheritdoc */
|
|
1014
1063
|
connectedCallback() {
|
|
1015
1064
|
this.markAsPristine();
|
|
1016
1065
|
super.connectedCallback();
|
|
1017
1066
|
this.addEventListener("change", this[_eventHandler$2]);
|
|
1018
1067
|
}
|
|
1068
|
+
/** @inheritdoc */
|
|
1019
1069
|
disconnectedCallback() {
|
|
1020
1070
|
super.disconnectedCallback();
|
|
1021
1071
|
this.removeEventListener("change", this[_eventHandler$2]);
|
|
1022
1072
|
}
|
|
1073
|
+
/** Marks the element as pristine. */
|
|
1023
1074
|
markAsPristine() {
|
|
1024
1075
|
this.classList.toggle("-dirty", false);
|
|
1025
1076
|
}
|
|
1077
|
+
/** Marks the element as dirty. */
|
|
1026
1078
|
markAsDirty() {
|
|
1027
1079
|
this.classList.toggle("-dirty", true);
|
|
1028
1080
|
}
|
|
@@ -1051,26 +1103,33 @@ function Touched(base) {
|
|
|
1051
1103
|
class _Touched extends base {
|
|
1052
1104
|
constructor() {
|
|
1053
1105
|
super(...arguments);
|
|
1106
|
+
/** @private */
|
|
1054
1107
|
this[_a] = () => this.markAsTouched();
|
|
1055
1108
|
}
|
|
1109
|
+
/** Whether the user has interacted when the element. */
|
|
1056
1110
|
get touched() {
|
|
1057
1111
|
return this.classList.contains("-touched");
|
|
1058
1112
|
}
|
|
1113
|
+
/** Whether the user has not interacted when the element. */
|
|
1059
1114
|
get untouched() {
|
|
1060
1115
|
return !this.touched;
|
|
1061
1116
|
}
|
|
1117
|
+
/** @inheritdoc */
|
|
1062
1118
|
connectedCallback() {
|
|
1063
1119
|
this.markAsUntouched();
|
|
1064
1120
|
super.connectedCallback();
|
|
1065
1121
|
this.addEventListener("focusout", this[_eventHandler$1]);
|
|
1066
1122
|
}
|
|
1123
|
+
/** @inheritdoc */
|
|
1067
1124
|
disconnectedCallback() {
|
|
1068
1125
|
super.disconnectedCallback();
|
|
1069
1126
|
this.removeEventListener("focusout", this[_eventHandler$1]);
|
|
1070
1127
|
}
|
|
1128
|
+
/** Marks the element as touched. */
|
|
1071
1129
|
markAsTouched() {
|
|
1072
1130
|
this.classList.toggle("-touched", true);
|
|
1073
1131
|
}
|
|
1132
|
+
/** Marks the element as untouched. */
|
|
1074
1133
|
markAsUntouched() {
|
|
1075
1134
|
this.classList.toggle("-touched", false);
|
|
1076
1135
|
}
|
|
@@ -1728,8 +1787,13 @@ function Disabled(base, reflect = true) {
|
|
|
1728
1787
|
class _DisabledMixin extends base {
|
|
1729
1788
|
constructor() {
|
|
1730
1789
|
super(...arguments);
|
|
1790
|
+
/**
|
|
1791
|
+
* Whether the element is disabled.
|
|
1792
|
+
* @default false
|
|
1793
|
+
*/
|
|
1731
1794
|
this.disabled = false;
|
|
1732
1795
|
}
|
|
1796
|
+
/** @inheritdoc */
|
|
1733
1797
|
update(changedProperties) {
|
|
1734
1798
|
super.update(changedProperties);
|
|
1735
1799
|
if (changedProperties.has("disabled") && this.role && this.role !== "none" && this.role !== "presentation") {
|
|
@@ -1765,6 +1829,7 @@ function DisabledInteractive(base) {
|
|
|
1765
1829
|
class _DisabledInteractiveMixin extends base {
|
|
1766
1830
|
constructor() {
|
|
1767
1831
|
super(...arguments);
|
|
1832
|
+
/** @private */
|
|
1768
1833
|
this[_a] = (e) => {
|
|
1769
1834
|
if (this.disabledInteractive) {
|
|
1770
1835
|
// Only allow specific keys when disabled and interactive.
|
|
@@ -1775,16 +1840,23 @@ function DisabledInteractive(base) {
|
|
|
1775
1840
|
e.preventDefault();
|
|
1776
1841
|
}
|
|
1777
1842
|
};
|
|
1843
|
+
/**
|
|
1844
|
+
* Whether the element is disabled and interactive.
|
|
1845
|
+
* @default false
|
|
1846
|
+
*/
|
|
1778
1847
|
this.disabledInteractive = false;
|
|
1779
1848
|
}
|
|
1849
|
+
/** @inheritdoc */
|
|
1780
1850
|
connectedCallback() {
|
|
1781
1851
|
SUPPRESSED_EVENTS.forEach((x) => this.addEventListener(x, this[_suppressedEventHandler], true));
|
|
1782
1852
|
super.connectedCallback();
|
|
1783
1853
|
}
|
|
1854
|
+
/** @inheritdoc */
|
|
1784
1855
|
disconnectedCallback() {
|
|
1785
1856
|
SUPPRESSED_EVENTS.forEach((x) => this.removeEventListener(x, this[_suppressedEventHandler], true));
|
|
1786
1857
|
super.disconnectedCallback();
|
|
1787
1858
|
}
|
|
1859
|
+
/** @inheritdoc */
|
|
1788
1860
|
update(changedProperties) {
|
|
1789
1861
|
super.update(changedProperties);
|
|
1790
1862
|
if ((changedProperties.has("disabled") || changedProperties.has("disabledInteractive")) &&
|
|
@@ -1824,29 +1896,35 @@ function Labelled(base) {
|
|
|
1824
1896
|
class _Labelled extends base {
|
|
1825
1897
|
constructor() {
|
|
1826
1898
|
super(...arguments);
|
|
1899
|
+
/** @private */
|
|
1827
1900
|
this[_a] = (e) => {
|
|
1828
1901
|
if (!e.defaultPrevented) {
|
|
1829
1902
|
this[_updateLabels]();
|
|
1830
1903
|
}
|
|
1831
1904
|
};
|
|
1832
1905
|
}
|
|
1906
|
+
/** The label elements that the element is associated with. */
|
|
1833
1907
|
get labels() {
|
|
1834
1908
|
return this[internals].labels;
|
|
1835
1909
|
}
|
|
1910
|
+
/** @inheritdoc */
|
|
1836
1911
|
connectedCallback() {
|
|
1837
1912
|
super.connectedCallback();
|
|
1838
1913
|
this.addEventListener("focusout", this[_eventHandler]);
|
|
1839
1914
|
this.addEventListener("change", this[_eventHandler]);
|
|
1840
1915
|
}
|
|
1916
|
+
/** @inheritdoc */
|
|
1841
1917
|
disconnectedCallback() {
|
|
1842
1918
|
super.disconnectedCallback();
|
|
1843
1919
|
this.removeEventListener("focusout", this[_eventHandler]);
|
|
1844
1920
|
this.removeEventListener("change", this[_eventHandler]);
|
|
1845
1921
|
}
|
|
1922
|
+
/** @inheritdoc */
|
|
1846
1923
|
update(changedProperties) {
|
|
1847
1924
|
super.update(changedProperties);
|
|
1848
1925
|
this[_updateLabels]();
|
|
1849
1926
|
}
|
|
1927
|
+
/** @private */
|
|
1850
1928
|
[(_a = _eventHandler, _updateLabels)]() {
|
|
1851
1929
|
const focusable = this.hasAttribute("tabindex");
|
|
1852
1930
|
const disabled = (isDisabledMixin(this) && this.disabled) || (isDisabledInteractiveMixin(this) && this.disabledInteractive);
|
|
@@ -1861,6 +1939,7 @@ function Labelled(base) {
|
|
|
1861
1939
|
}
|
|
1862
1940
|
}
|
|
1863
1941
|
}
|
|
1942
|
+
/** Indicates that this custom element participates in form submission, validation, and form state restoration. */
|
|
1864
1943
|
_Labelled.formAssociated = true;
|
|
1865
1944
|
return _Labelled;
|
|
1866
1945
|
}
|
|
@@ -1893,21 +1972,26 @@ function FormAssociated(base) {
|
|
|
1893
1972
|
class _FormAssociatedMixin extends base {
|
|
1894
1973
|
constructor() {
|
|
1895
1974
|
super(...arguments);
|
|
1896
|
-
this[_a] = false;
|
|
1897
|
-
this[_b] = false;
|
|
1975
|
+
/** @private */ this[_a] = false;
|
|
1976
|
+
/** @private */ this[_b] = false;
|
|
1898
1977
|
}
|
|
1978
|
+
/** The `HTMLFormElement` associated with this element. */
|
|
1899
1979
|
get form() {
|
|
1900
1980
|
return this[internals].form;
|
|
1901
1981
|
}
|
|
1982
|
+
/** @inheritdoc */
|
|
1902
1983
|
get labels() {
|
|
1903
1984
|
return this[internals].labels;
|
|
1904
1985
|
}
|
|
1986
|
+
/** @internal */
|
|
1905
1987
|
get [(_a = _defaultIndeterminate, _b = _formDisabled, formValue)]() {
|
|
1906
1988
|
return null;
|
|
1907
1989
|
}
|
|
1990
|
+
/** @internal */
|
|
1908
1991
|
get [defaultValue]() {
|
|
1909
1992
|
return this[_defaultValue];
|
|
1910
1993
|
}
|
|
1994
|
+
/** The name that identifies the element when submitting the associated form. */
|
|
1911
1995
|
get name() {
|
|
1912
1996
|
return this.getAttribute("name") ?? "";
|
|
1913
1997
|
}
|
|
@@ -1922,12 +2006,17 @@ function FormAssociated(base) {
|
|
|
1922
2006
|
// Disabled attributes should not be reflected for form associated elements due to
|
|
1923
2007
|
// how the formDisabledCallback overrides an element's disabled state.
|
|
1924
2008
|
// See https://github.com/whatwg/html/issues/8365
|
|
2009
|
+
/**
|
|
2010
|
+
* Whether the element is disabled.
|
|
2011
|
+
* @default false
|
|
2012
|
+
*/
|
|
1925
2013
|
get disabled() {
|
|
1926
2014
|
return super.disabled || this[_formDisabled];
|
|
1927
2015
|
}
|
|
1928
2016
|
set disabled(value) {
|
|
1929
2017
|
super.disabled = value;
|
|
1930
2018
|
}
|
|
2019
|
+
/** @inheritdoc */
|
|
1931
2020
|
connectedCallback() {
|
|
1932
2021
|
super.connectedCallback();
|
|
1933
2022
|
if (isCheckedMixin(this)) {
|
|
@@ -1940,10 +2029,12 @@ function FormAssociated(base) {
|
|
|
1940
2029
|
this[_defaultValue] = this.value;
|
|
1941
2030
|
}
|
|
1942
2031
|
}
|
|
2032
|
+
/** @inheritdoc */
|
|
1943
2033
|
requestUpdate(name, oldValue, options) {
|
|
1944
2034
|
super.requestUpdate(name, oldValue, options);
|
|
1945
2035
|
this[internals].setFormValue(this[formValue]);
|
|
1946
2036
|
}
|
|
2037
|
+
/** Called when the element is disabled or enabled via its form association. */
|
|
1947
2038
|
formDisabledCallback(disabled) {
|
|
1948
2039
|
const wasDisabled = this.disabled;
|
|
1949
2040
|
this[_formDisabled] = disabled;
|
|
@@ -1951,6 +2042,7 @@ function FormAssociated(base) {
|
|
|
1951
2042
|
this.requestUpdate("disabled", wasDisabled);
|
|
1952
2043
|
}
|
|
1953
2044
|
}
|
|
2045
|
+
/** Called when the associated form is reset. */
|
|
1954
2046
|
formResetCallback() {
|
|
1955
2047
|
if (isCheckedMixin(this)) {
|
|
1956
2048
|
this.checked = this[_defaultValue] === true;
|
|
@@ -1969,6 +2061,7 @@ function FormAssociated(base) {
|
|
|
1969
2061
|
}
|
|
1970
2062
|
}
|
|
1971
2063
|
}
|
|
2064
|
+
/** Indicates that this custom element participates in form submission, validation, and form state restoration. */
|
|
1972
2065
|
_FormAssociatedMixin.formAssociated = true;
|
|
1973
2066
|
__decorate([
|
|
1974
2067
|
n$1({ noAccessor: true })
|
|
@@ -2004,20 +2097,28 @@ function ConstraintValidation(base) {
|
|
|
2004
2097
|
super(...arguments);
|
|
2005
2098
|
__ConstraintValidation_instances.add(this);
|
|
2006
2099
|
}
|
|
2100
|
+
/** Whether the element is a submittable element that is a candidate for constraint validation. */
|
|
2007
2101
|
get willValidate() {
|
|
2008
2102
|
return this[internals].willValidate;
|
|
2009
2103
|
}
|
|
2104
|
+
/** The validity state of the element. */
|
|
2010
2105
|
get validity() {
|
|
2011
2106
|
this[_updateValidity]();
|
|
2012
2107
|
return this[internals].validity;
|
|
2013
2108
|
}
|
|
2109
|
+
/** The error message that would be displayed if the user submits the form, or an empty string if no error message. */
|
|
2014
2110
|
get validationMessage() {
|
|
2015
2111
|
this[_updateValidity]();
|
|
2016
2112
|
return this[internals].validationMessage;
|
|
2017
2113
|
}
|
|
2114
|
+
/** @internal */
|
|
2018
2115
|
[(__ConstraintValidation_instances = new WeakSet(), validate)]() {
|
|
2019
2116
|
return this[_validityMessage] ? { customError: true } : undefined;
|
|
2020
2117
|
}
|
|
2118
|
+
/**
|
|
2119
|
+
* Returns `true` if the element has no validity problems; otherwise, returns `false`, fires
|
|
2120
|
+
* an invalid event, and (if the event isn't canceled) reports the problem to the user.
|
|
2121
|
+
*/
|
|
2021
2122
|
reportValidity() {
|
|
2022
2123
|
if (isTouchedMixin(this)) {
|
|
2023
2124
|
this.markAsTouched();
|
|
@@ -2025,10 +2126,18 @@ function ConstraintValidation(base) {
|
|
|
2025
2126
|
this[_updateValidity]();
|
|
2026
2127
|
return this[internals].reportValidity();
|
|
2027
2128
|
}
|
|
2129
|
+
/**
|
|
2130
|
+
* Returns `true` if the element has no validity problems; otherwise,
|
|
2131
|
+
* returns `false`, fires an invalid event.
|
|
2132
|
+
*/
|
|
2028
2133
|
checkValidity() {
|
|
2029
2134
|
this[_updateValidity]();
|
|
2030
2135
|
return this[internals].checkValidity();
|
|
2031
2136
|
}
|
|
2137
|
+
/**
|
|
2138
|
+
* Sets a custom validity message for the element.
|
|
2139
|
+
* @param error The message to use for validity errors.
|
|
2140
|
+
*/
|
|
2032
2141
|
setCustomValidity(error) {
|
|
2033
2142
|
if (error) {
|
|
2034
2143
|
this[_validityMessage] = error;
|
|
@@ -2038,14 +2147,17 @@ function ConstraintValidation(base) {
|
|
|
2038
2147
|
}
|
|
2039
2148
|
this[_updateValidity]();
|
|
2040
2149
|
}
|
|
2150
|
+
/** @inheritdoc */
|
|
2041
2151
|
requestUpdate(name, oldValue, options) {
|
|
2042
2152
|
super.requestUpdate(name, oldValue, options);
|
|
2043
2153
|
this[_updateValidity]();
|
|
2044
2154
|
}
|
|
2155
|
+
/** @inheritdoc */
|
|
2045
2156
|
firstUpdated(_changedProperties) {
|
|
2046
2157
|
super.firstUpdated(_changedProperties);
|
|
2047
2158
|
this[_updateValidity]();
|
|
2048
2159
|
}
|
|
2160
|
+
/** @private */
|
|
2049
2161
|
[_updateValidity]() {
|
|
2050
2162
|
if (isServer || !this.isConnected)
|
|
2051
2163
|
return;
|
|
@@ -2120,6 +2232,7 @@ function ConstraintValidation(base) {
|
|
|
2120
2232
|
*/
|
|
2121
2233
|
function EventAttribute(base, ...types) {
|
|
2122
2234
|
class _EventAttribute extends base {
|
|
2235
|
+
/** @internal */
|
|
2123
2236
|
dispatchEvent(event) {
|
|
2124
2237
|
if (types.includes(event.type)) {
|
|
2125
2238
|
const eventAttribute = this.getAttribute(`on${event.type}`);
|
|
@@ -2145,6 +2258,7 @@ function Focusable(base) {
|
|
|
2145
2258
|
class _FocusableMixin extends base {
|
|
2146
2259
|
constructor() {
|
|
2147
2260
|
super(...arguments);
|
|
2261
|
+
/** @private */
|
|
2148
2262
|
this[_a] = 0;
|
|
2149
2263
|
}
|
|
2150
2264
|
/** @inheritdoc */
|
|
@@ -2152,12 +2266,14 @@ function Focusable(base) {
|
|
|
2152
2266
|
this[_tabindex] = Number.parseInt(this.getAttribute("tabindex") ?? "0");
|
|
2153
2267
|
super.connectedCallback();
|
|
2154
2268
|
}
|
|
2269
|
+
/** @inheritdoc */
|
|
2155
2270
|
firstUpdated(_changedProperties) {
|
|
2156
2271
|
super.firstUpdated(_changedProperties);
|
|
2157
2272
|
if (!this.hasAttribute("tabindex") && !_changedProperties.has("disabled")) {
|
|
2158
2273
|
this.setAttribute("tabindex", `${this[_tabindex]}`);
|
|
2159
2274
|
}
|
|
2160
2275
|
}
|
|
2276
|
+
/** @inheritdoc */
|
|
2161
2277
|
update(changedProperties) {
|
|
2162
2278
|
super.update(changedProperties);
|
|
2163
2279
|
if (changedProperties.has("disabled")) {
|
|
@@ -2200,9 +2316,16 @@ function FormSubmitter(base) {
|
|
|
2200
2316
|
class _FormSubmitterMixin extends base {
|
|
2201
2317
|
constructor() {
|
|
2202
2318
|
super(...arguments);
|
|
2319
|
+
/**
|
|
2320
|
+
* The type of the element.
|
|
2321
|
+
* @default "button"
|
|
2322
|
+
*/
|
|
2203
2323
|
this.type = "button";
|
|
2324
|
+
/** @private */
|
|
2204
2325
|
this[_a] = async (e) => {
|
|
2205
|
-
if (
|
|
2326
|
+
if (e.defaultPrevented ||
|
|
2327
|
+
(isDisabledMixin(this) && this.disabled) ||
|
|
2328
|
+
(isDisabledInteractiveMixin(this) && this.disabledInteractive)) {
|
|
2206
2329
|
return;
|
|
2207
2330
|
}
|
|
2208
2331
|
const form = this[internals].form;
|
|
@@ -2229,6 +2352,10 @@ function FormSubmitter(base) {
|
|
|
2229
2352
|
}
|
|
2230
2353
|
};
|
|
2231
2354
|
}
|
|
2355
|
+
/**
|
|
2356
|
+
* The name of the element, submitted as a pair with the element's `value`
|
|
2357
|
+
* as part of form data, when the element is used to submit a form.
|
|
2358
|
+
*/
|
|
2232
2359
|
get name() {
|
|
2233
2360
|
return this.getAttribute("name") ?? "";
|
|
2234
2361
|
}
|
|
@@ -2240,6 +2367,7 @@ function FormSubmitter(base) {
|
|
|
2240
2367
|
this.removeAttribute("name");
|
|
2241
2368
|
}
|
|
2242
2369
|
}
|
|
2370
|
+
/** The value associated with the element's name when it's submitted with form data. */
|
|
2243
2371
|
get value() {
|
|
2244
2372
|
return this.getAttribute("value");
|
|
2245
2373
|
}
|
|
@@ -2251,16 +2379,20 @@ function FormSubmitter(base) {
|
|
|
2251
2379
|
this.removeAttribute("value");
|
|
2252
2380
|
}
|
|
2253
2381
|
}
|
|
2382
|
+
/** @inheritdoc */
|
|
2254
2383
|
connectedCallback() {
|
|
2255
2384
|
super.connectedCallback();
|
|
2256
2385
|
this.addEventListener("click", this[_clickHandler$1]);
|
|
2257
2386
|
}
|
|
2387
|
+
/** @inheritdoc */
|
|
2258
2388
|
disconnectedCallback() {
|
|
2259
2389
|
super.disconnectedCallback();
|
|
2260
2390
|
this.removeEventListener("click", this[_clickHandler$1]);
|
|
2261
2391
|
}
|
|
2262
2392
|
}
|
|
2263
2393
|
_a = _clickHandler$1;
|
|
2394
|
+
/** Indicates that this custom element participates in form submission, validation, and form state restoration. */
|
|
2395
|
+
_FormSubmitterMixin.formAssociated = true;
|
|
2264
2396
|
__decorate([
|
|
2265
2397
|
n$1()
|
|
2266
2398
|
], _FormSubmitterMixin.prototype, "name", null);
|
|
@@ -2296,15 +2428,19 @@ function HtmlFor(base) {
|
|
|
2296
2428
|
super(...arguments);
|
|
2297
2429
|
/** @private */ this[_a] = null;
|
|
2298
2430
|
/** @private */ this[_b] = false;
|
|
2431
|
+
/** The identifier of the interactive control to which this element is attached. */
|
|
2299
2432
|
this.htmlFor = null;
|
|
2300
2433
|
}
|
|
2434
|
+
/** The interactive element to which this element is attached. */
|
|
2301
2435
|
get control() {
|
|
2302
2436
|
return this[_control];
|
|
2303
2437
|
}
|
|
2438
|
+
/** @inheritdoc */
|
|
2304
2439
|
firstUpdated(_changedProperties) {
|
|
2305
2440
|
super.firstUpdated(_changedProperties);
|
|
2306
2441
|
this[_firstUpdated] = true;
|
|
2307
2442
|
}
|
|
2443
|
+
/** @inheritdoc */
|
|
2308
2444
|
update(changedProperties) {
|
|
2309
2445
|
super.update(changedProperties);
|
|
2310
2446
|
if (changedProperties.has("htmlFor")) {
|
|
@@ -2324,9 +2460,14 @@ function HtmlFor(base) {
|
|
|
2324
2460
|
}
|
|
2325
2461
|
}
|
|
2326
2462
|
}
|
|
2463
|
+
/**
|
|
2464
|
+
* Attaches the element to an interactive control.
|
|
2465
|
+
* @param {HTMLElement} control The element that controls the attachable element.
|
|
2466
|
+
*/
|
|
2327
2467
|
attach(control) {
|
|
2328
2468
|
this[_control] = control;
|
|
2329
2469
|
}
|
|
2470
|
+
/** Detaches the element from its current interactive control. */
|
|
2330
2471
|
detach() {
|
|
2331
2472
|
this[_control] = null;
|
|
2332
2473
|
}
|
|
@@ -2351,19 +2492,25 @@ function KeyboardClick(base, allowEnter = true) {
|
|
|
2351
2492
|
constructor() {
|
|
2352
2493
|
super(...arguments);
|
|
2353
2494
|
__KeyboardClickMixin_instances.add(this);
|
|
2495
|
+
/** @private */
|
|
2354
2496
|
__KeyboardClickMixin_keyUpHandler.set(this, (e) => __classPrivateFieldGet(this, __KeyboardClickMixin_instances, "m", __KeyboardClickMixin_handleKeyUp).call(this, e));
|
|
2355
2497
|
}
|
|
2498
|
+
/** @inheritdoc */
|
|
2356
2499
|
connectedCallback() {
|
|
2357
2500
|
super.connectedCallback();
|
|
2358
2501
|
this.addEventListener("keyup", __classPrivateFieldGet(this, __KeyboardClickMixin_keyUpHandler, "f"));
|
|
2359
2502
|
}
|
|
2503
|
+
/** @inheritdoc */
|
|
2360
2504
|
disconnectedCallback() {
|
|
2361
2505
|
super.disconnectedCallback();
|
|
2362
2506
|
this.removeEventListener("keyup", __classPrivateFieldGet(this, __KeyboardClickMixin_keyUpHandler, "f"));
|
|
2363
2507
|
}
|
|
2364
2508
|
}
|
|
2365
2509
|
__KeyboardClickMixin_keyUpHandler = new WeakMap(), __KeyboardClickMixin_instances = new WeakSet(), __KeyboardClickMixin_handleKeyUp = function __KeyboardClickMixin_handleKeyUp(e) {
|
|
2366
|
-
if (
|
|
2510
|
+
if (e.defaultPrevented ||
|
|
2511
|
+
e.target !== e.currentTarget ||
|
|
2512
|
+
(isDisabledMixin(this) && this.disabled) ||
|
|
2513
|
+
(isDisabledInteractiveMixin(this) && this.disabledInteractive)) {
|
|
2367
2514
|
return;
|
|
2368
2515
|
}
|
|
2369
2516
|
if (e.key === " " || (allowEnter && e.key === "Enter")) {
|
|
@@ -2441,10 +2588,27 @@ function LinkButton(base) {
|
|
|
2441
2588
|
link.click();
|
|
2442
2589
|
}
|
|
2443
2590
|
};
|
|
2591
|
+
/**
|
|
2592
|
+
* The URL to which the link button points.
|
|
2593
|
+
* @default ""
|
|
2594
|
+
*/
|
|
2444
2595
|
this.href = "";
|
|
2596
|
+
/**
|
|
2597
|
+
* The target of the link button.
|
|
2598
|
+
* @default ""
|
|
2599
|
+
*/
|
|
2445
2600
|
this.target = "";
|
|
2601
|
+
/**
|
|
2602
|
+
* The relationship between the `target` of the link button and the document.
|
|
2603
|
+
* @default ""
|
|
2604
|
+
*/
|
|
2446
2605
|
this.rel = "";
|
|
2447
2606
|
}
|
|
2607
|
+
/**
|
|
2608
|
+
* A value indicating whether the `target` of the link button will be downloaded,
|
|
2609
|
+
* optionally specifying the new name of the file.
|
|
2610
|
+
* @default null
|
|
2611
|
+
*/
|
|
2448
2612
|
get download() {
|
|
2449
2613
|
return this.getAttribute("download");
|
|
2450
2614
|
}
|
|
@@ -2460,6 +2624,7 @@ function LinkButton(base) {
|
|
|
2460
2624
|
this.requestUpdate("download", old);
|
|
2461
2625
|
}
|
|
2462
2626
|
}
|
|
2627
|
+
/** @inheritdoc */
|
|
2463
2628
|
connectedCallback() {
|
|
2464
2629
|
super.connectedCallback();
|
|
2465
2630
|
this.addEventListener("click", this[_clickHandler]);
|
|
@@ -2467,10 +2632,12 @@ function LinkButton(base) {
|
|
|
2467
2632
|
this.role = "link";
|
|
2468
2633
|
}
|
|
2469
2634
|
}
|
|
2635
|
+
/** @inheritdoc */
|
|
2470
2636
|
disconnectedCallback() {
|
|
2471
2637
|
super.disconnectedCallback();
|
|
2472
2638
|
this.removeEventListener("click", this[_clickHandler]);
|
|
2473
2639
|
}
|
|
2640
|
+
/** @internal */
|
|
2474
2641
|
[(__LinkButtonMixin_instances = new WeakSet(), _a = _clickHandler, renderPseudoLink)]() {
|
|
2475
2642
|
const disabled = isDisabledMixin(this) && this.disabled;
|
|
2476
2643
|
const disabledInteractive = isDisabledInteractiveMixin(this) && this.disabledInteractive;
|
|
@@ -2542,8 +2709,13 @@ function ReadOnly(base, reflect = true) {
|
|
|
2542
2709
|
class _ReadOnlyMixin extends base {
|
|
2543
2710
|
constructor() {
|
|
2544
2711
|
super(...arguments);
|
|
2712
|
+
/**
|
|
2713
|
+
* A value indicating whether the element is read-only.
|
|
2714
|
+
* @default false
|
|
2715
|
+
*/
|
|
2545
2716
|
this.readOnly = false;
|
|
2546
2717
|
}
|
|
2718
|
+
/** @inheritdoc */
|
|
2547
2719
|
update(changedProperties) {
|
|
2548
2720
|
super.update(changedProperties);
|
|
2549
2721
|
if (changedProperties.has("readOnly")) {
|
|
@@ -2575,11 +2747,17 @@ function Required(base) {
|
|
|
2575
2747
|
class _RequiredMixin extends base {
|
|
2576
2748
|
constructor() {
|
|
2577
2749
|
super(...arguments);
|
|
2750
|
+
/**
|
|
2751
|
+
* Whether a value is required for the element.
|
|
2752
|
+
* @default false
|
|
2753
|
+
*/
|
|
2578
2754
|
this.required = false;
|
|
2579
2755
|
}
|
|
2756
|
+
/** Whether a value is not required for the element. */
|
|
2580
2757
|
get optional() {
|
|
2581
2758
|
return !this.required;
|
|
2582
2759
|
}
|
|
2760
|
+
/** @inheritdoc */
|
|
2583
2761
|
update(changedProperties) {
|
|
2584
2762
|
super.update(changedProperties);
|
|
2585
2763
|
if (changedProperties.has("required")) {
|
|
@@ -2609,6 +2787,7 @@ function isRequiredConstraintValidationMixin(value) {
|
|
|
2609
2787
|
*/
|
|
2610
2788
|
function RequiredConstraintValidation(base) {
|
|
2611
2789
|
class _RequiredConstraintValidation extends base {
|
|
2790
|
+
/** @internal */
|
|
2612
2791
|
[validate]() {
|
|
2613
2792
|
const validity = super[validate]();
|
|
2614
2793
|
if (!validity && this.required) {
|
|
@@ -2635,6 +2814,7 @@ function RequiredConstraintValidation(base) {
|
|
|
2635
2814
|
*/
|
|
2636
2815
|
function Role(base, role) {
|
|
2637
2816
|
class _RoleMixin extends base {
|
|
2817
|
+
/** @inheritdoc */
|
|
2638
2818
|
connectedCallback() {
|
|
2639
2819
|
this.role = this.role || role;
|
|
2640
2820
|
super.connectedCallback();
|
|
@@ -2661,8 +2841,13 @@ function Vertical(base) {
|
|
|
2661
2841
|
class _VerticalMixin extends base {
|
|
2662
2842
|
constructor() {
|
|
2663
2843
|
super(...arguments);
|
|
2844
|
+
/**
|
|
2845
|
+
* Whether the element is oriented vertically.
|
|
2846
|
+
* @default false
|
|
2847
|
+
*/
|
|
2664
2848
|
this.vertical = false;
|
|
2665
2849
|
}
|
|
2850
|
+
/** @inheritdoc */
|
|
2666
2851
|
update(changedProperties) {
|
|
2667
2852
|
super.update(changedProperties);
|
|
2668
2853
|
if (changedProperties.has("vertical")) {
|
|
@@ -2740,13 +2925,13 @@ function prefersReducedMotion() {
|
|
|
2740
2925
|
* If needed, scrolls an element into view within a given scroll container.
|
|
2741
2926
|
* @param {HTMLElement} element The element to scroll into view.
|
|
2742
2927
|
* @param {HTMLElement} scrollContainer The scrollable container.
|
|
2743
|
-
* @param {
|
|
2928
|
+
* @param {ScrollIntoViewOptions} [options=undefined] Options used to scroll into view.
|
|
2744
2929
|
*/
|
|
2745
|
-
function scrollIntoViewIfNeeded(element, scrollContainer,
|
|
2746
|
-
const
|
|
2747
|
-
const
|
|
2748
|
-
if (
|
|
2749
|
-
element.scrollIntoView(
|
|
2930
|
+
function scrollIntoViewIfNeeded(element, scrollContainer, options) {
|
|
2931
|
+
const containerBounds = scrollContainer.getBoundingClientRect();
|
|
2932
|
+
const elementBounds = element.getBoundingClientRect();
|
|
2933
|
+
if (elementBounds.top < containerBounds.top || elementBounds.bottom > containerBounds.bottom) {
|
|
2934
|
+
element.scrollIntoView(options);
|
|
2750
2935
|
}
|
|
2751
2936
|
}
|
|
2752
2937
|
|
|
@@ -2775,7 +2960,7 @@ var _M3eCollapsibleElement_instances, _M3eCollapsibleElement_slotChanged, _M3eCo
|
|
|
2775
2960
|
*
|
|
2776
2961
|
* @cssprop --m3e-collapsible-animation-duration - The duration of the expand / collapse animation.
|
|
2777
2962
|
*/
|
|
2778
|
-
let M3eCollapsibleElement = class M3eCollapsibleElement extends EventAttribute(
|
|
2963
|
+
let M3eCollapsibleElement = class M3eCollapsibleElement extends EventAttribute(LitElement, "opening", "opened", "closing", "closed") {
|
|
2779
2964
|
constructor() {
|
|
2780
2965
|
super(...arguments);
|
|
2781
2966
|
_M3eCollapsibleElement_instances.add(this);
|
|
@@ -2930,7 +3115,6 @@ const ElevationToken = {
|
|
|
2930
3115
|
|
|
2931
3116
|
var _M3eElevationElement_instances, _M3eElevationElement_hoverController, _M3eElevationElement_focusController, _M3eElevationElement_pressedController, _M3eElevationElement_handleHoverChange, _M3eElevationElement_handleFocusChange, _M3eElevationElement_handlePressedChange;
|
|
2932
3117
|
/**
|
|
2933
|
-
* @summary
|
|
2934
3118
|
* Visually depicts elevation using a shadow.
|
|
2935
3119
|
*
|
|
2936
3120
|
* @description
|
|
@@ -3184,7 +3368,6 @@ const FocusRingToken = {
|
|
|
3184
3368
|
|
|
3185
3369
|
var _M3eFocusRingElement_instances, _M3eFocusRingElement_focusController, _M3eFocusRingElement_handleFocusChange;
|
|
3186
3370
|
/**
|
|
3187
|
-
* @summary
|
|
3188
3371
|
* A focus ring used to depict a strong focus indicator.
|
|
3189
3372
|
*
|
|
3190
3373
|
* @description
|
|
@@ -3372,7 +3555,6 @@ M3eFocusRingElement = __decorate([
|
|
|
3372
3555
|
], M3eFocusRingElement);
|
|
3373
3556
|
|
|
3374
3557
|
/**
|
|
3375
|
-
* @summary
|
|
3376
3558
|
* An element which looks like a checkbox.
|
|
3377
3559
|
*
|
|
3378
3560
|
* @description
|
|
@@ -3477,7 +3659,6 @@ M3ePseudoCheckboxElement = __decorate([
|
|
|
3477
3659
|
], M3ePseudoCheckboxElement);
|
|
3478
3660
|
|
|
3479
3661
|
/**
|
|
3480
|
-
* @summary
|
|
3481
3662
|
* An element which looks like a radio button.
|
|
3482
3663
|
*
|
|
3483
3664
|
* @description
|
|
@@ -3562,7 +3743,6 @@ const RippleToken = {
|
|
|
3562
3743
|
|
|
3563
3744
|
var _M3eRippleElement_instances, _M3eRippleElement_ripple, _M3eRippleElement_pressedController, _M3eRippleElement_destroyRipple, _M3eRippleElement_handleAnimationEnd, _M3eRippleElement_handlePressedChange;
|
|
3564
3745
|
/**
|
|
3565
|
-
* @summary
|
|
3566
3746
|
* Connects user input to screen reactions using ripples.
|
|
3567
3747
|
*
|
|
3568
3748
|
* @description
|
|
@@ -3611,6 +3791,7 @@ let M3eRippleElement = class M3eRippleElement extends HtmlFor(Role(LitElement, "
|
|
|
3611
3791
|
/** @private */ _M3eRippleElement_ripple.set(this, null);
|
|
3612
3792
|
/** @private */ _M3eRippleElement_pressedController.set(this, new PressedController(this, {
|
|
3613
3793
|
target: null,
|
|
3794
|
+
minPressedDuration: 150,
|
|
3614
3795
|
isPressedKey: (key) => key === " " || (!this.disableEnter && key === "Enter"),
|
|
3615
3796
|
callback: (pressed, { x, y }) => __classPrivateFieldGet(this, _M3eRippleElement_instances, "m", _M3eRippleElement_handlePressedChange).call(this, pressed, x, y),
|
|
3616
3797
|
}));
|
|
@@ -3837,7 +4018,6 @@ M3eRippleElement = __decorate([
|
|
|
3837
4018
|
|
|
3838
4019
|
var _M3eScrollContainerElement_scrollHandler;
|
|
3839
4020
|
/**
|
|
3840
|
-
* @summary
|
|
3841
4021
|
* A vertically oriented content container which presents dividers above and below content when scrolled.
|
|
3842
4022
|
*
|
|
3843
4023
|
* @description
|
|
@@ -3867,7 +4047,7 @@ var _M3eScrollContainerElement_scrollHandler;
|
|
|
3867
4047
|
* @cssprop --m3e-focus-ring-factor - Animation factor for focus ring thickness.
|
|
3868
4048
|
* @cssprop --m3e-focus-ring-duration - Duration of the focus ring animation.
|
|
3869
4049
|
*/
|
|
3870
|
-
let M3eScrollContainerElement = class M3eScrollContainerElement extends
|
|
4050
|
+
let M3eScrollContainerElement = class M3eScrollContainerElement extends LitElement {
|
|
3871
4051
|
constructor() {
|
|
3872
4052
|
super(...arguments);
|
|
3873
4053
|
/** @private */ _M3eScrollContainerElement_scrollHandler.set(this, () => this._updateScroll());
|
|
@@ -4000,7 +4180,7 @@ var _M3eSlide_instances, _M3eSlide_updateItems;
|
|
|
4000
4180
|
*
|
|
4001
4181
|
* @cssprop --m3e-slide-animation-duration - The duration of transitions between slotted items.
|
|
4002
4182
|
*/
|
|
4003
|
-
let M3eSlide = class M3eSlide extends
|
|
4183
|
+
let M3eSlide = class M3eSlide extends LitElement {
|
|
4004
4184
|
constructor() {
|
|
4005
4185
|
super(...arguments);
|
|
4006
4186
|
_M3eSlide_instances.add(this);
|
|
@@ -4110,7 +4290,6 @@ const StateLayerToken = {
|
|
|
4110
4290
|
|
|
4111
4291
|
var _M3eStateLayerElement_instances, _M3eStateLayerElement_hoverController, _M3eStateLayerElement_focusController, _M3eStateLayerElement_handleHoverChange, _M3eStateLayerElement_handleFocusChange;
|
|
4112
4292
|
/**
|
|
4113
|
-
* @summary
|
|
4114
4293
|
* Provides focus and hover state layer treatment for an interactive element.
|
|
4115
4294
|
*
|
|
4116
4295
|
* @description
|
|
@@ -4286,7 +4465,6 @@ M3eStateLayerElement = __decorate([
|
|
|
4286
4465
|
], M3eStateLayerElement);
|
|
4287
4466
|
|
|
4288
4467
|
/**
|
|
4289
|
-
* @summary
|
|
4290
4468
|
* An inline container which presents an ellipsis when content overflows.
|
|
4291
4469
|
*
|
|
4292
4470
|
* @description
|
|
@@ -4338,5 +4516,211 @@ M3eTextOverflowElement = __decorate([
|
|
|
4338
4516
|
t$2("m3e-text-overflow")
|
|
4339
4517
|
], M3eTextOverflowElement);
|
|
4340
4518
|
|
|
4341
|
-
|
|
4519
|
+
var _M3eTextHighlightElement_instances, _M3eTextHighlightElement_id, _M3eTextHighlightElement_ranges, _M3eTextHighlightElement_styles, _M3eTextHighlightElement_isTextNode, _M3eTextHighlightElement_findTextNodes, _M3eTextHighlightElement_highlight;
|
|
4520
|
+
var M3eTextHighlightElement_1;
|
|
4521
|
+
/**
|
|
4522
|
+
* Highlights text which matches a given search term.
|
|
4523
|
+
*
|
|
4524
|
+
* @description
|
|
4525
|
+
* Highlights all text ranges in slotted content that match a given search term using the CSS Custom Highlight API.
|
|
4526
|
+
*
|
|
4527
|
+
* @example
|
|
4528
|
+
* The following example illustrates highlighting "Lor".
|
|
4529
|
+
* ```html
|
|
4530
|
+
* <m3e-text-highlight term="Lor">
|
|
4531
|
+
* <p>
|
|
4532
|
+
* Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
|
|
4533
|
+
* ut labore et dolore magna aliqua.
|
|
4534
|
+
* </p>
|
|
4535
|
+
* </m3e-text-highlight>
|
|
4536
|
+
* ```
|
|
4537
|
+
*
|
|
4538
|
+
* @tag m3e-text-highlight
|
|
4539
|
+
*
|
|
4540
|
+
* @slot - Renders the content to highlight.
|
|
4541
|
+
*
|
|
4542
|
+
* @attr case-sensitive - A value indicating whether matching is case sensitive.
|
|
4543
|
+
* @attr disabled - A value indicating whether text highlighting is disabled.
|
|
4544
|
+
* @attr term - The term to highlight.
|
|
4545
|
+
*
|
|
4546
|
+
* @fires highlight - Emitted when content is highlighted.
|
|
4547
|
+
*
|
|
4548
|
+
* @cssprop --m3e-text-highlight-container-color - Background color applied to highlighted text ranges.
|
|
4549
|
+
* @cssprop --m3e-text-highlight-color - Foreground color of highlighted text content.
|
|
4550
|
+
* @cssprop --m3e-text-highlight-decoration - Optional text decoration (e.g., underline, line-through) for highlighted text.
|
|
4551
|
+
* @cssprop --m3e-text-highlight-shadow - Optional text shadow for emphasis or contrast.
|
|
4552
|
+
*/
|
|
4553
|
+
let M3eTextHighlightElement = M3eTextHighlightElement_1 = class M3eTextHighlightElement extends LitElement {
|
|
4554
|
+
constructor() {
|
|
4555
|
+
super();
|
|
4556
|
+
_M3eTextHighlightElement_instances.add(this);
|
|
4557
|
+
/** @private */ _M3eTextHighlightElement_id.set(this, `m3e-text-highlight-${M3eTextHighlightElement_1.__nextId++}`);
|
|
4558
|
+
/** @private */ _M3eTextHighlightElement_ranges.set(this, new Array());
|
|
4559
|
+
/** @private */ _M3eTextHighlightElement_styles.set(this, null);
|
|
4560
|
+
/**
|
|
4561
|
+
* A value indicating whether text highlighting is disabled.
|
|
4562
|
+
* @default false
|
|
4563
|
+
*/
|
|
4564
|
+
this.disabled = false;
|
|
4565
|
+
/**
|
|
4566
|
+
* The term to highlight.
|
|
4567
|
+
* @default ""
|
|
4568
|
+
*/
|
|
4569
|
+
this.term = "";
|
|
4570
|
+
/**
|
|
4571
|
+
* A value indicating whether matching is case sensitive.
|
|
4572
|
+
* @default false
|
|
4573
|
+
*/
|
|
4574
|
+
this.caseSensitive = false;
|
|
4575
|
+
if (this.isSupported) {
|
|
4576
|
+
__classPrivateFieldSet(this, _M3eTextHighlightElement_styles, new CSSStyleSheet(), "f");
|
|
4577
|
+
__classPrivateFieldGet(this, _M3eTextHighlightElement_styles, "f").replaceSync(css `
|
|
4578
|
+
::highlight(${unsafeCSS(__classPrivateFieldGet(this, _M3eTextHighlightElement_id, "f"))}) {
|
|
4579
|
+
background-color: var(--m3e-text-highlight-container-color, ${DesignToken.color.secondaryContainer});
|
|
4580
|
+
color: var(--m3e-text-highlight-color, ${DesignToken.color.onSecondaryContainer});
|
|
4581
|
+
text-decoration: var(--m3e-text-highlight-decoration);
|
|
4582
|
+
text-shadow: var(--m3e-text-highlight-shadow);
|
|
4583
|
+
}
|
|
4584
|
+
`.toString());
|
|
4585
|
+
}
|
|
4586
|
+
}
|
|
4587
|
+
/** A value indicating whether text highlighting is supported by the browser. */
|
|
4588
|
+
get isSupported() {
|
|
4589
|
+
return !isServer && CSS.highlights ? true : false;
|
|
4590
|
+
}
|
|
4591
|
+
/** The ranges that match the current term. */
|
|
4592
|
+
get ranges() {
|
|
4593
|
+
return __classPrivateFieldGet(this, _M3eTextHighlightElement_ranges, "f");
|
|
4594
|
+
}
|
|
4595
|
+
/** @inheritdoc */
|
|
4596
|
+
firstUpdated(_changedProperties) {
|
|
4597
|
+
super.firstUpdated(_changedProperties);
|
|
4598
|
+
if (this.shadowRoot && __classPrivateFieldGet(this, _M3eTextHighlightElement_styles, "f") && !this.shadowRoot.adoptedStyleSheets.includes(__classPrivateFieldGet(this, _M3eTextHighlightElement_styles, "f"))) {
|
|
4599
|
+
this.shadowRoot.adoptedStyleSheets.push(__classPrivateFieldGet(this, _M3eTextHighlightElement_styles, "f"));
|
|
4600
|
+
}
|
|
4601
|
+
}
|
|
4602
|
+
/** @inheritdoc */
|
|
4603
|
+
updated(_changedProperties) {
|
|
4604
|
+
super.updated(_changedProperties);
|
|
4605
|
+
if (_changedProperties.has("term") ||
|
|
4606
|
+
_changedProperties.has("caseSensitive") ||
|
|
4607
|
+
_changedProperties.has("disabled")) {
|
|
4608
|
+
__classPrivateFieldGet(this, _M3eTextHighlightElement_instances, "m", _M3eTextHighlightElement_highlight).call(this);
|
|
4609
|
+
}
|
|
4610
|
+
}
|
|
4611
|
+
/** @inheritdoc */
|
|
4612
|
+
render() {
|
|
4613
|
+
return html `<slot @slotchange="${__classPrivateFieldGet(this, _M3eTextHighlightElement_instances, "m", _M3eTextHighlightElement_highlight)}"></slot>`;
|
|
4614
|
+
}
|
|
4615
|
+
};
|
|
4616
|
+
_M3eTextHighlightElement_id = new WeakMap();
|
|
4617
|
+
_M3eTextHighlightElement_ranges = new WeakMap();
|
|
4618
|
+
_M3eTextHighlightElement_styles = new WeakMap();
|
|
4619
|
+
_M3eTextHighlightElement_instances = new WeakSet();
|
|
4620
|
+
_M3eTextHighlightElement_isTextNode = function _M3eTextHighlightElement_isTextNode(node) {
|
|
4621
|
+
return /^(\\s|\\n)+$/gi.test(node.data) ? false : true;
|
|
4622
|
+
};
|
|
4623
|
+
_M3eTextHighlightElement_findTextNodes = function _M3eTextHighlightElement_findTextNodes(parent, nodes) {
|
|
4624
|
+
if (parent instanceof HTMLSlotElement) {
|
|
4625
|
+
parent.assignedElements({ flatten: true }).forEach((x) => {
|
|
4626
|
+
switch (x.nodeType) {
|
|
4627
|
+
case Node.TEXT_NODE:
|
|
4628
|
+
if (__classPrivateFieldGet(this, _M3eTextHighlightElement_instances, "m", _M3eTextHighlightElement_isTextNode).call(this, x)) {
|
|
4629
|
+
nodes.push(x);
|
|
4630
|
+
}
|
|
4631
|
+
break;
|
|
4632
|
+
case Node.ELEMENT_NODE:
|
|
4633
|
+
__classPrivateFieldGet(this, _M3eTextHighlightElement_instances, "m", _M3eTextHighlightElement_findTextNodes).call(this, x, nodes);
|
|
4634
|
+
break;
|
|
4635
|
+
}
|
|
4636
|
+
});
|
|
4637
|
+
}
|
|
4638
|
+
else {
|
|
4639
|
+
parent.childNodes.forEach((x) => {
|
|
4640
|
+
switch (x.nodeType) {
|
|
4641
|
+
case Node.TEXT_NODE:
|
|
4642
|
+
if (__classPrivateFieldGet(this, _M3eTextHighlightElement_instances, "m", _M3eTextHighlightElement_isTextNode).call(this, x)) {
|
|
4643
|
+
nodes.push(x);
|
|
4644
|
+
}
|
|
4645
|
+
break;
|
|
4646
|
+
case Node.ELEMENT_NODE:
|
|
4647
|
+
__classPrivateFieldGet(this, _M3eTextHighlightElement_instances, "m", _M3eTextHighlightElement_findTextNodes).call(this, x, nodes);
|
|
4648
|
+
break;
|
|
4649
|
+
}
|
|
4650
|
+
});
|
|
4651
|
+
}
|
|
4652
|
+
};
|
|
4653
|
+
_M3eTextHighlightElement_highlight = function _M3eTextHighlightElement_highlight() {
|
|
4654
|
+
if (!this.isSupported || !this.isConnected)
|
|
4655
|
+
return;
|
|
4656
|
+
CSS.highlights.delete(__classPrivateFieldGet(this, _M3eTextHighlightElement_id, "f"));
|
|
4657
|
+
__classPrivateFieldGet(this, _M3eTextHighlightElement_ranges, "f").length = 0;
|
|
4658
|
+
if (this.disabled)
|
|
4659
|
+
return;
|
|
4660
|
+
if (!this.term) {
|
|
4661
|
+
this.dispatchEvent(new CustomEvent("highlight", {
|
|
4662
|
+
detail: [...__classPrivateFieldGet(this, _M3eTextHighlightElement_ranges, "f")],
|
|
4663
|
+
bubbles: false,
|
|
4664
|
+
composed: false,
|
|
4665
|
+
}));
|
|
4666
|
+
return;
|
|
4667
|
+
}
|
|
4668
|
+
const texts = new Array();
|
|
4669
|
+
__classPrivateFieldGet(this, _M3eTextHighlightElement_instances, "m", _M3eTextHighlightElement_findTextNodes).call(this, this, texts);
|
|
4670
|
+
const term = !this.caseSensitive ? this.term.toLowerCase() : this.term;
|
|
4671
|
+
__classPrivateFieldSet(this, _M3eTextHighlightElement_ranges, texts
|
|
4672
|
+
.map((x) => {
|
|
4673
|
+
return {
|
|
4674
|
+
el: x,
|
|
4675
|
+
text: (!this.caseSensitive ? x.textContent?.toLowerCase() : x.textContent) ?? "",
|
|
4676
|
+
};
|
|
4677
|
+
})
|
|
4678
|
+
.map(({ el, text }) => {
|
|
4679
|
+
const indices = new Array();
|
|
4680
|
+
let startPos = 0;
|
|
4681
|
+
while (startPos < text.length) {
|
|
4682
|
+
const index = text.indexOf(term, startPos);
|
|
4683
|
+
if (index === -1)
|
|
4684
|
+
break;
|
|
4685
|
+
indices.push(index);
|
|
4686
|
+
startPos = index + term.length;
|
|
4687
|
+
}
|
|
4688
|
+
return indices.map((index) => {
|
|
4689
|
+
const range = new Range();
|
|
4690
|
+
range.setStart(el, index);
|
|
4691
|
+
range.setEnd(el, index + term.length);
|
|
4692
|
+
return range;
|
|
4693
|
+
});
|
|
4694
|
+
})
|
|
4695
|
+
.flat(), "f");
|
|
4696
|
+
if (__classPrivateFieldGet(this, _M3eTextHighlightElement_ranges, "f").length > 0) {
|
|
4697
|
+
CSS.highlights.set(__classPrivateFieldGet(this, _M3eTextHighlightElement_id, "f"), new Highlight(...__classPrivateFieldGet(this, _M3eTextHighlightElement_ranges, "f")));
|
|
4698
|
+
}
|
|
4699
|
+
this.dispatchEvent(new CustomEvent("highlight", {
|
|
4700
|
+
detail: [...__classPrivateFieldGet(this, _M3eTextHighlightElement_ranges, "f")],
|
|
4701
|
+
bubbles: false,
|
|
4702
|
+
composed: false,
|
|
4703
|
+
}));
|
|
4704
|
+
};
|
|
4705
|
+
/** The styles of the element. */
|
|
4706
|
+
M3eTextHighlightElement.styles = css `
|
|
4707
|
+
:host {
|
|
4708
|
+
display: contents;
|
|
4709
|
+
}
|
|
4710
|
+
`;
|
|
4711
|
+
/** @private */ M3eTextHighlightElement.__nextId = 0;
|
|
4712
|
+
__decorate([
|
|
4713
|
+
n$1({ type: Boolean, reflect: true })
|
|
4714
|
+
], M3eTextHighlightElement.prototype, "disabled", void 0);
|
|
4715
|
+
__decorate([
|
|
4716
|
+
n$1()
|
|
4717
|
+
], M3eTextHighlightElement.prototype, "term", void 0);
|
|
4718
|
+
__decorate([
|
|
4719
|
+
n$1({ attribute: "case-sensitive", type: Boolean })
|
|
4720
|
+
], M3eTextHighlightElement.prototype, "caseSensitive", void 0);
|
|
4721
|
+
M3eTextHighlightElement = M3eTextHighlightElement_1 = __decorate([
|
|
4722
|
+
t$2("m3e-text-highlight")
|
|
4723
|
+
], M3eTextHighlightElement);
|
|
4724
|
+
|
|
4725
|
+
export { 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, M3eSlide, M3eStateLayerElement, M3eTextHighlightElement, M3eTextOverflowElement, MutationController, PressedController, ReadOnly, Required, RequiredConstraintValidation, ResizeController, Role, ScrollController, Selected, Touched, Vertical, checkOrSelect, debounce, defaultValue, formValue, getTextContent, guid, hasAssignedNodes, hasKeys, internals, isAttachInternalsMixin, isCheckedIndeterminateMixin, isCheckedMixin, isCheckedOrSelected, isCheckedOrSelectedMixin, isConstraintValidationMixin, isDirtyMixin, isDisabledInteractiveMixin, isDisabledMixin, isFormAssociatedMixin, isFormSubmitterMixin, isHtmlForMixin, isLabelledMixin, isLinkButtonMixin, isReadOnlyMixin, isRequiredConstraintValidationMixin, isRequiredMixin, isSelectedMixin, isTouchedMixin, isVerticalMixin, prefersReducedMotion, renderPseudoLink, safeStyleMap, scrollIntoViewIfNeeded, validate };
|
|
4342
4726
|
//# sourceMappingURL=index.js.map
|