dockview-react 7.0.4 → 8.1.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 (71) hide show
  1. package/LICENCE.md +21 -0
  2. package/README.md +21 -16
  3. package/dist/cjs/dockview/reactContextMenuItemPart.d.ts +10 -3
  4. package/dist/cjs/index.d.ts +2 -2
  5. package/dist/cjs/svg.d.ts +1 -0
  6. package/dist/dockview-react.js +19294 -21736
  7. package/dist/dockview-react.min.js +4142 -22
  8. package/dist/package/main.cjs.js +960 -986
  9. package/dist/package/main.cjs.min.js +6 -6
  10. package/dist/package/main.esm.min.mjs +6 -6
  11. package/dist/package/main.esm.mjs +926 -977
  12. package/dist/styles/dockview.css +3098 -2400
  13. package/package.json +91 -85
  14. package/dist/cjs/dockview/defaultTab.js +0 -99
  15. package/dist/cjs/dockview/dockview.js +0 -285
  16. package/dist/cjs/dockview/headerActionsRenderer.js +0 -86
  17. package/dist/cjs/dockview/reactContentPart.js +0 -52
  18. package/dist/cjs/dockview/reactContextMenuItemPart.js +0 -31
  19. package/dist/cjs/dockview/reactGroupDragGhostPart.js +0 -32
  20. package/dist/cjs/dockview/reactHeaderPart.js +0 -46
  21. package/dist/cjs/dockview/reactTabGroupChipPart.js +0 -36
  22. package/dist/cjs/dockview/reactWatermarkPart.js +0 -47
  23. package/dist/cjs/gridview/gridview.js +0 -105
  24. package/dist/cjs/gridview/view.js +0 -41
  25. package/dist/cjs/index.js +0 -24
  26. package/dist/cjs/paneview/paneview.js +0 -137
  27. package/dist/cjs/paneview/view.js +0 -44
  28. package/dist/cjs/react.js +0 -183
  29. package/dist/cjs/splitview/splitview.js +0 -105
  30. package/dist/cjs/splitview/view.js +0 -39
  31. package/dist/cjs/svg.js +0 -15
  32. package/dist/cjs/types.js +0 -2
  33. package/dist/dockview-react.min.js.map +0 -1
  34. package/dist/esm/dockview/defaultTab.d.ts +0 -7
  35. package/dist/esm/dockview/defaultTab.js +0 -65
  36. package/dist/esm/dockview/dockview.d.ts +0 -33
  37. package/dist/esm/dockview/dockview.js +0 -252
  38. package/dist/esm/dockview/headerActionsRenderer.d.ts +0 -24
  39. package/dist/esm/dockview/headerActionsRenderer.js +0 -72
  40. package/dist/esm/dockview/reactContentPart.d.ts +0 -21
  41. package/dist/esm/dockview/reactContentPart.js +0 -43
  42. package/dist/esm/dockview/reactContextMenuItemPart.d.ts +0 -14
  43. package/dist/esm/dockview/reactContextMenuItemPart.js +0 -22
  44. package/dist/esm/dockview/reactGroupDragGhostPart.d.ts +0 -20
  45. package/dist/esm/dockview/reactGroupDragGhostPart.js +0 -23
  46. package/dist/esm/dockview/reactHeaderPart.d.ts +0 -17
  47. package/dist/esm/dockview/reactHeaderPart.js +0 -37
  48. package/dist/esm/dockview/reactTabGroupChipPart.d.ts +0 -23
  49. package/dist/esm/dockview/reactTabGroupChipPart.js +0 -27
  50. package/dist/esm/dockview/reactWatermarkPart.d.ts +0 -18
  51. package/dist/esm/dockview/reactWatermarkPart.js +0 -38
  52. package/dist/esm/gridview/gridview.d.ts +0 -17
  53. package/dist/esm/gridview/gridview.js +0 -72
  54. package/dist/esm/gridview/view.d.ts +0 -9
  55. package/dist/esm/gridview/view.js +0 -19
  56. package/dist/esm/index.d.ts +0 -10
  57. package/dist/esm/index.js +0 -8
  58. package/dist/esm/paneview/paneview.d.ts +0 -20
  59. package/dist/esm/paneview/paneview.js +0 -104
  60. package/dist/esm/paneview/view.d.ts +0 -19
  61. package/dist/esm/paneview/view.js +0 -35
  62. package/dist/esm/react.d.ts +0 -35
  63. package/dist/esm/react.js +0 -134
  64. package/dist/esm/splitview/splitview.d.ts +0 -17
  65. package/dist/esm/splitview/splitview.js +0 -72
  66. package/dist/esm/splitview/view.d.ts +0 -9
  67. package/dist/esm/splitview/view.js +0 -17
  68. package/dist/esm/svg.d.ts +0 -3
  69. package/dist/esm/svg.js +0 -7
  70. package/dist/esm/types.d.ts +0 -4
  71. package/dist/esm/types.js +0 -1
@@ -1,1033 +1,982 @@
1
1
  /**
2
2
  * dockview-react
3
- * @version 7.0.4
4
- * @link https://github.com/mathuo/dockview
3
+ * @version 8.1.0
4
+ * @link https://github.com/dockview/dockview
5
5
  * @license MIT
6
6
  */
7
- import { DockviewDisposable, DockviewEmitter, DockviewMutableDisposable, DockviewCompositeDisposable, PROPERTY_KEYS_DOCKVIEW, createDockview, SplitviewPanel, SplitviewApi, PROPERTY_KEYS_SPLITVIEW, createSplitview, GridviewPanel, GridviewApi, PROPERTY_KEYS_GRIDVIEW, createGridview, PROPERTY_KEYS_PANEVIEW, createPaneview } from 'dockview';
8
- export * from 'dockview';
9
- import React from 'react';
10
- import ReactDOM from 'react-dom';
7
+ import { DockviewCompositeDisposable, DockviewDisposable, DockviewEmitter, DockviewMutableDisposable, GridviewApi, GridviewPanel, PROPERTY_KEYS_DOCKVIEW, PROPERTY_KEYS_GRIDVIEW, PROPERTY_KEYS_PANEVIEW, PROPERTY_KEYS_SPLITVIEW, SplitviewApi, SplitviewPanel, createDockview, createGridview, createPaneview, createSplitview } from "dockview";
8
+ import React from "react";
9
+ import ReactDOM from "react-dom";
11
10
 
11
+ export * from "dockview"
12
+
13
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/typeof.js
14
+ function _typeof(o) {
15
+ "@babel/helpers - typeof";
16
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
17
+ return typeof o;
18
+ } : function(o) {
19
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
20
+ }, _typeof(o);
21
+ }
22
+
23
+ //#endregion
24
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/toPrimitive.js
25
+ function toPrimitive(t, r) {
26
+ if ("object" != _typeof(t) || !t) return t;
27
+ var e = t[Symbol.toPrimitive];
28
+ if (void 0 !== e) {
29
+ var i = e.call(t, r || "default");
30
+ if ("object" != _typeof(i)) return i;
31
+ throw new TypeError("@@toPrimitive must return a primitive value.");
32
+ }
33
+ return ("string" === r ? String : Number)(t);
34
+ }
35
+
36
+ //#endregion
37
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/toPropertyKey.js
38
+ function toPropertyKey(t) {
39
+ var i = toPrimitive(t, "string");
40
+ return "symbol" == _typeof(i) ? i : i + "";
41
+ }
42
+
43
+ //#endregion
44
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/defineProperty.js
45
+ function _defineProperty(e, r, t) {
46
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
47
+ value: t,
48
+ enumerable: !0,
49
+ configurable: !0,
50
+ writable: !0
51
+ }) : e[r] = t, e;
52
+ }
53
+
54
+ //#endregion
55
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/objectSpread2.js
56
+ function ownKeys(e, r) {
57
+ var t = Object.keys(e);
58
+ if (Object.getOwnPropertySymbols) {
59
+ var o = Object.getOwnPropertySymbols(e);
60
+ r && (o = o.filter(function(r) {
61
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
62
+ })), t.push.apply(t, o);
63
+ }
64
+ return t;
65
+ }
66
+ function _objectSpread2(e) {
67
+ for (var r = 1; r < arguments.length; r++) {
68
+ var t = null != arguments[r] ? arguments[r] : {};
69
+ r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
70
+ _defineProperty(e, r, t[r]);
71
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
72
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
73
+ });
74
+ }
75
+ return e;
76
+ }
77
+
78
+ //#endregion
79
+ //#region src/react.ts
12
80
  /**
13
- * This component is intended to interface between vanilla-js and React hence we need to be
14
- * creative in how we update props.
15
- * A ref of the component is exposed with an update method; which when called stores the props
16
- * as a ref within this component and forcefully triggers a re-render of the component using
17
- * the ref of props we just set on the renderered component as the props passed to the inner
18
- * component
19
- */
81
+ * This component is intended to interface between vanilla-js and React hence we need to be
82
+ * creative in how we update props.
83
+ * A ref of the component is exposed with an update method; which when called stores the props
84
+ * as a ref within this component and forcefully triggers a re-render of the component using
85
+ * the ref of props we just set on the renderered component as the props passed to the inner
86
+ * component
87
+ */
20
88
  const ReactComponentBridge = (props, ref) => {
21
- const [, triggerRender] = React.useState(0);
22
- const _props = React.useRef(props.componentProps);
23
- React.useImperativeHandle(ref, () => ({
24
- update: (componentProps) => {
25
- _props.current = Object.assign(Object.assign({}, _props.current), componentProps);
26
- /**
27
- * setting a arbitrary piece of state within this component will
28
- * trigger a re-render.
29
- * we use this rather than updating through a prop since we can
30
- * pass a ref into the vanilla-js world.
31
- *
32
- * Use a monotonic counter rather than `Date.now()` so two
33
- * updates within the same millisecond still produce distinct
34
- * state values and avoid React's bailout.
35
- */
36
- triggerRender((n) => n + 1);
37
- },
38
- }), []);
39
- return React.createElement(props.component, _props.current);
89
+ const [, triggerRender] = React.useState(0);
90
+ const _props = React.useRef(props.componentProps);
91
+ React.useImperativeHandle(ref, () => ({ update: (componentProps) => {
92
+ _props.current = _objectSpread2(_objectSpread2({}, _props.current), componentProps);
93
+ /**
94
+ * setting a arbitrary piece of state within this component will
95
+ * trigger a re-render.
96
+ * we use this rather than updating through a prop since we can
97
+ * pass a ref into the vanilla-js world.
98
+ *
99
+ * Use a monotonic counter rather than `Date.now()` so two
100
+ * updates within the same millisecond still produce distinct
101
+ * state values and avoid React's bailout.
102
+ */
103
+ triggerRender((n) => n + 1);
104
+ } }), []);
105
+ return React.createElement(props.component, _props.current);
40
106
  };
