Reference · 1,106 exports · mocanvas 4.11.2

@mocanvas/editor

The editor itself — the store, the records, geometry, and everything the UI is built on.

Read out of the type declarations inside the published package, so a name here is a name in the version above — and its description is the one written next to the code.

1106 of 1106

Arc2d

class

A circular arc, given the way SVG gives one: a centre, two endpoints, and the two flags that pick which of the four possible arcs between them is meant.

An array whose every item matches `item`.

Describes how one kind of asset behaves.

The per-editor registry behind `editor.assetUtils` and the `getAssetUtil*` family.

Shapes with `w` and `h` props.

Container behaviour, complete, for a `w`/`h` shape.

Describes how a binding type behaves.

Bounds snapping: aligning a dragged or resized selection's edges and centres with those of the shapes around it.

Box

class

A circle of the given radius, inscribed in its own bounding box.

Turns a stream of pointer presses into double-click events.

One element per shape, for as long as the shape exists.

A single cubic bézier segment: `start` → `end`, shaped by the two control points `cp1` and `cp2`.

A chain of cubic bézier segments, serialized natively rather than flattened.

A validator for an object used as a lookup table: any key the key validator accepts, every value matching the value validator.

Edge2d

class

One straight segment.

Editor

class

A piece of reactive state that belongs to an editor rather than to a module.

The base class for anything that owns subscriptions on behalf of an editor.

An ellipse inscribed in a `width × height` box at the shape's origin.

Catches a render-time throw in its subtree and renders `fallback` instead.

Minimal typed event emitter.

Loads the typefaces the canvas actually needs, and only those.

Base class for shape geometry.

Group2d

class

