Quick reference
API index.
Scan every supported public signature across the active White Label projects, then jump directly to its authoritative package documentation for parameters, return contracts, runtime details, lifecycle guidance, security notes, and examples.
Filter API
Observable state
white-label-model
Own object, array, or Map state with synchronous change notifications, deep mutation observation, and optional whole-state runtime validation.
Core API
new Model(data?, validator?)- Create an observable root state container.
initialize()- Start the lifecycle for chaining and composition.
addEventListener(type, callback, options?)- Subscribe to Model events with native EventTarget semantics; Model payloads are available through CustomEvent.detail.
removeEventListener(type, callback, options?)- Release a Model subscription using EventTarget listener matching semantics.
dispatchEvent(event)- Synchronously dispatch an application-supplied Event or CustomEvent through the native EventTarget contract.
get() / get(key)- Read the complete observable root or one object property, array index, or Map entry.
set(data, silent?)- Replace the complete root state with another supported root shape.
update(partial, silent?) / update(key, value, silent?)- Shallow-merge an object root or replace/shallow-merge one existing array or Map member.
push(valueOrValues, silent?) / push(key, value, silent?)- Append array values or insert Map entries.
delete(key, silent?)- Delete one object property, array index, or Map entry.
clear(silent?)- Reset the root to an empty value of the same shape.
destroy()- Clear state silently and release Model-owned listeners.
Rendering and lifecycle
white-label-view
Render new output or adopt existing DOM through explicit browser or server lifecycles, with first-party tagged HTML and application-owned renderer choice.
Browser constructor settings
new View(settings?)- Create a browser View.
Browser View API
update(element, data)- Handle an attached root in place before template rendering; returning true allows an adopted View to render without a client template.
setModel(model?)- Move model binding and synchronously render current data.
initialize()- Perform the initial synchronous render and lifecycle setup.
requestRender()- Render now or queue one animation-frame render when batching is enabled.
addChild(child)- Give this View cleanup ownership of another View without automatically mounting it.
releaseChild(child)- Relinquish cleanup ownership without destroying the child.
destroy()- Release listeners, binding, queued work, owned children, and the DOM root.
initializeModelBinding()- Subscribe once to an EventTarget-compatible model's change event.
destroyModelBinding()- Release the owned EventTarget model subscription and cancel queued rendering.
addListeners()- Subclass hook called after root installation.
removeListeners()- Subclass hook called before root replacement or destruction.
afterMount()- Subclass hook called after insertion/adoption and listener setup.
delegate(scope?)- Create a caller-owned delegated-event registry scoped to an element or the current root.
render()- Synchronously adopt/update an attached root or mount, preserve, or replace template output.
DelegatedEvents API
delegated.on(type, selector, callback, options?)- Register a native delegated event listener. once is consumed only by a matching event.
delegated.off(type, selector?, callback?, options?)- Remove matching delegated registrations, optionally scoped by selector/callback/capture.
delegated.clear()- Remove every native and abort listener owned by the registry.
Server View API
setModel(model?)- Move model binding and synchronously render current data.
initialize()- Render current state and initialize the server lifecycle.
addChild(child)- Register child cleanup ownership.
releaseChild(child)- Release ownership without destroying the child.
initializeModelBinding()- Subscribe to EventTarget-compatible model changes.
destroyModelBinding()- Release the EventTarget model subscription after first resetting internal binding state, so the server View remains reusable even if external listener removal throws.
render()- Synchronously render the template into stored HTML.
toString()- Read the most recently rendered HTML.
destroy()- Destroy children, release subscriptions, and clear stored output.
Tagged HTML API
html`...`- Render a tagged HTML template with escaped interpolations and runtime-owned trusted output.
attributes(values)- Render validated, escaped HTML attributes for interpolation at an opening-tag attribute boundary.
unsafeHTML(value)- Mark caller-owned, already trusted or sanitized HTML for insertion without escaping.
isHTMLMarkup(value)- Identify tagged output created by the active White Label View package instance. Marker-shaped objects and output from a separate installed copy are not implicitly trusted.
HTMLMarkup- TypeScript contract for trusted tagged output created by the active White Label View package instance.
Application events
white-label-mediator
A small synchronous standards-based EventTarget for exchanging named application intent without direct module coupling.
Mediator API
new Mediator<Events>()- Create an independent EventTarget-based application event bus, optionally with a compile-time detail map.
initialize()- Start the lifecycle for composition/chaining.
addEventListener(type, callback, options?)- Subscribe using native EventTarget semantics; typed maps narrow CustomEvent.detail for known event names.
removeEventListener(type, callback, options?)- Release an owned subscription using native EventTarget matching semantics.
dispatchEvent(event)- Synchronously dispatch an Event or CustomEvent through the native EventTarget signature.
destroy()- Remove every listener owned by this mediator instance and reset lifecycle tracking for reuse.
URL to application intent
white-label-router
Use one route contract across browser and server runtimes while preserving real links, scoped progressive enhancement, URL semantics, History API behavior, and requestable server routes.
Configuration properties
router.routes- Route table containing route functions or lifecycle route objects; the longest matching own path prefix wins regardless of insertion order.
router.scope- Application Element passed to callbacks; null is valid on server paths.
router.navigationRoot- Optional Document or Element that scopes data-pushstate click interception; null uses document. Changing it while listeners are active moves the owned click listener.
router.mediator- Optional EventTarget-compatible source for router:navigate CustomEvents; an active subscription moves from the previous mediator when this property changes.
route.title- Document title applied after browser routing; retained as pageTitle state on servers.
route.focus- Selector to focus after browser navigation; defaults to main h1, false preserves focus.
route.secure(scope, location)- Navigation guard. Only an exact true result allows the route.
route.view- Route function or lifecycle object with initialize() and optional destroy().
Router API
new Router()- Create an independent router with default fallback behavior and isolated listener state.
initialize(url?)- Dispatch the current browser URL or an explicit server URL and attach applicable listeners.
addListeners()- Attach browser and optional mediator handlers once.
destroy()- Release routing listeners owned by the instance.
removeListeners()- Release listeners owned by this router; subclasses may extend this lifecycle hook.
eventPushStateClick(event)- Intercept an eligible same-origin data-pushstate link while preserving native browser actions that should not be enhanced.
eventPopState()- Dispatch the authoritative current browser history location without adding a new entry.
parseQueryString(query)- Decode query parameters using URLSearchParams and keep the last duplicate value.
setLocationData(data?)- Rebuild decoded path/query/mediator payload for the selected route.
applyPageContext(route)- Apply configured title and focus after routing when the runtime supports those effects.
navigate(url?, data?, isPopState?)- Atomically match a route, enforce its guard/runnable view contract, transition view lifecycle, and update browser history when applicable.
Project creation
generator-white-label
Create a production-oriented TypeScript starter that composes the White Label packages with one canonical tagged-HTML template path.
CLI contract
white-label create <destination>- Create the canonical tagged-template project in a missing or empty target directory without overwriting existing user files.
white-label --help- Show command usage.
Programmatic API
createProject(options)- Write the canonical White Label scaffold using the same implementation and overwrite protection as the CLI.
createSiteManifest()- Return the package manifest written into generated White Label projects.
CreateProjectOptions- TypeScript options contract for createProject().
ScaffoldFileSystem- TypeScript filesystem adapter contract used by createProject() for copying files and writing JSON.