@floegence/floe-webapp-core 0.52.7 → 0.52.9
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/icons/index.d.ts +1 -0
- package/dist/components/icons/index.js +417 -406
- package/dist/components/layout/BottomBarCompanion.d.ts +2 -0
- package/dist/components/layout/BottomBarCompanion.js +85 -85
- package/dist/components/ui/SurfaceFloatingPanel.d.ts +13 -0
- package/dist/components/ui/SurfaceFloatingPanel.js +102 -82
- package/dist/components/ui/index.d.ts +2 -1
- package/dist/components/ui/surfaceFloatingPanelGeometry.d.ts +39 -0
- package/dist/components/ui/surfaceFloatingPanelGeometry.js +78 -0
- package/dist/floe.css +7 -6
- package/dist/full.js +707 -706
- package/dist/icons.js +100 -99
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -10,6 +10,8 @@ export interface BottomBarCompanionProps {
|
|
|
10
10
|
id: string;
|
|
11
11
|
label: string;
|
|
12
12
|
children?: JSX.Element;
|
|
13
|
+
/** Preferred expanded width in pixels; defaults to the anchor width and respects maxWidth. */
|
|
14
|
+
expandedWidth?: number;
|
|
13
15
|
maxWidth?: number;
|
|
14
16
|
maxHeight?: number;
|
|
15
17
|
viewportPadding?: number;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { createComponent as
|
|
2
|
-
import { createSignal as
|
|
3
|
-
import { cn as
|
|
1
|
+
import { createComponent as p, Portal as ce, use as ee, insert as le, effect as ue, setAttribute as V, className as te, style as de, memo as fe, template as me } from "solid-js/web";
|
|
2
|
+
import { createSignal as x, createEffect as G, untrack as U, onCleanup as _, Show as he } from "solid-js";
|
|
3
|
+
import { cn as ne } from "../../utils/cn.js";
|
|
4
4
|
var ve = /* @__PURE__ */ me("<section role=region data-floe-bottom-bar-companion=true><div data-floe-bottom-bar-companion-content=true>");
|
|
5
|
-
const we = 544, be = 544, ge = 12,
|
|
5
|
+
const we = 544, be = 544, ge = 12, q = {
|
|
6
6
|
top: "--floe-bottom-bar-companion-safe-area-top",
|
|
7
7
|
right: "--floe-bottom-bar-companion-safe-area-right",
|
|
8
8
|
bottom: "--floe-bottom-bar-companion-safe-area-bottom",
|
|
9
9
|
left: "--floe-bottom-bar-companion-safe-area-left"
|
|
10
10
|
};
|
|
11
|
-
function
|
|
11
|
+
function X(e, a) {
|
|
12
12
|
const l = Number(e);
|
|
13
13
|
return Number.isFinite(l) && l > 0 ? l : a;
|
|
14
14
|
}
|
|
@@ -16,7 +16,7 @@ function Ce(e, a) {
|
|
|
16
16
|
const l = Number(e);
|
|
17
17
|
return Number.isFinite(l) && l >= 0 ? l : a;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function oe(e) {
|
|
20
20
|
if (!e?.isConnected) return null;
|
|
21
21
|
const a = e.getBoundingClientRect();
|
|
22
22
|
return !Number.isFinite(a.left) || !Number.isFinite(a.top) || a.width <= 0 || a.height <= 0 ? null : {
|
|
@@ -26,7 +26,7 @@ function ne(e) {
|
|
|
26
26
|
height: a.height
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function k(e, a) {
|
|
30
30
|
const l = e.ownerDocument.defaultView;
|
|
31
31
|
if (!l) return 0;
|
|
32
32
|
const m = Number.parseFloat(l.getComputedStyle(e).getPropertyValue(a));
|
|
@@ -34,19 +34,19 @@ function B(e, a) {
|
|
|
34
34
|
}
|
|
35
35
|
function Fe(e) {
|
|
36
36
|
return {
|
|
37
|
-
top:
|
|
38
|
-
right:
|
|
39
|
-
bottom:
|
|
40
|
-
left:
|
|
37
|
+
top: k(e, q.top),
|
|
38
|
+
right: k(e, q.right),
|
|
39
|
+
bottom: k(e, q.bottom),
|
|
40
|
+
left: k(e, q.left)
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
function ye(e, a, l, m,
|
|
44
|
-
const
|
|
43
|
+
function ye(e, a, l, m, R, F) {
|
|
44
|
+
const E = a.ownerDocument.defaultView, f = E?.visualViewport, A = f?.offsetLeft ?? 0, z = f?.offsetTop ?? 0, N = f?.width ?? E?.innerWidth ?? e.left + e.width, H = f?.height ?? E?.innerHeight ?? e.top + e.height, P = Fe(a), b = A + P.left + F, h = A + N - P.right - F, v = z + P.top + F, g = z + H - P.bottom, w = Math.max(0, h - b), C = Math.min(l, m, w), L = e.left + (e.width - C) / 2, M = Math.max(b, Math.min(L, h - C)), D = Math.min(e.top + e.height, g), S = Math.max(e.height, D - v), B = Math.min(R, S);
|
|
45
45
|
return {
|
|
46
46
|
left: M,
|
|
47
|
-
top:
|
|
48
|
-
width:
|
|
49
|
-
height:
|
|
47
|
+
top: D - B,
|
|
48
|
+
width: C,
|
|
49
|
+
height: B
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
function Ee(e, a) {
|
|
@@ -61,157 +61,157 @@ function Ae(e) {
|
|
|
61
61
|
} : {};
|
|
62
62
|
}
|
|
63
63
|
function Me(e) {
|
|
64
|
-
const [a, l] =
|
|
65
|
-
let
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
},
|
|
64
|
+
const [a, l] = x(null), [m, R] = x(!1), [F, E] = x(!1), [f, A] = x(null), [z, N] = x(null), [H, P] = x("collapsed");
|
|
65
|
+
let b = null, h = 0, v = 0, g = null, w = null, C = null, L = !1, M = !1;
|
|
66
|
+
const D = (i) => {
|
|
67
|
+
H() !== i && (P(i), e.onPhaseChange?.(i));
|
|
68
|
+
}, S = () => a()?.ownerDocument.defaultView ?? e.anchor?.ownerDocument.defaultView ?? null, B = () => S()?.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1, K = (i) => {
|
|
69
69
|
const t = e.mount, r = e.anchor, n = !!(t?.isConnected && i && r?.ownerDocument === t.ownerDocument);
|
|
70
70
|
n && l(t);
|
|
71
71
|
const c = a();
|
|
72
72
|
if (c) {
|
|
73
|
-
|
|
73
|
+
R(c.isConnected);
|
|
74
74
|
const o = !!(n && c === t);
|
|
75
|
-
return
|
|
75
|
+
return E(o), {
|
|
76
76
|
mount: c,
|
|
77
77
|
ready: o
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
|
-
return
|
|
80
|
+
return R(!1), E(!1), {
|
|
81
81
|
mount: null,
|
|
82
82
|
ready: !1
|
|
83
83
|
};
|
|
84
84
|
}, ie = (i) => {
|
|
85
|
-
const t =
|
|
86
|
-
t &&
|
|
85
|
+
const t = oe(e.anchor);
|
|
86
|
+
t && N(t);
|
|
87
87
|
const {
|
|
88
88
|
mount: r,
|
|
89
89
|
ready: n
|
|
90
|
-
} =
|
|
91
|
-
return !c || !r || !n ? null : i ? ye(c, r,
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
},
|
|
90
|
+
} = K(t), c = t ?? z();
|
|
91
|
+
return !c || !r || !n ? null : i ? ye(c, r, X(e.expandedWidth, c.width), X(e.maxWidth, we), X(e.maxHeight, be), Ce(e.viewportPadding, ge)) : c;
|
|
92
|
+
}, j = () => {
|
|
93
|
+
h && g && g.cancelAnimationFrame(h), v && w && w.cancelAnimationFrame(v), h = 0, v = 0, g = null, w = null, C = null;
|
|
94
|
+
}, J = (i, t) => {
|
|
95
95
|
const r = ie(i);
|
|
96
96
|
if (!r) return;
|
|
97
|
-
const n =
|
|
98
|
-
if (!t ||
|
|
99
|
-
|
|
97
|
+
const n = f(), c = i ? "expanded" : "collapsed";
|
|
98
|
+
if (!t || B() || Ee(n, r)) {
|
|
99
|
+
A(r), C = null, D(c);
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
|
-
|
|
103
|
-
const o =
|
|
102
|
+
C = ["height", "width", "top", "left"].find((u) => n?.[u] !== r[u]) ?? null, D(i ? "expanding" : "collapsing");
|
|
103
|
+
const o = S();
|
|
104
104
|
if (!o) {
|
|
105
|
-
|
|
105
|
+
A(r), D(c);
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}),
|
|
111
|
-
},
|
|
112
|
-
const r =
|
|
108
|
+
v = o.requestAnimationFrame(() => {
|
|
109
|
+
v = 0, w = null, A(r);
|
|
110
|
+
}), w = o;
|
|
111
|
+
}, Q = (i, t) => {
|
|
112
|
+
const r = S();
|
|
113
113
|
if (!r) {
|
|
114
|
-
|
|
114
|
+
J(t, i);
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
h && g && g.cancelAnimationFrame(h), v && w && w.cancelAnimationFrame(v), v = 0, w = null, h = r.requestAnimationFrame(() => {
|
|
118
|
+
h = 0, g = null, U(() => J(t, i));
|
|
119
119
|
}), g = r;
|
|
120
120
|
};
|
|
121
|
-
|
|
121
|
+
G(() => {
|
|
122
122
|
const i = e.retained, t = e.visible, r = e.open;
|
|
123
|
-
if (e.anchor, e.mount, e.maxWidth, e.maxHeight, e.viewportPadding, !i) {
|
|
124
|
-
|
|
123
|
+
if (e.anchor, e.mount, e.expandedWidth, e.maxWidth, e.maxHeight, e.viewportPadding, !i) {
|
|
124
|
+
j(), l(null), R(!1), E(!1), A(null), N(null), b = null, e.surfaceRef?.(null), e.contentHostRef?.(null), L = !1, M = r;
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
|
-
const n =
|
|
128
|
-
if (n &&
|
|
129
|
-
|
|
127
|
+
const n = oe(e.anchor);
|
|
128
|
+
if (n && N(n), K(n), !t) {
|
|
129
|
+
L = !1, M = r;
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
132
|
-
const c = !
|
|
133
|
-
|
|
134
|
-
}),
|
|
132
|
+
const c = !L, o = M !== r;
|
|
133
|
+
L = !0, M = r, Q(!c && o, r);
|
|
134
|
+
}), G(() => {
|
|
135
135
|
if (!e.retained) return;
|
|
136
136
|
const i = e.anchor, t = a(), r = e.mount, n = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set();
|
|
137
137
|
for (const s of [i, t, r]) {
|
|
138
138
|
if (!s) continue;
|
|
139
139
|
n.add(s.ownerDocument);
|
|
140
|
-
const
|
|
141
|
-
|
|
140
|
+
const d = s.ownerDocument.defaultView;
|
|
141
|
+
d && c.add(d);
|
|
142
142
|
}
|
|
143
143
|
if (c.size === 0 || n.size === 0) return;
|
|
144
|
-
const o = () =>
|
|
144
|
+
const o = () => Q(!1, U(() => e.open)), u = [];
|
|
145
145
|
for (const s of /* @__PURE__ */ new Set([i, t, r])) {
|
|
146
|
-
const
|
|
147
|
-
if (!s || !
|
|
148
|
-
const
|
|
149
|
-
|
|
146
|
+
const d = s?.ownerDocument.defaultView;
|
|
147
|
+
if (!s || !d || typeof d.ResizeObserver != "function") continue;
|
|
148
|
+
const y = new d.ResizeObserver(o);
|
|
149
|
+
y.observe(s), u.push(y);
|
|
150
150
|
}
|
|
151
|
-
let
|
|
151
|
+
let T = i?.isConnected ?? !1, W = t?.isConnected ?? !1, I = r?.isConnected ?? !1;
|
|
152
152
|
const O = [];
|
|
153
153
|
for (const s of n) {
|
|
154
|
-
const
|
|
155
|
-
if (!
|
|
156
|
-
const
|
|
157
|
-
const
|
|
158
|
-
|
|
154
|
+
const d = s.defaultView;
|
|
155
|
+
if (!d || typeof d.MutationObserver != "function" || !s.documentElement) continue;
|
|
156
|
+
const y = new d.MutationObserver(() => {
|
|
157
|
+
const Y = i?.isConnected ?? !1, Z = t?.isConnected ?? !1, $ = r?.isConnected ?? !1;
|
|
158
|
+
T === Y && W === Z && I === $ || (T = Y, W = Z, I = $, U(o));
|
|
159
159
|
});
|
|
160
|
-
|
|
160
|
+
y.observe(s.documentElement, {
|
|
161
161
|
childList: !0,
|
|
162
162
|
subtree: !0
|
|
163
|
-
}), O.push(
|
|
163
|
+
}), O.push(y);
|
|
164
164
|
}
|
|
165
165
|
for (const s of c)
|
|
166
166
|
s.addEventListener("resize", o), s.visualViewport?.addEventListener("resize", o), s.visualViewport?.addEventListener("scroll", o);
|
|
167
|
-
|
|
167
|
+
_(() => {
|
|
168
168
|
for (const s of u) s.disconnect();
|
|
169
169
|
for (const s of O) s.disconnect();
|
|
170
170
|
for (const s of c)
|
|
171
171
|
s.removeEventListener("resize", o), s.visualViewport?.removeEventListener("resize", o), s.visualViewport?.removeEventListener("scroll", o);
|
|
172
172
|
});
|
|
173
|
-
}),
|
|
174
|
-
if (!e.retained || !e.visible || !e.open || !m() || !F() || !
|
|
173
|
+
}), G(() => {
|
|
174
|
+
if (!e.retained || !e.visible || !e.open || !m() || !F() || !f()) return;
|
|
175
175
|
const t = a()?.ownerDocument;
|
|
176
176
|
if (!t) return;
|
|
177
177
|
const r = (o) => {
|
|
178
178
|
const u = typeof o.composedPath == "function" ? o.composedPath() : [];
|
|
179
|
-
return
|
|
179
|
+
return b && u.includes(b) || e.anchor && u.includes(e.anchor) ? !0 : e.isOwnedInteraction?.(o) ?? !1;
|
|
180
180
|
}, n = (o) => {
|
|
181
181
|
r(o) || e.onDismiss?.("outside-pointer");
|
|
182
182
|
}, c = (o) => {
|
|
183
183
|
if (o.key !== "Escape" || o.defaultPrevented || o.isComposing || o.keyCode === 229) return;
|
|
184
184
|
const u = t.activeElement;
|
|
185
|
-
!
|
|
185
|
+
!b?.contains(u) && !e.isOwnedInteraction?.(o) || (o.preventDefault(), e.onDismiss?.("escape"));
|
|
186
186
|
};
|
|
187
|
-
t.addEventListener("pointerdown", n, !0), t.addEventListener("keydown", c),
|
|
187
|
+
t.addEventListener("pointerdown", n, !0), t.addEventListener("keydown", c), _(() => {
|
|
188
188
|
t.removeEventListener("pointerdown", n, !0), t.removeEventListener("keydown", c);
|
|
189
189
|
});
|
|
190
|
-
}),
|
|
191
|
-
|
|
190
|
+
}), _(() => {
|
|
191
|
+
j(), e.surfaceRef?.(null), e.contentHostRef?.(null);
|
|
192
192
|
});
|
|
193
193
|
const re = (i) => {
|
|
194
|
-
|
|
194
|
+
b = i, e.surfaceRef?.(i);
|
|
195
195
|
}, ae = (i) => {
|
|
196
196
|
e.contentHostRef?.(i);
|
|
197
197
|
}, se = (i) => {
|
|
198
|
-
if (i.target !==
|
|
198
|
+
if (i.target !== b || i.propertyName !== C) return;
|
|
199
199
|
const t = e.open ? "expanding" : "collapsing";
|
|
200
|
-
|
|
200
|
+
H() === t && (C = null, D(e.open ? "expanded" : "collapsed"));
|
|
201
201
|
};
|
|
202
|
-
return
|
|
202
|
+
return p(he, {
|
|
203
203
|
get when() {
|
|
204
204
|
return fe(() => !!e.retained)() && a();
|
|
205
205
|
},
|
|
206
|
-
children: (i) =>
|
|
206
|
+
children: (i) => p(ce, {
|
|
207
207
|
get mount() {
|
|
208
208
|
return i();
|
|
209
209
|
},
|
|
210
210
|
get children() {
|
|
211
211
|
var t = ve(), r = t.firstChild;
|
|
212
|
-
return t.addEventListener("transitionend", se),
|
|
213
|
-
var c = e.id, o = e.label, u = !e.visible || !m() || !F() || !
|
|
214
|
-
return c !== n.e &&
|
|
212
|
+
return t.addEventListener("transitionend", se), ee((n) => re(n), t), ee((n) => ae(n), r), le(r, () => e.children), ue((n) => {
|
|
213
|
+
var c = e.id, o = e.label, u = !e.visible || !m() || !F() || !f() ? "true" : void 0, T = !e.visible || !m() || !F() || !f(), W = ne("floe-bottom-bar-companion", e.class), I = H(), O = e.visible && m() && F() ? "visible" : "hidden", s = f() ? "true" : "false", d = Ae(f()), y = ne("floe-bottom-bar-companion__content", e.contentClass);
|
|
214
|
+
return c !== n.e && V(t, "id", n.e = c), o !== n.t && V(t, "aria-label", n.t = o), u !== n.a && V(t, "aria-hidden", n.a = u), T !== n.o && (t.inert = n.o = T), W !== n.i && te(t, n.i = W), I !== n.n && V(t, "data-companion-phase", n.n = I), O !== n.s && V(t, "data-companion-visibility", n.s = O), s !== n.h && V(t, "data-companion-frame-ready", n.h = s), n.r = de(t, d, n.r), y !== n.d && te(r, n.d = y), n;
|
|
215
215
|
}, {
|
|
216
216
|
e: void 0,
|
|
217
217
|
t: void 0,
|
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
import { type JSX } from 'solid-js';
|
|
2
2
|
import { type SurfaceFloatingLayerProps } from './SurfaceFloatingLayer';
|
|
3
|
+
import { type SurfaceFloatingPanelBoundaryInsets, type SurfaceFloatingPanelPosition } from './surfaceFloatingPanelGeometry';
|
|
3
4
|
export type SurfaceFloatingPanelHandleProps = Pick<JSX.ButtonHTMLAttributes<HTMLButtonElement>, 'onPointerDown' | 'onKeyDown' | 'style'> & {
|
|
4
5
|
'oncapture:click': JSX.EventHandler<HTMLButtonElement, MouseEvent>;
|
|
5
6
|
};
|
|
6
7
|
export interface SurfaceFloatingPanelProps extends Omit<SurfaceFloatingLayerProps, 'position' | 'estimatedSize' | 'clamp' | 'children' | 'layerRef'> {
|
|
7
8
|
/** Spread these props on a dedicated grip or collapsed launcher button. */
|
|
8
9
|
children: (handle: SurfaceFloatingPanelHandleProps) => JSX.Element;
|
|
10
|
+
/** Non-interactive client/CSS viewport pixel insets, such as app chrome or a composer. */
|
|
11
|
+
boundaryInsets?: SurfaceFloatingPanelBoundaryInsets;
|
|
12
|
+
/** Snap the panel to the nearest safe boundary edge after a committed pointer drag. */
|
|
13
|
+
snapToEdge?: boolean;
|
|
14
|
+
/** Maximum client/CSS viewport pixel distance that enables snapping. Defaults to Infinity. */
|
|
15
|
+
snapThreshold?: number;
|
|
16
|
+
/** Client/CSS viewport pixel gap between the panel and its safe boundary. Defaults to 8px. */
|
|
17
|
+
snapInset?: number;
|
|
18
|
+
/** Called with client/CSS viewport coordinates after a committed position change. */
|
|
19
|
+
onPositionChange?: (position: SurfaceFloatingPanelPosition) => void;
|
|
9
20
|
}
|
|
10
21
|
/** A draggable, bottom-end anchored panel using the shared surface portal boundary.
|
|
11
22
|
* Content owns its dimensions and collapsed presentation; the panel preserves its
|
|
12
23
|
* relative placement as either changes. Drag handles never intercept content input.
|
|
24
|
+
* Geometry stays in client/CSS viewport coordinates; projected surfaces are converted
|
|
25
|
+
* only when the shared floating layer renders.
|
|
13
26
|
*/
|
|
14
27
|
export declare function SurfaceFloatingPanel(props: SurfaceFloatingPanelProps): JSX.Element;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { memo as
|
|
2
|
-
import { splitProps as
|
|
3
|
-
import { SurfaceFloatingLayer as
|
|
4
|
-
import { readSurfaceSafeArea as
|
|
5
|
-
import { startPointerSession as
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { memo as X, createComponent as K, mergeProps as L, template as j, use as q } from "solid-js/web";
|
|
2
|
+
import { splitProps as N, createSignal as b, createMemo as Y, onMount as O, onCleanup as U } from "solid-js";
|
|
3
|
+
import { SurfaceFloatingLayer as V } from "./SurfaceFloatingLayer.js";
|
|
4
|
+
import { readSurfaceSafeArea as z, resolveFloatingBoundary as J } from "./surfaceFloatingBoundary.js";
|
|
5
|
+
import { startPointerSession as Q } from "./pointerSession.js";
|
|
6
|
+
import { resolveSurfaceFloatingPanelBounds as Z, resolveSurfaceFloatingPanelPosition as ee, resolveSurfaceFloatingPanelInset as te, insetSurfaceFloatingPanelGeometry as ne, resolveSurfaceFloatingPanelSnap as oe, resolveSurfaceFloatingPanelSnapThreshold as re } from "./surfaceFloatingPanelGeometry.js";
|
|
7
|
+
import { resolveSurfacePortalHost as ae, resolveSurfacePortalScale as ie } from "./dialogSurfaceScope.js";
|
|
8
|
+
var se = /* @__PURE__ */ j("<span hidden>");
|
|
9
|
+
function he($) {
|
|
10
|
+
const [a, E] = N($, ["children", "owner", "boundary", "style", "snapToEdge", "boundaryInsets", "snapThreshold", "snapInset", "onPositionChange"]);
|
|
11
|
+
let P, r, f, h = !1, p, c = null;
|
|
12
|
+
const B = z(), [G, R] = b(!1), [A, F] = b({
|
|
12
13
|
x: 1,
|
|
13
14
|
y: 1
|
|
14
|
-
}), [
|
|
15
|
+
}), [u, W] = b({
|
|
15
16
|
left: 0,
|
|
16
17
|
top: 0,
|
|
17
18
|
width: 0,
|
|
@@ -20,117 +21,136 @@ function Z(X) {
|
|
|
20
21
|
panelHeight: 0,
|
|
21
22
|
scaleX: 1,
|
|
22
23
|
scaleY: 1
|
|
23
|
-
}),
|
|
24
|
-
if (!
|
|
25
|
-
const
|
|
26
|
-
owner:
|
|
27
|
-
}),
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
24
|
+
}), x = () => a.owner ?? P, v = () => te(a.snapInset), S = Y(() => Z(u(), v())), k = () => x()?.ownerDocument.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches ? 0 : 180, T = () => {
|
|
25
|
+
if (!r) return;
|
|
26
|
+
const e = ae({
|
|
27
|
+
owner: x()
|
|
28
|
+
}), t = J(e, a.boundary, B), n = ie(e), i = r.getBoundingClientRect(), o = {
|
|
29
|
+
...ne({
|
|
30
|
+
left: t?.left ?? 0,
|
|
31
|
+
top: t?.top ?? 0,
|
|
32
|
+
width: t?.width ?? 0,
|
|
33
|
+
height: t?.height ?? 0,
|
|
34
|
+
panelWidth: i.width,
|
|
35
|
+
panelHeight: i.height
|
|
36
|
+
}, a.boundaryInsets),
|
|
37
|
+
scaleX: n.x,
|
|
38
|
+
scaleY: n.y
|
|
36
39
|
};
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
x:
|
|
42
|
-
y: t
|
|
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)
|
|
40
|
+
W((m) => Object.keys(o).every((s) => o[s] === m[s]) ? m : o);
|
|
41
|
+
}, l = Y(() => ee(S(), A())), y = (e, t) => {
|
|
42
|
+
const n = S(), i = (g, o) => o.room > 0 ? Math.max(0, Math.min(1, g / o.room)) : 0;
|
|
43
|
+
F({
|
|
44
|
+
x: i(e - n.x.min, n.x),
|
|
45
|
+
y: i(t - n.y.min, n.y)
|
|
49
46
|
});
|
|
50
|
-
},
|
|
47
|
+
}, d = (e = l()) => {
|
|
48
|
+
a.onPositionChange?.(e);
|
|
49
|
+
}, M = () => {
|
|
50
|
+
p !== void 0 && (clearTimeout(p), p = void 0), r && c !== null && (r.style.transition = c, c = null);
|
|
51
|
+
}, C = () => {
|
|
52
|
+
const e = p !== void 0 ? r?.getBoundingClientRect() : void 0;
|
|
53
|
+
M(), T(), e && y(e.left, e.top);
|
|
54
|
+
}, H = () => {
|
|
55
|
+
const e = oe(l(), S(), re(a.snapThreshold));
|
|
56
|
+
if (!e) {
|
|
57
|
+
d(l());
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const t = l();
|
|
61
|
+
if (t.x === e.position.x && t.y === e.position.y) {
|
|
62
|
+
d(t);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
M();
|
|
66
|
+
const n = k();
|
|
67
|
+
r && (c = r.style.transition, r.style.transition = n ? `left ${n}ms ease-out, top ${n}ms ease-out` : "none"), y(e.position.x, e.position.y), d(e.position), p = setTimeout(() => {
|
|
68
|
+
r && c !== null && (r.style.transition = c), c = null, p = void 0;
|
|
69
|
+
}, n);
|
|
70
|
+
}, _ = {
|
|
51
71
|
style: {
|
|
52
72
|
"touch-action": "none",
|
|
53
73
|
"user-select": "none"
|
|
54
74
|
},
|
|
55
|
-
onPointerDown: (
|
|
56
|
-
if (
|
|
57
|
-
|
|
58
|
-
const
|
|
75
|
+
onPointerDown: (e) => {
|
|
76
|
+
if (e.button !== 0 || f) return;
|
|
77
|
+
e.stopPropagation(), C();
|
|
78
|
+
const t = A(), n = l(), i = e.clientX, g = e.clientY;
|
|
59
79
|
h = !1;
|
|
60
|
-
let
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
|
|
80
|
+
let o = !1;
|
|
81
|
+
const m = (s, w) => {
|
|
82
|
+
const D = s - i, I = w - g;
|
|
83
|
+
o ||= Math.hypot(D, I) >= 4, o && y(n.x + D, n.y + I);
|
|
64
84
|
};
|
|
65
|
-
|
|
66
|
-
pointerEvent:
|
|
67
|
-
captureEl:
|
|
85
|
+
f = Q({
|
|
86
|
+
pointerEvent: e,
|
|
87
|
+
captureEl: e.currentTarget,
|
|
68
88
|
onMove: (s) => {
|
|
69
|
-
s.preventDefault(),
|
|
89
|
+
s.preventDefault(), m(s.clientX, s.clientY);
|
|
70
90
|
},
|
|
71
91
|
onEnd: ({
|
|
72
92
|
commit: s,
|
|
73
|
-
snapshot:
|
|
93
|
+
snapshot: w
|
|
74
94
|
}) => {
|
|
75
|
-
s ?
|
|
95
|
+
s ? (m(w.latestClientX, w.latestClientY), o && a.snapToEdge ? H() : o && d(l())) : F(t), h = o, f = void 0;
|
|
76
96
|
}
|
|
77
97
|
});
|
|
78
98
|
},
|
|
79
|
-
"oncapture:click": (
|
|
80
|
-
h &&
|
|
99
|
+
"oncapture:click": (e) => {
|
|
100
|
+
h && e.detail !== 0 && (e.preventDefault(), e.stopImmediatePropagation()), h = !1;
|
|
81
101
|
},
|
|
82
|
-
onKeyDown: (
|
|
83
|
-
const
|
|
102
|
+
onKeyDown: (e) => {
|
|
103
|
+
const t = {
|
|
84
104
|
ArrowLeft: [-1, 0],
|
|
85
105
|
ArrowRight: [1, 0],
|
|
86
106
|
ArrowUp: [0, -1],
|
|
87
107
|
ArrowDown: [0, 1]
|
|
88
|
-
}[
|
|
89
|
-
if (!
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
|
|
108
|
+
}[e.key];
|
|
109
|
+
if (!t) return;
|
|
110
|
+
e.preventDefault(), e.stopPropagation(), C();
|
|
111
|
+
const n = l(), i = e.shiftKey ? 40 : 10;
|
|
112
|
+
y(n.x + t[0] * i, n.y + t[1] * i), d(l());
|
|
93
113
|
}
|
|
94
114
|
};
|
|
95
|
-
return
|
|
96
|
-
|
|
97
|
-
let
|
|
98
|
-
const
|
|
99
|
-
|
|
115
|
+
return O(() => {
|
|
116
|
+
R(!0);
|
|
117
|
+
let e = 0;
|
|
118
|
+
const t = () => {
|
|
119
|
+
T(), e = requestAnimationFrame(t);
|
|
100
120
|
};
|
|
101
|
-
|
|
102
|
-
cancelAnimationFrame(
|
|
121
|
+
t(), U(() => {
|
|
122
|
+
cancelAnimationFrame(e), M(), f?.stop();
|
|
103
123
|
});
|
|
104
124
|
}), [(() => {
|
|
105
|
-
var
|
|
106
|
-
return typeof
|
|
107
|
-
})(),
|
|
125
|
+
var e = se(), t = P;
|
|
126
|
+
return typeof t == "function" ? q(t, e) : P = e, e;
|
|
127
|
+
})(), X(() => X(() => !!G())() && K(V, L(E, {
|
|
108
128
|
get owner() {
|
|
109
|
-
return
|
|
129
|
+
return x();
|
|
110
130
|
},
|
|
111
131
|
get boundary() {
|
|
112
|
-
return
|
|
132
|
+
return a.boundary;
|
|
113
133
|
},
|
|
114
134
|
get position() {
|
|
115
|
-
return
|
|
135
|
+
return l();
|
|
116
136
|
},
|
|
117
137
|
clamp: !1,
|
|
118
|
-
layerRef: (
|
|
119
|
-
|
|
138
|
+
layerRef: (e) => {
|
|
139
|
+
r = e;
|
|
120
140
|
},
|
|
121
141
|
get style() {
|
|
122
142
|
return {
|
|
123
|
-
...
|
|
124
|
-
"max-width": `${Math.max(0,
|
|
125
|
-
"max-height": `${Math.max(0,
|
|
126
|
-
visibility:
|
|
143
|
+
...a.style,
|
|
144
|
+
"max-width": `${Math.max(0, u().width - v() * 2) / Math.max(0.01, u().scaleX)}px`,
|
|
145
|
+
"max-height": `${Math.max(0, u().height - v() * 2) / Math.max(0.01, u().scaleY)}px`,
|
|
146
|
+
visibility: u().width <= 16 || u().height <= 16 ? "hidden" : void 0
|
|
127
147
|
};
|
|
128
148
|
},
|
|
129
149
|
get children() {
|
|
130
|
-
return
|
|
150
|
+
return a.children(_);
|
|
131
151
|
}
|
|
132
152
|
})))];
|
|
133
153
|
}
|
|
134
154
|
export {
|
|
135
|
-
|
|
155
|
+
he as SurfaceFloatingPanel
|
|
136
156
|
};
|
|
@@ -5,7 +5,8 @@ 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
|
+
export { SurfaceFloatingPanel, type SurfaceFloatingPanelProps, type SurfaceFloatingPanelHandleProps, } from './SurfaceFloatingPanel';
|
|
9
|
+
export type { SurfaceFloatingPanelBoundaryInsets, SurfaceFloatingPanelPosition, } from './surfaceFloatingPanelGeometry';
|
|
9
10
|
export { createFloatingPresence, type FloatingPresence, type FloatingPresenceOptions, type FloatingPresenceState, } from './floatingPresence';
|
|
10
11
|
export { MENU_ITEM_SELECTOR, focusMenuItem, getMenuItems, handleMenuKeyboardNavigation, moveMenuFocus, type MenuDismissReason, type MenuFocusMode, type MenuItemNavigationOptions, type MenuKeyboardNavigationOptions, } from './menuUtils';
|
|
11
12
|
export { resolveFloatingWindowViewport, type FloatingWindowRect, type FloatingWindowViewport, type FloatingWindowViewportInsets, } from './floatingWindowGeometry';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export type SurfaceFloatingPanelPosition = Readonly<{
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
}>;
|
|
5
|
+
export type SurfaceFloatingPanelGeometry = Readonly<{
|
|
6
|
+
left: number;
|
|
7
|
+
top: number;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
panelWidth: number;
|
|
11
|
+
panelHeight: number;
|
|
12
|
+
}>;
|
|
13
|
+
export type SurfaceFloatingPanelBoundaryInsets = Readonly<{
|
|
14
|
+
top?: number;
|
|
15
|
+
right?: number;
|
|
16
|
+
bottom?: number;
|
|
17
|
+
left?: number;
|
|
18
|
+
}>;
|
|
19
|
+
export type SurfaceFloatingPanelAxis = Readonly<{
|
|
20
|
+
min: number;
|
|
21
|
+
max: number;
|
|
22
|
+
room: number;
|
|
23
|
+
}>;
|
|
24
|
+
export type SurfaceFloatingPanelBounds = Readonly<{
|
|
25
|
+
x: SurfaceFloatingPanelAxis;
|
|
26
|
+
y: SurfaceFloatingPanelAxis;
|
|
27
|
+
}>;
|
|
28
|
+
export type SurfaceFloatingPanelSnapEdge = 'left' | 'right' | 'top' | 'bottom';
|
|
29
|
+
export type SurfaceFloatingPanelSnap = Readonly<{
|
|
30
|
+
edge: SurfaceFloatingPanelSnapEdge;
|
|
31
|
+
position: SurfaceFloatingPanelPosition;
|
|
32
|
+
}>;
|
|
33
|
+
export declare const DEFAULT_SURFACE_FLOATING_PANEL_INSET = 8;
|
|
34
|
+
export declare function insetSurfaceFloatingPanelGeometry(geometry: SurfaceFloatingPanelGeometry, insets?: SurfaceFloatingPanelBoundaryInsets): SurfaceFloatingPanelGeometry;
|
|
35
|
+
export declare function resolveSurfaceFloatingPanelInset(value: unknown): number;
|
|
36
|
+
export declare function resolveSurfaceFloatingPanelSnapThreshold(value: unknown): number;
|
|
37
|
+
export declare function resolveSurfaceFloatingPanelBounds(geometry: SurfaceFloatingPanelGeometry, inset?: number): SurfaceFloatingPanelBounds;
|
|
38
|
+
export declare function resolveSurfaceFloatingPanelPosition(bounds: SurfaceFloatingPanelBounds, placement: SurfaceFloatingPanelPosition): SurfaceFloatingPanelPosition;
|
|
39
|
+
export declare function resolveSurfaceFloatingPanelSnap(position: SurfaceFloatingPanelPosition, bounds: SurfaceFloatingPanelBounds, threshold?: number): SurfaceFloatingPanelSnap | null;
|