@ng-matero/extensions 17.3.4 → 18.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. package/README.md +11 -0
  2. package/_index.scss +6 -0
  3. package/alert/_alert-theme.scss +2 -3
  4. package/colorpicker/_colorpicker-theme.scss +2 -3
  5. package/colorpicker/colorpicker.d.ts +4 -4
  6. package/{experimental/theming/_color-api-back-compat.scss → core/theming/_color-api-backwards-compatibility.scss} +1 -1
  7. package/{experimental → core}/theming/_config-validation.scss +11 -5
  8. package/{experimental → core}/theming/_definition.scss +4 -2
  9. package/core/theming/prebuilt/azure-blue.scss +26 -0
  10. package/core/theming/prebuilt/cyan-orange.scss +26 -0
  11. package/core/theming/prebuilt/deeppurple-amber.scss +4 -4
  12. package/core/theming/prebuilt/indigo-pink.scss +4 -4
  13. package/core/theming/prebuilt/magenta-violet.scss +26 -0
  14. package/core/theming/prebuilt/pink-bluegrey.scss +4 -4
  15. package/core/theming/prebuilt/purple-green.scss +4 -4
  16. package/core/theming/prebuilt/rose-red.scss +26 -0
  17. package/{experimental/theming/_m3-density.scss → core/tokens/_density.scss} +0 -1
  18. package/core/tokens/_m3-tokens.scss +350 -0
  19. package/core/tokens/_token-utils.scss +164 -40
  20. package/core/tokens/m2/_index.scss +2 -3
  21. package/core/tokens/m2/mdc/_plain-tooltip.scss +1 -2
  22. package/core/tokens/m2/mtx/_alert.scss +5 -6
  23. package/core/tokens/m2/mtx/_colorpicker.scss +2 -3
  24. package/core/tokens/m2/mtx/_datetimepicker.scss +7 -8
  25. package/core/tokens/m2/mtx/_drawer.scss +3 -2
  26. package/core/tokens/m2/mtx/_grid.scss +4 -3
  27. package/core/tokens/m2/mtx/_loader.scss +2 -3
  28. package/core/tokens/m2/mtx/_popover.scss +1 -2
  29. package/core/tokens/m2/mtx/_progress.scss +5 -6
  30. package/core/tokens/m2/mtx/_select.scss +3 -2
  31. package/core/tokens/m2/mtx/_split.scss +2 -3
  32. package/core/tokens/m3/index.scss +45 -0
  33. package/core/tokens/m3/mtx/_alert.scss +31 -0
  34. package/core/tokens/m3/mtx/_colorpicker.scss +19 -0
  35. package/{experimental/theming/_custom-tokens.scss → core/tokens/m3/mtx/_datetimepicker.scss} +15 -191
  36. package/core/tokens/m3/mtx/_drawer.scss +22 -0
  37. package/core/tokens/m3/mtx/_grid.scss +34 -0
  38. package/core/tokens/m3/mtx/_loader.scss +22 -0
  39. package/core/tokens/m3/mtx/_popover.scss +22 -0
  40. package/core/tokens/m3/mtx/_progress.scss +31 -0
  41. package/core/tokens/m3/mtx/_select.scss +72 -0
  42. package/core/tokens/m3/mtx/_split.scss +30 -0
  43. package/datetimepicker/_datetimepicker-theme.scss +3 -4
  44. package/datetimepicker/calendar-body.scss +2 -2
  45. package/datetimepicker/calendar.d.ts +1 -0
  46. package/datetimepicker/datetimepicker-content.scss +0 -2
  47. package/datetimepicker/datetimepicker.d.ts +4 -4
  48. package/drawer/_drawer-theme.scss +2 -3
  49. package/drawer/drawer-container.scss +1 -2
  50. package/esm2022/alert/alert-module.mjs +4 -4
  51. package/esm2022/alert/alert.mjs +3 -3
  52. package/esm2022/button/button-loading.mjs +3 -3
  53. package/esm2022/button/button-module.mjs +4 -4
  54. package/esm2022/checkbox-group/checkbox-group-module.mjs +4 -4
  55. package/esm2022/checkbox-group/checkbox-group.mjs +3 -3
  56. package/esm2022/colorpicker/colorpicker-input.mjs +3 -3
  57. package/esm2022/colorpicker/colorpicker-module.mjs +4 -4
  58. package/esm2022/colorpicker/colorpicker-toggle.mjs +6 -6
  59. package/esm2022/colorpicker/colorpicker.mjs +14 -12
  60. package/esm2022/column-resize/column-resize-directives/column-resize-flex.mjs +3 -3
  61. package/esm2022/column-resize/column-resize-directives/column-resize.mjs +3 -3
  62. package/esm2022/column-resize/column-resize-module.mjs +4 -4
  63. package/esm2022/column-resize/column-resize-notifier.mjs +6 -6
  64. package/esm2022/column-resize/column-resize.mjs +3 -3
  65. package/esm2022/column-resize/column-size-store.mjs +3 -3
  66. package/esm2022/column-resize/event-dispatcher.mjs +3 -3
  67. package/esm2022/column-resize/overlay-handle.mjs +3 -3
  68. package/esm2022/column-resize/resizable.mjs +3 -3
  69. package/esm2022/column-resize/resize-strategy.mjs +9 -9
  70. package/esm2022/core/datetime/datetime.module.mjs +8 -8
  71. package/esm2022/core/datetime/native-datetime-adapter.mjs +3 -3
  72. package/esm2022/core/pipes/is-template-ref.pipe.mjs +3 -3
  73. package/esm2022/core/pipes/pipes.module.mjs +4 -4
  74. package/esm2022/core/pipes/to-observable.pipe.mjs +3 -3
  75. package/esm2022/datetimepicker/calendar-body.mjs +3 -3
  76. package/esm2022/datetimepicker/calendar.mjs +9 -14
  77. package/esm2022/datetimepicker/clock.mjs +5 -5
  78. package/esm2022/datetimepicker/datetimepicker-input.mjs +3 -3
  79. package/esm2022/datetimepicker/datetimepicker-intl.mjs +3 -3
  80. package/esm2022/datetimepicker/datetimepicker-module.mjs +4 -4
  81. package/esm2022/datetimepicker/datetimepicker-toggle.mjs +6 -6
  82. package/esm2022/datetimepicker/datetimepicker.mjs +15 -13
  83. package/esm2022/datetimepicker/month-view.mjs +3 -3
  84. package/esm2022/datetimepicker/multi-year-view.mjs +3 -3
  85. package/esm2022/datetimepicker/time.mjs +6 -6
  86. package/esm2022/datetimepicker/year-view.mjs +3 -3
  87. package/esm2022/dialog/dialog-container.mjs +3 -3
  88. package/esm2022/dialog/dialog-module.mjs +4 -4
  89. package/esm2022/dialog/dialog.mjs +3 -3
  90. package/esm2022/drawer/drawer-container.mjs +5 -5
  91. package/esm2022/drawer/drawer-module.mjs +4 -4
  92. package/esm2022/drawer/drawer.mjs +3 -3
  93. package/esm2022/grid/cell.mjs +3 -3
  94. package/esm2022/grid/column-menu.mjs +5 -5
  95. package/esm2022/grid/column-resize/column-resize-directives/column-resize-flex.mjs +3 -3
  96. package/esm2022/grid/column-resize/column-resize-directives/column-resize.mjs +3 -3
  97. package/esm2022/grid/column-resize/column-resize-module.mjs +8 -8
  98. package/esm2022/grid/column-resize/overlay-handle.mjs +3 -3
  99. package/esm2022/grid/column-resize/resizable-directives/resizable.mjs +3 -3
  100. package/esm2022/grid/column-resize/resize-strategy.mjs +3 -3
  101. package/esm2022/grid/expansion-toggle.mjs +3 -3
  102. package/esm2022/grid/grid-module.mjs +4 -4
  103. package/esm2022/grid/grid-pipes.mjs +21 -21
  104. package/esm2022/grid/grid-utils.mjs +3 -3
  105. package/esm2022/grid/grid.mjs +3 -3
  106. package/esm2022/grid/selectable-cell.mjs +3 -3
  107. package/esm2022/loader/loader-module.mjs +4 -4
  108. package/esm2022/loader/loader.mjs +3 -3
  109. package/esm2022/photoviewer/photoviewer-module.mjs +4 -4
  110. package/esm2022/photoviewer/photoviewer.mjs +3 -3
  111. package/esm2022/popover/popover-content.mjs +6 -6
  112. package/esm2022/popover/popover-module.mjs +4 -4
  113. package/esm2022/popover/popover-target.mjs +3 -3
  114. package/esm2022/popover/popover-trigger.mjs +6 -8
  115. package/esm2022/popover/popover.mjs +6 -6
  116. package/esm2022/progress/progress-module.mjs +4 -4
  117. package/esm2022/progress/progress.mjs +3 -3
  118. package/esm2022/select/option.mjs +3 -3
  119. package/esm2022/select/select-module.mjs +4 -4
  120. package/esm2022/select/select.mjs +37 -24
  121. package/esm2022/select/templates.mjs +33 -33
  122. package/esm2022/split/split-module.mjs +4 -4
  123. package/esm2022/split/split-pane.mjs +37 -28
  124. package/esm2022/split/split.mjs +55 -49
  125. package/esm2022/split/utils.mjs +1 -4
  126. package/esm2022/tooltip/tooltip-module.mjs +4 -4
  127. package/esm2022/tooltip/tooltip.mjs +6 -6
  128. package/fesm2022/mtxAlert.mjs +7 -7
  129. package/fesm2022/mtxButton.mjs +7 -7
  130. package/fesm2022/mtxCheckboxGroup.mjs +7 -7
  131. package/fesm2022/mtxColorpicker.mjs +27 -25
  132. package/fesm2022/mtxColorpicker.mjs.map +1 -1
  133. package/fesm2022/mtxColumnResize.mjs +40 -40
  134. package/fesm2022/mtxCore.mjs +21 -21
  135. package/fesm2022/mtxDatetimepicker.mjs +61 -63
  136. package/fesm2022/mtxDatetimepicker.mjs.map +1 -1
  137. package/fesm2022/mtxDialog.mjs +10 -10
  138. package/fesm2022/mtxDrawer.mjs +13 -13
  139. package/fesm2022/mtxDrawer.mjs.map +1 -1
  140. package/fesm2022/mtxGrid.mjs +68 -68
  141. package/fesm2022/mtxGrid.mjs.map +1 -1
  142. package/fesm2022/mtxLoader.mjs +7 -7
  143. package/fesm2022/mtxPhotoviewer.mjs +7 -7
  144. package/fesm2022/mtxPopover.mjs +24 -26
  145. package/fesm2022/mtxPopover.mjs.map +1 -1
  146. package/fesm2022/mtxProgress.mjs +7 -7
  147. package/fesm2022/mtxSelect.mjs +76 -63
  148. package/fesm2022/mtxSelect.mjs.map +1 -1
  149. package/fesm2022/mtxSplit.mjs +92 -80
  150. package/fesm2022/mtxSplit.mjs.map +1 -1
  151. package/fesm2022/mtxTooltip.mjs +12 -12
  152. package/grid/_grid-theme.scss +3 -4
  153. package/grid/column-menu.scss +15 -9
  154. package/grid/grid.scss +2 -2
  155. package/loader/_loader-theme.scss +2 -3
  156. package/package.json +14 -14
  157. package/popover/_popover-theme.scss +2 -3
  158. package/popover/popover.d.ts +2 -2
  159. package/prebuilt-themes/azure-blue.css +1 -0
  160. package/prebuilt-themes/cyan-orange.css +1 -0
  161. package/prebuilt-themes/deeppurple-amber.css +1 -1
  162. package/prebuilt-themes/indigo-pink.css +1 -1
  163. package/prebuilt-themes/magenta-violet.css +1 -0
  164. package/prebuilt-themes/pink-bluegrey.css +1 -1
  165. package/prebuilt-themes/purple-green.css +1 -1
  166. package/prebuilt-themes/rose-red.css +1 -0
  167. package/progress/_progress-theme.scss +3 -4
  168. package/select/_select-theme.scss +3 -4
  169. package/select/select.d.ts +17 -2
  170. package/select/select.scss +2 -4
  171. package/split/_split-theme.scss +2 -3
  172. package/split/split-pane.d.ts +29 -13
  173. package/split/split.d.ts +44 -20
  174. package/split/utils.d.ts +0 -1
  175. package/tooltip/_tooltip-theme.scss +4 -5
  176. package/core/style/_sass-utils.scss +0 -80
  177. package/experimental/_index.scss +0 -5
  178. package/experimental/theming/_m3-tokens.scss +0 -308
  179. /package/{experimental/theming → core/tokens}/_format-tokens.scss +0 -0
