@bgub/fig-dom 0.1.0 → 0.1.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"view-transitions.js","names":[],"sources":["../src/view-transition-pseudos.ts","../src/view-transition.ts","../src/view-transitions.ts"],"sourcesContent":["import type { ViewTransitionSurface } from \"@bgub/fig\";\nimport type { ViewTransitionSurfaceSnapshots } from \"@bgub/fig-reconciler/view-transitions\";\n\nexport interface ViewTransitionPseudoElement {\n readonly selector: string;\n animate(\n keyframes: Keyframe[] | PropertyIndexedKeyframes | null,\n options?: number | KeyframeAnimationOptions,\n ): Animation;\n getAnimations(): Animation[];\n getComputedStyle(): CSSStyleDeclaration;\n}\n\nexport interface ViewTransitionPseudoElements {\n readonly group: ViewTransitionPseudoElement;\n readonly imagePair: ViewTransitionPseudoElement;\n readonly new: ViewTransitionPseudoElement | null;\n readonly old: ViewTransitionPseudoElement | null;\n}\n\nconst domSurfaces = new WeakMap<\n ViewTransitionSurface,\n { owner: Document; snapshots: ViewTransitionSurfaceSnapshots }\n>();\n\nexport function createDOMViewTransitionSurface(\n element: Element,\n name: string,\n snapshots: ViewTransitionSurfaceSnapshots,\n): ViewTransitionSurface {\n const surface: ViewTransitionSurface = { name };\n domSurfaces.set(surface, { owner: element.ownerDocument, snapshots });\n return surface;\n}\n\nexport function getViewTransitionPseudoElements(\n surface: ViewTransitionSurface,\n): ViewTransitionPseudoElements {\n const resolved = domSurfaces.get(surface);\n if (resolved === undefined) {\n throw new Error(\n \"The view-transition surface was not created by Fig DOM. Read pseudo \" +\n \"elements from a surface passed to <ViewTransition onTransition>.\",\n );\n }\n\n const name = escapeViewTransitionName(surface.name);\n const pseudo = (kind: string): ViewTransitionPseudoElement =>\n createPseudoElement(\n resolved.owner.documentElement,\n `::view-transition-${kind}(${name})`,\n );\n return {\n group: pseudo(\"group\"),\n imagePair: pseudo(\"image-pair\"),\n new: resolved.snapshots.new ? pseudo(\"new\") : null,\n old: resolved.snapshots.old ? pseudo(\"old\") : null,\n };\n}\n\nfunction createPseudoElement(\n element: HTMLElement,\n selector: string,\n): ViewTransitionPseudoElement {\n return {\n selector,\n animate(keyframes, options): Animation {\n const resolvedOptions: KeyframeAnimationOptions =\n typeof options === \"number\"\n ? { duration: options, pseudoElement: selector }\n : { ...options, pseudoElement: selector };\n return element.animate(keyframes, resolvedOptions);\n },\n getAnimations(): Animation[] {\n return element.getAnimations({ subtree: true }).filter((animation) => {\n const effect = animation.effect;\n return (\n effect !== null &&\n \"target\" in effect &&\n effect.target === element &&\n \"pseudoElement\" in effect &&\n effect.pseudoElement === selector\n );\n });\n },\n getComputedStyle(): CSSStyleDeclaration {\n return (\n element.ownerDocument.defaultView?.getComputedStyle(\n element,\n selector,\n ) ?? getComputedStyle(element, selector)\n );\n },\n };\n}\n\nexport function escapeViewTransitionName(name: string): string {\n return globalThis.CSS?.escape?.(name) ?? name;\n}\n","import type { Props } from \"@bgub/fig\";\nimport {\n VIEW_TRANSITION_PENDING_PROPERTY,\n VIEW_TRANSITION_TIMEOUT_MS,\n} from \"@bgub/fig/internal\";\nimport type {\n ViewTransitionCommitOptions,\n ViewTransitionCommitResult,\n ViewTransitionHostConfig,\n ViewTransitionMutationResult,\n ViewTransitionSurfaceMeasurement,\n} from \"@bgub/fig-reconciler/view-transitions\";\nimport type { Container } from \"./events.ts\";\nimport {\n createDOMViewTransitionSurface,\n escapeViewTransitionName,\n} from \"./view-transition-pseudos.ts\";\n\ninterface RunningViewTransition {\n finished?: Promise<unknown>;\n ready?: Promise<unknown>;\n skipTransition?(): void;\n}\n\ninterface CancellableAnimation {\n cancel(): void;\n}\n\ntype ViewTransitionDocument = Document & {\n [VIEW_TRANSITION_PENDING_PROPERTY]?: RunningViewTransition | null;\n};\n\nconst interruptedTransitions = new WeakSet<object>();\n\nfunction commitViewTransition(\n container: Container,\n options: ViewTransitionCommitOptions,\n prepareSnapshot: () => void,\n mutate: () => ViewTransitionMutationResult,\n onReady: (active: boolean) => void,\n onFinished: () => void,\n): ViewTransitionCommitResult {\n const owner = ownerDocument(container);\n const start = owner.startViewTransition?.bind(owner);\n if (start === undefined) return false;\n\n let didMutate = false;\n let chained = false;\n let failedBeforeMutate = false;\n let restoreRootName: (() => void) | null = null;\n let mutationResult: ViewTransitionMutationResult | null = null;\n const notifyReady = once(onReady);\n const notifyFinished = once(onFinished);\n const finishUnanimated = (): void => {\n restoreRootName?.();\n notifyReady(false);\n notifyFinished();\n };\n\n const run = (): void => {\n prepareSnapshot();\n try {\n const update = () => {\n didMutate = true;\n mutationResult = mutate();\n // Before the new capture: when measurement shows every change is\n // contained in a named boundary, drop the root's own snapshot so the\n // page-wide overlay does not swallow pointer events for the\n // animation's duration.\n if (mutationResult.cancelRootSnapshot) {\n restoreRootName = cancelRootViewTransitionName(owner);\n }\n };\n const transition = start(\n options.types.length === 0\n ? update\n : { types: [...options.types], update },\n );\n if (transition !== undefined) {\n registerPendingTransition(owner, transition);\n hideCanceledSnapshots(owner, transition, () => mutationResult);\n }\n // Root-name restore waits for the transition to fully settle: putting\n // `view-transition-name: root` back on the live <html> while the\n // transition still runs can re-associate the live root with its\n // (force-hidden) captured group, which paints the page blank for the\n // rest of the animation.\n const settleAfterTransition = transitionSettled(transition);\n if (settleAfterTransition === undefined) {\n finishUnanimated();\n } else {\n if (transition?.ready === undefined) {\n onSettled(settleAfterTransition, () => notifyReady(false));\n } else {\n transition.ready.then(\n () => notifyReady(true),\n () => notifyReady(false),\n );\n }\n const finish = (): void => {\n restoreRootName?.();\n notifyFinished();\n };\n onSettled(settleAfterTransition, finish);\n }\n } catch (error) {\n if (!didMutate) {\n // A chained run has no caller to report a fallback to and the\n // reconciler stays frozen until mutate runs: commit unanimated.\n // A synchronous run reports `false` so the caller falls back.\n if (chained) {\n didMutate = true;\n try {\n mutate();\n } finally {\n finishUnanimated();\n }\n } else {\n failedBeforeMutate = true;\n finishUnanimated();\n }\n return;\n }\n finishUnanimated();\n if (!chained) throw error;\n // Chained commit errors were already routed by the reconciler's\n // deferred-commit handling; a residual throw here is a transition\n // failure that must not vanish into the pending promise.\n setTimeout(() => {\n throw error;\n });\n }\n };\n\n // Coordinate per document: the default serializes animations, while an\n // explicit interruption skips the active one but still waits for its\n // restoration before capturing the next old state. The reconciler normally\n // parks eligible commits upstream (render-during-wait via the adapter's\n // suspend hook), so for fig-dom this chain is a fallback for renderers that\n // wire commit without suspend — chaining freezes the root until the previous\n // animation settles or times out; parking keeps rendering live.\n if (coordinateActiveViewTransition(owner, options.interrupt, run)) {\n chained = true;\n return \"deferred\";\n }\n\n run();\n if (failedBeforeMutate) return false;\n return didMutate ? \"committed\" : \"deferred\";\n}\n\n// Remove the root element from the new capture, remembering how to restore\n// the author's inline style afterwards.\nfunction cancelRootViewTransitionName(\n owner: ViewTransitionDocument,\n): () => void {\n const element = owner.documentElement;\n const style = element.style;\n const previous = style.viewTransitionName ?? \"\";\n style.viewTransitionName = \"none\";\n\n return () => {\n style.viewTransitionName = previous;\n if (element.getAttribute(\"style\") === \"\") element.removeAttribute(\"style\");\n };\n}\n\n// Old snapshots were captured before the update callback ran and cannot be\n// un-captured; once the pseudo tree exists (ready), hide the groups of\n// measurement-canceled boundaries — and the root group plus the\n// ::view-transition overlay when the whole-page snapshot was dropped — with\n// filling zero-duration animations so untouched regions stay interactive\n// while the remaining groups animate. Mirrors React's\n// cancelViewTransitionName / cancelRootViewTransitionName.\nfunction hideCanceledSnapshots(\n owner: ViewTransitionDocument,\n transition: RunningViewTransition,\n getResult: () => ViewTransitionMutationResult | null,\n): void {\n // The filled zero-duration animations outlive their pseudo tree: without\n // an explicit cancel once the transition settles they would apply to the\n // next transition's pseudo tree and hide its groups.\n const hideAnimations: CancellableAnimation[] = [];\n const cancelHideAnimations = (): void => {\n for (const animation of hideAnimations) {\n try {\n animation.cancel();\n } catch {\n // Cancelling a finished pseudo animation is best-effort.\n }\n }\n hideAnimations.length = 0;\n };\n\n const hide = (): void => {\n const result = getResult();\n if (result === null) return;\n if (result.canceledNames.length === 0 && !result.cancelRootSnapshot) {\n return;\n }\n\n const element = owner.documentElement;\n if (typeof element.animate !== \"function\") return;\n\n const track = (animation: unknown): void => {\n if (\n typeof (animation as CancellableAnimation | null)?.cancel === \"function\"\n ) {\n hideAnimations.push(animation as CancellableAnimation);\n }\n };\n\n const hideGroup = (name: string): void => {\n track(\n element.animate(\n { opacity: [0, 0], pointerEvents: [\"none\", \"none\"] },\n {\n duration: 0,\n fill: \"forwards\",\n pseudoElement: `::view-transition-group(${name})`,\n },\n ),\n );\n };\n\n try {\n for (const name of result.canceledNames) {\n hideGroup(escapeViewTransitionName(name));\n }\n if (result.cancelRootSnapshot) {\n hideGroup(\"root\");\n track(\n element.animate(\n { height: [0, 0], width: [0, 0] },\n {\n duration: 0,\n fill: \"forwards\",\n pseudoElement: \"::view-transition\",\n },\n ),\n );\n }\n } catch {\n // Pseudo-element animation is best-effort: without it the canceled\n // snapshots fall back to the browser's default cross-fade.\n }\n };\n\n const ready = transition.ready ?? transition.finished;\n if (ready === undefined) hide();\n else ready.then(hide, () => undefined);\n\n const settled = transitionSettled(transition);\n onSettled(settled, cancelHideAnimations);\n}\n\nfunction registerPendingTransition(\n owner: ViewTransitionDocument,\n transition: RunningViewTransition,\n): void {\n owner[VIEW_TRANSITION_PENDING_PROPERTY] = transition;\n const release = (): void => {\n if (owner[VIEW_TRANSITION_PENDING_PROPERTY] === transition) {\n owner[VIEW_TRANSITION_PENDING_PROPERTY] = null;\n }\n };\n onSettled(transitionSettled(transition), release);\n}\n\n// React caps suspended commits at 60 seconds. Besides preventing a broken or\n// infinite animation from parking work forever, releasing the document mutex\n// lets the resumed commit start a new transition, which ends the stale one.\nfunction coordinateActiveViewTransition(\n owner: ViewTransitionDocument,\n interrupt: boolean,\n onFinished: () => void,\n): boolean {\n const pending = owner[VIEW_TRANSITION_PENDING_PROPERTY];\n if (pending == null) return false;\n const settled = transitionSettled(pending);\n if (settled === undefined) return false;\n\n let waiting = true;\n function finish(): void {\n if (!waiting) return;\n waiting = false;\n clearTimeout(timeout);\n if (owner[VIEW_TRANSITION_PENDING_PROPERTY] === pending) {\n owner[VIEW_TRANSITION_PENDING_PROPERTY] = null;\n }\n onFinished();\n }\n\n const timeout = setTimeout(finish, VIEW_TRANSITION_TIMEOUT_MS);\n onSettled(settled, finish);\n if (\n interrupt &&\n pending.skipTransition !== undefined &&\n !interruptedTransitions.has(pending)\n ) {\n interruptedTransitions.add(pending);\n try {\n pending.skipTransition();\n } catch {\n interruptedTransitions.delete(pending);\n // A failed interruption falls back to waiting for normal settlement.\n }\n }\n return true;\n}\n\nfunction onSettled(\n promise: Promise<unknown> | undefined,\n callback: () => void,\n): void {\n if (promise === undefined) callback();\n else promise.then(callback, callback);\n}\n\nfunction once<Args extends unknown[]>(\n callback: (...args: Args) => void,\n): (...args: Args) => void {\n let called = false;\n return (...args) => {\n if (called) return;\n called = true;\n callback(...args);\n };\n}\n\nfunction transitionSettled(\n transition: RunningViewTransition | undefined,\n): Promise<unknown> | undefined {\n return transition?.finished ?? transition?.ready;\n}\n\nfunction measureViewTransitionSurface(\n element: Element,\n): ViewTransitionSurfaceMeasurement | null {\n if (typeof element.getBoundingClientRect !== \"function\") return null;\n\n const rect = element.getBoundingClientRect();\n const view = element.ownerDocument?.defaultView ?? null;\n const inViewport =\n view === null\n ? true\n : rect.bottom >= 0 &&\n rect.right >= 0 &&\n rect.top <= view.innerHeight &&\n rect.left <= view.innerWidth;\n let absolutelyPositioned = false;\n try {\n absolutelyPositioned =\n view?.getComputedStyle(element).position === \"absolute\";\n } catch {\n // Detached elements or minimal test environments: assume static\n // positioning, the conservative choice (resizes keep the root snapshot).\n }\n\n return {\n absolutelyPositioned,\n height: rect.height,\n inViewport,\n width: rect.width,\n x: rect.left,\n y: rect.top,\n };\n}\n\nfunction applyViewTransitionName(\n element: Element,\n name: string,\n className: string | null,\n): void {\n const style = (element as HTMLElement).style;\n\n style.viewTransitionName = escapeViewTransitionName(name);\n if (className !== null) style.viewTransitionClass = className;\n}\n\nfunction restoreViewTransitionName(element: Element, props: Props): void {\n const style = (element as HTMLElement).style;\n const styleProp = props.style;\n const name =\n styleProp?.viewTransitionName ?? styleProp?.[\"view-transition-name\"];\n const className =\n styleProp?.viewTransitionClass ?? styleProp?.[\"view-transition-class\"];\n\n style.viewTransitionName = styleValue(name);\n style.viewTransitionClass = styleValue(className);\n}\n\nfunction ownerDocument(container: Container): ViewTransitionDocument {\n return (container.ownerDocument ?? document) as ViewTransitionDocument;\n}\n\nfunction styleValue(value: unknown): string {\n if (typeof value === \"string\" || typeof value === \"number\") {\n return String(value).trim();\n }\n\n return \"\";\n}\n\nexport const viewTransitionHostConfig: ViewTransitionHostConfig<\n Container,\n Element\n> = {\n commit: commitViewTransition,\n apply: applyViewTransitionName,\n restore: restoreViewTransitionName,\n measure: measureViewTransitionSurface,\n createSurface: createDOMViewTransitionSurface,\n // Park eligible commits behind the shared per-document mutex while\n // rendering continues, then re-schedule once the transition settles.\n suspend(container, options, onFinished) {\n return coordinateActiveViewTransition(\n ownerDocument(container),\n options.interrupt,\n onFinished,\n );\n },\n};\n","import { createViewTransitionCommitCoordinator } from \"@bgub/fig-reconciler/view-transitions\";\nimport { domRenderer } from \"./renderer.ts\";\nimport { viewTransitionHostConfig } from \"./view-transition.ts\";\n\nexport {\n getViewTransitionPseudoElements,\n type ViewTransitionPseudoElement,\n type ViewTransitionPseudoElements,\n} from \"./view-transition-pseudos.ts\";\n\nconst coordinator = createViewTransitionCommitCoordinator(\n viewTransitionHostConfig,\n);\n\nexport function enableViewTransitions(): void {\n domRenderer.installCommitCoordinator(coordinator);\n}\n"],"mappings":"+OAoBA,MAAM,EAAc,IAAI,QAKxB,SAAgB,EACd,EACA,EACA,EACuB,CACvB,IAAM,EAAiC,CAAE,MAAK,EAE9C,OADA,EAAY,IAAI,EAAS,CAAE,MAAO,EAAQ,cAAe,WAAU,CAAC,EAC7D,CACT,CAEA,SAAgB,EACd,EAC8B,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AS,EAAwB,MAEvC,EAAM,mBAAqB,EAAyB,CAAI,EACpD,IAAc,OAAM,EAAM,oBAAsB,EACtD,CAEA,SAAS,EAA0B,EAAkB,EAAoB,CACvE,IAAM,EAAS,EAAwB,MACjC,EAAY,EAAM,MAClB,EACJ,GAAW,oBAAsB,IAAY,wBACzC,EACJ,GAAW,qBAAuB,IAAY,yBAEhD,EAAM,mBAAqB,EAAW,CAAI,EAC1C,EAAM,oBAAsB,EAAW,CAAS,CAClD,CAEA,SAAS,EAAc,EAA8C,CACnE,OAAQ,EAAU,eAAiB,QACrC,CAEA,SAAS,EAAW,EAAwB,CAK1C,OAJI,OAAO,GAAU,UAAY,OAAO,GAAU,SACzC,OAAO,CAAK,CAAC,CAAC,KAAK,EAGrB,EACT,CCxYA,MAAM,EAAc,EAClB,CD6YA,OAAQ,EACR,MAAO,EACP,QAAS,EACT,QAAS,EACT,cAAe,EAGf,QAAQ,EAAW,EAAS,EAAY,CACtC,OAAO,EACL,EAAc,CAAS,EACvB,EAAQ,UACR,CACF,CACF,CC1ZA,CACF,EAEA,SAAgB,GAA8B,CAC5C,EAAY,yBAAyB,CAAW,CAClD"}
1
+ {"version":3,"file":"view-transitions.js","names":[],"sources":["../src/view-transition-pseudos.ts","../src/view-transition.ts","../src/view-transitions.ts"],"sourcesContent":["import type { ViewTransitionSurface } from \"@bgub/fig\";\nimport type { ViewTransitionSurfaceSnapshots } from \"@bgub/fig-reconciler/view-transitions\";\n\n/** Describes view transition pseudo element. */\nexport interface ViewTransitionPseudoElement {\n readonly selector: string;\n animate(\n keyframes: Keyframe[] | PropertyIndexedKeyframes | null,\n options?: number | KeyframeAnimationOptions,\n ): Animation;\n getAnimations(): Animation[];\n getComputedStyle(): CSSStyleDeclaration;\n}\n\n/** Describes view transition pseudo elements. */\nexport interface ViewTransitionPseudoElements {\n readonly group: ViewTransitionPseudoElement;\n readonly imagePair: ViewTransitionPseudoElement;\n readonly new: ViewTransitionPseudoElement | null;\n readonly old: ViewTransitionPseudoElement | null;\n}\n\nconst domSurfaces = new WeakMap<\n ViewTransitionSurface,\n { owner: Document; snapshots: ViewTransitionSurfaceSnapshots }\n>();\n\nexport function createDOMViewTransitionSurface(\n element: Element,\n name: string,\n snapshots: ViewTransitionSurfaceSnapshots,\n): ViewTransitionSurface {\n const surface: ViewTransitionSurface = { name };\n domSurfaces.set(surface, { owner: element.ownerDocument, snapshots });\n return surface;\n}\n\n/** Gets view transition pseudo elements. */\nexport function getViewTransitionPseudoElements(\n surface: ViewTransitionSurface,\n): ViewTransitionPseudoElements {\n const resolved = domSurfaces.get(surface);\n if (resolved === undefined) {\n throw new Error(\n \"The view-transition surface was not created by Fig DOM. Read pseudo \" +\n \"elements from a surface passed to <ViewTransition onTransition>.\",\n );\n }\n\n const name = escapeViewTransitionName(surface.name);\n const pseudo = (kind: string): ViewTransitionPseudoElement =>\n createPseudoElement(\n resolved.owner.documentElement,\n `::view-transition-${kind}(${name})`,\n );\n return {\n group: pseudo(\"group\"),\n imagePair: pseudo(\"image-pair\"),\n new: resolved.snapshots.new ? pseudo(\"new\") : null,\n old: resolved.snapshots.old ? pseudo(\"old\") : null,\n };\n}\n\nfunction createPseudoElement(\n element: HTMLElement,\n selector: string,\n): ViewTransitionPseudoElement {\n return {\n selector,\n animate(keyframes, options): Animation {\n const resolvedOptions: KeyframeAnimationOptions =\n typeof options === \"number\"\n ? { duration: options, pseudoElement: selector }\n : { ...options, pseudoElement: selector };\n return element.animate(keyframes, resolvedOptions);\n },\n getAnimations(): Animation[] {\n return element.getAnimations({ subtree: true }).filter((animation) => {\n const effect = animation.effect;\n return (\n effect !== null &&\n \"target\" in effect &&\n effect.target === element &&\n \"pseudoElement\" in effect &&\n effect.pseudoElement === selector\n );\n });\n },\n getComputedStyle(): CSSStyleDeclaration {\n return (\n element.ownerDocument.defaultView?.getComputedStyle(\n element,\n selector,\n ) ?? getComputedStyle(element, selector)\n );\n },\n };\n}\n\nexport function escapeViewTransitionName(name: string): string {\n return globalThis.CSS?.escape?.(name) ?? name;\n}\n","import type { Props } from \"@bgub/fig\";\nimport {\n VIEW_TRANSITION_PENDING_PROPERTY,\n VIEW_TRANSITION_TIMEOUT_MS,\n} from \"@bgub/fig/internal\";\nimport type {\n ViewTransitionCommitOptions,\n ViewTransitionCommitResult,\n ViewTransitionHostConfig,\n ViewTransitionMutationResult,\n ViewTransitionSurfaceMeasurement,\n} from \"@bgub/fig-reconciler/view-transitions\";\nimport type { Container } from \"./events.ts\";\nimport {\n createDOMViewTransitionSurface,\n escapeViewTransitionName,\n} from \"./view-transition-pseudos.ts\";\n\ninterface RunningViewTransition {\n finished?: Promise<unknown>;\n ready?: Promise<unknown>;\n skipTransition?(): void;\n}\n\ninterface CancellableAnimation {\n cancel(): void;\n}\n\ntype ViewTransitionDocument = Document & {\n [VIEW_TRANSITION_PENDING_PROPERTY]?: RunningViewTransition | null;\n};\n\nconst interruptedTransitions = new WeakSet<object>();\n\nfunction commitViewTransition(\n container: Container,\n options: ViewTransitionCommitOptions,\n prepareSnapshot: () => void,\n mutate: () => ViewTransitionMutationResult,\n onReady: (active: boolean) => void,\n onFinished: () => void,\n): ViewTransitionCommitResult {\n const owner = ownerDocument(container);\n const start = owner.startViewTransition?.bind(owner);\n if (start === undefined) return false;\n\n let didMutate = false;\n let chained = false;\n let failedBeforeMutate = false;\n let restoreRootName: (() => void) | null = null;\n let mutationResult: ViewTransitionMutationResult | null = null;\n const notifyReady = once(onReady);\n const notifyFinished = once(onFinished);\n const finishUnanimated = (): void => {\n restoreRootName?.();\n notifyReady(false);\n notifyFinished();\n };\n\n const run = (): void => {\n prepareSnapshot();\n try {\n const update = () => {\n didMutate = true;\n mutationResult = mutate();\n // Before the new capture: when measurement shows every change is\n // contained in a named boundary, drop the root's own snapshot so the\n // page-wide overlay does not swallow pointer events for the\n // animation's duration.\n if (mutationResult.cancelRootSnapshot) {\n restoreRootName = cancelRootViewTransitionName(owner);\n }\n };\n const transition = start(\n options.types.length === 0\n ? update\n : { types: [...options.types], update },\n );\n if (transition !== undefined) {\n registerPendingTransition(owner, transition);\n hideCanceledSnapshots(owner, transition, () => mutationResult);\n }\n // Root-name restore waits for the transition to fully settle: putting\n // `view-transition-name: root` back on the live <html> while the\n // transition still runs can re-associate the live root with its\n // (force-hidden) captured group, which paints the page blank for the\n // rest of the animation.\n const settleAfterTransition = transitionSettled(transition);\n if (settleAfterTransition === undefined) {\n finishUnanimated();\n } else {\n if (transition?.ready === undefined) {\n onSettled(settleAfterTransition, () => notifyReady(false));\n } else {\n transition.ready.then(\n () => notifyReady(true),\n () => notifyReady(false),\n );\n }\n const finish = (): void => {\n restoreRootName?.();\n notifyFinished();\n };\n onSettled(settleAfterTransition, finish);\n }\n } catch (error) {\n if (!didMutate) {\n // A chained run has no caller to report a fallback to and the\n // reconciler stays frozen until mutate runs: commit unanimated.\n // A synchronous run reports `false` so the caller falls back.\n if (chained) {\n didMutate = true;\n try {\n mutate();\n } finally {\n finishUnanimated();\n }\n } else {\n failedBeforeMutate = true;\n finishUnanimated();\n }\n return;\n }\n finishUnanimated();\n if (!chained) throw error;\n // Chained commit errors were already routed by the reconciler's\n // deferred-commit handling; a residual throw here is a transition\n // failure that must not vanish into the pending promise.\n setTimeout(() => {\n throw error;\n });\n }\n };\n\n // Coordinate per document: the default serializes animations, while an\n // explicit interruption skips the active one but still waits for its\n // restoration before capturing the next old state. The reconciler normally\n // parks eligible commits upstream (render-during-wait via the adapter's\n // suspend hook), so for fig-dom this chain is a fallback for renderers that\n // wire commit without suspend — chaining freezes the root until the previous\n // animation settles or times out; parking keeps rendering live.\n if (coordinateActiveViewTransition(owner, options.interrupt, run)) {\n chained = true;\n return \"deferred\";\n }\n\n run();\n if (failedBeforeMutate) return false;\n return didMutate ? \"committed\" : \"deferred\";\n}\n\n// Remove the root element from the new capture, remembering how to restore\n// the author's inline style afterwards.\nfunction cancelRootViewTransitionName(\n owner: ViewTransitionDocument,\n): () => void {\n const element = owner.documentElement;\n const style = element.style;\n const previous = style.viewTransitionName ?? \"\";\n style.viewTransitionName = \"none\";\n\n return () => {\n style.viewTransitionName = previous;\n if (element.getAttribute(\"style\") === \"\") element.removeAttribute(\"style\");\n };\n}\n\n// Old snapshots were captured before the update callback ran and cannot be\n// un-captured; once the pseudo tree exists (ready), hide the groups of\n// measurement-canceled boundaries — and the root group plus the\n// ::view-transition overlay when the whole-page snapshot was dropped — with\n// filling zero-duration animations so untouched regions stay interactive\n// while the remaining groups animate. Mirrors React's\n// cancelViewTransitionName / cancelRootViewTransitionName.\nfunction hideCanceledSnapshots(\n owner: ViewTransitionDocument,\n transition: RunningViewTransition,\n getResult: () => ViewTransitionMutationResult | null,\n): void {\n // The filled zero-duration animations outlive their pseudo tree: without\n // an explicit cancel once the transition settles they would apply to the\n // next transition's pseudo tree and hide its groups.\n const hideAnimations: CancellableAnimation[] = [];\n const cancelHideAnimations = (): void => {\n for (const animation of hideAnimations) {\n try {\n animation.cancel();\n } catch {\n // Cancelling a finished pseudo animation is best-effort.\n }\n }\n hideAnimations.length = 0;\n };\n\n const hide = (): void => {\n const result = getResult();\n if (result === null) return;\n if (result.canceledNames.length === 0 && !result.cancelRootSnapshot) {\n return;\n }\n\n const element = owner.documentElement;\n if (typeof element.animate !== \"function\") return;\n\n const track = (animation: unknown): void => {\n if (\n typeof (animation as CancellableAnimation | null)?.cancel === \"function\"\n ) {\n hideAnimations.push(animation as CancellableAnimation);\n }\n };\n\n const hideGroup = (name: string): void => {\n track(\n element.animate(\n { opacity: [0, 0], pointerEvents: [\"none\", \"none\"] },\n {\n duration: 0,\n fill: \"forwards\",\n pseudoElement: `::view-transition-group(${name})`,\n },\n ),\n );\n };\n\n try {\n for (const name of result.canceledNames) {\n hideGroup(escapeViewTransitionName(name));\n }\n if (result.cancelRootSnapshot) {\n hideGroup(\"root\");\n track(\n element.animate(\n { height: [0, 0], width: [0, 0] },\n {\n duration: 0,\n fill: \"forwards\",\n pseudoElement: \"::view-transition\",\n },\n ),\n );\n }\n } catch {\n // Pseudo-element animation is best-effort: without it the canceled\n // snapshots fall back to the browser's default cross-fade.\n }\n };\n\n const ready = transition.ready ?? transition.finished;\n if (ready === undefined) hide();\n else ready.then(hide, () => undefined);\n\n const settled = transitionSettled(transition);\n onSettled(settled, cancelHideAnimations);\n}\n\nfunction registerPendingTransition(\n owner: ViewTransitionDocument,\n transition: RunningViewTransition,\n): void {\n owner[VIEW_TRANSITION_PENDING_PROPERTY] = transition;\n const release = (): void => {\n if (owner[VIEW_TRANSITION_PENDING_PROPERTY] === transition) {\n owner[VIEW_TRANSITION_PENDING_PROPERTY] = null;\n }\n };\n onSettled(transitionSettled(transition), release);\n}\n\n// React caps suspended commits at 60 seconds. Besides preventing a broken or\n// infinite animation from parking work forever, releasing the document mutex\n// lets the resumed commit start a new transition, which ends the stale one.\nfunction coordinateActiveViewTransition(\n owner: ViewTransitionDocument,\n interrupt: boolean,\n onFinished: () => void,\n): boolean {\n const pending = owner[VIEW_TRANSITION_PENDING_PROPERTY];\n if (pending == null) return false;\n const settled = transitionSettled(pending);\n if (settled === undefined) return false;\n\n let waiting = true;\n function finish(): void {\n if (!waiting) return;\n waiting = false;\n clearTimeout(timeout);\n if (owner[VIEW_TRANSITION_PENDING_PROPERTY] === pending) {\n owner[VIEW_TRANSITION_PENDING_PROPERTY] = null;\n }\n onFinished();\n }\n\n const timeout = setTimeout(finish, VIEW_TRANSITION_TIMEOUT_MS);\n onSettled(settled, finish);\n if (\n interrupt &&\n pending.skipTransition !== undefined &&\n !interruptedTransitions.has(pending)\n ) {\n interruptedTransitions.add(pending);\n try {\n pending.skipTransition();\n } catch {\n interruptedTransitions.delete(pending);\n // A failed interruption falls back to waiting for normal settlement.\n }\n }\n return true;\n}\n\nfunction onSettled(\n promise: Promise<unknown> | undefined,\n callback: () => void,\n): void {\n if (promise === undefined) callback();\n else promise.then(callback, callback);\n}\n\nfunction once<Args extends unknown[]>(\n callback: (...args: Args) => void,\n): (...args: Args) => void {\n let called = false;\n return (...args) => {\n if (called) return;\n called = true;\n callback(...args);\n };\n}\n\nfunction transitionSettled(\n transition: RunningViewTransition | undefined,\n): Promise<unknown> | undefined {\n return transition?.finished ?? transition?.ready;\n}\n\nfunction measureViewTransitionSurface(\n element: Element,\n): ViewTransitionSurfaceMeasurement | null {\n if (typeof element.getBoundingClientRect !== \"function\") return null;\n\n const rect = element.getBoundingClientRect();\n const view = element.ownerDocument?.defaultView ?? null;\n const inViewport =\n view === null\n ? true\n : rect.bottom >= 0 &&\n rect.right >= 0 &&\n rect.top <= view.innerHeight &&\n rect.left <= view.innerWidth;\n let absolutelyPositioned = false;\n try {\n absolutelyPositioned =\n view?.getComputedStyle(element).position === \"absolute\";\n } catch {\n // Detached elements or minimal test environments: assume static\n // positioning, the conservative choice (resizes keep the root snapshot).\n }\n\n return {\n absolutelyPositioned,\n height: rect.height,\n inViewport,\n width: rect.width,\n x: rect.left,\n y: rect.top,\n };\n}\n\nfunction applyViewTransitionName(\n element: Element,\n name: string,\n className: string | null,\n): void {\n const style = (element as HTMLElement).style;\n\n style.viewTransitionName = escapeViewTransitionName(name);\n if (className !== null) style.viewTransitionClass = className;\n}\n\nfunction restoreViewTransitionName(element: Element, props: Props): void {\n const style = (element as HTMLElement).style;\n const styleProp = props.style;\n const name =\n styleProp?.viewTransitionName ?? styleProp?.[\"view-transition-name\"];\n const className =\n styleProp?.viewTransitionClass ?? styleProp?.[\"view-transition-class\"];\n\n style.viewTransitionName = styleValue(name);\n style.viewTransitionClass = styleValue(className);\n}\n\nfunction ownerDocument(container: Container): ViewTransitionDocument {\n return (container.ownerDocument ?? document) as ViewTransitionDocument;\n}\n\nfunction styleValue(value: unknown): string {\n if (typeof value === \"string\" || typeof value === \"number\") {\n return String(value).trim();\n }\n\n return \"\";\n}\n\nexport const viewTransitionHostConfig: ViewTransitionHostConfig<\n Container,\n Element\n> = {\n commit: commitViewTransition,\n apply: applyViewTransitionName,\n restore: restoreViewTransitionName,\n measure: measureViewTransitionSurface,\n createSurface: createDOMViewTransitionSurface,\n // Park eligible commits behind the shared per-document mutex while\n // rendering continues, then re-schedule once the transition settles.\n suspend(container, options, onFinished) {\n return coordinateActiveViewTransition(\n ownerDocument(container),\n options.interrupt,\n onFinished,\n );\n },\n};\n","/**\n * Opt-in DOM View Transition integration for Fig.\n *\n * @module\n */\nimport { createViewTransitionCommitCoordinator } from \"@bgub/fig-reconciler/view-transitions\";\nimport { domRenderer } from \"./renderer.ts\";\nimport { viewTransitionHostConfig } from \"./view-transition.ts\";\n\nexport {\n getViewTransitionPseudoElements,\n type ViewTransitionPseudoElement,\n type ViewTransitionPseudoElements,\n} from \"./view-transition-pseudos.ts\";\n\nconst coordinator = createViewTransitionCommitCoordinator(\n viewTransitionHostConfig,\n);\n\n/** Enables view transitions. */\nexport function enableViewTransitions(): void {\n domRenderer.installCommitCoordinator(coordinator);\n}\n"],"mappings":"+OAsBA,MAAM,EAAc,IAAI,QAKxB,SAAgB,EACd,EACA,EACA,EACuB,CACvB,IAAM,EAAiC,CAAE,MAAK,EAE9C,OADA,EAAY,IAAI,EAAS,CAAE,MAAO,EAAQ,cAAe,WAAU,CAAC,EAC7D,CACT,CAGA,SAAgB,EACd,EAC8B,CAC9B,IAAM,EAAW,EAAY,IAAI,CAAO,EACxC,GAAI,IAAa,IAAA,GACf,MAAU,MACR,sIAEF,EAGF,IAAM,EAAO,EAAyB,EAAQ,IAAI,EAC5C,EAAU,GACd,EACE,EAAS,MAAM,gBACf,qBAAqB,EAAK,GAAG,EAAK,EACpC,EACF,MAAO,CACL,MAAO,EAAO,OAAO,EACrB,UAAW,EAAO,YAAY,EAC9B,IAAK,EAAS,UAAU,IAAM,EAAO,KAAK,EAAI,KAC9C,IAAK,EAAS,UAAU,IAAM,EAAO,KAAK,EAAI,IAChD,CACF,CAEA,SAAS,EACP,EACA,EAC6B,CAC7B,MAAO,CACL,WACA,QAAQ,EAAW,EAAoB,CACrC,IAAM,EACJ,OAAO,GAAY,SACf,CAAE,SAAU,EAAS,cAAe,CAAS,EAC7C,CAAE,GA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,EACR,MAAO,EACP,QAAS,EACT,QAAS,EACT,cAAe,EAGf,QAAQ,EAAW,EAAS,EAAY,CACtC,OAAO,EACL,EAAc,CAAS,EACvB,EAAQ,UACR,CACF,CACF,CCrZA,CACF,EAGA,SAAgB,GAA8B,CAC5C,EAAY,yBAAyB,CAAW,CAClD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bgub/fig-dom",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Fig DOM renderer",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/bgub/fig",
@@ -64,14 +64,14 @@
64
64
  "access": "public"
65
65
  },
66
66
  "dependencies": {
67
- "@bgub/fig-reconciler": "0.1.0"
67
+ "@bgub/fig-reconciler": "0.1.1"
68
68
  },
69
69
  "peerDependencies": {
70
- "@bgub/fig": "0.1.0"
70
+ "@bgub/fig": "0.1.1"
71
71
  },
72
72
  "devDependencies": {
73
- "@bgub/fig": "0.1.0",
74
- "@bgub/fig-server": "0.1.0"
73
+ "@bgub/fig-server": "0.1.1",
74
+ "@bgub/fig": "0.1.1"
75
75
  },
76
76
  "engines": {
77
77
  "node": "^20.19.0 || >=22.12.0"