index
@fungi.computer/sprite / index
Type Aliases
Section titled “Type Aliases”AssetPolicy
Section titled “AssetPolicy”AssetPolicy =
object
Host-owned admission and resource limits for published avatar artwork.
Properties
Section titled “Properties”baseURL
Section titled “baseURL”
readonlybaseURL:string
allowedOrigins
Section titled “allowedOrigins”
readonlyallowedOrigins: readonlystring[]
maxBytes
Section titled “maxBytes”
readonlymaxBytes:number
Maximum bytes admitted for one response.
maxTotalBytes
Section titled “maxTotalBytes”
readonlymaxTotalBytes:number
Cumulative bytes admitted across one character selection.
maxRequests
Section titled “maxRequests”
readonlymaxRequests:number
Number of requests admitted for one character selection.
fetch?
Section titled “fetch?”
readonlyoptionalfetch?: typeoffetch
Asset =
object
Decoded transport bytes; adapters use these instead of opening their own URLs.
Properties
Section titled “Properties”
readonlyurl:string
readonlybytes:Uint8Array<ArrayBuffer>>
contentType
Section titled “contentType”
readonlycontentType:string
Control
Section titled “Control”Control =
z.infer<typeofcontrolSchema>>
A validated, character-owned customization control.
Appearance
Section titled “Appearance”Appearance =
Readonly<Record<string,string|number|boolean>>>>
Values saved by the shell; no renderer objects or transient activity.
CharacterDocument
Section titled “CharacterDocument”CharacterDocument =
z.infer<typeofcharacterSchema>>
A portable character, with renderer data still awaiting its native decoder.
CharacterSource
Section titled “CharacterSource”CharacterSource =
string| {local:string; }
A served document URL or a host-installed character key.
AvatarPresentation
Section titled “AvatarPresentation”AvatarPresentation =
object
One complete request. Omitted customization resets to character defaults.
Properties
Section titled “Properties”
readonlysrc:CharacterSource
activity?
Section titled “activity?”
readonlyoptionalactivity?:string
expression?
Section titled “expression?”
readonlyoptionalexpression?:string
appearance?
Section titled “appearance?”
readonlyoptionalappearance?:Appearance
NativePresentation
Section titled “NativePresentation”NativePresentation =
object
The resolved activity and appearance passed to a native renderer.
Properties
Section titled “Properties”activity
Section titled “activity”
readonlyactivity:string
expression
Section titled “expression”
readonlyexpression:string|null
appearance
Section titled “appearance”
readonlyappearance:Appearance
NativePlayer
Section titled “NativePlayer”NativePlayer =
object
The adapter registers native destruction in the selection scope.
Properties
Section titled “Properties”activities
Section titled “activities”
readonlyactivities: readonlystring[]
expressions
Section titled “expressions”
readonlyexpressions: readonlystring[]
Methods
Section titled “Methods”set(
presentation):void
Update the existing native instance.
Parameters
Section titled “Parameters”presentation
Section titled “presentation”Returns
Section titled “Returns”void
pause()
Section titled “pause()”pause(
paused):void
Pause or resume animation without losing the current frame.
Parameters
Section titled “Parameters”paused
Section titled “paused”boolean
Returns
Section titled “Returns”void
RendererContext
Section titled “RendererContext”RendererContext =
object
Native renderer access to the selected document and its admitted assets.
Properties
Section titled “Properties”target
Section titled “target”
readonlytarget:HTMLElement
document
Section titled “document”
readonlydocument:CharacterDocument
signal
Section titled “signal”
readonlysignal:AbortSignal
maxPixels
Section titled “maxPixels”
readonlymaxPixels:number
reportError
Section titled “reportError”
readonlyreportError: (error) =>void
Report a native failure that occurs after the renderer has become ready.
Parameters
Section titled “Parameters”Error
Returns
Section titled “Returns”void
assetURL
Section titled “assetURL”
readonlyassetURL: (reference) =>Effect.Effect<string,Error,Scope.Scope>>
Admit an asset and revoke its object URL when the selection closes.
Parameters
Section titled “Parameters”reference
Section titled “reference”string
Returns
Section titled “Returns”Effect.Effect<string, Error, Scope.Scope>
Renderer
Section titled “Renderer”Renderer = (
context) =>Effect.Effect<NativePlayer,Error,Scope.Scope>>
A native renderer whose resources live in the character selection scope.
Parameters
Section titled “Parameters”context
Section titled “context”Returns
Section titled “Returns”Effect.Effect<NativePlayer, Error, Scope.Scope>
EffectivePresentation
Section titled “EffectivePresentation”EffectivePresentation =
NativePresentation&object
A request after native fallback and appearance validation.
Type Declaration
Section titled “Type Declaration”requestedActivity
Section titled “requestedActivity”
readonlyrequestedActivity:string
requestedExpression
Section titled “requestedExpression”
readonlyrequestedExpression:string|null
fallback
Section titled “fallback”
readonlyfallback:boolean
PlayerState
Section titled “PlayerState”PlayerState = {
status:"empty"|"loading"|"destroyed"; } | {status:"error";error:Error; } | {status:"ready";document:CharacterDocument;presentation:EffectivePresentation;updateError?:Error; }
Observable loading, ready, error, and disposal states.
LocalCharacter
Section titled “LocalCharacter”LocalCharacter =
object
An installed document and its renderer, loaded together by the shell.
Properties
Section titled “Properties”document
Section titled “document”
readonlydocument:CharacterDocument
render
Section titled “render”
readonlyrender:Renderer
SpriteOptions
Section titled “SpriteOptions”SpriteOptions =
object
Host-owned character registry and resource policy.
Properties
Section titled “Properties”assets?
Section titled “assets?”
readonlyoptionalassets?:AssetPolicy
Omit for local-only characters; network access is denied by default.
maxPixels?
Section titled “maxPixels?”
readonlyoptionalmaxPixels?:number
renderers?
Section titled “renderers?”
readonlyoptionalrenderers?:Readonly<Record<string, () =>Promise<{default:Renderer; }>>>
Native adapters allowed for served character documents.
characters?
Section titled “characters?”
readonlyoptionalcharacters?:Readonly<Record<string, () =>Promise<LocalCharacter>>>>>>
Lazy local characters installed by this shell.
AvatarPlayer
Section titled “AvatarPlayer”AvatarPlayer =
object
One mounted avatar; dispose releases its native and browser resources.
Properties
Section titled “Properties”
readonlystate:PlayerState
Current public state.
Methods
Section titled “Methods”subscribe()
Section titled “subscribe()”subscribe(
listener): () =>void
Observe state changes until the returned unsubscribe function is called.
Parameters
Section titled “Parameters”listener
Section titled “listener”(next) => void
Returns
Section titled “Returns”() => void
set(
next):void
Select a source or update its activity and appearance.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
pause()
Section titled “pause()”pause(
value):void
Pause or resume the current native animation.
Parameters
Section titled “Parameters”boolean
Returns
Section titled “Returns”void
dispose()
Section titled “dispose()”dispose():
Promise<void>>
Cancel loading and release the current native selection.
Returns
Section titled “Returns”Promise<void>
SpriteService
Section titled “SpriteService”SpriteService =
object
Stable shell configuration that creates independent mounted players.
Methods
Section titled “Methods”mount()
Section titled “mount()”mount(
target):AvatarPlayer
Claim one DOM host for a new avatar instance.
Parameters
Section titled “Parameters”target
Section titled “target”HTMLElement
Returns
Section titled “Returns”Variables
Section titled “Variables”controlSchema
Section titled “controlSchema”
constcontrolSchema:ZodDiscriminatedUnion<[ZodObject<{type:ZodLiteral<"number">>;label:ZodString;default:ZodNumber;min:ZodNumber;max:ZodNumber;step:ZodOptional<ZodNumber>>; },$strict>>,ZodObject<{type:ZodLiteral<"choice">>;label:ZodString;default:ZodString;options:ZodArray<ZodObject<{value:ZodString;label:ZodString; },$strict>>>>; },$strict>>,ZodObject<{type:ZodLiteral<"color">>;label:ZodString;default:ZodString; },$strict>>,ZodObject<{type:ZodLiteral<"boolean">>;label:ZodString;default:ZodBoolean; },$strict>>],"type">>
Portable editor descriptors; native input bindings belong to each renderer.
characterSchema
Section titled “characterSchema”
constcharacterSchema:ZodObject<{version:ZodLiteral<1>>;name:ZodString;renderer:ZodString;controls:ZodDefault<ZodRecord<ZodString,ZodDiscriminatedUnion<[ZodObject<{type:ZodLiteral<"number">>;label:ZodString;default:ZodNumber;min:ZodNumber;max:ZodNumber;step:ZodOptional<ZodNumber>>; },$strict>>,ZodObject<{type:ZodLiteral<"choice">>;label:ZodString;default:ZodString;options:ZodArray<ZodObject<{value: …;label: …; },$strict>>>>; },$strict>>,ZodObject<{type:ZodLiteral<"color">>;label:ZodString;default:ZodString; },$strict>>,ZodObject<{type:ZodLiteral<"boolean">>;label:ZodString;default:ZodBoolean; },$strict>>],"type">>>>>>;poster:ZodOptional<ZodString>>;data:ZodJSONSchema; },$strict>>
Shared envelope only. The selected adapter must decode data before use.
Functions
Section titled “Functions”resolveAppearance()
Section titled “resolveAppearance()”resolveAppearance(
controls,overrides?):Appearance
Validate the complete appearance before applying any native updates.
Parameters
Section titled “Parameters”controls
Section titled “controls”Readonly<Record<string, Control>>
overrides?
Section titled “overrides?”Appearance = {}
Returns
Section titled “Returns”createSprite()
Section titled “createSprite()”createSprite(
options):SpriteService
Stable shell service; each mounted player owns its own selection.