@ng-matero/extensions 19.4.1 → 20.0.1

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 (283) hide show
  1. package/_index.scss +1 -1
  2. package/alert/_alert-theme.scss +26 -31
  3. package/alert/_m2-alert.scss +59 -0
  4. package/alert/_m3-alert.scss +41 -0
  5. package/alert/alert.scss +27 -31
  6. package/alert/index.d.ts +30 -5
  7. package/button/index.d.ts +31 -5
  8. package/checkbox-group/index.d.ts +117 -5
  9. package/colorpicker/_colorpicker-theme.scss +31 -36
  10. package/{core/tokens/m2/mtx/_colorpicker.scss → colorpicker/_m2-colorpicker.scss} +6 -10
  11. package/colorpicker/_m3-colorpicker.scss +23 -0
  12. package/colorpicker/colorpicker-toggle.scss +4 -9
  13. package/colorpicker/index.d.ts +285 -3
  14. package/column-resize/index.d.ts +456 -3
  15. package/core/index.d.ts +147 -5
  16. package/core/theming/_color-api-backwards-compatibility.scss +8 -15
  17. package/core/theming/_definition.scss +81 -75
  18. package/core/theming/_palettes.scss +1036 -0
  19. package/core/tokens/{m2/_index.scss → _m2-tokens.scss} +22 -22
  20. package/core/tokens/_m2-utils.scss +108 -0
  21. package/core/tokens/_m3-system.scss +128 -106
  22. package/core/tokens/_m3-tokens.scss +36 -282
  23. package/core/tokens/_m3-utils.scss +48 -0
  24. package/core/tokens/_token-utils.scss +67 -239
  25. package/core/tokens/m3/_index.scss +7 -0
  26. package/core/tokens/m3/_md-sys-color.scss +156 -0
  27. package/core/tokens/m3/_md-sys-elevation.scss +15 -0
  28. package/core/tokens/m3/_md-sys-motion.scss +35 -0
  29. package/core/tokens/m3/_md-sys-shape.scss +21 -0
  30. package/core/tokens/m3/_md-sys-state.scss +13 -0
  31. package/core/tokens/m3/_md-sys-typescale.scss +128 -0
  32. package/core/tokens/m3/_theme.scss +47 -0
  33. package/datetimepicker/_datetimepicker-theme.scss +29 -39
  34. package/datetimepicker/_m2-datetimepicker.scss +149 -0
  35. package/datetimepicker/_m3-datetimepicker.scss +81 -0
  36. package/datetimepicker/calendar-body.scss +31 -56
  37. package/datetimepicker/calendar.scss +43 -79
  38. package/datetimepicker/clock.scss +28 -47
  39. package/datetimepicker/datetimepicker-content.scss +9 -15
  40. package/datetimepicker/datetimepicker-toggle.scss +4 -9
  41. package/datetimepicker/index.d.ts +1208 -3
  42. package/datetimepicker/time-view.scss +26 -32
  43. package/dialog/index.d.ts +54 -5
  44. package/drawer/_drawer-theme.scss +25 -30
  45. package/{core/tokens/m2/mtx/_drawer.scss → drawer/_m2-drawer.scss} +9 -12
  46. package/drawer/_m3-drawer.scss +24 -0
  47. package/drawer/drawer-container.scss +13 -24
  48. package/drawer/index.d.ts +221 -3
  49. package/fesm2022/mtxAlert.mjs +7 -7
  50. package/fesm2022/mtxAlert.mjs.map +1 -1
  51. package/fesm2022/mtxButton.mjs +11 -11
  52. package/fesm2022/mtxButton.mjs.map +1 -1
  53. package/fesm2022/mtxCheckboxGroup.mjs +7 -7
  54. package/fesm2022/mtxColorpicker.mjs +21 -21
  55. package/fesm2022/mtxColorpicker.mjs.map +1 -1
  56. package/fesm2022/mtxColumnResize.mjs +232 -103
  57. package/fesm2022/mtxColumnResize.mjs.map +1 -1
  58. package/fesm2022/mtxCore.mjs +21 -21
  59. package/fesm2022/mtxDatetimepicker.mjs +63 -67
  60. package/fesm2022/mtxDatetimepicker.mjs.map +1 -1
  61. package/fesm2022/mtxDialog.mjs +10 -10
  62. package/fesm2022/mtxDialog.mjs.map +1 -1
  63. package/fesm2022/mtxDrawer.mjs +10 -10
  64. package/fesm2022/mtxGrid.mjs +78 -77
  65. package/fesm2022/mtxGrid.mjs.map +1 -1
  66. package/fesm2022/mtxLoader.mjs +7 -7
  67. package/fesm2022/mtxPhotoviewer.mjs +7 -7
  68. package/fesm2022/mtxPopover.mjs +24 -25
  69. package/fesm2022/mtxPopover.mjs.map +1 -1
  70. package/fesm2022/mtxProgress.mjs +7 -7
  71. package/fesm2022/mtxSelect.mjs +54 -54
  72. package/fesm2022/mtxSelect.mjs.map +1 -1
  73. package/fesm2022/mtxSplit.mjs +10 -10
  74. package/fesm2022/mtxTooltip.mjs +13 -13
  75. package/fesm2022/mtxTooltip.mjs.map +1 -1
  76. package/grid/_grid-theme.scss +24 -34
  77. package/grid/_m2-grid.scss +66 -0
  78. package/grid/_m3-grid.scss +35 -0
  79. package/grid/column-menu.scss +6 -23
  80. package/grid/column-resize/_column-resize.scss +35 -30
  81. package/grid/grid.scss +41 -74
  82. package/grid/index.d.ts +799 -3
  83. package/index.d.ts +2 -5
  84. package/loader/_loader-theme.scss +26 -31
  85. package/{core/tokens/m2/mtx/_loader.scss → loader/_m2-loader.scss} +5 -10
  86. package/loader/_m3-loader.scss +20 -0
  87. package/loader/index.d.ts +43 -5
  88. package/loader/loader.scss +4 -5
  89. package/package.json +28 -28
  90. package/photoviewer/index.d.ts +26 -5
  91. package/{core/tokens/m2/mtx/_popover.scss → popover/_m2-popover.scss} +9 -12
  92. package/popover/_m3-popover.scss +26 -0
  93. package/popover/_popover-theme.scss +26 -31
  94. package/popover/index.d.ts +399 -3
  95. package/popover/popover.scss +23 -29
  96. package/prebuilt-themes/azure-blue.css +1 -1
  97. package/prebuilt-themes/cyan-orange.css +1 -1
  98. package/prebuilt-themes/deeppurple-amber.css +1 -1
  99. package/prebuilt-themes/indigo-pink.css +1 -1
  100. package/prebuilt-themes/magenta-violet.css +1 -1
  101. package/prebuilt-themes/pink-bluegrey.css +1 -1
  102. package/prebuilt-themes/purple-green.css +1 -1
  103. package/prebuilt-themes/rose-red.css +1 -1
  104. package/progress/_m2-progress.scss +53 -0
  105. package/progress/_m3-progress.scss +33 -0
  106. package/progress/_progress-theme.scss +22 -34
  107. package/progress/index.d.ts +35 -5
  108. package/progress/progress.scss +28 -43
  109. package/select/_m2-select.scss +79 -0
  110. package/select/_m3-select.scss +46 -0
  111. package/select/_select-theme.scss +27 -37
  112. package/select/index.d.ts +381 -3
  113. package/select/select.scss +189 -205
  114. package/{core/tokens/m2/mtx/_split.scss → split/_m2-split.scss} +6 -9
  115. package/split/_m3-split.scss +23 -0
  116. package/split/_split-theme.scss +31 -34
  117. package/split/index.d.ts +255 -3
  118. package/split/split.scss +8 -11
  119. package/tooltip/_m2-tooltip.scss +50 -0
  120. package/tooltip/_m3-tooltip.scss +28 -0
  121. package/tooltip/_tooltip-theme.scss +23 -47
  122. package/tooltip/index.d.ts +345 -3
  123. package/tooltip/tooltip.scss +11 -15
  124. package/alert/alert-module.d.ts +0 -8
  125. package/alert/alert.d.ts +0 -19
  126. package/alert/public-api.d.ts +0 -2
  127. package/button/button-loading.d.ts +0 -19
  128. package/button/button-module.d.ts +0 -10
  129. package/button/public-api.d.ts +0 -2
  130. package/checkbox-group/checkbox-group-module.d.ts +0 -11
  131. package/checkbox-group/checkbox-group.d.ts +0 -86
  132. package/checkbox-group/interfaces.d.ts +0 -17
  133. package/checkbox-group/public-api.d.ts +0 -3
  134. package/colorpicker/colorpicker-animations.d.ts +0 -9
  135. package/colorpicker/colorpicker-input.d.ts +0 -88
  136. package/colorpicker/colorpicker-module.d.ts +0 -15
  137. package/colorpicker/colorpicker-toggle.d.ts +0 -39
  138. package/colorpicker/colorpicker.d.ts +0 -140
  139. package/colorpicker/public-api.d.ts +0 -5
  140. package/column-resize/column-resize-directives/column-resize-flex.d.ts +0 -29
  141. package/column-resize/column-resize-directives/column-resize.d.ts +0 -29
  142. package/column-resize/column-resize-directives/constants.d.ts +0 -10
  143. package/column-resize/column-resize-module.d.ts +0 -12
  144. package/column-resize/column-resize-notifier.d.ts +0 -48
  145. package/column-resize/column-resize.d.ts +0 -39
  146. package/column-resize/column-size-store.d.ts +0 -12
  147. package/column-resize/event-dispatcher.d.ts +0 -35
  148. package/column-resize/overlay-handle.d.ts +0 -43
  149. package/column-resize/polyfill.d.ts +0 -9
  150. package/column-resize/public-api.d.ts +0 -12
  151. package/column-resize/resizable.d.ts +0 -63
  152. package/column-resize/resize-ref.d.ts +0 -17
  153. package/column-resize/resize-strategy.d.ts +0 -84
  154. package/column-resize/selectors.d.ts +0 -10
  155. package/core/datetime/datetime-adapter.d.ts +0 -45
  156. package/core/datetime/datetime-formats.d.ts +0 -22
  157. package/core/datetime/datetime.module.d.ts +0 -15
  158. package/core/datetime/index.d.ts +0 -5
  159. package/core/datetime/native-datetime-adapter.d.ts +0 -40
  160. package/core/datetime/native-datetime-formats.d.ts +0 -2
  161. package/core/pipes/index.d.ts +0 -3
  162. package/core/pipes/is-template-ref.pipe.d.ts +0 -7
  163. package/core/pipes/pipes.module.d.ts +0 -9
  164. package/core/pipes/to-observable.pipe.d.ts +0 -8
  165. package/core/public-api.d.ts +0 -2
  166. package/core/theming/_inspection.scss +0 -38
  167. package/core/theming/_validation.scss +0 -5
  168. package/core/tokens/_density.scss +0 -49
  169. package/core/tokens/_format-tokens.scss +0 -5
  170. package/core/tokens/_token-definition.scss +0 -271
  171. package/core/tokens/m2/mdc/_plain-tooltip.scss +0 -63
  172. package/core/tokens/m2/mtx/_alert.scss +0 -62
  173. package/core/tokens/m2/mtx/_datetimepicker.scss +0 -152
  174. package/core/tokens/m2/mtx/_grid.scss +0 -69
  175. package/core/tokens/m2/mtx/_progress.scss +0 -56
  176. package/core/tokens/m2/mtx/_select.scss +0 -82
  177. package/core/tokens/m3/definitions/_index.scss +0 -9
  178. package/core/tokens/m3/definitions/_md-comp-plain-tooltip.scss +0 -51
  179. package/core/tokens/m3/definitions/_md-ref-palette.scss +0 -100
  180. package/core/tokens/m3/definitions/_md-ref-typeface.scss +0 -14
  181. package/core/tokens/m3/definitions/_md-sys-color.scss +0 -126
  182. package/core/tokens/m3/definitions/_md-sys-elevation.scss +0 -15
  183. package/core/tokens/m3/definitions/_md-sys-motion.scss +0 -46
  184. package/core/tokens/m3/definitions/_md-sys-shape.scss +0 -24
  185. package/core/tokens/m3/definitions/_md-sys-state.scss +0 -13
  186. package/core/tokens/m3/definitions/_md-sys-typescale.scss +0 -308
  187. package/core/tokens/m3/index.scss +0 -47
  188. package/core/tokens/m3/mdc/_plain-tooltip.scss +0 -15
  189. package/core/tokens/m3/mtx/_alert.scss +0 -41
  190. package/core/tokens/m3/mtx/_colorpicker.scss +0 -19
  191. package/core/tokens/m3/mtx/_datetimepicker.scss +0 -140
  192. package/core/tokens/m3/mtx/_drawer.scss +0 -22
  193. package/core/tokens/m3/mtx/_grid.scss +0 -32
  194. package/core/tokens/m3/mtx/_loader.scss +0 -22
  195. package/core/tokens/m3/mtx/_popover.scss +0 -25
  196. package/core/tokens/m3/mtx/_progress.scss +0 -32
  197. package/core/tokens/m3/mtx/_select.scss +0 -76
  198. package/core/tokens/m3/mtx/_split.scss +0 -30
  199. package/datetimepicker/calendar-body.d.ts +0 -66
  200. package/datetimepicker/calendar.d.ts +0 -157
  201. package/datetimepicker/clock.d.ts +0 -101
  202. package/datetimepicker/datetimepicker-actions.d.ts +0 -36
  203. package/datetimepicker/datetimepicker-animations.d.ts +0 -11
  204. package/datetimepicker/datetimepicker-errors.d.ts +0 -2
  205. package/datetimepicker/datetimepicker-filtertype.d.ts +0 -5
  206. package/datetimepicker/datetimepicker-input.d.ts +0 -105
  207. package/datetimepicker/datetimepicker-intl.d.ts +0 -53
  208. package/datetimepicker/datetimepicker-module.d.ts +0 -22
  209. package/datetimepicker/datetimepicker-toggle.d.ts +0 -42
  210. package/datetimepicker/datetimepicker-types.d.ts +0 -6
  211. package/datetimepicker/datetimepicker.d.ts +0 -274
  212. package/datetimepicker/month-view.d.ts +0 -80
  213. package/datetimepicker/multi-year-view.d.ts +0 -86
  214. package/datetimepicker/public-api.d.ts +0 -16
  215. package/datetimepicker/time-view.d.ts +0 -147
  216. package/datetimepicker/year-view.d.ts +0 -68
  217. package/dialog/dialog-config.d.ts +0 -17
  218. package/dialog/dialog-container.d.ts +0 -11
  219. package/dialog/dialog-module.d.ts +0 -12
  220. package/dialog/dialog.d.ts +0 -15
  221. package/dialog/public-api.d.ts +0 -4
  222. package/drawer/drawer-animations.d.ts +0 -8
  223. package/drawer/drawer-config.d.ts +0 -63
  224. package/drawer/drawer-container.d.ts +0 -35
  225. package/drawer/drawer-module.d.ts +0 -10
  226. package/drawer/drawer-ref.d.ts +0 -53
  227. package/drawer/drawer.d.ts +0 -59
  228. package/drawer/public-api.d.ts +0 -6
  229. package/grid/cell.d.ts +0 -32
  230. package/grid/column-menu.d.ts +0 -39
  231. package/grid/column-resize/column-resize-directives/column-resize-flex.d.ts +0 -24
  232. package/grid/column-resize/column-resize-directives/column-resize.d.ts +0 -24
  233. package/grid/column-resize/column-resize-directives/common.d.ts +0 -13
  234. package/grid/column-resize/column-resize-module.d.ts +0 -17
  235. package/grid/column-resize/index.d.ts +0 -7
  236. package/grid/column-resize/overlay-handle.d.ts +0 -32
  237. package/grid/column-resize/resizable-directives/common.d.ts +0 -19
  238. package/grid/column-resize/resizable-directives/resizable.d.ts +0 -32
  239. package/grid/column-resize/resize-strategy.d.ts +0 -20
  240. package/grid/expansion-toggle.d.ts +0 -17
  241. package/grid/grid-module.d.ts +0 -31
  242. package/grid/grid-pipes.d.ts +0 -39
  243. package/grid/grid-utils.d.ts +0 -33
  244. package/grid/grid.d.ts +0 -268
  245. package/grid/interfaces.d.ts +0 -180
  246. package/grid/public-api.d.ts +0 -17
  247. package/grid/selectable-cell.d.ts +0 -16
  248. package/loader/loader-module.d.ts +0 -10
  249. package/loader/loader.d.ts +0 -30
  250. package/loader/public-api.d.ts +0 -2
  251. package/photoviewer/photoviewer-module.d.ts +0 -7
  252. package/photoviewer/photoviewer.d.ts +0 -17
  253. package/photoviewer/public-api.d.ts +0 -2
  254. package/popover/popover-animations.d.ts +0 -11
  255. package/popover/popover-content.d.ts +0 -43
  256. package/popover/popover-errors.d.ts +0 -14
  257. package/popover/popover-interfaces.d.ts +0 -50
  258. package/popover/popover-module.d.ts +0 -13
  259. package/popover/popover-target.d.ts +0 -7
  260. package/popover/popover-trigger.d.ts +0 -132
  261. package/popover/popover-types.d.ts +0 -10
  262. package/popover/popover.d.ts +0 -147
  263. package/popover/public-api.d.ts +0 -8
  264. package/progress/progress-module.d.ts +0 -8
  265. package/progress/progress.d.ts +0 -24
  266. package/progress/public-api.d.ts +0 -2
  267. package/public-api.d.ts +0 -2
  268. package/select/option.d.ts +0 -21
  269. package/select/public-api.d.ts +0 -5
  270. package/select/select-intl.d.ts +0 -18
  271. package/select/select-module.d.ts +0 -12
  272. package/select/select.d.ts +0 -270
  273. package/select/templates.d.ts +0 -67
  274. package/split/interfaces.d.ts +0 -52
  275. package/split/public-api.d.ts +0 -5
  276. package/split/split-module.d.ts +0 -9
  277. package/split/split-pane.d.ts +0 -53
  278. package/split/split.d.ts +0 -133
  279. package/split/utils.d.ts +0 -13
  280. package/tooltip/public-api.d.ts +0 -3
  281. package/tooltip/tooltip-animations.d.ts +0 -9
  282. package/tooltip/tooltip-module.d.ts +0 -13
  283. package/tooltip/tooltip.d.ts +0 -321
