@vielzeug/codex 2.1.1 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/catalog.json +17 -13
- package/data/llms-full.txt +16 -44
- package/data/llms.txt +2 -2
- package/data/manifest.json +1 -1
- package/data/packages/arsenal.json +1 -1
- package/data/packages/assay.json +26 -26
- package/data/packages/clockwork.json +3 -3
- package/data/packages/codex.json +23 -23
- package/data/packages/coins.json +5 -5
- package/data/packages/conduit.json +8 -8
- package/data/packages/courier.json +8 -8
- package/data/packages/dnd.json +6 -6
- package/data/packages/familiar.json +9 -9
- package/data/packages/flux.json +9 -9
- package/data/packages/forge.json +2 -2
- package/data/packages/keymap.json +6 -6
- package/data/packages/lingua.json +22 -22
- package/data/packages/necromancer.json +2 -2
- package/data/packages/orbit.json +21 -21
- package/data/packages/ore.json +49 -49
- package/data/packages/prism.json +22 -22
- package/data/packages/pulse.json +17 -17
- package/data/packages/ripple.json +22 -16
- package/data/packages/rune.json +29 -29
- package/data/packages/scout.json +2 -2
- package/data/packages/scroll.json +15 -15
- package/data/packages/sourcerer.json +28 -28
- package/data/packages/spell.json +23 -23
- package/data/packages/tempo.json +14 -14
- package/data/packages/vault.json +4 -4
- package/data/packages/ward.json +25 -25
- package/data/packages/wayfinder.json +44 -44
- package/data/refine.json +3649 -3457
- package/data/search.json +33 -33
- package/dist/catalog.js.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/http.js +1 -1
- package/dist/http.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/snapshot.js.map +1 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/packages.js.map +1 -1
- package/dist/tools/refine.js.map +1 -1
- package/mcp-setup.json +5 -5
- package/package.json +20 -20
package/data/packages/ore.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"apiSource": "export
|
|
2
|
+
"apiSource": "export type { ComponentDefinition } from './component-types';\nexport { createContext, type InjectionKey, inject, injectStrict, provide } from './context';\nexport { define, prop } from './define';\n// Near-universal template directives — used in most non-trivial components (lists,\n// conditionals, and class/style maps. Kept in the main entry alongside\n// `html`/`define` rather than a separate sub-path: tree-shaking already means an unused export\n// costs nothing in a bundled consumer, so splitting these off only adds an extra import line\n// for functionality most components need on day one. `unsafeHtml()` and `live()` remain here\n// too: their explicit names make their specialized behavior clear without a second import path.\nexport { classMap } from './directives/classMap';\nexport { each } from './directives/each';\nexport { type LiveBinding, live } from './directives/live';\nexport { styleMap } from './directives/styleMap';\nexport { unsafeHtml } from './directives/unsafe-html';\nexport { when } from './directives/when';\nexport { OreApiError, OreError, type OreErrorPhase, OreInternalError, OreLifecycleError } from './errors';\nexport { type FormFieldHandle, type FormFieldOptions, useField } from './forms/field';\nexport {\n type BindOptions,\n bind,\n type HostBindConfig,\n type HostBindFn,\n type HostBindingValue,\n type ReflectConfig,\n} from './host-bind';\nexport { intersectionObserver } from './observers/intersection-observe';\nexport { mediaObserver } from './observers/media-observe';\nexport { type MutationObserverValue, mutationObserver } from './observers/mutation-observe';\nexport { resizeObserver } from './observers/resize-observe';\nexport type { InferProps, PropDef, PropInputDefs, PropsDef } from './props';\n// Lifecycle hooks — plain functions, called during setup() or a composable it invokes.\nexport {\n getHost,\n type OnFormResetCallback,\n type OnMountedCallback,\n onCleanup,\n onElement,\n onEvent,\n onFormReset,\n onMounted,\n watchEffect,\n} from './runtime';\nexport { type ComponentSlots, useSlots } from './slots';\nexport { html } from './template/instantiator';\nexport { type HTMLResult, type Ref, type RefCallback, ref } from './template/result';\nexport { type CSSResult, css } from './utils/css';\nexport { type EmitFn, useEmit } from './utils/emit';\n\nexport { createId, createStableId, resetStableIdCounter } from './utils/id';\n",
|
|
3
3
|
"docs": {
|
|
4
4
|
"index": "---\ntitle: Ore — Web component authoring with signals\ndescription: Functional custom-element authoring with typed props, reactive templates, lifecycle helpers, observers, and testing utilities.\npackage: ore\ncategory: ui-primitives\nkeywords: [web-components, custom-elements, reactive, templates, signals, lifecycle]\nrelated: [ripple, refine, orbit]\nexports: [define, prop, html, css, ref, createContext, inject, injectStrict, provide, onMounted, onCleanup, onEvent, onElement, onFormReset, watchEffect, useEmit, useSlots, getHost, bind, each, when, classMap, styleMap, live, unsafeHtml, useField, intersectionObserver, mediaObserver, mutationObserver, resizeObserver, createId, createStableId, resetStableIdCounter, OreError, OreApiError, OreInternalError, OreLifecycleError, BindOptions]\nenvironments: [browser]\n---\n\n<!-- markdownlint-disable MD025 MD033 MD060 -->\n\n<PackageHero package=\"ore\" />\n\n## Why Ore?\n\nOre keeps custom elements functional and signal-driven while giving you direct control over templates, lifecycle hooks, host bindings, and form-associated behavior.\n\n```ts\n// Before — vanilla custom element boilerplate\nclass MyCounter extends HTMLElement {\n #count = 0;\n connectedCallback() {\n this.attachShadow({ mode: 'open' });\n this.#render();\n }\n #render() {\n this.shadowRoot!.innerHTML = `<button>${this.#count}</button>`;\n this.shadowRoot!.querySelector('button')!.onclick = () => {\n this.#count++;\n this.#render();\n };\n }\n}\ncustomElements.define('my-counter', MyCounter);\n\n// After — Ore\nimport { signal } from '@vielzeug/ripple';\nimport { define, html } from '@vielzeug/ore';\n\ndefine('my-counter', {\n setup() {\n const count = signal(0);\n return html`<button @click=${() => count.value++}>${count}</button>`;\n },\n});\n```\n\n| Feature | Ore | Lit | Stencil |\n| -------------------------- | ------------------------------------------- | ----------------------------------------------------------------- | ------------------------------------------ |\n| Bundle size | <PackageInfo package=\"ore\" type=\"size\" /> | ~12 kB | ~60 kB+ toolchain |\n| Signal-first runtime | <ore-icon name=\"check\" size=\"16\"></ore-icon> | <ore-icon name=\"x\" size=\"16\"></ore-icon> (separate signals package) | <ore-icon name=\"x\" size=\"16\"></ore-icon> |\n| Functional component setup | <ore-icon name=\"check\" size=\"16\"></ore-icon> | Partial | <ore-icon name=\"x\" size=\"16\"></ore-icon> |\n| Typed prop helpers | <ore-icon name=\"check\" size=\"16\"></ore-icon> | Partial | <ore-icon name=\"check\" size=\"16\"></ore-icon> |\n| Host binding helpers | <ore-icon name=\"check\" size=\"16\"></ore-icon> | Partial | Partial |\n| Form-associated helpers | <ore-icon name=\"check\" size=\"16\"></ore-icon> | Manual | Partial |\n| Zero dependencies | <ore-icon name=\"check\" size=\"16\"></ore-icon> | <ore-icon name=\"check\" size=\"16\"></ore-icon> | <ore-icon name=\"x\" size=\"16\"></ore-icon> |\n\n<div class=\"decision-callout\">\n\n**Use Ore when** you want typed, signal-driven custom elements with minimal runtime overhead and no framework lock-in.\n\n**Consider Lit when** you need a mature ecosystem with wide community adoption and don't need signal-based reactivity.\n\n</div>\n\n## Installation\n\n::: code-group\n\n```sh [pnpm]\npnpm add @vielzeug/ore @vielzeug/ripple\n```\n\n```sh [npm]\nnpm install @vielzeug/ore @vielzeug/ripple\n```\n\n```sh [yarn]\nyarn add @vielzeug/ore @vielzeug/ripple\n```\n\n:::\n\n## Quick Start\n\n```ts\nimport { computed, signal } from '@vielzeug/ripple';\nimport { bind, css, define, html, onMounted, prop } from '@vielzeug/ore';\n\ndefine('my-counter', {\n props: {\n label: prop.string('Count'),\n step: prop.number(1),\n },\n styles: [\n css`\n :host {\n display: inline-grid;\n gap: 0.5rem;\n }\n `,\n ],\n setup(props) {\n const count = signal(0);\n const doubled = computed(() => count.value * 2);\n\n bind({ class: { 'is-positive': () => count.value > 0 } });\n\n onMounted(() => console.log('mounted'));\n\n return html`\n <button @click=${() => (count.value += props.step.value)}>${props.label}: ${count}</button>\n <p>Doubled: ${doubled}</p>\n `;\n },\n});\n```\n\n## Features\n\n<div class=\"features-grid\">\n\n- Signal-first runtime with `signal`, `computed`, `watch`, `batch` from `@vielzeug/ripple` — import them directly\n- Functional component authoring via `define(tag, { props, setup, styles, formAssociated })`\n- Props via `prop.*` helpers (`prop.string`, `prop.number`, `prop.bool`, `prop.oneOf`, `prop.json`, `prop.data`) or raw `PropDef` objects\n- `setup(props)` takes only props and returns an `HTMLResult` directly: `return html\\`...\\``\n- Lifecycle hooks — `onMounted`, `onCleanup`, `onEvent`, `onElement`, `watchEffect` — plain functions imported from `@vielzeug/ore`, called directly from `setup()` or any composable it calls\n- Directives: `each` (keyed reactive list rendering), `classMap`, `styleMap`, `when`, `live`, `unsafeHtml`\n- Host bindings via `bind({ attr, class, style, on })` — pass `{ target: el }` to bind any off-host element\n- Reactive ARIA sync via `bind({ aria }, { target })` — applies `aria-*` attributes reactively to any element, auto-cleanup on disconnect\n- Context via `provide(key, value)` / `inject(key)`; typed emit/slots via `useEmit<Emits>()` / `useSlots<SlotNames>()`\n- Form-associated `useField()` and observer helpers are root exports\n- Testing utilities (`@vielzeug/ore/testing`) — `mount`, `renderHook`, `flush`, `cleanup`\n- Generic testing utilities (scoped queries, named event dispatchers, and async waits) are exported by `@vielzeug/assay`\n- Debug utilities (`@vielzeug/ore/testing`) — `debugFlush()` for diagnosing update timing\n\n</div>\n\n## Package Entry Points\n\n| Import | Purpose |\n| --------------------------- | ----------------------------------------------------------------------------- |\n| `@vielzeug/ore` | All browser runtime APIs: components, directives, `useField`, and observers |\n| `@vielzeug/ore/testing` | Ore-specific mounting, lifecycle flushing, hooks, cleanup, and form internals |\n| `@vielzeug/assay` | Generic DOM events, scoped queries, and async waiting |\n\n## Documentation\n\n<div class=\"doc-links\">\n\n- [Usage Guide](./usage.md)\n- [API Reference](./api.md)\n- [Examples](./examples.md)\n- [Migration Guide](./migration.md)\n\n</div>\n\n## See Also\n\n<div class=\"see-also\">\n\n- [Refine](../refine/index.md) for prebuilt accessible components powered by Ore.\n- [Ripple](../ripple/index.md) for reactive state used inside Ore components.\n- [Forge](../forge/index.md) for typed form state that integrates with Ore.\n\n</div>\n\n<!-- markdownlint-enable MD025 MD033 MD060 -->\n",
|
|
5
5
|
"api": "---\ntitle: Ore — API Reference\ndescription: Complete API reference for @vielzeug/ore and @vielzeug/ore/testing.\n---\n\n[[toc]]\n\n## API Overview\n\nAll browser-runtime symbols below are imported from `@vielzeug/ore`. Lifecycle/context/binding functions (`onMounted`, `onCleanup`, `onEvent`, `onElement`, `watchEffect`, `bind`, `provide`, `useEmit`, `useSlots`, `getHost`) resolve the active component through an implicit \"current component\" context — they work when called synchronously during `setup()`, or from any composable function `setup()` calls (transitively), but throw if called outside that window.\n\n> `watchEffect` is not named `watch` — `@vielzeug/ripple` already exports a `watch(source, callback)` with different semantics (explicit source + old/new value pair), and the two are frequently imported in the same file.\n\n| Symbol | Purpose | Execution mode | Common gotcha |\n| ---------------------- | ----------------------------------------------------- | -------------- | -------------------------------------------------------------------------- |\n| `define()` | Register a custom element with reactive setup | Sync | Tag must contain a hyphen; call before first use |\n| `html` | Tagged template literal returning HTMLResult | Sync | Expressions must be signals, functions, or primitives |\n| `prop.*` | Typed prop helpers (string, bool, number, …) | Sync | Prop values are signals — read `.value` |\n| `provide()`/`inject()` | Context API for parent-to-descendant sharing | Setup only | Must be called synchronously during `setup()` |\n| `ref()` | Reactive reference to a DOM element | Sync | Value is null until after first mount |\n| `createContext()` | Create a typed injection key | Sync | Context is scoped to the component tree |\n| `each()` | Keyed list rendering with DOM diffing | Sync | Duplicate keys report `ore:error`; plain `T[]` is a one-time static render |\n| `when()` | Conditional branch rendering | Sync | Getter-fn computed disposed on cleanup; static bool skips subscription |\n| `live(signal)` | One-way binding that skips stale writes during input | Sync | Use for controlled inputs alongside a manual `@input` handler |\n| `onMounted(fn)` | DOM-ready callback | Setup only | Must be called synchronously during `setup()` |\n| `onCleanup(fn)` | Register teardown | Setup only | Called on component disconnect |\n| `onEvent(target, …)` | Scoped event listener with auto-cleanup | Setup only | No-ops on null target; removed on disconnect |\n| `useField(options)` | Wire signal to form `ElementInternals` | Setup only | Requires `formAssociated: true` on the component definition |\n| `onFormReset(fn)` | Run work when the ancestor `<form>` resets | Setup only | Fires every reset (not one-shot); only for `formAssociated: true` components |\n| `useEmit<Emits>()` | Typed `emit()` bound to the current host | Setup only | Call once per component; returns `dispatchEvent`'s boolean (`false` if a listener called `preventDefault()`) |\n| `useSlots<SlotNames>()`| Reactive slot presence/element signals | Setup only | Safe to call more than once — the underlying registry is created once |\n| `getHost()` | The current component's host element | Setup only | Prefer a higher-level helper (`bind`, …) when one exists |\n\n## Package Entry Points\n\n| Import | Purpose |\n| ------------------------- | ------------------------------------------------------------------ |\n| `@vielzeug/ore` | All browser runtime APIs, including directives, fields, and observers |\n| `@vielzeug/ore/testing` | Ore-specific mounting, lifecycle, hook, cleanup, and form test support |\n| `@vielzeug/assay` | Generic DOM events, scoped queries, and async waiting |\n\n## Core Component API\n\n### `define(tag, definition)`\n\n```ts\ndefine<Props>(tag: string, definition: ComponentDefinition<Props>): void;\n```\n\nThe `setup()` function receives only typed prop signals:\n\n```ts\nsetup(props) {\n return html`<div>${props.label}</div>`;\n}\n```\n\nEverything else — lifecycle hooks, host bindings, context, slots, emit — is a plain function imported from `@vielzeug/ore`, called directly from `setup()` (or a composable it calls):\n\n```ts\nimport { define, html, onMounted, useEmit, useSlots } from '@vielzeug/ore';\n\ndefine('my-card', {\n setup(_props) {\n const emit = useEmit<{ close: undefined }>();\n const slots = useSlots<'header' | 'footer'>();\n\n onMounted(() => console.log('mounted'));\n\n // emit() returns dispatchEvent's boolean — false if a listener called preventDefault()\n const notCancelled = emit('close');\n\n return html`${when(slots.has('header'), () => html`<slot name=\"header\"></slot>`)}`;\n },\n});\n```\n\n`useEmit<Emits>()` and `useSlots<SlotNames>()` are factory hooks — call them once per setup run to get a typed\n`emit`/`slots` bound to the current host. `useSlots()` is safe to call more than once within that setup run.\n\n### ComponentDefinition\n\n```ts\ntype ComponentDefinition<Props> = {\n formAssociated?: boolean;\n props?: PropsDef<Props>;\n setup: (props: InferProps<PropsDef<Props>>) => HTMLResult | null;\n shadow?: Partial<ShadowRootInit> | false; // false = light DOM (no shadow root)\n styles?: (string | CSSStyleSheet | CSSResult)[];\n};\n```\n\n## Runtime Helpers\n\n`onMounted`, `onCleanup`, `onEvent`, `onElement`, and `watchEffect` are plain functions imported from `@vielzeug/ore`. Call them directly during `setup()`.\n\n```ts\nimport { html, onCleanup, onEvent, onMounted } from '@vielzeug/ore';\n\nsetup(props) {\n onMounted(() => {\n // DOM is ready; return a function for mount-scoped cleanup\n return () => { /* cleanup on unmount */ };\n });\n\n onCleanup(() => { /* called on disconnect */ });\n\n onEvent(window, 'keydown', (e) => { /* auto-removed on disconnect */ });\n\n return html`...`;\n}\n```\n\nBecause these resolve the active component through an implicit context (rather than a value threaded through parameters), composable helper functions can call them directly too — no need to pass hooks in as options:\n\n```ts\nimport { onCleanup } from '@vielzeug/ore';\n\nfunction useMyHelper() {\n onCleanup(() => { /* teardown */ });\n}\n\n// In setup:\nsetup(_props) {\n useMyHelper();\n return html`...`;\n}\n```\n\n## Props API\n\n| Helper | Signature | Notes |\n| ----------------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------ |\n| `prop.string(defaultValue?)` | `PropDef<string>` | Reflects by default |\n| `prop.bool(defaultValue?)` | `PropDef<boolean>` | Any non-null attribute value other than `\"false\"` parses as `true`; `\"false\"` or absent attribute is `false` |\n| `prop.number(defaultValue?)` | `PropDef<number>` | Returns default (not NaN) and warns in dev when attribute is not a valid number |\n| `prop.oneOf(allowed, defaultValue)` | `PropDef<T>` | Restricts to provided string union |\n| `prop.json(defaultValue)` | `PropDef<T>` | JSON.parse from attribute; `reflect: false` |\n| `prop.data<T>(defaultValue?)` | `PropDef<T>` | JS-only — never reads/writes an attribute; use for objects, arrays, callbacks, or any non-serialisable value |\n\n> **Choosing the right prop helper:**\n>\n> - **`prop.json`** — value can be declared in HTML (`<my-el config='{\"x\":1}'>`); attribute string is `JSON.parse`d.\n> - **`prop.data`** — value is always set from JavaScript (objects, arrays, callbacks, class instances); the attribute is never read. Use this for both data and function props.\n\nWhen you need custom parsing or `reflect: false`, use a raw `PropDef` object:\n\n```ts\nprops: {\n items: { default: [], parse: () => [], reflect: false },\n}\n```\n\nUse `prop.data` for props that hold JS-only values (including callbacks) that cannot be serialised through an HTML attribute:\n\n```ts\ndefine('data-grid', {\n props: {\n getRowKey: prop.data<(row: unknown) => string>(),\n columns: prop.data<DataGridColumn[]>([]),\n onSort: prop.data<(key: string) => void>(),\n },\n setup(props) {\n // Set from JS: grid.getRowKey = (row) => row.id\n return html`...`;\n },\n});\n```\n\n## Template and Directives\n\n### `html`\n\nTagged template literal that returns an `HTMLResult`. Supports text interpolation, ordinary attributes (`attr=`),\nboolean attributes (`?attr=`), events (`@event=`), refs (`ref=`), and nested templates.\n\n### `css`\n\nTagged template literal that returns a `CSSResult` for use in `styles`.\n\n### Directives\n\n| Directive | Purpose |\n| -------------------------------------- | ----------------------------------------------------------------------------------------------------- |\n| `each(source, key, render, fallback?)` | Keyed reactive list; render receives `Readable<T>` and `Readable<number>`; plain `T[]` is a one-time static snapshot |\n| `when(condition, truthy, falsy?)` | Conditional rendering |\n| `classMap(record)` | Reactive class string from object map |\n| `styleMap(record)` | Reactive inline style string from object map |\n| `live(signal)` | One-way binding that skips stale writes during active user input; use with `@input` handler |\n| `unsafeHtml(value)` | HTML rendering sink; sanitize untrusted values before calling |\n\n### `unsafeHtml`\n\n`unsafeHtml()` is an explicit HTML injection sink. It has no global sanitizer: sanitize untrusted\ncontent before passing it to the directive, so the trust boundary remains at the call site.\n\n```ts\nimport { unsafeHtml } from '@vielzeug/ore';\n\nconst safeArticle = sanitize(userSuppliedArticle);\n\nreturn html`<article>${unsafeHtml(safeArticle)}</article>`;\n```\n\n## Host Bindings\n\n`bind(config, options?)` is a plain function imported from `@vielzeug/ore`:\n\n```ts\nbind({\n attr: { role: 'button', 'aria-expanded': () => String(open.value) },\n class: { 'is-open': open },\n style: { '--height': () => height.value + 'px' },\n on: { click: handleClick },\n});\n```\n\n`bind()` auto-registers cleanup with the component scope — no manual `onCleanup` needed. Returns a cleanup function for early teardown.\n\n### Off-host bindings\n\nPass `{ target: el }` as a second argument to bind to any element other than the host:\n\n```ts\nbind(\n { attr: { 'aria-expanded': () => String(isOpen.value) } },\n { target: triggerEl },\n);\n```\n\nEvent listener options (`once`, `capture`, `passive`) are also accepted in the second argument. Cleanup is auto-registered with the component scope when called during setup.\n\n### Reactive ARIA attributes\n\nFor reactive ARIA attribute syncing, use `bind({ aria: config }, { target })`. Shorthand keys are normalised to `aria-*` automatically (`expanded` → `aria-expanded`; `role` is passed verbatim):\n\n```ts\n// Inside setup — cleanup auto-registered\nbind(\n {\n aria: {\n expanded: () => isOpen.value,\n controls: panelId,\n haspopup: 'listbox',\n },\n },\n { target: triggerEl },\n);\n\n// Manage cleanup manually — bind() always returns a cleanup fn\nconst stopAria = bind({ aria: { expanded: () => isOpen.value } }, { target: triggerEl });\n// Call stopAria() when the trigger is swapped out\n```\n\nStatic values (strings, numbers, booleans) are applied once. Getter functions and signals create reactive effects. Setting a value to `null`, `undefined`, or `false` removes the attribute.\n\n## Slots\n\n- `slots.has(name?)` — `Readable<boolean>` — whether the named (or default) slot has assigned content\n- `slots.elements(name?)` — `Readable<Element[]>` — the assigned elements for the slot\n\nSlot signals update reactively when assigned content changes, including when slots are inserted dynamically (via `when()` or `each()`) after mount.\n\n## Context API\n\n- `createContext<T>(description?)` — Create a typed injection key\n- `provide(key, value)` — Provide a value to descendants\n- `inject(key)` — Resolve from nearest ancestor; returns `undefined` if not found\n- `inject(key, fallback)` — Resolve with a fallback value\n- `injectStrict(key)` — Resolve or throw if absent\n\n`provide()` and `inject()` must be called synchronously during `setup()`. Calling them outside a setup context throws\n`'Lifecycle hooks must be called during component setup'`. Context resolution walks the ancestor chain including shadow\nDOM boundaries. `inject()` resolves and caches its result once per consumer — provide a `Readable` (signal/computed)\nrather than a raw value if descendants need to observe later changes; re-calling `provide()` with a new raw value\nafterward is not seen by consumers that already resolved it (a dev-mode warning fires when a key is provided twice on\nthe same element).\n\n## Utilities\n\n- `ref<T>()` — Create a `Signal<T | null>` element reference. Set to the element via `ref=` in templates.\n- `createId(prefix = 'id')` — Generate a unique incremental string ID (e.g. `'id-1'`, `'id-2'`). Each call returns a new ID — it does not deduplicate by prefix.\n- `createStableId(prefix = 'id')` — Generate a unique ID that also embeds a short random tag shared across all IDs generated in the session (e.g. `'field-a3k21'`), reducing collision risk when multiple app instances run on the same page. Like `createId()`, every call returns a new ID.\n- `resetStableIdCounter()` — Reset the `createStableId()` counter to 0. Call in test `beforeEach` for deterministic IDs. Scoped to `createStableId()` only — `createId()` has no public reset (it's for uniqueness, not cross-test determinism).\n\n## Form-Associated API\n\nImport from `@vielzeug/ore`.\n\n### `useField(options)`\n\nWire a form-associated element to `ElementInternals`. Requires `formAssociated: true` on the component definition. The `disabled` state tracking via `internals.states` (CustomStateSet) is skipped with a dev warning if the API is unavailable in the current environment.\n\n```ts\ntype FormFieldOptions<T> = {\n disabled?: Readable<boolean>;\n /** Defaults to the host element active during setup. */\n el?: HTMLElement;\n /**\n * When true, a null/undefined value is submitted as '' instead of null,\n * keeping the field's key present in FormData even when the value is absent.\n * Only applies to the default toFormValue; ignored if toFormValue is provided.\n * @default false\n */\n emptyStringForNull?: boolean;\n /** Called when the ancestor <form> resets (see onFormReset) — restore local field state here. */\n onReset?: () => void;\n toFormValue?: (value: T) => File | FormData | string | null;\n /** Recomputed reactively and passed straight to internals.setValidity(). null = always valid. */\n validationMessage?: Readable<string>;\n validity?: Readable<ValidityStateFlags | null>;\n value: Signal<T> | Readable<T>;\n};\n\ntype FormFieldHandle = {\n checkValidity(): boolean;\n readonly internals: ElementInternals;\n reportValidity(): boolean;\n /** Set (non-empty message) or clear (empty string) a custom validity error. */\n setCustomValidity(message: string): void;\n};\n```\n\nPass `validity`/`validationMessage` to make `required`-style constraints participate in native constraint validation\nthrough `checkValidity()` and `reportValidity()`:\n\n```ts\nconst isBlank = (v: string) => v.trim() === '';\n\nuseField({\n validationMessage: computed(() => (required.value && isBlank(value.value) ? 'This field is required.' : '')),\n validity: computed(() => (required.value && isBlank(value.value) ? { valueMissing: true } : null)),\n value,\n});\n```\n\n## Observer APIs\n\nImport from `@vielzeug/ore`.\n\n- `resizeObserver(element)` — Returns `Readable<{ height: number; width: number }>`, initialised to `{ height: 0, width: 0 }`\n- `intersectionObserver(element, options?)` — Returns `Readable<IntersectionObserverEntry | null>`, initialised to `null`\n- `mutationObserver(element, options?)` — Returns `Readable<{ entries: MutationRecord[]; latest: MutationRecord | null }>`, initialised to `{ entries: [], latest: null }`\n- `mediaObserver(query)` — Returns `Readable<boolean>`, initialised to the query's current `matches` state\n\n## Testing APIs\n\nImport from `@vielzeug/ore/testing`.\n\n| API | Purpose |\n| ------------------------ | ------------------------------------------------------------------------------------------ |\n| `mount(setup, options?)` | Mount a component and return a test fixture |\n| `cleanup()` | Remove all mounted elements and reset test state |\n| `install(afterEach, options?)` | Register auto-cleanup; pass `{ formInternals: true }` to also install the `ElementInternals`/`FormData`/`<form>.reset()` jsdom polyfill (see below) |\n| `installFormInternalsPolyfill()` | Installs the form-internals polyfill directly (returns an `uninstall()` that restores every patched global). Usually called via `install(afterEach, { formInternals: true })` |\n| `walkFlatTree(root, visit)` | Walks the flat tree (expanding `<slot>` via `assignedElements()`) — for finding slotted content across a shadow boundary that `querySelectorAll()` can't cross |\n| `flush(options?)` | Drain reactive updates and animation frames |\n| `debugFlush()` | Run `flush()` with `console.debug` diagnostics |\n| `mock(tag, template?)` | Register a no-op stub custom element |\n| `renderHook(setup)` | Run lifecycle hooks in isolation; overload accepts `propDefs` as first arg for typed props |\n| `resetOreForTests()` | Reset styles and ID counters when mounting is managed manually |\n| `OreTimeoutError` | Error thrown when `flush()` cannot settle tracked Ore work |\n\n> **Test isolation:** `cleanup()` removes mounted elements and resets all cross-test Ore state (the stylesheet cache and ID counters) via `resetOreForTests()`. Call it in `afterEach` (or use `install()`) to prevent state leaking between tests.\n\nImport `within`, named dispatchers such as `fireClick`, and waits such as `waitUntil` or `waitForEvent` from\n`@vielzeug/assay`.\n\n> **Form-associated component testing:** jsdom implements none of the `ElementInternals` form-association API — `install(afterEach, { formInternals: true })` polyfills `setFormValue`/`setValidity`/`checkValidity`/`reportValidity`/`validationMessage`/`validity`/`states`, mixes `checkValidity`/`reportValidity`/`validity`/`validationMessage` onto the host element itself (real browsers do this for any `formAssociated: true` element), makes `FormData` collect a form-associated element's set value, and makes `<form>.reset()` invoke `formResetCallback()`. Every patch is a guarded no-op when its target already exists, and `installFormInternalsPolyfill()` returns an `uninstall()` that restores every patched global. The polyfill is opt-in (`{ formInternals: true }`) because the patches are global — suites without form-associated components shouldn't carry them. A downstream package (e.g. a component library built on `ore`) should rely on this instead of hand-rolling its own copy.\n\n#### `Fixture` interface\n\n```ts\ninterface Fixture<T extends HTMLElement = HTMLElement> {\n [Symbol.dispose](): void; // Delegates to dispose() — enables `using` declarations\n element: T;\n readonly disposed: boolean; // true after dispose() has been called\n readonly shadow: ShadowRoot | null;\n get<E extends Element>(selector: string): E;\n query<E extends Element>(selector: string): E | null;\n queryAll<E extends Element>(selector: string): E[];\n getByText<E extends Element>(text: string, selector?: string): E;\n queryByText<E extends Element>(text: string, selector?: string): E | null;\n queryAllByText<E extends Element>(text: string, selector?: string): E[];\n getByTestId<E extends Element>(testId: string): E;\n queryByTestId<E extends Element>(testId: string): E | null;\n queryAllByTestId<E extends Element>(testId: string): E[];\n attr(name: string, value: string | number | boolean): Promise<void>;\n attrs(record: Record<string, string | number | boolean>): Promise<void>;\n flush(options?: FlushOptions): Promise<void>;\n act(fn: () => unknown): Promise<void>;\n dispose(): void; // Removes the component from the DOM — idempotent\n}\n```\n\n#### `renderHook`\n\nUseful for testing composable lifecycle hooks (`onMounted`, `watchEffect`, `inject`, etc.) without a template. `onMounted`/`onCleanup`/`watchEffect`/... work exactly as inside a real `setup()`, since they resolve the same implicit current-component context:\n\n```ts\n// Without props\nconst { result, flush, dispose } = await renderHook(() => {\n const count = signal(0);\n onMounted(() => {\n count.value = 1;\n });\n return count;\n});\nexpect(result.value).toBe(1);\n\n// With typed props (prop-defs overload)\nconst { result } = await renderHook({ label: prop.string('hello'), count: prop.number(0) }, (props) => props.label);\nexpect(result.value).toBe('hello');\n```\n\n## Ripple Primitives\n\nOre does **not** re-export reactive primitives. Import them directly from `@vielzeug/ripple`:\n\n```ts\nimport { batch, computed, signal, watch } from '@vielzeug/ripple';\n```\n\nSee the [Ripple documentation](/ripple/) for the full API.\n\n## Lifecycle Events\n\n| Event | When |\n| ------------------ | ------------------------------------------------------------- |\n| `ore:connect` | After every `connectedCallback` (including reconnects) |\n| `ore:disconnect` | After `disconnectedCallback`, before component state is reset |\n| `ore:error` | When a lifecycle callback fails — bubbles, composed; detail is `OreLifecycleError` |\n\n## Types\n\n```ts\ntype PropDef<T> = {\n default: T;\n parse: (value: string | null) => T;\n reflect?: boolean;\n};\n\n/**\n * Infer reactive props type from a PropInputDefs map.\n * Each entry becomes Readable<T> keyed by prop name.\n */\ntype InferProps<D extends PropInputDefs> = {\n readonly [K in keyof D]-?: Readable<InferPropValue<D[K]>>;\n};\n\n// Runtime hooks — all plain functions imported from '@vielzeug/ore', not fields on an object.\ndeclare function onMounted(fn: OnMountedCallback): void; // DOM-ready callback; runs after each connection's render\ndeclare function onCleanup(fn: CleanupFn): void; // Register teardown; called on disconnect\ndeclare function onElement<T extends HTMLElement>(ref: Readable<T | null>, cb: (el: T) => CleanupFn | void): () => void;\ndeclare function onEvent(\n target: EventTarget | null | undefined,\n event: string,\n listener: EventListener,\n options?: AddEventListenerOptions,\n): void;\ndeclare function onFormReset(fn: () => void): void; // Runs on every ancestor <form> reset; formAssociated only\ndeclare function watchEffect(fn: EffectCallback): () => void; // Scoped reactive effect; auto-cleaned on disconnect\ndeclare function bind(config: HostBindConfig, options?: BindOptions): () => void; // Bindings for host or any target element\ndeclare function provide<T>(key: InjectionKey<T>, value: T): void; // Register a context value on the host element\ndeclare function inject<T>(key: InjectionKey<T>, fallback?: T): T | undefined;\ndeclare function getHost(): HTMLElement; // The current component's host element\ndeclare function useEmit<Emits extends Record<string, unknown> = Record<string, never>>(): EmitFn<Emits>;\ndeclare function useSlots<SlotNames extends string = string>(): ComponentSlots<SlotNames>;\n\ntype ComponentDefinition<Props> = {\n formAssociated?: boolean;\n props?: PropsDef<Props>;\n setup: (props: InferProps<PropsDef<Props>>) => HTMLResult | null;\n shadow?: Partial<ShadowRootInit> | false; // false = light DOM\n styles?: (string | CSSStyleSheet | CSSResult)[];\n};\n\ntype HostBindConfig = {\n aria?: ReflectConfig;\n attr?: Record<string, HostBindingValue>;\n class?: (() => Record<string, boolean>) | Record<string, boolean | (() => boolean) | Readable<boolean>>;\n on?: Record<string, (event: Event) => void>;\n style?: Record<string, HostBindingValue>;\n};\n\ntype ComponentSlots<S extends string = string> = {\n elements(name?: S): Readable<Element[]>;\n has(name?: S): Readable<boolean>;\n};\n\ntype Ref<T extends Element> = Signal<T | null>;\n\ntype RefCallback<T extends Element> = (el: T | null) => void;\n\ntype InjectionKey<T> = symbol & { readonly __ore_injection_key?: T };\n\n/** Phase in which a OreError occurred. */\ntype OreErrorPhase = 'each-reconcile' | 'form-reset' | 'mounted' | 'setup';\n```\n\n## Errors\n\n`OreError` is the base class for every Ore error class — `err instanceof OreError` catches all of them.\n`OreError.is(err)` is the equivalent static type-guard.\n\n- **`OreApiError`** — thrown when the `ore` API itself is misused: calling `define()` with a duplicate tag, calling a lifecycle hook (`inject`, `onMounted`, `onCleanup`, `onEvent`, …) outside of `setup()`, or passing an invalid prop definition to `define()`.\n- **`OreInternalError`** — thrown when an Ore invariant fails, indicating a package bug rather than invalid application code.\n- **`OreLifecycleError`** — reported in the `ore:error` event when component `setup()`, a mounted callback, a form-reset callback, or `each()` reconciliation fails. Extends `OreError` with:\n - `component: string` — the element's local name\n - `phase: OreErrorPhase` — `'setup'` | `'mounted'` | `'form-reset'` | `'each-reconcile'`\n - `cause: Error` — the original error thrown by `setup()`\n- **`OreTimeoutError`** — thrown by `flush()` (from `@vielzeug/ore/testing`) when pending Ore work does not settle before its timeout.\n\nLifecycle failures dispatch a bubbling, composed `ore:error` event whose `detail` is the `OreLifecycleError`. Setup\nfailures still rethrow their original error; mounted and form-reset callback failures are reported through the same\nevent so their remaining callbacks can continue.\n",
|
|
@@ -8,64 +8,64 @@
|
|
|
8
8
|
},
|
|
9
9
|
"examples": [],
|
|
10
10
|
"typeSignatures": {
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
11
|
+
"ComponentDefinition": "export type { ComponentDefinition } from './component-types';",
|
|
12
|
+
"createContext": "export { createContext, type InjectionKey, inject, injectStrict, provide } from './context';",
|
|
13
|
+
"InjectionKey": "export { createContext, type InjectionKey, inject, injectStrict, provide } from './context';",
|
|
14
|
+
"inject": "export { createContext, type InjectionKey, inject, injectStrict, provide } from './context';",
|
|
15
|
+
"injectStrict": "export { createContext, type InjectionKey, inject, injectStrict, provide } from './context';",
|
|
16
|
+
"provide": "export { createContext, type InjectionKey, inject, injectStrict, provide } from './context';",
|
|
16
17
|
"define": "export { define, prop } from './define';",
|
|
17
18
|
"prop": "export { define, prop } from './define';",
|
|
18
|
-
"ComponentDefinition": "export type { ComponentDefinition } from './component-types';",
|
|
19
|
-
"InferProps": "export type { InferProps, PropDef, PropInputDefs, PropsDef } from './props';",
|
|
20
|
-
"PropDef": "export type { InferProps, PropDef, PropInputDefs, PropsDef } from './props';",
|
|
21
|
-
"PropInputDefs": "export type { InferProps, PropDef, PropInputDefs, PropsDef } from './props';",
|
|
22
|
-
"PropsDef": "export type { InferProps, PropDef, PropInputDefs, PropsDef } from './props';",
|
|
23
|
-
"createContext": "export { createContext, inject, injectStrict, provide, type InjectionKey } from './context';",
|
|
24
|
-
"inject": "export { createContext, inject, injectStrict, provide, type InjectionKey } from './context';",
|
|
25
|
-
"injectStrict": "export { createContext, inject, injectStrict, provide, type InjectionKey } from './context';",
|
|
26
|
-
"provide": "export { createContext, inject, injectStrict, provide, type InjectionKey } from './context';",
|
|
27
|
-
"InjectionKey": "export { createContext, inject, injectStrict, provide, type InjectionKey } from './context';",
|
|
28
|
-
"useSlots": "export { useSlots, type ComponentSlots } from './slots';",
|
|
29
|
-
"ComponentSlots": "export { useSlots, type ComponentSlots } from './slots';",
|
|
30
|
-
"bind": "export {\n bind,\n type BindOptions,\n type HostBindConfig,\n type HostBindFn,\n type HostBindingValue,\n type ReflectConfig,\n} from './host-bind';",
|
|
31
|
-
"BindOptions": "export {\n bind,\n type BindOptions,\n type HostBindConfig,\n type HostBindFn,\n type HostBindingValue,\n type ReflectConfig,\n} from './host-bind';",
|
|
32
|
-
"HostBindConfig": "export {\n bind,\n type BindOptions,\n type HostBindConfig,\n type HostBindFn,\n type HostBindingValue,\n type ReflectConfig,\n} from './host-bind';",
|
|
33
|
-
"HostBindFn": "export {\n bind,\n type BindOptions,\n type HostBindConfig,\n type HostBindFn,\n type HostBindingValue,\n type ReflectConfig,\n} from './host-bind';",
|
|
34
|
-
"HostBindingValue": "export {\n bind,\n type BindOptions,\n type HostBindConfig,\n type HostBindFn,\n type HostBindingValue,\n type ReflectConfig,\n} from './host-bind';",
|
|
35
|
-
"ReflectConfig": "export {\n bind,\n type BindOptions,\n type HostBindConfig,\n type HostBindFn,\n type HostBindingValue,\n type ReflectConfig,\n} from './host-bind';",
|
|
36
|
-
"getHost": "export {\n getHost,\n onCleanup,\n onElement,\n onEvent,\n onFormReset,\n type OnFormResetCallback,\n onMounted,\n type OnMountedCallback,\n watchEffect,\n} from './runtime';",
|
|
37
|
-
"onCleanup": "export {\n getHost,\n onCleanup,\n onElement,\n onEvent,\n onFormReset,\n type OnFormResetCallback,\n onMounted,\n type OnMountedCallback,\n watchEffect,\n} from './runtime';",
|
|
38
|
-
"onElement": "export {\n getHost,\n onCleanup,\n onElement,\n onEvent,\n onFormReset,\n type OnFormResetCallback,\n onMounted,\n type OnMountedCallback,\n watchEffect,\n} from './runtime';",
|
|
39
|
-
"onEvent": "export {\n getHost,\n onCleanup,\n onElement,\n onEvent,\n onFormReset,\n type OnFormResetCallback,\n onMounted,\n type OnMountedCallback,\n watchEffect,\n} from './runtime';",
|
|
40
|
-
"onFormReset": "export {\n getHost,\n onCleanup,\n onElement,\n onEvent,\n onFormReset,\n type OnFormResetCallback,\n onMounted,\n type OnMountedCallback,\n watchEffect,\n} from './runtime';",
|
|
41
|
-
"OnFormResetCallback": "export {\n getHost,\n onCleanup,\n onElement,\n onEvent,\n onFormReset,\n type OnFormResetCallback,\n onMounted,\n type OnMountedCallback,\n watchEffect,\n} from './runtime';",
|
|
42
|
-
"onMounted": "export {\n getHost,\n onCleanup,\n onElement,\n onEvent,\n onFormReset,\n type OnFormResetCallback,\n onMounted,\n type OnMountedCallback,\n watchEffect,\n} from './runtime';",
|
|
43
|
-
"OnMountedCallback": "export {\n getHost,\n onCleanup,\n onElement,\n onEvent,\n onFormReset,\n type OnFormResetCallback,\n onMounted,\n type OnMountedCallback,\n watchEffect,\n} from './runtime';",
|
|
44
|
-
"watchEffect": "export {\n getHost,\n onCleanup,\n onElement,\n onEvent,\n onFormReset,\n type OnFormResetCallback,\n onMounted,\n type OnMountedCallback,\n watchEffect,\n} from './runtime';",
|
|
45
|
-
"useEmit": "export { useEmit, type EmitFn } from './utils/emit';",
|
|
46
|
-
"EmitFn": "export { useEmit, type EmitFn } from './utils/emit';",
|
|
47
|
-
"html": "export { html } from './template/instantiator';",
|
|
48
|
-
"HTMLResult": "export { type HTMLResult, ref, type Ref, type RefCallback } from './template/result';",
|
|
49
|
-
"ref": "export { type HTMLResult, ref, type Ref, type RefCallback } from './template/result';",
|
|
50
|
-
"Ref": "export { type HTMLResult, ref, type Ref, type RefCallback } from './template/result';",
|
|
51
|
-
"RefCallback": "export { type HTMLResult, ref, type Ref, type RefCallback } from './template/result';",
|
|
52
19
|
"classMap": "export { classMap } from './directives/classMap';",
|
|
53
20
|
"each": "export { each } from './directives/each';",
|
|
54
|
-
"
|
|
55
|
-
"
|
|
21
|
+
"LiveBinding": "export { type LiveBinding, live } from './directives/live';",
|
|
22
|
+
"live": "export { type LiveBinding, live } from './directives/live';",
|
|
56
23
|
"styleMap": "export { styleMap } from './directives/styleMap';",
|
|
57
24
|
"unsafeHtml": "export { unsafeHtml } from './directives/unsafe-html';",
|
|
58
25
|
"when": "export { when } from './directives/when';",
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
26
|
+
"OreApiError": "export { OreApiError, OreError, type OreErrorPhase, OreInternalError, OreLifecycleError } from './errors';",
|
|
27
|
+
"OreError": "export { OreApiError, OreError, type OreErrorPhase, OreInternalError, OreLifecycleError } from './errors';",
|
|
28
|
+
"OreErrorPhase": "export { OreApiError, OreError, type OreErrorPhase, OreInternalError, OreLifecycleError } from './errors';",
|
|
29
|
+
"OreInternalError": "export { OreApiError, OreError, type OreErrorPhase, OreInternalError, OreLifecycleError } from './errors';",
|
|
30
|
+
"OreLifecycleError": "export { OreApiError, OreError, type OreErrorPhase, OreInternalError, OreLifecycleError } from './errors';",
|
|
31
|
+
"FormFieldHandle": "export { type FormFieldHandle, type FormFieldOptions, useField } from './forms/field';",
|
|
32
|
+
"FormFieldOptions": "export { type FormFieldHandle, type FormFieldOptions, useField } from './forms/field';",
|
|
33
|
+
"useField": "export { type FormFieldHandle, type FormFieldOptions, useField } from './forms/field';",
|
|
34
|
+
"BindOptions": "export {\n type BindOptions,\n bind,\n type HostBindConfig,\n type HostBindFn,\n type HostBindingValue,\n type ReflectConfig,\n} from './host-bind';",
|
|
35
|
+
"bind": "export {\n type BindOptions,\n bind,\n type HostBindConfig,\n type HostBindFn,\n type HostBindingValue,\n type ReflectConfig,\n} from './host-bind';",
|
|
36
|
+
"HostBindConfig": "export {\n type BindOptions,\n bind,\n type HostBindConfig,\n type HostBindFn,\n type HostBindingValue,\n type ReflectConfig,\n} from './host-bind';",
|
|
37
|
+
"HostBindFn": "export {\n type BindOptions,\n bind,\n type HostBindConfig,\n type HostBindFn,\n type HostBindingValue,\n type ReflectConfig,\n} from './host-bind';",
|
|
38
|
+
"HostBindingValue": "export {\n type BindOptions,\n bind,\n type HostBindConfig,\n type HostBindFn,\n type HostBindingValue,\n type ReflectConfig,\n} from './host-bind';",
|
|
39
|
+
"ReflectConfig": "export {\n type BindOptions,\n bind,\n type HostBindConfig,\n type HostBindFn,\n type HostBindingValue,\n type ReflectConfig,\n} from './host-bind';",
|
|
62
40
|
"intersectionObserver": "export { intersectionObserver } from './observers/intersection-observe';",
|
|
63
41
|
"mediaObserver": "export { mediaObserver } from './observers/media-observe';",
|
|
64
|
-
"
|
|
65
|
-
"
|
|
42
|
+
"MutationObserverValue": "export { type MutationObserverValue, mutationObserver } from './observers/mutation-observe';",
|
|
43
|
+
"mutationObserver": "export { type MutationObserverValue, mutationObserver } from './observers/mutation-observe';",
|
|
66
44
|
"resizeObserver": "export { resizeObserver } from './observers/resize-observe';",
|
|
67
|
-
"
|
|
68
|
-
"
|
|
45
|
+
"InferProps": "export type { InferProps, PropDef, PropInputDefs, PropsDef } from './props';",
|
|
46
|
+
"PropDef": "export type { InferProps, PropDef, PropInputDefs, PropsDef } from './props';",
|
|
47
|
+
"PropInputDefs": "export type { InferProps, PropDef, PropInputDefs, PropsDef } from './props';",
|
|
48
|
+
"PropsDef": "export type { InferProps, PropDef, PropInputDefs, PropsDef } from './props';",
|
|
49
|
+
"getHost": "export {\n getHost,\n type OnFormResetCallback,\n type OnMountedCallback,\n onCleanup,\n onElement,\n onEvent,\n onFormReset,\n onMounted,\n watchEffect,\n} from './runtime';",
|
|
50
|
+
"OnFormResetCallback": "export {\n getHost,\n type OnFormResetCallback,\n type OnMountedCallback,\n onCleanup,\n onElement,\n onEvent,\n onFormReset,\n onMounted,\n watchEffect,\n} from './runtime';",
|
|
51
|
+
"OnMountedCallback": "export {\n getHost,\n type OnFormResetCallback,\n type OnMountedCallback,\n onCleanup,\n onElement,\n onEvent,\n onFormReset,\n onMounted,\n watchEffect,\n} from './runtime';",
|
|
52
|
+
"onCleanup": "export {\n getHost,\n type OnFormResetCallback,\n type OnMountedCallback,\n onCleanup,\n onElement,\n onEvent,\n onFormReset,\n onMounted,\n watchEffect,\n} from './runtime';",
|
|
53
|
+
"onElement": "export {\n getHost,\n type OnFormResetCallback,\n type OnMountedCallback,\n onCleanup,\n onElement,\n onEvent,\n onFormReset,\n onMounted,\n watchEffect,\n} from './runtime';",
|
|
54
|
+
"onEvent": "export {\n getHost,\n type OnFormResetCallback,\n type OnMountedCallback,\n onCleanup,\n onElement,\n onEvent,\n onFormReset,\n onMounted,\n watchEffect,\n} from './runtime';",
|
|
55
|
+
"onFormReset": "export {\n getHost,\n type OnFormResetCallback,\n type OnMountedCallback,\n onCleanup,\n onElement,\n onEvent,\n onFormReset,\n onMounted,\n watchEffect,\n} from './runtime';",
|
|
56
|
+
"onMounted": "export {\n getHost,\n type OnFormResetCallback,\n type OnMountedCallback,\n onCleanup,\n onElement,\n onEvent,\n onFormReset,\n onMounted,\n watchEffect,\n} from './runtime';",
|
|
57
|
+
"watchEffect": "export {\n getHost,\n type OnFormResetCallback,\n type OnMountedCallback,\n onCleanup,\n onElement,\n onEvent,\n onFormReset,\n onMounted,\n watchEffect,\n} from './runtime';",
|
|
58
|
+
"ComponentSlots": "export { type ComponentSlots, useSlots } from './slots';",
|
|
59
|
+
"useSlots": "export { type ComponentSlots, useSlots } from './slots';",
|
|
60
|
+
"html": "export { html } from './template/instantiator';",
|
|
61
|
+
"HTMLResult": "export { type HTMLResult, type Ref, type RefCallback, ref } from './template/result';",
|
|
62
|
+
"Ref": "export { type HTMLResult, type Ref, type RefCallback, ref } from './template/result';",
|
|
63
|
+
"RefCallback": "export { type HTMLResult, type Ref, type RefCallback, ref } from './template/result';",
|
|
64
|
+
"ref": "export { type HTMLResult, type Ref, type RefCallback, ref } from './template/result';",
|
|
65
|
+
"CSSResult": "export { type CSSResult, css } from './utils/css';",
|
|
66
|
+
"css": "export { type CSSResult, css } from './utils/css';",
|
|
67
|
+
"EmitFn": "export { type EmitFn, useEmit } from './utils/emit';",
|
|
68
|
+
"useEmit": "export { type EmitFn, useEmit } from './utils/emit';",
|
|
69
69
|
"createId": "export { createId, createStableId, resetStableIdCounter } from './utils/id';",
|
|
70
70
|
"createStableId": "export { createId, createStableId, resetStableIdCounter } from './utils/id';",
|
|
71
71
|
"resetStableIdCounter": "export { createId, createStableId, resetStableIdCounter } from './utils/id';"
|
package/data/packages/prism.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"apiSource": "// Public API — all exports for @vielzeug/prism\n\nexport type {
|
|
2
|
+
"apiSource": "// Public API — all exports for @vielzeug/prism\n\nexport type { EasingFn } from './animation/easing';\nexport type { AnimationTarget } from './animation/transition';\n// Animation utilities (for plugin authors)\nexport { animate } from './animation/transition';\n// Chart factories\nexport { createAreaChart } from './charts/area';\nexport { createBarChart } from './charts/bar';\nexport { createLineChart } from './charts/line';\nexport { createPieChart } from './charts/pie';\nexport { createSparkline } from './charts/sparkline';\n// Error classes\nexport { PrismDisposedError, PrismError, PrismRenderError } from './errors';\n// Interaction types (useful for plugin authors)\nexport type { LegendState } from './interaction/legend';\nexport type { TooltipState } from './interaction/tooltip';\n// Scale factories\nexport { bandScale } from './scales/band';\nexport { linearScale } from './scales/linear';\nexport { timeScale } from './scales/time';\n// SVG primitives (for plugin authors)\nexport type { Point } from './svg/path';\n// Theme utilities\nexport { resetTheme, seriesColor, setTheme } from './theme';\nexport type {\n AreaChartConfig,\n AreaSeriesConfig,\n AxisConfig,\n AxisPosition,\n BandScale,\n BarChartConfig,\n BarSeriesConfig,\n BarVariant,\n BaseChartConfig,\n ChartA11y,\n ChartDimensions,\n ChartEvent,\n ChartHandle,\n ChartMargin,\n ChartPlugin,\n ChartPluginContext,\n CrosshairConfig,\n Datum,\n GridConfig,\n LegendConfig,\n LegendPosition,\n LineChartConfig,\n LineSeriesConfig,\n MaybeSignal,\n PieChartConfig,\n PieSliceConfig,\n PieVariant,\n PrismTheme,\n Scale,\n Series,\n SparklineConfig,\n SparklineVariant,\n StackSegment,\n TooltipConfig,\n TransitionConfig,\n} from './types';\n",
|
|
3
3
|
"docs": {
|
|
4
4
|
"index": "---\ntitle: Prism — Reactive SVG data visualization\ndescription: Reactive SVG charting library — line, bar, and area charts. Signal-driven updates, CSS-themeable, accessible.\npackage: prism\ncategory: ui\nkeywords: [chart, svg, visualization, reactive, line-chart, bar-chart, area-chart, signals, typescript]\nrelated: [ripple, refine, orbit]\nexports:\n [\n createLineChart,\n createBarChart,\n createAreaChart,\n createPieChart,\n createSparkline,\n linearScale,\n timeScale,\n bandScale,\n seriesColor,\n setTheme,\n resetTheme,\n animate,\n PrismError,\n AnimationTarget,\n EasingFn,\n LegendState,\n TooltipState,\n ChartPluginContext,\n Point,\n ScaffoldContext,\n ScaffoldGroups,\n ChartEventHandlers,\n StackSegment,\n ]\nenvironments: [browser]\n---\n\n<!-- markdownlint-disable MD025 MD033 MD060 -->\n\n<PackageHero package=\"prism\" />\n\n## Why Prism?\n\nCharting libraries typically require a framework binding, bundle heavy dependencies, or force canvas rendering that can't be styled with CSS. Prism takes a different approach:\n\n```ts\n// Before — Chart.js, imperative setup with a canvas you can't CSS-theme\nimport Chart from 'chart.js/auto';\nconst ctx = document.getElementById('myChart') as HTMLCanvasElement;\nnew Chart(ctx, {\n type: 'line',\n data: { labels, datasets: [{ data: values }] },\n // re-render manually when data changes, no signals, canvas not CSS-styleable\n});\n\n// After — Prism, declarative SVG chart driven by a signal\nimport { createLineChart } from '@vielzeug/prism';\nimport { signal } from '@vielzeug/ripple';\n\nconst data = signal([\n { key: 1, value: 12 },\n { key: 2, value: 40 },\n { key: 3, value: 28 },\n]);\nconst chart = createLineChart(document.getElementById('chart')!, {\n a11y: { ariaLabel: 'Users by day' },\n series: [{ name: 'Users', data }],\n tooltip: true,\n});\n// chart auto-updates when data.value changes — no manual re-render\ndata.value = [...data.value, { key: 4, value: 65 }];\n```\n\n| Feature | Prism | Chart.js | Lightweight Charts | D3 |\n| ------------------ | -------------------------------------------- | ---------------------------------------- | -------------------------------------------- | -------------------------------------------- |\n| Bundle size | <PackageInfo package=\"prism\" type=\"size\" /> | ~60 kB | ~45 kB | ~30 kB (core) |\n| Renderer | SVG | Canvas | Canvas | SVG/Canvas |\n| Reactive data model | Ripple signals | Plugin-specific | Plugin-specific | Manual |\n| CSS themeable | <ore-icon name=\"check\" size=\"16\"></ore-icon> | <ore-icon name=\"x\" size=\"16\"></ore-icon> | Limited | <ore-icon name=\"check\" size=\"16\"></ore-icon> |\n| Reactive (signals) | <ore-icon name=\"check\" size=\"16\"></ore-icon> | <ore-icon name=\"x\" size=\"16\"></ore-icon> | <ore-icon name=\"x\" size=\"16\"></ore-icon> | <ore-icon name=\"x\" size=\"16\"></ore-icon> |\n| Accessible SVG | <ore-icon name=\"check\" size=\"16\"></ore-icon> | <ore-icon name=\"x\" size=\"16\"></ore-icon> | <ore-icon name=\"x\" size=\"16\"></ore-icon> | Manual |\n| TypeScript-first | <ore-icon name=\"check\" size=\"16\"></ore-icon> | Partial | <ore-icon name=\"check\" size=\"16\"></ore-icon> | Types available |\n\n<div class=\"decision-callout\">\n\n**Use Prism when** you need lightweight, reactive charts that integrate with signal-based state and can be styled purely with CSS. Ideal for dashboards, admin panels, and data-heavy applications using Vielzeug.\n\n**Consider alternatives when** you need 50+ chart types (ECharts), financial trading charts (Lightweight Charts), or low-level visualization grammar (D3).\n\n</div>\n\n## Installation\n\n::: code-group\n\n```sh [pnpm]\npnpm add @vielzeug/prism\n```\n\n```sh [npm]\nnpm install @vielzeug/prism\n```\n\n```sh [yarn]\nyarn add @vielzeug/prism\n```\n\n:::\n\n## Quick Start\n\n```ts\nimport { createLineChart } from '@vielzeug/prism';\nimport { signal } from '@vielzeug/ripple';\nimport '@vielzeug/prism/theme';\n\nconst data = signal([\n { key: 1, value: 10 },\n { key: 2, value: 25 },\n { key: 3, value: 18 },\n { key: 4, value: 32 },\n]);\n\nconst chart = createLineChart(document.getElementById('chart')!, {\n a11y: { ariaLabel: 'Revenue by month' },\n series: [{ name: 'Revenue', data, color: '#3b82f6' }],\n xAxis: { position: 'bottom' },\n yAxis: { position: 'left', grid: true },\n tooltip: true,\n crosshair: true,\n onHover: (event) => console.log(event?.datum),\n});\n\n// Update data → chart re-renders automatically\ndata.value = [...data.value, { key: 5, value: 28 }];\n\n// Cleanup when done\nchart.dispose();\n```\n\n## Features\n\n<div class=\"features-grid\">\n\n- **`createLineChart(container, config)`** — line chart with linear, monotone, or step interpolation\n- **`createBarChart(container, config)`** — bar chart with four layout variants: grouped, stacked, grouped-horizontal, stacked-horizontal\n- **`createAreaChart(container, config)`** — filled area with configurable opacity\n- **`createSparkline(container, config)`** — minimal inline sparkline (line, area, or bar variant)\n- **`createPieChart(container, config)`** — pie, donut, or semi-circle donut chart\n- **`linearScale(config)`** — continuous numeric scale with nice tick generation\n- **`timeScale(config)`** — date/time scale with interval-based ticks\n- **`bandScale(config)`** — categorical scale for bar charts\n- **`MaybeSignal<T>`** — pass plain values or `@vielzeug/ripple` signals; both work seamlessly\n- **`seriesColor(index, override?)`** — resolve CSS palette color by series index\n- **`setTheme(theme)` / `resetTheme()`** — apply or clear custom colors, font, and grid tokens at runtime\n- **Event hooks** — `onClick` and `onHover` callbacks on every chart\n- **Plugin system** — extend charts with `ChartPlugin` (`install()`/`dispose()` lifecycle, each isolated from the other's failures); supported by all chart types including `createPieChart`\n- **Devtools** — `debugChart()` from `@vielzeug/prism/devtools` logs mount/resize/dispose to `console.debug`; tree-shaken from production unless imported\n- **CSS custom properties** — full theme control via `--prism-*` tokens\n- **Responsive** — auto-resizes via `ResizeObserver`\n- **Accessible** — ARIA labels and semantic SVG structure\n- **`Symbol.dispose`** — explicit resource management following TC39 proposal\n\n</div>\n\n## Sub-paths\n\n| Import | Purpose |\n| -------------------------- | ------------------------------------------------------------------------------------ |\n| `@vielzeug/prism` | All chart factories, scales, and types |\n| `@vielzeug/prism/theme` | Default CSS (custom properties + dark mode) |\n| `@vielzeug/prism/devtools` | `debugChart()` — opt-in `console.debug` lifecycle logging, tree-shaken in production |\n\n## Documentation\n\n<div class=\"doc-links\">\n\n- [Usage Guide](./usage.md)\n- [API Reference](./api.md)\n- [Examples](./examples.md)\n- [Migration Guide](./migration.md)\n\n</div>\n\n## See Also\n\n<div class=\"see-also\">\n\n- [Ripple](/ripple/) — reactive signals that power Prism's auto-updating charts\n- [Refine](/refine/) — accessible web components that pair well with Prism for dashboards\n- [Orbit](/orbit/) — floating element positioning for chart tooltips and popovers\n\n</div>\n\n<!-- markdownlint-enable MD025 MD033 MD060 -->\n",
|
|
5
5
|
"api": "---\ntitle: Prism — API Reference\ndescription: Complete type signatures, parameter docs, and return values for every export in @vielzeug/prism.\n---\n\n[[toc]]\n\n## API Overview\n\n| Symbol | Purpose | Returns |\n| -------------------- | ----------------------------------------------------- | ------------------------------ |\n| `createLineChart()` | Reactive line chart with curves and interpolation | `ChartHandle` |\n| `createBarChart()` | Bar chart: grouped, stacked, horizontal variants | `ChartHandle` |\n| `createAreaChart()` | Filled area chart | `ChartHandle` |\n| `linearScale()` | Continuous numeric → pixel scale | `Scale<number>` |\n| `timeScale()` | Date → pixel scale | `Scale<Date>` |\n| `bandScale()` | Categorical → pixel band scale | `BandScale` |\n| `createSparkline()` | Minimal inline sparkline (line/area/bar) | `ChartHandle` |\n| `createPieChart()` | Pie, donut, or semi-circle donut chart | `ChartHandle` |\n| `seriesColor()` | CSS variable color for series index | `string` |\n| `setTheme()` | Apply custom palette / CSS tokens at runtime | `void` |\n| `resetTheme()` | Clear all custom theme overrides back to defaults | `void` |\n| `animate()` | Animate SVG element attributes via RAF | `() => void` (cancel function) |\n| `debugChart()` | Wrap a `ChartHandle` with lifecycle logging (`/devtools` subpath) | `ChartHandle` |\n| `PrismError` | Base class for all prism-originated errors | class |\n| `LegendState` | Live legend state object (plugin API) | type |\n| `TooltipState` | Live tooltip state object (plugin API) | type |\n| `ChartPluginContext` | Context object passed to `ChartPlugin.install()` | type |\n\n## Package Entry Points\n\n| Import | Purpose |\n| -------------------------- | --------------------------------------------------------------------------- |\n| `@vielzeug/prism` | All chart factories, scales, types, and utilities |\n| `@vielzeug/prism/theme` | Default CSS custom properties (light + dark) |\n| `@vielzeug/prism/devtools` | `debugChart()` — opt-in `console.debug` lifecycle logging, tree-shaken in production |\n\n---\n\n## Chart Factories\n\n### `createLineChart`\n\n```ts\nfunction createLineChart(container: HTMLElement, config: LineChartConfig): ChartHandle;\n```\n\nCreates a reactive line chart. Supports multiple series, curve interpolation, tooltips, crosshair, and event hooks.\n\n| Parameter | Type | Description |\n| ----------- | ----------------- | --------------------------------------------------- |\n| `container` | `HTMLElement` | DOM element to render into (must have width/height) |\n| `config` | `LineChartConfig` | Chart configuration |\n\n**Returns** — [`ChartHandle`](#charthandle)\n\n---\n\n### `createBarChart`\n\n```ts\nfunction createBarChart(container: HTMLElement, config: BarChartConfig): ChartHandle;\n```\n\nCreates a reactive bar chart. Use `variant` to switch between grouped, stacked, horizontal variants.\n\n| Parameter | Type | Description |\n| ----------- | ---------------- | -------------------------- |\n| `container` | `HTMLElement` | DOM element to render into |\n| `config` | `BarChartConfig` | Chart configuration |\n\n**Returns** — [`ChartHandle`](#charthandle)\n\n---\n\n### `createAreaChart`\n\n```ts\nfunction createAreaChart(container: HTMLElement, config: AreaChartConfig): ChartHandle;\n```\n\nCreates a reactive filled area chart with configurable opacity, curve, and event hooks.\n\n| Parameter | Type | Description |\n| ----------- | ----------------- | -------------------------- |\n| `container` | `HTMLElement` | DOM element to render into |\n| `config` | `AreaChartConfig` | Chart configuration |\n\n**Returns** — [`ChartHandle`](#charthandle)\n\n---\n\n### `createPieChart`\n\n```ts\nfunction createPieChart(container: HTMLElement, config: PieChartConfig): ChartHandle;\n```\n\nCreates a pie, donut, or semi-circle donut chart. All three variants share the same `PieChartConfig` — select via `variant`.\n\n| Parameter | Type | Description |\n| ----------- | ---------------- | ----------------------------------------- |\n| `container` | `HTMLElement` | DOM element to render into (sized by CSS) |\n| `config` | `PieChartConfig` | Chart configuration |\n\n**Returns** — [`ChartHandle`](#charthandle)\n\n---\n\n### `createSparkline`\n\n```ts\nfunction createSparkline(container: HTMLElement, config: SparklineConfig): ChartHandle;\n```\n\nCreates a minimal inline chart with no axes, no legend, and no margin. Designed for use in tables, cards, and inline data contexts.\n\n| Parameter | Type | Description |\n| ----------- | ----------------- | ----------------------------------------- |\n| `container` | `HTMLElement` | DOM element to render into (sized by CSS) |\n| `config` | `SparklineConfig` | Sparkline configuration |\n\n**Returns** — [`ChartHandle`](#charthandle)\n\n---\n\n## Scale Factories\n\n### `linearScale`\n\n```ts\nfunction linearScale(config: LinearScaleConfig): Scale<number>;\n```\n\nContinuous linear scale mapping a numeric domain to a pixel range. Unlike chart config fields, scale factory config is not `MaybeSignal` — pass plain values and call `linearScale()` again if the domain/range changes.\n\n| Field | Type | Default | Description |\n| --------------- | ------------------ | ------- | ----------------------------------------------------------------- |\n| `config.domain` | `[number, number]` | — | Input data range `[min, max]`. A reversed domain (`min > max`) is supported for inverted axes. |\n| `config.range` | `[number, number]` | — | Output pixel range `[min, max]` |\n| `config.nice` | `boolean` | `true` | Extend domain to nice round numbers |\n| `config.clamp` | `boolean` | `false` | Clamp output to range bounds |\n\n---\n\n### `timeScale`\n\n```ts\nfunction timeScale(config: TimeScaleConfig): Scale<Date>;\n```\n\nTime scale mapping `Date` values to pixels. Automatically selects tick intervals (seconds → years).\n\n| Field | Type | Default | Description |\n| --------------- | ----------------- | ------- | -------------------------------- |\n| `config.domain` | `[Date, Date]` | — | Input date range `[start, end]` |\n| `config.range` | `[number, number]` | — | Output pixel range |\n| `config.nice` | `boolean` | `true` | Extend domain to nice boundaries |\n\n---\n\n### `bandScale`\n\n```ts\nfunction bandScale(config: BandScaleConfig): BandScale;\n```\n\nCategorical scale dividing the range into equal bands with configurable padding.\n\n| Field | Type | Default | Description |\n| --------------------- | ------------------ | ----------------- | ------------------------- |\n| `config.domain` | `string[]` | — | Category names |\n| `config.range` | `[number, number]` | — | Output pixel range |\n| `config.padding` | `number` | `0.1` | Inner padding ratio (0–1) |\n| `config.paddingOuter` | `number` | same as `padding` | Outer edge padding ratio |\n\n---\n\n## Types\n\n### `ChartHandle`\n\nReturned by all chart factories.\n\n```ts\ninterface ChartHandle {\n readonly disposalSignal: AbortSignal;\n readonly disposed: boolean;\n readonly el: SVGSVGElement;\n dispose(): void;\n [Symbol.dispose](): void;\n}\n```\n\n| Member | Description |\n| -------------------- | ----------------------------------------------------------------------------------------------- |\n| `el` | The root `SVGSVGElement` (for styling or external manipulation) |\n| `disposed` | `true` once `dispose()` has run; useful for guarding late callbacks |\n| `disposalSignal` | Aborted when the chart is disposed — tie your own cleanup (RAF loops, observers) to this instead of overriding `dispose()` |\n| `dispose()` | Tear down all effects, observers, DOM nodes, tooltip, and legend. Calling it more than once is a no-op |\n| `[Symbol.dispose]()` | Same as `dispose()` — for TC39 `using` declarations |\n\n> **Note:** Charts re-render automatically when signal data changes. There is no `update()` method — reactivity is fully automatic.\n\n---\n\n### `ChartEvent`\n\nPassed to `onClick` and `onHover` callbacks.\n\n```ts\ninterface ChartEvent {\n datum: Datum;\n originalEvent: MouseEvent;\n series: Series;\n}\n```\n\n---\n\n### `ChartPlugin`\n\nInterface for extending charts with custom behavior. Plugins are installed after the chart is mounted and torn down on `dispose()`.\n\n```ts\ninterface ChartPlugin {\n install(ctx: ChartPluginContext): void;\n dispose(): void;\n}\n```\n\nSee [`ChartPluginContext`](#chartplugincontext) for the object passed to `install()`.\n\n---\n\n### `BaseChartConfig`\n\nShared configuration inherited by all chart config types.\n\n```ts\ninterface BaseChartConfig {\n ariaLabel?: string;\n legend?: boolean | LegendConfig;\n margin?: Partial<ChartMargin>;\n onClick?: (event: ChartEvent) => void;\n onHover?: (event: ChartEvent | null) => void;\n plugins?: ChartPlugin[];\n tooltip?: boolean | TooltipConfig;\n transition?: TransitionConfig;\n xAxis?: AxisConfig;\n yAxis?: AxisConfig;\n}\n```\n\n| Field | Type | Description |\n| ------------ | ------------------------------------- | --------------------------------------- |\n| `ariaLabel` | `string` | Accessible label on the SVG element |\n| `legend` | `boolean \\| LegendConfig` | Show a series legend |\n| `margin` | `Partial<ChartMargin>` | Override chart margins |\n| `onClick` | `(event: ChartEvent) => void` | Fired when a data point is clicked |\n| `onHover` | `(event: ChartEvent \\| null) => void` | Fired on mousemove (null on mouseleave) |\n| `plugins` | `ChartPlugin[]` | Extension plugins installed at mount |\n| `tooltip` | `boolean \\| TooltipConfig` | Hover tooltip |\n| `transition` | `TransitionConfig` | Enter/update animation |\n| `xAxis` | `AxisConfig` | X-axis configuration |\n| `yAxis` | `AxisConfig` | Y-axis configuration |\n\n---\n\n### `MaybeSignal<T>`\n\n```ts\ntype MaybeSignal<T> = Readable<T> | T;\n```\n\nAccepts either a plain value or a `@vielzeug/ripple` `Readable<T>` signal (e.g. one created with `signal()`). Used for `series`/`data` fields on chart configs — when a signal is passed, the chart re-renders automatically on `.value` changes. Not used by the scale factories (`linearScale`/`timeScale`/`bandScale`), whose config fields are always plain values.\n\n---\n\n### `Scale<T>`\n\n```ts\ninterface Scale<T> {\n readonly domain: readonly [T, T];\n readonly range: readonly [number, number];\n map(value: T): number;\n invert(pixel: number): T;\n ticks(count?: number): T[];\n}\n```\n\n| Member | Description |\n| --------------- | --------------------------------------------------- |\n| `domain` | Input domain `[min, max]` — readonly computed tuple |\n| `range` | Output pixel range — readonly computed tuple |\n| `map(value)` | Domain value → pixel position |\n| `invert(pixel)` | Pixel position → domain value |\n| `ticks(count?)` | Nicely-spaced tick values (default: 10) |\n\n---\n\n### `BandScale`\n\n```ts\ninterface BandScale {\n readonly domain: readonly string[];\n readonly range: readonly [number, number];\n map(value: string): number;\n bandwidth(): number;\n gap(): number;\n ticks(count?: number): string[];\n}\n```\n\n| Member | Description |\n| --------------- | --------------------------------------------------------------- |\n| `map(value)` | Left edge pixel position of a category's band |\n| `bandwidth()` | Width of each band in pixels |\n| `gap()` | Pixel gap between adjacent bands (`bandwidth × padding`) |\n| `ticks(count?)` | All domain categories, or at most `count` evenly sampled values |\n\n---\n\n### `Point`\n\n```ts\ninterface Point {\n x: number;\n y: number;\n}\n```\n\nA pixel-space 2D point used by path builders and area renderers. Exported for plugin authors who build custom SVG paths.\n\n---\n\n### `Datum`\n\nA single data point in a cartesian chart series.\n\n```ts\ninterface Datum {\n key: Date | number | string;\n value: number;\n meta?: Record<string, unknown>;\n}\n```\n\n| Field | Type | Description |\n| ------- | -------------------------- | ----------------------------------------------------------------------------------------- |\n| `key` | `Date \\| number \\| string` | X-axis identity. Use `number` or `Date` for line/area charts; `string` for bar categories |\n| `value` | `number` | Y-axis measured quantity |\n| `meta` | `Record<string, unknown>` | Optional arbitrary metadata (available in tooltip `render` callbacks) |\n\n---\n\n### `Series`\n\n```ts\ninterface Series {\n name: string;\n data: MaybeSignal<Datum[]>;\n color?: string;\n}\n```\n\n---\n\n### `ScaffoldContext`\n\nPassed to `renderFn` inside `createChartScaffold` — the internal building block behind `createLineChart`/`createBarChart`/`createAreaChart`. Relevant only if you're building a custom cartesian chart type on top of prism's scaffold, not to `ChartPlugin.install()` (see [`ChartPluginContext`](#chartplugincontext) for that).\n\n```ts\ninterface ScaffoldContext {\n chartArea: SVGGElement;\n container: HTMLElement;\n dimensions: Readable<ChartDimensions>;\n disposalSignal: AbortSignal;\n groups: ScaffoldGroups;\n legend: LegendState | null;\n svg: SVGSVGElement;\n tooltip: TooltipState | null;\n}\n```\n\n---\n\n### `RadialScaffoldContext`\n\nThe `createRadialScaffold` counterpart to `ScaffoldContext`, for chart types with no cartesian axis groups (pie, donut, semi). Backs `createPieChart`.\n\n```ts\ninterface RadialScaffoldContext {\n container: HTMLElement;\n dimensions: Readable<ChartDimensions>;\n disposalSignal: AbortSignal;\n legend: LegendState | null;\n svg: SVGSVGElement;\n tooltip: TooltipState | null;\n}\n```\n\n---\n\n### `ScaffoldGroups`\n\n```ts\ninterface ScaffoldGroups {\n grid: SVGGElement;\n series: SVGGElement;\n xAxis: SVGGElement;\n yAxis: SVGGElement;\n}\n```\n\nSVG `<g>` elements created by `createChartScaffold`. Children of `chartArea`, appended in render order: `grid` → `xAxis` → `yAxis` → `series`.\n\n---\n\n### `ChartEventHandlers`\n\n```ts\ninterface ChartEventHandlers {\n onClick?: (event: MouseEvent) => void;\n onMouseLeave?: (event: MouseEvent) => void;\n onMouseMove?: (event: MouseEvent) => void;\n}\n```\n\nReturned by the `renderFn` passed to `createChartScaffold`. The scaffold attaches and tears down these listeners automatically before each re-render.\n\n---\n\n### `AnimationTarget`\n\n```ts\ninterface AnimationTarget {\n attrs: Record<string, { from: number; to: number }>;\n el: SVGElement;\n}\n```\n\nOne element + attribute map for use with `animate()`. Each attribute entry specifies the start (`from`) and end (`to`) pixel value.\n\n---\n\n## Pie / Donut Types\n\n### `PieChartConfig`\n\nExtends [`BaseChartConfig`](#basechartconfig) (inherits `ariaLabel`, `legend`, `margin`, `plugins`, `tooltip`, `transition`). Overrides `onClick`/`onHover` with pie-specific slice signatures.\n\n```ts\ninterface PieChartConfig extends Omit<BaseChartConfig, 'onClick' | 'onHover' | 'xAxis' | 'yAxis'> {\n cornerRadius?: number;\n data: MaybeSignal<PieSliceConfig[]>;\n innerRadius?: number;\n onClick?: (slice: PieSliceConfig, index: number) => void;\n onHover?: (slice: PieSliceConfig | null, index: number | null) => void;\n padPixels?: number;\n variant?: PieVariant;\n}\n```\n\n| Field | Type | Default | Description |\n| -------------- | ------------------------------------ | -------------------------------------- | ------------------------------------------------------- |\n| `data` | `MaybeSignal<PieSliceConfig[]>` | — | Slice definitions |\n| `variant` | `PieVariant` | `'pie'` | Chart style: `'pie'`, `'donut'`, or `'semi'` |\n| `innerRadius` | `number` | `55%` of outer (donut/semi), `0` (pie) | Inner hole radius in pixels |\n| `padPixels` | `number` | `0` (pie), `8` (donut/semi) | Pixel gap between slices (uniform across arc thickness) |\n| `cornerRadius` | `number` | `0` (pie), `8` (donut/semi) | Rounded arc corners (pixels) |\n| `onClick` | `(slice, index) => void` | — | Fired on slice click |\n| `onHover` | `(slice\\|null, index\\|null) => void` | — | Fired on hover; `null` on mouseleave |\n\n> Inherited `BaseChartConfig` fields (`tooltip`, `transition`, `legend`, `margin`, `ariaLabel`, `plugins`) behave identically to other chart types.\n\n### `PieSliceConfig`\n\n```ts\ninterface PieSliceConfig {\n color?: string;\n label?: string;\n value: number;\n}\n```\n\n| Field | Type | Description |\n| ------- | -------- | ------------------------------------------------- |\n| `value` | `number` | Numeric weight of the slice |\n| `color` | `string` | Slice fill color; defaults to `--prism-color-{n}` |\n| `label` | `string` | Optional text rendered at the arc centroid |\n\n### `PieVariant`\n\n```ts\ntype PieVariant = 'donut' | 'pie' | 'semi';\n```\n\n- **`pie`** — full circle, no hole\n- **`donut`** — full circle with inner hole (~55% of outer radius by default)\n- **`semi`** — top-half semicircle with inner hole (useful for gauges/progress)\n\n---\n\n## Sparkline Types\n\n### `SparklineConfig`\n\n```ts\ninterface SparklineConfig {\n ariaLabel?: string;\n color?: string;\n cornerRadius?: number;\n curve?: 'linear' | 'monotone' | 'step';\n data: MaybeSignal<number[] | StackSegment[]>;\n fillOpacity?: number;\n onClick?: (index: number, value: number) => void;\n onHover?: (index: number | null, value: number | null) => void;\n padPixels?: number;\n strokeWidth?: number;\n transition?: TransitionConfig;\n variant?: SparklineVariant;\n}\n```\n\n| Field | Type | Default | Description |\n| -------------- | ----------------------------------------- | ---------------------- | -------------------------------------------------------------------------------------------------------------- |\n| `data` | `MaybeSignal<number[] \\| StackSegment[]>` | — | Numeric values, or `StackSegment[]` for `'stack'` variant |\n| `variant` | `SparklineVariant` | `'line'` | Chart style |\n| `color` | `string` | `var(--prism-color-1)` | Stroke/fill color (line/area/bar only) |\n| `curve` | `'linear' \\| 'monotone' \\| 'step'` | `'linear'` | Line interpolation (line/area only) |\n| `strokeWidth` | `number` | `1.5` | Line stroke width (line/area only) |\n| `fillOpacity` | `number` | `0.2` | Fill opacity (area only) |\n| `cornerRadius` | `number` | `4` | Rounded corners for stack segments in pixels. Stack variant only — no effect on line/area/bar |\n| `padPixels` | `number` | `0` | Gap between stack segments in pixels. Stack variant only — no effect on line/area/bar |\n| `ariaLabel` | `string` | — | Accessible label; sets `role=\"img\"` on the SVG. If omitted the SVG is marked `aria-hidden=\"true\"` (decorative) |\n| `transition` | `TransitionConfig` | — | Enter animation (bar/stack only; line/area use RAF interpolation) |\n| `onClick` | `(index, value) => void` | — | Called on click with nearest data index. Not fired for 0- or 1-point data |\n| `onHover` | `(index\\|null, value\\|null) => void` | — | Called on mousemove; `null` on mouseleave. Not fired for 0- or 1-point data |\n\n### `SparklineVariant`\n\n```ts\ntype SparklineVariant = 'area' | 'bar' | 'line' | 'stack';\n```\n\n- **`line`** — polyline path (default)\n- **`area`** — filled area + line overlay\n- **`bar`** — vertical bar per data point\n- **`stack`** — horizontal proportional segments; use `StackSegment[]` for `data` with per-segment colors\n\n### `StackSegment`\n\n```ts\ninterface StackSegment {\n color?: string;\n label?: string;\n value: number;\n}\n```\n\n> **Accessibility:** Without `ariaLabel` the SVG is marked `aria-hidden=\"true\"` (decorative). Set `ariaLabel` to expose the chart to assistive technology — the SVG will carry `role=\"img\"` and the provided label.\n\n---\n\n## Chart Config Types\n\n### `LineChartConfig`\n\nExtends [`BaseChartConfig`](#basechartconfig).\n\n```ts\ninterface LineChartConfig extends BaseChartConfig {\n series: MaybeSignal<LineSeriesConfig[]>;\n crosshair?: boolean | CrosshairConfig;\n}\n```\n\n### `LineSeriesConfig`\n\n```ts\ninterface LineSeriesConfig extends Series {\n curve?: 'linear' | 'monotone' | 'step'; // default: 'linear'\n strokeWidth?: number; // default: 2\n showPoints?: boolean; // default: false\n pointRadius?: number; // default: 3\n}\n```\n\n---\n\n### `BarChartConfig`\n\nExtends [`BaseChartConfig`](#basechartconfig).\n\n```ts\ntype BarVariant =\n | 'grouped' // vertical grouped (default)\n | 'stacked' // vertical stacked\n | 'grouped-horizontal' // horizontal grouped\n | 'stacked-horizontal'; // horizontal stacked\n\ninterface BarChartConfig extends BaseChartConfig {\n series: MaybeSignal<BarSeriesConfig[]>;\n variant?: BarVariant; // default: 'grouped'\n}\n```\n\n### `BarSeriesConfig`\n\n```ts\ninterface BarSeriesConfig extends Series {\n borderRadius?: number; // default: 0\n}\n```\n\n---\n\n### `AreaChartConfig`\n\nExtends [`BaseChartConfig`](#basechartconfig).\n\n```ts\ninterface AreaChartConfig extends BaseChartConfig {\n series: MaybeSignal<AreaSeriesConfig[]>;\n crosshair?: boolean | CrosshairConfig;\n}\n```\n\n### `AreaSeriesConfig`\n\n```ts\ninterface AreaSeriesConfig extends Series {\n curve?: 'linear' | 'monotone' | 'step'; // default: 'linear'\n fillOpacity?: number; // default: 0.3\n showLine?: boolean; // default: true\n}\n```\n\n---\n\n## Shared Config Types\n\n### `AxisConfig`\n\n```ts\ninterface AxisConfig {\n position: 'top' | 'bottom' | 'left' | 'right';\n tickCount?: number;\n tickFormat?: (value: Date | number | string) => string;\n label?: string;\n grid?: boolean | GridConfig;\n}\n```\n\n### `GridConfig`\n\n```ts\ninterface GridConfig {\n color?: string;\n dash?: string; // SVG stroke-dasharray value, e.g. '4 2'\n}\n```\n\n### `TooltipConfig`\n\n```ts\ninterface TooltipConfig {\n offset?: number; // default: 8\n render?: (datum: Datum, series: Series) => string; // returns HTML string\n sanitize?: (html: string) => string; // applied before innerHTML injection\n}\n```\n\nThe tooltip is appended inside the chart container (not `document.body`), so it is automatically scoped and cleaned up on `dispose()`.\n\n> ⚠️ **Security:** The string returned by `render` is injected via `innerHTML`. Pass `sanitize` to apply a sanitizer (e.g. DOMPurify) before injection, or ensure all user-supplied values are escaped before interpolation. A `warn` is emitted in development when `render` is set without `sanitize`.\n\n### `CrosshairConfig`\n\n```ts\ninterface CrosshairConfig {\n vertical?: boolean; // default: true\n horizontal?: boolean; // default: false\n snap?: boolean; // default: true\n}\n```\n\n### `LegendConfig`\n\n```ts\ninterface LegendConfig {\n position?: 'top' | 'bottom' | 'left' | 'right'; // default: 'bottom'\n}\n```\n\n### `TransitionConfig`\n\n```ts\ninterface TransitionConfig {\n duration?: number; // ms, default: 300\n easing?: 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out' | ((t: number) => number);\n stagger?: number; // ms delay between bar enter animations, default: 0\n}\n```\n\n> **`stagger`** applies only to bar chart enter animations — new bars grow in sequence with a `stagger`ms delay between each one.\n\n### `ChartMargin`\n\n```ts\ninterface ChartMargin {\n top: number; // default: 20\n right: number; // default: 20\n bottom: number; // default: 40\n left: number; // default: 50\n}\n```\n\n---\n\n## Utilities\n\n### `seriesColor`\n\n```ts\nfunction seriesColor(index: number, override?: string): string;\n```\n\nReturns the CSS variable reference for palette color at `index` (wraps at 8). If `override` is provided it is returned as-is. Used internally by all chart factories.\n\n```ts\nimport { seriesColor } from '@vielzeug/prism';\n\nseriesColor(0); // 'var(--prism-color-1)'\nseriesColor(0, '#ff0'); // '#ff0'\n```\n\n### `setTheme`\n\n```ts\ninterface PrismTheme {\n colors?: string[]; // replaces --prism-color-1 … -8\n fontFamily?: string; // sets --prism-font-family\n gridColor?: string; // sets --prism-grid-color\n gridOpacity?: number; // sets --prism-grid-opacity\n}\n\nfunction setTheme(theme: PrismTheme): void;\n```\n\nApplies CSS custom properties to `document.documentElement`. Call once at app startup before mounting charts. Setting `colors` clears any unset color slots left over from a previous `setTheme()` call, so a theme with fewer colors than the last one doesn't leave stale high-index colors behind.\n\n```ts\nimport { setTheme } from '@vielzeug/prism';\n\nsetTheme({ colors: ['#6366f1', '#22d3ee', '#f59e0b', '#10b981'] });\n```\n\n### `resetTheme`\n\n```ts\nfunction resetTheme(): void;\n```\n\nClears every CSS custom property `setTheme()` can set, restoring prism's default theme (from `@vielzeug/prism/theme`). Useful for test teardown or a theme-switcher's \"reset to default\" action.\n\n```ts\nimport { resetTheme, setTheme } from '@vielzeug/prism';\n\nsetTheme({ colors: ['#6366f1'] });\nresetTheme(); // back to the default palette\n```\n\n> `seriesColor`, `setTheme`, and `resetTheme` are all exported from `@vielzeug/prism` (not from the `/theme` CSS subpath).\n\n---\n\n## Interaction Types\n\n> Exported from `@vielzeug/prism` for use in plugins and custom chart extensions. Both types reflect the live state object created internally; `el` is `null` when no legend/tooltip is configured.\n\n### `LegendState`\n\n```ts\ninterface LegendState {\n dispose(): void;\n [Symbol.dispose](): void;\n el: HTMLDivElement | null;\n update(series: { color: string; name: string }[]): void;\n}\n```\n\nThe live legend object available on `ctx.legend` inside `ChartPlugin.install`. Call `update()` to re-render legend items, `dispose()` to remove the element.\n\n### `TooltipState`\n\n```ts\ninterface TooltipState {\n dispose(): void;\n [Symbol.dispose](): void;\n el: HTMLElement | null;\n hide(): void;\n show(x: number, y: number, datum: Datum, series: Series): void;\n}\n```\n\nThe live tooltip object available on `ctx.tooltip` inside `ChartPlugin.install`. `x`/`y` are pixel coordinates relative to the chart area; `show()` positions and renders the tooltip.\n\n---\n\n### `ChartPluginContext`\n\n```ts\ninterface ChartPluginContext {\n container: HTMLElement;\n dimensions: Readable<ChartDimensions>;\n disposalSignal: AbortSignal;\n svg: SVGSVGElement;\n}\n```\n\nPassed to `ChartPlugin.install(ctx)`. Gives plugins access to the reactive `dimensions` signal, the host `container`, the root `svg` element, and a `disposalSignal` aborted when the chart is torn down.\n\n```ts\nimport type { ChartPlugin } from '@vielzeug/prism';\nimport { effect } from '@vielzeug/ripple';\n\nconst watermarkPlugin: ChartPlugin = {\n dispose() {},\n install(ctx) {\n // React to size changes\n effect(() => {\n const { width, height } = ctx.dimensions.value;\n /* re-layout watermark */\n });\n },\n};\n```\n\n> **Note:** To observe future resize events use `effect(() => { ctx.dimensions.value; })` from `@vielzeug/ripple` within a reactive scope. To run cleanup when the chart is disposed without relying on your own `dispose()` implementation being called, add a listener to `ctx.disposalSignal` instead: `ctx.disposalSignal.addEventListener('abort', cleanup)`.\n>\n> **Error isolation:** if a plugin's `install()` or `dispose()` throws, the error is logged (dev builds only) and the rest of the chart — and any other installed plugins — continues to work. A throwing plugin never aborts chart creation or teardown.\n\n---\n\n## Animation Utilities\n\n> Exported from `@vielzeug/prism` for use in plugins and custom chart extensions.\n\n### `animate`\n\n```ts\nfunction animate(\n targets: AnimationTarget[],\n config?: TransitionConfig,\n onComplete?: () => void,\n signal?: AbortSignal,\n): () => void;\n```\n\nAnimates SVG element attributes from `from` to `to` values over the given `TransitionConfig` duration. Calls `onComplete` when all animations finish. Returns a cancel function — call it to stop the in-flight animation early (its `requestAnimationFrame` loop is cancelled and `onComplete` is not called).\n\n- **Empty targets or `duration: 0`** — attributes are set immediately and `onComplete` is called synchronously; no RAF is scheduled. The returned cancel function is a no-op in this case.\n- **Negative `stagger`** — clamped to `0`; all elements animate in parallel.\n- **`signal`** — if provided and already aborted (or aborted mid-animation), the RAF loop stops rescheduling itself on its next frame, same effect as calling the returned cancel function.\n\n**Parameters — `AnimationTarget`:**\n\n| Field | Type | Description |\n| ------- | ---------------------------------------------- | --------------------------------- |\n| `el` | `SVGElement` | Target element |\n| `attrs` | `Record<string, { from: number; to: number }>` | Attribute name → start/end values |\n\n```ts\nimport { animate } from '@vielzeug/prism';\n\nconst cancel = animate([{ attrs: { opacity: { from: 0, to: 1 } }, el: rect }], { duration: 300, easing: 'ease-out' });\n\n// Stop early if the element is removed before the animation completes:\ncancel();\n```\n\n### `EasingFn`\n\n```ts\ntype EasingFn = (t: number) => number;\n```\n\nA custom easing function. Receives a normalised time value `t ∈ [0, 1]` and returns a progress value (also typically `[0, 1]`). Pass as `TransitionConfig.easing`. Unknown or invalid easing name strings fall back to `'ease-out'` rather than throwing.\n\n---\n\n## Devtools\n\n> **Import:** `@vielzeug/prism/devtools`\n\nOpt-in debug logging, separate from the internal dev-mode validation warnings in `_dev.ts` (those run automatically and need no import). Tree-shaken from production bundles when this sub-path isn't imported — there is no environment gate to configure.\n\n### `debugChart`\n\n```ts\ninterface DebugChartOptions {\n label?: string; // defaults to 'chart', producing log prefixes like [prism:chart]\n}\n\nfunction debugChart<T extends ChartHandle>(handle: T, options?: DebugChartOptions): T;\n```\n\nWraps an already-created `ChartHandle` with lifecycle logging to `console.debug`. Logs the chart's mount, every resize (via its own `ResizeObserver` on `handle.el`, independent of the chart's internal one), and disposal — each prefixed with `[prism:<label>]`. Returns the same handle unchanged, so it can wrap any `create*Chart()` call in place.\n\n```ts\nimport { createLineChart } from '@vielzeug/prism';\nimport { debugChart } from '@vielzeug/prism/devtools';\n\nconst chart = debugChart(createLineChart(container, config), { label: 'revenue' });\n// [prism:revenue] mounted\n// [prism:revenue] resized 600×300\nchart.dispose();\n// [prism:revenue] disposed\n```\n\n---\n\n## Errors\n\n### `PrismError`\n\nBase class for all prism errors. Use `instanceof PrismError` or `PrismError.is()` to catch any prism-originated error.\n\n```ts\nclass PrismError extends Error {\n static is(err: unknown): err is PrismError;\n}\n```\n\n**Named subclasses**\n\n| Class | Thrown when |\n| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `PrismRenderError` | A chart is given a structurally invalid configuration it cannot render at all (e.g. a non-`Element` `container`). Recoverable issues like empty or malformed data emit a dev-mode warning instead — they do not throw. |\n| `PrismDisposedError` | Reserved for future disposal-sensitive APIs on `ChartHandle`. No code path throws this yet — calling `dispose()` more than once is currently a documented no-op, not an error. |\n",
|
|
@@ -8,6 +8,26 @@
|
|
|
8
8
|
},
|
|
9
9
|
"examples": [],
|
|
10
10
|
"typeSignatures": {
|
|
11
|
+
"EasingFn": "export type { EasingFn } from './animation/easing';",
|
|
12
|
+
"AnimationTarget": "export type { AnimationTarget } from './animation/transition';",
|
|
13
|
+
"animate": "export { animate } from './animation/transition';",
|
|
14
|
+
"createAreaChart": "export { createAreaChart } from './charts/area';",
|
|
15
|
+
"createBarChart": "export { createBarChart } from './charts/bar';",
|
|
16
|
+
"createLineChart": "export { createLineChart } from './charts/line';",
|
|
17
|
+
"createPieChart": "export { createPieChart } from './charts/pie';",
|
|
18
|
+
"createSparkline": "export { createSparkline } from './charts/sparkline';",
|
|
19
|
+
"PrismDisposedError": "export { PrismDisposedError, PrismError, PrismRenderError } from './errors';",
|
|
20
|
+
"PrismError": "export { PrismDisposedError, PrismError, PrismRenderError } from './errors';",
|
|
21
|
+
"PrismRenderError": "export { PrismDisposedError, PrismError, PrismRenderError } from './errors';",
|
|
22
|
+
"LegendState": "export type { LegendState } from './interaction/legend';",
|
|
23
|
+
"TooltipState": "export type { TooltipState } from './interaction/tooltip';",
|
|
24
|
+
"bandScale": "export { bandScale } from './scales/band';",
|
|
25
|
+
"linearScale": "export { linearScale } from './scales/linear';",
|
|
26
|
+
"timeScale": "export { timeScale } from './scales/time';",
|
|
27
|
+
"Point": "export type { Point } from './svg/path';",
|
|
28
|
+
"resetTheme": "export { resetTheme, seriesColor, setTheme } from './theme';",
|
|
29
|
+
"seriesColor": "export { resetTheme, seriesColor, setTheme } from './theme';",
|
|
30
|
+
"setTheme": "export { resetTheme, seriesColor, setTheme } from './theme';",
|
|
11
31
|
"AreaChartConfig": "export type {\n AreaChartConfig,\n AreaSeriesConfig,\n AxisConfig,\n AxisPosition,\n BandScale,\n BarChartConfig,\n BarSeriesConfig,\n BarVariant,\n BaseChartConfig,\n ChartA11y,\n ChartDimensions,\n ChartEvent,\n ChartHandle,\n ChartMargin,\n ChartPlugin,\n ChartPluginContext,\n CrosshairConfig,\n Datum,\n GridConfig,\n LegendConfig,\n LegendPosition,\n LineChartConfig,\n LineSeriesConfig,\n MaybeSignal,\n PieChartConfig,\n PieSliceConfig,\n PieVariant,\n PrismTheme,\n Scale,\n Series,\n SparklineConfig,\n SparklineVariant,\n StackSegment,\n TooltipConfig,\n TransitionConfig,\n} from './types';",
|
|
12
32
|
"AreaSeriesConfig": "export type {\n AreaChartConfig,\n AreaSeriesConfig,\n AxisConfig,\n AxisPosition,\n BandScale,\n BarChartConfig,\n BarSeriesConfig,\n BarVariant,\n BaseChartConfig,\n ChartA11y,\n ChartDimensions,\n ChartEvent,\n ChartHandle,\n ChartMargin,\n ChartPlugin,\n ChartPluginContext,\n CrosshairConfig,\n Datum,\n GridConfig,\n LegendConfig,\n LegendPosition,\n LineChartConfig,\n LineSeriesConfig,\n MaybeSignal,\n PieChartConfig,\n PieSliceConfig,\n PieVariant,\n PrismTheme,\n Scale,\n Series,\n SparklineConfig,\n SparklineVariant,\n StackSegment,\n TooltipConfig,\n TransitionConfig,\n} from './types';",
|
|
13
33
|
"AxisConfig": "export type {\n AreaChartConfig,\n AreaSeriesConfig,\n AxisConfig,\n AxisPosition,\n BandScale,\n BarChartConfig,\n BarSeriesConfig,\n BarVariant,\n BaseChartConfig,\n ChartA11y,\n ChartDimensions,\n ChartEvent,\n ChartHandle,\n ChartMargin,\n ChartPlugin,\n ChartPluginContext,\n CrosshairConfig,\n Datum,\n GridConfig,\n LegendConfig,\n LegendPosition,\n LineChartConfig,\n LineSeriesConfig,\n MaybeSignal,\n PieChartConfig,\n PieSliceConfig,\n PieVariant,\n PrismTheme,\n Scale,\n Series,\n SparklineConfig,\n SparklineVariant,\n StackSegment,\n TooltipConfig,\n TransitionConfig,\n} from './types';",
|
|
@@ -42,26 +62,6 @@
|
|
|
42
62
|
"SparklineVariant": "export type {\n AreaChartConfig,\n AreaSeriesConfig,\n AxisConfig,\n AxisPosition,\n BandScale,\n BarChartConfig,\n BarSeriesConfig,\n BarVariant,\n BaseChartConfig,\n ChartA11y,\n ChartDimensions,\n ChartEvent,\n ChartHandle,\n ChartMargin,\n ChartPlugin,\n ChartPluginContext,\n CrosshairConfig,\n Datum,\n GridConfig,\n LegendConfig,\n LegendPosition,\n LineChartConfig,\n LineSeriesConfig,\n MaybeSignal,\n PieChartConfig,\n PieSliceConfig,\n PieVariant,\n PrismTheme,\n Scale,\n Series,\n SparklineConfig,\n SparklineVariant,\n StackSegment,\n TooltipConfig,\n TransitionConfig,\n} from './types';",
|
|
43
63
|
"StackSegment": "export type {\n AreaChartConfig,\n AreaSeriesConfig,\n AxisConfig,\n AxisPosition,\n BandScale,\n BarChartConfig,\n BarSeriesConfig,\n BarVariant,\n BaseChartConfig,\n ChartA11y,\n ChartDimensions,\n ChartEvent,\n ChartHandle,\n ChartMargin,\n ChartPlugin,\n ChartPluginContext,\n CrosshairConfig,\n Datum,\n GridConfig,\n LegendConfig,\n LegendPosition,\n LineChartConfig,\n LineSeriesConfig,\n MaybeSignal,\n PieChartConfig,\n PieSliceConfig,\n PieVariant,\n PrismTheme,\n Scale,\n Series,\n SparklineConfig,\n SparklineVariant,\n StackSegment,\n TooltipConfig,\n TransitionConfig,\n} from './types';",
|
|
44
64
|
"TooltipConfig": "export type {\n AreaChartConfig,\n AreaSeriesConfig,\n AxisConfig,\n AxisPosition,\n BandScale,\n BarChartConfig,\n BarSeriesConfig,\n BarVariant,\n BaseChartConfig,\n ChartA11y,\n ChartDimensions,\n ChartEvent,\n ChartHandle,\n ChartMargin,\n ChartPlugin,\n ChartPluginContext,\n CrosshairConfig,\n Datum,\n GridConfig,\n LegendConfig,\n LegendPosition,\n LineChartConfig,\n LineSeriesConfig,\n MaybeSignal,\n PieChartConfig,\n PieSliceConfig,\n PieVariant,\n PrismTheme,\n Scale,\n Series,\n SparklineConfig,\n SparklineVariant,\n StackSegment,\n TooltipConfig,\n TransitionConfig,\n} from './types';",
|
|
45
|
-
"TransitionConfig": "export type {\n AreaChartConfig,\n AreaSeriesConfig,\n AxisConfig,\n AxisPosition,\n BandScale,\n BarChartConfig,\n BarSeriesConfig,\n BarVariant,\n BaseChartConfig,\n ChartA11y,\n ChartDimensions,\n ChartEvent,\n ChartHandle,\n ChartMargin,\n ChartPlugin,\n ChartPluginContext,\n CrosshairConfig,\n Datum,\n GridConfig,\n LegendConfig,\n LegendPosition,\n LineChartConfig,\n LineSeriesConfig,\n MaybeSignal,\n PieChartConfig,\n PieSliceConfig,\n PieVariant,\n PrismTheme,\n Scale,\n Series,\n SparklineConfig,\n SparklineVariant,\n StackSegment,\n TooltipConfig,\n TransitionConfig,\n} from './types';"
|
|
46
|
-
"PrismDisposedError": "export { PrismDisposedError, PrismError, PrismRenderError } from './errors';",
|
|
47
|
-
"PrismError": "export { PrismDisposedError, PrismError, PrismRenderError } from './errors';",
|
|
48
|
-
"PrismRenderError": "export { PrismDisposedError, PrismError, PrismRenderError } from './errors';",
|
|
49
|
-
"createAreaChart": "export { createAreaChart } from './charts/area';",
|
|
50
|
-
"createBarChart": "export { createBarChart } from './charts/bar';",
|
|
51
|
-
"createLineChart": "export { createLineChart } from './charts/line';",
|
|
52
|
-
"createPieChart": "export { createPieChart } from './charts/pie';",
|
|
53
|
-
"createSparkline": "export { createSparkline } from './charts/sparkline';",
|
|
54
|
-
"bandScale": "export { bandScale } from './scales/band';",
|
|
55
|
-
"linearScale": "export { linearScale } from './scales/linear';",
|
|
56
|
-
"timeScale": "export { timeScale } from './scales/time';",
|
|
57
|
-
"animate": "export { animate } from './animation/transition';",
|
|
58
|
-
"AnimationTarget": "export type { AnimationTarget } from './animation/transition';",
|
|
59
|
-
"EasingFn": "export type { EasingFn } from './animation/easing';",
|
|
60
|
-
"LegendState": "export type { LegendState } from './interaction/legend';",
|
|
61
|
-
"TooltipState": "export type { TooltipState } from './interaction/tooltip';",
|
|
62
|
-
"Point": "export type { Point } from './svg/path';",
|
|
63
|
-
"resetTheme": "export { resetTheme, seriesColor, setTheme } from './theme';",
|
|
64
|
-
"seriesColor": "export { resetTheme, seriesColor, setTheme } from './theme';",
|
|
65
|
-
"setTheme": "export { resetTheme, seriesColor, setTheme } from './theme';"
|
|
65
|
+
"TransitionConfig": "export type {\n AreaChartConfig,\n AreaSeriesConfig,\n AxisConfig,\n AxisPosition,\n BandScale,\n BarChartConfig,\n BarSeriesConfig,\n BarVariant,\n BaseChartConfig,\n ChartA11y,\n ChartDimensions,\n ChartEvent,\n ChartHandle,\n ChartMargin,\n ChartPlugin,\n ChartPluginContext,\n CrosshairConfig,\n Datum,\n GridConfig,\n LegendConfig,\n LegendPosition,\n LineChartConfig,\n LineSeriesConfig,\n MaybeSignal,\n PieChartConfig,\n PieSliceConfig,\n PieVariant,\n PrismTheme,\n Scale,\n Series,\n SparklineConfig,\n SparklineVariant,\n StackSegment,\n TooltipConfig,\n TransitionConfig,\n} from './types';"
|
|
66
66
|
}
|
|
67
67
|
}
|
package/data/packages/pulse.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"apiSource": "export
|
|
2
|
+
"apiSource": "export {\n PulseAbortError,\n PulseConnectionError,\n PulseDisposedError,\n PulseError,\n PulseProtocolError,\n PulseTimeoutError,\n} from './errors';\nexport { createPulse } from './pulse';\nexport type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n PresenceDefinitions,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n ReconnectOptions,\n Unsubscribe,\n} from './types';\n",
|
|
3
3
|
"docs": {
|
|
4
4
|
"index": "---\ntitle: Pulse — Typed WebSocket sessions\ndescription: Explicitly connected, typed WebSocket sessions with scoped channels, presence, reconnect restoration, and heartbeat.\npackage: pulse\ncategory: websockets\nkeywords: [websocket, realtime, channels, presence, reconnect, heartbeat, typed-messaging, ripple]\nrelated: [herald, ripple, courier, clockwork]\nexports:\n [\n createPulse,\n Pulse,\n PulseChannel,\n PresenceChannel,\n PulseOptions,\n ChannelDefinition,\n ChannelDefinitions,\n PresenceDefinitions,\n OutgoingMessage,\n OutgoingTransform,\n PulseError,\n PulseConnectionError,\n PulseTimeoutError,\n PulseAbortError,\n PulseDisposedError,\n PulseProtocolError,\n ]\nenvironments: [browser, node]\n---\n\n<!-- markdownlint-disable MD025 MD033 MD060 -->\n\n<PackageHero package=\"pulse\" />\n\n## Why Pulse?\n\nNative WebSocket leaves connection ownership, event routing, reconnect restoration, and cleanup to each application. Pulse provides those boundaries while making readiness explicit: applications connect before sending, and disconnected messages never disappear silently.\n\n```ts\n// Before\nconst socket = new WebSocket('wss://api.example.com/ws');\nsocket.addEventListener('message', (event) => route(JSON.parse(event.data)));\nsocket.addEventListener('close', () => setTimeout(() => reconnect(), 1_000));\n\n// After\nconst pulse = createPulse<ServerEvents, ClientEvents>('wss://api.example.com/ws', { reconnect: true });\ntry {\n await pulse.connect();\n pulse.on('chat:message', (message) => console.log(message.text));\n pulse.send('chat:send', { text: 'Hello!' });\n} catch (error) {\n console.error('Pulse connection failed:', error);\n}\n```\n\n| Feature | Pulse | Native WebSocket | socket.io-client |\n| --- | --- | --- | --- |\n| Bundle size | <PackageInfo package=\"pulse\" type=\"size\" /> | 0 B | ~44 kB gzip |\n| Explicit readiness | <ore-icon name=\"check\" size=\"16\"></ore-icon> | Manual | <ore-icon name=\"check\" size=\"16\"></ore-icon> |\n| Session restoration | <ore-icon name=\"check\" size=\"16\"></ore-icon> | <ore-icon name=\"x\" size=\"16\"></ore-icon> | Protocol-specific |\n| Typed scoped channels | <ore-icon name=\"check\" size=\"16\"></ore-icon> | <ore-icon name=\"x\" size=\"16\"></ore-icon> | Basic |\n| Zero runtime dependencies | <ore-icon name=\"triangle-alert\" size=\"16\"></ore-icon> ripple | <ore-icon name=\"check\" size=\"16\"></ore-icon> | <ore-icon name=\"x\" size=\"16\"></ore-icon> |\n\n<div class=\"decision-callout\">\n\n**Use Pulse when** you need a typed WebSocket session whose reconnect and cleanup behavior must be deterministic.\n\n**Consider native WebSocket when** a single untyped connection does not need retry, routing, or session restoration.\n\n</div>\n\n## Installation\n\n::: code-group\n\n```sh [pnpm]\npnpm add @vielzeug/pulse @vielzeug/ripple\n```\n\n```sh [npm]\nnpm install @vielzeug/pulse @vielzeug/ripple\n```\n\n```sh [yarn]\nyarn add @vielzeug/pulse @vielzeug/ripple\n```\n\n:::\n\n## Quick Start\n\nDefine the protocol at construction time, create scopes, then connect before sending.\n\n```ts\nimport { createPulse } from '@vielzeug/pulse';\n\ntype ServerEvents = { 'chat:message': { text: string } };\ntype ClientEvents = { 'chat:send': { text: string } };\ntype Channels = {\n chat: {\n client: { send: { text: string } };\n server: { message: { text: string } };\n };\n};\ntype Presence = { lobby: { name: string } };\n\nconst pulse = createPulse<ServerEvents, ClientEvents, Channels, Presence>('wss://api.example.com/ws', {\n reconnect: true,\n onError: (error) => console.error(error),\n});\nconst chat = pulse.channel('chat');\nconst lobby = pulse.presence('lobby');\n\ntry {\n await pulse.connect();\n chat.send('send', { text: 'Hello!' });\n lobby.update({ name: 'Ada' });\n} catch (error) {\n console.error('Pulse connection failed:', error);\n}\n\npulse.dispose();\n```\n\n## Features\n\n<div class=\"features-grid\">\n\n- **`connect()`** — explicit readiness; application messages throw while disconnected.\n- **`channel()`** — named, schema-bound scopes with independent disposal and reference-counted server subscriptions.\n- **`presence()`** — named, schema-bound reactive presence scopes with reference-counted room membership.\n- **`reconnect`** — ordered restoration of channel subscriptions, rooms, and local presence state.\n- **`transform`** — one synchronous transform or filter for application messages.\n- **`onError`** — typed connection and protocol errors.\n- **`heartbeat`** — ping/pong liveness detection that uses the same reconnect controller.\n- **`status` and `rooms`** — ripple readables for transport and confirmed membership state.\n\n</div>\n\n## Documentation\n\n<div class=\"doc-links\">\n\n- [Usage Guide](./usage.md)\n- [API Reference](./api.md)\n- [Examples](./examples.md)\n- [Pulse 3.0 Migration](./migration.md)\n\n</div>\n\n## See Also\n\n<div class=\"see-also\">\n\n- [Ripple](/ripple/) — provides the reactive values exposed by Pulse.\n- [Herald](/herald/) — receives routed Pulse events in an in-process application bus.\n- [Courier](/courier/) — handles request/response traffic alongside a Pulse session.\n- [Clockwork](/clockwork/) — models application-level authentication or session workflows.\n\n</div>\n\n<!-- markdownlint-enable MD025 MD033 MD060 -->\n",
|
|
5
5
|
"api": "---\ntitle: Pulse — API Reference\ndescription: Complete API reference for @vielzeug/pulse.\n---\n\n[[toc]]\n\n## API Overview\n\n| Symbol | Purpose | Execution mode | Common gotcha |\n| --- | --- | --- | --- |\n| `createPulse()` | Creates an explicitly connected WebSocket session | Sync | Call `connect()` before sends |\n| `Pulse` | Root session API | Sync / Async | Named schemas are fixed at construction |\n| `PulseChannel` | Disposable channel listener scope | Sync / Async | Each call is a distinct scope |\n| `PresenceChannel` | Disposable reactive presence scope | Sync | `update()` requires an open connection |\n| `OutgoingTransform` | Transforms or filters application messages | Sync | Return `null` to filter |\n| `PulseError` types | Typed transport and protocol failures | Sync | Handle rejected promises as well as `onError` |\n\n## Package Entry Point\n\n| Import | Purpose |\n| --- | --- |\n| `@vielzeug/pulse` | All public values, errors, and types |\n\n## Core Functions\n\n### `createPulse()`\n\n```ts\ncreatePulse<\n TServer extends MessageMap = MessageMap,\n TClient extends MessageMap = MessageMap,\n TChannels extends ChannelDefinitions = ChannelDefinitions,\n TPresence extends PresenceDefinitions = PresenceDefinitions,\n>(url: string, options?: PulseOptions): Pulse<TServer, TClient, TChannels, TPresence>\n```\n\nCreates a closed session. `connect()` opens the socket and restores active session state.\n\n| Parameter | Type | Description |\n| --- | --- | --- |\n| `url` | `string` | WebSocket URL |\n| `options` | `PulseOptions` | Transport, error, reconnect, heartbeat, and transform configuration |\n\n**Returns:** `Pulse<TServer, TClient, TChannels, TPresence>`\n\n```ts\nimport { createPulse } from '@vielzeug/pulse';\n\ntype ServerEvents = { notice: string };\ntype ClientEvents = { acknowledge: { id: string } };\n\nconst pulse = createPulse<ServerEvents, ClientEvents>('wss://api.example.com/ws');\nawait pulse.connect();\n```\n\n## Session API\n\n| Member | Returns | Contract |\n| --- | --- | --- |\n| `connect()` | `Promise<void>` | Opens transport and restores session state |\n| `disconnect(code?, reason?)` | `void` | Cancels retry and closes transport |\n| `send(event, payload)` | `void` | Throws `PulseConnectionError` unless open |\n| `on()` / `once()` / `wait()` | `Unsubscribe` / `Promise` | Root server-event subscriptions |\n| `channel(name)` | `PulseChannel` | Creates a schema-bound disposable scope |\n| `join()` / `leave()` | `Promise<void>` | Require an open connection and server confirmation |\n| `presence(room)` | `PresenceChannel` | Creates a schema-bound reference-counted room scope |\n| `status` / `rooms` | `Readable` | Transport state and server-confirmed room membership |\n| `dispose()` | `void` | Releases the whole session |\n\n### `pulse.channel()`\n\n```ts\nchannel<K extends keyof TChannels & string>(name: K): PulseChannel<TChannels[K]['server'], TChannels[K]['client']>\n```\n\nEach call creates a separate scope. Pulse sends `subscribe` for the first active scope and `unsubscribe` after the last is disposed.\n\n### `pulse.presence()`\n\n```ts\npresence<K extends keyof TPresence & string>(room: K): PresenceChannel<TPresence[K]>\n```\n\nEach call creates a separate presence scope. Pulse keeps the room joined while at least one scope remains.\n\n### `pulse.send()`\n\n```ts\nsend<K extends EventKey<TClient>>(event: K, payload: TClient[K]): void\n```\n\nSends a root application message. Throws `PulseConnectionError` unless the socket is open.\n\n### `pulse.wait()`\n\n```ts\nwait<K extends EventKey<TServer>>(event: K, opts?: { signal?: AbortSignal; timeout?: number }): Promise<TServer[K]>\n```\n\nResolves with the next matching event. Rejects with `PulseAbortError` or `PulseTimeoutError`.\n\n### `pulse.join()` and `pulse.leave()`\n\n```ts\njoin(room: string, opts?: { signal?: AbortSignal; timeout?: number }): Promise<void>\nleave(room: string, opts?: { signal?: AbortSignal; timeout?: number }): Promise<void>\n```\n\nBoth methods require an open transport and resolve only after the matching server confirmation. Opposing in-flight requests are serialized, so the final confirmed state follows the last request.\n\n| Parameter | Type | Description |\n| --- | --- | --- |\n| `room` | `string` | Server room identifier |\n| `opts.signal` | `AbortSignal` | Cancels the caller's wait; Pulse reconciles any request already sent |\n| `opts.timeout` | `number` | Maximum confirmation wait in milliseconds |\n\n**Returns:** A promise that rejects with `PulseConnectionError`, `PulseAbortError`, `PulseTimeoutError`, or `PulseDisposedError` when applicable.\n\n### `pulse.disconnect()`\n\n```ts\ndisconnect(code?: number, reason?: string): void\n```\n\nCloses the current session, cancels scheduled reconnects, and clears confirmed remote room and presence state immediately. Calling `connect()` afterward starts a new session from the retained desired scopes.\n\n## Scoped Handles\n\n`PulseChannel` and `PresenceChannel` are independently disposable. Disposing one scope removes only that scope's listeners and ownership reference.\n\n## Types\n\n```ts\nimport type { Readable } from '@vielzeug/ripple';\n\ntype MessageMap = Record<string, unknown>;\ntype EventKey<T extends MessageMap> = keyof T & string;\ntype Unsubscribe = () => void;\ntype PulseStatus = 'connecting' | 'open' | 'reconnecting' | 'closed';\n\ntype ChannelDefinition = { client: MessageMap; server: MessageMap };\ntype ChannelDefinitions = Record<string, ChannelDefinition>;\ntype PresenceDefinitions = Record<string, unknown>;\n\ntype OutgoingMessage = { channel?: string; event: string; payload: unknown };\ntype OutgoingTransform = (message: Readonly<OutgoingMessage>) => OutgoingMessage | null;\n\ntype ReconnectOptions = {\n delay?: number | ((attempt: number) => number);\n maxAttempts?: number;\n};\n\ntype HeartbeatOptions = { interval?: number; timeout?: number };\n\ntype PulseOptions = {\n heartbeat?: boolean | HeartbeatOptions;\n onError?: (error: PulseError) => void;\n protocols?: string | string[];\n reconnect?: boolean | ReconnectOptions;\n transform?: OutgoingTransform;\n};\n```\n\n```ts\ntype PulseChannel<TServer extends MessageMap = MessageMap, TClient extends MessageMap = MessageMap> = {\n [Symbol.dispose](): void;\n readonly disposalSignal: AbortSignal;\n dispose(): void;\n readonly disposed: boolean;\n readonly name: string;\n on<K extends EventKey<TServer>>(event: K, handler: (payload: TServer[K]) => void): Unsubscribe;\n once<K extends EventKey<TServer>>(event: K, handler: (payload: TServer[K]) => void): Unsubscribe;\n send<K extends EventKey<TClient>>(event: K, payload: TClient[K]): void;\n wait<K extends EventKey<TServer>>(event: K, opts?: { signal?: AbortSignal; timeout?: number }): Promise<TServer[K]>;\n};\n\ntype PresenceChannel<T = unknown> = {\n [Symbol.dispose](): void;\n readonly disposalSignal: AbortSignal;\n dispose(): void;\n readonly disposed: boolean;\n onJoin(handler: (memberId: string, state: T) => void): Unsubscribe;\n onLeave(handler: (memberId: string) => void): Unsubscribe;\n readonly room: string;\n readonly state: Readable<ReadonlyMap<string, T>>;\n update(state: T): void;\n};\n```\n\n```ts\ntype Pulse<\n TServer extends MessageMap = MessageMap,\n TClient extends MessageMap = MessageMap,\n TChannels extends ChannelDefinitions = ChannelDefinitions,\n TPresence extends PresenceDefinitions = PresenceDefinitions,\n> = {\n [Symbol.dispose](): void;\n channel<K extends keyof TChannels & string>(name: K): PulseChannel<TChannels[K]['server'], TChannels[K]['client']>;\n connect(): Promise<void>;\n disconnect(code?: number, reason?: string): void;\n readonly disposalSignal: AbortSignal;\n dispose(): void;\n readonly disposed: boolean;\n join(room: string, opts?: { signal?: AbortSignal; timeout?: number }): Promise<void>;\n leave(room: string, opts?: { signal?: AbortSignal; timeout?: number }): Promise<void>;\n on<K extends EventKey<TServer>>(event: K, handler: (payload: TServer[K]) => void): Unsubscribe;\n once<K extends EventKey<TServer>>(event: K, handler: (payload: TServer[K]) => void): Unsubscribe;\n presence<K extends keyof TPresence & string>(room: K): PresenceChannel<TPresence[K]>;\n readonly rooms: Readable<ReadonlySet<string>>;\n send<K extends EventKey<TClient>>(event: K, payload: TClient[K]): void;\n readonly status: Readable<PulseStatus>;\n wait<K extends EventKey<TServer>>(event: K, opts?: { signal?: AbortSignal; timeout?: number }): Promise<TServer[K]>;\n};\n```\n\n## Errors\n\n| Class | Triggers | Notable properties |\n| --- | --- | --- |\n| `PulseError` | Base class for every Pulse error | `PulseError.is(error)` |\n| `PulseConnectionError` | Send before open, transport error, or exhausted reconnect | `url` |\n| `PulseTimeoutError` | A `wait()`, `join()`, or `leave()` timeout | `event` |\n| `PulseAbortError` | An abort signal cancels `wait()`, `join()`, or `leave()` | — |\n| `PulseDisposedError` | An operation targets a disposed scope or session | — |\n| `PulseProtocolError` | A malformed, unknown, server-error, or failed handler frame | `raw` |\n",
|
|
@@ -34,27 +34,27 @@
|
|
|
34
34
|
}
|
|
35
35
|
],
|
|
36
36
|
"typeSignatures": {
|
|
37
|
-
"ChannelDefinition": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n PresenceDefinitions,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
38
|
-
"ChannelDefinitions": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n PresenceDefinitions,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
39
|
-
"EventKey": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n PresenceDefinitions,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
40
|
-
"HeartbeatOptions": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n PresenceDefinitions,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
41
|
-
"MessageMap": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n PresenceDefinitions,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
42
|
-
"OutgoingMessage": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n PresenceDefinitions,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
43
|
-
"OutgoingTransform": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n PresenceDefinitions,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
44
|
-
"PresenceChannel": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n PresenceDefinitions,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
45
|
-
"Pulse": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n PresenceDefinitions,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
46
|
-
"PulseChannel": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n PresenceDefinitions,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
47
|
-
"PulseOptions": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n PresenceDefinitions,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
48
|
-
"PulseStatus": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n PresenceDefinitions,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
49
|
-
"PresenceDefinitions": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n PresenceDefinitions,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
50
|
-
"ReconnectOptions": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n PresenceDefinitions,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
51
|
-
"Unsubscribe": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n PresenceDefinitions,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
52
37
|
"PulseAbortError": "export {\n PulseAbortError,\n PulseConnectionError,\n PulseDisposedError,\n PulseError,\n PulseProtocolError,\n PulseTimeoutError,\n} from './errors';",
|
|
53
38
|
"PulseConnectionError": "export {\n PulseAbortError,\n PulseConnectionError,\n PulseDisposedError,\n PulseError,\n PulseProtocolError,\n PulseTimeoutError,\n} from './errors';",
|
|
54
39
|
"PulseDisposedError": "export {\n PulseAbortError,\n PulseConnectionError,\n PulseDisposedError,\n PulseError,\n PulseProtocolError,\n PulseTimeoutError,\n} from './errors';",
|
|
55
40
|
"PulseError": "export {\n PulseAbortError,\n PulseConnectionError,\n PulseDisposedError,\n PulseError,\n PulseProtocolError,\n PulseTimeoutError,\n} from './errors';",
|
|
56
41
|
"PulseProtocolError": "export {\n PulseAbortError,\n PulseConnectionError,\n PulseDisposedError,\n PulseError,\n PulseProtocolError,\n PulseTimeoutError,\n} from './errors';",
|
|
57
42
|
"PulseTimeoutError": "export {\n PulseAbortError,\n PulseConnectionError,\n PulseDisposedError,\n PulseError,\n PulseProtocolError,\n PulseTimeoutError,\n} from './errors';",
|
|
58
|
-
"createPulse": "export { createPulse } from './pulse';"
|
|
43
|
+
"createPulse": "export { createPulse } from './pulse';",
|
|
44
|
+
"ChannelDefinition": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n PresenceDefinitions,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
45
|
+
"ChannelDefinitions": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n PresenceDefinitions,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
46
|
+
"EventKey": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n PresenceDefinitions,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
47
|
+
"HeartbeatOptions": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n PresenceDefinitions,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
48
|
+
"MessageMap": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n PresenceDefinitions,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
49
|
+
"OutgoingMessage": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n PresenceDefinitions,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
50
|
+
"OutgoingTransform": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n PresenceDefinitions,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
51
|
+
"PresenceChannel": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n PresenceDefinitions,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
52
|
+
"PresenceDefinitions": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n PresenceDefinitions,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
53
|
+
"Pulse": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n PresenceDefinitions,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
54
|
+
"PulseChannel": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n PresenceDefinitions,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
55
|
+
"PulseOptions": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n PresenceDefinitions,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
56
|
+
"PulseStatus": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n PresenceDefinitions,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
57
|
+
"ReconnectOptions": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n PresenceDefinitions,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n ReconnectOptions,\n Unsubscribe,\n} from './types';",
|
|
58
|
+
"Unsubscribe": "export type {\n ChannelDefinition,\n ChannelDefinitions,\n EventKey,\n HeartbeatOptions,\n MessageMap,\n OutgoingMessage,\n OutgoingTransform,\n PresenceChannel,\n PresenceDefinitions,\n Pulse,\n PulseChannel,\n PulseOptions,\n PulseStatus,\n ReconnectOptions,\n Unsubscribe,\n} from './types';"
|
|
59
59
|
}
|
|
60
60
|
}
|