@floegence/floe-webapp-core 0.36.17 → 0.36.19
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/InfiniteCanvas.d.ts +17 -0
- package/dist/components/ui/InfiniteCanvas.js +38 -38
- package/dist/components/ui/index.d.ts +1 -1
- package/dist/components/ui/localInteractionSurface.d.ts +2 -0
- package/dist/components/ui/localInteractionSurface.js +51 -26
- package/dist/components/workbench/WorkbenchCanvas.d.ts +5 -1
- package/dist/components/workbench/WorkbenchCanvas.js +79 -40
- package/dist/components/workbench/WorkbenchCanvasField.d.ts +5 -1
- package/dist/components/workbench/WorkbenchCanvasField.js +82 -63
- package/dist/components/workbench/WorkbenchSurface.d.ts +13 -1
- package/dist/components/workbench/WorkbenchSurface.js +222 -130
- package/dist/components/workbench/WorkbenchWidget.d.ts +5 -1
- package/dist/components/workbench/WorkbenchWidget.js +155 -123
- package/dist/components/workbench/types.d.ts +66 -0
- package/dist/components/workbench/workbenchInteractionAdapter.d.ts +39 -0
- package/dist/components/workbench/workbenchInteractionAdapter.js +103 -0
- package/dist/full.js +463 -462
- package/dist/ui.js +102 -101
- package/package.json +1 -1
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { isTypingElement as R } from "../../utils/dom.js";
|
|
2
|
+
import { DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR as v, resolveWorkbenchWidgetEventOwnership as W, DEFAULT_WORKBENCH_WIDGET_SHELL_SELECTOR as I, resolveSurfaceInteractionTargetRole as T, resolveSurfaceWheelRouting as A } from "../ui/localInteractionSurface.js";
|
|
3
|
+
const _ = "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 m(e) {
|
|
5
|
+
return typeof Element < "u" && e instanceof Element ? e : typeof Node < "u" && e instanceof Node ? e.parentElement : null;
|
|
6
|
+
}
|
|
7
|
+
function g(e, t = s) {
|
|
8
|
+
const r = (e?.getAttribute(t) ?? "").trim();
|
|
9
|
+
return r.length > 0 ? r : null;
|
|
10
|
+
}
|
|
11
|
+
function O(e, t = a) {
|
|
12
|
+
if (!(e instanceof Element)) return null;
|
|
13
|
+
const o = e.closest(`[${t}="true"]`);
|
|
14
|
+
return o instanceof HTMLElement ? o : null;
|
|
15
|
+
}
|
|
16
|
+
function k(e) {
|
|
17
|
+
const {
|
|
18
|
+
root: t,
|
|
19
|
+
widgetId: o,
|
|
20
|
+
widgetRootAttr: r = a,
|
|
21
|
+
readWidgetId: c = (i) => g(i, s)
|
|
22
|
+
} = e;
|
|
23
|
+
if (!t || typeof t.querySelectorAll != "function") return null;
|
|
24
|
+
const l = t.querySelectorAll(`[${r}="true"]`);
|
|
25
|
+
for (const i of l)
|
|
26
|
+
if (i instanceof HTMLElement && c(i) === o)
|
|
27
|
+
return i;
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
function b(e) {
|
|
31
|
+
const t = k(e);
|
|
32
|
+
return t ? (t.focus({ preventScroll: !0 }), !0) : !1;
|
|
33
|
+
}
|
|
34
|
+
function d(e) {
|
|
35
|
+
return { kind: "canvas", reason: e };
|
|
36
|
+
}
|
|
37
|
+
function C(e, t) {
|
|
38
|
+
return { kind: "widget", widgetId: e, reason: t };
|
|
39
|
+
}
|
|
40
|
+
function H(e) {
|
|
41
|
+
const t = A({
|
|
42
|
+
target: e.target,
|
|
43
|
+
disablePanZoom: e.disablePanZoom,
|
|
44
|
+
wheelInteractiveSelector: e.wheelInteractiveSelector
|
|
45
|
+
});
|
|
46
|
+
return t.kind === "canvas_zoom" ? t : t.kind === "local_surface" ? { kind: "local_surface", reason: t.reason } : { kind: "ignore", reason: t.reason };
|
|
47
|
+
}
|
|
48
|
+
function D(e) {
|
|
49
|
+
const t = e?.surfaceRootAttr ?? _, 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"]', S = e?.wheelInteractiveSelector ?? v, f = e?.readWidgetId ?? ((n) => g(n, r)), E = e?.findWidgetRoot ?? ((n) => O(n, o)), w = e?.focusWidgetElement ?? ((n, u) => b({
|
|
50
|
+
root: n,
|
|
51
|
+
widgetId: u,
|
|
52
|
+
widgetRootAttr: o,
|
|
53
|
+
readWidgetId: f
|
|
54
|
+
}));
|
|
55
|
+
return {
|
|
56
|
+
...e,
|
|
57
|
+
surfaceRootAttr: t,
|
|
58
|
+
widgetRootAttr: o,
|
|
59
|
+
widgetIdAttr: r,
|
|
60
|
+
dialogSurfaceHostAttr: c,
|
|
61
|
+
interactiveSelector: l,
|
|
62
|
+
panSurfaceSelector: i,
|
|
63
|
+
wheelInteractiveSelector: S,
|
|
64
|
+
createInitialInputOwner: e?.createInitialInputOwner ?? (() => d("initial")),
|
|
65
|
+
createCanvasInputOwner: e?.createCanvasInputOwner ?? d,
|
|
66
|
+
createWidgetInputOwner: e?.createWidgetInputOwner ?? C,
|
|
67
|
+
readWidgetId: f,
|
|
68
|
+
findWidgetRoot: E,
|
|
69
|
+
focusWidgetElement: w,
|
|
70
|
+
resolveSurfaceTargetRole: e?.resolveSurfaceTargetRole ?? ((n) => T({
|
|
71
|
+
target: n.target,
|
|
72
|
+
interactiveSelector: n.interactiveSelector,
|
|
73
|
+
panSurfaceSelector: n.panSurfaceSelector
|
|
74
|
+
})),
|
|
75
|
+
resolveWidgetEventOwnership: e?.resolveWidgetEventOwnership ?? ((n) => W({
|
|
76
|
+
target: n.target,
|
|
77
|
+
widgetRoot: n.widgetRoot,
|
|
78
|
+
interactiveSelector: n.interactiveSelector,
|
|
79
|
+
panSurfaceSelector: n.panSurfaceSelector,
|
|
80
|
+
shellSelector: I
|
|
81
|
+
})),
|
|
82
|
+
resolveWheelRouting: e?.resolveWheelRouting ?? ((n) => H({
|
|
83
|
+
target: n.target,
|
|
84
|
+
disablePanZoom: n.disablePanZoom,
|
|
85
|
+
wheelInteractiveSelector: n.wheelInteractiveSelector
|
|
86
|
+
})),
|
|
87
|
+
shouldBypassGlobalHotkeys: e?.shouldBypassGlobalHotkeys ?? ((n) => {
|
|
88
|
+
const u = m(n.target);
|
|
89
|
+
return R(u);
|
|
90
|
+
})
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
export {
|
|
94
|
+
h as DEFAULT_WORKBENCH_DIALOG_SURFACE_HOST_ATTR,
|
|
95
|
+
_ as DEFAULT_WORKBENCH_SURFACE_ROOT_ATTR,
|
|
96
|
+
s as DEFAULT_WORKBENCH_WIDGET_ID_ATTR,
|
|
97
|
+
a as DEFAULT_WORKBENCH_WIDGET_ROOT_ATTR,
|
|
98
|
+
k as findWorkbenchWidgetElement,
|
|
99
|
+
O as findWorkbenchWidgetRoot,
|
|
100
|
+
b as focusWorkbenchWidgetElement,
|
|
101
|
+
g as readWorkbenchWidgetId,
|
|
102
|
+
D as resolveWorkbenchInteractionAdapter
|
|
103
|
+
};
|