@floegence/floe-webapp-core 0.35.59 → 0.36.1

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.
Files changed (62) hide show
  1. package/dist/components/deck/DeckCell.js +47 -50
  2. package/dist/components/deck/DeckContextMenu.d.ts +22 -0
  3. package/dist/components/deck/DeckContextMenu.js +73 -0
  4. package/dist/components/deck/DeckGrid.js +147 -104
  5. package/dist/components/deck/DeckTopBar.js +74 -96
  6. package/dist/components/deck/WidgetFrame.d.ts +7 -1
  7. package/dist/components/deck/WidgetFrame.js +60 -52
  8. package/dist/components/deck/index.d.ts +1 -0
  9. package/dist/components/layout/DisplayModePageShell.d.ts +8 -0
  10. package/dist/components/layout/DisplayModePageShell.js +22 -0
  11. package/dist/components/layout/DisplayModeSwitcher.d.ts +7 -0
  12. package/dist/components/layout/DisplayModeSwitcher.js +52 -0
  13. package/dist/components/layout/index.d.ts +2 -0
  14. package/dist/components/ui/InfiniteCanvas.d.ts +2 -0
  15. package/dist/components/ui/InfiniteCanvas.js +43 -37
  16. package/dist/components/workbench/WorkbenchCanvas.d.ts +29 -0
  17. package/dist/components/workbench/WorkbenchCanvas.js +83 -0
  18. package/dist/components/workbench/WorkbenchContextMenu.d.ts +24 -0
  19. package/dist/components/workbench/WorkbenchContextMenu.js +44 -0
  20. package/dist/components/workbench/WorkbenchFilterBar.d.ts +17 -0
  21. package/dist/components/workbench/WorkbenchFilterBar.js +267 -0
  22. package/dist/components/workbench/WorkbenchHud.d.ts +6 -0
  23. package/dist/components/workbench/WorkbenchHud.js +17 -0
  24. package/dist/components/workbench/WorkbenchLockButton.d.ts +6 -0
  25. package/dist/components/workbench/WorkbenchLockButton.js +49 -0
  26. package/dist/components/workbench/WorkbenchOverlay.d.ts +18 -0
  27. package/dist/components/workbench/WorkbenchOverlay.js +107 -0
  28. package/dist/components/workbench/WorkbenchSurface.d.ts +34 -0
  29. package/dist/components/workbench/WorkbenchSurface.js +200 -0
  30. package/dist/components/workbench/WorkbenchWidget.d.ts +26 -0
  31. package/dist/components/workbench/WorkbenchWidget.js +192 -0
  32. package/dist/components/workbench/index.d.ts +7 -0
  33. package/dist/components/workbench/types.d.ts +56 -0
  34. package/dist/components/workbench/types.js +11 -0
  35. package/dist/components/workbench/useWorkbenchModel.d.ts +83 -0
  36. package/dist/components/workbench/useWorkbenchModel.js +284 -0
  37. package/dist/components/workbench/widgets/CodeEditorWidget.d.ts +1 -0
  38. package/dist/components/workbench/widgets/CodeEditorWidget.js +144 -0
  39. package/dist/components/workbench/widgets/FileBrowserWidget.d.ts +1 -0
  40. package/dist/components/workbench/widgets/FileBrowserWidget.js +142 -0
  41. package/dist/components/workbench/widgets/LogViewerWidget.d.ts +1 -0
  42. package/dist/components/workbench/widgets/LogViewerWidget.js +86 -0
  43. package/dist/components/workbench/widgets/SystemMonitorWidget.d.ts +1 -0
  44. package/dist/components/workbench/widgets/SystemMonitorWidget.js +122 -0
  45. package/dist/components/workbench/widgets/TerminalWidget.d.ts +1 -0
  46. package/dist/components/workbench/widgets/TerminalWidget.js +70 -0
  47. package/dist/components/workbench/widgets/widgetRegistry.d.ts +14 -0
  48. package/dist/components/workbench/widgets/widgetRegistry.js +71 -0
  49. package/dist/components/workbench/workbenchHelpers.d.ts +26 -0
  50. package/dist/components/workbench/workbenchHelpers.js +139 -0
  51. package/dist/deck.js +14 -12
  52. package/dist/display-mode.css +70 -0
  53. package/dist/full.js +475 -468
  54. package/dist/hooks/useDeckDrag.js +15 -15
  55. package/dist/layout.js +32 -27
  56. package/dist/styles.css +1 -1
  57. package/dist/tailwind.css +2 -0
  58. package/dist/ui.css +4 -0
  59. package/dist/workbench.css +1220 -0
  60. package/dist/workbench.d.ts +1 -0
  61. package/dist/workbench.js +23 -0
  62. package/package.json +5 -1
