@gridui/overlay 1.2.2 → 2.1.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @gridui/overlay
2
2
 
3
- Core family. Public API: `interactionLayerProps`, `useInteractionOutline`, `InteractionOutlineOptions`, `useScrollbars`, `ScrollbarsOptions`, `scrollbarInteractionRef`, `OverlayOpen`, `RetainedLayer`, `RetainedLayerProps`, `useOverlayState`, `overlaySurfaceStyles`, `overlayBackdropStyles`.
3
+ Core family. Public API: `ExitSnapshot`, `ExitSnapshotProps`, `interactionLayerProps`, `useInteractionOutline`, `InteractionOutlineOptions`, `useScrollbars`, `ScrollbarsOptions`, `scrollbarInteractionRef`, `OverlayOpen`, `RetainedLayer`, `RetainedLayerProps`, `useOverlayState`, `overlaySurfaceStyles`, `overlayListStyles`, `overlayListItemStyles`, `overlayListLabelStyles`, `overlayListIndicatorStyles`, `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.
@@ -14,6 +14,18 @@ reduced-motion behavior. `kind` is `popup` (default), `tooltip`, or `dialog`.
14
14
  `overlayBackdropStyles({ pace })` shares backdrop fades at `normal` (default)
15
15
  or `deliberate` pace. Load this stylesheet before the consuming family.
16
16
 
17
+ `overlayListStyles()` adds the shared popup-list stacking level, data typography,
18
+ and zero surface padding to the popup surface. Dropdown menus and selection
19
+ popups use it while retaining their own width, scrolling, and positioning rules.
20
+ `overlayListItemStyles()` owns row spacing, text wrapping, selected fill, and
21
+ visual disabled states. `overlayListLabelStyles()` supplies group-label spacing
22
+ and typography. `overlayListIndicatorStyles()` reserves a 16px selection slot;
23
+ place it after a flexible label so it stays at the trailing edge in LTR and RTL.
24
+ These helpers contain presentation only. Callers provide semantic elements,
25
+ selection attributes, keyboard behavior, and focus management. DropdownMenu,
26
+ Select, and CommandPalette consume them directly; load Overlay's stylesheet
27
+ before the consuming family's stylesheet.
28
+
17
29
  Each family maps its own positioning origin to `--gridui-overlay-origin`.
18
30
  Popup motion follows `data-side`; `data-side="none"` disables surface motion for
19
31
  item-aligned Select. Open/closed and Tooltip's instant/delayed open states are
@@ -24,8 +36,12 @@ shared backdrop. Theme continues to own motion tokens and keyframes.
24
36
  ## Interaction outlines
25
37
 
26
38
  `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
39
+ scrolling viewport. Forward the caller's optional ref. The optional `selector`
40
+ defaults to native controls, links, focusable elements, and interactive ARIA roles.
41
+ Use a selector to restrict a specialized viewport to its owned items. Mark a
42
+ composite field's outline container with `data-gridui-outline-target`; these
43
+ containers are included with either selector and inherit focus priority from
44
+ focused descendants. Theme styles own the indicator
29
45
  paint; the hook does not require an additional stylesheet.
30
46
  The hook mirrors each active Theme outline into an aria-hidden, input-transparent
31
47
  document plane using its resolved color, width, offset, and radius.
@@ -44,7 +60,7 @@ allowing the outline's full outward extent. The layer never receives input.
44
60
 
45
61
  ## Scrollbars
46
62
 
47
- `useScrollbars({ ref })` returns a composed React ref for one native scrolling
63
+ `useScrollbars({ ref, containerRef? })` returns a composed React ref for one native scrolling
48
64
  viewport. Bind each owned viewport explicitly, including independently scrolling
49
65
  dialog sections. `useInteractionOutline` remains independent; compose its ref
50
66
  with this hook when a viewport needs both behaviors. Theme owns the paint, so
@@ -57,7 +73,15 @@ Track clicks, wheel input, and captured pointer dragging update the real viewpor
57
73
  keyboard focus remains on the real content. RTL horizontal scrolling and reversed
58
74
  vertical flex layouts retain their native coordinate behavior.
59
75
 
60
- The layer lives inside the viewport and follows its native scrolling, clipping,
76
+ For an owned scroll layout, pass `containerRef` for a local, non-scrolling ancestor
77
+ with positioning and clipping owned by the composition. The viewport and indicator
78
+ layer are separate descendants, so the track never moves with scrolling content.
79
+ FollowScroll uses this structure. Resize notifications and native scroll events
80
+ refresh indicator geometry synchronously; React commits refresh before paint.
81
+
82
+ A ref-only native viewport retains an internal adapter for controls that cannot
83
+ supply a separate host without changing their DOM or popup event ownership.
84
+ That layer lives inside the viewport and follows its native scrolling, clipping,
61
85
  palette, transforms, and stacking context. It remains part of hover-opened panels.
62
86
  There is no document-level scrollbar portal, ancestor z-index reconstruction,
63
87
  descendant discovery, or permanent document input listener. Resize observation
@@ -79,3 +103,19 @@ React 19 callback ref with cleanup, also usable as an imperative binding that
79
103
  returns a disposer. Native viewports and Sidebar's Radix scrollbar share this
80
104
  binding. Ref composition uses Radix's cleanup-aware implementation. Both layout
81
105
  hooks ignore mutations inside their decorative layers and observe real content.
106
+
107
+ [Component reference](docs/reference/README.md) contains focused API pages for each public component.
108
+
109
+ ## Exit content
110
+
111
+ `ExitSnapshot` accepts `open` and `children`. Mount it inside a presence-managed
112
+ popup or dialog content boundary. While open, it follows parent-provided content;
113
+ while closing, it retains the last open content until that boundary unmounts.
114
+ Reopening during exit immediately resumes current content. It adds no DOM, timer,
115
+ focus management, or animation listener, and works with reduced-motion unmounts.
116
+
117
+ This separates immediate value/query updates from exit presentation. Select's
118
+ search popups and CommandPalette use it so a query reset cannot replace the
119
+ visible results halfway through dismissal. It retains React elements, not pixels:
120
+ descendant-owned state and context updates still run. It does not replace presence
121
+ or make interactive content inert; the owning surface keeps those responsibilities.
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Overlay
4
+ * @namespace ExitSnapshot
5
+ * @description Exit Snapshot
6
+ */
7
+ import { type FC, type ReactNode } from "react";
8
+ export type ExitSnapshotProps = {
9
+ /** Whether the owning surface is open. False retains its last open content. */
10
+ readonly open: boolean;
11
+ /** Parent-provided content, retained only until the presence boundary unmounts. */
12
+ readonly children: ReactNode;
13
+ };
14
+ export declare const ExitSnapshot: FC<ExitSnapshotProps>;
package/dist/index.d.ts CHANGED
@@ -4,14 +4,17 @@
4
4
  * @namespace Root
