@floegence/floe-webapp-core 0.36.2 → 0.36.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,145 +1,144 @@
1
- import { insert as o, createComponent as g, template as u } from "solid-js/web";
2
- import { createMemo as r, For as m } from "solid-js";
3
- import { getWidgetEntry as c } from "./widgets/widgetRegistry.js";
4
- import { WorkbenchWidget as l } from "./WorkbenchWidget.js";
5
- var a = /* @__PURE__ */ u("<div class=workbench-canvas__field><div class=workbench-canvas__grid aria-hidden=true>");
6
- function w(t) {
7
- const e = r((n) => {
8
- const i = t.widgetById().get(t.widgetId);
9
- if (i) return i;
1
+ import { insert as u, createComponent as g, template as m } from "solid-js/web";
2
+ import { createMemo as i, For as c } from "solid-js";
3
+ import { createWorkbenchRenderLayerMap as a } from "./workbenchHelpers.js";
4
+ import { getWidgetEntry as l } from "./widgets/widgetRegistry.js";
5
+ import { WorkbenchWidget as w } from "./WorkbenchWidget.js";
6
+ var f = /* @__PURE__ */ m("<div class=workbench-canvas__field><div class=workbench-canvas__grid aria-hidden=true>");
7
+ function W(e) {
8
+ const t = i((r) => {
9
+ const n = e.widgetById().get(e.widgetId);
10
10
  if (n) return n;
11
- throw new Error(`Workbench widget ${t.widgetId} is missing from the render map.`);
12
- }), d = r(() => c(e().type, t.widgetDefinitions));
13
- return g(l, {
11
+ if (r) return r;
12
+ throw new Error(`Workbench widget ${e.widgetId} is missing from the render map.`);
13
+ }), d = i(() => l(t().type, e.widgetDefinitions));
14
+ return g(w, {
14
15
  get definition() {
15
16
  return d();
16
17
  },
17
18
  get widgetId() {
18
- return t.widgetId;
19
+ return e.widgetId;
19
20
  },
20
21
  get widgetTitle() {
21
- return e().title;
22
+ return t().title;
22
23
  },
23
24
  get widgetType() {
24
- return e().type;
25
+ return t().type;
25
26
  },
26
27
  get x() {
27
- return e().x;
28
+ return t().x;
28
29
  },
29
30
  get y() {
30
- return e().y;
31
+ return t().y;
31
32
  },
32
33
  get width() {
33
- return e().width;
34
+ return t().width;
34
35
  },
35
36
  get height() {
36
- return e().height;
37
+ return t().height;
37
38
  },
38
- get zIndex() {
39
- return e().z_index;
39
+ get renderLayer() {
40
+ return e.renderLayers().byWidgetId.get(e.widgetId) ?? 1;
40
41
  },
41
- itemSnapshot: e,
42
+ itemSnapshot: t,
42
43
  get selected() {
43
- return t.selectedWidgetId === t.widgetId;
44
+ return e.selectedWidgetId === e.widgetId;
44
45
  },
45
46
  get optimisticFront() {
46
- return t.optimisticFrontWidgetId === t.widgetId;
47
+ return e.optimisticFrontWidgetId === e.widgetId;
47
48
  },
48
- get topZIndex() {
49
- return t.topZIndex;
49
+ get topRenderLayer() {
50
+ return e.renderLayers().topRenderLayer;
50
51
  },
51
52
  get viewportScale() {
52
- return t.viewportScale;
53
+ return e.viewportScale;
53
54
  },
54
55
  get locked() {
55
- return t.locked;
56
+ return e.locked;
56
57
  },
57
58
  get filtered() {
58
- return !t.filters[e().type];
59
+ return !e.filters[t().type];
59
60
  },
60
61
  get onSelect() {
61
- return t.onSelectWidget;
62
+ return e.onSelectWidget;
62
63
  },
63
64
  get onContextMenu() {
64
- return t.onWidgetContextMenu;
65
+ return e.onWidgetContextMenu;
65
66
  },
66
67
  get onStartOptimisticFront() {
67
- return t.onStartOptimisticFront;
68
+ return e.onStartOptimisticFront;
68
69
  },
69
70
  get onCommitFront() {
70
- return t.onCommitFront;
71
+ return e.onCommitFront;
71
72
  },
72
73
  get onCommitMove() {
73
- return t.onCommitMove;
74
+ return e.onCommitMove;
74
75
  },
75
76
  get onCommitResize() {
76
- return t.onCommitResize;
77
+ return e.onCommitResize;
77
78
  },
78
79
  get onRequestDelete() {
79
- return t.onRequestDelete;
80
+ return e.onRequestDelete;
80
81
  }
81
82
  });
82
83
  }
83
- function W(t) {
84
- const e = r(() => t.widgets.map((n) => n.id)), d = r(() => new Map(t.widgets.map((n) => [n.id, n])));
84
+ function v(e) {
85
+ const t = i(() => e.widgets.map((n) => n.id)), d = i(() => new Map(e.widgets.map((n) => [n.id, n]))), r = i(() => a(e.widgets));
85
86
  return (() => {
86
- var n = a();
87
- return n.firstChild, o(n, g(m, {
87
+ var n = f();
88
+ return n.firstChild, u(n, g(c, {
88
89
  get each() {
89
- return e();
90
+ return t();
90
91
  },
91
- children: (i) => g(w, {
92
- widgetId: i,
92
+ children: (o) => g(W, {
93
+ widgetId: o,
93
94
  get widgetDefinitions() {
94
- return t.widgetDefinitions;
95
+ return e.widgetDefinitions;
95
96
  },
96
97
  get widgets() {
97
- return t.widgets;
98
+ return e.widgets;
98
99
  },
99
100
  widgetById: d,
101
+ renderLayers: r,
100
102
  get selectedWidgetId() {
101
- return t.selectedWidgetId;
103
+ return e.selectedWidgetId;
102
104
  },
103
105
  get optimisticFrontWidgetId() {
104
- return t.optimisticFrontWidgetId;
105
- },
106
- get topZIndex() {
107
- return t.topZIndex;
106
+ return e.optimisticFrontWidgetId;
108
107
  },
109
108
  get viewportScale() {
110
- return t.viewportScale;
109
+ return e.viewportScale;
111
110
  },
112
111
  get locked() {
113
- return t.locked;
112
+ return e.locked;
114
113
  },
115
114
  get filters() {
116
- return t.filters;
115
+ return e.filters;
117
116
  },
118
117
  get onSelectWidget() {
119
- return t.onSelectWidget;
118
+ return e.onSelectWidget;
120
119
  },
121
120
  get onWidgetContextMenu() {
122
- return t.onWidgetContextMenu;
121
+ return e.onWidgetContextMenu;
123
122
  },
124
123
  get onStartOptimisticFront() {
125
- return t.onStartOptimisticFront;
124
+ return e.onStartOptimisticFront;
126
125
  },
127
126
  get onCommitFront() {
128
- return t.onCommitFront;
127
+ return e.onCommitFront;
129
128
  },
130
129
  get onCommitMove() {
131
- return t.onCommitMove;
130
+ return e.onCommitMove;
132
131
  },
133
132
  get onCommitResize() {
134
- return t.onCommitResize;
133
+ return e.onCommitResize;
135
134
  },
136
135
  get onRequestDelete() {
137
- return t.onRequestDelete;
136
+ return e.onRequestDelete;
138
137
  }
139
138
  })
140
139
  }), null), n;
141
140
  })();
142
141
  }
143
142
  export {
144
- W as WorkbenchCanvasField
143
+ v as WorkbenchCanvasField
145
144
  };
@@ -2,14 +2,14 @@ import { insert as c, createComponent as a, Portal as k, addEventListener as s,
2
2
  import { createEffect as d, onCleanup as g, Show as W } from "solid-js";
3
3
  import { isTypingElement as A } from "../../utils/dom.js";
4
4
  import { WorkbenchCanvas as y } from "./WorkbenchCanvas.js";
5
- import { WorkbenchContextMenu as x } from "./WorkbenchContextMenu.js";
6
- import { WorkbenchFilterBar as D } from "./WorkbenchFilterBar.js";
5
+ import { WorkbenchContextMenu as D } from "./WorkbenchContextMenu.js";
6
+ import { WorkbenchFilterBar as x } from "./WorkbenchFilterBar.js";
7
7
  import { WorkbenchHud as M } from "./WorkbenchHud.js";
8
8
  import { WorkbenchLockButton as S } from "./WorkbenchLockButton.js";
9
9
  import { useWorkbenchModel as F } from "./useWorkbenchModel.js";
10
10
  var L = /* @__PURE__ */ m("<div class=workbench-menu-backdrop data-floe-workbench-boundary=true>"), R = /* @__PURE__ */ m("<div><div class=workbench-surface__body data-floe-workbench-canvas-frame=true>");
11
11
  const E = "F1";
12
- function K(i) {
12
+ function U(i) {
13
13
  const e = F({
14
14
  state: () => i.state(),
15
15
  setState: (t) => i.setState(t),
@@ -91,9 +91,6 @@ function K(i) {
91
91
  get optimisticFrontWidgetId() {
92
92
  return e.optimisticFrontWidgetId();
93
93
  },
94
- get topZIndex() {
95
- return e.topZIndex();
96
- },
97
94
  get locked() {
98
95
  return e.locked();
99
96
  },
@@ -140,7 +137,7 @@ function K(i) {
140
137
  get shortcutLabel() {
141
138
  return u() ?? void 0;
142
139
  }
143
- }), null), c(t, a(D, {
140
+ }), null), c(t, a(x, {
144
141
  get widgetDefinitions() {
145
142
  return e.widgetDefinitions();
146
143
  },
@@ -177,7 +174,7 @@ function K(i) {
177
174
  return [(() => {
178
175
  var n = L();
179
176
  return s(n, "contextmenu", e.contextMenu.retarget, !0), s(n, "click", e.contextMenu.close, !0), n;
180
- })(), a(x, {
177
+ })(), a(D, {
181
178
  get x() {
182
179
  return e.contextMenu.position()?.left ?? 0;
183
180
  },
@@ -196,5 +193,5 @@ function K(i) {
196
193
  }
197
194
  C(["click", "contextmenu"]);
198
195
  export {
199
- K as WorkbenchSurface
196
+ U as WorkbenchSurface
200
197
  };
@@ -9,11 +9,11 @@ export interface WorkbenchWidgetProps {
9
9
  y: number;
10
10
  width: number;
11
11
  height: number;
12
- zIndex: number;
12
+ renderLayer: number;
13
13
  itemSnapshot: () => WorkbenchWidgetItem;
14
14
  selected: boolean;
15
15
  optimisticFront: boolean;
16
- topZIndex: number;
16
+ topRenderLayer: number;
17
17
  viewportScale: number;
18
18
  locked: boolean;
19
19
  filtered: boolean;
@@ -1,178 +1,192 @@
1
- import { insert as u, createComponent as v, memo as E, effect as B, setAttribute as G, setStyleProperty as m, template as A, delegateEvents as N } from "solid-js/web";
2
- import { createSignal as R, onCleanup as O, untrack as I, createMemo as H } from "solid-js";
3
- import { startHotInteraction as P } from "../../utils/hotInteraction.js";
4
- import { GripVertical as q, X as V } from "../icons/index.js";
5
- var Z = /* @__PURE__ */ A('<article class=workbench-widget data-floe-dialog-surface-host=true><header class=workbench-widget__header><button type=button class=workbench-widget__drag aria-label="Drag widget"data-floe-canvas-interactive=true></button><div class=workbench-widget__title-area><span class=workbench-widget__title></span></div><button type=button class=workbench-widget__close aria-label="Remove widget"data-floe-canvas-interactive=true></button></header><div class=workbench-widget__body data-floe-canvas-interactive=true>'), j = /* @__PURE__ */ A('<div class=workbench-widget__resize aria-label="Resize widget"data-floe-canvas-interactive=true><svg class=workbench-widget__resize-glyph viewBox="0 0 12 12"aria-hidden=true><path d="M12 0 L0 12"></path><path d="M12 4 L4 12"></path><path d="M12 8 L8 12">');
6
- const J = 220, K = 160;
7
- function et(e) {
8
- const [b, x] = R(null), [f, C] = R(null);
9
- let h, w;
10
- O(() => {
11
- h?.abort(), h = void 0, w?.abort(), w = void 0, I(b)?.stopInteraction(), I(f)?.stopInteraction();
1
+ import { spread as G, insert as u, createComponent as I, memo as K, effect as V, setAttribute as q, setStyleProperty as m, template as P, use as U, delegateEvents as j } from "solid-js/web";
2
+ import { createSignal as H, onCleanup as J, untrack as _, createMemo as A } from "solid-js";
3
+ import { startHotInteraction as O } from "../../utils/hotInteraction.js";
4
+ import { GripVertical as Q, X as Z } from "../icons/index.js";
5
+ import { WORKBENCH_WIDGET_SHELL_ATTR as p, resolveWorkbenchWidgetEventOwnership as tt } from "../ui/localInteractionSurface.js";
6
+ var et = /* @__PURE__ */ P('<article class=workbench-widget data-floe-dialog-surface-host=true tabindex=0><header class=workbench-widget__header><button type=button class=workbench-widget__drag aria-label="Drag widget"data-floe-canvas-interactive=true></button><div class=workbench-widget__title-area><span class=workbench-widget__title></span></div><button type=button class=workbench-widget__close aria-label="Remove widget"data-floe-canvas-interactive=true></button></header><div class=workbench-widget__body data-floe-canvas-interactive=true>'), it = /* @__PURE__ */ P('<div class=workbench-widget__resize aria-label="Resize widget"data-floe-canvas-interactive=true><svg class=workbench-widget__resize-glyph viewBox="0 0 12 12"aria-hidden=true><path d="M12 0 L0 12"></path><path d="M12 4 L4 12"></path><path d="M12 8 L8 12">');
7
+ const nt = 220, ot = 160, at = '[data-floe-canvas-interactive="true"]', rt = '[data-floe-canvas-pan-surface="true"]';
8
+ function ht(i) {
9
+ const [f, C] = H(null), [v, x] = H(null);
10
+ let h, w, b;
11
+ J(() => {
12
+ h?.abort(), h = void 0, w?.abort(), w = void 0, _(f)?.stopInteraction(), _(v)?.stopInteraction();
12
13
  });
13
- const M = () => b() !== null, k = () => f() !== null, y = H(() => {
14
- const i = b();
15
- return i ? {
16
- x: i.worldX,
17
- y: i.worldY
14
+ const S = () => f() !== null, y = () => v() !== null, E = (e) => tt({
15
+ target: e,
16
+ widgetRoot: b ?? null,
17
+ interactiveSelector: at,
18
+ panSurfaceSelector: rt
19
+ }), N = (e) => {
20
+ e.button === 0 && (i.onSelect(i.widgetId), i.onCommitFront(i.widgetId), E(e.target) === "widget_shell" && b?.focus({
21
+ preventScroll: !0
22
+ }));
23
+ }, W = A(() => {
24
+ const e = f();
25
+ return e ? {
26
+ x: e.worldX,
27
+ y: e.worldY
18
28
  } : {
19
- x: e.x,
20
- y: e.y
29
+ x: i.x,
30
+ y: i.y
21
31
  };
22
- }), _ = H(() => {
23
- const i = f();
24
- return i ? {
25
- width: i.width,
26
- height: i.height
27
- } : {
32
+ }), M = A(() => {
33
+ const e = v();
34
+ return e ? {
28
35
  width: e.width,
29
36
  height: e.height
37
+ } : {
38
+ width: i.width,
39
+ height: i.height
30
40
  };
31
- }), $ = (i) => {
32
- const o = I(b);
33
- if (!o) return;
41
+ }), $ = (e) => {
42
+ const n = _(f);
43
+ if (!n) return;
34
44
  const a = {
35
- x: o.worldX,
36
- y: o.worldY
45
+ x: n.worldX,
46
+ y: n.worldY
37
47
  }, r = {
38
- x: o.startWorldX,
39
- y: o.startWorldY
40
- }, l = i && (Math.abs(a.x - r.x) > 1 || Math.abs(a.y - r.y) > 1);
41
- e.onCommitFront(e.widgetId), l && e.onCommitMove(e.widgetId, a), o.stopInteraction(), x(null), h?.abort(), h = void 0;
42
- }, F = (i) => {
43
- if (i.button !== 0 || e.locked) return;
44
- i.preventDefault(), i.stopPropagation(), h?.abort(), e.onStartOptimisticFront(e.widgetId);
45
- const o = P({
48
+ x: n.startWorldX,
49
+ y: n.startWorldY
50
+ }, s = e && (Math.abs(a.x - r.x) > 1 || Math.abs(a.y - r.y) > 1);
51
+ i.onCommitFront(i.widgetId), s && i.onCommitMove(i.widgetId, a), n.stopInteraction(), C(null), h?.abort(), h = void 0;
52
+ }, F = (e) => {
53
+ if (e.button !== 0 || i.locked) return;
54
+ e.preventDefault(), e.stopPropagation(), h?.abort(), i.onStartOptimisticFront(i.widgetId);
55
+ const n = O({
46
56
  kind: "drag",
47
57
  cursor: "grabbing"
48
- }), a = Math.max(e.viewportScale, 1e-3);
49
- x({
50
- pointerId: i.pointerId,
51
- startClientX: i.clientX,
52
- startClientY: i.clientY,
53
- startWorldX: e.x,
54
- startWorldY: e.y,
55
- worldX: e.x,
56
- worldY: e.y,
58
+ }), a = Math.max(i.viewportScale, 1e-3);
59
+ C({
60
+ pointerId: e.pointerId,
61
+ startClientX: e.clientX,
62
+ startClientY: e.clientY,
63
+ startWorldX: i.x,
64
+ startWorldY: i.y,
65
+ worldX: i.x,
66
+ worldY: i.y,
57
67
  moved: !1,
58
68
  scale: a,
59
- stopInteraction: o
69
+ stopInteraction: n
60
70
  });
61
- const r = (t) => {
62
- x((n) => {
63
- if (!n || n.pointerId !== t.pointerId) return n;
64
- const c = n.startWorldX + (t.clientX - n.startClientX) / n.scale, g = n.startWorldY + (t.clientY - n.startClientY) / n.scale;
71
+ const r = (o) => {
72
+ C((t) => {
73
+ if (!t || t.pointerId !== o.pointerId) return t;
74
+ const d = t.startWorldX + (o.clientX - t.startClientX) / t.scale, g = t.startWorldY + (o.clientY - t.startClientY) / t.scale;
65
75
  return {
66
- ...n,
67
- worldX: c,
76
+ ...t,
77
+ worldX: d,
68
78
  worldY: g,
69
- moved: n.moved || Math.abs(c - n.startWorldX) > 2 || Math.abs(g - n.startWorldY) > 2
79
+ moved: t.moved || Math.abs(d - t.startWorldX) > 2 || Math.abs(g - t.startWorldY) > 2
70
80
  };
71
81
  });
72
- }, l = (t) => {
73
- t.pointerId === i.pointerId && $(!0);
74
- }, s = (t) => {
75
- t.pointerId === i.pointerId && $(!1);
76
- }, d = new AbortController();
77
- h = d, window.addEventListener("pointermove", r, {
78
- signal: d.signal
79
- }), window.addEventListener("pointerup", l, {
82
+ }, s = (o) => {
83
+ o.pointerId === e.pointerId && $(!0);
84
+ }, c = (o) => {
85
+ o.pointerId === e.pointerId && $(!1);
86
+ }, l = new AbortController();
87
+ h = l, window.addEventListener("pointermove", r, {
88
+ signal: l.signal
89
+ }), window.addEventListener("pointerup", s, {
80
90
  once: !0,
81
- signal: d.signal
82
- }), window.addEventListener("pointercancel", s, {
91
+ signal: l.signal
92
+ }), window.addEventListener("pointercancel", c, {
83
93
  once: !0,
84
- signal: d.signal
94
+ signal: l.signal
85
95
  });
86
- }, S = (i) => {
87
- const o = I(f);
88
- if (!o) return;
96
+ }, k = (e) => {
97
+ const n = _(v);
98
+ if (!n) return;
89
99
  const a = {
90
- width: o.width,
91
- height: o.height
92
- }, r = Math.abs(o.width - o.startWidth) > 1 || Math.abs(o.height - o.startHeight) > 1;
93
- i && r && e.onCommitResize(e.widgetId, a), o.stopInteraction(), C(null), w?.abort(), w = void 0;
94
- }, T = (i) => {
95
- if (i.button !== 0 || e.locked) return;
96
- i.preventDefault(), i.stopPropagation(), w?.abort(), e.onStartOptimisticFront(e.widgetId);
97
- const o = P({
100
+ width: n.width,
101
+ height: n.height
102
+ }, r = Math.abs(n.width - n.startWidth) > 1 || Math.abs(n.height - n.startHeight) > 1;
103
+ e && r && i.onCommitResize(i.widgetId, a), n.stopInteraction(), x(null), w?.abort(), w = void 0;
104
+ }, B = (e) => {
105
+ if (e.button !== 0 || i.locked) return;
106
+ e.preventDefault(), e.stopPropagation(), w?.abort(), i.onStartOptimisticFront(i.widgetId);
107
+ const n = O({
98
108
  kind: "drag",
99
109
  cursor: "nwse-resize"
100
- }), a = Math.max(e.viewportScale, 1e-3);
101
- C({
102
- pointerId: i.pointerId,
103
- startClientX: i.clientX,
104
- startClientY: i.clientY,
105
- startWidth: e.width,
106
- startHeight: e.height,
107
- width: e.width,
108
- height: e.height,
110
+ }), a = Math.max(i.viewportScale, 1e-3);
111
+ x({
112
+ pointerId: e.pointerId,
113
+ startClientX: e.clientX,
114
+ startClientY: e.clientY,
115
+ startWidth: i.width,
116
+ startHeight: i.height,
117
+ width: i.width,
118
+ height: i.height,
109
119
  scale: a,
110
- stopInteraction: o
120
+ stopInteraction: n
111
121
  });
112
- const r = (t) => {
113
- C((n) => {
114
- if (!n || n.pointerId !== t.pointerId) return n;
115
- const c = Math.max(J, n.startWidth + (t.clientX - n.startClientX) / n.scale), g = Math.max(K, n.startHeight + (t.clientY - n.startClientY) / n.scale);
122
+ const r = (o) => {
123
+ x((t) => {
124
+ if (!t || t.pointerId !== o.pointerId) return t;
125
+ const d = Math.max(nt, t.startWidth + (o.clientX - t.startClientX) / t.scale), g = Math.max(ot, t.startHeight + (o.clientY - t.startClientY) / t.scale);
116
126
  return {
117
- ...n,
118
- width: c,
127
+ ...t,
128
+ width: d,
119
129
  height: g
120
130
  };
121
131
  });
122
- }, l = (t) => {
123
- t.pointerId === i.pointerId && S(!0);
124
- }, s = (t) => {
125
- t.pointerId === i.pointerId && S(!1);
126
- }, d = new AbortController();
127
- w = d, window.addEventListener("pointermove", r, {
128
- signal: d.signal
129
- }), window.addEventListener("pointerup", l, {
132
+ }, s = (o) => {
133
+ o.pointerId === e.pointerId && k(!0);
134
+ }, c = (o) => {
135
+ o.pointerId === e.pointerId && k(!1);
136
+ }, l = new AbortController();
137
+ w = l, window.addEventListener("pointermove", r, {
138
+ signal: l.signal
139
+ }), window.addEventListener("pointerup", s, {
130
140
  once: !0,
131
- signal: d.signal
132
- }), window.addEventListener("pointercancel", s, {
141
+ signal: l.signal
142
+ }), window.addEventListener("pointercancel", c, {
133
143
  once: !0,
134
- signal: d.signal
144
+ signal: l.signal
135
145
  });
136
146
  };
137
147
  return (() => {
138
- var i = Z(), o = i.firstChild, a = o.firstChild, r = a.nextSibling, l = r.firstChild, s = r.nextSibling, d = o.nextSibling;
139
- return i.$$click = () => {
140
- e.onSelect(e.widgetId), e.onCommitFront(e.widgetId);
141
- }, i.$$contextmenu = (t) => {
142
- t.preventDefault(), t.stopPropagation(), e.onContextMenu(t, e.itemSnapshot());
143
- }, a.$$pointerdown = F, u(a, v(q, {
148
+ var e = et(), n = e.firstChild, a = n.firstChild, r = a.nextSibling, s = r.firstChild, c = r.nextSibling, l = n.nextSibling;
149
+ e.$$contextmenu = (t) => {
150
+ E(t.target) === "widget_shell" && (t.preventDefault(), t.stopPropagation(), i.onContextMenu(t, i.itemSnapshot()));
151
+ }, e.addEventListener("focus", () => {
152
+ i.onSelect(i.widgetId);
153
+ }), e.$$pointerdown = N;
154
+ var o = b;
155
+ return typeof o == "function" ? U(o, e) : b = e, G(n, {
156
+ [p]: "true"
157
+ }, !1, !0), a.$$pointerdown = F, u(a, I(Q, {
144
158
  class: "w-3.5 h-3.5"
145
159
  })), u(r, () => {
146
- const t = e.definition.icon;
147
- return v(t, {
160
+ const t = i.definition.icon;
161
+ return I(t, {
148
162
  class: "w-3.5 h-3.5"
149
163
  });
150
- }, l), u(l, () => e.widgetTitle), s.$$click = (t) => {
151
- t.stopPropagation(), t.preventDefault(), e.onRequestDelete(e.widgetId);
152
- }, s.$$pointerdown = (t) => t.stopPropagation(), u(s, v(V, {
164
+ }, s), u(s, () => i.widgetTitle), c.$$click = (t) => {
165
+ t.stopPropagation(), t.preventDefault(), i.onRequestDelete(i.widgetId);
166
+ }, c.$$pointerdown = (t) => t.stopPropagation(), u(c, I(Z, {
153
167
  class: "w-3 h-3"
154
- })), u(d, () => {
155
- const t = e.definition.body;
156
- return v(t, {
168
+ })), u(l, () => {
169
+ const t = i.definition.body;
170
+ return I(t, {
157
171
  get widgetId() {
158
- return e.widgetId;
172
+ return i.widgetId;
159
173
  },
160
174
  get title() {
161
- return e.widgetTitle;
175
+ return i.widgetTitle;
162
176
  },
163
177
  get type() {
164
- return e.widgetType;
178
+ return i.widgetType;
165
179
  }
166
180
  });
167
- }), u(i, (() => {
168
- var t = E(() => !!e.locked);
181
+ }), u(e, (() => {
182
+ var t = K(() => !!i.locked);
169
183
  return () => t() ? null : (() => {
170
- var n = j();
171
- return n.$$pointerdown = T, n;
184
+ var d = it();
185
+ return d.$$pointerdown = B, d;
172
186
  })();
173
- })(), null), B((t) => {
174
- var n = !!e.selected, c = !!M(), g = !!k(), X = !!e.filtered, z = e.widgetId, Y = `translate(${y().x}px, ${y().y}px)`, W = `${_().width}px`, L = `${_().height}px`, D = M() || k() || e.optimisticFront ? `${e.topZIndex + 1}` : `${e.zIndex}`;
175
- return n !== t.e && i.classList.toggle("is-selected", t.e = n), c !== t.t && i.classList.toggle("is-dragging", t.t = c), g !== t.a && i.classList.toggle("is-resizing", t.a = g), X !== t.o && i.classList.toggle("is-filtered-out", t.o = X), z !== t.i && G(i, "data-floe-workbench-widget-id", t.i = z), Y !== t.n && m(i, "transform", t.n = Y), W !== t.s && m(i, "width", t.s = W), L !== t.h && m(i, "height", t.h = L), D !== t.r && m(i, "z-index", t.r = D), t;
187
+ })(), null), V((t) => {
188
+ var d = !!i.selected, g = !!S(), L = !!y(), R = !!i.filtered, X = i.widgetId, Y = `translate(${W().x}px, ${W().y}px)`, z = `${M().width}px`, D = `${M().height}px`, T = S() || y() || i.optimisticFront ? `${i.topRenderLayer + 1}` : `${i.renderLayer}`;
189
+ return d !== t.e && e.classList.toggle("is-selected", t.e = d), g !== t.t && e.classList.toggle("is-dragging", t.t = g), L !== t.a && e.classList.toggle("is-resizing", t.a = L), R !== t.o && e.classList.toggle("is-filtered-out", t.o = R), X !== t.i && q(e, "data-floe-workbench-widget-id", t.i = X), Y !== t.n && m(e, "transform", t.n = Y), z !== t.s && m(e, "width", t.s = z), D !== t.h && m(e, "height", t.h = D), T !== t.r && m(e, "z-index", t.r = T), t;
176
190
  }, {
177
191
  e: void 0,
178
192
  t: void 0,
@@ -183,10 +197,10 @@ function et(e) {
183
197
  s: void 0,
184
198
  h: void 0,
185
199
  r: void 0
186
- }), i;
200
+ }), e;
187
201
  })();
188
202
  }
189
- N(["contextmenu", "click", "pointerdown"]);
203
+ j(["pointerdown", "contextmenu", "click"]);
190
204
  export {
191
- et as WorkbenchWidget
205
+ ht as WorkbenchWidget
192
206
  };
@@ -4,4 +4,4 @@ export { WorkbenchContextMenu, type WorkbenchContextMenuItem, type WorkbenchCont
4
4
  export { useWorkbenchModel, type UseWorkbenchModelOptions } from './useWorkbenchModel';
5
5
  export { WIDGET_REGISTRY, createWorkbenchFilterState, getWidgetEntry, isValidWorkbenchWidgetType, resolveWorkbenchWidgetDefinitions, type WidgetRegistryEntry, } from './widgets/widgetRegistry';
6
6
  export * from './types';
7
- export { sanitizeWorkbenchState, createDefaultWorkbenchState, createWorkbenchId, } from './workbenchHelpers';
7
+ export { sanitizeWorkbenchState, createDefaultWorkbenchState, createWorkbenchId, createWorkbenchRenderLayerMap, type WorkbenchRenderLayerMap, } from './workbenchHelpers';
@@ -10,6 +10,11 @@ export declare function sanitizeWorkbenchState(input: unknown, options?: Sanitiz
10
10
  export declare function createDefaultWorkbenchState(widgetDefinitions?: readonly WorkbenchWidgetDefinition[]): WorkbenchState;
11
11
  export declare const WORKBENCH_CANVAS_ZOOM_STEP = 1.18;
12
12
  export declare const WORKBENCH_CONTEXT_MENU_WIDTH_PX = 200;
13
+ export interface WorkbenchRenderLayerMap {
14
+ byWidgetId: ReadonlyMap<string, number>;
15
+ topRenderLayer: number;
16
+ }
17
+ export declare function createWorkbenchRenderLayerMap(widgets: readonly WorkbenchWidgetItem[]): WorkbenchRenderLayerMap;
13
18
  export declare function createContextMenuPosition(options: {
14
19
  clientX: number;
15
20
  clientY: number;