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