@bigbluebutton/tlschema 2.0.0-alpha.19
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/LICENSE +190 -0
- package/dist-cjs/TLStore.js +133 -0
- package/dist-cjs/TLStore.js.map +7 -0
- package/dist-cjs/assets/TLBaseAsset.js +37 -0
- package/dist-cjs/assets/TLBaseAsset.js.map +7 -0
- package/dist-cjs/assets/TLBookmarkAsset.js +38 -0
- package/dist-cjs/assets/TLBookmarkAsset.js.map +7 -0
- package/dist-cjs/assets/TLImageAsset.js +76 -0
- package/dist-cjs/assets/TLImageAsset.js.map +7 -0
- package/dist-cjs/assets/TLVideoAsset.js +76 -0
- package/dist-cjs/assets/TLVideoAsset.js.map +7 -0
- package/dist-cjs/createPresenceStateDerivation.js +68 -0
- package/dist-cjs/createPresenceStateDerivation.js.map +7 -0
- package/dist-cjs/createTLSchema.js +68 -0
- package/dist-cjs/createTLSchema.js.map +7 -0
- package/dist-cjs/index.d.ts +1414 -0
- package/dist-cjs/index.js +142 -0
- package/dist-cjs/index.js.map +7 -0
- package/dist-cjs/misc/TLColor.js +36 -0
- package/dist-cjs/misc/TLColor.js.map +7 -0
- package/dist-cjs/misc/TLCursor.js +55 -0
- package/dist-cjs/misc/TLCursor.js.map +7 -0
- package/dist-cjs/misc/TLHandle.js +36 -0
- package/dist-cjs/misc/TLHandle.js.map +7 -0
- package/dist-cjs/misc/TLOpacity.js +30 -0
- package/dist-cjs/misc/TLOpacity.js.map +7 -0
- package/dist-cjs/misc/TLScribble.js +40 -0
- package/dist-cjs/misc/TLScribble.js.map +7 -0
- package/dist-cjs/misc/geometry-types.js +37 -0
- package/dist-cjs/misc/geometry-types.js.map +7 -0
- package/dist-cjs/misc/id-validator.js +33 -0
- package/dist-cjs/misc/id-validator.js.map +7 -0
- package/dist-cjs/records/TLAsset.js +74 -0
- package/dist-cjs/records/TLAsset.js.map +7 -0
- package/dist-cjs/records/TLCamera.js +74 -0
- package/dist-cjs/records/TLCamera.js.map +7 -0
- package/dist-cjs/records/TLDocument.js +82 -0
- package/dist-cjs/records/TLDocument.js.map +7 -0
- package/dist-cjs/records/TLInstance.js +452 -0
- package/dist-cjs/records/TLInstance.js.map +7 -0
- package/dist-cjs/records/TLPage.js +74 -0
- package/dist-cjs/records/TLPage.js.map +7 -0
- package/dist-cjs/records/TLPageState.js +209 -0
- package/dist-cjs/records/TLPageState.js.map +7 -0
- package/dist-cjs/records/TLPointer.js +76 -0
- package/dist-cjs/records/TLPointer.js.map +7 -0
- package/dist-cjs/records/TLPresence.js +170 -0
- package/dist-cjs/records/TLPresence.js.map +7 -0
- package/dist-cjs/records/TLRecord.js +17 -0
- package/dist-cjs/records/TLRecord.js.map +7 -0
- package/dist-cjs/records/TLShape.js +147 -0
- package/dist-cjs/records/TLShape.js.map +7 -0
- package/dist-cjs/shapes/TLArrowShape.js +156 -0
- package/dist-cjs/shapes/TLArrowShape.js.map +7 -0
- package/dist-cjs/shapes/TLBaseShape.js +52 -0
- package/dist-cjs/shapes/TLBaseShape.js.map +7 -0
- package/dist-cjs/shapes/TLBookmarkShape.js +57 -0
- package/dist-cjs/shapes/TLBookmarkShape.js.map +7 -0
- package/dist-cjs/shapes/TLDrawShape.js +89 -0
- package/dist-cjs/shapes/TLDrawShape.js.map +7 -0
- package/dist-cjs/shapes/TLEmbedShape.js +709 -0
- package/dist-cjs/shapes/TLEmbedShape.js.map +7 -0
- package/dist-cjs/shapes/TLFrameShape.js +33 -0
- package/dist-cjs/shapes/TLFrameShape.js.map +7 -0
- package/dist-cjs/shapes/TLGeoShape.js +230 -0
- package/dist-cjs/shapes/TLGeoShape.js.map +7 -0
- package/dist-cjs/shapes/TLGroupShape.js +28 -0
- package/dist-cjs/shapes/TLGroupShape.js.map +7 -0
- package/dist-cjs/shapes/TLHighlightShape.js +38 -0
- package/dist-cjs/shapes/TLHighlightShape.js.map +7 -0
- package/dist-cjs/shapes/TLImageShape.js +69 -0
- package/dist-cjs/shapes/TLImageShape.js.map +7 -0
- package/dist-cjs/shapes/TLLineShape.js +70 -0
- package/dist-cjs/shapes/TLLineShape.js.map +7 -0
- package/dist-cjs/shapes/TLNoteShape.js +144 -0
- package/dist-cjs/shapes/TLNoteShape.js.map +7 -0
- package/dist-cjs/shapes/TLTextShape.js +67 -0
- package/dist-cjs/shapes/TLTextShape.js.map +7 -0
- package/dist-cjs/shapes/TLVideoShape.js +53 -0
- package/dist-cjs/shapes/TLVideoShape.js.map +7 -0
- package/dist-cjs/store-migrations.js +81 -0
- package/dist-cjs/store-migrations.js.map +7 -0
- package/dist-cjs/styles/StyleProp.js +94 -0
- package/dist-cjs/styles/StyleProp.js.map +7 -0
- package/dist-cjs/styles/TLColorStyle.js +283 -0
- package/dist-cjs/styles/TLColorStyle.js.map +7 -0
- package/dist-cjs/styles/TLDashStyle.js +29 -0
- package/dist-cjs/styles/TLDashStyle.js.map +7 -0
- package/dist-cjs/styles/TLFillStyle.js +29 -0
- package/dist-cjs/styles/TLFillStyle.js.map +7 -0
- package/dist-cjs/styles/TLFontStyle.js +36 -0
- package/dist-cjs/styles/TLFontStyle.js.map +7 -0
- package/dist-cjs/styles/TLHorizontalAlignStyle.js +29 -0
- package/dist-cjs/styles/TLHorizontalAlignStyle.js.map +7 -0
- package/dist-cjs/styles/TLSizeStyle.js +29 -0
- package/dist-cjs/styles/TLSizeStyle.js.map +7 -0
- package/dist-cjs/styles/TLVerticalAlignStyle.js +29 -0
- package/dist-cjs/styles/TLVerticalAlignStyle.js.map +7 -0
- package/dist-cjs/translations/languages.js +59 -0
- package/dist-cjs/translations/languages.js.map +7 -0
- package/dist-cjs/translations/translations.js +63 -0
- package/dist-cjs/translations/translations.js.map +7 -0
- package/dist-cjs/util-types.js +17 -0
- package/dist-cjs/util-types.js.map +7 -0
- package/dist-esm/TLStore.mjs +113 -0
- package/dist-esm/TLStore.mjs.map +7 -0
- package/dist-esm/assets/TLBaseAsset.mjs +17 -0
- package/dist-esm/assets/TLBaseAsset.mjs.map +7 -0
- package/dist-esm/assets/TLBookmarkAsset.mjs +18 -0
- package/dist-esm/assets/TLBookmarkAsset.mjs.map +7 -0
- package/dist-esm/assets/TLImageAsset.mjs +56 -0
- package/dist-esm/assets/TLImageAsset.mjs.map +7 -0
- package/dist-esm/assets/TLVideoAsset.mjs +56 -0
- package/dist-esm/assets/TLVideoAsset.mjs.map +7 -0
- package/dist-esm/createPresenceStateDerivation.mjs +48 -0
- package/dist-esm/createPresenceStateDerivation.mjs.map +7 -0
- package/dist-esm/createTLSchema.mjs +48 -0
- package/dist-esm/createTLSchema.mjs.map +7 -0
- package/dist-esm/index.d.mts +1414 -0
- package/dist-esm/index.mjs +193 -0
- package/dist-esm/index.mjs.map +7 -0
- package/dist-esm/misc/TLColor.mjs +16 -0
- package/dist-esm/misc/TLColor.mjs.map +7 -0
- package/dist-esm/misc/TLCursor.mjs +35 -0
- package/dist-esm/misc/TLCursor.mjs.map +7 -0
- package/dist-esm/misc/TLHandle.mjs +16 -0
- package/dist-esm/misc/TLHandle.mjs.map +7 -0
- package/dist-esm/misc/TLOpacity.mjs +10 -0
- package/dist-esm/misc/TLOpacity.mjs.map +7 -0
- package/dist-esm/misc/TLScribble.mjs +20 -0
- package/dist-esm/misc/TLScribble.mjs.map +7 -0
- package/dist-esm/misc/geometry-types.mjs +17 -0
- package/dist-esm/misc/geometry-types.mjs.map +7 -0
- package/dist-esm/misc/id-validator.mjs +13 -0
- package/dist-esm/misc/id-validator.mjs.map +7 -0
- package/dist-esm/records/TLAsset.mjs +57 -0
- package/dist-esm/records/TLAsset.mjs.map +7 -0
- package/dist-esm/records/TLCamera.mjs +54 -0
- package/dist-esm/records/TLCamera.mjs.map +7 -0
- package/dist-esm/records/TLDocument.mjs +62 -0
- package/dist-esm/records/TLDocument.mjs.map +7 -0
- package/dist-esm/records/TLInstance.mjs +432 -0
- package/dist-esm/records/TLInstance.mjs.map +7 -0
- package/dist-esm/records/TLPage.mjs +54 -0
- package/dist-esm/records/TLPage.mjs.map +7 -0
- package/dist-esm/records/TLPageState.mjs +189 -0
- package/dist-esm/records/TLPageState.mjs.map +7 -0
- package/dist-esm/records/TLPointer.mjs +56 -0
- package/dist-esm/records/TLPointer.mjs.map +7 -0
- package/dist-esm/records/TLPresence.mjs +150 -0
- package/dist-esm/records/TLPresence.mjs.map +7 -0
- package/dist-esm/records/TLRecord.mjs +1 -0
- package/dist-esm/records/TLRecord.mjs.map +7 -0
- package/dist-esm/records/TLShape.mjs +127 -0
- package/dist-esm/records/TLShape.mjs.map +7 -0
- package/dist-esm/shapes/TLArrowShape.mjs +136 -0
- package/dist-esm/shapes/TLArrowShape.mjs.map +7 -0
- package/dist-esm/shapes/TLBaseShape.mjs +32 -0
- package/dist-esm/shapes/TLBaseShape.mjs.map +7 -0
- package/dist-esm/shapes/TLBookmarkShape.mjs +37 -0
- package/dist-esm/shapes/TLBookmarkShape.mjs.map +7 -0
- package/dist-esm/shapes/TLDrawShape.mjs +69 -0
- package/dist-esm/shapes/TLDrawShape.mjs.map +7 -0
- package/dist-esm/shapes/TLEmbedShape.mjs +689 -0
- package/dist-esm/shapes/TLEmbedShape.mjs.map +7 -0
- package/dist-esm/shapes/TLFrameShape.mjs +13 -0
- package/dist-esm/shapes/TLFrameShape.mjs.map +7 -0
- package/dist-esm/shapes/TLGeoShape.mjs +212 -0
- package/dist-esm/shapes/TLGeoShape.mjs.map +7 -0
- package/dist-esm/shapes/TLGroupShape.mjs +8 -0
- package/dist-esm/shapes/TLGroupShape.mjs.map +7 -0
- package/dist-esm/shapes/TLHighlightShape.mjs +18 -0
- package/dist-esm/shapes/TLHighlightShape.mjs.map +7 -0
- package/dist-esm/shapes/TLImageShape.mjs +49 -0
- package/dist-esm/shapes/TLImageShape.mjs.map +7 -0
- package/dist-esm/shapes/TLLineShape.mjs +50 -0
- package/dist-esm/shapes/TLLineShape.mjs.map +7 -0
- package/dist-esm/shapes/TLNoteShape.mjs +126 -0
- package/dist-esm/shapes/TLNoteShape.mjs.map +7 -0
- package/dist-esm/shapes/TLTextShape.mjs +47 -0
- package/dist-esm/shapes/TLTextShape.mjs.map +7 -0
- package/dist-esm/shapes/TLVideoShape.mjs +33 -0
- package/dist-esm/shapes/TLVideoShape.mjs.map +7 -0
- package/dist-esm/store-migrations.mjs +61 -0
- package/dist-esm/store-migrations.mjs.map +7 -0
- package/dist-esm/styles/StyleProp.mjs +74 -0
- package/dist-esm/styles/StyleProp.mjs.map +7 -0
- package/dist-esm/styles/TLColorStyle.mjs +263 -0
- package/dist-esm/styles/TLColorStyle.mjs.map +7 -0
- package/dist-esm/styles/TLDashStyle.mjs +9 -0
- package/dist-esm/styles/TLDashStyle.mjs.map +7 -0
- package/dist-esm/styles/TLFillStyle.mjs +9 -0
- package/dist-esm/styles/TLFillStyle.mjs.map +7 -0
- package/dist-esm/styles/TLFontStyle.mjs +16 -0
- package/dist-esm/styles/TLFontStyle.mjs.map +7 -0
- package/dist-esm/styles/TLHorizontalAlignStyle.mjs +9 -0
- package/dist-esm/styles/TLHorizontalAlignStyle.mjs.map +7 -0
- package/dist-esm/styles/TLSizeStyle.mjs +9 -0
- package/dist-esm/styles/TLSizeStyle.mjs.map +7 -0
- package/dist-esm/styles/TLVerticalAlignStyle.mjs +9 -0
- package/dist-esm/styles/TLVerticalAlignStyle.mjs.map +7 -0
- package/dist-esm/translations/languages.mjs +39 -0
- package/dist-esm/translations/languages.mjs.map +7 -0
- package/dist-esm/translations/translations.mjs +43 -0
- package/dist-esm/translations/translations.mjs.map +7 -0
- package/dist-esm/util-types.mjs +1 -0
- package/dist-esm/util-types.mjs.map +7 -0
- package/package.json +64 -0
- package/src/TLStore.ts +160 -0
- package/src/assets/TLBaseAsset.ts +44 -0
- package/src/assets/TLBookmarkAsset.ts +31 -0
- package/src/assets/TLImageAsset.ts +73 -0
- package/src/assets/TLVideoAsset.ts +73 -0
- package/src/createPresenceStateDerivation.ts +53 -0
- package/src/createTLSchema.ts +65 -0
- package/src/index.ts +168 -0
- package/src/migrations.test.ts +1768 -0
- package/src/misc/TLColor.ts +28 -0
- package/src/misc/TLCursor.ts +54 -0
- package/src/misc/TLHandle.ts +41 -0
- package/src/misc/TLOpacity.ts +11 -0
- package/src/misc/TLScribble.ts +39 -0
- package/src/misc/geometry-types.ts +37 -0
- package/src/misc/id-validator.ts +14 -0
- package/src/records/TLAsset.ts +80 -0
- package/src/records/TLCamera.ts +74 -0
- package/src/records/TLDocument.ts +77 -0
- package/src/records/TLInstance.ts +493 -0
- package/src/records/TLPage.ts +72 -0
- package/src/records/TLPageState.ts +216 -0
- package/src/records/TLPointer.ts +74 -0
- package/src/records/TLPresence.ts +179 -0
- package/src/records/TLRecord.ts +21 -0
- package/src/records/TLShape.ts +214 -0
- package/src/shapes/TLArrowShape.ts +160 -0
- package/src/shapes/TLBaseShape.ts +67 -0
- package/src/shapes/TLBookmarkShape.ts +44 -0
- package/src/shapes/TLDrawShape.ts +89 -0
- package/src/shapes/TLEmbedShape.ts +754 -0
- package/src/shapes/TLFrameShape.ts +18 -0
- package/src/shapes/TLGeoShape.ts +226 -0
- package/src/shapes/TLGroupShape.ts +14 -0
- package/src/shapes/TLHighlightShape.ts +24 -0
- package/src/shapes/TLImageShape.ts +59 -0
- package/src/shapes/TLLineShape.ts +61 -0
- package/src/shapes/TLNoteShape.ts +137 -0
- package/src/shapes/TLTextShape.ts +55 -0
- package/src/shapes/TLVideoShape.ts +40 -0
- package/src/store-migrations.ts +63 -0
- package/src/styles/StyleProp.ts +105 -0
- package/src/styles/TLColorStyle.ts +296 -0
- package/src/styles/TLDashStyle.ts +11 -0
- package/src/styles/TLFillStyle.ts +11 -0
- package/src/styles/TLFontStyle.ts +19 -0
- package/src/styles/TLHorizontalAlignStyle.ts +11 -0
- package/src/styles/TLSizeStyle.ts +11 -0
- package/src/styles/TLVerticalAlignStyle.ts +11 -0
- package/src/translations/languages.ts +39 -0
- package/src/translations/translations.test.ts +43 -0
- package/src/translations/translations.ts +73 -0
- package/src/util-types.ts +2 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineMigrations } from '@bigbluebutton/store'
|
|
2
|
+
import { T } from '@bigbluebutton/validate'
|
|
3
|
+
import { ShapePropsType, TLBaseShape } from './TLBaseShape'
|
|
4
|
+
|
|
5
|
+
/** @public */
|
|
6
|
+
export const frameShapeProps = {
|
|
7
|
+
w: T.nonZeroNumber,
|
|
8
|
+
h: T.nonZeroNumber,
|
|
9
|
+
name: T.string,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
type TLFrameShapeProps = ShapePropsType<typeof frameShapeProps>
|
|
13
|
+
|
|
14
|
+
/** @public */
|
|
15
|
+
export type TLFrameShape = TLBaseShape<'frame', TLFrameShapeProps>
|
|
16
|
+
|
|
17
|
+
/** @internal */
|
|
18
|
+
export const frameShapeMigrations = defineMigrations({})
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { defineMigrations } from '@bigbluebutton/store'
|
|
2
|
+
import { T } from '@bigbluebutton/validate'
|
|
3
|
+
import { StyleProp } from '../styles/StyleProp'
|
|
4
|
+
import { DefaultColorStyle, DefaultLabelColorStyle } from '../styles/TLColorStyle'
|
|
5
|
+
import { DefaultDashStyle } from '../styles/TLDashStyle'
|
|
6
|
+
import { DefaultFillStyle } from '../styles/TLFillStyle'
|
|
7
|
+
import { DefaultFontStyle } from '../styles/TLFontStyle'
|
|
8
|
+
import {
|
|
9
|
+
DefaultHorizontalAlignStyle,
|
|
10
|
+
TLDefaultHorizontalAlignStyle,
|
|
11
|
+
} from '../styles/TLHorizontalAlignStyle'
|
|
12
|
+
import { DefaultSizeStyle } from '../styles/TLSizeStyle'
|
|
13
|
+
import { DefaultVerticalAlignStyle } from '../styles/TLVerticalAlignStyle'
|
|
14
|
+
import { ShapePropsType, TLBaseShape } from './TLBaseShape'
|
|
15
|
+
|
|
16
|
+
/** @public */
|
|
17
|
+
export const GeoShapeGeoStyle = StyleProp.defineEnum('tldraw:geo', {
|
|
18
|
+
defaultValue: 'rectangle',
|
|
19
|
+
values: [
|
|
20
|
+
'cloud',
|
|
21
|
+
'rectangle',
|
|
22
|
+
'ellipse',
|
|
23
|
+
'triangle',
|
|
24
|
+
'diamond',
|
|
25
|
+
'pentagon',
|
|
26
|
+
'hexagon',
|
|
27
|
+
'octagon',
|
|
28
|
+
'star',
|
|
29
|
+
'rhombus',
|
|
30
|
+
'rhombus-2',
|
|
31
|
+
'oval',
|
|
32
|
+
'trapezoid',
|
|
33
|
+
'arrow-right',
|
|
34
|
+
'arrow-left',
|
|
35
|
+
'arrow-up',
|
|
36
|
+
'arrow-down',
|
|
37
|
+
'x-box',
|
|
38
|
+
'check-box',
|
|
39
|
+
],
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
/** @public */
|
|
43
|
+
export type TLGeoShapeGeoStyle = T.TypeOf<typeof GeoShapeGeoStyle>
|
|
44
|
+
|
|
45
|
+
/** @public */
|
|
46
|
+
export const geoShapeProps = {
|
|
47
|
+
geo: GeoShapeGeoStyle,
|
|
48
|
+
labelColor: DefaultLabelColorStyle,
|
|
49
|
+
color: DefaultColorStyle,
|
|
50
|
+
fill: DefaultFillStyle,
|
|
51
|
+
dash: DefaultDashStyle,
|
|
52
|
+
size: DefaultSizeStyle,
|
|
53
|
+
font: DefaultFontStyle,
|
|
54
|
+
align: DefaultHorizontalAlignStyle,
|
|
55
|
+
verticalAlign: DefaultVerticalAlignStyle,
|
|
56
|
+
url: T.string,
|
|
57
|
+
w: T.nonZeroNumber,
|
|
58
|
+
h: T.nonZeroNumber,
|
|
59
|
+
growY: T.positiveNumber,
|
|
60
|
+
text: T.string,
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** @public */
|
|
64
|
+
export type TLGeoShapeProps = ShapePropsType<typeof geoShapeProps>
|
|
65
|
+
|
|
66
|
+
/** @public */
|
|
67
|
+
export type TLGeoShape = TLBaseShape<'geo', TLGeoShapeProps>
|
|
68
|
+
|
|
69
|
+
const Versions = {
|
|
70
|
+
AddUrlProp: 1,
|
|
71
|
+
AddLabelColor: 2,
|
|
72
|
+
RemoveJustify: 3,
|
|
73
|
+
AddCheckBox: 4,
|
|
74
|
+
AddVerticalAlign: 5,
|
|
75
|
+
MigrateLegacyAlign: 6,
|
|
76
|
+
AddCloud: 7,
|
|
77
|
+
} as const
|
|
78
|
+
|
|
79
|
+
export { Versions as GeoShapeVersions }
|
|
80
|
+
|
|
81
|
+
/** @internal */
|
|
82
|
+
export const geoShapeMigrations = defineMigrations({
|
|
83
|
+
currentVersion: Versions.AddCloud,
|
|
84
|
+
migrators: {
|
|
85
|
+
[Versions.AddUrlProp]: {
|
|
86
|
+
up: (shape) => {
|
|
87
|
+
return { ...shape, props: { ...shape.props, url: '' } }
|
|
88
|
+
},
|
|
89
|
+
down: (shape) => {
|
|
90
|
+
const { url: _, ...props } = shape.props
|
|
91
|
+
return { ...shape, props }
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
[Versions.AddLabelColor]: {
|
|
95
|
+
up: (record) => {
|
|
96
|
+
return {
|
|
97
|
+
...record,
|
|
98
|
+
props: {
|
|
99
|
+
...record.props,
|
|
100
|
+
labelColor: 'black',
|
|
101
|
+
},
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
down: (record) => {
|
|
105
|
+
const { labelColor: _, ...props } = record.props
|
|
106
|
+
return {
|
|
107
|
+
...record,
|
|
108
|
+
props,
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
[Versions.RemoveJustify]: {
|
|
113
|
+
up: (shape) => {
|
|
114
|
+
let newAlign = shape.props.align
|
|
115
|
+
if (newAlign === 'justify') {
|
|
116
|
+
newAlign = 'start'
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return {
|
|
120
|
+
...shape,
|
|
121
|
+
props: {
|
|
122
|
+
...shape.props,
|
|
123
|
+
align: newAlign,
|
|
124
|
+
},
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
down: (shape) => {
|
|
128
|
+
return { ...shape }
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
[Versions.AddCheckBox]: {
|
|
132
|
+
up: (shape) => {
|
|
133
|
+
return { ...shape }
|
|
134
|
+
},
|
|
135
|
+
down: (shape) => {
|
|
136
|
+
return {
|
|
137
|
+
...shape,
|
|
138
|
+
props: {
|
|
139
|
+
...shape.props,
|
|
140
|
+
geo: shape.props.geo === 'check-box' ? 'rectangle' : shape.props.geo,
|
|
141
|
+
},
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
[Versions.AddVerticalAlign]: {
|
|
146
|
+
up: (shape) => {
|
|
147
|
+
return {
|
|
148
|
+
...shape,
|
|
149
|
+
props: {
|
|
150
|
+
...shape.props,
|
|
151
|
+
verticalAlign: 'middle',
|
|
152
|
+
},
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
down: (shape) => {
|
|
156
|
+
const { verticalAlign: _, ...props } = shape.props
|
|
157
|
+
return {
|
|
158
|
+
...shape,
|
|
159
|
+
props,
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
[Versions.MigrateLegacyAlign]: {
|
|
164
|
+
up: (shape) => {
|
|
165
|
+
let newAlign: TLDefaultHorizontalAlignStyle
|
|
166
|
+
switch (shape.props.align) {
|
|
167
|
+
case 'start':
|
|
168
|
+
newAlign = 'start-legacy'
|
|
169
|
+
break
|
|
170
|
+
case 'end':
|
|
171
|
+
newAlign = 'end-legacy'
|
|
172
|
+
break
|
|
173
|
+
default:
|
|
174
|
+
newAlign = 'middle-legacy'
|
|
175
|
+
break
|
|
176
|
+
}
|
|
177
|
+
return {
|
|
178
|
+
...shape,
|
|
179
|
+
props: {
|
|
180
|
+
...shape.props,
|
|
181
|
+
align: newAlign,
|
|
182
|
+
},
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
down: (shape) => {
|
|
186
|
+
let oldAlign: TLDefaultHorizontalAlignStyle
|
|
187
|
+
switch (shape.props.align) {
|
|
188
|
+
case 'start-legacy':
|
|
189
|
+
oldAlign = 'start'
|
|
190
|
+
break
|
|
191
|
+
case 'end-legacy':
|
|
192
|
+
oldAlign = 'end'
|
|
193
|
+
break
|
|
194
|
+
case 'middle-legacy':
|
|
195
|
+
oldAlign = 'middle'
|
|
196
|
+
break
|
|
197
|
+
default:
|
|
198
|
+
oldAlign = shape.props.align
|
|
199
|
+
}
|
|
200
|
+
return {
|
|
201
|
+
...shape,
|
|
202
|
+
props: {
|
|
203
|
+
...shape.props,
|
|
204
|
+
align: oldAlign,
|
|
205
|
+
},
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
[Versions.AddCloud]: {
|
|
210
|
+
up: (shape) => {
|
|
211
|
+
return shape
|
|
212
|
+
},
|
|
213
|
+
down: (shape) => {
|
|
214
|
+
if (shape.props.geo === 'cloud') {
|
|
215
|
+
return {
|
|
216
|
+
...shape,
|
|
217
|
+
props: {
|
|
218
|
+
...shape.props,
|
|
219
|
+
geo: 'rectangle',
|
|
220
|
+
},
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineMigrations } from '@bigbluebutton/store'
|
|
2
|
+
import { ShapeProps, TLBaseShape } from './TLBaseShape'
|
|
3
|
+
|
|
4
|
+
/** @public */
|
|
5
|
+
export type TLGroupShapeProps = { [key in never]: undefined }
|
|
6
|
+
|
|
7
|
+
/** @public */
|
|
8
|
+
export type TLGroupShape = TLBaseShape<'group', TLGroupShapeProps>
|
|
9
|
+
|
|
10
|
+
/** @internal */
|
|
11
|
+
export const groupShapeProps: ShapeProps<TLGroupShape> = {}
|
|
12
|
+
|
|
13
|
+
/** @internal */
|
|
14
|
+
export const groupShapeMigrations = defineMigrations({})
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { defineMigrations } from '@bigbluebutton/store'
|
|
2
|
+
import { T } from '@bigbluebutton/validate'
|
|
3
|
+
import { DefaultColorStyle } from '../styles/TLColorStyle'
|
|
4
|
+
import { DefaultSizeStyle } from '../styles/TLSizeStyle'
|
|
5
|
+
import { ShapePropsType, TLBaseShape } from './TLBaseShape'
|
|
6
|
+
import { DrawShapeSegment } from './TLDrawShape'
|
|
7
|
+
|
|
8
|
+
/** @public */
|
|
9
|
+
export const highlightShapeProps = {
|
|
10
|
+
color: DefaultColorStyle,
|
|
11
|
+
size: DefaultSizeStyle,
|
|
12
|
+
segments: T.arrayOf(DrawShapeSegment),
|
|
13
|
+
isComplete: T.boolean,
|
|
14
|
+
isPen: T.boolean,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** @public */
|
|
18
|
+
export type TLHighlightShapeProps = ShapePropsType<typeof highlightShapeProps>
|
|
19
|
+
|
|
20
|
+
/** @public */
|
|
21
|
+
export type TLHighlightShape = TLBaseShape<'highlight', TLHighlightShapeProps>
|
|
22
|
+
|
|
23
|
+
/** @internal */
|
|
24
|
+
export const highlightShapeMigrations = defineMigrations({})
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { defineMigrations } from '@bigbluebutton/store'
|
|
2
|
+
import { T } from '@bigbluebutton/validate'
|
|
3
|
+
import { assetIdValidator } from '../assets/TLBaseAsset'
|
|
4
|
+
import { vec2dModelValidator } from '../misc/geometry-types'
|
|
5
|
+
import { ShapePropsType, TLBaseShape } from './TLBaseShape'
|
|
6
|
+
|
|
7
|
+
/** @public */
|
|
8
|
+
export const ImageShapeCrop = T.object({
|
|
9
|
+
topLeft: vec2dModelValidator,
|
|
10
|
+
bottomRight: vec2dModelValidator,
|
|
11
|
+
})
|
|
12
|
+
/** @public */
|
|
13
|
+
export type TLImageShapeCrop = T.TypeOf<typeof ImageShapeCrop>
|
|
14
|
+
|
|
15
|
+
/** @public */
|
|
16
|
+
export const imageShapeProps = {
|
|
17
|
+
w: T.nonZeroNumber,
|
|
18
|
+
h: T.nonZeroNumber,
|
|
19
|
+
playing: T.boolean,
|
|
20
|
+
url: T.string,
|
|
21
|
+
assetId: assetIdValidator.nullable(),
|
|
22
|
+
crop: ImageShapeCrop.nullable(),
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** @public */
|
|
26
|
+
export type TLImageShapeProps = ShapePropsType<typeof imageShapeProps>
|
|
27
|
+
|
|
28
|
+
/** @public */
|
|
29
|
+
export type TLImageShape = TLBaseShape<'image', TLImageShapeProps>
|
|
30
|
+
|
|
31
|
+
const Versions = {
|
|
32
|
+
AddUrlProp: 1,
|
|
33
|
+
AddCropProp: 2,
|
|
34
|
+
} as const
|
|
35
|
+
|
|
36
|
+
/** @internal */
|
|
37
|
+
export const imageShapeMigrations = defineMigrations({
|
|
38
|
+
currentVersion: Versions.AddCropProp,
|
|
39
|
+
migrators: {
|
|
40
|
+
[Versions.AddUrlProp]: {
|
|
41
|
+
up: (shape) => {
|
|
42
|
+
return { ...shape, props: { ...shape.props, url: '' } }
|
|
43
|
+
},
|
|
44
|
+
down: (shape) => {
|
|
45
|
+
const { url: _, ...props } = shape.props
|
|
46
|
+
return { ...shape, props }
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
[Versions.AddCropProp]: {
|
|
50
|
+
up: (shape) => {
|
|
51
|
+
return { ...shape, props: { ...shape.props, crop: null } }
|
|
52
|
+
},
|
|
53
|
+
down: (shape) => {
|
|
54
|
+
const { crop: _, ...props } = shape.props
|
|
55
|
+
return { ...shape, props }
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
})
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { defineMigrations } from '@bigbluebutton/store'
|
|
2
|
+
import { deepCopy } from '@bigbluebutton/utils'
|
|
3
|
+
import { T } from '@bigbluebutton/validate'
|
|
4
|
+
import { handleValidator } from '../misc/TLHandle'
|
|
5
|
+
import { StyleProp } from '../styles/StyleProp'
|
|
6
|
+
import { DefaultColorStyle } from '../styles/TLColorStyle'
|
|
7
|
+
import { DefaultDashStyle } from '../styles/TLDashStyle'
|
|
8
|
+
import { DefaultSizeStyle } from '../styles/TLSizeStyle'
|
|
9
|
+
import { ShapePropsType, TLBaseShape } from './TLBaseShape'
|
|
10
|
+
|
|
11
|
+
/** @public */
|
|
12
|
+
export const LineShapeSplineStyle = StyleProp.defineEnum('tldraw:spline', {
|
|
13
|
+
defaultValue: 'line',
|
|
14
|
+
values: ['cubic', 'line'],
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
/** @public */
|
|
18
|
+
export type TLLineShapeSplineStyle = T.TypeOf<typeof LineShapeSplineStyle>
|
|
19
|
+
|
|
20
|
+
/** @public */
|
|
21
|
+
export const lineShapeProps = {
|
|
22
|
+
color: DefaultColorStyle,
|
|
23
|
+
dash: DefaultDashStyle,
|
|
24
|
+
size: DefaultSizeStyle,
|
|
25
|
+
spline: LineShapeSplineStyle,
|
|
26
|
+
handles: T.dict(T.string, handleValidator),
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** @public */
|
|
30
|
+
export type TLLineShapeProps = ShapePropsType<typeof lineShapeProps>
|
|
31
|
+
|
|
32
|
+
/** @public */
|
|
33
|
+
export type TLLineShape = TLBaseShape<'line', TLLineShapeProps>
|
|
34
|
+
|
|
35
|
+
/** @internal */
|
|
36
|
+
export const lineShapeVersions = {
|
|
37
|
+
AddSnapHandles: 1,
|
|
38
|
+
} as const
|
|
39
|
+
|
|
40
|
+
/** @internal */
|
|
41
|
+
export const lineShapeMigrations = defineMigrations({
|
|
42
|
+
currentVersion: lineShapeVersions.AddSnapHandles,
|
|
43
|
+
migrators: {
|
|
44
|
+
[lineShapeVersions.AddSnapHandles]: {
|
|
45
|
+
up: (record: any) => {
|
|
46
|
+
const handles = deepCopy(record.props.handles as Record<string, any>)
|
|
47
|
+
for (const id in handles) {
|
|
48
|
+
handles[id].canSnap = true
|
|
49
|
+
}
|
|
50
|
+
return { ...record, props: { ...record.props, handles } }
|
|
51
|
+
},
|
|
52
|
+
down: (record: any) => {
|
|
53
|
+
const handles = deepCopy(record.props.handles as Record<string, any>)
|
|
54
|
+
for (const id in handles) {
|
|
55
|
+
delete handles[id].canSnap
|
|
56
|
+
}
|
|
57
|
+
return { ...record, props: { ...record.props, handles } }
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
})
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { defineMigrations } from '@bigbluebutton/store'
|
|
2
|
+
import { T } from '@bigbluebutton/validate'
|
|
3
|
+
import { DefaultColorStyle } from '../styles/TLColorStyle'
|
|
4
|
+
import { DefaultFontStyle } from '../styles/TLFontStyle'
|
|
5
|
+
import {
|
|
6
|
+
DefaultHorizontalAlignStyle,
|
|
7
|
+
TLDefaultHorizontalAlignStyle,
|
|
8
|
+
} from '../styles/TLHorizontalAlignStyle'
|
|
9
|
+
import { DefaultSizeStyle } from '../styles/TLSizeStyle'
|
|
10
|
+
import { DefaultVerticalAlignStyle } from '../styles/TLVerticalAlignStyle'
|
|
11
|
+
import { ShapePropsType, TLBaseShape } from './TLBaseShape'
|
|
12
|
+
|
|
13
|
+
/** @public */
|
|
14
|
+
export const noteShapeProps = {
|
|
15
|
+
color: DefaultColorStyle,
|
|
16
|
+
size: DefaultSizeStyle,
|
|
17
|
+
font: DefaultFontStyle,
|
|
18
|
+
align: DefaultHorizontalAlignStyle,
|
|
19
|
+
verticalAlign: DefaultVerticalAlignStyle,
|
|
20
|
+
growY: T.positiveNumber,
|
|
21
|
+
url: T.string,
|
|
22
|
+
text: T.string,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** @public */
|
|
26
|
+
export type TLNoteShapeProps = ShapePropsType<typeof noteShapeProps>
|
|
27
|
+
|
|
28
|
+
/** @public */
|
|
29
|
+
export type TLNoteShape = TLBaseShape<'note', TLNoteShapeProps>
|
|
30
|
+
|
|
31
|
+
const Versions = {
|
|
32
|
+
AddUrlProp: 1,
|
|
33
|
+
RemoveJustify: 2,
|
|
34
|
+
MigrateLegacyAlign: 3,
|
|
35
|
+
AddVerticalAlign: 4,
|
|
36
|
+
} as const
|
|
37
|
+
|
|
38
|
+
/** @internal */
|
|
39
|
+
export const noteShapeMigrations = defineMigrations({
|
|
40
|
+
currentVersion: Versions.AddVerticalAlign,
|
|
41
|
+
migrators: {
|
|
42
|
+
[Versions.AddUrlProp]: {
|
|
43
|
+
up: (shape) => {
|
|
44
|
+
return { ...shape, props: { ...shape.props, url: '' } }
|
|
45
|
+
},
|
|
46
|
+
down: (shape) => {
|
|
47
|
+
const { url: _, ...props } = shape.props
|
|
48
|
+
return { ...shape, props }
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
[Versions.RemoveJustify]: {
|
|
52
|
+
up: (shape) => {
|
|
53
|
+
let newAlign = shape.props.align
|
|
54
|
+
if (newAlign === 'justify') {
|
|
55
|
+
newAlign = 'start'
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
...shape,
|
|
60
|
+
props: {
|
|
61
|
+
...shape.props,
|
|
62
|
+
align: newAlign,
|
|
63
|
+
},
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
down: (shape) => {
|
|
67
|
+
return { ...shape }
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
[Versions.MigrateLegacyAlign]: {
|
|
72
|
+
up: (shape) => {
|
|
73
|
+
let newAlign: TLDefaultHorizontalAlignStyle
|
|
74
|
+
switch (shape.props.align) {
|
|
75
|
+
case 'start':
|
|
76
|
+
newAlign = 'start-legacy'
|
|
77
|
+
break
|
|
78
|
+
case 'end':
|
|
79
|
+
newAlign = 'end-legacy'
|
|
80
|
+
break
|
|
81
|
+
default:
|
|
82
|
+
newAlign = 'middle-legacy'
|
|
83
|
+
break
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
...shape,
|
|
87
|
+
props: {
|
|
88
|
+
...shape.props,
|
|
89
|
+
align: newAlign,
|
|
90
|
+
},
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
down: (shape) => {
|
|
94
|
+
let oldAlign: TLDefaultHorizontalAlignStyle
|
|
95
|
+
switch (shape.props.align) {
|
|
96
|
+
case 'start-legacy':
|
|
97
|
+
oldAlign = 'start'
|
|
98
|
+
break
|
|
99
|
+
case 'end-legacy':
|
|
100
|
+
oldAlign = 'end'
|
|
101
|
+
break
|
|
102
|
+
case 'middle-legacy':
|
|
103
|
+
oldAlign = 'middle'
|
|
104
|
+
break
|
|
105
|
+
default:
|
|
106
|
+
oldAlign = shape.props.align
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
...shape,
|
|
110
|
+
props: {
|
|
111
|
+
...shape.props,
|
|
112
|
+
align: oldAlign,
|
|
113
|
+
},
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
[Versions.AddVerticalAlign]: {
|
|
118
|
+
up: (shape) => {
|
|
119
|
+
return {
|
|
120
|
+
...shape,
|
|
121
|
+
props: {
|
|
122
|
+
...shape.props,
|
|
123
|
+
verticalAlign: 'middle',
|
|
124
|
+
},
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
down: (shape) => {
|
|
128
|
+
const { verticalAlign: _, ...props } = shape.props
|
|
129
|
+
|
|
130
|
+
return {
|
|
131
|
+
...shape,
|
|
132
|
+
props,
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
})
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { defineMigrations } from '@bigbluebutton/store'
|
|
2
|
+
import { T } from '@bigbluebutton/validate'
|
|
3
|
+
import { DefaultColorStyle } from '../styles/TLColorStyle'
|
|
4
|
+
import { DefaultFontStyle } from '../styles/TLFontStyle'
|
|
5
|
+
import { DefaultHorizontalAlignStyle } from '../styles/TLHorizontalAlignStyle'
|
|
6
|
+
import { DefaultSizeStyle } from '../styles/TLSizeStyle'
|
|
7
|
+
import { ShapePropsType, TLBaseShape } from './TLBaseShape'
|
|
8
|
+
|
|
9
|
+
/** @public */
|
|
10
|
+
export const textShapeProps = {
|
|
11
|
+
color: DefaultColorStyle,
|
|
12
|
+
size: DefaultSizeStyle,
|
|
13
|
+
font: DefaultFontStyle,
|
|
14
|
+
align: DefaultHorizontalAlignStyle,
|
|
15
|
+
w: T.nonZeroNumber,
|
|
16
|
+
text: T.string,
|
|
17
|
+
scale: T.nonZeroNumber,
|
|
18
|
+
autoSize: T.boolean,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** @public */
|
|
22
|
+
export type TLTextShapeProps = ShapePropsType<typeof textShapeProps>
|
|
23
|
+
|
|
24
|
+
/** @public */
|
|
25
|
+
export type TLTextShape = TLBaseShape<'text', TLTextShapeProps>
|
|
26
|
+
|
|
27
|
+
const Versions = {
|
|
28
|
+
RemoveJustify: 1,
|
|
29
|
+
} as const
|
|
30
|
+
|
|
31
|
+
/** @internal */
|
|
32
|
+
export const textShapeMigrations = defineMigrations({
|
|
33
|
+
currentVersion: Versions.RemoveJustify,
|
|
34
|
+
migrators: {
|
|
35
|
+
[Versions.RemoveJustify]: {
|
|
36
|
+
up: (shape) => {
|
|
37
|
+
let newAlign = shape.props.align
|
|
38
|
+
if (newAlign === 'justify') {
|
|
39
|
+
newAlign = 'start'
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
...shape,
|
|
44
|
+
props: {
|
|
45
|
+
...shape.props,
|
|
46
|
+
align: newAlign,
|
|
47
|
+
},
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
down: (shape) => {
|
|
51
|
+
return { ...shape }
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
})
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { defineMigrations } from '@bigbluebutton/store'
|
|
2
|
+
import { T } from '@bigbluebutton/validate'
|
|
3
|
+
import { assetIdValidator } from '../assets/TLBaseAsset'
|
|
4
|
+
import { ShapePropsType, TLBaseShape } from './TLBaseShape'
|
|
5
|
+
|
|
6
|
+
/** @public */
|
|
7
|
+
export const videoShapeProps = {
|
|
8
|
+
w: T.nonZeroNumber,
|
|
9
|
+
h: T.nonZeroNumber,
|
|
10
|
+
time: T.number,
|
|
11
|
+
playing: T.boolean,
|
|
12
|
+
url: T.string,
|
|
13
|
+
assetId: assetIdValidator.nullable(),
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** @public */
|
|
17
|
+
export type TLVideoShapeProps = ShapePropsType<typeof videoShapeProps>
|
|
18
|
+
|
|
19
|
+
/** @public */
|
|
20
|
+
export type TLVideoShape = TLBaseShape<'video', TLVideoShapeProps>
|
|
21
|
+
|
|
22
|
+
const Versions = {
|
|
23
|
+
AddUrlProp: 1,
|
|
24
|
+
} as const
|
|
25
|
+
|
|
26
|
+
/** @internal */
|
|
27
|
+
export const videoShapeMigrations = defineMigrations({
|
|
28
|
+
currentVersion: Versions.AddUrlProp,
|
|
29
|
+
migrators: {
|
|
30
|
+
[Versions.AddUrlProp]: {
|
|
31
|
+
up: (shape) => {
|
|
32
|
+
return { ...shape, props: { ...shape.props, url: '' } }
|
|
33
|
+
},
|
|
34
|
+
down: (shape) => {
|
|
35
|
+
const { url: _, ...props } = shape.props
|
|
36
|
+
return { ...shape, props }
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
})
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { defineMigrations, SerializedStore } from '@bigbluebutton/store'
|
|
2
|
+
import { TLRecord } from './records/TLRecord'
|
|
3
|
+
|
|
4
|
+
const Versions = {
|
|
5
|
+
RemoveCodeAndIconShapeTypes: 1,
|
|
6
|
+
AddInstancePresenceType: 2,
|
|
7
|
+
RemoveTLUserAndPresenceAndAddPointer: 3,
|
|
8
|
+
RemoveUserDocument: 4,
|
|
9
|
+
} as const
|
|
10
|
+
|
|
11
|
+
export { Versions as storeVersions }
|
|
12
|
+
|
|
13
|
+
/** @public */
|
|
14
|
+
export const storeMigrations = defineMigrations({
|
|
15
|
+
currentVersion: Versions.RemoveUserDocument,
|
|
16
|
+
migrators: {
|
|
17
|
+
[Versions.RemoveCodeAndIconShapeTypes]: {
|
|
18
|
+
up: (store: SerializedStore<TLRecord>) => {
|
|
19
|
+
return Object.fromEntries(
|
|
20
|
+
Object.entries(store).filter(
|
|
21
|
+
([_, v]) => v.typeName !== 'shape' || (v.type !== 'icon' && v.type !== 'code')
|
|
22
|
+
)
|
|
23
|
+
)
|
|
24
|
+
},
|
|
25
|
+
down: (store: SerializedStore<TLRecord>) => {
|
|
26
|
+
// noop
|
|
27
|
+
return store
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
[Versions.AddInstancePresenceType]: {
|
|
31
|
+
up: (store: SerializedStore<TLRecord>) => {
|
|
32
|
+
return store
|
|
33
|
+
},
|
|
34
|
+
down: (store: SerializedStore<TLRecord>) => {
|
|
35
|
+
return Object.fromEntries(
|
|
36
|
+
Object.entries(store).filter(([_, v]) => v.typeName !== 'instance_presence')
|
|
37
|
+
)
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
[Versions.RemoveTLUserAndPresenceAndAddPointer]: {
|
|
41
|
+
up: (store: SerializedStore<TLRecord>) => {
|
|
42
|
+
return Object.fromEntries(
|
|
43
|
+
Object.entries(store).filter(([_, v]) => !v.typeName.match(/^(user|user_presence)$/))
|
|
44
|
+
)
|
|
45
|
+
},
|
|
46
|
+
down: (store: SerializedStore<TLRecord>) => {
|
|
47
|
+
return Object.fromEntries(
|
|
48
|
+
Object.entries(store).filter(([_, v]) => v.typeName !== 'pointer')
|
|
49
|
+
)
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
[Versions.RemoveUserDocument]: {
|
|
53
|
+
up: (store: SerializedStore<TLRecord>) => {
|
|
54
|
+
return Object.fromEntries(
|
|
55
|
+
Object.entries(store).filter(([_, v]) => !v.typeName.match('user_document'))
|
|
56
|
+
)
|
|
57
|
+
},
|
|
58
|
+
down: (store: SerializedStore<TLRecord>) => {
|
|
59
|
+
return store
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
})
|