@dioramajs/diorama
The site entry: start(), effect() and the re-exports most sites need.
On this page
import { assets, color, createApp } from '@dioramajs/diorama'Functions
color | 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 | Creates an app with the built-in web layer and the given presets and plugins. Call `start()` to run it. |
defineEffect | Checks a definition and returns it as a frozen callable. Registers and loads nothing. Throws `EFFECT_DEFINITION` on a bad definition. |
effect | 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 | Preset of the `effects` and `attach` plugins. |
oneOf | String param limited to these values. The first one is the default. |
ready | 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 | Swaps the definition registered under `key` in live apps. |
start | 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 | Plain string param for a default that looks like a colour, e.g. `text('#cafe')`. |
transition | 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 | Preset with the `transition` plugin, e.g. `presets: [effects(), transitions()]`. |
Constants
Interfaces
ChoiceParam | A string param limited to some values, made by `oneOf()`. |
ColorParam | 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 | Frozen callable, like a plugin. Calling it returns a configured use. |
EffectContext | Methods are bound, so `setup({ surface, u, place })` works. |
EffectHandle | Calling the handle detaches it, like kernel handles. `scope.onDispose(handle)` ties it to a scope. |
EffectTypes | Effect types of packages by name, for typed attach and get. Extend via declaration merging. |
EntryPatch | 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 | 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 | Options of `start()`. Every field is optional. |
Types
App | What `createApp` returns: the kernel API, lifecycle controls and services. |
EffectEntries | The key is the token in markup and the instance name. A definition with another name is an alias. |
EffectName | Checked once a registry is extended, any string before that. |
EffectOptions | Options of `effect()`, the definition minus params and setup. |
EffectSetup | The `setup` function of an effect. |