Class Field<T>

    Type Parameters

    • T
    Hierarchy
    Index

    Constructors

    Methods

    • Step the field by steps GPU passes of frag (which samples the current field as u_src; u_texel = 1/size is provided). One value is committed after the substeps, so the reactive graph sees a single new epoch/frame.

      Parameters

      • frag: string
      • Optionaluniforms: Record<string, number | readonly number[]>
      • steps: number = 1

      Returns void

    • Mean over a sub-rectangle (data pixels, reactive box) as a read-only T cell.

      Parameters

      • box: Val<{ h: number; w: number; x: number; y: number }>

      Returns Read<T>

    • Stamp a Gaussian disc of value at data pixel (x, y), radius r.

      Parameters

      • x: number
      • y: number
      • r: number
      • value: T
      • strength: number = 1

      Returns void

    • Coerce Val<Inner<Cls>>Cls: instance → identity, RO cell → tracked derive, literal → fresh seed.

      Type Parameters

      • C extends AnyCellCtor

      Parameters

      Returns InstanceType<C>

    • Read-only typed view. Cls.derive(parent, fn) (1-input), Cls.derive(parents, fn) (N-input), or Cls.derive(fn) (closure). Polymorphic-this: Vec.derive(...)Vec.

      Type Parameters

      • C extends AnyCellCtor
      • P

      Parameters

      Returns InstanceType<C>

    • Read-only typed view. Cls.derive(parent, fn) (1-input), Cls.derive(parents, fn) (N-input), or Cls.derive(fn) (closure). Polymorphic-this: Vec.derive(...)Vec.

      Type Parameters

      • C extends AnyCellCtor
      • P extends readonly Read<unknown>[]

      Parameters

      • this: C
      • parents: P
      • fn: (vals: ReadValues<P>) => Inner<InstanceType<C>>

      Returns InstanceType<C>

    • Read-only typed view. Cls.derive(parent, fn) (1-input), Cls.derive(parents, fn) (N-input), or Cls.derive(fn) (closure). Polymorphic-this: Vec.derive(...)Vec.

      Type Parameters

      • C extends AnyCellCtor

      Parameters

      • this: C
      • fn: () => Inner<InstanceType<C>>

      Returns InstanceType<C>

    • Type predicate against this class: Vec.is(x) narrows x to Vec. Inherited static; works for any subclass via polymorphic this.

      Type Parameters

      • C extends AnyCellCtor

      Parameters

      • this: C
      • v: unknown

      Returns v is InstanceType<C>

    • Writable lens. Cls.lens(parent, fwd, bwd) for one input, Cls.lens(parents, fwd, bwd) for N; a 2-arg bwd reads the source, a 1-arg bwd reconstructs it. Cls.lens(parent(s), spec) builds a complement-carrying lens from { init, step, fwd, bwd }.

      Type Parameters

      • C extends AnyCellCtor
      • P

      Parameters

      • this: C
      • parent: Read<P>
      • fwd: (v: P) => Inner<InstanceType<C>>
      • bwd: (target: Inner<InstanceType<C>>, v: P) => P

      Returns Writable<InstanceType<C>>

    • Writable lens. Cls.lens(parent, fwd, bwd) for one input, Cls.lens(parents, fwd, bwd) for N; a 2-arg bwd reads the source, a 1-arg bwd reconstructs it. Cls.lens(parent(s), spec) builds a complement-carrying lens from { init, step, fwd, bwd }.

      Type Parameters

      • C extends AnyCellCtor
      • P extends readonly Read<unknown>[]

      Parameters

      • this: C
      • parents: P
      • fwd: (vals: ReadValues<P>) => Inner<InstanceType<C>>
      • bwd: (
            target: Inner<InstanceType<C>>,
            vals: ReadValues<P>,
        ) => BackUpdates<ReadValuesOrSkip<P>>

      Returns Writable<InstanceType<C>>

    • Writable lens. Cls.lens(parent, fwd, bwd) for one input, Cls.lens(parents, fwd, bwd) for N; a 2-arg bwd reads the source, a 1-arg bwd reconstructs it. Cls.lens(parent(s), spec) builds a complement-carrying lens from { init, step, fwd, bwd }.

      Type Parameters

      • C extends AnyCellCtor
      • P
      • Cm

      Parameters

      Returns Writable<InstanceType<C>>

    • Writable lens. Cls.lens(parent, fwd, bwd) for one input, Cls.lens(parents, fwd, bwd) for N; a 2-arg bwd reads the source, a 1-arg bwd reconstructs it. Cls.lens(parent(s), spec) builds a complement-carrying lens from { init, step, fwd, bwd }.

      Type Parameters

      • C extends AnyCellCtor
      • P extends readonly Read<unknown>[]
      • Cm

      Parameters

      Returns Writable<InstanceType<C>>

    • Writable-shaped constant: always reads v, absorbs writes (parentless sink lens), for APIs demanding bidirectionality.

      Type Parameters

      • C extends AnyCellCtor

      Parameters

      Returns Writable<InstanceType<C>>

    Properties

    _t: { equals: (a: FieldVal, b: FieldVal) => boolean }
    kind: FieldKind<T>
    name: string | undefined

    Optional debug label (cell(0, { name })); used by errors and graph dumps.

    value: FieldVal
    traits: { equals: (a: FieldVal, b: FieldVal) => boolean } = ...