@deephaven/components 0.55.1-beta.8 → 0.56.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 +837 -3627
- package/css/BaseStyleSheet.css.map +1 -1
- package/dist/AutoCompleteInput.css +4 -4
- package/dist/AutoCompleteInput.css.map +1 -1
- package/dist/Button.d.ts.map +1 -1
- package/dist/Button.js +26 -2
- package/dist/Button.js.map +1 -1
- package/dist/ComboBox.css +7 -7
- package/dist/ComboBox.css.map +1 -1
- package/dist/CustomTimeSelect.css +9 -9
- package/dist/CustomTimeSelect.css.map +1 -1
- package/dist/DraggableItemList.css +14 -14
- package/dist/DraggableItemList.css.map +1 -1
- package/dist/ErrorBoundary.d.ts +26 -0
- package/dist/ErrorBoundary.d.ts.map +1 -0
- package/dist/ErrorBoundary.js +55 -0
- package/dist/ErrorBoundary.js.map +1 -0
- package/dist/HierarchicalCheckboxMenu.css +20 -6
- package/dist/HierarchicalCheckboxMenu.css.map +1 -1
- package/dist/HierarchicalCheckboxMenu.d.ts.map +1 -1
- package/dist/HierarchicalCheckboxMenu.js +2 -4
- package/dist/HierarchicalCheckboxMenu.js.map +1 -1
- package/dist/ItemList.css +1 -1
- package/dist/ItemList.css.map +1 -1
- package/dist/ItemListItem.css +7 -7
- package/dist/ItemListItem.css.map +1 -1
- package/dist/LoadingOverlay.css +1 -1
- package/dist/LoadingOverlay.css.map +1 -1
- package/dist/MaskedInput.css.map +1 -1
- package/dist/RandomAreaPlotAnimation.d.ts +1 -1
- package/dist/RandomAreaPlotAnimation.d.ts.map +1 -1
- package/dist/RandomAreaPlotAnimation.js +49 -13
- package/dist/RandomAreaPlotAnimation.js.map +1 -1
- package/dist/SearchInput.css +3 -3
- package/dist/SearchInput.css.map +1 -1
- package/dist/SelectValueList.css +3 -3
- package/dist/SelectValueList.css.map +1 -1
- package/dist/SocketedButton.css +33 -33
- package/dist/SocketedButton.css.map +1 -1
- package/dist/ThemeExport.module.css +33 -33
- package/dist/ThemeExport.module.css.map +1 -1
- package/dist/TimeSlider.css +10 -10
- package/dist/TimeSlider.css.map +1 -1
- package/dist/TimeSlider.module.css +10 -10
- package/dist/TimeSlider.module.css.map +1 -1
- package/dist/ToastNotification.css +4 -4
- package/dist/ToastNotification.css.map +1 -1
- package/dist/UISwitch.css +19 -19
- package/dist/UISwitch.css.map +1 -1
- package/dist/ValidateLabelInput.css +1 -1
- package/dist/ValidateLabelInput.css.map +1 -1
- package/dist/context-actions/ContextActions.css +19 -19
- package/dist/context-actions/ContextActions.css.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/menu-actions/DropdownMenu.css +2 -2
- package/dist/menu-actions/DropdownMenu.css.map +1 -1
- package/dist/navigation/MenuItem.css +9 -9
- package/dist/navigation/MenuItem.css.map +1 -1
- package/dist/navigation/Page.css.map +1 -1
- package/dist/navigation/Stack.css +2 -2
- package/dist/navigation/Stack.css.map +1 -1
- package/dist/popper/Popper.css +4 -4
- package/dist/popper/Popper.css.map +1 -1
- package/dist/theme/SpectrumThemeProvider.d.ts.map +1 -1
- package/dist/theme/SpectrumThemeProvider.js +1 -0
- package/dist/theme/SpectrumThemeProvider.js.map +1 -1
- package/dist/theme/ThemeModel.d.ts +1 -1
- package/dist/theme/ThemeModel.d.ts.map +1 -1
- package/dist/theme/ThemeModel.js +56 -7
- package/dist/theme/ThemeModel.js.map +1 -1
- package/dist/theme/ThemePicker.d.ts +4 -0
- package/dist/theme/ThemePicker.d.ts.map +1 -0
- package/dist/theme/ThemePicker.js +25 -0
- package/dist/theme/ThemePicker.js.map +1 -0
- package/dist/theme/ThemeProvider.d.ts +2 -1
- package/dist/theme/ThemeProvider.d.ts.map +1 -1
- package/dist/theme/ThemeProvider.js +10 -8
- package/dist/theme/ThemeProvider.js.map +1 -1
- package/dist/theme/ThemeUtils.d.ts +5 -3
- package/dist/theme/ThemeUtils.d.ts.map +1 -1
- package/dist/theme/ThemeUtils.js +18 -22
- package/dist/theme/ThemeUtils.js.map +1 -1
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +1 -0
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/theme-dark/theme-dark-components.css +1 -1
- package/dist/theme/theme-dark/theme-dark-components.css.map +1 -1
- package/dist/theme/theme-dark/theme-dark-palette.css +1 -1
- package/dist/theme/theme-dark/theme-dark-palette.css.map +1 -1
- package/dist/theme/theme-dark/theme-dark-semantic-chart.css +1 -1
- package/dist/theme/theme-dark/theme-dark-semantic-chart.css.map +1 -1
- package/dist/theme/theme-dark/theme-dark-semantic-editor.css +1 -1
- package/dist/theme/theme-dark/theme-dark-semantic-editor.css.map +1 -1
- package/dist/theme/theme-dark/theme-dark-semantic-grid.css +1 -1
- package/dist/theme/theme-dark/theme-dark-semantic-grid.css.map +1 -1
- package/dist/theme/theme-dark/theme-dark-semantic.css +1 -1
- package/dist/theme/theme-dark/theme-dark-semantic.css.map +1 -1
- package/dist/theme/theme-light/theme-light-palette.css +1 -1
- package/dist/theme/theme-light/theme-light-palette.css.map +1 -1
- package/dist/theme/theme-spectrum/theme-spectrum-alias.module.css +1 -1
- package/dist/theme/theme-spectrum/theme-spectrum-alias.module.css.map +1 -1
- package/package.json +7 -7
- package/scss/BaseStyleSheet.scss +68 -60
- package/scss/bootstrap_imports.scss +49 -0
- package/scss/bootstrap_override_functions.scss +31 -0
- package/scss/bootstrap_override_mixins_background_variant.scss +16 -0
- package/scss/bootstrap_override_mixins_buttons.scss +123 -0
- package/scss/bootstrap_override_mixins_forms.scss +231 -0
- package/scss/bootstrap_override_mixins_text_emphasis.scss +21 -0
- package/scss/bootstrap_overrides.scss +144 -101
- package/scss/new_variables.scss +18 -0
- package/scss/util.scss +2 -2
|
@@ -22,6 +22,7 @@ export function SpectrumThemeProvider(_ref) {
|
|
|
22
22
|
// won't be needed if https://github.com/adobe/react-spectrum/pull/2669 is merged
|
|
23
23
|
var [id] = useState(isPortal ? shortid() : null);
|
|
24
24
|
return /*#__PURE__*/_jsx(Provider, {
|
|
25
|
+
UNSAFE_className: "spectrum-theme-provider",
|
|
25
26
|
theme: theme,
|
|
26
27
|
colorScheme: colorScheme,
|
|
27
28
|
"data-unique-id": id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpectrumThemeProvider.js","names":["useState","Provider","shortid","themeDHDefault","jsx","_jsx","SpectrumThemeProvider","_ref","children","isPortal","theme","colorScheme","id"],"sources":["../../src/theme/SpectrumThemeProvider.tsx"],"sourcesContent":["import { ReactNode, useState } from 'react';\nimport { Provider } from '@adobe/react-spectrum';\nimport type { Theme } from '@react-types/provider';\nimport shortid from 'shortid';\nimport { themeDHDefault } from '../SpectrumUtils';\n\nexport interface SpectrumThemeProviderProps {\n children: ReactNode;\n isPortal?: boolean;\n theme?: Theme;\n colorScheme?: 'light' | 'dark';\n}\n\n/**\n * Wrapper around React Spectrum's theme Provider that provides DH mappings of\n * Spectrum's theme variables to DH's theme variables. Also exposes an optional\n * `isPortal` prop that if provided, adds a unique `data-unique-id` attribute to\n * the Provider. This is needed to force the Provider to render the theme wrapper\n * inside of portals.\n */\nexport function SpectrumThemeProvider({\n children,\n isPortal = false,\n theme = themeDHDefault,\n colorScheme,\n}: SpectrumThemeProviderProps): JSX.Element {\n // a unique ID is used per provider to force it to render the theme wrapper element inside portals\n // based on https://github.com/adobe/react-spectrum/issues/1697#issuecomment-999827266\n // won't be needed if https://github.com/adobe/react-spectrum/pull/2669 is merged\n const [id] = useState(isPortal ? shortid() : null);\n\n return (\n <Provider
|
|
1
|
+
{"version":3,"file":"SpectrumThemeProvider.js","names":["useState","Provider","shortid","themeDHDefault","jsx","_jsx","SpectrumThemeProvider","_ref","children","isPortal","theme","colorScheme","id","UNSAFE_className"],"sources":["../../src/theme/SpectrumThemeProvider.tsx"],"sourcesContent":["import { ReactNode, useState } from 'react';\nimport { Provider } from '@adobe/react-spectrum';\nimport type { Theme } from '@react-types/provider';\nimport shortid from 'shortid';\nimport { themeDHDefault } from '../SpectrumUtils';\n\nexport interface SpectrumThemeProviderProps {\n children: ReactNode;\n isPortal?: boolean;\n theme?: Theme;\n colorScheme?: 'light' | 'dark';\n}\n\n/**\n * Wrapper around React Spectrum's theme Provider that provides DH mappings of\n * Spectrum's theme variables to DH's theme variables. Also exposes an optional\n * `isPortal` prop that if provided, adds a unique `data-unique-id` attribute to\n * the Provider. This is needed to force the Provider to render the theme wrapper\n * inside of portals.\n */\nexport function SpectrumThemeProvider({\n children,\n isPortal = false,\n theme = themeDHDefault,\n colorScheme,\n}: SpectrumThemeProviderProps): JSX.Element {\n // a unique ID is used per provider to force it to render the theme wrapper element inside portals\n // based on https://github.com/adobe/react-spectrum/issues/1697#issuecomment-999827266\n // won't be needed if https://github.com/adobe/react-spectrum/pull/2669 is merged\n const [id] = useState(isPortal ? shortid() : null);\n\n return (\n <Provider\n UNSAFE_className=\"spectrum-theme-provider\"\n theme={theme}\n colorScheme={colorScheme}\n data-unique-id={id}\n >\n {children}\n </Provider>\n );\n}\n"],"mappings":"AAAA,SAAoBA,QAAQ,QAAQ,OAAO;AAC3C,SAASC,QAAQ,QAAQ,uBAAuB;AAEhD,OAAOC,OAAO,MAAM,SAAS;AAAC,SACrBC,cAAc;AAAA,SAAAC,GAAA,IAAAC,IAAA;AASvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAAAC,IAAA,EAKO;EAAA,IALN;IACpCC,QAAQ;IACRC,QAAQ,GAAG,KAAK;IAChBC,KAAK,GAAGP,cAAc;IACtBQ;EAC0B,CAAC,GAAAJ,IAAA;EAC3B;EACA;EACA;EACA,IAAM,CAACK,EAAE,CAAC,GAAGZ,QAAQ,CAACS,QAAQ,GAAGP,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;EAElD,oBACEG,IAAA,CAACJ,QAAQ;IACPY,gBAAgB,EAAC,yBAAyB;IAC1CH,KAAK,EAAEA,KAAM;IACbC,WAAW,EAAEA,WAAY;IACzB,kBAAgBC,EAAG;IAAAJ,QAAA,EAElBA;EAAQ,CACD,CAAC;AAEf"}
|
|
@@ -2,7 +2,7 @@ export type BaseThemeType = 'dark' | 'light';
|
|
|
2
2
|
export type BaseThemeKey = `default-${BaseThemeType}`;
|
|
3
3
|
export type CssVariableStyleContent = `:root{${string}`;
|
|
4
4
|
export type ThemeCssVariableName = `--dh-${string}`;
|
|
5
|
-
export type ThemePreloadColorVariable = '--dh-color-loading-spinner-primary' | '--dh-color-loading-spinner-secondary' | '--dh-color-
|
|
5
|
+
export type ThemePreloadColorVariable = '--dh-color-accent-contrast' | '--dh-color-accent-bg' | '--dh-color-accent-hover-bg' | '--dh-color-accent-down-bg' | '--dh-color-accent-key-focus-bg' | '--dh-color-negative-bg' | '--dh-color-loading-spinner-primary' | '--dh-color-loading-spinner-secondary' | '--dh-color-bg' | '--dh-color-fg' | '--dh-color-input-bg' | '--dh-color-input-fg' | '--dh-color-input-disabled-bg' | '--dh-color-input-border' | '--dh-color-input-placeholder' | '--dh-color-input-focus-border' | '--dh-color-login-form-bg' | '--dh-color-login-status-message' | '--dh-color-login-logo-bg' | '--dh-color-login-footer-fg' | '--dh-color-random-area-plot-animation-fg-fill' | '--dh-color-random-area-plot-animation-fg-stroke' | '--dh-color-random-area-plot-animation-bg' | '--dh-color-random-area-plot-animation-grid';
|
|
6
6
|
export type ThemeIconsRequiringManualColorChanges = '--dh-svg-icon-select-indicator' | '--dh-svg-icon-select-indicator-hover' | '--dh-svg-icon-select-indicator-disabled' | '--dh-svg-icon-error';
|
|
7
7
|
export declare const DEFAULT_DARK_THEME_KEY = "default-dark";
|
|
8
8
|
export declare const DEFAULT_LIGHT_THEME_KEY = "default-light";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeModel.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeModel.ts"],"names":[],"mapp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M,CA+BP,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAC5C,qCAAqC,EACrC,MAAM,CAMP,CAAC;AAEF,eAAO,MAAM,6BAA6B,yBAAyB,CAAC;AAEpE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,mBAAmB,CAAC,EAAE,uBAAuB,CAAC;CAC/C;AAED,MAAM,WAAW,SAAS;IACxB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,SAAS,EAAE,CAAC;IAClB,MAAM,EAAE,SAAS,EAAE,CAAC;CACrB"}
|
package/dist/theme/ThemeModel.js
CHANGED
|
@@ -1,15 +1,64 @@
|
|
|
1
1
|
export var DEFAULT_DARK_THEME_KEY = 'default-dark';
|
|
2
2
|
export var DEFAULT_LIGHT_THEME_KEY = 'default-light';
|
|
3
3
|
|
|
4
|
+
// Hex versions of some of the default dark theme color palette needed for
|
|
5
|
+
// preload defaults.
|
|
6
|
+
var DEFAULT_DARK_THEME_PALETTE = {
|
|
7
|
+
blue: {
|
|
8
|
+
500: '#2f5bc0',
|
|
9
|
+
400: '#254ba4',
|
|
10
|
+
600: '#3b6bda' // accent color
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
red: {
|
|
14
|
+
600: '#c73f61'
|
|
15
|
+
},
|
|
16
|
+
gray: {
|
|
17
|
+
50: '#1a171a',
|
|
18
|
+
75: '#211f22',
|
|
19
|
+
300: '#373438',
|
|
20
|
+
400: '#403e41',
|
|
21
|
+
500: '#5b5a5c',
|
|
22
|
+
600: '#929192',
|
|
23
|
+
700: '#c0bfbf',
|
|
24
|
+
800: '#f0f0ee',
|
|
25
|
+
900: '#fcfcfa'
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
4
29
|
// Css properties that are used in preload data with default values.
|
|
5
30
|
export var DEFAULT_PRELOAD_DATA_VARIABLES = {
|
|
6
|
-
'--dh-color-
|
|
7
|
-
|
|
8
|
-
'--dh-color-
|
|
9
|
-
|
|
10
|
-
'--dh-color-
|
|
11
|
-
|
|
12
|
-
'--dh-color-
|
|
31
|
+
'--dh-color-accent-contrast': DEFAULT_DARK_THEME_PALETTE.gray[900],
|
|
32
|
+
'--dh-color-accent-bg': DEFAULT_DARK_THEME_PALETTE.blue[600],
|
|
33
|
+
'--dh-color-accent-hover-bg': DEFAULT_DARK_THEME_PALETTE.blue[500],
|
|
34
|
+
'--dh-color-accent-down-bg': DEFAULT_DARK_THEME_PALETTE.blue[400],
|
|
35
|
+
'--dh-color-accent-key-focus-bg': DEFAULT_DARK_THEME_PALETTE.blue[500],
|
|
36
|
+
'--dh-color-negative-bg': DEFAULT_DARK_THEME_PALETTE.red[600],
|
|
37
|
+
'--dh-color-loading-spinner-primary': DEFAULT_DARK_THEME_PALETTE.blue[600],
|
|
38
|
+
'--dh-color-loading-spinner-secondary': "".concat(DEFAULT_DARK_THEME_PALETTE.gray[800], "80"),
|
|
39
|
+
// 50% opacity
|
|
40
|
+
'--dh-color-bg': DEFAULT_DARK_THEME_PALETTE.gray[50],
|
|
41
|
+
'--dh-color-fg': DEFAULT_DARK_THEME_PALETTE.gray[800],
|
|
42
|
+
'--dh-color-input-bg': DEFAULT_DARK_THEME_PALETTE.gray[500],
|
|
43
|
+
'--dh-color-input-fg': DEFAULT_DARK_THEME_PALETTE.gray[800],
|
|
44
|
+
'--dh-color-input-disabled-bg': DEFAULT_DARK_THEME_PALETTE.gray[300],
|
|
45
|
+
'--dh-color-input-border': DEFAULT_DARK_THEME_PALETTE.gray[600],
|
|
46
|
+
'--dh-color-input-placeholder': DEFAULT_DARK_THEME_PALETTE.gray[600],
|
|
47
|
+
'--dh-color-input-focus-border': "".concat(DEFAULT_DARK_THEME_PALETTE.blue[600], "d9"),
|
|
48
|
+
// 85% opacity
|
|
49
|
+
// Preloading login specific variables should only be needed in DHE. Including
|
|
50
|
+
// them for now until we have a way for DHE to configure them. To be addressed
|
|
51
|
+
// by #1679
|
|
52
|
+
'--dh-color-login-form-bg': DEFAULT_DARK_THEME_PALETTE.gray[400],
|
|
53
|
+
'--dh-color-login-status-message': DEFAULT_DARK_THEME_PALETTE.gray[600],
|
|
54
|
+
'--dh-color-login-logo-bg': DEFAULT_DARK_THEME_PALETTE.gray[900],
|
|
55
|
+
'--dh-color-login-footer-fg': DEFAULT_DARK_THEME_PALETTE.gray[700],
|
|
56
|
+
'--dh-color-random-area-plot-animation-fg-fill': "".concat(DEFAULT_DARK_THEME_PALETTE.blue[600], "14"),
|
|
57
|
+
// .08 opacity
|
|
58
|
+
'--dh-color-random-area-plot-animation-fg-stroke': "".concat(DEFAULT_DARK_THEME_PALETTE.blue[600], "33"),
|
|
59
|
+
// .2 opacity
|
|
60
|
+
'--dh-color-random-area-plot-animation-bg': DEFAULT_DARK_THEME_PALETTE.gray[75],
|
|
61
|
+
'--dh-color-random-area-plot-animation-grid': DEFAULT_DARK_THEME_PALETTE.gray[300]
|
|
13
62
|
};
|
|
14
63
|
|
|
15
64
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeModel.js","names":["DEFAULT_DARK_THEME_KEY","DEFAULT_LIGHT_THEME_KEY","DEFAULT_PRELOAD_DATA_VARIABLES","SVG_ICON_MANUAL_COLOR_MAP","THEME_CACHE_LOCAL_STORAGE_KEY"],"sources":["../../src/theme/ThemeModel.ts"],"sourcesContent":["export type BaseThemeType = 'dark' | 'light';\nexport type BaseThemeKey = `default-${BaseThemeType}`;\nexport type CssVariableStyleContent = `:root{${string}`;\nexport type ThemeCssVariableName = `--dh-${string}`;\n\nexport type ThemePreloadColorVariable =\n | '--dh-color-loading-spinner-primary'\n | '--dh-color-loading-spinner-secondary'\n | '--dh-color-
|
|
1
|
+
{"version":3,"file":"ThemeModel.js","names":["DEFAULT_DARK_THEME_KEY","DEFAULT_LIGHT_THEME_KEY","DEFAULT_DARK_THEME_PALETTE","blue","red","gray","DEFAULT_PRELOAD_DATA_VARIABLES","concat","SVG_ICON_MANUAL_COLOR_MAP","THEME_CACHE_LOCAL_STORAGE_KEY"],"sources":["../../src/theme/ThemeModel.ts"],"sourcesContent":["export type BaseThemeType = 'dark' | 'light';\nexport type BaseThemeKey = `default-${BaseThemeType}`;\nexport type CssVariableStyleContent = `:root{${string}`;\nexport type ThemeCssVariableName = `--dh-${string}`;\n\nexport type ThemePreloadColorVariable =\n | '--dh-color-accent-contrast'\n | '--dh-color-accent-bg'\n | '--dh-color-accent-hover-bg'\n | '--dh-color-accent-down-bg'\n | '--dh-color-accent-key-focus-bg'\n | '--dh-color-negative-bg'\n | '--dh-color-loading-spinner-primary'\n | '--dh-color-loading-spinner-secondary'\n | '--dh-color-bg'\n | '--dh-color-fg'\n | '--dh-color-input-bg'\n | '--dh-color-input-fg'\n | '--dh-color-input-disabled-bg'\n | '--dh-color-input-border'\n | '--dh-color-input-placeholder'\n | '--dh-color-input-focus-border'\n // Preloading login specific variables should only be needed in DHE. Including\n // them for now until we have a way for DHE to configure them. To be addressed\n // by #1679\n | '--dh-color-login-form-bg'\n | '--dh-color-login-status-message'\n | '--dh-color-login-logo-bg'\n | '--dh-color-login-footer-fg'\n | '--dh-color-random-area-plot-animation-fg-fill'\n | '--dh-color-random-area-plot-animation-fg-stroke'\n | '--dh-color-random-area-plot-animation-bg'\n | '--dh-color-random-area-plot-animation-grid';\n\nexport type ThemeIconsRequiringManualColorChanges =\n | '--dh-svg-icon-select-indicator'\n | '--dh-svg-icon-select-indicator-hover'\n | '--dh-svg-icon-select-indicator-disabled'\n | '--dh-svg-icon-error';\n\nexport const DEFAULT_DARK_THEME_KEY = 'default-dark' satisfies BaseThemeKey;\nexport const DEFAULT_LIGHT_THEME_KEY = 'default-light' satisfies BaseThemeKey;\n\n// Hex versions of some of the default dark theme color palette needed for\n// preload defaults.\nconst DEFAULT_DARK_THEME_PALETTE = {\n blue: {\n 500: '#2f5bc0',\n 400: '#254ba4',\n 600: '#3b6bda', // accent color\n },\n red: {\n 600: '#c73f61',\n },\n gray: {\n 50: '#1a171a',\n 75: '#211f22',\n 300: '#373438',\n 400: '#403e41',\n 500: '#5b5a5c',\n 600: '#929192',\n 700: '#c0bfbf',\n 800: '#f0f0ee',\n 900: '#fcfcfa',\n },\n} as const;\n\n// Css properties that are used in preload data with default values.\nexport const DEFAULT_PRELOAD_DATA_VARIABLES: Record<\n ThemePreloadColorVariable,\n string\n> = {\n '--dh-color-accent-contrast': DEFAULT_DARK_THEME_PALETTE.gray[900],\n '--dh-color-accent-bg': DEFAULT_DARK_THEME_PALETTE.blue[600],\n '--dh-color-accent-hover-bg': DEFAULT_DARK_THEME_PALETTE.blue[500],\n '--dh-color-accent-down-bg': DEFAULT_DARK_THEME_PALETTE.blue[400],\n '--dh-color-accent-key-focus-bg': DEFAULT_DARK_THEME_PALETTE.blue[500],\n '--dh-color-negative-bg': DEFAULT_DARK_THEME_PALETTE.red[600],\n '--dh-color-loading-spinner-primary': DEFAULT_DARK_THEME_PALETTE.blue[600],\n '--dh-color-loading-spinner-secondary': `${DEFAULT_DARK_THEME_PALETTE.gray[800]}80`, // 50% opacity\n '--dh-color-bg': DEFAULT_DARK_THEME_PALETTE.gray[50],\n '--dh-color-fg': DEFAULT_DARK_THEME_PALETTE.gray[800],\n '--dh-color-input-bg': DEFAULT_DARK_THEME_PALETTE.gray[500],\n '--dh-color-input-fg': DEFAULT_DARK_THEME_PALETTE.gray[800],\n '--dh-color-input-disabled-bg': DEFAULT_DARK_THEME_PALETTE.gray[300],\n '--dh-color-input-border': DEFAULT_DARK_THEME_PALETTE.gray[600],\n '--dh-color-input-placeholder': DEFAULT_DARK_THEME_PALETTE.gray[600],\n '--dh-color-input-focus-border': `${DEFAULT_DARK_THEME_PALETTE.blue[600]}d9`, // 85% opacity\n // Preloading login specific variables should only be needed in DHE. Including\n // them for now until we have a way for DHE to configure them. To be addressed\n // by #1679\n '--dh-color-login-form-bg': DEFAULT_DARK_THEME_PALETTE.gray[400],\n '--dh-color-login-status-message': DEFAULT_DARK_THEME_PALETTE.gray[600],\n '--dh-color-login-logo-bg': DEFAULT_DARK_THEME_PALETTE.gray[900],\n '--dh-color-login-footer-fg': DEFAULT_DARK_THEME_PALETTE.gray[700],\n '--dh-color-random-area-plot-animation-fg-fill': `${DEFAULT_DARK_THEME_PALETTE.blue[600]}14`, // .08 opacity\n '--dh-color-random-area-plot-animation-fg-stroke': `${DEFAULT_DARK_THEME_PALETTE.blue[600]}33`, // .2 opacity\n '--dh-color-random-area-plot-animation-bg':\n DEFAULT_DARK_THEME_PALETTE.gray[75],\n '--dh-color-random-area-plot-animation-grid':\n DEFAULT_DARK_THEME_PALETTE.gray[300],\n};\n\n/**\n * Some inline SVGs require manually updating their fill color via\n * `updateSVGFillColors`. This object maps these variables to their respective\n * fill color variables.\n */\nexport const SVG_ICON_MANUAL_COLOR_MAP: Record<\n ThemeIconsRequiringManualColorChanges,\n string\n> = {\n '--dh-svg-icon-select-indicator': '--dh-color-selector-fg',\n '--dh-svg-icon-select-indicator-hover': '--dh-color-selector-hover-fg',\n '--dh-svg-icon-select-indicator-disabled': '--dh-color-selector-disabled-fg',\n '--dh-svg-icon-error': '--dh-color-form-control-error',\n};\n\nexport const THEME_CACHE_LOCAL_STORAGE_KEY = 'deephaven.themeCache';\n\nexport interface ThemePreloadData {\n themeKey: string;\n preloadStyleContent?: CssVariableStyleContent;\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":"AAwCA,OAAO,IAAMA,sBAAsB,GAAG,cAAqC;AAC3E,OAAO,IAAMC,uBAAuB,GAAG,eAAsC;;AAE7E;AACA;AACA,IAAMC,0BAA0B,GAAG;EACjCC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yBAAyB,EAAEH,0BAA0B,CAACG,IAAI,CAAC,GAAG,CAAC;EAC/D,8BAA8B,EAAEH,0BAA0B,CAACG,IAAI,CAAC,GAAG,CAAC;EACpE,+BAA+B,KAAAE,MAAA,CAAKL,0BAA0B,CAACC,IAAI,CAAC,GAAG,CAAC,OAAI;EAAE;EAC9E;EACA;EACA;EACA,0BAA0B,EAAED,0BAA0B,CAACG,IAAI,CAAC,GAAG,CAAC;EAChE,iCAAiC,EAAEH,0BAA0B,CAACG,IAAI,CAAC,GAAG,CAAC;EACvE,0BAA0B,EAAEH,0BAA0B,CAACG,IAAI,CAAC,GAAG,CAAC;EAChE,4BAA4B,EAAEH,0BAA0B,CAACG,IAAI,CAAC,GAAG,CAAC;EAClE,+CAA+C,KAAAE,MAAA,CAAKL,0BAA0B,CAACC,IAAI,CAAC,GAAG,CAAC,OAAI;EAAE;EAC9F,iDAAiD,KAAAI,MAAA,CAAKL,0BAA0B,CAACC,IAAI,CAAC,GAAG,CAAC,OAAI;EAAE;EAChG,0CAA0C,EACxCD,0BAA0B,CAACG,IAAI,CAAC,EAAE,CAAC;EACrC,4CAA4C,EAC1CH,0BAA0B,CAACG,IAAI,CAAC,GAAG;AACvC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMG,yBAGZ,GAAG;EACF,gCAAgC,EAAE,wBAAwB;EAC1D,sCAAsC,EAAE,8BAA8B;EACtE,yCAAyC,EAAE,iCAAiC;EAC5E,qBAAqB,EAAE;AACzB,CAAC;AAED,OAAO,IAAMC,6BAA6B,GAAG,sBAAsB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemePicker.d.ts","sourceRoot":"","sources":["../../src/theme/ThemePicker.tsx"],"names":[],"mappings":";AAIA,wBAAgB,WAAW,IAAI,GAAG,CAAC,OAAO,GAAG,IAAI,CAoBhD;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { Item, Picker } from '@adobe/react-spectrum';
|
|
3
|
+
import useTheme from "./useTheme.js";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
export function ThemePicker() {
|
|
6
|
+
var {
|
|
7
|
+
selectedThemeKey,
|
|
8
|
+
setSelectedThemeKey,
|
|
9
|
+
themes
|
|
10
|
+
} = useTheme();
|
|
11
|
+
var onSelectionChange = useCallback(key => {
|
|
12
|
+
setSelectedThemeKey(key);
|
|
13
|
+
}, [setSelectedThemeKey]);
|
|
14
|
+
return /*#__PURE__*/_jsx(Picker, {
|
|
15
|
+
label: "Pick a color scheme",
|
|
16
|
+
items: themes,
|
|
17
|
+
selectedKey: selectedThemeKey,
|
|
18
|
+
onSelectionChange: onSelectionChange,
|
|
19
|
+
children: item => /*#__PURE__*/_jsx(Item, {
|
|
20
|
+
children: item.name
|
|
21
|
+
}, item.themeKey)
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export default ThemePicker;
|
|
25
|
+
//# sourceMappingURL=ThemePicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemePicker.js","names":["useCallback","Item","Picker","useTheme","jsx","_jsx","ThemePicker","selectedThemeKey","setSelectedThemeKey","themes","onSelectionChange","key","label","items","selectedKey","children","item","name","themeKey"],"sources":["../../src/theme/ThemePicker.tsx"],"sourcesContent":["import { Key, useCallback } from 'react';\nimport { Item, Picker } from '@adobe/react-spectrum';\nimport useTheme from './useTheme';\n\nexport function ThemePicker(): JSX.Element | null {\n const { selectedThemeKey, setSelectedThemeKey, themes } = useTheme();\n\n const onSelectionChange = useCallback(\n (key: Key) => {\n setSelectedThemeKey(key as string);\n },\n [setSelectedThemeKey]\n );\n\n return (\n <Picker\n label=\"Pick a color scheme\"\n items={themes}\n selectedKey={selectedThemeKey}\n onSelectionChange={onSelectionChange}\n >\n {item => <Item key={item.themeKey}>{item.name}</Item>}\n </Picker>\n );\n}\n\nexport default ThemePicker;\n"],"mappings":"AAAA,SAAcA,WAAW,QAAQ,OAAO;AACxC,SAASC,IAAI,EAAEC,MAAM,QAAQ,uBAAuB;AAAC,OAC9CC,QAAQ;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAEf,OAAO,SAASC,WAAWA,CAAA,EAAuB;EAChD,IAAM;IAAEC,gBAAgB;IAAEC,mBAAmB;IAAEC;EAAO,CAAC,GAAGN,QAAQ,CAAC,CAAC;EAEpE,IAAMO,iBAAiB,GAAGV,WAAW,CAClCW,GAAQ,IAAK;IACZH,mBAAmB,CAACG,GAAa,CAAC;EACpC,CAAC,EACD,CAACH,mBAAmB,CACtB,CAAC;EAED,oBACEH,IAAA,CAACH,MAAM;IACLU,KAAK,EAAC,qBAAqB;IAC3BC,KAAK,EAAEJ,MAAO;IACdK,WAAW,EAAEP,gBAAiB;IAC9BG,iBAAiB,EAAEA,iBAAkB;IAAAK,QAAA,EAEpCC,IAAI,iBAAIX,IAAA,CAACJ,IAAI;MAAAc,QAAA,EAAsBC,IAAI,CAACC;IAAI,GAAzBD,IAAI,CAACE,QAA2B;EAAC,CAC/C,CAAC;AAEb;AAEA,eAAeZ,WAAW"}
|
|
@@ -4,6 +4,7 @@ import './theme-svg.scss';
|
|
|
4
4
|
export interface ThemeContextValue {
|
|
5
5
|
activeThemes: ThemeData[] | null;
|
|
6
6
|
selectedThemeKey: string;
|
|
7
|
+
themes: ThemeData[];
|
|
7
8
|
setSelectedThemeKey: (themeKey: string) => void;
|
|
8
9
|
}
|
|
9
10
|
export declare const ThemeContext: import("react").Context<ThemeContextValue | null>;
|
|
@@ -11,6 +12,6 @@ export interface ThemeProviderProps {
|
|
|
11
12
|
themes: ThemeData[] | null;
|
|
12
13
|
children: ReactNode;
|
|
13
14
|
}
|
|
14
|
-
export declare function ThemeProvider({ themes, children, }: ThemeProviderProps): JSX.Element;
|
|
15
|
+
export declare function ThemeProvider({ themes: customThemes, children, }: ThemeProviderProps): JSX.Element;
|
|
15
16
|
export default ThemeProvider;
|
|
16
17
|
//# sourceMappingURL=ThemeProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAgC,MAAM,OAAO,CAAC;AAE/E,OAAO,EAA0B,SAAS,EAAE,MAAM,cAAc,CAAC;AAUjE,OAAO,kBAAkB,CAAC;AAE1B,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IACjC,gBAAgB,EAAE,MAAM,CAAC;IACzB,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,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,EAC5B,MAAM,
|
|
1
|
+
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAgC,MAAM,OAAO,CAAC;AAE/E,OAAO,EAA0B,SAAS,EAAE,MAAM,cAAc,CAAC;AAUjE,OAAO,kBAAkB,CAAC;AAE1B,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,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EAAE,YAAY,EACpB,QAAQ,GACT,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CA4ElC;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -11,7 +11,7 @@ var log = Log.module('ThemeProvider');
|
|
|
11
11
|
export var ThemeContext = /*#__PURE__*/createContext(null);
|
|
12
12
|
export function ThemeProvider(_ref) {
|
|
13
13
|
var {
|
|
14
|
-
themes,
|
|
14
|
+
themes: customThemes,
|
|
15
15
|
children
|
|
16
16
|
} = _ref;
|
|
17
17
|
var baseThemes = useMemo(() => getDefaultBaseThemes(), []);
|
|
@@ -21,13 +21,14 @@ export function ThemeProvider(_ref) {
|
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
// Calculate active themes once a non-null themes array is provided.
|
|
24
|
-
var activeThemes = useMemo(() =>
|
|
24
|
+
var activeThemes = useMemo(() => customThemes == null ? null : getActiveThemes(selectedThemeKey, {
|
|
25
25
|
base: baseThemes,
|
|
26
|
-
custom:
|
|
27
|
-
}), [baseThemes, selectedThemeKey,
|
|
26
|
+
custom: customThemes !== null && customThemes !== void 0 ? customThemes : []
|
|
27
|
+
}), [baseThemes, selectedThemeKey, customThemes]);
|
|
28
|
+
var themes = useMemo(() => [...baseThemes, ...(customThemes !== null && customThemes !== void 0 ? customThemes : [])], [baseThemes, customThemes]);
|
|
28
29
|
useEffect(function updateThemePreloadData() {
|
|
29
30
|
// Don't update preload data until themes have been loaded and activated
|
|
30
|
-
if (activeThemes == null ||
|
|
31
|
+
if (activeThemes == null || customThemes == null) {
|
|
31
32
|
return;
|
|
32
33
|
}
|
|
33
34
|
|
|
@@ -37,7 +38,7 @@ export function ThemeProvider(_ref) {
|
|
|
37
38
|
var preloadStyleContent = calculatePreloadStyleContent();
|
|
38
39
|
log.debug2('updateThemePreloadData:', {
|
|
39
40
|
active: activeThemes.map(theme => theme.themeKey),
|
|
40
|
-
|
|
41
|
+
custom: customThemes.map(theme => theme.themeKey),
|
|
41
42
|
preloadStyleContent,
|
|
42
43
|
selectedThemeKey
|
|
43
44
|
});
|
|
@@ -45,12 +46,13 @@ export function ThemeProvider(_ref) {
|
|
|
45
46
|
themeKey: selectedThemeKey,
|
|
46
47
|
preloadStyleContent
|
|
47
48
|
});
|
|
48
|
-
}, [activeThemes, selectedThemeKey,
|
|
49
|
+
}, [activeThemes, selectedThemeKey, customThemes]);
|
|
49
50
|
var value = useMemo(() => ({
|
|
50
51
|
activeThemes,
|
|
51
52
|
selectedThemeKey,
|
|
53
|
+
themes,
|
|
52
54
|
setSelectedThemeKey
|
|
53
|
-
}), [activeThemes, selectedThemeKey]);
|
|
55
|
+
}), [activeThemes, selectedThemeKey, themes]);
|
|
54
56
|
return /*#__PURE__*/_jsxs(ThemeContext.Provider, {
|
|
55
57
|
value: value,
|
|
56
58
|
children: [activeThemes == null ? null : /*#__PURE__*/_jsx(_Fragment, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.js","names":["createContext","useEffect","useMemo","useState","Log","DEFAULT_DARK_THEME_KEY","calculatePreloadStyleContent","getActiveThemes","getDefaultBaseThemes","getThemePreloadData","setThemePreloadData","overrideSVGFillColors","SpectrumThemeProvider","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","log","module","ThemeContext","ThemeProvider","_ref","themes","children","baseThemes","selectedThemeKey","setSelectedThemeKey","_getThemePreloadData$","_getThemePreloadData","themeKey","activeThemes","base","custom","updateThemePreloadData","preloadStyleContent","debug2","active","map","theme","
|
|
1
|
+
{"version":3,"file":"ThemeProvider.js","names":["createContext","useEffect","useMemo","useState","Log","DEFAULT_DARK_THEME_KEY","calculatePreloadStyleContent","getActiveThemes","getDefaultBaseThemes","getThemePreloadData","setThemePreloadData","overrideSVGFillColors","SpectrumThemeProvider","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","log","module","ThemeContext","ThemeProvider","_ref","themes","customThemes","children","baseThemes","selectedThemeKey","setSelectedThemeKey","_getThemePreloadData$","_getThemePreloadData","themeKey","activeThemes","base","custom","updateThemePreloadData","preloadStyleContent","debug2","active","map","theme","value","Provider","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 overrideSVGFillColors,\n} from './ThemeUtils';\nimport { SpectrumThemeProvider } from './SpectrumThemeProvider';\nimport './theme-svg.scss';\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 children: ReactNode;\n}\n\nexport function ThemeProvider({\n themes: customThemes,\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 // Calculate active themes once a non-null themes array is provided.\n const activeThemes = useMemo(\n () =>\n customThemes == null\n ? null\n : getActiveThemes(selectedThemeKey, {\n base: baseThemes,\n custom: customThemes ?? [],\n }),\n [baseThemes, selectedThemeKey, customThemes]\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();\n\n const preloadStyleContent = calculatePreloadStyleContent();\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]\n );\n\n const value = useMemo(\n () => ({\n activeThemes,\n selectedThemeKey,\n themes,\n setSelectedThemeKey,\n }),\n [activeThemes, selectedThemeKey, themes]\n );\n\n return (\n <ThemeContext.Provider value={value}>\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 <SpectrumThemeProvider>{children}</SpectrumThemeProvider>\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,EACnBC,qBAAqB;AAAA,SAEdC,qBAAqB;AAAA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAU9B,IAAMC,GAAG,GAAGf,GAAG,CAACgB,MAAM,CAAC,eAAe,CAAC;AAEvC,OAAO,IAAMC,YAAY,gBAAGrB,aAAa,CAA2B,IAAI,CAAC;AAYzE,OAAO,SAASsB,aAAaA,CAAAC,IAAA,EAGO;EAAA,IAHN;IAC5BC,MAAM,EAAEC,YAAY;IACpBC;EACkB,CAAC,GAAAH,IAAA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,IAAIA,KAAK,CAACT,QAAQ,CAAC;MACjDK,mBAAmB;MACnBT;IACF,CAAC,CAAC;IAEFlB,mBAAmB,CAAC;MAClBsB,QAAQ,EAAEJ,gBAAgB;MAC1BS;IACF,CAAC,CAAC;EACJ,CAAC,EACD,CAACJ,YAAY,EAAEL,gBAAgB,EAAEH,YAAY,CAC/C,CAAC;EAED,IAAMiB,KAAK,GAAGxC,OAAO,CACnB,OAAO;IACL+B,YAAY;IACZL,gBAAgB;IAChBJ,MAAM;IACNK;EACF,CAAC,CAAC,EACF,CAACI,YAAY,EAAEL,gBAAgB,EAAEJ,MAAM,CACzC,CAAC;EAED,oBACEN,KAAA,CAACG,YAAY,CAACsB,QAAQ;IAACD,KAAK,EAAEA,KAAM;IAAAhB,QAAA,GACjCO,YAAY,IAAI,IAAI,GAAG,IAAI,gBAC1BnB,IAAA,CAAAE,SAAA;MAAAU,QAAA,EACGO,YAAY,CAACO,GAAG,CAACC,KAAK,iBACrB3B,IAAA;QAAO,kBAAgB2B,KAAK,CAACT,QAAS;QAAAN,QAAA,EACnCe,KAAK,CAACG;MAAY,GADuBH,KAAK,CAACT,QAE3C,CACR;IAAC,CACF,CACH,eACDlB,IAAA,CAACF,qBAAqB;MAAAc,QAAA,EAAEA;IAAQ,CAAwB,CAAC;EAAA,CACpC,CAAC;AAE5B;AAEA,eAAeJ,aAAa"}
|
|
@@ -76,8 +76,8 @@ export declare function replaceSVGFillColor(svgContent: string, fillColor: strin
|
|
|
76
76
|
/**
|
|
77
77
|
* Make a copy of the given object replacing any css variable expressions
|
|
78
78
|
* contained in its prop values with values resolved from the given HTML element.
|
|
79
|
-
* Variables that resolve to color strings will also be normalized to
|
|
80
|
-
*
|
|
79
|
+
* Variables that resolve to color strings will also be normalized to 8 digit
|
|
80
|
+
* hex values (or optionally 6 digit hex if `isAlphaOptional` is true).
|
|
81
81
|
*
|
|
82
82
|
* Note that the browser will force a reflow when calling `getComputedStyle` if
|
|
83
83
|
* css properties have changed. In order to avoid a reflow for every property
|
|
@@ -90,8 +90,10 @@ export declare function replaceSVGFillColor(svgContent: string, fillColor: strin
|
|
|
90
90
|
* @param record An object whose values may contain css var expressions
|
|
91
91
|
* @param targetElement The element to resolve css variables against. Defaults
|
|
92
92
|
* to document.body
|
|
93
|
+
* @param isAlphaOptional If true, the alpha value will be dropped from resolved
|
|
94
|
+
* 8 character hex colors if it is 'ff'. Defaults to false.
|
|
93
95
|
*/
|
|
94
|
-
export declare function resolveCssVariablesInRecord<T extends Record<string, string>>(record: T, targetElement?: HTMLElement): T;
|
|
96
|
+
export declare function resolveCssVariablesInRecord<T extends Record<string, string>>(record: T, targetElement?: HTMLElement, isAlphaOptional?: boolean): T;
|
|
95
97
|
/**
|
|
96
98
|
* Resolve css variable expressions in the given string using the
|
|
97
99
|
* given resolver and replace the original expressions with the resolved values.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeUtils.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ThemeUtils.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeUtils.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,SAAS,EACT,gBAAgB,EAChB,uBAAuB,EAEvB,qBAAqB,EAGrB,oBAAoB,EAErB,MAAM,cAAc,CAAC;AAItB,eAAO,MAAM,yBAAyB,WAAW,CAAC;AAClD,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAC5C,eAAO,MAAM,oBAAoB,QAAO,CAAC;AACzC,eAAO,MAAM,gBAAgB,QAAO,CAAC;AAErC,MAAM,MAAM,qBAAqB,GAAG,CAAC,aAAa,EAAE,MAAM,KAAK,MAAM,CAAC;AAEtE;;;;;GAKG;AACH,wBAAgB,4BAA4B,IAAI,uBAAuB,CAUtE;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,EAAE,EAAE,OAAO,GACV,CAAC,OAAO,EAAE,oBAAoB,KAAK,MAAM,CA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wBAAgB,qBAAqB,IAAI,IAAI,CAkB5C"}
|
package/dist/theme/ThemeUtils.js
CHANGED
|
@@ -1,20 +1,7 @@
|
|
|
1
1
|
import Log from '@deephaven/log';
|
|
2
2
|
import { assertNotNull, ColorUtils } from '@deephaven/utils';
|
|
3
|
-
// Note that ?inline imports are natively supported by Vite, but consumers of
|
|
4
|
-
// @deephaven/components using Webpack will need to add a rule to their module
|
|
5
|
-
// config.
|
|
6
|
-
// e.g.
|
|
7
|
-
// module: {
|
|
8
|
-
// rules: [
|
|
9
|
-
// {
|
|
10
|
-
// resourceQuery: /inline/,
|
|
11
|
-
// type: 'asset/source',
|
|
12
|
-
// },
|
|
13
|
-
// ],
|
|
14
|
-
// },
|
|
15
3
|
import { themeDark } from "./theme-dark/index.js";
|
|
16
|
-
import {
|
|
17
|
-
import { DEFAULT_DARK_THEME_KEY, DEFAULT_LIGHT_THEME_KEY, DEFAULT_PRELOAD_DATA_VARIABLES, THEME_CACHE_LOCAL_STORAGE_KEY, SVG_ICON_MANUAL_COLOR_MAP } from "./ThemeModel.js";
|
|
4
|
+
import { DEFAULT_DARK_THEME_KEY, DEFAULT_PRELOAD_DATA_VARIABLES, THEME_CACHE_LOCAL_STORAGE_KEY, SVG_ICON_MANUAL_COLOR_MAP } from "./ThemeModel.js";
|
|
18
5
|
var log = Log.module('ThemeUtils');
|
|
19
6
|
export var CSS_VAR_EXPRESSION_PREFIX = 'var(--';
|
|
20
7
|
export var TMP_CSS_PROP_PREFIX = 'dh-tmp';
|
|
@@ -104,11 +91,16 @@ export function getDefaultBaseThemes() {
|
|
|
104
91
|
name: 'Default Dark',
|
|
105
92
|
themeKey: DEFAULT_DARK_THEME_KEY,
|
|
106
93
|
styleContent: themeDark
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
94
|
+
}
|
|
95
|
+
// The ThemePicker shows whenever more than 1 theme is available. Disable
|
|
96
|
+
// light theme for now to keep the picker hidden until it is fully
|
|
97
|
+
// implemented by #1539.
|
|
98
|
+
// {
|
|
99
|
+
// name: 'Default Light',
|
|
100
|
+
// themeKey: DEFAULT_LIGHT_THEME_KEY,
|
|
101
|
+
// styleContent: themeLight,
|
|
102
|
+
// },
|
|
103
|
+
];
|
|
112
104
|
}
|
|
113
105
|
|
|
114
106
|
/**
|
|
@@ -190,8 +182,8 @@ export function replaceSVGFillColor(svgContent, fillColor) {
|
|
|
190
182
|
/**
|
|
191
183
|
* Make a copy of the given object replacing any css variable expressions
|
|
192
184
|
* contained in its prop values with values resolved from the given HTML element.
|
|
193
|
-
* Variables that resolve to color strings will also be normalized to
|
|
194
|
-
*
|
|
185
|
+
* Variables that resolve to color strings will also be normalized to 8 digit
|
|
186
|
+
* hex values (or optionally 6 digit hex if `isAlphaOptional` is true).
|
|
195
187
|
*
|
|
196
188
|
* Note that the browser will force a reflow when calling `getComputedStyle` if
|
|
197
189
|
* css properties have changed. In order to avoid a reflow for every property
|
|
@@ -204,9 +196,12 @@ export function replaceSVGFillColor(svgContent, fillColor) {
|
|
|
204
196
|
* @param record An object whose values may contain css var expressions
|
|
205
197
|
* @param targetElement The element to resolve css variables against. Defaults
|
|
206
198
|
* to document.body
|
|
199
|
+
* @param isAlphaOptional If true, the alpha value will be dropped from resolved
|
|
200
|
+
* 8 character hex colors if it is 'ff'. Defaults to false.
|
|
207
201
|
*/
|
|
208
202
|
export function resolveCssVariablesInRecord(record) {
|
|
209
203
|
var targetElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.body;
|
|
204
|
+
var isAlphaOptional = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
210
205
|
var perfStart = performance.now();
|
|
211
206
|
|
|
212
207
|
// Add a temporary div to attach temp css variables to
|
|
@@ -224,7 +219,7 @@ export function resolveCssVariablesInRecord(record) {
|
|
|
224
219
|
var resolver = varExpression => {
|
|
225
220
|
var tmpPropKey = "--".concat(TMP_CSS_PROP_PREFIX, "-").concat(varExpressions.indexOf(varExpression));
|
|
226
221
|
var resolved = computedStyle.getPropertyValue(tmpPropKey);
|
|
227
|
-
return ColorUtils.normalizeCssColor(resolved);
|
|
222
|
+
return ColorUtils.normalizeCssColor(resolved, isAlphaOptional);
|
|
228
223
|
};
|
|
229
224
|
|
|
230
225
|
// Resolve the temporary css variables
|
|
@@ -290,6 +285,7 @@ export function preloadTheme() {
|
|
|
290
285
|
var preloadStyleContent = (_getThemePreloadData$ = (_getThemePreloadData = getThemePreloadData()) === null || _getThemePreloadData === void 0 ? void 0 : _getThemePreloadData.preloadStyleContent) !== null && _getThemePreloadData$ !== void 0 ? _getThemePreloadData$ : calculatePreloadStyleContent();
|
|
291
286
|
log.debug('Preloading theme content:', "'".concat(preloadStyleContent, "'"));
|
|
292
287
|
var style = document.createElement('style');
|
|
288
|
+
style.id = 'theme-preload';
|
|
293
289
|
style.innerHTML = preloadStyleContent;
|
|
294
290
|
document.head.appendChild(style);
|
|
295
291
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeUtils.js","names":["Log","assertNotNull","ColorUtils","themeDark","themeLight","DEFAULT_DARK_THEME_KEY","DEFAULT_LIGHT_THEME_KEY","DEFAULT_PRELOAD_DATA_VARIABLES","THEME_CACHE_LOCAL_STORAGE_KEY","SVG_ICON_MANUAL_COLOR_MAP","log","module","CSS_VAR_EXPRESSION_PREFIX","TMP_CSS_PROP_PREFIX","NON_WHITESPACE_REGEX","WHITESPACE_REGEX","calculatePreloadStyleContent","resolveVar","createCssVariableResolver","document","body","pairs","Object","keys","map","key","concat","join","el","computedStyle","getComputedStyle","cssVariableResolver","varName","_DEFAULT_PRELOAD_DATA","value","getPropertyValue","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","getThemePreloadData","data","localStorage","getItem","JSON","parse","_unused","_NON_WHITESPACE_REGEX","_NON_WHITESPACE_REGEX2","ranges","exec","index","parenLevel","i","length","test","push","replaceSVGFillColor","svgContent","fillColor","replace","encodeURIComponent","resolveCssVariablesInRecord","targetElement","arguments","undefined","perfStart","performance","now","tmpPropEl","createElement","appendChild","varExpressions","varExpression","tmpPropKey","style","setProperty","result","window","resolver","indexOf","resolved","normalizeCssColor","entries","_ref2","resolveCssVariablesInString","remove","_ref3","setThemePreloadData","preloadData","setItem","stringify","getThemeKey","pluginName","themeName","preloadTheme","_getThemePreloadData$","_getThemePreloadData","preloadStyleContent","innerHTML","head","overrideSVGFillColors","_ref4","removeProperty","newSVGContent"],"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 CssVariableStyleContent,\n ThemePreloadColorVariable,\n ThemeRegistrationData,\n THEME_CACHE_LOCAL_STORAGE_KEY,\n SVG_ICON_MANUAL_COLOR_MAP,\n ThemeCssVariableName,\n ThemeIconsRequiringManualColorChanges,\n} from './ThemeModel';\n\nconst log = Log.module('ThemeUtils');\n\nexport const CSS_VAR_EXPRESSION_PREFIX = 'var(--';\nexport const TMP_CSS_PROP_PREFIX = 'dh-tmp';\nexport const NON_WHITESPACE_REGEX = /\\S/;\nexport const WHITESPACE_REGEX = /\\s/;\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 */\nexport function calculatePreloadStyleContent(): CssVariableStyleContent {\n const resolveVar = createCssVariableResolver(document.body);\n\n // Calculate the current preload variables. If the variable is not set, use\n // the default value.\n const pairs = Object.keys(DEFAULT_PRELOAD_DATA_VARIABLES).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 * DEFAULT_PRELOAD_DATA_VARIABLES for a default value, and if one does not exist,\n * return ''.\n * @param el Element to resolve css variables against\n */\nexport function createCssVariableResolver(\n el: Element\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 (\n DEFAULT_PRELOAD_DATA_VARIABLES[varName as ThemePreloadColorVariable] ?? ''\n );\n };\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 {\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 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 * 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 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 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 */\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\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 */\nexport function overrideSVGFillColors(): void {\n const resolveVar = createCssVariableResolver(document.body);\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,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,EAM9BC,6BAA6B,EAC7BC,yBAAyB;AAK3B,IAAMC,GAAG,GAAGV,GAAG,CAACW,MAAM,CAAC,YAAY,CAAC;AAEpC,OAAO,IAAMC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ACA;IACA3G,QAAQ,CAACC,IAAI,CAAC+E,KAAK,CAAC4B,cAAc,CAACtG,GAAG,CAAC;IAEvC,IAAMyD,UAAU,GAAGjE,UAAU,CAACQ,GAA4C,CAAC;IAC3E,IAAM0D,SAAS,GAAGlE,UAAU,CAACiB,KAAkC,CAAC;IAEhE,IAAM8F,aAAa,GAAG/C,mBAAmB,CAACC,UAAU,EAAEC,SAAS,CAAC;;IAEhE;IACA;IACAhE,QAAQ,CAACC,IAAI,CAAC+E,KAAK,CAACC,WAAW,CAAC3E,GAAG,EAAEuG,aAAa,CAAC;EACrD,CAAC,CAAC;AACJ"}
|
|
1
|
+
{"version":3,"file":"ThemeUtils.js","names":["Log","assertNotNull","ColorUtils","themeDark","DEFAULT_DARK_THEME_KEY","DEFAULT_PRELOAD_DATA_VARIABLES","THEME_CACHE_LOCAL_STORAGE_KEY","SVG_ICON_MANUAL_COLOR_MAP","log","module","CSS_VAR_EXPRESSION_PREFIX","TMP_CSS_PROP_PREFIX","NON_WHITESPACE_REGEX","WHITESPACE_REGEX","calculatePreloadStyleContent","resolveVar","createCssVariableResolver","document","body","pairs","Object","keys","map","key","concat","join","el","computedStyle","getComputedStyle","cssVariableResolver","varName","_DEFAULT_PRELOAD_DATA","value","getPropertyValue","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","getThemePreloadData","data","localStorage","getItem","JSON","parse","_unused","_NON_WHITESPACE_REGEX","_NON_WHITESPACE_REGEX2","ranges","exec","index","parenLevel","i","length","test","push","replaceSVGFillColor","svgContent","fillColor","replace","encodeURIComponent","resolveCssVariablesInRecord","targetElement","arguments","undefined","isAlphaOptional","perfStart","performance","now","tmpPropEl","createElement","appendChild","varExpressions","varExpression","tmpPropKey","style","setProperty","result","window","resolver","indexOf","resolved","normalizeCssColor","entries","_ref2","resolveCssVariablesInString","remove","_ref3","setThemePreloadData","preloadData","setItem","stringify","getThemeKey","pluginName","themeName","preloadTheme","_getThemePreloadData$","_getThemePreloadData","preloadStyleContent","id","innerHTML","head","overrideSVGFillColors","_ref4","removeProperty","newSVGContent"],"sources":["../../src/theme/ThemeUtils.ts"],"sourcesContent":["import Log from '@deephaven/log';\nimport { assertNotNull, ColorUtils } from '@deephaven/utils';\nimport { themeDark } from './theme-dark';\nimport {\n DEFAULT_DARK_THEME_KEY,\n DEFAULT_PRELOAD_DATA_VARIABLES,\n ThemeData,\n ThemePreloadData,\n CssVariableStyleContent,\n ThemePreloadColorVariable,\n ThemeRegistrationData,\n THEME_CACHE_LOCAL_STORAGE_KEY,\n SVG_ICON_MANUAL_COLOR_MAP,\n ThemeCssVariableName,\n ThemeIconsRequiringManualColorChanges,\n} from './ThemeModel';\n\nconst log = Log.module('ThemeUtils');\n\nexport const CSS_VAR_EXPRESSION_PREFIX = 'var(--';\nexport const TMP_CSS_PROP_PREFIX = 'dh-tmp';\nexport const NON_WHITESPACE_REGEX = /\\S/;\nexport const WHITESPACE_REGEX = /\\s/;\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 */\nexport function calculatePreloadStyleContent(): CssVariableStyleContent {\n const resolveVar = createCssVariableResolver(document.body);\n\n // Calculate the current preload variables. If the variable is not set, use\n // the default value.\n const pairs = Object.keys(DEFAULT_PRELOAD_DATA_VARIABLES).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 * DEFAULT_PRELOAD_DATA_VARIABLES for a default value, and if one does not exist,\n * return ''.\n * @param el Element to resolve css variables against\n */\nexport function createCssVariableResolver(\n el: Element\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 (\n DEFAULT_PRELOAD_DATA_VARIABLES[varName as ThemePreloadColorVariable] ?? ''\n );\n };\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 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 * 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 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, isAlphaOptional);\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 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 */\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.id = 'theme-preload';\n style.innerHTML = preloadStyleContent;\n document.head.appendChild(style);\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 */\nexport function overrideSVGFillColors(): void {\n const resolveVar = createCssVariableResolver(document.body);\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,SAASC,aAAa,EAAEC,UAAU,QAAQ,kBAAkB;AAAC,SACpDC,SAAS;AAAA,SAEhBC,sBAAsB,EACtBC,8BAA8B,EAM9BC,6BAA6B,EAC7BC,yBAAyB;AAK3B,IAAMC,GAAG,GAAGR,GAAG,CAACS,MAAM,CAAC,YAAY,CAAC;AAEpC,OAAO,IAAMC,yBAAyB,GAAG,QAAQ;AACjD,OAAO,IAAMC,mBAAmB,GAAG,QAAQ;AAC3C,OAAO,IAAMC,oBAAoB,GAAG,IAAI;AACxC,OAAO,IAAMC,gBAAgB,GAAG,IAAI;AAIpC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,4BAA4BA,CAAA,EAA4B;EACtE,IAAMC,UAAU,GAAGC,yBAAyB,CAACC,QAAQ,CAACC,IAAI,CAAC;;EAE3D;EACA;EACA,IAAMC,KAAK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AAGjD,mBAAmB,CAACC,UAAU,EAAEC,SAAS,CAAC;;IAEhE;IACA;IACAhE,QAAQ,CAACC,IAAI,CAACgF,KAAK,CAACC,WAAW,CAAC5E,GAAG,EAAEyG,aAAa,CAAC;EACrD,CAAC,CAAC;AACJ"}
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
package/dist/theme/index.js
CHANGED
package/dist/theme/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/theme/index.ts"],"sourcesContent":["export * from './theme-dark';\nexport * from './theme-light';\nexport * from './ThemeModel';\nexport * from './ThemeProvider';\nexport * from './ThemeUtils';\nexport * from './useTheme';\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/theme/index.ts"],"sourcesContent":["export * from './theme-dark';\nexport * from './theme-light';\nexport * from './ThemeModel';\nexport * from './ThemePicker';\nexport * from './ThemeProvider';\nexport * from './ThemeUtils';\nexport * from './useTheme';\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--dh-color-loading-spinner-primary: var(--dh-color-accent-
|
|
1
|
+
:root{--dh-color-loading-spinner-primary: var(--dh-color-accent-bg);--dh-color-loading-spinner-secondary: hsla(var(--dh-color-gray-800-hsl), 0.5);--dh-color-quickactions-bg: hsla(var(--dh-color-visual-gray-hsl), 0.9);--dh-color-radial-reaction: hsla(var(--dh-color-visual-gray-hsl), 0.6);--dh-color-colorpicker-border: hsla(var(--dh-color-visual-gray-hsl), 0.1);--dh-color-login-form-bg: var(--dh-color-gray-400);--dh-color-login-status-message: var(--dh-color-gray-600);--dh-color-login-logo-bg: var(--dh-color-gray-900);--dh-color-login-footer-fg: var(--dh-color-gray-700);--dh-color-random-area-plot-animation-fg-fill: hsla( var(--dh-color-accent-hsl), 0.08 );--dh-color-random-area-plot-animation-fg-stroke: hsla( var(--dh-color-accent-hsl), 0.2 );--dh-color-random-area-plot-animation-bg: var(--dh-color-gray-75);--dh-color-random-area-plot-animation-grid: var(--dh-color-gray-300);--dh-color-action-bg: hsl(var(--dh-color-action-hsl));--dh-color-action-fg: hsl(var(--dh-color-action-contrast-hsl));--dh-color-action-border: var(--dh-color-border);--dh-color-action-down-bg: var(--dh-color-gray-300);--dh-color-action-hover-bg: var(--dh-color-black);--dh-color-action-hover-fg: var(--dh-color-action-fg);--dh-color-action-hover-border: var(--dh-color-hover-border);--dh-color-action-active-bg: var(--dh-color-accent-bg);--dh-color-action-active-fg: var(--dh-color-accent-contrast);--dh-color-action-active-border: var(--dh-color-accent-bg);--dh-color-action-active-hover-bg: var(--dh-color-accent-hover-bg);--dh-color-action-active-hover-fg: var(--dh-color-accent-contrast);--dh-color-action-active-hover-border: var(--dh-color-accent-hover-bg);--dh-color-action-disabled-bg: transparent;--dh-color-action-disabled-fg: var(--dh-color-gray-700);--dh-color-action-disabled-border: var(--dh-color-black);--dh-color-input-bg: var(--dh-color-gray-500);--dh-color-input-fg: var(--dh-color-fg);--dh-color-input-disabled-bg: var(--dh-color-gray-300);--dh-color-input-border: var(--dh-color-gray-600);--dh-color-input-placeholder: var(--dh-color-gray-600);--dh-color-input-focus-border: hsla(var(--dh-color-accent-hsl), 0.85);--dh-color-search-icon: var(--dh-color-fg);--dh-color-form-control-error: hsl(var(--dh-color-visual-negative-hsl));--dh-color-form-control-error-shadow: hsla( var(--dh-color-visual-negative-hsl), 0.25 );--dh-color-selector-fg: hsla(var(--dh-color-gray-800-hsl), 0.4);--dh-color-selector-hover-fg: hsl(var(--dh-color-gray-800-hsl));--dh-color-selector-disabled-fg: hsla( var(--dh-color-gray-800-hsl), /* * Other dropdowns have opacity .4 when not hovered and then an additional * .65 opacity applied to disabled, hence .4 * .65 == .26 */ 0.26 );--dh-color-item-list-bg: transparent;--dh-color-item-list-active-bg: var(--dh-color-highlight-active);--dh-color-item-list-hover-bg: var(--dh-color-highlight-hover);--dh-color-item-list-selected-fg: var(--dh-color-white);--dh-color-item-list-selected-bg: var(--dh-color-highlight-selected);--dh-color-item-list-selected-hover-bg: var( --dh-color-highlight-selected-hover );--dh-color-item-list-selected-inactive-bg: var(--dh-color-gray-200);--dh-color-item-list-selected-border: hsla(var(--dh-color-accent-hsl), 0.6);--dh-color-item-list-drop-target-fg: var(--dh-color-white);--dh-color-item-list-keyboard-selected-bg: hsla( var(--dh-color-accent-hsl), 0.5 );--dh-color-menu-item-fg: var(--dh-color-gray-700);--dh-color-tooltip-bg: var(--dh-color-gray-400);--dh-color-tooltip-fg: var(--dh-color-fg);--dh-color-tooltip-box-shadow: hsla(var(--dh-color-black-hsl), 0.8);--dh-color-well-bg: hsla(var(--dh-color-visual-gray-hsl), 0.02);--dh-color-well-border: hsla(var(--dh-color-visual-gray-hsl), 0.05)}/*# sourceMappingURL=theme-dark-components.css.map */
|