@angular/material-experimental 16.1.0-next.0 → 16.1.0-next.2

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.
package/_index.scss CHANGED
@@ -4,4 +4,7 @@
4
4
  @forward './popover-edit/popover-edit-theme' as popover-edit-* show popover-edit-color,
5
5
  popover-edit-typography, popover-edit-density, popover-edit-theme;
6
6
 
7
+ // Token-based theming API
8
+ @forward './theming/theming' show theme, card, checkbox;
9
+
7
10
  // Additional public APIs for individual components
@@ -7,5 +7,5 @@
7
7
  */
8
8
  import { Version } from '@angular/core';
9
9
  /** Current version of the Material experimental package. */
10
- export const VERSION = new Version('16.1.0-next.0');
10
+ export const VERSION = new Version('16.1.0-next.2');
11
11
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVyc2lvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3NyYy9tYXRlcmlhbC1leHBlcmltZW50YWwvdmVyc2lvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFFSCxPQUFPLEVBQUMsT0FBTyxFQUFDLE1BQU0sZUFBZSxDQUFDO0FBRXRDLDREQUE0RDtBQUM1RCxNQUFNLENBQUMsTUFBTSxPQUFPLEdBQUcsSUFBSSxPQUFPLENBQUMsbUJBQW1CLENBQUMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQGxpY2Vuc2VcbiAqIENvcHlyaWdodCBHb29nbGUgTExDIEFsbCBSaWdodHMgUmVzZXJ2ZWQuXG4gKlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgYW4gTUlULXN0eWxlIGxpY2Vuc2UgdGhhdCBjYW4gYmVcbiAqIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUgYXQgaHR0cHM6Ly9hbmd1bGFyLmlvL2xpY2Vuc2VcbiAqL1xuXG5pbXBvcnQge1ZlcnNpb259IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuXG4vKiogQ3VycmVudCB2ZXJzaW9uIG9mIHRoZSBNYXRlcmlhbCBleHBlcmltZW50YWwgcGFja2FnZS4gKi9cbmV4cG9ydCBjb25zdCBWRVJTSU9OID0gbmV3IFZlcnNpb24oJzAuMC4wLVBMQUNFSE9MREVSJyk7XG4iXX0=
@@ -1,7 +1,7 @@
1
1
  import { Version } from '@angular/core';
2
2
 
3
3
  /** Current version of the Material experimental package. */
4
- const VERSION = new Version('16.1.0-next.0');
4
+ const VERSION = new Version('16.1.0-next.2');
5
5
 
6
6
  export { VERSION };
7
7
  //# sourceMappingURL=material-experimental.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"material-experimental.mjs","sources":["../../../../../../src/material-experimental/version.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the Material experimental package. */\nexport const VERSION = new Version('16.1.0-next.0');\n"],"names":[],"mappings":";;AAUA;MACa,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB;;;;"}
