@flowgram.ai/panel-manager-plugin 0.1.0-alpha.18 → 0.1.0-alpha.20

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.
package/dist/index.d.mts CHANGED
@@ -1,5 +1,7 @@
1
1
  import * as _flowgram_ai_core from '@flowgram.ai/core';
2
+ import { PluginContext } from '@flowgram.ai/core';
2
3
  import * as _flowgram_ai_utils from '@flowgram.ai/utils';
4
+ import React$1 from 'react';
3
5
 
4
6
  /**
5
7
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
@@ -12,20 +14,52 @@ interface PanelConfig {
12
14
  }
13
15
  interface PanelFactory<T extends any> {
14
16
  key: string;
17
+ defaultSize: number;
18
+ style?: React.CSSProperties;
15
19
  render: (props: T) => React.ReactNode;
16
20
  }
17
21
 
22
+ /**
23
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
24
+ * SPDX-License-Identifier: MIT
25
+ */
26
+ type PanelLayerProps = React.PropsWithChildren<{
27
+ className?: string;
28
+ style?: React.CSSProperties;
29
+ }>;
30
+
31
+ /**
32
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
33
+ * SPDX-License-Identifier: MIT
34
+ */
35
+
36
+ interface PanelManagerConfig {
37
+ factories: PanelFactory<any>[];
38
+ right: PanelConfig;
39
+ bottom: PanelConfig;
40
+ autoResize: boolean;
41
+ layerProps: PanelLayerProps;
42
+ getPopupContainer: (ctx: PluginContext) => HTMLElement;
43
+ }
44
+ declare const PanelManagerConfig: unique symbol;
45
+
18
46
  interface PanelElement {
19
47
  key: string;
48
+ style?: React.CSSProperties;
20
49
  el: React.ReactNode;
21
50
  }
22
51
  declare class FloatPanel {
23
52
  private config;
24
53
  elements: PanelElement[];
25
54
  private onUpdateEmitter;
55
+ sizeMap: Map<string, number>;
26
56
  onUpdate: _flowgram_ai_utils.Event<void>;
57
+ currentFactoryKey: string;
58
+ updateSize(newSize: number): void;
59
+ get currentSize(): number;
27
60
  constructor(config: PanelConfig);
28
61
  open(factory: PanelFactory<any>, options: any): void;
62
+ get visible(): boolean;
29
63
  close(key?: string): void;
30
64
  dispose(): void;
31
65
  }