41
- ReactComponentBridge.displayName = 'DockviewReactJsBridge';
107
+ ReactComponentBridge.displayName = "DockviewReactJsBridge";
42
108
  /**
43
- * Since we are storing the React.Portal references in a rendered array they
44
- * require a key property like any other React element rendered in an array
45
- * to prevent excessive re-rendering
46
- */
109
+ * Since we are storing the React.Portal references in a rendered array they
110
+ * require a key property like any other React element rendered in an array
111
+ * to prevent excessive re-rendering
112
+ */
47
113
  const uniquePortalKeyGenerator = (() => {
48
- let value = 1;
49
- return { next: () => `dockview_react_portal_key_${(value++).toString()}` };
114
+ let value = 1;
115
+ return { next: () => `dockview_react_portal_key_${(value++).toString()}` };
50
116
  })();
51
117
  const ReactPartContext = React.createContext({});
52
- class ReactPart {
53
- constructor(parent, portalStore, component, parameters, context) {
54
- this.parent = parent;
55
- this.portalStore = portalStore;
56
- this.component = component;
57
- this.parameters = parameters;
58
- this.context = context;
59
- this._initialProps = {};
60
- this.disposed = false;
61
- this.createPortal();
62
- }
63
- update(props) {
64
- if (this.disposed) {
65
- throw new Error('invalid operation: resource is already disposed');
66
- }
67
- if (this.componentInstance) {
68
- this.componentInstance.update(props);
69
- }
70
- else {
71
- // if the component is yet to be mounted store the props
72
- this._initialProps = Object.assign(Object.assign({}, this._initialProps), props);
73
- }
74
- }
75
- createPortal() {
76
- if (this.disposed) {
77
- throw new Error('invalid operation: resource is already disposed');
78
- }
79
- if (!isReactComponent(this.component)) {
80
- /**
81
- * we know this isn't a React.FunctionComponent so throw an error here.
82
- * if we do not intercept then React library will throw a very obsure error
83
- * for the same reason... at least at this point we will emit a sensible stacktrace.
84
- */
85
- throw new Error('Dockview: Only React.memo(...), React.ForwardRef(...) and functional components are accepted as components');
86
- }
87
- const bridgeComponent = React.createElement(React.forwardRef(ReactComponentBridge), {
88
- component: this
89
- .component,
90
- componentProps: this.parameters,
91
- ref: (element) => {
92
- this.componentInstance = element;
93
- if (Object.keys(this._initialProps).length > 0) {
94
- this.componentInstance.update(this._initialProps);
95
- this._initialProps = {}; // don't keep a reference to the users object once no longer required
96
- }
97
- },
98
- });
99
- const node = this.context
100
- ? React.createElement(ReactPartContext.Provider, { value: this.context }, bridgeComponent)
101
- : bridgeComponent;
102
- const portal = ReactDOM.createPortal(node, this.parent, uniquePortalKeyGenerator.next());
103
- this.ref = {
104
- portal,
105
- disposable: this.portalStore.addPortal(portal),
106
- };
107
- }
108
- dispose() {
109
- var _a;
110
- (_a = this.ref) === null || _a === void 0 ? void 0 : _a.disposable.dispose();
111
- this.disposed = true;
112
- }
113
- }
118
+ var ReactPart = class {
119
+ constructor(parent, portalStore, component, parameters, context) {
120
+ this.parent = parent;
121
+ this.portalStore = portalStore;
122
+ this.component = component;
123
+ this.parameters = parameters;
124
+ this.context = context;
125
+ this._initialProps = {};
126
+ this.disposed = false;
127
+ this.createPortal();
128
+ }
129
+ update(props) {
130
+ if (this.disposed) throw new Error("invalid operation: resource is already disposed");
131
+ if (this.componentInstance) this.componentInstance.update(props);
132
+ else this._initialProps = _objectSpread2(_objectSpread2({}, this._initialProps), props);
133
+ }
134
+ createPortal() {
135
+ if (this.disposed) throw new Error("invalid operation: resource is already disposed");
136
+ if (!isReactComponent(this.component))
137
+ /**
138
+ * we know this isn't a React.FunctionComponent so throw an error here.
139
+ * if we do not intercept then React library will throw a very obsure error
140
+ * for the same reason... at least at this point we will emit a sensible stacktrace.
141
+ */
142
+ throw new Error("Dockview: Only React.memo(...), React.ForwardRef(...) and functional components are accepted as components");
143
+ const bridgeComponent = React.createElement(React.forwardRef(ReactComponentBridge), {
144
+ component: this.component,
145
+ componentProps: this.parameters,
146
+ ref: (element) => {
147
+ this.componentInstance = element;
148
+ if (Object.keys(this._initialProps).length > 0) {
149
+ this.componentInstance.update(this._initialProps);
150
+ this._initialProps = {};
151
+ }
152
+ }
153
+ });
154
+ const node = this.context ? React.createElement(ReactPartContext.Provider, { value: this.context }, bridgeComponent) : bridgeComponent;
155
+ const portal = ReactDOM.createPortal(node, this.parent, uniquePortalKeyGenerator.next());
156
+ this.ref = {
157
+ portal,
158
+ disposable: this.portalStore.addPortal(portal)
159
+ };
160
+ }
161
+ dispose() {
162
+ var _this$ref;
163
+ (_this$ref = this.ref) === null || _this$ref === void 0 || _this$ref.disposable.dispose();
164
+ this.disposed = true;
165
+ }
166
+ };
114
167
  /**
115
- * A React Hook that returns an array of portals to be rendered by the user of this hook
116
- * and a disposable function to add a portal. Calling dispose removes this portal from the
117
- * portal array
118
- */
168
+ * A React Hook that returns an array of portals to be rendered by the user of this hook
169
+ * and a disposable function to add a portal. Calling dispose removes this portal from the
170
+ * portal array
171
+ */
119
172
  const usePortalsLifecycle = () => {
120
- const [portals, setPortals] = React.useState([]);
121
- React.useDebugValue(`Portal count: ${portals.length}`);
122
- const addPortal = React.useCallback((portal) => {
123
- setPortals((existingPortals) => [...existingPortals, portal]);
124
- let disposed = false;
125
- return DockviewDisposable.from(() => {
126
- if (disposed) {
127
- throw new Error('invalid operation: resource already disposed');
128
- }
129
- disposed = true;
130
- setPortals((existingPortals) => existingPortals.filter((p) => p !== portal));
131
- });
132
- }, []);
133
- return [portals, addPortal];
173
+ const [portals, setPortals] = React.useState([]);
174
+ React.useDebugValue(`Portal count: ${portals.length}`);
175
+ return [portals, React.useCallback((portal) => {
176
+ setPortals((existingPortals) => [...existingPortals, portal]);
177
+ let disposed = false;
178
+ return DockviewDisposable.from(() => {
179
+ if (disposed) throw new Error("invalid operation: resource already disposed");
180
+ disposed = true;
181
+ setPortals((existingPortals) => existingPortals.filter((p) => p !== portal));
182
+ });
183
+ }, [])];
134
184
  };
135
185
  function isReactComponent(component) {
136
- /**
137
- * Yes, we could use "react-is" but that would introduce an unwanted peer dependency
138
- * so for now we will check in a rather crude fashion...
139
- */
140
- return (typeof component === 'function' /** Functional Componnts */ ||
141
- !!(component === null || component === void 0 ? void 0 : component.$$typeof) /** React.memo(...) Components */);
186
+ /**
187
+ * Yes, we could use "react-is" but that would introduce an unwanted peer dependency
188
+ * so for now we will check in a rather crude fashion...
189
+ */
190
+ return typeof component === "function" || !!(component === null || component === void 0 ? void 0 : component.$$typeof);
142
191
  }
143
192
 
144
- class ReactPanelContentPart {
145
- get element() {
146
- return this._element;
147
- }
148
- constructor(id, component, reactPortalStore) {
149
- this.id = id;
150
- this.component = component;
151
- this.reactPortalStore = reactPortalStore;
152
- this._onDidFocus = new DockviewEmitter();
153
- this.onDidFocus = this._onDidFocus.event;
154
- this._onDidBlur = new DockviewEmitter();
155
- this.onDidBlur = this._onDidBlur.event;
156
- this._element = document.createElement('div');
157
- this._element.className = 'dv-react-part';
158
- this._element.style.height = '100%';
159
- this._element.style.width = '100%';
160
- }
161
- focus() {
162
- // TODO
163
- }
164
- init(parameters) {
165
- this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {
166
- params: parameters.params,
167
- api: parameters.api,
168
- containerApi: parameters.containerApi,
169
- });
170
- }
171
- update(event) {
172
- var _a;
173
- (_a = this.part) === null || _a === void 0 ? void 0 : _a.update({ params: event.params });
174
- }
175
- layout(_width, _height) {
176
- // noop
177
- }
178
- dispose() {
179
- var _a;
180
- this._onDidFocus.dispose();
181
- this._onDidBlur.dispose();
182
- (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
183
- }
184
- }
193
+ //#endregion
194
+ //#region src/dockview/reactContentPart.ts
195
+ var ReactPanelContentPart = class {
196
+ get element() {
197
+ return this._element;
198
+ }
199
+ constructor(id, component, reactPortalStore) {
200
+ this.id = id;
201
+ this.component = component;
202
+ this.reactPortalStore = reactPortalStore;
203
+ this._onDidFocus = new DockviewEmitter();
204
+ this.onDidFocus = this._onDidFocus.event;
205
+ this._onDidBlur = new DockviewEmitter();
206
+ this.onDidBlur = this._onDidBlur.event;
207
+ this._element = document.createElement("div");
208
+ this._element.className = "dv-react-part";
209
+ this._element.style.height = "100%";
210
+ this._element.style.width = "100%";
211
+ }
212
+ focus() {}
213
+ init(parameters) {
214
+ this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {
215
+ params: parameters.params,
216
+ api: parameters.api,
217
+ containerApi: parameters.containerApi
218
+ });
219
+ }
220
+ update(event) {
221
+ var _this$part;
222
+ (_this$part = this.part) === null || _this$part === void 0 || _this$part.update({ params: event.params });
223
+ }
224
+ layout(_width, _height) {}
225
+ dispose() {
226
+ var _this$part2;
227
+ this._onDidFocus.dispose();
228
+ this._onDidBlur.dispose();
229
+ (_this$part2 = this.part) === null || _this$part2 === void 0 || _this$part2.dispose();
230
+ }
231
+ };
185
232
 
