@floegence/floe-webapp-core 0.36.23 → 0.36.25
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.
- package/dist/components/ui/index.d.ts +1 -1
- package/dist/components/ui/localInteractionSurface.d.ts +5 -1
- package/dist/components/ui/localInteractionSurface.js +67 -63
- package/dist/components/workbench/WorkbenchSurface.js +140 -119
- package/dist/components/workbench/WorkbenchWidget.js +252 -226
- package/dist/components/workbench/types.d.ts +1 -1
- package/dist/components/workbench/workbenchInteractionAdapter.js +61 -52
- package/dist/full.js +546 -543
- package/dist/ui.js +124 -121
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ export type BuiltinWorkbenchWidgetType = 'terminal' | 'file-browser' | 'system-m
|
|
|
5
5
|
export type WorkbenchWidgetType = BuiltinWorkbenchWidgetType | (string & {});
|
|
6
6
|
export declare const WORKBENCH_WIDGET_TYPES: readonly WorkbenchWidgetType[];
|
|
7
7
|
export type WorkbenchWidgetRenderMode = 'canvas_scaled' | 'projected_surface';
|
|
8
|
-
export type WorkbenchCanvasOwnerReason = 'initial' | 'background_pointer' | 'background_focus' | (string & {});
|
|
8
|
+
export type WorkbenchCanvasOwnerReason = 'initial' | 'background_pointer' | 'background_focus' | 'selection_cleared' | (string & {});
|
|
9
9
|
export type WorkbenchWidgetOwnerReason = 'pointer' | 'focus' | 'activation' | (string & {});
|
|
10
10
|
export type WorkbenchInputOwner = {
|
|
11
11
|
kind: 'canvas';
|
|
@@ -1,103 +1,112 @@
|
|
|
1
|
-
import { isTypingElement as
|
|
2
|
-
import { DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
1
|
+
import { isTypingElement as E } from "../../utils/dom.js";
|
|
2
|
+
import { DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR as R, resolveWorkbenchWidgetEventOwnership as v, DEFAULT_WORKBENCH_WIDGET_SHELL_SELECTOR as _, resolveSurfaceInteractionTargetRole as T, resolveSurfaceWheelRouting as A } from "../ui/localInteractionSurface.js";
|
|
3
|
+
const m = "data-floe-workbench-surface-root", a = "data-floe-workbench-widget-root", s = "data-floe-workbench-widget-id", h = "data-floe-dialog-surface-host";
|
|
4
|
+
function W(e) {
|
|
5
5
|
return typeof Element < "u" && e instanceof Element ? e : typeof Node < "u" && e instanceof Node ? e.parentElement : null;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
const r = (e?.getAttribute(
|
|
7
|
+
function S(e, n = s) {
|
|
8
|
+
const r = (e?.getAttribute(n) ?? "").trim();
|
|
9
9
|
return r.length > 0 ? r : null;
|
|
10
10
|
}
|
|
11
|
-
function O(e,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
function O(e, n = a) {
|
|
12
|
+
const o = W(e);
|
|
13
|
+
if (!o) return null;
|
|
14
|
+
const r = o.closest(`[${n}="true"]`);
|
|
15
|
+
return r instanceof HTMLElement ? r : null;
|
|
15
16
|
}
|
|
16
17
|
function k(e) {
|
|
17
18
|
const {
|
|
18
|
-
root:
|
|
19
|
+
root: n,
|
|
19
20
|
widgetId: o,
|
|
20
21
|
widgetRootAttr: r = a,
|
|
21
|
-
readWidgetId: c = (i) =>
|
|
22
|
+
readWidgetId: c = (i) => S(i, s)
|
|
22
23
|
} = e;
|
|
23
|
-
if (!
|
|
24
|
-
const l =
|
|
24
|
+
if (!n || typeof n.querySelectorAll != "function") return null;
|
|
25
|
+
const l = n.querySelectorAll(`[${r}="true"]`);
|
|
25
26
|
for (const i of l)
|
|
26
27
|
if (i instanceof HTMLElement && c(i) === o)
|
|
27
28
|
return i;
|
|
28
29
|
return null;
|
|
29
30
|
}
|
|
30
31
|
function b(e) {
|
|
31
|
-
const
|
|
32
|
-
return
|
|
32
|
+
const n = k(e);
|
|
33
|
+
return n ? (n.focus({ preventScroll: !0 }), !0) : !1;
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
+
function g(e) {
|
|
35
36
|
return { kind: "canvas", reason: e };
|
|
36
37
|
}
|
|
37
|
-
function
|
|
38
|
-
return { kind: "widget", widgetId: e, reason:
|
|
38
|
+
function p(e, n) {
|
|
39
|
+
return { kind: "widget", widgetId: e, reason: n };
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
-
const
|
|
41
|
+
function C(e) {
|
|
42
|
+
const n = e.findWidgetRoot(e.target);
|
|
43
|
+
if (n) {
|
|
44
|
+
const r = e.readWidgetId(n);
|
|
45
|
+
return r !== null && r === e.selectedWidgetId ? { kind: "local_surface", reason: "selected_widget" } : e.disablePanZoom ? { kind: "ignore", reason: "pan_zoom_disabled" } : { kind: "canvas_zoom" };
|
|
46
|
+
}
|
|
47
|
+
const o = A({
|
|
42
48
|
target: e.target,
|
|
43
49
|
disablePanZoom: e.disablePanZoom,
|
|
44
50
|
wheelInteractiveSelector: e.wheelInteractiveSelector
|
|
45
51
|
});
|
|
46
|
-
return
|
|
52
|
+
return o.kind === "canvas_zoom" ? o : o.kind === "local_surface" ? { kind: "local_surface", reason: o.reason } : { kind: "ignore", reason: o.reason };
|
|
47
53
|
}
|
|
48
54
|
function D(e) {
|
|
49
|
-
const
|
|
50
|
-
root:
|
|
55
|
+
const n = e?.surfaceRootAttr ?? m, o = e?.widgetRootAttr ?? a, r = e?.widgetIdAttr ?? s, c = e?.dialogSurfaceHostAttr ?? h, l = e?.interactiveSelector ?? '[data-floe-canvas-interactive="true"]', i = e?.panSurfaceSelector ?? '[data-floe-canvas-pan-surface="true"]', w = e?.wheelInteractiveSelector ?? R, d = e?.readWidgetId ?? ((t) => S(t, r)), f = e?.findWidgetRoot ?? ((t) => O(t, o)), I = e?.focusWidgetElement ?? ((t, u) => b({
|
|
56
|
+
root: t,
|
|
51
57
|
widgetId: u,
|
|
52
58
|
widgetRootAttr: o,
|
|
53
|
-
readWidgetId:
|
|
59
|
+
readWidgetId: d
|
|
54
60
|
}));
|
|
55
61
|
return {
|
|
56
62
|
...e,
|
|
57
|
-
surfaceRootAttr:
|
|
63
|
+
surfaceRootAttr: n,
|
|
58
64
|
widgetRootAttr: o,
|
|
59
65
|
widgetIdAttr: r,
|
|
60
66
|
dialogSurfaceHostAttr: c,
|
|
61
67
|
interactiveSelector: l,
|
|
62
68
|
panSurfaceSelector: i,
|
|
63
|
-
wheelInteractiveSelector:
|
|
64
|
-
createInitialInputOwner: e?.createInitialInputOwner ?? (() =>
|
|
65
|
-
createCanvasInputOwner: e?.createCanvasInputOwner ??
|
|
66
|
-
createWidgetInputOwner: e?.createWidgetInputOwner ??
|
|
67
|
-
readWidgetId:
|
|
68
|
-
findWidgetRoot:
|
|
69
|
-
focusWidgetElement:
|
|
70
|
-
resolveSurfaceTargetRole: e?.resolveSurfaceTargetRole ?? ((
|
|
71
|
-
target:
|
|
72
|
-
interactiveSelector:
|
|
73
|
-
panSurfaceSelector:
|
|
69
|
+
wheelInteractiveSelector: w,
|
|
70
|
+
createInitialInputOwner: e?.createInitialInputOwner ?? (() => g("initial")),
|
|
71
|
+
createCanvasInputOwner: e?.createCanvasInputOwner ?? g,
|
|
72
|
+
createWidgetInputOwner: e?.createWidgetInputOwner ?? p,
|
|
73
|
+
readWidgetId: d,
|
|
74
|
+
findWidgetRoot: f,
|
|
75
|
+
focusWidgetElement: I,
|
|
76
|
+
resolveSurfaceTargetRole: e?.resolveSurfaceTargetRole ?? ((t) => T({
|
|
77
|
+
target: t.target,
|
|
78
|
+
interactiveSelector: t.interactiveSelector,
|
|
79
|
+
panSurfaceSelector: t.panSurfaceSelector
|
|
74
80
|
})),
|
|
75
|
-
resolveWidgetEventOwnership: e?.resolveWidgetEventOwnership ?? ((
|
|
76
|
-
target:
|
|
77
|
-
widgetRoot:
|
|
78
|
-
interactiveSelector:
|
|
79
|
-
panSurfaceSelector:
|
|
80
|
-
shellSelector:
|
|
81
|
+
resolveWidgetEventOwnership: e?.resolveWidgetEventOwnership ?? ((t) => v({
|
|
82
|
+
target: t.target,
|
|
83
|
+
widgetRoot: t.widgetRoot,
|
|
84
|
+
interactiveSelector: t.interactiveSelector,
|
|
85
|
+
panSurfaceSelector: t.panSurfaceSelector,
|
|
86
|
+
shellSelector: _
|
|
81
87
|
})),
|
|
82
|
-
resolveWheelRouting: e?.resolveWheelRouting ?? ((
|
|
83
|
-
target:
|
|
84
|
-
disablePanZoom:
|
|
85
|
-
|
|
88
|
+
resolveWheelRouting: e?.resolveWheelRouting ?? ((t) => C({
|
|
89
|
+
target: t.target,
|
|
90
|
+
disablePanZoom: t.disablePanZoom,
|
|
91
|
+
selectedWidgetId: t.selectedWidgetId,
|
|
92
|
+
wheelInteractiveSelector: t.wheelInteractiveSelector,
|
|
93
|
+
findWidgetRoot: f,
|
|
94
|
+
readWidgetId: d
|
|
86
95
|
})),
|
|
87
|
-
shouldBypassGlobalHotkeys: e?.shouldBypassGlobalHotkeys ?? ((
|
|
88
|
-
const u =
|
|
89
|
-
return
|
|
96
|
+
shouldBypassGlobalHotkeys: e?.shouldBypassGlobalHotkeys ?? ((t) => {
|
|
97
|
+
const u = W(t.target);
|
|
98
|
+
return E(u);
|
|
90
99
|
})
|
|
91
100
|
};
|
|
92
101
|
}
|
|
93
102
|
export {
|
|
94
103
|
h as DEFAULT_WORKBENCH_DIALOG_SURFACE_HOST_ATTR,
|
|
95
|
-
|
|
104
|
+
m as DEFAULT_WORKBENCH_SURFACE_ROOT_ATTR,
|
|
96
105
|
s as DEFAULT_WORKBENCH_WIDGET_ID_ATTR,
|
|
97
106
|
a as DEFAULT_WORKBENCH_WIDGET_ROOT_ATTR,
|
|
98
107
|
k as findWorkbenchWidgetElement,
|
|
99
108
|
O as findWorkbenchWidgetRoot,
|
|
100
109
|
b as focusWorkbenchWidgetElement,
|
|
101
|
-
|
|
110
|
+
S as readWorkbenchWidgetId,
|
|
102
111
|
D as resolveWorkbenchInteractionAdapter
|
|
103
112
|
};
|