@floegence/floe-webapp-core 0.52.5 → 0.52.7
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/FloatingWindow.d.ts +2 -0
- package/dist/components/ui/FloatingWindow.js +148 -140
- package/dist/components/ui/SurfaceFloatingPanel.d.ts +14 -0
- package/dist/components/ui/SurfaceFloatingPanel.js +136 -0
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/full.js +176 -174
- package/dist/ui.js +60 -58
- package/package.json +1 -1
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { memo as A, createComponent as $, mergeProps as W, template as k, use as E } from "solid-js/web";
|
|
2
|
+
import { splitProps as R, createSignal as y, createMemo as _, onMount as B, onCleanup as K } from "solid-js";
|
|
3
|
+
import { SurfaceFloatingLayer as L } from "./SurfaceFloatingLayer.js";
|
|
4
|
+
import { readSurfaceSafeArea as j, resolveFloatingBoundary as q } from "./surfaceFloatingBoundary.js";
|
|
5
|
+
import { startPointerSession as G } from "./pointerSession.js";
|
|
6
|
+
import { resolveSurfacePortalHost as I, resolveSurfacePortalScale as O } from "./dialogSurfaceScope.js";
|
|
7
|
+
var T = /* @__PURE__ */ k("<span hidden>");
|
|
8
|
+
function Z(X) {
|
|
9
|
+
const [l, Y] = R(X, ["children", "owner", "boundary", "style"]);
|
|
10
|
+
let m, d, p, h = !1;
|
|
11
|
+
const v = j(), [C, D] = y(!1), [w, x] = y({
|
|
12
|
+
x: 1,
|
|
13
|
+
y: 1
|
|
14
|
+
}), [a, F] = y({
|
|
15
|
+
left: 0,
|
|
16
|
+
top: 0,
|
|
17
|
+
width: 0,
|
|
18
|
+
height: 0,
|
|
19
|
+
panelWidth: 0,
|
|
20
|
+
panelHeight: 0,
|
|
21
|
+
scaleX: 1,
|
|
22
|
+
scaleY: 1
|
|
23
|
+
}), P = () => l.owner ?? m, f = () => {
|
|
24
|
+
if (!d) return;
|
|
25
|
+
const t = I({
|
|
26
|
+
owner: P()
|
|
27
|
+
}), e = q(t, l.boundary, v), o = O(t), n = d.getBoundingClientRect(), i = {
|
|
28
|
+
left: e?.left ?? 0,
|
|
29
|
+
top: e?.top ?? 0,
|
|
30
|
+
width: e?.width ?? 0,
|
|
31
|
+
height: e?.height ?? 0,
|
|
32
|
+
panelWidth: n.width,
|
|
33
|
+
panelHeight: n.height,
|
|
34
|
+
scaleX: o.x,
|
|
35
|
+
scaleY: o.y
|
|
36
|
+
};
|
|
37
|
+
F((r) => Object.keys(i).every((c) => i[c] === r[c]) ? r : i);
|
|
38
|
+
}, g = _(() => {
|
|
39
|
+
const t = a(), e = w();
|
|
40
|
+
return {
|
|
41
|
+
x: t.left + 8 + e.x * Math.max(0, t.width - t.panelWidth - 16),
|
|
42
|
+
y: t.top + 8 + e.y * Math.max(0, t.height - t.panelHeight - 16)
|
|
43
|
+
};
|
|
44
|
+
}), M = (t, e) => {
|
|
45
|
+
const o = a(), n = (i, r) => r > 0 ? Math.max(0, Math.min(1, i / r)) : 0;
|
|
46
|
+
x({
|
|
47
|
+
x: n(t - o.left - 8, o.width - o.panelWidth - 16),
|
|
48
|
+
y: n(e - o.top - 8, o.height - o.panelHeight - 16)
|
|
49
|
+
});
|
|
50
|
+
}, H = {
|
|
51
|
+
style: {
|
|
52
|
+
"touch-action": "none",
|
|
53
|
+
"user-select": "none"
|
|
54
|
+
},
|
|
55
|
+
onPointerDown: (t) => {
|
|
56
|
+
if (t.button !== 0 || p) return;
|
|
57
|
+
t.stopPropagation(), f();
|
|
58
|
+
const e = w(), o = g(), n = t.clientX, i = t.clientY;
|
|
59
|
+
h = !1;
|
|
60
|
+
let r = !1;
|
|
61
|
+
const c = (s, u) => {
|
|
62
|
+
const S = s - n, b = u - i;
|
|
63
|
+
r ||= Math.hypot(S, b) >= 4, r && M(o.x + S, o.y + b);
|
|
64
|
+
};
|
|
65
|
+
p = G({
|
|
66
|
+
pointerEvent: t,
|
|
67
|
+
captureEl: t.currentTarget,
|
|
68
|
+
onMove: (s) => {
|
|
69
|
+
s.preventDefault(), c(s.clientX, s.clientY);
|
|
70
|
+
},
|
|
71
|
+
onEnd: ({
|
|
72
|
+
commit: s,
|
|
73
|
+
snapshot: u
|
|
74
|
+
}) => {
|
|
75
|
+
s ? c(u.latestClientX, u.latestClientY) : x(e), h = r, p = void 0;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
"oncapture:click": (t) => {
|
|
80
|
+
h && t.detail !== 0 && (t.preventDefault(), t.stopImmediatePropagation()), h = !1;
|
|
81
|
+
},
|
|
82
|
+
onKeyDown: (t) => {
|
|
83
|
+
const e = {
|
|
84
|
+
ArrowLeft: [-1, 0],
|
|
85
|
+
ArrowRight: [1, 0],
|
|
86
|
+
ArrowUp: [0, -1],
|
|
87
|
+
ArrowDown: [0, 1]
|
|
88
|
+
}[t.key];
|
|
89
|
+
if (!e) return;
|
|
90
|
+
t.preventDefault(), t.stopPropagation(), f();
|
|
91
|
+
const o = g(), n = t.shiftKey ? 40 : 10;
|
|
92
|
+
M(o.x + e[0] * n, o.y + e[1] * n);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
return B(() => {
|
|
96
|
+
D(!0);
|
|
97
|
+
let t = 0;
|
|
98
|
+
const e = () => {
|
|
99
|
+
f(), t = requestAnimationFrame(e);
|
|
100
|
+
};
|
|
101
|
+
e(), K(() => {
|
|
102
|
+
cancelAnimationFrame(t), p?.stop();
|
|
103
|
+
});
|
|
104
|
+
}), [(() => {
|
|
105
|
+
var t = T(), e = m;
|
|
106
|
+
return typeof e == "function" ? E(e, t) : m = t, t;
|
|
107
|
+
})(), A(() => A(() => !!C())() && $(L, W(Y, {
|
|
108
|
+
get owner() {
|
|
109
|
+
return P();
|
|
110
|
+
},
|
|
111
|
+
get boundary() {
|
|
112
|
+
return l.boundary;
|
|
113
|
+
},
|
|
114
|
+
get position() {
|
|
115
|
+
return g();
|
|
116
|
+
},
|
|
117
|
+
clamp: !1,
|
|
118
|
+
layerRef: (t) => {
|
|
119
|
+
d = t;
|
|
120
|
+
},
|
|
121
|
+
get style() {
|
|
122
|
+
return {
|
|
123
|
+
...l.style,
|
|
124
|
+
"max-width": `${Math.max(0, a().width - 16) / a().scaleX}px`,
|
|
125
|
+
"max-height": `${Math.max(0, a().height - 16) / a().scaleY}px`,
|
|
126
|
+
visibility: a().width <= 16 || a().height <= 16 ? "hidden" : void 0
|
|
127
|
+
};
|
|
128
|
+
},
|
|
129
|
+
get children() {
|
|
130
|
+
return l.children(H);
|
|
131
|
+
}
|
|
132
|
+
})))];
|
|
133
|
+
}
|
|
134
|
+
export {
|
|
135
|
+
Z as SurfaceFloatingPanel
|
|
136
|
+
};
|
|
@@ -5,6 +5,7 @@ export { Input, Textarea, NumberInput, AffixInput, type InputProps, type InputSi
|
|
|
5
5
|
export { Dialog, ConfirmDialog, type DialogProps, type ConfirmDialogProps } from './Dialog';
|
|
6
6
|
export { DialogPlacementProvider, type DialogPlacementMode, type DialogPlacementProviderProps, } from './DialogPlacementContext';
|
|
7
7
|
export { FloatingWindow, type FloatingWindowProps } from './FloatingWindow';
|
|
8
|
+
export { SurfaceFloatingPanel, type SurfaceFloatingPanelProps, type SurfaceFloatingPanelHandleProps } from './SurfaceFloatingPanel';
|
|
8
9
|
export { createFloatingPresence, type FloatingPresence, type FloatingPresenceOptions, type FloatingPresenceState, } from './floatingPresence';
|
|
9
10
|
export { MENU_ITEM_SELECTOR, focusMenuItem, getMenuItems, handleMenuKeyboardNavigation, moveMenuFocus, type MenuDismissReason, type MenuFocusMode, type MenuItemNavigationOptions, type MenuKeyboardNavigationOptions, } from './menuUtils';
|
|
10
11
|
export { resolveFloatingWindowViewport, type FloatingWindowRect, type FloatingWindowViewport, type FloatingWindowViewportInsets, } from './floatingWindowGeometry';
|