@floegence/floe-webapp-core 0.36.12 → 0.36.15
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/deck/DeckCell.js +46 -38
- package/dist/components/file-browser/FileContextMenu.js +265 -225
- package/dist/components/ui/Dialog.js +63 -53
- package/dist/components/ui/Dropdown.js +209 -169
- package/dist/components/ui/FloatingWindow.js +73 -69
- package/dist/components/ui/InfiniteCanvas.d.ts +1 -0
- package/dist/components/ui/InfiniteCanvas.js +123 -105
- package/dist/components/ui/canvasGeometry.d.ts +32 -0
- package/dist/components/ui/canvasGeometry.js +33 -0
- package/dist/components/ui/dialogSurfaceScope.d.ts +26 -1
- package/dist/components/ui/dialogSurfaceScope.js +132 -33
- package/dist/components/ui/index.d.ts +2 -0
- package/dist/components/ui/menuUtils.d.ts +21 -2
- package/dist/components/ui/menuUtils.js +73 -43
- package/dist/components/ui/surfacePortalScope.d.ts +1 -0
- package/dist/components/ui/surfacePortalTypes.d.ts +8 -0
- package/dist/components/workbench/WorkbenchCanvas.d.ts +1 -0
- package/dist/components/workbench/WorkbenchCanvas.js +11 -8
- package/dist/components/workbench/WorkbenchSurface.js +56 -55
- package/dist/components/workbench/useWorkbenchModel.d.ts +1 -0
- package/dist/components/workbench/useWorkbenchModel.js +67 -64
- package/dist/full.js +611 -591
- package/dist/styles.css +1 -1
- package/dist/ui.js +120 -100
- package/package.json +1 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { createSignal as
|
|
2
|
-
import { ArrowUp as
|
|
3
|
-
import { getTopZIndex as
|
|
4
|
-
import { resolveWorkbenchWidgetDefinitions as
|
|
5
|
-
function
|
|
6
|
-
const [W, x] =
|
|
1
|
+
import { createSignal as N, createMemo as d, onCleanup as St } from "solid-js";
|
|
2
|
+
import { ArrowUp as Ct, Copy as pt, Trash as kt } from "../icons/index.js";
|
|
3
|
+
import { getTopZIndex as Ft, createContextMenuPosition as bt, createWorkbenchId as It, createWorkbenchViewportCenteredOnWidget as L, findNearestWidget as Mt, clampScale as Xt, WORKBENCH_CANVAS_ZOOM_STEP as $, WORKBENCH_MIN_SCALE as vt, createWorkbenchViewportFitForWidget as yt, WORKBENCH_CONTEXT_MENU_WIDTH_PX as Yt, estimateContextMenuHeight as Ot } from "./workbenchHelpers.js";
|
|
4
|
+
import { resolveWorkbenchWidgetDefinitions as zt, getWidgetEntry as j, createWorkbenchFilterState as _t } from "./widgets/widgetRegistry.js";
|
|
5
|
+
function Pt(c) {
|
|
6
|
+
const [W, x] = N(null), [U, D] = N(null), [H, G] = N({ width: 0, height: 0 });
|
|
7
7
|
let r = null, S = null;
|
|
8
|
-
const l = c.state, w = d(() => l().widgets), u = d(() => l().viewport), J = d(() => l().locked),
|
|
9
|
-
() =>
|
|
8
|
+
const l = c.state, w = d(() => l().widgets), u = d(() => l().viewport), J = d(() => l().locked), R = d(() => l().filters), F = d(() => l().selectedWidgetId), b = d(() => Ft(w())), Q = d(() => `${Math.round(u().scale * 100)}%`), tt = () => typeof c.widgetDefinitions == "function" ? c.widgetDefinitions() : c.widgetDefinitions, m = d(
|
|
9
|
+
() => zt(tt())
|
|
10
10
|
), I = (t, e) => {
|
|
11
11
|
const n = Number.isFinite(t) && t > 0 ? t : 0, i = Number.isFinite(e) && e > 0 ? e : 0, o = { width: n, height: i }, s = H();
|
|
12
12
|
return s.width === n && s.height === i ? s : (G(o), o);
|
|
13
|
-
},
|
|
13
|
+
}, T = () => {
|
|
14
14
|
S?.disconnect(), S = null;
|
|
15
15
|
}, a = () => r ? I(r.clientWidth, r.clientHeight) : I(0, 0), et = (t) => {
|
|
16
16
|
if (r === (t ?? null)) {
|
|
17
17
|
a();
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
T(), r = t ?? null, a(), !(!r || typeof ResizeObserver > "u") && (S = new ResizeObserver((e) => {
|
|
21
21
|
const n = e[0];
|
|
22
22
|
I(
|
|
23
23
|
n?.contentRect.width ?? r?.clientWidth ?? 0,
|
|
@@ -25,8 +25,8 @@ function qt(c) {
|
|
|
25
25
|
);
|
|
26
26
|
}), S.observe(r));
|
|
27
27
|
};
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
St(() => {
|
|
29
|
+
T(), r = null;
|
|
30
30
|
});
|
|
31
31
|
const nt = (t) => {
|
|
32
32
|
x({
|
|
@@ -43,7 +43,7 @@ function qt(c) {
|
|
|
43
43
|
worldY: e.y,
|
|
44
44
|
widgetId: e.id
|
|
45
45
|
});
|
|
46
|
-
}, h = () => x(null), ot = (t) => l().widgets.find((e) => e.id === t) ?? null, M = (t) => l().widgets.find((e) => e.type === t) ?? null,
|
|
46
|
+
}, h = () => x(null), ot = (t) => l().widgets.find((e) => e.id === t) ?? null, M = (t) => l().widgets.find((e) => e.type === t) ?? null, E = d(() => {
|
|
47
47
|
const t = W();
|
|
48
48
|
if (!t) return [];
|
|
49
49
|
if (t.widgetId) {
|
|
@@ -52,7 +52,7 @@ function qt(c) {
|
|
|
52
52
|
id: "bring-to-front",
|
|
53
53
|
kind: "action",
|
|
54
54
|
label: "Bring to Front",
|
|
55
|
-
icon:
|
|
55
|
+
icon: Ct,
|
|
56
56
|
onSelect: () => {
|
|
57
57
|
f(e.id), h();
|
|
58
58
|
}
|
|
@@ -60,18 +60,18 @@ function qt(c) {
|
|
|
60
60
|
id: "duplicate",
|
|
61
61
|
kind: "action",
|
|
62
62
|
label: "Duplicate",
|
|
63
|
-
icon:
|
|
63
|
+
icon: pt,
|
|
64
64
|
onSelect: () => {
|
|
65
|
-
|
|
65
|
+
B(e.type, e.x + 32, e.y + 32), h();
|
|
66
66
|
}
|
|
67
67
|
})), n.push({ id: "separator-delete", kind: "separator" }), n.push({
|
|
68
68
|
id: "delete",
|
|
69
69
|
kind: "action",
|
|
70
70
|
label: "Delete",
|
|
71
|
-
icon:
|
|
71
|
+
icon: kt,
|
|
72
72
|
destructive: !0,
|
|
73
73
|
onSelect: () => {
|
|
74
|
-
t.widgetId &&
|
|
74
|
+
t.widgetId && y(t.widgetId), h();
|
|
75
75
|
}
|
|
76
76
|
}), n;
|
|
77
77
|
}
|
|
@@ -81,25 +81,25 @@ function qt(c) {
|
|
|
81
81
|
label: `Add ${e.label}`,
|
|
82
82
|
icon: e.icon,
|
|
83
83
|
onSelect: () => {
|
|
84
|
-
|
|
84
|
+
v(e.type, t.worldX, t.worldY), h();
|
|
85
85
|
}
|
|
86
86
|
}));
|
|
87
87
|
}), ct = d(() => {
|
|
88
88
|
const t = W();
|
|
89
89
|
if (!t) return;
|
|
90
|
-
const e =
|
|
91
|
-
return
|
|
90
|
+
const e = E(), n = e.filter((o) => o.kind === "action").length, i = e.filter((o) => o.kind === "separator").length;
|
|
91
|
+
return bt({
|
|
92
92
|
clientX: t.clientX,
|
|
93
93
|
clientY: t.clientY,
|
|
94
94
|
menuWidth: Yt,
|
|
95
|
-
menuHeight:
|
|
95
|
+
menuHeight: Ot(n, i)
|
|
96
96
|
});
|
|
97
97
|
}), X = (t, e, n) => {
|
|
98
98
|
const i = j(t, m()), o = i.singleton ? M(t) : null;
|
|
99
99
|
if (o)
|
|
100
100
|
return p(o, { centerViewport: !0 });
|
|
101
101
|
const s = i.defaultSize, g = {
|
|
102
|
-
id:
|
|
102
|
+
id: It(),
|
|
103
103
|
type: t,
|
|
104
104
|
title: i.defaultTitle,
|
|
105
105
|
x: e,
|
|
@@ -114,10 +114,10 @@ function qt(c) {
|
|
|
114
114
|
widgets: [...k.widgets, g],
|
|
115
115
|
selectedWidgetId: g.id
|
|
116
116
|
})), g;
|
|
117
|
-
},
|
|
117
|
+
}, v = (t, e, n) => {
|
|
118
118
|
const i = j(t, m()).defaultSize;
|
|
119
119
|
return X(t, e - i.width / 2, n - i.height / 2);
|
|
120
|
-
},
|
|
120
|
+
}, B = (t, e, n) => X(t, e, n), y = (t) => {
|
|
121
121
|
c.setState((e) => ({
|
|
122
122
|
...e,
|
|
123
123
|
widgets: e.widgets.filter((n) => n.id !== t),
|
|
@@ -148,17 +148,17 @@ function qt(c) {
|
|
|
148
148
|
(i) => i.id === t ? { ...i, width: e.width, height: e.height } : i
|
|
149
149
|
)
|
|
150
150
|
}));
|
|
151
|
-
},
|
|
151
|
+
}, Y = (t) => {
|
|
152
152
|
c.setState((e) => ({ ...e, viewport: t }));
|
|
153
|
-
},
|
|
154
|
-
const e = u(), n = a(), i = (n.width / 2 - e.x) / e.scale, o = (n.height / 2 - e.y) / e.scale, s =
|
|
153
|
+
}, q = (t) => {
|
|
154
|
+
const e = u(), n = a(), i = (n.width / 2 - e.x) / e.scale, o = (n.height / 2 - e.y) / e.scale, s = Xt(
|
|
155
155
|
t === "in" ? e.scale * $ : e.scale / $
|
|
156
156
|
), g = {
|
|
157
157
|
x: n.width / 2 - i * s,
|
|
158
158
|
y: n.height / 2 - o * s,
|
|
159
159
|
scale: s
|
|
160
160
|
};
|
|
161
|
-
|
|
161
|
+
Y(g);
|
|
162
162
|
}, lt = () => {
|
|
163
163
|
c.setState((t) => ({ ...t, locked: !t.locked }));
|
|
164
164
|
}, at = (t) => {
|
|
@@ -174,14 +174,14 @@ function qt(c) {
|
|
|
174
174
|
return { ...e, filters: n };
|
|
175
175
|
});
|
|
176
176
|
}, ut = () => {
|
|
177
|
-
const t =
|
|
177
|
+
const t = _t(m());
|
|
178
178
|
c.setState((e) => ({
|
|
179
179
|
...e,
|
|
180
180
|
filters: t
|
|
181
181
|
}));
|
|
182
182
|
}, C = (t) => {
|
|
183
183
|
c.setState((e) => ({ ...e, selectedWidgetId: t }));
|
|
184
|
-
},
|
|
184
|
+
}, P = () => {
|
|
185
185
|
c.setState(
|
|
186
186
|
(t) => t.selectedWidgetId === null ? t : { ...t, selectedWidgetId: null }
|
|
187
187
|
);
|
|
@@ -192,48 +192,50 @@ function qt(c) {
|
|
|
192
192
|
worldY: t.height > 0 ? (t.height / 2 - e.y) / e.scale : 180
|
|
193
193
|
};
|
|
194
194
|
};
|
|
195
|
-
let
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
195
|
+
let O = 0;
|
|
196
|
+
const ft = () => {
|
|
197
|
+
O += 1;
|
|
198
|
+
}, z = (t) => {
|
|
199
|
+
const e = u(), n = e.x, i = e.y, o = e.scale, s = performance.now(), g = 360, k = ++O, Wt = (V) => 1 - Math.pow(1 - V, 3), Z = (V) => {
|
|
200
|
+
if (k !== O) return;
|
|
201
|
+
const xt = V - s, K = Math.min(Math.max(xt / g, 0), 1), A = Wt(K);
|
|
202
|
+
Y({
|
|
201
203
|
x: n + (t.x - n) * A,
|
|
202
204
|
y: i + (t.y - i) * A,
|
|
203
205
|
scale: o + (t.scale - o) * A
|
|
204
206
|
}), K < 1 && requestAnimationFrame(Z);
|
|
205
207
|
};
|
|
206
208
|
requestAnimationFrame(Z);
|
|
207
|
-
},
|
|
209
|
+
}, _ = (t) => {
|
|
208
210
|
const e = a();
|
|
209
|
-
e.width === 0 || e.height === 0 ||
|
|
211
|
+
e.width === 0 || e.height === 0 || z(L({
|
|
210
212
|
widget: t,
|
|
211
213
|
scale: u().scale,
|
|
212
214
|
frameWidth: e.width,
|
|
213
215
|
frameHeight: e.height
|
|
214
216
|
}));
|
|
215
|
-
},
|
|
217
|
+
}, wt = (t) => {
|
|
216
218
|
const e = a();
|
|
217
|
-
e.width === 0 || e.height === 0 ||
|
|
219
|
+
e.width === 0 || e.height === 0 || z(yt({
|
|
218
220
|
widget: t,
|
|
219
221
|
frameWidth: e.width,
|
|
220
222
|
frameHeight: e.height
|
|
221
223
|
}));
|
|
222
|
-
},
|
|
224
|
+
}, mt = (t) => {
|
|
223
225
|
const e = a();
|
|
224
|
-
e.width === 0 || e.height === 0 ||
|
|
226
|
+
e.width === 0 || e.height === 0 || z(L({
|
|
225
227
|
widget: t,
|
|
226
|
-
scale:
|
|
228
|
+
scale: vt,
|
|
227
229
|
frameWidth: e.width,
|
|
228
230
|
frameHeight: e.height
|
|
229
231
|
}));
|
|
230
|
-
}, p = (t, e = {}) => (C(t.id), f(t.id), e.centerViewport !== !1 &&
|
|
232
|
+
}, p = (t, e = {}) => (C(t.id), f(t.id), e.centerViewport !== !1 && _(t), t);
|
|
231
233
|
return {
|
|
232
234
|
widgets: w,
|
|
233
235
|
viewport: u,
|
|
234
236
|
canvasFrameSize: H,
|
|
235
237
|
locked: J,
|
|
236
|
-
filters:
|
|
238
|
+
filters: R,
|
|
237
239
|
selectedWidgetId: F,
|
|
238
240
|
topZIndex: b,
|
|
239
241
|
scaleLabel: Q,
|
|
@@ -242,7 +244,7 @@ function qt(c) {
|
|
|
242
244
|
setCanvasFrameRef: et,
|
|
243
245
|
contextMenu: {
|
|
244
246
|
state: W,
|
|
245
|
-
items:
|
|
247
|
+
items: E,
|
|
246
248
|
position: ct,
|
|
247
249
|
close: h,
|
|
248
250
|
retarget: (t) => {
|
|
@@ -258,16 +260,17 @@ function qt(c) {
|
|
|
258
260
|
openCanvasContextMenu: nt,
|
|
259
261
|
openWidgetContextMenu: it,
|
|
260
262
|
selectWidget: C,
|
|
261
|
-
clearSelection:
|
|
263
|
+
clearSelection: P,
|
|
262
264
|
startOptimisticFront: st,
|
|
263
265
|
commitFront: f,
|
|
264
266
|
commitMove: rt,
|
|
265
267
|
commitResize: dt,
|
|
266
|
-
commitViewport:
|
|
268
|
+
commitViewport: Y,
|
|
269
|
+
cancelViewportNavigation: ft
|
|
267
270
|
},
|
|
268
271
|
hud: {
|
|
269
|
-
zoomIn: () =>
|
|
270
|
-
zoomOut: () =>
|
|
272
|
+
zoomIn: () => q("in"),
|
|
273
|
+
zoomOut: () => q("out")
|
|
271
274
|
},
|
|
272
275
|
lock: {
|
|
273
276
|
toggle: lt
|
|
@@ -279,41 +282,41 @@ function qt(c) {
|
|
|
279
282
|
},
|
|
280
283
|
navigation: {
|
|
281
284
|
handleArrowNavigation: (t) => {
|
|
282
|
-
const e =
|
|
285
|
+
const e = Mt(
|
|
283
286
|
w(),
|
|
284
287
|
F(),
|
|
285
288
|
t,
|
|
286
|
-
|
|
289
|
+
R()
|
|
287
290
|
);
|
|
288
291
|
e && p(e);
|
|
289
292
|
},
|
|
290
|
-
centerOnWidget:
|
|
293
|
+
centerOnWidget: _,
|
|
291
294
|
focusWidget: p,
|
|
292
|
-
fitWidget: (t) => (C(t.id), f(t.id),
|
|
293
|
-
overviewWidget: (t) => (C(t.id), f(t.id),
|
|
295
|
+
fitWidget: (t) => (C(t.id), f(t.id), wt(t), t),
|
|
296
|
+
overviewWidget: (t) => (C(t.id), f(t.id), mt(t), t)
|
|
294
297
|
},
|
|
295
298
|
selection: {
|
|
296
|
-
clear:
|
|
299
|
+
clear: P
|
|
297
300
|
},
|
|
298
301
|
widgetActions: {
|
|
299
302
|
deleteSelected: () => {
|
|
300
303
|
const t = F();
|
|
301
|
-
t &&
|
|
304
|
+
t && y(t);
|
|
302
305
|
},
|
|
303
|
-
deleteWidget:
|
|
306
|
+
deleteWidget: y,
|
|
304
307
|
addWidget: X,
|
|
305
|
-
addWidgetAtCursor:
|
|
306
|
-
addWidgetCentered:
|
|
308
|
+
addWidgetAtCursor: v,
|
|
309
|
+
addWidgetCentered: B,
|
|
307
310
|
ensureWidget: (t, e) => {
|
|
308
311
|
const n = M(t);
|
|
309
312
|
if (n)
|
|
310
313
|
return p(n, { centerViewport: e?.centerViewport ?? !0 });
|
|
311
|
-
const i = ht(), o =
|
|
314
|
+
const i = ht(), o = v(
|
|
312
315
|
t,
|
|
313
316
|
e?.worldX ?? i.worldX,
|
|
314
317
|
e?.worldY ?? i.worldY
|
|
315
318
|
);
|
|
316
|
-
return (e?.centerViewport ?? !0) && o &&
|
|
319
|
+
return (e?.centerViewport ?? !0) && o && _(o), o;
|
|
317
320
|
}
|
|
318
321
|
},
|
|
319
322
|
queries: {
|
|
@@ -330,5 +333,5 @@ function qt(c) {
|
|
|
330
333
|
};
|
|
331
334
|
}
|
|
332
335
|
export {
|
|
333
|
-
|
|
336
|
+
Pt as useWorkbenchModel
|
|
334
337
|
};
|