@@ -36,37 +70,37 @@ declare class FloatPanel {
36
70
  */
37
71
 
38
72
  declare class PanelManager {
39
- private readonly config;
73
+ readonly config: PanelManagerConfig;
40
74
  readonly panelRegistry: Map<string, PanelFactory<any>>;
41
75
  right: FloatPanel;
42
76
  bottom: FloatPanel;
43
77
  init(): void;
44
78
  register<T extends any>(factory: PanelFactory<T>): void;
45
79
  open(key: string, area?: Area, options?: any): void;
46
- close(key: string, area?: Area): void;
80
+ close(key?: string): void;
47
81
  getPanel(area: Area): FloatPanel;
48
82
  dispose(): void;
49
83
  }
50
84
 
85
+ declare const createPanelManagerPlugin: _flowgram_ai_core.PluginCreator<Partial<PanelManagerConfig>>;
86
+
51
87
  /**
52
88
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
53
89
  * SPDX-License-Identifier: MIT
54
90
  */
55
91
 
56
- interface PanelManagerConfig {
57
- factories: PanelFactory<any>[];
58
- right: PanelConfig;
59
- bottom: PanelConfig;
60
- }
61
- declare const PanelManagerConfig: unique symbol;
62
-
63
- declare const createPanelManagerPlugin: _flowgram_ai_core.PluginCreator<Partial<PanelManagerConfig>>;
92
+ declare const usePanelManager: () => PanelManager;
64
93
 
65
94
  /**
66
95
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
67
96
  * SPDX-License-Identifier: MIT
68
97
  */
69
98
 
70
- declare const usePanelManager: () => PanelManager;
99
+ interface Props {
100
+ onResize: (w: number) => void;
101
+ size: number;
102
+ isVertical?: boolean;
103
+ }
104
+ declare const ResizeBar: React$1.FC<Props>;
71
105
 
72
- export { type Area, type PanelFactory, PanelManager, createPanelManagerPlugin, usePanelManager };
106
+ export { type Area, type PanelFactory, PanelManager, PanelManagerConfig, ResizeBar, createPanelManagerPlugin, usePanelManager };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import * as _flowgram_ai_core from '@flowgram.ai/core';
2
+ import { PluginContext } from '@flowgram.ai/core';
2
3
  import * as _flowgram_ai_utils from '@flowgram.ai/utils';
4
+ import React$1 from 'react';
3
5
 
4
6
  /**
5
7
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
@@ -12,20 +14,52 @@ interface PanelConfig {
12
14
  }
13
15
  interface PanelFactory<T extends any> {
14
16
  key: string;
17
+ defaultSize: number;
18
+ style?: React.CSSProperties;
15
19
  render: (props: T) => React.ReactNode;
16
20
  }
17
21
 
22
+ /**
23
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
24
+ * SPDX-License-Identifier: MIT
25
+ */
26
+ type PanelLayerProps = React.PropsWithChildren<{
27
+ className?: string;
28
+ style?: React.CSSProperties;
29
+ }>;
30
+
31
+ /**
32
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
33
+ * SPDX-License-Identifier: MIT
34
+ */
35
+
36
+ interface PanelManagerConfig {
37
+ factories: PanelFactory<any>[];
38
+ right: PanelConfig;
39
+ bottom: PanelConfig;
40
+ autoResize: boolean;
41
+ layerProps: PanelLayerProps;
42
+ getPopupContainer: (ctx: PluginContext) => HTMLElement;
43
+ }
44
+ declare const PanelManagerConfig: unique symbol;
45
+
18
46
  interface PanelElement {
19
47
  key: string;
48
+ style?: React.CSSProperties;
20
49
  el: React.ReactNode;
21
50
  }
22
51
  declare class FloatPanel {
23
52
  private config;
24
53
  elements: PanelElement[];
25
54
  private onUpdateEmitter;
55
+ sizeMap: Map<string, number>;
26
56
  onUpdate: _flowgram_ai_utils.Event<void>;
57
+ currentFactoryKey: string;
58
+ updateSize(newSize: number): void;
59
+ get currentSize(): number;
27
60
  constructor(config: PanelConfig);
28
61
  open(factory: PanelFactory<any>, options: any): void;
62
+ get visible(): boolean;
29
63
  close(key?: string): void;
30
64
  dispose(): void;
31
65
  }
@@ -36,37 +70,37 @@ declare class FloatPanel {
36
70
  */
37
71
 
38
72
  declare class PanelManager {
39
- private readonly config;
73
+ readonly config: PanelManagerConfig;
40
74
  readonly panelRegistry: Map<string, PanelFactory<any>>;
41
75
  right: FloatPanel;
42
76
  bottom: FloatPanel;
43
77
  init(): void;
44
78
  register<T extends any>(factory: PanelFactory<T>): void;
45
79
  open(key: string, area?: Area, options?: any): void;
46
- close(key: string, area?: Area): void;
80
+ close(key?: string): void;
47
81
  getPanel(area: Area): FloatPanel;
48
82
  dispose(): void;
49
83
  }
50
84
 
85
+ declare const createPanelManagerPlugin: _flowgram_ai_core.PluginCreator<Partial<PanelManagerConfig>>;
86
+
51
87
  /**
52
88
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
53
89
  * SPDX-License-Identifier: MIT
54
90
  */
55
91
 
56
- interface PanelManagerConfig {
57
- factories: PanelFactory<any>[];
58
- right: PanelConfig;
59
- bottom: PanelConfig;
60
- }
61
- declare const PanelManagerConfig: unique symbol;
62
-
63
- declare const createPanelManagerPlugin: _flowgram_ai_core.PluginCreator<Partial<PanelManagerConfig>>;
92
+ declare const usePanelManager: () => PanelManager;
64
93
 
65
94
  /**
66
95
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
67
96
  * SPDX-License-Identifier: MIT
68
97
  */
69
98
 
70
- declare const usePanelManager: () => PanelManager;
99
+ interface Props {
100
+ onResize: (w: number) => void;
101
+ size: number;
102
+ isVertical?: boolean;
103
+ }
104
+ declare const ResizeBar: React$1.FC<Props>;
71
105
 
72
- export { type Area, type PanelFactory, PanelManager, createPanelManagerPlugin, usePanelManager };
106
+ export { type Area, type PanelFactory, PanelManager, PanelManagerConfig, ResizeBar, createPanelManagerPlugin, usePanelManager };
package/dist/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
  var __decorateClass = (decorators, target, key, kind) => {
20
30
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
@@ -29,6 +39,7 @@ var __decorateClass = (decorators, target, key, kind) => {
29
39
  var index_exports = {};
30
40
  __export(index_exports, {
31
41
  PanelManager: () => PanelManager,
42
+ ResizeBar: () => ResizeBar,
32
43
  createPanelManagerPlugin: () => createPanelManagerPlugin,
33
44
  usePanelManager: () => usePanelManager
34
45
  });
@@ -47,7 +58,10 @@ var defineConfig = (config) => {
47
58
  bottom: {
48
59
  max: 1
49
60
  },
50
- factories: []
61
+ factories: [],
62
+ autoResize: true,
63
+ layerProps: {},
64
+ getPopupContainer: (ctx) => ctx.playground.node.parentNode
51
65
  };
52
66
  return {
53
67
  ...defaultConfig,
@@ -60,26 +74,43 @@ var import_inversify = require("inversify");
60
74
 
61
75
  // src/services/float-panel.ts
62
76
  var import_utils = require("@flowgram.ai/utils");
77
+ var PANEL_SIZE_DEFAULT = 400;
63
78
  var FloatPanel = class {
64
79
  constructor(config) {
65
80
  this.config = config;
66
81
  this.elements = [];
67
82
  this.onUpdateEmitter = new import_utils.Emitter();
83
+ this.sizeMap = /* @__PURE__ */ new Map();
68
84
  this.onUpdate = this.onUpdateEmitter.event;
85
+ this.currentFactoryKey = "";
86
+ }
87
+ updateSize(newSize) {
88
+ this.sizeMap.set(this.currentFactoryKey, newSize);
89
+ this.onUpdateEmitter.fire();
90
+ }
91
+ get currentSize() {
92
+ return this.sizeMap.get(this.currentFactoryKey) || PANEL_SIZE_DEFAULT;
69
93
  }
70
94
  open(factory, options) {
71
95
  const el = factory.render(options?.props);
72
96
  const idx = this.elements.findIndex((e) => e.key === factory.key);
97
+ this.currentFactoryKey = factory.key;
98
+ if (!this.sizeMap.has(factory.key)) {
99
+ this.sizeMap.set(factory.key, factory.defaultSize || PANEL_SIZE_DEFAULT);
100
+ }
73
101
  if (idx >= 0) {
74
- this.elements[idx] = { el, key: factory.key };
102
+ this.elements[idx] = { el, key: factory.key, style: factory.style };
75
103
  } else {
76
- this.elements.push({ el, key: factory.key });
104
+ this.elements.push({ el, key: factory.key, style: factory.style });
77
105
  if (this.elements.length > this.config.max) {
78
106
  this.elements.shift();
79
107
  }
80
108
  }
81
109
  this.onUpdateEmitter.fire();
82
110
  }
111
+ get visible() {
112
+ return this.elements.length > 0;
113
+ }
83
114
  close(key) {
84
115
  if (!key) {
85
116
  this.elements = [];
@@ -115,9 +146,9 @@ var PanelManager = class {
115
146
  const panel = this.getPanel(area);
116
147
  panel.open(factory, options);
117
148
  }
118
- close(key, area = "right") {
119
- const panel = this.getPanel(area);
120
- panel.close(key);
149
+ close(key) {
150
+ this.right.close(key);
151
+ this.bottom.close(key);
121
152
  }
122
153
  getPanel(area) {
123
154
  return area === "right" ? this.right : this.bottom;
@@ -135,31 +166,57 @@ PanelManager = __decorateClass([
135
166
  ], PanelManager);
136
167
 
137
168
  // src/services/panel-layer.ts
138
- var import_react2 = require("react");
169
+ var import_react_dom = __toESM(require("react-dom"));
170
+ var import_react4 = require("react");
139
171
  var import_inversify2 = require("inversify");
140
172
  var import_utils2 = require("@flowgram.ai/utils");
141
173
  var import_core2 = require("@flowgram.ai/core");
142
174
 
143
- // src/components/panel-layer/float-panel.tsx
175
+ // src/components/panel-layer/panel-layer.tsx
176
+ var import_clsx = __toESM(require("clsx"));
177
+
178
+ // src/hooks/use-global-css.ts
144
179
  var import_react = require("react");
180
+ var useGlobalCSS = ({ cssText, id, cleanup }) => {
181
+ (0, import_react.useEffect)(() => {
182
+ if (typeof document === "undefined") return;
183
+ if (document.getElementById(id)) return;
184
+ const style = document.createElement("style");
185
+ style.id = id;
186
+ style.textContent = cssText;
187
+ document.head.appendChild(style);
188
+ return () => {
189
+ const existing = document.getElementById(id);
190
+ if (existing && cleanup) existing.remove();
191
+ };
192
+ }, [id]);
193
+ };
194
+
195
+ // src/components/panel-layer/float-panel.tsx
196
+ var import_react3 = require("react");
145
197
 
146
198
  // src/hooks/use-panel-manager.ts
147
199
  var import_core = require("@flowgram.ai/core");
148
200
  var usePanelManager = () => (0, import_core.useService)(PanelManager);
149
201
 
150
202
  // src/components/panel-layer/css.ts
151
- var panelLayer = {
152
- pointerEvents: "none",
153
- position: "absolute",
154
- top: 0,
155
- left: 0,
156
- display: "flex",
157
- columnGap: "4px",
158
- width: "100%",
159
- height: "100%",
160
- padding: "4px",
161
- boxSizing: "border-box"
162
- };
203
+ var globalCSS = `
204
+ .gedit-flow-panel-layer * {
205
+ box-sizing: border-box;
206
+ }
207
+ .gedit-flow-panel-layer-wrap {
208
+ pointer-events: none;
209
+ position: absolute;
210
+ top: 0;
211
+ left: 0;
212
+ display: flex;
213
+ column-gap: 4px;
214
+ width: 100%;
215
+ height: 100%;
216
+ padding: 4px;
217
+ overflow: hidden;
218
+ }
219
+ `;
163
220
  var leftArea = {
164
221
  width: "100%",
165
222
  minWidth: 0,
@@ -194,93 +251,184 @@ var bottomArea = {
194
251
  var floatPanelWrap = {
195
252
  pointerEvents: "auto",
196
253
  height: "100%",
197
- width: "100%"
254
+ width: "100%",
255
+ overflow: "auto"
198
256
  };
199
257
 
200
- // src/components/panel-layer/float-panel.tsx
258
+ // src/components/resize-bar/index.tsx
259
+ var import_react2 = require("react");
201
260
  var import_jsx_runtime = require("react/jsx-runtime");
202
- var FloatPanel2 = ({ area }) => {
203
- const [, setVersion] = (0, import_react.useState)(0);
204
- const panelManager = usePanelManager();
205
- const panel = (0, import_react.useRef)(panelManager.getPanel(area));
206
- const render = () => panel.current.elements.map((i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
261
+ var ResizeBar = ({ onResize, size, isVertical }) => {
262
+ const currentPoint = (0, import_react2.useRef)(null);
263
+ const [isDragging, setIsDragging] = (0, import_react2.useState)(false);
264
+ const [isHovered, setIsHovered] = (0, import_react2.useState)(false);
265
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
207
266
  "div",
208
267
  {
209
- className: "float-panel-wrap",
210
- style: floatPanelWrap,
211
- onMouseDown: (e) => e.stopPropagation(),
212
- children: i.el
213
- },
214
- i.key
215
- ));
216
- const node = (0, import_react.useRef)(render());
217
- (0, import_react.useEffect)(() => {
268
+ onMouseDown: (e) => {
269
+ currentPoint.current = isVertical ? e.clientX : e.clientY;
270
+ e.stopPropagation();
271
+ e.preventDefault();
272
+ setIsDragging(true);
273
+ const mouseUp = () => {
274
+ currentPoint.current = null;
275
+ document.body.removeEventListener("mouseup", mouseUp);
276
+ document.body.removeEventListener("mousemove", mouseMove);
277
+ setIsDragging(false);
278
+ };
279
+ const mouseMove = (e2) => {
280
+ const delta = currentPoint.current - (isVertical ? e2.clientX : e2.clientY);
281
+ onResize(size + delta);
282
+ };
283
+ document.body.addEventListener("mouseup", mouseUp);
284
+ document.body.addEventListener("mousemove", mouseMove);
285
+ },
286
+ onMouseEnter: () => setIsHovered(true),
287
+ onMouseLeave: () => setIsHovered(false),
288
+ style: {
289
+ position: "absolute",
290
+ top: 0,
291
+ left: 0,
292
+ zIndex: 999,
293
+ display: "flex",
294
+ alignItems: "center",
295
+ justifyContent: "center",
296
+ pointerEvents: "auto",
297
+ ...isVertical ? {
298
+ cursor: "ew-resize",
299
+ height: "100%",
300
+ marginLeft: -5,
301
+ width: 10
302
+ } : {
303
+ cursor: "ns-resize",
304
+ width: "100%",
305
+ marginTop: -5,
306
+ height: 10
307
+ }
308
+ },
309
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
310
+ "div",
311
+ {
312
+ style: {
313
+ ...isVertical ? {
314
+ width: 3,
315
+ height: "100%"
316
+ } : {
317
+ height: 3,
318
+ width: "100%"
319
+ },
320
+ backgroundColor: isDragging || isHovered ? "var(--g-playground-line)" : "transparent"
321
+ }
322
+ }
323
+ )
324
+ }
325
+ );
326
+ };
327
+
328
+ // src/components/panel-layer/float-panel.tsx
329
+ var import_jsx_runtime2 = require("react/jsx-runtime");
330
+ var FloatPanel2 = ({ area }) => {
331
+ const [, setVersion] = (0, import_react3.useState)(0);
332
+ const panelManager = usePanelManager();
333
+ const panel = (0, import_react3.useRef)(panelManager.getPanel(area));
334
+ const render = () => panel.current.elements.map((i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "float-panel-wrap", style: { ...floatPanelWrap, ...i.style }, children: i.el }, i.key));
335
+ const node = (0, import_react3.useRef)(render());
336
+ (0, import_react3.useEffect)(() => {
218
337
  const dispose = panel.current.onUpdate(() => {
219
- (0, import_react.startTransition)(() => {
338
+ (0, import_react3.startTransition)(() => {
220
339
  node.current = render();
221
340
  setVersion((v) => v + 1);
222
341
  });
223
342
  });
224
343
  return () => dispose.dispose();
225
344
  }, [panel]);
226
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: node.current });
345
+ const onResize = (0, import_react3.useCallback)((newSize) => panel.current.updateSize(newSize), []);
346
+ const size = panel.current.currentSize;
347
+ const sizeStyle = area === "right" ? { width: size, height: "100%" } : { height: size, width: "100%" };
348
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
349
+ "div",
350
+ {
351
+ className: "gedit-flow-panel",
352
+ style: {
353
+ position: "relative",
354
+ display: panel.current.visible ? "block" : "none",
355
+ ...sizeStyle
356
+ },
357
+ children: [
358
+ panelManager.config.autoResize && panel.current.elements.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ResizeBar, { size, isVertical: area === "right", onResize }),
359
+ node.current
360
+ ]
361
+ }
362
+ );
227
363
  };
228
364
 
229
365
  // src/components/panel-layer/panel-layer.tsx
230
- var import_jsx_runtime2 = require("react/jsx-runtime");
231
- var PanelLayer = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "panel-layer", style: panelLayer, children: [
232
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "left-area", style: leftArea, children: [
233
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "main-area", style: mainArea, children }),
234
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "bottom-area", style: bottomArea, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FloatPanel2, { area: "bottom" }) })
235
- ] }),
236
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "right-area", style: rightArea, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FloatPanel2, { area: "right" }) })
237
- ] });
366
+ var import_jsx_runtime3 = require("react/jsx-runtime");
367
+ var PanelLayer = ({ className, style, children }) => {
368
+ useGlobalCSS({
369
+ cssText: globalCSS,
370
+ id: "flow-panel-layer-css"
371
+ });
372
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: (0, import_clsx.default)("gedit-flow-panel-layer-wrap", className), style, children: [
373
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "gedit-flow-panel-left-area", style: leftArea, children: [
374
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "gedit-flow-panel-main-area", style: mainArea, children }),
375
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "gedit-flow-panel-bottom-area", style: bottomArea, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FloatPanel2, { area: "bottom" }) })
376
+ ] }),
377
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "gedit-flow-panel-right-area", style: rightArea, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FloatPanel2, { area: "right" }) })
378
+ ] });
379
+ };
238
380
 
