@angular/material 18.0.0-next.5 → 18.0.0-rc.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/_index.scss +67 -60
- package/autocomplete/_autocomplete-theme.scss +7 -0
- package/badge/_badge-theme.scss +9 -0
- package/bottom-sheet/_bottom-sheet-theme.scss +7 -0
- package/button/_button-theme.scss +25 -0
- package/button/_fab-theme.scss +13 -0
- package/button/_icon-button-theme.scss +8 -0
- package/button-toggle/_button-toggle-theme.scss +12 -0
- package/card/_card-theme.scss +9 -0
- package/checkbox/_checkbox-theme.scss +2 -4
- package/chips/_chips-theme.scss +10 -0
- package/core/_core-theme.scss +17 -0
- package/core/m2/_index.scss +52 -0
- package/core/m2/_theming.scss +295 -0
- package/core/{typography/_property-getters.scss → m2/_typography-utils.scss} +14 -0
- package/core/{typography/_definition.scss → m2/_typography.scss} +1 -1
- package/core/option/_optgroup-theme.scss +7 -0
- package/core/option/_option-theme.scss +9 -0
- package/core/ripple/_ripple-theme.scss +7 -0
- package/core/selection/pseudo-checkbox/_pseudo-checkbox-theme.scss +13 -0
- package/core/style/_sass-utils.scss +14 -1
- package/core/theming/_color-api-backwards-compatibility.scss +128 -0
- package/core/theming/_config-validation.scss +173 -0
- package/core/theming/_definition.scss +113 -0
- package/core/theming/_m2-inspection.scss +23 -22
- package/core/theming/_palettes.scss +947 -0
- package/core/theming/_theming-deprecated.scss +9 -9
- package/core/theming/_theming.scss +73 -339
- package/core/tokens/_density.scss +191 -0
- package/core/tokens/_format-tokens.scss +5 -0
- package/core/tokens/_m3-tokens.scss +382 -0
- package/core/tokens/_token-utils.scss +179 -42
- package/core/tokens/m2/mat/_chip.scss +3 -3
- package/core/tokens/m2/mat/_form-field.scss +3 -3
- package/core/tokens/m2/mat/_switch.scss +1 -0
- package/core/tokens/m2/mdc/_checkbox.scss +3 -2
- package/core/tokens/m2/mdc/_chip.scss +3 -3
- package/core/tokens/m2/mdc/_radio.scss +3 -2
- package/core/tokens/m3/_index.scss +161 -0
- package/core/tokens/m3/mat/_app.scss +19 -0
- package/core/tokens/m3/mat/_autocomplete.scss +22 -0
- package/core/tokens/m3/mat/_badge.scss +77 -0
- package/core/tokens/m3/mat/_bottom-sheet.scss +24 -0
- package/core/tokens/m3/mat/_card.scss +24 -0
- package/core/tokens/m3/mat/_checkbox.scss +21 -0
- package/core/tokens/m3/mat/_chip.scss +46 -0
- package/core/tokens/m3/mat/_datepicker.scss +123 -0
- package/core/tokens/m3/mat/_dialog.scss +30 -0
- package/core/tokens/m3/mat/_divider.scss +19 -0
- package/core/tokens/m3/mat/_expansion.scss +41 -0
- package/core/tokens/m3/mat/_fab-small.scss +50 -0
- package/core/tokens/m3/mat/_fab.scss +50 -0
- package/core/tokens/m3/mat/_filled-button.scss +54 -0
- package/core/tokens/m3/mat/_form-field.scss +59 -0
- package/core/tokens/m3/mat/_full-pseudo-checkbox.scss +42 -0
- package/core/tokens/m3/mat/_grid-list.scss +21 -0
- package/core/tokens/m3/mat/_icon-button.scss +27 -0
- package/core/tokens/m3/mat/_icon.scss +33 -0
- package/core/tokens/m3/mat/_list.scss +19 -0
- package/core/tokens/m3/mat/_menu.scss +42 -0
- package/core/tokens/m3/mat/_minimal-pseudo-checkbox.scss +33 -0
- package/core/tokens/m3/mat/_optgroup.scss +22 -0
- package/core/tokens/m3/mat/_option.scss +55 -0
- package/core/tokens/m3/mat/_outlined-button.scss +54 -0
- package/core/tokens/m3/mat/_paginator.scss +27 -0
- package/core/tokens/m3/mat/_protected-button.scss +55 -0
- package/core/tokens/m3/mat/_radio.scss +34 -0
- package/core/tokens/m3/mat/_ripple.scss +19 -0
- package/core/tokens/m3/mat/_select.scss +46 -0
- package/core/tokens/m3/mat/_sidenav.scss +28 -0
- package/core/tokens/m3/mat/_slider.scss +56 -0
- package/core/tokens/m3/mat/_snack-bar.scss +18 -0
- package/core/tokens/m3/mat/_sort.scss +18 -0
- package/core/tokens/m3/mat/_standard-button-toggle.scss +57 -0
- package/core/tokens/m3/mat/_stepper.scss +79 -0
- package/core/tokens/m3/mat/_switch.scss +45 -0
- package/core/tokens/m3/mat/_tab-header.scss +51 -0
- package/core/tokens/m3/mat/_table.scss +28 -0
- package/core/tokens/m3/mat/_text-button.scss +55 -0
- package/core/tokens/m3/mat/_toolbar.scss +23 -0
- package/core/tokens/m3/mat/_tree.scss +22 -0
- package/core/tokens/m3/mdc/_checkbox.scss +110 -0
- package/core/tokens/m3/mdc/_chip.scss +91 -0
- package/core/tokens/m3/mdc/_circular-progress.scss +29 -0
- package/core/tokens/m3/mdc/_dialog.scss +39 -0
- package/core/tokens/m3/mdc/_elevated-card.scss +15 -0
- package/core/tokens/m3/mdc/_extended-fab.scss +21 -0
- package/core/tokens/m3/mdc/_fab-small.scss +21 -0
- package/core/tokens/m3/mdc/_fab.scss +21 -0
- package/core/tokens/m3/mdc/_filled-button.scss +86 -0
- package/core/tokens/m3/mdc/_filled-text-field.scss +92 -0
- package/core/tokens/m3/mdc/_form-field.scss +25 -0
- package/core/tokens/m3/mdc/_icon-button.scss +39 -0
- package/core/tokens/m3/mdc/_linear-progress.scss +32 -0
- package/core/tokens/m3/mdc/_list.scss +37 -0
- package/core/tokens/m3/mdc/_outlined-button.scss +83 -0
- package/core/tokens/m3/mdc/_outlined-card.scss +15 -0
- package/core/tokens/m3/mdc/_outlined-text-field.scss +85 -0
- package/core/tokens/m3/mdc/_plain-tooltip.scss +15 -0
- package/core/tokens/m3/mdc/_protected-button.scss +84 -0
- package/core/tokens/m3/mdc/_radio.scss +46 -0
- package/core/tokens/m3/mdc/_slider.scss +61 -0
- package/core/tokens/m3/mdc/_snack-bar.scss +15 -0
- package/core/tokens/m3/mdc/_switch.scss +70 -0
- package/core/tokens/m3/mdc/_tab-indicator.scss +33 -0
- package/core/tokens/m3/mdc/_tab.scss +15 -0
- package/core/tokens/m3/mdc/_text-button.scss +79 -0
- package/core/typography/_all-typography.scss +3 -2
- package/core/typography/_typography-utils.scss +0 -26
- package/core/typography/_typography.scss +0 -2
- package/core/typography/_versioning.scss +3 -3
- package/datepicker/_datepicker-theme.scss +9 -0
- package/datepicker/index.d.ts +5 -0
- package/dialog/_dialog-theme.scss +8 -0
- package/dialog/index.d.ts +4 -3
- package/divider/_divider-theme.scss +7 -0
- package/esm2022/autocomplete/autocomplete-origin.mjs +3 -3
- package/esm2022/autocomplete/autocomplete-trigger.mjs +3 -3
- package/esm2022/autocomplete/autocomplete.mjs +3 -3
- package/esm2022/autocomplete/module.mjs +4 -4
- package/esm2022/badge/badge-module.mjs +4 -4
- package/esm2022/badge/badge.mjs +6 -6
- package/esm2022/bottom-sheet/bottom-sheet-container.mjs +3 -3
- package/esm2022/bottom-sheet/bottom-sheet-module.mjs +4 -4
- package/esm2022/bottom-sheet/bottom-sheet.mjs +3 -3
- package/esm2022/button/button-base.mjs +6 -6
- package/esm2022/button/button.mjs +6 -6
- package/esm2022/button/fab.mjs +12 -12
- package/esm2022/button/icon-button.mjs +6 -6
- package/esm2022/button/module.mjs +4 -4
- package/esm2022/button-toggle/button-toggle-module.mjs +4 -4
- package/esm2022/button-toggle/button-toggle.mjs +6 -6
- package/esm2022/card/card.mjs +42 -42
- package/esm2022/card/module.mjs +4 -4
- package/esm2022/checkbox/checkbox-required-validator.mjs +3 -3
- package/esm2022/checkbox/checkbox.mjs +3 -3
- package/esm2022/checkbox/module.mjs +8 -8
- package/esm2022/chips/chip-action.mjs +3 -3
- package/esm2022/chips/chip-edit-input.mjs +3 -3
- package/esm2022/chips/chip-grid.mjs +3 -3
- package/esm2022/chips/chip-icons.mjs +9 -9
- package/esm2022/chips/chip-input.mjs +3 -3
- package/esm2022/chips/chip-listbox.mjs +3 -3
- package/esm2022/chips/chip-option.mjs +3 -3
- package/esm2022/chips/chip-row.mjs +3 -3
- package/esm2022/chips/chip-set.mjs +3 -3
- package/esm2022/chips/chip.mjs +3 -3
- package/esm2022/chips/module.mjs +4 -4
- package/esm2022/core/common-behaviors/common-module.mjs +4 -4
- package/esm2022/core/datetime/index.mjs +8 -8
- package/esm2022/core/datetime/native-date-adapter.mjs +3 -3
- package/esm2022/core/error/error-options.mjs +6 -6
- package/esm2022/core/internal-form-field/internal-form-field.mjs +3 -3
- package/esm2022/core/line/line.mjs +7 -7
- package/esm2022/core/option/index.mjs +4 -4
- package/esm2022/core/option/optgroup.mjs +3 -3
- package/esm2022/core/option/option.mjs +3 -3
- package/esm2022/core/private/ripple-loader.mjs +3 -3
- package/esm2022/core/ripple/index.mjs +4 -4
- package/esm2022/core/ripple/ripple.mjs +3 -3
- package/esm2022/core/selection/pseudo-checkbox/pseudo-checkbox-module.mjs +4 -4
- package/esm2022/core/selection/pseudo-checkbox/pseudo-checkbox.mjs +3 -3
- package/esm2022/core/version.mjs +1 -1
- package/esm2022/datepicker/calendar-body.mjs +3 -3
- package/esm2022/datepicker/calendar.mjs +6 -6
- package/esm2022/datepicker/date-range-input-parts.mjs +9 -9
- package/esm2022/datepicker/date-range-input.mjs +9 -4
- package/esm2022/datepicker/date-range-picker.mjs +3 -3
- package/esm2022/datepicker/date-range-selection-strategy.mjs +3 -3
- package/esm2022/datepicker/date-selection-model.mjs +9 -9
- package/esm2022/datepicker/datepicker-actions.mjs +9 -9
- package/esm2022/datepicker/datepicker-base.mjs +6 -6
- package/esm2022/datepicker/datepicker-input-base.mjs +3 -3
- package/esm2022/datepicker/datepicker-input.mjs +3 -3
- package/esm2022/datepicker/datepicker-intl.mjs +3 -3
- package/esm2022/datepicker/datepicker-module.mjs +4 -4
- package/esm2022/datepicker/datepicker-toggle.mjs +6 -6
- package/esm2022/datepicker/datepicker.mjs +3 -3
- package/esm2022/datepicker/month-view.mjs +3 -3
- package/esm2022/datepicker/multi-year-view.mjs +3 -3
- package/esm2022/datepicker/year-view.mjs +3 -3
- package/esm2022/dialog/dialog-container.mjs +3 -3
- package/esm2022/dialog/dialog-content-directives.mjs +19 -16
- package/esm2022/dialog/dialog.mjs +3 -3
- package/esm2022/dialog/module.mjs +4 -4
- package/esm2022/divider/divider-module.mjs +4 -4
- package/esm2022/divider/divider.mjs +3 -3
- package/esm2022/expansion/accordion.mjs +3 -3
- package/esm2022/expansion/expansion-module.mjs +4 -4
- package/esm2022/expansion/expansion-panel-content.mjs +3 -3
- package/esm2022/expansion/expansion-panel-header.mjs +9 -9
- package/esm2022/expansion/expansion-panel.mjs +6 -6
- package/esm2022/form-field/directives/error.mjs +3 -3
- package/esm2022/form-field/directives/floating-label.mjs +3 -3
- package/esm2022/form-field/directives/hint.mjs +3 -3
- package/esm2022/form-field/directives/label.mjs +3 -3
- package/esm2022/form-field/directives/line-ripple.mjs +3 -3
- package/esm2022/form-field/directives/notched-outline.mjs +3 -3
- package/esm2022/form-field/directives/prefix.mjs +3 -3
- package/esm2022/form-field/directives/suffix.mjs +3 -3
- package/esm2022/form-field/form-field-control.mjs +4 -4
- package/esm2022/form-field/form-field.mjs +6 -6
- package/esm2022/form-field/module.mjs +4 -4
- package/esm2022/grid-list/grid-list-module.mjs +4 -4
- package/esm2022/grid-list/grid-list.mjs +3 -3
- package/esm2022/grid-list/grid-tile.mjs +15 -15
- package/esm2022/icon/icon-module.mjs +4 -4
- package/esm2022/icon/icon-registry.mjs +3 -3
- package/esm2022/icon/icon.mjs +3 -3
- package/esm2022/icon/testing/fake-icon-registry.mjs +7 -7
- package/esm2022/input/input.mjs +3 -3
- package/esm2022/input/module.mjs +4 -4
- package/esm2022/list/action-list.mjs +3 -3
- package/esm2022/list/list-base.mjs +6 -6
- package/esm2022/list/list-item-sections.mjs +18 -18
- package/esm2022/list/list-module.mjs +4 -4
- package/esm2022/list/list-option.mjs +3 -3
- package/esm2022/list/list.mjs +6 -6
- package/esm2022/list/nav-list.mjs +3 -3
- package/esm2022/list/selection-list.mjs +3 -3
- package/esm2022/list/subheader.mjs +3 -3
- package/esm2022/menu/menu-content.mjs +3 -3
- package/esm2022/menu/menu-item.mjs +3 -3
- package/esm2022/menu/menu-trigger.mjs +3 -3
- package/esm2022/menu/menu.mjs +3 -3
- package/esm2022/menu/module.mjs +4 -4
- package/esm2022/paginator/module.mjs +4 -4
- package/esm2022/paginator/paginator-intl.mjs +3 -3
- package/esm2022/paginator/paginator.mjs +3 -3
- package/esm2022/progress-bar/module.mjs +4 -4
- package/esm2022/progress-bar/progress-bar.mjs +5 -5
- package/esm2022/progress-spinner/module.mjs +4 -4
- package/esm2022/progress-spinner/progress-spinner.mjs +3 -3
- package/esm2022/radio/module.mjs +4 -4
- package/esm2022/radio/radio.mjs +6 -6
- package/esm2022/select/module.mjs +4 -4
- package/esm2022/select/select.mjs +12 -7
- package/esm2022/sidenav/drawer.mjs +9 -9
- package/esm2022/sidenav/sidenav-module.mjs +4 -4
- package/esm2022/sidenav/sidenav.mjs +9 -9
- package/esm2022/slide-toggle/module.mjs +8 -8
- package/esm2022/slide-toggle/slide-toggle-required-validator.mjs +3 -3
- package/esm2022/slide-toggle/slide-toggle.mjs +6 -6
- package/esm2022/slider/module.mjs +4 -4
- package/esm2022/slider/slider-input.mjs +6 -6
- package/esm2022/slider/slider-thumb.mjs +3 -3
- package/esm2022/slider/slider.mjs +3 -3
- package/esm2022/snack-bar/module.mjs +4 -4
- package/esm2022/snack-bar/simple-snack-bar.mjs +3 -3
- package/esm2022/snack-bar/snack-bar-container.mjs +3 -3
- package/esm2022/snack-bar/snack-bar-content.mjs +9 -9
- package/esm2022/snack-bar/snack-bar.mjs +3 -3
- package/esm2022/sort/sort-header-intl.mjs +3 -3
- package/esm2022/sort/sort-header.mjs +3 -3
- package/esm2022/sort/sort-module.mjs +4 -4
- package/esm2022/sort/sort.mjs +3 -3
- package/esm2022/stepper/step-content.mjs +3 -3
- package/esm2022/stepper/step-header.mjs +3 -3
- package/esm2022/stepper/step-label.mjs +3 -3
- package/esm2022/stepper/stepper-button.mjs +6 -6
- package/esm2022/stepper/stepper-icon.mjs +3 -3
- package/esm2022/stepper/stepper-intl.mjs +3 -3
- package/esm2022/stepper/stepper-module.mjs +4 -4
- package/esm2022/stepper/stepper.mjs +6 -6
- package/esm2022/table/cell.mjs +21 -21
- package/esm2022/table/module.mjs +4 -4
- package/esm2022/table/row.mjs +21 -21
- package/esm2022/table/table.mjs +6 -6
- package/esm2022/table/text-column.mjs +3 -3
- package/esm2022/tabs/ink-bar.mjs +3 -3
- package/esm2022/tabs/module.mjs +4 -4
- package/esm2022/tabs/paginated-tab-header.mjs +3 -3
- package/esm2022/tabs/tab-body.mjs +6 -6
- package/esm2022/tabs/tab-content.mjs +3 -3
- package/esm2022/tabs/tab-group.mjs +3 -3
- package/esm2022/tabs/tab-header.mjs +3 -3
- package/esm2022/tabs/tab-label-wrapper.mjs +3 -3
- package/esm2022/tabs/tab-label.mjs +3 -3
- package/esm2022/tabs/tab-nav-bar/tab-nav-bar.mjs +9 -9
- package/esm2022/tabs/tab.mjs +3 -3
- package/esm2022/toolbar/toolbar-module.mjs +4 -4
- package/esm2022/toolbar/toolbar.mjs +6 -6
- package/esm2022/tooltip/module.mjs +4 -4
- package/esm2022/tooltip/tooltip.mjs +6 -6
- package/esm2022/tree/node.mjs +9 -9
- package/esm2022/tree/outlet.mjs +3 -3
- package/esm2022/tree/padding.mjs +3 -3
- package/esm2022/tree/toggle.mjs +3 -3
- package/esm2022/tree/tree-module.mjs +4 -4
- package/esm2022/tree/tree.mjs +3 -3
- package/expansion/_expansion-theme.scss +7 -0
- package/fesm2022/autocomplete.mjs +13 -13
- package/fesm2022/badge.mjs +10 -10
- package/fesm2022/bottom-sheet.mjs +10 -10
- package/fesm2022/button-toggle.mjs +10 -10
- package/fesm2022/button.mjs +34 -34
- package/fesm2022/card.mjs +46 -46
- package/fesm2022/checkbox.mjs +14 -14
- package/fesm2022/chips.mjs +40 -40
- package/fesm2022/core.mjs +59 -59
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/datepicker.mjs +87 -82
- package/fesm2022/datepicker.mjs.map +1 -1
- package/fesm2022/dialog.mjs +28 -25
- package/fesm2022/dialog.mjs.map +1 -1
- package/fesm2022/divider.mjs +7 -7
- package/fesm2022/expansion.mjs +25 -25
- package/fesm2022/form-field.mjs +36 -36
- package/fesm2022/form-field.mjs.map +1 -1
- package/fesm2022/grid-list.mjs +22 -22
- package/fesm2022/icon/testing.mjs +7 -7
- package/fesm2022/icon.mjs +10 -10
- package/fesm2022/input.mjs +7 -7
- package/fesm2022/list.mjs +49 -49
- package/fesm2022/menu.mjs +16 -16
- package/fesm2022/paginator.mjs +10 -10
- package/fesm2022/progress-bar.mjs +8 -8
- package/fesm2022/progress-bar.mjs.map +1 -1
- package/fesm2022/progress-spinner.mjs +7 -7
- package/fesm2022/radio.mjs +10 -10
- package/fesm2022/select.mjs +15 -10
- package/fesm2022/select.mjs.map +1 -1
- package/fesm2022/sidenav.mjs +22 -22
- package/fesm2022/slide-toggle.mjs +16 -16
- package/fesm2022/slide-toggle.mjs.map +1 -1
- package/fesm2022/slider.mjs +16 -16
- package/fesm2022/snack-bar.mjs +22 -22
- package/fesm2022/sort.mjs +13 -13
- package/fesm2022/stepper.mjs +31 -31
- package/fesm2022/table.mjs +55 -55
- package/fesm2022/tabs.mjs +43 -43
- package/fesm2022/toolbar.mjs +10 -10
- package/fesm2022/tooltip.mjs +10 -10
- package/fesm2022/tree.mjs +25 -25
- package/form-field/_form-field-theme.scss +15 -0
- package/form-field/index.d.ts +6 -0
- package/grid-list/_grid-list-theme.scss +7 -0
- package/icon/_icon-theme.scss +9 -0
- package/input/_input-theme.scss +8 -0
- package/list/_list-theme.scss +8 -0
- package/menu/_menu-theme.scss +7 -0
- package/package.json +3 -2
- package/paginator/_paginator-theme.scss +7 -0
- package/prebuilt-themes/azure-blue.css +1 -1
- package/prebuilt-themes/cyan-orange.css +1 -1
- package/prebuilt-themes/deeppurple-amber.css +1 -1
- package/prebuilt-themes/indigo-pink.css +1 -1
- package/prebuilt-themes/magenta-violet.css +1 -1
- package/prebuilt-themes/pink-bluegrey.css +1 -1
- package/prebuilt-themes/purple-green.css +1 -1
- package/prebuilt-themes/rose-red.css +1 -1
- package/progress-bar/_progress-bar-theme.scss +11 -0
- package/progress-spinner/_progress-spinner-theme.scss +11 -0
- package/radio/_radio-theme.scss +10 -0
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/schematics/ng-add/theming/create-custom-theme.js +5 -6
- package/schematics/ng-add/theming/create-custom-theme.mjs +5 -6
- package/schematics/ng-generate/m3-theme/index_bundled.js +4 -4
- package/schematics/ng-generate/m3-theme/index_bundled.js.map +1 -1
- package/schematics/ng-update/index_bundled.js +240 -26
- package/schematics/ng-update/index_bundled.js.map +4 -4
- package/select/_select-theme.scss +9 -0
- package/select/index.d.ts +5 -0
- package/sidenav/_sidenav-theme.scss +7 -0
- package/slide-toggle/_slide-toggle-theme.scss +11 -0
- package/slider/_slider-theme.scss +10 -0
- package/snack-bar/_snack-bar-theme.scss +10 -0
- package/sort/_sort-theme.scss +7 -0
- package/stepper/_stepper-theme.scss +9 -0
- package/table/_table-theme.scss +7 -0
- package/tabs/_tabs-theme.scss +20 -0
- package/toolbar/_toolbar-theme.scss +9 -0
- package/tooltip/_tooltip-theme.scss +8 -0
- package/tree/_tree-theme.scss +7 -0
- /package/core/{theming → m2}/_palette.scss +0 -0
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
@use '
|
|
2
|
-
@use '
|
|
1
|
+
@use '../m2/theming' as m2-theming;
|
|
2
|
+
@use '../m2/palette' as m2-palette;
|
|
3
3
|
|
|
4
4
|
// @deprecated Use `get-color-from-palette`.
|
|
5
5
|
@function color($palette, $hue: default, $opacity: null) {
|
|
6
|
-
@return theming.get-color-from-palette($palette, $hue, $opacity);
|
|
6
|
+
@return m2-theming.get-color-from-palette($palette, $hue, $opacity);
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
// @deprecated Use `get-contrast-color-from-palette`.
|
|
10
10
|
@function contrast($palette, $hue) {
|
|
11
|
-
@return theming.get-contrast-color-from-palette($palette, $hue);
|
|
11
|
+
@return m2-theming.get-contrast-color-from-palette($palette, $hue);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
// @deprecated Use `define-palette`.
|
|
15
15
|
@function palette($base-palette, $default: 500, $lighter: 100, $darker: 700, $text: $default) {
|
|
16
|
-
@return theming.define-palette($base-palette, $default, $lighter, $darker, $text);
|
|
16
|
+
@return m2-theming.define-palette($base-palette, $default, $lighter, $darker, $text);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
// @deprecated Use `define-light-theme`.
|
|
20
|
-
@function dark-theme($primary, $accent: null, $warn: palette(palette.$red-palette)) {
|
|
21
|
-
@return theming.define-dark-theme($primary, $accent, $warn);
|
|
20
|
+
@function dark-theme($primary, $accent: null, $warn: palette(m2-palette.$red-palette)) {
|
|
21
|
+
@return m2-theming.define-dark-theme($primary, $accent, $warn);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
// @deprecated Use `define-light-theme`.
|
|
25
|
-
@function light-theme($primary, $accent: null, $warn: palette(palette.$red-palette)) {
|
|
26
|
-
@return theming.define-light-theme($primary, $accent, $warn);
|
|
25
|
+
@function light-theme($primary, $accent: null, $warn: palette(m2-palette.$red-palette)) {
|
|
26
|
+
@return m2-theming.define-light-theme($primary, $accent, $warn);
|
|
27
27
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
@use 'sass:map';
|
|
3
3
|
@use 'sass:math';
|
|
4
4
|
@use 'sass:meta';
|
|
5
|
-
@use 'palette';
|
|
6
5
|
|
|
7
6
|
// Whether to enable compatibility with legacy methods for accessing theme information.
|
|
8
7
|
$theme-legacy-inspection-api-compatibility: true !default;
|
|
@@ -18,8 +17,8 @@ $_duplicate-warning: 'Read more about how style duplication can be avoided in a
|
|
|
18
17
|
'guide. https://github.com/angular/components/blob/main/guides/duplicate-theming-styles.md';
|
|
19
18
|
|
|
20
19
|
// Warning that will be printed if the legacy theming API is used.
|
|
21
|
-
$
|
|
22
|
-
'keys "color", "typography", and "density". The color value should be a map containing the ' +
|
|
20
|
+
$private-legacy-theme-warning: 'Angular Material themes should be created from a map containing ' +
|
|
21
|
+
'the keys "color", "typography", and "density". The color value should be a map containing the ' +
|
|
23
22
|
'palette values for "primary", "accent", and "warn". ' +
|
|
24
23
|
'See https://material.angular.io/guide/theming for more information.';
|
|
25
24
|
|
|
@@ -34,284 +33,11 @@ $_emitted-typography: () !default;
|
|
|
34
33
|
$_emitted-density: () !default;
|
|
35
34
|
$_emitted-base: () !default;
|
|
36
35
|
|
|
37
|
-
/// Extracts a color from a palette or throws an error if it doesn't exist.
|
|
38
|
-
/// @param {Map} $palette The palette from which to extract a color.
|
|
39
|
-
/// @param {String | Number} $hue The hue for which to get the color.
|
|
40
|
-
@function _get-color-from-palette($palette, $hue) {
|
|
41
|
-
@if map.has-key($palette, $hue) {
|
|
42
|
-
@return map.get($palette, $hue);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@error 'Hue "' + $hue + '" does not exist in palette. Available hues are: ' + map.keys($palette);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/// For a given hue in a palette, return the contrast color from the map of contrast palettes.
|
|
49
|
-
/// @param {Map} $palette The palette from which to extract a color.
|
|
50
|
-
/// @param {String | Number} $hue The hue for which to get a contrast color.
|
|
51
|
-
/// @returns {Color} The contrast color for the given palette and hue.
|
|
52
|
-
@function get-contrast-color-from-palette($palette, $hue) {
|
|
53
|
-
@return map.get(map.get($palette, contrast), $hue);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
/// Creates a map of hues to colors for a theme. This is used to define a theme palette in terms
|
|
58
|
-
/// of the Material Design hues.
|
|
59
|
-
/// @param {Map} $base-palette Map of hue keys to color values for the basis for this palette.
|
|
60
|
-
/// @param {String | Number} $default Default hue for this palette.
|
|
61
|
-
/// @param {String | Number} $lighter "lighter" hue for this palette.
|
|
62
|
-
/// @param {String | Number} $darker "darker" hue for this palette.
|
|
63
|
-
/// @param {String | Number} $text "text" hue for this palette.
|
|
64
|
-
/// @returns {Map} A complete Angular Material theming palette.
|
|
65
|
-
@function define-palette($base-palette, $default: 500, $lighter: 100, $darker: 700,
|
|
66
|
-
$text: $default) {
|
|
67
|
-
$result: map.merge($base-palette, (
|
|
68
|
-
default: _get-color-from-palette($base-palette, $default),
|
|
69
|
-
lighter: _get-color-from-palette($base-palette, $lighter),
|
|
70
|
-
darker: _get-color-from-palette($base-palette, $darker),
|
|
71
|
-
text: _get-color-from-palette($base-palette, $text),
|
|
72
|
-
default-contrast: get-contrast-color-from-palette($base-palette, $default),
|
|
73
|
-
lighter-contrast: get-contrast-color-from-palette($base-palette, $lighter),
|
|
74
|
-
darker-contrast: get-contrast-color-from-palette($base-palette, $darker)
|
|
75
|
-
));
|
|
76
|
-
|
|
77
|
-
// For each hue in the palette, add a "-contrast" color to the map.
|
|
78
|
-
@each $hue, $color in $base-palette {
|
|
79
|
-
$result: map.merge($result, (
|
|
80
|
-
'#{$hue}-contrast': get-contrast-color-from-palette($base-palette, $hue)
|
|
81
|
-
));
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
@return $result;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
/// Gets a color from a theme palette (the output of mat-palette).
|
|
89
|
-
/// The hue can be one of the standard values (500, A400, etc.), one of the three preconfigured
|
|
90
|
-
/// hues (default, lighter, darker), or any of the aforementioned suffixed with "-contrast".
|
|
91
|
-
///
|
|
92
|
-
/// @param {Map} $palette The palette from which to extract a color.
|
|
93
|
-
/// @param {String | Number} $hue The hue from the palette to use. If this is a value between 0
|
|
94
|
-
// and 1, it will be treated as opacity.
|
|
95
|
-
/// @param {Number} $opacity The alpha channel value for the color.
|
|
96
|
-
/// @returns {Color} The color for the given palette, hue, and opacity.
|
|
97
|
-
@function get-color-from-palette($palette, $hue: default, $opacity: null) {
|
|
98
|
-
// If hueKey is a number between zero and one, then it actually contains an
|
|
99
|
-
// opacity value, so recall this function with the default hue and that given opacity.
|
|
100
|
-
@if meta.type-of($hue) == number and $hue >= 0 and $hue <= 1 {
|
|
101
|
-
@return get-color-from-palette($palette, default, $hue);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// We cast the $hue to a string, because some hues starting with a number, like `700-contrast`,
|
|
105
|
-
// might be inferred as numbers by Sass. Casting them to string fixes the map lookup.
|
|
106
|
-
$color: if(map.has-key($palette, $hue), map.get($palette, $hue), map.get($palette, $hue + ''));
|
|
107
|
-
|
|
108
|
-
@if (meta.type-of($color) != color) {
|
|
109
|
-
// If the $color resolved to something different from a color (e.g. a CSS variable),
|
|
110
|
-
// we can't apply the opacity anyway so we return the value as is, otherwise Sass can
|
|
111
|
-
// throw an error or output something invalid.
|
|
112
|
-
@return $color;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
@return rgba($color, if($opacity == null, opacity($color), $opacity));
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// Validates the specified theme by ensuring that the optional color config defines
|
|
119
|
-
// a primary, accent and warn palette. Returns the theme if no failures were found.
|
|
120
|
-
@function _mat-validate-theme($theme) {
|
|
121
|
-
@if map.get($theme, color) {
|
|
122
|
-
$color: map.get($theme, color);
|
|
123
|
-
@if not map.get($color, primary) {
|
|
124
|
-
@error 'Theme does not define a valid "primary" palette.';
|
|
125
|
-
}
|
|
126
|
-
@else if not map.get($color, accent) {
|
|
127
|
-
@error 'Theme does not define a valid "accent" palette.';
|
|
128
|
-
}
|
|
129
|
-
@else if not map.get($color, warn) {
|
|
130
|
-
@error 'Theme does not define a valid "warn" palette.';
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
@return $theme;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// Creates a light-themed color configuration from the specified
|
|
137
|
-
// primary, accent and warn palettes.
|
|
138
|
-
@function _mat-create-light-color-config($primary, $accent, $warn: null) {
|
|
139
|
-
@return (
|
|
140
|
-
primary: $primary,
|
|
141
|
-
accent: $accent,
|
|
142
|
-
warn: if($warn != null, $warn, define-palette(palette.$red-palette)),
|
|
143
|
-
is-dark: false,
|
|
144
|
-
foreground: palette.$light-theme-foreground-palette,
|
|
145
|
-
background: palette.$light-theme-background-palette,
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// Creates a dark-themed color configuration from the specified
|
|
150
|
-
// primary, accent and warn palettes.
|
|
151
|
-
@function _mat-create-dark-color-config($primary, $accent, $warn: null) {
|
|
152
|
-
@return (
|
|
153
|
-
primary: $primary,
|
|
154
|
-
accent: $accent,
|
|
155
|
-
warn: if($warn != null, $warn, define-palette(palette.$red-palette)),
|
|
156
|
-
is-dark: true,
|
|
157
|
-
foreground: palette.$dark-theme-foreground-palette,
|
|
158
|
-
background: palette.$dark-theme-background-palette,
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// TODO: Remove legacy API and rename `$primary` below to `$config`. Currently it cannot be renamed
|
|
163
|
-
// as it would break existing apps that set the parameter by name.
|
|
164
|
-
|
|
165
|
-
/// Creates a container object for a light theme to be given to individual component theme mixins.
|
|
166
|
-
/// @param {Map} $primary The theme configuration object.
|
|
167
|
-
/// @returns {Map} A complete Angular Material theme map.
|
|
168
|
-
@function define-light-theme($primary, $accent: null, $warn: define-palette(palette.$red-palette)) {
|
|
169
|
-
// This function creates a container object for the individual component theme mixins. Consumers
|
|
170
|
-
// can construct such an object by calling this function, or by building the object manually.
|
|
171
|
-
// There are two possible ways to invoke this function in order to create such an object:
|
|
172
|
-
//
|
|
173
|
-
// (1) Passing in a map that holds optional configurations for individual parts of the
|
|
174
|
-
// theming system. For `color` configurations, the function only expects the palettes
|
|
175
|
-
// for `primary` and `accent` (and optionally `warn`). The function will expand the
|
|
176
|
-
// shorthand into an actual configuration that can be consumed in `-color` mixins.
|
|
177
|
-
// (2) Legacy pattern: Passing in the palettes as parameters. This is not as flexible
|
|
178
|
-
// as passing in a configuration map because only the `color` system can be configured.
|
|
179
|
-
//
|
|
180
|
-
// If the legacy pattern is used, we generate a container object only with a light-themed
|
|
181
|
-
// configuration for the `color` theming part.
|
|
182
|
-
@if $accent != null {
|
|
183
|
-
@warn $_legacy-theme-warning;
|
|
184
|
-
@return _internalize-theme(private-create-backwards-compatibility-theme(_mat-validate-theme((
|
|
185
|
-
_is-legacy-theme: true,
|
|
186
|
-
color: _mat-create-light-color-config($primary, $accent, $warn),
|
|
187
|
-
))));
|
|
188
|
-
}
|
|
189
|
-
// If the map pattern is used (1), we just pass-through the configurations for individual
|
|
190
|
-
// parts of the theming system, but update the `color` configuration if set. As explained
|
|
191
|
-
// above, the color shorthand will be expanded to an actual light-themed color configuration.
|
|
192
|
-
$result: $primary;
|
|
193
|
-
@if map.get($primary, color) {
|
|
194
|
-
$color-settings: map.get($primary, color);
|
|
195
|
-
$primary: map.get($color-settings, primary);
|
|
196
|
-
$accent: map.get($color-settings, accent);
|
|
197
|
-
$warn: map.get($color-settings, warn);
|
|
198
|
-
$result: map.merge($result, (color: _mat-create-light-color-config($primary, $accent, $warn)));
|
|
199
|
-
}
|
|
200
|
-
@return _internalize-theme(
|
|
201
|
-
private-create-backwards-compatibility-theme(_mat-validate-theme($result)));
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// TODO: Remove legacy API and rename below `$primary` to `$config`. Currently it cannot be renamed
|
|
205
|
-
// as it would break existing apps that set the parameter by name.
|
|
206
|
-
|
|
207
|
-
/// Creates a container object for a dark theme to be given to individual component theme mixins.
|
|
208
|
-
/// @param {Map} $primary The theme configuration object.
|
|
209
|
-
/// @returns {Map} A complete Angular Material theme map.
|
|
210
|
-
@function define-dark-theme($primary, $accent: null, $warn: define-palette(palette.$red-palette)) {
|
|
211
|
-
// This function creates a container object for the individual component theme mixins. Consumers
|
|
212
|
-
// can construct such an object by calling this function, or by building the object manually.
|
|
213
|
-
// There are two possible ways to invoke this function in order to create such an object:
|
|
214
|
-
//
|
|
215
|
-
// (1) Passing in a map that holds optional configurations for individual parts of the
|
|
216
|
-
// theming system. For `color` configurations, the function only expects the palettes
|
|
217
|
-
// for `primary` and `accent` (and optionally `warn`). The function will expand the
|
|
218
|
-
// shorthand into an actual configuration that can be consumed in `-color` mixins.
|
|
219
|
-
// (2) Legacy pattern: Passing in the palettes as parameters. This is not as flexible
|
|
220
|
-
// as passing in a configuration map because only the `color` system can be configured.
|
|
221
|
-
//
|
|
222
|
-
// If the legacy pattern is used, we generate a container object only with a dark-themed
|
|
223
|
-
// configuration for the `color` theming part.
|
|
224
|
-
@if $accent != null {
|
|
225
|
-
@warn $_legacy-theme-warning;
|
|
226
|
-
@return _internalize-theme(private-create-backwards-compatibility-theme(_mat-validate-theme((
|
|
227
|
-
_is-legacy-theme: true,
|
|
228
|
-
color: _mat-create-dark-color-config($primary, $accent, $warn),
|
|
229
|
-
))));
|
|
230
|
-
}
|
|
231
|
-
// If the map pattern is used (1), we just pass-through the configurations for individual
|
|
232
|
-
// parts of the theming system, but update the `color` configuration if set. As explained
|
|
233
|
-
// above, the color shorthand will be expanded to an actual dark-themed color configuration.
|
|
234
|
-
$result: $primary;
|
|
235
|
-
@if map.get($primary, color) {
|
|
236
|
-
$color-settings: map.get($primary, color);
|
|
237
|
-
$primary: map.get($color-settings, primary);
|
|
238
|
-
$accent: map.get($color-settings, accent);
|
|
239
|
-
$warn: map.get($color-settings, warn);
|
|
240
|
-
$result: map.merge($result, (color: _mat-create-dark-color-config($primary, $accent, $warn)));
|
|
241
|
-
}
|
|
242
|
-
@return _internalize-theme(
|
|
243
|
-
private-create-backwards-compatibility-theme(_mat-validate-theme($result)));
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/// Gets the color configuration from the given theme or configuration.
|
|
247
|
-
/// @param {Map} $theme The theme map returned from `define-light-theme` or `define-dark-theme`.
|
|
248
|
-
/// @param {Map} $default The default value returned if the given `$theme` does not include a
|
|
249
|
-
/// `color` configuration.
|
|
250
|
-
/// @returns {Map} Color configuration for a theme.
|
|
251
|
-
@function get-color-config($theme, $default: null) {
|
|
252
|
-
// If a configuration has been passed, return the config directly.
|
|
253
|
-
@if not private-is-theme-object($theme) {
|
|
254
|
-
@return $theme;
|
|
255
|
-
}
|
|
256
|
-
// If the theme has been constructed through the legacy theming API, we use the theme object
|
|
257
|
-
// as color configuration instead of the dedicated `color` property. We do this because for
|
|
258
|
-
// backwards compatibility, we copied the color configuration from `$theme.color` to `$theme`.
|
|
259
|
-
// Hence developers could customize the colors at top-level and want to respect these changes
|
|
260
|
-
// TODO: Remove when legacy theming API is removed.
|
|
261
|
-
@if private-is-legacy-constructed-theme($theme) {
|
|
262
|
-
@return $theme;
|
|
263
|
-
}
|
|
264
|
-
@if map.has-key($theme, color) {
|
|
265
|
-
@return map.get($theme, color);
|
|
266
|
-
}
|
|
267
|
-
@return $default;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/// Gets the density configuration from the given theme or configuration.
|
|
271
|
-
/// @param {Map} $theme-or-config The theme map returned from `define-light-theme` or
|
|
272
|
-
/// `define-dark-theme`.
|
|
273
|
-
/// @param {Map} $default The default value returned if the given `$theme` does not include a
|
|
274
|
-
/// `density` configuration.
|
|
275
|
-
/// @returns {Map} Density configuration for a theme.
|
|
276
|
-
@function get-density-config($theme-or-config, $default: 0) {
|
|
277
|
-
// If a configuration has been passed, return the config directly.
|
|
278
|
-
@if not private-is-theme-object($theme-or-config) {
|
|
279
|
-
@return $theme-or-config;
|
|
280
|
-
}
|
|
281
|
-
// In case a theme has been passed, extract the configuration if present,
|
|
282
|
-
// or fall back to the default density config.
|
|
283
|
-
@if map.has-key($theme-or-config, density) {
|
|
284
|
-
@return map.get($theme-or-config, density);
|
|
285
|
-
}
|
|
286
|
-
@return $default;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
/// Gets the typography configuration from the given theme or configuration.
|
|
290
|
-
/// For backwards compatibility, typography is not included by default.
|
|
291
|
-
/// @param {Map} $theme-or-config The theme map returned from `define-light-theme` or
|
|
292
|
-
/// `define-dark-theme`.
|
|
293
|
-
/// @param {Map} $default The default value returned if the given `$theme` does not include a
|
|
294
|
-
/// `typography` configuration.
|
|
295
|
-
/// @returns {Map} Typography configuration for a theme.
|
|
296
|
-
@function get-typography-config($theme-or-config, $default: null) {
|
|
297
|
-
// If a configuration has been passed, return the config directly.
|
|
298
|
-
@if not private-is-theme-object($theme-or-config) {
|
|
299
|
-
@return $theme-or-config;
|
|
300
|
-
}
|
|
301
|
-
// In case a theme has been passed, extract the configuration if present,
|
|
302
|
-
// or fall back to the default typography config.
|
|
303
|
-
@if (map.has-key($theme-or-config, typography)) {
|
|
304
|
-
@return map.get($theme-or-config, typography);
|
|
305
|
-
}
|
|
306
|
-
@return $default;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
|
|
310
36
|
//
|
|
311
37
|
// Private APIs
|
|
312
38
|
//
|
|
313
39
|
|
|
314
|
-
$
|
|
40
|
+
$private-internal-name: _mat-theming-internals-do-not-access;
|
|
315
41
|
|
|
316
42
|
// Checks if configurations that have been declared in the given theme have been generated
|
|
317
43
|
// before. If so, warnings will be reported. This should notify developers in case duplicate
|
|
@@ -327,7 +53,7 @@ $_internals: _mat-theming-internals-do-not-access;
|
|
|
327
53
|
// style duplication.
|
|
328
54
|
@mixin private-check-duplicate-theme-styles($theme-or-color-config, $id) {
|
|
329
55
|
// TODO(mmalerba): use get-theme-version for this check when its moved out of experimental.
|
|
330
|
-
@if map.get($theme-or-color-config, $
|
|
56
|
+
@if map.get($theme-or-color-config, $private-internal-name, theme-version) == 1 {
|
|
331
57
|
@include _check-duplicate-theme-styles-v1($theme-or-color-config, $id) {
|
|
332
58
|
// Optionally, consumers of this mixin can wrap contents inside so that nested
|
|
333
59
|
// duplicate style checks do not report another warning. e.g. if developers include
|
|
@@ -367,18 +93,21 @@ $_internals: _mat-theming-internals-do-not-access;
|
|
|
367
93
|
// Checks for duplicate styles in a `theme-version: 1` style theme.
|
|
368
94
|
@mixin _check-duplicate-theme-styles-v1($theme-or-color-config, $id) {
|
|
369
95
|
$color-settings: _strip-empty-settings((
|
|
370
|
-
theme-type: map.get($theme-or-color-config, $
|
|
371
|
-
color-tokens: map.get($theme-or-color-config, $
|
|
96
|
+
theme-type: map.get($theme-or-color-config, $private-internal-name, theme-type),
|
|
97
|
+
color-tokens: map.get($theme-or-color-config, $private-internal-name, color-tokens),
|
|
372
98
|
));
|
|
373
99
|
$typography-settings: _strip-empty-settings((
|
|
374
|
-
typography-tokens:
|
|
100
|
+
typography-tokens:
|
|
101
|
+
map.get($theme-or-color-config, $private-internal-name, typography-tokens),
|
|
375
102
|
));
|
|
376
103
|
$density-settings: _strip-empty-settings((
|
|
377
|
-
density-scale:
|
|
378
|
-
|
|
104
|
+
density-scale:
|
|
105
|
+
map.get($theme-or-color-config, $private-internal-name, density-scale),
|
|
106
|
+
density-tokens:
|
|
107
|
+
map.get($theme-or-color-config, $private-internal-name, density-tokens),
|
|
379
108
|
));
|
|
380
109
|
$base-settings: _strip-empty-settings((
|
|
381
|
-
base-tokens: map.get($theme-or-color-config, $
|
|
110
|
+
base-tokens: map.get($theme-or-color-config, $private-internal-name, base-tokens),
|
|
382
111
|
));
|
|
383
112
|
$previous-color-settings: map.get($_emitted-color, $id) or ();
|
|
384
113
|
$previous-typography-settings: map.get($_emitted-typography, $id) or ();
|
|
@@ -432,10 +161,12 @@ $_internals: _mat-theming-internals-do-not-access;
|
|
|
432
161
|
// Checks for duplicate styles in a `theme-version: 0` style theme.
|
|
433
162
|
@mixin _check-duplicate-theme-styles-v0($theme-or-color-config, $id) {
|
|
434
163
|
$theme: private-legacy-get-theme($theme-or-color-config);
|
|
435
|
-
$color-config: map.get($theme, $
|
|
436
|
-
|
|
437
|
-
$
|
|
438
|
-
|
|
164
|
+
$color-config: map.get($theme, $private-internal-name, m2-config, color) or
|
|
165
|
+
private-get-color-config($theme);
|
|
166
|
+
$density-config: map.get($theme, $private-internal-name, m2-config, density) or
|
|
167
|
+
private-get-density-config($theme);
|
|
168
|
+
$typography-config: map.get($theme, $private-internal-name, m2-config, typography) or
|
|
169
|
+
private-get-typography-config($theme);
|
|
439
170
|
// Lists of previous `color`, `density` and `typography` configurations.
|
|
440
171
|
$previous-color: map.get($_emitted-color, $id) or ();
|
|
441
172
|
$previous-typography: map.get($_emitted-typography, $id) or ();
|
|
@@ -500,6 +231,57 @@ $_internals: _mat-theming-internals-do-not-access;
|
|
|
500
231
|
@return meta.type-of($value) == 'map' and map.get($value, '_is-legacy-theme');
|
|
501
232
|
}
|
|
502
233
|
|
|
234
|
+
// This is the implementation of the `m2-get-color-config` function.
|
|
235
|
+
// It's declared here to avoid a circular reference between this file and `m2/_theming.scss`.
|
|
236
|
+
@function private-get-color-config($theme, $default: null) {
|
|
237
|
+
// If a configuration has been passed, return the config directly.
|
|
238
|
+
@if not private-is-theme-object($theme) {
|
|
239
|
+
@return $theme;
|
|
240
|
+
}
|
|
241
|
+
// If the theme has been constructed through the legacy theming API, we use the theme object
|
|
242
|
+
// as color configuration instead of the dedicated `color` property. We do this because for
|
|
243
|
+
// backwards compatibility, we copied the color configuration from `$theme.color` to `$theme`.
|
|
244
|
+
// Hence developers could customize the colors at top-level and want to respect these changes
|
|
245
|
+
// TODO: Remove when legacy theming API is removed.
|
|
246
|
+
@if private-is-legacy-constructed-theme($theme) {
|
|
247
|
+
@return $theme;
|
|
248
|
+
}
|
|
249
|
+
@if map.has-key($theme, color) {
|
|
250
|
+
@return map.get($theme, color);
|
|
251
|
+
}
|
|
252
|
+
@return $default;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// This is the implementation of the `m2-get-density-config` function.
|
|
256
|
+
// It's declared here to avoid a circular reference between this file and `m2/_theming.scss`.
|
|
257
|
+
@function private-get-density-config($theme-or-config, $default: 0) {
|
|
258
|
+
// If a configuration has been passed, return the config directly.
|
|
259
|
+
@if not private-is-theme-object($theme-or-config) {
|
|
260
|
+
@return $theme-or-config;
|
|
261
|
+
}
|
|
262
|
+
// In case a theme has been passed, extract the configuration if present,
|
|
263
|
+
// or fall back to the default density config.
|
|
264
|
+
@if map.has-key($theme-or-config, density) {
|
|
265
|
+
@return map.get($theme-or-config, density);
|
|
266
|
+
}
|
|
267
|
+
@return $default;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// This is the implementation of the `m2-get-typography-config` function.
|
|
271
|
+
// It's declared here to avoid a circular reference between this file and `m2/_theming.scss`.
|
|
272
|
+
@function private-get-typography-config($theme-or-config, $default: null) {
|
|
273
|
+
// If a configuration has been passed, return the config directly.
|
|
274
|
+
@if not private-is-theme-object($theme-or-config) {
|
|
275
|
+
@return $theme-or-config;
|
|
276
|
+
}
|
|
277
|
+
// In case a theme has been passed, extract the configuration if present,
|
|
278
|
+
// or fall back to the default typography config.
|
|
279
|
+
@if (map.has-key($theme-or-config, typography)) {
|
|
280
|
+
@return map.get($theme-or-config, typography);
|
|
281
|
+
}
|
|
282
|
+
@return $default;
|
|
283
|
+
}
|
|
284
|
+
|
|
503
285
|
// Creates a backwards compatible theme. Previously in Angular Material, theme objects
|
|
504
286
|
// contained the color configuration directly. With the recent refactoring of the theming
|
|
505
287
|
// system to allow for density and typography configurations, this is no longer the case.
|
|
@@ -510,7 +292,7 @@ $_internals: _mat-theming-internals-do-not-access;
|
|
|
510
292
|
//
|
|
511
293
|
// @mixin my-custom-component-theme($theme) {
|
|
512
294
|
// .my-comp {
|
|
513
|
-
// background-color: mat.get-color-from-palette(map.get($theme, primary));
|
|
295
|
+
// background-color: mat.m2-get-color-from-palette(map.get($theme, primary));
|
|
514
296
|
// }
|
|
515
297
|
// }
|
|
516
298
|
//
|
|
@@ -534,11 +316,11 @@ $_internals: _mat-theming-internals-do-not-access;
|
|
|
534
316
|
// and the code can be easily updated to the new API.
|
|
535
317
|
@function private-legacy-get-theme($theme-or-color-config) {
|
|
536
318
|
@if private-is-theme-object($theme-or-color-config) or
|
|
537
|
-
map.get($theme-or-color-config, $
|
|
319
|
+
map.get($theme-or-color-config, $private-internal-name, theme-version) == 1 {
|
|
538
320
|
@return $theme-or-color-config;
|
|
539
321
|
}
|
|
540
322
|
|
|
541
|
-
@warn $
|
|
323
|
+
@warn $private-legacy-theme-warning;
|
|
542
324
|
@return private-create-backwards-compatibility-theme((
|
|
543
325
|
_is-legacy-theme: true,
|
|
544
326
|
color: $theme-or-color-config
|
|
@@ -573,51 +355,3 @@ $_internals: _mat-theming-internals-do-not-access;
|
|
|
573
355
|
}
|
|
574
356
|
@return $density-scale;
|
|
575
357
|
}
|
|
576
|
-
|
|
577
|
-
/// Copies the given theme object and nests it within itself under a secret key and replaces the
|
|
578
|
-
/// original map keys with error values. This allows the inspection API which is aware of the secret
|
|
579
|
-
/// key to access the real values, but attempts to directly access the map will result in errors.
|
|
580
|
-
/// @param {Map} $theme The theme map.
|
|
581
|
-
@function _internalize-theme($theme) {
|
|
582
|
-
@if map.has-key($theme, $_internals) {
|
|
583
|
-
@return $theme;
|
|
584
|
-
}
|
|
585
|
-
$internalized-theme: (
|
|
586
|
-
$_internals: (
|
|
587
|
-
theme-version: 0,
|
|
588
|
-
m2-config: $theme
|
|
589
|
-
)
|
|
590
|
-
);
|
|
591
|
-
@if ($theme-legacy-inspection-api-compatibility) {
|
|
592
|
-
@return map.merge($theme, $internalized-theme);
|
|
593
|
-
}
|
|
594
|
-
$error-theme:
|
|
595
|
-
_replace-values-with-errors($theme, 'Theme may only be accessed via theme inspection API');
|
|
596
|
-
@return map.merge($error-theme, $internalized-theme);
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
/// Replaces concrete CSS values with errors in a theme object.
|
|
600
|
-
/// Errors are represented as a map `(ERROR: <message>)`. Because maps are not valid CSS values,
|
|
601
|
-
/// the Sass will not compile if the user tries to use any of the error theme values in their CSS.
|
|
602
|
-
/// Users will see a message about `(ERROR: <message>)` not being a valid CSS value. Using the
|
|
603
|
-
/// message, that winds up getting shown, we can help explain to users why they're getting the
|
|
604
|
-
/// error.
|
|
605
|
-
/// @param {*} $value The theme value to replace with errors.
|
|
606
|
-
/// @param {String} $message The error message to sow users.
|
|
607
|
-
/// @return {Map} A version of $value where concrete CSS values have been replaced with errors
|
|
608
|
-
@function _replace-values-with-errors($value, $message) {
|
|
609
|
-
$value-type: meta.type-of($value);
|
|
610
|
-
@if $value-type == 'map' {
|
|
611
|
-
@each $k, $v in $value {
|
|
612
|
-
$value: map.set($value, $k, _replace-values-with-errors($v, $message));
|
|
613
|
-
}
|
|
614
|
-
@return $value;
|
|
615
|
-
}
|
|
616
|
-
@else if $value-type == 'list' and list.length($value) > 0 {
|
|
617
|
-
@for $i from 1 through list.length() {
|
|
618
|
-
$value: list.set-nth($value, $i, _replace-values-with-errors(list.nth($value, $i), $message));
|
|
619
|
-
}
|
|
620
|
-
@return $value;
|
|
621
|
-
}
|
|
622
|
-
@return (ERROR: $message);
|
|
623
|
-
}
|