5
5
  * @description Index
6
6
  */
7
+ export type { ExitSnapshotProps } from "./exit-snapshot/exit-snapshot";
8
+ export { ExitSnapshot } from "./exit-snapshot/exit-snapshot";
9
+ export { interactionLayerProps } from "./interaction-outline/interaction-layer";
10
+ export type { InteractionOutlineOptions } from "./interaction-outline/use-interaction-outline";
11
+ export { useInteractionOutline } from "./interaction-outline/use-interaction-outline";
12
+ export { overlayListIndicatorStyles, overlayListItemStyles, overlayListLabelStyles, overlayListStyles } from "./list/style";
7
13
  export type { RetainedLayerProps } from "./retained-layer/retained-layer";
8
14
  export { OverlayOpen } from "./retained-layer/retained-layer";
9
15
  export { RetainedLayer } from "./retained-layer/retained-layer";
10
- export { interactionLayerProps } from "./shared/interaction-layer";
11
- export { scrollbarInteractionRef } from "./shared/scrollbar-interaction-ref";
12
- export { overlayBackdropStyles, overlaySurfaceStyles } from "./shared/style";
13
- export type { InteractionOutlineOptions } from "./shared/use-interaction-outline";
14
- export { useInteractionOutline } from "./shared/use-interaction-outline";
15
- export { useOverlayState } from "./shared/use-overlay-state";
16
- export type { ScrollbarsOptions } from "./shared/use-scrollbars";
17
- export { useScrollbars } from "./shared/use-scrollbars";
16
+ export { scrollbarInteractionRef } from "./scrollbar/scrollbar-interaction-ref";
17
+ export type { ScrollbarsOptions } from "./scrollbar/use-scrollbars";
18
+ export { useScrollbars } from "./scrollbar/use-scrollbars";
19
+ export { overlayBackdropStyles, overlaySurfaceStyles } from "./surface/style";
20
+ export { useOverlayState } from "./use-overlay-state";
package/dist/index.js CHANGED
@@ -1,20 +1,18 @@
1
- // src/retained-layer/retained-layer.tsx
2
- import { Activity, createContext, useContext } from "react";
3
- import { jsx } from "react/jsx-runtime";
4
- var OverlayOpen = createContext(false);
5
- var RetainedLayer = (props) => {
6
- const { children } = props;
7
- const open = useContext(OverlayOpen);
8
- return /* @__PURE__ */ jsx(
9
- Activity,
10
- {
11
- mode: !open ? "hidden" : "visible",
12
- children
13
- }
14
- );
1
+ // src/exit-snapshot/exit-snapshot.tsx
2
+ import { useState } from "react";
3
+ var ExitSnapshot = (props) => {
4
+ const { open, children } = props;
5
+ const [
6
+ snapshot,
7
+ setSnapshot
8
+ ] = useState(children);
9
+ if (open && children !== snapshot) {
10
+ setSnapshot(children);
11
+ }
12
+ return open ? children : snapshot;
15
13
  };
16
14
 
17
- // src/shared/interaction-layer.ts
15
+ // src/interaction-outline/interaction-layer.ts
18
16
  var interactionLayerProps = { "data-gridui-interaction-layer": "" };
19
17
  var selector = "[data-gridui-interaction-layer]";
20
18
  var planes = /* @__PURE__ */ new WeakMap();
@@ -88,68 +86,6 @@ var releaseOutlinePlane = (plane) => {
88
86
  }
89
87
  };
90
88
 
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
-
131
- // src/shared/style.ts
132
- import { cva } from "class-variance-authority";
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", {
134
- variants: {
135
- kind: {
136
- popup: "gridui-overlay-floating gridui-u-rounded-control",
137
- tooltip: "gridui-overlay-tooltip gridui-u-rounded-control",
138
- dialog: "gridui-overlay-dialog"
139
- }
140
- },
141
- defaultVariants: { kind: "popup" }
142
- });
143
- var overlayBackdropStyles = cva("gridui-overlay-backdrop", {
144
- variants: {
145
- pace: {
146
- normal: null,
147
- deliberate: "gridui-overlay-backdrop-deliberate"
148
- }
149
- },
150
- defaultVariants: { pace: "normal" }
151
- });
152
-
153
89
  // src/shared/content-mutation.ts
154
90
  var decorativeSelector = ".gridui-scrollbar-layer, .gridui-interaction-outline-layer";
155
91
  var isDecorative = (node) => {
@@ -167,15 +103,15 @@ var hasContentMutation = (records) => {
167
103
  });
168
104
  };
169
105
 
170
- // src/shared/use-interaction-outline.ts
106
+ // src/interaction-outline/use-interaction-outline.ts
171
107
  import { useComposedRefs } from "@radix-ui/react-compose-refs";
