Skip to content

Commit 32981cc

Browse files
committed
refactor(multiple): change 'other' to 'base' in theming terminology
1 parent 0df4d08 commit 32981cc

File tree

5 files changed

+22
-18
lines changed

5 files changed

+22
-18
lines changed

src/material-experimental/theming/_definition.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ $theme-version: 1;
2424
define-colors(map.get($config, color) or ()),
2525
define-typography(map.get($config, typography) or ()),
2626
define-density(map.get($config, density) or ()),
27-
($internals: (other-tokens: m3-tokens.generate-other-tokens())),
27+
($internals: (base-tokens: m3-tokens.generate-base-tokens())),
2828
);
2929
}
3030

src/material-experimental/theming/_m3-tokens.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@
256256
/// Generates a set of namespaced tokens not related to color, typography, or density for all
257257
/// components.
258258
/// @return {Map} A map of namespaced tokens not related to color, typography, or density
259-
@function generate-other-tokens() {
259+
@function generate-base-tokens() {
260260
// TODO(mmalerba): Exclude density tokens once implemented.
261261
@return _generate-tokens((
262262
md-sys-motion: mdc-tokens.md-sys-motion-values(),

src/material/checkbox/_checkbox-theme.scss

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@
99
@use '../core/tokens/m2/mdc/checkbox' as tokens-mdc-checkbox;
1010

1111
@mixin base($config-or-theme) {
12-
// Add default values for tokens not related to color, typography, or density.
13-
@include sass-utils.current-selector-or-root() {
14-
@include mdc-checkbox-theme.theme(tokens-mdc-checkbox.get-unthemable-tokens());
12+
@if inspection.get-theme-version($config-or-theme) == 1 {
13+
@include _theme-from-tokens(inspection.get-theme-tokens($config-or-theme, base));
14+
}
15+
@else {
16+
@include sass-utils.current-selector-or-root() {
17+
@include mdc-checkbox-theme.theme(tokens-mdc-checkbox.get-unthemable-tokens());
18+
}
1519
}
1620
}
1721

src/material/core/theming/_inspection.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@ $_internals: _mat-theming-internals-do-not-access;
2828
/// systems.
2929
/// @param {Map} $theme The theme to get tokens from.
3030
/// @param {String...} $systems The theming systems to get tokens for. Valid values are: color,
31-
/// typography, density, other. If no systems are passed, all tokens will be returned.
31+
/// typography, density, base. If no systems are passed, all tokens will be returned.
3232
/// @return {Map} The requested tokens for the theme.
3333
@function get-theme-tokens($theme, $systems...) {
34-
$systems: if(list.length($systems) == 0, (color, typography, density, other), $systems);
34+
$systems: if(list.length($systems) == 0, (color, typography, density, base), $systems);
3535
$err: _validate-theme-object($theme);
3636
@if $err {
3737
@error #{'Expected $theme to be an Angular Material theme object. Got:'} $theme;
3838
}
39-
$err: validation.validate-allowed-values($systems, color, typography, density, other);
39+
$err: validation.validate-allowed-values($systems, color, typography, density, base);
4040
@if $err {
4141
@error
42-
#{'Expected $systems to contain valid system names (color, typographt, density, or other).'}
42+
#{'Expected $systems to contain valid system names (color, typographt, density, or base).'}
4343
#{'Got invalid system names:'} $err;
4444
}
4545
$result: ();

src/material/core/theming/_theming.scss

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ $_disable-color-backwards-compatibility: false;
3535
$_emitted-color: () !default;
3636
$_emitted-typography: () !default;
3737
$_emitted-density: () !default;
38-
$_emitted-other: () !default;
38+
$_emitted-base: () !default;
3939

4040
/// Extracts a color from a palette or throws an error if it doesn't exist.
4141
/// @param {Map} $palette The palette from which to extract a color.
@@ -387,13 +387,13 @@ $_internals: _mat-theming-internals-do-not-access;
387387
density-scale: map.get($theme-or-color-config, $_internals, density-scale),
388388
density-tokens: map.get($theme-or-color-config, $_internals, density-tokens),
389389
));
390-
$other-settings: _strip-empty-settings((
391-
other-tokens: map.get($theme-or-color-config, $_internals, other-tokens),
390+
$base-settings: _strip-empty-settings((
391+
base-tokens: map.get($theme-or-color-config, $_internals, base-tokens),
392392
));
393393
$previous-color-settings: map.get($_emitted-color, $id) or ();
394394
$previous-typography-settings: map.get($_emitted-typography, $id) or ();
395395
$previous-density-settings: map.get($_emitted-density, $id) or ();
396-
$previous-other-settings: map.get($_emitted-other, $id) or ();
396+
$previous-base-settings: map.get($_emitted-base, $id) or ();
397397

398398
// Check if the color configuration has been generated before.
399399
@if $color-settings != null {
@@ -422,19 +422,19 @@ $_internals: _mat-theming-internals-do-not-access;
422422
$previous-density-settings: list.append($previous-density-settings, $density-settings);
423423
}
424424

425-
// Check if the other configuration has been generated before.
426-
@if $other-settings != null {
427-
@if list.index($previous-other-settings, $other-settings) != null and
425+
// Check if the base configuration has been generated before.
426+
@if $base-settings != null {
427+
@if list.index($previous-base-settings, $base-settings) != null and
428428
not $theme-ignore-duplication-warnings {
429429
@warn 'The same base theme styles are generated multiple times. ' + $_duplicate-warning;
430430
}
431-
$previous-other-settings: list.append($previous-other-settings, $other-settings);
431+
$previous-base-settings: list.append($previous-base-settings, $base-settings);
432432
}
433433

434434
$_emitted-color: map.set($_emitted-color, $id, $previous-color-settings) !global;
435435
$_emitted-density: map.set($_emitted-density, $id, $previous-density-settings) !global;
436436
$_emitted-typography: map.set($_emitted-typography, $id, $previous-typography-settings) !global;
437-
$_emitted-other: map.set($_emitted-other, $id, $previous-other-settings) !global;
437+
$_emitted-base: map.set($_emitted-base, $id, $previous-base-settings) !global;
438438

439439
@content;
440440
}

0 commit comments

Comments
 (0)