@floegence/floe-webapp-core 0.101.29 → 0.101.33

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,7 +1,7 @@
1
1
  import { type WorkbenchCompositionMessages } from './workbenchCompositionMessages';
2
2
  import { type UIFirstSelectionEvent } from '../../utils/uiFirstSelection';
3
3
  import { type WorkbenchContextMenuItem } from './WorkbenchContextMenu';
4
- import { type WorkbenchDockItemActivation, type WorkbenchDockItemActivationMode, type WorkbenchDockAction, type WorkbenchDockModeIcons, type WorkbenchExternalDockDragController, type WorkbenchHostDockItem } from './WorkbenchFilterBar';
4
+ import { type WorkbenchDockItemActivation, type WorkbenchDockItemActivationMode, type WorkbenchDockAction, type WorkbenchDockCustomization, type WorkbenchDockModeIcons, type WorkbenchExternalDockDragController, type WorkbenchHostDockItem } from './WorkbenchFilterBar';
5
5
  import type { WorkbenchState, WorkbenchAnnotationItem, WorkbenchBackgroundLayer, WorkbenchBackgroundLayerDefaults, WorkbenchBackgroundLayerPatch, WorkbenchContextMenuState, WorkbenchDockToolId, WorkbenchInteractionAdapter, WorkbenchStickyNoteItem, WorkbenchStickyNotePatch, WorkbenchTextAnnotationDefaults, WorkbenchTextAnnotationPatch, WorkbenchWidgetDefinition, WorkbenchWidgetItem, WorkbenchWidgetType } from './types';
