@ni/fast-foundation 0.0.2
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 +58 -0
- package/dist/dts/accordion/accordion.d.ts +65 -0
- package/dist/dts/accordion/accordion.template.d.ts +8 -0
- package/dist/dts/accordion/index.d.ts +2 -0
- package/dist/dts/accordion-item/accordion-item.d.ts +76 -0
- package/dist/dts/accordion-item/accordion-item.template.d.ts +8 -0
- package/dist/dts/accordion-item/index.d.ts +2 -0
- package/dist/dts/anchor/anchor.d.ts +128 -0
- package/dist/dts/anchor/anchor.template.d.ts +8 -0
- package/dist/dts/anchor/index.d.ts +2 -0
- package/dist/dts/anchored-region/anchored-region-config.d.ts +117 -0
- package/dist/dts/anchored-region/anchored-region.d.ts +389 -0
- package/dist/dts/anchored-region/anchored-region.template.d.ts +8 -0
- package/dist/dts/anchored-region/index.d.ts +3 -0
- package/dist/dts/avatar/avatar.d.ts +62 -0
- package/dist/dts/avatar/avatar.template.d.ts +8 -0
- package/dist/dts/avatar/index.d.ts +2 -0
- package/dist/dts/badge/badge.d.ts +36 -0
- package/dist/dts/badge/badge.template.d.ts +8 -0
- package/dist/dts/badge/index.d.ts +2 -0
- package/dist/dts/breadcrumb/breadcrumb.d.ts +27 -0
- package/dist/dts/breadcrumb/breadcrumb.template.d.ts +8 -0
- package/dist/dts/breadcrumb/index.d.ts +2 -0
- package/dist/dts/breadcrumb-item/breadcrumb-item.d.ts +36 -0
- package/dist/dts/breadcrumb-item/breadcrumb-item.template.d.ts +8 -0
- package/dist/dts/breadcrumb-item/index.d.ts +2 -0
- package/dist/dts/button/button.d.ts +167 -0
- package/dist/dts/button/button.form-associated.d.ts +16 -0
- package/dist/dts/button/button.template.d.ts +8 -0
- package/dist/dts/button/index.d.ts +2 -0
- package/dist/dts/calendar/calendar.d.ts +178 -0
- package/dist/dts/calendar/calendar.template.d.ts +58 -0
- package/dist/dts/calendar/date-formatter.d.ts +124 -0
- package/dist/dts/calendar/index.d.ts +3 -0
- package/dist/dts/card/card.d.ts +10 -0
- package/dist/dts/card/card.template.d.ts +8 -0
- package/dist/dts/card/index.d.ts +2 -0
- package/dist/dts/checkbox/checkbox.d.ts +58 -0
- package/dist/dts/checkbox/checkbox.form-associated.d.ts +16 -0
- package/dist/dts/checkbox/checkbox.template.d.ts +8 -0
- package/dist/dts/checkbox/index.d.ts +2 -0
- package/dist/dts/combobox/combobox.d.ts +341 -0
- package/dist/dts/combobox/combobox.form-associated.d.ts +16 -0
- package/dist/dts/combobox/combobox.options.d.ts +15 -0
- package/dist/dts/combobox/combobox.template.d.ts +8 -0
- package/dist/dts/combobox/index.d.ts +3 -0
- package/dist/dts/data-grid/data-grid-cell.d.ts +62 -0
- package/dist/dts/data-grid/data-grid-cell.template.d.ts +9 -0
- package/dist/dts/data-grid/data-grid-row.d.ts +119 -0
- package/dist/dts/data-grid/data-grid-row.template.d.ts +10 -0
- package/dist/dts/data-grid/data-grid.d.ts +218 -0
- package/dist/dts/data-grid/data-grid.options.d.ts +49 -0
- package/dist/dts/data-grid/data-grid.template.d.ts +10 -0
- package/dist/dts/data-grid/index.d.ts +6 -0
- package/dist/dts/design-system/component-presentation.d.ts +66 -0
- package/dist/dts/design-system/design-system.d.ts +104 -0
- package/dist/dts/design-system/index.d.ts +3 -0
- package/dist/dts/design-system/registration-context.d.ts +106 -0
- package/dist/dts/design-token/custom-property-manager.d.ts +35 -0
- package/dist/dts/design-token/design-token.d.ts +139 -0
- package/dist/dts/design-token/interfaces.d.ts +31 -0
- package/dist/dts/di/di.d.ts +858 -0
- package/dist/dts/di/index.d.ts +1 -0
- package/dist/dts/dialog/dialog.d.ts +153 -0
- package/dist/dts/dialog/dialog.template.d.ts +8 -0
- package/dist/dts/dialog/index.d.ts +2 -0
- package/dist/dts/directives/reflect-attributes.d.ts +18 -0
- package/dist/dts/disclosure/disclosure.d.ts +59 -0
- package/dist/dts/disclosure/disclosure.template.d.ts +8 -0
- package/dist/dts/disclosure/index.d.ts +2 -0
- package/dist/dts/divider/divider.d.ts +28 -0
- package/dist/dts/divider/divider.options.d.ts +19 -0
- package/dist/dts/divider/divider.template.d.ts +8 -0
- package/dist/dts/divider/index.d.ts +2 -0
- package/dist/dts/flipper/flipper.d.ts +57 -0
- package/dist/dts/flipper/flipper.options.d.ts +13 -0
- package/dist/dts/flipper/flipper.template.d.ts +8 -0
- package/dist/dts/flipper/index.d.ts +2 -0
- package/dist/dts/form-associated/form-associated.d.ts +177 -0
- package/dist/dts/form-associated/index.d.ts +1 -0
- package/dist/dts/foundation-element/foundation-element.d.ts +120 -0
- package/dist/dts/foundation-element/index.d.ts +1 -0
- package/dist/dts/horizontal-scroll/horizontal-scroll.d.ts +242 -0
- package/dist/dts/horizontal-scroll/horizontal-scroll.template.d.ts +7 -0
- package/dist/dts/horizontal-scroll/index.d.ts +2 -0
- package/dist/dts/index-rollup.d.ts +2 -0
- package/dist/dts/index.d.ts +53 -0
- package/dist/dts/interfaces.d.ts +4 -0
- package/dist/dts/listbox/index.d.ts +3 -0
- package/dist/dts/listbox/listbox.d.ts +314 -0
- package/dist/dts/listbox/listbox.element.d.ts +223 -0
- package/dist/dts/listbox/listbox.template.d.ts +8 -0
- package/dist/dts/listbox-option/index.d.ts +2 -0
- package/dist/dts/listbox-option/listbox-option.d.ts +176 -0
- package/dist/dts/listbox-option/listbox-option.template.d.ts +8 -0
- package/dist/dts/menu/index.d.ts +2 -0
- package/dist/dts/menu/menu.d.ts +78 -0
- package/dist/dts/menu/menu.template.d.ts +8 -0
- package/dist/dts/menu-item/index.d.ts +2 -0
- package/dist/dts/menu-item/menu-item.d.ts +160 -0
- package/dist/dts/menu-item/menu-item.options.d.ts +29 -0
- package/dist/dts/menu-item/menu-item.template.d.ts +10 -0
- package/dist/dts/number-field/index.d.ts +2 -0
- package/dist/dts/number-field/number-field.d.ts +227 -0
- package/dist/dts/number-field/number-field.form-associated.d.ts +16 -0
- package/dist/dts/number-field/number-field.template.d.ts +8 -0
- package/dist/dts/patterns/aria-global.d.ts +189 -0
- package/dist/dts/patterns/index.d.ts +2 -0
- package/dist/dts/patterns/start-end.d.ts +65 -0
- package/dist/dts/picker/index.d.ts +10 -0
- package/dist/dts/picker/picker-list-item.d.ts +38 -0
- package/dist/dts/picker/picker-list-item.template.d.ts +8 -0
- package/dist/dts/picker/picker-list.d.ts +8 -0
- package/dist/dts/picker/picker-list.template.d.ts +8 -0
- package/dist/dts/picker/picker-menu-option.d.ts +37 -0
- package/dist/dts/picker/picker-menu-option.template.d.ts +8 -0
- package/dist/dts/picker/picker-menu.d.ts +46 -0
- package/dist/dts/picker/picker-menu.template.d.ts +8 -0
- package/dist/dts/picker/picker.d.ts +390 -0
- package/dist/dts/picker/picker.form-associated.d.ts +16 -0
- package/dist/dts/picker/picker.template.d.ts +8 -0
- package/dist/dts/progress/base-progress.d.ts +71 -0
- package/dist/dts/progress/index.d.ts +2 -0
- package/dist/dts/progress/progress.template.d.ts +8 -0
- package/dist/dts/progress-ring/index.d.ts +1 -0
- package/dist/dts/progress-ring/progress-ring.template.d.ts +8 -0
- package/dist/dts/radio/index.d.ts +2 -0
- package/dist/dts/radio/radio.d.ts +70 -0
- package/dist/dts/radio/radio.form-associated.d.ts +16 -0
- package/dist/dts/radio/radio.template.d.ts +8 -0
- package/dist/dts/radio-group/index.d.ts +2 -0
- package/dist/dts/radio-group/radio-group.d.ts +101 -0
- package/dist/dts/radio-group/radio-group.template.d.ts +8 -0
- package/dist/dts/search/index.d.ts +2 -0
- package/dist/dts/search/search.d.ts +162 -0
- package/dist/dts/search/search.form-associated.d.ts +16 -0
- package/dist/dts/search/search.template.d.ts +8 -0
- package/dist/dts/select/index.d.ts +3 -0
- package/dist/dts/select/select.d.ts +289 -0
- package/dist/dts/select/select.form-associated.d.ts +16 -0
- package/dist/dts/select/select.options.d.ts +13 -0
- package/dist/dts/select/select.template.d.ts +8 -0
- package/dist/dts/skeleton/index.d.ts +2 -0
- package/dist/dts/skeleton/skeleton.d.ts +47 -0
- package/dist/dts/skeleton/skeleton.template.d.ts +8 -0
- package/dist/dts/slider/index.d.ts +2 -0
- package/dist/dts/slider/slider-utilities.d.ts +5 -0
- package/dist/dts/slider/slider.d.ts +230 -0
- package/dist/dts/slider/slider.form-associated.d.ts +16 -0
- package/dist/dts/slider/slider.template.d.ts +8 -0
- package/dist/dts/slider-label/index.d.ts +2 -0
- package/dist/dts/slider-label/slider-label.d.ts +81 -0
- package/dist/dts/slider-label/slider-label.template.d.ts +8 -0
- package/dist/dts/switch/index.d.ts +2 -0
- package/dist/dts/switch/switch.d.ts +60 -0
- package/dist/dts/switch/switch.form-associated.d.ts +16 -0
- package/dist/dts/switch/switch.template.d.ts +8 -0
- package/dist/dts/tab/index.d.ts +2 -0
- package/dist/dts/tab/tab.d.ts +17 -0
- package/dist/dts/tab/tab.template.d.ts +8 -0
- package/dist/dts/tab-panel/index.d.ts +2 -0
- package/dist/dts/tab-panel/tab-panel.d.ts +10 -0
- package/dist/dts/tab-panel/tab-panel.template.d.ts +8 -0
- package/dist/dts/tabs/index.d.ts +2 -0
- package/dist/dts/tabs/tabs.d.ts +140 -0
- package/dist/dts/tabs/tabs.template.d.ts +8 -0
- package/dist/dts/test-utilities/fixture.d.ts +89 -0
- package/dist/dts/test-utilities/timeout.d.ts +4 -0
- package/dist/dts/text-area/index.d.ts +2 -0
- package/dist/dts/text-area/text-area.d.ts +149 -0
- package/dist/dts/text-area/text-area.form-associated.d.ts +16 -0
- package/dist/dts/text-area/text-area.options.d.ts +27 -0
- package/dist/dts/text-area/text-area.template.d.ts +8 -0
- package/dist/dts/text-field/index.d.ts +2 -0
- package/dist/dts/text-field/text-field.d.ts +166 -0
- package/dist/dts/text-field/text-field.form-associated.d.ts +16 -0
- package/dist/dts/text-field/text-field.options.d.ts +31 -0
- package/dist/dts/text-field/text-field.template.d.ts +8 -0
- package/dist/dts/toolbar/index.d.ts +2 -0
- package/dist/dts/toolbar/toolbar.d.ts +167 -0
- package/dist/dts/toolbar/toolbar.template.d.ts +9 -0
- package/dist/dts/tooltip/index.d.ts +2 -0
- package/dist/dts/tooltip/tooltip.d.ts +239 -0
- package/dist/dts/tooltip/tooltip.options.d.ts +69 -0
- package/dist/dts/tooltip/tooltip.template.d.ts +8 -0
- package/dist/dts/tree-item/index.d.ts +2 -0
- package/dist/dts/tree-item/tree-item.d.ts +141 -0
- package/dist/dts/tree-item/tree-item.template.d.ts +8 -0
- package/dist/dts/tree-view/index.d.ts +2 -0
- package/dist/dts/tree-view/tree-view.d.ts +99 -0
- package/dist/dts/tree-view/tree-view.template.d.ts +8 -0
- package/dist/dts/utilities/apply-mixins.d.ts +6 -0
- package/dist/dts/utilities/composed-contains.d.ts +12 -0
- package/dist/dts/utilities/composed-parent.d.ts +10 -0
- package/dist/dts/utilities/direction.d.ts +7 -0
- package/dist/dts/utilities/index.d.ts +8 -0
- package/dist/dts/utilities/intersection-service.d.ts +30 -0
- package/dist/dts/utilities/match-media-stylesheet-behavior.d.ts +124 -0
- package/dist/dts/utilities/property-stylesheet-behavior.d.ts +38 -0
- package/dist/dts/utilities/resize-observer.d.ts +31 -0
- package/dist/dts/utilities/root-active-element.d.ts +1 -0
- package/dist/dts/utilities/style/disabled.d.ts +5 -0
- package/dist/dts/utilities/style/display.d.ts +17 -0
- package/dist/dts/utilities/style/focus.d.ts +8 -0
- package/dist/dts/utilities/style/index.d.ts +3 -0
- package/dist/dts/utilities/whitespace-filter.d.ts +9 -0
- package/dist/esm/accordion/accordion.js +185 -0
- package/dist/esm/accordion/accordion.template.js +11 -0
- package/dist/esm/accordion/index.js +2 -0
- package/dist/esm/accordion-item/accordion-item.js +72 -0
- package/dist/esm/accordion-item/accordion-item.template.js +49 -0
- package/dist/esm/accordion-item/index.js +2 -0
- package/dist/esm/anchor/anchor.js +85 -0
- package/dist/esm/anchor/anchor.template.js +47 -0
- package/dist/esm/anchor/index.js +2 -0
- package/dist/esm/anchored-region/anchored-region-config.js +59 -0
- package/dist/esm/anchored-region/anchored-region.js +964 -0
- package/dist/esm/anchored-region/anchored-region.template.js +12 -0
- package/dist/esm/anchored-region/index.js +3 -0
- package/dist/esm/avatar/avatar.js +39 -0
- package/dist/esm/avatar/avatar.template.js +23 -0
- package/dist/esm/avatar/index.js +2 -0
- package/dist/esm/badge/badge.js +40 -0
- package/dist/esm/badge/badge.template.js +12 -0
- package/dist/esm/badge/index.js +2 -0
- package/dist/esm/breadcrumb/breadcrumb.js +70 -0
- package/dist/esm/breadcrumb/breadcrumb.template.js +14 -0
- package/dist/esm/breadcrumb/index.js +2 -0
- package/dist/esm/breadcrumb-item/breadcrumb-item.js +23 -0
- package/dist/esm/breadcrumb-item/breadcrumb-item.template.js +24 -0
- package/dist/esm/breadcrumb-item/index.js +2 -0
- package/dist/esm/button/button.form-associated.js +15 -0
- package/dist/esm/button/button.js +183 -0
- package/dist/esm/button/button.template.js +51 -0
- package/dist/esm/button/index.js +2 -0
- package/dist/esm/calendar/calendar.js +280 -0
- package/dist/esm/calendar/calendar.template.js +191 -0
- package/dist/esm/calendar/date-formatter.js +144 -0
- package/dist/esm/calendar/index.js +3 -0
- package/dist/esm/card/card.js +10 -0
- package/dist/esm/card/card.template.js +8 -0
- package/dist/esm/card/index.js +2 -0
- package/dist/esm/checkbox/checkbox.form-associated.js +15 -0
- package/dist/esm/checkbox/checkbox.js +75 -0
- package/dist/esm/checkbox/checkbox.template.js +35 -0
- package/dist/esm/checkbox/index.js +2 -0
- package/dist/esm/combobox/combobox.form-associated.js +15 -0
- package/dist/esm/combobox/combobox.js +587 -0
- package/dist/esm/combobox/combobox.options.js +10 -0
- package/dist/esm/combobox/combobox.template.js +66 -0
- package/dist/esm/combobox/index.js +3 -0
- package/dist/esm/data-grid/data-grid-cell.js +229 -0
- package/dist/esm/data-grid/data-grid-cell.template.js +23 -0
- package/dist/esm/data-grid/data-grid-row.js +203 -0
- package/dist/esm/data-grid/data-grid-row.template.js +47 -0
- package/dist/esm/data-grid/data-grid.js +440 -0
- package/dist/esm/data-grid/data-grid.options.js +31 -0
- package/dist/esm/data-grid/data-grid.template.js +36 -0
- package/dist/esm/data-grid/index.js +6 -0
- package/dist/esm/design-system/component-presentation.js +86 -0
- package/dist/esm/design-system/design-system.js +207 -0
- package/dist/esm/design-system/index.js +3 -0
- package/dist/esm/design-system/registration-context.js +1 -0
- package/dist/esm/design-token/custom-property-manager.js +216 -0
- package/dist/esm/design-token/design-token.js +657 -0
- package/dist/esm/design-token/interfaces.js +1 -0
- package/dist/esm/di/di.js +1341 -0
- package/dist/esm/di/index.js +1 -0
- package/dist/esm/dialog/dialog.js +280 -0
- package/dist/esm/dialog/dialog.template.js +30 -0
- package/dist/esm/dialog/index.js +2 -0
- package/dist/esm/directives/reflect-attributes.js +88 -0
- package/dist/esm/disclosure/disclosure.js +72 -0
- package/dist/esm/disclosure/disclosure.template.js +20 -0
- package/dist/esm/disclosure/index.js +2 -0
- package/dist/esm/divider/divider.js +39 -0
- package/dist/esm/divider/divider.options.js +14 -0
- package/dist/esm/divider/divider.template.js +8 -0
- package/dist/esm/divider/index.js +2 -0
- package/dist/esm/flipper/flipper.js +65 -0
- package/dist/esm/flipper/flipper.options.js +8 -0
- package/dist/esm/flipper/flipper.template.js +30 -0
- package/dist/esm/flipper/index.js +2 -0
- package/dist/esm/form-associated/form-associated.js +464 -0
- package/dist/esm/form-associated/index.js +1 -0
- package/dist/esm/foundation-element/foundation-element.js +132 -0
- package/dist/esm/foundation-element/index.js +1 -0
- package/dist/esm/horizontal-scroll/horizontal-scroll.js +380 -0
- package/dist/esm/horizontal-scroll/horizontal-scroll.template.js +62 -0
- package/dist/esm/horizontal-scroll/index.js +2 -0
- package/dist/esm/index-rollup.js +2 -0
- package/dist/esm/index.js +54 -0
- package/dist/esm/interfaces.js +1 -0
- package/dist/esm/listbox/index.js +3 -0
- package/dist/esm/listbox/listbox.element.js +448 -0
- package/dist/esm/listbox/listbox.js +528 -0
- package/dist/esm/listbox/listbox.template.js +27 -0
- package/dist/esm/listbox-option/index.js +2 -0
- package/dist/esm/listbox-option/listbox-option.js +200 -0
- package/dist/esm/listbox-option/listbox-option.template.js +25 -0
- package/dist/esm/menu/index.js +2 -0
- package/dist/esm/menu/menu.js +290 -0
- package/dist/esm/menu/menu.template.js +15 -0
- package/dist/esm/menu-item/index.js +2 -0
- package/dist/esm/menu-item/menu-item.js +251 -0
- package/dist/esm/menu-item/menu-item.options.js +26 -0
- package/dist/esm/menu-item/menu-item.template.js +78 -0
- package/dist/esm/number-field/index.js +2 -0
- package/dist/esm/number-field/number-field.form-associated.js +15 -0
- package/dist/esm/number-field/number-field.js +288 -0
- package/dist/esm/number-field/number-field.template.js +84 -0
- package/dist/esm/patterns/aria-global.js +70 -0
- package/dist/esm/patterns/index.js +2 -0
- package/dist/esm/patterns/start-end.js +84 -0
- package/dist/esm/picker/index.js +10 -0
- package/dist/esm/picker/picker-list-item.js +71 -0
- package/dist/esm/picker/picker-list-item.template.js +17 -0
- package/dist/esm/picker/picker-list.js +8 -0
- package/dist/esm/picker/picker-list.template.js +13 -0
- package/dist/esm/picker/picker-menu-option.js +61 -0
- package/dist/esm/picker/picker-menu-option.template.js +16 -0
- package/dist/esm/picker/picker-menu.js +59 -0
- package/dist/esm/picker/picker-menu.template.js +29 -0
- package/dist/esm/picker/picker.form-associated.js +15 -0
- package/dist/esm/picker/picker.js +759 -0
- package/dist/esm/picker/picker.template.js +97 -0
- package/dist/esm/progress/base-progress.js +69 -0
- package/dist/esm/progress/index.js +2 -0
- package/dist/esm/progress/progress.template.js +31 -0
- package/dist/esm/progress-ring/index.js +1 -0
- package/dist/esm/progress-ring/progress-ring.template.js +45 -0
- package/dist/esm/radio/index.js +2 -0
- package/dist/esm/radio/radio.form-associated.js +15 -0
- package/dist/esm/radio/radio.js +108 -0
- package/dist/esm/radio/radio.template.js +31 -0
- package/dist/esm/radio-group/index.js +2 -0
- package/dist/esm/radio-group/radio-group.js +390 -0
- package/dist/esm/radio-group/radio-group.template.js +29 -0
- package/dist/esm/search/index.js +2 -0
- package/dist/esm/search/search.form-associated.js +15 -0
- package/dist/esm/search/search.js +157 -0
- package/dist/esm/search/search.template.js +93 -0
- package/dist/esm/select/index.js +3 -0
- package/dist/esm/select/select.form-associated.js +15 -0
- package/dist/esm/select/select.js +490 -0
- package/dist/esm/select/select.options.js +8 -0
- package/dist/esm/select/select.template.js +72 -0
- package/dist/esm/skeleton/index.js +2 -0
- package/dist/esm/skeleton/skeleton.js +35 -0
- package/dist/esm/skeleton/skeleton.template.js +20 -0
- package/dist/esm/slider/index.js +2 -0
- package/dist/esm/slider/slider-utilities.js +11 -0
- package/dist/esm/slider/slider.form-associated.js +15 -0
- package/dist/esm/slider/slider.js +452 -0
- package/dist/esm/slider/slider.template.js +40 -0
- package/dist/esm/slider-label/index.js +2 -0
- package/dist/esm/slider-label/slider-label.js +158 -0
- package/dist/esm/slider-label/slider-label.template.js +24 -0
- package/dist/esm/switch/index.js +2 -0
- package/dist/esm/switch/switch.form-associated.js +15 -0
- package/dist/esm/switch/switch.js +79 -0
- package/dist/esm/switch/switch.template.js +37 -0
- package/dist/esm/tab/index.js +2 -0
- package/dist/esm/tab/tab.js +15 -0
- package/dist/esm/tab/tab.template.js +10 -0
- package/dist/esm/tab-panel/index.js +2 -0
- package/dist/esm/tab-panel/tab-panel.js +10 -0
- package/dist/esm/tab-panel/tab-panel.template.js +10 -0
- package/dist/esm/tabs/index.js +2 -0
- package/dist/esm/tabs/tabs.js +375 -0
- package/dist/esm/tabs/tabs.template.js +26 -0
- package/dist/esm/test-utilities/fixture.js +90 -0
- package/dist/esm/test-utilities/timeout.js +13 -0
- package/dist/esm/text-area/index.js +2 -0
- package/dist/esm/text-area/text-area.form-associated.js +15 -0
- package/dist/esm/text-area/text-area.js +146 -0
- package/dist/esm/text-area/text-area.options.js +22 -0
- package/dist/esm/text-area/text-area.template.js +64 -0
- package/dist/esm/text-field/index.js +2 -0
- package/dist/esm/text-field/text-field.form-associated.js +15 -0
- package/dist/esm/text-field/text-field.js +183 -0
- package/dist/esm/text-field/text-field.options.js +26 -0
- package/dist/esm/text-field/text-field.template.js +70 -0
- package/dist/esm/toolbar/index.js +2 -0
- package/dist/esm/toolbar/toolbar.js +271 -0
- package/dist/esm/toolbar/toolbar.template.js +37 -0
- package/dist/esm/tooltip/index.js +2 -0
- package/dist/esm/tooltip/tooltip.js +512 -0
- package/dist/esm/tooltip/tooltip.options.js +63 -0
- package/dist/esm/tooltip/tooltip.template.js +32 -0
- package/dist/esm/tree-item/index.js +2 -0
- package/dist/esm/tree-item/tree-item.js +150 -0
- package/dist/esm/tree-item/tree-item.template.js +52 -0
- package/dist/esm/tree-view/index.js +2 -0
- package/dist/esm/tree-view/tree-view.js +268 -0
- package/dist/esm/tree-view/tree-view.template.js +18 -0
- package/dist/esm/utilities/apply-mixins.js +20 -0
- package/dist/esm/utilities/composed-contains.js +22 -0
- package/dist/esm/utilities/composed-parent.js +23 -0
- package/dist/esm/utilities/direction.js +10 -0
- package/dist/esm/utilities/index.js +8 -0
- package/dist/esm/utilities/intersection-service.js +91 -0
- package/dist/esm/utilities/match-media-stylesheet-behavior.js +140 -0
- package/dist/esm/utilities/property-stylesheet-behavior.js +52 -0
- package/dist/esm/utilities/resize-observer.js +5 -0
- package/dist/esm/utilities/root-active-element.js +8 -0
- package/dist/esm/utilities/style/disabled.js +5 -0
- package/dist/esm/utilities/style/display.js +14 -0
- package/dist/esm/utilities/style/focus.js +9 -0
- package/dist/esm/utilities/style/index.js +3 -0
- package/dist/esm/utilities/whitespace-filter.js +13 -0
- package/dist/fast-foundation.d.ts +9744 -0
- package/dist/fast-foundation.js +19097 -0
- package/dist/fast-foundation.min.js +19 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/package.json +101 -0
|
@@ -0,0 +1,657 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { CSSDirective, defaultExecutionContext, FASTElement, observable, Observable, } from "@ni/fast-element";
|
|
3
|
+
import { composedParent } from "../utilities/composed-parent.js";
|
|
4
|
+
import { composedContains } from "../utilities/composed-contains.js";
|
|
5
|
+
import { PropertyTargetManager, RootStyleSheetTarget, } from "./custom-property-manager.js";
|
|
6
|
+
import { defaultElement } from "./custom-property-manager.js";
|
|
7
|
+
/**
|
|
8
|
+
* Implementation of {@link (DesignToken:interface)}
|
|
9
|
+
*/
|
|
10
|
+
class DesignTokenImpl extends CSSDirective {
|
|
11
|
+
get appliedTo() {
|
|
12
|
+
return [...this._appliedTo];
|
|
13
|
+
}
|
|
14
|
+
static from(nameOrConfig) {
|
|
15
|
+
return new DesignTokenImpl({
|
|
16
|
+
name: typeof nameOrConfig === "string" ? nameOrConfig : nameOrConfig.name,
|
|
17
|
+
cssCustomPropertyName: typeof nameOrConfig === "string"
|
|
18
|
+
? nameOrConfig
|
|
19
|
+
: nameOrConfig.cssCustomPropertyName === void 0
|
|
20
|
+
? nameOrConfig.name
|
|
21
|
+
: nameOrConfig.cssCustomPropertyName,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
static isCSSDesignToken(token) {
|
|
25
|
+
return typeof token.cssCustomProperty === "string";
|
|
26
|
+
}
|
|
27
|
+
static isDerivedDesignTokenValue(value) {
|
|
28
|
+
return typeof value === "function";
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Gets a token by ID. Returns undefined if the token was not found.
|
|
32
|
+
* @param id - The ID of the token
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
static getTokenById(id) {
|
|
36
|
+
return DesignTokenImpl.tokensById.get(id);
|
|
37
|
+
}
|
|
38
|
+
getOrCreateSubscriberSet(target = this) {
|
|
39
|
+
return (this.subscribers.get(target) ||
|
|
40
|
+
(this.subscribers.set(target, new Set()) && this.subscribers.get(target)));
|
|
41
|
+
}
|
|
42
|
+
constructor(configuration) {
|
|
43
|
+
super();
|
|
44
|
+
this.subscribers = new WeakMap();
|
|
45
|
+
this._appliedTo = new Set();
|
|
46
|
+
this.name = configuration.name;
|
|
47
|
+
if (configuration.cssCustomPropertyName !== null) {
|
|
48
|
+
this.cssCustomProperty = `--${configuration.cssCustomPropertyName}`;
|
|
49
|
+
this.cssVar = `var(${this.cssCustomProperty})`;
|
|
50
|
+
}
|
|
51
|
+
this.id = DesignTokenImpl.uniqueId();
|
|
52
|
+
DesignTokenImpl.tokensById.set(this.id, this);
|
|
53
|
+
}
|
|
54
|
+
createCSS() {
|
|
55
|
+
return this.cssVar || "";
|
|
56
|
+
}
|
|
57
|
+
getValueFor(element) {
|
|
58
|
+
const value = DesignTokenNode.getOrCreate(element).get(this);
|
|
59
|
+
if (value !== undefined) {
|
|
60
|
+
return value;
|
|
61
|
+
}
|
|
62
|
+
throw new Error(`Value could not be retrieved for token named "${this.name}". Ensure the value is set for ${element} or an ancestor of ${element}.`);
|
|
63
|
+
}
|
|
64
|
+
setValueFor(element, value) {
|
|
65
|
+
this._appliedTo.add(element);
|
|
66
|
+
if (value instanceof DesignTokenImpl) {
|
|
67
|
+
value = this.alias(value);
|
|
68
|
+
}
|
|
69
|
+
DesignTokenNode.getOrCreate(element).set(this, value);
|
|
70
|
+
return this;
|
|
71
|
+
}
|
|
72
|
+
deleteValueFor(element) {
|
|
73
|
+
this._appliedTo.delete(element);
|
|
74
|
+
if (DesignTokenNode.existsFor(element)) {
|
|
75
|
+
DesignTokenNode.getOrCreate(element).delete(this);
|
|
76
|
+
}
|
|
77
|
+
return this;
|
|
78
|
+
}
|
|
79
|
+
withDefault(value) {
|
|
80
|
+
this.setValueFor(defaultElement, value);
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
83
|
+
subscribe(subscriber, target) {
|
|
84
|
+
const subscriberSet = this.getOrCreateSubscriberSet(target);
|
|
85
|
+
if (target && !DesignTokenNode.existsFor(target)) {
|
|
86
|
+
DesignTokenNode.getOrCreate(target);
|
|
87
|
+
}
|
|
88
|
+
if (!subscriberSet.has(subscriber)) {
|
|
89
|
+
subscriberSet.add(subscriber);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
unsubscribe(subscriber, target) {
|
|
93
|
+
const list = this.subscribers.get(target || this);
|
|
94
|
+
if (list && list.has(subscriber)) {
|
|
95
|
+
list.delete(subscriber);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Notifies subscribers that the value for an element has changed.
|
|
100
|
+
* @param element - The element to emit a notification for
|
|
101
|
+
*/
|
|
102
|
+
notify(element) {
|
|
103
|
+
const record = Object.freeze({ token: this, target: element });
|
|
104
|
+
if (this.subscribers.has(this)) {
|
|
105
|
+
this.subscribers.get(this).forEach(sub => sub.handleChange(record));
|
|
106
|
+
}
|
|
107
|
+
if (this.subscribers.has(element)) {
|
|
108
|
+
this.subscribers.get(element).forEach(sub => sub.handleChange(record));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Alias the token to the provided token.
|
|
113
|
+
* @param token - the token to alias to
|
|
114
|
+
*/
|
|
115
|
+
alias(token) {
|
|
116
|
+
return ((target) => token.getValueFor(target));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
DesignTokenImpl.uniqueId = (() => {
|
|
120
|
+
let id = 0;
|
|
121
|
+
return () => {
|
|
122
|
+
id++;
|
|
123
|
+
return id.toString(16);
|
|
124
|
+
};
|
|
125
|
+
})();
|
|
126
|
+
/**
|
|
127
|
+
* Token storage by token ID
|
|
128
|
+
*/
|
|
129
|
+
DesignTokenImpl.tokensById = new Map();
|
|
130
|
+
class CustomPropertyReflector {
|
|
131
|
+
startReflection(token, target) {
|
|
132
|
+
token.subscribe(this, target);
|
|
133
|
+
this.handleChange({ token, target });
|
|
134
|
+
}
|
|
135
|
+
stopReflection(token, target) {
|
|
136
|
+
token.unsubscribe(this, target);
|
|
137
|
+
this.remove(token, target);
|
|
138
|
+
}
|
|
139
|
+
handleChange(record) {
|
|
140
|
+
const { token, target } = record;
|
|
141
|
+
this.add(token, target);
|
|
142
|
+
}
|
|
143
|
+
add(token, target) {
|
|
144
|
+
PropertyTargetManager.getOrCreate(target).setProperty(token.cssCustomProperty, this.resolveCSSValue(DesignTokenNode.getOrCreate(target).get(token)));
|
|
145
|
+
}
|
|
146
|
+
remove(token, target) {
|
|
147
|
+
PropertyTargetManager.getOrCreate(target).removeProperty(token.cssCustomProperty);
|
|
148
|
+
}
|
|
149
|
+
resolveCSSValue(value) {
|
|
150
|
+
return value && typeof value.createCSS === "function" ? value.createCSS() : value;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* A light wrapper around BindingObserver to handle value caching and
|
|
155
|
+
* token notification
|
|
156
|
+
*/
|
|
157
|
+
class DesignTokenBindingObserver {
|
|
158
|
+
constructor(source, token, node) {
|
|
159
|
+
this.source = source;
|
|
160
|
+
this.token = token;
|
|
161
|
+
this.node = node;
|
|
162
|
+
this.dependencies = new Set();
|
|
163
|
+
this.observer = Observable.binding(source, this, false);
|
|
164
|
+
// This is a little bit hacky because it's using internal APIs of BindingObserverImpl.
|
|
165
|
+
// BindingObserverImpl queues updates to batch it's notifications which doesn't work for this
|
|
166
|
+
// scenario because the DesignToken.getValueFor API is not async. Without this, using DesignToken.getValueFor()
|
|
167
|
+
// after DesignToken.setValueFor() when setting a dependency of the value being retrieved can return a stale
|
|
168
|
+
// value. Assigning .handleChange to .call forces immediate invocation of this classes handleChange() method,
|
|
169
|
+
// allowing resolution of values synchronously.
|
|
170
|
+
// TODO: https://github.com/microsoft/fast/issues/5110
|
|
171
|
+
this.observer.handleChange = this.observer.call;
|
|
172
|
+
this.handleChange();
|
|
173
|
+
}
|
|
174
|
+
disconnect() {
|
|
175
|
+
this.observer.disconnect();
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* @internal
|
|
179
|
+
*/
|
|
180
|
+
handleChange() {
|
|
181
|
+
try {
|
|
182
|
+
this.node.store.set(this.token, this.observer.observe(this.node.target, defaultExecutionContext));
|
|
183
|
+
}
|
|
184
|
+
catch (e) {
|
|
185
|
+
console.error(e);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Stores resolved token/value pairs and notifies on changes
|
|
191
|
+
*/
|
|
192
|
+
class Store {
|
|
193
|
+
constructor() {
|
|
194
|
+
this.values = new Map();
|
|
195
|
+
}
|
|
196
|
+
set(token, value) {
|
|
197
|
+
if (this.values.get(token) !== value) {
|
|
198
|
+
this.values.set(token, value);
|
|
199
|
+
Observable.getNotifier(this).notify(token.id);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
get(token) {
|
|
203
|
+
Observable.track(this, token.id);
|
|
204
|
+
return this.values.get(token);
|
|
205
|
+
}
|
|
206
|
+
delete(token) {
|
|
207
|
+
this.values.delete(token);
|
|
208
|
+
Observable.getNotifier(this).notify(token.id);
|
|
209
|
+
}
|
|
210
|
+
all() {
|
|
211
|
+
return this.values.entries();
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
const nodeCache = new WeakMap();
|
|
215
|
+
const childToParent = new WeakMap();
|
|
216
|
+
/**
|
|
217
|
+
* A node responsible for setting and getting token values,
|
|
218
|
+
* emitting values to CSS custom properties, and maintaining
|
|
219
|
+
* inheritance structures.
|
|
220
|
+
*/
|
|
221
|
+
class DesignTokenNode {
|
|
222
|
+
/**
|
|
223
|
+
* Returns a DesignTokenNode for an element.
|
|
224
|
+
* Creates a new instance if one does not already exist for a node,
|
|
225
|
+
* otherwise returns the cached instance
|
|
226
|
+
*
|
|
227
|
+
* @param target - The HTML element to retrieve a DesignTokenNode for
|
|
228
|
+
*/
|
|
229
|
+
static getOrCreate(target) {
|
|
230
|
+
return nodeCache.get(target) || new DesignTokenNode(target);
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Determines if a DesignTokenNode has been created for a target
|
|
234
|
+
* @param target - The element to test
|
|
235
|
+
*/
|
|
236
|
+
static existsFor(target) {
|
|
237
|
+
return nodeCache.has(target);
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Searches for and return the nearest parent DesignTokenNode.
|
|
241
|
+
* Null is returned if no node is found or the node provided is for a default element.
|
|
242
|
+
*/
|
|
243
|
+
static findParent(node) {
|
|
244
|
+
if (!(defaultElement === node.target)) {
|
|
245
|
+
let parent = composedParent(node.target);
|
|
246
|
+
while (parent !== null) {
|
|
247
|
+
if (nodeCache.has(parent)) {
|
|
248
|
+
return nodeCache.get(parent);
|
|
249
|
+
}
|
|
250
|
+
parent = composedParent(parent);
|
|
251
|
+
}
|
|
252
|
+
return DesignTokenNode.getOrCreate(defaultElement);
|
|
253
|
+
}
|
|
254
|
+
return null;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Finds the closest node with a value explicitly assigned for a token, otherwise null.
|
|
258
|
+
* @param token - The token to look for
|
|
259
|
+
* @param start - The node to start looking for value assignment
|
|
260
|
+
* @returns
|
|
261
|
+
*/
|
|
262
|
+
static findClosestAssignedNode(token, start) {
|
|
263
|
+
let current = start;
|
|
264
|
+
do {
|
|
265
|
+
if (current.has(token)) {
|
|
266
|
+
return current;
|
|
267
|
+
}
|
|
268
|
+
current = current.parent
|
|
269
|
+
? current.parent
|
|
270
|
+
: current.target !== defaultElement
|
|
271
|
+
? DesignTokenNode.getOrCreate(defaultElement)
|
|
272
|
+
: null;
|
|
273
|
+
} while (current !== null);
|
|
274
|
+
return null;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* The parent DesignTokenNode, or null.
|
|
278
|
+
*/
|
|
279
|
+
get parent() {
|
|
280
|
+
return childToParent.get(this) || null;
|
|
281
|
+
}
|
|
282
|
+
updateCSSTokenReflection(source, token) {
|
|
283
|
+
if (DesignTokenImpl.isCSSDesignToken(token)) {
|
|
284
|
+
const parent = this.parent;
|
|
285
|
+
const reflecting = this.isReflecting(token);
|
|
286
|
+
if (parent) {
|
|
287
|
+
const parentValue = parent.get(token);
|
|
288
|
+
const sourceValue = source.get(token);
|
|
289
|
+
if (parentValue !== sourceValue && !reflecting) {
|
|
290
|
+
this.reflectToCSS(token);
|
|
291
|
+
}
|
|
292
|
+
else if (parentValue === sourceValue && reflecting) {
|
|
293
|
+
this.stopReflectToCSS(token);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
else if (!reflecting) {
|
|
297
|
+
this.reflectToCSS(token);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
constructor(target) {
|
|
302
|
+
this.target = target;
|
|
303
|
+
/**
|
|
304
|
+
* Stores all resolved token values for a node
|
|
305
|
+
*/
|
|
306
|
+
this.store = new Store();
|
|
307
|
+
/**
|
|
308
|
+
* All children assigned to the node
|
|
309
|
+
*/
|
|
310
|
+
this.children = [];
|
|
311
|
+
/**
|
|
312
|
+
* All values explicitly assigned to the node in their raw form
|
|
313
|
+
*/
|
|
314
|
+
this.assignedValues = new Map();
|
|
315
|
+
/**
|
|
316
|
+
* Tokens currently being reflected to CSS custom properties
|
|
317
|
+
*/
|
|
318
|
+
this.reflecting = new Set();
|
|
319
|
+
/**
|
|
320
|
+
* Binding observers for assigned and inherited derived values.
|
|
321
|
+
*/
|
|
322
|
+
this.bindingObservers = new Map();
|
|
323
|
+
/**
|
|
324
|
+
* Emits notifications to token when token values
|
|
325
|
+
* change the DesignTokenNode
|
|
326
|
+
*/
|
|
327
|
+
this.tokenValueChangeHandler = {
|
|
328
|
+
handleChange: (source, arg) => {
|
|
329
|
+
const token = DesignTokenImpl.getTokenById(arg);
|
|
330
|
+
if (token) {
|
|
331
|
+
// Notify any token subscribers
|
|
332
|
+
token.notify(this.target);
|
|
333
|
+
this.updateCSSTokenReflection(source, token);
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
};
|
|
337
|
+
nodeCache.set(target, this);
|
|
338
|
+
// Map store change notifications to token change notifications
|
|
339
|
+
Observable.getNotifier(this.store).subscribe(this.tokenValueChangeHandler);
|
|
340
|
+
if (target instanceof FASTElement) {
|
|
341
|
+
target.$fastController.addBehaviors([this]);
|
|
342
|
+
}
|
|
343
|
+
else if (target.isConnected) {
|
|
344
|
+
this.bind();
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Checks if a token has been assigned an explicit value the node.
|
|
349
|
+
* @param token - the token to check.
|
|
350
|
+
*/
|
|
351
|
+
has(token) {
|
|
352
|
+
return this.assignedValues.has(token);
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Gets the value of a token for a node
|
|
356
|
+
* @param token - The token to retrieve the value for
|
|
357
|
+
* @returns
|
|
358
|
+
*/
|
|
359
|
+
get(token) {
|
|
360
|
+
const value = this.store.get(token);
|
|
361
|
+
if (value !== undefined) {
|
|
362
|
+
return value;
|
|
363
|
+
}
|
|
364
|
+
const raw = this.getRaw(token);
|
|
365
|
+
if (raw !== undefined) {
|
|
366
|
+
this.hydrate(token, raw);
|
|
367
|
+
return this.get(token);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Retrieves the raw assigned value of a token from the nearest assigned node.
|
|
372
|
+
* @param token - The token to retrieve a raw value for
|
|
373
|
+
* @returns
|
|
374
|
+
*/
|
|
375
|
+
getRaw(token) {
|
|
376
|
+
var _a;
|
|
377
|
+
if (this.assignedValues.has(token)) {
|
|
378
|
+
return this.assignedValues.get(token);
|
|
379
|
+
}
|
|
380
|
+
return (_a = DesignTokenNode.findClosestAssignedNode(token, this)) === null || _a === void 0 ? void 0 : _a.getRaw(token);
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Sets a token to a value for a node
|
|
384
|
+
* @param token - The token to set
|
|
385
|
+
* @param value - The value to set the token to
|
|
386
|
+
*/
|
|
387
|
+
set(token, value) {
|
|
388
|
+
if (DesignTokenImpl.isDerivedDesignTokenValue(this.assignedValues.get(token))) {
|
|
389
|
+
this.tearDownBindingObserver(token);
|
|
390
|
+
}
|
|
391
|
+
this.assignedValues.set(token, value);
|
|
392
|
+
if (DesignTokenImpl.isDerivedDesignTokenValue(value)) {
|
|
393
|
+
this.setupBindingObserver(token, value);
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
this.store.set(token, value);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Deletes a token value for the node.
|
|
401
|
+
* @param token - The token to delete the value for
|
|
402
|
+
*/
|
|
403
|
+
delete(token) {
|
|
404
|
+
this.assignedValues.delete(token);
|
|
405
|
+
this.tearDownBindingObserver(token);
|
|
406
|
+
const upstream = this.getRaw(token);
|
|
407
|
+
if (upstream) {
|
|
408
|
+
this.hydrate(token, upstream);
|
|
409
|
+
}
|
|
410
|
+
else {
|
|
411
|
+
this.store.delete(token);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Invoked when the DesignTokenNode.target is attached to the document
|
|
416
|
+
*/
|
|
417
|
+
bind() {
|
|
418
|
+
const parent = DesignTokenNode.findParent(this);
|
|
419
|
+
if (parent) {
|
|
420
|
+
parent.appendChild(this);
|
|
421
|
+
}
|
|
422
|
+
for (const key of this.assignedValues.keys()) {
|
|
423
|
+
key.notify(this.target);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Invoked when the DesignTokenNode.target is detached from the document
|
|
428
|
+
*/
|
|
429
|
+
unbind() {
|
|
430
|
+
if (this.parent) {
|
|
431
|
+
const parent = childToParent.get(this);
|
|
432
|
+
parent.removeChild(this);
|
|
433
|
+
}
|
|
434
|
+
for (const token of this.bindingObservers.keys()) {
|
|
435
|
+
this.tearDownBindingObserver(token);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Appends a child to a parent DesignTokenNode.
|
|
440
|
+
* @param child - The child to append to the node
|
|
441
|
+
*/
|
|
442
|
+
appendChild(child) {
|
|
443
|
+
if (child.parent) {
|
|
444
|
+
childToParent.get(child).removeChild(child);
|
|
445
|
+
}
|
|
446
|
+
const reParent = this.children.filter(x => child.contains(x));
|
|
447
|
+
childToParent.set(child, this);
|
|
448
|
+
this.children.push(child);
|
|
449
|
+
reParent.forEach(x => child.appendChild(x));
|
|
450
|
+
Observable.getNotifier(this.store).subscribe(child);
|
|
451
|
+
// How can we not notify *every* subscriber?
|
|
452
|
+
for (const [token, value] of this.store.all()) {
|
|
453
|
+
child.hydrate(token, this.bindingObservers.has(token) ? this.getRaw(token) : value);
|
|
454
|
+
// Need to stop reflecting any tokens that can now be inherited
|
|
455
|
+
child.updateCSSTokenReflection(child.store, token);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Removes a child from a node.
|
|
460
|
+
* @param child - The child to remove.
|
|
461
|
+
*/
|
|
462
|
+
removeChild(child) {
|
|
463
|
+
const childIndex = this.children.indexOf(child);
|
|
464
|
+
if (childIndex !== -1) {
|
|
465
|
+
this.children.splice(childIndex, 1);
|
|
466
|
+
}
|
|
467
|
+
Observable.getNotifier(this.store).unsubscribe(child);
|
|
468
|
+
if (child.parent !== this) {
|
|
469
|
+
return false;
|
|
470
|
+
}
|
|
471
|
+
const deleted = childToParent.delete(child);
|
|
472
|
+
for (const [token] of this.store.all()) {
|
|
473
|
+
child.hydrate(token, child.getRaw(token));
|
|
474
|
+
// Need to start reflecting any assigned values that were previously inherited
|
|
475
|
+
child.updateCSSTokenReflection(child.store, token);
|
|
476
|
+
}
|
|
477
|
+
return deleted;
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Tests whether a provided node is contained by
|
|
481
|
+
* the calling node.
|
|
482
|
+
* @param test - The node to test
|
|
483
|
+
*/
|
|
484
|
+
contains(test) {
|
|
485
|
+
return composedContains(this.target, test.target);
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Instructs the node to reflect a design token for the provided token.
|
|
489
|
+
* @param token - The design token to reflect
|
|
490
|
+
*/
|
|
491
|
+
reflectToCSS(token) {
|
|
492
|
+
if (!this.isReflecting(token)) {
|
|
493
|
+
this.reflecting.add(token);
|
|
494
|
+
DesignTokenNode.cssCustomPropertyReflector.startReflection(token, this.target);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Stops reflecting a DesignToken to CSS
|
|
499
|
+
* @param token - The design token to stop reflecting
|
|
500
|
+
*/
|
|
501
|
+
stopReflectToCSS(token) {
|
|
502
|
+
if (this.isReflecting(token)) {
|
|
503
|
+
this.reflecting.delete(token);
|
|
504
|
+
DesignTokenNode.cssCustomPropertyReflector.stopReflection(token, this.target);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Determines if a token is being reflected to CSS for a node.
|
|
509
|
+
* @param token - The token to check for reflection
|
|
510
|
+
* @returns
|
|
511
|
+
*/
|
|
512
|
+
isReflecting(token) {
|
|
513
|
+
return this.reflecting.has(token);
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Handle changes to upstream tokens
|
|
517
|
+
* @param source - The parent DesignTokenNode
|
|
518
|
+
* @param property - The token ID that changed
|
|
519
|
+
*/
|
|
520
|
+
handleChange(source, property) {
|
|
521
|
+
const token = DesignTokenImpl.getTokenById(property);
|
|
522
|
+
if (!token) {
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
this.hydrate(token, this.getRaw(token));
|
|
526
|
+
this.updateCSSTokenReflection(this.store, token);
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Hydrates a token with a DesignTokenValue, making retrieval available.
|
|
530
|
+
* @param token - The token to hydrate
|
|
531
|
+
* @param value - The value to hydrate
|
|
532
|
+
*/
|
|
533
|
+
hydrate(token, value) {
|
|
534
|
+
if (!this.has(token)) {
|
|
535
|
+
const observer = this.bindingObservers.get(token);
|
|
536
|
+
if (DesignTokenImpl.isDerivedDesignTokenValue(value)) {
|
|
537
|
+
if (observer) {
|
|
538
|
+
// If the binding source doesn't match, we need
|
|
539
|
+
// to update the binding
|
|
540
|
+
if (observer.source !== value) {
|
|
541
|
+
this.tearDownBindingObserver(token);
|
|
542
|
+
this.setupBindingObserver(token, value);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
else {
|
|
546
|
+
this.setupBindingObserver(token, value);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
else {
|
|
550
|
+
if (observer) {
|
|
551
|
+
this.tearDownBindingObserver(token);
|
|
552
|
+
}
|
|
553
|
+
this.store.set(token, value);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Sets up a binding observer for a derived token value that notifies token
|
|
559
|
+
* subscribers on change.
|
|
560
|
+
*
|
|
561
|
+
* @param token - The token to notify when the binding updates
|
|
562
|
+
* @param source - The binding source
|
|
563
|
+
*/
|
|
564
|
+
setupBindingObserver(token, source) {
|
|
565
|
+
const binding = new DesignTokenBindingObserver(source, token, this);
|
|
566
|
+
this.bindingObservers.set(token, binding);
|
|
567
|
+
return binding;
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Tear down a binding observer for a token.
|
|
571
|
+
*/
|
|
572
|
+
tearDownBindingObserver(token) {
|
|
573
|
+
if (this.bindingObservers.has(token)) {
|
|
574
|
+
this.bindingObservers.get(token).disconnect();
|
|
575
|
+
this.bindingObservers.delete(token);
|
|
576
|
+
return true;
|
|
577
|
+
}
|
|
578
|
+
return false;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Responsible for reflecting tokens to CSS custom properties
|
|
583
|
+
*/
|
|
584
|
+
DesignTokenNode.cssCustomPropertyReflector = new CustomPropertyReflector();
|
|
585
|
+
__decorate([
|
|
586
|
+
observable
|
|
587
|
+
], DesignTokenNode.prototype, "children", void 0);
|
|
588
|
+
function create(nameOrConfig) {
|
|
589
|
+
return DesignTokenImpl.from(nameOrConfig);
|
|
590
|
+
}
|
|
591
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
592
|
+
/**
|
|
593
|
+
* Factory object for creating {@link (DesignToken:interface)} instances.
|
|
594
|
+
* @public
|
|
595
|
+
*/
|
|
596
|
+
export const DesignToken = Object.freeze({
|
|
597
|
+
create,
|
|
598
|
+
/**
|
|
599
|
+
* Informs DesignToken that an HTMLElement for which tokens have
|
|
600
|
+
* been set has been connected to the document.
|
|
601
|
+
*
|
|
602
|
+
* The browser does not provide a reliable mechanism to observe an HTMLElement's connectedness
|
|
603
|
+
* in all scenarios, so invoking this method manually is necessary when:
|
|
604
|
+
*
|
|
605
|
+
* 1. Token values are set for an HTMLElement.
|
|
606
|
+
* 2. The HTMLElement does not inherit from FASTElement.
|
|
607
|
+
* 3. The HTMLElement is not connected to the document when token values are set.
|
|
608
|
+
*
|
|
609
|
+
* @param element - The element to notify
|
|
610
|
+
* @returns - true if notification was successful, otherwise false.
|
|
611
|
+
*/
|
|
612
|
+
notifyConnection(element) {
|
|
613
|
+
if (!element.isConnected || !DesignTokenNode.existsFor(element)) {
|
|
614
|
+
return false;
|
|
615
|
+
}
|
|
616
|
+
DesignTokenNode.getOrCreate(element).bind();
|
|
617
|
+
return true;
|
|
618
|
+
},
|
|
619
|
+
/**
|
|
620
|
+
* Informs DesignToken that an HTMLElement for which tokens have
|
|
621
|
+
* been set has been disconnected to the document.
|
|
622
|
+
*
|
|
623
|
+
* The browser does not provide a reliable mechanism to observe an HTMLElement's connectedness
|
|
624
|
+
* in all scenarios, so invoking this method manually is necessary when:
|
|
625
|
+
*
|
|
626
|
+
* 1. Token values are set for an HTMLElement.
|
|
627
|
+
* 2. The HTMLElement does not inherit from FASTElement.
|
|
628
|
+
*
|
|
629
|
+
* @param element - The element to notify
|
|
630
|
+
* @returns - true if notification was successful, otherwise false.
|
|
631
|
+
*/
|
|
632
|
+
notifyDisconnection(element) {
|
|
633
|
+
if (element.isConnected || !DesignTokenNode.existsFor(element)) {
|
|
634
|
+
return false;
|
|
635
|
+
}
|
|
636
|
+
DesignTokenNode.getOrCreate(element).unbind();
|
|
637
|
+
return true;
|
|
638
|
+
},
|
|
639
|
+
/**
|
|
640
|
+
* Registers and element or document as a DesignToken root.
|
|
641
|
+
* {@link CSSDesignToken | CSSDesignTokens} with default values assigned via
|
|
642
|
+
* {@link (DesignToken:interface).withDefault} will emit CSS custom properties to all
|
|
643
|
+
* registered roots.
|
|
644
|
+
* @param target - The root to register
|
|
645
|
+
*/
|
|
646
|
+
registerRoot(target = defaultElement) {
|
|
647
|
+
RootStyleSheetTarget.registerRoot(target);
|
|
648
|
+
},
|
|
649
|
+
/**
|
|
650
|
+
* Unregister an element or document as a DesignToken root.
|
|
651
|
+
* @param target - The root to deregister
|
|
652
|
+
*/
|
|
653
|
+
unregisterRoot(target = defaultElement) {
|
|
654
|
+
RootStyleSheetTarget.unregisterRoot(target);
|
|
655
|
+
},
|
|
656
|
+
});
|
|
657
|
+
/* eslint-enable @typescript-eslint/no-non-null-assertion */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|