@shortfuse/materialdesignweb 0.4.0 → 0.5.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 (184) hide show
  1. package/.browserslistrc +2 -1
  2. package/.eslintrc.json +59 -8
  3. package/.stylelintrc.json +94 -49
  4. package/CHANGELOG.md +12 -0
  5. package/README.md +1 -3
  6. package/adapters/datatable/column.js +27 -54
  7. package/adapters/datatable/index.js +69 -81
  8. package/adapters/dom/index.js +32 -47
  9. package/adapters/search/index.js +107 -133
  10. package/components/appbar/_spec.scss +77 -137
  11. package/components/banner/_spec.scss +28 -63
  12. package/components/bottomnav/_spec.scss +46 -54
  13. package/components/bottomnav/index.js +15 -20
  14. package/components/bottomnav/item.js +4 -5
  15. package/components/button/README.md +1 -1
  16. package/components/button/_spec.scss +43 -42
  17. package/components/button/_theme.scss +27 -50
  18. package/components/card/_spec.scss +61 -69
  19. package/components/chip/_spec.scss +21 -44
  20. package/components/chip/_theme.scss +79 -151
  21. package/components/chip/index.js +6 -4
  22. package/components/datatable/_spec.scss +36 -99
  23. package/components/datatable/_theme.scss +98 -124
  24. package/components/datatable/cell.js +1 -2
  25. package/components/datatable/columnheader.js +1 -2
  26. package/components/datatable/index.js +33 -47
  27. package/components/datatable/row.js +4 -5
  28. package/components/dialog/_spec.scss +53 -63
  29. package/components/dialog/_theme.scss +7 -0
  30. package/components/dialog/index.js +62 -88
  31. package/components/divider/_spec.scss +6 -8
  32. package/components/elevation/_spec.scss +1 -1
  33. package/components/fab/_spec.scss +30 -42
  34. package/components/fab/index.js +4 -8
  35. package/components/grid/_spec.scss +68 -211
  36. package/components/layout/_mixins.scss +0 -22
  37. package/components/layout/_spec.scss +267 -363
  38. package/components/layout/_theme.scss +10 -35
  39. package/components/layout/index.js +40 -50
  40. package/components/list/_spec.scss +57 -91
  41. package/components/list/_theme.scss +75 -84
  42. package/components/list/content.js +9 -13
  43. package/components/list/index.js +34 -38
  44. package/components/list/item.js +8 -11
  45. package/components/list/secondary.js +8 -9
  46. package/components/menu/_spec.scss +134 -167
  47. package/components/menu/index.js +45 -61
  48. package/components/menu/item.js +11 -19
  49. package/components/progress/_spec.scss +43 -34
  50. package/components/selection/_spec.scss +123 -133
  51. package/components/selection/_theme.scss +88 -120
  52. package/components/selection/index.js +9 -15
  53. package/components/selection/input.js +3 -5
  54. package/components/selection/radiogroup.js +8 -15
  55. package/components/slider/_spec.scss +23 -28
  56. package/components/snackbar/_spec.scss +17 -62
  57. package/components/snackbar/index.js +15 -21
  58. package/components/tab/_spec.scss +35 -50
  59. package/components/tab/content.js +33 -28
  60. package/components/tab/index.js +30 -33
  61. package/components/tab/item.js +4 -5
  62. package/components/tab/list.js +22 -36
  63. package/components/textfield/README.md +2 -2
  64. package/components/textfield/_spec.scss +241 -287
  65. package/components/textfield/_theme.scss +197 -232
  66. package/components/textfield/index.js +8 -16
  67. package/components/tooltip/_spec.scss +23 -26
  68. package/components/type/_spec.scss +19 -16
  69. package/core/_breakpoint.scss +33 -33
  70. package/core/_elevation.scss +40 -0
  71. package/core/_length.scss +0 -1
  72. package/core/_platform.scss +0 -22
  73. package/core/_type.scss +7 -6
  74. package/core/aria/button.js +4 -5
  75. package/core/aria/keyboard.js +1 -2
  76. package/core/aria/rovingtabindex.js +14 -17
  77. package/core/aria/tab.js +1 -2
  78. package/core/dom.js +18 -109
  79. package/core/overlay/_spec.scss +5 -8
  80. package/core/overlay/_theme.scss +126 -150
  81. package/core/overlay/index.js +19 -32
  82. package/core/ripple/_spec.scss +16 -17
  83. package/core/ripple/_theme.scss +13 -33
  84. package/core/ripple/index.js +36 -44
  85. package/core/theme/_aliases.scss +15 -0
  86. package/core/theme/_config.scss +8 -2
  87. package/core/theme/_functions.scss +22 -0
  88. package/core/theme/_palettes.scss +0 -1
  89. package/core/{color → theme}/_spec.scss +0 -0
  90. package/core/theme/_theme.scss +268 -0
  91. package/core/theme/index.scss +4 -0
  92. package/core/transition/index.js +73 -76
  93. package/docs/_flex.scss +7 -1
  94. package/docs/_menuoptions.js +2 -2
  95. package/docs/_partials/_appbar.eta +12 -14
  96. package/docs/_partials/_header.eta +41 -44
  97. package/docs/_sample-utils.js +15 -20
  98. package/docs/docs.scss +123 -87
  99. package/docs/framework.scss +26 -0
  100. package/docs/index.eta +2 -6
  101. package/docs/index.js +7 -0
  102. package/docs/pages/appbar.eta +22 -28
  103. package/docs/pages/bottomnav.js +17 -14
  104. package/docs/pages/button.js +10 -10
  105. package/docs/pages/card.js +20 -22
  106. package/docs/pages/chip.js +11 -13
  107. package/docs/pages/color.js +35 -36
  108. package/docs/pages/datatable.js +11 -15
  109. package/docs/pages/dialog.eta +9 -11
  110. package/docs/pages/dialog.js +6 -9
  111. package/docs/pages/dom.js +6 -9
  112. package/docs/pages/elevation.eta +10 -10
  113. package/docs/pages/fab.js +2 -3
  114. package/docs/pages/grid.js +5 -5
  115. package/docs/pages/list.js +1 -2
  116. package/docs/pages/menu.eta +17 -19
  117. package/docs/pages/menu.js +7 -11
  118. package/docs/pages/overlay.js +1 -2
  119. package/docs/pages/progress.eta +2 -2
  120. package/docs/pages/progress.js +1 -1
  121. package/docs/pages/ripple.js +1 -2
  122. package/docs/pages/search.eta +20 -24
  123. package/docs/pages/search.js +24 -41
  124. package/docs/pages/selection.eta +2 -6
  125. package/docs/pages/selection.js +3 -4
  126. package/docs/pages/snackbar.js +3 -4
  127. package/docs/pages/tab.eta +61 -75
  128. package/docs/pages/tab.js +16 -15
  129. package/docs/pages/textfield.eta +9 -8
  130. package/docs/pages/textfield.js +26 -23
  131. package/docs/pages/tooltip.eta +10 -12
  132. package/docs/pages/transition.js +5 -7
  133. package/docs/postrender.js +7 -5
  134. package/docs/pwa/pwa.eta +14 -16
  135. package/docs/pwa/pwa.js +19 -27
  136. package/docs/pwa/pwa.scss +12 -7
  137. package/docs/themes/theme-colored.scss +9 -11
  138. package/docs/themes/theme-default.scss +0 -14
  139. package/index.scss +27 -0
  140. package/jsconfig.json +7 -3
  141. package/package.json +26 -15
  142. package/tsconfig.json +16 -0
  143. package/{webpack.config.cjs → webpack.config.js} +105 -58
  144. package/components/template/_theme.scss +0 -27
  145. package/components/textfield/_mixins.scss +0 -52
  146. package/core/color/_theme.scss +0 -390
  147. package/core/color/index.scss +0 -2
  148. package/core/theme/_mixins.scss +0 -172
  149. package/core/theme/_variables.scss +0 -24
  150. package/docs/_mixins.pug +0 -155
  151. package/docs/pages/appbar.pug +0 -78
  152. package/docs/pages/bottomnav.pug +0 -137
  153. package/docs/pages/button.pug +0 -121
  154. package/docs/pages/card.pug +0 -74
  155. package/docs/pages/chip.pug +0 -91
  156. package/docs/pages/color.pug +0 -121
  157. package/docs/pages/datatable.pug +0 -283
  158. package/docs/pages/dialog.pug +0 -132
  159. package/docs/pages/dom.pug +0 -22
  160. package/docs/pages/elevation.pug +0 -25
  161. package/docs/pages/fab.pug +0 -66
  162. package/docs/pages/grid.pug +0 -95
  163. package/docs/pages/layout.pug +0 -7
  164. package/docs/pages/list.pug +0 -326
  165. package/docs/pages/menu.pug +0 -205
  166. package/docs/pages/overlay.pug +0 -55
  167. package/docs/pages/progress.pug +0 -16
  168. package/docs/pages/ripple.pug +0 -21
  169. package/docs/pages/search.pug +0 -165
  170. package/docs/pages/selection.pug +0 -74
  171. package/docs/pages/slider.pug +0 -17
  172. package/docs/pages/snackbar.pug +0 -60
  173. package/docs/pages/tab.pug +0 -304
  174. package/docs/pages/textfield.pug +0 -360
  175. package/docs/pages/tooltip.pug +0 -78
  176. package/docs/pages/transition.pug +0 -76
  177. package/docs/pages/type.pug +0 -29
  178. package/docs/pwa/_dialogs.pug +0 -96
  179. package/docs/pwa/_menus.pug +0 -11
  180. package/docs/pwa/pwa.pug +0 -325
  181. package/docs/spec.scss +0 -26
  182. package/docs/themes/_component-themes.scss +0 -26
  183. package/docs/themes/theme-colored-fallbacks.scss +0 -17
  184. package/docs/themes/theme-default-fallbacks.scss +0 -17
