@tldraw/editor 3.15.0-canary.d3401abd19b9 → 3.15.0-canary.db14db4f5395
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-cjs/index.d.ts +41 -49
- package/dist-cjs/index.js +16 -18
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/config/TLUserPreferences.js +1 -7
- package/dist-cjs/lib/config/TLUserPreferences.js.map +2 -2
- package/dist-cjs/lib/editor/Editor.js +2 -20
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/managers/TextManager/TextManager.js +101 -96
- package/dist-cjs/lib/editor/managers/TextManager/TextManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js +2 -7
- package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/Arc2d.js +1 -1
- package/dist-cjs/lib/primitives/geometry/Arc2d.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/Circle2d.js +1 -1
- package/dist-cjs/lib/primitives/geometry/Circle2d.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/CubicBezier2d.js +1 -3
- package/dist-cjs/lib/primitives/geometry/CubicBezier2d.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/Ellipse2d.js +1 -1
- package/dist-cjs/lib/primitives/geometry/Ellipse2d.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/geometry-constants.js +2 -2
- package/dist-cjs/lib/primitives/geometry/geometry-constants.js.map +2 -2
- package/dist-cjs/lib/primitives/intersect.js +4 -4
- package/dist-cjs/lib/primitives/intersect.js.map +2 -2
- package/dist-cjs/lib/primitives/utils.js +0 -4
- package/dist-cjs/lib/primitives/utils.js.map +2 -2
- package/dist-cjs/lib/utils/sync/TLLocalSyncClient.js +1 -0
- package/dist-cjs/lib/utils/sync/TLLocalSyncClient.js.map +2 -2
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.d.mts +41 -49
- package/dist-esm/index.mjs +41 -43
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/config/TLUserPreferences.mjs +1 -7
- package/dist-esm/lib/config/TLUserPreferences.mjs.map +2 -2
- package/dist-esm/lib/editor/Editor.mjs +2 -20
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs +101 -96
- package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs +2 -7
- package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/Arc2d.mjs +2 -2
- package/dist-esm/lib/primitives/geometry/Arc2d.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/Circle2d.mjs +2 -2
- package/dist-esm/lib/primitives/geometry/Circle2d.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/CubicBezier2d.mjs +1 -3
- package/dist-esm/lib/primitives/geometry/CubicBezier2d.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/Ellipse2d.mjs +2 -2
- package/dist-esm/lib/primitives/geometry/Ellipse2d.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/geometry-constants.mjs +2 -2
- package/dist-esm/lib/primitives/geometry/geometry-constants.mjs.map +2 -2
- package/dist-esm/lib/primitives/intersect.mjs +5 -5
- package/dist-esm/lib/primitives/intersect.mjs.map +2 -2
- package/dist-esm/lib/primitives/utils.mjs +0 -4
- package/dist-esm/lib/primitives/utils.mjs.map +2 -2
- package/dist-esm/lib/utils/sync/TLLocalSyncClient.mjs +1 -0
- package/dist-esm/lib/utils/sync/TLLocalSyncClient.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/package.json +7 -7
- package/src/index.ts +62 -63
- package/src/lib/config/TLUserPreferences.ts +0 -7
- package/src/lib/editor/Editor.test.ts +0 -407
- package/src/lib/editor/Editor.ts +4 -29
- package/src/lib/editor/managers/TextManager/TextManager.ts +128 -108
- package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.test.ts +0 -21
- package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.ts +0 -8
- package/src/lib/license/LicenseManager.test.ts +1 -1
- package/src/lib/primitives/geometry/Arc2d.ts +2 -2
- package/src/lib/primitives/geometry/Circle2d.ts +2 -2
- package/src/lib/primitives/geometry/CubicBezier2d.ts +1 -4
- package/src/lib/primitives/geometry/Ellipse2d.ts +2 -2
- package/src/lib/primitives/geometry/geometry-constants.ts +1 -2
- package/src/lib/primitives/intersect.ts +5 -12
- package/src/lib/primitives/utils.ts +0 -11
- package/src/lib/utils/sync/TLLocalSyncClient.ts +1 -0
- package/src/version.ts +3 -3
- package/src/lib/primitives/intersect.test.ts +0 -946
package/dist-cjs/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
|
|
1
3
|
import { Atom } from '@tldraw/state';
|
|
2
4
|
import { BoxModel } from '@tldraw/tlschema';
|
|
3
5
|
import { ComponentType } from 'react';
|
|
@@ -17,8 +19,8 @@ import { NamedExoticComponent } from 'react';
|
|
|
17
19
|
import { Node as Node_2 } from '@tiptap/pm/model';
|
|
18
20
|
import { PerformanceTracker } from '@tldraw/utils';
|
|
19
21
|
import { PointerEventHandler } from 'react';
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
+
import { default as React_2 } from 'react';
|
|
23
|
+
import * as React_3 from 'react';
|
|
22
24
|
import { ReactElement } from 'react';
|
|
23
25
|
import { ReactNode } from 'react';
|
|
24
26
|
import { RecordProps } from '@tldraw/tlschema';
|
|
@@ -57,7 +59,6 @@ import { TLImageAsset } from '@tldraw/tlschema';
|
|
|
57
59
|
import { TLInstance } from '@tldraw/tlschema';
|
|
58
60
|
import { TLInstancePageState } from '@tldraw/tlschema';
|
|
59
61
|
import { TLInstancePresence } from '@tldraw/tlschema';
|
|
60
|
-
import { TLOpacityType } from '@tldraw/tlschema';
|
|
61
62
|
import { TLPage } from '@tldraw/tlschema';
|
|
62
63
|
import { TLPageId } from '@tldraw/tlschema';
|
|
63
64
|
import { TLParentId } from '@tldraw/tlschema';
|
|
@@ -715,8 +716,8 @@ export declare function createTLStore({ initialData, defaultName, id, assets, on
|
|
|
715
716
|
|
|
716
717
|
/** @public */
|
|
717
718
|
export declare function createTLUser(opts?: {
|
|
718
|
-
setUserPreferences?: (userPreferences: TLUserPreferences) => void;
|
|
719
|
-
userPreferences?: Signal<TLUserPreferences
|
|
719
|
+
setUserPreferences?: ((userPreferences: TLUserPreferences) => void) | undefined;
|
|
720
|
+
userPreferences?: Signal<TLUserPreferences, unknown> | undefined;
|
|
720
721
|
}): TLUser;
|
|
721
722
|
|
|
722
723
|
/** @public */
|
|
@@ -725,12 +726,10 @@ export declare class CubicBezier2d extends Polyline2d {
|
|
|
725
726
|
private _b;
|
|
726
727
|
private _c;
|
|
727
728
|
private _d;
|
|
728
|
-
private _resolution;
|
|
729
729
|
constructor(config: Omit<Geometry2dOptions, 'isClosed' | 'isFilled'> & {
|
|
730
730
|
cp1: Vec;
|
|
731
731
|
cp2: Vec;
|
|
732
732
|
end: Vec;
|
|
733
|
-
resolution?: number;
|
|
734
733
|
start: Vec;
|
|
735
734
|
});
|
|
736
735
|
getVertices(): Vec[];
|
|
@@ -849,7 +848,7 @@ export declare const defaultTldrawOptions: {
|
|
|
849
848
|
readonly edgeScrollSpeed: 25;
|
|
850
849
|
readonly enableToolbarKeyboardShortcuts: true;
|
|
851
850
|
readonly exportProvider: ExoticComponent< {
|
|
852
|
-
children?: ReactNode
|
|
851
|
+
children?: ReactNode;
|
|
853
852
|
}>;
|
|
854
853
|
readonly flattenImageBoundsExpand: 64;
|
|
855
854
|
readonly flattenImageBoundsPadding: 16;
|
|
@@ -889,7 +888,6 @@ export declare const defaultTldrawOptions: {
|
|
|
889
888
|
/** @public */
|
|
890
889
|
export declare const defaultUserPreferences: Readonly<{
|
|
891
890
|
animationSpeed: 0 | 1;
|
|
892
|
-
areKeyboardShortcutsEnabled: true;
|
|
893
891
|
color: "#02B1CC" | "#11B3A3" | "#39B178" | "#55B467" | "#7B66DC" | "#9D5BD2" | "#BD54C6" | "#E34BA9" | "#EC5E41" | "#F04F88" | "#F2555A" | "#FF802B";
|
|
894
892
|
colorScheme: "light";
|
|
895
893
|
edgeScrollSpeed: 1;
|
|
@@ -1020,8 +1018,8 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1020
1018
|
readonly timers: {
|
|
1021
1019
|
dispose: () => void;
|
|
1022
1020
|
requestAnimationFrame: (callback: FrameRequestCallback) => number;
|
|
1023
|
-
setInterval: (handler: TimerHandler, timeout?: number, ...args: any[]) => number;
|
|
1024
|
-
setTimeout: (handler: TimerHandler, timeout?: number, ...args: any[]) => number;
|
|
1021
|
+
setInterval: (handler: TimerHandler, timeout?: number | undefined, ...args: any[]) => number;
|
|
1022
|
+
setTimeout: (handler: TimerHandler, timeout?: number | undefined, ...args: any[]) => number;
|
|
1025
1023
|
};
|
|
1026
1024
|
/**
|
|
1027
1025
|
* A manager for the user and their preferences.
|
|
@@ -1555,9 +1553,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1555
1553
|
*/
|
|
1556
1554
|
deselect(...shapes: TLShape[] | TLShapeId[]): this;
|
|
1557
1555
|
/**
|
|
1558
|
-
* Select all
|
|
1559
|
-
* select all shapes within that parent. If the user has not selected any shapes,
|
|
1560
|
-
* or if the shapes shapes are only on select all shapes on the current page.
|
|
1556
|
+
* Select all direct children of the current page.
|
|
1561
1557
|
*
|
|
1562
1558
|
* @example
|
|
1563
1559
|
* ```ts
|
|
@@ -2072,10 +2068,10 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2072
2068
|
*/
|
|
2073
2069
|
slideCamera(opts?: {
|
|
2074
2070
|
direction: VecLike;
|
|
2075
|
-
force?: boolean;
|
|
2076
|
-
friction?: number;
|
|
2071
|
+
force?: boolean | undefined;
|
|
2072
|
+
friction?: number | undefined;
|
|
2077
2073
|
speed: number;
|
|
2078
|
-
speedThreshold?: number;
|
|
2074
|
+
speedThreshold?: number | undefined;
|
|
2079
2075
|
}): this;
|
|
2080
2076
|
/**
|
|
2081
2077
|
* Animate the camera to a user's cursor position. This also briefly show the user's cursor if it's not currently visible.
|
|
@@ -2687,12 +2683,12 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2687
2683
|
*/
|
|
2688
2684
|
getShapeAtPoint(point: VecLike, opts?: {
|
|
2689
2685
|
filter?(shape: TLShape): boolean;
|
|
2690
|
-
hitFrameInside?: boolean;
|
|
2691
|
-
hitInside?: boolean;
|
|
2692
|
-
hitLabels?: boolean;
|
|
2693
|
-
hitLocked?: boolean;
|
|
2694
|
-
margin?: number;
|
|
2695
|
-
renderingOnly?: boolean;
|
|
2686
|
+
hitFrameInside?: boolean | undefined;
|
|
2687
|
+
hitInside?: boolean | undefined;
|
|
2688
|
+
hitLabels?: boolean | undefined;
|
|
2689
|
+
hitLocked?: boolean | undefined;
|
|
2690
|
+
margin?: number | undefined;
|
|
2691
|
+
renderingOnly?: boolean | undefined;
|
|
2696
2692
|
}): TLShape | undefined;
|
|
2697
2693
|
/**
|
|
2698
2694
|
* Get the shapes, if any, at a given page point.
|
|
@@ -2711,8 +2707,8 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2711
2707
|
* @public
|
|
2712
2708
|
*/
|
|
2713
2709
|
getShapesAtPoint(point: VecLike, opts?: {
|
|
2714
|
-
hitInside?: boolean;
|
|
2715
|
-
margin?: number;
|
|
2710
|
+
hitInside?: boolean | undefined;
|
|
2711
|
+
margin?: number | undefined;
|
|
2716
2712
|
}): TLShape[];
|
|
2717
2713
|
/**
|
|
2718
2714
|
* Test whether a point (in the current page space) will will a shape. This method takes into account masks,
|
|
@@ -2730,8 +2726,8 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2730
2726
|
* @public
|
|
2731
2727
|
*/
|
|
2732
2728
|
isPointInShape(shape: TLShape | TLShapeId, point: VecLike, opts?: {
|
|
2733
|
-
hitInside?: boolean;
|
|
2734
|
-
margin?: number;
|
|
2729
|
+
hitInside?: boolean | undefined;
|
|
2730
|
+
margin?: number | undefined;
|
|
2735
2731
|
}): boolean;
|
|
2736
2732
|
/**
|
|
2737
2733
|
* Convert a point in the current page space to a point in the local space of a shape. For example, if a
|
|
@@ -4017,7 +4013,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
4017
4013
|
}
|
|
4018
4014
|
|
|
4019
4015
|
/** @public */
|
|
4020
|
-
export declare const EditorContext:
|
|
4016
|
+
export declare const EditorContext: React_2.Context<Editor | null>;
|
|
4021
4017
|
|
|
4022
4018
|
/** @public @react */
|
|
4023
4019
|
export declare function EditorProvider({ editor, children }: EditorProviderProps): JSX_2.Element;
|
|
@@ -4025,7 +4021,7 @@ export declare function EditorProvider({ editor, children }: EditorProviderProps
|
|
|
4025
4021
|
/** @public */
|
|
4026
4022
|
export declare interface EditorProviderProps {
|
|
4027
4023
|
editor: Editor;
|
|
4028
|
-
children:
|
|
4024
|
+
children: React_2.ReactNode;
|
|
4029
4025
|
}
|
|
4030
4026
|
|
|
4031
4027
|
/** @public */
|
|
@@ -4051,7 +4047,7 @@ export declare class Ellipse2d extends Geometry2d {
|
|
|
4051
4047
|
}
|
|
4052
4048
|
|
|
4053
4049
|
/** @public */
|
|
4054
|
-
export declare class ErrorBoundary extends
|
|
4050
|
+
export declare class ErrorBoundary extends React_3.Component<React_3.PropsWithRef<React_3.PropsWithChildren<TLErrorBoundaryProps>>, {
|
|
4055
4051
|
error: Error | null;
|
|
4056
4052
|
}> {
|
|
4057
4053
|
static getDerivedStateFromError(error: Error): {
|
|
@@ -4061,7 +4057,7 @@ export declare class ErrorBoundary extends React_2.Component<React_2.PropsWithRe
|
|
|
4061
4057
|
error: null;
|
|
4062
4058
|
};
|
|
4063
4059
|
componentDidCatch(error: unknown): void;
|
|
4064
|
-
render(): boolean | JSX_2.Element | Iterable<
|
|
4060
|
+
render(): boolean | JSX_2.Element | Iterable<React_3.ReactNode> | null | number | string | undefined;
|
|
4065
4061
|
}
|
|
4066
4062
|
|
|
4067
4063
|
/** @public @react */
|
|
@@ -4322,8 +4318,6 @@ export declare function getSvgPathFromPoints(points: VecLike[], closed?: boolean
|
|
|
4322
4318
|
/** @public */
|
|
4323
4319
|
export declare function getUserPreferences(): TLUserPreferences;
|
|
4324
4320
|
|
|
4325
|
-
/* Excluded from this release type: getVerticesCountForArcLength */
|
|
4326
|
-
|
|
4327
4321
|
/** @public */
|
|
4328
4322
|
export declare class Group2d extends Geometry2d {
|
|
4329
4323
|
children: Geometry2d[];
|
|
@@ -4467,7 +4461,7 @@ export declare class HistoryManager<R extends UnknownRecord> {
|
|
|
4467
4461
|
export declare function HTMLContainer({ children, className, ...rest }: HTMLContainerProps): JSX_2.Element;
|
|
4468
4462
|
|
|
4469
4463
|
/** @public */
|
|
4470
|
-
export declare type HTMLContainerProps =
|
|
4464
|
+
export declare type HTMLContainerProps = React_3.HTMLAttributes<HTMLDivElement>;
|
|
4471
4465
|
|
|
4472
4466
|
/** @public */
|
|
4473
4467
|
export declare const inlineBase64AssetStore: TLAssetStore;
|
|
@@ -4523,7 +4517,7 @@ export declare function intersectLineSegmentCircle(a1: VecLike, a2: VecLike, c:
|
|
|
4523
4517
|
* @param b2 - The second segment's second point.
|
|
4524
4518
|
* @public
|
|
4525
4519
|
*/
|
|
4526
|
-
export declare function intersectLineSegmentLineSegment(a1: VecLike, a2: VecLike, b1: VecLike, b2: VecLike
|
|
4520
|
+
export declare function intersectLineSegmentLineSegment(a1: VecLike, a2: VecLike, b1: VecLike, b2: VecLike): null | Vec;
|
|
4527
4521
|
|
|
4528
4522
|
/**
|
|
4529
4523
|
* Find the intersections between a line segment and a closed polygon.
|
|
@@ -4829,7 +4823,7 @@ export declare function precise(A: VecLike): string;
|
|
|
4829
4823
|
* @param event - To prevent default on
|
|
4830
4824
|
* @public
|
|
4831
4825
|
*/
|
|
4832
|
-
export declare function preventDefault(event: Event |
|
|
4826
|
+
export declare function preventDefault(event: Event | React_2.BaseSyntheticEvent): void;
|
|
4833
4827
|
|
|
4834
4828
|
/**
|
|
4835
4829
|
* Convert radians to degrees.
|
|
@@ -4864,10 +4858,10 @@ export declare class ReadonlySharedStyleMap {
|
|
|
4864
4858
|
getAsKnownValue<T>(prop: StyleProp<T>): T | undefined;
|
|
4865
4859
|
get size(): number;
|
|
4866
4860
|
equals(other: ReadonlySharedStyleMap): boolean;
|
|
4867
|
-
keys():
|
|
4868
|
-
values():
|
|
4869
|
-
entries():
|
|
4870
|
-
[Symbol.iterator]():
|
|
4861
|
+
keys(): IterableIterator<StyleProp<any>>;
|
|
4862
|
+
values(): IterableIterator<SharedStyle<unknown>>;
|
|
4863
|
+
entries(): IterableIterator<[StyleProp<any>, SharedStyle<unknown>]>;
|
|
4864
|
+
[Symbol.iterator](): IterableIterator<[StyleProp<any>, SharedStyle<unknown>]>;
|
|
4871
4865
|
}
|
|
4872
4866
|
|
|
4873
4867
|
/** @public */
|
|
@@ -4891,7 +4885,7 @@ export declare class Rectangle2d extends Polygon2d {
|
|
|
4891
4885
|
export declare function refreshPage(): void;
|
|
4892
4886
|
|
|
4893
4887
|
/** @public */
|
|
4894
|
-
export declare function releasePointerCapture(element: Element, event: PointerEvent |
|
|
4888
|
+
export declare function releasePointerCapture(element: Element, event: PointerEvent | React_2.PointerEvent<Element>): void;
|
|
4895
4889
|
|
|
4896
4890
|
/** @public */
|
|
4897
4891
|
export declare type RequiredKeys<T, K extends keyof T> = Required<Pick<T, K>> & Omit<T, K>;
|
|
@@ -5034,7 +5028,7 @@ export declare type SelectionEdge = 'bottom' | 'left' | 'right' | 'top';
|
|
|
5034
5028
|
export declare type SelectionHandle = SelectionCorner | SelectionEdge;
|
|
5035
5029
|
|
|
5036
5030
|
/** @public */
|
|
5037
|
-
export declare function setPointerCapture(element: Element, event: PointerEvent |
|
|
5031
|
+
export declare function setPointerCapture(element: Element, event: PointerEvent | React_2.PointerEvent<Element>): void;
|
|
5038
5032
|
|
|
5039
5033
|
/** @public */
|
|
5040
5034
|
export declare function setRuntimeOverrides(input: Partial<typeof runtime>): void;
|
|
@@ -5740,7 +5734,7 @@ export declare function suffixSafeId(id: SafeId, suffix: string): SafeId;
|
|
|
5740
5734
|
export declare function SVGContainer({ children, className, ...rest }: SVGContainerProps): JSX_2.Element;
|
|
5741
5735
|
|
|
5742
5736
|
/** @public */
|
|
5743
|
-
export declare type SVGContainerProps =
|
|
5737
|
+
export declare type SVGContainerProps = React_3.ComponentProps<'svg'>;
|
|
5744
5738
|
|
|
5745
5739
|
/** @public */
|
|
5746
5740
|
export declare interface SvgExportContext {
|
|
@@ -5801,9 +5795,10 @@ export declare const TAB_ID: string;
|
|
|
5801
5795
|
export declare class TextManager {
|
|
5802
5796
|
editor: Editor;
|
|
5803
5797
|
private elm;
|
|
5798
|
+
private defaultStyles;
|
|
5804
5799
|
constructor(editor: Editor);
|
|
5805
|
-
private setElementStyles;
|
|
5806
5800
|
dispose(): void;
|
|
5801
|
+
private resetElmStyles;
|
|
5807
5802
|
measureText(textToMeasure: string, opts: TLMeasureTextOpts): BoxModel & {
|
|
5808
5803
|
scrollWidth: number;
|
|
5809
5804
|
};
|
|
@@ -6147,7 +6142,7 @@ export declare interface TLDragShapesOverInfo {
|
|
|
6147
6142
|
}
|
|
6148
6143
|
|
|
6149
6144
|
/** @public @react */
|
|
6150
|
-
export declare const TldrawEditor:
|
|
6145
|
+
export declare const TldrawEditor: React_2.NamedExoticComponent<TldrawEditorProps>;
|
|
6151
6146
|
|
|
6152
6147
|
/**
|
|
6153
6148
|
* Base props for the {@link tldraw#Tldraw} and {@link TldrawEditor} components.
|
|
@@ -6551,7 +6546,7 @@ export declare const tlenv: {
|
|
|
6551
6546
|
|
|
6552
6547
|
/** @public */
|
|
6553
6548
|
export declare interface TLErrorBoundaryProps {
|
|
6554
|
-
children:
|
|
6549
|
+
children: React_3.ReactNode;
|
|
6555
6550
|
onError?: ((error: unknown) => void) | null;
|
|
6556
6551
|
fallback: TLErrorFallbackComponent;
|
|
6557
6552
|
}
|
|
@@ -7507,7 +7502,6 @@ export declare interface TLUserPreferences {
|
|
|
7507
7502
|
color?: null | string;
|
|
7508
7503
|
locale?: null | string;
|
|
7509
7504
|
animationSpeed?: null | number;
|
|
7510
|
-
areKeyboardShortcutsEnabled?: boolean | null;
|
|
7511
7505
|
edgeScrollSpeed?: null | number;
|
|
7512
7506
|
colorScheme?: 'dark' | 'light' | 'system';
|
|
7513
7507
|
isSnapMode?: boolean | null;
|
|
@@ -7676,7 +7670,6 @@ export declare class UserPreferencesManager {
|
|
|
7676
7670
|
updateUserPreferences(userPreferences: Partial<TLUserPreferences>): void;
|
|
7677
7671
|
getUserPreferences(): {
|
|
7678
7672
|
animationSpeed: number;
|
|
7679
|
-
areKeyboardShortcutsEnabled: boolean;
|
|
7680
7673
|
color: string;
|
|
7681
7674
|
colorScheme: "dark" | "light" | "system" | undefined;
|
|
7682
7675
|
id: string;
|
|
@@ -7693,7 +7686,6 @@ export declare class UserPreferencesManager {
|
|
|
7693
7686
|
*/
|
|
7694
7687
|
getEdgeScrollSpeed(): number;
|
|
7695
7688
|
getAnimationSpeed(): number;
|
|
7696
|
-
getAreKeyboardShortcutsEnabled(): boolean;
|
|
7697
7689
|
getId(): string;
|
|
7698
7690
|
getName(): string;
|
|
7699
7691
|
getLocale(): string;
|
package/dist-cjs/index.js
CHANGED
|
@@ -144,7 +144,6 @@ __export(index_exports, {
|
|
|
144
144
|
getSvgAsImage: () => import_getSvgAsImage.getSvgAsImage,
|
|
145
145
|
getSvgPathFromPoints: () => import_getSvgPathFromPoints.getSvgPathFromPoints,
|
|
146
146
|
getUserPreferences: () => import_TLUserPreferences.getUserPreferences,
|
|
147
|
-
getVerticesCountForArcLength: () => import_geometry_constants.getVerticesCountForArcLength,
|
|
148
147
|
hardReset: () => import_hardReset.hardReset,
|
|
149
148
|
hardResetEditor: () => import_hardResetEditor.hardResetEditor,
|
|
150
149
|
inlineBase64AssetStore: () => import_createTLStore.inlineBase64AssetStore,
|
|
@@ -242,6 +241,11 @@ __reExport(index_exports, require("@tldraw/store"), module.exports);
|
|
|
242
241
|
__reExport(index_exports, require("@tldraw/tlschema"), module.exports);
|
|
243
242
|
__reExport(index_exports, require("@tldraw/utils"), module.exports);
|
|
244
243
|
__reExport(index_exports, require("@tldraw/validate"), module.exports);
|
|
244
|
+
var import_TldrawEditor = require("./lib/TldrawEditor");
|
|
245
|
+
var import_ErrorBoundary = require("./lib/components/ErrorBoundary");
|
|
246
|
+
var import_HTMLContainer = require("./lib/components/HTMLContainer");
|
|
247
|
+
var import_MenuClickCapture = require("./lib/components/MenuClickCapture");
|
|
248
|
+
var import_SVGContainer = require("./lib/components/SVGContainer");
|
|
245
249
|
var import_DefaultBackground = require("./lib/components/default-components/DefaultBackground");
|
|
246
250
|
var import_DefaultBrush = require("./lib/components/default-components/DefaultBrush");
|
|
247
251
|
var import_DefaultCanvas = require("./lib/components/default-components/DefaultCanvas");
|
|
@@ -259,19 +263,15 @@ var import_DefaultShapeIndicators = require("./lib/components/default-components
|
|
|
259
263
|
var import_DefaultSnapIndictor = require("./lib/components/default-components/DefaultSnapIndictor");
|
|
260
264
|
var import_DefaultSpinner = require("./lib/components/default-components/DefaultSpinner");
|
|
261
265
|
var import_DefaultSvgDefs = require("./lib/components/default-components/DefaultSvgDefs");
|
|
262
|
-
var import_ErrorBoundary = require("./lib/components/ErrorBoundary");
|
|
263
|
-
var import_HTMLContainer = require("./lib/components/HTMLContainer");
|
|
264
|
-
var import_MenuClickCapture = require("./lib/components/MenuClickCapture");
|
|
265
|
-
var import_SVGContainer = require("./lib/components/SVGContainer");
|
|
266
|
-
var import_createTLStore = require("./lib/config/createTLStore");
|
|
267
|
-
var import_createTLUser = require("./lib/config/createTLUser");
|
|
268
|
-
var import_defaultShapes = require("./lib/config/defaultShapes");
|
|
269
266
|
var import_TLEditorSnapshot = require("./lib/config/TLEditorSnapshot");
|
|
270
267
|
var import_TLSessionStateSnapshot = require("./lib/config/TLSessionStateSnapshot");
|
|
271
268
|
var import_TLUserPreferences = require("./lib/config/TLUserPreferences");
|
|
269
|
+
var import_createTLStore = require("./lib/config/createTLStore");
|
|
270
|
+
var import_createTLUser = require("./lib/config/createTLUser");
|
|
271
|
+
var import_defaultShapes = require("./lib/config/defaultShapes");
|
|
272
272
|
var import_constants = require("./lib/constants");
|
|
273
|
-
var import_BindingUtil = require("./lib/editor/bindings/BindingUtil");
|
|
274
273
|
var import_Editor = require("./lib/editor/Editor");
|
|
274
|
+
var import_BindingUtil = require("./lib/editor/bindings/BindingUtil");
|
|
275
275
|
var import_ClickManager = require("./lib/editor/managers/ClickManager/ClickManager");
|
|
276
276
|
var import_EdgeScrollManager = require("./lib/editor/managers/EdgeScrollManager/EdgeScrollManager");
|
|
277
277
|
var import_FontManager = require("./lib/editor/managers/FontManager/FontManager");
|
|
@@ -283,16 +283,16 @@ var import_SnapManager = require("./lib/editor/managers/SnapManager/SnapManager"
|
|
|
283
283
|
var import_TextManager = require("./lib/editor/managers/TextManager/TextManager");
|
|
284
284
|
var import_UserPreferencesManager = require("./lib/editor/managers/UserPreferencesManager/UserPreferencesManager");
|
|
285
285
|
var import_BaseBoxShapeUtil = require("./lib/editor/shapes/BaseBoxShapeUtil");
|
|
286
|
-
var import_GroupShapeUtil = require("./lib/editor/shapes/group/GroupShapeUtil");
|
|
287
286
|
var import_ShapeUtil = require("./lib/editor/shapes/ShapeUtil");
|
|
287
|
+
var import_GroupShapeUtil = require("./lib/editor/shapes/group/GroupShapeUtil");
|
|
288
288
|
var import_getPerfectDashProps = require("./lib/editor/shapes/shared/getPerfectDashProps");
|
|
289
289
|
var import_resizeBox = require("./lib/editor/shapes/shared/resizeBox");
|
|
290
290
|
var import_resizeScaled = require("./lib/editor/shapes/shared/resizeScaled");
|
|
291
291
|
var import_BaseBoxShapeTool = require("./lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool");
|
|
292
292
|
var import_Pointing = require("./lib/editor/tools/BaseBoxShapeTool/children/Pointing");
|
|
293
293
|
var import_StateNode = require("./lib/editor/tools/StateNode");
|
|
294
|
-
var import_event_types = require("./lib/editor/types/event-types");
|
|
295
294
|
var import_SvgExportContext = require("./lib/editor/types/SvgExportContext");
|
|
295
|
+
var import_event_types = require("./lib/editor/types/event-types");
|
|
296
296
|
var import_getSvgAsImage = require("./lib/exports/getSvgAsImage");
|
|
297
297
|
var import_environment = require("./lib/globals/environment");
|
|
298
298
|
var import_menus = require("./lib/globals/menus");
|
|
@@ -321,6 +321,8 @@ var import_useViewportHeight = require("./lib/hooks/useViewportHeight");
|
|
|
321
321
|
var import_LicenseManager = require("./lib/license/LicenseManager");
|
|
322
322
|
var import_options = require("./lib/options");
|
|
323
323
|
var import_Box = require("./lib/primitives/Box");
|
|
324
|
+
var import_Mat = require("./lib/primitives/Mat");
|
|
325
|
+
var import_Vec = require("./lib/primitives/Vec");
|
|
324
326
|
var import_easings = require("./lib/primitives/easings");
|
|
325
327
|
var import_Arc2d = require("./lib/primitives/geometry/Arc2d");
|
|
326
328
|
var import_Circle2d = require("./lib/primitives/geometry/Circle2d");
|
|
@@ -328,7 +330,6 @@ var import_CubicBezier2d = require("./lib/primitives/geometry/CubicBezier2d");
|
|
|
328
330
|
var import_CubicSpline2d = require("./lib/primitives/geometry/CubicSpline2d");
|
|
329
331
|
var import_Edge2d = require("./lib/primitives/geometry/Edge2d");
|
|
330
332
|
var import_Ellipse2d = require("./lib/primitives/geometry/Ellipse2d");
|
|
331
|
-
var import_geometry_constants = require("./lib/primitives/geometry/geometry-constants");
|
|
332
333
|
var import_Geometry2d = require("./lib/primitives/geometry/Geometry2d");
|
|
333
334
|
var import_Group2d = require("./lib/primitives/geometry/Group2d");
|
|
334
335
|
var import_Point2d = require("./lib/primitives/geometry/Point2d");
|
|
@@ -337,10 +338,8 @@ var import_Polyline2d = require("./lib/primitives/geometry/Polyline2d");
|
|
|
337
338
|
var import_Rectangle2d = require("./lib/primitives/geometry/Rectangle2d");
|
|
338
339
|
var import_Stadium2d = require("./lib/primitives/geometry/Stadium2d");
|
|
339
340
|
var import_intersect = require("./lib/primitives/intersect");
|
|
340
|
-
var import_Mat = require("./lib/primitives/Mat");
|
|
341
341
|
var import_utils2 = require("./lib/primitives/utils");
|
|
342
|
-
var
|
|
343
|
-
var import_TldrawEditor = require("./lib/TldrawEditor");
|
|
342
|
+
var import_SharedStylesMap = require("./lib/utils/SharedStylesMap");
|
|
344
343
|
var import_assets = require("./lib/utils/assets");
|
|
345
344
|
var import_browserCanvasMaxSize = require("./lib/utils/browserCanvasMaxSize");
|
|
346
345
|
var import_debug_flags = require("./lib/utils/debug-flags");
|
|
@@ -357,9 +356,8 @@ var import_reparenting = require("./lib/utils/reparenting");
|
|
|
357
356
|
var import_richText = require("./lib/utils/richText");
|
|
358
357
|
var import_rotation = require("./lib/utils/rotation");
|
|
359
358
|
var import_runtime = require("./lib/utils/runtime");
|
|
360
|
-
var import_SharedStylesMap = require("./lib/utils/SharedStylesMap");
|
|
361
|
-
var import_hardReset = require("./lib/utils/sync/hardReset");
|
|
362
359
|
var import_LocalIndexedDb = require("./lib/utils/sync/LocalIndexedDb");
|
|
360
|
+
var import_hardReset = require("./lib/utils/sync/hardReset");
|
|
363
361
|
var import_uniq = require("./lib/utils/uniq");
|
|
364
362
|
var import_window_open = require("./lib/utils/window-open");
|
|
365
363
|
function debugEnableLicensing() {
|
|
@@ -367,7 +365,7 @@ function debugEnableLicensing() {
|
|
|
367
365
|
}
|
|
368
366
|
(0, import_utils.registerTldrawLibraryVersion)(
|
|
369
367
|
"@tldraw/editor",
|
|
370
|
-
"3.15.0-canary.
|
|
368
|
+
"3.15.0-canary.db14db4f5395",
|
|
371
369
|
"cjs"
|
|
372
370
|
);
|
|
373
371
|
//# sourceMappingURL=index.js.map
|
package/dist-cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { registerTldrawLibraryVersion } from '@tldraw/utils'\nimport 'core-js/stable/array/at.js'\nimport 'core-js/stable/array/flat-map.js'\nimport 'core-js/stable/array/flat.js'\nimport 'core-js/stable/string/at.js'\nimport 'core-js/stable/string/replace-all.js'\n\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/state'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/state-react'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/store'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/tlschema'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/utils'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/validate'\n\nexport { DefaultBackground } from './lib/components/default-components/DefaultBackground'\nexport { DefaultBrush, type TLBrushProps } from './lib/components/default-components/DefaultBrush'\nexport {\n\tDefaultCanvas,\n\ttype TLCanvasComponentProps,\n} from './lib/components/default-components/DefaultCanvas'\nexport {\n\tDefaultCollaboratorHint,\n\ttype TLCollaboratorHintProps,\n} from './lib/components/default-components/DefaultCollaboratorHint'\nexport {\n\tDefaultCursor,\n\ttype TLCursorProps,\n} from './lib/components/default-components/DefaultCursor'\nexport {\n\tDefaultErrorFallback,\n\ttype TLErrorFallbackComponent,\n} from './lib/components/default-components/DefaultErrorFallback'\nexport { DefaultGrid, type TLGridProps } from './lib/components/default-components/DefaultGrid'\nexport {\n\tDefaultHandle,\n\ttype TLHandleProps,\n} from './lib/components/default-components/DefaultHandle'\nexport {\n\tDefaultHandles,\n\ttype TLHandlesProps,\n} from './lib/components/default-components/DefaultHandles'\nexport {\n\tDefaultScribble,\n\ttype TLScribbleProps,\n} from './lib/components/default-components/DefaultScribble'\nexport {\n\tDefaultSelectionBackground,\n\ttype TLSelectionBackgroundProps,\n} from './lib/components/default-components/DefaultSelectionBackground'\nexport {\n\tDefaultSelectionForeground,\n\ttype TLSelectionForegroundProps,\n} from './lib/components/default-components/DefaultSelectionForeground'\nexport { type TLShapeErrorFallbackComponent } from './lib/components/default-components/DefaultShapeErrorFallback'\nexport {\n\tDefaultShapeIndicator,\n\ttype TLShapeIndicatorProps,\n} from './lib/components/default-components/DefaultShapeIndicator'\nexport { type TLShapeIndicatorErrorFallbackComponent } from './lib/components/default-components/DefaultShapeIndicatorErrorFallback'\nexport {\n\tDefaultShapeIndicators,\n\ttype TLShapeIndicatorsProps,\n} from './lib/components/default-components/DefaultShapeIndicators'\nexport {\n\tDefaultSnapIndicator,\n\ttype TLSnapIndicatorProps,\n} from './lib/components/default-components/DefaultSnapIndictor'\nexport { DefaultSpinner } from './lib/components/default-components/DefaultSpinner'\nexport { DefaultSvgDefs } from './lib/components/default-components/DefaultSvgDefs'\nexport {\n\tErrorBoundary,\n\tOptionalErrorBoundary,\n\ttype TLErrorBoundaryProps,\n} from './lib/components/ErrorBoundary'\nexport { HTMLContainer, type HTMLContainerProps } from './lib/components/HTMLContainer'\nexport { MenuClickCapture } from './lib/components/MenuClickCapture'\nexport { SVGContainer, type SVGContainerProps } from './lib/components/SVGContainer'\nexport {\n\tcreateTLSchemaFromUtils,\n\tcreateTLStore,\n\tinlineBase64AssetStore,\n\ttype TLStoreBaseOptions,\n\ttype TLStoreEventInfo,\n\ttype TLStoreOptions,\n\ttype TLStoreSchemaOptions,\n} from './lib/config/createTLStore'\nexport { createTLUser, useTldrawUser, type TLUser } from './lib/config/createTLUser'\nexport { type TLAnyBindingUtilConstructor } from './lib/config/defaultBindings'\nexport { coreShapes, type TLAnyShapeUtilConstructor } from './lib/config/defaultShapes'\nexport {\n\tgetSnapshot,\n\tloadSnapshot,\n\ttype TLEditorSnapshot,\n\ttype TLLoadSnapshotOptions,\n} from './lib/config/TLEditorSnapshot'\nexport {\n\tcreateSessionStateSnapshotSignal,\n\textractSessionStateFromLegacySnapshot,\n\tloadSessionStateSnapshotIntoStore,\n\tTAB_ID,\n\ttype TLLoadSessionStateSnapshotOptions,\n\ttype TLSessionStateSnapshot,\n} from './lib/config/TLSessionStateSnapshot'\nexport {\n\tdefaultUserPreferences,\n\tgetFreshUserPreferences,\n\tgetUserPreferences,\n\tsetUserPreferences,\n\tUSER_COLORS,\n\tuserTypeValidator,\n\ttype TLUserPreferences,\n} from './lib/config/TLUserPreferences'\nexport { DEFAULT_ANIMATION_OPTIONS, DEFAULT_CAMERA_OPTIONS, SIDES } from './lib/constants'\nexport {\n\tBindingUtil,\n\ttype BindingOnChangeOptions,\n\ttype BindingOnCreateOptions,\n\ttype BindingOnDeleteOptions,\n\ttype BindingOnShapeChangeOptions,\n\ttype BindingOnShapeDeleteOptions,\n\ttype BindingOnShapeIsolateOptions,\n\ttype TLBindingUtilConstructor,\n} from './lib/editor/bindings/BindingUtil'\nexport {\n\tEditor,\n\ttype TLEditorOptions,\n\ttype TLEditorRunOptions,\n\ttype TLRenderingShape,\n\ttype TLResizeShapeOptions,\n} from './lib/editor/Editor'\nexport { ClickManager, type TLClickState } from './lib/editor/managers/ClickManager/ClickManager'\nexport { EdgeScrollManager } from './lib/editor/managers/EdgeScrollManager/EdgeScrollManager'\nexport {\n\tFontManager,\n\ttype TLFontFace,\n\ttype TLFontFaceSource,\n} from './lib/editor/managers/FontManager/FontManager'\nexport { HistoryManager } from './lib/editor/managers/HistoryManager/HistoryManager'\nexport {\n\tScribbleManager,\n\ttype ScribbleItem,\n} from './lib/editor/managers/ScribbleManager/ScribbleManager'\nexport {\n\tBoundsSnaps,\n\ttype BoundsSnapGeometry,\n\ttype BoundsSnapPoint,\n} from './lib/editor/managers/SnapManager/BoundsSnaps'\nexport { HandleSnaps, type HandleSnapGeometry } from './lib/editor/managers/SnapManager/HandleSnaps'\nexport {\n\tSnapManager,\n\ttype GapsSnapIndicator,\n\ttype PointsSnapIndicator,\n\ttype SnapData,\n\ttype SnapIndicator,\n} from './lib/editor/managers/SnapManager/SnapManager'\nexport {\n\tTextManager,\n\ttype TLMeasureTextOpts,\n\ttype TLMeasureTextSpanOpts,\n} from './lib/editor/managers/TextManager/TextManager'\nexport { UserPreferencesManager } from './lib/editor/managers/UserPreferencesManager/UserPreferencesManager'\nexport { BaseBoxShapeUtil, type TLBaseBoxShape } from './lib/editor/shapes/BaseBoxShapeUtil'\nexport { GroupShapeUtil } from './lib/editor/shapes/group/GroupShapeUtil'\nexport {\n\tShapeUtil,\n\ttype TLCropInfo,\n\ttype TLDragShapesInInfo,\n\ttype TLDragShapesOutInfo,\n\ttype TLDragShapesOverInfo,\n\ttype TLDropShapesOverInfo,\n\ttype TLGeometryOpts,\n\ttype TLHandleDragInfo,\n\ttype TLResizeInfo,\n\ttype TLResizeMode,\n\ttype TLShapeUtilCanBeLaidOutOpts,\n\ttype TLShapeUtilCanBindOpts,\n\ttype TLShapeUtilCanvasSvgDef,\n\ttype TLShapeUtilConstructor,\n} from './lib/editor/shapes/ShapeUtil'\nexport {\n\tgetPerfectDashProps,\n\ttype PerfectDashTerminal,\n} from './lib/editor/shapes/shared/getPerfectDashProps'\nexport { resizeBox, type ResizeBoxOptions } from './lib/editor/shapes/shared/resizeBox'\nexport { resizeScaled } from './lib/editor/shapes/shared/resizeScaled'\nexport { BaseBoxShapeTool } from './lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool'\nexport { maybeSnapToGrid } from './lib/editor/tools/BaseBoxShapeTool/children/Pointing'\nexport { StateNode, type TLStateNodeConstructor } from './lib/editor/tools/StateNode'\nexport { type TLContent } from './lib/editor/types/clipboard-types'\nexport { type TLEventMap, type TLEventMapHandler } from './lib/editor/types/emit-types'\nexport {\n\tEVENT_NAME_MAP,\n\ttype TLBaseEventInfo,\n\ttype TLCancelEvent,\n\ttype TLCancelEventInfo,\n\ttype TLClickEvent,\n\ttype TLClickEventInfo,\n\ttype TLCLickEventName,\n\ttype TLCompleteEvent,\n\ttype TLCompleteEventInfo,\n\ttype TLEnterEventHandler,\n\ttype TLEventHandlers,\n\ttype TLEventInfo,\n\ttype TLEventName,\n\ttype TLExitEventHandler,\n\ttype TLInterruptEvent,\n\ttype TLInterruptEventInfo,\n\ttype TLKeyboardEvent,\n\ttype TLKeyboardEventInfo,\n\ttype TLKeyboardEventName,\n\ttype TLPinchEvent,\n\ttype TLPinchEventInfo,\n\ttype TLPinchEventName,\n\ttype TLPointerEvent,\n\ttype TLPointerEventInfo,\n\ttype TLPointerEventName,\n\ttype TLPointerEventTarget,\n\ttype TLTickEvent,\n\ttype TLTickEventInfo,\n\ttype TLWheelEvent,\n\ttype TLWheelEventInfo,\n\ttype UiEvent,\n\ttype UiEventType,\n} from './lib/editor/types/event-types'\nexport {\n\ttype TLBaseExternalContent,\n\ttype TLEmbedExternalContent,\n\ttype TLErrorExternalContentSource,\n\ttype TLExcalidrawExternalContent,\n\ttype TLExcalidrawExternalContentSource,\n\ttype TLExternalAsset,\n\ttype TLExternalContent,\n\ttype TLExternalContentSource,\n\ttype TLFileExternalAsset,\n\ttype TLFileReplaceExternalContent,\n\ttype TLFilesExternalContent,\n\ttype TLSvgTextExternalContent,\n\ttype TLTextExternalContent,\n\ttype TLTextExternalContentSource,\n\ttype TLTldrawExternalContent,\n\ttype TLTldrawExternalContentSource,\n\ttype TLUrlExternalAsset,\n\ttype TLUrlExternalContent,\n} from './lib/editor/types/external-content'\nexport {\n\ttype TLHistoryBatchOptions,\n\ttype TLHistoryDiff,\n\ttype TLHistoryEntry,\n\ttype TLHistoryMark,\n} from './lib/editor/types/history-types'\nexport {\n\ttype OptionalKeys,\n\ttype RequiredKeys,\n\ttype TLCameraConstraints,\n\ttype TLCameraMoveOptions,\n\ttype TLCameraOptions,\n\ttype TLExportType,\n\ttype TLImageExportOptions,\n\ttype TLSvgExportOptions,\n\ttype TLSvgOptions,\n} from './lib/editor/types/misc-types'\nexport {\n\ttype TLAdjacentDirection,\n\ttype TLResizeHandle,\n\ttype TLSelectionHandle,\n} from './lib/editor/types/selection-types'\nexport {\n\tuseDelaySvgExport,\n\tuseSvgExportContext,\n\ttype SvgExportContext,\n\ttype SvgExportDef,\n} from './lib/editor/types/SvgExportContext'\nexport { getSvgAsImage } from './lib/exports/getSvgAsImage'\nexport { tlenv } from './lib/globals/environment'\nexport { tlmenus } from './lib/globals/menus'\nexport { tltime } from './lib/globals/time'\nexport {\n\tContainerProvider,\n\tuseContainer,\n\tuseContainerIfExists,\n\ttype ContainerProviderProps,\n} from './lib/hooks/useContainer'\nexport { getCursor } from './lib/hooks/useCursor'\nexport {\n\tEditorContext,\n\tEditorProvider,\n\tuseEditor,\n\tuseMaybeEditor,\n\ttype EditorProviderProps,\n} from './lib/hooks/useEditor'\nexport { useEditorComponents } from './lib/hooks/useEditorComponents'\nexport type { TLEditorComponents } from './lib/hooks/useEditorComponents'\nexport { useEvent, useReactiveEvent } from './lib/hooks/useEvent'\nexport { useGlobalMenuIsOpen } from './lib/hooks/useGlobalMenuIsOpen'\nexport { useShallowArrayIdentity, useShallowObjectIdentity } from './lib/hooks/useIdentity'\nexport { useIsCropping } from './lib/hooks/useIsCropping'\nexport { useIsDarkMode } from './lib/hooks/useIsDarkMode'\nexport { useIsEditing } from './lib/hooks/useIsEditing'\nexport { useLocalStore } from './lib/hooks/useLocalStore'\nexport { usePassThroughMouseOverEvents } from './lib/hooks/usePassThroughMouseOverEvents'\nexport { usePassThroughWheelEvents } from './lib/hooks/usePassThroughWheelEvents'\nexport { usePeerIds } from './lib/hooks/usePeerIds'\nexport { usePresence } from './lib/hooks/usePresence'\nexport { useRefState } from './lib/hooks/useRefState'\nexport {\n\tsanitizeId,\n\tsuffixSafeId,\n\tuseSharedSafeId,\n\tuseUniqueSafeId,\n\ttype SafeId,\n} from './lib/hooks/useSafeId'\nexport { useSelectionEvents } from './lib/hooks/useSelectionEvents'\nexport { useTLSchemaFromUtils, useTLStore } from './lib/hooks/useTLStore'\nexport { useTransform } from './lib/hooks/useTransform'\nexport { useViewportHeight } from './lib/hooks/useViewportHeight'\nexport {\n\tLicenseManager,\n\ttype InvalidLicenseKeyResult,\n\ttype InvalidLicenseReason,\n\ttype LicenseFromKeyResult,\n\ttype LicenseInfo,\n\ttype TestEnvironment,\n\ttype ValidLicenseKeyResult,\n} from './lib/license/LicenseManager'\nexport { defaultTldrawOptions, type TldrawOptions } from './lib/options'\nexport {\n\tBox,\n\tROTATE_CORNER_TO_SELECTION_CORNER,\n\trotateSelectionHandle,\n\ttype BoxLike,\n\ttype RotateCorner,\n\ttype SelectionCorner,\n\ttype SelectionEdge,\n\ttype SelectionHandle,\n} from './lib/primitives/Box'\nexport { EASINGS } from './lib/primitives/easings'\nexport { Arc2d } from './lib/primitives/geometry/Arc2d'\nexport { Circle2d } from './lib/primitives/geometry/Circle2d'\nexport { CubicBezier2d } from './lib/primitives/geometry/CubicBezier2d'\nexport { CubicSpline2d } from './lib/primitives/geometry/CubicSpline2d'\nexport { Edge2d } from './lib/primitives/geometry/Edge2d'\nexport { Ellipse2d } from './lib/primitives/geometry/Ellipse2d'\nexport { getVerticesCountForArcLength } from './lib/primitives/geometry/geometry-constants'\nexport {\n\tGeometry2d,\n\tGeometry2dFilters,\n\tTransformedGeometry2d,\n\ttype Geometry2dOptions,\n\ttype TransformedGeometry2dOptions,\n} from './lib/primitives/geometry/Geometry2d'\nexport { Group2d } from './lib/primitives/geometry/Group2d'\nexport { Point2d } from './lib/primitives/geometry/Point2d'\nexport { Polygon2d } from './lib/primitives/geometry/Polygon2d'\nexport { Polyline2d } from './lib/primitives/geometry/Polyline2d'\nexport { Rectangle2d } from './lib/primitives/geometry/Rectangle2d'\nexport { Stadium2d } from './lib/primitives/geometry/Stadium2d'\nexport {\n\tintersectCircleCircle,\n\tintersectCirclePolygon,\n\tintersectCirclePolyline,\n\tintersectLineSegmentCircle,\n\tintersectLineSegmentLineSegment,\n\tintersectLineSegmentPolygon,\n\tintersectLineSegmentPolyline,\n\tintersectPolygonBounds,\n\tintersectPolygonPolygon,\n\tlinesIntersect,\n\tpolygonIntersectsPolyline,\n\tpolygonsIntersect,\n} from './lib/primitives/intersect'\nexport { Mat, type MatLike, type MatModel } from './lib/primitives/Mat'\nexport {\n\tangleDistance,\n\tapproximately,\n\tareAnglesCompatible,\n\taverage,\n\tcanonicalizeRotation,\n\tcenterOfCircleFromThreePoints,\n\tclamp,\n\tclampRadians,\n\tclockwiseAngleDist,\n\tcounterClockwiseAngleDist,\n\tdegreesToRadians,\n\tgetArcMeasure,\n\tgetPointInArcT,\n\tgetPointOnCircle,\n\tgetPointsOnArc,\n\tgetPolygonVertices,\n\tHALF_PI,\n\tisSafeFloat,\n\tperimeterOfEllipse,\n\tPI,\n\tPI2,\n\tpointInPolygon,\n\tprecise,\n\tradiansToDegrees,\n\trangeIntersection,\n\tshortAngleDist,\n\tSIN,\n\tsnapAngle,\n\ttoDomPrecision,\n\ttoFixed,\n\ttoPrecision,\n} from './lib/primitives/utils'\nexport { Vec, type VecLike } from './lib/primitives/Vec'\nexport {\n\tErrorScreen,\n\tLoadingScreen,\n\tTldrawEditor,\n\tuseOnMount,\n\ttype LoadingScreenProps,\n\ttype TldrawEditorBaseProps,\n\ttype TldrawEditorProps,\n\ttype TldrawEditorStoreProps,\n\ttype TldrawEditorWithoutStoreProps,\n\ttype TldrawEditorWithStoreProps,\n\ttype TLOnMountHandler,\n} from './lib/TldrawEditor'\nexport { dataUrlToFile, getDefaultCdnBaseUrl } from './lib/utils/assets'\nexport { clampToBrowserMaxCanvasSize, type CanvasMaxSize } from './lib/utils/browserCanvasMaxSize'\nexport {\n\tdebugFlags,\n\tfeatureFlags,\n\ttype DebugFlag,\n\ttype DebugFlagDef,\n\ttype DebugFlagDefaults,\n} from './lib/utils/debug-flags'\nexport {\n\tcreateDeepLinkString,\n\tparseDeepLinkString,\n\ttype TLDeepLink,\n\ttype TLDeepLinkOptions,\n} from './lib/utils/deepLinks'\nexport {\n\tactiveElementShouldCaptureKeys,\n\tloopToHtmlElement,\n\tpreventDefault,\n\treleasePointerCapture,\n\tsetPointerCapture,\n\tstopEventPropagation,\n} from './lib/utils/dom'\nexport { getIncrementedName } from './lib/utils/getIncrementedName'\nexport { getPointerInfo } from './lib/utils/getPointerInfo'\nexport { getSvgPathFromPoints } from './lib/utils/getSvgPathFromPoints'\nexport { hardResetEditor } from './lib/utils/hardResetEditor'\nexport { isAccelKey } from './lib/utils/keyboard'\nexport { normalizeWheel } from './lib/utils/normalizeWheel'\nexport { refreshPage } from './lib/utils/refreshPage'\nexport { getDroppedShapesToNewParents, kickoutOccludedShapes } from './lib/utils/reparenting'\nexport {\n\tgetFontsFromRichText,\n\ttype RichTextFontVisitor,\n\ttype RichTextFontVisitorState,\n\ttype TiptapEditor,\n\ttype TiptapNode,\n\ttype TLTextOptions,\n} from './lib/utils/richText'\nexport {\n\tapplyRotationToSnapshotShapes,\n\tgetRotationSnapshot,\n\ttype TLRotationSnapshot,\n} from './lib/utils/rotation'\nexport { runtime, setRuntimeOverrides } from './lib/utils/runtime'\nexport {\n\tReadonlySharedStyleMap,\n\tSharedStyleMap,\n\ttype SharedStyle,\n} from './lib/utils/SharedStylesMap'\nexport { hardReset } from './lib/utils/sync/hardReset'\nexport { LocalIndexedDb, Table, type StoreName } from './lib/utils/sync/LocalIndexedDb'\nexport { type TLStoreWithStatus } from './lib/utils/sync/StoreWithStatus'\nexport { uniq } from './lib/utils/uniq'\nexport { openWindow } from './lib/utils/window-open'\n\n/**\n * @deprecated Licensing is now enabled in the tldraw SDK.\n * @public */\nexport function debugEnableLicensing() {\n\t// noop\n\treturn\n}\n\nregisterTldrawLibraryVersion(\n\t(globalThis as any).TLDRAW_LIBRARY_NAME,\n\t(globalThis as any).TLDRAW_LIBRARY_VERSION,\n\t(globalThis as any).TLDRAW_LIBRARY_MODULES\n)\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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4
|
+
"sourcesContent": ["import { registerTldrawLibraryVersion } from '@tldraw/utils'\nimport 'core-js/stable/array/at.js'\nimport 'core-js/stable/array/flat-map.js'\nimport 'core-js/stable/array/flat.js'\nimport 'core-js/stable/string/at.js'\nimport 'core-js/stable/string/replace-all.js'\n\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/state'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/state-react'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/store'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/tlschema'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/utils'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/validate'\n\nexport {\n\tErrorScreen,\n\tLoadingScreen,\n\tTldrawEditor,\n\tuseOnMount,\n\ttype LoadingScreenProps,\n\ttype TLOnMountHandler,\n\ttype TldrawEditorBaseProps,\n\ttype TldrawEditorProps,\n\ttype TldrawEditorStoreProps,\n\ttype TldrawEditorWithStoreProps,\n\ttype TldrawEditorWithoutStoreProps,\n} from './lib/TldrawEditor'\nexport {\n\tErrorBoundary,\n\tOptionalErrorBoundary,\n\ttype TLErrorBoundaryProps,\n} from './lib/components/ErrorBoundary'\nexport { HTMLContainer, type HTMLContainerProps } from './lib/components/HTMLContainer'\nexport { MenuClickCapture } from './lib/components/MenuClickCapture'\nexport { SVGContainer, type SVGContainerProps } from './lib/components/SVGContainer'\nexport { DefaultBackground } from './lib/components/default-components/DefaultBackground'\nexport { DefaultBrush, type TLBrushProps } from './lib/components/default-components/DefaultBrush'\nexport {\n\tDefaultCanvas,\n\ttype TLCanvasComponentProps,\n} from './lib/components/default-components/DefaultCanvas'\nexport {\n\tDefaultCollaboratorHint,\n\ttype TLCollaboratorHintProps,\n} from './lib/components/default-components/DefaultCollaboratorHint'\nexport {\n\tDefaultCursor,\n\ttype TLCursorProps,\n} from './lib/components/default-components/DefaultCursor'\nexport {\n\tDefaultErrorFallback,\n\ttype TLErrorFallbackComponent,\n} from './lib/components/default-components/DefaultErrorFallback'\nexport { DefaultGrid, type TLGridProps } from './lib/components/default-components/DefaultGrid'\nexport {\n\tDefaultHandle,\n\ttype TLHandleProps,\n} from './lib/components/default-components/DefaultHandle'\nexport {\n\tDefaultHandles,\n\ttype TLHandlesProps,\n} from './lib/components/default-components/DefaultHandles'\nexport {\n\tDefaultScribble,\n\ttype TLScribbleProps,\n} from './lib/components/default-components/DefaultScribble'\nexport {\n\tDefaultSelectionBackground,\n\ttype TLSelectionBackgroundProps,\n} from './lib/components/default-components/DefaultSelectionBackground'\nexport {\n\tDefaultSelectionForeground,\n\ttype TLSelectionForegroundProps,\n} from './lib/components/default-components/DefaultSelectionForeground'\nexport { type TLShapeErrorFallbackComponent } from './lib/components/default-components/DefaultShapeErrorFallback'\nexport {\n\tDefaultShapeIndicator,\n\ttype TLShapeIndicatorProps,\n} from './lib/components/default-components/DefaultShapeIndicator'\nexport { type TLShapeIndicatorErrorFallbackComponent } from './lib/components/default-components/DefaultShapeIndicatorErrorFallback'\nexport {\n\tDefaultShapeIndicators,\n\ttype TLShapeIndicatorsProps,\n} from './lib/components/default-components/DefaultShapeIndicators'\nexport {\n\tDefaultSnapIndicator,\n\ttype TLSnapIndicatorProps,\n} from './lib/components/default-components/DefaultSnapIndictor'\nexport { DefaultSpinner } from './lib/components/default-components/DefaultSpinner'\nexport { DefaultSvgDefs } from './lib/components/default-components/DefaultSvgDefs'\nexport {\n\tgetSnapshot,\n\tloadSnapshot,\n\ttype TLEditorSnapshot,\n\ttype TLLoadSnapshotOptions,\n} from './lib/config/TLEditorSnapshot'\nexport {\n\tTAB_ID,\n\tcreateSessionStateSnapshotSignal,\n\textractSessionStateFromLegacySnapshot,\n\tloadSessionStateSnapshotIntoStore,\n\ttype TLLoadSessionStateSnapshotOptions,\n\ttype TLSessionStateSnapshot,\n} from './lib/config/TLSessionStateSnapshot'\nexport {\n\tUSER_COLORS,\n\tdefaultUserPreferences,\n\tgetFreshUserPreferences,\n\tgetUserPreferences,\n\tsetUserPreferences,\n\tuserTypeValidator,\n\ttype TLUserPreferences,\n} from './lib/config/TLUserPreferences'\nexport {\n\tcreateTLSchemaFromUtils,\n\tcreateTLStore,\n\tinlineBase64AssetStore,\n\ttype TLStoreBaseOptions,\n\ttype TLStoreEventInfo,\n\ttype TLStoreOptions,\n\ttype TLStoreSchemaOptions,\n} from './lib/config/createTLStore'\nexport { createTLUser, useTldrawUser, type TLUser } from './lib/config/createTLUser'\nexport { type TLAnyBindingUtilConstructor } from './lib/config/defaultBindings'\nexport { coreShapes, type TLAnyShapeUtilConstructor } from './lib/config/defaultShapes'\nexport { DEFAULT_ANIMATION_OPTIONS, DEFAULT_CAMERA_OPTIONS, SIDES } from './lib/constants'\nexport {\n\tEditor,\n\ttype TLEditorOptions,\n\ttype TLEditorRunOptions,\n\ttype TLRenderingShape,\n\ttype TLResizeShapeOptions,\n} from './lib/editor/Editor'\nexport {\n\tBindingUtil,\n\ttype BindingOnChangeOptions,\n\ttype BindingOnCreateOptions,\n\ttype BindingOnDeleteOptions,\n\ttype BindingOnShapeChangeOptions,\n\ttype BindingOnShapeDeleteOptions,\n\ttype BindingOnShapeIsolateOptions,\n\ttype TLBindingUtilConstructor,\n} from './lib/editor/bindings/BindingUtil'\nexport { ClickManager, type TLClickState } from './lib/editor/managers/ClickManager/ClickManager'\nexport { EdgeScrollManager } from './lib/editor/managers/EdgeScrollManager/EdgeScrollManager'\nexport {\n\tFontManager,\n\ttype TLFontFace,\n\ttype TLFontFaceSource,\n} from './lib/editor/managers/FontManager/FontManager'\nexport { HistoryManager } from './lib/editor/managers/HistoryManager/HistoryManager'\nexport {\n\tScribbleManager,\n\ttype ScribbleItem,\n} from './lib/editor/managers/ScribbleManager/ScribbleManager'\nexport {\n\tBoundsSnaps,\n\ttype BoundsSnapGeometry,\n\ttype BoundsSnapPoint,\n} from './lib/editor/managers/SnapManager/BoundsSnaps'\nexport { HandleSnaps, type HandleSnapGeometry } from './lib/editor/managers/SnapManager/HandleSnaps'\nexport {\n\tSnapManager,\n\ttype GapsSnapIndicator,\n\ttype PointsSnapIndicator,\n\ttype SnapData,\n\ttype SnapIndicator,\n} from './lib/editor/managers/SnapManager/SnapManager'\nexport {\n\tTextManager,\n\ttype TLMeasureTextOpts,\n\ttype TLMeasureTextSpanOpts,\n} from './lib/editor/managers/TextManager/TextManager'\nexport { UserPreferencesManager } from './lib/editor/managers/UserPreferencesManager/UserPreferencesManager'\nexport { BaseBoxShapeUtil, type TLBaseBoxShape } from './lib/editor/shapes/BaseBoxShapeUtil'\nexport {\n\tShapeUtil,\n\ttype TLCropInfo,\n\ttype TLDragShapesInInfo,\n\ttype TLDragShapesOutInfo,\n\ttype TLDragShapesOverInfo,\n\ttype TLDropShapesOverInfo,\n\ttype TLGeometryOpts,\n\ttype TLHandleDragInfo,\n\ttype TLResizeInfo,\n\ttype TLResizeMode,\n\ttype TLShapeUtilCanBeLaidOutOpts,\n\ttype TLShapeUtilCanBindOpts,\n\ttype TLShapeUtilCanvasSvgDef,\n\ttype TLShapeUtilConstructor,\n} from './lib/editor/shapes/ShapeUtil'\nexport { GroupShapeUtil } from './lib/editor/shapes/group/GroupShapeUtil'\nexport {\n\tgetPerfectDashProps,\n\ttype PerfectDashTerminal,\n} from './lib/editor/shapes/shared/getPerfectDashProps'\nexport { resizeBox, type ResizeBoxOptions } from './lib/editor/shapes/shared/resizeBox'\nexport { resizeScaled } from './lib/editor/shapes/shared/resizeScaled'\nexport { BaseBoxShapeTool } from './lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool'\nexport { maybeSnapToGrid } from './lib/editor/tools/BaseBoxShapeTool/children/Pointing'\nexport { StateNode, type TLStateNodeConstructor } from './lib/editor/tools/StateNode'\nexport {\n\tuseDelaySvgExport,\n\tuseSvgExportContext,\n\ttype SvgExportContext,\n\ttype SvgExportDef,\n} from './lib/editor/types/SvgExportContext'\nexport { type TLContent } from './lib/editor/types/clipboard-types'\nexport { type TLEventMap, type TLEventMapHandler } from './lib/editor/types/emit-types'\nexport {\n\tEVENT_NAME_MAP,\n\ttype TLBaseEventInfo,\n\ttype TLCLickEventName,\n\ttype TLCancelEvent,\n\ttype TLCancelEventInfo,\n\ttype TLClickEvent,\n\ttype TLClickEventInfo,\n\ttype TLCompleteEvent,\n\ttype TLCompleteEventInfo,\n\ttype TLEnterEventHandler,\n\ttype TLEventHandlers,\n\ttype TLEventInfo,\n\ttype TLEventName,\n\ttype TLExitEventHandler,\n\ttype TLInterruptEvent,\n\ttype TLInterruptEventInfo,\n\ttype TLKeyboardEvent,\n\ttype TLKeyboardEventInfo,\n\ttype TLKeyboardEventName,\n\ttype TLPinchEvent,\n\ttype TLPinchEventInfo,\n\ttype TLPinchEventName,\n\ttype TLPointerEvent,\n\ttype TLPointerEventInfo,\n\ttype TLPointerEventName,\n\ttype TLPointerEventTarget,\n\ttype TLTickEvent,\n\ttype TLTickEventInfo,\n\ttype TLWheelEvent,\n\ttype TLWheelEventInfo,\n\ttype UiEvent,\n\ttype UiEventType,\n} from './lib/editor/types/event-types'\nexport {\n\ttype TLBaseExternalContent,\n\ttype TLEmbedExternalContent,\n\ttype TLErrorExternalContentSource,\n\ttype TLExcalidrawExternalContent,\n\ttype TLExcalidrawExternalContentSource,\n\ttype TLExternalAsset,\n\ttype TLExternalContent,\n\ttype TLExternalContentSource,\n\ttype TLFileExternalAsset,\n\ttype TLFileReplaceExternalContent,\n\ttype TLFilesExternalContent,\n\ttype TLSvgTextExternalContent,\n\ttype TLTextExternalContent,\n\ttype TLTextExternalContentSource,\n\ttype TLTldrawExternalContent,\n\ttype TLTldrawExternalContentSource,\n\ttype TLUrlExternalAsset,\n\ttype TLUrlExternalContent,\n} from './lib/editor/types/external-content'\nexport {\n\ttype TLHistoryBatchOptions,\n\ttype TLHistoryDiff,\n\ttype TLHistoryEntry,\n\ttype TLHistoryMark,\n} from './lib/editor/types/history-types'\nexport {\n\ttype OptionalKeys,\n\ttype RequiredKeys,\n\ttype TLCameraConstraints,\n\ttype TLCameraMoveOptions,\n\ttype TLCameraOptions,\n\ttype TLExportType,\n\ttype TLImageExportOptions,\n\ttype TLSvgExportOptions,\n\ttype TLSvgOptions,\n} from './lib/editor/types/misc-types'\nexport {\n\ttype TLAdjacentDirection,\n\ttype TLResizeHandle,\n\ttype TLSelectionHandle,\n} from './lib/editor/types/selection-types'\nexport { getSvgAsImage } from './lib/exports/getSvgAsImage'\nexport { tlenv } from './lib/globals/environment'\nexport { tlmenus } from './lib/globals/menus'\nexport { tltime } from './lib/globals/time'\nexport {\n\tContainerProvider,\n\tuseContainer,\n\tuseContainerIfExists,\n\ttype ContainerProviderProps,\n} from './lib/hooks/useContainer'\nexport { getCursor } from './lib/hooks/useCursor'\nexport {\n\tEditorContext,\n\tEditorProvider,\n\tuseEditor,\n\tuseMaybeEditor,\n\ttype EditorProviderProps,\n} from './lib/hooks/useEditor'\nexport { useEditorComponents } from './lib/hooks/useEditorComponents'\nexport type { TLEditorComponents } from './lib/hooks/useEditorComponents'\nexport { useEvent, useReactiveEvent } from './lib/hooks/useEvent'\nexport { useGlobalMenuIsOpen } from './lib/hooks/useGlobalMenuIsOpen'\nexport { useShallowArrayIdentity, useShallowObjectIdentity } from './lib/hooks/useIdentity'\nexport { useIsCropping } from './lib/hooks/useIsCropping'\nexport { useIsDarkMode } from './lib/hooks/useIsDarkMode'\nexport { useIsEditing } from './lib/hooks/useIsEditing'\nexport { useLocalStore } from './lib/hooks/useLocalStore'\nexport { usePassThroughMouseOverEvents } from './lib/hooks/usePassThroughMouseOverEvents'\nexport { usePassThroughWheelEvents } from './lib/hooks/usePassThroughWheelEvents'\nexport { usePeerIds } from './lib/hooks/usePeerIds'\nexport { usePresence } from './lib/hooks/usePresence'\nexport { useRefState } from './lib/hooks/useRefState'\nexport {\n\tsanitizeId,\n\tsuffixSafeId,\n\tuseSharedSafeId,\n\tuseUniqueSafeId,\n\ttype SafeId,\n} from './lib/hooks/useSafeId'\nexport { useSelectionEvents } from './lib/hooks/useSelectionEvents'\nexport { useTLSchemaFromUtils, useTLStore } from './lib/hooks/useTLStore'\nexport { useTransform } from './lib/hooks/useTransform'\nexport { useViewportHeight } from './lib/hooks/useViewportHeight'\nexport {\n\tLicenseManager,\n\ttype InvalidLicenseKeyResult,\n\ttype InvalidLicenseReason,\n\ttype LicenseFromKeyResult,\n\ttype LicenseInfo,\n\ttype TestEnvironment,\n\ttype ValidLicenseKeyResult,\n} from './lib/license/LicenseManager'\nexport { defaultTldrawOptions, type TldrawOptions } from './lib/options'\nexport {\n\tBox,\n\tROTATE_CORNER_TO_SELECTION_CORNER,\n\trotateSelectionHandle,\n\ttype BoxLike,\n\ttype RotateCorner,\n\ttype SelectionCorner,\n\ttype SelectionEdge,\n\ttype SelectionHandle,\n} from './lib/primitives/Box'\nexport { Mat, type MatLike, type MatModel } from './lib/primitives/Mat'\nexport { Vec, type VecLike } from './lib/primitives/Vec'\nexport { EASINGS } from './lib/primitives/easings'\nexport { Arc2d } from './lib/primitives/geometry/Arc2d'\nexport { Circle2d } from './lib/primitives/geometry/Circle2d'\nexport { CubicBezier2d } from './lib/primitives/geometry/CubicBezier2d'\nexport { CubicSpline2d } from './lib/primitives/geometry/CubicSpline2d'\nexport { Edge2d } from './lib/primitives/geometry/Edge2d'\nexport { Ellipse2d } from './lib/primitives/geometry/Ellipse2d'\nexport {\n\tGeometry2d,\n\tGeometry2dFilters,\n\tTransformedGeometry2d,\n\ttype Geometry2dOptions,\n\ttype TransformedGeometry2dOptions,\n} from './lib/primitives/geometry/Geometry2d'\nexport { Group2d } from './lib/primitives/geometry/Group2d'\nexport { Point2d } from './lib/primitives/geometry/Point2d'\nexport { Polygon2d } from './lib/primitives/geometry/Polygon2d'\nexport { Polyline2d } from './lib/primitives/geometry/Polyline2d'\nexport { Rectangle2d } from './lib/primitives/geometry/Rectangle2d'\nexport { Stadium2d } from './lib/primitives/geometry/Stadium2d'\nexport {\n\tintersectCircleCircle,\n\tintersectCirclePolygon,\n\tintersectCirclePolyline,\n\tintersectLineSegmentCircle,\n\tintersectLineSegmentLineSegment,\n\tintersectLineSegmentPolygon,\n\tintersectLineSegmentPolyline,\n\tintersectPolygonBounds,\n\tintersectPolygonPolygon,\n\tlinesIntersect,\n\tpolygonIntersectsPolyline,\n\tpolygonsIntersect,\n} from './lib/primitives/intersect'\nexport {\n\tHALF_PI,\n\tPI,\n\tPI2,\n\tSIN,\n\tangleDistance,\n\tapproximately,\n\tareAnglesCompatible,\n\taverage,\n\tcanonicalizeRotation,\n\tcenterOfCircleFromThreePoints,\n\tclamp,\n\tclampRadians,\n\tclockwiseAngleDist,\n\tcounterClockwiseAngleDist,\n\tdegreesToRadians,\n\tgetArcMeasure,\n\tgetPointInArcT,\n\tgetPointOnCircle,\n\tgetPointsOnArc,\n\tgetPolygonVertices,\n\tisSafeFloat,\n\tperimeterOfEllipse,\n\tpointInPolygon,\n\tprecise,\n\tradiansToDegrees,\n\trangeIntersection,\n\tshortAngleDist,\n\tsnapAngle,\n\ttoDomPrecision,\n\ttoFixed,\n\ttoPrecision,\n} from './lib/primitives/utils'\nexport {\n\tReadonlySharedStyleMap,\n\tSharedStyleMap,\n\ttype SharedStyle,\n} from './lib/utils/SharedStylesMap'\nexport { dataUrlToFile, getDefaultCdnBaseUrl } from './lib/utils/assets'\nexport { clampToBrowserMaxCanvasSize, type CanvasMaxSize } from './lib/utils/browserCanvasMaxSize'\nexport {\n\tdebugFlags,\n\tfeatureFlags,\n\ttype DebugFlag,\n\ttype DebugFlagDef,\n\ttype DebugFlagDefaults,\n} from './lib/utils/debug-flags'\nexport {\n\tcreateDeepLinkString,\n\tparseDeepLinkString,\n\ttype TLDeepLink,\n\ttype TLDeepLinkOptions,\n} from './lib/utils/deepLinks'\nexport {\n\tactiveElementShouldCaptureKeys,\n\tloopToHtmlElement,\n\tpreventDefault,\n\treleasePointerCapture,\n\tsetPointerCapture,\n\tstopEventPropagation,\n} from './lib/utils/dom'\nexport { getIncrementedName } from './lib/utils/getIncrementedName'\nexport { getPointerInfo } from './lib/utils/getPointerInfo'\nexport { getSvgPathFromPoints } from './lib/utils/getSvgPathFromPoints'\nexport { hardResetEditor } from './lib/utils/hardResetEditor'\nexport { isAccelKey } from './lib/utils/keyboard'\nexport { normalizeWheel } from './lib/utils/normalizeWheel'\nexport { refreshPage } from './lib/utils/refreshPage'\nexport { getDroppedShapesToNewParents, kickoutOccludedShapes } from './lib/utils/reparenting'\nexport {\n\tgetFontsFromRichText,\n\ttype RichTextFontVisitor,\n\ttype RichTextFontVisitorState,\n\ttype TLTextOptions,\n\ttype TiptapEditor,\n\ttype TiptapNode,\n} from './lib/utils/richText'\nexport {\n\tapplyRotationToSnapshotShapes,\n\tgetRotationSnapshot,\n\ttype TLRotationSnapshot,\n} from './lib/utils/rotation'\nexport { runtime, setRuntimeOverrides } from './lib/utils/runtime'\nexport { LocalIndexedDb, Table, type StoreName } from './lib/utils/sync/LocalIndexedDb'\nexport { type TLStoreWithStatus } from './lib/utils/sync/StoreWithStatus'\nexport { hardReset } from './lib/utils/sync/hardReset'\nexport { uniq } from './lib/utils/uniq'\nexport { openWindow } from './lib/utils/window-open'\n\n/**\n * @deprecated Licensing is now enabled in the tldraw SDK.\n * @public */\nexport function debugEnableLicensing() {\n\t// noop\n\treturn\n}\n\nregisterTldrawLibraryVersion(\n\t(globalThis as any).TLDRAW_LIBRARY_NAME,\n\t(globalThis as any).TLDRAW_LIBRARY_VERSION,\n\t(globalThis as any).TLDRAW_LIBRARY_MODULES\n)\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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O;AACP,qBAAwB;AACxB,qBAAwB;AACxB,uBAA0B;AAC1B,wBAA2B;AAC3B,yBAA4B;AAC5B,uBAA0B;AAC1B,uBAaO;AACP,IAAAC,gBAgCO;AACP,6BAIO;AACP,oBAAoD;AACpD,kCAAgE;AAChE,yBAMO;AACP,uBAKO;AACP,iBAOO;AACP,gCAAmC;AACnC,4BAA+B;AAC/B,kCAAqC;AACrC,6BAAgC;AAChC,sBAA2B;AAC3B,4BAA+B;AAC/B,yBAA4B;AAC5B,yBAAoE;AACpE,sBAOO;AACP,sBAIO;AACP,qBAA6C;AAC7C,4BAAsD;AAEtD,uBAA0B;AAC1B,kBAAqB;AACrB,yBAA2B;AAKpB,SAAS,uBAAuB;AAEtC;AACD;AAAA,IAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF;",
|
|
6
6
|
"names": ["import_at", "import_utils"]
|
|
7
7
|
}
|
|
@@ -39,7 +39,6 @@ const userTypeValidator = import_validate.T.object({
|
|
|
39
39
|
// N.B. These are duplicated in TLdrawAppUser.
|
|
40
40
|
locale: import_validate.T.string.nullable().optional(),
|
|
41
41
|
animationSpeed: import_validate.T.number.nullable().optional(),
|
|
42
|
-
areKeyboardShortcutsEnabled: import_validate.T.boolean.nullable().optional(),
|
|
43
42
|
edgeScrollSpeed: import_validate.T.number.nullable().optional(),
|
|
44
43
|
colorScheme: import_validate.T.literalEnum("light", "dark", "system").optional(),
|
|
45
44
|
isSnapMode: import_validate.T.boolean.nullable().optional(),
|
|
@@ -55,8 +54,7 @@ const Versions = {
|
|
|
55
54
|
AddExcalidrawSelectMode: 5,
|
|
56
55
|
AddDynamicSizeMode: 6,
|
|
57
56
|
AllowSystemColorScheme: 7,
|
|
58
|
-
AddPasteAtCursor: 8
|
|
59
|
-
AddKeyboardShortcuts: 9
|
|
57
|
+
AddPasteAtCursor: 8
|
|
60
58
|
};
|
|
61
59
|
const CURRENT_VERSION = Math.max(...Object.values(Versions));
|
|
62
60
|
function migrateSnapshot(data) {
|
|
@@ -88,9 +86,6 @@ function migrateSnapshot(data) {
|
|
|
88
86
|
if (data.version < Versions.AddPasteAtCursor) {
|
|
89
87
|
data.user.isPasteAtCursorMode = false;
|
|
90
88
|
}
|
|
91
|
-
if (data.version < Versions.AddKeyboardShortcuts) {
|
|
92
|
-
data.user.areKeyboardShortcutsEnabled = true;
|
|
93
|
-
}
|
|
94
89
|
data.version = CURRENT_VERSION;
|
|
95
90
|
}
|
|
96
91
|
const USER_COLORS = [
|
|
@@ -123,7 +118,6 @@ const defaultUserPreferences = Object.freeze({
|
|
|
123
118
|
// N.B. These are duplicated in TLdrawAppUser.
|
|
124
119
|
edgeScrollSpeed: 1,
|
|
125
120
|
animationSpeed: userPrefersReducedMotion() ? 0 : 1,
|
|
126
|
-
areKeyboardShortcutsEnabled: true,
|
|
127
121
|
isSnapMode: false,
|
|
128
122
|
isWrapMode: false,
|
|
129
123
|
isDynamicSizeMode: false,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/config/TLUserPreferences.ts"],
|
|
4
|
-
"sourcesContent": ["import { atom } from '@tldraw/state'\nimport { getDefaultTranslationLocale } from '@tldraw/tlschema'\nimport { getFromLocalStorage, setInLocalStorage, structuredClone, uniqueId } from '@tldraw/utils'\nimport { T } from '@tldraw/validate'\n\nconst USER_DATA_KEY = 'TLDRAW_USER_DATA_v3'\n\n/**\n * A user of tldraw\n *\n * @public\n */\nexport interface TLUserPreferences {\n\tid: string\n\tname?: string | null\n\tcolor?: string | null\n\t// N.B. These are duplicated in TLdrawAppUser.\n\tlocale?: string | null\n\tanimationSpeed?: number | null\n\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAqB;AACrB,sBAA4C;AAC5C,mBAAkF;AAClF,sBAAkB;AAElB,MAAM,gBAAgB;
|
|
4
|
+
"sourcesContent": ["import { atom } from '@tldraw/state'\nimport { getDefaultTranslationLocale } from '@tldraw/tlschema'\nimport { getFromLocalStorage, setInLocalStorage, structuredClone, uniqueId } from '@tldraw/utils'\nimport { T } from '@tldraw/validate'\n\nconst USER_DATA_KEY = 'TLDRAW_USER_DATA_v3'\n\n/**\n * A user of tldraw\n *\n * @public\n */\nexport interface TLUserPreferences {\n\tid: string\n\tname?: string | null\n\tcolor?: string | null\n\t// N.B. These are duplicated in TLdrawAppUser.\n\tlocale?: string | null\n\tanimationSpeed?: number | null\n\tedgeScrollSpeed?: number | null\n\tcolorScheme?: 'light' | 'dark' | 'system'\n\tisSnapMode?: boolean | null\n\tisWrapMode?: boolean | null\n\tisDynamicSizeMode?: boolean | null\n\tisPasteAtCursorMode?: boolean | null\n}\n\ninterface UserDataSnapshot {\n\tversion: number\n\tuser: TLUserPreferences\n}\n\ninterface UserChangeBroadcastMessage {\n\ttype: typeof broadcastEventKey\n\torigin: string\n\tdata: UserDataSnapshot\n}\n\n/** @public */\nexport const userTypeValidator: T.Validator<TLUserPreferences> = T.object<TLUserPreferences>({\n\tid: T.string,\n\tname: T.string.nullable().optional(),\n\tcolor: T.string.nullable().optional(),\n\t// N.B. These are duplicated in TLdrawAppUser.\n\tlocale: T.string.nullable().optional(),\n\tanimationSpeed: T.number.nullable().optional(),\n\tedgeScrollSpeed: T.number.nullable().optional(),\n\tcolorScheme: T.literalEnum('light', 'dark', 'system').optional(),\n\tisSnapMode: T.boolean.nullable().optional(),\n\tisWrapMode: T.boolean.nullable().optional(),\n\tisDynamicSizeMode: T.boolean.nullable().optional(),\n\tisPasteAtCursorMode: T.boolean.nullable().optional(),\n})\n\nconst Versions = {\n\tAddAnimationSpeed: 1,\n\tAddIsSnapMode: 2,\n\tMakeFieldsNullable: 3,\n\tAddEdgeScrollSpeed: 4,\n\tAddExcalidrawSelectMode: 5,\n\tAddDynamicSizeMode: 6,\n\tAllowSystemColorScheme: 7,\n\tAddPasteAtCursor: 8,\n} as const\n\nconst CURRENT_VERSION = Math.max(...Object.values(Versions))\n\nfunction migrateSnapshot(data: { version: number; user: any }) {\n\tif (data.version < Versions.AddAnimationSpeed) {\n\t\tdata.user.animationSpeed = 1\n\t}\n\tif (data.version < Versions.AddIsSnapMode) {\n\t\tdata.user.isSnapMode = false\n\t}\n\tif (data.version < Versions.MakeFieldsNullable) {\n\t\t// noop\n\t}\n\tif (data.version < Versions.AddEdgeScrollSpeed) {\n\t\tdata.user.edgeScrollSpeed = 1\n\t}\n\tif (data.version < Versions.AddExcalidrawSelectMode) {\n\t\tdata.user.isWrapMode = false\n\t}\n\tif (data.version < Versions.AllowSystemColorScheme) {\n\t\tif (data.user.isDarkMode === true) {\n\t\t\tdata.user.colorScheme = 'dark'\n\t\t} else if (data.user.isDarkMode === false) {\n\t\t\tdata.user.colorScheme = 'light'\n\t\t}\n\t\tdelete data.user.isDarkMode\n\t}\n\n\tif (data.version < Versions.AddDynamicSizeMode) {\n\t\tdata.user.isDynamicSizeMode = false\n\t}\n\tif (data.version < Versions.AddPasteAtCursor) {\n\t\tdata.user.isPasteAtCursorMode = false\n\t}\n\n\t// finally\n\tdata.version = CURRENT_VERSION\n}\n\n/** @internal */\nexport const USER_COLORS = [\n\t'#FF802B',\n\t'#EC5E41',\n\t'#F2555A',\n\t'#F04F88',\n\t'#E34BA9',\n\t'#BD54C6',\n\t'#9D5BD2',\n\t'#7B66DC',\n\t'#02B1CC',\n\t'#11B3A3',\n\t'#39B178',\n\t'#55B467',\n] as const\n\nfunction getRandomColor() {\n\treturn USER_COLORS[Math.floor(Math.random() * USER_COLORS.length)]\n}\n\n/** @internal */\nexport function userPrefersReducedMotion() {\n\tif (typeof window !== 'undefined' && 'matchMedia' in window) {\n\t\treturn window.matchMedia?.('(prefers-reduced-motion: reduce)')?.matches ?? false\n\t}\n\n\treturn false\n}\n\n/** @public */\nexport const defaultUserPreferences = Object.freeze({\n\tname: '',\n\tlocale: getDefaultTranslationLocale(),\n\tcolor: getRandomColor(),\n\n\t// N.B. These are duplicated in TLdrawAppUser.\n\tedgeScrollSpeed: 1,\n\tanimationSpeed: userPrefersReducedMotion() ? 0 : 1,\n\tisSnapMode: false,\n\tisWrapMode: false,\n\tisDynamicSizeMode: false,\n\tisPasteAtCursorMode: false,\n\tcolorScheme: 'light',\n}) satisfies Readonly<Omit<TLUserPreferences, 'id'>>\n\n/** @public */\nexport function getFreshUserPreferences(): TLUserPreferences {\n\treturn {\n\t\tid: uniqueId(),\n\t\tcolor: getRandomColor(),\n\t}\n}\n\nfunction migrateUserPreferences(userData: unknown): TLUserPreferences {\n\tif (userData === null || typeof userData !== 'object') {\n\t\treturn getFreshUserPreferences()\n\t}\n\n\tif (!('version' in userData) || !('user' in userData) || typeof userData.version !== 'number') {\n\t\treturn getFreshUserPreferences()\n\t}\n\n\tconst snapshot = structuredClone(userData) as any\n\n\tmigrateSnapshot(snapshot)\n\n\ttry {\n\t\treturn userTypeValidator.validate(snapshot.user)\n\t} catch {\n\t\treturn getFreshUserPreferences()\n\t}\n}\n\nfunction loadUserPreferences(): TLUserPreferences {\n\tconst userData = (JSON.parse(getFromLocalStorage(USER_DATA_KEY) || 'null') ??\n\t\tnull) as null | UserDataSnapshot\n\n\treturn migrateUserPreferences(userData)\n}\n\nconst globalUserPreferences = atom<TLUserPreferences | null>('globalUserData', null)\n\nfunction storeUserPreferences() {\n\tsetInLocalStorage(\n\t\tUSER_DATA_KEY,\n\t\tJSON.stringify({\n\t\t\tversion: CURRENT_VERSION,\n\t\t\tuser: globalUserPreferences.get(),\n\t\t})\n\t)\n}\n\n/** @public */\nexport function setUserPreferences(user: TLUserPreferences) {\n\tuserTypeValidator.validate(user)\n\tglobalUserPreferences.set(user)\n\tstoreUserPreferences()\n\tbroadcastUserPreferencesChange()\n}\n\nconst isTest = typeof process !== 'undefined' && process.env.NODE_ENV === 'test'\n\nconst channel =\n\ttypeof BroadcastChannel !== 'undefined' && !isTest\n\t\t? new BroadcastChannel('tldraw-user-sync')\n\t\t: null\n\nchannel?.addEventListener('message', (e) => {\n\tconst data = e.data as undefined | UserChangeBroadcastMessage\n\tif (data?.type === broadcastEventKey && data?.origin !== getBroadcastOrigin()) {\n\t\tglobalUserPreferences.set(migrateUserPreferences(data.data))\n\t}\n})\n\nlet _broadcastOrigin = null as null | string\nfunction getBroadcastOrigin() {\n\tif (_broadcastOrigin === null) {\n\t\t_broadcastOrigin = uniqueId()\n\t}\n\treturn _broadcastOrigin\n}\nconst broadcastEventKey = 'tldraw-user-preferences-change' as const\n\nfunction broadcastUserPreferencesChange() {\n\tchannel?.postMessage({\n\t\ttype: broadcastEventKey,\n\t\torigin: getBroadcastOrigin(),\n\t\tdata: {\n\t\t\tuser: getUserPreferences(),\n\t\t\tversion: CURRENT_VERSION,\n\t\t},\n\t} satisfies UserChangeBroadcastMessage)\n}\n\n/** @public */\nexport function getUserPreferences(): TLUserPreferences {\n\tlet prefs = globalUserPreferences.get()\n\tif (!prefs) {\n\t\tprefs = loadUserPreferences()\n\t\tsetUserPreferences(prefs)\n\t}\n\treturn prefs\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAqB;AACrB,sBAA4C;AAC5C,mBAAkF;AAClF,sBAAkB;AAElB,MAAM,gBAAgB;AAkCf,MAAM,oBAAoD,kBAAE,OAA0B;AAAA,EAC5F,IAAI,kBAAE;AAAA,EACN,MAAM,kBAAE,OAAO,SAAS,EAAE,SAAS;AAAA,EACnC,OAAO,kBAAE,OAAO,SAAS,EAAE,SAAS;AAAA;AAAA,EAEpC,QAAQ,kBAAE,OAAO,SAAS,EAAE,SAAS;AAAA,EACrC,gBAAgB,kBAAE,OAAO,SAAS,EAAE,SAAS;AAAA,EAC7C,iBAAiB,kBAAE,OAAO,SAAS,EAAE,SAAS;AAAA,EAC9C,aAAa,kBAAE,YAAY,SAAS,QAAQ,QAAQ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