@fungi.computer/sprite
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.
Customization
Section titled “Customization”Customization =
z.infer<typeofcustomizationSchema>>
A parsed, saved Sprite customization.
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
renderStyle?
Section titled “renderStyle?”
readonlyoptionalrenderStyle?:RenderStyle
SVG filter drawn over the character; omitted draws it plain.
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”renderStyle
Section titled “renderStyle”
readonlyrenderStyle:RenderStyle
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”RenderStyle
Section titled “RenderStyle”RenderStyle =
z.infer<typeofrenderStyleSchema>>
How a Sprite is drawn over its native renderer.
RenderStyleLayer
Section titled “RenderStyleLayer”RenderStyleLayer =
object
The filter layer owned by one mounted player.
Methods
Section titled “Methods”set(
style,stage):void
Draw stage in style; plain removes the filter.
Parameters
Section titled “Parameters”"plain" | "pencil" | "manga" | "riso" | "halftone" |
"blueprint" | "crt" | "watercolor"
HTMLElement
Returns
Section titled “Returns”void
still()
Section titled “still()”still(
value):void
Hold one still frame: paused, hidden, or reduced motion.
Parameters
Section titled “Parameters”boolean
Returns
Section titled “Returns”void
dispose()
Section titled “dispose()”dispose():
void
Stop the boil and remove the filter and its definitions.
Returns
Section titled “Returns”void
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.
customizationSchema
Section titled “customizationSchema”
constcustomizationSchema:ZodObject<{appearance:ZodOptional<ZodRecord<ZodString,ZodUnion<readonly [ZodString,ZodNumber,ZodBoolean]>>>;renderStyle:ZodDefault<ZodEnum<{plain:"plain";pencil:"pencil";manga:"manga";riso:"riso";halftone:"halftone";blueprint:"blueprint";crt:"crt";watercolor:"watercolor"; }>>; },$strict>>
What a person saves about their Sprite. Hosts parse stored values with this
schema at their boundary; character controls still validate appearance against
the selected document when it is presented.
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.
renderStyles
Section titled “renderStyles”
constrenderStyles: readonly ["plain","pencil","manga","riso","halftone","blueprint","crt","watercolor"]
Render styles: an SVG filter drawn over a mounted Sprite. This module owns the style vocabulary, every filter definition, and the DOM layer that mounts one filter per player with ids unique to that player.
renderStyleSchema
Section titled “renderStyleSchema”
constrenderStyleSchema:ZodEnum<{plain:"plain";pencil:"pencil";manga:"manga";riso:"riso";halftone:"halftone";blueprint:"blueprint";crt:"crt";watercolor:"watercolor"; }>
A saved render style; unknown names fail at the boundary.
renderStyleLabels
Section titled “renderStyleLabels”
constrenderStyleLabels:object
Picker labels for each style, in display order.
Type Declaration
Section titled “Type Declaration”
readonlyplain:"Plain"="Plain"
pencil
Section titled “pencil”
readonlypencil:"Pencil"="Pencil"
readonlymanga:"Manga"="Manga"
readonlyriso:"Riso"="Riso"
halftone
Section titled “halftone”
readonlyhalftone:"Halftone"="Halftone"
blueprint
Section titled “blueprint”
readonlyblueprint:"Blueprint"="Blueprint"
readonlycrt:"CRT"="CRT"
watercolor
Section titled “watercolor”
readonlywatercolor:"Watercolor"="Watercolor"
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.
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”createRenderStyleLayer()
Section titled “createRenderStyleLayer()”createRenderStyleLayer(
host):RenderStyleLayer
Mount a render-style layer in host. The filter applies only to the stage box,
and its boil runs only while the host is on screen and not still.
Parameters
Section titled “Parameters”HTMLElement