239
381
  // src/services/panel-layer.ts
240
382
  var PanelLayer2 = class extends import_core2.Layer {
241
383
  constructor() {
242
384
  super(...arguments);
243
- this.node = import_utils2.domUtils.createDivWithClass("gedit-flow-panel-layer");
385
+ this.panelRoot = import_utils2.domUtils.createDivWithClass("gedit-flow-panel-layer");
244
386
  this.layout = null;
245
387
  }
246
388
  onReady() {
389
+ this.panelConfig.getPopupContainer(this.pluginContext).appendChild(this.panelRoot);
390
+ this.toDispose.push(
391
+ import_utils2.Disposable.create(() => {
392
+ this.panelRoot.remove();
393
+ })
394
+ );
247
395
  const commonStyle = {
248
396
  pointerEvents: "none",
249
- zIndex: 11
397
+ width: "100%",
398
+ height: "100%",
399
+ position: "absolute",
400
+ left: 0,
401
+ top: 0,
402
+ zIndex: 100
250
403
  };
251
- import_utils2.domUtils.setStyle(this.node, commonStyle);
252
- this.config.onDataChange(() => {
253
- const { width, height, scrollX, scrollY } = this.config.config;
254
- import_utils2.domUtils.setStyle(this.node, {
255
- ...commonStyle,
256
- width,
257
- height,
258
- left: scrollX,
259
- top: scrollY
260
- });
261
- });
404
+ import_utils2.domUtils.setStyle(this.panelRoot, commonStyle);
262
405
  }
263
406
  render() {
264
407
  if (!this.layout) {
265
- this.layout = (0, import_react2.createElement)(PanelLayer);
408
+ const { children, ...layoutProps } = this.panelConfig.layerProps;
409
+ this.layout = (0, import_react4.createElement)(PanelLayer, layoutProps, children);
266
410
  }
267
- return this.layout;
411
+ return import_react_dom.default.createPortal(this.layout, this.panelRoot);
268
412
  }
269
413
  };
