@ng-matero/extensions 16.1.3 → 16.3.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 (147) hide show
  1. package/_index.scss +0 -3
  2. package/_theming.scss +0 -3
  3. package/alert/_alert-theme.scss +12 -28
  4. package/alert/alert.scss +28 -0
  5. package/colorpicker/_colorpicker-theme.scss +20 -8
  6. package/colorpicker/colorpicker-toggle.scss +23 -17
  7. package/column-resize/column-resize-notifier.d.ts +1 -1
  8. package/column-resize/polyfill.d.ts +1 -3
  9. package/column-resize/resizable.d.ts +1 -0
  10. package/column-resize/resize-strategy.d.ts +4 -3
  11. package/core/style/_sass-utils.scss +49 -0
  12. package/core/theming/_all-theme.scss +0 -2
  13. package/core/tokens/_token-utils.scss +127 -0
  14. package/core/tokens/m2/_index.scss +49 -0
  15. package/core/tokens/m2/mdc/_plain-tooltip.scss +72 -0
  16. package/core/tokens/m2/mtx/_alert.scss +55 -0
  17. package/core/tokens/m2/mtx/_colorpicker.scss +55 -0
  18. package/core/tokens/m2/mtx/_datetimepicker.scss +155 -0
  19. package/core/tokens/m2/mtx/_drawer.scss +45 -0
  20. package/core/tokens/m2/mtx/_grid.scss +57 -0
  21. package/core/tokens/m2/mtx/_loader.scss +45 -0
  22. package/core/tokens/m2/mtx/_popover.scss +46 -0
  23. package/core/tokens/m2/mtx/_progress.scss +56 -0
  24. package/core/tokens/m2/mtx/_select.scss +83 -0
  25. package/core/tokens/m2/mtx/_split.scss +54 -0
  26. package/core/typography/_typography.scss +203 -36
  27. package/datetimepicker/_datetimepicker-theme.scss +31 -183
  28. package/datetimepicker/calendar-body.scss +81 -1
  29. package/datetimepicker/calendar.scss +33 -3
  30. package/datetimepicker/clock.scss +50 -10
  31. package/datetimepicker/datetimepicker-content.scss +12 -0
  32. package/datetimepicker/datetimepicker-toggle.scss +23 -17
  33. package/datetimepicker/time.scss +41 -1
  34. package/drawer/_drawer-theme.scss +6 -10
  35. package/drawer/drawer-container.scss +11 -0
  36. package/esm2022/alert/alert.mjs +4 -4
  37. package/esm2022/colorpicker/colorpicker-toggle.mjs +2 -2
  38. package/esm2022/column-resize/column-resize-directives/column-resize-flex.mjs +3 -9
  39. package/esm2022/column-resize/column-resize-directives/column-resize.mjs +3 -9
  40. package/esm2022/column-resize/column-resize-directives/constants.mjs +1 -1
  41. package/esm2022/column-resize/column-resize-notifier.mjs +7 -2
  42. package/esm2022/column-resize/column-resize.mjs +3 -3
  43. package/esm2022/column-resize/event-dispatcher.mjs +5 -2
  44. package/esm2022/column-resize/polyfill.mjs +3 -19
  45. package/esm2022/column-resize/resizable.mjs +7 -7
  46. package/esm2022/column-resize/resize-ref.mjs +1 -1
  47. package/esm2022/column-resize/resize-strategy.mjs +16 -10
  48. package/esm2022/datetimepicker/calendar-body.mjs +2 -2
  49. package/esm2022/datetimepicker/calendar.mjs +3 -3
  50. package/esm2022/datetimepicker/clock.mjs +2 -2
  51. package/esm2022/datetimepicker/datetimepicker-toggle.mjs +2 -2
  52. package/esm2022/datetimepicker/datetimepicker.mjs +3 -3
  53. package/esm2022/datetimepicker/time.mjs +3 -3
  54. package/esm2022/drawer/drawer-container.mjs +3 -3
  55. package/esm2022/grid/cell.mjs +3 -19
  56. package/esm2022/grid/column-resize/column-resize-directives/common.mjs +1 -8
  57. package/esm2022/grid/column-resize/overlay-handle.mjs +11 -6
  58. package/esm2022/grid/column-resize/resizable-directives/common.mjs +1 -1
  59. package/esm2022/grid/column-resize/resizable-directives/resizable.mjs +3 -2
  60. package/esm2022/grid/column-resize/resize-strategy.mjs +10 -5
  61. package/esm2022/grid/grid-module.mjs +13 -9
  62. package/esm2022/grid/grid-utils.mjs +1 -9
  63. package/esm2022/grid/grid.mjs +28 -21
  64. package/esm2022/loader/loader.mjs +2 -2
  65. package/esm2022/photoviewer/mtxPhotoviewer.mjs +5 -0
  66. package/esm2022/photoviewer/photoviewer-module.mjs +17 -0
  67. package/esm2022/photoviewer/photoviewer.mjs +63 -0
  68. package/esm2022/photoviewer/public-api.mjs +3 -0
  69. package/esm2022/popover/popover-interfaces.mjs +1 -1
  70. package/esm2022/popover/popover.mjs +13 -3
  71. package/esm2022/progress/progress.mjs +4 -4
  72. package/esm2022/select/select.mjs +11 -3
  73. package/esm2022/split/split.mjs +2 -2
  74. package/esm2022/tooltip/tooltip.mjs +2 -2
  75. package/fesm2022/mtxAlert.mjs +3 -3
  76. package/fesm2022/mtxAlert.mjs.map +1 -1
  77. package/fesm2022/mtxColorpicker.mjs +2 -2
  78. package/fesm2022/mtxColorpicker.mjs.map +1 -1
  79. package/fesm2022/mtxColumnResize.mjs +38 -52
  80. package/fesm2022/mtxColumnResize.mjs.map +1 -1
  81. package/fesm2022/mtxDatetimepicker.mjs +12 -12
  82. package/fesm2022/mtxDatetimepicker.mjs.map +1 -1
  83. package/fesm2022/mtxDrawer.mjs +2 -2
  84. package/fesm2022/mtxDrawer.mjs.map +1 -1
  85. package/fesm2022/mtxGrid.mjs +188 -197
  86. package/fesm2022/mtxGrid.mjs.map +1 -1
  87. package/fesm2022/mtxLoader.mjs +2 -2
  88. package/fesm2022/mtxLoader.mjs.map +1 -1
  89. package/fesm2022/mtxPhotoviewer.mjs +84 -0
  90. package/fesm2022/mtxPhotoviewer.mjs.map +1 -0
  91. package/fesm2022/mtxPopover.mjs +12 -2
  92. package/fesm2022/mtxPopover.mjs.map +1 -1
  93. package/fesm2022/mtxProgress.mjs +3 -3
  94. package/fesm2022/mtxProgress.mjs.map +1 -1
  95. package/fesm2022/mtxSelect.mjs +10 -2
  96. package/fesm2022/mtxSelect.mjs.map +1 -1
  97. package/fesm2022/mtxSplit.mjs +2 -2
  98. package/fesm2022/mtxSplit.mjs.map +1 -1
  99. package/fesm2022/mtxTooltip.mjs +2 -2
  100. package/fesm2022/mtxTooltip.mjs.map +1 -1
  101. package/grid/_grid-theme.scss +14 -86
  102. package/grid/cell.d.ts +0 -2
  103. package/grid/cell.scss +0 -1
  104. package/grid/column-resize/_column-resize.scss +88 -94
  105. package/grid/column-resize/column-resize-directives/common.d.ts +0 -7
  106. package/grid/column-resize/overlay-handle.d.ts +1 -0
  107. package/grid/column-resize/resize-strategy.d.ts +2 -2
  108. package/grid/grid-module.d.ts +4 -4
  109. package/grid/grid-utils.d.ts +0 -6
  110. package/grid/grid.d.ts +10 -7
  111. package/grid/grid.scss +103 -15
  112. package/loader/_loader-theme.scss +6 -6
  113. package/loader/loader.scss +7 -0
  114. package/package.json +25 -25
  115. package/{slider → photoviewer}/index.d.ts +1 -1
  116. package/photoviewer/photoviewer-module.d.ts +7 -0
  117. package/photoviewer/photoviewer.d.ts +17 -0
  118. package/photoviewer/public-api.d.ts +2 -0
  119. package/popover/_popover-theme.scss +6 -40
  120. package/popover/popover-interfaces.d.ts +1 -0
  121. package/popover/popover.d.ts +6 -1
  122. package/popover/popover.scss +36 -2
  123. package/prebuilt-themes/deeppurple-amber.css +1 -1
  124. package/prebuilt-themes/indigo-pink.css +1 -1
  125. package/prebuilt-themes/pink-bluegrey.css +1 -1
  126. package/prebuilt-themes/purple-green.css +1 -1
  127. package/progress/_progress-theme.scss +6 -25
  128. package/progress/progress.scss +42 -0
  129. package/select/_select-theme.scss +19 -133
  130. package/select/select.d.ts +1 -0
  131. package/select/select.scss +147 -36
  132. package/split/_split-theme.scss +21 -18
  133. package/split/split.scss +13 -0
  134. package/tooltip/_tooltip-theme.scss +19 -24
  135. package/tooltip/tooltip.scss +18 -17
  136. package/esm2022/slider/mtxSlider.mjs +0 -5
  137. package/esm2022/slider/public-api.mjs +0 -3
  138. package/esm2022/slider/slider-module.mjs +0 -19
  139. package/esm2022/slider/slider.mjs +0 -1115
  140. package/fesm2022/mtxSlider.mjs +0 -1137
  141. package/fesm2022/mtxSlider.mjs.map +0 -1
  142. package/slider/_slider-theme.import.scss +0 -2
  143. package/slider/_slider-theme.scss +0 -232
  144. package/slider/public-api.d.ts +0 -2
  145. package/slider/slider-module.d.ts +0 -9
  146. package/slider/slider.d.ts +0 -277
  147. package/slider/slider.scss +0 -514
