@floegence/floe-webapp-core 0.52.2 → 0.52.3
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.js +42 -35
- package/dist/floe.css +39 -44
- package/dist/styles.css +1 -1
- package/dist/surface.css +40 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createComponent as a, Portal as
|
|
1
|
+
import { createComponent as a, Portal as Te, spread as ce, mergeProps as fe, memo as we, insert as g, effect as c, setAttribute as De, addEventListener as m, className as f, template as u, use as We, delegateEvents as Oe } from "solid-js/web";
|
|
2
2
|
import { createUniqueId as He, createSignal as p, onCleanup as L, onMount as Ye, createEffect as b, Show as S, batch as Ne, untrack as Xe } from "solid-js";
|
|
3
3
|
import { cn as M } from "../../utils/cn.js";
|
|
4
4
|
import { useLayout as Ue } from "../../context/LayoutContext.js";
|
|
@@ -10,21 +10,21 @@ import { resolveFloatingWindowViewport as ge, normalizeFloatingWindowRect as me,
|
|
|
10
10
|
import { createFloatingPresence as Je } from "./floatingPresence.js";
|
|
11
11
|
import { LOCAL_INTERACTION_SURFACE_ATTR as ve } from "./localInteractionSurface.js";
|
|
12
12
|
import { SURFACE_PORTAL_LAYER_ATTR as Ke, SURFACE_FLOATING_LAYER_ATTR as Qe } from "./dialogSurfaceScope.js";
|
|
13
|
-
var et = /* @__PURE__ */
|
|
13
|
+
var et = /* @__PURE__ */ u('<h2 class="text-xs leading-none font-medium truncate select-none">'), tt = /* @__PURE__ */ u('<div data-floe-floating-window-footer=true class="flex items-center justify-end gap-2 p-3 border-t border-border">'), nt = /* @__PURE__ */ u("<div data-floe-floating-window-resize-handle=n style=touch-action:none>"), it = /* @__PURE__ */ u("<div data-floe-floating-window-resize-handle=s style=touch-action:none>"), ot = /* @__PURE__ */ u("<div data-floe-floating-window-resize-handle=e style=touch-action:none>"), rt = /* @__PURE__ */ u("<div data-floe-floating-window-resize-handle=w style=touch-action:none>"), lt = /* @__PURE__ */ u("<div data-floe-floating-window-resize-handle=ne style=touch-action:none>"), st = /* @__PURE__ */ u("<div data-floe-floating-window-resize-handle=nw style=touch-action:none>"), at = /* @__PURE__ */ u("<div data-floe-floating-window-resize-handle=se style=touch-action:none>"), dt = /* @__PURE__ */ u("<div data-floe-floating-window-resize-handle=sw style=touch-action:none>"), ut = /* @__PURE__ */ u('<div data-floe-geometry-surface=floating-window><div data-floe-dialog-surface-host=true><div data-floe-floating-window-titlebar=true style=touch-action:none><div class="flex-1 min-w-0 px-2"></div><div class="flex h-full shrink-0 items-stretch"></div></div><div data-floe-floating-window-content=true class="flex-1 overflow-auto p-3">');
|
|
14
14
|
function St(i) {
|
|
15
|
-
const B = () => i.resizable ?? !0, G = () => i.draggable ?? !0,
|
|
15
|
+
const B = () => i.resizable ?? !0, G = () => i.draggable ?? !0, k = () => i.minSize ?? {
|
|
16
16
|
width: 200,
|
|
17
17
|
height: 150
|
|
18
|
-
},
|
|
18
|
+
}, T = () => i.maxSize ?? {
|
|
19
19
|
width: 1 / 0,
|
|
20
20
|
height: 1 / 0
|
|
21
|
-
}, x = () => i.viewportInsets ?? {}, pe = () => i.zIndex ?? 100, xe = He(), ze = Ue(), $ = () => ze.isMobile(),
|
|
21
|
+
}, x = () => i.viewportInsets ?? {}, pe = () => i.zIndex ?? 100, xe = He(), ze = Ue(), $ = () => ze.isMobile(), D = 16, j = () => `floating-window-${xe}-title`, [W, ye] = p(i.defaultPosition ?? {
|
|
22
22
|
x: 0,
|
|
23
23
|
y: 0
|
|
24
24
|
}), [O, be] = p(i.defaultSize ?? {
|
|
25
25
|
width: 400,
|
|
26
26
|
height: 300
|
|
27
|
-
}), [
|
|
27
|
+
}), [d, V] = p(!1), [R, Z] = p(!1), [E, J] = p(!1), [Se, H] = p(!1), _ = Je({
|
|
28
28
|
open: () => i.open,
|
|
29
29
|
exitDurationMs: 120
|
|
30
30
|
}), [$e, _e] = p(null);
|
|
@@ -75,7 +75,7 @@ function St(i) {
|
|
|
75
75
|
}, ie = (e) => {
|
|
76
76
|
y = e, l && (l.style.transform = `translate3d(${e.x}px, ${e.y}px, 0)`, l.style.width = `${e.width}px`, l.style.height = `${e.height}px`);
|
|
77
77
|
}, X = () => {
|
|
78
|
-
const e =
|
|
78
|
+
const e = W(), t = O();
|
|
79
79
|
return {
|
|
80
80
|
x: e.x,
|
|
81
81
|
y: e.y,
|
|
@@ -121,15 +121,15 @@ function St(i) {
|
|
|
121
121
|
resizeStartPos: ee,
|
|
122
122
|
resizeStartRect: te,
|
|
123
123
|
resizeHandle: ne,
|
|
124
|
-
minSize:
|
|
125
|
-
maxSize:
|
|
124
|
+
minSize: k(),
|
|
125
|
+
maxSize: T(),
|
|
126
126
|
viewport: {
|
|
127
127
|
width: window.innerWidth,
|
|
128
128
|
height: window.innerHeight
|
|
129
129
|
},
|
|
130
130
|
viewportInsets: x(),
|
|
131
131
|
mobile: $(),
|
|
132
|
-
mobilePadding:
|
|
132
|
+
mobilePadding: D
|
|
133
133
|
})));
|
|
134
134
|
}, F = (e) => {
|
|
135
135
|
if (typeof window > "u") return;
|
|
@@ -137,18 +137,18 @@ function St(i) {
|
|
|
137
137
|
width: window.innerWidth,
|
|
138
138
|
height: window.innerHeight
|
|
139
139
|
};
|
|
140
|
-
if (
|
|
140
|
+
if (d()) {
|
|
141
141
|
P(ge(t, x()));
|
|
142
142
|
return;
|
|
143
143
|
}
|
|
144
144
|
P(me({
|
|
145
145
|
rect: X(),
|
|
146
|
-
minSize:
|
|
147
|
-
maxSize:
|
|
146
|
+
minSize: k(),
|
|
147
|
+
maxSize: T(),
|
|
148
148
|
viewport: t,
|
|
149
149
|
viewportInsets: x(),
|
|
150
150
|
mobile: $(),
|
|
151
|
-
mobilePadding:
|
|
151
|
+
mobilePadding: D,
|
|
152
152
|
center: e?.center ?? !1
|
|
153
153
|
}));
|
|
154
154
|
}, re = (e) => {
|
|
@@ -221,7 +221,7 @@ function St(i) {
|
|
|
221
221
|
s === null ? ie(e) : y = e;
|
|
222
222
|
});
|
|
223
223
|
const Ae = (e) => {
|
|
224
|
-
!G() ||
|
|
224
|
+
!G() || d() || s !== null || e.pointerType === "mouse" && e.button !== 0 || e.target?.closest('button, input, select, textarea, a, [role="button"]') || (e.preventDefault(), s = e.pointerId, v = "drag", Z(!0), K = {
|
|
225
225
|
x: e.clientX,
|
|
226
226
|
y: e.clientY
|
|
227
227
|
}, Q = {
|
|
@@ -231,7 +231,7 @@ function St(i) {
|
|
|
231
231
|
y: e.clientY
|
|
232
232
|
}, N(!0, "grabbing"), se(e));
|
|
233
233
|
}, w = (e) => (t) => {
|
|
234
|
-
!B() ||
|
|
234
|
+
!B() || d() || s !== null || t.pointerType === "mouse" && t.button !== 0 || (t.preventDefault(), t.stopPropagation(), s = t.pointerId, v = "resize", J(!0), ne = e, ee = {
|
|
235
235
|
x: t.clientX,
|
|
236
236
|
y: t.clientY
|
|
237
237
|
}, te = {
|
|
@@ -270,7 +270,7 @@ function St(i) {
|
|
|
270
270
|
}
|
|
271
271
|
});
|
|
272
272
|
}, ae = () => {
|
|
273
|
-
if (s !== null && q(!0),
|
|
273
|
+
if (s !== null && q(!0), d()) {
|
|
274
274
|
const t = $e();
|
|
275
275
|
t && P(me({
|
|
276
276
|
rect: {
|
|
@@ -279,15 +279,15 @@ function St(i) {
|
|
|
279
279
|
width: t.size.width,
|
|
280
280
|
height: t.size.height
|
|
281
281
|
},
|
|
282
|
-
minSize:
|
|
283
|
-
maxSize:
|
|
282
|
+
minSize: k(),
|
|
283
|
+
maxSize: T(),
|
|
284
284
|
viewport: {
|
|
285
285
|
width: window.innerWidth,
|
|
286
286
|
height: window.innerHeight
|
|
287
287
|
},
|
|
288
288
|
viewportInsets: x(),
|
|
289
289
|
mobile: $(),
|
|
290
|
-
mobilePadding:
|
|
290
|
+
mobilePadding: D,
|
|
291
291
|
center: !1
|
|
292
292
|
})), V(!1);
|
|
293
293
|
return;
|
|
@@ -306,8 +306,8 @@ function St(i) {
|
|
|
306
306
|
width: window.innerWidth,
|
|
307
307
|
height: window.innerHeight
|
|
308
308
|
}, x())), V(!0);
|
|
309
|
-
}, Le = () => {
|
|
310
|
-
ae();
|
|
309
|
+
}, Le = (e) => {
|
|
310
|
+
e.target?.closest("button") || ae();
|
|
311
311
|
}, Me = (e) => {
|
|
312
312
|
Re(e.target) && Pe();
|
|
313
313
|
}, h = (e) => M("absolute z-10", {
|
|
@@ -325,10 +325,10 @@ function St(i) {
|
|
|
325
325
|
return _.mounted();
|
|
326
326
|
},
|
|
327
327
|
get children() {
|
|
328
|
-
return a(
|
|
328
|
+
return a(Te, {
|
|
329
329
|
get children() {
|
|
330
|
-
var e = ut(), t = e.firstChild, o = t.firstChild, r = o.firstChild, de = r.nextSibling,
|
|
331
|
-
return typeof ue == "function" ?
|
|
330
|
+
var e = ut(), t = e.firstChild, o = t.firstChild, r = o.firstChild, de = r.nextSibling, ke = o.nextSibling, ue = l;
|
|
331
|
+
return typeof ue == "function" ? We(ue, e) : l = e, ce(e, fe({
|
|
332
332
|
get "data-floating-presence"() {
|
|
333
333
|
return _.state();
|
|
334
334
|
},
|
|
@@ -345,7 +345,7 @@ function St(i) {
|
|
|
345
345
|
return {
|
|
346
346
|
width: `${O().width}px`,
|
|
347
347
|
height: `${O().height}px`,
|
|
348
|
-
transform: `translate3d(${
|
|
348
|
+
transform: `translate3d(${W().x}px, ${W().y}px, 0)`,
|
|
349
349
|
"z-index": pe(),
|
|
350
350
|
"will-change": R() ? "transform" : E() ? "transform, width, height" : void 0
|
|
351
351
|
};
|
|
@@ -371,7 +371,12 @@ function St(i) {
|
|
|
371
371
|
[ve]: "true"
|
|
372
372
|
}, {
|
|
373
373
|
get class() {
|
|
374
|
-
return M("relative flex h-full w-full flex-col overflow-hidden", "text-card-foreground rounded-md", "border", "floe-floating-presence floe-floating-window-motion", (R() || E()) && "floe-floating-presence--suspended",
|
|
374
|
+
return M("relative flex h-full w-full flex-col overflow-hidden", "text-card-foreground rounded-md", "border", "floe-floating-presence floe-floating-window-motion", (R() || E()) && "floe-floating-presence--suspended", d() && "rounded-none", i.class);
|
|
375
|
+
},
|
|
376
|
+
get style() {
|
|
377
|
+
return {
|
|
378
|
+
"border-radius": d() ? "0" : "10px"
|
|
379
|
+
};
|
|
375
380
|
},
|
|
376
381
|
get "data-floating-presence"() {
|
|
377
382
|
return _.state();
|
|
@@ -382,22 +387,23 @@ function St(i) {
|
|
|
382
387
|
},
|
|
383
388
|
get children() {
|
|
384
389
|
var n = et();
|
|
385
|
-
return g(n, () => i.title), c(() =>
|
|
390
|
+
return g(n, () => i.title), c(() => De(n, "id", j())), n;
|
|
386
391
|
}
|
|
387
392
|
})), g(de, a(he, {
|
|
388
393
|
variant: "ghost",
|
|
389
394
|
size: "icon",
|
|
390
|
-
|
|
395
|
+
"data-floe-floating-window-control": "maximize",
|
|
396
|
+
class: "h-full w-9 shrink-0 rounded-none border-0 px-0 active:scale-100",
|
|
391
397
|
onClick: (n) => {
|
|
392
398
|
n.stopPropagation(), ae();
|
|
393
399
|
},
|
|
394
400
|
get "aria-label"() {
|
|
395
|
-
return
|
|
401
|
+
return d() ? "Restore" : "Maximize";
|
|
396
402
|
},
|
|
397
403
|
get children() {
|
|
398
404
|
return a(S, {
|
|
399
405
|
get when() {
|
|
400
|
-
return
|
|
406
|
+
return d();
|
|
401
407
|
},
|
|
402
408
|
get fallback() {
|
|
403
409
|
return a(Be, {
|
|
@@ -414,7 +420,8 @@ function St(i) {
|
|
|
414
420
|
}), null), g(de, a(he, {
|
|
415
421
|
variant: "ghost-destructive",
|
|
416
422
|
size: "icon",
|
|
417
|
-
|
|
423
|
+
"data-floe-floating-window-control": "close",
|
|
424
|
+
class: "h-full w-10 shrink-0 rounded-none border-0 px-0 active:scale-100",
|
|
418
425
|
onClick: (n) => {
|
|
419
426
|
n.stopPropagation(), i.onOpenChange(!1);
|
|
420
427
|
},
|
|
@@ -424,7 +431,7 @@ function St(i) {
|
|
|
424
431
|
class: "w-3.5 h-3.5"
|
|
425
432
|
});
|
|
426
433
|
}
|
|
427
|
-
}), null), g(
|
|
434
|
+
}), null), g(ke, () => i.children), g(t, a(S, {
|
|
428
435
|
get when() {
|
|
429
436
|
return i.footer;
|
|
430
437
|
},
|
|
@@ -434,7 +441,7 @@ function St(i) {
|
|
|
434
441
|
}
|
|
435
442
|
}), null), g(t, a(S, {
|
|
436
443
|
get when() {
|
|
437
|
-
return we(() => !!B())() && !
|
|
444
|
+
return we(() => !!B())() && !d();
|
|
438
445
|
},
|
|
439
446
|
get children() {
|
|
440
447
|
return [(() => {
|
|
@@ -470,7 +477,7 @@ function St(i) {
|
|
|
470
477
|
}
|
|
471
478
|
})];
|
|
472
479
|
}
|
|
473
|
-
}), null), c(() => f(o, M("flex items-center justify-between h-
|
|
480
|
+
}), null), c(() => f(o, M("flex shrink-0 items-center justify-between h-8", "border-b", d() ? "rounded-none" : "rounded-t-md", G() && !d() && "cursor-move"))), e;
|
|
474
481
|
}
|
|
475
482
|
});
|
|
476
483
|
}
|
package/dist/floe.css
CHANGED
|
@@ -357,67 +357,49 @@
|
|
|
357
357
|
contain: layout paint style;
|
|
358
358
|
}
|
|
359
359
|
|
|
360
|
-
[data-floe-floating-window-surface='true'] {
|
|
361
|
-
|
|
362
|
-
|
|
360
|
+
[data-floe-floating-window-surface='true'].floe-floating-window-motion {
|
|
361
|
+
/* Floating windows use an opaque Mica-like stack in every surface mode.
|
|
362
|
+
* Keeping this on the component boundary makes the default (standard)
|
|
363
|
+
* path match the opt-in material without changing other controls. */
|
|
364
|
+
background-color: var(--card);
|
|
365
|
+
border-color: color-mix(in srgb, var(--border) 78%, var(--background) 22%);
|
|
366
|
+
border-radius: 10px;
|
|
363
367
|
box-shadow:
|
|
364
|
-
0
|
|
365
|
-
0 3px
|
|
366
|
-
|
|
367
|
-
border-color 140ms ease,
|
|
368
|
-
box-shadow 140ms ease,
|
|
369
|
-
background-color 140ms ease;
|
|
368
|
+
0 12px 28px -8px color-mix(in srgb, var(--foreground) 18%, transparent),
|
|
369
|
+
0 3px 8px -2px color-mix(in srgb, var(--foreground) 12%, transparent),
|
|
370
|
+
inset 0 1px 0 rgb(255 255 255 / 45%);
|
|
370
371
|
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
[data-floe-floating-window-surface='true'] {
|
|
374
|
-
backdrop-filter: blur(12px);
|
|
375
|
-
background-color: color-mix(in srgb, var(--card) 90%, transparent);
|
|
376
|
-
}
|
|
372
|
+
[data-floe-floating-window-surface='true'] {
|
|
373
|
+
border-radius: 10px;
|
|
377
374
|
}
|
|
378
375
|
|
|
379
376
|
[data-floe-floating-window-surface='true'][data-floe-floating-window-state='active'] {
|
|
380
|
-
border-color: color-mix(in srgb, var(--border)
|
|
381
|
-
box-shadow:
|
|
382
|
-
0 22px 48px color-mix(in srgb, var(--foreground) 16%, transparent),
|
|
383
|
-
0 5px 14px color-mix(in srgb, var(--foreground) 12%, transparent),
|
|
384
|
-
0 0 0 1px color-mix(in srgb, var(--ring) 22%, transparent);
|
|
377
|
+
border-color: color-mix(in srgb, var(--border) 60%, var(--ring) 40%);
|
|
385
378
|
}
|
|
386
379
|
|
|
387
380
|
[data-floe-floating-window-surface='true'][data-floe-floating-window-state='inactive'] {
|
|
388
|
-
border-color: color-mix(in srgb, var(--border)
|
|
389
|
-
box-shadow:
|
|
390
|
-
0 12px 28px color-mix(in srgb, var(--foreground) 10%, transparent),
|
|
391
|
-
0 2px 6px color-mix(in srgb, var(--foreground) 8%, transparent);
|
|
381
|
+
border-color: color-mix(in srgb, var(--border) 88%, var(--background) 12%);
|
|
392
382
|
}
|
|
393
383
|
|
|
394
384
|
[data-floe-floating-window-titlebar='true'] {
|
|
395
|
-
background:
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
385
|
+
background-color: color-mix(in srgb, var(--muted) 70%, var(--card) 30%);
|
|
386
|
+
border-bottom-color: color-mix(in srgb, var(--border) 70%, var(--background) 30%);
|
|
387
|
+
transition: none;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
:root.dark [data-floe-floating-window-surface='true'] {
|
|
391
|
+
box-shadow:
|
|
392
|
+
0 12px 28px -8px color-mix(in srgb, var(--foreground) 24%, transparent),
|
|
393
|
+
0 3px 8px -2px color-mix(in srgb, var(--foreground) 18%, transparent),
|
|
394
|
+
inset 0 1px 0 rgb(255 255 255 / 8%);
|
|
403
395
|
}
|
|
404
396
|
|
|
405
397
|
[data-floe-floating-window-surface='true'][data-floe-floating-window-state='active'] [data-floe-floating-window-titlebar='true'] {
|
|
406
|
-
background:
|
|
407
|
-
linear-gradient(
|
|
408
|
-
180deg,
|
|
409
|
-
color-mix(in srgb, var(--accent) 62%, var(--muted) 38%),
|
|
410
|
-
color-mix(in srgb, var(--muted) 52%, var(--card) 48%)
|
|
411
|
-
);
|
|
398
|
+
background-color: color-mix(in srgb, var(--accent) 24%, var(--muted) 76%);
|
|
412
399
|
}
|
|
413
400
|
|
|
414
401
|
[data-floe-floating-window-surface='true'][data-floe-floating-window-state='inactive'] [data-floe-floating-window-titlebar='true'] {
|
|
415
|
-
background:
|
|
416
|
-
linear-gradient(
|
|
417
|
-
180deg,
|
|
418
|
-
color-mix(in srgb, var(--muted) 80%, var(--card) 20%),
|
|
419
|
-
color-mix(in srgb, var(--muted) 64%, var(--card) 36%)
|
|
420
|
-
);
|
|
402
|
+
background-color: color-mix(in srgb, var(--muted) 56%, var(--card) 44%);
|
|
421
403
|
}
|
|
422
404
|
|
|
423
405
|
[data-floe-hot-interaction~='resize'] [data-floe-geometry-surface='shell-sidebar'],
|
|
@@ -433,6 +415,19 @@
|
|
|
433
415
|
}
|
|
434
416
|
}
|
|
435
417
|
|
|
418
|
+
/* Edge-aligned window controls keep their keyboard indicator inside the
|
|
419
|
+
* clipped panel. The outer resize perimeter keeps its existing hit targets. */
|
|
420
|
+
[data-floe-floating-window-control]:focus-visible {
|
|
421
|
+
box-shadow: none;
|
|
422
|
+
outline: 2px solid var(--ring);
|
|
423
|
+
outline-offset: -3px;
|
|
424
|
+
}
|
|
425
|
+
@media (forced-colors: active) {
|
|
426
|
+
[data-floe-floating-window-control]:focus-visible {
|
|
427
|
+
outline-color: Highlight;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
|
|
436
431
|
/* Animation utilities */
|
|
437
432
|
@layer utilities {
|
|
438
433
|
.floe-floating-presence {
|