d750da8f40
This PR is a significant rewrite of our selection / hit testing logic. It - replaces our current geometric helpers (`getBounds`, `getOutline`, `hitTestPoint`, and `hitTestLineSegment`) with a new geometry API - moves our hit testing entirely to JS using geometry - improves selection logic, especially around editing shapes, groups and frames - fixes many minor selection bugs (e.g. shapes behind frames) - removes hit-testing DOM elements from ShapeFill etc. - adds many new tests around selection - adds new tests around selection - makes several superficial changes to surface editor APIs This PR is hard to evaluate. The `selection-omnibus` test suite is intended to describe all of the selection behavior, however all existing tests are also either here preserved and passing or (in a few cases around editing shapes) are modified to reflect the new behavior. ## Geometry All `ShapeUtils` implement `getGeometry`, which returns a single geometry primitive (`Geometry2d`). For example: ```ts class BoxyShapeUtil { getGeometry(shape: BoxyShape) { return new Rectangle2d({ width: shape.props.width, height: shape.props.height, isFilled: true, margin: shape.props.strokeWidth }) } } ``` This geometric primitive is used for all bounds calculation, hit testing, intersection with arrows, etc. There are several geometric primitives that extend `Geometry2d`: - `Arc2d` - `Circle2d` - `CubicBezier2d` - `CubicSpline2d` - `Edge2d` - `Ellipse2d` - `Group2d` - `Polygon2d` - `Rectangle2d` - `Stadium2d` For shapes that have more complicated geometric representations, such as an arrow with a label, the `Group2d` can accept other primitives as its children. ## Hit testing Previously, we did all hit testing via events set on shapes and other elements. In this PR, I've replaced those hit tests with our own calculation for hit tests in JavaScript. This removed the need for many DOM elements, such as hit test area borders and fills which only existed to trigger pointer events. ## Selection We now support selecting "hollow" shapes by clicking inside of them. This involves a lot of new logic but it should work intuitively. See `Editor.getShapeAtPoint` for the (thoroughly commented) implementation. ![Kapture 2023-07-23 at 23 27 27](https://github.com/tldraw/tldraw/assets/23072548/a743275c-acdb-42d9-a3fe-b3e20dce86b6) every sunset is actually the sun hiding in fear and respect of tldraw's quality of interactions This PR also fixes several bugs with scribble selection, in particular around the shift key modifier. ![Kapture 2023-07-24 at 23 34 07](https://github.com/tldraw/tldraw/assets/23072548/871d67d0-8d06-42ae-a2b2-021effba37c5) ...as well as issues with labels and editing. There are **over 100 new tests** for selection covering groups, frames, brushing, scribbling, hovering, and editing. I'll add a few more before I feel comfortable merging this PR. ## Arrow binding Using the same "hollow shape" logic as selection, arrow binding is significantly improved. ![Kapture 2023-07-22 at 07 46 25](https://github.com/tldraw/tldraw/assets/23072548/5aa724b3-b57d-4fb7-92d0-80e34246753c) a thousand wise men could not improve on this ## Moving focus between editing shapes Previously, this was handled in the `editing_shapes` state. This is moved to `useEditableText`, and should generally be considered an advanced implementation detail on a shape-by-shape basis. This addresses a bug that I'd never noticed before, but which can be reproduced by selecting an shape—but not focusing its input—while editing a different shape. Previously, the new shape became the editing shape but its input did not focus. ![Kapture 2023-07-23 at 23 19 09](https://github.com/tldraw/tldraw/assets/23072548/a5e157fb-24a8-42bd-a692-04ce769b1a9c) In this PR, you can select a shape by clicking on its edge or body, or select its input to transfer editing / focus. ![Kapture 2023-07-23 at 23 22 21](https://github.com/tldraw/tldraw/assets/23072548/7384e7ea-9777-4e1a-8f63-15de2166a53a) tldraw, glorious tldraw ### Change Type - [x] `major` — Breaking change ### Test Plan 1. Erase shapes 2. Select shapes 3. Calculate their bounding boxes - [ ] Unit Tests // todo - [ ] End to end tests // todo ### Release Notes - [editor] Remove `ShapeUtil.getBounds`, `ShapeUtil.getOutline`, `ShapeUtil.hitTestPoint`, `ShapeUtil.hitTestLineSegment` - [editor] Add `ShapeUtil.getGeometry` - [editor] Add `Editor.getShapeGeometry`
1246 lines
37 KiB
Markdown
1246 lines
37 KiB
Markdown
## API Report File for "@tldraw/tlschema"
|
|
|
|
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
|
|
```ts
|
|
|
|
import { BaseRecord } from '@tldraw/store';
|
|
import { Expand } from '@tldraw/utils';
|
|
import { JsonObject } from '@tldraw/utils';
|
|
import { Migrations } from '@tldraw/store';
|
|
import { RecordId } from '@tldraw/store';
|
|
import { RecordType } from '@tldraw/store';
|
|
import { SerializedStore } from '@tldraw/store';
|
|
import { Signal } from '@tldraw/state';
|
|
import { Store } from '@tldraw/store';
|
|
import { StoreSchema } from '@tldraw/store';
|
|
import { T } from '@tldraw/validate';
|
|
import { UnknownRecord } from '@tldraw/store';
|
|
|
|
// @public (undocumented)
|
|
export const ArrowShapeArrowheadEndStyle: EnumStyleProp<"arrow" | "bar" | "diamond" | "dot" | "inverted" | "none" | "pipe" | "square" | "triangle">;
|
|
|
|
// @public (undocumented)
|
|
export const ArrowShapeArrowheadStartStyle: EnumStyleProp<"arrow" | "bar" | "diamond" | "dot" | "inverted" | "none" | "pipe" | "square" | "triangle">;
|
|
|
|
// @internal (undocumented)
|
|
export const arrowShapeMigrations: Migrations;
|
|
|
|
// @public (undocumented)
|
|
export const arrowShapeProps: {
|
|
labelColor: EnumStyleProp<"black" | "blue" | "green" | "grey" | "light-blue" | "light-green" | "light-red" | "light-violet" | "orange" | "red" | "violet" | "yellow">;
|
|
color: EnumStyleProp<"black" | "blue" | "green" | "grey" | "light-blue" | "light-green" | "light-red" | "light-violet" | "orange" | "red" | "violet" | "yellow">;
|
|
fill: EnumStyleProp<"none" | "pattern" | "semi" | "solid">;
|
|
dash: EnumStyleProp<"dashed" | "dotted" | "draw" | "solid">;
|
|
size: EnumStyleProp<"l" | "m" | "s" | "xl">;
|
|
arrowheadStart: EnumStyleProp<"arrow" | "bar" | "diamond" | "dot" | "inverted" | "none" | "pipe" | "square" | "triangle">;
|
|
arrowheadEnd: EnumStyleProp<"arrow" | "bar" | "diamond" | "dot" | "inverted" | "none" | "pipe" | "square" | "triangle">;
|
|
font: EnumStyleProp<"draw" | "mono" | "sans" | "serif">;
|
|
start: T.UnionValidator<"type", {
|
|
binding: T.ObjectValidator<{
|
|
type: "binding";
|
|
boundShapeId: TLShapeId;
|
|
normalizedAnchor: Vec2dModel;
|
|
isExact: boolean;
|
|
}>;
|
|
point: T.ObjectValidator<{
|
|
type: "point";
|
|
x: number;
|
|
y: number;
|
|
}>;
|
|
}, never>;
|
|
end: T.UnionValidator<"type", {
|
|
binding: T.ObjectValidator<{
|
|
type: "binding";
|
|
boundShapeId: TLShapeId;
|
|
normalizedAnchor: Vec2dModel;
|
|
isExact: boolean;
|
|
}>;
|
|
point: T.ObjectValidator<{
|
|
type: "point";
|
|
x: number;
|
|
y: number;
|
|
}>;
|
|
}, never>;
|
|
bend: T.Validator<number>;
|
|
text: T.Validator<string>;
|
|
};
|
|
|
|
// @public
|
|
export const assetIdValidator: T.Validator<TLAssetId>;
|
|
|
|
// @internal (undocumented)
|
|
export const assetMigrations: Migrations;
|
|
|
|
// @public (undocumented)
|
|
export const AssetRecordType: RecordType<TLAsset, "props" | "type">;
|
|
|
|
// @internal (undocumented)
|
|
export const assetValidator: T.Validator<TLAsset>;
|
|
|
|
// @internal (undocumented)
|
|
export const bookmarkShapeMigrations: Migrations;
|
|
|
|
// @public (undocumented)
|
|
export const bookmarkShapeProps: {
|
|
w: T.Validator<number>;
|
|
h: T.Validator<number>;
|
|
assetId: T.Validator<TLAssetId | null>;
|
|
url: T.Validator<string>;
|
|
};
|
|
|
|
// @public
|
|
export interface Box2dModel {
|
|
// (undocumented)
|
|
h: number;
|
|
// (undocumented)
|
|
w: number;
|
|
// (undocumented)
|
|
x: number;
|
|
// (undocumented)
|
|
y: number;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export const box2dModelValidator: T.Validator<Box2dModel>;
|
|
|
|
// @public (undocumented)
|
|
export const CameraRecordType: RecordType<TLCamera, never>;
|
|
|
|
// @public
|
|
export const canvasUiColorTypeValidator: T.Validator<"accent" | "black" | "laser" | "muted-1" | "selection-fill" | "selection-stroke" | "white">;
|
|
|
|
// @internal (undocumented)
|
|
export function CLIENT_FIXUP_SCRIPT(persistedStore: SerializedStore<TLRecord>): SerializedStore<TLRecord>;
|
|
|
|
// @public
|
|
export function createAssetValidator<Type extends string, Props extends JsonObject>(type: Type, props: T.Validator<Props>): T.ObjectValidator<{
|
|
id: TLAssetId;
|
|
typeName: 'asset';
|
|
type: Type;
|
|
props: Props;
|
|
meta: JsonObject;
|
|
}>;
|
|
|
|
// @public (undocumented)
|
|
export const createPresenceStateDerivation: ($user: Signal<{
|
|
id: string;
|
|
color: string;
|
|
name: string;
|
|
}>, instanceId?: TLInstancePresence['id']) => (store: TLStore) => Signal<null | TLInstancePresence>;
|
|
|
|
// @public (undocumented)
|
|
export function createShapeId(id?: string): TLShapeId;
|
|
|
|
// @public (undocumented)
|
|
export function createShapeValidator<Type extends string, Props extends JsonObject, Meta extends JsonObject>(type: Type, props?: {
|
|
[K in keyof Props]: T.Validatable<Props[K]>;
|
|
}, meta?: {
|
|
[K in keyof Meta]: T.Validatable<Meta[K]>;
|
|
}): T.ObjectValidator<TLBaseShape<Type, Props>>;
|
|
|
|
// @public
|
|
export function createTLSchema({ shapes }: {
|
|
shapes: Record<string, SchemaShapeInfo>;
|
|
}): TLSchema;
|
|
|
|
// @public (undocumented)
|
|
export const DefaultColorStyle: EnumStyleProp<"black" | "blue" | "green" | "grey" | "light-blue" | "light-green" | "light-red" | "light-violet" | "orange" | "red" | "violet" | "yellow">;
|
|
|
|
// @public (undocumented)
|
|
export const DefaultColorThemePalette: {
|
|
lightMode: TLDefaultColorTheme;
|
|
darkMode: TLDefaultColorTheme;
|
|
};
|
|
|
|
// @public (undocumented)
|
|
export const DefaultDashStyle: EnumStyleProp<"dashed" | "dotted" | "draw" | "solid">;
|
|
|
|
// @public (undocumented)
|
|
export const DefaultFillStyle: EnumStyleProp<"none" | "pattern" | "semi" | "solid">;
|
|
|
|
// @public (undocumented)
|
|
export const DefaultFontFamilies: {
|
|
draw: string;
|
|
sans: string;
|
|
serif: string;
|
|
mono: string;
|
|
};
|
|
|
|
// @public (undocumented)
|
|
export const DefaultFontStyle: EnumStyleProp<"draw" | "mono" | "sans" | "serif">;
|
|
|
|
// @public (undocumented)
|
|
export const DefaultHorizontalAlignStyle: EnumStyleProp<"end-legacy" | "end" | "middle-legacy" | "middle" | "start-legacy" | "start">;
|
|
|
|
// @public (undocumented)
|
|
export const DefaultSizeStyle: EnumStyleProp<"l" | "m" | "s" | "xl">;
|
|
|
|
// @public (undocumented)
|
|
export const DefaultVerticalAlignStyle: EnumStyleProp<"end" | "middle" | "start">;
|
|
|
|
// @public (undocumented)
|
|
export const DocumentRecordType: RecordType<TLDocument, never>;
|
|
|
|
// @internal (undocumented)
|
|
export const drawShapeMigrations: Migrations;
|
|
|
|
// @public (undocumented)
|
|
export const drawShapeProps: {
|
|
color: EnumStyleProp<"black" | "blue" | "green" | "grey" | "light-blue" | "light-green" | "light-red" | "light-violet" | "orange" | "red" | "violet" | "yellow">;
|
|
fill: EnumStyleProp<"none" | "pattern" | "semi" | "solid">;
|
|
dash: EnumStyleProp<"dashed" | "dotted" | "draw" | "solid">;
|
|
size: EnumStyleProp<"l" | "m" | "s" | "xl">;
|
|
segments: T.ArrayOfValidator<{
|
|
type: "free" | "straight";
|
|
points: Vec2dModel[];
|
|
}>;
|
|
isComplete: T.Validator<boolean>;
|
|
isClosed: T.Validator<boolean>;
|
|
isPen: T.Validator<boolean>;
|
|
};
|
|
|
|
// @public (undocumented)
|
|
export const EMBED_DEFINITIONS: readonly [{
|
|
readonly type: "tldraw";
|
|
readonly title: "tldraw";
|
|
readonly hostnames: readonly ["beta.tldraw.com", "lite.tldraw.com", "www.tldraw.com"];
|
|
readonly minWidth: 300;
|
|
readonly minHeight: 300;
|
|
readonly width: 720;
|
|
readonly height: 500;
|
|
readonly doesResize: true;
|
|
readonly canUnmount: true;
|
|
readonly toEmbedUrl: (url: string) => string | undefined;
|
|
readonly fromEmbedUrl: (url: string) => string | undefined;
|
|
}, {
|
|
readonly type: "codesandbox";
|
|
readonly title: "CodeSandbox";
|
|
readonly hostnames: readonly ["codesandbox.io"];
|
|
readonly minWidth: 300;
|
|
readonly minHeight: 300;
|
|
readonly width: 720;
|
|
readonly height: 500;
|
|
readonly doesResize: true;
|
|
readonly canUnmount: false;
|
|
readonly toEmbedUrl: (url: string) => string | undefined;
|
|
readonly fromEmbedUrl: (url: string) => string | undefined;
|
|
}, {
|
|
readonly type: "codepen";
|
|
readonly title: "Codepen";
|
|
readonly hostnames: readonly ["codepen.io"];
|
|
readonly minWidth: 300;
|
|
readonly minHeight: 300;
|
|
readonly width: 520;
|
|
readonly height: 400;
|
|
readonly doesResize: true;
|
|
readonly canUnmount: false;
|
|
readonly toEmbedUrl: (url: string) => string | undefined;
|
|
readonly fromEmbedUrl: (url: string) => string | undefined;
|
|
}, {
|
|
readonly type: "scratch";
|
|
readonly title: "Scratch";
|
|
readonly hostnames: readonly ["scratch.mit.edu"];
|
|
readonly width: 520;
|
|
readonly height: 400;
|
|
readonly doesResize: false;
|
|
readonly canUnmount: false;
|
|
readonly toEmbedUrl: (url: string) => string | undefined;
|
|
readonly fromEmbedUrl: (url: string) => string | undefined;
|
|
}, {
|
|
readonly type: "youtube";
|
|
readonly title: "YouTube";
|
|
readonly hostnames: readonly ["*.youtube.com", "youtube.com", "youtu.be"];
|
|
readonly width: 800;
|
|
readonly height: 450;
|
|
readonly doesResize: true;
|
|
readonly canUnmount: false;
|
|
readonly overridePermissions: {
|
|
readonly 'allow-presentation': true;
|
|
};
|
|
readonly isAspectRatioLocked: true;
|
|
readonly toEmbedUrl: (url: string) => string | undefined;
|
|
readonly fromEmbedUrl: (url: string) => string | undefined;
|
|
}, {
|
|
readonly type: "figma";
|
|
readonly title: "Figma";
|
|
readonly hostnames: readonly ["figma.com"];
|
|
readonly width: 720;
|
|
readonly height: 500;
|
|
readonly doesResize: true;
|
|
readonly canUnmount: true;
|
|
readonly toEmbedUrl: (url: string) => string | undefined;
|
|
readonly fromEmbedUrl: (url: string) => string | undefined;
|
|
}, {
|
|
readonly type: "google_maps";
|
|
readonly title: "Google Maps";
|
|
readonly hostnames: readonly ["google.*"];
|
|
readonly width: 720;
|
|
readonly height: 500;
|
|
readonly doesResize: true;
|
|
readonly canUnmount: false;
|
|
readonly toEmbedUrl: (url: string) => string | undefined;
|
|
readonly fromEmbedUrl: (url: string) => string | undefined;
|
|
}, {
|
|
readonly type: "google_calendar";
|
|
readonly title: "Google Calendar";
|
|
readonly hostnames: readonly ["calendar.google.*"];
|
|
readonly width: 720;
|
|
readonly height: 500;
|
|
readonly minWidth: 460;
|
|
readonly minHeight: 360;
|
|
readonly doesResize: true;
|
|
readonly canUnmount: false;
|
|
readonly instructionLink: "https://support.google.com/calendar/answer/41207?hl=en";
|
|
readonly toEmbedUrl: (url: string) => string | undefined;
|
|
readonly fromEmbedUrl: (url: string) => string | undefined;
|
|
}, {
|
|
readonly type: "google_slides";
|
|
readonly title: "Google Slides";
|
|
readonly hostnames: readonly ["docs.google.*"];
|
|
readonly width: 720;
|
|
readonly height: 500;
|
|
readonly minWidth: 460;
|
|
readonly minHeight: 360;
|
|
readonly doesResize: true;
|
|
readonly canUnmount: false;
|
|
readonly toEmbedUrl: (url: string) => string | undefined;
|
|
readonly fromEmbedUrl: (url: string) => string | undefined;
|
|
}, {
|
|
readonly type: "github_gist";
|
|
readonly title: "GitHub Gist";
|
|
readonly hostnames: readonly ["gist.github.com"];
|
|
readonly width: 720;
|
|
readonly height: 500;
|
|
readonly doesResize: true;
|
|
readonly canUnmount: true;
|
|
readonly toEmbedUrl: (url: string) => string | undefined;
|
|
readonly fromEmbedUrl: (url: string) => string | undefined;
|
|
}, {
|
|
readonly type: "replit";
|
|
readonly title: "Replit";
|
|
readonly hostnames: readonly ["replit.com"];
|
|
readonly width: 720;
|
|
readonly height: 500;
|
|
readonly doesResize: true;
|
|
readonly canUnmount: false;
|
|
readonly toEmbedUrl: (url: string) => string | undefined;
|
|
readonly fromEmbedUrl: (url: string) => string | undefined;
|
|
}, {
|
|
readonly type: "felt";
|
|
readonly title: "Felt";
|
|
readonly hostnames: readonly ["felt.com"];
|
|
readonly width: 720;
|
|
readonly height: 500;
|
|
readonly doesResize: true;
|
|
readonly canUnmount: false;
|
|
readonly toEmbedUrl: (url: string) => string | undefined;
|
|
readonly fromEmbedUrl: (url: string) => string | undefined;
|
|
}, {
|
|
readonly type: "spotify";
|
|
readonly title: "Spotify";
|
|
readonly hostnames: readonly ["open.spotify.com"];
|
|
readonly width: 720;
|
|
readonly height: 500;
|
|
readonly minHeight: 500;
|
|
readonly overrideOutlineRadius: 12;
|
|
readonly doesResize: true;
|
|
readonly canUnmount: false;
|
|
readonly toEmbedUrl: (url: string) => string | undefined;
|
|
readonly fromEmbedUrl: (url: string) => string | undefined;
|
|
}, {
|
|
readonly type: "vimeo";
|
|
readonly title: "Vimeo";
|
|
readonly hostnames: readonly ["vimeo.com", "player.vimeo.com"];
|
|
readonly width: 640;
|
|
readonly height: 360;
|
|
readonly doesResize: true;
|
|
readonly canUnmount: false;
|
|
readonly isAspectRatioLocked: true;
|
|
readonly toEmbedUrl: (url: string) => string | undefined;
|
|
readonly fromEmbedUrl: (url: string) => string | undefined;
|
|
}, {
|
|
readonly type: "excalidraw";
|
|
readonly title: "Excalidraw";
|
|
readonly hostnames: readonly ["excalidraw.com"];
|
|
readonly width: 720;
|
|
readonly height: 500;
|
|
readonly doesResize: true;
|
|
readonly canUnmount: false;
|
|
readonly isAspectRatioLocked: true;
|
|
readonly toEmbedUrl: (url: string) => string | undefined;
|
|
readonly fromEmbedUrl: (url: string) => string | undefined;
|
|
}, {
|
|
readonly type: "observable";
|
|
readonly title: "Observable";
|
|
readonly hostnames: readonly ["observablehq.com"];
|
|
readonly width: 720;
|
|
readonly height: 500;
|
|
readonly doesResize: true;
|
|
readonly canUnmount: false;
|
|
readonly isAspectRatioLocked: false;
|
|
readonly backgroundColor: "#fff";
|
|
readonly toEmbedUrl: (url: string) => string | undefined;
|
|
readonly fromEmbedUrl: (url: string) => string | undefined;
|
|
}];
|
|
|
|
// @public (undocumented)
|
|
export type EmbedDefinition = {
|
|
readonly type: string;
|
|
readonly title: string;
|
|
readonly hostnames: readonly string[];
|
|
readonly minWidth?: number;
|
|
readonly minHeight?: number;
|
|
readonly width: number;
|
|
readonly height: number;
|
|
readonly doesResize: boolean;
|
|
readonly canUnmount: boolean;
|
|
readonly isAspectRatioLocked?: boolean;
|
|
readonly overridePermissions?: TLEmbedShapePermissions;
|
|
readonly instructionLink?: string;
|
|
readonly backgroundColor?: string;
|
|
readonly overrideOutlineRadius?: number;
|
|
readonly toEmbedUrl: (url: string) => string | undefined;
|
|
readonly fromEmbedUrl: (url: string) => string | undefined;
|
|
};
|
|
|
|
// @internal (undocumented)
|
|
export const embedShapeMigrations: Migrations;
|
|
|
|
// @public
|
|
export const embedShapePermissionDefaults: {
|
|
readonly 'allow-downloads-without-user-activation': false;
|
|
readonly 'allow-downloads': false;
|
|
readonly 'allow-modals': false;
|
|
readonly 'allow-orientation-lock': false;
|
|
readonly 'allow-pointer-lock': false;
|
|
readonly 'allow-popups': true;
|
|
readonly 'allow-popups-to-escape-sandbox': false;
|
|
readonly 'allow-presentation': false;
|
|
readonly 'allow-storage-access-by-user-activation': false;
|
|
readonly 'allow-top-navigation': false;
|
|
readonly 'allow-top-navigation-by-user-activation': false;
|
|
readonly 'allow-scripts': true;
|
|
readonly 'allow-same-origin': true;
|
|
readonly 'allow-forms': true;
|
|
};
|
|
|
|
// @public (undocumented)
|
|
export const embedShapeProps: {
|
|
w: T.Validator<number>;
|
|
h: T.Validator<number>;
|
|
url: T.Validator<string>;
|
|
};
|
|
|
|
// @public
|
|
export class EnumStyleProp<T> extends StyleProp<T> {
|
|
// @internal
|
|
constructor(id: string, defaultValue: T, values: readonly T[]);
|
|
// (undocumented)
|
|
readonly values: readonly T[];
|
|
}
|
|
|
|
// @internal (undocumented)
|
|
export function fixupRecord(oldRecord: TLRecord): {
|
|
record: any;
|
|
issues: string[];
|
|
};
|
|
|
|
// @internal (undocumented)
|
|
export const frameShapeMigrations: Migrations;
|
|
|
|
// @public (undocumented)
|
|
export const frameShapeProps: {
|
|
w: T.Validator<number>;
|
|
h: T.Validator<number>;
|
|
name: T.Validator<string>;
|
|
};
|
|
|
|
// @public (undocumented)
|
|
export const GeoShapeGeoStyle: EnumStyleProp<"arrow-down" | "arrow-left" | "arrow-right" | "arrow-up" | "check-box" | "cloud" | "diamond" | "ellipse" | "hexagon" | "octagon" | "oval" | "pentagon" | "rectangle" | "rhombus-2" | "rhombus" | "star" | "trapezoid" | "triangle" | "x-box">;
|
|
|
|
// @internal (undocumented)
|
|
export const geoShapeMigrations: Migrations;
|
|
|
|
// @public (undocumented)
|
|
export const geoShapeProps: {
|
|
geo: EnumStyleProp<"arrow-down" | "arrow-left" | "arrow-right" | "arrow-up" | "check-box" | "cloud" | "diamond" | "ellipse" | "hexagon" | "octagon" | "oval" | "pentagon" | "rectangle" | "rhombus-2" | "rhombus" | "star" | "trapezoid" | "triangle" | "x-box">;
|
|
labelColor: EnumStyleProp<"black" | "blue" | "green" | "grey" | "light-blue" | "light-green" | "light-red" | "light-violet" | "orange" | "red" | "violet" | "yellow">;
|
|
color: EnumStyleProp<"black" | "blue" | "green" | "grey" | "light-blue" | "light-green" | "light-red" | "light-violet" | "orange" | "red" | "violet" | "yellow">;
|
|
fill: EnumStyleProp<"none" | "pattern" | "semi" | "solid">;
|
|
dash: EnumStyleProp<"dashed" | "dotted" | "draw" | "solid">;
|
|
size: EnumStyleProp<"l" | "m" | "s" | "xl">;
|
|
font: EnumStyleProp<"draw" | "mono" | "sans" | "serif">;
|
|
align: EnumStyleProp<"end-legacy" | "end" | "middle-legacy" | "middle" | "start-legacy" | "start">;
|
|
verticalAlign: EnumStyleProp<"end" | "middle" | "start">;
|
|
url: T.Validator<string>;
|
|
w: T.Validator<number>;
|
|
h: T.Validator<number>;
|
|
growY: T.Validator<number>;
|
|
text: T.Validator<string>;
|
|
};
|
|
|
|
// @public (undocumented)
|
|
export function getDefaultColorTheme(opts: {
|
|
isDarkMode: boolean;
|
|
}): TLDefaultColorTheme;
|
|
|
|
// @public (undocumented)
|
|
export function getDefaultTranslationLocale(): TLLanguage['locale'];
|
|
|
|
// @internal (undocumented)
|
|
export function getShapePropKeysByStyle(props: Record<string, T.Validatable<any>>): Map<StyleProp<unknown>, string>;
|
|
|
|
// @internal (undocumented)
|
|
export const groupShapeMigrations: Migrations;
|
|
|
|
// @internal (undocumented)
|
|
export const groupShapeProps: ShapeProps<TLGroupShape>;
|
|
|
|
// @internal (undocumented)
|
|
export const highlightShapeMigrations: Migrations;
|
|
|
|
// @public (undocumented)
|
|
export const highlightShapeProps: {
|
|
color: EnumStyleProp<"black" | "blue" | "green" | "grey" | "light-blue" | "light-green" | "light-red" | "light-violet" | "orange" | "red" | "violet" | "yellow">;
|
|
size: EnumStyleProp<"l" | "m" | "s" | "xl">;
|
|
segments: T.ArrayOfValidator<{
|
|
type: "free" | "straight";
|
|
points: Vec2dModel[];
|
|
}>;
|
|
isComplete: T.Validator<boolean>;
|
|
isPen: T.Validator<boolean>;
|
|
};
|
|
|
|
// @internal (undocumented)
|
|
export function idValidator<Id extends RecordId<UnknownRecord>>(prefix: Id['__type__']['typeName']): T.Validator<Id>;
|
|
|
|
// @internal (undocumented)
|
|
export const imageShapeMigrations: Migrations;
|
|
|
|
// @public (undocumented)
|
|
export const imageShapeProps: {
|
|
w: T.Validator<number>;
|
|
h: T.Validator<number>;
|
|
playing: T.Validator<boolean>;
|
|
url: T.Validator<string>;
|
|
assetId: T.Validator<TLAssetId | null>;
|
|
crop: T.Validator<{
|
|
topLeft: Vec2dModel;
|
|
bottomRight: Vec2dModel;
|
|
} | null>;
|
|
};
|
|
|
|
// @public (undocumented)
|
|
export const InstancePageStateRecordType: RecordType<TLInstancePageState, "pageId">;
|
|
|
|
// @public (undocumented)
|
|
export const InstancePresenceRecordType: RecordType<TLInstancePresence, "currentPageId" | "userId" | "userName">;
|
|
|
|
// @public (undocumented)
|
|
export function isPageId(id: string): id is TLPageId;
|
|
|
|
// @public (undocumented)
|
|
export function isShape(record?: UnknownRecord): record is TLShape;
|
|
|
|
// @public (undocumented)
|
|
export function isShapeId(id?: string): id is TLShapeId;
|
|
|
|
// @public (undocumented)
|
|
export const LANGUAGES: readonly [{
|
|
readonly locale: "ar";
|
|
readonly label: "عربي";
|
|
}, {
|
|
readonly locale: "ca";
|
|
readonly label: "Català";
|
|
}, {
|
|
readonly locale: "da";
|
|
readonly label: "Danish";
|
|
}, {
|
|
readonly locale: "de";
|
|
readonly label: "Deutsch";
|
|
}, {
|
|
readonly locale: "en";
|
|
readonly label: "English";
|
|
}, {
|
|
readonly locale: "es";
|
|
readonly label: "Español";
|
|
}, {
|
|
readonly locale: "fa";
|
|
readonly label: "فارسی";
|
|
}, {
|
|
readonly locale: "fi";
|
|
readonly label: "Suomi";
|
|
}, {
|
|
readonly locale: "fr";
|
|
readonly label: "Français";
|
|
}, {
|
|
readonly locale: "gl";
|
|
readonly label: "Galego";
|
|
}, {
|
|
readonly locale: "he";
|
|
readonly label: "עברית";
|
|
}, {
|
|
readonly locale: "it";
|
|
readonly label: "Italiano";
|
|
}, {
|
|
readonly locale: "ja";
|
|
readonly label: "日本語";
|
|
}, {
|
|
readonly locale: "ko-kr";
|
|
readonly label: "한국어";
|
|
}, {
|
|
readonly locale: "ku";
|
|
readonly label: "کوردی";
|
|
}, {
|
|
readonly locale: "hi-in";
|
|
readonly label: "हिन्दी";
|
|
}, {
|
|
readonly locale: "hu";
|
|
readonly label: "Magyar";
|
|
}, {
|
|
readonly locale: "my";
|
|
readonly label: "မြန်မာစာ";
|
|
}, {
|
|
readonly locale: "ne";
|
|
readonly label: "नेपाली";
|
|
}, {
|
|
readonly locale: "no";
|
|
readonly label: "Norwegian";
|
|
}, {
|
|
readonly locale: "pl";
|
|
readonly label: "Polski";
|
|
}, {
|
|
readonly locale: "pt-br";
|
|
readonly label: "Português - Brasil";
|
|
}, {
|
|
readonly locale: "pt-pt";
|
|
readonly label: "Português - Europeu";
|
|
}, {
|
|
readonly locale: "ro";
|
|
readonly label: "Română";
|
|
}, {
|
|
readonly locale: "ru";
|
|
readonly label: "Russian";
|
|
}, {
|
|
readonly locale: "sv";
|
|
readonly label: "Svenska";
|
|
}, {
|
|
readonly locale: "te";
|
|
readonly label: "తెలుగు";
|
|
}, {
|
|
readonly locale: "th";
|
|
readonly label: "ภาษาไทย";
|
|
}, {
|
|
readonly locale: "tr";
|
|
readonly label: "Türkçe";
|
|
}, {
|
|
readonly locale: "uk";
|
|
readonly label: "Ukrainian";
|
|
}, {
|
|
readonly locale: "vi";
|
|
readonly label: "Tiếng Việt";
|
|
}, {
|
|
readonly locale: "zh-cn";
|
|
readonly label: "Chinese - Simplified";
|
|
}, {
|
|
readonly locale: "zh-tw";
|
|
readonly label: "繁體中文 (台灣)";
|
|
}];
|
|
|
|
// @internal (undocumented)
|
|
export const lineShapeMigrations: Migrations;
|
|
|
|
// @public (undocumented)
|
|
export const lineShapeProps: {
|
|
color: EnumStyleProp<"black" | "blue" | "green" | "grey" | "light-blue" | "light-green" | "light-red" | "light-violet" | "orange" | "red" | "violet" | "yellow">;
|
|
dash: EnumStyleProp<"dashed" | "dotted" | "draw" | "solid">;
|
|
size: EnumStyleProp<"l" | "m" | "s" | "xl">;
|
|
spline: EnumStyleProp<"cubic" | "line">;
|
|
handles: T.DictValidator<string, TLHandle>;
|
|
};
|
|
|
|
// @public (undocumented)
|
|
export const LineShapeSplineStyle: EnumStyleProp<"cubic" | "line">;
|
|
|
|
// @internal (undocumented)
|
|
export const noteShapeMigrations: Migrations;
|
|
|
|
// @public (undocumented)
|
|
export const noteShapeProps: {
|
|
color: EnumStyleProp<"black" | "blue" | "green" | "grey" | "light-blue" | "light-green" | "light-red" | "light-violet" | "orange" | "red" | "violet" | "yellow">;
|
|
size: EnumStyleProp<"l" | "m" | "s" | "xl">;
|
|
font: EnumStyleProp<"draw" | "mono" | "sans" | "serif">;
|
|
align: EnumStyleProp<"end-legacy" | "end" | "middle-legacy" | "middle" | "start-legacy" | "start">;
|
|
verticalAlign: EnumStyleProp<"end" | "middle" | "start">;
|
|
growY: T.Validator<number>;
|
|
url: T.Validator<string>;
|
|
text: T.Validator<string>;
|
|
};
|
|
|
|
// @internal (undocumented)
|
|
export const opacityValidator: T.Validator<number>;
|
|
|
|
// @internal (undocumented)
|
|
export const pageIdValidator: T.Validator<TLPageId>;
|
|
|
|
// @public (undocumented)
|
|
export const PageRecordType: RecordType<TLPage, "index" | "name">;
|
|
|
|
// @public (undocumented)
|
|
export const parentIdValidator: T.Validator<TLParentId>;
|
|
|
|
// @public (undocumented)
|
|
export const PointerRecordType: RecordType<TLPointer, never>;
|
|
|
|
// @internal (undocumented)
|
|
export const rootShapeMigrations: Migrations;
|
|
|
|
// @public (undocumented)
|
|
export type SchemaShapeInfo = {
|
|
migrations?: Migrations;
|
|
props?: Record<string, {
|
|
validate: (prop: any) => any;
|
|
}>;
|
|
meta?: Record<string, {
|
|
validate: (prop: any) => any;
|
|
}>;
|
|
};
|
|
|
|
// @internal (undocumented)
|
|
export const scribbleValidator: T.Validator<TLScribble>;
|
|
|
|
// @public (undocumented)
|
|
export const shapeIdValidator: T.Validator<TLShapeId>;
|
|
|
|
// @public (undocumented)
|
|
export type ShapeProps<Shape extends TLBaseShape<any, any>> = {
|
|
[K in keyof Shape['props']]: T.Validatable<Shape['props'][K]>;
|
|
};
|
|
|
|
// @public
|
|
export class StyleProp<Type> implements T.Validatable<Type> {
|
|
// @internal
|
|
protected constructor(id: string, defaultValue: Type, type: T.Validatable<Type>);
|
|
// (undocumented)
|
|
readonly defaultValue: Type;
|
|
static define<Type>(uniqueId: string, options: {
|
|
defaultValue: Type;
|
|
type?: T.Validatable<Type>;
|
|
}): StyleProp<Type>;
|
|
static defineEnum<const Values extends readonly unknown[]>(uniqueId: string, options: {
|
|
defaultValue: Values[number];
|
|
values: Values;
|
|
}): EnumStyleProp<Values[number]>;
|
|
// (undocumented)
|
|
readonly id: string;
|
|
// (undocumented)
|
|
readonly type: T.Validatable<Type>;
|
|
// (undocumented)
|
|
validate(value: unknown): Type;
|
|
}
|
|
|
|
// @internal (undocumented)
|
|
export const textShapeMigrations: Migrations;
|
|
|
|
// @public (undocumented)
|
|
export const textShapeProps: {
|
|
color: EnumStyleProp<"black" | "blue" | "green" | "grey" | "light-blue" | "light-green" | "light-red" | "light-violet" | "orange" | "red" | "violet" | "yellow">;
|
|
size: EnumStyleProp<"l" | "m" | "s" | "xl">;
|
|
font: EnumStyleProp<"draw" | "mono" | "sans" | "serif">;
|
|
align: EnumStyleProp<"end-legacy" | "end" | "middle-legacy" | "middle" | "start-legacy" | "start">;
|
|
w: T.Validator<number>;
|
|
text: T.Validator<string>;
|
|
scale: T.Validator<number>;
|
|
autoSize: T.Validator<boolean>;
|
|
};
|
|
|
|
// @public
|
|
export const TL_CANVAS_UI_COLOR_TYPES: Set<"accent" | "black" | "laser" | "muted-1" | "selection-fill" | "selection-stroke" | "white">;
|
|
|
|
// @public (undocumented)
|
|
export type TLArrowShape = TLBaseShape<'arrow', TLArrowShapeProps>;
|
|
|
|
// @public (undocumented)
|
|
export type TLArrowShapeArrowheadStyle = T.TypeOf<typeof ArrowShapeArrowheadStartStyle>;
|
|
|
|
// @public (undocumented)
|
|
export type TLArrowShapeProps = ShapePropsType<typeof arrowShapeProps>;
|
|
|
|
// @public (undocumented)
|
|
export type TLArrowShapeTerminal = T.TypeOf<typeof ArrowShapeTerminal>;
|
|
|
|
// @public (undocumented)
|
|
export type TLAsset = TLBookmarkAsset | TLImageAsset | TLVideoAsset;
|
|
|
|
// @public (undocumented)
|
|
export type TLAssetId = RecordId<TLBaseAsset<any, any>>;
|
|
|
|
// @public (undocumented)
|
|
export type TLAssetPartial<T extends TLAsset = TLAsset> = T extends T ? {
|
|
id: TLAssetId;
|
|
type: T['type'];
|
|
props?: Partial<T['props']>;
|
|
meta?: Partial<T['meta']>;
|
|
} & Partial<Omit<T, 'id' | 'meta' | 'props' | 'type'>> : never;
|
|
|
|
// @public (undocumented)
|
|
export type TLAssetShape = Extract<TLShape, {
|
|
props: {
|
|
assetId: TLAssetId;
|
|
};
|
|
}>;
|
|
|
|
// @public (undocumented)
|
|
export interface TLBaseAsset<Type extends string, Props> extends BaseRecord<'asset', TLAssetId> {
|
|
// (undocumented)
|
|
meta: JsonObject;
|
|
// (undocumented)
|
|
props: Props;
|
|
// (undocumented)
|
|
type: Type;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLBaseShape<Type extends string, Props extends object> extends BaseRecord<'shape', TLShapeId> {
|
|
// (undocumented)
|
|
index: string;
|
|
// (undocumented)
|
|
isLocked: boolean;
|
|
// (undocumented)
|
|
meta: JsonObject;
|
|
// (undocumented)
|
|
opacity: TLOpacityType;
|
|
// (undocumented)
|
|
parentId: TLParentId;
|
|
// (undocumented)
|
|
props: Props;
|
|
// (undocumented)
|
|
rotation: number;
|
|
// (undocumented)
|
|
type: Type;
|
|
// (undocumented)
|
|
x: number;
|
|
// (undocumented)
|
|
y: number;
|
|
}
|
|
|
|
// @public
|
|
export type TLBookmarkAsset = TLBaseAsset<'bookmark', {
|
|
title: string;
|
|
description: string;
|
|
image: string;
|
|
src: null | string;
|
|
}>;
|
|
|
|
// @public (undocumented)
|
|
export type TLBookmarkShape = TLBaseShape<'bookmark', TLBookmarkShapeProps>;
|
|
|
|
// @public
|
|
export interface TLCamera extends BaseRecord<'camera', TLCameraId> {
|
|
// (undocumented)
|
|
meta: JsonObject;
|
|
// (undocumented)
|
|
x: number;
|
|
// (undocumented)
|
|
y: number;
|
|
// (undocumented)
|
|
z: number;
|
|
}
|
|
|
|
// @public
|
|
export type TLCameraId = RecordId<TLCamera>;
|
|
|
|
// @public
|
|
export type TLCanvasUiColor = SetValue<typeof TL_CANVAS_UI_COLOR_TYPES>;
|
|
|
|
// @public
|
|
export interface TLCursor {
|
|
// (undocumented)
|
|
rotation: number;
|
|
// (undocumented)
|
|
type: TLCursorType;
|
|
}
|
|
|
|
// @public
|
|
export type TLCursorType = SetValue<typeof TL_CURSOR_TYPES>;
|
|
|
|
// @public (undocumented)
|
|
export type TLDefaultColorStyle = T.TypeOf<typeof DefaultColorStyle>;
|
|
|
|
// @public (undocumented)
|
|
export type TLDefaultColorTheme = Expand<{
|
|
id: 'dark' | 'light';
|
|
text: string;
|
|
background: string;
|
|
solid: string;
|
|
} & Record<(typeof colors)[number], TLDefaultColorThemeColor>>;
|
|
|
|
// @public (undocumented)
|
|
export type TLDefaultColorThemeColor = {
|
|
solid: string;
|
|
semi: string;
|
|
pattern: string;
|
|
highlight: {
|
|
srgb: string;
|
|
p3: string;
|
|
};
|
|
};
|
|
|
|
// @public (undocumented)
|
|
export type TLDefaultDashStyle = T.TypeOf<typeof DefaultDashStyle>;
|
|
|
|
// @public (undocumented)
|
|
export type TLDefaultFillStyle = T.TypeOf<typeof DefaultFillStyle>;
|
|
|
|
// @public (undocumented)
|
|
export type TLDefaultFontStyle = T.TypeOf<typeof DefaultFontStyle>;
|
|
|
|
// @public (undocumented)
|
|
export type TLDefaultHorizontalAlignStyle = T.TypeOf<typeof DefaultHorizontalAlignStyle>;
|
|
|
|
// @public
|
|
export type TLDefaultShape = TLArrowShape | TLBookmarkShape | TLDrawShape | TLEmbedShape | TLFrameShape | TLGeoShape | TLGroupShape | TLHighlightShape | TLImageShape | TLLineShape | TLNoteShape | TLTextShape | TLVideoShape;
|
|
|
|
// @public (undocumented)
|
|
export type TLDefaultSizeStyle = T.TypeOf<typeof DefaultSizeStyle>;
|
|
|
|
// @public (undocumented)
|
|
export type TLDefaultVerticalAlignStyle = T.TypeOf<typeof DefaultVerticalAlignStyle>;
|
|
|
|
// @public
|
|
export interface TLDocument extends BaseRecord<'document', RecordId<TLDocument>> {
|
|
// (undocumented)
|
|
gridSize: number;
|
|
// (undocumented)
|
|
meta: JsonObject;
|
|
// (undocumented)
|
|
name: string;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export const TLDOCUMENT_ID: RecordId<TLDocument>;
|
|
|
|
// @public (undocumented)
|
|
export type TLDrawShape = TLBaseShape<'draw', TLDrawShapeProps>;
|
|
|
|
// @public (undocumented)
|
|
export type TLDrawShapeSegment = T.TypeOf<typeof DrawShapeSegment>;
|
|
|
|
// @public (undocumented)
|
|
export type TLEmbedShape = TLBaseShape<'embed', TLEmbedShapeProps>;
|
|
|
|
// @public (undocumented)
|
|
export type TLEmbedShapePermissions = {
|
|
[K in keyof typeof embedShapePermissionDefaults]?: boolean;
|
|
};
|
|
|
|
// @public (undocumented)
|
|
export type TLFrameShape = TLBaseShape<'frame', TLFrameShapeProps>;
|
|
|
|
// @public (undocumented)
|
|
export type TLGeoShape = TLBaseShape<'geo', TLGeoShapeProps>;
|
|
|
|
// @public (undocumented)
|
|
export type TLGroupShape = TLBaseShape<'group', TLGroupShapeProps>;
|
|
|
|
// @public
|
|
export interface TLHandle {
|
|
// (undocumented)
|
|
canBind?: boolean;
|
|
id: string;
|
|
// (undocumented)
|
|
index: string;
|
|
// (undocumented)
|
|
type: TLHandleType;
|
|
// (undocumented)
|
|
x: number;
|
|
// (undocumented)
|
|
y: number;
|
|
}
|
|
|
|
// @public
|
|
export type TLHandleType = SetValue<typeof TL_HANDLE_TYPES>;
|
|
|
|
// @public (undocumented)
|
|
export type TLHighlightShape = TLBaseShape<'highlight', TLHighlightShapeProps>;
|
|
|
|
// @public
|
|
export type TLImageAsset = TLBaseAsset<'image', {
|
|
w: number;
|
|
h: number;
|
|
name: string;
|
|
isAnimated: boolean;
|
|
mimeType: null | string;
|
|
src: null | string;
|
|
}>;
|
|
|
|
// @public (undocumented)
|
|
export type TLImageShape = TLBaseShape<'image', TLImageShapeProps>;
|
|
|
|
// @public (undocumented)
|
|
export type TLImageShapeCrop = T.TypeOf<typeof ImageShapeCrop>;
|
|
|
|
// @public (undocumented)
|
|
export type TLImageShapeProps = ShapePropsType<typeof imageShapeProps>;
|
|
|
|
// @public
|
|
export interface TLInstance extends BaseRecord<'instance', TLInstanceId> {
|
|
// (undocumented)
|
|
brush: Box2dModel | null;
|
|
// (undocumented)
|
|
canMoveCamera: boolean;
|
|
// (undocumented)
|
|
chatMessage: string;
|
|
// (undocumented)
|
|
currentPageId: TLPageId;
|
|
// (undocumented)
|
|
cursor: TLCursor;
|
|
// (undocumented)
|
|
devicePixelRatio: number;
|
|
// (undocumented)
|
|
exportBackground: boolean;
|
|
// (undocumented)
|
|
followingUserId: null | string;
|
|
// (undocumented)
|
|
highlightedUserIds: string[];
|
|
// (undocumented)
|
|
isChangingStyle: boolean;
|
|
// (undocumented)
|
|
isChatting: boolean;
|
|
// (undocumented)
|
|
isCoarsePointer: boolean;
|
|
// (undocumented)
|
|
isDebugMode: boolean;
|
|
// (undocumented)
|
|
isFocused: boolean;
|
|
// (undocumented)
|
|
isFocusMode: boolean;
|
|
// (undocumented)
|
|
isGridMode: boolean;
|
|
// (undocumented)
|
|
isPenMode: boolean;
|
|
// (undocumented)
|
|
isReadonly: boolean;
|
|
// (undocumented)
|
|
isToolLocked: boolean;
|
|
// (undocumented)
|
|
meta: JsonObject;
|
|
// (undocumented)
|
|
opacityForNextShape: TLOpacityType;
|
|
// (undocumented)
|
|
openMenus: string[];
|
|
// (undocumented)
|
|
screenBounds: Box2dModel;
|
|
// (undocumented)
|
|
scribble: null | TLScribble;
|
|
// (undocumented)
|
|
stylesForNextShape: Record<string, unknown>;
|
|
// (undocumented)
|
|
zoomBrush: Box2dModel | null;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export const TLINSTANCE_ID: TLInstanceId;
|
|
|
|
// @public (undocumented)
|
|
export type TLInstanceId = RecordId<TLInstance>;
|
|
|
|
// @public
|
|
export interface TLInstancePageState extends BaseRecord<'instance_page_state', TLInstancePageStateId> {
|
|
// (undocumented)
|
|
croppingShapeId: null | TLShapeId;
|
|
// (undocumented)
|
|
editingShapeId: null | TLShapeId;
|
|
// (undocumented)
|
|
erasingShapeIds: TLShapeId[];
|
|
// (undocumented)
|
|
focusedGroupId: null | TLShapeId;
|
|
// (undocumented)
|
|
hintingShapeIds: TLShapeId[];
|
|
// (undocumented)
|
|
hoveredShapeId: null | TLShapeId;
|
|
// (undocumented)
|
|
meta: JsonObject;
|
|
// (undocumented)
|
|
pageId: RecordId<TLPage>;
|
|
// (undocumented)
|
|
selectedShapeIds: TLShapeId[];
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLInstancePresence extends BaseRecord<'instance_presence', TLInstancePresenceID> {
|
|
// (undocumented)
|
|
brush: Box2dModel | null;
|
|
// (undocumented)
|
|
camera: {
|
|
x: number;
|
|
y: number;
|
|
z: number;
|
|
};
|
|
// (undocumented)
|
|
chatMessage: string;
|
|
// (undocumented)
|
|
color: string;
|
|
// (undocumented)
|
|
currentPageId: TLPageId;
|
|
// (undocumented)
|
|
cursor: {
|
|
x: number;
|
|
y: number;
|
|
type: TLCursor['type'];
|
|
rotation: number;
|
|
};
|
|
// (undocumented)
|
|
followingUserId: null | string;
|
|
// (undocumented)
|
|
lastActivityTimestamp: number;
|
|
// (undocumented)
|
|
meta: JsonObject;
|
|
// (undocumented)
|
|
screenBounds: Box2dModel;
|
|
// (undocumented)
|
|
scribble: null | TLScribble;
|
|
// (undocumented)
|
|
selectedShapeIds: TLShapeId[];
|
|
// (undocumented)
|
|
userId: string;
|
|
// (undocumented)
|
|
userName: string;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export type TLLanguage = (typeof LANGUAGES)[number];
|
|
|
|
// @public (undocumented)
|
|
export type TLLineShape = TLBaseShape<'line', TLLineShapeProps>;
|
|
|
|
// @public (undocumented)
|
|
export type TLNoteShape = TLBaseShape<'note', TLNoteShapeProps>;
|
|
|
|
// @public (undocumented)
|
|
export type TLOpacityType = number;
|
|
|
|
// @public
|
|
export interface TLPage extends BaseRecord<'page', TLPageId> {
|
|
// (undocumented)
|
|
index: string;
|
|
// (undocumented)
|
|
meta: JsonObject;
|
|
// (undocumented)
|
|
name: string;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export type TLPageId = RecordId<TLPage>;
|
|
|
|
// @public (undocumented)
|
|
export type TLParentId = TLPageId | TLShapeId;
|
|
|
|
// @public (undocumented)
|
|
export const TLPOINTER_ID: TLPointerId;
|
|
|
|
// @public (undocumented)
|
|
export type TLRecord = TLAsset | TLCamera | TLDocument | TLInstance | TLInstancePageState | TLInstancePresence | TLPage | TLPointer | TLShape;
|
|
|
|
// @public (undocumented)
|
|
export type TLSchema = StoreSchema<TLRecord, TLStoreProps>;
|
|
|
|
// @public
|
|
export type TLScribble = {
|
|
points: Vec2dModel[];
|
|
size: number;
|
|
color: TLCanvasUiColor;
|
|
opacity: number;
|
|
state: SetValue<typeof TL_SCRIBBLE_STATES>;
|
|
delay: number;
|
|
};
|
|
|
|
// @public (undocumented)
|
|
export type TLSerializedStore = SerializedStore<TLRecord>;
|
|
|
|
// @public
|
|
export type TLShape = TLDefaultShape | TLUnknownShape;
|
|
|
|
// @public (undocumented)
|
|
export type TLShapeId = RecordId<TLUnknownShape>;
|
|
|
|
// @public (undocumented)
|
|
export type TLShapePartial<T extends TLShape = TLShape> = T extends T ? {
|
|
id: TLShapeId;
|
|
type: T['type'];
|
|
props?: Partial<T['props']>;
|
|
meta?: Partial<T['meta']>;
|
|
} & Partial<Omit<T, 'id' | 'meta' | 'props' | 'type'>> : never;
|
|
|
|
// @public (undocumented)
|
|
export type TLShapeProp = keyof TLShapeProps;
|
|
|
|
// @public (undocumented)
|
|
export type TLShapeProps = Identity<UnionToIntersection<TLDefaultShape['props']>>;
|
|
|
|
// @public (undocumented)
|
|
export type TLStore = Store<TLRecord, TLStoreProps>;
|
|
|
|
// @public (undocumented)
|
|
export type TLStoreProps = {
|
|
defaultName: string;
|
|
};
|
|
|
|
// @public (undocumented)
|
|
export type TLStoreSchema = StoreSchema<TLRecord, TLStoreProps>;
|
|
|
|
// @public (undocumented)
|
|
export type TLStoreSnapshot = SerializedStore<TLRecord>;
|
|
|
|
// @public (undocumented)
|
|
export type TLTextShape = TLBaseShape<'text', TLTextShapeProps>;
|
|
|
|
// @public (undocumented)
|
|
export type TLTextShapeProps = ShapePropsType<typeof textShapeProps>;
|
|
|
|
// @public
|
|
export type TLUnknownShape = TLBaseShape<string, object>;
|
|
|
|
// @public
|
|
export type TLVideoAsset = TLBaseAsset<'video', {
|
|
w: number;
|
|
h: number;
|
|
name: string;
|
|
isAnimated: boolean;
|
|
mimeType: null | string;
|
|
src: null | string;
|
|
}>;
|
|
|
|
// @public (undocumented)
|
|
export type TLVideoShape = TLBaseShape<'video', TLVideoShapeProps>;
|
|
|
|
// @public
|
|
export interface Vec2dModel {
|
|
// (undocumented)
|
|
x: number;
|
|
// (undocumented)
|
|
y: number;
|
|
// (undocumented)
|
|
z?: number;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export const vec2dModelValidator: T.Validator<Vec2dModel>;
|
|
|
|
// @internal (undocumented)
|
|
export const videoShapeMigrations: Migrations;
|
|
|
|
// @public (undocumented)
|
|
export const videoShapeProps: {
|
|
w: T.Validator<number>;
|
|
h: T.Validator<number>;
|
|
time: T.Validator<number>;
|
|
playing: T.Validator<boolean>;
|
|
url: T.Validator<string>;
|
|
assetId: T.Validator<TLAssetId | null>;
|
|
};
|
|
|
|
// (No @packageDocumentation comment for this package)
|
|
|
|
```
|