package/_index.scss CHANGED
@@ -1,5 +1,3 @@
1
- @forward 'photoviewer';
2
-
3
1
  @forward './alert/alert-theme' as alert-* show alert-theme;
4
2
  @forward './button/button-theme' as button-* show button-theme;
5
3
  @forward './colorpicker/colorpicker-theme' as colorpicker-* show colorpicker-theme;
@@ -10,7 +8,6 @@
10
8
  @forward './popover/popover-theme' as popover-* show popover-theme;
11
9
  @forward './progress/progress-theme' as progress-* show progress-theme;
12
10
  @forward './select/select-theme' as select-* show select-theme;
13
- @forward './slider/slider-theme' as slider-* show slider-theme;
14
11
  @forward './split/split-theme' as split-* show split-theme;
15
12
  @forward './tooltip/tooltip-theme' as tooltip-* show tooltip-theme;
16
13
 
package/_theming.scss CHANGED
@@ -1,5 +1,3 @@
1
- @forward 'photoviewer';
2
-
3
1
  @forward './alert/alert-theme.import';
4
2
  @forward './button/button-theme.import';
5
3
  @forward './colorpicker/colorpicker-theme.import';
@@ -10,7 +8,6 @@
10
8
  @forward './popover/popover-theme.import';
11
9
  @forward './progress/progress-theme.import';