@@ -189,8 +189,7 @@ $_tokens: tokens-mtx-select.$prefix, tokens-mtx-select.get-token-slots();
189
189
 
190
190
  @include token-utils.create-token-slot(border-bottom-left-radius, container-shape);
191
191
  @include token-utils.create-token-slot(border-bottom-right-radius, container-shape);
192
-
193
- @include mat.elevation(8);
192
+ @include token-utils.create-token-slot(box-shadow, container-elevation-shadow);
194
193
  }
195
194
 
196
195
  &.ng-select-top {
@@ -198,8 +197,7 @@ $_tokens: tokens-mtx-select.$prefix, tokens-mtx-select.get-token-slots();
198
197
 
199
198
  @include token-utils.create-token-slot(border-top-left-radius, container-shape);
200
199
  @include token-utils.create-token-slot(border-top-right-radius, container-shape);
201
-
202
- @include mat.elevation(8);
200
+ @include token-utils.create-token-slot(box-shadow, container-elevation-shadow);
203
201
  }
204
202
 
205
203
  .ng-dropdown-header,
@@ -1,6 +1,5 @@
1
1
  @use 'sass:map';
2
2
  @use '@angular/material' as mat;
3
- @use '../core/style/sass-utils';
4
3
  @use '../core/theming/inspection';
