@tldraw/tlschema 3.13.0-canary.c0afd1f5aa1e → 3.13.0-canary.c4135f4903f5
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/bindings/TLArrowBinding.js +3 -19
- package/dist-cjs/bindings/TLArrowBinding.js.map +2 -2
- package/dist-cjs/index.d.ts +0 -31
- package/dist-cjs/index.js +1 -5
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/misc/TLHandle.js.map +1 -1
- package/dist-cjs/recordsWithProps.js +3 -3
- package/dist-cjs/recordsWithProps.js.map +1 -1
- package/dist-cjs/shapes/TLArrowShape.js +2 -22
- package/dist-cjs/shapes/TLArrowShape.js.map +2 -2
- package/dist-esm/bindings/TLArrowBinding.mjs +4 -23
- package/dist-esm/bindings/TLArrowBinding.mjs.map +2 -2
- package/dist-esm/index.d.mts +0 -31
- package/dist-esm/index.mjs +3 -11
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/misc/TLHandle.mjs.map +1 -1
- package/dist-esm/recordsWithProps.mjs +3 -3
- package/dist-esm/recordsWithProps.mjs.map +1 -1
- package/dist-esm/shapes/TLArrowShape.mjs +2 -22
- package/dist-esm/shapes/TLArrowShape.mjs.map +2 -2
- package/package.json +5 -5
- package/src/bindings/TLArrowBinding.ts +3 -27
- package/src/index.ts +0 -5
- package/src/migrations.test.ts +0 -31
- package/src/misc/TLHandle.ts +0 -2
- package/src/recordsWithProps.ts +3 -3
- package/src/shapes/TLArrowShape.ts +3 -29
|
@@ -18,7 +18,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var TLArrowBinding_exports = {};
|
|
20
20
|
__export(TLArrowBinding_exports, {
|
|
21
|
-
ElbowArrowSnap: () => ElbowArrowSnap,
|
|
22
21
|
arrowBindingMigrations: () => arrowBindingMigrations,
|
|
23
22
|
arrowBindingProps: () => arrowBindingProps,
|
|
24
23
|
arrowBindingVersions: () => arrowBindingVersions
|
|
@@ -28,29 +27,14 @@ var import_validate = require("@tldraw/validate");
|
|
|
28
27
|
var import_geometry_types = require("../misc/geometry-types");
|
|
29
28
|
var import_TLBinding = require("../records/TLBinding");
|
|
30
29
|
var import_TLArrowShape = require("../shapes/TLArrowShape");
|
|
31
|
-
const ElbowArrowSnap = import_validate.T.literalEnum("center", "edge-point", "edge", "none");
|
|
32
30
|
const arrowBindingProps = {
|
|
33
31
|
terminal: import_validate.T.literalEnum("start", "end"),
|
|
34
32
|
normalizedAnchor: import_geometry_types.vecModelValidator,
|
|
35
33
|
isExact: import_validate.T.boolean,
|
|
36
|
-
isPrecise: import_validate.T.boolean
|
|
37
|
-
snap: ElbowArrowSnap
|
|
34
|
+
isPrecise: import_validate.T.boolean
|
|
38
35
|
};
|
|
39
|
-
const arrowBindingVersions =
|
|
40
|
-
AddSnap: 1
|
|
41
|
-
});
|
|
36
|
+
const arrowBindingVersions = {};
|
|
42
37
|
const arrowBindingMigrations = (0, import_TLBinding.createBindingPropsMigrationSequence)({
|
|
43
|
-
sequence: [
|
|
44
|
-
{ dependsOn: [import_TLArrowShape.arrowShapeVersions.ExtractBindings] },
|
|
45
|
-
{
|
|
46
|
-
id: arrowBindingVersions.AddSnap,
|
|
47
|
-
up: (props) => {
|
|
48
|
-
props.snap = "none";
|
|
49
|
-
},
|
|
50
|
-
down: (props) => {
|
|
51
|
-
delete props.snap;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
]
|
|
38
|
+
sequence: [{ dependsOn: [import_TLArrowShape.arrowShapeVersions.ExtractBindings] }]
|
|
55
39
|
});
|
|
56
40
|
//# sourceMappingURL=TLArrowBinding.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/bindings/TLArrowBinding.ts"],
|
|
4
|
-
"sourcesContent": ["import { T } from '@tldraw/validate'\nimport { VecModel, vecModelValidator } from '../misc/geometry-types'\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA
|
|
4
|
+
"sourcesContent": ["import { T } from '@tldraw/validate'\nimport { VecModel, vecModelValidator } from '../misc/geometry-types'\nimport { createBindingPropsMigrationSequence } from '../records/TLBinding'\nimport { RecordProps } from '../recordsWithProps'\nimport { arrowShapeVersions } from '../shapes/TLArrowShape'\nimport { TLBaseBinding } from './TLBaseBinding'\n\n/** @public */\nexport interface TLArrowBindingProps {\n\tterminal: 'start' | 'end'\n\tnormalizedAnchor: VecModel\n\t/**\n\t * exact is whether the arrow head 'enters' the bound shape to point directly at the binding\n\t * anchor point\n\t */\n\tisExact: boolean\n\t/**\n\t * precise is whether to bind to the normalizedAnchor, or to the middle of the shape\n\t */\n\tisPrecise: boolean\n}\n\n/** @public */\nexport const arrowBindingProps: RecordProps<TLArrowBinding> = {\n\tterminal: T.literalEnum('start', 'end'),\n\tnormalizedAnchor: vecModelValidator,\n\tisExact: T.boolean,\n\tisPrecise: T.boolean,\n}\n\n/** @public */\nexport type TLArrowBinding = TLBaseBinding<'arrow', TLArrowBindingProps>\n\nexport const arrowBindingVersions = {} as const\n\n/** @public */\nexport const arrowBindingMigrations = createBindingPropsMigrationSequence({\n\tsequence: [{ dependsOn: [arrowShapeVersions.ExtractBindings] }],\n})\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAkB;AAClB,4BAA4C;AAC5C,uBAAoD;AAEpD,0BAAmC;AAmB5B,MAAM,oBAAiD;AAAA,EAC7D,UAAU,kBAAE,YAAY,SAAS,KAAK;AAAA,EACtC,kBAAkB;AAAA,EAClB,SAAS,kBAAE;AAAA,EACX,WAAW,kBAAE;AACd;AAKO,MAAM,uBAAuB,CAAC;AAG9B,MAAM,6BAAyB,sDAAoC;AAAA,EACzE,UAAU,CAAC,EAAE,WAAW,CAAC,uCAAmB,eAAe,EAAE,CAAC;AAC/D,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist-cjs/index.d.ts
CHANGED
|
@@ -24,36 +24,18 @@ export declare const arrowBindingMigrations: TLPropsMigrations;
|
|
|
24
24
|
/** @public */
|
|
25
25
|
export declare const arrowBindingProps: RecordProps<TLArrowBinding>;
|
|
26
26
|
|
|
27
|
-
/** @public */
|
|
28
|
-
export declare const arrowBindingVersions: {
|
|
29
|
-
AddSnap: `com.tldraw.binding.arrow/${number}`;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
27
|
/** @public */
|
|
33
28
|
export declare const ArrowShapeArrowheadEndStyle: EnumStyleProp<"arrow" | "bar" | "diamond" | "dot" | "inverted" | "none" | "pipe" | "square" | "triangle">;
|
|
34
29
|
|
|
35
30
|
/** @public */
|
|
36
31
|
export declare const ArrowShapeArrowheadStartStyle: EnumStyleProp<"arrow" | "bar" | "diamond" | "dot" | "inverted" | "none" | "pipe" | "square" | "triangle">;
|
|
37
32
|
|
|
38
|
-
/** @public */
|
|
39
|
-
export declare const ArrowShapeKindStyle: EnumStyleProp<"arc" | "elbow">;
|
|
40
|
-
|
|
41
33
|
/** @public */
|
|
42
34
|
export declare const arrowShapeMigrations: MigrationSequence;
|
|
43
35
|
|
|
44
36
|
/** @public */
|
|
45
37
|
export declare const arrowShapeProps: RecordProps<TLArrowShape>;
|
|
46
38
|
|
|
47
|
-
/** @public */
|
|
48
|
-
export declare const arrowShapeVersions: {
|
|
49
|
-
readonly AddElbow: "com.tldraw.shape.arrow/6";
|
|
50
|
-
readonly AddIsPrecise: "com.tldraw.shape.arrow/2";
|
|
51
|
-
readonly AddLabelColor: "com.tldraw.shape.arrow/1";
|
|
52
|
-
readonly AddLabelPosition: "com.tldraw.shape.arrow/3";
|
|
53
|
-
readonly AddScale: "com.tldraw.shape.arrow/5";
|
|
54
|
-
readonly ExtractBindings: "com.tldraw.shape.arrow/4";
|
|
55
|
-
};
|
|
56
|
-
|
|
57
39
|
/**
|
|
58
40
|
* A validator for asset record type Ids.
|
|
59
41
|
*
|
|
@@ -298,12 +280,6 @@ export declare const drawShapeMigrations: TLPropsMigrations;
|
|
|
298
280
|
/** @public */
|
|
299
281
|
export declare const drawShapeProps: RecordProps<TLDrawShape>;
|
|
300
282
|
|
|
301
|
-
/** @public */
|
|
302
|
-
export declare const ElbowArrowSnap: T.Validator<"center" | "edge-point" | "edge" | "none">;
|
|
303
|
-
|
|
304
|
-
/** @public */
|
|
305
|
-
export declare type ElbowArrowSnap = T.TypeOf<typeof ElbowArrowSnap>;
|
|
306
|
-
|
|
307
283
|
/** @public */
|
|
308
284
|
export declare const embedShapeMigrations: TLPropsMigrations;
|
|
309
285
|
|
|
@@ -781,7 +757,6 @@ export declare interface TLArrowBindingProps {
|
|
|
781
757
|
* precise is whether to bind to the normalizedAnchor, or to the middle of the shape
|
|
782
758
|
*/
|
|
783
759
|
isPrecise: boolean;
|
|
784
|
-
snap: ElbowArrowSnap;
|
|
785
760
|
}
|
|
786
761
|
|
|
787
762
|
/** @public */
|
|
@@ -790,12 +765,8 @@ export declare type TLArrowShape = TLBaseShape<'arrow', TLArrowShapeProps>;
|
|
|
790
765
|
/** @public */
|
|
791
766
|
export declare type TLArrowShapeArrowheadStyle = T.TypeOf<typeof ArrowShapeArrowheadStartStyle>;
|
|
792
767
|
|
|
793
|
-
/** @public */
|
|
794
|
-
export declare type TLArrowShapeKind = T.TypeOf<typeof ArrowShapeKindStyle>;
|
|
795
|
-
|
|
796
768
|
/** @public */
|
|
797
769
|
export declare interface TLArrowShapeProps {
|
|
798
|
-
kind: TLArrowShapeKind;
|
|
799
770
|
labelColor: TLDefaultColorStyle;
|
|
800
771
|
color: TLDefaultColorStyle;
|
|
801
772
|
fill: TLDefaultFillStyle;
|
|
@@ -810,7 +781,6 @@ export declare interface TLArrowShapeProps {
|
|
|
810
781
|
text: string;
|
|
811
782
|
labelPosition: number;
|
|
812
783
|
scale: number;
|
|
813
|
-
elbowMidPoint: number;
|
|
814
784
|
}
|
|
815
785
|
|
|
816
786
|
/** @public */
|
|
@@ -1201,7 +1171,6 @@ export declare interface TLGroupShapeProps {
|
|
|
1201
1171
|
export declare interface TLHandle {
|
|
1202
1172
|
/** A unique identifier for the handle. */
|
|
1203
1173
|
id: string;
|
|
1204
|
-
label?: string;
|
|
1205
1174
|
type: TLHandleType;
|
|
1206
1175
|
canSnap?: boolean;
|
|
1207
1176
|
index: IndexKey;
|
package/dist-cjs/index.js
CHANGED
|
@@ -20,7 +20,6 @@ var index_exports = {};
|
|
|
20
20
|
__export(index_exports, {
|
|
21
21
|
ArrowShapeArrowheadEndStyle: () => import_TLArrowShape.ArrowShapeArrowheadEndStyle,
|
|
22
22
|
ArrowShapeArrowheadStartStyle: () => import_TLArrowShape.ArrowShapeArrowheadStartStyle,
|
|
23
|
-
ArrowShapeKindStyle: () => import_TLArrowShape.ArrowShapeKindStyle,
|
|
24
23
|
AssetRecordType: () => import_TLAsset.AssetRecordType,
|
|
25
24
|
CameraRecordType: () => import_TLCamera.CameraRecordType,
|
|
26
25
|
DefaultColorStyle: () => import_TLColorStyle.DefaultColorStyle,
|
|
@@ -34,7 +33,6 @@ __export(index_exports, {
|
|
|
34
33
|
DefaultTextAlignStyle: () => import_TLTextAlignStyle.DefaultTextAlignStyle,
|
|
35
34
|
DefaultVerticalAlignStyle: () => import_TLVerticalAlignStyle.DefaultVerticalAlignStyle,
|
|
36
35
|
DocumentRecordType: () => import_TLDocument.DocumentRecordType,
|
|
37
|
-
ElbowArrowSnap: () => import_TLArrowBinding.ElbowArrowSnap,
|
|
38
36
|
EnumStyleProp: () => import_StyleProp.EnumStyleProp,
|
|
39
37
|
GeoShapeGeoStyle: () => import_TLGeoShape.GeoShapeGeoStyle,
|
|
40
38
|
ImageShapeCrop: () => import_TLImageShape.ImageShapeCrop,
|
|
@@ -54,10 +52,8 @@ __export(index_exports, {
|
|
|
54
52
|
TL_SCRIBBLE_STATES: () => import_TLScribble.TL_SCRIBBLE_STATES,
|
|
55
53
|
arrowBindingMigrations: () => import_TLArrowBinding.arrowBindingMigrations,
|
|
56
54
|
arrowBindingProps: () => import_TLArrowBinding.arrowBindingProps,
|
|
57
|
-
arrowBindingVersions: () => import_TLArrowBinding.arrowBindingVersions,
|
|
58
55
|
arrowShapeMigrations: () => import_TLArrowShape.arrowShapeMigrations,
|
|
59
56
|
arrowShapeProps: () => import_TLArrowShape.arrowShapeProps,
|
|
60
|
-
arrowShapeVersions: () => import_TLArrowShape.arrowShapeVersions,
|
|
61
57
|
assetIdValidator: () => import_TLBaseAsset.assetIdValidator,
|
|
62
58
|
assetMigrations: () => import_TLAsset.assetMigrations,
|
|
63
59
|
assetValidator: () => import_TLAsset.assetValidator,
|
|
@@ -176,7 +172,7 @@ var import_TLVerticalAlignStyle = require("./styles/TLVerticalAlignStyle");
|
|
|
176
172
|
var import_translations = require("./translations/translations");
|
|
177
173
|
(0, import_utils.registerTldrawLibraryVersion)(
|
|
178
174
|
"@tldraw/tlschema",
|
|
179
|
-
"3.13.0-canary.
|
|
175
|
+
"3.13.0-canary.c4135f4903f5",
|
|
180
176
|
"cjs"
|
|
181
177
|
);
|
|
182
178
|
//# 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'\nexport {\n\ttype TLAssetContext,\n\ttype TLAssetStore,\n\ttype TLSerializedStore,\n\ttype TLStore,\n\ttype TLStoreProps,\n\ttype TLStoreSchema,\n\ttype TLStoreSnapshot,\n} from './TLStore'\nexport { assetIdValidator, createAssetValidator, type TLBaseAsset } from './assets/TLBaseAsset'\nexport { type TLBookmarkAsset } from './assets/TLBookmarkAsset'\nexport { type TLImageAsset } from './assets/TLImageAsset'\nexport { type TLVideoAsset } from './assets/TLVideoAsset'\nexport {\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;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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA
|
|
4
|
+
"sourcesContent": ["import { registerTldrawLibraryVersion } from '@tldraw/utils'\nexport {\n\ttype TLAssetContext,\n\ttype TLAssetStore,\n\ttype TLSerializedStore,\n\ttype TLStore,\n\ttype TLStoreProps,\n\ttype TLStoreSchema,\n\ttype TLStoreSnapshot,\n} from './TLStore'\nexport { assetIdValidator, createAssetValidator, type TLBaseAsset } from './assets/TLBaseAsset'\nexport { type TLBookmarkAsset } from './assets/TLBookmarkAsset'\nexport { type TLImageAsset } from './assets/TLImageAsset'\nexport { type TLVideoAsset } from './assets/TLVideoAsset'\nexport {\n\tarrowBindingMigrations,\n\tarrowBindingProps,\n\ttype TLArrowBinding,\n\ttype TLArrowBindingProps,\n} from './bindings/TLArrowBinding'\nexport {\n\tbindingIdValidator,\n\tcreateBindingValidator,\n\ttype TLBaseBinding,\n} from './bindings/TLBaseBinding'\nexport {\n\tcreatePresenceStateDerivation,\n\tgetDefaultUserPresence,\n\ttype TLPresenceStateInfo,\n\ttype TLPresenceUserInfo,\n} from './createPresenceStateDerivation'\nexport {\n\tcreateTLSchema,\n\tdefaultBindingSchemas,\n\tdefaultShapeSchemas,\n\ttype SchemaPropsInfo,\n\ttype TLSchema,\n} from './createTLSchema'\nexport {\n\tTL_CANVAS_UI_COLOR_TYPES,\n\tcanvasUiColorTypeValidator,\n\ttype TLCanvasUiColor,\n} from './misc/TLColor'\nexport { TL_CURSOR_TYPES, type TLCursor, type TLCursorType } from './misc/TLCursor'\nexport { TL_HANDLE_TYPES, type TLHandle, type TLHandleType } from './misc/TLHandle'\nexport { opacityValidator, type TLOpacityType } from './misc/TLOpacity'\nexport { richTextValidator, toRichText, type TLRichText } from './misc/TLRichText'\nexport { TL_SCRIBBLE_STATES, scribbleValidator, type TLScribble } from './misc/TLScribble'\nexport {\n\tboxModelValidator,\n\tvecModelValidator,\n\ttype BoxModel,\n\ttype VecModel,\n} from './misc/geometry-types'\nexport { idValidator } from './misc/id-validator'\nexport {\n\tAssetRecordType,\n\tassetMigrations,\n\tassetValidator,\n\ttype TLAsset,\n\ttype TLAssetId,\n\ttype TLAssetPartial,\n\ttype TLAssetShape,\n} from './records/TLAsset'\nexport {\n\tcreateBindingId,\n\tcreateBindingPropsMigrationIds,\n\tcreateBindingPropsMigrationSequence,\n\tisBinding,\n\tisBindingId,\n\trootBindingMigrations,\n\ttype TLBinding,\n\ttype TLBindingCreate,\n\ttype TLBindingId,\n\ttype TLBindingUpdate,\n\ttype TLDefaultBinding,\n\ttype TLUnknownBinding,\n} from './records/TLBinding'\nexport { CameraRecordType, type TLCamera, type TLCameraId } from './records/TLCamera'\nexport {\n\tDocumentRecordType,\n\tTLDOCUMENT_ID,\n\tisDocument,\n\ttype TLDocument,\n} from './records/TLDocument'\nexport {\n\tTLINSTANCE_ID,\n\tpluckPreservingValues,\n\ttype TLInstance,\n\ttype TLInstanceId,\n} from './records/TLInstance'\nexport {\n\tPageRecordType,\n\tisPageId,\n\tpageIdValidator,\n\ttype TLPage,\n\ttype TLPageId,\n} from './records/TLPage'\nexport {\n\tInstancePageStateRecordType,\n\ttype TLInstancePageState,\n\ttype TLInstancePageStateId,\n} from './records/TLPageState'\nexport {\n\tPointerRecordType,\n\tTLPOINTER_ID,\n\ttype TLPointer,\n\ttype TLPointerId,\n} from './records/TLPointer'\nexport {\n\tInstancePresenceRecordType,\n\ttype TLInstancePresence,\n\ttype TLInstancePresenceID,\n} from './records/TLPresence'\nexport { type TLRecord } from './records/TLRecord'\nexport {\n\tcreateShapeId,\n\tcreateShapePropsMigrationIds,\n\tcreateShapePropsMigrationSequence,\n\tgetShapePropKeysByStyle,\n\tisShape,\n\tisShapeId,\n\trootShapeMigrations,\n\ttype TLDefaultShape,\n\ttype TLParentId,\n\ttype TLShape,\n\ttype TLShapeId,\n\ttype TLShapePartial,\n\ttype TLUnknownShape,\n} from './records/TLShape'\nexport {\n\ttype RecordProps,\n\ttype RecordPropsType,\n\ttype TLPropsMigration,\n\ttype TLPropsMigrations,\n} from './recordsWithProps'\nexport { type ShapeWithCrop, type TLShapeCrop } from './shapes/ShapeWithCrop'\nexport {\n\tArrowShapeArrowheadEndStyle,\n\tArrowShapeArrowheadStartStyle,\n\tarrowShapeMigrations,\n\tarrowShapeProps,\n\ttype TLArrowShape,\n\ttype TLArrowShapeArrowheadStyle,\n\ttype TLArrowShapeProps,\n} from './shapes/TLArrowShape'\nexport {\n\tcreateShapeValidator,\n\tparentIdValidator,\n\tshapeIdValidator,\n\ttype TLBaseShape,\n} from './shapes/TLBaseShape'\nexport {\n\tbookmarkShapeMigrations,\n\tbookmarkShapeProps,\n\ttype TLBookmarkShape,\n\ttype TLBookmarkShapeProps,\n} from './shapes/TLBookmarkShape'\nexport {\n\tdrawShapeMigrations,\n\tdrawShapeProps,\n\ttype TLDrawShape,\n\ttype TLDrawShapeProps,\n\ttype TLDrawShapeSegment,\n} from './shapes/TLDrawShape'\nexport {\n\tembedShapeMigrations,\n\tembedShapeProps,\n\ttype TLEmbedShape,\n\ttype TLEmbedShapeProps,\n} from './shapes/TLEmbedShape'\nexport {\n\tframeShapeMigrations,\n\tframeShapeProps,\n\ttype TLFrameShape,\n\ttype TLFrameShapeProps,\n} from './shapes/TLFrameShape'\nexport {\n\tGeoShapeGeoStyle,\n\tgeoShapeMigrations,\n\tgeoShapeProps,\n\ttype TLGeoShape,\n\ttype TLGeoShapeGeoStyle,\n\ttype TLGeoShapeProps,\n} from './shapes/TLGeoShape'\nexport {\n\tgroupShapeMigrations,\n\tgroupShapeProps,\n\ttype TLGroupShape,\n\ttype TLGroupShapeProps,\n} from './shapes/TLGroupShape'\nexport {\n\thighlightShapeMigrations,\n\thighlightShapeProps,\n\ttype TLHighlightShape,\n\ttype TLHighlightShapeProps,\n} from './shapes/TLHighlightShape'\nexport {\n\tImageShapeCrop,\n\timageShapeMigrations,\n\timageShapeProps,\n\ttype TLImageShape,\n\ttype TLImageShapeProps,\n} from './shapes/TLImageShape'\nexport {\n\tLineShapeSplineStyle,\n\tlineShapeMigrations,\n\tlineShapeProps,\n\ttype TLLineShape,\n\ttype TLLineShapePoint,\n\ttype TLLineShapeProps,\n\ttype TLLineShapeSplineStyle,\n} from './shapes/TLLineShape'\nexport {\n\tnoteShapeMigrations,\n\tnoteShapeProps,\n\ttype TLNoteShape,\n\ttype TLNoteShapeProps,\n} from './shapes/TLNoteShape'\nexport {\n\ttextShapeMigrations,\n\ttextShapeProps,\n\ttype TLTextShape,\n\ttype TLTextShapeProps,\n} from './shapes/TLTextShape'\nexport {\n\tvideoShapeMigrations,\n\tvideoShapeProps,\n\ttype TLVideoShape,\n\ttype TLVideoShapeProps,\n} from './shapes/TLVideoShape'\nexport { EnumStyleProp, StyleProp, type StylePropValue } from './styles/StyleProp'\nexport {\n\tDefaultColorStyle,\n\tDefaultColorThemePalette,\n\tdefaultColorNames,\n\tgetDefaultColorTheme,\n\ttype TLDefaultColorStyle,\n\ttype TLDefaultColorTheme,\n\ttype TLDefaultColorThemeColor,\n} from './styles/TLColorStyle'\nexport { DefaultDashStyle, type TLDefaultDashStyle } from './styles/TLDashStyle'\nexport { DefaultFillStyle, type TLDefaultFillStyle } from './styles/TLFillStyle'\nexport {\n\tDefaultFontFamilies,\n\tDefaultFontStyle,\n\ttype TLDefaultFontStyle,\n} from './styles/TLFontStyle'\nexport {\n\tDefaultHorizontalAlignStyle,\n\ttype TLDefaultHorizontalAlignStyle,\n} from './styles/TLHorizontalAlignStyle'\nexport { DefaultSizeStyle, type TLDefaultSizeStyle } from './styles/TLSizeStyle'\nexport { DefaultTextAlignStyle, type TLDefaultTextAlignStyle } from './styles/TLTextAlignStyle'\nexport {\n\tDefaultVerticalAlignStyle,\n\ttype TLDefaultVerticalAlignStyle,\n} from './styles/TLVerticalAlignStyle'\nexport {\n\tLANGUAGES,\n\tgetDefaultTranslationLocale,\n\ttype TLLanguage,\n} from './translations/translations'\nexport { type SetValue } from './util-types'\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;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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA6C;AAU7C,yBAAyE;AAIzE,4BAKO;AACP,2BAIO;AACP,2CAKO;AACP,4BAMO;AACP,qBAIO;AACP,sBAAkE;AAClE,sBAAkE;AAClE,uBAAqD;AACrD,wBAA+D;AAC/D,wBAAuE;AACvE,4BAKO;AACP,0BAA4B;AAC5B,qBAQO;AACP,uBAaO;AACP,sBAAiE;AACjE,wBAKO;AACP,wBAKO;AACP,oBAMO;AACP,yBAIO;AACP,uBAKO;AACP,wBAIO;AAEP,qBAcO;AAQP,0BAQO;AACP,yBAKO;AACP,6BAKO;AACP,yBAMO;AACP,0BAKO;AACP,0BAKO;AACP,wBAOO;AACP,0BAKO;AACP,8BAKO;AACP,0BAMO;AACP,yBAQO;AACP,yBAKO;AACP,yBAKO;AACP,0BAKO;AACP,uBAA8D;AAC9D,0BAQO;AACP,yBAA0D;AAC1D,yBAA0D;AAC1D,yBAIO;AACP,oCAGO;AACP,yBAA0D;AAC1D,8BAAoE;AACpE,kCAGO;AACP,0BAIO;AAAA,IAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/misc/TLHandle.ts"],
|
|
4
|
-
"sourcesContent": ["import { IndexKey } from '@tldraw/utils'\nimport { SetValue } from '../util-types'\n\n/**\n * The handle types used by tldraw's default shapes.\n *\n * @public */\nexport const TL_HANDLE_TYPES = new Set(['vertex', 'virtual', 'create', 'clone'] as const)\n\n/**\n * A type for the handle types used by tldraw's default shapes.\n *\n * @public */\nexport type TLHandleType = SetValue<typeof TL_HANDLE_TYPES>\n\n/**\n * A base interface for a shape's handles.\n *\n * @public\n */\nexport interface TLHandle {\n\t/** A unique identifier for the handle. */\n\tid: string\n\
|
|
4
|
+
"sourcesContent": ["import { IndexKey } from '@tldraw/utils'\nimport { SetValue } from '../util-types'\n\n/**\n * The handle types used by tldraw's default shapes.\n *\n * @public */\nexport const TL_HANDLE_TYPES = new Set(['vertex', 'virtual', 'create', 'clone'] as const)\n\n/**\n * A type for the handle types used by tldraw's default shapes.\n *\n * @public */\nexport type TLHandleType = SetValue<typeof TL_HANDLE_TYPES>\n\n/**\n * A base interface for a shape's handles.\n *\n * @public\n */\nexport interface TLHandle {\n\t/** A unique identifier for the handle. */\n\tid: string\n\ttype: TLHandleType\n\tcanSnap?: boolean\n\tindex: IndexKey\n\tx: number\n\ty: number\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOO,MAAM,kBAAkB,oBAAI,IAAI,CAAC,UAAU,WAAW,UAAU,OAAO,CAAU;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -32,7 +32,7 @@ function processPropsMigrations(typeName, records) {
|
|
|
32
32
|
result.push(
|
|
33
33
|
(0, import_store.createMigrationSequence)({
|
|
34
34
|
sequenceId,
|
|
35
|
-
retroactive:
|
|
35
|
+
retroactive: false,
|
|
36
36
|
sequence: []
|
|
37
37
|
})
|
|
38
38
|
);
|
|
@@ -46,7 +46,7 @@ function processPropsMigrations(typeName, records) {
|
|
|
46
46
|
result.push(
|
|
47
47
|
(0, import_store.createMigrationSequence)({
|
|
48
48
|
sequenceId,
|
|
49
|
-
retroactive:
|
|
49
|
+
retroactive: false,
|
|
50
50
|
sequence: migrations.sequence.map(
|
|
51
51
|
(m) => "id" in m ? createPropsMigration(typeName, subType, m) : m
|
|
52
52
|
)
|
|
@@ -56,7 +56,7 @@ function processPropsMigrations(typeName, records) {
|
|
|
56
56
|
result.push(
|
|
57
57
|
(0, import_store.createMigrationSequence)({
|
|
58
58
|
sequenceId,
|
|
59
|
-
retroactive:
|
|
59
|
+
retroactive: false,
|
|
60
60
|
sequence: Object.keys(migrations.migrators).map((k) => Number(k)).sort((a, b) => a - b).map(
|
|
61
61
|
(version) => ({
|
|
62
62
|
id: `${sequenceId}/${version}`,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/recordsWithProps.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n\tMigration,\n\tMigrationId,\n\tMigrationSequence,\n\tRecordType,\n\tStandaloneDependsOn,\n\tUnknownRecord,\n\tcreateMigrationSequence,\n} from '@tldraw/store'\nimport { MakeUndefinedOptional, assert } from '@tldraw/utils'\nimport { T } from '@tldraw/validate'\nimport { SchemaPropsInfo } from './createTLSchema'\n\n/** @public */\nexport type RecordProps<R extends UnknownRecord & { props: object }> = {\n\t[K in keyof R['props']]: T.Validatable<R['props'][K]>\n}\n\n/** @public */\nexport type RecordPropsType<Config extends Record<string, T.Validatable<any>>> =\n\tMakeUndefinedOptional<{\n\t\t[K in keyof Config]: T.TypeOf<Config[K]>\n\t}>\n\n/**\n * @public\n */\nexport interface TLPropsMigration {\n\treadonly id: MigrationId\n\treadonly dependsOn?: MigrationId[]\n\t// eslint-disable-next-line @typescript-eslint/method-signature-style\n\treadonly up: (props: any) => any\n\t/**\n\t * If a down migration was deployed more than a couple of months ago it should be safe to retire it.\n\t * We only really need them to smooth over the transition between versions, and some folks do keep\n\t * browser tabs open for months without refreshing, but at a certain point that kind of behavior is\n\t * on them. Plus anyway recently chrome has started to actually kill tabs that are open for too long\n\t * rather than just suspending them, so if other browsers follow suit maybe it's less of a concern.\n\t *\n\t * @public\n\t */\n\treadonly down?: 'none' | 'retired' | ((props: any) => any)\n}\n\n/**\n * @public\n */\nexport interface TLPropsMigrations {\n\treadonly sequence: Array<StandaloneDependsOn | TLPropsMigration>\n}\n\nexport function processPropsMigrations<R extends UnknownRecord & { type: string; props: object }>(\n\ttypeName: R['typeName'],\n\trecords: Record<string, SchemaPropsInfo>\n) {\n\tconst result: MigrationSequence[] = []\n\n\tfor (const [subType, { migrations }] of Object.entries(records)) {\n\t\tconst sequenceId = `com.tldraw.${typeName}.${subType}`\n\t\tif (!migrations) {\n\t\t\t// provide empty migrations sequence to allow for future migrations\n\t\t\tresult.push(\n\t\t\t\tcreateMigrationSequence({\n\t\t\t\t\tsequenceId,\n\t\t\t\t\tretroactive:
|
|
4
|
+
"sourcesContent": ["import {\n\tMigration,\n\tMigrationId,\n\tMigrationSequence,\n\tRecordType,\n\tStandaloneDependsOn,\n\tUnknownRecord,\n\tcreateMigrationSequence,\n} from '@tldraw/store'\nimport { MakeUndefinedOptional, assert } from '@tldraw/utils'\nimport { T } from '@tldraw/validate'\nimport { SchemaPropsInfo } from './createTLSchema'\n\n/** @public */\nexport type RecordProps<R extends UnknownRecord & { props: object }> = {\n\t[K in keyof R['props']]: T.Validatable<R['props'][K]>\n}\n\n/** @public */\nexport type RecordPropsType<Config extends Record<string, T.Validatable<any>>> =\n\tMakeUndefinedOptional<{\n\t\t[K in keyof Config]: T.TypeOf<Config[K]>\n\t}>\n\n/**\n * @public\n */\nexport interface TLPropsMigration {\n\treadonly id: MigrationId\n\treadonly dependsOn?: MigrationId[]\n\t// eslint-disable-next-line @typescript-eslint/method-signature-style\n\treadonly up: (props: any) => any\n\t/**\n\t * If a down migration was deployed more than a couple of months ago it should be safe to retire it.\n\t * We only really need them to smooth over the transition between versions, and some folks do keep\n\t * browser tabs open for months without refreshing, but at a certain point that kind of behavior is\n\t * on them. Plus anyway recently chrome has started to actually kill tabs that are open for too long\n\t * rather than just suspending them, so if other browsers follow suit maybe it's less of a concern.\n\t *\n\t * @public\n\t */\n\treadonly down?: 'none' | 'retired' | ((props: any) => any)\n}\n\n/**\n * @public\n */\nexport interface TLPropsMigrations {\n\treadonly sequence: Array<StandaloneDependsOn | TLPropsMigration>\n}\n\nexport function processPropsMigrations<R extends UnknownRecord & { type: string; props: object }>(\n\ttypeName: R['typeName'],\n\trecords: Record<string, SchemaPropsInfo>\n) {\n\tconst result: MigrationSequence[] = []\n\n\tfor (const [subType, { migrations }] of Object.entries(records)) {\n\t\tconst sequenceId = `com.tldraw.${typeName}.${subType}`\n\t\tif (!migrations) {\n\t\t\t// provide empty migrations sequence to allow for future migrations\n\t\t\tresult.push(\n\t\t\t\tcreateMigrationSequence({\n\t\t\t\t\tsequenceId,\n\t\t\t\t\tretroactive: false,\n\t\t\t\t\tsequence: [],\n\t\t\t\t})\n\t\t\t)\n\t\t} else if ('sequenceId' in migrations) {\n\t\t\tassert(\n\t\t\t\tsequenceId === migrations.sequenceId,\n\t\t\t\t`sequenceId mismatch for ${subType} ${RecordType} migrations. Expected '${sequenceId}', got '${migrations.sequenceId}'`\n\t\t\t)\n\t\t\tresult.push(migrations)\n\t\t} else if ('sequence' in migrations) {\n\t\t\tresult.push(\n\t\t\t\tcreateMigrationSequence({\n\t\t\t\t\tsequenceId,\n\t\t\t\t\tretroactive: false,\n\t\t\t\t\tsequence: migrations.sequence.map((m) =>\n\t\t\t\t\t\t'id' in m ? createPropsMigration(typeName, subType, m) : m\n\t\t\t\t\t),\n\t\t\t\t})\n\t\t\t)\n\t\t} else {\n\t\t\t// legacy migrations, will be removed in the future\n\t\t\tresult.push(\n\t\t\t\tcreateMigrationSequence({\n\t\t\t\t\tsequenceId,\n\t\t\t\t\tretroactive: false,\n\t\t\t\t\tsequence: Object.keys(migrations.migrators)\n\t\t\t\t\t\t.map((k) => Number(k))\n\t\t\t\t\t\t.sort((a: number, b: number) => a - b)\n\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t(version): Migration => ({\n\t\t\t\t\t\t\t\tid: `${sequenceId}/${version}`,\n\t\t\t\t\t\t\t\tscope: 'record',\n\t\t\t\t\t\t\t\tfilter: (r) => r.typeName === typeName && (r as R).type === subType,\n\t\t\t\t\t\t\t\tup: (record: any) => {\n\t\t\t\t\t\t\t\t\tconst result = migrations.migrators[version].up(record)\n\t\t\t\t\t\t\t\t\tif (result) {\n\t\t\t\t\t\t\t\t\t\treturn result\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdown: (record: any) => {\n\t\t\t\t\t\t\t\t\tconst result = migrations.migrators[version].down(record)\n\t\t\t\t\t\t\t\t\tif (result) {\n\t\t\t\t\t\t\t\t\t\treturn result\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t),\n\t\t\t\t})\n\t\t\t)\n\t\t}\n\t}\n\n\treturn result\n}\n\nexport function createPropsMigration<R extends UnknownRecord & { type: string; props: object }>(\n\ttypeName: R['typeName'],\n\tsubType: R['type'],\n\tm: TLPropsMigration\n): Migration {\n\treturn {\n\t\tid: m.id,\n\t\tdependsOn: m.dependsOn,\n\t\tscope: 'record',\n\t\tfilter: (r) => r.typeName === typeName && (r as R).type === subType,\n\t\tup: (record: any) => {\n\t\t\tconst result = m.up(record.props)\n\t\t\tif (result) {\n\t\t\t\trecord.props = result\n\t\t\t}\n\t\t},\n\t\tdown:\n\t\t\ttypeof m.down === 'function'\n\t\t\t\t? (record: any) => {\n\t\t\t\t\t\tconst result = (m.down as (props: any) => any)(record.props)\n\t\t\t\t\t\tif (result) {\n\t\t\t\t\t\t\trecord.props = result\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t}\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAQO;AACP,mBAA8C;AA0CvC,SAAS,uBACf,UACA,SACC;AACD,QAAM,SAA8B,CAAC;AAErC,aAAW,CAAC,SAAS,EAAE,WAAW,CAAC,KAAK,OAAO,QAAQ,OAAO,GAAG;A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D;AAAA,UACD;AAAA,QACF,CAAC;AAAA,MACF;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AACR;AAEO,SAAS,qBACf,UACA,SACA,GACY;AACZ,SAAO;AAAA,IACN,IAAI,EAAE;AAAA,IACN,WAAW,EAAE;AAAA,IACb,OAAO;AAAA,IACP,QAAQ,CAAC,MAAM,EAAE,aAAa,YAAa,EAAQ,SAAS;AAAA,IAC5D,IAAI,CAAC,WAAgB;AACpB,YAAM,SAAS,EAAE,GAAG,OAAO,KAAK;AAChC,UAAI,QAAQ;AACX,eAAO,QAAQ;AAAA,MAChB;AAAA,IACD;AAAA,IACA,MACC,OAAO,EAAE,SAAS,aACf,CAAC,WAAgB;AACjB,YAAM,SAAU,EAAE,KAA6B,OAAO,KAAK;AAC3D,UAAI,QAAQ;AACX,eAAO,QAAQ;AAAA,MAChB;AAAA,IACD,IACC;AAAA,EACL;AACD;",
|
|
6
6
|
"names": ["result"]
|
|
7
7
|
}
|
|
@@ -20,7 +20,6 @@ var TLArrowShape_exports = {};
|
|
|
20
20
|
__export(TLArrowShape_exports, {
|
|
21
21
|
ArrowShapeArrowheadEndStyle: () => ArrowShapeArrowheadEndStyle,
|
|
22
22
|
ArrowShapeArrowheadStartStyle: () => ArrowShapeArrowheadStartStyle,
|
|
23
|
-
ArrowShapeKindStyle: () => ArrowShapeKindStyle,
|
|
24
23
|
arrowShapeMigrations: () => arrowShapeMigrations,
|
|
25
24
|
arrowShapeProps: () => arrowShapeProps,
|
|
26
25
|
arrowShapeVersions: () => arrowShapeVersions
|
|
@@ -38,11 +37,6 @@ var import_TLDashStyle = require("../styles/TLDashStyle");
|
|
|
38
37
|
var import_TLFillStyle = require("../styles/TLFillStyle");
|
|
39
38
|
var import_TLFontStyle = require("../styles/TLFontStyle");
|
|
40
39
|
var import_TLSizeStyle = require("../styles/TLSizeStyle");
|
|
41
|
-
const arrowKinds = ["arc", "elbow"];
|
|
42
|
-
const ArrowShapeKindStyle = import_StyleProp.StyleProp.defineEnum("tldraw:arrowKind", {
|
|
43
|
-
defaultValue: "arc",
|
|
44
|
-
values: arrowKinds
|
|
45
|
-
});
|
|
46
40
|
const arrowheadTypes = [
|
|
47
41
|
"arrow",
|
|
48
42
|
"triangle",
|
|
@@ -63,7 +57,6 @@ const ArrowShapeArrowheadEndStyle = import_StyleProp.StyleProp.defineEnum("tldra
|
|
|
63
57
|
values: arrowheadTypes
|
|
64
58
|
});
|
|
65
59
|
const arrowShapeProps = {
|
|
66
|
-
kind: ArrowShapeKindStyle,
|
|
67
60
|
labelColor: import_TLColorStyle.DefaultLabelColorStyle,
|
|
68
61
|
color: import_TLColorStyle.DefaultColorStyle,
|
|
69
62
|
fill: import_TLFillStyle.DefaultFillStyle,
|
|
@@ -77,16 +70,14 @@ const arrowShapeProps = {
|
|
|
77
70
|
bend: import_validate.T.number,
|
|
78
71
|
text: import_validate.T.string,
|
|
79
72
|
labelPosition: import_validate.T.number,
|
|
80
|
-
scale: import_validate.T.nonZeroNumber
|
|
81
|
-
elbowMidPoint: import_validate.T.number
|
|
73
|
+
scale: import_validate.T.nonZeroNumber
|
|
82
74
|
};
|
|
83
75
|
const arrowShapeVersions = (0, import_TLShape.createShapePropsMigrationIds)("arrow", {
|
|
84
76
|
AddLabelColor: 1,
|
|
85
77
|
AddIsPrecise: 2,
|
|
86
78
|
AddLabelPosition: 3,
|
|
87
79
|
ExtractBindings: 4,
|
|
88
|
-
AddScale: 5
|
|
89
|
-
AddElbow: 6
|
|
80
|
+
AddScale: 5
|
|
90
81
|
});
|
|
91
82
|
function propsMigration(migration) {
|
|
92
83
|
return (0, import_recordsWithProps.createPropsMigration)("shape", "arrow", migration);
|
|
@@ -198,17 +189,6 @@ const arrowShapeMigrations = (0, import_store.createMigrationSequence)({
|
|
|
198
189
|
down: (props) => {
|
|
199
190
|
delete props.scale;
|
|
200
191
|
}
|
|
201
|
-
}),
|
|
202
|
-
propsMigration({
|
|
203
|
-
id: arrowShapeVersions.AddElbow,
|
|
204
|
-
up: (props) => {
|
|
205
|
-
props.kind = "arc";
|
|
206
|
-
props.elbowMidPoint = 0.5;
|
|
207
|
-
},
|
|
208
|
-
down: (props) => {
|
|
209
|
-
delete props.kind;
|
|
210
|
-
delete props.elbowMidPoint;
|
|
211
|
-
}
|
|
212
192
|
})
|
|
213
193
|
]
|
|
214
194
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/shapes/TLArrowShape.ts"],
|
|
4
|
-
"sourcesContent": ["import { createMigrationSequence } from '@tldraw/store'\nimport { T } from '@tldraw/validate'\nimport { VecModel, vecModelValidator } from '../misc/geometry-types'\nimport { createBindingId } from '../records/TLBinding'\nimport { TLShapeId, createShapePropsMigrationIds } from '../records/TLShape'\nimport { RecordProps, TLPropsMigration, createPropsMigration } from '../recordsWithProps'\nimport { StyleProp } from '../styles/StyleProp'\nimport {\n\tDefaultColorStyle,\n\tDefaultLabelColorStyle,\n\tTLDefaultColorStyle,\n} from '../styles/TLColorStyle'\nimport { DefaultDashStyle, TLDefaultDashStyle } from '../styles/TLDashStyle'\nimport { DefaultFillStyle, TLDefaultFillStyle } from '../styles/TLFillStyle'\nimport { DefaultFontStyle, TLDefaultFontStyle } from '../styles/TLFontStyle'\nimport { DefaultSizeStyle, TLDefaultSizeStyle } from '../styles/TLSizeStyle'\nimport { TLBaseShape } from './TLBaseShape'\n\nconst
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA
|
|
4
|
+
"sourcesContent": ["import { createMigrationSequence } from '@tldraw/store'\nimport { T } from '@tldraw/validate'\nimport { TLArrowBinding } from '../bindings/TLArrowBinding'\nimport { VecModel, vecModelValidator } from '../misc/geometry-types'\nimport { createBindingId } from '../records/TLBinding'\nimport { TLShapeId, createShapePropsMigrationIds } from '../records/TLShape'\nimport { RecordProps, TLPropsMigration, createPropsMigration } from '../recordsWithProps'\nimport { StyleProp } from '../styles/StyleProp'\nimport {\n\tDefaultColorStyle,\n\tDefaultLabelColorStyle,\n\tTLDefaultColorStyle,\n} from '../styles/TLColorStyle'\nimport { DefaultDashStyle, TLDefaultDashStyle } from '../styles/TLDashStyle'\nimport { DefaultFillStyle, TLDefaultFillStyle } from '../styles/TLFillStyle'\nimport { DefaultFontStyle, TLDefaultFontStyle } from '../styles/TLFontStyle'\nimport { DefaultSizeStyle, TLDefaultSizeStyle } from '../styles/TLSizeStyle'\nimport { TLBaseShape } from './TLBaseShape'\n\nconst arrowheadTypes = [\n\t'arrow',\n\t'triangle',\n\t'square',\n\t'dot',\n\t'pipe',\n\t'diamond',\n\t'inverted',\n\t'bar',\n\t'none',\n] as const\n\n/** @public */\nexport const ArrowShapeArrowheadStartStyle = StyleProp.defineEnum('tldraw:arrowheadStart', {\n\tdefaultValue: 'none',\n\tvalues: arrowheadTypes,\n})\n\n/** @public */\nexport const ArrowShapeArrowheadEndStyle = StyleProp.defineEnum('tldraw:arrowheadEnd', {\n\tdefaultValue: 'arrow',\n\tvalues: arrowheadTypes,\n})\n\n/** @public */\nexport type TLArrowShapeArrowheadStyle = T.TypeOf<typeof ArrowShapeArrowheadStartStyle>\n\n/** @public */\nexport interface TLArrowShapeProps {\n\tlabelColor: TLDefaultColorStyle\n\tcolor: TLDefaultColorStyle\n\tfill: TLDefaultFillStyle\n\tdash: TLDefaultDashStyle\n\tsize: TLDefaultSizeStyle\n\tarrowheadStart: TLArrowShapeArrowheadStyle\n\tarrowheadEnd: TLArrowShapeArrowheadStyle\n\tfont: TLDefaultFontStyle\n\tstart: VecModel\n\tend: VecModel\n\tbend: number\n\ttext: string\n\tlabelPosition: number\n\tscale: number\n}\n\n/** @public */\nexport type TLArrowShape = TLBaseShape<'arrow', TLArrowShapeProps>\n\n/** @public */\nexport const arrowShapeProps: RecordProps<TLArrowShape> = {\n\tlabelColor: DefaultLabelColorStyle,\n\tcolor: DefaultColorStyle,\n\tfill: DefaultFillStyle,\n\tdash: DefaultDashStyle,\n\tsize: DefaultSizeStyle,\n\tarrowheadStart: ArrowShapeArrowheadStartStyle,\n\tarrowheadEnd: ArrowShapeArrowheadEndStyle,\n\tfont: DefaultFontStyle,\n\tstart: vecModelValidator,\n\tend: vecModelValidator,\n\tbend: T.number,\n\ttext: T.string,\n\tlabelPosition: T.number,\n\tscale: T.nonZeroNumber,\n}\n\nexport const arrowShapeVersions = createShapePropsMigrationIds('arrow', {\n\tAddLabelColor: 1,\n\tAddIsPrecise: 2,\n\tAddLabelPosition: 3,\n\tExtractBindings: 4,\n\tAddScale: 5,\n})\n\nfunction propsMigration(migration: TLPropsMigration) {\n\treturn createPropsMigration<TLArrowShape>('shape', 'arrow', migration)\n}\n\n/** @public */\nexport const arrowShapeMigrations = createMigrationSequence({\n\tsequenceId: 'com.tldraw.shape.arrow',\n\tretroactive: false,\n\tsequence: [\n\t\tpropsMigration({\n\t\t\tid: arrowShapeVersions.AddLabelColor,\n\t\t\tup: (props) => {\n\t\t\t\tprops.labelColor = 'black'\n\t\t\t},\n\t\t\tdown: 'retired',\n\t\t}),\n\n\t\tpropsMigration({\n\t\t\tid: arrowShapeVersions.AddIsPrecise,\n\t\t\tup: ({ start, end }) => {\n\t\t\t\tif (start.type === 'binding') {\n\t\t\t\t\tstart.isPrecise = !(start.normalizedAnchor.x === 0.5 && start.normalizedAnchor.y === 0.5)\n\t\t\t\t}\n\t\t\t\tif (end.type === 'binding') {\n\t\t\t\t\tend.isPrecise = !(end.normalizedAnchor.x === 0.5 && end.normalizedAnchor.y === 0.5)\n\t\t\t\t}\n\t\t\t},\n\t\t\tdown: ({ start, end }) => {\n\t\t\t\tif (start.type === 'binding') {\n\t\t\t\t\tif (!start.isPrecise) {\n\t\t\t\t\t\tstart.normalizedAnchor = { x: 0.5, y: 0.5 }\n\t\t\t\t\t}\n\t\t\t\t\tdelete start.isPrecise\n\t\t\t\t}\n\t\t\t\tif (end.type === 'binding') {\n\t\t\t\t\tif (!end.isPrecise) {\n\t\t\t\t\t\tend.normalizedAnchor = { x: 0.5, y: 0.5 }\n\t\t\t\t\t}\n\t\t\t\t\tdelete end.isPrecise\n\t\t\t\t}\n\t\t\t},\n\t\t}),\n\n\t\tpropsMigration({\n\t\t\tid: arrowShapeVersions.AddLabelPosition,\n\t\t\tup: (props) => {\n\t\t\t\tprops.labelPosition = 0.5\n\t\t\t},\n\t\t\tdown: (props) => {\n\t\t\t\tdelete props.labelPosition\n\t\t\t},\n\t\t}),\n\n\t\t{\n\t\t\tid: arrowShapeVersions.ExtractBindings,\n\t\t\tscope: 'store',\n\t\t\tup: (oldStore) => {\n\t\t\t\ttype OldArrowTerminal =\n\t\t\t\t\t| {\n\t\t\t\t\t\t\ttype: 'point'\n\t\t\t\t\t\t\tx: number\n\t\t\t\t\t\t\ty: number\n\t\t\t\t\t }\n\t\t\t\t\t| {\n\t\t\t\t\t\t\ttype: 'binding'\n\t\t\t\t\t\t\tboundShapeId: TLShapeId\n\t\t\t\t\t\t\tnormalizedAnchor: VecModel\n\t\t\t\t\t\t\tisExact: boolean\n\t\t\t\t\t\t\tisPrecise: boolean\n\t\t\t\t\t }\n\t\t\t\t\t// new type:\n\t\t\t\t\t| { type?: undefined; x: number; y: number }\n\n\t\t\t\ttype OldArrow = TLBaseShape<'arrow', { start: OldArrowTerminal; end: OldArrowTerminal }>\n\n\t\t\t\tconst arrows = Object.values(oldStore).filter(\n\t\t\t\t\t(r: any): r is OldArrow => r.typeName === 'shape' && r.type === 'arrow'\n\t\t\t\t)\n\n\t\t\t\tfor (const arrow of arrows) {\n\t\t\t\t\tconst { start, end } = arrow.props\n\t\t\t\t\tif (start.type === 'binding') {\n\t\t\t\t\t\tconst id = createBindingId()\n\t\t\t\t\t\tconst binding: TLArrowBinding = {\n\t\t\t\t\t\t\ttypeName: 'binding',\n\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\ttype: 'arrow',\n\t\t\t\t\t\t\tfromId: arrow.id,\n\t\t\t\t\t\t\ttoId: start.boundShapeId,\n\t\t\t\t\t\t\tmeta: {},\n\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\tterminal: 'start',\n\t\t\t\t\t\t\t\tnormalizedAnchor: start.normalizedAnchor,\n\t\t\t\t\t\t\t\tisExact: start.isExact,\n\t\t\t\t\t\t\t\tisPrecise: start.isPrecise,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\toldStore[id] = binding\n\t\t\t\t\t\tarrow.props.start = { x: 0, y: 0 }\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdelete arrow.props.start.type\n\t\t\t\t\t}\n\t\t\t\t\tif (end.type === 'binding') {\n\t\t\t\t\t\tconst id = createBindingId()\n\t\t\t\t\t\tconst binding: TLArrowBinding = {\n\t\t\t\t\t\t\ttypeName: 'binding',\n\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\ttype: 'arrow',\n\t\t\t\t\t\t\tfromId: arrow.id,\n\t\t\t\t\t\t\ttoId: end.boundShapeId,\n\t\t\t\t\t\t\tmeta: {},\n\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\tterminal: 'end',\n\t\t\t\t\t\t\t\tnormalizedAnchor: end.normalizedAnchor,\n\t\t\t\t\t\t\t\tisExact: end.isExact,\n\t\t\t\t\t\t\t\tisPrecise: end.isPrecise,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\toldStore[id] = binding\n\t\t\t\t\t\tarrow.props.end = { x: 0, y: 0 }\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdelete arrow.props.end.type\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\tpropsMigration({\n\t\t\tid: arrowShapeVersions.AddScale,\n\t\t\tup: (props) => {\n\t\t\t\tprops.scale = 1\n\t\t\t},\n\t\t\tdown: (props) => {\n\t\t\t\tdelete props.scale\n\t\t\t},\n\t\t}),\n\t],\n})\n"],
|
|
5
|
+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from "@tldraw/validate";
|
|
2
2
|
import { vecModelValidator } from "../misc/geometry-types.mjs";
|
|
3
|
-
import {
|
|
4
|
-
createBindingPropsMigrationIds,
|
|
5
|
-
createBindingPropsMigrationSequence
|
|
6
|
-
} from "../records/TLBinding.mjs";
|
|
3
|
+
import { createBindingPropsMigrationSequence } from "../records/TLBinding.mjs";
|
|
7
4
|
import { arrowShapeVersions } from "../shapes/TLArrowShape.mjs";
|
|
8
|
-
const ElbowArrowSnap = T.literalEnum("center", "edge-point", "edge", "none");
|
|
9
5
|
const arrowBindingProps = {
|
|
10
6
|
terminal: T.literalEnum("start", "end"),
|
|
11
7
|
normalizedAnchor: vecModelValidator,
|
|
12
8
|
isExact: T.boolean,
|
|
13
|
-
isPrecise: T.boolean
|
|
14
|
-
snap: ElbowArrowSnap
|
|
9
|
+
isPrecise: T.boolean
|
|
15
10
|
};
|
|
16
|
-
const arrowBindingVersions =
|
|
17
|
-
AddSnap: 1
|
|
18
|
-
});
|
|
11
|
+
const arrowBindingVersions = {};
|
|
19
12
|
const arrowBindingMigrations = createBindingPropsMigrationSequence({
|
|
20
|
-
sequence: [
|
|
21
|
-
{ dependsOn: [arrowShapeVersions.ExtractBindings] },
|
|
22
|
-
{
|
|
23
|
-
id: arrowBindingVersions.AddSnap,
|
|
24
|
-
up: (props) => {
|
|
25
|
-
props.snap = "none";
|
|
26
|
-
},
|
|
27
|
-
down: (props) => {
|
|
28
|
-
delete props.snap;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
]
|
|
13
|
+
sequence: [{ dependsOn: [arrowShapeVersions.ExtractBindings] }]
|
|
32
14
|
});
|
|
33
15
|
export {
|
|
34
|
-
ElbowArrowSnap,
|
|
35
16
|
arrowBindingMigrations,
|
|
36
17
|
arrowBindingProps,
|
|
37
18
|
arrowBindingVersions
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/bindings/TLArrowBinding.ts"],
|
|
4
|
-
"sourcesContent": ["import { T } from '@tldraw/validate'\nimport { VecModel, vecModelValidator } from '../misc/geometry-types'\nimport {
|
|
5
|
-
"mappings": "AAAA,SAAS,SAAS;AAClB,SAAmB,yBAAyB;AAC5C
|
|
4
|
+
"sourcesContent": ["import { T } from '@tldraw/validate'\nimport { VecModel, vecModelValidator } from '../misc/geometry-types'\nimport { createBindingPropsMigrationSequence } from '../records/TLBinding'\nimport { RecordProps } from '../recordsWithProps'\nimport { arrowShapeVersions } from '../shapes/TLArrowShape'\nimport { TLBaseBinding } from './TLBaseBinding'\n\n/** @public */\nexport interface TLArrowBindingProps {\n\tterminal: 'start' | 'end'\n\tnormalizedAnchor: VecModel\n\t/**\n\t * exact is whether the arrow head 'enters' the bound shape to point directly at the binding\n\t * anchor point\n\t */\n\tisExact: boolean\n\t/**\n\t * precise is whether to bind to the normalizedAnchor, or to the middle of the shape\n\t */\n\tisPrecise: boolean\n}\n\n/** @public */\nexport const arrowBindingProps: RecordProps<TLArrowBinding> = {\n\tterminal: T.literalEnum('start', 'end'),\n\tnormalizedAnchor: vecModelValidator,\n\tisExact: T.boolean,\n\tisPrecise: T.boolean,\n}\n\n/** @public */\nexport type TLArrowBinding = TLBaseBinding<'arrow', TLArrowBindingProps>\n\nexport const arrowBindingVersions = {} as const\n\n/** @public */\nexport const arrowBindingMigrations = createBindingPropsMigrationSequence({\n\tsequence: [{ dependsOn: [arrowShapeVersions.ExtractBindings] }],\n})\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,SAAS;AAClB,SAAmB,yBAAyB;AAC5C,SAAS,2CAA2C;AAEpD,SAAS,0BAA0B;AAmB5B,MAAM,oBAAiD;AAAA,EAC7D,UAAU,EAAE,YAAY,SAAS,KAAK;AAAA,EACtC,kBAAkB;AAAA,EAClB,SAAS,EAAE;AAAA,EACX,WAAW,EAAE;AACd;AAKO,MAAM,uBAAuB,CAAC;AAG9B,MAAM,yBAAyB,oCAAoC;AAAA,EACzE,UAAU,CAAC,EAAE,WAAW,CAAC,mBAAmB,eAAe,EAAE,CAAC;AAC/D,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist-esm/index.d.mts
CHANGED
|
@@ -24,36 +24,18 @@ export declare const arrowBindingMigrations: TLPropsMigrations;
|
|
|
24
24
|
/** @public */
|
|
25
25
|
export declare const arrowBindingProps: RecordProps<TLArrowBinding>;
|
|
26
26
|
|
|
27
|
-
/** @public */
|
|
28
|
-
export declare const arrowBindingVersions: {
|
|
29
|
-
AddSnap: `com.tldraw.binding.arrow/${number}`;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
27
|
/** @public */
|
|
33
28
|
export declare const ArrowShapeArrowheadEndStyle: EnumStyleProp<"arrow" | "bar" | "diamond" | "dot" | "inverted" | "none" | "pipe" | "square" | "triangle">;
|
|
34
29
|
|
|
35
30
|
/** @public */
|
|
36
31
|
export declare const ArrowShapeArrowheadStartStyle: EnumStyleProp<"arrow" | "bar" | "diamond" | "dot" | "inverted" | "none" | "pipe" | "square" | "triangle">;
|
|
37
32
|
|
|
38
|
-
/** @public */
|
|
39
|
-
export declare const ArrowShapeKindStyle: EnumStyleProp<"arc" | "elbow">;
|
|
40
|
-
|
|
41
33
|
/** @public */
|
|
42
34
|
export declare const arrowShapeMigrations: MigrationSequence;
|
|
43
35
|
|
|
44
36
|
/** @public */
|
|
45
37
|
export declare const arrowShapeProps: RecordProps<TLArrowShape>;
|
|
46
38
|
|
|
47
|
-
/** @public */
|
|
48
|
-
export declare const arrowShapeVersions: {
|
|
49
|
-
readonly AddElbow: "com.tldraw.shape.arrow/6";
|
|
50
|
-
readonly AddIsPrecise: "com.tldraw.shape.arrow/2";
|
|
51
|
-
readonly AddLabelColor: "com.tldraw.shape.arrow/1";
|
|
52
|
-
readonly AddLabelPosition: "com.tldraw.shape.arrow/3";
|
|
53
|
-
readonly AddScale: "com.tldraw.shape.arrow/5";
|
|
54
|
-
readonly ExtractBindings: "com.tldraw.shape.arrow/4";
|
|
55
|
-
};
|
|
56
|
-
|
|
57
39
|
/**
|
|
58
40
|
* A validator for asset record type Ids.
|
|
59
41
|
*
|
|
@@ -298,12 +280,6 @@ export declare const drawShapeMigrations: TLPropsMigrations;
|
|
|
298
280
|
/** @public */
|
|
299
281
|
export declare const drawShapeProps: RecordProps<TLDrawShape>;
|
|
300
282
|
|
|
301
|
-
/** @public */
|
|
302
|
-
export declare const ElbowArrowSnap: T.Validator<"center" | "edge-point" | "edge" | "none">;
|
|
303
|
-
|
|
304
|
-
/** @public */
|
|
305
|
-
export declare type ElbowArrowSnap = T.TypeOf<typeof ElbowArrowSnap>;
|
|
306
|
-
|
|
307
283
|
/** @public */
|
|
308
284
|
export declare const embedShapeMigrations: TLPropsMigrations;
|
|
309
285
|
|
|
@@ -781,7 +757,6 @@ export declare interface TLArrowBindingProps {
|
|
|
781
757
|
* precise is whether to bind to the normalizedAnchor, or to the middle of the shape
|
|
782
758
|
*/
|
|
783
759
|
isPrecise: boolean;
|
|
784
|
-
snap: ElbowArrowSnap;
|
|
785
760
|
}
|
|
786
761
|
|
|
787
762
|
/** @public */
|
|
@@ -790,12 +765,8 @@ export declare type TLArrowShape = TLBaseShape<'arrow', TLArrowShapeProps>;
|
|
|
790
765
|
/** @public */
|
|
791
766
|
export declare type TLArrowShapeArrowheadStyle = T.TypeOf<typeof ArrowShapeArrowheadStartStyle>;
|
|
792
767
|
|
|
793
|
-
/** @public */
|
|
794
|
-
export declare type TLArrowShapeKind = T.TypeOf<typeof ArrowShapeKindStyle>;
|
|
795
|
-
|
|
796
768
|
/** @public */
|
|
797
769
|
export declare interface TLArrowShapeProps {
|
|
798
|
-
kind: TLArrowShapeKind;
|
|
799
770
|
labelColor: TLDefaultColorStyle;
|
|
800
771
|
color: TLDefaultColorStyle;
|
|
801
772
|
fill: TLDefaultFillStyle;
|
|
@@ -810,7 +781,6 @@ export declare interface TLArrowShapeProps {
|
|
|
810
781
|
text: string;
|
|
811
782
|
labelPosition: number;
|
|
812
783
|
scale: number;
|
|
813
|
-
elbowMidPoint: number;
|
|
814
784
|
}
|
|
815
785
|
|
|
816
786
|
/** @public */
|
|
@@ -1201,7 +1171,6 @@ export declare interface TLGroupShapeProps {
|
|
|
1201
1171
|
export declare interface TLHandle {
|
|
1202
1172
|
/** A unique identifier for the handle. */
|
|
1203
1173
|
id: string;
|
|
1204
|
-
label?: string;
|
|
1205
1174
|
type: TLHandleType;
|
|
1206
1175
|
canSnap?: boolean;
|
|
1207
1176
|
index: IndexKey;
|
package/dist-esm/index.mjs
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { registerTldrawLibraryVersion } from "@tldraw/utils";
|
|
2
2
|
import { assetIdValidator, createAssetValidator } from "./assets/TLBaseAsset.mjs";
|
|
3
3
|
import {
|
|
4
|
-
ElbowArrowSnap,
|
|
5
4
|
arrowBindingMigrations,
|
|
6
|
-
arrowBindingProps
|
|
7
|
-
arrowBindingVersions
|
|
5
|
+
arrowBindingProps
|
|
8
6
|
} from "./bindings/TLArrowBinding.mjs";
|
|
9
7
|
import {
|
|
10
8
|
bindingIdValidator,
|
|
@@ -83,10 +81,8 @@ import {
|
|
|
83
81
|
import {
|
|
84
82
|
ArrowShapeArrowheadEndStyle,
|
|
85
83
|
ArrowShapeArrowheadStartStyle,
|
|
86
|
-
ArrowShapeKindStyle,
|
|
87
84
|
arrowShapeMigrations,
|
|
88
|
-
arrowShapeProps
|
|
89
|
-
arrowShapeVersions
|
|
85
|
+
arrowShapeProps
|
|
90
86
|
} from "./shapes/TLArrowShape.mjs";
|
|
91
87
|
import {
|
|
92
88
|
createShapeValidator,
|
|
@@ -171,13 +167,12 @@ import {
|
|
|
171
167
|
} from "./translations/translations.mjs";
|
|
172
168
|
registerTldrawLibraryVersion(
|
|
173
169
|
"@tldraw/tlschema",
|
|
174
|
-
"3.13.0-canary.
|
|
170
|
+
"3.13.0-canary.c4135f4903f5",
|
|
175
171
|
"esm"
|
|
176
172
|
);
|
|
177
173
|
export {
|
|
178
174
|
ArrowShapeArrowheadEndStyle,
|
|
179
175
|
ArrowShapeArrowheadStartStyle,
|
|
180
|
-
ArrowShapeKindStyle,
|
|
181
176
|
AssetRecordType,
|
|
182
177
|
CameraRecordType,
|
|
183
178
|
DefaultColorStyle,
|
|
@@ -191,7 +186,6 @@ export {
|
|
|
191
186
|
DefaultTextAlignStyle,
|
|
192
187
|
DefaultVerticalAlignStyle,
|
|
193
188
|
DocumentRecordType,
|
|
194
|
-
ElbowArrowSnap,
|
|
195
189
|
EnumStyleProp,
|
|
196
190
|
GeoShapeGeoStyle,
|
|
197
191
|
ImageShapeCrop,
|
|
@@ -211,10 +205,8 @@ export {
|
|
|
211
205
|
TL_SCRIBBLE_STATES,
|
|
212
206
|
arrowBindingMigrations,
|
|
213
207
|
arrowBindingProps,
|
|
214
|
-
arrowBindingVersions,
|
|
215
208
|
arrowShapeMigrations,
|
|
216
209
|
arrowShapeProps,
|
|
217
|
-
arrowShapeVersions,
|
|
218
210
|
assetIdValidator,
|
|
219
211
|
assetMigrations,
|
|
220
212
|
assetValidator,
|
package/dist-esm/index.mjs.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'\nexport {\n\ttype TLAssetContext,\n\ttype TLAssetStore,\n\ttype TLSerializedStore,\n\ttype TLStore,\n\ttype TLStoreProps,\n\ttype TLStoreSchema,\n\ttype TLStoreSnapshot,\n} from './TLStore'\nexport { assetIdValidator, createAssetValidator, type TLBaseAsset } from './assets/TLBaseAsset'\nexport { type TLBookmarkAsset } from './assets/TLBookmarkAsset'\nexport { type TLImageAsset } from './assets/TLImageAsset'\nexport { type TLVideoAsset } from './assets/TLVideoAsset'\nexport {\n\
|
|
5
|
-
"mappings": "AAAA,SAAS,oCAAoC;AAU7C,SAAS,kBAAkB,4BAA8C;AAIzE;AAAA,EACC;AAAA,EACA;AAAA,
|
|
4
|
+
"sourcesContent": ["import { registerTldrawLibraryVersion } from '@tldraw/utils'\nexport {\n\ttype TLAssetContext,\n\ttype TLAssetStore,\n\ttype TLSerializedStore,\n\ttype TLStore,\n\ttype TLStoreProps,\n\ttype TLStoreSchema,\n\ttype TLStoreSnapshot,\n} from './TLStore'\nexport { assetIdValidator, createAssetValidator, type TLBaseAsset } from './assets/TLBaseAsset'\nexport { type TLBookmarkAsset } from './assets/TLBookmarkAsset'\nexport { type TLImageAsset } from './assets/TLImageAsset'\nexport { type TLVideoAsset } from './assets/TLVideoAsset'\nexport {\n\tarrowBindingMigrations,\n\tarrowBindingProps,\n\ttype TLArrowBinding,\n\ttype TLArrowBindingProps,\n} from './bindings/TLArrowBinding'\nexport {\n\tbindingIdValidator,\n\tcreateBindingValidator,\n\ttype TLBaseBinding,\n} from './bindings/TLBaseBinding'\nexport {\n\tcreatePresenceStateDerivation,\n\tgetDefaultUserPresence,\n\ttype TLPresenceStateInfo,\n\ttype TLPresenceUserInfo,\n} from './createPresenceStateDerivation'\nexport {\n\tcreateTLSchema,\n\tdefaultBindingSchemas,\n\tdefaultShapeSchemas,\n\ttype SchemaPropsInfo,\n\ttype TLSchema,\n} from './createTLSchema'\nexport {\n\tTL_CANVAS_UI_COLOR_TYPES,\n\tcanvasUiColorTypeValidator,\n\ttype TLCanvasUiColor,\n} from './misc/TLColor'\nexport { TL_CURSOR_TYPES, type TLCursor, type TLCursorType } from './misc/TLCursor'\nexport { TL_HANDLE_TYPES, type TLHandle, type TLHandleType } from './misc/TLHandle'\nexport { opacityValidator, type TLOpacityType } from './misc/TLOpacity'\nexport { richTextValidator, toRichText, type TLRichText } from './misc/TLRichText'\nexport { TL_SCRIBBLE_STATES, scribbleValidator, type TLScribble } from './misc/TLScribble'\nexport {\n\tboxModelValidator,\n\tvecModelValidator,\n\ttype BoxModel,\n\ttype VecModel,\n} from './misc/geometry-types'\nexport { idValidator } from './misc/id-validator'\nexport {\n\tAssetRecordType,\n\tassetMigrations,\n\tassetValidator,\n\ttype TLAsset,\n\ttype TLAssetId,\n\ttype TLAssetPartial,\n\ttype TLAssetShape,\n} from './records/TLAsset'\nexport {\n\tcreateBindingId,\n\tcreateBindingPropsMigrationIds,\n\tcreateBindingPropsMigrationSequence,\n\tisBinding,\n\tisBindingId,\n\trootBindingMigrations,\n\ttype TLBinding,\n\ttype TLBindingCreate,\n\ttype TLBindingId,\n\ttype TLBindingUpdate,\n\ttype TLDefaultBinding,\n\ttype TLUnknownBinding,\n} from './records/TLBinding'\nexport { CameraRecordType, type TLCamera, type TLCameraId } from './records/TLCamera'\nexport {\n\tDocumentRecordType,\n\tTLDOCUMENT_ID,\n\tisDocument,\n\ttype TLDocument,\n} from './records/TLDocument'\nexport {\n\tTLINSTANCE_ID,\n\tpluckPreservingValues,\n\ttype TLInstance,\n\ttype TLInstanceId,\n} from './records/TLInstance'\nexport {\n\tPageRecordType,\n\tisPageId,\n\tpageIdValidator,\n\ttype TLPage,\n\ttype TLPageId,\n} from './records/TLPage'\nexport {\n\tInstancePageStateRecordType,\n\ttype TLInstancePageState,\n\ttype TLInstancePageStateId,\n} from './records/TLPageState'\nexport {\n\tPointerRecordType,\n\tTLPOINTER_ID,\n\ttype TLPointer,\n\ttype TLPointerId,\n} from './records/TLPointer'\nexport {\n\tInstancePresenceRecordType,\n\ttype TLInstancePresence,\n\ttype TLInstancePresenceID,\n} from './records/TLPresence'\nexport { type TLRecord } from './records/TLRecord'\nexport {\n\tcreateShapeId,\n\tcreateShapePropsMigrationIds,\n\tcreateShapePropsMigrationSequence,\n\tgetShapePropKeysByStyle,\n\tisShape,\n\tisShapeId,\n\trootShapeMigrations,\n\ttype TLDefaultShape,\n\ttype TLParentId,\n\ttype TLShape,\n\ttype TLShapeId,\n\ttype TLShapePartial,\n\ttype TLUnknownShape,\n} from './records/TLShape'\nexport {\n\ttype RecordProps,\n\ttype RecordPropsType,\n\ttype TLPropsMigration,\n\ttype TLPropsMigrations,\n} from './recordsWithProps'\nexport { type ShapeWithCrop, type TLShapeCrop } from './shapes/ShapeWithCrop'\nexport {\n\tArrowShapeArrowheadEndStyle,\n\tArrowShapeArrowheadStartStyle,\n\tarrowShapeMigrations,\n\tarrowShapeProps,\n\ttype TLArrowShape,\n\ttype TLArrowShapeArrowheadStyle,\n\ttype TLArrowShapeProps,\n} from './shapes/TLArrowShape'\nexport {\n\tcreateShapeValidator,\n\tparentIdValidator,\n\tshapeIdValidator,\n\ttype TLBaseShape,\n} from './shapes/TLBaseShape'\nexport {\n\tbookmarkShapeMigrations,\n\tbookmarkShapeProps,\n\ttype TLBookmarkShape,\n\ttype TLBookmarkShapeProps,\n} from './shapes/TLBookmarkShape'\nexport {\n\tdrawShapeMigrations,\n\tdrawShapeProps,\n\ttype TLDrawShape,\n\ttype TLDrawShapeProps,\n\ttype TLDrawShapeSegment,\n} from './shapes/TLDrawShape'\nexport {\n\tembedShapeMigrations,\n\tembedShapeProps,\n\ttype TLEmbedShape,\n\ttype TLEmbedShapeProps,\n} from './shapes/TLEmbedShape'\nexport {\n\tframeShapeMigrations,\n\tframeShapeProps,\n\ttype TLFrameShape,\n\ttype TLFrameShapeProps,\n} from './shapes/TLFrameShape'\nexport {\n\tGeoShapeGeoStyle,\n\tgeoShapeMigrations,\n\tgeoShapeProps,\n\ttype TLGeoShape,\n\ttype TLGeoShapeGeoStyle,\n\ttype TLGeoShapeProps,\n} from './shapes/TLGeoShape'\nexport {\n\tgroupShapeMigrations,\n\tgroupShapeProps,\n\ttype TLGroupShape,\n\ttype TLGroupShapeProps,\n} from './shapes/TLGroupShape'\nexport {\n\thighlightShapeMigrations,\n\thighlightShapeProps,\n\ttype TLHighlightShape,\n\ttype TLHighlightShapeProps,\n} from './shapes/TLHighlightShape'\nexport {\n\tImageShapeCrop,\n\timageShapeMigrations,\n\timageShapeProps,\n\ttype TLImageShape,\n\ttype TLImageShapeProps,\n} from './shapes/TLImageShape'\nexport {\n\tLineShapeSplineStyle,\n\tlineShapeMigrations,\n\tlineShapeProps,\n\ttype TLLineShape,\n\ttype TLLineShapePoint,\n\ttype TLLineShapeProps,\n\ttype TLLineShapeSplineStyle,\n} from './shapes/TLLineShape'\nexport {\n\tnoteShapeMigrations,\n\tnoteShapeProps,\n\ttype TLNoteShape,\n\ttype TLNoteShapeProps,\n} from './shapes/TLNoteShape'\nexport {\n\ttextShapeMigrations,\n\ttextShapeProps,\n\ttype TLTextShape,\n\ttype TLTextShapeProps,\n} from './shapes/TLTextShape'\nexport {\n\tvideoShapeMigrations,\n\tvideoShapeProps,\n\ttype TLVideoShape,\n\ttype TLVideoShapeProps,\n} from './shapes/TLVideoShape'\nexport { EnumStyleProp, StyleProp, type StylePropValue } from './styles/StyleProp'\nexport {\n\tDefaultColorStyle,\n\tDefaultColorThemePalette,\n\tdefaultColorNames,\n\tgetDefaultColorTheme,\n\ttype TLDefaultColorStyle,\n\ttype TLDefaultColorTheme,\n\ttype TLDefaultColorThemeColor,\n} from './styles/TLColorStyle'\nexport { DefaultDashStyle, type TLDefaultDashStyle } from './styles/TLDashStyle'\nexport { DefaultFillStyle, type TLDefaultFillStyle } from './styles/TLFillStyle'\nexport {\n\tDefaultFontFamilies,\n\tDefaultFontStyle,\n\ttype TLDefaultFontStyle,\n} from './styles/TLFontStyle'\nexport {\n\tDefaultHorizontalAlignStyle,\n\ttype TLDefaultHorizontalAlignStyle,\n} from './styles/TLHorizontalAlignStyle'\nexport { DefaultSizeStyle, type TLDefaultSizeStyle } from './styles/TLSizeStyle'\nexport { DefaultTextAlignStyle, type TLDefaultTextAlignStyle } from './styles/TLTextAlignStyle'\nexport {\n\tDefaultVerticalAlignStyle,\n\ttype TLDefaultVerticalAlignStyle,\n} from './styles/TLVerticalAlignStyle'\nexport {\n\tLANGUAGES,\n\tgetDefaultTranslationLocale,\n\ttype TLLanguage,\n} from './translations/translations'\nexport { type SetValue } from './util-types'\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,SAAS,oCAAoC;AAU7C,SAAS,kBAAkB,4BAA8C;AAIzE;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAEM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAEM;AACP,SAAS,uBAAyD;AAClE,SAAS,uBAAyD;AAClE,SAAS,wBAA4C;AACrD,SAAS,mBAAmB,kBAAmC;AAC/D,SAAS,oBAAoB,yBAA0C;AACvE;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP,SAAS,mBAAmB;AAC5B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAKM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAOM;AACP,SAAS,wBAAwD;AACjE;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAEM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,OAGM;AAEP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAOM;AAQP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAEM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAIM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAIM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAKM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP,SAAS,eAAe,iBAAsC;AAC9D;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIM;AACP,SAAS,wBAAiD;AAC1D,SAAS,wBAAiD;AAC1D;AAAA,EACC;AAAA,EACA;AAAA,OAEM;AACP;AAAA,EACC;AAAA,OAEM;AACP,SAAS,wBAAiD;AAC1D,SAAS,6BAA2D;AACpE;AAAA,EACC;AAAA,OAEM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAEM;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/misc/TLHandle.ts"],
|
|
4
|
-
"sourcesContent": ["import { IndexKey } from '@tldraw/utils'\nimport { SetValue } from '../util-types'\n\n/**\n * The handle types used by tldraw's default shapes.\n *\n * @public */\nexport const TL_HANDLE_TYPES = new Set(['vertex', 'virtual', 'create', 'clone'] as const)\n\n/**\n * A type for the handle types used by tldraw's default shapes.\n *\n * @public */\nexport type TLHandleType = SetValue<typeof TL_HANDLE_TYPES>\n\n/**\n * A base interface for a shape's handles.\n *\n * @public\n */\nexport interface TLHandle {\n\t/** A unique identifier for the handle. */\n\tid: string\n\
|
|
4
|
+
"sourcesContent": ["import { IndexKey } from '@tldraw/utils'\nimport { SetValue } from '../util-types'\n\n/**\n * The handle types used by tldraw's default shapes.\n *\n * @public */\nexport const TL_HANDLE_TYPES = new Set(['vertex', 'virtual', 'create', 'clone'] as const)\n\n/**\n * A type for the handle types used by tldraw's default shapes.\n *\n * @public */\nexport type TLHandleType = SetValue<typeof TL_HANDLE_TYPES>\n\n/**\n * A base interface for a shape's handles.\n *\n * @public\n */\nexport interface TLHandle {\n\t/** A unique identifier for the handle. */\n\tid: string\n\ttype: TLHandleType\n\tcanSnap?: boolean\n\tindex: IndexKey\n\tx: number\n\ty: number\n}\n"],
|
|
5
5
|
"mappings": "AAOO,MAAM,kBAAkB,oBAAI,IAAI,CAAC,UAAU,WAAW,UAAU,OAAO,CAAU;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -11,7 +11,7 @@ function processPropsMigrations(typeName, records) {
|
|
|
11
11
|
result.push(
|
|
12
12
|
createMigrationSequence({
|
|
13
13
|
sequenceId,
|
|
14
|
-
retroactive:
|
|
14
|
+
retroactive: false,
|
|
15
15
|
sequence: []
|
|
16
16
|
})
|
|
17
17
|
);
|
|
@@ -25,7 +25,7 @@ function processPropsMigrations(typeName, records) {
|
|
|
25
25
|
result.push(
|
|
26
26
|
createMigrationSequence({
|
|
27
27
|
sequenceId,
|
|
28
|
-
retroactive:
|
|
28
|
+
retroactive: false,
|
|
29
29
|
sequence: migrations.sequence.map(
|
|
30
30
|
(m) => "id" in m ? createPropsMigration(typeName, subType, m) : m
|
|
31
31
|
)
|
|
@@ -35,7 +35,7 @@ function processPropsMigrations(typeName, records) {
|
|
|
35
35
|
result.push(
|
|
36
36
|
createMigrationSequence({
|
|
37
37
|
sequenceId,
|
|
38
|
-
retroactive:
|
|
38
|
+
retroactive: false,
|
|
39
39
|
sequence: Object.keys(migrations.migrators).map((k) => Number(k)).sort((a, b) => a - b).map(
|
|
40
40
|
(version) => ({
|
|
41
41
|
id: `${sequenceId}/${version}`,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/recordsWithProps.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n\tMigration,\n\tMigrationId,\n\tMigrationSequence,\n\tRecordType,\n\tStandaloneDependsOn,\n\tUnknownRecord,\n\tcreateMigrationSequence,\n} from '@tldraw/store'\nimport { MakeUndefinedOptional, assert } from '@tldraw/utils'\nimport { T } from '@tldraw/validate'\nimport { SchemaPropsInfo } from './createTLSchema'\n\n/** @public */\nexport type RecordProps<R extends UnknownRecord & { props: object }> = {\n\t[K in keyof R['props']]: T.Validatable<R['props'][K]>\n}\n\n/** @public */\nexport type RecordPropsType<Config extends Record<string, T.Validatable<any>>> =\n\tMakeUndefinedOptional<{\n\t\t[K in keyof Config]: T.TypeOf<Config[K]>\n\t}>\n\n/**\n * @public\n */\nexport interface TLPropsMigration {\n\treadonly id: MigrationId\n\treadonly dependsOn?: MigrationId[]\n\t// eslint-disable-next-line @typescript-eslint/method-signature-style\n\treadonly up: (props: any) => any\n\t/**\n\t * If a down migration was deployed more than a couple of months ago it should be safe to retire it.\n\t * We only really need them to smooth over the transition between versions, and some folks do keep\n\t * browser tabs open for months without refreshing, but at a certain point that kind of behavior is\n\t * on them. Plus anyway recently chrome has started to actually kill tabs that are open for too long\n\t * rather than just suspending them, so if other browsers follow suit maybe it's less of a concern.\n\t *\n\t * @public\n\t */\n\treadonly down?: 'none' | 'retired' | ((props: any) => any)\n}\n\n/**\n * @public\n */\nexport interface TLPropsMigrations {\n\treadonly sequence: Array<StandaloneDependsOn | TLPropsMigration>\n}\n\nexport function processPropsMigrations<R extends UnknownRecord & { type: string; props: object }>(\n\ttypeName: R['typeName'],\n\trecords: Record<string, SchemaPropsInfo>\n) {\n\tconst result: MigrationSequence[] = []\n\n\tfor (const [subType, { migrations }] of Object.entries(records)) {\n\t\tconst sequenceId = `com.tldraw.${typeName}.${subType}`\n\t\tif (!migrations) {\n\t\t\t// provide empty migrations sequence to allow for future migrations\n\t\t\tresult.push(\n\t\t\t\tcreateMigrationSequence({\n\t\t\t\t\tsequenceId,\n\t\t\t\t\tretroactive:
|
|
4
|
+
"sourcesContent": ["import {\n\tMigration,\n\tMigrationId,\n\tMigrationSequence,\n\tRecordType,\n\tStandaloneDependsOn,\n\tUnknownRecord,\n\tcreateMigrationSequence,\n} from '@tldraw/store'\nimport { MakeUndefinedOptional, assert } from '@tldraw/utils'\nimport { T } from '@tldraw/validate'\nimport { SchemaPropsInfo } from './createTLSchema'\n\n/** @public */\nexport type RecordProps<R extends UnknownRecord & { props: object }> = {\n\t[K in keyof R['props']]: T.Validatable<R['props'][K]>\n}\n\n/** @public */\nexport type RecordPropsType<Config extends Record<string, T.Validatable<any>>> =\n\tMakeUndefinedOptional<{\n\t\t[K in keyof Config]: T.TypeOf<Config[K]>\n\t}>\n\n/**\n * @public\n */\nexport interface TLPropsMigration {\n\treadonly id: MigrationId\n\treadonly dependsOn?: MigrationId[]\n\t// eslint-disable-next-line @typescript-eslint/method-signature-style\n\treadonly up: (props: any) => any\n\t/**\n\t * If a down migration was deployed more than a couple of months ago it should be safe to retire it.\n\t * We only really need them to smooth over the transition between versions, and some folks do keep\n\t * browser tabs open for months without refreshing, but at a certain point that kind of behavior is\n\t * on them. Plus anyway recently chrome has started to actually kill tabs that are open for too long\n\t * rather than just suspending them, so if other browsers follow suit maybe it's less of a concern.\n\t *\n\t * @public\n\t */\n\treadonly down?: 'none' | 'retired' | ((props: any) => any)\n}\n\n/**\n * @public\n */\nexport interface TLPropsMigrations {\n\treadonly sequence: Array<StandaloneDependsOn | TLPropsMigration>\n}\n\nexport function processPropsMigrations<R extends UnknownRecord & { type: string; props: object }>(\n\ttypeName: R['typeName'],\n\trecords: Record<string, SchemaPropsInfo>\n) {\n\tconst result: MigrationSequence[] = []\n\n\tfor (const [subType, { migrations }] of Object.entries(records)) {\n\t\tconst sequenceId = `com.tldraw.${typeName}.${subType}`\n\t\tif (!migrations) {\n\t\t\t// provide empty migrations sequence to allow for future migrations\n\t\t\tresult.push(\n\t\t\t\tcreateMigrationSequence({\n\t\t\t\t\tsequenceId,\n\t\t\t\t\tretroactive: false,\n\t\t\t\t\tsequence: [],\n\t\t\t\t})\n\t\t\t)\n\t\t} else if ('sequenceId' in migrations) {\n\t\t\tassert(\n\t\t\t\tsequenceId === migrations.sequenceId,\n\t\t\t\t`sequenceId mismatch for ${subType} ${RecordType} migrations. Expected '${sequenceId}', got '${migrations.sequenceId}'`\n\t\t\t)\n\t\t\tresult.push(migrations)\n\t\t} else if ('sequence' in migrations) {\n\t\t\tresult.push(\n\t\t\t\tcreateMigrationSequence({\n\t\t\t\t\tsequenceId,\n\t\t\t\t\tretroactive: false,\n\t\t\t\t\tsequence: migrations.sequence.map((m) =>\n\t\t\t\t\t\t'id' in m ? createPropsMigration(typeName, subType, m) : m\n\t\t\t\t\t),\n\t\t\t\t})\n\t\t\t)\n\t\t} else {\n\t\t\t// legacy migrations, will be removed in the future\n\t\t\tresult.push(\n\t\t\t\tcreateMigrationSequence({\n\t\t\t\t\tsequenceId,\n\t\t\t\t\tretroactive: false,\n\t\t\t\t\tsequence: Object.keys(migrations.migrators)\n\t\t\t\t\t\t.map((k) => Number(k))\n\t\t\t\t\t\t.sort((a: number, b: number) => a - b)\n\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t(version): Migration => ({\n\t\t\t\t\t\t\t\tid: `${sequenceId}/${version}`,\n\t\t\t\t\t\t\t\tscope: 'record',\n\t\t\t\t\t\t\t\tfilter: (r) => r.typeName === typeName && (r as R).type === subType,\n\t\t\t\t\t\t\t\tup: (record: any) => {\n\t\t\t\t\t\t\t\t\tconst result = migrations.migrators[version].up(record)\n\t\t\t\t\t\t\t\t\tif (result) {\n\t\t\t\t\t\t\t\t\t\treturn result\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdown: (record: any) => {\n\t\t\t\t\t\t\t\t\tconst result = migrations.migrators[version].down(record)\n\t\t\t\t\t\t\t\t\tif (result) {\n\t\t\t\t\t\t\t\t\t\treturn result\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t),\n\t\t\t\t})\n\t\t\t)\n\t\t}\n\t}\n\n\treturn result\n}\n\nexport function createPropsMigration<R extends UnknownRecord & { type: string; props: object }>(\n\ttypeName: R['typeName'],\n\tsubType: R['type'],\n\tm: TLPropsMigration\n): Migration {\n\treturn {\n\t\tid: m.id,\n\t\tdependsOn: m.dependsOn,\n\t\tscope: 'record',\n\t\tfilter: (r) => r.typeName === typeName && (r as R).type === subType,\n\t\tup: (record: any) => {\n\t\t\tconst result = m.up(record.props)\n\t\t\tif (result) {\n\t\t\t\trecord.props = result\n\t\t\t}\n\t\t},\n\t\tdown:\n\t\t\ttypeof m.down === 'function'\n\t\t\t\t? (record: any) => {\n\t\t\t\t\t\tconst result = (m.down as (props: any) => any)(record.props)\n\t\t\t\t\t\tif (result) {\n\t\t\t\t\t\t\trecord.props = result\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t}\n}\n"],
|
|
5
5
|
"mappings": "AAAA;AAAA,EAIC;AAAA,EAGA;AAAA,OACM;AACP,SAAgC,cAAc;AA0CvC,SAAS,uBACf,UACA,SACC;AACD,QAAM,SAA8B,CAAC;AAErC,aAAW,CAAC,SAAS,EAAE,WAAW,CAAC,KAAK,OAAO,QAAQ,OAAO,GAAG;AAChE,UAAM,aAAa,cAAc,QAAQ,IAAI,OAAO;AACpD,QAAI,CAAC,YAAY;AAEhB,aAAO;AAAA,QACN,wBAAwB;AAAA,UACvB;AAAA,UACA,aAAa;AAAA,UACb,UAAU,CAAC;AAAA,QACZ,CAAC;AAAA,MACF;AAAA,IACD,WAAW,gBAAgB,YAAY;AACtC;AAAA,QACC,eAAe,WAAW;AAAA,QAC1B,2BAA2B,OAAO,IAAI,UAAU,0BAA0B,UAAU,WAA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EAAE,GAAG,OAAO,KAAK;AAChC,UAAI,QAAQ;AACX,eAAO,QAAQ;AAAA,MAChB;AAAA,IACD;AAAA,IACA,MACC,OAAO,EAAE,SAAS,aACf,CAAC,WAAgB;AACjB,YAAM,SAAU,EAAE,KAA6B,OAAO,KAAK;AAC3D,UAAI,QAAQ;AACX,eAAO,QAAQ;AAAA,MAChB;AAAA,IACD,IACC;AAAA,EACL;AACD;",
|
|
6
6
|
"names": ["result"]
|
|
7
7
|
}
|
|
@@ -13,11 +13,6 @@ import { DefaultDashStyle } from "../styles/TLDashStyle.mjs";
|
|
|
13
13
|
import { DefaultFillStyle } from "../styles/TLFillStyle.mjs";
|
|
14
14
|
import { DefaultFontStyle } from "../styles/TLFontStyle.mjs";
|
|
15
15
|
import { DefaultSizeStyle } from "../styles/TLSizeStyle.mjs";
|
|
16
|
-
const arrowKinds = ["arc", "elbow"];
|
|
17
|
-
const ArrowShapeKindStyle = StyleProp.defineEnum("tldraw:arrowKind", {
|
|
18
|
-
defaultValue: "arc",
|
|
19
|
-
values: arrowKinds
|
|
20
|
-
});
|
|
21
16
|
const arrowheadTypes = [
|
|
22
17
|
"arrow",
|
|
23
18
|
"triangle",
|
|
@@ -38,7 +33,6 @@ const ArrowShapeArrowheadEndStyle = StyleProp.defineEnum("tldraw:arrowheadEnd",
|
|
|
38
33
|
values: arrowheadTypes
|
|
39
34
|
});
|
|
40
35
|
const arrowShapeProps = {
|
|
41
|
-
kind: ArrowShapeKindStyle,
|
|
42
36
|
labelColor: DefaultLabelColorStyle,
|
|
43
37
|
color: DefaultColorStyle,
|
|
44
38
|
fill: DefaultFillStyle,
|
|
@@ -52,16 +46,14 @@ const arrowShapeProps = {
|
|
|
52
46
|
bend: T.number,
|
|
53
47
|
text: T.string,
|
|
54
48
|
labelPosition: T.number,
|
|
55
|
-
scale: T.nonZeroNumber
|
|
56
|
-
elbowMidPoint: T.number
|
|
49
|
+
scale: T.nonZeroNumber
|
|
57
50
|
};
|
|
58
51
|
const arrowShapeVersions = createShapePropsMigrationIds("arrow", {
|
|
59
52
|
AddLabelColor: 1,
|
|
60
53
|
AddIsPrecise: 2,
|
|
61
54
|
AddLabelPosition: 3,
|
|
62
55
|
ExtractBindings: 4,
|
|
63
|
-
AddScale: 5
|
|
64
|
-
AddElbow: 6
|
|
56
|
+
AddScale: 5
|
|
65
57
|
});
|
|
66
58
|
function propsMigration(migration) {
|
|
67
59
|
return createPropsMigration("shape", "arrow", migration);
|
|
@@ -173,24 +165,12 @@ const arrowShapeMigrations = createMigrationSequence({
|
|
|
173
165
|
down: (props) => {
|
|
174
166
|
delete props.scale;
|
|
175
167
|
}
|
|
176
|
-
}),
|
|
177
|
-
propsMigration({
|
|
178
|
-
id: arrowShapeVersions.AddElbow,
|
|
179
|
-
up: (props) => {
|
|
180
|
-
props.kind = "arc";
|
|
181
|
-
props.elbowMidPoint = 0.5;
|
|
182
|
-
},
|
|
183
|
-
down: (props) => {
|
|
184
|
-
delete props.kind;
|
|
185
|
-
delete props.elbowMidPoint;
|
|
186
|
-
}
|
|
187
168
|
})
|
|
188
169
|
]
|
|
189
170
|
});
|
|
190
171
|
export {
|
|
191
172
|
ArrowShapeArrowheadEndStyle,
|
|
192
173
|
ArrowShapeArrowheadStartStyle,
|
|
193
|
-
ArrowShapeKindStyle,
|
|
194
174
|
arrowShapeMigrations,
|
|
195
175
|
arrowShapeProps,
|
|
196
176
|
arrowShapeVersions
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/shapes/TLArrowShape.ts"],
|
|
4
|
-
"sourcesContent": ["import { createMigrationSequence } from '@tldraw/store'\nimport { T } from '@tldraw/validate'\nimport { VecModel, vecModelValidator } from '../misc/geometry-types'\nimport { createBindingId } from '../records/TLBinding'\nimport { TLShapeId, createShapePropsMigrationIds } from '../records/TLShape'\nimport { RecordProps, TLPropsMigration, createPropsMigration } from '../recordsWithProps'\nimport { StyleProp } from '../styles/StyleProp'\nimport {\n\tDefaultColorStyle,\n\tDefaultLabelColorStyle,\n\tTLDefaultColorStyle,\n} from '../styles/TLColorStyle'\nimport { DefaultDashStyle, TLDefaultDashStyle } from '../styles/TLDashStyle'\nimport { DefaultFillStyle, TLDefaultFillStyle } from '../styles/TLFillStyle'\nimport { DefaultFontStyle, TLDefaultFontStyle } from '../styles/TLFontStyle'\nimport { DefaultSizeStyle, TLDefaultSizeStyle } from '../styles/TLSizeStyle'\nimport { TLBaseShape } from './TLBaseShape'\n\nconst
|
|
5
|
-
"mappings": "AAAA,SAAS,+BAA+B;AACxC,SAAS,SAAS;
|
|
4
|
+
"sourcesContent": ["import { createMigrationSequence } from '@tldraw/store'\nimport { T } from '@tldraw/validate'\nimport { TLArrowBinding } from '../bindings/TLArrowBinding'\nimport { VecModel, vecModelValidator } from '../misc/geometry-types'\nimport { createBindingId } from '../records/TLBinding'\nimport { TLShapeId, createShapePropsMigrationIds } from '../records/TLShape'\nimport { RecordProps, TLPropsMigration, createPropsMigration } from '../recordsWithProps'\nimport { StyleProp } from '../styles/StyleProp'\nimport {\n\tDefaultColorStyle,\n\tDefaultLabelColorStyle,\n\tTLDefaultColorStyle,\n} from '../styles/TLColorStyle'\nimport { DefaultDashStyle, TLDefaultDashStyle } from '../styles/TLDashStyle'\nimport { DefaultFillStyle, TLDefaultFillStyle } from '../styles/TLFillStyle'\nimport { DefaultFontStyle, TLDefaultFontStyle } from '../styles/TLFontStyle'\nimport { DefaultSizeStyle, TLDefaultSizeStyle } from '../styles/TLSizeStyle'\nimport { TLBaseShape } from './TLBaseShape'\n\nconst arrowheadTypes = [\n\t'arrow',\n\t'triangle',\n\t'square',\n\t'dot',\n\t'pipe',\n\t'diamond',\n\t'inverted',\n\t'bar',\n\t'none',\n] as const\n\n/** @public */\nexport const ArrowShapeArrowheadStartStyle = StyleProp.defineEnum('tldraw:arrowheadStart', {\n\tdefaultValue: 'none',\n\tvalues: arrowheadTypes,\n})\n\n/** @public */\nexport const ArrowShapeArrowheadEndStyle = StyleProp.defineEnum('tldraw:arrowheadEnd', {\n\tdefaultValue: 'arrow',\n\tvalues: arrowheadTypes,\n})\n\n/** @public */\nexport type TLArrowShapeArrowheadStyle = T.TypeOf<typeof ArrowShapeArrowheadStartStyle>\n\n/** @public */\nexport interface TLArrowShapeProps {\n\tlabelColor: TLDefaultColorStyle\n\tcolor: TLDefaultColorStyle\n\tfill: TLDefaultFillStyle\n\tdash: TLDefaultDashStyle\n\tsize: TLDefaultSizeStyle\n\tarrowheadStart: TLArrowShapeArrowheadStyle\n\tarrowheadEnd: TLArrowShapeArrowheadStyle\n\tfont: TLDefaultFontStyle\n\tstart: VecModel\n\tend: VecModel\n\tbend: number\n\ttext: string\n\tlabelPosition: number\n\tscale: number\n}\n\n/** @public */\nexport type TLArrowShape = TLBaseShape<'arrow', TLArrowShapeProps>\n\n/** @public */\nexport const arrowShapeProps: RecordProps<TLArrowShape> = {\n\tlabelColor: DefaultLabelColorStyle,\n\tcolor: DefaultColorStyle,\n\tfill: DefaultFillStyle,\n\tdash: DefaultDashStyle,\n\tsize: DefaultSizeStyle,\n\tarrowheadStart: ArrowShapeArrowheadStartStyle,\n\tarrowheadEnd: ArrowShapeArrowheadEndStyle,\n\tfont: DefaultFontStyle,\n\tstart: vecModelValidator,\n\tend: vecModelValidator,\n\tbend: T.number,\n\ttext: T.string,\n\tlabelPosition: T.number,\n\tscale: T.nonZeroNumber,\n}\n\nexport const arrowShapeVersions = createShapePropsMigrationIds('arrow', {\n\tAddLabelColor: 1,\n\tAddIsPrecise: 2,\n\tAddLabelPosition: 3,\n\tExtractBindings: 4,\n\tAddScale: 5,\n})\n\nfunction propsMigration(migration: TLPropsMigration) {\n\treturn createPropsMigration<TLArrowShape>('shape', 'arrow', migration)\n}\n\n/** @public */\nexport const arrowShapeMigrations = createMigrationSequence({\n\tsequenceId: 'com.tldraw.shape.arrow',\n\tretroactive: false,\n\tsequence: [\n\t\tpropsMigration({\n\t\t\tid: arrowShapeVersions.AddLabelColor,\n\t\t\tup: (props) => {\n\t\t\t\tprops.labelColor = 'black'\n\t\t\t},\n\t\t\tdown: 'retired',\n\t\t}),\n\n\t\tpropsMigration({\n\t\t\tid: arrowShapeVersions.AddIsPrecise,\n\t\t\tup: ({ start, end }) => {\n\t\t\t\tif (start.type === 'binding') {\n\t\t\t\t\tstart.isPrecise = !(start.normalizedAnchor.x === 0.5 && start.normalizedAnchor.y === 0.5)\n\t\t\t\t}\n\t\t\t\tif (end.type === 'binding') {\n\t\t\t\t\tend.isPrecise = !(end.normalizedAnchor.x === 0.5 && end.normalizedAnchor.y === 0.5)\n\t\t\t\t}\n\t\t\t},\n\t\t\tdown: ({ start, end }) => {\n\t\t\t\tif (start.type === 'binding') {\n\t\t\t\t\tif (!start.isPrecise) {\n\t\t\t\t\t\tstart.normalizedAnchor = { x: 0.5, y: 0.5 }\n\t\t\t\t\t}\n\t\t\t\t\tdelete start.isPrecise\n\t\t\t\t}\n\t\t\t\tif (end.type === 'binding') {\n\t\t\t\t\tif (!end.isPrecise) {\n\t\t\t\t\t\tend.normalizedAnchor = { x: 0.5, y: 0.5 }\n\t\t\t\t\t}\n\t\t\t\t\tdelete end.isPrecise\n\t\t\t\t}\n\t\t\t},\n\t\t}),\n\n\t\tpropsMigration({\n\t\t\tid: arrowShapeVersions.AddLabelPosition,\n\t\t\tup: (props) => {\n\t\t\t\tprops.labelPosition = 0.5\n\t\t\t},\n\t\t\tdown: (props) => {\n\t\t\t\tdelete props.labelPosition\n\t\t\t},\n\t\t}),\n\n\t\t{\n\t\t\tid: arrowShapeVersions.ExtractBindings,\n\t\t\tscope: 'store',\n\t\t\tup: (oldStore) => {\n\t\t\t\ttype OldArrowTerminal =\n\t\t\t\t\t| {\n\t\t\t\t\t\t\ttype: 'point'\n\t\t\t\t\t\t\tx: number\n\t\t\t\t\t\t\ty: number\n\t\t\t\t\t }\n\t\t\t\t\t| {\n\t\t\t\t\t\t\ttype: 'binding'\n\t\t\t\t\t\t\tboundShapeId: TLShapeId\n\t\t\t\t\t\t\tnormalizedAnchor: VecModel\n\t\t\t\t\t\t\tisExact: boolean\n\t\t\t\t\t\t\tisPrecise: boolean\n\t\t\t\t\t }\n\t\t\t\t\t// new type:\n\t\t\t\t\t| { type?: undefined; x: number; y: number }\n\n\t\t\t\ttype OldArrow = TLBaseShape<'arrow', { start: OldArrowTerminal; end: OldArrowTerminal }>\n\n\t\t\t\tconst arrows = Object.values(oldStore).filter(\n\t\t\t\t\t(r: any): r is OldArrow => r.typeName === 'shape' && r.type === 'arrow'\n\t\t\t\t)\n\n\t\t\t\tfor (const arrow of arrows) {\n\t\t\t\t\tconst { start, end } = arrow.props\n\t\t\t\t\tif (start.type === 'binding') {\n\t\t\t\t\t\tconst id = createBindingId()\n\t\t\t\t\t\tconst binding: TLArrowBinding = {\n\t\t\t\t\t\t\ttypeName: 'binding',\n\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\ttype: 'arrow',\n\t\t\t\t\t\t\tfromId: arrow.id,\n\t\t\t\t\t\t\ttoId: start.boundShapeId,\n\t\t\t\t\t\t\tmeta: {},\n\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\tterminal: 'start',\n\t\t\t\t\t\t\t\tnormalizedAnchor: start.normalizedAnchor,\n\t\t\t\t\t\t\t\tisExact: start.isExact,\n\t\t\t\t\t\t\t\tisPrecise: start.isPrecise,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\toldStore[id] = binding\n\t\t\t\t\t\tarrow.props.start = { x: 0, y: 0 }\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdelete arrow.props.start.type\n\t\t\t\t\t}\n\t\t\t\t\tif (end.type === 'binding') {\n\t\t\t\t\t\tconst id = createBindingId()\n\t\t\t\t\t\tconst binding: TLArrowBinding = {\n\t\t\t\t\t\t\ttypeName: 'binding',\n\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\ttype: 'arrow',\n\t\t\t\t\t\t\tfromId: arrow.id,\n\t\t\t\t\t\t\ttoId: end.boundShapeId,\n\t\t\t\t\t\t\tmeta: {},\n\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\tterminal: 'end',\n\t\t\t\t\t\t\t\tnormalizedAnchor: end.normalizedAnchor,\n\t\t\t\t\t\t\t\tisExact: end.isExact,\n\t\t\t\t\t\t\t\tisPrecise: end.isPrecise,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\toldStore[id] = binding\n\t\t\t\t\t\tarrow.props.end = { x: 0, y: 0 }\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdelete arrow.props.end.type\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\tpropsMigration({\n\t\t\tid: arrowShapeVersions.AddScale,\n\t\t\tup: (props) => {\n\t\t\t\tprops.scale = 1\n\t\t\t},\n\t\t\tdown: (props) => {\n\t\t\t\tdelete props.scale\n\t\t\t},\n\t\t}),\n\t],\n})\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,+BAA+B;AACxC,SAAS,SAAS;AAElB,SAAmB,yBAAyB;AAC5C,SAAS,uBAAuB;AAChC,SAAoB,oCAAoC;AACxD,SAAwC,4BAA4B;AACpE,SAAS,iBAAiB;AAC1B;AAAA,EACC;AAAA,EACA;AAAA,OAEM;AACP,SAAS,wBAA4C;AACrD,SAAS,wBAA4C;AACrD,SAAS,wBAA4C;AACrD,SAAS,wBAA4C;AAGrD,MAAM,iBAAiB;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAGO,MAAM,gCAAgC,UAAU,WAAW,yBAAyB;AAAA,EAC1F,cAAc;AAAA,EACd,QAAQ;AACT,CAAC;AAGM,MAAM,8BAA8B,UAAU,WAAW,uBAAuB;AAAA,EACtF,cAAc;AAAA,EACd,QAAQ;AACT,CAAC;AA2BM,MAAM,kBAA6C;AAAA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AAQ,MAAM;AAAA,cACd,MAAM,IAAI;AAAA,cACV,MAAM,CAAC;AAAA,cACP,OAAO;AAAA,gBACN,UAAU;AAAA,gBACV,kBAAkB,IAAI;AAAA,gBACtB,SAAS,IAAI;AAAA,gBACb,WAAW,IAAI;AAAA,cAChB;AAAA,YACD;AAEA,qBAAS,EAAE,IAAI;AACf,kBAAM,MAAM,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE;AAAA,UAChC,OAAO;AACN,mBAAO,MAAM,MAAM,IAAI;AAAA,UACxB;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,IACA,eAAe;AAAA,MACd,IAAI,mBAAmB;AAAA,MACvB,IAAI,CAAC,UAAU;AACd,cAAM,QAAQ;AAAA,MACf;AAAA,MACA,MAAM,CAAC,UAAU;AAChB,eAAO,MAAM;AAAA,MACd;AAAA,IACD,CAAC;AAAA,EACF;AACD,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tldraw/tlschema",
|
|
3
3
|
"description": "A tiny little drawing app (schema).",
|
|
4
|
-
"version": "3.13.0-canary.
|
|
4
|
+
"version": "3.13.0-canary.c4135f4903f5",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "tldraw Inc.",
|
|
7
7
|
"email": "hello@tldraw.com"
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@tldraw/state": "3.13.0-canary.
|
|
58
|
-
"@tldraw/store": "3.13.0-canary.
|
|
59
|
-
"@tldraw/utils": "3.13.0-canary.
|
|
60
|
-
"@tldraw/validate": "3.13.0-canary.
|
|
57
|
+
"@tldraw/state": "3.13.0-canary.c4135f4903f5",
|
|
58
|
+
"@tldraw/store": "3.13.0-canary.c4135f4903f5",
|
|
59
|
+
"@tldraw/utils": "3.13.0-canary.c4135f4903f5",
|
|
60
|
+
"@tldraw/validate": "3.13.0-canary.c4135f4903f5"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"react": "^18.2.0 || ^19.0.0",
|
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import { T } from '@tldraw/validate'
|
|
2
2
|
import { VecModel, vecModelValidator } from '../misc/geometry-types'
|
|
3
|
-
import {
|
|
4
|
-
createBindingPropsMigrationIds,
|
|
5
|
-
createBindingPropsMigrationSequence,
|
|
6
|
-
} from '../records/TLBinding'
|
|
3
|
+
import { createBindingPropsMigrationSequence } from '../records/TLBinding'
|
|
7
4
|
import { RecordProps } from '../recordsWithProps'
|
|
8
5
|
import { arrowShapeVersions } from '../shapes/TLArrowShape'
|
|
9
6
|
import { TLBaseBinding } from './TLBaseBinding'
|
|
10
7
|
|
|
11
|
-
/** @public */
|
|
12
|
-
export const ElbowArrowSnap = T.literalEnum('center', 'edge-point', 'edge', 'none')
|
|
13
|
-
/** @public */
|
|
14
|
-
export type ElbowArrowSnap = T.TypeOf<typeof ElbowArrowSnap>
|
|
15
|
-
|
|
16
8
|
/** @public */
|
|
17
9
|
export interface TLArrowBindingProps {
|
|
18
10
|
terminal: 'start' | 'end'
|
|
@@ -26,7 +18,6 @@ export interface TLArrowBindingProps {
|
|
|
26
18
|
* precise is whether to bind to the normalizedAnchor, or to the middle of the shape
|
|
27
19
|
*/
|
|
28
20
|
isPrecise: boolean
|
|
29
|
-
snap: ElbowArrowSnap
|
|
30
21
|
}
|
|
31
22
|
|
|
32
23
|
/** @public */
|
|
@@ -35,29 +26,14 @@ export const arrowBindingProps: RecordProps<TLArrowBinding> = {
|
|
|
35
26
|
normalizedAnchor: vecModelValidator,
|
|
36
27
|
isExact: T.boolean,
|
|
37
28
|
isPrecise: T.boolean,
|
|
38
|
-
snap: ElbowArrowSnap,
|
|
39
29
|
}
|
|
40
30
|
|
|
41
31
|
/** @public */
|
|
42
32
|
export type TLArrowBinding = TLBaseBinding<'arrow', TLArrowBindingProps>
|
|
43
33
|
|
|
44
|
-
|
|
45
|
-
export const arrowBindingVersions = createBindingPropsMigrationIds('arrow', {
|
|
46
|
-
AddSnap: 1,
|
|
47
|
-
})
|
|
34
|
+
export const arrowBindingVersions = {} as const
|
|
48
35
|
|
|
49
36
|
/** @public */
|
|
50
37
|
export const arrowBindingMigrations = createBindingPropsMigrationSequence({
|
|
51
|
-
sequence: [
|
|
52
|
-
{ dependsOn: [arrowShapeVersions.ExtractBindings] },
|
|
53
|
-
{
|
|
54
|
-
id: arrowBindingVersions.AddSnap,
|
|
55
|
-
up: (props) => {
|
|
56
|
-
props.snap = 'none'
|
|
57
|
-
},
|
|
58
|
-
down: (props) => {
|
|
59
|
-
delete props.snap
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
],
|
|
38
|
+
sequence: [{ dependsOn: [arrowShapeVersions.ExtractBindings] }],
|
|
63
39
|
})
|
package/src/index.ts
CHANGED
|
@@ -13,10 +13,8 @@ export { type TLBookmarkAsset } from './assets/TLBookmarkAsset'
|
|
|
13
13
|
export { type TLImageAsset } from './assets/TLImageAsset'
|
|
14
14
|
export { type TLVideoAsset } from './assets/TLVideoAsset'
|
|
15
15
|
export {
|
|
16
|
-
ElbowArrowSnap,
|
|
17
16
|
arrowBindingMigrations,
|
|
18
17
|
arrowBindingProps,
|
|
19
|
-
arrowBindingVersions,
|
|
20
18
|
type TLArrowBinding,
|
|
21
19
|
type TLArrowBindingProps,
|
|
22
20
|
} from './bindings/TLArrowBinding'
|
|
@@ -140,13 +138,10 @@ export { type ShapeWithCrop, type TLShapeCrop } from './shapes/ShapeWithCrop'
|
|
|
140
138
|
export {
|
|
141
139
|
ArrowShapeArrowheadEndStyle,
|
|
142
140
|
ArrowShapeArrowheadStartStyle,
|
|
143
|
-
ArrowShapeKindStyle,
|
|
144
141
|
arrowShapeMigrations,
|
|
145
142
|
arrowShapeProps,
|
|
146
|
-
arrowShapeVersions,
|
|
147
143
|
type TLArrowShape,
|
|
148
144
|
type TLArrowShapeArrowheadStyle,
|
|
149
|
-
type TLArrowShapeKind,
|
|
150
145
|
type TLArrowShapeProps,
|
|
151
146
|
} from './shapes/TLArrowShape'
|
|
152
147
|
export {
|
package/src/migrations.test.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { getTestMigration, testSchema } from './__tests__/migrationTestUtils'
|
|
|
3
3
|
import { bookmarkAssetVersions } from './assets/TLBookmarkAsset'
|
|
4
4
|
import { imageAssetVersions } from './assets/TLImageAsset'
|
|
5
5
|
import { videoAssetVersions } from './assets/TLVideoAsset'
|
|
6
|
-
import { arrowBindingVersions } from './bindings/TLArrowBinding'
|
|
7
6
|
import { toRichText } from './misc/TLRichText'
|
|
8
7
|
import { assetVersions } from './records/TLAsset'
|
|
9
8
|
import { cameraVersions } from './records/TLCamera'
|
|
@@ -2158,36 +2157,6 @@ describe('Adding color to frame shapes', () => {
|
|
|
2158
2157
|
})
|
|
2159
2158
|
})
|
|
2160
2159
|
|
|
2161
|
-
describe('Add elbow kind to arrow shape', () => {
|
|
2162
|
-
const { up, down } = getTestMigration(arrowShapeVersions.AddElbow)
|
|
2163
|
-
|
|
2164
|
-
test('up works as expected', () => {
|
|
2165
|
-
expect(up({ props: {} })).toEqual({ props: { kind: 'arc', elbowMidPoint: 0.5 } })
|
|
2166
|
-
})
|
|
2167
|
-
|
|
2168
|
-
test('down works as expected', () => {
|
|
2169
|
-
expect(down({ props: { kind: 'arc', elbowMidPoint: 0.5, wow: true } })).toEqual({
|
|
2170
|
-
props: { wow: true },
|
|
2171
|
-
})
|
|
2172
|
-
expect(down({ props: { kind: 'elbow', elbowMidPoint: 0.5, wow: true } })).toEqual({
|
|
2173
|
-
props: { wow: true },
|
|
2174
|
-
})
|
|
2175
|
-
})
|
|
2176
|
-
})
|
|
2177
|
-
|
|
2178
|
-
describe('Add side to arrow binding', () => {
|
|
2179
|
-
const { up, down } = getTestMigration(arrowBindingVersions.AddSnap)
|
|
2180
|
-
|
|
2181
|
-
test('up works as expected', () => {
|
|
2182
|
-
expect(up({ props: {} })).toEqual({ props: { snap: 'none' } })
|
|
2183
|
-
})
|
|
2184
|
-
|
|
2185
|
-
test('down works as expected', () => {
|
|
2186
|
-
expect(down({ props: { snap: 'none' } })).toEqual({ props: {} })
|
|
2187
|
-
expect(down({ props: { snap: 'edge' } })).toEqual({ props: {} })
|
|
2188
|
-
})
|
|
2189
|
-
})
|
|
2190
|
-
|
|
2191
2160
|
/* --- PUT YOUR MIGRATIONS TESTS ABOVE HERE --- */
|
|
2192
2161
|
|
|
2193
2162
|
// check that all migrator fns were called at least once
|
package/src/misc/TLHandle.ts
CHANGED
|
@@ -21,8 +21,6 @@ export type TLHandleType = SetValue<typeof TL_HANDLE_TYPES>
|
|
|
21
21
|
export interface TLHandle {
|
|
22
22
|
/** A unique identifier for the handle. */
|
|
23
23
|
id: string
|
|
24
|
-
// TODO(mime): this needs to be required.
|
|
25
|
-
label?: string
|
|
26
24
|
type: TLHandleType
|
|
27
25
|
canSnap?: boolean
|
|
28
26
|
index: IndexKey
|
package/src/recordsWithProps.ts
CHANGED
|
@@ -62,7 +62,7 @@ export function processPropsMigrations<R extends UnknownRecord & { type: string;
|
|
|
62
62
|
result.push(
|
|
63
63
|
createMigrationSequence({
|
|
64
64
|
sequenceId,
|
|
65
|
-
retroactive:
|
|
65
|
+
retroactive: false,
|
|
66
66
|
sequence: [],
|
|
67
67
|
})
|
|
68
68
|
)
|
|
@@ -76,7 +76,7 @@ export function processPropsMigrations<R extends UnknownRecord & { type: string;
|
|
|
76
76
|
result.push(
|
|
77
77
|
createMigrationSequence({
|
|
78
78
|
sequenceId,
|
|
79
|
-
retroactive:
|
|
79
|
+
retroactive: false,
|
|
80
80
|
sequence: migrations.sequence.map((m) =>
|
|
81
81
|
'id' in m ? createPropsMigration(typeName, subType, m) : m
|
|
82
82
|
),
|
|
@@ -87,7 +87,7 @@ export function processPropsMigrations<R extends UnknownRecord & { type: string;
|
|
|
87
87
|
result.push(
|
|
88
88
|
createMigrationSequence({
|
|
89
89
|
sequenceId,
|
|
90
|
-
retroactive:
|
|
90
|
+
retroactive: false,
|
|
91
91
|
sequence: Object.keys(migrations.migrators)
|
|
92
92
|
.map((k) => Number(k))
|
|
93
93
|
.sort((a: number, b: number) => a - b)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createMigrationSequence } from '@tldraw/store'
|
|
2
2
|
import { T } from '@tldraw/validate'
|
|
3
|
+
import { TLArrowBinding } from '../bindings/TLArrowBinding'
|
|
3
4
|
import { VecModel, vecModelValidator } from '../misc/geometry-types'
|
|
4
5
|
import { createBindingId } from '../records/TLBinding'
|
|
5
6
|
import { TLShapeId, createShapePropsMigrationIds } from '../records/TLShape'
|
|
@@ -16,16 +17,6 @@ import { DefaultFontStyle, TLDefaultFontStyle } from '../styles/TLFontStyle'
|
|
|
16
17
|
import { DefaultSizeStyle, TLDefaultSizeStyle } from '../styles/TLSizeStyle'
|
|
17
18
|
import { TLBaseShape } from './TLBaseShape'
|
|
18
19
|
|
|
19
|
-
const arrowKinds = ['arc', 'elbow'] as const
|
|
20
|
-
/** @public */
|
|
21
|
-
export const ArrowShapeKindStyle = StyleProp.defineEnum('tldraw:arrowKind', {
|
|
22
|
-
defaultValue: 'arc',
|
|
23
|
-
values: arrowKinds,
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
/** @public */
|
|
27
|
-
export type TLArrowShapeKind = T.TypeOf<typeof ArrowShapeKindStyle>
|
|
28
|
-
|
|
29
20
|
const arrowheadTypes = [
|
|
30
21
|
'arrow',
|
|
31
22
|
'triangle',
|
|
@@ -55,7 +46,6 @@ export type TLArrowShapeArrowheadStyle = T.TypeOf<typeof ArrowShapeArrowheadStar
|
|
|
55
46
|
|
|
56
47
|
/** @public */
|
|
57
48
|
export interface TLArrowShapeProps {
|
|
58
|
-
kind: TLArrowShapeKind
|
|
59
49
|
labelColor: TLDefaultColorStyle
|
|
60
50
|
color: TLDefaultColorStyle
|
|
61
51
|
fill: TLDefaultFillStyle
|
|
@@ -70,7 +60,6 @@ export interface TLArrowShapeProps {
|
|
|
70
60
|
text: string
|
|
71
61
|
labelPosition: number
|
|
72
62
|
scale: number
|
|
73
|
-
elbowMidPoint: number
|
|
74
63
|
}
|
|
75
64
|
|
|
76
65
|
/** @public */
|
|
@@ -78,7 +67,6 @@ export type TLArrowShape = TLBaseShape<'arrow', TLArrowShapeProps>
|
|
|
78
67
|
|
|
79
68
|
/** @public */
|
|
80
69
|
export const arrowShapeProps: RecordProps<TLArrowShape> = {
|
|
81
|
-
kind: ArrowShapeKindStyle,
|
|
82
70
|
labelColor: DefaultLabelColorStyle,
|
|
83
71
|
color: DefaultColorStyle,
|
|
84
72
|
fill: DefaultFillStyle,
|
|
@@ -93,17 +81,14 @@ export const arrowShapeProps: RecordProps<TLArrowShape> = {
|
|
|
93
81
|
text: T.string,
|
|
94
82
|
labelPosition: T.number,
|
|
95
83
|
scale: T.nonZeroNumber,
|
|
96
|
-
elbowMidPoint: T.number,
|
|
97
84
|
}
|
|
98
85
|
|
|
99
|
-
/** @public */
|
|
100
86
|
export const arrowShapeVersions = createShapePropsMigrationIds('arrow', {
|
|
101
87
|
AddLabelColor: 1,
|
|
102
88
|
AddIsPrecise: 2,
|
|
103
89
|
AddLabelPosition: 3,
|
|
104
90
|
ExtractBindings: 4,
|
|
105
91
|
AddScale: 5,
|
|
106
|
-
AddElbow: 6,
|
|
107
92
|
})
|
|
108
93
|
|
|
109
94
|
function propsMigration(migration: TLPropsMigration) {
|
|
@@ -189,7 +174,7 @@ export const arrowShapeMigrations = createMigrationSequence({
|
|
|
189
174
|
const { start, end } = arrow.props
|
|
190
175
|
if (start.type === 'binding') {
|
|
191
176
|
const id = createBindingId()
|
|
192
|
-
const binding = {
|
|
177
|
+
const binding: TLArrowBinding = {
|
|
193
178
|
typeName: 'binding',
|
|
194
179
|
id,
|
|
195
180
|
type: 'arrow',
|
|
@@ -211,7 +196,7 @@ export const arrowShapeMigrations = createMigrationSequence({
|
|
|
211
196
|
}
|
|
212
197
|
if (end.type === 'binding') {
|
|
213
198
|
const id = createBindingId()
|
|
214
|
-
const binding = {
|
|
199
|
+
const binding: TLArrowBinding = {
|
|
215
200
|
typeName: 'binding',
|
|
216
201
|
id,
|
|
217
202
|
type: 'arrow',
|
|
@@ -243,16 +228,5 @@ export const arrowShapeMigrations = createMigrationSequence({
|
|
|
243
228
|
delete props.scale
|
|
244
229
|
},
|
|
245
230
|
}),
|
|
246
|
-
propsMigration({
|
|
247
|
-
id: arrowShapeVersions.AddElbow,
|
|
248
|
-
up: (props) => {
|
|
249
|
-
props.kind = 'arc'
|
|
250
|
-
props.elbowMidPoint = 0.5
|
|
251
|
-
},
|
|
252
|
-
down: (props) => {
|
|
253
|
-
delete props.kind
|
|
254
|
-
delete props.elbowMidPoint
|
|
255
|
-
},
|
|
256
|
-
}),
|
|
257
231
|
],
|
|
258
232
|
})
|