@sofyan/glass 0.1.3 → 0.1.5

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
@@ -147,6 +147,19 @@ Pass `enabled: false` once the sheet is closed. After `onClose` the hook keeps t
147
147
  off-screen and clears its inline styles when `enabled` turns false; if that has not
148
148
  happened a moment later, it slides the sheet back.
149
149
 
150
+ From release until the sheet has closed, the hook sets `data-closing` on it. Style the
151
+ `::backdrop` with it so the dim fades out before the dialog closes: iOS Safari can leave a
152
+ closed dialog's backdrop painted. `.glass-dialog` does this already; for your own dialog:
153
+
154
+ ```css
155
+ dialog.my-sheet::backdrop {
156
+ transition: background-color 180ms ease-out;
157
+ }
158
+ dialog.my-sheet[data-closing]::backdrop {
159
+ background-color: transparent;
160
+ }
161
+ ```
162
+
150
163
  ### Refraction (Chromium only)
151
164
 
152
165
  Mount `<GlassFilter />` once near the root, then add `refract` (or `glass-refract`). Safari
package/dist/glass.css CHANGED
@@ -524,6 +524,15 @@
524
524
  background-color: var(--lg-scrim);
525
525
  overflow: hidden;
526
526
  overscroll-behavior: contain;
527
+ /* Both ways: out on a swipe-close, back in if the sheet comes back. No effect on open,
528
+ where the backdrop is new and has nothing to transition from. */
529
+ transition: background-color var(--lg-duration-fast) var(--lg-ease-out);
530
+ }
531
+
532
+ /* Set by the swipe hook from release until the sheet has closed. iOS Safari can leave a
533
+ closed dialog's backdrop painted, so it must already be clear when the close happens. */
534
+ dialog.glass-dialog[data-closing]::backdrop {
535
+ background-color: transparent;
527
536
  }
528
537
 