186
- class ReactPanelHeaderPart {
187
- get element() {
188
- return this._element;
189
- }
190
- constructor(id, component, reactPortalStore) {
191
- this.id = id;
192
- this.component = component;
193
- this.reactPortalStore = reactPortalStore;
194
- this._element = document.createElement('div');
195
- this._element.className = 'dv-react-part';
196
- this._element.style.height = '100%';
197
- this._element.style.width = '100%';
198
- }
199
- focus() {
200
- //noop
201
- }
202
- init(parameters) {
203
- this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {
204
- params: parameters.params,
205
- api: parameters.api,
206
- containerApi: parameters.containerApi,
207
- tabLocation: parameters.tabLocation,
208
- });
209
- }
210
- update(event) {
211
- var _a;
212
- (_a = this.part) === null || _a === void 0 ? void 0 : _a.update({ params: event.params });
213
- }
214
- layout(_width, _height) {
215
- // noop - retrieval from api
216
- }
217
- dispose() {
218
- var _a;
219
- (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
220
- }
221
- }
233
+ //#endregion
234
+ //#region src/dockview/reactHeaderPart.ts
235
+ var ReactPanelHeaderPart = class {
236
+ get element() {
237
+ return this._element;
238
+ }
239
+ constructor(id, component, reactPortalStore) {
240
+ this.id = id;
241
+ this.component = component;
242
+ this.reactPortalStore = reactPortalStore;
243
+ this._element = document.createElement("div");
244
+ this._element.className = "dv-react-part";
245
+ this._element.style.height = "100%";
246
+ this._element.style.width = "100%";
247
+ }
248
+ focus() {}
249
+ init(parameters) {
250
+ this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {
251
+ params: parameters.params,
252
+ api: parameters.api,
253
+ containerApi: parameters.containerApi,
254
+ tabLocation: parameters.tabLocation
255
+ });
256
+ }
257
+ update(event) {
258
+ var _this$part;
259
+ (_this$part = this.part) === null || _this$part === void 0 || _this$part.update({ params: event.params });
260
+ }
261
+ layout(_width, _height) {}
262
+ dispose() {
263
+ var _this$part2;
264
+ (_this$part2 = this.part) === null || _this$part2 === void 0 || _this$part2.dispose();
265
+ }
266
+ };
222
267
 
223
- class ReactWatermarkPart {
224
- get element() {
225
- return this._element;
226
- }
227
- constructor(id, component, reactPortalStore) {
228
- this.id = id;
229
- this.component = component;
230
- this.reactPortalStore = reactPortalStore;
231
- this._element = document.createElement('div');
232
- this._element.className = 'dv-react-part';
233
- this._element.style.height = '100%';
234
- this._element.style.width = '100%';
235
- }
236
- init(parameters) {
237
- this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {
238
- group: parameters.group,
239
- containerApi: parameters.containerApi,
240
- });
241
- }
242
- focus() {
243
- // noop
244
- }
245
- update(params) {
246
- var _a, _b, _c;
247
- if (this.parameters) {
248
- this.parameters.params = params.params;
249
- }
250
- (_a = this.part) === null || _a === void 0 ? void 0 : _a.update({ params: (_c = (_b = this.parameters) === null || _b === void 0 ? void 0 : _b.params) !== null && _c !== void 0 ? _c : {} });
251
- }
252
- layout(_width, _height) {
253
- // noop - retrieval from api
254
- }
255
- dispose() {
256
- var _a;
257
- (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
258
- }
259
- }
268
+ //#endregion
269
+ //#region src/dockview/reactWatermarkPart.ts
270
+ var ReactWatermarkPart = class {
271
+ get element() {
272
+ return this._element;
273
+ }
274
+ constructor(id, component, reactPortalStore) {
275
+ this.id = id;
276
+ this.component = component;
277
+ this.reactPortalStore = reactPortalStore;
278
+ this._element = document.createElement("div");
279
+ this._element.className = "dv-react-part";
280
+ this._element.style.height = "100%";
281
+ this._element.style.width = "100%";
282
+ }
283
+ init(parameters) {
284
+ this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {
285
+ group: parameters.group,
286
+ containerApi: parameters.containerApi
287
+ });
288
+ }
289
+ focus() {}
290
+ update(params) {
291
+ var _this$part, _this$parameters$para, _this$parameters;
292
+ if (this.parameters) this.parameters.params = params.params;
293
+ (_this$part = this.part) === null || _this$part === void 0 || _this$part.update({ params: (_this$parameters$para = (_this$parameters = this.parameters) === null || _this$parameters === void 0 ? void 0 : _this$parameters.params) !== null && _this$parameters$para !== void 0 ? _this$parameters$para : {} });
294
+ }
295
+ layout(_width, _height) {}
296
+ dispose() {
297
+ var _this$part2;
298
+ (_this$part2 = this.part) === null || _this$part2 === void 0 || _this$part2.dispose();
299
+ }
300
+ };
260
301
 
261
- class ReactHeaderActionsRendererPart {
262
- get element() {
263
- return this._element;
264
- }
265
- get part() {
266
- return this._part;
267
- }
268
- constructor(component, reactPortalStore, _group) {
269
- this.component = component;
270
- this.reactPortalStore = reactPortalStore;
271
- this._group = _group;
272
- this.mutableDisposable = new DockviewMutableDisposable();
273
- this._element = document.createElement('div');
274
- this._element.className = 'dv-react-part';
275
- this._element.style.height = '100%';
276
- this._element.style.width = '100%';
277
- }
278
- init(parameters) {
279
- this.mutableDisposable.value = new DockviewCompositeDisposable(this._group.model.onDidAddPanel(() => {
280
- this.updatePanels();
281
- }), this._group.model.onDidRemovePanel(() => {
282
- this.updatePanels();
283
- }), this._group.model.onDidActivePanelChange(() => {
284
- this.updateActivePanel();
285
- }), parameters.api.onDidActiveChange(() => {
286
- this.updateGroupActive();
287
- }), parameters.api.onDidLocationChange((event) => {
288
- this.updateLocation(event.location);
289
- }));
290
- this._part = new ReactPart(this.element, this.reactPortalStore, this.component, {
291
- api: parameters.api,
292
- containerApi: parameters.containerApi,
293
- panels: this._group.model.panels,
294
- activePanel: this._group.model.activePanel,
295
- isGroupActive: this._group.api.isActive,
296
- group: this._group,
297
- headerPosition: this._group.model.headerPosition,
298
- location: parameters.api.location,
299
- });
300
- }
301
- dispose() {
302
- var _a;
303
- this.mutableDisposable.dispose();
304
- (_a = this._part) === null || _a === void 0 ? void 0 : _a.dispose();
305
- }
306
- update(event) {
307
- var _a;
308
- (_a = this._part) === null || _a === void 0 ? void 0 : _a.update(event.params);
309
- }
310
- updatePanels() {
311
- this.update({ params: { panels: this._group.model.panels } });
312
- }
313
- updateActivePanel() {
314
- this.update({
315
- params: {
316
- activePanel: this._group.model.activePanel,
317
- },
318
- });
319
- }
320
- updateGroupActive() {
321
- this.update({
322
- params: {
323
- isGroupActive: this._group.api.isActive,
324
- },
325
- });
326
- }
327
- updateLocation(location) {
328
- this.update({ params: { location } });
329
- }
330
- }
302
+ //#endregion
303
+ //#region src/dockview/headerActionsRenderer.ts
304
+ var ReactHeaderActionsRendererPart = class {
305
+ get element() {
306
+ return this._element;
307
+ }
308
+ get part() {
309
+ return this._part;
310
+ }
311
+ constructor(component, reactPortalStore, _group) {
312
+ this.component = component;
313
+ this.reactPortalStore = reactPortalStore;
314
+ this._group = _group;
315
+ this.mutableDisposable = new DockviewMutableDisposable();
316
+ this._element = document.createElement("div");
317
+ this._element.className = "dv-react-part";
318
+ this._element.style.height = "100%";
319
+ this._element.style.width = "100%";
320
+ }
321
+ init(parameters) {
322
+ this.mutableDisposable.value = new DockviewCompositeDisposable(this._group.model.onDidAddPanel(() => {
323
+ this.updatePanels();
324
+ }), this._group.model.onDidRemovePanel(() => {
325
+ this.updatePanels();
326
+ }), this._group.model.onDidActivePanelChange(() => {
327
+ this.updateActivePanel();
328
+ }), parameters.api.onDidActiveChange(() => {
329
+ this.updateGroupActive();
330
+ }), parameters.api.onDidLocationChange((event) => {
331
+ this.updateLocation(event.location);
332
+ }));
333
+ this._part = new ReactPart(this.element, this.reactPortalStore, this.component, {
334
+ api: parameters.api,
335
+ containerApi: parameters.containerApi,
336
+ panels: this._group.model.panels,
337
+ activePanel: this._group.model.activePanel,
338
+ isGroupActive: this._group.api.isActive,
339
+ group: this._group,
340
+ headerPosition: this._group.model.headerPosition,
341
+ location: parameters.api.location
342
+ });
343
+ }
344
+ dispose() {
345
+ var _this$_part;
346
+ this.mutableDisposable.dispose();
347
+ (_this$_part = this._part) === null || _this$_part === void 0 || _this$_part.dispose();
348
+ }
349
+ update(event) {
350
+ var _this$_part2;
351
+ (_this$_part2 = this._part) === null || _this$_part2 === void 0 || _this$_part2.update(event.params);
352
+ }
353
+ updatePanels() {
354
+ this.update({ params: { panels: this._group.model.panels } });
355
+ }
356
+ updateActivePanel() {
357
+ this.update({ params: { activePanel: this._group.model.activePanel } });
358
+ }
359
+ updateGroupActive() {
360
+ this.update({ params: { isGroupActive: this._group.api.isActive } });
361
+ }
362
+ updateLocation(location) {
363
+ this.update({ params: { location } });
364
+ }
365
+ };
331
366
 
