@deephaven/golden-layout 0.43.0 → 0.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/css/goldenlayout-base.css +1 -1
  2. package/css/goldenlayout-base.css.map +1 -1
  3. package/css/goldenlayout-dark-theme.css +1 -1
  4. package/css/goldenlayout-dark-theme.css.map +1 -1
  5. package/dist/GoldenLayout.module.css +1 -0
  6. package/dist/GoldenLayout.module.css.map +1 -0
  7. package/dist/GoldenLayoutThemeExport.js +6 -0
  8. package/dist/GoldenLayoutThemeExport.js.map +1 -0
  9. package/dist/LayoutManager.js +1001 -0
  10. package/dist/LayoutManager.js.map +1 -0
  11. package/dist/base.js +16 -0
  12. package/dist/base.js.map +1 -0
  13. package/dist/config/Config.js +42 -0
  14. package/dist/config/Config.js.map +1 -0
  15. package/dist/config/ItemConfig.js +14 -0
  16. package/dist/config/ItemConfig.js.map +1 -0
  17. package/dist/config/index.js +3 -0
  18. package/dist/config/index.js.map +1 -0
  19. package/dist/container/ItemContainer.js +199 -0
  20. package/dist/container/ItemContainer.js.map +1 -0
  21. package/dist/container/index.js +3 -0
  22. package/dist/container/index.js.map +1 -0
  23. package/dist/controls/BrowserPopout.js +250 -0
  24. package/dist/controls/BrowserPopout.js.map +1 -0
  25. package/dist/controls/DragProxy.js +204 -0
  26. package/dist/controls/DragProxy.js.map +1 -0
  27. package/dist/controls/DragSource.js +52 -0
  28. package/dist/controls/DragSource.js.map +1 -0
  29. package/dist/controls/DragSourceFromEvent.js +71 -0
  30. package/dist/controls/DragSourceFromEvent.js.map +1 -0
  31. package/dist/controls/DropTargetIndicator.js +27 -0
  32. package/dist/controls/DropTargetIndicator.js.map +1 -0
  33. package/dist/controls/Header.js +736 -0
  34. package/dist/controls/Header.js.map +1 -0
  35. package/dist/controls/HeaderButton.js +22 -0
  36. package/dist/controls/HeaderButton.js.map +1 -0
  37. package/dist/controls/Splitter.js +49 -0
  38. package/dist/controls/Splitter.js.map +1 -0
  39. package/dist/controls/Tab.js +225 -0
  40. package/dist/controls/Tab.js.map +1 -0
  41. package/dist/controls/index.js +10 -0
  42. package/dist/controls/index.js.map +1 -0
  43. package/dist/declaration.d.js +2 -0
  44. package/dist/declaration.d.js.map +1 -0
  45. package/dist/errors/ConfigurationError.js +14 -0
  46. package/dist/errors/ConfigurationError.js.map +1 -0
  47. package/dist/errors/index.js +2 -0
  48. package/dist/errors/index.js.map +1 -0
  49. package/dist/index.js +11 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/items/AbstractContentItem.js +565 -0
  52. package/dist/items/AbstractContentItem.js.map +1 -0
  53. package/dist/items/Component.js +80 -0
  54. package/dist/items/Component.js.map +1 -0
  55. package/dist/items/Root.js +100 -0
  56. package/dist/items/Root.js.map +1 -0
  57. package/dist/items/RowOrColumn.js +488 -0
  58. package/dist/items/RowOrColumn.js.map +1 -0
  59. package/dist/items/Stack.js +479 -0
  60. package/dist/items/Stack.js.map +1 -0
  61. package/dist/items/index.js +8 -0
  62. package/dist/items/index.js.map +1 -0
  63. package/dist/utils/BubblingEvent.js +17 -0
  64. package/dist/utils/BubblingEvent.js.map +1 -0
  65. package/dist/utils/ConfigMinifier.js +147 -0
  66. package/dist/utils/ConfigMinifier.js.map +1 -0
  67. package/dist/utils/DragListener.js +125 -0
  68. package/dist/utils/DragListener.js.map +1 -0
  69. package/dist/utils/EventEmitter.js +117 -0
  70. package/dist/utils/EventEmitter.js.map +1 -0
  71. package/dist/utils/EventHub.js +108 -0
  72. package/dist/utils/EventHub.js.map +1 -0
  73. package/dist/utils/ReactComponentHandler.js +136 -0
  74. package/dist/utils/ReactComponentHandler.js.map +1 -0
  75. package/dist/utils/index.js +8 -0
  76. package/dist/utils/index.js.map +1 -0
  77. package/dist/utils/utils.js +65 -0
  78. package/dist/utils/utils.js.map +1 -0
  79. package/package.json +3 -3
