@floegence/floe-webapp-core 0.36.18 → 0.36.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/components/ui/InfiniteCanvas.d.ts +17 -0
- package/dist/components/ui/InfiniteCanvas.js +38 -38
- package/dist/components/workbench/WorkbenchCanvas.d.ts +5 -1
- package/dist/components/workbench/WorkbenchCanvas.js +79 -40
- package/dist/components/workbench/WorkbenchCanvasField.d.ts +5 -1
- package/dist/components/workbench/WorkbenchCanvasField.js +82 -63
- package/dist/components/workbench/WorkbenchSurface.d.ts +13 -1
- package/dist/components/workbench/WorkbenchSurface.js +222 -130
- package/dist/components/workbench/WorkbenchWidget.d.ts +5 -1
- package/dist/components/workbench/WorkbenchWidget.js +141 -114
- package/dist/components/workbench/types.d.ts +64 -0
- package/dist/components/workbench/workbenchInteractionAdapter.d.ts +39 -0
- package/dist/components/workbench/workbenchInteractionAdapter.js +103 -0
- package/package.json +1 -1
|
@@ -1,51 +1,66 @@
|
|
|
1
|
-
import { spread as
|
|
2
|
-
import {
|
|
3
|
-
import { startHotInteraction as
|
|
4
|
-
import { X as
|
|
5
|
-
import { CANVAS_WHEEL_INTERACTIVE_ATTR as
|
|
6
|
-
import { startPointerSession as
|
|
7
|
-
import { createWorkbenchWidgetSurfaceMetrics as
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { spread as F, mergeProps as rt, insert as l, createComponent as c, memo as dt, template as B, use as lt, delegateEvents as ct } from "solid-js/web";
|
|
2
|
+
import { createMemo as u, createSignal as W, onCleanup as st, untrack as f } from "solid-js";
|
|
3
|
+
import { startHotInteraction as wt } from "../../utils/hotInteraction.js";
|
|
4
|
+
import { X as j, Minus as O, Maximize as q, GripVertical as gt } from "../icons/index.js";
|
|
5
|
+
import { CANVAS_WHEEL_INTERACTIVE_ATTR as ht, WORKBENCH_WIDGET_SHELL_ATTR as ut, shouldActivateWorkbenchWidgetLocalTarget as ft } from "../ui/localInteractionSurface.js";
|
|
6
|
+
import { startPointerSession as N } from "../ui/pointerSession.js";
|
|
7
|
+
import { createWorkbenchWidgetSurfaceMetrics as _t } from "./workbenchHelpers.js";
|
|
8
|
+
import { resolveWorkbenchInteractionAdapter as bt } from "./workbenchInteractionAdapter.js";
|
|
9
|
+
var mt = /* @__PURE__ */ B('<article class=workbench-widget><header class=workbench-widget__header><span class=workbench-widget__traffic role=group aria-label="Window controls"><button type=button class="workbench-widget__traffic-dot workbench-widget__traffic-dot--close"aria-label="Close widget"title="Close widget"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__traffic-dot workbench-widget__traffic-dot--min"aria-label="Minimize widget to overview"title="Minimize widget to overview"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__traffic-dot workbench-widget__traffic-dot--max"aria-label="Zoom widget to fit viewport"title="Zoom widget to fit viewport"data-floe-canvas-interactive=true></button></span><span class=workbench-widget__badge aria-hidden=true></span><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-dot aria-hidden=true></span><span class=workbench-widget__title></span></div><span class=workbench-widget__window-controls role=group aria-label="Window controls"><button type=button class="workbench-widget__window-control workbench-widget__window-control--min"aria-label="Minimize widget to overview"title="Minimize widget to overview"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__window-control workbench-widget__window-control--max"aria-label="Zoom widget to fit viewport"title="Zoom widget to fit viewport"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__window-control workbench-widget__window-control--close"aria-label="Remove widget"title="Remove widget"data-floe-canvas-interactive=true></button></span></header><div class=workbench-widget__body data-floe-canvas-interactive=true>'), vt = /* @__PURE__ */ B('<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">');
|
|
10
|
+
const $t = 220, St = 160;
|
|
11
|
+
function Rt(t) {
|
|
12
|
+
const s = u(() => bt(t.interactionAdapter)), [m, y] = W(null), [v, x] = W(null), [V, Z] = W();
|
|
13
|
+
let _, b, g;
|
|
14
|
+
const z = (e, i) => {
|
|
15
|
+
const r = wt({
|
|
16
|
+
kind: e,
|
|
17
|
+
cursor: i
|
|
18
|
+
});
|
|
19
|
+
let d = !1;
|
|
20
|
+
return f(() => t.onLayoutInteractionStart?.()), () => {
|
|
21
|
+
d || (d = !0, r(), f(() => t.onLayoutInteractionEnd?.()));
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
st(() => {
|
|
25
|
+
_?.stop({
|
|
15
26
|
reason: "manual_stop",
|
|
16
27
|
commit: !1
|
|
17
|
-
}),
|
|
28
|
+
}), _ = void 0, b?.stop({
|
|
18
29
|
reason: "manual_stop",
|
|
19
30
|
commit: !1
|
|
20
|
-
}),
|
|
31
|
+
}), b = void 0, f(m)?.stopInteraction(), f(v)?.stopInteraction();
|
|
21
32
|
});
|
|
22
|
-
const
|
|
33
|
+
const R = () => m() !== null, T = () => v() !== null, G = u(() => t.filtered ? "cold" : t.selected ? "hot" : "warm"), X = (e) => s().resolveWidgetEventOwnership({
|
|
23
34
|
target: e,
|
|
24
35
|
widgetRoot: g ?? null,
|
|
25
|
-
interactiveSelector:
|
|
26
|
-
panSurfaceSelector:
|
|
27
|
-
}), K = (
|
|
36
|
+
interactiveSelector: s().interactiveSelector,
|
|
37
|
+
panSurfaceSelector: s().panSurfaceSelector
|
|
38
|
+
}), K = () => {
|
|
39
|
+
t.onSelect(t.widgetId), t.onCommitFront(t.widgetId), g?.focus({
|
|
40
|
+
preventScroll: !0
|
|
41
|
+
});
|
|
42
|
+
}, J = (e) => {
|
|
28
43
|
if (e.button !== 0) return;
|
|
29
44
|
t.onSelect(t.widgetId), t.onCommitFront(t.widgetId);
|
|
30
|
-
const i =
|
|
45
|
+
const i = X(e.target);
|
|
31
46
|
if (i === "widget_shell") {
|
|
32
47
|
g?.focus({
|
|
33
48
|
preventScroll: !0
|
|
34
49
|
});
|
|
35
50
|
return;
|
|
36
51
|
}
|
|
37
|
-
i === "widget_local" &&
|
|
52
|
+
i === "widget_local" && ft({
|
|
38
53
|
target: e.target,
|
|
39
54
|
widgetRoot: g ?? null,
|
|
40
|
-
interactiveSelector:
|
|
41
|
-
panSurfaceSelector:
|
|
55
|
+
interactiveSelector: s().interactiveSelector,
|
|
56
|
+
panSurfaceSelector: s().panSurfaceSelector
|
|
42
57
|
}) && Z((r) => ({
|
|
43
58
|
seq: (r?.seq ?? 0) + 1,
|
|
44
59
|
source: "local_pointer",
|
|
45
60
|
pointerType: e.pointerType || void 0
|
|
46
61
|
}));
|
|
47
|
-
},
|
|
48
|
-
const e =
|
|
62
|
+
}, $ = u(() => {
|
|
63
|
+
const e = m();
|
|
49
64
|
return e ? {
|
|
50
65
|
x: e.worldX,
|
|
51
66
|
y: e.worldY
|
|
@@ -53,8 +68,8 @@ function Ct(t) {
|
|
|
53
68
|
x: t.x,
|
|
54
69
|
y: t.y
|
|
55
70
|
};
|
|
56
|
-
}),
|
|
57
|
-
const e =
|
|
71
|
+
}), S = u(() => {
|
|
72
|
+
const e = v();
|
|
58
73
|
return e ? {
|
|
59
74
|
width: e.width,
|
|
60
75
|
height: e.height
|
|
@@ -62,34 +77,34 @@ function Ct(t) {
|
|
|
62
77
|
width: t.width,
|
|
63
78
|
height: t.height
|
|
64
79
|
};
|
|
65
|
-
}),
|
|
80
|
+
}), Y = u(() => {
|
|
66
81
|
if (!(t.layoutMode !== "projected_surface" || !t.projectedViewport))
|
|
67
|
-
return
|
|
82
|
+
return _t({
|
|
68
83
|
widgetId: t.widgetId,
|
|
69
|
-
worldX:
|
|
70
|
-
worldY:
|
|
71
|
-
worldWidth:
|
|
72
|
-
worldHeight:
|
|
84
|
+
worldX: $().x,
|
|
85
|
+
worldY: $().y,
|
|
86
|
+
worldWidth: S().width,
|
|
87
|
+
worldHeight: S().height,
|
|
73
88
|
viewport: t.projectedViewport,
|
|
74
89
|
ready: t.surfaceReady ?? !0
|
|
75
90
|
});
|
|
76
|
-
}),
|
|
91
|
+
}), Q = u(() => {
|
|
77
92
|
const e = t.itemSnapshot().z_index, i = Number.isFinite(e) ? Math.max(1, Math.min(99, Math.round(e))) : 1;
|
|
78
93
|
return String(i).padStart(2, "0");
|
|
79
|
-
}),
|
|
94
|
+
}), D = (e) => {
|
|
80
95
|
e.preventDefault(), e.stopPropagation(), t.onRequestOverview(t.itemSnapshot());
|
|
81
|
-
},
|
|
96
|
+
}, P = (e) => {
|
|
82
97
|
e.preventDefault(), e.stopPropagation(), t.onRequestFit(t.itemSnapshot());
|
|
83
|
-
},
|
|
98
|
+
}, A = (e) => {
|
|
84
99
|
e.preventDefault(), e.stopPropagation(), t.onRequestDelete(t.widgetId);
|
|
85
|
-
},
|
|
100
|
+
}, U = u(() => {
|
|
86
101
|
const e = {
|
|
87
|
-
width: `${
|
|
88
|
-
height: `${
|
|
89
|
-
"z-index":
|
|
102
|
+
width: `${S().width}px`,
|
|
103
|
+
height: `${S().height}px`,
|
|
104
|
+
"z-index": R() || T() || t.optimisticFront ? `${t.topRenderLayer + 1}` : `${t.renderLayer}`
|
|
90
105
|
};
|
|
91
106
|
if (t.layoutMode === "projected_surface") {
|
|
92
|
-
const i =
|
|
107
|
+
const i = Y()?.rect;
|
|
93
108
|
return {
|
|
94
109
|
...e,
|
|
95
110
|
left: `${i?.screenX ?? 0}px`,
|
|
@@ -99,10 +114,10 @@ function Ct(t) {
|
|
|
99
114
|
}
|
|
100
115
|
return {
|
|
101
116
|
...e,
|
|
102
|
-
transform: `translate(${
|
|
117
|
+
transform: `translate(${$().x}px, ${$().y}px)`
|
|
103
118
|
};
|
|
104
|
-
}),
|
|
105
|
-
const i =
|
|
119
|
+
}), tt = (e) => {
|
|
120
|
+
const i = f(m);
|
|
106
121
|
if (!i) return;
|
|
107
122
|
const r = {
|
|
108
123
|
x: i.worldX,
|
|
@@ -111,20 +126,17 @@ function Ct(t) {
|
|
|
111
126
|
x: i.startWorldX,
|
|
112
127
|
y: i.startWorldY
|
|
113
128
|
}, a = e && (Math.abs(r.x - d.x) > 1 || Math.abs(r.y - d.y) > 1);
|
|
114
|
-
t.onCommitFront(t.widgetId), a && t.onCommitMove(t.widgetId, r), i.stopInteraction(),
|
|
115
|
-
},
|
|
129
|
+
t.onCommitFront(t.widgetId), a && t.onCommitMove(t.widgetId, r), i.stopInteraction(), y(null), _ = void 0;
|
|
130
|
+
}, E = (e) => {
|
|
116
131
|
if (e.button !== 0 || t.locked) return;
|
|
117
|
-
e.preventDefault(), e.stopPropagation(),
|
|
132
|
+
e.preventDefault(), e.stopPropagation(), _?.stop({
|
|
118
133
|
reason: "manual_stop",
|
|
119
134
|
commit: !1
|
|
120
135
|
}), t.onSelect(t.widgetId), g?.focus({
|
|
121
136
|
preventScroll: !0
|
|
122
137
|
}), t.onStartOptimisticFront(t.widgetId);
|
|
123
|
-
const i =
|
|
124
|
-
|
|
125
|
-
cursor: "grabbing"
|
|
126
|
-
}), r = Math.max(t.viewportScale, 1e-3);
|
|
127
|
-
I({
|
|
138
|
+
const i = z("drag", "grabbing"), r = Math.max(t.viewportScale, 1e-3);
|
|
139
|
+
y({
|
|
128
140
|
pointerId: e.pointerId,
|
|
129
141
|
startClientX: e.clientX,
|
|
130
142
|
startClientY: e.clientY,
|
|
@@ -137,43 +149,40 @@ function Ct(t) {
|
|
|
137
149
|
stopInteraction: i
|
|
138
150
|
});
|
|
139
151
|
const d = (a) => {
|
|
140
|
-
|
|
141
|
-
if (!
|
|
142
|
-
const
|
|
152
|
+
y((n) => {
|
|
153
|
+
if (!n || n.pointerId !== a.pointerId) return n;
|
|
154
|
+
const h = n.startWorldX + (a.clientX - n.startClientX) / n.scale, w = n.startWorldY + (a.clientY - n.startClientY) / n.scale;
|
|
143
155
|
return {
|
|
144
|
-
...
|
|
145
|
-
worldX:
|
|
146
|
-
worldY:
|
|
147
|
-
moved:
|
|
156
|
+
...n,
|
|
157
|
+
worldX: h,
|
|
158
|
+
worldY: w,
|
|
159
|
+
moved: n.moved || Math.abs(h - n.startWorldX) > 2 || Math.abs(w - n.startWorldY) > 2
|
|
148
160
|
};
|
|
149
161
|
});
|
|
150
162
|
};
|
|
151
|
-
|
|
163
|
+
_ = N({
|
|
152
164
|
pointerEvent: e,
|
|
153
165
|
captureEl: e.currentTarget,
|
|
154
166
|
onMove: d,
|
|
155
167
|
onEnd: ({
|
|
156
168
|
commit: a
|
|
157
|
-
}) =>
|
|
169
|
+
}) => tt(a)
|
|
158
170
|
});
|
|
159
|
-
},
|
|
160
|
-
const i =
|
|
171
|
+
}, et = (e) => {
|
|
172
|
+
const i = f(v);
|
|
161
173
|
if (!i) return;
|
|
162
174
|
const r = {
|
|
163
175
|
width: i.width,
|
|
164
176
|
height: i.height
|
|
165
177
|
}, d = Math.abs(i.width - i.startWidth) > 1 || Math.abs(i.height - i.startHeight) > 1;
|
|
166
|
-
e && d && t.onCommitResize(t.widgetId, r), i.stopInteraction(), x(null),
|
|
167
|
-
},
|
|
178
|
+
e && d && t.onCommitResize(t.widgetId, r), i.stopInteraction(), x(null), b = void 0;
|
|
179
|
+
}, it = (e) => {
|
|
168
180
|
if (e.button !== 0 || t.locked) return;
|
|
169
|
-
e.preventDefault(), e.stopPropagation(),
|
|
181
|
+
e.preventDefault(), e.stopPropagation(), b?.stop({
|
|
170
182
|
reason: "manual_stop",
|
|
171
183
|
commit: !1
|
|
172
184
|
}), t.onStartOptimisticFront(t.widgetId);
|
|
173
|
-
const i =
|
|
174
|
-
kind: "drag",
|
|
175
|
-
cursor: "nwse-resize"
|
|
176
|
-
}), r = Math.max(t.viewportScale, 1e-3);
|
|
185
|
+
const i = z("resize", "nwse-resize"), r = Math.max(t.viewportScale, 1e-3);
|
|
177
186
|
x({
|
|
178
187
|
pointerId: e.pointerId,
|
|
179
188
|
startClientX: e.clientX,
|
|
@@ -186,41 +195,49 @@ function Ct(t) {
|
|
|
186
195
|
stopInteraction: i
|
|
187
196
|
});
|
|
188
197
|
const d = (a) => {
|
|
189
|
-
x((
|
|
190
|
-
if (!
|
|
191
|
-
const
|
|
198
|
+
x((n) => {
|
|
199
|
+
if (!n || n.pointerId !== a.pointerId) return n;
|
|
200
|
+
const h = Math.max($t, n.startWidth + (a.clientX - n.startClientX) / n.scale), w = Math.max(St, n.startHeight + (a.clientY - n.startClientY) / n.scale);
|
|
192
201
|
return {
|
|
193
|
-
...
|
|
194
|
-
width:
|
|
195
|
-
height:
|
|
202
|
+
...n,
|
|
203
|
+
width: h,
|
|
204
|
+
height: w
|
|
196
205
|
};
|
|
197
206
|
});
|
|
198
207
|
};
|
|
199
|
-
|
|
208
|
+
b = N({
|
|
200
209
|
pointerEvent: e,
|
|
201
210
|
captureEl: e.currentTarget,
|
|
202
211
|
onMove: d,
|
|
203
212
|
onEnd: ({
|
|
204
213
|
commit: a
|
|
205
|
-
}) =>
|
|
214
|
+
}) => et(a)
|
|
206
215
|
});
|
|
207
216
|
};
|
|
208
217
|
return (() => {
|
|
209
|
-
var e =
|
|
210
|
-
return typeof
|
|
218
|
+
var e = mt(), i = e.firstChild, r = i.firstChild, d = r.firstChild, a = d.nextSibling, n = a.nextSibling, h = r.nextSibling, w = h.nextSibling, M = w.nextSibling, nt = M.firstChild, L = nt.nextSibling, ot = M.nextSibling, k = ot.firstChild, I = k.nextSibling, C = I.nextSibling, at = i.nextSibling, H = g;
|
|
219
|
+
return typeof H == "function" ? lt(H, e) : g = e, F(e, rt({
|
|
211
220
|
get classList() {
|
|
212
221
|
return {
|
|
213
222
|
"is-selected": t.selected,
|
|
214
|
-
"is-dragging":
|
|
215
|
-
"is-resizing":
|
|
223
|
+
"is-dragging": R(),
|
|
224
|
+
"is-resizing": T(),
|
|
216
225
|
"is-filtered-out": t.filtered,
|
|
217
226
|
"is-projected-surface": t.layoutMode === "projected_surface",
|
|
218
227
|
"is-locked": t.locked
|
|
219
228
|
};
|
|
220
|
-
}
|
|
229
|
+
}
|
|
230
|
+
}, () => ({
|
|
231
|
+
[s().dialogSurfaceHostAttr]: "true"
|
|
232
|
+
}), {
|
|
221
233
|
get "data-floe-workbench-widget-id"() {
|
|
222
234
|
return t.widgetId;
|
|
223
|
-
}
|
|
235
|
+
}
|
|
236
|
+
}, () => ({
|
|
237
|
+
[s().widgetRootAttr]: "true"
|
|
238
|
+
}), () => ({
|
|
239
|
+
[s().widgetIdAttr]: t.widgetId
|
|
240
|
+
}), {
|
|
224
241
|
get "data-workbench-widget-type"() {
|
|
225
242
|
return t.widgetType;
|
|
226
243
|
},
|
|
@@ -228,49 +245,49 @@ function Ct(t) {
|
|
|
228
245
|
return t.layoutMode ?? "canvas_scaled";
|
|
229
246
|
}
|
|
230
247
|
}, () => ({
|
|
231
|
-
[
|
|
248
|
+
[ht]: t.selected ? "true" : void 0
|
|
232
249
|
}), {
|
|
233
250
|
tabIndex: 0,
|
|
234
|
-
onPointerDown:
|
|
251
|
+
onPointerDown: J,
|
|
235
252
|
onFocus: () => {
|
|
236
253
|
t.onSelect(t.widgetId);
|
|
237
254
|
},
|
|
238
|
-
onContextMenu: (
|
|
239
|
-
|
|
255
|
+
onContextMenu: (o) => {
|
|
256
|
+
X(o.target) === "widget_shell" && (o.preventDefault(), o.stopPropagation(), t.onContextMenu(o, t.itemSnapshot()));
|
|
240
257
|
},
|
|
241
258
|
get style() {
|
|
242
|
-
return
|
|
259
|
+
return U();
|
|
243
260
|
}
|
|
244
|
-
}), !1, !0), i.$$pointerdown =
|
|
245
|
-
[
|
|
246
|
-
}, !1, !0), d.$$click =
|
|
261
|
+
}), !1, !0), i.$$pointerdown = E, F(i, {
|
|
262
|
+
[ut]: "true"
|
|
263
|
+
}, !1, !0), d.$$click = A, d.$$pointerdown = (o) => o.stopPropagation(), l(d, c(j, {
|
|
247
264
|
class: "workbench-widget__traffic-icon",
|
|
248
265
|
"aria-hidden": "true"
|
|
249
|
-
})), a.$$click =
|
|
266
|
+
})), a.$$click = D, a.$$pointerdown = (o) => o.stopPropagation(), l(a, c(O, {
|
|
250
267
|
class: "workbench-widget__traffic-icon",
|
|
251
268
|
"aria-hidden": "true"
|
|
252
|
-
})),
|
|
269
|
+
})), n.$$click = P, n.$$pointerdown = (o) => o.stopPropagation(), l(n, c(q, {
|
|
253
270
|
class: "workbench-widget__traffic-icon",
|
|
254
271
|
"aria-hidden": "true"
|
|
255
|
-
})), l(
|
|
272
|
+
})), l(h, Q), w.$$pointerdown = E, l(w, c(gt, {
|
|
256
273
|
class: "w-3.5 h-3.5"
|
|
257
|
-
})), l(
|
|
258
|
-
const
|
|
259
|
-
return c(
|
|
274
|
+
})), l(M, () => {
|
|
275
|
+
const o = t.definition.icon;
|
|
276
|
+
return c(o, {
|
|
260
277
|
class: "w-3.5 h-3.5"
|
|
261
278
|
});
|
|
262
|
-
},
|
|
279
|
+
}, L), l(L, () => t.widgetTitle), k.$$click = D, k.$$pointerdown = (o) => o.stopPropagation(), l(k, c(O, {
|
|
263
280
|
class: "workbench-widget__window-control-icon",
|
|
264
281
|
"aria-hidden": "true"
|
|
265
|
-
})),
|
|
282
|
+
})), I.$$click = P, I.$$pointerdown = (o) => o.stopPropagation(), l(I, c(q, {
|
|
266
283
|
class: "workbench-widget__window-control-icon",
|
|
267
284
|
"aria-hidden": "true"
|
|
268
|
-
})),
|
|
285
|
+
})), C.$$click = A, C.$$pointerdown = (o) => o.stopPropagation(), l(C, c(j, {
|
|
269
286
|
class: "workbench-widget__window-control-icon",
|
|
270
287
|
"aria-hidden": "true"
|
|
271
|
-
})), l(
|
|
272
|
-
const
|
|
273
|
-
return c(
|
|
288
|
+
})), l(at, () => {
|
|
289
|
+
const o = t.definition.body;
|
|
290
|
+
return c(o, {
|
|
274
291
|
get widgetId() {
|
|
275
292
|
return t.widgetId;
|
|
276
293
|
},
|
|
@@ -281,22 +298,32 @@ function Ct(t) {
|
|
|
281
298
|
return t.widgetType;
|
|
282
299
|
},
|
|
283
300
|
get surfaceMetrics() {
|
|
284
|
-
return
|
|
301
|
+
return Y();
|
|
285
302
|
},
|
|
286
303
|
get activation() {
|
|
304
|
+
return V();
|
|
305
|
+
},
|
|
306
|
+
get lifecycle() {
|
|
287
307
|
return G();
|
|
288
|
-
}
|
|
308
|
+
},
|
|
309
|
+
get selected() {
|
|
310
|
+
return t.selected;
|
|
311
|
+
},
|
|
312
|
+
get filtered() {
|
|
313
|
+
return t.filtered;
|
|
314
|
+
},
|
|
315
|
+
requestActivate: K
|
|
289
316
|
});
|
|
290
317
|
}), l(e, (() => {
|
|
291
|
-
var
|
|
292
|
-
return () =>
|
|
293
|
-
var
|
|
294
|
-
return
|
|
318
|
+
var o = dt(() => !!t.locked);
|
|
319
|
+
return () => o() ? null : (() => {
|
|
320
|
+
var p = vt();
|
|
321
|
+
return p.$$pointerdown = it, p;
|
|
295
322
|
})();
|
|
296
323
|
})(), null), e;
|
|
297
324
|
})();
|
|
298
325
|
}
|
|
299
|
-
|
|
326
|
+
ct(["pointerdown", "click"]);
|
|
300
327
|
export {
|
|
301
|
-
|
|
328
|
+
Rt as WorkbenchWidget
|
|
302
329
|
};
|
|
@@ -1,9 +1,68 @@
|
|
|
1
1
|
import type { Component } from 'solid-js';
|
|
2
2
|
import type { WorkbenchThemeId } from './workbenchThemes';
|
|
3
|
+
import type { SurfaceInteractionTargetRole, SurfaceWheelLocalReason, WorkbenchWidgetEventOwnership } from '../ui/localInteractionSurface';
|
|
3
4
|
export type BuiltinWorkbenchWidgetType = 'terminal' | 'file-browser' | 'system-monitor' | 'log-viewer' | 'code-editor';
|
|
4
5
|
export type WorkbenchWidgetType = BuiltinWorkbenchWidgetType | (string & {});
|
|
5
6
|
export declare const WORKBENCH_WIDGET_TYPES: readonly WorkbenchWidgetType[];
|
|
6
7
|
export type WorkbenchWidgetRenderMode = 'canvas_scaled' | 'projected_surface';
|
|
8
|
+
export type WorkbenchCanvasOwnerReason = 'initial' | 'background_pointer' | 'background_focus' | (string & {});
|
|
9
|
+
export type WorkbenchWidgetOwnerReason = 'pointer' | 'focus' | 'activation' | (string & {});
|
|
10
|
+
export type WorkbenchInputOwner = {
|
|
11
|
+
kind: 'canvas';
|
|
12
|
+
reason: WorkbenchCanvasOwnerReason;
|
|
13
|
+
} | {
|
|
14
|
+
kind: 'widget';
|
|
15
|
+
widgetId: string;
|
|
16
|
+
reason: WorkbenchWidgetOwnerReason;
|
|
17
|
+
};
|
|
18
|
+
export type WorkbenchWheelLocalReason = SurfaceWheelLocalReason | 'selected_widget' | (string & {});
|
|
19
|
+
export type WorkbenchWheelRoutingDecision = {
|
|
20
|
+
kind: 'canvas_zoom';
|
|
21
|
+
} | {
|
|
22
|
+
kind: 'local_surface';
|
|
23
|
+
reason: WorkbenchWheelLocalReason;
|
|
24
|
+
} | {
|
|
25
|
+
kind: 'ignore';
|
|
26
|
+
reason: 'pan_zoom_disabled' | (string & {});
|
|
27
|
+
};
|
|
28
|
+
export interface WorkbenchInteractionAdapter {
|
|
29
|
+
surfaceRootAttr?: string;
|
|
30
|
+
widgetRootAttr?: string;
|
|
31
|
+
widgetIdAttr?: string;
|
|
32
|
+
dialogSurfaceHostAttr?: string;
|
|
33
|
+
interactiveSelector?: string;
|
|
34
|
+
panSurfaceSelector?: string;
|
|
35
|
+
wheelInteractiveSelector?: string;
|
|
36
|
+
createInitialInputOwner?: () => WorkbenchInputOwner;
|
|
37
|
+
createCanvasInputOwner?: (reason: WorkbenchCanvasOwnerReason) => WorkbenchInputOwner;
|
|
38
|
+
createWidgetInputOwner?: (widgetId: string, reason: WorkbenchWidgetOwnerReason) => WorkbenchInputOwner;
|
|
39
|
+
findWidgetRoot?: (target: EventTarget | null) => HTMLElement | null;
|
|
40
|
+
readWidgetId?: (element: Element | null) => string | null;
|
|
41
|
+
focusWidgetElement?: (root: ParentNode | null | undefined, widgetId: string) => boolean;
|
|
42
|
+
resolveSurfaceTargetRole?: (args: {
|
|
43
|
+
target: EventTarget | null;
|
|
44
|
+
interactiveSelector: string;
|
|
45
|
+
panSurfaceSelector: string;
|
|
46
|
+
}) => SurfaceInteractionTargetRole;
|
|
47
|
+
resolveWidgetEventOwnership?: (args: {
|
|
48
|
+
target: EventTarget | null;
|
|
49
|
+
widgetRoot: Element | EventTarget | null;
|
|
50
|
+
interactiveSelector: string;
|
|
51
|
+
panSurfaceSelector: string;
|
|
52
|
+
}) => WorkbenchWidgetEventOwnership;
|
|
53
|
+
resolveWheelRouting?: (args: {
|
|
54
|
+
target: EventTarget | null;
|
|
55
|
+
disablePanZoom: boolean;
|
|
56
|
+
selectedWidgetId: string | null;
|
|
57
|
+
wheelInteractiveSelector: string;
|
|
58
|
+
}) => WorkbenchWheelRoutingDecision;
|
|
59
|
+
shouldBypassGlobalHotkeys?: (args: {
|
|
60
|
+
root: HTMLElement | null | undefined;
|
|
61
|
+
target: EventTarget | null;
|
|
62
|
+
owner: WorkbenchInputOwner;
|
|
63
|
+
interactiveSelector: string;
|
|
64
|
+
}) => boolean;
|
|
65
|
+
}
|
|
7
66
|
export interface WorkbenchProjectedRect {
|
|
8
67
|
widgetId: string;
|
|
9
68
|
worldX: number;
|
|
@@ -26,12 +85,17 @@ export interface WorkbenchWidgetBodyActivation {
|
|
|
26
85
|
source: WorkbenchWidgetBodyActivationSource;
|
|
27
86
|
pointerType?: string;
|
|
28
87
|
}
|
|
88
|
+
export type WorkbenchWidgetLifecycle = 'hot' | 'warm' | 'cold';
|
|
29
89
|
export interface WorkbenchWidgetBodyProps<TWidgetType extends string = WorkbenchWidgetType> {
|
|
30
90
|
widgetId: string;
|
|
31
91
|
title: string;
|
|
32
92
|
type: TWidgetType;
|
|
33
93
|
surfaceMetrics?: WorkbenchWidgetSurfaceMetrics;
|
|
34
94
|
activation?: WorkbenchWidgetBodyActivation;
|
|
95
|
+
lifecycle?: WorkbenchWidgetLifecycle;
|
|
96
|
+
selected?: boolean;
|
|
97
|
+
filtered?: boolean;
|
|
98
|
+
requestActivate?: () => void;
|
|
35
99
|
}
|
|
36
100
|
export interface WorkbenchWidgetDefinition<TWidgetType extends string = WorkbenchWidgetType> {
|
|
37
101
|
type: TWidgetType;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { WorkbenchCanvasOwnerReason, WorkbenchInputOwner, WorkbenchInteractionAdapter, WorkbenchWidgetOwnerReason } from './types';
|
|
2
|
+
export declare const DEFAULT_WORKBENCH_SURFACE_ROOT_ATTR = "data-floe-workbench-surface-root";
|
|
3
|
+
export declare const DEFAULT_WORKBENCH_WIDGET_ROOT_ATTR = "data-floe-workbench-widget-root";
|
|
4
|
+
export declare const DEFAULT_WORKBENCH_WIDGET_ID_ATTR = "data-floe-workbench-widget-id";
|
|
5
|
+
export declare const DEFAULT_WORKBENCH_DIALOG_SURFACE_HOST_ATTR = "data-floe-dialog-surface-host";
|
|
6
|
+
export interface ResolvedWorkbenchInteractionAdapter extends WorkbenchInteractionAdapter {
|
|
7
|
+
surfaceRootAttr: string;
|
|
8
|
+
widgetRootAttr: string;
|
|
9
|
+
widgetIdAttr: string;
|
|
10
|
+
dialogSurfaceHostAttr: string;
|
|
11
|
+
interactiveSelector: string;
|
|
12
|
+
panSurfaceSelector: string;
|
|
13
|
+
wheelInteractiveSelector: string;
|
|
14
|
+
createInitialInputOwner: () => WorkbenchInputOwner;
|
|
15
|
+
createCanvasInputOwner: (reason: WorkbenchCanvasOwnerReason) => WorkbenchInputOwner;
|
|
16
|
+
createWidgetInputOwner: (widgetId: string, reason: WorkbenchWidgetOwnerReason) => WorkbenchInputOwner;
|
|
17
|
+
findWidgetRoot: (target: EventTarget | null) => HTMLElement | null;
|
|
18
|
+
readWidgetId: (element: Element | null) => string | null;
|
|
19
|
+
focusWidgetElement: (root: ParentNode | null | undefined, widgetId: string) => boolean;
|
|
20
|
+
resolveSurfaceTargetRole: NonNullable<WorkbenchInteractionAdapter['resolveSurfaceTargetRole']>;
|
|
21
|
+
resolveWidgetEventOwnership: NonNullable<WorkbenchInteractionAdapter['resolveWidgetEventOwnership']>;
|
|
22
|
+
resolveWheelRouting: NonNullable<WorkbenchInteractionAdapter['resolveWheelRouting']>;
|
|
23
|
+
shouldBypassGlobalHotkeys: NonNullable<WorkbenchInteractionAdapter['shouldBypassGlobalHotkeys']>;
|
|
24
|
+
}
|
|
25
|
+
export declare function readWorkbenchWidgetId(element: Element | null, widgetIdAttr?: string): string | null;
|
|
26
|
+
export declare function findWorkbenchWidgetRoot(target: EventTarget | null, widgetRootAttr?: string): HTMLElement | null;
|
|
27
|
+
export declare function findWorkbenchWidgetElement(args: {
|
|
28
|
+
root: ParentNode | null | undefined;
|
|
29
|
+
widgetId: string;
|
|
30
|
+
widgetRootAttr?: string;
|
|
31
|
+
readWidgetId?: (element: Element | null) => string | null;
|
|
32
|
+
}): HTMLElement | null;
|
|
33
|
+
export declare function focusWorkbenchWidgetElement(args: {
|
|
34
|
+
root: ParentNode | null | undefined;
|
|
35
|
+
widgetId: string;
|
|
36
|
+
widgetRootAttr?: string;
|
|
37
|
+
readWidgetId?: (element: Element | null) => string | null;
|
|
38
|
+
}): boolean;
|
|
39
|
+
export declare function resolveWorkbenchInteractionAdapter(adapter?: WorkbenchInteractionAdapter): ResolvedWorkbenchInteractionAdapter;
|