332
- class ReactContextMenuItemPart {
333
- get element() {
334
- return this._element;
335
- }
336
- constructor(id, component, reactPortalStore) {
337
- this.id = id;
338
- this.component = component;
339
- this.reactPortalStore = reactPortalStore;
340
- this._element = document.createElement('div');
341
- this._element.className = 'dv-react-part';
342
- this._element.style.height = '100%';
343
- this._element.style.width = '100%';
344
- }
345
- init(props) {
346
- this.part = new ReactPart(this._element, this.reactPortalStore, this.component, props);
347
- }
348
- dispose() {
349
- var _a;
350
- (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
351
- }
352
- }
367
+ //#endregion
368
+ //#region src/dockview/reactContextMenuItemPart.ts
369
+ var ReactContextMenuItemPart = class {
370
+ get element() {
371
+ return this._element;
372
+ }
373
+ constructor(id, component, reactPortalStore) {
374
+ this.id = id;
375
+ this.component = component;
376
+ this.reactPortalStore = reactPortalStore;
377
+ this._element = document.createElement("div");
378
+ this._element.className = "dv-react-part";
379
+ this._element.style.height = "100%";
380
+ this._element.style.width = "100%";
381
+ }
382
+ init(props) {
383
+ this.part = new ReactPart(this._element, this.reactPortalStore, this.component, props);
384
+ }
385
+ dispose() {
386
+ var _this$part;
387
+ (_this$part = this.part) === null || _this$part === void 0 || _this$part.dispose();
388
+ }
389
+ };
353
390
 
354
- class ReactTabGroupChipPart {
355
- get element() {
356
- return this._element;
357
- }
358
- constructor(component, reactPortalStore) {
359
- this.component = component;
360
- this.reactPortalStore = reactPortalStore;
361
- this._element = document.createElement('div');
362
- this._element.className = 'dv-react-part';
363
- this._element.style.display = 'inline-flex';
364
- }
365
- init(params) {
366
- this.part = new ReactPart(this._element, this.reactPortalStore, this.component, {
367
- tabGroup: params.tabGroup,
368
- api: params.api,
369
- });
370
- }
371
- update(params) {
372
- var _a;
373
- (_a = this.part) === null || _a === void 0 ? void 0 : _a.update({ tabGroup: params.tabGroup });
374
- }
375
- dispose() {
376
- var _a;
377
- (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
378
- }
379
- }
391
+ //#endregion
392
+ //#region src/dockview/reactTabGroupChipPart.ts
393
+ var ReactTabGroupChipPart = class {
394
+ get element() {
395
+ return this._element;
396
+ }
397
+ constructor(component, reactPortalStore) {
398
+ this.component = component;
399
+ this.reactPortalStore = reactPortalStore;
400
+ this._element = document.createElement("div");
401
+ this._element.className = "dv-react-part";
402
+ this._element.style.display = "inline-flex";
403
+ }
404
+ init(params) {
405
+ this.part = new ReactPart(this._element, this.reactPortalStore, this.component, {
406
+ tabGroup: params.tabGroup,
407
+ api: params.api
408
+ });
409
+ }
410
+ update(params) {
411
+ var _this$part;
412
+ (_this$part = this.part) === null || _this$part === void 0 || _this$part.update({ tabGroup: params.tabGroup });
413
+ }
414
+ dispose() {
415
+ var _this$part2;
416
+ (_this$part2 = this.part) === null || _this$part2 === void 0 || _this$part2.dispose();
417
+ }
418
+ };
380
419
 
381
- class ReactGroupDragGhostPart {
382
- get element() {
383
- return this._element;
384
- }
385
- constructor(component, reactPortalStore) {
386
- this.component = component;
387
- this.reactPortalStore = reactPortalStore;
388
- this._element = document.createElement('div');
389
- this._element.className = 'dv-react-part';
390
- this._element.style.display = 'inline-flex';
391
- }
392
- init(params) {
393
- this.part = new ReactPart(this._element, this.reactPortalStore, this.component, {
394
- group: params.group,
395
- api: params.api,
396
- });
397
- }
398
- dispose() {
399
- var _a;
400
- (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
401
- }
402
- }
420
+ //#endregion
421
+ //#region src/dockview/reactGroupDragGhostPart.ts
422
+ var ReactGroupDragGhostPart = class {
423
+ get element() {
424
+ return this._element;
425
+ }
426
+ constructor(component, reactPortalStore) {
427
+ this.component = component;
428
+ this.reactPortalStore = reactPortalStore;
429
+ this._element = document.createElement("div");
430
+ this._element.className = "dv-react-part";
431
+ this._element.style.display = "inline-flex";
432
+ }
433
+ init(params) {
434
+ this.part = new ReactPart(this._element, this.reactPortalStore, this.component, {
435
+ group: params.group,
436
+ api: params.api
437
+ });
438
+ }
439
+ dispose() {
440
+ var _this$part;
441
+ (_this$part = this.part) === null || _this$part === void 0 || _this$part.dispose();
442
+ }
443
+ };
403
444
 
445
+ //#endregion
446
+ //#region src/dockview/dockview.tsx
404
447
  function createGroupControlElement(component, store) {
405
- return component
406
- ? (groupPanel) => {
407
- return new ReactHeaderActionsRendererPart(component, store, groupPanel);
408
- }
409
- : undefined;
448
+ return component ? (groupPanel) => {
449
+ return new ReactHeaderActionsRendererPart(component, store, groupPanel);
450
+ } : void 0;
410
451
  }
411
- const DEFAULT_REACT_TAB = 'props.defaultTabComponent';
452
+ const DEFAULT_REACT_TAB = "props.defaultTabComponent";
412
453
  function extractCoreOptions$3(props) {
413
- const coreOptions = PROPERTY_KEYS_DOCKVIEW.reduce((obj, key) => {
414
- if (key in props) {
415
- obj[key] = props[key];
416
- }
417
- return obj;
418
- }, {});
419
- return coreOptions;
454
+ return PROPERTY_KEYS_DOCKVIEW.reduce((obj, key) => {
455
+ if (key in props) obj[key] = props[key];
456
+ return obj;
457
+ }, {});
420
458
  }
421
459
  const DockviewReact = React.forwardRef((props, ref) => {
422
- const domRef = React.useRef(null);
423
- const dockviewRef = React.useRef(undefined);
424
- const [portals, addPortal] = usePortalsLifecycle();
425
- React.useImperativeHandle(ref, () => domRef.current, []);
426
- const prevProps = React.useRef({});
427
- React.useEffect(() => {
428
- const changes = {};
429
- PROPERTY_KEYS_DOCKVIEW.forEach((propKey) => {
430
- const key = propKey;
431
- const propValue = props[key];
432
- if (key in props && propValue !== prevProps.current[key]) {
433
- changes[key] = propValue;
434
- }
435
- });
436
- if (dockviewRef.current) {
437
- dockviewRef.current.updateOptions(changes);
438
- }
439
- prevProps.current = props;
440
- }, PROPERTY_KEYS_DOCKVIEW.map((key) => props[key]));
441
- React.useEffect(() => {
442
- var _a;
443
- if (!domRef.current) {
444
- return;
445
- }
446
- const frameworkTabComponents = (_a = props.tabComponents) !== null && _a !== void 0 ? _a : {};
447
- if (props.defaultTabComponent) {
448
- frameworkTabComponents[DEFAULT_REACT_TAB] =
449
- props.defaultTabComponent;
450
- }
451
- const frameworkOptions = {
452
- createLeftHeaderActionComponent: createGroupControlElement(props.leftHeaderActionsComponent, { addPortal }),
453
- createRightHeaderActionComponent: createGroupControlElement(props.rightHeaderActionsComponent, { addPortal }),
454
- createPrefixHeaderActionComponent: createGroupControlElement(props.prefixHeaderActionsComponent, { addPortal }),
455
- createComponent: (options) => {
456
- return new ReactPanelContentPart(options.id, props.components[options.name], {
457
- addPortal,
458
- });
459
- },
460
- createTabComponent(options) {
461
- return new ReactPanelHeaderPart(options.id, frameworkTabComponents[options.name], {
462
- addPortal,
463
- });
464
- },
465
- createWatermarkComponent: props.watermarkComponent
466
- ? () => {
467
- return new ReactWatermarkPart('watermark', props.watermarkComponent, {
468
- addPortal,
469
- });
470
- }
471
- : undefined,
472
- defaultTabComponent: props.defaultTabComponent
473
- ? DEFAULT_REACT_TAB
474
- : undefined,
475
- createContextMenuItemComponent: (options) => {
476
- if (!options.component) {
477
- return undefined;
478
- }
479
- return new ReactContextMenuItemPart(options.id, options.component, { addPortal });
480
- },
481
- };
482
- const coreOptions = extractCoreOptions$3(props);
483
- if (props.tabGroupChipComponent) {
484
- const chipComponent = props.tabGroupChipComponent;
485
- coreOptions.createTabGroupChipComponent = () => {
486
- return new ReactTabGroupChipPart(chipComponent, {
487
- addPortal,
488
- });
489
- };
490
- }
491
- if (props.groupDragGhostComponent) {
492
- const ghostComponent = props.groupDragGhostComponent;
493
- coreOptions.createGroupDragGhostComponent = () => {
494
- return new ReactGroupDragGhostPart(ghostComponent, {
495
- addPortal,
496
- });
497
- };
498
- }
499
- const api = createDockview(domRef.current, Object.assign(Object.assign({}, coreOptions), frameworkOptions));
500
- const { clientWidth, clientHeight } = domRef.current;
501
- api.layout(clientWidth, clientHeight);
502
- if (props.onReady) {
503
- props.onReady({ api });
504
- }
505
- dockviewRef.current = api;
506
- return () => {
507
- dockviewRef.current = undefined;
508
- api.dispose();
509
- };
510
- }, []);
511
- React.useEffect(() => {
512
- if (!dockviewRef.current) {
513
- return () => {
514
- // noop
515
- };
516
- }
517
- const disposable = dockviewRef.current.onDidDrop((event) => {
518
- if (props.onDidDrop) {
519
- props.onDidDrop(event);
520
- }
521
- });
522
- return () => {
523
- disposable.dispose();
524
- };
525
- }, [props.onDidDrop]);
526
- React.useEffect(() => {
527
- if (!dockviewRef.current) {
528
- return () => {
529
- // noop
530
- };
531
- }
532
- const disposable = dockviewRef.current.onWillDrop((event) => {
533
- if (props.onWillDrop) {
534
- props.onWillDrop(event);
535
- }
536
- });
537
- return () => {
538
- disposable.dispose();
539
- };
540
- }, [props.onWillDrop]);
541
- React.useEffect(() => {
542
- if (!dockviewRef.current) {
543
- return;
544
- }
545
- dockviewRef.current.updateOptions({
546
- createTabGroupChipComponent: props.tabGroupChipComponent
547
- ? () => {
548
- return new ReactTabGroupChipPart(props.tabGroupChipComponent, {
549
- addPortal,
550
- });
551
- }
552
- : undefined,
553
- });
554
- }, [props.tabGroupChipComponent]);
555
- React.useEffect(() => {
556
- if (!dockviewRef.current) {
557
- return;
558
- }
559
- dockviewRef.current.updateOptions({
560
- createGroupDragGhostComponent: props.groupDragGhostComponent
561
- ? () => {
562
- return new ReactGroupDragGhostPart(props.groupDragGhostComponent, {
563
- addPortal,
564
- });
565
- }
566
- : undefined,
567
- });
568
- }, [props.groupDragGhostComponent]);
569
- React.useEffect(() => {
570
- if (!dockviewRef.current) {
571
- return;
572
- }
573
- dockviewRef.current.updateOptions({
574
- createComponent: (options) => {
575
- return new ReactPanelContentPart(options.id, props.components[options.name], {
576
- addPortal,
577
- });
578
- },
579
- });
580
- }, [props.components]);
581
- React.useEffect(() => {
582
- var _a;
583
- if (!dockviewRef.current) {
584
- return;
585
- }
586
- const frameworkTabComponents = (_a = props.tabComponents) !== null && _a !== void 0 ? _a : {};
587
- if (props.defaultTabComponent) {
588
- frameworkTabComponents[DEFAULT_REACT_TAB] =
589
- props.defaultTabComponent;
590
- }
591
- dockviewRef.current.updateOptions({
592
- defaultTabComponent: props.defaultTabComponent
593
- ? DEFAULT_REACT_TAB
594
- : undefined,
595
- createTabComponent(options) {
596
- return new ReactPanelHeaderPart(options.id, frameworkTabComponents[options.name], {
597
- addPortal,
598
- });
599
- },
600
- });
601
- }, [props.tabComponents, props.defaultTabComponent]);
602
- React.useEffect(() => {
603
- if (!dockviewRef.current) {
604
- return;
605
- }
606
- dockviewRef.current.updateOptions({
607
- createWatermarkComponent: props.watermarkComponent
608
- ? () => {
609
- return new ReactWatermarkPart('watermark', props.watermarkComponent, {
610
- addPortal,
611
- });
612
- }
613
- : undefined,
614
- });
615
- }, [props.watermarkComponent]);
616
- React.useEffect(() => {
617
- if (!dockviewRef.current) {
618
- return;
619
- }
620
- dockviewRef.current.updateOptions({
621
- createRightHeaderActionComponent: createGroupControlElement(props.rightHeaderActionsComponent, { addPortal }),
622
- });
623
- }, [props.rightHeaderActionsComponent]);
624
- React.useEffect(() => {
625
- if (!dockviewRef.current) {
626
- return;
627
- }
628
- dockviewRef.current.updateOptions({
629
- createLeftHeaderActionComponent: createGroupControlElement(props.leftHeaderActionsComponent, { addPortal }),
630
- });
631
- }, [props.leftHeaderActionsComponent]);
632
- React.useEffect(() => {
633
- if (!dockviewRef.current) {
634
- return;
635
- }
636
- dockviewRef.current.updateOptions({
637
- createPrefixHeaderActionComponent: createGroupControlElement(props.prefixHeaderActionsComponent, { addPortal }),
638
- });
639
- }, [props.prefixHeaderActionsComponent]);
640
- return (React.createElement("div", { style: { height: '100%', width: '100%' }, ref: domRef }, portals));
460
+ const domRef = React.useRef(null);
461
+ const dockviewRef = React.useRef(void 0);
462
+ const [portals, addPortal] = usePortalsLifecycle();
463
+ React.useImperativeHandle(ref, () => domRef.current, []);
464
+ const prevProps = React.useRef({});
465
+ React.useEffect(() => {
466
+ const changes = {};
467
+ PROPERTY_KEYS_DOCKVIEW.forEach((propKey) => {
468
+ const key = propKey;
469
+ const propValue = props[key];
470
+ if (key in props && propValue !== prevProps.current[key]) changes[key] = propValue;
471
+ });
472
+ if (dockviewRef.current) dockviewRef.current.updateOptions(changes);
473
+ prevProps.current = props;
474
+ }, PROPERTY_KEYS_DOCKVIEW.map((key) => props[key]));
475
+ React.useEffect(() => {
476
+ if (!domRef.current) return;
477
+ const frameworkTabComponents = _objectSpread2({}, props.tabComponents);
478
+ if (props.defaultTabComponent) frameworkTabComponents[DEFAULT_REACT_TAB] = props.defaultTabComponent;
479
+ const frameworkOptions = {
480
+ createLeftHeaderActionComponent: createGroupControlElement(props.leftHeaderActionsComponent, { addPortal }),
481
+ createRightHeaderActionComponent: createGroupControlElement(props.rightHeaderActionsComponent, { addPortal }),
482
+ createPrefixHeaderActionComponent: createGroupControlElement(props.prefixHeaderActionsComponent, { addPortal }),
483
+ createComponent: (options) => {
484
+ return new ReactPanelContentPart(options.id, props.components[options.name], { addPortal });
485
+ },
486
+ createTabComponent(options) {
487
+ return new ReactPanelHeaderPart(options.id, frameworkTabComponents[options.name], { addPortal });
488
+ },
489
+ createWatermarkComponent: props.watermarkComponent ? () => {
490
+ return new ReactWatermarkPart("watermark", props.watermarkComponent, { addPortal });
491
+ } : void 0,
492
+ defaultTabComponent: props.defaultTabComponent ? DEFAULT_REACT_TAB : void 0,
493
+ createContextMenuItemComponent: (options) => {
494
+ if (!options.component) return;
495
+ return new ReactContextMenuItemPart(options.id, options.component, { addPortal });
496
+ }
497
+ };
498
+ const coreOptions = extractCoreOptions$3(props);
499
+ if (props.tabGroupChipComponent) {
500
+ const chipComponent = props.tabGroupChipComponent;
501
+ coreOptions.createTabGroupChipComponent = () => {
502
+ return new ReactTabGroupChipPart(chipComponent, { addPortal });
503
+ };
504
+ }
505
+ if (props.groupDragGhostComponent) {
506
+ const ghostComponent = props.groupDragGhostComponent;
507
+ coreOptions.createGroupDragGhostComponent = () => {
508
+ return new ReactGroupDragGhostPart(ghostComponent, { addPortal });
509
+ };
510
+ }
511
+ const api = createDockview(domRef.current, _objectSpread2(_objectSpread2({}, coreOptions), frameworkOptions));
512
+ const { clientWidth, clientHeight } = domRef.current;
513
+ api.layout(clientWidth, clientHeight);
514
+ if (props.onReady) props.onReady({ api });
515
+ dockviewRef.current = api;
516
+ return () => {
517
+ dockviewRef.current = void 0;
518
+ api.dispose();
519
+ };
520
+ }, []);
521
+ React.useEffect(() => {
522
+ if (!dockviewRef.current) return () => {};
523
+ const disposable = dockviewRef.current.onDidDrop((event) => {
524
+ if (props.onDidDrop) props.onDidDrop(event);
525
+ });
526
+ return () => {
527
+ disposable.dispose();
528
+ };
529
+ }, [props.onDidDrop]);
530
+ React.useEffect(() => {
531
+ if (!dockviewRef.current) return () => {};
532
+ const disposable = dockviewRef.current.onWillDrop((event) => {
533
+ if (props.onWillDrop) props.onWillDrop(event);
534
+ });
535
+ return () => {
536
+ disposable.dispose();
537
+ };
538
+ }, [props.onWillDrop]);
539
+ React.useEffect(() => {
540
+ if (!dockviewRef.current) return;
541
+ dockviewRef.current.updateOptions({ createTabGroupChipComponent: props.tabGroupChipComponent ? () => {
542
+ return new ReactTabGroupChipPart(props.tabGroupChipComponent, { addPortal });
543
+ } : void 0 });
544
+ }, [props.tabGroupChipComponent]);
545
+ React.useEffect(() => {
546
+ if (!dockviewRef.current) return;
547
+ dockviewRef.current.updateOptions({ createGroupDragGhostComponent: props.groupDragGhostComponent ? () => {
548
+ return new ReactGroupDragGhostPart(props.groupDragGhostComponent, { addPortal });
549
+ } : void 0 });
550
+ }, [props.groupDragGhostComponent]);
551
+ React.useEffect(() => {
552
+ if (!dockviewRef.current) return;
553
+ dockviewRef.current.updateOptions({ createComponent: (options) => {
554
+ return new ReactPanelContentPart(options.id, props.components[options.name], { addPortal });
555
+ } });
556
+ }, [props.components]);
557
+ React.useEffect(() => {
558
+ if (!dockviewRef.current) return;
559
+ const frameworkTabComponents = _objectSpread2({}, props.tabComponents);
560
+ if (props.defaultTabComponent) frameworkTabComponents[DEFAULT_REACT_TAB] = props.defaultTabComponent;
561
+ dockviewRef.current.updateOptions({
562
+ defaultTabComponent: props.defaultTabComponent ? DEFAULT_REACT_TAB : void 0,
563
+ createTabComponent(options) {
564
+ return new ReactPanelHeaderPart(options.id, frameworkTabComponents[options.name], { addPortal });
565
+ }
566
+ });
567
+ }, [props.tabComponents, props.defaultTabComponent]);
568
+ React.useEffect(() => {
569
+ if (!dockviewRef.current) return;
570
+ dockviewRef.current.updateOptions({ createWatermarkComponent: props.watermarkComponent ? () => {
571
+ return new ReactWatermarkPart("watermark", props.watermarkComponent, { addPortal });
572
+ } : void 0 });
573
+ }, [props.watermarkComponent]);
574
+ React.useEffect(() => {
575
+ if (!dockviewRef.current) return;
576
+ dockviewRef.current.updateOptions({ createRightHeaderActionComponent: createGroupControlElement(props.rightHeaderActionsComponent, { addPortal }) });
577
+ }, [props.rightHeaderActionsComponent]);
578
+ React.useEffect(() => {
579
+ if (!dockviewRef.current) return;
580
+ dockviewRef.current.updateOptions({ createLeftHeaderActionComponent: createGroupControlElement(props.leftHeaderActionsComponent, { addPortal }) });
581
+ }, [props.leftHeaderActionsComponent]);
582
+ React.useEffect(() => {
583
+ if (!dockviewRef.current) return;
584
+ dockviewRef.current.updateOptions({ createPrefixHeaderActionComponent: createGroupControlElement(props.prefixHeaderActionsComponent, { addPortal }) });
585
+ }, [props.prefixHeaderActionsComponent]);
586
+ return /* @__PURE__ */ React.createElement("div", {
587
+ style: {
588
+ height: "100%",
589
+ width: "100%"
590
+ },
591
+ ref: domRef
592
+ }, portals);
641
593
  });
642
- DockviewReact.displayName = 'DockviewComponent';
594
+ DockviewReact.displayName = "DockviewComponent";
643
595
 
644
- /******************************************************************************
645
- Copyright (c) Microsoft Corporation.
646
-
647
- Permission to use, copy, modify, and/or distribute this software for any
648
- purpose with or without fee is hereby granted.
649
-
650
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
651
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
652
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
653
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
654
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
655
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
656
- PERFORMANCE OF THIS SOFTWARE.
657
- ***************************************************************************** */
658
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
659
-
660
-
661
- function __rest(s, e) {
662
- var t = {};
663
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
664
- t[p] = s[p];
665
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
666
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
667
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
668
- t[p[i]] = s[p[i]];
669
- }
670
- return t;
671
- }
672
-
673
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
674
- var e = new Error(message);
675
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
676
- };
596
+ //#endregion
597
+ //#region src/svg.tsx
598
+ const CloseButton = () => /* @__PURE__ */ React.createElement("svg", {
599
+ height: "11",
600
+ width: "11",
601
+ viewBox: "0 0 28 28",
602
+ "aria-hidden": "false",
603
+ focusable: false,
604
+ className: "dv-svg"
605
+ }, /* @__PURE__ */ React.createElement("path", { d: "M2.1 27.3L0 25.2L11.55 13.65L0 2.1L2.1 0L13.65 11.55L25.2 0L27.3 2.1L15.75 13.65L27.3 25.2L25.2 27.3L13.65 15.75L2.1 27.3Z" }));
606
+ const PinButton = () => /* @__PURE__ */ React.createElement("svg", {
607
+ height: "11",
608
+ width: "11",
609
+ viewBox: "0 0 24 24",
610
+ "aria-hidden": "false",
611
+ focusable: false,
612
+ className: "dv-svg"
613
+ }, /* @__PURE__ */ React.createElement("path", { d: "M16 9V4h1c.55 0 1-.45 1-1s-.45-1-1-1H6c-.55 0-1 .45-1 1s.45 1 1 1h1v5c0 1.66-1.34 3-3 3v2h5.97v7l1 1 1-1v-7H19v-2c-1.66 0-3-1.34-3-3z" }));
677
614
 
678
- const CloseButton = () => (React.createElement("svg", { height: "11", width: "11", viewBox: "0 0 28 28", "aria-hidden": 'false', focusable: false, className: "dv-svg" },
679
- React.createElement("path", { d: "M2.1 27.3L0 25.2L11.55 13.65L0 2.1L2.1 0L13.65 11.55L25.2 0L27.3 2.1L15.75 13.65L27.3 25.2L25.2 27.3L13.65 15.75L2.1 27.3Z" })));
615
+ //#endregion
616
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/objectWithoutPropertiesLoose.js
617
+ function _objectWithoutPropertiesLoose(r, e) {
618
+ if (null == r) return {};
619
+ var t = {};
620
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
621
+ if (e.includes(n)) continue;
622
+ t[n] = r[n];
623
+ }
624
+ return t;
625
+ }
626
+
627
+ //#endregion
628
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/objectWithoutProperties.js
629
+ function _objectWithoutProperties(e, t) {
630
+ if (null == e) return {};
631
+ var o, r, i = _objectWithoutPropertiesLoose(e, t);
632
+ if (Object.getOwnPropertySymbols) {
633
+ var s = Object.getOwnPropertySymbols(e);
634
+ for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
635
+ }
636
+ return i;
637
+ }
680
638
 
