# @dioramajs/core

App, plugins, signals, frame loop, stage, scroll and pointer.

## Functions and values

- [anchors](/docs/api/diorama-core/anchors.md): Layout is read only when something may have moved (resize, observed size changes, fonts). Each frame just offsets the cached page boxes by the scroll position. Live anchors near the viewport are re-read every frame, since sticky, fixed and transformed boxes move without a layout change.
- [batch](/docs/api/diorama-core/batch.md): Runs `fn` and notifies effects once at the end, not after each write.
- [cancel](/docs/api/diorama-core/cancel.md): Returned from a hook handler to stop the chain. `callHook` then returns it.
- [computed](/docs/api/diorama-core/computed.md): A read-only value derived from signals, recomputed lazily when they change.
- [createApp](/docs/api/diorama/create-app.md): Creates an app with the built-in web layer and the given presets and plugins. Call `start()` to run it.
- [definePlugin](/docs/api/diorama-core/define-plugin.md): Defines a plugin. The result is a frozen function: call it with options for a configured copy.
- [definePreset](/docs/api/diorama-core/define-preset.md): Groups plugins and other presets under one name for `createApp({ presets })`.
- [DioramaError](/docs/api/diorama-core/diorama-error.md): An error of the kernel or a plugin. Its message reads `[diorama] CODE: message`.
- [effect](/docs/api/diorama-core/effect.md): Runs `fn` now and again whenever a signal it read changes. Returns Off.
- [isCancel](/docs/api/diorama-core/is-cancel.md): Whether a hook result is a `cancel()`.
- [isDioramaError](/docs/api/diorama-core/is-diorama-error.md): Whether `value` is a `DioramaError`, with `code` if one is given.
- [manualDriver](/docs/api/diorama-core/manual-driver.md): A driver that frames only on `tick()` or `flush()`, for tests.
- [offlineDriver](/docs/api/diorama-core/offline-driver.md): A fixed-step driver that frames on `step()`, for video capture.
- [pointer](/docs/api/diorama-core/pointer.md): Tracks the pointer over the page. Built in.
- [rafDriver](/docs/api/diorama-core/raf-driver.md): Frames on `requestAnimationFrame`. The default driver in the browser.
- [satisfies](/docs/api/diorama-core/satisfies.md): Whether `version` is within a semver `range` such as `^1.2.0 || >=2`.
- [scroll](/docs/api/diorama-core/scroll.md): Tracks page scroll, its velocity and progress. Built in.
- [signal](/docs/api/diorama-core/signal.md): A writable reactive value. Reading `value` inside `effect` or `computed` tracks it.
- [stage](/docs/api/diorama/stage.md): One canvas for the whole site. It outlives page transitions.
- [tickerDriver](/docs/api/diorama-core/ticker-driver.md): A driver on an external ticker, such as `gsap.ticker`. `subscribe` returns its own Off.
- [untracked](/docs/api/diorama-core/untracked.md): Runs `fn` without tracking the signals it reads.
- [VERSION](/docs/api/diorama-core/version.md): Version of @dioramajs/core.
- [visibility](/docs/api/diorama-core/visibility.md): Tracks tab visibility and pauses frames while the tab is hidden. Built in.

## Types

