@hashicorp/design-system-components 5.2.0-rc-20260108162959 → 5.2.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.
- package/declarations/components.d.ts +0 -2
- package/declarations/services.d.ts +0 -1
- package/declarations/template-registry.d.ts +0 -6
- package/dist/components.js +0 -2
- package/dist/components.js.map +1 -1
- package/dist/services.js +1 -1
- package/dist/styles/@hashicorp/design-system-components.css +320 -501
- package/dist/styles/@hashicorp/design-system-components.scss +62 -4
- package/dist/styles/@hashicorp/design-system-components.scss.map +1 -0
- package/dist/styles/components/badge-count.scss +76 -26
- package/dist/styles/components/badge.scss +131 -26
- package/dist/styles/components/button.scss +0 -5
- package/dist/styles/components/dropdown.scss +5 -3
- package/dist/styles/components/form/file-input.scss +2 -2
- package/dist/styles/components/form/key-value-inputs.scss +4 -2
- package/dist/styles/mixins/_button.scss +129 -82
- package/dist/styles/mixins/_interactive-dark-theme.scss +1 -1
- package/package.json +4 -8
- package/declarations/components/hds/theme-context/index.d.ts +0 -24
- package/declarations/components/hds/theme-context/types.d.ts +0 -19
- package/declarations/components/hds/theme-switcher/index.d.ts +0 -43
- package/declarations/services/hds-theming.d.ts +0 -57
- package/dist/_app_/components/hds/theme-context.js +0 -1
- package/dist/_app_/components/hds/theme-switcher.js +0 -1
- package/dist/_app_/services/hds-theming.js +0 -1
- package/dist/components/hds/theme-context/index.js +0 -45
- package/dist/components/hds/theme-context/index.js.map +0 -1
- package/dist/components/hds/theme-context/types.js +0 -27
- package/dist/components/hds/theme-context/types.js.map +0 -1
- package/dist/components/hds/theme-switcher/index.js +0 -100
- package/dist/components/hds/theme-switcher/index.js.map +0 -1
- package/dist/services/hds-theming.js +0 -214
- package/dist/services/hds-theming.js.map +0 -1
- package/dist/styles/@hashicorp/design-system-components-common.css +0 -9588
- package/dist/styles/@hashicorp/design-system-components-common.css.map +0 -1
- package/dist/styles/@hashicorp/design-system-components-common.scss +0 -24
- package/dist/styles/@hashicorp/design-system-components.css.map +0 -1
- package/dist/styles/@hashicorp/design-system-power-select-overrides.css +0 -229
- package/dist/styles/@hashicorp/design-system-power-select-overrides.css.map +0 -1
- package/dist/styles/components/index.scss +0 -52
- package/dist/styles/components/theme-context.scss +0 -12
- package/dist/styles/mixins/_carbonization.scss +0 -31
|
@@ -1 +0,0 @@
|
|
|
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 // can be either 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","classNames","classes","push","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;;AAyBO,MAAMA,iBAA8B,GAAGC,MAAM,CAACC,MAAM,CACzDC,2BACF;AACO,MAAMC,gBAA4B,GAAGH,MAAM,CAACC,MAAM,CACvDG,0BACF;AACO,MAAMC,iBAAqC,GAAG,CACnD,GAAGN,iBAAiB,EACpB,GAAGI,gBAAgB;AAGN,MAAMG,eAAe,SAASC,SAAS,CAA2B;AAC/EC,EAAAA,WAAWA,CAACC,KAAY,EAAEC,IAAsC,EAAE;AAChE,IAAA,KAAK,CAACD,KAAK,EAAEC,IAAI,CAAC;IAElB,MAAM;AAAEC,MAAAA;AAAQ,KAAC,GAAGD,IAAI;AAExBE,IAAAA,MAAM,CACJ,CAAA,+DAAA,EAAkEP,iBAAiB,CAACQ,IAAI,CACtF,IACF,CAAC,CAAA,YAAA,EAAeF,OAAO,CAAA,CAAE,EACzBN,iBAAiB,CAACS,QAAQ,CAACH,OAAO,CACpC,CAAC;AACH,EAAA;;AAEA;EACA,IAAII,UAAUA,GAAW;AACvB,IAAA,MAAMC,OAAO,GAAG,CAAC,mBAAmB,CAAC;IAErC,MAAM;AAAEL,MAAAA;KAAS,GAAG,IAAI,CAACD,IAAI;;AAE7B;AACA,IAAA,IAAIX,iBAAiB,CAACe,QAAQ,CAACH,OAAoB,CAAC,EAAE;AACpDK,MAAAA,OAAO,CAACC,IAAI,CAAC,CAAA,UAAA,EAAaN,OAAO,EAAE,CAAC;IACtC,CAAC,MAAM,IAAIR,gBAAgB,CAACW,QAAQ,CAACH,OAAmB,CAAC,EAAE;AACzDK,MAAAA,OAAO,CAACC,IAAI,CAAC,CAAA,SAAA,EAAYN,OAAO,EAAE,CAAC;AACrC,IAAA;AAEA,IAAA,OAAOK,OAAO,CAACH,IAAI,CAAC,GAAG,CAAC;AAC1B,EAAA;AACF;AAACK,oBAAA,CAAAC,QAAA,EA7BoBb,eAAe,CAAA;;;;"}
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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;;;;"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
import { inject } from '@ember/service';
|
|
3
|
-
import { action } from '@ember/object';
|
|
4
|
-
import { precompileTemplate } from '@ember/template-compilation';
|
|
5
|
-
import { g, i, n } from 'decorator-transforms/runtime';
|
|
6
|
-
import { setComponentTemplate } from '@ember/component';
|
|
7
|
-
|
|
8
|
-
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n\n{{!\n ------------------------------------------------------------------------------------------\n IMPORTANT: this is a temporary implementation, while we wait for the design specifications\n ------------------------------------------------------------------------------------------\n}}\n\n<Hds::Dropdown\n @enableCollisionDetection={{true}}\n @matchToggleWidth={{@toggleIsFullWidth}}\n class=\"hds-theme-switcher-control\"\n ...attributes\n as |D|\n>\n <D.ToggleButton\n @color=\"secondary\"\n @size={{this.toggleSize}}\n @isFullWidth={{this.toggleIsFullWidth}}\n @text={{this.toggleContent.label}}\n @icon={{this.toggleContent.icon}}\n />\n {{#each-in this._options as |key data|}}\n <D.Interactive @icon={{data.icon}} {{on \"click\" (fn this.onSelectTheme data.theme)}}>{{data.label}}</D.Interactive>\n {{/each-in}}\n</Hds::Dropdown>");
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Copyright (c) HashiCorp, Inc.
|
|
12
|
-
* SPDX-License-Identifier: MPL-2.0
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
const OPTIONS = {
|
|
16
|
-
default: {
|
|
17
|
-
theme: 'default',
|
|
18
|
-
icon: 'hashicorp',
|
|
19
|
-
label: 'Default'
|
|
20
|
-
},
|
|
21
|
-
system: {
|
|
22
|
-
theme: 'system',
|
|
23
|
-
icon: 'monitor',
|
|
24
|
-
label: 'System'
|
|
25
|
-
},
|
|
26
|
-
light: {
|
|
27
|
-
theme: 'light',
|
|
28
|
-
icon: 'sun',
|
|
29
|
-
label: 'Light'
|
|
30
|
-
},
|
|
31
|
-
dark: {
|
|
32
|
-
theme: 'dark',
|
|
33
|
-
icon: 'moon',
|
|
34
|
-
label: 'Dark'
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
class HdsThemeSwitcher extends Component {
|
|
38
|
-
static {
|
|
39
|
-
g(this.prototype, "hdsTheming", [inject]);
|
|
40
|
-
}
|
|
41
|
-
#hdsTheming = (i(this, "hdsTheming"), void 0);
|
|
42
|
-
get toggleSize() {
|
|
43
|
-
return this.args.toggleSize ?? 'small';
|
|
44
|
-
}
|
|
45
|
-
get toggleIsFullWidth() {
|
|
46
|
-
return this.args.toggleIsFullWidth ?? false;
|
|
47
|
-
}
|
|
48
|
-
get toggleContent() {
|
|
49
|
-
if (this.currentTheme === 'default' && this.hasDefaultOption || this.currentTheme === 'system' && this.hasSystemOption || this.currentTheme === 'light' || this.currentTheme === 'dark') {
|
|
50
|
-
return {
|
|
51
|
-
label: OPTIONS[this.currentTheme].label,
|
|
52
|
-
icon: OPTIONS[this.currentTheme].icon
|
|
53
|
-
};
|
|
54
|
-
} else {
|
|
55
|
-
return {
|
|
56
|
-
label: 'Theme',
|
|
57
|
-
icon: undefined
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// note: we will use the `default` option in development, while migrating to the `cds` theming
|
|
63
|
-
// during this process, consumers will enable/disable this option via code logic or feature flag
|
|
64
|
-
get hasDefaultOption() {
|
|
65
|
-
return this.args.hasDefaultOption ?? false;
|
|
66
|
-
}
|
|
67
|
-
get hasSystemOption() {
|
|
68
|
-
return this.args.hasSystemOption ?? true;
|
|
69
|
-
}
|
|
70
|
-
get _options() {
|
|
71
|
-
const options = {
|
|
72
|
-
...OPTIONS
|
|
73
|
-
};
|
|
74
|
-
if (!this.hasDefaultOption) {
|
|
75
|
-
delete options.default;
|
|
76
|
-
}
|
|
77
|
-
if (!this.hasSystemOption) {
|
|
78
|
-
delete options.system;
|
|
79
|
-
}
|
|
80
|
-
return options;
|
|
81
|
-
}
|
|
82
|
-
get currentTheme() {
|
|
83
|
-
// we get the theme from the global service
|
|
84
|
-
return this.hdsTheming.currentTheme;
|
|
85
|
-
}
|
|
86
|
-
onSelectTheme(theme) {
|
|
87
|
-
// we set the theme in the global service (and provide an optional user-defined callback)
|
|
88
|
-
this.hdsTheming.setTheme({
|
|
89
|
-
theme,
|
|
90
|
-
onSetTheme: this.args.onSetTheme
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
static {
|
|
94
|
-
n(this.prototype, "onSelectTheme", [action]);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
setComponentTemplate(TEMPLATE, HdsThemeSwitcher);
|
|
98
|
-
|
|
99
|
-
export { HdsThemeSwitcher as default };
|
|
100
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/theme-switcher/index.ts"],"sourcesContent":["/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\n// ------------------------------------------------------------------------------------------\n// IMPORTANT: this is a temporary implementation, while we wait for the design specifications\n// ------------------------------------------------------------------------------------------\n\nimport Component from '@glimmer/component';\nimport { inject as service } from '@ember/service';\nimport { action } from '@ember/object';\n\nimport type { HdsDropdownSignature } from '../dropdown/index.ts';\nimport type { HdsDropdownToggleButtonSignature } from '../dropdown/toggle/button.ts';\nimport type { HdsIconSignature } from '../icon/index.ts';\nimport type HdsThemingService from '../../../services/hds-theming.ts';\nimport type {\n HdsThemes,\n HdsOnSetThemeCallback,\n} from '../../../services/hds-theming.ts';\n\ninterface ThemeOption {\n theme: HdsThemes | undefined;\n icon: HdsIconSignature['Args']['name'];\n label: string;\n}\n\nconst OPTIONS: Record<HdsThemes, ThemeOption> = {\n default: { theme: 'default', icon: 'hashicorp', label: 'Default' },\n system: { theme: 'system', icon: 'monitor', label: 'System' },\n light: { theme: 'light', icon: 'sun', label: 'Light' },\n dark: { theme: 'dark', icon: 'moon', label: 'Dark' },\n};\n\nexport interface HdsThemeSwitcherSignature {\n Args: {\n toggleSize?: HdsDropdownToggleButtonSignature['Args']['size'];\n toggleIsFullWidth?: HdsDropdownToggleButtonSignature['Args']['isFullWidth'];\n hasDefaultOption?: boolean;\n hasSystemOption?: boolean;\n onSetTheme?: HdsOnSetThemeCallback;\n };\n Element: HdsDropdownSignature['Element'];\n}\n\nexport default class HdsThemeSwitcher extends Component<HdsThemeSwitcherSignature> {\n @service declare readonly hdsTheming: HdsThemingService;\n\n get toggleSize() {\n return this.args.toggleSize ?? 'small';\n }\n\n get toggleIsFullWidth() {\n return this.args.toggleIsFullWidth ?? false;\n }\n\n get toggleContent() {\n if (\n (this.currentTheme === 'default' && this.hasDefaultOption) ||\n (this.currentTheme === 'system' && this.hasSystemOption) ||\n this.currentTheme === 'light' ||\n this.currentTheme === 'dark'\n ) {\n return {\n label: OPTIONS[this.currentTheme].label,\n icon: OPTIONS[this.currentTheme].icon,\n };\n } else {\n return { label: 'Theme', icon: undefined };\n }\n }\n\n // note: we will use the `default` option in development, while migrating to the `cds` theming\n // during this process, consumers will enable/disable this option via code logic or feature flag\n get hasDefaultOption() {\n return this.args.hasDefaultOption ?? false;\n }\n\n get hasSystemOption() {\n return this.args.hasSystemOption ?? true;\n }\n\n get _options() {\n const options: Partial<typeof OPTIONS> = { ...OPTIONS };\n\n if (!this.hasDefaultOption) {\n delete options.default;\n }\n\n if (!this.hasSystemOption) {\n delete options.system;\n }\n\n return options;\n }\n\n get currentTheme() {\n // we get the theme from the global service\n return this.hdsTheming.currentTheme;\n }\n\n @action\n onSelectTheme(theme: HdsThemes | undefined): void {\n // we set the theme in the global service (and provide an optional user-defined callback)\n this.hdsTheming.setTheme({ theme, onSetTheme: this.args.onSetTheme });\n }\n}\n"],"names":["OPTIONS","default","theme","icon","label","system","light","dark","HdsThemeSwitcher","Component","g","prototype","service","i","void 0","toggleSize","args","toggleIsFullWidth","toggleContent","currentTheme","hasDefaultOption","hasSystemOption","undefined","_options","options","hdsTheming","onSelectTheme","setThe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;AAKT;AAACC,oBAAA,CAAAC,QAAA,EA7DoBxB,gBAAgB,CAAA;;;;"}
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import Service from '@ember/service';
|
|
2
|
-
import { tracked } from '@glimmer/tracking';
|
|
3
|
-
import { g, i } from 'decorator-transforms/runtime';
|
|
4
|
-
|
|
5
|
-
let HdsThemeValues = /*#__PURE__*/function (HdsThemeValues) {
|
|
6
|
-
// default (original HDS)
|
|
7
|
-
HdsThemeValues["Default"] = "default";
|
|
8
|
-
// system settings (prefers-color-scheme)
|
|
9
|
-
HdsThemeValues["System"] = "system";
|
|
10
|
-
// user settings for dark/light
|
|
11
|
-
HdsThemeValues["Light"] = "light";
|
|
12
|
-
HdsThemeValues["Dark"] = "dark";
|
|
13
|
-
return HdsThemeValues;
|
|
14
|
-
}({});
|
|
15
|
-
let HdsModesBaseValues = /*#__PURE__*/function (HdsModesBaseValues) {
|
|
16
|
-
HdsModesBaseValues["Default"] = "default";
|
|
17
|
-
return HdsModesBaseValues;
|
|
18
|
-
}({});
|
|
19
|
-
let HdsModesLightValues = /*#__PURE__*/function (HdsModesLightValues) {
|
|
20
|
-
HdsModesLightValues["CdsG0"] = "cds-g0";
|
|
21
|
-
HdsModesLightValues["CdsG10"] = "cds-g10";
|
|
22
|
-
return HdsModesLightValues;
|
|
23
|
-
}({});
|
|
24
|
-
let HdsModesDarkValues = /*#__PURE__*/function (HdsModesDarkValues) {
|
|
25
|
-
HdsModesDarkValues["CdsG90"] = "cds-g90";
|
|
26
|
-
HdsModesDarkValues["CdsG100"] = "cds-g100";
|
|
27
|
-
return HdsModesDarkValues;
|
|
28
|
-
}({});
|
|
29
|
-
const THEMES = Object.values(HdsThemeValues);
|
|
30
|
-
const MODES_LIGHT = Object.values(HdsModesLightValues);
|
|
31
|
-
const MODES_DARK = Object.values(HdsModesDarkValues);
|
|
32
|
-
const MODES = [...Object.values(HdsModesBaseValues), ...MODES_LIGHT, ...MODES_DARK];
|
|
33
|
-
const HDS_THEMING_LOCALSTORAGE_DATA = 'hds-theming-data';
|
|
34
|
-
const DEFAULT_THEMING_OPTION_LIGHT_THEME = HdsModesLightValues.CdsG0;
|
|
35
|
-
const DEFAULT_THEMING_OPTION_DARK_THEME = HdsModesDarkValues.CdsG100;
|
|
36
|
-
// We use this guard function to check if the data parsed from `localStorage` conforms to the `StoredThemingData` type and so is safe to use.
|
|
37
|
-
// This prevents the application from using corrupted, malformed or malicious data, by validating the object structure, theme, and mode values.
|
|
38
|
-
|
|
39
|
-
function isSafeStoredThemingData(data) {
|
|
40
|
-
if (typeof data !== 'object' || data === null) return false;
|
|
41
|
-
const d = data;
|
|
42
|
-
const isSafeThemeData =
|
|
43
|
-
// there is no stored `theme` key in the object (eg. the `default` theme was selected)
|
|
44
|
-
!('theme' in d) ||
|
|
45
|
-
// there is a `theme` value and is one of the valid `HdsThemes`
|
|
46
|
-
d['theme'] === undefined || THEMES.includes(d['theme']);
|
|
47
|
-
const options = d['options'];
|
|
48
|
-
const isSafeOptionsData =
|
|
49
|
-
// there is no stored `options` key in the object (eg. it's the first run of the application)
|
|
50
|
-
!('options' in d) ||
|
|
51
|
-
// there is an `options` value and has valid entries
|
|
52
|
-
typeof options === 'object' && options !== null && 'lightTheme' in options && MODES_LIGHT.includes(options['lightTheme']) && 'darkTheme' in options && MODES_DARK.includes(options['darkTheme']);
|
|
53
|
-
return isSafeThemeData && isSafeOptionsData;
|
|
54
|
-
}
|
|
55
|
-
class HdsThemingService extends Service {
|
|
56
|
-
static {
|
|
57
|
-
g(this.prototype, "_currentTheme", [tracked], function () {
|
|
58
|
-
return undefined;
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
#_currentTheme = (i(this, "_currentTheme"), void 0);
|
|
62
|
-
static {
|
|
63
|
-
g(this.prototype, "_currentMode", [tracked], function () {
|
|
64
|
-
return undefined;
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
#_currentMode = (i(this, "_currentMode"), void 0);
|
|
68
|
-
static {
|
|
69
|
-
g(this.prototype, "_currentLightTheme", [tracked], function () {
|
|
70
|
-
return DEFAULT_THEMING_OPTION_LIGHT_THEME;
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
#_currentLightTheme = (i(this, "_currentLightTheme"), void 0);
|
|
74
|
-
static {
|
|
75
|
-
g(this.prototype, "_currentDarkTheme", [tracked], function () {
|
|
76
|
-
return DEFAULT_THEMING_OPTION_DARK_THEME;
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
#_currentDarkTheme = (i(this, "_currentDarkTheme"), void 0);
|
|
80
|
-
static {
|
|
81
|
-
g(this.prototype, "globalOnSetTheme", [tracked]);
|
|
82
|
-
}
|
|
83
|
-
#globalOnSetTheme = (i(this, "globalOnSetTheme"), void 0);
|
|
84
|
-
initializeTheme() {
|
|
85
|
-
const rawStoredThemingData = localStorage.getItem(HDS_THEMING_LOCALSTORAGE_DATA);
|
|
86
|
-
if (rawStoredThemingData !== null) {
|
|
87
|
-
let storedThemingData;
|
|
88
|
-
try {
|
|
89
|
-
storedThemingData = JSON.parse(rawStoredThemingData);
|
|
90
|
-
} catch (error) {
|
|
91
|
-
// malformed JSON in localStorage, ignore and proceed with defaults
|
|
92
|
-
console.error(`Error while reading local storage '${HDS_THEMING_LOCALSTORAGE_DATA}' for theming`, error);
|
|
93
|
-
}
|
|
94
|
-
if (isSafeStoredThemingData(storedThemingData)) {
|
|
95
|
-
this.setTheme({
|
|
96
|
-
theme: storedThemingData.theme,
|
|
97
|
-
options: storedThemingData.options
|
|
98
|
-
});
|
|
99
|
-
} else {
|
|
100
|
-
// if data is not safe or malformed, reset theming to its defaults
|
|
101
|
-
this.setTheme({
|
|
102
|
-
theme: undefined,
|
|
103
|
-
options: undefined
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
setTheme({
|
|
109
|
-
theme,
|
|
110
|
-
options,
|
|
111
|
-
onSetTheme
|
|
112
|
-
}) {
|
|
113
|
-
if (options !== undefined) {
|
|
114
|
-
// if we have new options, we override the current ones (`lightTheme` / `darkTheme`)
|
|
115
|
-
// these options can be used by consumers that want to customize how they apply theming
|
|
116
|
-
// (and used by the showcase for the custom theming / theme switching logic)
|
|
117
|
-
if (Object.hasOwn(options, 'lightTheme') && Object.hasOwn(options, 'darkTheme')) {
|
|
118
|
-
const {
|
|
119
|
-
lightTheme,
|
|
120
|
-
darkTheme
|
|
121
|
-
} = options;
|
|
122
|
-
this._currentLightTheme = lightTheme;
|
|
123
|
-
this._currentDarkTheme = darkTheme;
|
|
124
|
-
} else {
|
|
125
|
-
// fallback if something goes wrong
|
|
126
|
-
this._currentLightTheme = DEFAULT_THEMING_OPTION_LIGHT_THEME;
|
|
127
|
-
this._currentDarkTheme = DEFAULT_THEMING_OPTION_DARK_THEME;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// set the current theme/mode (`currentTheme` / `currentMode`)
|
|
132
|
-
if (theme === undefined ||
|
|
133
|
-
// standard (no theming)
|
|
134
|
-
!THEMES.includes(theme) // handle possible errors
|
|
135
|
-
) {
|
|
136
|
-
this._currentTheme = undefined;
|
|
137
|
-
this._currentMode = undefined;
|
|
138
|
-
} else if (theme === HdsThemeValues.Default // default (original HDS)
|
|
139
|
-
) {
|
|
140
|
-
this._currentTheme = HdsThemeValues.Default;
|
|
141
|
-
this._currentMode = undefined;
|
|
142
|
-
} else if (theme === HdsThemeValues.System // system (prefers-color-scheme)
|
|
143
|
-
) {
|
|
144
|
-
this._currentTheme = HdsThemeValues.System;
|
|
145
|
-
this._currentMode = undefined;
|
|
146
|
-
} else {
|
|
147
|
-
this._currentTheme = theme;
|
|
148
|
-
if (this._currentTheme === HdsThemeValues.Light) {
|
|
149
|
-
this._currentMode = this._currentLightTheme;
|
|
150
|
-
}
|
|
151
|
-
if (this._currentTheme === HdsThemeValues.Dark) {
|
|
152
|
-
this._currentMode = this._currentDarkTheme;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// IMPORTANT: for this to work, it needs to be the `<html>` tag (it's the `:root` in CSS)
|
|
157
|
-
const rootElement = document.querySelector('html');
|
|
158
|
-
if (!rootElement) {
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
// remove or update the CSS selectors applied to the root element (depending on the `theme`/`mode` arguments)
|
|
162
|
-
const hdsThemingClassesToRemove = Array.from(rootElement.classList).filter(className => className.match(/^hds-(theme|mode)/));
|
|
163
|
-
rootElement.classList.remove(...hdsThemingClassesToRemove);
|
|
164
|
-
if (this._currentTheme !== undefined) {
|
|
165
|
-
rootElement.classList.add(`hds-theme-${this._currentTheme}`);
|
|
166
|
-
}
|
|
167
|
-
if (this._currentMode !== undefined) {
|
|
168
|
-
rootElement.classList.add(`hds-mode-${this._currentMode}`);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// store the current theme and theming options in local storage
|
|
172
|
-
localStorage.setItem(HDS_THEMING_LOCALSTORAGE_DATA, JSON.stringify({
|
|
173
|
-
theme: this._currentTheme,
|
|
174
|
-
options: {
|
|
175
|
-
lightTheme: this._currentLightTheme,
|
|
176
|
-
darkTheme: this._currentDarkTheme
|
|
177
|
-
}
|
|
178
|
-
}));
|
|
179
|
-
|
|
180
|
-
// this is a general callback that can be defined globally (by extending the service)
|
|
181
|
-
if (this.globalOnSetTheme) {
|
|
182
|
-
this.globalOnSetTheme({
|
|
183
|
-
currentTheme: this._currentTheme,
|
|
184
|
-
currentMode: this._currentMode
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// this is a "local" callback that can be defined "locally" (eg. in a theme switcher)
|
|
189
|
-
if (onSetTheme) {
|
|
190
|
-
onSetTheme({
|
|
191
|
-
currentTheme: this._currentTheme,
|
|
192
|
-
currentMode: this._currentMode
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
// getters used for reactivity in the components/services using this service
|
|
198
|
-
|
|
199
|
-
get currentTheme() {
|
|
200
|
-
return this._currentTheme;
|
|
201
|
-
}
|
|
202
|
-
get currentMode() {
|
|
203
|
-
return this._currentMode;
|
|
204
|
-
}
|
|
205
|
-
get currentLightTheme() {
|
|
206
|
-
return this._currentLightTheme;
|
|
207
|
-
}
|
|
208
|
-
get currentDarkTheme() {
|
|
209
|
-
return this._currentDarkTheme;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
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 };
|
|
214
|
-
//# sourceMappingURL=hds-theming.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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\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?: HdsOnSetThemeCallback;\n};\n\nexport type HdsOnSetThemeCallbackArgs = {\n currentTheme: HdsThemes | undefined;\n currentMode: HdsModes | undefined;\n};\n\nexport type HdsOnSetThemeCallback = (args: HdsOnSetThemeCallbackArgs) => 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\ntype StoredThemingData = {\n theme: HdsThemes | undefined;\n options: HdsThemingOptions;\n};\n\n// We use this guard function to check if the data parsed from `localStorage` conforms to the `StoredThemingData` type and so is safe to use.\n// This prevents the application from using corrupted, malformed or malicious data, by validating the object structure, theme, and mode values.\n\nfunction isSafeStoredThemingData(data: unknown): data is StoredThemingData {\n if (typeof data !== 'object' || data === null) return false;\n\n const d = data as Record<string, unknown>;\n\n const isSafeThemeData =\n // there is no stored `theme` key in the object (eg. the `default` theme was selected)\n !('theme' in d) ||\n // there is a `theme` value and is one of the valid `HdsThemes`\n d['theme'] === undefined ||\n THEMES.includes(d['theme'] as HdsThemes);\n\n const options = d['options'] as Record<string, unknown> | undefined;\n\n const isSafeOptionsData =\n // there is no stored `options` key in the object (eg. it's the first run of the application)\n !('options' in d) ||\n // there is an `options` value and has valid entries\n (typeof options === 'object' &&\n options !== null &&\n 'lightTheme' in options &&\n MODES_LIGHT.includes(options['lightTheme'] as HdsModesLight) &&\n 'darkTheme' in options &&\n MODES_DARK.includes(options['darkTheme'] as HdsModesDark));\n\n return isSafeThemeData && isSafeOptionsData;\n}\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: HdsOnSetThemeCallback | undefined;\n\n initializeTheme() {\n const rawStoredThemingData = localStorage.getItem(\n HDS_THEMING_LOCALSTORAGE_DATA\n );\n\n if (rawStoredThemingData !== null) {\n let storedThemingData: unknown;\n try {\n storedThemingData = JSON.parse(rawStoredThemingData);\n } catch (error) {\n // malformed JSON in localStorage, ignore and proceed with defaults\n console.error(\n `Error while reading local storage '${HDS_THEMING_LOCALSTORAGE_DATA}' for theming`,\n error\n );\n }\n\n if (isSafeStoredThemingData(storedThemingData)) {\n this.setTheme({\n theme: storedThemingData.theme,\n options: storedThemingData.options,\n });\n } else {\n // if data is not safe or malformed, reset theming to its defaults\n this.setTheme({\n theme: undefined,\n options: undefined,\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\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;\n }\n\n get currentDarkTheme(): HdsModesDark {\n return this._currentDarkTheme;\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","isSafeStoredThemingData","data","d","isSafeThemeData","undefined","includes","options","isSafeOptionsData","HdsThemingService","Service","g","prototype","tracked","i","void 0","initializeTheme","rawStoredThemingData","localStorage","getItem","storedThemingData","JSON","parse","error","console","setTheme","theme","onSetTheme","hasOwn","lightTheme","darkTheme","_currentLightTheme","_currentDarkTheme","_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,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,kBA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