639
+ //#endregion
640
+ //#region src/dockview/defaultTab.tsx
641
+ const _excluded = [
642
+ "api",
643
+ "containerApi",
644
+ "params",
645
+ "hideClose",
646
+ "closeActionOverride",
647
+ "onPointerDown",
648
+ "onPointerUp",
649
+ "onPointerLeave",
650
+ "tabLocation"
651
+ ];
681
652
  function useTitle(api) {
682
- const [title, setTitle] = React.useState(api.title);
683
- React.useEffect(() => {
684
- const disposable = api.onDidTitleChange((event) => {
685
- setTitle(event.title);
686
- });
687
- // Depending on the order in which React effects are run, the title may already be out of sync (cf. issue #1003).
688
- if (title !== api.title) {
689
- setTitle(api.title);
690
- }
691
- return () => {
692
- disposable.dispose();
693
- };
694
- }, [api]);
695
- return title;
653
+ const [title, setTitle] = React.useState(api.title);
654
+ React.useEffect(() => {
655
+ const disposable = api.onDidTitleChange((event) => {
656
+ setTitle(event.title);
657
+ });
658
+ if (title !== api.title) setTitle(api.title);
659
+ return () => {
660
+ disposable.dispose();
661
+ };
662
+ }, [api]);
663
+ return title;
696
664
  }
