@floegence/floe-webapp-core 0.42.0 → 0.42.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.
@@ -1,71 +1,71 @@
1
- import { insert as w, createComponent as c, effect as A, setAttribute as M, memo as Q, className as Me, template as X, addEventListener as ge, Portal as xe, setStyleProperty as Xe, use as $e, delegateEvents as Ae } from "solid-js/web";
2
- import { createSignal as Z, onCleanup as G, createEffect as U, createMemo as H, Show as W, For as q } from "solid-js";
3
- import { Motion as F } 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 B } from "../../utils/animations.js";
5
- import { Plus as Fe } from "../icons/index.js";
6
- import { startHotInteraction as Ye } from "../../utils/hotInteraction.js";
1
+ import { insert as h, createComponent as c, effect as Y, setAttribute as y, memo as Z, className as Xe, template as X, addEventListener as ke, Portal as Ae, setStyleProperty as Ye, use as $e, delegateEvents as Fe } from "solid-js/web";
2
+ import { createSignal as ee, onCleanup as U, createEffect as q, createMemo as H, Show as W, For as z } from "solid-js";
3
+ import { Motion as $ } 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 F, duration as R } from "../../utils/animations.js";
5
+ import { Plus as Re } from "../icons/index.js";
6
+ import { startHotInteraction as pe } from "../../utils/hotInteraction.js";
7
7
  import { startPointerSession as Be } from "../ui/pointerSession.js";
8
8
  import { clientToCanvasWorld as He } from "../ui/canvasGeometry.js";
9
9
  import { createWorkbenchWidgetFrame as We } from "./workbenchHelpers.js";
