@material/web 0.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +34 -0
- package/actionelement/action-element.d.ts +79 -0
- package/actionelement/action-element.js +97 -0
- package/actionelement/action-element.js.map +1 -0
- package/badge/badge.d.ts +19 -0
- package/badge/badge.js +22 -0
- package/badge/badge.js.map +1 -0
- package/badge/lib/_badge-theme.scss +118 -0
- package/badge/lib/_badge.scss +41 -0
- package/badge/lib/badge-styles.css.d.ts +1 -0
- package/badge/lib/badge-styles.css.js +9 -0
- package/badge/lib/badge-styles.css.js.map +1 -0
- package/badge/lib/badge-styles.scss +16 -0
- package/badge/lib/badge.d.ts +15 -0
- package/badge/lib/badge.js +31 -0
- package/badge/lib/badge.js.map +1 -0
- package/button/_elevated-button.scss +8 -0
- package/button/_filled-button.scss +8 -0
- package/button/_outlined-button.scss +8 -0
- package/button/_text-button.scss +8 -0
- package/button/_tonal-button.scss +8 -0
- package/button/elevated-button.d.ts +19 -0
- package/button/elevated-button.js +24 -0
- package/button/elevated-button.js.map +1 -0
- package/button/elevated-link-button.d.ts +19 -0
- package/button/elevated-link-button.js +24 -0
- package/button/elevated-link-button.js.map +1 -0
- package/button/filled-button.d.ts +19 -0
- package/button/filled-button.js +23 -0
- package/button/filled-button.js.map +1 -0
- package/button/filled-link-button.d.ts +19 -0
- package/button/filled-link-button.js +23 -0
- package/button/filled-link-button.js.map +1 -0
- package/button/harness.d.ts +13 -0
- package/button/harness.js +16 -0
- package/button/harness.js.map +1 -0
- package/button/lib/_button-theme.scss +204 -0
- package/button/lib/_button.scss +88 -0
- package/button/lib/_elevated-button-theme.scss +53 -0
- package/button/lib/_elevated-button.scss +8 -0
- package/button/lib/_elevation-theme.scss +94 -0
- package/button/lib/_filled-button-theme.scss +53 -0
- package/button/lib/_filled-button.scss +8 -0
- package/button/lib/_icon-theme.scss +67 -0
- package/button/lib/_icon.scss +49 -0
- package/button/lib/_outlined-button-theme.scss +112 -0
- package/button/lib/_outlined-button.scss +25 -0
- package/button/lib/_text-button-theme.scss +57 -0
- package/button/lib/_text-button.scss +8 -0
- package/button/lib/_tonal-button-theme.scss +53 -0
- package/button/lib/_tonal-button.scss +8 -0
- package/button/lib/_touch-target.scss +16 -0
- package/button/lib/button.d.ts +76 -0
- package/button/lib/button.js +238 -0
- package/button/lib/button.js.map +1 -0
- package/button/lib/elevated-button.d.ts +15 -0
- package/button/lib/elevated-button.js +22 -0
- package/button/lib/elevated-button.js.map +1 -0
- package/button/lib/elevated-link-button.d.ts +15 -0
- package/button/lib/elevated-link-button.js +22 -0
- package/button/lib/elevated-link-button.js.map +1 -0
- package/button/lib/elevated-styles.css.d.ts +1 -0
- package/button/lib/elevated-styles.css.js +9 -0
- package/button/lib/elevated-styles.css.js.map +1 -0
- package/button/lib/elevated-styles.scss +18 -0
- package/button/lib/filled-button.d.ts +12 -0
- package/button/lib/filled-button.js +17 -0
- package/button/lib/filled-button.js.map +1 -0
- package/button/lib/filled-link-button.d.ts +12 -0
- package/button/lib/filled-link-button.js +17 -0
- package/button/lib/filled-link-button.js.map +1 -0
- package/button/lib/filled-styles.css.d.ts +1 -0
- package/button/lib/filled-styles.css.js +9 -0
- package/button/lib/filled-styles.css.js.map +1 -0
- package/button/lib/filled-styles.scss +16 -0
- package/button/lib/link-button.d.ts +17 -0
- package/button/lib/link-button.js +53 -0
- package/button/lib/link-button.js.map +1 -0
- package/button/lib/outlined-button.d.ts +15 -0
- package/button/lib/outlined-button.js +22 -0
- package/button/lib/outlined-button.js.map +1 -0
- package/button/lib/outlined-link-button.d.ts +15 -0
- package/button/lib/outlined-link-button.js +22 -0
- package/button/lib/outlined-link-button.js.map +1 -0
- package/button/lib/outlined-styles.css.d.ts +1 -0
- package/button/lib/outlined-styles.css.js +9 -0
- package/button/lib/outlined-styles.css.js.map +1 -0
- package/button/lib/outlined-styles.scss +18 -0
- package/button/lib/shared-styles.css.d.ts +1 -0
- package/button/lib/shared-styles.css.js +9 -0
- package/button/lib/shared-styles.css.js.map +1 -0
- package/button/lib/shared-styles.scss +12 -0
- package/button/lib/state.d.ts +10 -0
- package/button/lib/state.js +7 -0
- package/button/lib/state.js.map +1 -0
- package/button/lib/text-button.d.ts +12 -0
- package/button/lib/text-button.js +17 -0
- package/button/lib/text-button.js.map +1 -0
- package/button/lib/text-link-button.d.ts +12 -0
- package/button/lib/text-link-button.js +17 -0
- package/button/lib/text-link-button.js.map +1 -0
- package/button/lib/text-styles.css.d.ts +1 -0
- package/button/lib/text-styles.css.js +9 -0
- package/button/lib/text-styles.css.js.map +1 -0
- package/button/lib/text-styles.scss +16 -0
- package/button/lib/tonal-button.d.ts +12 -0
- package/button/lib/tonal-button.js +17 -0
- package/button/lib/tonal-button.js.map +1 -0
- package/button/lib/tonal-link-button.d.ts +12 -0
- package/button/lib/tonal-link-button.js +17 -0
- package/button/lib/tonal-link-button.js.map +1 -0
- package/button/lib/tonal-styles.css.d.ts +1 -0
- package/button/lib/tonal-styles.css.js +9 -0
- package/button/lib/tonal-styles.css.js.map +1 -0
- package/button/lib/tonal-styles.scss +16 -0
- package/button/outlined-button.d.ts +19 -0
- package/button/outlined-button.js +23 -0
- package/button/outlined-button.js.map +1 -0
- package/button/outlined-link-button.d.ts +19 -0
- package/button/outlined-link-button.js +23 -0
- package/button/outlined-link-button.js.map +1 -0
- package/button/text-button.d.ts +19 -0
- package/button/text-button.js +23 -0
- package/button/text-button.js.map +1 -0
- package/button/text-link-button.d.ts +19 -0
- package/button/text-link-button.js +23 -0
- package/button/text-link-button.js.map +1 -0
- package/button/tonal-button.d.ts +19 -0
- package/button/tonal-button.js +23 -0
- package/button/tonal-button.js.map +1 -0
- package/button/tonal-link-button.d.ts +19 -0
- package/button/tonal-link-button.js +23 -0
- package/button/tonal-link-button.js.map +1 -0
- package/checkbox/_checkbox.scss +1 -0
- package/checkbox/checkbox.d.ts +15 -0
- package/checkbox/checkbox.js +18 -0
- package/checkbox/checkbox.js.map +1 -0
- package/checkbox/harness.d.ts +13 -0
- package/checkbox/harness.js +16 -0
- package/checkbox/harness.js.map +1 -0
- package/checkbox/lib/_checkbox-theme.scss +532 -0
- package/checkbox/lib/_checkbox.scss +424 -0
- package/checkbox/lib/checkbox-styles.css.d.ts +1 -0
- package/checkbox/lib/checkbox-styles.css.js +9 -0
- package/checkbox/lib/checkbox-styles.css.js.map +1 -0
- package/checkbox/lib/checkbox-styles.scss +15 -0
- package/checkbox/lib/checkbox.d.ts +56 -0
- package/checkbox/lib/checkbox.js +238 -0
- package/checkbox/lib/checkbox.js.map +1 -0
- package/chips/action/lib/action.d.ts +34 -0
- package/chips/action/lib/action.js +83 -0
- package/chips/action/lib/action.js.map +1 -0
- package/chips/action/lib/adapter.d.ts +21 -0
- package/chips/action/lib/adapter.js +7 -0
- package/chips/action/lib/adapter.js.map +1 -0
- package/chips/action/lib/constants.d.ts +62 -0
- package/chips/action/lib/constants.js +69 -0
- package/chips/action/lib/constants.js.map +1 -0
- package/chips/action/lib/foundation.d.ts +31 -0
- package/chips/action/lib/foundation.js +151 -0
- package/chips/action/lib/foundation.js.map +1 -0
- package/chips/action/lib/link-action.d.ts +17 -0
- package/chips/action/lib/link-action.js +43 -0
- package/chips/action/lib/link-action.js.map +1 -0
- package/chips/action/lib/presentational-action.d.ts +15 -0
- package/chips/action/lib/presentational-action.js +30 -0
- package/chips/action/lib/presentational-action.js.map +1 -0
- package/chips/action/lib/primary-action.d.ts +29 -0
- package/chips/action/lib/primary-action.js +83 -0
- package/chips/action/lib/primary-action.js.map +1 -0
- package/chips/action/lib/primary-foundation.d.ts +16 -0
- package/chips/action/lib/primary-foundation.js +24 -0
- package/chips/action/lib/primary-foundation.js.map +1 -0
- package/chips/action/lib/selectable-action.d.ts +17 -0
- package/chips/action/lib/selectable-action.js +57 -0
- package/chips/action/lib/selectable-action.js.map +1 -0
- package/chips/action/lib/trailing-action.d.ts +20 -0
- package/chips/action/lib/trailing-action.js +62 -0
- package/chips/action/lib/trailing-action.js.map +1 -0
- package/chips/action/lib/trailing-foundation.d.ts +16 -0
- package/chips/action/lib/trailing-foundation.js +23 -0
- package/chips/action/lib/trailing-foundation.js.map +1 -0
- package/chips/action/lib/types.d.ts +23 -0
- package/chips/action/lib/types.js +7 -0
- package/chips/action/lib/types.js.map +1 -0
- package/chips/chip/lib/_assist-chip-theme.scss +101 -0
- package/chips/chip/lib/_chip-theme.scss +1329 -0
- package/chips/chip/lib/_chip.scss +427 -0
- package/chips/chip/lib/_filter-chip-theme.scss +132 -0
- package/chips/chip/lib/_input-chip-theme.scss +103 -0
- package/chips/chip/lib/_suggestion-chip-theme.scss +94 -0
- package/chips/chip/lib/adapter.d.ts +50 -0
- package/chips/chip/lib/adapter.js +7 -0
- package/chips/chip/lib/adapter.js.map +1 -0
- package/chips/chip/lib/constants.d.ts +43 -0
- package/chips/chip/lib/constants.js +48 -0
- package/chips/chip/lib/constants.js.map +1 -0
- package/chips/chip/lib/foundation.d.ts +41 -0
- package/chips/chip/lib/foundation.js +256 -0
- package/chips/chip/lib/foundation.js.map +1 -0
- package/chips/chip/lib/types.d.ts +42 -0
- package/chips/chip/lib/types.js +7 -0
- package/chips/chip/lib/types.js.map +1 -0
- package/chips/chipset/lib/_chip-set-theme.scss +48 -0
- package/chips/chipset/lib/_chip-set.scss +46 -0
- package/chips/chipset/lib/adapter.d.ts +45 -0
- package/chips/chipset/lib/adapter.js +7 -0
- package/chips/chipset/lib/adapter.js.map +1 -0
- package/chips/chipset/lib/constants.d.ts +26 -0
- package/chips/chipset/lib/constants.js +30 -0
- package/chips/chipset/lib/constants.js.map +1 -0
- package/chips/chipset/lib/foundation.d.ts +68 -0
- package/chips/chipset/lib/foundation.js +316 -0
- package/chips/chipset/lib/foundation.js.map +1 -0
- package/chips/chipset/lib/types.d.ts +41 -0
- package/chips/chipset/lib/types.js +7 -0
- package/chips/chipset/lib/types.js.map +1 -0
- package/compat/animation/animationframe.d.ts +31 -0
- package/compat/animation/animationframe.js +65 -0
- package/compat/animation/animationframe.js.map +1 -0
- package/compat/base/aria-property.d.ts +39 -0
- package/compat/base/aria-property.js +93 -0
- package/compat/base/aria-property.js.map +1 -0
- package/compat/base/foundation.d.ts +44 -0
- package/compat/base/foundation.js +45 -0
- package/compat/base/foundation.js.map +1 -0
- package/compat/base/observer.d.ts +16 -0
- package/compat/base/observer.js +43 -0
- package/compat/base/observer.js.map +1 -0
- package/compat/base/utils.d.ts +7 -0
- package/compat/base/utils.js +39 -0
- package/compat/base/utils.js.map +1 -0
- package/compat/density/_density.scss +106 -0
- package/compat/dom/keyboard.d.ts +33 -0
- package/compat/dom/keyboard.js +109 -0
- package/compat/dom/keyboard.js.map +1 -0
- package/compat/theme/_color-palette.scss +277 -0
- package/compat/theme/_css.scss +92 -0
- package/compat/theme/_custom-properties.scss +309 -0
- package/compat/theme/_gss.scss +45 -0
- package/compat/theme/_keys.scss +507 -0
- package/compat/theme/_map-ext.scss +68 -0
- package/compat/theme/_replace.scss +108 -0
- package/compat/theme/_selector-ext.scss +522 -0
- package/compat/theme/_shadow-dom.scss +474 -0
- package/compat/theme/_state.scss +752 -0
- package/compat/theme/_theme-color.scss +344 -0
- package/compat/theme/_theme.scss +334 -0
- package/compat/touchtarget/_touch-target.scss +56 -0
- package/controller/action-controller.d.ts +147 -0
- package/controller/action-controller.js +286 -0
- package/controller/action-controller.js.map +1 -0
- package/controller/events.d.ts +27 -0
- package/controller/events.js +40 -0
- package/controller/events.js.map +1 -0
- package/controller/form-controller.d.ts +59 -0
- package/controller/form-controller.js +68 -0
- package/controller/form-controller.js.map +1 -0
- package/controller/foundation.d.ts +24 -0
- package/controller/foundation.js +18 -0
- package/controller/foundation.js.map +1 -0
- package/controller/observer-foundation.d.ts +25 -0
- package/controller/observer-foundation.js +37 -0
- package/controller/observer-foundation.js.map +1 -0
- package/controller/observer.d.ts +52 -0
- package/controller/observer.js +149 -0
- package/controller/observer.js.map +1 -0
- package/controller/string-converter.d.ts +9 -0
- package/controller/string-converter.js +14 -0
- package/controller/string-converter.js.map +1 -0
- package/decorators/aria-property.d.ts +32 -0
- package/decorators/aria-property.js +99 -0
- package/decorators/aria-property.js.map +1 -0
- package/decorators/bound.d.ts +40 -0
- package/decorators/bound.js +49 -0
- package/decorators/bound.js.map +1 -0
- package/elevation/lib/_elevation-overlay-theme.scss +31 -0
- package/elevation/lib/_elevation-overlay.scss +18 -0
- package/elevation/lib/_elevation-theme.scss +88 -0
- package/elevation/lib/_surface.scss +18 -0
- package/elevation/lib/elevation-overlay-styles.css.d.ts +1 -0
- package/elevation/lib/elevation-overlay-styles.css.js +9 -0
- package/elevation/lib/elevation-overlay-styles.css.js.map +1 -0
- package/elevation/lib/elevation-overlay-styles.scss +9 -0
- package/fab/_fab-extended.scss +11 -0
- package/fab/_fab.scss +20 -0
- package/fab/fab-extended.d.ts +23 -0
- package/fab/fab-extended.js +30 -0
- package/fab/fab-extended.js.map +1 -0
- package/fab/fab.d.ts +23 -0
- package/fab/fab.js +30 -0
- package/fab/fab.js.map +1 -0
- package/fab/harness.d.ts +14 -0
- package/fab/harness.js +16 -0
- package/fab/harness.js.map +1 -0
- package/fab/lib/_fab-extended-theme.scss +108 -0
- package/fab/lib/_fab-extended.scss +39 -0
- package/fab/lib/_fab-shared-theme.scss +202 -0
- package/fab/lib/_fab-shared.scss +114 -0
- package/fab/lib/_fab-theme.scss +107 -0
- package/fab/lib/_fab.scss +17 -0
- package/fab/lib/fab-extended-styles.css.d.ts +1 -0
- package/fab/lib/fab-extended-styles.css.js +9 -0
- package/fab/lib/fab-extended-styles.css.js.map +1 -0
- package/fab/lib/fab-extended-styles.scss +16 -0
- package/fab/lib/fab-extended.d.ts +19 -0
- package/fab/lib/fab-extended.js +28 -0
- package/fab/lib/fab-extended.js.map +1 -0
- package/fab/lib/fab-shared-styles.css.d.ts +1 -0
- package/fab/lib/fab-shared-styles.css.js +9 -0
- package/fab/lib/fab-shared-styles.css.js.map +1 -0
- package/fab/lib/fab-shared-styles.scss +8 -0
- package/fab/lib/fab-shared.d.ts +50 -0
- package/fab/lib/fab-shared.js +138 -0
- package/fab/lib/fab-shared.js.map +1 -0
- package/fab/lib/fab-styles.css.d.ts +1 -0
- package/fab/lib/fab-styles.css.js +9 -0
- package/fab/lib/fab-styles.css.js.map +1 -0
- package/fab/lib/fab-styles.scss +16 -0
- package/fab/lib/fab.d.ts +17 -0
- package/fab/lib/fab.js +23 -0
- package/fab/lib/fab.js.map +1 -0
- package/field/_filled-field.scss +8 -0
- package/field/_outlined-field.scss +8 -0
- package/field/filled-field.d.ts +19 -0
- package/field/filled-field.js +23 -0
- package/field/filled-field.js.map +1 -0
- package/field/harness.d.ts +16 -0
- package/field/harness.js +29 -0
- package/field/harness.js.map +1 -0
- package/field/lib/_content-theme.scss +80 -0
- package/field/lib/_content.scss +63 -0
- package/field/lib/_field-theme.scss +15 -0
- package/field/lib/_field.scss +52 -0
- package/field/lib/_filled-field-theme.scss +382 -0
- package/field/lib/_filled-field.scss +129 -0
- package/field/lib/_label-theme.scss +123 -0
- package/field/lib/_label.scss +49 -0
- package/field/lib/_outlined-field-theme.scss +311 -0
- package/field/lib/_outlined-field.scss +194 -0
- package/field/lib/_supporting-text-theme.scss +107 -0
- package/field/lib/_supporting-text.scss +20 -0
- package/field/lib/field.d.ts +56 -0
- package/field/lib/field.js +253 -0
- package/field/lib/field.js.map +1 -0
- package/field/lib/filled-field.d.ts +23 -0
- package/field/lib/filled-field.js +83 -0
- package/field/lib/filled-field.js.map +1 -0
- package/field/lib/filled-styles.css.d.ts +1 -0
- package/field/lib/filled-styles.css.js +9 -0
- package/field/lib/filled-styles.css.js.map +1 -0
- package/field/lib/filled-styles.scss +16 -0
- package/field/lib/outlined-field.d.ts +19 -0
- package/field/lib/outlined-field.js +46 -0
- package/field/lib/outlined-field.js.map +1 -0
- package/field/lib/outlined-styles.css.d.ts +1 -0
- package/field/lib/outlined-styles.css.js +9 -0
- package/field/lib/outlined-styles.css.js.map +1 -0
- package/field/lib/outlined-styles.scss +16 -0
- package/field/lib/shared-styles.css.d.ts +1 -0
- package/field/lib/shared-styles.css.js +9 -0
- package/field/lib/shared-styles.css.js.map +1 -0
- package/field/lib/shared-styles.scss +14 -0
- package/field/outlined-field.d.ts +19 -0
- package/field/outlined-field.js +23 -0
- package/field/outlined-field.js.map +1 -0
- package/focus/focus-ring.d.ts +19 -0
- package/focus/focus-ring.js +22 -0
- package/focus/focus-ring.js.map +1 -0
- package/focus/lib/_focus-ring-theme.scss +89 -0
- package/focus/lib/_focus-ring.scss +41 -0
- package/focus/lib/focus-ring-styles.css.d.ts +1 -0
- package/focus/lib/focus-ring-styles.css.js +9 -0
- package/focus/lib/focus-ring-styles.css.js.map +1 -0
- package/focus/lib/focus-ring-styles.scss +16 -0
- package/focus/lib/focus-ring.d.ts +15 -0
- package/focus/lib/focus-ring.js +31 -0
- package/focus/lib/focus-ring.js.map +1 -0
- package/focus/strong-focus.d.ts +43 -0
- package/focus/strong-focus.js +84 -0
- package/focus/strong-focus.js.map +1 -0
- package/formfield/formfield.d.ts +19 -0
- package/formfield/formfield.js +22 -0
- package/formfield/formfield.js.map +1 -0
- package/formfield/lib/_formfield-theme.scss +41 -0
- package/formfield/lib/_formfield.scss +40 -0
- package/formfield/lib/formfield-styles.css.d.ts +1 -0
- package/formfield/lib/formfield-styles.css.js +9 -0
- package/formfield/lib/formfield-styles.css.js.map +1 -0
- package/formfield/lib/formfield-styles.scss +16 -0
- package/formfield/lib/formfield.d.ts +22 -0
- package/formfield/lib/formfield.js +73 -0
- package/formfield/lib/formfield.js.map +1 -0
- package/icon/icon.d.ts +19 -0
- package/icon/icon.js +22 -0
- package/icon/icon.js.map +1 -0
- package/icon/lib/icon-styles.css.d.ts +1 -0
- package/icon/lib/icon-styles.css.js +9 -0
- package/icon/lib/icon-styles.css.js.map +1 -0
- package/icon/lib/icon-styles.scss +25 -0
- package/icon/lib/icon.d.ts +11 -0
- package/icon/lib/icon.js +14 -0
- package/icon/lib/icon.js.map +1 -0
- package/iconbutton/_filled-icon-button.scss +7 -0
- package/iconbutton/_outlined-icon-button.scss +7 -0
- package/iconbutton/_standard-icon-button.scss +7 -0
- package/iconbutton/filled-icon-button-toggle.d.ts +19 -0
- package/iconbutton/filled-icon-button-toggle.js +28 -0
- package/iconbutton/filled-icon-button-toggle.js.map +1 -0
- package/iconbutton/filled-icon-button.d.ts +19 -0
- package/iconbutton/filled-icon-button.js +27 -0
- package/iconbutton/filled-icon-button.js.map +1 -0
- package/iconbutton/filled-link-icon-button.d.ts +19 -0
- package/iconbutton/filled-link-icon-button.js +27 -0
- package/iconbutton/filled-link-icon-button.js.map +1 -0
- package/iconbutton/filled-tonal-icon-button-toggle.d.ts +19 -0
- package/iconbutton/filled-tonal-icon-button-toggle.js +28 -0
- package/iconbutton/filled-tonal-icon-button-toggle.js.map +1 -0
- package/iconbutton/filled-tonal-icon-button.d.ts +19 -0
- package/iconbutton/filled-tonal-icon-button.js +27 -0
- package/iconbutton/filled-tonal-icon-button.js.map +1 -0
- package/iconbutton/filled-tonal-link-icon-button.d.ts +19 -0
- package/iconbutton/filled-tonal-link-icon-button.js +27 -0
- package/iconbutton/filled-tonal-link-icon-button.js.map +1 -0
- package/iconbutton/harness.d.ts +14 -0
- package/iconbutton/harness.js +16 -0
- package/iconbutton/harness.js.map +1 -0
- package/iconbutton/lib/_filled-icon-button-theme.scss +138 -0
- package/iconbutton/lib/_filled-icon-button.scss +8 -0
- package/iconbutton/lib/_filled-tonal-icon-button-theme.scss +144 -0
- package/iconbutton/lib/_filled-tonal-icon-button.scss +8 -0
- package/iconbutton/lib/_icon-button-theme.scss +163 -0
- package/iconbutton/lib/_icon-button.scss +91 -0
- package/iconbutton/lib/_outlined-icon-button-theme.scss +187 -0
- package/iconbutton/lib/_outlined-icon-button.scss +30 -0
- package/iconbutton/lib/_standard-icon-button-theme.scss +107 -0
- package/iconbutton/lib/_standard-icon-button.scss +13 -0
- package/iconbutton/lib/filled-styles.css.d.ts +1 -0
- package/iconbutton/lib/filled-styles.css.js +9 -0
- package/iconbutton/lib/filled-styles.css.js.map +1 -0
- package/iconbutton/lib/filled-styles.scss +18 -0
- package/iconbutton/lib/filled-tonal-styles.css.d.ts +1 -0
- package/iconbutton/lib/filled-tonal-styles.css.js +9 -0
- package/iconbutton/lib/filled-tonal-styles.css.js.map +1 -0
- package/iconbutton/lib/filled-tonal-styles.scss +18 -0
- package/iconbutton/lib/icon-button-styles.css.d.ts +1 -0
- package/iconbutton/lib/icon-button-styles.css.js +9 -0
- package/iconbutton/lib/icon-button-styles.css.js.map +1 -0
- package/iconbutton/lib/icon-button-styles.scss +8 -0
- package/iconbutton/lib/icon-button-toggle.d.ts +44 -0
- package/iconbutton/lib/icon-button-toggle.js +155 -0
- package/iconbutton/lib/icon-button-toggle.js.map +1 -0
- package/iconbutton/lib/icon-button.d.ts +50 -0
- package/iconbutton/lib/icon-button.js +154 -0
- package/iconbutton/lib/icon-button.js.map +1 -0
- package/iconbutton/lib/link-icon-button.d.ts +14 -0
- package/iconbutton/lib/link-icon-button.js +53 -0
- package/iconbutton/lib/link-icon-button.js.map +1 -0
- package/iconbutton/lib/outlined-styles.css.d.ts +1 -0
- package/iconbutton/lib/outlined-styles.css.js +9 -0
- package/iconbutton/lib/outlined-styles.css.js.map +1 -0
- package/iconbutton/lib/outlined-styles.scss +18 -0
- package/iconbutton/lib/standard-styles.css.d.ts +1 -0
- package/iconbutton/lib/standard-styles.css.js +9 -0
- package/iconbutton/lib/standard-styles.css.js.map +1 -0
- package/iconbutton/lib/standard-styles.scss +18 -0
- package/iconbutton/outlined-icon-button-toggle.d.ts +19 -0
- package/iconbutton/outlined-icon-button-toggle.js +27 -0
- package/iconbutton/outlined-icon-button-toggle.js.map +1 -0
- package/iconbutton/outlined-icon-button.d.ts +19 -0
- package/iconbutton/outlined-icon-button.js +27 -0
- package/iconbutton/outlined-icon-button.js.map +1 -0
- package/iconbutton/outlined-link-icon-button.d.ts +19 -0
- package/iconbutton/outlined-link-icon-button.js +27 -0
- package/iconbutton/outlined-link-icon-button.js.map +1 -0
- package/iconbutton/standard-icon-button-toggle.d.ts +19 -0
- package/iconbutton/standard-icon-button-toggle.js +27 -0
- package/iconbutton/standard-icon-button-toggle.js.map +1 -0
- package/iconbutton/standard-icon-button.d.ts +19 -0
- package/iconbutton/standard-icon-button.js +27 -0
- package/iconbutton/standard-icon-button.js.map +1 -0
- package/iconbutton/standard-link-icon-button.d.ts +19 -0
- package/iconbutton/standard-link-icon-button.js +27 -0
- package/iconbutton/standard-link-icon-button.js.map +1 -0
- package/list/_list-item.scss +7 -0
- package/list/_list.scss +7 -0
- package/list/harness.d.ts +19 -0
- package/list/harness.js +24 -0
- package/list/harness.js.map +1 -0
- package/list/lib/_list-theme.scss +51 -0
- package/list/lib/_list.scss +41 -0
- package/list/lib/_tokens.scss +80 -0
- package/list/lib/avatar/_list-item-avatar-theme.scss +30 -0
- package/list/lib/avatar/_list-item-avatar.scss +14 -0
- package/list/lib/avatar/list-item-avatar-styles.css.d.ts +1 -0
- package/list/lib/avatar/list-item-avatar-styles.css.js +9 -0
- package/list/lib/avatar/list-item-avatar-styles.css.js.map +1 -0
- package/list/lib/avatar/list-item-avatar-styles.scss +20 -0
- package/list/lib/avatar/list-item-avatar.d.ts +16 -0
- package/list/lib/avatar/list-item-avatar.js +35 -0
- package/list/lib/avatar/list-item-avatar.js.map +1 -0
- package/list/lib/divider/_list-divider-theme.scss +30 -0
- package/list/lib/divider/_list-divider.scss +14 -0
- package/list/lib/divider/list-divider-styles.css.d.ts +1 -0
- package/list/lib/divider/list-divider-styles.css.js +9 -0
- package/list/lib/divider/list-divider-styles.css.js.map +1 -0
- package/list/lib/divider/list-divider-styles.scss +18 -0
- package/list/lib/divider/list-divider.d.ts +13 -0
- package/list/lib/divider/list-divider.js +30 -0
- package/list/lib/divider/list-divider.js.map +1 -0
- package/list/lib/icon/_list-item-icon-theme.scss +32 -0
- package/list/lib/icon/_list-item-icon.scss +35 -0
- package/list/lib/icon/list-item-icon-styles.css.d.ts +1 -0
- package/list/lib/icon/list-item-icon-styles.css.js +9 -0
- package/list/lib/icon/list-item-icon-styles.css.js.map +1 -0
- package/list/lib/icon/list-item-icon-styles.scss +20 -0
- package/list/lib/icon/list-item-icon.d.ts +12 -0
- package/list/lib/icon/list-item-icon.js +26 -0
- package/list/lib/icon/list-item-icon.js.map +1 -0
- package/list/lib/image/_list-item-image-theme.scss +36 -0
- package/list/lib/image/_list-item-image.scss +16 -0
- package/list/lib/image/list-item-image-styles.css.d.ts +1 -0
- package/list/lib/image/list-item-image-styles.css.js +9 -0
- package/list/lib/image/list-item-image-styles.css.js.map +1 -0
- package/list/lib/image/list-item-image-styles.scss +20 -0
- package/list/lib/image/list-item-image.d.ts +14 -0
- package/list/lib/image/list-item-image.js +37 -0
- package/list/lib/image/list-item-image.js.map +1 -0
- package/list/lib/list-styles.css.d.ts +1 -0
- package/list/lib/list-styles.css.js +9 -0
- package/list/lib/list-styles.css.js.map +1 -0
- package/list/lib/list-styles.scss +16 -0
- package/list/lib/list.d.ts +41 -0
- package/list/lib/list.js +168 -0
- package/list/lib/list.js.map +1 -0
- package/list/lib/listitem/_list-item-theme.scss +337 -0
- package/list/lib/listitem/_list-item.scss +133 -0
- package/list/lib/listitem/harness.d.ts +13 -0
- package/list/lib/listitem/harness.js +16 -0
- package/list/lib/listitem/harness.js.map +1 -0
- package/list/lib/listitem/list-item-styles.css.d.ts +1 -0
- package/list/lib/listitem/list-item-styles.css.js +9 -0
- package/list/lib/listitem/list-item-styles.css.js.map +1 -0
- package/list/lib/listitem/list-item-styles.scss +16 -0
- package/list/lib/listitem/list-item.d.ts +73 -0
- package/list/lib/listitem/list-item.js +258 -0
- package/list/lib/listitem/list-item.js.map +1 -0
- package/list/lib/video/_list-item-video-theme.scss +36 -0
- package/list/lib/video/_list-item-video.scss +18 -0
- package/list/lib/video/list-item-video-styles.css.d.ts +1 -0
- package/list/lib/video/list-item-video-styles.css.js +9 -0
- package/list/lib/video/list-item-video-styles.css.js.map +1 -0
- package/list/lib/video/list-item-video-styles.scss +20 -0
- package/list/lib/video/list-item-video.d.ts +14 -0
- package/list/lib/video/list-item-video.js +37 -0
- package/list/lib/video/list-item-video.js.map +1 -0
- package/list/list-divider.d.ts +19 -0
- package/list/list-divider.js +22 -0
- package/list/list-divider.js.map +1 -0
- package/list/list-item-avatar.d.ts +19 -0
- package/list/list-item-avatar.js +22 -0
- package/list/list-item-avatar.js.map +1 -0
- package/list/list-item-icon.d.ts +19 -0
- package/list/list-item-icon.js +22 -0
- package/list/list-item-icon.js.map +1 -0
- package/list/list-item-image.d.ts +19 -0
- package/list/list-item-image.js +22 -0
- package/list/list-item-image.js.map +1 -0
- package/list/list-item-video.d.ts +19 -0
- package/list/list-item-video.js +22 -0
- package/list/list-item-video.js.map +1 -0
- package/list/list-item.d.ts +19 -0
- package/list/list-item.js +22 -0
- package/list/list-item.js.map +1 -0
- package/list/list.d.ts +19 -0
- package/list/list.js +22 -0
- package/list/list.js.map +1 -0
- package/menu/harness.d.ts +15 -0
- package/menu/harness.js +17 -0
- package/menu/harness.js.map +1 -0
- package/menu/lib/_menu-button.scss +14 -0
- package/menu/lib/_menu-theme.scss +118 -0
- package/menu/lib/_menu.scss +8 -0
- package/menu/lib/adapter.d.ts +66 -0
- package/menu/lib/adapter.js +7 -0
- package/menu/lib/adapter.js.map +1 -0
- package/menu/lib/constants.d.ts +22 -0
- package/menu/lib/constants.js +23 -0
- package/menu/lib/constants.js.map +1 -0
- package/menu/lib/foundation.d.ts +49 -0
- package/menu/lib/foundation.js +123 -0
- package/menu/lib/foundation.js.map +1 -0
- package/menu/lib/menu-button-styles.css.d.ts +1 -0
- package/menu/lib/menu-button-styles.css.js +9 -0
- package/menu/lib/menu-button-styles.css.js.map +1 -0
- package/menu/lib/menu-button-styles.scss +9 -0
- package/menu/lib/menu-button.d.ts +27 -0
- package/menu/lib/menu-button.js +93 -0
- package/menu/lib/menu-button.js.map +1 -0
- package/menu/lib/menu-styles.css.d.ts +1 -0
- package/menu/lib/menu-styles.css.js +9 -0
- package/menu/lib/menu-styles.css.js.map +1 -0
- package/menu/lib/menu-styles.scss +17 -0
- package/menu/lib/menu.d.ts +62 -0
- package/menu/lib/menu.js +334 -0
- package/menu/lib/menu.js.map +1 -0
- package/menu/lib/menuitem/harness.d.ts +11 -0
- package/menu/lib/menuitem/harness.js +12 -0
- package/menu/lib/menuitem/harness.js.map +1 -0
- package/menu/lib/menuitem/menu-item.d.ts +11 -0
- package/menu/lib/menuitem/menu-item.js +14 -0
- package/menu/lib/menuitem/menu-item.js.map +1 -0
- package/menu/lib/types.d.ts +23 -0
- package/menu/lib/types.js +7 -0
- package/menu/lib/types.js.map +1 -0
- package/menu/menu-button.d.ts +14 -0
- package/menu/menu-button.js +17 -0
- package/menu/menu-button.js.map +1 -0
- package/menu/menu-item.d.ts +14 -0
- package/menu/menu-item.js +17 -0
- package/menu/menu-item.js.map +1 -0
- package/menu/menu.d.ts +14 -0
- package/menu/menu.js +17 -0
- package/menu/menu.js.map +1 -0
- package/menusurface/_menu-surface.scss +7 -0
- package/menusurface/lib/_menu-surface-theme.scss +58 -0
- package/menusurface/lib/_menu-surface.scss +85 -0
- package/menusurface/lib/adapter.d.ts +46 -0
- package/menusurface/lib/adapter.js +7 -0
- package/menusurface/lib/adapter.js.map +1 -0
- package/menusurface/lib/constants.d.ts +71 -0
- package/menusurface/lib/constants.js +83 -0
- package/menusurface/lib/constants.js.map +1 -0
- package/menusurface/lib/foundation.d.ts +176 -0
- package/menusurface/lib/foundation.js +544 -0
- package/menusurface/lib/foundation.js.map +1 -0
- package/menusurface/lib/menu-surface-styles.css.d.ts +1 -0
- package/menusurface/lib/menu-surface-styles.css.js +9 -0
- package/menusurface/lib/menu-surface-styles.css.js.map +1 -0
- package/menusurface/lib/menu-surface-styles.scss +16 -0
- package/menusurface/lib/menu-surface.d.ts +58 -0
- package/menusurface/lib/menu-surface.js +386 -0
- package/menusurface/lib/menu-surface.js.map +1 -0
- package/menusurface/lib/types.d.ts +19 -0
- package/menusurface/lib/types.js +7 -0
- package/menusurface/lib/types.js.map +1 -0
- package/menusurface/menu-surface.d.ts +14 -0
- package/menusurface/menu-surface.js +17 -0
- package/menusurface/menu-surface.js.map +1 -0
- package/motion/_animation.scss +33 -0
- package/motion/animation.d.ts +63 -0
- package/motion/animation.js +66 -0
- package/motion/animation.js.map +1 -0
- package/navigationbar/_navigation-bar.scss +7 -0
- package/navigationbar/harness.d.ts +19 -0
- package/navigationbar/harness.js +29 -0
- package/navigationbar/harness.js.map +1 -0
- package/navigationbar/lib/_navigation-bar-theme.scss +87 -0
- package/navigationbar/lib/_navigation-bar.scss +28 -0
- package/navigationbar/lib/constants.d.ts +17 -0
- package/navigationbar/lib/constants.js +7 -0
- package/navigationbar/lib/constants.js.map +1 -0
- package/navigationbar/lib/navigation-bar-styles.css.d.ts +1 -0
- package/navigationbar/lib/navigation-bar-styles.css.js +9 -0
- package/navigationbar/lib/navigation-bar-styles.css.js.map +1 -0
- package/navigationbar/lib/navigation-bar-styles.scss +20 -0
- package/navigationbar/lib/navigation-bar.d.ts +26 -0
- package/navigationbar/lib/navigation-bar.js +150 -0
- package/navigationbar/lib/navigation-bar.js.map +1 -0
- package/navigationbar/lib/state.d.ts +23 -0
- package/navigationbar/lib/state.js +7 -0
- package/navigationbar/lib/state.js.map +1 -0
- package/navigationbar/navigation-bar.d.ts +19 -0
- package/navigationbar/navigation-bar.js +22 -0
- package/navigationbar/navigation-bar.js.map +1 -0
- package/navigationdrawer/_navigation-drawer-modal.scss +6 -0
- package/navigationdrawer/_navigation-drawer.scss +6 -0
- package/navigationdrawer/lib/_navigation-drawer-modal-theme.scss +138 -0
- package/navigationdrawer/lib/_navigation-drawer-modal.scss +78 -0
- package/navigationdrawer/lib/_navigation-drawer-theme.scss +113 -0
- package/navigationdrawer/lib/_navigation-drawer.scss +64 -0
- package/navigationdrawer/lib/navigation-drawer-modal-styles.css.d.ts +1 -0
- package/navigationdrawer/lib/navigation-drawer-modal-styles.css.js +9 -0
- package/navigationdrawer/lib/navigation-drawer-modal-styles.css.js.map +1 -0
- package/navigationdrawer/lib/navigation-drawer-modal-styles.scss +12 -0
- package/navigationdrawer/lib/navigation-drawer-modal.d.ts +24 -0
- package/navigationdrawer/lib/navigation-drawer-modal.js +106 -0
- package/navigationdrawer/lib/navigation-drawer-modal.js.map +1 -0
- package/navigationdrawer/lib/navigation-drawer-styles.css.d.ts +1 -0
- package/navigationdrawer/lib/navigation-drawer-styles.css.js +9 -0
- package/navigationdrawer/lib/navigation-drawer-styles.css.js.map +1 -0
- package/navigationdrawer/lib/navigation-drawer-styles.scss +18 -0
- package/navigationdrawer/lib/navigation-drawer.d.ts +20 -0
- package/navigationdrawer/lib/navigation-drawer.js +87 -0
- package/navigationdrawer/lib/navigation-drawer.js.map +1 -0
- package/navigationdrawer/navigation-drawer-modal.d.ts +19 -0
- package/navigationdrawer/navigation-drawer-modal.js +22 -0
- package/navigationdrawer/navigation-drawer-modal.js.map +1 -0
- package/navigationdrawer/navigation-drawer.d.ts +19 -0
- package/navigationdrawer/navigation-drawer.js +22 -0
- package/navigationdrawer/navigation-drawer.js.map +1 -0
- package/navigationtab/_navigation-tab.scss +7 -0
- package/navigationtab/harness.d.ts +13 -0
- package/navigationtab/harness.js +16 -0
- package/navigationtab/harness.js.map +1 -0
- package/navigationtab/lib/_navigation-tab-theme.scss +343 -0
- package/navigationtab/lib/_navigation-tab.scss +127 -0
- package/navigationtab/lib/navigation-tab-styles.css.d.ts +1 -0
- package/navigationtab/lib/navigation-tab-styles.css.js +9 -0
- package/navigationtab/lib/navigation-tab-styles.css.js.map +1 -0
- package/navigationtab/lib/navigation-tab-styles.scss +21 -0
- package/navigationtab/lib/navigation-tab.d.ts +48 -0
- package/navigationtab/lib/navigation-tab.js +174 -0
- package/navigationtab/lib/navigation-tab.js.map +1 -0
- package/navigationtab/lib/state.d.ts +24 -0
- package/navigationtab/lib/state.js +7 -0
- package/navigationtab/lib/state.js.map +1 -0
- package/navigationtab/navigation-tab.d.ts +19 -0
- package/navigationtab/navigation-tab.js +22 -0
- package/navigationtab/navigation-tab.js.map +1 -0
- package/package.json +48 -0
- package/radio/_radio.scss +1 -0
- package/radio/harness.d.ts +13 -0
- package/radio/harness.js +16 -0
- package/radio/harness.js.map +1 -0
- package/radio/lib/_radio-theme.scss +376 -0
- package/radio/lib/_radio.scss +131 -0
- package/radio/lib/radio-styles.css.d.ts +1 -0
- package/radio/lib/radio-styles.css.js +9 -0
- package/radio/lib/radio-styles.css.js.map +1 -0
- package/radio/lib/radio-styles.scss +14 -0
- package/radio/lib/radio.d.ts +93 -0
- package/radio/lib/radio.js +302 -0
- package/radio/lib/radio.js.map +1 -0
- package/radio/lib/single-selection-controller.d.ts +167 -0
- package/radio/lib/single-selection-controller.js +289 -0
- package/radio/lib/single-selection-controller.js.map +1 -0
- package/radio/radio.d.ts +15 -0
- package/radio/radio.js +18 -0
- package/radio/radio.js.map +1 -0
- package/ripple/_index.scss +6 -0
- package/ripple/_ripple-theme.scss +6 -0
- package/ripple/lib/_ripple-theme.scss +98 -0
- package/ripple/lib/_ripple.scss +84 -0
- package/ripple/lib/ripple-styles.css.d.ts +1 -0
- package/ripple/lib/ripple-styles.css.js +9 -0
- package/ripple/lib/ripple-styles.css.js.map +1 -0
- package/ripple/lib/ripple-styles.scss +16 -0
- package/ripple/lib/ripple.d.ts +62 -0
- package/ripple/lib/ripple.js +215 -0
- package/ripple/lib/ripple.js.map +1 -0
- package/ripple/ripple.d.ts +19 -0
- package/ripple/ripple.js +22 -0
- package/ripple/ripple.js.map +1 -0
- package/sass/_assert.scss +16 -0
- package/sass/_color.scss +186 -0
- package/sass/_dom.scss +52 -0
- package/sass/_elevation.scss +155 -0
- package/sass/_feature-flags.scss +117 -0
- package/sass/_map-ext.scss +25 -0
- package/sass/_resolvers.scss +16 -0
- package/sass/_shape.scss +106 -0
- package/sass/_string-ext.scss +128 -0
- package/sass/_theme.scss +245 -0
- package/sass/_touch-target.scss +22 -0
- package/sass/_typography.scss +114 -0
- package/sass/_var.scss +241 -0
- package/segmentedbutton/lib/_outlined-segmented-button-theme.scss +167 -0
- package/segmentedbutton/lib/_outlined-segmented-button.scss +18 -0
- package/segmentedbutton/lib/_segmented-button-theme.scss +316 -0
- package/segmentedbutton/lib/_segmented-button.scss +159 -0
- package/segmentedbutton/lib/outlined-segmented-button.d.ts +15 -0
- package/segmentedbutton/lib/outlined-segmented-button.js +22 -0
- package/segmentedbutton/lib/outlined-segmented-button.js.map +1 -0
- package/segmentedbutton/lib/outlined-styles.css.d.ts +1 -0
- package/segmentedbutton/lib/outlined-styles.css.js +9 -0
- package/segmentedbutton/lib/outlined-styles.css.js.map +1 -0
- package/segmentedbutton/lib/outlined-styles.scss +17 -0
- package/segmentedbutton/lib/segmented-button-styles.css.d.ts +1 -0
- package/segmentedbutton/lib/segmented-button-styles.css.js +9 -0
- package/segmentedbutton/lib/segmented-button-styles.css.js.map +1 -0
- package/segmentedbutton/lib/segmented-button-styles.scss +8 -0
- package/segmentedbutton/lib/segmented-button.d.ts +60 -0
- package/segmentedbutton/lib/segmented-button.js +229 -0
- package/segmentedbutton/lib/segmented-button.js.map +1 -0
- package/segmentedbutton/outlined-segmented-button.d.ts +21 -0
- package/segmentedbutton/outlined-segmented-button.js +25 -0
- package/segmentedbutton/outlined-segmented-button.js.map +1 -0
- package/segmentedbuttonset/lib/_outlined-segmented-button-set-theme.scss +53 -0
- package/segmentedbuttonset/lib/_outlined-segmented-button-set.scss +12 -0
- package/segmentedbuttonset/lib/_segmented-button-set-theme.scss +41 -0
- package/segmentedbuttonset/lib/_segmented-button-set.scss +21 -0
- package/segmentedbuttonset/lib/outlined-segmented-button-set.d.ts +12 -0
- package/segmentedbuttonset/lib/outlined-segmented-button-set.js +17 -0
- package/segmentedbuttonset/lib/outlined-segmented-button-set.js.map +1 -0
- package/segmentedbuttonset/lib/outlined-styles.css.d.ts +1 -0
- package/segmentedbuttonset/lib/outlined-styles.css.js +9 -0
- package/segmentedbuttonset/lib/outlined-styles.css.js.map +1 -0
- package/segmentedbuttonset/lib/outlined-styles.scss +17 -0
- package/segmentedbuttonset/lib/segmented-button-set.d.ts +34 -0
- package/segmentedbuttonset/lib/segmented-button-set.js +118 -0
- package/segmentedbuttonset/lib/segmented-button-set.js.map +1 -0
- package/segmentedbuttonset/lib/shared-styles.css.d.ts +1 -0
- package/segmentedbuttonset/lib/shared-styles.css.js +9 -0
- package/segmentedbuttonset/lib/shared-styles.css.js.map +1 -0
- package/segmentedbuttonset/lib/shared-styles.scss +8 -0
- package/segmentedbuttonset/outlined-segmented-button-set.d.ts +21 -0
- package/segmentedbuttonset/outlined-segmented-button-set.js +25 -0
- package/segmentedbuttonset/outlined-segmented-button-set.js.map +1 -0
- package/switch/_switch.scss +7 -0
- package/switch/harness.d.ts +13 -0
- package/switch/harness.js +16 -0
- package/switch/harness.js.map +1 -0
- package/switch/lib/_switch-handle-theme.scss +137 -0
- package/switch/lib/_switch-icon-theme.scss +52 -0
- package/switch/lib/_switch-theme.scss +232 -0
- package/switch/lib/_switch-track-theme.scss +117 -0
- package/switch/lib/_switch.scss +210 -0
- package/switch/lib/switch-styles.css.d.ts +1 -0
- package/switch/lib/switch-styles.css.js +9 -0
- package/switch/lib/switch-styles.css.js.map +1 -0
- package/switch/lib/switch-styles.scss +11 -0
- package/switch/lib/switch.d.ts +59 -0
- package/switch/lib/switch.js +223 -0
- package/switch/lib/switch.js.map +1 -0
- package/switch/switch.d.ts +19 -0
- package/switch/switch.js +22 -0
- package/switch/switch.js.map +1 -0
- package/textfield/_filled-text-field.scss +9 -0
- package/textfield/_outlined-text-field.scss +9 -0
- package/textfield/filled-text-field.d.ts +21 -0
- package/textfield/filled-text-field.js +31 -0
- package/textfield/filled-text-field.js.map +1 -0
- package/textfield/harness.d.ts +51 -0
- package/textfield/harness.js +118 -0
- package/textfield/harness.js.map +1 -0
- package/textfield/lib/_filled-text-field-theme.scss +203 -0
- package/textfield/lib/_icon-theme.scss +100 -0
- package/textfield/lib/_icon.scss +18 -0
- package/textfield/lib/_input-theme.scss +91 -0
- package/textfield/lib/_input.scss +38 -0
- package/textfield/lib/_outlined-text-field-theme.scss +186 -0
- package/textfield/lib/_text-field.scss +28 -0
- package/textfield/lib/filled-forced-colors-styles.css.d.ts +1 -0
- package/textfield/lib/filled-forced-colors-styles.css.js +9 -0
- package/textfield/lib/filled-forced-colors-styles.css.js.map +1 -0
- package/textfield/lib/filled-forced-colors-styles.scss +17 -0
- package/textfield/lib/filled-styles.css.d.ts +1 -0
- package/textfield/lib/filled-styles.css.js +9 -0
- package/textfield/lib/filled-styles.css.js.map +1 -0
- package/textfield/lib/filled-styles.scss +15 -0
- package/textfield/lib/filled-text-field.d.ts +12 -0
- package/textfield/lib/filled-text-field.js +17 -0
- package/textfield/lib/filled-text-field.js.map +1 -0
- package/textfield/lib/outlined-forced-colors-styles.css.d.ts +1 -0
- package/textfield/lib/outlined-forced-colors-styles.css.js +9 -0
- package/textfield/lib/outlined-forced-colors-styles.css.js.map +1 -0
- package/textfield/lib/outlined-forced-colors-styles.scss +17 -0
- package/textfield/lib/outlined-styles.css.d.ts +1 -0
- package/textfield/lib/outlined-styles.css.js +9 -0
- package/textfield/lib/outlined-styles.css.js.map +1 -0
- package/textfield/lib/outlined-styles.scss +15 -0
- package/textfield/lib/outlined-text-field.d.ts +12 -0
- package/textfield/lib/outlined-text-field.js +17 -0
- package/textfield/lib/outlined-text-field.js.map +1 -0
- package/textfield/lib/shared-styles.css.d.ts +1 -0
- package/textfield/lib/shared-styles.css.js +9 -0
- package/textfield/lib/shared-styles.css.js.map +1 -0
- package/textfield/lib/shared-styles.scss +12 -0
- package/textfield/lib/text-field.d.ts +319 -0
- package/textfield/lib/text-field.js +707 -0
- package/textfield/lib/text-field.js.map +1 -0
- package/textfield/outlined-text-field.d.ts +21 -0
- package/textfield/outlined-text-field.js +31 -0
- package/textfield/outlined-text-field.js.map +1 -0
- package/tokens/_index.scss +6 -0
- package/tokens/latest/_index.scss +186 -0
- package/tokens/latest/_md-comp-assist-chip.scss +98 -0
- package/tokens/latest/_md-comp-badge.scss +51 -0
- package/tokens/latest/_md-comp-banner.scss +99 -0
- package/tokens/latest/_md-comp-bottom-app-bar.scss +36 -0
- package/tokens/latest/_md-comp-checkbox.scss +119 -0
- package/tokens/latest/_md-comp-circular-progress-indicator.scss +37 -0
- package/tokens/latest/_md-comp-date-input-modal.scss +76 -0
- package/tokens/latest/_md-comp-date-picker-docked.scss +210 -0
- package/tokens/latest/_md-comp-date-picker-modal.scss +254 -0
- package/tokens/latest/_md-comp-dialog.scss +115 -0
- package/tokens/latest/_md-comp-divider.scss +25 -0
- package/tokens/latest/_md-comp-elevated-button.scss +83 -0
- package/tokens/latest/_md-comp-elevated-card.scss +59 -0
- package/tokens/latest/_md-comp-extended-fab-branded.scss +77 -0
- package/tokens/latest/_md-comp-extended-fab-primary.scss +80 -0
- package/tokens/latest/_md-comp-extended-fab-secondary.scss +83 -0
- package/tokens/latest/_md-comp-extended-fab-surface.scss +81 -0
- package/tokens/latest/_md-comp-extended-fab-tertiary.scss +80 -0
- package/tokens/latest/_md-comp-fab-branded-large.scss +59 -0
- package/tokens/latest/_md-comp-fab-branded.scss +58 -0
- package/tokens/latest/_md-comp-fab-primary-large.scss +61 -0
- package/tokens/latest/_md-comp-fab-primary-small.scss +61 -0
- package/tokens/latest/_md-comp-fab-primary.scss +61 -0
- package/tokens/latest/_md-comp-fab-secondary-large.scss +63 -0
- package/tokens/latest/_md-comp-fab-secondary-small.scss +62 -0
- package/tokens/latest/_md-comp-fab-secondary.scss +63 -0
- package/tokens/latest/_md-comp-fab-surface-large.scss +62 -0
- package/tokens/latest/_md-comp-fab-surface-small.scss +62 -0
- package/tokens/latest/_md-comp-fab-surface.scss +62 -0
- package/tokens/latest/_md-comp-fab-tertiary-large.scss +61 -0
- package/tokens/latest/_md-comp-fab-tertiary-small.scss +61 -0
- package/tokens/latest/_md-comp-fab-tertiary.scss +61 -0
- package/tokens/latest/_md-comp-filled-autocomplete.scss +235 -0
- package/tokens/latest/_md-comp-filled-button.scss +87 -0
- package/tokens/latest/_md-comp-filled-card.scss +59 -0
- package/tokens/latest/_md-comp-filled-icon-button.scss +72 -0
- package/tokens/latest/_md-comp-filled-menu-button.scss +89 -0
- package/tokens/latest/_md-comp-filled-select.scss +243 -0
- package/tokens/latest/_md-comp-filled-text-field.scss +146 -0
- package/tokens/latest/_md-comp-filled-tonal-button.scss +88 -0
- package/tokens/latest/_md-comp-filled-tonal-icon-button.scss +83 -0
- package/tokens/latest/_md-comp-filter-chip.scss +172 -0
- package/tokens/latest/_md-comp-full-screen-dialog.scss +131 -0
- package/tokens/latest/_md-comp-icon-button.scss +66 -0
- package/tokens/latest/_md-comp-input-chip.scss +112 -0
- package/tokens/latest/_md-comp-linear-progress-indicator.scss +39 -0
- package/tokens/latest/_md-comp-list.scss +205 -0
- package/tokens/latest/_md-comp-menu.scss +113 -0
- package/tokens/latest/_md-comp-navigation-bar.scss +97 -0
- package/tokens/latest/_md-comp-navigation-drawer.scss +137 -0
- package/tokens/latest/_md-comp-navigation-rail.scss +132 -0
- package/tokens/latest/_md-comp-outlined-autocomplete.scss +223 -0
- package/tokens/latest/_md-comp-outlined-button.scss +80 -0
- package/tokens/latest/_md-comp-outlined-card.scss +65 -0
- package/tokens/latest/_md-comp-outlined-icon-button.scss +68 -0
- package/tokens/latest/_md-comp-outlined-menu-button.scss +83 -0
- package/tokens/latest/_md-comp-outlined-segmented-button.scss +97 -0
- package/tokens/latest/_md-comp-outlined-select.scss +231 -0
- package/tokens/latest/_md-comp-outlined-text-field.scss +140 -0
- package/tokens/latest/_md-comp-plain-tooltip.scss +46 -0
- package/tokens/latest/_md-comp-primary-navigation-tab.scss +110 -0
- package/tokens/latest/_md-comp-radio-button.scss +58 -0
- package/tokens/latest/_md-comp-rich-tooltip.scss +98 -0
- package/tokens/latest/_md-comp-search-bar.scss +84 -0
- package/tokens/latest/_md-comp-search-view.scss +79 -0
- package/tokens/latest/_md-comp-secondary-navigation-tab.scss +78 -0
- package/tokens/latest/_md-comp-sheet-bottom.scss +41 -0
- package/tokens/latest/_md-comp-sheet-floating.scss +34 -0
- package/tokens/latest/_md-comp-sheet-side.scss +75 -0
- package/tokens/latest/_md-comp-slider.scss +105 -0
- package/tokens/latest/_md-comp-snackbar.scss +91 -0
- package/tokens/latest/_md-comp-standard-menu-button.scss +82 -0
- package/tokens/latest/_md-comp-suggestion-chip.scss +90 -0
- package/tokens/latest/_md-comp-switch.scss +126 -0
- package/tokens/latest/_md-comp-text-button.scss +75 -0
- package/tokens/latest/_md-comp-time-input.scss +184 -0
- package/tokens/latest/_md-comp-time-picker.scss +235 -0
- package/tokens/latest/_md-comp-top-app-bar-large.scss +57 -0
- package/tokens/latest/_md-comp-top-app-bar-medium.scss +56 -0
- package/tokens/latest/_md-comp-top-app-bar-small-centered.scss +60 -0
- package/tokens/latest/_md-comp-top-app-bar-small.scss +58 -0
- package/tokens/latest/_md-ref-palette.scss +95 -0
- package/tokens/latest/_md-ref-typeface.scss +20 -0
- package/tokens/latest/_md-sys-color.scss +1006 -0
- package/tokens/latest/_md-sys-elevation.scss +30 -0
- package/tokens/latest/_md-sys-motion.scss +51 -0
- package/tokens/latest/_md-sys-shape.scss +26 -0
- package/tokens/latest/_md-sys-state.scss +19 -0
- package/tokens/latest/_md-sys-typescale.scss +204 -0
- package/tokens/v0_75/_index.scss +154 -0
- package/tokens/v0_75/_md-comp-assist-chip.scss +98 -0
- package/tokens/v0_75/_md-comp-badge.scss +51 -0
- package/tokens/v0_75/_md-comp-banner.scss +99 -0
- package/tokens/v0_75/_md-comp-bottom-app-bar.scss +36 -0
- package/tokens/v0_75/_md-comp-checkbox.scss +59 -0
- package/tokens/v0_75/_md-comp-circular-progress-indicator.scss +37 -0
- package/tokens/v0_75/_md-comp-dialog.scss +102 -0
- package/tokens/v0_75/_md-comp-elevated-button.scss +83 -0
- package/tokens/v0_75/_md-comp-elevated-card.scss +56 -0
- package/tokens/v0_75/_md-comp-extended-fab-branded.scss +77 -0
- package/tokens/v0_75/_md-comp-extended-fab-primary.scss +80 -0
- package/tokens/v0_75/_md-comp-extended-fab-secondary.scss +83 -0
- package/tokens/v0_75/_md-comp-extended-fab-surface.scss +81 -0
- package/tokens/v0_75/_md-comp-extended-fab-tertiary.scss +80 -0
- package/tokens/v0_75/_md-comp-fab-branded-large.scss +59 -0
- package/tokens/v0_75/_md-comp-fab-branded.scss +58 -0
- package/tokens/v0_75/_md-comp-fab-primary-large.scss +61 -0
- package/tokens/v0_75/_md-comp-fab-primary-small.scss +61 -0
- package/tokens/v0_75/_md-comp-fab-primary.scss +61 -0
- package/tokens/v0_75/_md-comp-fab-secondary-large.scss +63 -0
- package/tokens/v0_75/_md-comp-fab-secondary-small.scss +62 -0
- package/tokens/v0_75/_md-comp-fab-secondary.scss +63 -0
- package/tokens/v0_75/_md-comp-fab-surface-large.scss +62 -0
- package/tokens/v0_75/_md-comp-fab-surface-small.scss +62 -0
- package/tokens/v0_75/_md-comp-fab-surface.scss +62 -0
- package/tokens/v0_75/_md-comp-fab-tertiary-large.scss +61 -0
- package/tokens/v0_75/_md-comp-fab-tertiary-small.scss +61 -0
- package/tokens/v0_75/_md-comp-fab-tertiary.scss +61 -0
- package/tokens/v0_75/_md-comp-filled-button-tonal.scss +84 -0
- package/tokens/v0_75/_md-comp-filled-button.scss +87 -0
- package/tokens/v0_75/_md-comp-filled-card.scss +56 -0
- package/tokens/v0_75/_md-comp-filled-icon-button.scss +72 -0
- package/tokens/v0_75/_md-comp-filled-text-field.scss +142 -0
- package/tokens/v0_75/_md-comp-filled-tonal-button.scss +88 -0
- package/tokens/v0_75/_md-comp-filled-tonal-icon-button.scss +83 -0
- package/tokens/v0_75/_md-comp-filter-chip.scss +172 -0
- package/tokens/v0_75/_md-comp-full-screen-dialog.scss +131 -0
- package/tokens/v0_75/_md-comp-icon-button.scss +79 -0
- package/tokens/v0_75/_md-comp-input-chip.scss +112 -0
- package/tokens/v0_75/_md-comp-linear-progress-indicator.scss +39 -0
- package/tokens/v0_75/_md-comp-list.scss +205 -0
- package/tokens/v0_75/_md-comp-menu.scss +113 -0
- package/tokens/v0_75/_md-comp-navigation-bar.scss +131 -0
- package/tokens/v0_75/_md-comp-navigation-drawer.scss +137 -0
- package/tokens/v0_75/_md-comp-navigation-rail.scss +136 -0
- package/tokens/v0_75/_md-comp-outlined-button.scss +80 -0
- package/tokens/v0_75/_md-comp-outlined-card.scss +62 -0
- package/tokens/v0_75/_md-comp-outlined-icon-button.scss +68 -0
- package/tokens/v0_75/_md-comp-outlined-segmented-button.scss +96 -0
- package/tokens/v0_75/_md-comp-outlined-text-field.scss +136 -0
- package/tokens/v0_75/_md-comp-primary-navigation-tab.scss +116 -0
- package/tokens/v0_75/_md-comp-radio-button.scss +58 -0
- package/tokens/v0_75/_md-comp-rich-tooltip.scss +98 -0
- package/tokens/v0_75/_md-comp-secondary-navigation-tab.scss +75 -0
- package/tokens/v0_75/_md-comp-slider.scss +129 -0
- package/tokens/v0_75/_md-comp-snackbar.scss +77 -0
- package/tokens/v0_75/_md-comp-suggestion-chip.scss +90 -0
- package/tokens/v0_75/_md-comp-switch.scss +92 -0
- package/tokens/v0_75/_md-comp-text-button.scss +75 -0
- package/tokens/v0_75/_md-comp-top-app-bar-compact-centered.scss +53 -0
- package/tokens/v0_75/_md-comp-top-app-bar-compact.scss +43 -0
- package/tokens/v0_75/_md-comp-top-app-bar-large.scss +57 -0
- package/tokens/v0_75/_md-comp-top-app-bar-medium.scss +56 -0
- package/tokens/v0_75/_md-comp-top-app-bar-small-centered.scss +60 -0
- package/tokens/v0_75/_md-comp-top-app-bar-small.scss +58 -0
- package/tokens/v0_75/_md-ref-palette.scss +186 -0
- package/tokens/v0_75/_md-ref-typeface.scss +25 -0
- package/tokens/v0_75/_md-sys-color.scss +86 -0
- package/tokens/v0_75/_md-sys-elevation.scss +30 -0
- package/tokens/v0_75/_md-sys-motion.scss +61 -0
- package/tokens/v0_75/_md-sys-shape.scss +29 -0
- package/tokens/v0_75/_md-sys-state.scss +19 -0
- package/tokens/v0_75/_md-sys-typescale.scss +252 -0
- package/tokens/v0_93/_index.scss +184 -0
- package/tokens/v0_93/_md-comp-assist-chip.scss +98 -0
- package/tokens/v0_93/_md-comp-badge.scss +51 -0
- package/tokens/v0_93/_md-comp-banner.scss +99 -0
- package/tokens/v0_93/_md-comp-bottom-app-bar.scss +36 -0
- package/tokens/v0_93/_md-comp-checkbox.scss +119 -0
- package/tokens/v0_93/_md-comp-circular-progress-indicator.scss +37 -0
- package/tokens/v0_93/_md-comp-date-input-modal.scss +76 -0
- package/tokens/v0_93/_md-comp-date-picker-docked.scss +210 -0
- package/tokens/v0_93/_md-comp-date-picker-modal.scss +254 -0
- package/tokens/v0_93/_md-comp-dialog.scss +101 -0
- package/tokens/v0_93/_md-comp-divider.scss +25 -0
- package/tokens/v0_93/_md-comp-elevated-button.scss +83 -0
- package/tokens/v0_93/_md-comp-elevated-card.scss +59 -0
- package/tokens/v0_93/_md-comp-extended-fab-branded.scss +77 -0
- package/tokens/v0_93/_md-comp-extended-fab-primary.scss +80 -0
- package/tokens/v0_93/_md-comp-extended-fab-secondary.scss +83 -0
- package/tokens/v0_93/_md-comp-extended-fab-surface.scss +81 -0
- package/tokens/v0_93/_md-comp-extended-fab-tertiary.scss +80 -0
- package/tokens/v0_93/_md-comp-fab-branded-large.scss +59 -0
- package/tokens/v0_93/_md-comp-fab-branded.scss +58 -0
- package/tokens/v0_93/_md-comp-fab-primary-large.scss +61 -0
- package/tokens/v0_93/_md-comp-fab-primary-small.scss +61 -0
- package/tokens/v0_93/_md-comp-fab-primary.scss +61 -0
- package/tokens/v0_93/_md-comp-fab-secondary-large.scss +63 -0
- package/tokens/v0_93/_md-comp-fab-secondary-small.scss +62 -0
- package/tokens/v0_93/_md-comp-fab-secondary.scss +63 -0
- package/tokens/v0_93/_md-comp-fab-surface-large.scss +62 -0
- package/tokens/v0_93/_md-comp-fab-surface-small.scss +62 -0
- package/tokens/v0_93/_md-comp-fab-surface.scss +62 -0
- package/tokens/v0_93/_md-comp-fab-tertiary-large.scss +61 -0
- package/tokens/v0_93/_md-comp-fab-tertiary-small.scss +61 -0
- package/tokens/v0_93/_md-comp-fab-tertiary.scss +61 -0
- package/tokens/v0_93/_md-comp-filled-autocomplete.scss +235 -0
- package/tokens/v0_93/_md-comp-filled-button.scss +87 -0
- package/tokens/v0_93/_md-comp-filled-card.scss +59 -0
- package/tokens/v0_93/_md-comp-filled-icon-button.scss +72 -0
- package/tokens/v0_93/_md-comp-filled-menu-button.scss +89 -0
- package/tokens/v0_93/_md-comp-filled-select.scss +243 -0
- package/tokens/v0_93/_md-comp-filled-text-field.scss +146 -0
- package/tokens/v0_93/_md-comp-filled-tonal-button.scss +88 -0
- package/tokens/v0_93/_md-comp-filled-tonal-icon-button.scss +83 -0
- package/tokens/v0_93/_md-comp-filter-chip.scss +172 -0
- package/tokens/v0_93/_md-comp-full-screen-dialog.scss +131 -0
- package/tokens/v0_93/_md-comp-icon-button.scss +66 -0
- package/tokens/v0_93/_md-comp-input-chip.scss +112 -0
- package/tokens/v0_93/_md-comp-linear-progress-indicator.scss +39 -0
- package/tokens/v0_93/_md-comp-list.scss +205 -0
- package/tokens/v0_93/_md-comp-menu.scss +113 -0
- package/tokens/v0_93/_md-comp-navigation-bar.scss +97 -0
- package/tokens/v0_93/_md-comp-navigation-drawer.scss +137 -0
- package/tokens/v0_93/_md-comp-navigation-rail.scss +132 -0
- package/tokens/v0_93/_md-comp-outlined-autocomplete.scss +223 -0
- package/tokens/v0_93/_md-comp-outlined-button.scss +80 -0
- package/tokens/v0_93/_md-comp-outlined-card.scss +65 -0
- package/tokens/v0_93/_md-comp-outlined-icon-button.scss +68 -0
- package/tokens/v0_93/_md-comp-outlined-menu-button.scss +83 -0
- package/tokens/v0_93/_md-comp-outlined-segmented-button.scss +97 -0
- package/tokens/v0_93/_md-comp-outlined-select.scss +231 -0
- package/tokens/v0_93/_md-comp-outlined-text-field.scss +140 -0
- package/tokens/v0_93/_md-comp-plain-tooltip.scss +46 -0
- package/tokens/v0_93/_md-comp-primary-navigation-tab.scss +110 -0
- package/tokens/v0_93/_md-comp-radio-button.scss +58 -0
- package/tokens/v0_93/_md-comp-rich-tooltip.scss +98 -0
- package/tokens/v0_93/_md-comp-search-bar.scss +84 -0
- package/tokens/v0_93/_md-comp-search-view.scss +79 -0
- package/tokens/v0_93/_md-comp-secondary-navigation-tab.scss +78 -0
- package/tokens/v0_93/_md-comp-sheet-bottom.scss +41 -0
- package/tokens/v0_93/_md-comp-sheet-side.scss +75 -0
- package/tokens/v0_93/_md-comp-slider.scss +105 -0
- package/tokens/v0_93/_md-comp-snackbar.scss +91 -0
- package/tokens/v0_93/_md-comp-standard-menu-button.scss +82 -0
- package/tokens/v0_93/_md-comp-suggestion-chip.scss +90 -0
- package/tokens/v0_93/_md-comp-switch.scss +126 -0
- package/tokens/v0_93/_md-comp-text-button.scss +75 -0
- package/tokens/v0_93/_md-comp-time-input.scss +184 -0
- package/tokens/v0_93/_md-comp-time-picker.scss +235 -0
- package/tokens/v0_93/_md-comp-top-app-bar-large.scss +57 -0
- package/tokens/v0_93/_md-comp-top-app-bar-medium.scss +56 -0
- package/tokens/v0_93/_md-comp-top-app-bar-small-centered.scss +60 -0
- package/tokens/v0_93/_md-comp-top-app-bar-small.scss +58 -0
- package/tokens/v0_93/_md-ref-palette.scss +95 -0
- package/tokens/v0_93/_md-ref-typeface.scss +20 -0
- package/tokens/v0_93/_md-sys-color.scss +1006 -0
- package/tokens/v0_93/_md-sys-elevation.scss +30 -0
- package/tokens/v0_93/_md-sys-motion.scss +51 -0
- package/tokens/v0_93/_md-sys-shape.scss +26 -0
- package/tokens/v0_93/_md-sys-state.scss +19 -0
- package/tokens/v0_93/_md-sys-typescale.scss +204 -0
- package/types/aria.d.ts +48 -0
- package/types/keys.d.ts +57 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { __decorate, __metadata } from "tslib";
|
|
7
|
+
import { bound } from '@material/web/decorators/bound.js';
|
|
8
|
+
/**
|
|
9
|
+
* A unique symbol key for `FormController` elements to implement their
|
|
10
|
+
* `getFormValue()` function.
|
|
11
|
+
*/
|
|
12
|
+
export const getFormValue = Symbol('getFormValue');
|
|
13
|
+
/**
|
|
14
|
+
* A `ReactiveController` that adds `<form>` support to an element.
|
|
15
|
+
*/
|
|
16
|
+
export class FormController {
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new `FormController` for the given element.
|
|
19
|
+
*
|
|
20
|
+
* @param element The element to add `<form>` support to.
|
|
21
|
+
*/
|
|
22
|
+
constructor(element) {
|
|
23
|
+
this.element = element;
|
|
24
|
+
}
|
|
25
|
+
hostConnected() {
|
|
26
|
+
// If the component internals are not in Shadow DOM, subscribing to form
|
|
27
|
+
// data events could lead to duplicated data, which may not work correctly
|
|
28
|
+
// on the server side.
|
|
29
|
+
if (!this.element.shadowRoot || window.ShadyDOM?.inUse) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
// Preserve a reference to the form, since on hostDisconnected it may be
|
|
33
|
+
// null if the child was removed.
|
|
34
|
+
this.form = this.element.form;
|
|
35
|
+
this.form?.addEventListener('formdata', this.formDataListener);
|
|
36
|
+
}
|
|
37
|
+
hostDisconnected() {
|
|
38
|
+
this.form?.removeEventListener('formdata', this.formDataListener);
|
|
39
|
+
}
|
|
40
|
+
formDataListener(event) {
|
|
41
|
+
if (this.element.disabled) {
|
|
42
|
+
// Check for truthiness since some elements may not support disabling.
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const value = this.element[getFormValue]();
|
|
46
|
+
// If given a `FormData` instance, append all values to the form. This
|
|
47
|
+
// allows elements to customize what is added beyond a single name/value
|
|
48
|
+
// pair.
|
|
49
|
+
if (value instanceof FormData) {
|
|
50
|
+
for (const [key, dataValue] of value) {
|
|
51
|
+
event.formData.append(key, dataValue);
|
|
52
|
+
}
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
// Do not associate the value with the form if there is no value or no name.
|
|
56
|
+
if (value === null || !this.element.name) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
event.formData.append(this.element.name, value);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
__decorate([
|
|
63
|
+
bound,
|
|
64
|
+
__metadata("design:type", Function),
|
|
65
|
+
__metadata("design:paramtypes", [FormDataEvent]),
|
|
66
|
+
__metadata("design:returntype", void 0)
|
|
67
|
+
], FormController.prototype, "formDataListener", null);
|
|
68
|
+
//# sourceMappingURL=form-controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-controller.js","sourceRoot":"","sources":["form-controller.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,KAAK,EAAC,MAAM,mCAAmC,CAAC;AAmCxD;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAEnD;;GAEG;AACH,MAAM,OAAO,cAAc;IAGzB;;;;OAIG;IACH,YAA6B,OAAoB;QAApB,YAAO,GAAP,OAAO,CAAa;IAAG,CAAC;IAErD,aAAa;QACX,wEAAwE;QACxE,0EAA0E;QAC1E,sBAAsB;QACtB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE;YACtD,OAAO;SACR;QAED,wEAAwE;QACxE,iCAAiC;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;QAC9B,IAAI,CAAC,IAAI,EAAE,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACjE,CAAC;IAED,gBAAgB;QACd,IAAI,CAAC,IAAI,EAAE,mBAAmB,CAAC,UAAU,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACpE,CAAC;IAGO,gBAAgB,CAAC,KAAoB;QAC3C,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;YACzB,sEAAsE;YACtE,OAAO;SACR;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;QAC3C,sEAAsE;QACtE,wEAAwE;QACxE,QAAQ;QACR,IAAI,KAAK,YAAY,QAAQ,EAAE;YAC7B,KAAK,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,IAAI,KAAK,EAAE;gBACpC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;aACvC;YACD,OAAO;SACR;QAED,4EAA4E;QAC5E,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;YACxC,OAAO;SACR;QAED,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAClD,CAAC;CACF;AAxBC;IADC,KAAK;;qCAC0B,aAAa;;sDAuB5C","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {bound} from '@material/web/decorators/bound.js';\nimport {ReactiveController, ReactiveControllerHost} from 'lit';\n\ndeclare global {\n interface Window {\n ShadyDOM?: {inUse: boolean;};\n }\n}\n\n/**\n * An element that `FormController` may use.\n */\nexport interface FormElement extends ReactiveControllerHost, HTMLElement {\n /**\n * The `<form>` that this element is associated with.\n */\n readonly form: HTMLFormElement|null;\n /**\n * The name of the element in the form. This property should reflect to a\n * `name` attribute.\n */\n name: string;\n /**\n * Whether or not this element is disabled. If present, this property should\n * reflect to a `disabled` attribute.\n */\n disabled?: boolean;\n /**\n * A function that retrieves the current form value for this element.\n *\n * @return The current form value, or `null` if there is no value.\n */\n [getFormValue](): string|File|FormData|null;\n}\n\n/**\n * A unique symbol key for `FormController` elements to implement their\n * `getFormValue()` function.\n */\nexport const getFormValue = Symbol('getFormValue');\n\n/**\n * A `ReactiveController` that adds `<form>` support to an element.\n */\nexport class FormController implements ReactiveController {\n private form?: HTMLFormElement|null;\n\n /**\n * Creates a new `FormController` for the given element.\n *\n * @param element The element to add `<form>` support to.\n */\n constructor(private readonly element: FormElement) {}\n\n hostConnected() {\n // If the component internals are not in Shadow DOM, subscribing to form\n // data events could lead to duplicated data, which may not work correctly\n // on the server side.\n if (!this.element.shadowRoot || window.ShadyDOM?.inUse) {\n return;\n }\n\n // Preserve a reference to the form, since on hostDisconnected it may be\n // null if the child was removed.\n this.form = this.element.form;\n this.form?.addEventListener('formdata', this.formDataListener);\n }\n\n hostDisconnected() {\n this.form?.removeEventListener('formdata', this.formDataListener);\n }\n\n @bound\n private formDataListener(event: FormDataEvent) {\n if (this.element.disabled) {\n // Check for truthiness since some elements may not support disabling.\n return;\n }\n\n const value = this.element[getFormValue]();\n // If given a `FormData` instance, append all values to the form. This\n // allows elements to customize what is added beyond a single name/value\n // pair.\n if (value instanceof FormData) {\n for (const [key, dataValue] of value) {\n event.formData.append(key, dataValue);\n }\n return;\n }\n\n // Do not associate the value with the form if there is no value or no name.\n if (value === null || !this.element.name) {\n return;\n }\n\n event.formData.append(this.element.name, value);\n }\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Legacy stateful foundation class for components.
|
|
8
|
+
*/
|
|
9
|
+
export declare class Foundation<Adapter extends object> {
|
|
10
|
+
protected adapter: Adapter;
|
|
11
|
+
constructor(adapter: Adapter);
|
|
12
|
+
protected init(): void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The constructor for a foundation.
|
|
16
|
+
*/
|
|
17
|
+
export interface FoundationConstructor<Adapter extends object> {
|
|
18
|
+
new (adapter: Adapter): Foundation<Adapter>;
|
|
19
|
+
readonly prototype: Foundation<Adapter>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Retrieves the adapter type from the provided foundation type.
|
|
23
|
+
*/
|
|
24
|
+
export declare type AdapterOf<FoundationType> = FoundationType extends Foundation<infer A> ? A : never;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Legacy stateful foundation class for components.
|
|
8
|
+
*/
|
|
9
|
+
export class Foundation {
|
|
10
|
+
constructor(adapter) {
|
|
11
|
+
this.adapter = adapter;
|
|
12
|
+
this.init();
|
|
13
|
+
}
|
|
14
|
+
init() {
|
|
15
|
+
// Subclasses should override this method to perform initialization routines
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=foundation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"foundation.js","sourceRoot":"","sources":["foundation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,OAAO,UAAU;IACrB,YAAsB,OAAgB;QAAhB,YAAO,GAAP,OAAO,CAAS;QACpC,IAAI,CAAC,IAAI,EAAE,CAAC;IACd,CAAC;IAES,IAAI;QACZ,4EAA4E;IAC9E,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Legacy stateful foundation class for components.\n */\nexport class Foundation<Adapter extends object> {\n constructor(protected adapter: Adapter) {\n this.init();\n }\n\n protected init() {\n // Subclasses should override this method to perform initialization routines\n }\n}\n\n/**\n * The constructor for a foundation.\n */\nexport interface FoundationConstructor<Adapter extends object> {\n new(adapter: Adapter): Foundation<Adapter>;\n readonly prototype: Foundation<Adapter>;\n}\n\n/**\n * Retrieves the adapter type from the provided foundation type.\n */\nexport type AdapterOf<FoundationType> =\n FoundationType extends Foundation<infer A>? A : never;\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Foundation } from './foundation.js';
|
|
7
|
+
import { ObserverRecord } from './observer.js';
|
|
8
|
+
/**
|
|
9
|
+
* Legacy observer foundation class for components.
|
|
10
|
+
*/
|
|
11
|
+
export declare class ObserverFoundation<Adapter extends object> extends Foundation<Adapter> {
|
|
12
|
+
/**
|
|
13
|
+
* Observe a target's properties for changes using the provided map of
|
|
14
|
+
* property names and observer functions.
|
|
15
|
+
*
|
|
16
|
+
* @template T The target type.
|
|
17
|
+
* @param target - The target to observe.
|
|
18
|
+
* @param observers - An object whose keys are target properties and values
|
|
19
|
+
* are observer functions that are called when the associated property
|
|
20
|
+
* changes.
|
|
21
|
+
* @return A cleanup function that can be called to unobserve the
|
|
22
|
+
* target.
|
|
23
|
+
*/
|
|
24
|
+
protected observe<T extends object>(target: T, observers: ObserverRecord<T, this>): () => void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Foundation } from './foundation.js';
|
|
7
|
+
import { observeProperty } from './observer.js';
|
|
8
|
+
/**
|
|
9
|
+
* Legacy observer foundation class for components.
|
|
10
|
+
*/
|
|
11
|
+
export class ObserverFoundation extends Foundation {
|
|
12
|
+
/**
|
|
13
|
+
* Observe a target's properties for changes using the provided map of
|
|
14
|
+
* property names and observer functions.
|
|
15
|
+
*
|
|
16
|
+
* @template T The target type.
|
|
17
|
+
* @param target - The target to observe.
|
|
18
|
+
* @param observers - An object whose keys are target properties and values
|
|
19
|
+
* are observer functions that are called when the associated property
|
|
20
|
+
* changes.
|
|
21
|
+
* @return A cleanup function that can be called to unobserve the
|
|
22
|
+
* target.
|
|
23
|
+
*/
|
|
24
|
+
observe(target, observers) {
|
|
25
|
+
const cleanup = [];
|
|
26
|
+
for (const property of Object.keys(observers)) {
|
|
27
|
+
const observer = observers[property].bind(this);
|
|
28
|
+
cleanup.push(observeProperty(target, property, observer));
|
|
29
|
+
}
|
|
30
|
+
return () => {
|
|
31
|
+
for (const cleanupFn of cleanup) {
|
|
32
|
+
cleanupFn();
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=observer-foundation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observer-foundation.js","sourceRoot":"","sources":["observer-foundation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAC,eAAe,EAAiB,MAAM,eAAe,CAAC;AAE9D;;GAEG;AACH,MAAM,OAAO,kBAA2C,SACpD,UAAmB;IACrB;;;;;;;;;;;OAWG;IACO,OAAO,CACb,MAAS,EAAE,SAAkC;QAC/C,MAAM,OAAO,GAAe,EAAE,CAAC;QAC/B,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAmB,EAAE;YAC/D,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACjD,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;SAC3D;QAED,OAAO,GAAG,EAAE;YACV,KAAK,MAAM,SAAS,IAAI,OAAO,EAAE;gBAC/B,SAAS,EAAE,CAAC;aACb;QACH,CAAC,CAAC;IACJ,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {Foundation} from './foundation.js';\nimport {observeProperty, ObserverRecord} from './observer.js';\n\n/**\n * Legacy observer foundation class for components.\n */\nexport class ObserverFoundation<Adapter extends object> extends\n Foundation<Adapter> {\n /**\n * Observe a target's properties for changes using the provided map of\n * property names and observer functions.\n *\n * @template T The target type.\n * @param target - The target to observe.\n * @param observers - An object whose keys are target properties and values\n * are observer functions that are called when the associated property\n * changes.\n * @return A cleanup function that can be called to unobserve the\n * target.\n */\n protected observe<T extends object>(\n target: T, observers: ObserverRecord<T, this>) {\n const cleanup: Function[] = [];\n for (const property of Object.keys(observers) as Array<keyof T>) {\n const observer = observers[property]!.bind(this);\n cleanup.push(observeProperty(target, property, observer));\n }\n\n return () => {\n for (const cleanupFn of cleanup) {\n cleanupFn();\n }\n };\n }\n}\n"]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* A function used to observe property changes on a target.
|
|
8
|
+
*
|
|
9
|
+
* @template T The observed target type.
|
|
10
|
+
* @template K The observed property.
|
|
11
|
+
* @template This The `this` context of the observer function.
|
|
12
|
+
* @param current - The current value of the property.
|
|
13
|
+
* @param previous - The previous value of the property.
|
|
14
|
+
*/
|
|
15
|
+
export declare type Observer<T extends object, K extends keyof T = keyof T, This = unknown> = (this: This, current: T[K], previous: T[K]) => void;
|
|
16
|
+
/**
|
|
17
|
+
* An object map whose keys are properties of a target to observe and values
|
|
18
|
+
* are `Observer` functions for each property.
|
|
19
|
+
*
|
|
20
|
+
* @template T The observed target type.
|
|
21
|
+
* @template This The `this` context of observer functions.
|
|
22
|
+
*/
|
|
23
|
+
export declare type ObserverRecord<T extends object, This = unknown> = {
|
|
24
|
+
[K in keyof T]?: Observer<T, K, This>;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Observe a target's property for changes. When a property changes, the
|
|
28
|
+
* provided `Observer` function will be invoked with the properties current and
|
|
29
|
+
* previous values.
|
|
30
|
+
*
|
|
31
|
+
* The returned cleanup function will stop listening to changes for the
|
|
32
|
+
* provided `Observer`.
|
|
33
|
+
*
|
|
34
|
+
* @template T The observed target type.
|
|
35
|
+
* @template K The observed property.
|
|
36
|
+
* @param target - The target to observe.
|
|
37
|
+
* @param property - The property of the target to observe.
|
|
38
|
+
* @param observer - An observer function to invoke each time the property
|
|
39
|
+
* changes.
|
|
40
|
+
* @return A cleanup function that will stop observing changes for the provided
|
|
41
|
+
* `Observer`.
|
|
42
|
+
*/
|
|
43
|
+
export declare function observeProperty<T extends object, K extends keyof T>(target: T, property: K, observer: Observer<T, K>): () => void;
|
|
44
|
+
/**
|
|
45
|
+
* Enables or disables all observers for a provided target. Changes to observed
|
|
46
|
+
* properties will not call any observers when disabled.
|
|
47
|
+
*
|
|
48
|
+
* @template T The observed target type.
|
|
49
|
+
* @param target - The target to enable or disable observers for.
|
|
50
|
+
* @param enabled - True to enable or false to disable observers.
|
|
51
|
+
*/
|
|
52
|
+
export declare function setObserversEnabled<T extends object>(target: T, enabled: boolean): void;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
const isTargetObservers = Symbol();
|
|
7
|
+
const isEnabled = Symbol();
|
|
8
|
+
const getObservers = Symbol();
|
|
9
|
+
/**
|
|
10
|
+
* Observe a target's property for changes. When a property changes, the
|
|
11
|
+
* provided `Observer` function will be invoked with the properties current and
|
|
12
|
+
* previous values.
|
|
13
|
+
*
|
|
14
|
+
* The returned cleanup function will stop listening to changes for the
|
|
15
|
+
* provided `Observer`.
|
|
16
|
+
*
|
|
17
|
+
* @template T The observed target type.
|
|
18
|
+
* @template K The observed property.
|
|
19
|
+
* @param target - The target to observe.
|
|
20
|
+
* @param property - The property of the target to observe.
|
|
21
|
+
* @param observer - An observer function to invoke each time the property
|
|
22
|
+
* changes.
|
|
23
|
+
* @return A cleanup function that will stop observing changes for the provided
|
|
24
|
+
* `Observer`.
|
|
25
|
+
*/
|
|
26
|
+
export function observeProperty(target, property, observer) {
|
|
27
|
+
const observerPrototype = installObserver(target);
|
|
28
|
+
const observers = observerPrototype[getObservers](property);
|
|
29
|
+
observers.push(observer);
|
|
30
|
+
return () => {
|
|
31
|
+
observers.splice(observers.indexOf(observer), 1);
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Installs a `TargetObservers` for the provided target (if not already
|
|
36
|
+
* installed).
|
|
37
|
+
*
|
|
38
|
+
* A target's `TargetObservers` is installed as a Proxy on the target's
|
|
39
|
+
* prototype.
|
|
40
|
+
*
|
|
41
|
+
* @template T The observed target type.
|
|
42
|
+
* @param obj - The target to observe.
|
|
43
|
+
* @return The installed `TargetObservers` for the provided target.
|
|
44
|
+
*/
|
|
45
|
+
function installObserver(obj) {
|
|
46
|
+
const prototype = Object.getPrototypeOf(obj);
|
|
47
|
+
if (prototype[isTargetObservers]) {
|
|
48
|
+
return prototype;
|
|
49
|
+
}
|
|
50
|
+
// Proxy prototypes will not trap plain properties (not a getter/setter) that
|
|
51
|
+
// are already defined. They only work on new plain properties.
|
|
52
|
+
// We can work around this by deleting the properties, installing the Proxy,
|
|
53
|
+
// then re-setting the properties.
|
|
54
|
+
const existingKeyValues = new Map();
|
|
55
|
+
const keys = Object.getOwnPropertyNames(obj);
|
|
56
|
+
for (const key of keys) {
|
|
57
|
+
const descriptor = getDescriptor(obj, key);
|
|
58
|
+
if (descriptor && descriptor.writable) {
|
|
59
|
+
existingKeyValues.set(key, descriptor.value);
|
|
60
|
+
delete obj[key];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const proxy = new Proxy(Object.create(prototype), {
|
|
64
|
+
get(target, key, receiver) {
|
|
65
|
+
return Reflect.get(target, key, receiver);
|
|
66
|
+
},
|
|
67
|
+
set(target, key, newValue, receiver) {
|
|
68
|
+
const isTargetObserversKey = key === isTargetObservers ||
|
|
69
|
+
key === isEnabled || key === getObservers;
|
|
70
|
+
const previous = Reflect.get(target, key, receiver);
|
|
71
|
+
// If a key has an existing setter, invoke it with the receiver to
|
|
72
|
+
// preserve the correct `this` context.
|
|
73
|
+
// Otherwise, the key is either a new or existing plain property and
|
|
74
|
+
// should be set on the target. Setting a plain property on the
|
|
75
|
+
// receiver will cause the proxy to no longer be able to observe it.
|
|
76
|
+
const descriptor = getDescriptor(target, key);
|
|
77
|
+
if (descriptor?.set) {
|
|
78
|
+
Reflect.set(target, key, newValue, receiver);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
Reflect.set(target, key, newValue);
|
|
82
|
+
}
|
|
83
|
+
if (!isTargetObserversKey && proxy[isEnabled] &&
|
|
84
|
+
newValue !== previous) {
|
|
85
|
+
for (const observer of proxy[getObservers](key)) {
|
|
86
|
+
observer(newValue, previous);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
proxy[isTargetObservers] = true;
|
|
93
|
+
proxy[isEnabled] = true;
|
|
94
|
+
const observersMap = new Map();
|
|
95
|
+
proxy[getObservers] = (key) => {
|
|
96
|
+
const observers = observersMap.get(key) || [];
|
|
97
|
+
if (!observersMap.has(key)) {
|
|
98
|
+
observersMap.set(key, observers);
|
|
99
|
+
}
|
|
100
|
+
return observers;
|
|
101
|
+
};
|
|
102
|
+
Object.setPrototypeOf(obj, proxy);
|
|
103
|
+
// Re-set plain pre-existing properties so that the Proxy can trap them
|
|
104
|
+
for (const [key, value] of existingKeyValues.entries()) {
|
|
105
|
+
obj[key] = value;
|
|
106
|
+
}
|
|
107
|
+
return proxy;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Enables or disables all observers for a provided target. Changes to observed
|
|
111
|
+
* properties will not call any observers when disabled.
|
|
112
|
+
*
|
|
113
|
+
* @template T The observed target type.
|
|
114
|
+
* @param target - The target to enable or disable observers for.
|
|
115
|
+
* @param enabled - True to enable or false to disable observers.
|
|
116
|
+
*/
|
|
117
|
+
export function setObserversEnabled(target, enabled) {
|
|
118
|
+
const prototype = Object.getPrototypeOf(target);
|
|
119
|
+
if (prototype[isTargetObservers]) {
|
|
120
|
+
prototype[isEnabled] = enabled;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Retrieves the descriptor for a property from the provided target. This
|
|
125
|
+
* function will walk up the target's prototype chain to search for the
|
|
126
|
+
* descriptor.
|
|
127
|
+
*
|
|
128
|
+
* @template T The target type.
|
|
129
|
+
* @template K The property type.
|
|
130
|
+
* @param target - The target to retrieve a descriptor from.
|
|
131
|
+
* @param property - The name of the property to retrieve a descriptor for.
|
|
132
|
+
* @return the descriptor, or undefined if it does not exist. Keep in mind that
|
|
133
|
+
* plain properties may not have a descriptor defined.
|
|
134
|
+
*/
|
|
135
|
+
function getDescriptor(target, property) {
|
|
136
|
+
let descriptorTarget = target;
|
|
137
|
+
let descriptor;
|
|
138
|
+
while (descriptorTarget) {
|
|
139
|
+
descriptor = Object.getOwnPropertyDescriptor(descriptorTarget, property);
|
|
140
|
+
if (descriptor) {
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
// Walk up the instance's prototype chain in case the property is declared
|
|
144
|
+
// on a superclass.
|
|
145
|
+
descriptorTarget = Object.getPrototypeOf(descriptorTarget);
|
|
146
|
+
}
|
|
147
|
+
return descriptor;
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=observer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observer.js","sourceRoot":"","sources":["observer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA0BH,MAAM,iBAAiB,GAAG,MAAM,EAAE,CAAC;AACnC,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC;AAC3B,MAAM,YAAY,GAAG,MAAM,EAAE,CAAC;AA+B9B;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,eAAe,CAC3B,MAAS,EAAE,QAAW,EAAE,QAAwB;IAClD,MAAM,iBAAiB,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAClD,MAAM,SAAS,GAAG,iBAAiB,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC5D,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACzB,OAAO,GAAG,EAAE;QACV,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;IACnD,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAS,eAAe,CAAmB,GAAM;IAC/C,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IAC7C,IAAI,SAAS,CAAC,iBAAiB,CAAC,EAAE;QAChC,OAAO,SAA+B,CAAC;KACxC;IAED,6EAA6E;IAC7E,+DAA+D;IAC/D,4EAA4E;IAC5E,kCAAkC;IAClC,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAuB,CAAC;IACzD,MAAM,IAAI,GAAG,MAAM,CAAC,mBAAmB,CAAC,GAAG,CAAmB,CAAC;IAC/D,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;QACtB,MAAM,UAAU,GAAG,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAC3C,IAAI,UAAU,IAAI,UAAU,CAAC,QAAQ,EAAE;YACrC,iBAAiB,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,KAAmB,CAAC,CAAC;YAC3D,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;SACjB;KACF;IAED,MAAM,KAAK,GACP,IAAI,KAAK,CAAI,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;QACrC,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ;YACvB,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;QAC5C,CAAC;QACD,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ;YACjC,MAAM,oBAAoB,GAAG,GAAG,KAAK,iBAAiB;gBAClD,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,YAAY,CAAC;YAC9C,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;YACpD,kEAAkE;YAClE,uCAAuC;YACvC,oEAAoE;YACpE,+DAA+D;YAC/D,oEAAoE;YACpE,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,EAAE,GAAc,CAAC,CAAC;YACzD,IAAI,UAAU,EAAE,GAAG,EAAE;gBACnB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;aAC9C;iBAAM;gBACL,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;aACpC;YAED,IAAI,CAAC,oBAAoB,IAAI,KAAK,CAAC,SAAS,CAAC;gBACzC,QAAQ,KAAK,QAAQ,EAAE;gBACzB,KAAK,MAAM,QAAQ,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC,GAAc,CAAC,EAAE;oBAC1D,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;iBAC9B;aACF;YAED,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAuB,CAAC;IAE7B,KAAK,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC;IAChC,KAAK,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IACxB,MAAM,YAAY,GAAG,IAAI,GAAG,EAA+B,CAAC;IAC5D,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,GAAY,EAAE,EAAE;QACrC,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QAC9C,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;YAC1B,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;SAClC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IAEF,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAClC,uEAAuE;IACvE,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,iBAAiB,CAAC,OAAO,EAAE,EAAE;QACtD,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;KAClB;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAC/B,MAAS,EAAE,OAAgB;IAC7B,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IAChD,IAAI,SAAS,CAAC,iBAAiB,CAAC,EAAE;QAC/B,SAAgC,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC;KACxD;AACH,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAS,aAAa,CAClB,MAAS,EAAE,QAAW;IACxB,IAAI,gBAAgB,GAAgB,MAAM,CAAC;IAC3C,IAAI,UAAmD,CAAC;IACxD,OAAO,gBAAgB,EAAE;QACvB,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;QACzE,IAAI,UAAU,EAAE;YACd,MAAM;SACP;QAED,0EAA0E;QAC1E,mBAAmB;QACnB,gBAAgB,GAAG,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;KAC5D;IAED,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * A function used to observe property changes on a target.\n *\n * @template T The observed target type.\n * @template K The observed property.\n * @template This The `this` context of the observer function.\n * @param current - The current value of the property.\n * @param previous - The previous value of the property.\n */\nexport type Observer<T extends object, K extends keyof T = keyof T,\n This = unknown> =\n (this: This, current: T[K], previous: T[K]) => void;\n\n/**\n * An object map whose keys are properties of a target to observe and values\n * are `Observer` functions for each property.\n *\n * @template T The observed target type.\n * @template This The `this` context of observer functions.\n */\nexport type ObserverRecord<T extends object, This = unknown> = {\n [K in keyof T]?: Observer<T, K, This>;\n};\n\nconst isTargetObservers = Symbol();\nconst isEnabled = Symbol();\nconst getObservers = Symbol();\n\n/**\n * A manager for observers listening to a target. A target's `prototype` is its\n * `TargetObservers` instance.\n *\n * @template T The observed target type.\n */\ninterface TargetObservers<T extends object> {\n /**\n * Indicates that the prototype is a `TargetObservers` instance.\n */\n [isTargetObservers]: true;\n\n /**\n * Indicates whether or not observers for this target are enabled. If\n * disabled, observers will not be called in response to target property\n * changes.\n */\n [isEnabled]: boolean;\n\n /**\n * Retrieves all observers for a given target property.\n *\n * @template K The target property key.\n * @param key - The property to retrieve observers for.\n * @return An array of observers for the provided target property.\n */\n [getObservers]: <K extends keyof T>(key: K) => Array<Observer<T, K>>;\n}\n\n/**\n * Observe a target's property for changes. When a property changes, the\n * provided `Observer` function will be invoked with the properties current and\n * previous values.\n *\n * The returned cleanup function will stop listening to changes for the\n * provided `Observer`.\n *\n * @template T The observed target type.\n * @template K The observed property.\n * @param target - The target to observe.\n * @param property - The property of the target to observe.\n * @param observer - An observer function to invoke each time the property\n * changes.\n * @return A cleanup function that will stop observing changes for the provided\n * `Observer`.\n */\nexport function observeProperty<T extends object, K extends keyof T>(\n target: T, property: K, observer: Observer<T, K>) {\n const observerPrototype = installObserver(target);\n const observers = observerPrototype[getObservers](property);\n observers.push(observer);\n return () => {\n observers.splice(observers.indexOf(observer), 1);\n };\n}\n\n/**\n * Installs a `TargetObservers` for the provided target (if not already\n * installed).\n *\n * A target's `TargetObservers` is installed as a Proxy on the target's\n * prototype.\n *\n * @template T The observed target type.\n * @param obj - The target to observe.\n * @return The installed `TargetObservers` for the provided target.\n */\nfunction installObserver<T extends object>(obj: T): TargetObservers<T> {\n const prototype = Object.getPrototypeOf(obj);\n if (prototype[isTargetObservers]) {\n return prototype as TargetObservers<T>;\n }\n\n // Proxy prototypes will not trap plain properties (not a getter/setter) that\n // are already defined. They only work on new plain properties.\n // We can work around this by deleting the properties, installing the Proxy,\n // then re-setting the properties.\n const existingKeyValues = new Map<keyof T, T[keyof T]>();\n const keys = Object.getOwnPropertyNames(obj) as Array<keyof T>;\n for (const key of keys) {\n const descriptor = getDescriptor(obj, key);\n if (descriptor && descriptor.writable) {\n existingKeyValues.set(key, descriptor.value as T[keyof T]);\n delete obj[key];\n }\n }\n\n const proxy =\n new Proxy<T>(Object.create(prototype), {\n get(target, key, receiver) {\n return Reflect.get(target, key, receiver);\n },\n set(target, key, newValue, receiver) {\n const isTargetObserversKey = key === isTargetObservers ||\n key === isEnabled || key === getObservers;\n const previous = Reflect.get(target, key, receiver);\n // If a key has an existing setter, invoke it with the receiver to\n // preserve the correct `this` context.\n // Otherwise, the key is either a new or existing plain property and\n // should be set on the target. Setting a plain property on the\n // receiver will cause the proxy to no longer be able to observe it.\n const descriptor = getDescriptor(target, key as keyof T);\n if (descriptor?.set) {\n Reflect.set(target, key, newValue, receiver);\n } else {\n Reflect.set(target, key, newValue);\n }\n\n if (!isTargetObserversKey && proxy[isEnabled] &&\n newValue !== previous) {\n for (const observer of proxy[getObservers](key as keyof T)) {\n observer(newValue, previous);\n }\n }\n\n return true;\n }\n }) as TargetObservers<T>;\n\n proxy[isTargetObservers] = true;\n proxy[isEnabled] = true;\n const observersMap = new Map<keyof T, Array<Observer<T>>>();\n proxy[getObservers] = (key: keyof T) => {\n const observers = observersMap.get(key) || [];\n if (!observersMap.has(key)) {\n observersMap.set(key, observers);\n }\n\n return observers;\n };\n\n Object.setPrototypeOf(obj, proxy);\n // Re-set plain pre-existing properties so that the Proxy can trap them\n for (const [key, value] of existingKeyValues.entries()) {\n obj[key] = value;\n }\n\n return proxy;\n}\n\n/**\n * Enables or disables all observers for a provided target. Changes to observed\n * properties will not call any observers when disabled.\n *\n * @template T The observed target type.\n * @param target - The target to enable or disable observers for.\n * @param enabled - True to enable or false to disable observers.\n */\nexport function setObserversEnabled<T extends object>(\n target: T, enabled: boolean) {\n const prototype = Object.getPrototypeOf(target);\n if (prototype[isTargetObservers]) {\n (prototype as TargetObservers<T>)[isEnabled] = enabled;\n }\n}\n\n/**\n * Retrieves the descriptor for a property from the provided target. This\n * function will walk up the target's prototype chain to search for the\n * descriptor.\n *\n * @template T The target type.\n * @template K The property type.\n * @param target - The target to retrieve a descriptor from.\n * @param property - The name of the property to retrieve a descriptor for.\n * @return the descriptor, or undefined if it does not exist. Keep in mind that\n * plain properties may not have a descriptor defined.\n */\nfunction getDescriptor<T extends object, K extends keyof T>(\n target: T, property: K) {\n let descriptorTarget: object|null = target;\n let descriptor: TypedPropertyDescriptor<T[K]>|undefined;\n while (descriptorTarget) {\n descriptor = Object.getOwnPropertyDescriptor(descriptorTarget, property);\n if (descriptor) {\n break;\n }\n\n // Walk up the instance's prototype chain in case the property is declared\n // on a superclass.\n descriptorTarget = Object.getPrototypeOf(descriptorTarget);\n }\n\n return descriptor;\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export const stringConverter = {
|
|
7
|
+
fromAttribute(value) {
|
|
8
|
+
return value ?? '';
|
|
9
|
+
},
|
|
10
|
+
toAttribute(value) {
|
|
11
|
+
return value || null;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=string-converter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string-converter.js","sourceRoot":"","sources":["string-converter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,aAAa,CAAC,KAAkB;QAC9B,OAAO,KAAK,IAAI,EAAE,CAAC;IACrB,CAAC;IACD,WAAW,CAAC,KAAa;QACvB,OAAO,KAAK,IAAI,IAAI,CAAC;IACvB,CAAC;CACF,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport const stringConverter = {\n fromAttribute(value: string|null): string {\n return value ?? '';\n },\n toAttribute(value: string): string|null {\n return value || null;\n }\n};\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { ReactiveElement } from 'lit';
|
|
7
|
+
/**
|
|
8
|
+
* A property decorator that helps proxy an aria attribute to an internal node.
|
|
9
|
+
*
|
|
10
|
+
* This decorator is only intended for use with ARIAMixin properties,
|
|
11
|
+
* such as `ariaLabel`, to help with screen readers.
|
|
12
|
+
*
|
|
13
|
+
* This decorator will remove the host `aria-*` attribute at runtime and add it
|
|
14
|
+
* to a `data-aria-*` attribute to avoid screenreader conflicts between the
|
|
15
|
+
* host and internal node.
|
|
16
|
+
*
|
|
17
|
+
* `@ariaProperty` decorated properties should sync with LitElement to the
|
|
18
|
+
* `data-aria-*` attribute, not the native `aria-*` attribute.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* class MyElement extends LitElement {
|
|
23
|
+
* \@ariaProperty
|
|
24
|
+
* // TODO(b/210730484): replace with @soyParam annotation
|
|
25
|
+
* \@property({ type: String, attribute: 'data-aria-label', noAccessor: true})
|
|
26
|
+
* ariaLabel!: string;
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
* @category Decorator
|
|
30
|
+
* @ExportDecoratedItems
|
|
31
|
+
*/
|
|
32
|
+
export declare function ariaProperty<E extends ReactiveElement, K extends keyof E & (`aria${string}` | 'role')>(prototype: E, property: K): void;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* A property decorator that helps proxy an aria attribute to an internal node.
|
|
8
|
+
*
|
|
9
|
+
* This decorator is only intended for use with ARIAMixin properties,
|
|
10
|
+
* such as `ariaLabel`, to help with screen readers.
|
|
11
|
+
*
|
|
12
|
+
* This decorator will remove the host `aria-*` attribute at runtime and add it
|
|
13
|
+
* to a `data-aria-*` attribute to avoid screenreader conflicts between the
|
|
14
|
+
* host and internal node.
|
|
15
|
+
*
|
|
16
|
+
* `@ariaProperty` decorated properties should sync with LitElement to the
|
|
17
|
+
* `data-aria-*` attribute, not the native `aria-*` attribute.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* class MyElement extends LitElement {
|
|
22
|
+
* \@ariaProperty
|
|
23
|
+
* // TODO(b/210730484): replace with @soyParam annotation
|
|
24
|
+
* \@property({ type: String, attribute: 'data-aria-label', noAccessor: true})
|
|
25
|
+
* ariaLabel!: string;
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
* @category Decorator
|
|
29
|
+
* @ExportDecoratedItems
|
|
30
|
+
*/
|
|
31
|
+
export function ariaProperty(prototype, property) {
|
|
32
|
+
// Replace the ARIAMixin property with data-* attribute syncing instead of
|
|
33
|
+
// using the native aria-* attribute reflection. This preserves the attribute
|
|
34
|
+
// for SSR and avoids screenreader conflicts after delegating the attribute
|
|
35
|
+
// to a child node.
|
|
36
|
+
Object.defineProperty(prototype, property, {
|
|
37
|
+
configurable: true,
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get() {
|
|
40
|
+
return this.dataset[property] ?? '';
|
|
41
|
+
},
|
|
42
|
+
set(value) {
|
|
43
|
+
// Coerce non-string values to a string
|
|
44
|
+
const strValue = String(value ?? '');
|
|
45
|
+
if (strValue) {
|
|
46
|
+
this.dataset[property] = strValue;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
delete this.dataset[property];
|
|
50
|
+
}
|
|
51
|
+
// lit will call this setter whenever the data-* attribute changes.
|
|
52
|
+
// However, this.dataset[property] will automatically be updated to the
|
|
53
|
+
// current value. To avoid bugs, always request an update regardless of
|
|
54
|
+
// the old value.
|
|
55
|
+
this.requestUpdate();
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
// Define an internal property that syncs from the `aria-*` attribute with lit
|
|
59
|
+
// and delegates to the real ARIAMixin property, which renders an update.
|
|
60
|
+
// This property will immediately remove the `aria-*` attribute, which doesn't
|
|
61
|
+
// work well with SSR (which is why there's a separate synced property).
|
|
62
|
+
const internalAriaProperty = Symbol(property);
|
|
63
|
+
// "ariaLabel" -> "aria-label" / "ariaLabelledBy" -> "aria-labelledby"
|
|
64
|
+
const ariaAttribute = property.replace('aria', 'aria-').toLowerCase();
|
|
65
|
+
const constructor = prototype.constructor;
|
|
66
|
+
let removingAttribute = false;
|
|
67
|
+
Object.defineProperty(prototype, internalAriaProperty, {
|
|
68
|
+
get() {
|
|
69
|
+
// tslint is failing here, but the types are correct (ARIAMixin
|
|
70
|
+
// properties do not obfuscate with closure)
|
|
71
|
+
// tslint:disable-next-line:no-dict-access-on-struct-type
|
|
72
|
+
return this[property];
|
|
73
|
+
},
|
|
74
|
+
set(value) {
|
|
75
|
+
if (removingAttribute) {
|
|
76
|
+
// Ignore this update, which is triggered below
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
// Set the ARIAMixin property, which will sync the `data-*` attribute
|
|
80
|
+
// and trigger rendering if the value changed.
|
|
81
|
+
// tslint is failing here, but the types are correct (ARIAMixin
|
|
82
|
+
// properties do not obfuscate with closure)
|
|
83
|
+
// tslint:disable-next-line:no-dict-access-on-struct-type
|
|
84
|
+
this[property] = value;
|
|
85
|
+
// Remove the `aria-*` attribute, which will call this setter again with
|
|
86
|
+
// the incorrect value. Ignore these updates.
|
|
87
|
+
removingAttribute = true;
|
|
88
|
+
this.removeAttribute(ariaAttribute);
|
|
89
|
+
removingAttribute = false;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
// Tell lit to observe the `aria-*` attribute and set the internal property,
|
|
93
|
+
// which acts as a "aria-* attribute changed" observer.
|
|
94
|
+
constructor.createProperty(internalAriaProperty, {
|
|
95
|
+
attribute: ariaAttribute,
|
|
96
|
+
noAccessor: true,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=aria-property.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aria-property.js","sourceRoot":"","sources":["aria-property.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,YAAY,CAExB,SAAY,EAAE,QAAW;IAC3B,0EAA0E;IAC1E,6EAA6E;IAC7E,2EAA2E;IAC3E,mBAAmB;IACnB,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,QAAQ,EAAE;QACzC,YAAY,EAAE,IAAI;QAClB,UAAU,EAAE,IAAI;QAChB,GAAG;YACD,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACtC,CAAC;QACD,GAAG,CAAwB,KAAc;YACvC,uCAAuC;YACvC,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;YACrC,IAAI,QAAQ,EAAE;gBACZ,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;aACnC;iBAAM;gBACL,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;aAC/B;YAED,mEAAmE;YACnE,uEAAuE;YACvE,uEAAuE;YACvE,iBAAiB;YACjB,IAAI,CAAC,aAAa,EAAE,CAAC;QACvB,CAAC;KACF,CAAC,CAAC;IAEH,8EAA8E;IAC9E,yEAAyE;IACzE,8EAA8E;IAC9E,wEAAwE;IACxE,MAAM,oBAAoB,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC9C,sEAAsE;IACtE,MAAM,aAAa,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;IACtE,MAAM,WAAW,GAAI,SAAS,CAAC,WAAsC,CAAC;IACtE,IAAI,iBAAiB,GAAG,KAAK,CAAC;IAC9B,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,oBAAoB,EAAE;QACrD,GAAG;YACD,+DAA+D;YAC/D,4CAA4C;YAC5C,yDAAyD;YACzD,OAAQ,IAAU,CAAC,QAAQ,CAAC,CAAC;QAC/B,CAAC;QACD,GAAG,CAAwB,KAAW;YACpC,IAAI,iBAAiB,EAAE;gBACrB,+CAA+C;gBAC/C,OAAO;aACR;YAED,qEAAqE;YACrE,8CAA8C;YAC9C,+DAA+D;YAC/D,4CAA4C;YAC5C,yDAAyD;YACxD,IAAU,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;YAC9B,wEAAwE;YACxE,6CAA6C;YAC7C,iBAAiB,GAAG,IAAI,CAAC;YACzB,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;YACpC,iBAAiB,GAAG,KAAK,CAAC;QAC5B,CAAC;KACF,CAAC,CAAC;IAEH,4EAA4E;IAC5E,uDAAuD;IACvD,WAAW,CAAC,cAAc,CAAC,oBAAoB,EAAE;QAC/C,SAAS,EAAE,aAAa;QACxB,UAAU,EAAE,IAAI;KACjB,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {ReactiveElement} from 'lit';\n\n/**\n * A property decorator that helps proxy an aria attribute to an internal node.\n *\n * This decorator is only intended for use with ARIAMixin properties,\n * such as `ariaLabel`, to help with screen readers.\n *\n * This decorator will remove the host `aria-*` attribute at runtime and add it\n * to a `data-aria-*` attribute to avoid screenreader conflicts between the\n * host and internal node.\n *\n * `@ariaProperty` decorated properties should sync with LitElement to the\n * `data-aria-*` attribute, not the native `aria-*` attribute.\n *\n * @example\n * ```ts\n * class MyElement extends LitElement {\n * \\@ariaProperty\n * // TODO(b/210730484): replace with @soyParam annotation\n * \\@property({ type: String, attribute: 'data-aria-label', noAccessor: true})\n * ariaLabel!: string;\n * }\n * ```\n * @category Decorator\n * @ExportDecoratedItems\n */\nexport function ariaProperty<E extends ReactiveElement, K extends keyof E&\n (`aria${string}` | 'role')>(\n prototype: E, property: K) {\n // Replace the ARIAMixin property with data-* attribute syncing instead of\n // using the native aria-* attribute reflection. This preserves the attribute\n // for SSR and avoids screenreader conflicts after delegating the attribute\n // to a child node.\n Object.defineProperty(prototype, property, {\n configurable: true,\n enumerable: true,\n get(this: ReactiveElement) {\n return this.dataset[property] ?? '';\n },\n set(this: ReactiveElement, value: unknown) {\n // Coerce non-string values to a string\n const strValue = String(value ?? '');\n if (strValue) {\n this.dataset[property] = strValue;\n } else {\n delete this.dataset[property];\n }\n\n // lit will call this setter whenever the data-* attribute changes.\n // However, this.dataset[property] will automatically be updated to the\n // current value. To avoid bugs, always request an update regardless of\n // the old value.\n this.requestUpdate();\n }\n });\n\n // Define an internal property that syncs from the `aria-*` attribute with lit\n // and delegates to the real ARIAMixin property, which renders an update.\n // This property will immediately remove the `aria-*` attribute, which doesn't\n // work well with SSR (which is why there's a separate synced property).\n const internalAriaProperty = Symbol(property);\n // \"ariaLabel\" -> \"aria-label\" / \"ariaLabelledBy\" -> \"aria-labelledby\"\n const ariaAttribute = property.replace('aria', 'aria-').toLowerCase();\n const constructor = (prototype.constructor as typeof ReactiveElement);\n let removingAttribute = false;\n Object.defineProperty(prototype, internalAriaProperty, {\n get(this: ReactiveElement) {\n // tslint is failing here, but the types are correct (ARIAMixin\n // properties do not obfuscate with closure)\n // tslint:disable-next-line:no-dict-access-on-struct-type\n return (this as E)[property];\n },\n set(this: ReactiveElement, value: E[K]) {\n if (removingAttribute) {\n // Ignore this update, which is triggered below\n return;\n }\n\n // Set the ARIAMixin property, which will sync the `data-*` attribute\n // and trigger rendering if the value changed.\n // tslint is failing here, but the types are correct (ARIAMixin\n // properties do not obfuscate with closure)\n // tslint:disable-next-line:no-dict-access-on-struct-type\n (this as E)[property] = value;\n // Remove the `aria-*` attribute, which will call this setter again with\n // the incorrect value. Ignore these updates.\n removingAttribute = true;\n this.removeAttribute(ariaAttribute);\n removingAttribute = false;\n }\n });\n\n // Tell lit to observe the `aria-*` attribute and set the internal property,\n // which acts as a \"aria-* attribute changed\" observer.\n constructor.createProperty(internalAriaProperty, {\n attribute: ariaAttribute,\n noAccessor: true,\n });\n}\n"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { FunctionKeys } from '@material/web/types/keys.js';
|
|
7
|
+
/**
|
|
8
|
+
* Binds a class's method to its instance.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* class MyClass {
|
|
12
|
+
* \@bound
|
|
13
|
+
* foo() { return this; }
|
|
14
|
+
* }
|
|
15
|
+
*
|
|
16
|
+
* const instance = new MyClass();
|
|
17
|
+
* const reference = instance.foo;
|
|
18
|
+
* foo(); // MyClass
|
|
19
|
+
*
|
|
20
|
+
* @category Decorator
|
|
21
|
+
* @ExportDecoratedItems
|
|
22
|
+
*/
|
|
23
|
+
export declare function bound<V extends Function>(target: object, propertyKey: string | symbol, methodDescriptor: TypedPropertyDescriptor<V>): TypedPropertyDescriptor<V>;
|
|
24
|
+
/**
|
|
25
|
+
* Binds a class's function property to its instance.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* class MyClass {
|
|
29
|
+
* \@bound
|
|
30
|
+
* foo = function(this: MyClass) { return this; }
|
|
31
|
+
* }
|
|
32
|
+
*
|
|
33
|
+
* const instance = new MyClass();
|
|
34
|
+
* const reference = instance.foo;
|
|
35
|
+
* foo(); // MyClass
|
|
36
|
+
*
|
|
37
|
+
* @category Decorator
|
|
38
|
+
* @ExportDecoratedItems
|
|
39
|
+
*/
|
|
40
|
+
export declare function bound<T extends object>(target: T, propertyKey: FunctionKeys<T>): any;
|