@deephaven/components 0.50.1-beta.5 → 0.51.1-alpha-theme-fix.1
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/AutoCompleteInput.d.ts +2 -2
- package/dist/AutoCompleteInput.d.ts.map +1 -1
- package/dist/AutoCompleteInput.js.map +1 -1
- package/dist/AutoResizeTextarea.js.map +1 -1
- package/dist/BasicModal.js.map +1 -1
- package/dist/BulkActionBar.js.map +1 -1
- package/dist/Button.js.map +1 -1
- package/dist/ButtonGroup.js.map +1 -1
- package/dist/ButtonOld.js.map +1 -1
- package/dist/CardFlip.js.map +1 -1
- package/dist/Checkbox.js.map +1 -1
- package/dist/Collapse.js.map +1 -1
- package/dist/ComboBox.d.ts +2 -2
- package/dist/ComboBox.d.ts.map +1 -1
- package/dist/ComboBox.js.map +1 -1
- package/dist/CopyButton.js.map +1 -1
- package/dist/CustomTimeSelect.d.ts +3 -3
- package/dist/CustomTimeSelect.d.ts.map +1 -1
- package/dist/CustomTimeSelect.js.map +1 -1
- package/dist/DateInput.d.ts +3 -3
- package/dist/DateInput.d.ts.map +1 -1
- package/dist/DateInput.js.map +1 -1
- package/dist/DateInputUtils.js.map +1 -1
- package/dist/DateTimeInput.d.ts +4 -4
- package/dist/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput.js.map +1 -1
- package/dist/DateTimeInputUtils.js.map +1 -1
- package/dist/DebouncedSearchInput.d.ts +1 -1
- package/dist/DebouncedSearchInput.d.ts.map +1 -1
- package/dist/DebouncedSearchInput.js.map +1 -1
- package/dist/DragUtils.d.ts +3 -3
- package/dist/DragUtils.d.ts.map +1 -1
- package/dist/DragUtils.js.map +1 -1
- package/dist/DraggableItemList.d.ts +1 -1
- package/dist/DraggableItemList.d.ts.map +1 -1
- package/dist/DraggableItemList.js.map +1 -1
- package/dist/EditableItemList.js.map +1 -1
- package/dist/HierarchicalCheckboxMenu.d.ts +1 -1
- package/dist/HierarchicalCheckboxMenu.d.ts.map +1 -1
- package/dist/HierarchicalCheckboxMenu.js.map +1 -1
- package/dist/ItemList.d.ts +4 -4
- package/dist/ItemList.d.ts.map +1 -1
- package/dist/ItemList.js +6 -6
- package/dist/ItemList.js.map +1 -1
- package/dist/ItemListItem.d.ts +13 -13
- package/dist/ItemListItem.d.ts.map +1 -1
- package/dist/ItemListItem.js.map +1 -1
- package/dist/LoadingOverlay.js.map +1 -1
- package/dist/LoadingSpinner.js.map +1 -1
- package/dist/MaskedInput.d.ts +5 -5
- package/dist/MaskedInput.d.ts.map +1 -1
- package/dist/MaskedInput.js.map +1 -1
- package/dist/MaskedInputUtils.js.map +1 -1
- package/dist/Option.js.map +1 -1
- package/dist/RadioGroup.js.map +1 -1
- package/dist/RadioItem.js.map +1 -1
- package/dist/RandomAreaPlotAnimation.js.map +1 -1
- package/dist/SearchInput.js.map +1 -1
- package/dist/SearchableCombobox.js.map +1 -1
- package/dist/Select.js.map +1 -1
- package/dist/SelectValueList.d.ts +2 -2
- package/dist/SelectValueList.d.ts.map +1 -1
- package/dist/SelectValueList.js.map +1 -1
- package/dist/SocketedButton.js.map +1 -1
- package/dist/SpectrumUtils.d.ts.map +1 -1
- package/dist/SpectrumUtils.js +3 -4
- package/dist/SpectrumUtils.js.map +1 -1
- package/dist/TableViewEmptyState.js.map +1 -1
- package/dist/TextWithTooltip.js.map +1 -1
- package/dist/ThemeExport.js.map +1 -1
- package/dist/TimeInput.d.ts +4 -4
- package/dist/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput.js.map +1 -1
- package/dist/TimeSlider.d.ts +2 -2
- package/dist/TimeSlider.d.ts.map +1 -1
- package/dist/TimeSlider.js.map +1 -1
- package/dist/ToastNotification.js.map +1 -1
- package/dist/UISwitch.js.map +1 -1
- package/dist/ValidateLabelInput.js.map +1 -1
- package/dist/actions/ConfirmActionButton.js.map +1 -1
- package/dist/actions/IconActionButton.js.map +1 -1
- package/dist/context-actions/ContextActionUtils.d.ts +1 -1
- package/dist/context-actions/ContextActionUtils.d.ts.map +1 -1
- package/dist/context-actions/ContextActionUtils.js +6 -4
- package/dist/context-actions/ContextActionUtils.js.map +1 -1
- package/dist/context-actions/ContextActions.js.map +1 -1
- package/dist/context-actions/ContextMenu.d.ts +4 -4
- package/dist/context-actions/ContextMenu.d.ts.map +1 -1
- package/dist/context-actions/ContextMenu.js +1 -1
- package/dist/context-actions/ContextMenu.js.map +1 -1
- package/dist/context-actions/ContextMenuItem.d.ts +4 -4
- package/dist/context-actions/ContextMenuItem.d.ts.map +1 -1
- package/dist/context-actions/ContextMenuItem.js.map +1 -1
- package/dist/context-actions/ContextMenuRoot.js.map +1 -1
- package/dist/context-actions/GlobalContextAction.js.map +1 -1
- package/dist/context-actions/GlobalContextActions.js.map +1 -1
- package/dist/declaration.d.js.map +1 -1
- package/dist/dialogs/ActionButtonDialogTrigger.js.map +1 -1
- package/dist/dialogs/ConfirmationDialog.js.map +1 -1
- package/dist/menu-actions/DropdownMenu.d.ts +2 -2
- package/dist/menu-actions/DropdownMenu.d.ts.map +1 -1
- package/dist/menu-actions/DropdownMenu.js.map +1 -1
- package/dist/menu-actions/Menu.d.ts +3 -3
- package/dist/menu-actions/Menu.d.ts.map +1 -1
- package/dist/menu-actions/Menu.js +1 -1
- package/dist/menu-actions/Menu.js.map +1 -1
- package/dist/modal/DebouncedModal.js.map +1 -1
- package/dist/modal/InfoModal.js.map +1 -1
- package/dist/modal/Modal.js.map +1 -1
- package/dist/modal/ModalBody.js.map +1 -1
- package/dist/modal/ModalFooter.js.map +1 -1
- package/dist/modal/ModalHeader.js.map +1 -1
- package/dist/navigation/Menu.js.map +1 -1
- package/dist/navigation/MenuItem.js.map +1 -1
- package/dist/navigation/Page.js.map +1 -1
- package/dist/navigation/Stack.js.map +1 -1
- package/dist/popper/Popper.js +3 -0
- package/dist/popper/Popper.js.map +1 -1
- package/dist/popper/Tooltip.js +3 -0
- package/dist/popper/Tooltip.js.map +1 -1
- package/dist/shortcuts/Shortcut.js.map +1 -1
- package/dist/shortcuts/ShortcutRegistry.js.map +1 -1
- package/dist/theme/SpectrumThemeProvider.d.ts +17 -0
- package/dist/theme/SpectrumThemeProvider.d.ts.map +1 -0
- package/dist/theme/SpectrumThemeProvider.js +31 -0
- package/dist/theme/SpectrumThemeProvider.js.map +1 -0
- package/dist/theme/ThemeProvider.d.ts.map +1 -1
- package/dist/theme/ThemeProvider.js +26 -12
- package/dist/theme/ThemeProvider.js.map +1 -1
- package/dist/theme/ThemeUtils.js.map +1 -1
- package/dist/theme/theme-dark/index.d.ts +37 -0
- package/dist/theme/theme-dark/index.d.ts.map +1 -1
- package/dist/theme/theme-dark/index.js +43 -5
- package/dist/theme/theme-dark/index.js.map +1 -1
- package/dist/theme/theme-dark/theme-dark-components.css +8 -0
- package/dist/theme/theme-dark/theme-dark-components.css.map +1 -0
- package/dist/theme/theme-dark/theme-dark-semantic.css +51 -4
- package/dist/theme/theme-dark/theme-dark-semantic.css.map +1 -1
- package/dist/theme/theme-light/index.d.ts +37 -0
- package/dist/theme/theme-light/index.d.ts.map +1 -1
- package/dist/theme/theme-light/index.js +38 -1
- package/dist/theme/theme-light/index.js.map +1 -1
- package/dist/theme/theme-spectrum/index.d.ts +16 -0
- package/dist/theme/theme-spectrum/index.d.ts.map +1 -0
- package/dist/theme/theme-spectrum/index.js +22 -0
- package/dist/theme/theme-spectrum/index.js.map +1 -0
- package/dist/theme/theme-spectrum/theme-spectrum-alias.module.css +192 -0
- package/dist/theme/theme-spectrum/theme-spectrum-alias.module.css.map +1 -0
- package/dist/theme/theme-spectrum/theme-spectrum-overrides.module.css +7 -0
- package/dist/theme/theme-spectrum/theme-spectrum-overrides.module.css.map +1 -0
- package/dist/theme/theme-spectrum/theme-spectrum-palette.module.css +211 -0
- package/dist/theme/theme-spectrum/theme-spectrum-palette.module.css.map +1 -0
- package/dist/theme/useTheme.js.map +1 -1
- package/package.json +7 -7
- package/dist/SpectrumThemeDark.module.css +0 -9
- package/dist/SpectrumThemeDark.module.css.map +0 -1
- package/dist/SpectrumThemeLight.module.css +0 -9
- package/dist/SpectrumThemeLight.module.css.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Shortcut.js","names":["EventTarget","Log","EventShimCustomEvent","ContextActionUtils","log","module","MODIFIER","KEY","ALLOWED_SINGLE_KEY_SET","Set","ENTER","DELETE","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","Shortcut","isAllowedKey","key","Object","values","includes","isValidKeyState","state","keyValue","isMacPlatform","metaKey","isSingleKey","altKey","ctrlKey","shiftKey","has","createKeyState","keys","keyState","length","forEach","CTRL","ALT","OPTION","CMD","SHIFT","getKeyStateFromEvent","e","eventKey","keyCode","String","fromCharCode","getWindowsDisplayText","display","ESCAPE","getMacDisplayText","BACKSPACE","doKeyStatesMatch","state1","state2","toUpperCase","getDisplayText","constructor","id","shortcut","macShortcut","isEditable","name","tooltip","isMac","activeShortcut","defaultKeyState","getKeyState","setKeyState","debug2","JSON","stringify","dispatchEvent","detail","getDefaultKeyState","isDefault","setToNull","NULL_KEY_STATE","isNull","setToDefault","matchesKeyState","matchesEvent"],"sources":["../../src/shortcuts/Shortcut.ts"],"sourcesContent":["/* eslint-disable no-underscore-dangle */\nimport { EventTarget } from 'event-target-shim';\nimport React from 'react';\nimport { Log } from '@deephaven/log';\nimport { CustomEventMap, EventShimCustomEvent } from '@deephaven/utils';\nimport { ContextActionUtils } from '../context-actions';\n\nconst log = Log.module('Shortcut');\n\nexport enum MODIFIER {\n CTRL = 'MODIFIER_CTRL',\n CMD = 'MODIFIER_CMD',\n ALT = 'MODIFIER_ALT',\n OPTION = 'MODIFIER_OPTION',\n SHIFT = 'MODIFIER_SHIFT',\n}\n\n// The value should match the KeyboardEvent.key value\n// This is the value which will be displayed if no display overrides are done in the OS specific getDisplayString methods\nexport enum KEY {\n A = 'A',\n B = 'B',\n C = 'C',\n D = 'D',\n E = 'E',\n F = 'F',\n G = 'G',\n H = 'H',\n I = 'I',\n J = 'J',\n K = 'K',\n L = 'L',\n M = 'M',\n N = 'N',\n O = 'O',\n P = 'P',\n Q = 'Q',\n R = 'R',\n S = 'S',\n T = 'T',\n U = 'U',\n V = 'V',\n W = 'W',\n X = 'X',\n Y = 'Y',\n Z = 'Z',\n ZERO = '0',\n ONE = '1',\n TWO = '2',\n THREE = '3',\n FOUR = '4',\n FIVE = '5',\n SIX = '6',\n SEVEN = '7',\n EIGHT = '8',\n NINE = '9',\n BACKSPACE = 'Backspace',\n ESCAPE = 'Escape',\n ENTER = 'Enter',\n DELETE = 'Delete',\n SLASH = '/',\n QUESTION_MARK = '?',\n BACKSLASH = '\\\\',\n PIPE = '|',\n MINUS = '-',\n UNDERSCORE = '_',\n EQUALS = '=',\n PLUS = '+',\n BACKTICK = '`',\n TILDE = '~',\n COMMA = ',',\n LEFT_CHEVRON = '<',\n PERIOD = '.',\n RIGHT_CHEVRON = '>',\n SEMICOLON = ';',\n COLON = ':',\n SINGLE_QUOTE = \"'\",\n DOUBLE_QUOTE = '\"',\n LEFT_BRACKET = '[',\n RIGHT_BRACKET = ']',\n LEFT_CURLY = '{',\n RIGHT_CURLY = '}',\n F1 = 'F1',\n F2 = 'F2',\n F3 = 'F3',\n F4 = 'F4',\n F5 = 'F5',\n F6 = 'F6',\n F7 = 'F7',\n F8 = 'F8',\n F9 = 'F9',\n F10 = 'F10',\n F11 = 'F11',\n F12 = 'F12',\n}\n\nconst ALLOWED_SINGLE_KEY_SET: Set<KEY> = new Set([\n KEY.ENTER,\n KEY.DELETE,\n KEY.F1,\n KEY.F2,\n KEY.F3,\n KEY.F4,\n KEY.F5,\n KEY.F6,\n KEY.F7,\n KEY.F8,\n KEY.F9,\n KEY.F10,\n KEY.F11,\n KEY.F12,\n]);\n\ntype ShortcutKeys = [...MODIFIER[], KEY];\n\nexport interface KeyState {\n /**\n * This is purposely keyValue and not key to make KeyboardEvents not match the interface\n * KeyboardEvents need some processing to get the actual value\n * Use Shortcut.getKeyStateFromEvent to get the right KeyState from an event\n */\n keyValue: string | null;\n altKey: boolean;\n ctrlKey: boolean;\n metaKey: boolean;\n shiftKey: boolean;\n}\n\nexport interface ValidKeyState extends KeyState {\n keyValue: KEY | null;\n}\n\ntype EventMap = CustomEventMap<{\n onUpdate: CustomEvent<Shortcut>;\n}>;\n\nexport default class Shortcut extends EventTarget<EventMap, 'strict'> {\n readonly id: string; // Unique identifier for the shortcut\n\n readonly name: string; // e.g. Rename, Save, Run Selected\n\n readonly tooltip?: string;\n\n readonly isEditable: boolean;\n\n private readonly defaultKeyState: ValidKeyState;\n\n keyState: ValidKeyState;\n\n static NULL_KEY_STATE: ValidKeyState = {\n metaKey: false,\n shiftKey: false,\n altKey: false,\n ctrlKey: false,\n keyValue: null,\n };\n\n /**\n * Use to check if a keyCode corresponds to an allowed key for a shortcut\n * @param keyCode The keyCode to check. This should be the charCode of the key\n * @returns Type predicate asserting the key is an allowed KEY\n */\n static isAllowedKey(key: string | null): key is KEY {\n return Object.values(KEY).includes(key as KEY);\n }\n\n /**\n * Checks if a KeyState has a valid key.\n * @param state KeyState with any string as the key\n * @returns True if KeyState is is using an allowed keyCode\n */\n static isValidKeyState(state: KeyState): state is ValidKeyState {\n const { keyValue } = state;\n\n if (keyValue === null) {\n // Null state is valid\n return true;\n }\n\n if (!Shortcut.isMacPlatform && state.metaKey) {\n // MetaKey not allowed in windows\n return false;\n }\n\n if (!Shortcut.isAllowedKey(keyValue)) {\n return false;\n }\n\n const isSingleKey =\n !state.altKey && !state.ctrlKey && !state.metaKey && !state.shiftKey;\n\n return !isSingleKey || ALLOWED_SINGLE_KEY_SET.has(keyValue);\n }\n\n static isMacPlatform = ContextActionUtils.isMacPlatform();\n\n /**\n * Creates a KeyState from a valid array of modifier and key constants\n * @param keys Array of keys in the shortcut. Modifiers first and key last. Should use the MODIFIER and KEY enums\n * @returns KeyState representing the array of constants\n */\n static createKeyState(keys: ShortcutKeys): ValidKeyState {\n const keyState: ValidKeyState = {\n altKey: false,\n ctrlKey: false,\n metaKey: false,\n shiftKey: false,\n keyValue: keys[keys.length - 1] as KEY,\n };\n\n keys.forEach(key => {\n switch (key) {\n case MODIFIER.CTRL:\n keyState.ctrlKey = true;\n break;\n case MODIFIER.ALT:\n case MODIFIER.OPTION:\n keyState.altKey = true;\n break;\n case MODIFIER.CMD:\n keyState.metaKey = true;\n break;\n case MODIFIER.SHIFT:\n keyState.shiftKey = true;\n break;\n default:\n break;\n }\n });\n\n return keyState;\n }\n\n static getKeyStateFromEvent(\n e: React.KeyboardEvent | KeyboardEvent\n ): KeyState {\n const { key: eventKey, keyCode } = e;\n let key = '';\n if (\n eventKey === 'Shift' ||\n eventKey === 'Meta' ||\n eventKey === 'Control' ||\n eventKey === 'Alt'\n ) {\n key = '';\n } else if (\n // This is primarily for Mac which has a symbol keyboard hidden behind the alt key\n // The keyCode still corresponds to the letter keyCode, but the key value will be a symbol\n !Shortcut.isAllowedKey(eventKey) &&\n Shortcut.isAllowedKey(String.fromCharCode(keyCode))\n ) {\n key = String.fromCharCode(keyCode);\n } else {\n key = eventKey;\n }\n\n return {\n keyValue: key,\n altKey: e.altKey,\n ctrlKey: e.ctrlKey,\n metaKey: e.metaKey,\n shiftKey: e.shiftKey,\n };\n }\n\n /**\n * Gets display string for Windows (and Linux + any other non-Mac OS)\n * If the key is not an allowed key, the display will only display the modifiers\n * @param keyState KeyState to get the display for\n * @returns The string to display on Windows/non-Mac OS\n */\n private static getWindowsDisplayText(keyState: KeyState): string {\n let display = '';\n\n if (keyState.ctrlKey) {\n display += 'Ctrl+';\n }\n if (keyState.altKey) {\n display += 'Alt+';\n }\n if (keyState.shiftKey) {\n display += 'Shift+';\n }\n\n if (keyState.keyValue === KEY.ESCAPE) {\n display += 'Esc';\n } else if (keyState.keyValue !== null) {\n display += keyState.keyValue;\n }\n\n return display;\n }\n\n /**\n * Gets display string Mac OS\n * If the key is not an allowed key, the display will only display the modifiers\n * @param keyState KeyState to get the display for\n * @returns The string to display on Mac OS\n */\n private static getMacDisplayText(keyState: KeyState): string {\n let display = '';\n\n if (keyState.ctrlKey) {\n display += '⌃';\n }\n if (keyState.altKey) {\n display += '⌥';\n }\n if (keyState.shiftKey) {\n display += '⇧';\n }\n if (keyState.metaKey) {\n display += '⌘';\n }\n\n switch (keyState.keyValue) {\n case KEY.ENTER:\n display += '⏎';\n break;\n case KEY.ESCAPE:\n display += '⎋';\n break;\n case KEY.BACKSPACE:\n display += '⌫';\n break;\n case KEY.DELETE:\n display += '⌦';\n break;\n case null:\n break;\n default:\n display += keyState.keyValue;\n }\n\n return display;\n }\n\n /**\n * Checks if 2 KeyStates match\n * @param state1 First KeyState to compare\n * @param state2 Second KeyState to compare\n * @returns True if the KeyStates match and have non-null keyValues\n */\n static doKeyStatesMatch(state1: KeyState, state2: KeyState): boolean {\n return (\n state1.keyValue?.toUpperCase() === state2.keyValue?.toUpperCase() &&\n state1.altKey === state2.altKey &&\n state1.ctrlKey === state2.ctrlKey &&\n state1.metaKey === state2.metaKey &&\n state1.shiftKey === state2.shiftKey\n );\n }\n\n /**\n * Gets the display string for the current OS from a KeyState.\n * @param keyState KeyState to get the display for\n * @returns Display string for the current OS\n */\n static getDisplayText(keyState: KeyState): string {\n if (keyState.keyValue === null) {\n return '';\n }\n return Shortcut.isMacPlatform\n ? Shortcut.getMacDisplayText(keyState)\n : Shortcut.getWindowsDisplayText(keyState);\n }\n\n constructor({\n id,\n shortcut,\n macShortcut,\n isEditable = true,\n name,\n tooltip,\n }: {\n id: string;\n shortcut: ShortcutKeys;\n macShortcut: ShortcutKeys;\n isEditable?: boolean;\n name: string;\n tooltip?: string;\n }) {\n super();\n this.id = id;\n this.name = name;\n this.tooltip = tooltip;\n this.isEditable = isEditable;\n\n const isMac = Shortcut.isMacPlatform;\n const activeShortcut = isMac ? macShortcut : shortcut;\n this.defaultKeyState = Shortcut.createKeyState(activeShortcut);\n this.keyState = this.defaultKeyState;\n }\n\n /**\n * Gets the display string for the current OS\n */\n getDisplayText(): string {\n return Shortcut.getDisplayText(this.keyState);\n }\n\n /**\n * Gets the current keyState for the Shortcut\n */\n getKeyState(): ValidKeyState {\n return this.keyState;\n }\n\n /**\n * Sets the KeyState if it is valid\n * @param keyState\n */\n setKeyState(keyState: KeyState): void {\n if (Shortcut.isValidKeyState(keyState)) {\n log.debug2(`Shortcut ${this.id} updated to ${JSON.stringify(keyState)}`);\n this.keyState = keyState;\n this.dispatchEvent(\n new EventShimCustomEvent('onUpdate', { detail: this })\n );\n } else {\n log.debug2(\n `Shortcut ${\n this.id\n } tried to update to invalid keyState ${JSON.stringify(keyState)}`\n );\n }\n }\n\n /**\n * Gets the default key state of the shortcut\n * @returns Default key state\n */\n getDefaultKeyState(): ValidKeyState {\n return this.defaultKeyState;\n }\n\n isDefault(): boolean {\n return Shortcut.doKeyStatesMatch(\n this.getDefaultKeyState(),\n this.getKeyState()\n );\n }\n\n /**\n * Sets the shortcut to have null keyValue\n */\n setToNull(): void {\n this.setKeyState(Shortcut.NULL_KEY_STATE);\n }\n\n isNull(): boolean {\n return Shortcut.doKeyStatesMatch(this.keyState, Shortcut.NULL_KEY_STATE);\n }\n\n /**\n * Sets the shortcut to its default key state\n */\n setToDefault(): void {\n this.setKeyState(this.defaultKeyState);\n }\n\n /**\n * Checks if a KeyState matches the KeyState for the shortcut\n * @param keyState KeyState to check\n * @returns True if the passed KeyState matches the Shortcut's KeyState\n */\n matchesKeyState(keyState: KeyState): boolean {\n return Shortcut.doKeyStatesMatch(keyState, this.keyState);\n }\n\n /**\n * Alias for matchesKeyState\n * @param e KeyboardEvent to check if the Shortcut matches\n * @returns True if the event matches the Shortcut's KeyState\n */\n matchesEvent(e: React.KeyboardEvent | KeyboardEvent): boolean {\n return this.matchesKeyState(Shortcut.getKeyStateFromEvent(e));\n }\n}\n"],"mappings":";;;AAAA;AACA,SAASA,WAAW,QAAQ,mBAAmB;AAE/C,SAASC,GAAG,QAAQ,gBAAgB;AACpC,SAAyBC,oBAAoB,QAAQ,kBAAkB;AAAC,SAC/DC,k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eAAe;EAC7B;EAEAS,SAAS,GAAY;IACnB,OAAO5D,QAAQ,CAACqC,gBAAgB,CAC9B,IAAI,CAACsB,kBAAkB,EAAE,EACzB,IAAI,CAACP,WAAW,EAAE,CACnB;EACH;;EAEA;AACF;AACA;EACES,SAAS,GAAS;IAChB,IAAI,CAACR,WAAW,CAACrD,QAAQ,CAAC8D,cAAc,CAAC;EAC3C;EAEAC,MAAM,GAAY;IAChB,OAAO/D,QAAQ,CAACqC,gBAAgB,CAAC,IAAI,CAACnB,QAAQ,EAAElB,QAAQ,CAAC8D,cAAc,CAAC;EAC1E;;EAEA;AACF;AACA;EACEE,YAAY,GAAS;IACnB,IAAI,CAACX,WAAW,CAAC,IAAI,CAACF,eAAe,CAAC;EACxC;;EAEA;AACF;AACA;AACA;AACA;EACEc,eAAe,CAAC/C,QAAkB,EAAW;IAC3C,OAAOlB,QAAQ,CAACqC,gBAAgB,CAACnB,QAAQ,EAAE,IAAI,CAACA,QAAQ,CAAC;EAC3D;;EAEA;AACF;AACA;AACA;AACA;EACEgD,YAAY,CAACvC,CAAsC,EAAW;IAC5D,OAAO,IAAI,CAACsC,eAAe,CAACjE,QAAQ,CAAC0B,oBAAoB,CAACC,CAAC,CAAC,CAAC;EAC/D;AACF;AAAC,gBAtVoB3B,QAAQ,oBAaY;EACrCU,OAAO,EAAE,KAAK;EACdI,QAAQ,EAAE,KAAK;EACfF,MAAM,EAAE,KAAK;EACbC,OAAO,EAAE,KAAK;EACdL,QAAQ,EAAE;AACZ,CAAC;AAAA,gBAnBkBR,QAAQ,mBA0DJrB,kBAAkB,CAAC8B,aAAa,EAAE"}
|
|
1
|
+
{"version":3,"file":"Shortcut.js","names":["EventTarget","Log","EventShimCustomEvent","ContextActionUtils","log","module","MODIFIER","KEY","ALLOWED_SINGLE_KEY_SET","Set","ENTER","DELETE","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","Shortcut","isAllowedKey","key","Object","values","includes","isValidKeyState","state","keyValue","isMacPlatform","metaKey","isSingleKey","altKey","ctrlKey","shiftKey","has","createKeyState","keys","keyState","length","forEach","CTRL","ALT","OPTION","CMD","SHIFT","getKeyStateFromEvent","e","eventKey","keyCode","String","fromCharCode","getWindowsDisplayText","display","ESCAPE","getMacDisplayText","BACKSPACE","doKeyStatesMatch","state1","state2","_state1$keyValue","_state2$keyValue","toUpperCase","getDisplayText","constructor","_ref","id","shortcut","macShortcut","isEditable","name","tooltip","_defineProperty","isMac","activeShortcut","defaultKeyState","getKeyState","setKeyState","debug2","concat","JSON","stringify","dispatchEvent","detail","getDefaultKeyState","isDefault","setToNull","NULL_KEY_STATE","isNull","setToDefault","matchesKeyState","matchesEvent"],"sources":["../../src/shortcuts/Shortcut.ts"],"sourcesContent":["/* eslint-disable no-underscore-dangle */\nimport { EventTarget } from 'event-target-shim';\nimport React from 'react';\nimport { Log } from '@deephaven/log';\nimport { CustomEventMap, EventShimCustomEvent } from '@deephaven/utils';\nimport { ContextActionUtils } from '../context-actions';\n\nconst log = Log.module('Shortcut');\n\nexport enum MODIFIER {\n CTRL = 'MODIFIER_CTRL',\n CMD = 'MODIFIER_CMD',\n ALT = 'MODIFIER_ALT',\n OPTION = 'MODIFIER_OPTION',\n SHIFT = 'MODIFIER_SHIFT',\n}\n\n// The value should match the KeyboardEvent.key value\n// This is the value which will be displayed if no display overrides are done in the OS specific getDisplayString methods\nexport enum KEY {\n A = 'A',\n B = 'B',\n C = 'C',\n D = 'D',\n E = 'E',\n F = 'F',\n G = 'G',\n H = 'H',\n I = 'I',\n J = 'J',\n K = 'K',\n L = 'L',\n M = 'M',\n N = 'N',\n O = 'O',\n P = 'P',\n Q = 'Q',\n R = 'R',\n S = 'S',\n T = 'T',\n U = 'U',\n V = 'V',\n W = 'W',\n X = 'X',\n Y = 'Y',\n Z = 'Z',\n ZERO = '0',\n ONE = '1',\n TWO = '2',\n THREE = '3',\n FOUR = '4',\n FIVE = '5',\n SIX = '6',\n SEVEN = '7',\n EIGHT = '8',\n NINE = '9',\n BACKSPACE = 'Backspace',\n ESCAPE = 'Escape',\n ENTER = 'Enter',\n DELETE = 'Delete',\n SLASH = '/',\n QUESTION_MARK = '?',\n BACKSLASH = '\\\\',\n PIPE = '|',\n MINUS = '-',\n UNDERSCORE = '_',\n EQUALS = '=',\n PLUS = '+',\n BACKTICK = '`',\n TILDE = '~',\n COMMA = ',',\n LEFT_CHEVRON = '<',\n PERIOD = '.',\n RIGHT_CHEVRON = '>',\n SEMICOLON = ';',\n COLON = ':',\n SINGLE_QUOTE = \"'\",\n DOUBLE_QUOTE = '\"',\n LEFT_BRACKET = '[',\n RIGHT_BRACKET = ']',\n LEFT_CURLY = '{',\n RIGHT_CURLY = '}',\n F1 = 'F1',\n F2 = 'F2',\n F3 = 'F3',\n F4 = 'F4',\n F5 = 'F5',\n F6 = 'F6',\n F7 = 'F7',\n F8 = 'F8',\n F9 = 'F9',\n F10 = 'F10',\n F11 = 'F11',\n F12 = 'F12',\n}\n\nconst ALLOWED_SINGLE_KEY_SET: Set<KEY> = new Set([\n KEY.ENTER,\n KEY.DELETE,\n KEY.F1,\n KEY.F2,\n KEY.F3,\n KEY.F4,\n KEY.F5,\n KEY.F6,\n KEY.F7,\n KEY.F8,\n KEY.F9,\n KEY.F10,\n KEY.F11,\n KEY.F12,\n]);\n\ntype ShortcutKeys = [...MODIFIER[], KEY];\n\nexport interface KeyState {\n /**\n * This is purposely keyValue and not key to make KeyboardEvents not match the interface\n * KeyboardEvents need some processing to get the actual value\n * Use Shortcut.getKeyStateFromEvent to get the right KeyState from an event\n */\n keyValue: string | null;\n altKey: boolean;\n ctrlKey: boolean;\n metaKey: boolean;\n shiftKey: boolean;\n}\n\nexport interface ValidKeyState extends KeyState {\n keyValue: KEY | null;\n}\n\ntype EventMap = CustomEventMap<{\n onUpdate: CustomEvent<Shortcut>;\n}>;\n\nexport default class Shortcut extends EventTarget<EventMap, 'strict'> {\n readonly id: string; // Unique identifier for the shortcut\n\n readonly name: string; // e.g. Rename, Save, Run Selected\n\n readonly tooltip?: string;\n\n readonly isEditable: boolean;\n\n private readonly defaultKeyState: ValidKeyState;\n\n keyState: ValidKeyState;\n\n static NULL_KEY_STATE: ValidKeyState = {\n metaKey: false,\n shiftKey: false,\n altKey: false,\n ctrlKey: false,\n keyValue: null,\n };\n\n /**\n * Use to check if a keyCode corresponds to an allowed key for a shortcut\n * @param keyCode The keyCode to check. This should be the charCode of the key\n * @returns Type predicate asserting the key is an allowed KEY\n */\n static isAllowedKey(key: string | null): key is KEY {\n return Object.values(KEY).includes(key as KEY);\n }\n\n /**\n * Checks if a KeyState has a valid key.\n * @param state KeyState with any string as the key\n * @returns True if KeyState is is using an allowed keyCode\n */\n static isValidKeyState(state: KeyState): state is ValidKeyState {\n const { keyValue } = state;\n\n if (keyValue === null) {\n // Null state is valid\n return true;\n }\n\n if (!Shortcut.isMacPlatform && state.metaKey) {\n // MetaKey not allowed in windows\n return false;\n }\n\n if (!Shortcut.isAllowedKey(keyValue)) {\n return false;\n }\n\n const isSingleKey =\n !state.altKey && !state.ctrlKey && !state.metaKey && !state.shiftKey;\n\n return !isSingleKey || ALLOWED_SINGLE_KEY_SET.has(keyValue);\n }\n\n static isMacPlatform = ContextActionUtils.isMacPlatform();\n\n /**\n * Creates a KeyState from a valid array of modifier and key constants\n * @param keys Array of keys in the shortcut. Modifiers first and key last. Should use the MODIFIER and KEY enums\n * @returns KeyState representing the array of constants\n */\n static createKeyState(keys: ShortcutKeys): ValidKeyState {\n const keyState: ValidKeyState = {\n altKey: false,\n ctrlKey: false,\n metaKey: false,\n shiftKey: false,\n keyValue: keys[keys.length - 1] as KEY,\n };\n\n keys.forEach(key => {\n switch (key) {\n case MODIFIER.CTRL:\n keyState.ctrlKey = true;\n break;\n case MODIFIER.ALT:\n case MODIFIER.OPTION:\n keyState.altKey = true;\n break;\n case MODIFIER.CMD:\n keyState.metaKey = true;\n break;\n case MODIFIER.SHIFT:\n keyState.shiftKey = true;\n break;\n default:\n break;\n }\n });\n\n return keyState;\n }\n\n static getKeyStateFromEvent(\n e: React.KeyboardEvent | KeyboardEvent\n ): KeyState {\n const { key: eventKey, keyCode } = e;\n let key = '';\n if (\n eventKey === 'Shift' ||\n eventKey === 'Meta' ||\n eventKey === 'Control' ||\n eventKey === 'Alt'\n ) {\n key = '';\n } else if (\n // This is primarily for Mac which has a symbol keyboard hidden behind the alt key\n // The keyCode still corresponds to the letter keyCode, but the key value will be a symbol\n !Shortcut.isAllowedKey(eventKey) &&\n Shortcut.isAllowedKey(String.fromCharCode(keyCode))\n ) {\n key = String.fromCharCode(keyCode);\n } else {\n key = eventKey;\n }\n\n return {\n keyValue: key,\n altKey: e.altKey,\n ctrlKey: e.ctrlKey,\n metaKey: e.metaKey,\n shiftKey: e.shiftKey,\n };\n }\n\n /**\n * Gets display string for Windows (and Linux + any other non-Mac OS)\n * If the key is not an allowed key, the display will only display the modifiers\n * @param keyState KeyState to get the display for\n * @returns The string to display on Windows/non-Mac OS\n */\n private static getWindowsDisplayText(keyState: KeyState): string {\n let display = '';\n\n if (keyState.ctrlKey) {\n display += 'Ctrl+';\n }\n if (keyState.altKey) {\n display += 'Alt+';\n }\n if (keyState.shiftKey) {\n display += 'Shift+';\n }\n\n if (keyState.keyValue === KEY.ESCAPE) {\n display += 'Esc';\n } else if (keyState.keyValue !== null) {\n display += keyState.keyValue;\n }\n\n return display;\n }\n\n /**\n * Gets display string Mac OS\n * If the key is not an allowed key, the display will only display the modifiers\n * @param keyState KeyState to get the display for\n * @returns The string to display on Mac OS\n */\n private static getMacDisplayText(keyState: KeyState): string {\n let display = '';\n\n if (keyState.ctrlKey) {\n display += '⌃';\n }\n if (keyState.altKey) {\n display += '⌥';\n }\n if (keyState.shiftKey) {\n display += '⇧';\n }\n if (keyState.metaKey) {\n display += '⌘';\n }\n\n switch (keyState.keyValue) {\n case KEY.ENTER:\n display += '⏎';\n break;\n case KEY.ESCAPE:\n display += '⎋';\n break;\n case KEY.BACKSPACE:\n display += '⌫';\n break;\n case KEY.DELETE:\n display += '⌦';\n break;\n case null:\n break;\n default:\n display += keyState.keyValue;\n }\n\n return display;\n }\n\n /**\n * Checks if 2 KeyStates match\n * @param state1 First KeyState to compare\n * @param state2 Second KeyState to compare\n * @returns True if the KeyStates match and have non-null keyValues\n */\n static doKeyStatesMatch(state1: KeyState, state2: KeyState): boolean {\n return (\n state1.keyValue?.toUpperCase() === state2.keyValue?.toUpperCase() &&\n state1.altKey === state2.altKey &&\n state1.ctrlKey === state2.ctrlKey &&\n state1.metaKey === state2.metaKey &&\n state1.shiftKey === state2.shiftKey\n );\n }\n\n /**\n * Gets the display string for the current OS from a KeyState.\n * @param keyState KeyState to get the display for\n * @returns Display string for the current OS\n */\n static getDisplayText(keyState: KeyState): string {\n if (keyState.keyValue === null) {\n return '';\n }\n return Shortcut.isMacPlatform\n ? Shortcut.getMacDisplayText(keyState)\n : Shortcut.getWindowsDisplayText(keyState);\n }\n\n constructor({\n id,\n shortcut,\n macShortcut,\n isEditable = true,\n name,\n tooltip,\n }: {\n id: string;\n shortcut: ShortcutKeys;\n macShortcut: ShortcutKeys;\n isEditable?: boolean;\n name: string;\n tooltip?: string;\n }) {\n super();\n this.id = id;\n this.name = name;\n this.tooltip = tooltip;\n this.isEditable = isEditable;\n\n const isMac = Shortcut.isMacPlatform;\n const activeShortcut = isMac ? macShortcut : shortcut;\n this.defaultKeyState = Shortcut.createKeyState(activeShortcut);\n this.keyState = this.defaultKeyState;\n }\n\n /**\n * Gets the display string for the current OS\n */\n getDisplayText(): string {\n return Shortcut.getDisplayText(this.keyState);\n }\n\n /**\n * Gets the current keyState for the Shortcut\n */\n getKeyState(): ValidKeyState {\n return this.keyState;\n }\n\n /**\n * Sets the KeyState if it is valid\n * @param keyState\n */\n setKeyState(keyState: KeyState): void {\n if (Shortcut.isValidKeyState(keyState)) {\n log.debug2(`Shortcut ${this.id} updated to ${JSON.stringify(keyState)}`);\n this.keyState = keyState;\n this.dispatchEvent(\n new EventShimCustomEvent('onUpdate', { detail: this })\n );\n } else {\n log.debug2(\n `Shortcut ${\n this.id\n } tried to update to invalid keyState ${JSON.stringify(keyState)}`\n );\n }\n }\n\n /**\n * Gets the default key state of the shortcut\n * @returns Default key state\n */\n getDefaultKeyState(): ValidKeyState {\n return this.defaultKeyState;\n }\n\n isDefault(): boolean {\n return Shortcut.doKeyStatesMatch(\n this.getDefaultKeyState(),\n this.getKeyState()\n );\n }\n\n /**\n * Sets the shortcut to have null keyValue\n */\n setToNull(): void {\n this.setKeyState(Shortcut.NULL_KEY_STATE);\n }\n\n isNull(): boolean {\n return Shortcut.doKeyStatesMatch(this.keyState, Shortcut.NULL_KEY_STATE);\n }\n\n /**\n * Sets the shortcut to its default key state\n */\n setToDefault(): void {\n this.setKeyState(this.defaultKeyState);\n }\n\n /**\n * Checks if a KeyState matches the KeyState for the shortcut\n * @param keyState KeyState to check\n * @returns True if the passed KeyState matches the Shortcut's KeyState\n */\n matchesKeyState(keyState: KeyState): boolean {\n return Shortcut.doKeyStatesMatch(keyState, this.keyState);\n }\n\n /**\n * Alias for matchesKeyState\n * @param e KeyboardEvent to check if the Shortcut matches\n * @returns True if the event matches the Shortcut's KeyState\n */\n matchesEvent(e: React.KeyboardEvent | KeyboardEvent): boolean {\n return this.matchesKeyState(Shortcut.getKeyStateFromEvent(e));\n }\n}\n"],"mappings":";;;AAAA;AACA,SAASA,WAAW,QAAQ,mBAAmB;AAE/C,SAASC,GAAG,QAAQ,gBAAgB;AACpC,SAAyBC,oBAAoB,QAAQ,kBAAkB;AAAC,SAC/DC,kBAAkB;AAE3B,IAAMC,GAAG,GAAGH,GAAG,CAACI,MAAM,CAAC,UAAU,CAAC;AAElC,WAAYC,QAAQ;;AAQpB;AACA;AAAA,WATYA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;AAAA,GAARA,QAAQ,KAARA,QAAQ;AAUpB,WAAYC,GAAG;AA2Ed,WA3EWA,GAAG;EAAHA,GAAG;EAAHA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AAe;EAC7B;EAEAU,SAASA,CAAA,EAAY;IACnB,OAAOjE,QAAQ,CAACqC,gBAAgB,CAC9B,IAAI,CAAC2B,kBAAkB,CAAC,CAAC,EACzB,IAAI,CAACR,WAAW,CAAC,CACnB,CAAC;EACH;;EAEA;AACF;AACA;EACEU,SAASA,CAAA,EAAS;IAChB,IAAI,CAACT,WAAW,CAACzD,QAAQ,CAACmE,cAAc,CAAC;EAC3C;EAEAC,MAAMA,CAAA,EAAY;IAChB,OAAOpE,QAAQ,CAACqC,gBAAgB,CAAC,IAAI,CAACnB,QAAQ,EAAElB,QAAQ,CAACmE,cAAc,CAAC;EAC1E;;EAEA;AACF;AACA;EACEE,YAAYA,CAAA,EAAS;IACnB,IAAI,CAACZ,WAAW,CAAC,IAAI,CAACF,eAAe,CAAC;EACxC;;EAEA;AACF;AACA;AACA;AACA;EACEe,eAAeA,CAACpD,QAAkB,EAAW;IAC3C,OAAOlB,QAAQ,CAACqC,gBAAgB,CAACnB,QAAQ,EAAE,IAAI,CAACA,QAAQ,CAAC;EAC3D;;EAEA;AACF;AACA;AACA;AACA;EACEqD,YAAYA,CAAC5C,CAAsC,EAAW;IAC5D,OAAO,IAAI,CAAC2C,eAAe,CAACtE,QAAQ,CAAC0B,oBAAoB,CAACC,CAAC,CAAC,CAAC;EAC/D;AACF;AAACyB,eAAA,CAtVoBpD,QAAQ,oBAaY;EACrCU,OAAO,EAAE,KAAK;EACdI,QAAQ,EAAE,KAAK;EACfF,MAAM,EAAE,KAAK;EACbC,OAAO,EAAE,KAAK;EACdL,QAAQ,EAAE;AACZ,CAAC;AAAA4C,eAAA,CAnBkBpD,QAAQ,mBA0DJrB,kBAAkB,CAAC8B,aAAa,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShortcutRegistry.js","names":["EventTarget","Log","EventShimCustomEvent","Shortcut","log","module","ShortcutRegistry","Map","createAndAdd","params","shortcut","add","existingShortcut","shortcutMap","get","id","warn","debug2","addEventListener","detail","dispatchEvent","category","split","set","shortcutsByCategory","has","push","getConflictingShortcuts","keyState","Array","from","values","filter","isNull","matchesKeyState","registry","Object","freeze"],"sources":["../../src/shortcuts/ShortcutRegistry.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\nimport { EventTarget } from 'event-target-shim';\nimport { Log } from '@deephaven/log';\nimport { CustomEventMap, EventShimCustomEvent } from '@deephaven/utils';\nimport Shortcut, { KeyState } from './Shortcut';\n\nconst log = Log.module('ShortcutRegistry');\n\ntype EventMap = CustomEventMap<{\n onUpdate: CustomEvent<Shortcut>;\n}>;\n\nclass ShortcutRegistry extends EventTarget<EventMap, 'strict'> {\n readonly shortcutMap = new Map<string, Shortcut>();\n\n readonly shortcutsByCategory = new Map<string, Shortcut[]>();\n\n /**\n * Creates a Shortcut and adds it to the registry\n * @param params The constructor params for the {@link Shortcut}\n * @returns The created shortcut or the shortcut in the registry if 1 already exists w/ the same ID\n */\n createAndAdd(params: ConstructorParameters<typeof Shortcut>[0]): Shortcut {\n const shortcut = new Shortcut(params);\n return this.add(shortcut);\n }\n\n /**\n * Adds a shortcut to the registry. Warns and returns existing shortcut if a shortcut with the same ID already exists\n * @param shortcut Shortcut to add to the registry\n * @returns Shortcut passed if it is not in the registry. Shortcut from the registry if one exists for the same ID\n */\n add(shortcut: Shortcut): Shortcut {\n const existingShortcut = this.shortcutMap.get(shortcut.id);\n if (existingShortcut) {\n log.warn(\n `Skipping attempt to add duplicate shortcut ID to registry: ${shortcut.id}`\n );\n return existingShortcut;\n }\n\n log.debug2(`Adding shortcut to registry: ${shortcut.id}`);\n\n shortcut.addEventListener('onUpdate', ({ detail }) =>\n this.dispatchEvent(new EventShimCustomEvent('onUpdate', { detail }))\n );\n\n const category = shortcut.id.split('.')[0];\n\n this.shortcutMap.set(shortcut.id, shortcut);\n if (this.shortcutsByCategory.has(category)) {\n this.shortcutsByCategory.get(category)?.push(shortcut);\n } else {\n this.shortcutsByCategory.set(category, [shortcut]);\n }\n\n return shortcut;\n }\n\n /**\n * Gets a shortcut from the registry from an ID\n * @param id ID of the shortcut\n * @returns The shortcut for that ID if it exists\n */\n get(id: string): Shortcut | undefined {\n return this.shortcutMap.get(id);\n }\n\n /**\n * Gets an array of any registered shortcuts with conflicting key states.\n * Only checks the key states of the current OS (Mac or Windows/Linux)\n * @param keyState\n * @returns Array of conflicting shortcuts. Empty array if none conflict\n */\n getConflictingShortcuts(keyState: KeyState): Shortcut[] {\n return Array.from(this.shortcutMap.values()).filter(\n shortcut => !shortcut.isNull() && shortcut.matchesKeyState(keyState)\n );\n }\n}\n\nconst registry = Object.freeze(new ShortcutRegistry());\n\nexport default registry;\n"],"mappings":";;;AAAA;AACA,SAASA,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,GAAG,QAAQ,gBAAgB;AACpC,SAAyBC,oBAAoB,QAAQ,kBAAkB;AAAC,OACjEC,QAAQ;AAEf,IAAMC,GAAG,GAAGH,GAAG,CAACI,MAAM,CAAC,kBAAkB,CAAC;AAM1C,MAAMC,gBAAgB,SAASN,WAAW,CAAqB;
|
|
1
|
+
{"version":3,"file":"ShortcutRegistry.js","names":["EventTarget","Log","EventShimCustomEvent","Shortcut","log","module","ShortcutRegistry","constructor","arguments","_defineProperty","Map","createAndAdd","params","shortcut","add","existingShortcut","shortcutMap","get","id","warn","concat","debug2","addEventListener","_ref","detail","dispatchEvent","category","split","set","shortcutsByCategory","has","_this$shortcutsByCate","push","getConflictingShortcuts","keyState","Array","from","values","filter","isNull","matchesKeyState","registry","Object","freeze"],"sources":["../../src/shortcuts/ShortcutRegistry.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\nimport { EventTarget } from 'event-target-shim';\nimport { Log } from '@deephaven/log';\nimport { CustomEventMap, EventShimCustomEvent } from '@deephaven/utils';\nimport Shortcut, { KeyState } from './Shortcut';\n\nconst log = Log.module('ShortcutRegistry');\n\ntype EventMap = CustomEventMap<{\n onUpdate: CustomEvent<Shortcut>;\n}>;\n\nclass ShortcutRegistry extends EventTarget<EventMap, 'strict'> {\n readonly shortcutMap = new Map<string, Shortcut>();\n\n readonly shortcutsByCategory = new Map<string, Shortcut[]>();\n\n /**\n * Creates a Shortcut and adds it to the registry\n * @param params The constructor params for the {@link Shortcut}\n * @returns The created shortcut or the shortcut in the registry if 1 already exists w/ the same ID\n */\n createAndAdd(params: ConstructorParameters<typeof Shortcut>[0]): Shortcut {\n const shortcut = new Shortcut(params);\n return this.add(shortcut);\n }\n\n /**\n * Adds a shortcut to the registry. Warns and returns existing shortcut if a shortcut with the same ID already exists\n * @param shortcut Shortcut to add to the registry\n * @returns Shortcut passed if it is not in the registry. Shortcut from the registry if one exists for the same ID\n */\n add(shortcut: Shortcut): Shortcut {\n const existingShortcut = this.shortcutMap.get(shortcut.id);\n if (existingShortcut) {\n log.warn(\n `Skipping attempt to add duplicate shortcut ID to registry: ${shortcut.id}`\n );\n return existingShortcut;\n }\n\n log.debug2(`Adding shortcut to registry: ${shortcut.id}`);\n\n shortcut.addEventListener('onUpdate', ({ detail }) =>\n this.dispatchEvent(new EventShimCustomEvent('onUpdate', { detail }))\n );\n\n const category = shortcut.id.split('.')[0];\n\n this.shortcutMap.set(shortcut.id, shortcut);\n if (this.shortcutsByCategory.has(category)) {\n this.shortcutsByCategory.get(category)?.push(shortcut);\n } else {\n this.shortcutsByCategory.set(category, [shortcut]);\n }\n\n return shortcut;\n }\n\n /**\n * Gets a shortcut from the registry from an ID\n * @param id ID of the shortcut\n * @returns The shortcut for that ID if it exists\n */\n get(id: string): Shortcut | undefined {\n return this.shortcutMap.get(id);\n }\n\n /**\n * Gets an array of any registered shortcuts with conflicting key states.\n * Only checks the key states of the current OS (Mac or Windows/Linux)\n * @param keyState\n * @returns Array of conflicting shortcuts. Empty array if none conflict\n */\n getConflictingShortcuts(keyState: KeyState): Shortcut[] {\n return Array.from(this.shortcutMap.values()).filter(\n shortcut => !shortcut.isNull() && shortcut.matchesKeyState(keyState)\n );\n }\n}\n\nconst registry = Object.freeze(new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C,GAAG,CAAC,CAAC,CAAC,CAAC;IAE1C,IAAI,CAACX,WAAW,CAACY,GAAG,CAACf,QAAQ,CAACK,EAAE,EAAEL,QAAQ,CAAC;IAC3C,IAAI,IAAI,CAACgB,mBAAmB,CAACC,GAAG,CAACJ,QAAQ,CAAC,EAAE;MAAA,IAAAK,qBAAA;MAC1C,CAAAA,qBAAA,OAAI,CAACF,mBAAmB,CAACZ,GAAG,CAACS,QAAQ,CAAC,cAAAK,qBAAA,uBAAtCA,qBAAA,CAAwCC,IAAI,CAACnB,QAAQ,CAAC;IACxD,CAAC,MAAM;MACL,IAAI,CAACgB,mBAAmB,CAACD,GAAG,CAACF,QAAQ,EAAE,CAACb,QAAQ,CAAC,CAAC;IACpD;IAEA,OAAOA,QAAQ;EACjB;;EAEA;AACF;AACA;AACA;AACA;EACEI,GAAGA,CAACC,EAAU,EAAwB;IACpC,OAAO,IAAI,CAACF,WAAW,CAACC,GAAG,CAACC,EAAE,CAAC;EACjC;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEe,uBAAuBA,CAACC,QAAkB,EAAc;IACtD,OAAOC,KAAK,CAACC,IAAI,CAAC,IAAI,CAACpB,WAAW,CAACqB,MAAM,CAAC,CAAC,CAAC,CAACC,MAAM,CACjDzB,QAAQ,IAAI,CAACA,QAAQ,CAAC0B,MAAM,CAAC,CAAC,IAAI1B,QAAQ,CAAC2B,eAAe,CAACN,QAAQ,CACrE,CAAC;EACH;AACF;AAEA,IAAMO,QAAQ,GAAGC,MAAM,CAACC,MAAM,CAAC,IAAIrC,gBAAgB,CAAC,CAAC,CAAC;AAEtD,eAAemC,QAAQ"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import type { Theme } from '@react-types/provider';
|
|
3
|
+
export interface SpectrumThemeProviderProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
isPortal?: boolean;
|
|
6
|
+
theme?: Theme;
|
|
7
|
+
colorScheme?: 'light' | 'dark';
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Wrapper around React Spectrum's theme Provider that provides DH mappings of
|
|
11
|
+
* Spectrum's theme variables to DH's theme variables. Also exposes an optional
|
|
12
|
+
* `isPortal` prop that if provided, adds a unique `data-unique-id` attribute to
|
|
13
|
+
* the Provider. This is needed to force the Provider to render the theme wrapper
|
|
14
|
+
* inside of portals.
|
|
15
|
+
*/
|
|
16
|
+
export declare function SpectrumThemeProvider({ children, isPortal, theme, colorScheme, }: SpectrumThemeProviderProps): JSX.Element;
|
|
17
|
+
//# sourceMappingURL=SpectrumThemeProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SpectrumThemeProvider.d.ts","sourceRoot":"","sources":["../../src/theme/SpectrumThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAE5C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAInD,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAChC;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,QAAQ,EACR,QAAgB,EAChB,KAAsB,EACtB,WAAW,GACZ,EAAE,0BAA0B,GAAG,GAAG,CAAC,OAAO,CAW1C"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { Provider } from '@adobe/react-spectrum';
|
|
3
|
+
import shortid from 'shortid';
|
|
4
|
+
import { themeDHDefault } from "../SpectrumUtils.js";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
/**
|
|
7
|
+
* Wrapper around React Spectrum's theme Provider that provides DH mappings of
|
|
8
|
+
* Spectrum's theme variables to DH's theme variables. Also exposes an optional
|
|
9
|
+
* `isPortal` prop that if provided, adds a unique `data-unique-id` attribute to
|
|
10
|
+
* the Provider. This is needed to force the Provider to render the theme wrapper
|
|
11
|
+
* inside of portals.
|
|
12
|
+
*/
|
|
13
|
+
export function SpectrumThemeProvider(_ref) {
|
|
14
|
+
var {
|
|
15
|
+
children,
|
|
16
|
+
isPortal = false,
|
|
17
|
+
theme = themeDHDefault,
|
|
18
|
+
colorScheme
|
|
19
|
+
} = _ref;
|
|
20
|
+
// a unique ID is used per provider to force it to render the theme wrapper element inside portals
|
|
21
|
+
// based on https://github.com/adobe/react-spectrum/issues/1697#issuecomment-999827266
|
|
22
|
+
// won't be needed if https://github.com/adobe/react-spectrum/pull/2669 is merged
|
|
23
|
+
var [id] = useState(isPortal ? shortid() : null);
|
|
24
|
+
return /*#__PURE__*/_jsx(Provider, {
|
|
25
|
+
theme: theme,
|
|
26
|
+
colorScheme: colorScheme,
|
|
27
|
+
"data-unique-id": id,
|
|
28
|
+
children: children
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=SpectrumThemeProvider.js.map
|
|
@@ -0,0 +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 theme={theme} colorScheme={colorScheme} data-unique-id={id}>\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;IAACS,KAAK,EAAEA,KAAM;IAACC,WAAW,EAAEA,WAAY;IAAC,kBAAgBC,EAAG;IAAAJ,QAAA,EAClEA;EAAQ,CACD,CAAC;AAEf"}
|
|
@@ -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;
|
|
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,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,EACN,QAAQ,GACT,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAkElC;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -2,7 +2,9 @@ import { createContext, useEffect, useMemo, useState } from 'react';
|
|
|
2
2
|
import Log from '@deephaven/log';
|
|
3
3
|
import { DEFAULT_DARK_THEME_KEY } from "./ThemeModel.js";
|
|
4
4
|
import { calculatePreloadStyleContent, getActiveThemes, getDefaultBaseThemes, getThemePreloadData, setThemePreloadData } from "./ThemeUtils.js";
|
|
5
|
+
import { SpectrumThemeProvider } from "./SpectrumThemeProvider.js";
|
|
5
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
6
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
9
|
var log = Log.module('ThemeProvider');
|
|
8
10
|
export var ThemeContext = /*#__PURE__*/createContext(null);
|
|
@@ -16,21 +18,29 @@ export function ThemeProvider(_ref) {
|
|
|
16
18
|
var _getThemePreloadData$, _getThemePreloadData;
|
|
17
19
|
return (_getThemePreloadData$ = (_getThemePreloadData = getThemePreloadData()) === null || _getThemePreloadData === void 0 ? void 0 : _getThemePreloadData.themeKey) !== null && _getThemePreloadData$ !== void 0 ? _getThemePreloadData$ : DEFAULT_DARK_THEME_KEY;
|
|
18
20
|
});
|
|
19
|
-
|
|
20
|
-
//
|
|
21
|
-
|
|
22
|
-
// on additional themes to be available.
|
|
23
|
-
themes == null ? null : getActiveThemes(selectedThemeKey, {
|
|
21
|
+
|
|
22
|
+
// Calculate active themes once a non-null themes array is provided.
|
|
23
|
+
var activeThemes = useMemo(() => themes == null ? null : getActiveThemes(selectedThemeKey, {
|
|
24
24
|
base: baseThemes,
|
|
25
25
|
custom: themes !== null && themes !== void 0 ? themes : []
|
|
26
26
|
}), [baseThemes, selectedThemeKey, themes]);
|
|
27
27
|
useEffect(function updateThemePreloadData() {
|
|
28
|
-
|
|
28
|
+
// Don't update preload data until themes have been loaded and activated
|
|
29
|
+
if (activeThemes == null || themes == null) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
var preloadStyleContent = calculatePreloadStyleContent();
|
|
33
|
+
log.debug2('updateThemePreloadData:', {
|
|
34
|
+
active: activeThemes.map(theme => theme.themeKey),
|
|
35
|
+
all: themes.map(theme => theme.themeKey),
|
|
36
|
+
preloadStyleContent,
|
|
37
|
+
selectedThemeKey
|
|
38
|
+
});
|
|
29
39
|
setThemePreloadData({
|
|
30
40
|
themeKey: selectedThemeKey,
|
|
31
|
-
preloadStyleContent
|
|
41
|
+
preloadStyleContent
|
|
32
42
|
});
|
|
33
|
-
}, [activeThemes, selectedThemeKey]);
|
|
43
|
+
}, [activeThemes, selectedThemeKey, themes]);
|
|
34
44
|
var value = useMemo(() => ({
|
|
35
45
|
activeThemes,
|
|
36
46
|
selectedThemeKey,
|
|
@@ -38,10 +48,14 @@ export function ThemeProvider(_ref) {
|
|
|
38
48
|
}), [activeThemes, selectedThemeKey]);
|
|
39
49
|
return /*#__PURE__*/_jsxs(ThemeContext.Provider, {
|
|
40
50
|
value: value,
|
|
41
|
-
children: [activeThemes
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
51
|
+
children: [activeThemes == null ? null : /*#__PURE__*/_jsx(_Fragment, {
|
|
52
|
+
children: activeThemes.map(theme => /*#__PURE__*/_jsx("style", {
|
|
53
|
+
"data-theme-key": theme.themeKey,
|
|
54
|
+
children: theme.styleContent
|
|
55
|
+
}, theme.themeKey))
|
|
56
|
+
}), /*#__PURE__*/_jsx(SpectrumThemeProvider, {
|
|
57
|
+
children: children
|
|
58
|
+
})]
|
|
45
59
|
});
|
|
46
60
|
}
|
|
47
61
|
export default ThemeProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.js","names":["createContext","useEffect","useMemo","useState","Log","DEFAULT_DARK_THEME_KEY","calculatePreloadStyleContent","getActiveThemes","getDefaultBaseThemes","getThemePreloadData","setThemePreloadData","log","module","ThemeContext","ThemeProvider","themes","children","baseThemes","selectedThemeKey","setSelectedThemeKey","themeKey","activeThemes","base","custom","updateThemePreloadData","
|
|
1
|
+
{"version":3,"file":"ThemeProvider.js","names":["createContext","useEffect","useMemo","useState","Log","DEFAULT_DARK_THEME_KEY","calculatePreloadStyleContent","getActiveThemes","getDefaultBaseThemes","getThemePreloadData","setThemePreloadData","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","all","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} from './ThemeUtils';\nimport { SpectrumThemeProvider } from './SpectrumThemeProvider';\n\nexport interface ThemeContextValue {\n activeThemes: ThemeData[] | null;\n selectedThemeKey: string;\n setSelectedThemeKey: (themeKey: string) => void;\n}\n\nconst log = Log.module('ThemeProvider');\n\nexport const ThemeContext = createContext<ThemeContextValue | null>(null);\n\nexport interface ThemeProviderProps {\n /*\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,\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 themes == null\n ? null\n : getActiveThemes(selectedThemeKey, {\n base: baseThemes,\n custom: themes ?? [],\n }),\n [baseThemes, selectedThemeKey, themes]\n );\n\n useEffect(\n function updateThemePreloadData() {\n // Don't update preload data until themes have been loaded and activated\n if (activeThemes == null || themes == null) {\n return;\n }\n\n const preloadStyleContent = calculatePreloadStyleContent();\n\n log.debug2('updateThemePreloadData:', {\n active: activeThemes.map(theme => theme.themeKey),\n all: themes.map(theme => theme.themeKey),\n preloadStyleContent,\n selectedThemeKey,\n });\n\n setThemePreloadData({\n themeKey: selectedThemeKey,\n preloadStyleContent,\n });\n },\n [activeThemes, selectedThemeKey, themes]\n );\n\n const value = useMemo(\n () => ({\n activeThemes,\n selectedThemeKey,\n setSelectedThemeKey,\n }),\n [activeThemes, selectedThemeKey]\n );\n\n return (\n <ThemeContext.Provider value={value}>\n {activeThemes == 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 <SpectrumTh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"}
|
|
@@ -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","log","module","TMP_CSS_PROP_PREFIX","calculatePreloadStyleContent","bodyStyle","getComputedStyle","document","body","pairs","Object","entries","map","key","defaultValue","getPropertyValue","join","extractDistinctCssVariableExpressions","record","set","Set","values","forEach","value","getCssVariableRanges","start","end","add","substring","getActiveThemes","themeKey","themeRegistration","custom","find","theme","baseThemeKey","base","error","debug","getDefaultBaseThemes","name","styleContent","getThemePreloadData","data","localStorage","getItem","JSON","parse","ranges","cssVarPrefix","indexOf","parenLevel","i","length","push","resolveCssVariablesInRecord","targetElement","perfStart","performance","now","tmpPropEl","createElement","appendChild","varExpressions","varExpression","tmpPropKey","style","setProperty","result","computedStyle","window","resolver","resolved","normalizeCssColor","resolveCssVariablesInString","remove","setThemePreloadData","preloadData","setItem","stringify","getThemeKey","pluginName","themeName","preloadTheme","preloadStyleContent","innerHTML","head"],"sources":["../../src/theme/ThemeUtils.ts"],"sourcesContent":["import Log from '@deephaven/log';\nimport { assertNotNull, ColorUtils } from '@deephaven/utils';\n// Note that ?inline imports are natively supported by Vite, but consumers of\n// @deephaven/components using Webpack will need to add a rule to their module\n// config.\n// e.g.\n// module: {\n// rules: [\n// {\n// resourceQuery: /inline/,\n// type: 'asset/source',\n// },\n// ],\n// },\nimport { themeDark } from './theme-dark';\nimport { themeLight } from './theme-light';\nimport {\n DEFAULT_DARK_THEME_KEY,\n DEFAULT_LIGHT_THEME_KEY,\n DEFAULT_PRELOAD_DATA_VARIABLES,\n ThemeData,\n ThemePreloadData,\n ThemePreloadStyleContent,\n ThemeRegistrationData,\n THEME_CACHE_LOCAL_STORAGE_KEY,\n} from './ThemeModel';\n\nconst log = Log.module('ThemeUtils');\n\nexport const TMP_CSS_PROP_PREFIX = 'dh-tmp';\n\nexport type VarExpressionResolver = (varExpression: string) => string;\n\n/**\n * Creates a string containing preload style content for the current theme.\n * This resolves the current values of a few CSS variables that can be used\n * to style the page before the theme is loaded on next page load.\n */\nexport function calculatePreloadStyleContent(): ThemePreloadStyleContent {\n const bodyStyle = getComputedStyle(document.body);\n\n // Calculate the current preload variables. If the variable is not set, use\n // the default value.\n const pairs = Object.entries(DEFAULT_PRELOAD_DATA_VARIABLES).map(\n ([key, defaultValue]) =>\n `${key}:${bodyStyle.getPropertyValue(key) || defaultValue}`\n );\n\n return `:root{${pairs.join(';')}}`;\n}\n\n/**\n * Extracts all css variable expressions from the given record and returns\n * a set of unique expressions.\n * @param record The record to extract css variable expressions from\n */\nexport function extractDistinctCssVariableExpressions(\n record: Record<string, string>\n): Set<string> {\n const set = new Set<string>();\n\n Object.values(record).forEach(value => {\n getCssVariableRanges(value).forEach(([start, end]) => {\n set.add(value.substring(start, end + 1));\n });\n });\n\n return set;\n}\n\n/**\n * Returns an array of the active themes. The first item will always be one\n * of the base themes. Optionally, the second item will be a custom theme.\n */\nexport function getActiveThemes(\n themeKey: string,\n themeRegistration: ThemeRegistrationData\n): [ThemeData] | [ThemeData, ThemeData] {\n const custom = themeRegistration.custom.find(\n theme => theme.themeKey === themeKey\n );\n\n const baseThemeKey = custom?.baseThemeKey ?? themeKey;\n\n let base = themeRegistration.base.find(\n theme => theme.themeKey === baseThemeKey\n );\n\n if (base == null) {\n log.error(\n `No registered base theme found for theme key: '${baseThemeKey}'`,\n 'Registered:',\n themeRegistration.base.map(theme => theme.themeKey),\n themeRegistration.custom.map(theme => theme.themeKey)\n );\n base = themeRegistration.base.find(\n theme => theme.themeKey === DEFAULT_DARK_THEME_KEY\n );\n\n assertNotNull(\n base,\n `Default base theme '${DEFAULT_DARK_THEME_KEY}' is not registered`\n );\n }\n\n log.debug('Applied themes:', base.themeKey, custom?.themeKey);\n\n return custom == null ? [base] : [base, custom];\n}\n\n/**\n * Get default base theme data.\n */\nexport function getDefaultBaseThemes(): ThemeData[] {\n return [\n {\n name: 'Default Dark',\n themeKey: DEFAULT_DARK_THEME_KEY,\n styleContent: themeDark,\n },\n {\n name: 'Default Light',\n themeKey: DEFAULT_LIGHT_THEME_KEY,\n styleContent: themeLight,\n },\n ];\n}\n\n/**\n * Get the preload data from local storage or null if it does not exist or is\n * invalid\n */\nexport function getThemePreloadData(): ThemePreloadData | null {\n const data = localStorage.getItem(THEME_CACHE_LOCAL_STORAGE_KEY);\n\n try {\n return data == null ? null : JSON.parse(data);\n } catch {\n // ignore\n }\n\n return null;\n}\n\n/**\n * Identifies start and end indices of any css variable expressions in the given\n * string.\n *\n * e.g.\n * getCssVariableRanges('var(--aaa-aa) var(--bbb-bb)')\n * yields:\n * [\n * [0, 12],\n * [14, 26],\n * ]\n *\n * In cases where there are nested expressions, only the indices of the outermost\n * expression will be included.\n *\n * e.g.\n * getCssVariableRanges('var(--ccc-cc, var(--aaa-aa, green)) var(--bbb-bb)')\n * yields:\n * [\n * [0, 34], // range for --ccc-cc expression\n * [36, 48], // range for --bbb-bb expression\n * ]\n * @param value The string to search for css variable expressions\n * @returns An array of [start, end] index pairs for each css variable expression\n */\nexport function getCssVariableRanges(value: string): [number, number][] {\n const ranges: [number, number][] = [];\n\n const cssVarPrefix = 'var(--';\n let start = value.indexOf(cssVarPrefix);\n let parenLevel = 0;\n\n while (start > -1) {\n parenLevel = 1;\n let i = start + cssVarPrefix.length;\n for (; i < value.length; i += 1) {\n if (value[i] === '(') {\n parenLevel += 1;\n } else if (value[i] === ')') {\n parenLevel -= 1;\n }\n\n if (parenLevel === 0) {\n ranges.push([start, i]);\n break;\n }\n }\n\n if (parenLevel !== 0) {\n log.error('Unbalanced parentheses in css var expression', value);\n return [];\n }\n\n start = value.indexOf(cssVarPrefix, i + 1);\n }\n\n return ranges;\n}\n\n/**\n * Make a copy of the given object replacing any css variable expressions\n * contained in its prop values with values resolved from the given HTML element.\n * Variables that resolve to color strings will also be normalized to rgb or\n * rgba color strings.\n *\n * Note that the browser will force a reflow when calling `getComputedStyle` if\n * css properties have changed. In order to avoid a reflow for every property\n * check we use distinct setup, resolve / normalize, and cleanup passes:\n * 1. Setup - Create a tmp element and set all css props we want to evaluate\n * 2. Resolve / Normalize - Evaluate all css props via `getPropertyValue` calls\n * and replace the original expressions with resolved values. Also normalize\n * css colors to rgb/a.\n * 3. Cleanup - Remove the tmp element\n * @param record An object whose values may contain css var expressions\n * @param targetElement The element to resolve css variables against. Defaults\n * to document.body\n */\nexport function resolveCssVariablesInRecord<T extends Record<string, string>>(\n record: T,\n targetElement: HTMLElement = document.body\n): T {\n const perfStart = performance.now();\n\n // Add a temporary div to attach temp css variables to\n const tmpPropEl = document.createElement('div');\n targetElement.appendChild(tmpPropEl);\n\n const varExpressions = [...extractDistinctCssVariableExpressions(record)];\n\n // Set temporary css variables for resolving var expressions\n varExpressions.forEach((varExpression, i) => {\n const tmpPropKey = `--${TMP_CSS_PROP_PREFIX}-${i}`;\n tmpPropEl.style.setProperty(tmpPropKey, varExpression);\n });\n\n const result = {} as T;\n\n const computedStyle = window.getComputedStyle(tmpPropEl);\n\n const resolver = (varExpression: string): string => {\n const tmpPropKey = `--${TMP_CSS_PROP_PREFIX}-${varExpressions.indexOf(\n varExpression\n )}`;\n\n const resolved = computedStyle.getPropertyValue(tmpPropKey);\n\n return ColorUtils.normalizeCssColor(resolved);\n };\n\n // Resolve the temporary css variables\n Object.entries(record).forEach(([key, value]) => {\n result[key as keyof T] = resolveCssVariablesInString(\n resolver,\n value\n ) as T[keyof T];\n });\n\n // Remove the temporary css variables\n tmpPropEl.remove();\n\n log.debug('Resolved css variables', performance.now() - perfStart, 'ms');\n\n return result;\n}\n\n/**\n * Resolve css variable expressions in the given string using the\n * given resolver and replace the original expressions with the resolved values.\n *\n * @param resolver Function that can resolve a css variable expression\n * @param value Value that may contain css variable expressions\n */\nexport function resolveCssVariablesInString(\n resolver: VarExpressionResolver,\n value: string\n): string {\n const result: string[] = [];\n let i = 0;\n getCssVariableRanges(value).forEach(([start, end]) => {\n if (i < start) {\n result.push(value.substring(i, start));\n i += start - i;\n }\n\n result.push(resolver(value.substring(start, end + 1)));\n\n i += end - start + 1;\n });\n\n if (result.length === 0) {\n return value;\n }\n\n return result.join('');\n}\n\n/**\n * Store theme preload data in local storage.\n * @param preloadData The preload data to set\n */\nexport function setThemePreloadData(preloadData: ThemePreloadData): void {\n localStorage.setItem(\n THEME_CACHE_LOCAL_STORAGE_KEY,\n JSON.stringify(preloadData)\n );\n}\n\n/**\n * Derive unique theme key from plugin root path and theme name.\n * @param pluginName The root path of the plugin\n * @param themeName The name of the theme\n */\nexport function getThemeKey(pluginName: string, themeName: string): string {\n return `${pluginName}_${themeName}`;\n}\n\n/**\n * Preload minimal theme variables from the cache.\n */\nexport function preloadTheme(): void {\n const preloadStyleContent =\n getThemePreloadData()?.preloadStyleContent ??\n calculatePreloadStyleContent();\n\n log.debug('Preloading theme content:', `'${preloadStyleContent}'`);\n\n const style = document.createElement('style');\n style.innerHTML = preloadStyleContent;\n document.head.appendChild(style);\n}\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,gBAAgB;AAChC,SAASC,aAAa,EAAEC,UAAU,QAAQ,kBAAkB;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA,SACSC,SAAS;AAAA,SACTC,UAAU;AAAA,SAEjBC,sBAAsB,EACtBC,uBAAuB,EACvBC,8BAA8B,EAK9BC,6BAA6B;AAG/B,IAAMC,GAAG,GAAGT,GAAG,CAACU,MAAM,CAAC,YAAY,CAAC;AAEpC,OAAO,IAAMC,mBAAmB,GAAG,QAAQ;AAI3C;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,4BAA4B,GAA6B;EACvE,IAAMC,SAAS,GAAGC,gBAAgB,CAACC,QAAQ,CAACC,IAAI,CAAC;;EAEjD;EACA;EACA,IAAMC,KAAK,GAAGC,MAAM,CAACC,OAAO,CA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AQ,CAACsD,aAAa,CAAC,OAAO,CAAC;EAC7CK,KAAK,CAACmB,SAAS,GAAGD,mBAAmB;EACrC7E,QAAQ,CAAC+E,IAAI,CAACxB,WAAW,CAACI,KAAK,CAAC;AAClC"}
|
|
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","log","module","TMP_CSS_PROP_PREFIX","calculatePreloadStyleContent","bodyStyle","getComputedStyle","document","body","pairs","Object","entries","map","_ref","key","defaultValue","concat","getPropertyValue","join","extractDistinctCssVariableExpressions","record","set","Set","values","forEach","value","getCssVariableRanges","_ref2","start","end","add","substring","getActiveThemes","themeKey","themeRegistration","_custom$baseThemeKey","custom","find","theme","baseThemeKey","base","error","debug","getDefaultBaseThemes","name","styleContent","getThemePreloadData","data","localStorage","getItem","JSON","parse","_unused","ranges","cssVarPrefix","indexOf","parenLevel","i","length","push","resolveCssVariablesInRecord","targetElement","arguments","undefined","perfStart","performance","now","tmpPropEl","createElement","appendChild","varExpressions","varExpression","tmpPropKey","style","setProperty","result","computedStyle","window","resolver","resolved","normalizeCssColor","_ref3","resolveCssVariablesInString","remove","_ref4","setThemePreloadData","preloadData","setItem","stringify","getThemeKey","pluginName","themeName","preloadTheme","_getThemePreloadData$","_getThemePreloadData","preloadStyleContent","innerHTML","head"],"sources":["../../src/theme/ThemeUtils.ts"],"sourcesContent":["import Log from '@deephaven/log';\nimport { assertNotNull, ColorUtils } from '@deephaven/utils';\n// Note that ?inline imports are natively supported by Vite, but consumers of\n// @deephaven/components using Webpack will need to add a rule to their module\n// config.\n// e.g.\n// module: {\n// rules: [\n// {\n// resourceQuery: /inline/,\n// type: 'asset/source',\n// },\n// ],\n// },\nimport { themeDark } from './theme-dark';\nimport { themeLight } from './theme-light';\nimport {\n DEFAULT_DARK_THEME_KEY,\n DEFAULT_LIGHT_THEME_KEY,\n DEFAULT_PRELOAD_DATA_VARIABLES,\n ThemeData,\n ThemePreloadData,\n ThemePreloadStyleContent,\n ThemeRegistrationData,\n THEME_CACHE_LOCAL_STORAGE_KEY,\n} from './ThemeModel';\n\nconst log = Log.module('ThemeUtils');\n\nexport const TMP_CSS_PROP_PREFIX = 'dh-tmp';\n\nexport type VarExpressionResolver = (varExpression: string) => string;\n\n/**\n * Creates a string containing preload style content for the current theme.\n * This resolves the current values of a few CSS variables that can be used\n * to style the page before the theme is loaded on next page load.\n */\nexport function calculatePreloadStyleContent(): ThemePreloadStyleContent {\n const bodyStyle = getComputedStyle(document.body);\n\n // Calculate the current preload variables. If the variable is not set, use\n // the default value.\n const pairs = Object.entries(DEFAULT_PRELOAD_DATA_VARIABLES).map(\n ([key, defaultValue]) =>\n `${key}:${bodyStyle.getPropertyValue(key) || defaultValue}`\n );\n\n return `:root{${pairs.join(';')}}`;\n}\n\n/**\n * Extracts all css variable expressions from the given record and returns\n * a set of unique expressions.\n * @param record The record to extract css variable expressions from\n */\nexport function extractDistinctCssVariableExpressions(\n record: Record<string, string>\n): Set<string> {\n const set = new Set<string>();\n\n Object.values(record).forEach(value => {\n getCssVariableRanges(value).forEach(([start, end]) => {\n set.add(value.substring(start, end + 1));\n });\n });\n\n return set;\n}\n\n/**\n * Returns an array of the active themes. The first item will always be one\n * of the base themes. Optionally, the second item will be a custom theme.\n */\nexport function getActiveThemes(\n themeKey: string,\n themeRegistration: ThemeRegistrationData\n): [ThemeData] | [ThemeData, ThemeData] {\n const custom = themeRegistration.custom.find(\n theme => theme.themeKey === themeKey\n );\n\n const baseThemeKey = custom?.baseThemeKey ?? themeKey;\n\n let base = themeRegistration.base.find(\n theme => theme.themeKey === baseThemeKey\n );\n\n if (base == null) {\n log.error(\n `No registered base theme found for theme key: '${baseThemeKey}'`,\n 'Registered:',\n themeRegistration.base.map(theme => theme.themeKey),\n themeRegistration.custom.map(theme => theme.themeKey)\n );\n base = themeRegistration.base.find(\n theme => theme.themeKey === DEFAULT_DARK_THEME_KEY\n );\n\n assertNotNull(\n base,\n `Default base theme '${DEFAULT_DARK_THEME_KEY}' is not registered`\n );\n }\n\n log.debug('Applied themes:', base.themeKey, custom?.themeKey);\n\n return custom == null ? [base] : [base, custom];\n}\n\n/**\n * Get default base theme data.\n */\nexport function getDefaultBaseThemes(): ThemeData[] {\n return [\n {\n name: 'Default Dark',\n themeKey: DEFAULT_DARK_THEME_KEY,\n styleContent: themeDark,\n },\n {\n name: 'Default Light',\n themeKey: DEFAULT_LIGHT_THEME_KEY,\n styleContent: themeLight,\n },\n ];\n}\n\n/**\n * Get the preload data from local storage or null if it does not exist or is\n * invalid\n */\nexport function getThemePreloadData(): ThemePreloadData | null {\n const data = localStorage.getItem(THEME_CACHE_LOCAL_STORAGE_KEY);\n\n try {\n return data == null ? null : JSON.parse(data);\n } catch {\n // ignore\n }\n\n return null;\n}\n\n/**\n * Identifies start and end indices of any css variable expressions in the given\n * string.\n *\n * e.g.\n * getCssVariableRanges('var(--aaa-aa) var(--bbb-bb)')\n * yields:\n * [\n * [0, 12],\n * [14, 26],\n * ]\n *\n * In cases where there are nested expressions, only the indices of the outermost\n * expression will be included.\n *\n * e.g.\n * getCssVariableRanges('var(--ccc-cc, var(--aaa-aa, green)) var(--bbb-bb)')\n * yields:\n * [\n * [0, 34], // range for --ccc-cc expression\n * [36, 48], // range for --bbb-bb expression\n * ]\n * @param value The string to search for css variable expressions\n * @returns An array of [start, end] index pairs for each css variable expression\n */\nexport function getCssVariableRanges(value: string): [number, number][] {\n const ranges: [number, number][] = [];\n\n const cssVarPrefix = 'var(--';\n let start = value.indexOf(cssVarPrefix);\n let parenLevel = 0;\n\n while (start > -1) {\n parenLevel = 1;\n let i = start + cssVarPrefix.length;\n for (; i < value.length; i += 1) {\n if (value[i] === '(') {\n parenLevel += 1;\n } else if (value[i] === ')') {\n parenLevel -= 1;\n }\n\n if (parenLevel === 0) {\n ranges.push([start, i]);\n break;\n }\n }\n\n if (parenLevel !== 0) {\n log.error('Unbalanced parentheses in css var expression', value);\n return [];\n }\n\n start = value.indexOf(cssVarPrefix, i + 1);\n }\n\n return ranges;\n}\n\n/**\n * Make a copy of the given object replacing any css variable expressions\n * contained in its prop values with values resolved from the given HTML element.\n * Variables that resolve to color strings will also be normalized to rgb or\n * rgba color strings.\n *\n * Note that the browser will force a reflow when calling `getComputedStyle` if\n * css properties have changed. In order to avoid a reflow for every property\n * check we use distinct setup, resolve / normalize, and cleanup passes:\n * 1. Setup - Create a tmp element and set all css props we want to evaluate\n * 2. Resolve / Normalize - Evaluate all css props via `getPropertyValue` calls\n * and replace the original expressions with resolved values. Also normalize\n * css colors to rgb/a.\n * 3. Cleanup - Remove the tmp element\n * @param record An object whose values may contain css var expressions\n * @param targetElement The element to resolve css variables against. Defaults\n * to document.body\n */\nexport function resolveCssVariablesInRecord<T extends Record<string, string>>(\n record: T,\n targetElement: HTMLElement = document.body\n): T {\n const perfStart = performance.now();\n\n // Add a temporary div to attach temp css variables to\n const tmpPropEl = document.createElement('div');\n targetElement.appendChild(tmpPropEl);\n\n const varExpressions = [...extractDistinctCssVariableExpressions(record)];\n\n // Set temporary css variables for resolving var expressions\n varExpressions.forEach((varExpression, i) => {\n const tmpPropKey = `--${TMP_CSS_PROP_PREFIX}-${i}`;\n tmpPropEl.style.setProperty(tmpPropKey, varExpression);\n });\n\n const result = {} as T;\n\n const computedStyle = window.getComputedStyle(tmpPropEl);\n\n const resolver = (varExpression: string): string => {\n const tmpPropKey = `--${TMP_CSS_PROP_PREFIX}-${varExpressions.indexOf(\n varExpression\n )}`;\n\n const resolved = computedStyle.getPropertyValue(tmpPropKey);\n\n return ColorUtils.normalizeCssColor(resolved);\n };\n\n // Resolve the temporary css variables\n Object.entries(record).forEach(([key, value]) => {\n result[key as keyof T] = resolveCssVariablesInString(\n resolver,\n value\n ) as T[keyof T];\n });\n\n // Remove the temporary css variables\n tmpPropEl.remove();\n\n log.debug('Resolved css variables', performance.now() - perfStart, 'ms');\n\n return result;\n}\n\n/**\n * Resolve css variable expressions in the given string using the\n * given resolver and replace the original expressions with the resolved values.\n *\n * @param resolver Function that can resolve a css variable expression\n * @param value Value that may contain css variable expressions\n */\nexport function resolveCssVariablesInString(\n resolver: VarExpressionResolver,\n value: string\n): string {\n const result: string[] = [];\n let i = 0;\n getCssVariableRanges(value).forEach(([start, end]) => {\n if (i < start) {\n result.push(value.substring(i, start));\n i += start - i;\n }\n\n result.push(resolver(value.substring(start, end + 1)));\n\n i += end - start + 1;\n });\n\n if (result.length === 0) {\n return value;\n }\n\n return result.join('');\n}\n\n/**\n * Store theme preload data in local storage.\n * @param preloadData The preload data to set\n */\nexport function setThemePreloadData(preloadData: ThemePreloadData): void {\n localStorage.setItem(\n THEME_CACHE_LOCAL_STORAGE_KEY,\n JSON.stringify(preloadData)\n );\n}\n\n/**\n * Derive unique theme key from plugin root path and theme name.\n * @param pluginName The root path of the plugin\n * @param themeName The name of the theme\n */\nexport function getThemeKey(pluginName: string, themeName: string): string {\n return `${pluginName}_${themeName}`;\n}\n\n/**\n * Preload minimal theme variables from the cache.\n */\nexport function preloadTheme(): void {\n const preloadStyleContent =\n getThemePreloadData()?.preloadStyleContent ??\n calculatePreloadStyleContent();\n\n log.debug('Preloading theme content:', `'${preloadStyleContent}'`);\n\n const style = document.createElement('style');\n style.innerHTML = preloadStyleContent;\n document.head.appendChild(style);\n}\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,gBAAgB;AAChC,SAASC,aAAa,EAAEC,UAAU,QAAQ,kBAAkB;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA,SACSC,SAAS;AAAA,SACTC,UAAU;AAAA,SAEjBC,sBAAsB,EACtBC,uBAAuB,EACvBC,8BAA8B,EAK9BC,6BAA6B;AAG/B,IAAMC,GAAG,GAAGT,GAAG,CAACU,MAAM,CAAC,YAAY,CAAC;AAEpC,OAAO,IAAMC,m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EACd;EAEA,OAAOkD,MAAM,CAACzD,IAAI,CAAC,EAAE,CAAC;AACxB;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASmE,mBAAmBA,CAACC,WAA6B,EAAQ;EACvEtC,YAAY,CAACuC,OAAO,CAClBvF,6BAA6B,EAC7BkD,IAAI,CAACsC,SAAS,CAACF,WAAW,CAC5B,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,WAAWA,CAACC,UAAkB,EAAEC,SAAiB,EAAU;EACzE,UAAA3E,MAAA,CAAU0E,UAAU,OAAA1E,MAAA,CAAI2E,SAAS;AACnC;;AAEA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAAA,EAAS;EAAA,IAAAC,qBAAA,EAAAC,oBAAA;EACnC,IAAMC,mBAAmB,IAAAF,qBAAA,IAAAC,oBAAA,GACvBhD,mBAAmB,CAAC,CAAC,cAAAgD,oBAAA,uBAArBA,oBAAA,CAAuBC,mBAAmB,cAAAF,qBAAA,cAAAA,qBAAA,GAC1CzF,4BAA4B,CAAC,CAAC;EAEhCH,GAAG,CAACyC,KAAK,CAAC,2BAA2B,MAAA1B,MAAA,CAAM+E,mBAAmB,MAAG,CAAC;EAElE,IAAMtB,KAAK,GAAGlE,QAAQ,CAAC6D,aAAa,CAAC,OAAO,CAAC;EAC7CK,KAAK,CAACuB,SAAS,GAAGD,mBAAmB;EACrCxF,QAAQ,CAAC0F,IAAI,CAAC5B,WAAW,CAACI,KAAK,CAAC;AAClC"}
|
|
@@ -1,3 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DH theme variables are imported via Vite `?raw` query which provides the
|
|
3
|
+
* text content of the variable files as a string. The exported theme is just a
|
|
4
|
+
* concatenation of the contents of all of these imports.
|
|
5
|
+
*
|
|
6
|
+
* Note that ?raw / ?inline imports are natively supported by Vite, but consumers
|
|
7
|
+
* of @deephaven/components using Webpack will need to add a rule to their module
|
|
8
|
+
* config.
|
|
9
|
+
* e.g.
|
|
10
|
+
* module: {
|
|
11
|
+
* rules: [
|
|
12
|
+
* {
|
|
13
|
+
* resourceQuery: /inline/,
|
|
14
|
+
* type: 'asset/source',
|
|
15
|
+
* },
|
|
16
|
+
* ],
|
|
17
|
+
* },
|
|
18
|
+
*
|
|
19
|
+
* e.g.
|
|
20
|
+
*
|
|
21
|
+
* :root {
|
|
22
|
+
* --dh-color-from-dark-palette: #fff;
|
|
23
|
+
* --dh-color-from-dark-palette2: #ccc;
|
|
24
|
+
* }
|
|
25
|
+
* :root {
|
|
26
|
+
* --dh-color-from-dark-semantic: #000;
|
|
27
|
+
* }
|
|
28
|
+
* :root {
|
|
29
|
+
* --dh-color-from-dark-semantic-editor: #000;
|
|
30
|
+
* }
|
|
31
|
+
* :root {
|
|
32
|
+
* --dh-color-from-dark-semantic-grid: #000;
|
|
33
|
+
* }
|
|
34
|
+
* :root {
|
|
35
|
+
* --dh-color-from-dark-components: #000;
|
|
36
|
+
* }
|
|
37
|
+
*/
|
|
1
38
|
export declare const themeDark: string;
|
|
2
39
|
export default themeDark;
|
|
3
40
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/theme/theme-dark/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/theme/theme-dark/index.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,eAAO,MAAM,SAAS,QAMV,CAAC;AAEb,eAAe,SAAS,CAAC"}
|
|
@@ -1,7 +1,45 @@
|
|
|
1
|
-
import themeDarkPalette from "./theme-dark-palette.css?
|
|
2
|
-
import themeDarkSemantic from "./theme-dark-semantic.css?
|
|
3
|
-
import themeDarkSemanticEditor from "./theme-dark-semantic-editor.css?
|
|
4
|
-
import themeDarkSemanticGrid from "./theme-dark-semantic-grid.css?
|
|
5
|
-
|
|
1
|
+
import themeDarkPalette from "./theme-dark-palette.css?raw";
|
|
2
|
+
import themeDarkSemantic from "./theme-dark-semantic.css?raw";
|
|
3
|
+
import themeDarkSemanticEditor from "./theme-dark-semantic-editor.css?raw";
|
|
4
|
+
import themeDarkSemanticGrid from "./theme-dark-semantic-grid.css?raw";
|
|
5
|
+
import themeDarkComponents from "./theme-dark-components.css?raw";
|
|
6
|
+
/**
|
|
7
|
+
* DH theme variables are imported via Vite `?raw` query which provides the
|
|
8
|
+
* text content of the variable files as a string. The exported theme is just a
|
|
9
|
+
* concatenation of the contents of all of these imports.
|
|
10
|
+
*
|
|
11
|
+
* Note that ?raw / ?inline imports are natively supported by Vite, but consumers
|
|
12
|
+
* of @deephaven/components using Webpack will need to add a rule to their module
|
|
13
|
+
* config.
|
|
14
|
+
* e.g.
|
|
15
|
+
* module: {
|
|
16
|
+
* rules: [
|
|
17
|
+
* {
|
|
18
|
+
* resourceQuery: /inline/,
|
|
19
|
+
* type: 'asset/source',
|
|
20
|
+
* },
|
|
21
|
+
* ],
|
|
22
|
+
* },
|
|
23
|
+
*
|
|
24
|
+
* e.g.
|
|
25
|
+
*
|
|
26
|
+
* :root {
|
|
27
|
+
* --dh-color-from-dark-palette: #fff;
|
|
28
|
+
* --dh-color-from-dark-palette2: #ccc;
|
|
29
|
+
* }
|
|
30
|
+
* :root {
|
|
31
|
+
* --dh-color-from-dark-semantic: #000;
|
|
32
|
+
* }
|
|
33
|
+
* :root {
|
|
34
|
+
* --dh-color-from-dark-semantic-editor: #000;
|
|
35
|
+
* }
|
|
36
|
+
* :root {
|
|
37
|
+
* --dh-color-from-dark-semantic-grid: #000;
|
|
38
|
+
* }
|
|
39
|
+
* :root {
|
|
40
|
+
* --dh-color-from-dark-components: #000;
|
|
41
|
+
* }
|
|
42
|
+
*/
|
|
43
|
+
export var themeDark = [themeDarkPalette, themeDarkSemantic, themeDarkSemanticEditor, themeDarkSemanticGrid, themeDarkComponents].join('\n');
|
|
6
44
|
export default themeDark;
|
|
7
45
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["themeDarkPalette","themeDarkSemantic","themeDarkSemanticEditor","themeDarkSemanticGrid","themeDark","join"],"sources":["../../../src/theme/theme-dark/index.ts"],"sourcesContent":["import themeDarkPalette from './theme-dark-palette.css?
|
|
1
|
+
{"version":3,"file":"index.js","names":["themeDarkPalette","themeDarkSemantic","themeDarkSemanticEditor","themeDarkSemanticGrid","themeDarkComponents","themeDark","join"],"sources":["../../../src/theme/theme-dark/index.ts"],"sourcesContent":["import themeDarkPalette from './theme-dark-palette.css?raw';\nimport themeDarkSemantic from './theme-dark-semantic.css?raw';\nimport themeDarkSemanticEditor from './theme-dark-semantic-editor.css?raw';\nimport themeDarkSemanticGrid from './theme-dark-semantic-grid.css?raw';\nimport themeDarkComponents from './theme-dark-components.css?raw';\n\n/**\n * DH theme variables are imported via Vite `?raw` query which provides the\n * text content of the variable files as a string. The exported theme is just a\n * concatenation of the contents of all of these imports.\n *\n * Note that ?raw / ?inline imports are natively supported by Vite, but consumers\n * of @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 * },\n *\n * e.g.\n *\n * :root {\n * --dh-color-from-dark-palette: #fff;\n * --dh-color-from-dark-palette2: #ccc;\n * }\n * :root {\n * --dh-color-from-dark-semantic: #000;\n * }\n * :root {\n * --dh-color-from-dark-semantic-editor: #000;\n * }\n * :root {\n * --dh-color-from-dark-semantic-grid: #000;\n * }\n * :root {\n * --dh-color-from-dark-components: #000;\n * }\n */\nexport const themeDark = [\n themeDarkPalette,\n themeDarkSemantic,\n themeDarkSemanticEditor,\n themeDarkSemanticGrid,\n themeDarkComponents,\n].join('\\n');\n\nexport default themeDark;\n"],"mappings":"OAAOA,gBAAgB;AAAA,OAChBC,iBAAiB;AAAA,OACjBC,uBAAuB;AAAA,OACvBC,qBAAqB;AAAA,OACrBC,mBAAmB;AAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,SAAS,GAAG,CACvBL,gBAAgB,EAChBC,iBAAiB,EACjBC,uBAAuB,EACvBC,qBAAqB,EACrBC,mBAAmB,CACpB,CAACE,IAAI,CAAC,IAAI,CAAC;AAEZ,eAAeD,SAAS"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* stylelint-disable alpha-value-notation */
|
|
2
|
+
:root {
|
|
3
|
+
--dh-color-quickactions-bg: hsla(var(--dh-color-gray-hue), 0%, 11%, 0.9);
|
|
4
|
+
--dh-color-radial-reaction: hsla(var(--dh-color-gray-hue), 0%, 92%, 0.6);
|
|
5
|
+
--dh-color-colorpicker-border: hsla(var(--dh-color-gray-hue), 0%, 94%, 0.1);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/*# sourceMappingURL=theme-dark-components.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../../../src/theme/theme-dark/theme-dark-components.css"],"names":[],"mappings":"AAAA;AACA;EACE;EACA;EACA","file":"theme-dark-components.css","sourcesContent":["/* stylelint-disable alpha-value-notation */\n:root {\n --dh-color-quickactions-bg: hsla(var(--dh-color-gray-hue), 0%, 11%, 0.9);\n --dh-color-radial-reaction: hsla(var(--dh-color-gray-hue), 0%, 92%, 0.6);\n --dh-color-colorpicker-border: hsla(var(--dh-color-gray-hue), 0%, 94%, 0.1);\n}\n"]}
|
|
@@ -32,6 +32,21 @@
|
|
|
32
32
|
--dh-color-accent-background-hover: var(--dh-color-accent-500);
|
|
33
33
|
--dh-color-accent-background-down: var(--dh-color-accent-400);
|
|
34
34
|
--dh-color-accent-background-key-focus: var(--dh-color-accent-500);
|
|
35
|
+
/* Background Defaults */
|
|
36
|
+
--dh-color-default-gray-bg: var(--dh-color-gray-700);
|
|
37
|
+
--dh-color-default-blue-bg: var(--dh-color-blue-700);
|
|
38
|
+
--dh-color-default-red-bg: var(--dh-color-red-700);
|
|
39
|
+
--dh-color-default-orange-bg: var(--dh-color-orange-800);
|
|
40
|
+
--dh-color-default-yellow-bg: var(--dh-color-yellow-1000);
|
|
41
|
+
--dh-color-default-chartreuse-bg: var(--dh-color-chartreuse-900);
|
|
42
|
+
--dh-color-default-celery-bg: var(--dh-color-celery-800);
|
|
43
|
+
--dh-color-default-green-bg: var(--dh-color-green-700);
|
|
44
|
+
--dh-color-default-seafoam-bg: var(--dh-color-seafoam-700);
|
|
45
|
+
--dh-color-default-cyan-bg: var(--dh-color-cyan-700);
|
|
46
|
+
--dh-color-default-indigo-bg: var(--dh-color-indigo-700);
|
|
47
|
+
--dh-color-default-purple-bg: var(--dh-color-purple-700);
|
|
48
|
+
--dh-color-default-fuchsia-bg: var(--dh-color-fuchsia-700);
|
|
49
|
+
--dh-color-default-magenta-bg: var(--dh-color-magenta-700);
|
|
35
50
|
/* Focus */
|
|
36
51
|
--dh-color-focus: var(--dh-color-blue-800);
|
|
37
52
|
--dh-color-focus-border: var(--dh-color-blue-800);
|
|
@@ -47,11 +62,39 @@
|
|
|
47
62
|
62%,
|
|
48
63
|
0.2
|
|
49
64
|
);
|
|
65
|
+
/* Shadows / Overlays */
|
|
66
|
+
--dh-color-dropshadow: hsla(var(--dh-color-gray-hue), 0, 0, 0.8);
|
|
67
|
+
--dh-color-overlay-modal-bg: hsla(var(--dh-color-gray-hue), 0%, 0%, 0.6);
|
|
68
|
+
--dh-color-overlay-hover-bg: hsla(var(--dh-color-gray-hue), 0%, 100%, 0.08);
|
|
50
69
|
/* Negative Background */
|
|
51
|
-
--dh-color-negative-
|
|
52
|
-
--dh-color-negative-
|
|
53
|
-
--dh-color-negative-
|
|
54
|
-
--dh-color-negative-
|
|
70
|
+
--dh-color-negative-default-bg: var(--dh-color-red-600);
|
|
71
|
+
--dh-color-negative-hover-bg: var(--dh-color-red-500);
|
|
72
|
+
--dh-color-negative-down-bg: var(--dh-color-red-400);
|
|
73
|
+
--dh-color-negative-key-focus-bg: var(--dh-color-red-500);
|
|
74
|
+
/* Neutral */
|
|
75
|
+
--dh-neutral-default-bg: var(--dh-color-gray-500);
|
|
76
|
+
--dh-neutral-hover-bg: var(--dh-color-gray-400);
|
|
77
|
+
--dh-neutral-down-bg: var(--dh-color-gray-300);
|
|
78
|
+
--dh-neutral-key-focus-bg: var(--dh-color-gray-400);
|
|
79
|
+
--dh-neutral-subdued-default-bg: var(--dh-color-gray-400);
|
|
80
|
+
--dh-neutral-subdued-hover-bg: var(--dh-color-gray-300);
|
|
81
|
+
--dh-neutral-subdued-down-bg: var(--dh-color-gray-200);
|
|
82
|
+
--dh-neutral-subdued-key-focus-bg: var(--dh-color-gray-300);
|
|
83
|
+
/* Positive */
|
|
84
|
+
--dh-color-positive-default-bg: var(--dh-color-green-900);
|
|
85
|
+
--dh-color-positive-hover-bg: var(--dh-color-green-800);
|
|
86
|
+
--dh-color-positive-down-bg: var(--dh-color-green-700);
|
|
87
|
+
--dh-color-positive-key-focus-bg: var(--dh-color-green-800);
|
|
88
|
+
/* Informative */
|
|
89
|
+
--dh-color-info-default-bg: var(--dh-color-cyan-1000);
|
|
90
|
+
--dh-color-info-hover-bg: var(--dh-color-cyan-900);
|
|
91
|
+
--dh-color-info-down-bg: var(--dh-color-cyan-800);
|
|
92
|
+
--dh-color-info-key-focus-bg: var(--dh-color-cyan-900);
|
|
93
|
+
/* Notice */
|
|
94
|
+
--dh-color-notice-default-bg: var(--dh-color-yellow-1000);
|
|
95
|
+
--dh-color-notice-hover-bg: var(--dh-color-yellow-900);
|
|
96
|
+
--dh-color-notice-down-bg: var(--dh-color-yellow-800);
|
|
97
|
+
--dh-color-notice-key-focus-bg: var(--dh-color-yellow-1000);
|
|
55
98
|
/* Visual Colors */
|
|
56
99
|
--dh-color-visual-blue: var(--dh-color-blue-700);
|
|
57
100
|
--dh-color-visual-celery: var(--dh-color-celery-1000);
|
|
@@ -70,6 +113,10 @@
|
|
|
70
113
|
--dh-color-visual-positive: var(--dh-color-green-1100);
|
|
71
114
|
--dh-color-visual-negative: var(--dh-color-red-800);
|
|
72
115
|
--dh-color-visual-notice: var(--dh-color-yellow-1200);
|
|
116
|
+
--dh-color-visual-info: var(--dh-color-cyan-1100);
|
|
117
|
+
/* Wells */
|
|
118
|
+
--dh-color-well-bg: hsla(var(--dh-color-gray-hue) 0% 92% 0.02);
|
|
119
|
+
--dh-color-well-border: hsla(var(--dh-color-gray-hue) 0% 94% 0.05);
|
|
73
120
|
}
|
|
74
121
|
|
|
75
122
|
/*# sourceMappingURL=theme-dark-semantic.css.map */
|