@material/web 2.4.1 → 2.4.2-nightly.082faad.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/button/internal/button.d.ts +2 -21
- package/button/internal/button.js +4 -43
- package/button/internal/button.js.map +1 -1
- package/button/internal/elevated-styles.d.ts +2 -0
- package/button/internal/elevated-styles.js +1 -0
- package/button/internal/elevated-styles.js.map +1 -1
- package/button/internal/filled-styles.d.ts +2 -0
- package/button/internal/filled-styles.js +1 -0
- package/button/internal/filled-styles.js.map +1 -1
- package/button/internal/filled-tonal-styles.d.ts +2 -0
- package/button/internal/filled-tonal-styles.js +1 -0
- package/button/internal/filled-tonal-styles.js.map +1 -1
- package/button/internal/outlined-styles.d.ts +2 -0
- package/button/internal/outlined-styles.js +1 -0
- package/button/internal/outlined-styles.js.map +1 -1
- package/button/internal/shared-elevation-styles.d.ts +2 -0
- package/button/internal/shared-elevation-styles.js +1 -0
- package/button/internal/shared-elevation-styles.js.map +1 -1
- package/button/internal/shared-styles.d.ts +2 -0
- package/button/internal/shared-styles.js +1 -0
- package/button/internal/shared-styles.js.map +1 -1
- package/button/internal/text-styles.d.ts +2 -0
- package/button/internal/text-styles.js +1 -0
- package/button/internal/text-styles.js.map +1 -1
- package/checkbox/internal/checkbox-styles.d.ts +2 -0
- package/checkbox/internal/checkbox-styles.js +1 -0
- package/checkbox/internal/checkbox-styles.js.map +1 -1
- package/chips/internal/assist-styles.d.ts +2 -0
- package/chips/internal/assist-styles.js +1 -0
- package/chips/internal/assist-styles.js.map +1 -1
- package/chips/internal/chip-set-styles.d.ts +2 -0
- package/chips/internal/chip-set-styles.js +1 -0
- package/chips/internal/chip-set-styles.js.map +1 -1
- package/chips/internal/elevated-styles.d.ts +2 -0
- package/chips/internal/elevated-styles.js +1 -0
- package/chips/internal/elevated-styles.js.map +1 -1
- package/chips/internal/filter-styles.d.ts +2 -0
- package/chips/internal/filter-styles.js +1 -0
- package/chips/internal/filter-styles.js.map +1 -1
- package/chips/internal/input-styles.d.ts +2 -0
- package/chips/internal/input-styles.js +1 -0
- package/chips/internal/input-styles.js.map +1 -1
- package/chips/internal/selectable-styles.d.ts +2 -0
- package/chips/internal/selectable-styles.js +1 -0
- package/chips/internal/selectable-styles.js.map +1 -1
- package/chips/internal/shared-styles.d.ts +2 -0
- package/chips/internal/shared-styles.js +1 -0
- package/chips/internal/shared-styles.js.map +1 -1
- package/chips/internal/suggestion-styles.d.ts +2 -0
- package/chips/internal/suggestion-styles.js +1 -0
- package/chips/internal/suggestion-styles.js.map +1 -1
- package/chips/internal/trailing-icon-styles.d.ts +2 -0
- package/chips/internal/trailing-icon-styles.js +1 -0
- package/chips/internal/trailing-icon-styles.js.map +1 -1
- package/dialog/internal/dialog-styles.d.ts +2 -0
- package/dialog/internal/dialog-styles.js +1 -0
- package/dialog/internal/dialog-styles.js.map +1 -1
- package/divider/internal/divider-styles.d.ts +2 -0
- package/divider/internal/divider-styles.js +1 -0
- package/divider/internal/divider-styles.js.map +1 -1
- package/elevation/internal/elevation-styles.d.ts +2 -0
- package/elevation/internal/elevation-styles.js +1 -0
- package/elevation/internal/elevation-styles.js.map +1 -1
- package/fab/internal/fab-branded-styles.d.ts +2 -0
- package/fab/internal/fab-branded-styles.js +1 -0
- package/fab/internal/fab-branded-styles.js.map +1 -1
- package/fab/internal/fab-styles.d.ts +2 -0
- package/fab/internal/fab-styles.js +1 -0
- package/fab/internal/fab-styles.js.map +1 -1
- package/fab/internal/forced-colors-styles.d.ts +2 -0
- package/fab/internal/forced-colors-styles.js +1 -0
- package/fab/internal/forced-colors-styles.js.map +1 -1
- package/fab/internal/shared-styles.d.ts +2 -0
- package/fab/internal/shared-styles.js +1 -0
- package/fab/internal/shared-styles.js.map +1 -1
- package/field/internal/field.js +12 -1
- package/field/internal/field.js.map +1 -1
- package/field/internal/filled-styles.d.ts +2 -0
- package/field/internal/filled-styles.js +1 -0
- package/field/internal/filled-styles.js.map +1 -1
- package/field/internal/outlined-styles.d.ts +2 -0
- package/field/internal/outlined-styles.js +1 -0
- package/field/internal/outlined-styles.js.map +1 -1
- package/field/internal/shared-styles.d.ts +2 -0
- package/field/internal/shared-styles.js +1 -0
- package/field/internal/shared-styles.js.map +1 -1
- package/focus/internal/focus-ring-styles.d.ts +2 -0
- package/focus/internal/focus-ring-styles.js +1 -0
- package/focus/internal/focus-ring-styles.js.map +1 -1
- package/icon/internal/icon-styles.d.ts +2 -0
- package/icon/internal/icon-styles.js +1 -0
- package/icon/internal/icon-styles.js.map +1 -1
- package/iconbutton/internal/filled-styles.d.ts +2 -0
- package/iconbutton/internal/filled-styles.js +1 -0
- package/iconbutton/internal/filled-styles.js.map +1 -1
- package/iconbutton/internal/filled-tonal-styles.d.ts +2 -0
- package/iconbutton/internal/filled-tonal-styles.js +1 -0
- package/iconbutton/internal/filled-tonal-styles.js.map +1 -1
- package/iconbutton/internal/icon-button.d.ts +2 -32
- package/iconbutton/internal/icon-button.js +33 -84
- package/iconbutton/internal/icon-button.js.map +1 -1
- package/iconbutton/internal/outlined-styles.d.ts +2 -0
- package/iconbutton/internal/outlined-styles.js +1 -0
- package/iconbutton/internal/outlined-styles.js.map +1 -1
- package/iconbutton/internal/shared-styles.d.ts +2 -0
- package/iconbutton/internal/shared-styles.js +1 -0
- package/iconbutton/internal/shared-styles.js.map +1 -1
- package/iconbutton/internal/standard-styles.d.ts +2 -0
- package/iconbutton/internal/standard-styles.js +1 -0
- package/iconbutton/internal/standard-styles.js.map +1 -1
- package/internal/events/dispatch-hooks.js +10 -1
- package/internal/events/dispatch-hooks.js.map +1 -1
- package/labs/badge/internal/badge-styles.d.ts +2 -0
- package/labs/badge/internal/badge-styles.js +1 -0
- package/labs/badge/internal/badge-styles.js.map +1 -1
- package/labs/behaviors/form-associated.d.ts +10 -8
- package/labs/behaviors/form-associated.js +4 -4
- package/labs/behaviors/form-associated.js.map +1 -1
- package/{internal/controller → labs/behaviors}/form-submitter.d.ts +10 -16
- package/labs/behaviors/form-submitter.js +87 -0
- package/labs/behaviors/form-submitter.js.map +1 -0
- package/labs/card/internal/elevated-styles.d.ts +2 -0
- package/labs/card/internal/elevated-styles.js +1 -0
- package/labs/card/internal/elevated-styles.js.map +1 -1
- package/labs/card/internal/filled-styles.d.ts +2 -0
- package/labs/card/internal/filled-styles.js +1 -0
- package/labs/card/internal/filled-styles.js.map +1 -1
- package/labs/card/internal/outlined-styles.d.ts +2 -0
- package/labs/card/internal/outlined-styles.js +1 -0
- package/labs/card/internal/outlined-styles.js.map +1 -1
- package/labs/card/internal/shared-styles.d.ts +2 -0
- package/labs/card/internal/shared-styles.js +1 -0
- package/labs/card/internal/shared-styles.js.map +1 -1
- package/labs/item/internal/item-styles.d.ts +2 -0
- package/labs/item/internal/item-styles.js +1 -0
- package/labs/item/internal/item-styles.js.map +1 -1
- package/labs/navigationbar/internal/navigation-bar-styles.d.ts +2 -0
- package/labs/navigationbar/internal/navigation-bar-styles.js +1 -0
- package/labs/navigationbar/internal/navigation-bar-styles.js.map +1 -1
- package/labs/navigationdrawer/internal/navigation-drawer-modal-styles.d.ts +2 -0
- package/labs/navigationdrawer/internal/navigation-drawer-modal-styles.js +1 -0
- package/labs/navigationdrawer/internal/navigation-drawer-modal-styles.js.map +1 -1
- package/labs/navigationdrawer/internal/navigation-drawer-styles.d.ts +2 -0
- package/labs/navigationdrawer/internal/navigation-drawer-styles.js +1 -0
- package/labs/navigationdrawer/internal/navigation-drawer-styles.js.map +1 -1
- package/labs/navigationdrawer/internal/shared-styles.d.ts +2 -0
- package/labs/navigationdrawer/internal/shared-styles.js +1 -0
- package/labs/navigationdrawer/internal/shared-styles.js.map +1 -1
- package/labs/navigationtab/internal/navigation-tab-styles.d.ts +2 -0
- package/labs/navigationtab/internal/navigation-tab-styles.js +1 -0
- package/labs/navigationtab/internal/navigation-tab-styles.js.map +1 -1
- package/labs/segmentedbutton/internal/outlined-styles.d.ts +2 -0
- package/labs/segmentedbutton/internal/outlined-styles.js +1 -0
- package/labs/segmentedbutton/internal/outlined-styles.js.map +1 -1
- package/labs/segmentedbutton/internal/shared-styles.d.ts +2 -0
- package/labs/segmentedbutton/internal/shared-styles.js +1 -0
- package/labs/segmentedbutton/internal/shared-styles.js.map +1 -1
- package/labs/segmentedbuttonset/internal/outlined-styles.d.ts +2 -0
- package/labs/segmentedbuttonset/internal/outlined-styles.js +1 -0
- package/labs/segmentedbuttonset/internal/outlined-styles.js.map +1 -1
- package/labs/segmentedbuttonset/internal/shared-styles.d.ts +2 -0
- package/labs/segmentedbuttonset/internal/shared-styles.js +1 -0
- package/labs/segmentedbuttonset/internal/shared-styles.js.map +1 -1
- package/list/internal/list-styles.d.ts +2 -0
- package/list/internal/list-styles.js +1 -0
- package/list/internal/list-styles.js.map +1 -1
- package/list/internal/listitem/_list-item.scss +3 -0
- package/list/internal/listitem/list-item-styles.css +1 -1
- package/list/internal/listitem/list-item-styles.css.map +1 -1
- package/list/internal/listitem/list-item-styles.d.ts +2 -0
- package/list/internal/listitem/list-item-styles.js +2 -1
- package/list/internal/listitem/list-item-styles.js.map +1 -1
- package/menu/internal/menu-styles.d.ts +2 -0
- package/menu/internal/menu-styles.js +1 -0
- package/menu/internal/menu-styles.js.map +1 -1
- package/menu/internal/menuitem/_menu-item.scss +3 -0
- package/menu/internal/menuitem/menu-item-styles.css +1 -1
- package/menu/internal/menuitem/menu-item-styles.css.map +1 -1
- package/menu/internal/menuitem/menu-item-styles.d.ts +2 -0
- package/menu/internal/menuitem/menu-item-styles.js +2 -1
- package/menu/internal/menuitem/menu-item-styles.js.map +1 -1
- package/menu/internal/submenu/sub-menu-styles.d.ts +2 -0
- package/menu/internal/submenu/sub-menu-styles.js +1 -0
- package/menu/internal/submenu/sub-menu-styles.js.map +1 -1
- package/package.json +23 -1
- package/progress/internal/circular-progress-styles.d.ts +2 -0
- package/progress/internal/circular-progress-styles.js +1 -0
- package/progress/internal/circular-progress-styles.js.map +1 -1
- package/progress/internal/linear-progress-styles.d.ts +2 -0
- package/progress/internal/linear-progress-styles.js +1 -0
- package/progress/internal/linear-progress-styles.js.map +1 -1
- package/radio/internal/radio-styles.d.ts +2 -0
- package/radio/internal/radio-styles.js +1 -0
- package/radio/internal/radio-styles.js.map +1 -1
- package/ripple/internal/ripple-styles.d.ts +2 -0
- package/ripple/internal/ripple-styles.js +1 -0
- package/ripple/internal/ripple-styles.js.map +1 -1
- package/sass/ext/_assert.scss +82 -0
- package/sass/ext/_list_ext.scss +114 -0
- package/sass/ext/_map_ext.scss +222 -0
- package/sass/ext/_string_ext.scss +153 -0
- package/sass/ext/_throw.scss +83 -0
- package/sass/ext/_type.scss +66 -0
- package/{internal/sass → sass/ext}/_var.scss +86 -96
- package/sass/ext/tests.css +1 -0
- package/sass/ext/tests.css.map +1 -0
- package/sass/ext/tests.scss +18 -0
- package/select/internal/filled-select-styles.d.ts +2 -0
- package/select/internal/filled-select-styles.js +1 -0
- package/select/internal/filled-select-styles.js.map +1 -1
- package/select/internal/outlined-select-styles.d.ts +2 -0
- package/select/internal/outlined-select-styles.js +1 -0
- package/select/internal/outlined-select-styles.js.map +1 -1
- package/select/internal/shared-styles.d.ts +2 -0
- package/select/internal/shared-styles.js +1 -0
- package/select/internal/shared-styles.js.map +1 -1
- package/slider/internal/_slider.scss +1 -0
- package/slider/internal/forced-colors-styles.d.ts +2 -0
- package/slider/internal/forced-colors-styles.js +1 -0
- package/slider/internal/forced-colors-styles.js.map +1 -1
- package/slider/internal/slider-styles.css +1 -1
- package/slider/internal/slider-styles.css.map +1 -1
- package/slider/internal/slider-styles.d.ts +2 -0
- package/slider/internal/slider-styles.js +2 -1
- package/slider/internal/slider-styles.js.map +1 -1
- package/switch/internal/switch-styles.d.ts +2 -0
- package/switch/internal/switch-styles.js +1 -0
- package/switch/internal/switch-styles.js.map +1 -1
- package/tabs/internal/_tab.scss +0 -1
- package/tabs/internal/primary-tab-styles.d.ts +2 -0
- package/tabs/internal/primary-tab-styles.js +1 -0
- package/tabs/internal/primary-tab-styles.js.map +1 -1
- package/tabs/internal/secondary-tab-styles.d.ts +2 -0
- package/tabs/internal/secondary-tab-styles.js +1 -0
- package/tabs/internal/secondary-tab-styles.js.map +1 -1
- package/tabs/internal/tab-styles.css.map +1 -1
- package/tabs/internal/tab-styles.d.ts +2 -0
- package/tabs/internal/tab-styles.js +1 -0
- package/tabs/internal/tab-styles.js.map +1 -1
- package/tabs/internal/tabs-styles.d.ts +2 -0
- package/tabs/internal/tabs-styles.js +1 -0
- package/tabs/internal/tabs-styles.js.map +1 -1
- package/textfield/internal/filled-styles.d.ts +2 -0
- package/textfield/internal/filled-styles.js +1 -0
- package/textfield/internal/filled-styles.js.map +1 -1
- package/textfield/internal/outlined-styles.d.ts +2 -0
- package/textfield/internal/outlined-styles.js +1 -0
- package/textfield/internal/outlined-styles.js.map +1 -1
- package/textfield/internal/shared-styles.d.ts +2 -0
- package/textfield/internal/shared-styles.js +1 -0
- package/textfield/internal/shared-styles.js.map +1 -1
- package/tokens/versions/v30_0/sass/_index.scss +239 -0
- package/tokens/versions/v30_0/sass/_md-comp-app-bar-large-flexible.scss +31 -0
- package/tokens/versions/v30_0/sass/_md-comp-app-bar-large.scss +35 -0
- package/tokens/versions/v30_0/sass/_md-comp-app-bar-medium-flexible.scss +31 -0
- package/tokens/versions/v30_0/sass/_md-comp-app-bar-medium.scss +35 -0
- package/tokens/versions/v30_0/sass/_md-comp-app-bar-small.scss +42 -0
- package/tokens/versions/v30_0/sass/_md-comp-app-bar.scss +59 -0
- package/tokens/versions/v30_0/sass/_md-comp-assist-chip.scss +134 -0
- package/tokens/versions/v30_0/sass/_md-comp-badge.scss +53 -0
- package/tokens/versions/v30_0/sass/_md-comp-banner.scss +147 -0
- package/tokens/versions/v30_0/sass/_md-comp-banners-basic.scss +86 -0
- package/tokens/versions/v30_0/sass/_md-comp-banners-rich.scss +89 -0
- package/tokens/versions/v30_0/sass/_md-comp-banners.scss +43 -0
- package/tokens/versions/v30_0/sass/_md-comp-bottom-app-bar.scss +37 -0
- package/tokens/versions/v30_0/sass/_md-comp-button-elevated.scss +125 -0
- package/tokens/versions/v30_0/sass/_md-comp-button-filled.scss +125 -0
- package/tokens/versions/v30_0/sass/_md-comp-button-group-connected-large.scss +31 -0
- package/tokens/versions/v30_0/sass/_md-comp-button-group-connected-medium.scss +31 -0
- package/tokens/versions/v30_0/sass/_md-comp-button-group-connected-small.scss +31 -0
- package/tokens/versions/v30_0/sass/_md-comp-button-group-connected-xlarge.scss +31 -0
- package/tokens/versions/v30_0/sass/_md-comp-button-group-connected-xsmall.scss +31 -0
- package/tokens/versions/v30_0/sass/_md-comp-button-group-standard-large.scss +29 -0
- package/tokens/versions/v30_0/sass/_md-comp-button-group-standard-medium.scss +29 -0
- package/tokens/versions/v30_0/sass/_md-comp-button-group-standard-small.scss +29 -0
- package/tokens/versions/v30_0/sass/_md-comp-button-group-standard-xlarge.scss +29 -0
- package/tokens/versions/v30_0/sass/_md-comp-button-group-standard-xsmall.scss +29 -0
- package/tokens/versions/v30_0/sass/_md-comp-button-large.scss +51 -0
- package/tokens/versions/v30_0/sass/_md-comp-button-medium.scss +51 -0
- package/tokens/versions/v30_0/sass/_md-comp-button-outlined.scss +124 -0
- package/tokens/versions/v30_0/sass/_md-comp-button-small.scss +51 -0
- package/tokens/versions/v30_0/sass/_md-comp-button-text.scss +60 -0
- package/tokens/versions/v30_0/sass/_md-comp-button-tonal.scss +125 -0
- package/tokens/versions/v30_0/sass/_md-comp-button-xlarge.scss +51 -0
- package/tokens/versions/v30_0/sass/_md-comp-button-xsmall.scss +51 -0
- package/tokens/versions/v30_0/sass/_md-comp-button.scss +163 -0
- package/tokens/versions/v30_0/sass/_md-comp-carousel-item.scss +79 -0
- package/tokens/versions/v30_0/sass/_md-comp-checkbox.scss +216 -0
- package/tokens/versions/v30_0/sass/_md-comp-circular-progress-indicator.scss +52 -0
- package/tokens/versions/v30_0/sass/_md-comp-data-table.scss +110 -0
- package/tokens/versions/v30_0/sass/_md-comp-date-input-modal.scss +80 -0
- package/tokens/versions/v30_0/sass/_md-comp-date-picker-docked.scss +241 -0
- package/tokens/versions/v30_0/sass/_md-comp-date-picker-modal.scss +295 -0
- package/tokens/versions/v30_0/sass/_md-comp-dialog.scss +157 -0
- package/tokens/versions/v30_0/sass/_md-comp-divider.scss +23 -0
- package/tokens/versions/v30_0/sass/_md-comp-drag-handle.scss +54 -0
- package/tokens/versions/v30_0/sass/_md-comp-elevated-button.scss +112 -0
- package/tokens/versions/v30_0/sass/_md-comp-elevated-card.scss +75 -0
- package/tokens/versions/v30_0/sass/_md-comp-extended-fab-branded.scss +100 -0
- package/tokens/versions/v30_0/sass/_md-comp-extended-fab-large.scss +36 -0
- package/tokens/versions/v30_0/sass/_md-comp-extended-fab-medium.scss +36 -0
- package/tokens/versions/v30_0/sass/_md-comp-extended-fab-primary-container.scss +61 -0
- package/tokens/versions/v30_0/sass/_md-comp-extended-fab-primary.scss +174 -0
- package/tokens/versions/v30_0/sass/_md-comp-extended-fab-secondary-container.scss +61 -0
- package/tokens/versions/v30_0/sass/_md-comp-extended-fab-secondary.scss +174 -0
- package/tokens/versions/v30_0/sass/_md-comp-extended-fab-small.scss +36 -0
- package/tokens/versions/v30_0/sass/_md-comp-extended-fab-surface.scss +108 -0
- package/tokens/versions/v30_0/sass/_md-comp-extended-fab-tertiary-container.scss +61 -0
- package/tokens/versions/v30_0/sass/_md-comp-extended-fab-tertiary.scss +174 -0
- package/tokens/versions/v30_0/sass/_md-comp-extended-fab.scss +36 -0
- package/tokens/versions/v30_0/sass/_md-comp-fab-branded-large.scss +79 -0
- package/tokens/versions/v30_0/sass/_md-comp-fab-branded.scss +75 -0
- package/tokens/versions/v30_0/sass/_md-comp-fab-large.scss +27 -0
- package/tokens/versions/v30_0/sass/_md-comp-fab-medium.scss +27 -0
- package/tokens/versions/v30_0/sass/_md-comp-fab-menu-primary-close-button.scss +51 -0
- package/tokens/versions/v30_0/sass/_md-comp-fab-menu-primary-container.scss +59 -0
- package/tokens/versions/v30_0/sass/_md-comp-fab-menu-secondary-close-button.scss +51 -0
- package/tokens/versions/v30_0/sass/_md-comp-fab-menu-secondary-container.scss +59 -0
- package/tokens/versions/v30_0/sass/_md-comp-fab-menu-tertiary-close-button.scss +51 -0
- package/tokens/versions/v30_0/sass/_md-comp-fab-menu-tertiary-container.scss +59 -0
- package/tokens/versions/v30_0/sass/_md-comp-fab-menu.scss +53 -0
- package/tokens/versions/v30_0/sass/_md-comp-fab-primary-container.scss +53 -0
- package/tokens/versions/v30_0/sass/_md-comp-fab-primary-large.scss +77 -0
- package/tokens/versions/v30_0/sass/_md-comp-fab-primary-small.scss +77 -0
- package/tokens/versions/v30_0/sass/_md-comp-fab-primary.scss +131 -0
- package/tokens/versions/v30_0/sass/_md-comp-fab-secondary-container.scss +53 -0
- package/tokens/versions/v30_0/sass/_md-comp-fab-secondary-large.scss +77 -0
- package/tokens/versions/v30_0/sass/_md-comp-fab-secondary-small.scss +77 -0
- package/tokens/versions/v30_0/sass/_md-comp-fab-secondary.scss +131 -0
- package/tokens/versions/v30_0/sass/_md-comp-fab-small.scss +27 -0
- package/tokens/versions/v30_0/sass/_md-comp-fab-surface-large.scss +83 -0
- package/tokens/versions/v30_0/sass/_md-comp-fab-surface.scss +83 -0
- package/tokens/versions/v30_0/sass/_md-comp-fab-tertiary-container.scss +53 -0
- package/tokens/versions/v30_0/sass/_md-comp-fab-tertiary-large.scss +77 -0
- package/tokens/versions/v30_0/sass/_md-comp-fab-tertiary-small.scss +77 -0
- package/tokens/versions/v30_0/sass/_md-comp-fab-tertiary.scss +131 -0
- package/tokens/versions/v30_0/sass/_md-comp-fab.scss +27 -0
- package/tokens/versions/v30_0/sass/_md-comp-filled-autocomplete.scss +279 -0
- package/tokens/versions/v30_0/sass/_md-comp-filled-button.scss +128 -0
- package/tokens/versions/v30_0/sass/_md-comp-filled-card.scss +75 -0
- package/tokens/versions/v30_0/sass/_md-comp-filled-icon-button.scss +102 -0
- package/tokens/versions/v30_0/sass/_md-comp-filled-menu-button.scss +118 -0
- package/tokens/versions/v30_0/sass/_md-comp-filled-select.scss +269 -0
- package/tokens/versions/v30_0/sass/_md-comp-filled-text-field.scss +221 -0
- package/tokens/versions/v30_0/sass/_md-comp-filled-tonal-button.scss +108 -0
- package/tokens/versions/v30_0/sass/_md-comp-filled-tonal-icon-button.scss +102 -0
- package/tokens/versions/v30_0/sass/_md-comp-filter-chip.scss +276 -0
- package/tokens/versions/v30_0/sass/_md-comp-full-screen-dialog.scss +199 -0
- package/tokens/versions/v30_0/sass/_md-comp-icon-button-filled.scss +82 -0
- package/tokens/versions/v30_0/sass/_md-comp-icon-button-large.scss +52 -0
- package/tokens/versions/v30_0/sass/_md-comp-icon-button-medium.scss +52 -0
- package/tokens/versions/v30_0/sass/_md-comp-icon-button-outlined.scss +86 -0
- package/tokens/versions/v30_0/sass/_md-comp-icon-button-small.scss +52 -0
- package/tokens/versions/v30_0/sass/_md-comp-icon-button-standard.scss +72 -0
- package/tokens/versions/v30_0/sass/_md-comp-icon-button-tonal.scss +82 -0
- package/tokens/versions/v30_0/sass/_md-comp-icon-button-xlarge.scss +52 -0
- package/tokens/versions/v30_0/sass/_md-comp-icon-button-xsmall.scss +52 -0
- package/tokens/versions/v30_0/sass/_md-comp-icon-button.scss +193 -0
- package/tokens/versions/v30_0/sass/_md-comp-input-chip.scss +300 -0
- package/tokens/versions/v30_0/sass/_md-comp-linear-progress-indicator.scss +60 -0
- package/tokens/versions/v30_0/sass/_md-comp-list-expand.scss +36 -0
- package/tokens/versions/v30_0/sass/_md-comp-list-reorder.scss +45 -0
- package/tokens/versions/v30_0/sass/_md-comp-list-reveal.scss +50 -0
- package/tokens/versions/v30_0/sass/_md-comp-list.scss +408 -0
- package/tokens/versions/v30_0/sass/_md-comp-loading-indicator.scss +38 -0
- package/tokens/versions/v30_0/sass/_md-comp-menu.scss +218 -0
- package/tokens/versions/v30_0/sass/_md-comp-menus-standard.scss +188 -0
- package/tokens/versions/v30_0/sass/_md-comp-menus-vibrant.scss +160 -0
- package/tokens/versions/v30_0/sass/_md-comp-menus.scss +141 -0
- package/tokens/versions/v30_0/sass/_md-comp-nav-bar-item-horizontal.scss +31 -0
- package/tokens/versions/v30_0/sass/_md-comp-nav-bar-item-vertical.scss +31 -0
- package/tokens/versions/v30_0/sass/_md-comp-nav-bar.scss +68 -0
- package/tokens/versions/v30_0/sass/_md-comp-nav-rail-collapsed.scss +35 -0
- package/tokens/versions/v30_0/sass/_md-comp-nav-rail-expanded.scss +47 -0
- package/tokens/versions/v30_0/sass/_md-comp-nav-rail-item-horizontal.scss +31 -0
- package/tokens/versions/v30_0/sass/_md-comp-nav-rail-item-vertical.scss +33 -0
- package/tokens/versions/v30_0/sass/_md-comp-nav-rail-item.scss +39 -0
- package/tokens/versions/v30_0/sass/_md-comp-nav-rail.scss +48 -0
- package/tokens/versions/v30_0/sass/_md-comp-navigation-bar.scss +150 -0
- package/tokens/versions/v30_0/sass/_md-comp-navigation-drawer.scss +187 -0
- package/tokens/versions/v30_0/sass/_md-comp-navigation-rail.scss +233 -0
- package/tokens/versions/v30_0/sass/_md-comp-outlined-autocomplete.scss +275 -0
- package/tokens/versions/v30_0/sass/_md-comp-outlined-button.scss +108 -0
- package/tokens/versions/v30_0/sass/_md-comp-outlined-card.scss +87 -0
- package/tokens/versions/v30_0/sass/_md-comp-outlined-menu-button.scss +117 -0
- package/tokens/versions/v30_0/sass/_md-comp-outlined-segmented-button.scss +121 -0
- package/tokens/versions/v30_0/sass/_md-comp-outlined-select.scss +266 -0
- package/tokens/versions/v30_0/sass/_md-comp-outlined-text-field.scss +216 -0
- package/tokens/versions/v30_0/sass/_md-comp-plain-tooltip.scss +45 -0
- package/tokens/versions/v30_0/sass/_md-comp-primary-navigation-tab.scss +130 -0
- package/tokens/versions/v30_0/sass/_md-comp-progress-indicator-circular.scss +47 -0
- package/tokens/versions/v30_0/sass/_md-comp-progress-indicator-linear.scss +65 -0
- package/tokens/versions/v30_0/sass/_md-comp-progress-indicator.scss +48 -0
- package/tokens/versions/v30_0/sass/_md-comp-radio-button.scss +72 -0
- package/tokens/versions/v30_0/sass/_md-comp-rich-tooltip.scss +113 -0
- package/tokens/versions/v30_0/sass/_md-comp-scrim.scss +23 -0
- package/tokens/versions/v30_0/sass/_md-comp-search-bar.scss +102 -0
- package/tokens/versions/v30_0/sass/_md-comp-search-view.scss +84 -0
- package/tokens/versions/v30_0/sass/_md-comp-secondary-navigation-tab.scss +104 -0
- package/tokens/versions/v30_0/sass/_md-comp-sheet-bottom.scss +52 -0
- package/tokens/versions/v30_0/sass/_md-comp-sheet-floating.scss +31 -0
- package/tokens/versions/v30_0/sass/_md-comp-sheet-side.scss +96 -0
- package/tokens/versions/v30_0/sass/_md-comp-slider-large.scss +31 -0
- package/tokens/versions/v30_0/sass/_md-comp-slider-medium.scss +31 -0
- package/tokens/versions/v30_0/sass/_md-comp-slider-small.scss +27 -0
- package/tokens/versions/v30_0/sass/_md-comp-slider-xlarge.scss +31 -0
- package/tokens/versions/v30_0/sass/_md-comp-slider-xsmall.scss +27 -0
- package/tokens/versions/v30_0/sass/_md-comp-slider.scss +307 -0
- package/tokens/versions/v30_0/sass/_md-comp-snackbar.scss +115 -0
- package/tokens/versions/v30_0/sass/_md-comp-split-button-large.scss +43 -0
- package/tokens/versions/v30_0/sass/_md-comp-split-button-medium.scss +43 -0
- package/tokens/versions/v30_0/sass/_md-comp-split-button-small.scss +43 -0
- package/tokens/versions/v30_0/sass/_md-comp-split-button-xlarge.scss +43 -0
- package/tokens/versions/v30_0/sass/_md-comp-split-button-xsmall.scss +45 -0
- package/tokens/versions/v30_0/sass/_md-comp-standard-menu-button.scss +103 -0
- package/tokens/versions/v30_0/sass/_md-comp-suggestion-chip.scss +134 -0
- package/tokens/versions/v30_0/sass/_md-comp-switch.scss +191 -0
- package/tokens/versions/v30_0/sass/_md-comp-text-button.scss +94 -0
- package/tokens/versions/v30_0/sass/_md-comp-time-input.scss +206 -0
- package/tokens/versions/v30_0/sass/_md-comp-time-picker.scss +257 -0
- package/tokens/versions/v30_0/sass/_md-comp-toolbar-docked.scss +36 -0
- package/tokens/versions/v30_0/sass/_md-comp-toolbar-floating-fab.scss +51 -0
- package/tokens/versions/v30_0/sass/_md-comp-toolbar-floating.scss +75 -0
- package/tokens/versions/v30_0/sass/_md-comp-toolbar-standard.scss +87 -0
- package/tokens/versions/v30_0/sass/_md-comp-toolbar-vibrant.scss +87 -0
- package/tokens/versions/v30_0/sass/_md-comp-top-app-bar-large.scss +62 -0
- package/tokens/versions/v30_0/sass/_md-comp-top-app-bar-medium.scss +62 -0
- package/tokens/versions/v30_0/sass/_md-comp-top-app-bar-small-centered.scss +72 -0
- package/tokens/versions/v30_0/sass/_md-comp-top-app-bar-small.scss +70 -0
- package/tokens/versions/v30_0/sass/_md-ref-palette.scss +495 -0
- package/tokens/versions/v30_0/sass/_md-ref-typeface.scss +27 -0
- package/tokens/versions/v30_0/sass/_md-sys-color.scss +209 -0
- package/tokens/versions/v30_0/sass/_md-sys-color__dark.scss +209 -0
- package/tokens/versions/v30_0/sass/_md-sys-color__dark__high-contrast.scss +209 -0
- package/tokens/versions/v30_0/sass/_md-sys-color__dark__medium-contrast.scss +209 -0
- package/tokens/versions/v30_0/sass/_md-sys-color__high-contrast.scss +209 -0
- package/tokens/versions/v30_0/sass/_md-sys-color__medium-contrast.scss +209 -0
- package/tokens/versions/v30_0/sass/_md-sys-elevation.scss +35 -0
- package/tokens/versions/v30_0/sass/_md-sys-motion.scss +107 -0
- package/tokens/versions/v30_0/sass/_md-sys-shape.scss +67 -0
- package/tokens/versions/v30_0/sass/_md-sys-state-focus-indicator.scss +23 -0
- package/tokens/versions/v30_0/sass/_md-sys-state.scss +27 -0
- package/tokens/versions/v30_0/sass/_md-sys-typescale-emphasized.scss +559 -0
- package/tokens/versions/v30_0/sass/_md-sys-typescale.scss +571 -0
- package/typography/md-typescale-styles.d.ts +2 -0
- package/typography/md-typescale-styles.js +1 -0
- package/typography/md-typescale-styles.js.map +1 -1
- package/internal/controller/form-submitter.js +0 -69
- package/internal/controller/form-submitter.js.map +0 -1
- package/internal/sass/_string-ext.scss +0 -195
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 Google LLC
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
//
|
|
5
|
+
|
|
6
|
+
// Extensions to the go/sass:map built-in module.
|
|
7
|
+
|
|
8
|
+
// go/keep-sorted start by_regex='(.+) prefix_order=sass:
|
|
9
|
+
@use 'sass:list';
|
|
10
|
+
@use 'sass:map';
|
|
11
|
+
@use 'sass:meta';
|
|
12
|
+
@use 'assert';
|
|
13
|
+
@use 'throw';
|
|
14
|
+
@use 'type';
|
|
15
|
+
// go/keep-sorted end
|
|
16
|
+
|
|
17
|
+
/// The same as `map.get()` but throws an error if the key is not found.
|
|
18
|
+
///
|
|
19
|
+
/// This is useful over `map.get()` when using Sass maps like records, where
|
|
20
|
+
/// the key is expected to exist.
|
|
21
|
+
///
|
|
22
|
+
/// @example scss
|
|
23
|
+
/// $map: (
|
|
24
|
+
/// 'name': 'foo',
|
|
25
|
+
/// 'value': blue,
|
|
26
|
+
/// );
|
|
27
|
+
///
|
|
28
|
+
/// @debug map_ext.get-strict($map, 'name'); // 'foo'
|
|
29
|
+
/// @debug map_ext.get-strict($map, 'bar'); // ERROR: Key "bar" expected but not found in $map: ('name': 'foo', 'value': blue)
|
|
30
|
+
///
|
|
31
|
+
/// @param {map} $map - The map to retrieve the value from.
|
|
32
|
+
/// @param {string} $key - The key of the value to retrieve.
|
|
33
|
+
/// @param {list} $keys - Additional keys to retrieve deeply nested values.
|
|
34
|
+
/// @return {*} The value at the given key.
|
|
35
|
+
/// @throw Error if the key does not exist in the map.
|
|
36
|
+
@function get-strict($map, $key, $keys...) {
|
|
37
|
+
$map: assert.is-type($map, 'map', $source: 'map_ext.get-strict');
|
|
38
|
+
@if throw.get-error($map) {
|
|
39
|
+
@return $map;
|
|
40
|
+
}
|
|
41
|
+
@if not map.has-key($map, $key, $keys...) {
|
|
42
|
+
@return throw.error(
|
|
43
|
+
'Key #{$key} expected but not found in $map: #{meta.inspect($map)}',
|
|
44
|
+
$source: 'map.get-strict'
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@return map.get($map, $key, $keys...);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/// Splits a Map and returns a List pair with two new Maps: the first with the
|
|
52
|
+
/// provided keys and the second without.
|
|
53
|
+
///
|
|
54
|
+
/// @example scss
|
|
55
|
+
/// $map: (
|
|
56
|
+
/// 'focus': blue,
|
|
57
|
+
/// 'focus-within': blue,
|
|
58
|
+
/// 'hover': teal,
|
|
59
|
+
/// 'active': green,
|
|
60
|
+
/// );
|
|
61
|
+
///
|
|
62
|
+
/// $pair: map_ext.split($map, ('focus', 'focus-within'));
|
|
63
|
+
///
|
|
64
|
+
/// $map-with-focus-keys: list.nth($pair, 1);
|
|
65
|
+
/// @debug $map-with-focus-keys; // ('focus': blue, 'focus-within': blue)
|
|
66
|
+
///
|
|
67
|
+
/// $map-with-remaining-keys: list.nth($pair, 2);
|
|
68
|
+
/// @debug $map-with-remaining-keys; // ('hover': teal, 'active': green)
|
|
69
|
+
///
|
|
70
|
+
/// @param {map} $map - The Map to split.
|
|
71
|
+
/// @param {list} $keys - List of keys to split the Map by.
|
|
72
|
+
/// @return {list} A List pair with two new Maps: the first with the keys
|
|
73
|
+
/// provided, and the second with the remaining keys.
|
|
74
|
+
@function split($map, $keys) {
|
|
75
|
+
@if type.matches($keys, 'string') {
|
|
76
|
+
// A list with a single string `('key')` collapses to a single string type
|
|
77
|
+
// at build time. We can force it to be a list using a list API method.
|
|
78
|
+
// Ex:
|
|
79
|
+
// map_ext.split($map, ('key')) is the same as
|
|
80
|
+
// map_ext.split($map, 'key')
|
|
81
|
+
$keys: list.append((), $keys);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// In Sass, `()` counts as both a map and a list, and always reports its type
|
|
85
|
+
// as a list. If we're given an empty map-list, we don't need to throw a type
|
|
86
|
+
// error.
|
|
87
|
+
$map: assert.is-type($map, 'map|list', $source: 'map_ext.split');
|
|
88
|
+
$keys: assert.is-type($keys, 'list', $source: 'map_ext.split');
|
|
89
|
+
$error: throw.get-error($map, $keys);
|
|
90
|
+
@if not $error and list.length($keys) == 0 {
|
|
91
|
+
$error: throw.error(
|
|
92
|
+
'List of keys to split by are empty',
|
|
93
|
+
$source: 'map_ext.split'
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
@if $error {
|
|
97
|
+
@return $error;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// In Sass, `()` is an empty list. We can force Sass to use map types by
|
|
101
|
+
// creating the map with map APIs. This ensures that even if a map is empty,
|
|
102
|
+
// `meta.type-of()` will report it as a map.
|
|
103
|
+
$map-with-keys: map.merge((), ());
|
|
104
|
+
$map-without-keys: map.merge((), ());
|
|
105
|
+
@each $key, $value in $map {
|
|
106
|
+
$has-key: list.index($keys, $key) != null;
|
|
107
|
+
@if $has-key {
|
|
108
|
+
$map-with-keys: map.set($map-with-keys, $key, $value);
|
|
109
|
+
} @else {
|
|
110
|
+
$map-without-keys: map.set($map-without-keys, $key, $value);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@return ($map-with-keys, $map-without-keys);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/// Splits a Map and returns a new Map that only includes the provided keys.
|
|
118
|
+
///
|
|
119
|
+
/// @example scss
|
|
120
|
+
/// $map: (
|
|
121
|
+
/// 'focus': blue,
|
|
122
|
+
/// 'focus-within': blue,
|
|
123
|
+
/// 'hover': teal,
|
|
124
|
+
/// 'active': green,
|
|
125
|
+
/// );
|
|
126
|
+
///
|
|
127
|
+
/// $map-with-focus-keys: map_ext.pick($map, ('focus', 'focus-within'));
|
|
128
|
+
/// @debug $map-with-focus-keys; // ('focus': blue, 'focus-within': blue)
|
|
129
|
+
///
|
|
130
|
+
/// @param {map} $map - The Map to split.
|
|
131
|
+
/// @param {list} $keys - List of keys to include in the new Map.
|
|
132
|
+
/// @return {map} Map with only the keys provided.
|
|
133
|
+
@function pick($map, $keys) {
|
|
134
|
+
$result: split($map, $keys);
|
|
135
|
+
@if throw.get-error($result) {
|
|
136
|
+
@return $result;
|
|
137
|
+
}
|
|
138
|
+
@return list.nth($result, 1);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/// Splits a Map and returns a new Map that excludes the provided keys.
|
|
142
|
+
///
|
|
143
|
+
/// @example scss
|
|
144
|
+
/// $map: (
|
|
145
|
+
/// 'focus': blue,
|
|
146
|
+
/// 'focus-within': blue,
|
|
147
|
+
/// 'hover': teal,
|
|
148
|
+
/// 'active': green,
|
|
149
|
+
/// );
|
|
150
|
+
///
|
|
151
|
+
/// $map-without-focus-keys: map_ext.omit($map, ('focus', 'focus-within'));
|
|
152
|
+
/// @debug $map-without-focus-keys; // ('hover': teal, 'active': green)
|
|
153
|
+
///
|
|
154
|
+
/// @param {map} $map - The Map to split.
|
|
155
|
+
/// @param {list} $keys - List of keys to exclude from the new Map.
|
|
156
|
+
/// @return {map} Map without the keys provided.
|
|
157
|
+
@function omit($map, $keys) {
|
|
158
|
+
$result: split($map, $keys);
|
|
159
|
+
@if throw.get-error($result) {
|
|
160
|
+
@return $result;
|
|
161
|
+
}
|
|
162
|
+
@return list.nth($result, 2);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/// Returns the given map with any matching keys renamed according to the
|
|
166
|
+
/// provided Map of keys to rename.
|
|
167
|
+
///
|
|
168
|
+
/// @example scss
|
|
169
|
+
/// $map: ('foo': red);
|
|
170
|
+
///
|
|
171
|
+
/// $new-map: map_ext.rename-keys($map, ('foo': 'bar'));
|
|
172
|
+
/// @debug $new-map; // ('bar': red)
|
|
173
|
+
///
|
|
174
|
+
/// @param {map} $map - The map to rename keys within.
|
|
175
|
+
/// @param {map} $keys-to-rename - A map of keys and their new names.
|
|
176
|
+
/// @return {map} The map with any matching keys renamed.
|
|
177
|
+
@function rename-keys($map, $keys-to-rename) {
|
|
178
|
+
$new-map: omit($map, map.keys($keys-to-rename));
|
|
179
|
+
@if throw.get-error($new-map) {
|
|
180
|
+
@return $new-map;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
@each $old-key-name, $new-key-name in $keys-to-rename {
|
|
184
|
+
@if map.has-key($map, $old-key-name) {
|
|
185
|
+
$new-map: map.set($new-map, $new-key-name, map.get($map, $old-key-name));
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
@return $new-map;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/// Returns a list of keys where $mapB diverges from $mapA.
|
|
193
|
+
/// Divergence occurs when:
|
|
194
|
+
/// 1. A key exists in $mapB but not in $mapA.
|
|
195
|
+
/// 2. A key exists in both maps but with different values.
|
|
196
|
+
///
|
|
197
|
+
/// @example scss
|
|
198
|
+
/// $mapA: ('foo': red, 'bar': yellow, 'baz': 10);
|
|
199
|
+
/// $mapB: ('foo': red, 'bar': green, 'baz': 10, 'fooBar': blue);
|
|
200
|
+
///
|
|
201
|
+
/// $differences: map_ext.difference($mapA, $mapB);
|
|
202
|
+
/// @debug $differences; // ('bar', 'fooBar')
|
|
203
|
+
///
|
|
204
|
+
/// @param {map} $mapA - The reference map.
|
|
205
|
+
/// @param {map} $mapB - The map to compare against the reference.
|
|
206
|
+
/// @return {list} A list of keys where $mapB diverges from $mapA.
|
|
207
|
+
@function difference($mapA, $mapB) {
|
|
208
|
+
$mapA: assert.is-type($mapA, 'map', $source: 'map_ext.difference');
|
|
209
|
+
$mapB: assert.is-type($mapB, 'map', $source: 'map_ext.difference');
|
|
210
|
+
$error: throw.get-error($mapA, $mapB);
|
|
211
|
+
@if $error {
|
|
212
|
+
@return $error;
|
|
213
|
+
}
|
|
214
|
+
$differences: ();
|
|
215
|
+
@each $key, $value in $mapB {
|
|
216
|
+
@if not map.has-key($mapA, $key) or map.get($mapA, $key) != $value {
|
|
217
|
+
$differences: list.append($differences, $key);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
@return $differences;
|
|
222
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2021 Google LLC
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
//
|
|
5
|
+
|
|
6
|
+
// Extensions to the go/sass:string built-in module.
|
|
7
|
+
|
|
8
|
+
// go/keep-sorted start by_regex='(.+) prefix_order=sass:
|
|
9
|
+
@use 'sass:list';
|
|
10
|
+
@use 'sass:string';
|
|
11
|
+
// go/keep-sorted end
|
|
12
|
+
|
|
13
|
+
/// Checks if a string starts with a given prefix.
|
|
14
|
+
///
|
|
15
|
+
/// @example scss
|
|
16
|
+
/// @debug string_ext.starts-with('var(--foo)', 'var('); // true
|
|
17
|
+
///
|
|
18
|
+
/// @param {string} $string - The string to test.
|
|
19
|
+
/// @param {string} $prefix - The prefix to check.
|
|
20
|
+
/// @return {boolean} True if the string starts with the given prefix.
|
|
21
|
+
@function starts-with($string, $prefix) {
|
|
22
|
+
@return string.slice($string, 1, string.length($prefix)) == $prefix;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/// Checks if a string ends with a given suffix.
|
|
26
|
+
///
|
|
27
|
+
/// @example scss
|
|
28
|
+
/// @debug string_ext.ends-with('var(--foo)', ')'); // true
|
|
29
|
+
///
|
|
30
|
+
/// @param {string} $string - The string to test.
|
|
31
|
+
/// @param {string} $suffix - The suffix to check.
|
|
32
|
+
/// @return {boolean} True if the string ends with the given suffix.
|
|
33
|
+
@function ends-with($string, $suffix) {
|
|
34
|
+
@return string.slice($string, -1 * string.length($suffix)) == $suffix;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/// Trims leading whitespace from the start of a string.
|
|
38
|
+
///
|
|
39
|
+
/// @example scss
|
|
40
|
+
/// @debug string_ext.trim-start(' foo bar '); // "foo bar "
|
|
41
|
+
///
|
|
42
|
+
/// @param {string} $string - The string to trim.
|
|
43
|
+
/// @return {string} The string with whitespace trimmed from the start.
|
|
44
|
+
@function trim-start($string) {
|
|
45
|
+
@while starts-with($string, ' ') {
|
|
46
|
+
$string: replace-start($string, ' ', '');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@return $string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/// Trims trailing whitespace from the end of a string.
|
|
53
|
+
///
|
|
54
|
+
/// @example scss
|
|
55
|
+
/// @debug string_ext.trim-end(' foo bar '); // " foo bar"
|
|
56
|
+
///
|
|
57
|
+
/// @param {string} $string - The string to trim.
|
|
58
|
+
/// @return {string} The string with trailing whitespace trimmed from the end.
|
|
59
|
+
@function trim-end($string) {
|
|
60
|
+
@while ends-with($string, ' ') {
|
|
61
|
+
$string: replace-end($string, ' ', '');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@return $string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/// Trims leading and trailing whitespace from a string.
|
|
68
|
+
///
|
|
69
|
+
/// @example scss
|
|
70
|
+
/// @debug string_ext.trim(' foo bar '); // "foo bar"
|
|
71
|
+
///
|
|
72
|
+
/// @param {string} $string - The string to trim.
|
|
73
|
+
/// @return {string} The string with leading and trailing whitespace trimmed.
|
|
74
|
+
@function trim($string) {
|
|
75
|
+
@return trim-start(trim-end($string));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/// Returns a new string with the first match of a pattern replaced by a given
|
|
79
|
+
/// string.
|
|
80
|
+
///
|
|
81
|
+
/// @example scss
|
|
82
|
+
/// @debug string_ext.replace('foo bar baz', 'bar', 'quux'); // "foo quux baz"
|
|
83
|
+
///
|
|
84
|
+
/// @param {string} $string - The string to be searched.
|
|
85
|
+
/// @param {string} $pattern - The pattern to search for.
|
|
86
|
+
/// @param {string} $replacement - The value to replace the pattern.
|
|
87
|
+
/// @return {string} The string with the first match of pattern replaced by the
|
|
88
|
+
/// replacement or the initial string itself.
|
|
89
|
+
@function replace($string, $pattern, $replacement) {
|
|
90
|
+
$pattern-index: string.index($string, $pattern);
|
|
91
|
+
@if not $pattern-index {
|
|
92
|
+
@return $string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
$before: string.slice($string, 1, $pattern-index - 1);
|
|
96
|
+
$after: string.slice($string, string.length($pattern) + $pattern-index);
|
|
97
|
+
|
|
98
|
+
@return $before + $replacement + $after;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/// Returns a new string with all matches of a pattern replaced by a given
|
|
102
|
+
/// string.
|
|
103
|
+
///
|
|
104
|
+
/// @example scss
|
|
105
|
+
/// @debug string_ext.replace-all('foo bar baz', 'ba', 'qua'); // "foo quar quaz"
|
|
106
|
+
///
|
|
107
|
+
/// @param {string} $string - The string to be searched.
|
|
108
|
+
/// @param {string} $pattern - The pattern to search for.
|
|
109
|
+
/// @param {string} $replacement - The value to replace the pattern.
|
|
110
|
+
/// @return {string} The string with all matches of pattern replaced by the
|
|
111
|
+
/// replacement or the initial string itself.
|
|
112
|
+
@function replace-all($string, $pattern, $replacement) {
|
|
113
|
+
@while string.index($string, $pattern) {
|
|
114
|
+
$string: replace($string, $pattern, $replacement);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@return $string;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/// Returns a new string that replaces a prefix at the start of the string.
|
|
121
|
+
///
|
|
122
|
+
/// @example scss
|
|
123
|
+
/// @debug string_ext.replace-start('var(--foo)', 'var(', ''); // "--foo)"
|
|
124
|
+
///
|
|
125
|
+
/// @param {string} $string - The string to be searched.
|
|
126
|
+
/// @param {string} $prefix - The prefix string to replace.
|
|
127
|
+
/// @param {string} $replacement - The value to replace the prefix.
|
|
128
|
+
/// @return {string} The string with the prefix replaced.
|
|
129
|
+
@function replace-start($string, $prefix, $replacement) {
|
|
130
|
+
@if starts-with($string, $prefix) {
|
|
131
|
+
$string: $replacement + string.slice($string, string.length($prefix) + 1);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@return $string;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/// Returns a new string that replaces a suffix at the end of the string.
|
|
138
|
+
///
|
|
139
|
+
/// @example scss
|
|
140
|
+
/// @debug string_ext.replace-end('var(--foo)', ')', ''); // "var(--foo"
|
|
141
|
+
///
|
|
142
|
+
/// @param {string} $string - The string to be searched.
|
|
143
|
+
/// @param {string} $suffix - The suffix string to replace.
|
|
144
|
+
/// @param {string} $replacement - The value to replace the suffix.
|
|
145
|
+
/// @return {string} The string with the suffix trimmed from the end.
|
|
146
|
+
@function replace-end($string, $suffix, $replacement) {
|
|
147
|
+
@if ends-with($string, $suffix) {
|
|
148
|
+
$string: string.slice($string, 1, -1 * string.length($suffix) - 1) +
|
|
149
|
+
$replacement;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@return $string;
|
|
153
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 Google LLC
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
//
|
|
5
|
+
|
|
6
|
+
// Utilities for `sass-true` errors, to support testing error behavior.
|
|
7
|
+
|
|
8
|
+
// go/keep-sorted start by_regex='(.+) prefix_order=sass:
|
|
9
|
+
@use 'sass:meta';
|
|
10
|
+
@use 'sass:string';
|
|
11
|
+
// go/keep-sorted end
|
|
12
|
+
|
|
13
|
+
@forward 'true' show error;
|
|
14
|
+
|
|
15
|
+
/// Returns false if none of the given values are error strings, or returns an
|
|
16
|
+
/// error string if any value has an error.
|
|
17
|
+
///
|
|
18
|
+
/// This is used to support testing error behavior with `sass-true`, since
|
|
19
|
+
/// `@error` messages cannot be caught at build time.
|
|
20
|
+
///
|
|
21
|
+
/// @example scss
|
|
22
|
+
/// // A function that may return an "ERROR:" string in a test.
|
|
23
|
+
/// @function get-value($map, $key) {
|
|
24
|
+
/// @if meta.type-of($map) != 'map' {
|
|
25
|
+
/// // Identical to `@error 'ERROR: Arg is not a map'` outside of tests.
|
|
26
|
+
/// @return throw.error('Arg is not a map');
|
|
27
|
+
/// }
|
|
28
|
+
/// @return map.get($map, $key);
|
|
29
|
+
/// }
|
|
30
|
+
///
|
|
31
|
+
/// // A function that needs to handle potential errors from other functions.
|
|
32
|
+
/// @function mix-primary-on-surface($values) {
|
|
33
|
+
/// $primary: get-value($values, 'primary');
|
|
34
|
+
/// $surface: get-value($values, 'surface');
|
|
35
|
+
/// $error: throw.get-error($primary, $surface);
|
|
36
|
+
/// @if $error {
|
|
37
|
+
/// // Return early to guard logic against additional errors since
|
|
38
|
+
/// // $primary or $surface may be a string instead of a color.
|
|
39
|
+
/// @return $error;
|
|
40
|
+
/// }
|
|
41
|
+
///
|
|
42
|
+
/// @return color.mix($primary, $surface, 10%);
|
|
43
|
+
/// }
|
|
44
|
+
///
|
|
45
|
+
/// Note: `throw.error()` and `throw.get-error()` are only useful when testing
|
|
46
|
+
/// error behavior using `sass-true`. If you are not testing a function, use
|
|
47
|
+
/// `@error` instead.
|
|
48
|
+
///
|
|
49
|
+
/// @example scss
|
|
50
|
+
/// // In a `sass-true` test, `throw.get-error()` can be used to assert that
|
|
51
|
+
/// // an error is thrown.
|
|
52
|
+
/// @use 'true' as test with ($catch-errors: true);
|
|
53
|
+
///
|
|
54
|
+
/// @include test.describe('module.get-value()') {
|
|
55
|
+
/// @include test.it('throws an error if the value is not a map') {
|
|
56
|
+
/// $result: module.get-value('not a map', 'primary');
|
|
57
|
+
/// @include test.assert-truthy(throw.get-error($result), '$result is an error');
|
|
58
|
+
/// }
|
|
59
|
+
/// }
|
|
60
|
+
///
|
|
61
|
+
/// @param {*} $error - The value to check.
|
|
62
|
+
/// @param {list} $errors - Additional values to check. Useful for checking
|
|
63
|
+
/// multiple errors at the same time.
|
|
64
|
+
/// @return {string|boolean} The error string if any value is an error, or false
|
|
65
|
+
/// otherwise.
|
|
66
|
+
@function get-error($error, $errors...) {
|
|
67
|
+
@if _is-error($error) {
|
|
68
|
+
@return $error;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@each $additional-error in $errors {
|
|
72
|
+
@if _is-error($additional-error) {
|
|
73
|
+
@return $additional-error;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@return false;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@function _is-error($error) {
|
|
81
|
+
@return (meta.type-of($error) == 'string') and
|
|
82
|
+
(string.index($error, 'ERROR') == 1);
|
|
83
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 Google LLC
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
//
|
|
5
|
+
|
|
6
|
+
// Utilities for Sass type checking.
|
|
7
|
+
|
|
8
|
+
// go/keep-sorted start by_regex='(.+) prefix_order=sass:
|
|
9
|
+
@use 'sass:meta';
|
|
10
|
+
@use 'sass:string';
|
|
11
|
+
@use 'throw';
|
|
12
|
+
// go/keep-sorted end
|
|
13
|
+
|
|
14
|
+
/// Returns true if the given value matches the provided type string.
|
|
15
|
+
///
|
|
16
|
+
/// The type string supports multiple types separated by `|`, such as
|
|
17
|
+
/// `'string|null'`. Type options are any values returned by `meta.type-of()`.
|
|
18
|
+
///
|
|
19
|
+
/// @example scss
|
|
20
|
+
/// @function is-empty($value) {
|
|
21
|
+
/// @if type.matches($value, 'list|map') {
|
|
22
|
+
/// @return list.length($value) == 0;
|
|
23
|
+
/// }
|
|
24
|
+
/// @if type.matches($value, 'string') {
|
|
25
|
+
/// @return $value == '';
|
|
26
|
+
/// }
|
|
27
|
+
/// @return type.matches($value, 'null');
|
|
28
|
+
/// }
|
|
29
|
+
///
|
|
30
|
+
/// @param {*} $value - The value to check the type of.
|
|
31
|
+
/// @param {string} $type-string - The type to check. May be multiple types
|
|
32
|
+
/// separated by `|`.
|
|
33
|
+
/// @return {boolean} True if the value matches the type string.
|
|
34
|
+
@function matches($value, $type-string) {
|
|
35
|
+
@if meta.type-of($type-string) != 'string' or $type-string == '' {
|
|
36
|
+
@return throw.error(
|
|
37
|
+
'$type-string must be a non-empty string',
|
|
38
|
+
$source: 'type.matches'
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
@if string.index($type-string, ' ') {
|
|
42
|
+
@return throw.error(
|
|
43
|
+
'$type-string may not contain spaces',
|
|
44
|
+
$source: 'type.matches'
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
@if string.index($type-string, 'boolean') {
|
|
48
|
+
@return throw.error(
|
|
49
|
+
'Use "bool" instead of "boolean"',
|
|
50
|
+
$source: 'type.matches'
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
$value-type: meta.type-of($value);
|
|
55
|
+
@if $value-type == $type-string {
|
|
56
|
+
@return true;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@each $type in string.split($type-string, '|') {
|
|
60
|
+
@if $value-type == $type {
|
|
61
|
+
@return true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@return false;
|
|
66
|
+
}
|