@tldraw/tlschema 3.14.0-canary.fd17def565a1 → 3.14.0-canary.fdbfe5bf2604
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-cjs/index.d.ts +7 -6
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/shapes/ShapeWithCrop.js.map +1 -1
- package/dist-cjs/shapes/TLGeoShape.js +8 -7
- package/dist-cjs/shapes/TLGeoShape.js.map +2 -2
- package/dist-cjs/shapes/TLImageShape.js +2 -1
- package/dist-cjs/shapes/TLImageShape.js.map +2 -2
- package/dist-esm/index.d.mts +7 -6
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/shapes/TLGeoShape.mjs +8 -7
- package/dist-esm/shapes/TLGeoShape.mjs.map +2 -2
- package/dist-esm/shapes/TLImageShape.mjs +2 -1
- package/dist-esm/shapes/TLImageShape.mjs.map +2 -2
- package/package.json +5 -5
- package/src/shapes/ShapeWithCrop.ts +1 -0
- package/src/shapes/TLGeoShape.ts +16 -12
- package/src/shapes/TLImageShape.ts +1 -0
package/dist-cjs/index.d.ts
CHANGED
|
@@ -1170,20 +1170,20 @@ export declare type TLGeoShapeGeoStyle = T.TypeOf<typeof GeoShapeGeoStyle>;
|
|
|
1170
1170
|
/** @public */
|
|
1171
1171
|
export declare interface TLGeoShapeProps {
|
|
1172
1172
|
geo: TLGeoShapeGeoStyle;
|
|
1173
|
+
dash: TLDefaultDashStyle;
|
|
1174
|
+
url: string;
|
|
1175
|
+
w: number;
|
|
1176
|
+
h: number;
|
|
1177
|
+
growY: number;
|
|
1178
|
+
scale: number;
|
|
1173
1179
|
labelColor: TLDefaultColorStyle;
|
|
1174
1180
|
color: TLDefaultColorStyle;
|
|
1175
1181
|
fill: TLDefaultFillStyle;
|
|
1176
|
-
dash: TLDefaultDashStyle;
|
|
1177
1182
|
size: TLDefaultSizeStyle;
|
|
1178
1183
|
font: TLDefaultFontStyle;
|
|
1179
1184
|
align: TLDefaultHorizontalAlignStyle;
|
|
1180
1185
|
verticalAlign: TLDefaultVerticalAlignStyle;
|
|
1181
|
-
url: string;
|
|
1182
|
-
w: number;
|
|
1183
|
-
h: number;
|
|
1184
|
-
growY: number;
|
|
1185
1186
|
richText: TLRichText;
|
|
1186
|
-
scale: number;
|
|
1187
1187
|
}
|
|
1188
1188
|
|
|
1189
1189
|
/** @public */
|
|
@@ -1538,6 +1538,7 @@ export declare type TLShape = TLDefaultShape | TLUnknownShape;
|
|
|
1538
1538
|
export declare interface TLShapeCrop {
|
|
1539
1539
|
topLeft: VecModel;
|
|
1540
1540
|
bottomRight: VecModel;
|
|
1541
|
+
isCircle?: boolean;
|
|
1541
1542
|
}
|
|
1542
1543
|
|
|
1543
1544
|
/** @public */
|
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.14.0-canary.
|
|
179
|
+
"3.14.0-canary.fdbfe5bf2604",
|
|
180
180
|
"cjs"
|
|
181
181
|
);
|
|
182
182
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/shapes/ShapeWithCrop.ts"],
|
|
4
|
-
"sourcesContent": ["import { VecModel } from '../misc/geometry-types'\nimport { TLBaseShape } from './TLBaseShape'\n\n/** @public */\nexport interface TLShapeCrop {\n\ttopLeft: VecModel\n\tbottomRight: VecModel\n}\n\n/** @public */\nexport type ShapeWithCrop = TLBaseShape<string, { w: number; h: number; crop: TLShapeCrop | null }>\n"],
|
|
4
|
+
"sourcesContent": ["import { VecModel } from '../misc/geometry-types'\nimport { TLBaseShape } from './TLBaseShape'\n\n/** @public */\nexport interface TLShapeCrop {\n\ttopLeft: VecModel\n\tbottomRight: VecModel\n\tisCircle?: boolean\n}\n\n/** @public */\nexport type ShapeWithCrop = TLBaseShape<string, { w: number; h: number; crop: TLShapeCrop | null }>\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -62,20 +62,21 @@ const GeoShapeGeoStyle = import_StyleProp.StyleProp.defineEnum("tldraw:geo", {
|
|
|
62
62
|
});
|
|
63
63
|
const geoShapeProps = {
|
|
64
64
|
geo: GeoShapeGeoStyle,
|
|
65
|
+
dash: import_TLDashStyle.DefaultDashStyle,
|
|
66
|
+
url: import_validate.T.linkUrl,
|
|
67
|
+
w: import_validate.T.nonZeroNumber,
|
|
68
|
+
h: import_validate.T.nonZeroNumber,
|
|
69
|
+
growY: import_validate.T.positiveNumber,
|
|
70
|
+
scale: import_validate.T.nonZeroNumber,
|
|
71
|
+
// Text properties
|
|
65
72
|
labelColor: import_TLColorStyle.DefaultLabelColorStyle,
|
|
66
73
|
color: import_TLColorStyle.DefaultColorStyle,
|
|
67
74
|
fill: import_TLFillStyle.DefaultFillStyle,
|
|
68
|
-
dash: import_TLDashStyle.DefaultDashStyle,
|
|
69
75
|
size: import_TLSizeStyle.DefaultSizeStyle,
|
|
70
76
|
font: import_TLFontStyle.DefaultFontStyle,
|
|
71
77
|
align: import_TLHorizontalAlignStyle.DefaultHorizontalAlignStyle,
|
|
72
78
|
verticalAlign: import_TLVerticalAlignStyle.DefaultVerticalAlignStyle,
|
|
73
|
-
|
|
74
|
-
w: import_validate.T.nonZeroNumber,
|
|
75
|
-
h: import_validate.T.nonZeroNumber,
|
|
76
|
-
growY: import_validate.T.positiveNumber,
|
|
77
|
-
richText: import_TLRichText.richTextValidator,
|
|
78
|
-
scale: import_validate.T.nonZeroNumber
|
|
79
|
+
richText: import_TLRichText.richTextValidator
|
|
79
80
|
};
|
|
80
81
|
const geoShapeVersions = (0, import_TLShape.createShapePropsMigrationIds)("geo", {
|
|
81
82
|
AddUrlProp: 1,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/shapes/TLGeoShape.ts"],
|
|
4
|
-
"sourcesContent": ["import { T } from '@tldraw/validate'\nimport { TLRichText, richTextValidator, toRichText } from '../misc/TLRichText'\nimport { createShapePropsMigrationIds, createShapePropsMigrationSequence } from '../records/TLShape'\nimport { RecordProps } 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 {\n\tDefaultHorizontalAlignStyle,\n\tTLDefaultHorizontalAlignStyle,\n} from '../styles/TLHorizontalAlignStyle'\nimport { DefaultSizeStyle, TLDefaultSizeStyle } from '../styles/TLSizeStyle'\nimport {\n\tDefaultVerticalAlignStyle,\n\tTLDefaultVerticalAlignStyle,\n} from '../styles/TLVerticalAlignStyle'\nimport { TLBaseShape } from './TLBaseShape'\n\n/** @public */\nexport const GeoShapeGeoStyle = StyleProp.defineEnum('tldraw:geo', {\n\tdefaultValue: 'rectangle',\n\tvalues: [\n\t\t'cloud',\n\t\t'rectangle',\n\t\t'ellipse',\n\t\t'triangle',\n\t\t'diamond',\n\t\t'pentagon',\n\t\t'hexagon',\n\t\t'octagon',\n\t\t'star',\n\t\t'rhombus',\n\t\t'rhombus-2',\n\t\t'oval',\n\t\t'trapezoid',\n\t\t'arrow-right',\n\t\t'arrow-left',\n\t\t'arrow-up',\n\t\t'arrow-down',\n\t\t'x-box',\n\t\t'check-box',\n\t\t'heart',\n\t],\n})\n\n/** @public */\nexport type TLGeoShapeGeoStyle = T.TypeOf<typeof GeoShapeGeoStyle>\n\n/** @public */\nexport interface TLGeoShapeProps {\n\tgeo: TLGeoShapeGeoStyle\n\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAkB;AAClB,wBAA0D;AAC1D,qBAAgF;AAEhF,uBAA0B;AAC1B,0BAIO;AACP,yBAAqD;AACrD,yBAAqD;AACrD,yBAAqD;AACrD,oCAGO;AACP,yBAAqD;AACrD,kCAGO;AAIA,MAAM,mBAAmB,2BAAU,WAAW,cAAc;AAAA,EAClE,cAAc;AAAA,EACd,QAAQ;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD,CAAC;
|
|
4
|
+
"sourcesContent": ["import { T } from '@tldraw/validate'\nimport { TLRichText, richTextValidator, toRichText } from '../misc/TLRichText'\nimport { createShapePropsMigrationIds, createShapePropsMigrationSequence } from '../records/TLShape'\nimport { RecordProps } 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 {\n\tDefaultHorizontalAlignStyle,\n\tTLDefaultHorizontalAlignStyle,\n} from '../styles/TLHorizontalAlignStyle'\nimport { DefaultSizeStyle, TLDefaultSizeStyle } from '../styles/TLSizeStyle'\nimport {\n\tDefaultVerticalAlignStyle,\n\tTLDefaultVerticalAlignStyle,\n} from '../styles/TLVerticalAlignStyle'\nimport { TLBaseShape } from './TLBaseShape'\n\n/** @public */\nexport const GeoShapeGeoStyle = StyleProp.defineEnum('tldraw:geo', {\n\tdefaultValue: 'rectangle',\n\tvalues: [\n\t\t'cloud',\n\t\t'rectangle',\n\t\t'ellipse',\n\t\t'triangle',\n\t\t'diamond',\n\t\t'pentagon',\n\t\t'hexagon',\n\t\t'octagon',\n\t\t'star',\n\t\t'rhombus',\n\t\t'rhombus-2',\n\t\t'oval',\n\t\t'trapezoid',\n\t\t'arrow-right',\n\t\t'arrow-left',\n\t\t'arrow-up',\n\t\t'arrow-down',\n\t\t'x-box',\n\t\t'check-box',\n\t\t'heart',\n\t],\n})\n\n/** @public */\nexport type TLGeoShapeGeoStyle = T.TypeOf<typeof GeoShapeGeoStyle>\n\n/** @public */\nexport interface TLGeoShapeProps {\n\tgeo: TLGeoShapeGeoStyle\n\tdash: TLDefaultDashStyle\n\turl: string\n\tw: number\n\th: number\n\tgrowY: number\n\tscale: number\n\n\t// Text properties\n\tlabelColor: TLDefaultColorStyle\n\tcolor: TLDefaultColorStyle\n\tfill: TLDefaultFillStyle\n\tsize: TLDefaultSizeStyle\n\tfont: TLDefaultFontStyle\n\talign: TLDefaultHorizontalAlignStyle\n\tverticalAlign: TLDefaultVerticalAlignStyle\n\trichText: TLRichText\n}\n\n/** @public */\nexport type TLGeoShape = TLBaseShape<'geo', TLGeoShapeProps>\n\n/** @public */\nexport const geoShapeProps: RecordProps<TLGeoShape> = {\n\tgeo: GeoShapeGeoStyle,\n\tdash: DefaultDashStyle,\n\turl: T.linkUrl,\n\tw: T.nonZeroNumber,\n\th: T.nonZeroNumber,\n\tgrowY: T.positiveNumber,\n\tscale: T.nonZeroNumber,\n\n\t// Text properties\n\tlabelColor: DefaultLabelColorStyle,\n\tcolor: DefaultColorStyle,\n\tfill: DefaultFillStyle,\n\tsize: DefaultSizeStyle,\n\tfont: DefaultFontStyle,\n\talign: DefaultHorizontalAlignStyle,\n\tverticalAlign: DefaultVerticalAlignStyle,\n\trichText: richTextValidator,\n}\n\nconst geoShapeVersions = createShapePropsMigrationIds('geo', {\n\tAddUrlProp: 1,\n\tAddLabelColor: 2,\n\tRemoveJustify: 3,\n\tAddCheckBox: 4,\n\tAddVerticalAlign: 5,\n\tMigrateLegacyAlign: 6,\n\tAddCloud: 7,\n\tMakeUrlsValid: 8,\n\tAddScale: 9,\n\tAddRichText: 10,\n})\n\nexport { geoShapeVersions as geoShapeVersions }\n\n/** @public */\nexport const geoShapeMigrations = createShapePropsMigrationSequence({\n\tsequence: [\n\t\t{\n\t\t\tid: geoShapeVersions.AddUrlProp,\n\t\t\tup: (props) => {\n\t\t\t\tprops.url = ''\n\t\t\t},\n\t\t\tdown: 'retired',\n\t\t},\n\t\t{\n\t\t\tid: geoShapeVersions.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\t\t{\n\t\t\tid: geoShapeVersions.RemoveJustify,\n\t\t\tup: (props) => {\n\t\t\t\tif (props.align === 'justify') {\n\t\t\t\t\tprops.align = 'start'\n\t\t\t\t}\n\t\t\t},\n\t\t\tdown: 'retired',\n\t\t},\n\t\t{\n\t\t\tid: geoShapeVersions.AddCheckBox,\n\t\t\tup: (_props) => {\n\t\t\t\t// noop\n\t\t\t},\n\t\t\tdown: 'retired',\n\t\t},\n\t\t{\n\t\t\tid: geoShapeVersions.AddVerticalAlign,\n\t\t\tup: (props) => {\n\t\t\t\tprops.verticalAlign = 'middle'\n\t\t\t},\n\t\t\tdown: 'retired',\n\t\t},\n\t\t{\n\t\t\tid: geoShapeVersions.MigrateLegacyAlign,\n\t\t\tup: (props) => {\n\t\t\t\tlet newAlign: TLDefaultHorizontalAlignStyle\n\t\t\t\tswitch (props.align) {\n\t\t\t\t\tcase 'start':\n\t\t\t\t\t\tnewAlign = 'start-legacy'\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase 'end':\n\t\t\t\t\t\tnewAlign = 'end-legacy'\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tnewAlign = 'middle-legacy'\n\t\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tprops.align = newAlign\n\t\t\t},\n\t\t\tdown: 'retired',\n\t\t},\n\t\t{\n\t\t\tid: geoShapeVersions.AddCloud,\n\t\t\tup: (_props) => {\n\t\t\t\t// noop\n\t\t\t},\n\t\t\tdown: 'retired',\n\t\t},\n\t\t{\n\t\t\tid: geoShapeVersions.MakeUrlsValid,\n\t\t\tup: (props) => {\n\t\t\t\tif (!T.linkUrl.isValid(props.url)) {\n\t\t\t\t\tprops.url = ''\n\t\t\t\t}\n\t\t\t},\n\t\t\tdown: (_props) => {\n\t\t\t\t// noop\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: geoShapeVersions.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\t{\n\t\t\tid: geoShapeVersions.AddRichText,\n\t\t\tup: (props) => {\n\t\t\t\tprops.richText = toRichText(props.text)\n\t\t\t\tdelete props.text\n\t\t\t},\n\t\t\t// N.B. Explicitly no down state so that we force clients to update.\n\t\t\t// down: (props) => {\n\t\t\t// \tdelete props.richText\n\t\t\t// },\n\t\t},\n\t],\n})\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAkB;AAClB,wBAA0D;AAC1D,qBAAgF;AAEhF,uBAA0B;AAC1B,0BAIO;AACP,yBAAqD;AACrD,yBAAqD;AACrD,yBAAqD;AACrD,oCAGO;AACP,yBAAqD;AACrD,kCAGO;AAIA,MAAM,mBAAmB,2BAAU,WAAW,cAAc;AAAA,EAClE,cAAc;AAAA,EACd,QAAQ;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 -30,7 +30,8 @@ var import_geometry_types = require("../misc/geometry-types");
|
|
|
30
30
|
var import_TLShape = require("../records/TLShape");
|
|
31
31
|
const ImageShapeCrop = import_validate.T.object({
|
|
32
32
|
topLeft: import_geometry_types.vecModelValidator,
|
|
33
|
-
bottomRight: import_geometry_types.vecModelValidator
|
|
33
|
+
bottomRight: import_geometry_types.vecModelValidator,
|
|
34
|
+
isCircle: import_validate.T.boolean.optional()
|
|
34
35
|
});
|
|
35
36
|
const imageShapeProps = {
|
|
36
37
|
w: import_validate.T.nonZeroNumber,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/shapes/TLImageShape.ts"],
|
|
4
|
-
"sourcesContent": ["import { T } from '@tldraw/validate'\nimport { assetIdValidator } from '../assets/TLBaseAsset'\nimport { vecModelValidator } from '../misc/geometry-types'\nimport { TLAssetId } from '../records/TLAsset'\nimport { createShapePropsMigrationIds, createShapePropsMigrationSequence } from '../records/TLShape'\nimport { RecordProps } from '../recordsWithProps'\nimport { TLShapeCrop } from './ShapeWithCrop'\nimport { TLBaseShape } from './TLBaseShape'\n\n/** @public */\nexport const ImageShapeCrop: T.ObjectValidator<TLShapeCrop> = T.object({\n\ttopLeft: vecModelValidator,\n\tbottomRight: vecModelValidator,\n})\n\n/** @public */\nexport interface TLImageShapeProps {\n\tw: number\n\th: number\n\tplaying: boolean\n\turl: string\n\tassetId: TLAssetId | null\n\tcrop: TLShapeCrop | null\n\tflipX: boolean\n\tflipY: boolean\n\taltText: string\n}\n\n/** @public */\nexport type TLImageShape = TLBaseShape<'image', TLImageShapeProps>\n\n/** @public */\nexport const imageShapeProps: RecordProps<TLImageShape> = {\n\tw: T.nonZeroNumber,\n\th: T.nonZeroNumber,\n\tplaying: T.boolean,\n\turl: T.linkUrl,\n\tassetId: assetIdValidator.nullable(),\n\tcrop: ImageShapeCrop.nullable(),\n\tflipX: T.boolean,\n\tflipY: T.boolean,\n\taltText: T.string,\n}\n\nconst Versions = createShapePropsMigrationIds('image', {\n\tAddUrlProp: 1,\n\tAddCropProp: 2,\n\tMakeUrlsValid: 3,\n\tAddFlipProps: 4,\n\tAddAltText: 5,\n})\n\nexport { Versions as imageShapeVersions }\n\n/** @public */\nexport const imageShapeMigrations = createShapePropsMigrationSequence({\n\tsequence: [\n\t\t{\n\t\t\tid: Versions.AddUrlProp,\n\t\t\tup: (props) => {\n\t\t\t\tprops.url = ''\n\t\t\t},\n\t\t\tdown: 'retired',\n\t\t},\n\t\t{\n\t\t\tid: Versions.AddCropProp,\n\t\t\tup: (props) => {\n\t\t\t\tprops.crop = null\n\t\t\t},\n\t\t\tdown: (props) => {\n\t\t\t\tdelete props.crop\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: Versions.MakeUrlsValid,\n\t\t\tup: (props) => {\n\t\t\t\tif (!T.linkUrl.isValid(props.url)) {\n\t\t\t\t\tprops.url = ''\n\t\t\t\t}\n\t\t\t},\n\t\t\tdown: (_props) => {\n\t\t\t\t// noop\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: Versions.AddFlipProps,\n\t\t\tup: (props) => {\n\t\t\t\tprops.flipX = false\n\t\t\t\tprops.flipY = false\n\t\t\t},\n\t\t\tdown: (props) => {\n\t\t\t\tdelete props.flipX\n\t\t\t\tdelete props.flipY\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: Versions.AddAltText,\n\t\t\tup: (props) => {\n\t\t\t\tprops.altText = ''\n\t\t\t},\n\t\t\tdown: (props) => {\n\t\t\t\tdelete props.altText\n\t\t\t},\n\t\t},\n\t],\n})\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAkB;AAClB,yBAAiC;AACjC,4BAAkC;AAElC,qBAAgF;AAMzE,MAAM,iBAAiD,kBAAE,OAAO;AAAA,EACtE,SAAS;AAAA,EACT,aAAa;
|
|
4
|
+
"sourcesContent": ["import { T } from '@tldraw/validate'\nimport { assetIdValidator } from '../assets/TLBaseAsset'\nimport { vecModelValidator } from '../misc/geometry-types'\nimport { TLAssetId } from '../records/TLAsset'\nimport { createShapePropsMigrationIds, createShapePropsMigrationSequence } from '../records/TLShape'\nimport { RecordProps } from '../recordsWithProps'\nimport { TLShapeCrop } from './ShapeWithCrop'\nimport { TLBaseShape } from './TLBaseShape'\n\n/** @public */\nexport const ImageShapeCrop: T.ObjectValidator<TLShapeCrop> = T.object({\n\ttopLeft: vecModelValidator,\n\tbottomRight: vecModelValidator,\n\tisCircle: T.boolean.optional(),\n})\n\n/** @public */\nexport interface TLImageShapeProps {\n\tw: number\n\th: number\n\tplaying: boolean\n\turl: string\n\tassetId: TLAssetId | null\n\tcrop: TLShapeCrop | null\n\tflipX: boolean\n\tflipY: boolean\n\taltText: string\n}\n\n/** @public */\nexport type TLImageShape = TLBaseShape<'image', TLImageShapeProps>\n\n/** @public */\nexport const imageShapeProps: RecordProps<TLImageShape> = {\n\tw: T.nonZeroNumber,\n\th: T.nonZeroNumber,\n\tplaying: T.boolean,\n\turl: T.linkUrl,\n\tassetId: assetIdValidator.nullable(),\n\tcrop: ImageShapeCrop.nullable(),\n\tflipX: T.boolean,\n\tflipY: T.boolean,\n\taltText: T.string,\n}\n\nconst Versions = createShapePropsMigrationIds('image', {\n\tAddUrlProp: 1,\n\tAddCropProp: 2,\n\tMakeUrlsValid: 3,\n\tAddFlipProps: 4,\n\tAddAltText: 5,\n})\n\nexport { Versions as imageShapeVersions }\n\n/** @public */\nexport const imageShapeMigrations = createShapePropsMigrationSequence({\n\tsequence: [\n\t\t{\n\t\t\tid: Versions.AddUrlProp,\n\t\t\tup: (props) => {\n\t\t\t\tprops.url = ''\n\t\t\t},\n\t\t\tdown: 'retired',\n\t\t},\n\t\t{\n\t\t\tid: Versions.AddCropProp,\n\t\t\tup: (props) => {\n\t\t\t\tprops.crop = null\n\t\t\t},\n\t\t\tdown: (props) => {\n\t\t\t\tdelete props.crop\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: Versions.MakeUrlsValid,\n\t\t\tup: (props) => {\n\t\t\t\tif (!T.linkUrl.isValid(props.url)) {\n\t\t\t\t\tprops.url = ''\n\t\t\t\t}\n\t\t\t},\n\t\t\tdown: (_props) => {\n\t\t\t\t// noop\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: Versions.AddFlipProps,\n\t\t\tup: (props) => {\n\t\t\t\tprops.flipX = false\n\t\t\t\tprops.flipY = false\n\t\t\t},\n\t\t\tdown: (props) => {\n\t\t\t\tdelete props.flipX\n\t\t\t\tdelete props.flipY\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: Versions.AddAltText,\n\t\t\tup: (props) => {\n\t\t\t\tprops.altText = ''\n\t\t\t},\n\t\t\tdown: (props) => {\n\t\t\t\tdelete props.altText\n\t\t\t},\n\t\t},\n\t],\n})\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAkB;AAClB,yBAAiC;AACjC,4BAAkC;AAElC,qBAAgF;AAMzE,MAAM,iBAAiD,kBAAE,OAAO;AAAA,EACtE,SAAS;AAAA,EACT,aAAa;AAAA,EACb,UAAU,kBAAE,QAAQ,SAAS;AAC9B,CAAC;AAmBM,MAAM,kBAA6C;AAAA,EACzD,GAAG,kBAAE;AAAA,EACL,GAAG,kBAAE;AAAA,EACL,SAAS,kBAAE;AAAA,EACX,KAAK,kBAAE;AAAA,EACP,SAAS,oCAAiB,SAAS;AAAA,EACnC,MAAM,eAAe,SAAS;AAAA,EAC9B,OAAO,kBAAE;AAAA,EACT,OAAO,kBAAE;AAAA,EACT,SAAS,kBAAE;AACZ;AAEA,MAAM,eAAW,6CAA6B,SAAS;AAAA,EACtD,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,eAAe;AAAA,EACf,cAAc;AAAA,EACd,YAAY;AACb,CAAC;AAKM,MAAM,2BAAuB,kDAAkC;AAAA,EACrE,UAAU;AAAA,IACT;AAAA,MACC,IAAI,SAAS;AAAA,MACb,IAAI,CAAC,UAAU;AACd,cAAM,MAAM;AAAA,MACb;AAAA,MACA,MAAM;AAAA,IACP;AAAA,IACA;AAAA,MACC,IAAI,SAAS;AAAA,MACb,IAAI,CAAC,UAAU;AACd,cAAM,OAAO;AAAA,MACd;AAAA,MACA,MAAM,CAAC,UAAU;AAChB,eAAO,MAAM;AAAA,MACd;AAAA,IACD;AAAA,IACA;AAAA,MACC,IAAI,SAAS;AAAA,MACb,IAAI,CAAC,UAAU;AACd,YAAI,CAAC,kBAAE,QAAQ,QAAQ,MAAM,GAAG,GAAG;AAClC,gBAAM,MAAM;AAAA,QACb;AAAA,MACD;AAAA,MACA,MAAM,CAAC,WAAW;AAAA,MAElB;AAAA,IACD;AAAA,IACA;AAAA,MACC,IAAI,SAAS;AAAA,MACb,IAAI,CAAC,UAAU;AACd,cAAM,QAAQ;AACd,cAAM,QAAQ;AAAA,MACf;AAAA,MACA,MAAM,CAAC,UAAU;AAChB,eAAO,MAAM;AACb,eAAO,MAAM;AAAA,MACd;AAAA,IACD;AAAA,IACA;AAAA,MACC,IAAI,SAAS;AAAA,MACb,IAAI,CAAC,UAAU;AACd,cAAM,UAAU;AAAA,MACjB;AAAA,MACA,MAAM,CAAC,UAAU;AAChB,eAAO,MAAM;AAAA,MACd;AAAA,IACD;AAAA,EACD;AACD,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist-esm/index.d.mts
CHANGED
|
@@ -1170,20 +1170,20 @@ export declare type TLGeoShapeGeoStyle = T.TypeOf<typeof GeoShapeGeoStyle>;
|
|
|
1170
1170
|
/** @public */
|
|
1171
1171
|
export declare interface TLGeoShapeProps {
|
|
1172
1172
|
geo: TLGeoShapeGeoStyle;
|
|
1173
|
+
dash: TLDefaultDashStyle;
|
|
1174
|
+
url: string;
|
|
1175
|
+
w: number;
|
|
1176
|
+
h: number;
|
|
1177
|
+
growY: number;
|
|
1178
|
+
scale: number;
|
|
1173
1179
|
labelColor: TLDefaultColorStyle;
|
|
1174
1180
|
color: TLDefaultColorStyle;
|
|
1175
1181
|
fill: TLDefaultFillStyle;
|
|
1176
|
-
dash: TLDefaultDashStyle;
|
|
1177
1182
|
size: TLDefaultSizeStyle;
|
|
1178
1183
|
font: TLDefaultFontStyle;
|
|
1179
1184
|
align: TLDefaultHorizontalAlignStyle;
|
|
1180
1185
|
verticalAlign: TLDefaultVerticalAlignStyle;
|
|
1181
|
-
url: string;
|
|
1182
|
-
w: number;
|
|
1183
|
-
h: number;
|
|
1184
|
-
growY: number;
|
|
1185
1186
|
richText: TLRichText;
|
|
1186
|
-
scale: number;
|
|
1187
1187
|
}
|
|
1188
1188
|
|
|
1189
1189
|
/** @public */
|
|
@@ -1538,6 +1538,7 @@ export declare type TLShape = TLDefaultShape | TLUnknownShape;
|
|
|
1538
1538
|
export declare interface TLShapeCrop {
|
|
1539
1539
|
topLeft: VecModel;
|
|
1540
1540
|
bottomRight: VecModel;
|
|
1541
|
+
isCircle?: boolean;
|
|
1541
1542
|
}
|
|
1542
1543
|
|
|
1543
1544
|
/** @public */
|
package/dist-esm/index.mjs
CHANGED
|
@@ -43,20 +43,21 @@ const GeoShapeGeoStyle = StyleProp.defineEnum("tldraw:geo", {
|
|
|
43
43
|
});
|
|
44
44
|
const geoShapeProps = {
|
|
45
45
|
geo: GeoShapeGeoStyle,
|
|
46
|
+
dash: DefaultDashStyle,
|
|
47
|
+
url: T.linkUrl,
|
|
48
|
+
w: T.nonZeroNumber,
|
|
49
|
+
h: T.nonZeroNumber,
|
|
50
|
+
growY: T.positiveNumber,
|
|
51
|
+
scale: T.nonZeroNumber,
|
|
52
|
+
// Text properties
|
|
46
53
|
labelColor: DefaultLabelColorStyle,
|
|
47
54
|
color: DefaultColorStyle,
|
|
48
55
|
fill: DefaultFillStyle,
|
|
49
|
-
dash: DefaultDashStyle,
|
|
50
56
|
size: DefaultSizeStyle,
|
|
51
57
|
font: DefaultFontStyle,
|
|
52
58
|
align: DefaultHorizontalAlignStyle,
|
|
53
59
|
verticalAlign: DefaultVerticalAlignStyle,
|
|
54
|
-
|
|
55
|
-
w: T.nonZeroNumber,
|
|
56
|
-
h: T.nonZeroNumber,
|
|
57
|
-
growY: T.positiveNumber,
|
|
58
|
-
richText: richTextValidator,
|
|
59
|
-
scale: T.nonZeroNumber
|
|
60
|
+
richText: richTextValidator
|
|
60
61
|
};
|
|
61
62
|
const geoShapeVersions = createShapePropsMigrationIds("geo", {
|
|
62
63
|
AddUrlProp: 1,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/shapes/TLGeoShape.ts"],
|
|
4
|
-
"sourcesContent": ["import { T } from '@tldraw/validate'\nimport { TLRichText, richTextValidator, toRichText } from '../misc/TLRichText'\nimport { createShapePropsMigrationIds, createShapePropsMigrationSequence } from '../records/TLShape'\nimport { RecordProps } 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 {\n\tDefaultHorizontalAlignStyle,\n\tTLDefaultHorizontalAlignStyle,\n} from '../styles/TLHorizontalAlignStyle'\nimport { DefaultSizeStyle, TLDefaultSizeStyle } from '../styles/TLSizeStyle'\nimport {\n\tDefaultVerticalAlignStyle,\n\tTLDefaultVerticalAlignStyle,\n} from '../styles/TLVerticalAlignStyle'\nimport { TLBaseShape } from './TLBaseShape'\n\n/** @public */\nexport const GeoShapeGeoStyle = StyleProp.defineEnum('tldraw:geo', {\n\tdefaultValue: 'rectangle',\n\tvalues: [\n\t\t'cloud',\n\t\t'rectangle',\n\t\t'ellipse',\n\t\t'triangle',\n\t\t'diamond',\n\t\t'pentagon',\n\t\t'hexagon',\n\t\t'octagon',\n\t\t'star',\n\t\t'rhombus',\n\t\t'rhombus-2',\n\t\t'oval',\n\t\t'trapezoid',\n\t\t'arrow-right',\n\t\t'arrow-left',\n\t\t'arrow-up',\n\t\t'arrow-down',\n\t\t'x-box',\n\t\t'check-box',\n\t\t'heart',\n\t],\n})\n\n/** @public */\nexport type TLGeoShapeGeoStyle = T.TypeOf<typeof GeoShapeGeoStyle>\n\n/** @public */\nexport interface TLGeoShapeProps {\n\tgeo: TLGeoShapeGeoStyle\n\
|
|
5
|
-
"mappings": "AAAA,SAAS,SAAS;AAClB,SAAqB,mBAAmB,kBAAkB;AAC1D,SAAS,8BAA8B,yCAAyC;AAEhF,SAAS,iBAAiB;AAC1B;AAAA,EACC;AAAA,EACA;AAAA,OAEM;AACP,SAAS,wBAA4C;AACrD,SAAS,wBAA4C;AACrD,SAAS,wBAA4C;AACrD;AAAA,EACC;AAAA,OAEM;AACP,SAAS,wBAA4C;AACrD;AAAA,EACC;AAAA,OAEM;AAIA,MAAM,mBAAmB,UAAU,WAAW,cAAc;AAAA,EAClE,cAAc;AAAA,EACd,QAAQ;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD,CAAC;
|
|
4
|
+
"sourcesContent": ["import { T } from '@tldraw/validate'\nimport { TLRichText, richTextValidator, toRichText } from '../misc/TLRichText'\nimport { createShapePropsMigrationIds, createShapePropsMigrationSequence } from '../records/TLShape'\nimport { RecordProps } 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 {\n\tDefaultHorizontalAlignStyle,\n\tTLDefaultHorizontalAlignStyle,\n} from '../styles/TLHorizontalAlignStyle'\nimport { DefaultSizeStyle, TLDefaultSizeStyle } from '../styles/TLSizeStyle'\nimport {\n\tDefaultVerticalAlignStyle,\n\tTLDefaultVerticalAlignStyle,\n} from '../styles/TLVerticalAlignStyle'\nimport { TLBaseShape } from './TLBaseShape'\n\n/** @public */\nexport const GeoShapeGeoStyle = StyleProp.defineEnum('tldraw:geo', {\n\tdefaultValue: 'rectangle',\n\tvalues: [\n\t\t'cloud',\n\t\t'rectangle',\n\t\t'ellipse',\n\t\t'triangle',\n\t\t'diamond',\n\t\t'pentagon',\n\t\t'hexagon',\n\t\t'octagon',\n\t\t'star',\n\t\t'rhombus',\n\t\t'rhombus-2',\n\t\t'oval',\n\t\t'trapezoid',\n\t\t'arrow-right',\n\t\t'arrow-left',\n\t\t'arrow-up',\n\t\t'arrow-down',\n\t\t'x-box',\n\t\t'check-box',\n\t\t'heart',\n\t],\n})\n\n/** @public */\nexport type TLGeoShapeGeoStyle = T.TypeOf<typeof GeoShapeGeoStyle>\n\n/** @public */\nexport interface TLGeoShapeProps {\n\tgeo: TLGeoShapeGeoStyle\n\tdash: TLDefaultDashStyle\n\turl: string\n\tw: number\n\th: number\n\tgrowY: number\n\tscale: number\n\n\t// Text properties\n\tlabelColor: TLDefaultColorStyle\n\tcolor: TLDefaultColorStyle\n\tfill: TLDefaultFillStyle\n\tsize: TLDefaultSizeStyle\n\tfont: TLDefaultFontStyle\n\talign: TLDefaultHorizontalAlignStyle\n\tverticalAlign: TLDefaultVerticalAlignStyle\n\trichText: TLRichText\n}\n\n/** @public */\nexport type TLGeoShape = TLBaseShape<'geo', TLGeoShapeProps>\n\n/** @public */\nexport const geoShapeProps: RecordProps<TLGeoShape> = {\n\tgeo: GeoShapeGeoStyle,\n\tdash: DefaultDashStyle,\n\turl: T.linkUrl,\n\tw: T.nonZeroNumber,\n\th: T.nonZeroNumber,\n\tgrowY: T.positiveNumber,\n\tscale: T.nonZeroNumber,\n\n\t// Text properties\n\tlabelColor: DefaultLabelColorStyle,\n\tcolor: DefaultColorStyle,\n\tfill: DefaultFillStyle,\n\tsize: DefaultSizeStyle,\n\tfont: DefaultFontStyle,\n\talign: DefaultHorizontalAlignStyle,\n\tverticalAlign: DefaultVerticalAlignStyle,\n\trichText: richTextValidator,\n}\n\nconst geoShapeVersions = createShapePropsMigrationIds('geo', {\n\tAddUrlProp: 1,\n\tAddLabelColor: 2,\n\tRemoveJustify: 3,\n\tAddCheckBox: 4,\n\tAddVerticalAlign: 5,\n\tMigrateLegacyAlign: 6,\n\tAddCloud: 7,\n\tMakeUrlsValid: 8,\n\tAddScale: 9,\n\tAddRichText: 10,\n})\n\nexport { geoShapeVersions as geoShapeVersions }\n\n/** @public */\nexport const geoShapeMigrations = createShapePropsMigrationSequence({\n\tsequence: [\n\t\t{\n\t\t\tid: geoShapeVersions.AddUrlProp,\n\t\t\tup: (props) => {\n\t\t\t\tprops.url = ''\n\t\t\t},\n\t\t\tdown: 'retired',\n\t\t},\n\t\t{\n\t\t\tid: geoShapeVersions.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\t\t{\n\t\t\tid: geoShapeVersions.RemoveJustify,\n\t\t\tup: (props) => {\n\t\t\t\tif (props.align === 'justify') {\n\t\t\t\t\tprops.align = 'start'\n\t\t\t\t}\n\t\t\t},\n\t\t\tdown: 'retired',\n\t\t},\n\t\t{\n\t\t\tid: geoShapeVersions.AddCheckBox,\n\t\t\tup: (_props) => {\n\t\t\t\t// noop\n\t\t\t},\n\t\t\tdown: 'retired',\n\t\t},\n\t\t{\n\t\t\tid: geoShapeVersions.AddVerticalAlign,\n\t\t\tup: (props) => {\n\t\t\t\tprops.verticalAlign = 'middle'\n\t\t\t},\n\t\t\tdown: 'retired',\n\t\t},\n\t\t{\n\t\t\tid: geoShapeVersions.MigrateLegacyAlign,\n\t\t\tup: (props) => {\n\t\t\t\tlet newAlign: TLDefaultHorizontalAlignStyle\n\t\t\t\tswitch (props.align) {\n\t\t\t\t\tcase 'start':\n\t\t\t\t\t\tnewAlign = 'start-legacy'\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase 'end':\n\t\t\t\t\t\tnewAlign = 'end-legacy'\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tnewAlign = 'middle-legacy'\n\t\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tprops.align = newAlign\n\t\t\t},\n\t\t\tdown: 'retired',\n\t\t},\n\t\t{\n\t\t\tid: geoShapeVersions.AddCloud,\n\t\t\tup: (_props) => {\n\t\t\t\t// noop\n\t\t\t},\n\t\t\tdown: 'retired',\n\t\t},\n\t\t{\n\t\t\tid: geoShapeVersions.MakeUrlsValid,\n\t\t\tup: (props) => {\n\t\t\t\tif (!T.linkUrl.isValid(props.url)) {\n\t\t\t\t\tprops.url = ''\n\t\t\t\t}\n\t\t\t},\n\t\t\tdown: (_props) => {\n\t\t\t\t// noop\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: geoShapeVersions.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\t{\n\t\t\tid: geoShapeVersions.AddRichText,\n\t\t\tup: (props) => {\n\t\t\t\tprops.richText = toRichText(props.text)\n\t\t\t\tdelete props.text\n\t\t\t},\n\t\t\t// N.B. Explicitly no down state so that we force clients to update.\n\t\t\t// down: (props) => {\n\t\t\t// \tdelete props.richText\n\t\t\t// },\n\t\t},\n\t],\n})\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,SAAS;AAClB,SAAqB,mBAAmB,kBAAkB;AAC1D,SAAS,8BAA8B,yCAAyC;AAEhF,SAAS,iBAAiB;AAC1B;AAAA,EACC;AAAA,EACA;AAAA,OAEM;AACP,SAAS,wBAA4C;AACrD,SAAS,wBAA4C;AACrD,SAAS,wBAA4C;AACrD;AAAA,EACC;AAAA,OAEM;AACP,SAAS,wBAA4C;AACrD;AAAA,EACC;AAAA,OAEM;AAIA,MAAM,mBAAmB,UAAU,WAAW,cAAc;AAAA,EAClE,cAAc;AAAA,EACd,QAAQ;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD,CAAC;AA8BM,MAAM,gBAAyC;AAAA,EACrD,KAAK;AAAA,EACL,MAAM;AAAA,EACN,KAAK,EAAE;AAAA,EACP,GAAG,EAAE;AAAA,EACL,GAAG,EAAE;AAAA,EACL,OAAO,EAAE;AAAA,EACT,OAAO,EAAE;AAAA;AAAA,EAGT,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,eAAe;AAAA,EACf,UAAU;AACX;AAEA,MAAM,mBAAmB,6BAA6B,OAAO;AAAA,EAC5D,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,eAAe;AAAA,EACf,aAAa;AAAA,EACb,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,UAAU;AAAA,EACV,eAAe;AAAA,EACf,UAAU;AAAA,EACV,aAAa;AACd,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D;AAAA,MACA,MAAM,CAAC,WAAW;AAAA,MAElB;AAAA,IACD;AAAA,IACA;AAAA,MACC,IAAI,iBAAiB;AAAA,MACrB,IAAI,CAAC,UAAU;AACd,cAAM,QAAQ;AAAA,MACf;AAAA,MACA,MAAM,CAAC,UAAU;AAChB,eAAO,MAAM;AAAA,MACd;AAAA,IACD;AAAA,IACA;AAAA,MACC,IAAI,iBAAiB;AAAA,MACrB,IAAI,CAAC,UAAU;AACd,cAAM,WAAW,WAAW,MAAM,IAAI;AACtC,eAAO,MAAM;AAAA,MACd;AAAA;AAAA;AAAA;AAAA;AAAA,IAKD;AAAA,EACD;AACD,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -4,7 +4,8 @@ import { vecModelValidator } from "../misc/geometry-types.mjs";
|
|
|
4
4
|
import { createShapePropsMigrationIds, createShapePropsMigrationSequence } from "../records/TLShape.mjs";
|
|
5
5
|
const ImageShapeCrop = T.object({
|
|
6
6
|
topLeft: vecModelValidator,
|
|
7
|
-
bottomRight: vecModelValidator
|
|
7
|
+
bottomRight: vecModelValidator,
|
|
8
|
+
isCircle: T.boolean.optional()
|
|
8
9
|
});
|
|
9
10
|
const imageShapeProps = {
|
|
10
11
|
w: T.nonZeroNumber,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/shapes/TLImageShape.ts"],
|
|
4
|
-
"sourcesContent": ["import { T } from '@tldraw/validate'\nimport { assetIdValidator } from '../assets/TLBaseAsset'\nimport { vecModelValidator } from '../misc/geometry-types'\nimport { TLAssetId } from '../records/TLAsset'\nimport { createShapePropsMigrationIds, createShapePropsMigrationSequence } from '../records/TLShape'\nimport { RecordProps } from '../recordsWithProps'\nimport { TLShapeCrop } from './ShapeWithCrop'\nimport { TLBaseShape } from './TLBaseShape'\n\n/** @public */\nexport const ImageShapeCrop: T.ObjectValidator<TLShapeCrop> = T.object({\n\ttopLeft: vecModelValidator,\n\tbottomRight: vecModelValidator,\n})\n\n/** @public */\nexport interface TLImageShapeProps {\n\tw: number\n\th: number\n\tplaying: boolean\n\turl: string\n\tassetId: TLAssetId | null\n\tcrop: TLShapeCrop | null\n\tflipX: boolean\n\tflipY: boolean\n\taltText: string\n}\n\n/** @public */\nexport type TLImageShape = TLBaseShape<'image', TLImageShapeProps>\n\n/** @public */\nexport const imageShapeProps: RecordProps<TLImageShape> = {\n\tw: T.nonZeroNumber,\n\th: T.nonZeroNumber,\n\tplaying: T.boolean,\n\turl: T.linkUrl,\n\tassetId: assetIdValidator.nullable(),\n\tcrop: ImageShapeCrop.nullable(),\n\tflipX: T.boolean,\n\tflipY: T.boolean,\n\taltText: T.string,\n}\n\nconst Versions = createShapePropsMigrationIds('image', {\n\tAddUrlProp: 1,\n\tAddCropProp: 2,\n\tMakeUrlsValid: 3,\n\tAddFlipProps: 4,\n\tAddAltText: 5,\n})\n\nexport { Versions as imageShapeVersions }\n\n/** @public */\nexport const imageShapeMigrations = createShapePropsMigrationSequence({\n\tsequence: [\n\t\t{\n\t\t\tid: Versions.AddUrlProp,\n\t\t\tup: (props) => {\n\t\t\t\tprops.url = ''\n\t\t\t},\n\t\t\tdown: 'retired',\n\t\t},\n\t\t{\n\t\t\tid: Versions.AddCropProp,\n\t\t\tup: (props) => {\n\t\t\t\tprops.crop = null\n\t\t\t},\n\t\t\tdown: (props) => {\n\t\t\t\tdelete props.crop\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: Versions.MakeUrlsValid,\n\t\t\tup: (props) => {\n\t\t\t\tif (!T.linkUrl.isValid(props.url)) {\n\t\t\t\t\tprops.url = ''\n\t\t\t\t}\n\t\t\t},\n\t\t\tdown: (_props) => {\n\t\t\t\t// noop\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: Versions.AddFlipProps,\n\t\t\tup: (props) => {\n\t\t\t\tprops.flipX = false\n\t\t\t\tprops.flipY = false\n\t\t\t},\n\t\t\tdown: (props) => {\n\t\t\t\tdelete props.flipX\n\t\t\t\tdelete props.flipY\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: Versions.AddAltText,\n\t\t\tup: (props) => {\n\t\t\t\tprops.altText = ''\n\t\t\t},\n\t\t\tdown: (props) => {\n\t\t\t\tdelete props.altText\n\t\t\t},\n\t\t},\n\t],\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,SAAS;AAClB,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;AAElC,SAAS,8BAA8B,yCAAyC;AAMzE,MAAM,iBAAiD,EAAE,OAAO;AAAA,EACtE,SAAS;AAAA,EACT,aAAa;
|
|
4
|
+
"sourcesContent": ["import { T } from '@tldraw/validate'\nimport { assetIdValidator } from '../assets/TLBaseAsset'\nimport { vecModelValidator } from '../misc/geometry-types'\nimport { TLAssetId } from '../records/TLAsset'\nimport { createShapePropsMigrationIds, createShapePropsMigrationSequence } from '../records/TLShape'\nimport { RecordProps } from '../recordsWithProps'\nimport { TLShapeCrop } from './ShapeWithCrop'\nimport { TLBaseShape } from './TLBaseShape'\n\n/** @public */\nexport const ImageShapeCrop: T.ObjectValidator<TLShapeCrop> = T.object({\n\ttopLeft: vecModelValidator,\n\tbottomRight: vecModelValidator,\n\tisCircle: T.boolean.optional(),\n})\n\n/** @public */\nexport interface TLImageShapeProps {\n\tw: number\n\th: number\n\tplaying: boolean\n\turl: string\n\tassetId: TLAssetId | null\n\tcrop: TLShapeCrop | null\n\tflipX: boolean\n\tflipY: boolean\n\taltText: string\n}\n\n/** @public */\nexport type TLImageShape = TLBaseShape<'image', TLImageShapeProps>\n\n/** @public */\nexport const imageShapeProps: RecordProps<TLImageShape> = {\n\tw: T.nonZeroNumber,\n\th: T.nonZeroNumber,\n\tplaying: T.boolean,\n\turl: T.linkUrl,\n\tassetId: assetIdValidator.nullable(),\n\tcrop: ImageShapeCrop.nullable(),\n\tflipX: T.boolean,\n\tflipY: T.boolean,\n\taltText: T.string,\n}\n\nconst Versions = createShapePropsMigrationIds('image', {\n\tAddUrlProp: 1,\n\tAddCropProp: 2,\n\tMakeUrlsValid: 3,\n\tAddFlipProps: 4,\n\tAddAltText: 5,\n})\n\nexport { Versions as imageShapeVersions }\n\n/** @public */\nexport const imageShapeMigrations = createShapePropsMigrationSequence({\n\tsequence: [\n\t\t{\n\t\t\tid: Versions.AddUrlProp,\n\t\t\tup: (props) => {\n\t\t\t\tprops.url = ''\n\t\t\t},\n\t\t\tdown: 'retired',\n\t\t},\n\t\t{\n\t\t\tid: Versions.AddCropProp,\n\t\t\tup: (props) => {\n\t\t\t\tprops.crop = null\n\t\t\t},\n\t\t\tdown: (props) => {\n\t\t\t\tdelete props.crop\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: Versions.MakeUrlsValid,\n\t\t\tup: (props) => {\n\t\t\t\tif (!T.linkUrl.isValid(props.url)) {\n\t\t\t\t\tprops.url = ''\n\t\t\t\t}\n\t\t\t},\n\t\t\tdown: (_props) => {\n\t\t\t\t// noop\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: Versions.AddFlipProps,\n\t\t\tup: (props) => {\n\t\t\t\tprops.flipX = false\n\t\t\t\tprops.flipY = false\n\t\t\t},\n\t\t\tdown: (props) => {\n\t\t\t\tdelete props.flipX\n\t\t\t\tdelete props.flipY\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: Versions.AddAltText,\n\t\t\tup: (props) => {\n\t\t\t\tprops.altText = ''\n\t\t\t},\n\t\t\tdown: (props) => {\n\t\t\t\tdelete props.altText\n\t\t\t},\n\t\t},\n\t],\n})\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,SAAS;AAClB,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;AAElC,SAAS,8BAA8B,yCAAyC;AAMzE,MAAM,iBAAiD,EAAE,OAAO;AAAA,EACtE,SAAS;AAAA,EACT,aAAa;AAAA,EACb,UAAU,EAAE,QAAQ,SAAS;AAC9B,CAAC;AAmBM,MAAM,kBAA6C;AAAA,E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AAAA,IACD;AAAA,EACD;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.14.0-canary.
|
|
4
|
+
"version": "3.14.0-canary.fdbfe5bf2604",
|
|
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.14.0-canary.
|
|
58
|
-
"@tldraw/store": "3.14.0-canary.
|
|
59
|
-
"@tldraw/utils": "3.14.0-canary.
|
|
60
|
-
"@tldraw/validate": "3.14.0-canary.
|
|
57
|
+
"@tldraw/state": "3.14.0-canary.fdbfe5bf2604",
|
|
58
|
+
"@tldraw/store": "3.14.0-canary.fdbfe5bf2604",
|
|
59
|
+
"@tldraw/utils": "3.14.0-canary.fdbfe5bf2604",
|
|
60
|
+
"@tldraw/validate": "3.14.0-canary.fdbfe5bf2604"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"react": "^18.2.0 || ^19.0.0",
|
package/src/shapes/TLGeoShape.ts
CHANGED
|
@@ -55,20 +55,22 @@ export type TLGeoShapeGeoStyle = T.TypeOf<typeof GeoShapeGeoStyle>
|
|
|
55
55
|
/** @public */
|
|
56
56
|
export interface TLGeoShapeProps {
|
|
57
57
|
geo: TLGeoShapeGeoStyle
|
|
58
|
+
dash: TLDefaultDashStyle
|
|
59
|
+
url: string
|
|
60
|
+
w: number
|
|
61
|
+
h: number
|
|
62
|
+
growY: number
|
|
63
|
+
scale: number
|
|
64
|
+
|
|
65
|
+
// Text properties
|
|
58
66
|
labelColor: TLDefaultColorStyle
|
|
59
67
|
color: TLDefaultColorStyle
|
|
60
68
|
fill: TLDefaultFillStyle
|
|
61
|
-
dash: TLDefaultDashStyle
|
|
62
69
|
size: TLDefaultSizeStyle
|
|
63
70
|
font: TLDefaultFontStyle
|
|
64
71
|
align: TLDefaultHorizontalAlignStyle
|
|
65
72
|
verticalAlign: TLDefaultVerticalAlignStyle
|
|
66
|
-
url: string
|
|
67
|
-
w: number
|
|
68
|
-
h: number
|
|
69
|
-
growY: number
|
|
70
73
|
richText: TLRichText
|
|
71
|
-
scale: number
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
/** @public */
|
|
@@ -77,20 +79,22 @@ export type TLGeoShape = TLBaseShape<'geo', TLGeoShapeProps>
|
|
|
77
79
|
/** @public */
|
|
78
80
|
export const geoShapeProps: RecordProps<TLGeoShape> = {
|
|
79
81
|
geo: GeoShapeGeoStyle,
|
|
82
|
+
dash: DefaultDashStyle,
|
|
83
|
+
url: T.linkUrl,
|
|
84
|
+
w: T.nonZeroNumber,
|
|
85
|
+
h: T.nonZeroNumber,
|
|
86
|
+
growY: T.positiveNumber,
|
|
87
|
+
scale: T.nonZeroNumber,
|
|
88
|
+
|
|
89
|
+
// Text properties
|
|
80
90
|
labelColor: DefaultLabelColorStyle,
|
|
81
91
|
color: DefaultColorStyle,
|
|
82
92
|
fill: DefaultFillStyle,
|
|
83
|
-
dash: DefaultDashStyle,
|
|
84
93
|
size: DefaultSizeStyle,
|
|
85
94
|
font: DefaultFontStyle,
|
|
86
95
|
align: DefaultHorizontalAlignStyle,
|
|
87
96
|
verticalAlign: DefaultVerticalAlignStyle,
|
|
88
|
-
url: T.linkUrl,
|
|
89
|
-
w: T.nonZeroNumber,
|
|
90
|
-
h: T.nonZeroNumber,
|
|
91
|
-
growY: T.positiveNumber,
|
|
92
97
|
richText: richTextValidator,
|
|
93
|
-
scale: T.nonZeroNumber,
|
|
94
98
|
}
|
|
95
99
|
|
|
96
100
|
const geoShapeVersions = createShapePropsMigrationIds('geo', {
|