10
- import { getWidgetEntry as pe } from "./widgets/widgetRegistry.js";
11
- import { WORKBENCH_EDGE_AUTO_PAN_FRAME_SELECTOR as he, frameFromElement as we, createWorkbenchEdgeAutoPanController as Re } from "./workbenchEdgeAutoPan.js";
12
- import { DockLayoutDashboard as Ke, DockLayers as Ne, DockRegion as Ve, DockText as Ge, DockMessageSquare as Ue } from "../icons/DockIcons.js";
13
- var qe = /* @__PURE__ */ X("<button type=button class=workbench-dock__item>"), ze = /* @__PURE__ */ X('<button type=button class="workbench-dock__item workbench-dock__action">'), je = /* @__PURE__ */ X('<div class=workbench-dock__mode-popover role=menu aria-label="Canvas mode">'), Je = /* @__PURE__ */ X("<span class=workbench-dock__external-placeholder aria-hidden=true>"), Qe = /* @__PURE__ */ X('<div data-floe-canvas-interactive=true><div class=workbench-dock__mode-switcher><button type=button class="workbench-dock__item workbench-dock__mode-trigger"aria-label="Switch canvas mode"aria-haspopup=menu></button></div><span class=workbench-dock__divider aria-hidden=true>'), Ze = /* @__PURE__ */ X("<button type=button class=workbench-dock__mode-option role=menuitemradio><span class=workbench-dock__mode-option-icon></span><span class=workbench-dock__mode-option-copy><span class=workbench-dock__mode-option-label></span><span class=workbench-dock__mode-option-description>"), et = /* @__PURE__ */ X("<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>");
14
- const ve = 5, tt = ".workbench-dock", ee = [{
10
+ import { getWidgetEntry as Ne } from "./widgets/widgetRegistry.js";
11
+ import { WORKBENCH_EDGE_AUTO_PAN_FRAME_SELECTOR as be, frameFromElement as _e, createWorkbenchEdgeAutoPanController as Ke } from "./workbenchEdgeAutoPan.js";
12
+ import { DockLayoutDashboard as Ve, DockLayers as Ge, DockRegion as Ue, DockText as qe, DockMessageSquare as ze } from "../icons/DockIcons.js";
13
+ var je = /* @__PURE__ */ X("<button type=button class=workbench-dock__item>"), Je = /* @__PURE__ */ X('<button type=button class="workbench-dock__item workbench-dock__action">'), Qe = /* @__PURE__ */ X('<div class=workbench-dock__mode-popover role=menu aria-label="Canvas mode">'), Ze = /* @__PURE__ */ X("<span class=workbench-dock__external-placeholder aria-hidden=true>"), et = /* @__PURE__ */ X('<div data-floe-canvas-interactive=true><div class=workbench-dock__mode-switcher><button type=button class="workbench-dock__item workbench-dock__mode-trigger"aria-label="Switch canvas mode"aria-haspopup=menu></button></div><span class=workbench-dock__divider aria-hidden=true>'), tt = /* @__PURE__ */ X("<button type=button class=workbench-dock__mode-option role=menuitemradio><span class=workbench-dock__mode-option-icon></span><span class=workbench-dock__mode-option-copy><span class=workbench-dock__mode-option-label></span><span class=workbench-dock__mode-option-description>"), nt = /* @__PURE__ */ X("<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>");
14
+ const fe = 5, ot = 1e3, rt = ".workbench-dock", te = [{
15
15
  mode: "work",
16
16
  label: "Work Mode",
17
17
  description: "Operate windows and sticky notes",
18
- icon: Ke
18
+ icon: Ve
19
19
  }, {
20
20
  mode: "background",
21
21
  label: "Composition Mode",
22
22
  description: "Arrange regions and canvas text",
23
- icon: Ne
24
- }], nt = [{
23
+ icon: Ge
24
+ }], it = [{
25
25
  tool: "sticky-note",
26
26
  label: "Sticky",
27
- icon: Ue
28
- }], ot = [{
27
+ icon: ze
28
+ }], at = [{
29
29
  tool: "background-region",
30
30
  label: "Region",
31
- icon: Ve
31
+ icon: Ue
32
32
  }, {
33
33
  tool: "text",
34
34
  label: "Text",
35
- icon: Ge
35
+ icon: qe
36
36
  }];
37
- function rt(e) {
38
- const a = e?.closest(".workbench-surface")?.querySelector(he);
39
- return a instanceof HTMLElement ? we(a) : null;
37
+ function lt(e) {
38
+ const a = e?.closest(".workbench-surface")?.querySelector(be);
39
+ return a instanceof HTMLElement ? _e(a) : null;
40
40
  }
41
- function te(e, s, a) {
41
+ function ne(e, s, a) {
42
42
  return e >= a.left && e <= a.right && s >= a.top && s <= a.bottom;
43
43
  }
44
- function it(e, s, a) {
45
- return a ? te(e, s, a) : !1;
44
+ function ct(e, s, a) {
45
+ return a ? ne(e, s, a) : !1;
46
46
  }
47
- function ke(e, s, a) {
47
+ function me(e, s, a) {
48
48
  return Math.min(a, Math.max(s, e));
49
49
  }
50
- function at(e, s, a, l, r) {
50
+ function st(e, s, a, l, r) {
51
51
  if (!e) return !1;
52
- if (te(s, a, e) || te(l, r, e))
52
+ if (ne(s, a, e) || ne(l, r, e))
53
53
  return !0;
54
54
  const i = l - s, D = r - a;
55
55
  let v = 0, E = 1;
56
- const u = (b, C) => {
56
+ const g = (b, C) => {
57
57
  if (b === 0) return C >= 0;
58
58
  const k = C / b;
59
59
  return b < 0 ? k > E ? !1 : (k > v && (v = k), !0) : k < v ? !1 : (k < E && (E = k), !0);
60
60
  };
61
- return u(-i, s - e.left) && u(i, e.right - s) && u(-D, a - e.top) && u(D, e.bottom - a);
61
+ return g(-i, s - e.left) && g(i, e.right - s) && g(-D, a - e.top) && g(D, e.bottom - a);
62
62
  }
63
- function fe(e, s, a) {
63
+ function we(e, s, a) {
64
64
  if (!a || typeof document.elementFromPoint != "function") return !1;
65
65
  const l = document.elementFromPoint(e, s);
66
- return l instanceof Element && l.closest(tt) === a;
66
+ return l instanceof Element && l.closest(rt) === a;
67
67
  }
68
- function me(e) {
68
+ function he(e) {
69
69
  const s = () => e.hoverOffset === -1 ? {
70
70
  scale: 1.26,
71
71
  y: -6,
@@ -86,16 +86,16 @@ function me(e) {
86
86
  r.button === 0 && e.onDragBegin(r, e.kind, e.id, e.label, e.icon, r.currentTarget, e.canvasPlacement, null);
87
87
  };
88
88
  return (() => {
89
- var r = qe();
90
- return r.$$pointerdown = l, r.addEventListener("pointerleave", () => e.onLeave()), r.addEventListener("pointerenter", () => e.onEnter()), w(r, c(F.span, {
89
+ var r = je();
90
+ return r.$$pointerdown = l, r.addEventListener("pointerleave", () => e.onLeave()), r.addEventListener("pointerenter", () => e.onEnter()), h(r, c($.span, {
91
91
  class: "workbench-dock__tile",
92
92
  get animate() {
93
93
  return s();
94
94
  },
95
95
  get transition() {
96
96
  return {
97
- duration: B.fast,
98
- easing: Y.easeOut
97
+ duration: R.fast,
98
+ easing: F.easeOut
99
99
  };
100
100
  },
101
101
  get children() {
@@ -106,7 +106,7 @@ function me(e) {
106
106
  });
107
107
  })();
108
108
  }
109
- }), null), w(r, c(F.span, {
109
+ }), null), h(r, c($.span, {
110
110
  class: "workbench-dock__tooltip",
111
111
  get animate() {
112
112
  return {
@@ -116,16 +116,16 @@ function me(e) {
116
116
  },
117
117
  get transition() {
118
118
  return {
119
- duration: B.fast,
120
- easing: Y.easeOut
119
+ duration: R.fast,
120
+ easing: F.easeOut
121
121
  };
122
122
  },
123
123
  get children() {
124
124
  return e.label;
125
125
  }
126
- }), null), A((i) => {
127
- var D = e.kind === "host" ? e.id : void 0, v = !!e.active, E = !!(e.filterable && !e.visible), u = !!a(), b = !!e.isDragging, C = e.filterable ? `${e.label} — click to solo, drag to canvas to create` : `${e.label} — drag to canvas to create`, k = e.active;
128
- return D !== i.e && M(r, "data-workbench-dock-item", i.e = D), v !== i.t && r.classList.toggle("is-active", i.t = v), E !== i.a && r.classList.toggle("is-filter-muted", i.a = E), u !== i.o && r.classList.toggle("is-hovered", i.o = u), b !== i.i && r.classList.toggle("is-source-dragging", i.i = b), C !== i.n && M(r, "aria-label", i.n = C), k !== i.s && M(r, "aria-pressed", i.s = k), i;
126
+ }), null), Y((i) => {
127
+ var D = e.kind === "host" ? e.id : void 0, v = !!e.active, E = !!(e.filterable && !e.visible), g = !!a(), b = !!e.isDragging, C = e.filterable ? `${e.label} — click to solo, drag to canvas to create` : `${e.label} — drag to canvas to create`, k = e.active;
128
+ return D !== i.e && y(r, "data-workbench-dock-item", i.e = D), v !== i.t && r.classList.toggle("is-active", i.t = v), E !== i.a && r.classList.toggle("is-filter-muted", i.a = E), g !== i.o && r.classList.toggle("is-hovered", i.o = g), b !== i.i && r.classList.toggle("is-source-dragging", i.i = b), C !== i.n && y(r, "aria-label", i.n = C), k !== i.s && y(r, "aria-pressed", i.s = k), i;
129
129
  }, {
130
130
  e: void 0,
131
131
  t: void 0,
@@ -137,23 +137,23 @@ function me(e) {
137
137
  }), r;
138
138
  })();
139
139
  }
140
- function lt(e) {
140
+ function dt(e) {
141
141
  const s = () => e.hoverOffset === -1, a = () => ({
142
142
  scale: 1,
143
143
  y: 0,
144
144
  x: 0
145
145
  }), l = e.action.icon;
146
146
  return (() => {
147
- var r = ze();
148
- return r.$$click = (i) => e.action.onActivate(i.currentTarget), r.addEventListener("dragstart", (i) => i.preventDefault()), ge(r, "pointerleave", e.onLeave), ge(r, "pointerenter", e.onEnter), M(r, "draggable", !1), w(r, c(F.span, {
147
+ var r = Je();
148
+ return r.$$click = (i) => e.action.onActivate(i.currentTarget), r.addEventListener("dragstart", (i) => i.preventDefault()), ke(r, "pointerleave", e.onLeave), ke(r, "pointerenter", e.onEnter), y(r, "draggable", !1), h(r, c($.span, {
149
149
  class: "workbench-dock__tile",
150
150
  get animate() {
151
151
  return a();
152
152
  },
153
153
  get transition() {
154
154
  return {
155
- duration: B.fast,
156
- easing: Y.easeOut
155
+ duration: R.fast,
156
+ easing: F.easeOut
157
157
  };
158
158
  },
159
159
  get children() {
@@ -161,7 +161,7 @@ function lt(e) {
161
161
  class: "workbench-dock__icon"
162
162
  });
163
163
  }
164
- }), null), w(r, c(F.span, {
164
+ }), null), h(r, c($.span, {
165
165
  class: "workbench-dock__tooltip",
166
166
  get animate() {
167
167
  return {
@@ -171,16 +171,16 @@ function lt(e) {
171
171
  },
172
172
  get transition() {
173
173
  return {
174
- duration: B.fast,
175
- easing: Y.easeOut
174
+ duration: R.fast,
175
+ easing: F.easeOut
176
176
  };
177
177
  },
178
178
  get children() {
179
179
  return e.action.label;
180
180
  }
181
- }), null), A((i) => {
182
- var D = e.action.id, v = !!e.action.active, E = !!s(), u = e.action.label, b = e.action.active;
183
- return D !== i.e && M(r, "data-workbench-dock-action", i.e = D), v !== i.t && r.classList.toggle("is-active", i.t = v), E !== i.a && r.classList.toggle("is-hovered", i.a = E), u !== i.o && M(r, "aria-label", i.o = u), b !== i.i && M(r, "aria-pressed", i.i = b), i;
181
+ }), null), Y((i) => {
182
+ var D = e.action.id, v = !!e.action.active, E = !!s(), g = e.action.label, b = e.action.active;
183
+ return D !== i.e && y(r, "data-workbench-dock-action", i.e = D), v !== i.t && r.classList.toggle("is-active", i.t = v), E !== i.a && r.classList.toggle("is-hovered", i.a = E), g !== i.o && y(r, "aria-label", i.o = g), b !== i.i && y(r, "aria-pressed", i.i = b), i;
184
184
  }, {
185
185
  e: void 0,
186
186
  t: void 0,
@@ -190,45 +190,45 @@ function lt(e) {
190
190
  }), r;
191
191
  })();
192
192
  }
193
- function Et(e) {
194
- const [s, a] = Z(null), [l, r] = Z(null), [i, D] = Z(!1);
195
- let v, E, u, b, C = null;
196
- G(() => {
193
+ function Pt(e) {
194
+ const [s, a] = ee(null), [l, r] = ee(null), [i, D] = ee(!1);
195
+ let v, E, g, b, C = null;
196
+ U(() => {
197
197
  b?.stop(), E?.stop({
198
198
  reason: "manual_stop",
199
199
  commit: !1
200
- }), E = void 0, u?.(), u = void 0, l()?.stopInteraction(), e.onDragPreviewChange?.(null), e.registerExternalDockDragController?.(null);
201
- }), U(() => {
200
+ }), E = void 0, g?.clear(), g = void 0, l()?.stopInteraction(), e.onDragPreviewChange?.(null), e.registerExternalDockDragController?.(null);
201
+ }), q(() => {
202
202
  e.onDragPreviewChange?.(l()?.preview ?? null);
203
- }), U(() => {
203
+ }), q(() => {
204
204
  const t = (n) => {
205
205
  n.key !== "Escape" || !l() || (n.preventDefault(), E?.stop({
206
206
  reason: "manual_stop",
207
207
  commit: !1
208
208
  }));
209
209
  };
210
- window.addEventListener("keydown", t, !0), G(() => window.removeEventListener("keydown", t, !0));
211
- }), U(() => {
210
+ window.addEventListener("keydown", t, !0), U(() => window.removeEventListener("keydown", t, !0));
211
+ }), q(() => {
212
212
  if (!i() || typeof window > "u") return;
213
213
  const t = (f) => {
214
214
  v && f.target instanceof Node && v.contains(f.target) || D(!1);
215
215
  }, n = (f) => {
216
216
  f.key === "Escape" && D(!1);
217
217
  };
218
- window.addEventListener("pointerdown", t, !0), window.addEventListener("keydown", n, !0), G(() => {
218
+ window.addEventListener("pointerdown", t, !0), window.addEventListener("keydown", n, !0), U(() => {
219
219
  window.removeEventListener("pointerdown", t, !0), window.removeEventListener("keydown", n, !0);
220
220
  });
221
221
  });
222
222
  const k = (t) => {
223
223
  const n = s();
224
- return n === null || n <= R().length ? 0 : n === t ? -1 : n === t + 1 ? -2 : n === t - 1 ? 1 : 0;
225
- }, $ = () => {
224
+ return n === null || n <= K().length ? 0 : n === t ? -1 : n === t + 1 ? -2 : n === t - 1 ? 1 : 0;
225
+ }, A = () => {
226
226
  b?.stop(), b = void 0, C = null;
227
- }, p = () => {
228
- !e.viewport || !e.onViewportCommit || (C = e.viewport, b?.stop(), b = Re({
227
+ }, N = () => {
228
+ !e.viewport || !e.onViewportCommit || (C = e.viewport, b?.stop(), b = Ke({
229
229
  readFrame: () => {
230
- const n = v?.closest(".workbench-surface")?.querySelector(he);
231
- return n instanceof HTMLElement ? we(n) : null;
230
+ const n = v?.closest(".workbench-surface")?.querySelector(be);
231
+ return n instanceof HTMLElement ? _e(n) : null;
232
232
  },
233
233
  readViewport: () => C ?? e.viewport ?? null,
234
234
  commitViewport: (t) => {
@@ -237,14 +237,14 @@ function Et(e) {
237
237
  onPanStart: () => e.onViewportInteractionStart?.("pan"),
238
238
  shouldPan: () => {
239
239
  const t = l();
240
- return !!(t?.moved && t.hasEnteredCanvas && !fe(t.clientX, t.clientY, v));
240
+ return !!(t?.moved && t.hasEnteredCanvas && !we(t.clientX, t.clientY, v));
241
241
  }
242
242
  }));
243
- }, be = (t) => {
243
+ }, Ee = (t) => {
244
244
  const n = l();
245
245
  if (!n) return;
246
246
  const f = !n.moved, P = C ?? e.viewport;
247
- if (n.stopInteraction(), $(), r(null), E = void 0, f) {
247
+ if (n.stopInteraction(), A(), r(null), E = void 0, n.kind === "external" && n.moved && g?.expire(), f) {
248
248
  if (n.kind === "external" || !(n.trigger instanceof HTMLButtonElement)) return;
249
249
  if (n.kind === "host") {
250
250
  e.dockItems?.find((o) => o.id === n.id)?.onActivate?.(n.trigger);
@@ -256,7 +256,7 @@ function Et(e) {
256
256
  label: n.label,
257
257
  trigger: n.trigger
258
258
  })) return;
259
- I() !== "background" && e.onSoloFilter(String(n.id), ae());
259
+ O() !== "background" && e.onSoloFilter(String(n.id), le());
260
260
  return;
261
261
  }
262
262
  if (t && n.overDock && n.dockDrop) {
@@ -276,12 +276,12 @@ function Et(e) {
276
276
  } : void 0;
277
277
  n.canvasPlacement.onDrop(n.clientX, n.clientY, o);
278
278
  }
279
- }, z = (t, n, f, P, S, o, _, h) => {
279
+ }, j = (t, n, f, P, S, o, _, w) => {
280
280
  t.preventDefault(), E?.stop({
281
281
  reason: "manual_stop",
282
282
  commit: !1
283
- }), p();
284
- const g = rt(v);
283
+ }), N();
284
+ const u = lt(v);
285
285
  r({
286
286
  kind: n,
287
287
  id: f,
@@ -295,11 +295,11 @@ function Et(e) {
295
295
  moved: !1,
296
296
  overCanvas: !1,
297
297
  hasEnteredCanvas: !1,
298
- canvasFrame: g,
298
+ canvasFrame: u,
299
299
  preview: null,
300
300
  canvasPlacement: _,
301
- dockDrop: h,
302
- stopInteraction: Ye({
301
+ dockDrop: w,
302
+ stopInteraction: pe({
303
303
  kind: "drag",
304
304
  cursor: "grabbing"
305
305
  }),
@@ -310,39 +310,40 @@ function Et(e) {
310
310
  let T = !1;
311
311
  r((m) => {
312
312
  if (!m || m.pointerId !== d.pointerId) return m;
313
- const x = d.clientX - m.startClientX, K = d.clientY - m.startClientY, y = m.moved || Math.abs(x) > ve || Math.abs(K) > ve;
314
- if (m.kind === "external" && y && !m.moved) {
315
- const de = (ue) => {
316
- ue.preventDefault(), ue.stopImmediatePropagation(), u?.();
317
- }, ye = window.setTimeout(() => {
318
- u === V && V();
319
- }, 0), V = () => {
320
- window.clearTimeout(ye), m.trigger.removeEventListener("click", de, !0), u === V && (u = void 0);
313
+ const M = d.clientX - m.startClientX, V = d.clientY - m.startClientY, x = m.moved || Math.abs(M) > fe || Math.abs(V) > fe;
314
+ if (m.kind === "external" && x && !m.moved) {
315
+ let p;
316
+ const B = () => {
317
+ p !== void 0 && window.clearTimeout(p), m.trigger.removeEventListener("click", ue, !0), window.removeEventListener("pointerdown", ge, !0), g?.clear === B && (g = void 0);
318
+ }, ue = (ve) => {
319
+ ve.preventDefault(), ve.stopImmediatePropagation(), B();
320
+ }, ge = () => B(), Me = () => {
321
+ p !== void 0 && window.clearTimeout(p), p = window.setTimeout(B, ot);
322
+ };
323
+ m.trigger.addEventListener("click", ue, !0), window.addEventListener("pointerdown", ge, !0), g = {
324
+ clear: B,
325
+ expire: Me
321
326
  };
322
- m.trigger.addEventListener("click", de, {
323
- capture: !0,
324
- once: !0
325
- }), u = V;
326
327
  }
327
- const N = fe(d.clientX, d.clientY, v), O = m.canvasFrame, le = y && it(d.clientX, d.clientY, O), ce = le && !N, Oe = y && !N && at(O, m.clientX, m.clientY, d.clientX, d.clientY), se = m.hasEnteredCanvas || le || Oe;
328
- T = y && se && !N;
329
- const Ie = O ? ke(d.clientX, O.left, O.right) : d.clientX, Te = O ? ke(d.clientY, O.top, O.bottom) : d.clientY;
328
+ const G = we(d.clientX, d.clientY, v), I = m.canvasFrame, ce = x && ct(d.clientX, d.clientY, I), se = ce && !G, Te = x && !G && st(I, m.clientX, m.clientY, d.clientX, d.clientY), de = m.hasEnteredCanvas || ce || Te;
329
+ T = x && de && !G;
330
+ const xe = I ? me(d.clientX, I.left, I.right) : d.clientX, ye = I ? me(d.clientY, I.top, I.bottom) : d.clientY;
330
331
  return {
331
332
  ...m,
332
333
  clientX: d.clientX,
333
334
  clientY: d.clientY,
334
- moved: y,
335
- overDock: N,
336
- overCanvas: ce,
337
- hasEnteredCanvas: se,
338
- preview: y && O && m.canvasPlacement?.preview ? {
335
+ moved: x,
336
+ overDock: G,
337
+ overCanvas: se,
338
+ hasEnteredCanvas: de,
339
+ preview: x && I && m.canvasPlacement?.preview ? {
339
340
  kind: m.canvasPlacement.preview.kind,
340
341
  id: m.canvasPlacement.preview.id,
341
342
  label: m.label,
342
- clientX: Ie,
343
- clientY: Te,
344
- dropAllowed: ce,
345
- canvasFrame: O
343
+ clientX: xe,
344
+ clientY: ye,
345
+ dropAllowed: se,
346
+ canvasFrame: I
346
347
  } : null
347
348
  };
348
349
  }), T && b?.updatePointer(d.clientX, d.clientY);
@@ -359,17 +360,17 @@ function Et(e) {
359
360
  pointerId: T.pointerId,
360
361
  clientX: T.latestClientX,
361
362
  clientY: T.latestClientY
362
- }), be(d);
363
+ }), Ee(d);
363
364
  }
364
365
  });
365
- }, ne = (t) => t ? {
366
+ }, oe = (t) => t ? {
366
367
  preview: {
367
368
  kind: "widget",
368
369
  id: t.widgetType
369
370
  },
370
371
  onDrop: (n, f, P) => {
371
372
  if (!P?.worldPoint) return;
372
- const S = pe(t.widgetType, e.widgetDefinitions);
373
+ const S = Ne(t.widgetType, e.widgetDefinitions);
373
374
  t.onDrop({
374
375
  widgetType: t.widgetType,
375
376
  centerWorld: P.worldPoint,
@@ -380,20 +381,20 @@ function Et(e) {
380
381
  })
381
382
  });
382
383
  }
383
- } : null, _e = (t, n) => {
384
- t.button !== 0 || !(t.currentTarget instanceof HTMLElement) || (u?.(), u = void 0, z(t, "external", n.id, n.label, n.icon, t.currentTarget, ne(n.canvasPlacement), n.onDropToDock ?? null));
384
+ } : null, De = (t, n) => {
385
+ t.button !== 0 || !(t.currentTarget instanceof HTMLElement) || (g?.clear(), g = void 0, j(t, "external", n.id, n.label, n.icon, t.currentTarget, oe(n.canvasPlacement), n.onDropToDock ?? null));
385
386
  };
386
- U(() => {
387
+ q(() => {
387
388
  e.registerExternalDockDragController?.({
388
- begin: _e
389
- }), G(() => e.registerExternalDockDragController?.(null));
389
+ begin: De
390
+ }), U(() => e.registerExternalDockDragController?.(null));
390
391
  });
391
- const Ee = () => l()?.kind === "widget" ? l().id : null, De = () => l()?.kind === "tool" ? l().id : null, Ce = () => l()?.kind === "external" ? l()?.icon : void 0, I = () => e.mode === "background" || e.mode === "annotation" ? "background" : "work", oe = H(() => ee.find((t) => t.mode === I()) ?? ee[0]), re = H(() => I() === "background" ? ot.map((t) => ({
392
+ const Ce = () => l()?.kind === "widget" ? l().id : null, Pe = () => l()?.kind === "tool" ? l().id : null, Le = () => l()?.kind === "external" ? l()?.icon : void 0, O = () => e.mode === "background" || e.mode === "annotation" ? "background" : "work", re = H(() => te.find((t) => t.mode === O()) ?? te[0]), ie = H(() => O() === "background" ? at.map((t) => ({
392
393
  id: t.tool,
393
394
  kind: "tool",
394
395
  label: t.label,
395
396
  icon: t.icon
396
- })) : [...nt.map((t) => ({
397
+ })) : [...it.map((t) => ({
397
398
  id: t.tool,
398
399
  kind: "tool",
399
400
  label: t.label,
@@ -403,123 +404,123 @@ function Et(e) {
403
404
  kind: "widget",
404
405
  label: t.label,
405
406
  icon: t.icon
406
- }))]), ie = H(() => I() === "background" ? [] : [...e.dockItems ?? []]), R = H(() => I() === "background" ? [] : [...e.dockActions ?? []]), ae = H(() => re().map((t) => String(t.id))), j = () => I() !== "background", Pe = (t) => !j() || e.filters[t] !== !1, Le = (t) => {
407
- if (!j())
407
+ }))]), ae = H(() => O() === "background" ? [] : [...e.dockItems ?? []]), K = H(() => O() === "background" ? [] : [...e.dockActions ?? []]), le = H(() => ie().map((t) => String(t.id))), J = () => O() !== "background", Se = (t) => !J() || e.filters[t] !== !1, Ie = (t) => {
408
+ if (!J())
408
409
  return !1;
409
- const n = ae();
410
+ const n = le();
410
411
  return n.length > 1 && n.every((f) => e.filters[f] !== !1 == (f === t));
411
- }, J = () => s() === 0, Se = () => ({
412
+ }, Q = () => s() === 0, Oe = () => ({
412
413
  scale: 1,
413
414
  y: 0,
414
415
  x: 0
415
416
  });
416
417
  return [(() => {
417
- var t = Qe(), n = t.firstChild, f = n.firstChild, P = n.nextSibling;
418
+ var t = et(), n = t.firstChild, f = n.firstChild, P = n.nextSibling;
418
419
  t.addEventListener("pointerleave", () => a(null));
419
420
  var S = v;
420
- return typeof S == "function" ? $e(S, t) : v = t, f.$$click = () => D((o) => !o), f.addEventListener("pointerleave", () => a((o) => o === 0 ? null : o)), f.addEventListener("pointerenter", () => a(0)), w(f, c(F.span, {
421
+ return typeof S == "function" ? $e(S, t) : v = t, f.$$click = () => D((o) => !o), f.addEventListener("pointerleave", () => a((o) => o === 0 ? null : o)), f.addEventListener("pointerenter", () => a(0)), h(f, c($.span, {
421
422
  class: "workbench-dock__tile",
422
423
  get animate() {
423
- return Se();
424
+ return Oe();
424
425
  },
425
426
  get transition() {
426
427
  return {
427
- duration: B.fast,
428
- easing: Y.easeOut
428
+ duration: R.fast,
429
+ easing: F.easeOut
429
430
  };
430
431
  },
431
432
  get children() {
432
433
  return (() => {
433
- const o = oe().icon;
434
+ const o = re().icon;
434
435
  return c(o, {
435
436
  class: "workbench-dock__icon"
436
437
  });
437
438
  })();
438
439
  }
439
- }), null), w(f, c(F.span, {
440
+ }), null), h(f, c($.span, {
440
441
  class: "workbench-dock__tooltip",
441
442
  get animate() {
442
443
  return {
443
- opacity: J() && !i() ? 1 : 0,
444
- y: J() && !i() ? -6 : 0
444
+ opacity: Q() && !i() ? 1 : 0,
445
+ y: Q() && !i() ? -6 : 0
445
446
  };
446
447
  },
447
448
  get transition() {
448
449
  return {
449
- duration: B.fast,
450
- easing: Y.easeOut
450
+ duration: R.fast,
451
+ easing: F.easeOut
451
452
  };
452
453
  },
453
454
  get children() {
454
- return oe().label;
455
+ return re().label;
455
456
  }
456
- }), null), w(n, c(W, {
457
+ }), null), h(n, c(W, {
457
458
  get when() {
458
459
  return i();
459
460
  },
460
461
  get children() {
461
- var o = je();
462
- return w(o, c(q, {
463
- each: ee,
462
+ var o = Qe();
463
+ return h(o, c(z, {
464
+ each: te,
464
465
  children: (_) => {
465
- const h = _.icon;
466
+ const w = _.icon;
466
467
  return (() => {
467
- var g = Ze(), L = g.firstChild, d = L.nextSibling, T = d.firstChild, m = T.nextSibling;
468
- return g.$$click = () => {
468
+ var u = tt(), L = u.firstChild, d = L.nextSibling, T = d.firstChild, m = T.nextSibling;
469
+ return u.$$click = () => {
469
470
  e.onSelectMode?.(_.mode), D(!1);
470
- }, w(L, c(h, {
471
+ }, h(L, c(w, {
471
472
  class: "workbench-dock__mode-icon"
472
- })), w(T, () => _.label), w(m, () => _.description), A((x) => {
473
- var K = I() === _.mode, y = I() === _.mode;
474
- return K !== x.e && g.classList.toggle("is-active", x.e = K), y !== x.t && M(g, "aria-checked", x.t = y), x;
473
+ })), h(T, () => _.label), h(m, () => _.description), Y((M) => {
474
+ var V = O() === _.mode, x = O() === _.mode;
475
+ return V !== M.e && u.classList.toggle("is-active", M.e = V), x !== M.t && y(u, "aria-checked", M.t = x), M;
475
476
  }, {
476
477
  e: void 0,
477
478
  t: void 0
478
- }), g;
479
+ }), u;
479
480
  })();
480
481
  }
481
482
  })), o;
482
483
  }
483
- }), null), w(t, c(q, {
484
+ }), null), h(t, c(z, {
484
485
  get each() {
485
- return R();
486
+ return K();
486
487
  },
487
488
  children: (o, _) => {
488
- const h = () => _() + 1;
489
- return c(lt, {
489
+ const w = () => _() + 1;
490
+ return c(dt, {
490
491
  action: o,
491
492
  get hoverOffset() {
492
- return k(h());
493
+ return k(w());
493
494
  },
494
- onEnter: () => a(h()),
495
- onLeave: () => a((g) => g === h() ? null : g)
495
+ onEnter: () => a(w()),
496
+ onLeave: () => a((u) => u === w() ? null : u)
496
497
  });
497
498
  }
498
- }), P), w(t, c(W, {
499
+ }), P), h(t, c(W, {
499
500
  get when() {
500
501
  return !!(l()?.kind === "external" && l()?.moved);
501
502
  },
502
503
  get children() {
503
- var o = Je();
504
- return w(o, c(W, {
504
+ var o = Ze();
505
+ return h(o, c(W, {
505
506
  get when() {
506
- return Ce();
507
+ return Le();
507
508
  },
508
509
  children: (_) => {
509
- const h = _();
510
- return c(h, {
510
+ const w = _();
511
+ return c(w, {
511
512
  class: "workbench-dock__icon"
512
513
  });
513
514
  }
514
- })), A(() => o.classList.toggle("is-drop-allowed", !!l()?.overDock)), o;
515
+ })), Y(() => o.classList.toggle("is-drop-allowed", !!l()?.overDock)), o;
515
516
  }
516
- }), P), w(t, c(q, {
517
+ }), P), h(t, c(z, {
517
518
  get each() {
518
- return ie();
519
+ return ae();
519
520
  },
520
521
  children: (o, _) => {
521
- const h = () => _() + R().length + 1;
522
- return c(me, {
522
+ const w = () => _() + K().length + 1;
523
+ return c(he, {
523
524
  get id() {
524
525
  return o.id;
525
526
  },
@@ -536,26 +537,26 @@ function Et(e) {
536
537
  visible: !0,
537
538
  filterable: !1,
538
539
  get hoverOffset() {
539
- return k(h());
540
+ return k(w());
540
541
  },
541
542
  get isDragging() {
542
- return Q(() => l()?.kind === "host")() && l()?.id === o.id;
543
+ return Z(() => l()?.kind === "host")() && l()?.id === o.id;
543
544
  },
544
545
  get canvasPlacement() {
545
- return ne(o.canvasPlacement);
546
+ return oe(o.canvasPlacement);
546
547
  },
547
- onEnter: () => a(h()),
548
- onLeave: () => a((g) => g === h() ? null : g),
549
- onDragBegin: z
548
+ onEnter: () => a(w()),
549
+ onLeave: () => a((u) => u === w() ? null : u),
550
+ onDragBegin: j
550
551
  });
551
552
  }
552
- }), P), w(t, c(q, {
553
+ }), P), h(t, c(z, {
553
554
  get each() {
554
- return re();
555
+ return ie();
555
556
  },
556
557
  children: (o, _) => {
557
- const h = () => _() + R().length + ie().length + 1;
558
- return c(me, {
558
+ const w = () => _() + K().length + ae().length + 1;
559
+ return c(he, {
559
560
  get id() {
560
561
  return String(o.id);
561
562
  },
@@ -569,43 +570,43 @@ function Et(e) {
569
570
  return o.icon;
570
571
  },
571
572
  get active() {
572
- return Le(String(o.id));
573
+ return Ie(String(o.id));
573
574
  },
574
575
  get visible() {
575
- return Pe(String(o.id));
576
+ return Se(String(o.id));
576
577
  },
577
578
  get filterable() {
578
- return j();
579
+ return J();
579
580
  },
580
581
  get hoverOffset() {
581
- return k(h());
582
+ return k(w());
582
583
  },
583
584
  get isDragging() {
584
- return Q(() => o.kind === "widget")() ? Ee() === o.id : De() === o.id;
585
+ return Z(() => o.kind === "widget")() ? Ce() === o.id : Pe() === o.id;
585
586
  },
586
587
  get canvasPlacement() {
587
- return Q(() => o.kind === "widget")() ? {
588
+ return Z(() => o.kind === "widget")() ? {
588
589
  preview: {
589
590
  kind: "widget",
590
591
  id: o.id
591
592
  },
592
- onDrop: (g, L, d) => e.onCreateAt?.(o.id, g, L, d)
593
+ onDrop: (u, L, d) => e.onCreateAt?.(o.id, u, L, d)
593
594
  } : {
594
595
  preview: {
595
596
  kind: "tool",
596
597
  id: o.id
597
598
  },
598
- onDrop: (g, L, d) => e.onCreateToolAt?.(o.id, g, L, d)
599
+ onDrop: (u, L, d) => e.onCreateToolAt?.(o.id, u, L, d)
599
600
  };
600
601
  },
601
- onEnter: () => a(h()),
602
- onLeave: () => a((g) => g === h() ? null : g),
603
- onDragBegin: z
602
+ onEnter: () => a(w()),
603
+ onLeave: () => a((u) => u === w() ? null : u),
604
+ onDragBegin: j
604
605
  });
605
606
  }
606
- }), null), A((o) => {
607
- var _ = `workbench-dock workbench-dock-material${l()?.kind === "external" && l()?.moved ? " is-external-drop-target" : ""}${l()?.kind === "external" && l()?.overDock ? " is-external-drop-allowed" : ""}`, h = I() === "background", g = !!(J() || i()), L = i();
608
- return _ !== o.e && Me(t, o.e = _), h !== o.t && f.classList.toggle("is-active", o.t = h), g !== o.a && f.classList.toggle("is-hovered", o.a = g), L !== o.o && M(f, "aria-expanded", o.o = L), o;
607
+ }), null), Y((o) => {
608
+ var _ = `workbench-dock workbench-dock-material${l()?.kind === "external" && l()?.moved ? " is-external-drop-target" : ""}${l()?.kind === "external" && l()?.overDock ? " is-external-drop-allowed" : ""}`, w = O() === "background", u = !!(Q() || i()), L = i();
609
+ return _ !== o.e && Xe(t, o.e = _), w !== o.t && f.classList.toggle("is-active", o.t = w), u !== o.a && f.classList.toggle("is-hovered", o.a = u), L !== o.o && y(f, "aria-expanded", o.o = L), o;
609
610
  }, {
610
611
  e: void 0,
611
612
  t: void 0,
@@ -617,35 +618,35 @@ function Et(e) {
617
618
  return !!(l()?.moved && !l()?.preview);
618
619
  },
619
620
  get children() {
620
- return c(ct, {
621
+ return c(ut, {
621
622
  state: l
622
623
  });
623
624
  }
624
625
  })];
625
626
  }
626
- function ct(e) {
627
+ function ut(e) {
627
628
  const s = () => {
628
629
  const r = e.state();
629
630
  return r ? `translate3d(${r.clientX + 14}px, ${r.clientY - 56}px, 0)` : "translate3d(0px, 0px, 0)";
630
631
  }, a = () => e.state()?.label ?? "", l = () => e.state()?.icon;
631
- return c(xe, {
632
+ return c(Ae, {
632
633
  get children() {
633
- var r = et(), i = r.firstChild, D = i.nextSibling, v = D.firstChild, E = v.nextSibling, u = E.firstChild, b = u.nextSibling, C = b.firstChild;
634
- return w(v, c(W, {
634
+ var r = nt(), i = r.firstChild, D = i.nextSibling, v = D.firstChild, E = v.nextSibling, g = E.firstChild, b = g.nextSibling, C = b.firstChild;
635
+ return h(v, c(W, {
635
636
  get when() {
636
637
  return l();
637
638
  },
638
639
  children: (k) => {
639
- const $ = k();
640
- return c($, {
640
+ const A = k();
641
+ return c(A, {
641
642
  class: "w-4 h-4"
642
643
  });
643
644
  }
644
- })), w(u, a), w(b, c(Fe, {
645
+ })), h(g, a), h(b, c(Re, {
645
646
  class: "w-3 h-3"
646
- }), C), w(C, () => e.state()?.kind === "external" ? "Pin to Dock" : "Drag onto canvas"), A((k) => {
647
- var $ = !!(e.state()?.kind === "external" && e.state()?.overDock), p = s();
648
- return $ !== k.e && r.classList.toggle("is-over-dock", k.e = $), p !== k.t && Xe(r, "transform", k.t = p), k;
647
+ }), C), h(C, () => e.state()?.kind === "external" ? "Pin to Dock" : "Drag onto canvas"), Y((k) => {
648
+ var A = !!(e.state()?.kind === "external" && e.state()?.overDock), N = s();
649
+ return A !== k.e && r.classList.toggle("is-over-dock", k.e = A), N !== k.t && Ye(r, "transform", k.t = N), k;
649
650
  }, {
650
651
  e: void 0,
651
652
  t: void 0
@@ -653,7 +654,7 @@ function ct(e) {
653
654
  }
654
655
  });
655
656
  }
656
- Ae(["pointerdown", "click"]);
657
+ Fe(["pointerdown", "click"]);
657
658
  export {
658
- Et as WorkbenchDock
659
+ Pt as WorkbenchDock
659
660
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-core",
3
- "version": "0.42.0",
3
+ "version": "0.42.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",