@floegence/floe-webapp-core 0.36.19 → 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.
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { spread as F, mergeProps as
|
|
2
|
-
import { createMemo as u, createSignal as W, onCleanup as
|
|
3
|
-
import { startHotInteraction as
|
|
4
|
-
import { X as j, Minus as O, Maximize as
|
|
5
|
-
import { CANVAS_WHEEL_INTERACTIVE_ATTR as
|
|
6
|
-
import { startPointerSession as
|
|
7
|
-
import { createWorkbenchWidgetSurfaceMetrics as
|
|
8
|
-
import { resolveWorkbenchInteractionAdapter as
|
|
9
|
-
var
|
|
10
|
-
const
|
|
11
|
-
function
|
|
12
|
-
const s = u(() =>
|
|
13
|
-
let _, b,
|
|
14
|
-
const
|
|
15
|
-
const r =
|
|
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
16
|
kind: e,
|
|
17
17
|
cursor: i
|
|
18
18
|
});
|
|
@@ -21,7 +21,7 @@ function Wt(t) {
|
|
|
21
21
|
d || (d = !0, r(), f(() => t.onLayoutInteractionEnd?.()));
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
|
-
|
|
24
|
+
st(() => {
|
|
25
25
|
_?.stop({
|
|
26
26
|
reason: "manual_stop",
|
|
27
27
|
commit: !1
|
|
@@ -30,24 +30,28 @@ function Wt(t) {
|
|
|
30
30
|
commit: !1
|
|
31
31
|
}), b = void 0, f(m)?.stopInteraction(), f(v)?.stopInteraction();
|
|
32
32
|
});
|
|
33
|
-
const
|
|
33
|
+
const R = () => m() !== null, T = () => v() !== null, G = u(() => t.filtered ? "cold" : t.selected ? "hot" : "warm"), X = (e) => s().resolveWidgetEventOwnership({
|
|
34
34
|
target: e,
|
|
35
|
-
widgetRoot:
|
|
35
|
+
widgetRoot: g ?? null,
|
|
36
36
|
interactiveSelector: s().interactiveSelector,
|
|
37
37
|
panSurfaceSelector: s().panSurfaceSelector
|
|
38
|
-
}),
|
|
38
|
+
}), K = () => {
|
|
39
|
+
t.onSelect(t.widgetId), t.onCommitFront(t.widgetId), g?.focus({
|
|
40
|
+
preventScroll: !0
|
|
41
|
+
});
|
|
42
|
+
}, J = (e) => {
|
|
39
43
|
if (e.button !== 0) return;
|
|
40
44
|
t.onSelect(t.widgetId), t.onCommitFront(t.widgetId);
|
|
41
|
-
const i =
|
|
45
|
+
const i = X(e.target);
|
|
42
46
|
if (i === "widget_shell") {
|
|
43
|
-
|
|
47
|
+
g?.focus({
|
|
44
48
|
preventScroll: !0
|
|
45
49
|
});
|
|
46
50
|
return;
|
|
47
51
|
}
|
|
48
|
-
i === "widget_local" &&
|
|
52
|
+
i === "widget_local" && ft({
|
|
49
53
|
target: e.target,
|
|
50
|
-
widgetRoot:
|
|
54
|
+
widgetRoot: g ?? null,
|
|
51
55
|
interactiveSelector: s().interactiveSelector,
|
|
52
56
|
panSurfaceSelector: s().panSurfaceSelector
|
|
53
57
|
}) && Z((r) => ({
|
|
@@ -73,9 +77,9 @@ function Wt(t) {
|
|
|
73
77
|
width: t.width,
|
|
74
78
|
height: t.height
|
|
75
79
|
};
|
|
76
|
-
}),
|
|
80
|
+
}), Y = u(() => {
|
|
77
81
|
if (!(t.layoutMode !== "projected_surface" || !t.projectedViewport))
|
|
78
|
-
return
|
|
82
|
+
return _t({
|
|
79
83
|
widgetId: t.widgetId,
|
|
80
84
|
worldX: $().x,
|
|
81
85
|
worldY: $().y,
|
|
@@ -84,23 +88,23 @@ function Wt(t) {
|
|
|
84
88
|
viewport: t.projectedViewport,
|
|
85
89
|
ready: t.surfaceReady ?? !0
|
|
86
90
|
});
|
|
87
|
-
}),
|
|
91
|
+
}), Q = u(() => {
|
|
88
92
|
const e = t.itemSnapshot().z_index, i = Number.isFinite(e) ? Math.max(1, Math.min(99, Math.round(e))) : 1;
|
|
89
93
|
return String(i).padStart(2, "0");
|
|
90
|
-
}),
|
|
94
|
+
}), D = (e) => {
|
|
91
95
|
e.preventDefault(), e.stopPropagation(), t.onRequestOverview(t.itemSnapshot());
|
|
92
|
-
}, D = (e) => {
|
|
93
|
-
e.preventDefault(), e.stopPropagation(), t.onRequestFit(t.itemSnapshot());
|
|
94
96
|
}, P = (e) => {
|
|
97
|
+
e.preventDefault(), e.stopPropagation(), t.onRequestFit(t.itemSnapshot());
|
|
98
|
+
}, A = (e) => {
|
|
95
99
|
e.preventDefault(), e.stopPropagation(), t.onRequestDelete(t.widgetId);
|
|
96
|
-
},
|
|
100
|
+
}, U = u(() => {
|
|
97
101
|
const e = {
|
|
98
102
|
width: `${S().width}px`,
|
|
99
103
|
height: `${S().height}px`,
|
|
100
|
-
"z-index":
|
|
104
|
+
"z-index": R() || T() || t.optimisticFront ? `${t.topRenderLayer + 1}` : `${t.renderLayer}`
|
|
101
105
|
};
|
|
102
106
|
if (t.layoutMode === "projected_surface") {
|
|
103
|
-
const i =
|
|
107
|
+
const i = Y()?.rect;
|
|
104
108
|
return {
|
|
105
109
|
...e,
|
|
106
110
|
left: `${i?.screenX ?? 0}px`,
|
|
@@ -112,7 +116,7 @@ function Wt(t) {
|
|
|
112
116
|
...e,
|
|
113
117
|
transform: `translate(${$().x}px, ${$().y}px)`
|
|
114
118
|
};
|
|
115
|
-
}),
|
|
119
|
+
}), tt = (e) => {
|
|
116
120
|
const i = f(m);
|
|
117
121
|
if (!i) return;
|
|
118
122
|
const r = {
|
|
@@ -128,10 +132,10 @@ function Wt(t) {
|
|
|
128
132
|
e.preventDefault(), e.stopPropagation(), _?.stop({
|
|
129
133
|
reason: "manual_stop",
|
|
130
134
|
commit: !1
|
|
131
|
-
}), t.onSelect(t.widgetId),
|
|
135
|
+
}), t.onSelect(t.widgetId), g?.focus({
|
|
132
136
|
preventScroll: !0
|
|
133
137
|
}), t.onStartOptimisticFront(t.widgetId);
|
|
134
|
-
const i =
|
|
138
|
+
const i = z("drag", "grabbing"), r = Math.max(t.viewportScale, 1e-3);
|
|
135
139
|
y({
|
|
136
140
|
pointerId: e.pointerId,
|
|
137
141
|
startClientX: e.clientX,
|
|
@@ -145,26 +149,26 @@ function Wt(t) {
|
|
|
145
149
|
stopInteraction: i
|
|
146
150
|
});
|
|
147
151
|
const d = (a) => {
|
|
148
|
-
y((
|
|
149
|
-
if (!
|
|
150
|
-
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;
|
|
151
155
|
return {
|
|
152
|
-
...
|
|
153
|
-
worldX:
|
|
156
|
+
...n,
|
|
157
|
+
worldX: h,
|
|
154
158
|
worldY: w,
|
|
155
|
-
moved:
|
|
159
|
+
moved: n.moved || Math.abs(h - n.startWorldX) > 2 || Math.abs(w - n.startWorldY) > 2
|
|
156
160
|
};
|
|
157
161
|
});
|
|
158
162
|
};
|
|
159
|
-
_ =
|
|
163
|
+
_ = N({
|
|
160
164
|
pointerEvent: e,
|
|
161
165
|
captureEl: e.currentTarget,
|
|
162
166
|
onMove: d,
|
|
163
167
|
onEnd: ({
|
|
164
168
|
commit: a
|
|
165
|
-
}) =>
|
|
169
|
+
}) => tt(a)
|
|
166
170
|
});
|
|
167
|
-
},
|
|
171
|
+
}, et = (e) => {
|
|
168
172
|
const i = f(v);
|
|
169
173
|
if (!i) return;
|
|
170
174
|
const r = {
|
|
@@ -172,13 +176,13 @@ function Wt(t) {
|
|
|
172
176
|
height: i.height
|
|
173
177
|
}, d = Math.abs(i.width - i.startWidth) > 1 || Math.abs(i.height - i.startHeight) > 1;
|
|
174
178
|
e && d && t.onCommitResize(t.widgetId, r), i.stopInteraction(), x(null), b = void 0;
|
|
175
|
-
},
|
|
179
|
+
}, it = (e) => {
|
|
176
180
|
if (e.button !== 0 || t.locked) return;
|
|
177
181
|
e.preventDefault(), e.stopPropagation(), b?.stop({
|
|
178
182
|
reason: "manual_stop",
|
|
179
183
|
commit: !1
|
|
180
184
|
}), t.onStartOptimisticFront(t.widgetId);
|
|
181
|
-
const i =
|
|
185
|
+
const i = z("resize", "nwse-resize"), r = Math.max(t.viewportScale, 1e-3);
|
|
182
186
|
x({
|
|
183
187
|
pointerId: e.pointerId,
|
|
184
188
|
startClientX: e.clientX,
|
|
@@ -191,33 +195,33 @@ function Wt(t) {
|
|
|
191
195
|
stopInteraction: i
|
|
192
196
|
});
|
|
193
197
|
const d = (a) => {
|
|
194
|
-
x((
|
|
195
|
-
if (!
|
|
196
|
-
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);
|
|
197
201
|
return {
|
|
198
|
-
...
|
|
199
|
-
width:
|
|
202
|
+
...n,
|
|
203
|
+
width: h,
|
|
200
204
|
height: w
|
|
201
205
|
};
|
|
202
206
|
});
|
|
203
207
|
};
|
|
204
|
-
b =
|
|
208
|
+
b = N({
|
|
205
209
|
pointerEvent: e,
|
|
206
210
|
captureEl: e.currentTarget,
|
|
207
211
|
onMove: d,
|
|
208
212
|
onEnd: ({
|
|
209
213
|
commit: a
|
|
210
|
-
}) =>
|
|
214
|
+
}) => et(a)
|
|
211
215
|
});
|
|
212
216
|
};
|
|
213
217
|
return (() => {
|
|
214
|
-
var e =
|
|
215
|
-
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({
|
|
216
220
|
get classList() {
|
|
217
221
|
return {
|
|
218
222
|
"is-selected": t.selected,
|
|
219
|
-
"is-dragging":
|
|
220
|
-
"is-resizing":
|
|
223
|
+
"is-dragging": R(),
|
|
224
|
+
"is-resizing": T(),
|
|
221
225
|
"is-filtered-out": t.filtered,
|
|
222
226
|
"is-projected-surface": t.layoutMode === "projected_surface",
|
|
223
227
|
"is-locked": t.locked
|
|
@@ -241,49 +245,49 @@ function Wt(t) {
|
|
|
241
245
|
return t.layoutMode ?? "canvas_scaled";
|
|
242
246
|
}
|
|
243
247
|
}, () => ({
|
|
244
|
-
[
|
|
248
|
+
[ht]: t.selected ? "true" : void 0
|
|
245
249
|
}), {
|
|
246
250
|
tabIndex: 0,
|
|
247
|
-
onPointerDown:
|
|
251
|
+
onPointerDown: J,
|
|
248
252
|
onFocus: () => {
|
|
249
253
|
t.onSelect(t.widgetId);
|
|
250
254
|
},
|
|
251
|
-
onContextMenu: (
|
|
252
|
-
|
|
255
|
+
onContextMenu: (o) => {
|
|
256
|
+
X(o.target) === "widget_shell" && (o.preventDefault(), o.stopPropagation(), t.onContextMenu(o, t.itemSnapshot()));
|
|
253
257
|
},
|
|
254
258
|
get style() {
|
|
255
|
-
return
|
|
259
|
+
return U();
|
|
256
260
|
}
|
|
257
261
|
}), !1, !0), i.$$pointerdown = E, F(i, {
|
|
258
|
-
[
|
|
259
|
-
}, !1, !0), d.$$click =
|
|
262
|
+
[ut]: "true"
|
|
263
|
+
}, !1, !0), d.$$click = A, d.$$pointerdown = (o) => o.stopPropagation(), l(d, c(j, {
|
|
260
264
|
class: "workbench-widget__traffic-icon",
|
|
261
265
|
"aria-hidden": "true"
|
|
262
|
-
})), a.$$click =
|
|
266
|
+
})), a.$$click = D, a.$$pointerdown = (o) => o.stopPropagation(), l(a, c(O, {
|
|
263
267
|
class: "workbench-widget__traffic-icon",
|
|
264
268
|
"aria-hidden": "true"
|
|
265
|
-
})),
|
|
269
|
+
})), n.$$click = P, n.$$pointerdown = (o) => o.stopPropagation(), l(n, c(q, {
|
|
266
270
|
class: "workbench-widget__traffic-icon",
|
|
267
271
|
"aria-hidden": "true"
|
|
268
|
-
})), l(
|
|
272
|
+
})), l(h, Q), w.$$pointerdown = E, l(w, c(gt, {
|
|
269
273
|
class: "w-3.5 h-3.5"
|
|
270
274
|
})), l(M, () => {
|
|
271
|
-
const
|
|
272
|
-
return c(
|
|
275
|
+
const o = t.definition.icon;
|
|
276
|
+
return c(o, {
|
|
273
277
|
class: "w-3.5 h-3.5"
|
|
274
278
|
});
|
|
275
|
-
},
|
|
279
|
+
}, L), l(L, () => t.widgetTitle), k.$$click = D, k.$$pointerdown = (o) => o.stopPropagation(), l(k, c(O, {
|
|
276
280
|
class: "workbench-widget__window-control-icon",
|
|
277
281
|
"aria-hidden": "true"
|
|
278
|
-
})), I.$$click =
|
|
282
|
+
})), I.$$click = P, I.$$pointerdown = (o) => o.stopPropagation(), l(I, c(q, {
|
|
279
283
|
class: "workbench-widget__window-control-icon",
|
|
280
284
|
"aria-hidden": "true"
|
|
281
|
-
})), C.$$click =
|
|
285
|
+
})), C.$$click = A, C.$$pointerdown = (o) => o.stopPropagation(), l(C, c(j, {
|
|
282
286
|
class: "workbench-widget__window-control-icon",
|
|
283
287
|
"aria-hidden": "true"
|
|
284
|
-
})), l(
|
|
285
|
-
const
|
|
286
|
-
return c(
|
|
288
|
+
})), l(at, () => {
|
|
289
|
+
const o = t.definition.body;
|
|
290
|
+
return c(o, {
|
|
287
291
|
get widgetId() {
|
|
288
292
|
return t.widgetId;
|
|
289
293
|
},
|
|
@@ -294,22 +298,32 @@ function Wt(t) {
|
|
|
294
298
|
return t.widgetType;
|
|
295
299
|
},
|
|
296
300
|
get surfaceMetrics() {
|
|
297
|
-
return
|
|
301
|
+
return Y();
|
|
298
302
|
},
|
|
299
303
|
get activation() {
|
|
300
304
|
return V();
|
|
301
|
-
}
|
|
305
|
+
},
|
|
306
|
+
get lifecycle() {
|
|
307
|
+
return G();
|
|
308
|
+
},
|
|
309
|
+
get selected() {
|
|
310
|
+
return t.selected;
|
|
311
|
+
},
|
|
312
|
+
get filtered() {
|
|
313
|
+
return t.filtered;
|
|
314
|
+
},
|
|
315
|
+
requestActivate: K
|
|
302
316
|
});
|
|
303
317
|
}), l(e, (() => {
|
|
304
|
-
var
|
|
305
|
-
return () =>
|
|
306
|
-
var
|
|
307
|
-
return
|
|
318
|
+
var o = dt(() => !!t.locked);
|
|
319
|
+
return () => o() ? null : (() => {
|
|
320
|
+
var p = vt();
|
|
321
|
+
return p.$$pointerdown = it, p;
|
|
308
322
|
})();
|
|
309
323
|
})(), null), e;
|
|
310
324
|
})();
|
|
311
325
|
}
|
|
312
|
-
|
|
326
|
+
ct(["pointerdown", "click"]);
|
|
313
327
|
export {
|
|
314
|
-
|
|
328
|
+
Rt as WorkbenchWidget
|
|
315
329
|
};
|
|
@@ -85,12 +85,17 @@ export interface WorkbenchWidgetBodyActivation {
|
|
|
85
85
|
source: WorkbenchWidgetBodyActivationSource;
|
|
86
86
|
pointerType?: string;
|
|
87
87
|
}
|
|
88
|
+
export type WorkbenchWidgetLifecycle = 'hot' | 'warm' | 'cold';
|
|
88
89
|
export interface WorkbenchWidgetBodyProps<TWidgetType extends string = WorkbenchWidgetType> {
|
|
89
90
|
widgetId: string;
|
|
90
91
|
title: string;
|
|
91
92
|
type: TWidgetType;
|
|
92
93
|
surfaceMetrics?: WorkbenchWidgetSurfaceMetrics;
|
|
93
94
|
activation?: WorkbenchWidgetBodyActivation;
|
|
95
|
+
lifecycle?: WorkbenchWidgetLifecycle;
|
|
96
|
+
selected?: boolean;
|
|
97
|
+
filtered?: boolean;
|
|
98
|
+
requestActivate?: () => void;
|
|
94
99
|
}
|
|
95
100
|
export interface WorkbenchWidgetDefinition<TWidgetType extends string = WorkbenchWidgetType> {
|
|
96
101
|
type: TWidgetType;
|