@mocanvas/editor · interface

ShapeUtilOptions

interface ShapeUtilOptions<T extends UnknownShape = UnknownShape, D extends object = TLDefaultDisplayValues>

The per-util settings bag, read as util.options and set with ShapeUtil.configure.

Everything a util wants tunable *without subclassing* goes here — which is what makes GeoShapeUtil.configure({ customGeoTypes }) possible. A util that needs more than the base fields declares its own interface extending this one and re-declares both static options and the instance property with it.


Properties · 1

getDefaultDisplayValues?(editor: unknown, shape: T, theme: TLTheme, colorMode: TLColorMode): D

How this util resolves a shape's style props into the concrete values it paints with. Left undefined, getDisplayValues falls back to the shared default resolution.

Declared as a method rather than as a property of function type on purpose: a util's options are read through the base class, where the shape type is only UnknownShape, and method bivariance is what lets a ShapeUtil<NoteShape> still be handled as a ShapeUtil.

Mentioned here

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.