import { TreePlane, TreePlaneLocation, PluridPartialConfiguration, PluridConfiguration, RouteDivisions, CameraState, PluridApi } from '@plurid/plurid-data'; import { A as AppState, B as PluridThunkExtra, D as TweenOptions, b as PluridReactApplicationProperties, d as PluridApplicationHandle } from './handle-u2vdZiPu.mjs'; import { ThunkDispatch, AnyAction } from '@reduxjs/toolkit'; import 'react'; import '@plurid/plurid-themes'; /** * Fixtures for a host's tests and the engine's own: the data the store holds, built the way the * application builds it, so a test never spells a tree node or a configuration by hand. */ interface ViewSize { width: number; height: number; } /** The view every fixture assumes unless told otherwise. */ declare const TEST_VIEW: ViewSize; /** The route divisions a tree node carries: the tree never parses them (the engine's tree logic). */ declare const emptyRouteDivisions: (host?: string) => RouteDivisions; type TreePlaneOverrides = Omit, 'location'> & { location?: Partial; }; /** A measured, shown tree node (400 × 300 at the origin): a root, or with `parentPlaneID` a spawned child. */ declare const treePlane: (planeID: string, overrides?: TreePlaneOverrides) => TreePlane; /** A view-sized sheet: what a page is in the page presentation. */ declare const viewSizedSheet: (planeID: string, overrides?: TreePlaneOverrides, view?: ViewSize) => TreePlane; /** A configuration: `partial` layered over the defaults the way the application layers a host's. */ declare const configurationWith: (partial?: PluridPartialConfiguration) => PluridConfiguration; /** The page presentation's configuration (its three defaults applied), with `partial` on top. */ declare const pageConfiguration: (partial?: PluridPartialConfiguration) => PluridConfiguration; type HeadlessDispatch = ThunkDispatch; /** * A HEADLESS STORE: the application's reducer and thunk extra without a DOM or a React tree. A * thunk runs through `dispatch` exactly as in the application (`dispatch(thunk)` or * `thunk(dispatch, getState, extra)`); every plain action that reached the reducer is kept. */ interface HeadlessStore { getState: () => AppState; dispatch: HeadlessDispatch; /** Told after every action, as the application's store tells its subscribers. Returns the unsubscribe. */ subscribe: (listener: () => void) => () => void; /** every plain action that reached the reducer, in order */ dispatched: AnyAction[]; /** the thunk extra: mount a motion controller on it with `motionSpy` */ extra: PluridThunkExtra; /** the camera commits so far (`space/setCamera`) */ cameraCommits: () => AnyAction[]; space: () => AppState['space']; tree: () => TreePlane[]; } interface HeadlessStoreOptions { view?: ViewSize; /** Include the history middleware, as the application does. Default `true`. */ history?: boolean; } /** * THE REAL STACK (2026-09-13). This used to be a hand-rolled `dispatch` closure over the reducer, with * NO middleware at all — so nothing in the unit suite ever ran a thunk through the middleware into the * reducer: the reducer was tested with no store, the thunks against a middleware-free dispatch, and * the history middleware against a fake reducer with invented action types. An action that changed * the arrangement but that the history middleware failed to record would have broken undo with every * test still green. * * It is now `configureStore` with `pluridMiddleware` — the same stack `PluridApplication` builds — * plus one recording middleware at the front, which is where `dispatched` comes from. RTK's * development checks (serializable / immutable) run here too, so a test now catches the mistakes they * are there to catch. */ declare const makeSpaceStore: (configuration?: PluridConfiguration, tree?: TreePlane[], options?: HeadlessStoreOptions) => HeadlessStore; interface RecordedTween { target: CameraState; options?: TweenOptions; } interface RecordedFling { velocity: { x: number; y: number; }; kind: string; } interface MotionStub { /** Every `tweenTo`, in order: what was asked for. */ tweens: RecordedTween[]; /** Every `fling`, in order. */ flings: RecordedFling[]; /** Every `gesture` call, in order: `true` as a drag starts, `false` as it ends. */ gestures: boolean[]; /** How many times an input cancelled the motion. */ cancels: number; /** Make the next `tweenTo` REFUSE (a jump instead of a tween) — the branch a caller must handle. */ refuse: (refusing?: boolean) => void; /** Say a motion is running, so a caller's "is something moving?" branch can be driven. */ setActive: (active: boolean) => void; /** * LAND the running tween, as its last frame does: its target is committed and its `onSettle` * called. `false` when no accepted tween is running (none started, or it landed, was cancelled * or was replaced). The stub moves nothing by itself, so a caller waiting for a landing (a tour * stop) is driven by this. */ land: () => boolean; } interface MotionStubOptions { /** Whether `tweenTo` reports a started tween. Default `true`. */ accept?: boolean; /** What `isActive()` says. Default `false`. */ active?: boolean; /** What `reducedMotion()` says. Default `false`. */ reducedMotion?: boolean; } /** * A mounted View's motion controller, STUBBED on the store's thunk extra: it records what was asked * of it and moves nothing (the real controller is `useCameraMotion`, tested against a deterministic * frame clock in its own suite). * * Until 2026-09-13 the stub lied in four ways — `tweenTo` always returned `true`, `isActive()` always * `false`, `cancel` and `fling` were unrecorded no-ops, and `reducedMotion()` was always `false` — so * "the controller refused the tween", "a drag cancelled a running tween", "a flick flung" and the * reduced-motion path were all unreachable from a unit test. Everything is recorded now, and the two * answers a caller branches on are the test's to set. */ declare const motionStub: (store: HeadlessStore, options?: MotionStubOptions) => MotionStub; /** The recorded tweens alone — what most callers want (`motionStub` for the rest). */ declare const motionSpy: (store: HeadlessStore) => RecordedTween[]; /** * `@plurid/plurid-react/testing` — render an application in jsdom, drive it with synthetic * gestures and keys, step a deterministic frame clock, and assert on the camera. Built for the * host's own test suites (vitest / jest with a DOM), not for the browser. */ type RenderPluridProperties = Partial; interface RenderedPlurid { container: HTMLElement; /** The view element (the gesture target). */ view: HTMLElement; api: PluridApi; handle: PluridApplicationHandle; rerender: (properties: RenderPluridProperties) => Promise; unmount: () => Promise; } /** jsdom has no `PointerEvent` and no pointer capture; the engine needs both. */ declare const installPointerEvents: () => void; /** jsdom has no `matchMedia` (reduced-motion and theme queries); a permissive stub. */ declare const installMatchMedia: () => void; type FrameClock = { advance: (milliseconds?: number) => void; now: () => number; pending: () => number; restore: () => void; }; /** * A controllable `requestAnimationFrame` + `performance.now`, for tweens, flings and per-frame * batchers. Install it BEFORE the input it should drive; `gestures.*` and `flushFrames` step it. */ declare const installFrameClock: () => FrameClock; /** Run `count` frames of `milliseconds` each through the installed frame clock (installed on demand). */ declare const flushFrames: (count?: number, milliseconds?: number) => Promise; /** * Render a `PluridApplication` and resolve once `onReady` fired. The view is the window's size * (jsdom's 1024 × 768 unless the test sets `window.innerWidth` / `innerHeight`). */ declare const renderPlurid: (properties?: RenderPluridProperties) => Promise; interface GestureModifiers { shiftKey?: boolean; altKey?: boolean; ctrlKey?: boolean; metaKey?: boolean; } /** Synthetic input, dispatched as the browser would (pointer, wheel, keyboard events). */ declare const gestures: { /** Press, move in `steps`, release. `button` 0 left, 1 middle, 2 right. */ drag: (target: Element, from: { x: number; y: number; }, to: { x: number; y: number; }, options?: GestureModifiers & { button?: number; steps?: number; pointerType?: string; pointerId?: number; }) => Promise; /** A pinch: two touch pointers moving apart (or together) about a midpoint. */ pinch: (target: Element, midpoint: { x: number; y: number; }, fromDistance: number, toDistance: number, steps?: number) => Promise; wheel: (target: Element, options?: GestureModifiers & { deltaX?: number; deltaY?: number; x?: number; y?: number; deltaMode?: number; }) => Promise; /** A key press (`keydown` then `keyup`) on `target` (the view by default). */ key: (target: Element, code: string, options?: GestureModifiers & { key?: string; }) => Promise; }; declare const pinned: { frame: (root: ParentNode, planeID: string) => HTMLElement | null; frames: (root: ParentNode) => HTMLElement[]; host: (root: ParentNode, planeID: string) => HTMLElement | null; /** Where the content host stands now: `pinned` in a frame, `space` in the plane, `none`. */ where: (root: ParentNode, planeID: string) => "pinned" | "space" | "none"; }; /** Camera assertions with a tolerance, throwing a readable error. */ declare const expectCamera: (camera: CameraState) => { toBeNear: (target: Partial, tolerance?: number) => void; }; export { type GestureModifiers, type HeadlessDispatch, type HeadlessStore, type HeadlessStoreOptions, type MotionStub, type MotionStubOptions, PluridApplicationHandle, type RecordedFling, type RecordedTween, type RenderPluridProperties, type RenderedPlurid, TEST_VIEW, type TreePlaneOverrides, type ViewSize, configurationWith, emptyRouteDivisions, expectCamera, flushFrames, gestures, installFrameClock, installMatchMedia, installPointerEvents, makeSpaceStore, motionSpy, motionStub, pageConfiguration, pinned, renderPlurid, treePlane, viewSizedSheet };