@sandlada/mdc 0.1.0-20250907.a
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/LICENSE +21 -0
- package/LICENSES/LICENSE-APACHE-2.0.txt +202 -0
- package/README.md +43 -0
- package/build/all.d.ts +24 -0
- package/build/all.d.ts.map +1 -0
- package/build/all.js +1 -0
- package/build/class-map-DlMb2KKL.js +11 -0
- package/build/color-CigMJnjV.js +1 -0
- package/build/component-definitions/badge.definition.d.ts +15 -0
- package/build/component-definitions/badge.definition.d.ts.map +1 -0
- package/build/component-definitions/badge.definition.js +6 -0
- package/build/component-definitions/button.definition.d.ts +1017 -0
- package/build/component-definitions/button.definition.d.ts.map +1 -0
- package/build/component-definitions/button.definition.js +6 -0
- package/build/component-definitions/card.definition.d.ts +99 -0
- package/build/component-definitions/card.definition.d.ts.map +1 -0
- package/build/component-definitions/card.definition.js +6 -0
- package/build/component-definitions/checkbox.definition.d.ts +74 -0
- package/build/component-definitions/checkbox.definition.d.ts.map +1 -0
- package/build/component-definitions/checkbox.definition.js +6 -0
- package/build/component-definitions/dialog.definition.d.ts +74 -0
- package/build/component-definitions/dialog.definition.d.ts.map +1 -0
- package/build/component-definitions/dialog.definition.js +1 -0
- package/build/component-definitions/divider.definition.d.ts +5 -0
- package/build/component-definitions/divider.definition.d.ts.map +1 -0
- package/build/component-definitions/divider.definition.js +6 -0
- package/build/component-definitions/elevation.definition.d.ts +5 -0
- package/build/component-definitions/elevation.definition.d.ts.map +1 -0
- package/build/component-definitions/elevation.definition.js +6 -0
- package/build/component-definitions/fab.definition.d.ts +643 -0
- package/build/component-definitions/fab.definition.d.ts.map +1 -0
- package/build/component-definitions/fab.definition.js +6 -0
- package/build/component-definitions/focus-ring.definition.d.ts +13 -0
- package/build/component-definitions/focus-ring.definition.d.ts.map +1 -0
- package/build/component-definitions/focus-ring.definition.js +6 -0
- package/build/component-definitions/icon-button.definition.d.ts +718 -0
- package/build/component-definitions/icon-button.definition.d.ts.map +1 -0
- package/build/component-definitions/icon-button.definition.js +6 -0
- package/build/component-definitions/icon.definition.d.ts +10 -0
- package/build/component-definitions/icon.definition.d.ts.map +1 -0
- package/build/component-definitions/icon.definition.js +6 -0
- package/build/component-definitions/navigation-bar.definition.d.ts +36 -0
- package/build/component-definitions/navigation-bar.definition.d.ts.map +1 -0
- package/build/component-definitions/navigation-bar.definition.js +1 -0
- package/build/component-definitions/navigation-rail.definition.d.ts +37 -0
- package/build/component-definitions/navigation-rail.definition.d.ts.map +1 -0
- package/build/component-definitions/navigation-rail.definition.js +1 -0
- package/build/component-definitions/navigation-tab.definition.d.ts +337 -0
- package/build/component-definitions/navigation-tab.definition.d.ts.map +1 -0
- package/build/component-definitions/navigation-tab.definition.js +23 -0
- package/build/component-definitions/progress-indicator.definition.d.ts +52 -0
- package/build/component-definitions/progress-indicator.definition.d.ts.map +1 -0
- package/build/component-definitions/progress-indicator.definition.js +1 -0
- package/build/component-definitions/radio-button.definition.d.ts +29 -0
- package/build/component-definitions/radio-button.definition.d.ts.map +1 -0
- package/build/component-definitions/radio-button.definition.js +6 -0
- package/build/component-definitions/ripple.definition.d.ts +9 -0
- package/build/component-definitions/ripple.definition.d.ts.map +1 -0
- package/build/component-definitions/ripple.definition.js +6 -0
- package/build/component-definitions/search.definition.d.ts +47 -0
- package/build/component-definitions/search.definition.d.ts.map +1 -0
- package/build/component-definitions/search.definition.js +1 -0
- package/build/component-definitions/slider.definition.d.ts +80 -0
- package/build/component-definitions/slider.definition.d.ts.map +1 -0
- package/build/component-definitions/slider.definition.js +1 -0
- package/build/component-definitions/switch.definition.d.ts +84 -0
- package/build/component-definitions/switch.definition.d.ts.map +1 -0
- package/build/component-definitions/switch.definition.js +6 -0
- package/build/components/button/base-button.d.ts +100 -0
- package/build/components/button/base-button.d.ts.map +1 -0
- package/build/components/button/base-button.js +1 -0
- package/build/components/button/button.d.ts +34 -0
- package/build/components/button/button.d.ts.map +1 -0
- package/build/components/button/button.js +1 -0
- package/build/components/button/button.style.d.ts +2 -0
- package/build/components/button/button.style.d.ts.map +1 -0
- package/build/components/button/button.style.js +468 -0
- package/build/components/button/toggle-button.d.ts +71 -0
- package/build/components/button/toggle-button.d.ts.map +1 -0
- package/build/components/button/toggle-button.js +1 -0
- package/build/components/button-group/base-button-group.d.ts +6 -0
- package/build/components/button-group/base-button-group.d.ts.map +1 -0
- package/build/components/button-group/base-button-group.js +1 -0
- package/build/components/button-group/connected-button-group.d.ts +8 -0
- package/build/components/button-group/connected-button-group.d.ts.map +1 -0
- package/build/components/button-group/connected-button-group.js +1 -0
- package/build/components/button-group/standard-button-group.d.ts +4 -0
- package/build/components/button-group/standard-button-group.d.ts.map +1 -0
- package/build/components/button-group/standard-button-group.js +1 -0
- package/build/components/dialog/base-dialog.d.ts +42 -0
- package/build/components/dialog/base-dialog.d.ts.map +1 -0
- package/build/components/dialog/base-dialog.js +1 -0
- package/build/components/dialog/basic-dialog.d.ts +10 -0
- package/build/components/dialog/basic-dialog.d.ts.map +1 -0
- package/build/components/dialog/basic-dialog.js +1 -0
- package/build/components/dialog/dialog-action.d.ts +62 -0
- package/build/components/dialog/dialog-action.d.ts.map +1 -0
- package/build/components/dialog/dialog-action.js +1 -0
- package/build/components/dialog/dialog-animations.d.ts +48 -0
- package/build/components/dialog/dialog-animations.d.ts.map +1 -0
- package/build/components/dialog/dialog-animations.js +6 -0
- package/build/components/dialog/dialog.style.d.ts +2 -0
- package/build/components/dialog/dialog.style.d.ts.map +1 -0
- package/build/components/dialog/dialog.style.js +217 -0
- package/build/components/divider/divider.d.ts +18 -0
- package/build/components/divider/divider.d.ts.map +1 -0
- package/build/components/divider/divider.js +1 -0
- package/build/components/divider/divider.style.d.ts +2 -0
- package/build/components/divider/divider.style.d.ts.map +1 -0
- package/build/components/divider/divider.style.js +6 -0
- package/build/components/elevation/elevation.d.ts +46 -0
- package/build/components/elevation/elevation.d.ts.map +1 -0
- package/build/components/elevation/elevation.js +1 -0
- package/build/components/elevation/elevation.style.d.ts +2 -0
- package/build/components/elevation/elevation.style.d.ts.map +1 -0
- package/build/components/elevation/elevation.style.js +6 -0
- package/build/components/fab/base-extended-fab.d.ts +23 -0
- package/build/components/fab/base-extended-fab.d.ts.map +1 -0
- package/build/components/fab/base-extended-fab.js +1 -0
- package/build/components/fab/base-fab.d.ts +47 -0
- package/build/components/fab/base-fab.d.ts.map +1 -0
- package/build/components/fab/base-fab.js +1 -0
- package/build/components/fab/fab.d.ts +29 -0
- package/build/components/fab/fab.d.ts.map +1 -0
- package/build/components/fab/fab.js +1 -0
- package/build/components/fab/fab.style.d.ts +2 -0
- package/build/components/fab/fab.style.d.ts.map +1 -0
- package/build/components/fab/fab.style.js +180 -0
- package/build/components/focus-ring/focus-ring.d.ts +56 -0
- package/build/components/focus-ring/focus-ring.d.ts.map +1 -0
- package/build/components/focus-ring/focus-ring.js +1 -0
- package/build/components/focus-ring/focus-ring.style.d.ts +2 -0
- package/build/components/focus-ring/focus-ring.style.d.ts.map +1 -0
- package/build/components/focus-ring/focus-ring.style.js +108 -0
- package/build/components/icon/icon.d.ts +50 -0
- package/build/components/icon/icon.d.ts.map +1 -0
- package/build/components/icon/icon.js +1 -0
- package/build/components/icon/icon.style.d.ts +2 -0
- package/build/components/icon/icon.style.d.ts.map +1 -0
- package/build/components/icon/icon.style.js +6 -0
- package/build/components/icon-button/base-icon-button.d.ts +69 -0
- package/build/components/icon-button/base-icon-button.d.ts.map +1 -0
- package/build/components/icon-button/base-icon-button.js +1 -0
- package/build/components/icon-button/icon-button.d.ts +24 -0
- package/build/components/icon-button/icon-button.d.ts.map +1 -0
- package/build/components/icon-button/icon-button.js +1 -0
- package/build/components/icon-button/icon-button.style.d.ts +2 -0
- package/build/components/icon-button/icon-button.style.d.ts.map +1 -0
- package/build/components/icon-button/icon-button.style.js +357 -0
- package/build/components/icon-button/toggle-icon-button.d.ts +68 -0
- package/build/components/icon-button/toggle-icon-button.d.ts.map +1 -0
- package/build/components/icon-button/toggle-icon-button.js +1 -0
- package/build/components/navigation-bar/navigation-bar-animations.d.ts +21 -0
- package/build/components/navigation-bar/navigation-bar-animations.d.ts.map +1 -0
- package/build/components/navigation-bar/navigation-bar-animations.js +1 -0
- package/build/components/navigation-bar/navigation-bar.d.ts +75 -0
- package/build/components/navigation-bar/navigation-bar.d.ts.map +1 -0
- package/build/components/navigation-bar/navigation-bar.js +1 -0
- package/build/components/navigation-bar/navigation-bar.style.d.ts +2 -0
- package/build/components/navigation-bar/navigation-bar.style.d.ts.map +1 -0
- package/build/components/navigation-bar/navigation-bar.style.js +1 -0
- package/build/components/navigation-item/base-navigation-tab.d.ts +67 -0
- package/build/components/navigation-item/base-navigation-tab.d.ts.map +1 -0
- package/build/components/navigation-item/base-navigation-tab.js +1 -0
- package/build/components/navigation-item/navigation-bar-tab.d.ts +30 -0
- package/build/components/navigation-item/navigation-bar-tab.d.ts.map +1 -0
- package/build/components/navigation-item/navigation-bar-tab.js +1 -0
- package/build/components/navigation-item/navigation-rail-tab.d.ts +32 -0
- package/build/components/navigation-item/navigation-rail-tab.d.ts.map +1 -0
- package/build/components/navigation-item/navigation-rail-tab.js +1 -0
- package/build/components/navigation-item/navigation-tab-sigle-selection-controller.d.ts +37 -0
- package/build/components/navigation-item/navigation-tab-sigle-selection-controller.d.ts.map +1 -0
- package/build/components/navigation-item/navigation-tab-sigle-selection-controller.js +6 -0
- package/build/components/navigation-item/navigation-tab.d.ts +6 -0
- package/build/components/navigation-item/navigation-tab.d.ts.map +1 -0
- package/build/components/navigation-item/navigation-tab.js +1 -0
- package/build/components/navigation-item/navigation-tab.style.d.ts +3 -0
- package/build/components/navigation-item/navigation-tab.style.d.ts.map +1 -0
- package/build/components/navigation-item/navigation-tab.style.js +353 -0
- package/build/components/navigation-rail/navigation-rail-animations.d.ts +21 -0
- package/build/components/navigation-rail/navigation-rail-animations.d.ts.map +1 -0
- package/build/components/navigation-rail/navigation-rail-animations.js +1 -0
- package/build/components/navigation-rail/navigation-rail.d.ts +94 -0
- package/build/components/navigation-rail/navigation-rail.d.ts.map +1 -0
- package/build/components/navigation-rail/navigation-rail.js +1 -0
- package/build/components/navigation-rail/navigation-rail.style.d.ts +2 -0
- package/build/components/navigation-rail/navigation-rail.style.d.ts.map +1 -0
- package/build/components/navigation-rail/navigation-rail.style.js +1 -0
- package/build/components/progress-indicator/base-progress-indicator.d.ts +33 -0
- package/build/components/progress-indicator/base-progress-indicator.d.ts.map +1 -0
- package/build/components/progress-indicator/base-progress-indicator.js +1 -0
- package/build/components/progress-indicator/linear-progress-indicator.d.ts +47 -0
- package/build/components/progress-indicator/linear-progress-indicator.d.ts.map +1 -0
- package/build/components/progress-indicator/linear-progress-indicator.js +1 -0
- package/build/components/progress-indicator/progress-indicator.style.d.ts +2 -0
- package/build/components/progress-indicator/progress-indicator.style.d.ts.map +1 -0
- package/build/components/progress-indicator/progress-indicator.style.js +154 -0
- package/build/components/radio-button/radio-button.d.ts +49 -0
- package/build/components/radio-button/radio-button.d.ts.map +1 -0
- package/build/components/radio-button/radio-button.js +1 -0
- package/build/components/radio-button/radio-button.style.d.ts +2 -0
- package/build/components/radio-button/radio-button.style.d.ts.map +1 -0
- package/build/components/radio-button/radio-button.style.js +143 -0
- package/build/components/ripple/ripple-action.d.ts +62 -0
- package/build/components/ripple/ripple-action.d.ts.map +1 -0
- package/build/components/ripple/ripple-action.js +10 -0
- package/build/components/ripple/ripple.d.ts +55 -0
- package/build/components/ripple/ripple.d.ts.map +1 -0
- package/build/components/ripple/ripple.js +1 -0
- package/build/components/ripple/ripple.style.d.ts +2 -0
- package/build/components/ripple/ripple.style.d.ts.map +1 -0
- package/build/components/ripple/ripple.style.js +6 -0
- package/build/components/search/search-bar.d.ts +30 -0
- package/build/components/search/search-bar.d.ts.map +1 -0
- package/build/components/search/search-bar.js +1 -0
- package/build/components/search/search-bar.style.d.ts +2 -0
- package/build/components/search/search-bar.style.d.ts.map +1 -0
- package/build/components/search/search-bar.style.js +1 -0
- package/build/components/slider/base-slider.d.ts +58 -0
- package/build/components/slider/base-slider.d.ts.map +1 -0
- package/build/components/slider/base-slider.js +1 -0
- package/build/components/slider/slider.d.ts +3 -0
- package/build/components/slider/slider.d.ts.map +1 -0
- package/build/components/slider/slider.js +1 -0
- package/build/components/switch/switch.d.ts +45 -0
- package/build/components/switch/switch.d.ts.map +1 -0
- package/build/components/switch/switch.js +1 -0
- package/build/components/switch/switch.style.d.ts +2 -0
- package/build/components/switch/switch.style.d.ts.map +1 -0
- package/build/components/switch/switch.style.js +329 -0
- package/build/components/typography/typography.d.ts +44 -0
- package/build/components/typography/typography.d.ts.map +1 -0
- package/build/components/typography/typography.js +1 -0
- package/build/components/typography/typography.styles.d.ts +3 -0
- package/build/components/typography/typography.styles.d.ts.map +1 -0
- package/build/components/typography/typography.styles.js +6 -0
- package/build/components/wave/base-wave.d.ts +12 -0
- package/build/components/wave/base-wave.d.ts.map +1 -0
- package/build/components/wave/base-wave.js +1 -0
- package/build/components/wave/circular-wave.d.ts +37 -0
- package/build/components/wave/circular-wave.d.ts.map +1 -0
- package/build/components/wave/circular-wave.js +1 -0
- package/build/components/wave/linear-wave.d.ts +26 -0
- package/build/components/wave/linear-wave.d.ts.map +1 -0
- package/build/components/wave/linear-wave.js +1 -0
- package/build/custom-element-Dz3n6kSt.js +6 -0
- package/build/definitions.d.ts +18 -0
- package/build/definitions.d.ts.map +1 -0
- package/build/definitions.js +1 -0
- package/build/duration-CDKuKTyT.js +1 -0
- package/build/easing-5hHInU7b.js +1 -0
- package/build/elevation-dUQez_WX.js +1 -0
- package/build/lit-element-Ho-VPzO1.js +22 -0
- package/build/property-Ck1wIidx.js +6 -0
- package/build/query-DifSdHBD.js +11 -0
- package/build/query-assigned-elements-CAhlPqtD.js +6 -0
- package/build/shape-CrZ0CLVJ.js +1 -0
- package/build/state--U2hSgGK.js +6 -0
- package/build/state-C-haZXan.js +1 -0
- package/build/tslib.es6-CmLYFWVC.js +1 -0
- package/build/typescale-Bh1NLwSE.js +1 -0
- package/build/utils/aria/aria.d.ts +71 -0
- package/build/utils/aria/aria.d.ts.map +1 -0
- package/build/utils/aria/aria.js +6 -0
- package/build/utils/aria/delegate.d.ts +55 -0
- package/build/utils/aria/delegate.d.ts.map +1 -0
- package/build/utils/aria/delegate.js +7 -0
- package/build/utils/behaviors/connected-promise-resolve.d.ts +8 -0
- package/build/utils/behaviors/connected-promise-resolve.d.ts.map +1 -0
- package/build/utils/behaviors/connected-promise-resolve.js +1 -0
- package/build/utils/behaviors/constraint-validation.d.ts +134 -0
- package/build/utils/behaviors/constraint-validation.d.ts.map +1 -0
- package/build/utils/behaviors/constraint-validation.js +6 -0
- package/build/utils/behaviors/element-internals.d.ts +46 -0
- package/build/utils/behaviors/element-internals.d.ts.map +1 -0
- package/build/utils/behaviors/element-internals.js +6 -0
- package/build/utils/behaviors/mixin.d.ts +55 -0
- package/build/utils/behaviors/mixin.d.ts.map +1 -0
- package/build/utils/behaviors/mixin.js +1 -0
- package/build/utils/behaviors/validators/checkbox-validator.d.ts +36 -0
- package/build/utils/behaviors/validators/checkbox-validator.d.ts.map +1 -0
- package/build/utils/behaviors/validators/checkbox-validator.js +6 -0
- package/build/utils/behaviors/validators/radio-validator.d.ts +39 -0
- package/build/utils/behaviors/validators/radio-validator.d.ts.map +1 -0
- package/build/utils/behaviors/validators/radio-validator.js +6 -0
- package/build/utils/behaviors/validators/select-validator.d.ts +36 -0
- package/build/utils/behaviors/validators/select-validator.d.ts.map +1 -0
- package/build/utils/behaviors/validators/select-validator.js +6 -0
- package/build/utils/behaviors/validators/text-field-validator.d.ts +111 -0
- package/build/utils/behaviors/validators/text-field-validator.d.ts.map +1 -0
- package/build/utils/behaviors/validators/text-field-validator.js +6 -0
- package/build/utils/behaviors/validators/validator.d.ts +97 -0
- package/build/utils/behaviors/validators/validator.d.ts.map +1 -0
- package/build/utils/behaviors/validators/validator.js +6 -0
- package/build/utils/controller/attachable-controller.d.ts +116 -0
- package/build/utils/controller/attachable-controller.d.ts.map +1 -0
- package/build/utils/controller/attachable-controller.js +9 -0
- package/build/utils/controller/form-submitter.d.ts +71 -0
- package/build/utils/controller/form-submitter.d.ts.map +1 -0
- package/build/utils/controller/form-submitter.js +6 -0
- package/build/utils/controller/selection-controller.d.ts +24 -0
- package/build/utils/controller/selection-controller.d.ts.map +1 -0
- package/build/utils/controller/selection-controller.js +1 -0
- package/build/utils/controller/single-selection-controller.d.ts +46 -0
- package/build/utils/controller/single-selection-controller.d.ts.map +1 -0
- package/build/utils/controller/single-selection-controller.js +6 -0
- package/build/utils/event/dispatch-hook.d.ts +86 -0
- package/build/utils/event/dispatch-hook.d.ts.map +1 -0
- package/build/utils/event/dispatch-hook.js +6 -0
- package/build/utils/event/form-label-activation.d.ts +56 -0
- package/build/utils/event/form-label-activation.d.ts.map +1 -0
- package/build/utils/event/form-label-activation.js +6 -0
- package/build/utils/event/redispatch-event.d.ts +28 -0
- package/build/utils/event/redispatch-event.d.ts.map +1 -0
- package/build/utils/event/redispatch-event.js +6 -0
- package/build/utils/form/form-associated.d.ts +200 -0
- package/build/utils/form/form-associated.d.ts.map +1 -0
- package/build/utils/form/form-associated.js +1 -0
- package/build/utils/string/to-kebab-case.d.ts +11 -0
- package/build/utils/string/to-kebab-case.d.ts.map +1 -0
- package/build/utils/string/to-kebab-case.js +6 -0
- package/build/utils/tokens/create-logic-shape-tokens.d.ts +14 -0
- package/build/utils/tokens/create-logic-shape-tokens.d.ts.map +1 -0
- package/build/utils/tokens/create-logic-shape-tokens.js +6 -0
- package/build/utils/tokens/create-var.d.ts +14 -0
- package/build/utils/tokens/create-var.d.ts.map +1 -0
- package/build/utils/tokens/create-var.js +6 -0
- package/build/utils/tokens/create-wrapped-tokens.d.ts +25 -0
- package/build/utils/tokens/create-wrapped-tokens.d.ts.map +1 -0
- package/build/utils/tokens/create-wrapped-tokens.js +6 -0
- package/build/utils/tokens/exclude-tokens.d.ts +7 -0
- package/build/utils/tokens/exclude-tokens.d.ts.map +1 -0
- package/build/utils/tokens/exclude-tokens.js +6 -0
- package/build/utils/tokens/index.d.ts +12 -0
- package/build/utils/tokens/index.d.ts.map +1 -0
- package/build/utils/tokens/index.js +1 -0
- package/build/utils/tokens/override-component-tokens.d.ts +34 -0
- package/build/utils/tokens/override-component-tokens.d.ts.map +1 -0
- package/build/utils/tokens/override-component-tokens.js +6 -0
- package/build/utils/tokens/string-tokens.d.ts +14 -0
- package/build/utils/tokens/string-tokens.d.ts.map +1 -0
- package/build/utils/tokens/string-tokens.js +6 -0
- package/build/utils/uuid/generate-uuid.d.ts +19 -0
- package/build/utils/uuid/generate-uuid.d.ts.map +1 -0
- package/build/utils/uuid/generate-uuid.js +6 -0
- package/build/utils.d.ts +3 -0
- package/build/utils.d.ts.map +1 -0
- package/build/utils.js +1 -0
- package/package.json +74 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*
|
|
6
|
+
* @link
|
|
7
|
+
* https://github.com/material-components/material-web/blob/main/internal/controller/attachable-controller.ts
|
|
8
|
+
*/
|
|
9
|
+
import { type ReactiveController, type ReactiveControllerHost } from 'lit';
|
|
10
|
+
/**
|
|
11
|
+
* An element that can be attached to an associated controlling element.
|
|
12
|
+
*/
|
|
13
|
+
export interface IAttachable {
|
|
14
|
+
/**
|
|
15
|
+
* Reflects the value of the `for` attribute, which is the ID of the element's
|
|
16
|
+
* associated control.
|
|
17
|
+
*
|
|
18
|
+
* Use this when the elements's associated control is not its parent.
|
|
19
|
+
*
|
|
20
|
+
* To manually control an element, set its `for` attribute to `""`.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```html
|
|
24
|
+
* <div class="container">
|
|
25
|
+
* <md-attachable for="interactive"></md-attachable>
|
|
26
|
+
* <button id="interactive">Action</button>
|
|
27
|
+
* </div>
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```html
|
|
32
|
+
* <button class="manually-controlled">
|
|
33
|
+
* <md-attachable for=""></md-attachable>
|
|
34
|
+
* </button>
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
htmlFor: string | null;
|
|
38
|
+
/**
|
|
39
|
+
* Gets or sets the element that controls the visibility of the attachable
|
|
40
|
+
* element. It is one of:
|
|
41
|
+
*
|
|
42
|
+
* - The control referenced by the `for` attribute.
|
|
43
|
+
* - The control provided to `element.attach(control)`
|
|
44
|
+
* - The element's parent.
|
|
45
|
+
* - `null` if the element is not controlled.
|
|
46
|
+
*/
|
|
47
|
+
control: HTMLElement | null;
|
|
48
|
+
/**
|
|
49
|
+
* Attaches the element to an interactive control.
|
|
50
|
+
*
|
|
51
|
+
* @param control The element that controls the attachable element.
|
|
52
|
+
*/
|
|
53
|
+
attach(control: HTMLElement): void;
|
|
54
|
+
/**
|
|
55
|
+
* Detaches the element from its current control.
|
|
56
|
+
*/
|
|
57
|
+
detach(): void;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* A key to retrieve an `IAttachable` element's `AttachableController` from a
|
|
61
|
+
* global `MutationObserver`.
|
|
62
|
+
*/
|
|
63
|
+
declare const ATTACHABLE_CONTROLLER: unique symbol;
|
|
64
|
+
/**
|
|
65
|
+
* The host of an `AttachableController`. The controller will add itself to
|
|
66
|
+
* the host so it can be retrieved in a global `MutationObserver`.
|
|
67
|
+
*/
|
|
68
|
+
export interface IAttachableControllerHost extends ReactiveControllerHost, HTMLElement {
|
|
69
|
+
[ATTACHABLE_CONTROLLER]?: AttachableController;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* A controller that provides an implementation for `IAttachable` elements.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* class MyElement extends LitElement implements IAttachable {
|
|
77
|
+
* get control() { return this.attachableController.control; }
|
|
78
|
+
*
|
|
79
|
+
* private readonly attachableController = new AttachableController(
|
|
80
|
+
* this,
|
|
81
|
+
* (previousControl, newControl) => {
|
|
82
|
+
* previousControl?.removeEventListener('click', this.handleClick);
|
|
83
|
+
* newControl?.addEventListener('click', this.handleClick);
|
|
84
|
+
* }
|
|
85
|
+
* );
|
|
86
|
+
*
|
|
87
|
+
* // Implement remaining `IAttachable` properties/methods that call the
|
|
88
|
+
* // controller's properties/methods.
|
|
89
|
+
* }
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
export declare class AttachableController implements ReactiveController, IAttachable {
|
|
93
|
+
private readonly host;
|
|
94
|
+
private readonly onControlChange;
|
|
95
|
+
get htmlFor(): string | null;
|
|
96
|
+
set htmlFor(htmlFor: string | null);
|
|
97
|
+
get control(): HTMLElement | null;
|
|
98
|
+
set control(control: HTMLElement | null);
|
|
99
|
+
private currentControl;
|
|
100
|
+
/**
|
|
101
|
+
* Creates a new controller for an `IAttachable` element.
|
|
102
|
+
*
|
|
103
|
+
* @param host The `IAttachable` element.
|
|
104
|
+
* @param onControlChange A callback with two parameters for the previous and
|
|
105
|
+
* next control. An `IAttachable` element may perform setup or teardown
|
|
106
|
+
* logic whenever the control changes.
|
|
107
|
+
*/
|
|
108
|
+
constructor(host: IAttachableControllerHost, onControlChange: (prev: HTMLElement | null, next: HTMLElement | null) => void);
|
|
109
|
+
attach(control: HTMLElement): void;
|
|
110
|
+
detach(): void;
|
|
111
|
+
hostConnected(): void;
|
|
112
|
+
hostDisconnected(): void;
|
|
113
|
+
private setCurrentControl;
|
|
114
|
+
}
|
|
115
|
+
export {};
|
|
116
|
+
//# sourceMappingURL=attachable-controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachable-controller.d.ts","sourceRoot":"","sources":["../../../src/utils/controller/attachable-controller.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAY,KAAK,kBAAkB,EAAE,KAAK,sBAAsB,EAAE,MAAM,KAAK,CAAC;AAErF;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvB;;;;;;;;OAQG;IACH,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAE5B;;;;OAIG;IACH,MAAM,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAEnC;;OAEG;IACH,MAAM,IAAI,IAAI,CAAC;CAClB;AAED;;;GAGG;AACH,QAAA,MAAM,qBAAqB,eAAiC,CAAC;AAE7D;;;GAGG;AACH,MAAM,WAAW,yBAA0B,SAAQ,sBAAsB,EAAE,WAAW;IAClF,CAAC,qBAAqB,CAAC,CAAC,EAAE,oBAAoB,CAAC;CAClD;AAqBD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,oBAAqB,YAAW,kBAAkB,EAAE,WAAW;IACxE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA2B;IAChD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAGvB;IAET,IAAW,OAAO,IAIU,MAAM,GAAG,IAAI,CAFxC;IAED,IAAW,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,EAMxC;IAED,IAAW,OAAO,IAaU,WAAW,GAAG,IAAI,CAD7C;IACD,IAAW,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,EAM7C;IAED,OAAO,CAAC,cAAc,CAA4B;IAElD;;;;;;;OAOG;gBAEC,IAAI,EAAE,yBAAyB,EAC/B,eAAe,EAAE,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI;IAU1E,MAAM,CAAC,OAAO,EAAE,WAAW;IAW3B,MAAM;IAON,aAAa;IAIb,gBAAgB;IAIvB,OAAO,CAAC,iBAAiB;CAI5B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import"../../lit-element-Ho-VPzO1.js";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2023 Google LLC
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
*
|
|
7
|
+
* @link
|
|
8
|
+
* https://github.com/material-components/material-web/blob/main/internal/controller/attachable-controller.ts
|
|
9
|
+
*/const t=Symbol("attachableController");let o;o=new MutationObserver(o=>{for(const r of o)r.target[t]?.hostConnected()});class r{get htmlFor(){return this.host.getAttribute("for")}set htmlFor(t){null===t?this.host.removeAttribute("for"):this.host.setAttribute("for",t)}get control(){return this.host.hasAttribute("for")?this.htmlFor&&this.host.isConnected?this.host.getRootNode().querySelector(`#${this.htmlFor}`):null:this.currentControl||this.host.parentElement}set control(t){t?this.attach(t):this.detach()}constructor(r,e){this.currentControl=null,this.host=r,this.onControlChange=e,r.addController(this),r[t]=this,o?.observe(r,{attributeFilter:["for"]})}attach(t){t!==this.currentControl&&(this.setCurrentControl(t),this.host.removeAttribute("for"))}detach(){this.setCurrentControl(null),this.host.setAttribute("for","")}hostConnected(){this.setCurrentControl(this.control)}hostDisconnected(){this.setCurrentControl(null)}setCurrentControl(t){this.onControlChange(this.currentControl,t),this.currentControl=t}}export{r as AttachableController};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { ReactiveElement } from 'lit';
|
|
7
|
+
import { type WithElementInternals } from '../behaviors/element-internals';
|
|
8
|
+
/**
|
|
9
|
+
* A string indicating the form submission behavior of the element.
|
|
10
|
+
*
|
|
11
|
+
* - submit: The element submits the form. This is the default value if the
|
|
12
|
+
* attribute is not specified, or if it is dynamically changed to an empty or
|
|
13
|
+
* invalid value.
|
|
14
|
+
* - reset: The element resets the form.
|
|
15
|
+
* - button: The element does nothing.
|
|
16
|
+
*/
|
|
17
|
+
export type FormSubmitterType = 'button' | 'submit' | 'reset';
|
|
18
|
+
/**
|
|
19
|
+
* An element that can submit or reset a `<form>`, similar to
|
|
20
|
+
* `<button type="submit">`.
|
|
21
|
+
*/
|
|
22
|
+
export interface FormSubmitter extends ReactiveElement, WithElementInternals {
|
|
23
|
+
/**
|
|
24
|
+
* A string indicating the form submission behavior of the element.
|
|
25
|
+
*
|
|
26
|
+
* - submit: The element submits the form. This is the default value if the
|
|
27
|
+
* attribute is not specified, or if it is dynamically changed to an empty or
|
|
28
|
+
* invalid value.
|
|
29
|
+
* - reset: The element resets the form.
|
|
30
|
+
* - button: The element does nothing.
|
|
31
|
+
*/
|
|
32
|
+
type: FormSubmitterType;
|
|
33
|
+
/**
|
|
34
|
+
* The HTML name to use in form submission. When combined with a `value`, the
|
|
35
|
+
* submitting button's name/value will be added to the form.
|
|
36
|
+
*
|
|
37
|
+
* Names must reflect to a `name` attribute for form integration.
|
|
38
|
+
*/
|
|
39
|
+
name: string;
|
|
40
|
+
/**
|
|
41
|
+
* The value of the button. When combined with a `name`, the submitting
|
|
42
|
+
* button's name/value will be added to the form.
|
|
43
|
+
*/
|
|
44
|
+
value: string;
|
|
45
|
+
}
|
|
46
|
+
type FormSubmitterConstructor = (new () => FormSubmitter) | (abstract new () => FormSubmitter);
|
|
47
|
+
/**
|
|
48
|
+
* Sets up an element's constructor to enable form submission. The element
|
|
49
|
+
* instance should be form associated and have a `type` property.
|
|
50
|
+
*
|
|
51
|
+
* A click listener is added to each element instance. If the click is not
|
|
52
|
+
* default prevented, it will submit the element's form, if any.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* class MyElement extends mixinElementInternals(LitElement) {
|
|
57
|
+
* static {
|
|
58
|
+
* setupFormSubmitter(MyElement);
|
|
59
|
+
* }
|
|
60
|
+
*
|
|
61
|
+
* static formAssociated = true;
|
|
62
|
+
*
|
|
63
|
+
* type: FormSubmitterType = 'submit';
|
|
64
|
+
* }
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* @param ctor The form submitter element's constructor.
|
|
68
|
+
*/
|
|
69
|
+
export declare function setupFormSubmitter(ctor: FormSubmitterConstructor): void;
|
|
70
|
+
export {};
|
|
71
|
+
//# sourceMappingURL=form-submitter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-submitter.d.ts","sourceRoot":"","sources":["../../../src/utils/controller/form-submitter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAY,eAAe,EAAE,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,KAAK,oBAAoB,EAAa,MAAM,gCAAgC,CAAA;AAErF;;;;;;;;GAQG;AACH,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAA;AAE7D;;;GAGG;AACH,MAAM,WAAW,aAAc,SAAQ,eAAe,EAAE,oBAAoB;IACxE;;;;;;;;OAQG;IACH,IAAI,EAAE,iBAAiB,CAAA;IAEvB;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAA;CAChB;AAED,KAAK,wBAAwB,GACvB,CAAC,UAAU,aAAa,CAAC,GACzB,CAAC,QAAQ,WAAW,aAAa,CAAC,CAAA;AAExC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,wBAAwB,QAgDhE"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import"../../lit-element-Ho-VPzO1.js";import{internals as e}from"../behaviors/element-internals.js";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2023 Google LLC
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
*/function t(t){t.addInitializer(t=>{const r=t;r.addEventListener("click",async t=>{const{type:n,[e]:i}=r,{form:s}=i;s&&"button"!==n&&(await new Promise(e=>{setTimeout(e)}),t.defaultPrevented||("reset"!==n?(s.addEventListener("submit",e=>{Object.defineProperty(e,"submitter",{configurable:!0,enumerable:!0,get:()=>r})},{capture:!0,once:!0}),i.setFormValue(r.value),s.requestSubmit()):s.reset()))})})}export{t as setupFormSubmitter};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
+
export type TSelectableElement = HTMLElement & {
|
|
3
|
+
checked: boolean;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export type TSelectionController = {};
|
|
7
|
+
export declare class SelectionController implements TSelectionController, ReactiveController {
|
|
8
|
+
private readonly host;
|
|
9
|
+
private root;
|
|
10
|
+
multiple: boolean;
|
|
11
|
+
constructor(host: TSelectableElement & ReactiveControllerHost, options?: Partial<{
|
|
12
|
+
multiple: boolean;
|
|
13
|
+
}>);
|
|
14
|
+
hostConnected(): void;
|
|
15
|
+
hostDisconnected(): void;
|
|
16
|
+
get controls(): Array<TSelectableElement>;
|
|
17
|
+
private updateTabIndices;
|
|
18
|
+
readonly handleCheckedChange: () => void;
|
|
19
|
+
readonly handleFocus: () => void;
|
|
20
|
+
readonly handleKeyDown: (e: KeyboardEvent) => void;
|
|
21
|
+
readonly focus: (control: TSelectableElement) => void;
|
|
22
|
+
readonly select: (control: TSelectableElement) => void;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=selection-controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection-controller.d.ts","sourceRoot":"","sources":["../../../src/utils/controller/selection-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,KAAK,CAAA;AAErE,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG;IAC3C,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,EAElC,CAAA;AAED,qBAAa,mBAAoB,YAAW,oBAAoB,EAAE,kBAAkB;IAEhF,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA6C;IAClE,OAAO,CAAC,IAAI,CAAqC;IAE1C,QAAQ,EAAE,OAAO,CAAQ;gBAG5B,IAAI,EAAE,kBAAkB,GAAG,sBAAsB,EACjD,OAAO,CAAC,EAAE,OAAO,CAAC;QACd,QAAQ,EAAE,OAAO,CAAA;KACpB,CAAC;IAYN,aAAa,IAAI,IAAI;IAkBd,gBAAgB;IAYvB,IAAW,QAAQ,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAK/C;IAED,OAAO,CAAC,gBAAgB;IAoBxB,SAAgB,mBAAmB,aASlC;IAED,SAAgB,WAAW,aAE1B;IAED,SAAgB,aAAa,GAAI,GAAG,aAAa,UAwChD;IAED,SAAgB,KAAK,GAAI,SAAS,kBAAkB,UAEnD;IAED,SAAgB,MAAM,GAAI,SAAS,kBAAkB,UASpD;CAEJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
class t{constructor(t,e){if(this.root=null,this.multiple=!1,this.handleCheckedChange=()=>{if(this.host.checked&&!this.multiple)for(const t of this.controls)t!==this.host&&(t.checked=!1)},this.handleFocus=()=>{this.updateTabIndices()},this.handleKeyDown=t=>{const{key:e}=t,s={isArrowKey:e.startsWith("Arrow"),isHomeEnd:"Home"===e||"End"===e,isActivationKey:" "===e,isVertical:"ArrowDown"===e||"ArrowUp"===e,isForward:"ArrowDown"===e||"ArrowRight"===e};if(!Object.values(s).includes(!0))return;const o=this.controls.filter(t=>!t?.disabled);if(t.preventDefault(),s.isActivationKey)return this.host.checked=!this.host.checked,void this.handleCheckedChange();const i=o.indexOf(this.host);let h=i;s.isArrowKey?h=s.isForward?(i+1)%o.length:(i-1+o.length)%o.length:s.isHomeEnd&&(h="Home"===e?0:o.length-1);const n=o[h];n&&(this.focus(n),this.select(n),this.updateTabIndices())},this.focus=t=>{t.focus()},this.select=t=>{this.multiple||t.checked||(t.checked=!0,this.handleCheckedChange())},this.host=t,e)for(const[t,s]of Object.entries(e))this[t]=s}hostConnected(){this.root=this.host.getRootNode(),this.host.addEventListener("keydown",this.handleKeyDown),this.host.addEventListener("focus",this.handleFocus),this.host.checked&&this.handleCheckedChange(),requestAnimationFrame(()=>{this.updateTabIndices()})}hostDisconnected(){this.host.removeEventListener("keydown",this.handleKeyDown),this.host.removeEventListener("focus",this.handleFocus),this.root=null,requestAnimationFrame(()=>{this.updateTabIndices()})}get controls(){const t=this.host.getAttribute("name");if(!t||!this.root||!this.host.isConnected)return[this.host];const e=this.root.querySelectorAll(`[name="${t}"]`);return Array.from(e)}updateTabIndices(){const t=this.controls,e=t.find(t=>t.checked),s=this.root?.activeElement,o=t.includes(s)?s:e??t.find(t=>!t?.disabled);for(const e of t)e.tabIndex=e===o?0:-1}}export{t as SelectionController};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Kai-Orion & Sandlada
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
import { type ReactiveController } from 'lit';
|
|
7
|
+
export interface ISingleSelectionElement extends HTMLElement {
|
|
8
|
+
checked: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface ISingleSelectionController {
|
|
11
|
+
controls: [ISingleSelectionElement, ...Array<ISingleSelectionElement>];
|
|
12
|
+
handleCheckedChange: () => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated
|
|
16
|
+
* Because the "single selection" operation logic of SingleSelectionController
|
|
17
|
+
* has limitations, please use SelectionController instead.
|
|
18
|
+
*/
|
|
19
|
+
export declare class SingleSelectionController implements ReactiveController, ISingleSelectionController {
|
|
20
|
+
get controls(): [ISingleSelectionElement, ...Array<ISingleSelectionElement>];
|
|
21
|
+
private focused;
|
|
22
|
+
private root;
|
|
23
|
+
private readonly host;
|
|
24
|
+
constructor(host: ISingleSelectionElement);
|
|
25
|
+
hostConnected(): void;
|
|
26
|
+
hostDisconnected(): void;
|
|
27
|
+
/**
|
|
28
|
+
* Should be called whenever the host's `checked` property changes
|
|
29
|
+
* synchronously.
|
|
30
|
+
*/
|
|
31
|
+
handleCheckedChange(): void;
|
|
32
|
+
private readonly handleFocusIn;
|
|
33
|
+
private readonly handleFocusOut;
|
|
34
|
+
private uncheckSiblings;
|
|
35
|
+
/**
|
|
36
|
+
* Updates the `tabindex` of the host and its siblings.
|
|
37
|
+
*/
|
|
38
|
+
private updateTabIndices;
|
|
39
|
+
/**
|
|
40
|
+
* Handles arrow key events from the host. Using the arrow keys will
|
|
41
|
+
* select and check the next or previous sibling with the host's
|
|
42
|
+
* `name` attribute.
|
|
43
|
+
*/
|
|
44
|
+
private readonly handleKeyDown;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=single-selection-controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"single-selection-controller.d.ts","sourceRoot":"","sources":["../../../src/utils/controller/single-selection-controller.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,KAAK,CAAA;AAG7C,MAAM,WAAW,uBAAwB,SAAQ,WAAW;IACxD,OAAO,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,0BAA0B;IACvC,QAAQ,EAAE,CAAC,uBAAuB,EAAE,GAAG,KAAK,CAAC,uBAAuB,CAAC,CAAC,CAAA;IACtE,mBAAmB,EAAE,MAAM,IAAI,CAAA;CAClC;AAED;;;;GAIG;AACH,qBAAa,yBAA0B,YAAW,kBAAkB,EAAE,0BAA0B;IAE5F,IAAW,QAAQ,IAAI,CAAC,uBAAuB,EAAE,GAAG,KAAK,CAAC,uBAAuB,CAAC,CAAC,CAOlF;IAED,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,IAAI,CAA0B;IACtC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAyB;gBAElC,IAAI,EAAE,uBAAuB;IAIlC,aAAa;IAeb,gBAAgB;IASvB;;;OAGG;IACI,mBAAmB;IAS1B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAG7B;IAED,OAAO,CAAC,QAAQ,CAAC,cAAc,CAG9B;IAED,OAAO,CAAC,eAAe;IAQvB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAwBxB;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,aAAa,CAqE7B;CACJ"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import"../../lit-element-Ho-VPzO1.js";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2025 Kai-Orion & Sandlada
|
|
5
|
+
* SPDX-License-Identifier: MIT
|
|
6
|
+
*/class t{get controls(){const t=this.host.getAttribute("name");return t&&this.root&&this.host.isConnected?Array.from(this.root.querySelectorAll(`[name="${t}"]`)):[this.host]}constructor(t){this.focused=!1,this.root=null,this.handleFocusIn=()=>{this.focused=!0,this.updateTabIndices()},this.handleFocusOut=()=>{this.focused=!1,this.updateTabIndices()},this.handleKeyDown=t=>{const e="ArrowDown"===t.key,s="ArrowUp"===t.key,o="ArrowLeft"===t.key,h="ArrowRight"===t.key;if(!(o||h||e||s))return;const n=this.controls;if(!n.length)return;t.preventDefault();const i="rtl"===getComputedStyle(this.host).direction?o||e:h||e,c=n.indexOf(this.host);let d=i?c+1:c-1;for(;d!==c;){d>=n.length?d=0:d<0&&(d=n.length-1);const t=n[d];if(!t.hasAttribute("disabled")){for(const e of n)e!==t&&(e.tabIndex=-1,e.blur());t.checked=!0,t.tabIndex=0,t.focus();break}i?d++:d--}},this.host=t}hostConnected(){this.root=this.host.getRootNode(),this.host.addEventListener("keydown",this.handleKeyDown),this.host.addEventListener("focusin",this.handleFocusIn),this.host.addEventListener("focusout",this.handleFocusOut),this.host.checked&&this.uncheckSiblings(),this.updateTabIndices()}hostDisconnected(){this.host.removeEventListener("keydown",this.handleKeyDown),this.host.removeEventListener("focusin",this.handleFocusIn),this.host.removeEventListener("focusout",this.handleFocusOut),this.updateTabIndices(),this.root=null}handleCheckedChange(){this.host.checked&&(this.uncheckSiblings(),this.updateTabIndices())}uncheckSiblings(){for(const t of this.controls)t!==this.host&&(t.checked=!1)}updateTabIndices(){const t=this.controls,e=t.find(t=>t.checked);if(e||this.focused){const s=e||this.host;s.tabIndex=0;for(const e of t)e!==s&&(e.tabIndex=-1);return}for(const e of t)e.tabIndex=0}}export{t as SingleSelectionController};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Add a hook for an event that is called after the event is dispatched and
|
|
8
|
+
* propagates to other event listeners.
|
|
9
|
+
*
|
|
10
|
+
* This is useful for behaviors that need to check if an event is canceled.
|
|
11
|
+
*
|
|
12
|
+
* The callback is invoked synchronously, which allows for better integration
|
|
13
|
+
* with synchronous platform APIs (like `<form>` or `<label>` clicking).
|
|
14
|
+
*
|
|
15
|
+
* Note: `setupDispatchHooks()` must be called on the element before adding any
|
|
16
|
+
* other event listeners. Call it in the constructor of an element or
|
|
17
|
+
* controller.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* class MyControl extends LitElement {
|
|
22
|
+
* constructor() {
|
|
23
|
+
* super();
|
|
24
|
+
* setupDispatchHooks(this, 'click');
|
|
25
|
+
* this.addEventListener('click', event => {
|
|
26
|
+
* afterDispatch(event, () => {
|
|
27
|
+
* if (event.defaultPrevented) {
|
|
28
|
+
* return
|
|
29
|
+
* }
|
|
30
|
+
*
|
|
31
|
+
* // ... perform logic
|
|
32
|
+
* });
|
|
33
|
+
* });
|
|
34
|
+
* }
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* class MyController implements ReactiveController {
|
|
41
|
+
* constructor(host: ReactiveElement) {
|
|
42
|
+
* // setupDispatchHooks() may be called multiple times for the same
|
|
43
|
+
* // element and events, making it safe for multiple controllers to use it.
|
|
44
|
+
* setupDispatchHooks(host, 'click');
|
|
45
|
+
* host.addEventListener('click', event => {
|
|
46
|
+
* afterDispatch(event, () => {
|
|
47
|
+
* if (event.defaultPrevented) {
|
|
48
|
+
* return;
|
|
49
|
+
* }
|
|
50
|
+
*
|
|
51
|
+
* // ... perform logic
|
|
52
|
+
* });
|
|
53
|
+
* });
|
|
54
|
+
* }
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @param event The event to add a hook to.
|
|
59
|
+
* @param callback A hook that is called after the event finishes dispatching.
|
|
60
|
+
*/
|
|
61
|
+
export declare function afterDispatch(event: Event, callback: () => void): void;
|
|
62
|
+
/**
|
|
63
|
+
* Sets up an element to add dispatch hooks to given event types. This must be
|
|
64
|
+
* called before adding any event listeners that need to use dispatch hooks
|
|
65
|
+
* like `afterDispatch()`.
|
|
66
|
+
*
|
|
67
|
+
* This function is safe to call multiple times with the same element or event
|
|
68
|
+
* types. Call it in the constructor of elements, mixins, and controllers to
|
|
69
|
+
* ensure it is set up before external listeners.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* class MyControl extends LitElement {
|
|
74
|
+
* constructor() {
|
|
75
|
+
* super();
|
|
76
|
+
* setupDispatchHooks(this, 'click');
|
|
77
|
+
* this.addEventListener('click', this.listenerUsingAfterDispatch);
|
|
78
|
+
* }
|
|
79
|
+
* }
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* @param element The element to set up event dispatch hooks for.
|
|
83
|
+
* @param eventTypes The event types to add dispatch hooks to.
|
|
84
|
+
*/
|
|
85
|
+
export declare function setupDispatchHooks(element: Element, ...eventTypes: [string, ...string[]]): void;
|
|
86
|
+
//# sourceMappingURL=dispatch-hook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatch-hook.d.ts","sourceRoot":"","sources":["../../../src/utils/event/dispatch-hook.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAcH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,IAAI,QAO/D;AASD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,EAChB,GAAG,UAAU,EAAE,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,QA6DrC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
const t=Symbol("dispatchHooks");function e(e,n){const o=e[t];if(!o)throw new Error(`'${e.type}' event needs setupDispatchHooks().`);o.addEventListener("after",n)}const n=new WeakMap;function o(e,...o){let s=n.get(e);s||(s=new Set,n.set(e,s));for(const n of o){if(s.has(n))continue;let o=!1;e.addEventListener(n,n=>{if(o)return;n.stopImmediatePropagation();const s=Reflect.construct(n.constructor,[n.type,n]),c=new EventTarget;s[t]=c,o=!0;const r=e.dispatchEvent(s);o=!1,r||n.preventDefault(),c.dispatchEvent(new Event("after"))},{capture:!0}),s.add(n)}}export{e as afterDispatch,o as setupDispatchHooks};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Dispatches a click event to the given element that triggers a native action,
|
|
8
|
+
* but is not composed and therefore is not seen outside the element.
|
|
9
|
+
*
|
|
10
|
+
* This is useful for responding to an external click event on the host element
|
|
11
|
+
* that should trigger an internal action like a button click.
|
|
12
|
+
*
|
|
13
|
+
* Note, a helper is provided because setting this up correctly is a bit tricky.
|
|
14
|
+
* In particular, calling `click` on an element creates a composed event, which
|
|
15
|
+
* is not desirable, and a manually dispatched event must specifically be a
|
|
16
|
+
* `MouseEvent` to trigger a native action.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* hostClickListener = (event: MouseEvent) {
|
|
20
|
+
* if (isActivationClick(event)) {
|
|
21
|
+
* this.dispatchActivationClick(this.buttonElement);
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
export declare function dispatchActivationClick(element: HTMLElement): MouseEvent;
|
|
27
|
+
/**
|
|
28
|
+
* Returns true if the click event should trigger an activation behavior. The
|
|
29
|
+
* behavior is defined by the element and is whatever it should do when
|
|
30
|
+
* clicked.
|
|
31
|
+
*
|
|
32
|
+
* Typically when an element needs to handle a click, the click is generated
|
|
33
|
+
* from within the element and an event listener within the element implements
|
|
34
|
+
* the needed behavior; however, it's possible to fire a click directly
|
|
35
|
+
* at the element that the element should handle. This method helps
|
|
36
|
+
* distinguish these "external" clicks.
|
|
37
|
+
*
|
|
38
|
+
* An "external" click can be triggered in a number of ways: via a click
|
|
39
|
+
* on an associated label for a form associated element, calling
|
|
40
|
+
* `element.click()`, or calling
|
|
41
|
+
* `element.dispatchEvent(new MouseEvent('click', ...))`.
|
|
42
|
+
*
|
|
43
|
+
* Also works around Firefox issue
|
|
44
|
+
* https://bugzilla.mozilla.org/show_bug.cgi?id=1804576 by squelching
|
|
45
|
+
* events for a microtask after called.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* hostClickListener = (event: MouseEvent) {
|
|
49
|
+
* if (isActivationClick(event)) {
|
|
50
|
+
* this.dispatchActivationClick(this.buttonElement);
|
|
51
|
+
* }
|
|
52
|
+
* }
|
|
53
|
+
*
|
|
54
|
+
*/
|
|
55
|
+
export declare function isActivationClick(event: Event): boolean;
|
|
56
|
+
//# sourceMappingURL=form-label-activation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-label-activation.d.ts","sourceRoot":"","sources":["../../../src/utils/event/form-label-activation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,WAAW,cAI3D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,WAgB7C"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
function t(t){const e=new MouseEvent("click",{bubbles:!0});return t.dispatchEvent(e),e}function e(t){return t.currentTarget===t.target&&(t.composedPath()[0]===t.target&&(!t.target.disabled&&!function(t){const e=n;e&&(t.preventDefault(),t.stopImmediatePropagation());return async function(){n=!0,await null,n=!1}(),e}(t)))}let n=!1;export{t as dispatchActivationClick,e as isActivationClick};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Re-dispatches an event from the provided element.
|
|
8
|
+
*
|
|
9
|
+
* This function is useful for forwarding non-composed events, such as `change`
|
|
10
|
+
* events.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* class MyInput extends LitElement {
|
|
14
|
+
* render() {
|
|
15
|
+
* return html`<input @change=${this.redispatchEvent}>`;
|
|
16
|
+
* }
|
|
17
|
+
*
|
|
18
|
+
* protected redispatchEvent(event: Event) {
|
|
19
|
+
* redispatchEvent(this, event);
|
|
20
|
+
* }
|
|
21
|
+
* }
|
|
22
|
+
*
|
|
23
|
+
* @param element The element to dispatch the event from.
|
|
24
|
+
* @param event The event to re-dispatch.
|
|
25
|
+
* @return Whether or not the event was dispatched (if cancelable).
|
|
26
|
+
*/
|
|
27
|
+
export declare function redispatchEvent(element: Element, event: Event): boolean;
|
|
28
|
+
//# sourceMappingURL=redispatch-event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redispatch-event.d.ts","sourceRoot":"","sources":["../../../src/utils/event/redispatch-event.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,WAkB7D"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
function t(t,o){!o.bubbles||t.shadowRoot&&!o.composed||o.stopPropagation();const e=new o.constructor(o.type,o),n=!t.dispatchEvent(e);return n&&o.preventDefault(),n}export{t as redispatchEvent};
|