@deephaven/dashboard 0.35.1-beta.0 → 0.35.1-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,31 @@
1
- import { Component, ComponentType } from 'react';
1
+ import { Component, ComponentType, ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react';
2
2
  import { ConnectedComponent } from 'react-redux';
3
3
  import GoldenLayout from '@deephaven/golden-layout';
4
4
  import type { ReactComponentConfig, EventEmitter, Container } from '@deephaven/golden-layout';
5
5
  import PanelManager from './PanelManager';
6
+ /**
7
+ * Alias for the return type of React.forwardRef()
8
+ */
9
+ export type ForwardRefComponentType<P, R> = ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<R>>;
10
+ /**
11
+ * Panel components can provide static props that provide meta data about the
12
+ * panel.
13
+ */
14
+ export interface PanelStaticMetaData {
15
+ /**
16
+ * Should be set to the same name as the component type.
17
+ * @deprecated Use `displayName` instead.
18
+ */
19
+ COMPONENT?: string;
20
+ /** Title of the panel. */
21
+ TITLE?: string;
22
+ }
23
+ /**
24
+ * Panels defined as functional components have to use React.forwardRef.
25
+ */
26
+ export type PanelFunctionComponentType<P, R> = ForwardRefComponentType<P, R> & PanelStaticMetaData;
6
27
  export type WrappedComponentType<P extends PanelProps, C extends ComponentType<P>> = ConnectedComponent<C, P>;
7
- export type PanelComponentType<P extends PanelProps = PanelProps, C extends ComponentType<P> = ComponentType<P>> = ComponentType<P> | WrappedComponentType<P, C>;
28
+ export type PanelComponentType<P extends PanelProps = PanelProps, C extends ComponentType<P> = ComponentType<P>> = (ComponentType<P> | WrappedComponentType<P, C> | PanelFunctionComponentType<P, unknown>) & PanelStaticMetaData;
8
29
  export declare function isWrappedComponent<P extends PanelProps, C extends ComponentType<P>>(type: PanelComponentType<P, C>): type is WrappedComponentType<P, C>;
9
30
  export type PanelProps = {
10
31
  glContainer: Container;
@@ -1 +1 @@
1
- {"version":3,"file":"DashboardPl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B,CAC1C,KAAK,EAAE,OAAO,CAAC,6BAA6B,CAAC,GAC5C,OAAO,CAAC,KAAK,IAAI,6BAA6B,CAMhD"}
@@ -1,6 +1,9 @@
1
1
  import { ComponentType } from 'react';
2
2
  import GoldenLayout from '@deephaven/golden-layout';
3
3
  import PanelManager from "./PanelManager.js";
4
+ /**
5
+ * Alias for the return type of React.forwardRef()
6
+ */
4
7
  export function isWrappedComponent(type) {
5
8
  return (type === null || type === void 0 ? void 0 : type.WrappedComponent) !== undefined;
6
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DashboardPlugin.js","names":["ComponentType","GoldenLayout","PanelManager","isWrappedComponent","type","WrappedComponent","undefined","isDashboardPluginProps","props","id","layout","panelManager","registerComponent","assertIsDashboardPluginProps","Error"],"sources":["../src/DashboardPlugin.ts"],"sourcesContent":["import { Component, ComponentType } from 'react';\nimport { ConnectedComponent } from 'react-redux';\nimport GoldenLayout from '@deephaven/golden-layout';\nimport type {\n ReactComponentConfig,\n EventEmitter,\n Container,\n} from '@deephaven/golden-layout';\nimport PanelManager from './PanelManager';\n\nexport type WrappedComponentType<\n P extends PanelProps,\n C extends ComponentType<P>\n> = ConnectedComponent<C, P>;\n\nexport type PanelComponentType<\n P extends PanelProps = PanelProps,\n C extends ComponentType<P> = ComponentType<P>\n> = ComponentType<P> | WrappedComponentType<P, C>;\n\nexport function isWrappedComponent<\n P extends PanelProps,\n C extends ComponentType<P>\n>(type: PanelComponentType<P, C>): type is WrappedComponentType<P, C> {\n return (type as WrappedComponentType<P, C>)?.WrappedComponent !== undefined;\n}\n\nexport type PanelProps = {\n glContainer: Container;\n glEventHub: EventEmitter;\n};\n\nexport type PanelComponent<T extends PanelProps = PanelProps> = Component<T>;\n\nexport type PanelConfig = ReactComponentConfig & {\n componentState?: Record<string, unknown> | null;\n};\n\nexport type DashboardConfig = {\n id: string;\n layout: GoldenLayout;\n panelManager: PanelManager;\n};\n\nexport interface DashboardPanelDefinition {\n name: string;\n definition: ComponentType;\n}\n\nexport type DeregisterComponentFunction = () => void;\n\nexport type PanelHydrateFunction<T = PanelProps> = (\n props: T,\n dashboardId: string\n) => PanelProps;\n\nexport type PanelDehydrateFunction = (\n config: PanelConfig,\n dashboardId: string\n) => PanelConfig | null;\n\nexport type DashboardPluginComponentProps = {\n id: string;\n layout: GoldenLayout;\n panelManager: PanelManager;\n registerComponent: <P extends PanelProps, C extends ComponentType<P>>(\n name: string,\n ComponentType: PanelComponentType<P, C>,\n hydrate?: PanelHydrateFunction<P>,\n dehydrate?: PanelDehydrateFunction\n ) => DeregisterComponentFunction;\n};\n\nexport interface DashboardPlugin {\n panels?: DashboardPanelDefinition[];\n\n /** Hydrate the provided panel and props. Return the same object if no changes made. */\n hydrateComponent?: (name: string, props: PanelProps) => PanelProps;\n\n /** Dehydrate a component. Return the same object if no changes made, or `null` if the component should not be saved */\n dehydrateComponent?: (\n name: string,\n config: PanelConfig\n ) => PanelConfig | null;\n\n /** Called when the dashboard is initialized and layout is ready. */\n initialize?: (config: DashboardConfig) => void;\n\n /** Called when the dashboard is unintialized and layout is about to be destroyed */\n deinitialize?: (config: DashboardConfig) => void;\n}\n\n/**\n * Takes a partial DashboardPluginComponentProps and verifies all the dashboard component fields are filled in.\n * @param props The props to check\n * @returns True if the props are valid DashboardPluginComponentProps, false otherwise\n */\nexport function isDashboardPluginProps(\n props: Partial<DashboardPluginComponentProps>\n): props is DashboardPluginComponentProps {\n return (\n typeof props.id === 'string' &&\n props.layout instanceof GoldenLayout &&\n props.panelManager instanceof PanelManager &&\n typeof props.registerComponent === 'function'\n );\n}\n\nexport function assertIsDashboardPluginProps(\n props: Partial<DashboardPluginComponentProps>\n): asserts props is DashboardPluginComponentProps {\n if (!isDashboardPluginProps(props)) {\n throw new Error(\n `Expected dashboard plugin props, but instead received ${props}`\n );\n }\n}\n"],"mappings":"AAAA,SAAoBA,aAAa,QAAQ,OAAO;AAEhD,OAAOC,YAAY,MAAM,0BAA0B;AAAC,OAM7CC,YAAY;AAYnB,OAAO,SAASC,kBAAkB,CAGhCC,IAA8B,EAAsC;EACpE,OAAO,CAACA,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAiCC,gBAAgB,MAAKC,SAAS;AAC7E;AAmEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsB,CACpCC,KAA6C,EACL;EACxC,OACE,OAAOA,KAAK,CAACC,EAAE,KAAK,QAAQ,IAC5BD,KAAK,CAACE,MAAM,YAAYT,YAAY,IACpCO,KAAK,CAACG,YAAY,YAAYT,YAAY,IAC1C,OAAOM,KAAK,CAACI,iBAAiB,KAAK,UAAU;AAEjD;AAEA,OAAO,SAASC,4BAA4B,CAC1CL,KAA6C,EACG;EAChD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC,EAAE;IAClC,MAAM,IAAIM,KAAK,iEAC4CN,KAAK,EAC/D;EACH;AACF"}
1
+ {"version":3,"file":"DashboardPlugin.js","names":["ComponentType","GoldenLayout","PanelManager","isWrappedComponent","type","WrappedComponent","undefined","isDashboardPluginProps","props","id","layout","panelManager","registerComponent","assertIsDashboardPluginProps","Error"],"sources":["../src/DashboardPlugin.ts"],"sourcesContent":["import {\n Component,\n ComponentType,\n ForwardRefExoticComponent,\n PropsWithoutRef,\n RefAttributes,\n} from 'react';\nimport { ConnectedComponent } from 'react-redux';\nimport GoldenLayout from '@deephaven/golden-layout';\nimport type {\n ReactComponentConfig,\n EventEmitter,\n Container,\n} from '@deephaven/golden-layout';\nimport PanelManager from './PanelManager';\n\n/**\n * Alias for the return type of React.forwardRef()\n */\nexport type ForwardRefComponentType<P, R> = ForwardRefExoticComponent<\n PropsWithoutRef<P> & RefAttributes<R>\n>;\n\n/**\n * Panel components can provide static props that provide meta data about the\n * panel.\n */\nexport interface PanelStaticMetaData {\n /**\n * Should be set to the same name as the component type.\n * @deprecated Use `displayName` instead.\n */\n COMPONENT?: string;\n\n /** Title of the panel. */\n TITLE?: string;\n}\n\n/**\n * Panels defined as functional components have to use React.forwardRef.\n */\nexport type PanelFunctionComponentType<P, R> = ForwardRefComponentType<P, R> &\n PanelStaticMetaData;\n\nexport type WrappedComponentType<\n P extends PanelProps,\n C extends ComponentType<P>\n> = ConnectedComponent<C, P>;\n\nexport type PanelComponentType<\n P extends PanelProps = PanelProps,\n C extends ComponentType<P> = ComponentType<P>\n> = (\n | ComponentType<P>\n | WrappedComponentType<P, C>\n | PanelFunctionComponentType<P, unknown>\n) &\n PanelStaticMetaData;\n\nexport function isWrappedComponent<\n P extends PanelProps,\n C extends ComponentType<P>\n>(type: PanelComponentType<P, C>): type is WrappedComponentType<P, C> {\n return (type as WrappedComponentType<P, C>)?.WrappedComponent !== undefined;\n}\n\nexport type PanelProps = {\n glContainer: Container;\n glEventHub: EventEmitter;\n};\n\nexport type PanelComponent<T extends PanelProps = PanelProps> = Component<T>;\n\nexport type PanelConfig = ReactComponentConfig & {\n componentState?: Record<string, unknown> | null;\n};\n\nexport type DashboardConfig = {\n id: string;\n layout: GoldenLayout;\n panelManager: PanelManager;\n};\n\nexport interface DashboardPanelDefinition {\n name: string;\n definition: ComponentType;\n}\n\nexport type DeregisterComponentFunction = () => void;\n\nexport type PanelHydrateFunction<T = PanelProps> = (\n props: T,\n dashboardId: string\n) => PanelProps;\n\nexport type PanelDehydrateFunction = (\n config: PanelConfig,\n dashboardId: string\n) => PanelConfig | null;\n\nexport type DashboardPluginComponentProps = {\n id: string;\n layout: GoldenLayout;\n panelManager: PanelManager;\n registerComponent: <P extends PanelProps, C extends ComponentType<P>>(\n name: string,\n ComponentType: PanelComponentType<P, C>,\n hydrate?: PanelHydrateFunction<P>,\n dehydrate?: PanelDehydrateFunction\n ) => DeregisterComponentFunction;\n};\n\nexport interface DashboardPlugin {\n panels?: DashboardPanelDefinition[];\n\n /** Hydrate the provided panel and props. Return the same object if no changes made. */\n hydrateComponent?: (name: string, props: PanelProps) => PanelProps;\n\n /** Dehydrate a component. Return the same object if no changes made, or `null` if the component should not be saved */\n dehydrateComponent?: (\n name: string,\n config: PanelConfig\n ) => PanelConfig | null;\n\n /** Called when the dashboard is initialized and layout is ready. */\n initialize?: (config: DashboardConfig) => void;\n\n /** Called when the dashboard is unintialized and layout is about to be destroyed */\n deinitialize?: (config: DashboardConfig) => void;\n}\n\n/**\n * Takes a partial DashboardPluginComponentProps and verifies all the dashboard component fields are filled in.\n * @param props The props to check\n * @returns True if the props are valid DashboardPluginComponentProps, false otherwise\n */\nexport function isDashboardPluginProps(\n props: Partial<DashboardPluginComponentProps>\n): props is DashboardPluginComponentProps {\n return (\n typeof props.id === 'string' &&\n props.layout instanceof GoldenLayout &&\n props.panelManager instanceof PanelManager &&\n typeof props.registerComponent === 'function'\n );\n}\n\nexport function assertIsDashboardPluginProps(\n props: Partial<DashboardPluginComponentProps>\n): asserts props is DashboardPluginComponentProps {\n if (!isDashboardPluginProps(props)) {\n throw new Error(\n `Expected dashboard plugin props, but instead received ${props}`\n );\n }\n}\n"],"mappings":"AAAA,SAEEA,aAAa,QAIR,OAAO;AAEd,OAAOC,YAAY,MAAM,0BAA0B;AAAC,OAM7CC,YAAY;AAEnB;AACA;AACA;AAyCA,OAAO,SAASC,kBAAkB,CAGhCC,IAA8B,EAAsC;EACpE,OAAO,CAACA,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAiCC,gBAAgB,MAAKC,SAAS;AAC7E;AAmEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsB,CACpCC,KAA6C,EACL;EACxC,OACE,OAAOA,KAAK,CAACC,EAAE,KAAK,QAAQ,IAC5BD,KAAK,CAACE,MAAM,YAAYT,YAAY,IACpCO,KAAK,CAACG,YAAY,YAAYT,YAAY,IAC1C,OAAOM,KAAK,CAACI,iBAAiB,KAAK,UAAU;AAEjD;AAEA,OAAO,SAASC,4BAA4B,CAC1CL,KAA6C,EACG;EAChD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC,EAAE;IAClC,MAAM,IAAIM,KAAK,iEAC4CN,KAAK,EAC/D;EACH;AACF"}
@@ -2,4 +2,5 @@ export { default as GoldenLayoutThemeExport } from './GoldenLayoutThemeExport';
2
2
  export { default as LayoutUtils } from './LayoutUtils';
3
3
  export { default as GLPropTypes } from './GLPropTypes';
4
4
  export * from './hooks';
5
+ export { default as usePanelRegistration } from './usePanelRegistration';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AAEvD,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AAEvD,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -2,4 +2,5 @@ export { default as GoldenLayoutThemeExport } from "./GoldenLayoutThemeExport.js
2
2
  export { default as LayoutUtils } from "./LayoutUtils.js";
3
3
  export { default as GLPropTypes } from "./GLPropTypes.js";
4
4
  export * from "./hooks.js";
5
+ export { default as usePanelRegistration } from "./usePanelRegistration.js";
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["default","GoldenLayoutThemeExport","LayoutUtils","GLPropTypes"],"sources":["../../src/layout/index.ts"],"sourcesContent":["export { default as GoldenLayoutThemeExport } from './GoldenLayoutThemeExport';\nexport { default as LayoutUtils } from './LayoutUtils';\nexport { default as GLPropTypes } from './GLPropTypes';\n\nexport * from './hooks';\n"],"mappings":"SAASA,OAAO,IAAIC,uBAAuB;AAAA,SAClCD,OAAO,IAAIE,WAAW;AAAA,SACtBF,OAAO,IAAIG,WAAW;AAAA"}
1
+ {"version":3,"file":"index.js","names":["default","GoldenLayoutThemeExport","LayoutUtils","GLPropTypes","usePanelRegistration"],"sources":["../../src/layout/index.ts"],"sourcesContent":["export { default as GoldenLayoutThemeExport } from './GoldenLayoutThemeExport';\nexport { default as LayoutUtils } from './LayoutUtils';\nexport { default as GLPropTypes } from './GLPropTypes';\n\nexport * from './hooks';\nexport { default as usePanelRegistration } from './usePanelRegistration';\n"],"mappings":"SAASA,OAAO,IAAIC,uBAAuB;AAAA,SAClCD,OAAO,IAAIE,WAAW;AAAA,SACtBF,OAAO,IAAIG,WAAW;AAAA;AAAA,SAGtBH,OAAO,IAAII,oBAAoB"}
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { DashboardPluginComponentProps, PanelComponentType, PanelDehydrateFunction, PanelHydrateFunction, PanelProps } from '../DashboardPlugin';
3
+ /**
4
+ * Registers a given panel component. Also runs a `useEffect` that will
5
+ * automatically de-register then panel on unmount.
6
+ * @param registerComponent
7
+ * @param ComponentType
8
+ * @param hydrate
9
+ * @param dehydrate
10
+ */
11
+ export default function usePanelRegistration<P extends PanelProps, C extends React.ComponentType<P>>(registerComponent: DashboardPluginComponentProps['registerComponent'], ComponentType: PanelComponentType<P, C>, hydrate?: PanelHydrateFunction<P>, dehydrate?: PanelDehydrateFunction): void;
12
+ //# sourceMappingURL=usePanelRegistration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePanelRegistration.d.ts","sourceRoot":"","sources":["../../src/layout/usePanelRegistration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,6BAA6B,EAC7B,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,UAAU,EACX,MAAM,oBAAoB,CAAC;AAE5B;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAC1C,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EAEhC,iBAAiB,EAAE,6BAA6B,CAAC,mBAAmB,CAAC,EACrE,aAAa,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,EACvC,OAAO,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,EACjC,SAAS,CAAC,EAAE,sBAAsB,QAsBnC"}
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ /**
3
+ * Registers a given panel component. Also runs a `useEffect` that will
4
+ * automatically de-register then panel on unmount.
5
+ * @param registerComponent
6
+ * @param ComponentType
7
+ * @param hydrate
8
+ * @param dehydrate
9
+ */
10
+ export default function usePanelRegistration(registerComponent, ComponentType, hydrate, dehydrate) {
11
+ var _ComponentType$COMPON;
12
+ var name = (_ComponentType$COMPON = ComponentType.COMPONENT) !== null && _ComponentType$COMPON !== void 0 ? _ComponentType$COMPON : ComponentType.displayName;
13
+ if (name == null) {
14
+ throw new Error('ComponentType must have a `COMPONENT` or `displayName` attribute.');
15
+ }
16
+ React.useEffect(() => {
17
+ var deregister = registerComponent(name, ComponentType, hydrate, dehydrate);
18
+ return () => {
19
+ deregister();
20
+ };
21
+ }, [ComponentType, dehydrate, hydrate, name, registerComponent]);
22
+ }
23
+ //# sourceMappingURL=usePanelRegistration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePanelRegistration.js","names":["React","usePanelRegistration","registerComponent","ComponentType","hydrate","dehydrate","name","COMPONENT","displayName","Error","useEffect","deregister"],"sources":["../../src/layout/usePanelRegistration.ts"],"sourcesContent":["import React from 'react';\nimport {\n DashboardPluginComponentProps,\n PanelComponentType,\n PanelDehydrateFunction,\n PanelHydrateFunction,\n PanelProps,\n} from '../DashboardPlugin';\n\n/**\n * Registers a given panel component. Also runs a `useEffect` that will\n * automatically de-register then panel on unmount.\n * @param registerComponent\n * @param ComponentType\n * @param hydrate\n * @param dehydrate\n */\nexport default function usePanelRegistration<\n P extends PanelProps,\n C extends React.ComponentType<P>\n>(\n registerComponent: DashboardPluginComponentProps['registerComponent'],\n ComponentType: PanelComponentType<P, C>,\n hydrate?: PanelHydrateFunction<P>,\n dehydrate?: PanelDehydrateFunction\n) {\n const name = ComponentType.COMPONENT ?? ComponentType.displayName;\n\n if (name == null) {\n throw new Error(\n 'ComponentType must have a `COMPONENT` or `displayName` attribute.'\n );\n }\n\n React.useEffect(() => {\n const deregister = registerComponent(\n name,\n ComponentType,\n hydrate,\n dehydrate\n );\n\n return () => {\n deregister();\n };\n }, [ComponentType, dehydrate, hydrate, name, registerComponent]);\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AASzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,oBAAoB,CAI1CC,iBAAqE,EACrEC,aAAuC,EACvCC,OAAiC,EACjCC,SAAkC,EAClC;EAAA;EACA,IAAMC,IAAI,4BAAGH,aAAa,CAACI,SAAS,yEAAIJ,aAAa,CAACK,WAAW;EAEjE,IAAIF,IAAI,IAAI,IAAI,EAAE;IAChB,MAAM,IAAIG,KAAK,CACb,mEAAmE,CACpE;EACH;EAEAT,KAAK,CAACU,SAAS,CAAC,MAAM;IACpB,IAAMC,UAAU,GAAGT,iBAAiB,CAClCI,IAAI,EACJH,aAAa,EACbC,OAAO,EACPC,SAAS,CACV;IAED,OAAO,MAAM;MACXM,UAAU,EAAE;IACd,CAAC;EACH,CAAC,EAAE,CAACR,aAAa,EAAEE,SAAS,EAAED,OAAO,EAAEE,IAAI,EAAEJ,iBAAiB,CAAC,CAAC;AAClE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deephaven/dashboard",
3
- "version": "0.35.1-beta.0+59d3df4d",
3
+ "version": "0.35.1-beta.2+85ce600a",
4
4
  "description": "Deephaven Dashboard",
5
5
  "author": "Deephaven Data Labs LLC",
6
6
  "license": "Apache-2.0",
@@ -22,12 +22,12 @@
22
22
  "build:sass": "sass --embed-sources --load-path=../../node_modules ./src:./dist"
23
23
  },
24
24
  "dependencies": {
25
- "@deephaven/components": "^0.35.1-beta.0+59d3df4d",
26
- "@deephaven/golden-layout": "^0.35.1-beta.0+59d3df4d",
27
- "@deephaven/log": "^0.35.1-beta.0+59d3df4d",
28
- "@deephaven/react-hooks": "^0.35.1-beta.0+59d3df4d",
29
- "@deephaven/redux": "^0.35.1-beta.0+59d3df4d",
30
- "@deephaven/utils": "^0.35.1-beta.0+59d3df4d",
25
+ "@deephaven/components": "^0.35.1-beta.2+85ce600a",
26
+ "@deephaven/golden-layout": "^0.35.1-beta.2+85ce600a",
27
+ "@deephaven/log": "^0.35.1-beta.2+85ce600a",
28
+ "@deephaven/react-hooks": "^0.35.1-beta.2+85ce600a",
29
+ "@deephaven/redux": "^0.35.1-beta.2+85ce600a",
30
+ "@deephaven/utils": "^0.35.1-beta.2+85ce600a",
31
31
  "deep-equal": "^2.0.5",
32
32
  "lodash.ismatch": "^4.1.1",
33
33
  "lodash.throttle": "^4.1.1",
@@ -40,8 +40,8 @@
40
40
  "react-redux": "^7.2.4"
41
41
  },
42
42
  "devDependencies": {
43
- "@deephaven/mocks": "^0.35.1-beta.0+59d3df4d",
44
- "@deephaven/tsconfig": "^0.35.1-beta.0+59d3df4d",
43
+ "@deephaven/mocks": "^0.35.1-beta.2+85ce600a",
44
+ "@deephaven/tsconfig": "^0.35.1-beta.2+85ce600a",
45
45
  "@types/lodash.ismatch": "^4.4.0"
46
46
  },
47
47
  "files": [
@@ -50,5 +50,5 @@
50
50
  "publishConfig": {
51
51
  "access": "public"
52
52
  },
53
- "gitHead": "59d3df4de3ec9a855d6e5c326a57bc9c1136ae90"
53
+ "gitHead": "85ce600ad63cd49504f75db5663ed64ec095749e"
54
54
  }