@floegence/floe-webapp-core 0.40.13 → 0.40.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/workbench/WorkbenchFilterBar.d.ts +12 -0
- package/dist/components/workbench/WorkbenchFilterBar.js +353 -255
- package/dist/components/workbench/WorkbenchSurface.d.ts +3 -1
- package/dist/components/workbench/WorkbenchSurface.js +32 -26
- package/dist/components/workbench/index.d.ts +1 -1
- package/dist/styles.css +1 -1
- package/dist/workbench.css +51 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type UIFirstSelectionEvent } from '../../utils/uiFirstSelection';
|
|
2
2
|
import { type WorkbenchContextMenuItem } from './WorkbenchContextMenu';
|
|
3
|
-
import { type WorkbenchDockItemActivation, type WorkbenchDockAction } from './WorkbenchFilterBar';
|
|
3
|
+
import { type WorkbenchDockItemActivation, type WorkbenchDockAction, type WorkbenchExternalDockDragController, type WorkbenchExternalDockDragItem } from './WorkbenchFilterBar';
|
|
4
4
|
import type { WorkbenchState, WorkbenchAnnotationItem, WorkbenchBackgroundLayer, WorkbenchBackgroundLayerDefaults, WorkbenchBackgroundLayerPatch, WorkbenchContextMenuState, WorkbenchInteractionAdapter, WorkbenchStickyNoteItem, WorkbenchStickyNotePatch, WorkbenchTextAnnotationDefaults, WorkbenchTextAnnotationPatch, WorkbenchWidgetDefinition, WorkbenchWidgetItem, WorkbenchWidgetType } from './types';
|
|
5
5
|
export interface WorkbenchCreateAtOptions {
|
|
6
6
|
worldX?: number;
|
|
@@ -69,6 +69,8 @@ export interface WorkbenchSurfaceProps {
|
|
|
69
69
|
onRequestDelete?: (widgetId: string) => void;
|
|
70
70
|
onDockItemClick?: (item: WorkbenchDockItemActivation) => boolean | void;
|
|
71
71
|
dockActions?: readonly WorkbenchDockAction[];
|
|
72
|
+
registerExternalDockDragController?: (controller: WorkbenchExternalDockDragController | null) => void;
|
|
73
|
+
onExternalDockDrop?: (item: WorkbenchExternalDockDragItem) => void;
|
|
72
74
|
onLayoutInteractionStart?: () => void;
|
|
73
75
|
onLayoutInteractionEnd?: () => void;
|
|
74
76
|
/** Defer pointer/focus widget activation until the visual selection has painted. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { use as j, spread as K, mergeProps as Z, insert as v, createComponent as l, Portal as G, addEventListener as J, template as
|
|
2
|
-
import { createSignal as
|
|
1
|
+
import { use as j, spread as K, mergeProps as Z, insert as v, createComponent as l, Portal as G, addEventListener as J, template as E, delegateEvents as Q } from "solid-js/web";
|
|
2
|
+
import { createSignal as W, createMemo as w, untrack as h, createEffect as k, onCleanup as A, Show as ee } from "solid-js";
|
|
3
3
|
import { clientToCanvasWorld as B } from "../ui/canvasGeometry.js";
|
|
4
4
|
import { createUIFirstSelection as te } from "../../utils/uiFirstSelection.js";
|
|
5
5
|
import { WorkbenchCanvas as ne } from "./WorkbenchCanvas.js";
|
|
@@ -12,7 +12,7 @@ import { createContextMenuPosition as de, WORKBENCH_CONTEXT_MENU_WIDTH_PX as ue,
|
|
|
12
12
|
import { resolveWorkbenchWidgetPlacementPreview as le, resolveWorkbenchToolPlacementPreview as ge } from "./workbenchPlacement.js";
|
|
13
13
|
import { useWorkbenchModel as we } from "./useWorkbenchModel.js";
|
|
14
14
|
import { resolveWorkbenchInteractionAdapter as me } from "./workbenchInteractionAdapter.js";
|
|
15
|
-
var fe = /* @__PURE__ */
|
|
15
|
+
var fe = /* @__PURE__ */ E("<div class=workbench-menu-backdrop data-floe-workbench-boundary=true>"), ve = /* @__PURE__ */ E("<div><div class=workbench-surface__body data-floe-workbench-canvas-frame=true>");
|
|
16
16
|
const ke = "F1";
|
|
17
17
|
function T(i) {
|
|
18
18
|
if (i)
|
|
@@ -24,7 +24,7 @@ function T(i) {
|
|
|
24
24
|
i.focus();
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function Ee(i) {
|
|
28
28
|
const t = we({
|
|
29
29
|
state: () => i.state(),
|
|
30
30
|
setState: (e) => i.setState(e),
|
|
@@ -44,7 +44,7 @@ function Re(i) {
|
|
|
44
44
|
t.canvas.selectWidget(e), n?.bringToFront && t.canvas.commitFront(e);
|
|
45
45
|
},
|
|
46
46
|
onEvent: (e) => i.onWidgetActivationEvent?.(e)
|
|
47
|
-
}),
|
|
47
|
+
}), R = () => i.widgetActivationMode === "after-paint" ? u.visual() : t.selectedWidgetId(), F = () => {
|
|
48
48
|
if (i.widgetActivationMode !== "after-paint" || !u.pending())
|
|
49
49
|
return t.selectedObject();
|
|
50
50
|
const e = u.visual();
|
|
@@ -52,7 +52,7 @@ function Re(i) {
|
|
|
52
52
|
kind: "widget",
|
|
53
53
|
id: e
|
|
54
54
|
} : null;
|
|
55
|
-
},
|
|
55
|
+
}, N = (e) => {
|
|
56
56
|
if (i.widgetActivationMode === "after-paint") {
|
|
57
57
|
if (u.pending() && u.visual() === e) return;
|
|
58
58
|
u.request(e, {
|
|
@@ -61,7 +61,7 @@ function Re(i) {
|
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
63
|
t.canvas.selectWidget(e);
|
|
64
|
-
},
|
|
64
|
+
}, O = (e) => {
|
|
65
65
|
if (i.widgetActivationMode === "after-paint") {
|
|
66
66
|
if (u.pending() && u.visual() === e) return;
|
|
67
67
|
u.request(e, {
|
|
@@ -70,7 +70,7 @@ function Re(i) {
|
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
t.canvas.selectWidget(e), t.canvas.commitFront(e);
|
|
73
|
-
}, [s, X] =
|
|
73
|
+
}, [s, X] = W(null), [_, q] = W(null), c = w(() => me(i.interactionAdapter)), [p, g] = W(h(() => c().createInitialInputOwner())), S = w(() => {
|
|
74
74
|
const e = i.launcherWidgetTypes;
|
|
75
75
|
return !e || e.length <= 0 ? null : new Set(e);
|
|
76
76
|
}), Y = w(() => {
|
|
@@ -93,7 +93,7 @@ function Re(i) {
|
|
|
93
93
|
widget: d,
|
|
94
94
|
closeMenu: t.contextMenu.close
|
|
95
95
|
});
|
|
96
|
-
}),
|
|
96
|
+
}), D = w(() => {
|
|
97
97
|
const e = t.contextMenu.state();
|
|
98
98
|
if (!e) return;
|
|
99
99
|
const n = b(), o = n.filter((a) => a.kind === "action").length, r = n.filter((a) => a.kind === "separator").length;
|
|
@@ -115,7 +115,7 @@ function Re(i) {
|
|
|
115
115
|
}
|
|
116
116
|
const f = s();
|
|
117
117
|
f && e instanceof Node && f.contains(e) && g(r.createCanvasInputOwner(o));
|
|
118
|
-
},
|
|
118
|
+
}, M = (e = "selection_cleared") => {
|
|
119
119
|
const n = c(), o = s();
|
|
120
120
|
t.selection.clear(), g(n.createCanvasInputOwner(e)), queueMicrotask(() => {
|
|
121
121
|
if (!o || typeof document > "u") return;
|
|
@@ -164,7 +164,7 @@ function Re(i) {
|
|
|
164
164
|
const n = y();
|
|
165
165
|
return t.widgetActions.addBackgroundLayerAtCursor(e?.worldX ?? n.worldX, e?.worldY ?? n.worldY) ?? null;
|
|
166
166
|
},
|
|
167
|
-
clearSelection: () =>
|
|
167
|
+
clearSelection: () => M("selection_cleared"),
|
|
168
168
|
focusWidget: (e, n) => {
|
|
169
169
|
const o = t.navigation.focusWidget(e, n);
|
|
170
170
|
return m(o.id), o;
|
|
@@ -202,7 +202,7 @@ function Re(i) {
|
|
|
202
202
|
i.onApiReady?.(null);
|
|
203
203
|
});
|
|
204
204
|
});
|
|
205
|
-
const
|
|
205
|
+
const I = () => i.lockShortcut === void 0 ? ke : i.lockShortcut;
|
|
206
206
|
k(() => {
|
|
207
207
|
if (typeof window > "u" || !t.contextMenu.state()) return;
|
|
208
208
|
const e = ce({
|
|
@@ -227,7 +227,7 @@ function Re(i) {
|
|
|
227
227
|
});
|
|
228
228
|
}), k(() => {
|
|
229
229
|
if (i.enableKeyboard === !1 || typeof document > "u") return;
|
|
230
|
-
const e =
|
|
230
|
+
const e = I(), n = (o) => {
|
|
231
231
|
if (!(o.defaultPrevented || o.isComposing)) {
|
|
232
232
|
if (e !== null && o.key === e) {
|
|
233
233
|
o.preventDefault(), t.lock.toggle();
|
|
@@ -261,7 +261,7 @@ function Re(i) {
|
|
|
261
261
|
};
|
|
262
262
|
document.addEventListener("keydown", n, !0), A(() => document.removeEventListener("keydown", n, !0));
|
|
263
263
|
});
|
|
264
|
-
const
|
|
264
|
+
const C = (e, n, o) => {
|
|
265
265
|
if (o?.canvasFrame)
|
|
266
266
|
return B(o.canvasFrame, t.viewport(), {
|
|
267
267
|
clientX: e,
|
|
@@ -275,10 +275,10 @@ function Re(i) {
|
|
|
275
275
|
clientY: n
|
|
276
276
|
});
|
|
277
277
|
}, z = (e, n, o, r) => {
|
|
278
|
-
const a =
|
|
278
|
+
const a = C(n, o, r);
|
|
279
279
|
a && t.widgetActions.addWidgetAtWorldCenter(e, a.worldX, a.worldY);
|
|
280
280
|
}, H = (e, n, o, r) => {
|
|
281
|
-
const a =
|
|
281
|
+
const a = C(n, o, r);
|
|
282
282
|
if (a) {
|
|
283
283
|
if (e === "sticky-note") {
|
|
284
284
|
t.widgetActions.addStickyNoteAtCursor(a.worldX, a.worldY);
|
|
@@ -291,11 +291,11 @@ function Re(i) {
|
|
|
291
291
|
e === "background-region" && t.widgetActions.addBackgroundLayerAtCursor(a.worldX, a.worldY);
|
|
292
292
|
}
|
|
293
293
|
}, U = (e) => {
|
|
294
|
-
e.button === 0 && (c().findWidgetRoot(e.target) ||
|
|
294
|
+
e.button === 0 && (c().findWidgetRoot(e.target) || M("background_pointer"));
|
|
295
295
|
}, $ = w(() => {
|
|
296
296
|
const e = _();
|
|
297
297
|
if (!e) return null;
|
|
298
|
-
const n =
|
|
298
|
+
const n = C(e.clientX, e.clientY, e);
|
|
299
299
|
return n ? e.kind === "widget" ? le({
|
|
300
300
|
type: e.id,
|
|
301
301
|
widgetDefinitions: t.widgetDefinitions(),
|
|
@@ -354,10 +354,10 @@ function Re(i) {
|
|
|
354
354
|
return t.canvasFrameSize();
|
|
355
355
|
},
|
|
356
356
|
get selectedWidgetId() {
|
|
357
|
-
return
|
|
357
|
+
return R();
|
|
358
358
|
},
|
|
359
359
|
get selectedObject() {
|
|
360
|
-
return
|
|
360
|
+
return F();
|
|
361
361
|
},
|
|
362
362
|
get mode() {
|
|
363
363
|
return t.mode();
|
|
@@ -387,8 +387,8 @@ function Re(i) {
|
|
|
387
387
|
return t.canvas.openCanvasContextMenu;
|
|
388
388
|
},
|
|
389
389
|
onCanvasPointerDown: U,
|
|
390
|
-
onSelectWidget:
|
|
391
|
-
onActivateWidget:
|
|
390
|
+
onSelectWidget: N,
|
|
391
|
+
onActivateWidget: O,
|
|
392
392
|
get onWidgetContextMenu() {
|
|
393
393
|
return t.canvas.openWidgetContextMenu;
|
|
394
394
|
},
|
|
@@ -483,7 +483,7 @@ function Re(i) {
|
|
|
483
483
|
return t.lock.toggle;
|
|
484
484
|
},
|
|
485
485
|
get shortcutLabel() {
|
|
486
|
-
return
|
|
486
|
+
return I() ?? void 0;
|
|
487
487
|
}
|
|
488
488
|
}), null), v(e, l(re, {
|
|
489
489
|
get widgetDefinitions() {
|
|
@@ -519,6 +519,12 @@ function Re(i) {
|
|
|
519
519
|
get dockActions() {
|
|
520
520
|
return i.dockActions;
|
|
521
521
|
},
|
|
522
|
+
get registerExternalDockDragController() {
|
|
523
|
+
return i.registerExternalDockDragController;
|
|
524
|
+
},
|
|
525
|
+
get onExternalDockDrop() {
|
|
526
|
+
return i.onExternalDockDrop;
|
|
527
|
+
},
|
|
522
528
|
onDragPreviewChange: q
|
|
523
529
|
}), null), v(e, l(ie, {
|
|
524
530
|
get scaleLabel() {
|
|
@@ -546,10 +552,10 @@ function Re(i) {
|
|
|
546
552
|
return J(o, "contextmenu", t.contextMenu.retarget, !0), o;
|
|
547
553
|
})(), l(oe, {
|
|
548
554
|
get x() {
|
|
549
|
-
return
|
|
555
|
+
return D()?.left ?? 0;
|
|
550
556
|
},
|
|
551
557
|
get y() {
|
|
552
|
-
return
|
|
558
|
+
return D()?.top ?? 0;
|
|
553
559
|
},
|
|
554
560
|
get items() {
|
|
555
561
|
return b();
|
|
@@ -563,5 +569,5 @@ function Re(i) {
|
|
|
563
569
|
}
|
|
564
570
|
Q(["contextmenu"]);
|
|
565
571
|
export {
|
|
566
|
-
|
|
572
|
+
Ee as WorkbenchSurface
|
|
567
573
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { WorkbenchOverlay, type WorkbenchOverlayProps, } from './WorkbenchOverlay';
|
|
2
2
|
export { WorkbenchSurface, type WorkbenchSurfaceApi, type WorkbenchCreateAtOptions, type WorkbenchCreateWidgetOptions, type WorkbenchContextMenuItemsResolver, type WorkbenchSurfaceProps, } from './WorkbenchSurface';
|
|
3
|
-
export type { WorkbenchDockAction, WorkbenchDockItemActivation } from './WorkbenchFilterBar';
|
|
3
|
+
export type { WorkbenchDockAction, WorkbenchDockItemActivation, WorkbenchExternalDockDragController, WorkbenchExternalDockDragItem, } from './WorkbenchFilterBar';
|
|
4
4
|
export { WorkbenchContextMenu, type WorkbenchContextMenuItem, type WorkbenchContextMenuProps, } from './WorkbenchContextMenu';
|
|
5
5
|
export { useWorkbenchModel, type UseWorkbenchModelOptions } from './useWorkbenchModel';
|
|
6
6
|
export { WIDGET_REGISTRY, createWorkbenchFilterState, getWidgetEntry, isValidWorkbenchWidgetType, resolveWorkbenchWidgetDefinitions, type WidgetRegistryEntry, } from './widgets/widgetRegistry';
|