@cloudlet/toast 1.4.0-rc.1 → 1.5.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/CHANGELOG.md +181 -0
- package/README.md +30 -5
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +19 -15
- package/dist/agent.js.map +1 -1
- package/dist/center-react.d.ts +286 -0
- package/dist/center-react.d.ts.map +1 -0
- package/dist/center-react.js +2 -0
- package/dist/center.d.ts +3 -0
- package/dist/center.d.ts.map +1 -0
- package/dist/center.js +1 -0
- package/dist/core/agent-port.d.ts +2 -0
- package/dist/core/agent-port.d.ts.map +1 -1
- package/dist/core/agent-port.js +3 -0
- package/dist/core/agent-port.js.map +1 -1
- package/dist/react/card.d.ts +4 -0
- package/dist/react/card.d.ts.map +1 -1
- package/dist/react/card.js +3 -8
- package/dist/react/card.js.map +1 -1
- package/dist/react/center-backdrop.d.ts +69 -0
- package/dist/react/center-backdrop.d.ts.map +1 -0
- package/dist/react/center-backdrop.js +81 -0
- package/dist/react/center-backdrop.js.map +1 -0
- package/dist/react/center-clear.d.ts +16 -0
- package/dist/react/center-clear.d.ts.map +1 -0
- package/dist/react/center-clear.js +24 -0
- package/dist/react/center-clear.js.map +1 -0
- package/dist/react/center-gestures.d.ts +47 -0
- package/dist/react/center-gestures.d.ts.map +1 -0
- package/dist/react/center-gestures.js +74 -0
- package/dist/react/center-gestures.js.map +1 -0
- package/dist/react/center-motion.d.ts +174 -0
- package/dist/react/center-motion.d.ts.map +1 -0
- package/dist/react/center-motion.js +344 -0
- package/dist/react/center-motion.js.map +1 -0
- package/dist/react/center.d.ts +15 -0
- package/dist/react/center.d.ts.map +1 -0
- package/dist/react/center.js +1287 -0
- package/dist/react/center.js.map +1 -0
- package/dist/react/focus.d.ts +7 -0
- package/dist/react/focus.d.ts.map +1 -0
- package/dist/react/focus.js +14 -0
- package/dist/react/focus.js.map +1 -0
- package/dist/react/gestures.d.ts +33 -2
- package/dist/react/gestures.d.ts.map +1 -1
- package/dist/react/gestures.js +181 -149
- package/dist/react/gestures.js.map +1 -1
- package/dist/react/host.d.ts.map +1 -1
- package/dist/react/host.js +287 -283
- package/dist/react/host.js.map +1 -1
- package/dist/react/motion.d.ts +18 -11
- package/dist/react/motion.d.ts.map +1 -1
- package/dist/react/motion.js +6 -3
- package/dist/react/motion.js.map +1 -1
- package/dist/react/reduced.d.ts +24 -0
- package/dist/react/reduced.d.ts.map +1 -0
- package/dist/react/reduced.js +35 -0
- package/dist/react/reduced.js.map +1 -0
- package/dist/react/zoom.d.ts +12 -0
- package/dist/react/zoom.d.ts.map +1 -0
- package/dist/react/zoom.js +21 -0
- package/dist/react/zoom.js.map +1 -0
- package/dist/react.d.ts +4 -0
- package/dist/react.d.ts.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -2
- package/src/agent.ts +11 -6
- package/src/center-react.ts +300 -0
- package/src/center.ts +27 -0
- package/src/core/agent-port.ts +3 -0
- package/src/react/card.tsx +5 -6
- package/src/react/center-backdrop.tsx +151 -0
- package/src/react/center-clear.ts +56 -0
- package/src/react/center-gestures.ts +143 -0
- package/src/react/center-motion.ts +504 -0
- package/src/react/center.tsx +1557 -0
- package/src/react/focus.ts +18 -0
- package/src/react/gestures.ts +127 -37
- package/src/react/host.tsx +17 -5
- package/src/react/motion.ts +16 -9
- package/src/react/reduced.ts +52 -0
- package/src/react/zoom.ts +26 -0
- package/src/react.ts +4 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"center.js","names":["_Fragment","kinds","MINUTE","HOUR","DAY","TICK","ANNOUNCE","FLING_WINDOW","dates","shortDate","format","lang","time","relative","age","now","defaultCenterLabels","kind","key","label","count","links","centerButtons","link","element","buttonsInOrder","a","b","connectButtons","own","released","returned","settling","settle","others","other","cleanups","pressed","event","version","usePanelId","useId","useNotificationCenter","inner","setInner","useState","options","controlled","open","state","useRef","id","pending","isOpen","next","current","made","useMemo","ref","onClick","subscribeMount","clientMounted","serverMounted","NotificationCenter","props","mounted","useSyncExternalStore","shown","setShown","onClosed","useCallback","placeOpen","useLayoutEffect","createPortal","Panel","timeOf","arrange","seen","entries","notifications","item","group","entry","gather","groups","byKey","members","fresh","expanded","ONE_SHOT","subscribeScheme","media","listener","darkScheme","partClasses","extra","classNames","part","custom","rootRef","backdrop","resolveBackdrop","useReducedTransparency","apple","appleEngine","resolveCenterBackdrop","dark","headingRef","setNow","timer","latest","requests","onDismiss","onClear","ids","actionId","can","setExpanded","wasOpen","setWasOpen","stale","keys","useMotionKeys","doc","useDrawerMotion","useScrollTint","scrollTint","setBlur","useCenterBehaviour","groupKey","useGroupKeys","toggle","useGroupToggle","lostFocus","useRefocus","clearable","present","ALL","twoStep","useTwoStepClear","useArrivals","useRead","labels","args","text","formatter","fallback","sideValue","side","themeValue","theme","direction","dir","onClickCapture","confirmAll","armedGroup","armedCount","status","card","Card","layers","styleRef","CenterBackdropLayers","TwoStepButton","glyph","stackRef","listRef","lag","index","clear","GroupItem","Empty","exitsRef","map","back","nextMotionKey","armed","control","confirm","EDGES","useText","texts","revealed","CONTROLS","set","value","itemRef","last","stackId","stackArmed","stackClear","clearStack","name","GroupHeader","showLess","folding","MoreButton","more","listed","target","root","active","from","focused","isoTime","date","StatusIcon","known","glyphs","icon","titleId","leave","place","actions","unread","Title","level","dismiss","action","title","description","buttons","button","clock","when","iconShown","content","Fragment","parts","render","ruleSet","rules","style","sheet","scope","selector","put","property","clamp01","round","REST_LOOK","motionRef","live","view","width","overrides","constants","resolveCenterMotion","writeConstants","backdropFade","blurFade","columnFade","opacityOf","writeBackdrop","motion","fade","BACKDROP_LAYERS","scroll","blur","BACKDROP_BLURS","writeFade","writeDrawer","p","sign","x","offset","header","writeCard","y","scale","opacity","clip","copy","write","cards","changed","gestures","calm","watchReducedMotion","createCenterMotion","callback","frame","flings","attachCenterGestures","at","swiped","places","observer","measuredWidth","exits","leaving","rest","box","geometry","copyBox","inStack","visual","look","stackLook","stackVisual","fling","done","folds","before","to","was","turned","same","spring","restClip","cascadeDelay","moved","stack","inertCopy","offsetIn","BACKDROP_SCROLL","result","list","nested","first","origin","listTop","cardKey","top","left","node","container","restored","instant","close","setOpen","opening","waiting","owned","onKeyDown","onPointerDown","path","inside","restore","opener","previous","focusIfVisible","later","lost","groupOf","stayed","liveRegion","priority","cardText","heard","flushRef","useEffect","region","lines","arrived","reported","opened","visible","setVisible","onVisibility"],"sources":["../../src/react/center.tsx"],"sourcesContent":["import { useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore, version } from 'react';\nimport type { MouseEvent as ReactMouseEvent, ReactElement, ReactNode, RefObject } from 'react';\nimport { createPortal } from 'react-dom';\nimport type {\n NotificationCenterLabels, NotificationCenterOpenOptions, NotificationCenterPart, NotificationCenterProps, NotificationItem, NotificationParts,\n UseNotificationCenterResult,\n} from '../center-react.js';\nimport { glyph, glyphs } from './card.js';\nimport { appleEngine, BACKDROP_BLURS, BACKDROP_LAYERS, BACKDROP_SCROLL, CenterBackdropLayers, resolveBackdrop, resolveCenterBackdrop, useReducedTransparency, useScrollTint } from './center-backdrop.js';\nimport { attachCenterGestures } from './center-gestures.js';\nimport { useTwoStepClear } from './center-clear.js';\nimport type { TwoStepClear } from './center-clear.js';\nimport { cascadeDelay, createCenterMotion, LAG_CARDS, resolveCenterMotion, restClip, stackLook, stackVisual } from './center-motion.js';\nimport type { CenterMotion, StackBox } from './center-motion.js';\nimport { focusIfVisible } from './focus.js';\nimport { watchReducedMotion } from './reduced.js';\n\n// The notification center's panel and the hook for the app's buttons. The panel shows the app's\n// own list of notifications: it keeps no notification of its own and never changes the list;\n// dismissing, clearing, actions and reading go back to the app through callbacks, and each new\n// array is laid out against the previous one. It is a non-modal dialog portalled into\n// `document.body`; a closed center renders nothing once its drawer has left, and so do the server\n// and the first client render.\n//\n// The drawer slides in from its edge and out on one interruptible position spring, the cards\n// trailing each other; a card that arrives while the center is open grows in at the top, one the\n// app took out leaves as an inert copy while the others move to their places. Every frame is\n// written through the panel's own CSSOM rules, never a style attribute. A closing panel is inert\n// and hidden from assistive technology at once; it leaves the document when its drawer has left.\n//\n// Two fingers or a finger towards the edge drag the drawer shut; away from the edge on a card they\n// ask the app to dismiss it (react/center-gestures.ts). The list scrolls natively.\n//\n// Notifications with one `group` form a group: two or more are a stack that a click expands into\n// its cards under a heading row, and \"Show less\" collapses again. Its cards spread out of the stack\n// and gather back into it on the stack's springs, from where they are and as fast as they go, so a\n// click mid-way turns them; the heading row and the button under the stack swap with a blur. Every\n// group is collapsed again when the center opens.\n//\n// A center has as many buttons as the app spreads the hook's props on. While it is open the panel\n// owns Escape (focus in it, on one of its buttons or on the body) and a primary press outside it\n// and its buttons closes it, letting the press through to the page. Focus goes to its heading when\n// it opens; when it closes from inside, back to the button that opened it, else to what had focus\n// before, else to its first button. A notification that arrives while it is open is spoken in its\n// own polite live region.\n\nconst kinds: Record<string, string> = { success: 'Success', error: 'Error', info: 'Info', warning: 'Warning', loading: 'In progress' };\nconst MINUTE = 60_000;\nconst HOUR = 60 * MINUTE;\nconst DAY = 24 * HOUR;\n/** A card's time is redrawn this often while the center is open. */\nconst TICK = 30_000;\n/** Arrivals are spoken together after this quiet window, as in the Toaster's announcer. */\nconst ANNOUNCE = 300;\n/**\n * A swiped card's fling is used by a copy that leaves this soon after the swipe asked to dismiss it,\n * also once the card has sprung back to its place.\n */\nconst FLING_WINDOW = 600;\n\nconst dates = new Map<string, Intl.DateTimeFormat>();\n/** \"Nov 23\" in the document's language; an unknown language falls back to the default one. */\nfunction shortDate(time: number, lang: string): string {\n let format = dates.get(lang);\n if (!format) {\n try { format = new Intl.DateTimeFormat(lang || undefined, { month: 'short', day: 'numeric' }); }\n catch { format = new Intl.DateTimeFormat(undefined, { month: 'short', day: 'numeric' }); }\n dates.set(lang, format);\n }\n return format.format(time);\n}\nconst relative = (lang: string) => (time: number, now: number) => {\n if (!Number.isFinite(time)) return '';\n const age = Math.max(0, now - time);\n if (age < MINUTE) return 'now';\n if (age < HOUR) return `${Math.floor(age / MINUTE)}m`;\n if (age < DAY) return `${Math.floor(age / HOUR)}h`;\n if (age < 7 * DAY) return `${Math.floor(age / DAY)}d`;\n return shortDate(time, lang);\n};\n\nexport const defaultCenterLabels: NotificationCenterLabels = {\n title: 'Notifications', close: 'Close notifications', clear: 'Clear notification', empty: 'No notifications',\n kind: kind => kinds[kind] ?? '', unread: 'Unread', time: relative(''),\n group: key => key, more: (label, count) => `${label} · ${count} more`, stack: (label, count) => `${label}, ${count} notifications`,\n showLess: 'Show less',\n clearGroup: 'Clear', clearGroupConfirm: count => `Clear ${count}`, clearStack: label => `Clear ${label}`,\n clearAll: 'Clear all', clearAllConfirm: count => `Clear ${count}`,\n};\n\n/**\n * What the hook and the panel share for one center: the panel's id for `aria-controls`, the\n * center's buttons, the one whose click opened it (for focus to come back to), and its state.\n */\ninterface CenterLink {\n readonly id: string;\n readonly buttons: Set<HTMLElement>;\n opener: HTMLElement | null;\n readonly isOpen: () => boolean;\n readonly request: (open: boolean) => void;\n}\n/** By the hook's `setOpen`, the one function of its result that never changes. */\nconst links = new WeakMap<object, CenterLink>();\n\n/** The center's buttons: the elements a hook's ref holds. One that left the document is not a button. */\nfunction centerButtons(link: CenterLink): HTMLElement[] {\n return [...link.buttons].filter(element => element.isConnected);\n}\n/** The same, in the document's order. */\nfunction buttonsInOrder(link: CenterLink): HTMLElement[] {\n return centerButtons(link).sort((a, b) => a.compareDocumentPosition(b) & a.DOCUMENT_POSITION_FOLLOWING ? -1 : 1);\n}\n\n/**\n * The ref and the click of one `useNotificationCenter()`. Every element the ref is given is a\n * button of the center until the ref lets it go, so the same props work on several buttons.\n *\n * React takes an element back by calling the ref with `null`, which does not say which element, and\n * a ref function of the app that changes at every render lets the button go and gives it back in\n * the same commit. So a `null` is settled once the commit is over: the elements that came back\n * stay; else the hook's only button goes, or all of them when as many `null`s came as it holds\n * buttons; short of that the one that left is told from the others by having left the document, or,\n * when the others came back in the commit, by not coming back. A ref of the app that never passes `null` on leaves its element to that last rule alone.\n *\n * React 19 and later call the cleanup a ref returns in place of `null`, which names the element: the\n * hook's own ref returns one there, so a button that keeps its place in the document but loses the\n * props is let go at once. React 18 would warn about the returned function, so it gets none.\n */\nfunction connectButtons(link: CenterLink) {\n const own = link.buttons;\n /** `null`s heard in this commit that no element has come back for. */\n let released = 0;\n /** Elements given back in this commit after a `null`: the app's ref changes at every render. */\n const returned = new Set<HTMLElement>();\n let settling = false;\n const settle = () => {\n settling = false;\n for (const element of [...own]) {\n if (element.isConnected) continue;\n own.delete(element);\n released -= 1;\n }\n if (released > 0 && released >= own.size) own.clear();\n else if (released > 0 && returned.size) {\n // Every button that stayed came back: the ones that did not are those the `null`s let go.\n const others = [...own].filter(element => !returned.has(element));\n if (others.length === released) for (const element of others) own.delete(element);\n }\n released = 0;\n returned.clear();\n };\n const ref = (element: HTMLElement | null): (() => void) | undefined => {\n if (!element) {\n released += 1;\n if (!settling) queueMicrotask(settle);\n settling = true;\n return undefined;\n }\n // A button that is out of a live document has left for good: the center holds on to none. Its\n // `null` in this commit, if it sent one, is settled with it.\n if (element.isConnected) {\n for (const other of [...own]) {\n if (other.isConnected) continue;\n own.delete(other);\n released = Math.max(0, released - 1);\n }\n }\n if (own.has(element)) released = Math.max(0, released - 1);\n if (settling) returned.add(element);\n own.add(element);\n return cleanups ? () => { own.delete(element); } : undefined;\n };\n // React hands the click its event; a call without one is the hook's only button's.\n const onClick = (event?: { readonly currentTarget: EventTarget | null }) => {\n if (link.isOpen()) { link.request(false); return; }\n const pressed = event?.currentTarget as HTMLElement | null | undefined;\n link.opener = pressed ? own.has(pressed) ? pressed : null : own.size === 1 ? [...own][0]! : null;\n link.request(true);\n };\n return { ref, onClick };\n}\n\n/** React 19 and later call a ref's returned cleanup in place of the ref with `null`. */\nconst cleanups = Number.parseInt(version, 10) >= 19;\n\n/** The panel's id: React's `useId`, without the characters a CSS selector would need escaped. */\nfunction usePanelId(): string {\n return `cloudlet-center-${useId().replace(/[^\\w-]/gu, '')}`;\n}\n\n/**\n * The center's open state and the props of the app's buttons that open and close it: uncontrolled\n * (`defaultOpen`) or controlled (`open` with `onOpenChange`).\n */\nexport function useNotificationCenter(options?: NotificationCenterOpenOptions): UseNotificationCenterResult {\n const [inner, setInner] = useState(() => options?.defaultOpen === true);\n const controlled = typeof options?.open === 'boolean';\n const open = controlled ? options!.open! : inner;\n const state = useRef({ open, controlled, onOpenChange: options?.onOpenChange });\n // Read by the callbacks, which never change: the latest props.\n state.current = { open, controlled, onOpenChange: options?.onOpenChange };\n const id = usePanelId();\n const [link] = useState<CenterLink>(() => {\n // A request already made in this task: one press can reach the close button and the press\n // outside, and is asked once. It never stands for the app's answer, which may be no (a\n // controlled `open` the app keeps): the next task reads the open state from the props again.\n let pending: { readonly open: boolean } | null = null;\n const isOpen = () => pending ? pending.open : state.current.open;\n const request = (next: boolean) => {\n if (next === isOpen()) return;\n const current = state.current;\n const made = { open: next };\n pending = made;\n if (!current.controlled) setInner(next);\n current.onOpenChange?.(next);\n // Queued after React's own render of the change, so the props say it by then.\n queueMicrotask(() => { if (pending === made) pending = null; });\n };\n return { id, buttons: new Set(), opener: null, isOpen, request };\n });\n const { ref, onClick } = useMemo(() => connectButtons(link), [link]);\n links.set(link.request, link);\n return useMemo(() => ({\n open,\n setOpen: link.request,\n triggerProps: { ref, 'aria-expanded': open, 'aria-controls': open ? link.id : undefined, 'aria-haspopup': 'dialog' as const, onClick },\n }), [open, link, ref, onClick]);\n}\n\nconst subscribeMount = () => () => {};\nconst clientMounted = () => true;\nconst serverMounted = () => false;\n\n/**\n * The notification center's panel. Mount it once, anywhere under the app; it portals itself. Its\n * open state comes from `center` (`useNotificationCenter()`), else from its own `open`,\n * `defaultOpen` and `onOpenChange`.\n */\nexport function NotificationCenter(props: NotificationCenterProps): ReactElement | null {\n const own = useNotificationCenter({ open: props.open, defaultOpen: props.defaultOpen, onOpenChange: props.onOpenChange });\n const state = props.center ?? own;\n // A center of another shape than the hook's result keeps its own `open` and `setOpen`.\n const link = links.get(state.setOpen) ?? links.get(own.setOpen)!;\n const open = state.open === true;\n const mounted = useSyncExternalStore(subscribeMount, clientMounted, serverMounted);\n // The panel stays while its drawer leaves; it goes when the closing spring has settled.\n const [shown, setShown] = useState(false);\n if (open && !shown) setShown(true);\n const onClosed = useCallback(() => setShown(false), []);\n // A center already open at the first client render is placed, not animated in.\n const placeOpen = useRef(true);\n useLayoutEffect(() => { if (mounted) placeOpen.current = false; });\n if (!mounted || !(shown || open)) return null;\n return createPortal(<Panel {...props} link={link} setOpen={state.setOpen} open={open} instant={placeOpen.current} onClosed={onClosed} />, document.body);\n}\n\n/** One notification as the panel lays it out. */\ninterface Entry {\n readonly id: string;\n readonly item: NotificationItem;\n /** Milliseconds since the epoch; NaN for a time that is not one. */\n readonly time: number;\n /** The item's `group`; null without a nonempty one. */\n readonly group: string | null;\n}\n/** Entries that share a group key, or one entry that stands alone (`key: null`). */\ninterface Group {\n readonly key: string | null;\n /** Newest first. */\n readonly entries: readonly Entry[];\n /** Only a group of two entries or more is ever expanded. */\n readonly expanded: boolean;\n}\n\nconst timeOf = (time: unknown) => typeof time === 'number' ? time : time instanceof Date ? time.getTime() : Number.NaN;\n/**\n * The list newest first (of two at the same time, or without one, the earlier in the array first);\n * an item without a string id, or with the id of an earlier one, is left out.\n */\nfunction arrange(notifications: readonly NotificationItem[]): Entry[] {\n const seen = new Set<string>();\n const entries: { entry: Entry; index: number }[] = [];\n (Array.isArray(notifications) ? notifications : []).forEach((item, index) => {\n if (!item || typeof item !== 'object' || typeof item.id !== 'string' || seen.has(item.id)) return;\n seen.add(item.id);\n const group = typeof item.group === 'string' && item.group ? item.group : null;\n entries.push({ entry: { id: item.id, item, time: timeOf(item.time), group }, index });\n });\n const key = (time: number) => Number.isNaN(time) ? -Infinity : time;\n entries.sort((a, b) => key(b.entry.time) - key(a.entry.time) || a.index - b.index);\n return entries.map(({ entry }) => entry);\n}\n/** The entries gathered by their group, each group where its newest entry stands. */\nfunction gather(entries: readonly Entry[], expanded: ReadonlySet<string>): Group[] {\n const groups: { key: string | null; entries: Entry[] }[] = [];\n const byKey = new Map<string, Entry[]>();\n for (const entry of entries) {\n if (entry.group === null) { groups.push({ key: null, entries: [entry] }); continue; }\n const members = byKey.get(entry.group);\n if (members) { members.push(entry); continue; }\n const fresh = [entry];\n byKey.set(entry.group, fresh);\n groups.push({ key: entry.group, entries: fresh });\n }\n return groups.map(group => ({ ...group, expanded: group.key !== null && group.entries.length >= 2 && expanded.has(group.key) }));\n}\n\n/** Controls that act once: a double click must not run an action or a clear twice. */\nconst ONE_SHOT = '[data-cloudlet-control=\"action\"], [data-cloudlet-control=\"clear\"], '\n // A double click on a two-step button arms it and no more.\n + '[data-cloudlet-control=\"clear-all\"], [data-cloudlet-control=\"group-clear\"], [data-cloudlet-control=\"stack-clear\"]';\n\nfunction subscribeScheme(listener: () => void) {\n const media = globalThis.matchMedia?.('(prefers-color-scheme: dark)');\n media?.addEventListener('change', listener);\n return () => media?.removeEventListener('change', listener);\n}\nconst darkScheme = () => globalThis.matchMedia?.('(prefers-color-scheme: dark)').matches ?? false;\n\n/** Adds the application's `classNames` part to an own `cloudlet-*` class, never replacing it. */\ntype PartClass = (part: NotificationCenterPart, own: string) => string;\nfunction partClasses(classNames: NotificationCenterProps['classNames']): PartClass {\n return (part, own) => {\n const extra = classNames?.[part];\n return typeof extra === 'string' && extra.trim() ? `${own} ${extra.trim()}` : own;\n };\n}\n\ntype PanelProps = NotificationCenterProps & {\n readonly link: CenterLink;\n readonly setOpen: (open: boolean) => void;\n readonly open: boolean;\n /** Place the drawer open without motion when the panel mounts. */\n readonly instant: boolean;\n /** The closing spring settled: the panel can leave the document. */\n readonly onClosed: () => void;\n};\n\n/** What a card's controls ask the app for; null where the app gave no callback for it. */\ninterface Requests {\n readonly dismiss: ((id: string) => void) | null;\n readonly clear: ((ids: readonly string[]) => void) | null;\n readonly action: (id: string, actionId: string) => void;\n}\n\nfunction Panel(props: PanelProps) {\n const { link, side, theme, dir, labels: custom, classNames, nonce, open, notifications } = props;\n const rootRef = useRef<HTMLDivElement>(null);\n // The app's reduced transparency (an ancestor's attribute) or `tint` draw the tone in place of blur.\n const backdrop = resolveBackdrop(props.backdrop, useReducedTransparency(rootRef));\n // The engine is read once, when the panel mounts.\n const [apple] = useState(appleEngine);\n const { layers, scrollTint } = resolveCenterBackdrop(props.motion?.overrides?.backdrop, apple);\n const dark = useSyncExternalStore(subscribeScheme, darkScheme, () => false);\n const headingRef = useRef<HTMLHeadingElement>(null);\n const [now, setNow] = useState(Date.now);\n useEffect(() => {\n if (!open) return;\n setNow(Date.now());\n const timer = setInterval(() => setNow(Date.now()), TICK);\n return () => clearInterval(timer);\n }, [open]);\n // The callbacks of the latest render, behind functions that never change.\n const latest = useRef(props);\n latest.current = props;\n const requests = useMemo(() => ({\n dismiss: (id: string) => {\n const { onDismiss, onClear } = latest.current;\n if (onDismiss) onDismiss(id); else onClear?.([id]);\n },\n clear: (ids: readonly string[]) => {\n const { onDismiss, onClear } = latest.current;\n if (onClear) onClear(ids); else if (onDismiss) for (const id of ids) onDismiss(id);\n },\n action: (id: string, actionId: string) => latest.current.onAction?.(id, actionId),\n }), []);\n const can: Requests = {\n dismiss: props.onDismiss || props.onClear ? requests.dismiss : null,\n clear: props.onClear || props.onDismiss ? requests.clear : null,\n action: requests.action,\n };\n const entries = useMemo(() => arrange(notifications), [notifications]);\n // Expanded groups, all collapsed again at each opening.\n const [expanded, setExpanded] = useState<ReadonlySet<string>>(() => new Set());\n const [wasOpen, setWasOpen] = useState(open);\n if (wasOpen !== open) {\n setWasOpen(open);\n if (open && expanded.size) setExpanded(new Set());\n }\n // A group that left or shrank to one notification is no longer expanded when it comes back.\n const stale = [...expanded].filter(key => entries.filter(entry => entry.group === key).length < 2);\n if (stale.length) setExpanded(new Set([...expanded].filter(key => !stale.includes(key))));\n const groups = useMemo(() => gather(entries, expanded), [entries, expanded]);\n const keys = useMotionKeys(entries);\n\n const doc = document;\n const { styleRef, stackRef, listRef, exitsRef, leave, texts, folding, setBlur } = useDrawerMotion(props, rootRef, keys, can.dismiss !== null);\n useScrollTint(open, backdrop === 'blur' && scrollTint, rootRef, setBlur);\n useCenterBehaviour(open, props.instant, link, props.setOpen, rootRef, headingRef);\n const groupKey = useGroupKeys(groups);\n const toggle = useGroupToggle(groups, setExpanded, rootRef, groupKey);\n const lostFocus = useRefocus(groups, groupKey, keys, rootRef, headingRef);\n // The two-step buttons shown in this render: Clear all from two notifications, and per group of\n // two or more its heading row's Clear (expanded) or its stack's clear button (collapsed).\n const clearable = can.clear !== null && entries.length >= 2;\n const present = can.clear === null ? [] : groups.flatMap(group => group.key === null || group.entries.length < 2 ? [] : [`${group.expanded ? 'group' : 'stack'}:${group.key}`]);\n if (clearable) present.push(ALL);\n const twoStep = useTwoStepClear(present, open);\n useArrivals(open, entries, keys, rootRef);\n useRead(open, entries, latest);\n const lang = doc.documentElement.lang;\n const labels: NotificationCenterLabels = { ...defaultCenterLabels, time: relative(lang), ...custom };\n function format<Args extends readonly unknown[]>(formatter: (...args: Args) => string, fallback: (...args: Args) => string, ...args: Args): string {\n try {\n const text = formatter(...args);\n if (typeof text !== 'string') throw new TypeError('Label formatter must return a string');\n return text;\n } catch {\n return fallback(...args);\n }\n }\n const sideValue = side === 'left' ? 'left' : 'right';\n const themeValue = theme === 'light' || theme === 'dark' ? theme : 'system';\n const direction = dir ?? (doc.documentElement.dir === 'rtl' ? 'rtl' : 'ltr');\n const part = partClasses(classNames);\n const id = link.id;\n\n const onClickCapture = (event: ReactMouseEvent) => {\n const target = (event.target as Element).closest('button');\n if (target?.matches(ONE_SHOT) && event.detail > 1) {\n event.preventDefault();\n event.stopPropagation();\n }\n };\n const confirmAll = format(labels.clearAllConfirm, defaultCenterLabels.clearAllConfirm, entries.length);\n const armedGroup = twoStep.armed?.replace(/^(?:group|stack):/u, '');\n const armedCount = twoStep.armed === null || twoStep.armed === ALL ? 0 : groups.find(group => group.key === armedGroup)?.entries.length ?? 0;\n // What the armed button would clear, said once by the polite status as the Island's Clear all does.\n const status = twoStep.armed === null ? '' : twoStep.armed === ALL ? confirmAll : format(labels.clearGroupConfirm, defaultCenterLabels.clearGroupConfirm, armedCount);\n const card = (entry: Entry, extra: { lag?: number; place?: StackPlace; level: 'h3' | 'h4'; when?: ReactElement }) =>\n <Card key={`h:${entry.id}`} entry={entry} motionKey={keys.of(entry.id)} requests={can} render={props.renderNotification}\n part={part} lostFocus={lostFocus} leave={leave}\n kind={typeof entry.item.kind === 'string' ? format(labels.kind, defaultCenterLabels.kind, entry.item.kind) : ''}\n time={format(labels.time, relative(lang), entry.time, now)} labels={labels} {...extra} />;\n\n // A closing panel is gone for assistive technology at once (and inert, set with its drawer).\n return <div ref={rootRef} id={id} className={part('center', 'cloudlet-host cloudlet-center')} role=\"dialog\" aria-labelledby={`${id}-title`}\n aria-hidden={open ? undefined : true}\n data-cloudlet-center=\"\" data-side={sideValue} data-theme={themeValue} data-resolved-theme={themeValue === 'system' ? dark ? 'dark' : 'light' : themeValue}\n data-backdrop={backdrop} data-backdrop-layers={backdrop === 'blur' ? layers : undefined} dir={direction} onClickCapture={onClickCapture}>\n <style ref={styleRef} nonce={nonce} data-cloudlet-center-motion=\"\" />\n <CenterBackdropLayers backdrop={backdrop} layers={layers} />\n <div className=\"cloudlet-center-column\">\n <div className={part('header', 'cloudlet-center-header')}>\n <h2 ref={headingRef} id={`${id}-title`} tabIndex={-1} className={part('heading', 'cloudlet-center-heading')}>{labels.title}</h2>\n {clearable && <TwoStepButton control=\"clear-all\" id={ALL} twoStep={twoStep} className={part('clear-all', 'cloudlet-clear cloudlet-center-clear-all')}\n label={labels.clearAll} confirm={confirmAll} onClear={() => {\n // The cards leave and the empty line takes their place: focus waits on the heading.\n headingRef.current?.focus({ preventScroll: true });\n can.clear?.(entries.map(entry => entry.id));\n }} />}\n <span role=\"status\" className=\"cloudlet-live\">{status}</span>\n <button type=\"button\" data-cloudlet-control=\"dismiss\" className={part('dismiss', 'cloudlet-close cloudlet-center-dismiss')} aria-label={labels.close}\n onClick={() => props.setOpen(false)}>{glyph('m4.5 4.5 7 7m0-7-7 7')}</button>\n </div>\n {/* No Tab stop of its own (Firefox gives every scroller one): every card holds its clear\n button, so Tab reaches and scrolls the list card by card, right after the close button. */}\n <div className=\"cloudlet-center-scroll\" tabIndex={-1}>\n <div ref={stackRef} className=\"cloudlet-center-stack\">\n {groups.length\n ? <ul ref={listRef} className={part('list', 'cloudlet-center-list')}>{groups.map((group, index) => {\n const lag = Math.min(index, LAG_CARDS);\n if (group.key === null || group.entries.length < 2) return card(group.entries[0]!, { lag, level: 'h3' });\n const label = format(labels.group, defaultCenterLabels.group, group.key);\n const count = group.entries.length;\n const clear = can.clear;\n return <GroupItem key={`g:${group.key}`} group={group} motionKey={groupKey(group.key)} lag={lag} part={part} card={card}\n name={format(labels.stack, defaultCenterLabels.stack, label, count)} label={label}\n more={format(labels.more, defaultCenterLabels.more, label, count - 1)} showLess={labels.showLess} toggle={toggle}\n clear={labels.clearGroup} clearStack={format(labels.clearStack, defaultCenterLabels.clearStack, label)}\n confirm={format(labels.clearGroupConfirm, defaultCenterLabels.clearGroupConfirm, count)} twoStep={twoStep} lostFocus={lostFocus}\n texts={texts} folding={folding} onClear={clear && (() => clear(group.entries.map(entry => entry.id)))} />;\n })}</ul>\n : <Empty className={part('empty', 'cloudlet-center-empty')} texts={texts}>{labels.empty}</Empty>}\n {/* Cards that left the list leave from here as inert copies, outside the list and its order. */}\n <div ref={exitsRef} className=\"cloudlet-center-exits\" aria-hidden=\"true\" />\n </div>\n </div>\n </div>\n </div>;\n}\n\n/**\n * Motion keys by notification id: a card's key names its CSSOM rule and its motion channels, and\n * ids are the app's own strings, which these never need escaping for. The key of an id that left\n * the list is forgotten after the commit; one that comes back gets a new key.\n */\ninterface MotionKeys {\n readonly of: (id: string) => string;\n /** The listed id a key stands for. */\n readonly idOf: (key: string) => string | null;\n}\nfunction useMotionKeys(entries: readonly Entry[]): MotionKeys {\n const [map] = useState(() => new Map<string, string>());\n const [back] = useState(() => new Map<string, string>());\n useLayoutEffect(() => {\n const present = new Set(entries.map(entry => entry.id));\n for (const [id, key] of map) if (!present.has(id)) { map.delete(id); back.delete(key); }\n }, [entries, map, back]);\n return useMemo(() => ({\n of(id: string) {\n let key = map.get(id);\n if (key === undefined) { map.set(id, key = String(++nextMotionKey)); back.set(key, id); }\n return key;\n },\n idOf: (key: string) => back.get(key) ?? null,\n }), [map, back]);\n}\n\n/** The id of the header's Clear all among the two-step buttons; a group's are `group:` and `stack:` with its key. */\nconst ALL = 'all';\n\n/**\n * A two-step text button: both labels share one cell, so it keeps its width when it arms; armed it\n * takes the error tint and its label says what the next press clears.\n */\nfunction TwoStepButton({ control, id, twoStep, className, label, confirm, onClear }: {\n control: string; id: string; twoStep: TwoStepClear; className: string; label: string; confirm: string; onClear: () => void;\n}) {\n const armed = twoStep.armed === id;\n return <button type=\"button\" data-cloudlet-control={control} className={className} data-armed={armed}\n onClick={() => twoStep.press(id, onClear)} onBlur={() => twoStep.disarm(id)}>\n <span aria-hidden={armed || undefined}>{label}</span><span aria-hidden={!armed || undefined}>{confirm}</span>\n </button>;\n}\n\n/** A card's place in a collapsed stack: its top card, one of the two edges under it, or hidden behind them. */\ntype StackPlace = 'top' | 'edge' | 'hidden';\n/** Edges under the top card of a collapsed stack, at most. */\nconst EDGES = 2;\n\n/**\n * The panel's text that comes and goes with a group (its heading row, the button under its stack)\n * and the empty line: shown with a blur once the panel stands (`reveal`), and leaving as an inert\n * copy that blurs out where it stood (`leave`).\n */\ninterface TextMotion { readonly reveal: (element: HTMLElement) => void; readonly leave: (element: HTMLElement) => void }\nfunction useText<T extends HTMLElement>(texts: TextMotion): RefObject<T | null> {\n const ref = useRef<T>(null);\n useLayoutEffect(() => {\n const element = ref.current;\n if (!element) return;\n texts.reveal(element);\n return () => texts.leave(element);\n }, [texts]);\n return ref;\n}\n/** The reveal is done: the attribute goes, so a later change of the motion setting does not replay it. */\nconst revealed = (event: { target: EventTarget; currentTarget: Element }) => {\n if (event.target === event.currentTarget) event.currentTarget.removeAttribute('data-cloudlet-reveal');\n};\n\nfunction Empty({ className, texts, children }: { className: string; texts: TextMotion; children: ReactNode }) {\n const ref = useText<HTMLParagraphElement>(texts);\n return <p ref={ref} className={className} data-cloudlet-lag=\"0\" onAnimationEnd={revealed}>{children}</p>;\n}\n\n/** Elements that act on their own: a click on them in a group never turns its motion. */\nconst CONTROLS = 'button, a[href], input, textarea, select, label, summary, [contenteditable], [tabindex]';\n\n/**\n * A group of two notifications or more. Collapsed, it is a stack: the top card in full with its\n * actions and fields inert, up to two edges under it with nothing to read, the rest hidden behind\n * them, and a button that expands it, as a click anywhere on the stack does. Expanded, a heading\n * row (the group's name with its count, and \"Show less\") stands over all its cards; both buttons\n * collapse it, and so does a click on its cards while they are still spreading out of the stack.\n * Its cards stay the same elements, in the same nested list, either way.\n */\nfunction GroupItem({ group, motionKey: key, lag, part, card, name, label, more, showLess, toggle, clear, clearStack, confirm, twoStep, lostFocus, texts, folding, onClear }: {\n group: Group; motionKey: string; lag: number; part: PartClass;\n card: (entry: Entry, extra: { place?: StackPlace; level: 'h3' | 'h4'; when?: ReactElement }) => ReactElement;\n name: string; label: string; more: string; showLess: string; toggle: (key: string, expanded: boolean, from: Element) => void;\n clear: string; clearStack: string; confirm: string; twoStep: TwoStepClear; lostFocus: RefObject<string | null>;\n /** Null without a clear callback: the group has no two-step buttons. */\n texts: TextMotion; folding: (key: string) => boolean; onClear: (() => void) | null;\n}) {\n const { expanded, entries } = group;\n const groupKey = group.key!;\n const set = (value: boolean) => (event: ReactMouseEvent) => toggle(groupKey, value, event.currentTarget);\n const itemRef = useRef<HTMLLIElement>(null);\n const last = useRef(entries);\n last.current = entries;\n // A group cleared with focus in its heading row hands focus on as its last card would: to what follows it.\n useLayoutEffect(() => () => {\n const item = itemRef.current;\n if (lostFocus.current === null && item?.contains(item.ownerDocument.activeElement)) lostFocus.current = last.current[last.current.length - 1]!.id;\n }, [lostFocus]);\n const stackId = `stack:${groupKey}`;\n const stackArmed = twoStep.armed === stackId;\n // In place of the top card's time on hover and focus; armed, it grows into a pill that says what it clears.\n const stackClear = onClear && <button type=\"button\" data-cloudlet-control=\"stack-clear\" data-armed={stackArmed}\n className={part('stack-clear', 'cloudlet-close cloudlet-card-clear cloudlet-center-stack-clear')} aria-label={stackArmed ? confirm : clearStack}\n onClick={event => { event.stopPropagation(); twoStep.press(stackId, onClear); }} onBlur={() => twoStep.disarm(stackId)}>\n {glyph('m4.5 4.5 7 7m0-7-7 7')}<span className=\"cloudlet-center-stack-clear-label\" aria-hidden=\"true\"><span>{confirm}</span></span>\n </button>;\n // A click on a collapsed stack, its top card or an edge, expands it; the button below is its keyboard way.\n // The second click of a double click that collapsed the group lands here: it expands nothing. While\n // the cards of an expanded group still spread out, a click on them (not on a control) turns them back.\n const onListClick = (event: ReactMouseEvent) => {\n if (event.detail > 1) return;\n if (!expanded) set(true)(event);\n else if (folding(key) && !event.currentTarget.contains((event.target as Element).closest(CONTROLS))) set(false)(event);\n };\n return <li ref={itemRef} className={part('group', 'cloudlet-center-group')} data-expanded={String(expanded)}\n data-peeks={expanded ? undefined : Math.min(entries.length - 1, EDGES)} data-cloudlet-motion-key={key} data-cloudlet-lag={lag}>\n <div role=\"group\" aria-label={name} className=\"cloudlet-center-group-box\">\n {expanded && <GroupHeader className={part('group-header', 'cloudlet-center-group-header')} texts={texts}>\n <h3 className=\"cloudlet-center-group-heading\">\n <button type=\"button\" data-cloudlet-control=\"group-title\" className={part('group-title', 'cloudlet-center-group-title')}\n aria-expanded=\"true\" onClick={set(false)}>\n <span className=\"cloudlet-center-group-label\">{label}</span> <span className=\"cloudlet-center-group-count\">{entries.length}</span>\n </button>\n </h3>\n <button type=\"button\" data-cloudlet-control=\"show-less\" className={part('show-less', 'cloudlet-action cloudlet-center-show-less')}\n onClick={set(false)}>{showLess}</button>\n {onClear && <TwoStepButton control=\"group-clear\" id={`group:${groupKey}`} twoStep={twoStep} className={part('group-clear', 'cloudlet-clear cloudlet-center-group-clear')}\n label={clear} confirm={confirm} onClear={onClear} />}\n </GroupHeader>}\n <ul className={part('group-list', 'cloudlet-center-group-list')} onClick={onListClick}>\n {entries.map((entry, index) => card(entry, expanded ? { level: 'h4' }\n : index > EDGES ? { place: 'hidden', level: 'h4' } : index ? { place: 'edge', level: 'h4' } : { place: 'top', level: 'h3', ...stackClear ? { when: stackClear } : {} }))}\n </ul>\n {!expanded && <MoreButton className={part('more', 'cloudlet-center-more')} texts={texts} onClick={set(true)}>{more}</MoreButton>}\n </div>\n </li>;\n}\n\nfunction GroupHeader({ className, texts, children }: { className: string; texts: TextMotion; children: ReactNode }) {\n const ref = useText<HTMLDivElement>(texts);\n return <div ref={ref} className={className} onAnimationEnd={revealed}>{children}</div>;\n}\n\nfunction MoreButton({ className, texts, onClick, children }: { className: string; texts: TextMotion; onClick: (event: ReactMouseEvent) => void; children: ReactNode }) {\n const ref = useText<HTMLButtonElement>(texts);\n return <button ref={ref} type=\"button\" data-cloudlet-control=\"more\" className={className} aria-expanded=\"false\" onClick={onClick} onAnimationEnd={revealed}>{children}</button>;\n}\n\n/** A group's motion key (`g…`) names its CSSOM rule as a card's does; group keys are the app's strings. */\nfunction useGroupKeys(groups: readonly Group[]) {\n const keys = useRef(new Map<string, string>());\n // Keys of groups that left are forgotten after the commit; a group that comes back gets a new one.\n useLayoutEffect(() => {\n const present = new Set(groups.map(group => group.key));\n for (const key of keys.current.keys()) if (!present.has(key)) keys.current.delete(key);\n }, [groups]);\n return useCallback((key: string) => {\n let value = keys.current.get(key);\n if (value === undefined) keys.current.set(key, value = `g${++nextMotionKey}`);\n return value;\n }, []);\n}\n\n/**\n * Expanding and collapsing a group as the person, at once. When the pressed control leaves with the\n * change (or anything else in the group lost focus with it), focus goes to the group's name in its\n * heading when it expanded and to the button under the stack when it collapsed; focus that stayed\n * where it was is left alone, so a press of the pointer outside the group's controls moves nothing.\n */\nfunction useGroupToggle(groups: readonly Group[], setExpanded: (change: (expanded: ReadonlySet<string>) => ReadonlySet<string>) => void,\n rootRef: RefObject<HTMLDivElement | null>, groupKey: (key: string) => string) {\n const pending = useRef<{ key: string; expanded: boolean } | null>(null);\n const listed = useRef(groups);\n listed.current = groups;\n useLayoutEffect(() => {\n const target = pending.current;\n pending.current = null;\n const root = rootRef.current;\n if (!target || !root) return;\n const active = root.ownerDocument.activeElement;\n if (active && active !== root.ownerDocument.body && active.isConnected) return;\n const item = root.querySelector(`.cloudlet-center-list > [data-cloudlet-motion-key=\"${target.key}\"]`);\n focusIfVisible(item?.querySelector<HTMLElement>(target.expanded ? '.cloudlet-center-group-title' : '.cloudlet-center-more'));\n });\n return useCallback((key: string, expanded: boolean, from: Element) => {\n const group = listed.current.find(item => item.key === key);\n // Only a group of two or more expands, and only a change counts.\n if (!group || group.entries.length < 2 || group.expanded === expanded) return;\n const doc = from.ownerDocument;\n const focused = !!from.closest('.cloudlet-center-group')?.contains(doc.activeElement);\n setExpanded(current => {\n const next = new Set(current);\n if (expanded) next.add(key); else next.delete(key);\n return next;\n });\n if (focused) pending.current = { key: groupKey(key), expanded };\n }, [setExpanded, groupKey]);\n}\n\n/** A finite time outside the range of a date has no machine-readable form. */\nfunction isoTime(time: number): string | undefined {\n const date = new Date(time);\n return Number.isNaN(date.getTime()) ? undefined : date.toISOString();\n}\n\nlet nextMotionKey = 0;\n\n/** The status icon of a known kind, or the item's own icon; null without either. */\nfunction StatusIcon({ item, part }: { item: NotificationItem; part: PartClass }) {\n const { kind, icon } = item;\n const known = kind === 'loading' || (typeof kind === 'string' && Object.hasOwn(glyphs, kind));\n if ((icon === undefined || icon === null || icon === false) && !known) return null;\n return <div className={part('icon', 'cloudlet-icon')} data-kind={kind} aria-hidden=\"true\">\n {icon !== undefined && icon !== null && icon !== false\n ? <span className=\"cloudlet-glyph\">{icon}</span>\n : kind === 'loading'\n ? <svg viewBox=\"0 0 16 16\" className=\"cloudlet-glyph cloudlet-spinner\"><circle cx=\"8\" cy=\"8\" r=\"5.5\" strokeDasharray=\"22 13\" /></svg>\n : <svg viewBox=\"0 0 16 16\" className=\"cloudlet-glyph\"><path d={glyphs[kind as keyof typeof glyphs]} /></svg>}\n </div>;\n}\n\n/**\n * One card. In a collapsed stack (`place`) the top card shows the stack's clear button in place of its\n * own (`when`) and keeps its actions inert, out of Tab and the accessibility tree, while its title and\n * description read; an edge, and a card hidden behind the edges, is inert and hidden altogether. `lag`\n * only on the list's own items: a group trails as one. `render` draws the content from the default parts.\n */\nfunction Card({ entry, motionKey: key, requests, render, part, lostFocus, leave, lag, place, level, when, kind, time, labels }: {\n entry: Entry; motionKey: string; requests: Requests; render: NotificationCenterProps['renderNotification']; part: PartClass;\n lostFocus: RefObject<string | null>;\n leave: (key: string, item: HTMLLIElement) => void; lag?: number | undefined; place?: StackPlace | undefined; level: 'h3' | 'h4';\n /** The top card of a collapsed stack: the stack's clear button in place of the card's own. */\n when?: ReactElement | undefined;\n kind: string; time: string; labels: NotificationCenterLabels;\n}) {\n const titleId = `${useId()}-title`;\n const itemRef = useRef<HTMLLIElement>(null);\n const { id, item } = entry;\n // A layout cleanup runs before the item leaves the document: it can still see focus inside it,\n // and its look, for the copy that leaves in its place.\n useLayoutEffect(() => () => {\n const element = itemRef.current;\n if (element?.contains(element.ownerDocument.activeElement)) lostFocus.current = id;\n if (element) leave(key, element);\n }, [id, key, lostFocus, leave]);\n // Native `inert` (React 18 has no prop for it), on every commit: the app's content may change.\n useLayoutEffect(() => {\n const element = itemRef.current;\n if (!element) return;\n element.toggleAttribute('inert', place === 'edge' || place === 'hidden');\n for (const actions of element.querySelectorAll('.cloudlet-actions')) actions.toggleAttribute('inert', place === 'top');\n });\n const unread = item.read === false;\n const Title = level;\n const dismiss = () => requests.dismiss?.(id);\n const action = (actionId: string) => requests.action(id, actionId);\n const icon = <StatusIcon item={item} part={part} />;\n const title = <Title id={titleId} tabIndex={-1} className={part('title', 'cloudlet-title')}>{item.title}</Title>;\n const hasDescription = item.description !== undefined && item.description !== null && item.description !== false && item.description !== '';\n const description = hasDescription ? <div className={part('description', 'cloudlet-description')}>\n {typeof item.description === 'string' || typeof item.description === 'number' ? <p>{item.description}</p> : item.description}\n </div> : null;\n const buttons = Array.isArray(item.actions) ? item.actions.filter(button => button && typeof button.id === 'string') : [];\n const actions = buttons.length ? <div className={part('actions', 'cloudlet-actions')}>\n {buttons.map((button, index) => <button key={button.id} type=\"button\" data-cloudlet-control=\"action\"\n className={index ? part('action', 'cloudlet-action') : `${part('action', 'cloudlet-action')} cloudlet-primary`}\n onClick={() => action(button.id)}>{button.label}</button>)}\n </div> : null;\n const clock = <span className=\"cloudlet-when\">\n <time className={part('time', 'cloudlet-time')} dateTime={isoTime(entry.time)}>{time}</time>\n {!place && requests.dismiss && <button type=\"button\" data-cloudlet-control=\"clear\" className={part('clear', 'cloudlet-close cloudlet-card-clear')}\n aria-label={labels.clear} aria-describedby={titleId} onClick={dismiss}>{glyph('m4.5 4.5 7 7m0-7-7 7')}</button>}\n {place === 'top' && when}\n </span>;\n const iconShown = item.icon !== undefined && item.icon !== null && item.icon !== false\n || item.kind === 'loading' || (typeof item.kind === 'string' && Object.hasOwn(glyphs, item.kind));\n const content = <>\n <div className=\"cloudlet-card-head\">\n <div className=\"cloudlet-heading\">{icon}{title}</div>\n {clock}\n </div>\n {(description || actions) && <div className={part('body', 'cloudlet-body')} data-kind={item.kind}>{description}{actions}</div>}\n </>;\n const parts: NotificationParts = { icon: iconShown ? icon : null, title, description, actions, time: clock, titleId, dismiss, action, content };\n return <li ref={itemRef} className={part('card', place === 'edge' ? `cloudlet-card ${part('edge', 'cloudlet-center-edge')}` : 'cloudlet-card')}\n data-kind={item.kind} data-read={unread ? 'false' : undefined} data-icon={iconShown ? undefined : 'none'}\n data-cloudlet-motion-key={key} data-cloudlet-lag={lag} data-cloudlet-place={place} aria-hidden={place === 'edge' || place === 'hidden' ? true : undefined}>\n {/* Read before the title: the kind, then whether it is unread. */}\n {kind && <span className=\"cloudlet-live\">{kind}</span>}\n {unread && <><span className=\"cloudlet-live\">{labels.unread}</span><span className={part('unread', 'cloudlet-center-unread')} aria-hidden=\"true\" /></>}\n {render ? render(item, parts) : content}\n </li>;\n}\n\n/** Scoped CSSOM rules of the panel's own `<style>`: the only place its motion is written. */\nfunction ruleSet(sheet: CSSStyleSheet | null | undefined, scope: string) {\n const rules = new Map<string, CSSStyleDeclaration>();\n return {\n get(name: string, selector: string): CSSStyleDeclaration | null {\n let style = rules.get(name);\n if (!style && sheet) {\n const index = sheet.insertRule(`${scope}${selector} {}`, sheet.cssRules.length);\n rules.set(name, style = (sheet.cssRules[index] as CSSStyleRule).style);\n }\n return style ?? null;\n },\n drop(name: string) {\n const style = rules.get(name);\n if (!style || !sheet) return;\n rules.delete(name);\n for (let index = 0; index < sheet.cssRules.length; index++) {\n if ((sheet.cssRules[index] as CSSStyleRule).style === style) { sheet.deleteRule(index); return; }\n }\n },\n clear() {\n rules.clear();\n if (sheet) while (sheet.cssRules.length) sheet.deleteRule(0);\n },\n };\n}\ntype Rules = ReturnType<typeof ruleSet>;\n/** Writes `value`, or removes the property for its resting value (`''`). */\nfunction put(style: CSSStyleDeclaration | null, property: string, value: string) {\n if (!style) return;\n if (value) style.setProperty(property, value); else style.removeProperty(property);\n}\nconst clamp01 = (value: number) => Math.min(1, Math.max(0, value));\nconst round = (value: number) => Math.round(value * 100) / 100;\n\n/**\n * What a leaving card's copy needs, captured while the card is still in the document; a card hidden\n * behind a stack's edges leaves without one.\n */\ninterface Leaving { readonly key: string; readonly item: HTMLLIElement; readonly copy: HTMLElement | null; readonly top: number; readonly left: number; readonly width: number }\n/** A heading row, a button under a stack or the empty line that left: its copy blurs out where it stood. */\ninterface LeavingText { readonly element: HTMLElement; readonly copy: HTMLElement; readonly top: number; readonly left: number; readonly width: number; readonly opacity: number }\nconst REST_LOOK = { y: 0, s: 1, c: 0, vy: 0, vs: 0, clipping: false } as const;\n\n/**\n * The drawer's motion: one position spring (and the reduced-motion fade), the trail of the cards,\n * a card growing in at the top, the copy of a cleared card leaving, the others moving to their new\n * places (FLIP from the layout positions of the previous commit), and the backdrop's layers\n * following the position. Reduced motion (the system, the prop, `data-reduced-motion` on an ancestor) turns all of\n * it into short opacity changes, live: the column and the backdrop's layers fade, never the root,\n * whose opacity would cut the blur off from the page.\n */\nfunction useDrawerMotion(props: PanelProps, rootRef: RefObject<HTMLDivElement | null>, keys: MotionKeys, swipeable: boolean) {\n const styleRef = useRef<HTMLStyleElement>(null);\n const stackRef = useRef<HTMLDivElement>(null);\n const listRef = useRef<HTMLUListElement>(null);\n const exitsRef = useRef<HTMLDivElement>(null);\n const latest = useRef({ props, keys, swipeable });\n const motionRef = useRef<CenterMotion | null>(null);\n const live = useRef<{\n rules: Rules; positions: Places; measured: boolean; leaving: Leaving[]; texts: LeavingText[]; sync: () => void;\n /** Motion keys of every listed record at the last commit. */\n listed: Set<string>;\n /** What the writer needs to know of the cards in groups (refreshed with the places). */\n kinds: CardKinds;\n /** The cards each group last moved, for a click that turns them while they go. */\n folds: Map<string, readonly string[]>;\n /** Release speeds (px per second) of swiped cards and when they were let go, for the copies that leave in their place. */\n flings: Map<string, { readonly velocity: number; readonly direction: 1 | -1; readonly at: number }>; now: () => number; width: () => number; travel: () => number; cancelSwipe: () => void;\n refresh: () => Places;\n } | null>(null);\n useLayoutEffect(() => { latest.current = { props, keys, swipeable }; });\n\n useLayoutEffect(() => {\n const root = rootRef.current!;\n const doc = root.ownerDocument;\n const view = doc.defaultView!;\n const rules = ruleSet(styleRef.current?.sheet, `#${root.id}`);\n let width = root.offsetWidth || root.getBoundingClientRect().width;\n let overrides = latest.current.props.motion?.overrides;\n let constants = resolveCenterMotion(overrides);\n const writeConstants = () => {\n const style = rules.get('root', '');\n put(style, '--cloudlet-center-swap', `${constants.swap}ms`);\n put(style, '--cloudlet-center-swap-blur', `${constants.swapBlur}px`);\n put(style, '--cloudlet-center-reduced', `${constants.reduced}ms`);\n put(style, '--cloudlet-center-stack-step', `${constants.stack.step}px`);\n put(style, '--cloudlet-center-stack-shrink', String(constants.stack.shrink));\n put(style, '--cloudlet-center-stack-reveal', `${constants.stack.reveal}ms`);\n put(style, '--cloudlet-center-stack-blur', `${constants.stack.blur}px`);\n };\n const kinds: CardKinds = { grouped: new Set(), edges: new Set(), hidden: new Set() };\n /** What was last written: the backdrop's layers, its blur layers apart, the column ('' for nothing). */\n let backdropFade = '';\n let blurFade = '';\n let columnFade = '';\n const opacityOf = (value: number) => value >= 1 ? '' : String(round(clamp01(value) * 1000) / 1000);\n /**\n * The backdrop's layers fade with the drawer's position and, under reduced motion, the panel's\n * fade: each layer on its own, never its container or the root. At 0 they are hidden, so a\n * closed or leaving center computes no blur; at 1 nothing is written. The blur layers take a\n * rule of their own only while the page's scroll hides them (`blur` below 1).\n */\n const writeBackdrop = () => {\n const shown = clamp01(motion.value('p')) * clamp01(motion.value('fade'));\n const fade = opacityOf(shown);\n if (fade !== backdropFade) {\n backdropFade = fade;\n const style = rules.get('backdrop', BACKDROP_LAYERS);\n put(style, 'opacity', fade);\n put(style, 'visibility', fade === '0' ? 'hidden' : '');\n }\n const scroll = clamp01(motion.value('blur'));\n const blur = scroll >= 1 ? '' : String(round(shown * scroll * 1000) / 1000);\n if (blur !== blurFade) {\n blurFade = blur;\n const style = rules.get('blur', BACKDROP_BLURS);\n put(style, 'opacity', blur);\n put(style, 'visibility', blur === '0' ? 'hidden' : '');\n }\n };\n /** Reduced motion fades the column (and through writeBackdrop the backdrop's layers). */\n const writeFade = () => {\n const fade = opacityOf(motion.value('fade'));\n if (fade !== columnFade) { columnFade = fade; put(rules.get('column', ' > .cloudlet-center-column'), 'opacity', fade); }\n writeBackdrop();\n };\n const writeDrawer = () => {\n const p = motion.value('p');\n const sign = latest.current.props.side === 'left' ? -1 : 1;\n const x = (1 - p) * (width + constants.travel) * sign;\n for (let index = 0; index <= LAG_CARDS; index++) {\n const offset = x * (1 + index * constants.lag);\n put(rules.get(`lag${index}`, ` [data-cloudlet-lag=\"${index}\"]`), 'translate', Math.abs(offset) < 0.01 ? '' : `${round(offset)}px 0`);\n }\n writeBackdrop();\n // The header appears in the second half of the way.\n const header = clamp01(p * 1.6 - 0.5);\n put(rules.get('header', ' .cloudlet-center-header'), 'opacity', header >= 1 ? '' : String(round(header * 1000) / 1000));\n };\n const writeCard = (key: string) => {\n const x = motion.value(`x:${key}`);\n const y = motion.value(`y:${key}`);\n const scale = motion.value(`s:${key}`);\n // A card swiped sideways fades with its travel, down to 30 %.\n const opacity = motion.value(`o:${key}`) * (1 - Math.min(0.7, Math.abs(x) / Math.max(1, width)));\n const style = rules.get(`card${key}`, ` [data-cloudlet-motion-key=\"${key}\"]`);\n const still = Math.abs(x) < 0.01 && Math.abs(y) < 0.01 && scale === 1;\n put(style, 'transform', still ? '' : Math.abs(x) < 0.01\n ? `translateY(${round(y)}px) scale(${Math.round(scale * 10000) / 10000})`\n : `translate(${round(x)}px, ${round(y)}px) scale(${Math.round(scale * 10000) / 10000})`);\n put(style, 'opacity', opacity >= 1 ? '' : String(Math.round(opacity * 1000) / 1000));\n // A card growing in at the top stays over the cards still moving down out of its way (a group\n // keeps its own order: each card over the next).\n put(style, 'z-index', scale !== 1 && !key.startsWith('x') && !kinds.grouped.has(key) ? '1' : '');\n // A card moving in a group is clipped from its top by its channel; at rest an edge's own clip\n // (the CSS) holds, and a copy keeps the clip it left with.\n const clip = motion.value(`c:${key}`);\n const copy = key.startsWith('x');\n const clipping = copy || motion.moving(`c:${key}`);\n put(style, 'clip-path', clipping && (clip > 0.01 || (!copy && kinds.edges.has(key))) ? `inset(${round(clip)}px -48px -48px)` : '');\n // A card hidden behind the edges shows while it fades out into its place.\n put(style, 'visibility', kinds.hidden.has(key) && opacity < 1 ? 'visible' : '');\n };\n const write = (changed: ReadonlySet<string>) => {\n const cards = new Set<string>();\n for (const key of changed) {\n if (key === 'p') writeDrawer();\n else if (key === 'fade') writeFade();\n else if (key === 'blur') writeBackdrop();\n else cards.add(key.slice(2));\n }\n for (const key of cards) writeCard(key);\n };\n let gestures: ReturnType<typeof attachCenterGestures> | null = null;\n const calm = watchReducedMotion(root, () => latest.current.props.reducedMotion === true, next => {\n root.dataset.reducedMotion = String(next);\n // Calm turns the swipes off, a running one too.\n if (next) gestures?.cancel();\n motion.setReducedMotion(next);\n });\n root.dataset.reducedMotion = String(calm.reduced);\n const motion = createCenterMotion({\n now: () => view.performance.now(),\n requestFrame: callback => view.requestAnimationFrame ? view.requestAnimationFrame(callback) : view.setTimeout(() => callback(view.performance.now()), 16),\n cancelFrame: frame => view.cancelAnimationFrame ? view.cancelAnimationFrame(frame) : view.clearTimeout(frame),\n write, reducedMotion: calm.reduced, timeScale: latest.current.props.motion?.timeScale, constants,\n });\n motionRef.current = motion;\n writeConstants();\n if (latest.current.props.instant) motion.place(true);\n // The first frame: the drawer at its starting place, before anything paints (under reduced\n // motion it stays in place and fades instead).\n if (!calm.reduced) writeDrawer();\n const flings = new Map<string, { velocity: number; direction: 1 | -1; at: number }>();\n gestures = attachCenterGestures(root, {\n motion, width: () => width, travel: () => constants.travel,\n edge: () => latest.current.props.side === 'left' ? -1 : 1,\n open: () => latest.current.props.open,\n close: () => latest.current.props.setOpen(false),\n idOf: key => latest.current.swipeable ? latest.current.keys.idOf(key) : null,\n dismiss: id => {\n const { onDismiss, onClear } = latest.current.props;\n if (onDismiss) onDismiss(id); else onClear?.([id]);\n },\n fling: (key, velocity, direction) => {\n const at = view.performance.now();\n for (const [other, swiped] of flings) if (at - swiped.at >= FLING_WINDOW) flings.delete(other);\n flings.set(key, { velocity, direction, at });\n },\n now: () => view.performance.now(),\n });\n const state = {\n now: () => view.performance.now(), flings, width: () => width, travel: () => constants.travel, cancelSwipe: () => gestures?.cancel(),\n rules, positions: new Map() as Places, measured: false, leaving: [] as Leaving[], texts: [] as LeavingText[], listed: new Set<string>(),\n kinds, folds: new Map<string, readonly string[]>(),\n /** Measures the places again, and writes each collapsed stack's top card height for its edges' clip. */\n refresh: () => {\n const next = places(listRef.current, stackRef.current);\n kinds.grouped.clear(); kinds.edges.clear(); kinds.hidden.clear();\n for (const [key, place] of next) {\n if (place.box) kinds.grouped.add(key);\n if (place.box?.kind === 'edge' || place.box?.kind === 'hidden') kinds.edges.add(key);\n if (place.box?.kind === 'hidden') kinds.hidden.add(key);\n if (place.first !== undefined) put(rules.get(`card${key}`, ` [data-cloudlet-motion-key=\"${key}\"]`), '--cloudlet-center-stack-top', place.expanded ? '' : `${round(place.first)}px`);\n }\n return next;\n },\n sync: () => {\n const next = latest.current.props.motion?.overrides;\n if (next !== overrides) { overrides = next; constants = resolveCenterMotion(next); motion.setConstants(constants); writeConstants(); }\n motion.setTimeScale(latest.current.props.motion?.timeScale);\n calm.sync();\n },\n };\n live.current = state;\n // The column's width sets the travel; the list's size changes outside a commit refresh the places.\n const observer = view.ResizeObserver ? new view.ResizeObserver(() => {\n const measuredWidth = root.offsetWidth;\n if (measuredWidth && measuredWidth !== width) { width = measuredWidth; writeDrawer(); }\n state.positions = state.refresh();\n }) : null;\n observer?.observe(root);\n if (stackRef.current) observer?.observe(stackRef.current);\n return () => {\n observer?.disconnect();\n gestures?.dispose();\n gestures = null;\n calm.dispose();\n motion.dispose();\n motionRef.current = null;\n live.current = null;\n rules.clear();\n exitsRef.current?.replaceChildren();\n delete root.dataset.reducedMotion;\n };\n }, [rootRef]);\n\n // Opening and closing retarget the one spring from where the drawer is and how fast it moves.\n const { open, onClosed } = props;\n useLayoutEffect(() => {\n rootRef.current?.toggleAttribute('inert', !open);\n // Closed from elsewhere under a finger: the finger lets go of nothing.\n if (!open) live.current?.cancelSwipe();\n motionRef.current?.setOpen(open, open ? undefined : onClosed);\n }, [open, onClosed, rootRef]);\n\n // Every commit: props that tune the motion, the copies of the cards that left, the new places.\n useLayoutEffect(() => {\n const state = live.current;\n const motion = motionRef.current;\n if (!state || !motion) return;\n state.sync();\n const exits = exitsRef.current;\n const { notifications } = latest.current.props;\n // Not an array (an app's `data?.items` while it loads): nothing is listed, as `arrange` reads it.\n const listed = new Set((Array.isArray(notifications) ? notifications : []).flatMap(item => {\n const key = item && typeof item.id === 'string' ? latest.current.keys.of(item.id) : null;\n return key === null ? [] : [key];\n }));\n for (const leaving of state.leaving.splice(0)) {\n // Still in the document: StrictMode's simulated unmount, not a card that left. Still listed:\n // the card moved into or out of a group, or behind a collapsed stack; its channels stay.\n if (leaving.item.isConnected || !exits || listed.has(leaving.key)) continue;\n const { copy } = leaving;\n if (!copy) {\n motion.forget(leaving.key);\n state.rules.drop(`card${leaving.key}`);\n continue;\n }\n const key = `x${leaving.key}`;\n let from: { x: number; y: number; scale: number; opacity: number; clip?: number } = { x: motion.value(`x:${leaving.key}`), y: motion.value(`y:${leaving.key}`), scale: motion.value(`s:${leaving.key}`), opacity: motion.value(`o:${leaving.key}`) };\n // A card of a group leaves from where it looks (an edge lower, narrower and clipped), and its\n // copy shrinks from that place.\n let rest: StackLookValue | undefined;\n const box = state.positions.get(leaving.key);\n if (box?.box && box.origin !== undefined) {\n const geometry = motion.constants.stack;\n const copyBox: StackBox = { kind: 'plain', top: leaving.top, height: box.box.height, list: 0, first: 0, level: 0 };\n const inStack = (visual: ReturnType<typeof stackVisual>) => ({ ...visual, top: visual.top + box.origin!, bottom: visual.bottom + box.origin! });\n const look = stackLook(copyBox, inStack(stackVisual(box.box, { ...REST_LOOK, y: from.y, s: from.scale, c: motion.value(`c:${leaving.key}`), clipping: motion.moving(`c:${leaving.key}`) }, geometry)), geometry);\n rest = stackLook(copyBox, inStack(stackVisual(box.box, REST_LOOK, geometry)), geometry);\n from = { ...from, y: look.y, scale: look.s, clip: look.c };\n }\n // A swiped card flies on away from the edge, past the column, with the speed it was let go with,\n // from wherever its spring back has taken it.\n const swiped = state.flings.get(leaving.key);\n state.flings.delete(leaving.key);\n const fling = swiped && state.now() - swiped.at < FLING_WINDOW\n ? { to: swiped.direction * (state.width() + state.travel()), velocity: swiped.velocity } : undefined;\n motion.forget(leaving.key);\n state.rules.drop(`card${leaving.key}`);\n copy.setAttribute('data-cloudlet-motion-key', key);\n const style = state.rules.get(`card${key}`, ` [data-cloudlet-motion-key=\"${key}\"]`);\n put(style, 'top', `${leaving.top}px`);\n put(style, 'left', `${leaving.left}px`);\n put(style, 'width', `${leaving.width}px`);\n exits.append(copy);\n motion.exit(key, from, () => {\n copy.remove();\n motion.forget(key);\n state.rules.drop(`card${key}`);\n }, fling, rest);\n }\n // The heading rows, buttons under stacks and the empty line that left blur out as copies.\n for (const text of state.texts.splice(0)) {\n if (text.element.isConnected || !exits) continue;\n const key = `t${++nextMotionKey}`;\n const { copy } = text;\n copy.setAttribute('data-cloudlet-motion-key', key);\n const style = state.rules.get(`card${key}`, ` [data-cloudlet-motion-key=\"${key}\"]`);\n put(style, 'top', `${text.top}px`);\n put(style, 'left', `${text.left}px`);\n put(style, 'width', `${text.width}px`);\n put(style, 'opacity', text.opacity >= 1 ? '' : String(round(text.opacity)));\n copy.setAttribute('data-cloudlet-unreveal', '');\n exits.append(copy);\n const view = exits.ownerDocument.defaultView!;\n let timer = 0;\n const done = () => { view.clearTimeout(timer); copy.remove(); state.rules.drop(`card${key}`); };\n copy.addEventListener('animationend', done, { once: true });\n // Without CSS animations (or once the panel is gone) the copy still goes.\n timer = view.setTimeout(done, (motion.reduced ? motion.constants.reduced : motion.constants.stack.reveal) + 100);\n }\n const next = state.refresh();\n if (state.measured) {\n const geometry = motion.constants.stack;\n const folds = new Map<string, string[]>();\n for (const [key, place] of next) {\n const before = state.positions.get(key);\n // A record that was listed already (a card that moved in or out of a group) is placed; only\n // an arrival grows in, unless it lands hidden behind a stack's edges.\n if (before === undefined) {\n if (latest.current.props.open && !state.listed.has(key) && place.box?.kind !== 'hidden') motion.enter(key);\n continue;\n }\n if (before.parent !== place.parent) continue;\n if (!place.box || !before.box) {\n if (before.top !== place.top) motion.shift(key, before.top - place.top);\n continue;\n }\n // A card of a group: from where it looks in its old place to its new place, on the stack's\n // springs when the group turned or the card changed places, else on the reflow's.\n const from = before.box;\n const to = place.box;\n if (from.kind === 'hidden' && to.kind === 'hidden') continue;\n const group = next.get(place.parent);\n const was = state.positions.get(place.parent);\n const turned = group?.expanded !== was?.expanded;\n const same = from.kind === to.kind && from.level === to.level;\n if (!turned && same && from.top === to.top && from.height === to.height && from.list === to.list && (to.kind === 'plain' || from.first === to.first)) continue;\n const spring = turned ? group?.expanded ? geometry.expand : geometry.collapse : same && to.kind === 'plain' ? motion.constants.reflow : geometry.collapse;\n const fade = to.kind === 'hidden' ? 'out' : from.kind === 'hidden' ? 'in' : undefined;\n motion.fold(key, look => stackLook(to, stackVisual(from, look, geometry), geometry), {\n spring, clip: restClip(to), fade, delay: cascadeDelay(spring, Math.min(place.index ?? 0, LAG_CARDS) * geometry.cascade),\n });\n let moved = folds.get(place.parent);\n if (!moved) folds.set(place.parent, moved = []);\n moved.push(key);\n }\n for (const [group, keys] of folds) state.folds.set(group, keys);\n }\n // A group that left (it was cleared, or shrank to one card) has no copy: its cards have theirs.\n for (const key of state.positions.keys()) {\n if (key.startsWith('g') && !next.has(key)) { motion.forget(key); state.rules.drop(`card${key}`); state.folds.delete(key); }\n }\n state.positions = next;\n state.listed = listed;\n state.measured = true;\n });\n\n /** From a card's layout cleanup: copy it while it is still in the document. */\n const leave = useCallback((key: string, item: HTMLLIElement) => {\n const state = live.current;\n if (!state || !motionRef.current) return;\n const stack = stackRef.current;\n let copy: HTMLElement | null = null;\n const place = item.dataset.cloudletPlace;\n if (place !== 'hidden') {\n copy = item.cloneNode(true) as HTMLElement;\n // The clear button stays in place of the time on the copy if it was showing.\n if (item.matches(':hover, :focus-within')) copy.setAttribute('data-cloudlet-swapped', '');\n copy.removeAttribute('data-cloudlet-place');\n // An edge's copy keeps its look: a shade off the card, nothing to read.\n if (place === 'edge') copy.setAttribute('data-cloudlet-edge', '');\n inertCopy(copy);\n }\n const { top, left } = offsetIn(item, stack);\n // A card leaves once: the latest capture replaces an earlier one. StrictMode's simulated unmount\n // of a card that just mounted captures it after this commit's copies were made, and that capture\n // waits for the next commit; were it the one where the card leaves, two copies under one key\n // would share its exit, and the one whose completion was replaced would stay for good.\n state.leaving = state.leaving.filter(leaving => leaving.key !== key);\n state.leaving.push({ key, item, copy, top, left, width: item.offsetWidth });\n }, []);\n\n /** Text that comes with a group or the empty line: a blur in, unless the panel is only being drawn; its leaving copy. */\n const texts = useMemo<TextMotion>(() => ({\n reveal(element) {\n if (live.current?.measured) element.setAttribute('data-cloudlet-reveal', '');\n },\n leave(element) {\n const state = live.current;\n const view = element.ownerDocument.defaultView;\n if (!state || !view) return;\n const copy = element.cloneNode(true) as HTMLElement;\n copy.removeAttribute('data-cloudlet-reveal');\n inertCopy(copy);\n const opacity = Number(view.getComputedStyle(element).opacity);\n const { top, left } = offsetIn(element, stackRef.current);\n // As a card's: the latest capture of one element replaces an earlier one.\n state.texts = state.texts.filter(text => text.element !== element);\n state.texts.push({ element, copy, top, left, width: element.offsetWidth, opacity: Number.isFinite(opacity) ? opacity : 1 });\n },\n }), []);\n\n /** True while the cards a group last moved are still on their way. */\n const folding = useCallback((key: string) => {\n const motion = motionRef.current;\n const keys = live.current?.folds.get(key);\n return !!motion && !!keys && keys.some(card => motion.moving(`y:${card}`) || motion.moving(`s:${card}`));\n }, []);\n\n /** Shows or hides the backdrop's blur layers apart from the drawer (the scroll tint). */\n const setBlur = useCallback((shown: boolean) => { motionRef.current?.setBlur(shown, BACKDROP_SCROLL.fade); }, []);\n\n return { styleRef, stackRef, listRef, exitsRef, leave, texts, folding, motionRef, setBlur };\n}\n\n/** What the writer knows of the cards in groups: which are in one, which lie as edges (or hidden), which are hidden. */\ninterface CardKinds { readonly grouped: Set<string>; readonly edges: Set<string>; readonly hidden: Set<string> }\ntype StackLookValue = { readonly y: number; readonly s: number; readonly c: number };\n\n/**\n * Layout places (offsetTop and offsetHeight, untouched by transforms) by motion key: the list's own\n * items (cards and groups) in the list, and the cards of a group in the group's own terms (`box`,\n * px from the top of its `li`, which lies at `origin` in the stack), so a group that moves moves its\n * cards with it and they only move for what changed inside it. A group records whether it is\n * expanded and the height of its first card (`first`).\n */\ninterface Place {\n readonly top: number;\n readonly parent: string;\n readonly expanded?: boolean;\n readonly first?: number;\n readonly box?: StackBox;\n readonly index?: number;\n readonly origin?: number;\n}\ntype Places = Map<string, Place>;\nfunction places(list: HTMLUListElement | null, stack: HTMLElement | null): Places {\n const result: Places = new Map();\n if (!list) return result;\n for (const item of list.children as HTMLCollectionOf<HTMLElement>) {\n const key = item.dataset.cloudletMotionKey;\n if (!key) continue;\n const nested = item.querySelector<HTMLElement>(':scope > .cloudlet-center-group-box > .cloudlet-center-group-list');\n if (!nested) { result.set(key, { top: item.offsetTop, parent: '' }); continue; }\n const cards = [...nested.children as HTMLCollectionOf<HTMLElement>];\n const first = cards[0]?.offsetHeight ?? 0;\n result.set(key, { top: item.offsetTop, parent: '', expanded: item.dataset.expanded === 'true', first });\n const origin = offsetIn(item, stack).top;\n const listTop = offsetIn(nested, stack).top - origin;\n cards.forEach((card, index) => {\n const cardKey = card.dataset.cloudletMotionKey;\n if (!cardKey) return;\n const place = card.dataset.cloudletPlace;\n const kind = place === 'edge' ? 'edge' : place === 'hidden' ? 'hidden' : 'plain';\n const box: StackBox = { kind, top: listTop + card.offsetTop, height: card.offsetHeight, list: listTop, first, level: kind === 'plain' ? 0 : kind === 'edge' ? index : EDGES };\n result.set(cardKey, { top: card.offsetTop, parent: key, box, index, origin });\n });\n }\n return result;\n}\n\n/** An element's layout offset inside `container` (an offset ancestor), untouched by transforms. */\nfunction offsetIn(element: HTMLElement, container: HTMLElement | null): { top: number; left: number } {\n let top = 0;\n let left = 0;\n for (let node: HTMLElement | null = element; node && node !== container; node = node.offsetParent as HTMLElement | null) {\n top += node.offsetTop;\n left += node.offsetLeft;\n }\n return { top, left };\n}\n\n/** A copy that only looks: no ids, roles, tab stops or ARIA, inert. */\nfunction inertCopy(copy: HTMLElement) {\n for (const element of [copy, ...copy.querySelectorAll('*')]) {\n for (const name of [...element.getAttributeNames()]) {\n if (name === 'id' || name === 'role' || name === 'tabindex' || name === 'for' || name === 'name' || name.startsWith('aria-')) element.removeAttribute(name);\n }\n }\n copy.setAttribute('inert', '');\n}\n\n/**\n * Escape, a press outside and focus in and out of the panel while it is open. Focus goes to the\n * heading at each opening (not when the panel is placed open on its first client render) and, when\n * the center closes while focus is inside the panel or on the body, to the first of these a person\n * can reach: the button whose click opened it, what had focus before it opened, the center's first\n * button in the document. A closing panel (its drawer still leaving) hears nothing.\n */\nfunction useCenterBehaviour(open: boolean, instant: boolean, link: CenterLink, setOpen: (open: boolean) => void,\n rootRef: RefObject<HTMLDivElement | null>, headingRef: RefObject<HTMLHeadingElement | null>) {\n const restored = useRef<HTMLElement | null>(null);\n const first = useRef(instant);\n const close = useRef(setOpen);\n close.current = setOpen;\n // The rendered state: a cleanup that runs with the panel still open is StrictMode's simulated\n // unmount (the effect runs again at once) or the panel leaving while open.\n const shown = useRef(open);\n shown.current = open;\n /** Where focus came from at this opening; StrictMode's second run of the effect is the same opening. */\n const opening = useRef<{ readonly previous: HTMLElement | null; readonly opener: HTMLElement | null } | null>(null);\n /** A restore waiting to see whether the panel was only unmounted for show. */\n const waiting = useRef<(() => void) | null>(null);\n useLayoutEffect(() => {\n if (!open) return;\n waiting.current = null;\n const root = rootRef.current!;\n const doc = root.ownerDocument;\n const view = doc.defaultView!;\n let from = opening.current;\n if (!from) {\n const active = doc.activeElement;\n // The button whose click opened it; the app's own `setOpen(true)` opens with none.\n from = opening.current = {\n previous: active instanceof view.HTMLElement && active !== doc.body && !root.contains(active) ? active : null,\n opener: link.opener,\n };\n if (!first.current) headingRef.current?.focus({ preventScroll: true });\n }\n first.current = false;\n const { previous, opener } = from;\n const owned = (target: EventTarget | null) =>\n target instanceof view.Node && (root.contains(target) || centerButtons(link).some(button => button.contains(target)));\n // Captured on the document, so the center hears Escape first and nothing behind it does.\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key !== 'Escape' || event.isComposing || event.keyCode === 229) return;\n const target = event.target;\n if (target !== doc.body && target !== doc.documentElement && !owned(target)) return;\n event.stopPropagation();\n close.current(false);\n };\n // A primary press outside the panel and every button of the center (each of them toggles it with\n // its click); the press itself goes on to the page.\n const onPointerDown = (event: PointerEvent) => {\n if (event.button !== 0 || event.ctrlKey) return;\n const path = event.composedPath();\n if (path.includes(root) || centerButtons(link).some(button => path.includes(button))) return;\n close.current(false);\n };\n doc.addEventListener('keydown', onKeyDown, true);\n doc.addEventListener('pointerdown', onPointerDown, true);\n return () => {\n doc.removeEventListener('keydown', onKeyDown, true);\n doc.removeEventListener('pointerdown', onPointerDown, true);\n // A layout cleanup runs while the panel is still in the document (closing or unmounting).\n const inside = () => {\n const focused = doc.activeElement;\n return !focused || focused === doc.body || root.contains(focused);\n };\n const restore = () => [opener, previous, ...buttonsInOrder(link)].find(element => focusIfVisible(element)) ?? null;\n if (!shown.current) {\n opening.current = null;\n if (inside()) restored.current = restore();\n return;\n }\n // Still open: StrictMode runs the effect again at once and the panel keeps focus; a panel that\n // leaves while open gives it back once it has gone.\n if (!inside()) return;\n const later = () => {\n if (waiting.current !== later) return;\n waiting.current = null;\n opening.current = null;\n if (inside()) restore();\n };\n waiting.current = later;\n queueMicrotask(later);\n };\n }, [open, link, rootRef, headingRef]);\n // React puts focus back where it was before a commit when that element is still in the document:\n // the closing panel stays for its drawer to leave, so the restored focus is re-applied after it.\n useLayoutEffect(() => {\n const target = restored.current;\n restored.current = null;\n // The button that opened the center is remembered for as long as it is open.\n if (!open) link.opener = null;\n if (open || !target) return;\n if (rootRef.current?.contains(target.ownerDocument.activeElement)) focusIfVisible(target);\n }, [open, link, rootRef]);\n}\n\n/**\n * A card that leaves while focus is in it hands focus to the card that followed it in its group, or\n * to the first control of the list's next item (a group cleared from its heading row or its stack\n * reports its last card), else to the panel's heading; a card that only moved (into a group, out of\n * one when it shrank) keeps focus on its own clear button. A card behind a collapsed stack stands for\n * the stack: focus goes to the button under it. The card reports itself from its layout cleanup;\n * this runs after the commit.\n */\nfunction useRefocus(groups: readonly Group[], groupKey: (key: string) => string, keys: MotionKeys,\n rootRef: RefObject<HTMLDivElement | null>, headingRef: RefObject<HTMLHeadingElement | null>): RefObject<string | null> {\n const lostFocus = useRef<string | null>(null);\n const listed = useRef(groups);\n useLayoutEffect(() => {\n const lost = lostFocus.current;\n const previous = listed.current;\n const before = previous.flatMap(group => group.entries);\n lostFocus.current = null;\n listed.current = groups;\n const root = rootRef.current;\n if (lost === null || !root) return;\n const doc = root.ownerDocument;\n if (doc.activeElement && doc.activeElement !== doc.body) return;\n const groupOf = new Map(groups.flatMap(group => group.entries.map(entry => [entry.id, group] as const)));\n const stayed = groupOf.has(lost);\n const next = stayed ? lost\n : before.slice(before.findIndex(entry => entry.id === lost) + 1).find(entry => groupOf.has(entry.id))?.id;\n const group = next === undefined ? undefined : groupOf.get(next);\n let target: HTMLElement | null | undefined = null;\n if (next !== undefined && group) {\n // The card itself when it stayed or follows in the same group; else the next item of the list\n // takes focus on its first control: a card's clear button, a collapsed stack's clear button,\n // an expanded group's name. A card that moved behind a collapsed stack stands for it: its button.\n const from = previous.find(item => item.entries.some(entry => entry.id === lost))?.key ?? null;\n const card = stayed || group.key === null || group.entries.length < 2 || group.key === from\n ? root.querySelector(`.cloudlet-center-list [data-cloudlet-motion-key=\"${keys.of(next)}\"]:not([data-cloudlet-place])`) : null;\n const item = group.key === null ? null : root.querySelector(`.cloudlet-center-list > [data-cloudlet-motion-key=\"${groupKey(group.key)}\"]`);\n // A card without a clear button (no dismiss callback, a custom card) takes focus on its title.\n target = card ? card.querySelector<HTMLElement>('[data-cloudlet-control=\"clear\"]') ?? card.querySelector<HTMLElement>('.cloudlet-title')\n : item?.querySelector<HTMLElement>(stayed ? '.cloudlet-center-more, .cloudlet-center-group-title'\n : '.cloudlet-center-stack-clear, .cloudlet-center-group-title, .cloudlet-center-more');\n }\n if (!focusIfVisible(target)) headingRef.current?.focus({ preventScroll: true });\n }, [groups, groupKey, keys, rootRef, headingRef]);\n return lostFocus;\n}\n\n/** An empty, visually hidden, atomic live region, as the Toaster's announcer makes them. */\nfunction liveRegion(doc: Document, priority: 'polite' | 'assertive'): HTMLElement {\n const element = doc.createElement('div');\n element.className = 'cloudlet-announcer';\n element.setAttribute('aria-live', priority);\n element.setAttribute('aria-atomic', 'true');\n return element;\n}\n\n/** The text a screen reader hears for a card that arrived: its title and description as shown. */\nfunction cardText(card: Element | null): string {\n if (!card) return '';\n const parts = [card.querySelector('.cloudlet-title'), card.querySelector('.cloudlet-description')];\n const text = parts.map(part => part?.textContent?.trim() ?? '').filter(Boolean);\n return (text.length ? text : [card.textContent?.trim() ?? '']).join('. ').replace(/\\s+/gu, ' ');\n}\n\n/**\n * Speaks the notifications that arrive while the center is open, after a quiet window, in a polite\n * region inserted at each opening and again on the next frame (VoiceOver in Safari ignores a region\n * changed right after its only insertion). What was listed when it opened stays silent, and a\n * closed center (its drawer still leaving, too) has no region at all.\n */\nfunction useArrivals(open: boolean, entries: readonly Entry[], keys: MotionKeys, rootRef: RefObject<HTMLDivElement | null>) {\n const heard = useRef(new Set<string>());\n const listed = useRef(entries);\n const waiting = useRef<string[]>([]);\n const flushRef = useRef<() => void>(() => {});\n useLayoutEffect(() => { listed.current = entries; });\n useEffect(() => {\n if (!open) return;\n heard.current = new Set(listed.current.map(entry => entry.id));\n const root = rootRef.current!;\n const doc = root.ownerDocument;\n const view = doc.defaultView!;\n const region = liveRegion(doc, 'polite');\n region.dataset.cloudletCenterAnnouncer = '';\n root.after(region);\n const frame = view.requestAnimationFrame?.(() => { if (region.isConnected) root.after(region); });\n let timer: number | undefined;\n flushRef.current = () => {\n if (timer !== undefined) return;\n timer = view.setTimeout(() => {\n timer = undefined;\n const ids = waiting.current.splice(0);\n if (doc.visibilityState === 'hidden') return;\n const present = new Set(listed.current.map(entry => entry.id));\n const lines = ids.filter(id => present.has(id))\n .map(id => cardText(root.querySelector(`.cloudlet-center-list [data-cloudlet-motion-key=\"${keys.of(id)}\"]`))).filter(Boolean);\n if (!lines.length) return;\n let text = lines.join('. ');\n // The same text again would leave the region unchanged and silent.\n if (region.textContent === text) text += ' ';\n region.replaceChildren(doc.createTextNode(text));\n }, ANNOUNCE);\n };\n return () => {\n flushRef.current = () => {};\n waiting.current = [];\n view.clearTimeout(timer);\n if (frame !== undefined) view.cancelAnimationFrame(frame);\n region.remove();\n };\n }, [open, keys, rootRef]);\n useEffect(() => {\n if (!open) return;\n let arrived = false;\n for (const entry of entries) {\n if (heard.current.has(entry.id)) continue;\n heard.current.add(entry.id);\n waiting.current.push(entry.id);\n arrived = true;\n }\n if (arrived) flushRef.current();\n }, [open, entries]);\n}\n\n/**\n * Reports the unread notifications the person has seen to `onRead`: after a commit with the center\n * open on a visible page, the unread ids listed then, each once per opening (an app that keeps one\n * unread is not asked again until the center opens again). A page that becomes visible again reports\n * what it missed.\n */\nfunction useRead(open: boolean, entries: readonly Entry[], latest: RefObject<NotificationCenterProps>) {\n const reported = useRef(new Set<string>());\n /** The opening `reported` belongs to; StrictMode's second run of the effect is the same opening. */\n const opened = useRef(false);\n const [visible, setVisible] = useState(0);\n useEffect(() => {\n if (!open) { opened.current = false; return; }\n if (!opened.current) reported.current = new Set();\n opened.current = true;\n const onVisibility = () => { if (document.visibilityState !== 'hidden') setVisible(count => count + 1); };\n document.addEventListener('visibilitychange', onVisibility);\n return () => document.removeEventListener('visibilitychange', onVisibility);\n }, [open]);\n useEffect(() => {\n if (!open || document.visibilityState === 'hidden') return;\n const ids = entries.filter(entry => entry.item.read === false && !reported.current.has(entry.id)).map(entry => entry.id);\n if (!ids.length) return;\n for (const id of ids) reported.current.add(id);\n latest.current?.onRead?.(ids);\n }, [open, entries, visible, latest]);\n}\n"],"mappings":";;;;;;;;;;;AA8CA,IAAMC,IAAgC;CAAE,SAAS;CAAW,OAAO;CAAS,MAAM;CAAQ,SAAS;CAAW,SAAS;AAAc,GAC/HC,IAAS,KACTC,IAAO,KAAKD,GACZE,IAAM,KAAKD,GAEXE,KAAO,KAEPC,IAAW,KAKXC,IAAe,KAEfC,qBAAQ,I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iB;CAE/C,GAAG;EAAClE;EAAM8B;EAASuR;EAASvP;CAAM,CAAC;AACrC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Focuses `element` only where a person could reach it: connected, enabled, and neither hidden,
|
|
3
|
+
* inert, `aria-hidden`, `display: none`, `visibility: hidden` nor skipped by `content-visibility`.
|
|
4
|
+
* Returns whether focus landed on it.
|
|
5
|
+
*/
|
|
6
|
+
export declare function focusIfVisible(element: HTMLElement | null | undefined): boolean;
|
|
7
|
+
//# sourceMappingURL=focus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus.d.ts","sourceRoot":"","sources":["../../src/react/focus.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAY/E"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/react/focus.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
if (!e?.isConnected || e.closest("[hidden],[inert],[aria-hidden=\"true\"]") || e.matches(":disabled")) return !1;
|
|
4
|
+
let t = e.ownerDocument, n = t.defaultView;
|
|
5
|
+
for (let t = e; t; t = t.parentElement) {
|
|
6
|
+
let e = n?.getComputedStyle(t);
|
|
7
|
+
if (e?.display === "none" || e?.visibility === "hidden" || e?.visibility === "collapse" || e?.contentVisibility === "hidden") return !1;
|
|
8
|
+
}
|
|
9
|
+
return e.focus({ preventScroll: !0 }), t.activeElement === e;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { e as focusIfVisible };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=focus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus.js","names":["focusIfVisible","element","doc","view","ancestor","style"],"sources":["../../src/react/focus.ts"],"sourcesContent":["/**\n * Focuses `element` only where a person could reach it: connected, enabled, and neither hidden,\n * inert, `aria-hidden`, `display: none`, `visibility: hidden` nor skipped by `content-visibility`.\n * Returns whether focus landed on it.\n */\nexport function focusIfVisible(element: HTMLElement | null | undefined): boolean {\n if (!element?.isConnected || element.closest('[hidden],[inert],[aria-hidden=\"true\"]')\n || element.matches(':disabled')) return false;\n const doc = element.ownerDocument;\n const view = doc.defaultView;\n for (let ancestor: HTMLElement | null = element; ancestor; ancestor = ancestor.parentElement) {\n const style = view?.getComputedStyle(ancestor);\n if (style?.display === 'none' || style?.visibility === 'hidden' || style?.visibility === 'collapse'\n || style?.contentVisibility === 'hidden') return false;\n }\n element.focus({ preventScroll: true });\n return doc.activeElement === element;\n}\n"],"mappings":";AAKA,SAAgBA,EAAe,GAAkD;CAC/E,IAAI,CAACC,GAAS,eAAeA,EAAQ,QAAQ,yCAAuC,KAC/EA,EAAQ,QAAQ,WAAW,GAAG,OAAO;CAC1C,IAAMC,IAAMD,EAAQ,eACdE,IAAOD,EAAI;CACjB,KAAK,IAAIE,IAA+BH,GAASG,GAAU,IAAWA,EAAS,eAAe;EAC5F,IAAMC,IAAQF,GAAM,iBAAiBC,CAAQ;EAC7C,IAAIC,GAAO,YAAY,UAAUA,GAAO,eAAe,YAAYA,GAAO,eAAe,cACpFA,GAAO,sBAAsB,UAAU,OAAO;CACrD;CAEA,OADAJ,EAAQ,MAAM,EAAE,eAAe,GAAK,CAAC,GAC9BC,EAAI,kBAAkBD;AAC/B"}
|
package/dist/react/gestures.d.ts
CHANGED
|
@@ -6,13 +6,27 @@ export declare function rubberBand(offset: number, dimension: number, coefficien
|
|
|
6
6
|
/**
|
|
7
7
|
* Release decision along one axis. Returns the sign of the travel when the swipe
|
|
8
8
|
* commits that way (distance past `MOTION.swipe.distance` of `dimension`, or a flick of
|
|
9
|
-
* at least `
|
|
9
|
+
* at least `flick` px released at `velocity` px/ms or faster), 0 when it springs back.
|
|
10
10
|
* A direction without a destination never commits; a flick back always cancels.
|
|
11
11
|
*/
|
|
12
12
|
export declare function decideRelease(offset: number, velocity: number, dimension: number, allowed: {
|
|
13
13
|
readonly negative: boolean;
|
|
14
14
|
readonly positive: boolean;
|
|
15
15
|
}): -1 | 0 | 1;
|
|
16
|
+
/**
|
|
17
|
+
* The release speed of one axis: the travel over the last `MOTION.swipe.window` ms of samples, in
|
|
18
|
+
* px/ms, at most `maxVelocity` either way; a span shorter than one frame counts as one frame. The
|
|
19
|
+
* sample just before the window anchors it. Of a wheel stream (`'wheel'`), a quiet time before a
|
|
20
|
+
* burst counts too: batched deltas after a pause are no flick. A pointer (`'pointer'`) sends a move
|
|
21
|
+
* whenever it moves, so a quiet time is stillness: the anchor stands until a frame before the next
|
|
22
|
+
* sample, at most back to the window's start, and a finger that rests and then flicks is measured
|
|
23
|
+
* over the flick.
|
|
24
|
+
*/
|
|
25
|
+
export declare function createVelocity(input?: 'pointer' | 'wheel'): {
|
|
26
|
+
reset(time: number, position: number): void;
|
|
27
|
+
add(time: number, position: number): void;
|
|
28
|
+
get(): number;
|
|
29
|
+
};
|
|
16
30
|
export type SwipeAxis = 'x' | 'y';
|
|
17
31
|
/** A started swipe along one axis. Offsets are raw finger travel in CSS px. */
|
|
18
32
|
export interface SwipeSession {
|
|
@@ -21,12 +35,18 @@ export interface SwipeSession {
|
|
|
21
35
|
readonly end: (offset: number, velocity: number) => void;
|
|
22
36
|
/** Lost capture, a second pointer, orientation change or an external cancel. */
|
|
23
37
|
readonly cancel: () => void;
|
|
38
|
+
/**
|
|
39
|
+
* Whether a release now would commit; a trackpad stream ends as soon as it does. Without it the
|
|
40
|
+
* stream commits past `MOTION.swipe` of the root's width in either direction.
|
|
41
|
+
*/
|
|
42
|
+
readonly decide?: (offset: number, velocity: number) => boolean;
|
|
24
43
|
}
|
|
25
44
|
/** What may start from one pointerdown or wheel stream; `release` ends the intent window. */
|
|
26
45
|
export interface SwipeCandidate {
|
|
27
46
|
readonly x: boolean;
|
|
28
47
|
readonly y: boolean;
|
|
29
|
-
|
|
48
|
+
/** `direction` is the sign of the travel that decided the axis (+1 right or down). */
|
|
49
|
+
readonly start: (axis: SwipeAxis, direction: 1 | -1) => SwipeSession | null;
|
|
30
50
|
readonly release: () => void;
|
|
31
51
|
}
|
|
32
52
|
interface SwipeOptions {
|
|
@@ -38,6 +58,13 @@ interface SwipeOptions {
|
|
|
38
58
|
* even where no swipe can start (an end of the slider, reduced motion, outside the slides).
|
|
39
59
|
*/
|
|
40
60
|
readonly claimsWheel?: (target: Element) => boolean;
|
|
61
|
+
/**
|
|
62
|
+
* A wheel stream that started over the root stays the root's until it goes idle, wherever the
|
|
63
|
+
* pointer is now: the rest of a committed swipe is swallowed even when the root has left the hit
|
|
64
|
+
* test (the notification center's panel turns inert as a swipe closes it). Streams still start
|
|
65
|
+
* only over the root, and the window has a wheel listener only while such a stream lasts.
|
|
66
|
+
*/
|
|
67
|
+
readonly holdsStream?: boolean;
|
|
41
68
|
readonly now: () => number;
|
|
42
69
|
}
|
|
43
70
|
/**
|
|
@@ -46,6 +73,10 @@ interface SwipeOptions {
|
|
|
46
73
|
* browser (native scroll) for the rest of the gesture. Buttons and links never start
|
|
47
74
|
* a swipe, except the collapsed pill, which is itself the swipe surface. Layout,
|
|
48
75
|
* physics and store commands stay with the caller.
|
|
76
|
+
*
|
|
77
|
+
* Travel, velocity and thresholds are CSS px of the host: under a CSS `zoom` on an
|
|
78
|
+
* ancestor, pointer and wheel input (viewport px) is divided by it, so content follows
|
|
79
|
+
* the finger and every distance scales with the zoomed interface.
|
|
49
80
|
*/
|
|
50
81
|
export declare function createSwipe(root: HTMLElement, options: SwipeOptions): {
|
|
51
82
|
cancel(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gestures.d.ts","sourceRoot":"","sources":["../../src/react/gestures.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gestures.d.ts","sourceRoot":"","sources":["../../src/react/gestures.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MA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