@@ -0,0 +1,136 @@
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
+ import React from 'react';
5
+ import ReactDOM from 'react-dom';
6
+ import $ from 'jquery';
7
+ /**
8
+ * A specialised GoldenLayout component that binds GoldenLayout container
9
+ * lifecycle events to react components
10
+ *
11
+ * @param container
12
+ * @param state state is not required for react components
13
+ */
14
+ export default class ReactComponentHandler {
15
+ constructor(container, state) {
16
+ _defineProperty(this, "_container", void 0);
17
+ _defineProperty(this, "_reactComponent", null);
18
+ _defineProperty(this, "_portalComponent", null);
19
+ _defineProperty(this, "_originalComponentWillUpdate", null);
20
+ _defineProperty(this, "_initialState", void 0);
21
+ _defineProperty(this, "_reactClass", void 0);
22
+ this._reactComponent = null;
23
+ this._portalComponent = null;
24
+ this._originalComponentWillUpdate = null;
25
+ this._container = container;
26
+ this._initialState = state;
27
+ this._reactClass = this._getReactClass();
28
+ this._container.on('open', this._render, this);
29
+ this._container.on('destroy', this._destroy, this);
30
+ }
31
+
32
+ /**
33
+ * Gets the unique key to use for the react component
34
+ * @returns Unique key for the component
35
+ */
36
+ _key() {
37
+ var id = this._container._config.id;
38
+ if (!id) {
39
+ throw new Error('Cannot mount panel without id');
40
+ }
41
+
42
+ // If addId is called multiple times, an element can have multiple IDs in golden-layout
43
+ // We don't use it, but changing the type requires many changes and a separate PR
44
+ if (Array.isArray(id)) {
45
+ return id.join(',');
46
+ }
47
+ return id;
48
+ }
49
+
50
+ /**
51
+ * Creates the react class and component and hydrates it with
52
+ * the initial state - if one is present
53
+ *
54
+ * By default, react's getInitialState will be used
55
+ *
56
+ * Creates a portal so the non-react golden-layout code still works,
57
+ * but also allows us to mount the React components in the app's tree
58
+ * instead of separate sibling root trees
59
+ */
60
+ _render() {
61
+ var key = this._key();
62
+ this._portalComponent = /*#__PURE__*/ReactDOM.createPortal(this._getReactComponent(), this._container.getElement()[0], key);
63
+ this._container.layoutManager.addReactChild(key, this._portalComponent);
64
+ }
65
+
66
+ /**
67
+ * Fired by react when the component is created.
68
+ * <p>
69
+ * Note: This callback is used instead of the return from `ReactDOM.render` because
70
+ * of https://github.com/facebook/react/issues/10309.
71
+ * </p>
72
+ *
73
+ * @param component The component instance created by the `ReactDOM.render` call in the `_render` method.
74
+ */
75
+ _gotReactComponent(component) {
76
+ if (!component) {
77
+ return;
78
+ }
79
+ this._reactComponent = component;
80
+ this._originalComponentWillUpdate = this._reactComponent.componentWillUpdate || function () {};
81
+ this._reactComponent.componentWillUpdate = this._onUpdate.bind(this);
82
+ var state = this._container.getState();
83
+ if (state) {
84
+ this._reactComponent.setState(state);
85
+ }
86
+ }
87
+
88
+ /**
89
+ * Removes the component from the DOM and thus invokes React's unmount lifecycle
90
+ */
91
+ _destroy() {
92
+ this._container.layoutManager.removeReactChild(this._key(), this._portalComponent);
93
+ this._container.off('open', this._render, this);
94
+ this._container.off('destroy', this._destroy, this);
95
+ }
96
+
97
+ /**
98
+ * Hooks into React's state management and applies the componentstate
99
+ * to GoldenLayout
100
+ */
101
+ _onUpdate(nextProps, nextState) {
102
+ var _this$_originalCompon;
103
+ this._container.setState(nextState);
104
+ (_this$_originalCompon = this._originalComponentWillUpdate) === null || _this$_originalCompon === void 0 ? void 0 : _this$_originalCompon.call(this._reactComponent, nextProps, nextState);
105
+ }
106
+
107
+ /**
108
+ * Retrieves the react class from GoldenLayout's registry
109
+ * @returns react class
110
+ */
111
+ _getReactClass() {
112
+ var componentName = this._container._config.component;
113
+ if (!componentName) {
114
+ throw new Error('No react component name. type: react-component needs a field `component`');
115
+ }
116
+ var reactClass = this._container.layoutManager.getComponent(componentName) || this._container.layoutManager.getFallbackComponent();
117
+ if (!reactClass) {
118
+ throw new Error('React component "' + componentName + '" not found. ' + 'Please register all components with GoldenLayout using `registerComponent(name, component)`');
119
+ }
120
+ return reactClass;
121
+ }
122
+
123
+ /**
124
+ * Copies and extends the properties array and returns the React element
125
+ */
126
+ _getReactComponent() {
127
+ var defaultProps = {
128
+ glEventHub: this._container.layoutManager.eventHub,
129
+ glContainer: this._container,
130
+ ref: this._gotReactComponent.bind(this)
131
+ };
132
+ var props = $.extend(defaultProps, this._container._config.props);
133
+ return /*#__PURE__*/React.createElement(this._reactClass, props);
134
+ }
135
+ }
136
+ //# sourceMappingURL=ReactComponentHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactComponentHandler.js","names":["React","ReactDOM","$","ReactComponentHandler","constructor","container","state","_reactComponent","_portalComponent","_originalComponentWillUpdate","_container","_initialState","_reactClass","_getReactClass","on","_render","_destroy","_key","id","_config","Error","Array","isArray","join","key","createPortal","_getReactComponent","getElement","layoutManager","addReactChild","_gotReactComponent","component","componentWillUpdate","_onUpdate","bind","getState","setState","removeReactChild","off","nextProps","nextState","call","componentName","reactClass","getComponent","getFallbackComponent","defaultProps","glEventHub","eventHub","glContainer","ref","props","extend","createElement"],"sources":["../../src/utils/ReactComponentHandler.tsx"],"sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport $ from 'jquery';\nimport type ItemContainer from '../container/ItemContainer';\nimport type { ReactComponentConfig } from '../config/ItemConfig';\n\n/**\n * A specialised GoldenLayout component that binds GoldenLayout container\n * lifecycle events to react components\n *\n * @param container\n * @param state state is not required for react components\n */\nexport default class ReactComponentHandler {\n private _container: ItemContainer<ReactComponentConfig>;\n\n private _reactComponent: React.Component | null = null;\n private _portalComponent: React.ReactPortal | null = null;\n private _originalComponentWillUpdate: Function | null = null;\n private _initialState: unknown;\n private _reactClass: React.ComponentClass;\n\n constructor(container: ItemContainer<ReactComponentConfig>, state?: unknown) {\n this._reactComponent = null;\n this._portalComponent = null;\n this._originalComponentWillUpdate = null;\n this._container = container;\n this._initialState = state;\n this._reactClass = this._getReactClass();\n this._container.on('open', this._render, this);\n this._container.on('destroy', this._destroy, this);\n }\n\n /**\n * Gets the unique key to use for the react component\n * @returns Unique key for the component\n */\n _key(): string {\n const id = this._container._config.id;\n if (!id) {\n throw new Error('Cannot mount panel without id');\n }\n\n // If addId is called multiple times, an element can have multiple IDs in golden-layout\n // We don't use it, but changing the type requires many changes and a separate PR\n if (Array.isArray(id)) {\n return id.join(',');\n }\n\n return id;\n }\n\n /**\n * Creates the react class and component and hydrates it with\n * the initial state - if one is present\n *\n * By default, react's getInitialState will be used\n *\n * Creates a portal so the non-react golden-layout code still works,\n * but also allows us to mount the React components in the app's tree\n * instead of separate sibling root trees\n */\n _render() {\n const key = this._key();\n this._portalComponent = ReactDOM.createPortal(\n this._getReactComponent(),\n this._container.getElement()[0],\n key\n );\n\n this._container.layoutManager.addReactChild(key, this._portalComponent);\n }\n\n /**\n * Fired by react when the component is created.\n * <p>\n * Note: This callback is used instead of the return from `ReactDOM.render` because\n *\t of https://github.com/facebook/react/issues/10309.\n * </p>\n *\n * @param component The component instance created by the `ReactDOM.render` call in the `_render` method.\n */\n _gotReactComponent(component: React.Component) {\n if (!component) {\n return;\n }\n\n this._reactComponent = component;\n this._originalComponentWillUpdate =\n this._reactComponent.componentWillUpdate || function () {};\n this._reactComponent.componentWillUpdate = this._onUpdate.bind(this);\n const state = this._container.getState();\n if (state) {\n this._reactComponent.setState(state);\n }\n }\n\n /**\n * Removes the component from the DOM and thus invokes React's unmount lifecycle\n */\n _destroy() {\n this._container.layoutManager.removeReactChild(\n this._key(),\n this._portalComponent\n );\n this._container.off('open', this._render, this);\n this._container.off('destroy', this._destroy, this);\n }\n\n /**\n * Hooks into React's state management and applies the componentstate\n * to GoldenLayout\n */\n _onUpdate(nextProps: unknown, nextState: Record<string, unknown>) {\n this._container.setState(nextState);\n this._originalComponentWillUpdate?.call(\n this._reactComponent,\n nextProps,\n nextState\n );\n }\n\n /**\n * Retrieves the react class from GoldenLayout's registry\n * @returns react class\n */\n _getReactClass() {\n var componentName = this._container._config.component;\n\n if (!componentName) {\n throw new Error(\n 'No react component name. type: react-component needs a field `component`'\n );\n }\n\n const reactClass = ((this._container.layoutManager.getComponent(\n componentName\n ) ||\n this._container.layoutManager.getFallbackComponent()) as unknown) as React.ComponentClass;\n\n if (!reactClass) {\n throw new Error(\n 'React component \"' +\n componentName +\n '\" not found. ' +\n 'Please register all components with GoldenLayout using `registerComponent(name, component)`'\n );\n }\n\n return reactClass;\n }\n\n /**\n * Copies and extends the properties array and returns the React element\n */\n _getReactComponent() {\n var defaultProps = {\n glEventHub: this._container.layoutManager.eventHub,\n glContainer: this._container,\n ref: this._gotReactComponent.bind(this),\n };\n var props = $.extend(defaultProps, this._container._config.props);\n return React.createElement(this._reactClass, props);\n }\n}\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,QAAQ,MAAM,WAAW;AAChC,OAAOC,CAAC,MAAM,QAAQ;AAItB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAMC,qBAAqB,CAAC;EASzCC,WAAW,CAACC,SAA8C,EAAEC,KAAe,EAAE;IAAA;IAAA,yCAN3B,IAAI;IAAA,0CACD,IAAI;IAAA,sDACD,IAAI;IAAA;IAAA;IAK1D,IAAI,CAACC,eAAe,GAAG,IAAI;IAC3B,IAAI,CAACC,gBAAgB,GAAG,IAAI;IAC5B,IAAI,CAACC,4BAA4B,GAAG,IAAI;IACxC,IAAI,CAACC,UAAU,GAAGL,SAAS;IAC3B,IAAI,CAACM,aAAa,GAAGL,KAAK;IAC1B,IAAI,CAACM,WAAW,GAAG,IAAI,CAACC,cAAc,EAAE;IACxC,IAAI,CAACH,UAAU,CAACI,EAAE,CAAC,MAAM,EAAE,IAAI,CAACC,OAAO,EAAE,IAAI,CAAC;IAC9C,IAAI,CAACL,UAAU,CAACI,EAAE,CAA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CAACrC,UAAU,CAACkB,aAAa,CAACoB,QAAQ;MAClDC,WAAW,EAAE,IAAI,CAACvC,UAAU;MAC5BwC,GAAG,EAAE,IAAI,CAACpB,kBAAkB,CAACI,IAAI,CAAC,IAAI;IACxC,CAAC;IACD,IAAIiB,KAAK,GAAGjD,CAAC,CAACkD,MAAM,CAACN,YAAY,EAAE,IAAI,CAACpC,UAAU,CAACS,OAAO,CAACgC,KAAK,CAAC;IACjE,oBAAOnD,KAAK,CAACqD,aAAa,CAAC,IAAI,CAACzC,WAAW,EAAEuC,KAAK,CAAC;EACrD;AACF"}
@@ -0,0 +1,8 @@
1
+ export * from "./utils.js";
2
+ export { default as EventEmitter } from "./EventEmitter.js";
3
+ export { default as DragListener } from "./DragListener.js";
4
+ export { default as ReactComponentHandler } from "./ReactComponentHandler.js";
5
+ export * from "./ConfigMinifier.js";
6
+ export { default as BubblingEvent } from "./BubblingEvent.js";
7
+ export { default as EventHub } from "./EventHub.js";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["default","EventEmitter","DragListener","ReactComponentHandler","BubblingEvent","EventHub"],"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './utils';\nexport { default as EventEmitter } from './EventEmitter';\nexport { default as DragListener } from './DragListener';\nexport { default as ReactComponentHandler } from './ReactComponentHandler';\nexport * from './ConfigMinifier';\nexport { default as BubblingEvent } from './BubblingEvent';\nexport { default as EventHub } from './EventHub';\n"],"mappings":";SACSA,OAAO,IAAIC,YAAY;AAAA,SACvBD,OAAO,IAAIE,YAAY;AAAA,SACvBF,OAAO,IAAIG,qBAAqB;AAAA;AAAA,SAEhCH,OAAO,IAAII,aAAa;AAAA,SACxBJ,OAAO,IAAIK,QAAQ"}
@@ -0,0 +1,65 @@
1
+ import $ from 'jquery';
2
+ export function getHashValue(key) {
3
+ var matches = location.hash.match(new RegExp(key + '=([^&]*)'));
4
+ return matches ? matches[1] : null;
5
+ }
6
+ export function getQueryStringParam(param) {
7
+ if (window.location.hash) {
8
+ return getHashValue(param);
9
+ } else if (!window.location.search) {
10
+ return null;
11
+ }
12
+ var keyValuePairs = window.location.search.substr(1).split('&'),
13
+ params = {},
14
+ pair,
15
+ i;
16
+ for (i = 0; i < keyValuePairs.length; i++) {
17
+ pair = keyValuePairs[i].split('=');
18
+ params[pair[0]] = pair[1];
19
+ }
20
+ return params[param] || null;
21
+ }
22
+ export function animFrame(fn) {
23
+ return window.requestAnimationFrame(fn);
24
+ }
25
+ export function removeFromArray(item, array) {
26
+ var index = array.indexOf(item);
27
+ if (index === -1) {
28
+ throw new Error("Can't remove item from array. Item is not in the array");
29
+ }
30
+ array.splice(index, 1);
31
+ }
32
+ export function getUniqueId() {
33
+ return (Math.random() * 1000000000000000).toString(36).replace('.', '');
34
+ }
35
+
36
+ /**
37
+ * A basic XSS filter. It is ultimately up to the
38
+ * implementing developer to make sure their particular
39
+ * applications and usecases are save from cross site scripting attacks
40
+ *
41
+ * @param input
42
+ * @param keepTags
43
+ *
44
+ * @returns filtered input
45
+ */
46
+ export function filterXss(input, keepTags) {
47
+ var output = input.replace(/javascript/gi, 'j&#97;vascript').replace(/expression/gi, 'expr&#101;ssion').replace(/onload/gi, 'onlo&#97;d').replace(/script/gi, '&#115;cript').replace(/onerror/gi, 'on&#101;rror');
48
+ if (keepTags === true) {
49
+ return output;
50
+ } else {
51
+ return output.replace(/>/g, '&gt;').replace(/</g, '&lt;');
52
+ }
53
+ }
54
+
55
+ /**
56
+ * Removes html tags from a string
57
+ *
58
+ * @param input
59
+ *
60
+ * @returns input without tags
61
+ */
62
+ export function stripTags(input) {
63
+ return $.trim(input.replace(/(<([^>]+)>)/gi, ''));
64
+ }
65
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","names":["$","getHashValue","key","matches","location","hash","match","RegExp","getQueryStringParam","param","window","search","keyValuePairs","substr","split","params","pair","i","length","animFrame","fn","requestAnimationFrame","removeFromArray","item","array","index","indexOf","Error","splice","getUniqueId","Math","random","toString","replace","filterXss","input","keepTags","output","stripTags","trim"],"sources":["../../src/utils/utils.ts"],"sourcesContent":["import $ from 'jquery';\n\nexport function getHashValue(key: string) {\n var matches = location.hash.match(new RegExp(key + '=([^&]*)'));\n return matches ? matches[1] : null;\n}\n\nexport function getQueryStringParam(param: string) {\n if (window.location.hash) {\n return getHashValue(param);\n } else if (!window.location.search) {\n return null;\n }\n\n var keyValuePairs = window.location.search.substr(1).split('&'),\n params: Record<string, string> = {},\n pair,\n i;\n\n for (i = 0; i < keyValuePairs.length; i++) {\n pair = keyValuePairs[i].split('=');\n params[pair[0]] = pair[1];\n }\n\n return params[param] || null;\n}\n\nexport function animFrame(fn: (time?: number) => void) {\n return window.requestAnimationFrame(fn);\n}\n\nexport function removeFromArray<T>(item: T, array: T[]) {\n var index = array.indexOf(item);\n\n if (index === -1) {\n throw new Error(\"Can't remove item from array. Item is not in the array\");\n }\n\n array.splice(index, 1);\n}\n\nexport function getUniqueId() {\n return (Math.random() * 1000000000000000).toString(36).replace('.', '');\n}\n\n/**\n * A basic XSS filter. It is ultimately up to the\n * implementing developer to make sure their particular\n * applications and usecases are save from cross site scripting attacks\n *\n * @param input\n * @param keepTags\n *\n * @returns filtered input\n */\nexport function filterXss(input: string, keepTags: boolean) {\n var output = input\n .replace(/javascript/gi, 'j&#97;vascript')\n .replace(/expression/gi, 'expr&#101;ssion')\n .replace(/onload/gi, 'onlo&#97;d')\n .replace(/script/gi, '&#115;cript')\n .replace(/onerror/gi, 'on&#101;rror');\n\n if (keepTags === true) {\n return output;\n } else {\n return output.replace(/>/g, '&gt;').replace(/</g, '&lt;');\n }\n}\n\n/**\n * Removes html tags from a string\n *\n * @param input\n *\n * @returns input without tags\n */\nexport function stripTags(input: string) {\n return $.trim(input.replace(/(<([^>]+)>)/gi, ''));\n}\n"],"mappings":"AAAA,OAAOA,CAAC,MAAM,QAAQ;AAEtB,OAAO,SAASC,YAAY,CAACC,GAAW,EA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K,CAACI,MAAM,CAACH,KAAK,EAAE,CAAC,CAAC;AACxB;AAEA,OAAO,SAASI,WAAW,GAAG;EAC5B,OAAO,CAACC,IAAI,CAACC,MAAM,EAAE,GAAG,gBAAgB,EAAEC,QAAQ,CAAC,EAAE,CAAC,CAACC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;AACzE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,SAAS,CAACC,KAAa,EAAEC,QAAiB,EAAE;EAC1D,IAAIC,MAAM,GAAGF,KAAK,CACfF,OAAO,CAAC,cAAc,EAAE,gBAAgB,CAAC,CACzCA,OAAO,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAC1CA,OAAO,CAAC,UAAU,EAAE,YAAY,CAAC,CACjCA,OAAO,CAAC,UAAU,EAAE,aAAa,CAAC,CAClCA,OAAO,CAAC,WAAW,EAAE,cAAc,CAAC;EAEvC,IAAIG,QAAQ,KAAK,IAAI,EAAE;IACrB,OAAOC,MAAM;EACf,CAAC,MAAM;IACL,OAAOA,MAAM,CAACJ,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAACA,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;EAC3D;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASK,SAAS,CAACH,KAAa,EAAE;EACvC,OAAOnC,CAAC,CAACuC,IAAI,CAACJ,KAAK,CAACF,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;AACnD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deephaven/golden-layout",
3
- "version": "0.43.0",
3
+ "version": "0.44.0",
4
4
  "author": "Deephaven Data Labs LLC",
5
5
  "license": "Apache-2.0",
6
6
  "description": "A multi-screen javascript Layout manager",
@@ -10,7 +10,7 @@
10
10
  "source": "src/index.ts",
11
11
  "type": "module",
12
12
  "dependencies": {
13
- "@deephaven/components": "^0.43.0",
13
+ "@deephaven/components": "^0.44.0",
14
14
  "jquery": "^3.6.0"
15
15
  },
16
16
  "peerDependencies": {
@@ -55,5 +55,5 @@
55
55
  "karma-browserify": "^8.1.0",
56
56
  "watchify": "^4.0.0"
57
57
  },
58
- "gitHead": "b16776b5bdc15a02cd2897cd79d562ea38c60ed8"
58
+ "gitHead": "ba13c9139b3b7a5f5d64d79069f1de9d4727eeb6"
59
59
  }