@@ -1,14 +1,14 @@
1
- import { insert as q, effect as G, className as I, setAttribute as J, setStyleProperty as K, template as Q, use as ee, delegateEvents as te } from "solid-js/web";
2
- import { createSignal as T, untrack as D, createEffect as L, onCleanup as y } from "solid-js";
1
+ import { insert as q, effect as G, className as T, setAttribute as J, setStyleProperty as K, template as Q, use as ee, delegateEvents as te } from "solid-js/web";
2
+ import { createSignal as D, untrack as L, createEffect as b, onCleanup as y } from "solid-js";
3
3
  import { cn as Y } from "../../utils/cn.js";
4
4
  import { isTypingElement as _ } from "../../utils/dom.js";
5
- import { startHotInteraction as b } from "../../utils/hotInteraction.js";
5
+ import { startHotInteraction as A } from "../../utils/hotInteraction.js";
6
6
  var ne = /* @__PURE__ */ Q('<div><div style="transform-origin:0 0">');
7
- const re = 1, ie = 0.45, oe = 2.2, ae = 14e-4, ce = '[data-floe-canvas-pan-surface="true"]', A = 3;
7
+ const re = 1, ie = 0.45, oe = 2.2, ae = 14e-4, ce = '[data-floe-canvas-pan-surface="true"]', M = 3;
8
8
  function le(n, a, d) {
9
9
  return Math.max(a, Math.min(d, n));
10
10
  }