172
- import { useLayoutEffect, useState } from "react";
108
+ import { useLayoutEffect, useState as useState2 } from "react";
173
109
  var useInteractionOutline = (options) => {
174
- const { ref, selector: selector2 } = options;
110
+ const { ref, selector: selector2 = 'a[href], button, input, select, textarea, summary, [tabindex], [role="button"], [role="link"], [role="checkbox"], [role="radio"], [role="switch"], [role="tab"], [role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], [role="option"], [role="slider"]' } = options;
175
111
  const [
176
112
  viewport,
177
113
  setViewport
178
- ] = useState(null);
114
+ ] = useState2(null);
179
115
  useLayoutEffect(() => {
180
116
  if (!viewport) {
181
117
  return;
@@ -210,8 +146,8 @@ var useInteractionOutline = (options) => {
210
146
  }
211
147
  const inactive = viewport.closest('[inert], [aria-hidden="true"]');
212
148
  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]");
149
+ const candidates = inactive ? [] : Array.from(viewport.querySelectorAll(`${selector2}, [data-gridui-outline-target]`)).filter((element) => {
150
+ return element.parentElement?.closest("[data-gridui-outline-viewport]") === viewport && !element.closest('[inert], [aria-hidden="true"]') && element.matches(":hover, :active, :focus-visible, [data-highlighted], [data-gridui-outline-target]:has(:focus-visible)");
215
151
  });
216
152
  const current = /* @__PURE__ */ new Set();
217
153
  let moving = false;
@@ -268,7 +204,7 @@ var useInteractionOutline = (options) => {
268
204
  outlineOffset: style.outlineOffset,
269
205
  borderRadius: style.borderRadius,
270
206
  opacity: String(opacity),
271
- zIndex: element.matches(":focus-visible") ? "3" : "2",
207
+ zIndex: element.matches(":focus-visible, [data-gridui-outline-target]:has(:focus-visible)") ? "3" : "2",
272
208
  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
209
  });
274
210
  element.setAttribute("data-gridui-outline-rendered", "");
@@ -314,7 +250,10 @@ var useInteractionOutline = (options) => {
314
250
  "data-readonly",
315
251
  "data-state",
316
252
  "data-highlighted",
317
- "aria-selected"
253
+ "aria-selected",
254
+ "aria-hidden",
255
+ "inert",
256
+ "data-gridui-outline-target"
318
257
  ]
319
258
  });
320
259
  const ancestors = new MutationObserver(schedule);
@@ -334,6 +273,22 @@ var useInteractionOutline = (options) => {
334
273
  ]
335
274
  });
336
275
  }
