@tldraw/tlschema 3.12.0-internal.624e32507d98 β 3.13.0-canary.1793786aff8a
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/CHANGELOG.md +31 -0
- package/dist-cjs/index.d.ts +2 -0
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/shapes/TLImageShape.js +13 -2
- package/dist-cjs/shapes/TLImageShape.js.map +2 -2
- package/dist-cjs/shapes/TLVideoShape.js +13 -2
- package/dist-cjs/shapes/TLVideoShape.js.map +2 -2
- package/dist-esm/index.d.mts +2 -0
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/shapes/TLImageShape.mjs +13 -2
- package/dist-esm/shapes/TLImageShape.mjs.map +2 -2
- package/dist-esm/shapes/TLVideoShape.mjs +13 -2
- package/dist-esm/shapes/TLVideoShape.mjs.map +2 -2
- package/package.json +5 -5
- package/src/migrations.test.ts +24 -0
- package/src/shapes/TLImageShape.ts +12 -0
- package/src/shapes/TLVideoShape.ts +12 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
# v3.12.0 (Tue Apr 15 2025)
|
|
2
|
+
|
|
3
|
+
### Release Notes
|
|
4
|
+
|
|
5
|
+
#### a11y: announce shapes as they're visited ([#5773](https://github.com/tldraw/tldraw/pull/5773))
|
|
6
|
+
|
|
7
|
+
- a11y: announce shapes as they're visited
|
|
8
|
+
|
|
9
|
+
#### Add Frame colors ([#5283](https://github.com/tldraw/tldraw/pull/5283))
|
|
10
|
+
|
|
11
|
+
- Added `FrameShapeUtil.options.showColors` option to display colors for frames.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
#### π Bug Fixes
|
|
16
|
+
|
|
17
|
+
- Add Frame colors [#5283](https://github.com/tldraw/tldraw/pull/5283) ([@steveruizok](https://github.com/steveruizok) [@huppy-bot[bot]](https://github.com/huppy-bot[bot]) [@SomeHats](https://github.com/SomeHats))
|
|
18
|
+
|
|
19
|
+
#### π New Features
|
|
20
|
+
|
|
21
|
+
- a11y: announce shapes as they're visited [#5773](https://github.com/tldraw/tldraw/pull/5773) ([@mimecuvalo](https://github.com/mimecuvalo))
|
|
22
|
+
|
|
23
|
+
#### Authors: 4
|
|
24
|
+
|
|
25
|
+
- [@huppy-bot[bot]](https://github.com/huppy-bot[bot])
|
|
26
|
+
- alex ([@SomeHats](https://github.com/SomeHats))
|
|
27
|
+
- Mime Δuvalo ([@mimecuvalo](https://github.com/mimecuvalo))
|
|
28
|
+
- Steve Ruiz ([@steveruizok](https://github.com/steveruizok))
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
1
32
|
# v3.11.0 (Thu Mar 20 2025)
|
|
2
33
|
|
|
3
34
|
### Release Notes
|
package/dist-cjs/index.d.ts
CHANGED
|
@@ -1224,6 +1224,7 @@ export declare interface TLImageShapeProps {
|
|
|
1224
1224
|
crop: null | TLShapeCrop;
|
|
1225
1225
|
flipX: boolean;
|
|
1226
1226
|
flipY: boolean;
|
|
1227
|
+
altText: string;
|
|
1227
1228
|
}
|
|
1228
1229
|
|
|
1229
1230
|
/**
|
|
@@ -1596,6 +1597,7 @@ export declare interface TLVideoShapeProps {
|
|
|
1596
1597
|
playing: boolean;
|
|
1597
1598
|
url: string;
|
|
1598
1599
|
assetId: null | TLAssetId;
|
|
1600
|
+
altText: string;
|
|
1599
1601
|
}
|
|
1600
1602
|
|
|
1601
1603
|
/** @public */
|
package/dist-cjs/index.js
CHANGED
|
@@ -172,7 +172,7 @@ var import_TLVerticalAlignStyle = require("./styles/TLVerticalAlignStyle");
|
|
|
172
172
|
var import_translations = require("./translations/translations");
|
|
173
173
|
(0, import_utils.registerTldrawLibraryVersion)(
|
|
174
174
|
"@tldraw/tlschema",
|
|
175
|
-
"3.
|
|
175
|
+
"3.13.0-canary.1793786aff8a",
|
|
176
176
|
"cjs"
|
|
177
177
|
);
|
|
178
178
|
//# sourceMappingURL=index.js.map
|
|
@@ -40,13 +40,15 @@ const imageShapeProps = {
|
|
|
40
40
|
assetId: import_TLBaseAsset.assetIdValidator.nullable(),
|
|
41
41
|
crop: ImageShapeCrop.nullable(),
|
|
42
42
|
flipX: import_validate.T.boolean,
|
|
43
|
-
flipY: import_validate.T.boolean
|
|
43
|
+
flipY: import_validate.T.boolean,
|
|
44
|
+
altText: import_validate.T.string
|
|
44
45
|
};
|
|
45
46
|
const Versions = (0, import_TLShape.createShapePropsMigrationIds)("image", {
|
|
46
47
|
AddUrlProp: 1,
|
|
47
48
|
AddCropProp: 2,
|
|
48
49
|
MakeUrlsValid: 3,
|
|
49
|
-
AddFlipProps: 4
|
|
50
|
+
AddFlipProps: 4,
|
|
51
|
+
AddAltText: 5
|
|
50
52
|
});
|
|
51
53
|
const imageShapeMigrations = (0, import_TLShape.createShapePropsMigrationSequence)({
|
|
52
54
|
sequence: [
|
|
@@ -86,6 +88,15 @@ const imageShapeMigrations = (0, import_TLShape.createShapePropsMigrationSequenc
|
|
|
86
88
|
delete props.flipX;
|
|
87
89
|
delete props.flipY;
|
|
88
90
|
}
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: Versions.AddAltText,
|
|
94
|
+
up: (props) => {
|
|
95
|
+
props.altText = "";
|
|
96
|
+
},
|
|
97
|
+
down: (props) => {
|
|
98
|
+
delete props.altText;
|
|
99
|
+
}
|
|
89
100
|
}
|
|
90
101
|
]
|
|
91
102
|
});
|
|
@@ -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}\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}\n\nconst Versions = createShapePropsMigrationIds('image', {\n\tAddUrlProp: 1,\n\tAddCropProp: 2,\n\tMakeUrlsValid: 3,\n\tAddFlipProps: 4,\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],\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;AACd,CAAC;
|
|
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;AACd,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
|
}
|
|
@@ -32,11 +32,13 @@ const videoShapeProps = {
|
|
|
32
32
|
time: import_validate.T.number,
|
|
33
33
|
playing: import_validate.T.boolean,
|
|
34
34
|
url: import_validate.T.linkUrl,
|
|
35
|
-
assetId: import_TLBaseAsset.assetIdValidator.nullable()
|
|
35
|
+
assetId: import_TLBaseAsset.assetIdValidator.nullable(),
|
|
36
|
+
altText: import_validate.T.string
|
|
36
37
|
};
|
|
37
38
|
const Versions = (0, import_TLShape.createShapePropsMigrationIds)("video", {
|
|
38
39
|
AddUrlProp: 1,
|
|
39
|
-
MakeUrlsValid: 2
|
|
40
|
+
MakeUrlsValid: 2,
|
|
41
|
+
AddAltText: 3
|
|
40
42
|
});
|
|
41
43
|
const videoShapeMigrations = (0, import_TLShape.createShapePropsMigrationSequence)({
|
|
42
44
|
sequence: [
|
|
@@ -56,6 +58,15 @@ const videoShapeMigrations = (0, import_TLShape.createShapePropsMigrationSequenc
|
|
|
56
58
|
},
|
|
57
59
|
down: (_props) => {
|
|
58
60
|
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: Versions.AddAltText,
|
|
64
|
+
up: (props) => {
|
|
65
|
+
props.altText = "";
|
|
66
|
+
},
|
|
67
|
+
down: (props) => {
|
|
68
|
+
delete props.altText;
|
|
69
|
+
}
|
|
59
70
|
}
|
|
60
71
|
]
|
|
61
72
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/shapes/TLVideoShape.ts"],
|
|
4
|
-
"sourcesContent": ["import { T } from '@tldraw/validate'\nimport { assetIdValidator } from '../assets/TLBaseAsset'\nimport { TLAssetId } from '../records/TLAsset'\nimport { createShapePropsMigrationIds, createShapePropsMigrationSequence } from '../records/TLShape'\nimport { RecordProps } from '../recordsWithProps'\nimport { TLBaseShape } from './TLBaseShape'\n\n/** @public */\nexport interface TLVideoShapeProps {\n\tw: number\n\th: number\n\ttime: number\n\tplaying: boolean\n\turl: string\n\tassetId: TLAssetId | null\n}\n\n/** @public */\nexport type TLVideoShape = TLBaseShape<'video', TLVideoShapeProps>\n\n/** @public */\nexport const videoShapeProps: RecordProps<TLVideoShape> = {\n\tw: T.nonZeroNumber,\n\th: T.nonZeroNumber,\n\ttime: T.number,\n\tplaying: T.boolean,\n\turl: T.linkUrl,\n\tassetId: assetIdValidator.nullable(),\n}\n\nconst Versions = createShapePropsMigrationIds('video', {\n\tAddUrlProp: 1,\n\tMakeUrlsValid: 2,\n})\n\nexport { Versions as videoShapeVersions }\n\n/** @public */\nexport const videoShapeMigrations = 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.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],\n})\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAkB;AAClB,yBAAiC;AAEjC,qBAAgF;
|
|
4
|
+
"sourcesContent": ["import { T } from '@tldraw/validate'\nimport { assetIdValidator } from '../assets/TLBaseAsset'\nimport { TLAssetId } from '../records/TLAsset'\nimport { createShapePropsMigrationIds, createShapePropsMigrationSequence } from '../records/TLShape'\nimport { RecordProps } from '../recordsWithProps'\nimport { TLBaseShape } from './TLBaseShape'\n\n/** @public */\nexport interface TLVideoShapeProps {\n\tw: number\n\th: number\n\ttime: number\n\tplaying: boolean\n\turl: string\n\tassetId: TLAssetId | null\n\taltText: string\n}\n\n/** @public */\nexport type TLVideoShape = TLBaseShape<'video', TLVideoShapeProps>\n\n/** @public */\nexport const videoShapeProps: RecordProps<TLVideoShape> = {\n\tw: T.nonZeroNumber,\n\th: T.nonZeroNumber,\n\ttime: T.number,\n\tplaying: T.boolean,\n\turl: T.linkUrl,\n\tassetId: assetIdValidator.nullable(),\n\taltText: T.string,\n}\n\nconst Versions = createShapePropsMigrationIds('video', {\n\tAddUrlProp: 1,\n\tMakeUrlsValid: 2,\n\tAddAltText: 3,\n})\n\nexport { Versions as videoShapeVersions }\n\n/** @public */\nexport const videoShapeMigrations = 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.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.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,sBAAkB;AAClB,yBAAiC;AAEjC,qBAAgF;AAmBzE,MAAM,kBAA6C;AAAA,EACzD,GAAG,kBAAE;AAAA,EACL,GAAG,kBAAE;AAAA,EACL,MAAM,kBAAE;AAAA,EACR,SAAS,kBAAE;AAAA,EACX,KAAK,kBAAE;AAAA,EACP,SAAS,oCAAiB,SAAS;AAAA,EACnC,SAAS,kBAAE;AACZ;AAEA,MAAM,eAAW,6CAA6B,SAAS;AAAA,EACtD,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,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,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,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
|
@@ -1224,6 +1224,7 @@ export declare interface TLImageShapeProps {
|
|
|
1224
1224
|
crop: null | TLShapeCrop;
|
|
1225
1225
|
flipX: boolean;
|
|
1226
1226
|
flipY: boolean;
|
|
1227
|
+
altText: string;
|
|
1227
1228
|
}
|
|
1228
1229
|
|
|
1229
1230
|
/**
|
|
@@ -1596,6 +1597,7 @@ export declare interface TLVideoShapeProps {
|
|
|
1596
1597
|
playing: boolean;
|
|
1597
1598
|
url: string;
|
|
1598
1599
|
assetId: null | TLAssetId;
|
|
1600
|
+
altText: string;
|
|
1599
1601
|
}
|
|
1600
1602
|
|
|
1601
1603
|
/** @public */
|
package/dist-esm/index.mjs
CHANGED
|
@@ -14,13 +14,15 @@ const imageShapeProps = {
|
|
|
14
14
|
assetId: assetIdValidator.nullable(),
|
|
15
15
|
crop: ImageShapeCrop.nullable(),
|
|
16
16
|
flipX: T.boolean,
|
|
17
|
-
flipY: T.boolean
|
|
17
|
+
flipY: T.boolean,
|
|
18
|
+
altText: T.string
|
|
18
19
|
};
|
|
19
20
|
const Versions = createShapePropsMigrationIds("image", {
|
|
20
21
|
AddUrlProp: 1,
|
|
21
22
|
AddCropProp: 2,
|
|
22
23
|
MakeUrlsValid: 3,
|
|
23
|
-
AddFlipProps: 4
|
|
24
|
+
AddFlipProps: 4,
|
|
25
|
+
AddAltText: 5
|
|
24
26
|
});
|
|
25
27
|
const imageShapeMigrations = createShapePropsMigrationSequence({
|
|
26
28
|
sequence: [
|
|
@@ -60,6 +62,15 @@ const imageShapeMigrations = createShapePropsMigrationSequence({
|
|
|
60
62
|
delete props.flipX;
|
|
61
63
|
delete props.flipY;
|
|
62
64
|
}
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: Versions.AddAltText,
|
|
68
|
+
up: (props) => {
|
|
69
|
+
props.altText = "";
|
|
70
|
+
},
|
|
71
|
+
down: (props) => {
|
|
72
|
+
delete props.altText;
|
|
73
|
+
}
|
|
63
74
|
}
|
|
64
75
|
]
|
|
65
76
|
});
|
|
@@ -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}\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}\n\nconst Versions = createShapePropsMigrationIds('image', {\n\tAddUrlProp: 1,\n\tAddCropProp: 2,\n\tMakeUrlsValid: 3,\n\tAddFlipProps: 4,\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],\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;AACd,CAAC;
|
|
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;AACd,CAAC;AAmBM,MAAM,kBAA6C;AAAA,EACzD,GAAG,EAAE;AAAA,EACL,GAAG,EAAE;AAAA,EACL,SAAS,EAAE;AAAA,EACX,KAAK,EAAE;AAAA,EACP,SAAS,iBAAiB,SAAS;AAAA,EACnC,MAAM,eAAe,SAAS;AAAA,EAC9B,OAAO,EAAE;AAAA,EACT,OAAO,EAAE;AAAA,EACT,SAAS,EAAE;AACZ;AAEA,MAAM,WAAW,6BAA6B,SAAS;AAAA,EACtD,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,eAAe;AAAA,EACf,cAAc;AAAA,EACd,YAAY;AACb,CAAC;AAKM,MAAM,uBAAuB,kCAAkC;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,EAAE,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
|
}
|
|
@@ -7,11 +7,13 @@ const videoShapeProps = {
|
|
|
7
7
|
time: T.number,
|
|
8
8
|
playing: T.boolean,
|
|
9
9
|
url: T.linkUrl,
|
|
10
|
-
assetId: assetIdValidator.nullable()
|
|
10
|
+
assetId: assetIdValidator.nullable(),
|
|
11
|
+
altText: T.string
|
|
11
12
|
};
|
|
12
13
|
const Versions = createShapePropsMigrationIds("video", {
|
|
13
14
|
AddUrlProp: 1,
|
|
14
|
-
MakeUrlsValid: 2
|
|
15
|
+
MakeUrlsValid: 2,
|
|
16
|
+
AddAltText: 3
|
|
15
17
|
});
|
|
16
18
|
const videoShapeMigrations = createShapePropsMigrationSequence({
|
|
17
19
|
sequence: [
|
|
@@ -31,6 +33,15 @@ const videoShapeMigrations = createShapePropsMigrationSequence({
|
|
|
31
33
|
},
|
|
32
34
|
down: (_props) => {
|
|
33
35
|
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: Versions.AddAltText,
|
|
39
|
+
up: (props) => {
|
|
40
|
+
props.altText = "";
|
|
41
|
+
},
|
|
42
|
+
down: (props) => {
|
|
43
|
+
delete props.altText;
|
|
44
|
+
}
|
|
34
45
|
}
|
|
35
46
|
]
|
|
36
47
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/shapes/TLVideoShape.ts"],
|
|
4
|
-
"sourcesContent": ["import { T } from '@tldraw/validate'\nimport { assetIdValidator } from '../assets/TLBaseAsset'\nimport { TLAssetId } from '../records/TLAsset'\nimport { createShapePropsMigrationIds, createShapePropsMigrationSequence } from '../records/TLShape'\nimport { RecordProps } from '../recordsWithProps'\nimport { TLBaseShape } from './TLBaseShape'\n\n/** @public */\nexport interface TLVideoShapeProps {\n\tw: number\n\th: number\n\ttime: number\n\tplaying: boolean\n\turl: string\n\tassetId: TLAssetId | null\n}\n\n/** @public */\nexport type TLVideoShape = TLBaseShape<'video', TLVideoShapeProps>\n\n/** @public */\nexport const videoShapeProps: RecordProps<TLVideoShape> = {\n\tw: T.nonZeroNumber,\n\th: T.nonZeroNumber,\n\ttime: T.number,\n\tplaying: T.boolean,\n\turl: T.linkUrl,\n\tassetId: assetIdValidator.nullable(),\n}\n\nconst Versions = createShapePropsMigrationIds('video', {\n\tAddUrlProp: 1,\n\tMakeUrlsValid: 2,\n})\n\nexport { Versions as videoShapeVersions }\n\n/** @public */\nexport const videoShapeMigrations = 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.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],\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,SAAS;AAClB,SAAS,wBAAwB;AAEjC,SAAS,8BAA8B,yCAAyC;
|
|
4
|
+
"sourcesContent": ["import { T } from '@tldraw/validate'\nimport { assetIdValidator } from '../assets/TLBaseAsset'\nimport { TLAssetId } from '../records/TLAsset'\nimport { createShapePropsMigrationIds, createShapePropsMigrationSequence } from '../records/TLShape'\nimport { RecordProps } from '../recordsWithProps'\nimport { TLBaseShape } from './TLBaseShape'\n\n/** @public */\nexport interface TLVideoShapeProps {\n\tw: number\n\th: number\n\ttime: number\n\tplaying: boolean\n\turl: string\n\tassetId: TLAssetId | null\n\taltText: string\n}\n\n/** @public */\nexport type TLVideoShape = TLBaseShape<'video', TLVideoShapeProps>\n\n/** @public */\nexport const videoShapeProps: RecordProps<TLVideoShape> = {\n\tw: T.nonZeroNumber,\n\th: T.nonZeroNumber,\n\ttime: T.number,\n\tplaying: T.boolean,\n\turl: T.linkUrl,\n\tassetId: assetIdValidator.nullable(),\n\taltText: T.string,\n}\n\nconst Versions = createShapePropsMigrationIds('video', {\n\tAddUrlProp: 1,\n\tMakeUrlsValid: 2,\n\tAddAltText: 3,\n})\n\nexport { Versions as videoShapeVersions }\n\n/** @public */\nexport const videoShapeMigrations = 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.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.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;AAEjC,SAAS,8BAA8B,yCAAyC;AAmBzE,MAAM,kBAA6C;AAAA,EACzD,GAAG,EAAE;AAAA,EACL,GAAG,EAAE;AAAA,EACL,MAAM,EAAE;AAAA,EACR,SAAS,EAAE;AAAA,EACX,KAAK,EAAE;AAAA,EACP,SAAS,iBAAiB,SAAS;AAAA,EACnC,SAAS,EAAE;AACZ;AAEA,MAAM,WAAW,6BAA6B,SAAS;AAAA,EACtD,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,YAAY;AACb,CAAC;AAKM,MAAM,uBAAuB,kCAAkC;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,YAAI,CAAC,EAAE,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,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/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.
|
|
4
|
+
"version": "3.13.0-canary.1793786aff8a",
|
|
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.
|
|
58
|
-
"@tldraw/store": "3.
|
|
59
|
-
"@tldraw/utils": "3.
|
|
60
|
-
"@tldraw/validate": "3.
|
|
57
|
+
"@tldraw/state": "3.13.0-canary.1793786aff8a",
|
|
58
|
+
"@tldraw/store": "3.13.0-canary.1793786aff8a",
|
|
59
|
+
"@tldraw/utils": "3.13.0-canary.1793786aff8a",
|
|
60
|
+
"@tldraw/validate": "3.13.0-canary.1793786aff8a"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"react": "^18.2.0 || ^19.0.0",
|
package/src/migrations.test.ts
CHANGED
|
@@ -2029,6 +2029,30 @@ describe('Add flipX, flipY to image shape', () => {
|
|
|
2029
2029
|
})
|
|
2030
2030
|
})
|
|
2031
2031
|
|
|
2032
|
+
describe('Add alt text to image shape', () => {
|
|
2033
|
+
const { up, down } = getTestMigration(imageShapeVersions.AddAltText)
|
|
2034
|
+
|
|
2035
|
+
test('up works as expected', () => {
|
|
2036
|
+
expect(up({ props: {} })).toEqual({ props: { altText: '' } })
|
|
2037
|
+
})
|
|
2038
|
+
|
|
2039
|
+
test('down works as expected', () => {
|
|
2040
|
+
expect(down({ props: { altText: 'yo' } })).toEqual({ props: {} })
|
|
2041
|
+
})
|
|
2042
|
+
})
|
|
2043
|
+
|
|
2044
|
+
describe('Add alt text to video shape', () => {
|
|
2045
|
+
const { up, down } = getTestMigration(videoShapeVersions.AddAltText)
|
|
2046
|
+
|
|
2047
|
+
test('up works as expected', () => {
|
|
2048
|
+
expect(up({ props: {} })).toEqual({ props: { altText: '' } })
|
|
2049
|
+
})
|
|
2050
|
+
|
|
2051
|
+
test('down works as expected', () => {
|
|
2052
|
+
expect(down({ props: { altText: 'yo' } })).toEqual({ props: {} })
|
|
2053
|
+
})
|
|
2054
|
+
})
|
|
2055
|
+
|
|
2032
2056
|
describe('Make video asset file size optional', () => {
|
|
2033
2057
|
const { up, down } = getTestMigration(videoAssetVersions.MakeFileSizeOptional)
|
|
2034
2058
|
|
|
@@ -23,6 +23,7 @@ export interface TLImageShapeProps {
|
|
|
23
23
|
crop: TLShapeCrop | null
|
|
24
24
|
flipX: boolean
|
|
25
25
|
flipY: boolean
|
|
26
|
+
altText: string
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
/** @public */
|
|
@@ -38,6 +39,7 @@ export const imageShapeProps: RecordProps<TLImageShape> = {
|
|
|
38
39
|
crop: ImageShapeCrop.nullable(),
|
|
39
40
|
flipX: T.boolean,
|
|
40
41
|
flipY: T.boolean,
|
|
42
|
+
altText: T.string,
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
const Versions = createShapePropsMigrationIds('image', {
|
|
@@ -45,6 +47,7 @@ const Versions = createShapePropsMigrationIds('image', {
|
|
|
45
47
|
AddCropProp: 2,
|
|
46
48
|
MakeUrlsValid: 3,
|
|
47
49
|
AddFlipProps: 4,
|
|
50
|
+
AddAltText: 5,
|
|
48
51
|
})
|
|
49
52
|
|
|
50
53
|
export { Versions as imageShapeVersions }
|
|
@@ -90,5 +93,14 @@ export const imageShapeMigrations = createShapePropsMigrationSequence({
|
|
|
90
93
|
delete props.flipY
|
|
91
94
|
},
|
|
92
95
|
},
|
|
96
|
+
{
|
|
97
|
+
id: Versions.AddAltText,
|
|
98
|
+
up: (props) => {
|
|
99
|
+
props.altText = ''
|
|
100
|
+
},
|
|
101
|
+
down: (props) => {
|
|
102
|
+
delete props.altText
|
|
103
|
+
},
|
|
104
|
+
},
|
|
93
105
|
],
|
|
94
106
|
})
|
|
@@ -13,6 +13,7 @@ export interface TLVideoShapeProps {
|
|
|
13
13
|
playing: boolean
|
|
14
14
|
url: string
|
|
15
15
|
assetId: TLAssetId | null
|
|
16
|
+
altText: string
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
/** @public */
|
|
@@ -26,11 +27,13 @@ export const videoShapeProps: RecordProps<TLVideoShape> = {
|
|
|
26
27
|
playing: T.boolean,
|
|
27
28
|
url: T.linkUrl,
|
|
28
29
|
assetId: assetIdValidator.nullable(),
|
|
30
|
+
altText: T.string,
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
const Versions = createShapePropsMigrationIds('video', {
|
|
32
34
|
AddUrlProp: 1,
|
|
33
35
|
MakeUrlsValid: 2,
|
|
36
|
+
AddAltText: 3,
|
|
34
37
|
})
|
|
35
38
|
|
|
36
39
|
export { Versions as videoShapeVersions }
|
|
@@ -56,5 +59,14 @@ export const videoShapeMigrations = createShapePropsMigrationSequence({
|
|
|
56
59
|
// noop
|
|
57
60
|
},
|
|
58
61
|
},
|
|
62
|
+
{
|
|
63
|
+
id: Versions.AddAltText,
|
|
64
|
+
up: (props) => {
|
|
65
|
+
props.altText = ''
|
|
66
|
+
},
|
|
67
|
+
down: (props) => {
|
|
68
|
+
delete props.altText
|
|
69
|
+
},
|
|
70
|
+
},
|
|
59
71
|
],
|
|
60
72
|
})
|