Several geometries drawn as one shape (e.g.

Handle snapping: finding somewhere for a dragged endpoint to land.

Interns string ids to dense u32 engine handles.

Undo/redo over store diffs.

The editor's input state.

Mat

class

The set of menus that are open, kept in the `instance` session record so it survives tool changes, is visible to anything reading the store, and is reactive: reading `getOpenMenus()` inside a signal re-runs it on every change.

A validator for a plain object with a known set of properties.

The registry of canvas overlays.

Base class for a canvas overlay.

Mirrors the editor's timing events into the browser's own Performance timeline, and collects long-animation-frame reports.

A small, self-contained sink for the editor's own timing events.

Point2d

class

A single point, with a `margin` that gives it something to be hit at.

A closed run of straight segments.

An open run of straight segments.

What the current selection has in common, style by style — the read-only half.

An axis-aligned rectangle, optionally offset from the shape's origin.

The root of the tool tree.

The trails a laser pointer, an eraser or a select brush leaves behind.

Paints shape indicators onto the canvas overlay.

The writable form, used while the shared styles are being computed.

Edge and center snapping against nearby shapes.

A rectangle with fully rounded ends — a pill.

A node in the tool state machine.

A shape prop that is a *style*: shared across shape types, remembered for the next created shape, and editable for a whole selection at once.

Text measurement, as the editor's own manager.

Owns the host's GPU textures: allocates ids, refcounts them by key, loads their pixels asynchronously and uploads them through the current `RenderBackend`.

Holds the themes and the colour mode, reactively.

Timers

class

Per-editor timers.

The registry behind {@link tleditors}.

Another geometry seen through an affine transform.

A discriminated union, dispatched on one property.

Reads preferences with the editor's defaults applied, and writes them back through whoever owns them.

Thrown when a value does not match its validator.

A checked value: `validate` narrows or throws, everything else is built on top of it.

Vec

class

The turn from `fromAngle` to `toAngle` in the given direction: `1` for anti-clockwise, `-1` for clockwise.

animateShape

function

Move a shape to a new position/rotation/opacity over time.

{@link animateShape} for many shapes on one clock, so a group of shapes arrives together rather than drifting apart over the animation.

Apply a patch to a theme, merging `colors` one ramp at a time.

Whether two numbers are equal to within `precision`.

Whether two angles describe the same axis, i.e.

arrayOf

function

An array whose every item matches `item`.

The `sequenceId` under which asset type `type`'s props migrations are registered.

Publishes an {@link TLAssetUrls} map to everything below it.

average

function

The midpoint of two points written for an SVG path `d`.

The `sequenceId` under which binding type `type`'s props migrations are registered.

A rectangle, as the indicator of last resort.

`dpr × min(MAX_TEXTURE_ZOOM, zoom)` snapped up to a power of two, so panning and zooming only re-rasterize a texture when it crosses a bucket boundary.

Whether a binding of `bindingType` may be created between two shapes.

Whether `Path2D` exists in this realm (it does not in Node, or during SSR).

Whether one more shape can be added to the current page.

Whether a whole batch can be added.

canCropShape

function

Whether a shape can enter cropping.

canEditShape

function

Whether a shape can be put into its editing state right now.

An angle brought into `[0, 2π)`, whatever it started as.

Canvas

function

The canvas: a WebGL2 surface driven by the engine, a DOM overlay for shapes that render through `ShapeUtil.component`, a 2D canvas overlay for shape indicators, and an SVG layer for the selection handles, snap lines, the brush — and for …

The centre of the circle through three points, or null when they are collinear and no such circle exists.

clamp

function

Clamp a value into a range.

clampRadians

function

An angle brought into `[0, 2π)`.

The turn from `a0` to `a1` going clockwise (increasing angle), in `[0, 2π)`.

Convert segments whose points are still stored as objects into packed ones.

Publishes `container` to {@link useContainer} and {@link EditorPortal}.

The turn from `a0` to `a1` going anti-clockwise, in `[0, 2π)`.

Migration ids for an asset type, from friendly version names:

Check an asset props migration sequence and hand it back.

The validator for an asset type, from its prop map.

The validator for an asset type, from its props.

Create the synchronous WebGL2 backend.

The fields every asset has whatever its type — everything but `props`.

The counterpart of {@link createBaseShapeValidator} for bindings.

The fields every shape has, whatever its type — everything but `props`.

Migration ids for a binding type; see {@link createShapePropsMigrationIds}.

Check a binding props migration sequence; see {@link createShapePropsMigrationSequence}.

The validator for a binding type, from its `static props`.

Migration ids for an asset type **this library ships**, under {@link BUILTIN_ASSET_MIGRATION_SEQUENCE_PREFIX}.

As {@link createBuiltInShapePropsMigrationIds}, for a built-in binding type.

Migration ids for a shape type **this library ships**, under {@link BUILTIN_SHAPE_MIGRATION_SEQUENCE_PREFIX}.

Wrap a {@link UserStore}'s `resolve` so the same id is not looked up twice.

Build a comment record.

Build a reaction record.

Build a thread record.

A {@link CurrentUser} backed by one atom.

Create a record of a declared custom type, with its defaults filled in.

Mint an id for a custom record of `type`.

Migration ids for a custom record type, from friendly version names:

Check a custom record props migration sequence and hand it back.

The migration sequences for a set of custom record declarations.

Build the `RecordType` for one custom record type.

One `RecordType` covering every declared custom type.

The validator for a custom record type, from its props.

Encode a deep link as a short string.

The store used when an app supplies none: files become `data:` URLs held in memory for the life of the page.

A `UserStore` over a fixed list of people.

Build the signal that says what to broadcast about this client.

The store migration sequences for a set of shape and binding utils.

Build a root state class with the given tools and initial tool id.

createSchema

function

Build the editor's schema.

A signal of the store's current session state.

Migration ids for a shape type, from friendly version names:

Check a props migration sequence and hand it back.

The validator for a shape type, from its `static props`.

createStore

function

Create a store with the editor's record types.

createTheme

function

A theme built on top of the built-in one — the way an app feeds its own design tokens to the canvas:

A {@link CurrentUser} over the persisted preferences above — the editor's `user` prop when an app has no opinion about where preferences live.

Build a store schema from the utils an editor will be given.

createUserId

function

Mint a `user:` id.

createUserPreferences

function · deprecated

Create a `UserPreferences` backed by one session atom.

A `user` record type carrying the app's own fields.

The `sequenceId` under which custom record type `type`'s migrations are registered.

Turn a data URL back into a `File`.

Decode a packed freehand segment path into its points, or `null` when the blob is not in the layout we understand.

The plate behind the page: a flat fill in the theme's canvas colour.

The canvas surface.

A pointer arrow drawn in the editor, with an optional name tag.

What an unhandled error looks like when nothing better is configured: the message, and a button that re-mounts the subtree.

DefaultGrid

function

The grid: one lattice of dots on the document's own grid step, drawn with an SVG pattern in page space.

Drawn in place of one shape whose body threw.

The element a shape's DOM body is rendered into.

The indeterminate progress mark, sized to the text around it.

The document-level `<defs>`: the one place a shape can put a gradient, filter or marker that every instance of it shares.

deselect

function

Remove shapes from the selection, leaving the rest of it alone.

dict

function

An object used as a lookup table: any key, every value matching `value`.

Move `shapes` into `target` (or back onto the page when `target` is `undefined`), through the containers' own hooks.

Copy a page — its shapes, the bindings among them, and its name — and return the new page's id.

The default animation curve: slow at both ends, quick through the middle.

EditorPortal

function

Renders `children` into the editor's container rather than in place.

Publishes an editor to the React tree.

ErrorScreen

function

A full-bleed error surface, for a failure that happened before there was an editor to put a fallback inside of — a store that would not load, a schema that would not migrate.

Read a file as a base64 `data:` URL.

Read a file into a `data:` URL.

The innermost shape that every one of `shapes` sits inside, or `undefined` when they only share the page.

The nearest ancestor of `shape` that `predicate` accepts, or `undefined`.

fontKey

function

Identity of a face for deduplication: two faces are the same request when every descriptor matches.

Render a path as `props.segments.0.x`, the form used in error messages.

The signed sweep of the arc that runs from angle `A` to angle `B` with the given SVG arc flags.

getAssetSrc

function

The `src` an asset carries in its own props, or `null` when it has none yet.

The zoom level that counts as `1` for these constraints in a viewport of this size.

The camera, as custom properties.

The colour names a set of themes defines, as the union of every ramp's palette keys, in the order they were first seen.

One value out of a ramp: the paint a given colour name gets for a given variant.

The shapes the renderer is allowed to skip this frame: off screen *and* willing to be skipped.

The current page's shapes in paint order, without the render metadata — the plain list for anything that only needs "which shapes, in what order".

The current page's shapes in READING order: top to bottom, then left to right, the way a person scans a board.

getCursor

function

The CSS `cursor` value for a cursor record.

The type part of a custom record id, or `undefined` when it is not one.

Build an {@link AssetContext}, filling anything unspecified from {@link DEFAULT_ASSET_CONTEXT}.

The base URL that default asset URLs (icons, fonts, translations) are built from.

The whole of the content: the crop a shape starts out with.

The default resolution of the shared style props.

Read this client's presence state out of the store: the default {@link CreatePresenceStateDerivationOpts.getUserPresence}.

The default properties the built-in `user` record type starts from.

The display values of one shape, as its util resolves them.

The new parent for each shape after a drag, keyed by shape id.

The registered export implementation, or `null` when nothing has registered one.

The focused group's record, or `undefined` when the page is focused.

The container gestures are currently scoped to: a group that has been drilled into, or the current page when none has.

Every font name any registered theme defines, in first-seen order.

Every font face a rich-text document needs, in first-seen order.

The frame-like shape a drag would drop into, or `undefined` for the page.

Mint a brand new set of preferences: a fresh id and a presence colour, and nothing else.

The effective hit radius for the current selection.

A name that is not already taken: `"Page"` becomes `"Page 1"`, then `"Page 2"`, and `"Page 2"` itself becomes `"Page 3"`.

@see IndicatorSource

The `meta` every newly created shape starts with.

The locales to try, most specific first: the locale itself, its base language, then English.

The shape a person means when they press an arrow key from `shape`.

Shapes on the current page that are not on screen — off the edge of the viewport, or clipped away entirely by an ancestor.

The id of the only selected shape, or `null` when zero or many are.

The paint one overlay util draws with, resolved against the live theme.

The document `el` belongs to, falling back to the ambient one.

The window `el` is painted in, falling back to the ambient one.

The session state of every page: what is selected, hovered, being edited or cropped on each one.

Every palette entry of a ramp, in registration order.

A dash pattern that divides evenly into the length it has to cover.

Read a browser pointer event into the fields the editor's dispatch loop wants, in the coordinate space of `container`.

Where the angle `P` falls along the arc from `A` to `B`, as a `t` in `[0, 1]` for a point on the arc and outside it for a point that is not.

The point at angle `a` on the circle of radius `r` about `center`.

`numPoints` points along the arc from `startPoint` to `endPoint`, inclusive.

The vertices of a regular `sides`-gon scaled to exactly fill a `width × height` box, starting at the apex (the `-π/2` angle) and running clockwise.

Every shape on the current page in paint order, with its render metadata.

The topmost SELECTED shape under a page point, or `undefined`.

Screen-space positions of the selection handles for the current selection, or null if nothing is selected / handles are hidden.

The selection's bounds in the selection's OWN rotated frame.

{@link getSelectionRotatedPageBounds} in screen space: the rotated box scaled and offset by the camera, still expressed in its own rotated frame.

The selection's bounds in SCREEN space (window-relative pixels) — where a `position: fixed` toolbar has to be put to sit against the selection.

Just the session half of the current editor state.

Read the session state straight out of a store.

Every id in `ids`, plus every descendant of each of them.

The CSS `clip-path` that cuts a shape down to what its ancestors allow, or `undefined` when nothing clips it.

A shape's drag handles in its own coordinate space, or `undefined` when its util defines none.

The ids of every shape completely inside a page-space box.

getShapeIndicatorNode

function · deprecated

The outline to draw over one shape: whatever its util's `indicator()` returns, or a rectangle around the shape's geometry bounds when the util has no indicator (or returns nothing).

The paths to stroke for one shape, or `undefined` for "this layer draws nothing here".

The part of a shape's page bounds that its clipping ancestors leave visible.

The common page bounds of several shapes, clipping included, or `null` when none of them is visible.

A shape's value for one style prop, or `undefined` when that shape does not carry that style at all.

The opacity of the current selection, as the style panel needs it.

getSnapshot

function

Everything needed to reopen this editor exactly as it is: the document, and where the person using it was.

Style props declared on a ShapeUtil's `static props` map, by prop key.

Rasterise an SVG.

SVG path data through a list of points.

The registered text measure provider, or `null` when nothing has registered one.

The custom properties for one resolved ramp.

The size the content would occupy uncropped, given the shape's current box.

The local person's preferences.

hardReset

function

Throw away this origin's local editor state and reload.

Tear one editor down and hard-reset the origin.

hasAncestor

function

Whether `ancestorId` is somewhere above `shape` in the tree.

hexToRgba

function

Parse `#rrggbb` or `#rrggbbaa` to the engine's `0xRRGGBBAA`.

Is the screen point inside the selection bounds (for dragging the selection as a whole)?

The selection handle under a screen point, if any.

The DOM body of a shape.

idOfType

function

A record id of a given type: `"shape:abc"`, `"page:home"`, ...

idValidator

function

A validator for ids of the record type named by `typeName`.

Where two circles cross.

Where a circle crosses a closed polygon's outline.

Where a circle crosses an open polyline.

Where the segment `a1`→`a2` crosses the circle of radius `r` about `c`, or null when it misses it entirely.

Where the segments `a1`→`a2` and `b1`→`b2` cross, or null if they do not.

Where the segment `a1`→`a2` crosses a closed polygon's outline.

Where the segment `a1`→`a2` crosses an open polyline.

Where a closed polygon's outline crosses the edges of an axis-aligned box.

The convex region common to two convex polygons, or null when they do not overlap.

Whether any ancestor of `shape` is selected.

isAsset

function

isAssetId

function

isBinding

function

isBindingId

function

isCommentId

function

Whether the pointer is currently over the canvas.

Whether `record` is a custom record — optionally, one of a particular type.

Whether `id` is a custom record id — optionally, one of a particular type.

isDocument

function

Whether `record` is the document record.

isFullCrop

function

Whether `crop` hides nothing — the case a util can skip drawing a crop for.

True when a validator accepts `undefined`, i.e.

isPage

function

Whether `record` is a page record.

isPageId

function

Whether a page-space point falls on a shape, honouring what clips it.

Whether `value` is a props migration sequence (as opposed to a store one, or nothing).

isSafeFloat

function

Whether `n` is a number a geometry routine may safely divide by, compare or persist: finite, not `NaN`, and inside the range where a `double` still has enough mantissa left to be meaningful at canvas scale.

isShape

function

Whether the host has hidden this shape.

isShapeId

function

Whether `shape` lives on `pageId` (the current page by default).

isUserId

function

True when `id` is a `user:` id.

isValidProps

function

Whether `value` matches a props map.

Reparent to the page any shape that is no longer inside the container it claims to be in.

lerp

function

Linear blend, the interpolation almost every numeric prop wants.

Whether the segments `A`→`B` and `C`→`D` cross.

literal

function

Exactly one value, compared with `===`.

literalEnum

function

One of a fixed set of values: `T.literalEnum("start", "end")`.

What is on screen while the editor's store and engine are still coming up.

Apply a session snapshot to a store.

loadSnapshot

function

Restore a snapshot, or just its document half.

Walk up from `node` to the first `HTMLElement`, or `null`.

Snap a page-space point to the grid, when grid mode is on.

mixHexColors

function

`amount` of the way from `from` to `to`, per channel.

Provides the merged chrome map and tool/action lists.

model

function

Name a validator so its failures read `At <name>(...): ...` instead of bare.

Move `element` to be the last child of `parent`, preserving its state.

Move shapes — and everything under them — to another page.

Normalize what a util returned into the composed form.

Rewrite loaded records so the shape utils see the props they declare.

Note the kind of pointer that just produced an event.

nullable

function

`T | null`.

object

function

An object with a known set of properties.

openWindow

function

Open a URL through the current {@link runtime}.

optional

function

`T | undefined`.

or

function

Either of two shapes, tried in order.

packShapes

function

Pack shapes into a tight block, in place.

Decode a string produced by {@link createDeepLinkString}.

The perimeter of an ellipse, to Ramanujan's second approximation — accurate to better than a part in ten thousand for any eccentricity a shape can have.

Whether `A` lies inside the closed polygon `points`.

Whether an open polyline touches a closed polygon — either by crossing its outline or by running entirely inside it.

Whether two closed polygons overlap at all — including the case where one is entirely inside the other, which no edge crossing would reveal.

Back out one level of drill-in: focus the focused group's own parent group, or the page when there is none.

precise

function

A point written for an SVG path `d`, rounded to DOM precision.

prefixError

function

Re-throw `error` with `segment` pushed onto the front of its path.

`preventDefault` as a standalone handler, for hanging on an event directly.

The overlap of the ranges `[a0, a1]` and `[b0, b1]`, or null when they do not meet.

refreshPage

function

Reload the page through the current {@link runtime}.

Re-read the reactive environment from the DOM.

Point the colour style props at the names the live themes actually define.

Add a shape util to {@link coreShapes}.

Register a built-in asset type's schema.

Register a built-in binding type's schema.

Register a built-in shape type's schema.

Install the fallback behind `new Editor({ ...

Install the implementation behind `Editor.getSvgString` and `Editor.toImage`.

Make every font named by a registered theme selectable.

Install the measurer behind `Editor.textMeasure`.

Undo a {@link setPointerCapture}.

resizeBox

function

The default resize for a box-shaped shape.

resizeScaled

function

Resize by scaling the whole shape, including whatever `scale` prop it keeps.

Scale and move shapes so their common bounds become `bounds` exactly.

Resolve an asset through `store`, falling back to the asset's own `props.src` when the store has no `resolve` (or when there is no store at all).

A line height in page units, from whatever the theme or a shape gave.

resolveShape

function

Resolve either spelling of a shape reference to a record.

The themes an editor will run with: the built-in `default` plus whatever the app registered, with an app's `default` *replacing* the built-in one.

The display text for `id`, or `id` itself when no dictionary has it.

Flatten a rich-text document to the plain string mocanvas stores in `props.text`.

The handle you are really dragging once the selection is rotated.

sanitizeId

function

Make an arbitrary string usable as a fragment identifier, and prefix it so it cannot start with a digit.

Move the selection one shape in `direction`, keeping it a single selection.

Select the first child of the only selected shape — the inverse of {@link selectParentShape}, and what "enter" does on a selected group.

Select the parents of the selected shapes.

Point {@link getDefaultCdnBaseUrl} somewhere.

Drill into a group, or back out to the page with `null`.

setOf

function

A `Set` whose every member matches `item`.

Set the opacity newly created shapes will start with.

Set the opacity of the selected shapes.

Keep sending this pointer's events to `element` until it is released, even once the pointer leaves the element's box.

Replace some or all of the runtime's side effects.

Replace the local person's preferences, and persist them.

The `sequenceId` under which shape type `type`'s props migrations are registered.

The shortest signed turn from `a0` to `a1`, in `(-π, π]`.

snapAngle

function

Round `r` to the nearest of `segments` evenly spaced angles — what shift-drag does to a rotation.

Stop an event travelling any further up the tree.

Stroke the indicator outline of each shape onto `ctx`.

suffixSafeId

function

Add a suffix to a safe id and keep it safe.

SVGContainer

function

The SVG body of a shape: an `<svg>` filling the shape's bounds, whose user space is the shape's own local coordinate space, so a `<path>` drawn at `(0, 0)` sits at the shape's origin at any pan, zoom or rotation.

Puts an export context in scope.

Turn a custom record type's props migrations into the record-scoped `MigrationSequence` the store applies.

Round to a sensible number of decimal places for the DOM.

toFixed

function

Round `n` to `precision` decimal places, without the float dust that a naive `Math.round(n * 100) / 100` leaves behind.

Turn a props migration sequence into the record-scoped `MigrationSequence` the store applies.

toPrecision

function

Round to a fixed number of decimal places, returning a number.

trackPointer

function

Mirror an editor's page-space pointer into a signal, so {@link createPresenceStateDerivation} can broadcast a cursor that moves.

union

function

A discriminated union: pick the member validator by the value of `key`.

uniq

function

The distinct values of `array`, in first-seen order.

updatePage

function

Change a page's own fields — its name, its `meta`, its index among the other pages.

useActions

function

The UI action list after overrides.

useAssetUrls

function

The asset urls the host configured.

{@link getCameraCssVars} for an editor, tracked reactively.

useColorMode

function

The colour mode the canvas is painting in, resolved: `"system"` has already been turned into `"light"` or `"dark"` by the time it gets here.

useContainer

function

The editor's container element.

The editor's container element, or `null` when there is none.

The theme the canvas is painting with.

Adapt host-owned preferences into the {@link CurrentUser} the editor takes.

Delay the export snapshot until this component says it is ready.

useEditor

function

The editor of the nearest `<EditorProvider>` / `<Canvas>`.

The chrome map after defaults and overrides.

Where floating layers are portalled to.

Register a menu as globally open, so the editor can stand down while it is.

Whether a shape is being cropped — its crop handles are live, so the ordinary resize handles must not be.

useIsEditing

function

Whether a shape is being edited — its text caret is live, so its DOM body takes pointer events.

Whether a tool item is the active one, tracked reactively.

The merged UI context.

Let a wheel event over this element reach the canvas underneath it.

A stable id derived from a name, safe for `url(#…)`.

The export in progress, or `null` when rendering normally.

The ramp the canvas is painting with: the current theme's colours for the current mode.

The theme's custom properties for an editor, tracked reactively — swapping a theme or flipping to dark restamps the container without anything being invalidated by hand.

A schema built from the given utils, memoised.

useTLStore

function

A store built from the given options, memoised.

useTools

function

The UI tool list after overrides.

useTransform

function

Write a page-to-screen transform onto an element.

An id unique to this component instance, safe for `url(#…)`.

The visual viewport's height in CSS pixels.

Check a set of custom record declarations before anything is built from them.

Validate `value` against a props map.

Call `visitor` for every descendant of `parent`, depth first, in draw order.

warnOnce

function

Say something, once, about a mistake the library can see but cannot fix.

The utils an editor should construct: the core ones, then the app's.

AssetContext

interface

How an asset is about to be used, so a store can serve a resolution- or bandwidth-appropriate variant instead of always handing back the original.

AssetStore

interface

The seam between the editor and wherever asset bytes actually live.

What {@link AssetStore.upload} resolves to: where the bytes ended up, plus anything to remember.

B64VecPoint

interface

A point with pen pressure, as freehand strokes record them.

BaseAsset

interface

A document-scoped record describing external media referenced by shapes (images, videos, bookmarks).

BaseBinding

interface

A directed relationship between two shapes (e.g.

BaseEventInfo

interface

BaseShape

interface

One entry in a {@link TextManager.measureHtmlBatch} call.

What a shape is asked before a binding is made between it and another shape.

What the binding's own delete callbacks are told.

The points a shape contributes to bounds snapping.

One point a dragged shape's own points may align to.

What {@link BoundsSnaps.snapResizeShapes} is asked.

What {@link BoundsSnaps.snapTranslateShapes} is asked.

BoxLike

interface

Anything with an `x`, `y`, `w` and `h`.

Camera

interface

CanvasProps

interface

What the manager needs from the editor: a way to find a shape's util.

The half of a shape util this manager needs.

Options for {@link createCachedUserResolve}.

Options for {@link createPresenceStateDerivation}, under the documented name.

The control points of one cubic segment, as a spline stores them.

CurrentUser

interface

A preferences object plus the way to replace it — the editor's `user` prop.

What an app tells `createTLSchema` about one custom record type.

A point of a freehand stroke: position plus pen pressure.

DecomposedMat

interface

The translation, rotation and per-axis scale a transform is made of.

Document$1

interface

DrawOptions

interface

EditorConfig

interface

The editor's option bag.

EditorEvents

interface

EditorInputs

interface

Live pointer and modifier state.

EditorOptions

interface

Props of {@link EditorProvider}.

Options for measuring a block of HTML.

"These gaps are equal." The indicator drawn when a shape is being spaced evenly between others.

Which parts of a shape's geometry a caller wants to see.

Options for {@link getSvgAsImage}.

Where a dragged *handle* may land on this shape.

What {@link HandleSnaps.snapHandle} is asked.

Pixel dimensions and source of an image file.

The two members of a shape util this module cares about.

The subset of a shape util the compositor reads.

Instance

interface

What one other person is doing right now: where their cursor is, what they have selected, which page they are on.

A draw segment as it was stored before the points were packed.

MatLike

interface

The structural form of a {@link Mat}: any object carrying the six components.

Everything the UI hooks read.

OverlayEntry

interface

An overlay paired with the util that produced it.

OverlayHost

interface

What an overlay util needs from the host.

OverlayLike

interface

The minimum an overlay record has to carry for the base class to talk about it without importing {@link TLOverlay} from the editor directory — which would be a cycle, since the overlay manager imports this file.

The half of an overlay util's `options` that concerns paint.

Page

interface

Options for {@link getPerfectDashProps}.

What SVG needs to draw the pattern.

Options for {@link PerformanceApiAdapter}.

What the editor reports about its own work.

PointerSource

interface

Anything that emits editor events and exposes the current pointer — i.e.

PointLike

interface

A page-space point.

"These points are in a line." The indicator drawn when edges or centres align.

PresenceUser

interface

The identity half of a presence record: everything the derivation cannot read off the store because it is about *who* rather than *what they are doing*.

One step of a props migration sequence.

A shape's or binding's props migrations, in version order.

A util as this module needs to see it: a type name and maybe some migrations.

What a props migration sequence is attached to.

PropsSource

interface

What this module needs to know about one util: its type and its props.

Options the record validator factories share.

RenderBackend

interface

A GPU backend that can draw one engine frame.

Bounds a {@link resizeBox} result is clamped to.

ResizeInfo

interface

The font a piece of text is currently in, as the walk carries it down the tree.

The props-and-migrations pair a schema needs for one shape, binding or asset type.

Scribble

interface

ScribbleItem

interface

One live scribble, plus the bookkeeping that fades it out.

How a scribble looks and how it fades.

ShapeHandle

interface

Export-wide settings handed to `ShapeUtil.toSvg` / `toBackgroundSvg`.

What {@link ShapeUtil.configure} may be called on.

The per-util settings bag, read as `util.options` and set with {@link ShapeUtil.configure}.

SnapData

interface

How far a snap moved the thing being dragged.

SnapLine

interface

SnapResult

interface

How the indicators should look.

Props for {@link SvgExportContextProvider}.

SvgExportDef

interface

A `<defs>` entry a shape needs present in the exported SVG — a gradient, a marker, a filter, a pattern.

TextureInfo

interface

ThemeColor

interface

What the manager needs from the editor: a way to find its window.

TickEventInfo

interface

TiptapNode

interface

One node of a rich-text document.

How an animated shape change is paced.

TLAssetUrls

interface

Where an app self-hosts the files the UI loads at runtime.

What {@link AssetUtil.configure} may be called on.

An asset util as an app registers it: the class, not an instance.

Constructor form, as an app registers it.

What the editor requires of an asset util.

The settings an asset util reads.

What every kind of external content carries.

A region the camera is kept over, plus how zoom relates to it.

The matching end of a {@link TLCameraStartPerfEvent}.

Options accepted by every camera move (`setCamera`, `zoomToBounds`, …).

Camera configuration, held on the editor and reachable through `Editor.getCameraOptions()` / `Editor.setCameraOptions()`.

A camera move began, animated or not.

What the `Canvas` component slot is handed.

What is being written to the clipboard, before it is written.

Just enough of a `Window` to follow the system colour scheme.

TLComment

interface

One message in a thread.

One person's reaction to one comment.

A conversation pinned somewhere in the document.

TLComponents

interface

The chrome override map, passed as `components`.

TLContent

interface

A copied selection, whole enough to be pasted into a different document.

TLCropInfo

interface

A crop in progress, handed to {@link ShapeUtil.onCrop}.

TLCursor

interface

The cursor to show, and how far to rotate it.

TLCursorProps

interface

What a {@link TLComponents.CollaboratorCursor} slot is rendered with.

What {@link isCursorInViewport} needs of an editor.

One custom record.

How an editor turns its current state into a link, and back.

One palette entry — every way a single colour name can be painted.

The concrete values a default shape paints with, once its style props have been resolved against a theme and a colour mode.

What {@link getDisplayValues} needs from a shape util: the editor it belongs to, its options (which may carry `getDefaultDisplayValues`) and its optional `getCustomDisplayValues` override.

The facts every drag callback receives.

Shapes have just been dragged over this shape for the first time.

Shapes have been dragged away from this shape.

The props both forms of the editor component accept.

The branch where the component builds the store from what the document needs.

The branch where the host owns the store.

TldrawOptions

interface

The full option bag.

One continuous run of a freehand stroke.

The editor's half of the map: the fonts the canvas loads.

The editor-level component map: the twelve slots `<Canvas>` itself renders.

Options for `Editor.run`.

A document and a person's place in it, saved together.

How an edit was asked for, handed to {@link ShapeUtil.canEdit} so a util can accept some routes into editing and refuse others.

A URL the caller has already decided to embed.

TLEnvironment

interface

Fixed facts about the browser and platform, detected once at load.

A reading that failed.

Failure containment for the editor's React tree.

What an error-fallback slot is rendered with.

TLEventMap

interface

The editor-level notifications, by name, as argument tuples.

A drawing exported from Excalidraw.

An Excalidraw clipboard payload, recognised but not interpreted.

A file something should be made from.

A file dropped onto an existing shape, to replace what that shape shows.

One or more files, from a drop, a paste or a file picker.

TLFontFace

interface

One loadable typeface, in the vocabulary of the CSS `@font-face` rule.

Where the bytes of one font face come from.

One rendered frame.

Options passed to `ShapeUtil.getGeometry` alongside the shape.

Options for `Editor.getShapeAtPoint`.

Props of every registered asset type, keyed by asset type.

Props of every registered binding type, keyed by binding type.

Props of every custom record type an app has registered, keyed by type.

Props of every registered custom shape type, keyed by shape type.

TLGridProps

interface

What the `Grid` slot is rendered with.

TLGridStep

interface

One band of the alignment grid.

What a handle-drag callback is told.

Options for a batch of history-affecting work.

TLHistoryDiff

interface

One recorded change on the undo stack.

TLHistoryMark

interface

A boundary between undo steps.

Options for a raster export (`toImage`, `toImageDataUrl`).

What the compositor needs from the editor.

One indicator, fully resolved: the paths to stroke, the page transform to stroke them under, and the paint to use.

A composed indicator: an outline, an optional hole punched in it, and extra strokes drawn outside that hole.

A 2×3 affine matrix, in the `a b c d e f` order `CanvasRenderingContext2D` takes.

The matching end of a {@link TLInteractionStartPerfEvent}.

A user interaction began: a drag, a resize, a tool gesture.

Options for {@link loadSessionStateSnapshotIntoStore}.

Which halves of a snapshot to take or restore.

What a measurement comes back as.

How a run of text should be laid out before it is measured.

Options for splitting text into positioned spans.

TLMenus

interface

The open-menu registry.

TLOverlay

interface

One thing an overlay wants drawn this frame.

What {@link getOverlayDisplayValues} needs from an overlay util: the editor it belongs to, its options, and its optional override.

A constructor the {@link OverlayManager} can register.

Every timing event by name.

Summary statistics over a window of frame times, in milliseconds.

A frame the browser considered long enough to be worth reporting.

One script attributed to a long animation frame, as the browser reports it.

TLPointer

interface

Where the pointer is, in page space, plus the moment it was last there.

TLPointerInfo

interface

What {@link getPointerInfo} reads off a pointer event.

Options for {@link isPointInShape}.

Environment facts that can change while the page is open.

Built-in palette colours an app has removed, declared by augmenting this interface.

One shape, with everything the renderer needs to place it.

What {@link hardResetEditor} needs of an editor, so this module needs no import cycle.

What {@link getFontsFromRichText} needs of an editor.

TLRuntime

interface

The side effects a host may take over.

Per-page session state worth restoring.

Where one person was looking, independently of the document.

TLShapeCrop

interface

The visible window over a croppable shape's content, in normalized coordinates: `{ topLeft: { x: 0, y: 0 }, bottomRight: { x: 1, y: 1 } }` is the whole thing.

Stroke weights, in CSS pixels — the two numbers `configure` exists to change.

A batch of shape records was created, changed or deleted.

Why a shape is being asked whether it can be laid out.

A `<defs>` entry a shape needs present in the canvas SVG — a gradient, a filter, a marker, a pattern.

What a {@link TLComponents.ShapeWrapper} slot is rendered with.

What every way of building a store has in common: the data to start from and where its asset bytes live.

The schema half: what record types this store may contain.

TLStyledShape

interface

A shape as far as display values are concerned: a props bag, nothing else.

The style props {@link getDefaultDisplayValues} reads, all optional.

What a shape can find out about the export it is being rendered into.

SVG markup, as text.

A preview shown while an upload is still in flight.

Plain or rich text, pasted or dropped.

Plain or rich text found on the clipboard.

TLTextOptions

interface

Rich-text configuration, as an app supplies it.

TLTextSpan

interface

One laid-out run of text, positioned relative to the text block's origin.

TLTheme

interface

A complete theme: both ramps and the metrics that go with them.

TLThemeColors

interface

A full ramp: the palette plus the handful of colours that belong to the surface rather than to any one shape.

TLThemeFont

interface

One selectable typeface: the stack shapes render with, the faces to load, and what the picker shows.

TLThemeHost

interface

What {@link getDisplayValues} reads a theme off.

TLThemePatch

interface

A change to a theme.

TLTime

interface

The process-wide timer registry.

TLTimeContext

interface

The timer API, bound to one context.

A selection copied out of another canvas, in this library's own format.

This library's own format, found on the clipboard and already parsed.

One entry in the UI action list — undo, delete, group, and friends.

TLUiAssetUrls

interface

The UI layer's half: the icons and translation bundles a self-hosting app serves itself.

Editor-side helpers handed to an override callback, so it can build items that do the things the default chrome does without reaching for the DOM.

TLUiOverrides

interface

Rewrite the UI's tool and action lists, passed as `overrides`.

TLUiToolItem

interface

One entry in the UI tool list: everything the chrome needs to draw a tool and to bind its shortcut.

A history step was applied.

How to move the editor's idea of where the pointer is without a real pointer event having arrived.

A URL something should be made *from*, rather than content to place.

A URL, before anything has decided whether it becomes a bookmark or an embed.

Extra flags a {@link TransformedGeometry2d} may override on its source.

TranslateInfo

interface

User

interface

Who somebody *is*, as opposed to what they have configured.

UserPreferences

interface · deprecated

The local person's identity, held in a signal so that renaming or recolouring re-renders anything that shows it.

The local person's settings, as one plain serializable object.

What a schema is told about the `user` record type.

UserStore

interface

Where the editor asks about people.

Validatable

interface

Anything that can check a value and narrow its type: a `Validator`, a `StyleProp`, ...

VecLike

interface

Anything with an `x` and a `y`: the shape almost every API here accepts.

VecLikeJson

interface

Plain `{ x, y }`; kept structural so records stay JSON-serializable.

VecModel

interface

VecModel$1

interface

The serialized form of a {@link Vec}, as it is stored in shape props.

Asset

type

An asset to create: `id` and `meta` are optional, `props` must be complete.

Forget every asset id in `ids`.

The props of asset type `Type`, or the open `object` when that type has not been registered through {@link TLGlobalAssetPropsMap}.

An asset type name: the registered ones, plus any other string.

A binding record.

The props of binding type `Type`, or the open `object` when that type has not been registered through {@link TLGlobalBindingPropsMap}.

A binding type name; see {@link ShapeTypeName}.

A handle name `Box.Resize` and `Box.getHandlePoint` accept.

The serialized form of a {@link Box}, as it is stored in records.

A {@link UserStore.resolve} wrapped in a cache.

The only multi-click the editor reports.

How the canvas picks its palette: an explicit choice, or `"system"` to follow the operating system.

The DOM `Document` / `Window` types under names that cannot be shadowed.

The props of custom record type `Type`, or the open `object` when that type has not been registered.

Supplies an engine to editors constructed without an explicit one.

A built-in shape's outline, described by the numbers that generate it.

The pre-`TL` spelling of {@link TLErrorBoundaryProps}.

Something an asset can be produced from.

Content dropped or pasted onto the canvas.

The registered shape types whose props include `Props`.

Flags

type

The presentation flags every geometry config carries.

A box shape, as far as this base class is concerned.

Which layer owns a util's indicator.

A `Mat` compatible alias, matching the name transforms are usually given.

Props as a migration sees them: whatever was persisted, not yet validated.

The object type a `T.object({...})` config describes.

The keys of `T` that may be omitted.

Keys of an object validator config whose validator also accepts `undefined`.

The options shape of an overlay util that resolves paint from the theme — the common case, and the reason {@link OverlayOptionsWithDisplayValues} is re-exported through this module's barrel next to the class it configures.

PageId

type

How a dashed stroke behaves at one end of an open path.

A props map as the factories accept it: one validator (or {@link StyleProp}) per prop.

The `static props` map of a shape or binding util: one validator per prop of the record it describes.

The props object a `static props` map describes.

One entry of a `static props` map: a validator, or a {@link StyleProp} — which validates too, and additionally makes the prop shared across shapes.

The asset types registered in {@link TLGlobalAssetPropsMap}.

The binding types registered in {@link TLGlobalBindingPropsMap}.

The custom record types registered in {@link TLGlobalRecordPropsMap}.

The shape types registered in {@link TLGlobalShapePropsMap}.

The keys of `T` that a caller has to supply.

RGBA

type

Called for each node while collecting fonts.

The invisible handle just outside a corner that rotates instead of resizing.

SafeId

type

A string that is safe to use as a fragment identifier — i.e.

The type-keyed maps the registries below hold.

A util as the schema reads it: a type name, its `static props` (what the records of that type are validated against) and its `static migrations`.

A handle on one of a box's four corners.

A handle on the middle of one of a box's four sides.

The union of the values of a `const` object or array.

Shape

type

One shape record, with its props resolved from {@link TLGlobalShapePropsMap}.

A shape partial without a required id (id and index are assigned on create).

The props of shape type `Type`, or the open `object` when that type has not been registered through {@link TLGlobalShapePropsMap}.

How a caller may name a shape: by record or by id.

What an SVG export callback may return: a raw markup string (inserted verbatim, so it must be well-formed and escaped by the util) or a React node the exporter serializes.

A shape type name: the registered ones (so editors autocomplete them) and any other string, because a shape type need not be registered to exist.

The patch {@link ShapeUtil.configure} accepts for a given util class: a partial of whatever that class declared as its `static options`, or an open bag for a util that declared none.

A shape that can be cropped: one whose props carry a `crop`.

Something the canvas draws to explain a snap.

Convenience for subclass typing.

The value a {@link StyleProp} carries.

Produces the pixels for a texture.

Anything the GPU can sample as a texture.

A live rich-text editing session, as the host's text stack exposes it.

Where the quick actions (undo, redo, delete, duplicate) render.

A direction for keyboard shape-to-shape movement.

Any asset util constructor, whatever asset type it handles.

Any overlay util constructor, whatever it produces.

A shape that points at an asset.

A shape with `w` and `h` props: the shape {@link resizeBox} knows how to resize.

A patch to an existing binding: the id and type identify it, everything else is optional.

How a zoom level is derived from the constraint bounds and the viewport.

`"idle"` when the camera has settled, `"moving"` while it is in flight.

Called when the current gesture is abandoned — Escape, or a competing gesture.

One of {@link TL_CANVAS_UI_COLOR_TYPES}.

A handler for a synthesised click event.

The click event the manager produces, ready to dispatch.

The names {@link ClickManager} can emit.

Where a click gesture currently is.

The raw clipboard, before the editor has tried to make sense of it.

A resolved colour mode: what the canvas actually paints in.

The colour-mode *setting*.

Where a thread is pinned.

Called when the current gesture is committed — Enter, or a double click that ends it.

The chrome map after mocanvas's defaults have been merged in: every slot present, `null` where it was removed.

A shape to create: like `TLShapePartial`, but the id is optional because the store mints one.

One of {@link TL_CURSOR_TYPES}.

The id of a custom record: `custom:<type>:<unique>`.

A place on a board, in the form a URL can carry.

The asset types this library ships: `image`, `video` and `bookmark`.

The binding types this library ships; see {@link TLDefaultShape}.

Which part of a palette entry to read.

The record types this library ships, as a union.

The shape types this library ships.

Shapes are still being dragged over this shape.

What the editor component accepts: exactly one of the two branches above.

Shapes have been dropped while over this shape.

The name of one of the {@link EASINGS}.

Read for its side effect on the type checker only; keeps `Editor` imported.

Called as a state node becomes active.

A replacement for the editor-wide error screen, or `null` to render nothing at all.

A handler for one entry of {@link TLEventMap}.

Every name a dispatched canvas event can carry.

Called as a state node becomes inactive.

The formats an export can be asked for.

What an asset can be produced from.

One reading of a paste.

The faces of one family, indexed `[style][weight]` — the shape a picker reads a single preview face out of: `DefaultFontFaces["tldraw_serif"]?.normal?.normal`.

How far a request got.

The override point: return only the fields you want to change, or nothing at all to accept the defaults.

The override point: return only the fields to change, or nothing to accept the defaults wholesale.

A shape util's *default* display values: everything the util renders, derived from the shape and the live theme.

How an overlay util resolves its default paint.

The host's hook for hiding shapes without deleting them — layers, filters, a review mode that shows only one author's work.

One of {@link TL_HANDLE_TYPES}.

An entry on the undo or redo stack: either a change or a boundary.

How a batch of changes should be recorded.

Asset utils keyed by asset type.

Binding utils keyed by binding type.

Records of one kind, grouped by their `type` discriminant.

Shape utils (or anything else) keyed by shape type.

Why a shape is showing an indicator.

What `ShapeUtil.getIndicatorPath` may return: a bare `Path2D` (the common case), a composed {@link TLIndicatorPath}, or `undefined` to draw nothing.

The `TL`-spelled name for {@link InstancePresenceId}.

How a shape's props are blended between two versions of it, for {@link ShapeUtil.getInterpolatedProps}.

Called when something outside the tool takes over: a window blur, a programmatic tool change, a store reset.

A keyboard-event handler.

Called once the editor exists.

A shape's opacity: `0` to `1` inclusive.

The documented spelling of {@link OverlayEntry}.

A pinch-event handler.

The three phases of a pinch gesture.

A pointer-event handler, as a tool or shape util declares one.

What a pointer event happened *on*.

What one client broadcasts about itself, minus the record's own identity.

An asset record of type `Type`, with its props resolved from the global map.

The handles a resize can be driven from.

What a resize means for the shape's contents.

The schema an editor store is built on.

One of {@link TL_SCRIBBLE_STATES}.

A replacement for the fallback drawn in place of a single broken shape, or `null` to draw nothing.

The documented name for what {@link ShapeUtil.canBind} is asked.

What the host may say about one shape's visibility.

Opacity shared by the selection: a value, or `"mixed"`, or `undefined`.

What a store listener is handed: the records that changed, and who changed them.

Everything needed to build a store: the data and the schema.

The props an editor store carries.

A store, or the reason there isn't one yet.

The palette: one {@link TLDefaultColor} per style colour name, minus any an app has removed by augmenting {@link TLRemovedDefaultThemeColors}.

CSS font stacks, one per font style prop value.

A theme id.

Every registered theme, by id.

What an app hands in: a partial map, merged over the built-in `default`.

The colours in a ramp that belong to the *surface* rather than to any shape.

Called once per animation frame while the editor is running.

The UI action list, keyed by {@link TLUiActionItem.id}.

A component slot.

Where a UI item was activated from.

Builds the list a `TLUiOverrides` callback starts from.

The UI tool list, keyed by {@link TLUiToolItem.id}.

UI strings by locale, then by string id.

An asset whose type this build does not know.

A wheel-event handler.

TypeOf

type

The type a validator produces.

What a host's analytics hook receives.

The variant table a {@link UnionValidator} is built from: one validator per value of the discriminant.

A custom record whose type is only known at runtime.

How strict the props half of a record validator is about props the map does not declare.

A `static props` map read without knowing the record type — what the base class can say about it.

UserId

type

The id type a `user` record is keyed by, for an app declaring its own.

The type of the {@link T} namespace, for anyone who wants to pass it around.

One step of the path to the value that failed: an object key or an array index.

Font size per size style for an arrow's label, which steps up more gently still: an arrow's text sits on a line rather than in a box, and has no width of its own to grow into.

How an arrow's body is routed.

The arrow binding's props versions.

Shapes an arrow terminal can be drawn as.

The arrowhead drawn at an arrow's end; see {@link ArrowShapeArrowheadStartStyle}.

The arrowhead drawn at an arrow's start.

How an arrow's body is routed: a bowed arc, or axis-aligned elbow legs.

The `sequenceId` prefix of asset type `type`'s props migrations.

An `asset:...` record id.

As {@link rootShapeMigrations}, for the asset record itself.

Per-type validation lives in `../assets/assetValidators` — `imageAssetValidator`, `videoAssetValidator` and `bookmarkAssetValidator`, plus the `assetValidator` union over the three.

Any asset, dispatched on `type`.

The per-type validators, keyed by asset type — handy for a lookup by `asset.type`.

b64Vecs

constant

Encode and decode packed point lists.

The `sequenceId` of binding type `type`'s props migrations.

A binding id: `binding:…`.

The `bookmark` asset's props migrations; see {@link imageAssetMigrations}.

The props of a `bookmark` asset: the unfurled metadata behind a link card.

The unfurled metadata a bookmark asset caches for its card.

A link asset: the unfurled title, description and images behind a bookmark shape.

A box: `{ x, y, w, h }`.

As {@link ASSET_MIGRATION_SEQUENCE_PREFIX}, for asset types **this library ships**.

As {@link BUILTIN_SHAPE_MIGRATION_SEQUENCE_PREFIX}, for built-in bindings.

The prefix for migrations on shapes **this library ships**.

Which theme colour each custom property carries.

How long a collaborator may go without refreshing their presence record before they stop being drawn.

The commenting record types, in the shape `createTLSchema({ records })` expects.

coreShapes

constant

The core shape utils, in registration order.

Bumped when the shape of {@link TLSessionStateSnapshot} changes.

CURSOR_TYPES

constant

Every cursor name, re-exported so a picker can enumerate them without a second import.

The `sequenceId` prefix of a custom record type's props migrations.

The `typeName` every custom record shares.

The context used when nobody supplied one: original quality, no network hints.

The camera options an editor starts with.

Style value unions shared by the default shapes.

The built-in dark ramp.

Which palette token each fill *style* paints with.

CSS stacks per font style — the value a shape's `font` prop resolves to.

Distance between hatch lines, in page units.

Which palette token each fill style draws its *hatch* in, for the styles that have one.

The built-in light ramp.

Line height as a multiple of the font size, shared by every size.

The context used by callers that do not name one.

The id of an empty document's first page.

The v5 defaults: 1.5 CSS px normally, 2.5 for a drop target.

Horizontal alignment of *text inside a text-bearing shape*, as opposed to the alignment of the shape's own label box, which is {@link DEFAULT_H_ALIGNS}.

The built-in theme, registered under the id `default`.

The context id used when a caller does not name one.

The migration sequences for the asset types this library ships.

The props and migrations of the built-in *asset* types.

The props and migrations of the built-in *binding* types.

Every built-in face, keyed by family then `[style][weight]` — the shape a font picker reads one preview face out of:

The CSS stacks per built-in font style, under the documented name.

The props and migrations of the built-in *shape* types.

Alignment of the text *inside* a shape, shared across every text-bearing shape.

Every default, as one object.

What every unset preference resolves to.

A {@link UserStore} over the local preferences: one person, this browser.

DIM_2D

constant

Floats per point in a 2D stroke: `x`, `y`.

DIM_3D

constant

Floats per point in a 3D stroke: `x`, `y`, `z` — where `z` is pen pressure.

DOCUMENT_ID

constant

EASINGS

constant

The easing curves available to camera moves, animated nudges and anything else that tweens.

Where an elbow arrow is allowed to attach when its terminal is bound to a shape: `"none"` keeps the stored point, `"edge"` snaps to the nearest edge, `"center"` to the shape's centre, `"edge-point"` to the nearest point on an edge, `"non…

Where an elbow arrow attaches to the shape its terminal is bound to.

The index a blank document's first page gets.

FONT_SIZES

constant

HALF_PI

constant

A quarter turn in radians.

Half the size of a selection handle's pointer target, in screen pixels.

The `image` asset's props migrations.

The props of an `image` asset: the file, its dimensions, and how to describe it.

`w`, `h`, `src` and the file metadata an image or video asset carries.

A bitmap asset: an image the canvas paints inside an `image` shape.

The validator an image-like shape declares its `crop` prop with.

An {@link AssetStore} that keeps every uploaded file inside the document, as a base64 data URL.

INSTANCE_ID

constant

Font size per size style for a *label* — the text inside a geo shape or on a note, as opposed to a text shape, which is its own text and uses {@link FONT_SIZES}.

LIGHT_THEME

constant

A palette in the spirit of the classic light theme.

How a line shape interpolates between its points.

How a line shape interpolates between its points.

The prefix every key this library writes to web storage carries, so a hard reset can find its own keys and leave the host application's alone.

Largest device-pixel scale a rasterized texture is rendered at.

Largest zoom factor that still increases texture resolution.

A transparent sheet that swallows the click which closes an open menu.

A page id: `page:…`.

A shape's parent: either the page it sits on or the shape (a frame, a group) that contains it.

PI

constant

π.

PI2

constant

A full turn in radians.

Eight colours that stay readable on the canvas background in any order.

As {@link rootShapeMigrations}, for the binding record itself.

Migrations that apply to *every* shape, whatever its type — the record's own fields rather than any type's props.

Which corner each rotate handle sits outside.

runtime

constant

The live runtime.

The `sequenceId` of shape type `type`'s props migrations.

A shape id: `shape:…`.

SIDES

constant

The four sides, in clockwise order starting from the top.

SIN

constant

`Math.sin`, under the name the geometry code refers to it by.

STROKE_SIZES

constant

Stroke widths in page units per size, matching the classic look.

T

constant

The validation library, as one namespace object.

TAB_ID

constant

A stable per-tab identifier.

Colours the canvas chrome is allowed to use.

Every cursor the canvas can show.

What a handle on a shape does.

A scribble's lifecycle.

tleditors

constant

The registry every mounted `Mocanvas` adds itself to.

tlenv

constant

Browser and platform facts, decided at load.

Environment facts that change during a session.

tlmenus

constant

The process-wide open-menu registry.

TLPOINTER_ID

constant

The id of the one pointer record.

tltime

constant

The registry itself.

The edit-start info a caller with no more specific answer passes.

What every unset preference resolves to.

Validates a `user:` id.

Validates a stored preferences object.

Validates a whole `user` record.

Validates a whole `user` record.

A point: `{ x, y }`, optionally with the pressure/z a freehand point carries.

The `video` asset's props migrations; see {@link imageAssetMigrations}.

The props of a `video` asset.

A video asset.

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.