@deephaven/components 0.22.3-beta.11 → 0.22.3-beta.18
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.
|
@@ -6,7 +6,7 @@ export declare type MenuItem = ContextAction | Promise<ContextAction[]>;
|
|
|
6
6
|
export interface ContextAction {
|
|
7
7
|
title?: string;
|
|
8
8
|
description?: string;
|
|
9
|
-
action?(event?:
|
|
9
|
+
action?(event?: Event): void;
|
|
10
10
|
actions?: ResolvableContextAction[];
|
|
11
11
|
icon?: IconDefinition | React.ReactElement;
|
|
12
12
|
iconColor?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextActionUtils.d.ts","sourceRoot":"","sources":["../../src/context-actions/ContextActionUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,oBAAY,uBAAuB,GAC/B,aAAa,GACb,OAAO,CAAC,aAAa,EAAE,CAAC,GACxB,CAAC,MAAM,OAAO,CAAC,aAAa,EAAE,CAAC,GAAG,aAAa,EAAE,GAAG,aAAa,CAAC,CAAC;AAEvE,oBAAY,QAAQ,GAAG,aAAa,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;AAEhE,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,CAAC,KAAK,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"ContextActionUtils.d.ts","sourceRoot":"","sources":["../../src/context-actions/ContextActionUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,QAA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CAAC,CAAC,EAAE,UAAU,GAAG,CAAC,IAAI,kBAAkB;IAInE;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,aAAa,GAAG,MAAM;IAoBjE;;;OAGG;IACH,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,aAAa,EAAE;IAU7D,MAAM,CAAC,aAAa,IAAI,OAAO;IAK/B;;OAEG;IACH,MAAM,CAAC,cAAc,IAAI,SAAS,GAAG,SAAS;IAQ9C;;;OAGG;IACH,MAAM,CAAC,iBAAiB,CACtB,KAAK,EAAE,aAAa,GAAG,UAAU,GAAG,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC,UAAU,GACzE,OAAO;IAKV;;;;OAIG;IACH,MAAM,CAAC,YAAY,CACjB,YAAY,EAAE,uBAAuB,GAAG,uBAAuB,EAAE,EACjE,eAAe,CAAC,EAAE,IAAI,GACrB,QAAQ,EAAE;IAGb,MAAM,CAAC,YAAY,CACjB,YAAY,EAAE,uBAAuB,GAAG,uBAAuB,EAAE,EACjE,eAAe,EAAE,KAAK,GACrB,aAAa,EAAE;IA+ClB;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CACpB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,EACb,SAAS,EAAE,QAAQ,EAAE,GACpB,MAAM;CAiBV;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextActionUtils.js","names":["isPromise","value","then","undefined","ContextActionUtils","disableAllActions","actionsDisabled","enableAllActions","isContextActionEvent","e","Array","isArray","contextActions","compareActions","a","b","group","order","title","sortActions","actions","sortedActions","slice","sort","isMacPlatform","platform","window","navigator","startsWith","getModifierKey","isModifierKeyDown","event","modifierKey","getMenuItems","actionsParam","includePromises","menuItems","i","length","action","newMenuItems","Promise","push","concat","filter","menuElement","getNextMenuItem","startIndex","delta","firstIndex","menuIndex","item","disabled"],"sources":["../../src/context-actions/ContextActionUtils.ts"],"sourcesContent":["import { IconDefinition } from '@deephaven/icons';\nimport React from 'react';\nimport type { Shortcut } from '../shortcuts';\n\nexport type ResolvableContextAction =\n | ContextAction\n | Promise<ContextAction[]>\n | (() => Promise<ContextAction[]> | ContextAction[] | ContextAction);\n\nexport type MenuItem = ContextAction | Promise<ContextAction[]>;\n\nexport interface ContextAction {\n title?: string;\n description?: string;\n action?(event?: KeyboardEvent): void;\n actions?: ResolvableContextAction[];\n icon?: IconDefinition | React.ReactElement;\n iconColor?: string;\n shortcut?: Shortcut;\n isGlobal?: boolean;\n group?: number;\n order?: number;\n disabled?: boolean;\n menuElement?: React.ReactElement;\n iconOutline?: boolean;\n}\n\nexport interface ContextActionEvent extends MouseEvent {\n contextActions: ResolvableContextAction[];\n}\n\nexport function isPromise<A, T>(value: A | Promise<T>): value is Promise<T> {\n return (value as Promise<T>).then !== undefined;\n}\n\nclass ContextActionUtils {\n static actionsDisabled = false;\n\n static disableAllActions(): void {\n ContextActionUtils.actionsDisabled = true;\n }\n\n static enableAllActions(): void {\n ContextActionUtils.actionsDisabled = false;\n }\n\n static isContextActionEvent(e: MouseEvent): e is ContextActionEvent {\n return Array.isArray((e as ContextActionEvent).contextActions);\n }\n\n /**\n * Compare two action items. Useful in Array.sort\n * @param a First context action to compare\n * @param b Second context action to compare\n */\n static compareActions(a: ContextAction, b: ContextAction): number {\n if (a.group !== b.group) {\n return (a.group ?? 0) > (b.group ?? 0) ? 1 : -1;\n }\n\n if (a.order !== b.order) {\n return (a.order ?? 0) > (b.order ?? 0) ? 1 : -1;\n }\n\n if (a.title !== b.title) {\n return (a.title ?? '') > (b.title ?? '') ? 1 : -1;\n }\n\n if (a !== b) {\n return a > b ? 1 : -1;\n }\n\n return 0;\n }\n\n /**\n *\n * @param actions The array of actions to sort\n */\n static sortActions(actions: ContextAction[]): ContextAction[] {\n if (actions == null || !Array.isArray(actions)) {\n return [];\n }\n\n const sortedActions = actions.slice();\n sortedActions.sort(ContextActionUtils.compareActions);\n return sortedActions;\n }\n\n static isMacPlatform(): boolean {\n const { platform } = window.navigator;\n return platform.startsWith('Mac');\n }\n\n /**\n * Retrieve the preferred modifier key based on the current platform\n */\n static getModifierKey(): 'metaKey' | 'ctrlKey' {\n if (ContextActionUtils.isMacPlatform()) {\n return 'metaKey';\n }\n\n return 'ctrlKey';\n }\n\n /**\n * Returns true if the modifier key for the current platform is down for the event (Ctrl for windows/linux, Command (meta) for mac)\n * @param event The event to get the meta key status from\n */\n static isModifierKeyDown(\n event: KeyboardEvent | MouseEvent | React.KeyboardEvent | React.MouseEvent\n ): boolean {\n const modifierKey = ContextActionUtils.getModifierKey();\n return event[modifierKey];\n }\n\n /**\n * Returns the menu items for the provided context actions, or empty array if none found.\n * @param actionsParam The actions to get menu items for\n * @param includePromises Whether or not to include promises in the returned menu items\n */\n static getMenuItems(\n actionsParam: ResolvableContextAction | ResolvableContextAction[],\n includePromises?: true\n ): MenuItem[];\n\n // If ignoring promises, then the return type is narrowed\n static getMenuItems(\n actionsParam: ResolvableContextAction | ResolvableContextAction[],\n includePromises: false\n ): ContextAction[];\n\n static getMenuItems(\n actionsParam: ResolvableContextAction | ResolvableContextAction[],\n includePromises = true\n ): MenuItem[] {\n let menuItems: MenuItem[] = [];\n let actions = actionsParam;\n if (!Array.isArray(actions)) {\n actions = [actions];\n }\n\n for (let i = 0; i < actions.length; i += 1) {\n const action = actions[i];\n let newMenuItems:\n | ContextAction\n | ContextAction[]\n | Promise<ContextAction[]>;\n if (typeof action === 'function') {\n newMenuItems = action();\n } else {\n newMenuItems = action;\n }\n\n if (newMenuItems != null) {\n if (newMenuItems instanceof Promise) {\n if (includePromises) {\n menuItems.push(newMenuItems);\n }\n } else if (Array.isArray(newMenuItems)) {\n menuItems = menuItems.concat(newMenuItems);\n } else {\n menuItems.push(newMenuItems);\n }\n }\n }\n\n menuItems = menuItems.filter(\n action =>\n (action as ContextAction).title !== undefined ||\n (action as Promise<ContextAction[]>).then ||\n (action as ContextAction).menuElement\n );\n\n return menuItems;\n }\n\n /**\n * Returns the index of the next menu item in a list that doesn't have a disabled=true prop\n * @param startIndex the starting position for the iteration\n * @param delta the direction of travel, -1 or 1\n * @param menuItems an array of menuItems\n */\n static getNextMenuItem(\n startIndex: number,\n delta: -1 | 1,\n menuItems: MenuItem[]\n ): number {\n let firstIndex = startIndex;\n if (firstIndex < 0 && delta < 0) {\n // if menu index is -1 and delta -1 manually set start point\n firstIndex = menuItems.length;\n }\n // find the next non disabled menu option, iterating the list only once\n for (let i = 1; i < menuItems.length + 1; i += 1) {\n const menuIndex =\n (firstIndex + delta * i + menuItems.length) % menuItems.length;\n const item = menuItems[menuIndex];\n if (!(item instanceof Promise) && item.disabled !== true) {\n return menuIndex;\n }\n }\n return startIndex;\n }\n}\n\nexport default ContextActionUtils;\n"],"mappings":";;AA+BA,OAAO,SAASA,SAAT,CAAyBC,KAAzB,EAAqE;EAC1E,OAAQA,KAAD,CAAsBC,IAAtB,KAA+BC,SAAtC;AACD;;AAED,MAAMC,kBAAN,CAAyB;EAGC,OAAjBC,iBAAiB,GAAS;IAC/BD,kBAAkB,CAACE,eAAnB,GAAqC,IAArC;EACD;;EAEsB,OAAhBC,gBAAgB,GAAS;IAC9BH,kBAAkB,CAACE,eAAnB,GAAqC,KAArC;EACD;;EAE0B,OAApBE,oBAAoB,CAACC,CAAD,EAAyC;IAClE,OAAOC,KAAK,CAACC,OAAN,CAAeF,CAAD,CAA0BG,cAAxC,CAAP;EACD;EAED;AACF;AACA;AACA;AACA;;;EACuB,OAAdC,cAAc,CAACC,CAAD,EAAmBC,CAAnB,EAA6C;IAChE,IAAID,CAAC,CAACE,KAAF,KAAYD,CAAC,CAACC,KAAlB,EAAyB;MAAA;;MACvB,OAAO,aAACF,CAAC,CAACE,KAAH,+CAAY,CAAZ,iBAAkBD,CAAC,CAACC,KAApB,+CAA6B,CAA7B,IAAkC,CAAlC,GAAsC,CAAC,CA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EACwB,OAAfU,eAAe,CACpBC,UADoB,EAEpBC,KAFoB,EAGpBZ,SAHoB,EAIZ;IACR,IAAIa,UAAU,GAAGF,UAAjB;;IACA,IAAIE,UAAU,GAAG,CAAb,IAAkBD,KAAK,GAAG,CAA9B,EAAiC;MAC/B;MACAC,UAAU,GAAGb,SAAS,CAACE,MAAvB;IACD,CALO,CAMR;;;IACA,KAAK,IAAID,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,SAAS,CAACE,MAAV,GAAmB,CAAvC,EAA0CD,CAAC,IAAI,CAA/C,EAAkD;MAChD,IAAMa,SAAS,GACb,CAACD,UAAU,GAAGD,KAAK,GAAGX,CAArB,GAAyBD,SAAS,CAACE,MAApC,IAA8CF,SAAS,CAACE,MAD1D;MAEA,IAAMa,IAAI,GAAGf,SAAS,CAACc,SAAD,CAAtB;;MACA,IAAI,EAAEC,IAAI,YAAYV,OAAlB,KAA8BU,IAAI,CAACC,QAAL,KAAkB,IAApD,EAA0D;QACxD,OAAOF,SAAP;MACD;IACF;;IACD,OAAOH,UAAP;EACD;;AAxKsB;;gBAAnB3C,kB,qBACqB,K;;AA0K3B,eAAeA,kBAAf"}
|
|
1
|
+
{"version":3,"file":"ContextActionUtils.js","names":["isPromise","value","then","undefined","ContextActionUtils","disableAllActions","actionsDisabled","enableAllActions","isContextActionEvent","e","Array","isArray","contextActions","compareActions","a","b","group","order","title","sortActions","actions","sortedActions","slice","sort","isMacPlatform","platform","window","navigator","startsWith","getModifierKey","isModifierKeyDown","event","modifierKey","getMenuItems","actionsParam","includePromises","menuItems","i","length","action","newMenuItems","Promise","push","concat","filter","menuElement","getNextMenuItem","startIndex","delta","firstIndex","menuIndex","item","disabled"],"sources":["../../src/context-actions/ContextActionUtils.ts"],"sourcesContent":["import { IconDefinition } from '@deephaven/icons';\nimport React from 'react';\nimport type { Shortcut } from '../shortcuts';\n\nexport type ResolvableContextAction =\n | ContextAction\n | Promise<ContextAction[]>\n | (() => Promise<ContextAction[]> | ContextAction[] | ContextAction);\n\nexport type MenuItem = ContextAction | Promise<ContextAction[]>;\n\nexport interface ContextAction {\n title?: string;\n description?: string;\n action?(event?: Event): void;\n actions?: ResolvableContextAction[];\n icon?: IconDefinition | React.ReactElement;\n iconColor?: string;\n shortcut?: Shortcut;\n isGlobal?: boolean;\n group?: number;\n order?: number;\n disabled?: boolean;\n menuElement?: React.ReactElement;\n iconOutline?: boolean;\n}\n\nexport interface ContextActionEvent extends MouseEvent {\n contextActions: ResolvableContextAction[];\n}\n\nexport function isPromise<A, T>(value: A | Promise<T>): value is Promise<T> {\n return (value as Promise<T>).then !== undefined;\n}\n\nclass ContextActionUtils {\n static actionsDisabled = false;\n\n static disableAllActions(): void {\n ContextActionUtils.actionsDisabled = true;\n }\n\n static enableAllActions(): void {\n ContextActionUtils.actionsDisabled = false;\n }\n\n static isContextActionEvent(e: MouseEvent): e is ContextActionEvent {\n return Array.isArray((e as ContextActionEvent).contextActions);\n }\n\n /**\n * Compare two action items. Useful in Array.sort\n * @param a First context action to compare\n * @param b Second context action to compare\n */\n static compareActions(a: ContextAction, b: ContextAction): number {\n if (a.group !== b.group) {\n return (a.group ?? 0) > (b.group ?? 0) ? 1 : -1;\n }\n\n if (a.order !== b.order) {\n return (a.order ?? 0) > (b.order ?? 0) ? 1 : -1;\n }\n\n if (a.title !== b.title) {\n return (a.title ?? '') > (b.title ?? '') ? 1 : -1;\n }\n\n if (a !== b) {\n return a > b ? 1 : -1;\n }\n\n return 0;\n }\n\n /**\n *\n * @param actions The array of actions to sort\n */\n static sortActions(actions: ContextAction[]): ContextAction[] {\n if (actions == null || !Array.isArray(actions)) {\n return [];\n }\n\n const sortedActions = actions.slice();\n sortedActions.sort(ContextActionUtils.compareActions);\n return sortedActions;\n }\n\n static isMacPlatform(): boolean {\n const { platform } = window.navigator;\n return platform.startsWith('Mac');\n }\n\n /**\n * Retrieve the preferred modifier key based on the current platform\n */\n static getModifierKey(): 'metaKey' | 'ctrlKey' {\n if (ContextActionUtils.isMacPlatform()) {\n return 'metaKey';\n }\n\n return 'ctrlKey';\n }\n\n /**\n * Returns true if the modifier key for the current platform is down for the event (Ctrl for windows/linux, Command (meta) for mac)\n * @param event The event to get the meta key status from\n */\n static isModifierKeyDown(\n event: KeyboardEvent | MouseEvent | React.KeyboardEvent | React.MouseEvent\n ): boolean {\n const modifierKey = ContextActionUtils.getModifierKey();\n return event[modifierKey];\n }\n\n /**\n * Returns the menu items for the provided context actions, or empty array if none found.\n * @param actionsParam The actions to get menu items for\n * @param includePromises Whether or not to include promises in the returned menu items\n */\n static getMenuItems(\n actionsParam: ResolvableContextAction | ResolvableContextAction[],\n includePromises?: true\n ): MenuItem[];\n\n // If ignoring promises, then the return type is narrowed\n static getMenuItems(\n actionsParam: ResolvableContextAction | ResolvableContextAction[],\n includePromises: false\n ): ContextAction[];\n\n static getMenuItems(\n actionsParam: ResolvableContextAction | ResolvableContextAction[],\n includePromises = true\n ): MenuItem[] {\n let menuItems: MenuItem[] = [];\n let actions = actionsParam;\n if (!Array.isArray(actions)) {\n actions = [actions];\n }\n\n for (let i = 0; i < actions.length; i += 1) {\n const action = actions[i];\n let newMenuItems:\n | ContextAction\n | ContextAction[]\n | Promise<ContextAction[]>;\n if (typeof action === 'function') {\n newMenuItems = action();\n } else {\n newMenuItems = action;\n }\n\n if (newMenuItems != null) {\n if (newMenuItems instanceof Promise) {\n if (includePromises) {\n menuItems.push(newMenuItems);\n }\n } else if (Array.isArray(newMenuItems)) {\n menuItems = menuItems.concat(newMenuItems);\n } else {\n menuItems.push(newMenuItems);\n }\n }\n }\n\n menuItems = menuItems.filter(\n action =>\n (action as ContextAction).title !== undefined ||\n (action as Promise<ContextAction[]>).then ||\n (action as ContextAction).menuElement\n );\n\n return menuItems;\n }\n\n /**\n * Returns the index of the next menu item in a list that doesn't have a disabled=true prop\n * @param startIndex the starting position for the iteration\n * @param delta the direction of travel, -1 or 1\n * @param menuItems an array of menuItems\n */\n static getNextMenuItem(\n startIndex: number,\n delta: -1 | 1,\n menuItems: MenuItem[]\n ): number {\n let firstIndex = startIndex;\n if (firstIndex < 0 && delta < 0) {\n // if menu index is -1 and delta -1 manually set start point\n firstIndex = menuItems.length;\n }\n // find the next non disabled menu option, iterating the list only once\n for (let i = 1; i < menuItems.length + 1; i += 1) {\n const menuIndex =\n (firstIndex + delta * i + menuItems.length) % menuItems.length;\n const item = menuItems[menuIndex];\n if (!(item instanceof Promise) && item.disabled !== true) {\n return menuIndex;\n }\n }\n return startIndex;\n }\n}\n\nexport default ContextActionUtils;\n"],"mappings":";;AA+BA,OAAO,SAASA,SAAT,CAAyBC,KAAzB,EAAqE;EAC1E,OAAQA,KAAD,CAAsBC,IAAtB,KAA+BC,SAAtC;AACD;;AAED,MAAMC,kBAAN,CAAyB;EAGC,OAAjBC,iBAAiB,GAAS;IAC/BD,kBAAkB,CAACE,eAAnB,GAAqC,IAArC;EACD;;EAEsB,OAAhBC,gBAAgB,GAAS;IAC9BH,kBAAkB,CAACE,eAAnB,GAAqC,KAArC;EACD;;EAE0B,OAApBE,oBAAoB,CAACC,CAAD,EAAyC;IAClE,OAAOC,KAAK,CAACC,OAAN,CAAeF,CAAD,CAA0BG,cAAxC,CAAP;EACD;EAED;AACF;AACA;AACA;AACA;;;EACuB,OAAdC,cAAc,CAACC,CAAD,EAAmBC,CAAnB,EAA6C;IAChE,IAAID,CAAC,CAACE,KAAF,KAAYD,CAAC,CAACC,KAAlB,EAAyB;MAAA;;MACvB,OAAO,aAACF,CAAC,CAACE,KAAH,+CAAY,CAAZ,iBAAkBD,CAAC,CAACC,KAApB,+CAA6B,CAA7B,IAAkC,CAAlC,GAAsC,CAAC,CAA9C;IACD;;IAED,IAAIF,CAAC,CAACG,KAAF,KAAYF,CAAC,CAACE,KAAlB,EAAyB;MAAA;;MACvB,OAAO,aAACH,CAAC,CAACG,KAAH,+CAAY,CAAZ,iBAAkBF,CAAC,CAACE,KAApB,+CAA6B,CAA7B,IAAkC,CAAlC,GAAsC,CAAC,CAA9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,MAAvB;IACD,CALO,CAMR;;;IACA,KAAK,IAAID,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,SAAS,CAACE,MAAV,GAAmB,CAAvC,EAA0CD,CAAC,IAAI,CAA/C,EAAkD;MAChD,IAAMa,SAAS,GACb,CAACD,UAAU,GAAGD,KAAK,GAAGX,CAArB,GAAyBD,SAAS,CAACE,MAApC,IAA8CF,SAAS,CAACE,MAD1D;MAEA,IAAMa,IAAI,GAAGf,SAAS,CAACc,SAAD,CAAtB;;MACA,IAAI,EAAEC,IAAI,YAAYV,OAAlB,KAA8BU,IAAI,CAACC,QAAL,KAAkB,IAApD,EAA0D;QACxD,OAAOF,SAAP;MACD;IACF;;IACD,OAAOH,UAAP;EACD;;AAxKsB;;gBAAnB3C,kB,qBACqB,K;;AA0K3B,eAAeA,kBAAf"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deephaven/components",
|
|
3
|
-
"version": "0.22.3-beta.
|
|
3
|
+
"version": "0.22.3-beta.18+8d1ab1f",
|
|
4
4
|
"description": "Deephaven React component library",
|
|
5
5
|
"author": "Deephaven Data Labs LLC",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"build:sass": "sass --embed-sources --load-path=../../node_modules ./src:./dist ./scss/BaseStyleSheet.scss:./css/BaseStyleSheet.css"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@deephaven/icons": "^0.22.3-beta.
|
|
27
|
-
"@deephaven/log": "^0.22.3-beta.
|
|
28
|
-
"@deephaven/react-hooks": "^0.22.3-beta.
|
|
29
|
-
"@deephaven/utils": "^0.22.3-beta.
|
|
26
|
+
"@deephaven/icons": "^0.22.3-beta.18+8d1ab1f",
|
|
27
|
+
"@deephaven/log": "^0.22.3-beta.18+8d1ab1f",
|
|
28
|
+
"@deephaven/react-hooks": "^0.22.3-beta.18+8d1ab1f",
|
|
29
|
+
"@deephaven/utils": "^0.22.3-beta.18+8d1ab1f",
|
|
30
30
|
"@fortawesome/fontawesome-svg-core": "^6.1.1",
|
|
31
31
|
"@fortawesome/react-fontawesome": "^0.1.18",
|
|
32
32
|
"bootstrap": "4.6.2",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"react-dom": "^17.x"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@deephaven/mocks": "^0.22.3-beta.
|
|
53
|
-
"@deephaven/tsconfig": "^0.22.3-beta.
|
|
52
|
+
"@deephaven/mocks": "^0.22.3-beta.18+8d1ab1f",
|
|
53
|
+
"@deephaven/tsconfig": "^0.22.3-beta.18+8d1ab1f"
|
|
54
54
|
},
|
|
55
55
|
"files": [
|
|
56
56
|
"dist",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "8d1ab1fa6e893a438891194f922e069417b7f2d0"
|
|
67
67
|
}
|