@floegence/floe-webapp-core 0.36.15 → 0.36.16

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,54 +1,54 @@
1
- import { insert as c, createComponent as a, Portal as f, addEventListener as w, effect as v, className as h, template as d, delegateEvents as p } from "solid-js/web";
2
- import { createEffect as s, onCleanup as l, Show as k } from "solid-js";
3
- import { isTypingElement as W } from "../../utils/dom.js";
4
- import { clientToCanvasWorld as C } from "../ui/canvasGeometry.js";
5
- import { WorkbenchCanvas as b } from "./WorkbenchCanvas.js";
6
- import { WorkbenchContextMenu as A } from "./WorkbenchContextMenu.js";
7
- import { WorkbenchFilterBar as y } from "./WorkbenchFilterBar.js";
8
- import { WorkbenchHud as D } from "./WorkbenchHud.js";
9
- import { WorkbenchLockButton as S } from "./WorkbenchLockButton.js";
10
- import { installWorkbenchContextMenuDismissListeners as x } from "./workbenchContextMenuDismiss.js";
11
- import { useWorkbenchModel as M } from "./useWorkbenchModel.js";
12
- var F = /* @__PURE__ */ d("<div class=workbench-menu-backdrop data-floe-workbench-boundary=true>"), L = /* @__PURE__ */ d("<div><div class=workbench-surface__body data-floe-workbench-canvas-frame=true>");
13
- const R = "F1";
14
- function U(o) {
15
- const e = M({
16
- state: () => o.state(),
17
- setState: (t) => o.setState(t),
18
- widgetDefinitions: () => o.widgetDefinitions,
1
+ import { insert as c, createComponent as a, Portal as v, addEventListener as w, effect as h, className as k, setAttribute as p, template as g, delegateEvents as W } from "solid-js/web";
2
+ import { createEffect as s, onCleanup as u, Show as b } from "solid-js";
3
+ import { isTypingElement as C } from "../../utils/dom.js";
4
+ import { clientToCanvasWorld as A } from "../ui/canvasGeometry.js";
5
+ import { WorkbenchCanvas as D } from "./WorkbenchCanvas.js";
6
+ import { WorkbenchContextMenu as y } from "./WorkbenchContextMenu.js";
7
+ import { WorkbenchFilterBar as S } from "./WorkbenchFilterBar.js";
8
+ import { WorkbenchHud as x } from "./WorkbenchHud.js";
9
+ import { WorkbenchLockButton as M } from "./WorkbenchLockButton.js";
10
+ import { installWorkbenchContextMenuDismissListeners as F } from "./workbenchContextMenuDismiss.js";
11
+ import { useWorkbenchModel as R } from "./useWorkbenchModel.js";
12
+ var T = /* @__PURE__ */ g("<div class=workbench-menu-backdrop data-floe-workbench-boundary=true>"), L = /* @__PURE__ */ g("<div><div class=workbench-surface__body data-floe-workbench-canvas-frame=true>");
13
+ const E = "F1";
14
+ function H(i) {
15
+ const e = R({
16
+ state: () => i.state(),
17
+ setState: (t) => i.setState(t),
18
+ widgetDefinitions: () => i.widgetDefinitions,
19
19
  onClose: () => {
20
20
  }
21
21
  });
22
22
  s(() => {
23
- o.onApiReady?.({
23
+ i.onApiReady?.({
24
24
  ensureWidget: (t, r) => e.widgetActions.ensureWidget(t, r) ?? null,
25
25
  clearSelection: () => e.selection.clear(),
26
26
  focusWidget: (t, r) => e.navigation.focusWidget(t, r),
27
27
  fitWidget: (t) => e.navigation.fitWidget(t),
28
28
  overviewWidget: (t) => e.navigation.overviewWidget(t),
29
29
  findWidgetByType: (t) => e.queries.findWidgetByType(t)
30
- }), l(() => {
31
- o.onApiReady?.(null);
30
+ }), u(() => {
31
+ i.onApiReady?.(null);
32
32
  });
33
33
  });
34
- const u = () => o.lockShortcut === void 0 ? R : o.lockShortcut;
34
+ const l = () => i.lockShortcut === void 0 ? E : i.lockShortcut;
35
35
  s(() => {
36
36
  if (typeof window > "u" || !e.contextMenu.state()) return;
37
- const t = x({
37
+ const t = F({
38
38
  ownerWindow: window,
39
39
  onDismiss: e.contextMenu.close
40
40
  });
41
- l(() => t());
41
+ u(() => t());
42
42
  }), s(() => {
43
- if (o.enableKeyboard === !1 || typeof document > "u") return;
44
- const t = u(), r = (n) => {
43
+ if (i.enableKeyboard === !1 || typeof document > "u") return;
44
+ const t = l(), r = (n) => {
45
45
  if (n.defaultPrevented || n.isComposing) return;
46
46
  if (t !== null && n.key === t) {
47
47
  n.preventDefault(), e.lock.toggle();
48
48
  return;
49
49
  }
50
- const i = n.target;
51
- if (!(i instanceof Element && W(i)))
50
+ const o = n.target;
51
+ if (!(o instanceof Element && C(o)))
52
52
  switch (n.key) {
53
53
  case "ArrowUp":
54
54
  n.preventDefault(), e.navigation.handleArrowNavigation("up");
@@ -68,23 +68,23 @@ function U(o) {
68
68
  break;
69
69
  }
70
70
  };
71
- document.addEventListener("keydown", r, !0), l(() => document.removeEventListener("keydown", r, !0));
71
+ document.addEventListener("keydown", r, !0), u(() => document.removeEventListener("keydown", r, !0));
72
72
  });
73
- const g = (t, r) => {
73
+ const m = (t, r) => {
74
74
  const n = document.querySelector('[data-floe-workbench-canvas-frame="true"]');
75
75
  if (!n) return null;
76
- const i = n.getBoundingClientRect();
77
- return C(i, e.viewport(), {
76
+ const o = n.getBoundingClientRect();
77
+ return A(o, e.viewport(), {
78
78
  clientX: t,
79
79
  clientY: r
80
80
  });
81
- }, m = (t, r, n) => {
82
- const i = g(r, n);
83
- i && e.widgetActions.addWidgetAtCursor(t, i.worldX, i.worldY);
81
+ }, f = (t, r, n) => {
82
+ const o = m(r, n);
83
+ o && e.widgetActions.addWidgetAtCursor(t, o.worldX, o.worldY);
84
84
  };
85
85
  return (() => {
86
86
  var t = L(), r = t.firstChild;
87
- return c(r, a(b, {
87
+ return c(r, a(D, {
88
88
  get widgetDefinitions() {
89
89
  return e.widgetDefinitions();
90
90
  },
@@ -121,6 +121,9 @@ function U(o) {
121
121
  get onCanvasContextMenu() {
122
122
  return e.canvas.openCanvasContextMenu;
123
123
  },
124
+ get onCanvasPointerDown() {
125
+ return e.selection.clear;
126
+ },
124
127
  get onSelectWidget() {
125
128
  return e.canvas.selectWidget;
126
129
  },
@@ -139,10 +142,16 @@ function U(o) {
139
142
  get onCommitResize() {
140
143
  return e.canvas.commitResize;
141
144
  },
145
+ get onRequestOverview() {
146
+ return e.navigation.overviewWidget;
147
+ },
148
+ get onRequestFit() {
149
+ return e.navigation.fitWidget;
150
+ },
142
151
  get onRequestDelete() {
143
152
  return e.widgetActions.deleteWidget;
144
153
  }
145
- })), c(t, a(S, {
154
+ })), c(t, a(M, {
146
155
  get locked() {
147
156
  return e.locked();
148
157
  },
@@ -150,9 +159,9 @@ function U(o) {
150
159
  return e.lock.toggle;
151
160
  },
152
161
  get shortcutLabel() {
153
- return u() ?? void 0;
162
+ return l() ?? void 0;
154
163
  }
155
- }), null), c(t, a(y, {
164
+ }), null), c(t, a(S, {
156
165
  get widgetDefinitions() {
157
166
  return e.widgetDefinitions();
158
167
  },
@@ -168,8 +177,8 @@ function U(o) {
168
177
  get onShowAll() {
169
178
  return e.filter.showAll;
170
179
  },
171
- onCreateAt: m
172
- }), null), c(t, a(D, {
180
+ onCreateAt: f
181
+ }), null), c(t, a(x, {
173
182
  get scaleLabel() {
174
183
  return e.scaleLabel();
175
184
  },
@@ -178,18 +187,22 @@ function U(o) {
178
187
  },
179
188
  get onZoomIn() {
180
189
  return e.hud.zoomIn;
181
- }
182
- }), null), c(t, a(k, {
190
+ },
191
+ get activeTheme() {
192
+ return e.theme();
193
+ },
194
+ onSelectTheme: (n) => e.appearance.setTheme(n)
195
+ }), null), c(t, a(b, {
183
196
  get when() {
184
197
  return e.contextMenu.state();
185
198
  },
186
199
  get children() {
187
- return a(f, {
200
+ return a(v, {
188
201
  get children() {
189
202
  return [(() => {
190
- var n = F();
203
+ var n = T();
191
204
  return w(n, "contextmenu", e.contextMenu.retarget, !0), n;
192
- })(), a(A, {
205
+ })(), a(y, {
193
206
  get x() {
194
207
  return e.contextMenu.position()?.left ?? 0;
195
208
  },
@@ -203,10 +216,16 @@ function U(o) {
203
216
  }
204
217
  });
205
218
  }
206
- }), null), v(() => h(t, `workbench-surface${o.class ? ` ${o.class}` : ""}`)), t;
219
+ }), null), h((n) => {
220
+ var o = `workbench-surface${i.class ? ` ${i.class}` : ""}`, d = e.theme();
221
+ return o !== n.e && k(t, n.e = o), d !== n.t && p(t, "data-workbench-theme", n.t = d), n;
222
+ }, {
223
+ e: void 0,
224
+ t: void 0
225
+ }), t;
207
226
  })();
208
227
  }
209
- p(["contextmenu"]);
228
+ W(["contextmenu"]);
210
229
  export {
211
- U as WorkbenchSurface
230
+ H as WorkbenchSurface
212
231
  };
@@ -0,0 +1,6 @@
1
+ import { type WorkbenchThemeId } from './workbenchThemes';
2
+ export interface WorkbenchThemeSelectorProps {
3
+ activeTheme: WorkbenchThemeId;
4
+ onSelect: (id: WorkbenchThemeId) => void;
5
+ }
6
+ export declare function WorkbenchThemeSelector(props: WorkbenchThemeSelectorProps): import("solid-js").JSX.Element;
@@ -0,0 +1,77 @@
1
+ import { createComponent as l, insert as c, template as o, effect as $, setAttribute as k, setStyleProperty as h, delegateEvents as S } from "solid-js/web";
2
+ import { createMemo as u, For as T } from "solid-js";
3
+ import { Sparkles as C } from "../icons/index.js";
4
+ import { Dropdown as x } from "../ui/Dropdown.js";
5
+ import { workbenchThemeMeta as W, WORKBENCH_THEMES as E } from "./workbenchThemes.js";
6
+ var y = /* @__PURE__ */ o("<div class=workbench-theme-selector data-floe-canvas-interactive=true>"), L = /* @__PURE__ */ o("<span class=workbench-theme-selector__trigger-inner>"), M = /* @__PURE__ */ o('<div class=workbench-theme-grid role=radiogroup aria-label="Workbench theme"><div class=workbench-theme-grid__header>Workbench theme</div><div class=workbench-theme-grid__items>'), p = /* @__PURE__ */ o("<button type=button class=workbench-theme-tile role=radio><span class=workbench-theme-tile__canvas aria-hidden=true><span class=workbench-theme-tile__widget></span><span class=workbench-theme-tile__dot></span></span><span class=workbench-theme-tile__meta><span class=workbench-theme-tile__label></span><span class=workbench-theme-tile__description>");
7
+ function K(e) {
8
+ const r = u(() => W(e.activeTheme).label), a = u(() => [{
9
+ id: "theme-grid",
10
+ label: "Theme",
11
+ keepOpen: !0,
12
+ content: () => l(A, {
13
+ get activeTheme() {
14
+ return e.activeTheme;
15
+ },
16
+ onSelect: (i) => e.onSelect(i)
17
+ })
18
+ }]);
19
+ return (() => {
20
+ var i = y();
21
+ return c(i, l(x, {
22
+ get trigger() {
23
+ return (() => {
24
+ var n = L();
25
+ return c(n, l(C, {
26
+ class: "w-3.5 h-3.5"
27
+ })), n;
28
+ })();
29
+ },
30
+ get triggerAriaLabel() {
31
+ return `Workbench theme · ${r()}`;
32
+ },
33
+ triggerClass: "workbench-theme-selector__trigger",
34
+ get items() {
35
+ return a();
36
+ },
37
+ onSelect: () => {
38
+ },
39
+ align: "end"
40
+ })), i;
41
+ })();
42
+ }
43
+ function A(e) {
44
+ return (() => {
45
+ var r = M(), a = r.firstChild, i = a.nextSibling;
46
+ return c(i, l(T, {
47
+ each: E,
48
+ children: (n) => l(H, {
49
+ theme: n,
50
+ get active() {
51
+ return n.id === e.activeTheme;
52
+ },
53
+ onClick: () => e.onSelect(n.id)
54
+ })
55
+ })), r;
56
+ })();
57
+ }
58
+ function H(e) {
59
+ return (() => {
60
+ var r = p(), a = r.firstChild, i = a.firstChild, n = i.nextSibling, w = a.nextSibling, s = w.firstChild, f = s.nextSibling;
61
+ return r.$$click = () => e.onClick(), c(s, () => e.theme.label), c(f, () => e.theme.description), $((t) => {
62
+ var m = !!e.active, d = e.active, v = e.active, b = e.theme.preview.canvas, g = e.theme.preview.widget, _ = e.theme.preview.accent;
63
+ return m !== t.e && r.classList.toggle("is-active", t.e = m), d !== t.t && k(r, "aria-pressed", t.t = d), v !== t.a && k(r, "aria-checked", t.a = v), b !== t.o && h(a, "background", t.o = b), g !== t.i && h(i, "background", t.i = g), _ !== t.n && h(n, "background", t.n = _), t;
64
+ }, {
65
+ e: void 0,
66
+ t: void 0,
67
+ a: void 0,
68
+ o: void 0,
69
+ i: void 0,
70
+ n: void 0
71
+ }), r;
72
+ })();
73
+ }
74
+ S(["click"]);
75
+ export {
76
+ K as WorkbenchThemeSelector
77
+ };
@@ -32,6 +32,8 @@ export interface WorkbenchWidgetProps {
32
32
  width: number;
33
33
  height: number;
34
34
  }) => void;
35
+ onRequestOverview: (item: WorkbenchWidgetItem) => void;
36
+ onRequestFit: (item: WorkbenchWidgetItem) => void;
35
37
  onRequestDelete: (widgetId: string) => void;
36
38
  }
37
39
  export declare function WorkbenchWidget(props: WorkbenchWidgetProps): JSX.Element;