11
- function M(n) {
11
+ function X(n) {
12
12
  return {
13
13
  x: Number.isFinite(n.x) ? n.x : 0,
14
14
  y: Number.isFinite(n.y) ? n.y : 0,
@@ -19,16 +19,16 @@ function se(n, a) {
19
19
  return n.deltaMode === 1 ? n.deltaY * 16 : n.deltaMode === 2 ? n.deltaY * (a?.clientHeight ?? window.innerHeight) : n.deltaY;
20
20
  }
21
21
  function we(n) {
22
- const [a, d] = T(D(() => M(n.viewport))), [p, S] = T(null);
22
+ const [a, d] = D(L(() => X(n.viewport))), [p, S] = D(null);
23
23
  let o, f, m = !1, l;
24
- const X = () => n.interactiveSelector ?? '[data-floe-canvas-interactive="true"]', F = () => n.panSurfaceSelector ?? ce, $ = () => n.minScale ?? ie, k = () => n.maxScale ?? oe, V = () => n.wheelZoomSpeed ?? ae, R = () => {
24
+ const F = () => n.interactiveSelector ?? '[data-floe-canvas-interactive="true"]', k = () => n.panSurfaceSelector ?? ce, $ = () => n.minScale ?? ie, V = () => n.maxScale ?? oe, R = () => n.wheelZoomSpeed ?? ae, N = () => {
25
25
  const e = p();
26
26
  return e ? e.startedFromPanSurface ? e.moved : !0 : !1;
27
- }, C = () => {
28
- f !== void 0 && (window.clearTimeout(f), f = void 0);
29
27
  }, v = () => {
28
+ f !== void 0 && (window.clearTimeout(f), f = void 0);
29
+ }, C = () => {
30
30
  m = !1, l !== void 0 && (window.clearTimeout(l), l = void 0);
31
- }, N = () => {
31
+ }, U = () => {
32
32
  if (typeof window > "u") {
33
33
  m = !1;
34
34
  return;
@@ -37,47 +37,49 @@ function we(n) {
37
37
  l = void 0, m = !1;
38
38
  }, 0);
39
39
  }, h = (e) => {
40
- D(() => n.onViewportChange?.(e));
41
- }, U = (e) => {
40
+ L(() => n.onViewportChange?.(e));
41
+ }, H = (e) => {
42
42
  if (typeof window > "u") {
43
43
  h(e);
44
44
  return;
45
45
  }
46
- C(), f = window.setTimeout(() => {
46
+ v(), f = window.setTimeout(() => {
47
47
  f = void 0, h(e);
48
48
  }, 90);
49
- }, E = (e) => e instanceof Element ? e.closest(X()) ? !0 : _(e) : !1, x = (e) => e instanceof Element ? e.closest(F()) !== null : !1, g = (e) => {
49
+ }, E = (e) => e instanceof Element ? e.closest(F()) ? !0 : _(e) : !1, P = (e) => e instanceof Element ? e.closest(k()) !== null : !1, g = (e) => {
50
50
  const t = p();
51
51
  if (!t || e !== void 0 && t.pointerId !== e) return;
52
52
  t.stopInteraction?.();
53
53
  const r = a();
54
- S(null), o && o.hasPointerCapture(t.pointerId) && o.releasePointerCapture(t.pointerId), t.startedFromPanSurface && t.moved && (m = !0, N()), h(r);
54
+ S(null), o && o.hasPointerCapture(t.pointerId) && o.releasePointerCapture(t.pointerId), t.startedFromPanSurface && t.moved && (m = !0, U()), h(r);
55
55
  };
56
- L(() => {
57
- p() || d(M(n.viewport));
58
- }), L(() => {
56
+ b(() => {
57
+ p() || d(X(n.viewport));
58
+ }), b(() => {
59
59
  const e = o;
60
60
  if (!e) return;
61
61
  const t = (r) => {
62
- !m || !x(r.target) || (v(), r.preventDefault(), r.stopPropagation());
62
+ !m || !P(r.target) || (C(), r.preventDefault(), r.stopPropagation());
63
63
  };
64
- e.addEventListener("click", t, !0), y(() => {
65
- e.removeEventListener("click", t, !0);
64
+ e.addEventListener("click", t, !0), e.addEventListener("wheel", x, {
65
+ passive: !1
66
+ }), y(() => {
67
+ e.removeEventListener("click", t, !0), e.removeEventListener("wheel", x);
66
68
  });
67
69
  }), y(() => {
68
- C(), g(), v();
70
+ v(), g(), C();
69
71
  });
70
- const H = (e) => {
71
- if (e.button !== 0 || _(e.target)) return;
72
- const t = x(e.target);
73
- E(e.target) && !t || (C(), v(), t || (e.preventDefault(), o?.setPointerCapture(e.pointerId)), S({
72
+ const Z = (e) => {
73
+ if (e.button !== 0 || _(e.target) || n.disablePanZoom) return;
74
+ const t = P(e.target);
75
+ E(e.target) && !t || (v(), C(), t || (e.preventDefault(), o?.setPointerCapture(e.pointerId)), S({
74
76
  pointerId: e.pointerId,
75
77
  startClientX: e.clientX,
76
78
  startClientY: e.clientY,
77
79
  startViewport: a(),
78
80
  moved: !1,
79
81
  startedFromPanSurface: t,
80
- stopInteraction: t ? void 0 : b({
82
+ stopInteraction: t ? void 0 : A({
81
83
  kind: "drag",
82
84
  cursor: "grabbing"
83
85
  })
@@ -86,7 +88,7 @@ function we(n) {
86
88
  const t = p();
87
89
  if (!t || t.pointerId !== e.pointerId) return;
88
90
  const r = e.clientX - t.startClientX, i = e.clientY - t.startClientY;
89
- if (!(t.moved || Math.abs(r) > A || Math.abs(i) > A)) return;
91
+ if (!(t.moved || Math.abs(r) > M || Math.abs(i) > M)) return;
90
92
  t.moved || (e.preventDefault(), o?.hasPointerCapture(e.pointerId) || o?.setPointerCapture(e.pointerId));
91
93
  const u = {
92
94
  ...t.startViewport,
@@ -96,27 +98,31 @@ function we(n) {
96
98
  t.moved || S({
97
99
  ...t,
98
100
  moved: !0,
99
- stopInteraction: t.stopInteraction ?? b({
101
+ stopInteraction: t.stopInteraction ?? A({
100
102
  kind: "drag",
101
103
  cursor: "grabbing"
102
104
  })
103
105
  }), d(u);
104
106
  }, W = (e) => {
105
107
  g(e.pointerId);
106
- }, Z = (e) => {
107
- g(e.pointerId);
108
108
  }, B = (e) => {
109
+ g(e.pointerId);
110
+ }, x = (e) => {
109
111
  const t = o?.getBoundingClientRect();
110
112
  if (!t) return;
113
+ if (n.disablePanZoom) {
114
+ e.preventDefault();
115
+ return;
116
+ }
111
117
  e.preventDefault();
112
- const r = a(), i = e.clientX - t.left, c = e.clientY - t.top, u = se(e, o), s = le(r.scale * Math.exp(-u * V()), $(), k());
118
+ const r = a(), i = e.clientX - t.left, c = e.clientY - t.top, u = se(e, o), s = le(r.scale * Math.exp(-u * R()), $(), V());
113
119
  if (Math.abs(s - r.scale) < 1e-4) return;
114
- const w = (i - r.x) / r.scale, j = (c - r.y) / r.scale, P = {
120
+ const w = (i - r.x) / r.scale, j = (c - r.y) / r.scale, I = {
115
121
  x: i - w * s,
116
122
  y: c - j * s,
117
123
  scale: s
118
124
  };
119
- d(P), U(P);
125
+ d(I), H(I);
120
126
  }, z = (e) => {
121
127
  if (E(e.target)) return;
122
128
  const t = o?.getBoundingClientRect();
@@ -134,11 +140,11 @@ function we(n) {
134
140
  };
135
141
  return (() => {
136
142
  var e = ne(), t = e.firstChild;
137
- e.$$contextmenu = z, e.addEventListener("wheel", B), e.addEventListener("pointercancel", Z), e.$$pointerup = W, e.$$pointermove = O, e.$$pointerdown = H;
143
+ e.$$contextmenu = z, e.addEventListener("pointercancel", B), e.$$pointerup = W, e.$$pointermove = O, e.$$pointerdown = Z;
138
144
  var r = o;
139
145
  return typeof r == "function" ? ee(r, e) : o = e, q(t, () => n.children), G((i) => {
140
- var c = Y("floe-infinite-canvas", R() && "is-panning", n.class), u = n.ariaLabel ?? "Infinite canvas", s = Y("floe-infinite-canvas__viewport", n.contentClass), w = `translate(${a().x}px, ${a().y}px) scale(${a().scale})`;
141
- return c !== i.e && I(e, i.e = c), u !== i.t && J(e, "aria-label", i.t = u), s !== i.a && I(t, i.a = s), w !== i.o && K(t, "transform", i.o = w), i;
146
+ var c = Y("floe-infinite-canvas", N() && "is-panning", n.disablePanZoom && "is-locked", n.class), u = n.ariaLabel ?? "Infinite canvas", s = Y("floe-infinite-canvas__viewport", n.contentClass), w = `translate(${a().x}px, ${a().y}px) scale(${a().scale})`;
147
+ return c !== i.e && T(e, i.e = c), u !== i.t && J(e, "aria-label", i.t = u), s !== i.a && T(t, i.a = s), w !== i.o && K(t, "transform", i.o = w), i;
142
148
  }, {
143
149
  e: void 0,
144
150
  t: void 0,
@@ -0,0 +1,29 @@
1
+ import { type InfiniteCanvasContextMenuEvent } from '../../ui';
2
+ import type { WorkbenchViewport, WorkbenchWidgetDefinition, WorkbenchWidgetItem, WorkbenchWidgetType } from './types';
3
+ export interface WorkbenchCanvasProps {
4
+ widgetDefinitions: readonly WorkbenchWidgetDefinition[];
5
+ widgets: readonly WorkbenchWidgetItem[];
6
+ viewport: WorkbenchViewport;
7
+ selectedWidgetId: string | null;
8
+ optimisticFrontWidgetId: string | null;
9
+ topZIndex: number;
10
+ locked: boolean;
11
+ filters: Record<WorkbenchWidgetType, boolean>;
12
+ setCanvasFrameRef: (el: HTMLDivElement | undefined) => void;
13
+ onViewportCommit: (viewport: WorkbenchViewport) => void;
14
+ onCanvasContextMenu: (event: InfiniteCanvasContextMenuEvent) => void;
15
+ onSelectWidget: (widgetId: string) => void;
16
+ onWidgetContextMenu: (event: MouseEvent, item: WorkbenchWidgetItem) => void;
17
+ onStartOptimisticFront: (widgetId: string) => void;
18
+ onCommitFront: (widgetId: string) => void;
19
+ onCommitMove: (widgetId: string, position: {
20
+ x: number;
21
+ y: number;
22
+ }) => void;
23
+ onCommitResize: (widgetId: string, size: {
24
+ width: number;
25
+ height: number;
26
+ }) => void;
27
+ onRequestDelete: (widgetId: string) => void;
28
+ }
29
+ export declare function WorkbenchCanvas(props: WorkbenchCanvasProps): import("solid-js").JSX.Element;
@@ -0,0 +1,83 @@
1
+ import { use as d, insert as a, createComponent as i, effect as l, template as c } from "solid-js/web";
2
+ import { For as g } from "solid-js";
3
+ import { WorkbenchWidget as u } from "./WorkbenchWidget.js";
4
+ import { getWidgetEntry as m } from "./widgets/widgetRegistry.js";
5
+ import { InfiniteCanvas as v } from "../ui/InfiniteCanvas.js";
6
+ var s = /* @__PURE__ */ c("<div class=workbench-canvas__field><div class=workbench-canvas__grid aria-hidden=true>"), f = /* @__PURE__ */ c("<div class=workbench-canvas>");
7
+ function b(e) {
8
+ return (() => {
9
+ var t = f(), o = e.setCanvasFrameRef;
10
+ return typeof o == "function" ? d(o, t) : e.setCanvasFrameRef = t, a(t, i(v, {
11
+ ariaLabel: "Workbench canvas",
12
+ class: "workbench-canvas__infinite",
13
+ get viewport() {
14
+ return e.viewport;
15
+ },
16
+ get onViewportChange() {
17
+ return e.onViewportCommit;
18
+ },
19
+ get onCanvasContextMenu() {
20
+ return e.onCanvasContextMenu;
21
+ },
22
+ get disablePanZoom() {
23
+ return e.locked;
24
+ },
25
+ get children() {
26
+ var r = s();
27
+ return r.firstChild, a(r, i(g, {
28
+ get each() {
29
+ return e.widgets;
30
+ },
31
+ children: (n) => i(u, {
32
+ get definition() {
33
+ return m(n.type, e.widgetDefinitions);
34
+ },
35
+ item: n,
36
+ get selected() {
37
+ return e.selectedWidgetId === n.id;
38
+ },
39
+ get optimisticFront() {
40
+ return e.optimisticFrontWidgetId === n.id;
41
+ },
42
+ get topZIndex() {
43
+ return e.topZIndex;
44
+ },
45
+ get viewportScale() {
46
+ return e.viewport.scale;
47
+ },
48
+ get locked() {
49
+ return e.locked;
50
+ },
51
+ get filtered() {
52
+ return !e.filters[n.type];
53
+ },
54
+ get onSelect() {
55
+ return e.onSelectWidget;
56
+ },
57
+ get onContextMenu() {
58
+ return e.onWidgetContextMenu;
59
+ },
60
+ get onStartOptimisticFront() {
61
+ return e.onStartOptimisticFront;
62
+ },
63
+ get onCommitFront() {
64
+ return e.onCommitFront;
65
+ },
66
+ get onCommitMove() {
67
+ return e.onCommitMove;
68
+ },
69
+ get onCommitResize() {
70
+ return e.onCommitResize;
71
+ },
72
+ get onRequestDelete() {
73
+ return e.onRequestDelete;
74
+ }
75
+ })
76
+ }), null), r;
77
+ }
78
+ })), l(() => t.classList.toggle("is-locked", !!e.locked)), t;
79
+ })();
80
+ }
81
+ export {
82
+ b as WorkbenchCanvas
83
+ };
@@ -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,17 @@
1
+ import { type JSX } from 'solid-js';
2
+ import type { WorkbenchWidgetDefinition, WorkbenchWidgetItem, WorkbenchWidgetType } from './types';
3
+ export interface WorkbenchFilterBarProps {
4
+ widgetDefinitions: readonly WorkbenchWidgetDefinition[];
5
+ widgets: readonly WorkbenchWidgetItem[];
6
+ filters: Record<WorkbenchWidgetType, boolean>;
7
+ /** Solo a single widget type — only this type remains visible. */
8
+ onSoloFilter: (type: WorkbenchWidgetType) => void;
9
+ /** Reset filters so every widget type is visible again. */
10
+ onShowAll: () => void;
11
+ /**
12
+ * Called when the user drags a widget pill onto the canvas to create a
13
+ * new widget of that type. Coordinates are in client space (clientX/Y).
14
+ */
15
+ onCreateAt?: (type: WorkbenchWidgetType, clientX: number, clientY: number) => void;
16
+ }
17
+ export declare function WorkbenchFilterBar(props: WorkbenchFilterBarProps): JSX.Element;
@@ -0,0 +1,267 @@
1
+ import { insert as v, createComponent as d, effect as D, setAttribute as S, template as I, Portal as F, setStyleProperty as H, delegateEvents as P } from "solid-js/web";
2
+ import { createSignal as O, onCleanup as R, createMemo as B, For as T, Show as X } 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 G, Plus as q } from "../icons/index.js";
6
+ import { startHotInteraction as z } from "../../utils/hotInteraction.js";
7
+ var N = /* @__PURE__ */ I("<button type=button class=workbench-dock__item>"), U = /* @__PURE__ */ I('<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>'), V = /* @__PURE__ */ I("<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>");
8
+ const x = 5, W = '[data-floe-workbench-canvas-frame="true"]';
9
+ function j(e, l) {
10
+ const a = document.querySelector(W);
11
+ if (!(a instanceof HTMLElement)) return !1;
12
+ const s = a.getBoundingClientRect();
13
+ return e >= s.left && e <= s.right && l >= s.top && l <= s.bottom;
14
+ }
15
+ function p(e) {
16
+ const l = () => e.hoverOffset === -1 ? {
17
+ scale: 1.26,
18
+ y: -6,
19
+ x: 0
20
+ } : e.hoverOffset === 1 ? {
21
+ scale: 1.08,
22
+ y: -2,
23
+ x: 5
24
+ } : e.hoverOffset === -2 ? {
25
+ scale: 1.08,
26
+ y: -2,
27
+ x: -5
28
+ } : {
29
+ scale: 1,
30
+ y: 0,
31
+ x: 0
32
+ }, a = () => e.hoverOffset === -1, s = (o) => {
33
+ o.button === 0 && e.onDragBegin(o, e.type, e.label, e.icon);
34
+ };
35
+ return (() => {
36
+ var o = N();
37
+ return o.$$pointerdown = s, o.addEventListener("pointerleave", () => e.onLeave()), o.addEventListener("pointerenter", () => e.onEnter()), v(o, d(C.span, {
38
+ class: "workbench-dock__tile",
39
+ get animate() {
40
+ return l();
41
+ },
42
+ get transition() {
43
+ return {
44
+ duration: L.fast,
45
+ easing: y.easeOut
46
+ };
47
+ },
48
+ get children() {
49
+ return (() => {
50
+ const t = e.icon;
51
+ return d(t, {
52
+ class: "workbench-dock__icon"
53
+ });
54
+ })();
55
+ }
56
+ }), null), v(o, d(C.span, {
57
+ class: "workbench-dock__tooltip",
58
+ get animate() {
59
+ return {
60
+ opacity: a() ? 1 : 0,
61
+ y: a() ? -6 : 0
62
+ };
63
+ },
64
+ get transition() {
65
+ return {
66
+ duration: L.fast,
67
+ easing: y.easeOut
68
+ };
69
+ },
70
+ get children() {
71
+ return e.label;
72
+ }
73
+ }), null), D((t) => {
74
+ var h = !!e.active, m = !!a(), f = !!e.isDragging, _ = `${e.label} — click to solo, drag to canvas to create`, b = e.active;
75
+ return h !== t.e && o.classList.toggle("is-active", t.e = h), m !== t.t && o.classList.toggle("is-hovered", t.t = m), f !== t.a && o.classList.toggle("is-source-dragging", t.a = f), _ !== t.o && S(o, "aria-label", t.o = _), b !== t.i && S(o, "aria-pressed", t.i = b), t;
76
+ }, {
77
+ e: void 0,
78
+ t: void 0,
79
+ a: void 0,
80
+ o: void 0,
81
+ i: void 0
82
+ }), o;
83
+ })();
84
+ }
85
+ function re(e) {
86
+ const [l, a] = O(null), [s, o] = O(null);
87
+ let t;
88
+ R(() => {
89
+ t?.abort(), t = void 0, s()?.stopInteraction();
90
+ });
91
+ const h = B(() => e.widgetDefinitions.every((i) => e.filters[i.type])), m = (i) => {
92
+ const r = l();
93
+ return r === null ? 0 : r === i ? -1 : r === i + 1 ? -2 : r === i - 1 ? 1 : 0;
94
+ }, f = (i) => {
95
+ const r = s();
96
+ if (!r) return;
97
+ const n = !r.moved;
98
+ if (r.stopInteraction(), o(null), t?.abort(), t = void 0, n) {
99
+ e.onSoloFilter(r.type);
100
+ return;
101
+ }
102
+ i && r.overCanvas && e.onCreateAt?.(r.type, r.clientX, r.clientY);
103
+ }, _ = (i, r, n, u) => {
104
+ i.preventDefault(), t?.abort(), o({
105
+ type: r,
106
+ label: n,
107
+ icon: u,
108
+ pointerId: i.pointerId,
109
+ startClientX: i.clientX,
110
+ startClientY: i.clientY,
111
+ clientX: i.clientX,
112
+ clientY: i.clientY,
113
+ moved: !1,
114
+ overCanvas: !1,
115
+ stopInteraction: z({
116
+ kind: "drag",
117
+ cursor: "grabbing"
118
+ })
119
+ });
120
+ const c = new AbortController();
121
+ t = c;
122
+ const k = (g) => {
123
+ o((w) => {
124
+ if (!w || w.pointerId !== g.pointerId) return w;
125
+ const Y = g.clientX - w.startClientX, M = g.clientY - w.startClientY, E = w.moved || Math.abs(Y) > x || Math.abs(M) > x;
126
+ return {
127
+ ...w,
128
+ clientX: g.clientX,
129
+ clientY: g.clientY,
130
+ moved: E,
131
+ overCanvas: E && j(g.clientX, g.clientY)
132
+ };
133
+ });
134
+ }, $ = (g) => {
135
+ g.pointerId === i.pointerId && f(!0);
136
+ }, A = (g) => {
137
+ g.pointerId === i.pointerId && f(!1);
138
+ };
139
+ window.addEventListener("pointermove", k, {
140
+ signal: c.signal
141
+ }), window.addEventListener("pointerup", $, {
142
+ signal: c.signal
143
+ }), window.addEventListener("pointercancel", A, {
144
+ signal: c.signal
145
+ });
146
+ }, b = () => s()?.type ?? null;
147
+ return [(() => {
148
+ var i = U(), r = i.firstChild;
149
+ return r.nextSibling, i.addEventListener("pointerleave", () => a(null)), r.$$click = () => e.onShowAll(), r.addEventListener("pointerleave", () => a((n) => n === 0 ? null : n)), r.addEventListener("pointerenter", () => a(0)), v(r, d(C.span, {
150
+ class: "workbench-dock__tile",
151
+ get animate() {
152
+ return {
153
+ scale: l() === 0 ? 1.26 : 1,
154
+ y: l() === 0 ? -6 : 0,
155
+ x: l() === 1 ? -5 : 0
156
+ };
157
+ },
158
+ get transition() {
159
+ return {
160
+ duration: L.fast,
161
+ easing: y.easeOut
162
+ };
163
+ },
164
+ get children() {
165
+ return d(G, {
166
+ class: "workbench-dock__icon"
167
+ });
168
+ }
169
+ }), null), v(r, d(C.span, {
170
+ class: "workbench-dock__tooltip",
171
+ get animate() {
172
+ return {
173
+ opacity: l() === 0 ? 1 : 0,
174
+ y: l() === 0 ? -6 : 0
175
+ };
176
+ },
177
+ get transition() {
178
+ return {
179
+ duration: L.fast,
180
+ easing: y.easeOut
181
+ };
182
+ },
183
+ children: "Show all widgets"
184
+ }), null), v(i, d(T, {
185
+ get each() {
186
+ return e.widgetDefinitions;
187
+ },
188
+ children: (n, u) => {
189
+ const c = () => u() + 1;
190
+ return d(p, {
191
+ get type() {
192
+ return n.type;
193
+ },
194
+ get label() {
195
+ return n.label;
196
+ },
197
+ get icon() {
198
+ return n.icon;
199
+ },
200
+ get active() {
201
+ return e.filters[n.type];
202
+ },
203
+ get hoverOffset() {
204
+ return m(c());
205
+ },
206
+ get isDragging() {
207
+ return b() === n.type;
208
+ },
209
+ onEnter: () => a(c()),
210
+ onLeave: () => a((k) => k === c() ? null : k),
211
+ onSolo: () => e.onSoloFilter(n.type),
212
+ onDragBegin: _
213
+ });
214
+ }
215
+ }), null), D((n) => {
216
+ var u = !!h(), c = l() === 0, k = h();
217
+ 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;
218
+ }, {
219
+ e: void 0,
220
+ t: void 0,
221
+ a: void 0
222
+ }), i;
223
+ })(), d(X, {
224
+ get when() {
225
+ return s()?.moved ?? !1;
226
+ },
227
+ get children() {
228
+ return d(J, {
229
+ state: s
230
+ });
231
+ }
232
+ })];
233
+ }
234
+ function J(e) {
235
+ const l = () => {
236
+ const t = e.state();
237
+ return t ? `translate3d(${t.clientX + 14}px, ${t.clientY - 56}px, 0)` : "translate3d(0px, 0px, 0)";
238
+ }, a = () => e.state()?.overCanvas ?? !1, s = () => e.state()?.label ?? "", o = () => e.state()?.icon;
239
+ return d(F, {
240
+ get children() {
241
+ var t = V(), h = t.firstChild, m = h.nextSibling, f = m.firstChild, _ = f.nextSibling, b = _.firstChild, i = b.nextSibling, r = i.firstChild;
242
+ return v(f, d(X, {
243
+ get when() {
244
+ return o();
245
+ },
246
+ children: (n) => {
247
+ const u = n();
248
+ return d(u, {
249
+ class: "w-4 h-4"
250
+ });
251
+ }
252
+ })), v(b, s), v(i, d(q, {
253
+ class: "w-3 h-3"
254
+ }), r), v(r, () => a() ? "Drop to create" : "Drag onto canvas"), D((n) => {
255
+ var u = !!a(), c = l();
256
+ return u !== n.e && t.classList.toggle("is-over-canvas", n.e = u), c !== n.t && H(t, "transform", n.t = c), n;
257
+ }, {
258
+ e: void 0,
259
+ t: void 0
260
+ }), t;
261
+ }
262
+ });
263
+ }
264
+ P(["pointerdown", "click"]);
265
+ export {
266
+ re as WorkbenchFilterBar
267
+ };
@@ -0,0 +1,6 @@
1
+ export interface WorkbenchHudProps {
2
+ scaleLabel: string;
3
+ onZoomOut: () => void;
4
+ onZoomIn: () => void;
5
+ }
6
+ export declare function WorkbenchHud(props: WorkbenchHudProps): import("solid-js").JSX.Element;
@@ -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,6 @@
1
+ export interface WorkbenchLockButtonProps {
2
+ locked: boolean;
3
+ onToggle: () => void;
4
+ shortcutLabel?: string;
5
+ }
6
+ export declare function WorkbenchLockButton(props: WorkbenchLockButtonProps): import("solid-js").JSX.Element;