@floegence/floe-webapp-core 0.103.4 → 0.103.6
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/layout/BottomBarCompanion.d.ts +2 -1
- package/dist/components/layout/BottomBarCompanion.js +113 -103
- package/dist/components/layout/DisplayModePageShell.d.ts +1 -0
- package/dist/components/layout/DisplayModePageShell.js +10 -7
- package/dist/components/layout/Shell.d.ts +1 -0
- package/dist/components/layout/Shell.js +20 -17
- package/dist/components/layout/TopBar.d.ts +1 -0
- package/dist/components/layout/TopBar.js +51 -30
- package/dist/components/ui/InfiniteCanvas.js +89 -90
- package/dist/context/ViewActivationContext.d.ts +1 -0
- package/dist/context/ViewActivationContext.js +13 -9
- package/dist/styles.css +1 -1
- package/dist/ui.css +6 -1
- package/package.json +1 -1
|
@@ -1,41 +1,44 @@
|
|
|
1
|
-
import { spread as
|
|
2
|
-
import { createSignal as
|
|
3
|
-
import { cn as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function Se(t, s, i) {
|
|
1
|
+
import { spread as G, mergeProps as J, insert as x, effect as K, className as Q, setStyleProperty as ee, template as te, use as ne } from "solid-js/web";
|
|
2
|
+
import { createSignal as D, untrack as y, createMemo as re, createEffect as R, onCleanup as Y } from "solid-js";
|
|
3
|
+
import { cn as F } from "../../utils/cn.js";
|
|
4
|
+
import { resolveSurfaceInteractionTargetRole as oe, resolveSurfaceWheelRouting as ae, DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR as ie } from "./localInteractionSurface.js";
|
|
5
|
+
import { startPointerSession as ce } from "./pointerSession.js";
|
|
6
|
+
import { clientToCanvasLocal as M, localToCanvasWorld as le, createViewportFromZoomAnchor as se } from "./canvasGeometry.js";
|
|
7
|
+
import { SURFACE_PORTAL_LAYER_ATTR as ue } from "./dialogSurfaceScope.js";
|
|
8
|
+
var de = /* @__PURE__ */ te('<div><div style="transform-origin:0 0">');
|
|
9
|
+
const fe = 1, me = 0.45, we = 2.2, ve = 14e-4, Se = '[data-floe-canvas-pan-surface="true"]', I = 3;
|
|
10
|
+
function pe(t, s, i) {
|
|
12
11
|
return Math.max(s, Math.min(i, t));
|
|
13
12
|
}
|
|
14
|
-
function
|
|
13
|
+
function X(t) {
|
|
15
14
|
return {
|
|
16
15
|
x: Number.isFinite(t.x) ? t.x : 0,
|
|
17
16
|
y: Number.isFinite(t.y) ? t.y : 0,
|
|
18
|
-
scale: Number.isFinite(t.scale) && t.scale > 0 ? t.scale :
|
|
17
|
+
scale: Number.isFinite(t.scale) && t.scale > 0 ? t.scale : fe
|
|
19
18
|
};
|
|
20
19
|
}
|
|
21
|
-
function
|
|
20
|
+
function Ee(t, s) {
|
|
22
21
|
return t.deltaMode === 1 ? t.deltaY * 16 : t.deltaMode === 2 ? t.deltaY * (s?.clientHeight ?? window.innerHeight) : t.deltaY;
|
|
23
22
|
}
|
|
24
|
-
function
|
|
23
|
+
function Ae(t) {
|
|
25
24
|
let s = !1;
|
|
26
|
-
const [i,
|
|
25
|
+
const [i, w] = D(y(() => X(t.viewport))), [v, E] = D(null), k = re(() => {
|
|
27
26
|
const e = t.children;
|
|
28
27
|
return typeof e == "function" ? e(i) : e;
|
|
29
28
|
});
|
|
30
|
-
let l, d,
|
|
31
|
-
const
|
|
32
|
-
|
|
29
|
+
let l, d, S, p;
|
|
30
|
+
const L = () => {
|
|
31
|
+
p = void 0, S && w(S), S = void 0;
|
|
32
|
+
};
|
|
33
|
+
let f, m = !1, u;
|
|
34
|
+
const V = () => t.interactiveSelector ?? '[data-floe-canvas-interactive="true"]', N = () => t.panSurfaceSelector ?? Se, U = () => t.wheelInteractiveSelector ?? ie, W = () => t.minScale ?? me, Z = () => t.maxScale ?? we, H = () => t.wheelZoomSpeed ?? ve, O = () => {
|
|
35
|
+
const e = v();
|
|
33
36
|
return e ? e.startedFromPanSurface ? e.moved : !0 : !1;
|
|
34
|
-
},
|
|
37
|
+
}, C = () => {
|
|
35
38
|
f !== void 0 && (window.clearTimeout(f), f = void 0);
|
|
36
39
|
}, g = () => {
|
|
37
40
|
m = !1, u !== void 0 && (window.clearTimeout(u), u = void 0);
|
|
38
|
-
},
|
|
41
|
+
}, $ = () => {
|
|
39
42
|
if (typeof window > "u") {
|
|
40
43
|
m = !1;
|
|
41
44
|
return;
|
|
@@ -43,34 +46,34 @@ function Te(t) {
|
|
|
43
46
|
u !== void 0 && window.clearTimeout(u), u = window.setTimeout(() => {
|
|
44
47
|
u = void 0, m = !1;
|
|
45
48
|
}, 0);
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
+
}, h = (e) => {
|
|
50
|
+
y(() => t.onViewportChange?.(e));
|
|
51
|
+
}, z = (e) => {
|
|
49
52
|
if (typeof window > "u") {
|
|
50
|
-
|
|
53
|
+
h(e);
|
|
51
54
|
return;
|
|
52
55
|
}
|
|
53
|
-
|
|
54
|
-
f = void 0,
|
|
56
|
+
C(), f = window.setTimeout(() => {
|
|
57
|
+
f = void 0, h(e);
|
|
55
58
|
}, 90);
|
|
56
|
-
},
|
|
59
|
+
}, P = (e) => (t.resolveTargetRole ?? oe)({
|
|
57
60
|
target: e,
|
|
58
|
-
interactiveSelector:
|
|
59
|
-
panSurfaceSelector:
|
|
60
|
-
}),
|
|
61
|
-
const e =
|
|
61
|
+
interactiveSelector: V(),
|
|
62
|
+
panSurfaceSelector: N()
|
|
63
|
+
}), B = () => {
|
|
64
|
+
const e = v();
|
|
62
65
|
if (!e) return;
|
|
63
|
-
|
|
66
|
+
p !== void 0 && window.cancelAnimationFrame(p), L();
|
|
64
67
|
const n = i();
|
|
65
|
-
|
|
68
|
+
E(null), d = void 0, e.startedFromPanSurface && e.moved && (m = !0, $()), h(n);
|
|
66
69
|
};
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}),
|
|
70
|
+
R(() => {
|
|
71
|
+
v() || w(X(t.viewport));
|
|
72
|
+
}), R(() => {
|
|
70
73
|
const e = l;
|
|
71
74
|
if (!e) return;
|
|
72
75
|
const n = (o) => {
|
|
73
|
-
!m ||
|
|
76
|
+
!m || P(o.target) !== "pan_surface" || (g(), o.preventDefault(), o.stopPropagation());
|
|
74
77
|
}, a = (o) => {
|
|
75
78
|
o.code !== "Space" || o.isComposing || o.target instanceof Element && o.target.closest('input, textarea, select, [contenteditable="true"], [contenteditable="plaintext-only"]') || (s = !0, e.contains(o.target) && o.preventDefault());
|
|
76
79
|
}, r = () => {
|
|
@@ -78,96 +81,92 @@ function Te(t) {
|
|
|
78
81
|
};
|
|
79
82
|
document.addEventListener("keydown", a), document.addEventListener("keyup", r), window.addEventListener("blur", r);
|
|
80
83
|
const c = (o) => {
|
|
81
|
-
(o.button === 1 || o.button === 0 && s) &&
|
|
84
|
+
(o.button === 1 || o.button === 0 && s) && _(o);
|
|
82
85
|
};
|
|
83
|
-
e.addEventListener("pointerdown", c, !0), e.addEventListener("click", n, !0), e.addEventListener("wheel",
|
|
86
|
+
e.addEventListener("pointerdown", c, !0), e.addEventListener("click", n, !0), e.addEventListener("wheel", T, {
|
|
84
87
|
passive: !1
|
|
85
|
-
}),
|
|
86
|
-
document.removeEventListener("keydown", a), document.removeEventListener("keyup", r), window.removeEventListener("blur", r), e.removeEventListener("pointerdown", c, !0), e.removeEventListener("click", n, !0), e.removeEventListener("wheel",
|
|
88
|
+
}), Y(() => {
|
|
89
|
+
document.removeEventListener("keydown", a), document.removeEventListener("keyup", r), window.removeEventListener("blur", r), e.removeEventListener("pointerdown", c, !0), e.removeEventListener("click", n, !0), e.removeEventListener("wheel", T);
|
|
87
90
|
});
|
|
88
|
-
}),
|
|
89
|
-
|
|
91
|
+
}), Y(() => {
|
|
92
|
+
C(), d?.stop({
|
|
90
93
|
reason: "manual_stop",
|
|
91
94
|
commit: !0
|
|
92
95
|
}), d = void 0, g();
|
|
93
96
|
});
|
|
94
|
-
const
|
|
97
|
+
const _ = (e) => {
|
|
95
98
|
const n = e.button === 1 || e.button === 0 && s;
|
|
96
99
|
if (e.button !== 0 && e.button !== 1) return;
|
|
97
|
-
const a = n ? "canvas" :
|
|
100
|
+
const a = n ? "canvas" : P(e.target);
|
|
98
101
|
if (a === "canvas" && t.onCanvasPointerDown?.(e), t.disablePanZoom) return;
|
|
99
102
|
n && e.stopPropagation();
|
|
100
103
|
const r = a === "pan_surface";
|
|
101
|
-
a !== "local_surface" && (
|
|
104
|
+
a !== "local_surface" && (C(), g(), r || (t.onViewportInteractionStart?.("pan"), e.preventDefault()), d?.stop({
|
|
102
105
|
reason: "manual_stop",
|
|
103
106
|
commit: !0
|
|
104
|
-
}),
|
|
107
|
+
}), E({
|
|
105
108
|
pointerId: e.pointerId,
|
|
106
109
|
startClientX: e.clientX,
|
|
107
110
|
startClientY: e.clientY,
|
|
108
111
|
startViewport: i(),
|
|
109
112
|
moved: !1,
|
|
110
|
-
startedFromPanSurface: r
|
|
111
|
-
|
|
112
|
-
kind: "drag",
|
|
113
|
-
cursor: "grabbing"
|
|
114
|
-
})
|
|
115
|
-
}), d = ae({
|
|
113
|
+
startedFromPanSurface: r
|
|
114
|
+
}), d = ce({
|
|
116
115
|
pointerEvent: e,
|
|
117
116
|
captureEl: l ?? null,
|
|
118
117
|
capturePointer: !r,
|
|
119
|
-
onMove:
|
|
118
|
+
onMove: q,
|
|
120
119
|
onEnd: () => {
|
|
121
|
-
|
|
120
|
+
B();
|
|
122
121
|
}
|
|
123
122
|
}));
|
|
124
|
-
},
|
|
125
|
-
const n =
|
|
123
|
+
}, q = (e) => {
|
|
124
|
+
const n = v();
|
|
126
125
|
if (!n || n.pointerId !== e.pointerId) return;
|
|
127
126
|
const a = e.clientX - n.startClientX, r = e.clientY - n.startClientY;
|
|
128
|
-
if (!(n.moved || Math.abs(a) >
|
|
127
|
+
if (!(n.moved || Math.abs(a) > I || Math.abs(r) > I)) return;
|
|
129
128
|
n.moved || (e.preventDefault(), (!l || typeof l.hasPointerCapture != "function" || !l.hasPointerCapture(e.pointerId)) && d?.capturePointer());
|
|
130
129
|
const o = {
|
|
131
130
|
...n.startViewport,
|
|
132
131
|
x: n.startViewport.x + a,
|
|
133
132
|
y: n.startViewport.y + r
|
|
134
133
|
};
|
|
135
|
-
n.moved
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
},
|
|
134
|
+
if (!n.moved) {
|
|
135
|
+
E({
|
|
136
|
+
...n,
|
|
137
|
+
moved: !0
|
|
138
|
+
}), w(o);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
S = o, p ??= window.requestAnimationFrame(L);
|
|
142
|
+
}, T = (e) => {
|
|
144
143
|
const n = l?.getBoundingClientRect();
|
|
145
|
-
if (!n || (t.resolveWheelRouting ??
|
|
144
|
+
if (!n || (t.resolveWheelRouting ?? ae)({
|
|
146
145
|
target: e.target,
|
|
147
146
|
disablePanZoom: !!t.disablePanZoom,
|
|
148
|
-
wheelInteractiveSelector:
|
|
147
|
+
wheelInteractiveSelector: U()
|
|
149
148
|
}).kind !== "canvas_zoom") return;
|
|
150
149
|
e.preventDefault(), t.onViewportInteractionStart?.("wheel");
|
|
151
|
-
const r = i(), c =
|
|
150
|
+
const r = i(), c = M(n, {
|
|
152
151
|
clientX: e.clientX,
|
|
153
152
|
clientY: e.clientY
|
|
154
|
-
}), o =
|
|
155
|
-
if (Math.abs(
|
|
156
|
-
const
|
|
153
|
+
}), o = Ee(e, l), A = pe(r.scale * Math.exp(-o * H()), W(), Z());
|
|
154
|
+
if (Math.abs(A - r.scale) < 1e-4) return;
|
|
155
|
+
const b = se({
|
|
157
156
|
viewport: r,
|
|
158
157
|
localPoint: c,
|
|
159
|
-
nextScale:
|
|
158
|
+
nextScale: A
|
|
160
159
|
});
|
|
161
|
-
|
|
162
|
-
},
|
|
163
|
-
if (
|
|
160
|
+
w(b), z(b);
|
|
161
|
+
}, j = (e) => {
|
|
162
|
+
if (P(e.target) !== "canvas") return;
|
|
164
163
|
const n = l?.getBoundingClientRect();
|
|
165
164
|
if (!n) return;
|
|
166
165
|
e.preventDefault();
|
|
167
|
-
const a =
|
|
166
|
+
const a = M(n, {
|
|
168
167
|
clientX: e.clientX,
|
|
169
168
|
clientY: e.clientY
|
|
170
|
-
}), r = i(), c =
|
|
169
|
+
}), r = i(), c = le(r, a);
|
|
171
170
|
t.onCanvasContextMenu?.({
|
|
172
171
|
clientX: e.clientX,
|
|
173
172
|
clientY: e.clientY,
|
|
@@ -178,22 +177,22 @@ function Te(t) {
|
|
|
178
177
|
});
|
|
179
178
|
};
|
|
180
179
|
return (() => {
|
|
181
|
-
var e =
|
|
182
|
-
return typeof a == "function" ?
|
|
180
|
+
var e = de(), n = e.firstChild, a = l;
|
|
181
|
+
return typeof a == "function" ? ne(a, e) : l = e, G(e, J({
|
|
183
182
|
get class() {
|
|
184
|
-
return
|
|
183
|
+
return F("floe-infinite-canvas", O() && "is-panning", t.disablePanZoom && "is-locked", t.class);
|
|
185
184
|
}
|
|
186
185
|
}, {
|
|
187
|
-
[
|
|
186
|
+
[ue]: "true"
|
|
188
187
|
}, {
|
|
189
|
-
onPointerDown:
|
|
190
|
-
onContextMenu:
|
|
188
|
+
onPointerDown: _,
|
|
189
|
+
onContextMenu: j,
|
|
191
190
|
get "aria-label"() {
|
|
192
191
|
return t.ariaLabel ?? "Infinite canvas";
|
|
193
192
|
}
|
|
194
|
-
}), !1, !0),
|
|
195
|
-
var c =
|
|
196
|
-
return c !== r.e &&
|
|
193
|
+
}), !1, !0), x(n, k), x(e, () => t.overlay?.(i), null), K((r) => {
|
|
194
|
+
var c = F("floe-infinite-canvas__viewport", t.contentClass), o = `translate(${i().x}px, ${i().y}px) scale(${i().scale})`;
|
|
195
|
+
return c !== r.e && Q(n, r.e = c), o !== r.t && ee(n, "transform", r.t = o), r;
|
|
197
196
|
}, {
|
|
198
197
|
e: void 0,
|
|
199
198
|
t: void 0
|
|
@@ -201,5 +200,5 @@ function Te(t) {
|
|
|
201
200
|
})();
|
|
202
201
|
}
|
|
203
202
|
export {
|
|
204
|
-
|
|
203
|
+
Ae as InfiniteCanvas
|
|
205
204
|
};
|
|
@@ -13,3 +13,4 @@ export interface ViewActivationProviderProps {
|
|
|
13
13
|
}
|
|
14
14
|
export declare function ViewActivationProvider(props: ViewActivationProviderProps): JSX.Element;
|
|
15
15
|
export declare function useViewActivation(): Required<ViewActivationContextValue>;
|
|
16
|
+
export declare function useViewVisibility(): Accessor<boolean>;
|
|
@@ -1,25 +1,29 @@
|
|
|
1
|
-
import { createComponent as
|
|
2
|
-
import { useContext as
|
|
3
|
-
const i =
|
|
1
|
+
import { createComponent as u } from "solid-js/web";
|
|
2
|
+
import { useContext as n, untrack as v, createContext as a } from "solid-js";
|
|
3
|
+
const i = a();
|
|
4
4
|
function w(t) {
|
|
5
|
-
const
|
|
5
|
+
const o = n(i), e = v(() => t.value), r = e.visible ?? e.active, c = {
|
|
6
6
|
...e,
|
|
7
|
-
visible: () => (
|
|
7
|
+
visible: () => (o?.visible() ?? !0) && r()
|
|
8
8
|
};
|
|
9
|
-
return
|
|
9
|
+
return u(i.Provider, {
|
|
10
10
|
value: c,
|
|
11
11
|
get children() {
|
|
12
12
|
return t.children;
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
const t =
|
|
16
|
+
function V() {
|
|
17
|
+
const t = n(i);
|
|
18
18
|
if (!t)
|
|
19
19
|
throw new Error("ViewActivationContext not found. Wrap your view with <ViewActivationProvider />.");
|
|
20
20
|
return t;
|
|
21
21
|
}
|
|
22
|
+
function f() {
|
|
23
|
+
return n(i)?.visible ?? (() => !0);
|
|
24
|
+
}
|
|
22
25
|
export {
|
|
23
26
|
w as ViewActivationProvider,
|
|
24
|
-
|
|
27
|
+
V as useViewActivation,
|
|
28
|
+
f as useViewVisibility
|
|
25
29
|
};
|