@adobe/spectrum-wc-core 0.0.0-snapshot.20260922095923
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 +39 -0
- package/dist/_virtual/_@oxc-project_runtime@0.124.0/helpers/decorate.js +9 -0
- package/dist/components/accordion/Accordion.base.d.ts +59 -0
- package/dist/components/accordion/Accordion.base.js +69 -0
- package/dist/components/accordion/Accordion.base.js.map +1 -0
- package/dist/components/accordion/Accordion.types.d.ts +22 -0
- package/dist/components/accordion/Accordion.types.js +21 -0
- package/dist/components/accordion/Accordion.types.js.map +1 -0
- package/dist/components/accordion/AccordionItem.base.d.ts +96 -0
- package/dist/components/accordion/AccordionItem.base.js +93 -0
- package/dist/components/accordion/AccordionItem.base.js.map +1 -0
- package/dist/components/accordion/index.d.ts +14 -0
- package/dist/components/accordion/index.js +4 -0
- package/dist/components/action-button/ActionButton.types.d.ts +15 -0
- package/dist/components/action-button/ActionButton.types.js +12 -0
- package/dist/components/action-button/ActionButton.types.js.map +1 -0
- package/dist/components/action-button/index.d.ts +12 -0
- package/dist/components/action-button/index.js +2 -0
- package/dist/components/action-group/ActionGroup.base.d.ts +108 -0
- package/dist/components/action-group/ActionGroup.base.js +53 -0
- package/dist/components/action-group/ActionGroup.base.js.map +1 -0
- package/dist/components/action-group/ActionGroup.types.d.ts +17 -0
- package/dist/components/action-group/ActionGroup.types.js +12 -0
- package/dist/components/action-group/ActionGroup.types.js.map +1 -0
- package/dist/components/action-group/index.d.ts +13 -0
- package/dist/components/action-group/index.js +3 -0
- package/dist/components/alert-banner/AlertBanner.base.d.ts +36 -0
- package/dist/components/alert-banner/AlertBanner.base.js +57 -0
- package/dist/components/alert-banner/AlertBanner.base.js.map +1 -0
- package/dist/components/alert-banner/AlertBanner.types.d.ts +13 -0
- package/dist/components/alert-banner/AlertBanner.types.js +10 -0
- package/dist/components/alert-banner/AlertBanner.types.js.map +1 -0
- package/dist/components/alert-banner/index.d.ts +13 -0
- package/dist/components/alert-banner/index.js +3 -0
- package/dist/components/asset/Asset.base.d.ts +101 -0
- package/dist/components/asset/Asset.base.js +130 -0
- package/dist/components/asset/Asset.base.js.map +1 -0
- package/dist/components/asset/Asset.types.d.ts +31 -0
- package/dist/components/asset/Asset.types.js +14 -0
- package/dist/components/asset/Asset.types.js.map +1 -0
- package/dist/components/asset/index.d.ts +13 -0
- package/dist/components/asset/index.js +3 -0
- package/dist/components/avatar/Avatar.base.d.ts +53 -0
- package/dist/components/avatar/Avatar.base.js +52 -0
- package/dist/components/avatar/Avatar.base.js.map +1 -0
- package/dist/components/avatar/Avatar.types.d.ts +19 -0
- package/dist/components/avatar/Avatar.types.js +24 -0
- package/dist/components/avatar/Avatar.types.js.map +1 -0
- package/dist/components/avatar/index.d.ts +13 -0
- package/dist/components/avatar/index.js +3 -0
- package/dist/components/badge/Badge.base.d.ts +114 -0
- package/dist/components/badge/Badge.base.js +49 -0
- package/dist/components/badge/Badge.base.js.map +1 -0
- package/dist/components/badge/Badge.types.d.ts +21 -0
- package/dist/components/badge/Badge.types.js +43 -0
- package/dist/components/badge/Badge.types.js.map +1 -0
- package/dist/components/badge/index.d.ts +13 -0
- package/dist/components/badge/index.js +3 -0
- package/dist/components/button/Button.base.d.ts +78 -0
- package/dist/components/button/Button.base.js +51 -0
- package/dist/components/button/Button.base.js.map +1 -0
- package/dist/components/button/Button.types.d.ts +19 -0
- package/dist/components/button/Button.types.js +16 -0
- package/dist/components/button/Button.types.js.map +1 -0
- package/dist/components/button/index.d.ts +13 -0
- package/dist/components/button/index.js +3 -0
- package/dist/components/button-group/ButtonGroup.base.d.ts +89 -0
- package/dist/components/button-group/ButtonGroup.base.js +60 -0
- package/dist/components/button-group/ButtonGroup.base.js.map +1 -0
- package/dist/components/button-group/ButtonGroup.types.d.ts +17 -0
- package/dist/components/button-group/ButtonGroup.types.js +15 -0
- package/dist/components/button-group/ButtonGroup.types.js.map +1 -0
- package/dist/components/button-group/index.d.ts +13 -0
- package/dist/components/button-group/index.js +3 -0
- package/dist/components/card/Card.base.d.ts +172 -0
- package/dist/components/card/Card.base.js +123 -0
- package/dist/components/card/Card.base.js.map +1 -0
- package/dist/components/card/Card.types.d.ts +18 -0
- package/dist/components/card/Card.types.js +21 -0
- package/dist/components/card/Card.types.js.map +1 -0
- package/dist/components/card/index.d.ts +13 -0
- package/dist/components/card/index.js +3 -0
- package/dist/components/color-handle/ColorHandle.base.d.ts +51 -0
- package/dist/components/color-handle/ColorHandle.base.js +39 -0
- package/dist/components/color-handle/ColorHandle.base.js.map +1 -0
- package/dist/components/color-handle/ColorHandle.types.d.ts +30 -0
- package/dist/components/color-handle/color-contrast.d.ts +55 -0
- package/dist/components/color-handle/color-contrast.js +49 -0
- package/dist/components/color-handle/color-contrast.js.map +1 -0
- package/dist/components/color-handle/index.d.ts +14 -0
- package/dist/components/color-handle/index.js +3 -0
- package/dist/components/color-loupe/ColorLoupe.base.d.ts +41 -0
- package/dist/components/color-loupe/ColorLoupe.base.js +21 -0
- package/dist/components/color-loupe/ColorLoupe.base.js.map +1 -0
- package/dist/components/color-loupe/index.d.ts +12 -0
- package/dist/components/color-loupe/index.js +2 -0
- package/dist/components/divider/Divider.base.d.ts +43 -0
- package/dist/components/divider/Divider.base.js +42 -0
- package/dist/components/divider/Divider.base.js.map +1 -0
- package/dist/components/divider/Divider.types.d.ts +15 -0
- package/dist/components/divider/Divider.types.js +10 -0
- package/dist/components/divider/Divider.types.js.map +1 -0
- package/dist/components/divider/index.d.ts +13 -0
- package/dist/components/divider/index.js +3 -0
- package/dist/components/dropzone/Dropzone.base.d.ts +74 -0
- package/dist/components/dropzone/Dropzone.base.js +82 -0
- package/dist/components/dropzone/Dropzone.base.js.map +1 -0
- package/dist/components/dropzone/Dropzone.types.d.ts +43 -0
- package/dist/components/dropzone/Dropzone.types.js +15 -0
- package/dist/components/dropzone/Dropzone.types.js.map +1 -0
- package/dist/components/dropzone/index.d.ts +13 -0
- package/dist/components/dropzone/index.js +3 -0
- package/dist/components/icon/Icon.base.d.ts +36 -0
- package/dist/components/icon/Icon.base.js +28 -0
- package/dist/components/icon/Icon.base.js.map +1 -0
- package/dist/components/icon/Icon.types.d.ts +13 -0
- package/dist/components/icon/Icon.types.js +12 -0
- package/dist/components/icon/Icon.types.js.map +1 -0
- package/dist/components/icon/index.d.ts +13 -0
- package/dist/components/icon/index.js +3 -0
- package/dist/components/illustrated-message/IllustratedMessage.base.d.ts +60 -0
- package/dist/components/illustrated-message/IllustratedMessage.base.js +59 -0
- package/dist/components/illustrated-message/IllustratedMessage.base.js.map +1 -0
- package/dist/components/illustrated-message/IllustratedMessage.types.d.ts +15 -0
- package/dist/components/illustrated-message/IllustratedMessage.types.js +10 -0
- package/dist/components/illustrated-message/IllustratedMessage.types.js.map +1 -0
- package/dist/components/illustrated-message/index.d.ts +13 -0
- package/dist/components/illustrated-message/index.js +3 -0
- package/dist/components/infield-button/InfieldButton.base.d.ts +28 -0
- package/dist/components/infield-button/InfieldButton.base.js +22 -0
- package/dist/components/infield-button/InfieldButton.base.js.map +1 -0
- package/dist/components/infield-button/InfieldButton.types.d.ts +13 -0
- package/dist/components/infield-button/InfieldButton.types.js +11 -0
- package/dist/components/infield-button/InfieldButton.types.js.map +1 -0
- package/dist/components/infield-button/index.d.ts +13 -0
- package/dist/components/infield-button/index.js +3 -0
- package/dist/components/meter/Meter.base.d.ts +40 -0
- package/dist/components/meter/Meter.base.js +32 -0
- package/dist/components/meter/Meter.base.js.map +1 -0
- package/dist/components/meter/Meter.types.d.ts +13 -0
- package/dist/components/meter/Meter.types.js +11 -0
- package/dist/components/meter/Meter.types.js.map +1 -0
- package/dist/components/meter/index.d.ts +13 -0
- package/dist/components/meter/index.js +3 -0
- package/dist/components/popover/Popover.base.d.ts +226 -0
- package/dist/components/popover/Popover.base.js +287 -0
- package/dist/components/popover/Popover.base.js.map +1 -0
- package/dist/components/popover/Popover.types.d.ts +39 -0
- package/dist/components/popover/Popover.types.js +24 -0
- package/dist/components/popover/Popover.types.js.map +1 -0
- package/dist/components/popover/index.d.ts +13 -0
- package/dist/components/popover/index.js +3 -0
- package/dist/components/progress-bar/ProgressBar.base.d.ts +34 -0
- package/dist/components/progress-bar/ProgressBar.base.js +21 -0
- package/dist/components/progress-bar/ProgressBar.base.js.map +1 -0
- package/dist/components/progress-bar/ProgressBar.types.d.ts +12 -0
- package/dist/components/progress-bar/index.d.ts +13 -0
- package/dist/components/progress-bar/index.js +2 -0
- package/dist/components/progress-circle/ProgressCircle.base.d.ts +83 -0
- package/dist/components/progress-circle/ProgressCircle.base.js +77 -0
- package/dist/components/progress-circle/ProgressCircle.base.js.map +1 -0
- package/dist/components/progress-circle/ProgressCircle.types.d.ts +15 -0
- package/dist/components/progress-circle/ProgressCircle.types.js +10 -0
- package/dist/components/progress-circle/ProgressCircle.types.js.map +1 -0
- package/dist/components/progress-circle/index.d.ts +13 -0
- package/dist/components/progress-circle/index.js +3 -0
- package/dist/components/status-light/StatusLight.base.d.ts +69 -0
- package/dist/components/status-light/StatusLight.base.js +32 -0
- package/dist/components/status-light/StatusLight.base.js.map +1 -0
- package/dist/components/status-light/StatusLight.types.d.ts +19 -0
- package/dist/components/status-light/StatusLight.types.js +32 -0
- package/dist/components/status-light/StatusLight.types.js.map +1 -0
- package/dist/components/status-light/index.d.ts +13 -0
- package/dist/components/status-light/index.js +3 -0
- package/dist/components/tabs/Tab.base.d.ts +49 -0
- package/dist/components/tabs/Tab.base.js +39 -0
- package/dist/components/tabs/Tab.base.js.map +1 -0
- package/dist/components/tabs/Tab.types.d.ts +17 -0
- package/dist/components/tabs/TabPanel.base.d.ts +49 -0
- package/dist/components/tabs/TabPanel.base.js +36 -0
- package/dist/components/tabs/TabPanel.base.js.map +1 -0
- package/dist/components/tabs/TabPanel.types.d.ts +17 -0
- package/dist/components/tabs/Tabs.base.d.ts +221 -0
- package/dist/components/tabs/Tabs.base.js +213 -0
- package/dist/components/tabs/Tabs.base.js.map +1 -0
- package/dist/components/tabs/Tabs.types.d.ts +55 -0
- package/dist/components/tabs/Tabs.types.js +6 -0
- package/dist/components/tabs/Tabs.types.js.map +1 -0
- package/dist/components/tabs/index.d.ts +17 -0
- package/dist/components/tabs/index.js +5 -0
- package/dist/components/tooltip/Tooltip.base.d.ts +159 -0
- package/dist/components/tooltip/Tooltip.base.js +198 -0
- package/dist/components/tooltip/Tooltip.base.js.map +1 -0
- package/dist/components/tooltip/Tooltip.types.d.ts +18 -0
- package/dist/components/tooltip/Tooltip.types.js +15 -0
- package/dist/components/tooltip/Tooltip.types.js.map +1 -0
- package/dist/components/tooltip/index.d.ts +13 -0
- package/dist/components/tooltip/index.js +3 -0
- package/dist/controllers/color-controller/index.d.ts +12 -0
- package/dist/controllers/color-controller/index.js +2 -0
- package/dist/controllers/color-controller/src/color-controller.d.ts +226 -0
- package/dist/controllers/color-controller/src/color-controller.js +253 -0
- package/dist/controllers/color-controller/src/color-controller.js.map +1 -0
- package/dist/controllers/drag-and-drop-controller/index.d.ts +12 -0
- package/dist/controllers/drag-and-drop-controller/index.js +2 -0
- package/dist/controllers/drag-and-drop-controller/src/drag-and-drop-controller.d.ts +68 -0
- package/dist/controllers/drag-and-drop-controller/src/drag-and-drop-controller.js +56 -0
- package/dist/controllers/drag-and-drop-controller/src/drag-and-drop-controller.js.map +1 -0
- package/dist/controllers/focusgroup-navigation-controller/index.d.ts +12 -0
- package/dist/controllers/focusgroup-navigation-controller/index.js +2 -0
- package/dist/controllers/focusgroup-navigation-controller/src/focusgroup-navigation-controller.d.ts +496 -0
- package/dist/controllers/focusgroup-navigation-controller/src/focusgroup-navigation-controller.js +345 -0
- package/dist/controllers/focusgroup-navigation-controller/src/focusgroup-navigation-controller.js.map +1 -0
- package/dist/controllers/hover-controller/index.d.ts +12 -0
- package/dist/controllers/hover-controller/index.js +2 -0
- package/dist/controllers/hover-controller/src/hover-controller.d.ts +118 -0
- package/dist/controllers/hover-controller/src/hover-controller.js +90 -0
- package/dist/controllers/hover-controller/src/hover-controller.js.map +1 -0
- package/dist/controllers/index.d.ts +26 -0
- package/dist/controllers/index.js +18 -0
- package/dist/controllers/language-resolution.d.ts +87 -0
- package/dist/controllers/language-resolution.js +56 -0
- package/dist/controllers/language-resolution.js.map +1 -0
- package/dist/controllers/live-selection-controller/index.d.ts +12 -0
- package/dist/controllers/live-selection-controller/index.js +2 -0
- package/dist/controllers/live-selection-controller/src/live-selection-controller.d.ts +144 -0
- package/dist/controllers/live-selection-controller/src/live-selection-controller.js +36 -0
- package/dist/controllers/live-selection-controller/src/live-selection-controller.js.map +1 -0
- package/dist/controllers/page-scroll-lock-controller/index.d.ts +12 -0
- package/dist/controllers/page-scroll-lock-controller/index.js +2 -0
- package/dist/controllers/page-scroll-lock-controller/src/page-scroll-lock.d.ts +20 -0
- package/dist/controllers/page-scroll-lock-controller/src/page-scroll-lock.js +30 -0
- package/dist/controllers/page-scroll-lock-controller/src/page-scroll-lock.js.map +1 -0
- package/dist/controllers/pending-controller/index.d.ts +12 -0
- package/dist/controllers/pending-controller/index.js +2 -0
- package/dist/controllers/pending-controller/src/pending-controller.d.ts +95 -0
- package/dist/controllers/pending-controller/src/pending-controller.js +55 -0
- package/dist/controllers/pending-controller/src/pending-controller.js.map +1 -0
- package/dist/controllers/placement-controller/index.d.ts +12 -0
- package/dist/controllers/placement-controller/index.js +4 -0
- package/dist/controllers/placement-controller/src/fallback-placements.d.ts +9 -0
- package/dist/controllers/placement-controller/src/fallback-placements.js +71 -0
- package/dist/controllers/placement-controller/src/fallback-placements.js.map +1 -0
- package/dist/controllers/placement-controller/src/placement-controller.d.ts +152 -0
- package/dist/controllers/placement-controller/src/placement-controller.js +129 -0
- package/dist/controllers/placement-controller/src/placement-controller.js.map +1 -0
- package/dist/controllers/placement-controller/src/placement-conversion.d.ts +35 -0
- package/dist/controllers/placement-controller/src/placement-conversion.js +54 -0
- package/dist/controllers/placement-controller/src/placement-conversion.js.map +1 -0
- package/dist/controllers/placement-controller/src/types.d.ts +128 -0
- package/dist/controllers/placement-controller/src/types.js +29 -0
- package/dist/controllers/placement-controller/src/types.js.map +1 -0
- package/dist/controllers/slot-attribute-propagation-controller/index.d.ts +12 -0
- package/dist/controllers/slot-attribute-propagation-controller/index.js +2 -0
- package/dist/controllers/slot-attribute-propagation-controller/src/slot-attribute-propagation-controller.d.ts +65 -0
- package/dist/controllers/slot-attribute-propagation-controller/src/slot-attribute-propagation-controller.js +33 -0
- package/dist/controllers/slot-attribute-propagation-controller/src/slot-attribute-propagation-controller.js.map +1 -0
- package/dist/controllers/slot-presence-controller/index.d.ts +12 -0
- package/dist/controllers/slot-presence-controller/index.js +2 -0
- package/dist/controllers/slot-presence-controller/src/slot-presence-controller.d.ts +57 -0
- package/dist/controllers/slot-presence-controller/src/slot-presence-controller.js +44 -0
- package/dist/controllers/slot-presence-controller/src/slot-presence-controller.js.map +1 -0
- package/dist/controllers/slot-text-controller/index.d.ts +12 -0
- package/dist/controllers/slot-text-controller/index.js +2 -0
- package/dist/controllers/slot-text-controller/src/slot-text-controller.d.ts +92 -0
- package/dist/controllers/slot-text-controller/src/slot-text-controller.js +53 -0
- package/dist/controllers/slot-text-controller/src/slot-text-controller.js.map +1 -0
- package/dist/directives/index.d.ts +15 -0
- package/dist/directives/index.js +3 -0
- package/dist/directives/pending-spinner/index.d.ts +12 -0
- package/dist/directives/pending-spinner/index.js +1 -0
- package/dist/directives/pending-spinner/src/pending-spinner.d.ts +22 -0
- package/dist/directives/pending-spinner/src/pending-spinner.js +39 -0
- package/dist/directives/pending-spinner/src/pending-spinner.js.map +1 -0
- package/dist/element/define-element.d.ts +16 -0
- package/dist/element/define-element.js +8 -0
- package/dist/element/define-element.js.map +1 -0
- package/dist/element/index.d.ts +14 -0
- package/dist/element/index.js +4 -0
- package/dist/element/spectrum-element.d.ts +69 -0
- package/dist/element/spectrum-element.js +85 -0
- package/dist/element/spectrum-element.js.map +1 -0
- package/dist/element/version.d.ts +19 -0
- package/dist/element/version.js +6 -0
- package/dist/element/version.js.map +1 -0
- package/dist/mixins/disabled-mixin.d.ts +30 -0
- package/dist/mixins/disabled-mixin.js +27 -0
- package/dist/mixins/disabled-mixin.js.map +1 -0
- package/dist/mixins/index.d.ts +16 -0
- package/dist/mixins/index.js +5 -0
- package/dist/mixins/linear-progress-mixin.d.ts +41 -0
- package/dist/mixins/linear-progress-mixin.js +115 -0
- package/dist/mixins/linear-progress-mixin.js.map +1 -0
- package/dist/mixins/pending-mixin.d.ts +45 -0
- package/dist/mixins/pending-mixin.js +50 -0
- package/dist/mixins/pending-mixin.js.map +1 -0
- package/dist/mixins/sized-mixin.d.ts +49 -0
- package/dist/mixins/sized-mixin.js +42 -0
- package/dist/mixins/sized-mixin.js.map +1 -0
- package/dist/utils/actual-placement.d.ts +10 -0
- package/dist/utils/actual-placement.js +8 -0
- package/dist/utils/actual-placement.js.map +1 -0
- package/dist/utils/capitalize.d.ts +26 -0
- package/dist/utils/capitalize.js +8 -0
- package/dist/utils/capitalize.js.map +1 -0
- package/dist/utils/deep-contains.d.ts +26 -0
- package/dist/utils/deep-contains.js +14 -0
- package/dist/utils/deep-contains.js.map +1 -0
- package/dist/utils/dev-validation.d.ts +88 -0
- package/dist/utils/dev-validation.js +33 -0
- package/dist/utils/dev-validation.js.map +1 -0
- package/dist/utils/dismissible-stack.d.ts +26 -0
- package/dist/utils/dismissible-stack.js +16 -0
- package/dist/utils/dismissible-stack.js.map +1 -0
- package/dist/utils/focusable-selectors.d.ts +43 -0
- package/dist/utils/focusable-selectors.js +18 -0
- package/dist/utils/focusable-selectors.js.map +1 -0
- package/dist/utils/get-active-element.d.ts +31 -0
- package/dist/utils/get-active-element.js +11 -0
- package/dist/utils/get-active-element.js.map +1 -0
- package/dist/utils/get-label-from-slot.d.ts +12 -0
- package/dist/utils/get-label-from-slot.js +10 -0
- package/dist/utils/get-label-from-slot.js.map +1 -0
- package/dist/utils/index.d.ts +22 -0
- package/dist/utils/index.js +12 -0
- package/dist/utils/is-focus-visible-in-tree.d.ts +33 -0
- package/dist/utils/is-focus-visible-in-tree.js +11 -0
- package/dist/utils/is-focus-visible-in-tree.js.map +1 -0
- package/dist/utils/resolve-trigger.d.ts +42 -0
- package/dist/utils/resolve-trigger.js +23 -0
- package/dist/utils/resolve-trigger.js.map +1 -0
- package/dist/utils/transition.d.ts +53 -0
- package/dist/utils/transition.js +26 -0
- package/dist/utils/transition.js.map +1 -0
- package/package.json +644 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { ReactiveController, ReactiveElement } from 'lit';
|
|
2
|
+
export interface SlotTextConfig {
|
|
3
|
+
/**
|
|
4
|
+
* The slot name to observe. Use `''` (empty string) for the default slot.
|
|
5
|
+
*
|
|
6
|
+
* @default '' (default slot)
|
|
7
|
+
*/
|
|
8
|
+
slotName?: string;
|
|
9
|
+
/**
|
|
10
|
+
* CSS selectors for elements to exclude when checking for content.
|
|
11
|
+
* Matched elements are ignored — only non-excluded elements and
|
|
12
|
+
* non-empty text nodes count as "content."
|
|
13
|
+
*/
|
|
14
|
+
excludeSelectors?: string[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A reactive controller that observes whether a slot contains meaningful
|
|
18
|
+
* text or element content.
|
|
19
|
+
*
|
|
20
|
+
* Replaces the `ObserveSlotText` mixin with a composition-based approach.
|
|
21
|
+
*
|
|
22
|
+
* Monitors for `characterData` mutations (text changes) and re-evaluates
|
|
23
|
+
* on slot change events. The host is requested to update whenever the
|
|
24
|
+
* content state changes.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* class MyButton extends SpectrumElement {
|
|
29
|
+
* private slotText = new SlotTextController(this);
|
|
30
|
+
*
|
|
31
|
+
* get hasLabel(): boolean {
|
|
32
|
+
* return this.slotText.hasContent;
|
|
33
|
+
* }
|
|
34
|
+
*
|
|
35
|
+
* override render() {
|
|
36
|
+
* return html`<slot @slotchange=${this.slotText.handleSlotChange}></slot>`;
|
|
37
|
+
* }
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* // Named slot with exclusions
|
|
44
|
+
* class MyComponent extends SpectrumElement {
|
|
45
|
+
* private slotText = new SlotTextController(this, {
|
|
46
|
+
* slotName: 'description',
|
|
47
|
+
* excludeSelectors: ['.visually-hidden'],
|
|
48
|
+
* });
|
|
49
|
+
* }
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare class SlotTextController implements ReactiveController {
|
|
53
|
+
private host;
|
|
54
|
+
private slotName;
|
|
55
|
+
private excludeSelectors;
|
|
56
|
+
private observer;
|
|
57
|
+
private _hasContent;
|
|
58
|
+
constructor(host: ReactiveElement, config?: SlotTextConfig);
|
|
59
|
+
/**
|
|
60
|
+
* Whether the observed slot has meaningful content (text nodes or
|
|
61
|
+
* non-excluded elements).
|
|
62
|
+
*/
|
|
63
|
+
get hasContent(): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Bind this to the slot's `@slotchange` event in the template.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```html
|
|
69
|
+
* <slot @slotchange=${this.slotText.handleSlotChange}></slot>
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
handleSlotChange: (event: Event) => void;
|
|
73
|
+
private evaluateNodes;
|
|
74
|
+
/**
|
|
75
|
+
* Checks initial content from light DOM children before the first render,
|
|
76
|
+
* before slots are assigned.
|
|
77
|
+
*
|
|
78
|
+
* This runs from `hostConnected`, which Lit invokes during the host's
|
|
79
|
+
* `connectedCallback` — before the first `update()`. It sets `_hasContent`
|
|
80
|
+
* directly and intentionally does not call `requestUpdate()`: the first
|
|
81
|
+
* render has not happened yet, so it will read the correct value when it
|
|
82
|
+
* runs. This differs from the `ObserveSlotText` mixin, where `slotHasContent`
|
|
83
|
+
* was a reactive `@property` assigned in `update()`. After the first render,
|
|
84
|
+
* `handleSlotChange` (bound via `@slotchange`) and the `characterData`
|
|
85
|
+
* observer take over and do call `requestUpdate()` on change. The
|
|
86
|
+
* controller stories cover initial content being reflected on first paint.
|
|
87
|
+
*/
|
|
88
|
+
private checkInitialContent;
|
|
89
|
+
private checkContent;
|
|
90
|
+
hostConnected(): void;
|
|
91
|
+
hostDisconnected(): void;
|
|
92
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//#region controllers/slot-text-controller/src/slot-text-controller.ts
|
|
2
|
+
var e = class {
|
|
3
|
+
constructor(e, t = {}) {
|
|
4
|
+
var n, r;
|
|
5
|
+
this._hasContent = !1, this.handleSlotChange = (e) => {
|
|
6
|
+
let t = e.target.assignedNodes({ flatten: !0 });
|
|
7
|
+
this.evaluateNodes(t);
|
|
8
|
+
}, this.host = e, this.slotName = (n = t.slotName) == null ? "" : n, this.excludeSelectors = (r = t.excludeSelectors) == null ? [] : r, this.host.addController(this), this.observer = new MutationObserver((e) => {
|
|
9
|
+
for (let t of e) if (t.type === "characterData") {
|
|
10
|
+
this.checkContent();
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
get hasContent() {
|
|
16
|
+
return this._hasContent;
|
|
17
|
+
}
|
|
18
|
+
evaluateNodes(e) {
|
|
19
|
+
let t = [...e].some((e) => {
|
|
20
|
+
let t = e;
|
|
21
|
+
return t.tagName ? !this.excludeSelectors.some((e) => t.matches(e)) : this.slotName ? !1 : e.nodeType === Node.TEXT_NODE && e.textContent ? e.textContent.trim().length > 0 : !1;
|
|
22
|
+
});
|
|
23
|
+
t !== this._hasContent && (this._hasContent = t, this.host.requestUpdate());
|
|
24
|
+
}
|
|
25
|
+
checkInitialContent() {
|
|
26
|
+
let { childNodes: e } = this.host;
|
|
27
|
+
this._hasContent = [...e].filter((e) => {
|
|
28
|
+
let t = e;
|
|
29
|
+
return t.tagName ? this.excludeSelectors.some((e) => t.matches(e)) ? !1 : this.slotName ? t.getAttribute("slot") === this.slotName : !t.hasAttribute("slot") : this.slotName ? !1 : e.nodeType === Node.TEXT_NODE && e.textContent ? e.textContent.trim().length > 0 : !1;
|
|
30
|
+
}).length > 0;
|
|
31
|
+
}
|
|
32
|
+
checkContent() {
|
|
33
|
+
var e;
|
|
34
|
+
let t = (e = this.host.shadowRoot) == null ? void 0 : e.querySelector(this.slotName ? `slot[name="${this.slotName}"]` : "slot:not([name])");
|
|
35
|
+
if (t) {
|
|
36
|
+
let e = t.assignedNodes({ flatten: !0 });
|
|
37
|
+
this.evaluateNodes(e);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
hostConnected() {
|
|
41
|
+
this.observer.observe(this.host, {
|
|
42
|
+
characterData: !0,
|
|
43
|
+
subtree: !0
|
|
44
|
+
}), this.checkInitialContent();
|
|
45
|
+
}
|
|
46
|
+
hostDisconnected() {
|
|
47
|
+
this.observer.disconnect();
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
//#endregion
|
|
51
|
+
export { e as SlotTextController };
|
|
52
|
+
|
|
53
|
+
//# sourceMappingURL=slot-text-controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slot-text-controller.js","names":[],"sources":["../../../../controllers/slot-text-controller/src/slot-text-controller.ts"],"sourcesContent":["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport type { ReactiveController, ReactiveElement } from 'lit';\n\nexport interface SlotTextConfig {\n /**\n * The slot name to observe. Use `''` (empty string) for the default slot.\n *\n * @default '' (default slot)\n */\n slotName?: string;\n\n /**\n * CSS selectors for elements to exclude when checking for content.\n * Matched elements are ignored — only non-excluded elements and\n * non-empty text nodes count as \"content.\"\n */\n excludeSelectors?: string[];\n}\n\n/**\n * A reactive controller that observes whether a slot contains meaningful\n * text or element content.\n *\n * Replaces the `ObserveSlotText` mixin with a composition-based approach.\n *\n * Monitors for `characterData` mutations (text changes) and re-evaluates\n * on slot change events. The host is requested to update whenever the\n * content state changes.\n *\n * @example\n * ```typescript\n * class MyButton extends SpectrumElement {\n * private slotText = new SlotTextController(this);\n *\n * get hasLabel(): boolean {\n * return this.slotText.hasContent;\n * }\n *\n * override render() {\n * return html`<slot @slotchange=${this.slotText.handleSlotChange}></slot>`;\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Named slot with exclusions\n * class MyComponent extends SpectrumElement {\n * private slotText = new SlotTextController(this, {\n * slotName: 'description',\n * excludeSelectors: ['.visually-hidden'],\n * });\n * }\n * ```\n */\nexport class SlotTextController implements ReactiveController {\n private host: ReactiveElement;\n private slotName: string;\n private excludeSelectors: string[];\n private observer: MutationObserver;\n private _hasContent = false;\n\n constructor(host: ReactiveElement, config: SlotTextConfig = {}) {\n this.host = host;\n this.slotName = config.slotName ?? '';\n this.excludeSelectors = config.excludeSelectors ?? [];\n this.host.addController(this);\n\n this.observer = new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (mutation.type === 'characterData') {\n this.checkContent();\n return;\n }\n }\n });\n }\n\n /**\n * Whether the observed slot has meaningful content (text nodes or\n * non-excluded elements).\n */\n get hasContent(): boolean {\n return this._hasContent;\n }\n\n /**\n * Bind this to the slot's `@slotchange` event in the template.\n *\n * @example\n * ```html\n * <slot @slotchange=${this.slotText.handleSlotChange}></slot>\n * ```\n */\n handleSlotChange = (event: Event): void => {\n const slot = event.target as HTMLSlotElement;\n const nodes = slot.assignedNodes({ flatten: true });\n this.evaluateNodes(nodes);\n };\n\n private evaluateNodes(nodes: Iterable<Node>): void {\n const hasContent = [...nodes].some((node) => {\n const el = node as HTMLElement;\n if (el.tagName) {\n return !this.excludeSelectors.some((sel) => el.matches(sel));\n }\n // A bare text node can never carry a `slot` attribute, so it is only\n // ever assigned to the default slot. When observing a named slot it must\n // not count as content.\n if (this.slotName) {\n return false;\n }\n // Only real text nodes count. Comment nodes (e.g. Lit's child-part\n // markers left behind by a `${cond ? nothing : label}` binding) also\n // lack a `tagName`, and their `textContent` is the marker data, which\n // would otherwise be misread as label text.\n return node.nodeType === Node.TEXT_NODE && node.textContent\n ? node.textContent.trim().length > 0\n : false;\n });\n\n if (hasContent !== this._hasContent) {\n this._hasContent = hasContent;\n this.host.requestUpdate();\n }\n }\n\n /**\n * Checks initial content from light DOM children before the first render,\n * before slots are assigned.\n *\n * This runs from `hostConnected`, which Lit invokes during the host's\n * `connectedCallback` — before the first `update()`. It sets `_hasContent`\n * directly and intentionally does not call `requestUpdate()`: the first\n * render has not happened yet, so it will read the correct value when it\n * runs. This differs from the `ObserveSlotText` mixin, where `slotHasContent`\n * was a reactive `@property` assigned in `update()`. After the first render,\n * `handleSlotChange` (bound via `@slotchange`) and the `characterData`\n * observer take over and do call `requestUpdate()` on change. The\n * controller stories cover initial content being reflected on first paint.\n */\n private checkInitialContent(): void {\n const { childNodes } = this.host;\n const relevant = [...childNodes].filter((node) => {\n const el = node as HTMLElement;\n if (el.tagName) {\n const excluded = this.excludeSelectors.some((sel) => el.matches(sel));\n if (excluded) {\n return false;\n }\n // Match slot assignment: named slot checks slot attribute,\n // default slot checks for no slot attribute\n return this.slotName\n ? el.getAttribute('slot') === this.slotName\n : !el.hasAttribute('slot');\n }\n // A bare text node has no `slot` attribute, so it is only assigned to\n // the default slot; it never counts as content for a named slot.\n if (this.slotName) {\n return false;\n }\n // Only real text nodes count. Comment nodes (e.g. Lit's child-part\n // markers left behind by a `${cond ? nothing : label}` binding) also\n // lack a `tagName`, and their `textContent` is the marker data, which\n // would otherwise be misread as label text.\n return node.nodeType === Node.TEXT_NODE && node.textContent\n ? node.textContent.trim().length > 0\n : false;\n });\n this._hasContent = relevant.length > 0;\n }\n\n private checkContent(): void {\n // Re-query assigned nodes from the slot element in the shadow root\n const slot = this.host.shadowRoot?.querySelector(\n this.slotName ? `slot[name=\"${this.slotName}\"]` : 'slot:not([name])'\n ) as HTMLSlotElement | null;\n if (slot) {\n const nodes = slot.assignedNodes({ flatten: true });\n this.evaluateNodes(nodes);\n }\n }\n\n hostConnected(): void {\n this.observer.observe(this.host, {\n characterData: true,\n subtree: true,\n });\n this.checkInitialContent();\n }\n\n hostDisconnected(): void {\n this.observer.disconnect();\n }\n}\n"],"mappings":";AAkEA,IAAa,IAAb,MAA8D;CAO5D,YAAY,GAAuB,IAAyB,EAAE,EAAE;;AAM9D,qBARoB,6BAkCF,MAAuB;GAEzC,IAAM,IADO,EAAM,OACA,cAAc,EAAE,SAAS,IAAM,CAAC;AACnD,QAAK,cAAc,EAAM;KAlCzB,KAAK,OAAO,GACZ,KAAK,YAAA,IAAW,EAAO,aAAA,OAAY,KAAZ,GACvB,KAAK,oBAAA,IAAmB,EAAO,qBAAA,OAAoB,EAAE,GAAtB,GAC/B,KAAK,KAAK,cAAc,KAAK,EAE7B,KAAK,WAAW,IAAI,kBAAkB,MAAc;AAClD,QAAK,IAAM,KAAY,EACrB,KAAI,EAAS,SAAS,iBAAiB;AACrC,SAAK,cAAc;AACnB;;IAGJ;;CAOJ,IAAI,aAAsB;AACxB,SAAO,KAAK;;CAiBd,cAAsB,GAA6B;EACjD,IAAM,IAAa,CAAC,GAAG,EAAM,CAAC,MAAM,MAAS;GAC3C,IAAM,IAAK;AAcX,UAbI,EAAG,UACE,CAAC,KAAK,iBAAiB,MAAM,MAAQ,EAAG,QAAQ,EAAI,CAAC,GAK1D,KAAK,WACA,KAMF,EAAK,aAAa,KAAK,aAAa,EAAK,cAC5C,EAAK,YAAY,MAAM,CAAC,SAAS,IACjC;IACJ;AAEF,EAAI,MAAe,KAAK,gBACtB,KAAK,cAAc,GACnB,KAAK,KAAK,eAAe;;CAkB7B,sBAAoC;EAClC,IAAM,EAAE,kBAAe,KAAK;AA2B5B,OAAK,cA1BY,CAAC,GAAG,EAAW,CAAC,QAAQ,MAAS;GAChD,IAAM,IAAK;AAqBX,UApBI,EAAG,UACY,KAAK,iBAAiB,MAAM,MAAQ,EAAG,QAAQ,EAAI,CAAC,GAE5D,KAIF,KAAK,WACR,EAAG,aAAa,OAAO,KAAK,KAAK,WACjC,CAAC,EAAG,aAAa,OAAO,GAI1B,KAAK,WACA,KAMF,EAAK,aAAa,KAAK,aAAa,EAAK,cAC5C,EAAK,YAAY,MAAM,CAAC,SAAS,IACjC;IACJ,CAC0B,SAAS;;CAGvC,eAA6B;;EAE3B,IAAM,KAAA,IAAO,KAAK,KAAK,eAAA,OAAA,KAAA,IAAA,EAAY,cACjC,KAAK,WAAW,cAAc,KAAK,SAAS,MAAM,mBACnD;AACD,MAAI,GAAM;GACR,IAAM,IAAQ,EAAK,cAAc,EAAE,SAAS,IAAM,CAAC;AACnD,QAAK,cAAc,EAAM;;;CAI7B,gBAAsB;AAKpB,EAJA,KAAK,SAAS,QAAQ,KAAK,MAAM;GAC/B,eAAe;GACf,SAAS;GACV,CAAC,EACF,KAAK,qBAAqB;;CAG5B,mBAAyB;AACvB,OAAK,SAAS,YAAY"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Public exports for render-only Lit template directives shared across gen2 packages.
|
|
14
|
+
*/
|
|
15
|
+
export { renderPendingSpinner, type PendingSpinnerResult, } from './pending-spinner/index.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
export { renderPendingSpinner, type PendingSpinnerResult, } from './src/pending-spinner.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./src/pending-spinner.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { nothing, TemplateResult } from 'lit';
|
|
2
|
+
/** Return type of {@link renderPendingSpinner}: the spinner template, or `nothing`. */
|
|
3
|
+
export type PendingSpinnerResult = TemplateResult | typeof nothing;
|
|
4
|
+
/**
|
|
5
|
+
* Renders the shared pending-spinner SVG used by pending-capable components.
|
|
6
|
+
* Returns `nothing` when `pending` is false so callers can interpolate
|
|
7
|
+
* unconditionally: `${renderPendingSpinner(this.pending, this.pendingActive)}`.
|
|
8
|
+
*
|
|
9
|
+
* Most consumers do not call this directly: `PendingController` (and
|
|
10
|
+
* `PendingMixin`) expose `renderPendingState()`, which calls this with the
|
|
11
|
+
* controller's own state. Use this directive directly only for a stateless
|
|
12
|
+
* spinner without a controller.
|
|
13
|
+
*
|
|
14
|
+
* This is render-only and carries no design-token dependency. Pair it with the
|
|
15
|
+
* shared `pending-spinner.css` style fragment, which themes the
|
|
16
|
+
* `swc-PendingSpinner*` classes this emits.
|
|
17
|
+
*
|
|
18
|
+
* @param pending - Whether the host is in the pending (busy) state.
|
|
19
|
+
* @param pendingActive - Whether the delayed busy visual is active; toggles the
|
|
20
|
+
* `swc-PendingSpinner--active` class that runs the spin animation.
|
|
21
|
+
*/
|
|
22
|
+
export declare function renderPendingSpinner(pending: boolean, pendingActive: boolean): PendingSpinnerResult;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { html as e, nothing as t } from "lit";
|
|
2
|
+
import { classMap as n } from "lit/directives/class-map.js";
|
|
3
|
+
//#region directives/pending-spinner/src/pending-spinner.ts
|
|
4
|
+
function r(r, i) {
|
|
5
|
+
return r ? e`
|
|
6
|
+
<svg
|
|
7
|
+
class=${n({
|
|
8
|
+
"swc-PendingSpinner": !0,
|
|
9
|
+
"swc-PendingSpinner--active": i
|
|
10
|
+
})}
|
|
11
|
+
width="100%"
|
|
12
|
+
height="100%"
|
|
13
|
+
fill="none"
|
|
14
|
+
aria-hidden="true"
|
|
15
|
+
focusable="false"
|
|
16
|
+
>
|
|
17
|
+
<circle
|
|
18
|
+
class="swc-PendingSpinner-track"
|
|
19
|
+
cx="50%"
|
|
20
|
+
cy="50%"
|
|
21
|
+
r="calc(50% - 1px)"
|
|
22
|
+
/>
|
|
23
|
+
<circle
|
|
24
|
+
class="swc-PendingSpinner-fill"
|
|
25
|
+
cx="50%"
|
|
26
|
+
cy="50%"
|
|
27
|
+
r="calc(50% - 1px)"
|
|
28
|
+
pathLength="100"
|
|
29
|
+
stroke-dasharray="100 200"
|
|
30
|
+
stroke-dashoffset="75"
|
|
31
|
+
stroke-linecap="round"
|
|
32
|
+
/>
|
|
33
|
+
</svg>
|
|
34
|
+
` : t;
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { r as renderPendingSpinner };
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=pending-spinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pending-spinner.js","names":[],"sources":["../../../../directives/pending-spinner/src/pending-spinner.ts"],"sourcesContent":["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { html, nothing, type TemplateResult } from 'lit';\nimport { classMap } from 'lit/directives/class-map.js';\n\n/** Return type of {@link renderPendingSpinner}: the spinner template, or `nothing`. */\nexport type PendingSpinnerResult = TemplateResult | typeof nothing;\n\n/**\n * Renders the shared pending-spinner SVG used by pending-capable components.\n * Returns `nothing` when `pending` is false so callers can interpolate\n * unconditionally: `${renderPendingSpinner(this.pending, this.pendingActive)}`.\n *\n * Most consumers do not call this directly: `PendingController` (and\n * `PendingMixin`) expose `renderPendingState()`, which calls this with the\n * controller's own state. Use this directive directly only for a stateless\n * spinner without a controller.\n *\n * This is render-only and carries no design-token dependency. Pair it with the\n * shared `pending-spinner.css` style fragment, which themes the\n * `swc-PendingSpinner*` classes this emits.\n *\n * @param pending - Whether the host is in the pending (busy) state.\n * @param pendingActive - Whether the delayed busy visual is active; toggles the\n * `swc-PendingSpinner--active` class that runs the spin animation.\n */\nexport function renderPendingSpinner(\n pending: boolean,\n pendingActive: boolean\n): PendingSpinnerResult {\n if (!pending) {\n return nothing;\n }\n return html`\n <svg\n class=${classMap({\n 'swc-PendingSpinner': true,\n 'swc-PendingSpinner--active': pendingActive,\n })}\n width=\"100%\"\n height=\"100%\"\n fill=\"none\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <circle\n class=\"swc-PendingSpinner-track\"\n cx=\"50%\"\n cy=\"50%\"\n r=\"calc(50% - 1px)\"\n />\n <circle\n class=\"swc-PendingSpinner-fill\"\n cx=\"50%\"\n cy=\"50%\"\n r=\"calc(50% - 1px)\"\n pathLength=\"100\"\n stroke-dasharray=\"100 200\"\n stroke-dashoffset=\"75\"\n stroke-linecap=\"round\"\n />\n </svg>\n `;\n}\n"],"mappings":";;;AAoCA,SAAgB,EACd,GACA,GACsB;AAItB,QAHK,IAGE,CAAI;;cAEC,EAAS;EACf,sBAAsB;EACtB,8BAA8B;EAC/B,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;MAPE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
interface CustomElementConstructor {
|
|
13
|
+
new (...params: unknown[]): HTMLElement;
|
|
14
|
+
}
|
|
15
|
+
export declare function defineElement(name: string, constructor: CustomElementConstructor): void;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region element/define-element.ts
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
window.__swc && window.__swc.DEBUG && customElements.get(e) && window.__swc.warn(void 0, `Attempted to redefine <${e}>. This usually indicates that multiple versions of the same web component were loaded onto a single page.`, "https://spectrum-web-components.adobe.com/registry-conflicts"), customElements.define(e, t);
|
|
4
|
+
}
|
|
5
|
+
//#endregion
|
|
6
|
+
export { e as defineElement };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=define-element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-element.js","names":[],"sources":["../../element/define-element.ts"],"sourcesContent":["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\ninterface CustomElementConstructor {\n new (...params: unknown[]): HTMLElement;\n}\n\nexport function defineElement(\n name: string,\n constructor: CustomElementConstructor\n): void {\n if (window.__swc && window.__swc.DEBUG) {\n if (customElements.get(name)) {\n window.__swc.warn(\n undefined,\n `Attempted to redefine <${name}>. This usually indicates that multiple versions of the same web component were loaded onto a single page.`,\n 'https://spectrum-web-components.adobe.com/registry-conflicts'\n );\n }\n }\n customElements.define(name, constructor);\n}\n"],"mappings":";AAgBA,SAAgB,EACd,GACA,GACM;AAUN,CATI,OAAO,SAAS,OAAO,MAAM,SAC3B,eAAe,IAAI,EAAK,IAC1B,OAAO,MAAM,KACX,KAAA,GACA,0BAA0B,EAAK,6GAC/B,+DACD,EAGL,eAAe,OAAO,GAAM,EAAY"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
export { defineElement } from './define-element.js';
|
|
13
|
+
export { SpectrumElement } from './spectrum-element.js';
|
|
14
|
+
export { coreVersion, version } from './version.js';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class SpectrumElement extends LitElement {
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
static VERSION: string;
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
static CORE_VERSION: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Builds the deduplication key for a dev-mode warning. The `message` is part of
|
|
14
|
+
* the key so two distinct problems that share a `type`/`level` (the common
|
|
15
|
+
* case) do not suppress each other; only a verbatim repeat of the same warning
|
|
16
|
+
* is deduplicated. Exported so the dedup key can be unit tested without relying
|
|
17
|
+
* on the `NODE_ENV`-gated `window.__swc` setup below.
|
|
18
|
+
*/
|
|
19
|
+
export declare function warningId(localName: string, type: WarningType, level: WarningLevel, message: string): BrandedSWCWarningID;
|
|
20
|
+
/**
|
|
21
|
+
* A group of dev-mode warnings that share a `warningId`, collected within a
|
|
22
|
+
* single microtask so they can be emitted as one console line with a count.
|
|
23
|
+
*/
|
|
24
|
+
type BatchedWarning = {
|
|
25
|
+
message: string;
|
|
26
|
+
url: string;
|
|
27
|
+
localName: string;
|
|
28
|
+
type: WarningType;
|
|
29
|
+
level: WarningLevel;
|
|
30
|
+
listedIssues: string;
|
|
31
|
+
elements: HTMLElement[];
|
|
32
|
+
count: number;
|
|
33
|
+
/**
|
|
34
|
+
* Elements already counted in this batch, keyed by identity. A repeated
|
|
35
|
+
* `warn()` for an element already here does not bump `count` again.
|
|
36
|
+
*/
|
|
37
|
+
countedElements?: Set<HTMLElement>;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the dev-mode warning (the only warning with no element) has been
|
|
40
|
+
* counted, so repeats of it collapse to one.
|
|
41
|
+
*/
|
|
42
|
+
countedDevModeWarning?: boolean;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Builds the `console.warn` arguments for a grouped dev warning: the message
|
|
46
|
+
* and a count line, then the element ref(s) to inspect. By default one
|
|
47
|
+
* representative element is shown; `verbose` shows every collected element
|
|
48
|
+
* (already capped at collection time). Exported so the grouped output can be
|
|
49
|
+
* unit tested without the `NODE_ENV`-gated `window.__swc` setup below.
|
|
50
|
+
*
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
export declare function buildGroupedWarningArgs(batch: BatchedWarning, verbose: boolean): unknown[];
|
|
54
|
+
/**
|
|
55
|
+
* Records one warning occurrence into its batch, counting by element identity:
|
|
56
|
+
* `count` becomes the number of distinct elements with this warning, not the
|
|
57
|
+
* number of `warn()` calls. A host that warns once per child (same message,
|
|
58
|
+
* same element) still counts as one affected element. `count` is uncapped;
|
|
59
|
+
* `maxDisplayed` only limits how many element refs are kept for display.
|
|
60
|
+
*
|
|
61
|
+
* @param batch - Grouped-warning batch to record into.
|
|
62
|
+
* @param element - Element the warning is about, or `undefined` for the
|
|
63
|
+
* dev-mode warning, which is not about a specific element.
|
|
64
|
+
* @param maxDisplayed - Cap on element refs kept for display; does not affect
|
|
65
|
+
* `count`.
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
export declare function recordAffectedElement(batch: BatchedWarning, element: HTMLElement | undefined, maxDisplayed: number): void;
|
|
69
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { coreVersion as e, version as t } from "./version.js";
|
|
2
|
+
import { LitElement as n } from "lit";
|
|
3
|
+
//#region element/spectrum-element.ts
|
|
4
|
+
var r, i = class extends n {};
|
|
5
|
+
r = i, r.VERSION = t, r.CORE_VERSION = e;
|
|
6
|
+
function a(e, t, n, r) {
|
|
7
|
+
return `${e}:${t}:${n}:${r}`;
|
|
8
|
+
}
|
|
9
|
+
function o(e, t) {
|
|
10
|
+
let { message: n, url: r, localName: i, type: a, level: o, listedIssues: s, elements: c, count: l } = e, u = o === "deprecation" ? "DEPRECATION NOTICE: " : "", d = t ? c : c.slice(0, 1), f = "";
|
|
11
|
+
f = l === 1 ? d.length ? "\nAffected element:" : "" : `\n${l} <${i}> elements affected:`;
|
|
12
|
+
let p = [u + n + "\n" + s + f];
|
|
13
|
+
for (let e of d) p.push(e);
|
|
14
|
+
return p.push((d.length ? "\n\n" : "\n") + r + "\n", { data: {
|
|
15
|
+
localName: i,
|
|
16
|
+
type: a,
|
|
17
|
+
level: o,
|
|
18
|
+
count: l
|
|
19
|
+
} }), p;
|
|
20
|
+
}
|
|
21
|
+
function s(e, t, n) {
|
|
22
|
+
var r;
|
|
23
|
+
if (!t) {
|
|
24
|
+
if (e.countedDevModeWarning) return;
|
|
25
|
+
e.countedDevModeWarning = !0, e.count += 1;
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
let i = (r = e.countedElements) == null ? e.countedElements = /* @__PURE__ */ new Set() : r;
|
|
29
|
+
i.has(t) || (i.add(t), e.count += 1, e.elements.length < n && e.elements.push(t));
|
|
30
|
+
}
|
|
31
|
+
if (process.env.NODE_ENV !== "production") {
|
|
32
|
+
var c, l, u;
|
|
33
|
+
let e = {
|
|
34
|
+
default: !1,
|
|
35
|
+
accessibility: !1,
|
|
36
|
+
api: !1
|
|
37
|
+
}, t = {
|
|
38
|
+
default: !1,
|
|
39
|
+
low: !1,
|
|
40
|
+
medium: !1,
|
|
41
|
+
high: !1,
|
|
42
|
+
deprecation: !1
|
|
43
|
+
}, n = /* @__PURE__ */ new Map(), r = !1, i = () => {
|
|
44
|
+
r = !1, n.forEach((e, t) => {
|
|
45
|
+
console.warn(...o(e, !!window.__swc.verbose)), window.__swc.issuedWarnings.add(t);
|
|
46
|
+
}), n.clear();
|
|
47
|
+
};
|
|
48
|
+
window.__swc = {
|
|
49
|
+
...window.__swc,
|
|
50
|
+
DEBUG: !0,
|
|
51
|
+
ignoreWarningLocalNames: { ...((c = window.__swc) == null ? void 0 : c.ignoreWarningLocalNames) || {} },
|
|
52
|
+
ignoreWarningTypes: {
|
|
53
|
+
...e,
|
|
54
|
+
...((l = window.__swc) == null ? void 0 : l.ignoreWarningTypes) || {}
|
|
55
|
+
},
|
|
56
|
+
ignoreWarningLevels: {
|
|
57
|
+
...t,
|
|
58
|
+
...((u = window.__swc) == null ? void 0 : u.ignoreWarningLevels) || {}
|
|
59
|
+
},
|
|
60
|
+
issuedWarnings: /* @__PURE__ */ new Set(),
|
|
61
|
+
warn: (e, t, o, { type: c = "api", level: l = "default", issues: u } = {}) => {
|
|
62
|
+
let { localName: d = "base" } = e || {}, f = a(d, c, l, t);
|
|
63
|
+
if (window.__swc.ignoreWarningLocalNames[d] || window.__swc.ignoreWarningTypes[c] || window.__swc.ignoreWarningLevels[l] || !window.__swc.verbose && window.__swc.issuedWarnings.has(f)) return;
|
|
64
|
+
let p = n.get(f);
|
|
65
|
+
if (!p) {
|
|
66
|
+
let e = "";
|
|
67
|
+
u && u.length && (u.unshift(""), e = u.join("\n - ") + "\n"), p = {
|
|
68
|
+
message: t,
|
|
69
|
+
url: o,
|
|
70
|
+
localName: d,
|
|
71
|
+
type: c,
|
|
72
|
+
level: l,
|
|
73
|
+
listedIssues: e,
|
|
74
|
+
elements: [],
|
|
75
|
+
count: 0
|
|
76
|
+
}, n.set(f, p);
|
|
77
|
+
}
|
|
78
|
+
s(p, e, 10), r || (r = !0, queueMicrotask(i));
|
|
79
|
+
}
|
|
80
|
+
}, window.__swc.warn(void 0, "Spectrum Web Components is in dev mode. Not recommended for production!", "https://spectrum-web-components.adobe.com/dev-mode/", { type: "default" });
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
export { i as SpectrumElement, o as buildGroupedWarningArgs, s as recordAffectedElement, a as warningId };
|
|
84
|
+
|
|
85
|
+
//# sourceMappingURL=spectrum-element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spectrum-element.js","names":[],"sources":["../../element/spectrum-element.ts"],"sourcesContent":["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { LitElement } from 'lit';\n\nimport { coreVersion, version } from './version.js';\n\nexport class SpectrumElement extends LitElement {\n /**\n * @internal\n */\n static VERSION = version;\n\n /**\n * @internal\n */\n static CORE_VERSION = coreVersion;\n}\n\n/**\n * Builds the deduplication key for a dev-mode warning. The `message` is part of\n * the key so two distinct problems that share a `type`/`level` (the common\n * case) do not suppress each other; only a verbatim repeat of the same warning\n * is deduplicated. Exported so the dedup key can be unit tested without relying\n * on the `NODE_ENV`-gated `window.__swc` setup below.\n */\nexport function warningId(\n localName: string,\n type: WarningType,\n level: WarningLevel,\n message: string\n): BrandedSWCWarningID {\n return `${localName}:${type}:${level}:${message}` as BrandedSWCWarningID;\n}\n\n/**\n * A group of dev-mode warnings that share a `warningId`, collected within a\n * single microtask so they can be emitted as one console line with a count.\n */\ntype BatchedWarning = {\n message: string;\n url: string;\n localName: string;\n type: WarningType;\n level: WarningLevel;\n listedIssues: string;\n elements: HTMLElement[];\n count: number;\n\n /**\n * Elements already counted in this batch, keyed by identity. A repeated\n * `warn()` for an element already here does not bump `count` again.\n */\n countedElements?: Set<HTMLElement>;\n\n /**\n * Whether the dev-mode warning (the only warning with no element) has been\n * counted, so repeats of it collapse to one.\n */\n countedDevModeWarning?: boolean;\n};\n\n/**\n * Builds the `console.warn` arguments for a grouped dev warning: the message\n * and a count line, then the element ref(s) to inspect. By default one\n * representative element is shown; `verbose` shows every collected element\n * (already capped at collection time). Exported so the grouped output can be\n * unit tested without the `NODE_ENV`-gated `window.__swc` setup below.\n *\n * @internal\n */\nexport function buildGroupedWarningArgs(\n batch: BatchedWarning,\n verbose: boolean\n): unknown[] {\n const {\n message,\n url,\n localName,\n type,\n level,\n listedIssues,\n elements,\n count,\n } = batch;\n const intro = level === 'deprecation' ? 'DEPRECATION NOTICE: ' : '';\n const shown = verbose ? elements : elements.slice(0, 1);\n let countLine = '';\n if (count === 1) {\n countLine = shown.length ? '\\nAffected element:' : '';\n } else {\n countLine = `\\n${count} <${localName}> elements affected:`;\n }\n const args: unknown[] = [intro + message + '\\n' + listedIssues + countLine];\n for (const el of shown) {\n args.push(el);\n }\n args.push((shown.length ? '\\n\\n' : '\\n') + url + '\\n', {\n data: { localName, type, level, count },\n });\n return args;\n}\n\n/**\n * Records one warning occurrence into its batch, counting by element identity:\n * `count` becomes the number of distinct elements with this warning, not the\n * number of `warn()` calls. A host that warns once per child (same message,\n * same element) still counts as one affected element. `count` is uncapped;\n * `maxDisplayed` only limits how many element refs are kept for display.\n *\n * @param batch - Grouped-warning batch to record into.\n * @param element - Element the warning is about, or `undefined` for the\n * dev-mode warning, which is not about a specific element.\n * @param maxDisplayed - Cap on element refs kept for display; does not affect\n * `count`.\n * @internal\n */\nexport function recordAffectedElement(\n batch: BatchedWarning,\n element: HTMLElement | undefined,\n maxDisplayed: number\n): void {\n if (!element) {\n // The dev-mode warning is the only warning with no element; count it once\n // however often it fires.\n if (batch.countedDevModeWarning) {\n return;\n }\n batch.countedDevModeWarning = true;\n batch.count += 1;\n return;\n }\n const countedElements = (batch.countedElements ??= new Set<HTMLElement>());\n if (countedElements.has(element)) {\n return; // this element is already counted for the batch\n }\n countedElements.add(element);\n batch.count += 1;\n if (batch.elements.length < maxDisplayed) {\n batch.elements.push(element);\n }\n}\n\n// Enabled in every environment except production (the ecosystem convention);\n// a production build strips this block via dead-code elimination.\nif (process.env.NODE_ENV !== 'production') {\n const ignoreWarningTypes = {\n default: false,\n accessibility: false,\n api: false,\n };\n const ignoreWarningLevels = {\n default: false,\n low: false,\n medium: false,\n high: false,\n deprecation: false,\n };\n\n // Grouped warnings: collect same-`warningId` warnings fired within one\n // microtask and emit a single console line with the total count. By default\n // one representative element is shown for inspection; `verbose` lists all\n // collected elements (capped at WARNING_ELEMENT_CAP).\n const WARNING_ELEMENT_CAP = 10;\n const batchedWarnings = new Map<BrandedSWCWarningID, BatchedWarning>();\n let flushScheduled = false;\n\n const flushWarnings = (): void => {\n flushScheduled = false;\n batchedWarnings.forEach((batch, id) => {\n console.warn(\n ...buildGroupedWarningArgs(batch, Boolean(window.__swc.verbose))\n );\n window.__swc.issuedWarnings.add(id);\n });\n batchedWarnings.clear();\n };\n\n window.__swc = {\n ...window.__swc,\n DEBUG: true,\n ignoreWarningLocalNames: {\n ...(window.__swc?.ignoreWarningLocalNames || {}),\n },\n ignoreWarningTypes: {\n ...ignoreWarningTypes,\n ...(window.__swc?.ignoreWarningTypes || {}),\n },\n ignoreWarningLevels: {\n ...ignoreWarningLevels,\n ...(window.__swc?.ignoreWarningLevels || {}),\n },\n issuedWarnings: new Set(),\n warn: (\n element,\n message,\n url,\n { type = 'api', level = 'default', issues } = {}\n ): void => {\n const { localName = 'base' } = element || {};\n const id = warningId(localName, type, level, message);\n // Ignore filters short-circuit before any batching.\n if (window.__swc.ignoreWarningLocalNames[localName]) {\n return;\n }\n if (window.__swc.ignoreWarningTypes[type]) {\n return;\n }\n if (window.__swc.ignoreWarningLevels[level]) {\n return;\n }\n // Session dedup: each id emits one grouped line per session. `verbose`\n // bypasses it so every microtask flush re-emits.\n if (!window.__swc.verbose && window.__swc.issuedWarnings.has(id)) {\n return;\n }\n // Collect into the per-id batch; `flushWarnings` builds the grouped\n // message on the next microtask.\n let batch = batchedWarnings.get(id);\n if (!batch) {\n let listedIssues = '';\n if (issues && issues.length) {\n issues.unshift('');\n listedIssues = issues.join('\\n - ') + '\\n';\n }\n batch = {\n message,\n url,\n localName,\n type,\n level,\n listedIssues,\n elements: [],\n count: 0,\n };\n batchedWarnings.set(id, batch);\n }\n recordAffectedElement(batch, element, WARNING_ELEMENT_CAP);\n if (!flushScheduled) {\n flushScheduled = true;\n queueMicrotask(flushWarnings);\n }\n },\n };\n\n window.__swc.warn(\n undefined,\n 'Spectrum Web Components is in dev mode. Not recommended for production!',\n 'https://spectrum-web-components.adobe.com/dev-mode/',\n { type: 'default' }\n );\n}\n"],"mappings":";;;OAgBa,IAAb,cAAqC,EAAW;mBAI7B,oBAKK;AAUxB,SAAgB,EACd,GACA,GACA,GACA,GACqB;AACrB,QAAO,GAAG,EAAU,GAAG,EAAK,GAAG,EAAM,GAAG;;AAuC1C,SAAgB,EACd,GACA,GACW;CACX,IAAM,EACJ,YACA,QACA,cACA,SACA,UACA,iBACA,aACA,aACE,GACE,IAAQ,MAAU,gBAAgB,yBAAyB,IAC3D,IAAQ,IAAU,IAAW,EAAS,MAAM,GAAG,EAAE,EACnD,IAAY;AAChB,CAGE,IAHE,MAAU,IACA,EAAM,SAAS,wBAAwB,KAEvC,KAAK,EAAM,IAAI,EAAU;CAEvC,IAAM,IAAkB,CAAC,IAAQ,IAAU,OAAO,IAAe,EAAU;AAC3E,MAAK,IAAM,KAAM,EACf,GAAK,KAAK,EAAG;AAKf,QAHA,EAAK,MAAM,EAAM,SAAS,SAAS,QAAQ,IAAM,MAAM,EACrD,MAAM;EAAE;EAAW;EAAM;EAAO;EAAO,EACxC,CAAC,EACK;;AAiBT,SAAgB,EACd,GACA,GACA,GACM;;AACN,KAAI,CAAC,GAAS;AAGZ,MAAI,EAAM,sBACR;AAGF,EADA,EAAM,wBAAwB,IAC9B,EAAM,SAAS;AACf;;CAEF,IAAM,KAAA,IAAmB,EAAM,oBAAA,OAAN,EAAM,kCAAoB,IAAI,KAAkB,GAA1C;AAC3B,GAAgB,IAAI,EAAQ,KAGhC,EAAgB,IAAI,EAAQ,EAC5B,EAAM,SAAS,GACX,EAAM,SAAS,SAAS,KAC1B,EAAM,SAAS,KAAK,EAAQ;;AAMhC,IAAA,QAAA,IAAA,aAA6B,cAAc;;CACzC,IAAM,IAAqB;EACzB,SAAS;EACT,eAAe;EACf,KAAK;EACN,EACK,IAAsB;EAC1B,SAAS;EACT,KAAK;EACL,QAAQ;EACR,MAAM;EACN,aAAa;EACd,EAOK,oBAAkB,IAAI,KAA0C,EAClE,IAAiB,IAEf,UAA4B;AAQhC,EAPA,IAAiB,IACjB,EAAgB,SAAS,GAAO,MAAO;AAIrC,GAHA,QAAQ,KACN,GAAG,EAAwB,GAAO,EAAQ,OAAO,MAAM,QAAS,CACjE,EACD,OAAO,MAAM,eAAe,IAAI,EAAG;IACnC,EACF,EAAgB,OAAO;;AAsEzB,CAnEA,OAAO,QAAQ;EACb,GAAG,OAAO;EACV,OAAO;EACP,yBAAyB,EACvB,KAAA,IAAI,OAAO,UAAA,OAAA,KAAA,IAAA,EAAO,4BAA2B,EAAE,EAChD;EACD,oBAAoB;GAClB,GAAG;GACH,KAAA,IAAI,OAAO,UAAA,OAAA,KAAA,IAAA,EAAO,uBAAsB,EAAE;GAC3C;EACD,qBAAqB;GACnB,GAAG;GACH,KAAA,IAAI,OAAO,UAAA,OAAA,KAAA,IAAA,EAAO,wBAAuB,EAAE;GAC5C;EACD,gCAAgB,IAAI,KAAK;EACzB,OACE,GACA,GACA,GACA,EAAE,UAAO,OAAO,WAAQ,WAAW,cAAW,EAAE,KACvC;GACT,IAAM,EAAE,eAAY,WAAW,KAAW,EAAE,EACtC,IAAK,EAAU,GAAW,GAAM,GAAO,EAAQ;AAarD,OAXI,OAAO,MAAM,wBAAwB,MAGrC,OAAO,MAAM,mBAAmB,MAGhC,OAAO,MAAM,oBAAoB,MAKjC,CAAC,OAAO,MAAM,WAAW,OAAO,MAAM,eAAe,IAAI,EAAG,CAC9D;GAIF,IAAI,IAAQ,EAAgB,IAAI,EAAG;AACnC,OAAI,CAAC,GAAO;IACV,IAAI,IAAe;AAenB,IAdI,KAAU,EAAO,WACnB,EAAO,QAAQ,GAAG,EAClB,IAAe,EAAO,KAAK,WAAW,GAAG,OAE3C,IAAQ;KACN;KACA;KACA;KACA;KACA;KACA;KACA,UAAU,EAAE;KACZ,OAAO;KACR,EACD,EAAgB,IAAI,GAAI,EAAM;;AAGhC,GADA,EAAsB,GAAO,GAAS,GAAoB,EACrD,MACH,IAAiB,IACjB,eAAe,EAAc;;EAGlC,EAED,OAAO,MAAM,KACX,KAAA,GACA,2EACA,uDACA,EAAE,MAAM,WAAW,CACpB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* The version of the gen2 Spectrum Web Components library.
|
|
14
|
+
*/
|
|
15
|
+
export declare const version = "2.0.0-beta.3";
|
|
16
|
+
/**
|
|
17
|
+
* The version of the core base package.
|
|
18
|
+
*/
|
|
19
|
+
export declare const coreVersion = "2.0.0-beta.3";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","names":[],"sources":["../../element/version.ts"],"sourcesContent":["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Auto-generated from gen2/packages/core/package.json\n// Generation: gen2\n// DO NOT EDIT - This file is generated by scripts/generate-versions.js\n\n/**\n * The version of the gen2 Spectrum Web Components library.\n */\nexport const version = '2.0.0-beta.3';\n\n/**\n * The version of the core base package.\n */\nexport const coreVersion = '2.0.0-beta.3';\n"],"mappings":";AAmBA,IAAa,IAAU,gBAKV,IAAc"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ReactiveElement } from 'lit';
|
|
2
|
+
type Constructor<T = Record<string, unknown>> = {
|
|
3
|
+
new (...args: any[]): T;
|
|
4
|
+
prototype: T;
|
|
5
|
+
};
|
|
6
|
+
export interface DisabledInterface {
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A mixin that adds a reactive `disabled` property with associated
|
|
11
|
+
* accessibility behavior.
|
|
12
|
+
*
|
|
13
|
+
* Sets `aria-disabled` on the host (not the native `disabled` attribute)
|
|
14
|
+
* so the element remains discoverable by assistive technology. Components
|
|
15
|
+
* wrapping native form controls (e.g., `<input>`, `<button>`) should also
|
|
16
|
+
* set `disabled` on the inner element in their `render()` method.
|
|
17
|
+
*
|
|
18
|
+
* @see https://kittygiraudel.com/2024/03/29/on-disabled-and-aria-disabled-attributes/
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* class MyButton extends DisabledMixin(SpectrumElement) {
|
|
23
|
+
* override render() {
|
|
24
|
+
* return html`<button ?disabled=${this.disabled}><slot></slot></button>`;
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function DisabledMixin<T extends Constructor<ReactiveElement>>(constructor: T): T & Constructor<DisabledInterface>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { __decorate as e } from "../_virtual/_@oxc-project_runtime@0.124.0/helpers/decorate.js";
|
|
2
|
+
import { property as t } from "lit/decorators.js";
|
|
3
|
+
//#region mixins/disabled-mixin.ts
|
|
4
|
+
function n(n) {
|
|
5
|
+
class r extends n {
|
|
6
|
+
constructor(...e) {
|
|
7
|
+
super(...e), this.disabled = !1;
|
|
8
|
+
}
|
|
9
|
+
update(e) {
|
|
10
|
+
if (e.has("disabled")) if (this.disabled) {
|
|
11
|
+
if (this.setAttribute("aria-disabled", "true"), this.hasAttribute("tabindex") && (this.prevTabindex = this.getAttribute("tabindex"), this.setAttribute("tabindex", "-1")), this.matches(":focus-within")) {
|
|
12
|
+
var t;
|
|
13
|
+
(t = this.shadowRoot) == null || (t = t.activeElement) == null || t.blur();
|
|
14
|
+
}
|
|
15
|
+
} else this.removeAttribute("aria-disabled"), this.prevTabindex !== void 0 && (this.setAttribute("tabindex", this.prevTabindex), this.prevTabindex = void 0);
|
|
16
|
+
super.update(e);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return e([t({
|
|
20
|
+
type: Boolean,
|
|
21
|
+
reflect: !0
|
|
22
|
+
})], r.prototype, "disabled", void 0), r;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { n as DisabledMixin };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=disabled-mixin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disabled-mixin.js","names":[],"sources":["../../mixins/disabled-mixin.ts"],"sourcesContent":["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport type { PropertyValues, ReactiveElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\ntype Constructor<T = Record<string, unknown>> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (...args: any[]): T;\n prototype: T;\n};\n\nexport interface DisabledInterface {\n disabled: boolean;\n}\n\n/**\n * A mixin that adds a reactive `disabled` property with associated\n * accessibility behavior.\n *\n * Sets `aria-disabled` on the host (not the native `disabled` attribute)\n * so the element remains discoverable by assistive technology. Components\n * wrapping native form controls (e.g., `<input>`, `<button>`) should also\n * set `disabled` on the inner element in their `render()` method.\n *\n * @see https://kittygiraudel.com/2024/03/29/on-disabled-and-aria-disabled-attributes/\n *\n * @example\n * ```typescript\n * class MyButton extends DisabledMixin(SpectrumElement) {\n * override render() {\n * return html`<button ?disabled=${this.disabled}><slot></slot></button>`;\n * }\n * }\n * ```\n */\nexport function DisabledMixin<T extends Constructor<ReactiveElement>>(\n constructor: T\n): T & Constructor<DisabledInterface> {\n class DisabledElement extends constructor {\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n private prevTabindex: string | undefined;\n\n /**\n * Uses `update()` (not `updated()`) so side effects apply BEFORE render.\n * Using `updated()` would leave a single frame where the component\n * renders as enabled but is behaviorally disabled, allowing the element\n * to be briefly focusable/clickable.\n */\n protected override update(changedProperties: PropertyValues): void {\n if (changedProperties.has('disabled')) {\n if (this.disabled) {\n // Host gets aria-disabled for screen reader discoverability.\n // Components wrapping native form controls should ALSO set\n // disabled on the inner element in render().\n this.setAttribute('aria-disabled', 'true');\n if (this.hasAttribute('tabindex')) {\n this.prevTabindex = this.getAttribute('tabindex')!;\n this.setAttribute('tabindex', '-1');\n }\n if (this.matches(':focus-within')) {\n (this.shadowRoot?.activeElement as HTMLElement)?.blur();\n }\n } else {\n this.removeAttribute('aria-disabled');\n if (this.prevTabindex !== undefined) {\n this.setAttribute('tabindex', this.prevTabindex);\n this.prevTabindex = undefined;\n }\n }\n }\n super.update(changedProperties);\n }\n }\n return DisabledElement as unknown as T & Constructor<DisabledInterface>;\n}\n"],"mappings":";;;AA6CA,SAAgB,EACd,GACoC;CACpC,MAAM,UAAwB,EAAY;;gCAE7B;;EAUX,OAA0B,GAAyC;AACjE,OAAI,EAAkB,IAAI,WAAW,CACnC,KAAI,KAAK,UASP;QALA,KAAK,aAAa,iBAAiB,OAAO,EACtC,KAAK,aAAa,WAAW,KAC/B,KAAK,eAAe,KAAK,aAAa,WAAW,EACjD,KAAK,aAAa,YAAY,KAAK,GAEjC,KAAK,QAAQ,gBAAgB,EAAE;;AACjC,MAAA,IAAC,KAAK,eAAA,SAAA,IAAA,EAAY,kBAAA,QAAA,EAA+B,MAAM;;SAIzD,CADA,KAAK,gBAAgB,gBAAgB,EACjC,KAAK,iBAAiB,KAAA,MACxB,KAAK,aAAa,YAAY,KAAK,aAAa,EAChD,KAAK,eAAe,KAAA;AAI1B,SAAM,OAAO,EAAkB;;;AAGnC,WApCG,EAAS;EAAE,MAAM;EAAS,SAAS;EAAM,CAAC,CAAA,EAAA,EAAA,WAAA,YAAA,KAAA,EAAA,EAoCtC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
export { DisabledMixin, type DisabledInterface } from './disabled-mixin.js';
|
|
13
|
+
export { LINEAR_PROGRESS_LABEL_POSITIONS, LINEAR_PROGRESS_STATIC_COLORS, LINEAR_PROGRESS_VALID_SIZES, LinearProgressMixin, type LinearProgressInterface, type LinearProgressLabelPosition, type LinearProgressSize, type LinearProgressStaticColor, } from './linear-progress-mixin.js';
|
|
14
|
+
export { PendingMixin, type PendingInterface } from './pending-mixin.js';
|
|
15
|
+
export { DEFAULT_ELEMENT_SIZES, ELEMENT_SIZES, SizedMixin, } from './sized-mixin.js';
|
|
16
|
+
export type { DefaultElementSize, ElementSize, SizedElementConstructor, SizedElementInterface, } from './sized-mixin.js';
|