@floegence/floe-webapp-core 0.52.4 → 0.52.5

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.
@@ -8,6 +8,8 @@ export interface WorkbenchFilterBarProps {
8
8
  widgets: readonly WorkbenchWidgetItem[];
9
9
  filters: Record<string, boolean>;
10
10
  mode?: WorkbenchInteractionMode;
11
+ /** Optional artwork shared by the mode trigger and menu; omitted entries use the built-in icons. */
12
+ modeIcons?: WorkbenchDockModeIcons;
11
13
  /** Changes built-in Dock clicks without affecting drag-to-create behavior. */
12
14
  activationMode?: WorkbenchDockItemActivationMode;
13
15
  /** Solo a single dock component in the supplied mode scope; soloing it again shows the full scope. */
@@ -44,6 +46,9 @@ export type WorkbenchDockItemPresentation = Readonly<{
44
46
  currentIndex: number | null;
45
47
  active: boolean;
46
48
  }>;
49
+ export type WorkbenchDockModeIcons = Readonly<Partial<Record<'work' | 'background', Component<{
50
+ class?: string;
51
+ }>>>>;
47
52
  export type WorkbenchDockAction = Readonly<{
48
53
  id: string;
49
54
  label: string;
@@ -1,5 +1,5 @@
1
- import { insert as m, createComponent as l, effect as K, setAttribute as I, memo as B, className as Ke, template as A, addEventListener as Ce, Portal as We, setStyleProperty as Ne, use as Ve, delegateEvents as Ge } from "solid-js/web";
2
- import { createSignal as le, onCleanup as p, createEffect as ee, createMemo as F, Show as R, For as te, Index as Ue } from "solid-js";
1
+ import { insert as h, createComponent as l, effect as K, setAttribute as L, memo as B, className as Ke, template as $, addEventListener as Ce, Portal as We, setStyleProperty as Ne, use as Ve, delegateEvents as Ge } from "solid-js/web";
2
+ import { createSignal as de, onCleanup as p, createEffect as ee, createMemo as A, Show as R, For as te, Index as Ue } from "solid-js";
3
3
  import { Motion as W } from "../../node_modules/.pnpm/solid-motionone@1.0.4_solid-js@1.9.11/node_modules/solid-motionone/dist/index.js";
4
4
  import { easing as N, duration as V } from "../../utils/animations.js";
5
5
  import { Plus as qe } from "../icons/index.js";
@@ -9,10 +9,10 @@ import { clientToCanvasWorld as Je } from "../ui/canvasGeometry.js";
9
9
  import { isBarItemContextMenuKey as Qe, keyboardBarItemContextMenuRequest as Ze } from "../layout/barItemContextMenu.js";
10
10
  import { createWorkbenchWidgetFrame as pe } from "./workbenchHelpers.js";
11
11
  import { getWidgetEntry as et } from "./widgets/widgetRegistry.js";
12
- import { WORKBENCH_EDGE_AUTO_PAN_FRAME_SELECTOR as Le, frameFromElement as Ie, createWorkbenchEdgeAutoPanController as tt } from "./workbenchEdgeAutoPan.js";
12
+ import { WORKBENCH_EDGE_AUTO_PAN_FRAME_SELECTOR as Ie, frameFromElement as Le, createWorkbenchEdgeAutoPanController as tt } from "./workbenchEdgeAutoPan.js";
13
13
  import { DockLayoutDashboard as nt, DockLayers as ot, DockRegion as rt, DockText as it, DockMessageSquare as at } from "../icons/DockIcons.js";
14
- var ct = /* @__PURE__ */ A("<button type=button class=workbench-dock__item>"), lt = /* @__PURE__ */ A('<button type=button class="workbench-dock__item workbench-dock__action">'), dt = /* @__PURE__ */ A("<span class=workbench-dock__external-placeholder aria-hidden=true>"), st = /* @__PURE__ */ A('<div class=workbench-dock__mode-popover role=menu aria-label="Canvas mode">'), ut = /* @__PURE__ */ A("<span class=workbench-dock__divider aria-hidden=true>"), gt = /* @__PURE__ */ A('<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>'), vt = /* @__PURE__ */ A("<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>"), ft = /* @__PURE__ */ A("<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>");
15
- const Pe = 5, kt = 1e3, ht = ".workbench-dock", de = [{
14
+ var ct = /* @__PURE__ */ $("<button type=button class=workbench-dock__item>"), lt = /* @__PURE__ */ $('<button type=button class="workbench-dock__item workbench-dock__action">'), dt = /* @__PURE__ */ $("<span class=workbench-dock__external-placeholder aria-hidden=true>"), st = /* @__PURE__ */ $('<div class=workbench-dock__mode-popover role=menu aria-label="Canvas mode">'), ut = /* @__PURE__ */ $("<span class=workbench-dock__divider aria-hidden=true>"), gt = /* @__PURE__ */ $('<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>'), vt = /* @__PURE__ */ $("<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>"), ft = /* @__PURE__ */ $("<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>");
15
+ const Pe = 5, kt = 1e3, mt = ".workbench-dock", ht = [{
16
16
  mode: "work",
17
17
  label: "Work Mode",
18
18
  description: "Operate windows and sticky notes",
@@ -22,11 +22,11 @@ const Pe = 5, kt = 1e3, ht = ".workbench-dock", de = [{
22
22
  label: "Composition Mode",
23
23
  description: "Arrange regions and canvas text",
24
24
  icon: ot
25
- }], mt = [{
25
+ }], wt = [{
26
26
  tool: "sticky-note",
27
27
  label: "Sticky",
28
28
  icon: at
29
- }], wt = [{
29
+ }], bt = [{
30
30
  tool: "background-region",
31
31
  label: "Region",
32
32
  icon: rt
@@ -35,20 +35,20 @@ const Pe = 5, kt = 1e3, ht = ".workbench-dock", de = [{
35
35
  label: "Text",
36
36
  icon: it
37
37
  }];
38
- function bt(e) {
39
- const a = e?.closest(".workbench-surface")?.querySelector(Le);
40
- return a instanceof HTMLElement ? Ie(a) : null;
38
+ function _t(e) {
39
+ const a = e?.closest(".workbench-surface")?.querySelector(Ie);
40
+ return a instanceof HTMLElement ? Le(a) : null;
41
41
  }
42
42
  function ue(e, v, a) {
43
43
  return e >= a.left && e <= a.right && v >= a.top && v <= a.bottom;
44
44
  }
45
- function _t(e, v, a) {
45
+ function Dt(e, v, a) {
46
46
  return a ? ue(e, v, a) : !1;
47
47
  }
48
48
  function xe(e, v, a) {
49
49
  return Math.min(a, Math.max(v, e));
50
50
  }
51
- function Dt(e, v, a, c, d) {
51
+ function Et(e, v, a, c, d) {
52
52
  if (!e) return !1;
53
53
  if (ue(v, a, e) || ue(c, d, e))
54
54
  return !0;
@@ -64,7 +64,7 @@ function Dt(e, v, a, c, d) {
64
64
  function Me(e, v, a) {
65
65
  if (!a || typeof document.elementFromPoint != "function") return !1;
66
66
  const c = document.elementFromPoint(e, v);
67
- return c instanceof Element && c.closest(ht) === a;
67
+ return c instanceof Element && c.closest(mt) === a;
68
68
  }
69
69
  function se(e) {
70
70
  const v = () => e.hoverOffset === -1 ? {
@@ -102,7 +102,7 @@ function se(e) {
102
102
  };
103
103
  return (() => {
104
104
  var r = ct();
105
- return r.$$keydown = s, r.$$contextmenu = d, r.$$click = P, r.$$pointerdown = c, r.addEventListener("pointerleave", () => e.onLeave()), r.addEventListener("pointerenter", () => e.onEnter()), m(r, l(W.span, {
105
+ return r.$$keydown = s, r.$$contextmenu = d, r.$$click = P, r.$$pointerdown = c, r.addEventListener("pointerleave", () => e.onLeave()), r.addEventListener("pointerenter", () => e.onEnter()), h(r, l(W.span, {
106
106
  class: "workbench-dock__tile",
107
107
  get animate() {
108
108
  return v();
@@ -121,7 +121,7 @@ function se(e) {
121
121
  });
122
122
  })();
123
123
  }
124
- }), null), m(r, l(W.span, {
124
+ }), null), h(r, l(W.span, {
125
125
  class: "workbench-dock__tooltip",
126
126
  get animate() {
127
127
  return {
@@ -139,8 +139,8 @@ function se(e) {
139
139
  return B(() => e.activationMode === "focus-cycle")() ? b() : e.label;
140
140
  }
141
141
  }), null), K((i) => {
142
- var D = e.kind === "host" ? e.id : void 0, x = e.kind === "widget" || e.kind === "tool" ? e.id : void 0, f = !!e.active, M = !!(e.filterable && !e.visible), $ = !!a(), z = !!e.isDragging, X = e.activationMode === "focus-cycle" && e.presentation ? b() : e.filterable ? `${e.label} — click to solo, drag to canvas to create` : `${e.label} — drag to canvas to create`, j = e.activationMode === "focus-cycle" ? e.presentation?.active : e.active, Y = e.onContextMenu ? "menu" : void 0;
143
- return D !== i.e && I(r, "data-workbench-dock-item", i.e = D), x !== i.t && I(r, "data-workbench-dock-component", i.t = x), f !== i.a && r.classList.toggle("is-active", i.a = f), M !== i.o && r.classList.toggle("is-filter-muted", i.o = M), $ !== i.i && r.classList.toggle("is-hovered", i.i = $), z !== i.n && r.classList.toggle("is-source-dragging", i.n = z), X !== i.s && I(r, "aria-label", i.s = X), j !== i.h && I(r, "aria-pressed", i.h = j), Y !== i.r && I(r, "aria-haspopup", i.r = Y), i;
142
+ var D = e.kind === "host" ? e.id : void 0, x = e.kind === "widget" || e.kind === "tool" ? e.id : void 0, f = !!e.active, M = !!(e.filterable && !e.visible), X = !!a(), z = !!e.isDragging, Y = e.activationMode === "focus-cycle" && e.presentation ? b() : e.filterable ? `${e.label} — click to solo, drag to canvas to create` : `${e.label} — drag to canvas to create`, j = e.activationMode === "focus-cycle" ? e.presentation?.active : e.active, F = e.onContextMenu ? "menu" : void 0;
143
+ return D !== i.e && L(r, "data-workbench-dock-item", i.e = D), x !== i.t && L(r, "data-workbench-dock-component", i.t = x), f !== i.a && r.classList.toggle("is-active", i.a = f), M !== i.o && r.classList.toggle("is-filter-muted", i.o = M), X !== i.i && r.classList.toggle("is-hovered", i.i = X), z !== i.n && r.classList.toggle("is-source-dragging", i.n = z), Y !== i.s && L(r, "aria-label", i.s = Y), j !== i.h && L(r, "aria-pressed", i.h = j), F !== i.r && L(r, "aria-haspopup", i.r = F), i;
144
144
  }, {
145
145
  e: void 0,
146
146
  t: void 0,
@@ -154,7 +154,7 @@ function se(e) {
154
154
  }), r;
155
155
  })();
156
156
  }
157
- function Et(e) {
157
+ function Ct(e) {
158
158
  const v = () => e.hoverOffset === -1, a = () => ({
159
159
  scale: 1,
160
160
  y: 0,
@@ -162,7 +162,7 @@ function Et(e) {
162
162
  }), c = e.action.icon;
163
163
  return (() => {
164
164
  var d = lt();
165
- return d.$$click = (s) => e.onActivate(s.currentTarget), d.addEventListener("dragstart", (s) => s.preventDefault()), Ce(d, "pointerleave", e.onLeave), Ce(d, "pointerenter", e.onEnter), I(d, "draggable", !1), m(d, l(W.span, {
165
+ return d.$$click = (s) => e.onActivate(s.currentTarget), d.addEventListener("dragstart", (s) => s.preventDefault()), Ce(d, "pointerleave", e.onLeave), Ce(d, "pointerenter", e.onEnter), L(d, "draggable", !1), h(d, l(W.span, {
166
166
  class: "workbench-dock__tile",
167
167
  get animate() {
168
168
  return a();
@@ -178,7 +178,7 @@ function Et(e) {
178
178
  class: "workbench-dock__icon"
179
179
  });
180
180
  }
181
- }), null), m(d, l(W.span, {
181
+ }), null), h(d, l(W.span, {
182
182
  class: "workbench-dock__tooltip",
183
183
  get animate() {
184
184
  return {
@@ -197,7 +197,7 @@ function Et(e) {
197
197
  }
198
198
  }), null), K((s) => {
199
199
  var P = e.action.id, b = !!e.action.active, r = !!v(), i = e.action.label, D = e.action.active;
200
- return P !== s.e && I(d, "data-workbench-dock-action", s.e = P), b !== s.t && d.classList.toggle("is-active", s.t = b), r !== s.a && d.classList.toggle("is-hovered", s.a = r), i !== s.o && I(d, "aria-label", s.o = i), D !== s.i && I(d, "aria-pressed", s.i = D), s;
200
+ return P !== s.e && L(d, "data-workbench-dock-action", s.e = P), b !== s.t && d.classList.toggle("is-active", s.t = b), r !== s.a && d.classList.toggle("is-hovered", s.a = r), i !== s.o && L(d, "aria-label", s.o = i), D !== s.i && L(d, "aria-pressed", s.i = D), s;
201
201
  }, {
202
202
  e: void 0,
203
203
  t: void 0,
@@ -207,8 +207,8 @@ function Et(e) {
207
207
  }), d;
208
208
  })();
209
209
  }
210
- function Ft(e) {
211
- const [v, a] = le(null), [c, d] = le(null), [s, P] = le(!1);
210
+ function Bt(e) {
211
+ const [v, a] = de(null), [c, d] = de(null), [s, P] = de(!1);
212
212
  let b, r, i, D, x = null;
213
213
  const f = () => e.activationMode === "focus-cycle" ? "focus-cycle" : "solo-filter";
214
214
  p(() => {
@@ -240,13 +240,13 @@ function Ft(e) {
240
240
  const M = (t) => {
241
241
  const n = v();
242
242
  return n === null || n <= G().length ? 0 : n === t ? -1 : n === t + 1 ? -2 : n === t - 1 ? 1 : 0;
243
- }, $ = () => {
243
+ }, X = () => {
244
244
  D?.stop(), D = void 0, x = null;
245
245
  }, z = () => {
246
246
  !e.viewport || !e.onViewportCommit || (x = e.viewport, D?.stop(), D = tt({
247
247
  readFrame: () => {
248
- const n = b?.closest(".workbench-surface")?.querySelector(Le);
249
- return n instanceof HTMLElement ? Ie(n) : null;
248
+ const n = b?.closest(".workbench-surface")?.querySelector(Ie);
249
+ return n instanceof HTMLElement ? Le(n) : null;
250
250
  },
251
251
  readViewport: () => x ?? e.viewport ?? null,
252
252
  commitViewport: (t) => {
@@ -258,7 +258,7 @@ function Ft(e) {
258
258
  return !!(t?.moved && t.hasEnteredCanvas && !Me(t.clientX, t.clientY, b));
259
259
  }
260
260
  }));
261
- }, X = (t, n, k, E) => {
261
+ }, Y = (t, n, k, E) => {
262
262
  if (e.onDockActivation?.({
263
263
  kind: t,
264
264
  id: String(n)
@@ -267,15 +267,15 @@ function Ft(e) {
267
267
  e.dockItems?.find((o) => o.id === n)?.onActivate?.(E);
268
268
  return;
269
269
  }
270
- const L = {
270
+ const I = {
271
271
  kind: t,
272
272
  id: n,
273
273
  label: k,
274
274
  trigger: E
275
275
  };
276
- if (!e.onItemClick?.(L)) {
276
+ if (!e.onItemClick?.(I)) {
277
277
  if (f() === "focus-cycle") {
278
- e.onFocusCycleItem?.(L);
278
+ e.onFocusCycleItem?.(I);
279
279
  return;
280
280
  }
281
281
  y() !== "background" && e.onSoloFilter(String(n), ke());
@@ -284,9 +284,9 @@ function Ft(e) {
284
284
  const n = c();
285
285
  if (!n) return;
286
286
  const k = !n.moved, E = x ?? e.viewport;
287
- if (n.stopInteraction(), $(), d(null), r = void 0, n.kind === "external" && n.moved && i?.expire(), k) {
287
+ if (n.stopInteraction(), X(), d(null), r = void 0, n.kind === "external" && n.moved && i?.expire(), k) {
288
288
  if (n.kind === "external" || !(n.trigger instanceof HTMLButtonElement)) return;
289
- X(n.kind, n.id, n.label, n.trigger);
289
+ Y(n.kind, n.id, n.label, n.trigger);
290
290
  return;
291
291
  }
292
292
  if (t && n.overDock && n.dockDrop) {
@@ -294,29 +294,29 @@ function Ft(e) {
294
294
  return;
295
295
  }
296
296
  if (t && n.overCanvas && n.canvasPlacement) {
297
- const L = n.canvasFrame && E ? Je(n.canvasFrame, E, {
297
+ const I = n.canvasFrame && E ? Je(n.canvasFrame, E, {
298
298
  clientX: n.clientX,
299
299
  clientY: n.clientY
300
300
  }) : null, o = n.canvasFrame ? {
301
301
  dropAllowed: n.overCanvas,
302
302
  canvasFrame: n.canvasFrame,
303
- ...L ? {
304
- worldPoint: L
303
+ ...I ? {
304
+ worldPoint: I
305
305
  } : {}
306
306
  } : void 0;
307
307
  n.canvasPlacement.onDrop(n.clientX, n.clientY, o);
308
308
  }
309
- }, Y = (t, n, k, E, L, o, _, w, u = "before-components") => {
309
+ }, F = (t, n, k, E, I, o, _, w, u = "before-components") => {
310
310
  t.preventDefault(), r?.stop({
311
311
  reason: "manual_stop",
312
312
  commit: !1
313
313
  }), z();
314
- const C = bt(b);
314
+ const C = _t(b);
315
315
  d({
316
316
  kind: n,
317
317
  id: k,
318
318
  label: E,
319
- icon: L,
319
+ icon: I,
320
320
  pointerId: t.pointerId,
321
321
  startClientX: t.clientX,
322
322
  startClientY: t.clientY,
@@ -339,38 +339,38 @@ function Ft(e) {
339
339
  });
340
340
  const T = (g) => {
341
341
  let O = !1;
342
- d((h) => {
343
- if (!h || h.pointerId !== g.pointerId) return h;
344
- const J = g.clientX - h.startClientX, Q = g.clientY - h.startClientY, H = h.moved || Math.abs(J) > Pe || Math.abs(Q) > Pe;
345
- if (h.kind === "external" && H && !h.moved) {
342
+ d((m) => {
343
+ if (!m || m.pointerId !== g.pointerId) return m;
344
+ const J = g.clientX - m.startClientX, Q = g.clientY - m.startClientY, H = m.moved || Math.abs(J) > Pe || Math.abs(Q) > Pe;
345
+ if (m.kind === "external" && H && !m.moved) {
346
346
  let U;
347
347
  const q = () => {
348
- U !== void 0 && window.clearTimeout(U), h.trigger.removeEventListener("click", _e, !0), window.removeEventListener("pointerdown", De, !0), i?.clear === q && (i = void 0);
348
+ U !== void 0 && window.clearTimeout(U), m.trigger.removeEventListener("click", _e, !0), window.removeEventListener("pointerdown", De, !0), i?.clear === q && (i = void 0);
349
349
  }, _e = (Ee) => {
350
350
  Ee.preventDefault(), Ee.stopImmediatePropagation(), q();
351
351
  }, De = () => q(), He = () => {
352
352
  U !== void 0 && window.clearTimeout(U), U = window.setTimeout(q, kt);
353
353
  };
354
- h.trigger.addEventListener("click", _e, !0), window.addEventListener("pointerdown", De, !0), i = {
354
+ m.trigger.addEventListener("click", _e, !0), window.addEventListener("pointerdown", De, !0), i = {
355
355
  clear: q,
356
356
  expire: He
357
357
  };
358
358
  }
359
- const Z = Me(g.clientX, g.clientY, b), S = h.canvasFrame, me = H && _t(g.clientX, g.clientY, S), we = me && !Z, Fe = H && !Z && Dt(S, h.clientX, h.clientY, g.clientX, g.clientY), be = h.hasEnteredCanvas || me || Fe;
359
+ const Z = Me(g.clientX, g.clientY, b), S = m.canvasFrame, he = H && Dt(g.clientX, g.clientY, S), we = he && !Z, Fe = H && !Z && Et(S, m.clientX, m.clientY, g.clientX, g.clientY), be = m.hasEnteredCanvas || he || Fe;
360
360
  O = H && be && !Z;
361
361
  const Be = S ? xe(g.clientX, S.left, S.right) : g.clientX, Re = S ? xe(g.clientY, S.top, S.bottom) : g.clientY;
362
362
  return {
363
- ...h,
363
+ ...m,
364
364
  clientX: g.clientX,
365
365
  clientY: g.clientY,
366
366
  moved: H,
367
367
  overDock: Z,
368
368
  overCanvas: we,
369
369
  hasEnteredCanvas: be,
370
- preview: H && S && h.canvasPlacement?.preview ? {
371
- kind: h.canvasPlacement.preview.kind,
372
- id: h.canvasPlacement.preview.id,
373
- label: h.label,
370
+ preview: H && S && m.canvasPlacement?.preview ? {
371
+ kind: m.canvasPlacement.preview.kind,
372
+ id: m.canvasPlacement.preview.id,
373
+ label: m.label,
374
374
  clientX: Be,
375
375
  clientY: Re,
376
376
  dropAllowed: we,
@@ -401,11 +401,11 @@ function Ft(e) {
401
401
  },
402
402
  onDrop: (n, k, E) => {
403
403
  if (!E?.worldPoint) return;
404
- const L = et(t.widgetType, e.widgetDefinitions);
404
+ const I = et(t.widgetType, e.widgetDefinitions);
405
405
  t.onDrop({
406
406
  widgetType: t.widgetType,
407
407
  centerWorld: E.worldPoint,
408
- frame: pe(L, {
408
+ frame: pe(I, {
409
409
  anchor: "center",
410
410
  worldX: E.worldPoint.worldX,
411
411
  worldY: E.worldPoint.worldY
@@ -413,19 +413,22 @@ function Ft(e) {
413
413
  });
414
414
  }
415
415
  } : null, ye = (t, n) => {
416
- t.button !== 0 || !(t.currentTarget instanceof HTMLElement) || (i?.clear(), i = void 0, Y(t, "external", n.id, n.label, n.icon, t.currentTarget, ne(n.canvasPlacement), n.onDropToDock ?? null, n.dockPlacement ?? "before-components"));
416
+ t.button !== 0 || !(t.currentTarget instanceof HTMLElement) || (i?.clear(), i = void 0, F(t, "external", n.id, n.label, n.icon, t.currentTarget, ne(n.canvasPlacement), n.onDropToDock ?? null, n.dockPlacement ?? "before-components"));
417
417
  };
418
418
  ee(() => {
419
419
  e.registerExternalDockDragController?.({
420
420
  begin: ye
421
421
  }), p(() => e.registerExternalDockDragController?.(null));
422
422
  });
423
- const Se = () => c()?.kind === "widget" ? c().id : null, Te = () => c()?.kind === "tool" ? c().id : null, Oe = () => c()?.kind === "external" ? c()?.icon : void 0, y = () => e.mode === "background" || e.mode === "annotation" ? "background" : "work", ge = F(() => de.find((t) => t.mode === y()) ?? de[0]), oe = F(() => y() === "background" ? wt.map((t) => ({
423
+ const Se = () => c()?.kind === "widget" ? c().id : null, Te = () => c()?.kind === "tool" ? c().id : null, Oe = () => c()?.kind === "external" ? c()?.icon : void 0, y = () => e.mode === "background" || e.mode === "annotation" ? "background" : "work", oe = A(() => ht.map((t) => ({
424
+ ...t,
425
+ icon: e.modeIcons?.[t.mode] ?? t.icon
426
+ }))), ge = A(() => oe().find((t) => t.mode === y()) ?? oe()[0]), re = A(() => y() === "background" ? bt.map((t) => ({
424
427
  id: t.tool,
425
428
  kind: "tool",
426
429
  label: t.label,
427
430
  icon: t.icon
428
- })) : [...mt.map((t) => ({
431
+ })) : [...wt.map((t) => ({
429
432
  id: t.tool,
430
433
  kind: "tool",
431
434
  label: t.label,
@@ -435,24 +438,24 @@ function Ft(e) {
435
438
  kind: "widget",
436
439
  label: t.label,
437
440
  icon: t.icon
438
- }))]), ve = F(() => y() === "background" ? [] : [...e.dockItems ?? []]), re = F(() => ve().filter((t) => t.dockPlacement !== "after-components")), fe = F(() => ve().filter((t) => t.dockPlacement === "after-components")), G = F(() => y() === "background" ? [] : [...e.dockActions ?? []]), ke = F(() => oe().map((t) => String(t.id))), ie = () => y() !== "background", Ae = (t) => !ie() || e.filters[t] !== !1, $e = (t) => {
439
- if (!ie())
441
+ }))]), ve = A(() => y() === "background" ? [] : [...e.dockItems ?? []]), ie = A(() => ve().filter((t) => t.dockPlacement !== "after-components")), fe = A(() => ve().filter((t) => t.dockPlacement === "after-components")), G = A(() => y() === "background" ? [] : [...e.dockActions ?? []]), ke = A(() => re().map((t) => String(t.id))), ae = () => y() !== "background", Ae = (t) => !ae() || e.filters[t] !== !1, $e = (t) => {
442
+ if (!ae())
440
443
  return !1;
441
444
  const n = ke();
442
445
  return n.length > 1 && n.every((k) => e.filters[k] !== !1 == (k === t));
443
446
  }, Xe = (t, n) => f() === "focus-cycle" ? e.resolveItemPresentation?.({
444
447
  kind: t,
445
448
  id: n
446
- }) : void 0, ae = () => v() === 0, Ye = () => ({
449
+ }) : void 0, ce = () => v() === 0, Ye = () => ({
447
450
  scale: 1,
448
451
  y: 0,
449
452
  x: 0
450
- }), ce = (t) => {
453
+ }), le = (t) => {
451
454
  const n = c();
452
455
  return !!(n?.kind === "external" && n.moved && n.dockPlacement === t);
453
- }, he = () => (() => {
456
+ }, me = () => (() => {
454
457
  var t = dt();
455
- return m(t, l(R, {
458
+ return h(t, l(R, {
456
459
  get when() {
457
460
  return Oe();
458
461
  },
@@ -467,13 +470,13 @@ function Ft(e) {
467
470
  return [(() => {
468
471
  var t = gt(), n = t.firstChild, k = n.firstChild, E = n.nextSibling;
469
472
  t.addEventListener("pointerleave", () => a(null));
470
- var L = b;
471
- return typeof L == "function" ? Ve(L, t) : b = t, k.$$click = () => {
473
+ var I = b;
474
+ return typeof I == "function" ? Ve(I, t) : b = t, k.$$click = () => {
472
475
  e.onDockActivation?.({
473
476
  kind: "mode",
474
477
  id: y()
475
478
  }), P((o) => !o);
476
- }, k.addEventListener("pointerleave", () => a((o) => o === 0 ? null : o)), k.addEventListener("pointerenter", () => a(0)), m(k, l(W.span, {
479
+ }, k.addEventListener("pointerleave", () => a((o) => o === 0 ? null : o)), k.addEventListener("pointerenter", () => a(0)), h(k, l(W.span, {
477
480
  class: "workbench-dock__tile",
478
481
  get animate() {
479
482
  return Ye();
@@ -492,12 +495,12 @@ function Ft(e) {
492
495
  });
493
496
  })();
494
497
  }
495
- }), null), m(k, l(W.span, {
498
+ }), null), h(k, l(W.span, {
496
499
  class: "workbench-dock__tooltip",
497
500
  get animate() {
498
501
  return {
499
- opacity: ae() && !s() ? 1 : 0,
500
- y: ae() && !s() ? -6 : 0
502
+ opacity: ce() && !s() ? 1 : 0,
503
+ y: ce() && !s() ? -6 : 0
501
504
  };
502
505
  },
503
506
  get transition() {
@@ -509,14 +512,16 @@ function Ft(e) {
509
512
  get children() {
510
513
  return ge().label;
511
514
  }
512
- }), null), m(n, l(R, {
515
+ }), null), h(n, l(R, {
513
516
  get when() {
514
517
  return s();
515
518
  },
516
519
  get children() {
517
520
  var o = st();
518
- return m(o, l(te, {
519
- each: de,
521
+ return h(o, l(te, {
522
+ get each() {
523
+ return oe();
524
+ },
520
525
  children: (_) => {
521
526
  const w = _.icon;
522
527
  return (() => {
@@ -526,11 +531,11 @@ function Ft(e) {
526
531
  kind: "mode",
527
532
  id: _.mode
528
533
  }), e.onSelectMode?.(_.mode), P(!1);
529
- }, m(C, l(w, {
534
+ }, h(C, l(w, {
530
535
  class: "workbench-dock__mode-icon"
531
- })), m(g, () => _.label), m(O, () => _.description), K((h) => {
536
+ })), h(g, () => _.label), h(O, () => _.description), K((m) => {
532
537
  var J = y() === _.mode, Q = y() === _.mode;
533
- return J !== h.e && u.classList.toggle("is-active", h.e = J), Q !== h.t && I(u, "aria-checked", h.t = Q), h;
538
+ return J !== m.e && u.classList.toggle("is-active", m.e = J), Q !== m.t && L(u, "aria-checked", m.t = Q), m;
534
539
  }, {
535
540
  e: void 0,
536
541
  t: void 0
@@ -539,13 +544,13 @@ function Ft(e) {
539
544
  }
540
545
  })), o;
541
546
  }
542
- }), null), m(t, l(Ue, {
547
+ }), null), h(t, l(Ue, {
543
548
  get each() {
544
549
  return G();
545
550
  },
546
551
  children: (o, _) => {
547
552
  const w = () => _ + 1;
548
- return l(Et, {
553
+ return l(Ct, {
549
554
  get action() {
550
555
  return o();
551
556
  },
@@ -562,16 +567,16 @@ function Ft(e) {
562
567
  }
563
568
  });
564
569
  }
565
- }), E), m(t, l(R, {
570
+ }), E), h(t, l(R, {
566
571
  get when() {
567
- return ce("before-components");
572
+ return le("before-components");
568
573
  },
569
574
  get children() {
570
- return l(he, {});
575
+ return l(me, {});
571
576
  }
572
- }), E), m(t, l(te, {
577
+ }), E), h(t, l(te, {
573
578
  get each() {
574
- return re();
579
+ return ie();
575
580
  },
576
581
  children: (o, _) => {
577
582
  const w = () => _() + G().length + 1;
@@ -606,18 +611,18 @@ function Ft(e) {
606
611
  get onContextMenu() {
607
612
  return o.onContextMenu;
608
613
  },
609
- onKeyboardActivate: (u) => X("host", o.id, o.label, u),
614
+ onKeyboardActivate: (u) => Y("host", o.id, o.label, u),
610
615
  onEnter: () => a(w()),
611
616
  onLeave: () => a((u) => u === w() ? null : u),
612
- onDragBegin: Y
617
+ onDragBegin: F
613
618
  });
614
619
  }
615
- }), E), m(t, l(te, {
620
+ }), E), h(t, l(te, {
616
621
  get each() {
617
- return oe();
622
+ return re();
618
623
  },
619
624
  children: (o, _) => {
620
- const w = () => _() + G().length + re().length + 1, u = () => Xe(o.kind, o.id);
625
+ const w = () => _() + G().length + ie().length + 1, u = () => Xe(o.kind, o.id);
621
626
  return l(se, {
622
627
  get id() {
623
628
  return String(o.id);
@@ -638,7 +643,7 @@ function Ft(e) {
638
643
  return B(() => f() === "focus-cycle")() ? !0 : Ae(String(o.id));
639
644
  },
640
645
  get filterable() {
641
- return B(() => f() === "solo-filter")() && ie();
646
+ return B(() => f() === "solo-filter")() && ae();
642
647
  },
643
648
  get activationMode() {
644
649
  return f();
@@ -669,23 +674,23 @@ function Ft(e) {
669
674
  },
670
675
  onEnter: () => a(w()),
671
676
  onLeave: () => a((C) => C === w() ? null : C),
672
- onKeyboardActivate: (C) => X(o.kind, o.id, o.label, C),
673
- onDragBegin: Y
677
+ onKeyboardActivate: (C) => Y(o.kind, o.id, o.label, C),
678
+ onDragBegin: F
674
679
  });
675
680
  }
676
- }), null), m(t, l(R, {
681
+ }), null), h(t, l(R, {
677
682
  get when() {
678
- return fe().length > 0 || ce("after-components");
683
+ return fe().length > 0 || le("after-components");
679
684
  },
680
685
  get children() {
681
686
  return ut();
682
687
  }
683
- }), null), m(t, l(te, {
688
+ }), null), h(t, l(te, {
684
689
  get each() {
685
690
  return fe();
686
691
  },
687
692
  children: (o, _) => {
688
- const w = () => _() + G().length + re().length + oe().length + 1;
693
+ const w = () => _() + G().length + ie().length + re().length + 1;
689
694
  return l(se, {
690
695
  get id() {
691
696
  return o.id;
@@ -717,22 +722,22 @@ function Ft(e) {
717
722
  get onContextMenu() {
718
723
  return o.onContextMenu;
719
724
  },
720
- onKeyboardActivate: (u) => X("host", o.id, o.label, u),
725
+ onKeyboardActivate: (u) => Y("host", o.id, o.label, u),
721
726
  onEnter: () => a(w()),
722
727
  onLeave: () => a((u) => u === w() ? null : u),
723
- onDragBegin: Y
728
+ onDragBegin: F
724
729
  });
725
730
  }
726
- }), null), m(t, l(R, {
731
+ }), null), h(t, l(R, {
727
732
  get when() {
728
- return ce("after-components");
733
+ return le("after-components");
729
734
  },
730
735
  get children() {
731
- return l(he, {});
736
+ return l(me, {});
732
737
  }
733
738
  }), null), K((o) => {
734
- var _ = `workbench-dock workbench-dock-material${c()?.kind === "external" && c()?.moved ? " is-external-drop-target" : ""}${c()?.kind === "external" && c()?.overDock ? " is-external-drop-allowed" : ""}`, w = y() === "background", u = !!(ae() || s()), C = s();
735
- return _ !== o.e && Ke(t, o.e = _), w !== o.t && k.classList.toggle("is-active", o.t = w), u !== o.a && k.classList.toggle("is-hovered", o.a = u), C !== o.o && I(k, "aria-expanded", o.o = C), o;
739
+ var _ = `workbench-dock workbench-dock-material${c()?.kind === "external" && c()?.moved ? " is-external-drop-target" : ""}${c()?.kind === "external" && c()?.overDock ? " is-external-drop-allowed" : ""}`, w = y() === "background", u = !!(ce() || s()), C = s();
740
+ return _ !== o.e && Ke(t, o.e = _), w !== o.t && k.classList.toggle("is-active", o.t = w), u !== o.a && k.classList.toggle("is-hovered", o.a = u), C !== o.o && L(k, "aria-expanded", o.o = C), o;
736
741
  }, {
737
742
  e: void 0,
738
743
  t: void 0,
@@ -744,13 +749,13 @@ function Ft(e) {
744
749
  return !!(c()?.moved && !c()?.preview);
745
750
  },
746
751
  get children() {
747
- return l(Ct, {
752
+ return l(Pt, {
748
753
  state: c
749
754
  });
750
755
  }
751
756
  })];
752
757
  }
753
- function Ct(e) {
758
+ function Pt(e) {
754
759
  const v = () => {
755
760
  const d = e.state();
756
761
  return d ? `translate3d(${d.clientX + 14}px, ${d.clientY - 56}px, 0)` : "translate3d(0px, 0px, 0)";
@@ -758,7 +763,7 @@ function Ct(e) {
758
763
  return l(We, {
759
764
  get children() {
760
765
  var d = ft(), s = d.firstChild, P = s.nextSibling, b = P.firstChild, r = b.nextSibling, i = r.firstChild, D = i.nextSibling, x = D.firstChild;
761
- return m(b, l(R, {
766
+ return h(b, l(R, {
762
767
  get when() {
763
768
  return c();
764
769
  },
@@ -768,11 +773,11 @@ function Ct(e) {
768
773
  class: "w-4 h-4"
769
774
  });
770
775
  }
771
- })), m(i, a), m(D, l(qe, {
776
+ })), h(i, a), h(D, l(qe, {
772
777
  class: "w-3 h-3"
773
- }), x), m(x, () => e.state()?.kind === "external" ? "Pin to Dock" : "Drag onto canvas"), K((f) => {
774
- var M = !!(e.state()?.kind === "external" && e.state()?.overDock), $ = v();
775
- return M !== f.e && d.classList.toggle("is-over-dock", f.e = M), $ !== f.t && Ne(d, "transform", f.t = $), f;
778
+ }), x), h(x, () => e.state()?.kind === "external" ? "Pin to Dock" : "Drag onto canvas"), K((f) => {
779
+ var M = !!(e.state()?.kind === "external" && e.state()?.overDock), X = v();
780
+ return M !== f.e && d.classList.toggle("is-over-dock", f.e = M), X !== f.t && Ne(d, "transform", f.t = X), f;
776
781
  }, {
777
782
  e: void 0,
778
783
  t: void 0
@@ -782,5 +787,5 @@ function Ct(e) {
782
787
  }
783
788
  Ge(["pointerdown", "click", "contextmenu", "keydown"]);
784
789
  export {
785
- Ft as WorkbenchDock
790
+ Bt as WorkbenchDock
786
791
  };
@@ -1,6 +1,6 @@
1
1
  import { type UIFirstSelectionEvent } from '../../utils/uiFirstSelection';
2
2
  import { type WorkbenchContextMenuItem } from './WorkbenchContextMenu';
3
- import { type WorkbenchDockItemActivation, type WorkbenchDockItemActivationMode, type WorkbenchDockAction, type WorkbenchExternalDockDragController, type WorkbenchHostDockItem } from './WorkbenchFilterBar';
3
+ import { type WorkbenchDockItemActivation, type WorkbenchDockItemActivationMode, type WorkbenchDockAction, type WorkbenchDockModeIcons, type WorkbenchExternalDockDragController, type WorkbenchHostDockItem } from './WorkbenchFilterBar';
4
4
  import type { WorkbenchState, WorkbenchAnnotationItem, WorkbenchBackgroundLayer, WorkbenchBackgroundLayerDefaults, WorkbenchBackgroundLayerPatch, WorkbenchContextMenuState, WorkbenchInteractionAdapter, WorkbenchStickyNoteItem, WorkbenchStickyNotePatch, WorkbenchTextAnnotationDefaults, WorkbenchTextAnnotationPatch, WorkbenchWidgetDefinition, WorkbenchWidgetItem, WorkbenchWidgetType } from './types';
5
5
  export interface WorkbenchCreateAtOptions {
6
6
  worldX?: number;
@@ -73,6 +73,8 @@ export interface WorkbenchSurfaceProps {
73
73
  */
74
74
  dockItemActivationMode?: WorkbenchDockItemActivationMode;
75
75
  onDockItemClick?: (item: WorkbenchDockItemActivation) => boolean | void;
76
+ /** Host artwork for the Dock mode trigger and its menu. */
77
+ dockModeIcons?: WorkbenchDockModeIcons;
76
78
  dockActions?: readonly WorkbenchDockAction[];
77
79
  dockItems?: readonly WorkbenchHostDockItem[];
78
80
  registerExternalDockDragController?: (controller: WorkbenchExternalDockDragController | null) => void;
@@ -614,6 +614,9 @@ function Zt(c) {
614
614
  get onItemClick() {
615
615
  return c.onDockItemClick;
616
616
  },
617
+ get modeIcons() {
618
+ return c.dockModeIcons;
619
+ },
617
620
  get dockActions() {
618
621
  return c.dockActions;
619
622
  },
@@ -1,7 +1,7 @@
1
1
  export { WorkbenchOverlay, type WorkbenchOverlayProps } from './WorkbenchOverlay';
2
2
  export { WorkbenchDockPopoverSurface, type WorkbenchDockPopoverSurfaceProps, } from './WorkbenchDockPopoverSurface';
3
3
  export { WorkbenchSurface, type WorkbenchSurfaceApi, type WorkbenchCreateAtOptions, type WorkbenchCreateWidgetOptions, type WorkbenchContextMenuItemsResolver, type WorkbenchSurfaceProps, } from './WorkbenchSurface';
4
- export type { WorkbenchDockAction, WorkbenchCanvasWidgetPlacement, WorkbenchDockCanvasPlacement, WorkbenchDockDropContext, WorkbenchDockItemPlacement, WorkbenchDockItemActivation, WorkbenchDockItemActivationMode, WorkbenchExternalDockDragController, WorkbenchExternalDockDragItem, WorkbenchHostDockItem, } from './WorkbenchFilterBar';
4
+ export type { WorkbenchDockAction, WorkbenchDockModeIcons, WorkbenchCanvasWidgetPlacement, WorkbenchDockCanvasPlacement, WorkbenchDockDropContext, WorkbenchDockItemPlacement, WorkbenchDockItemActivation, WorkbenchDockItemActivationMode, WorkbenchExternalDockDragController, WorkbenchExternalDockDragItem, WorkbenchHostDockItem, } from './WorkbenchFilterBar';
5
5
  export type { BarItemContextMenuHandler, BarItemContextMenuRequest, BarItemContextMenuSource, } from '../layout/barItemContextMenu';
6
6
  export { WorkbenchContextMenu, type WorkbenchContextMenuItem, type WorkbenchContextMenuProps, } from './WorkbenchContextMenu';
7
7
  export { useWorkbenchModel, type UseWorkbenchModelOptions } from './useWorkbenchModel';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-core",
3
- "version": "0.52.4",
3
+ "version": "0.52.5",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",