@tldraw/editor 3.13.0-canary.c0afd1f5aa1e → 3.13.0-canary.c3ce2eeb1729
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 +99 -97
- package/dist-cjs/index.js +22 -7
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/components/default-components/DefaultCanvas.js +6 -10
- package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +2 -2
- package/dist-cjs/lib/editor/Editor.js +16 -64
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/managers/SnapManager/HandleSnaps.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js +1 -1
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js +3 -0
- package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/shared/getPerfectDashProps.js.map +2 -2
- package/dist-cjs/lib/hooks/useEditorComponents.js +2 -1
- package/dist-cjs/lib/hooks/useEditorComponents.js.map +2 -2
- package/dist-cjs/lib/primitives/Box.js +0 -16
- package/dist-cjs/lib/primitives/Box.js.map +2 -2
- package/dist-cjs/lib/primitives/Mat.js +1 -1
- package/dist-cjs/lib/primitives/Mat.js.map +2 -2
- package/dist-cjs/lib/primitives/Vec.js +0 -20
- package/dist-cjs/lib/primitives/Vec.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/Arc2d.js +2 -2
- 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 -1
- package/dist-cjs/lib/primitives/geometry/CubicBezier2d.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/CubicSpline2d.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/Edge2d.js +1 -1
- package/dist-cjs/lib/primitives/geometry/Edge2d.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/Ellipse2d.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/Geometry2d.js +20 -91
- package/dist-cjs/lib/primitives/geometry/Geometry2d.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/Group2d.js +2 -55
- package/dist-cjs/lib/primitives/geometry/Group2d.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/Point2d.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/Polyline2d.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/Stadium2d.js.map +2 -2
- package/dist-cjs/lib/utils/debug-flags.js +2 -5
- package/dist-cjs/lib/utils/debug-flags.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 +99 -97
- package/dist-esm/index.mjs +41 -9
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +6 -10
- package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +2 -2
- package/dist-esm/lib/editor/Editor.mjs +16 -64
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/SnapManager/HandleSnaps.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +1 -1
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs +3 -0
- package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/shared/getPerfectDashProps.mjs.map +2 -2
- package/dist-esm/lib/hooks/useEditorComponents.mjs +4 -1
- package/dist-esm/lib/hooks/useEditorComponents.mjs.map +2 -2
- package/dist-esm/lib/primitives/Box.mjs +0 -16
- package/dist-esm/lib/primitives/Box.mjs.map +2 -2
- package/dist-esm/lib/primitives/Mat.mjs +1 -1
- package/dist-esm/lib/primitives/Mat.mjs.map +2 -2
- package/dist-esm/lib/primitives/Vec.mjs +0 -20
- package/dist-esm/lib/primitives/Vec.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 +1 -1
- package/dist-esm/lib/primitives/geometry/Circle2d.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/CubicBezier2d.mjs +1 -1
- package/dist-esm/lib/primitives/geometry/CubicBezier2d.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/CubicSpline2d.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/Edge2d.mjs +1 -1
- package/dist-esm/lib/primitives/geometry/Edge2d.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/Ellipse2d.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/Geometry2d.mjs +21 -92
- package/dist-esm/lib/primitives/geometry/Geometry2d.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/Group2d.mjs +2 -55
- package/dist-esm/lib/primitives/geometry/Group2d.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/Point2d.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/Polyline2d.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/Stadium2d.mjs.map +2 -2
- package/dist-esm/lib/utils/debug-flags.mjs +2 -5
- package/dist-esm/lib/utils/debug-flags.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/editor.css +4 -32
- package/package.json +7 -7
- package/src/index.ts +31 -16
- package/src/lib/components/default-components/DefaultCanvas.tsx +6 -11
- package/src/lib/editor/Editor.test.ts +1 -1
- package/src/lib/editor/Editor.ts +16 -75
- package/src/lib/editor/managers/SnapManager/HandleSnaps.ts +1 -0
- package/src/lib/editor/shapes/ShapeUtil.ts +2 -10
- package/src/lib/editor/shapes/group/GroupShapeUtil.tsx +4 -0
- package/src/lib/editor/shapes/shared/getPerfectDashProps.ts +9 -9
- package/src/lib/hooks/useEditorComponents.tsx +5 -2
- package/src/lib/primitives/Box.ts +0 -20
- package/src/lib/primitives/Mat.ts +4 -5
- package/src/lib/primitives/Vec.ts +0 -23
- package/src/lib/primitives/geometry/Arc2d.ts +5 -5
- package/src/lib/primitives/geometry/Circle2d.ts +4 -4
- package/src/lib/primitives/geometry/CubicBezier2d.ts +4 -4
- package/src/lib/primitives/geometry/CubicSpline2d.ts +3 -3
- package/src/lib/primitives/geometry/Edge2d.ts +3 -3
- package/src/lib/primitives/geometry/Ellipse2d.ts +3 -3
- package/src/lib/primitives/geometry/Geometry2d.ts +35 -123
- package/src/lib/primitives/geometry/Group2d.ts +7 -70
- package/src/lib/primitives/geometry/Point2d.ts +2 -2
- package/src/lib/primitives/geometry/Polyline2d.ts +3 -3
- package/src/lib/primitives/geometry/Stadium2d.ts +3 -3
- package/src/lib/test/currentToolIdMask.test.ts +1 -1
- package/src/lib/test/user.test.ts +1 -1
- package/src/lib/utils/debug-flags.ts +2 -7
- package/src/lib/utils/sync/LocalIndexedDb.test.ts +1 -1
- package/src/lib/utils/sync/TLLocalSyncClient.test.ts +1 -1
- package/src/version.ts +3 -3
- package/src/lib/primitives/geometry/Geometry2d.test.ts +0 -42
package/dist-esm/index.d.mts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
|
|
3
3
|
import { Atom } from '@tldraw/state';
|
|
4
|
+
import { atom } from '@tldraw/state';
|
|
4
5
|
import { BoxModel } from '@tldraw/tlschema';
|
|
5
6
|
import { ComponentType } from 'react';
|
|
6
7
|
import { Computed } from '@tldraw/state';
|
|
8
|
+
import { computed } from '@tldraw/state';
|
|
7
9
|
import { Dispatch } from 'react';
|
|
8
10
|
import { Editor as Editor_2 } from '@tiptap/core';
|
|
9
11
|
import { EditorProviderProps } from '@tiptap/react';
|
|
12
|
+
import { EffectScheduler } from '@tldraw/state';
|
|
13
|
+
import { EMPTY_ARRAY } from '@tldraw/state';
|
|
10
14
|
import EventEmitter from 'eventemitter3';
|
|
11
15
|
import { ExoticComponent } from 'react';
|
|
12
16
|
import { HistoryEntry } from '@tldraw/store';
|
|
@@ -19,6 +23,7 @@ import { NamedExoticComponent } from 'react';
|
|
|
19
23
|
import { Node as Node_2 } from '@tiptap/pm/model';
|
|
20
24
|
import { PerformanceTracker } from '@tldraw/utils';
|
|
21
25
|
import { PointerEventHandler } from 'react';
|
|
26
|
+
import { react } from '@tldraw/state';
|
|
22
27
|
import { default as React_2 } from 'react';
|
|
23
28
|
import * as React_3 from 'react';
|
|
24
29
|
import { ReactElement } from 'react';
|
|
@@ -77,8 +82,18 @@ import { TLStoreSnapshot } from '@tldraw/tlschema';
|
|
|
77
82
|
import { TLUnknownBinding } from '@tldraw/tlschema';
|
|
78
83
|
import { TLUnknownShape } from '@tldraw/tlschema';
|
|
79
84
|
import { TLVideoAsset } from '@tldraw/tlschema';
|
|
85
|
+
import { track } from '@tldraw/state-react';
|
|
86
|
+
import { transact } from '@tldraw/state';
|
|
87
|
+
import { transaction } from '@tldraw/state';
|
|
80
88
|
import { UnknownRecord } from '@tldraw/store';
|
|
89
|
+
import { useAtom } from '@tldraw/state-react';
|
|
90
|
+
import { useComputed } from '@tldraw/state-react';
|
|
91
|
+
import { useQuickReactor } from '@tldraw/state-react';
|
|
92
|
+
import { useReactor } from '@tldraw/state-react';
|
|
93
|
+
import { useStateTracking } from '@tldraw/state-react';
|
|
94
|
+
import { useValue } from '@tldraw/state-react';
|
|
81
95
|
import { VecModel } from '@tldraw/tlschema';
|
|
96
|
+
import { whyAmIRunning } from '@tldraw/state';
|
|
82
97
|
|
|
83
98
|
/* Excluded from this release type: activeElementShouldCaptureKeys */
|
|
84
99
|
|
|
@@ -121,8 +136,8 @@ export declare class Arc2d extends Geometry2d {
|
|
|
121
136
|
start: Vec;
|
|
122
137
|
sweepFlag: number;
|
|
123
138
|
});
|
|
124
|
-
nearestPoint(point:
|
|
125
|
-
hitTestLineSegment(A:
|
|
139
|
+
nearestPoint(point: Vec): Vec;
|
|
140
|
+
hitTestLineSegment(A: Vec, B: Vec): boolean;
|
|
126
141
|
getVertices(): Vec[];
|
|
127
142
|
getSvgPathData(first?: boolean): string;
|
|
128
143
|
getLength(): number;
|
|
@@ -138,6 +153,10 @@ export declare class Arc2d extends Geometry2d {
|
|
|
138
153
|
*/
|
|
139
154
|
export declare function areAnglesCompatible(a: number, b: number): boolean;
|
|
140
155
|
|
|
156
|
+
export { Atom }
|
|
157
|
+
|
|
158
|
+
export { atom }
|
|
159
|
+
|
|
141
160
|
/** @public */
|
|
142
161
|
export declare function average(A: VecLike, B: VecLike): string;
|
|
143
162
|
|
|
@@ -458,16 +477,12 @@ export declare class Box {
|
|
|
458
477
|
set point(val: Vec);
|
|
459
478
|
get minX(): number;
|
|
460
479
|
set minX(n: number);
|
|
461
|
-
get left(): number;
|
|
462
480
|
get midX(): number;
|
|
463
481
|
get maxX(): number;
|
|
464
|
-
get right(): number;
|
|
465
482
|
get minY(): number;
|
|
466
483
|
set minY(n: number);
|
|
467
|
-
get top(): number;
|
|
468
484
|
get midY(): number;
|
|
469
485
|
get maxY(): number;
|
|
470
|
-
get bottom(): number;
|
|
471
486
|
get width(): number;
|
|
472
487
|
set width(n: number);
|
|
473
488
|
get height(): number;
|
|
@@ -563,8 +578,8 @@ export declare class Circle2d extends Geometry2d {
|
|
|
563
578
|
});
|
|
564
579
|
getBounds(): Box;
|
|
565
580
|
getVertices(): Vec[];
|
|
566
|
-
nearestPoint(point:
|
|
567
|
-
hitTestLineSegment(A:
|
|
581
|
+
nearestPoint(point: Vec): Vec;
|
|
582
|
+
hitTestLineSegment(A: Vec, B: Vec, distance?: number): boolean;
|
|
568
583
|
getSvgPathData(): string;
|
|
569
584
|
}
|
|
570
585
|
|
|
@@ -641,6 +656,8 @@ export declare class ClickManager {
|
|
|
641
656
|
*/
|
|
642
657
|
export declare function clockwiseAngleDist(a0: number, a1: number): number;
|
|
643
658
|
|
|
659
|
+
export { computed }
|
|
660
|
+
|
|
644
661
|
/**
|
|
645
662
|
* @public
|
|
646
663
|
* @react
|
|
@@ -728,10 +745,10 @@ export declare class CubicBezier2d extends Polyline2d {
|
|
|
728
745
|
});
|
|
729
746
|
getVertices(): Vec[];
|
|
730
747
|
midPoint(): Vec;
|
|
731
|
-
nearestPoint(A:
|
|
748
|
+
nearestPoint(A: Vec): Vec;
|
|
732
749
|
getSvgPathData(first?: boolean): string;
|
|
733
750
|
static GetAtT(segment: CubicBezier2d, t: number): Vec;
|
|
734
|
-
getLength(
|
|
751
|
+
getLength(precision?: number): number;
|
|
735
752
|
}
|
|
736
753
|
|
|
737
754
|
/** @public */
|
|
@@ -744,8 +761,8 @@ export declare class CubicSpline2d extends Geometry2d {
|
|
|
744
761
|
get segments(): CubicBezier2d[];
|
|
745
762
|
getLength(): number;
|
|
746
763
|
getVertices(): Vec[];
|
|
747
|
-
nearestPoint(A:
|
|
748
|
-
hitTestLineSegment(A:
|
|
764
|
+
nearestPoint(A: Vec): Vec;
|
|
765
|
+
hitTestLineSegment(A: Vec, B: Vec): boolean;
|
|
749
766
|
getSvgPathData(): string;
|
|
750
767
|
}
|
|
751
768
|
|
|
@@ -939,8 +956,8 @@ export declare class Edge2d extends Geometry2d {
|
|
|
939
956
|
getLength(): number;
|
|
940
957
|
midPoint(): Vec;
|
|
941
958
|
getVertices(): Vec[];
|
|
942
|
-
nearestPoint(point:
|
|
943
|
-
hitTestLineSegment(A:
|
|
959
|
+
nearestPoint(point: Vec): Vec;
|
|
960
|
+
hitTestLineSegment(A: Vec, B: Vec, distance?: number): boolean;
|
|
944
961
|
getSvgPathData(first?: boolean): string;
|
|
945
962
|
}
|
|
946
963
|
|
|
@@ -1560,16 +1577,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1560
1577
|
* @public
|
|
1561
1578
|
*/
|
|
1562
1579
|
selectAll(): this;
|
|
1563
|
-
/**
|
|
1564
|
-
* Select the next shape in the reading order or in cardinal order.
|
|
1565
|
-
*
|
|
1566
|
-
* @example
|
|
1567
|
-
* ```ts
|
|
1568
|
-
* editor.selectAdjacentShape('next')
|
|
1569
|
-
* ```
|
|
1570
|
-
*
|
|
1571
|
-
* @public
|
|
1572
|
-
*/
|
|
1573
1580
|
selectAdjacentShape(direction: TLAdjacentDirection): void;
|
|
1574
1581
|
/**
|
|
1575
1582
|
* Generates a reading order for shapes based on rows grouping.
|
|
@@ -1578,16 +1585,12 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1578
1585
|
* @public
|
|
1579
1586
|
*/
|
|
1580
1587
|
getCurrentPageShapesInReadingOrder(): TLShape[];
|
|
1581
|
-
private _getShapesInReadingOrder;
|
|
1582
1588
|
/**
|
|
1583
1589
|
* Find the nearest adjacent shape in a specific direction.
|
|
1584
1590
|
*
|
|
1585
1591
|
* @public
|
|
1586
1592
|
*/
|
|
1587
1593
|
getNearestAdjacentShape(currentShapeId: TLShapeId, direction: 'down' | 'left' | 'right' | 'up'): TLShapeId;
|
|
1588
|
-
selectParentShape(): void;
|
|
1589
|
-
selectFirstChildShape(): void;
|
|
1590
|
-
private _selectShapesAndZoom;
|
|
1591
1594
|
/**
|
|
1592
1595
|
* Clear the selection.
|
|
1593
1596
|
*
|
|
@@ -3991,6 +3994,8 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3991
3994
|
/** @public */
|
|
3992
3995
|
export declare const EditorContext: React_2.Context<Editor | null>;
|
|
3993
3996
|
|
|
3997
|
+
export { EffectScheduler }
|
|
3998
|
+
|
|
3994
3999
|
/** @public */
|
|
3995
4000
|
export declare class Ellipse2d extends Geometry2d {
|
|
3996
4001
|
config: Omit<Geometry2dOptions, 'isClosed'> & {
|
|
@@ -4006,13 +4011,15 @@ export declare class Ellipse2d extends Geometry2d {
|
|
|
4006
4011
|
_edges?: Edge2d[];
|
|
4007
4012
|
get edges(): Edge2d[];
|
|
4008
4013
|
getVertices(): any[];
|
|
4009
|
-
nearestPoint(A:
|
|
4010
|
-
hitTestLineSegment(A:
|
|
4014
|
+
nearestPoint(A: Vec): Vec;
|
|
4015
|
+
hitTestLineSegment(A: Vec, B: Vec): boolean;
|
|
4011
4016
|
getBounds(): Box;
|
|
4012
4017
|
getLength(): number;
|
|
4013
4018
|
getSvgPathData(first?: boolean): string;
|
|
4014
4019
|
}
|
|
4015
4020
|
|
|
4021
|
+
export { EMPTY_ARRAY }
|
|
4022
|
+
|
|
4016
4023
|
/** @public */
|
|
4017
4024
|
export declare class ErrorBoundary extends React_3.Component<React_3.PropsWithRef<React_3.PropsWithChildren<TLErrorBoundaryProps>>, {
|
|
4018
4025
|
error: Error | null;
|
|
@@ -4080,27 +4087,18 @@ export declare abstract class Geometry2d {
|
|
|
4080
4087
|
constructor(opts: Geometry2dOptions);
|
|
4081
4088
|
isExcludedByFilter(filters?: Geometry2dFilters): boolean;
|
|
4082
4089
|
abstract getVertices(filters: Geometry2dFilters): Vec[];
|
|
4083
|
-
abstract nearestPoint(point:
|
|
4084
|
-
hitTestPoint(point:
|
|
4085
|
-
distanceToPoint(point:
|
|
4086
|
-
distanceToLineSegment(A:
|
|
4087
|
-
hitTestLineSegment(A:
|
|
4090
|
+
abstract nearestPoint(point: Vec, _filters?: Geometry2dFilters): Vec;
|
|
4091
|
+
hitTestPoint(point: Vec, margin?: number, hitInside?: boolean, _filters?: Geometry2dFilters): boolean;
|
|
4092
|
+
distanceToPoint(point: Vec, hitInside?: boolean, filters?: Geometry2dFilters): number;
|
|
4093
|
+
distanceToLineSegment(A: Vec, B: Vec, filters?: Geometry2dFilters): number;
|
|
4094
|
+
hitTestLineSegment(A: Vec, B: Vec, distance?: number, filters?: Geometry2dFilters): boolean;
|
|
4088
4095
|
intersectLineSegment(A: VecLike, B: VecLike, _filters?: Geometry2dFilters): VecLike[];
|
|
4089
4096
|
intersectCircle(center: VecLike, radius: number, _filters?: Geometry2dFilters): VecLike[];
|
|
4090
4097
|
intersectPolygon(polygon: VecLike[], _filters?: Geometry2dFilters): VecLike[];
|
|
4091
4098
|
intersectPolyline(polyline: VecLike[], _filters?: Geometry2dFilters): VecLike[];
|
|
4092
|
-
/**
|
|
4093
|
-
* Find a point along the edge of the geometry that is a fraction `t` along the entire way round.
|
|
4094
|
-
*/
|
|
4095
|
-
interpolateAlongEdge(t: number, _filters?: Geometry2dFilters): Vec;
|
|
4096
|
-
/**
|
|
4097
|
-
* Take `point`, find the closest point to it on the edge of the geometry, and return how far
|
|
4098
|
-
* along the edge it is as a fraction of the total length.
|
|
4099
|
-
*/
|
|
4100
|
-
uninterpolateAlongEdge(point: VecLike, _filters?: Geometry2dFilters): number;
|
|
4101
4099
|
/** @deprecated Iterate the vertices instead. */
|
|
4102
|
-
nearestPointOnLineSegment(A:
|
|
4103
|
-
isPointInBounds(point:
|
|
4100
|
+
nearestPointOnLineSegment(A: Vec, B: Vec): Vec;
|
|
4101
|
+
isPointInBounds(point: Vec, margin?: number): boolean;
|
|
4104
4102
|
transform(transform: MatModel, opts?: TransformedGeometry2dOptions): Geometry2d;
|
|
4105
4103
|
private _vertices;
|
|
4106
4104
|
get vertices(): Vec[];
|
|
@@ -4114,7 +4112,7 @@ export declare abstract class Geometry2d {
|
|
|
4114
4112
|
toSimpleSvgPath(): string;
|
|
4115
4113
|
private _length?;
|
|
4116
4114
|
get length(): number;
|
|
4117
|
-
getLength(
|
|
4115
|
+
getLength(): number;
|
|
4118
4116
|
abstract getSvgPathData(first: boolean): string;
|
|
4119
4117
|
}
|
|
4120
4118
|
|
|
@@ -4182,15 +4180,15 @@ export declare function getFreshUserPreferences(): TLUserPreferences;
|
|
|
4182
4180
|
export declare function getIncrementedName(name: string, others: string[]): string;
|
|
4183
4181
|
|
|
4184
4182
|
/** @public */
|
|
4185
|
-
export declare function getPerfectDashProps(totalLength: number, strokeWidth: number, opts?: {
|
|
4186
|
-
closed
|
|
4187
|
-
end
|
|
4188
|
-
forceSolid
|
|
4189
|
-
lengthRatio
|
|
4190
|
-
snap
|
|
4191
|
-
start
|
|
4192
|
-
style
|
|
4193
|
-
}): {
|
|
4183
|
+
export declare function getPerfectDashProps(totalLength: number, strokeWidth: number, opts?: Partial<{
|
|
4184
|
+
closed: boolean;
|
|
4185
|
+
end: 'none' | 'outset' | 'skip';
|
|
4186
|
+
forceSolid: boolean;
|
|
4187
|
+
lengthRatio: number;
|
|
4188
|
+
snap: number;
|
|
4189
|
+
start: 'none' | 'outset' | 'skip';
|
|
4190
|
+
style: TLDefaultDashStyle;
|
|
4191
|
+
}>): {
|
|
4194
4192
|
strokeDasharray: string;
|
|
4195
4193
|
strokeDashoffset: string;
|
|
4196
4194
|
};
|
|
@@ -4277,20 +4275,18 @@ export declare class Group2d extends Geometry2d {
|
|
|
4277
4275
|
children: Geometry2d[];
|
|
4278
4276
|
});
|
|
4279
4277
|
getVertices(filters: Geometry2dFilters): Vec[];
|
|
4280
|
-
nearestPoint(point:
|
|
4281
|
-
distanceToPoint(point:
|
|
4282
|
-
hitTestPoint(point:
|
|
4283
|
-
hitTestLineSegment(A:
|
|
4278
|
+
nearestPoint(point: Vec, filters?: Geometry2dFilters): Vec;
|
|
4279
|
+
distanceToPoint(point: Vec, hitInside?: boolean, filters?: Geometry2dFilters): number;
|
|
4280
|
+
hitTestPoint(point: Vec, margin: number, hitInside: boolean, filters?: Geometry2dFilters): boolean;
|
|
4281
|
+
hitTestLineSegment(A: Vec, B: Vec, zoom: number, filters?: Geometry2dFilters): boolean;
|
|
4284
4282
|
intersectLineSegment(A: VecLike, B: VecLike, filters?: Geometry2dFilters): VecLike[];
|
|
4285
4283
|
intersectCircle(center: VecLike, radius: number, filters?: Geometry2dFilters): VecLike[];
|
|
4286
4284
|
intersectPolygon(polygon: VecLike[], filters?: Geometry2dFilters): VecLike[];
|
|
4287
4285
|
intersectPolyline(polyline: VecLike[], filters?: Geometry2dFilters): VecLike[];
|
|
4288
|
-
interpolateAlongEdge(t: number, filters?: Geometry2dFilters): Vec;
|
|
4289
|
-
uninterpolateAlongEdge(point: VecLike, filters?: Geometry2dFilters): number;
|
|
4290
4286
|
transform(transform: Mat): Geometry2d;
|
|
4291
4287
|
getArea(): number;
|
|
4292
4288
|
toSimpleSvgPath(): string;
|
|
4293
|
-
getLength(
|
|
4289
|
+
getLength(): number;
|
|
4294
4290
|
getSvgPathData(): string;
|
|
4295
4291
|
}
|
|
4296
4292
|
|
|
@@ -4299,6 +4295,7 @@ export declare class GroupShapeUtil extends ShapeUtil<TLGroupShape> {
|
|
|
4299
4295
|
static type: "group";
|
|
4300
4296
|
static props: RecordProps<TLGroupShape>;
|
|
4301
4297
|
static migrations: TLPropsMigrations;
|
|
4298
|
+
canTabTo(): boolean;
|
|
4302
4299
|
hideSelectionBoundsFg(): boolean;
|
|
4303
4300
|
canBind(): boolean;
|
|
4304
4301
|
getDefaultProps(): TLGroupShape['props'];
|
|
@@ -4594,8 +4591,8 @@ export declare class Mat {
|
|
|
4594
4591
|
static Identity(): Mat;
|
|
4595
4592
|
static Translate(x: number, y: number): Mat;
|
|
4596
4593
|
static Rotate(r: number, cx?: number, cy?: number): Mat;
|
|
4597
|
-
static Scale(x: number, y: number):
|
|
4598
|
-
static Scale(x: number, y: number, cx: number, cy: number):
|
|
4594
|
+
static Scale(x: number, y: number): MatModel;
|
|
4595
|
+
static Scale(x: number, y: number, cx: number, cy: number): MatModel;
|
|
4599
4596
|
static Multiply(m1: MatModel, m2: MatModel): MatModel;
|
|
4600
4597
|
static Inverse(m: MatModel): MatModel;
|
|
4601
4598
|
static Absolute(m: MatLike): MatModel;
|
|
@@ -4690,7 +4687,7 @@ export declare class Point2d extends Geometry2d {
|
|
|
4690
4687
|
});
|
|
4691
4688
|
getVertices(): Vec[];
|
|
4692
4689
|
nearestPoint(): Vec;
|
|
4693
|
-
hitTestLineSegment(A:
|
|
4690
|
+
hitTestLineSegment(A: Vec, B: Vec, margin: number): boolean;
|
|
4694
4691
|
getSvgPathData(): string;
|
|
4695
4692
|
}
|
|
4696
4693
|
|
|
@@ -4735,8 +4732,8 @@ export declare class Polyline2d extends Geometry2d {
|
|
|
4735
4732
|
get segments(): Edge2d[];
|
|
4736
4733
|
getLength(): number;
|
|
4737
4734
|
getVertices(): Vec[];
|
|
4738
|
-
nearestPoint(A:
|
|
4739
|
-
hitTestLineSegment(A:
|
|
4735
|
+
nearestPoint(A: Vec): Vec;
|
|
4736
|
+
hitTestLineSegment(A: Vec, B: Vec, distance?: number): boolean;
|
|
4740
4737
|
getSvgPathData(): string;
|
|
4741
4738
|
}
|
|
4742
4739
|
|
|
@@ -4777,6 +4774,8 @@ export declare function radiansToDegrees(r: number): number;
|
|
|
4777
4774
|
*/
|
|
4778
4775
|
export declare function rangeIntersection(a0: number, a1: number, b0: number, b1: number): [number, number] | null;
|
|
4779
4776
|
|
|
4777
|
+
export { react }
|
|
4778
|
+
|
|
4780
4779
|
/**
|
|
4781
4780
|
* A map of {@link @tldraw/tlschema#StyleProp | StyleProps} to their {@link SharedStyle} values. See
|
|
4782
4781
|
* {@link Editor.getSharedStyles}.
|
|
@@ -5100,7 +5099,7 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
|
|
|
5100
5099
|
*
|
|
5101
5100
|
* @public
|
|
5102
5101
|
*/
|
|
5103
|
-
|
|
5102
|
+
canEditInReadOnly(_shape: Shape): boolean;
|
|
5104
5103
|
/**
|
|
5105
5104
|
* Whether the shape can be cropped.
|
|
5106
5105
|
*
|
|
@@ -5451,14 +5450,7 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
|
|
|
5451
5450
|
*/
|
|
5452
5451
|
onClick?(shape: Shape): TLShapePartial<Shape> | void;
|
|
5453
5452
|
/**
|
|
5454
|
-
* A callback called when a shape
|
|
5455
|
-
*
|
|
5456
|
-
* @param shape - The shape.
|
|
5457
|
-
* @public
|
|
5458
|
-
*/
|
|
5459
|
-
onEditStart?(shape: Shape): void;
|
|
5460
|
-
/**
|
|
5461
|
-
* A callback called when a shape finishes being edited.
|
|
5453
|
+
* A callback called when a shape finishes being editing.
|
|
5462
5454
|
*
|
|
5463
5455
|
* @param shape - The shape.
|
|
5464
5456
|
* @public
|
|
@@ -5497,6 +5489,8 @@ export declare function shortAngleDist(a0: number, a1: number): number;
|
|
|
5497
5489
|
/** @public */
|
|
5498
5490
|
export declare const SIDES: readonly ["top", "right", "bottom", "left"];
|
|
5499
5491
|
|
|
5492
|
+
export { Signal }
|
|
5493
|
+
|
|
5500
5494
|
/** @public */
|
|
5501
5495
|
export declare const SIN: (x: number) => number;
|
|
5502
5496
|
|
|
@@ -5548,8 +5542,8 @@ export declare class Stadium2d extends Geometry2d {
|
|
|
5548
5542
|
height: number;
|
|
5549
5543
|
width: number;
|
|
5550
5544
|
});
|
|
5551
|
-
nearestPoint(A:
|
|
5552
|
-
hitTestLineSegment(A:
|
|
5545
|
+
nearestPoint(A: Vec): Vec;
|
|
5546
|
+
hitTestLineSegment(A: Vec, B: Vec): boolean;
|
|
5553
5547
|
getVertices(): Vec[];
|
|
5554
5548
|
getBounds(): Box;
|
|
5555
5549
|
getLength(): number;
|
|
@@ -7430,6 +7424,12 @@ export declare function toFixed(v: number): number;
|
|
|
7430
7424
|
*/
|
|
7431
7425
|
export declare function toPrecision(n: number, precision?: number): number;
|
|
7432
7426
|
|
|
7427
|
+
export { track }
|
|
7428
|
+
|
|
7429
|
+
export { transact }
|
|
7430
|
+
|
|
7431
|
+
export { transaction }
|
|
7432
|
+
|
|
7433
7433
|
/** @public */
|
|
7434
7434
|
export declare class TransformedGeometry2d extends Geometry2d {
|
|
7435
7435
|
private readonly geometry;
|
|
@@ -7438,13 +7438,13 @@ export declare class TransformedGeometry2d extends Geometry2d {
|
|
|
7438
7438
|
private readonly decomposed;
|
|
7439
7439
|
constructor(geometry: Geometry2d, matrix: MatModel, opts?: TransformedGeometry2dOptions);
|
|
7440
7440
|
getVertices(filters: Geometry2dFilters): Vec[];
|
|
7441
|
-
nearestPoint(point:
|
|
7442
|
-
hitTestPoint(point:
|
|
7443
|
-
distanceToPoint(point:
|
|
7444
|
-
distanceToLineSegment(A:
|
|
7445
|
-
hitTestLineSegment(A:
|
|
7446
|
-
intersectLineSegment(A: VecLike, B: VecLike, filters?: Geometry2dFilters):
|
|
7447
|
-
intersectCircle(center: VecLike, radius: number, filters?: Geometry2dFilters):
|
|
7441
|
+
nearestPoint(point: Vec, filters?: Geometry2dFilters): Vec;
|
|
7442
|
+
hitTestPoint(point: Vec, margin?: number, hitInside?: boolean, filters?: Geometry2dFilters): boolean;
|
|
7443
|
+
distanceToPoint(point: Vec, hitInside?: boolean, filters?: Geometry2dFilters): number;
|
|
7444
|
+
distanceToLineSegment(A: Vec, B: Vec, filters?: Geometry2dFilters): number;
|
|
7445
|
+
hitTestLineSegment(A: Vec, B: Vec, distance?: number, filters?: Geometry2dFilters): boolean;
|
|
7446
|
+
intersectLineSegment(A: VecLike, B: VecLike, filters?: Geometry2dFilters): VecLike[];
|
|
7447
|
+
intersectCircle(center: VecLike, radius: number, filters?: Geometry2dFilters): VecLike[];
|
|
7448
7448
|
intersectPolygon(polygon: VecLike[], filters?: Geometry2dFilters): VecLike[];
|
|
7449
7449
|
intersectPolyline(polyline: VecLike[], filters?: Geometry2dFilters): VecLike[];
|
|
7450
7450
|
transform(transform: MatModel, opts?: TransformedGeometry2dOptions): Geometry2d;
|
|
@@ -7471,6 +7471,10 @@ export declare function uniq<T>(array: {
|
|
|
7471
7471
|
readonly length: number;
|
|
7472
7472
|
} | null | undefined): T[];
|
|
7473
7473
|
|
|
7474
|
+
export { useAtom }
|
|
7475
|
+
|
|
7476
|
+
export { useComputed }
|
|
7477
|
+
|
|
7474
7478
|
/** @public */
|
|
7475
7479
|
export declare function useContainer(): HTMLElement;
|
|
7476
7480
|
|
|
@@ -7540,9 +7544,12 @@ export declare function usePeerIds(): string[];
|
|
|
7540
7544
|
*/
|
|
7541
7545
|
export declare function usePresence(userId: string): null | TLInstancePresence;
|
|
7542
7546
|
|
|
7547
|
+
export { useQuickReactor }
|
|
7548
|
+
|
|
7543
7549
|
/* Excluded from this release type: USER_COLORS */
|
|
7544
7550
|
|
|
7545
7551
|
/* Excluded from this release type: useReactiveEvent */
|
|
7552
|
+
export { useReactor }
|
|
7546
7553
|
|
|
7547
7554
|
/* Excluded from this release type: useRefState */
|
|
7548
7555
|
|
|
@@ -7605,6 +7612,8 @@ export declare function useSelectionEvents(handle: TLSelectionHandle): {
|
|
|
7605
7612
|
*/
|
|
7606
7613
|
export declare function useSharedSafeId(id: string): SafeId;
|
|
7607
7614
|
|
|
7615
|
+
export { useStateTracking }
|
|
7616
|
+
|
|
7608
7617
|
/**
|
|
7609
7618
|
* Returns the current SVG export context. Returns null if the component isn't being rendered for an
|
|
7610
7619
|
* SVG export.
|
|
@@ -7638,6 +7647,8 @@ export declare function useTransform(ref: React.RefObject<HTMLElement | SVGEleme
|
|
|
7638
7647
|
*/
|
|
7639
7648
|
export declare function useUniqueSafeId(suffix?: string): SafeId;
|
|
7640
7649
|
|
|
7650
|
+
export { useValue }
|
|
7651
|
+
|
|
7641
7652
|
/** @public */
|
|
7642
7653
|
export declare function useViewportHeight(): number;
|
|
7643
7654
|
|
|
@@ -7709,7 +7720,6 @@ export declare class Vec {
|
|
|
7709
7720
|
static Per(A: VecLike): Vec;
|
|
7710
7721
|
static Abs(A: VecLike): Vec;
|
|
7711
7722
|
static Dist(A: VecLike, B: VecLike): number;
|
|
7712
|
-
static ManhattanDist(A: VecLike, B: VecLike): number;
|
|
7713
7723
|
static DistMin(A: VecLike, B: VecLike, n: number): boolean;
|
|
7714
7724
|
static Dist2(A: VecLike, B: VecLike): number;
|
|
7715
7725
|
/**
|
|
@@ -7757,15 +7767,7 @@ export declare class Vec {
|
|
|
7757
7767
|
static Cast(A: VecLike): Vec;
|
|
7758
7768
|
static Slope(A: VecLike, B: VecLike): number;
|
|
7759
7769
|
static IsNaN(A: VecLike): boolean;
|
|
7760
|
-
/**
|
|
7761
|
-
* Get the angle from position A to position B.
|
|
7762
|
-
*/
|
|
7763
7770
|
static Angle(A: VecLike, B: VecLike): number;
|
|
7764
|
-
/**
|
|
7765
|
-
* Get the angle between vector A and vector B. This will return the smallest angle between the
|
|
7766
|
-
* two vectors, between -π and π. The sign indicates direction of angle.
|
|
7767
|
-
*/
|
|
7768
|
-
static AngleBetween(A: VecLike, B: VecLike): number;
|
|
7769
7771
|
/**
|
|
7770
7772
|
* Linearly interpolate between two points.
|
|
7771
7773
|
* @param A - The first point.
|
|
@@ -7809,9 +7811,9 @@ export declare class Vec {
|
|
|
7809
7811
|
/** @public */
|
|
7810
7812
|
export declare type VecLike = Vec | VecModel;
|
|
7811
7813
|
|
|
7814
|
+
export { whyAmIRunning }
|
|
7815
|
+
|
|
7812
7816
|
|
|
7813
|
-
export * from "@tldraw/state";
|
|
7814
|
-
export * from "@tldraw/state-react";
|
|
7815
7817
|
export * from "@tldraw/store";
|
|
7816
7818
|
export * from "@tldraw/tlschema";
|
|
7817
7819
|
export * from "@tldraw/utils";
|
package/dist-esm/index.mjs
CHANGED
|
@@ -4,8 +4,30 @@ import "core-js/stable/array/flat-map.js";
|
|
|
4
4
|
import "core-js/stable/array/flat.js";
|
|
5
5
|
import "core-js/stable/string/at.js";
|
|
6
6
|
import "core-js/stable/string/replace-all.js";
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
import {
|
|
8
|
+
EMPTY_ARRAY,
|
|
9
|
+
EffectScheduler,
|
|
10
|
+
atom,
|
|
11
|
+
computed,
|
|
12
|
+
react,
|
|
13
|
+
transact,
|
|
14
|
+
transaction,
|
|
15
|
+
whyAmIRunning
|
|
16
|
+
} from "@tldraw/state";
|
|
17
|
+
import {
|
|
18
|
+
track,
|
|
19
|
+
useAtom,
|
|
20
|
+
useComputed,
|
|
21
|
+
useQuickReactor,
|
|
22
|
+
useReactor,
|
|
23
|
+
useStateTracking,
|
|
24
|
+
useValue
|
|
25
|
+
} from "@tldraw/state-react";
|
|
26
|
+
import { resizeScaled } from "./lib/editor/shapes/shared/resizeScaled.mjs";
|
|
27
|
+
import {
|
|
28
|
+
getFontsFromRichText
|
|
29
|
+
} from "./lib/utils/richText.mjs";
|
|
30
|
+
import { LocalIndexedDb, Table } from "./lib/utils/sync/LocalIndexedDb.mjs";
|
|
9
31
|
export * from "@tldraw/store";
|
|
10
32
|
export * from "@tldraw/tlschema";
|
|
11
33
|
export * from "@tldraw/utils";
|
|
@@ -119,7 +141,6 @@ import {
|
|
|
119
141
|
import { GroupShapeUtil } from "./lib/editor/shapes/group/GroupShapeUtil.mjs";
|
|
120
142
|
import { getPerfectDashProps } from "./lib/editor/shapes/shared/getPerfectDashProps.mjs";
|
|
121
143
|
import { resizeBox } from "./lib/editor/shapes/shared/resizeBox.mjs";
|
|
122
|
-
import { resizeScaled } from "./lib/editor/shapes/shared/resizeScaled.mjs";
|
|
123
144
|
import { BaseBoxShapeTool } from "./lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool.mjs";
|
|
124
145
|
import { maybeSnapToGrid } from "./lib/editor/tools/BaseBoxShapeTool/children/Pointing.mjs";
|
|
125
146
|
import { StateNode } from "./lib/editor/tools/StateNode.mjs";
|
|
@@ -269,15 +290,11 @@ import { hardResetEditor } from "./lib/utils/hardResetEditor.mjs";
|
|
|
269
290
|
import { isAccelKey } from "./lib/utils/keyboard.mjs";
|
|
270
291
|
import { normalizeWheel } from "./lib/utils/normalizeWheel.mjs";
|
|
271
292
|
import { refreshPage } from "./lib/utils/refreshPage.mjs";
|
|
272
|
-
import {
|
|
273
|
-
getFontsFromRichText
|
|
274
|
-
} from "./lib/utils/richText.mjs";
|
|
275
293
|
import {
|
|
276
294
|
applyRotationToSnapshotShapes,
|
|
277
295
|
getRotationSnapshot
|
|
278
296
|
} from "./lib/utils/rotation.mjs";
|
|
279
297
|
import { runtime, setRuntimeOverrides } from "./lib/utils/runtime.mjs";
|
|
280
|
-
import { LocalIndexedDb, Table } from "./lib/utils/sync/LocalIndexedDb.mjs";
|
|
281
298
|
import { hardReset } from "./lib/utils/sync/hardReset.mjs";
|
|
282
299
|
import { uniq } from "./lib/utils/uniq.mjs";
|
|
283
300
|
import { openWindow } from "./lib/utils/window-open.mjs";
|
|
@@ -286,7 +303,7 @@ function debugEnableLicensing() {
|
|
|
286
303
|
}
|
|
287
304
|
registerTldrawLibraryVersion(
|
|
288
305
|
"@tldraw/editor",
|
|
289
|
-
"3.13.0-canary.
|
|
306
|
+
"3.13.0-canary.c3ce2eeb1729",
|
|
290
307
|
"esm"
|
|
291
308
|
);
|
|
292
309
|
export {
|
|
@@ -321,11 +338,13 @@ export {
|
|
|
321
338
|
DefaultSpinner,
|
|
322
339
|
DefaultSvgDefs,
|
|
323
340
|
EASINGS,
|
|
341
|
+
EMPTY_ARRAY,
|
|
324
342
|
EVENT_NAME_MAP,
|
|
325
343
|
Edge2d,
|
|
326
344
|
EdgeScrollManager,
|
|
327
345
|
Editor,
|
|
328
346
|
EditorContext,
|
|
347
|
+
EffectScheduler,
|
|
329
348
|
Ellipse2d,
|
|
330
349
|
ErrorBoundary,
|
|
331
350
|
ErrorScreen,
|
|
@@ -374,6 +393,7 @@ export {
|
|
|
374
393
|
applyRotationToSnapshotShapes,
|
|
375
394
|
approximately,
|
|
376
395
|
areAnglesCompatible,
|
|
396
|
+
atom,
|
|
377
397
|
average,
|
|
378
398
|
canonicalizeRotation,
|
|
379
399
|
centerOfCircleFromThreePoints,
|
|
@@ -381,6 +401,7 @@ export {
|
|
|
381
401
|
clampRadians,
|
|
382
402
|
clampToBrowserMaxCanvasSize,
|
|
383
403
|
clockwiseAngleDist,
|
|
404
|
+
computed,
|
|
384
405
|
coreShapes,
|
|
385
406
|
counterClockwiseAngleDist,
|
|
386
407
|
createDeepLinkString,
|
|
@@ -443,6 +464,7 @@ export {
|
|
|
443
464
|
preventDefault,
|
|
444
465
|
radiansToDegrees,
|
|
445
466
|
rangeIntersection,
|
|
467
|
+
react,
|
|
446
468
|
refreshPage,
|
|
447
469
|
releasePointerCapture,
|
|
448
470
|
resizeBox,
|
|
@@ -463,7 +485,12 @@ export {
|
|
|
463
485
|
toDomPrecision,
|
|
464
486
|
toFixed,
|
|
465
487
|
toPrecision,
|
|
488
|
+
track,
|
|
489
|
+
transact,
|
|
490
|
+
transaction,
|
|
466
491
|
uniq,
|
|
492
|
+
useAtom,
|
|
493
|
+
useComputed,
|
|
467
494
|
useContainer,
|
|
468
495
|
useContainerIfExists,
|
|
469
496
|
useDelaySvgExport,
|
|
@@ -481,19 +508,24 @@ export {
|
|
|
481
508
|
usePassThroughWheelEvents,
|
|
482
509
|
usePeerIds,
|
|
483
510
|
usePresence,
|
|
511
|
+
useQuickReactor,
|
|
484
512
|
useReactiveEvent,
|
|
513
|
+
useReactor,
|
|
485
514
|
useRefState,
|
|
486
515
|
useSelectionEvents,
|
|
487
516
|
useShallowArrayIdentity,
|
|
488
517
|
useShallowObjectIdentity,
|
|
489
518
|
useSharedSafeId,
|
|
519
|
+
useStateTracking,
|
|
490
520
|
useSvgExportContext,
|
|
491
521
|
useTLSchemaFromUtils,
|
|
492
522
|
useTLStore,
|
|
493
523
|
useTldrawUser,
|
|
494
524
|
useTransform,
|
|
495
525
|
useUniqueSafeId,
|
|
526
|
+
useValue,
|
|
496
527
|
useViewportHeight,
|
|
497
|
-
userTypeValidator
|
|
528
|
+
userTypeValidator,
|
|
529
|
+
whyAmIRunning
|
|
498
530
|
};
|
|
499
531
|
//# sourceMappingURL=index.mjs.map
|