@@ -2,40 +2,6 @@
2
2
  @use 'sass:map';
3
3
  @use 'sass:string';
4
4
  @use '@angular/material' as mat;
5
- @use '../style/elevation';
6
- @use './m3-system';
7
- @use './m3-tokens';
8
-
9
- $_tokens: null;
10
- $_component-prefix: null;
11
- $_system-fallbacks: m3-system.create-system-fallbacks();
12
-
13
- // Sets the token prefix and map to use when creating token slots.
14
- @mixin use-tokens($prefix, $tokens) {
15
- $_component-prefix: $prefix !global;
16
- $_tokens: $tokens !global;
17
-
18
- @content;
19
-
20
- $_component-prefix: null !global;
21
- $_tokens: null !global;
22
- }
23
-
24
- // Combines a prefix and a string to generate a CSS variable name for a token.
25
- @function _create-var-name($prefix, $token) {
26
- @if $prefix == null or $token == null {
27
- @error 'Must specify both prefix and name when generating token';
28
- }
29
-
30
- $string-prefix: '';
31
-
32
- // Prefixes are lists so we need to combine them.
33
- @each $part in $prefix {
34
- $string-prefix: if($string-prefix == '', $part, '#{$string-prefix}-#{$part}');
35
- }
36
-
37
- @return string.unquote('--#{$string-prefix}-#{$token}');
38
- }
39
5
 