697
- const DockviewDefaultTab = (_a) => {
698
- var { api, containerApi: _containerApi, params: _params, hideClose, closeActionOverride, onPointerDown, onPointerUp, onPointerLeave, tabLocation } = _a, rest = __rest(_a, ["api", "containerApi", "params", "hideClose", "closeActionOverride", "onPointerDown", "onPointerUp", "onPointerLeave", "tabLocation"]);
699
- const title = useTitle(api);
700
- const isMiddleMouseButton = React.useRef(false);
701
- const onClose = React.useCallback((event) => {
702
- event.preventDefault();
703
- if (closeActionOverride) {
704
- closeActionOverride();
705
- }
706
- else {
707
- api.close();
708
- }
709
- }, [api, closeActionOverride]);
710
- const onBtnPointerDown = React.useCallback((event) => {
711
- event.preventDefault();
712
- }, []);
713
- const _onPointerDown = React.useCallback((event) => {
714
- isMiddleMouseButton.current = event.button === 1;
715
- onPointerDown === null || onPointerDown === void 0 ? void 0 : onPointerDown(event);
716
- }, [onPointerDown]);
717
- const _onPointerUp = React.useCallback((event) => {
718
- if (isMiddleMouseButton && event.button === 1 && !hideClose) {
719
- isMiddleMouseButton.current = false;
720
- onClose(event);
721
- }
722
- onPointerUp === null || onPointerUp === void 0 ? void 0 : onPointerUp(event);
723
- }, [onPointerUp, onClose, hideClose]);
724
- const _onPointerLeave = React.useCallback((event) => {
725
- isMiddleMouseButton.current = false;
726
- onPointerLeave === null || onPointerLeave === void 0 ? void 0 : onPointerLeave(event);
727
- }, [onPointerLeave]);
728
- return (React.createElement("div", Object.assign({ "data-testid": "dockview-dv-default-tab" }, rest, { onPointerDown: _onPointerDown, onPointerUp: _onPointerUp, onPointerLeave: _onPointerLeave, className: "dv-default-tab" }),
729
- React.createElement("span", { className: "dv-default-tab-content" }, title),
730
- !hideClose && (React.createElement("div", { className: "dv-default-tab-action", onPointerDown: onBtnPointerDown, onClick: onClose },
731
- React.createElement(CloseButton, null)))));
665
+ function useIsPinned(api) {
666
+ const [isPinned, setIsPinned] = React.useState(api.isPinned);
667
+ React.useEffect(() => {
668
+ const disposable = api.onDidChangePinned((event) => {
669
+ setIsPinned(event.isPinned);
670
+ });
671
+ if (isPinned !== api.isPinned) setIsPinned(api.isPinned);
672
+ return () => {
673
+ disposable.dispose();
674
+ };
675
+ }, [api]);
676
+ return isPinned;
677
+ }
678
+ const DockviewDefaultTab = (_ref) => {
679
+ let { api, containerApi: _containerApi, params: _params, hideClose, closeActionOverride, onPointerDown, onPointerUp, onPointerLeave, tabLocation } = _ref, rest = _objectWithoutProperties(_ref, _excluded);
680
+ const title = useTitle(api);
681
+ const isPinned = useIsPinned(api);
682
+ const isMiddleMouseButton = React.useRef(false);
683
+ const onClose = React.useCallback((event) => {
684
+ event.preventDefault();
685
+ if (closeActionOverride) closeActionOverride();
686
+ else api.close();
687
+ }, [api, closeActionOverride]);
688
+ const onBtnPointerDown = React.useCallback((event) => {
689
+ event.preventDefault();
690
+ }, []);
691
+ const _onPointerDown = React.useCallback((event) => {
692
+ isMiddleMouseButton.current = event.button === 1;
693
+ onPointerDown === null || onPointerDown === void 0 || onPointerDown(event);
694
+ }, [onPointerDown]);
695
+ const _onPointerUp = React.useCallback((event) => {
696
+ if (isMiddleMouseButton.current && event.button === 1 && !hideClose) {
697
+ isMiddleMouseButton.current = false;
698
+ onClose(event);
699
+ }
700
+ onPointerUp === null || onPointerUp === void 0 || onPointerUp(event);
701
+ }, [
702
+ onPointerUp,
703
+ onClose,
704
+ hideClose
705
+ ]);
706
+ const _onPointerLeave = React.useCallback((event) => {
707
+ isMiddleMouseButton.current = false;
708
+ onPointerLeave === null || onPointerLeave === void 0 || onPointerLeave(event);
709
+ }, [onPointerLeave]);
710
+ return /* @__PURE__ */ React.createElement("div", _objectSpread2(_objectSpread2({ "data-testid": "dockview-dv-default-tab" }, rest), {}, {
711
+ onPointerDown: _onPointerDown,
712
+ onPointerUp: _onPointerUp,
713
+ onPointerLeave: _onPointerLeave,
714
+ className: "dv-default-tab"
715
+ }), isPinned && /* @__PURE__ */ React.createElement("div", { className: "dv-tab-pin" }, /* @__PURE__ */ React.createElement(PinButton, null)), /* @__PURE__ */ React.createElement("span", { className: "dv-default-tab-content" }, title), !hideClose && /* @__PURE__ */ React.createElement("button", {
716
+ type: "button",
717
+ className: "dv-default-tab-action",
718
+ "aria-label": "Close tab",
719
+ onPointerDown: onBtnPointerDown,
720
+ onClick: onClose
721
+ }, /* @__PURE__ */ React.createElement(CloseButton, null)));
732
722
  };
733
723
 
734
- class ReactPanelView extends SplitviewPanel {
735
- constructor(id, component, reactComponent, reactPortalStore) {
736
- super(id, component);
737
- this.reactComponent = reactComponent;
738
- this.reactPortalStore = reactPortalStore;
739
- }
740
- getComponent() {
741
- var _a, _b;
742
- return new ReactPart(this.element, this.reactPortalStore, this.reactComponent, {
743
- params: (_b = (_a = this._params) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {},
744
- api: this.api,
745
- containerApi: new SplitviewApi(this._params.accessor),
746
- });
747
- }
748
- }
724
+ //#endregion
725
+ //#region src/splitview/view.ts
726
+ var ReactPanelView = class extends SplitviewPanel {
727
+ constructor(id, component, reactComponent, reactPortalStore) {
728
+ super(id, component);
729
+ this.reactComponent = reactComponent;
730
+ this.reactPortalStore = reactPortalStore;
731
+ }
732
+ getComponent() {
733
+ var _this$_params$params, _this$_params;
734
+ return new ReactPart(this.element, this.reactPortalStore, this.reactComponent, {
735
+ params: (_this$_params$params = (_this$_params = this._params) === null || _this$_params === void 0 ? void 0 : _this$_params.params) !== null && _this$_params$params !== void 0 ? _this$_params$params : {},
736
+ api: this.api,
737
+ containerApi: new SplitviewApi(this._params.accessor)
738
+ });
739
+ }
740
+ };
749
741
 
742
+ //#endregion
743
+ //#region src/splitview/splitview.tsx
750
744
  function extractCoreOptions$2(props) {
751
- const coreOptions = PROPERTY_KEYS_SPLITVIEW.reduce((obj, key) => {
752
- if (key in props) {
753
- obj[key] = props[key];
754
- }
755
- return obj;
756
- }, {});
757
- return coreOptions;
745
+ return PROPERTY_KEYS_SPLITVIEW.reduce((obj, key) => {
746
+ if (key in props) obj[key] = props[key];
747
+ return obj;
748
+ }, {});
758
749
  }
759
750
  const SplitviewReact = React.forwardRef((props, ref) => {
760
- const domRef = React.useRef(null);
761
- const splitviewRef = React.useRef(undefined);
762
- const [portals, addPortal] = usePortalsLifecycle();
763
- React.useImperativeHandle(ref, () => domRef.current, []);
764
- const prevProps = React.useRef({});
765
- React.useEffect(() => {
766
- const changes = {};
767
- PROPERTY_KEYS_SPLITVIEW.forEach((propKey) => {
768
- const key = propKey;
769
- const propValue = props[key];
770
- if (key in props && propValue !== prevProps.current[key]) {
771
- changes[key] = propValue;
772
- }
773
- });
774
- if (splitviewRef.current) {
775
- splitviewRef.current.updateOptions(changes);
776
- }
777
- prevProps.current = props;
778
- }, PROPERTY_KEYS_SPLITVIEW.map((key) => props[key]));
779
- React.useEffect(() => {
780
- if (!domRef.current) {
781
- return () => {
782
- // noop
783
- };
784
- }
785
- const frameworkOptions = {
786
- createComponent: (options) => {
787
- return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
788
- },
789
- };
790
- const api = createSplitview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$2(props)), frameworkOptions));
791
- const { clientWidth, clientHeight } = domRef.current;
792
- api.layout(clientWidth, clientHeight);
793
- if (props.onReady) {
794
- props.onReady({ api });
795
- }
796
- splitviewRef.current = api;
797
- return () => {
798
- splitviewRef.current = undefined;
799
- api.dispose();
800
- };
801
- }, []);
802
- React.useEffect(() => {
803
- if (!splitviewRef.current) {
804
- return;
805
- }
806
- splitviewRef.current.updateOptions({
807
- createComponent: (options) => {
808
- return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
809
- },
810
- });
811
- }, [props.components]);
812
- return (React.createElement("div", { style: { height: '100%', width: '100%' }, ref: domRef }, portals));
751
+ const domRef = React.useRef(null);
752
+ const splitviewRef = React.useRef(void 0);
753
+ const [portals, addPortal] = usePortalsLifecycle();
754
+ React.useImperativeHandle(ref, () => domRef.current, []);
755
+ const prevProps = React.useRef({});
756
+ React.useEffect(() => {
757
+ const changes = {};
758
+ PROPERTY_KEYS_SPLITVIEW.forEach((propKey) => {
759
+ const key = propKey;
760
+ const propValue = props[key];
761
+ if (key in props && propValue !== prevProps.current[key]) changes[key] = propValue;
762
+ });
763
+ if (splitviewRef.current) splitviewRef.current.updateOptions(changes);
764
+ prevProps.current = props;
765
+ }, PROPERTY_KEYS_SPLITVIEW.map((key) => props[key]));
766
+ React.useEffect(() => {
767
+ if (!domRef.current) return () => {};
768
+ const api = createSplitview(domRef.current, _objectSpread2(_objectSpread2({}, extractCoreOptions$2(props)), { createComponent: (options) => {
769
+ return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
770
+ } }));
771
+ const { clientWidth, clientHeight } = domRef.current;
772
+ api.layout(clientWidth, clientHeight);
773
+ if (props.onReady) props.onReady({ api });
774
+ splitviewRef.current = api;
775
+ return () => {
776
+ splitviewRef.current = void 0;
777
+ api.dispose();
778
+ };
779
+ }, []);
780
+ React.useEffect(() => {
781
+ if (!splitviewRef.current) return;
782
+ splitviewRef.current.updateOptions({ createComponent: (options) => {
783
+ return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
784
+ } });
785
+ }, [props.components]);
786
+ return /* @__PURE__ */ React.createElement("div", {
787
+ style: {
788
+ height: "100%",
789
+ width: "100%"
790
+ },
791
+ ref: domRef
792
+ }, portals);
813
793
  });