6
6
  export interface WorkbenchCreateAtOptions {
7
7
  worldX?: number;
@@ -80,6 +80,7 @@ export interface WorkbenchSurfaceProps {
80
80
  /** Host artwork for the Dock mode trigger and its menu. */
81
81
  dockModeIcons?: WorkbenchDockModeIcons;
82
82
  dockActions?: readonly WorkbenchDockAction[];
83
+ dockCustomization?: WorkbenchDockCustomization;
83
84
  dockItems?: readonly WorkbenchHostDockItem[];
84
85
  registerExternalDockDragController?: (controller: WorkbenchExternalDockDragController | null) => void;
85
86
  onLayoutInteractionStart?: () => void;
@@ -654,6 +654,9 @@ function ae(c) {
654
654
  get dockActions() {
655
655
  return c.dockActions;
656
656
  },
657
+ get customization() {
658
+ return c.dockCustomization;
659
+ },
657
660
  get componentOrder() {
658
661
  return c.dockComponentOrder;
659
662
  },
@@ -2,7 +2,7 @@ export { WorkbenchOverlay, type WorkbenchOverlayProps } from './WorkbenchOverlay
2
2
  export { WorkbenchWidgetHeader, type WorkbenchWidgetHeaderProps } from './WorkbenchWidgetHeader';
3
3
  export { WorkbenchDockPopoverSurface, type WorkbenchDockPopoverSurfaceProps, } from './WorkbenchDockPopoverSurface';
4
4
  export { WorkbenchSurface, type WorkbenchSurfaceApi, type WorkbenchCreateAtOptions, type WorkbenchCreateWidgetOptions, type WorkbenchContextMenuItemsResolver, type WorkbenchSurfaceProps, } from './WorkbenchSurface';
5
- export type { WorkbenchDockAction, WorkbenchDockModeIcons, WorkbenchCanvasWidgetPlacement, WorkbenchDockCanvasPlacement, WorkbenchDockDropContext, WorkbenchDockItemPlacement, WorkbenchDockItemActivation, WorkbenchDockItemActivationMode, WorkbenchExternalDockDragController, WorkbenchExternalDockDragItem, WorkbenchHostDockItem, } from './WorkbenchFilterBar';
5
+ export type { WorkbenchDockAction, WorkbenchDockCustomization, WorkbenchDockEntry, WorkbenchDockModeIcons, WorkbenchCanvasWidgetPlacement, WorkbenchDockCanvasPlacement, WorkbenchDockDropContext, WorkbenchDockItemPlacement, WorkbenchDockItemActivation, WorkbenchDockItemActivationMode, WorkbenchExternalDockDragController, WorkbenchExternalDockDragItem, WorkbenchHostDockItem, } from './WorkbenchFilterBar';
6
6
  export type { BarItemContextMenuHandler, BarItemContextMenuRequest, BarItemContextMenuSource, } from '../layout/barItemContextMenu';
7
7
  export { WorkbenchContextMenu, type WorkbenchContextMenuItem, type WorkbenchContextMenuProps, } from './WorkbenchContextMenu';
8
8
  export { useWorkbenchModel, type UseWorkbenchModelOptions } from './useWorkbenchModel';
@@ -1,66 +1,67 @@
1
- import { createEffect as U, onCleanup as X } from "solid-js";
2
- import { lockBodyStyle as Y } from "../utils/bodyStyleLock.js";
3
- import { deferAfterPaint as I } from "../utils/defer.js";
4
- import { getFocusableElements as H, getFirstFocusableElement as Z } from "../utils/focus.js";
5
- import { matchKeybind as _ } from "../utils/keybind.js";
6
- const L = /* @__PURE__ */ new WeakMap();
7
- function A(t) {
1
+ import { createEffect as $, onCleanup as ee } from "solid-js";
2
+ import { lockBodyStyle as te } from "../utils/bodyStyleLock.js";
3
+ import { deferAfterPaint as N } from "../utils/defer.js";
4
+ import { getFocusableElements as q, getFirstFocusableElement as ne } from "../utils/focus.js";
5
+ import { matchKeybind as oe } from "../utils/keybind.js";
6
+ import { deepActiveElement as y, composedEventTarget as r, composedContains as M } from "../utils/domScope.js";
7
+ const T = /* @__PURE__ */ new WeakMap();
8
+ function z(t) {
8
9
  return typeof Node < "u" && t instanceof Node;
9
10
  }
10
- function E(t, o, c) {
11
- return c ? c(o) : !t || !A(o) ? !1 : t.contains(o);
11
+ function g(t, o, u) {
12
+ return u ? u(o) : !t || !z(o) ? !1 : M(t, o);
12
13
  }
13
- function W(t, o, c, l) {
14
- return c === "none" ? !1 : c === "all" ? !0 : !E(t, o, l);
14
+ function j(t, o, u, m) {
15
+ return u === "none" ? !1 : u === "all" ? !0 : !g(t, o, m);
15
16
  }
16
- function $(t) {
17
+ function re(t) {
17
18
  return typeof t == "function" ? t() ?? [] : t ?? [];
18
19
  }
19
- function i(t, o) {
20
+ function f(t, o) {
20
21
  return typeof t == "function" ? t() ?? o : t ?? o;
21
22
  }
22
- function ee(t, o) {
23
- for (const c of $(o)) {
24
- const l = c.trim();
25
- if (l && _(t, l))
23
+ function ce(t, o) {
24
+ for (const u of re(o)) {
25
+ const m = u.trim();
26
+ if (m && oe(t, m))
26
27
  return !0;
27
28
  }
28
29
  return !1;
29
30
  }
30
- function se(t) {
31
- const o = () => i(t.lockBodyScroll, !0), c = () => i(t.trapFocus, !0), l = () => {
32
- const d = i(
31
+ function me(t) {
32
+ const o = () => f(t.lockBodyScroll, !0), u = () => f(t.trapFocus, !0), m = () => {
33
+ const v = f(
33
34
  t.closeOnEscape,
34
35
  !0
35
36
  );
36
- return d === !1 ? "none" : d === "inside" ? "inside" : d === "none" ? "none" : "always";
37
- }, R = () => i(t.blockHotkeys, !0), N = () => i(t.restoreFocus, !0), q = () => i(t.blockWheel, "none"), j = () => i(t.blockTouchMove, "none"), z = () => i(t.autoFocus, !0);
38
- U(() => {
37
+ return v === !1 ? "none" : v === "inside" ? "inside" : v === "none" ? "none" : "always";
38
+ }, V = () => f(t.blockHotkeys, !0), G = () => f(t.restoreFocus, !0), J = () => f(t.blockWheel, "none"), Q = () => f(t.blockTouchMove, "none"), U = () => f(t.autoFocus, !0);
39
+ $(() => {
39
40
  if (!t.open() || typeof document > "u") return;
40
- const d = o(), O = c(), h = l(), y = i(t.escapeKeyPhase, "capture"), V = R(), G = N(), k = q(), b = j(), w = z(), m = L.get(document) ?? [];
41
- L.set(document, m);
42
- const v = {
43
- global: d || h === "always",
44
- contains: (e) => E(t.root(), e, t.containsTarget)
41
+ const v = o(), B = u(), p = m(), E = f(t.escapeKeyPhase, "capture"), X = V(), Y = G(), w = J(), L = Q(), O = U(), h = T.get(document) ?? [];
42
+ T.set(document, h);
43
+ const l = {
44
+ global: v || p === "always",
45
+ contains: (e) => g(t.root(), e, t.containsTarget)
45
46
  };
46
- m.push(v);
47
- let T = !0;
48
- const u = (e) => T && !m.slice(m.indexOf(v) + 1).some((n) => n.global || n.contains(e)), p = document.activeElement instanceof HTMLElement ? document.activeElement : null, J = d ? Y({ overflow: "hidden" }) : null;
49
- I(() => {
47
+ h.push(l);
48
+ let F = !0;
49
+ const s = (e) => F && !h.slice(h.indexOf(l) + 1).some((n) => n.global || n.contains(e)), C = y(document), k = C instanceof HTMLElement ? C : null, Z = v ? te({ overflow: "hidden" }) : null;
50
+ N(() => {
50
51
  const e = t.root();
51
- if (!e?.isConnected || !u(e) || w === !1 || v.contains(document.activeElement)) return;
52
- const n = typeof w == "object" ? w.selector : void 0, r = (n ? e.querySelector(n) : null) ?? e.querySelector("[data-floe-autofocus]") ?? Z(e) ?? e;
52
+ if (!e?.isConnected || !s(e) || O === !1 || l.contains(y(document))) return;
53
+ const n = typeof O == "object" ? O.selector : void 0, c = (n ? e.querySelector(n) : null) ?? e.querySelector("[data-floe-autofocus]") ?? ne(e) ?? e;
53
54
  try {
54
- r.focus({ preventScroll: !0 });
55
+ c.focus({ preventScroll: !0 });
55
56
  } catch {
56
57
  }
57
58
  });
58
- const M = (e) => {
59
- if (e.key !== "Tab" || !u(e.target)) return;
59
+ const S = (e) => {
60
+ if (e.key !== "Tab" || !s(r(e)) || !l.global && !l.contains(r(e))) return;
60
61
  const n = t.root();
61
62
  if (!n) return;
62
- const s = t.focusRoots?.() ?? [n], r = t.focusRoots ? [...new Set(s.flatMap(H))].filter((a) => a.tabIndex >= 0 && !a.closest('[hidden], [inert], [aria-hidden="true"]')) : H(n);
63
- if (!r.length) {
63
+ const a = t.focusRoots?.() ?? [n], c = t.focusRoots ? [...new Set(a.flatMap(q))].filter((i) => i.tabIndex >= 0 && !i.closest('[hidden], [inert], [aria-hidden="true"]')) : q(n);
64
+ if (!c.length) {
64
65
  e.preventDefault();
65
66
  try {
66
67
  n.focus();
@@ -68,36 +69,36 @@ function se(t) {
68
69
  }
69
70
  return;
70
71
  }
71
- const K = r[0], x = r[r.length - 1], f = document.activeElement instanceof HTMLElement ? document.activeElement : null;
72
+ const W = c[0], A = c[c.length - 1], R = y(document), d = R instanceof HTMLElement ? R : null;
72
73
  if (t.focusRoots) {
73
- const a = f ? r.indexOf(f) : -1, Q = a < 0 ? e.shiftKey ? r.length - 1 : 0 : (a + (e.shiftKey ? -1 : 1) + r.length) % r.length;
74
- e.preventDefault(), r[Q]?.focus({ preventScroll: !0 });
74
+ const i = d ? c.indexOf(d) : -1, _ = i < 0 ? e.shiftKey ? c.length - 1 : 0 : (i + (e.shiftKey ? -1 : 1) + c.length) % c.length;
75
+ e.preventDefault(), c[_]?.focus({ preventScroll: !0 });
75
76
  return;
76
77
  }
77
78
  if (e.shiftKey) {
78
- if (f === K || !f || !s.some((a) => a.contains(f))) {
79
+ if (d === W || !d || !a.some((i) => M(i, d))) {
79
80
  e.preventDefault();
80
81
  try {
81
- x.focus();
82
+ A.focus();
82
83
  } catch {
83
84
  }
84
85
  }
85
- } else if (f === x || !f || !s.some((a) => a.contains(f))) {
86
+ } else if (d === A || !d || !a.some((i) => M(i, d))) {
86
87
  e.preventDefault();
87
88
  try {
88
- K.focus();
89
+ W.focus();
89
90
  } catch {
90
91
  }
91
92
  }
92
- }, B = (e) => {
93
- if (e.key !== "Escape" || !u(e.target) || y === "bubble" && (e.defaultPrevented || e.isComposing) || h === "none") return;
94
- const n = t.root(), s = E(
93
+ }, P = (e) => {
94
+ if (e.key !== "Escape" || !s(r(e)) || E === "bubble" && (e.defaultPrevented || e.isComposing) || p === "none") return;
95
+ const n = t.root(), a = g(
95
96
  n,
96
- A(e.target) ? e.target : document.activeElement,
97
+ z(r(e)) ? r(e) : y(document),
97
98
  t.containsTarget
98
99
  );
99
- if (h === "inside") {
100
- if (s) {
100
+ if (p === "inside") {
101
+ if (a) {
101
102
  e.preventDefault(), e.stopImmediatePropagation(), t.onClose?.();
102
103
  return;
103
104
  }
@@ -105,43 +106,43 @@ function se(t) {
105
106
  return;
106
107
  }
107
108
  e.preventDefault(), e.stopImmediatePropagation(), t.onClose?.();
108
- }, F = (e) => {
109
- if (!u(e.target)) return;
109
+ }, D = (e) => {
110
+ if (!s(r(e))) return;
110
111
  const n = t.root();
111
- n && V && E(n, e.target, t.containsTarget) && (ee(e, t.allowHotkeys) || e.stopPropagation());
112
- }, S = (e) => {
113
- if (!u(e.target)) return;
112
+ n && X && g(n, r(e), t.containsTarget) && (ce(e, t.allowHotkeys) || e.stopPropagation());
113
+ }, K = (e) => {
114
+ if (!s(r(e))) return;
114
115
  const n = t.root();
115
- W(n, e.target, k, t.containsTarget) && e.cancelable && e.preventDefault();
116
- }, C = (e) => {
117
- u(e.target) && e.stopPropagation();
118
- }, P = (e) => {
119
- if (!u(e.target)) return;
116
+ j(n, r(e), w, t.containsTarget) && e.cancelable && e.preventDefault();
117
+ }, x = (e) => {
118
+ s(r(e)) && e.stopPropagation();
119
+ }, I = (e) => {
120
+ if (!s(r(e))) return;
120
121
  const n = t.root();
121
- W(n, e.target, b, t.containsTarget) && e.cancelable && e.preventDefault();
122
- }, g = (e) => {
123
- e.composedPath().some((s) => !u(s) || v.contains(s)) || u(e.target) && !v.contains(e.target) && t.onInteractOutside?.(e);
122
+ j(n, r(e), L, t.containsTarget) && e.cancelable && e.preventDefault();
123
+ }, b = (e) => {
124
+ e.composedPath().some((a) => !s(a) || l.contains(a)) || s(e.target) && !l.contains(e.target) && t.onInteractOutside?.(e);
124
125
  };
125
- t.onInteractOutside && (document.addEventListener("pointerdown", g, !0), document.addEventListener("focusin", g)), O && document.addEventListener("keydown", M, !0);
126
- const D = y === "capture" ? window : document;
127
- h !== "none" && D.addEventListener(
126
+ t.onInteractOutside && (document.addEventListener("pointerdown", b, !0), document.addEventListener("focusin", b)), B && document.addEventListener("keydown", S, !0);
127
+ const H = E === "capture" ? window : document;
128
+ p !== "none" && H.addEventListener(
128
129
  "keydown",
129
- B,
130
- y === "capture"
131
- ), document.addEventListener("keydown", F), k !== "none" && (document.addEventListener("wheel", S, { capture: !0, passive: !1 }), document.addEventListener("wheel", C)), b !== "none" && document.addEventListener("touchmove", P, {
130
+ P,
131
+ E === "capture"
132
+ ), document.addEventListener("keydown", D), w !== "none" && (document.addEventListener("wheel", K, { capture: !0, passive: !1 }), document.addEventListener("wheel", x)), L !== "none" && document.addEventListener("touchmove", I, {
132
133
  capture: !0,
133
134
  passive: !1
134
- }), X(() => {
135
- T = !1, document.removeEventListener("pointerdown", g, !0), document.removeEventListener("focusin", g), m.splice(m.indexOf(v), 1), O && document.removeEventListener("keydown", M, !0), h !== "none" && D.removeEventListener(
135
+ }), ee(() => {
136
+ F = !1, document.removeEventListener("pointerdown", b, !0), document.removeEventListener("focusin", b), h.splice(h.indexOf(l), 1), B && document.removeEventListener("keydown", S, !0), p !== "none" && H.removeEventListener(
136
137
  "keydown",
137
- B,
138
- y === "capture"
139
- ), document.removeEventListener("keydown", F), k !== "none" && (document.removeEventListener("wheel", S, !0), document.removeEventListener("wheel", C)), b !== "none" && document.removeEventListener("touchmove", P, !0), J?.(), G && p && p.isConnected && I(() => {
140
- if (typeof document > "u" || L.get(document)?.some((n) => !n.contains(p))) return;
141
- const e = document.activeElement;
138
+ P,
139
+ E === "capture"
140
+ ), document.removeEventListener("keydown", D), w !== "none" && (document.removeEventListener("wheel", K, !0), document.removeEventListener("wheel", x)), L !== "none" && document.removeEventListener("touchmove", I, !0), Z?.(), Y && k && k.isConnected && N(() => {
141
+ if (typeof document > "u" || T.get(document)?.some((n) => !n.contains(k))) return;
142
+ const e = y(document);
142
143
  if (!(e && e !== document.body && e !== document.documentElement))
143
144
  try {
144
- p.focus({ preventScroll: !0 });
145
+ k.focus({ preventScroll: !0 });
145
146
  } catch {
146
147
  }
147
148
  });
@@ -149,5 +150,5 @@ function se(t) {
149
150
  });
150
151
  }
151
152
  export {
152
- se as useOverlayMask
153
+ me as useOverlayMask
153
154
  };
@@ -0,0 +1,6 @@
1
+ /** Resolve the actual control while document listeners see a retargeted shadow host. */
2
+ export declare function composedEventTarget(event: Event): EventTarget | null;
3
+ export declare function deepActiveElement(root: Document | ShadowRoot): Element | null;
4
+ export declare function composedParent(node: Node): Node | null;
5
+ export declare function composedContains(root: Node, target: EventTarget | null): boolean;
6
+ export declare function composedClosest(target: EventTarget | null, selector: string): Element | null;
@@ -0,0 +1,30 @@
1
+ function i(e) {
2
+ return e.composedPath()[0] ?? e.target;
3
+ }
4
+ function r(e) {
5
+ let n = e.activeElement;
6
+ for (; n?.shadowRoot?.activeElement; ) n = n.shadowRoot.activeElement;
7
+ return n;
8
+ }
9
+ function o(e) {
10
+ return e instanceof Element && e.assignedSlot ? e.assignedSlot : e.parentNode ?? (e instanceof ShadowRoot ? e.host : null);
11
+ }
12
+ function l(e, n) {
13
+ if (typeof Node > "u") return !1;
14
+ for (let t = n instanceof Node ? n : null; t; t = o(t))
15
+ if (t === e) return !0;
16
+ return !1;
17
+ }
18
+ function f(e, n) {
19
+ if (typeof Node > "u") return null;
20
+ for (let t = e instanceof Node ? e : null; t; t = o(t))
21
+ if (t instanceof Element && t.matches(n)) return t;
22
+ return null;
23
+ }
24
+ export {
25
+ f as composedClosest,
26
+ l as composedContains,
27
+ i as composedEventTarget,
28
+ o as composedParent,
29
+ r as deepActiveElement
30
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-core",
3
- "version": "0.101.29",
3
+ "version": "0.101.33",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",