@hashicorp/design-system-components 4.24.2-rc-20251112142624 → 4.24.2-rc-20251125162348
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/declarations/components/hds/theme-context/index.d.ts +24 -0
- package/declarations/components/hds/theme-context/types.d.ts +19 -0
- package/declarations/components.d.ts +1 -0
- package/declarations/services/hds-theming.d.ts +3 -15
- package/declarations/template-registry.d.ts +3 -0
- package/dist/_app_/components/hds/theme-context.js +1 -0
- package/dist/components/hds/theme-context/index.js +45 -0
- package/dist/components/hds/theme-context/index.js.map +1 -0
- package/dist/components/hds/theme-context/types.js +27 -0
- package/dist/components/hds/theme-context/types.js.map +1 -0
- package/dist/components.js +1 -0
- package/dist/components.js.map +1 -1
- package/dist/services/hds-theming.js +17 -45
- package/dist/services/hds-theming.js.map +1 -1
- package/dist/services.js +1 -1
- package/dist/styles/@hashicorp/design-system-components-common.css +296 -264
- package/dist/styles/@hashicorp/design-system-components-common.css.map +1 -1
- package/dist/styles/@hashicorp/design-system-components-common.scss +1 -0
- package/dist/styles/@hashicorp/design-system-components.css +396 -294
- package/dist/styles/@hashicorp/design-system-components.css.map +1 -1
- package/dist/styles/components/badge-count.scss +26 -76
- package/dist/styles/components/badge.scss +10 -32
- package/dist/styles/components/button.scss +5 -0
- package/dist/styles/components/dropdown.scss +3 -5
- package/dist/styles/components/form/file-input.scss +2 -2
- package/dist/styles/components/form/key-value-inputs.scss +2 -4
- package/dist/styles/components/index.scss +1 -0
- package/dist/styles/components/theme-context.scss +12 -0
- package/dist/styles/mixins/_button.scss +82 -129
- package/dist/styles/mixins/_carbonization.scss +31 -0
- package/dist/styles/mixins/_interactive-dark-theme.scss +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) HashiCorp, Inc.
|
|
3
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
*/
|
|
5
|
+
import Component from '@glimmer/component';
|
|
6
|
+
import type Owner from '@ember/owner';
|
|
7
|
+
import type { HdsThemeContexts } from './types.ts';
|
|
8
|
+
import type { HdsThemes, HdsModes } from '../../../services/hds-theming.ts';
|
|
9
|
+
export interface HdsThemeContextSignature {
|
|
10
|
+
Args: {
|
|
11
|
+
context: HdsThemeContexts;
|
|
12
|
+
};
|
|
13
|
+
Blocks: {
|
|
14
|
+
default: [];
|
|
15
|
+
};
|
|
16
|
+
Element: HTMLElement;
|
|
17
|
+
}
|
|
18
|
+
export declare const CONTEXTUAL_THEMES: HdsThemes[];
|
|
19
|
+
export declare const CONTEXTUAL_MODES: HdsModes[];
|
|
20
|
+
export declare const CONTEXTUAL_VALUES: HdsThemeContexts[];
|
|
21
|
+
export default class HdsThemeContext extends Component<HdsThemeContextSignature> {
|
|
22
|
+
constructor(owner: Owner, args: HdsThemeContextSignature['Args']);
|
|
23
|
+
get classNames(): string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) HashiCorp, Inc.
|
|
3
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { HdsThemeValues, HdsModesLightValues, HdsModesDarkValues } from '../../../services/hds-theming.ts';
|
|
6
|
+
import type { HdsThemes, HdsModes } from '../../../services/hds-theming.ts';
|
|
7
|
+
export declare const HdsThemeContextThemesValues: {
|
|
8
|
+
readonly Default: HdsThemeValues.Default;
|
|
9
|
+
readonly System: HdsThemeValues.System;
|
|
10
|
+
readonly Light: HdsThemeValues.Light;
|
|
11
|
+
readonly Dark: HdsThemeValues.Dark;
|
|
12
|
+
};
|
|
13
|
+
export declare const HdsThemeContextModesValues: {
|
|
14
|
+
readonly CdsG0: HdsModesLightValues.CdsG0;
|
|
15
|
+
readonly CdsG10: HdsModesLightValues.CdsG10;
|
|
16
|
+
readonly CdsG90: HdsModesDarkValues.CdsG90;
|
|
17
|
+
readonly CdsG100: HdsModesDarkValues.CdsG100;
|
|
18
|
+
};
|
|
19
|
+
export type HdsThemeContexts = HdsThemes | Exclude<HdsModes, 'default'>;
|
|
@@ -223,6 +223,7 @@ export { default as HdsTextBody } from './components/hds/text/body.ts';
|
|
|
223
223
|
export { default as HdsTextCode } from './components/hds/text/code.ts';
|
|
224
224
|
export { default as HdsTextDisplay } from './components/hds/text/display.ts';
|
|
225
225
|
export * from './components/hds/text/types.ts';
|
|
226
|
+
export { default as HdsThemeContext } from './components/hds/theme-context/index.ts';
|
|
226
227
|
export { default as HdsThemeSwitcher } from './components/hds/theme-switcher/index.ts';
|
|
227
228
|
export { default as HdsTime } from './components/hds/time/index.ts';
|
|
228
229
|
export { default as HdsTimeSingle } from './components/hds/time/single.ts';
|
|
@@ -5,31 +5,24 @@ export declare enum HdsThemeValues {
|
|
|
5
5
|
Light = "light",
|
|
6
6
|
Dark = "dark"
|
|
7
7
|
}
|
|
8
|
-
declare enum HdsModesBaseValues {
|
|
8
|
+
export declare enum HdsModesBaseValues {
|
|
9
9
|
Default = "default"
|
|
10
10
|
}
|
|
11
|
-
declare enum HdsModesLightValues {
|
|
11
|
+
export declare enum HdsModesLightValues {
|
|
12
12
|
CdsG0 = "cds-g0",
|
|
13
13
|
CdsG10 = "cds-g10"
|
|
14
14
|
}
|
|
15
|
-
declare enum HdsModesDarkValues {
|
|
15
|
+
export declare enum HdsModesDarkValues {
|
|
16
16
|
CdsG90 = "cds-g90",
|
|
17
17
|
CdsG100 = "cds-g100"
|
|
18
18
|
}
|
|
19
|
-
export declare enum HdsCssSelectorsValues {
|
|
20
|
-
Data = "data",
|
|
21
|
-
Class = "class"
|
|
22
|
-
}
|
|
23
19
|
export type HdsThemes = `${HdsThemeValues}`;
|
|
24
20
|
export type HdsModes = `${HdsModesBaseValues}` | `${HdsModesLightValues}` | `${HdsModesDarkValues}`;
|
|
25
21
|
export type HdsModesLight = `${HdsModesLightValues}`;
|
|
26
22
|
export type HdsModesDark = `${HdsModesDarkValues}`;
|
|
27
|
-
export type HdsCssSelectors = `${HdsCssSelectorsValues}`;
|
|
28
23
|
type HdsThemingOptions = {
|
|
29
24
|
lightTheme: HdsModesLight;
|
|
30
25
|
darkTheme: HdsModesDark;
|
|
31
|
-
cssSelector: HdsCssSelectors;
|
|
32
|
-
isComplex: boolean;
|
|
33
26
|
};
|
|
34
27
|
type SetThemeArgs = {
|
|
35
28
|
theme: HdsThemes | undefined;
|
|
@@ -45,18 +38,14 @@ export declare const THEMES: HdsThemes[];
|
|
|
45
38
|
export declare const MODES_LIGHT: HdsModesLight[];
|
|
46
39
|
export declare const MODES_DARK: HdsModesDark[];
|
|
47
40
|
export declare const MODES: HdsModes[];
|
|
48
|
-
export declare const HDS_THEMING_DATA_SELECTOR = "data-hds-theme";
|
|
49
|
-
export declare const HDS_THEMING_CLASS_SELECTOR_PREFIX = "hds-theme";
|
|
50
41
|
export declare const HDS_THEMING_LOCALSTORAGE_DATA = "hds-theming-data";
|
|
51
42
|
export declare const DEFAULT_THEMING_OPTION_LIGHT_THEME = HdsModesLightValues.CdsG0;
|
|
52
43
|
export declare const DEFAULT_THEMING_OPTION_DARK_THEME = HdsModesDarkValues.CdsG100;
|
|
53
|
-
export declare const DEFAULT_THEMING_OPTION_CSS_SELECTOR = "data";
|
|
54
44
|
export default class HdsThemingService extends Service {
|
|
55
45
|
_currentTheme: HdsThemes | undefined;
|
|
56
46
|
_currentMode: HdsModes | undefined;
|
|
57
47
|
_currentLightTheme: HdsModesLight;
|
|
58
48
|
_currentDarkTheme: HdsModesDark;
|
|
59
|
-
_currentCssSelector: HdsCssSelectors;
|
|
60
49
|
globalOnSetTheme: OnSetThemeCallback | undefined;
|
|
61
50
|
initializeTheme(): void;
|
|
62
51
|
setTheme({ theme, options, onSetTheme }: SetThemeArgs): void;
|
|
@@ -64,6 +53,5 @@ export default class HdsThemingService extends Service {
|
|
|
64
53
|
get currentMode(): HdsModes | undefined;
|
|
65
54
|
get currentLightTheme(): HdsModesLight;
|
|
66
55
|
get currentDarkTheme(): HdsModesDark;
|
|
67
|
-
get currentCssSelector(): HdsCssSelectors;
|
|
68
56
|
}
|
|
69
57
|
export {};
|
|
@@ -226,6 +226,7 @@ import type HdsTagComponent from './components/hds/tag';
|
|
|
226
226
|
import type HdsTooltipButtonComponent from './components/hds/tooltip-button';
|
|
227
227
|
import type HdsToastComponent from './components/hds/toast';
|
|
228
228
|
import type HdsTextCodeComponent from './components/hds/text/code';
|
|
229
|
+
import type HdsThemeContextComponent from './components/hds/theme-context';
|
|
229
230
|
import type HdsThemeSwitcherComponent from './components/hds/theme-switcher';
|
|
230
231
|
import type HdsTimeComponent from './components/hds/time';
|
|
231
232
|
import type HdsTimeSingleComponent from './components/hds/time/single';
|
|
@@ -718,6 +719,8 @@ export default interface HdsComponentsRegistry {
|
|
|
718
719
|
'hds/tooltip-button': typeof HdsTooltipButtonComponent;
|
|
719
720
|
'Hds::Toast': typeof HdsToastComponent;
|
|
720
721
|
'hds/toast': typeof HdsToastComponent;
|
|
722
|
+
'Hds::ThemeContext': typeof HdsThemeContextComponent;
|
|
723
|
+
'hds/theme-Context': typeof HdsThemeContextComponent;
|
|
721
724
|
'Hds::ThemeSwitcher': typeof HdsThemeSwitcherComponent;
|
|
722
725
|
'hds/theme-switcher': typeof HdsThemeSwitcherComponent;
|
|
723
726
|
'Hds::Time': typeof HdsTimeComponent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@hashicorp/design-system-components/components/hds/theme-context/index";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { assert } from '@ember/debug';
|
|
3
|
+
import { HdsThemeContextThemesValues, HdsThemeContextModesValues } from './types.js';
|
|
4
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
5
|
+
import { setComponentTemplate } from '@ember/component';
|
|
6
|
+
|
|
7
|
+
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<div class={{this.classNames}} ...attributes>{{yield}}</div>");
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Copyright (c) HashiCorp, Inc.
|
|
11
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const CONTEXTUAL_THEMES = Object.values(HdsThemeContextThemesValues);
|
|
15
|
+
const CONTEXTUAL_MODES = Object.values(HdsThemeContextModesValues);
|
|
16
|
+
const CONTEXTUAL_VALUES = [...CONTEXTUAL_THEMES, ...CONTEXTUAL_MODES];
|
|
17
|
+
class HdsThemeContext extends Component {
|
|
18
|
+
constructor(owner, args) {
|
|
19
|
+
super(owner, args);
|
|
20
|
+
const {
|
|
21
|
+
context
|
|
22
|
+
} = args;
|
|
23
|
+
assert(`@context for "Hds::ThemeContext" must be one of the following: ${CONTEXTUAL_VALUES.join(', ')}; received: ${context}`, CONTEXTUAL_VALUES.includes(context));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Get the class names to apply to the component.
|
|
27
|
+
get classNames() {
|
|
28
|
+
const classes = ['hds-theme-context'];
|
|
29
|
+
const {
|
|
30
|
+
context
|
|
31
|
+
} = this.args;
|
|
32
|
+
|
|
33
|
+
// add "theme" or "mode" classes based on the @context arguments
|
|
34
|
+
if (CONTEXTUAL_THEMES.includes(context)) {
|
|
35
|
+
classes.push(`hds-theme-${context}`);
|
|
36
|
+
} else if (CONTEXTUAL_MODES.includes(context)) {
|
|
37
|
+
classes.push(`hds-mode-${context}`);
|
|
38
|
+
}
|
|
39
|
+
return classes.join(' ');
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
setComponentTemplate(TEMPLATE, HdsThemeContext);
|
|
43
|
+
|
|
44
|
+
export { CONTEXTUAL_MODES, CONTEXTUAL_THEMES, CONTEXTUAL_VALUES, HdsThemeContext as default };
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/theme-context/index.ts"],"sourcesContent":["/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { assert } from '@ember/debug';\nimport type Owner from '@ember/owner';\n\nimport {\n HdsThemeContextThemesValues,\n HdsThemeContextModesValues,\n} from './types.ts';\nimport type { HdsThemeContexts } from './types.ts';\n\nimport type { HdsThemes, HdsModes } from '../../../services/hds-theming.ts';\n\nexport interface HdsThemeContextSignature {\n Args: {\n // it can be an `HdsTheme` or an `HdsMode`\n context: HdsThemeContexts;\n };\n Blocks: {\n default: [];\n };\n Element: HTMLElement;\n}\n\nexport const CONTEXTUAL_THEMES: HdsThemes[] = Object.values(\n HdsThemeContextThemesValues\n);\nexport const CONTEXTUAL_MODES: HdsModes[] = Object.values(\n HdsThemeContextModesValues\n);\nexport const CONTEXTUAL_VALUES: HdsThemeContexts[] = [\n ...CONTEXTUAL_THEMES,\n ...CONTEXTUAL_MODES,\n];\n\nexport default class HdsThemeContext extends Component<HdsThemeContextSignature> {\n constructor(owner: Owner, args: HdsThemeContextSignature['Args']) {\n super(owner, args);\n\n const { context } = args;\n\n assert(\n `@context for \"Hds::ThemeContext\" must be one of the following: ${CONTEXTUAL_VALUES.join(\n ', '\n )}; received: ${context}`,\n CONTEXTUAL_VALUES.includes(context)\n );\n }\n\n // Get the class names to apply to the component.\n get classNames(): string {\n const classes = ['hds-theme-context'];\n\n const { context } = this.args;\n\n // add \"theme\" or \"mode\" classes based on the @context arguments\n if (CONTEXTUAL_THEMES.includes(context as HdsThemes)) {\n classes.push(`hds-theme-${context}`);\n } else if (CONTEXTUAL_MODES.includes(context as HdsModes)) {\n classes.push(`hds-mode-${context}`);\n }\n\n return classes.join(' ');\n }\n}\n"],"names":["CONTEXTUAL_THEMES","Object","values","HdsThemeContextThemesValues","CONTEXTUAL_MODES","HdsThemeContextModesValues","CONTEXTUAL_VALUES","HdsThemeContext","Component","constructor","owner","args","context","assert","join","includes","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,0 +1,27 @@
|
|
|
1
|
+
import { HdsThemeValues, HdsModesDarkValues, HdsModesLightValues } from '../../../services/hds-theming.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Copyright (c) HashiCorp, Inc.
|
|
5
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// re-export the enum values for the `HdsThemes` to use in the component
|
|
9
|
+
// note: using `as const` ensures Object.values() returns only the values (not keys _and_ values)
|
|
10
|
+
const HdsThemeContextThemesValues = {
|
|
11
|
+
Default: HdsThemeValues.Default,
|
|
12
|
+
System: HdsThemeValues.System,
|
|
13
|
+
Light: HdsThemeValues.Light,
|
|
14
|
+
Dark: HdsThemeValues.Dark
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// re-export the enum values for the `HdsModes` to use in the component
|
|
18
|
+
// note: using `as const` ensures Object.values() returns only the values (not keys _and_ values)
|
|
19
|
+
const HdsThemeContextModesValues = {
|
|
20
|
+
CdsG0: HdsModesLightValues.CdsG0,
|
|
21
|
+
CdsG10: HdsModesLightValues.CdsG10,
|
|
22
|
+
CdsG90: HdsModesDarkValues.CdsG90,
|
|
23
|
+
CdsG100: HdsModesDarkValues.CdsG100
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { HdsThemeContextModesValues, HdsThemeContextThemesValues };
|
|
27
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../../src/components/hds/theme-context/types.ts"],"sourcesContent":["/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport {\n HdsThemeValues,\n HdsModesLightValues,\n HdsModesDarkValues,\n} from '../../../services/hds-theming.ts';\n\nimport type { HdsThemes, HdsModes } from '../../../services/hds-theming.ts';\n\n// re-export the enum values for the `HdsThemes` to use in the component\n// note: using `as const` ensures Object.values() returns only the values (not keys _and_ values)\nexport const HdsThemeContextThemesValues = {\n Default: HdsThemeValues.Default,\n System: HdsThemeValues.System,\n Light: HdsThemeValues.Light,\n Dark: HdsThemeValues.Dark,\n} as const;\n\n// re-export the enum values for the `HdsModes` to use in the component\n// note: using `as const` ensures Object.values() returns only the values (not keys _and_ values)\nexport const HdsThemeContextModesValues = {\n CdsG0: HdsModesLightValues.CdsG0,\n CdsG10: HdsModesLightValues.CdsG10,\n CdsG90: HdsModesDarkValues.CdsG90,\n CdsG100: HdsModesDarkValues.CdsG100,\n} as const;\n\nexport type HdsThemeContexts = HdsThemes | Exclude<HdsModes, 'default'>;\n"],"names":["HdsThemeContextThemesValues","Default","HdsThemeValues","System","Light","Dark","HdsThemeContextModesValues","CdsG0","HdsModesLightValues","CdsG10","CdsG90","HdsModesDarkValues","CdsG100"],"mappings":";;AAAA;AACA;AACA;AACA;;AAUA;AACA;AACO,MAAMA,2BAA2B,GAAG;EACzCC,OAAO,EAAEC,cAAc,CAACD,OAAO;EAC/BE,MAAM,EAAED,cAAc,CAACC,MAAM;EAC7BC,KAAK,EAAEF,cAAc,CAACE,KAAK;EAC3BC,IAAI,EAAEH,cAAc,CAACG;AACvB;;AAEA;AACA;AACO,MAAMC,0BAA0B,GAAG;EACxCC,KAAK,EAAEC,mBAAmB,CAACD,KAAK;EAChCE,MAAM,EAAED,mBAAmB,CAACC,MAAM;EAClCC,MAAM,EAAEC,kBAAkB,CAACD,MAAM;EACjCE,OAAO,EAAED,kBAAkB,CAACC;AAC9B;;;;"}
|
package/dist/components.js
CHANGED
|
@@ -219,6 +219,7 @@ export { default as HdsTextBody } from './components/hds/text/body.js';
|
|
|
219
219
|
export { default as HdsTextCode } from './components/hds/text/code.js';
|
|
220
220
|
export { default as HdsTextDisplay } from './components/hds/text/display.js';
|
|
221
221
|
export { HdsTextAlignValues, HdsTextColorValues, HdsTextGroupValues, HdsTextSizeValues, HdsTextWeightValues } from './components/hds/text/types.js';
|
|
222
|
+
export { default as HdsThemeContext } from './components/hds/theme-context/index.js';
|
|
222
223
|
export { default as HdsThemeSwitcher } from './components/hds/theme-switcher/index.js';
|
|
223
224
|
export { default as HdsTime } from './components/hds/time/index.js';
|
|
224
225
|
export { default as HdsTimeSingle } from './components/hds/time/single.js';
|
package/dist/components.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"components.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -14,35 +14,27 @@ let HdsThemeValues = /*#__PURE__*/function (HdsThemeValues) {
|
|
|
14
14
|
}({});
|
|
15
15
|
|
|
16
16
|
// TODO! understand if we really need this
|
|
17
|
-
|
|
17
|
+
let HdsModesBaseValues = /*#__PURE__*/function (HdsModesBaseValues) {
|
|
18
18
|
HdsModesBaseValues["Default"] = "default";
|
|
19
19
|
return HdsModesBaseValues;
|
|
20
|
-
}(
|
|
21
|
-
|
|
20
|
+
}({});
|
|
21
|
+
let HdsModesLightValues = /*#__PURE__*/function (HdsModesLightValues) {
|
|
22
22
|
HdsModesLightValues["CdsG0"] = "cds-g0";
|
|
23
23
|
HdsModesLightValues["CdsG10"] = "cds-g10";
|
|
24
24
|
return HdsModesLightValues;
|
|
25
|
-
}(
|
|
26
|
-
|
|
25
|
+
}({});
|
|
26
|
+
let HdsModesDarkValues = /*#__PURE__*/function (HdsModesDarkValues) {
|
|
27
27
|
HdsModesDarkValues["CdsG90"] = "cds-g90";
|
|
28
28
|
HdsModesDarkValues["CdsG100"] = "cds-g100";
|
|
29
29
|
return HdsModesDarkValues;
|
|
30
|
-
}(HdsModesDarkValues || {});
|
|
31
|
-
let HdsCssSelectorsValues = /*#__PURE__*/function (HdsCssSelectorsValues) {
|
|
32
|
-
HdsCssSelectorsValues["Data"] = "data";
|
|
33
|
-
HdsCssSelectorsValues["Class"] = "class";
|
|
34
|
-
return HdsCssSelectorsValues;
|
|
35
30
|
}({});
|
|
36
31
|
const THEMES = Object.values(HdsThemeValues);
|
|
37
32
|
const MODES_LIGHT = Object.values(HdsModesLightValues);
|
|
38
33
|
const MODES_DARK = Object.values(HdsModesDarkValues);
|
|
39
34
|
const MODES = [...Object.values(HdsModesBaseValues), ...MODES_LIGHT, ...MODES_DARK];
|
|
40
|
-
const HDS_THEMING_DATA_SELECTOR = 'data-hds-theme';
|
|
41
|
-
const HDS_THEMING_CLASS_SELECTOR_PREFIX = 'hds-theme';
|
|
42
35
|
const HDS_THEMING_LOCALSTORAGE_DATA = 'hds-theming-data';
|
|
43
36
|
const DEFAULT_THEMING_OPTION_LIGHT_THEME = HdsModesLightValues.CdsG0;
|
|
44
37
|
const DEFAULT_THEMING_OPTION_DARK_THEME = HdsModesDarkValues.CdsG100;
|
|
45
|
-
const DEFAULT_THEMING_OPTION_CSS_SELECTOR = 'data';
|
|
46
38
|
class HdsThemingService extends Service {
|
|
47
39
|
static {
|
|
48
40
|
g(this.prototype, "_currentTheme", [tracked], function () {
|
|
@@ -68,12 +60,6 @@ class HdsThemingService extends Service {
|
|
|
68
60
|
});
|
|
69
61
|
}
|
|
70
62
|
#_currentDarkTheme = (i(this, "_currentDarkTheme"), void 0);
|
|
71
|
-
static {
|
|
72
|
-
g(this.prototype, "_currentCssSelector", [tracked], function () {
|
|
73
|
-
return DEFAULT_THEMING_OPTION_CSS_SELECTOR;
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
#_currentCssSelector = (i(this, "_currentCssSelector"), void 0);
|
|
77
63
|
static {
|
|
78
64
|
g(this.prototype, "globalOnSetTheme", [tracked]);
|
|
79
65
|
}
|
|
@@ -100,45 +86,38 @@ class HdsThemingService extends Service {
|
|
|
100
86
|
onSetTheme
|
|
101
87
|
}) {
|
|
102
88
|
if (options !== undefined) {
|
|
103
|
-
// if we have new options, we override the current ones (`lightTheme` / `darkTheme`
|
|
89
|
+
// if we have new options, we override the current ones (`lightTheme` / `darkTheme`)
|
|
104
90
|
// these options can be used by consumers that want to customize how they apply theming
|
|
105
91
|
// (and used by the showcase for the custom theming / theme switching logic)
|
|
106
|
-
if (Object.hasOwn(options, 'lightTheme') && Object.hasOwn(options, 'darkTheme')
|
|
92
|
+
if (Object.hasOwn(options, 'lightTheme') && Object.hasOwn(options, 'darkTheme')) {
|
|
107
93
|
const {
|
|
108
94
|
lightTheme,
|
|
109
|
-
darkTheme
|
|
110
|
-
cssSelector
|
|
95
|
+
darkTheme
|
|
111
96
|
} = options;
|
|
112
97
|
this._currentLightTheme = lightTheme;
|
|
113
98
|
this._currentDarkTheme = darkTheme;
|
|
114
|
-
this._currentCssSelector = cssSelector;
|
|
115
99
|
} else {
|
|
116
100
|
// fallback if something goes wrong
|
|
117
101
|
this._currentLightTheme = DEFAULT_THEMING_OPTION_LIGHT_THEME;
|
|
118
102
|
this._currentDarkTheme = DEFAULT_THEMING_OPTION_DARK_THEME;
|
|
119
|
-
this._currentCssSelector = DEFAULT_THEMING_OPTION_CSS_SELECTOR;
|
|
120
103
|
}
|
|
121
104
|
}
|
|
122
105
|
|
|
123
106
|
// set the current theme/mode (`currentTheme` / `currentMode`)
|
|
124
|
-
let cssSelectorPartial;
|
|
125
107
|
if (theme === undefined ||
|
|
126
108
|
// standard (no theming)
|
|
127
109
|
!THEMES.includes(theme) // handle possible errors
|
|
128
110
|
) {
|
|
129
111
|
this._currentTheme = undefined;
|
|
130
112
|
this._currentMode = undefined;
|
|
131
|
-
cssSelectorPartial = undefined;
|
|
132
113
|
} else if (theme === HdsThemeValues.Default // default (original HDS)
|
|
133
114
|
) {
|
|
134
115
|
this._currentTheme = HdsThemeValues.Default;
|
|
135
116
|
this._currentMode = undefined;
|
|
136
|
-
cssSelectorPartial = HdsThemeValues.Default;
|
|
137
117
|
} else if (theme === HdsThemeValues.System // system (prefers-color-scheme)
|
|
138
118
|
) {
|
|
139
119
|
this._currentTheme = HdsThemeValues.System;
|
|
140
120
|
this._currentMode = undefined;
|
|
141
|
-
cssSelectorPartial = HdsThemeValues.System;
|
|
142
121
|
} else {
|
|
143
122
|
this._currentTheme = theme;
|
|
144
123
|
if (this._currentTheme === HdsThemeValues.Light) {
|
|
@@ -147,7 +126,6 @@ class HdsThemingService extends Service {
|
|
|
147
126
|
if (this._currentTheme === HdsThemeValues.Dark) {
|
|
148
127
|
this._currentMode = this._currentDarkTheme;
|
|
149
128
|
}
|
|
150
|
-
cssSelectorPartial = options?.isComplex ? this._currentMode : this._currentTheme;
|
|
151
129
|
}
|
|
152
130
|
|
|
153
131
|
// IMPORTANT: for this to work, it needs to be the HTML tag (it's the `:root` in CSS)
|
|
@@ -155,16 +133,14 @@ class HdsThemingService extends Service {
|
|
|
155
133
|
if (!rootElement) {
|
|
156
134
|
return;
|
|
157
135
|
}
|
|
158
|
-
// remove or update the CSS selectors applied to the root element (depending on the `theme`
|
|
159
|
-
rootElement.
|
|
160
|
-
const hdsThemingClassesToRemove = Array.from(rootElement.classList).filter(className => className.startsWith(`${HDS_THEMING_CLASS_SELECTOR_PREFIX}-`));
|
|
136
|
+
// remove or update the CSS selectors applied to the root element (depending on the `theme`/`mode` arguments)
|
|
137
|
+
const hdsThemingClassesToRemove = Array.from(rootElement.classList).filter(className => className.match(/^hds-(theme|mode)/));
|
|
161
138
|
rootElement.classList.remove(...hdsThemingClassesToRemove);
|
|
162
|
-
if (
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
139
|
+
if (this._currentTheme !== undefined) {
|
|
140
|
+
rootElement.classList.add(`hds-theme-${this._currentTheme}`);
|
|
141
|
+
}
|
|
142
|
+
if (this._currentMode !== undefined) {
|
|
143
|
+
rootElement.classList.add(`hds-mode-${this._currentMode}`);
|
|
168
144
|
}
|
|
169
145
|
|
|
170
146
|
// store the current theme and theming options in local storage (unless undefined)
|
|
@@ -172,8 +148,7 @@ class HdsThemingService extends Service {
|
|
|
172
148
|
theme: this._currentTheme,
|
|
173
149
|
options: {
|
|
174
150
|
lightTheme: this._currentLightTheme,
|
|
175
|
-
darkTheme: this._currentDarkTheme
|
|
176
|
-
cssSelector: this._currentCssSelector
|
|
151
|
+
darkTheme: this._currentDarkTheme
|
|
177
152
|
}
|
|
178
153
|
}));
|
|
179
154
|
|
|
@@ -208,10 +183,7 @@ class HdsThemingService extends Service {
|
|
|
208
183
|
get currentDarkTheme() {
|
|
209
184
|
return this._currentDarkTheme ?? DEFAULT_THEMING_OPTION_DARK_THEME;
|
|
210
185
|
}
|
|
211
|
-
get currentCssSelector() {
|
|
212
|
-
return this._currentCssSelector ?? DEFAULT_THEMING_OPTION_CSS_SELECTOR;
|
|
213
|
-
}
|
|
214
186
|
}
|
|
215
187
|
|
|
216
|
-
export {
|
|
188
|
+
export { DEFAULT_THEMING_OPTION_DARK_THEME, DEFAULT_THEMING_OPTION_LIGHT_THEME, HDS_THEMING_LOCALSTORAGE_DATA, HdsModesBaseValues, HdsModesDarkValues, HdsModesLightValues, HdsThemeValues, MODES, MODES_DARK, MODES_LIGHT, THEMES, HdsThemingService as default };
|
|
217
189
|
//# sourceMappingURL=hds-theming.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hds-theming.js","sources":["../../src/services/hds-theming.ts"],"sourcesContent":["import Service from '@ember/service';\nimport { tracked } from '@glimmer/tracking';\n\nexport enum HdsThemeValues {\n // default (original HDS)\n Default = 'default',\n // system settings (prefers-color-scheme)\n System = 'system',\n // user settings for dark/light\n Light = 'light',\n Dark = 'dark',\n}\n\n// TODO! understand if we really need this\nenum HdsModesBaseValues {\n Default = 'default',\n}\n\nenum HdsModesLightValues {\n CdsG0 = 'cds-g0',\n CdsG10 = 'cds-g10',\n}\n\nenum HdsModesDarkValues {\n CdsG90 = 'cds-g90',\n CdsG100 = 'cds-g100',\n}\n\nexport enum HdsCssSelectorsValues {\n Data = 'data',\n Class = 'class',\n}\n\nexport type HdsThemes = `${HdsThemeValues}`;\nexport type HdsModes =\n | `${HdsModesBaseValues}`\n | `${HdsModesLightValues}`\n | `${HdsModesDarkValues}`;\nexport type HdsModesLight = `${HdsModesLightValues}`;\nexport type HdsModesDark = `${HdsModesDarkValues}`;\nexport type HdsCssSelectors = `${HdsCssSelectorsValues}`;\n\ntype HdsThemingOptions = {\n lightTheme: HdsModesLight;\n darkTheme: HdsModesDark;\n cssSelector: HdsCssSelectors;\n isComplex: boolean;\n};\n\ntype SetThemeArgs = {\n theme: HdsThemes | undefined;\n options?: HdsThemingOptions;\n onSetTheme?: OnSetThemeCallback;\n};\n\nexport type OnSetThemeCallbackArgs = {\n currentTheme: HdsThemes | undefined;\n currentMode: HdsModes | undefined;\n};\n\nexport type OnSetThemeCallback = (args: OnSetThemeCallbackArgs) => void;\n\nexport const THEMES: HdsThemes[] = Object.values(HdsThemeValues);\nexport const MODES_LIGHT: HdsModesLight[] = Object.values(HdsModesLightValues);\nexport const MODES_DARK: HdsModesDark[] = Object.values(HdsModesDarkValues);\nexport const MODES: HdsModes[] = [\n ...Object.values(HdsModesBaseValues),\n ...MODES_LIGHT,\n ...MODES_DARK,\n];\n\nexport const HDS_THEMING_DATA_SELECTOR = 'data-hds-theme';\nexport const HDS_THEMING_CLASS_SELECTOR_PREFIX = 'hds-theme';\n\nexport const HDS_THEMING_LOCALSTORAGE_DATA = 'hds-theming-data';\n\nexport const DEFAULT_THEMING_OPTION_LIGHT_THEME = HdsModesLightValues.CdsG0;\nexport const DEFAULT_THEMING_OPTION_DARK_THEME = HdsModesDarkValues.CdsG100;\nexport const DEFAULT_THEMING_OPTION_CSS_SELECTOR = 'data';\n\nexport default class HdsThemingService extends Service {\n @tracked _currentTheme: HdsThemes | undefined = undefined;\n @tracked _currentMode: HdsModes | undefined = undefined;\n @tracked _currentLightTheme: HdsModesLight =\n DEFAULT_THEMING_OPTION_LIGHT_THEME;\n @tracked _currentDarkTheme: HdsModesDark = DEFAULT_THEMING_OPTION_DARK_THEME;\n @tracked _currentCssSelector: HdsCssSelectors =\n DEFAULT_THEMING_OPTION_CSS_SELECTOR;\n @tracked globalOnSetTheme: OnSetThemeCallback | undefined;\n\n initializeTheme() {\n const rawStoredThemingData = localStorage.getItem(\n HDS_THEMING_LOCALSTORAGE_DATA\n );\n if (rawStoredThemingData !== null) {\n const storedThemingData: unknown = JSON.parse(rawStoredThemingData);\n if (storedThemingData) {\n const { theme, options } = storedThemingData as {\n theme: HdsThemes | undefined;\n options: HdsThemingOptions;\n };\n this.setTheme({\n theme,\n options,\n });\n }\n }\n }\n\n setTheme({ theme, options, onSetTheme }: SetThemeArgs) {\n if (options !== undefined) {\n // if we have new options, we override the current ones (`lightTheme` / `darkTheme` / `cssSelector`)\n // these options can be used by consumers that want to customize how they apply theming\n // (and used by the showcase for the custom theming / theme switching logic)\n if (\n Object.hasOwn(options, 'lightTheme') &&\n Object.hasOwn(options, 'darkTheme') &&\n Object.hasOwn(options, 'cssSelector')\n ) {\n const { lightTheme, darkTheme, cssSelector } = options;\n\n this._currentLightTheme = lightTheme;\n this._currentDarkTheme = darkTheme;\n this._currentCssSelector = cssSelector;\n } else {\n // fallback if something goes wrong\n this._currentLightTheme = DEFAULT_THEMING_OPTION_LIGHT_THEME;\n this._currentDarkTheme = DEFAULT_THEMING_OPTION_DARK_THEME;\n this._currentCssSelector = DEFAULT_THEMING_OPTION_CSS_SELECTOR;\n }\n }\n\n // set the current theme/mode (`currentTheme` / `currentMode`)\n let cssSelectorPartial;\n if (\n theme === undefined || // standard (no theming)\n !THEMES.includes(theme) // handle possible errors\n ) {\n this._currentTheme = undefined;\n this._currentMode = undefined;\n cssSelectorPartial = undefined;\n } else if (\n theme === HdsThemeValues.Default // default (original HDS)\n ) {\n this._currentTheme = HdsThemeValues.Default;\n this._currentMode = undefined;\n cssSelectorPartial = HdsThemeValues.Default;\n } else if (\n theme === HdsThemeValues.System // system (prefers-color-scheme)\n ) {\n this._currentTheme = HdsThemeValues.System;\n this._currentMode = undefined;\n cssSelectorPartial = HdsThemeValues.System;\n } else {\n this._currentTheme = theme;\n if (this._currentTheme === HdsThemeValues.Light) {\n this._currentMode = this._currentLightTheme;\n }\n if (this._currentTheme === HdsThemeValues.Dark) {\n this._currentMode = this._currentDarkTheme;\n }\n cssSelectorPartial = options?.isComplex\n ? this._currentMode\n : this._currentTheme;\n }\n\n // IMPORTANT: for this to work, it needs to be the HTML tag (it's the `:root` in CSS)\n const rootElement = document.querySelector('html');\n\n if (!rootElement) {\n return;\n }\n // remove or update the CSS selectors applied to the root element (depending on the `theme` argument)\n rootElement.removeAttribute(HDS_THEMING_DATA_SELECTOR);\n const hdsThemingClassesToRemove = Array.from(rootElement.classList).filter(\n (className) =>\n className.startsWith(`${HDS_THEMING_CLASS_SELECTOR_PREFIX}-`)\n );\n rootElement.classList.remove(...hdsThemingClassesToRemove);\n if (cssSelectorPartial !== undefined) {\n if (this._currentCssSelector === 'data') {\n rootElement.setAttribute(HDS_THEMING_DATA_SELECTOR, cssSelectorPartial);\n } else if (this._currentCssSelector === 'class') {\n rootElement.classList.add(\n `${HDS_THEMING_CLASS_SELECTOR_PREFIX}-${cssSelectorPartial}`\n );\n }\n }\n\n // store the current theme and theming options in local storage (unless undefined)\n localStorage.setItem(\n HDS_THEMING_LOCALSTORAGE_DATA,\n JSON.stringify({\n theme: this._currentTheme,\n options: {\n lightTheme: this._currentLightTheme,\n darkTheme: this._currentDarkTheme,\n cssSelector: this._currentCssSelector,\n },\n })\n );\n\n // this is a general callback that can be defined globally (by extending the service)\n if (this.globalOnSetTheme) {\n this.globalOnSetTheme({\n currentTheme: this._currentTheme,\n currentMode: this._currentMode,\n });\n }\n\n // this is a \"local\" callback that can be defined \"locally\" (eg. in a theme switcher)\n if (onSetTheme) {\n onSetTheme({\n currentTheme: this._currentTheme,\n currentMode: this._currentMode,\n });\n }\n }\n\n // getters used for reactivity in the components/services using this service\n\n get currentTheme(): HdsThemes | undefined {\n return this._currentTheme;\n }\n\n get currentMode(): HdsModes | undefined {\n return this._currentMode;\n }\n\n get currentLightTheme(): HdsModesLight {\n return this._currentLightTheme ?? DEFAULT_THEMING_OPTION_LIGHT_THEME;\n }\n\n get currentDarkTheme(): HdsModesDark {\n return this._currentDarkTheme ?? DEFAULT_THEMING_OPTION_DARK_THEME;\n }\n\n get currentCssSelector(): HdsCssSelectors {\n return this._currentCssSelector ?? DEFAULT_THEMING_OPTION_CSS_SELECTOR;\n }\n}\n"],"names":["HdsThemeValues","HdsModesBaseValues","HdsModesLightValues","HdsModesDarkValues","HdsCssSelectorsValues","THEMES","Object","values","MODES_LIGHT","MODES_DARK","MODES","HDS_THEMING_DATA_SELECTOR","HDS_THEMING_CLASS_SELECTOR_PREFIX","HDS_THEMING_LOCALSTORAGE_DATA","DEFAULT_THEMING_OPTION_LIGHT_THEME","CdsG0","DEFAULT_THEMING_OPTION_DARK_THEME","CdsG100","DEFAULT_THEMING_OPTION_CSS_SELECTOR","HdsThemingService","Service","g","prototype","tracked","undefined","i","void 0","initializeTheme","rawStoredThemingData","localStorage","getItem","storedThemingData","JSON","parse","theme","options","setTheme","onSetTheme","hasOwn","lightTheme","darkTheme","cssSelector","_currentLightTheme","_currentDarkTheme","_currentCssSelector","cssSelectorPartial","includes","_currentTheme","_currentMode","Default","System","Light","Dark","isComplex","rootElement","document","querySelector","removeAttribute","hdsThemingClassesToRemove","Array","from","classList","filter","className","startsWith","remove","setAttribute","add","setItem","stringify","globalOnSetTheme","currentTheme","currentMode","currentLightTheme","currentDarkTheme","currentCssSelector"],"mappings":";;;;AAGA,IAAYA,cAAc,0BAAdA,cAAc,EAAA;AACxB;EADUA,cAAc,CAAA,SAAA,CAAA,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,SAAS,EAAE,IAAI,CAACG,iBAAiB;QACjCF,WAAW,EAAE,IAAI,CAACG;AACpB;AACF,KAAC,CACH,CAAC;;AAED;IACA,IAAI,IAAI,CAAC0B,gBAAgB,EAAE;MACzB,IAAI,CAACA,gBAAgB,CAAC;QACpBC,YAAY,EAAE,IAAI,CAACxB,aAAa;QAChCyB,WAAW,EAAE,IAAI,CAACxB;AACpB,OAAC,CAAC;AACJ,IAAA;;AAEA;AACA,IAAA,IAAIX,UAAU,EAAE;AACdA,MAAAA,UAAU,CAAC;QACTkC,YAAY,EAAE,IAAI,CAACxB,aAAa;QAChCyB,WAAW,EAAE,IAAI,CAACxB;AACpB,OAAC,CAAC;AACJ,IAAA;AACF,EAAA;;AAEA;;EAEA,IAAIuB,YAAYA,GAA0B;IACxC,OAAO,IAAI,CAACxB,aAAa;AAC3B,EAAA;EAEA,IAAIyB,WAAWA,GAAyB;IACtC,OAAO,IAAI,CAACxB,YAAY;AAC1B,EAAA;EAEA,IAAIyB,iBAAiBA,GAAkB;AACrC,IAAA,OAAO,IAAI,CAAC/B,kBAAkB,IAAI5B,kCAAkC;AACtE,EAAA;EAEA,IAAI4D,gBAAgBA,GAAiB;AACnC,IAAA,OAAO,IAAI,CAAC/B,iBAAiB,IAAI3B,iCAAiC;AACpE,EAAA;EAEA,IAAI2D,kBAAkBA,GAAoB;AACxC,IAAA,OAAO,IAAI,CAAC/B,mBAAmB,IAAI1B,mCAAmC;AACxE,EAAA;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"hds-theming.js","sources":["../../src/services/hds-theming.ts"],"sourcesContent":["import Service from '@ember/service';\nimport { tracked } from '@glimmer/tracking';\n\nexport enum HdsThemeValues {\n // default (original HDS)\n Default = 'default',\n // system settings (prefers-color-scheme)\n System = 'system',\n // user settings for dark/light\n Light = 'light',\n Dark = 'dark',\n}\n\n// TODO! understand if we really need this\nexport enum HdsModesBaseValues {\n Default = 'default',\n}\n\nexport enum HdsModesLightValues {\n CdsG0 = 'cds-g0',\n CdsG10 = 'cds-g10',\n}\n\nexport enum HdsModesDarkValues {\n CdsG90 = 'cds-g90',\n CdsG100 = 'cds-g100',\n}\n\nexport type HdsThemes = `${HdsThemeValues}`;\nexport type HdsModes =\n | `${HdsModesBaseValues}`\n | `${HdsModesLightValues}`\n | `${HdsModesDarkValues}`;\nexport type HdsModesLight = `${HdsModesLightValues}`;\nexport type HdsModesDark = `${HdsModesDarkValues}`;\n\ntype HdsThemingOptions = {\n lightTheme: HdsModesLight;\n darkTheme: HdsModesDark;\n};\n\ntype SetThemeArgs = {\n theme: HdsThemes | undefined;\n options?: HdsThemingOptions;\n onSetTheme?: OnSetThemeCallback;\n};\n\nexport type OnSetThemeCallbackArgs = {\n currentTheme: HdsThemes | undefined;\n currentMode: HdsModes | undefined;\n};\n\nexport type OnSetThemeCallback = (args: OnSetThemeCallbackArgs) => void;\n\nexport const THEMES: HdsThemes[] = Object.values(HdsThemeValues);\nexport const MODES_LIGHT: HdsModesLight[] = Object.values(HdsModesLightValues);\nexport const MODES_DARK: HdsModesDark[] = Object.values(HdsModesDarkValues);\nexport const MODES: HdsModes[] = [\n ...Object.values(HdsModesBaseValues),\n ...MODES_LIGHT,\n ...MODES_DARK,\n];\n\nexport const HDS_THEMING_LOCALSTORAGE_DATA = 'hds-theming-data';\n\nexport const DEFAULT_THEMING_OPTION_LIGHT_THEME = HdsModesLightValues.CdsG0;\nexport const DEFAULT_THEMING_OPTION_DARK_THEME = HdsModesDarkValues.CdsG100;\n\nexport default class HdsThemingService extends Service {\n @tracked _currentTheme: HdsThemes | undefined = undefined;\n @tracked _currentMode: HdsModes | undefined = undefined;\n @tracked _currentLightTheme: HdsModesLight =\n DEFAULT_THEMING_OPTION_LIGHT_THEME;\n @tracked _currentDarkTheme: HdsModesDark = DEFAULT_THEMING_OPTION_DARK_THEME;\n @tracked globalOnSetTheme: OnSetThemeCallback | undefined;\n\n initializeTheme() {\n const rawStoredThemingData = localStorage.getItem(\n HDS_THEMING_LOCALSTORAGE_DATA\n );\n if (rawStoredThemingData !== null) {\n const storedThemingData: unknown = JSON.parse(rawStoredThemingData);\n if (storedThemingData) {\n const { theme, options } = storedThemingData as {\n theme: HdsThemes | undefined;\n options: HdsThemingOptions;\n };\n this.setTheme({\n theme,\n options,\n });\n }\n }\n }\n\n setTheme({ theme, options, onSetTheme }: SetThemeArgs) {\n if (options !== undefined) {\n // if we have new options, we override the current ones (`lightTheme` / `darkTheme`)\n // these options can be used by consumers that want to customize how they apply theming\n // (and used by the showcase for the custom theming / theme switching logic)\n if (\n Object.hasOwn(options, 'lightTheme') &&\n Object.hasOwn(options, 'darkTheme')\n ) {\n const { lightTheme, darkTheme } = options;\n\n this._currentLightTheme = lightTheme;\n this._currentDarkTheme = darkTheme;\n } else {\n // fallback if something goes wrong\n this._currentLightTheme = DEFAULT_THEMING_OPTION_LIGHT_THEME;\n this._currentDarkTheme = DEFAULT_THEMING_OPTION_DARK_THEME;\n }\n }\n\n // set the current theme/mode (`currentTheme` / `currentMode`)\n if (\n theme === undefined || // standard (no theming)\n !THEMES.includes(theme) // handle possible errors\n ) {\n this._currentTheme = undefined;\n this._currentMode = undefined;\n } else if (\n theme === HdsThemeValues.Default // default (original HDS)\n ) {\n this._currentTheme = HdsThemeValues.Default;\n this._currentMode = undefined;\n } else if (\n theme === HdsThemeValues.System // system (prefers-color-scheme)\n ) {\n this._currentTheme = HdsThemeValues.System;\n this._currentMode = undefined;\n } else {\n this._currentTheme = theme;\n if (this._currentTheme === HdsThemeValues.Light) {\n this._currentMode = this._currentLightTheme;\n }\n if (this._currentTheme === HdsThemeValues.Dark) {\n this._currentMode = this._currentDarkTheme;\n }\n }\n\n // IMPORTANT: for this to work, it needs to be the HTML tag (it's the `:root` in CSS)\n const rootElement = document.querySelector('html');\n\n if (!rootElement) {\n return;\n }\n // remove or update the CSS selectors applied to the root element (depending on the `theme`/`mode` arguments)\n const hdsThemingClassesToRemove = Array.from(rootElement.classList).filter(\n (className) => className.match(/^hds-(theme|mode)/)\n );\n rootElement.classList.remove(...hdsThemingClassesToRemove);\n if (this._currentTheme !== undefined) {\n rootElement.classList.add(`hds-theme-${this._currentTheme}`);\n }\n if (this._currentMode !== undefined) {\n rootElement.classList.add(`hds-mode-${this._currentMode}`);\n }\n\n // store the current theme and theming options in local storage (unless undefined)\n localStorage.setItem(\n HDS_THEMING_LOCALSTORAGE_DATA,\n JSON.stringify({\n theme: this._currentTheme,\n options: {\n lightTheme: this._currentLightTheme,\n darkTheme: this._currentDarkTheme,\n },\n })\n );\n\n // this is a general callback that can be defined globally (by extending the service)\n if (this.globalOnSetTheme) {\n this.globalOnSetTheme({\n currentTheme: this._currentTheme,\n currentMode: this._currentMode,\n });\n }\n\n // this is a \"local\" callback that can be defined \"locally\" (eg. in a theme switcher)\n if (onSetTheme) {\n onSetTheme({\n currentTheme: this._currentTheme,\n currentMode: this._currentMode,\n });\n }\n }\n\n // getters used for reactivity in the components/services using this service\n\n get currentTheme(): HdsThemes | undefined {\n return this._currentTheme;\n }\n\n get currentMode(): HdsModes | undefined {\n return this._currentMode;\n }\n\n get currentLightTheme(): HdsModesLight {\n return this._currentLightTheme ?? DEFAULT_THEMING_OPTION_LIGHT_THEME;\n }\n\n get currentDarkTheme(): HdsModesDark {\n return this._currentDarkTheme ?? DEFAULT_THEMING_OPTION_DARK_THEME;\n }\n}\n"],"names":["HdsThemeValues","HdsModesBaseValues","HdsModesLightValues","HdsModesDarkValues","THEMES","Object","values","MODES_LIGHT","MODES_DARK","MODES","HDS_THEMING_LOCALSTORAGE_DATA","DEFAULT_THEMING_OPTION_LIGHT_THEME","CdsG0","DEFAULT_THEMING_OPTION_DARK_THEME","CdsG100","HdsThemingService","Service","g","prototype","tracked","undefined","i","void 0","initializeTheme","rawStoredThemingData","localStorage","getItem","storedThemingData","JSON","parse","theme","options","setTheme","onSetTheme","hasOwn","lightTheme","darkTheme","_currentLightTheme","_currentDarkTheme","includes","_currentTheme","_currentMode","Default","System","Light","Dark","rootElement","document","querySelector","hdsThemingClassesToRemove","Array","from","classList","filter","className","match","remove","add","setItem","stringify","globalOnSetTheme","currentTheme","currentMode","currentLightTheme","currentDarkTheme"],"mappings":";;;;AAGA,IAAYA,cAAc,0BAAdA,cAAc,EAAA;AACxB;EADUA,cAAc,CAAA,SAAA,CAAA,GAAA,SAAA;AAGxB;EAHUA,cAAc,CAAA,QAAA,CAAA,GAAA,QAAA;AAKxB;EALUA,cAAc,CAAA,OAAA,CAAA,GAAA,OAAA;EAAdA,cAAc,CAAA,MAAA,CAAA,GAAA,MAAA;AAAA,EAAA,OAAdA,cAAc;AAAA,CAAA,CAAA,EAAA;;AAU1B;AACA,IAAYC,kBAAkB,0BAAlBA,kBAAkB,EAAA;EAAlBA,kBAAkB,CAAA,SAAA,CAAA,GAAA,SAAA;AAAA,EAAA,OAAlBA,kBAAkB;AAAA,CAAA,CAAA,EAAA;AAI9B,IAAYC,mBAAmB,0BAAnBA,mBAAmB,EAAA;EAAnBA,mBAAmB,CAAA,OAAA,CAAA,GAAA,QAAA;EAAnBA,mBAAmB,CAAA,QAAA,CAAA,GAAA,SAAA;AAAA,EAAA,OAAnBA,mBAAmB;AAAA,CAAA,CAAA,EAAA;AAK/B,IAAYC,kBAAkB,0BAAlBA,kBAAkB,EAAA;EAAlBA,kBAAkB,CAAA,QAAA,CAAA,GAAA,SAAA;EAAlBA,kBAAkB,CAAA,SAAA,CAAA,GAAA,UAAA;AAAA,EAAA,OAAlBA,kBAAkB;AAAA,CAAA,CAAA,EAAA;AA+BvB,MAAMC,MAAmB,GAAGC,MAAM,CAACC,MAAM,CAACN,cAAc;AACxD,MAAMO,WAA4B,GAAGF,MAAM,CAACC,MAAM,CAACJ,mBAAmB;AACtE,MAAMM,UAA0B,GAAGH,MAAM,CAACC,MAAM,CAACH,kBAAkB;MAC7DM,KAAiB,GAAG,CAC/B,GAAGJ,MAAM,CAACC,MAAM,CAACL,kBAAkB,CAAC,EACpC,GAAGM,WAAW,EACd,GAAGC,UAAU;AAGR,MAA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STORAGE_DATA, HdsModesBaseValues, HdsModesDarkValues, HdsModesLightValues, HdsThemeValues, MODES, MODES_DARK, MODES_LIGHT, THEMES } from './services/hds-theming.js';
|
|
2
2
|
//# sourceMappingURL=services.js.map
|