529
538
  .glass-dialog-grabber {
@@ -689,7 +698,8 @@
689
698
  .glass-menu-item,
690
699
  .glass-sheet,
691
700
  .glass-scrim,
692
- dialog.glass-dialog[open] {
701
+ dialog.glass-dialog[open],
702
+ dialog.glass-dialog::backdrop {
693
703
  animation: none;
694
704
  transition: none;
695
705
  }
@@ -97,6 +97,9 @@ interface SwipeToCloseOptions {
97
97
  /**
98
98
  * Called once the sheet has slid away. The sheet stays off-screen until `enabled` turns
99
99
  * false; if that has not happened `REOPEN_AFTER_MS` later, it slides back.
100
+ *
101
+ * From release until the sheet is closed and tidied up (or comes back) it carries
102
+ * `data-closing`. Style the backdrop with it, so the dim is gone before the close.
100
103
  */
101
104
  onClose: () => void;
102
105
  /** Media query for when the gesture applies. Default: the phone bottom-sheet layout. */
@@ -112,6 +115,10 @@ interface SwipeToCloseOptions {
112
115
  * After a slide-away the inline transform is kept until the effect is torn down (the owner
113
116
  * closed the sheet and `enabled` turned false). Clearing it earlier would show the sheet at
114
117
  * rest for a frame before the close is committed.
118
+ *
119
+ * From release until the sheet is closed and tidied up, or comes back, the sheet has the
120
+ * attribute `data-closing`. Fade the backdrop out with it (`[data-closing]::backdrop`): iOS
121
+ * Safari can leave a dialog's backdrop painted after it closes, so it must be clear by then.
115
122
  */
116
123
  declare function useSwipeToClose(sheetRef: RefObject<HTMLElement | null>, { enabled, scrollRef, onClose, media }: SwipeToCloseOptions): void;
117
124
 
@@ -188,6 +188,7 @@ var CLOSE_DISTANCE_RATIO = 0.25;
188
188
  var CLOSE_VELOCITY = 0.5;
189
189
  var MIN_FLICK_PX = 24;
190
190
  var SETTLE_MS = 220;
191
+ var SLIDE_AWAY_MS = SETTLE_MS + 60;
191
192
  var REOPEN_AFTER_MS = 250;
192
193
  var SETTLE_EASE = "cubic-bezier(0.22, 1, 0.36, 1)";
193
194
  function shouldClose({ offset, height, velocity }) {
@@ -196,6 +197,7 @@ function shouldClose({ offset, height, velocity }) {
196
197
  return velocity >= CLOSE_VELOCITY && offset >= MIN_FLICK_PX;
197
198
  }
198
199
  var INTERACTIVE = 'button, a[href], input, select, textarea, label, summary, [contenteditable=""], [contenteditable="true"], [role="button"], [role="slider"], [data-glass-no-drag]';
200
+ var runs = /* @__PURE__ */ new WeakMap();
199
201
  var prefersReducedMotion = () => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
200
202
  function useSwipeToClose(sheetRef, { enabled, scrollRef, onClose, media = "(max-width: 639.98px)" }) {
201
203
  const onCloseRef = useRef(onClose);
@@ -217,10 +219,13 @@ function useSwipeToClose(sheetRef, { enabled, scrollRef, onClose, media = "(max-
217
219
  sheet.style.transform = "";
218
220
  sheet.style.transition = "";
219
221
  sheet.removeAttribute("data-dragging");
222
+ sheet.removeAttribute("data-closing");
220
223
  };
224
+ runs.set(sheet, (runs.get(sheet) ?? 0) + 1);
221
225
  resetStyles();
222
226
  sheet.style.animation = "";
223
227
  const settleBack = () => {
228
+ sheet.removeAttribute("data-closing");
224
229
  sheet.style.transition = `transform ${SETTLE_MS}ms ${SETTLE_EASE}`;
225
230
  sheet.style.transform = "";
226
231
  timer = setTimeout(resetStyles, SETTLE_MS);
@@ -281,11 +286,12 @@ function useSwipeToClose(sheetRef, { enabled, scrollRef, onClose, media = "(max-
281
286
  const end = () => {
282
287
  if (!drag) return;
283
288
  const wasActive = drag.active === true;
289
+ const wasTouch = drag.pointerId === "touch";
284
290
  const offset = Math.max(0, drag.lastY - drag.startY - DRAG_SLOP_PX);
285
291
  const velocity = performance.now() - drag.lastT > 100 ? 0 : drag.velocity;
286
292
  drag = null;
287
293
  if (!wasActive) return;
288
- suppressClick = true;
294
+ suppressClick = !wasTouch;
289
295
  sheet.removeAttribute("data-dragging");
290
296
  const close = shouldClose({ offset, height: sheet.getBoundingClientRect().height, velocity });
291
297
  const reduceMotion = prefersReducedMotion();
@@ -295,13 +301,11 @@ function useSwipeToClose(sheetRef, { enabled, scrollRef, onClose, media = "(max-
295
301
  return;
296
302
  }
297
303
  closing = true;
298
- if (reduceMotion) {
299
- requestClose(resetStyles);
300
- return;
301
- }
302
- sheet.style.transition = `transform ${SETTLE_MS}ms ${SETTLE_EASE}`;
304
+ sheet.setAttribute("data-closing", "");
305
+ sheet.style.transition = reduceMotion ? "none" : `transform ${SETTLE_MS}ms ${SETTLE_EASE}`;
303
306
  sheet.style.transform = "translate3d(0, 100%, 0)";
304
- timer = setTimeout(() => requestClose(settleBack), SETTLE_MS);
307
+ const comeBack = reduceMotion ? resetStyles : settleBack;
308
+ timer = setTimeout(() => requestClose(comeBack), SLIDE_AWAY_MS);
305
309
  };
306
310
  const cancel = () => {
307
311
  const wasActive = drag?.active === true;
@@ -357,7 +361,12 @@ function useSwipeToClose(sheetRef, { enabled, scrollRef, onClose, media = "(max-
357
361
  return () => {
358
362
  alive = false;
359
363
  clearTimer();
360
- if (!closing) resetStyles();
364
+ const mine = runs.get(sheet);
365
+ setTimeout(() => {
366
+ if (runs.get(sheet) !== mine) return;
367
+ resetStyles();
368
+ sheet.style.animation = "";
369
+ }, SLIDE_AWAY_MS);
361
370
  sheet.removeEventListener("touchstart", onTouchStart);
362
371
  sheet.removeEventListener("touchmove", onTouchMove);
363
372
  sheet.removeEventListener("touchend", onTouchEnd);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/react/Glass.tsx","../../src/react/cx.ts","../../src/react/GlassButton.tsx","../../src/react/GlassFilter.tsx","../../src/react/GlassSheet.tsx","../../src/react/swipe.ts"],"sourcesContent":["import {\n forwardRef,\n type ComponentPropsWithoutRef,\n type ElementType,\n type ForwardedRef,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from 'react';\nimport { cx } from './cx';\n\nexport type GlassTone = 'light' | 'dark' | 'clear' | 'tinted' | 'tinted-secondary' | 'danger';\nexport type GlassThickness = 'thin' | 'regular' | 'thick';\nexport type GlassShape = 'sm' | 'md' | 'lg' | 'xl' | 'pill';\n\nconst TONE_CLASS: Record<GlassTone, string | undefined> = {\n light: undefined,\n dark: 'glass-dark',\n clear: 'glass-clear',\n tinted: 'glass-tinted',\n 'tinted-secondary': 'glass-tinted-secondary',\n danger: 'glass-danger',\n};\n\nconst THICKNESS_CLASS: Record<GlassThickness, string | undefined> = {\n thin: 'glass-thin',\n regular: undefined,\n thick: 'glass-thick',\n};\n\nconst SHAPE_CLASS: Record<GlassShape, string | undefined> = {\n sm: 'glass-sm',\n md: undefined,\n lg: 'glass-lg',\n xl: 'glass-xl',\n pill: 'glass-pill',\n};\n\nexport interface GlassOptions {\n tone?: GlassTone;\n thickness?: GlassThickness;\n shape?: GlassShape;\n /** Hover fill, press-scale and focus ring. Use for clickable surfaces. */\n interactive?: boolean;\n /** Float upward on hover. Use for cards. */\n lift?: boolean;\n /** Chromium-only SVG refraction (no-op elsewhere). Needs <GlassFilter /> mounted once. */\n refract?: boolean;\n}\n\n/** The class list for a glass surface, for elements you can't swap for <Glass>. */\nexport function glassClasses({\n tone = 'light',\n thickness = 'regular',\n shape = 'md',\n interactive = false,\n lift = false,\n refract = false,\n}: GlassOptions = {}): string {\n return cx(\n 'glass',\n TONE_CLASS[tone],\n THICKNESS_CLASS[thickness],\n SHAPE_CLASS[shape],\n interactive && 'glass-interactive',\n lift && 'glass-lift',\n refract && 'glass-refract',\n );\n}\n\nexport type GlassProps<T extends ElementType = 'div'> = GlassOptions & {\n as?: T;\n className?: string;\n children?: ReactNode;\n} & Omit<ComponentPropsWithoutRef<T>, keyof GlassOptions | 'as' | 'className' | 'children'>;\n\nfunction GlassInner<T extends ElementType = 'div'>(\n {\n as,\n tone,\n thickness,\n shape,\n interactive,\n lift,\n refract,\n className,\n children,\n ...rest\n }: GlassProps<T>,\n ref: ForwardedRef<Element>,\n) {\n const Component: ElementType = as ?? 'div';\n return (\n <Component\n ref={ref}\n className={cx(\n glassClasses({ tone, thickness, shape, interactive, lift, refract }),\n className,\n )}\n {...rest}\n >\n {children}\n </Component>\n );\n}\n\n/** A Liquid Glass surface. Polymorphic: `<Glass as=\"nav\" tone=\"dark\" shape=\"pill\">`. */\nexport const Glass = forwardRef(GlassInner) as <T extends ElementType = 'div'>(\n props: GlassProps<T> & { ref?: Ref<Element> },\n) => ReactElement | null;\n","/** Join class names, skipping falsy values. */\nexport function cx(...parts: Array<string | false | null | undefined>): string {\n return parts.filter(Boolean).join(' ');\n}\n","import { forwardRef, type ButtonHTMLAttributes } from 'react';\nimport { cx } from './cx';\n\nexport type GlassButtonVariant = 'glass' | 'dark' | 'clear' | 'primary' | 'secondary' | 'danger';\nexport type GlassButtonSize = 'sm' | 'md' | 'lg';\n\nconst VARIANT_CLASS: Record<GlassButtonVariant, string | undefined> = {\n glass: undefined,\n dark: 'glass-dark',\n clear: 'glass-clear',\n primary: 'glass-tinted',\n secondary: 'glass-tinted-secondary',\n danger: 'glass-danger',\n};\n\nconst SIZE_CLASS: Record<GlassButtonSize, string | undefined> = {\n sm: 'glass-btn-sm',\n md: undefined,\n lg: 'glass-btn-lg',\n};\n\nexport interface GlassButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: GlassButtonVariant;\n size?: GlassButtonSize;\n /** Stretch to the container width. */\n block?: boolean;\n}\n\n/** A glass button with a 44px touch target. Defaults to `type=\"button\"`. */\nexport const GlassButton = forwardRef<HTMLButtonElement, GlassButtonProps>(function GlassButton(\n { variant = 'glass', size = 'md', block = false, className, type = 'button', ...rest },\n ref,\n) {\n return (\n <button\n ref={ref}\n type={type}\n className={cx(\n 'glass-btn',\n VARIANT_CLASS[variant],\n SIZE_CLASS[size],\n block && 'glass-block',\n className,\n )}\n {...rest}\n />\n );\n});\n","import { useEffect } from 'react';\n\n/**\n * True when the browser renders SVG filters inside `backdrop-filter`\n * (currently Chromium only). Safari and Firefox accept the syntax but either\n * ignore it or drop the whole backdrop, so we gate on the engine instead.\n */\nexport function supportsBackdropRefraction(): boolean {\n if (typeof navigator === 'undefined' || typeof CSS === 'undefined') return false;\n const uaData = (navigator as Navigator & { userAgentData?: { brands?: { brand: string }[] } })\n .userAgentData;\n const isChromium = !!uaData?.brands?.some((b) => b.brand === 'Chromium');\n return isChromium && CSS.supports('backdrop-filter', 'url(#lg-refract)');\n}\n\n/**\n * Mount once near the app root. Provides the `#lg-refract` displacement filter\n * used by `.glass-refract` and flags support on <html data-lg-refract>.\n */\nexport function GlassFilter() {\n useEffect(() => {\n if (!supportsBackdropRefraction()) return;\n const root = document.documentElement;\n root.setAttribute('data-lg-refract', '');\n return () => {\n root.removeAttribute('data-lg-refract');\n };\n }, []);\n\n return (\n <svg\n aria-hidden=\"true\"\n focusable=\"false\"\n width=\"0\"\n height=\"0\"\n style={{ position: 'absolute', width: 0, height: 0, overflow: 'hidden' }}\n >\n <filter\n id=\"lg-refract\"\n x=\"0\"\n y=\"0\"\n width=\"100%\"\n height=\"100%\"\n colorInterpolationFilters=\"sRGB\"\n >\n <feTurbulence\n type=\"fractalNoise\"\n baseFrequency=\"0.008 0.012\"\n numOctaves=\"2\"\n seed=\"7\"\n result=\"noise\"\n />\n <feGaussianBlur in=\"noise\" stdDeviation=\"2\" result=\"softNoise\" />\n <feDisplacementMap\n in=\"SourceGraphic\"\n in2=\"softNoise\"\n scale=\"18\"\n xChannelSelector=\"R\"\n yChannelSelector=\"G\"\n />\n </filter>\n </svg>\n );\n}\n","import {\n useEffect,\n useId,\n useRef,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n} from 'react';\nimport { cx } from './cx';\nimport { useSwipeToClose } from './swipe';\n\nexport interface GlassSheetProps {\n open: boolean;\n /** Called when the person closes it: the close button, a swipe down, Esc or a tap outside. */\n onClose: () => void;\n /** Names the dialog (aria-labelledby). */\n title: ReactNode;\n /** Small line above the title, e.g. \"About event\". */\n eyebrow?: ReactNode;\n /** Accessible name of the close button. Translate it. */\n closeLabel?: string;\n /** Pull down to close in the phone (bottom sheet) layout. Default true. */\n swipeToClose?: boolean;\n /** Content pinned under the scrolling body, e.g. actions. */\n footer?: ReactNode;\n children?: ReactNode;\n className?: string;\n bodyClassName?: string;\n}\n\n/** Light dismiss is native where `closedby` is supported; elsewhere it is done below. */\nconst needsLightDismissFallback = () =>\n typeof HTMLDialogElement !== 'undefined' && !('closedBy' in HTMLDialogElement.prototype);\n\nconst isOutside = (e: ReactMouseEvent<HTMLDialogElement>) => {\n const r = e.currentTarget.getBoundingClientRect();\n return e.clientX < r.left || e.clientX > r.right || e.clientY < r.top || e.clientY > r.bottom;\n};\n\nfunction CloseIcon() {\n return (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <path\n d=\"M6 18 18 6M6 6l12 12\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n\n/**\n * A modal sheet on a native <dialog>: the browser makes the page inert, keeps focus inside,\n * closes on Esc and returns focus to the opener. Centred from 640px up; on phones a bottom\n * sheet with a grabber that can be pulled down to close. The close button stays, as the\n * single-tap alternative to the swipe (WCAG 2.5.1 and 2.5.7).\n *\n * Opening focuses the dialog itself rather than the close button, so screen readers start\n * at the title and no focus ring flashes on the ✕ for touch users.\n */\nexport function GlassSheet({\n open,\n onClose,\n title,\n eyebrow,\n closeLabel = 'Close',\n swipeToClose = true,\n footer,\n children,\n className,\n bodyClassName,\n}: GlassSheetProps) {\n const dialogRef = useRef<HTMLDialogElement>(null);\n const bodyRef = useRef<HTMLDivElement>(null);\n const titleId = useId();\n const pressedOutside = useRef(false);\n\n useEffect(() => {\n const dialog = dialogRef.current;\n if (!dialog || open === dialog.hasAttribute('open')) return;\n // Feature-checked: older engines and jsdom lack showModal/close.\n if (open) {\n if (typeof dialog.showModal === 'function') dialog.showModal();\n else dialog.setAttribute('open', '');\n dialog.focus({ preventScroll: true });\n if (bodyRef.current) bodyRef.current.scrollTop = 0;\n } else if (typeof dialog.close === 'function') {\n dialog.close();\n } else {\n dialog.removeAttribute('open');\n }\n }, [open]);\n\n useSwipeToClose(dialogRef, { enabled: open && swipeToClose, scrollRef: bodyRef, onClose });\n\n return (\n <dialog\n ref={dialogRef}\n // Not yet in React's types; React passes it through as an attribute.\n {...{ closedby: 'any' }}\n tabIndex={-1}\n aria-labelledby={titleId}\n // Esc or light dismiss closed it; when `open` is already false the page closed it.\n onClose={() => {\n if (open) onClose();\n }}\n // Without `closedby`: close only when both the press and the release are outside the\n // box, so a text selection dragged onto the backdrop does not dismiss.\n onPointerDown={(e) => {\n pressedOutside.current = needsLightDismissFallback() && isOutside(e);\n }}\n onPointerUp={(e) => {\n if (pressedOutside.current && isOutside(e)) onClose();\n pressedOutside.current = false;\n }}\n className={cx('glass-dialog', className)}\n >\n {swipeToClose && <div className=\"glass-dialog-grabber\" aria-hidden=\"true\" />}\n <header className=\"glass-dialog-header\">\n <div className=\"glass-dialog-heading\">\n {eyebrow && <p className=\"glass-dialog-eyebrow\">{eyebrow}</p>}\n <h2 id={titleId} className=\"glass-dialog-title\">\n {title}\n </h2>\n </div>\n <button\n type=\"button\"\n onClick={onClose}\n aria-label={closeLabel}\n className=\"glass-dialog-close\"\n >\n <CloseIcon />\n </button>\n </header>\n <div ref={bodyRef} className={cx('glass-dialog-body', bodyClassName)}>\n {children}\n </div>\n {footer && <div className=\"glass-dialog-footer\">{footer}</div>}\n </dialog>\n );\n}\n","import { useEffect, useRef, type RefObject } from 'react';\n\n/** Movement (px) before a press counts as a drag, so taps and small jitters stay taps. */\nexport const DRAG_SLOP_PX = 8;\n/** Pull further than this share of the sheet's height and it closes on release. */\nexport const CLOSE_DISTANCE_RATIO = 0.25;\n/** Or flick downward at least this fast (px per ms), however short the pull. */\nexport const CLOSE_VELOCITY = 0.5;\n/** A flick only counts once the sheet has moved this far, so a twitch doesn't close it. */\nexport const MIN_FLICK_PX = 24;\n/** How long the sheet takes to slide away or settle back (ms). */\nexport const SETTLE_MS = 220;\n/**\n * After `onClose`, how long the sheet waits off-screen for its owner to close it (ms). If it\n * is still open by then (the owner kept it, e.g. to ask \"discard changes?\"), it comes back.\n */\nexport const REOPEN_AFTER_MS = 250;\n\nconst SETTLE_EASE = 'cubic-bezier(0.22, 1, 0.36, 1)';\n\nexport interface ReleaseState {\n /** How far the sheet is pulled down (px). */\n offset: number;\n /** The sheet's height (px). */\n height: number;\n /** Downward speed at release (px per ms; negative means moving up). */\n velocity: number;\n}\n\n/** Whether a released drag should close the sheet or let it settle back. */\nexport function shouldClose({ offset, height, velocity }: ReleaseState): boolean {\n if (offset <= 0) return false;\n if (height > 0 && offset >= height * CLOSE_DISTANCE_RATIO) return true;\n return velocity >= CLOSE_VELOCITY && offset >= MIN_FLICK_PX;\n}\n\n/** Controls a press should leave alone: a drag starting on one would steal its tap. */\nconst INTERACTIVE =\n 'button, a[href], input, select, textarea, label, summary, [contenteditable=\"\"], [contenteditable=\"true\"], [role=\"button\"], [role=\"slider\"], [data-glass-no-drag]';\n\nconst prefersReducedMotion = () =>\n typeof window !== 'undefined' &&\n typeof window.matchMedia === 'function' &&\n window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n\nexport interface SwipeToCloseOptions {\n /** Turn the gesture on or off (e.g. only while open, only in the bottom-sheet layout). */\n enabled: boolean;\n /** The scrolling part of the sheet. A press there drags only while it is scrolled to the top. */\n scrollRef?: RefObject<HTMLElement | null>;\n /**\n * Called once the sheet has slid away. The sheet stays off-screen until `enabled` turns\n * false; if that has not happened `REOPEN_AFTER_MS` later, it slides back.\n */\n onClose: () => void;\n /** Media query for when the gesture applies. Default: the phone bottom-sheet layout. */\n media?: string;\n}\n\ninterface Drag {\n pointerId: number | 'touch';\n startX: number;\n startY: number;\n lastY: number;\n lastT: number;\n velocity: number;\n /** Null until the press has moved past the slop and we know whether it is our drag. */\n active: boolean | null;\n}\n\n/**\n * Pull-down-to-close for a sheet. Touch uses touch events, because a pointer-events drag\n * over scrollable content is cancelled by the browser as soon as it starts to pan; with\n * a non-passive touchmove we can stop that pan once the drag is ours. Mouse and pen use\n * pointer events. The sheet follows the finger via an inline transform and either slides\n * away (then `onClose`) or settles back.\n *\n * After a slide-away the inline transform is kept until the effect is torn down (the owner\n * closed the sheet and `enabled` turned false). Clearing it earlier would show the sheet at\n * rest for a frame before the close is committed.\n */\nexport function useSwipeToClose(\n sheetRef: RefObject<HTMLElement | null>,\n { enabled, scrollRef, onClose, media = '(max-width: 639.98px)' }: SwipeToCloseOptions,\n): void {\n const onCloseRef = useRef(onClose);\n onCloseRef.current = onClose;\n\n useEffect(() => {\n const sheet = sheetRef.current;\n if (!enabled || !sheet) return;\n\n let drag: Drag | null = null;\n let suppressClick = false;\n // False once the effect is torn down, so nothing is scheduled on a sheet we let go of.\n let alive = true;\n // True from release until the owner closes the sheet or it comes back.\n let closing = false;\n // The release phases (slide away, wait for the owner, settle back) run one after\n // another, so a single timer handle covers them.\n let timer: ReturnType<typeof setTimeout> | undefined;\n\n const clearTimer = () => {\n clearTimeout(timer);\n timer = undefined;\n };\n\n const applies = () =>\n typeof window.matchMedia !== 'function' || window.matchMedia(media).matches;\n\n const resetStyles = () => {\n sheet.style.transform = '';\n sheet.style.transition = '';\n sheet.removeAttribute('data-dragging');\n };\n\n // A swipe-close leaves its inline styles on the sheet (see the cleanup): start clean.\n resetStyles();\n sheet.style.animation = '';\n\n /** Animate back to rest, then drop the inline styles. */\n const settleBack = () => {\n sheet.style.transition = `transform ${SETTLE_MS}ms ${SETTLE_EASE}`;\n sheet.style.transform = '';\n // A timer, not transitionend: that event never fires if nothing moved or the tab hid.\n timer = setTimeout(resetStyles, SETTLE_MS);\n };\n\n /**\n * Ask the owner to close, leaving the sheet where it is. The effect cleanup clears the\n * styles once the sheet really closes; if it is still open after REOPEN_AFTER_MS,\n * `comeBack` runs.\n */\n const requestClose = (comeBack: () => void) => {\n try {\n onCloseRef.current();\n } finally {\n // The owner may have closed the sheet synchronously, tearing this effect down.\n if (alive) {\n timer = setTimeout(() => {\n closing = false;\n comeBack();\n }, REOPEN_AFTER_MS);\n }\n }\n };\n\n const begin = (id: Drag['pointerId'], x: number, y: number, target: EventTarget | null) => {\n // While closing, the sheet is sliding away or waiting for its owner: leave it be.\n if (drag || closing || !applies()) return;\n const el = target instanceof Element ? target : null;\n if (!el || !sheet.contains(el) || el.closest(INTERACTIVE)) return;\n const scroller = scrollRef?.current;\n if (scroller && scroller.contains(el) && scroller.scrollTop > 0) return;\n // Text selected inside the body: the press is probably adjusting it.\n if (scroller?.contains(el) && window.getSelection()?.isCollapsed === false) return;\n clearTimer();\n drag = {\n pointerId: id,\n startX: x,\n startY: y,\n lastY: y,\n lastT: performance.now(),\n velocity: 0,\n active: null,\n };\n };\n\n /** Returns true while the move belongs to the drag (so the caller can stop scrolling). */\n const move = (x: number, y: number): boolean => {\n if (!drag) return false;\n const dy = y - drag.startY;\n const dx = x - drag.startX;\n if (drag.active === null) {\n if (Math.abs(dy) < DRAG_SLOP_PX && Math.abs(dx) < DRAG_SLOP_PX) return false;\n // Upward or sideways: a scroll or a swipe for something else. Let it go.\n if (dy <= 0 || Math.abs(dx) > Math.abs(dy)) {\n drag = null;\n return false;\n }\n drag.active = true;\n sheet.setAttribute('data-dragging', '');\n sheet.style.transition = 'none';\n // Off until the sheet closes (see cleanup). An open animation with a fill mode would\n // override the inline transform, and switching it off only for the drag would replay\n // it on release.\n sheet.style.animation = 'none';\n }\n const now = performance.now();\n const dt = now - drag.lastT;\n if (dt > 0) drag.velocity = (y - drag.lastY) / dt;\n drag.lastY = y;\n drag.lastT = now;\n sheet.style.transform = `translate3d(0, ${Math.max(0, dy - DRAG_SLOP_PX)}px, 0)`;\n return true;\n };\n\n const end = () => {\n if (!drag) return;\n const wasActive = drag.active === true;\n const offset = Math.max(0, drag.lastY - drag.startY - DRAG_SLOP_PX);\n // A long pause before letting go means the flick is over.\n const velocity = performance.now() - drag.lastT > 100 ? 0 : drag.velocity;\n drag = null;\n if (!wasActive) return;\n suppressClick = true;\n sheet.removeAttribute('data-dragging');\n\n const close = shouldClose({ offset, height: sheet.getBoundingClientRect().height, velocity });\n const reduceMotion = prefersReducedMotion();\n if (!close) {\n if (reduceMotion) resetStyles();\n else settleBack();\n return;\n }\n closing = true;\n if (reduceMotion) {\n // No slide: close from where the finger let go, and snap back if it stays open.\n requestClose(resetStyles);\n return;\n }\n sheet.style.transition = `transform ${SETTLE_MS}ms ${SETTLE_EASE}`;\n sheet.style.transform = 'translate3d(0, 100%, 0)';\n // A timer, not transitionend: that event never fires if nothing moved or the tab hid.\n timer = setTimeout(() => requestClose(settleBack), SETTLE_MS);\n };\n\n const cancel = () => {\n const wasActive = drag?.active === true;\n drag = null;\n if (wasActive) resetStyles();\n };\n\n // Touch\n const onTouchStart = (e: TouchEvent) => {\n const t = e.touches[0];\n if (e.touches.length !== 1 || !t) return cancel();\n begin('touch', t.clientX, t.clientY, e.target);\n };\n const onTouchMove = (e: TouchEvent) => {\n const t = e.touches[0];\n if (!t || drag?.pointerId !== 'touch') return;\n if (move(t.clientX, t.clientY) && e.cancelable) e.preventDefault();\n };\n const onTouchEnd = () => {\n if (drag?.pointerId === 'touch') end();\n };\n\n // Mouse and pen (touch is handled above)\n const onPointerDown = (e: PointerEvent) => {\n if (e.pointerType === 'touch' || e.button !== 0) return;\n begin(e.pointerId, e.clientX, e.clientY, e.target);\n };\n const onPointerMove = (e: PointerEvent) => {\n if (drag?.pointerId !== e.pointerId) return;\n if (move(e.clientX, e.clientY)) e.preventDefault();\n };\n const onPointerUp = (e: PointerEvent) => {\n if (drag?.pointerId === e.pointerId) end();\n };\n const onPointerCancel = (e: PointerEvent) => {\n if (drag?.pointerId === e.pointerId) cancel();\n };\n\n // A mouse drag ends with a click on whatever is under it; that click must not count.\n const onClickCapture = (e: MouseEvent) => {\n if (!suppressClick) return;\n suppressClick = false;\n e.preventDefault();\n e.stopPropagation();\n };\n const clearSuppress = () => {\n suppressClick = false;\n };\n\n sheet.addEventListener('touchstart', onTouchStart, { passive: true });\n sheet.addEventListener('touchmove', onTouchMove, { passive: false });\n sheet.addEventListener('touchend', onTouchEnd);\n sheet.addEventListener('touchcancel', cancel);\n sheet.addEventListener('pointerdown', onPointerDown);\n sheet.addEventListener('click', onClickCapture, true);\n window.addEventListener('pointermove', onPointerMove);\n window.addEventListener('pointerup', onPointerUp);\n window.addEventListener('pointercancel', onPointerCancel);\n window.addEventListener('pointerdown', clearSuppress, true);\n\n return () => {\n alive = false;\n clearTimer();\n // Leave the open animation off, and after a swipe-close leave the sheet where it is,\n // off-screen. Restarting the animation or moving the sheet in the same frame as the\n // owner closes it is the suspected cause of the dialog backdrop staying painted on iOS\n // Safari. The next run starts clean (above).\n if (!closing) resetStyles();\n sheet.removeEventListener('touchstart', onTouchStart);\n sheet.removeEventListener('touchmove', onTouchMove);\n sheet.removeEventListener('touchend', onTouchEnd);\n sheet.removeEventListener('touchcancel', cancel);\n sheet.removeEventListener('pointerdown', onPointerDown);\n sheet.removeEventListener('click', onClickCapture, true);\n window.removeEventListener('pointermove', onPointerMove);\n window.removeEventListener('pointerup', onPointerUp);\n window.removeEventListener('pointercancel', onPointerCancel);\n window.removeEventListener('pointerdown', clearSuppress, true);\n };\n }, [enabled, media, scrollRef, sheetRef]);\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,OAOK;;;ACPA,SAAS,MAAM,OAAyD;AAC7E,SAAO,MAAM,OAAO,OAAO,EAAE,KAAK,GAAG;AACvC;;;AD0FI;AA9EJ,IAAM,aAAoD;AAAA,EACxD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,oBAAoB;AAAA,EACpB,QAAQ;AACV;AAEA,IAAM,kBAA8D;AAAA,EAClE,MAAM;AAAA,EACN,SAAS;AAAA,EACT,OAAO;AACT;AAEA,IAAM,cAAsD;AAAA,EAC1D,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,MAAM;AACR;AAeO,SAAS,aAAa;AAAA,EAC3B,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,OAAO;AAAA,EACP,UAAU;AACZ,IAAkB,CAAC,GAAW;AAC5B,SAAO;AAAA,IACL;AAAA,IACA,WAAW,IAAI;AAAA,IACf,gBAAgB,SAAS;AAAA,IACzB,YAAY,KAAK;AAAA,IACjB,eAAe;AAAA,IACf,QAAQ;AAAA,IACR,WAAW;AAAA,EACb;AACF;AAQA,SAAS,WACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AA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,0BAAAA,KAAC,aAAU;AAAA;AAAA,UACb;AAAA,WACF;AAAA,QACA,gBAAAA,KAAC,SAAI,KAAK,SAAS,WAAW,GAAG,qBAAqB,aAAa,GAChE,UACH;AAAA,QACC,UAAU,gBAAAA,KAAC,SAAI,WAAU,uBAAuB,kBAAO;AAAA;AAAA;AAAA,EAC1D;AAEJ;","names":["forwardRef","jsx","forwardRef","GlassButton","jsx","useEffect","useRef","useEffect","jsx","jsxs","useRef","useEffect"]}
1
+ {"version":3,"sources":["../../src/react/Glass.tsx","../../src/react/cx.ts","../../src/react/GlassButton.tsx","../../src/react/GlassFilter.tsx","../../src/react/GlassSheet.tsx","../../src/react/swipe.ts"],"sourcesContent":["import {\n forwardRef,\n type ComponentPropsWithoutRef,\n type ElementType,\n type ForwardedRef,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from 'react';\nimport { cx } from './cx';\n\nexport type GlassTone = 'light' | 'dark' | 'clear' | 'tinted' | 'tinted-secondary' | 'danger';\nexport type GlassThickness = 'thin' | 'regular' | 'thick';\nexport type GlassShape = 'sm' | 'md' | 'lg' | 'xl' | 'pill';\n\nconst TONE_CLASS: Record<GlassTone, string | undefined> = {\n light: undefined,\n dark: 'glass-dark',\n clear: 'glass-clear',\n tinted: 'glass-tinted',\n 'tinted-secondary': 'glass-tinted-secondary',\n danger: 'glass-danger',\n};\n\nconst THICKNESS_CLASS: Record<GlassThickness, string | undefined> = {\n thin: 'glass-thin',\n regular: undefined,\n thick: 'glass-thick',\n};\n\nconst SHAPE_CLASS: Record<GlassShape, string | undefined> = {\n sm: 'glass-sm',\n md: undefined,\n lg: 'glass-lg',\n xl: 'glass-xl',\n pill: 'glass-pill',\n};\n\nexport interface GlassOptions {\n tone?: GlassTone;\n thickness?: GlassThickness;\n shape?: GlassShape;\n /** Hover fill, press-scale and focus ring. Use for clickable surfaces. */\n interactive?: boolean;\n /** Float upward on hover. Use for cards. */\n lift?: boolean;\n /** Chromium-only SVG refraction (no-op elsewhere). Needs <GlassFilter /> mounted once. */\n refract?: boolean;\n}\n\n/** The class list for a glass surface, for elements you can't swap for <Glass>. */\nexport function glassClasses({\n tone = 'light',\n thickness = 'regular',\n shape = 'md',\n interactive = false,\n lift = false,\n refract = false,\n}: GlassOptions = {}): string {\n return cx(\n 'glass',\n TONE_CLASS[tone],\n THICKNESS_CLASS[thickness],\n SHAPE_CLASS[shape],\n interactive && 'glass-interactive',\n lift && 'glass-lift',\n refract && 'glass-refract',\n );\n}\n\nexport type GlassProps<T extends ElementType = 'div'> = GlassOptions & {\n as?: T;\n className?: string;\n children?: ReactNode;\n} & Omit<ComponentPropsWithoutRef<T>, keyof GlassOptions | 'as' | 'className' | 'children'>;\n\nfunction GlassInner<T extends ElementType = 'div'>(\n {\n as,\n tone,\n thickness,\n shape,\n interactive,\n lift,\n refract,\n className,\n children,\n ...rest\n }: GlassProps<T>,\n ref: ForwardedRef<Element>,\n) {\n const Component: ElementType = as ?? 'div';\n return (\n <Component\n ref={ref}\n className={cx(\n glassClasses({ tone, thickness, shape, interactive, lift, refract }),\n className,\n )}\n {...rest}\n >\n {children}\n </Component>\n );\n}\n\n/** A Liquid Glass surface. Polymorphic: `<Glass as=\"nav\" tone=\"dark\" shape=\"pill\">`. */\nexport const Glass = forwardRef(GlassInner) as <T extends ElementType = 'div'>(\n props: GlassProps<T> & { ref?: Ref<Element> },\n) => ReactElement | null;\n","/** Join class names, skipping falsy values. */\nexport function cx(...parts: Array<string | false | null | undefined>): string {\n return parts.filter(Boolean).join(' ');\n}\n","import { forwardRef, type ButtonHTMLAttributes } from 'react';\nimport { cx } from './cx';\n\nexport type GlassButtonVariant = 'glass' | 'dark' | 'clear' | 'primary' | 'secondary' | 'danger';\nexport type GlassButtonSize = 'sm' | 'md' | 'lg';\n\nconst VARIANT_CLASS: Record<GlassButtonVariant, string | undefined> = {\n glass: undefined,\n dark: 'glass-dark',\n clear: 'glass-clear',\n primary: 'glass-tinted',\n secondary: 'glass-tinted-secondary',\n danger: 'glass-danger',\n};\n\nconst SIZE_CLASS: Record<GlassButtonSize, string | undefined> = {\n sm: 'glass-btn-sm',\n md: undefined,\n lg: 'glass-btn-lg',\n};\n\nexport interface GlassButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: GlassButtonVariant;\n size?: GlassButtonSize;\n /** Stretch to the container width. */\n block?: boolean;\n}\n\n/** A glass button with a 44px touch target. Defaults to `type=\"button\"`. */\nexport const GlassButton = forwardRef<HTMLButtonElement, GlassButtonProps>(function GlassButton(\n { variant = 'glass', size = 'md', block = false, className, type = 'button', ...rest },\n ref,\n) {\n return (\n <button\n ref={ref}\n type={type}\n className={cx(\n 'glass-btn',\n VARIANT_CLASS[variant],\n SIZE_CLASS[size],\n block && 'glass-block',\n className,\n )}\n {...rest}\n />\n );\n});\n","import { useEffect } from 'react';\n\n/**\n * True when the browser renders SVG filters inside `backdrop-filter`\n * (currently Chromium only). Safari and Firefox accept the syntax but either\n * ignore it or drop the whole backdrop, so we gate on the engine instead.\n */\nexport function supportsBackdropRefraction(): boolean {\n if (typeof navigator === 'undefined' || typeof CSS === 'undefined') return false;\n const uaData = (navigator as Navigator & { userAgentData?: { brands?: { brand: string }[] } })\n .userAgentData;\n const isChromium = !!uaData?.brands?.some((b) => b.brand === 'Chromium');\n return isChromium && CSS.supports('backdrop-filter', 'url(#lg-refract)');\n}\n\n/**\n * Mount once near the app root. Provides the `#lg-refract` displacement filter\n * used by `.glass-refract` and flags support on <html data-lg-refract>.\n */\nexport function GlassFilter() {\n useEffect(() => {\n if (!supportsBackdropRefraction()) return;\n const root = document.documentElement;\n root.setAttribute('data-lg-refract', '');\n return () => {\n root.removeAttribute('data-lg-refract');\n };\n }, []);\n\n return (\n <svg\n aria-hidden=\"true\"\n focusable=\"false\"\n width=\"0\"\n height=\"0\"\n style={{ position: 'absolute', width: 0, height: 0, overflow: 'hidden' }}\n >\n <filter\n id=\"lg-refract\"\n x=\"0\"\n y=\"0\"\n width=\"100%\"\n height=\"100%\"\n colorInterpolationFilters=\"sRGB\"\n >\n <feTurbulence\n type=\"fractalNoise\"\n baseFrequency=\"0.008 0.012\"\n numOctaves=\"2\"\n seed=\"7\"\n result=\"noise\"\n />\n <feGaussianBlur in=\"noise\" stdDeviation=\"2\" result=\"softNoise\" />\n <feDisplacementMap\n in=\"SourceGraphic\"\n in2=\"softNoise\"\n scale=\"18\"\n xChannelSelector=\"R\"\n yChannelSelector=\"G\"\n />\n </filter>\n </svg>\n );\n}\n","import {\n useEffect,\n useId,\n useRef,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n} from 'react';\nimport { cx } from './cx';\nimport { useSwipeToClose } from './swipe';\n\nexport interface GlassSheetProps {\n open: boolean;\n /** Called when the person closes it: the close button, a swipe down, Esc or a tap outside. */\n onClose: () => void;\n /** Names the dialog (aria-labelledby). */\n title: ReactNode;\n /** Small line above the title, e.g. \"About event\". */\n eyebrow?: ReactNode;\n /** Accessible name of the close button. Translate it. */\n closeLabel?: string;\n /** Pull down to close in the phone (bottom sheet) layout. Default true. */\n swipeToClose?: boolean;\n /** Content pinned under the scrolling body, e.g. actions. */\n footer?: ReactNode;\n children?: ReactNode;\n className?: string;\n bodyClassName?: string;\n}\n\n/** Light dismiss is native where `closedby` is supported; elsewhere it is done below. */\nconst needsLightDismissFallback = () =>\n typeof HTMLDialogElement !== 'undefined' && !('closedBy' in HTMLDialogElement.prototype);\n\nconst isOutside = (e: ReactMouseEvent<HTMLDialogElement>) => {\n const r = e.currentTarget.getBoundingClientRect();\n return e.clientX < r.left || e.clientX > r.right || e.clientY < r.top || e.clientY > r.bottom;\n};\n\nfunction CloseIcon() {\n return (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <path\n d=\"M6 18 18 6M6 6l12 12\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n\n/**\n * A modal sheet on a native <dialog>: the browser makes the page inert, keeps focus inside,\n * closes on Esc and returns focus to the opener. Centred from 640px up; on phones a bottom\n * sheet with a grabber that can be pulled down to close. The close button stays, as the\n * single-tap alternative to the swipe (WCAG 2.5.1 and 2.5.7).\n *\n * Opening focuses the dialog itself rather than the close button, so screen readers start\n * at the title and no focus ring flashes on the ✕ for touch users.\n */\nexport function GlassSheet({\n open,\n onClose,\n title,\n eyebrow,\n closeLabel = 'Close',\n swipeToClose = true,\n footer,\n children,\n className,\n bodyClassName,\n}: GlassSheetProps) {\n const dialogRef = useRef<HTMLDialogElement>(null);\n const bodyRef = useRef<HTMLDivElement>(null);\n const titleId = useId();\n const pressedOutside = useRef(false);\n\n useEffect(() => {\n const dialog = dialogRef.current;\n if (!dialog || open === dialog.hasAttribute('open')) return;\n // Feature-checked: older engines and jsdom lack showModal/close.\n if (open) {\n if (typeof dialog.showModal === 'function') dialog.showModal();\n else dialog.setAttribute('open', '');\n dialog.focus({ preventScroll: true });\n if (bodyRef.current) bodyRef.current.scrollTop = 0;\n } else if (typeof dialog.close === 'function') {\n dialog.close();\n } else {\n dialog.removeAttribute('open');\n }\n }, [open]);\n\n useSwipeToClose(dialogRef, { enabled: open && swipeToClose, scrollRef: bodyRef, onClose });\n\n return (\n <dialog\n ref={dialogRef}\n // Not yet in React's types; React passes it through as an attribute.\n {...{ closedby: 'any' }}\n tabIndex={-1}\n aria-labelledby={titleId}\n // Esc or light dismiss closed it; when `open` is already false the page closed it.\n onClose={() => {\n if (open) onClose();\n }}\n // Without `closedby`: close only when both the press and the release are outside the\n // box, so a text selection dragged onto the backdrop does not dismiss.\n onPointerDown={(e) => {\n pressedOutside.current = needsLightDismissFallback() && isOutside(e);\n }}\n onPointerUp={(e) => {\n if (pressedOutside.current && isOutside(e)) onClose();\n pressedOutside.current = false;\n }}\n className={cx('glass-dialog', className)}\n >\n {swipeToClose && <div className=\"glass-dialog-grabber\" aria-hidden=\"true\" />}\n <header className=\"glass-dialog-header\">\n <div className=\"glass-dialog-heading\">\n {eyebrow && <p className=\"glass-dialog-eyebrow\">{eyebrow}</p>}\n <h2 id={titleId} className=\"glass-dialog-title\">\n {title}\n </h2>\n </div>\n <button\n type=\"button\"\n onClick={onClose}\n aria-label={closeLabel}\n className=\"glass-dialog-close\"\n >\n <CloseIcon />\n </button>\n </header>\n <div ref={bodyRef} className={cx('glass-dialog-body', bodyClassName)}>\n {children}\n </div>\n {footer && <div className=\"glass-dialog-footer\">{footer}</div>}\n </dialog>\n );\n}\n","import { useEffect, useRef, type RefObject } from 'react';\n\n/** Movement (px) before a press counts as a drag, so taps and small jitters stay taps. */\nexport const DRAG_SLOP_PX = 8;\n/** Pull further than this share of the sheet's height and it closes on release. */\nexport const CLOSE_DISTANCE_RATIO = 0.25;\n/** Or flick downward at least this fast (px per ms), however short the pull. */\nexport const CLOSE_VELOCITY = 0.5;\n/** A flick only counts once the sheet has moved this far, so a twitch doesn't close it. */\nexport const MIN_FLICK_PX = 24;\n/** How long the sheet takes to slide away or settle back (ms). */\nexport const SETTLE_MS = 220;\n/**\n * How long after release the owner is asked to close (ms): the slide-away plus a margin, so\n * the transition has really finished. Closing a dialog while its transform is still moving\n * is one more thing iOS Safari may get wrong.\n */\nexport const SLIDE_AWAY_MS = SETTLE_MS + 60;\n/**\n * After `onClose`, how long the sheet waits off-screen for its owner to close it (ms). If it\n * is still open by then (the owner kept it, e.g. to ask \"discard changes?\"), it comes back.\n */\nexport const REOPEN_AFTER_MS = 250;\n\nconst SETTLE_EASE = 'cubic-bezier(0.22, 1, 0.36, 1)';\n\nexport interface ReleaseState {\n /** How far the sheet is pulled down (px). */\n offset: number;\n /** The sheet's height (px). */\n height: number;\n /** Downward speed at release (px per ms; negative means moving up). */\n velocity: number;\n}\n\n/** Whether a released drag should close the sheet or let it settle back. */\nexport function shouldClose({ offset, height, velocity }: ReleaseState): boolean {\n if (offset <= 0) return false;\n if (height > 0 && offset >= height * CLOSE_DISTANCE_RATIO) return true;\n return velocity >= CLOSE_VELOCITY && offset >= MIN_FLICK_PX;\n}\n\n/** Controls a press should leave alone: a drag starting on one would steal its tap. */\nconst INTERACTIVE =\n 'button, a[href], input, select, textarea, label, summary, [contenteditable=\"\"], [contenteditable=\"true\"], [role=\"button\"], [role=\"slider\"], [data-glass-no-drag]';\n\n/** Counts the hook runs per sheet, so a late tidy-up never touches a sheet that is in use again. */\nconst runs = new WeakMap<HTMLElement, number>();\n\nconst prefersReducedMotion = () =>\n typeof window !== 'undefined' &&\n typeof window.matchMedia === 'function' &&\n window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n\nexport interface SwipeToCloseOptions {\n /** Turn the gesture on or off (e.g. only while open, only in the bottom-sheet layout). */\n enabled: boolean;\n /** The scrolling part of the sheet. A press there drags only while it is scrolled to the top. */\n scrollRef?: RefObject<HTMLElement | null>;\n /**\n * Called once the sheet has slid away. The sheet stays off-screen until `enabled` turns\n * false; if that has not happened `REOPEN_AFTER_MS` later, it slides back.\n *\n * From release until the sheet is closed and tidied up (or comes back) it carries\n * `data-closing`. Style the backdrop with it, so the dim is gone before the close.\n */\n onClose: () => void;\n /** Media query for when the gesture applies. Default: the phone bottom-sheet layout. */\n media?: string;\n}\n\ninterface Drag {\n pointerId: number | 'touch';\n startX: number;\n startY: number;\n lastY: number;\n lastT: number;\n velocity: number;\n /** Null until the press has moved past the slop and we know whether it is our drag. */\n active: boolean | null;\n}\n\n/**\n * Pull-down-to-close for a sheet. Touch uses touch events, because a pointer-events drag\n * over scrollable content is cancelled by the browser as soon as it starts to pan; with\n * a non-passive touchmove we can stop that pan once the drag is ours. Mouse and pen use\n * pointer events. The sheet follows the finger via an inline transform and either slides\n * away (then `onClose`) or settles back.\n *\n * After a slide-away the inline transform is kept until the effect is torn down (the owner\n * closed the sheet and `enabled` turned false). Clearing it earlier would show the sheet at\n * rest for a frame before the close is committed.\n *\n * From release until the sheet is closed and tidied up, or comes back, the sheet has the\n * attribute `data-closing`. Fade the backdrop out with it (`[data-closing]::backdrop`): iOS\n * Safari can leave a dialog's backdrop painted after it closes, so it must be clear by then.\n */\nexport function useSwipeToClose(\n sheetRef: RefObject<HTMLElement | null>,\n { enabled, scrollRef, onClose, media = '(max-width: 639.98px)' }: SwipeToCloseOptions,\n): void {\n const onCloseRef = useRef(onClose);\n onCloseRef.current = onClose;\n\n useEffect(() => {\n const sheet = sheetRef.current;\n if (!enabled || !sheet) return;\n\n let drag: Drag | null = null;\n let suppressClick = false;\n // False once the effect is torn down, so nothing is scheduled on a sheet we let go of.\n let alive = true;\n // True from release until the owner closes the sheet or it comes back.\n let closing = false;\n // The release phases (slide away, wait for the owner, settle back) run one after\n // another, so a single timer handle covers them.\n let timer: ReturnType<typeof setTimeout> | undefined;\n\n const clearTimer = () => {\n clearTimeout(timer);\n timer = undefined;\n };\n\n const applies = () =>\n typeof window.matchMedia !== 'function' || window.matchMedia(media).matches;\n\n const resetStyles = () => {\n sheet.style.transform = '';\n sheet.style.transition = '';\n sheet.removeAttribute('data-dragging');\n sheet.removeAttribute('data-closing');\n };\n\n // Start clean: an earlier run may have left its inline styles (see the cleanup).\n runs.set(sheet, (runs.get(sheet) ?? 0) + 1);\n resetStyles();\n sheet.style.animation = '';\n\n /** Animate back to rest, then drop the inline styles. */\n const settleBack = () => {\n // Now, not once it has settled: the backdrop fades back in while the sheet slides up.\n sheet.removeAttribute('data-closing');\n sheet.style.transition = `transform ${SETTLE_MS}ms ${SETTLE_EASE}`;\n sheet.style.transform = '';\n // A timer, not transitionend: that event never fires if nothing moved or the tab hid.\n timer = setTimeout(resetStyles, SETTLE_MS);\n };\n\n /**\n * Ask the owner to close, leaving the sheet where it is. The effect cleanup clears the\n * styles once the sheet really closes; if it is still open after REOPEN_AFTER_MS,\n * `comeBack` runs.\n */\n const requestClose = (comeBack: () => void) => {\n try {\n onCloseRef.current();\n } finally {\n // The owner may have closed the sheet synchronously, tearing this effect down.\n if (alive) {\n timer = setTimeout(() => {\n closing = false;\n comeBack();\n }, REOPEN_AFTER_MS);\n }\n }\n };\n\n const begin = (id: Drag['pointerId'], x: number, y: number, target: EventTarget | null) => {\n // While closing, the sheet is sliding away or waiting for its owner: leave it be.\n if (drag || closing || !applies()) return;\n const el = target instanceof Element ? target : null;\n if (!el || !sheet.contains(el) || el.closest(INTERACTIVE)) return;\n const scroller = scrollRef?.current;\n if (scroller && scroller.contains(el) && scroller.scrollTop > 0) return;\n // Text selected inside the body: the press is probably adjusting it.\n if (scroller?.contains(el) && window.getSelection()?.isCollapsed === false) return;\n clearTimer();\n drag = {\n pointerId: id,\n startX: x,\n startY: y,\n lastY: y,\n lastT: performance.now(),\n velocity: 0,\n active: null,\n };\n };\n\n /** Returns true while the move belongs to the drag (so the caller can stop scrolling). */\n const move = (x: number, y: number): boolean => {\n if (!drag) return false;\n const dy = y - drag.startY;\n const dx = x - drag.startX;\n if (drag.active === null) {\n if (Math.abs(dy) < DRAG_SLOP_PX && Math.abs(dx) < DRAG_SLOP_PX) return false;\n // Upward or sideways: a scroll or a swipe for something else. Let it go.\n if (dy <= 0 || Math.abs(dx) > Math.abs(dy)) {\n drag = null;\n return false;\n }\n drag.active = true;\n sheet.setAttribute('data-dragging', '');\n sheet.style.transition = 'none';\n // Off until the sheet closes (see cleanup). An open animation with a fill mode would\n // override the inline transform, and switching it off only for the drag would replay\n // it on release.\n sheet.style.animation = 'none';\n }\n const now = performance.now();\n const dt = now - drag.lastT;\n if (dt > 0) drag.velocity = (y - drag.lastY) / dt;\n drag.lastY = y;\n drag.lastT = now;\n sheet.style.transform = `translate3d(0, ${Math.max(0, dy - DRAG_SLOP_PX)}px, 0)`;\n return true;\n };\n\n const end = () => {\n if (!drag) return;\n const wasActive = drag.active === true;\n const wasTouch = drag.pointerId === 'touch';\n const offset = Math.max(0, drag.lastY - drag.startY - DRAG_SLOP_PX);\n // A long pause before letting go means the flick is over.\n const velocity = performance.now() - drag.lastT > 100 ? 0 : drag.velocity;\n drag = null;\n if (!wasActive) return;\n // Only a mouse or pen drag ends in a click to swallow. A touch drag does not, and the\n // flag would then eat the next real activation (e.g. from a screen reader).\n suppressClick = !wasTouch;\n sheet.removeAttribute('data-dragging');\n\n const close = shouldClose({ offset, height: sheet.getBoundingClientRect().height, velocity });\n const reduceMotion = prefersReducedMotion();\n if (!close) {\n if (reduceMotion) resetStyles();\n else settleBack();\n return;\n }\n closing = true;\n // The backdrop fades out from now, so nothing dark is left to repaint at the close.\n sheet.setAttribute('data-closing', '');\n // Reduced motion: no slide, the sheet goes at once. The close still waits, so it never\n // lands in the frame the backdrop changes.\n sheet.style.transition = reduceMotion ? 'none' : `transform ${SETTLE_MS}ms ${SETTLE_EASE}`;\n sheet.style.transform = 'translate3d(0, 100%, 0)';\n // A timer, not transitionend: that event never fires if nothing moved or the tab hid.\n const comeBack = reduceMotion ? resetStyles : settleBack;\n timer = setTimeout(() => requestClose(comeBack), SLIDE_AWAY_MS);\n };\n\n const cancel = () => {\n const wasActive = drag?.active === true;\n drag = null;\n if (wasActive) resetStyles();\n };\n\n // Touch\n const onTouchStart = (e: TouchEvent) => {\n const t = e.touches[0];\n if (e.touches.length !== 1 || !t) return cancel();\n begin('touch', t.clientX, t.clientY, e.target);\n };\n const onTouchMove = (e: TouchEvent) => {\n const t = e.touches[0];\n if (!t || drag?.pointerId !== 'touch') return;\n if (move(t.clientX, t.clientY) && e.cancelable) e.preventDefault();\n };\n const onTouchEnd = () => {\n if (drag?.pointerId === 'touch') end();\n };\n\n // Mouse and pen (touch is handled above)\n const onPointerDown = (e: PointerEvent) => {\n if (e.pointerType === 'touch' || e.button !== 0) return;\n begin(e.pointerId, e.clientX, e.clientY, e.target);\n };\n const onPointerMove = (e: PointerEvent) => {\n if (drag?.pointerId !== e.pointerId) return;\n if (move(e.clientX, e.clientY)) e.preventDefault();\n };\n const onPointerUp = (e: PointerEvent) => {\n if (drag?.pointerId === e.pointerId) end();\n };\n const onPointerCancel = (e: PointerEvent) => {\n if (drag?.pointerId === e.pointerId) cancel();\n };\n\n // A mouse drag ends with a click on whatever is under it; that click must not count.\n const onClickCapture = (e: MouseEvent) => {\n if (!suppressClick) return;\n suppressClick = false;\n e.preventDefault();\n e.stopPropagation();\n };\n const clearSuppress = () => {\n suppressClick = false;\n };\n\n sheet.addEventListener('touchstart', onTouchStart, { passive: true });\n sheet.addEventListener('touchmove', onTouchMove, { passive: false });\n sheet.addEventListener('touchend', onTouchEnd);\n sheet.addEventListener('touchcancel', cancel);\n sheet.addEventListener('pointerdown', onPointerDown);\n sheet.addEventListener('click', onClickCapture, true);\n window.addEventListener('pointermove', onPointerMove);\n window.addEventListener('pointerup', onPointerUp);\n window.addEventListener('pointercancel', onPointerCancel);\n window.addEventListener('pointerdown', clearSuppress, true);\n\n return () => {\n alive = false;\n clearTimer();\n // Never change the sheet in the frame it closes: moving it or restarting its open\n // animation together with dialog.close() is the suspected cause of the backdrop staying\n // painted on iOS Safari. Tidy up a moment later (styles and `data-closing`), unless the\n // sheet is in use again.\n const mine = runs.get(sheet);\n setTimeout(() => {\n if (runs.get(sheet) !== mine) return;\n resetStyles();\n sheet.style.animation = '';\n }, SLIDE_AWAY_MS);\n sheet.removeEventListener('touchstart', onTouchStart);\n sheet.removeEventListener('touchmove', onTouchMove);\n sheet.removeEventListener('touchend', onTouchEnd);\n sheet.removeEventListener('touchcancel', cancel);\n sheet.removeEventListener('pointerdown', onPointerDown);\n sheet.removeEventListener('click', onClickCapture, true);\n window.removeEventListener('pointermove', onPointerMove);\n window.removeEventListener('pointerup', onPointerUp);\n window.removeEventListener('pointercancel', onPointerCancel);\n window.removeEventListener('pointerdown', clearSuppress, true);\n };\n }, [enabled, media, scrollRef, sheetRef]);\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,OAOK;;;ACPA,SAAS,MAAM,OAAyD;AAC7E,SAAO,MAAM,OAAO,OAAO,EAAE,KAAK,GAAG;AACvC;;;AD0FI;AA9EJ,IAAM,aAAoD;AAAA,EACxD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,oBAAoB;AAAA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useRef","useEffect"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sofyan/glass",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Liquid Glass material for the web: CSS (Tailwind v4 friendly) and React components, including a swipe-to-close sheet.",
5
5
  "license": "MIT",
6
6
  "private": false,