Skip to Content
API referencePackage exports

Package exports

Orbz separates pure API access, automatic browser registration, the React adapter, and the standalone browser bundle. Choose the narrowest entry point for the job.

Entry-point map

ImportExposesSide effect
@neongate-ai/orbzNative element types, constants, presets, normalization helpers, createOrbzElementClass(), and defineOrbz()Does not register the tag
@neongate-ai/orbz/browserEverything from the root entryCalls defineOrbz()
@neongate-ai/orbz/react<Orbz />, OrbzProps, and related option typesRegisters through the adapter after mount
@neongate-ai/orbz/standaloneSelf-contained browser build of the browser entryCalls defineOrbz()
@neongate-ai/orbz/package.jsonPublished package metadataNone

The browser and standalone entry points are marked as side-effectful in the package manifest so bundlers retain their registration call.

Root entry

Use the root entry for explicit registration and reusable domain types:

import { defineOrbz, ORBZ_PRESETS, ORBZ_STATES, type OrbzElement, type OrbzPresetName, type OrbzState, } from "@neongate-ai/orbz"; defineOrbz(); const nextState: OrbzState = "listening"; const preset: OrbzPresetName = "neongate"; const colors = ORBZ_PRESETS[preset]; const orb = document.querySelector<OrbzElement>("orb-z"); if (orb) orb.state = nextState;

Importing the root module alone never registers orb-z. Call defineOrbz() or import /browser when a page should upgrade the tag.

Constants

ExportMeaning
ORBZ_TAG_NAMEThe string "orb-z"
ORBZ_OBSERVED_ATTRIBUTESReactive native attribute names
ORBZ_STATESAll supported assistant states
ORBZ_REDUCED_MOTION_MODESsystem, always, and never
ORBZ_PRESET_NAMESAll six preset names
ORBZ_PRESETSFrozen color values for every preset
ORBZ_COLOR_ATTRIBUTESMap from color keys to native attribute names
ORBZ_COLOR_KEYSThe five color keys
DEFAULT_ORBZ_STATEidle
DEFAULT_ORBZ_SIZE16rem
DEFAULT_ORBZ_SPEED1
DEFAULT_ORBZ_REDUCED_MOTIONsystem
DEFAULT_ORBZ_PRESETneongate
DEFAULT_ORBZ_COLORSThe NeonGate preset colors

The arrays and preset records are useful for generating validated controls without copying the package’s accepted values.

import { ORBZ_PRESET_NAMES, ORBZ_STATES } from "@neongate-ai/orbz"; for (const state of ORBZ_STATES) { stateSelect.add(new Option(state, state)); } for (const preset of ORBZ_PRESET_NAMES) { presetSelect.add(new Option(preset, preset)); }

Types

ExportShape
OrbzStateUnion of the five state names
OrbzReducedMotion"system" | "always" | "never"
OrbzPresetNameUnion of the six preset names
OrbzSizenumber | string
OrbzColorsRequired primary, secondary, accent, highlight, and background strings
OrbzColorOverridesPartial OrbzColors
OrbzBaseOptionsState, size, speed, pause, elevation, and reduced-motion options
OrbzPresetOptionsPreset mode; custom color keys are never
OrbzCustomColorOptionsCustom-color mode; preset is never
OrbzColorSelectionUnion of preset and custom-color mode
OrbzOptionsBase options combined with the color selection union
OrbzElementNative element properties and playback methods
OrbzElementConstructorTyped custom-element constructor

Validators and normalizers

ExportPurpose
isOrbzState()Type guard for a supported state
isOrbzPresetName()Type guard for a preset name
isOrbzReducedMotion()Type guard for a reduced-motion value
normalizeOrbzState()Unsupported input becomes idle
normalizeOrbzPreset()Unsupported input becomes neongate
normalizeOrbzReducedMotion()Unsupported input becomes system
normalizeOrbzSize()Numbers become pixels; invalid numeric or empty input becomes 16rem
normalizeOrbzSpeed()Non-positive or non-finite input becomes 1
mergeOrbzColors()Merge valid, non-empty overrides over a base color set

Normalize untrusted configuration before storing it:

import { normalizeOrbzPreset, normalizeOrbzSpeed, normalizeOrbzState, } from "@neongate-ai/orbz"; const config = { preset: normalizeOrbzPreset(payload.preset), speed: normalizeOrbzSpeed(payload.speed), state: normalizeOrbzState(payload.state), };

Registration helpers

defineOrbz() is the normal explicit-registration API. It is SSR-safe and idempotent:

import { defineOrbz } from "@neongate-ai/orbz"; const constructor = defineOrbz();

createOrbzElementClass() creates and caches the class only when globalThis.HTMLElement exists. It is exported for advanced integrations; most applications should call defineOrbz() instead.

import { createOrbzElementClass } from "@neongate-ai/orbz"; const constructor = createOrbzElementClass(); // undefined on a server; an OrbzElementConstructor in a browser

Both helpers avoid evaluating an HTMLElement subclass when the DOM is not available.

Last updated on