40
6
  // Creates a CSS variable, including the fallback if provided.
41
7
  @function _create-var($name, $fallback: null) {
@@ -46,209 +12,110 @@ $_system-fallbacks: m3-system.create-system-fallbacks();
46
12
  }
47
13
  }
48
14
 
49
- // Gets the value of the token given the current global context state.
50
- @function _get-token-value($token, $fallback) {
51
- $var-name: _create-var-name($_component-prefix, $token);
52
- $fallback: _get-token-fallback($token, $fallback);
53
- @return _create-var($var-name, $fallback);
54
- }
55
-
56
- // Assertion mixin that throws an error if the global state has not been set up by wrapping
57
- // calls with `use-tokens`.
58
- @function _assert-use-tokens($token) {
59
- @if $_component-prefix == null or $_tokens == null {
60
- @error 'Function was not called within a wrapping call of `use-tokens`';
61
- }
62
- @if not map.has-key($_tokens, $token) {
63
- @error 'Token #{$token} does not exist. Configured tokens are: #{map.keys($_tokens)}';
15
+ // Returns a list of overrides for the given M3 get-tokens mixin and prefix. Each token has its
16
+ // prefix removed since the overrides API expects its absence. The returned map includes "all" for
17
+ // all override tokens, and also the subsets with keys base, color, typography, and density.
18
+ @function get-overrides($tokens, $prefix) {
19
+ $base: remove-token-prefixes(map.get($tokens, base), $prefix);
20
+ $color: remove-token-prefixes(map.get($tokens, color), $prefix);
21
+ $typography: remove-token-prefixes(map.get($tokens, typography), $prefix);
22
+ $density: remove-token-prefixes(map.get($tokens, density), $prefix);
23
+ $all: ();
24
+ @each $map in ($base, $color, $typography, $density) {
25
+ $all: map.merge($all, $map);
64
26
  }
65
27
 
66
- @return true;
28
+ @return (
29
+ all: $all,
30
+ base: $base,
31
+ color: $color,
32
+ typography: $typography,
33
+ density: $density,
34
+ );
67
35
  }
68
36
 
69
- // Emits a slot for the given token, provided that it has a non-null value in the token map passed
70
- // to `use-tokens`.
71
- // Accepts an optional fallback parameter to include in the CSS variable.
72
- // If $fallback is `true`, then use the tokens map to get the fallback.
73
- // TODO: Remove the use case where we accept "true" and handle any failing client screenshots
74
- @mixin create-token-slot($property, $token, $fallback: null) {
75
- $_assert: _assert-use-tokens($token);
76
- @if map.get($_tokens, $token) != null {
77
- #{$property}: #{_get-token-value($token, $fallback)};
37
+ // Removes a prefix from each component token in the provided map of prefixed tokens.
38
+ @function remove-token-prefixes($prefixed-tokens: (), $prefix) {
39
+ $tokens: ();
40
+ @each $prefixed-token, $value in $prefixed-tokens {
41
+ $token: string.slice($prefixed-token, string.length($prefix) + 2);
42
+ $tokens: map.set($tokens, $token, $value);
78
43
  }
44
+ @return $tokens;
79
45
  }
80
46
 
81
- // Returns the name of a token including the current prefix. Intended to be used in calculations
82
- // involving tokens. `create-token-slot` should be used when outputting tokens.
83
- @function get-token-variable-name($token) {
84
- $_assert: _assert-use-tokens($token);
85
- @return _create-var-name($_component-prefix, $token);
86
- }
87
-
88
- // Returns a `var()` reference to a specific token. Intended for declarations
89
- // where the token has to be referenced as a part of a larger expression.
47
+ // Returns the token slot value.
90
48
  // Accepts an optional fallback parameter to include in the CSS variable.
91
49
  // If $fallback is `true`, then use the tokens map to get the fallback.
92
- // TODO: Remove the use case where we accept "true" and handle any failing client screenshots
93
- @function get-token-variable($token, $fallback: null) {
94
- $_assert: _assert-use-tokens($token);
95
- @return _get-token-value($token, $fallback);
96
- }
97
-
98
- // Gets the token's fallback value. Prefers adding a system-level fallback if one exists, otherwise
99
- // use the provided fallback.
100
- @function _get-token-fallback($token, $fallback: null) {
101
- // If the $fallback is `true`, this is the component's signal to use the current token map value
102
- @if ($fallback == true) {
103
- $fallback: map.get($_tokens, $token);
50
+ @function slot($token, $fallbacks, $fallback: null) {
51
+ // Fallbacks are a map of base, color, typography, and density tokens. To simplify
52
+ // lookup, flatten these token groups into a single map.
53
+ $fallbacks-flattened: ();
54
+ @each $tokens in map.values($fallbacks) {
55
+ @each $token, $value in $tokens {
56
+ $fallbacks-flattened: map.set($fallbacks-flattened, $token, $value);
57
+ }
104
58
  }
105
-
106
- // Check whether there's a system-level fallback. If not, return the optional
107
- // provided fallback (otherwise null).
108
- $sys-fallback: map.get($_system-fallbacks, $_component-prefix, $token);
109
- @if (not $sys-fallback) {
110
- @return $fallback;
59
+ @if not map.has-key($fallbacks-flattened, $token) {
60
+ @error 'Token #{$token} does not exist. Configured tokens are:' +
61
+ #{map.keys($fallbacks-flattened)};
111
62
  }
112
63
 
64
+ $sys-fallback: map.get($fallbacks-flattened, $token);
113
65
  @if (mat.private-is-css-var-name($sys-fallback)) {
114
- @return _create-var($sys-fallback, $fallback);
66
+ $sys-fallback: _create-var($sys-fallback, $fallback);
115
67
  }
116
68
 
117
- @return $sys-fallback;
69
+ @return _create-var(--mtx-#{$token}, $sys-fallback);
118
70
  }
119
71
 
120
- // Outputs a map of tokens under a specific prefix.
121
- @mixin create-token-values($prefix, $tokens) {
122
- @if $tokens != null {
123
- // TODO: The `&` adds to the file size of theme, but it's necessary for compatibility
124
- // with https://sass-lang.com/documentation/breaking-changes/mixed-decls/. We should
125
- // figure out a better way to do this or move all the concrete styles out of the theme.
126
- & {
127
- @each $key, $value in $tokens {
128
- @if $value != null {
129
- #{_create-var-name($prefix, $key)}: #{$value};
130
- }
131
- }
132
- }
133
- }
72
+ // Outputs a map of tokens.
73
+ @mixin create-token-values($tokens) {
74
+ @include _create-token-values-internal($tokens, false);
134
75
  }
135
76
 
136
- // MDC doesn't currently handle elevation tokens properly. As a temporary workaround we can combine
137
- // the elevation and shadow-color tokens into a full box-shadow and use it as the value for the
138
- // elevation token.
139
- @function resolve-elevation($tokens, $elevation-token, $shadow-color-token) {
140
- $elevation: map.get($tokens, $elevation-token);
141
- $shadow-color: map.get($tokens, $shadow-color-token);
142
- @return map.merge(
143
- $tokens,
144
- (
145
- $elevation-token: elevation.get-box-shadow($elevation, $shadow-color),
146
- $shadow-color-token: null,
147
- )
148
- );
77
+ // Outputs a map of tokens under a specific prefix in scenarios where tokens may be mixed with
78
+ // other declarations (e.g. M2 themes). Used to avoid https://sass-lang.com/documentation/breaking-changes/mixed-decls/
79
+ @mixin create-token-values-mixed($tokens) {
80
+ @include _create-token-values-internal($tokens, true);
149
81
  }
150
82
 
151
- /// Checks whether a list starts wih a given prefix
152
- /// @param {List} $list The list value to check the prefix of.
153
- /// @param {List} $prefix The prefix to check.
154
- /// @return {Boolean} Whether the list starts with the prefix.
155
- @function _is-prefix($list, $prefix) {
156
- @for $i from 1 through list.length($prefix) {
157
- @if list.nth($list, $i) != list.nth($prefix, $i) {
158
- @return false;
159
- }
160
- }
161
- @return true;
162
- }
163
-
164
- /// Gets the supported color variants in the given token set for the given prefix.
165
- /// @param {Map} $tokens The full token map.
166
- /// @param {List} $prefix The component prefix to get color variants for.
167
- /// @return {List} The supported color variants.
168
- @function _supported-color-variants($tokens, $prefix) {
169
- $result: ();
170
- @each $namespace in map.keys($tokens) {
171
- @if list.length($prefix) == list.length($namespace) - 1 and _is-prefix($namespace, $prefix) {
172
- $result: list.append($result, list.nth($namespace, list.length($namespace)), comma);
83
+ @mixin _create-token-values-internal($tokens, $in-place) {
84
+ @if ($tokens != null) {
85
+ @if ($in-place) {
86
+ & {
87
+ @each $key, $value in $tokens {
88
+ @if $value != null {
89
+ --mtx-#{$key}: #{$value};
90
+ }
91
+ }
92
+ }
93
+ } @else {
94
+ @each $key, $value in $tokens {
95
+ @if $value != null {
96
+ --mtx-#{$key}: #{$value};
97
+ }
98
+ }
173
99
  }
174
100
  }
175
- @return $result;
176
- }
177
-
178
- /// Gets the token values for the given components prefix with the given options.
179
- /// @param {Map} $tokens The full token map.
180
- /// @param {List} $prefix The component prefix to get the token values for.
181
- /// @param {ArgList} Any additional options
182
- /// Currently the additional supported options are:
183
- // - $color-variant - The color variant to use for the component
184
- // - $emit-overrides-only - Whether to emit *only* the overrides for the
185
- // specific color variant, or all color styles. Defaults to false.
186
- /// @throws If given options are invalid
187
- /// @return {Map} The token values for the requested component.
188
- @function get-tokens-for($tokens, $prefix, $options...) {
189
- $options: mat.private-validate-keyword-args($options, (color-variant, emit-overrides-only));
190
- @if $tokens == () {
191
- @return ();
192
- }
193
- $values: map.get($tokens, $prefix);
194
- $color-variant: map.get($options, color-variant);
195
- $emit-overrides-only: map.get($options, emit-overrides-only);
196
- @if $color-variant == null {
197
- @return $values;
198
- }
199
- $overrides: map.get($tokens, list.append($prefix, $color-variant));
200
- @if $overrides == null {
201
- $variants: _supported-color-variants($tokens, $prefix);
202
- $secondary-message: if(
203
- $variants == (),
204
- 'Mixin does not support color variants',
205
- 'Supported color variants are: #{$variants}'
206
- );
207
-
208
- @error 'Invalid color variant: #{$color-variant}. #{$secondary-message}.';
209
- }
210
- @return if($emit-overrides-only, $overrides, map.merge($values, $overrides));
211
101
  }
212
102
 
213
103
  /// Emits new token values for the given token overrides.
214
104
  /// Verifies that the overrides passed in are valid tokens.
215
105
  /// New token values are emitted under the current selector or root.
216
- @mixin batch-create-token-values($overrides: (), $namespace-configs...) {
106
+ @mixin batch-create-token-values($overrides: (), $namespace-configs) {
217
107
  @include mat.private-current-selector-or-root() {
218
108
  $prefixed-name-data: ();
219
- $unprefixed-name-data: ();
220
109
  $all-names: ();
221
110
 
222
111
  @each $config in $namespace-configs {
223
112
  $namespace: map.get($config, namespace);
224
113
  $prefix: if(map.has-key($config, prefix), map.get($config, prefix), '');
225
- $tokens: _filter-nulls(map.get($config, tokens));
114
+ $tokens: map.get(map.get($config, tokens), all);
226
115
  @each $name, $value in $tokens {
227
116
  $prefixed-name: $prefix + $name;
228
117
  $all-names: list.append($all-names, $prefixed-name, $separator: comma);
229
- @if map.has-key($prefixed-name-data, $prefixed-name) {
230
- @error #{
231
- 'Error overriding token: Ambiguous token name `'
232
- }#{
233
- $prefixed-name
234
- }#{
235
- '` exists in multiple namespaces: `('
236
- }#{
237
- list.nth(map.get($prefixed-name-data, $prefixed-name), 1)
238
- }#{
239
- ')` and `('
240
- }#{
241
- $namespace
242
- }#{
243
- ')`'
244
- };
245
- }
246
118
  $prefixed-name-data: map.set($prefixed-name-data, $prefixed-name, ($namespace, $name));
247
- $unprefixed-data: map.has-key($unprefixed-name-data, $name) and
248
- map.get($unprefixed-name-data, $name) or
249
- ();
250
- $unprefixed-data: list.append($unprefixed-data, ($namespace, $prefixed-name));
251
- $unprefixed-name-data: map.set($unprefixed-name-data, $name, $unprefixed-data);
252
119
  }
253
120
  }
254
121
 
@@ -257,50 +124,11 @@ $_system-fallbacks: m3-system.create-system-fallbacks();
257
124
  $data: map.get($prefixed-name-data, $name);
258
125
  $namespace: list.nth($data, 1);
259
126
  $name: list.nth($data, 2);
260
- @include create-token-values(
261
- $namespace,
262
- (
263
- $name: $value,
264
- )
265
- );
266
- } @else if (map.has-key($unprefixed-name-data, $name)) {
267
- $datalist: map.get($unprefixed-name-data, $name);
268
- $prefixed-names: ();
269
- @each $data in $datalist {
270
- $namespace: list.nth($data, 1);
271
- $prefixed-names: list.append($prefixed-names, list.nth($data, 2), $separator: comma);
272
- @include create-token-values(
273
- $namespace,
274
- (
275
- $name: $value,
276
- )
277
- );
278
- }
279
- @warn #{
280
- 'Token `'
281
- }#{
282
- $name
283
- }#{
284
- '` is deprecated. Please use one of the following alternatives: '
285
- }#{
286
- $prefixed-names
287
- };
127
+ $prefixed-name: $namespace + '-' + $name;
128
+ @include create-token-values(($prefixed-name: $value));
288
129
  } @else {
289
130
  @error #{'Invalid token name `'}#{$name}#{'`. '}#{'Valid tokens are: '}#{$all-names};
290
131
  }
291
132
  }
292
133
  }
293
134
  }
294
-
295
- /// Filters keys with a null value out of the map.
296
- /// @param {Map} $map The map to filter.
297
- /// @return {Map} The given map with all of the null keys filtered out.
298
- @function _filter-nulls($map) {
299
- $result: ();
300
- @each $key, $val in $map {
301
- @if $val != null {
302
- $result: map.set($result, $key, $val);
303
- }
304
- }
305
- @return $result;
306
- }
@@ -0,0 +1,7 @@
1
+ @forward './md-sys-color';
2
+ @forward './md-sys-elevation';
3
+ @forward './md-sys-motion';
4
+ @forward './md-sys-shape';
5
+ @forward './md-sys-state';
6
+ @forward './md-sys-typescale';
7
+ @forward './theme';
@@ -0,0 +1,156 @@
1
+ //
2
+ // Design system display name: Material 3
3
+ // Design system version: v0.161
4
+ //
5
+
6
+ @use 'sass:map';
7
+
8
+ // Indicates whether alternative tokens should be used
9
+ $_alternate-tokens: false;
10
+
11
+ @function md-sys-color-values-dark($palettes) {
12
+ $values: (
13
+ background: map.get($palettes, neutral, 6),
14
+ error: map.get($palettes, error, 80),
15
+ error-container: map.get($palettes, error, 30),
16
+ inverse-on-surface: map.get($palettes, neutral, 20),
17
+ inverse-primary: map.get($palettes, primary, 40),
18
+ inverse-surface: map.get($palettes, neutral, 90),
19
+ on-background: map.get($palettes, neutral, 90),
20
+ on-error: map.get($palettes, error, 20),
21
+ on-error-container: map.get($palettes, error, 90),
22
+ on-primary: map.get($palettes, primary, 20),
23
+ on-primary-container: map.get($palettes, primary, 90),
24
+ on-primary-fixed: map.get($palettes, primary, 10),
25
+ on-primary-fixed-variant: map.get($palettes, primary, 30),
26
+ on-secondary: map.get($palettes, secondary, 20),
27
+ on-secondary-container: map.get($palettes, secondary, 90),
28
+ on-secondary-fixed: map.get($palettes, secondary, 10),
29
+ on-secondary-fixed-variant: map.get($palettes, secondary, 30),
30
+ on-surface: map.get($palettes, neutral, 90),
31
+ on-surface-variant: map.get($palettes, neutral-variant, 90),
32
+ on-tertiary: map.get($palettes, tertiary, 20),
33
+ on-tertiary-container: map.get($palettes, tertiary, 90),
34
+ on-tertiary-fixed: map.get($palettes, tertiary, 10),
35
+ on-tertiary-fixed-variant: map.get($palettes, tertiary, 30),
36
+ outline: map.get($palettes, neutral-variant, 60),
37
+ outline-variant: map.get($palettes, neutral-variant, 30),
38
+ primary: map.get($palettes, primary, 80),
39
+ primary-container: map.get($palettes, primary, 30),
40
+ primary-fixed: map.get($palettes, primary, 90),
41
+ primary-fixed-dim: map.get($palettes, primary, 80),
42
+ scrim: map.get($palettes, neutral, 0),
43
+ secondary: map.get($palettes, secondary, 80),
44
+ secondary-container: map.get($palettes, secondary, 30),
45
+ secondary-fixed: map.get($palettes, secondary, 90),
46
+ secondary-fixed-dim: map.get($palettes, secondary, 80),
47
+ shadow: map.get($palettes, neutral, 0),
48
+ surface: map.get($palettes, neutral, 6),
49
+ surface-bright: map.get($palettes, neutral, 24),
50
+ surface-container: map.get($palettes, neutral, 12),
51
+ surface-container-high: map.get($palettes, neutral, 17),
52
+ surface-container-highest: map.get($palettes, neutral, 22),
53
+ surface-container-low: map.get($palettes, neutral, 10),
54
+ surface-container-lowest: map.get($palettes, neutral, 4),
55
+ surface-dim: map.get($palettes, neutral, 6),
56
+ surface-tint: map.get($palettes, primary, 80),
57
+ surface-variant: map.get($palettes, neutral-variant, 30),
58
+ tertiary: map.get($palettes, tertiary, 80),
59
+ tertiary-container: map.get($palettes, tertiary, 30),
60
+ tertiary-fixed: map.get($palettes, tertiary, 90),
61
+ tertiary-fixed-dim: map.get($palettes, tertiary, 80)
62
+ );
63
+
64
+ @if ($_alternate-tokens) {
65
+ $values: map.merge($values, (
66
+ background: map.get($palettes, neutral, 10),
67
+ on-surface-variant: map.get($palettes, neutral-variant, 80),
68
+ surface: map.get($palettes, neutral, 10),
69
+ surface-bright: #37393b,
70
+ surface-container: #1e1f20,
71
+ surface-container-high: #282a2c,
72
+ surface-container-highest: #333537,
73
+ surface-container-low: #1b1b1b,
74
+ surface-container-lowest: #0e0e0e,
75
+ surface-dim: #131313,
76
+ surface-tint: #d1e1ff,
77
+ ));
78
+ }
79
+
80
+ @return $values;
81
+ }
82
+
83
+ @function md-sys-color-values-light($palettes) {
84
+ $values: (
85
+ background: map.get($palettes, neutral, 98),
86
+ error: map.get($palettes, error, 40),
87
+ error-container: map.get($palettes, error, 90),
88
+ inverse-on-surface: map.get($palettes, neutral, 95),
89
+ inverse-primary: map.get($palettes, primary, 80),
90
+ inverse-surface: map.get($palettes, neutral, 20),
91
+ on-background: map.get($palettes, neutral, 10),
92
+ on-error: map.get($palettes, error, 100),
93
+ on-error-container: map.get($palettes, error, 30),
94
+ on-primary: map.get($palettes, primary, 100),
95
+ on-primary-container: map.get($palettes, primary, 30),
96
+ on-primary-fixed: map.get($palettes, primary, 10),
97
+ on-primary-fixed-variant: map.get($palettes, primary, 30),
98
+ on-secondary: map.get($palettes, secondary, 100),
99
+ on-secondary-container: map.get($palettes, secondary, 30),
100
+ on-secondary-fixed: map.get($palettes, secondary, 10),
101
+ on-secondary-fixed-variant: map.get($palettes, secondary, 30),
102
+ on-surface: map.get($palettes, neutral, 10),
103
+ on-surface-variant: map.get($palettes, neutral-variant, 30),
104
+ on-tertiary: map.get($palettes, tertiary, 100),
105
+ on-tertiary-container: map.get($palettes, tertiary, 30),
106
+ on-tertiary-fixed: map.get($palettes, tertiary, 10),
107
+ on-tertiary-fixed-variant: map.get($palettes, tertiary, 30),
108
+ outline: map.get($palettes, neutral-variant, 50),
109
+ outline-variant: map.get($palettes, neutral-variant, 80),
110
+ primary: map.get($palettes, primary, 40),
111
+ primary-container: map.get($palettes, primary, 90),
112
+ primary-fixed: map.get($palettes, primary, 90),
113
+ primary-fixed-dim: map.get($palettes, primary, 80),
114
+ scrim: map.get($palettes, neutral, 0),
115
+ secondary: map.get($palettes, secondary, 40),
116
+ secondary-container: map.get($palettes, secondary, 90),
117
+ secondary-fixed: map.get($palettes, secondary, 90),
118
+ secondary-fixed-dim: map.get($palettes, secondary, 80),
119
+ shadow: map.get($palettes, neutral, 0),
120
+ surface: map.get($palettes, neutral, 98),
121
+ surface-bright: map.get($palettes, neutral, 98),
122
+ surface-container: map.get($palettes, neutral, 94),
123
+ surface-container-high: map.get($palettes, neutral, 92),
124
+ surface-container-highest: map.get($palettes, neutral, 90),
125
+ surface-container-low: map.get($palettes, neutral, 96),
126
+ surface-container-lowest: map.get($palettes, neutral, 100),
127
+ surface-dim: map.get($palettes, neutral, 87),
128
+ surface-tint: map.get($palettes, primary, 40),
129
+ surface-variant: map.get($palettes, neutral-variant, 90),
130
+ tertiary: map.get($palettes, tertiary, 40),
131
+ tertiary-container: map.get($palettes, tertiary, 90),
132
+ tertiary-fixed: map.get($palettes, tertiary, 90),
133
+ tertiary-fixed-dim: map.get($palettes, tertiary, 80)
134
+ );
135
+
136
+ @if ($_alternate-tokens) {
137
+ $values: map.merge($values, (
138
+ background: map.get($palettes, neutral, 100),
139
+ on-error-container: map.get($palettes, error, 10),
140
+ on-primary-container: map.get($palettes, primary, 10),
141
+ on-secondary-container: map.get($palettes, secondary, 10),
142
+ on-tertiary-container: map.get($palettes, tertiary, 10),
143
+ surface: map.get($palettes, neutral, 100),
144
+ surface-bright: map.get($palettes, neutral, 100),
145
+ surface-container: #f0f4f9,
146
+ surface-container-high: #e9eef6,
147
+ surface-container-highest: #dde3ea,
148
+ surface-container-low: #f8fafd,
149
+ surface-container-lowest: map.get($palettes, primary, 100),
150
+ surface-dim: #d3dbe5,
151
+ surface-tint: #6991d6,
152
+ ));
153
+ }
154
+
155
+ @return $values;
156
+ }
@@ -0,0 +1,15 @@
1
+ //
2
+ // Design system display name: Material 3
3
+ // Design system version: v0.161
4
+ //
5
+
6
+ @function md-sys-elevation-values() {
7
+ @return (
8
+ level0: 0,
9
+ level1: 1,
10
+ level2: 3,
11
+ level3: 6,
12
+ level4: 8,
13
+ level5: 12
14
+ );
15
+ }
@@ -0,0 +1,35 @@
1
+ //
2
+ // Design system display name: Material 3
3
+ // Design system version: v0.161
4
+ //
5
+
6
+ @function md-sys-motion-values() {
7
+ @return (
8
+ duration-extra-long1: 700ms,
9
+ duration-extra-long2: 800ms,
10
+ duration-extra-long3: 900ms,
11
+ duration-extra-long4: 1000ms,
12
+ duration-long1: 450ms,
13
+ duration-long2: 500ms,
14
+ duration-long3: 550ms,
15
+ duration-long4: 600ms,
16
+ duration-medium1: 250ms,
17
+ duration-medium2: 300ms,
18
+ duration-medium3: 350ms,
19
+ duration-medium4: 400ms,
20
+ duration-short1: 50ms,
21
+ duration-short2: 100ms,
22
+ duration-short3: 150ms,
23
+ duration-short4: 200ms,
24
+ easing-emphasized: cubic-bezier(0.2, 0, 0, 1),
25
+ easing-emphasized-accelerate: cubic-bezier(0.3, 0, 0.8, 0.15),
26
+ easing-emphasized-decelerate: cubic-bezier(0.05, 0.7, 0.1, 1),
27
+ easing-legacy: cubic-bezier(0.4, 0, 0.2, 1),
28
+ easing-legacy-accelerate: cubic-bezier(0.4, 0, 1, 1),
29
+ easing-legacy-decelerate: cubic-bezier(0, 0, 0.2, 1),
30
+ easing-linear: cubic-bezier(0, 0, 1, 1),
31
+ easing-standard: cubic-bezier(0.2, 0, 0, 1),
32
+ easing-standard-accelerate: cubic-bezier(0.3, 0, 1, 1),
33
+ easing-standard-decelerate: cubic-bezier(0, 0, 0, 1)
34
+ );
35
+ }
@@ -0,0 +1,21 @@
1
+ //
2
+ // Design system display name: Material 3
3
+ // Design system version: v0.161
4
+ //
5
+
6
+ @function md-sys-shape-values() {
7
+ @return (
8
+ corner-extra-large: 28px,
9
+ corner-extra-large-top: (28px 28px 0 0),
10
+ corner-extra-small: 4px,
11
+ corner-extra-small-top: (4px 4px 0 0),
12
+ corner-full: 9999px,
13
+ corner-large: 16px,
14
+ corner-large-end: (0 16px 16px 0),
15
+ corner-large-start: (16px 0 0 16px),
16
+ corner-large-top: (16px 16px 0 0),
17
+ corner-medium: 12px,
18
+ corner-none: 0,
19
+ corner-small: 8px
20
+ );
21
+ }
@@ -0,0 +1,13 @@
1
+ //
2
+ // Design system display name: Material 3
3
+ // Design system version: v0.161
4
+ //
5
+
6
+ @function md-sys-state-values($exclude-hardcoded-values: false) {
7
+ @return (
8
+ dragged-state-layer-opacity: 0.16,
9
+ focus-state-layer-opacity: 0.12,
10
+ hover-state-layer-opacity: 0.08,
11
+ pressed-state-layer-opacity: 0.12
12
+ );
13
+ }