414
+ __decorateClass([
415
+ (0, import_inversify2.inject)(PanelManagerConfig)
416
+ ], PanelLayer2.prototype, "panelConfig", 2);
417
+ __decorateClass([
418
+ (0, import_inversify2.inject)(import_core2.PluginContext)
419
+ ], PanelLayer2.prototype, "pluginContext", 2);
270
420
  PanelLayer2 = __decorateClass([
271
421
  (0, import_inversify2.injectable)()
272
422
  ], PanelLayer2);
273
423
 
274
424
  // src/create-panel-manager-plugin.ts
275
425
  var createPanelManagerPlugin = (0, import_core3.definePluginCreator)({
276
- onBind: ({ bind }) => {
426
+ onBind: ({ bind }, opt) => {
277
427
  bind(PanelManager).to(PanelManager).inSingletonScope();
278
- bind(PanelManagerConfig).toConstantValue(defineConfig({}));
428
+ bind(PanelManagerConfig).toConstantValue(defineConfig(opt));
279
429
  },
280
- onInit(ctx, opt) {
430
+ onInit(ctx) {
281
431
  ctx.playground.registerLayer(PanelLayer2);
282
- const config = defineConfig(opt);
283
- ctx.container.rebind(PanelManagerConfig).toConstantValue(config);
284
432
  const panelManager = ctx.container.get(PanelManager);
285
433
  panelManager.init();
286
434
  }
@@ -288,6 +436,7 @@ var createPanelManagerPlugin = (0, import_core3.definePluginCreator)({
288
436
  // Annotate the CommonJS export names for ESM import in node:
289
437
  0 && (module.exports = {
290
438
  PanelManager,
439
+ ResizeBar,
291
440
  createPanelManagerPlugin,
292
441
  usePanelManager
293
442
  });