276
+ const onEvent = (event) => {
277
+ const target = event.target;
278
+ const inside = !!target && viewport.contains(target);
279
+ const ancestor = !!target && target.contains(viewport);
280
+ if (event.type === "scroll") {
281
+ if (inside || ancestor) {
282
+ schedule();
283
+ }
284
+ return;
285
+ }
286
+ const related = "relatedTarget" in event ? event.relatedTarget : null;
287
+ const enters = !!related && related instanceof window.Node && viewport.contains(related);
288
+ if (inside || enters || rings.size > 0 || ancestor && (event.type === "animationstart" || event.type === "transitionrun")) {
289
+ schedule();
290
+ }
291
+ };
337
292
  const events = [
338
293
  "scroll",
339
294
  "pointerover",
@@ -349,7 +304,7 @@ var useInteractionOutline = (options) => {
349
304
  "transitionrun"
350
305
  ];
351
306
  for (const event of events) {
352
- document.addEventListener(event, schedule, {
307
+ document.addEventListener(event, onEvent, {
353
308
  capture: true,
354
309
  passive: true
355
310
  });
@@ -366,7 +321,7 @@ var useInteractionOutline = (options) => {
366
321
  mutation.disconnect();
367
322
  ancestors.disconnect();
368
323
  for (const event of events) {
369
- document.removeEventListener(event, schedule, true);
324
+ document.removeEventListener(event, onEvent, true);
370
325
  }
371
326
  scheme.removeEventListener("change", schedule);
372
327
  window.removeEventListener("resize", schedule);
@@ -389,29 +344,110 @@ var useInteractionOutline = (options) => {
389
344
  return useComposedRefs(setViewport, ref);
390
345
  };
391
346
 
392
- // src/shared/use-overlay-state.ts
393
- import { useState as useState2 } from "react";
394
- var useOverlayState = (options) => {
395
- const [
396
- localOpen,
397
- setLocalOpen
398
- ] = useState2(options.defaultOpen ?? false);
399
- return {
400
- open: options.open ?? localOpen,
401
- onOpenChange: (open) => {
402
- if (options.open === void 0) {
403
- setLocalOpen(open);
404
- }
405
- options.onOpenChange?.(open);
347
+ // src/surface/style.ts
348
+ import { cva } from "class-variance-authority";
349
+ var overlaySurfaceStyles = cva("gridui-overlay-surface gridui-u-overlay--border gridui-u-overlay--border-solid gridui-u-overlay--border-border gridui-u-overlay--bg-background gridui-u-overlay--text-foreground", {
350
+ variants: {
351
+ kind: {
352
+ popup: "gridui-overlay-floating gridui-u-overlay--rounded-control",
353
+ tooltip: "gridui-overlay-tooltip gridui-u-overlay--rounded-control",
354
+ dialog: "gridui-overlay-dialog"
355
+ }
356
+ },
357
+ defaultVariants: { kind: "popup" }
358
+ });
359
+ var overlayBackdropStyles = cva("gridui-overlay-backdrop", {
360
+ variants: {
361
+ pace: {
362
+ normal: null,
363
+ deliberate: "gridui-overlay-backdrop-deliberate"
364
+ }
365
+ },
366
+ defaultVariants: { pace: "normal" }
367
+ });
368
+
369
+ // src/list/style.ts
370
+ import { cva as cva2 } from "class-variance-authority";
371
+ var overlayListStyles = cva2([
372
+ overlaySurfaceStyles(),
373
+ "gridui-u-overlay--z-(--gridui-z-popover) gridui-u-overlay--p-0 gridui-u-overlay--type-data"
374
+ ]);
375
+ var overlayListItemStyles = cva2([
376
+ "gridui-overlay-list-item",
377
+ "gridui-u-overlay--flex gridui-u-overlay--min-h-10 gridui-u-overlay--min-w-0 gridui-u-overlay--items-center gridui-u-overlay--gap-gridui-8 gridui-u-overlay--px-gridui-8 gridui-u-overlay--py-gridui-8 gridui-u-overlay--rounded-control gridui-u-overlay--whitespace-normal gridui-u-overlay--wrap-anywhere gridui-u-overlay--text-inherit gridui-u-overlay--no-underline gridui-u-overlay--cursor-pointer",
378
+ "gridui-u-overlay--data-[state=checked]:bg-brand-tint gridui-u-overlay--aria-selected:bg-brand-tint",
379
+ "gridui-u-overlay--data-disabled:opacity-50 gridui-u-overlay--data-disabled:pointer-events-none"
380
+ ]);
381
+ var overlayListLabelStyles = cva2([
382
+ "gridui-overlay-list-label",
383
+ "gridui-u-overlay--p-gridui-8 gridui-u-overlay--text-muted gridui-u-overlay--type-caption"
384
+ ]);
385
+ var overlayListIndicatorStyles = cva2([
386
+ "gridui-overlay-list-indicator",
387
+ "gridui-u-overlay--inline-flex gridui-u-overlay--size-gridui-16 gridui-u-overlay--shrink-0 gridui-u-overlay--items-center gridui-u-overlay--justify-center gridui-u-overlay--text-foreground"
388
+ ]);
389
+
390
+ // src/retained-layer/retained-layer.tsx
391
+ import { Activity, createContext, useContext } from "react";
392
+ import { jsx } from "react/jsx-runtime";
393
+ var OverlayOpen = createContext(false);
394
+ var RetainedLayer = (props) => {
395
+ const { children } = props;
396
+ const open = useContext(OverlayOpen);
397
+ return /* @__PURE__ */ jsx(
398
+ Activity,
399
+ {
400
+ mode: !open ? "hidden" : "visible",
401
+ children
406
402
  }
403
+ );
404
+ };
405
+
406
+ // src/scrollbar/scrollbar-interaction-ref.ts
407
+ var scrollbarInteractionRef = (element) => {
408
+ if (!element) {
409
+ return;
410
+ }
411
+ const hover = (event) => {
412
+ const box = element.getBoundingClientRect();
413
+ element.toggleAttribute("data-gridui-hovered", event.clientX >= box.left && event.clientX < box.right && event.clientY >= box.top && event.clientY < box.bottom);
414
+ };
415
+ const leave = () => {
416
+ element.removeAttribute("data-gridui-hovered");
417
+ };
418
+ const down = (event) => {
419
+ if (event.button === 0) {
420
+ element.setAttribute("data-gridui-dragging", "");
421
+ }
422
+ };
423
+ const finish = () => {
424
+ element.removeAttribute("data-gridui-dragging");
425
+ };
426
+ element.addEventListener("pointerenter", hover);
427
+ element.addEventListener("pointermove", hover);
428
+ element.addEventListener("pointerleave", leave);
429
+ element.addEventListener("pointerdown", down);
430
+ element.addEventListener("pointerup", finish);
431
+ element.addEventListener("pointercancel", finish);
432
+ element.addEventListener("lostpointercapture", finish);
433
+ return () => {
434
+ element.removeEventListener("pointerenter", hover);
435
+ element.removeEventListener("pointermove", hover);
436
+ element.removeEventListener("pointerleave", leave);
437
+ element.removeEventListener("pointerdown", down);
438
+ element.removeEventListener("pointerup", finish);
439
+ element.removeEventListener("pointercancel", finish);
440
+ element.removeEventListener("lostpointercapture", finish);
441
+ leave();
442
+ finish();
407
443
  };
408
444
  };
409
445
 
410
- // src/shared/textarea-scrollbar.ts
446
+ // src/scrollbar/sibling-scrollbar.ts
411
447
  var isTextarea = (element) => {
412
448
  return element.tagName === "TEXTAREA";
413
449
  };
414
- var syncTextareaScrollbar = (viewport, layer, style) => {
450
+ var syncSiblingScrollbar = (viewport, layer, style) => {
415
451
  const window = viewport.ownerDocument.defaultView;
416
452
  layer.style.position = style.position === "fixed" ? "fixed" : "absolute";
417
453
  const parent = layer.offsetParent;
@@ -435,7 +471,7 @@ var syncTextareaScrollbar = (viewport, layer, style) => {
435
471
  colorScheme: style.colorScheme
436
472
  });
437
473
  layer.inert = viewport.inert;
438
- const inherited = window.getComputedStyle(viewport.parentElement);
474
+ const inherited = window.getComputedStyle(layer.parentElement);
439
475
  for (const [
440
476
  token,
441
477
  fallback
@@ -463,11 +499,11 @@ var syncTextareaScrollbar = (viewport, layer, style) => {
463
499
  }
464
500
  };
465
501
 
466
- // src/shared/use-scrollbars.ts
502
+ // src/scrollbar/use-scrollbars.ts
467
503
  import { useComposedRefs as useComposedRefs2 } from "@radix-ui/react-compose-refs";
468
504
  import { useId, useLayoutEffect as useLayoutEffect2, useRef, useState as useState3 } from "react";
469
505
  var useScrollbars = (options = {}) => {
470
- const { ref } = options;
506
+ const { ref, containerRef } = options;
471
507
  const owner = useId();
472
508
  const [
473
509
  viewport,
@@ -481,8 +517,9 @@ var useScrollbars = (options = {}) => {
481
517
  const document = viewport.ownerDocument;
482
518
  const window = document.defaultView;
483
519
  const textarea = isTextarea(viewport) ? viewport : null;
484
- const host = textarea ? viewport.parentElement : viewport;
485
- const layer = document.createElement(viewport.matches("ol, ul") ? "li" : "span");
520
+ const host = containerRef?.current ?? (textarea ? viewport.parentElement : viewport);
521
+ const sibling = host !== viewport;
522
+ const layer = document.createElement(host.matches("ol, ul") ? "li" : "span");
486
523
  layer.className = "gridui-scrollbar-layer";
487
524
  layer.setAttribute("aria-hidden", "true");
488
525
  host.append(layer);
@@ -610,8 +647,8 @@ var useScrollbars = (options = {}) => {
610
647
  const visible = viewport.clientWidth > 0 && viewport.clientHeight > 0;
611
648
  const vertical = visible && /^(auto|scroll)$/.test(style.overflowY) && extent(true) > 1;
612
649
  const horizontal = visible && /^(auto|scroll)$/.test(style.overflowX) && extent(false) > 1;
613
- if (textarea) {
614
- syncTextareaScrollbar(textarea, layer, style);
650
+ if (sibling) {
651
+ syncSiblingScrollbar(viewport, layer, style);
615
652
  } else {
616
653
  layer.style.transform = `translate(${viewport.scrollLeft}px, ${viewport.scrollTop}px)`;
617
654
  }
@@ -653,9 +690,12 @@ var useScrollbars = (options = {}) => {
653
690
  });
654
691
  }
655
692
  };
656
- const resize = new ResizeObserver(schedule);
693
+ const resize = new ResizeObserver(sync);
657
694
  const observeContents = () => {
658
- const current = new Set(Array.from(host.children).filter((element) => {
695
+ const current = new Set([
696
+ ...Array.from(host.children),
697
+ ...Array.from(viewport.children)
698
+ ].filter((element) => {
659
699
  return !element.classList.contains("gridui-scrollbar-layer");
660
700
  }));
661
701
  for (const content of contents) {
@@ -692,7 +732,7 @@ var useScrollbars = (options = {}) => {
692
732
  "data-state"
693
733
  ]
694
734
  });
695
- viewport.addEventListener("scroll", schedule, { passive: true });
735
+ viewport.addEventListener("scroll", sync, { passive: true });
696
736
  viewport.addEventListener("input", schedule);
697
737
  viewport.addEventListener("load", schedule, true);
698
738
  resize.observe(viewport);
@@ -701,12 +741,14 @@ var useScrollbars = (options = {}) => {
701
741
  schedule();
702
742
  }
703
743
  };
704
- if (textarea) {
744
+ if (sibling) {
705
745
  resize.observe(host);
746
+ }
747
+ if (textarea) {
706
748
  document.addEventListener("reset", reset, true);
707
749
  }
708
750
  observeContents();
709
- refresh.current = schedule;
751
+ refresh.current = sync;
710
752
  sync();
711
753
  return () => {
712
754
  disposed = true;
@@ -717,7 +759,7 @@ var useScrollbars = (options = {}) => {
717
759
  }
718
760
  resize.disconnect();
719
761
  mutation.disconnect();
720
- viewport.removeEventListener("scroll", schedule);
762
+ viewport.removeEventListener("scroll", sync);
721
763
  viewport.removeEventListener("input", schedule);
722
764
  viewport.removeEventListener("load", schedule, true);
723
765
  viewport.removeAttribute("data-gridui-scrollbar-owner");
@@ -729,18 +771,42 @@ var useScrollbars = (options = {}) => {
729
771
  };
730
772
  }, [
731
773
  viewport,
732
- owner
774
+ owner,
775
+ containerRef
733
776
  ]);
734
777
  useLayoutEffect2(() => {
735
778
  refresh.current?.();
736
779
  });
737
780
  return useComposedRefs2(setViewport, ref);
738
781
  };
782
+
783
+ // src/use-overlay-state.ts
784
+ import { useState as useState4 } from "react";
785
+ var useOverlayState = (options) => {
786
+ const [
787
+ localOpen,
788
+ setLocalOpen
789
+ ] = useState4(options.defaultOpen ?? false);
790
+ return {
791
+ open: options.open ?? localOpen,
792
+ onOpenChange: (open) => {
793
+ if (options.open === void 0) {
794
+ setLocalOpen(open);
795
+ }
796
+ options.onOpenChange?.(open);
797
+ }
798
+ };
799
+ };
739
800
  export {
801
+ ExitSnapshot,
740
802
  OverlayOpen,
741
803
  RetainedLayer,
742
804
  interactionLayerProps,
743
805
  overlayBackdropStyles,
806
+ overlayListIndicatorStyles,
807
+ overlayListItemStyles,
808
+ overlayListLabelStyles,
809
+ overlayListStyles,
744
810
  overlaySurfaceStyles,
745
811
  scrollbarInteractionRef,
746
812
  useInteractionOutline,
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/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,MAAM,iBAAiB,wBAAwB,KAAK,MACpD,MAAM;AACZ,MAAI,QAAQ;AACR,wBAAoB,MAAM;AAC1B,UAAM,OAAO,MAA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,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"]
3
+ "sources": ["../src/exit-snapshot/exit-snapshot.tsx", "../src/interaction-outline/interaction-layer.ts", "../src/shared/content-mutation.ts", "../src/interaction-outline/use-interaction-outline.ts", "../src/surface/style.ts", "../src/list/style.ts", "../src/retained-layer/retained-layer.tsx", "../src/scrollbar/scrollbar-interaction-ref.ts", "../src/scrollbar/sibling-scrollbar.ts", "../src/scrollbar/use-scrollbars.ts", "../src/use-overlay-state.ts"],
4
+ "sourcesContent": ["/**\n * @author WMXPY\n * @package Overlay\n * @namespace ExitSnapshot\n * @description Exit Snapshot\n */\n\nimport { type FC, type ReactNode, useState } from \"react\";\n\nexport type ExitSnapshotProps = {\n /** Whether the owning surface is open. False retains its last open content. */\n readonly open: boolean;\n /** Parent-provided content, retained only until the presence boundary unmounts. */\n readonly children: ReactNode;\n};\n\nexport const ExitSnapshot: FC<ExitSnapshotProps> = (props: ExitSnapshotProps) => {\n const { open, children } = props;\n const [\n snapshot,\n setSnapshot,\n ] = useState(children);\n // Track parent content before committing, so a close never paints reset data.\n // Mount inside the presence boundary; its unmount releases the snapshot.\n if (open && children !== snapshot) {\n setSnapshot(children);\n }\n return open ? children : snapshot;\n};\n", "/**\n * @author WMXPY\n * @package Overlay\n * @namespace InteractionOutline\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 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 InteractionOutline\n * @description Use Interaction Outline\n */\n\nimport { hasContentMutation } from \"../shared/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 = 'a[href], button, input, select, textarea, summary, [tabindex], [role=\"button\"], [role=\"link\"], [role=\"checkbox\"], [role=\"radio\"], [role=\"switch\"], [role=\"tab\"], [role=\"menuitem\"], [role=\"menuitemcheckbox\"], [role=\"menuitemradio\"], [role=\"option\"], [role=\"slider\"]' } = 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}, [data-gridui-outline-target]`)).filter(element => {\n return element.parentElement?.closest(\"[data-gridui-outline-viewport]\") === viewport\n && !element.closest('[inert], [aria-hidden=\"true\"]')\n && element.matches(\":hover, :active, :focus-visible, [data-highlighted], [data-gridui-outline-target]:has(:focus-visible)\");\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, [data-gridui-outline-target]:has(: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 \"aria-hidden\",\n \"inert\",\n \"data-gridui-outline-target\",\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 onEvent = (event: Event) => {\n const target = event.target as Node | null;\n const inside = !!target && viewport.contains(target);\n const ancestor = !!target && target.contains(viewport);\n // Scrolling an ancestor moves the viewport, but sibling scrolls do not.\n if (event.type === \"scroll\") {\n if (inside || ancestor) {\n schedule();\n }\n return;\n }\n const related = \"relatedTarget\" in event ? event.relatedTarget as Node | null : null;\n const enters = !!related && related instanceof window.Node && viewport.contains(related);\n // Existing rings must also observe global input-modality changes and dismissal.\n if (inside || enters || rings.size > 0\n || (ancestor && (event.type === \"animationstart\" || event.type === \"transitionrun\"))) {\n schedule();\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, onEvent, {\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, onEvent, 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 Surface\n * @description Style\n */\n\nimport { cva } from \"class-variance-authority\";\n\nexport const overlaySurfaceStyles = cva(\"gridui-overlay-surface gridui-u-overlay--border gridui-u-overlay--border-solid gridui-u-overlay--border-border gridui-u-overlay--bg-background gridui-u-overlay--text-foreground\", {\n variants: {\n kind: {\n popup: \"gridui-overlay-floating gridui-u-overlay--rounded-control\",\n tooltip: \"gridui-overlay-tooltip gridui-u-overlay--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 List\n * @description Style\n */\n\nimport { overlaySurfaceStyles } from \"../surface/style\";\nimport { cva } from \"class-variance-authority\";\n\n/** Shared popup-list presentation; callers own geometry and interaction semantics. */\nexport const overlayListStyles = cva([\n overlaySurfaceStyles(),\n \"gridui-u-overlay--z-(--gridui-z-popover) gridui-u-overlay--p-0 gridui-u-overlay--type-data\",\n]);\n\nexport const overlayListItemStyles = cva([\n \"gridui-overlay-list-item\",\n \"gridui-u-overlay--flex gridui-u-overlay--min-h-10 gridui-u-overlay--min-w-0 gridui-u-overlay--items-center gridui-u-overlay--gap-gridui-8 gridui-u-overlay--px-gridui-8 gridui-u-overlay--py-gridui-8 gridui-u-overlay--rounded-control gridui-u-overlay--whitespace-normal gridui-u-overlay--wrap-anywhere gridui-u-overlay--text-inherit gridui-u-overlay--no-underline gridui-u-overlay--cursor-pointer\",\n \"gridui-u-overlay--data-[state=checked]:bg-brand-tint gridui-u-overlay--aria-selected:bg-brand-tint\",\n \"gridui-u-overlay--data-disabled:opacity-50 gridui-u-overlay--data-disabled:pointer-events-none\",\n]);\n\nexport const overlayListLabelStyles = cva([\n \"gridui-overlay-list-label\",\n \"gridui-u-overlay--p-gridui-8 gridui-u-overlay--text-muted gridui-u-overlay--type-caption\",\n]);\n\nexport const overlayListIndicatorStyles = cva([\n \"gridui-overlay-list-indicator\",\n \"gridui-u-overlay--inline-flex gridui-u-overlay--size-gridui-16 gridui-u-overlay--shrink-0 gridui-u-overlay--items-center gridui-u-overlay--justify-center gridui-u-overlay--text-foreground\",\n]);\n", "/**\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 Scrollbar\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 Scrollbar\n * @description Sibling 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 syncSiblingScrollbar = (viewport: HTMLElement, 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(layer.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 Scrollbar\n * @description Use Scrollbars\n */\n\nimport { hasContentMutation } from \"../shared/content-mutation\";\nimport { scrollbarInteractionRef } from \"./scrollbar-interaction-ref\";\nimport { isTextarea, syncSiblingScrollbar } from \"./sibling-scrollbar\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { type Ref, type RefCallback, type RefObject, useId, useLayoutEffect, useRef, useState } from \"react\";\n\nexport type ScrollbarsOptions<T extends HTMLElement> = {\n readonly ref?: Ref<T> | undefined;\n /** A local, non-scrolling ancestor that owns the viewport and its indicators. */\n readonly containerRef?: RefObject<HTMLElement | null>;\n\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, containerRef } = 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 = containerRef?.current ?? (textarea ? viewport.parentElement! : viewport);\n const sibling = host !== viewport;\n const layer = document.createElement(host.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 (sibling) {\n syncSiblingScrollbar(viewport, 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(sync);\n const observeContents = () => {\n const current = new Set([\n ...Array.from(host.children),\n ...Array.from(viewport.children),\n ].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\", sync, { 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 (sibling) {\n resize.observe(host);\n }\n if (textarea) {\n document.addEventListener(\"reset\", reset, true);\n }\n observeContents();\n refresh.current = sync;\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\", sync);\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 containerRef,\n ]);\n useLayoutEffect(() => {\n refresh.current?.();\n });\n return useComposedRefs(setViewport, ref);\n};\n", "/**\n * @author WMXPY\n * @package Overlay\n * @namespace Root\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,SAAkC,gBAAgB;AAS3C,IAAM,eAAsC,CAAC,UAA6B;AAC7E,QAAM,EAAE,MAAM,SAAS,IAAI;AAC3B,QAAM;AAAA,IACF;AAAA,IACA;AAAA,EACJ,IAAI,SAAS,QAAQ;AAGrB,MAAI,QAAQ,aAAa,UAAU;AAC/B,gBAAY,QAAQ;AAAA,EACxB;AACA,SAAO,OAAO,WAAW;AAC7B;;;ACpBO,IAAM,wBAAwB,EAAE,iCAAiC,GAAG;AAE3E,IAAM,WAAW;AACjB,IAAM,SAAS,oBAAI,QAAmC;AACtD,IAAM,gBAAgB,oBAAI,QAA+B;AASlD,IAAM,wBAAwB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ACzC,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": ["useState", "selector", "cva", "useComposedRefs", "useLayoutEffect", "useState", "bar", "useState"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @author WMXPY
3
3
  * @package Overlay
4
- * @namespace Shared
4
+ * @namespace InteractionOutline
5
5
  * @description Interaction Layer
6
6
  */
7
7
  /** Marks a popup or dialog surface as an independent interaction paint boundary. */
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * @author WMXPY
3
3
  * @package Overlay
4
- * @namespace Shared
4
+ * @namespace InteractionOutline
5
5
  * @description Use Interaction Outline
6
6
  */
7
7
  import { type Ref, type RefCallback } from "react";
8
8
  export type InteractionOutlineOptions<T extends HTMLElement> = {
9
9
  readonly ref?: Ref<T> | undefined;
10
- readonly selector: string;
10
+ readonly selector?: string;
11
11
  };
12
12
  /** Mirror Theme's resolved outline outside a scrolling viewport's clipping ancestors. */
13
13
  export declare const useInteractionOutline: <T extends HTMLElement>(options: InteractionOutlineOptions<T>) => RefCallback<T>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Overlay
4
+ * @namespace List
5
+ * @description Style
6
+ */
7
+ /** Shared popup-list presentation; callers own geometry and interaction semantics. */
8
+ export declare const overlayListStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
9
+ export declare const overlayListItemStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
10
+ export declare const overlayListLabelStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
11
+ export declare const overlayListIndicatorStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @author WMXPY
3
3
  * @package Overlay
4
- * @namespace Shared
4
+ * @namespace Scrollbar
5
5
  * @description Scrollbar Interaction Ref
6
6
  */
7
7
  /** Share pointer paint with native scrollbars and Radix without owning scrolling. */
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * @author WMXPY
3
3
  * @package Overlay
4
- * @namespace Shared
5
- * @description Textarea Scrollbar
4
+ * @namespace Scrollbar
5
+ * @description Sibling Scrollbar
6
6
  */
7
7
  export declare const isTextarea: (element: HTMLElement) => element is HTMLTextAreaElement;
8
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;
9
+ export declare const syncSiblingScrollbar: (viewport: HTMLElement, layer: HTMLElement, style: CSSStyleDeclaration) => void;
@@ -1,12 +1,14 @@
1
1
  /**
2
2
  * @author WMXPY
3
3
  * @package Overlay
4
- * @namespace Shared
4
+ * @namespace Scrollbar
5
5
  * @description Use Scrollbars
6
6
  */
7
- import { type Ref, type RefCallback } from "react";
7
+ import { type Ref, type RefCallback, type RefObject } from "react";
8
8
  export type ScrollbarsOptions<T extends HTMLElement> = {
9
9
  readonly ref?: Ref<T> | undefined;
10
+ /** A local, non-scrolling ancestor that owns the viewport and its indicators. */
11
+ readonly containerRef?: RefObject<HTMLElement | null>;
10
12
  };
11
13
  /** Attach square scrollbars to one native viewport, within its local DOM owner. */
12
14
  export declare const useScrollbars: <T extends HTMLElement>(options?: ScrollbarsOptions<T>) => RefCallback<T>;
package/dist/styles.css CHANGED
@@ -1,27 +1,114 @@
1
- /*! tailwindcss v4.3.4 | MIT License | https://tailwindcss.com */
1
+ /*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
2
2
  @layer properties;
3
3
  @layer theme, base, components, utilities;
4
+ @layer theme {
5
+ :root, :host {
6
+ --spacing: 0.25rem;
7
+ }
8
+ }
4
9
  @layer utilities {
5
- .gridui-u-rounded-control {
10
+ .gridui-u-overlay--z-\(--gridui-z-popover\) {
11
+ z-index: var(--gridui-z-popover);
12
+ }
13
+ .gridui-u-overlay--flex {
14
+ display: flex;
15
+ }
16
+ .gridui-u-overlay--inline-flex {
17
+ display: inline-flex;
18
+ }
19
+ .gridui-u-overlay--size-gridui-16 {
20
+ width: var(--gridui-space-16);
21
+ height: var(--gridui-space-16);
22
+ }
23
+ .gridui-u-overlay--min-h-10 {
24
+ min-height: calc(var(--spacing) * 10);
25
+ }
26
+ .gridui-u-overlay--min-w-0 {
27
+ min-width: 0px;
28
+ }
29
+ .gridui-u-overlay--shrink-0 {
30
+ flex-shrink: 0;
31
+ }
32
+ .gridui-u-overlay--cursor-pointer {
33
+ cursor: pointer;
34
+ }
35
+ .gridui-u-overlay--items-center {
36
+ align-items: center;
37
+ }
38
+ .gridui-u-overlay--justify-center {
39
+ justify-content: center;
40
+ }
41
+ .gridui-u-overlay--gap-gridui-8 {
42
+ gap: var(--gridui-space-8);
43
+ }
44
+ .gridui-u-overlay--rounded-control {
6
45
  border-radius: var(--gridui-control-radius);
7
46
  }
8
- .gridui-u-border {
47
+ .gridui-u-overlay--border {
9
48
  border-style: var(--tw-border-style);
10
49
  border-width: 1px;
11
50
  }
12
- .gridui-u-border-solid {
51
+ .gridui-u-overlay--border-solid {
13
52
  --tw-border-style: solid;
14
53
  border-style: solid;
15
54
  }
16
- .gridui-u-border-border {
55
+ .gridui-u-overlay--border-border {
17
56
  border-color: var(--gridui-border);
18
57
  }
19
- .gridui-u-bg-background {
58
+ .gridui-u-overlay--bg-background {
20
59
  background-color: var(--gridui-background);
21
60
  }
22
- .gridui-u-text-foreground {
61
+ .gridui-u-overlay--p-0 {
62
+ padding: 0px;
63
+ }
64
+ .gridui-u-overlay--p-gridui-8 {
65
+ padding: var(--gridui-space-8);
66
+ }
67
+ .gridui-u-overlay--px-gridui-8 {
68
+ padding-inline: var(--gridui-space-8);
69
+ }
70
+ .gridui-u-overlay--py-gridui-8 {
71
+ padding-block: var(--gridui-space-8);
72
+ }
73
+ .gridui-u-overlay--type-data {
74
+ font: var(--gridui-type-data);
75
+ letter-spacing: normal;
76
+ font-variant-numeric: tabular-nums;
77
+ }
78
+ .gridui-u-overlay--type-caption {
79
+ font: var(--gridui-type-caption);
80
+ letter-spacing: normal;
81
+ }
82
+ .gridui-u-overlay--wrap-anywhere {
83
+ overflow-wrap: anywhere;
84
+ }
85
+ .gridui-u-overlay--whitespace-normal {
86
+ white-space: normal;
87
+ }
88
+ .gridui-u-overlay--text-foreground {
23
89
  color: var(--gridui-foreground);
24
90
  }
91
+ .gridui-u-overlay--text-inherit {
92
+ color: inherit;
93
+ }
94
+ .gridui-u-overlay--text-muted {
95
+ color: var(--gridui-muted);
96
+ }
97
+ .gridui-u-overlay--no-underline {
98
+ text-decoration-line: none;
99
+ }
100
+ .gridui-u-overlay--aria-selected\:bg-brand-tint[aria-selected="true"] {
101
+ background-color: var(--gridui-brand-tint);
102
+ }
103
+ .gridui-u-overlay--data-disabled\:pointer-events-none[data-disabled] {
104
+ pointer-events: none;
105
+ }
106
+ .gridui-u-overlay--data-disabled\:opacity-50[data-disabled] {
107
+ opacity: 50%;
108
+ }
109
+ .gridui-u-overlay--data-\[state\=checked\]\:bg-brand-tint[data-state="checked"] {
110
+ background-color: var(--gridui-brand-tint);
111
+ }
25
112
  }
26
113
  @layer components {
27
114
  .gridui-overlay-surface {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @author WMXPY
3
3
  * @package Overlay
4
- * @namespace Shared
4
+ * @namespace Surface
5
5
  * @description Style
6
6
  */
7
7
  export declare const overlaySurfaceStyles: (props?: ({
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @author WMXPY
3
3
  * @package Overlay
4
- * @namespace Shared
4
+ * @namespace Root
5
5
  * @description Use Overlay State
6
6
  */
7
7
  type OverlayStateOptions = {
package/docs/catalog.json CHANGED
@@ -1,14 +1,27 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "name": "@gridui/overlay",
4
- "version": "1.2.2",
4
+ "version": "2.1.0",
5
5
  "category": "core",
6
6
  "description": "GridUI React overlay",
7
7
  "usage": "`overlaySurfaceStyles({ kind })` shares the surface border, colors, motion, and reduced-motion behavior. `kind` is `popup` (default), `tooltip`, or `dialog`. `overlayBackdropStyles({ pace })` shares backdrop fades at `normal` (default) or `deliberate` pace. Load this stylesheet before the consuming family.",
8
8
  "documentation": [
9
- "README.md"
9
+ "README.md",
10
+ "docs/reference/README.md",
11
+ "docs/reference/exit-snapshot.md",
12
+ "docs/reference/retained-layer.md"
10
13
  ],
11
14
  "exports": [
15
+ {
16
+ "name": "ExitSnapshot",
17
+ "kind": "component",
18
+ "importPath": "@gridui/overlay"
19
+ },
20
+ {
21
+ "name": "ExitSnapshotProps",
22
+ "kind": "type",
23
+ "importPath": "@gridui/overlay"
24
+ },
12
25
  {
13
26
  "name": "interactionLayerProps",
14
27
  "kind": "value",
@@ -24,6 +37,26 @@
24
37
  "kind": "value",
25
38
  "importPath": "@gridui/overlay"
26
39
  },
40
+ {
41
+ "name": "overlayListIndicatorStyles",
42
+ "kind": "value",
43
+ "importPath": "@gridui/overlay"
44
+ },
45
+ {
46
+ "name": "overlayListItemStyles",
47
+ "kind": "value",
48
+ "importPath": "@gridui/overlay"
49
+ },
50
+ {
51
+ "name": "overlayListLabelStyles",
52
+ "kind": "value",
53
+ "importPath": "@gridui/overlay"
54
+ },
55
+ {
56
+ "name": "overlayListStyles",
57
+ "kind": "value",
58
+ "importPath": "@gridui/overlay"
59
+ },
27
60
  {
28
61
  "name": "OverlayOpen",
29
62
  "kind": "value",
@@ -74,5 +107,9 @@
74
107
  "@gridui/theme/styles.css",
75
108
  "@gridui/overlay/styles.css"
76
109
  ],
77
- "examples": []
110
+ "examples": [
111
+ "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/overlay/stories/custom-surfaces.mdx",
112
+ "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/overlay/stories/getting-started.mdx",
113
+ "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/overlay/stories/retention-scroll.mdx"
114
+ ]
78
115
  }
@@ -0,0 +1,5 @@
1
+ <!-- Generated by pnpm docs:storybook. -->
2
+ # Component reference
3
+
4
+ - [ExitSnapshot](exit-snapshot.md)
5
+ - [RetainedLayer](retained-layer.md)
@@ -0,0 +1,31 @@
1
+ <!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
2
+ # ExitSnapshot
3
+
4
+ Public ExitSnapshot component from @gridui/overlay. See the package guide for its composition contract.
5
+
6
+ Import from ``@gridui/overlay`` and load Theme before this family's stylesheet.
7
+
8
+ ```tsx
9
+ import { ExitSnapshot } from "@gridui/overlay";
10
+ import "@gridui/theme/styles.css";
11
+ import "@gridui/overlay/styles.css";
12
+ ```
13
+
14
+ Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/overlay/README.md) for shared behavior and stylesheet dependencies.
15
+
16
+ ## API
17
+
18
+ The public Props type is the source of these signatures. Defaults below are explicit implementation defaults; story presets are separate. Native attributes remain available through the exported Props type.
19
+
20
+ ### open
21
+
22
+ ``boolean`` · Required
23
+
24
+ Whether the owning surface is open. False retains its last open content.
25
+
26
+ ### children
27
+
28
+ ``ReactNode`` · Required
29
+
30
+ Parent-provided content, retained only until the presence boundary unmounts.
31
+
@@ -0,0 +1,25 @@
1
+ <!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
2
+ # RetainedLayer
3
+
4
+ Public RetainedLayer component from @gridui/overlay. See the package guide for its composition contract.
5
+
6
+ Import from ``@gridui/overlay`` and load Theme before this family's stylesheet.
7
+
8
+ ```tsx
9
+ import { RetainedLayer } from "@gridui/overlay";
10
+ import "@gridui/theme/styles.css";
11
+ import "@gridui/overlay/styles.css";
12
+ ```
13
+
14
+ Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/overlay/README.md) for shared behavior and stylesheet dependencies.
15
+
16
+ ## API
17
+
18
+ The public Props type is the source of these signatures. Defaults below are explicit implementation defaults; story presets are separate. Native attributes remain available through the exported Props type.
19
+
20
+ ### children
21
+
22
+ ``ReactNode`` · Required
23
+
24
+ Content rendered inside the component.
25
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridui/overlay",
3
- "version": "1.2.2",
3
+ "version": "2.1.0",
4
4
  "description": "GridUI React overlay",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -27,7 +27,7 @@
27
27
  "react-dom": "^19.2.0"
28
28
  },
29
29
  "dependencies": {
30
- "@gridui/theme": "^2.5.3",
30
+ "@gridui/theme": "^2.5.4",
31
31
  "@radix-ui/react-compose-refs": "1.1.5",
32
32
  "class-variance-authority": "0.7.1"
33
33
  },