Skip to content

Commit

Permalink
main - 4ba4689 feat(material/core): namespace m2-specific theming API…
Browse files Browse the repository at this point in the history
…s (#28892)
  • Loading branch information
crisbeto committed Apr 17, 2024
1 parent 8afd08e commit c8ec954
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 20 deletions.
29 changes: 10 additions & 19 deletions _index.scss
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
// Theming APIs
@forward './core/theming/theming' show define-light-theme, define-dark-theme,
define-palette, get-contrast-color-from-palette, get-color-from-palette,
get-color-config, get-typography-config, get-density-config,
$theme-ignore-duplication-warnings, $theme-legacy-inspection-api-compatibility;
// Expose the M2 APIs under an `m2-` prefix in order to distinguish them from the M3 APIs.
@forward './core/m2' as m2-*;

// New theming APIs
@forward './core/theming/inspection' show get-theme-version, get-theme-type, get-theme-color,
get-theme-typography, get-theme-density, theme-has, theme-remove;

@forward './core/theming/theming' show $theme-ignore-duplication-warnings,
$theme-legacy-inspection-api-compatibility;
@forward './core/theming/theming' as private-* show private-clamp-density;
@forward './core/theming/palette' show $red-palette, $pink-palette, $indigo-palette,
$purple-palette, $deep-purple-palette, $blue-palette, $light-blue-palette, $cyan-palette,
$teal-palette, $green-palette, $light-green-palette, $lime-palette, $yellow-palette,
$amber-palette, $orange-palette, $deep-orange-palette, $brown-palette, $grey-palette,
$gray-palette, $blue-grey-palette, $blue-gray-palette, $light-theme-background-palette,
$dark-theme-background-palette, $light-theme-foreground-palette, $dark-theme-foreground-palette;
@forward './core/typography/typography' show define-typography-level, define-rem-typography-config,
define-typography-config, typography-hierarchy, define-legacy-typography-config;
@forward './core/typography/typography-utils' show typography-level,
font-size, line-height, font-weight, letter-spacing, font-family, font-shorthand;
@forward './core/typography/typography' show typography-hierarchy;
@forward './core/tokens/m2' show m2-tokens-from-theme;

// Private/Internal
Expand Down Expand Up @@ -131,7 +126,3 @@
tooltip-typography, tooltip-density, tooltip-base;
@forward './tree/tree-theme' as tree-* show tree-theme, tree-color, tree-typography, tree-density,
tree-base;

// New theming APIs
@forward './core/theming/inspection' show get-theme-version, get-theme-type, get-theme-color,
get-theme-typography, get-theme-density, theme-has, theme-remove;
54 changes: 54 additions & 0 deletions core/_m2.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// M2-specific theming APIs which are separated out into this file so they
// can be renamed conditionally depending on whether we're in 1P or 3P.
@forward './theming/theming' show
define-light-theme,
define-dark-theme,
define-palette,
get-contrast-color-from-palette,
get-color-from-palette,
get-color-config,
get-typography-config,
get-density-config;

@forward './theming/palette' show
$red-palette,
$pink-palette,
$indigo-palette,
$purple-palette,
$deep-purple-palette,
$blue-palette,
$light-blue-palette,
$cyan-palette,
$teal-palette,
$green-palette,
$light-green-palette,
$lime-palette,
$yellow-palette,
$amber-palette,
$orange-palette,
$deep-orange-palette,
$brown-palette,
$grey-palette,
$gray-palette,
$blue-grey-palette,
$blue-gray-palette,
$light-theme-background-palette,
$dark-theme-background-palette,
$light-theme-foreground-palette,
$dark-theme-foreground-palette;


@forward './typography/typography' show
define-typography-level,
define-rem-typography-config,
define-typography-config,
define-legacy-typography-config;

@forward './typography/typography-utils' show
typography-level,
font-size,
line-height,
font-weight,
letter-spacing,
font-family,
font-shorthand;
2 changes: 1 addition & 1 deletion core/typography/_definition.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
/// @param {Map} $input Configuration for the "input" typographic level.
/// @returns {Map} A typography config for the application.
///
/// @deprecated Use `mat.define-typography-config` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
/// @deprecated Use `mat.m2-define-typography-config` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
/// @breaking-change 17.0.0
@function define-legacy-typography-config(
$font-family: 'Roboto, "Helvetica Neue", sans-serif',
Expand Down

0 comments on commit c8ec954

Please sign in to comment.