@radix-ng/primitives 1.0.0-beta.3 → 1.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/fesm2022/radix-ng-primitives-accordion.mjs +5 -3
- package/fesm2022/radix-ng-primitives-accordion.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-alert-dialog.mjs +3 -2
- package/fesm2022/radix-ng-primitives-alert-dialog.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-autocomplete.mjs +617 -659
- package/fesm2022/radix-ng-primitives-autocomplete.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-calendar.mjs +5 -3
- package/fesm2022/radix-ng-primitives-calendar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-checkbox.mjs +33 -18
- package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-combobox.mjs +1305 -572
- package/fesm2022/radix-ng-primitives-combobox.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-config.mjs +13 -4
- package/fesm2022/radix-ng-primitives-config.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-context-menu.mjs +51 -10
- package/fesm2022/radix-ng-primitives-context-menu.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-core.mjs +1352 -64
- package/fesm2022/radix-ng-primitives-core.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-date-field.mjs +5 -3
- package/fesm2022/radix-ng-primitives-date-field.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-dialog.mjs +290 -120
- package/fesm2022/radix-ng-primitives-dialog.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-direction-provider.mjs +70 -0
- package/fesm2022/radix-ng-primitives-direction-provider.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-dismissable-layer.mjs +519 -184
- package/fesm2022/radix-ng-primitives-dismissable-layer.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-drawer.mjs +3 -3
- package/fesm2022/radix-ng-primitives-drawer.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-editable.mjs +12 -7
- package/fesm2022/radix-ng-primitives-editable.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-field.mjs +3 -2
- package/fesm2022/radix-ng-primitives-field.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-floating-focus-manager.mjs +803 -0
- package/fesm2022/radix-ng-primitives-floating-focus-manager.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-focus-scope.mjs +305 -70
- package/fesm2022/radix-ng-primitives-focus-scope.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-menu.mjs +893 -289
- package/fesm2022/radix-ng-primitives-menu.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-menubar.mjs +32 -4
- package/fesm2022/radix-ng-primitives-menubar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-navigation-menu.mjs +144 -159
- package/fesm2022/radix-ng-primitives-navigation-menu.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-number-field.mjs +7 -2
- package/fesm2022/radix-ng-primitives-number-field.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-popover.mjs +284 -212
- package/fesm2022/radix-ng-primitives-popover.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-popper.mjs +94 -51
- package/fesm2022/radix-ng-primitives-popper.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-presence.mjs +1 -1
- package/fesm2022/radix-ng-primitives-presence.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-preview-card.mjs +141 -173
- package/fesm2022/radix-ng-primitives-preview-card.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-radio.mjs +19 -14
- package/fesm2022/radix-ng-primitives-radio.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-roving-focus.mjs +4 -2
- package/fesm2022/radix-ng-primitives-roving-focus.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-scroll-area.mjs +5 -4
- package/fesm2022/radix-ng-primitives-scroll-area.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-select.mjs +241 -164
- package/fesm2022/radix-ng-primitives-select.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-slider.mjs +262 -29
- package/fesm2022/radix-ng-primitives-slider.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-stepper.mjs +16 -10
- package/fesm2022/radix-ng-primitives-stepper.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-switch.mjs +10 -5
- package/fesm2022/radix-ng-primitives-switch.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-tabs.mjs +15 -10
- package/fesm2022/radix-ng-primitives-tabs.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-time-field.mjs +5 -3
- package/fesm2022/radix-ng-primitives-time-field.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toast.mjs +15 -36
- package/fesm2022/radix-ng-primitives-toast.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toggle-group.mjs +14 -7
- package/fesm2022/radix-ng-primitives-toggle-group.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toggle.mjs +12 -6
- package/fesm2022/radix-ng-primitives-toggle.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toolbar.mjs +5 -3
- package/fesm2022/radix-ng-primitives-toolbar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-tooltip.mjs +251 -143
- package/fesm2022/radix-ng-primitives-tooltip.mjs.map +1 -1
- package/package.json +10 -1
- package/types/radix-ng-primitives-accordion.d.ts +4 -3
- package/types/radix-ng-primitives-autocomplete.d.ts +217 -152
- package/types/radix-ng-primitives-calendar.d.ts +5 -3
- package/types/radix-ng-primitives-checkbox.d.ts +27 -15
- package/types/radix-ng-primitives-combobox.d.ts +672 -283
- package/types/radix-ng-primitives-config.d.ts +1 -1
- package/types/radix-ng-primitives-context-menu.d.ts +15 -5
- package/types/radix-ng-primitives-core.d.ts +764 -14
- package/types/radix-ng-primitives-date-field.d.ts +3 -2
- package/types/radix-ng-primitives-dialog.d.ts +88 -32
- package/types/radix-ng-primitives-direction-provider.d.ts +41 -0
- package/types/radix-ng-primitives-dismissable-layer.d.ts +147 -99
- package/types/radix-ng-primitives-editable.d.ts +11 -5
- package/types/radix-ng-primitives-field.d.ts +1 -0
- package/types/radix-ng-primitives-floating-focus-manager.d.ts +272 -0
- package/types/radix-ng-primitives-focus-scope.d.ts +132 -1
- package/types/radix-ng-primitives-menu.d.ts +192 -103
- package/types/radix-ng-primitives-navigation-menu.d.ts +37 -75
- package/types/radix-ng-primitives-number-field.d.ts +8 -3
- package/types/radix-ng-primitives-popover.d.ts +71 -92
- package/types/radix-ng-primitives-popper.d.ts +39 -9
- package/types/radix-ng-primitives-preview-card.d.ts +39 -72
- package/types/radix-ng-primitives-radio.d.ts +13 -6
- package/types/radix-ng-primitives-roving-focus.d.ts +7 -6
- package/types/radix-ng-primitives-scroll-area.d.ts +2 -2
- package/types/radix-ng-primitives-select.d.ts +142 -109
- package/types/radix-ng-primitives-slider.d.ts +64 -12
- package/types/radix-ng-primitives-stepper.d.ts +15 -7
- package/types/radix-ng-primitives-switch.d.ts +10 -4
- package/types/radix-ng-primitives-tabs.d.ts +12 -6
- package/types/radix-ng-primitives-time-field.d.ts +3 -2
- package/types/radix-ng-primitives-toast.d.ts +7 -7
- package/types/radix-ng-primitives-toggle-group.d.ts +15 -8
- package/types/radix-ng-primitives-toggle.d.ts +10 -3
- package/types/radix-ng-primitives-toolbar.d.ts +3 -2
- package/types/radix-ng-primitives-tooltip.d.ts +61 -80
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radix-ng-primitives-presence.mjs","sources":["../../../packages/primitives/presence/src/presence-machine.ts","../../../packages/primitives/presence/src/presence.directive.ts","../../../packages/primitives/presence/radix-ng-primitives-presence.ts"],"sourcesContent":["import { afterNextRender, effect, Injector, Signal } from '@angular/core';\nimport { getMaxTransitionDuration } from '@radix-ng/primitives/core';\n\ntype PresenceState = 'mounted' | 'unmountSuspended' | 'unmounted';\ntype PresenceEvent = 'MOUNT' | 'UNMOUNT' | 'ANIMATION_OUT' | 'ANIMATION_END';\n\n/**\n * State machine mirroring `@radix-ui/react-presence`.\n *\n * - `mounted` — content rendered, `present` is `true`.\n * - `unmountSuspended` — `present` flipped to `false` but an exit animation is running;\n * the content stays in the DOM until the animation ends.\n * - `unmounted` — content removed.\n */\nconst MACHINE: Record<PresenceState, Partial<Record<PresenceEvent, PresenceState>>> = {\n mounted: { UNMOUNT: 'unmounted', ANIMATION_OUT: 'unmountSuspended' },\n unmountSuspended: { MOUNT: 'mounted', ANIMATION_END: 'unmounted' },\n unmounted: { MOUNT: 'mounted' }\n};\n\n/**\n * Grace period (ms) added to the longest declared exit duration before the safety-net timer\n * force-completes the exit. Only matters when a `finished` promise never settles (the engine\n * under-reports `getAnimations`, the animation is replaced without a cancel, reduced motion, …).\n * Mirrors `TRANSITION_FALLBACK_BUFFER` in `use-transition-status.ts`.\n */\nconst EXIT_FALLBACK_BUFFER = 50;\n\n/**\n * Operations the host directive supplies to {@link PresenceMachine}. The machine owns *when* the\n * view is mounted/unmounted (the state transitions and exit-animation suspension); the host owns\n * *how* — `RdxPresenceDirective` simply creates the embedded view in place, while `RdxPortalPresence`\n * additionally relocates its root nodes into a portal container.\n */\nexport interface PresenceMachineHost {\n /** Reactive `present` flag driving the machine. */\n readonly present: Signal<boolean>;\n /** Whether we are running in a browser (animation/computed-style logic is skipped on the server). */\n readonly isBrowser: boolean;\n /** Injection context for the internal `effect` / `afterNextRender`. */\n readonly injector: Injector;\n /**\n * Create (and, for the portal, relocate) the view. Returns the root `HTMLElement` nodes whose\n * exit animations should suspend the unmount. For a single-root template this is one element —\n * identical to the previous single-node behavior; dialog-shaped templates return backdrop + popup.\n */\n mountView(): HTMLElement[];\n /** Destroy the view (Angular removes the nodes from wherever they currently live). */\n destroyView(): void;\n}\n\n/**\n * Reusable presence state machine extracted from `RdxPresenceDirective`. It keeps content mounted\n * while a CSS exit animation runs anywhere inside the template — a `@keyframes` **or** a\n * `transition` (`data-ending-style`), on a watched root **or any of its descendants** — and unmounts\n * only once every exit animation started by the close has finished. With no exit animation it\n * unmounts immediately. For a single watched node and a root-level keyframe this reduces exactly to\n * the original `RdxPresenceDirective` behavior.\n *\n * Detection (ADR 0011) uses the Web Animations API: when `present()` flips `false` we snapshot a\n * close timestamp, and after the next render collect `node.getAnimations({ subtree: true })`, keeping\n * only animations that are running/pending and were *started by* the close (`startTime` null or\n * `>= closeTimestamp`). The view stays mounted until all of their `finished` promises settle, bounded\n * by a duration-based safety net. The legacy root-level computed-`animationName` check and the\n * `animationstart`/`animationend` listeners are kept as an additional acceptor — they drive the\n * zoneless jsdom suites (where `getAnimations` is absent) and cost nothing in a real browser.\n */\nexport class PresenceMachine {\n private state: PresenceState;\n private prevPresent: boolean;\n\n /** Root nodes currently watched for exit animations (set on mount). */\n private nodes: HTMLElement[] = [];\n /** Last-seen computed `animationName` per node, used to detect a *fresh* root exit animation. */\n private readonly prevAnimationNames = new WeakMap<HTMLElement, string>();\n /** Root nodes whose exit animation the event path is still waiting on (jsdom / root-keyframe). */\n private readonly pendingExits = new Set<HTMLElement>();\n private removeListeners: (() => void) | null = null;\n\n /**\n * Timeline time captured the moment `present` flipped `false`, on the same clock as\n * `Animation.startTime`. Animations started at or after it are the exit animations.\n */\n private closeTimestamp = 0;\n /**\n * Monotonic counter bumped on every mount/unmount transition. A suspended exit captures it and\n * its `finished`/safety-net resolution is ignored if it changed in the meantime (re-open or a\n * second close), so a stale promise can never tear down a freshly-reopened view.\n */\n private exitVersion = 0;\n /** True while a WAAPI `finished`-promise wait owns completion; gates the event path off. */\n private waapiPending = false;\n private safetyTimer: ReturnType<typeof setTimeout> | null = null;\n\n constructor(private readonly host: PresenceMachineHost) {\n this.prevPresent = host.present();\n this.state = this.prevPresent ? 'mounted' : 'unmounted';\n\n if (this.prevPresent) {\n this.mount();\n }\n\n effect(\n () => {\n const present = host.present();\n\n if (present === this.prevPresent) {\n return;\n }\n this.prevPresent = present;\n\n if (present) {\n // Mount synchronously so the enter animation can start on this frame.\n this.send('MOUNT');\n } else if (host.isBrowser) {\n // Snapshot the close time *now* (before the render that applies the closed-state\n // styles) so the freshness filter can tell exit animations from pre-existing ones.\n this.closeTimestamp = this.now();\n // Defer the unmount decision until the next render, so the consumer's\n // `data-state` / `data-ending-style` (and therefore the exit styles) are applied\n // to the DOM before we read the running animations.\n afterNextRender(() => this.evaluateExit(), { injector: host.injector });\n } else {\n this.send('UNMOUNT');\n }\n },\n { injector: host.injector }\n );\n }\n\n /** Tear the machine down — destroys the view. Call from the host's `DestroyRef`. */\n dispose(): void {\n this.unmount();\n }\n\n /** Decides whether to suspend the unmount for an exit animation (port of Radix' logic). */\n private evaluateExit(): void {\n // Re-opened before this callback ran — keep the content mounted.\n if (this.state !== 'mounted' || this.host.present()) {\n return;\n }\n\n this.pendingExits.clear();\n\n // Legacy acceptor: a watched root whose closed state starts a *different* `@keyframes`.\n // This is what the zoneless jsdom suite drives (via synthetic `animationstart`/`animationend`)\n // and what catches root keyframes in engines that do not expose `getAnimations`.\n for (const node of this.nodes) {\n const styles = getComputedStyle(node);\n const currentAnimationName = styles.animationName || 'none';\n const prevAnimationName = this.prevAnimationNames.get(node) ?? 'none';\n\n const isAnimating =\n currentAnimationName !== 'none' &&\n styles.display !== 'none' &&\n prevAnimationName !== currentAnimationName;\n\n if (isAnimating) {\n this.pendingExits.add(node);\n }\n }\n\n // WAAPI acceptor (ADR 0011): subtree-aware, transitions *or* keyframes, on any element in the\n // template. This is what makes popup-level exits work without a positioner decoy keyframe.\n const exitAnimations = this.collectExitAnimations();\n\n if (this.pendingExits.size === 0 && exitAnimations.length === 0) {\n // Nothing runs a fresh exit animation — unmount right away.\n this.send('UNMOUNT');\n return;\n }\n\n this.send('ANIMATION_OUT');\n\n if (exitAnimations.length > 0) {\n // WAAPI sees the whole subtree, so it supersedes the root-event path for this close:\n // wait for every fresh exit animation, version-guarded against re-open.\n this.waapiPending = true;\n const version = this.exitVersion;\n\n void Promise.all(exitAnimations.map((animation) => animation.finished.catch(() => undefined))).then(() =>\n this.finishExit(version)\n );\n\n this.armSafetyNet(version, exitAnimations);\n }\n // else: no WAAPI animations (jsdom, or an engine without `getAnimations`) → the root-event\n // path drains `pendingExits` through `onEnd`, exactly as before this ADR.\n }\n\n /**\n * Running/pending animations across the watched subtrees that were *started by* the close.\n * Pre-existing animations (an infinite spinner, a settled enter) have an earlier `startTime`\n * and must not delay the unmount.\n */\n private collectExitAnimations(): Animation[] {\n if (!this.host.isBrowser) {\n return [];\n }\n\n const result: Animation[] = [];\n\n for (const node of this.nodes) {\n if (typeof node.getAnimations !== 'function') {\n continue;\n }\n\n for (const animation of node.getAnimations({ subtree: true })) {\n const fresh = animation.startTime === null || Number(animation.startTime) >= this.closeTimestamp;\n\n // `animation.pending` is the WAAPI \"created but not yet started this frame\" flag — a\n // freshly triggered exit. `playState` itself never reports `'pending'`.\n if ((animation.playState === 'running' || animation.pending) && fresh) {\n result.push(animation);\n }\n }\n }\n\n return result;\n }\n\n /**\n * Force-completes the exit shortly after the longest declared duration, in case a `finished`\n * promise never settles. Measures the animated targets (falling back to the roots).\n */\n private armSafetyNet(version: number, exitAnimations: Animation[]): void {\n const targets = new Set<HTMLElement>(this.nodes);\n\n for (const animation of exitAnimations) {\n const target = (animation.effect as KeyframeEffect | null)?.target;\n if (target instanceof HTMLElement) {\n targets.add(target);\n }\n }\n\n let maxDuration = 0;\n for (const element of targets) {\n maxDuration = Math.max(maxDuration, getMaxTransitionDuration(element));\n }\n\n this.clearSafetyNet();\n this.safetyTimer = setTimeout(() => this.finishExit(version), maxDuration + EXIT_FALLBACK_BUFFER);\n }\n\n /** Settle a WAAPI/safety-net exit wait, ignoring it if a newer mount/unmount superseded it. */\n private finishExit(version: number): void {\n if (version !== this.exitVersion) {\n return;\n }\n this.waapiPending = false;\n this.clearSafetyNet();\n this.send('ANIMATION_END');\n }\n\n private clearSafetyNet(): void {\n if (this.safetyTimer !== null) {\n clearTimeout(this.safetyTimer);\n this.safetyTimer = null;\n }\n }\n\n private send(event: PresenceEvent): void {\n const next = MACHINE[this.state][event];\n if (next === undefined || next === this.state) {\n return;\n }\n\n this.state = next;\n\n if (next === 'mounted') {\n // Bump the version so any in-flight exit wait from a prior close is ignored.\n this.exitVersion++;\n this.waapiPending = false;\n this.clearSafetyNet();\n\n if (this.nodes.length > 0) {\n // Re-opened while an exit animation was running — refresh the tracked animations and\n // drop any pending exits so a late `animationend` cannot tear down the live view.\n this.pendingExits.clear();\n for (const node of this.nodes) {\n this.prevAnimationNames.set(node, this.getAnimationName(node));\n }\n } else {\n this.mount();\n }\n } else if (next === 'unmounted') {\n this.exitVersion++;\n this.unmount();\n }\n // `unmountSuspended` keeps the existing view mounted until ANIMATION_END.\n }\n\n private mount(): void {\n this.nodes = this.host.mountView();\n\n if (this.host.isBrowser && this.nodes.length > 0) {\n for (const node of this.nodes) {\n this.prevAnimationNames.set(node, this.getAnimationName(node));\n }\n this.addAnimationListeners();\n }\n }\n\n private unmount(): void {\n this.removeListeners?.();\n this.removeListeners = null;\n this.clearSafetyNet();\n this.waapiPending = false;\n this.host.destroyView();\n this.nodes = [];\n this.pendingExits.clear();\n }\n\n private addAnimationListeners(): void {\n const onStart = (event: AnimationEvent) => {\n const node = event.target as HTMLElement;\n if (this.nodes.includes(node)) {\n this.prevAnimationNames.set(node, this.getAnimationName(node));\n }\n };\n const onEnd = (event: AnimationEvent) => {\n const node = event.target as HTMLElement;\n if (!this.nodes.includes(node)) {\n return;\n }\n // Ignore the end of an animation other than the one we are currently waiting on.\n if (!this.getAnimationName(node).includes(event.animationName)) {\n return;\n }\n\n this.pendingExits.delete(node);\n // While a WAAPI wait owns completion it is authoritative (it sees the full subtree); the\n // event path only drives the unmount when no WAAPI animations were detected.\n if (!this.waapiPending && this.pendingExits.size === 0) {\n this.finishExit(this.exitVersion);\n }\n };\n\n for (const node of this.nodes) {\n node.addEventListener('animationstart', onStart);\n node.addEventListener('animationcancel', onEnd);\n node.addEventListener('animationend', onEnd);\n }\n\n this.removeListeners = () => {\n for (const node of this.nodes) {\n node.removeEventListener('animationstart', onStart);\n node.removeEventListener('animationcancel', onEnd);\n node.removeEventListener('animationend', onEnd);\n }\n };\n }\n\n private getAnimationName(node: HTMLElement): string {\n return (this.host.isBrowser ? getComputedStyle(node).animationName : '') || 'none';\n }\n\n /** Current timeline time on the same clock as `Animation.startTime` (ms), or 0 if unavailable. */\n private now(): number {\n const time = typeof document !== 'undefined' ? document.timeline?.currentTime : null;\n return typeof time === 'number' ? time : Number(time ?? 0);\n }\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n DestroyRef,\n Directive,\n EmbeddedViewRef,\n inject,\n InjectionToken,\n Injector,\n PLATFORM_ID,\n Provider,\n Signal,\n TemplateRef,\n ViewContainerRef\n} from '@angular/core';\nimport { PresenceMachine } from './presence-machine';\n\n/**\n * Context interface for RdxPresence directive\n * Contains a Signal that indicates whether the content should be present in the DOM\n */\nexport type RdxPresenceContext = {\n present: Signal<boolean>;\n};\n\nexport const RDX_PRESENCE_CONTEXT = new InjectionToken<RdxPresenceContext>('RdxPresenceContext');\n\n/**\n * Factory provider helper.\n * In your parent component/directive you can write:\n *\n * providers: [\n * provideRdxPresenceContext(() => ({ present: myBooleanSignal }))\n * ]\n */\nexport function provideRdxPresenceContext(contextFactory: () => RdxPresenceContext): Provider {\n return { provide: RDX_PRESENCE_CONTEXT, useFactory: contextFactory };\n}\n\n/**\n * Headless structural directive that conditionally renders its template based on a reactive\n * `present` signal supplied through {@link RDX_PRESENCE_CONTEXT}.\n *\n * Unlike a plain `*ngIf`, it keeps the content mounted while a CSS exit animation\n * (`@keyframes` applied for the closed state) is running, and unmounts it only once that\n * animation finishes. If the content has no exit animation, it unmounts immediately.\n *\n * The mount/unmount-with-exit logic lives in the shared {@link PresenceMachine}; this directive just\n * creates the embedded view in place (`RdxPortalPresence` reuses the same machine and additionally\n * relocates the view into a portal container).\n */\n@Directive({\n standalone: true\n})\nexport class RdxPresenceDirective {\n private readonly viewContainerRef = inject(ViewContainerRef);\n private readonly templateRef = inject(TemplateRef<void>);\n\n private viewRef: EmbeddedViewRef<void> | null = null;\n\n constructor() {\n const machine = new PresenceMachine({\n present: inject(RDX_PRESENCE_CONTEXT).present,\n isBrowser: isPlatformBrowser(inject(PLATFORM_ID)),\n injector: inject(Injector),\n mountView: () => this.mountView(),\n destroyView: () => this.destroyView()\n });\n\n inject(DestroyRef).onDestroy(() => machine.dispose());\n }\n\n private mountView(): HTMLElement[] {\n this.viewRef = this.viewContainerRef.createEmbeddedView(this.templateRef);\n const node = this.viewRef.rootNodes.find((n): n is HTMLElement => n instanceof HTMLElement);\n return node ? [node] : [];\n }\n\n private destroyView(): void {\n this.viewRef?.destroy();\n this.viewRef = null;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAMA;;;;;;;AAOG;AACH,MAAM,OAAO,GAAyE;IAClF,OAAO,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,kBAAkB,EAAE;IACpE,gBAAgB,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE;AAClE,IAAA,SAAS,EAAE,EAAE,KAAK,EAAE,SAAS;CAChC;AAED;;;;;AAKG;AACH,MAAM,oBAAoB,GAAG,EAAE;AAyB/B;;;;;;;;;;;;;;;AAeG;MACU,eAAe,CAAA;AA2BxB,IAAA,WAAA,CAA6B,IAAyB,EAAA;QAAzB,IAAA,CAAA,IAAI,GAAJ,IAAI;;QAtBzB,IAAA,CAAA,KAAK,GAAkB,EAAE;;AAEhB,QAAA,IAAA,CAAA,kBAAkB,GAAG,IAAI,OAAO,EAAuB;;AAEvD,QAAA,IAAA,CAAA,YAAY,GAAG,IAAI,GAAG,EAAe;QAC9C,IAAA,CAAA,eAAe,GAAwB,IAAI;AAEnD;;;AAGG;QACK,IAAA,CAAA,cAAc,GAAG,CAAC;AAC1B;;;;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AC,kBAAkB,CAAC,IAAI,CAAC,WAAW,CAAC;AACzE,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,KAAuB,CAAC,YAAY,WAAW,CAAC;QAC3F,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE;IAC7B;IAEQ,WAAW,GAAA;AACf,QAAA,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE;AACvB,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI;IACvB;8GA3BS,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAApB,oBAAoB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAApB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAHhC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,UAAU,EAAE;AACf,iBAAA;;;ACpDD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"radix-ng-primitives-presence.mjs","sources":["../../../packages/primitives/presence/src/presence-machine.ts","../../../packages/primitives/presence/src/presence.directive.ts","../../../packages/primitives/presence/radix-ng-primitives-presence.ts"],"sourcesContent":["import { afterNextRender, effect, Injector, Signal } from '@angular/core';\nimport { getMaxTransitionDuration } from '@radix-ng/primitives/core';\n\ntype PresenceState = 'mounted' | 'unmountSuspended' | 'unmounted';\ntype PresenceEvent = 'MOUNT' | 'UNMOUNT' | 'ANIMATION_OUT' | 'ANIMATION_END';\n\n/**\n * State machine mirroring `@radix-ui/react-presence`.\n *\n * - `mounted` — content rendered, `present` is `true`.\n * - `unmountSuspended` — `present` flipped to `false` but an exit animation is running;\n * the content stays in the DOM until the animation ends.\n * - `unmounted` — content removed.\n */\nconst MACHINE: Record<PresenceState, Partial<Record<PresenceEvent, PresenceState>>> = {\n mounted: { UNMOUNT: 'unmounted', ANIMATION_OUT: 'unmountSuspended' },\n unmountSuspended: { MOUNT: 'mounted', ANIMATION_END: 'unmounted' },\n unmounted: { MOUNT: 'mounted' }\n};\n\n/**\n * Grace period (ms) added to the longest declared exit duration before the safety-net timer\n * force-completes the exit. Only matters when a `finished` promise never settles (the engine\n * under-reports `getAnimations`, the animation is replaced without a cancel, reduced motion, …).\n * Mirrors `TRANSITION_FALLBACK_BUFFER` in `use-transition-status.ts`.\n */\nconst EXIT_FALLBACK_BUFFER = 50;\n\n/**\n * Operations the host directive supplies to {@link PresenceMachine}. The machine owns *when* the\n * view is mounted/unmounted (the state transitions and exit-animation suspension); the host owns\n * *how* — `RdxPresenceDirective` simply creates the embedded view in place, while `RdxPortalPresence`\n * additionally relocates its root nodes into a portal container.\n */\nexport interface PresenceMachineHost {\n /** Reactive `present` flag driving the machine. */\n readonly present: Signal<boolean>;\n /** Whether we are running in a browser (animation/computed-style logic is skipped on the server). */\n readonly isBrowser: boolean;\n /** Injection context for the internal `effect` / `afterNextRender`. */\n readonly injector: Injector;\n /**\n * Create (and, for the portal, relocate) the view. Returns the root `HTMLElement` nodes whose\n * exit animations should suspend the unmount. For a single-root template this is one element —\n * identical to the previous single-node behavior; dialog-shaped templates return backdrop + popup.\n */\n mountView(): HTMLElement[];\n /** Destroy the view (Angular removes the nodes from wherever they currently live). */\n destroyView(): void;\n}\n\n/**\n * Reusable presence state machine extracted from `RdxPresenceDirective`. It keeps content mounted\n * while a CSS exit animation runs anywhere inside the template — a `@keyframes` **or** a\n * `transition` (`data-ending-style`), on a watched root **or any of its descendants** — and unmounts\n * only once every exit animation started by the close has finished. With no exit animation it\n * unmounts immediately. For a single watched node and a root-level keyframe this reduces exactly to\n * the original `RdxPresenceDirective` behavior.\n *\n * Detection (ADR 0011) uses the Web Animations API: when `present()` flips `false` we snapshot a\n * close timestamp, and after the next render collect `node.getAnimations({ subtree: true })`, keeping\n * only animations that are running/pending and were *started by* the close (`startTime` null or\n * `>= closeTimestamp`). The view stays mounted until all of their `finished` promises settle, bounded\n * by a duration-based safety net. The legacy root-level computed-`animationName` check and the\n * `animationstart`/`animationend` listeners are kept as an additional acceptor — they drive the\n * zoneless jsdom suites (where `getAnimations` is absent) and cost nothing in a real browser.\n */\nexport class PresenceMachine {\n private state: PresenceState;\n private prevPresent: boolean;\n\n /** Root nodes currently watched for exit animations (set on mount). */\n private nodes: HTMLElement[] = [];\n /** Last-seen computed `animationName` per node, used to detect a *fresh* root exit animation. */\n private readonly prevAnimationNames = new WeakMap<HTMLElement, string>();\n /** Root nodes whose exit animation the event path is still waiting on (jsdom / root-keyframe). */\n private readonly pendingExits = new Set<HTMLElement>();\n private removeListeners: (() => void) | null = null;\n\n /**\n * Timeline time captured the moment `present` flipped `false`, on the same clock as\n * `Animation.startTime`. Animations started at or after it are the exit animations.\n */\n private closeTimestamp = 0;\n /**\n * Monotonic counter bumped on every mount/unmount transition. A suspended exit captures it and\n * its `finished`/safety-net resolution is ignored if it changed in the meantime (re-open or a\n * second close), so a stale promise can never tear down a freshly-reopened view.\n */\n private exitVersion = 0;\n /** True while a WAAPI `finished`-promise wait owns completion; gates the event path off. */\n private waapiPending = false;\n private safetyTimer: ReturnType<typeof setTimeout> | null = null;\n\n constructor(private readonly host: PresenceMachineHost) {\n this.prevPresent = host.present();\n this.state = this.prevPresent ? 'mounted' : 'unmounted';\n\n if (this.prevPresent) {\n this.mount();\n }\n\n effect(\n () => {\n const present = host.present();\n\n if (present === this.prevPresent) {\n return;\n }\n this.prevPresent = present;\n\n if (present) {\n // Mount synchronously so the enter animation can start on this frame.\n this.send('MOUNT');\n } else if (host.isBrowser) {\n // Snapshot the close time *now* (before the render that applies the closed-state\n // styles) so the freshness filter can tell exit animations from pre-existing ones.\n this.closeTimestamp = this.now();\n // Defer the unmount decision until the next render, so the consumer's\n // `data-state` / `data-ending-style` (and therefore the exit styles) are applied\n // to the DOM before we read the running animations.\n afterNextRender(() => this.evaluateExit(), { injector: host.injector });\n } else {\n this.send('UNMOUNT');\n }\n },\n { injector: host.injector, debugName: 'PresenceMachine.present' }\n );\n }\n\n /** Tear the machine down — destroys the view. Call from the host's `DestroyRef`. */\n dispose(): void {\n this.unmount();\n }\n\n /** Decides whether to suspend the unmount for an exit animation (port of Radix' logic). */\n private evaluateExit(): void {\n // Re-opened before this callback ran — keep the content mounted.\n if (this.state !== 'mounted' || this.host.present()) {\n return;\n }\n\n this.pendingExits.clear();\n\n // Legacy acceptor: a watched root whose closed state starts a *different* `@keyframes`.\n // This is what the zoneless jsdom suite drives (via synthetic `animationstart`/`animationend`)\n // and what catches root keyframes in engines that do not expose `getAnimations`.\n for (const node of this.nodes) {\n const styles = getComputedStyle(node);\n const currentAnimationName = styles.animationName || 'none';\n const prevAnimationName = this.prevAnimationNames.get(node) ?? 'none';\n\n const isAnimating =\n currentAnimationName !== 'none' &&\n styles.display !== 'none' &&\n prevAnimationName !== currentAnimationName;\n\n if (isAnimating) {\n this.pendingExits.add(node);\n }\n }\n\n // WAAPI acceptor (ADR 0011): subtree-aware, transitions *or* keyframes, on any element in the\n // template. This is what makes popup-level exits work without a positioner decoy keyframe.\n const exitAnimations = this.collectExitAnimations();\n\n if (this.pendingExits.size === 0 && exitAnimations.length === 0) {\n // Nothing runs a fresh exit animation — unmount right away.\n this.send('UNMOUNT');\n return;\n }\n\n this.send('ANIMATION_OUT');\n\n if (exitAnimations.length > 0) {\n // WAAPI sees the whole subtree, so it supersedes the root-event path for this close:\n // wait for every fresh exit animation, version-guarded against re-open.\n this.waapiPending = true;\n const version = this.exitVersion;\n\n void Promise.all(exitAnimations.map((animation) => animation.finished.catch(() => undefined))).then(() =>\n this.finishExit(version)\n );\n\n this.armSafetyNet(version, exitAnimations);\n }\n // else: no WAAPI animations (jsdom, or an engine without `getAnimations`) → the root-event\n // path drains `pendingExits` through `onEnd`, exactly as before this ADR.\n }\n\n /**\n * Running/pending animations across the watched subtrees that were *started by* the close.\n * Pre-existing animations (an infinite spinner, a settled enter) have an earlier `startTime`\n * and must not delay the unmount.\n */\n private collectExitAnimations(): Animation[] {\n if (!this.host.isBrowser) {\n return [];\n }\n\n const result: Animation[] = [];\n\n for (const node of this.nodes) {\n if (typeof node.getAnimations !== 'function') {\n continue;\n }\n\n for (const animation of node.getAnimations({ subtree: true })) {\n const fresh = animation.startTime === null || Number(animation.startTime) >= this.closeTimestamp;\n\n // `animation.pending` is the WAAPI \"created but not yet started this frame\" flag — a\n // freshly triggered exit. `playState` itself never reports `'pending'`.\n if ((animation.playState === 'running' || animation.pending) && fresh) {\n result.push(animation);\n }\n }\n }\n\n return result;\n }\n\n /**\n * Force-completes the exit shortly after the longest declared duration, in case a `finished`\n * promise never settles. Measures the animated targets (falling back to the roots).\n */\n private armSafetyNet(version: number, exitAnimations: Animation[]): void {\n const targets = new Set<HTMLElement>(this.nodes);\n\n for (const animation of exitAnimations) {\n const target = (animation.effect as KeyframeEffect | null)?.target;\n if (target instanceof HTMLElement) {\n targets.add(target);\n }\n }\n\n let maxDuration = 0;\n for (const element of targets) {\n maxDuration = Math.max(maxDuration, getMaxTransitionDuration(element));\n }\n\n this.clearSafetyNet();\n this.safetyTimer = setTimeout(() => this.finishExit(version), maxDuration + EXIT_FALLBACK_BUFFER);\n }\n\n /** Settle a WAAPI/safety-net exit wait, ignoring it if a newer mount/unmount superseded it. */\n private finishExit(version: number): void {\n if (version !== this.exitVersion) {\n return;\n }\n this.waapiPending = false;\n this.clearSafetyNet();\n this.send('ANIMATION_END');\n }\n\n private clearSafetyNet(): void {\n if (this.safetyTimer !== null) {\n clearTimeout(this.safetyTimer);\n this.safetyTimer = null;\n }\n }\n\n private send(event: PresenceEvent): void {\n const next = MACHINE[this.state][event];\n if (next === undefined || next === this.state) {\n return;\n }\n\n this.state = next;\n\n if (next === 'mounted') {\n // Bump the version so any in-flight exit wait from a prior close is ignored.\n this.exitVersion++;\n this.waapiPending = false;\n this.clearSafetyNet();\n\n if (this.nodes.length > 0) {\n // Re-opened while an exit animation was running — refresh the tracked animations and\n // drop any pending exits so a late `animationend` cannot tear down the live view.\n this.pendingExits.clear();\n for (const node of this.nodes) {\n this.prevAnimationNames.set(node, this.getAnimationName(node));\n }\n } else {\n this.mount();\n }\n } else if (next === 'unmounted') {\n this.exitVersion++;\n this.unmount();\n }\n // `unmountSuspended` keeps the existing view mounted until ANIMATION_END.\n }\n\n private mount(): void {\n this.nodes = this.host.mountView();\n\n if (this.host.isBrowser && this.nodes.length > 0) {\n for (const node of this.nodes) {\n this.prevAnimationNames.set(node, this.getAnimationName(node));\n }\n this.addAnimationListeners();\n }\n }\n\n private unmount(): void {\n this.removeListeners?.();\n this.removeListeners = null;\n this.clearSafetyNet();\n this.waapiPending = false;\n this.host.destroyView();\n this.nodes = [];\n this.pendingExits.clear();\n }\n\n private addAnimationListeners(): void {\n const onStart = (event: AnimationEvent) => {\n const node = event.target as HTMLElement;\n if (this.nodes.includes(node)) {\n this.prevAnimationNames.set(node, this.getAnimationName(node));\n }\n };\n const onEnd = (event: AnimationEvent) => {\n const node = event.target as HTMLElement;\n if (!this.nodes.includes(node)) {\n return;\n }\n // Ignore the end of an animation other than the one we are currently waiting on.\n if (!this.getAnimationName(node).includes(event.animationName)) {\n return;\n }\n\n this.pendingExits.delete(node);\n // While a WAAPI wait owns completion it is authoritative (it sees the full subtree); the\n // event path only drives the unmount when no WAAPI animations were detected.\n if (!this.waapiPending && this.pendingExits.size === 0) {\n this.finishExit(this.exitVersion);\n }\n };\n\n for (const node of this.nodes) {\n node.addEventListener('animationstart', onStart);\n node.addEventListener('animationcancel', onEnd);\n node.addEventListener('animationend', onEnd);\n }\n\n this.removeListeners = () => {\n for (const node of this.nodes) {\n node.removeEventListener('animationstart', onStart);\n node.removeEventListener('animationcancel', onEnd);\n node.removeEventListener('animationend', onEnd);\n }\n };\n }\n\n private getAnimationName(node: HTMLElement): string {\n return (this.host.isBrowser ? getComputedStyle(node).animationName : '') || 'none';\n }\n\n /** Current timeline time on the same clock as `Animation.startTime` (ms), or 0 if unavailable. */\n private now(): number {\n const time = typeof document !== 'undefined' ? document.timeline?.currentTime : null;\n return typeof time === 'number' ? time : Number(time ?? 0);\n }\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n DestroyRef,\n Directive,\n EmbeddedViewRef,\n inject,\n InjectionToken,\n Injector,\n PLATFORM_ID,\n Provider,\n Signal,\n TemplateRef,\n ViewContainerRef\n} from '@angular/core';\nimport { PresenceMachine } from './presence-machine';\n\n/**\n * Context interface for RdxPresence directive\n * Contains a Signal that indicates whether the content should be present in the DOM\n */\nexport type RdxPresenceContext = {\n present: Signal<boolean>;\n};\n\nexport const RDX_PRESENCE_CONTEXT = new InjectionToken<RdxPresenceContext>('RdxPresenceContext');\n\n/**\n * Factory provider helper.\n * In your parent component/directive you can write:\n *\n * providers: [\n * provideRdxPresenceContext(() => ({ present: myBooleanSignal }))\n * ]\n */\nexport function provideRdxPresenceContext(contextFactory: () => RdxPresenceContext): Provider {\n return { provide: RDX_PRESENCE_CONTEXT, useFactory: contextFactory };\n}\n\n/**\n * Headless structural directive that conditionally renders its template based on a reactive\n * `present` signal supplied through {@link RDX_PRESENCE_CONTEXT}.\n *\n * Unlike a plain `*ngIf`, it keeps the content mounted while a CSS exit animation\n * (`@keyframes` applied for the closed state) is running, and unmounts it only once that\n * animation finishes. If the content has no exit animation, it unmounts immediately.\n *\n * The mount/unmount-with-exit logic lives in the shared {@link PresenceMachine}; this directive just\n * creates the embedded view in place (`RdxPortalPresence` reuses the same machine and additionally\n * relocates the view into a portal container).\n */\n@Directive({\n standalone: true\n})\nexport class RdxPresenceDirective {\n private readonly viewContainerRef = inject(ViewContainerRef);\n private readonly templateRef = inject(TemplateRef<void>);\n\n private viewRef: EmbeddedViewRef<void> | null = null;\n\n constructor() {\n const machine = new PresenceMachine({\n present: inject(RDX_PRESENCE_CONTEXT).present,\n isBrowser: isPlatformBrowser(inject(PLATFORM_ID)),\n injector: inject(Injector),\n mountView: () => this.mountView(),\n destroyView: () => this.destroyView()\n });\n\n inject(DestroyRef).onDestroy(() => machine.dispose());\n }\n\n private mountView(): HTMLElement[] {\n this.viewRef = this.viewContainerRef.createEmbeddedView(this.templateRef);\n const node = this.viewRef.rootNodes.find((n): n is HTMLElement => n instanceof HTMLElement);\n return node ? [node] : [];\n }\n\n private destroyView(): void {\n this.viewRef?.destroy();\n this.viewRef = null;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAMA;;;;;;;AAOG;AACH,MAAM,OAAO,GAAyE;IAClF,OAAO,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,kBAAkB,EAAE;IACpE,gBAAgB,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE;AAClE,IAAA,SAAS,EAAE,EAAE,KAAK,EAAE,SAAS;CAChC;AAED;;;;;AAKG;AACH,MAAM,oBAAoB,GAAG,EAAE;AAyB/B;;;;;;;;;;;;;;;AAeG;MACU,eAAe,CAAA;AA2BxB,IAAA,WAAA,CAA6B,IAAyB,EAAA;QAAzB,IAAA,CAAA,IAAI,GAAJ,IAAI;;QAtBzB,IAAA,CAAA,KAAK,GAAkB,EAAE;;AAEhB,QAAA,IAAA,CAAA,kBAAkB,GAAG,IAAI,OAAO,EAAuB;;AAEvD,QAAA,IAAA,CAAA,YAAY,GAAG,IAAI,GAAG,EAAe;QAC9C,IAAA,CAAA,eAAe,GAAwB,IAAI;AAEnD;;;AAGG;QACK,IAAA,CAAA,cAAc,GAAG,CAAC;AAC1B;;;;AAIG;QACK,IAAA,CAAA,WAAW,GAAG,CAAC;;QAEf,IAAA,CAAA,YAAY,GAAG,KAAK;QACpB,IAAA,CAAA,WAAW,GAAyC,IAAI;AAG5D,QAAA,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,OAAO,EAAE;AACjC,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,WAAW,GAAG,SAAS,GAAG,WAAW;AAEvD,QAAA,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