@tldraw/tlschema 3.16.0-canary.ffdf566dd0a8 → 3.16.0-internal.a478398270c6
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/README.md +1 -1
- package/dist-cjs/index.d.ts +1 -2
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/shapes/TLArrowShape.js +2 -15
- package/dist-cjs/shapes/TLArrowShape.js.map +2 -2
- package/dist-esm/index.d.mts +1 -2
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/shapes/TLArrowShape.mjs +2 -15
- package/dist-esm/shapes/TLArrowShape.mjs.map +2 -2
- package/package.json +6 -7
- package/src/migrations.test.ts +0 -1
- package/src/shapes/TLArrowShape.ts +2 -15
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ If you are making a change that affects the structure of a record, shape, or ass
|
|
|
26
26
|
|
|
27
27
|
If you are making a change that affects the structure of the store (e.g. renaming or deleting a type, consolidating two shape types into one, etc), add your changes in the migrations in `schema.ts`.
|
|
28
28
|
|
|
29
|
-
After making your changes, add a new version number, using a
|
|
29
|
+
After making your changes, add a new version number, using a meaninful name. For example, if you add a new property
|
|
30
30
|
to the `TLShape` type called `ownerId` that points to a user, you might do this:
|
|
31
31
|
|
|
32
32
|
In `TLShape.ts`
|
package/dist-cjs/index.d.ts
CHANGED
|
@@ -50,7 +50,6 @@ export declare const arrowShapeVersions: {
|
|
|
50
50
|
readonly AddIsPrecise: "com.tldraw.shape.arrow/2";
|
|
51
51
|
readonly AddLabelColor: "com.tldraw.shape.arrow/1";
|
|
52
52
|
readonly AddLabelPosition: "com.tldraw.shape.arrow/3";
|
|
53
|
-
readonly AddRichText: "com.tldraw.shape.arrow/7";
|
|
54
53
|
readonly AddScale: "com.tldraw.shape.arrow/5";
|
|
55
54
|
readonly ExtractBindings: "com.tldraw.shape.arrow/4";
|
|
56
55
|
};
|
|
@@ -808,7 +807,7 @@ export declare interface TLArrowShapeProps {
|
|
|
808
807
|
start: VecModel;
|
|
809
808
|
end: VecModel;
|
|
810
809
|
bend: number;
|
|
811
|
-
|
|
810
|
+
text: string;
|
|
812
811
|
labelPosition: number;
|
|
813
812
|
scale: number;
|
|
814
813
|
elbowMidPoint: number;
|
package/dist-cjs/index.js
CHANGED
|
@@ -176,7 +176,7 @@ var import_TLVerticalAlignStyle = require("./styles/TLVerticalAlignStyle");
|
|
|
176
176
|
var import_translations = require("./translations/translations");
|
|
177
177
|
(0, import_utils.registerTldrawLibraryVersion)(
|
|
178
178
|
"@tldraw/tlschema",
|
|
179
|
-
"3.16.0-
|
|
179
|
+
"3.16.0-internal.a478398270c6",
|
|
180
180
|
"cjs"
|
|
181
181
|
);
|
|
182
182
|
//# sourceMappingURL=index.js.map
|
|
@@ -28,7 +28,6 @@ __export(TLArrowShape_exports, {
|
|
|
28
28
|
module.exports = __toCommonJS(TLArrowShape_exports);
|
|
29
29
|
var import_store = require("@tldraw/store");
|
|
30
30
|
var import_validate = require("@tldraw/validate");
|
|
31
|
-
var import_TLRichText = require("../misc/TLRichText");
|
|
32
31
|
var import_geometry_types = require("../misc/geometry-types");
|
|
33
32
|
var import_TLBinding = require("../records/TLBinding");
|
|
34
33
|
var import_TLShape = require("../records/TLShape");
|
|
@@ -76,7 +75,7 @@ const arrowShapeProps = {
|
|
|
76
75
|
start: import_geometry_types.vecModelValidator,
|
|
77
76
|
end: import_geometry_types.vecModelValidator,
|
|
78
77
|
bend: import_validate.T.number,
|
|
79
|
-
|
|
78
|
+
text: import_validate.T.string,
|
|
80
79
|
labelPosition: import_validate.T.number,
|
|
81
80
|
scale: import_validate.T.nonZeroNumber,
|
|
82
81
|
elbowMidPoint: import_validate.T.number
|
|
@@ -87,8 +86,7 @@ const arrowShapeVersions = (0, import_TLShape.createShapePropsMigrationIds)("arr
|
|
|
87
86
|
AddLabelPosition: 3,
|
|
88
87
|
ExtractBindings: 4,
|
|
89
88
|
AddScale: 5,
|
|
90
|
-
AddElbow: 6
|
|
91
|
-
AddRichText: 7
|
|
89
|
+
AddElbow: 6
|
|
92
90
|
});
|
|
93
91
|
function propsMigration(migration) {
|
|
94
92
|
return (0, import_recordsWithProps.createPropsMigration)("shape", "arrow", migration);
|
|
@@ -211,17 +209,6 @@ const arrowShapeMigrations = (0, import_store.createMigrationSequence)({
|
|
|
211
209
|
delete props.kind;
|
|
212
210
|
delete props.elbowMidPoint;
|
|
213
211
|
}
|
|
214
|
-
}),
|
|
215
|
-
propsMigration({
|
|
216
|
-
id: arrowShapeVersions.AddRichText,
|
|
217
|
-
up: (props) => {
|
|
218
|
-
props.richText = (0, import_TLRichText.toRichText)(props.text);
|
|
219
|
-
delete props.text;
|
|
220
|
-
}
|
|
221
|
-
// N.B. Explicitly no down state so that we force clients to update.
|
|
222
|
-
// down: (props) => {
|
|
223
|
-
// delete props.richText
|
|
224
|
-
// },
|
|
225
212
|
})
|
|
226
213
|
]
|
|
227
214
|
});
|
|
@@ -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 {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAwC;AACxC,sBAAkB;AAClB,
|
|
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 arrowKinds = ['arc', 'elbow'] as const\n/** @public */\nexport const ArrowShapeKindStyle = StyleProp.defineEnum('tldraw:arrowKind', {\n\tdefaultValue: 'arc',\n\tvalues: arrowKinds,\n})\n\n/** @public */\nexport type TLArrowShapeKind = T.TypeOf<typeof ArrowShapeKindStyle>\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\tkind: TLArrowShapeKind\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\telbowMidPoint: number\n}\n\n/** @public */\nexport type TLArrowShape = TLBaseShape<'arrow', TLArrowShapeProps>\n\n/** @public */\nexport const arrowShapeProps: RecordProps<TLArrowShape> = {\n\tkind: ArrowShapeKindStyle,\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\telbowMidPoint: T.number,\n}\n\n/** @public */\nexport const arrowShapeVersions = createShapePropsMigrationIds('arrow', {\n\tAddLabelColor: 1,\n\tAddIsPrecise: 2,\n\tAddLabelPosition: 3,\n\tExtractBindings: 4,\n\tAddScale: 5,\n\tAddElbow: 6,\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 = {\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 = {\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\tpropsMigration({\n\t\t\tid: arrowShapeVersions.AddElbow,\n\t\t\tup: (props) => {\n\t\t\t\tprops.kind = 'arc'\n\t\t\t\tprops.elbowMidPoint = 0.5\n\t\t\t},\n\t\t\tdown: (props) => {\n\t\t\t\tdelete props.kind\n\t\t\t\tdelete props.elbowMidPoint\n\t\t\t},\n\t\t}),\n\t],\n})\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAwC;AACxC,sBAAkB;AAClB,4BAA4C;AAC5C,uBAAgC;AAChC,qBAAwD;AACxD,8BAAoE;AACpE,uBAA0B;AAC1B,0BAIO;AACP,yBAAqD;AACrD,yBAAqD;AACrD,yBAAqD;AACrD,yBAAqD;AAGrD,MAAM,aAAa,CAAC,OAAO,OAAO;AAE3B,MAAM,sBAAsB,2BAAU,WAAW,oBAAoB;AAAA,EAC3E,cAAc;AAAA,EACd,QAAQ;AACT,CAAC;AAKD,MAAM,iBAAiB;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAGO,MAAM,gCAAgC,2BAAU,WAAW,yBAAyB;AAAA,EAC1F,cAAc;AAAA,EACd,QAAQ;AACT,CAAC;AAGM,MAAM,8BAA8B,2BAAU,WAAW,uBAAuB;AAAA,EACtF,cAAc;AAAA,EACd,QAAQ;AACT,CAAC;AA6BM,MAAM,kBAA6C;AAAA,EACzD,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,gBAAgB;AAAA,EAChB,cAAc;AAAA,EACd,MAAM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AA,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,IACD,eAAe;AAAA,MACd,IAAI,mBAAmB;AAAA,MACvB,IAAI,CAAC,UAAU;AACd,cAAM,OAAO;AACb,cAAM,gBAAgB;AAAA,MACvB;AAAA,MACA,MAAM,CAAC,UAAU;AAChB,eAAO,MAAM;AACb,eAAO,MAAM;AAAA,MACd;AAAA,IACD,CAAC;AAAA,EACF;AACD,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist-esm/index.d.mts
CHANGED
|
@@ -50,7 +50,6 @@ export declare const arrowShapeVersions: {
|
|
|
50
50
|
readonly AddIsPrecise: "com.tldraw.shape.arrow/2";
|
|
51
51
|
readonly AddLabelColor: "com.tldraw.shape.arrow/1";
|
|
52
52
|
readonly AddLabelPosition: "com.tldraw.shape.arrow/3";
|
|
53
|
-
readonly AddRichText: "com.tldraw.shape.arrow/7";
|
|
54
53
|
readonly AddScale: "com.tldraw.shape.arrow/5";
|
|
55
54
|
readonly ExtractBindings: "com.tldraw.shape.arrow/4";
|
|
56
55
|
};
|
|
@@ -808,7 +807,7 @@ export declare interface TLArrowShapeProps {
|
|
|
808
807
|
start: VecModel;
|
|
809
808
|
end: VecModel;
|
|
810
809
|
bend: number;
|
|
811
|
-
|
|
810
|
+
text: string;
|
|
812
811
|
labelPosition: number;
|
|
813
812
|
scale: number;
|
|
814
813
|
elbowMidPoint: number;
|
package/dist-esm/index.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createMigrationSequence } from "@tldraw/store";
|
|
2
2
|
import { T } from "@tldraw/validate";
|
|
3
|
-
import { richTextValidator, toRichText } from "../misc/TLRichText.mjs";
|
|
4
3
|
import { vecModelValidator } from "../misc/geometry-types.mjs";
|
|
5
4
|
import { createBindingId } from "../records/TLBinding.mjs";
|
|
6
5
|
import { createShapePropsMigrationIds } from "../records/TLShape.mjs";
|
|
@@ -51,7 +50,7 @@ const arrowShapeProps = {
|
|
|
51
50
|
start: vecModelValidator,
|
|
52
51
|
end: vecModelValidator,
|
|
53
52
|
bend: T.number,
|
|
54
|
-
|
|
53
|
+
text: T.string,
|
|
55
54
|
labelPosition: T.number,
|
|
56
55
|
scale: T.nonZeroNumber,
|
|
57
56
|
elbowMidPoint: T.number
|
|
@@ -62,8 +61,7 @@ const arrowShapeVersions = createShapePropsMigrationIds("arrow", {
|
|
|
62
61
|
AddLabelPosition: 3,
|
|
63
62
|
ExtractBindings: 4,
|
|
64
63
|
AddScale: 5,
|
|
65
|
-
AddElbow: 6
|
|
66
|
-
AddRichText: 7
|
|
64
|
+
AddElbow: 6
|
|
67
65
|
});
|
|
68
66
|
function propsMigration(migration) {
|
|
69
67
|
return createPropsMigration("shape", "arrow", migration);
|
|
@@ -186,17 +184,6 @@ const arrowShapeMigrations = createMigrationSequence({
|
|
|
186
184
|
delete props.kind;
|
|
187
185
|
delete props.elbowMidPoint;
|
|
188
186
|
}
|
|
189
|
-
}),
|
|
190
|
-
propsMigration({
|
|
191
|
-
id: arrowShapeVersions.AddRichText,
|
|
192
|
-
up: (props) => {
|
|
193
|
-
props.richText = toRichText(props.text);
|
|
194
|
-
delete props.text;
|
|
195
|
-
}
|
|
196
|
-
// N.B. Explicitly no down state so that we force clients to update.
|
|
197
|
-
// down: (props) => {
|
|
198
|
-
// delete props.richText
|
|
199
|
-
// },
|
|
200
187
|
})
|
|
201
188
|
]
|
|
202
189
|
});
|
|
@@ -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 {
|
|
5
|
-
"mappings": "AAAA,SAAS,+BAA+B;AACxC,SAAS,SAAS;AAClB,
|
|
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 arrowKinds = ['arc', 'elbow'] as const\n/** @public */\nexport const ArrowShapeKindStyle = StyleProp.defineEnum('tldraw:arrowKind', {\n\tdefaultValue: 'arc',\n\tvalues: arrowKinds,\n})\n\n/** @public */\nexport type TLArrowShapeKind = T.TypeOf<typeof ArrowShapeKindStyle>\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\tkind: TLArrowShapeKind\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\telbowMidPoint: number\n}\n\n/** @public */\nexport type TLArrowShape = TLBaseShape<'arrow', TLArrowShapeProps>\n\n/** @public */\nexport const arrowShapeProps: RecordProps<TLArrowShape> = {\n\tkind: ArrowShapeKindStyle,\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\telbowMidPoint: T.number,\n}\n\n/** @public */\nexport const arrowShapeVersions = createShapePropsMigrationIds('arrow', {\n\tAddLabelColor: 1,\n\tAddIsPrecise: 2,\n\tAddLabelPosition: 3,\n\tExtractBindings: 4,\n\tAddScale: 5,\n\tAddElbow: 6,\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 = {\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 = {\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\tpropsMigration({\n\t\t\tid: arrowShapeVersions.AddElbow,\n\t\t\tup: (props) => {\n\t\t\t\tprops.kind = 'arc'\n\t\t\t\tprops.elbowMidPoint = 0.5\n\t\t\t},\n\t\t\tdown: (props) => {\n\t\t\t\tdelete props.kind\n\t\t\t\tdelete props.elbowMidPoint\n\t\t\t},\n\t\t}),\n\t],\n})\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,+BAA+B;AACxC,SAAS,SAAS;AAClB,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,SAA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,CAAC,UAAU;AAChB,eAAO,MAAM;AACb,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
|
-
"description": "
|
|
4
|
-
"version": "3.16.0-
|
|
3
|
+
"description": "A tiny little drawing app (schema).",
|
|
4
|
+
"version": "3.16.0-internal.a478398270c6",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "tldraw Inc.",
|
|
7
7
|
"email": "hello@tldraw.com"
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
},
|
|
18
18
|
"keywords": [
|
|
19
19
|
"tldraw",
|
|
20
|
-
"sdk",
|
|
21
20
|
"drawing",
|
|
22
21
|
"app",
|
|
23
22
|
"development",
|
|
@@ -55,10 +54,10 @@
|
|
|
55
54
|
}
|
|
56
55
|
},
|
|
57
56
|
"dependencies": {
|
|
58
|
-
"@tldraw/state": "3.16.0-
|
|
59
|
-
"@tldraw/store": "3.16.0-
|
|
60
|
-
"@tldraw/utils": "3.16.0-
|
|
61
|
-
"@tldraw/validate": "3.16.0-
|
|
57
|
+
"@tldraw/state": "3.16.0-internal.a478398270c6",
|
|
58
|
+
"@tldraw/store": "3.16.0-internal.a478398270c6",
|
|
59
|
+
"@tldraw/utils": "3.16.0-internal.a478398270c6",
|
|
60
|
+
"@tldraw/validate": "3.16.0-internal.a478398270c6"
|
|
62
61
|
},
|
|
63
62
|
"peerDependencies": {
|
|
64
63
|
"react": "^18.2.0 || ^19.0.0",
|
package/src/migrations.test.ts
CHANGED
|
@@ -1385,7 +1385,6 @@ describe('Add rich text', () => {
|
|
|
1385
1385
|
['text shape', getTestMigration(textShapeVersions.AddRichText)],
|
|
1386
1386
|
['geo shape', getTestMigration(geoShapeVersions.AddRichText)],
|
|
1387
1387
|
['note shape', getTestMigration(noteShapeVersions.AddRichText)],
|
|
1388
|
-
['arrow shape', getTestMigration(arrowShapeVersions.AddRichText)],
|
|
1389
1388
|
] as const
|
|
1390
1389
|
|
|
1391
1390
|
for (const [shapeName, { up }] of migrations) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createMigrationSequence } from '@tldraw/store'
|
|
2
2
|
import { T } from '@tldraw/validate'
|
|
3
|
-
import { TLRichText, richTextValidator, toRichText } from '../misc/TLRichText'
|
|
4
3
|
import { VecModel, vecModelValidator } from '../misc/geometry-types'
|
|
5
4
|
import { createBindingId } from '../records/TLBinding'
|
|
6
5
|
import { TLShapeId, createShapePropsMigrationIds } from '../records/TLShape'
|
|
@@ -68,7 +67,7 @@ export interface TLArrowShapeProps {
|
|
|
68
67
|
start: VecModel
|
|
69
68
|
end: VecModel
|
|
70
69
|
bend: number
|
|
71
|
-
|
|
70
|
+
text: string
|
|
72
71
|
labelPosition: number
|
|
73
72
|
scale: number
|
|
74
73
|
elbowMidPoint: number
|
|
@@ -91,7 +90,7 @@ export const arrowShapeProps: RecordProps<TLArrowShape> = {
|
|
|
91
90
|
start: vecModelValidator,
|
|
92
91
|
end: vecModelValidator,
|
|
93
92
|
bend: T.number,
|
|
94
|
-
|
|
93
|
+
text: T.string,
|
|
95
94
|
labelPosition: T.number,
|
|
96
95
|
scale: T.nonZeroNumber,
|
|
97
96
|
elbowMidPoint: T.number,
|
|
@@ -105,7 +104,6 @@ export const arrowShapeVersions = createShapePropsMigrationIds('arrow', {
|
|
|
105
104
|
ExtractBindings: 4,
|
|
106
105
|
AddScale: 5,
|
|
107
106
|
AddElbow: 6,
|
|
108
|
-
AddRichText: 7,
|
|
109
107
|
})
|
|
110
108
|
|
|
111
109
|
function propsMigration(migration: TLPropsMigration) {
|
|
@@ -256,16 +254,5 @@ export const arrowShapeMigrations = createMigrationSequence({
|
|
|
256
254
|
delete props.elbowMidPoint
|
|
257
255
|
},
|
|
258
256
|
}),
|
|
259
|
-
propsMigration({
|
|
260
|
-
id: arrowShapeVersions.AddRichText,
|
|
261
|
-
up: (props) => {
|
|
262
|
-
props.richText = toRichText(props.text)
|
|
263
|
-
delete props.text
|
|
264
|
-
},
|
|
265
|
-
// N.B. Explicitly no down state so that we force clients to update.
|
|
266
|
-
// down: (props) => {
|
|
267
|
-
// delete props.richText
|
|
268
|
-
// },
|
|
269
|
-
}),
|
|
270
257
|
],
|
|
271
258
|
})
|