@smwb/ui-solid 0.9.0 → 0.11.0
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/README.md +16 -0
- package/dist/assets/styles/less/components/floatingWindow/floatingWindow.entry.css +1 -0
- package/dist/assets/styles/less/components/treeView/treeView.entry.css +1 -1
- package/dist/components/layout/floatingWindow/floatingWindow.d.ts +92 -0
- package/dist/components/layout/floatingWindow/floatingWindow.js +417 -0
- package/dist/components/layout/floatingWindow/floatingWindow.js.map +1 -0
- package/dist/components/layout/floatingWindow/index.d.ts +2 -0
- package/dist/connects/rt/index.d.ts +2 -0
- package/dist/connects/rt/table/index.d.ts +2 -0
- package/dist/connects/rt/table/table.d.ts +48 -0
- package/dist/headless/components/layout/floatingWindow/floatingWindow.js +416 -0
- package/dist/headless/components/layout/floatingWindow/floatingWindow.js.map +1 -0
- package/dist/headless/index.js +314 -308
- package/dist/headless/index.js.map +1 -1
- package/dist/headless/primitives/createHoverPopover.js +80 -0
- package/dist/headless/primitives/createHoverPopover.js.map +1 -0
- package/dist/headless/primitives/createRovingTabIndex.js +25 -0
- package/dist/headless/primitives/createRovingTabIndex.js.map +1 -0
- package/dist/headless/source/components/layout/floatingWindow/floatingWindow.jsx +403 -0
- package/dist/headless/source/components/layout/floatingWindow/floatingWindow.jsx.map +1 -0
- package/dist/headless/source/components/layout/floatingWindow/index.js +6 -0
- package/dist/headless/source/components/layout/floatingWindow/index.js.map +7 -0
- package/dist/headless/source/connects/rt/index.js +5 -0
- package/dist/headless/source/connects/rt/index.js.map +7 -0
- package/dist/headless/source/connects/rt/table/index.js +6 -0
- package/dist/headless/source/connects/rt/table/index.js.map +7 -0
- package/dist/headless/source/connects/rt/table/table.jsx +183 -0
- package/dist/headless/source/connects/rt/table/table.jsx.map +1 -0
- package/dist/headless/source/index.js +6 -0
- package/dist/headless/source/index.js.map +2 -2
- package/dist/headless/source/primitives/createHoverPopover.js +126 -0
- package/dist/headless/source/primitives/createHoverPopover.js.map +7 -0
- package/dist/headless/source/primitives/createRovingTabIndex.js +45 -0
- package/dist/headless/source/primitives/createRovingTabIndex.js.map +7 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +314 -308
- package/dist/index.js.map +1 -1
- package/dist/primitives/createHoverPopover.d.ts +73 -0
- package/dist/primitives/createHoverPopover.js +80 -0
- package/dist/primitives/createHoverPopover.js.map +1 -0
- package/dist/primitives/createRovingTabIndex.d.ts +26 -0
- package/dist/primitives/createRovingTabIndex.js +25 -0
- package/dist/primitives/createRovingTabIndex.js.map +1 -0
- package/dist/source/components/layout/floatingWindow/floatingWindow.jsx +404 -0
- package/dist/source/components/layout/floatingWindow/floatingWindow.jsx.map +1 -0
- package/dist/source/components/layout/floatingWindow/index.js +6 -0
- package/dist/source/components/layout/floatingWindow/index.js.map +7 -0
- package/dist/source/connects/rt/index.js +5 -0
- package/dist/source/connects/rt/index.js.map +7 -0
- package/dist/source/connects/rt/table/index.js +6 -0
- package/dist/source/connects/rt/table/index.js.map +7 -0
- package/dist/source/connects/rt/table/table.jsx +183 -0
- package/dist/source/connects/rt/table/table.jsx.map +1 -0
- package/dist/source/index.js +6 -0
- package/dist/source/index.js.map +2 -2
- package/dist/source/primitives/createHoverPopover.js +126 -0
- package/dist/source/primitives/createHoverPopover.js.map +7 -0
- package/dist/source/primitives/createRovingTabIndex.js +45 -0
- package/dist/source/primitives/createRovingTabIndex.js.map +7 -0
- package/package.json +25 -6
package/README.md
CHANGED
|
@@ -159,6 +159,22 @@ Each component's required entries (and their dependencies) are listed by the MCP
|
|
|
159
159
|
`get_component_props` (see `@smwb/ui-mcp-solid`). Import `<name>.entry.less`, never the bare
|
|
160
160
|
`components/<name>/<name>.less`.
|
|
161
161
|
|
|
162
|
+
### TanStack Table adapter
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
import { Table } from "@smwb/ui-solid/solid-table";
|
|
166
|
+
|
|
167
|
+
<Table data={rows} columns={columns} sortable withPagination limit={10} />;
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Binds [@tanstack/solid-table](https://tanstack.com/table) v8 to the smwb table components:
|
|
171
|
+
columns are plain `ColumnDef`s, cells go through `flexRender`, and the adapter adds the sort
|
|
172
|
+
affordance, the pagination footer and the loading / error rows. Column definitions written for
|
|
173
|
+
the `react-table` adapter work unchanged.
|
|
174
|
+
|
|
175
|
+
`@tanstack/solid-table` is an optional peer — install it in your app; it ships with this subpath
|
|
176
|
+
only. Column dragging and resizing are not ported yet. See Storybook → **Connects / solid-table**.
|
|
177
|
+
|
|
162
178
|
## Customization and theming
|
|
163
179
|
|
|
164
180
|
| Goal | Approach | Rebuild CSS? |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.smwb-floating-window{background-color:var(--smui-surfaceBackground);color:var(--smui-onSurfaceColor);position:fixed;z-index:150;display:flex;flex-direction:column;box-sizing:border-box;overflow:hidden;border-radius:12px;box-shadow:#00000024 0 8px 10px -5px,#00000024 0 1px 14px 1px,#00000024 0 6px 22px 4px;opacity:0;transition:opacity .12s ease-in-out}.smwb-floating-window.smwb-floating-window_entered{opacity:1}.smwb-floating-window__header{display:flex;align-items:center;gap:4px;flex-shrink:0;height:36px;padding:0 12px;border-bottom:1px solid var(--smui-dividerColor);touch-action:none;user-select:none;cursor:move}.smwb-floating-window__header:focus-visible{outline:2px solid var(--smui-primaryColor);outline-offset:-2px}.smwb-floating-window__grip{display:inline-flex;align-items:center;color:var(--smui-onSurfaceVariant);flex-shrink:0;cursor:move}.smwb-floating-window__grip:focus-visible{outline:2px solid var(--smui-primaryColor);outline-offset:2px;border-radius:2px}.smwb-floating-window__title{font-family:var(--smui-fontFamily);font-size:14px;font-weight:500;line-height:1.5;color:var(--smui-onSurfaceColor);flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.smwb-floating-window__actions{display:flex;align-items:center;gap:2px;flex-shrink:0;margin-left:auto;cursor:default}.smwb-floating-window__action{display:inline-flex;align-items:center;justify-content:center;padding:2px;border:none;border-radius:4px;background:transparent;color:var(--smui-onSurfaceVariant);cursor:pointer}.smwb-floating-window__action:hover{background-color:var(--smui-onSurfaceHover);color:var(--smui-onSurfaceColor)}.smwb-floating-window__action:focus-visible{outline:2px solid var(--smui-primaryColor);outline-offset:-2px}.smwb-floating-window__body{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;overflow:auto;padding:12px}.smwb-floating-window.smwb-collapsed{height:auto}.smwb-floating-window__resize{position:absolute;touch-action:none;user-select:none;z-index:1}.smwb-floating-window__resize:focus-visible{outline:2px solid var(--smui-primaryColor);outline-offset:-2px}.smwb-floating-window__resize_n,.smwb-floating-window__resize_s{left:6px;right:6px;height:6px;cursor:ns-resize}.smwb-floating-window__resize_e,.smwb-floating-window__resize_w{top:6px;bottom:6px;width:6px;cursor:ew-resize}.smwb-floating-window__resize_n{top:0}.smwb-floating-window__resize_s{bottom:0}.smwb-floating-window__resize_e{right:0}.smwb-floating-window__resize_w{left:0}.smwb-floating-window__resize_ne,.smwb-floating-window__resize_nw,.smwb-floating-window__resize_se,.smwb-floating-window__resize_sw{width:12px;height:12px}.smwb-floating-window__resize_ne{top:0;right:0;cursor:nesw-resize}.smwb-floating-window__resize_nw{top:0;left:0;cursor:nwse-resize}.smwb-floating-window__resize_se{bottom:0;right:0;cursor:nwse-resize}.smwb-floating-window__resize_sw{bottom:0;left:0;cursor:nesw-resize}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.smwb-tree__wrapper .smwb-tree__node:first-child{border-left:0}.smwb-tree__wrapper .smwb-tree__node:first-child:before{opacity:0}.smwb-tree__node{padding-left:30px;margin-left:9px;position:relative;border-left:1px solid var(--smui-primaryColor)}.smwb-tree__node:last-child{border-left-color:transparent}.smwb-tree__node:before{position:absolute;top:0;left:-1px;height:20px;width:25px;border-bottom:1px solid var(--smui-primaryColor);border-left:1px solid var(--smui-primaryColor);content:"";font-weight:600;font-size:14px}.smwb-tree__node__label{position:relative;display:inline-flex;align-items:center;gap:10px}.smwb-tree__node__content{display:flex;align-items:center;gap:10px;height:40px;cursor:pointer;user-select:none}.smwb-tree__node_selected>.smwb-tree__node__content{background-color:var(--smui-onSurfaceHover);border-radius:4px}.smwb-tree__node__checkbox{flex-shrink:0;width:18px;height:18px;min-width:18px;min-height:18px;margin:0;cursor:pointer;accent-color:var(--smui-checkboxCheckedBg)}.smwb-tree__node__loading{padding:4px 8px 4px 28px;font-size:13px;color:var(--smui-onSurfaceVariant)}
|
|
1
|
+
.smwb-tree__wrapper .smwb-tree__node:first-child{border-left:0}.smwb-tree__wrapper .smwb-tree__node:first-child:before{opacity:0}.smwb-tree__node{padding-left:30px;margin-left:9px;position:relative;border-left:1px solid var(--smui-primaryColor)}.smwb-tree__node:last-child{border-left-color:transparent}.smwb-tree__node:before{position:absolute;top:0;left:-1px;height:20px;width:25px;border-bottom:1px solid var(--smui-primaryColor);border-left:1px solid var(--smui-primaryColor);content:"";font-weight:600;font-size:14px}.smwb-tree__node__label{position:relative;display:inline-flex;align-items:center;gap:10px;min-width:0;overflow-wrap:break-word}.smwb-tree__node__label>.smwb-icon__wrapper{flex:none}.smwb-tree__node__content{display:flex;align-items:center;gap:10px;min-height:40px;cursor:pointer;user-select:none}.smwb-tree__node_selected>.smwb-tree__node__content{background-color:var(--smui-onSurfaceHover);border-radius:4px}.smwb-tree__node__checkbox{flex-shrink:0;width:18px;height:18px;min-width:18px;min-height:18px;margin:0;cursor:pointer;accent-color:var(--smui-checkboxCheckedBg)}.smwb-tree__node__loading{padding:4px 8px 4px 28px;font-size:13px;color:var(--smui-onSurfaceVariant)}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { type JSX, type ParentProps } from "solid-js";
|
|
2
|
+
import { type Ref } from "../../../primitives/mergeRefs";
|
|
3
|
+
export interface FloatingWindowPosition {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
}
|
|
7
|
+
export interface FloatingWindowSize {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
}
|
|
11
|
+
/** The eight edge/corner resize directions. */
|
|
12
|
+
export type FloatingWindowResizeDir = "n" | "s" | "e" | "w" | "ne" | "nw" | "se" | "sw";
|
|
13
|
+
export interface FloatingWindowProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, "onResize" | "title"> {
|
|
14
|
+
/** Controlled open state of the window. */
|
|
15
|
+
open: boolean;
|
|
16
|
+
/** Title bar content. When given, the window is labelled by it. */
|
|
17
|
+
title?: JSX.Element;
|
|
18
|
+
/** Extra header controls, rendered before the built-in collapse/close buttons. */
|
|
19
|
+
headerActions?: JSX.Element;
|
|
20
|
+
/** Controlled top-left position in viewport px. */
|
|
21
|
+
position?: FloatingWindowPosition;
|
|
22
|
+
/** Initial position when uncontrolled. */
|
|
23
|
+
defaultPosition?: FloatingWindowPosition;
|
|
24
|
+
/** Called on every move frame and on viewport re-clamp, with the clamped position. */
|
|
25
|
+
onPositionChange?: ((position: FloatingWindowPosition) => void) | undefined;
|
|
26
|
+
/** Called once when a move gesture ends — the point at which to persist. */
|
|
27
|
+
onMoveEnd?: ((position: FloatingWindowPosition) => void) | undefined;
|
|
28
|
+
/** Controlled size in px. */
|
|
29
|
+
size?: FloatingWindowSize;
|
|
30
|
+
/** Initial size when uncontrolled. */
|
|
31
|
+
defaultSize?: FloatingWindowSize;
|
|
32
|
+
/** Called on every resize frame and on viewport re-clamp, with the clamped size. */
|
|
33
|
+
onResize?: ((size: FloatingWindowSize) => void) | undefined;
|
|
34
|
+
/** Called once when a resize gesture ends — the point at which to persist. */
|
|
35
|
+
onResizeEnd?: ((size: FloatingWindowSize) => void) | undefined;
|
|
36
|
+
/** Minimum width in px (default 200). */
|
|
37
|
+
minWidth?: number;
|
|
38
|
+
/** Minimum height in px (default 120). */
|
|
39
|
+
minHeight?: number;
|
|
40
|
+
/** Maximum width in px (default: viewport width). */
|
|
41
|
+
maxWidth?: number;
|
|
42
|
+
/** Maximum height in px (default: viewport height). */
|
|
43
|
+
maxHeight?: number;
|
|
44
|
+
/** Px of the window that must stay inside the viewport (default 56). */
|
|
45
|
+
keepVisible?: number;
|
|
46
|
+
/** Step in px for keyboard moving (default 24). */
|
|
47
|
+
moveStep?: number;
|
|
48
|
+
/** Step in px for keyboard resizing (default 24). */
|
|
49
|
+
resizeStep?: number;
|
|
50
|
+
/** Inline stacking order. The host owns z-order across several windows. */
|
|
51
|
+
zIndex?: number;
|
|
52
|
+
/** Called on pointerdown anywhere in the window, so the host can raise it. */
|
|
53
|
+
onActivate?: (() => void) | undefined;
|
|
54
|
+
/** Shade the window down to its title bar. */
|
|
55
|
+
collapsed?: boolean;
|
|
56
|
+
/** Initial collapsed state when uncontrolled. */
|
|
57
|
+
defaultCollapsed?: boolean;
|
|
58
|
+
onCollapsedChange?: ((collapsed: boolean) => void) | undefined;
|
|
59
|
+
/** Render the built-in collapse toggle (default true). */
|
|
60
|
+
collapsible?: boolean;
|
|
61
|
+
/** Allow drag-to-move by the title bar (default true). */
|
|
62
|
+
movable?: boolean;
|
|
63
|
+
/** Allow drag-to-resize from the edges and corners (default true). */
|
|
64
|
+
resizable?: boolean;
|
|
65
|
+
/** Close on Escape while focus is inside the window (default false). */
|
|
66
|
+
closeOnEsc?: boolean;
|
|
67
|
+
onClose?: (() => void) | undefined;
|
|
68
|
+
/** Accessible label for the move handle. */
|
|
69
|
+
moveHandleAriaLabel?: string;
|
|
70
|
+
/** Accessible label for the resize handle. */
|
|
71
|
+
resizeHandleAriaLabel?: string;
|
|
72
|
+
/** Accessible label for the close button. */
|
|
73
|
+
closeAriaLabel?: string;
|
|
74
|
+
/** Accessible label for the collapse toggle while expanded. */
|
|
75
|
+
collapseAriaLabel?: string;
|
|
76
|
+
/** Accessible label for the collapse toggle while collapsed. */
|
|
77
|
+
expandAriaLabel?: string;
|
|
78
|
+
"aria-label"?: string;
|
|
79
|
+
ref?: Ref<HTMLDivElement>;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Free-floating, non-modal window: draggable by its title bar, resizable from every
|
|
83
|
+
* edge and corner, clamped so a grabbable strip always stays on screen.
|
|
84
|
+
*
|
|
85
|
+
* Unlike Sheet/Modal it is deliberately NOT an overlay layer: no backdrop, no focus
|
|
86
|
+
* trap, no `data-smwb-overlay-layer`. Several windows are meant to be open and usable
|
|
87
|
+
* at once alongside the page behind them, so it must not trap focus, swallow clicks,
|
|
88
|
+
* or steal Escape from a Modal stacked above it. Stacking order is the host's job —
|
|
89
|
+
* pass `zIndex` and raise the window from `onActivate`.
|
|
90
|
+
*/
|
|
91
|
+
export declare function FloatingWindow(props: ParentProps<FloatingWindowProps>): JSX.Element;
|
|
92
|
+
export default FloatingWindow;
|
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
import { isServer as $, createComponent as d, Portal as ie, use as oe, spread as K, mergeProps as T, insert as c, setAttribute as x, effect as M, memo as ae, template as _, delegateEvents as re } from "solid-js/web";
|
|
2
|
+
import '../../../assets/styles/less/components/floatingWindow/floatingWindow.entry.css';/* empty css */
|
|
3
|
+
import { mergeProps as le, splitProps as se, createSignal as de, createMemo as ce, createEffect as A, onCleanup as V, Show as y, For as he } from "solid-js";
|
|
4
|
+
import O from "clsx";
|
|
5
|
+
import { createCssTransition as we } from "../../../primitives/createCssTransition.js";
|
|
6
|
+
import { createControllableState as E } from "../../../primitives/createControllableState.js";
|
|
7
|
+
import { createId as pe } from "../../../primitives/createId.js";
|
|
8
|
+
import { mergeRefs as ue } from "../../../primitives/mergeRefs.js";
|
|
9
|
+
import { Icon as P } from "../../base/icon/icon.js";
|
|
10
|
+
var me = /* @__PURE__ */ _("<span class=smwb-floating-window__title>"), ge = /* @__PURE__ */ _("<button type=button class=smwb-floating-window__action data-testid=floating-window-collapse>"), fe = /* @__PURE__ */ _("<button type=button class=smwb-floating-window__action data-testid=floating-window-close>"), xe = /* @__PURE__ */ _("<div class=smwb-floating-window__body data-testid=floating-window-body>"), ye = /* @__PURE__ */ _("<div><div class=smwb-floating-window__header data-testid=floating-window-header><span class=smwb-floating-window__grip data-testid=floating-window-move role=button tabindex=0></span><div class=smwb-floating-window__actions data-no-drag>"), be = /* @__PURE__ */ _("<div>");
|
|
11
|
+
const _e = {
|
|
12
|
+
n: {
|
|
13
|
+
dx: 0,
|
|
14
|
+
dy: 1,
|
|
15
|
+
dw: 0,
|
|
16
|
+
dh: -1
|
|
17
|
+
},
|
|
18
|
+
s: {
|
|
19
|
+
dx: 0,
|
|
20
|
+
dy: 0,
|
|
21
|
+
dw: 0,
|
|
22
|
+
dh: 1
|
|
23
|
+
},
|
|
24
|
+
e: {
|
|
25
|
+
dx: 0,
|
|
26
|
+
dy: 0,
|
|
27
|
+
dw: 1,
|
|
28
|
+
dh: 0
|
|
29
|
+
},
|
|
30
|
+
w: {
|
|
31
|
+
dx: 1,
|
|
32
|
+
dy: 0,
|
|
33
|
+
dw: -1,
|
|
34
|
+
dh: 0
|
|
35
|
+
},
|
|
36
|
+
ne: {
|
|
37
|
+
dx: 0,
|
|
38
|
+
dy: 1,
|
|
39
|
+
dw: 1,
|
|
40
|
+
dh: -1
|
|
41
|
+
},
|
|
42
|
+
nw: {
|
|
43
|
+
dx: 1,
|
|
44
|
+
dy: 1,
|
|
45
|
+
dw: -1,
|
|
46
|
+
dh: -1
|
|
47
|
+
},
|
|
48
|
+
se: {
|
|
49
|
+
dx: 0,
|
|
50
|
+
dy: 0,
|
|
51
|
+
dw: 1,
|
|
52
|
+
dh: 1
|
|
53
|
+
},
|
|
54
|
+
sw: {
|
|
55
|
+
dx: 1,
|
|
56
|
+
dy: 0,
|
|
57
|
+
dw: -1,
|
|
58
|
+
dh: 1
|
|
59
|
+
}
|
|
60
|
+
}, ve = ["n", "s", "e", "w", "ne", "nw", "se", "sw"], b = () => typeof window > "u" ? {
|
|
61
|
+
width: 0,
|
|
62
|
+
height: 0
|
|
63
|
+
} : {
|
|
64
|
+
width: window.innerWidth,
|
|
65
|
+
height: window.innerHeight
|
|
66
|
+
};
|
|
67
|
+
function Le(X) {
|
|
68
|
+
const Y = le({
|
|
69
|
+
minWidth: 200,
|
|
70
|
+
minHeight: 120,
|
|
71
|
+
keepVisible: 56,
|
|
72
|
+
moveStep: 24,
|
|
73
|
+
resizeStep: 24,
|
|
74
|
+
collapsible: !0,
|
|
75
|
+
movable: !0,
|
|
76
|
+
resizable: !0,
|
|
77
|
+
closeOnEsc: !1,
|
|
78
|
+
defaultPosition: {
|
|
79
|
+
x: 24,
|
|
80
|
+
y: 24
|
|
81
|
+
},
|
|
82
|
+
defaultSize: {
|
|
83
|
+
width: 360,
|
|
84
|
+
height: 420
|
|
85
|
+
},
|
|
86
|
+
defaultCollapsed: !1,
|
|
87
|
+
moveHandleAriaLabel: "Move window",
|
|
88
|
+
resizeHandleAriaLabel: "Resize window",
|
|
89
|
+
closeAriaLabel: "Close window",
|
|
90
|
+
collapseAriaLabel: "Collapse window",
|
|
91
|
+
expandAriaLabel: "Expand window"
|
|
92
|
+
}, X), [t, U] = se(Y, ["open", "title", "headerActions", "position", "defaultPosition", "onPositionChange", "onMoveEnd", "size", "defaultSize", "onResize", "onResizeEnd", "minWidth", "minHeight", "maxWidth", "maxHeight", "keepVisible", "moveStep", "resizeStep", "zIndex", "onActivate", "collapsed", "defaultCollapsed", "onCollapsedChange", "collapsible", "movable", "resizable", "closeOnEsc", "onClose", "moveHandleAriaLabel", "resizeHandleAriaLabel", "closeAriaLabel", "collapseAriaLabel", "expandAriaLabel", "class", "style", "children", "ref"]);
|
|
93
|
+
let f;
|
|
94
|
+
const H = pe(void 0, "smwb-floating-window-title"), R = we({
|
|
95
|
+
in: () => t.open,
|
|
96
|
+
timeout: {
|
|
97
|
+
enter: 120,
|
|
98
|
+
exit: 120
|
|
99
|
+
},
|
|
100
|
+
classNames: {
|
|
101
|
+
enterDone: "smwb-floating-window_entered"
|
|
102
|
+
},
|
|
103
|
+
appear: !0
|
|
104
|
+
}), [v, F] = E({
|
|
105
|
+
value: () => t.position,
|
|
106
|
+
defaultValue: t.defaultPosition,
|
|
107
|
+
onChange: (e) => t.onPositionChange?.(e)
|
|
108
|
+
}), [z, Z] = E({
|
|
109
|
+
value: () => t.size,
|
|
110
|
+
defaultValue: t.defaultSize,
|
|
111
|
+
onChange: (e) => t.onResize?.(e)
|
|
112
|
+
}), [m, j] = E({
|
|
113
|
+
value: () => t.collapsed,
|
|
114
|
+
defaultValue: t.defaultCollapsed,
|
|
115
|
+
onChange: (e) => t.onCollapsedChange?.(e)
|
|
116
|
+
}), C = (e, n) => {
|
|
117
|
+
const i = t.maxWidth ?? n.width, r = t.maxHeight ?? n.height, a = Math.max(t.minWidth, Math.min(i, e.width)), o = Math.max(t.minHeight, Math.min(r, e.height)), l = Math.min(t.keepVisible, a), u = Math.max(l - a, Math.min(n.width - l, e.x)), g = Math.max(0, Math.min(Math.max(0, n.height - l), e.y));
|
|
118
|
+
return {
|
|
119
|
+
x: u,
|
|
120
|
+
y: g,
|
|
121
|
+
width: a,
|
|
122
|
+
height: o
|
|
123
|
+
};
|
|
124
|
+
}, G = (e, n) => {
|
|
125
|
+
const i = C(e, n);
|
|
126
|
+
return {
|
|
127
|
+
...i,
|
|
128
|
+
x: Math.max(0, Math.min(i.x, n.width - i.width)),
|
|
129
|
+
y: Math.max(0, Math.min(i.y, n.height - i.height))
|
|
130
|
+
};
|
|
131
|
+
}, [N, L] = de(!1), s = ce(() => {
|
|
132
|
+
const e = {
|
|
133
|
+
x: v().x,
|
|
134
|
+
y: v().y,
|
|
135
|
+
width: z().width,
|
|
136
|
+
height: z().height
|
|
137
|
+
};
|
|
138
|
+
return N() ? C(e, b()) : G(e, b());
|
|
139
|
+
}), h = (e, n = !0) => {
|
|
140
|
+
n && L(!0);
|
|
141
|
+
const i = C(e, b()), r = v(), a = z();
|
|
142
|
+
(i.x !== r.x || i.y !== r.y) && F({
|
|
143
|
+
x: i.x,
|
|
144
|
+
y: i.y
|
|
145
|
+
}), (i.width !== a.width || i.height !== a.height) && Z({
|
|
146
|
+
width: i.width,
|
|
147
|
+
height: i.height
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
A(() => {
|
|
151
|
+
t.open || L(!1);
|
|
152
|
+
}), A(() => {
|
|
153
|
+
if ($ || !t.open) return;
|
|
154
|
+
const e = () => h(s(), !1);
|
|
155
|
+
window.addEventListener("resize", e), V(() => window.removeEventListener("resize", e));
|
|
156
|
+
}), A(() => {
|
|
157
|
+
if ($ || !t.open || !t.closeOnEsc || !t.onClose) return;
|
|
158
|
+
const e = (n) => {
|
|
159
|
+
n.key === "Escape" && (!f || !f.contains(document.activeElement) || t.onClose?.());
|
|
160
|
+
};
|
|
161
|
+
document.addEventListener("keydown", e), V(() => document.removeEventListener("keydown", e));
|
|
162
|
+
});
|
|
163
|
+
const k = () => {
|
|
164
|
+
t.onActivate?.(), f && !f.contains(document.activeElement) && f.focus({
|
|
165
|
+
preventScroll: !0
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
let w = null;
|
|
169
|
+
const q = (e) => {
|
|
170
|
+
if (!t.movable || e.target?.closest("button,[data-no-drag]")) return;
|
|
171
|
+
e.preventDefault();
|
|
172
|
+
const n = s();
|
|
173
|
+
w = {
|
|
174
|
+
px: e.clientX,
|
|
175
|
+
py: e.clientY,
|
|
176
|
+
x: n.x,
|
|
177
|
+
y: n.y
|
|
178
|
+
};
|
|
179
|
+
try {
|
|
180
|
+
e.currentTarget.setPointerCapture?.(e.pointerId);
|
|
181
|
+
} catch {
|
|
182
|
+
}
|
|
183
|
+
}, B = (e) => {
|
|
184
|
+
if (!w) return;
|
|
185
|
+
const n = s();
|
|
186
|
+
h({
|
|
187
|
+
...n,
|
|
188
|
+
x: w.x + e.clientX - w.px,
|
|
189
|
+
y: w.y + e.clientY - w.py
|
|
190
|
+
});
|
|
191
|
+
}, S = (e) => {
|
|
192
|
+
if (w) {
|
|
193
|
+
w = null;
|
|
194
|
+
const n = s();
|
|
195
|
+
t.onMoveEnd?.({
|
|
196
|
+
x: n.x,
|
|
197
|
+
y: n.y
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
e.currentTarget.hasPointerCapture?.(e.pointerId) && e.currentTarget.releasePointerCapture?.(e.pointerId);
|
|
201
|
+
};
|
|
202
|
+
let p = null;
|
|
203
|
+
const J = (e, n) => {
|
|
204
|
+
n.preventDefault(), n.stopPropagation(), p = {
|
|
205
|
+
dir: e,
|
|
206
|
+
px: n.clientX,
|
|
207
|
+
py: n.clientY,
|
|
208
|
+
rect: s()
|
|
209
|
+
}, k();
|
|
210
|
+
try {
|
|
211
|
+
n.currentTarget.setPointerCapture?.(n.pointerId);
|
|
212
|
+
} catch {
|
|
213
|
+
}
|
|
214
|
+
}, Q = (e) => {
|
|
215
|
+
if (!p) return;
|
|
216
|
+
const n = _e[p.dir], i = e.clientX - p.px, r = e.clientY - p.py, a = p.rect, o = b(), l = t.maxWidth ?? o.width, u = t.maxHeight ?? o.height, g = Math.min(l, Math.max(t.minWidth, a.width + n.dw * i)), W = Math.min(u, Math.max(t.minHeight, a.height + n.dh * r));
|
|
217
|
+
h({
|
|
218
|
+
x: n.dx ? a.x + a.width - g : a.x,
|
|
219
|
+
y: n.dy ? a.y + a.height - W : a.y,
|
|
220
|
+
width: g,
|
|
221
|
+
height: W
|
|
222
|
+
});
|
|
223
|
+
}, D = (e) => {
|
|
224
|
+
if (p) {
|
|
225
|
+
p = null;
|
|
226
|
+
const n = s();
|
|
227
|
+
t.onResizeEnd?.({
|
|
228
|
+
width: n.width,
|
|
229
|
+
height: n.height
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
e.currentTarget.hasPointerCapture?.(e.pointerId) && e.currentTarget.releasePointerCapture?.(e.pointerId);
|
|
233
|
+
}, I = (e) => {
|
|
234
|
+
const n = s();
|
|
235
|
+
e ? t.onResizeEnd?.({
|
|
236
|
+
width: n.width,
|
|
237
|
+
height: n.height
|
|
238
|
+
}) : t.onMoveEnd?.({
|
|
239
|
+
x: n.x,
|
|
240
|
+
y: n.y
|
|
241
|
+
});
|
|
242
|
+
}, ee = (e) => {
|
|
243
|
+
const n = s(), i = e.shiftKey ? t.resizeStep : t.moveStep, a = {
|
|
244
|
+
ArrowLeft: [-i, 0],
|
|
245
|
+
ArrowRight: [i, 0],
|
|
246
|
+
ArrowUp: [0, -i],
|
|
247
|
+
ArrowDown: [0, i]
|
|
248
|
+
}[e.key];
|
|
249
|
+
a && (e.preventDefault(), e.shiftKey ? h({
|
|
250
|
+
...n,
|
|
251
|
+
width: n.width + a[0],
|
|
252
|
+
height: n.height + a[1]
|
|
253
|
+
}) : h({
|
|
254
|
+
...n,
|
|
255
|
+
x: n.x + a[0],
|
|
256
|
+
y: n.y + a[1]
|
|
257
|
+
}), I(e.shiftKey));
|
|
258
|
+
}, te = (e) => {
|
|
259
|
+
const n = s(), i = b();
|
|
260
|
+
if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
|
|
261
|
+
e.preventDefault();
|
|
262
|
+
const r = e.key === "ArrowRight" ? 1 : -1;
|
|
263
|
+
h({
|
|
264
|
+
...n,
|
|
265
|
+
width: n.width + r * t.resizeStep
|
|
266
|
+
});
|
|
267
|
+
} else if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
268
|
+
e.preventDefault();
|
|
269
|
+
const r = e.key === "ArrowDown" ? 1 : -1;
|
|
270
|
+
h({
|
|
271
|
+
...n,
|
|
272
|
+
height: n.height + r * t.resizeStep
|
|
273
|
+
});
|
|
274
|
+
} else if (e.key === "Home")
|
|
275
|
+
e.preventDefault(), h({
|
|
276
|
+
...n,
|
|
277
|
+
width: t.minWidth,
|
|
278
|
+
height: t.minHeight
|
|
279
|
+
});
|
|
280
|
+
else if (e.key === "End")
|
|
281
|
+
e.preventDefault(), h({
|
|
282
|
+
...n,
|
|
283
|
+
width: t.maxWidth ?? i.width,
|
|
284
|
+
height: t.maxHeight ?? i.height
|
|
285
|
+
});
|
|
286
|
+
else
|
|
287
|
+
return;
|
|
288
|
+
I(!0);
|
|
289
|
+
}, ne = () => j((e) => !e);
|
|
290
|
+
return d(y, {
|
|
291
|
+
get when() {
|
|
292
|
+
return R.mounted();
|
|
293
|
+
},
|
|
294
|
+
get children() {
|
|
295
|
+
return d(ie, {
|
|
296
|
+
get mount() {
|
|
297
|
+
return $ ? void 0 : document.body;
|
|
298
|
+
},
|
|
299
|
+
get children() {
|
|
300
|
+
var e = ye(), n = e.firstChild, i = n.firstChild, r = i.nextSibling, a = ue(t.ref, (o) => f = o);
|
|
301
|
+
return typeof a == "function" && oe(a, e), K(e, T(U, {
|
|
302
|
+
"data-testid": "floating-window",
|
|
303
|
+
role: "dialog",
|
|
304
|
+
tabindex: -1,
|
|
305
|
+
get "aria-labelledby"() {
|
|
306
|
+
return t.title ? H : void 0;
|
|
307
|
+
},
|
|
308
|
+
get class() {
|
|
309
|
+
return O("smwb-floating-window", t.class, R.classes(), {
|
|
310
|
+
"smwb-collapsed": m()
|
|
311
|
+
});
|
|
312
|
+
},
|
|
313
|
+
get style() {
|
|
314
|
+
return {
|
|
315
|
+
left: `${s().x}px`,
|
|
316
|
+
top: `${s().y}px`,
|
|
317
|
+
width: `${s().width}px`,
|
|
318
|
+
...m() ? {} : {
|
|
319
|
+
height: `${s().height}px`
|
|
320
|
+
},
|
|
321
|
+
...t.zIndex === void 0 ? {} : {
|
|
322
|
+
"z-index": t.zIndex
|
|
323
|
+
},
|
|
324
|
+
...typeof t.style == "object" && t.style ? t.style : {}
|
|
325
|
+
};
|
|
326
|
+
},
|
|
327
|
+
"on:pointerdown": k
|
|
328
|
+
}), !1, !0), n.addEventListener("pointercancel", S), n.$$pointerup = S, n.$$pointermove = B, n.$$pointerdown = q, i.$$keydown = ee, c(i, d(P, {
|
|
329
|
+
name: "drag_indicator"
|
|
330
|
+
})), c(n, d(y, {
|
|
331
|
+
get when() {
|
|
332
|
+
return t.title;
|
|
333
|
+
},
|
|
334
|
+
get children() {
|
|
335
|
+
var o = me();
|
|
336
|
+
return x(o, "id", H), c(o, () => t.title), o;
|
|
337
|
+
}
|
|
338
|
+
}), r), c(r, () => t.headerActions, null), c(r, d(y, {
|
|
339
|
+
get when() {
|
|
340
|
+
return t.collapsible;
|
|
341
|
+
},
|
|
342
|
+
get children() {
|
|
343
|
+
var o = ge();
|
|
344
|
+
return o.$$click = ne, c(o, d(P, {
|
|
345
|
+
get name() {
|
|
346
|
+
return m() ? "open_in_full" : "close_fullscreen";
|
|
347
|
+
}
|
|
348
|
+
})), M((l) => {
|
|
349
|
+
var u = m() ? t.expandAriaLabel : t.collapseAriaLabel, g = !m();
|
|
350
|
+
return u !== l.e && x(o, "aria-label", l.e = u), g !== l.t && x(o, "aria-expanded", l.t = g), l;
|
|
351
|
+
}, {
|
|
352
|
+
e: void 0,
|
|
353
|
+
t: void 0
|
|
354
|
+
}), o;
|
|
355
|
+
}
|
|
356
|
+
}), null), c(r, d(y, {
|
|
357
|
+
get when() {
|
|
358
|
+
return t.onClose;
|
|
359
|
+
},
|
|
360
|
+
get children() {
|
|
361
|
+
var o = fe();
|
|
362
|
+
return o.$$click = () => t.onClose?.(), c(o, d(P, {
|
|
363
|
+
name: "close"
|
|
364
|
+
})), M(() => x(o, "aria-label", t.closeAriaLabel)), o;
|
|
365
|
+
}
|
|
366
|
+
}), null), c(e, d(y, {
|
|
367
|
+
get when() {
|
|
368
|
+
return !m();
|
|
369
|
+
},
|
|
370
|
+
get children() {
|
|
371
|
+
var o = xe();
|
|
372
|
+
return c(o, () => t.children), o;
|
|
373
|
+
}
|
|
374
|
+
}), null), c(e, d(y, {
|
|
375
|
+
get when() {
|
|
376
|
+
return ae(() => !!t.resizable)() && !m();
|
|
377
|
+
},
|
|
378
|
+
get children() {
|
|
379
|
+
return d(he, {
|
|
380
|
+
each: ve,
|
|
381
|
+
children: (o) => (() => {
|
|
382
|
+
var l = be();
|
|
383
|
+
return x(l, "data-testid", `floating-window-resize-${o}`), K(l, T({
|
|
384
|
+
get class() {
|
|
385
|
+
return O("smwb-floating-window__resize", `smwb-floating-window__resize_${o}`);
|
|
386
|
+
}
|
|
387
|
+
}, () => o === "se" ? {
|
|
388
|
+
role: "separator",
|
|
389
|
+
tabindex: 0,
|
|
390
|
+
"aria-label": t.resizeHandleAriaLabel,
|
|
391
|
+
"aria-valuemin": t.minWidth,
|
|
392
|
+
"aria-valuemax": Math.round(t.maxWidth ?? b().width),
|
|
393
|
+
"aria-valuenow": Math.round(s().width),
|
|
394
|
+
onKeyDown: te
|
|
395
|
+
} : {
|
|
396
|
+
"aria-hidden": !0,
|
|
397
|
+
tabindex: -1
|
|
398
|
+
}, {
|
|
399
|
+
onPointerDown: (u) => J(o, u),
|
|
400
|
+
onPointerMove: Q,
|
|
401
|
+
onPointerUp: D,
|
|
402
|
+
onPointerCancel: D
|
|
403
|
+
}), !1, !1), l;
|
|
404
|
+
})()
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
}), null), M(() => x(i, "aria-label", t.moveHandleAriaLabel)), e;
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
re(["pointerdown", "pointermove", "pointerup", "keydown", "click"]);
|
|
414
|
+
export {
|
|
415
|
+
Le as FloatingWindow
|
|
416
|
+
};
|
|
417
|
+
//# sourceMappingURL=floatingWindow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"floatingWindow.js","sources":["../../../../src/components/layout/floatingWindow/floatingWindow.tsx"],"sourcesContent":["import {\n type Accessor,\n For,\n type JSX,\n type ParentProps,\n Show,\n createEffect,\n createMemo,\n createSignal,\n mergeProps,\n onCleanup,\n splitProps,\n} from \"solid-js\";\nimport { Portal, isServer } from \"solid-js/web\";\nimport cn from \"clsx\";\nimport { Icon } from \"../../base/icon\";\nimport { createCssTransition } from \"../../../primitives/createCssTransition\";\nimport { createControllableState } from \"../../../primitives/createControllableState\";\nimport { createId } from \"../../../primitives/createId\";\nimport { mergeRefs, type Ref } from \"../../../primitives/mergeRefs\";\n\nexport interface FloatingWindowPosition {\n x: number;\n y: number;\n}\n\nexport interface FloatingWindowSize {\n width: number;\n height: number;\n}\n\n/** The eight edge/corner resize directions. */\nexport type FloatingWindowResizeDir = \"n\" | \"s\" | \"e\" | \"w\" | \"ne\" | \"nw\" | \"se\" | \"sw\";\n\nexport interface FloatingWindowProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, \"onResize\" | \"title\"> {\n /** Controlled open state of the window. */\n open: boolean;\n /** Title bar content. When given, the window is labelled by it. */\n title?: JSX.Element;\n /** Extra header controls, rendered before the built-in collapse/close buttons. */\n headerActions?: JSX.Element;\n\n /** Controlled top-left position in viewport px. */\n position?: FloatingWindowPosition;\n /** Initial position when uncontrolled. */\n defaultPosition?: FloatingWindowPosition;\n /** Called on every move frame and on viewport re-clamp, with the clamped position. */\n onPositionChange?: ((position: FloatingWindowPosition) => void) | undefined;\n /** Called once when a move gesture ends — the point at which to persist. */\n onMoveEnd?: ((position: FloatingWindowPosition) => void) | undefined;\n\n /** Controlled size in px. */\n size?: FloatingWindowSize;\n /** Initial size when uncontrolled. */\n defaultSize?: FloatingWindowSize;\n /** Called on every resize frame and on viewport re-clamp, with the clamped size. */\n onResize?: ((size: FloatingWindowSize) => void) | undefined;\n /** Called once when a resize gesture ends — the point at which to persist. */\n onResizeEnd?: ((size: FloatingWindowSize) => void) | undefined;\n\n /** Minimum width in px (default 200). */\n minWidth?: number;\n /** Minimum height in px (default 120). */\n minHeight?: number;\n /** Maximum width in px (default: viewport width). */\n maxWidth?: number;\n /** Maximum height in px (default: viewport height). */\n maxHeight?: number;\n /** Px of the window that must stay inside the viewport (default 56). */\n keepVisible?: number;\n /** Step in px for keyboard moving (default 24). */\n moveStep?: number;\n /** Step in px for keyboard resizing (default 24). */\n resizeStep?: number;\n\n /** Inline stacking order. The host owns z-order across several windows. */\n zIndex?: number;\n /** Called on pointerdown anywhere in the window, so the host can raise it. */\n onActivate?: (() => void) | undefined;\n\n /** Shade the window down to its title bar. */\n collapsed?: boolean;\n /** Initial collapsed state when uncontrolled. */\n defaultCollapsed?: boolean;\n onCollapsedChange?: ((collapsed: boolean) => void) | undefined;\n /** Render the built-in collapse toggle (default true). */\n collapsible?: boolean;\n\n /** Allow drag-to-move by the title bar (default true). */\n movable?: boolean;\n /** Allow drag-to-resize from the edges and corners (default true). */\n resizable?: boolean;\n /** Close on Escape while focus is inside the window (default false). */\n closeOnEsc?: boolean;\n onClose?: (() => void) | undefined;\n\n /** Accessible label for the move handle. */\n moveHandleAriaLabel?: string;\n /** Accessible label for the resize handle. */\n resizeHandleAriaLabel?: string;\n /** Accessible label for the close button. */\n closeAriaLabel?: string;\n /** Accessible label for the collapse toggle while expanded. */\n collapseAriaLabel?: string;\n /** Accessible label for the collapse toggle while collapsed. */\n expandAriaLabel?: string;\n\n \"aria-label\"?: string;\n ref?: Ref<HTMLDivElement>;\n}\n\ninterface Rect {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\ninterface Viewport {\n width: number;\n height: number;\n}\n\n/** Sign vector per resize direction: how the pointer delta maps onto x/y/width/height. */\nconst RESIZE_DIRS: Record<FloatingWindowResizeDir, { dx: 0 | 1; dy: 0 | 1; dw: -1 | 0 | 1; dh: -1 | 0 | 1 }> = {\n n: { dx: 0, dy: 1, dw: 0, dh: -1 },\n s: { dx: 0, dy: 0, dw: 0, dh: 1 },\n e: { dx: 0, dy: 0, dw: 1, dh: 0 },\n w: { dx: 1, dy: 0, dw: -1, dh: 0 },\n ne: { dx: 0, dy: 1, dw: 1, dh: -1 },\n nw: { dx: 1, dy: 1, dw: -1, dh: -1 },\n se: { dx: 0, dy: 0, dw: 1, dh: 1 },\n sw: { dx: 1, dy: 0, dw: -1, dh: 1 },\n};\n\nconst RESIZE_ORDER: FloatingWindowResizeDir[] = [\"n\", \"s\", \"e\", \"w\", \"ne\", \"nw\", \"se\", \"sw\"];\n\nconst viewportOf = (): Viewport =>\n typeof window === \"undefined\" ? { width: 0, height: 0 } : { width: window.innerWidth, height: window.innerHeight };\n\n/**\n * Free-floating, non-modal window: draggable by its title bar, resizable from every\n * edge and corner, clamped so a grabbable strip always stays on screen.\n *\n * Unlike Sheet/Modal it is deliberately NOT an overlay layer: no backdrop, no focus\n * trap, no `data-smwb-overlay-layer`. Several windows are meant to be open and usable\n * at once alongside the page behind them, so it must not trap focus, swallow clicks,\n * or steal Escape from a Modal stacked above it. Stacking order is the host's job —\n * pass `zIndex` and raise the window from `onActivate`.\n */\nexport function FloatingWindow(props: ParentProps<FloatingWindowProps>): JSX.Element {\n const merged = mergeProps(\n {\n minWidth: 200,\n minHeight: 120,\n keepVisible: 56,\n moveStep: 24,\n resizeStep: 24,\n collapsible: true,\n movable: true,\n resizable: true,\n closeOnEsc: false,\n defaultPosition: { x: 24, y: 24 },\n defaultSize: { width: 360, height: 420 },\n defaultCollapsed: false,\n moveHandleAriaLabel: \"Move window\",\n resizeHandleAriaLabel: \"Resize window\",\n closeAriaLabel: \"Close window\",\n collapseAriaLabel: \"Collapse window\",\n expandAriaLabel: \"Expand window\",\n },\n props\n );\n const [local, rest] = splitProps(merged, [\n \"open\",\n \"title\",\n \"headerActions\",\n \"position\",\n \"defaultPosition\",\n \"onPositionChange\",\n \"onMoveEnd\",\n \"size\",\n \"defaultSize\",\n \"onResize\",\n \"onResizeEnd\",\n \"minWidth\",\n \"minHeight\",\n \"maxWidth\",\n \"maxHeight\",\n \"keepVisible\",\n \"moveStep\",\n \"resizeStep\",\n \"zIndex\",\n \"onActivate\",\n \"collapsed\",\n \"defaultCollapsed\",\n \"onCollapsedChange\",\n \"collapsible\",\n \"movable\",\n \"resizable\",\n \"closeOnEsc\",\n \"onClose\",\n \"moveHandleAriaLabel\",\n \"resizeHandleAriaLabel\",\n \"closeAriaLabel\",\n \"collapseAriaLabel\",\n \"expandAriaLabel\",\n \"class\",\n \"style\",\n \"children\",\n \"ref\",\n ]);\n\n let rootEl: HTMLDivElement | undefined;\n const titleId = createId(undefined, \"smwb-floating-window-title\");\n\n const transition = createCssTransition({\n in: () => local.open,\n timeout: { enter: 120, exit: 120 },\n classNames: { enterDone: \"smwb-floating-window_entered\" },\n appear: true,\n });\n\n const [position, setPosition] = createControllableState<FloatingWindowPosition>({\n value: () => local.position,\n defaultValue: local.defaultPosition,\n onChange: (next) => local.onPositionChange?.(next),\n });\n const [size, setSize] = createControllableState<FloatingWindowSize>({\n value: () => local.size,\n defaultValue: local.defaultSize,\n onChange: (next) => local.onResize?.(next),\n });\n const [collapsed, setCollapsed] = createControllableState<boolean>({\n value: () => local.collapsed,\n defaultValue: local.defaultCollapsed,\n onChange: (next) => local.onCollapsedChange?.(next),\n });\n\n /**\n * Size first, then position against the clamped size. `y` is never negative, so the\n * title bar can never be dragged above the top edge and become ungrabbable — the gap\n * that makes an off-screen Sheet unrecoverable.\n */\n const clampRect = (rect: Rect, vp: Viewport): Rect => {\n const maxW = local.maxWidth ?? vp.width;\n const maxH = local.maxHeight ?? vp.height;\n const width = Math.max(local.minWidth, Math.min(maxW, rect.width));\n const height = Math.max(local.minHeight, Math.min(maxH, rect.height));\n const keep = Math.min(local.keepVisible, width);\n const x = Math.max(keep - width, Math.min(vp.width - keep, rect.x));\n const y = Math.max(0, Math.min(Math.max(0, vp.height - keep), rect.y));\n return { x, y, width, height };\n };\n\n /**\n * Where a window is placed before anyone touches it: fully inside the viewport when\n * it fits at all. `clampRect` alone only keeps `keepVisible` px reachable, which is\n * right for a window the user parked at an edge but wrong on opening — a 760px\n * default on a 375px phone opened a quarter of a screen off to the right.\n */\n const fitRect = (rect: Rect, vp: Viewport): Rect => {\n const clamped = clampRect(rect, vp);\n return {\n ...clamped,\n x: Math.max(0, Math.min(clamped.x, vp.width - clamped.width)),\n y: Math.max(0, Math.min(clamped.y, vp.height - clamped.height)),\n };\n };\n\n // Set by the first move/resize: from then on the user's placement wins and only the\n // reachability clamp applies, so a window can still be parked half off-screen.\n const [placed, setPlaced] = createSignal(false);\n\n /** The geometry actually rendered. Clamping the CONTROLLED value (not just drag\n * frames) means a rect restored from a larger monitor lands on screen immediately. */\n const rect: Accessor<Rect> = createMemo(() => {\n const current = { x: position().x, y: position().y, width: size().width, height: size().height };\n return placed() ? clampRect(current, viewportOf()) : fitRect(current, viewportOf());\n });\n\n const commitRect = (next: Rect, gesture = true): void => {\n if (gesture) setPlaced(true);\n const clamped = clampRect(next, viewportOf());\n const pos = position();\n const dim = size();\n if (clamped.x !== pos.x || clamped.y !== pos.y) setPosition({ x: clamped.x, y: clamped.y });\n if (clamped.width !== dim.width || clamped.height !== dim.height) {\n setSize({ width: clamped.width, height: clamped.height });\n }\n };\n\n // A closed window forgets that it was moved: opening it again should land on screen\n // like the first time, whatever the viewport is now.\n createEffect(() => {\n if (!local.open) setPlaced(false);\n });\n\n // Re-clamp when the viewport shrinks, so a window parked near an edge on a large\n // screen stays reachable on a small one. Sheet has no such listener, which is why a\n // dragged sheet survives a viewport shrink oversized.\n createEffect(() => {\n if (isServer || !local.open) return;\n const onViewportResize = (): void => commitRect(rect(), false);\n window.addEventListener(\"resize\", onViewportResize);\n onCleanup(() => window.removeEventListener(\"resize\", onViewportResize));\n });\n\n // Escape only while focus is inside this window. FloatingWindow is not an overlay\n // layer, so `isTopOverlayLayer` (document order, not z-index) would be the wrong\n // arbiter with several windows open.\n createEffect(() => {\n if (isServer || !local.open || !local.closeOnEsc || !local.onClose) return;\n const onKeyDown = (event: KeyboardEvent): void => {\n if (event.key !== \"Escape\") return;\n if (!rootEl || !rootEl.contains(document.activeElement)) return;\n local.onClose?.();\n };\n document.addEventListener(\"keydown\", onKeyDown);\n onCleanup(() => document.removeEventListener(\"keydown\", onKeyDown));\n });\n\n const activate = (): void => {\n local.onActivate?.();\n // Only when focus is elsewhere — an unconditional focus() would steal the caret\n // from an input inside the window on every raise.\n if (rootEl && !rootEl.contains(document.activeElement)) rootEl.focus({ preventScroll: true });\n };\n\n // Pointer capture keeps `pointermove` flowing to the handle even outside it, so there\n // are no document-level listeners to leak (Sheet's pattern, not screenDivider's).\n let move: { px: number; py: number; x: number; y: number } | null = null;\n\n const onMoveHandlePointerDown = (event: PointerEvent & { currentTarget: HTMLDivElement }): void => {\n if (!local.movable) return;\n // Header buttons stay clickable.\n if ((event.target as Element | null)?.closest(\"button,[data-no-drag]\")) return;\n event.preventDefault();\n const current = rect();\n move = { px: event.clientX, py: event.clientY, x: current.x, y: current.y };\n try {\n event.currentTarget.setPointerCapture?.(event.pointerId);\n } catch {\n /* best-effort */\n }\n };\n\n const onMoveHandlePointerMove = (event: PointerEvent): void => {\n if (!move) return;\n const current = rect();\n commitRect({\n ...current,\n x: move.x + event.clientX - move.px,\n y: move.y + event.clientY - move.py,\n });\n };\n\n const endMove = (event: PointerEvent & { currentTarget: HTMLDivElement }): void => {\n if (move) {\n move = null;\n const current = rect();\n local.onMoveEnd?.({ x: current.x, y: current.y });\n }\n if (event.currentTarget.hasPointerCapture?.(event.pointerId)) {\n event.currentTarget.releasePointerCapture?.(event.pointerId);\n }\n };\n\n let resize: { dir: FloatingWindowResizeDir; px: number; py: number; rect: Rect } | null = null;\n\n const onResizePointerDown = (\n dir: FloatingWindowResizeDir,\n event: PointerEvent & { currentTarget: HTMLDivElement }\n ): void => {\n event.preventDefault();\n event.stopPropagation();\n resize = { dir, px: event.clientX, py: event.clientY, rect: rect() };\n // Grabbing a resize grip is an interaction with the window, so raise it too. (The root\n // listener cannot be relied on here — see the `on:pointerdown` note on the root.)\n activate();\n try {\n event.currentTarget.setPointerCapture?.(event.pointerId);\n } catch {\n /* best-effort */\n }\n };\n\n const onResizePointerMove = (event: PointerEvent): void => {\n if (!resize) return;\n const sign = RESIZE_DIRS[resize.dir];\n const dx = event.clientX - resize.px;\n const dy = event.clientY - resize.py;\n const start = resize.rect;\n // A west/north drag moves the origin AND changes the size, so width is recomputed from\n // the moved edge rather than from the delta alone — otherwise dragging past minWidth\n // would keep sliding the window instead of stopping at the minimum.\n //\n // The size must be clamped to BOTH bounds here, before the origin is derived from it.\n // Clamping only the minimum and leaving the maximum to commitRect's own clamp would\n // compute the origin from a width that then gets shrunk, so the edge the user is NOT\n // dragging would drift away under the cursor.\n const vp = viewportOf();\n const maxW = local.maxWidth ?? vp.width;\n const maxH = local.maxHeight ?? vp.height;\n const width = Math.min(maxW, Math.max(local.minWidth, start.width + sign.dw * dx));\n const height = Math.min(maxH, Math.max(local.minHeight, start.height + sign.dh * dy));\n commitRect({\n x: sign.dx ? start.x + start.width - width : start.x,\n y: sign.dy ? start.y + start.height - height : start.y,\n width,\n height,\n });\n };\n\n const endResize = (event: PointerEvent & { currentTarget: HTMLDivElement }): void => {\n if (resize) {\n resize = null;\n const current = rect();\n local.onResizeEnd?.({ width: current.width, height: current.height });\n }\n if (event.currentTarget.hasPointerCapture?.(event.pointerId)) {\n event.currentTarget.releasePointerCapture?.(event.pointerId);\n }\n };\n\n /** A keypress is a COMPLETE gesture, so it reports move/resize end as well as the\n * per-frame change — otherwise a consumer that persists only on `*End` (the documented\n * way to avoid thrashing storage during a drag) would silently never save\n * keyboard-driven geometry. */\n const endKeyboardGesture = (resized: boolean): void => {\n const current = rect();\n if (resized) local.onResizeEnd?.({ width: current.width, height: current.height });\n else local.onMoveEnd?.({ x: current.x, y: current.y });\n };\n\n /** Arrows move; Shift+Arrows resize. */\n const onMoveHandleKeyDown: JSX.EventHandler<HTMLSpanElement, KeyboardEvent> = (event) => {\n const current = rect();\n const step = event.shiftKey ? local.resizeStep : local.moveStep;\n const delta: Record<string, [number, number]> = {\n ArrowLeft: [-step, 0],\n ArrowRight: [step, 0],\n ArrowUp: [0, -step],\n ArrowDown: [0, step],\n };\n const d = delta[event.key];\n if (!d) return;\n event.preventDefault();\n if (event.shiftKey) {\n commitRect({ ...current, width: current.width + d[0], height: current.height + d[1] });\n } else {\n commitRect({ ...current, x: current.x + d[0], y: current.y + d[1] });\n }\n endKeyboardGesture(event.shiftKey);\n };\n\n const onResizeHandleKeyDown: JSX.EventHandler<HTMLDivElement, KeyboardEvent> = (event) => {\n const current = rect();\n const vp = viewportOf();\n if (event.key === \"ArrowLeft\" || event.key === \"ArrowRight\") {\n event.preventDefault();\n const dir = event.key === \"ArrowRight\" ? 1 : -1;\n commitRect({ ...current, width: current.width + dir * local.resizeStep });\n } else if (event.key === \"ArrowUp\" || event.key === \"ArrowDown\") {\n event.preventDefault();\n const dir = event.key === \"ArrowDown\" ? 1 : -1;\n commitRect({ ...current, height: current.height + dir * local.resizeStep });\n } else if (event.key === \"Home\") {\n event.preventDefault();\n commitRect({ ...current, width: local.minWidth, height: local.minHeight });\n } else if (event.key === \"End\") {\n event.preventDefault();\n commitRect({ ...current, width: local.maxWidth ?? vp.width, height: local.maxHeight ?? vp.height });\n } else {\n return;\n }\n endKeyboardGesture(true);\n };\n\n const toggleCollapsed = (): void => setCollapsed((prev) => !prev);\n\n return (\n <Show when={transition.mounted()}>\n <Portal mount={(isServer ? undefined : document.body) as Node}>\n <div\n {...rest}\n ref={mergeRefs(local.ref, (el) => (rootEl = el as HTMLDivElement))}\n data-testid=\"floating-window\"\n role=\"dialog\"\n tabindex={-1}\n aria-labelledby={local.title ? titleId : undefined}\n class={cn(\"smwb-floating-window\", local.class, transition.classes(), {\n \"smwb-collapsed\": collapsed(),\n })}\n style={{\n left: `${rect().x}px`,\n top: `${rect().y}px`,\n width: `${rect().width}px`,\n ...(collapsed() ? {} : { height: `${rect().height}px` }),\n ...(local.zIndex === undefined ? {} : { \"z-index\": local.zIndex }),\n ...(typeof local.style === \"object\" && local.style ? local.style : {}),\n }}\n // `on:pointerdown` (native listener), NOT `onPointerDown` (delegated). Solid's\n // delegated dispatcher walks `_$host`, the LOGICAL owner chain, and Portal sets\n // `_$host` to its marker's parent — so an event raised inside content a consumer\n // portals into this window never reaches this handler, and clicking such a panel\n // would silently fail to raise the window. A native listener follows the real DOM\n // tree, where the portaled container genuinely is a descendant.\n on:pointerdown={activate}\n >\n <div\n class=\"smwb-floating-window__header\"\n data-testid=\"floating-window-header\"\n onPointerDown={onMoveHandlePointerDown}\n onPointerMove={onMoveHandlePointerMove}\n onPointerUp={endMove}\n onPointerCancel={endMove}\n >\n {/* The move affordance is the grip, not the header: the header also hosts the\n collapse/close buttons and any consumer `headerActions`, and nesting those\n inside a role=\"button\" is an a11y violation. Pointer drag still works\n anywhere on the header; only the keyboard affordance lives here. */}\n <span\n class=\"smwb-floating-window__grip\"\n data-testid=\"floating-window-move\"\n role=\"button\"\n tabindex={0}\n aria-label={local.moveHandleAriaLabel}\n onKeyDown={onMoveHandleKeyDown}\n >\n <Icon name=\"drag_indicator\" />\n </span>\n <Show when={local.title}>\n <span class=\"smwb-floating-window__title\" id={titleId}>\n {local.title}\n </span>\n </Show>\n <div class=\"smwb-floating-window__actions\" data-no-drag>\n {local.headerActions}\n <Show when={local.collapsible}>\n <button\n type=\"button\"\n class=\"smwb-floating-window__action\"\n data-testid=\"floating-window-collapse\"\n aria-label={collapsed() ? local.expandAriaLabel : local.collapseAriaLabel}\n aria-expanded={!collapsed()}\n onClick={toggleCollapsed}\n >\n <Icon name={collapsed() ? \"open_in_full\" : \"close_fullscreen\"} />\n </button>\n </Show>\n <Show when={local.onClose}>\n <button\n type=\"button\"\n class=\"smwb-floating-window__action\"\n data-testid=\"floating-window-close\"\n aria-label={local.closeAriaLabel}\n onClick={() => local.onClose?.()}\n >\n <Icon name=\"close\" />\n </button>\n </Show>\n </div>\n </div>\n\n <Show when={!collapsed()}>\n <div class=\"smwb-floating-window__body\" data-testid=\"floating-window-body\">\n {local.children}\n </div>\n </Show>\n\n <Show when={local.resizable && !collapsed()}>\n <For each={RESIZE_ORDER}>\n {(dir) => (\n <div\n class={cn(\"smwb-floating-window__resize\", `smwb-floating-window__resize_${dir}`)}\n data-testid={`floating-window-resize-${dir}`}\n // Only the south-east grip is reachable by keyboard: eight tab stops per\n // window would make Tab unusable once a few windows are open.\n {...(dir === \"se\"\n ? {\n role: \"separator\",\n tabindex: 0,\n \"aria-label\": local.resizeHandleAriaLabel,\n \"aria-valuemin\": local.minWidth,\n \"aria-valuemax\": Math.round(local.maxWidth ?? viewportOf().width),\n \"aria-valuenow\": Math.round(rect().width),\n onKeyDown: onResizeHandleKeyDown,\n }\n : { \"aria-hidden\": true, tabindex: -1 })}\n onPointerDown={(event) => onResizePointerDown(dir, event)}\n onPointerMove={onResizePointerMove}\n onPointerUp={endResize}\n onPointerCancel={endResize}\n />\n )}\n </For>\n </Show>\n </div>\n </Portal>\n </Show>\n );\n}\n\nexport default FloatingWindow;\n"],"names":["RESIZE_DIRS","n","dx","dy","dw","dh","s","e","w","ne","nw","se","sw","RESIZE_ORDER","viewportOf","window","width","height","innerWidth","innerHeight","FloatingWindow","props","merged","mergeProps","minWidth","minHeight","keepVisible","moveStep","resizeStep","collapsible","movable","resizable","closeOnEsc","defaultPosition","x","y","defaultSize","defaultCollapsed","moveHandleAriaLabel","resizeHandleAriaLabel","closeAriaLabel","collapseAriaLabel","expandAriaLabel","local","rest","splitProps","rootEl","titleId","createId","undefined","transition","createCssTransition","in","open","timeout","enter","exit","classNames","enterDone","appear","position","setPosition","createControllableState","value","defaultValue","onChange","next","onPositionChange","size","setSize","onResize","collapsed","setCollapsed","onCollapsedChange","clampRect","rect","vp","maxW","maxWidth","maxH","maxHeight","Math","max","min","keep","fitRect","clamped","placed","setPlaced","createSignal","createMemo","current","commitRect","gesture","pos","dim","createEffect","isServer","onViewportResize","addEventListener","onCleanup","removeEventListener","onClose","onKeyDown","event","key","contains","document","activeElement","activate","onActivate","focus","preventScroll","move","onMoveHandlePointerDown","target","closest","preventDefault","px","clientX","py","clientY","currentTarget","setPointerCapture","pointerId","onMoveHandlePointerMove","endMove","onMoveEnd","hasPointerCapture","releasePointerCapture","resize","onResizePointerDown","dir","stopPropagation","onResizePointerMove","sign","start","endResize","onResizeEnd","endKeyboardGesture","resized","onMoveHandleKeyDown","step","shiftKey","d","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","onResizeHandleKeyDown","toggleCollapsed","prev","_$createComponent","Show","when","mounted","children","Portal","mount","body","_el$","_tmpl$5","_el$2","firstChild","_el$3","_el$5","nextSibling","_ref$","mergeRefs","ref","el","_$use","_$spread","_$mergeProps","title","cn","class","classes","style","left","top","zIndex","$$pointerup","$$pointermove","$$pointerdown","$$keydown","_$insert","Icon","name","_el$4","_tmpl$","_$setAttribute","headerActions","_el$6","_tmpl$2","$$click","_$effect","_p$","_v$","_v$2","t","_el$7","_tmpl$3","_el$8","_tmpl$4","_$memo","For","each","_el$9","_tmpl$6","role","tabindex","round","_$delegateEvents"],"mappings":";;;;;;;;;;AA6HA,MAAMA,KAAyG;AAAA,EAC7GC,GAAG;AAAA,IAAEC,IAAI;AAAA,IAAGC,IAAI;AAAA,IAAGC,IAAI;AAAA,IAAGC,IAAI;AAAA,EAAA;AAAA,EAC9BC,GAAG;AAAA,IAAEJ,IAAI;AAAA,IAAGC,IAAI;AAAA,IAAGC,IAAI;AAAA,IAAGC,IAAI;AAAA,EAAA;AAAA,EAC9BE,GAAG;AAAA,IAAEL,IAAI;AAAA,IAAGC,IAAI;AAAA,IAAGC,IAAI;AAAA,IAAGC,IAAI;AAAA,EAAA;AAAA,EAC9BG,GAAG;AAAA,IAAEN,IAAI;AAAA,IAAGC,IAAI;AAAA,IAAGC,IAAI;AAAA,IAAIC,IAAI;AAAA,EAAA;AAAA,EAC/BI,IAAI;AAAA,IAAEP,IAAI;AAAA,IAAGC,IAAI;AAAA,IAAGC,IAAI;AAAA,IAAGC,IAAI;AAAA,EAAA;AAAA,EAC/BK,IAAI;AAAA,IAAER,IAAI;AAAA,IAAGC,IAAI;AAAA,IAAGC,IAAI;AAAA,IAAIC,IAAI;AAAA,EAAA;AAAA,EAChCM,IAAI;AAAA,IAAET,IAAI;AAAA,IAAGC,IAAI;AAAA,IAAGC,IAAI;AAAA,IAAGC,IAAI;AAAA,EAAA;AAAA,EAC/BO,IAAI;AAAA,IAAEV,IAAI;AAAA,IAAGC,IAAI;AAAA,IAAGC,IAAI;AAAA,IAAIC,IAAI;AAAA,EAAA;AAClC,GAEMQ,KAA0C,CAAC,KAAK,KAAK,KAAK,KAAK,MAAM,MAAM,MAAM,IAAI,G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