814
- SplitviewReact.displayName = 'SplitviewComponent';
794
+ SplitviewReact.displayName = "SplitviewComponent";
815
795
 
816
- class ReactGridPanelView extends GridviewPanel {
817
- constructor(id, component, reactComponent, reactPortalStore) {
818
- super(id, component);
819
- this.reactComponent = reactComponent;
820
- this.reactPortalStore = reactPortalStore;
821
- }
822
- getComponent() {
823
- var _a, _b;
824
- return new ReactPart(this.element, this.reactPortalStore, this.reactComponent, {
825
- params: (_b = (_a = this._params) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {},
826
- api: this.api,
827
- // TODO: fix casting hack
828
- containerApi: new GridviewApi(this._params
829
- .accessor),
830
- });
831
- }
832
- }
796
+ //#endregion
797
+ //#region src/gridview/view.ts
798
+ var ReactGridPanelView = class extends GridviewPanel {
799
+ constructor(id, component, reactComponent, reactPortalStore) {
800
+ super(id, component);
801
+ this.reactComponent = reactComponent;
802
+ this.reactPortalStore = reactPortalStore;
803
+ }
804
+ getComponent() {
805
+ var _this$_params$params, _this$_params;
806
+ return new ReactPart(this.element, this.reactPortalStore, this.reactComponent, {
807
+ params: (_this$_params$params = (_this$_params = this._params) === null || _this$_params === void 0 ? void 0 : _this$_params.params) !== null && _this$_params$params !== void 0 ? _this$_params$params : {},
808
+ api: this.api,
809
+ containerApi: new GridviewApi(this._params.accessor)
810
+ });
811
+ }
812
+ };
833
813
 
814
+ //#endregion
815
+ //#region src/gridview/gridview.tsx
834
816
  function extractCoreOptions$1(props) {
835
- const coreOptions = PROPERTY_KEYS_GRIDVIEW.reduce((obj, key) => {
836
- if (key in props) {
837
- obj[key] = props[key];
838
- }
839
- return obj;
840
- }, {});
841
- return coreOptions;
817
+ return PROPERTY_KEYS_GRIDVIEW.reduce((obj, key) => {
818
+ if (key in props) obj[key] = props[key];
819
+ return obj;
820
+ }, {});
842
821
  }
843
822
  const GridviewReact = React.forwardRef((props, ref) => {
844
- const domRef = React.useRef(null);
845
- const gridviewRef = React.useRef(undefined);
846
- const [portals, addPortal] = usePortalsLifecycle();
847
- React.useImperativeHandle(ref, () => domRef.current, []);
848
- const prevProps = React.useRef({});
849
- React.useEffect(() => {
850
- const changes = {};
851
- PROPERTY_KEYS_GRIDVIEW.forEach((propKey) => {
852
- const key = propKey;
853
- const propValue = props[key];
854
- if (key in props && propValue !== prevProps.current[key]) {
855
- changes[key] = propValue;
856
- }
857
- });
858
- if (gridviewRef.current) {
859
- gridviewRef.current.updateOptions(changes);
860
- }
861
- prevProps.current = props;
862
- }, PROPERTY_KEYS_GRIDVIEW.map((key) => props[key]));
863
- React.useEffect(() => {
864
- if (!domRef.current) {
865
- return () => {
866
- // noop
867
- };
868
- }
869
- const frameworkOptions = {
870
- createComponent: (options) => {
871
- return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
872
- },
873
- };
874
- const api = createGridview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$1(props)), frameworkOptions));
875
- const { clientWidth, clientHeight } = domRef.current;
876
- api.layout(clientWidth, clientHeight);
877
- if (props.onReady) {
878
- props.onReady({ api });
879
- }
880
- gridviewRef.current = api;
881
- return () => {
882
- gridviewRef.current = undefined;
883
- api.dispose();
884
- };
885
- }, []);
886
- React.useEffect(() => {
887
- if (!gridviewRef.current) {
888
- return;
889
- }
890
- gridviewRef.current.updateOptions({
891
- createComponent: (options) => {
892
- return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
893
- },
894
- });
895
- }, [props.components]);
896
- return (React.createElement("div", { style: { height: '100%', width: '100%' }, ref: domRef }, portals));
823
+ const domRef = React.useRef(null);
824
+ const gridviewRef = React.useRef(void 0);
825
+ const [portals, addPortal] = usePortalsLifecycle();
826
+ React.useImperativeHandle(ref, () => domRef.current, []);
827
+ const prevProps = React.useRef({});
828
+ React.useEffect(() => {
829
+ const changes = {};
830
+ PROPERTY_KEYS_GRIDVIEW.forEach((propKey) => {
831
+ const key = propKey;
832
+ const propValue = props[key];
833
+ if (key in props && propValue !== prevProps.current[key]) changes[key] = propValue;
834
+ });
835
+ if (gridviewRef.current) gridviewRef.current.updateOptions(changes);
836
+ prevProps.current = props;
837
+ }, PROPERTY_KEYS_GRIDVIEW.map((key) => props[key]));
838
+ React.useEffect(() => {
839
+ if (!domRef.current) return () => {};
840
+ const api = createGridview(domRef.current, _objectSpread2(_objectSpread2({}, extractCoreOptions$1(props)), { createComponent: (options) => {
841
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
842
+ } }));
843
+ const { clientWidth, clientHeight } = domRef.current;
844
+ api.layout(clientWidth, clientHeight);
845
+ if (props.onReady) props.onReady({ api });
846
+ gridviewRef.current = api;
847
+ return () => {
848
+ gridviewRef.current = void 0;
849
+ api.dispose();
850
+ };
851
+ }, []);
852
+ React.useEffect(() => {
853
+ if (!gridviewRef.current) return;
854
+ gridviewRef.current.updateOptions({ createComponent: (options) => {
855
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
856
+ } });
857
+ }, [props.components]);
858
+ return /* @__PURE__ */ React.createElement("div", {
859
+ style: {
860
+ height: "100%",
861
+ width: "100%"
862
+ },
863
+ ref: domRef
864
+ }, portals);
897
865
  });
