@ng-matero/extensions 18.4.1 → 19.0.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.
Files changed (285) hide show
  1. package/_index.scss +3 -1
  2. package/alert/_alert-theme.scss +19 -8
  3. package/alert/alert.d.ts +1 -2
  4. package/button/button-loading.d.ts +1 -2
  5. package/checkbox-group/checkbox-group.d.ts +12 -4
  6. package/colorpicker/_colorpicker-theme.scss +19 -8
  7. package/colorpicker/colorpicker-input.d.ts +1 -3
  8. package/colorpicker/colorpicker-toggle.d.ts +3 -3
  9. package/colorpicker/colorpicker.d.ts +4 -7
  10. package/column-resize/column-resize-directives/column-resize-flex.d.ts +2 -1
  11. package/column-resize/column-resize-directives/column-resize.d.ts +2 -1
  12. package/column-resize/column-resize-notifier.d.ts +0 -1
  13. package/column-resize/column-resize.d.ts +1 -1
  14. package/column-resize/event-dispatcher.d.ts +0 -9
  15. package/column-resize/overlay-handle.d.ts +1 -1
  16. package/column-resize/resizable.d.ts +1 -1
  17. package/column-resize/resize-strategy.d.ts +4 -4
  18. package/core/datetime/datetime-adapter.d.ts +1 -2
  19. package/core/datetime/native-datetime-adapter.d.ts +3 -3
  20. package/core/style/_button-common.scss +18 -0
  21. package/core/theming/_config-validation.scss +4 -4
  22. package/core/theming/_definition.scss +12 -2
  23. package/core/theming/prebuilt/azure-blue.scss +10 -22
  24. package/core/theming/prebuilt/cyan-orange.scss +10 -22
  25. package/core/theming/prebuilt/magenta-violet.scss +10 -22
  26. package/core/theming/prebuilt/rose-red.scss +10 -22
  27. package/core/tokens/_m3-system.scss +273 -0
  28. package/core/tokens/_m3-tokens.scss +8 -151
  29. package/core/tokens/_token-utils.scss +102 -43
  30. package/core/tokens/m2/_index.scss +2 -0
  31. package/core/tokens/m3/definitions/_index.scss +1 -0
  32. package/core/tokens/m3/definitions/_md-comp-plain-tooltip.scss +51 -0
  33. package/core/tokens/m3/index.scss +2 -0
  34. package/core/tokens/m3/mdc/_plain-tooltip.scss +15 -0
  35. package/core/tokens/m3/mtx/_alert.scss +14 -14
  36. package/core/tokens/m3/mtx/_colorpicker.scss +2 -2
  37. package/core/tokens/m3/mtx/_datetimepicker.scss +2 -2
  38. package/core/tokens/m3/mtx/_drawer.scss +2 -2
  39. package/core/tokens/m3/mtx/_grid.scss +2 -2
  40. package/core/tokens/m3/mtx/_loader.scss +2 -2
  41. package/core/tokens/m3/mtx/_popover.scss +2 -2
  42. package/core/tokens/m3/mtx/_progress.scss +2 -2
  43. package/core/tokens/m3/mtx/_select.scss +2 -2
  44. package/core/tokens/m3/mtx/_split.scss +2 -2
  45. package/datetimepicker/_datetimepicker-theme.scss +23 -10
  46. package/datetimepicker/calendar-body.d.ts +26 -4
  47. package/datetimepicker/calendar-body.scss +58 -9
  48. package/datetimepicker/calendar.d.ts +31 -31
  49. package/datetimepicker/clock.d.ts +11 -5
  50. package/datetimepicker/datetimepicker-actions.d.ts +9 -5
  51. package/datetimepicker/datetimepicker-content.scss +15 -0
  52. package/datetimepicker/datetimepicker-input.d.ts +4 -5
  53. package/datetimepicker/datetimepicker-module.d.ts +2 -2
  54. package/datetimepicker/datetimepicker-toggle.d.ts +4 -3
  55. package/datetimepicker/datetimepicker.d.ts +12 -8
  56. package/datetimepicker/month-view.d.ts +22 -7
  57. package/datetimepicker/multi-year-view.d.ts +20 -20
  58. package/datetimepicker/public-api.d.ts +2 -2
  59. package/datetimepicker/{time.d.ts → time-view.d.ts} +21 -9
  60. package/datetimepicker/{time.scss → time-view.scss} +1 -1
  61. package/datetimepicker/year-view.d.ts +21 -11
  62. package/dialog/dialog-container.d.ts +1 -2
  63. package/dialog/dialog.d.ts +0 -1
  64. package/drawer/_drawer-theme.scss +19 -8
  65. package/drawer/drawer-container.d.ts +2 -5
  66. package/drawer/drawer.d.ts +3 -5
  67. package/fesm2022/mtxAlert.mjs +15 -15
  68. package/fesm2022/mtxAlert.mjs.map +1 -1
  69. package/fesm2022/mtxButton.mjs +13 -14
  70. package/fesm2022/mtxButton.mjs.map +1 -1
  71. package/fesm2022/mtxCheckboxGroup.mjs +51 -31
  72. package/fesm2022/mtxCheckboxGroup.mjs.map +1 -1
  73. package/fesm2022/mtxColorpicker.mjs +91 -109
  74. package/fesm2022/mtxColorpicker.mjs.map +1 -1
  75. package/fesm2022/mtxColumnResize.mjs +79 -96
  76. package/fesm2022/mtxColumnResize.mjs.map +1 -1
  77. package/fesm2022/mtxCore.mjs +31 -36
  78. package/fesm2022/mtxCore.mjs.map +1 -1
  79. package/fesm2022/mtxDatetimepicker.mjs +1179 -1092
  80. package/fesm2022/mtxDatetimepicker.mjs.map +1 -1
  81. package/fesm2022/mtxDialog.mjs +30 -41
  82. package/fesm2022/mtxDialog.mjs.map +1 -1
  83. package/fesm2022/mtxDrawer.mjs +36 -52
  84. package/fesm2022/mtxDrawer.mjs.map +1 -1
  85. package/fesm2022/mtxGrid.mjs +168 -204
  86. package/fesm2022/mtxGrid.mjs.map +1 -1
  87. package/fesm2022/mtxLoader.mjs +12 -12
  88. package/fesm2022/mtxLoader.mjs.map +1 -1
  89. package/fesm2022/mtxPhotoviewer.mjs +11 -12
  90. package/fesm2022/mtxPhotoviewer.mjs.map +1 -1
  91. package/fesm2022/mtxPopover.mjs +106 -119
  92. package/fesm2022/mtxPopover.mjs.map +1 -1
  93. package/fesm2022/mtxProgress.mjs +8 -8
  94. package/fesm2022/mtxProgress.mjs.map +1 -1
  95. package/fesm2022/mtxSelect.mjs +157 -169
  96. package/fesm2022/mtxSelect.mjs.map +1 -1
  97. package/fesm2022/mtxSplit.mjs +39 -40
  98. package/fesm2022/mtxSplit.mjs.map +1 -1
  99. package/fesm2022/mtxTooltip.mjs +105 -91
  100. package/fesm2022/mtxTooltip.mjs.map +1 -1
  101. package/grid/_grid-theme.scss +23 -10
  102. package/grid/cell.d.ts +1 -4
  103. package/grid/column-resize/column-resize-directives/column-resize-flex.d.ts +0 -1
  104. package/grid/column-resize/column-resize-directives/column-resize.d.ts +0 -1
  105. package/grid/column-resize/overlay-handle.d.ts +1 -2
  106. package/grid/column-resize/resizable-directives/resizable.d.ts +2 -3
  107. package/grid/column-resize/resize-strategy.d.ts +2 -4
  108. package/grid/grid-pipes.d.ts +0 -2
  109. package/grid/grid.d.ts +5 -5
  110. package/loader/_loader-theme.scss +19 -8
  111. package/loader/loader.d.ts +0 -2
  112. package/package.json +11 -47
  113. package/photoviewer/photoviewer.d.ts +1 -2
  114. package/popover/_popover-theme.scss +19 -8
  115. package/popover/popover-content.d.ts +1 -1
  116. package/popover/popover-target.d.ts +1 -2
  117. package/popover/popover-trigger.d.ts +5 -6
  118. package/popover/popover.d.ts +1 -2
  119. package/prebuilt-themes/azure-blue.css +1 -1
  120. package/prebuilt-themes/cyan-orange.css +1 -1
  121. package/prebuilt-themes/deeppurple-amber.css +1 -1
  122. package/prebuilt-themes/indigo-pink.css +1 -1
  123. package/prebuilt-themes/magenta-violet.css +1 -1
  124. package/prebuilt-themes/pink-bluegrey.css +1 -1
  125. package/prebuilt-themes/purple-green.css +1 -1
  126. package/prebuilt-themes/rose-red.css +1 -1
  127. package/progress/_progress-theme.scss +23 -10
  128. package/select/_select-theme.scss +23 -10
  129. package/select/option.d.ts +0 -1
  130. package/select/select-intl.d.ts +2 -4
  131. package/select/select.d.ts +8 -7
  132. package/select/select.scss +3 -3
  133. package/select/templates.d.ts +0 -12
  134. package/split/_split-theme.scss +19 -8
  135. package/split/split-pane.d.ts +3 -4
  136. package/split/split.d.ts +4 -4
  137. package/split/split.scss +1 -1
  138. package/tooltip/_tooltip-theme.scss +11 -4
  139. package/tooltip/tooltip.d.ts +17 -9
  140. package/tooltip/tooltip.scss +8 -3
  141. package/esm2022/alert/alert-module.mjs +0 -17
  142. package/esm2022/alert/alert.mjs +0 -46
  143. package/esm2022/alert/mtxAlert.mjs +0 -5
  144. package/esm2022/alert/public-api.mjs +0 -3
  145. package/esm2022/button/button-loading.mjs +0 -66
  146. package/esm2022/button/button-module.mjs +0 -19
  147. package/esm2022/button/mtxButton.mjs +0 -5
  148. package/esm2022/button/public-api.mjs +0 -3
  149. package/esm2022/checkbox-group/checkbox-group-module.mjs +0 -20
  150. package/esm2022/checkbox-group/checkbox-group.mjs +0 -222
  151. package/esm2022/checkbox-group/interfaces.mjs +0 -2
  152. package/esm2022/checkbox-group/mtxCheckboxGroup.mjs +0 -5
  153. package/esm2022/checkbox-group/public-api.mjs +0 -4
  154. package/esm2022/colorpicker/colorpicker-animations.mjs +0 -16
  155. package/esm2022/colorpicker/colorpicker-input.mjs +0 -228
  156. package/esm2022/colorpicker/colorpicker-module.mjs +0 -64
  157. package/esm2022/colorpicker/colorpicker-toggle.mjs +0 -102
  158. package/esm2022/colorpicker/colorpicker.mjs +0 -363
  159. package/esm2022/colorpicker/mtxColorpicker.mjs +0 -5
  160. package/esm2022/colorpicker/public-api.mjs +0 -6
  161. package/esm2022/column-resize/column-resize-directives/column-resize-flex.mjs +0 -40
  162. package/esm2022/column-resize/column-resize-directives/column-resize.mjs +0 -40
  163. package/esm2022/column-resize/column-resize-directives/constants.mjs +0 -21
  164. package/esm2022/column-resize/column-resize-module.mjs +0 -28
  165. package/esm2022/column-resize/column-resize-notifier.mjs +0 -52
  166. package/esm2022/column-resize/column-resize.mjs +0 -82
  167. package/esm2022/column-resize/column-size-store.mjs +0 -20
  168. package/esm2022/column-resize/event-dispatcher.mjs +0 -70
  169. package/esm2022/column-resize/mtxColumnResize.mjs +0 -5
  170. package/esm2022/column-resize/overlay-handle.mjs +0 -146
  171. package/esm2022/column-resize/polyfill.mjs +0 -19
  172. package/esm2022/column-resize/public-api.mjs +0 -13
  173. package/esm2022/column-resize/resizable.mjs +0 -199
  174. package/esm2022/column-resize/resize-ref.mjs +0 -17
  175. package/esm2022/column-resize/resize-strategy.mjs +0 -238
  176. package/esm2022/column-resize/selectors.mjs +0 -13
  177. package/esm2022/core/datetime/datetime-adapter.mjs +0 -132
  178. package/esm2022/core/datetime/datetime-formats.mjs +0 -3
  179. package/esm2022/core/datetime/datetime.module.mjs +0 -38
  180. package/esm2022/core/datetime/index.mjs +0 -6
  181. package/esm2022/core/datetime/native-datetime-adapter.mjs +0 -138
  182. package/esm2022/core/datetime/native-datetime-formats.mjs +0 -20
  183. package/esm2022/core/mtxCore.mjs +0 -5
  184. package/esm2022/core/pipes/index.mjs +0 -4
  185. package/esm2022/core/pipes/is-template-ref.pipe.mjs +0 -14
  186. package/esm2022/core/pipes/pipes.module.mjs +0 -18
  187. package/esm2022/core/pipes/to-observable.pipe.mjs +0 -15
  188. package/esm2022/core/public-api.mjs +0 -3
  189. package/esm2022/datetimepicker/calendar-body.mjs +0 -77
  190. package/esm2022/datetimepicker/calendar.mjs +0 -661
  191. package/esm2022/datetimepicker/clock.mjs +0 -362
  192. package/esm2022/datetimepicker/datetimepicker-actions.mjs +0 -88
  193. package/esm2022/datetimepicker/datetimepicker-animations.mjs +0 -44
  194. package/esm2022/datetimepicker/datetimepicker-errors.mjs +0 -8
  195. package/esm2022/datetimepicker/datetimepicker-filtertype.mjs +0 -7
  196. package/esm2022/datetimepicker/datetimepicker-input.mjs +0 -349
  197. package/esm2022/datetimepicker/datetimepicker-intl.mjs +0 -63
  198. package/esm2022/datetimepicker/datetimepicker-module.mjs +0 -116
  199. package/esm2022/datetimepicker/datetimepicker-toggle.mjs +0 -105
  200. package/esm2022/datetimepicker/datetimepicker-types.mjs +0 -2
  201. package/esm2022/datetimepicker/datetimepicker.mjs +0 -580
  202. package/esm2022/datetimepicker/month-view.mjs +0 -148
  203. package/esm2022/datetimepicker/mtxDatetimepicker.mjs +0 -5
  204. package/esm2022/datetimepicker/multi-year-view.mjs +0 -215
  205. package/esm2022/datetimepicker/public-api.mjs +0 -17
  206. package/esm2022/datetimepicker/time.mjs +0 -470
  207. package/esm2022/datetimepicker/year-view.mjs +0 -139
  208. package/esm2022/dialog/dialog-config.mjs +0 -2
  209. package/esm2022/dialog/dialog-container.mjs +0 -43
  210. package/esm2022/dialog/dialog-module.mjs +0 -40
  211. package/esm2022/dialog/dialog.mjs +0 -75
  212. package/esm2022/dialog/mtxDialog.mjs +0 -5
  213. package/esm2022/dialog/public-api.mjs +0 -5
  214. package/esm2022/drawer/drawer-animations.mjs +0 -18
  215. package/esm2022/drawer/drawer-config.mjs +0 -35
  216. package/esm2022/drawer/drawer-container.mjs +0 -88
  217. package/esm2022/drawer/drawer-module.mjs +0 -21
  218. package/esm2022/drawer/drawer-ref.mjs +0 -99
  219. package/esm2022/drawer/drawer.mjs +0 -144
  220. package/esm2022/drawer/mtxDrawer.mjs +0 -5
  221. package/esm2022/drawer/public-api.mjs +0 -7
  222. package/esm2022/grid/cell.mjs +0 -132
  223. package/esm2022/grid/column-menu.mjs +0 -133
  224. package/esm2022/grid/column-resize/column-resize-directives/column-resize-flex.mjs +0 -38
  225. package/esm2022/grid/column-resize/column-resize-directives/column-resize.mjs +0 -38
  226. package/esm2022/grid/column-resize/column-resize-directives/common.mjs +0 -27
  227. package/esm2022/grid/column-resize/column-resize-module.mjs +0 -42
  228. package/esm2022/grid/column-resize/index.mjs +0 -8
  229. package/esm2022/grid/column-resize/overlay-handle.mjs +0 -66
  230. package/esm2022/grid/column-resize/resizable-directives/common.mjs +0 -29
  231. package/esm2022/grid/column-resize/resizable-directives/resizable.mjs +0 -64
  232. package/esm2022/grid/column-resize/resize-strategy.mjs +0 -47
  233. package/esm2022/grid/expansion-toggle.mjs +0 -65
  234. package/esm2022/grid/grid-module.mjs +0 -151
  235. package/esm2022/grid/grid-pipes.mjs +0 -129
  236. package/esm2022/grid/grid-utils.mjs +0 -56
  237. package/esm2022/grid/grid.mjs +0 -644
  238. package/esm2022/grid/interfaces.mjs +0 -2
  239. package/esm2022/grid/mtxGrid.mjs +0 -5
  240. package/esm2022/grid/public-api.mjs +0 -18
  241. package/esm2022/grid/selectable-cell.mjs +0 -53
  242. package/esm2022/loader/loader-module.mjs +0 -19
  243. package/esm2022/loader/loader.mjs +0 -57
  244. package/esm2022/loader/mtxLoader.mjs +0 -5
  245. package/esm2022/loader/public-api.mjs +0 -3
  246. package/esm2022/ng-matero-extensions.mjs +0 -5
  247. package/esm2022/photoviewer/mtxPhotoviewer.mjs +0 -5
  248. package/esm2022/photoviewer/photoviewer-module.mjs +0 -16
  249. package/esm2022/photoviewer/photoviewer.mjs +0 -64
  250. package/esm2022/photoviewer/public-api.mjs +0 -3
  251. package/esm2022/popover/mtxPopover.mjs +0 -5
  252. package/esm2022/popover/popover-animations.mjs +0 -25
  253. package/esm2022/popover/popover-content.mjs +0 -91
  254. package/esm2022/popover/popover-errors.mjs +0 -27
  255. package/esm2022/popover/popover-interfaces.mjs +0 -2
  256. package/esm2022/popover/popover-module.mjs +0 -39
  257. package/esm2022/popover/popover-target.mjs +0 -18
  258. package/esm2022/popover/popover-trigger.mjs +0 -480
  259. package/esm2022/popover/popover-types.mjs +0 -2
  260. package/esm2022/popover/popover.mjs +0 -325
  261. package/esm2022/popover/public-api.mjs +0 -9
  262. package/esm2022/progress/mtxProgress.mjs +0 -5
  263. package/esm2022/progress/progress-module.mjs +0 -17
  264. package/esm2022/progress/progress.mjs +0 -43
  265. package/esm2022/progress/public-api.mjs +0 -3
  266. package/esm2022/public-api.mjs +0 -5
  267. package/esm2022/select/mtxSelect.mjs +0 -5
  268. package/esm2022/select/option.mjs +0 -52
  269. package/esm2022/select/public-api.mjs +0 -6
  270. package/esm2022/select/select-intl.mjs +0 -32
  271. package/esm2022/select/select-module.mjs +0 -89
  272. package/esm2022/select/select.mjs +0 -611
  273. package/esm2022/select/templates.mjs +0 -135
  274. package/esm2022/split/interfaces.mjs +0 -2
  275. package/esm2022/split/mtxSplit.mjs +0 -5
  276. package/esm2022/split/public-api.mjs +0 -6
  277. package/esm2022/split/split-module.mjs +0 -18
  278. package/esm2022/split/split-pane.mjs +0 -161
  279. package/esm2022/split/split.mjs +0 -634
  280. package/esm2022/split/utils.mjs +0 -219
  281. package/esm2022/tooltip/mtxTooltip.mjs +0 -5
  282. package/esm2022/tooltip/public-api.mjs +0 -4
  283. package/esm2022/tooltip/tooltip-animations.mjs +0 -17
  284. package/esm2022/tooltip/tooltip-module.mjs +0 -41
  285. package/esm2022/tooltip/tooltip.mjs +0 -915