@@ -1,390 +0,0 @@
1
- // https://material.io/design/interaction/states.html
2
-
3
- @use '../theme/_mixins.scss' as theme;
4
- @use "../_platform.scss" as platform;
5
-
6
- @function _resortColors($list) {
7
- $newList: ();
8
- @each $color in $list {
9
- @if (index($newList, $color) == null) {
10
- $newList: append($newList, $color);
11
- $palette: theme.getThemeParamValue($color);
12
- @each $color2 in $list {
13
- @if (index($newList, $color2) == null) {
14
- $palette2: theme.getThemeParamValue($color2);
15
- @if ($palette == $palette2) {
16
- $newList: append($newList, $color2);
17
- }
18
- }
19
- }
20
- }
21
- }
22
- @return $newList;
23
- }
24
-
25
- // Resort colors with aliases for CSS rule merging
26
- $sortedInks: _resortColors(theme.$inks);
27
- $sortedSurfaces: _resortColors(theme.$surfaces);
28
-
29
- $themeValues: (
30
- default-ink: theme.$foreground,
31
-
32
- high-ink-opacity: theme.$high-opacity,
33
- medium-ink-opacity: theme.$medium-opacity,
34
- inactive-ink-opacity: theme.$inactive-opacity,
35
- divider-ink-opacity: theme.$divider-opacity,
36
-
37
- card-surface: ((#fff, null), (#121212, null)),
38
- binary-surface: ((#fff, null), (#000, null)),
39
- ) !default;
40
-
41
- @each $color in $sortedInks {
42
- $newInkMap: (
43
- #{$color}-default-ink: (($color, nth(theme.$default-color-ink, 1),null), ($color, nth(theme.$default-color-ink, 2), null)),
44
- #{$color}-contrast-ink: (($color, nth(theme.$contrast-color-ink, 1),null), ($color, nth(theme.$contrast-color-ink, 2), null)),
45
- #{$color}-light-ink: (($color, nth(theme.$light-color-ink, 1),null), ($color, nth(theme.$light-color-ink, 2), null)),
46
- );
47
- $themeValues: map-merge($themeValues, $newInkMap);
48
- }
49
-
50
- @each $color in $sortedSurfaces {
51
- $newSurfaceMap: (
52
- #{$color}-default-surface: (($color, nth(theme.$default-color-surface, 1),null), ($color, nth(theme.$default-color-surface, 2), null)),
53
- #{$color}-alt-surface: (($color, nth(theme.$alt-color-surface, 1),null), ($color, nth(theme.$alt-color-surface, 2), null)),
54
- );
55
- $themeValues: map-merge($themeValues, $newSurfaceMap);
56
- }
57
-
58
- @function getThemeValue($key, $type) {
59
- @return theme.getThemeValue('color', $themeValues, $key, $type);
60
- }
61
-
62
- @mixin addThemeRules($type: 'var') {
63
- @if ($type == 'var') {
64
- .mdw-theme {
65
- /** Surface Colors **/
66
-
67
- &[mdw-surface] {
68
- background-color: RGB(var(--mdw-surface));
69
- }
70
- }
71
-
72
- svg.mdw-theme[mdw-surface] {
73
- background-color: transparent;
74
-
75
- fill: RGB(var(--mdw-surface));
76
- }
77
-
78
- .mdw-theme {
79
- &[mdw-surface]:not([mdw-ink]) {
80
- --mdw-ink: #{getThemeValue("default-ink", $type)};
81
- --mdw-ink-opacity: #{getThemeValue("high-ink-opacity", $type)};
82
- color: RGBA(var(--mdw-ink),var(--mdw-ink-opacity));
83
- }
84
-
85
- &[mdw-surface="white"] {
86
- --mdw-surface: 255,255,255;
87
- }
88
-
89
- &[mdw-surface="black"] {
90
- --mdw-surface: 0,0,0;
91
- }
92
-
93
- &[mdw-surface="binary"] {
94
- --mdw-surface: #{getThemeValue("binary-surface", $type)};
95
- }
96
-
97
- &[mdw-surface="card"] {
98
- --mdw-surface: #{getThemeValue("card-surface", $type)};
99
- }
100
-
101
- @each $surface in $sortedSurfaces {
102
- &[mdw-surface~="#{$surface}"] {
103
- --mdw-surface: #{getThemeValue("#{$surface}-default-surface", $type)};
104
- }
105
- }
106
-
107
- @each $surface in $sortedSurfaces {
108
- &[mdw-surface~="#{$surface}"] {
109
- $palette: theme.getThemeParamValue($surface);
110
- @each $tone in theme.$surface-tones {
111
- $value: map-get($palette, $tone);
112
- --#{$tone}-surface: #{red($value),green($value),blue($value)};
113
- }
114
- }
115
- }
116
-
117
- @each $surface in $sortedSurfaces {
118
- &[mdw-surface="#{$surface} alt"] {
119
- --mdw-surface: #{getThemeValue("#{$surface}-alt-surface", $type)};
120
- }
121
- }
122
-
123
- @each $tone in theme.$surface-tones {
124
- &[mdw-surface~="#{$tone}"] {
125
- --mdw-surface: var(--#{$tone}-surface);
126
- }
127
- }
128
-
129
- /** Ink Color **/
130
-
131
- &[mdw-ink] {
132
- --mdw-ink: #{getThemeValue("default-ink", $type)};
133
- --mdw-ink-opacity: 1;
134
- color: RGBA(var(--mdw-ink),var(--mdw-ink-opacity));
135
- }
136
-
137
- &[mdw-ink=""],
138
- &[mdw-ink~="default"] {
139
- --mdw-ink: #{getThemeValue("default-ink", $type)};
140
- --mdw-ink-opacity: #{getThemeValue("high-ink-opacity", $type)};
141
- }
142
-
143
- &[mdw-ink~="white"] {
144
- --mdw-ink: 255,255,255;
145
- }
146
-
147
- &[mdw-ink~="black"] {
148
- --mdw-ink: 0,0,0;
149
- }
150
-
151
- @each $ink in $sortedInks {
152
- &[mdw-ink~="#{$ink}"] {
153
- --mdw-ink: #{getThemeValue("#{$ink}-default-ink", $type)};
154
- }
155
- }
156
-
157
- @each $ink in $sortedInks {
158
- &[mdw-ink~="#{$ink}"] {
159
- $palette: theme.getThemeParamValue($ink);
160
- @each $tone in theme.$ink-tones {
161
- $value: map-get($palette, $tone);
162
- --mdw-ink-#{$tone}: #{red($value),green($value),blue($value)};
163
- }
164
- }
165
- }
166
-
167
- @each $ink in $sortedInks {
168
- &[mdw-ink^="#{$ink} contrast"] {
169
- --mdw-ink: #{getThemeValue("#{$ink}-contrast-ink", $type)};
170
- }
171
- }
172
-
173
- @each $ink in $sortedInks {
174
- @if ($ink != 'background') {
175
- &[mdw-ink^="#{$ink} light"] {
176
- --mdw-ink: #{getThemeValue("#{$ink}-light-ink", $type)};
177
- }
178
- }
179
- }
180
-
181
- @each $tone in theme.$ink-tones {
182
- &[mdw-ink~="#{$tone}"] {
183
- --mdw-ink: var(--mdw-ink-#{$tone});
184
- }
185
- }
186
-
187
- /** Ink Opacity **/
188
-
189
- &[mdw-ink~="solid"] {
190
- --mdw-ink-opacity: 1;
191
- }
192
-
193
- &[mdw-ink~="high"] {
194
- --mdw-ink-opacity: #{getThemeValue("high-ink-opacity", $type)};
195
- }
196
-
197
- &[mdw-ink~="medium"] {
198
- --mdw-ink-opacity: #{getThemeValue("medium-ink-opacity", $type)};
199
- }
200
-
201
- &[mdw-ink~="inactive"] {
202
- --mdw-ink-opacity: #{getThemeValue("inactive-ink-opacity", $type)};
203
- }
204
-
205
- &[mdw-ink~="divider"] {
206
- --mdw-ink-opacity: #{getThemeValue("divider-ink-opacity", $type)};
207
- }
208
-
209
- /** Border Ink **/
210
-
211
- &[mdw-border-ink] {
212
- border-color: #{RGBA(var(--mdw-ink), getThemeValue("divider-ink-opacity", $type))};
213
- }
214
-
215
- &[mdw-border-ink="default"] {
216
- border-color: #{RGBA(getThemeValue("default-ink", $type), getThemeValue("divider-ink-opacity", $type))};
217
- }
218
-
219
- &[mdw-border-ink="none"] {
220
- border-color: transparent;
221
- }
222
- }
223
- } @else {
224
- & {
225
- &[mdw-ink="default"],
226
- &[mdw-surface]:not([mdw-ink]) {
227
- color: RGBA(getThemeValue("default-ink", $type),getThemeValue("high-ink-opacity", $type));
228
- }
229
-
230
- &[mdw-surface="binary"] {
231
- background-color: RGB(getThemeValue("binary-surface", $type));
232
- }
233
-
234
- &[mdw-surface="card"] {
235
- background-color: RGB(getThemeValue("card-surface", $type));
236
- }
237
-
238
- @each $surface in $sortedSurfaces {
239
- &[mdw-surface="#{$surface}"] {
240
- background-color: RGB(getThemeValue("#{$surface}-default-surface", $type));
241
- }
242
- }
243
-
244
- @each $surface in $sortedSurfaces {
245
- &[mdw-surface="#{$surface} alt"] {
246
- background-color: RGB(getThemeValue("#{$surface}-alt-surface", $type));
247
- }
248
- }
249
-
250
- &[mdw-ink~="solid"] {
251
- color: RGB(getThemeValue("default-ink", $type));
252
- }
253
-
254
- &[mdw-ink~="high"] {
255
- color: RGBA(getThemeValue("default-ink", $type),getThemeValue("high-ink-opacity", $type));
256
- }
257
-
258
- &[mdw-ink~="medium"] {
259
- color: RGBA(getThemeValue("default-ink", $type),getThemeValue("medium-ink-opacity", $type));
260
- }
261
-
262
- &[mdw-ink~="inactive"] {
263
- color: RGBA(getThemeValue("default-ink", $type),getThemeValue("inactive-ink-opacity", $type));
264
- }
265
-
266
- &[mdw-ink~="divider"] {
267
- color: RGBA(getThemeValue("default-ink", $type),getThemeValue("divider-ink-opacity", $type));
268
- }
269
-
270
- @each $ink in $sortedInks {
271
- &[mdw-ink="#{$ink}"] {
272
- &,
273
- &.mdw-overlay::before {
274
- color: RGB(getThemeValue("#{$ink}-default-ink", $type));
275
- }
276
- }
277
- }
278
-
279
- @each $ink in $sortedInks {
280
- &[mdw-ink="#{$ink} contrast"] {
281
- &,
282
- &.mdw-overlay::before {
283
- color: RGB(getThemeValue("#{$ink}-contrast-ink", $type));
284
- }
285
- }
286
- }
287
-
288
- @each $ink in $sortedInks {
289
- &[mdw-ink="#{$ink} light"] {
290
- &,
291
- &.mdw-overlay::before {
292
- color: RGB(getThemeValue("#{$ink}-light-ink", $type));
293
- }
294
- }
295
- }
296
-
297
- &[mdw-border-ink],
298
- &[mdw-border-ink="default"] {
299
- border-color: RGBA(getThemeValue("default-ink", $type), getThemeValue("divider-ink-opacity", $type));
300
- }
301
-
302
- &[mdw-border-ink="none"] {
303
- border-color: transparent;
304
- }
305
- }
306
- }
307
- }
308
-
309
- @mixin addThemeFallbackRules() {
310
- .mdw-theme[mdw-surface="white"] {
311
- background-color: #fff;
312
- }
313
-
314
- .mdw-theme[mdw-surface="black"] {
315
- background-color: #000;
316
- }
317
-
318
- @each $surface in $sortedSurfaces {
319
- $palette: theme.getThemeParamValue($surface);
320
- @each $tone in theme.$surface-tones {
321
- $value: map-get($palette, $tone);
322
-
323
- .mdw-theme[mdw-surface="#{$surface} #{$tone}"] {
324
- background-color: #{$value};
325
- }
326
- }
327
- }
328
-
329
- /** Ink Fallback Colors **/
330
-
331
- .mdw-theme[mdw-ink~="white"] {
332
- &,
333
- &.mdw-overlay::before {
334
- color: #fff;
335
- }
336
- }
337
-
338
- .mdw-theme[mdw-ink~="black"] {
339
- &,
340
- &.mdw-overlay::before {
341
- color: #000;
342
- }
343
- }
344
-
345
- @each $tone in theme.$surface-tones {
346
- @each $surface in $sortedSurfaces {
347
- $palette: theme.getThemeParamValue($surface);
348
- $value: map-get($palette, $tone);
349
-
350
- .mdw-theme[mdw-surface^="#{$surface} #{$tone}"] {
351
- background-color: #{$value};
352
- }
353
- }
354
- }
355
-
356
- @each $tone in theme.$ink-tones {
357
- @each $ink in $sortedInks {
358
- $palette: theme.getThemeParamValue($ink);
359
- $value: map-get($palette, $tone);
360
- .mdw-theme[mdw-ink^="#{$ink} #{$tone}"] {
361
- &,
362
- &.mdw-overlay::before {
363
- color: #{$value};
364
- }
365
- }
366
- }
367
- }
368
-
369
- .mdw-theme[mdw-light],
370
- .mdw-theme[mdw-light] .mdw-theme:not([mdw-dark]) {
371
- @include addThemeRules('light');
372
- }
373
-
374
- .mdw-theme[mdw-dark],
375
- .mdw-theme[mdw-dark] .mdw-theme:not([mdw-light]) {
376
- @include addThemeRules('dark');
377
- }
378
- }
379
-
380
- @if (theme.$fallbacks == 'ieonly') {
381
- @include platform.ifIE() {
382
- @include addThemeFallbackRules();
383
- }
384
- } @else if (theme.$fallbacks != false) {
385
- @include addThemeFallbackRules();
386
- }
387
-
388
- @include theme.addComponentCSSVariableRules('color', $themeValues) {
389
- @include addThemeRules();
390
- }
@@ -1,2 +0,0 @@
1
- @forward './_spec.scss';
2
- @forward './_theme.scss';
@@ -1,172 +0,0 @@
1
- @forward './_variables.scss';
2
- @forward './_palettes.scss';
3
-
4
- @use '../_platform.scss' as platform;
5
- @use './_variables.scss' as variables;
6
- @use './_palettes.scss' as palettes;
7
-
8
- @mixin _addCSSVariables($component, $map, $lightness) {
9
- @each $key in map-keys($map) {
10
- $item: _getThemeMapItem($map, $key, $lightness);
11
- $value: null;
12
- $length: length($item);
13
- @if ($length == 1) {
14
- @if (type_of($item) == color) {
15
- $value: red($item),green($item),blue($item);
16
- } @else {
17
- $value: $item;
18
- }
19
- } @else if ($length == 2) {
20
- $color: nth($item, 1);
21
- $opacity: nth($item, 2);
22
- @if (type_of($color) == string) {
23
- $color: _getThemeParamColor($color);
24
- }
25
- $value: red($color),green($color),blue($color),$opacity;
26
- } @else {
27
- $color: nth($item, 1);
28
- $tone: nth($item, 2);
29
- $opacity: nth($item, 3);
30
- @if ($tone == null) {
31
- @error '$tone cannot be null';
32
- }
33
- @if ($color == null) {
34
- $value: var(--#{$tone}-color);
35
- } @else {
36
- @if (type_of($color) == string) {
37
- $color: _getThemeParamColor($color, $tone);
38
- }
39
- @if ($opacity == null) {
40
- $value: red($color),green($color),blue($color);
41
- } @else {
42
- $value: red($color),green($color),blue($color),$opacity;
43
- }
44
- }
45
- }
46
- --mdw-#{$component}__#{$key}: #{$value};
47
- }
48
- }
49
-
50
- @mixin _addComponentCSSVariableRules($component, $values) {
51
- :root,
52
- .mdw-theme[mdw-light] {
53
- @include _addCSSVariables($component, $values, 'light');
54
- }
55
-
56
- .mdw-theme[mdw-dark] {
57
- @include _addCSSVariables($component, $values, 'dark');
58
- }
59
- }
60
-
61
- @mixin addComponentCSSVariableRules($component, $values) {
62
- @if (variables.$cssvars == 'supports') {
63
- @supports(--v:v) {
64
- @content;
65
- @include _addComponentCSSVariableRules($component, $values);
66
- }
67
- } @else if (variables.$cssvars != false) {
68
- @content;
69
- @include _addComponentCSSVariableRules($component, $values);
70
- }
71
- }
72
-
73
- @mixin addComponentFallbackRules($lightness) {
74
- @if (variables.$fallbacks == 'ieonly') {
75
- @include platform.ifIE() {
76
- @include fallbackWrapper($lightness) {
77
- @content;
78
- }
79
- }
80
- } @else if (variables.$fallbacks != false) {
81
- @include fallbackWrapper($lightness) {
82
- @content;
83
- }
84
- }
85
- }
86
-
87
- @function getThemeParamValue($param) {
88
- @if ($param == 'primary') {
89
- @return map-get(palettes.$palettes, variables.$primary);
90
- } @else if ($param == 'secondary') {
91
- @return map-get(palettes.$palettes, variables.$secondary);
92
- } @else if ($param == 'warn') {
93
- @return map-get(palettes.$palettes, variables.$warn);
94
- } @else if ($param == 'background') {
95
- @return map-get(palettes.$palettes, variables.$background);
96
- } @else if ($param == 'foreground-light') {
97
- @return nth(variables.$foreground, 1);
98
- } @else if ($param == 'foreground-dark') {
99
- @return nth(variables.$foreground, length(variables.$foreground));
100
- } @else {
101
- @return map-get(palettes.$palettes, $param);
102
- }
103
- }
104
-
105
- @function _getThemeParamColor($param, $tone: null) {
106
- $paramValue: getThemeParamValue($param);
107
- @if (($param == 'foreground-light') or ($param == 'foreground-dark')) {
108
- @return $paramValue;
109
- }
110
- @return map-get($paramValue, $tone);
111
- }
112
-
113
- @function _getThemeMapItem($colorMap, $key, $lightness) {
114
- $list: map-get($colorMap, $key);
115
- $length: length($list);
116
-
117
- @if ($lightness == 'dark') {
118
- @if ($length > 1) {
119
- @return nth($list, 2);
120
- } @else {
121
- @error 'Variable not found' $key;
122
- }
123
- }
124
- @return nth($list, 1);
125
- }
126
-
127
- @function getThemeValue($component, $colorMap, $key, $type) {
128
- @if ($type == 'var') {
129
- @return var(--mdw-#{$component}__#{$key});
130
- }
131
- $item: _getThemeMapItem($colorMap, $key, $type);
132
- $length: length($item);
133
- @if ($length == 1) {
134
- @if (type_of($item) == color) {
135
- @return red($item),green($item),blue($item);
136
- }
137
- @return $item;
138
- } @else if ($length == 2) {
139
- $color: nth($item, 1);
140
- $opacity: nth($item, 2);
141
- @if (type_of($color) == string) {
142
- $color: _getThemeParamColor($color);
143
- }
144
- @return red($color),green($color),blue($color),$opacity;
145
- } @else {
146
- $color: nth($item, 1);
147
- $tone: nth($item, 2);
148
- $opacity: nth($item, 3);
149
- $value: _getThemeParamColor($color, $tone);
150
- @if ($opacity == null) {
151
- @return red($value),green($value),blue($value);
152
- }
153
- @return red($value),green($value),blue($value),$opacity;
154
- }
155
- @return null;
156
- }
157
-
158
- @mixin fallbackWrapper($scope) {
159
- @if ($scope == 'global') {
160
- @content;
161
- } @else if ($scope == 'light') {
162
- .mdw-theme[mdw-light],
163
- .mdw-theme[mdw-dark] .mdw-theme[mdw-light] {
164
- @content;
165
- }
166
- } @else if ($scope == 'dark') {
167
- .mdw-theme[mdw-dark],
168
- .mdw-theme[mdw-light] .mdw-theme[mdw-dark] {
169
- @content;
170
- }
171
- }
172
- }
@@ -1,24 +0,0 @@
1
- $fallbacks: 'ieonly' !default;
2
- $cssvars: 'supports' !default;
3
-
4
- $inks: ('primary', 'secondary', 'warn') !default;
5
- $surfaces: ('primary', 'secondary', 'warn', 'background') !default;
6
- $ink-tones: ("A100", "A200", "A400", "A700") !default;
7
- $surface-tones: ("50", "100", "200", "300", "400", "500", "600", "700", "800", "900") !default;
8
- $primary: 'blue' !default;
9
- $secondary: 'pink' !default;
10
- $warn: 'red' !default;
11
- $background: 'gray' !default;
12
- $foreground: (#000, #fff) !default;
13
-
14
- $high-opacity: (0.87, 1.00) !default;
15
- $medium-opacity: (0.60, 0.70) !default;
16
- $inactive-opacity: (0.38, 0.50) !default;
17
- $divider-opacity: (0.12, 0.24) !default;
18
-
19
- $default-color-surface: ('50', '900') !default;
20
- $alt-color-surface: ('100', '800') !default;
21
-
22
- $default-color-ink: ('A700', 'A200') !default;
23
- $contrast-color-ink: ('A700', 'A100') !default;
24
- $light-color-ink: ('A400', 'A100') !default;