898
- GridviewReact.displayName = 'GridviewComponent';
866
+ GridviewReact.displayName = "GridviewComponent";
899
867
 
900
- class PanePanelSection {
901
- get element() {
902
- return this._element;
903
- }
904
- constructor(id, component, reactPortalStore) {
905
- this.id = id;
906
- this.component = component;
907
- this.reactPortalStore = reactPortalStore;
908
- this._element = document.createElement('div');
909
- this._element.style.height = '100%';
910
- this._element.style.width = '100%';
911
- }
912
- init(parameters) {
913
- this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {
914
- params: parameters.params,
915
- api: parameters.api,
916
- title: parameters.title,
917
- containerApi: parameters.containerApi,
918
- });
919
- }
920
- toJSON() {
921
- return {
922
- id: this.id,
923
- };
924
- }
925
- update(params) {
926
- var _a;
927
- (_a = this.part) === null || _a === void 0 ? void 0 : _a.update(params.params);
928
- }
929
- dispose() {
930
- var _a;
931
- (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
932
- }
933
- }
868
+ //#endregion
869
+ //#region src/paneview/view.ts
870
+ var PanePanelSection = class {
871
+ get element() {
872
+ return this._element;
873
+ }
874
+ constructor(id, component, reactPortalStore) {
875
+ this.id = id;
876
+ this.component = component;
877
+ this.reactPortalStore = reactPortalStore;
878
+ this._element = document.createElement("div");
879
+ this._element.style.height = "100%";
880
+ this._element.style.width = "100%";
881
+ }
882
+ init(parameters) {
883
+ this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {
884
+ params: parameters.params,
885
+ api: parameters.api,
886
+ title: parameters.title,
887
+ containerApi: parameters.containerApi
888
+ });
889
+ }
890
+ toJSON() {
891
+ return { id: this.id };
892
+ }
893
+ update(params) {
894
+ var _this$part;
895
+ (_this$part = this.part) === null || _this$part === void 0 || _this$part.update(params.params);
896
+ }
897
+ dispose() {
898
+ var _this$part2;
899
+ (_this$part2 = this.part) === null || _this$part2 === void 0 || _this$part2.dispose();
900
+ }
901
+ };
934
902
 
903
+ //#endregion
904
+ //#region src/paneview/paneview.tsx
935
905
  function extractCoreOptions(props) {
936
- const coreOptions = PROPERTY_KEYS_PANEVIEW.reduce((obj, key) => {
937
- if (key in props) {
938
- obj[key] = props[key];
939
- }
940
- return obj;
941
- }, {});
942
- return coreOptions;
906
+ return PROPERTY_KEYS_PANEVIEW.reduce((obj, key) => {
907
+ if (key in props) obj[key] = props[key];
908
+ return obj;
909
+ }, {});
943
910
  }
944
911
  const PaneviewReact = React.forwardRef((props, ref) => {
945
- const domRef = React.useRef(null);
946
- const paneviewRef = React.useRef(undefined);
947
- const [portals, addPortal] = usePortalsLifecycle();
948
- React.useImperativeHandle(ref, () => domRef.current, []);
949
- const prevProps = React.useRef({});
950
- React.useEffect(() => {
951
- const changes = {};
952
- PROPERTY_KEYS_PANEVIEW.forEach((propKey) => {
953
- const key = propKey;
954
- const propValue = props[key];
955
- if (key in props && propValue !== prevProps.current[key]) {
956
- changes[key] = propValue;
957
- }
958
- });
959
- if (paneviewRef.current) {
960
- paneviewRef.current.updateOptions(changes);
961
- }
962
- prevProps.current = props;
963
- }, PROPERTY_KEYS_PANEVIEW.map((key) => props[key]));
964
- React.useEffect(() => {
965
- var _a;
966
- if (!domRef.current) {
967
- return () => {
968
- // noop
969
- };
970
- }
971
- const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};
972
- const frameworkOptions = {
973
- createComponent: (options) => {
974
- return new PanePanelSection(options.id, props.components[options.name], { addPortal });
975
- },
976
- createHeaderComponent: (options) => {
977
- return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
978
- },
979
- };
980
- const api = createPaneview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
981
- const { clientWidth, clientHeight } = domRef.current;
982
- api.layout(clientWidth, clientHeight);
983
- if (props.onReady) {
984
- props.onReady({ api });
985
- }
986
- paneviewRef.current = api;
987
- return () => {
988
- paneviewRef.current = undefined;
989
- api.dispose();
990
- };
991
- }, []);
992
- React.useEffect(() => {
993
- if (!paneviewRef.current) {
994
- return;
995
- }
996
- paneviewRef.current.updateOptions({
997
- createComponent: (options) => {
998
- return new PanePanelSection(options.id, props.components[options.name], { addPortal });
999
- },
1000
- });
1001
- }, [props.components]);
1002
- React.useEffect(() => {
1003
- var _a;
1004
- if (!paneviewRef.current) {
1005
- return;
1006
- }
1007
- const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};
1008
- paneviewRef.current.updateOptions({
1009
- createHeaderComponent: (options) => {
1010
- return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
1011
- },
1012
- });
1013
- }, [props.headerComponents]);
1014
- React.useEffect(() => {
1015
- if (!paneviewRef.current) {
1016
- return () => {
1017
- // noop
1018
- };
1019
- }
1020
- const disposable = paneviewRef.current.onDidDrop((event) => {
1021
- if (props.onDidDrop) {
1022
- props.onDidDrop(event);
1023
- }
1024
- });
1025
- return () => {
1026
- disposable.dispose();
1027
- };
1028
- }, [props.onDidDrop]);
1029
- return (React.createElement("div", { style: { height: '100%', width: '100%' }, ref: domRef }, portals));
912
+ const domRef = React.useRef(null);
913
+ const paneviewRef = React.useRef(void 0);
914
+ const [portals, addPortal] = usePortalsLifecycle();
915
+ React.useImperativeHandle(ref, () => domRef.current, []);
916
+ const prevProps = React.useRef({});
917
+ React.useEffect(() => {
918
+ const changes = {};
919
+ PROPERTY_KEYS_PANEVIEW.forEach((propKey) => {
920
+ const key = propKey;
921
+ const propValue = props[key];
922
+ if (key in props && propValue !== prevProps.current[key]) changes[key] = propValue;
923
+ });
924
+ if (paneviewRef.current) paneviewRef.current.updateOptions(changes);
925
+ prevProps.current = props;
926
+ }, PROPERTY_KEYS_PANEVIEW.map((key) => props[key]));
927
+ React.useEffect(() => {
928
+ var _props$headerComponen;
929
+ if (!domRef.current) return () => {};
930
+ const headerComponents = (_props$headerComponen = props.headerComponents) !== null && _props$headerComponen !== void 0 ? _props$headerComponen : {};
931
+ const api = createPaneview(domRef.current, _objectSpread2(_objectSpread2({}, extractCoreOptions(props)), {
932
+ createComponent: (options) => {
933
+ return new PanePanelSection(options.id, props.components[options.name], { addPortal });
934
+ },
935
+ createHeaderComponent: (options) => {
936
+ return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
937
+ }
938
+ }));
939
+ const { clientWidth, clientHeight } = domRef.current;
940
+ api.layout(clientWidth, clientHeight);
941
+ if (props.onReady) props.onReady({ api });
942
+ paneviewRef.current = api;
943
+ return () => {
944
+ paneviewRef.current = void 0;
945
+ api.dispose();
946
+ };
947
+ }, []);
948
+ React.useEffect(() => {
949
+ if (!paneviewRef.current) return;
950
+ paneviewRef.current.updateOptions({ createComponent: (options) => {
951
+ return new PanePanelSection(options.id, props.components[options.name], { addPortal });
952
+ } });
953
+ }, [props.components]);
954
+ React.useEffect(() => {
955
+ var _props$headerComponen2;
956
+ if (!paneviewRef.current) return;
957
+ const headerComponents = (_props$headerComponen2 = props.headerComponents) !== null && _props$headerComponen2 !== void 0 ? _props$headerComponen2 : {};
958
+ paneviewRef.current.updateOptions({ createHeaderComponent: (options) => {
959
+ return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
960
+ } });
961
+ }, [props.headerComponents]);
962
+ React.useEffect(() => {
963
+ if (!paneviewRef.current) return () => {};
964
+ const disposable = paneviewRef.current.onDidDrop((event) => {
965
+ if (props.onDidDrop) props.onDidDrop(event);
966
+ });
967
+ return () => {
968
+ disposable.dispose();
969
+ };
970
+ }, [props.onDidDrop]);
971
+ return /* @__PURE__ */ React.createElement("div", {
972
+ style: {
973
+ height: "100%",
974
+ width: "100%"
975
+ },
976
+ ref: domRef
977
+ }, portals);
1030
978
  });
1031
- PaneviewReact.displayName = 'PaneviewComponent';
979
+ PaneviewReact.displayName = "PaneviewComponent";
1032
980
 
1033
- export { DockviewDefaultTab, DockviewReact, GridviewReact, PaneviewReact, ReactPart, ReactPartContext, SplitviewReact, isReactComponent, usePortalsLifecycle };
981
+ //#endregion
982
+ export { DockviewDefaultTab, DockviewReact, GridviewReact, PaneviewReact, ReactPart, ReactPartContext, SplitviewReact, isReactComponent, usePortalsLifecycle };