@vcarl/sashay 0.0.0-stage → 0.0.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/LICENSE +21 -0
- package/README.md +27 -2
- package/dist/controller-2vB0dDsL.js +1401 -0
- package/dist/controller-qNSxQMhc.d.ts +39 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/react.d.ts +28 -0
- package/dist/react.js +198 -0
- package/dist/style.css +416 -0
- package/package.json +79 -3
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
type Length = string | number;
|
|
2
|
+
interface EdgeOptions {
|
|
3
|
+
width?: Length;
|
|
4
|
+
drawer?: {
|
|
5
|
+
width: Length;
|
|
6
|
+
title: string;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
interface PaneOptions {
|
|
10
|
+
id: string;
|
|
11
|
+
title: string;
|
|
12
|
+
focus: number;
|
|
13
|
+
minWidth?: Length;
|
|
14
|
+
maxWidth?: Length;
|
|
15
|
+
opensTo?: number[];
|
|
16
|
+
edge?: EdgeOptions;
|
|
17
|
+
}
|
|
18
|
+
interface SashayOptions {
|
|
19
|
+
panes: PaneOptions[];
|
|
20
|
+
layout?: string;
|
|
21
|
+
defaultLayout?: number[];
|
|
22
|
+
onChange?: (layout: string) => void;
|
|
23
|
+
onClose?: (id: string) => void;
|
|
24
|
+
compactBelow?: Length;
|
|
25
|
+
}
|
|
26
|
+
interface SashayHandle {
|
|
27
|
+
/** The current layout code, as the last onChange reported or setLayout applied. */
|
|
28
|
+
readonly layout: string;
|
|
29
|
+
reveal(id: string): void;
|
|
30
|
+
close(id: string): void;
|
|
31
|
+
toggleDrawer(id: string, open?: boolean): void;
|
|
32
|
+
keepInView(id: string, x: Length | null): void;
|
|
33
|
+
setLayout(code: string): void;
|
|
34
|
+
fit(fractions: number[]): void;
|
|
35
|
+
update(options: Partial<Pick<SashayOptions, "panes" | "onChange" | "onClose" | "compactBelow">>): void;
|
|
36
|
+
destroy(): void;
|
|
37
|
+
}
|
|
38
|
+
declare function createSashay(frame: HTMLElement, options: SashayOptions): SashayHandle;
|
|
39
|
+
export { createSashay as a, SashayOptions as i, PaneOptions as n, Length as o, SashayHandle as r, EdgeOptions as t };
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { r as createSashay } from "./controller-2vB0dDsL.js";
|
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ComponentProps, ReactElement, ReactNode, Ref } from "react";
|
|
2
|
+
import { n as PaneOptions, o as Length, r as SashayHandle } from "./controller-qNSxQMhc.js";
|
|
3
|
+
export interface SashayProps extends Omit<ComponentProps<"div">, "onChange" | "ref"> {
|
|
4
|
+
layout?: string;
|
|
5
|
+
defaultLayout?: number[];
|
|
6
|
+
compactBelow?: Length;
|
|
7
|
+
onLayoutChange?: (layout: string) => void;
|
|
8
|
+
ref?: Ref<SashayHandle>;
|
|
9
|
+
}
|
|
10
|
+
interface OwnPaneProps extends Omit<PaneOptions, "edge"> {
|
|
11
|
+
edge?: {
|
|
12
|
+
width?: Length;
|
|
13
|
+
drawer?: {
|
|
14
|
+
width: Length;
|
|
15
|
+
title: string;
|
|
16
|
+
content: ReactNode;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
keepInView?: Length | null;
|
|
20
|
+
onClose?: () => void;
|
|
21
|
+
children?: ReactNode | ((state: {
|
|
22
|
+
offscreen: boolean;
|
|
23
|
+
}) => ReactNode);
|
|
24
|
+
}
|
|
25
|
+
export type PaneProps = OwnPaneProps & Omit<ComponentProps<"section">, keyof OwnPaneProps | "ref" | "inert" | "data-sashay-pane">;
|
|
26
|
+
export declare function Sashay(props: SashayProps): ReactElement;
|
|
27
|
+
export declare function Pane(props: PaneProps): ReactElement;
|
|
28
|
+
export type { Length, SashayHandle };
|
package/dist/react.js
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { createContext, useContext, useId, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
|
|
2
|
+
import { a as decodeLayout, c as windowEnd, i as edgeWidth, l as snapV, n as SPINE, o as defaultView, r as createSashay, s as normalize, u as toWidths } from "./controller-2vB0dDsL.js";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
// src/react.tsx
|
|
5
|
+
const Ctx = createContext(null);
|
|
6
|
+
const toOptions = ({ id, title, focus, minWidth, maxWidth, opensTo, edge }) => {
|
|
7
|
+
const d = edge?.drawer;
|
|
8
|
+
return {
|
|
9
|
+
id,
|
|
10
|
+
title,
|
|
11
|
+
focus,
|
|
12
|
+
minWidth,
|
|
13
|
+
maxWidth,
|
|
14
|
+
opensTo,
|
|
15
|
+
edge: edge && {
|
|
16
|
+
width: edge.width,
|
|
17
|
+
drawer: d && {
|
|
18
|
+
width: d.width,
|
|
19
|
+
title: d.title
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
const METHODS = [
|
|
25
|
+
"reveal",
|
|
26
|
+
"close",
|
|
27
|
+
"toggleDrawer",
|
|
28
|
+
"keepInView",
|
|
29
|
+
"fit",
|
|
30
|
+
"update",
|
|
31
|
+
"destroy"
|
|
32
|
+
];
|
|
33
|
+
function Sashay(props) {
|
|
34
|
+
const { layout, defaultLayout, compactBelow, onLayoutChange, ref, children, ...rest } = props;
|
|
35
|
+
const frame = useRef(null);
|
|
36
|
+
const latest = useRef(props);
|
|
37
|
+
latest.current = props;
|
|
38
|
+
const scope = useId();
|
|
39
|
+
const [mounted, setMounted] = useState(false);
|
|
40
|
+
const [s] = useState(() => ({
|
|
41
|
+
reg: /* @__PURE__ */ new Map(),
|
|
42
|
+
h: null,
|
|
43
|
+
code: layout,
|
|
44
|
+
key: "",
|
|
45
|
+
dirty: false,
|
|
46
|
+
flush() {
|
|
47
|
+
s.dirty = false;
|
|
48
|
+
const f = frame.current;
|
|
49
|
+
if (!s.h || !f) return;
|
|
50
|
+
const panes = paneList(f, s.reg);
|
|
51
|
+
const key = JSON.stringify(panes);
|
|
52
|
+
if (key !== s.key) {
|
|
53
|
+
s.key = key;
|
|
54
|
+
s.h.update({ panes });
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
changed() {
|
|
58
|
+
if (s.dirty) return;
|
|
59
|
+
s.dirty = true;
|
|
60
|
+
queueMicrotask(() => s.dirty && s.flush());
|
|
61
|
+
}
|
|
62
|
+
}));
|
|
63
|
+
useLayoutEffect(() => {
|
|
64
|
+
const f = frame.current;
|
|
65
|
+
const panes = paneList(f, s.reg);
|
|
66
|
+
s.key = JSON.stringify(panes);
|
|
67
|
+
const h = createSashay(f, {
|
|
68
|
+
panes,
|
|
69
|
+
layout: s.code,
|
|
70
|
+
defaultLayout: latest.current.defaultLayout,
|
|
71
|
+
compactBelow: latest.current.compactBelow,
|
|
72
|
+
onChange: (c) => {
|
|
73
|
+
s.code = c;
|
|
74
|
+
latest.current.onLayoutChange?.(c);
|
|
75
|
+
},
|
|
76
|
+
onClose: (id) => s.reg.get(id)?.onClose?.()
|
|
77
|
+
});
|
|
78
|
+
s.h = h;
|
|
79
|
+
for (const p of s.reg.values()) if (p.keepInView != null) h.keepInView(p.id, p.keepInView);
|
|
80
|
+
const raf = requestAnimationFrame(() => setMounted(true));
|
|
81
|
+
return () => {
|
|
82
|
+
cancelAnimationFrame(raf);
|
|
83
|
+
h.destroy();
|
|
84
|
+
s.h = null;
|
|
85
|
+
};
|
|
86
|
+
}, [s]);
|
|
87
|
+
useLayoutEffect(() => {
|
|
88
|
+
if (s.dirty) s.flush();
|
|
89
|
+
});
|
|
90
|
+
useLayoutEffect(() => s.h?.update({ compactBelow: compactBelow ?? "40rem" }), [s, compactBelow]);
|
|
91
|
+
useLayoutEffect(() => {
|
|
92
|
+
if (!s.h || layout === void 0 || layout === s.code) return;
|
|
93
|
+
s.flush();
|
|
94
|
+
s.code = layout;
|
|
95
|
+
s.h.setLayout(layout);
|
|
96
|
+
}, [s, layout]);
|
|
97
|
+
useImperativeHandle(ref, () => ({
|
|
98
|
+
...Object.fromEntries(METHODS.map((k) => [k, (...a) => {
|
|
99
|
+
if (s.dirty) s.flush();
|
|
100
|
+
return (s.h?.[k])?.apply(s.h, a);
|
|
101
|
+
}])),
|
|
102
|
+
get layout() {
|
|
103
|
+
return s.h?.layout ?? s.code ?? "";
|
|
104
|
+
},
|
|
105
|
+
setLayout(c) {
|
|
106
|
+
if (s.dirty) s.flush();
|
|
107
|
+
s.code = c;
|
|
108
|
+
s.h?.setLayout(c);
|
|
109
|
+
}
|
|
110
|
+
}), [s]);
|
|
111
|
+
return /* @__PURE__ */ jsx(Ctx, {
|
|
112
|
+
value: s,
|
|
113
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
114
|
+
...rest,
|
|
115
|
+
ref: frame,
|
|
116
|
+
"data-sashay-frame": "",
|
|
117
|
+
"data-sashay-ssr": scope,
|
|
118
|
+
children: [children, !mounted && /* @__PURE__ */ jsx(SsrStyle, {
|
|
119
|
+
s,
|
|
120
|
+
scope,
|
|
121
|
+
layout,
|
|
122
|
+
defaultLayout
|
|
123
|
+
})]
|
|
124
|
+
})
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
const paneList = (f, reg) => [...f.querySelectorAll("[data-sashay-pane]")].flatMap((el) => {
|
|
128
|
+
const p = el.closest("[data-sashay-frame]") === f && reg.get(el.dataset.sashayPane ?? "");
|
|
129
|
+
return p ? [toOptions(p)] : [];
|
|
130
|
+
});
|
|
131
|
+
function SsrStyle({ s, scope, layout, defaultLayout }) {
|
|
132
|
+
const panes = [...s.reg.values()];
|
|
133
|
+
const n = panes.length;
|
|
134
|
+
const d = decodeLayout(layout, n, (p) => Boolean(panes[p].edge?.drawer));
|
|
135
|
+
const v = normalize(d?.view ?? defaultView(n, defaultLayout), n);
|
|
136
|
+
const win = panes.slice(v.offset, windowEnd(v));
|
|
137
|
+
const len = (x) => typeof x === "number" ? `${x}px` : x;
|
|
138
|
+
let j = 0;
|
|
139
|
+
const edges = win.map((p) => {
|
|
140
|
+
const dr = p.edge?.drawer;
|
|
141
|
+
return len(dr && d?.drawers[j++] ? dr.width : edgeWidth(p.edge));
|
|
142
|
+
});
|
|
143
|
+
const spine = v.offset ? SPINE : "0px";
|
|
144
|
+
const C = `(100% - ${spine} - ${windowEnd(v) < n ? SPINE : "0px"} - (${edges.join(" + ")}))`;
|
|
145
|
+
const div = v.div.map(snapV);
|
|
146
|
+
const w = toWidths(div);
|
|
147
|
+
const q = (x) => JSON.stringify(x).replace(/</g, "\\3c ");
|
|
148
|
+
const css = panes.map((p, i) => {
|
|
149
|
+
const k = i - v.offset;
|
|
150
|
+
const sel = `[data-sashay-ssr=${q(scope)}]:not([data-sashay-ready]) [data-sashay-pane=${q(p.id)}]`;
|
|
151
|
+
if (k < 0 || k >= win.length) return `${sel}{visibility:hidden}`;
|
|
152
|
+
return `${sel}{left:${`calc(${C} * ${k ? div[k - 1] : 0} + ${spine} + ${edges.slice(0, k + 1).join(" + ")})`};width:max(calc(${C} * ${w[k]}), calc(${C} * ${p.focus}))}`;
|
|
153
|
+
});
|
|
154
|
+
css.push(`[data-sashay-ssr=${q(scope)}] [data-sashay-pane]{transition:none}`);
|
|
155
|
+
return /* @__PURE__ */ jsx("style", { children: css.join("") });
|
|
156
|
+
}
|
|
157
|
+
function Pane(props) {
|
|
158
|
+
const s = useContext(Ctx);
|
|
159
|
+
if (!s) throw new Error("sashay: <Pane> must be inside <Sashay>");
|
|
160
|
+
const { id, title, focus, minWidth, maxWidth, opensTo, edge, keepInView, onClose, children, style, ...rest } = props;
|
|
161
|
+
const { transform: _t, width: _w, zIndex: _z, clipPath: _c, ...ownStyle } = style ?? {};
|
|
162
|
+
s.reg.set(id, props);
|
|
163
|
+
const el = useRef(null);
|
|
164
|
+
const [offscreen, setOffscreen] = useState(false);
|
|
165
|
+
const fn = typeof children === "function";
|
|
166
|
+
useLayoutEffect(() => {
|
|
167
|
+
s.reg.set(id, props);
|
|
168
|
+
s.changed();
|
|
169
|
+
return () => {
|
|
170
|
+
s.reg.delete(id);
|
|
171
|
+
s.changed();
|
|
172
|
+
};
|
|
173
|
+
});
|
|
174
|
+
useLayoutEffect(() => s.h?.keepInView(id, keepInView ?? null), [
|
|
175
|
+
s,
|
|
176
|
+
id,
|
|
177
|
+
keepInView
|
|
178
|
+
]);
|
|
179
|
+
useLayoutEffect(() => {
|
|
180
|
+
const e = el.current;
|
|
181
|
+
if (!fn || !e) return;
|
|
182
|
+
const mo = new MutationObserver(() => setOffscreen(e.hasAttribute("data-offscreen")));
|
|
183
|
+
mo.observe(e, { attributeFilter: ["data-offscreen"] });
|
|
184
|
+
return () => mo.disconnect();
|
|
185
|
+
}, [fn]);
|
|
186
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("section", {
|
|
187
|
+
...rest,
|
|
188
|
+
style: ownStyle,
|
|
189
|
+
ref: el,
|
|
190
|
+
"data-sashay-pane": id,
|
|
191
|
+
"aria-label": title,
|
|
192
|
+
children: fn ? children({ offscreen }) : children
|
|
193
|
+
}), edge?.drawer && /* @__PURE__ */ jsx("div", {
|
|
194
|
+
"data-sashay-drawer": id,
|
|
195
|
+
children: edge.drawer.content
|
|
196
|
+
})] });
|
|
197
|
+
}
|
|
198
|
+
export { Pane, Sashay };
|
package/dist/style.css
ADDED
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
/* Sashay: panes and edges are absolutely placed; the controller writes their
|
|
2
|
+
transform/width. Transforms animate only when not dragging. Theme with --sashay-*. */
|
|
3
|
+
@layer sashay {
|
|
4
|
+
[data-sashay-frame] {
|
|
5
|
+
position: relative;
|
|
6
|
+
height: 100%;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
background: var(--sashay-bg, color-mix(in srgb, CanvasText 6%, Canvas));
|
|
9
|
+
color: var(--sashay-fg, CanvasText);
|
|
10
|
+
touch-action: pan-y;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
[data-sashay-pane],
|
|
14
|
+
[data-sashay-edge],
|
|
15
|
+
[data-sashay-controls] {
|
|
16
|
+
position: absolute;
|
|
17
|
+
top: 0;
|
|
18
|
+
bottom: 0;
|
|
19
|
+
left: 0;
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
}
|
|
22
|
+
/* Laid over its edge; only the controls inside take the pointer. */
|
|
23
|
+
[data-sashay-controls] {
|
|
24
|
+
pointer-events: none;
|
|
25
|
+
}
|
|
26
|
+
[data-sashay-controls] :is(button, [data-sashay-tabs]) {
|
|
27
|
+
pointer-events: auto;
|
|
28
|
+
}
|
|
29
|
+
[data-sashay-pane] {
|
|
30
|
+
background: var(--sashay-pane-bg, Canvas);
|
|
31
|
+
--sashay-shift: none; /* keepInView: the controller sets it; nested panes reset it */
|
|
32
|
+
}
|
|
33
|
+
[data-sashay-pane] > * {
|
|
34
|
+
translate: var(--sashay-shift);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* Transforms only: the controller holds widths until the slide ends. */
|
|
38
|
+
[data-sashay-frame]:not([data-dragging])
|
|
39
|
+
:is([data-sashay-pane], [data-sashay-edge], [data-sashay-controls], [data-sashay-drawer]) {
|
|
40
|
+
transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
|
|
41
|
+
}
|
|
42
|
+
/* A pane leaving the window slides out before it hides. */
|
|
43
|
+
[data-sashay-frame] [data-sashay-pane][data-offscreen] {
|
|
44
|
+
content-visibility: hidden;
|
|
45
|
+
visibility: hidden;
|
|
46
|
+
transition:
|
|
47
|
+
transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1),
|
|
48
|
+
visibility 0s 0.24s,
|
|
49
|
+
content-visibility 0s 0.24s allow-discrete;
|
|
50
|
+
}
|
|
51
|
+
@media (prefers-reduced-motion: reduce) {
|
|
52
|
+
[data-sashay-frame] :is([data-sashay-pane], [data-sashay-edge], [data-sashay-controls], [data-sashay-drawer]),
|
|
53
|
+
[data-sashay-mark] path {
|
|
54
|
+
transition: none !important;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* Release preview. Under a throw the bar hides and the SVG bows its middle by --sashay-fling px. */
|
|
59
|
+
[data-sashay-mark] {
|
|
60
|
+
position: absolute;
|
|
61
|
+
top: 18%;
|
|
62
|
+
bottom: 18%;
|
|
63
|
+
left: 0;
|
|
64
|
+
width: 3px;
|
|
65
|
+
margin-left: -1.5px;
|
|
66
|
+
border-radius: 2px;
|
|
67
|
+
color: var(--sashay-accent, oklch(0.62 0.19 255));
|
|
68
|
+
background: currentColor;
|
|
69
|
+
box-shadow: 0 0 10px 2px color-mix(in srgb, currentColor 55%, transparent);
|
|
70
|
+
opacity: 0;
|
|
71
|
+
z-index: 98;
|
|
72
|
+
pointer-events: none;
|
|
73
|
+
}
|
|
74
|
+
[data-sashay-mark][data-fling] {
|
|
75
|
+
background: none;
|
|
76
|
+
box-shadow: none;
|
|
77
|
+
}
|
|
78
|
+
[data-sashay-mark] svg {
|
|
79
|
+
position: absolute;
|
|
80
|
+
left: 50%;
|
|
81
|
+
width: 1px;
|
|
82
|
+
height: 100%;
|
|
83
|
+
overflow: visible;
|
|
84
|
+
fill: none;
|
|
85
|
+
stroke: currentColor;
|
|
86
|
+
stroke-width: 3px;
|
|
87
|
+
stroke-linecap: round;
|
|
88
|
+
stroke-miterlimit: 20;
|
|
89
|
+
filter: drop-shadow(0 0 4px color-mix(in srgb, currentColor 55%, transparent));
|
|
90
|
+
}
|
|
91
|
+
[data-sashay-mark]:not([data-fling]) svg {
|
|
92
|
+
display: none;
|
|
93
|
+
}
|
|
94
|
+
[data-sashay-mark] path {
|
|
95
|
+
vector-effect: non-scaling-stroke;
|
|
96
|
+
scale: var(--sashay-fling, 0) 1;
|
|
97
|
+
transition: scale 0.16s;
|
|
98
|
+
}
|
|
99
|
+
[data-sashay-frame][data-dragging] [data-sashay-mark] {
|
|
100
|
+
opacity: 0.35;
|
|
101
|
+
}
|
|
102
|
+
[data-sashay-frame][data-dragging] [data-sashay-mark][data-primary] {
|
|
103
|
+
opacity: 0.9;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* Edges: a grip, optionally with a drawer toggle. */
|
|
107
|
+
[data-sashay-edge] {
|
|
108
|
+
background: var(--sashay-bg, color-mix(in srgb, CanvasText 6%, Canvas));
|
|
109
|
+
border-left: 1px solid var(--sashay-edge-border, color-mix(in srgb, CanvasText 55%, Canvas));
|
|
110
|
+
border-right: 1px solid var(--sashay-edge-border, color-mix(in srgb, CanvasText 55%, Canvas));
|
|
111
|
+
box-shadow: -10px 0 18px -12px var(--sashay-shadow, rgb(0 0 0 / 0.5));
|
|
112
|
+
cursor: ew-resize;
|
|
113
|
+
touch-action: none;
|
|
114
|
+
color: var(--sashay-muted, color-mix(in srgb, CanvasText 60%, transparent));
|
|
115
|
+
}
|
|
116
|
+
[data-sashay-edge][role="button"] {
|
|
117
|
+
box-shadow: none;
|
|
118
|
+
cursor: pointer;
|
|
119
|
+
}
|
|
120
|
+
[data-sashay-edge]:hover {
|
|
121
|
+
background: color-mix(
|
|
122
|
+
in srgb,
|
|
123
|
+
var(--sashay-accent, oklch(0.62 0.19 255)) 7%,
|
|
124
|
+
var(--sashay-bg, color-mix(in srgb, CanvasText 6%, Canvas))
|
|
125
|
+
);
|
|
126
|
+
color: var(--sashay-fg, CanvasText);
|
|
127
|
+
}
|
|
128
|
+
[data-sashay-edge]:active {
|
|
129
|
+
background: color-mix(
|
|
130
|
+
in srgb,
|
|
131
|
+
var(--sashay-accent, oklch(0.62 0.19 255)) 16%,
|
|
132
|
+
var(--sashay-bg, color-mix(in srgb, CanvasText 6%, Canvas))
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
[data-sashay-edge]:focus-visible,
|
|
136
|
+
[data-sashay-toggle]:focus-visible {
|
|
137
|
+
outline: 2px solid var(--sashay-accent, oklch(0.62 0.19 255));
|
|
138
|
+
outline-offset: -2px;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/* Grip: dots, centred on the edge. Compact gets a smaller one. */
|
|
142
|
+
[data-sashay-dots] {
|
|
143
|
+
--g: 6px;
|
|
144
|
+
position: absolute;
|
|
145
|
+
top: 50%;
|
|
146
|
+
left: 50%;
|
|
147
|
+
width: var(--g);
|
|
148
|
+
height: calc(var(--g) * 7);
|
|
149
|
+
margin: calc(var(--g) * -3.5) 0 0 calc(var(--g) / -2);
|
|
150
|
+
background:
|
|
151
|
+
radial-gradient(circle, var(--sashay-grip, color-mix(in srgb, CanvasText 65%, Canvas)) 35%, transparent 40%) 0 0 /
|
|
152
|
+
var(--g) calc(var(--g) * 1.75);
|
|
153
|
+
}
|
|
154
|
+
[data-sashay-frame][data-compact] [data-sashay-dots] {
|
|
155
|
+
--g: 4px;
|
|
156
|
+
}
|
|
157
|
+
[data-sashay-edge]:is(:hover, :active) [data-sashay-dots] {
|
|
158
|
+
background-image: radial-gradient(circle, var(--sashay-grip-hover, currentColor) 35%, transparent 40%);
|
|
159
|
+
}
|
|
160
|
+
[data-sashay-edge][role="button"] [data-sashay-dots],
|
|
161
|
+
[data-sashay-edge][data-open] [data-sashay-dots] {
|
|
162
|
+
display: none;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
[data-sashay-title] {
|
|
166
|
+
position: absolute;
|
|
167
|
+
top: var(--sashay-header, 2.75rem);
|
|
168
|
+
left: 28px;
|
|
169
|
+
white-space: nowrap;
|
|
170
|
+
transform-origin: 0 0;
|
|
171
|
+
transform: rotate(90deg);
|
|
172
|
+
font-size: var(--sashay-font-size, 0.6875rem);
|
|
173
|
+
font-weight: 600;
|
|
174
|
+
letter-spacing: 0.06em;
|
|
175
|
+
text-transform: uppercase;
|
|
176
|
+
pointer-events: none;
|
|
177
|
+
}
|
|
178
|
+
[data-sashay-toggle] {
|
|
179
|
+
position: absolute;
|
|
180
|
+
top: 8px;
|
|
181
|
+
left: 50%;
|
|
182
|
+
margin-left: -14px;
|
|
183
|
+
width: 28px;
|
|
184
|
+
height: 28px;
|
|
185
|
+
padding: 0;
|
|
186
|
+
display: grid;
|
|
187
|
+
place-items: center;
|
|
188
|
+
border-radius: var(--sashay-radius, 6px);
|
|
189
|
+
border: 1px solid var(--sashay-border, color-mix(in srgb, CanvasText 15%, transparent));
|
|
190
|
+
background: var(--sashay-pane-bg, Canvas);
|
|
191
|
+
color: var(--sashay-fg, CanvasText);
|
|
192
|
+
cursor: pointer;
|
|
193
|
+
}
|
|
194
|
+
[data-sashay-toggle]:hover {
|
|
195
|
+
border-color: var(--sashay-accent, oklch(0.62 0.19 255));
|
|
196
|
+
color: var(--sashay-accent, oklch(0.62 0.19 255));
|
|
197
|
+
}
|
|
198
|
+
[data-sashay-toggle] svg {
|
|
199
|
+
width: 14px;
|
|
200
|
+
height: 14px;
|
|
201
|
+
transition: transform 0.2s;
|
|
202
|
+
}
|
|
203
|
+
[data-sashay-controls][data-open] [data-sashay-toggle] {
|
|
204
|
+
left: auto;
|
|
205
|
+
right: 8px;
|
|
206
|
+
margin-left: 0;
|
|
207
|
+
}
|
|
208
|
+
[data-sashay-controls][data-open] [data-sashay-toggle] svg {
|
|
209
|
+
transform: rotate(180deg);
|
|
210
|
+
}
|
|
211
|
+
[data-sashay-controls][data-open] [data-sashay-title] {
|
|
212
|
+
transform: none;
|
|
213
|
+
top: 15px;
|
|
214
|
+
left: 14px;
|
|
215
|
+
}
|
|
216
|
+
[data-sashay-edge][data-open]::after {
|
|
217
|
+
content: "";
|
|
218
|
+
position: absolute;
|
|
219
|
+
left: 0;
|
|
220
|
+
right: 0;
|
|
221
|
+
top: calc(var(--sashay-header, 2.75rem) - 1px);
|
|
222
|
+
border-top: 1px solid var(--sashay-border, color-mix(in srgb, CanvasText 15%, transparent));
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
[data-sashay-drawer] {
|
|
226
|
+
position: absolute;
|
|
227
|
+
top: var(--sashay-header, 2.75rem);
|
|
228
|
+
bottom: 0;
|
|
229
|
+
left: 0;
|
|
230
|
+
padding: 12px 14px;
|
|
231
|
+
display: grid;
|
|
232
|
+
gap: 8px;
|
|
233
|
+
align-content: start;
|
|
234
|
+
font-size: var(--sashay-font-size, 0.6875rem);
|
|
235
|
+
color: var(--sashay-muted, color-mix(in srgb, CanvasText 60%, transparent));
|
|
236
|
+
box-sizing: border-box;
|
|
237
|
+
overflow-y: auto;
|
|
238
|
+
touch-action: pan-y;
|
|
239
|
+
}
|
|
240
|
+
[data-sashay-drawer]:not([data-open]) {
|
|
241
|
+
display: none;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/* Panes folded out of the window: a tab each, oldest at the top, in a spine at the left
|
|
245
|
+
(before the window) or the right (after it). */
|
|
246
|
+
[data-spine] {
|
|
247
|
+
position: absolute;
|
|
248
|
+
inset-block: 0;
|
|
249
|
+
left: 0;
|
|
250
|
+
width: var(--sashay-spine-width, 1.5rem);
|
|
251
|
+
display: flex;
|
|
252
|
+
flex-direction: column;
|
|
253
|
+
overflow-y: auto;
|
|
254
|
+
scrollbar-width: none;
|
|
255
|
+
overscroll-behavior: contain;
|
|
256
|
+
border-right: 1px solid var(--sashay-border, color-mix(in srgb, CanvasText 15%, transparent));
|
|
257
|
+
background: var(--sashay-raised-bg, color-mix(in srgb, CanvasText 10%, Canvas));
|
|
258
|
+
z-index: 99;
|
|
259
|
+
}
|
|
260
|
+
[data-spine="end"] {
|
|
261
|
+
left: auto;
|
|
262
|
+
right: 0;
|
|
263
|
+
border-right: 0;
|
|
264
|
+
border-left: 1px solid var(--sashay-border, color-mix(in srgb, CanvasText 15%, transparent));
|
|
265
|
+
}
|
|
266
|
+
[data-sashay-spine-tab] {
|
|
267
|
+
flex: none;
|
|
268
|
+
writing-mode: vertical-rl;
|
|
269
|
+
max-height: 12em;
|
|
270
|
+
overflow: hidden;
|
|
271
|
+
text-overflow: ellipsis;
|
|
272
|
+
white-space: nowrap;
|
|
273
|
+
padding: 10px 0;
|
|
274
|
+
border: 0;
|
|
275
|
+
border-bottom: 1px solid var(--sashay-border, color-mix(in srgb, CanvasText 15%, transparent));
|
|
276
|
+
background: transparent;
|
|
277
|
+
color: var(--sashay-muted, color-mix(in srgb, CanvasText 60%, transparent));
|
|
278
|
+
font: inherit;
|
|
279
|
+
font-size: var(--sashay-font-size, 0.6875rem);
|
|
280
|
+
font-weight: 600;
|
|
281
|
+
letter-spacing: 0.06em;
|
|
282
|
+
text-transform: uppercase;
|
|
283
|
+
cursor: pointer;
|
|
284
|
+
}
|
|
285
|
+
[data-sashay-spine-tab]:hover {
|
|
286
|
+
color: var(--sashay-fg, CanvasText);
|
|
287
|
+
}
|
|
288
|
+
[data-sashay-spine-tab]:focus-visible {
|
|
289
|
+
outline: 2px solid var(--sashay-accent, oklch(0.62 0.19 255));
|
|
290
|
+
outline-offset: -2px;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/* The leaf pane's own close. */
|
|
294
|
+
[data-sashay-close] {
|
|
295
|
+
position: absolute;
|
|
296
|
+
top: 6px;
|
|
297
|
+
left: 0;
|
|
298
|
+
margin-left: -36px;
|
|
299
|
+
z-index: 99;
|
|
300
|
+
width: 28px;
|
|
301
|
+
height: 28px;
|
|
302
|
+
padding: 0;
|
|
303
|
+
border: 0;
|
|
304
|
+
border-radius: var(--sashay-radius, 6px);
|
|
305
|
+
background: transparent;
|
|
306
|
+
color: var(--sashay-muted, color-mix(in srgb, CanvasText 60%, transparent));
|
|
307
|
+
font-size: 20px;
|
|
308
|
+
line-height: 1;
|
|
309
|
+
cursor: pointer;
|
|
310
|
+
}
|
|
311
|
+
[data-sashay-close]:hover {
|
|
312
|
+
background: var(--sashay-raised-bg, color-mix(in srgb, CanvasText 10%, Canvas));
|
|
313
|
+
color: var(--sashay-fg, CanvasText);
|
|
314
|
+
}
|
|
315
|
+
[data-sashay-close]:focus-visible {
|
|
316
|
+
outline: 2px solid var(--sashay-accent, oklch(0.62 0.19 255));
|
|
317
|
+
outline-offset: -2px;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/* Compact (phone): drawer titles stack as tabs in the first edge; an open
|
|
321
|
+
drawer is a sheet over the panes. */
|
|
322
|
+
[data-sashay-tabs] {
|
|
323
|
+
position: absolute;
|
|
324
|
+
inset: 0;
|
|
325
|
+
width: var(--sashay-tabs-width, 2.75rem);
|
|
326
|
+
display: flex;
|
|
327
|
+
flex-direction: column;
|
|
328
|
+
}
|
|
329
|
+
[data-sashay-tab] {
|
|
330
|
+
writing-mode: vertical-rl;
|
|
331
|
+
padding: 14px 0;
|
|
332
|
+
border: 0;
|
|
333
|
+
border-bottom: 1px solid var(--sashay-border, color-mix(in srgb, CanvasText 15%, transparent));
|
|
334
|
+
background: transparent;
|
|
335
|
+
color: var(--sashay-muted, color-mix(in srgb, CanvasText 60%, transparent));
|
|
336
|
+
font-size: var(--sashay-font-size, 0.6875rem);
|
|
337
|
+
font-weight: 600;
|
|
338
|
+
letter-spacing: 0.06em;
|
|
339
|
+
text-transform: uppercase;
|
|
340
|
+
cursor: pointer;
|
|
341
|
+
}
|
|
342
|
+
[data-sashay-tab]:hover {
|
|
343
|
+
color: var(--sashay-fg, CanvasText);
|
|
344
|
+
}
|
|
345
|
+
[data-sashay-tab][aria-pressed="true"] {
|
|
346
|
+
color: var(--sashay-fg, CanvasText);
|
|
347
|
+
box-shadow: inset 3px 0 0 var(--sashay-accent, oklch(0.62 0.19 255));
|
|
348
|
+
}
|
|
349
|
+
[data-sashay-drawer][data-sheet] {
|
|
350
|
+
z-index: 100;
|
|
351
|
+
padding: 0;
|
|
352
|
+
display: block;
|
|
353
|
+
background: var(--sashay-bg, color-mix(in srgb, CanvasText 6%, Canvas));
|
|
354
|
+
border-right: 1px solid var(--sashay-border, color-mix(in srgb, CanvasText 15%, transparent));
|
|
355
|
+
box-shadow: 10px 0 24px -12px var(--sashay-shadow, rgb(0 0 0 / 0.5));
|
|
356
|
+
}
|
|
357
|
+
/* Over the sheet; the controller matches its transform and width. */
|
|
358
|
+
[data-sashay-sheet-head] {
|
|
359
|
+
position: absolute;
|
|
360
|
+
top: 0;
|
|
361
|
+
left: 0;
|
|
362
|
+
z-index: 100;
|
|
363
|
+
box-sizing: border-box;
|
|
364
|
+
background: var(--sashay-bg, color-mix(in srgb, CanvasText 6%, Canvas));
|
|
365
|
+
height: var(--sashay-header, 2.75rem);
|
|
366
|
+
display: flex;
|
|
367
|
+
align-items: center;
|
|
368
|
+
padding: 0 14px;
|
|
369
|
+
border-bottom: 1px solid var(--sashay-border, color-mix(in srgb, CanvasText 15%, transparent));
|
|
370
|
+
font-size: var(--sashay-font-size, 0.6875rem);
|
|
371
|
+
font-weight: 600;
|
|
372
|
+
letter-spacing: 0.06em;
|
|
373
|
+
text-transform: uppercase;
|
|
374
|
+
color: var(--sashay-muted, color-mix(in srgb, CanvasText 60%, transparent));
|
|
375
|
+
}
|
|
376
|
+
[data-sashay-sheet-close] {
|
|
377
|
+
margin-left: auto;
|
|
378
|
+
padding: 0 4px;
|
|
379
|
+
border: 0;
|
|
380
|
+
background: transparent;
|
|
381
|
+
color: inherit;
|
|
382
|
+
font-size: 18px;
|
|
383
|
+
cursor: pointer;
|
|
384
|
+
}
|
|
385
|
+
[data-sashay-drawer-tab] {
|
|
386
|
+
writing-mode: vertical-rl;
|
|
387
|
+
display: flex;
|
|
388
|
+
align-items: center;
|
|
389
|
+
gap: 6px;
|
|
390
|
+
padding: 10px 0;
|
|
391
|
+
border: 0;
|
|
392
|
+
border-bottom: 1px solid var(--sashay-border, color-mix(in srgb, CanvasText 15%, transparent));
|
|
393
|
+
background: color-mix(in srgb, var(--sashay-pane-bg, Canvas) 50%, transparent);
|
|
394
|
+
color: var(--sashay-muted, color-mix(in srgb, CanvasText 60%, transparent));
|
|
395
|
+
font-size: var(--sashay-font-size, 0.6875rem);
|
|
396
|
+
letter-spacing: 0.04em;
|
|
397
|
+
text-transform: uppercase;
|
|
398
|
+
cursor: pointer;
|
|
399
|
+
}
|
|
400
|
+
[data-sashay-drawer-tab] svg {
|
|
401
|
+
width: 12px;
|
|
402
|
+
height: 12px;
|
|
403
|
+
transform: rotate(90deg);
|
|
404
|
+
transition: transform 0.2s;
|
|
405
|
+
}
|
|
406
|
+
[data-sashay-drawer-tab][aria-expanded="true"] {
|
|
407
|
+
background: var(--sashay-pane-bg, Canvas);
|
|
408
|
+
color: var(--sashay-accent, oklch(0.62 0.19 255));
|
|
409
|
+
}
|
|
410
|
+
[data-sashay-drawer-tab][aria-expanded="true"] svg {
|
|
411
|
+
transform: rotate(-90deg);
|
|
412
|
+
}
|
|
413
|
+
[data-sashay-drawer-tab]:hover {
|
|
414
|
+
color: var(--sashay-fg, CanvasText);
|
|
415
|
+
}
|
|
416
|
+
}
|