1
+ {"version":3,"file":"material-experimental.mjs","sources":["../../../../../../src/material-experimental/version.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the Material experimental package. */\nexport const VERSION = new Version('16.1.0-next.2');\n"],"names":[],"mappings":";;AAUA;MACa,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/material-experimental",
3
- "version": "16.1.0-next.0",
3
+ "version": "16.1.0-next.2",
4
4
  "description": "Experimental components for Angular Material",
5
5
  "repository": {
6
6
  "type": "git",
@@ -49,62 +49,62 @@
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@angular/animations": "^16.0.0-0 || ^16.1.0-0 || ^16.2.0-0 || ^16.3.0-0 || ^17.0.0-0",
52
- "@angular/cdk": "16.1.0-next.0",
52
+ "@angular/cdk": "16.1.0-next.2",
53
53
  "@angular/core": "^16.0.0-0 || ^16.1.0-0 || ^16.2.0-0 || ^16.3.0-0 || ^17.0.0-0",
54
54
  "@angular/common": "^16.0.0-0 || ^16.1.0-0 || ^16.2.0-0 || ^16.3.0-0 || ^17.0.0-0",
55
55
  "@angular/forms": "^16.0.0-0 || ^16.1.0-0 || ^16.2.0-0 || ^16.3.0-0 || ^17.0.0-0",
56
56
  "@angular/platform-browser": "^16.0.0-0 || ^16.1.0-0 || ^16.2.0-0 || ^16.3.0-0 || ^17.0.0-0",
57
- "@angular/material": "16.1.0-next.0"
57
+ "@angular/material": "16.1.0-next.2"
58
58
  },
59
59
  "dependencies": {
60
60
  "tslib": "^2.3.0",
61
- "@material/animation": "15.0.0-canary.3b5b55e31.0",
62
- "@material/auto-init": "15.0.0-canary.3b5b55e31.0",
63
- "@material/banner": "15.0.0-canary.3b5b55e31.0",
64
- "@material/base": "15.0.0-canary.3b5b55e31.0",
65
- "@material/button": "15.0.0-canary.3b5b55e31.0",
66
- "@material/card": "15.0.0-canary.3b5b55e31.0",
67
- "@material/checkbox": "15.0.0-canary.3b5b55e31.0",
68
- "@material/chips": "15.0.0-canary.3b5b55e31.0",
69
- "@material/circular-progress": "15.0.0-canary.3b5b55e31.0",
70
- "@material/data-table": "15.0.0-canary.3b5b55e31.0",
71
- "@material/density": "15.0.0-canary.3b5b55e31.0",
72
- "@material/dialog": "15.0.0-canary.3b5b55e31.0",
73
- "@material/dom": "15.0.0-canary.3b5b55e31.0",
74
- "@material/drawer": "15.0.0-canary.3b5b55e31.0",
75
- "@material/elevation": "15.0.0-canary.3b5b55e31.0",
76
- "@material/fab": "15.0.0-canary.3b5b55e31.0",
77
- "@material/feature-targeting": "15.0.0-canary.3b5b55e31.0",
78
- "@material/floating-label": "15.0.0-canary.3b5b55e31.0",
79
- "@material/form-field": "15.0.0-canary.3b5b55e31.0",
80
- "@material/icon-button": "15.0.0-canary.3b5b55e31.0",
81
- "@material/image-list": "15.0.0-canary.3b5b55e31.0",
82
- "@material/layout-grid": "15.0.0-canary.3b5b55e31.0",
83
- "@material/line-ripple": "15.0.0-canary.3b5b55e31.0",
84
- "@material/linear-progress": "15.0.0-canary.3b5b55e31.0",
85
- "@material/list": "15.0.0-canary.3b5b55e31.0",
86
- "@material/menu": "15.0.0-canary.3b5b55e31.0",
87
- "@material/menu-surface": "15.0.0-canary.3b5b55e31.0",
88
- "@material/notched-outline": "15.0.0-canary.3b5b55e31.0",
89
- "@material/radio": "15.0.0-canary.3b5b55e31.0",
90
- "@material/ripple": "15.0.0-canary.3b5b55e31.0",
91
- "@material/rtl": "15.0.0-canary.3b5b55e31.0",
92
- "@material/segmented-button": "15.0.0-canary.3b5b55e31.0",
93
- "@material/select": "15.0.0-canary.3b5b55e31.0",
94
- "@material/shape": "15.0.0-canary.3b5b55e31.0",
95
- "@material/slider": "15.0.0-canary.3b5b55e31.0",
96
- "@material/snackbar": "15.0.0-canary.3b5b55e31.0",
97
- "@material/switch": "15.0.0-canary.3b5b55e31.0",
98
- "@material/tab": "15.0.0-canary.3b5b55e31.0",
99
- "@material/tab-bar": "15.0.0-canary.3b5b55e31.0",
100
- "@material/tab-indicator": "15.0.0-canary.3b5b55e31.0",
101
- "@material/tab-scroller": "15.0.0-canary.3b5b55e31.0",
102
- "@material/textfield": "15.0.0-canary.3b5b55e31.0",
103
- "@material/theme": "15.0.0-canary.3b5b55e31.0",
104
- "@material/tooltip": "15.0.0-canary.3b5b55e31.0",
105
- "@material/top-app-bar": "15.0.0-canary.3b5b55e31.0",
106
- "@material/touch-target": "15.0.0-canary.3b5b55e31.0",
107
- "@material/typography": "15.0.0-canary.3b5b55e31.0"
61
+ "@material/animation": "15.0.0-canary.90291f2e2.0",
62
+ "@material/auto-init": "15.0.0-canary.90291f2e2.0",
63
+ "@material/banner": "15.0.0-canary.90291f2e2.0",
64
+ "@material/base": "15.0.0-canary.90291f2e2.0",
65
+ "@material/button": "15.0.0-canary.90291f2e2.0",
66
+ "@material/card": "15.0.0-canary.90291f2e2.0",
67
+ "@material/checkbox": "15.0.0-canary.90291f2e2.0",
68
+ "@material/chips": "15.0.0-canary.90291f2e2.0",
69
+ "@material/circular-progress": "15.0.0-canary.90291f2e2.0",
70
+ "@material/data-table": "15.0.0-canary.90291f2e2.0",
71
+ "@material/density": "15.0.0-canary.90291f2e2.0",
72
+ "@material/dialog": "15.0.0-canary.90291f2e2.0",
73
+ "@material/dom": "15.0.0-canary.90291f2e2.0",
74
+ "@material/drawer": "15.0.0-canary.90291f2e2.0",
75
+ "@material/elevation": "15.0.0-canary.90291f2e2.0",
76
+ "@material/fab": "15.0.0-canary.90291f2e2.0",
77
+ "@material/feature-targeting": "15.0.0-canary.90291f2e2.0",
78
+ "@material/floating-label": "15.0.0-canary.90291f2e2.0",
79
+ "@material/form-field": "15.0.0-canary.90291f2e2.0",
80
+ "@material/icon-button": "15.0.0-canary.90291f2e2.0",
81
+ "@material/image-list": "15.0.0-canary.90291f2e2.0",
82
+ "@material/layout-grid": "15.0.0-canary.90291f2e2.0",
83
+ "@material/line-ripple": "15.0.0-canary.90291f2e2.0",
84
+ "@material/linear-progress": "15.0.0-canary.90291f2e2.0",
85
+ "@material/list": "15.0.0-canary.90291f2e2.0",
86
+ "@material/menu": "15.0.0-canary.90291f2e2.0",
87
+ "@material/menu-surface": "15.0.0-canary.90291f2e2.0",
88
+ "@material/notched-outline": "15.0.0-canary.90291f2e2.0",
89
+ "@material/radio": "15.0.0-canary.90291f2e2.0",
90
+ "@material/ripple": "15.0.0-canary.90291f2e2.0",
91
+ "@material/rtl": "15.0.0-canary.90291f2e2.0",
92
+ "@material/segmented-button": "15.0.0-canary.90291f2e2.0",
93
+ "@material/select": "15.0.0-canary.90291f2e2.0",
94
+ "@material/shape": "15.0.0-canary.90291f2e2.0",
95
+ "@material/slider": "15.0.0-canary.90291f2e2.0",
96
+ "@material/snackbar": "15.0.0-canary.90291f2e2.0",
97
+ "@material/switch": "15.0.0-canary.90291f2e2.0",
98
+ "@material/tab": "15.0.0-canary.90291f2e2.0",
99
+ "@material/tab-bar": "15.0.0-canary.90291f2e2.0",
100
+ "@material/tab-indicator": "15.0.0-canary.90291f2e2.0",
101
+ "@material/tab-scroller": "15.0.0-canary.90291f2e2.0",
102
+ "@material/textfield": "15.0.0-canary.90291f2e2.0",
103
+ "@material/theme": "15.0.0-canary.90291f2e2.0",
104
+ "@material/tooltip": "15.0.0-canary.90291f2e2.0",
105
+ "@material/top-app-bar": "15.0.0-canary.90291f2e2.0",
106
+ "@material/touch-target": "15.0.0-canary.90291f2e2.0",
107
+ "@material/typography": "15.0.0-canary.90291f2e2.0"
108
108
  },
109
109
  "sideEffects": false,
110
110
  "module": "./fesm2022/material-experimental.mjs",
@@ -0,0 +1,134 @@
1
+ @use 'sass:list';
2
+ @use 'sass:map';
3
+ @use 'sass:meta';
4
+ @use '@angular/material' as mat;
5
+
6
+ /// Whether to throw an error when a required dep is not configured. If false, the dep will be
7
+ /// automatically configured instead.
8
+ $_error-on-missing-dep: false;
9
+
10
+ /// Applies the theme for the given component configuration.
11
+ /// @param {Map} $tokens A map containing the default values to use for tokens not explicitly
12
+ /// customized in the component config object.
13
+ /// @param {List} $component The component config object to emit theme tokens for.
14
+ /// @output CSS variables representing the theme tokens for this component.
15
+ @mixin _apply-theme($tokens, $component) {
16
+ $id: map.get($component, id);
17
+ $tokens: map.deep-merge($tokens, map.get($component, customizations));
18
+
19
+ // NOTE: for now we use a hardcoded if-chain, but in the future when first-class mixins are
20
+ // supported, the configuration data will contain a reference to its own theme mixin.
21
+ @if $id == 'mat.card' {
22
+ @include mat.private-apply-card-theme-from-tokens($tokens);
23
+ }
24
+ @else if $id == 'mat.checkbox' {
25
+ @include mat.private-apply-checkbox-theme-from-tokens($tokens);
26
+ }
27
+ @else {
28
+ @error 'Unrecognized component theme: #{id}';
29
+ }
30
+ }
31
+
32
+ /// Gets the transitive closure of the given list of component configuration dependencies.
33
+ /// @param {List} $components The list of component config objects to get the transitive deps for.
34
+ /// @param {Map} $configured [()] A map of already configured component IDs. Used for recursion,
35
+ /// should not be passed when calling.
36
+ /// @return {List} The transitive closure of configs for the given $components.
37
+ // TODO(mmalerba): Currently we use the deps to determine if additional tokens, other than the
38
+ // explicitly requested ones need to be emitted, but the deps do not affect the ordering in which
39
+ // the various configs are processed. Before moving out of experimental we should think more about
40
+ // the ordering behavior we want. For the most part the order shouldn't matter, unless we have 2
41
+ // configs trying to set the same token.
42
+ @function _get-transitive-deps($components, $configured: ()) {
43
+ // Mark the given components as configured.
44
+ @each $component in $components {
45
+ $configured: map.set($configured, map.get($component, id), true);
46
+ }
47
+ $new-deps: ();
48
+
49
+ // Check each of the given components for new deps.
50
+ @each $component in $components {
51
+ // Note: Deps are specified as getter functions that return a config object rather than a direct
52
+ // config object. This allows us to only call the getter if the dep has not yet been configured.
53
+ // This can be useful if we have 2 components that want to require each other to be configured.
54
+ // Example: form-field and input. If we used direct config objects in this case, it would cause
55
+ // infinite co-recursion.
56
+ @each $dep-getter in mat.private-coerce-to-list(map.get($component, deps)) {
57
+ $dep: meta.call($dep-getter);
58
+ $dep-id: map.get($dep, id);
59
+ @if not (map.has-key($configured, $dep-id)) {
60
+ @if $_error-on-missing-dep {
61
+ @error 'Missing theme: `#{map.get($component, id)}` depends on `#{$dep-id}`.' +
62
+ ' Please configure the theme for `#{$dep-id}` in your call to `mat.theme`';
63
+ }
64
+ @else {
65
+ $configured: map.set($configured, $dep-id, true);
66
+ $new-deps: list.append($new-deps, $dep);
67
+ }
68
+ }
69
+ }
70
+ }
71
+
72
+ // Append on the new deps to this list of component configurations and return.
73
+ @if list.length($new-deps) > 0 {
74
+ $components: list.join($components, _get-transitive-deps($new-deps, $configured));
75
+ }
76
+ @return $components;
77
+ }
78
+
79
+ /// Apply the themes for the given component configs with the given ste of fallback token values.
80
+ /// @param {Map} $tokens A map of fallback values to use for tokens that are not explicitly
81
+ /// customized by one of the component configs.
82
+ /// @param {List} $components The list of component configurations to emit tokens for.
83
+ /// @output CSS variables representing the theme tokens for the given component configs.
84
+ @mixin _theme($tokens, $components) {
85
+ // Call the theme mixin for each configured component.
86
+ @each $component in $components {
87
+ @include _apply-theme($tokens, $component);
88
+ }
89
+ }
90
+
91
+ /// Takes the full list of tokens and a list of components to configure, and outputs all theme
92
+ /// tokens for the configured components.
93
+ /// @param {Map} $tokens A map of all tokens for the current design system.
94
+ /// @param {List} $components The list of component configurations to emit tokens for.
95
+ /// @output CSS variables representing the theme tokens for the given component configs.
96
+ // TODO(mmalerba): Consider an alternate API where `$tokens` is not a separate argument,
97
+ // but one of the configs in the `$components` list
98
+ @mixin theme($tokens, $components) {
99
+ @include _theme($tokens, _get-transitive-deps(mat.private-coerce-to-list($components)));
100
+ }
101
+
102
+ /// Takes a list of components to configure, and outputs only the theme tokens that are explicitly
103
+ /// customized by the configurations.
104
+ /// @param {List} $components The list of component configurations to emit tokens for.
105
+ /// @output CSS variables representing the theme tokens for the given component configs.
106
+ // TODO(mmalerba): What should we call this?
107
+ // - update-theme
108
+ // - adjust-theme
109
+ // - edit-theme
110
+ // - override-theme
111
+ // - retheme
112
+ @mixin retheme($components) {
113
+ @include _theme((), $components);
114
+ }
115
+
116
+ /// Configure the mat-card's theme.
117
+ /// @param {Map} $customizations [()] A map of custom token values to use when theming mat-card.
118
+ @function card($customizations: ()) {
119
+ @return (
120
+ id: 'mat.card',
121
+ customizations: $customizations,
122
+ deps: (),
123
+ );
124
+ }
125
+
126
+ /// Configure the mat-checkbox's theme.
127
+ /// @param {Map} $customizations [()] A map of custom token values to use when theming mat-checkbox.
128
+ @function checkbox($customizations: ()) {
129
+ @return (
130
+ id: 'mat.checkbox',
131
+ customizations: $customizations,
132
+ deps: (),
133
+ );
134
+ }