@deephaven/components 0.91.1-beta.0 → 0.91.1-beta.2
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/ThemeModel.d.ts +1 -0
- package/dist/theme/ThemeModel.d.ts.map +1 -1
- package/dist/theme/ThemeModel.js +1 -0
- package/dist/theme/ThemeModel.js.map +1 -1
- package/dist/theme/ThemeProvider.d.ts.map +1 -1
- package/dist/theme/ThemeProvider.js +3 -6
- package/dist/theme/ThemeProvider.js.map +1 -1
- package/dist/theme/ThemeUtils.d.ts +14 -0
- package/dist/theme/ThemeUtils.d.ts.map +1 -1
- package/dist/theme/ThemeUtils.js +33 -11
- package/dist/theme/ThemeUtils.js.map +1 -1
- package/dist/transitions/FadeTransition.d.ts +2 -2
- package/dist/transitions/FadeTransition.d.ts.map +1 -1
- package/dist/transitions/FadeTransition.js +1 -1
- package/dist/transitions/FadeTransition.js.map +1 -1
- package/dist/transitions/SlideTransition.d.ts +2 -2
- package/dist/transitions/SlideTransition.d.ts.map +1 -1
- package/dist/transitions/SlideTransition.js +1 -1
- package/dist/transitions/SlideTransition.js.map +1 -1
- package/package.json +7 -7
|
@@ -6,6 +6,7 @@ export type ThemePreloadColorVariable = '--dh-color-accent-contrast' | '--dh-col
|
|
|
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";
|
|
9
|
+
export declare const THEME_KEY_OVERRIDE_QUERY_PARAM = "theme";
|
|
9
10
|
export declare const DEFAULT_DARK_THEME_PALETTE: {
|
|
10
11
|
readonly blue: {
|
|
11
12
|
readonly 500: "#2f5bc0";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeModel.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeModel.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,OAAO,CAAC;AAC7C,MAAM,MAAM,YAAY,GAAG,WAAW,aAAa,EAAE,CAAC;AACtD,MAAM,MAAM,uBAAuB,GAAG,SAAS,MAAM,EAAE,CAAC;AACxD,MAAM,MAAM,oBAAoB,GAAG,QAAQ,MAAM,EAAE,CAAC;AAOpD,MAAM,MAAM,yBAAyB,GACjC,4BAA4B,GAC5B,sBAAsB,GACtB,4BAA4B,GAC5B,2BAA2B,GAC3B,gCAAgC,GAChC,wBAAwB,GACxB,oCAAoC,GACpC,sCAAsC,GACtC,eAAe,GACf,eAAe,GACf,qBAAqB,GACrB,qBAAqB,GACrB,8BAA8B,GAC9B,yBAAyB,GACzB,8BAA8B,GAC9B,+BAA+B,GAC/B,2BAA2B,GAC3B,0BAA0B,GAC1B,iCAAiC,GACjC,0BAA0B,GAC1B,4BAA4B,GAC5B,+CAA+C,GAC/C,iDAAiD,GACjD,0CAA0C,GAC1C,4CAA4C,CAAC;AAEjD,MAAM,MAAM,qCAAqC,GAC7C,gCAAgC,GAChC,sCAAsC,GACtC,yCAAyC,GACzC,qBAAqB,CAAC;AAE1B,eAAO,MAAM,sBAAsB,iBAAwC,CAAC;AAC5E,eAAO,MAAM,uBAAuB,kBAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"ThemeModel.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeModel.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,OAAO,CAAC;AAC7C,MAAM,MAAM,YAAY,GAAG,WAAW,aAAa,EAAE,CAAC;AACtD,MAAM,MAAM,uBAAuB,GAAG,SAAS,MAAM,EAAE,CAAC;AACxD,MAAM,MAAM,oBAAoB,GAAG,QAAQ,MAAM,EAAE,CAAC;AAOpD,MAAM,MAAM,yBAAyB,GACjC,4BAA4B,GAC5B,sBAAs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
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
// codebase. To be addressed by #1679
|
|
6
6
|
export var DEFAULT_DARK_THEME_KEY = 'default-dark';
|
|
7
7
|
export var DEFAULT_LIGHT_THEME_KEY = 'default-light';
|
|
8
|
+
export var THEME_KEY_OVERRIDE_QUERY_PARAM = 'theme';
|
|
8
9
|
|
|
9
10
|
// Hex versions of some of the default dark theme color palette needed for
|
|
10
11
|
// preload defaults.
|
|
@@ -1 +1 @@
|
|
|
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\n// DHC should only need to preload variables that are required by the empty page\n// with loading spinner that shows while plugins are loading. The rest of the\n// preload variables defined here are required by DHE due to theme plugins\n// loading after login. We should consider moving most of these to the DHE\n// codebase. To be addressed by #1679\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 | '--dh-color-text-highlight'\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.\nexport const DEFAULT_DARK_THEME_PALETTE = {\n blue: {\n 500: '#2f5bc0',\n 400: '#254ba4',\n 600: '#3b6bda', // accent color\n 700: '#4c7dee',\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.\n// DHC should only need to preload variables that are required by the empty page\n// with loading spinner that shows while plugins are loading. The rest of the\n// preload variables defined here are required by DHE due to theme plugins\n// loading after login. We should consider moving most of these to the DHE\n// codebase. To be addressed by #1679\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 '--dh-color-text-highlight': `${DEFAULT_DARK_THEME_PALETTE.blue[700]}4d`, // 30% opacity\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":"AAKA;AACA;AACA;AACA;AACA;AAkCA,OAAO,IAAMA,sBAAsB,GAAG,cAAqC;AAC3E,OAAO,IAAMC,uBAAuB,GAAG,eAAsC;;
|
|
1
|
+
{"version":3,"file":"ThemeModel.js","names":["DEFAULT_DARK_THEME_KEY","DEFAULT_LIGHT_THEME_KEY","THEME_KEY_OVERRIDE_QUERY_PARAM","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\n// DHC should only need to preload variables that are required by the empty page\n// with loading spinner that shows while plugins are loading. The rest of the\n// preload variables defined here are required by DHE due to theme plugins\n// loading after login. We should consider moving most of these to the DHE\n// codebase. To be addressed by #1679\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 | '--dh-color-text-highlight'\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;\nexport const THEME_KEY_OVERRIDE_QUERY_PARAM = 'theme';\n\n// Hex versions of some of the default dark theme color palette needed for\n// preload defaults.\nexport const DEFAULT_DARK_THEME_PALETTE = {\n blue: {\n 500: '#2f5bc0',\n 400: '#254ba4',\n 600: '#3b6bda', // accent color\n 700: '#4c7dee',\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.\n// DHC should only need to preload variables that are required by the empty page\n// with loading spinner that shows while plugins are loading. The rest of the\n// preload variables defined here are required by DHE due to theme plugins\n// loading after login. We should consider moving most of these to the DHE\n// codebase. To be addressed by #1679\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 '--dh-color-text-highlight': `${DEFAULT_DARK_THEME_PALETTE.blue[700]}4d`, // 30% opacity\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":"AAKA;AACA;AACA;AACA;AACA;AAkCA,OAAO,IAAMA,sBAAsB,GAAG,cAAqC;AAC3E,OAAO,IAAMC,uBAAuB,GAAG,eAAsC;AAC7E,OAAO,IAAMC,8BAA8B,GAAG,OAAO;;AAErD;AACA;AACA,OAAO,IAAMC,0BAA0B,GAAG;EACxCC,IAAI,EAAE;IACJ,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IAAE;IAChB,GAAG,EAAE;EACP,CAAC;EACDC,GAAG,EAAE;IACH,GAAG,EAAE;EACP,CAAC;EACDC,IAAI,EAAE;IACJ,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,SAAS;IACb,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,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CAACC,IAAI,CAAC,GAAG,CAAC,OAAI;EAAE;EAC1E,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"}
|
|
@@ -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,
|
|
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,EAAkC,SAAS,EAAE,MAAM,cAAc,CAAC;AAUzE,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,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EAAE,YAAY,EACpB,oBAAqD,EACrD,QAAQ,GACT,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAkFzC;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createContext, useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import Log from '@deephaven/log';
|
|
3
|
-
import {
|
|
4
|
-
import { calculatePreloadStyleContent, getActiveThemes, getDefaultBaseThemes,
|
|
3
|
+
import { DEFAULT_PRELOAD_DATA_VARIABLES } from "./ThemeModel.js";
|
|
4
|
+
import { calculatePreloadStyleContent, getActiveThemes, getDefaultBaseThemes, setThemePreloadData, overrideSVGFillColors, getDefaultSelectedThemeKey } from "./ThemeUtils.js";
|
|
5
5
|
import { SpectrumThemeProvider } from "./SpectrumThemeProvider.js";
|
|
6
6
|
import "./theme-svg.css";
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -17,10 +17,7 @@ export function ThemeProvider(_ref) {
|
|
|
17
17
|
} = _ref;
|
|
18
18
|
var baseThemes = useMemo(() => getDefaultBaseThemes(), []);
|
|
19
19
|
var [value, setValue] = useState(null);
|
|
20
|
-
var [selectedThemeKey, setSelectedThemeKey] = useState(
|
|
21
|
-
var _getThemePreloadData$, _getThemePreloadData;
|
|
22
|
-
return (_getThemePreloadData$ = (_getThemePreloadData = getThemePreloadData()) === null || _getThemePreloadData === void 0 ? void 0 : _getThemePreloadData.themeKey) !== null && _getThemePreloadData$ !== void 0 ? _getThemePreloadData$ : DEFAULT_DARK_THEME_KEY;
|
|
23
|
-
});
|
|
20
|
+
var [selectedThemeKey, setSelectedThemeKey] = useState(getDefaultSelectedThemeKey);
|
|
24
21
|
|
|
25
22
|
// Calculate active themes once a non-null themes array is provided.
|
|
26
23
|
var activeThemes = useMemo(() => customThemes == null ? null : getActiveThemes(selectedThemeKey, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.js","names":["createContext","useEffect","useMemo","useState","Log","
|
|
1
|
+
{"version":3,"file":"ThemeProvider.js","names":["createContext","useEffect","useMemo","useState","Log","DEFAULT_PRELOAD_DATA_VARIABLES","calculatePreloadStyleContent","getActiveThemes","getDefaultBaseThemes","setThemePreloadData","overrideSVGFillColors","getDefaultSelectedThemeKey","SpectrumThemeProvider","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","log","module","ThemeContext","ThemeProvider","_ref","themes","customThemes","defaultPreloadValues","children","baseThemes","value","setValue","selectedThemeKey","setSelectedThemeKey","activeThemes","base","custom","updateThemePreloadData","preloadStyleContent","debug2","active","map","theme","themeKey","styleContent","Provider"],"sources":["../../src/theme/ThemeProvider.tsx"],"sourcesContent":["import { createContext, ReactNode, useEffect, useMemo, useState } from 'react';\nimport Log from '@deephaven/log';\nimport { DEFAULT_PRELOAD_DATA_VARIABLES, 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';\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: customThemes,\n defaultPreloadValues = DEFAULT_PRELOAD_DATA_VARIABLES,\n children,\n}: ThemeProviderProps): JSX.Element | null {\n const baseThemes = useMemo(() => getDefaultBaseThemes(), []);\n\n const [value, setValue] = useState<ThemeContextValue | null>(null);\n\n const [selectedThemeKey, setSelectedThemeKey] = useState<string>(\n getDefaultSelectedThemeKey\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(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,SAASA,aAAa,EAAaC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAC9E,OAAOC,GAAG,MAAM,gBAAgB;AAAC,SACxBC,8BAA8B;AAAA,SAErCC,4BAA4B,EAC5BC,eAAe,EACfC,oBAAoB,EACpBC,mBAAmB,EACnBC,qBAAqB,EACrBC,0BAA0B;AAAA,SAEnBC,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;AAazE,OAAO,SAASsB,aAAaA,CAAAC,IAAA,EAIc;EAAA,IAJb;IAC5BC,MAAM,EAAEC,YAAY;IACpBC,oBAAoB,GAAGrB,8BAA8B;IACrDsB;EACkB,CAAC,GAAAJ,IAAA;EACnB,IAAMK,UAAU,GAAG1B,OAAO,CAAC,MAAMM,oBAAoB,CAAC,CAAC,EAAE,EAAE,CAAC;EAE5D,IAAM,CAACqB,KAAK,EAAEC,QAAQ,CAAC,GAAG3B,QAAQ,CAA2B,IAAI,CAAC;EAElE,IAAM,CAAC4B,gBAAgB,EAAEC,mBAAmB,CAAC,GAAG7B,QAAQ,CACtDQ,0BACF,CAAC;;EAED;EACA,IAAMsB,YAAY,GAAG/B,OAAO,CAC1B,MACE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MAAM,CAAC,CAAC;EAE5C,oBACEN,KAAA,CAAAF,SAAA;IAAAW,QAAA,GACGM,YAAY,IAAI,IAAI,GAAG,IAAI,gBAC1BnB,IAAA,CAAAE,SAAA;MAAAW,QAAA,EACGM,YAAY,CAACO,GAAG,CAACC,KAAK,iBACrB3B,IAAA;QAAO,kBAAgB2B,KAAK,CAACC,QAAS;QAAAf,QAAA,EACnCc,KAAK,CAACE;MAAY,GADuBF,KAAK,CAACC,QAE3C,CACR;IAAC,CACF,CACH,EACAb,KAAK,IAAI,IAAI,GAAG,IAAI,gBACnBf,IAAA,CAACO,YAAY,CAACuB,QAAQ;MAACf,KAAK,EAAEA,KAAM;MAAAF,QAAA,eAClCb,IAAA,CAACF,qBAAqB;QAAAe,QAAA,EAAEA;MAAQ,CAAwB;IAAC,CACpC,CACxB;EAAA,CACD,CAAC;AAEP;AAEA,eAAeL,aAAa"}
|
|
@@ -42,6 +42,20 @@ export declare function getActiveThemes(themeKey: string, themeRegistration: The
|
|
|
42
42
|
* Get default base theme data.
|
|
43
43
|
*/
|
|
44
44
|
export declare function getDefaultBaseThemes(): ThemeData[];
|
|
45
|
+
/**
|
|
46
|
+
* Get the default selected theme key. Precedence is:
|
|
47
|
+
* 1. Theme key override query parameter
|
|
48
|
+
* 2. Theme key from preload data
|
|
49
|
+
* 3. Default dark theme key
|
|
50
|
+
* @returns The default selected theme key
|
|
51
|
+
*/
|
|
52
|
+
export declare function getDefaultSelectedThemeKey(): string;
|
|
53
|
+
/**
|
|
54
|
+
* A theme key override can be set via a query parameter to force a specific
|
|
55
|
+
* theme selection. Useful for embedded widget scenarios that don't expose the
|
|
56
|
+
* theme selector.
|
|
57
|
+
*/
|
|
58
|
+
export declare function getThemeKeyOverride(): string | null;
|
|
45
59
|
/**
|
|
46
60
|
* Get the preload data from local storage or null if it does not exist or is
|
|
47
61
|
* invalid
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeUtils.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeUtils.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,SAAS,EACT,gBAAgB,EAChB,uBAAuB,EAEvB,qBAAqB,EAGrB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"ThemeUtils.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeUtils.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,SAAS,EACT,gBAAgB,EAChB,uBAAuB,EAEvB,qBAAqB,EAGrB,oBAAoB,EAGrB,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;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAC1C,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC3C,uBAAuB,CAazB;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,EAAE,EAAE,OAAO,EACX,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACpC,CAAC,OAAO,EAAE,oBAAoB,KAAK,MAAM,CAgB3C;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,EAAE,EAAE,iBAAiB,MAAM,EAAE,EAC7B,mBAAmB,EAAE,uBAAuB,GAC3C,IAAI,CAKN;AAED;;;;GAIG;AACH,wBAAgB,qCAAqC,CACnD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,GAAG,CAAC,MAAM,CAAC,CAcb;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,iBAAiB,EAAE,qBAAqB,GACvC,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS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BN"}
|
package/dist/theme/ThemeUtils.js
CHANGED
|
@@ -2,7 +2,7 @@ import Log from '@deephaven/log';
|
|
|
2
2
|
import { assertNotNull, ColorUtils } from '@deephaven/utils';
|
|
3
3
|
import { themeDark } from "./theme-dark/index.js";
|
|
4
4
|
import { themeLight } from "./theme-light/index.js";
|
|
5
|
-
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";
|
|
5
|
+
import { 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 } from "./ThemeModel.js";
|
|
6
6
|
var log = Log.module('ThemeUtils');
|
|
7
7
|
export var CSS_VAR_EXPRESSION_PREFIX = 'var(--';
|
|
8
8
|
export var TMP_CSS_PROP_PREFIX = 'dh-tmp';
|
|
@@ -117,6 +117,28 @@ export function getDefaultBaseThemes() {
|
|
|
117
117
|
}];
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Get the default selected theme key. Precedence is:
|
|
122
|
+
* 1. Theme key override query parameter
|
|
123
|
+
* 2. Theme key from preload data
|
|
124
|
+
* 3. Default dark theme key
|
|
125
|
+
* @returns The default selected theme key
|
|
126
|
+
*/
|
|
127
|
+
export function getDefaultSelectedThemeKey() {
|
|
128
|
+
var _ref2, _getThemeKeyOverride, _getThemePreloadData;
|
|
129
|
+
return (_ref2 = (_getThemeKeyOverride = getThemeKeyOverride()) !== null && _getThemeKeyOverride !== void 0 ? _getThemeKeyOverride : (_getThemePreloadData = getThemePreloadData()) === null || _getThemePreloadData === void 0 ? void 0 : _getThemePreloadData.themeKey) !== null && _ref2 !== void 0 ? _ref2 : DEFAULT_DARK_THEME_KEY;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* A theme key override can be set via a query parameter to force a specific
|
|
134
|
+
* theme selection. Useful for embedded widget scenarios that don't expose the
|
|
135
|
+
* theme selector.
|
|
136
|
+
*/
|
|
137
|
+
export function getThemeKeyOverride() {
|
|
138
|
+
var searchParams = new URLSearchParams(window.location.search);
|
|
139
|
+
return searchParams.get(THEME_KEY_OVERRIDE_QUERY_PARAM);
|
|
140
|
+
}
|
|
141
|
+
|
|
120
142
|
/**
|
|
121
143
|
* Get the preload data from local storage or null if it does not exist or is
|
|
122
144
|
* invalid
|
|
@@ -222,8 +244,8 @@ export function resolveCssVariablesInRecord(record) {
|
|
|
222
244
|
var tmpPropEl = document.createElement('div');
|
|
223
245
|
tmpPropEl.style.display = 'none';
|
|
224
246
|
var recordArray = Object.entries(record);
|
|
225
|
-
recordArray.forEach((
|
|
226
|
-
var [, value] =
|
|
247
|
+
recordArray.forEach((_ref3, i) => {
|
|
248
|
+
var [, value] = _ref3;
|
|
227
249
|
tmpPropEl.style.setProperty("--".concat(TMP_CSS_PROP_PREFIX, "-").concat(i), value);
|
|
228
250
|
// faster to create these now all at once, even if we don't use them all
|
|
229
251
|
// since the parent isn't added yet to the DOM
|
|
@@ -238,8 +260,8 @@ export function resolveCssVariablesInRecord(record) {
|
|
|
238
260
|
targetElement.appendChild(tmpPropEl);
|
|
239
261
|
var tempPropElComputedStyle = window.getComputedStyle(tmpPropEl);
|
|
240
262
|
var result = {};
|
|
241
|
-
recordArray.forEach((
|
|
242
|
-
var [key, value] =
|
|
263
|
+
recordArray.forEach((_ref4, i) => {
|
|
264
|
+
var [key, value] = _ref4;
|
|
243
265
|
// resolves any variables in the expression
|
|
244
266
|
var resolved = tempPropElComputedStyle.getPropertyValue("--".concat(TMP_CSS_PROP_PREFIX, "-").concat(i));
|
|
245
267
|
var containsCssVar = value.includes(CSS_VAR_EXPRESSION_PREFIX);
|
|
@@ -275,8 +297,8 @@ export function resolveCssVariablesInRecord(record) {
|
|
|
275
297
|
export function resolveCssVariablesInString(resolver, value) {
|
|
276
298
|
var result = [];
|
|
277
299
|
var i = 0;
|
|
278
|
-
getExpressionRanges(value).forEach(
|
|
279
|
-
var [start, end] =
|
|
300
|
+
getExpressionRanges(value).forEach(_ref5 => {
|
|
301
|
+
var [start, end] = _ref5;
|
|
280
302
|
if (i < start) {
|
|
281
303
|
result.push(value.substring(i, start));
|
|
282
304
|
i += start - i;
|
|
@@ -313,9 +335,9 @@ export function getThemeKey(pluginName, themeName) {
|
|
|
313
335
|
* @defaultPreloadValues Optional default values to use if a preload variable is not set.
|
|
314
336
|
*/
|
|
315
337
|
export function preloadTheme() {
|
|
316
|
-
var
|
|
338
|
+
var _getThemePreloadData2;
|
|
317
339
|
var defaultPreloadValues = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_PRELOAD_DATA_VARIABLES;
|
|
318
|
-
var previousPreloadStyleContent = (
|
|
340
|
+
var previousPreloadStyleContent = (_getThemePreloadData2 = getThemePreloadData()) === null || _getThemePreloadData2 === void 0 ? void 0 : _getThemePreloadData2.preloadStyleContent;
|
|
319
341
|
var defaultPreloadStyleContent = calculatePreloadStyleContent(defaultPreloadValues);
|
|
320
342
|
log.debug('Preloading theme content:', {
|
|
321
343
|
defaultPreloadStyleContent,
|
|
@@ -348,8 +370,8 @@ export function preloadTheme() {
|
|
|
348
370
|
*/
|
|
349
371
|
export function overrideSVGFillColors(defaultValues) {
|
|
350
372
|
var resolveVar = createCssVariableResolver(document.body, defaultValues);
|
|
351
|
-
Object.entries(SVG_ICON_MANUAL_COLOR_MAP).forEach(
|
|
352
|
-
var [key, value] =
|
|
373
|
+
Object.entries(SVG_ICON_MANUAL_COLOR_MAP).forEach(_ref6 => {
|
|
374
|
+
var [key, value] = _ref6;
|
|
353
375
|
// Clear any previous override so that our variables get resolved against the
|
|
354
376
|
// actual svg content provided by the active themes and not from a previous
|
|
355
377
|
// override
|
|
@@ -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","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","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","display","recordArray","entries","_ref2","setProperty","backgroundColor","tempPropElComputedStyle","window","result","_ref3","resolved","containsCssVar","isColor","CSS","supports","children","color","normalizeCssColor","remove","resolveCssVariablesInString","resolver","_ref4","setThemePreloadData","preloadData","setItem","stringify","getThemeKey","pluginName","themeName","preloadTheme","_getThemePreloadData","previousPreloadStyleContent","defaultPreloadStyleContent","overrideSVGFillColors","_ref5","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 { 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 * @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 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 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 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,SAASC,aAAa,EAAEC,UAAU,QAAQ,kBAAkB;AAAC,SACpDC,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,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;AACA,OAAO,SAASC,4BAA4BA,CAC1CC,oBAA4C,EACnB;EACzB,IAAMC,UAAU,GAAGC,yBAAyB,CAC1CC,QAAQ,CAACC,IAAI,EACbJ,oBACF,CAAC;;EAED;EACA;EACA,IAAMK,KAAK,GAAGC,MAAM,CAACC,IAAI,CAACP,oBAAoB,CAAC,CAACQ,GAAG,CACjDC,GAAG,OAAAC,MAAA,CAAOD,GAAG,OAAAC,MAAA,CAAIT,UAAU,CAACQ,GAAgC,CAAC,CAC/D,CAAC;EAED,gBAAAC,MAAA,CAAgBL,KAAK,CAACM,IAAI,CAAC,GAAG,CAAC;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAST,yBAAyBA,CACvCU,EAAW,EACXC,aAAqC,EACM;EAC3C,IAAMC,aAAa,GAAGC,gBAAgB,CAACH,EAAE,CAAC;;EAE1C;AACF;AACA;AACA;EACE,OAAO,SAASI,mBAAmBA,CAACC,OAA6B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wB,EACxBkG,2BACF,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,qBAAqBA,CACnC5G,aAAqC,EAC/B;EACN,IAAMZ,UAAU,GAAGC,yBAAyB,CAACC,QAAQ,CAACC,IAAI,EAAES,aAAa,CAAC;EAE1EP,MAAM,CAACoF,OAAO,CAAClG,yBAAyB,CAAC,CAAC0C,OAAO,CAACwF,KAAA,IAAkB;IAAA,IAAjB,CAACjH,GAAG,EAAEU,KAAK,CAAC,GAAAuG,KAAA;IAC7D;IACA;IACA;IACAvH,QAAQ,CAACC,IAAI,CAACoB,KAAK,CAACmG,cAAc,CAAClH,GAAG,CAAC;IAEvC,IAAMkE,UAAU,GAAG1E,UAAU,CAACQ,GAA4C,CAAC;IAC3E,IAAMmE,SAAS,GAAG3E,UAAU,CAACkB,KAAkC,CAAC;IAEhE,IAAMyG,aAAa,GAAGlD,mBAAmB,CAACC,UAAU,EAAEC,SAAS,CAAC;;IAEhE;IACA;IACAzE,QAAQ,CAACC,IAAI,CAACoB,KAAK,CAACoE,WAAW,CAACnF,GAAG,EAAEmH,aAAa,CAAC;EACrD,CAAC,CAAC;AACJ"}
|
|
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","THEME_KEY_OVERRIDE_QUERY_PARAM","log","module","CSS_VAR_EXPRESSION_PREFIX","TMP_CSS_PROP_PREFIX","NON_WHITESPACE_REGEX","WHITESPACE_REGEX","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","replaceSVGFillColor","svgContent","fillColor","replace","encodeURIComponent","resolveCssVariablesInRecord","targetElement","arguments","undefined","isAlphaOptional","perfStart","performance","now","tmpPropEl","display","recordArray","entries","_ref3","setProperty","backgroundColor","tempPropElComputedStyle","result","_ref4","resolved","containsCssVar","isColor","CSS","supports","children","color","normalizeCssColor","remove","resolveCssVariablesInString","resolver","_ref5","setThemePreloadData","preloadData","setItem","stringify","getThemeKey","pluginName","themeName","preloadTheme","_getThemePreloadData2","previousPreloadStyleContent","defaultPreloadStyleContent","overrideSVGFillColors","_ref6","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 { 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 THEME_KEY_OVERRIDE_QUERY_PARAM,\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 * @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 * 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 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,SAASC,aAAa,EAAEC,UAAU,QAAQ,kBAAkB;AAAC,SACpDC,SAAS;AAAA,SACTC,UAAU;AAAA,SAEjBC,sBAAsB,EACtBC,uBAAuB,EACvBC,8BAA8B,EAM9BC,6BAA6B,EAC7BC,yBAAyB,EAGzBC,8BAA8B;AAGhC,IAAMC,GAAG,GAAGX,GAAG,CAACY,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;AACA,OAAO,SAASC,4BAA4BA,CAC1CC,oBAA4C,EACnB;EACzB,IAAMC,UAAU,GAAGC,yBAAyB,CAC1CC,QAAQ,CAACC,IAAI,EACbJ,oBACF,CAAC;;EAED;EACA;EACA,IAAMK,KAAK,GAAGC,MAAM,CAACC,IAAI,CAACP,oBAAoB,CAAC,CAACQ,GAAG,CACjDC,GAAG,OAAAC,MAAA,CAAOD,GAAG,OAAAC,MAAA,CAAIT,UAAU,CAACQ,GAAgC,CAAC,CAC/D,CAAC;EAED,gBAAAC,MAAA,CAAgBL,KAAK,CAACM,IAAI,CAAC,GAAG,CAAC;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAST,yBAAyBA,CACvCU,EAAW,EACXC,aAAqC,EACM;EAC3C,IAAMC,aAAa,GAAGC,gB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CAACkB,KAAkC,CAAC;IAEhE,IAAMmH,aAAa,GAAGjD,mBAAmB,CAACC,UAAU,EAAEC,SAAS,CAAC;;IAEhE;IACA;IACApF,QAAQ,CAACC,IAAI,CAACoB,KAAK,CAAC+E,WAAW,CAAC9F,GAAG,EAAE6H,aAAa,CAAC;EACrD,CAAC,CAAC;AACJ"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { CSSTransitionProps } from 'react-transition-group/CSSTransition';
|
|
3
|
-
import { EndHandler } from 'react-transition-group/Transition';
|
|
2
|
+
import type { CSSTransitionProps } from 'react-transition-group/CSSTransition';
|
|
3
|
+
import type { EndHandler } from 'react-transition-group/Transition';
|
|
4
4
|
type FadeTransitionProps<Ref extends undefined | HTMLElement = undefined> = Omit<CSSTransitionProps<Ref>, 'addEndHandler'> & {
|
|
5
5
|
addEndHandler?: EndHandler<Ref> | undefined;
|
|
6
6
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FadeTransition.d.ts","sourceRoot":"","sources":["../../src/transitions/FadeTransition.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"FadeTransition.d.ts","sourceRoot":"","sources":["../../src/transitions/FadeTransition.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAIpE,KAAK,mBAAmB,CAAC,GAAG,SAAS,SAAS,GAAG,WAAW,GAAG,SAAS,IAItE,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,eAAe,CAAC,GAAG;IAC/C,aAAa,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;CAC7C,CAAC;AAEJ;;GAEG;AACH,iBAAS,cAAc,CAAC,GAAG,SAAS,SAAS,GAAG,WAAW,GAAG,SAAS,EAAE,EACvE,SAAS,EACT,OAAkC,EAClC,GAAG,KAAK,EACT,EAAE,mBAAmB,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,OAAO,CASxC;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -6,7 +6,7 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
|
|
|
6
6
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
7
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
8
8
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
9
|
-
import CSSTransition from 'react-transition-group
|
|
9
|
+
import { CSSTransition } from 'react-transition-group';
|
|
10
10
|
import classNames from 'classnames';
|
|
11
11
|
import ThemeExport from "../ThemeExport.js";
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FadeTransition.js","names":["CSSTransition","classNames","ThemeExport","jsx","_jsx","FadeTransition","_ref","className","timeout","transitionMs","props","_objectWithoutProperties","_excluded","_objectSpread"],"sources":["../../src/transitions/FadeTransition.tsx"],"sourcesContent":["import CSSTransition
|
|
1
|
+
{"version":3,"file":"FadeTransition.js","names":["CSSTransition","classNames","ThemeExport","jsx","_jsx","FadeTransition","_ref","className","timeout","transitionMs","props","_objectWithoutProperties","_excluded","_objectSpread"],"sources":["../../src/transitions/FadeTransition.tsx"],"sourcesContent":["import { CSSTransition } from 'react-transition-group';\nimport type { CSSTransitionProps } from 'react-transition-group/CSSTransition';\nimport type { EndHandler } from 'react-transition-group/Transition';\nimport classNames from 'classnames';\nimport ThemeExport from '../ThemeExport';\n\ntype FadeTransitionProps<Ref extends undefined | HTMLElement = undefined> =\n // We default the timeout, so user doesn't need to provide it\n // However, CSSTransitionProps get confused if you don't provide a timeout, it requires an endHandler\n // We're just making the endHandler optional here, as the timeout has a default\n Omit<CSSTransitionProps<Ref>, 'addEndHandler'> & {\n addEndHandler?: EndHandler<Ref> | undefined;\n };\n\n/**\n * Fade between two components. Defaults to 150ms transition.\n */\nfunction FadeTransition<Ref extends undefined | HTMLElement = undefined>({\n className,\n timeout = ThemeExport.transitionMs,\n ...props\n}: FadeTransitionProps<Ref>): JSX.Element {\n return (\n <CSSTransition\n timeout={timeout}\n classNames={classNames('fade', className)}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...props}\n />\n );\n}\n\nexport default FadeTransition;\n"],"mappings":";;;;;;;;AAAA,SAASA,aAAa,QAAQ,wBAAwB;AAGtD,OAAOC,UAAU,MAAM,YAAY;AAAC,OAC7BC,WAAW;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAUlB;AACA;AACA;AACA,SAASC,cAAcA,CAAAC,IAAA,EAImB;EAAA,IAJ+B;MACvEC,SAAS;MACTC,OAAO,GAAGN,WAAW,CAACO;IAEE,CAAC,GAAAH,IAAA;IADtBI,KAAK,GAAAC,wBAAA,CAAAL,IAAA,EAAAM,SAAA;EAER,oBACER,IAAA,CAACJ,aAAa,EAAAa,aAAA;IACZL,OAAO,EAAEA,OAAQ;IACjBP,UAAU,EAAEA,UAAU,CAAC,MAAM,EAAEM,SAAS;IACxC;EAAA,GACIG,KAAK,CACV,CAAC;AAEN;AAEA,eAAeL,cAAc"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { CSSTransitionProps } from 'react-transition-group/CSSTransition';
|
|
3
|
-
import { EndHandler } from 'react-transition-group/Transition';
|
|
2
|
+
import type { CSSTransitionProps } from 'react-transition-group/CSSTransition';
|
|
3
|
+
import type { EndHandler } from 'react-transition-group/Transition';
|
|
4
4
|
type SlideDirection = 'left' | 'right';
|
|
5
5
|
type SlideTransitionProps<Ref extends undefined | HTMLElement = undefined> = Omit<CSSTransitionProps<Ref>, 'addEndHandler'> & {
|
|
6
6
|
addEndHandler?: EndHandler<Ref> | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlideTransition.d.ts","sourceRoot":"","sources":["../../src/transitions/SlideTransition.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"SlideTransition.d.ts","sourceRoot":"","sources":["../../src/transitions/SlideTransition.tsx"],"names":[],"mappings":";AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAKpE,KAAK,cAAc,GAAG,MAAM,GAAG,OAAO,CAAC;AAEvC,KAAK,oBAAoB,CAAC,GAAG,SAAS,SAAS,GAAG,WAAW,GAAG,SAAS,IAIvE,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,eAAe,CAAC,GAAG;IAC/C,aAAa,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;CAC7C,GAAG;IACF;;OAEG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAE3B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEJ;;;;GAIG;AACH,iBAAS,eAAe,CAAC,EACvB,SAAkB,EAClB,SAAS;AAET,sBAAsB;AACtB,OAAqC,EACrC,GAAG,KAAK,EACT,EAAE,oBAAoB,GAAG,GAAG,CAAC,OAAO,CASpC;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -8,7 +8,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
8
8
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
9
9
|
// SlideTransition class uses CSSTransition with slide-left and slide-right classNames, depending on the prop direction. The transition is 250ms long.
|
|
10
10
|
//
|
|
11
|
-
import CSSTransition from 'react-transition-group
|
|
11
|
+
import { CSSTransition } from 'react-transition-group';
|
|
12
12
|
import classNames from 'classnames';
|
|
13
13
|
import ThemeExport from "../ThemeExport.js";
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlideTransition.js","names":["CSSTransition","classNames","ThemeExport","jsx","_jsx","SlideTransition","_ref","direction","className","timeout","transitionMidMs","props","_objectWithoutProperties","_excluded","_objectSpread","concat"],"sources":["../../src/transitions/SlideTransition.tsx"],"sourcesContent":["// SlideTransition class uses CSSTransition with slide-left and slide-right classNames, depending on the prop direction. The transition is 250ms long.\n//\nimport CSSTransition
|
|
1
|
+
{"version":3,"file":"SlideTransition.js","names":["CSSTransition","classNames","ThemeExport","jsx","_jsx","SlideTransition","_ref","direction","className","timeout","transitionMidMs","props","_objectWithoutProperties","_excluded","_objectSpread","concat"],"sources":["../../src/transitions/SlideTransition.tsx"],"sourcesContent":["// SlideTransition class uses CSSTransition with slide-left and slide-right classNames, depending on the prop direction. The transition is 250ms long.\n//\nimport { CSSTransition } from 'react-transition-group';\nimport type { CSSTransitionProps } from 'react-transition-group/CSSTransition';\nimport type { EndHandler } from 'react-transition-group/Transition';\n\nimport classNames from 'classnames';\nimport ThemeExport from '../ThemeExport';\n\ntype SlideDirection = 'left' | 'right';\n\ntype SlideTransitionProps<Ref extends undefined | HTMLElement = undefined> =\n // We default the timeout, so user doesn't need to provide it\n // However, CSSTransitionProps get confused if you don't provide a timeout, it requires an endHandler\n // We're just making the endHandler optional here, as the timeout has a default\n Omit<CSSTransitionProps<Ref>, 'addEndHandler'> & {\n addEndHandler?: EndHandler<Ref> | undefined;\n } & {\n /**\n * The direction of the slide transition. Defaults to left.\n */\n direction?: SlideDirection;\n\n timeout?: number;\n };\n\n/**\n * Slides one component overtop of another component.\n * Defaults to sliding left, unless `direction='right'` is provided.\n * Timeout defaults to 200ms.\n */\nfunction SlideTransition({\n direction = 'left',\n className,\n\n /** Defaults to mid */\n timeout = ThemeExport.transitionMidMs,\n ...props\n}: SlideTransitionProps): JSX.Element {\n return (\n <CSSTransition\n timeout={timeout}\n classNames={classNames(`slide-${direction}`, className)}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...props}\n />\n );\n}\n\nexport default SlideTransition;\n"],"mappings":";;;;;;;;AAAA;AACA;AACA,SAASA,aAAa,QAAQ,wBAAwB;AAItD,OAAOC,UAAU,MAAM,YAAY;AAAC,OAC7BC,WAAW;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAmBlB;AACA;AACA;AACA;AACA;AACA,SAASC,eAAeA,CAAAC,IAAA,EAOc;EAAA,IAPb;MACvBC,SAAS,GAAG,MAAM;MAClBC,SAAS;MAET;MACAC,OAAO,GAAGP,WAAW,CAACQ;IAEF,CAAC,GAAAJ,IAAA;IADlBK,KAAK,GAAAC,wBAAA,CAAAN,IAAA,EAAAO,SAAA;EAER,oBACET,IAAA,CAACJ,aAAa,EAAAc,aAAA;IACZL,OAAO,EAAEA,OAAQ;IACjBR,UAAU,EAAEA,UAAU,UAAAc,MAAA,CAAUR,SAAS,GAAIC,SAAS;IACtD;EAAA,GACIG,KAAK,CACV,CAAC;AAEN;AAEA,eAAeN,eAAe"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deephaven/components",
|
|
3
|
-
"version": "0.91.1-beta.
|
|
3
|
+
"version": "0.91.1-beta.2+dcc95f69",
|
|
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.35.1",
|
|
28
|
-
"@deephaven/icons": "^0.91.1-beta.
|
|
29
|
-
"@deephaven/log": "^0.91.1-beta.
|
|
30
|
-
"@deephaven/react-hooks": "^0.91.1-beta.
|
|
31
|
-
"@deephaven/utils": "^0.91.1-beta.
|
|
28
|
+
"@deephaven/icons": "^0.91.1-beta.2+dcc95f69",
|
|
29
|
+
"@deephaven/log": "^0.91.1-beta.2+dcc95f69",
|
|
30
|
+
"@deephaven/react-hooks": "^0.91.1-beta.2+dcc95f69",
|
|
31
|
+
"@deephaven/utils": "^0.91.1-beta.2+dcc95f69",
|
|
32
32
|
"@fortawesome/fontawesome-svg-core": "^6.2.1",
|
|
33
33
|
"@fortawesome/react-fontawesome": "^0.2.0",
|
|
34
34
|
"@internationalized/date": "^3.5.5",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"react-is": ">=16.8.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@deephaven/mocks": "^0.91.1-beta.
|
|
61
|
+
"@deephaven/mocks": "^0.91.1-beta.2+dcc95f69",
|
|
62
62
|
"react-redux": "^7.2.4"
|
|
63
63
|
},
|
|
64
64
|
"files": [
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"publishConfig": {
|
|
74
74
|
"access": "public"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "dcc95f69ff3a94a0558093ed699f8147096b2556"
|
|
77
77
|
}
|