Capability first · transport second

ComponentContracts.js

Owns normalized configuration/value contracts and shared explicit STT activation behavior for chart, dashboard, Markdown, and voice components.

SDK 0.5.18Runtime 0.8.12Protocol arcane/1
On this page

Overview

Owns normalized configuration/value contracts and shared explicit STT activation behavior for chart, dashboard, Markdown, and voice components.

  • Artifact
    ComponentContracts.js · esm
  • Classification
    public first party
  • Availability
    Cross-host with an injected event constructor outside DOM hosts
  • Normalization
    Fully normalized labels, rows, definitions, visibility, formats, editor and voice options, plus capability-neutral STT activation intent and presentation state. Complete finite progress measures remain visible, including fractional and over-total values.

Import and lifecycle

JavaScript
import * as module from '/arcane/modules/ComponentContracts.js';

Normalization and formatting helpers are pure. createSTTActivationController installs one button listener, publishes and projects activation request or error events, invokes the configured host activation callback, reports presentation changes through onChange, and destroy removes the listener and disposes only an event source it created.

Application-facing behavior: Constant sets plus normalization, complete finite-progress formatting, and explicit STT activation helpers.

Protocol and host implementation

In-process only This detail does not widen the application-facing API or grant authority.

Exports, signatures, parameters, and results

BindingFormDeclaration or signatureParameter syntax
CHART_LABELSvariable · valuevariable CHART_LABELS
DASHBOARD_LABELSvariable · valuevariable DASHBOARD_LABELS
MARKDOWN_FORMATSvariable · valuevariable MARKDOWN_FORMATS
MARKDOWN_LABELSvariable · valuevariable MARKDOWN_LABELS
STT_ACTIVATION_ERROR_CODESvariable · valuevariable STT_ACTIVATION_ERROR_CODES
STT_ACTIVATION_EVENT_TYPESvariable · valuevariable STT_ACTIVATION_EVENT_TYPES
STT_ACTIVATION_REASONSvariable · valuevariable STT_ACTIVATION_REASONS
VOICE_LABELSvariable · valuevariable VOICE_LABELS
VOICE_MESSAGESvariable · valuevariable VOICE_MESSAGES
appendTranscriptionfunctionfunction appendTranscription(current='',segment='',separator='\n\n')current='',segment='',separator='\n\n'
applyMarkdownFormatfunctionfunction applyMarkdownFormat(value='',selectionStart=0,selectionEnd=selectionStart,format={})value='',selectionStart=0,selectionEnd=selectionStart,format={}
createSTTActivationControllerfunctionfunction createSTTActivationController({ host, button, onChange, EventClass=globalThis.CustomEvent, eventSource=null }){ host, button, onChange, EventClass=globalThis.CustomEvent, eventSource=null }
effectiveDashboardVisibilityfunctionfunction effectiveDashboardVisibility(definitions=[],visibility={})definitions=[],visibility={}
formatAIRuntimeProgressfunctionfunction formatAIRuntimeProgress(progress,fallback)progress,fallback
normalizeChartOptionsfunctionfunction normalizeChartOptions(input={},previous={})input={},previous={}
normalizeChartRowsfunctionfunction normalizeChartRows(data=[],options={})data=[],options={}
normalizeDashboardDefinitionsfunctionfunction normalizeDashboardDefinitions(values=[])values=[]
normalizeDashboardOptionsfunctionfunction normalizeDashboardOptions(input={},previous={})input={},previous={}
normalizeDashboardVisibilityfunctionfunction normalizeDashboardVisibility(values={})values={}
normalizeMarkdownFormatsfunctionfunction normalizeMarkdownFormats(values=MARKDOWN_FORMATS)values=MARKDOWN_FORMATS
normalizeMarkdownOptionsfunctionfunction normalizeMarkdownOptions(input={},previous={})input={},previous={}
normalizeVoiceOptionsfunctionfunction normalizeVoiceOptions(input={},previous={})input={},previous={}

Parameter meanings and results

Normalizers cover chart options and rows, dashboard definitions, options, and visibility, Markdown formats and options, and voice options. applyMarkdownFormat and appendTranscription return deterministic editor text and selection results. formatAIRuntimeProgress(progress,fallback) preserves complete finite completed/total measures, including fractional and over-total values, when total is positive and unit is nonempty; otherwise it returns the phase or fallback. createSTTActivationController({host,button,onChange,EventClass,eventSource}) returns mutable action, error, label, pending, selected, status, title, and visible getters plus request(action), synchronize(role), and destroy().

Events, side effects, and errors

Source-literal CustomEvent dispatches

No source-literal CustomEvent dispatch is part of this artifact.

Lifecycle and event flow

  • emits speech-stt-activation-request
  • emits speech-stt-activation-error

Direct coded failures

This artifact directly assigns no stable coded failure.

Exported Error subclasses

This artifact exports no Error subclass.

Documented failure behavior

  • TypeError or RangeError for invalid normalized records, values, callbacks, or chart bounds
  • ARCANE_STT_ACTIVATION_BUTTON_INVALID
  • ARCANE_STT_ACTIVATION_BUTTON_LISTENER_FAILED
  • ARCANE_STT_ACTIVATION_DOM_PROJECTION_UNAVAILABLE
  • ARCANE_STT_ACTIVATION_EVENT_CLASS_INVALID
  • ARCANE_STT_ACTIVATION_EVENT_SOURCE_INVALID
  • ARCANE_STT_ACTIVATION_HOST_INVALID
  • ARCANE_STT_ACTIVATION_ON_CHANGE_INVALID
  • ARCANE_STT_ACTIVATION_PRESENTATION_CALLBACK_FAILED
  • ARCANE_STT_ACTIVATION_REQUEST_REJECTED

Availability and capabilities

Cross-host with an injected event constructor outside DOM hosts. Fully normalized labels, rows, definitions, visibility, formats, editor and voice options, plus capability-neutral STT activation intent and presentation state. Complete finite progress measures remain visible, including fractional and over-total values.

Shared normalized value and explicit STT activation presentation layer for browser components. The configured host remains the lifecycle authority; this module implements no privileged Core service.

Contract example

JavaScript
import {normalizeChartRows} from '/arcane/modules/ComponentContracts.js';

const rows=normalizeChartRows([
    {date:'2026-08-24T00:00:00Z',value:3}
]);
console.log(rows);

No direct Core call is claimed for this artifact. Any injected provider or consuming module retains its own documented authority.