# @dioramajs/diorama

The site entry: start(), effect() and the re-exports most sites need.

## Functions and values

- [assets](/docs/api/diorama/assets.md): `app.assets`. One cache with leases for media and models, a priority queue, preloading of the next page and the progress wave of a preloader.
- [color](/docs/api/diorama/color.md): Colour param. A CSS colour string on the CPU, as written; a `color` uniform on the GPU. The uniform reads `var(--name)` and `currentColor` from the element when the value is written and again in every frame the element draws, so a theme switch shows with the next frame. Code that reads the string itself resolves it with `cssColor(value, element)` of `@dioramajs/render`.
- [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.
- [defineEffect](/docs/api/diorama/define-effect.md): Checks a definition and returns it as a frozen callable. Registers and loads nothing. Throws `EFFECT_DEFINITION` on a bad definition.
- [effect](/docs/api/diorama/effect.md): Short form of `defineEffect`: defaults, optional options, setup. An unnamed effect takes its registry key (the file name when a build plugin finds it).
- [effects](/docs/api/diorama/effects.md): Preset of the `effects` and `attach` plugins.
- [oneOf](/docs/api/diorama/one-of.md): String param limited to these values. The first one is the default.
- [ready](/docs/api/diorama/ready.md): Resolves with the app once it runs: the page's app of `start()` by default, waiting for the call if it has not happened yet. Rejects if the app fails or is destroyed first.
- [redefine](/docs/api/diorama/redefine.md): Swaps the definition registered under `key` in live apps.
- [stage](/docs/api/diorama/stage.md): One canvas for the whole site. It outlives page transitions.
- [start](/docs/api/diorama/start.md): Starts Diorama on the page and returns the app at once. It finishes starting in the background. A second call returns the same app, so a re-run module doesn't make another.
- [text](/docs/api/diorama/text.md): Plain string param for a default that looks like a colour, e.g. `text('#cafe')`.
- [transition](/docs/api/diorama/transition.md): Calls `app.transition` if the plugin is running, otherwise runs `swap` once and returns a settled 'skipped' transition. Safe for routers that navigate before `app.start()` resolves.
- [transitions](/docs/api/diorama/transitions.md): Preset with the `transition` plugin, e.g. `presets: [effects(), transitions()]`.

## Types

- [App](/docs/api/diorama/types/app.md): What `createApp` returns: the kernel API, lifecycle controls and services.
- [ChoiceParam](/docs/api/diorama/types/choice-param.md): A string param limited to some values, made by `oneOf()`.
- [ColorParam](/docs/api/diorama/types/color-param.md): A colour param, made by `color()`. Its uniform reads `var(--name)` and `currentColor` from the element, again in every frame the element draws, so it follows a theme switch.
- [Effect](/docs/api/diorama/types/effect.md): Frozen callable, like a plugin. Calling it returns a configured use.
- [EffectContext](/docs/api/diorama/types/effect-context.md): Methods are bound, so `setup({ surface, u, place })` works.
- [EffectEntries](/docs/api/diorama/types/effect-entries.md): The key is the token in markup and the instance name. A definition with another name is an alias.
- [EffectHandle](/docs/api/diorama/types/effect-handle.md): Calling the handle detaches it, like kernel handles. `scope.onDispose(handle)` ties it to a scope.
- [EffectName](/docs/api/diorama/types/effect-name.md): Checked once a registry is extended, any string before that.
- [EffectOptions](/docs/api/diorama/types/effect-options.md): Options of `effect()`, the definition minus params and setup.
- [EffectSetup](/docs/api/diorama/types/effect-setup.md): The `setup` function of an effect.
- [EffectTypes](/docs/api/diorama/types/effect-types.md): Effect types of packages by name, for typed attach and get. Extend via declaration merging.
- [EntryPatch](/docs/api/diorama/types/entry-patch.md): A known effect changed without its code: `{ ripple: { when: 'all' } }`. Both fields beat the definition's, and the light part reads them before the module loads.
- [SiteEffects](/docs/api/diorama/types/site-effects.md): Effect types of the site's own files, written by the build plugin. A site file named like a package effect (`ripple.ts`) overrides its type instead of conflicting with it.
- [StartOptions](/docs/api/diorama/types/start-options.md): Options of `start()`. Every field is optional.
