@deephaven/components 0.107.3-alpha-parent-theme.13 → 0.107.3-alpha-parent-theme.15
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/dist/theme/ThemeProvider.d.ts +1 -1
- package/dist/theme/ThemeProvider.d.ts.map +1 -1
- package/dist/theme/ThemeProvider.js +39 -8
- package/dist/theme/ThemeProvider.js.map +1 -1
- package/dist/theme/ThemeUtils.d.ts.map +1 -1
- package/dist/theme/ThemeUtils.js +6 -0
- package/dist/theme/ThemeUtils.js.map +1 -1
- package/dist/theme/useParentWindowTheme.d.ts +1 -0
- package/dist/theme/useParentWindowTheme.d.ts.map +1 -1
- package/dist/theme/useParentWindowTheme.js +13 -7
- package/dist/theme/useParentWindowTheme.js.map +1 -1
- package/package.json +8 -8
|
@@ -13,6 +13,6 @@ export interface ThemeProviderProps {
|
|
|
13
13
|
defaultPreloadValues?: Record<string, string>;
|
|
14
14
|
children: ReactNode;
|
|
15
15
|
}
|
|
16
|
-
export declare function ThemeProvider({ themes:
|
|
16
|
+
export declare function ThemeProvider({ themes: propThemes, defaultPreloadValues, children, }: ThemeProviderProps): JSX.Element | null;
|
|
17
17
|
export default ThemeProvider;
|
|
18
18
|
//# sourceMappingURL=ThemeProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAGf,OAAO,EAAkC,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAU9E,OAAO,kBAAkB,CAAC;AAG1B,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IACjC,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,mBAAmB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACjD;AAID,eAAO,MAAM,YAAY,mDAAgD,CAAC;AAE1E,MAAM,WAAW,kBAAkB;IAMjC,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EAAE,UAAU,EAClB,oBAAqD,EACrD,QAAQ,GACT,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAmIzC;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createContext, useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import Log from '@deephaven/log';
|
|
3
|
+
import { assertNotNull } from '@deephaven/utils';
|
|
3
4
|
import { DEFAULT_PRELOAD_DATA_VARIABLES } from "./ThemeModel.js";
|
|
4
5
|
import { calculatePreloadStyleContent, getActiveThemes, getDefaultBaseThemes, setThemePreloadData, overrideSVGFillColors, getDefaultSelectedThemeKey } from "./ThemeUtils.js";
|
|
5
6
|
import { SpectrumThemeProvider } from "./SpectrumThemeProvider.js";
|
|
@@ -12,32 +13,62 @@ var log = Log.module('ThemeProvider');
|
|
|
12
13
|
export var ThemeContext = /*#__PURE__*/createContext(null);
|
|
13
14
|
export function ThemeProvider(_ref) {
|
|
14
15
|
var {
|
|
15
|
-
themes:
|
|
16
|
+
themes: propThemes,
|
|
16
17
|
defaultPreloadValues = DEFAULT_PRELOAD_DATA_VARIABLES,
|
|
17
18
|
children
|
|
18
19
|
} = _ref;
|
|
19
20
|
var baseThemes = useMemo(() => getDefaultBaseThemes(), []);
|
|
20
21
|
var {
|
|
21
|
-
|
|
22
|
+
isEnabled: isParentThemeEnabled,
|
|
23
|
+
isPending: isParentThemePending,
|
|
22
24
|
themeData: parentThemeData
|
|
23
25
|
} = useParentWindowTheme();
|
|
24
26
|
var [value, setValue] = useState(null);
|
|
25
27
|
var [selectedThemeKey, setSelectedThemeKey] = useState(getDefaultSelectedThemeKey);
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Custom themes can be provided via props or by a `postMessage` from the
|
|
31
|
+
* parent window. In either case, the themes may get loaded asynchronously.
|
|
32
|
+
* A `null` value indicates that the themes are still being loaded. e.g.
|
|
33
|
+
* plugins that provide themes after login may provide custom themes via props,
|
|
34
|
+
* while `postMessage` apis are by nature asynchronous.
|
|
35
|
+
* Note prop themes are ignored when parent themes are enabled.
|
|
36
|
+
*/
|
|
37
|
+
var customThemes = useMemo(() => {
|
|
38
|
+
// Custom theme provided by `postMessage` from the parent window.
|
|
39
|
+
if (isParentThemeEnabled && !isParentThemePending) {
|
|
40
|
+
return parentThemeData ? [parentThemeData] : [];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Custom themes provided by props.
|
|
44
|
+
if (!isParentThemeEnabled) {
|
|
45
|
+
return propThemes;
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}, [isParentThemeEnabled, isParentThemePending, parentThemeData, propThemes]);
|
|
49
|
+
|
|
50
|
+
// Calculate active themes once custom themes are loaded
|
|
28
51
|
var activeThemes = useMemo(() => {
|
|
29
|
-
if (
|
|
52
|
+
if (isParentThemeEnabled && isParentThemePending) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Give plugins a chance to provide custom themes.
|
|
57
|
+
if (!isParentThemeEnabled && customThemes == null) {
|
|
30
58
|
return null;
|
|
31
59
|
}
|
|
32
|
-
var custom
|
|
33
|
-
if (
|
|
34
|
-
custom
|
|
60
|
+
var custom;
|
|
61
|
+
if (isParentThemeEnabled) {
|
|
62
|
+
custom = parentThemeData ? [parentThemeData] : [];
|
|
63
|
+
} else {
|
|
64
|
+
assertNotNull(customThemes);
|
|
65
|
+
custom = customThemes;
|
|
35
66
|
}
|
|
36
67
|
return getActiveThemes(selectedThemeKey, {
|
|
37
68
|
base: baseThemes,
|
|
38
69
|
custom
|
|
39
70
|
});
|
|
40
|
-
}, [
|
|
71
|
+
}, [isParentThemeEnabled, isParentThemePending, customThemes, selectedThemeKey, baseThemes, parentThemeData]);
|
|
41
72
|
var themes = useMemo(() => [...baseThemes, ...(customThemes !== null && customThemes !== void 0 ? customThemes : [])], [baseThemes, customThemes]);
|
|
42
73
|
useEffect(function updateThemePreloadData() {
|
|
43
74
|
// Don't update preload data until themes have been loaded and activated
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.js","names":["createContext","useEffect","useMemo","useState","Log","DEFAULT_PRELOAD_DATA_VARIABLES","calculatePreloadStyleContent","getActiveThemes","getDefaultBaseThemes","setThemePreloadData","overrideSVGFillColors","getDefaultSelectedThemeKey","SpectrumThemeProvider","useParentWindowTheme","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","log","module","ThemeContext","ThemeProvider","_ref","themes","
|
|
1
|
+
{"version":3,"file":"ThemeProvider.js","names":["createContext","useEffect","useMemo","useState","Log","assertNotNull","DEFAULT_PRELOAD_DATA_VARIABLES","calculatePreloadStyleContent","getActiveThemes","getDefaultBaseThemes","setThemePreloadData","overrideSVGFillColors","getDefaultSelectedThemeKey","SpectrumThemeProvider","useParentWindowTheme","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","log","module","ThemeContext","ThemeProvider","_ref","themes","propThemes","defaultPreloadValues","children","baseThemes","isEnabled","isParentThemeEnabled","isPending","isParentThemePending","themeData","parentThemeData","value","setValue","selectedThemeKey","setSelectedThemeKey","customThemes","activeThemes","custom","base","updateThemePreloadData","preloadStyleContent","debug2","active","map","theme","themeKey","styleContent","Provider"],"sources":["../../src/theme/ThemeProvider.tsx"],"sourcesContent":["import {\n createContext,\n type ReactNode,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport Log from '@deephaven/log';\nimport { assertNotNull } from '@deephaven/utils';\nimport { DEFAULT_PRELOAD_DATA_VARIABLES, type ThemeData } from './ThemeModel';\nimport {\n calculatePreloadStyleContent,\n getActiveThemes,\n getDefaultBaseThemes,\n setThemePreloadData,\n overrideSVGFillColors,\n getDefaultSelectedThemeKey,\n} from './ThemeUtils';\nimport { SpectrumThemeProvider } from './SpectrumThemeProvider';\nimport './theme-svg.scss';\nimport useParentWindowTheme from './useParentWindowTheme';\n\nexport interface ThemeContextValue {\n activeThemes: ThemeData[] | null;\n selectedThemeKey: string;\n themes: ThemeData[];\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 /*\n * Additional themes to load in addition to the base themes. If no additional\n * themes are to be loaded, this must be set to an empty array in order to\n * tell the provider to activate the base themes.\n */\n themes: ThemeData[] | null;\n defaultPreloadValues?: Record<string, string>;\n children: ReactNode;\n}\n\nexport function ThemeProvider({\n themes: propThemes,\n defaultPreloadValues = DEFAULT_PRELOAD_DATA_VARIABLES,\n children,\n}: ThemeProviderProps): JSX.Element | null {\n const baseThemes = useMemo(() => getDefaultBaseThemes(), []);\n\n const {\n isEnabled: isParentThemeEnabled,\n isPending: isParentThemePending,\n themeData: parentThemeData,\n } = useParentWindowTheme();\n\n const [value, setValue] = useState<ThemeContextValue | null>(null);\n\n const [selectedThemeKey, setSelectedThemeKey] = useState<string>(\n getDefaultSelectedThemeKey\n );\n\n /**\n * Custom themes can be provided via props or by a `postMessage` from the\n * parent window. In either case, the themes may get loaded asynchronously.\n * A `null` value indicates that the themes are still being loaded. e.g.\n * plugins that provide themes after login may provide custom themes via props,\n * while `postMessage` apis are by nature asynchronous.\n * Note prop themes are ignored when parent themes are enabled.\n */\n const customThemes = useMemo(() => {\n // Custom theme provided by `postMessage` from the parent window.\n if (isParentThemeEnabled && !isParentThemePending) {\n return parentThemeData ? [parentThemeData] : [];\n }\n\n // Custom themes provided by props.\n if (!isParentThemeEnabled) {\n return propThemes;\n }\n\n return null;\n }, [isParentThemeEnabled, isParentThemePending, parentThemeData, propThemes]);\n\n // Calculate active themes once custom themes are loaded\n const activeThemes = useMemo(() => {\n if (isParentThemeEnabled && isParentThemePending) {\n return null;\n }\n\n // Give plugins a chance to provide custom themes.\n if (!isParentThemeEnabled && customThemes == null) {\n return null;\n }\n\n let custom: ThemeData[];\n\n if (isParentThemeEnabled) {\n custom = parentThemeData ? [parentThemeData] : [];\n } else {\n assertNotNull(customThemes);\n custom = customThemes;\n }\n\n return getActiveThemes(selectedThemeKey, {\n base: baseThemes,\n custom,\n });\n }, [\n isParentThemeEnabled,\n isParentThemePending,\n customThemes,\n selectedThemeKey,\n baseThemes,\n parentThemeData,\n ]);\n\n const themes = useMemo(\n () => [...baseThemes, ...(customThemes ?? [])],\n [baseThemes, customThemes]\n );\n\n useEffect(\n function updateThemePreloadData() {\n // Don't update preload data until themes have been loaded and activated\n if (activeThemes == null || customThemes == null) {\n return;\n }\n\n // Override fill color for certain inline SVGs (the originals are provided\n // by theme-svg.scss)\n overrideSVGFillColors(defaultPreloadValues);\n\n const preloadStyleContent =\n calculatePreloadStyleContent(defaultPreloadValues);\n\n log.debug2('updateThemePreloadData:', {\n active: activeThemes.map(theme => theme.themeKey),\n custom: customThemes.map(theme => theme.themeKey),\n preloadStyleContent,\n selectedThemeKey,\n });\n\n setThemePreloadData({\n themeKey: selectedThemeKey,\n preloadStyleContent,\n });\n },\n [activeThemes, selectedThemeKey, customThemes, defaultPreloadValues]\n );\n\n useEffect(() => {\n setValue({\n activeThemes,\n selectedThemeKey,\n themes,\n setSelectedThemeKey,\n });\n }, [activeThemes, selectedThemeKey, themes]);\n\n return (\n <>\n {activeThemes == null ? null : (\n <>\n {activeThemes.map(theme => (\n <style data-theme-key={theme.themeKey} key={theme.themeKey}>\n {theme.styleContent}\n </style>\n ))}\n </>\n )}\n {value == null ? null : (\n <ThemeContext.Provider value={value}>\n <SpectrumThemeProvider>{children}</SpectrumThemeProvider>\n </ThemeContext.Provider>\n )}\n </>\n );\n}\n\nexport default ThemeProvider;\n"],"mappings":"AAAA,SACEA,aAAa,EAEbC,SAAS,EACTC,OAAO,EACPC,QAAQ,QACH,OAAO;AACd,OAAOC,GAAG,MAAM,gBAAgB;AAChC,SAASC,aAAa,QAAQ,kBAAkB;AAAC,SACxCC,8BAA8B;AAAA,SAErCC,4BAA4B,EAC5BC,eAAe,EACfC,oBAAoB,EACpBC,mBAAmB,EACnBC,qBAAqB,EACrBC,0BAA0B;AAAA,SAEnBC,qBAAqB;AAAA;AAAA,OAEvBC,oBAAoB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAS3B,IAAMC,GAAG,GAAGjB,GAAG,CAACkB,MAAM,CAAC,eAAe,CAAC;AAEvC,OAAO,IAAMC,YAAY,gBAAGvB,aAAa,CAA2B,IAAI,CAAC;AAazE,OAAO,SAASwB,aAAaA,CAAAC,IAAA,EAIc;EAAA,IAJb;IAC5BC,MAAM,EAAEC,UAAU;IAClBC,oBAAoB,GAAGtB,8BAA8B;IACrDuB;EACkB,CAAC,GAAAJ,IAAA;EACnB,IAAMK,UAAU,GAAG5B,OAAO,CAAC,MAAMO,oBAAoB,CAAC,CAAC,EAAE,EAAE,CAAC;EAE5D,IAAM;IACJsB,SAAS,EAAEC,oBAAoB;IAC/BC,SAAS,EAAEC,oBAAoB;IAC/BC,SAAS,EAAEC;EACb,CAAC,GAAGtB,oBAAoB,CAAC,CAAC;EAE1B,IAAM,CAACuB,KAAK,EAAEC,QAAQ,CAAC,GAAGnC,QAAQ,CAA2B,IAAI,CAAC;EAElE,IAAM,CAACoC,gBAA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EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACpC,IAAI,CAkBN"}
|
package/dist/theme/ThemeUtils.js
CHANGED
|
@@ -422,6 +422,12 @@ export function getThemeKey(pluginName, themeName) {
|
|
|
422
422
|
export function preloadTheme() {
|
|
423
423
|
var _getThemePreloadData2;
|
|
424
424
|
var defaultPreloadValues = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_PRELOAD_DATA_VARIABLES;
|
|
425
|
+
// In certain cases we may want to preload a transparent theme to allow the
|
|
426
|
+
// parent container to show through. For example, when a parent Window is
|
|
427
|
+
// providing a theme via `postMessage` apis, we may not have enough information
|
|
428
|
+
// to properly preload the theme, so we can just preload a transparent
|
|
429
|
+
// theme and let the parent container show through until `postMessage`
|
|
430
|
+
// communication is complete.
|
|
425
431
|
if (isPreloadTransparentTheme()) {
|
|
426
432
|
createPreloadStyleElement('theme-preload-transparent', calculatePreloadStyleContent(TRANSPARENT_PRELOAD_DATA_VARIABLES));
|
|
427
433
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeUtils.js","names":["Log","assertNotNull","ColorUtils","requestParentResponse","themeDark","themeLight","DEFAULT_DARK_THEME_KEY","DEFAULT_LIGHT_THEME_KEY","DEFAULT_PRELOAD_DATA_VARIABLES","THEME_CACHE_LOCAL_STORAGE_KEY","SVG_ICON_MANUAL_COLOR_MAP","THEME_KEY_OVERRIDE_QUERY_PARAM","PARENT_THEME_KEY","PARENT_THEME_REQUEST","TRANSPARENT_PRELOAD_DATA_VARIABLES","PRELOAD_TRANSPARENT_THEME_QUERY_PARAM","log","module","CSS_VAR_EXPRESSION_PREFIX","DH_VAR_PREFIX","TMP_CSS_PROP_PREFIX","NON_WHITESPACE_REGEX","WHITESPACE_REGEX","DH_CSS_VAR_NAME_REGEXP","calculatePreloadStyleContent","defaultPreloadValues","resolveVar","createCssVariableResolver","document","body","pairs","Object","keys","map","key","concat","join","el","defaultValues","computedStyle","getComputedStyle","cssVariableResolver","varName","_defaultValues","value","getPropertyValue","createPreloadStyleElement","id","preloadStyleContent","style","createElement","innerHTML","head","appendChild","extractDistinctCssVariableExpressions","record","set","Set","values","forEach","getExpressionRanges","_ref","start","end","expression","substring","includes","add","getActiveThemes","themeKey","themeRegistration","_custom$baseThemeKey","custom","find","theme","baseThemeKey","base","error","debug","getDefaultBaseThemes","name","styleContent","getDefaultSelectedThemeKey","_ref2","_getThemeKeyOverride","_getThemePreloadData","getThemeKeyOverride","getThemePreloadData","searchParams","URLSearchParams","window","location","search","get","data","localStorage","getItem","JSON","parse","_unused","_NON_WHITESPACE_REGEX","_NON_WHITESPACE_REGEX2","ranges","exec","index","parenLevel","i","length","test","push","requestParentThemeData","_requestParentThemeData","apply","arguments","_asyncToGenerator","result","isParentThemeData","Error","stringify","isValidColorVar","CSS","supports","parseParentThemeData","_ref3","cssVars","toExpression","_ref4","varValue","sanitized","entries","filter","str","isParentThemeEnabled","isPreloadTransparentTheme","isBaseThemeKey","maybeParentThemeData","replaceSVGFillColor","svgContent","fillColor","replace","encodeURIComponent","resolveCssVariablesInRecord","targetElement","undefined","isAlphaOptional","perfStart","performance","now","tmpPropEl","display","recordArray","_ref5","setProperty","backgroundColor","tempPropElComputedStyle","_ref6","resolved","containsCssVar","isColor","children","color","normalizeCssColor","remove","resolveCssVariablesInString","resolver","_ref7","setThemePreloadData","preloadData","setItem","getThemeKey","pluginName","themeName","preloadTheme","_getThemePreloadData2","previousPreloadStyleContent","defaultPreloadStyleContent","overrideSVGFillColors","_ref8","removeProperty","newSVGContent"],"sources":["../../src/theme/ThemeUtils.ts"],"sourcesContent":["import Log from '@deephaven/log';\nimport {\n assertNotNull,\n ColorUtils,\n requestParentResponse,\n} from '@deephaven/utils';\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 type BaseThemeKey,\n type ThemeData,\n type ThemePreloadData,\n type CssVariableStyleContent,\n type ThemePreloadColorVariable,\n type ThemeRegistrationData,\n THEME_CACHE_LOCAL_STORAGE_KEY,\n SVG_ICON_MANUAL_COLOR_MAP,\n type ThemeCssVariableName,\n type ThemeIconsRequiringManualColorChanges,\n THEME_KEY_OVERRIDE_QUERY_PARAM,\n PARENT_THEME_KEY,\n type ParentThemeData,\n PARENT_THEME_REQUEST,\n type ThemeCssColorVariableName,\n TRANSPARENT_PRELOAD_DATA_VARIABLES,\n PRELOAD_TRANSPARENT_THEME_QUERY_PARAM,\n} from './ThemeModel';\n\nconst log = Log.module('ThemeUtils');\n\nexport const CSS_VAR_EXPRESSION_PREFIX = 'var(--';\nexport const DH_VAR_PREFIX = '--dh-color-';\nexport const TMP_CSS_PROP_PREFIX = 'dh-tmp';\nexport const NON_WHITESPACE_REGEX = /\\S/;\nexport const WHITESPACE_REGEX = /\\s/;\n\nexport const DH_CSS_VAR_NAME_REGEXP = /^--dh-color-[a-z0-9_-]+$/;\n\nexport type VarExpressionResolver = (varExpression: string) => string;\n\n/**\n * Resolves the current values of CSS variables we want to preload. Preloading\n * happens before themes are fully loaded so that we can style things like the\n * loading spinner and background color which are shown to the user early on in\n * the app lifecycle.\n * @defaultPreloadValues Default values to use if a preload variable is not set.\n */\nexport function calculatePreloadStyleContent(\n defaultPreloadValues: Record<string, string>\n): CssVariableStyleContent {\n const resolveVar = createCssVariableResolver(\n document.body,\n defaultPreloadValues\n );\n\n // Calculate the current preload variables. If the variable is not set, use\n // the default value.\n const pairs = Object.keys(defaultPreloadValues).map(\n key => `${key}:${resolveVar(key as ThemePreloadColorVariable)}`\n );\n\n return `:root{${pairs.join(';')}}`;\n}\n\n/**\n * Create a resolver function for calculating the value of a css variable based\n * on a given element's computed style. If the variable resolves to '', we check\n * `defaultValues` for a default value, and if one does not exist,\n * return ''.\n * @param el Element to resolve css variables against\n * @param defaultValues Default values to use if a variable is not set.\n */\nexport function createCssVariableResolver(\n el: Element,\n defaultValues: Record<string, string>\n): (varName: ThemeCssVariableName) => string {\n const computedStyle = getComputedStyle(el);\n\n /**\n * Resolve the given css variable name to a value. If the variable is not set,\n * return the default preload value or '' if one does not exist.\n */\n return function cssVariableResolver(varName: ThemeCssVariableName): string {\n const value = computedStyle.getPropertyValue(varName);\n\n if (value !== '') {\n return value;\n }\n\n return defaultValues[varName as ThemePreloadColorVariable] ?? '';\n };\n}\n\n/**\n * Create a style tag containing preload css variables and add to the head.\n * @param id The id of the style tag\n * @param preloadStyleContent The css variable content to add to the style tag\n */\nexport function createPreloadStyleElement(\n id: `theme-preload-${string}`,\n preloadStyleContent: CssVariableStyleContent\n): void {\n const style = document.createElement('style');\n style.id = id;\n style.innerHTML = preloadStyleContent;\n document.head.appendChild(style);\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 getExpressionRanges(value).forEach(([start, end]) => {\n const expression = value.substring(start, end + 1);\n\n if (expression.includes(CSS_VAR_EXPRESSION_PREFIX)) {\n set.add(expression);\n }\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 // The ThemePicker shows whenever more than 1 theme is available. Disable\n // light theme for now to keep the picker hidden until it is fully\n // implemented by #1539.\n {\n name: 'Default Light',\n themeKey: DEFAULT_LIGHT_THEME_KEY,\n styleContent: themeLight,\n },\n ];\n}\n\n/**\n * Get the default selected theme key. Precedence is:\n * 1. Theme key override query parameter\n * 2. Theme key from preload data\n * 3. Default dark theme key\n * @returns The default selected theme key\n */\nexport function getDefaultSelectedThemeKey(): string {\n return (\n getThemeKeyOverride() ??\n getThemePreloadData()?.themeKey ??\n DEFAULT_DARK_THEME_KEY\n );\n}\n\n/**\n * A theme key override can be set via a query parameter to force a specific\n * theme selection. Useful for embedded widget scenarios that don't expose the\n * theme selector.\n */\nexport function getThemeKeyOverride(): string | null {\n const searchParams = new URLSearchParams(window.location.search);\n return searchParams.get(THEME_KEY_OVERRIDE_QUERY_PARAM);\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 top-level expressions in the given\n * string.\n *\n * e.g.\n * getExpressionRanges('var(--aaa-aa) #fff var(--bbb-bb)')\n * yields:\n * [\n * [0, 12], // 'var(--aaa-aa)'\n * [14, 17] // '#fff'\n * [19, 31], // 'var(--bbb-bb)'\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 * getExpressionRanges('var(--ccc-cc, var(--aaa-aa, green)) var(--bbb-bb)')\n * yields:\n * [\n * [0, 34], // 'var(--ccc-cc, var(--aaa-aa, green))'\n * [36, 48], // 'var(--bbb-bb)'\n * ]\n * @param value The string to search for expressions\n * @returns An array of [start, end] index pairs for each expression\n */\nexport function getExpressionRanges(value: string): [number, number][] {\n const ranges: [number, number][] = [];\n\n let start = NON_WHITESPACE_REGEX.exec(value)?.index ?? 0;\n let parenLevel = 0;\n\n for (let i = 0; i < value.length; i += 1) {\n if (value[i] === '(') {\n parenLevel += 1;\n } else if (value[i] === ')') {\n parenLevel -= 1;\n }\n\n if (\n i === value.length - 1 ||\n (WHITESPACE_REGEX.test(value[i + 1]) && parenLevel === 0)\n ) {\n ranges.push([start, i]);\n\n while (i < value.length - 1 && WHITESPACE_REGEX.test(value[i + 1])) {\n i += 1;\n }\n\n start = i + 1;\n }\n }\n\n if (parenLevel !== 0) {\n log.error('Unbalanced parentheses in css var expression', value);\n return [];\n }\n\n return ranges;\n}\n\n/**\n * Request parent theme data from the parent window.\n * @returns A promise that resolves to the parent theme data\n * @throws Error if the response is not a valid `ParentThemeData`\n */\nexport async function requestParentThemeData(): Promise<ParentThemeData> {\n const result = await requestParentResponse(PARENT_THEME_REQUEST);\n\n if (!isParentThemeData(result)) {\n throw new Error(\n `Unexpected parent theme data response: ${JSON.stringify(result)}`\n );\n }\n\n return result;\n}\n\nexport function isValidColorVar(\n name: string,\n value: string\n): name is ThemeCssColorVariableName {\n return DH_CSS_VAR_NAME_REGEXP.test(name) && CSS.supports('color', value);\n}\n\nexport function parseParentThemeData({\n baseThemeKey = DEFAULT_DARK_THEME_KEY,\n name,\n cssVars,\n}: ParentThemeData): ThemeData {\n const toExpression = ([varName, varValue]: [string, string]) =>\n isValidColorVar(varName, varValue) ? `${varName}:${varValue}` : null;\n\n const sanitized = Object.entries(cssVars)\n .map(toExpression)\n .filter((str): str is string => str != null);\n\n const styleContent = `:root{${\n sanitized.length === 0 ? '' : sanitized.join(';')\n };}`;\n\n return {\n baseThemeKey,\n themeKey: PARENT_THEME_KEY,\n name,\n styleContent,\n };\n}\n\n/**\n * Check if the current URL specifies a parent theme key override.\n * @returns True if the parent theme key override is set, false otherwise\n */\nexport function isParentThemeEnabled(): boolean {\n const searchParams = new URLSearchParams(window.location.search);\n return searchParams.get(THEME_KEY_OVERRIDE_QUERY_PARAM) === PARENT_THEME_KEY;\n}\n\n/**\n * Check if PRELOAD_TRANSPARENT_THEME_QUERY_PARAM query parameter is set to true.\n * @returns True if the preload transparent theme query parameter is set, false\n * otherwise\n */\nexport function isPreloadTransparentTheme(): boolean {\n const searchParams = new URLSearchParams(window.location.search);\n return searchParams.get(PRELOAD_TRANSPARENT_THEME_QUERY_PARAM) === 'true';\n}\n\n/**\n * Check if the given theme key is one of the base themes.\n * @param themeKey The theme key to check\n * @returns True if the theme key is a base theme key, false otherwise\n */\nexport function isBaseThemeKey(themeKey: string): themeKey is BaseThemeKey {\n return [DEFAULT_DARK_THEME_KEY, DEFAULT_LIGHT_THEME_KEY].includes(themeKey);\n}\n\n/**\n * Determine if a given object is a `ParentThemeData` object.\n * @param maybeParentThemeData An object that may or may not be a `ParentThemeData`\n * @returns True if the object is a `ParentThemeData`, false otherwise\n */\nexport function isParentThemeData(\n maybeParentThemeData: unknown\n): maybeParentThemeData is ParentThemeData {\n if (\n typeof maybeParentThemeData !== 'object' ||\n maybeParentThemeData == null\n ) {\n return false;\n }\n\n return (\n 'name' in maybeParentThemeData &&\n typeof maybeParentThemeData.name === 'string' &&\n 'cssVars' in maybeParentThemeData &&\n maybeParentThemeData.cssVars != null\n );\n}\n\n/**\n * Replace the `fill='...'` attribute in the given SVG content with the given\n * color string.\n * @param svgContent Inline SVG content to replace the fill color in\n * @param fillColor The color to replace the fill color with\n */\nexport function replaceSVGFillColor(\n svgContent: string,\n fillColor: string\n): string {\n return svgContent.replace(\n /fill='.*?'/,\n `fill='${encodeURIComponent(fillColor)}'`\n );\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 8 digit\n * hex values (or optionally 6 digit hex if `isAlphaOptional` is true).\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 * @param isAlphaOptional If true, the alpha value will be dropped from resolved\n * 8 character hex colors if it is 'ff'. Defaults to false.\n */\nexport function resolveCssVariablesInRecord<T extends Record<string, string>>(\n record: T,\n targetElement: HTMLElement = document.body,\n isAlphaOptional = false\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 tmpPropEl.style.display = 'none';\n\n const recordArray = Object.entries(record);\n recordArray.forEach(([, value], i) => {\n tmpPropEl.style.setProperty(`--${TMP_CSS_PROP_PREFIX}-${i}`, value);\n // faster to create these now all at once, even if we don't use them all\n // since the parent isn't added yet to the DOM\n const el = document.createElement('div');\n // use background color instead of color to avoid inherited values\n el.style.backgroundColor = value;\n tmpPropEl.appendChild(el);\n });\n\n // append only once to avoid multiple re-layouts\n // must be part of DOM to get computed color\n targetElement.appendChild(tmpPropEl);\n const tempPropElComputedStyle = window.getComputedStyle(tmpPropEl);\n\n const result = {} as T;\n recordArray.forEach(([key, value], i) => {\n // resolves any variables in the expression\n let resolved = tempPropElComputedStyle.getPropertyValue(\n `--${TMP_CSS_PROP_PREFIX}-${i}`\n );\n\n const containsCssVar = value.includes(CSS_VAR_EXPRESSION_PREFIX);\n const isColor = CSS.supports('color', resolved);\n\n if (\n // only try to normalize non-hex strings that are valid colors\n // otherwise non-colors will be made #00000000\n isColor &&\n !/^#[0-9A-F]{6}[0-9a-f]{0,2}$/i.test(resolved)\n ) {\n // getting the computed background color is necessary\n // because resolved can still contain a color-mix() function\n const el = tmpPropEl.children[i] as HTMLDivElement;\n const computedStyle = window.getComputedStyle(el);\n const color = computedStyle.getPropertyValue('background-color');\n // convert color to hex, which is what monaco and plotly require\n resolved = ColorUtils.normalizeCssColor(color, isAlphaOptional);\n }\n (result as Record<string, string>)[key] =\n containsCssVar || isColor ? resolved : value;\n });\n\n // Remove the temporary div\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 getExpressionRanges(value).forEach(([start, end]) => {\n if (i < start) {\n result.push(value.substring(i, start));\n i += start - i;\n }\n\n const expression = value.substring(start, end + 1);\n\n result.push(\n expression.includes(CSS_VAR_EXPRESSION_PREFIX)\n ? resolver(expression)\n : expression\n );\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 * @defaultPreloadValues Optional default values to use if a preload variable is not set.\n */\nexport function preloadTheme(\n defaultPreloadValues: Record<string, string> = DEFAULT_PRELOAD_DATA_VARIABLES\n): void {\n if (isPreloadTransparentTheme()) {\n createPreloadStyleElement(\n 'theme-preload-transparent',\n calculatePreloadStyleContent(TRANSPARENT_PRELOAD_DATA_VARIABLES)\n );\n return;\n }\n\n const previousPreloadStyleContent =\n getThemePreloadData()?.preloadStyleContent;\n\n const defaultPreloadStyleContent =\n calculatePreloadStyleContent(defaultPreloadValues);\n\n log.debug('Preloading theme content:', {\n defaultPreloadStyleContent,\n previousPreloadStyleContent,\n });\n\n createPreloadStyleElement(\n 'theme-preload-defaults',\n defaultPreloadStyleContent\n );\n\n // Any preload variables that were saved by last theme load should override\n // the defaults\n if (previousPreloadStyleContent != null) {\n createPreloadStyleElement(\n 'theme-preload-previous',\n previousPreloadStyleContent\n );\n }\n}\n\n/**\n * Inline SVGs cannot depend on dynamic CSS variables, so we have to statically\n * update them if we want to change their color.\n *\n * This function:\n * 1. Clears any previous overrides\n * 2. Resolves CSS variables containing inline SVG urls\n * 3. Resolves mapped color variables and replaces the `fill='...'` attribute with the result\n * 4. Sets the original CSS variable to the new replaced value\n *\n * Note that it is preferable to use inline SVGs as background-mask values and\n * just change the background color instead of relying on this util, but this\n * is not always possible. e.g. <select> elements don't support pseudo elements,\n * so there's not a good way to set icons via masks.\n * @param defaultValues Default values to use if a variable is not set.\n */\nexport function overrideSVGFillColors(\n defaultValues: Record<string, string>\n): void {\n const resolveVar = createCssVariableResolver(document.body, defaultValues);\n\n Object.entries(SVG_ICON_MANUAL_COLOR_MAP).forEach(([key, value]) => {\n // Clear any previous override so that our variables get resolved against the\n // actual svg content provided by the active themes and not from a previous\n // override\n document.body.style.removeProperty(key);\n\n const svgContent = resolveVar(key as ThemeIconsRequiringManualColorChanges);\n const fillColor = resolveVar(value as ThemePreloadColorVariable);\n\n const newSVGContent = replaceSVGFillColor(svgContent, fillColor);\n\n // This will take precedence over any values for the variable provided by\n // the active themes\n document.body.style.setProperty(key, newSVGContent);\n });\n}\n"],"mappings":";;AAAA,OAAOA,GAAG,MAAM,gBAAgB;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C,SAAS,CAAC;;IAEhE;IACA;IACA9G,QAAQ,CAACC,IAAI,CAACoB,KAAK,CAACuG,WAAW,CAACtH,GAAG,EAAEiJ,aAAa,CAAC;EACrD,CAAC,CAAC;AACJ"}
|
|
1
|
+
{"version":3,"file":"ThemeUtils.js","names":["Log","assertNotNull","ColorUtils","requestParentResponse","themeDark","themeLight","DEFAULT_DARK_THEME_KEY","DEFAULT_LIGHT_THEME_KEY","DEFAULT_PRELOAD_DATA_VARIABLES","THEME_CACHE_LOCAL_STORAGE_KEY","SVG_ICON_MANUAL_COLOR_MAP","THEME_KEY_OVERRIDE_QUERY_PARAM","PARENT_THEME_KEY","PARENT_THEME_REQUEST","TRANSPARENT_PRELOAD_DATA_VARIABLES","PRELOAD_TRANSPARENT_THEME_QUERY_PARAM","log","module","CSS_VAR_EXPRESSION_PREFIX","DH_VAR_PREFIX","TMP_CSS_PROP_PREFIX","NON_WHITESPACE_REGEX","WHITESPACE_REGEX","DH_CSS_VAR_NAME_REGEXP","calculatePreloadStyleContent","defaultPreloadValues","resolveVar","createCssVariableResolver","document","body","pairs","Object","keys","map","key","concat","join","el","defaultValues","computedStyle","getComputedStyle","cssVariableResolver","varName","_defaultValues","value","getPropertyValue","createPreloadStyleElement","id","preloadStyleContent","style","createElement","innerHTML","head","appendChild","extractDistinctCssVariableExpressions","record","set","Set","values","forEach","getExpressionRanges","_ref","start","end","expression","substring","includes","add","getActiveThemes","themeKey","themeRegistration","_custom$baseThemeKey","custom","find","theme","baseThemeKey","base","error","debug","getDefaultBaseThemes","name","styleContent","getDefaultSelectedThemeKey","_ref2","_getThemeKeyOverride","_getThemePreloadData","getThemeKeyOverride","getThemePreloadData","searchParams","URLSearchParams","window","location","search","get","data","localStorage","getItem","JSON","parse","_unused","_NON_WHITESPACE_REGEX","_NON_WHITESPACE_REGEX2","ranges","exec","index","parenLevel","i","length","test","push","requestParentThemeData","_requestParentThemeData","apply","arguments","_asyncToGenerator","result","isParentThemeData","Error","stringify","isValidColorVar","CSS","supports","parseParentThemeData","_ref3","cssVars","toExpression","_ref4","varValue","sanitized","entries","filter","str","isParentThemeEnabled","isPreloadTransparentTheme","isBaseThemeKey","maybeParentThemeData","replaceSVGFillColor","svgContent","fillColor","replace","encodeURIComponent","resolveCssVariablesInRecord","targetElement","undefined","isAlphaOptional","perfStart","performance","now","tmpPropEl","display","recordArray","_ref5","setProperty","backgroundColor","tempPropElComputedStyle","_ref6","resolved","containsCssVar","isColor","children","color","normalizeCssColor","remove","resolveCssVariablesInString","resolver","_ref7","setThemePreloadData","preloadData","setItem","getThemeKey","pluginName","themeName","preloadTheme","_getThemePreloadData2","previousPreloadStyleContent","defaultPreloadStyleContent","overrideSVGFillColors","_ref8","removeProperty","newSVGContent"],"sources":["../../src/theme/ThemeUtils.ts"],"sourcesContent":["import Log from '@deephaven/log';\nimport {\n assertNotNull,\n ColorUtils,\n requestParentResponse,\n} from '@deephaven/utils';\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 type BaseThemeKey,\n type ThemeData,\n type ThemePreloadData,\n type CssVariableStyleContent,\n type ThemePreloadColorVariable,\n type ThemeRegistrationData,\n THEME_CACHE_LOCAL_STORAGE_KEY,\n SVG_ICON_MANUAL_COLOR_MAP,\n type ThemeCssVariableName,\n type ThemeIconsRequiringManualColorChanges,\n THEME_KEY_OVERRIDE_QUERY_PARAM,\n PARENT_THEME_KEY,\n type ParentThemeData,\n PARENT_THEME_REQUEST,\n type ThemeCssColorVariableName,\n TRANSPARENT_PRELOAD_DATA_VARIABLES,\n PRELOAD_TRANSPARENT_THEME_QUERY_PARAM,\n} from './ThemeModel';\n\nconst log = Log.module('ThemeUtils');\n\nexport const CSS_VAR_EXPRESSION_PREFIX = 'var(--';\nexport const DH_VAR_PREFIX = '--dh-color-';\nexport const TMP_CSS_PROP_PREFIX = 'dh-tmp';\nexport const NON_WHITESPACE_REGEX = /\\S/;\nexport const WHITESPACE_REGEX = /\\s/;\n\nexport const DH_CSS_VAR_NAME_REGEXP = /^--dh-color-[a-z0-9_-]+$/;\n\nexport type VarExpressionResolver = (varExpression: string) => string;\n\n/**\n * Resolves the current values of CSS variables we want to preload. Preloading\n * happens before themes are fully loaded so that we can style things like the\n * loading spinner and background color which are shown to the user early on in\n * the app lifecycle.\n * @defaultPreloadValues Default values to use if a preload variable is not set.\n */\nexport function calculatePreloadStyleContent(\n defaultPreloadValues: Record<string, string>\n): CssVariableStyleContent {\n const resolveVar = createCssVariableResolver(\n document.body,\n defaultPreloadValues\n );\n\n // Calculate the current preload variables. If the variable is not set, use\n // the default value.\n const pairs = Object.keys(defaultPreloadValues).map(\n key => `${key}:${resolveVar(key as ThemePreloadColorVariable)}`\n );\n\n return `:root{${pairs.join(';')}}`;\n}\n\n/**\n * Create a resolver function for calculating the value of a css variable based\n * on a given element's computed style. If the variable resolves to '', we check\n * `defaultValues` for a default value, and if one does not exist,\n * return ''.\n * @param el Element to resolve css variables against\n * @param defaultValues Default values to use if a variable is not set.\n */\nexport function createCssVariableResolver(\n el: Element,\n defaultValues: Record<string, string>\n): (varName: ThemeCssVariableName) => string {\n const computedStyle = getComputedStyle(el);\n\n /**\n * Resolve the given css variable name to a value. If the variable is not set,\n * return the default preload value or '' if one does not exist.\n */\n return function cssVariableResolver(varName: ThemeCssVariableName): string {\n const value = computedStyle.getPropertyValue(varName);\n\n if (value !== '') {\n return value;\n }\n\n return defaultValues[varName as ThemePreloadColorVariable] ?? '';\n };\n}\n\n/**\n * Create a style tag containing preload css variables and add to the head.\n * @param id The id of the style tag\n * @param preloadStyleContent The css variable content to add to the style tag\n */\nexport function createPreloadStyleElement(\n id: `theme-preload-${string}`,\n preloadStyleContent: CssVariableStyleContent\n): void {\n const style = document.createElement('style');\n style.id = id;\n style.innerHTML = preloadStyleContent;\n document.head.appendChild(style);\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 getExpressionRanges(value).forEach(([start, end]) => {\n const expression = value.substring(start, end + 1);\n\n if (expression.includes(CSS_VAR_EXPRESSION_PREFIX)) {\n set.add(expression);\n }\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 // The ThemePicker shows whenever more than 1 theme is available. Disable\n // light theme for now to keep the picker hidden until it is fully\n // implemented by #1539.\n {\n name: 'Default Light',\n themeKey: DEFAULT_LIGHT_THEME_KEY,\n styleContent: themeLight,\n },\n ];\n}\n\n/**\n * Get the default selected theme key. Precedence is:\n * 1. Theme key override query parameter\n * 2. Theme key from preload data\n * 3. Default dark theme key\n * @returns The default selected theme key\n */\nexport function getDefaultSelectedThemeKey(): string {\n return (\n getThemeKeyOverride() ??\n getThemePreloadData()?.themeKey ??\n DEFAULT_DARK_THEME_KEY\n );\n}\n\n/**\n * A theme key override can be set via a query parameter to force a specific\n * theme selection. Useful for embedded widget scenarios that don't expose the\n * theme selector.\n */\nexport function getThemeKeyOverride(): string | null {\n const searchParams = new URLSearchParams(window.location.search);\n return searchParams.get(THEME_KEY_OVERRIDE_QUERY_PARAM);\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 top-level expressions in the given\n * string.\n *\n * e.g.\n * getExpressionRanges('var(--aaa-aa) #fff var(--bbb-bb)')\n * yields:\n * [\n * [0, 12], // 'var(--aaa-aa)'\n * [14, 17] // '#fff'\n * [19, 31], // 'var(--bbb-bb)'\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 * getExpressionRanges('var(--ccc-cc, var(--aaa-aa, green)) var(--bbb-bb)')\n * yields:\n * [\n * [0, 34], // 'var(--ccc-cc, var(--aaa-aa, green))'\n * [36, 48], // 'var(--bbb-bb)'\n * ]\n * @param value The string to search for expressions\n * @returns An array of [start, end] index pairs for each expression\n */\nexport function getExpressionRanges(value: string): [number, number][] {\n const ranges: [number, number][] = [];\n\n let start = NON_WHITESPACE_REGEX.exec(value)?.index ?? 0;\n let parenLevel = 0;\n\n for (let i = 0; i < value.length; i += 1) {\n if (value[i] === '(') {\n parenLevel += 1;\n } else if (value[i] === ')') {\n parenLevel -= 1;\n }\n\n if (\n i === value.length - 1 ||\n (WHITESPACE_REGEX.test(value[i + 1]) && parenLevel === 0)\n ) {\n ranges.push([start, i]);\n\n while (i < value.length - 1 && WHITESPACE_REGEX.test(value[i + 1])) {\n i += 1;\n }\n\n start = i + 1;\n }\n }\n\n if (parenLevel !== 0) {\n log.error('Unbalanced parentheses in css var expression', value);\n return [];\n }\n\n return ranges;\n}\n\n/**\n * Request parent theme data from the parent window.\n * @returns A promise that resolves to the parent theme data\n * @throws Error if the response is not a valid `ParentThemeData`\n */\nexport async function requestParentThemeData(): Promise<ParentThemeData> {\n const result = await requestParentResponse(PARENT_THEME_REQUEST);\n\n if (!isParentThemeData(result)) {\n throw new Error(\n `Unexpected parent theme data response: ${JSON.stringify(result)}`\n );\n }\n\n return result;\n}\n\nexport function isValidColorVar(\n name: string,\n value: string\n): name is ThemeCssColorVariableName {\n return DH_CSS_VAR_NAME_REGEXP.test(name) && CSS.supports('color', value);\n}\n\nexport function parseParentThemeData({\n baseThemeKey = DEFAULT_DARK_THEME_KEY,\n name,\n cssVars,\n}: ParentThemeData): ThemeData {\n const toExpression = ([varName, varValue]: [string, string]) =>\n isValidColorVar(varName, varValue) ? `${varName}:${varValue}` : null;\n\n const sanitized = Object.entries(cssVars)\n .map(toExpression)\n .filter((str): str is string => str != null);\n\n const styleContent = `:root{${\n sanitized.length === 0 ? '' : sanitized.join(';')\n };}`;\n\n return {\n baseThemeKey,\n themeKey: PARENT_THEME_KEY,\n name,\n styleContent,\n };\n}\n\n/**\n * Check if the current URL specifies a parent theme key override.\n * @returns True if the parent theme key override is set, false otherwise\n */\nexport function isParentThemeEnabled(): boolean {\n const searchParams = new URLSearchParams(window.location.search);\n return searchParams.get(THEME_KEY_OVERRIDE_QUERY_PARAM) === PARENT_THEME_KEY;\n}\n\n/**\n * Check if PRELOAD_TRANSPARENT_THEME_QUERY_PARAM query parameter is set to true.\n * @returns True if the preload transparent theme query parameter is set, false\n * otherwise\n */\nexport function isPreloadTransparentTheme(): boolean {\n const searchParams = new URLSearchParams(window.location.search);\n return searchParams.get(PRELOAD_TRANSPARENT_THEME_QUERY_PARAM) === 'true';\n}\n\n/**\n * Check if the given theme key is one of the base themes.\n * @param themeKey The theme key to check\n * @returns True if the theme key is a base theme key, false otherwise\n */\nexport function isBaseThemeKey(themeKey: string): themeKey is BaseThemeKey {\n return [DEFAULT_DARK_THEME_KEY, DEFAULT_LIGHT_THEME_KEY].includes(themeKey);\n}\n\n/**\n * Determine if a given object is a `ParentThemeData` object.\n * @param maybeParentThemeData An object that may or may not be a `ParentThemeData`\n * @returns True if the object is a `ParentThemeData`, false otherwise\n */\nexport function isParentThemeData(\n maybeParentThemeData: unknown\n): maybeParentThemeData is ParentThemeData {\n if (\n typeof maybeParentThemeData !== 'object' ||\n maybeParentThemeData == null\n ) {\n return false;\n }\n\n return (\n 'name' in maybeParentThemeData &&\n typeof maybeParentThemeData.name === 'string' &&\n 'cssVars' in maybeParentThemeData &&\n maybeParentThemeData.cssVars != null\n );\n}\n\n/**\n * Replace the `fill='...'` attribute in the given SVG content with the given\n * color string.\n * @param svgContent Inline SVG content to replace the fill color in\n * @param fillColor The color to replace the fill color with\n */\nexport function replaceSVGFillColor(\n svgContent: string,\n fillColor: string\n): string {\n return svgContent.replace(\n /fill='.*?'/,\n `fill='${encodeURIComponent(fillColor)}'`\n );\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 8 digit\n * hex values (or optionally 6 digit hex if `isAlphaOptional` is true).\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 * @param isAlphaOptional If true, the alpha value will be dropped from resolved\n * 8 character hex colors if it is 'ff'. Defaults to false.\n */\nexport function resolveCssVariablesInRecord<T extends Record<string, string>>(\n record: T,\n targetElement: HTMLElement = document.body,\n isAlphaOptional = false\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 tmpPropEl.style.display = 'none';\n\n const recordArray = Object.entries(record);\n recordArray.forEach(([, value], i) => {\n tmpPropEl.style.setProperty(`--${TMP_CSS_PROP_PREFIX}-${i}`, value);\n // faster to create these now all at once, even if we don't use them all\n // since the parent isn't added yet to the DOM\n const el = document.createElement('div');\n // use background color instead of color to avoid inherited values\n el.style.backgroundColor = value;\n tmpPropEl.appendChild(el);\n });\n\n // append only once to avoid multiple re-layouts\n // must be part of DOM to get computed color\n targetElement.appendChild(tmpPropEl);\n const tempPropElComputedStyle = window.getComputedStyle(tmpPropEl);\n\n const result = {} as T;\n recordArray.forEach(([key, value], i) => {\n // resolves any variables in the expression\n let resolved = tempPropElComputedStyle.getPropertyValue(\n `--${TMP_CSS_PROP_PREFIX}-${i}`\n );\n\n const containsCssVar = value.includes(CSS_VAR_EXPRESSION_PREFIX);\n const isColor = CSS.supports('color', resolved);\n\n if (\n // only try to normalize non-hex strings that are valid colors\n // otherwise non-colors will be made #00000000\n isColor &&\n !/^#[0-9A-F]{6}[0-9a-f]{0,2}$/i.test(resolved)\n ) {\n // getting the computed background color is necessary\n // because resolved can still contain a color-mix() function\n const el = tmpPropEl.children[i] as HTMLDivElement;\n const computedStyle = window.getComputedStyle(el);\n const color = computedStyle.getPropertyValue('background-color');\n // convert color to hex, which is what monaco and plotly require\n resolved = ColorUtils.normalizeCssColor(color, isAlphaOptional);\n }\n (result as Record<string, string>)[key] =\n containsCssVar || isColor ? resolved : value;\n });\n\n // Remove the temporary div\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 getExpressionRanges(value).forEach(([start, end]) => {\n if (i < start) {\n result.push(value.substring(i, start));\n i += start - i;\n }\n\n const expression = value.substring(start, end + 1);\n\n result.push(\n expression.includes(CSS_VAR_EXPRESSION_PREFIX)\n ? resolver(expression)\n : expression\n );\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 * @defaultPreloadValues Optional default values to use if a preload variable is not set.\n */\nexport function preloadTheme(\n defaultPreloadValues: Record<string, string> = DEFAULT_PRELOAD_DATA_VARIABLES\n): void {\n // In certain cases we may want to preload a transparent theme to allow the\n // parent container to show through. For example, when a parent Window is\n // providing a theme via `postMessage` apis, we may not have enough information\n // to properly preload the theme, so we can just preload a transparent\n // theme and let the parent container show through until `postMessage`\n // communication is complete.\n if (isPreloadTransparentTheme()) {\n createPreloadStyleElement(\n 'theme-preload-transparent',\n calculatePreloadStyleContent(TRANSPARENT_PRELOAD_DATA_VARIABLES)\n );\n return;\n }\n\n const previousPreloadStyleContent =\n getThemePreloadData()?.preloadStyleContent;\n\n const defaultPreloadStyleContent =\n calculatePreloadStyleContent(defaultPreloadValues);\n\n log.debug('Preloading theme content:', {\n defaultPreloadStyleContent,\n previousPreloadStyleContent,\n });\n\n createPreloadStyleElement(\n 'theme-preload-defaults',\n defaultPreloadStyleContent\n );\n\n // Any preload variables that were saved by last theme load should override\n // the defaults\n if (previousPreloadStyleContent != null) {\n createPreloadStyleElement(\n 'theme-preload-previous',\n previousPreloadStyleContent\n );\n }\n}\n\n/**\n * Inline SVGs cannot depend on dynamic CSS variables, so we have to statically\n * update them if we want to change their color.\n *\n * This function:\n * 1. Clears any previous overrides\n * 2. Resolves CSS variables containing inline SVG urls\n * 3. Resolves mapped color variables and replaces the `fill='...'` attribute with the result\n * 4. Sets the original CSS variable to the new replaced value\n *\n * Note that it is preferable to use inline SVGs as background-mask values and\n * just change the background color instead of relying on this util, but this\n * is not always possible. e.g. <select> elements don't support pseudo elements,\n * so there's not a good way to set icons via masks.\n * @param defaultValues Default values to use if a variable is not set.\n */\nexport function overrideSVGFillColors(\n defaultValues: Record<string, string>\n): void {\n const resolveVar = createCssVariableResolver(document.body, defaultValues);\n\n Object.entries(SVG_ICON_MANUAL_COLOR_MAP).forEach(([key, value]) => {\n // Clear any previous override so that our variables get resolved against the\n // actual svg content provided by the active themes and not from a previous\n // override\n document.body.style.removeProperty(key);\n\n const svgContent = resolveVar(key as ThemeIconsRequiringManualColorChanges);\n const fillColor = resolveVar(value as ThemePreloadColorVariable);\n\n const newSVGContent = replaceSVGFillColor(svgContent, fillColor);\n\n // This will take precedence over any values for the variable provided by\n // the active themes\n document.body.style.setProperty(key, newSVGContent);\n });\n}\n"],"mappings":";;AAAA,OAAOA,GAAG,MAAM,gBAAgB;AAChC,SACEC,aAAa,EACbC,UAAU,EACVC,qBAAqB,QAChB,kBAAkB;AAAC,SACjBC,SAAS;AAAA,SACTC,UAAU;AAAA,SAEjBC,sBAAsB,EACtBC,uBAAuB,EACvBC,8BAA8B,EAO9BC,6BAA6B,EAC7BC,yBAAyB,EAGzBC,8BAA8B,EAC9BC,gBAAgB,EAEhBC,oBAAoB,EAEpBC,kCAAkC,EAClCC,qCAAqC;AAGvC,IAAMC,GAAG,GAAGhB,GAAG,CAACiB,MAAM,CAAC,YAAY,CAAC;AAEpC,OAAO,IAAMC,yBAAyB,GAAG,Q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,4BAA4B,CAACC,oBAAoB,CAAC;EAEpDT,GAAG,CAAC8D,KAAK,CAAC,2BAA2B,EAAE;IACrCiG,0BAA0B;IAC1BD;EACF,CAAC,CAAC;EAEFhI,yBAAyB,CACvB,wBAAwB,EACxBiI,0BACF,CAAC;;EAED;EACA;EACA,IAAID,2BAA2B,IAAI,IAAI,EAAE;IACvChI,yBAAyB,CACvB,wBAAwB,EACxBgI,2BACF,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,qBAAqBA,CACnC1I,aAAqC,EAC/B;EACN,IAAMZ,UAAU,GAAGC,yBAAyB,CAACC,QAAQ,CAACC,IAAI,EAAES,aAAa,CAAC;EAE1EP,MAAM,CAACkG,OAAO,CAACvH,yBAAyB,CAAC,CAACiD,OAAO,CAACsH,KAAA,IAAkB;IAAA,IAAjB,CAAC/I,GAAG,EAAEU,KAAK,CAAC,GAAAqI,KAAA;IAC7D;IACA;IACA;IACArJ,QAAQ,CAACC,IAAI,CAACoB,KAAK,CAACiI,cAAc,CAAChJ,GAAG,CAAC;IAEvC,IAAMuG,UAAU,GAAG/G,UAAU,CAACQ,GAA4C,CAAC;IAC3E,IAAMwG,SAAS,GAAGhH,UAAU,CAACkB,KAAkC,CAAC;IAEhE,IAAMuI,aAAa,GAAG3C,mBAAmB,CAACC,UAAU,EAAEC,SAAS,CAAC;;IAEhE;IACA;IACA9G,QAAQ,CAACC,IAAI,CAACoB,KAAK,CAACuG,WAAW,CAACtH,GAAG,EAAEiJ,aAAa,CAAC;EACrD,CAAC,CAAC;AACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useParentWindowTheme.d.ts","sourceRoot":"","sources":["../../src/theme/useParentWindowTheme.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAQ9C,MAAM,WAAW,0BAA0B;IACzC,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,0BAA0B,
|
|
1
|
+
{"version":3,"file":"useParentWindowTheme.d.ts","sourceRoot":"","sources":["../../src/theme/useParentWindowTheme.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAQ9C,MAAM,WAAW,0BAA0B;IACzC,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,0BAA0B,CAgCjE;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect,
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
2
|
import Log from '@deephaven/log';
|
|
3
3
|
import { isParentThemeEnabled, parseParentThemeData, requestParentThemeData } from "./ThemeUtils.js";
|
|
4
4
|
var logger = Log.module('useParentWindowTheme');
|
|
@@ -7,24 +7,30 @@ var logger = Log.module('useParentWindowTheme');
|
|
|
7
7
|
* `postMessage` communication to retrieve the theme data from the parent window.
|
|
8
8
|
*/
|
|
9
9
|
export function useParentWindowTheme() {
|
|
10
|
-
var [result, setResult] = useState(() =>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
var [result, setResult] = useState(() => {
|
|
11
|
+
var isEnabled = isParentThemeEnabled();
|
|
12
|
+
return {
|
|
13
|
+
isEnabled,
|
|
14
|
+
isPending: isEnabled
|
|
15
|
+
};
|
|
16
|
+
});
|
|
14
17
|
useEffect(() => {
|
|
15
|
-
if (!
|
|
18
|
+
if (!result.isEnabled) {
|
|
16
19
|
return;
|
|
17
20
|
}
|
|
21
|
+
logger.debug('Requesting parent theme data');
|
|
18
22
|
requestParentThemeData().then(parseParentThemeData).then(themeData => setResult({
|
|
23
|
+
isEnabled: true,
|
|
19
24
|
isPending: false,
|
|
20
25
|
themeData
|
|
21
26
|
})).catch(err => {
|
|
22
27
|
logger.error(err);
|
|
23
28
|
setResult({
|
|
29
|
+
isEnabled: true,
|
|
24
30
|
isPending: false
|
|
25
31
|
});
|
|
26
32
|
});
|
|
27
|
-
}, []);
|
|
33
|
+
}, [result.isEnabled]);
|
|
28
34
|
return result;
|
|
29
35
|
}
|
|
30
36
|
export default useParentWindowTheme;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useParentWindowTheme.js","names":["useEffect","
|
|
1
|
+
{"version":3,"file":"useParentWindowTheme.js","names":["useEffect","useState","Log","isParentThemeEnabled","parseParentThemeData","requestParentThemeData","logger","module","useParentWindowTheme","result","setResult","isEnabled","isPending","debug","then","themeData","catch","err","error"],"sources":["../../src/theme/useParentWindowTheme.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport Log from '@deephaven/log';\nimport { type ThemeData } from './ThemeModel';\nimport {\n isParentThemeEnabled,\n parseParentThemeData,\n requestParentThemeData,\n} from './ThemeUtils';\n\nconst logger = Log.module('useParentWindowTheme');\nexport interface UseParentWindowThemeResult {\n isEnabled: boolean;\n isPending: boolean;\n themeData?: ThemeData;\n}\n\n/**\n * If parent theme is configured via `theme=PARENT_THEME_KEY` query param, handle\n * `postMessage` communication to retrieve the theme data from the parent window.\n */\nexport function useParentWindowTheme(): UseParentWindowThemeResult {\n const [result, setResult] = useState<UseParentWindowThemeResult>(() => {\n const isEnabled = isParentThemeEnabled();\n return {\n isEnabled,\n isPending: isEnabled,\n };\n });\n\n useEffect(() => {\n if (!result.isEnabled) {\n return;\n }\n\n logger.debug('Requesting parent theme data');\n\n requestParentThemeData()\n .then(parseParentThemeData)\n .then(themeData =>\n setResult({\n isEnabled: true,\n isPending: false,\n themeData,\n })\n )\n .catch(err => {\n logger.error(err);\n setResult({ isEnabled: true, isPending: false });\n });\n }, [result.isEnabled]);\n\n return result;\n}\n\nexport default useParentWindowTheme;\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,OAAOC,GAAG,MAAM,gBAAgB;AAAC,SAG/BC,oBAAoB,EACpBC,oBAAoB,EACpBC,sBAAsB;AAGxB,IAAMC,MAAM,GAAGJ,GAAG,CAACK,MAAM,CAAC,sBAAsB,CAAC;AAOjD;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAAA,EAA+B;EACjE,IAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAGT,QAAQ,CAA6B,MAAM;IACrE,IAAMU,SAAS,GAAGR,oBAAoB,CAAC,CAAC;IACxC,OAAO;MACLQ,SAAS;MACTC,SAAS,EAAED;IACb,CAAC;EACH,CAAC,CAAC;EAEFX,SAAS,CAAC,MAAM;IACd,IAAI,CAACS,MAAM,CAACE,SAAS,EAAE;MACrB;IACF;IAEAL,MAAM,CAACO,KAAK,CAAC,8BAA8B,CAAC;IAE5CR,sBAAsB,CAAC,CAAC,CACrBS,IAAI,CAACV,oBAAoB,CAAC,CAC1BU,IAAI,CAACC,SAAS,IACbL,SAAS,CAAC;MACRC,SAAS,EAAE,IAAI;MACfC,SAAS,EAAE,KAAK;MAChBG;IACF,CAAC,CACH,CAAC,CACAC,KAAK,CAACC,GAAG,IAAI;MACZX,MAAM,CAACY,KAAK,CAACD,GAAG,CAAC;MACjBP,SAAS,CAAC;QAAEC,SAAS,EAAE,IAAI;QAAEC,SAAS,EAAE;MAAM,CAAC,CAAC;IAClD,CAAC,CAAC;EACN,CAAC,EAAE,CAACH,MAAM,CAACE,SAAS,CAAC,CAAC;EAEtB,OAAOF,MAAM;AACf;AAEA,eAAeD,oBAAoB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deephaven/components",
|
|
3
|
-
"version": "0.107.3-alpha-parent-theme.
|
|
3
|
+
"version": "0.107.3-alpha-parent-theme.15+43d3de7e",
|
|
4
4
|
"description": "Deephaven React component library",
|
|
5
5
|
"author": "Deephaven Data Labs LLC",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@adobe/react-spectrum": "3.38.0",
|
|
28
|
-
"@deephaven/icons": "^0.107.3-alpha-parent-theme.
|
|
29
|
-
"@deephaven/log": "^0.107.3-alpha-parent-theme.
|
|
30
|
-
"@deephaven/react-hooks": "^0.107.3-alpha-parent-theme.
|
|
31
|
-
"@deephaven/utils": "^0.107.3-alpha-parent-theme.
|
|
28
|
+
"@deephaven/icons": "^0.107.3-alpha-parent-theme.15+43d3de7e",
|
|
29
|
+
"@deephaven/log": "^0.107.3-alpha-parent-theme.15+43d3de7e",
|
|
30
|
+
"@deephaven/react-hooks": "^0.107.3-alpha-parent-theme.15+43d3de7e",
|
|
31
|
+
"@deephaven/utils": "^0.107.3-alpha-parent-theme.15+43d3de7e",
|
|
32
32
|
"@fortawesome/fontawesome-svg-core": "^6.2.1",
|
|
33
33
|
"@fortawesome/react-fontawesome": "^0.2.0",
|
|
34
34
|
"@internationalized/date": "^3.5.5",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"react-is": ">=16.8.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@deephaven/mocks": "^0.107.3-alpha-parent-theme.
|
|
64
|
-
"@deephaven/test-utils": "^0.107.3-alpha-parent-theme.
|
|
63
|
+
"@deephaven/mocks": "^0.107.3-alpha-parent-theme.15+43d3de7e",
|
|
64
|
+
"@deephaven/test-utils": "^0.107.3-alpha-parent-theme.15+43d3de7e",
|
|
65
65
|
"react-redux": "^7.2.4"
|
|
66
66
|
},
|
|
67
67
|
"files": [
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"access": "public"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "43d3de7ed90cd7b5e827ec11173a41752773762e"
|
|
80
80
|
}
|