- [Anchor](/docs/api/diorama-core/types/anchor.md): An element's box, kept in sync with the page in the `layout` stage.
- [AnchorsApi](/docs/api/diorama-core/types/anchors-api.md): The `anchors` service: element boxes kept in sync with the page.
- [AnyPlugin](/docs/api/diorama-core/types/any-plugin.md): A plugin of any name, options and service.
- [App](/docs/api/diorama/types/app.md): What `createApp` returns: the kernel API, lifecycle controls and services.
- [AppControls](/docs/api/diorama-core/types/app-controls.md): Lifecycle controls of an app.
- [AppCore](/docs/api/diorama-core/types/app-core.md): The kernel API seen by the app, plugins and scopes. Registrations belong to the view's owner and are undone with it. Methods are unbound: pass arrows to callbacks.
- [AppOptions](/docs/api/diorama-core/types/app-options.md): Options of `createApp`.
- [AppScope](/docs/api/diorama-core/types/app-scope.md): A child view of the app whose registrations are undone together by `dispose()`.
- [AppState](/docs/api/diorama-core/types/app-state.md): Lifecycle state of an app.
- [Cancel](/docs/api/diorama-core/types/cancel.md): Result of `cancel()`: stops a hook chain.
- [Cleanup](/docs/api/diorama-core/types/cleanup.md): A function or anything with `dispose()`, so Three.js resources fit as is.
- [DependenciesOf](/docs/api/diorama-core/types/dependencies-of.md): Services of the declared dependencies, as `setup` sees them.
- [DependencyRef](/docs/api/diorama-core/types/dependency-ref.md): A dependency by name or by plugin.
- [DioramaErrorOptions](/docs/api/diorama-core/types/diorama-error-options.md): Options of `DioramaError`.
- [DisposableLike](/docs/api/diorama-core/types/disposable-like.md): Anything with `dispose()`.
- [DriverLink](/docs/api/diorama-core/types/driver-link.md): The loop's connection to a driver.
- [EffectFn](/docs/api/diorama-core/types/effect-fn.md): May return a cleanup, run before the next run and on disposal.
- [Empty](/docs/api/diorama-core/types/empty.md): An object type with no keys.
- [ErrorCode](/docs/api/diorama-core/types/error-code.md): Codes of errors from the kernel and the built-in web layer.
- [ErrorReport](/docs/api/diorama-core/types/error-report.md): What `app:error` listeners and `onError` receive.
- [ErrorSource](/docs/api/diorama-core/types/error-source.md): Where a reported error was caught.
- [EventArgs](/docs/api/diorama-core/types/event-args.md): Arguments of `emit` for event `K`: none when the payload is `undefined`.
- [EventName](/docs/api/diorama-core/types/event-name.md): Names of the registered events.
- [Events](/docs/api/core/types/events.md): Event payloads by name (`undefined` for none). Extend via declaration merging.
- [FrameDriver](/docs/api/diorama-core/types/frame-driver.md): Decides when frames happen, while the loop decides whether one is needed. `now()` is in ms.
- [FrameMode](/docs/api/diorama-core/types/frame-mode.md): `demand` frames only when something asks, `always` frames continuously.
- [FrameProfiler](/docs/api/diorama-core/types/frame-profiler.md): Receives timing points of every frame, see `app.profile`.
- [FrameReason](/docs/api/diorama-core/types/frame-reason.md): Why the last frame ran.
- [FrameStats](/docs/api/diorama-core/types/frame-stats.md): Counters of the frame loop.
- [FrameTick](/docs/api/diorama-core/types/frame-tick.md): Runs one frame at `now` (ms). Returns whether a frame ran.
- [FrameTime](/docs/api/diorama-core/types/frame-time.md): One mutable object per app. Durations are seconds, timestamps milliseconds.
- [HandlerReturn](/docs/api/diorama-core/types/handler-return.md): What a hook handler may return: a new value, nothing, or a promise of either for async hooks.
- [HookArgs](/docs/api/diorama-core/types/hook-args.md): Arguments of hook `K`.
- [HookHandler](/docs/api/diorama-core/types/hook-handler.md): Handler of hook `K`.
- [HookName](/docs/api/diorama-core/types/hook-name.md): Names of the registered hooks.
- [HookResult](/docs/api/diorama-core/types/hook-result.md): Result of hook `K`.
- [Hooks](/docs/api/diorama-core/types/hooks.md): Hook signatures by name, `(value, context?) => result`. A `Promise` result makes the hook async. A handler returns a new value, nothing, or `cancel()`.
- [Listener](/docs/api/diorama-core/types/listener.md): Listener of event `K`.
- [LogCode](/docs/api/diorama-core/types/log-code.md): Codes of warnings and notes that adapters and `start()` log as `CODE: message`, outside the error code unions of the packages.
- [Logger](/docs/api/diorama-core/types/logger.md): Console-like sink for logs. `console` by default.
- [LogLevel](/docs/api/diorama-core/types/log-level.md): Least severe level that is logged. `silent` logs nothing.
- [Loop](/docs/api/diorama-core/types/loop.md): Live loop state. Change settings with `overrideLoop`.
- [LoopOptions](/docs/api/diorama-core/types/loop-options.md): Loop options of `createApp`.
- [LoopSettings](/docs/api/diorama-core/types/loop-settings.md): Loop settings that `overrideLoop` can change.
- [ManualDriver](/docs/api/diorama-core/types/manual-driver.md): Frames only on `tick()` or `flush()`, for deterministic tests.
- [ManualDriverOptions](/docs/api/diorama-core/types/manual-driver-options.md): Options of `manualDriver`.
- [MaybePromise](/docs/api/diorama-core/types/maybe-promise.md): A value or a promise of it.
- [Off](/docs/api/diorama-core/types/off.md): Undoes a registration immediately. Calling it again does nothing.
- [OfflineDriver](/docs/api/diorama-core/types/offline-driver.md): Fixed-step frames on `step()` for video capture. Runs even while paused.
- [OfflineDriverOptions](/docs/api/diorama-core/types/offline-driver-options.md): Options of `offlineDriver`.
- [OptionsOf](/docs/api/diorama-core/types/options-of.md): Options type of a plugin from its declared types, defaults and schema.
- [OrderOptions](/docs/api/diorama-core/types/order-options.md): `name` defaults to the owner label. `before`/`after` match entry names or plugin names.
- [OrderRef](/docs/api/diorama-core/types/order-ref.md): One name or several, for `before` and `after`.
- [Plugin](/docs/api/diorama-core/types/plugin.md): A plugin is a frozen function. Calling it with options returns a configured copy. N is the name and service key, O the options, S the service, R the keys required at call time.
- [PluginApp](/docs/api/diorama-core/types/plugin-app.md): `app` inside setup: its own service and declared dependencies only.
- [PluginArgs](/docs/api/diorama-core/types/plugin-args.md): Arguments of a plugin call: partial options, with the keys in `R` required.
- [PluginDefinition](/docs/api/diorama-core/types/plugin-definition.md): What `definePlugin` takes.
- [PluginEntry](/docs/api/diorama-core/types/plugin-entry.md): Falsy entries are skipped, so `dev && devtools` works.
- [PluginName](/docs/api/diorama-core/types/plugin-name.md): A plugin name: a registered service or any string.
- [PluginNameProblem](/docs/api/diorama-core/types/plugin-name-problem.md): Why `N` is not a valid plugin name, or `never` when it is.
- [PluginRef](/docs/api/diorama-core/types/plugin-ref.md): A plugin or anything with its name and types, for `get`, `find` and dependencies.
- [PluginSource](/docs/api/diorama-core/types/plugin-source.md): How a plugin came in: built in, from a preset, from `createApp` or from `use`.
- [PluginStatus](/docs/api/diorama-core/types/plugin-status.md): Lifecycle state of a plugin.
- [PluginStatusEvent](/docs/api/diorama-core/types/plugin-status-event.md): Payload of `plugin:status`.
- [PluginTypes](/docs/api/diorama-core/types/plugin-types.md): Phantom types of a plugin, for inference.
- [PointerApi](/docs/api/diorama-core/types/pointer-api.md): The `pointer` service.
- [PointerState](/docs/api/diorama-core/types/pointer-state.md): Live pointer state. A move asks for a frame only if someone read the position in the last frame (or since), so a page whose effects ignore the pointer draws nothing on mouse moves.
- [Preset](/docs/api/diorama-core/types/preset.md): A named group of plugins and presets.
- [PresetDefinition](/docs/api/diorama-core/types/preset-definition.md): What `definePreset` takes.
- [PresetEntry](/docs/api/diorama-core/types/preset-entry.md): A preset, or a falsy value that is skipped.
- [PresetPlugins](/docs/api/diorama-core/types/preset-plugins.md): Plugins of a preset type.
- [ReadonlySignal](/docs/api/diorama-core/types/readonly-signal.md): A reactive value that can be read and watched.
- [RegisteredService](/docs/api/diorama-core/types/registered-service.md): Service registered under name `N` in `Services`, or `void`.
- [RemoveOptions](/docs/api/diorama-core/types/remove-options.md): Options of `app.remove`.
- [RequiredOptions](/docs/api/diorama-core/types/required-options.md): Option keys that a plugin call must pass.
- [ReservedName](/docs/api/diorama-core/types/reserved-name.md): Names a plugin cannot take, since the app API uses them.
- [ScopeControls](/docs/api/diorama-core/types/scope-controls.md): Lifecycle controls of a scope.
- [ScrollApi](/docs/api/diorama-core/types/scroll-api.md): The `scroll` service.
- [ScrollAxis](/docs/api/diorama-core/types/scroll-axis.md): Scroll axis: `x` for horizontal, `y` for vertical.
- [ScrollSample](/docs/api/diorama-core/types/scroll-sample.md): One frame's reading of a scroll source, filled in place.
- [ScrollSource](/docs/api/diorama-core/types/scroll-source.md): Where `scroll` takes the offset from. Without one, window scroll events are cached.
- [ScrollState](/docs/api/diorama-core/types/scroll-state.md): Live scroll state, updated in place in the `input` stage.
- [ServiceFor](/docs/api/diorama-core/types/service-for.md): Service of plugin `N`: the registered one when `N` is in `Services`, else `S`.
- [ServiceName](/docs/api/diorama-core/types/service-name.md): Names of the registered services.
- [ServiceOf](/docs/api/diorama-core/types/service-of.md): Service type of a plugin.
- [Services](/docs/api/diorama-core/types/services.md): Services by plugin name, exposed as `app.<name>`. Extend via declaration merging.
- [ServicesOf](/docs/api/diorama-core/types/services-of.md): Services of a union of plugins, keyed by name.
- [Signal](/docs/api/diorama-core/types/signal.md): A reactive value that can be written.
- [SignalOptions](/docs/api/diorama-core/types/signal-options.md): Options of `signal` and `computed`.
- [StageApi](/docs/api/diorama-core/types/stage-api.md): The `stage` service: the canvas and the viewport.
- [StageName](/docs/api/diorama-core/types/stage-name.md): Names of the frame stages.
- [StageOptions](/docs/api/diorama-core/types/stage-options.md): Options of the `stage` plugin.
- [StagePosition](/docs/api/diorama-core/types/stage-position.md): Where `addStage` puts a stage: before or after an existing one.
- [Stages](/docs/api/diorama-core/types/stages.md): Frame stages in run order. `addStage` inserts more, extend this to type them.
- [StandardSchemaIssue](/docs/api/diorama-core/types/standard-schema-issue.md): One validation problem.
- [StandardSchemaProps](/docs/api/diorama-core/types/standard-schema-props.md): Standard Schema properties.
- [StandardSchemaResult](/docs/api/diorama-core/types/standard-schema-result.md): Result of a Standard Schema validation.
- [StandardSchemaTypes](/docs/api/diorama-core/types/standard-schema-types.md): Input and output types of a schema.
- [StandardSchemaV1](/docs/api/diorama-core/types/standard-schema-v1.md): Standard Schema v1, inlined to stay dependency-free (Zod, Valibot, ArkType implement it).
- [SyncHookArgs](/docs/api/diorama-core/types/sync-hook-args.md): Arguments of `callHook` for hook `K`. Async hooks need `callHookAsync`.
- [System](/docs/api/diorama-core/types/system.md): Runs once per frame and must be synchronous.
- [SystemHandle](/docs/api/diorama-core/types/system-handle.md): Calling the handle removes the system.
- [SystemInfo](/docs/api/diorama-core/types/system-info.md): A system as the profiler sees it.
- [TickerDriverOptions](/docs/api/diorama-core/types/ticker-driver-options.md): Options of `tickerDriver`.
- [TrackOptions](/docs/api/diorama-core/types/track-options.md): Options of `anchors.track`.
- [VisibilityApi](/docs/api/diorama-core/types/visibility-api.md): The `visibility` service.
- [VisibilityOptions](/docs/api/diorama-core/types/visibility-options.md): Options of the `visibility` plugin.
