Class CodeShape
Hierarchy
- Shape
- CodeShape (View Summary)
Index
Accessors
Constructors
Methods
Properties
Accessors
bottom
center
left
right
svgRoot
- get svgRoot(): SVGSVGElement | null
Nearest enclosing
<svg>root, ornullif this shape isn't mounted under one. Used by drag helpers that need world-space cursor coords.Returns SVGSVGElement | null
top
Methods
add
at
attr
Bind one SVG attribute; static sets once, reactive runs as effect.
Parameters
- name: string
- val: Val<string | number>
- target: "intrinsic" | "wrapper" = "intrinsic"
Returns void
attrs
Bind several attributes at once —
this.attrs({ cx, cy, r }).Parameters
- map: Record<string, Val<string | number>>
- target: "intrinsic" | "wrapper" = "intrinsic"
Returns void
boundary
clear
Returns void
cut
Split
partat char offsets into N+1 same-row sub-parts (0 andtext.lengthimplicit). Sub-parts inheritpart.key; returned left-to-right.Parameters
- part: Part
- offsets: readonly number[]
Returns Part[]
dispose
Returns void
effect
Reactive effect torn down with the shape.
Parameters
- fn: () => void
Returns void
group
All parts sharing
key. Returns a fresh array.Parameters
- key: string
Returns Part[]
morphTo
on
Parameters
- name: string
- handler: (e: Event) => void
Optionalopts: AddEventListenerOptions
Returns () => void
paint
Paint syntax highlights: tokenise each row's joined text, route each typed token to a Range in its containing part. Re-entrant (clears prior syntax Ranges; leaves other buckets untouched).
Returns void
remove
Parameters
- ...toRemove: AnyShape[]
Returns void
segments
Stroke segments for the dashed renderer; default = bounding rect.
Returns Segment[]
stroke
- stroke(
opts: CommonOpts,
closed: boolean,
nativeAttrs?: Record<string, Val<string | number>>,
): voidWire stroke / fill / dashed for a stroked shape.
nativeAttrsbinds the shape's native geometry (e.g.{cx, cy, r}for circle); it's skipped whenopts.dashedsince the intrinsic is then a<path>whosedis driven bysegments().Parameters
- opts: CommonOpts
- closed: boolean
OptionalnativeAttrs: Record<string, Val<string | number>>
Returns void
toLocal
Map client coords into this shape's local frame.
Parameters
- evt: { clientX: number; clientY: number }
Returns V
toWorld
Map client coords into the SVG root's frame; stable under rotation (unlike
toLocal). Returns(0, 0)when detached.Parameters
- evt: { clientX: number; clientY: number }
Returns V
track
Register a disposer to run on
dispose().Parameters
- dispose: () => void
Returns void
uncut
Merge same-row contiguous
partsinto one (inherits the leftmost's key). Single part is a no-op; empty throws.Parameters
- parts: readonly Part[]
Returns Part
until
Properties
Readonlyaside
Readonlybox
Local-frame box; reach into .x, .center, .at(u,v), etc.
ReadonlycharW
Monospace char width and line height in CSS pixels.
Readonlyel
Readonlyheight
Optional Readonlyintrinsic
Readonlylanguage
ReadonlylineH
ReadonlylocalFrame
Composed local-frame matrix: T(t) T(p) R(r) S(s) T(-p).
Readonlyopacity
Readonlyorigin
parent
Back-link set by add(); cleared by dispose(). Non-reactive.
Readonlyparts
Flat parts list; morph re-sorts by (row, col) on completion.
Readonlyrotate
Readonlyscale
Readonlysource
Readonlytranslate
Readonlywidth
Readonlywrapper
Host wrapper (position: relative) for the absolute parts.
A Shape rendering monospace source code as a list of
Parts.