5
4
  @use '../core/theming/validation';
6
5
  @use '../core/tokens/token-utils';
@@ -11,7 +10,7 @@
11
10
  @include _theme-from-tokens(inspection.get-theme-tokens($theme, base));
12
11
  }
13
12
  @else {
14
- @include sass-utils.current-selector-or-root() {
13
+ @include mat.private-current-selector-or-root() {
15
14
  @include token-utils.create-token-values(tokens-mtx-split.$prefix,
16
15
  tokens-mtx-split.get-unthemable-tokens());
17
16
  }
@@ -23,7 +22,7 @@
23
22
  @include _theme-from-tokens(inspection.get-theme-tokens($theme, color), $options...);
24
23
  }
25
24
  @else {
26
- @include sass-utils.current-selector-or-root() {
25
+ @include mat.private-current-selector-or-root() {
27
26
  @include token-utils.create-token-values(tokens-mtx-split.$prefix,
28
27
  tokens-mtx-split.get-color-tokens($theme));
29
28
  }
@@ -1,4 +1,4 @@
1
- import { ElementRef, Renderer2, OnInit, OnDestroy, NgZone } from '@angular/core';
1
+ import { ElementRef, NgZone, OnDestroy, OnInit, Renderer2 } from '@angular/core';
2
2
  import { MtxSplit } from './split';
3
3
  import * as i0 from "@angular/core";
4
4
  export declare class MtxSplitPane implements OnInit, OnDestroy {
@@ -6,24 +6,38 @@ export declare class MtxSplitPane implements OnInit, OnDestroy {
6
6
  elRef: ElementRef;
7
7
  private renderer;
8
8
  private split;
9
- private _order;
10
- set order(v: number | null);
9
+ /**
10
+ * Order of the area. Used to maintain the order of areas when toggling their visibility.
11
+ * Toggling area visibility without specifying an `order` leads to weird behavior.
12
+ */
11
13
  get order(): number | null;
12
- private _size;
13
- set size(v: number | null);
14
+ set order(v: number | null);
15
+ private _order;
16
+ /**
17
+ * Size of the area in selected unit (percent/pixel).
18
+ * - Percent: All areas sizes should equal to `100`, If not, all areas will have the same size.
19
+ * - Pixel: An area with wildcard size (`size="*"`) is mandatory (only one) and
20
+ * can't have `visible="false"` or `minSize`/`maxSize`/`lockSize` properties.
21
+ */
14
22
  get size(): number | null;
15
- private _minSize;
16
- set minSize(v: number | null);
23
+ set size(v: number | null);
24
+ private _size;
25
+ /** Minimum pixel or percent size, should be equal to or smaller than provided `size`. */
17
26
  get minSize(): number | null;
18
- private _maxSize;
19
- set maxSize(v: number | null);
27
+ set minSize(v: number | null);
28
+ private _minSize;
29
+ /** Maximum pixel or percent size, should be equal to or larger than provided `size`. */
20
30
  get maxSize(): number | null;
21
- private _lockSize;
22
- set lockSize(v: boolean);
31
+ set maxSize(v: number | null);
32
+ private _maxSize;
33
+ /** Lock area size, same as `minSize`=`maxSize`=`size`. */
23
34
  get lockSize(): boolean;
24
- private _visible;
25
- set visible(v: boolean);
35
+ set lockSize(v: boolean);
36
+ private _lockSize;
37
+ /** Hide area visually but still present in the DOM, use `ngIf` to completely remove it. */
26
38
  get visible(): boolean;
39
+ set visible(v: boolean);
40
+ private _visible;
27
41
  private transitionListener;
28
42
  private readonly lockListeners;
29
43
  constructor(ngZone: NgZone, elRef: ElementRef, renderer: Renderer2, split: MtxSplit);
@@ -35,4 +49,6 @@ export declare class MtxSplitPane implements OnInit, OnDestroy {
35
49
  ngOnDestroy(): void;
36
50
  static ɵfac: i0.ɵɵFactoryDeclaration<MtxSplitPane, never>;
37
51
  static ɵdir: i0.ɵɵDirectiveDeclaration<MtxSplitPane, "mtx-split-pane, [mtx-split-pane]", ["mtxSplitPane"], { "order": { "alias": "order"; "required": false; }; "size": { "alias": "size"; "required": false; }; "minSize": { "alias": "minSize"; "required": false; }; "maxSize": { "alias": "maxSize"; "required": false; }; "lockSize": { "alias": "lockSize"; "required": false; }; "visible": { "alias": "visible"; "required": false; }; }, {}, never, never, true, never>;
52
+ static ngAcceptInputType_lockSize: unknown;
53
+ static ngAcceptInputType_visible: unknown;
38
54
  }
package/split/split.d.ts CHANGED
@@ -42,39 +42,60 @@ export declare class MtxSplit implements AfterViewInit, OnDestroy {
42
42
  private renderer;
43
43
  protected _defaultOptions?: MtxSplitDefaultOptions | undefined;
44
44
  color: ThemePalette;
45
- private _direction;
46
- set direction(v: 'horizontal' | 'vertical');
45
+ /** The split direction. */
47
46
  get direction(): 'horizontal' | 'vertical';
48
- private _unit;
49
- set unit(v: 'percent' | 'pixel');
47
+ set direction(v: 'horizontal' | 'vertical');
48
+ private _direction;
49
+ /** The unit you want to specify area sizes. */
50
50
  get unit(): 'percent' | 'pixel';
51
- private _gutterSize;
52
- set gutterSize(v: number);
51
+ set unit(v: 'percent' | 'pixel');
52
+ private _unit;
53
+ /** Gutters's size (dragging elements) in pixels. */
53
54
  get gutterSize(): number;
54
- private _gutterStep;
55
- set gutterStep(v: number);
55
+ set gutterSize(v: number);
56
+ private _gutterSize;
57
+ /** Gutter step while moving in pixels. */
56
58
  get gutterStep(): number;
57
- private _restrictMove;
58
- set restrictMove(v: boolean);
59
- get restrictMove(): boolean;
60
- private _useTransition;
61
- set useTransition(v: boolean);
59
+ set gutterStep(v: number);
60
+ private _gutterStep;
61
+ /** Set to true if you want to limit gutter move to adjacent areas only. */
62
+ restrictMove: boolean;
63
+ /** Add transition when toggling visibility using `visible` or `size` changes. */
62
64
  get useTransition(): boolean;
63
- private _disabled;
64
- set disabled(v: boolean);
65
+ set useTransition(v: boolean);
66
+ private _useTransition;
67
+ /**
68
+ * Disable the dragging feature (remove cursor/image on gutters).
69
+ * `gutterClick`/`gutterDblClick` still emits.
70
+ */
65
71
  get disabled(): boolean;
66
- private _dir;
67
- set dir(v: 'ltr' | 'rtl');
72
+ set disabled(v: boolean);
73
+ private _disabled;
74
+ /** Indicates the directionality of the areas. */
68
75
  get dir(): 'ltr' | 'rtl';
69
- private _gutterDblClickDuration;
70
- set gutterDblClickDuration(v: number);
76
+ set dir(v: 'ltr' | 'rtl');
77
+ private _dir;
78
+ /**
79
+ * Milliseconds to detect a double click on a gutter. Set it around 300-500ms if
80
+ * you want to use `gutterDblClick` event.
81
+ */
71
82
  get gutterDblClickDuration(): number;
83
+ set gutterDblClickDuration(v: number);
84
+ private _gutterDblClickDuration;
85
+ /** Event emitted when drag starts. */
72
86
  dragStart: EventEmitter<MtxSplitOutputData>;
87
+ /** Event emitted when drag ends. */
73
88
  dragEnd: EventEmitter<MtxSplitOutputData>;
89
+ /** Event emitted when user clicks on a gutter. */
74
90
  gutterClick: EventEmitter<MtxSplitOutputData>;
91
+ /** Event emitted when user double clicks on a gutter. */
75
92
  gutterDblClick: EventEmitter<MtxSplitOutputData>;
76
- private transitionEndSubscriber;
93
+ /**
94
+ * Event emitted when transition ends (could be triggered from `visible` or `size` changes).
95
+ * Only if `useTransition` equals true.
96
+ */
77
97
  get transitionEnd(): Observable<MtxSplitOutputAreaSizes>;
98
+ private transitionEndSubscriber;
78
99
  private dragProgressSubject;
79
100
  dragProgress$: Observable<MtxSplitOutputData>;
80
101
  private isDragging;
@@ -106,4 +127,7 @@ export declare class MtxSplit implements AfterViewInit, OnDestroy {
106
127
  ngOnDestroy(): void;
107
128
  static ɵfac: i0.ɵɵFactoryDeclaration<MtxSplit, [null, null, null, null, { optional: true; }]>;
108
129
  static ɵcmp: i0.ɵɵComponentDeclaration<MtxSplit, "mtx-split", ["mtxSplit"], { "color": { "alias": "color"; "required": false; }; "direction": { "alias": "direction"; "required": false; }; "unit": { "alias": "unit"; "required": false; }; "gutterSize": { "alias": "gutterSize"; "required": false; }; "gutterStep": { "alias": "gutterStep"; "required": false; }; "restrictMove": { "alias": "restrictMove"; "required": false; }; "useTransition": { "alias": "useTransition"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "dir": { "alias": "dir"; "required": false; }; "gutterDblClickDuration": { "alias": "gutterDblClickDuration"; "required": false; }; }, { "dragStart": "dragStart"; "dragEnd": "dragEnd"; "gutterClick": "gutterClick"; "gutterDblClick": "gutterDblClick"; "transitionEnd": "transitionEnd"; }, never, ["*"], true, never>;
130
+ static ngAcceptInputType_restrictMove: unknown;
131
+ static ngAcceptInputType_useTransition: unknown;
132
+ static ngAcceptInputType_disabled: unknown;
109
133
  }
package/split/utils.d.ts CHANGED
@@ -2,7 +2,6 @@ import { ElementRef } from '@angular/core';
2
2
  import { MtxSplitArea, MtxSplitPoint, MtxSplitAreaSnapshot, MtxSplitSideAbsorptionCapacity, MtxSplitAreaAbsorptionCapacity } from './interfaces';
3
3
  export declare function getPointFromEvent(event: MouseEvent | TouchEvent): MtxSplitPoint | null;
4
4
  export declare function getElementPixelSize(elRef: ElementRef, direction: 'horizontal' | 'vertical'): number;
5
- export declare function getInputBoolean(v: any): boolean;
6
5
  export declare function getInputPositiveNumber<T>(v: any, defaultValue: T): number | T;
7
6
  export declare function isUserSizesValid(unit: 'percent' | 'pixel', sizes: Array<number>): boolean | number | void;
8
7
  export declare function getAreaMinSize(a: MtxSplitArea): null | number;
@@ -1,7 +1,6 @@
1
1
  @use 'sass:map';
2
2
  @use '@material/tooltip/plain-tooltip-theme' as mdc-plain-tooltip-theme;
3
3
  @use '@angular/material' as mat;
4
- @use '../core/style/sass-utils';
5
4
  @use '../core/theming/inspection';
6
5
  @use '../core/theming/validation';
7
6
  @use '../core/tokens/m2/mdc/plain-tooltip' as tokens-mdc-plain-tooltip;
@@ -12,7 +11,7 @@
12
11
  }
13
12
  @else {
14
13
  // Add default values for tokens not related to color, typography, or density.
15
- @include sass-utils.current-selector-or-root() {
14
+ @include mat.private-current-selector-or-root() {
16
15
  @include mdc-plain-tooltip-theme.theme(tokens-mdc-plain-tooltip.get-unthemable-tokens());
17
16
  }
18
17
  }
@@ -26,7 +25,7 @@
26
25
  $mdc-tooltip-color-tokens: tokens-mdc-plain-tooltip.get-color-tokens($theme);
27
26
 
28
27
  // Add values for MDC tooltip tokens.
29
- @include sass-utils.current-selector-or-root() {
28
+ @include mat.private-current-selector-or-root() {
30
29
  @include mdc-plain-tooltip-theme.theme($mdc-tooltip-color-tokens);
31
30
  }
32
31
  }
@@ -40,7 +39,7 @@
40
39
  $mdc-tooltip-typography-tokens: tokens-mdc-plain-tooltip.get-typography-tokens($theme);
41
40
 
42
41
  // Add values for MDC tooltip tokens.
43
- @include sass-utils.current-selector-or-root() {
42
+ @include mat.private-current-selector-or-root() {
44
43
  @include mdc-plain-tooltip-theme.theme($mdc-tooltip-typography-tokens);
45
44
  }
46
45
  }
@@ -54,7 +53,7 @@
54
53
  $mdc-tooltip-density-tokens: tokens-mdc-plain-tooltip.get-density-tokens($theme);
55
54
 
56
55
  // Add values for MDC tooltip tokens.
57
- @include sass-utils.current-selector-or-root() {
56
+ @include mat.private-current-selector-or-root() {
58
57
  @include mdc-plain-tooltip-theme.theme($mdc-tooltip-density-tokens);
59
58
  }
60
59
  }
@@ -1,80 +0,0 @@
1
- @use 'sass:color';
2
- @use 'sass:list';
3
- @use 'sass:map';
4
- @use 'sass:meta';
5
-
6
- /// Include content under the current selector (&) or the document root if there is no current
7
- /// selector.
8
- /// @param {String} $root [html] The default root selector to use when there is no current selector.
9
- /// @output The given content under the current selector, or root selector if there is no current
10
- /// selector.
11
- /// @content Content to output under the current selector, or root selector if there is no current
12
- /// selector.
13
- @mixin current-selector-or-root($root: html) {
14
- @if & {
15
- @content;
16
- }
17
- @else {
18
- #{$root} {
19
- @content;
20
- }
21
- }
22
- }
23
-
24
- /// A version of the standard `map.merge` function that takes a variable number of arguments.
25
- /// Each argument is merged into the final result from left to right.
26
- /// @param {List} $maps The maps to combine with map.merge
27
- /// @return {Map} The combined result of successively calling map.merge with each parameter.
28
- @function merge-all($maps...) {
29
- $result: ();
30
- @each $map in $maps {
31
- $result: map.merge($result, $map);
32
- }
33
- @return $result;
34
- }
35
-
36
- /// A version of the standard `map.deep-merge` function that takes a variable number of arguments.
37
- /// Each argument is deep-merged into the final result from left to right.
38
- /// @param {List} $maps The maps to combine with map.deep-merge
39
- /// @return {Map} The combined result of successively calling map.deep-merge with each parameter.
40
- @function deep-merge-all($maps...) {
41
- $result: ();
42
- @each $map in $maps {
43
- $result: map.deep-merge($result, $map);
44
- }
45
- @return $result;
46
- }
47
-
48
- /// Coerces the given value to a list, by converting any non-list value into a single-item list.
49
- /// This should be used when dealing with user-passed lists of args to avoid confusing errors,
50
- /// since Sass treats `($x)` as equivalent to `$x`.
51
- /// @param {Any} $value The value to coerce to a list.
52
- /// @return {List} The original $value if it was a list, otherwise a single-item list containing
53
- /// $value.
54
- @function coerce-to-list($value) {
55
- @return if(meta.type-of($value) != 'list', ($value,), $value);
56
- }
57
-
58
- /// A version of the Sass `color.change` function that is safe ot use with CSS variables.
59
- @function safe-color-change($color, $args...) {
60
- $args: meta.keywords($args);
61
- @return if(meta.type-of($color) == 'color', color.change($color, $args...), $color);
62
- }
63
-
64
- /// Gets the given arguments as a map of keywords and validates that only supported arguments were
65
- /// passed.
66
- /// @param {ArgList} $args The arguments to convert to a keywords map.
67
- /// @param {List} $supported-args The supported argument names.
68
- /// @return {Map} The $args as a map of argument name to argument value.
69
- @function validate-keyword-args($args, $supported-args) {
70
- @if list.length($args) > 0 {
71
- @error #{'Expected keyword args, but got positional args: '}#{$args};
72
- }
73
- $kwargs: meta.keywords($args);
74
- @each $arg, $v in $kwargs {
75
- @if list.index($supported-args, $arg) == null {
76
- @error #{'Unsupported argument '}#{$arg}#{'. Valid arguments are: '}#{$supported-args};
77
- }
78
- }
79
- @return $kwargs;
80
- }
@@ -1,5 +0,0 @@
1
- @forward '../index';
2
-
3
- // Experimental M3 Token-based theming API
4
- @forward './theming/definition' show define-theme, define-colors, define-typography, define-density;
5
- @forward './theming/color-api-back-compat' show color-variants-back-compat;
@@ -1,308 +0,0 @@
1
- @use 'sass:list';
2
- @use 'sass:map';
3
- @use 'sass:meta';
4
- @use '@angular/material' as mat;
5
- @use '@material/tokens/v0_161' as mdc-tokens;
6
- @use './m3-density';
7
- @use './custom-tokens';
8
- @use './format-tokens';
9
- @use '../../core/tokens/m2';
10
-
11
- /// Picks a submap containing only the given keys out the given map.
12
- /// @param {Map} $map The map to pick from.
13
- /// @param {List} $keys The map keys to pick.
14
- /// @return {Map} A submap containing only the given keys.
15
- @function _pick($map, $keys) {
16
- $result: ();
17
- @each $key in $keys {
18
- @if map.has-key($map, $key) {
19
- $result: map.set($result, $key, map.get($map, $key));
20
- }
21
- }
22
- @return $result;
23
- }
24
-
25
- /// Filters keys with a null value out of the map.
26
- /// @param {Map} $map The map to filter.
27
- /// @return {Map} The given map with all of the null keys filtered out.
28
- @function _filter-nulls($map) {
29
- $result: ();
30
- @each $key, $val in $map {
31
- @if $val != null {
32
- $result: map.set($result, $key, $val);
33
- }
34
- }
35
- @return $result;
36
- }
37
-
38
- /// Gets the MDC tokens for the given prefix, M3 token values, and supported token slots.
39
- /// @param {List} $prefix The token prefix for the given tokens.
40
- /// @param {Map|(Map, Map)} $m3-values A map of M3 token values for the given prefix.
41
- /// This param may also be a tuple of maps, the first one representing the default M3 token values,
42
- // and the second containing overrides for different color variants.
43
- // Single map example:
44
- // (token1: green, token2: 2px)
45
- // Tuple example:
46
- // (
47
- // (token1: green, token2: 2px),
48
- // (
49
- // secondary: (token1: blue),
50
- // error: (token1: red),
51
- // )
52
- // )
53
- /// @param {Map} $slots A map of token slots, with null value indicating the token is not supported.
54
- /// @param {String|null} $variant The name of the variant the token values are for.
55
- /// @return {Map} A map of fully qualified token names to values, for only the supported tokens.
56
- @function _namespace-tokens($prefix, $m3-values, $slots, $variant: null) {
57
- $result: ();
58
- @if $variant == null and meta.type-of($m3-values) == 'list' and list.length($m3-values == 2) {
59
- $variants: list.nth($m3-values, 2);
60
- $m3-values: list.nth($m3-values, 1);
61
- @each $variant, $overrides in $variants {
62
- $result: map.merge($result, _namespace-tokens($prefix, $overrides, $slots, $variant));
63
- }
64
- }
65
- $used-token-names: map.keys(_filter-nulls(map.get($slots, $prefix)));
66
- $used-m3-tokens: _pick(_filter-nulls($m3-values), $used-token-names);
67
- $prefix: if($variant == null, $prefix, list.append($prefix, $variant));
68
- @return map.merge($result, ($prefix: $used-m3-tokens));
69
- }
70
-
71
- /// Generates tokens for the given palette with the given prefix.
72
- /// @param {Map} $palette The palette to generate tokens for
73
- /// @param {String} $prefix The key prefix used to name the tokens
74
- /// @return {Map} A set of tokens for the given palette
75
- @function _generate-palette-tokens($palette, $prefix) {
76
- $palette: map.remove($palette, neutral, neutral-variant);
77
- $result: ();
78
- @each $hue, $value in $palette {
79
- $result: map.set($result, '#{$prefix}#{$hue}', $value);
80
- }
81
- @return $result;
82
- }
83
-
84
- /// Creates a set of `md-ref-palette` tokens from the given palettes. (See
85
- /// https://github.com/material-components/material-components-web/blob/master/packages/mdc-tokens/v0_161/_md-ref-palette.scss)
86
- /// @param {Map} $primary The primary palette
87
- /// @param {Map} $secondary The secondary palette
88
- /// @param {Map} $tertiary The tertiary palette
89
- /// @param {Map} $error The error palette
90
- /// @return {Map} A set of `md-ref-palette` tokens
91
- @function _generate-ref-palette-tokens($primary, $tertiary, $error) {
92
- @return mat.private-merge-all(
93
- (black: #000, white: #fff),
94
- _generate-palette-tokens($primary, primary),
95
- _generate-palette-tokens(map.get($primary, secondary), secondary),
96
- _generate-palette-tokens($tertiary, tertiary),
97
- _generate-palette-tokens(map.get($primary, neutral), neutral),
98
- _generate-palette-tokens(map.get($primary, neutral-variant), neutral-variant),
99
- _generate-palette-tokens($error, error),
100
- );
101
- }
102
-
103
- /// Creates a set of `md-ref-typeface` tokens from the given palettes. (See
104
- /// https://github.com/material-components/material-components-web/blob/master/packages/mdc-tokens/v0_161/_md-ref-typeface.scss)
105
- /// @param {List|String} $brand The font-family to use for brand text
106
- /// @param {List|String} $plain The font-family to use for plain text
107
- /// @param {String} $bold The font-weight to use for bold text
108
- /// @param {String} $medium The font-weight to use for medium text
109
- /// @param {String} $regular The font-weight to use for regular text
110
- /// @return {Map} A set of `md-ref-typeface` tokens
111
- @function _generate-ref-typeface-tokens($brand, $plain, $bold, $medium, $regular) {
112
- @return (
113
- brand: $brand,
114
- plain: $plain,
115
- weight-bold: $bold,
116
- weight-medium: $medium,
117
- weight-regular: $regular,
118
- );
119
- }
120
-
121
- /// At the time of writing, some color tokens (e.g. disabled state) are defined as a solid color
122
- /// token and a separate opacity token. This function applies the opacity to the color and drops the
123
- /// opacity key from the map. Can be removed once b/213331407 is resolved.
124
- /// @param {Map} $tokens The map of tokens currently being generated
125
- /// @param {Map} $all-tokens A map of all tokens, including hardcoded values
126
- /// @param {List} $pairs Pairs of color token names and their opacities. Should be in the shape of
127
- /// `((color: 'color-key', opacity: 'opacity-key'))`.
128
- /// @return {Map} The initial tokens with the combined color values.
129
- @function _combine-color-tokens($tokens, $opacity-lookup, $pairs) {
130
- $result: $tokens;
131
-
132
- @each $pair in $pairs {
133
- $color-key: map.get($pair, color);
134
- $opacity-key: map.get($pair, opacity);
135
- $color: map.get($tokens, $color-key);
136
- $opacity: map.get($opacity-lookup, $opacity-key);
137
-
138
- @if meta.type-of($color) == 'color' {
139
- @if meta.type-of($opacity) != 'number' {
140
- @error 'Cannot find valid opacity value for color token "#{$color-key}"';
141
- }
142
-
143
- $result: map.remove($result, $opacity-key);
144
- $result: map.set($result, $color-key, rgba($color, $opacity));
145
- }
146
- }
147
-
148
- @return $result;
149
- }
150
-
151
- /// Generates a set of namespaced tokens for all components.
152
- /// @param {Map} $systems The MDC system tokens
153
- /// @param {Boolean} $include-non-systemized Whether to include non-systemized tokens
154
- /// @return {Map} A map of namespaced tokens
155
- @function _generate-tokens($systems, $include-non-systemized: false) {
156
- $systems: map.merge((
157
- md-sys-color: (),
158
- md-sys-elevation: (),
159
- md-sys-motion: (),
160
- md-sys-shape: (),
161
- md-sys-state: (),
162
- md-sys-typescale: ()
163
- ), $systems);
164
- $exclude-hardcoded: not $include-non-systemized;
165
-
166
- // DO NOT REMOVE
167
- // This function is used internally.
168
- $systems: format-tokens.private-format-tokens($systems);
169
-
170
- // TODO(mmalerba): Refactor this to not depend on the legacy theme when moving out of
171
- // material-experimental. This is a hack for now because there is no good way to get the token
172
- // slots in material-experimental without exposing them all from material.
173
- $fake-theme: mat.define-light-theme((
174
- color: (
175
- primary: mat.define-palette(mat.$red-palette),
176
- accent: mat.define-palette(mat.$red-palette),
177
- warn: mat.define-palette(mat.$red-palette),
178
- ),
179
- typography: mat.define-typography-config(),
180
- density: 0
181
- ));
182
- $token-slots: m2.m2-tokens-from-theme($fake-theme);
183
-
184
- // TODO(mmalerba): Fill in remaining tokens.
185
- $result: mat.private-deep-merge-all(
186
- _namespace-tokens(
187
- (mtx, alert),
188
- custom-tokens.alert($systems, $exclude-hardcoded),
189
- $token-slots
190
- ),
191
- _namespace-tokens(
192
- (mtx, colorpicker),
193
- custom-tokens.colorpicker($systems, $exclude-hardcoded),
194
- $token-slots
195
- ),
196
- _namespace-tokens(
197
- (mtx, datetimepicker),
198
- custom-tokens.datetimepicker($systems, $exclude-hardcoded),
199
- $token-slots
200
- ),
201
- _namespace-tokens(
202
- (mtx, drawer),
203
- custom-tokens.drawer($systems, $exclude-hardcoded),
204
- $token-slots
205
- ),
206
- _namespace-tokens(
207
- (mtx, grid),
208
- custom-tokens.grid($systems, $exclude-hardcoded),
209
- $token-slots
210
- ),
211
- _namespace-tokens(
212
- (mtx, loader),
213
- custom-tokens.loader($systems, $exclude-hardcoded),
214
- $token-slots
215
- ),
216
- _namespace-tokens(
217
- (mtx, popover),
218
- custom-tokens.popover($systems, $exclude-hardcoded),
219
- $token-slots
220
- ),
221
- _namespace-tokens(
222
- (mtx, progress),
223
- custom-tokens.progress($systems, $exclude-hardcoded),
224
- $token-slots
225
- ),
226
- _namespace-tokens(
227
- (mtx, select),
228
- custom-tokens.select($systems, $exclude-hardcoded),
229
- $token-slots
230
- ),
231
- _namespace-tokens(
232
- (mtx, split),
233
- custom-tokens.split($systems, $exclude-hardcoded),
234
- $token-slots
235
- ),
236
- );
237
-
238
- // Strip out tokens that are systemized by our made up density system.
239
- @each $namespace, $tokens in $result {
240
- @each $token, $value in $tokens {
241
- @if m3-density.is-systemized($namespace, $token) {
242
- $tokens: map.remove($tokens, $token);
243
- }
244
- }
245
- $result: map.set($result, $namespace, $tokens);
246
- }
247
- @return $result;
248
- }
249
-
250
- /// Generates a set of namespaced color tokens for all components.
251
- /// @param {String} $type The type of theme system (light or dark)
252
- /// @param {Map} $primary The primary palette
253
- /// @param {Map} $tertiary The tertiary palette
254
- /// @param {Map} $error The error palette
255
- /// @return {Map} A map of namespaced color tokens
256
- @function generate-color-tokens($type, $primary, $tertiary, $error) {
257
- $ref: (
258
- md-ref-palette: _generate-ref-palette-tokens($primary, $tertiary, $error)
259
- );
260
- $sys-color: if($type == dark,
261
- mdc-tokens.md-sys-color-values-dark($ref),
262
- mdc-tokens.md-sys-color-values-light($ref));
263
- @return _generate-tokens(map.merge($ref, (
264
- md-sys-color: $sys-color,
265
- // Because the elevation values are always combined with color values to create the box shadow,
266
- // elevation needs to be part of the color dimension.
267
- md-sys-elevation: mdc-tokens.md-sys-elevation-values(),
268
- // Because the state values are sometimes combined with color values to create rgba colors,
269
- // state needs to be part of color dimension.
270
- // TODO(mmalerba): If at some point we remove the need for these combined values, we can move
271
- // state to the base dimension.
272
- md-sys-state: mdc-tokens.md-sys-state-values(),
273
- )));
274
- }
275
-
276
- /// Generates a set of namespaced color tokens for all components.
277
- /// @param {String|List} $brand The brand font-family
278
- /// @param {String|List} $plain The plain fort-family
279
- /// @param {String|Number} $bold The bold font-weight
280
- /// @param {String|Number} $medium The medium font-weight
281
- /// @param {String|Number} $regular The regular font-weight
282
- /// @return {Map} A map of namespaced typography tokens
283
- @function generate-typography-tokens($brand, $plain, $bold, $medium, $regular) {
284
- $ref: (
285
- md-ref-typeface: _generate-ref-typeface-tokens($brand, $plain, $bold, $medium, $regular)
286
- );
287
- @return _generate-tokens((
288
- md-sys-typescale: mdc-tokens.md-sys-typescale-values($ref)
289
- ));
290
- }
291
-
292
- /// Generates a set of namespaced density tokens for all components.
293
- /// @param {String|Number} $scale The regular font-weight
294
- /// @return {Map} A map of namespaced density tokens
295
- @function generate-density-tokens($scale) {
296
- @return m3-density.get-tokens-for-scale($scale);
297
- }
298
-
299
- /// Generates a set of namespaced tokens not related to color, typography, or density for all
300
- /// components.
301
- /// @return {Map} A map of namespaced tokens not related to color, typography, or density
302
- @function generate-base-tokens() {
303
- // TODO(mmalerba): Exclude density tokens once implemented.
304
- @return _generate-tokens((
305
- md-sys-motion: mdc-tokens.md-sys-motion-values(),
306
- md-sys-shape: mdc-tokens.md-sys-shape-values(),
307
- ), $include-non-systemized: true);
308
- }