Primitives / foldkit-primitives/motion

Presence

const · packages/primitives/src/motion/presence.ts:29

Args{ durationMs: number }
Model{ phase: "hidden" | "shown" | "hiding", generation: number }
MessagesHidden { generation: number }, Show, Hide
Its full type
const Presence: Bundle.Bundle<
  'Presence',
  { readonly durationMs: number },
  {
    readonly phase: 'hidden' | 'shown' | 'hiding'
    readonly generation: number
  },
  | { readonly _tag: 'Hidden'; readonly generation: number }
  | { readonly _tag: 'Show' }
  | { readonly _tag: 'Hide' },
  never,
  never,
  never,
  void,
  {},
  {}
>

Presence as a bundle: mount-transition state for exit animations. Hide starts a timed hiding phase; the Hidden fact it yields carries the generation it was scheduled under, so a Show in between wins and the late fact is ignored. The clock is Effect's, so tests drive it.

In the guides