@gridui/overlay 1.1.1 → 1.2.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 +61 -2
- package/dist/index.d.ts +6 -0
- package/dist/index.js +693 -6
- package/dist/index.js.map +4 -4
- package/dist/shared/content-mutation.d.ts +8 -0
- package/dist/shared/interaction-layer.d.ts +21 -0
- package/dist/shared/scrollbar-interaction-ref.d.ts +8 -0
- package/dist/shared/style.d.ts +1 -1
- package/dist/shared/textarea-scrollbar.d.ts +9 -0
- package/dist/shared/use-interaction-outline.d.ts +13 -0
- package/dist/shared/use-scrollbars.d.ts +12 -0
- package/dist/styles.css +8 -14
- package/package.json +4 -5
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# @gridui/overlay
|
|
2
2
|
|
|
3
|
-
Core family. Public API: `OverlayOpen`, `RetainedLayer`, `RetainedLayerProps`, `useOverlayState`, `overlaySurfaceStyles`, `overlayBackdropStyles`.
|
|
3
|
+
Core family. Public API: `interactionLayerProps`, `useInteractionOutline`, `InteractionOutlineOptions`, `useScrollbars`, `ScrollbarsOptions`, `scrollbarInteractionRef`, `OverlayOpen`, `RetainedLayer`, `RetainedLayerProps`, `useOverlayState`, `overlaySurfaceStyles`, `overlayBackdropStyles`.
|
|
4
4
|
|
|
5
5
|
Import components from `@gridui/overlay` and load `@gridui/overlay/styles.css` after Theme.
|
|
6
6
|
Load styles for any composed dependency used by this family. Applications own routes, labels, state persistence, and branding.
|
|
7
7
|
|
|
8
|
-
See [component ownership](
|
|
8
|
+
See [component ownership](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/component-ownership.md) and [release history](https://github.com/sudo-ui/GridUI-React-Monorepo/tree/main/packages-core/overlay/.changeset/history).
|
|
9
9
|
|
|
10
10
|
## Surface presentation
|
|
11
11
|
|
|
@@ -20,3 +20,62 @@ item-aligned Select. Open/closed and Tooltip's instant/delayed open states are
|
|
|
20
20
|
supported. Families keep dimensions, stacking, positioning, portals, focus,
|
|
21
21
|
and dismissal. Drawer retains its directional panel motion and uses only the
|
|
22
22
|
shared backdrop. Theme continues to own motion tokens and keyframes.
|
|
23
|
+
|
|
24
|
+
## Interaction outlines
|
|
25
|
+
|
|
26
|
+
`useInteractionOutline({ ref, selector })` returns a composed React ref for a
|
|
27
|
+
scrolling viewport. Forward the caller's optional ref and select the native
|
|
28
|
+
interactive descendants owned by that viewport. Theme styles own the indicator
|
|
29
|
+
paint; the hook does not require an additional stylesheet.
|
|
30
|
+
The hook mirrors each active Theme outline into an aria-hidden, input-transparent
|
|
31
|
+
document plane using its resolved color, width, offset, and radius.
|
|
32
|
+
Spread `interactionLayerProps` on a custom popup or dialog surface to define its
|
|
33
|
+
interaction boundary. Built-in menu, selection, popover, and dialog surfaces
|
|
34
|
+
already do this. Viewports share one isolated plane per boundary, or the page
|
|
35
|
+
plane when there is no surface. The plane follows its surface's stacking level
|
|
36
|
+
and source order; descendant z-index values remain local. Nested DOM surfaces
|
|
37
|
+
retain their parent interaction boundary. Focus paints above hover within the
|
|
38
|
+
same plane, while newer menus and dialogs can cover the underlying outlines.
|
|
39
|
+
Inert and aria-hidden background viewports suppress both native and mirrored indicators.
|
|
40
|
+
Nested viewports own their own targets. It preserves native focus and selection,
|
|
41
|
+
tracks scroll, resize, theme, DOM changes and surface motion, and removes
|
|
42
|
+
invisible or unmounted targets. Clipping bounds limit offscreen paint while
|
|
43
|
+
allowing the outline's full outward extent. The layer never receives input.
|
|
44
|
+
|
|
45
|
+
## Scrollbars
|
|
46
|
+
|
|
47
|
+
`useScrollbars({ ref })` returns a composed React ref for one native scrolling
|
|
48
|
+
viewport. Bind each owned viewport explicitly, including independently scrolling
|
|
49
|
+
dialog sections. `useInteractionOutline` remains independent; compose its ref
|
|
50
|
+
with this hook when a viewport needs both behaviors. Theme owns the paint, so
|
|
51
|
+
no additional stylesheet is required for this hook.
|
|
52
|
+
|
|
53
|
+
The hook keeps native content scrolling and renders square, proportional thumbs
|
|
54
|
+
in an aria-hidden local layer. The transparent 10px track overlays the viewport
|
|
55
|
+
edge. Its 4px thumb becomes 6px on hover or drag without changing content geometry.
|
|
56
|
+
Track clicks, wheel input, and captured pointer dragging update the real viewport;
|
|
57
|
+
keyboard focus remains on the real content. RTL horizontal scrolling and reversed
|
|
58
|
+
vertical flex layouts retain their native coordinate behavior.
|
|
59
|
+
|
|
60
|
+
The layer lives inside the viewport and follows its native scrolling, clipping,
|
|
61
|
+
palette, transforms, and stacking context. It remains part of hover-opened panels.
|
|
62
|
+
There is no document-level scrollbar portal, ancestor z-index reconstruction,
|
|
63
|
+
descendant discovery, or permanent document input listener. Resize observation
|
|
64
|
+
covers every direct content element; captured load events also update asynchronous
|
|
65
|
+
media. Native refs, content DOM, and focus semantics remain intact.
|
|
66
|
+
|
|
67
|
+
Textarea uses a local sibling layer in its parent because it cannot render child
|
|
68
|
+
elements. The adapter measures the existing containing block without changing the
|
|
69
|
+
parent's positioning, adding a wrapper, or adjusting padding and margins. It
|
|
70
|
+
observes the parent and its direct children, preserves control-level palette
|
|
71
|
+
overrides, and mirrors the native control's inert state. Native form reset refreshes
|
|
72
|
+
the indicator after the default action, including canceled resets and live form
|
|
73
|
+
reassociation. Coarse pointers pan the native viewport; forced colors use square
|
|
74
|
+
system-colored thumbs.
|
|
75
|
+
|
|
76
|
+
`scrollbarInteractionRef` binds Theme's hover and dragging state to a scrollbar
|
|
77
|
+
element without owning scroll position, sizing, or pointer capture. It is a stable
|
|
78
|
+
React 19 callback ref with cleanup, also usable as an imperative binding that
|
|
79
|
+
returns a disposer. Native viewports and Sidebar's Radix scrollbar share this
|
|
80
|
+
binding. Ref composition uses Radix's cleanup-aware implementation. Both layout
|
|
81
|
+
hooks ignore mutations inside their decorative layers and observe real content.
|
package/dist/index.d.ts
CHANGED
|
@@ -7,5 +7,11 @@
|
|
|
7
7
|
export type { RetainedLayerProps } from "./retained-layer/retained-layer";
|
|
8
8
|
export { OverlayOpen } from "./retained-layer/retained-layer";
|
|
9
9
|
export { RetainedLayer } from "./retained-layer/retained-layer";
|
|
10
|
+
export { interactionLayerProps } from "./shared/interaction-layer";
|
|
11
|
+
export { scrollbarInteractionRef } from "./shared/scrollbar-interaction-ref";
|
|
10
12
|
export { overlayBackdropStyles, overlaySurfaceStyles } from "./shared/style";
|
|
13
|
+
export type { InteractionOutlineOptions } from "./shared/use-interaction-outline";
|
|
14
|
+
export { useInteractionOutline } from "./shared/use-interaction-outline";
|
|
11
15
|
export { useOverlayState } from "./shared/use-overlay-state";
|
|
16
|
+
export type { ScrollbarsOptions } from "./shared/use-scrollbars";
|
|
17
|
+
export { useScrollbars } from "./shared/use-scrollbars";
|
package/dist/index.js
CHANGED
|
@@ -14,13 +14,127 @@ var RetainedLayer = (props) => {
|
|
|
14
14
|
);
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
+
// src/shared/interaction-layer.ts
|
|
18
|
+
var interactionLayerProps = { "data-gridui-interaction-layer": "" };
|
|
19
|
+
var selector = "[data-gridui-interaction-layer]";
|
|
20
|
+
var planes = /* @__PURE__ */ new WeakMap();
|
|
21
|
+
var planeElements = /* @__PURE__ */ new WeakMap();
|
|
22
|
+
var interactionLayerOwner = (viewport) => {
|
|
23
|
+
return viewport.closest(selector) ?? viewport.ownerDocument.body;
|
|
24
|
+
};
|
|
25
|
+
var refreshOutlinePlane = (plane) => {
|
|
26
|
+
const { owner, element, parent } = plane;
|
|
27
|
+
const document = owner.ownerDocument;
|
|
28
|
+
const style = document.defaultView.getComputedStyle(owner);
|
|
29
|
+
element.style.zIndex = owner === document.body || style.zIndex === "auto" ? style.getPropertyValue("--gridui-z-interaction") || "3" : style.zIndex;
|
|
30
|
+
if (parent) {
|
|
31
|
+
refreshOutlinePlane(parent);
|
|
32
|
+
const next = Array.from(parent.element.children).find((child) => {
|
|
33
|
+
const sibling = planeElements.get(child);
|
|
34
|
+
return sibling && sibling !== plane && Boolean(owner.compareDocumentPosition(sibling.owner) & Node.DOCUMENT_POSITION_FOLLOWING);
|
|
35
|
+
});
|
|
36
|
+
parent.element.insertBefore(element, next ?? null);
|
|
37
|
+
} else if (owner === document.body) {
|
|
38
|
+
if (!element.isConnected) {
|
|
39
|
+
document.body.append(element);
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
let anchor = owner;
|
|
43
|
+
while (anchor.parentElement && anchor.parentElement !== document.body) {
|
|
44
|
+
anchor = anchor.parentElement;
|
|
45
|
+
}
|
|
46
|
+
let next = anchor.nextElementSibling;
|
|
47
|
+
while (next) {
|
|
48
|
+
const sibling = planeElements.get(next);
|
|
49
|
+
if (!sibling || sibling === plane || !(sibling.owner.compareDocumentPosition(owner) & Node.DOCUMENT_POSITION_FOLLOWING)) {
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
next = next.nextElementSibling;
|
|
53
|
+
}
|
|
54
|
+
document.body.insertBefore(element, next);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var acquireOutlinePlane = (owner) => {
|
|
58
|
+
const existing = planes.get(owner);
|
|
59
|
+
if (existing) {
|
|
60
|
+
existing.references++;
|
|
61
|
+
return existing;
|
|
62
|
+
}
|
|
63
|
+
const parentOwner = owner.parentElement?.closest(selector);
|
|
64
|
+
const parent = parentOwner ? acquireOutlinePlane(parentOwner) : void 0;
|
|
65
|
+
const element = owner.ownerDocument.createElement("div");
|
|
66
|
+
element.className = "gridui-interaction-outline-layer";
|
|
67
|
+
element.setAttribute("aria-hidden", "true");
|
|
68
|
+
const plane = {
|
|
69
|
+
owner,
|
|
70
|
+
element,
|
|
71
|
+
parent,
|
|
72
|
+
references: 1
|
|
73
|
+
};
|
|
74
|
+
planes.set(owner, plane);
|
|
75
|
+
planeElements.set(element, plane);
|
|
76
|
+
refreshOutlinePlane(plane);
|
|
77
|
+
return plane;
|
|
78
|
+
};
|
|
79
|
+
var releaseOutlinePlane = (plane) => {
|
|
80
|
+
if (--plane.references) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
plane.element.remove();
|
|
84
|
+
planes.delete(plane.owner);
|
|
85
|
+
planeElements.delete(plane.element);
|
|
86
|
+
if (plane.parent) {
|
|
87
|
+
releaseOutlinePlane(plane.parent);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// src/shared/scrollbar-interaction-ref.ts
|
|
92
|
+
var scrollbarInteractionRef = (element) => {
|
|
93
|
+
if (!element) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const hover = (event) => {
|
|
97
|
+
const box = element.getBoundingClientRect();
|
|
98
|
+
element.toggleAttribute("data-gridui-hovered", event.clientX >= box.left && event.clientX < box.right && event.clientY >= box.top && event.clientY < box.bottom);
|
|
99
|
+
};
|
|
100
|
+
const leave = () => {
|
|
101
|
+
element.removeAttribute("data-gridui-hovered");
|
|
102
|
+
};
|
|
103
|
+
const down = (event) => {
|
|
104
|
+
if (event.button === 0) {
|
|
105
|
+
element.setAttribute("data-gridui-dragging", "");
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const finish = () => {
|
|
109
|
+
element.removeAttribute("data-gridui-dragging");
|
|
110
|
+
};
|
|
111
|
+
element.addEventListener("pointerenter", hover);
|
|
112
|
+
element.addEventListener("pointermove", hover);
|
|
113
|
+
element.addEventListener("pointerleave", leave);
|
|
114
|
+
element.addEventListener("pointerdown", down);
|
|
115
|
+
element.addEventListener("pointerup", finish);
|
|
116
|
+
element.addEventListener("pointercancel", finish);
|
|
117
|
+
element.addEventListener("lostpointercapture", finish);
|
|
118
|
+
return () => {
|
|
119
|
+
element.removeEventListener("pointerenter", hover);
|
|
120
|
+
element.removeEventListener("pointermove", hover);
|
|
121
|
+
element.removeEventListener("pointerleave", leave);
|
|
122
|
+
element.removeEventListener("pointerdown", down);
|
|
123
|
+
element.removeEventListener("pointerup", finish);
|
|
124
|
+
element.removeEventListener("pointercancel", finish);
|
|
125
|
+
element.removeEventListener("lostpointercapture", finish);
|
|
126
|
+
leave();
|
|
127
|
+
finish();
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
|
|
17
131
|
// src/shared/style.ts
|
|
18
132
|
import { cva } from "class-variance-authority";
|
|
19
|
-
var overlaySurfaceStyles = cva("gridui-overlay-surface border border-solid border-border bg-background text-foreground", {
|
|
133
|
+
var overlaySurfaceStyles = cva("gridui-overlay-surface gridui-u-border gridui-u-border-solid gridui-u-border-border gridui-u-bg-background gridui-u-text-foreground", {
|
|
20
134
|
variants: {
|
|
21
135
|
kind: {
|
|
22
|
-
popup: "gridui-overlay-floating rounded-control",
|
|
23
|
-
tooltip: "gridui-overlay-tooltip rounded-control",
|
|
136
|
+
popup: "gridui-overlay-floating gridui-u-rounded-control",
|
|
137
|
+
tooltip: "gridui-overlay-tooltip gridui-u-rounded-control",
|
|
24
138
|
dialog: "gridui-overlay-dialog"
|
|
25
139
|
}
|
|
26
140
|
},
|
|
@@ -36,13 +150,252 @@ var overlayBackdropStyles = cva("gridui-overlay-backdrop", {
|
|
|
36
150
|
defaultVariants: { pace: "normal" }
|
|
37
151
|
});
|
|
38
152
|
|
|
153
|
+
// src/shared/content-mutation.ts
|
|
154
|
+
var decorativeSelector = ".gridui-scrollbar-layer, .gridui-interaction-outline-layer";
|
|
155
|
+
var isDecorative = (node) => {
|
|
156
|
+
const element = node.nodeType === 1 ? node : node.parentElement;
|
|
157
|
+
return !!element?.closest(decorativeSelector);
|
|
158
|
+
};
|
|
159
|
+
var hasContentMutation = (records) => {
|
|
160
|
+
return records.some((record) => {
|
|
161
|
+
return !isDecorative(record.target) && (record.type !== "childList" || [
|
|
162
|
+
...record.addedNodes,
|
|
163
|
+
...record.removedNodes
|
|
164
|
+
].some((node) => {
|
|
165
|
+
return !isDecorative(node);
|
|
166
|
+
}));
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
// src/shared/use-interaction-outline.ts
|
|
171
|
+
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
172
|
+
import { useLayoutEffect, useState } from "react";
|
|
173
|
+
var useInteractionOutline = (options) => {
|
|
174
|
+
const { ref, selector: selector2 } = options;
|
|
175
|
+
const [
|
|
176
|
+
viewport,
|
|
177
|
+
setViewport
|
|
178
|
+
] = useState(null);
|
|
179
|
+
useLayoutEffect(() => {
|
|
180
|
+
if (!viewport) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
const document = viewport.ownerDocument;
|
|
184
|
+
const window = document.defaultView;
|
|
185
|
+
let plane;
|
|
186
|
+
viewport.setAttribute("data-gridui-outline-viewport", "");
|
|
187
|
+
const rings = /* @__PURE__ */ new Map();
|
|
188
|
+
let frame = 0;
|
|
189
|
+
let disposed = false;
|
|
190
|
+
const schedule = () => {
|
|
191
|
+
if (!disposed && !frame) {
|
|
192
|
+
frame = window.requestAnimationFrame(sync);
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
const resize = new ResizeObserver(schedule);
|
|
196
|
+
const sync = () => {
|
|
197
|
+
frame = 0;
|
|
198
|
+
for (const element of rings.keys()) {
|
|
199
|
+
element.removeAttribute("data-gridui-outline-rendered");
|
|
200
|
+
}
|
|
201
|
+
const owner = interactionLayerOwner(viewport);
|
|
202
|
+
if (plane && plane.owner !== owner) {
|
|
203
|
+
const previous = plane;
|
|
204
|
+
plane = acquireOutlinePlane(owner);
|
|
205
|
+
plane.element.append(...rings.values());
|
|
206
|
+
releaseOutlinePlane(previous);
|
|
207
|
+
}
|
|
208
|
+
if (plane) {
|
|
209
|
+
refreshOutlinePlane(plane);
|
|
210
|
+
}
|
|
211
|
+
const inactive = viewport.closest('[inert], [aria-hidden="true"]');
|
|
212
|
+
viewport.toggleAttribute("data-gridui-outline-inactive", !!inactive);
|
|
213
|
+
const candidates = inactive ? [] : Array.from(viewport.querySelectorAll(selector2)).filter((element) => {
|
|
214
|
+
return element.closest("[data-gridui-outline-viewport]") === viewport && element.matches(":hover, :active, :focus-visible, [data-highlighted]");
|
|
215
|
+
});
|
|
216
|
+
const current = /* @__PURE__ */ new Set();
|
|
217
|
+
let moving = false;
|
|
218
|
+
for (const element of candidates) {
|
|
219
|
+
const box = element.getBoundingClientRect();
|
|
220
|
+
const style = window.getComputedStyle(element);
|
|
221
|
+
if (!element.getClientRects().length || style.visibility !== "visible" || style.outlineStyle === "none" || parseFloat(style.outlineWidth) <= 0) {
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
let left = 0;
|
|
225
|
+
let top = 0;
|
|
226
|
+
let right = document.documentElement.clientWidth;
|
|
227
|
+
let bottom = document.documentElement.clientHeight;
|
|
228
|
+
let opacity = Number(style.opacity);
|
|
229
|
+
let clipped = false;
|
|
230
|
+
for (let ancestor = element.parentElement; ancestor; ancestor = ancestor.parentElement) {
|
|
231
|
+
const appearance = window.getComputedStyle(ancestor);
|
|
232
|
+
const bounds = ancestor.getBoundingClientRect();
|
|
233
|
+
opacity *= Number(appearance.opacity);
|
|
234
|
+
moving ||= ancestor.getAnimations().some((animation) => {
|
|
235
|
+
return animation.playState === "running";
|
|
236
|
+
});
|
|
237
|
+
if (appearance.overflowX !== "visible") {
|
|
238
|
+
clipped = true;
|
|
239
|
+
left = Math.max(left, bounds.left + ancestor.clientLeft);
|
|
240
|
+
right = Math.min(right, bounds.left + ancestor.clientLeft + ancestor.clientWidth);
|
|
241
|
+
}
|
|
242
|
+
if (appearance.overflowY !== "visible") {
|
|
243
|
+
clipped = true;
|
|
244
|
+
top = Math.max(top, bounds.top + ancestor.clientTop);
|
|
245
|
+
bottom = Math.min(bottom, bounds.top + ancestor.clientTop + ancestor.clientHeight);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
if (!clipped || opacity === 0 || box.right <= left || box.left >= right || box.bottom <= top || box.top >= bottom) {
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
current.add(element);
|
|
252
|
+
let ring = rings.get(element);
|
|
253
|
+
if (!ring) {
|
|
254
|
+
ring = document.createElement("div");
|
|
255
|
+
ring.className = "gridui-interaction-outline";
|
|
256
|
+
plane ??= acquireOutlinePlane(owner);
|
|
257
|
+
plane.element.append(ring);
|
|
258
|
+
rings.set(element, ring);
|
|
259
|
+
resize.observe(element);
|
|
260
|
+
}
|
|
261
|
+
const extent = Math.max(0, parseFloat(style.outlineWidth) + parseFloat(style.outlineOffset));
|
|
262
|
+
Object.assign(ring.style, {
|
|
263
|
+
left: `${box.left}px`,
|
|
264
|
+
top: `${box.top}px`,
|
|
265
|
+
width: `${box.width}px`,
|
|
266
|
+
height: `${box.height}px`,
|
|
267
|
+
outline: style.outline,
|
|
268
|
+
outlineOffset: style.outlineOffset,
|
|
269
|
+
borderRadius: style.borderRadius,
|
|
270
|
+
opacity: String(opacity),
|
|
271
|
+
zIndex: element.matches(":focus-visible") ? "3" : "2",
|
|
272
|
+
clipPath: `inset(${Math.max(0, top - box.top) - extent}px ${Math.max(0, box.right - right) - extent}px ${Math.max(0, box.bottom - bottom) - extent}px ${Math.max(0, left - box.left) - extent}px)`
|
|
273
|
+
});
|
|
274
|
+
element.setAttribute("data-gridui-outline-rendered", "");
|
|
275
|
+
}
|
|
276
|
+
for (const [
|
|
277
|
+
element,
|
|
278
|
+
ring
|
|
279
|
+
] of rings) {
|
|
280
|
+
if (!current.has(element)) {
|
|
281
|
+
element.removeAttribute("data-gridui-outline-rendered");
|
|
282
|
+
ring.remove();
|
|
283
|
+
rings.delete(element);
|
|
284
|
+
resize.unobserve(element);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
if (!rings.size && plane) {
|
|
288
|
+
releaseOutlinePlane(plane);
|
|
289
|
+
plane = void 0;
|
|
290
|
+
}
|
|
291
|
+
if (moving) {
|
|
292
|
+
schedule();
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
const mutation = new MutationObserver((records) => {
|
|
296
|
+
if (hasContentMutation(records)) {
|
|
297
|
+
schedule();
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
mutation.observe(viewport, {
|
|
301
|
+
subtree: true,
|
|
302
|
+
childList: true,
|
|
303
|
+
characterData: true,
|
|
304
|
+
attributes: true,
|
|
305
|
+
attributeFilter: [
|
|
306
|
+
"class",
|
|
307
|
+
"style",
|
|
308
|
+
"hidden",
|
|
309
|
+
"disabled",
|
|
310
|
+
"aria-disabled",
|
|
311
|
+
"aria-readonly",
|
|
312
|
+
"readonly",
|
|
313
|
+
"data-disabled",
|
|
314
|
+
"data-readonly",
|
|
315
|
+
"data-state",
|
|
316
|
+
"data-highlighted",
|
|
317
|
+
"aria-selected"
|
|
318
|
+
]
|
|
319
|
+
});
|
|
320
|
+
const ancestors = new MutationObserver(schedule);
|
|
321
|
+
for (let ancestor = viewport; ancestor; ancestor = ancestor.parentElement) {
|
|
322
|
+
ancestors.observe(ancestor, {
|
|
323
|
+
attributes: true,
|
|
324
|
+
attributeFilter: [
|
|
325
|
+
"class",
|
|
326
|
+
"style",
|
|
327
|
+
"hidden",
|
|
328
|
+
"dir",
|
|
329
|
+
"data-theme",
|
|
330
|
+
"data-state",
|
|
331
|
+
"data-gridui-interaction-layer",
|
|
332
|
+
"aria-hidden",
|
|
333
|
+
"inert"
|
|
334
|
+
]
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
const events = [
|
|
338
|
+
"scroll",
|
|
339
|
+
"pointerover",
|
|
340
|
+
"pointerout",
|
|
341
|
+
"pointerdown",
|
|
342
|
+
"pointerup",
|
|
343
|
+
"pointercancel",
|
|
344
|
+
"focusin",
|
|
345
|
+
"focusout",
|
|
346
|
+
"keydown",
|
|
347
|
+
"keyup",
|
|
348
|
+
"animationstart",
|
|
349
|
+
"transitionrun"
|
|
350
|
+
];
|
|
351
|
+
for (const event of events) {
|
|
352
|
+
document.addEventListener(event, schedule, {
|
|
353
|
+
capture: true,
|
|
354
|
+
passive: true
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
const scheme = window.matchMedia("(prefers-color-scheme: dark)");
|
|
358
|
+
scheme.addEventListener("change", schedule);
|
|
359
|
+
window.addEventListener("resize", schedule);
|
|
360
|
+
resize.observe(viewport);
|
|
361
|
+
sync();
|
|
362
|
+
return () => {
|
|
363
|
+
disposed = true;
|
|
364
|
+
window.cancelAnimationFrame(frame);
|
|
365
|
+
resize.disconnect();
|
|
366
|
+
mutation.disconnect();
|
|
367
|
+
ancestors.disconnect();
|
|
368
|
+
for (const event of events) {
|
|
369
|
+
document.removeEventListener(event, schedule, true);
|
|
370
|
+
}
|
|
371
|
+
scheme.removeEventListener("change", schedule);
|
|
372
|
+
window.removeEventListener("resize", schedule);
|
|
373
|
+
viewport.removeAttribute("data-gridui-outline-viewport");
|
|
374
|
+
viewport.removeAttribute("data-gridui-outline-inactive");
|
|
375
|
+
for (const element of rings.keys()) {
|
|
376
|
+
element.removeAttribute("data-gridui-outline-rendered");
|
|
377
|
+
}
|
|
378
|
+
for (const ring of rings.values()) {
|
|
379
|
+
ring.remove();
|
|
380
|
+
}
|
|
381
|
+
if (plane) {
|
|
382
|
+
releaseOutlinePlane(plane);
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
}, [
|
|
386
|
+
viewport,
|
|
387
|
+
selector2
|
|
388
|
+
]);
|
|
389
|
+
return useComposedRefs(setViewport, ref);
|
|
390
|
+
};
|
|
391
|
+
|
|
39
392
|
// src/shared/use-overlay-state.ts
|
|
40
|
-
import { useState } from "react";
|
|
393
|
+
import { useState as useState2 } from "react";
|
|
41
394
|
var useOverlayState = (options) => {
|
|
42
395
|
const [
|
|
43
396
|
localOpen,
|
|
44
397
|
setLocalOpen
|
|
45
|
-
] =
|
|
398
|
+
] = useState2(options.defaultOpen ?? false);
|
|
46
399
|
return {
|
|
47
400
|
open: options.open ?? localOpen,
|
|
48
401
|
onOpenChange: (open) => {
|
|
@@ -53,11 +406,345 @@ var useOverlayState = (options) => {
|
|
|
53
406
|
}
|
|
54
407
|
};
|
|
55
408
|
};
|
|
409
|
+
|
|
410
|
+
// src/shared/textarea-scrollbar.ts
|
|
411
|
+
var isTextarea = (element) => {
|
|
412
|
+
return element.tagName === "TEXTAREA";
|
|
413
|
+
};
|
|
414
|
+
var syncTextareaScrollbar = (viewport, layer, style) => {
|
|
415
|
+
const window = viewport.ownerDocument.defaultView;
|
|
416
|
+
layer.style.position = style.position === "fixed" ? "fixed" : "absolute";
|
|
417
|
+
const parent = layer.offsetParent;
|
|
418
|
+
const parentBox = parent?.getBoundingClientRect();
|
|
419
|
+
const parentScaleX = parent?.offsetWidth ? parentBox.width / parent.offsetWidth : 1;
|
|
420
|
+
const parentScaleY = parent?.offsetHeight ? parentBox.height / parent.offsetHeight : 1;
|
|
421
|
+
const box = viewport.getBoundingClientRect();
|
|
422
|
+
const controlScaleX = viewport.offsetWidth ? box.width / viewport.offsetWidth : 1;
|
|
423
|
+
const controlScaleY = viewport.offsetHeight ? box.height / viewport.offsetHeight : 1;
|
|
424
|
+
const current = layer.getBoundingClientRect();
|
|
425
|
+
const left = (parseFloat(layer.style.left) || 0) + (box.left + viewport.clientLeft * controlScaleX - current.left) / parentScaleX;
|
|
426
|
+
const top = (parseFloat(layer.style.top) || 0) + (box.top + viewport.clientTop * controlScaleY - current.top) / parentScaleY;
|
|
427
|
+
Object.assign(layer.style, {
|
|
428
|
+
left: `${left}px`,
|
|
429
|
+
top: `${top}px`,
|
|
430
|
+
transform: `scale(${controlScaleX / parentScaleX}, ${controlScaleY / parentScaleY})`,
|
|
431
|
+
transformOrigin: "0 0",
|
|
432
|
+
zIndex: style.zIndex === "auto" ? "var(--gridui-z-interaction)" : style.zIndex,
|
|
433
|
+
opacity: style.opacity,
|
|
434
|
+
visibility: style.visibility,
|
|
435
|
+
colorScheme: style.colorScheme
|
|
436
|
+
});
|
|
437
|
+
layer.inert = viewport.inert;
|
|
438
|
+
const inherited = window.getComputedStyle(viewport.parentElement);
|
|
439
|
+
for (const [
|
|
440
|
+
token,
|
|
441
|
+
fallback
|
|
442
|
+
] of [
|
|
443
|
+
[
|
|
444
|
+
"--gridui-scrollbar-thumb",
|
|
445
|
+
"--gridui-muted"
|
|
446
|
+
],
|
|
447
|
+
[
|
|
448
|
+
"--gridui-scrollbar-thumb-active",
|
|
449
|
+
"--gridui-foreground"
|
|
450
|
+
],
|
|
451
|
+
[
|
|
452
|
+
"--gridui-scrollbar-track",
|
|
453
|
+
"--gridui-scrollbar-track"
|
|
454
|
+
]
|
|
455
|
+
]) {
|
|
456
|
+
const value = style.getPropertyValue(token) || style.getPropertyValue(fallback);
|
|
457
|
+
const parentValue = inherited.getPropertyValue(token) || inherited.getPropertyValue(fallback);
|
|
458
|
+
if (value && value !== parentValue) {
|
|
459
|
+
layer.style.setProperty(token, value);
|
|
460
|
+
} else {
|
|
461
|
+
layer.style.removeProperty(token);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
// src/shared/use-scrollbars.ts
|
|
467
|
+
import { useComposedRefs as useComposedRefs2 } from "@radix-ui/react-compose-refs";
|
|
468
|
+
import { useId, useLayoutEffect as useLayoutEffect2, useRef, useState as useState3 } from "react";
|
|
469
|
+
var useScrollbars = (options = {}) => {
|
|
470
|
+
const { ref } = options;
|
|
471
|
+
const owner = useId();
|
|
472
|
+
const [
|
|
473
|
+
viewport,
|
|
474
|
+
setViewport
|
|
475
|
+
] = useState3(null);
|
|
476
|
+
const refresh = useRef(void 0);
|
|
477
|
+
useLayoutEffect2(() => {
|
|
478
|
+
if (!viewport) {
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
const document = viewport.ownerDocument;
|
|
482
|
+
const window = document.defaultView;
|
|
483
|
+
const textarea = isTextarea(viewport) ? viewport : null;
|
|
484
|
+
const host = textarea ? viewport.parentElement : viewport;
|
|
485
|
+
const layer = document.createElement(viewport.matches("ol, ul") ? "li" : "span");
|
|
486
|
+
layer.className = "gridui-scrollbar-layer";
|
|
487
|
+
layer.setAttribute("aria-hidden", "true");
|
|
488
|
+
host.append(layer);
|
|
489
|
+
viewport.setAttribute("data-gridui-scrollbar-owner", owner);
|
|
490
|
+
viewport.setAttribute("data-gridui-scrollbar-id", owner);
|
|
491
|
+
const bars = /* @__PURE__ */ new Map();
|
|
492
|
+
const contents = /* @__PURE__ */ new Set();
|
|
493
|
+
let frame = 0;
|
|
494
|
+
let disposed = false;
|
|
495
|
+
let rtl = false;
|
|
496
|
+
let reverse = false;
|
|
497
|
+
const schedule = () => {
|
|
498
|
+
if (!disposed && !frame) {
|
|
499
|
+
frame = window.requestAnimationFrame(sync);
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
const extent = (vertical) => {
|
|
503
|
+
return vertical ? viewport.scrollHeight - viewport.clientHeight : viewport.scrollWidth - viewport.clientWidth;
|
|
504
|
+
};
|
|
505
|
+
const position = (vertical) => {
|
|
506
|
+
const value = vertical ? viewport.scrollTop : viewport.scrollLeft;
|
|
507
|
+
return (vertical ? reverse : rtl) ? extent(vertical) + value : value;
|
|
508
|
+
};
|
|
509
|
+
const write = (vertical, value) => {
|
|
510
|
+
if (viewport.inert) {
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
const next = Math.max(0, Math.min(extent(vertical), value));
|
|
514
|
+
const native = (vertical ? reverse : rtl) ? next - extent(vertical) : next;
|
|
515
|
+
if (vertical) {
|
|
516
|
+
viewport.scrollTop = native;
|
|
517
|
+
} else {
|
|
518
|
+
viewport.scrollLeft = native;
|
|
519
|
+
}
|
|
520
|
+
sync();
|
|
521
|
+
};
|
|
522
|
+
const create = (vertical) => {
|
|
523
|
+
const track = document.createElement("span");
|
|
524
|
+
const thumb = document.createElement("span");
|
|
525
|
+
track.className = "gridui-scrollbar";
|
|
526
|
+
thumb.className = "gridui-scrollbar-thumb";
|
|
527
|
+
track.dataset.orientation = vertical ? "vertical" : "horizontal";
|
|
528
|
+
track.setAttribute("data-gridui-scrollbar-for", owner);
|
|
529
|
+
track.append(thumb);
|
|
530
|
+
layer.append(track);
|
|
531
|
+
const unbind = scrollbarInteractionRef(track);
|
|
532
|
+
const length = () => {
|
|
533
|
+
return vertical ? track.clientHeight : track.clientWidth;
|
|
534
|
+
};
|
|
535
|
+
const thumbLength = () => {
|
|
536
|
+
return vertical ? thumb.clientHeight : thumb.clientWidth;
|
|
537
|
+
};
|
|
538
|
+
const coordinate = (event) => {
|
|
539
|
+
const box = track.getBoundingClientRect();
|
|
540
|
+
const scale = (vertical ? box.height : box.width) / length();
|
|
541
|
+
return (vertical ? event.clientY - box.top : event.clientX - box.left) / scale;
|
|
542
|
+
};
|
|
543
|
+
let drag;
|
|
544
|
+
const finish = () => {
|
|
545
|
+
drag = void 0;
|
|
546
|
+
};
|
|
547
|
+
track.addEventListener("pointerdown", (event) => {
|
|
548
|
+
if (event.button !== 0) {
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
event.preventDefault();
|
|
552
|
+
const max = extent(vertical);
|
|
553
|
+
const offset = max ? position(vertical) / max * (length() - thumbLength()) : 0;
|
|
554
|
+
const cursor = coordinate(event);
|
|
555
|
+
drag = {
|
|
556
|
+
pointerId: event.pointerId,
|
|
557
|
+
grab: event.target === thumb ? cursor - offset : thumbLength() / 2
|
|
558
|
+
};
|
|
559
|
+
track.setPointerCapture(event.pointerId);
|
|
560
|
+
write(vertical, (cursor - drag.grab) / Math.max(1, length() - thumbLength()) * max);
|
|
561
|
+
});
|
|
562
|
+
track.addEventListener("pointermove", (event) => {
|
|
563
|
+
if (drag?.pointerId === event.pointerId) {
|
|
564
|
+
write(vertical, (coordinate(event) - drag.grab) / Math.max(1, length() - thumbLength()) * extent(vertical));
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
track.addEventListener("pointerup", finish);
|
|
568
|
+
track.addEventListener("pointercancel", finish);
|
|
569
|
+
track.addEventListener("lostpointercapture", finish);
|
|
570
|
+
track.addEventListener("click", (event) => {
|
|
571
|
+
event.preventDefault();
|
|
572
|
+
event.stopPropagation();
|
|
573
|
+
});
|
|
574
|
+
track.addEventListener("wheel", (event) => {
|
|
575
|
+
if (event.ctrlKey) {
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
const style = window.getComputedStyle(viewport);
|
|
579
|
+
let unit = 1;
|
|
580
|
+
if (event.deltaMode === 1) {
|
|
581
|
+
unit = parseFloat(style.lineHeight) || 16;
|
|
582
|
+
} else if (event.deltaMode === 2) {
|
|
583
|
+
unit = vertical ? viewport.clientHeight : viewport.clientWidth;
|
|
584
|
+
}
|
|
585
|
+
const next = Math.max(0, Math.min(extent(vertical), position(vertical) + (vertical ? event.deltaY : event.deltaX || event.deltaY) * unit));
|
|
586
|
+
if (next !== position(vertical)) {
|
|
587
|
+
event.preventDefault();
|
|
588
|
+
write(vertical, next);
|
|
589
|
+
}
|
|
590
|
+
}, { passive: false });
|
|
591
|
+
return {
|
|
592
|
+
track,
|
|
593
|
+
thumb,
|
|
594
|
+
dispose() {
|
|
595
|
+
finish();
|
|
596
|
+
unbind();
|
|
597
|
+
track.remove();
|
|
598
|
+
}
|
|
599
|
+
};
|
|
600
|
+
};
|
|
601
|
+
const sync = () => {
|
|
602
|
+
if (disposed) {
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
window.cancelAnimationFrame(frame);
|
|
606
|
+
frame = 0;
|
|
607
|
+
const style = window.getComputedStyle(viewport);
|
|
608
|
+
rtl = style.direction === "rtl";
|
|
609
|
+
reverse = style.flexDirection === "column-reverse";
|
|
610
|
+
const visible = viewport.clientWidth > 0 && viewport.clientHeight > 0;
|
|
611
|
+
const vertical = visible && /^(auto|scroll)$/.test(style.overflowY) && extent(true) > 1;
|
|
612
|
+
const horizontal = visible && /^(auto|scroll)$/.test(style.overflowX) && extent(false) > 1;
|
|
613
|
+
if (textarea) {
|
|
614
|
+
syncTextareaScrollbar(textarea, layer, style);
|
|
615
|
+
} else {
|
|
616
|
+
layer.style.transform = `translate(${viewport.scrollLeft}px, ${viewport.scrollTop}px)`;
|
|
617
|
+
}
|
|
618
|
+
for (const axis of [
|
|
619
|
+
true,
|
|
620
|
+
false
|
|
621
|
+
]) {
|
|
622
|
+
if (!(axis ? vertical : horizontal)) {
|
|
623
|
+
const bar2 = bars.get(axis);
|
|
624
|
+
if (bar2) {
|
|
625
|
+
bar2.dispose();
|
|
626
|
+
bars.delete(axis);
|
|
627
|
+
}
|
|
628
|
+
continue;
|
|
629
|
+
}
|
|
630
|
+
let bar = bars.get(axis);
|
|
631
|
+
if (!bar) {
|
|
632
|
+
bar = create(axis);
|
|
633
|
+
bars.set(axis, bar);
|
|
634
|
+
}
|
|
635
|
+
const size = 10;
|
|
636
|
+
const width = axis ? size : viewport.clientWidth - (vertical ? size : 0);
|
|
637
|
+
const height = axis ? viewport.clientHeight - (horizontal ? size : 0) : size;
|
|
638
|
+
const length = axis ? height : width;
|
|
639
|
+
const view = axis ? viewport.clientHeight : viewport.clientWidth;
|
|
640
|
+
const thumb = Math.min(length, Math.max(24, length * view / (extent(axis) + view)));
|
|
641
|
+
Object.assign(bar.track.style, {
|
|
642
|
+
left: `${axis ? viewport.clientWidth - size : 0}px`,
|
|
643
|
+
top: `${axis ? 0 : viewport.clientHeight - size}px`,
|
|
644
|
+
width: `${width}px`,
|
|
645
|
+
height: `${height}px`
|
|
646
|
+
});
|
|
647
|
+
Object.assign(bar.thumb.style, axis ? {
|
|
648
|
+
height: `${thumb}px`,
|
|
649
|
+
transform: `translateY(${position(axis) / extent(axis) * (length - thumb)}px)`
|
|
650
|
+
} : {
|
|
651
|
+
width: `${thumb}px`,
|
|
652
|
+
transform: `translateX(${position(axis) / extent(axis) * (length - thumb)}px)`
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
};
|
|
656
|
+
const resize = new ResizeObserver(schedule);
|
|
657
|
+
const observeContents = () => {
|
|
658
|
+
const current = new Set(Array.from(host.children).filter((element) => {
|
|
659
|
+
return !element.classList.contains("gridui-scrollbar-layer");
|
|
660
|
+
}));
|
|
661
|
+
for (const content of contents) {
|
|
662
|
+
if (!current.has(content)) {
|
|
663
|
+
resize.unobserve(content);
|
|
664
|
+
contents.delete(content);
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
for (const content of current) {
|
|
668
|
+
if (!contents.has(content)) {
|
|
669
|
+
resize.observe(content);
|
|
670
|
+
contents.add(content);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
};
|
|
674
|
+
const mutation = new MutationObserver((records) => {
|
|
675
|
+
if (hasContentMutation(records)) {
|
|
676
|
+
observeContents();
|
|
677
|
+
schedule();
|
|
678
|
+
}
|
|
679
|
+
});
|
|
680
|
+
mutation.observe(host, {
|
|
681
|
+
subtree: true,
|
|
682
|
+
childList: true,
|
|
683
|
+
characterData: true,
|
|
684
|
+
attributes: true,
|
|
685
|
+
attributeFilter: [
|
|
686
|
+
"class",
|
|
687
|
+
"style",
|
|
688
|
+
"hidden",
|
|
689
|
+
"inert",
|
|
690
|
+
"aria-hidden",
|
|
691
|
+
"dir",
|
|
692
|
+
"data-state"
|
|
693
|
+
]
|
|
694
|
+
});
|
|
695
|
+
viewport.addEventListener("scroll", schedule, { passive: true });
|
|
696
|
+
viewport.addEventListener("input", schedule);
|
|
697
|
+
viewport.addEventListener("load", schedule, true);
|
|
698
|
+
resize.observe(viewport);
|
|
699
|
+
const reset = (event) => {
|
|
700
|
+
if (event.target === textarea?.form) {
|
|
701
|
+
schedule();
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
if (textarea) {
|
|
705
|
+
resize.observe(host);
|
|
706
|
+
document.addEventListener("reset", reset, true);
|
|
707
|
+
}
|
|
708
|
+
observeContents();
|
|
709
|
+
refresh.current = schedule;
|
|
710
|
+
sync();
|
|
711
|
+
return () => {
|
|
712
|
+
disposed = true;
|
|
713
|
+
refresh.current = void 0;
|
|
714
|
+
window.cancelAnimationFrame(frame);
|
|
715
|
+
for (const bar of bars.values()) {
|
|
716
|
+
bar.dispose();
|
|
717
|
+
}
|
|
718
|
+
resize.disconnect();
|
|
719
|
+
mutation.disconnect();
|
|
720
|
+
viewport.removeEventListener("scroll", schedule);
|
|
721
|
+
viewport.removeEventListener("input", schedule);
|
|
722
|
+
viewport.removeEventListener("load", schedule, true);
|
|
723
|
+
viewport.removeAttribute("data-gridui-scrollbar-owner");
|
|
724
|
+
viewport.removeAttribute("data-gridui-scrollbar-id");
|
|
725
|
+
if (textarea) {
|
|
726
|
+
document.removeEventListener("reset", reset, true);
|
|
727
|
+
}
|
|
728
|
+
layer.remove();
|
|
729
|
+
};
|
|
730
|
+
}, [
|
|
731
|
+
viewport,
|
|
732
|
+
owner
|
|
733
|
+
]);
|
|
734
|
+
useLayoutEffect2(() => {
|
|
735
|
+
refresh.current?.();
|
|
736
|
+
});
|
|
737
|
+
return useComposedRefs2(setViewport, ref);
|
|
738
|
+
};
|
|
56
739
|
export {
|
|
57
740
|
OverlayOpen,
|
|
58
741
|
RetainedLayer,
|
|
742
|
+
interactionLayerProps,
|
|
59
743
|
overlayBackdropStyles,
|
|
60
744
|
overlaySurfaceStyles,
|
|
61
|
-
|
|
745
|
+
scrollbarInteractionRef,
|
|
746
|
+
useInteractionOutline,
|
|
747
|
+
useOverlayState,
|
|
748
|
+
useScrollbars
|
|
62
749
|
};
|
|
63
750
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/retained-layer/retained-layer.tsx", "../src/shared/style.ts", "../src/shared/use-overlay-state.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * @author WMXPY\n * @package Overlay\n * @namespace RetainedLayer\n * @description Retained Layer\n */\n\nimport { Activity, createContext, type FC, type ReactNode, useContext } from \"react\";\n\nexport const OverlayOpen = createContext(false);\n\nexport type RetainedLayerProps = {\n readonly children: ReactNode;\n};\n\nexport const RetainedLayer: FC<RetainedLayerProps> = (props: RetainedLayerProps) => {\n const { children } = props;\n const open = useContext(OverlayOpen);\n return (<Activity\n mode={!open ? \"hidden\" : \"visible\"}\n >\n {children}\n </Activity>);\n};\n", "/**\n * @author WMXPY\n * @package Overlay\n * @namespace Shared\n * @description Style\n */\n\nimport { cva } from \"class-variance-authority\";\n\nexport const overlaySurfaceStyles = cva(\"gridui-overlay-surface border border-solid border-border bg-background text-foreground\", {\n variants: {\n kind: {\n popup: \"gridui-overlay-floating rounded-control\",\n tooltip: \"gridui-overlay-tooltip rounded-control\",\n dialog: \"gridui-overlay-dialog\",\n },\n },\n defaultVariants: { kind: \"popup\" },\n});\n\nexport const overlayBackdropStyles = cva(\"gridui-overlay-backdrop\", {\n variants: {\n pace: {\n normal: null,\n deliberate: \"gridui-overlay-backdrop-deliberate\",\n },\n },\n defaultVariants: { pace: \"normal\" },\n});\n", "/**\n * @author WMXPY\n * @package Overlay\n * @namespace Shared\n * @description Use Overlay State\n */\n\nimport { useState } from \"react\";\n\ntype OverlayStateOptions = {\n readonly open?: boolean | undefined;\n readonly defaultOpen?: boolean | undefined;\n readonly onOpenChange?: ((open: boolean) => void) | undefined;\n};\n\nexport const useOverlayState = (options: OverlayStateOptions) => {\n const [\n localOpen,\n setLocalOpen,\n ] = useState(options.defaultOpen ?? false);\n return {\n open: options.open ?? localOpen,\n onOpenChange: (open: boolean): void => {\n if (options.open === undefined) {\n setLocalOpen(open);\n }\n options.onOpenChange?.(open);\n },\n };\n};\n"],
|
|
5
|
-
"mappings": ";AAOA,SAAS,UAAU,eAAwC,kBAAkB;AAWjE;AATL,IAAM,cAAc,cAAc,KAAK;AAMvC,IAAM,gBAAwC,CAAC,UAA8B;AAChF,QAAM,EAAE,SAAS,IAAI;AACrB,QAAM,OAAO,WAAW,WAAW;AACnC,SAAQ;AAAA,IAAC;AAAA;AAAA,MACL,MAAM,CAAC,OAAO,WAAW;AAAA,MAExB;AAAA;AAAA,EACL;AACJ;;;AChBA,SAAS,WAAW;AAEb,IAAM,uBAAuB,IAAI,0FAA0F;AAAA,EAC9H,UAAU;AAAA,IACN,MAAM;AAAA,MACF,OAAO;AAAA,MACP,SAAS;AAAA,MACT,QAAQ;AAAA,IACZ;AAAA,EACJ;AAAA,EACA,iBAAiB,EAAE,MAAM,QAAQ;AACrC,CAAC;AAEM,IAAM,wBAAwB,IAAI,2BAA2B;AAAA,EAChE,UAAU;AAAA,IACN,MAAM;AAAA,MACF,QAAQ;AAAA,MACR,YAAY;AAAA,IAChB;AAAA,EACJ;AAAA,EACA,iBAAiB,EAAE,MAAM,SAAS;AACtC,CAAC;;;ACrBD,SAAS,gBAAgB;AAQlB,IAAM,kBAAkB,CAAC,YAAiC;AAC7D,QAAM;AAAA,IACF;AAAA,IACA;AAAA,EACJ,IAAI,SAAS,QAAQ,eAAe,KAAK;AACzC,SAAO;AAAA,IACH,MAAM,QAAQ,QAAQ;AAAA,IACtB,cAAc,CAAC,SAAwB;AACnC,UAAI,QAAQ,SAAS,QAAW;AAC5B,qBAAa,IAAI;AAAA,MACrB;AACA,cAAQ,eAAe,IAAI;AAAA,IAC/B;AAAA,EACJ;AACJ;",
|
|
6
|
-
"names": []
|
|
3
|
+
"sources": ["../src/retained-layer/retained-layer.tsx", "../src/shared/interaction-layer.ts", "../src/shared/scrollbar-interaction-ref.ts", "../src/shared/style.ts", "../src/shared/content-mutation.ts", "../src/shared/use-interaction-outline.ts", "../src/shared/use-overlay-state.ts", "../src/shared/textarea-scrollbar.ts", "../src/shared/use-scrollbars.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * @author WMXPY\n * @package Overlay\n * @namespace RetainedLayer\n * @description Retained Layer\n */\n\nimport { Activity, createContext, type FC, type ReactNode, useContext } from \"react\";\n\nexport const OverlayOpen = createContext(false);\n\nexport type RetainedLayerProps = {\n readonly children: ReactNode;\n};\n\nexport const RetainedLayer: FC<RetainedLayerProps> = (props: RetainedLayerProps) => {\n const { children } = props;\n const open = useContext(OverlayOpen);\n return (<Activity\n mode={!open ? \"hidden\" : \"visible\"}\n >\n {children}\n </Activity>);\n};\n", "/**\n * @author WMXPY\n * @package Overlay\n * @namespace Shared\n * @description Interaction Layer\n */\n\n/** Marks a popup or dialog surface as an independent interaction paint boundary. */\nexport const interactionLayerProps = { \"data-gridui-interaction-layer\": \"\" } as const;\n\nconst selector = \"[data-gridui-interaction-layer]\";\nconst planes = new WeakMap<HTMLElement, OutlinePlane>();\nconst planeElements = new WeakMap<Element, OutlinePlane>();\n\ntype OutlinePlane = {\n readonly owner: HTMLElement;\n readonly element: HTMLDivElement;\n readonly parent: OutlinePlane | undefined;\n references: number;\n};\n\nexport const interactionLayerOwner = (viewport: HTMLElement): HTMLElement => {\n return viewport.closest<HTMLElement>(selector) ?? viewport.ownerDocument.body;\n};\n\nexport const refreshOutlinePlane = (plane: OutlinePlane): void => {\n const { owner, element, parent } = plane;\n const document = owner.ownerDocument;\n const style = document.defaultView!.getComputedStyle(owner);\n element.style.zIndex = owner === document.body || style.zIndex === \"auto\"\n ? style.getPropertyValue(\"--gridui-z-interaction\") || \"3\"\n : style.zIndex;\n if (parent) {\n refreshOutlinePlane(parent);\n const next = Array.from(parent.element.children).find(child => {\n const sibling = planeElements.get(child);\n return sibling && sibling !== plane && Boolean(owner.compareDocumentPosition(sibling.owner) & Node.DOCUMENT_POSITION_FOLLOWING);\n });\n parent.element.insertBefore(element, next ?? null);\n } else if (owner === document.body) {\n if (!element.isConnected) {\n document.body.append(element);\n }\n } else {\n // Follow the source surface in paint order, including multiple surfaces in one portal container.\n let anchor = owner;\n while (anchor.parentElement && anchor.parentElement !== document.body) {\n anchor = anchor.parentElement;\n }\n let next = anchor.nextElementSibling;\n while (next) {\n const sibling = planeElements.get(next);\n if (!sibling || sibling === plane || !(sibling.owner.compareDocumentPosition(owner) & Node.DOCUMENT_POSITION_FOLLOWING)) {\n break;\n }\n next = next.nextElementSibling;\n }\n document.body.insertBefore(element, next);\n }\n};\n\nexport const acquireOutlinePlane = (owner: HTMLElement): OutlinePlane => {\n const existing = planes.get(owner);\n if (existing) {\n existing.references++;\n return existing;\n }\n const parentOwner = owner.parentElement?.closest<HTMLElement>(selector);\n const parent = parentOwner ? acquireOutlinePlane(parentOwner) : undefined;\n const element = owner.ownerDocument.createElement(\"div\");\n element.className = \"gridui-interaction-outline-layer\";\n element.setAttribute(\"aria-hidden\", \"true\");\n const plane: OutlinePlane = {\n owner,\n element,\n parent,\n references: 1,\n };\n planes.set(owner, plane);\n planeElements.set(element, plane);\n refreshOutlinePlane(plane);\n return plane;\n};\n\nexport const releaseOutlinePlane = (plane: OutlinePlane): void => {\n if (--plane.references) {\n return;\n }\n plane.element.remove();\n planes.delete(plane.owner);\n planeElements.delete(plane.element);\n if (plane.parent) {\n releaseOutlinePlane(plane.parent);\n }\n};\n", "/**\n * @author WMXPY\n * @package Overlay\n * @namespace Shared\n * @description Scrollbar Interaction Ref\n */\n\n/** Share pointer paint with native scrollbars and Radix without owning scrolling. */\nexport const scrollbarInteractionRef = (element: HTMLElement | null): (() => void) | undefined => {\n if (!element) {\n return;\n }\n const hover = (event: PointerEvent) => {\n const box = element.getBoundingClientRect();\n element.toggleAttribute(\"data-gridui-hovered\", event.clientX >= box.left && event.clientX < box.right\n && event.clientY >= box.top && event.clientY < box.bottom);\n };\n const leave = () => {\n element.removeAttribute(\"data-gridui-hovered\");\n };\n const down = (event: PointerEvent) => {\n if (event.button === 0) {\n element.setAttribute(\"data-gridui-dragging\", \"\");\n }\n };\n const finish = () => {\n element.removeAttribute(\"data-gridui-dragging\");\n };\n element.addEventListener(\"pointerenter\", hover);\n element.addEventListener(\"pointermove\", hover);\n element.addEventListener(\"pointerleave\", leave);\n element.addEventListener(\"pointerdown\", down);\n element.addEventListener(\"pointerup\", finish);\n element.addEventListener(\"pointercancel\", finish);\n element.addEventListener(\"lostpointercapture\", finish);\n return () => {\n element.removeEventListener(\"pointerenter\", hover);\n element.removeEventListener(\"pointermove\", hover);\n element.removeEventListener(\"pointerleave\", leave);\n element.removeEventListener(\"pointerdown\", down);\n element.removeEventListener(\"pointerup\", finish);\n element.removeEventListener(\"pointercancel\", finish);\n element.removeEventListener(\"lostpointercapture\", finish);\n leave();\n finish();\n };\n};\n", "/**\n * @author WMXPY\n * @package Overlay\n * @namespace Shared\n * @description Style\n */\n\nimport { cva } from \"class-variance-authority\";\n\nexport const overlaySurfaceStyles = cva(\"gridui-overlay-surface gridui-u-border gridui-u-border-solid gridui-u-border-border gridui-u-bg-background gridui-u-text-foreground\", {\n variants: {\n kind: {\n popup: \"gridui-overlay-floating gridui-u-rounded-control\",\n tooltip: \"gridui-overlay-tooltip gridui-u-rounded-control\",\n dialog: \"gridui-overlay-dialog\",\n },\n },\n defaultVariants: { kind: \"popup\" },\n});\n\nexport const overlayBackdropStyles = cva(\"gridui-overlay-backdrop\", {\n variants: {\n pace: {\n normal: null,\n deliberate: \"gridui-overlay-backdrop-deliberate\",\n },\n },\n defaultVariants: { pace: \"normal\" },\n});\n", "/**\n * @author WMXPY\n * @package Overlay\n * @namespace Shared\n * @description Content Mutation\n */\n\nconst decorativeSelector = \".gridui-scrollbar-layer, .gridui-interaction-outline-layer\";\n\nconst isDecorative = (node: Node): boolean => {\n const element = node.nodeType === 1 ? node as Element : node.parentElement;\n return !!element?.closest(decorativeSelector);\n};\n\n/** Ignore owned indicator paint while retaining mutations of the real content. */\nexport const hasContentMutation = (records: readonly MutationRecord[]): boolean => {\n return records.some(record => {\n return !isDecorative(record.target) && (record.type !== \"childList\"\n || [\n ...record.addedNodes,\n ...record.removedNodes,\n ].some(node => {\n return !isDecorative(node);\n }));\n });\n};\n", "/**\n * @author WMXPY\n * @package Overlay\n * @namespace Shared\n * @description Use Interaction Outline\n */\n\nimport { hasContentMutation } from \"./content-mutation\";\nimport { acquireOutlinePlane, interactionLayerOwner, refreshOutlinePlane, releaseOutlinePlane } from \"./interaction-layer\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { type Ref, type RefCallback, useLayoutEffect, useState } from \"react\";\n\nexport type InteractionOutlineOptions<T extends HTMLElement> = {\n readonly ref?: Ref<T> | undefined;\n readonly selector: string;\n};\n\n/** Mirror Theme's resolved outline outside a scrolling viewport's clipping ancestors. */\nexport const useInteractionOutline = <T extends HTMLElement>(options: InteractionOutlineOptions<T>): RefCallback<T> => {\n const { ref, selector } = options;\n const [\n viewport,\n setViewport,\n ] = useState<T | null>(null);\n useLayoutEffect(() => {\n if (!viewport) {\n return;\n }\n const document = viewport.ownerDocument;\n const window = document.defaultView!;\n let plane: ReturnType<typeof acquireOutlinePlane> | undefined;\n viewport.setAttribute(\"data-gridui-outline-viewport\", \"\");\n const rings = new Map<HTMLElement, HTMLDivElement>();\n let frame = 0;\n let disposed = false;\n const schedule = () => {\n if (!disposed && !frame) {\n frame = window.requestAnimationFrame(sync);\n }\n };\n const resize = new ResizeObserver(schedule);\n const sync = () => {\n frame = 0;\n for (const element of rings.keys()) {\n element.removeAttribute(\"data-gridui-outline-rendered\");\n }\n const owner = interactionLayerOwner(viewport);\n if (plane && plane.owner !== owner) {\n const previous = plane;\n plane = acquireOutlinePlane(owner);\n plane.element.append(...rings.values());\n releaseOutlinePlane(previous);\n }\n if (plane) {\n refreshOutlinePlane(plane);\n }\n const inactive = viewport.closest('[inert], [aria-hidden=\"true\"]');\n viewport.toggleAttribute(\"data-gridui-outline-inactive\", !!inactive);\n const candidates = inactive ? [] : Array.from(viewport.querySelectorAll<HTMLElement>(selector)).filter(element => {\n return element.closest(\"[data-gridui-outline-viewport]\") === viewport\n && element.matches(\":hover, :active, :focus-visible, [data-highlighted]\");\n });\n const current = new Set<HTMLElement>();\n let moving = false;\n for (const element of candidates) {\n const box = element.getBoundingClientRect();\n const style = window.getComputedStyle(element);\n if (!element.getClientRects().length || style.visibility !== \"visible\"\n || style.outlineStyle === \"none\" || parseFloat(style.outlineWidth) <= 0) {\n continue;\n }\n let left = 0;\n let top = 0;\n let right = document.documentElement.clientWidth;\n let bottom = document.documentElement.clientHeight;\n let opacity = Number(style.opacity);\n let clipped = false;\n for (let ancestor = element.parentElement; ancestor; ancestor = ancestor.parentElement) {\n const appearance = window.getComputedStyle(ancestor);\n const bounds = ancestor.getBoundingClientRect();\n opacity *= Number(appearance.opacity);\n moving ||= ancestor.getAnimations().some(animation => {\n return animation.playState === \"running\";\n });\n if (appearance.overflowX !== \"visible\") {\n clipped = true;\n left = Math.max(left, bounds.left + ancestor.clientLeft);\n right = Math.min(right, bounds.left + ancestor.clientLeft + ancestor.clientWidth);\n }\n if (appearance.overflowY !== \"visible\") {\n clipped = true;\n top = Math.max(top, bounds.top + ancestor.clientTop);\n bottom = Math.min(bottom, bounds.top + ancestor.clientTop + ancestor.clientHeight);\n }\n }\n if (!clipped || opacity === 0 || box.right <= left || box.left >= right || box.bottom <= top || box.top >= bottom) {\n continue;\n }\n current.add(element);\n let ring = rings.get(element);\n if (!ring) {\n ring = document.createElement(\"div\");\n ring.className = \"gridui-interaction-outline\";\n plane ??= acquireOutlinePlane(owner);\n plane.element.append(ring);\n rings.set(element, ring);\n resize.observe(element);\n }\n const extent = Math.max(0, parseFloat(style.outlineWidth) + parseFloat(style.outlineOffset));\n Object.assign(ring.style, {\n left: `${box.left}px`,\n top: `${box.top}px`,\n width: `${box.width}px`,\n height: `${box.height}px`,\n outline: style.outline,\n outlineOffset: style.outlineOffset,\n borderRadius: style.borderRadius,\n opacity: String(opacity),\n zIndex: element.matches(\":focus-visible\") ? \"3\" : \"2\",\n clipPath: `inset(${Math.max(0, top - box.top) - extent}px ${Math.max(0, box.right - right) - extent}px ${Math.max(0, box.bottom - bottom) - extent}px ${Math.max(0, left - box.left) - extent}px)`,\n });\n element.setAttribute(\"data-gridui-outline-rendered\", \"\");\n }\n for (const [\n element,\n ring,\n ] of rings) {\n if (!current.has(element)) {\n element.removeAttribute(\"data-gridui-outline-rendered\");\n ring.remove();\n rings.delete(element);\n resize.unobserve(element);\n }\n }\n if (!rings.size && plane) {\n releaseOutlinePlane(plane);\n plane = undefined;\n }\n if (moving) {\n schedule();\n }\n };\n const mutation = new MutationObserver(records => {\n if (hasContentMutation(records)) {\n schedule();\n }\n });\n mutation.observe(viewport, {\n subtree: true,\n childList: true,\n characterData: true,\n attributes: true,\n attributeFilter: [\n \"class\",\n \"style\",\n \"hidden\",\n \"disabled\",\n \"aria-disabled\",\n \"aria-readonly\",\n \"readonly\",\n \"data-disabled\",\n \"data-readonly\",\n \"data-state\",\n \"data-highlighted\",\n \"aria-selected\",\n ],\n });\n const ancestors = new MutationObserver(schedule);\n for (let ancestor: HTMLElement | null = viewport; ancestor; ancestor = ancestor.parentElement) {\n ancestors.observe(ancestor, {\n attributes: true,\n attributeFilter: [\n \"class\",\n \"style\",\n \"hidden\",\n \"dir\",\n \"data-theme\",\n \"data-state\",\n \"data-gridui-interaction-layer\",\n \"aria-hidden\",\n \"inert\",\n ],\n });\n }\n const events = [\n \"scroll\",\n \"pointerover\",\n \"pointerout\",\n \"pointerdown\",\n \"pointerup\",\n \"pointercancel\",\n \"focusin\",\n \"focusout\",\n \"keydown\",\n \"keyup\",\n \"animationstart\",\n \"transitionrun\",\n ];\n for (const event of events) {\n document.addEventListener(event, schedule, {\n capture: true,\n passive: true,\n });\n }\n const scheme = window.matchMedia(\"(prefers-color-scheme: dark)\");\n scheme.addEventListener(\"change\", schedule);\n window.addEventListener(\"resize\", schedule);\n resize.observe(viewport);\n sync();\n return () => {\n disposed = true;\n window.cancelAnimationFrame(frame);\n resize.disconnect();\n mutation.disconnect();\n ancestors.disconnect();\n for (const event of events) {\n document.removeEventListener(event, schedule, true);\n }\n scheme.removeEventListener(\"change\", schedule);\n window.removeEventListener(\"resize\", schedule);\n viewport.removeAttribute(\"data-gridui-outline-viewport\");\n viewport.removeAttribute(\"data-gridui-outline-inactive\");\n for (const element of rings.keys()) {\n element.removeAttribute(\"data-gridui-outline-rendered\");\n }\n for (const ring of rings.values()) {\n ring.remove();\n }\n if (plane) {\n releaseOutlinePlane(plane);\n }\n };\n }, [\n viewport,\n selector,\n ]);\n return useComposedRefs(setViewport, ref);\n};\n", "/**\n * @author WMXPY\n * @package Overlay\n * @namespace Shared\n * @description Use Overlay State\n */\n\nimport { useState } from \"react\";\n\ntype OverlayStateOptions = {\n readonly open?: boolean | undefined;\n readonly defaultOpen?: boolean | undefined;\n readonly onOpenChange?: ((open: boolean) => void) | undefined;\n};\n\nexport const useOverlayState = (options: OverlayStateOptions) => {\n const [\n localOpen,\n setLocalOpen,\n ] = useState(options.defaultOpen ?? false);\n return {\n open: options.open ?? localOpen,\n onOpenChange: (open: boolean): void => {\n if (options.open === undefined) {\n setLocalOpen(open);\n }\n options.onOpenChange?.(open);\n },\n };\n};\n", "/**\n * @author WMXPY\n * @package Overlay\n * @namespace Shared\n * @description Textarea Scrollbar\n */\n\nexport const isTextarea = (element: HTMLElement): element is HTMLTextAreaElement => {\n return element.tagName === \"TEXTAREA\";\n};\n\n/** Position a sibling indicator in its actual containing block without changing it. */\nexport const syncTextareaScrollbar = (viewport: HTMLTextAreaElement, layer: HTMLElement, style: CSSStyleDeclaration): void => {\n const window = viewport.ownerDocument.defaultView!;\n layer.style.position = style.position === \"fixed\" ? \"fixed\" : \"absolute\";\n const parent = layer.offsetParent as HTMLElement | null;\n const parentBox = parent?.getBoundingClientRect();\n const parentScaleX = parent?.offsetWidth ? parentBox!.width / parent.offsetWidth : 1;\n const parentScaleY = parent?.offsetHeight ? parentBox!.height / parent.offsetHeight : 1;\n const box = viewport.getBoundingClientRect();\n const controlScaleX = viewport.offsetWidth ? box.width / viewport.offsetWidth : 1;\n const controlScaleY = viewport.offsetHeight ? box.height / viewport.offsetHeight : 1;\n const current = layer.getBoundingClientRect();\n const left = (parseFloat(layer.style.left) || 0)\n + (box.left + viewport.clientLeft * controlScaleX - current.left) / parentScaleX;\n const top = (parseFloat(layer.style.top) || 0)\n + (box.top + viewport.clientTop * controlScaleY - current.top) / parentScaleY;\n Object.assign(layer.style, {\n left: `${left}px`,\n top: `${top}px`,\n transform: `scale(${controlScaleX / parentScaleX}, ${controlScaleY / parentScaleY})`,\n transformOrigin: \"0 0\",\n zIndex: style.zIndex === \"auto\" ? \"var(--gridui-z-interaction)\" : style.zIndex,\n opacity: style.opacity,\n visibility: style.visibility,\n colorScheme: style.colorScheme,\n });\n layer.inert = viewport.inert;\n const inherited = window.getComputedStyle(viewport.parentElement!);\n for (const [\n token,\n fallback,\n ] of [\n [\n \"--gridui-scrollbar-thumb\",\n \"--gridui-muted\",\n ],\n [\n \"--gridui-scrollbar-thumb-active\",\n \"--gridui-foreground\",\n ],\n [\n \"--gridui-scrollbar-track\",\n \"--gridui-scrollbar-track\",\n ],\n ] as const) {\n const value = style.getPropertyValue(token) || style.getPropertyValue(fallback);\n const parentValue = inherited.getPropertyValue(token) || inherited.getPropertyValue(fallback);\n if (value && value !== parentValue) {\n layer.style.setProperty(token, value);\n } else {\n layer.style.removeProperty(token);\n }\n }\n};\n", "/**\n * @author WMXPY\n * @package Overlay\n * @namespace Shared\n * @description Use Scrollbars\n */\n\nimport { hasContentMutation } from \"./content-mutation\";\nimport { scrollbarInteractionRef } from \"./scrollbar-interaction-ref\";\nimport { isTextarea, syncTextareaScrollbar } from \"./textarea-scrollbar\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { type Ref, type RefCallback, useId, useLayoutEffect, useRef, useState } from \"react\";\n\nexport type ScrollbarsOptions<T extends HTMLElement> = {\n readonly ref?: Ref<T> | undefined;\n};\n\ntype Scrollbar = {\n readonly track: HTMLElement;\n readonly thumb: HTMLElement;\n readonly dispose: () => void;\n};\n\n/** Attach square scrollbars to one native viewport, within its local DOM owner. */\nexport const useScrollbars = <T extends HTMLElement>(options: ScrollbarsOptions<T> = {}): RefCallback<T> => {\n const { ref } = options;\n const owner = useId();\n const [\n viewport,\n setViewport,\n ] = useState<T | null>(null);\n const refresh = useRef<(() => void) | undefined>(undefined);\n useLayoutEffect(() => {\n if (!viewport) {\n return;\n }\n const document = viewport.ownerDocument;\n const window = document.defaultView!;\n // Textarea cannot render descendants. Its indicator is a local sibling.\n const textarea = isTextarea(viewport) ? viewport : null;\n const host = textarea ? viewport.parentElement! : viewport;\n const layer = document.createElement(viewport.matches(\"ol, ul\") ? \"li\" : \"span\");\n layer.className = \"gridui-scrollbar-layer\";\n layer.setAttribute(\"aria-hidden\", \"true\");\n host.append(layer);\n viewport.setAttribute(\"data-gridui-scrollbar-owner\", owner);\n viewport.setAttribute(\"data-gridui-scrollbar-id\", owner);\n const bars = new Map<boolean, Scrollbar>();\n const contents = new Set<Element>();\n let frame = 0;\n let disposed = false;\n let rtl = false;\n let reverse = false;\n const schedule = () => {\n if (!disposed && !frame) {\n frame = window.requestAnimationFrame(sync);\n }\n };\n const extent = (vertical: boolean): number => {\n return vertical ? viewport.scrollHeight - viewport.clientHeight : viewport.scrollWidth - viewport.clientWidth;\n };\n const position = (vertical: boolean): number => {\n const value = vertical ? viewport.scrollTop : viewport.scrollLeft;\n return (vertical ? reverse : rtl) ? extent(vertical) + value : value;\n };\n const write = (vertical: boolean, value: number) => {\n if (viewport.inert) {\n return;\n }\n const next = Math.max(0, Math.min(extent(vertical), value));\n const native = (vertical ? reverse : rtl) ? next - extent(vertical) : next;\n if (vertical) {\n viewport.scrollTop = native;\n } else {\n viewport.scrollLeft = native;\n }\n sync();\n };\n const create = (vertical: boolean): Scrollbar => {\n const track = document.createElement(\"span\");\n const thumb = document.createElement(\"span\");\n track.className = \"gridui-scrollbar\";\n thumb.className = \"gridui-scrollbar-thumb\";\n track.dataset.orientation = vertical ? \"vertical\" : \"horizontal\";\n track.setAttribute(\"data-gridui-scrollbar-for\", owner);\n track.append(thumb);\n layer.append(track);\n const unbind = scrollbarInteractionRef(track)!;\n const length = () => {\n return vertical ? track.clientHeight : track.clientWidth;\n };\n const thumbLength = () => {\n return vertical ? thumb.clientHeight : thumb.clientWidth;\n };\n const coordinate = (event: PointerEvent) => {\n const box = track.getBoundingClientRect();\n const scale = (vertical ? box.height : box.width) / length();\n return (vertical ? event.clientY - box.top : event.clientX - box.left) / scale;\n };\n let drag: {\n readonly pointerId: number;\n readonly grab: number;\n } | undefined;\n const finish = () => {\n drag = undefined;\n };\n track.addEventListener(\"pointerdown\", event => {\n if (event.button !== 0) {\n return;\n }\n event.preventDefault();\n const max = extent(vertical);\n const offset = max ? position(vertical) / max * (length() - thumbLength()) : 0;\n const cursor = coordinate(event);\n drag = {\n pointerId: event.pointerId,\n grab: event.target === thumb ? cursor - offset : thumbLength() / 2,\n };\n track.setPointerCapture(event.pointerId);\n write(vertical, (cursor - drag.grab) / Math.max(1, length() - thumbLength()) * max);\n });\n track.addEventListener(\"pointermove\", event => {\n if (drag?.pointerId === event.pointerId) {\n write(vertical, (coordinate(event) - drag.grab) / Math.max(1, length() - thumbLength()) * extent(vertical));\n }\n });\n track.addEventListener(\"pointerup\", finish);\n track.addEventListener(\"pointercancel\", finish);\n track.addEventListener(\"lostpointercapture\", finish);\n track.addEventListener(\"click\", event => {\n event.preventDefault();\n event.stopPropagation();\n });\n track.addEventListener(\"wheel\", event => {\n if (event.ctrlKey) {\n return;\n }\n const style = window.getComputedStyle(viewport);\n let unit = 1;\n if (event.deltaMode === 1) {\n unit = parseFloat(style.lineHeight) || 16;\n } else if (event.deltaMode === 2) {\n unit = vertical ? viewport.clientHeight : viewport.clientWidth;\n }\n const next = Math.max(0, Math.min(extent(vertical), position(vertical) + (vertical ? event.deltaY : event.deltaX || event.deltaY) * unit));\n if (next !== position(vertical)) {\n event.preventDefault();\n write(vertical, next);\n }\n }, { passive: false });\n return {\n track,\n thumb,\n dispose() {\n finish();\n unbind();\n track.remove();\n },\n };\n };\n const sync = () => {\n if (disposed) {\n return;\n }\n window.cancelAnimationFrame(frame);\n frame = 0;\n const style = window.getComputedStyle(viewport);\n rtl = style.direction === \"rtl\";\n reverse = style.flexDirection === \"column-reverse\";\n const visible = viewport.clientWidth > 0 && viewport.clientHeight > 0;\n const vertical = visible && /^(auto|scroll)$/.test(style.overflowY) && extent(true) > 1;\n const horizontal = visible && /^(auto|scroll)$/.test(style.overflowX) && extent(false) > 1;\n if (textarea) {\n syncTextareaScrollbar(textarea, layer, style);\n } else {\n // Compensate native content scrolling inside the viewport's own clip and layer.\n layer.style.transform = `translate(${viewport.scrollLeft}px, ${viewport.scrollTop}px)`;\n }\n for (const axis of [\n true,\n false,\n ]) {\n if (!(axis ? vertical : horizontal)) {\n const bar = bars.get(axis);\n if (bar) {\n bar.dispose();\n bars.delete(axis);\n }\n continue;\n }\n let bar = bars.get(axis);\n if (!bar) {\n bar = create(axis);\n bars.set(axis, bar);\n }\n const size = 10;\n const width = axis ? size : viewport.clientWidth - (vertical ? size : 0);\n const height = axis ? viewport.clientHeight - (horizontal ? size : 0) : size;\n const length = axis ? height : width;\n const view = axis ? viewport.clientHeight : viewport.clientWidth;\n const thumb = Math.min(length, Math.max(24, length * view / (extent(axis) + view)));\n Object.assign(bar.track.style, {\n left: `${axis ? viewport.clientWidth - size : 0}px`,\n top: `${axis ? 0 : viewport.clientHeight - size}px`,\n width: `${width}px`,\n height: `${height}px`,\n });\n Object.assign(bar.thumb.style, axis\n ? {\n height: `${thumb}px`,\n transform: `translateY(${position(axis) / extent(axis) * (length - thumb)}px)`,\n }\n : {\n width: `${thumb}px`,\n transform: `translateX(${position(axis) / extent(axis) * (length - thumb)}px)`,\n });\n }\n };\n const resize = new ResizeObserver(schedule);\n const observeContents = () => {\n const current = new Set(Array.from(host.children).filter(element => {\n return !element.classList.contains(\"gridui-scrollbar-layer\");\n }));\n for (const content of contents) {\n if (!current.has(content)) {\n resize.unobserve(content);\n contents.delete(content);\n }\n }\n for (const content of current) {\n if (!contents.has(content)) {\n resize.observe(content);\n contents.add(content);\n }\n }\n };\n const mutation = new MutationObserver(records => {\n if (hasContentMutation(records)) {\n observeContents();\n schedule();\n }\n });\n mutation.observe(host, {\n subtree: true,\n childList: true,\n characterData: true,\n attributes: true,\n attributeFilter: [\n \"class\",\n \"style\",\n \"hidden\",\n \"inert\",\n \"aria-hidden\",\n \"dir\",\n \"data-state\",\n ],\n });\n viewport.addEventListener(\"scroll\", schedule, { passive: true });\n viewport.addEventListener(\"input\", schedule);\n viewport.addEventListener(\"load\", schedule, true);\n resize.observe(viewport);\n const reset = (event: Event) => {\n if (event.target === textarea?.form) {\n schedule();\n }\n };\n if (textarea) {\n resize.observe(host);\n document.addEventListener(\"reset\", reset, true);\n }\n observeContents();\n refresh.current = schedule;\n sync();\n return () => {\n disposed = true;\n refresh.current = undefined;\n window.cancelAnimationFrame(frame);\n for (const bar of bars.values()) { bar.dispose(); }\n resize.disconnect();\n mutation.disconnect();\n viewport.removeEventListener(\"scroll\", schedule);\n viewport.removeEventListener(\"input\", schedule);\n viewport.removeEventListener(\"load\", schedule, true);\n viewport.removeAttribute(\"data-gridui-scrollbar-owner\");\n viewport.removeAttribute(\"data-gridui-scrollbar-id\");\n if (textarea) {\n document.removeEventListener(\"reset\", reset, true);\n }\n layer.remove();\n };\n }, [\n viewport,\n owner,\n ]);\n useLayoutEffect(() => {\n refresh.current?.();\n });\n return useComposedRefs(setViewport, ref);\n};\n"],
|
|
5
|
+
"mappings": ";AAOA,SAAS,UAAU,eAAwC,kBAAkB;AAWjE;AATL,IAAM,cAAc,cAAc,KAAK;AAMvC,IAAM,gBAAwC,CAAC,UAA8B;AAChF,QAAM,EAAE,SAAS,IAAI;AACrB,QAAM,OAAO,WAAW,WAAW;AACnC,SAAQ;AAAA,IAAC;AAAA;AAAA,MACL,MAAM,CAAC,OAAO,WAAW;AAAA,MAExB;AAAA;AAAA,EACL;AACJ;;;ACfO,IAAM,wBAAwB,EAAE,iCAAiC,GAAG;AAE3E,IAAM,WAAW;AACjB,IAAM,SAAS,oBAAI,QAAmC;AACtD,IAAM,gBAAgB,oBAAI,QAA+B;AASlD,IAAM,wBAAwB,CAAC,aAAuC;AACzE,SAAO,SAAS,QAAqB,QAAQ,KAAK,SAAS,cAAc;AAC7E;AAEO,IAAM,sBAAsB,CAAC,UAA8B;AAC9D,QAAM,EAAE,OAAO,SAAS,OAAO,IAAI;AACnC,QAAM,WAAW,MAAM;AACvB,QAAM,QAAQ,SAAS,YAAa,iBAAiB,KAAK;AAC1D,UAAQ,MAAM,SAAS,UAAU,SAAS,QAAQ,MAAM,WAAW,SAC7D,MA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AAAA,IACJ,CAAC;AACD,aAAS,iBAAiB,UAAU,UAAU,EAAE,SAAS,KAAK,CAAC;AAC/D,aAAS,iBAAiB,SAAS,QAAQ;AAC3C,aAAS,iBAAiB,QAAQ,UAAU,IAAI;AAChD,WAAO,QAAQ,QAAQ;AACvB,UAAM,QAAQ,CAAC,UAAiB;AAC5B,UAAI,MAAM,WAAW,UAAU,MAAM;AACjC,iBAAS;AAAA,MACb;AAAA,IACJ;AACA,QAAI,UAAU;AACV,aAAO,QAAQ,IAAI;AACnB,eAAS,iBAAiB,SAAS,OAAO,IAAI;AAAA,IAClD;AACA,oBAAgB;AAChB,YAAQ,UAAU;AAClB,SAAK;AACL,WAAO,MAAM;AACT,iBAAW;AACX,cAAQ,UAAU;AAClB,aAAO,qBAAqB,KAAK;AACjC,iBAAW,OAAO,KAAK,OAAO,GAAG;AAAE,YAAI,QAAQ;AAAA,MAAG;AAClD,aAAO,WAAW;AAClB,eAAS,WAAW;AACpB,eAAS,oBAAoB,UAAU,QAAQ;AAC/C,eAAS,oBAAoB,SAAS,QAAQ;AAC9C,eAAS,oBAAoB,QAAQ,UAAU,IAAI;AACnD,eAAS,gBAAgB,6BAA6B;AACtD,eAAS,gBAAgB,0BAA0B;AACnD,UAAI,UAAU;AACV,iBAAS,oBAAoB,SAAS,OAAO,IAAI;AAAA,MACrD;AACA,YAAM,OAAO;AAAA,IACjB;AAAA,EACJ,GAAG;AAAA,IACC;AAAA,IACA;AAAA,EACJ,CAAC;AACD,EAAAF,iBAAgB,MAAM;AAClB,YAAQ,UAAU;AAAA,EACtB,CAAC;AACD,SAAOD,iBAAgB,aAAa,GAAG;AAC3C;",
|
|
6
|
+
"names": ["selector", "useState", "useComposedRefs", "useLayoutEffect", "useState", "bar"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Overlay
|
|
4
|
+
* @namespace Shared
|
|
5
|
+
* @description Content Mutation
|
|
6
|
+
*/
|
|
7
|
+
/** Ignore owned indicator paint while retaining mutations of the real content. */
|
|
8
|
+
export declare const hasContentMutation: (records: readonly MutationRecord[]) => boolean;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Overlay
|
|
4
|
+
* @namespace Shared
|
|
5
|
+
* @description Interaction Layer
|
|
6
|
+
*/
|
|
7
|
+
/** Marks a popup or dialog surface as an independent interaction paint boundary. */
|
|
8
|
+
export declare const interactionLayerProps: {
|
|
9
|
+
readonly "data-gridui-interaction-layer": "";
|
|
10
|
+
};
|
|
11
|
+
type OutlinePlane = {
|
|
12
|
+
readonly owner: HTMLElement;
|
|
13
|
+
readonly element: HTMLDivElement;
|
|
14
|
+
readonly parent: OutlinePlane | undefined;
|
|
15
|
+
references: number;
|
|
16
|
+
};
|
|
17
|
+
export declare const interactionLayerOwner: (viewport: HTMLElement) => HTMLElement;
|
|
18
|
+
export declare const refreshOutlinePlane: (plane: OutlinePlane) => void;
|
|
19
|
+
export declare const acquireOutlinePlane: (owner: HTMLElement) => OutlinePlane;
|
|
20
|
+
export declare const releaseOutlinePlane: (plane: OutlinePlane) => void;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Overlay
|
|
4
|
+
* @namespace Shared
|
|
5
|
+
* @description Scrollbar Interaction Ref
|
|
6
|
+
*/
|
|
7
|
+
/** Share pointer paint with native scrollbars and Radix without owning scrolling. */
|
|
8
|
+
export declare const scrollbarInteractionRef: (element: HTMLElement | null) => (() => void) | undefined;
|
package/dist/shared/style.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @description Style
|
|
6
6
|
*/
|
|
7
7
|
export declare const overlaySurfaceStyles: (props?: ({
|
|
8
|
-
kind?: "
|
|
8
|
+
kind?: "dialog" | "popup" | "tooltip" | null | undefined;
|
|
9
9
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
10
|
export declare const overlayBackdropStyles: (props?: ({
|
|
11
11
|
pace?: "normal" | "deliberate" | null | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Overlay
|
|
4
|
+
* @namespace Shared
|
|
5
|
+
* @description Textarea Scrollbar
|
|
6
|
+
*/
|
|
7
|
+
export declare const isTextarea: (element: HTMLElement) => element is HTMLTextAreaElement;
|
|
8
|
+
/** Position a sibling indicator in its actual containing block without changing it. */
|
|
9
|
+
export declare const syncTextareaScrollbar: (viewport: HTMLTextAreaElement, layer: HTMLElement, style: CSSStyleDeclaration) => void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Overlay
|
|
4
|
+
* @namespace Shared
|
|
5
|
+
* @description Use Interaction Outline
|
|
6
|
+
*/
|
|
7
|
+
import { type Ref, type RefCallback } from "react";
|
|
8
|
+
export type InteractionOutlineOptions<T extends HTMLElement> = {
|
|
9
|
+
readonly ref?: Ref<T> | undefined;
|
|
10
|
+
readonly selector: string;
|
|
11
|
+
};
|
|
12
|
+
/** Mirror Theme's resolved outline outside a scrolling viewport's clipping ancestors. */
|
|
13
|
+
export declare const useInteractionOutline: <T extends HTMLElement>(options: InteractionOutlineOptions<T>) => RefCallback<T>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Overlay
|
|
4
|
+
* @namespace Shared
|
|
5
|
+
* @description Use Scrollbars
|
|
6
|
+
*/
|
|
7
|
+
import { type Ref, type RefCallback } from "react";
|
|
8
|
+
export type ScrollbarsOptions<T extends HTMLElement> = {
|
|
9
|
+
readonly ref?: Ref<T> | undefined;
|
|
10
|
+
};
|
|
11
|
+
/** Attach square scrollbars to one native viewport, within its local DOM owner. */
|
|
12
|
+
export declare const useScrollbars: <T extends HTMLElement>(options?: ScrollbarsOptions<T>) => RefCallback<T>;
|
package/dist/styles.css
CHANGED
|
@@ -1,31 +1,25 @@
|
|
|
1
|
-
/*! tailwindcss v4.3.
|
|
1
|
+
/*! tailwindcss v4.3.4 | MIT License | https://tailwindcss.com */
|
|
2
2
|
@layer properties;
|
|
3
3
|
@layer theme, base, components, utilities;
|
|
4
4
|
@layer utilities {
|
|
5
|
-
.
|
|
6
|
-
visibility: visible;
|
|
7
|
-
}
|
|
8
|
-
.hidden {
|
|
9
|
-
display: none;
|
|
10
|
-
}
|
|
11
|
-
.rounded-control {
|
|
5
|
+
.gridui-u-rounded-control {
|
|
12
6
|
border-radius: var(--gridui-control-radius);
|
|
13
7
|
}
|
|
14
|
-
.border {
|
|
8
|
+
.gridui-u-border {
|
|
15
9
|
border-style: var(--tw-border-style);
|
|
16
10
|
border-width: 1px;
|
|
17
11
|
}
|
|
18
|
-
.border-solid {
|
|
12
|
+
.gridui-u-border-solid {
|
|
19
13
|
--tw-border-style: solid;
|
|
20
14
|
border-style: solid;
|
|
21
15
|
}
|
|
22
|
-
.border-border {
|
|
16
|
+
.gridui-u-border-border {
|
|
23
17
|
border-color: var(--gridui-border);
|
|
24
18
|
}
|
|
25
|
-
.bg-background {
|
|
19
|
+
.gridui-u-bg-background {
|
|
26
20
|
background-color: var(--gridui-background);
|
|
27
21
|
}
|
|
28
|
-
.text-foreground {
|
|
22
|
+
.gridui-u-text-foreground {
|
|
29
23
|
color: var(--gridui-foreground);
|
|
30
24
|
}
|
|
31
25
|
}
|
|
@@ -93,7 +87,7 @@
|
|
|
93
87
|
initial-value: solid;
|
|
94
88
|
}
|
|
95
89
|
@layer properties {
|
|
96
|
-
@supports ((-webkit-hyphens: none) and (not (margin-trim:
|
|
90
|
+
@supports ((-webkit-hyphens: none) and (not (margin-trim: block))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
|
97
91
|
*, ::before, ::after, ::backdrop {
|
|
98
92
|
--tw-border-style: solid;
|
|
99
93
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridui/overlay",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "GridUI React overlay",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"react-dom": "^19.2.0"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@gridui/theme": "^2.
|
|
29
|
+
"@gridui/theme": "^2.5.1",
|
|
30
|
+
"@radix-ui/react-compose-refs": "1.1.5",
|
|
30
31
|
"class-variance-authority": "0.7.1"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
@@ -43,8 +44,6 @@
|
|
|
43
44
|
},
|
|
44
45
|
"scripts": {
|
|
45
46
|
"build": "node ../../scripts/compilation/package.ts",
|
|
46
|
-
"compile": "tsc --project tsconfig.json"
|
|
47
|
-
"test": "jest --passWithNoTests",
|
|
48
|
-
"coverage": "jest --coverage --passWithNoTests"
|
|
47
|
+
"compile": "tsc --project tsconfig.json"
|
|
49
48
|
}
|
|
50
49
|
}
|