@deephaven/components 0.49.2-theme-plugins.43 → 0.50.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/css/BaseStyleSheet.css +2 -2
- package/css/BaseStyleSheet.css.map +1 -1
- package/dist/LoadingSpinner.css +1 -1
- package/dist/LoadingSpinner.css.map +1 -1
- package/dist/theme/ThemeModel.d.ts +2 -2
- package/dist/theme/ThemeModel.js +2 -2
- package/dist/theme/ThemeModel.js.map +1 -1
- package/dist/theme/ThemeProvider.js +1 -1
- package/dist/theme/ThemeProvider.js.map +1 -1
- package/dist/theme/ThemeUtils.d.ts +61 -0
- package/dist/theme/ThemeUtils.d.ts.map +1 -1
- package/dist/theme/ThemeUtils.js +152 -6
- package/dist/theme/ThemeUtils.js.map +1 -1
- package/dist/theme/theme-dark/index.d.ts +3 -0
- package/dist/theme/theme-dark/index.d.ts.map +1 -0
- package/dist/theme/theme-dark/index.js +7 -0
- package/dist/theme/theme-dark/index.js.map +1 -0
- package/dist/theme/theme-dark/theme-dark-palette.css +290 -0
- package/dist/theme/theme-dark/theme-dark-palette.css.map +1 -0
- package/dist/theme/theme-dark/theme-dark-semantic-editor.css +62 -0
- package/dist/theme/theme-dark/theme-dark-semantic-editor.css.map +1 -0
- package/dist/theme/theme-dark/theme-dark-semantic-grid.css +5 -0
- package/dist/theme/theme-dark/theme-dark-semantic-grid.css.map +1 -0
- package/dist/theme/theme-dark/theme-dark-semantic.css +69 -0
- package/dist/theme/theme-dark/theme-dark-semantic.css.map +1 -0
- package/dist/theme/theme-light/index.d.ts +3 -0
- package/dist/theme/theme-light/index.d.ts.map +1 -0
- package/dist/theme/theme-light/index.js +4 -0
- package/dist/theme/theme-light/index.js.map +1 -0
- package/dist/theme/{theme_default_light.css → theme-light/theme-light-palette.css} +5 -5
- package/dist/theme/theme-light/theme-light-palette.css.map +1 -0
- package/package.json +7 -7
- package/scss/BaseStyleSheet.scss +2 -2
- package/dist/theme/theme_default_dark.css +0 -53
- package/dist/theme/theme_default_dark.css.map +0 -1
- package/dist/theme/theme_default_light.css.map +0 -1
package/dist/LoadingSpinner.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["../src/LoadingSpinner.scss"],"names":[],"mappings":"AAAA;AACA;EACE;AAAA;AAAA;AAAA;EAIA;AAAA;AAAA;AAAA;EAIA;EACA;EAEA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EAKE;;;AAKF;EACE;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;IACE;;EAEF;IACE","file":"LoadingSpinner.css","sourcesContent":["/* stylelint-disable alpha-value-notation */\n.loading-spinner {\n --primary-color: var(\n --dh-loading-spinner-primary-color,\n var(--dh-accent
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../src/LoadingSpinner.scss"],"names":[],"mappings":"AAAA;AACA;EACE;AAAA;AAAA;AAAA;EAIA;AAAA;AAAA;AAAA;EAIA;EACA;EAEA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EAKE;;;AAKF;EACE;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;IACE;;EAEF;IACE","file":"LoadingSpinner.css","sourcesContent":["/* stylelint-disable alpha-value-notation */\n.loading-spinner {\n --primary-color: var(\n --dh-loading-spinner-primary-color,\n var(--dh-color-accent, #4c7dee)\n );\n --secondary-color: var(\n --dh-loading-spinner-secondary-color,\n rgba(240, 240, 240, 0.5)\n );\n --border-width: 1px;\n --size: 14px;\n\n box-sizing: border-box;\n display: inline-block;\n margin: 0 auto;\n width: var(--size);\n height: var(--size);\n}\n\n.loading-spinner-large {\n --border-width: 4px;\n --size: 56px;\n}\n\n.loading-spinner-vertical-align {\n // The original LoadingSpinner used `.fa-layers` to create the spinner icon.\n // This includes a vertical aligment adjustment to center the spinner along\n // side of other inline content. Copying this value from the `.fa-layers`\n // class to avoid breaking alignment of the new spinner.\n vertical-align: -0.125em;\n}\n\n// Spinning circle with colored border and transparent center. Half of the\n// circle is the primary color. The other half is the secondary color.\n.loading-spinner::after {\n animation: loading-spinner-rotate 2s linear infinite;\n border: var(--border-width) solid;\n border-color: var(--primary-color) var(--primary-color) var(--secondary-color)\n var(--secondary-color);\n border-radius: 50%;\n box-sizing: border-box;\n content: '';\n display: inline-block;\n width: var(--size);\n height: var(--size);\n}\n\n@keyframes loading-spinner-rotate {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(359deg);\n }\n}\n"]}
|
|
@@ -4,8 +4,8 @@ export type ThemePreloadStyleContent = `:root{${string}`;
|
|
|
4
4
|
export declare const DEFAULT_DARK_THEME_KEY = "default-dark";
|
|
5
5
|
export declare const DEFAULT_LIGHT_THEME_KEY = "default-light";
|
|
6
6
|
export declare const DEFAULT_PRELOAD_DATA_VARIABLES: {
|
|
7
|
-
'--dh-accent
|
|
8
|
-
'--dh-background
|
|
7
|
+
'--dh-color-accent': string;
|
|
8
|
+
'--dh-color-background': string;
|
|
9
9
|
};
|
|
10
10
|
export declare const THEME_CACHE_LOCAL_STORAGE_KEY = "deephaven.themeCache";
|
|
11
11
|
export interface ThemePreloadData {
|
package/dist/theme/ThemeModel.js
CHANGED
|
@@ -3,9 +3,9 @@ export var DEFAULT_LIGHT_THEME_KEY = 'default-light';
|
|
|
3
3
|
|
|
4
4
|
// Css properties that are used in preload data with default values.
|
|
5
5
|
export var DEFAULT_PRELOAD_DATA_VARIABLES = {
|
|
6
|
-
'--dh-accent
|
|
6
|
+
'--dh-color-accent': '#4c7dee',
|
|
7
7
|
// dark theme --dh-color-blue-700
|
|
8
|
-
'--dh-background
|
|
8
|
+
'--dh-color-background': '#1a171a' // dark theme --dh-color-gray-50
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export var THEME_CACHE_LOCAL_STORAGE_KEY = 'deephaven.themeCache';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeModel.js","names":["DEFAULT_DARK_THEME_KEY","DEFAULT_LIGHT_THEME_KEY","DEFAULT_PRELOAD_DATA_VARIABLES","THEME_CACHE_LOCAL_STORAGE_KEY"],"sources":["../../src/theme/ThemeModel.ts"],"sourcesContent":["export type BaseThemeType = 'dark' | 'light';\nexport type BaseThemeKey = `default-${BaseThemeType}`;\nexport type ThemePreloadStyleContent = `:root{${string}`;\n\nexport const DEFAULT_DARK_THEME_KEY = 'default-dark' satisfies BaseThemeKey;\nexport const DEFAULT_LIGHT_THEME_KEY = 'default-light' satisfies BaseThemeKey;\n\n// Css properties that are used in preload data with default values.\nexport const DEFAULT_PRELOAD_DATA_VARIABLES = {\n '--dh-accent
|
|
1
|
+
{"version":3,"file":"ThemeModel.js","names":["DEFAULT_DARK_THEME_KEY","DEFAULT_LIGHT_THEME_KEY","DEFAULT_PRELOAD_DATA_VARIABLES","THEME_CACHE_LOCAL_STORAGE_KEY"],"sources":["../../src/theme/ThemeModel.ts"],"sourcesContent":["export type BaseThemeType = 'dark' | 'light';\nexport type BaseThemeKey = `default-${BaseThemeType}`;\nexport type ThemePreloadStyleContent = `:root{${string}`;\n\nexport const DEFAULT_DARK_THEME_KEY = 'default-dark' satisfies BaseThemeKey;\nexport const DEFAULT_LIGHT_THEME_KEY = 'default-light' satisfies BaseThemeKey;\n\n// Css properties that are used in preload data with default values.\nexport const DEFAULT_PRELOAD_DATA_VARIABLES = {\n '--dh-color-accent': '#4c7dee', // dark theme --dh-color-blue-700\n '--dh-color-background': '#1a171a', // dark theme --dh-color-gray-50\n} satisfies Record<`--dh-${string}`, string>;\n\nexport const THEME_CACHE_LOCAL_STORAGE_KEY = 'deephaven.themeCache';\n\nexport interface ThemePreloadData {\n themeKey: string;\n preloadStyleContent?: ThemePreloadStyleContent;\n}\n\nexport interface ThemeData {\n baseThemeKey?: BaseThemeKey;\n themeKey: string;\n name: string;\n styleContent: string;\n}\n\nexport interface ThemeRegistrationData {\n base: ThemeData[];\n custom: ThemeData[];\n}\n"],"mappings":"AAIA,OAAO,IAAMA,sBAAsB,GAAG,cAAqC;AAC3E,OAAO,IAAMC,uBAAuB,GAAG,eAAsC;;AAE7E;AACA,OAAO,IAAMC,8BAA8B,GAAG;EAC5C,mBAAmB,EAAE,SAAS;EAAE;EAChC,uBAAuB,EAAE,SAAS,CAAE;AACtC,CAA4C;;AAE5C,OAAO,IAAMC,6BAA6B,GAAG,sBAAsB"}
|
|
@@ -17,7 +17,7 @@ export function ThemeProvider(_ref) {
|
|
|
17
17
|
return (_getThemePreloadData$ = (_getThemePreloadData = getThemePreloadData()) === null || _getThemePreloadData === void 0 ? void 0 : _getThemePreloadData.themeKey) !== null && _getThemePreloadData$ !== void 0 ? _getThemePreloadData$ : DEFAULT_DARK_THEME_KEY;
|
|
18
18
|
});
|
|
19
19
|
var activeThemes = useMemo(() =>
|
|
20
|
-
// Themes remain inactive until a non-null themes
|
|
20
|
+
// Themes remain inactive until a non-null themes array is provided. This
|
|
21
21
|
// avoids the default base theme overriding the preload if we are waiting
|
|
22
22
|
// on additional themes to be available.
|
|
23
23
|
themes == null ? null : getActiveThemes(selectedThemeKey, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.js","names":["createContext","useEffect","useMemo","useState","Log","DEFAULT_DARK_THEME_KEY","calculatePreloadStyleContent","getActiveThemes","getDefaultBaseThemes","getThemePreloadData","setThemePreloadData","log","module","ThemeContext","ThemeProvider","themes","children","baseThemes","selectedThemeKey","setSelectedThemeKey","themeKey","activeThemes","base","custom","updateThemePreloadData","debug","map","theme","preloadStyleContent","value","styleContent"],"sources":["../../src/theme/ThemeProvider.tsx"],"sourcesContent":["import { createContext, ReactNode, useEffect, useMemo, useState } from 'react';\nimport Log from '@deephaven/log';\nimport { DEFAULT_DARK_THEME_KEY, ThemeData } from './ThemeModel';\nimport {\n calculatePreloadStyleContent,\n getActiveThemes,\n getDefaultBaseThemes,\n getThemePreloadData,\n setThemePreloadData,\n} from './ThemeUtils';\n\nexport interface ThemeContextValue {\n activeThemes: ThemeData[] | null;\n selectedThemeKey: string;\n setSelectedThemeKey: (themeKey: string) => void;\n}\n\nconst log = Log.module('ThemeProvider');\n\nexport const ThemeContext = createContext<ThemeContextValue | null>(null);\n\nexport interface ThemeProviderProps {\n themes: ThemeData[] | null;\n children: ReactNode;\n}\n\nexport function ThemeProvider({\n themes,\n children,\n}: ThemeProviderProps): JSX.Element {\n const baseThemes = useMemo(() => getDefaultBaseThemes(), []);\n\n const [selectedThemeKey, setSelectedThemeKey] = useState<string>(\n () => getThemePreloadData()?.themeKey ?? DEFAULT_DARK_THEME_KEY\n );\n\n const activeThemes = useMemo(\n () =>\n // Themes remain inactive until a non-null themes
|
|
1
|
+
{"version":3,"file":"ThemeProvider.js","names":["createContext","useEffect","useMemo","useState","Log","DEFAULT_DARK_THEME_KEY","calculatePreloadStyleContent","getActiveThemes","getDefaultBaseThemes","getThemePreloadData","setThemePreloadData","log","module","ThemeContext","ThemeProvider","themes","children","baseThemes","selectedThemeKey","setSelectedThemeKey","themeKey","activeThemes","base","custom","updateThemePreloadData","debug","map","theme","preloadStyleContent","value","styleContent"],"sources":["../../src/theme/ThemeProvider.tsx"],"sourcesContent":["import { createContext, ReactNode, useEffect, useMemo, useState } from 'react';\nimport Log from '@deephaven/log';\nimport { DEFAULT_DARK_THEME_KEY, ThemeData } from './ThemeModel';\nimport {\n calculatePreloadStyleContent,\n getActiveThemes,\n getDefaultBaseThemes,\n getThemePreloadData,\n setThemePreloadData,\n} from './ThemeUtils';\n\nexport interface ThemeContextValue {\n activeThemes: ThemeData[] | null;\n selectedThemeKey: string;\n setSelectedThemeKey: (themeKey: string) => void;\n}\n\nconst log = Log.module('ThemeProvider');\n\nexport const ThemeContext = createContext<ThemeContextValue | null>(null);\n\nexport interface ThemeProviderProps {\n themes: ThemeData[] | null;\n children: ReactNode;\n}\n\nexport function ThemeProvider({\n themes,\n children,\n}: ThemeProviderProps): JSX.Element {\n const baseThemes = useMemo(() => getDefaultBaseThemes(), []);\n\n const [selectedThemeKey, setSelectedThemeKey] = useState<string>(\n () => getThemePreloadData()?.themeKey ?? DEFAULT_DARK_THEME_KEY\n );\n\n const activeThemes = useMemo(\n () =>\n // Themes remain inactive until a non-null themes array is provided. This\n // avoids the default base theme overriding the preload if we are waiting\n // on additional themes to be available.\n themes == null\n ? null\n : getActiveThemes(selectedThemeKey, {\n base: baseThemes,\n custom: themes ?? [],\n }),\n [baseThemes, selectedThemeKey, themes]\n );\n\n useEffect(\n function updateThemePreloadData() {\n log.debug('Active themes:', activeThemes?.map(theme => theme.themeKey));\n\n setThemePreloadData({\n themeKey: selectedThemeKey,\n preloadStyleContent: calculatePreloadStyleContent(),\n });\n },\n [activeThemes, selectedThemeKey]\n );\n\n const value = useMemo(\n () => ({\n activeThemes,\n selectedThemeKey,\n setSelectedThemeKey,\n }),\n [activeThemes, selectedThemeKey]\n );\n\n return (\n <ThemeContext.Provider value={value}>\n {activeThemes?.map(theme => (\n <style data-theme-key={theme.themeKey} key={theme.themeKey}>\n {theme.styleContent}\n </style>\n ))}\n {children}\n </ThemeContext.Provider>\n );\n}\n\nexport default ThemeProvider;\n"],"mappings":"AAAA,SAASA,aAAa,EAAaC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAC9E,OAAOC,GAAG,MAAM,gBAAgB;AAAC,SACxBC,sBAAsB;AAAA,SAE7BC,4BAA4B,EAC5BC,eAAe,EACfC,oBAAoB,EACpBC,mBAAmB,EACnBC,mBAAmB;AAAA;AAAA;AASrB,IAAMC,GAAG,GAAGP,GAAG,CAACQ,MAAM,CAAC,eAAe,CAAC;AAEvC,OAAO,IAAMC,YAAY,gBAAGb,aAAa,CAA2B,IAAI,CAAC;AAOzE,OAAO,SAASc,aAAa,OAGO;EAAA,IAHN;IAC5BC,MAAM;IACNC;EACkB,CAAC;EACnB,IAAMC,UAAU,GAAGf,OAAO,CAAC,MAAMM,oBAAoB,EAAE,EAAE,EAAE,C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
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { ThemeData, ThemePreloadData, ThemePreloadStyleContent, ThemeRegistrationData } from './ThemeModel';
|
|
2
|
+
export declare const TMP_CSS_PROP_PREFIX = "dh-tmp";
|
|
3
|
+
export type VarExpressionResolver = (varExpression: string) => string;
|
|
2
4
|
/**
|
|
3
5
|
* Creates a string containing preload style content for the current theme.
|
|
4
6
|
* This resolves the current values of a few CSS variables that can be used
|
|
5
7
|
* to style the page before the theme is loaded on next page load.
|
|
6
8
|
*/
|
|
7
9
|
export declare function calculatePreloadStyleContent(): ThemePreloadStyleContent;
|
|
10
|
+
/**
|
|
11
|
+
* Extracts all css variable expressions from the given record and returns
|
|
12
|
+
* a set of unique expressions.
|
|
13
|
+
* @param record The record to extract css variable expressions from
|
|
14
|
+
*/
|
|
15
|
+
export declare function extractDistinctCssVariableExpressions(record: Record<string, string>): Set<string>;
|
|
8
16
|
/**
|
|
9
17
|
* Returns an array of the active themes. The first item will always be one
|
|
10
18
|
* of the base themes. Optionally, the second item will be a custom theme.
|
|
@@ -19,6 +27,59 @@ export declare function getDefaultBaseThemes(): ThemeData[];
|
|
|
19
27
|
* invalid
|
|
20
28
|
*/
|
|
21
29
|
export declare function getThemePreloadData(): ThemePreloadData | null;
|
|
30
|
+
/**
|
|
31
|
+
* Identifies start and end indices of any css variable expressions in the given
|
|
32
|
+
* string.
|
|
33
|
+
*
|
|
34
|
+
* e.g.
|
|
35
|
+
* getCssVariableRanges('var(--aaa-aa) var(--bbb-bb)')
|
|
36
|
+
* yields:
|
|
37
|
+
* [
|
|
38
|
+
* [0, 12],
|
|
39
|
+
* [14, 26],
|
|
40
|
+
* ]
|
|
41
|
+
*
|
|
42
|
+
* In cases where there are nested expressions, only the indices of the outermost
|
|
43
|
+
* expression will be included.
|
|
44
|
+
*
|
|
45
|
+
* e.g.
|
|
46
|
+
* getCssVariableRanges('var(--ccc-cc, var(--aaa-aa, green)) var(--bbb-bb)')
|
|
47
|
+
* yields:
|
|
48
|
+
* [
|
|
49
|
+
* [0, 34], // range for --ccc-cc expression
|
|
50
|
+
* [36, 48], // range for --bbb-bb expression
|
|
51
|
+
* ]
|
|
52
|
+
* @param value The string to search for css variable expressions
|
|
53
|
+
* @returns An array of [start, end] index pairs for each css variable expression
|
|
54
|
+
*/
|
|
55
|
+
export declare function getCssVariableRanges(value: string): [number, number][];
|
|
56
|
+
/**
|
|
57
|
+
* Make a copy of the given object replacing any css variable expressions
|
|
58
|
+
* contained in its prop values with values resolved from the given HTML element.
|
|
59
|
+
* Variables that resolve to color strings will also be normalized to rgb or
|
|
60
|
+
* rgba color strings.
|
|
61
|
+
*
|
|
62
|
+
* Note that the browser will force a reflow when calling `getComputedStyle` if
|
|
63
|
+
* css properties have changed. In order to avoid a reflow for every property
|
|
64
|
+
* check we use distinct setup, resolve / normalize, and cleanup passes:
|
|
65
|
+
* 1. Setup - Create a tmp element and set all css props we want to evaluate
|
|
66
|
+
* 2. Resolve / Normalize - Evaluate all css props via `getPropertyValue` calls
|
|
67
|
+
* and replace the original expressions with resolved values. Also normalize
|
|
68
|
+
* css colors to rgb/a.
|
|
69
|
+
* 3. Cleanup - Remove the tmp element
|
|
70
|
+
* @param record An object whose values may contain css var expressions
|
|
71
|
+
* @param targetElement The element to resolve css variables against. Defaults
|
|
72
|
+
* to document.body
|
|
73
|
+
*/
|
|
74
|
+
export declare function resolveCssVariablesInRecord<T extends Record<string, string>>(record: T, targetElement?: HTMLElement): T;
|
|
75
|
+
/**
|
|
76
|
+
* Resolve css variable expressions in the given string using the
|
|
77
|
+
* given resolver and replace the original expressions with the resolved values.
|
|
78
|
+
*
|
|
79
|
+
* @param resolver Function that can resolve a css variable expression
|
|
80
|
+
* @param value Value that may contain css variable expressions
|
|
81
|
+
*/
|
|
82
|
+
export declare function resolveCssVariablesInString(resolver: VarExpressionResolver, value: string): string;
|
|
22
83
|
/**
|
|
23
84
|
* Store theme preload data in local storage.
|
|
24
85
|
* @param preloadData The preload data to set
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeUtils.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeUtils.ts"],"names":[],"mappings":"AAgBA,OAAO,EAIL,SAAS,EACT,gBAAgB,EAChB,wBAAwB,EACxB,qBAAqB,EAEtB,MAAM,cAAc,CAAC;AAItB;;;;GAIG;AACH,wBAAgB,4BAA4B,IAAI,wBAAwB,CAWvE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,iBAAiB,EAAE,qBAAqB,GACvC,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,CA+BtC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,SAAS,EAAE,CAalD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,gBAAgB,GAAG,IAAI,CAU7D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,gBAAgB,GAAG,IAAI,CAKvE;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEzE;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,IAAI,CAUnC"}
|
|
1
|
+
{"version":3,"file":"ThemeUtils.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeUtils.ts"],"names":[],"mappings":"AAgBA,OAAO,EAIL,SAAS,EACT,gBAAgB,EAChB,wBAAwB,EACxB,qBAAqB,EAEtB,MAAM,cAAc,CAAC;AAItB,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAE5C,MAAM,MAAM,qBAAqB,GAAG,CAAC,aAAa,EAAE,MAAM,KAAK,MAAM,CAAC;AAEtE;;;;GAIG;AACH,wBAAgB,4BAA4B,IAAI,wBAAwB,CAWvE;AAED;;;;GAIG;AACH,wBAAgB,qCAAqC,CACnD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,GAAG,CAAC,MAAM,CAAC,CAUb;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,iBAAiB,EAAE,qBAAqB,GACvC,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,CA+BtC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,SAAS,EAAE,CAalD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,gBAAgB,GAAG,IAAI,CAU7D;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAgCtE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,2BAA2B,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1E,MAAM,EAAE,CAAC,EACT,aAAa,GAAE,WAA2B,GACzC,CAAC,CA2CH;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,qBAAqB,EAC/B,KAAK,EAAE,MAAM,GACZ,MAAM,CAmBR;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,gBAAgB,GAAG,IAAI,CAKvE;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEzE;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,IAAI,CAUnC"}
|
package/dist/theme/ThemeUtils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Log from '@deephaven/log';
|
|
2
|
-
import { assertNotNull } from '@deephaven/utils';
|
|
2
|
+
import { assertNotNull, ColorUtils } from '@deephaven/utils';
|
|
3
3
|
// Note that ?inline imports are natively supported by Vite, but consumers of
|
|
4
4
|
// @deephaven/components using Webpack will need to add a rule to their module
|
|
5
5
|
// config.
|
|
@@ -12,11 +12,11 @@ import { assertNotNull } from '@deephaven/utils';
|
|
|
12
12
|
// },
|
|
13
13
|
// ],
|
|
14
14
|
// },
|
|
15
|
-
import
|
|
16
|
-
import
|
|
15
|
+
import { themeDark } from "./theme-dark/index.js";
|
|
16
|
+
import { themeLight } from "./theme-light/index.js";
|
|
17
17
|
import { DEFAULT_DARK_THEME_KEY, DEFAULT_LIGHT_THEME_KEY, DEFAULT_PRELOAD_DATA_VARIABLES, THEME_CACHE_LOCAL_STORAGE_KEY } from "./ThemeModel.js";
|
|
18
18
|
var log = Log.module('ThemeUtils');
|
|
19
|
-
|
|
19
|
+
export var TMP_CSS_PROP_PREFIX = 'dh-tmp';
|
|
20
20
|
/**
|
|
21
21
|
* Creates a string containing preload style content for the current theme.
|
|
22
22
|
* This resolves the current values of a few CSS variables that can be used
|
|
@@ -34,6 +34,22 @@ export function calculatePreloadStyleContent() {
|
|
|
34
34
|
return ":root{".concat(pairs.join(';'), "}");
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Extracts all css variable expressions from the given record and returns
|
|
39
|
+
* a set of unique expressions.
|
|
40
|
+
* @param record The record to extract css variable expressions from
|
|
41
|
+
*/
|
|
42
|
+
export function extractDistinctCssVariableExpressions(record) {
|
|
43
|
+
var set = new Set();
|
|
44
|
+
Object.values(record).forEach(value => {
|
|
45
|
+
getCssVariableRanges(value).forEach(_ref2 => {
|
|
46
|
+
var [start, end] = _ref2;
|
|
47
|
+
set.add(value.substring(start, end + 1));
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
return set;
|
|
51
|
+
}
|
|
52
|
+
|
|
37
53
|
/**
|
|
38
54
|
* Returns an array of the active themes. The first item will always be one
|
|
39
55
|
* of the base themes. Optionally, the second item will be a custom theme.
|
|
@@ -59,11 +75,11 @@ export function getDefaultBaseThemes() {
|
|
|
59
75
|
return [{
|
|
60
76
|
name: 'Default Dark',
|
|
61
77
|
themeKey: DEFAULT_DARK_THEME_KEY,
|
|
62
|
-
styleContent:
|
|
78
|
+
styleContent: themeDark
|
|
63
79
|
}, {
|
|
64
80
|
name: 'Default Light',
|
|
65
81
|
themeKey: DEFAULT_LIGHT_THEME_KEY,
|
|
66
|
-
styleContent:
|
|
82
|
+
styleContent: themeLight
|
|
67
83
|
}];
|
|
68
84
|
}
|
|
69
85
|
|
|
@@ -81,6 +97,136 @@ export function getThemePreloadData() {
|
|
|
81
97
|
return null;
|
|
82
98
|
}
|
|
83
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Identifies start and end indices of any css variable expressions in the given
|
|
102
|
+
* string.
|
|
103
|
+
*
|
|
104
|
+
* e.g.
|
|
105
|
+
* getCssVariableRanges('var(--aaa-aa) var(--bbb-bb)')
|
|
106
|
+
* yields:
|
|
107
|
+
* [
|
|
108
|
+
* [0, 12],
|
|
109
|
+
* [14, 26],
|
|
110
|
+
* ]
|
|
111
|
+
*
|
|
112
|
+
* In cases where there are nested expressions, only the indices of the outermost
|
|
113
|
+
* expression will be included.
|
|
114
|
+
*
|
|
115
|
+
* e.g.
|
|
116
|
+
* getCssVariableRanges('var(--ccc-cc, var(--aaa-aa, green)) var(--bbb-bb)')
|
|
117
|
+
* yields:
|
|
118
|
+
* [
|
|
119
|
+
* [0, 34], // range for --ccc-cc expression
|
|
120
|
+
* [36, 48], // range for --bbb-bb expression
|
|
121
|
+
* ]
|
|
122
|
+
* @param value The string to search for css variable expressions
|
|
123
|
+
* @returns An array of [start, end] index pairs for each css variable expression
|
|
124
|
+
*/
|
|
125
|
+
export function getCssVariableRanges(value) {
|
|
126
|
+
var ranges = [];
|
|
127
|
+
var cssVarPrefix = 'var(--';
|
|
128
|
+
var start = value.indexOf(cssVarPrefix);
|
|
129
|
+
var parenLevel = 0;
|
|
130
|
+
while (start > -1) {
|
|
131
|
+
parenLevel = 1;
|
|
132
|
+
var i = start + cssVarPrefix.length;
|
|
133
|
+
for (; i < value.length; i += 1) {
|
|
134
|
+
if (value[i] === '(') {
|
|
135
|
+
parenLevel += 1;
|
|
136
|
+
} else if (value[i] === ')') {
|
|
137
|
+
parenLevel -= 1;
|
|
138
|
+
}
|
|
139
|
+
if (parenLevel === 0) {
|
|
140
|
+
ranges.push([start, i]);
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (parenLevel !== 0) {
|
|
145
|
+
log.error('Unbalanced parentheses in css var expression', value);
|
|
146
|
+
return [];
|
|
147
|
+
}
|
|
148
|
+
start = value.indexOf(cssVarPrefix, i + 1);
|
|
149
|
+
}
|
|
150
|
+
return ranges;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Make a copy of the given object replacing any css variable expressions
|
|
155
|
+
* contained in its prop values with values resolved from the given HTML element.
|
|
156
|
+
* Variables that resolve to color strings will also be normalized to rgb or
|
|
157
|
+
* rgba color strings.
|
|
158
|
+
*
|
|
159
|
+
* Note that the browser will force a reflow when calling `getComputedStyle` if
|
|
160
|
+
* css properties have changed. In order to avoid a reflow for every property
|
|
161
|
+
* check we use distinct setup, resolve / normalize, and cleanup passes:
|
|
162
|
+
* 1. Setup - Create a tmp element and set all css props we want to evaluate
|
|
163
|
+
* 2. Resolve / Normalize - Evaluate all css props via `getPropertyValue` calls
|
|
164
|
+
* and replace the original expressions with resolved values. Also normalize
|
|
165
|
+
* css colors to rgb/a.
|
|
166
|
+
* 3. Cleanup - Remove the tmp element
|
|
167
|
+
* @param record An object whose values may contain css var expressions
|
|
168
|
+
* @param targetElement The element to resolve css variables against. Defaults
|
|
169
|
+
* to document.body
|
|
170
|
+
*/
|
|
171
|
+
export function resolveCssVariablesInRecord(record) {
|
|
172
|
+
var targetElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.body;
|
|
173
|
+
var perfStart = performance.now();
|
|
174
|
+
|
|
175
|
+
// Add a temporary div to attach temp css variables to
|
|
176
|
+
var tmpPropEl = document.createElement('div');
|
|
177
|
+
targetElement.appendChild(tmpPropEl);
|
|
178
|
+
var varExpressions = [...extractDistinctCssVariableExpressions(record)];
|
|
179
|
+
|
|
180
|
+
// Set temporary css variables for resolving var expressions
|
|
181
|
+
varExpressions.forEach((varExpression, i) => {
|
|
182
|
+
var tmpPropKey = "--".concat(TMP_CSS_PROP_PREFIX, "-").concat(i);
|
|
183
|
+
tmpPropEl.style.setProperty(tmpPropKey, varExpression);
|
|
184
|
+
});
|
|
185
|
+
var result = {};
|
|
186
|
+
var computedStyle = window.getComputedStyle(tmpPropEl);
|
|
187
|
+
var resolver = varExpression => {
|
|
188
|
+
var tmpPropKey = "--".concat(TMP_CSS_PROP_PREFIX, "-").concat(varExpressions.indexOf(varExpression));
|
|
189
|
+
var resolved = computedStyle.getPropertyValue(tmpPropKey);
|
|
190
|
+
return ColorUtils.normalizeCssColor(resolved);
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
// Resolve the temporary css variables
|
|
194
|
+
Object.entries(record).forEach(_ref3 => {
|
|
195
|
+
var [key, value] = _ref3;
|
|
196
|
+
result[key] = resolveCssVariablesInString(resolver, value);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
// Remove the temporary css variables
|
|
200
|
+
tmpPropEl.remove();
|
|
201
|
+
log.debug('Resolved css variables', performance.now() - perfStart, 'ms');
|
|
202
|
+
return result;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Resolve css variable expressions in the given string using the
|
|
207
|
+
* given resolver and replace the original expressions with the resolved values.
|
|
208
|
+
*
|
|
209
|
+
* @param resolver Function that can resolve a css variable expression
|
|
210
|
+
* @param value Value that may contain css variable expressions
|
|
211
|
+
*/
|
|
212
|
+
export function resolveCssVariablesInString(resolver, value) {
|
|
213
|
+
var result = [];
|
|
214
|
+
var i = 0;
|
|
215
|
+
getCssVariableRanges(value).forEach(_ref4 => {
|
|
216
|
+
var [start, end] = _ref4;
|
|
217
|
+
if (i < start) {
|
|
218
|
+
result.push(value.substring(i, start));
|
|
219
|
+
i += start - i;
|
|
220
|
+
}
|
|
221
|
+
result.push(resolver(value.substring(start, end + 1)));
|
|
222
|
+
i += end - start + 1;
|
|
223
|
+
});
|
|
224
|
+
if (result.length === 0) {
|
|
225
|
+
return value;
|
|
226
|
+
}
|
|
227
|
+
return result.join('');
|
|
228
|
+
}
|
|
229
|
+
|
|
84
230
|
/**
|
|
85
231
|
* Store theme preload data in local storage.
|
|
86
232
|
* @param preloadData The preload data to set
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeUtils.js","names":["Log","assertNotNull","darkTheme","lightTheme","DEFAULT_DARK_THEME_KEY","DEFAULT_LIGHT_THEME_KEY","DEFAULT_PRELOAD_DATA_VARIABLES","THEME_CACHE_LOCAL_STORAGE_KEY","log","module","calculatePreloadStyleContent","bodyStyle","getComputedStyle","document","body","pairs","Object","entries","map","key","defaultValue","getPropertyValue","join","getActiveThemes","themeKey","themeRegistration","custom","find","theme","baseThemeKey","base","error","debug","getDefaultBaseThemes","name","styleContent","getThemePreloadData","data","localStorage","getItem","JSON","parse","setThemePreloadData","preloadData","setItem","stringify","getThemeKey","pluginName","themeName","preloadTheme","preloadStyleContent","style","createElement","innerHTML","head","appendChild"],"sources":["../../src/theme/ThemeUtils.ts"],"sourcesContent":["import Log from '@deephaven/log';\nimport { assertNotNull } from '@deephaven/utils';\n// Note that ?inline imports are natively supported by Vite, but consumers of\n// @deephaven/components using Webpack will need to add a rule to their module\n// config.\n// e.g.\n// module: {\n// rules: [\n// {\n// resourceQuery: /inline/,\n// type: 'asset/source',\n// },\n// ],\n// },\nimport darkTheme from './theme_default_dark.css?inline';\nimport lightTheme from './theme_default_light.css?inline';\nimport {\n DEFAULT_DARK_THEME_KEY,\n DEFAULT_LIGHT_THEME_KEY,\n DEFAULT_PRELOAD_DATA_VARIABLES,\n ThemeData,\n ThemePreloadData,\n ThemePreloadStyleContent,\n ThemeRegistrationData,\n THEME_CACHE_LOCAL_STORAGE_KEY,\n} from './ThemeModel';\n\nconst log = Log.module('ThemeUtils');\n\n/**\n * Creates a string containing preload style content for the current theme.\n * This resolves the current values of a few CSS variables that can be used\n * to style the page before the theme is loaded on next page load.\n */\nexport function calculatePreloadStyleContent(): ThemePreloadStyleContent {\n const bodyStyle = getComputedStyle(document.body);\n\n // Calculate the current preload variables. If the variable is not set, use\n // the default value.\n const pairs = Object.entries(DEFAULT_PRELOAD_DATA_VARIABLES).map(\n ([key, defaultValue]) =>\n `${key}:${bodyStyle.getPropertyValue(key) || defaultValue}`\n );\n\n return `:root{${pairs.join(';')}}`;\n}\n\n/**\n * Returns an array of the active themes. The first item will always be one\n * of the base themes. Optionally, the second item will be a custom theme.\n */\nexport function getActiveThemes(\n themeKey: string,\n themeRegistration: ThemeRegistrationData\n): [ThemeData] | [ThemeData, ThemeData] {\n const custom = themeRegistration.custom.find(\n theme => theme.themeKey === themeKey\n );\n\n const baseThemeKey = custom?.baseThemeKey ?? themeKey;\n\n let base = themeRegistration.base.find(\n theme => theme.themeKey === baseThemeKey\n );\n\n if (base == null) {\n log.error(\n `No registered base theme found for theme key: '${baseThemeKey}'`,\n 'Registered:',\n themeRegistration.base.map(theme => theme.themeKey),\n themeRegistration.custom.map(theme => theme.themeKey)\n );\n base = themeRegistration.base.find(\n theme => theme.themeKey === DEFAULT_DARK_THEME_KEY\n );\n\n assertNotNull(\n base,\n `Default base theme '${DEFAULT_DARK_THEME_KEY}' is not registered`\n );\n }\n\n log.debug('Applied themes:', base.themeKey, custom?.themeKey);\n\n return custom == null ? [base] : [base, custom];\n}\n\n/**\n * Get default base theme data.\n */\nexport function getDefaultBaseThemes(): ThemeData[] {\n return [\n {\n name: 'Default Dark',\n themeKey: DEFAULT_DARK_THEME_KEY,\n styleContent: darkTheme,\n },\n {\n name: 'Default Light',\n themeKey: DEFAULT_LIGHT_THEME_KEY,\n styleContent: lightTheme,\n },\n ];\n}\n\n/**\n * Get the preload data from local storage or null if it does not exist or is\n * invalid\n */\nexport function getThemePreloadData(): ThemePreloadData | null {\n const data = localStorage.getItem(THEME_CACHE_LOCAL_STORAGE_KEY);\n\n try {\n return data == null ? null : JSON.parse(data);\n } catch {\n // ignore\n }\n\n return null;\n}\n\n/**\n * Store theme preload data in local storage.\n * @param preloadData The preload data to set\n */\nexport function setThemePreloadData(preloadData: ThemePreloadData): void {\n localStorage.setItem(\n THEME_CACHE_LOCAL_STORAGE_KEY,\n JSON.stringify(preloadData)\n );\n}\n\n/**\n * Derive unique theme key from plugin root path and theme name.\n * @param pluginName The root path of the plugin\n * @param themeName The name of the theme\n */\nexport function getThemeKey(pluginName: string, themeName: string): string {\n return `${pluginName}_${themeName}`;\n}\n\n/**\n * Preload minimal theme variables from the cache.\n */\nexport function preloadTheme(): void {\n const preloadStyleContent =\n getThemePreloadData()?.preloadStyleContent ??\n calculatePreloadStyleContent();\n\n log.debug('Preloading theme content:', `'${preloadStyleContent}'`);\n\n const style = document.createElement('style');\n style.innerHTML = preloadStyleContent;\n document.head.appendChild(style);\n}\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,gBAAgB;AAChC,SAASC,aAAa,QAAQ,kBAAkB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA,OACOC,SAAS;AAAA,OACTC,UAAU;AAAA,SAEfC,sBAAsB,EACtBC,uBAAuB,EACvBC,8BAA8B,EAK9BC,6BAA6B;AAG/B,IAAMC,GAAG,GAAGR,GAAG,CAACS,MAAM,CAAC,YAAY,CAAC;;AAEpC;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,4BAA4B,GAA6B;EACvE,IAAMC,SAAS,GAAGC,gBAAgB,CAACC,QAAQ,CAACC,IAAI,CAAC;;EAEjD;EACA;EACA,IAAMC,KAAK,GAAGC,MAAM,CAACC,OAAO,CAACX,8BAA8B,CAAC,CAACY,GAAG,CAC9D;IAAA,IAAC,CAACC,GAAG,EAAEC,YAAY,CAAC;IAAA,iBACfD,GAAG,cAAIR,SAAS,CAACU,gBAAgB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NotNull","ColorUtils","themeDark","themeLight","DEFAULT_DARK_THEME_KEY","DEFAULT_LIGHT_THEME_KEY","DEFAULT_PRELOAD_DATA_VARIABLES","THEME_CACHE_LOCAL_STORAGE_KEY","log","module","TMP_CSS_PROP_PREFIX","calculatePreloadStyleContent","bodyStyle","getComputedStyle","document","body","pairs","Object","entries","map","key","defaultValue","getPropertyValue","join","extractDistinctCssVariableExpressions","record","set","Set","values","forEach","value","getCssVariableRanges","start","end","add","substring","getActiveThemes","themeKey","themeRegistration","custom","find","theme","baseThemeKey","base","error","debug","getDefaultBaseThemes","name","styleContent","getThemePreloadData","data","localStorage","getItem","JSON","parse","ranges","cssVarPrefix","indexOf","parenLevel","i","length","push","resolveCssVariablesInRecord","targetElement","perfStart","performance","now","tmpPropEl","createElement","appendChild","varExpressions","varExpression","tmpPropKey","style","setProperty","result","computedStyle","window","resolver","resolved","normalizeCssColor","resolveCssVariablesInString","remove","setThemePreloadData","preloadData","setItem","stringify","getThemeKey","pluginName","themeName","preloadTheme","preloadStyleContent","innerHTML","head"],"sources":["../../src/theme/ThemeUtils.ts"],"sourcesContent":["import Log from '@deephaven/log';\nimport { assertNotNull, ColorUtils } from '@deephaven/utils';\n// Note that ?inline imports are natively supported by Vite, but consumers of\n// @deephaven/components using Webpack will need to add a rule to their module\n// config.\n// e.g.\n// module: {\n// rules: [\n// {\n// resourceQuery: /inline/,\n// type: 'asset/source',\n// },\n// ],\n// },\nimport { themeDark } from './theme-dark';\nimport { themeLight } from './theme-light';\nimport {\n DEFAULT_DARK_THEME_KEY,\n DEFAULT_LIGHT_THEME_KEY,\n DEFAULT_PRELOAD_DATA_VARIABLES,\n ThemeData,\n ThemePreloadData,\n ThemePreloadStyleContent,\n ThemeRegistrationData,\n THEME_CACHE_LOCAL_STORAGE_KEY,\n} from './ThemeModel';\n\nconst log = Log.module('ThemeUtils');\n\nexport const TMP_CSS_PROP_PREFIX = 'dh-tmp';\n\nexport type VarExpressionResolver = (varExpression: string) => string;\n\n/**\n * Creates a string containing preload style content for the current theme.\n * This resolves the current values of a few CSS variables that can be used\n * to style the page before the theme is loaded on next page load.\n */\nexport function calculatePreloadStyleContent(): ThemePreloadStyleContent {\n const bodyStyle = getComputedStyle(document.body);\n\n // Calculate the current preload variables. If the variable is not set, use\n // the default value.\n const pairs = Object.entries(DEFAULT_PRELOAD_DATA_VARIABLES).map(\n ([key, defaultValue]) =>\n `${key}:${bodyStyle.getPropertyValue(key) || defaultValue}`\n );\n\n return `:root{${pairs.join(';')}}`;\n}\n\n/**\n * Extracts all css variable expressions from the given record and returns\n * a set of unique expressions.\n * @param record The record to extract css variable expressions from\n */\nexport function extractDistinctCssVariableExpressions(\n record: Record<string, string>\n): Set<string> {\n const set = new Set<string>();\n\n Object.values(record).forEach(value => {\n getCssVariableRanges(value).forEach(([start, end]) => {\n set.add(value.substring(start, end + 1));\n });\n });\n\n return set;\n}\n\n/**\n * Returns an array of the active themes. The first item will always be one\n * of the base themes. Optionally, the second item will be a custom theme.\n */\nexport function getActiveThemes(\n themeKey: string,\n themeRegistration: ThemeRegistrationData\n): [ThemeData] | [ThemeData, ThemeData] {\n const custom = themeRegistration.custom.find(\n theme => theme.themeKey === themeKey\n );\n\n const baseThemeKey = custom?.baseThemeKey ?? themeKey;\n\n let base = themeRegistration.base.find(\n theme => theme.themeKey === baseThemeKey\n );\n\n if (base == null) {\n log.error(\n `No registered base theme found for theme key: '${baseThemeKey}'`,\n 'Registered:',\n themeRegistration.base.map(theme => theme.themeKey),\n themeRegistration.custom.map(theme => theme.themeKey)\n );\n base = themeRegistration.base.find(\n theme => theme.themeKey === DEFAULT_DARK_THEME_KEY\n );\n\n assertNotNull(\n base,\n `Default base theme '${DEFAULT_DARK_THEME_KEY}' is not registered`\n );\n }\n\n log.debug('Applied themes:', base.themeKey, custom?.themeKey);\n\n return custom == null ? [base] : [base, custom];\n}\n\n/**\n * Get default base theme data.\n */\nexport function getDefaultBaseThemes(): ThemeData[] {\n return [\n {\n name: 'Default Dark',\n themeKey: DEFAULT_DARK_THEME_KEY,\n styleContent: themeDark,\n },\n {\n name: 'Default Light',\n themeKey: DEFAULT_LIGHT_THEME_KEY,\n styleContent: themeLight,\n },\n ];\n}\n\n/**\n * Get the preload data from local storage or null if it does not exist or is\n * invalid\n */\nexport function getThemePreloadData(): ThemePreloadData | null {\n const data = localStorage.getItem(THEME_CACHE_LOCAL_STORAGE_KEY);\n\n try {\n return data == null ? null : JSON.parse(data);\n } catch {\n // ignore\n }\n\n return null;\n}\n\n/**\n * Identifies start and end indices of any css variable expressions in the given\n * string.\n *\n * e.g.\n * getCssVariableRanges('var(--aaa-aa) var(--bbb-bb)')\n * yields:\n * [\n * [0, 12],\n * [14, 26],\n * ]\n *\n * In cases where there are nested expressions, only the indices of the outermost\n * expression will be included.\n *\n * e.g.\n * getCssVariableRanges('var(--ccc-cc, var(--aaa-aa, green)) var(--bbb-bb)')\n * yields:\n * [\n * [0, 34], // range for --ccc-cc expression\n * [36, 48], // range for --bbb-bb expression\n * ]\n * @param value The string to search for css variable expressions\n * @returns An array of [start, end] index pairs for each css variable expression\n */\nexport function getCssVariableRanges(value: string): [number, number][] {\n const ranges: [number, number][] = [];\n\n const cssVarPrefix = 'var(--';\n let start = value.indexOf(cssVarPrefix);\n let parenLevel = 0;\n\n while (start > -1) {\n parenLevel = 1;\n let i = start + cssVarPrefix.length;\n for (; i < value.length; i += 1) {\n if (value[i] === '(') {\n parenLevel += 1;\n } else if (value[i] === ')') {\n parenLevel -= 1;\n }\n\n if (parenLevel === 0) {\n ranges.push([start, i]);\n break;\n }\n }\n\n if (parenLevel !== 0) {\n log.error('Unbalanced parentheses in css var expression', value);\n return [];\n }\n\n start = value.indexOf(cssVarPrefix, i + 1);\n }\n\n return ranges;\n}\n\n/**\n * Make a copy of the given object replacing any css variable expressions\n * contained in its prop values with values resolved from the given HTML element.\n * Variables that resolve to color strings will also be normalized to rgb or\n * rgba color strings.\n *\n * Note that the browser will force a reflow when calling `getComputedStyle` if\n * css properties have changed. In order to avoid a reflow for every property\n * check we use distinct setup, resolve / normalize, and cleanup passes:\n * 1. Setup - Create a tmp element and set all css props we want to evaluate\n * 2. Resolve / Normalize - Evaluate all css props via `getPropertyValue` calls\n * and replace the original expressions with resolved values. Also normalize\n * css colors to rgb/a.\n * 3. Cleanup - Remove the tmp element\n * @param record An object whose values may contain css var expressions\n * @param targetElement The element to resolve css variables against. Defaults\n * to document.body\n */\nexport function resolveCssVariablesInRecord<T extends Record<string, string>>(\n record: T,\n targetElement: HTMLElement = document.body\n): T {\n const perfStart = performance.now();\n\n // Add a temporary div to attach temp css variables to\n const tmpPropEl = document.createElement('div');\n targetElement.appendChild(tmpPropEl);\n\n const varExpressions = [...extractDistinctCssVariableExpressions(record)];\n\n // Set temporary css variables for resolving var expressions\n varExpressions.forEach((varExpression, i) => {\n const tmpPropKey = `--${TMP_CSS_PROP_PREFIX}-${i}`;\n tmpPropEl.style.setProperty(tmpPropKey, varExpression);\n });\n\n const result = {} as T;\n\n const computedStyle = window.getComputedStyle(tmpPropEl);\n\n const resolver = (varExpression: string): string => {\n const tmpPropKey = `--${TMP_CSS_PROP_PREFIX}-${varExpressions.indexOf(\n varExpression\n )}`;\n\n const resolved = computedStyle.getPropertyValue(tmpPropKey);\n\n return ColorUtils.normalizeCssColor(resolved);\n };\n\n // Resolve the temporary css variables\n Object.entries(record).forEach(([key, value]) => {\n result[key as keyof T] = resolveCssVariablesInString(\n resolver,\n value\n ) as T[keyof T];\n });\n\n // Remove the temporary css variables\n tmpPropEl.remove();\n\n log.debug('Resolved css variables', performance.now() - perfStart, 'ms');\n\n return result;\n}\n\n/**\n * Resolve css variable expressions in the given string using the\n * given resolver and replace the original expressions with the resolved values.\n *\n * @param resolver Function that can resolve a css variable expression\n * @param value Value that may contain css variable expressions\n */\nexport function resolveCssVariablesInString(\n resolver: VarExpressionResolver,\n value: string\n): string {\n const result: string[] = [];\n let i = 0;\n getCssVariableRanges(value).forEach(([start, end]) => {\n if (i < start) {\n result.push(value.substring(i, start));\n i += start - i;\n }\n\n result.push(resolver(value.substring(start, end + 1)));\n\n i += end - start + 1;\n });\n\n if (result.length === 0) {\n return value;\n }\n\n return result.join('');\n}\n\n/**\n * Store theme preload data in local storage.\n * @param preloadData The preload data to set\n */\nexport function setThemePreloadData(preloadData: ThemePreloadData): void {\n localStorage.setItem(\n THEME_CACHE_LOCAL_STORAGE_KEY,\n JSON.stringify(preloadData)\n );\n}\n\n/**\n * Derive unique theme key from plugin root path and theme name.\n * @param pluginName The root path of the plugin\n * @param themeName The name of the theme\n */\nexport function getThemeKey(pluginName: string, themeName: string): string {\n return `${pluginName}_${themeName}`;\n}\n\n/**\n * Preload minimal theme variables from the cache.\n */\nexport function preloadTheme(): void {\n const preloadStyleContent =\n getThemePreloadData()?.preloadStyleContent ??\n calculatePreloadStyleContent();\n\n log.debug('Preloading theme content:', `'${preloadStyleContent}'`);\n\n const style = document.createElement('style');\n style.innerHTML = preloadStyleContent;\n document.head.appendChild(style);\n}\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,gBAAgB;AAChC,SAASC,aAAa,EAAEC,UAAU,QAAQ,kBAAkB;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA,SACSC,SAAS;AAAA,SACTC,UAAU;AAAA,SAEjBC,sBAAsB,EACtBC,uBAAuB,EACvBC,8BAA8B,EAK9BC,6BAA6B;AAG/B,IAAMC,GAAG,GAAGT,GAAG,CAACU,MAAM,CAAC,YAAY,CAAC;AAEpC,OAAO,IAAMC,mBAAmB,GAAG,QAAQ;AAI3C;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,4BAA4B,GAA6B;EACvE,IAAMC,SAAS,GAAGC,gBAAgB,CAACC,QAAQ,CAACC,IAAI,CAAC;;EAEjD;EACA;EACA,IAAMC,KAAK,GAAGC,MAAM,CAACC,OAAO,CAACZ,8BAA8B,CAAC,CAACa,GAAG,CAC9D;IAAA,IAAC,CAACC,GAAG,EAAEC,Y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mBAAmB;EACrC7E,QAAQ,CAAC+E,IAAI,CAACxB,WAAW,CAACI,KAAK,CAAC;AAClC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/theme/theme-dark/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,SAAS,QAKV,CAAC;AAEb,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import themeDarkPalette from "./theme-dark-palette.css?inline";
|
|
2
|
+
import themeDarkSemantic from "./theme-dark-semantic.css?inline";
|
|
3
|
+
import themeDarkSemanticEditor from "./theme-dark-semantic-editor.css?inline";
|
|
4
|
+
import themeDarkSemanticGrid from "./theme-dark-semantic-grid.css?inline";
|
|
5
|
+
export var themeDark = [themeDarkPalette, themeDarkSemantic, themeDarkSemanticEditor, themeDarkSemanticGrid].join('\n');
|
|
6
|
+
export default themeDark;
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["themeDarkPalette","themeDarkSemantic","themeDarkSemanticEditor","themeDarkSemanticGrid","themeDark","join"],"sources":["../../../src/theme/theme-dark/index.ts"],"sourcesContent":["import themeDarkPalette from './theme-dark-palette.css?inline';\nimport themeDarkSemantic from './theme-dark-semantic.css?inline';\nimport themeDarkSemanticEditor from './theme-dark-semantic-editor.css?inline';\nimport themeDarkSemanticGrid from './theme-dark-semantic-grid.css?inline';\n\nexport const themeDark = [\n themeDarkPalette,\n themeDarkSemantic,\n themeDarkSemanticEditor,\n themeDarkSemanticGrid,\n].join('\\n');\n\nexport default themeDark;\n"],"mappings":"OAAOA,gBAAgB;AAAA,OAChBC,iBAAiB;AAAA,OACjBC,uBAAuB;AAAA,OACvBC,qBAAqB;AAE5B,OAAO,IAAMC,SAAS,GAAG,CACvBJ,gBAAgB,EAChBC,iBAAiB,EACjBC,uBAAuB,EACvBC,qBAAqB,CACtB,CAACE,IAAI,CAAC,IAAI,CAAC;AAEZ,eAAeD,SAAS"}
|