@floegence/floe-webapp-core 0.35.58 → 0.36.0
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 +47 -50
- package/dist/components/deck/DeckContextMenu.d.ts +22 -0
- package/dist/components/deck/DeckContextMenu.js +73 -0
- package/dist/components/deck/DeckGrid.js +147 -104
- package/dist/components/deck/DeckTopBar.js +74 -96
- package/dist/components/deck/WidgetFrame.d.ts +7 -1
- package/dist/components/deck/WidgetFrame.js +60 -52
- package/dist/components/deck/index.d.ts +1 -0
- package/dist/components/ui/InfiniteCanvas.d.ts +2 -0
- package/dist/components/ui/InfiniteCanvas.js +43 -37
- package/dist/components/workbench/WorkbenchCanvas.d.ts +28 -0
- package/dist/components/workbench/WorkbenchCanvas.js +79 -0
- package/dist/components/workbench/WorkbenchContextMenu.d.ts +24 -0
- package/dist/components/workbench/WorkbenchContextMenu.js +44 -0
- package/dist/components/workbench/WorkbenchFilterBar.d.ts +16 -0
- package/dist/components/workbench/WorkbenchFilterBar.js +266 -0
- package/dist/components/workbench/WorkbenchHud.d.ts +6 -0
- package/dist/components/workbench/WorkbenchHud.js +17 -0
- package/dist/components/workbench/WorkbenchLockButton.d.ts +6 -0
- package/dist/components/workbench/WorkbenchLockButton.js +49 -0
- package/dist/components/workbench/WorkbenchOverlay.d.ts +18 -0
- package/dist/components/workbench/WorkbenchOverlay.js +107 -0
- package/dist/components/workbench/WorkbenchSurface.d.ts +21 -0
- package/dist/components/workbench/WorkbenchSurface.js +183 -0
- package/dist/components/workbench/WorkbenchWidget.d.ts +25 -0
- package/dist/components/workbench/WorkbenchWidget.js +183 -0
- package/dist/components/workbench/index.d.ts +7 -0
- package/dist/components/workbench/types.d.ts +39 -0
- package/dist/components/workbench/types.js +25 -0
- package/dist/components/workbench/useWorkbenchModel.d.ts +70 -0
- package/dist/components/workbench/useWorkbenchModel.js +259 -0
- package/dist/components/workbench/widgets/CodeEditorWidget.d.ts +1 -0
- package/dist/components/workbench/widgets/CodeEditorWidget.js +144 -0
- package/dist/components/workbench/widgets/FileBrowserWidget.d.ts +1 -0
- package/dist/components/workbench/widgets/FileBrowserWidget.js +142 -0
- package/dist/components/workbench/widgets/LogViewerWidget.d.ts +1 -0
- package/dist/components/workbench/widgets/LogViewerWidget.js +86 -0
- package/dist/components/workbench/widgets/SystemMonitorWidget.d.ts +1 -0
- package/dist/components/workbench/widgets/SystemMonitorWidget.js +122 -0
- package/dist/components/workbench/widgets/TerminalWidget.d.ts +1 -0
- package/dist/components/workbench/widgets/TerminalWidget.js +70 -0
- package/dist/components/workbench/widgets/widgetRegistry.d.ts +13 -0
- package/dist/components/workbench/widgets/widgetRegistry.js +50 -0
- package/dist/components/workbench/workbenchHelpers.d.ts +22 -0
- package/dist/components/workbench/workbenchHelpers.js +176 -0
- package/dist/deck.js +14 -12
- package/dist/full.js +381 -379
- package/dist/hooks/useDeckDrag.js +15 -15
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -0
- package/dist/ui.css +4 -0
- package/dist/workbench.css +1220 -0
- package/dist/workbench.d.ts +1 -0
- package/dist/workbench.js +22 -0
- package/package.json +5 -1
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { use as l, insert as a, createComponent as i, effect as u, template as c } from "solid-js/web";
|
|
2
|
+
import { For as d } from "solid-js";
|
|
3
|
+
import { WorkbenchWidget as m } from "./WorkbenchWidget.js";
|
|
4
|
+
import { InfiniteCanvas as g } from "../ui/InfiniteCanvas.js";
|
|
5
|
+
var v = /* @__PURE__ */ c("<div class=workbench-canvas__field><div class=workbench-canvas__grid aria-hidden=true>"), s = /* @__PURE__ */ c("<div class=workbench-canvas>");
|
|
6
|
+
function w(e) {
|
|
7
|
+
return (() => {
|
|
8
|
+
var t = s(), o = e.setCanvasFrameRef;
|
|
9
|
+
return typeof o == "function" ? l(o, t) : e.setCanvasFrameRef = t, a(t, i(g, {
|
|
10
|
+
ariaLabel: "Workbench canvas",
|
|
11
|
+
class: "workbench-canvas__infinite",
|
|
12
|
+
get viewport() {
|
|
13
|
+
return e.viewport;
|
|
14
|
+
},
|
|
15
|
+
get onViewportChange() {
|
|
16
|
+
return e.onViewportCommit;
|
|
17
|
+
},
|
|
18
|
+
get onCanvasContextMenu() {
|
|
19
|
+
return e.onCanvasContextMenu;
|
|
20
|
+
},
|
|
21
|
+
get disablePanZoom() {
|
|
22
|
+
return e.locked;
|
|
23
|
+
},
|
|
24
|
+
get children() {
|
|
25
|
+
var r = v();
|
|
26
|
+
return r.firstChild, a(r, i(d, {
|
|
27
|
+
get each() {
|
|
28
|
+
return e.widgets;
|
|
29
|
+
},
|
|
30
|
+
children: (n) => i(m, {
|
|
31
|
+
item: n,
|
|
32
|
+
get selected() {
|
|
33
|
+
return e.selectedWidgetId === n.id;
|
|
34
|
+
},
|
|
35
|
+
get optimisticFront() {
|
|
36
|
+
return e.optimisticFrontWidgetId === n.id;
|
|
37
|
+
},
|
|
38
|
+
get topZIndex() {
|
|
39
|
+
return e.topZIndex;
|
|
40
|
+
},
|
|
41
|
+
get viewportScale() {
|
|
42
|
+
return e.viewport.scale;
|
|
43
|
+
},
|
|
44
|
+
get locked() {
|
|
45
|
+
return e.locked;
|
|
46
|
+
},
|
|
47
|
+
get filtered() {
|
|
48
|
+
return !e.filters[n.type];
|
|
49
|
+
},
|
|
50
|
+
get onSelect() {
|
|
51
|
+
return e.onSelectWidget;
|
|
52
|
+
},
|
|
53
|
+
get onContextMenu() {
|
|
54
|
+
return e.onWidgetContextMenu;
|
|
55
|
+
},
|
|
56
|
+
get onStartOptimisticFront() {
|
|
57
|
+
return e.onStartOptimisticFront;
|
|
58
|
+
},
|
|
59
|
+
get onCommitFront() {
|
|
60
|
+
return e.onCommitFront;
|
|
61
|
+
},
|
|
62
|
+
get onCommitMove() {
|
|
63
|
+
return e.onCommitMove;
|
|
64
|
+
},
|
|
65
|
+
get onCommitResize() {
|
|
66
|
+
return e.onCommitResize;
|
|
67
|
+
},
|
|
68
|
+
get onRequestDelete() {
|
|
69
|
+
return e.onRequestDelete;
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
}), null), r;
|
|
73
|
+
}
|
|
74
|
+
})), u(() => t.classList.toggle("is-locked", !!e.locked)), t;
|
|
75
|
+
})();
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
w as WorkbenchCanvas
|
|
79
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type Component } from 'solid-js';
|
|
2
|
+
type WorkbenchContextMenuActionItem = Readonly<{
|
|
3
|
+
id: string;
|
|
4
|
+
kind: 'action';
|
|
5
|
+
label: string;
|
|
6
|
+
icon: Component<{
|
|
7
|
+
class?: string;
|
|
8
|
+
}>;
|
|
9
|
+
onSelect: () => void;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
destructive?: boolean;
|
|
12
|
+
}>;
|
|
13
|
+
type WorkbenchContextMenuSeparatorItem = Readonly<{
|
|
14
|
+
id: string;
|
|
15
|
+
kind: 'separator';
|
|
16
|
+
}>;
|
|
17
|
+
export type WorkbenchContextMenuItem = WorkbenchContextMenuActionItem | WorkbenchContextMenuSeparatorItem;
|
|
18
|
+
export interface WorkbenchContextMenuProps {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
items: readonly WorkbenchContextMenuItem[];
|
|
22
|
+
}
|
|
23
|
+
export declare function WorkbenchContextMenu(props: WorkbenchContextMenuProps): import("solid-js").JSX.Element;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { insert as a, createComponent as d, addEventListener as b, effect as v, className as f, setStyleProperty as m, template as l, delegateEvents as h } from "solid-js/web";
|
|
2
|
+
import { For as x } from "solid-js";
|
|
3
|
+
import { cn as k } from "../../utils/cn.js";
|
|
4
|
+
var _ = /* @__PURE__ */ l("<div role=menu class=workbench-context-menu data-floe-workbench-boundary=true>"), p = /* @__PURE__ */ l("<div role=separator aria-orientation=horizontal class=workbench-context-menu__separator>"), w = /* @__PURE__ */ l("<button type=button role=menuitem><span class=workbench-context-menu__label>");
|
|
5
|
+
function $(n) {
|
|
6
|
+
return n.kind === "action";
|
|
7
|
+
}
|
|
8
|
+
function E(n) {
|
|
9
|
+
return (() => {
|
|
10
|
+
var r = _();
|
|
11
|
+
return r.$$contextmenu = (e) => e.preventDefault(), a(r, d(x, {
|
|
12
|
+
get each() {
|
|
13
|
+
return n.items;
|
|
14
|
+
},
|
|
15
|
+
children: (e) => {
|
|
16
|
+
if (!$(e))
|
|
17
|
+
return p();
|
|
18
|
+
const c = e.icon;
|
|
19
|
+
return (() => {
|
|
20
|
+
var t = w(), i = t.firstChild;
|
|
21
|
+
return b(t, "click", e.onSelect, !0), a(t, d(c, {
|
|
22
|
+
class: "h-3.5 w-3.5"
|
|
23
|
+
}), i), a(i, () => e.label), v((o) => {
|
|
24
|
+
var u = k("workbench-context-menu__item", e.destructive && "is-destructive"), s = e.disabled;
|
|
25
|
+
return u !== o.e && f(t, o.e = u), s !== o.t && (t.disabled = o.t = s), o;
|
|
26
|
+
}, {
|
|
27
|
+
e: void 0,
|
|
28
|
+
t: void 0
|
|
29
|
+
}), t;
|
|
30
|
+
})();
|
|
31
|
+
}
|
|
32
|
+
})), v((e) => {
|
|
33
|
+
var c = `${n.x}px`, t = `${n.y}px`;
|
|
34
|
+
return c !== e.e && m(r, "left", e.e = c), t !== e.t && m(r, "top", e.t = t), e;
|
|
35
|
+
}, {
|
|
36
|
+
e: void 0,
|
|
37
|
+
t: void 0
|
|
38
|
+
}), r;
|
|
39
|
+
})();
|
|
40
|
+
}
|
|
41
|
+
h(["contextmenu", "click"]);
|
|
42
|
+
export {
|
|
43
|
+
E as WorkbenchContextMenu
|
|
44
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type JSX } from 'solid-js';
|
|
2
|
+
import type { WorkbenchWidgetItem, WorkbenchWidgetType } from './types';
|
|
3
|
+
export interface WorkbenchFilterBarProps {
|
|
4
|
+
widgets: readonly WorkbenchWidgetItem[];
|
|
5
|
+
filters: Record<WorkbenchWidgetType, boolean>;
|
|
6
|
+
/** Solo a single widget type — only this type remains visible. */
|
|
7
|
+
onSoloFilter: (type: WorkbenchWidgetType) => void;
|
|
8
|
+
/** Reset filters so every widget type is visible again. */
|
|
9
|
+
onShowAll: () => void;
|
|
10
|
+
/**
|
|
11
|
+
* Called when the user drags a widget pill onto the canvas to create a
|
|
12
|
+
* new widget of that type. Coordinates are in client space (clientX/Y).
|
|
13
|
+
*/
|
|
14
|
+
onCreateAt?: (type: WorkbenchWidgetType, clientX: number, clientY: number) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare function WorkbenchFilterBar(props: WorkbenchFilterBarProps): JSX.Element;
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { insert as g, createComponent as d, effect as I, setAttribute as S, template as E, Portal as F, setStyleProperty as H, delegateEvents as T } from "solid-js/web";
|
|
2
|
+
import { createSignal as O, onCleanup as p, createMemo as G, For as P, Show as Y } from "solid-js";
|
|
3
|
+
import { Motion as C } from "../../node_modules/.pnpm/solid-motionone@1.0.4_solid-js@1.9.11/node_modules/solid-motionone/dist/index.js";
|
|
4
|
+
import { easing as y, duration as L } from "../../utils/animations.js";
|
|
5
|
+
import { Layers as B, Plus as W } from "../icons/index.js";
|
|
6
|
+
import { startHotInteraction as q } from "../../utils/hotInteraction.js";
|
|
7
|
+
import { WIDGET_REGISTRY as x } from "./widgets/widgetRegistry.js";
|
|
8
|
+
var z = /* @__PURE__ */ E("<button type=button class=workbench-dock__item>"), N = /* @__PURE__ */ E('<div class=workbench-dock data-floe-canvas-interactive=true><button type=button class=workbench-dock__item aria-label="Show all widgets"></button><span class=workbench-dock__divider aria-hidden=true>'), U = /* @__PURE__ */ E("<div class=workbench-dock-ghost aria-hidden=true><div class=workbench-dock-ghost__halo></div><div class=workbench-dock-ghost__card><div class=workbench-dock-ghost__icon></div><div class=workbench-dock-ghost__copy><div class=workbench-dock-ghost__title></div><div class=workbench-dock-ghost__hint><span>");
|
|
9
|
+
const X = 5, V = '[data-floe-workbench-canvas-frame="true"]';
|
|
10
|
+
function j(e, l) {
|
|
11
|
+
const a = document.querySelector(V);
|
|
12
|
+
if (!(a instanceof HTMLElement)) return !1;
|
|
13
|
+
const s = a.getBoundingClientRect();
|
|
14
|
+
return e >= s.left && e <= s.right && l >= s.top && l <= s.bottom;
|
|
15
|
+
}
|
|
16
|
+
function J(e) {
|
|
17
|
+
const l = () => e.hoverOffset === -1 ? {
|
|
18
|
+
scale: 1.26,
|
|
19
|
+
y: -6,
|
|
20
|
+
x: 0
|
|
21
|
+
} : e.hoverOffset === 1 ? {
|
|
22
|
+
scale: 1.08,
|
|
23
|
+
y: -2,
|
|
24
|
+
x: 5
|
|
25
|
+
} : e.hoverOffset === -2 ? {
|
|
26
|
+
scale: 1.08,
|
|
27
|
+
y: -2,
|
|
28
|
+
x: -5
|
|
29
|
+
} : {
|
|
30
|
+
scale: 1,
|
|
31
|
+
y: 0,
|
|
32
|
+
x: 0
|
|
33
|
+
}, a = () => e.hoverOffset === -1, s = (i) => {
|
|
34
|
+
i.button === 0 && e.onDragBegin(i, e.type, e.label, e.icon);
|
|
35
|
+
};
|
|
36
|
+
return (() => {
|
|
37
|
+
var i = z();
|
|
38
|
+
return i.$$pointerdown = s, i.addEventListener("pointerleave", () => e.onLeave()), i.addEventListener("pointerenter", () => e.onEnter()), g(i, d(C.span, {
|
|
39
|
+
class: "workbench-dock__tile",
|
|
40
|
+
get animate() {
|
|
41
|
+
return l();
|
|
42
|
+
},
|
|
43
|
+
get transition() {
|
|
44
|
+
return {
|
|
45
|
+
duration: L.fast,
|
|
46
|
+
easing: y.easeOut
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
get children() {
|
|
50
|
+
return (() => {
|
|
51
|
+
const t = e.icon;
|
|
52
|
+
return d(t, {
|
|
53
|
+
class: "workbench-dock__icon"
|
|
54
|
+
});
|
|
55
|
+
})();
|
|
56
|
+
}
|
|
57
|
+
}), null), g(i, d(C.span, {
|
|
58
|
+
class: "workbench-dock__tooltip",
|
|
59
|
+
get animate() {
|
|
60
|
+
return {
|
|
61
|
+
opacity: a() ? 1 : 0,
|
|
62
|
+
y: a() ? -6 : 0
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
get transition() {
|
|
66
|
+
return {
|
|
67
|
+
duration: L.fast,
|
|
68
|
+
easing: y.easeOut
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
get children() {
|
|
72
|
+
return e.label;
|
|
73
|
+
}
|
|
74
|
+
}), null), I((t) => {
|
|
75
|
+
var f = !!e.active, _ = !!a(), h = !!e.isDragging, w = `${e.label} — click to solo, drag to canvas to create`, b = e.active;
|
|
76
|
+
return f !== t.e && i.classList.toggle("is-active", t.e = f), _ !== t.t && i.classList.toggle("is-hovered", t.t = _), h !== t.a && i.classList.toggle("is-source-dragging", t.a = h), w !== t.o && S(i, "aria-label", t.o = w), b !== t.i && S(i, "aria-pressed", t.i = b), t;
|
|
77
|
+
}, {
|
|
78
|
+
e: void 0,
|
|
79
|
+
t: void 0,
|
|
80
|
+
a: void 0,
|
|
81
|
+
o: void 0,
|
|
82
|
+
i: void 0
|
|
83
|
+
}), i;
|
|
84
|
+
})();
|
|
85
|
+
}
|
|
86
|
+
function ie(e) {
|
|
87
|
+
const [l, a] = O(null), [s, i] = O(null);
|
|
88
|
+
let t;
|
|
89
|
+
p(() => {
|
|
90
|
+
t?.abort(), t = void 0, s()?.stopInteraction();
|
|
91
|
+
});
|
|
92
|
+
const f = G(() => x.every((o) => e.filters[o.type])), _ = (o) => {
|
|
93
|
+
const r = l();
|
|
94
|
+
return r === null ? 0 : r === o ? -1 : r === o + 1 ? -2 : r === o - 1 ? 1 : 0;
|
|
95
|
+
}, h = (o) => {
|
|
96
|
+
const r = s();
|
|
97
|
+
if (!r) return;
|
|
98
|
+
const n = !r.moved;
|
|
99
|
+
if (r.stopInteraction(), i(null), t?.abort(), t = void 0, n) {
|
|
100
|
+
e.onSoloFilter(r.type);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
o && r.overCanvas && e.onCreateAt?.(r.type, r.clientX, r.clientY);
|
|
104
|
+
}, w = (o, r, n, u) => {
|
|
105
|
+
o.preventDefault(), t?.abort(), i({
|
|
106
|
+
type: r,
|
|
107
|
+
label: n,
|
|
108
|
+
icon: u,
|
|
109
|
+
pointerId: o.pointerId,
|
|
110
|
+
startClientX: o.clientX,
|
|
111
|
+
startClientY: o.clientY,
|
|
112
|
+
clientX: o.clientX,
|
|
113
|
+
clientY: o.clientY,
|
|
114
|
+
moved: !1,
|
|
115
|
+
overCanvas: !1,
|
|
116
|
+
stopInteraction: q({
|
|
117
|
+
kind: "drag",
|
|
118
|
+
cursor: "grabbing"
|
|
119
|
+
})
|
|
120
|
+
});
|
|
121
|
+
const c = new AbortController();
|
|
122
|
+
t = c;
|
|
123
|
+
const k = (v) => {
|
|
124
|
+
i((m) => {
|
|
125
|
+
if (!m || m.pointerId !== v.pointerId) return m;
|
|
126
|
+
const M = v.clientX - m.startClientX, R = v.clientY - m.startClientY, D = m.moved || Math.abs(M) > X || Math.abs(R) > X;
|
|
127
|
+
return {
|
|
128
|
+
...m,
|
|
129
|
+
clientX: v.clientX,
|
|
130
|
+
clientY: v.clientY,
|
|
131
|
+
moved: D,
|
|
132
|
+
overCanvas: D && j(v.clientX, v.clientY)
|
|
133
|
+
};
|
|
134
|
+
});
|
|
135
|
+
}, $ = (v) => {
|
|
136
|
+
v.pointerId === o.pointerId && h(!0);
|
|
137
|
+
}, A = (v) => {
|
|
138
|
+
v.pointerId === o.pointerId && h(!1);
|
|
139
|
+
};
|
|
140
|
+
window.addEventListener("pointermove", k, {
|
|
141
|
+
signal: c.signal
|
|
142
|
+
}), window.addEventListener("pointerup", $, {
|
|
143
|
+
signal: c.signal
|
|
144
|
+
}), window.addEventListener("pointercancel", A, {
|
|
145
|
+
signal: c.signal
|
|
146
|
+
});
|
|
147
|
+
}, b = () => s()?.type ?? null;
|
|
148
|
+
return [(() => {
|
|
149
|
+
var o = N(), r = o.firstChild;
|
|
150
|
+
return r.nextSibling, o.addEventListener("pointerleave", () => a(null)), r.$$click = () => e.onShowAll(), r.addEventListener("pointerleave", () => a((n) => n === 0 ? null : n)), r.addEventListener("pointerenter", () => a(0)), g(r, d(C.span, {
|
|
151
|
+
class: "workbench-dock__tile",
|
|
152
|
+
get animate() {
|
|
153
|
+
return {
|
|
154
|
+
scale: l() === 0 ? 1.26 : 1,
|
|
155
|
+
y: l() === 0 ? -6 : 0,
|
|
156
|
+
x: l() === 1 ? -5 : 0
|
|
157
|
+
};
|
|
158
|
+
},
|
|
159
|
+
get transition() {
|
|
160
|
+
return {
|
|
161
|
+
duration: L.fast,
|
|
162
|
+
easing: y.easeOut
|
|
163
|
+
};
|
|
164
|
+
},
|
|
165
|
+
get children() {
|
|
166
|
+
return d(B, {
|
|
167
|
+
class: "workbench-dock__icon"
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}), null), g(r, d(C.span, {
|
|
171
|
+
class: "workbench-dock__tooltip",
|
|
172
|
+
get animate() {
|
|
173
|
+
return {
|
|
174
|
+
opacity: l() === 0 ? 1 : 0,
|
|
175
|
+
y: l() === 0 ? -6 : 0
|
|
176
|
+
};
|
|
177
|
+
},
|
|
178
|
+
get transition() {
|
|
179
|
+
return {
|
|
180
|
+
duration: L.fast,
|
|
181
|
+
easing: y.easeOut
|
|
182
|
+
};
|
|
183
|
+
},
|
|
184
|
+
children: "Show all widgets"
|
|
185
|
+
}), null), g(o, d(P, {
|
|
186
|
+
each: x,
|
|
187
|
+
children: (n, u) => {
|
|
188
|
+
const c = () => u() + 1;
|
|
189
|
+
return d(J, {
|
|
190
|
+
get type() {
|
|
191
|
+
return n.type;
|
|
192
|
+
},
|
|
193
|
+
get label() {
|
|
194
|
+
return n.label;
|
|
195
|
+
},
|
|
196
|
+
get icon() {
|
|
197
|
+
return n.icon;
|
|
198
|
+
},
|
|
199
|
+
get active() {
|
|
200
|
+
return e.filters[n.type];
|
|
201
|
+
},
|
|
202
|
+
get hoverOffset() {
|
|
203
|
+
return _(c());
|
|
204
|
+
},
|
|
205
|
+
get isDragging() {
|
|
206
|
+
return b() === n.type;
|
|
207
|
+
},
|
|
208
|
+
onEnter: () => a(c()),
|
|
209
|
+
onLeave: () => a((k) => k === c() ? null : k),
|
|
210
|
+
onSolo: () => e.onSoloFilter(n.type),
|
|
211
|
+
onDragBegin: w
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
}), null), I((n) => {
|
|
215
|
+
var u = !!f(), c = l() === 0, k = f();
|
|
216
|
+
return u !== n.e && r.classList.toggle("is-active", n.e = u), c !== n.t && r.classList.toggle("is-hovered", n.t = c), k !== n.a && S(r, "aria-pressed", n.a = k), n;
|
|
217
|
+
}, {
|
|
218
|
+
e: void 0,
|
|
219
|
+
t: void 0,
|
|
220
|
+
a: void 0
|
|
221
|
+
}), o;
|
|
222
|
+
})(), d(Y, {
|
|
223
|
+
get when() {
|
|
224
|
+
return s()?.moved ?? !1;
|
|
225
|
+
},
|
|
226
|
+
get children() {
|
|
227
|
+
return d(K, {
|
|
228
|
+
state: s
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
})];
|
|
232
|
+
}
|
|
233
|
+
function K(e) {
|
|
234
|
+
const l = () => {
|
|
235
|
+
const t = e.state();
|
|
236
|
+
return t ? `translate3d(${t.clientX + 14}px, ${t.clientY - 56}px, 0)` : "translate3d(0px, 0px, 0)";
|
|
237
|
+
}, a = () => e.state()?.overCanvas ?? !1, s = () => e.state()?.label ?? "", i = () => e.state()?.icon;
|
|
238
|
+
return d(F, {
|
|
239
|
+
get children() {
|
|
240
|
+
var t = U(), f = t.firstChild, _ = f.nextSibling, h = _.firstChild, w = h.nextSibling, b = w.firstChild, o = b.nextSibling, r = o.firstChild;
|
|
241
|
+
return g(h, d(Y, {
|
|
242
|
+
get when() {
|
|
243
|
+
return i();
|
|
244
|
+
},
|
|
245
|
+
children: (n) => {
|
|
246
|
+
const u = n();
|
|
247
|
+
return d(u, {
|
|
248
|
+
class: "w-4 h-4"
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
})), g(b, s), g(o, d(W, {
|
|
252
|
+
class: "w-3 h-3"
|
|
253
|
+
}), r), g(r, () => a() ? "Drop to create" : "Drag onto canvas"), I((n) => {
|
|
254
|
+
var u = !!a(), c = l();
|
|
255
|
+
return u !== n.e && t.classList.toggle("is-over-canvas", n.e = u), c !== n.t && H(t, "transform", n.t = c), n;
|
|
256
|
+
}, {
|
|
257
|
+
e: void 0,
|
|
258
|
+
t: void 0
|
|
259
|
+
}), t;
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
T(["pointerdown", "click"]);
|
|
264
|
+
export {
|
|
265
|
+
ie as WorkbenchFilterBar
|
|
266
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { insert as n, createComponent as c, template as i, delegateEvents as r } from "solid-js/web";
|
|
2
|
+
import { Minus as u, Plus as s } from "../icons/index.js";
|
|
3
|
+
var b = /* @__PURE__ */ i('<div class=workbench-hud data-floe-canvas-interactive=true><button type=button class=workbench-hud__button aria-label="Zoom out"></button><div class=workbench-hud__scale></div><button type=button class=workbench-hud__button aria-label="Zoom in">');
|
|
4
|
+
function m(t) {
|
|
5
|
+
return (() => {
|
|
6
|
+
var o = b(), e = o.firstChild, l = e.nextSibling, a = l.nextSibling;
|
|
7
|
+
return e.$$click = () => t.onZoomOut(), n(e, c(u, {
|
|
8
|
+
class: "w-3.5 h-3.5"
|
|
9
|
+
})), n(l, () => t.scaleLabel), a.$$click = () => t.onZoomIn(), n(a, c(s, {
|
|
10
|
+
class: "w-3.5 h-3.5"
|
|
11
|
+
})), o;
|
|
12
|
+
})();
|
|
13
|
+
}
|
|
14
|
+
r(["click"]);
|
|
15
|
+
export {
|
|
16
|
+
m as WorkbenchHud
|
|
17
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { insert as n, createComponent as c, memo as s, effect as d, setAttribute as u, template as k, delegateEvents as v } from "solid-js/web";
|
|
2
|
+
import { Motion as m } from "../../node_modules/.pnpm/solid-motionone@1.0.4_solid-js@1.9.11/node_modules/solid-motionone/dist/index.js";
|
|
3
|
+
import { easing as h, duration as f } from "../../utils/animations.js";
|
|
4
|
+
import { Lock as g, Unlock as _ } from "../icons/index.js";
|
|
5
|
+
var L = /* @__PURE__ */ k("<button type=button class=workbench-lock-button data-floe-canvas-interactive=true><span class=workbench-lock-button__icon>"), w = /* @__PURE__ */ k("<span class=workbench-lock-button__kbd>");
|
|
6
|
+
function y(t) {
|
|
7
|
+
const l = () => t.locked ? "Unlock canvas" : "Lock canvas";
|
|
8
|
+
return (() => {
|
|
9
|
+
var a = L(), b = a.firstChild;
|
|
10
|
+
return a.$$click = () => t.onToggle(), n(b, c(m.span, {
|
|
11
|
+
class: "workbench-lock-button__icon-swap",
|
|
12
|
+
get animate() {
|
|
13
|
+
return {
|
|
14
|
+
rotate: t.locked ? 0 : -14
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
get transition() {
|
|
18
|
+
return {
|
|
19
|
+
duration: f.fast,
|
|
20
|
+
easing: h.easeOut
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
get children() {
|
|
24
|
+
return s(() => !!t.locked)() ? c(g, {
|
|
25
|
+
class: "w-4 h-4"
|
|
26
|
+
}) : c(_, {
|
|
27
|
+
class: "w-4 h-4"
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
})), n(a, (() => {
|
|
31
|
+
var e = s(() => !!t.shortcutLabel);
|
|
32
|
+
return () => e() ? (() => {
|
|
33
|
+
var o = w();
|
|
34
|
+
return n(o, () => t.shortcutLabel), o;
|
|
35
|
+
})() : null;
|
|
36
|
+
})(), null), d((e) => {
|
|
37
|
+
var o = !!t.locked, r = t.shortcutLabel ? `${l()} (${t.shortcutLabel})` : l(), i = t.locked;
|
|
38
|
+
return o !== e.e && a.classList.toggle("is-locked", e.e = o), r !== e.t && u(a, "aria-label", e.t = r), i !== e.a && u(a, "aria-pressed", e.a = i), e;
|
|
39
|
+
}, {
|
|
40
|
+
e: void 0,
|
|
41
|
+
t: void 0,
|
|
42
|
+
a: void 0
|
|
43
|
+
}), a;
|
|
44
|
+
})();
|
|
45
|
+
}
|
|
46
|
+
v(["click"]);
|
|
47
|
+
export {
|
|
48
|
+
y as WorkbenchLockButton
|
|
49
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { WorkbenchState } from './types';
|
|
2
|
+
export interface WorkbenchOverlayProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
state: () => WorkbenchState;
|
|
6
|
+
setState: (updater: (prev: WorkbenchState) => WorkbenchState) => void;
|
|
7
|
+
/**
|
|
8
|
+
* Keyboard shortcut key for toggling lock mode.
|
|
9
|
+
* Matches `KeyboardEvent.key`. Defaults to "F1".
|
|
10
|
+
*/
|
|
11
|
+
lockShortcut?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Modal-mode wrapper around WorkbenchSurface. Use this for transient pop-in
|
|
15
|
+
* usage (a workbench launched as a tool overlay). For permanent display-mode
|
|
16
|
+
* usage, mount WorkbenchSurface directly inside your layout.
|
|
17
|
+
*/
|
|
18
|
+
export declare function WorkbenchOverlay(props: WorkbenchOverlayProps): import("solid-js").JSX.Element;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { createComponent as t, insert as l, template as u, delegateEvents as h } from "solid-js/web";
|
|
2
|
+
import { Show as f } from "solid-js";
|
|
3
|
+
import { Motion as c } from "../../node_modules/.pnpm/solid-motionone@1.0.4_solid-js@1.9.11/node_modules/solid-motionone/dist/index.js";
|
|
4
|
+
import { easing as y, duration as i } from "../../utils/animations.js";
|
|
5
|
+
import { useOverlayMask as b } from "../../hooks/useOverlayMask.js";
|
|
6
|
+
import { X as v } from "../icons/index.js";
|
|
7
|
+
import { WorkbenchSurface as k } from "./WorkbenchSurface.js";
|
|
8
|
+
var m = /* @__PURE__ */ u('<header class=workbench-overlay__header data-floe-canvas-interactive=true><div class=workbench-overlay__header-brand><div class=workbench-overlay__header-title>Workbench</div></div><div class=workbench-overlay__header-actions><button type=button class=workbench-overlay__close aria-label="Close workbench overlay"data-floe-overlay-close=true>'), _ = /* @__PURE__ */ u("<div class=workbench-overlay__body>");
|
|
9
|
+
const s = '[data-floe-workbench-boundary="true"]';
|
|
10
|
+
function w(e) {
|
|
11
|
+
return typeof Element < "u" && e instanceof Element ? !!e.closest(s) : typeof Node < "u" && e instanceof Node ? !!e.parentElement?.closest(s) : !1;
|
|
12
|
+
}
|
|
13
|
+
function O(e) {
|
|
14
|
+
let a;
|
|
15
|
+
return b({
|
|
16
|
+
open: () => e.open,
|
|
17
|
+
root: () => a,
|
|
18
|
+
onClose: () => e.onClose(),
|
|
19
|
+
containsTarget: w,
|
|
20
|
+
lockBodyScroll: !0,
|
|
21
|
+
trapFocus: !0,
|
|
22
|
+
closeOnEscape: !0,
|
|
23
|
+
blockHotkeys: !0,
|
|
24
|
+
blockWheel: "outside",
|
|
25
|
+
blockTouchMove: "outside",
|
|
26
|
+
autoFocus: {
|
|
27
|
+
selector: '[data-floe-overlay-close="true"]'
|
|
28
|
+
},
|
|
29
|
+
restoreFocus: !0
|
|
30
|
+
}), t(f, {
|
|
31
|
+
get when() {
|
|
32
|
+
return e.open;
|
|
33
|
+
},
|
|
34
|
+
get children() {
|
|
35
|
+
return t(c.section, {
|
|
36
|
+
ref(o) {
|
|
37
|
+
var r = a;
|
|
38
|
+
typeof r == "function" ? r(o) : a = o;
|
|
39
|
+
},
|
|
40
|
+
class: "workbench-overlay",
|
|
41
|
+
role: "dialog",
|
|
42
|
+
"aria-modal": !0,
|
|
43
|
+
"aria-label": "Workbench overlay",
|
|
44
|
+
tabIndex: -1,
|
|
45
|
+
initial: {
|
|
46
|
+
opacity: 0
|
|
47
|
+
},
|
|
48
|
+
animate: {
|
|
49
|
+
opacity: 1
|
|
50
|
+
},
|
|
51
|
+
get transition() {
|
|
52
|
+
return {
|
|
53
|
+
duration: i.fast
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
get children() {
|
|
57
|
+
return t(c.div, {
|
|
58
|
+
class: "workbench-overlay__frame",
|
|
59
|
+
"data-floe-workbench-boundary": "true",
|
|
60
|
+
initial: {
|
|
61
|
+
opacity: 0,
|
|
62
|
+
y: 18,
|
|
63
|
+
scale: 0.986
|
|
64
|
+
},
|
|
65
|
+
animate: {
|
|
66
|
+
opacity: 1,
|
|
67
|
+
y: 0,
|
|
68
|
+
scale: 1
|
|
69
|
+
},
|
|
70
|
+
get transition() {
|
|
71
|
+
return {
|
|
72
|
+
duration: i.normal,
|
|
73
|
+
easing: y.easeOut
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
get children() {
|
|
77
|
+
return [(() => {
|
|
78
|
+
var o = m(), r = o.firstChild, d = r.nextSibling, n = d.firstChild;
|
|
79
|
+
return n.$$click = () => e.onClose(), l(n, t(v, {
|
|
80
|
+
class: "w-4 h-4"
|
|
81
|
+
})), o;
|
|
82
|
+
})(), (() => {
|
|
83
|
+
var o = _();
|
|
84
|
+
return l(o, t(k, {
|
|
85
|
+
class: "workbench-surface--in-overlay",
|
|
86
|
+
get state() {
|
|
87
|
+
return e.state;
|
|
88
|
+
},
|
|
89
|
+
get setState() {
|
|
90
|
+
return e.setState;
|
|
91
|
+
},
|
|
92
|
+
get lockShortcut() {
|
|
93
|
+
return e.lockShortcut;
|
|
94
|
+
}
|
|
95
|
+
})), o;
|
|
96
|
+
})()];
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
h(["click"]);
|
|
105
|
+
export {
|
|
106
|
+
O as WorkbenchOverlay
|
|
107
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { WorkbenchState } from './types';
|
|
2
|
+
export interface WorkbenchSurfaceProps {
|
|
3
|
+
state: () => WorkbenchState;
|
|
4
|
+
setState: (updater: (prev: WorkbenchState) => WorkbenchState) => void;
|
|
5
|
+
/**
|
|
6
|
+
* Keyboard shortcut key for toggling lock mode. Matches `KeyboardEvent.key`.
|
|
7
|
+
* Defaults to "F1". Pass `null` to disable the shortcut entirely.
|
|
8
|
+
*/
|
|
9
|
+
lockShortcut?: string | null;
|
|
10
|
+
/**
|
|
11
|
+
* If true, owns global keyboard handlers (arrows, lock, delete). Set to
|
|
12
|
+
* false when the surface is embedded in a parent that drives those keys
|
|
13
|
+
* itself. Defaults to true.
|
|
14
|
+
*/
|
|
15
|
+
enableKeyboard?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Optional class added to the surface root for layout integration.
|
|
18
|
+
*/
|
|
19
|
+
class?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function WorkbenchSurface(props: WorkbenchSurfaceProps): import("solid-js").JSX.Element;
|