Skip to Content
OrbzAPI referencePackage exports

Package exports

Orbz separates pure API access, guarded browser registration, and the standalone browser bundle. Every framework renders the native <orb-z> element.

Entry-point map

ImportExposesSide effect
@neongate-ai/orbzNative element, talk-runtime types, constants, presets, normalization helpers, orbzElementClassFactory(), and defineOrbz()Does not register the tag
@neongate-ai/orbz/browserEverything from the root entryCalls defineOrbz()
@neongate-ai/orbz/react-typesOptional React JSX augmentation for the native <orb-z> tagNone
@neongate-ai/orbz/standaloneSelf-contained browser build of the browser entryCalls defineOrbz()
@neongate-ai/orbz/index.cssThe same source stylesheet embedded into the closed shadow rootNone
@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.

react-types contains no React component or runtime adapter. Import it only in React or Next.js TypeScript projects that need JSX awareness of <orb-z>.

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
configFrozen namespace exposing the package constants, including config.ORBZ_STATES
talkFrozen built-in deterministic talk-step catalog
DEFAULT_TALK_FLOWWelcome, ask-name, help, and optional response sequence

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
OrbzTalkStepTyped deterministic or intelligence-backed talk step
OrbzTalkContextIn-memory values captured by the talk runner
OrbzVoiceOptionsOptional voice engine, talk flow, and intelligence configuration
OrbzVoiceEnginePortContract for implementer-provided speech output
OrbzIntelligencePortContract for optional non-deterministic responses
WebSpeechAdapterOptionsLocale, voice preference, rate, pitch, volume, and voice-loading options
OpenAISpeechAdapterOptionsSecure endpoint and OpenAI speech model, voice, instructions, and format options

Speech adapters

ExportPurpose
WebSpeechAdapterBrowser speech synthesis with explicit English locale and voice selection
OpenAISpeechAdapterOpenAI-quality speech through an implementer-owned secure endpoint

OpenAISpeechAdapter defaults to gpt-4o-mini-tts, marin, and MP3. The OpenAI API key stays on the endpoint and is never included in browser code.

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();

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

import { orbzElementClassFactory } from '@neongate-ai/orbz' const constructor = orbzElementClassFactory() // 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