12
10
  @forward './select/select-theme.import';
13
- @forward './slider/slider-theme.import';
14
11
  @forward './split/split-theme.import';
15
12
  @forward './tooltip/tooltip-theme.import';
16
13
 
@@ -1,33 +1,14 @@
1
- @use 'sass:map';
1
+ @use '../core/style/sass-utils';
2
2
  @use '../core/theming/theming';
3
- @use '../core/theming/palette';
3
+ @use '../core/tokens/token-utils';
4
+ @use '../core/tokens/m2/mtx/alert' as tokens-mtx-alert;
4
5
 
5
6
  @mixin color($config-or-theme) {
6
7
  $config: theming.get-color-config($config-or-theme);
7
- $background: map.get($config, background);
8
8
 
9
- .mtx-alert {
10
- background-color: theming.get-color-from-palette($background, card);
11
- }
12
-
13
- .mtx-alert-info.mtx-alert {
14
- background-color: theming.get-color-from-palette(palette.$blue-palette, 500);
15
- color: white;
16
- }
17
-
18
- .mtx-alert-success.mtx-alert {
19
- background-color: theming.get-color-from-palette(palette.$green-palette, 500);
20
- color: white;
21
- }
22
-
23
- .mtx-alert-warning.mtx-alert {
24
- background-color: theming.get-color-from-palette(palette.$orange-palette, 500);
25
- color: white;
26
- }
27
-
28
- .mtx-alert-danger.mtx-alert {
29
- background-color: theming.get-color-from-palette(palette.$red-palette, 500);
30
- color: white;
9
+ @include sass-utils.current-selector-or-root() {
10
+ @include token-utils.create-token-values(tokens-mtx-alert.$prefix,
11
+ tokens-mtx-alert.get-color-tokens($config));
31
12
  }
32
13
  }
33
14
 
@@ -37,18 +18,21 @@
37
18
 
38
19
  @mixin theme($theme-or-color-config) {
39
20
  $theme: theming.private-legacy-get-theme($theme-or-color-config);
21
+
40
22
  @include theming.private-check-duplicate-theme-styles($theme, 'mtx-alert') {
41
23
  $color: theming.get-color-config($theme);
42
24
  $density: theming.get-density-config($theme);
43
25
  $typography: theming.get-typography-config($theme);
44
26
 
45
- @if $color != null {
27
+ @if $color !=null {
46
28
  @include color($color);
47
29
  }
48
- @if $density != null {
30
+
31
+ @if $density !=null {
49
32
  @include density($density);
50
33
  }
51
- @if $typography != null {
34
+
35
+ @if $typography !=null {
52
36
  @include typography($typography);
53
37
  }
54
38
  }
package/alert/alert.scss CHANGED
@@ -1,3 +1,6 @@
1
+ @use '../core/tokens/token-utils';
2
+ @use '../core/tokens/m2/mtx/alert' as tokens-mtx-alert;
3
+
1
4
  .mtx-alert {
2
5
  position: relative;
3
6
  display: block;
@@ -5,6 +8,31 @@
5
8
  margin-bottom: 1rem;
6
9
  border: 1px solid transparent;
7
10
  border-radius: .25rem;
11
+
12
+ @include token-utils.use-tokens(tokens-mtx-alert.$prefix, tokens-mtx-alert.get-token-slots()) {
13
+ @include token-utils.create-token-slot(background-color, background-color);
14
+ @include token-utils.create-token-slot(color, text-color);
15
+
16
+ &.mtx-alert-info {
17
+ @include token-utils.create-token-slot(background-color, info-background-color);
18
+ @include token-utils.create-token-slot(color, info-text-color);
19
+ }
20
+
21
+ &.mtx-alert-success {
22
+ @include token-utils.create-token-slot(background-color, success-background-color);
23
+ @include token-utils.create-token-slot(color, success-text-color);
24
+ }
25
+
26
+ &.mtx-alert-warning {
27
+ @include token-utils.create-token-slot(background-color, warning-background-color);
28
+ @include token-utils.create-token-slot(color, warning-text-color);
29
+ }
30
+
31
+ &.mtx-alert-danger {
32
+ @include token-utils.create-token-slot(background-color, danger-background-color);
33
+ @include token-utils.create-token-slot(color, danger-text-color);
34
+ }
35
+ }
8
36
  }
9
37
 
10
38
  .mtx-alert-close {
@@ -1,20 +1,29 @@
1
+ @use 'sass:color';
1
2
  @use 'sass:map';
2
3
  @use '../core/theming/theming';
3
- @use '../core/theming/palette';
4
+ @use '../core/typography/typography';
5
+ @use '../core/style/sass-utils';
6
+ @use '../core/tokens/token-utils';
7
+ @use '../core/tokens/m2/mtx/colorpicker' as tokens-mtx-colorpicker;
4
8
 
5
9
  @mixin color($config-or-theme) {
6
10
  $config: theming.get-color-config($config-or-theme);
7
11
  $background: map.get($config, background);
8
12
 
9
- .mtx-colorpicker-toggle-active {
10
- color: theming.get-color-from-palette(map.get($config, primary), text);
13
+ @include sass-utils.current-selector-or-root() {
14
+ @include token-utils.create-token-values(tokens-mtx-colorpicker.$prefix,
15
+ tokens-mtx-colorpicker.get-color-tokens($config));
16
+ }
11
17
 
18
+ .mtx-colorpicker-toggle-active {
12
19
  &.mat-accent {
13
- color: theming.get-color-from-palette(map.get($config, accent), text);
20
+ $accent-tokens: tokens-mtx-colorpicker.private-get-toggle-color-palette-color-tokens($config, accent);
21
+ @include token-utils.create-token-values(tokens-mtx-colorpicker.$prefix, $accent-tokens);
14
22
  }
15
23
 
16
24
  &.mat-warn {
17
- color: theming.get-color-from-palette(map.get($config, warn), text);
25
+ $warn-tokens: tokens-mtx-colorpicker.private-get-toggle-color-palette-color-tokens($config, warn);
26
+ @include token-utils.create-token-values(tokens-mtx-colorpicker.$prefix, $warn-tokens);
18
27
  }
19
28
  }
20
29
  }
@@ -25,18 +34,21 @@
25
34
 
26
35
  @mixin theme($theme-or-color-config) {
27
36
  $theme: theming.private-legacy-get-theme($theme-or-color-config);
37
+
28
38
  @include theming.private-check-duplicate-theme-styles($theme, 'mtx-colorpicker') {
29
39
  $color: theming.get-color-config($theme);
30
40
  $density: theming.get-density-config($theme);
31
41
  $typography: theming.get-typography-config($theme);
32
42
 
33
- @if $color != null {
43
+ @if $color !=null {
34
44
  @include color($color);
35
45
  }
36
- @if $density != null {
46
+
47
+ @if $density !=null {
37
48
  @include density($density);
38
49
  }
39
- @if $typography != null {
50
+
51
+ @if $typography !=null {
40
52
  @include typography($typography);
41
53
  }
42
54
  }
@@ -1,23 +1,29 @@
1
- .mat-form-field-appearance-legacy {
2
- .mat-form-field-prefix,
3
- .mat-form-field-suffix {
4
- .mtx-colorpicker-toggle-default-icon {
5
- width: 1em;
6
- }
1
+ @use '@angular/cdk';
2
+ @use '../core/tokens/token-utils';
3
+ @use '../core/tokens/m2/mtx/colorpicker' as tokens-mtx-colorpicker;
4
+
5
+ $_tokens: tokens-mtx-colorpicker.$prefix, tokens-mtx-colorpicker.get-token-slots();
6
+
7
+ // We support the case where the form field is disabled, but the datepicker is not.
8
+ // MDC sets `pointer-events: none` on disabled form fields which prevents clicks on the toggle.
9
+ .mtx-colorpicker-toggle {
10
+ pointer-events: auto;
11
+
12
+ @include token-utils.use-tokens($_tokens...) {
13
+ @include token-utils.create-token-slot(color, toggle-icon-color);
7
14
  }
8
15
  }
9
16
 
10
- .mat-form-field:not(.mat-form-field-appearance-legacy) {
11
- .mat-form-field-prefix,
12
- .mat-form-field-suffix {
13
- .mtx-colorpicker-toggle-default-icon {
14
- display: block;
15
- width: 1.5em;
16
- height: 1.5em;
17
- }
17
+ .mtx-colorpicker-toggle-active {
18
+ @include token-utils.use-tokens($_tokens...) {
19
+ @include token-utils.create-token-slot(color, toggle-active-state-icon-color);
20
+ }
21
+ }
18
22
 
19
- .mat-icon-button .mtx-colorpicker-toggle-default-icon {
20
- margin: auto;
21
- }
23
+ @include cdk.high-contrast(active, off) {
24
+ .mtx-colorpicker-toggle-default-icon {
25
+ // On Chromium-based browsers the icon doesn't appear to inherit the text color in high
26
+ // contrast mode so we have to set it explicitly. This is a no-op on IE and Firefox.
27
+ color: CanvasText;
22
28
  }
23
29
  }
@@ -14,7 +14,7 @@ export interface ColumnSizeAction extends ColumnSize {
14
14
  /**
15
15
  * Whether the resize action should be applied instantaneously. False for events triggered during
16
16
  * a UI-triggered resize (such as with the mouse) until the mouse button is released. True
17
- * for all programatically triggered resizes.
17
+ * for all programmatically triggered resizes.
18
18
  */
19
19
  readonly completeImmediately?: boolean;
20
20
  /**
@@ -5,7 +5,5 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
- /** IE 11 compatible matches implementation. */
9
- export declare function matches(element: Element, selector: string): boolean;
10
- /** IE 11 compatible closest implementation that is able to start from non-Element Nodes. */
8
+ /** closest implementation that is able to start from non-Element Nodes. */
11
9
  export declare function closest(element: EventTarget | Element | null | undefined, selector: string): Element | null;
@@ -35,6 +35,7 @@ export declare abstract class Resizable<HandleComponent extends ResizeOverlayHan
35
35
  protected abstract readonly viewContainerRef: ViewContainerRef;
36
36
  protected abstract readonly changeDetectorRef: ChangeDetectorRef;
37
37
  private _viewInitialized;
38
+ private _isDestroyed;
38
39
  /** The minimum width to allow the column to be sized to. */
39
40
  get minWidthPx(): number;
40
41
  set minWidthPx(value: number);
@@ -30,7 +30,7 @@ export declare abstract class ResizeStrategy {
30
30
  static ɵprov: i0.ɵɵInjectableDeclaration<ResizeStrategy>;
31
31
  }
32
32
  /**
33
- * The optimially performing resize strategy for &lt;table&gt; elements with table-layout: fixed.
33
+ * The optimally performing resize strategy for &lt;table&gt; elements with table-layout: fixed.
34
34
  * Tested against and outperformed:
35
35
  * CSS selector
36
36
  * CSS selector w/ CSS variable
@@ -57,6 +57,7 @@ export declare class CdkFlexTableResizeStrategy extends ResizeStrategy implement
57
57
  protected readonly columnResize: ColumnResize;
58
58
  protected readonly styleScheduler: _CoalescedStyleScheduler;
59
59
  protected readonly table: CdkTable<unknown>;
60
+ private readonly _nonce?;
60
61
  private readonly _document;
61
62
  private readonly _columnIndexes;
62
63
  private readonly _columnProperties;
@@ -64,7 +65,7 @@ export declare class CdkFlexTableResizeStrategy extends ResizeStrategy implement
64
65
  private _indexSequence;
65
66
  protected readonly defaultMinSize = 0;
66
67
  protected readonly defaultMaxSize: number;
67
- constructor(columnResize: ColumnResize, styleScheduler: _CoalescedStyleScheduler, table: CdkTable<unknown>, document: any);
68
+ constructor(columnResize: ColumnResize, styleScheduler: _CoalescedStyleScheduler, table: CdkTable<unknown>, document: any, _nonce?: string | null | undefined);
68
69
  applyColumnSize(cssFriendlyColumnName: string, columnHeader: HTMLElement, sizeInPx: number, previousSizeInPx?: number): void;
69
70
  applyMinColumnSize(cssFriendlyColumnName: string, _: HTMLElement, sizeInPx: number): void;
70
71
  applyMaxColumnSize(cssFriendlyColumnName: string, _: HTMLElement, sizeInPx: number): void;
@@ -76,7 +77,7 @@ export declare class CdkFlexTableResizeStrategy extends ResizeStrategy implement
76
77
  private _getStyleSheet;
77
78
  private _getColumnPropertiesMap;
78
79
  private _applySizeCss;
79
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkFlexTableResizeStrategy, never>;
80
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkFlexTableResizeStrategy, [null, null, null, null, { optional: true; }]>;
80
81
  static ɵprov: i0.ɵɵInjectableDeclaration<CdkFlexTableResizeStrategy>;
81
82
  }
82
83
  export declare const TABLE_LAYOUT_FIXED_RESIZE_STRATEGY_PROVIDER: Provider;
@@ -0,0 +1,49 @@
1
+ @use 'sass:map';
2
+ @use 'sass:meta';
3
+
4
+ /// Include content under the current selector (&) or the document root if there is no current
5
+ /// selector.
6
+ /// @param {String} $root [html] The default root selector to use when there is no current selector.
7
+ /// @output The given content under the current selector, or root selector if there is no current
8
+ /// selector.
9
+ /// @content Content to output under the current selector, or root selector if there is no current
10
+ /// selector.
11
+ @mixin current-selector-or-root($root: html) {
12
+ @at-root #{& or $root} {
13
+ @content;
14
+ }
15
+ }
16
+
17
+ /// A version of the standard `map.merge` function that takes a variable number of arguments.
18
+ /// Each argument is merged into the final result from left to right.
19
+ /// @param {List} $maps The maps to combine with map.merge
20
+ /// @return {Map} The combined result of successively calling map.merge with each parameter.
21
+ @function merge-all($maps...) {
22
+ $result: ();
23
+ @each $map in $maps {
24
+ $result: map.merge($result, $map);
25
+ }
26
+ @return $result;
27
+ }
28
+
29
+ /// A version of the standard `map.deep-merge` function that takes a variable number of arguments.
30
+ /// Each argument is deep-merged into the final result from left to right.
31
+ /// @param {List} $maps The maps to combine with map.deep-merge
32
+ /// @return {Map} The combined result of successively calling map.deep-merge with each parameter.
33
+ @function deep-merge-all($maps...) {
34
+ $result: ();
35
+ @each $map in $maps {
36
+ $result: map.deep-merge($result, $map);
37
+ }
38
+ @return $result;
39
+ }
40
+
41
+ /// Coerces the given value to a list, by converting any non-list value into a single-item list.
42
+ /// This should be used when dealing with user-passed lists of args to avoid confusing errors,
43
+ /// since Sass treats `($x)` as equivalent to `$x`.
44
+ /// @param {Any} $value The value to coerce to a list.
45
+ /// @return {List} The original $value if it was a list, otherwise a single-item list containing
46
+ /// $value.
47
+ @function coerce-to-list($value) {
48
+ @return if(meta.type-of($value) != 'list', ($value,), $value);
49
+ }
@@ -9,7 +9,6 @@
9
9
  @use '../../popover/popover-theme';
10
10
  @use '../../progress/progress-theme';
11
11
  @use '../../select/select-theme';
12
- @use '../../slider/slider-theme';
13
12
  @use '../../split/split-theme';
14
13
  @use '../../tooltip/tooltip-theme';
15
14
  @use './theming';
@@ -28,7 +27,6 @@
28
27
  @include popover-theme.theme($theme-or-color-config);
29
28
  @include progress-theme.theme($theme-or-color-config);
30
29
  @include select-theme.theme($theme-or-color-config);
31
- @include slider-theme.theme($theme-or-color-config);
32
30
  @include split-theme.theme($theme-or-color-config);
33
31
  @include tooltip-theme.theme($theme-or-color-config);
34
32
  }
@@ -0,0 +1,127 @@
1
+ @use 'sass:map';
2
+ @use '@material/elevation/elevation-theme' as mdc-elevation-theme;
3
+ @use '@material/theme/custom-properties' as mdc-custom-properties;
4
+ @use '@material/theme/theme' as mdc-theme;
5
+ @use '@material/theme/keys' as mdc-keys;
6
+ @use '../theming/palette';
7
+ @use '../theming/theming';
8
+ @use '../typography/typography';
9
+
10
+ $_placeholder-color-palette: theming.define-palette(palette.$red-palette);
11
+
12
+ // Placeholder color config that can be passed to token getter functions when generating token
13
+ // slots.
14
+ $placeholder-color-config: (
15
+ primary: $_placeholder-color-palette,
16
+ accent: $_placeholder-color-palette,
17
+ warn: $_placeholder-color-palette,
18
+ is-dark: false,
19
+ foreground: palette.$light-theme-foreground-palette,
20
+ background: palette.$light-theme-background-palette,
21
+ );
22
+
23
+ $_placeholder-typography-level-config: typography.typography-config-level-from-mdc(body1);
24
+
25
+ // Placeholder typography config that can be passed to token getter functions when generating token
26
+ // slots.
27
+ $placeholder-typography-config: (
28
+ font-family: 'Roboto, sans-serif',
29
+ headline-1: $_placeholder-typography-level-config,
30
+ headline-2: $_placeholder-typography-level-config,
31
+ headline-3: $_placeholder-typography-level-config,
32
+ headline-4: $_placeholder-typography-level-config,
33
+ headline-5: $_placeholder-typography-level-config,
34
+ headline-6: $_placeholder-typography-level-config,
35
+ subtitle-1: $_placeholder-typography-level-config,
36
+ subtitle-2: $_placeholder-typography-level-config,
37
+ body-1: $_placeholder-typography-level-config,
38
+ body-2: $_placeholder-typography-level-config,
39
+ caption: $_placeholder-typography-level-config,
40
+ button: $_placeholder-typography-level-config,
41
+ overline: $_placeholder-typography-level-config,
42
+ subheading-1: $_placeholder-typography-level-config,
43
+ title: $_placeholder-typography-level-config,
44
+ );
45
+
46
+ // Placeholder density config that can be passed to token getter functions when generating token
47
+ // slots.
48
+ $placeholder-density-config: 0;
49
+
50
+ $_tokens: null;
51
+ $_component-prefix: null;
52
+
53
+ @mixin _configure-token-prefix($first, $rest...) {
54
+ $_component-prefix: '' !global;
55
+ @each $item in $rest {
56
+ $_component-prefix:
57
+ if($_component-prefix == '', $item, '#{$_component-prefix}-#{$item}') !global;
58
+ }
59
+ @include mdc-custom-properties.configure($varname-prefix: $first) {
60
+ @content;
61
+ }
62
+ $_component-prefix: null !global;
63
+ }
64
+
65
+ // Sets the token prefix and map to use when creating token slots.
66
+ @mixin use-tokens($prefix, $tokens) {
67
+ $_tokens: $tokens !global;
68
+ @include _configure-token-prefix($prefix...) {
69
+ @content;
70
+ }
71
+ $_tokens: null !global;
72
+ }
73
+
74
+ // Emits a slot for the given token, provided that it has a non-null value in the token map passed
75
+ // to `use-tokens`.
76
+ @mixin create-token-slot($property, $token, $emit-fallback: false) {
77
+ @if $_component-prefix == null or $_tokens == null {
78
+ @error '`create-token-slot` must be used within `use-tokens`';
79
+ }
80
+ @if not map.has-key($_tokens, $token) {
81
+ @error 'Token #{$token} does not exist. Configured tokens are: #{map.keys($_tokens)}';
82
+ }
83
+ @if map.get($_tokens, $token) != null {
84
+ $fallback: null;
85
+
86
+ @if ($emit-fallback == true) {
87
+ $fallback: map.get($_tokens, $token);
88
+ }
89
+ @else if ($emit-fallback) {
90
+ $fallback: $emit-fallback;
91
+ }
92
+
93
+ $value: mdc-custom-properties.create('#{$_component-prefix}-#{$token}', $fallback: $fallback);
94
+ @include mdc-theme.property($property, $value);
95
+ }
96
+ }
97
+
98
+ // Returns the name of a token including the current prefix. Intended to be used in calculations
99
+ // involving tokens. `create-token-slot` should be used when outputting tokens.
100
+ @function get-token-variable($token) {
101
+ @if $_component-prefix == null or $_tokens == null {
102
+ @error '`get-token-variable` must be used within `use-tokens`';
103
+ }
104
+ @if not map.has-key($_tokens, $token) {
105
+ @error 'Token #{$token} does not exist. Configured tokens are: #{map.keys($_tokens)}';
106
+ }
107
+
108
+ @return mdc-custom-properties.create-varname('#{$_component-prefix}-#{$token}');
109
+ }
110
+
111
+ @mixin create-token-values($prefix, $tokens) {
112
+ @include _configure-token-prefix($prefix...) {
113
+ @include mdc-keys.declare-custom-properties($tokens, $_component-prefix);
114
+ }
115
+ }
116
+
117
+ // MDC doesn't currently handle elevation tokens properly. As a temporary workaround we can combine
118
+ // the elevation and shadow-color tokens into a full box-shadow and use it as the value for the
119
+ // elevation token.
120
+ @function resolve-elevation($tokens, $elevation-token, $shadow-color-token) {
121
+ $elevation: map.get($tokens, $elevation-token);
122
+ $shadow-color: map.get($tokens, $shadow-color-token);
123
+ @return map.merge($tokens, (
124
+ $elevation-token: mdc-elevation-theme.elevation-box-shadow($elevation, $shadow-color),
125
+ $shadow-color-token: null,
126
+ ));
127
+ }
@@ -0,0 +1,49 @@
1
+ @use 'sass:map';
2
+ @use 'sass:meta';
3
+ @use '../../style/sass-utils';
4
+
5
+ /// Gets the tokens for the given theme, m2 tokens module, and theming system.
6
+ /// @param {Map} $theme The Angular Material theme object to generate token values from.
7
+ /// @param {String} $module The Sass module containing the token getter functions.
8
+ /// @param {String} $system The theming system to get tokens for. Valid values are: unthemable,
9
+ /// color, typography, density.
10
+ /// @return {Map} The token map by calling the token getter for the given system in the given module
11
+ /// with the given Angular Material theme. Token names are not fully-qualified.
12
+ @function _get-tokens-for-module-and-system($theme, $module, $system) {
13
+ @if $system == unthemable {
14
+ @return meta.call(
15
+ meta.get-function(get-#{$system}-tokens, $module: $module));
16
+ }
17
+ @if not map.get($theme, $system) {
18
+ @return ();
19
+ }
20
+ @return meta.call(
21
+ meta.get-function(get-#{$system}-tokens, $module: $module), map.get($theme, $system));
22
+ }
23
+
24
+ /// Gets the fully qualified tokens map for the given theme and m2 tokens module.
25
+ /// @param {Map} $theme The Angular Material theme object to generate token values from.
26
+ /// @param {String} $module The Sass module containing the token getter functions.
27
+ /// @return {Map} The token map by calling the token getters in the given module with the given
28
+ /// Angular Material theme. Token names are fully-qualified.
29
+ @function _get-tokens-for-module($theme, $module) {
30
+ $tokens: sass-utils.deep-merge-all(
31
+ _get-tokens-for-module-and-system($theme, $module, unthemable),
32
+ _get-tokens-for-module-and-system($theme, $module, color),
33
+ _get-tokens-for-module-and-system($theme, $module, typography),
34
+ _get-tokens-for-module-and-system($theme, $module, density));
35
+ @return map.set((), map.get(meta.module-variables($module), prefix), $tokens);
36
+ }
37
+
38
+ /// Gets the full set of M2 tokens for the given theme object.
39
+ /// @param {Map} $theme The Angular Material theme object to generate token values from.
40
+ /// @return {Map} The token map for the given Angular Material theme. Returned format:
41
+ /// (
42
+ /// (fully, qualified, namespace): (
43
+ /// token: value
44
+ /// )
45
+ /// )
46
+ @function m2-tokens-from-theme($theme) {
47
+ @return sass-utils.deep-merge-all(
48
+ );
49
+ }
@@ -0,0 +1,72 @@
1
+ @use 'sass:map';
2
+ @use '../../../theming/theming';
3
+ @use '../../../typography/typography-utils';
4
+ @use '../../../mdc-helpers/mdc-helpers';
5
+ @use '../../../style/sass-utils';
6
+ @use '../../token-utils';
7
+
8
+ // The prefix used to generate the fully qualified name for tokens in this file.
9
+ $prefix: (mdc, plain-tooltip);
10
+
11
+ // Tokens that can't be configured through Angular Material's current theming API,
12
+ // but may be in a future version of the theming API.
13
+ //
14
+ // Tokens that are available in MDC, but not used in Angular Material should be mapped to `null`.
15
+ // `null` indicates that we are intentionally choosing not to emit a slot or value for the token in
16
+ // our CSS.
17
+ @function get-unthemable-tokens() {
18
+ @return ( // Border radius for the tooltip container.
19
+ container-shape: 4px,
20
+ // Line height of the tooltip text.
21
+ supporting-text-line-height: 16px,
22
+ // MDC does not seem to use these token.
23
+ supporting-text-type: null,
24
+ );
25
+ }
26
+
27
+ // Tokens that can be configured through Angular Material's color theming API.
28
+ @function get-color-tokens($config) {
29
+ $background: map.get($config, background);
30
+
31
+ @return ( // Color of the tooltip container.
32
+ container-color: theming.get-color-from-palette($background, tooltip),
33
+ // Color of the tooltip text.
34
+ supporting-text-color: #fff,
35
+ );
36
+ }
37
+
38
+ // Tokens that can be configured through Angular Material's typography theming API.
39
+ @function get-typography-tokens($config) {
40
+
41
+ // TODO(amysorto): The earlier implementation of the tooltip used MDC's APIs to create the
42
+ // typography tokens. As a result, we unintentionally allowed `null` typography configs to be
43
+ // passed in. Since there a lot of apps that now depend on this pattern, we need this temporary
44
+ // fallback.
45
+ @if ($config ==null) {
46
+ $config: mdc-helpers.private-fallback-typography-from-mdc();
47
+ }
48
+
49
+ @return ( // Font for the tooltip text.
50
+ supporting-text-font: typography-utils.font-family($config, caption) or typography-utils.font-family($config),
51
+ // Font size for the tooltip text.
52
+ supporting-text-size: typography-utils.font-size($config, caption),
53
+ // Font weight of the tooltip text.
54
+ supporting-text-weight: typography-utils.font-weight($config, caption),
55
+ // Tracking (space between letters) of the tooltip text.
56
+ supporting-text-tracking: typography-utils.letter-spacing($config, caption),
57
+ );
58
+ }
59
+
60
+ // Tokens that can be configured through Angular Material's density theming API.
61
+ @function get-density-tokens($config) {
62
+ @return ();
63
+ }
64
+
65
+ // Combines the tokens generated by the above functions into a single map with placeholder values.
66
+ // This is used to create token slots.
67
+ @function get-token-slots() {
68
+ @return sass-utils.deep-merge-all(get-unthemable-tokens(),
69
+ get-color-tokens(token-utils.$placeholder-color-config),
70
+ get-typography-tokens(token-utils.$placeholder-typography-config),
71
+ get-density-tokens(token-utils.$placeholder-density-config));
72
+ }