@@ -1,26 +1,14 @@
1
1
  @use '@angular/material' as mat;
2
- @use '../definition' as mtx;
3
- @use '../color-api-backwards-compatibility';
4
- @use '../all-theme';
5
-
6
- $config: (
7
- color: (
8
- theme-type: light,
9
- primary: mat.$rose-palette,
10
- tertiary: mat.$red-palette,
11
- ),
12
- density: (
13
- scale: 0,
14
- )
15
- );
16
-
17
- $theme: mat.private-deep-merge-all(
18
- mat.define-theme($config),
19
- mtx.define-theme($config),
20
- );
2
+ @use '../../../core/tokens/m3-system';
21
3
 
22
4
  html {
23
- @include all-theme.all-component-themes($theme);
5
+ @include m3-system.theme((
6
+ color: (
7
+ theme-type: light,
8
+ primary: mat.$rose-palette,
9
+ tertiary: mat.$red-palette,
10
+ ),
11
+ typography: Roboto,
12
+ density: 0,
13
+ ));
24
14
  }
25
-
26
- @include color-api-backwards-compatibility.color-variants-backwards-compatibility($theme);
@@ -0,0 +1,273 @@
1
+ @use 'sass:map';
2
+ @use 'sass:meta';
3
+ @use 'sass:list';
4
+ @use '@angular/material' as mat;
5
+ @use '../style/elevation';
6
+ @use '../theming/config-validation';
7
+ @use '../theming/definition';
8
+ @use './m3/definitions';
9
+ @use './m3-tokens';
10
+
11
+ /// Emits necessary CSS variables for Material's system level values for the values defined in the
12
+ /// config map. The config map can have values color, typography, and/or density.
13
+ ///
14
+ /// If the config map's color value is an Angular Material color palette, it will be used as the
15
+ /// primary and tertiary colors with a `color-scheme` theme type. Otherwise if the color value is a
16
+ /// map, it must have a `primary` value containing an Angular Material color palette, and
17
+ /// optionally a different `tertiary` palette (defaults to primary palette) and `theme-type` that
18
+ /// is either `light`, `dark`, or 'color-scheme` (defaults to `color-scheme`). Color variable
19
+ /// definitions will not be emitted if there are no color values in the config.
20
+ ///
21
+ /// If the config map's typography value is a font family string, it will be used as the
22
+ /// plain and brand font family with default bold, medium, and regular weights of 700, 500, and 400,
23
+ /// respectfully. Otherwise if the typography value is a map, it must have a `plain-family` font
24
+ /// family value, and optionally a different `brand-family` font family (defaults to the plain
25
+ /// value) and weights for `bold-weight` (default: 700), `bold-weight` (default: 500), and
26
+ /// `bold-weight` (default: 400). Typography variable definitions will not be emitted if there are
27
+ /// no typography values in the config.
28
+ ///
29
+ /// If the config map's density value is a number, it will be used as the density scale. Otherwise
30
+ /// if the density value is a map, it must have a `scale` value. Density variable definitions will
31
+ /// not be emitted if there are no density values in the config.
32
+ ///
33
+ /// The application variables emitted use the namespace prefix "--mat-sys".
34
+ /// e.g. --mat-sys-surface: #E5E5E5
35
+ ///
36
+ /// @param {Map} $config The color configuration with optional keys color, typography, or density.
37
+ @mixin theme($config, $overrides: ()) {
38
+ $color: map.get($config, color);
39
+ $color-config: null;
40
+ @if ($color) {
41
+ // validate-palette returns null if it is a valid M3 palette
42
+ $is-palette: config-validation.validate-palette($color) == null;
43
+
44
+ // Default to "color-scheme" theme type if the config's color does not provide one.
45
+ @if (not $is-palette and not map.has-key($color, theme-type)) {
46
+ $color: map.set($color, theme-type, color-scheme);
47
+ }
48
+
49
+ $color-config: if($is-palette,
50
+ definition.define-colors((primary: $color, theme-type: color-scheme)),
51
+ definition.define-colors($color));
52
+ @include system-level-colors($color-config, $overrides, definition.$system-fallback-prefix);
53
+ @include system-level-elevation($color-config, $overrides, definition.$system-fallback-prefix);
54
+ }
55
+
56
+ $typography: map.get($config, typography);
57
+ $typography-config: null;
58
+ @if ($typography) {
59
+ $typography-config: if(meta.type-of($typography) == 'map',
60
+ definition.define-typography($typography),
61
+ definition.define-typography((plain-family: $typography)));
62
+ @include system-level-typography(
63
+ $typography-config, $overrides, definition.$system-fallback-prefix);
64
+ }
65
+
66
+ $density: map.get($config, density);
67
+ $density-config: null;
68
+ @if ($density) {
69
+ $density-config: if(meta.type-of($density) == 'map',
70
+ definition.define-density($density),
71
+ definition.define-density((scale: $density)));
72
+ $scale: map.get($density-config, _mat-theming-internals-do-not-access, density-scale);
73
+ @if ($scale != 0) {
74
+ $all-tokens: m3-tokens.generate-density-tokens($scale);
75
+ @each $component-tokens in $all-tokens {
76
+ $namespace: list.nth($component-tokens, 1);
77
+ @each $tokens in list.nth($component-tokens, 2) {
78
+ --#{list.nth($namespace, 1)}-#{list.nth($namespace, 2)}-#{
79
+ list.nth($tokens, 1)}: #{list.nth($tokens, 2)};
80
+ }
81
+ }
82
+ }
83
+ }
84
+
85
+ @include system-level-shape($overrides: $overrides, $prefix: definition.$system-fallback-prefix);
86
+ @include system-level-state($overrides: $overrides, $prefix: definition.$system-fallback-prefix);
87
+ }
88
+
89
+ /// Emits the system-level CSS variables for each of the provided override values. E.g. to
90
+ /// change the primary color to red, use `mat.theme-overrides((primary: red));`
91
+ @mixin theme-overrides($overrides, $prefix: definition.$system-fallback-prefix) {
92
+ $sys-names: map-merge-all(
93
+ definitions.md-sys-color-values-light(),
94
+ definitions.md-sys-typescale-values(),
95
+ definitions.md-sys-elevation-values(),
96
+ definitions.md-sys-shape-values(),
97
+ definitions.md-sys-state-values());
98
+
99
+ & {
100
+ @each $name, $value in $overrides {
101
+ @if (map.has-key($sys-names, $name)) {
102
+ --#{$prefix}-#{$name}: #{map.get($overrides, $name)};
103
+ }
104
+ }
105
+ }
106
+ }
107
+
108
+ @mixin system-level-colors($theme, $overrides: (), $prefix: null) {
109
+ $palettes: map.get($theme, _mat-theming-internals-do-not-access, palettes);
110
+ $base-palettes: (
111
+ neutral: map.get($palettes, neutral),
112
+ neutral-variant: map.get($palettes, neutral-variant),
113
+ secondary: map.get($palettes, secondary),
114
+ error: map.get($palettes, error),
115
+ );
116
+
117
+ $type: map.get($theme, _mat-theming-internals-do-not-access, theme-type);
118
+ $primary: map.merge(map.get($palettes, primary), $base-palettes);
119
+ $tertiary: map.merge(map.get($palettes, tertiary), $base-palettes);
120
+ $error: map.get($palettes, error);
121
+
122
+ @if (not $prefix) {
123
+ $prefix: map.get($theme, _mat-theming-internals-do-not-access,
124
+ color-system-variables-prefix) or definition.$system-level-prefix;
125
+ }
126
+
127
+ $ref: (
128
+ md-ref-palette: m3-tokens.generate-ref-palette-tokens($primary, $tertiary, $error)
129
+ );
130
+
131
+ $sys-colors: _generate-sys-colors($ref, $type);
132
+
133
+ // Manually insert a subset of palette values that are used directly by components
134
+ // instead of system variables.
135
+ $sys-colors: map.set($sys-colors,
136
+ 'neutral-variant20', map.get($ref, md-ref-palette, neutral-variant20));
137
+ $sys-colors: map.set($sys-colors,
138
+ 'neutral10', map.get($ref, md-ref-palette, neutral10));
139
+
140
+ & {
141
+ @each $name, $value in $sys-colors {
142
+ --#{$prefix}-#{$name}: #{map.get($overrides, $name) or $value};
143
+ }
144
+ }
145
+ }
146
+
147
+ @function _generate-sys-colors($ref, $type) {
148
+ $light-sys-colors: definitions.md-sys-color-values-light($ref);
149
+ @if ($type == light) {
150
+ @return $light-sys-colors;
151
+ }
152
+
153
+ $dark-sys-colors: definitions.md-sys-color-values-dark($ref);
154
+ @if ($type == dark) {
155
+ @return $dark-sys-colors;
156
+ }
157
+
158
+ @if ($type == color-scheme) {
159
+ $light-dark-sys-colors: ();
160
+ @each $name, $light-value in $light-sys-colors {
161
+ $dark-value: map.get($dark-sys-colors, $name);
162
+ $light-dark-sys-colors:
163
+ map.set($light-dark-sys-colors, $name, light-dark($light-value, $dark-value));
164
+ }
165
+ @return $light-dark-sys-colors;
166
+ }
167
+
168
+ @error 'Unknown theme-type provided: #{$type}';
169
+ }
170
+
171
+ @mixin system-level-typography($theme, $overrides: (), $prefix: null) {
172
+ $font-definition: map.get($theme, _mat-theming-internals-do-not-access, font-definition);
173
+ $brand: map.get($font-definition, brand);
174
+ $plain: map.get($font-definition, plain);
175
+ $bold: map.get($font-definition, bold);
176
+ $medium: map.get($font-definition, medium);
177
+ $regular: map.get($font-definition, regular);
178
+ $ref: (md-ref-typeface:
179
+ m3-tokens.generate-ref-typeface-tokens($brand, $plain, $bold, $medium, $regular)
180
+ );
181
+
182
+ @if (not $prefix) {
183
+ $prefix: map.get($theme, _mat-theming-internals-do-not-access,
184
+ typography-system-variables-prefix) or definition.$system-level-prefix;
185
+ }
186
+
187
+ & {
188
+ @each $name, $value in definitions.md-sys-typescale-values($ref) {
189
+ --#{$prefix}-#{$name}: #{map.get($overrides, $name) or $value};
190
+ }
191
+ }
192
+ }
193
+
194
+ @mixin system-level-elevation($theme, $overrides: (), $prefix: definition.$system-level-prefix) {
195
+ $shadow-color: map.get(
196
+ $theme, _mat-theming-internals-do-not-access, color-tokens, (mdc, theme), shadow);
197
+
198
+ @each $name, $value in definitions.md-sys-elevation-values() {
199
+ $level: map.get($overrides, $name) or $value;
200
+ $value: elevation.get-box-shadow($level, $shadow-color);
201
+
202
+ & {
203
+ --#{$prefix}-#{$name}: #{$value};
204
+ }
205
+ }
206
+ }
207
+
208
+ @mixin system-level-shape($theme: (), $overrides: (), $prefix: definition.$system-level-prefix) {
209
+ & {
210
+ @each $name, $value in definitions.md-sys-shape-values() {
211
+ --#{$prefix}-#{$name}: #{map.get($overrides, $name) or $value};
212
+ }
213
+ }
214
+ }
215
+
216
+ @mixin system-level-state($theme: (), $overrides: (), $prefix: definition.$system-level-prefix) {
217
+ & {
218
+ @each $name, $value in definitions.md-sys-state-values() {
219
+ --#{$prefix}-#{$name}: #{map.get($overrides, $name) or $value};
220
+ }
221
+ }
222
+ }
223
+
224
+ // Return a new map where the values are the same as the provided map's
225
+ // keys, prefixed with "--mat-sys-". For example:
226
+ // (key1: '', key2: '') --> (key1: --mat-sys-key1, key2: --mat-sys-key2)
227
+ @function _create-system-app-vars-map($map) {
228
+ $new-map: ();
229
+ @each $key, $value in $map {
230
+ $new-map: map.set($new-map, $key, --#{definition.$system-fallback-prefix}-#{$key});
231
+ }
232
+ @return $new-map;
233
+ }
234
+
235
+ // Create a components tokens map where values are based on
236
+ // system fallback variables referencing Material's system keys.
237
+ // Includes density token fallbacks where density is 0.
238
+ @function create-system-fallbacks() {
239
+ $app-vars: (
240
+ 'md-sys-color':
241
+ _create-system-app-vars-map(definitions.md-sys-color-values-light()),
242
+ 'md-sys-typescale':
243
+ _create-system-app-vars-map(definitions.md-sys-typescale-values()),
244
+ 'md-sys-elevation':
245
+ _create-system-app-vars-map(definitions.md-sys-elevation-values()),
246
+ 'md-sys-state':
247
+ _create-system-app-vars-map(definitions.md-sys-state-values()),
248
+ 'md-sys-shape':
249
+ _create-system-app-vars-map(definitions.md-sys-shape-values()),
250
+ // Add a subset of palette-specific colors used by components instead of system values
251
+ 'md-ref-palette':
252
+ _create-system-app-vars-map(
253
+ (
254
+ neutral10: '', // Form field native select option text color
255
+ neutral-variant20: '', // Sidenav scrim (container background shadow when opened),
256
+ )
257
+ ),
258
+ );
259
+
260
+ @return mat.private-deep-merge-all(
261
+ m3-tokens.generate-tokens($app-vars, true, true),
262
+ m3-tokens.generate-density-tokens(0)
263
+ );
264
+ }
265
+
266
+ /// Creates a single merged map from the provided variable-length map arguments
267
+ @function map-merge-all($maps...) {
268
+ $result: ();
269
+ @each $map in $maps {
270
+ $result: map.merge($result, $map);
271
+ }
272
+ @return $result;
273
+ }
@@ -3,17 +3,9 @@
3
3
  @use './m3';
4
4
  @use './m3/definitions' as m3-token-definitions;
5
5
  @use '../tokens/m2' as m2-tokens;
6
- @use '../style/elevation';
7
6
  @use './density';
8
7
  @use './format-tokens';
9
8
 
10
- // Default system level prefix to use when directly calling the `system-level-*` mixins
11
- $_system-level-prefix: sys;
12
-
13
- // Prefix used for component token fallback variables, e.g.
14
- // `color: var(--mdc-text-button-label-text-color, var(--mat-app-primary));`
15
- $_system-fallback-prefix: mat-app;
16
-
17
9
  /// Generates tokens for the given palette with the given prefix.
18
10
  /// @param {Map} $palette The palette to generate tokens for
19
11
  /// @param {String} $prefix The key prefix used to name the tokens
@@ -34,7 +26,7 @@ $_system-fallback-prefix: mat-app;
34
26
  /// @param {Map} $tertiary The tertiary palette
35
27
  /// @param {Map} $error The error palette
36
28
  /// @return {Map} A set of `md-ref-palette` tokens
37
- @function _generate-ref-palette-tokens($primary, $tertiary, $error) {
29
+ @function generate-ref-palette-tokens($primary, $tertiary, $error) {
38
30
  @return mat.private-merge-all(
39
31
  (black: #000, white: #fff),
40
32
  _generate-palette-tokens($primary, primary),
@@ -54,7 +46,7 @@ $_system-fallback-prefix: mat-app;
54
46
  /// @param {String} $medium The font-weight to use for medium text
55
47
  /// @param {String} $regular The font-weight to use for regular text
56
48
  /// @return {Map} A set of `md-ref-typeface` tokens
57
- @function _generate-ref-typeface-tokens($brand, $plain, $bold, $medium, $regular) {
49
+ @function generate-ref-typeface-tokens($brand, $plain, $bold, $medium, $regular) {
58
50
  @return (
59
51
  brand: $brand,
60
52
  plain: $plain,
@@ -95,7 +87,7 @@ $_cached-token-slots: null;
95
87
  /// @param {Boolean} $include-non-systemized Whether to include non-systemized tokens
96
88
  /// @param {Boolean} $include-density Whether to include density tokens
97
89
  /// @return {Map} A map of namespaced tokens
98
- @function _generate-tokens($systems, $include-non-systemized: false, $include-density: false) {
90
+ @function generate-tokens($systems, $include-non-systemized: false, $include-density: false) {
99
91
  $systems: map.merge((
100
92
  md-sys-color: (),
101
93
  md-sys-elevation: (),
@@ -134,105 +126,6 @@ $_cached-token-slots: null;
134
126
  @return $result;
135
127
  }
136
128
 
137
- // Return a new map where the values are the same as the provided map's
138
- // keys, prefixed with "--mat-app-". For example:
139
- // (key1: '', key2: '') --> (key1: --mat-app-key1, key2: --mat-app-key2)
140
- @function _create-system-app-vars-map($map) {
141
- $new-map: ();
142
- @each $key, $value in $map {
143
- $new-map: map.set($new-map, $key, --#{$_system-fallback-prefix}-#{$key});
144
- }
145
- @return $new-map;
146
- }
147
-
148
- // Create a components tokens map where values are based on
149
- // system fallback variables referencing Material's system keys.
150
- // Includes density token fallbacks where density is 0.
151
- @function create-system-fallbacks() {
152
- $app-vars: (
153
- 'md-sys-color':
154
- _create-system-app-vars-map(m3-token-definitions.md-sys-color-values-light()),
155
- 'md-sys-typescale':
156
- _create-system-app-vars-map(m3-token-definitions.md-sys-typescale-values()),
157
- 'md-sys-elevation':
158
- _create-system-app-vars-map(m3-token-definitions.md-sys-elevation-values()),
159
- 'md-sys-state':
160
- _create-system-app-vars-map(m3-token-definitions.md-sys-state-values()),
161
- 'md-sys-shape':
162
- _create-system-app-vars-map(m3-token-definitions.md-sys-shape-values()),
163
- );
164
-
165
- @return mat.private-deep-merge-all(
166
- _generate-tokens($app-vars, true, true),
167
- generate-density-tokens(0)
168
- );
169
- }
170
-
171
- // Emits CSS variables for Material's system level values. Uses the
172
- // namespace prefix in $_system-fallback-prefix.
173
- // e.g. --mat-app-surface: #E5E5E5
174
- @mixin theme($theme, $overrides: ()) {
175
- @include system-level-colors($theme, $overrides, $_system-fallback-prefix);
176
- @include system-level-typography($theme, $overrides, $_system-fallback-prefix);
177
- @include system-level-elevation($theme, $overrides, $_system-fallback-prefix);
178
- @include system-level-shape($theme, $overrides, $_system-fallback-prefix);
179
- @include system-level-motion($theme, $overrides, $_system-fallback-prefix);
180
- @include system-level-state($theme, $overrides, $_system-fallback-prefix);
181
- }
182
-
183
- @mixin system-level-colors($theme, $overrides: (), $prefix: null) {
184
- $palettes: map.get($theme, _mat-theming-internals-do-not-access, palettes);
185
- $base-palettes: (
186
- neutral: map.get($palettes, neutral),
187
- neutral-variant: map.get($palettes, neutral-variant),
188
- secondary: map.get($palettes, secondary),
189
- error: map.get($palettes, error),
190
- );
191
-
192
- $type: map.get($theme, _mat-theming-internals-do-not-access, theme-type);
193
- $primary: map.merge(map.get($palettes, primary), $base-palettes);
194
- $tertiary: map.merge(map.get($palettes, tertiary), $base-palettes);
195
- $error: map.get($palettes, error);
196
-
197
- @if (not $prefix) {
198
- $prefix: map.get($theme, _mat-theming-internals-do-not-access,
199
- color-system-variables-prefix) or $_system-level-prefix;
200
- }
201
-
202
- $ref: (
203
- md-ref-palette: _generate-ref-palette-tokens($primary, $tertiary, $error)
204
- );
205
-
206
- $sys-colors: if($type == dark,
207
- m3-token-definitions.md-sys-color-values-dark($ref),
208
- m3-token-definitions.md-sys-color-values-light($ref));
209
-
210
- @each $name, $value in $sys-colors {
211
- --#{$prefix}-#{$name}: #{map.get($overrides, $name) or $value};
212
- }
213
- }
214
-
215
- @mixin system-level-typography($theme, $overrides: (), $prefix: null) {
216
- $font-definition: map.get($theme, _mat-theming-internals-do-not-access, font-definition);
217
- $brand: map.get($font-definition, brand);
218
- $plain: map.get($font-definition, plain);
219
- $bold: map.get($font-definition, bold);
220
- $medium: map.get($font-definition, medium);
221
- $regular: map.get($font-definition, regular);
222
- $ref: (
223
- md-ref-typeface: _generate-ref-typeface-tokens($brand, $plain, $bold, $medium, $regular)
224
- );
225
-
226
- @if (not $prefix) {
227
- $prefix: map.get($theme, _mat-theming-internals-do-not-access,
228
- typography-system-variables-prefix) or $_system-level-prefix;
229
- }
230
-
231
- @each $name, $value in m3-token-definitions.md-sys-typescale-values($ref) {
232
- --#{$prefix}-#{$name}: #{map.get($overrides, $name) or $value};
233
- }
234
- }
235
-
236
129
  @function create-map($keys, $prefix) {
237
130
  $result: ();
238
131
  @each $key in $keys {
@@ -241,42 +134,6 @@ $_cached-token-slots: null;
241
134
  @return $result;
242
135
  }
243
136
 
244
- @mixin system-level-elevation($theme, $overrides: (), $prefix: $_system-level-prefix) {
245
- $shadow-color: map.get(
246
- $theme, _mat-theming-internals-do-not-access, color-tokens, (mdc, theme), shadow);
247
-
248
- @for $level from 0 through 24 {
249
- $value: elevation.get-box-shadow($level, $shadow-color);
250
-
251
- --#{$prefix}-elevation-shadow-level-#{$level}: #{$value};
252
- }
253
-
254
- @each $name, $value in m3-token-definitions.md-sys-elevation-values() {
255
- $level: map.get($overrides, $name) or $value;
256
- $value: elevation.get-box-shadow($level, $shadow-color);
257
-
258
- --#{$prefix}-#{$name}: #{$value};
259
- }
260
- }
261
-
262
- @mixin system-level-shape($theme, $overrides: (), $prefix: $_system-level-prefix) {
263
- @each $name, $value in m3-token-definitions.md-sys-shape-values() {
264
- --#{$prefix}-#{$name}: #{map.get($overrides, $name) or $value};
265
- }
266
- }
267
-
268
- @mixin system-level-state($theme, $overrides: (), $prefix: $_system-level-prefix) {
269
- @each $name, $value in m3-token-definitions.md-sys-state-values() {
270
- --#{$prefix}-#{$name}: #{map.get($overrides, $name) or $value};
271
- }
272
- }
273
-
274
- @mixin system-level-motion($theme, $overrides: (), $prefix: $_system-level-prefix) {
275
- @each $name, $value in m3-token-definitions.md-sys-motion-values() {
276
- --#{$prefix}-#{$name}: #{map.get($overrides, $name) or $value};
277
- }
278
- }
279
-
280
137
  @function _get-sys-color($type, $ref, $prefix) {
281
138
  $mdc-sys-color: if($type == dark,
282
139
  m3-token-definitions.md-sys-color-values-dark($ref),
@@ -452,12 +309,12 @@ $_cached-token-slots: null;
452
309
  /// @return {Map} A map of namespaced color tokens
453
310
  @function generate-color-tokens($type, $primary, $tertiary, $error, $system-variables-prefix) {
454
311
  $ref: (
455
- md-ref-palette: _generate-ref-palette-tokens($primary, $tertiary, $error)
312
+ md-ref-palette: generate-ref-palette-tokens($primary, $tertiary, $error)
456
313
  );
457
314
 
458
315
  $sys-color: _get-sys-color($type, $ref, $system-variables-prefix);
459
316
 
460
- @return _generate-tokens(map.merge($ref, (
317
+ @return generate-tokens(map.merge($ref, (
461
318
  // Used to get the theme type
462
319
  md-sys-type: $type,
463
320
 
@@ -484,10 +341,10 @@ $_cached-token-slots: null;
484
341
  @function generate-typography-tokens($brand, $plain, $bold, $medium, $regular,
485
342
  $system-variables-prefix) {
486
343
  $ref: (
487
- md-ref-typeface: _generate-ref-typeface-tokens($brand, $plain, $bold, $medium, $regular)
344
+ md-ref-typeface: generate-ref-typeface-tokens($brand, $plain, $bold, $medium, $regular)
488
345
  );
489
346
  $sys-typeface: _get-sys-typeface($ref, $system-variables-prefix);
490
- @return _generate-tokens((
347
+ @return generate-tokens((
491
348
  md-sys-typescale: $sys-typeface
492
349
  ));
493
350
  }
@@ -504,7 +361,7 @@ $system-variables-prefix) {
504
361
  /// @return {Map} A map of namespaced tokens not related to color, typography, or density
505
362
  @function generate-base-tokens() {
506
363
  // TODO(mmalerba): Exclude density tokens once implemented.
507
- @return _generate-tokens((
364
+ @return generate-tokens((
508
365
  md-sys-motion: m3-token-definitions.md-sys-motion-values(),
509
366
  md-sys-shape: m3-token-definitions.md-sys-shape-values(),
510
367
  ), $include-non-systemized: true);