@tldraw/tlschema 4.1.0-canary.5b2a01989756 → 4.1.0-canary.62b1976714aa

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.
Files changed (212) hide show
  1. package/dist-cjs/TLStore.js +3 -10
  2. package/dist-cjs/TLStore.js.map +2 -2
  3. package/dist-cjs/assets/TLBaseAsset.js.map +2 -2
  4. package/dist-cjs/assets/TLBookmarkAsset.js.map +2 -2
  5. package/dist-cjs/assets/TLImageAsset.js.map +2 -2
  6. package/dist-cjs/assets/TLVideoAsset.js.map +2 -2
  7. package/dist-cjs/bindings/TLArrowBinding.js.map +2 -2
  8. package/dist-cjs/bindings/TLBaseBinding.js.map +2 -2
  9. package/dist-cjs/createPresenceStateDerivation.js.map +2 -2
  10. package/dist-cjs/createTLSchema.js.map +2 -2
  11. package/dist-cjs/index.d.ts +4416 -223
  12. package/dist-cjs/index.js +1 -1
  13. package/dist-cjs/index.js.map +2 -2
  14. package/dist-cjs/misc/TLColor.js.map +2 -2
  15. package/dist-cjs/misc/TLCursor.js.map +2 -2
  16. package/dist-cjs/misc/TLHandle.js.map +2 -2
  17. package/dist-cjs/misc/TLOpacity.js.map +2 -2
  18. package/dist-cjs/misc/TLRichText.js.map +2 -2
  19. package/dist-cjs/misc/TLScribble.js.map +2 -2
  20. package/dist-cjs/misc/geometry-types.js.map +2 -2
  21. package/dist-cjs/misc/id-validator.js.map +2 -2
  22. package/dist-cjs/records/TLAsset.js.map +2 -2
  23. package/dist-cjs/records/TLBinding.js.map +2 -2
  24. package/dist-cjs/records/TLCamera.js.map +2 -2
  25. package/dist-cjs/records/TLDocument.js.map +2 -2
  26. package/dist-cjs/records/TLInstance.js.map +2 -2
  27. package/dist-cjs/records/TLPage.js.map +2 -2
  28. package/dist-cjs/records/TLPageState.js.map +2 -2
  29. package/dist-cjs/records/TLPointer.js.map +2 -2
  30. package/dist-cjs/records/TLPresence.js.map +2 -2
  31. package/dist-cjs/records/TLRecord.js.map +1 -1
  32. package/dist-cjs/records/TLShape.js.map +2 -2
  33. package/dist-cjs/recordsWithProps.js.map +2 -2
  34. package/dist-cjs/shapes/ShapeWithCrop.js.map +1 -1
  35. package/dist-cjs/shapes/TLArrowShape.js.map +2 -2
  36. package/dist-cjs/shapes/TLBaseShape.js.map +2 -2
  37. package/dist-cjs/shapes/TLBookmarkShape.js.map +2 -2
  38. package/dist-cjs/shapes/TLDrawShape.js.map +2 -2
  39. package/dist-cjs/shapes/TLEmbedShape.js.map +2 -2
  40. package/dist-cjs/shapes/TLFrameShape.js.map +2 -2
  41. package/dist-cjs/shapes/TLGeoShape.js.map +2 -2
  42. package/dist-cjs/shapes/TLGroupShape.js.map +2 -2
  43. package/dist-cjs/shapes/TLHighlightShape.js.map +2 -2
  44. package/dist-cjs/shapes/TLImageShape.js.map +2 -2
  45. package/dist-cjs/shapes/TLLineShape.js.map +2 -2
  46. package/dist-cjs/shapes/TLNoteShape.js.map +2 -2
  47. package/dist-cjs/shapes/TLTextShape.js.map +2 -2
  48. package/dist-cjs/shapes/TLVideoShape.js.map +2 -2
  49. package/dist-cjs/store-migrations.js.map +2 -2
  50. package/dist-cjs/styles/TLColorStyle.js.map +2 -2
  51. package/dist-cjs/styles/TLDashStyle.js.map +2 -2
  52. package/dist-cjs/styles/TLFillStyle.js.map +2 -2
  53. package/dist-cjs/styles/TLFontStyle.js.map +2 -2
  54. package/dist-cjs/styles/TLHorizontalAlignStyle.js.map +2 -2
  55. package/dist-cjs/styles/TLSizeStyle.js.map +2 -2
  56. package/dist-cjs/styles/TLTextAlignStyle.js.map +2 -2
  57. package/dist-cjs/styles/TLVerticalAlignStyle.js.map +2 -2
  58. package/dist-cjs/translations/translations.js +1 -1
  59. package/dist-cjs/translations/translations.js.map +2 -2
  60. package/dist-cjs/util-types.js.map +1 -1
  61. package/dist-esm/TLStore.mjs +3 -10
  62. package/dist-esm/TLStore.mjs.map +2 -2
  63. package/dist-esm/assets/TLBaseAsset.mjs.map +2 -2
  64. package/dist-esm/assets/TLBookmarkAsset.mjs.map +2 -2
  65. package/dist-esm/assets/TLImageAsset.mjs.map +2 -2
  66. package/dist-esm/assets/TLVideoAsset.mjs.map +2 -2
  67. package/dist-esm/bindings/TLArrowBinding.mjs.map +2 -2
  68. package/dist-esm/bindings/TLBaseBinding.mjs.map +2 -2
  69. package/dist-esm/createPresenceStateDerivation.mjs.map +2 -2
  70. package/dist-esm/createTLSchema.mjs.map +2 -2
  71. package/dist-esm/index.d.mts +4416 -223
  72. package/dist-esm/index.mjs +1 -1
  73. package/dist-esm/index.mjs.map +2 -2
  74. package/dist-esm/misc/TLColor.mjs.map +2 -2
  75. package/dist-esm/misc/TLCursor.mjs.map +2 -2
  76. package/dist-esm/misc/TLHandle.mjs.map +2 -2
  77. package/dist-esm/misc/TLOpacity.mjs.map +2 -2
  78. package/dist-esm/misc/TLRichText.mjs.map +2 -2
  79. package/dist-esm/misc/TLScribble.mjs.map +2 -2
  80. package/dist-esm/misc/geometry-types.mjs.map +2 -2
  81. package/dist-esm/misc/id-validator.mjs.map +2 -2
  82. package/dist-esm/records/TLAsset.mjs.map +2 -2
  83. package/dist-esm/records/TLBinding.mjs.map +2 -2
  84. package/dist-esm/records/TLCamera.mjs.map +2 -2
  85. package/dist-esm/records/TLDocument.mjs.map +2 -2
  86. package/dist-esm/records/TLInstance.mjs.map +2 -2
  87. package/dist-esm/records/TLPage.mjs.map +2 -2
  88. package/dist-esm/records/TLPageState.mjs.map +2 -2
  89. package/dist-esm/records/TLPointer.mjs.map +2 -2
  90. package/dist-esm/records/TLPresence.mjs.map +2 -2
  91. package/dist-esm/records/TLShape.mjs.map +2 -2
  92. package/dist-esm/recordsWithProps.mjs.map +2 -2
  93. package/dist-esm/shapes/TLArrowShape.mjs.map +2 -2
  94. package/dist-esm/shapes/TLBaseShape.mjs.map +2 -2
  95. package/dist-esm/shapes/TLBookmarkShape.mjs.map +2 -2
  96. package/dist-esm/shapes/TLDrawShape.mjs.map +2 -2
  97. package/dist-esm/shapes/TLEmbedShape.mjs.map +2 -2
  98. package/dist-esm/shapes/TLFrameShape.mjs.map +2 -2
  99. package/dist-esm/shapes/TLGeoShape.mjs.map +2 -2
  100. package/dist-esm/shapes/TLGroupShape.mjs.map +2 -2
  101. package/dist-esm/shapes/TLHighlightShape.mjs.map +2 -2
  102. package/dist-esm/shapes/TLImageShape.mjs.map +2 -2
  103. package/dist-esm/shapes/TLLineShape.mjs.map +2 -2
  104. package/dist-esm/shapes/TLNoteShape.mjs.map +2 -2
  105. package/dist-esm/shapes/TLTextShape.mjs.map +2 -2
  106. package/dist-esm/shapes/TLVideoShape.mjs.map +2 -2
  107. package/dist-esm/store-migrations.mjs.map +2 -2
  108. package/dist-esm/styles/TLColorStyle.mjs.map +2 -2
  109. package/dist-esm/styles/TLDashStyle.mjs.map +2 -2
  110. package/dist-esm/styles/TLFillStyle.mjs.map +2 -2
  111. package/dist-esm/styles/TLFontStyle.mjs.map +2 -2
  112. package/dist-esm/styles/TLHorizontalAlignStyle.mjs.map +2 -2
  113. package/dist-esm/styles/TLSizeStyle.mjs.map +2 -2
  114. package/dist-esm/styles/TLTextAlignStyle.mjs.map +2 -2
  115. package/dist-esm/styles/TLVerticalAlignStyle.mjs.map +2 -2
  116. package/dist-esm/translations/translations.mjs +1 -1
  117. package/dist-esm/translations/translations.mjs.map +2 -2
  118. package/package.json +5 -5
  119. package/src/TLStore.test.ts +644 -0
  120. package/src/TLStore.ts +205 -20
  121. package/src/assets/TLBaseAsset.ts +90 -7
  122. package/src/assets/TLBookmarkAsset.test.ts +96 -0
  123. package/src/assets/TLBookmarkAsset.ts +52 -2
  124. package/src/assets/TLImageAsset.test.ts +213 -0
  125. package/src/assets/TLImageAsset.ts +60 -2
  126. package/src/assets/TLVideoAsset.test.ts +105 -0
  127. package/src/assets/TLVideoAsset.ts +93 -4
  128. package/src/bindings/TLArrowBinding.test.ts +55 -0
  129. package/src/bindings/TLArrowBinding.ts +132 -10
  130. package/src/bindings/TLBaseBinding.ts +140 -3
  131. package/src/createPresenceStateDerivation.test.ts +158 -0
  132. package/src/createPresenceStateDerivation.ts +71 -2
  133. package/src/createTLSchema.test.ts +181 -0
  134. package/src/createTLSchema.ts +164 -7
  135. package/src/index.ts +32 -0
  136. package/src/misc/TLColor.ts +50 -6
  137. package/src/misc/TLCursor.ts +110 -8
  138. package/src/misc/TLHandle.ts +86 -6
  139. package/src/misc/TLOpacity.ts +51 -2
  140. package/src/misc/TLRichText.ts +56 -3
  141. package/src/misc/TLScribble.ts +105 -5
  142. package/src/misc/geometry-types.ts +30 -2
  143. package/src/misc/id-validator.test.ts +50 -0
  144. package/src/misc/id-validator.ts +20 -1
  145. package/src/records/TLAsset.test.ts +234 -0
  146. package/src/records/TLAsset.ts +165 -8
  147. package/src/records/TLBinding.test.ts +22 -0
  148. package/src/records/TLBinding.ts +277 -11
  149. package/src/records/TLCamera.test.ts +19 -0
  150. package/src/records/TLCamera.ts +118 -7
  151. package/src/records/TLDocument.test.ts +35 -0
  152. package/src/records/TLDocument.ts +148 -8
  153. package/src/records/TLInstance.test.ts +201 -0
  154. package/src/records/TLInstance.ts +117 -9
  155. package/src/records/TLPage.test.ts +110 -0
  156. package/src/records/TLPage.ts +106 -8
  157. package/src/records/TLPageState.test.ts +228 -0
  158. package/src/records/TLPageState.ts +88 -7
  159. package/src/records/TLPointer.test.ts +63 -0
  160. package/src/records/TLPointer.ts +105 -7
  161. package/src/records/TLPresence.test.ts +190 -0
  162. package/src/records/TLPresence.ts +99 -5
  163. package/src/records/TLRecord.test.ts +70 -0
  164. package/src/records/TLRecord.ts +43 -1
  165. package/src/records/TLShape.test.ts +232 -0
  166. package/src/records/TLShape.ts +289 -12
  167. package/src/recordsWithProps.test.ts +188 -0
  168. package/src/recordsWithProps.ts +131 -2
  169. package/src/shapes/ShapeWithCrop.test.ts +18 -0
  170. package/src/shapes/ShapeWithCrop.ts +64 -2
  171. package/src/shapes/TLArrowShape.test.ts +505 -0
  172. package/src/shapes/TLArrowShape.ts +188 -10
  173. package/src/shapes/TLBaseShape.test.ts +142 -0
  174. package/src/shapes/TLBaseShape.ts +103 -4
  175. package/src/shapes/TLBookmarkShape.test.ts +122 -0
  176. package/src/shapes/TLBookmarkShape.ts +58 -4
  177. package/src/shapes/TLDrawShape.test.ts +177 -0
  178. package/src/shapes/TLDrawShape.ts +97 -6
  179. package/src/shapes/TLEmbedShape.test.ts +286 -0
  180. package/src/shapes/TLEmbedShape.ts +57 -4
  181. package/src/shapes/TLFrameShape.test.ts +71 -0
  182. package/src/shapes/TLFrameShape.ts +59 -4
  183. package/src/shapes/TLGeoShape.test.ts +247 -0
  184. package/src/shapes/TLGeoShape.ts +103 -7
  185. package/src/shapes/TLGroupShape.test.ts +59 -0
  186. package/src/shapes/TLGroupShape.ts +52 -4
  187. package/src/shapes/TLHighlightShape.test.ts +325 -0
  188. package/src/shapes/TLHighlightShape.ts +79 -4
  189. package/src/shapes/TLImageShape.test.ts +534 -0
  190. package/src/shapes/TLImageShape.ts +105 -5
  191. package/src/shapes/TLLineShape.test.ts +269 -0
  192. package/src/shapes/TLLineShape.ts +128 -8
  193. package/src/shapes/TLNoteShape.test.ts +1568 -0
  194. package/src/shapes/TLNoteShape.ts +97 -4
  195. package/src/shapes/TLTextShape.test.ts +407 -0
  196. package/src/shapes/TLTextShape.ts +94 -4
  197. package/src/shapes/TLVideoShape.test.ts +112 -0
  198. package/src/shapes/TLVideoShape.ts +99 -4
  199. package/src/store-migrations.test.ts +88 -0
  200. package/src/store-migrations.ts +47 -1
  201. package/src/styles/TLColorStyle.test.ts +439 -0
  202. package/src/styles/TLColorStyle.ts +228 -10
  203. package/src/styles/TLDashStyle.ts +54 -2
  204. package/src/styles/TLFillStyle.ts +54 -2
  205. package/src/styles/TLFontStyle.ts +72 -3
  206. package/src/styles/TLHorizontalAlignStyle.ts +55 -2
  207. package/src/styles/TLSizeStyle.ts +54 -2
  208. package/src/styles/TLTextAlignStyle.ts +52 -2
  209. package/src/styles/TLVerticalAlignStyle.ts +52 -2
  210. package/src/translations/translations.test.ts +378 -35
  211. package/src/translations/translations.ts +157 -10
  212. package/src/util-types.ts +51 -1
@@ -172,7 +172,7 @@ import {
172
172
  } from "./translations/translations.mjs";
173
173
  registerTldrawLibraryVersion(
174
174
  "@tldraw/tlschema",
175
- "4.1.0-canary.5b2a01989756",
175
+ "4.1.0-canary.62b1976714aa",
176
176
  "esm"
177
177
  );
178
178
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["import { registerTldrawLibraryVersion } from '@tldraw/utils'\nexport { assetIdValidator, createAssetValidator, type TLBaseAsset } from './assets/TLBaseAsset'\nexport { type TLBookmarkAsset } from './assets/TLBookmarkAsset'\nexport { type TLImageAsset } from './assets/TLImageAsset'\nexport { type TLVideoAsset } from './assets/TLVideoAsset'\nexport {\n\tarrowBindingMigrations,\n\tarrowBindingProps,\n\tarrowBindingVersions,\n\tElbowArrowSnap,\n\ttype TLArrowBinding,\n\ttype TLArrowBindingProps,\n} from './bindings/TLArrowBinding'\nexport {\n\tbindingIdValidator,\n\tcreateBindingValidator,\n\ttype TLBaseBinding,\n} from './bindings/TLBaseBinding'\nexport {\n\tcreatePresenceStateDerivation,\n\tgetDefaultUserPresence,\n\ttype TLPresenceStateInfo,\n\ttype TLPresenceUserInfo,\n} from './createPresenceStateDerivation'\nexport {\n\tcreateTLSchema,\n\tdefaultBindingSchemas,\n\tdefaultShapeSchemas,\n\ttype SchemaPropsInfo,\n\ttype TLSchema,\n} from './createTLSchema'\nexport {\n\tboxModelValidator,\n\tvecModelValidator,\n\ttype BoxModel,\n\ttype VecModel,\n} from './misc/geometry-types'\nexport { idValidator } from './misc/id-validator'\nexport {\n\tcanvasUiColorTypeValidator,\n\tTL_CANVAS_UI_COLOR_TYPES,\n\ttype TLCanvasUiColor,\n} from './misc/TLColor'\nexport { TL_CURSOR_TYPES, type TLCursor, type TLCursorType } from './misc/TLCursor'\nexport { TL_HANDLE_TYPES, type TLHandle, type TLHandleType } from './misc/TLHandle'\nexport { opacityValidator, type TLOpacityType } from './misc/TLOpacity'\nexport { richTextValidator, toRichText, type TLRichText } from './misc/TLRichText'\nexport { scribbleValidator, TL_SCRIBBLE_STATES, type TLScribble } from './misc/TLScribble'\nexport {\n\tassetMigrations,\n\tAssetRecordType,\n\tassetValidator,\n\ttype TLAsset,\n\ttype TLAssetId,\n\ttype TLAssetPartial,\n\ttype TLAssetShape,\n} from './records/TLAsset'\nexport {\n\tcreateBindingId,\n\tcreateBindingPropsMigrationIds,\n\tcreateBindingPropsMigrationSequence,\n\tisBinding,\n\tisBindingId,\n\trootBindingMigrations,\n\ttype TLBinding,\n\ttype TLBindingCreate,\n\ttype TLBindingId,\n\ttype TLBindingUpdate,\n\ttype TLDefaultBinding,\n\ttype TLUnknownBinding,\n} from './records/TLBinding'\nexport { CameraRecordType, type TLCamera, type TLCameraId } from './records/TLCamera'\nexport {\n\tDocumentRecordType,\n\tisDocument,\n\tTLDOCUMENT_ID,\n\ttype TLDocument,\n} from './records/TLDocument'\nexport {\n\tpluckPreservingValues,\n\tTLINSTANCE_ID,\n\ttype TLInstance,\n\ttype TLInstanceId,\n} from './records/TLInstance'\nexport {\n\tisPageId,\n\tpageIdValidator,\n\tPageRecordType,\n\ttype TLPage,\n\ttype TLPageId,\n} from './records/TLPage'\nexport {\n\tInstancePageStateRecordType,\n\ttype TLInstancePageState,\n\ttype TLInstancePageStateId,\n} from './records/TLPageState'\nexport {\n\tPointerRecordType,\n\tTLPOINTER_ID,\n\ttype TLPointer,\n\ttype TLPointerId,\n} from './records/TLPointer'\nexport {\n\tInstancePresenceRecordType,\n\ttype TLInstancePresence,\n\ttype TLInstancePresenceID,\n} from './records/TLPresence'\nexport { type TLRecord } from './records/TLRecord'\nexport {\n\tcreateShapeId,\n\tcreateShapePropsMigrationIds,\n\tcreateShapePropsMigrationSequence,\n\tgetShapePropKeysByStyle,\n\tisShape,\n\tisShapeId,\n\trootShapeMigrations,\n\ttype TLDefaultShape,\n\ttype TLParentId,\n\ttype TLShape,\n\ttype TLShapeId,\n\ttype TLShapePartial,\n\ttype TLUnknownShape,\n} from './records/TLShape'\nexport {\n\ttype RecordProps,\n\ttype RecordPropsType,\n\ttype TLPropsMigration,\n\ttype TLPropsMigrations,\n} from './recordsWithProps'\nexport { type ShapeWithCrop, type TLShapeCrop } from './shapes/ShapeWithCrop'\nexport {\n\tArrowShapeArrowheadEndStyle,\n\tArrowShapeArrowheadStartStyle,\n\tArrowShapeKindStyle,\n\tarrowShapeMigrations,\n\tarrowShapeProps,\n\tarrowShapeVersions,\n\ttype TLArrowShape,\n\ttype TLArrowShapeArrowheadStyle,\n\ttype TLArrowShapeKind,\n\ttype TLArrowShapeProps,\n} from './shapes/TLArrowShape'\nexport {\n\tcreateShapeValidator,\n\tparentIdValidator,\n\tshapeIdValidator,\n\ttype TLBaseShape,\n} from './shapes/TLBaseShape'\nexport {\n\tbookmarkShapeMigrations,\n\tbookmarkShapeProps,\n\ttype TLBookmarkShape,\n\ttype TLBookmarkShapeProps,\n} from './shapes/TLBookmarkShape'\nexport {\n\tdrawShapeMigrations,\n\tdrawShapeProps,\n\ttype TLDrawShape,\n\ttype TLDrawShapeProps,\n\ttype TLDrawShapeSegment,\n} from './shapes/TLDrawShape'\nexport {\n\tembedShapeMigrations,\n\tembedShapeProps,\n\ttype TLEmbedShape,\n\ttype TLEmbedShapeProps,\n} from './shapes/TLEmbedShape'\nexport {\n\tframeShapeMigrations,\n\tframeShapeProps,\n\ttype TLFrameShape,\n\ttype TLFrameShapeProps,\n} from './shapes/TLFrameShape'\nexport {\n\tGeoShapeGeoStyle,\n\tgeoShapeMigrations,\n\tgeoShapeProps,\n\ttype TLGeoShape,\n\ttype TLGeoShapeGeoStyle,\n\ttype TLGeoShapeProps,\n} from './shapes/TLGeoShape'\nexport {\n\tgroupShapeMigrations,\n\tgroupShapeProps,\n\ttype TLGroupShape,\n\ttype TLGroupShapeProps,\n} from './shapes/TLGroupShape'\nexport {\n\thighlightShapeMigrations,\n\thighlightShapeProps,\n\ttype TLHighlightShape,\n\ttype TLHighlightShapeProps,\n} from './shapes/TLHighlightShape'\nexport {\n\tImageShapeCrop,\n\timageShapeMigrations,\n\timageShapeProps,\n\ttype TLImageShape,\n\ttype TLImageShapeProps,\n} from './shapes/TLImageShape'\nexport {\n\tlineShapeMigrations,\n\tlineShapeProps,\n\tLineShapeSplineStyle,\n\ttype TLLineShape,\n\ttype TLLineShapePoint,\n\ttype TLLineShapeProps,\n\ttype TLLineShapeSplineStyle,\n} from './shapes/TLLineShape'\nexport {\n\tnoteShapeMigrations,\n\tnoteShapeProps,\n\ttype TLNoteShape,\n\ttype TLNoteShapeProps,\n} from './shapes/TLNoteShape'\nexport {\n\ttextShapeMigrations,\n\ttextShapeProps,\n\ttype TLTextShape,\n\ttype TLTextShapeProps,\n} from './shapes/TLTextShape'\nexport {\n\tvideoShapeMigrations,\n\tvideoShapeProps,\n\ttype TLVideoShape,\n\ttype TLVideoShapeProps,\n} from './shapes/TLVideoShape'\nexport { EnumStyleProp, StyleProp, type StylePropValue } from './styles/StyleProp'\nexport {\n\tdefaultColorNames,\n\tDefaultColorStyle,\n\tDefaultColorThemePalette,\n\tgetColorValue,\n\tgetDefaultColorTheme,\n\ttype TLDefaultColorStyle,\n\ttype TLDefaultColorTheme,\n\ttype TLDefaultColorThemeColor,\n} from './styles/TLColorStyle'\nexport { DefaultDashStyle, type TLDefaultDashStyle } from './styles/TLDashStyle'\nexport { DefaultFillStyle, type TLDefaultFillStyle } from './styles/TLFillStyle'\nexport {\n\tDefaultFontFamilies,\n\tDefaultFontStyle,\n\ttype TLDefaultFontStyle,\n} from './styles/TLFontStyle'\nexport {\n\tDefaultHorizontalAlignStyle,\n\ttype TLDefaultHorizontalAlignStyle,\n} from './styles/TLHorizontalAlignStyle'\nexport { DefaultSizeStyle, type TLDefaultSizeStyle } from './styles/TLSizeStyle'\nexport { DefaultTextAlignStyle, type TLDefaultTextAlignStyle } from './styles/TLTextAlignStyle'\nexport {\n\tDefaultVerticalAlignStyle,\n\ttype TLDefaultVerticalAlignStyle,\n} from './styles/TLVerticalAlignStyle'\nexport {\n\ttype TLAssetContext,\n\ttype TLAssetStore,\n\ttype TLSerializedStore,\n\ttype TLStore,\n\ttype TLStoreProps,\n\ttype TLStoreSchema,\n\ttype TLStoreSnapshot,\n} from './TLStore'\nexport {\n\tgetDefaultTranslationLocale,\n\tLANGUAGES,\n\ttype TLLanguage,\n} from './translations/translations'\nexport { type SetValue } from './util-types'\n\nregisterTldrawLibraryVersion(\n\t(globalThis as any).TLDRAW_LIBRARY_NAME,\n\t(globalThis as any).TLDRAW_LIBRARY_VERSION,\n\t(globalThis as any).TLDRAW_LIBRARY_MODULES\n)\n"],
5
- "mappings": "AAAA,SAAS,oCAAoC;AAC7C,SAAS,kBAAkB,4BAA8C;AAIzE;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAEM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP,SAAS,mBAAmB;AAC5B;AAAA,EACC;AAAA,EACA;AAAA,OAEM;AACP,SAAS,uBAAyD;AAClE,SAAS,uBAAyD;AAClE,SAAS,wBAA4C;AACrD,SAAS,mBAAmB,kBAAmC;AAC/D,SAAS,mBAAmB,0BAA2C;AACvE;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAKM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAOM;AACP,SAAS,wBAAwD;AACjE;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAEM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,OAGM;AAEP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAOM;AAQP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAKM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAEM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAIM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAIM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAKM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP,SAAS,eAAe,iBAAsC;AAC9D;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIM;AACP,SAAS,wBAAiD;AAC1D,SAAS,wBAAiD;AAC1D;AAAA,EACC;AAAA,EACA;AAAA,OAEM;AACP;AAAA,EACC;AAAA,OAEM;AACP,SAAS,wBAAiD;AAC1D,SAAS,6BAA2D;AACpE;AAAA,EACC;AAAA,OAEM;AAUP;AAAA,EACC;AAAA,EACA;AAAA,OAEM;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF;",
4
+ "sourcesContent": ["/**\n * @fileoverview\n * Main entry point for the tldraw schema package. Exports the complete type system,\n * data structures, validation, and migrations for tldraw's persisted data.\n *\n * This package provides:\n * - Schema creation utilities (createTLSchema, defaultShapeSchemas, defaultBindingSchemas)\n * - All built-in shape types (TLGeoShape, TLTextShape, TLArrowShape, etc.)\n * - Asset management types and validators (TLImageAsset, TLVideoAsset, TLBookmarkAsset)\n * - Binding system for shape relationships (TLArrowBinding)\n * - Store integration types (TLStore, TLStoreProps, TLStoreSnapshot)\n * - Style properties for consistent styling (DefaultColorStyle, DefaultSizeStyle, etc.)\n * - Validation utilities and type guards\n * - Migration systems for schema evolution\n * - Geometry and utility types\n *\n * @example\n * ```ts\n * import { createTLSchema, defaultShapeSchemas, TLStore } from '@tldraw/tlschema'\n *\n * // Create a schema with default shapes\n * const schema = createTLSchema({\n * shapes: defaultShapeSchemas\n * })\n *\n * // Use with a store\n * const store = new Store({ schema })\n * ```\n *\n * @public\n */\n\nimport { registerTldrawLibraryVersion } from '@tldraw/utils'\nexport { assetIdValidator, createAssetValidator, type TLBaseAsset } from './assets/TLBaseAsset'\nexport { type TLBookmarkAsset } from './assets/TLBookmarkAsset'\nexport { type TLImageAsset } from './assets/TLImageAsset'\nexport { type TLVideoAsset } from './assets/TLVideoAsset'\nexport {\n\tarrowBindingMigrations,\n\tarrowBindingProps,\n\tarrowBindingVersions,\n\tElbowArrowSnap,\n\ttype TLArrowBinding,\n\ttype TLArrowBindingProps,\n} from './bindings/TLArrowBinding'\nexport {\n\tbindingIdValidator,\n\tcreateBindingValidator,\n\ttype TLBaseBinding,\n} from './bindings/TLBaseBinding'\nexport {\n\tcreatePresenceStateDerivation,\n\tgetDefaultUserPresence,\n\ttype TLPresenceStateInfo,\n\ttype TLPresenceUserInfo,\n} from './createPresenceStateDerivation'\nexport {\n\tcreateTLSchema,\n\tdefaultBindingSchemas,\n\tdefaultShapeSchemas,\n\ttype SchemaPropsInfo,\n\ttype TLSchema,\n} from './createTLSchema'\nexport {\n\tboxModelValidator,\n\tvecModelValidator,\n\ttype BoxModel,\n\ttype VecModel,\n} from './misc/geometry-types'\nexport { idValidator } from './misc/id-validator'\nexport {\n\tcanvasUiColorTypeValidator,\n\tTL_CANVAS_UI_COLOR_TYPES,\n\ttype TLCanvasUiColor,\n} from './misc/TLColor'\nexport { TL_CURSOR_TYPES, type TLCursor, type TLCursorType } from './misc/TLCursor'\nexport { TL_HANDLE_TYPES, type TLHandle, type TLHandleType } from './misc/TLHandle'\nexport { opacityValidator, type TLOpacityType } from './misc/TLOpacity'\nexport { richTextValidator, toRichText, type TLRichText } from './misc/TLRichText'\nexport { scribbleValidator, TL_SCRIBBLE_STATES, type TLScribble } from './misc/TLScribble'\nexport {\n\tassetMigrations,\n\tAssetRecordType,\n\tassetValidator,\n\ttype TLAsset,\n\ttype TLAssetId,\n\ttype TLAssetPartial,\n\ttype TLAssetShape,\n} from './records/TLAsset'\nexport {\n\tcreateBindingId,\n\tcreateBindingPropsMigrationIds,\n\tcreateBindingPropsMigrationSequence,\n\tisBinding,\n\tisBindingId,\n\trootBindingMigrations,\n\ttype TLBinding,\n\ttype TLBindingCreate,\n\ttype TLBindingId,\n\ttype TLBindingUpdate,\n\ttype TLDefaultBinding,\n\ttype TLUnknownBinding,\n} from './records/TLBinding'\nexport { CameraRecordType, type TLCamera, type TLCameraId } from './records/TLCamera'\nexport {\n\tDocumentRecordType,\n\tisDocument,\n\tTLDOCUMENT_ID,\n\ttype TLDocument,\n} from './records/TLDocument'\nexport {\n\tpluckPreservingValues,\n\tTLINSTANCE_ID,\n\ttype TLInstance,\n\ttype TLInstanceId,\n} from './records/TLInstance'\nexport {\n\tisPageId,\n\tpageIdValidator,\n\tPageRecordType,\n\ttype TLPage,\n\ttype TLPageId,\n} from './records/TLPage'\nexport {\n\tInstancePageStateRecordType,\n\ttype TLInstancePageState,\n\ttype TLInstancePageStateId,\n} from './records/TLPageState'\nexport {\n\tPointerRecordType,\n\tTLPOINTER_ID,\n\ttype TLPointer,\n\ttype TLPointerId,\n} from './records/TLPointer'\nexport {\n\tInstancePresenceRecordType,\n\ttype TLInstancePresence,\n\ttype TLInstancePresenceID,\n} from './records/TLPresence'\nexport { type TLRecord } from './records/TLRecord'\nexport {\n\tcreateShapeId,\n\tcreateShapePropsMigrationIds,\n\tcreateShapePropsMigrationSequence,\n\tgetShapePropKeysByStyle,\n\tisShape,\n\tisShapeId,\n\trootShapeMigrations,\n\ttype TLDefaultShape,\n\ttype TLParentId,\n\ttype TLShape,\n\ttype TLShapeId,\n\ttype TLShapePartial,\n\ttype TLUnknownShape,\n} from './records/TLShape'\nexport {\n\ttype RecordProps,\n\ttype RecordPropsType,\n\ttype TLPropsMigration,\n\ttype TLPropsMigrations,\n} from './recordsWithProps'\nexport { type ShapeWithCrop, type TLShapeCrop } from './shapes/ShapeWithCrop'\nexport {\n\tArrowShapeArrowheadEndStyle,\n\tArrowShapeArrowheadStartStyle,\n\tArrowShapeKindStyle,\n\tarrowShapeMigrations,\n\tarrowShapeProps,\n\tarrowShapeVersions,\n\ttype TLArrowShape,\n\ttype TLArrowShapeArrowheadStyle,\n\ttype TLArrowShapeKind,\n\ttype TLArrowShapeProps,\n} from './shapes/TLArrowShape'\nexport {\n\tcreateShapeValidator,\n\tparentIdValidator,\n\tshapeIdValidator,\n\ttype TLBaseShape,\n} from './shapes/TLBaseShape'\nexport {\n\tbookmarkShapeMigrations,\n\tbookmarkShapeProps,\n\ttype TLBookmarkShape,\n\ttype TLBookmarkShapeProps,\n} from './shapes/TLBookmarkShape'\nexport {\n\tdrawShapeMigrations,\n\tdrawShapeProps,\n\ttype TLDrawShape,\n\ttype TLDrawShapeProps,\n\ttype TLDrawShapeSegment,\n} from './shapes/TLDrawShape'\nexport {\n\tembedShapeMigrations,\n\tembedShapeProps,\n\ttype TLEmbedShape,\n\ttype TLEmbedShapeProps,\n} from './shapes/TLEmbedShape'\nexport {\n\tframeShapeMigrations,\n\tframeShapeProps,\n\ttype TLFrameShape,\n\ttype TLFrameShapeProps,\n} from './shapes/TLFrameShape'\nexport {\n\tGeoShapeGeoStyle,\n\tgeoShapeMigrations,\n\tgeoShapeProps,\n\ttype TLGeoShape,\n\ttype TLGeoShapeGeoStyle,\n\ttype TLGeoShapeProps,\n} from './shapes/TLGeoShape'\nexport {\n\tgroupShapeMigrations,\n\tgroupShapeProps,\n\ttype TLGroupShape,\n\ttype TLGroupShapeProps,\n} from './shapes/TLGroupShape'\nexport {\n\thighlightShapeMigrations,\n\thighlightShapeProps,\n\ttype TLHighlightShape,\n\ttype TLHighlightShapeProps,\n} from './shapes/TLHighlightShape'\nexport {\n\tImageShapeCrop,\n\timageShapeMigrations,\n\timageShapeProps,\n\ttype TLImageShape,\n\ttype TLImageShapeProps,\n} from './shapes/TLImageShape'\nexport {\n\tlineShapeMigrations,\n\tlineShapeProps,\n\tLineShapeSplineStyle,\n\ttype TLLineShape,\n\ttype TLLineShapePoint,\n\ttype TLLineShapeProps,\n\ttype TLLineShapeSplineStyle,\n} from './shapes/TLLineShape'\nexport {\n\tnoteShapeMigrations,\n\tnoteShapeProps,\n\ttype TLNoteShape,\n\ttype TLNoteShapeProps,\n} from './shapes/TLNoteShape'\nexport {\n\ttextShapeMigrations,\n\ttextShapeProps,\n\ttype TLTextShape,\n\ttype TLTextShapeProps,\n} from './shapes/TLTextShape'\nexport {\n\tvideoShapeMigrations,\n\tvideoShapeProps,\n\ttype TLVideoShape,\n\ttype TLVideoShapeProps,\n} from './shapes/TLVideoShape'\nexport { EnumStyleProp, StyleProp, type StylePropValue } from './styles/StyleProp'\nexport {\n\tdefaultColorNames,\n\tDefaultColorStyle,\n\tDefaultColorThemePalette,\n\tgetColorValue,\n\tgetDefaultColorTheme,\n\ttype TLDefaultColorStyle,\n\ttype TLDefaultColorTheme,\n\ttype TLDefaultColorThemeColor,\n} from './styles/TLColorStyle'\nexport { DefaultDashStyle, type TLDefaultDashStyle } from './styles/TLDashStyle'\nexport { DefaultFillStyle, type TLDefaultFillStyle } from './styles/TLFillStyle'\nexport {\n\tDefaultFontFamilies,\n\tDefaultFontStyle,\n\ttype TLDefaultFontStyle,\n} from './styles/TLFontStyle'\nexport {\n\tDefaultHorizontalAlignStyle,\n\ttype TLDefaultHorizontalAlignStyle,\n} from './styles/TLHorizontalAlignStyle'\nexport { DefaultSizeStyle, type TLDefaultSizeStyle } from './styles/TLSizeStyle'\nexport { DefaultTextAlignStyle, type TLDefaultTextAlignStyle } from './styles/TLTextAlignStyle'\nexport {\n\tDefaultVerticalAlignStyle,\n\ttype TLDefaultVerticalAlignStyle,\n} from './styles/TLVerticalAlignStyle'\nexport {\n\ttype TLAssetContext,\n\ttype TLAssetStore,\n\ttype TLSerializedStore,\n\ttype TLStore,\n\ttype TLStoreProps,\n\ttype TLStoreSchema,\n\ttype TLStoreSnapshot,\n} from './TLStore'\nexport {\n\tgetDefaultTranslationLocale,\n\tLANGUAGES,\n\ttype TLLanguage,\n} from './translations/translations'\nexport { type SetValue } from './util-types'\n\nregisterTldrawLibraryVersion(\n\t(globalThis as any).TLDRAW_LIBRARY_NAME,\n\t(globalThis as any).TLDRAW_LIBRARY_VERSION,\n\t(globalThis as any).TLDRAW_LIBRARY_MODULES\n)\n"],
5
+ "mappings": "AAgCA,SAAS,oCAAoC;AAC7C,SAAS,kBAAkB,4BAA8C;AAIzE;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAEM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP,SAAS,mBAAmB;AAC5B;AAAA,EACC;AAAA,EACA;AAAA,OAEM;AACP,SAAS,uBAAyD;AAClE,SAAS,uBAAyD;AAClE,SAAS,wBAA4C;AACrD,SAAS,mBAAmB,kBAAmC;AAC/D,SAAS,mBAAmB,0BAA2C;AACvE;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAKM;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M;AACP;AAAA,EACC;AAAA,OAEM;AACP,SAAS,wBAAiD;AAC1D,SAAS,6BAA2D;AACpE;AAAA,EACC;AAAA,OAEM;AAUP;AAAA,EACC;AAAA,EACA;AAAA,OAEM;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/misc/TLColor.ts"],
4
- "sourcesContent": ["import { T } from '@tldraw/validate'\nimport { SetValue } from '../util-types'\n\n/**\n * The colors used by tldraw's default shapes.\n *\n * @public */\nexport const TL_CANVAS_UI_COLOR_TYPES = new Set([\n\t'accent',\n\t'white',\n\t'black',\n\t'selection-stroke',\n\t'selection-fill',\n\t'laser',\n\t'muted-1',\n] as const)\n\n/**\n * A type for the colors used by tldraw's default shapes.\n *\n * @public */\nexport type TLCanvasUiColor = SetValue<typeof TL_CANVAS_UI_COLOR_TYPES>\n\n/**\n * A validator for the colors used by tldraw's default shapes.\n *\n * @public */\nexport const canvasUiColorTypeValidator = T.setEnum(TL_CANVAS_UI_COLOR_TYPES)\n"],
5
- "mappings": "AAAA,SAAS,SAAS;AAOX,MAAM,2BAA2B,oBAAI,IAAI;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAU;AAYH,MAAM,6BAA6B,EAAE,QAAQ,wBAAwB;",
4
+ "sourcesContent": ["import { T } from '@tldraw/validate'\nimport { SetValue } from '../util-types'\n\n/**\n * The colors used by tldraw's canvas UI system.\n *\n * These are special color types used for canvas UI elements like selections,\n * accents, and other interface components that overlay the drawing canvas.\n * Unlike shape colors, these are semantic color types that adapt to the\n * current theme.\n *\n * @example\n * ```ts\n * // Check if a color is a canvas UI color\n * if (TL_CANVAS_UI_COLOR_TYPES.has('selection-stroke')) {\n * console.log('This is a valid canvas UI color')\n * }\n * ```\n *\n * @public\n */\nexport const TL_CANVAS_UI_COLOR_TYPES = new Set([\n\t'accent',\n\t'white',\n\t'black',\n\t'selection-stroke',\n\t'selection-fill',\n\t'laser',\n\t'muted-1',\n] as const)\n\n/**\n * A union type representing the available canvas UI color types.\n *\n * Canvas UI colors are semantic color types used for interface elements\n * that overlay the drawing canvas, such as selection indicators, accents,\n * and other UI components.\n *\n * @example\n * ```ts\n * const selectionColor: TLCanvasUiColor = 'selection-stroke'\n * const accentColor: TLCanvasUiColor = 'accent'\n * const backgroundColor: TLCanvasUiColor = 'white'\n * ```\n *\n * @public\n */\nexport type TLCanvasUiColor = SetValue<typeof TL_CANVAS_UI_COLOR_TYPES>\n\n/**\n * A validator for canvas UI color types.\n *\n * This validator ensures that color values are one of the valid canvas UI\n * color types defined in {@link TL_CANVAS_UI_COLOR_TYPES}. It provides\n * runtime type checking for canvas UI color properties.\n *\n * @example\n * ```ts\n * import { canvasUiColorTypeValidator } from '@tldraw/tlschema'\n *\n * // Validate a color value\n * try {\n * const validColor = canvasUiColorTypeValidator.validate('accent')\n * console.log('Valid color:', validColor)\n * } catch (error) {\n * console.error('Invalid color:', error.message)\n * }\n * ```\n *\n * @public\n */\nexport const canvasUiColorTypeValidator = T.setEnum(TL_CANVAS_UI_COLOR_TYPES)\n"],
5
+ "mappings": "AAAA,SAAS,SAAS;AAqBX,MAAM,2BAA2B,oBAAI,IAAI;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAU;AA0CH,MAAM,6BAA6B,EAAE,QAAQ,wBAAwB;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/misc/TLCursor.ts"],
4
- "sourcesContent": ["import { T } from '@tldraw/validate'\nimport { SetValue } from '../util-types'\n\n/**\n * The cursor types used by tldraw's default shapes.\n *\n * @public */\nexport const TL_CURSOR_TYPES = new Set([\n\t'none',\n\t'default',\n\t'pointer',\n\t'cross',\n\t'grab',\n\t'rotate',\n\t'grabbing',\n\t'resize-edge',\n\t'resize-corner',\n\t'text',\n\t'move',\n\t'ew-resize',\n\t'ns-resize',\n\t'nesw-resize',\n\t'nwse-resize',\n\t'nesw-rotate',\n\t'nwse-rotate',\n\t'swne-rotate',\n\t'senw-rotate',\n\t'zoom-in',\n\t'zoom-out',\n])\n\n/**\n * A type for the cursor types used by tldraw's default shapes.\n *\n * @public */\nexport type TLCursorType = SetValue<typeof TL_CURSOR_TYPES>\n\n/** @public */\nexport const cursorTypeValidator = T.setEnum(TL_CURSOR_TYPES)\n\n/**\n * A cursor used by tldraw.\n *\n * @public */\nexport interface TLCursor {\n\ttype: TLCursorType\n\trotation: number\n}\n\n/** @public */\nexport const cursorValidator: T.ObjectValidator<TLCursor> = T.object<TLCursor>({\n\ttype: cursorTypeValidator,\n\trotation: T.number,\n})\n"],
5
- "mappings": "AAAA,SAAS,SAAS;AAOX,MAAM,kBAAkB,oBAAI,IAAI;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAC;AASM,MAAM,sBAAsB,EAAE,QAAQ,eAAe;AAYrD,MAAM,kBAA+C,EAAE,OAAiB;AAAA,EAC9E,MAAM;AAAA,EACN,UAAU,EAAE;AACb,CAAC;",
4
+ "sourcesContent": ["import { T } from '@tldraw/validate'\nimport { SetValue } from '../util-types'\n\n/**\n * All available cursor types used throughout the tldraw editor.\n *\n * These cursor types correspond to CSS cursor values and are used to indicate\n * different interaction modes and states within the editor. The cursor types\n * cover selection, resizing, rotation, text editing, and various other editor\n * interactions.\n *\n * @example\n * ```ts\n * // Check if a cursor type is valid\n * if (TL_CURSOR_TYPES.has('resize-corner')) {\n * console.log('Valid cursor type')\n * }\n *\n * // Get all available cursor types\n * const allCursors = Array.from(TL_CURSOR_TYPES)\n * ```\n *\n * @public\n */\nexport const TL_CURSOR_TYPES = new Set([\n\t'none',\n\t'default',\n\t'pointer',\n\t'cross',\n\t'grab',\n\t'rotate',\n\t'grabbing',\n\t'resize-edge',\n\t'resize-corner',\n\t'text',\n\t'move',\n\t'ew-resize',\n\t'ns-resize',\n\t'nesw-resize',\n\t'nwse-resize',\n\t'nesw-rotate',\n\t'nwse-rotate',\n\t'swne-rotate',\n\t'senw-rotate',\n\t'zoom-in',\n\t'zoom-out',\n])\n\n/**\n * A union type representing all available cursor types in the tldraw editor.\n *\n * Each cursor type corresponds to a different interaction mode or state,\n * helping users understand what action they can perform at any given moment.\n *\n * @example\n * ```ts\n * const defaultCursor: TLCursorType = 'default'\n * const textCursor: TLCursorType = 'text'\n * const resizeCursor: TLCursorType = 'resize-corner'\n * const rotateCursor: TLCursorType = 'nesw-rotate'\n * ```\n *\n * @public\n */\nexport type TLCursorType = SetValue<typeof TL_CURSOR_TYPES>\n\n/**\n * A validator for cursor types.\n *\n * This validator ensures that cursor type values are one of the valid types\n * defined in {@link TL_CURSOR_TYPES}. It provides runtime type checking for\n * cursor properties throughout the editor.\n *\n * @example\n * ```ts\n * import { cursorTypeValidator } from '@tldraw/tlschema'\n *\n * // Validate a cursor type\n * try {\n * const validCursor = cursorTypeValidator.validate('pointer')\n * console.log('Valid cursor:', validCursor)\n * } catch (error) {\n * console.error('Invalid cursor:', error.message)\n * }\n * ```\n *\n * @public\n */\nexport const cursorTypeValidator = T.setEnum(TL_CURSOR_TYPES)\n\n/**\n * A cursor object used throughout the tldraw editor.\n *\n * Represents both the cursor type (which determines the visual appearance)\n * and its rotation angle. The rotation is particularly useful for resize\n * and rotation cursors that need to align with the current interaction angle.\n *\n * @example\n * ```ts\n * // Default cursor\n * const defaultCursor: TLCursor = {\n * type: 'default',\n * rotation: 0\n * }\n *\n * // Rotated resize cursor\n * const rotatedResizeCursor: TLCursor = {\n * type: 'resize-corner',\n * rotation: Math.PI / 4 // 45 degrees\n * }\n *\n * // Text editing cursor\n * const textCursor: TLCursor = {\n * type: 'text',\n * rotation: 0\n * }\n * ```\n *\n * @public\n */\nexport interface TLCursor {\n\t/** The cursor type, determining the visual appearance and interaction mode */\n\ttype: TLCursorType\n\t/** The rotation angle in radians, used for rotated cursors like resize handles */\n\trotation: number\n}\n\n/**\n * A validator for TLCursor objects.\n *\n * This validator ensures that cursor objects have valid cursor types and\n * numeric rotation values. It provides runtime validation for cursor\n * properties used throughout the editor.\n *\n * @example\n * ```ts\n * import { cursorValidator } from '@tldraw/tlschema'\n *\n * // Validate a cursor object\n * try {\n * const validCursor = cursorValidator.validate({\n * type: 'pointer',\n * rotation: 0.5\n * })\n * console.log('Valid cursor:', validCursor)\n * } catch (error) {\n * console.error('Invalid cursor:', error.message)\n * }\n * ```\n *\n * @public\n */\nexport const cursorValidator: T.ObjectValidator<TLCursor> = T.object<TLCursor>({\n\ttype: cursorTypeValidator,\n\trotation: T.number,\n})\n"],
5
+ "mappings": "AAAA,SAAS,SAAS;AAwBX,MAAM,kBAAkB,oBAAI,IAAI;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAC;AA0CM,MAAM,sBAAsB,EAAE,QAAQ,eAAe;AAgErD,MAAM,kBAA+C,EAAE,OAAiB;AAAA,EAC9E,MAAM;AAAA,EACN,UAAU,EAAE;AACb,CAAC;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/misc/TLHandle.ts"],
4
- "sourcesContent": ["import { IndexKey } from '@tldraw/utils'\nimport { SetValue } from '../util-types'\n\n/**\n * The handle types used by tldraw's default shapes.\n *\n * @public */\nexport const TL_HANDLE_TYPES = new Set(['vertex', 'virtual', 'create', 'clone'] as const)\n\n/**\n * A type for the handle types used by tldraw's default shapes.\n *\n * @public */\nexport type TLHandleType = SetValue<typeof TL_HANDLE_TYPES>\n\n/**\n * A base interface for a shape's handles.\n *\n * @public\n */\nexport interface TLHandle {\n\t/** A unique identifier for the handle. */\n\tid: string\n\t// TODO(mime): this needs to be required.\n\tlabel?: string\n\ttype: TLHandleType\n\tcanSnap?: boolean\n\tindex: IndexKey\n\tx: number\n\ty: number\n}\n"],
5
- "mappings": "AAOO,MAAM,kBAAkB,oBAAI,IAAI,CAAC,UAAU,WAAW,UAAU,OAAO,CAAU;",
4
+ "sourcesContent": ["import { IndexKey } from '@tldraw/utils'\nimport { SetValue } from '../util-types'\n\n/**\n * All available handle types used by shapes in the tldraw editor.\n *\n * Handles are interactive control points on shapes that allow users to\n * modify the shape's geometry. Different handle types serve different purposes:\n *\n * - `vertex`: A control point that defines a vertex of the shape\n * - `virtual`: A handle that exists between vertices for adding new points\n * - `create`: A handle for creating new geometry (like extending a line)\n * - `clone`: A handle for duplicating or cloning shape elements\n *\n * @example\n * ```ts\n * // Check if a handle type is valid\n * if (TL_HANDLE_TYPES.has('vertex')) {\n * console.log('Valid handle type')\n * }\n *\n * // Get all available handle types\n * const allHandleTypes = Array.from(TL_HANDLE_TYPES)\n * ```\n *\n * @public\n */\nexport const TL_HANDLE_TYPES = new Set(['vertex', 'virtual', 'create', 'clone'] as const)\n\n/**\n * A union type representing all available handle types.\n *\n * Handle types determine how a handle behaves when interacted with and\n * what kind of shape modification it enables.\n *\n * @example\n * ```ts\n * const vertexHandle: TLHandleType = 'vertex'\n * const virtualHandle: TLHandleType = 'virtual'\n * const createHandle: TLHandleType = 'create'\n * const cloneHandle: TLHandleType = 'clone'\n * ```\n *\n * @public\n */\nexport type TLHandleType = SetValue<typeof TL_HANDLE_TYPES>\n\n/**\n * A handle object representing an interactive control point on a shape.\n *\n * Handles allow users to manipulate shape geometry by dragging control points.\n * Each handle has a position, type, and various properties that control its\n * behavior during interactions.\n *\n * @example\n * ```ts\n * // A vertex handle for a line endpoint\n * const lineEndHandle: TLHandle = {\n * id: 'end',\n * label: 'End point',\n * type: 'vertex',\n * canSnap: true,\n * index: 'a1',\n * x: 100,\n * y: 50\n * }\n *\n * // A virtual handle for adding new points\n * const virtualHandle: TLHandle = {\n * id: 'virtual-1',\n * type: 'virtual',\n * canSnap: false,\n * index: 'a1V',\n * x: 75,\n * y: 25\n * }\n *\n * // A create handle for extending geometry\n * const createHandle: TLHandle = {\n * id: 'create',\n * type: 'create',\n * canSnap: true,\n * index: 'a2',\n * x: 200,\n * y: 100\n * }\n * ```\n *\n * @public\n */\nexport interface TLHandle {\n\t/** A unique identifier for the handle within the shape */\n\tid: string\n\t/** Optional human-readable label for the handle */\n\t// TODO(mime): this needs to be required.\n\tlabel?: string\n\t/** The type of handle, determining its behavior and interaction mode */\n\ttype: TLHandleType\n\t/**\n\t * @deprecated Use `snapType` instead. Whether this handle should snap to other geometry during interactions.\n\t */\n\tcanSnap?: boolean\n\t/** The type of snap to use for this handle */\n\tsnapType?: 'point' | 'align'\n\t/** The fractional index used for ordering handles */\n\tindex: IndexKey\n\t/** The x-coordinate of the handle in the shape's local coordinate system */\n\tx: number\n\t/** The y-coordinate of the handle in the shape's local coordinate system */\n\ty: number\n}\n"],
5
+ "mappings": "AA2BO,MAAM,kBAAkB,oBAAI,IAAI,CAAC,UAAU,WAAW,UAAU,OAAO,CAAU;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/misc/TLOpacity.ts"],
4
- "sourcesContent": ["import { T } from '@tldraw/validate'\n\n/** @public */\nexport type TLOpacityType = number\n\n/** @public */\nexport const opacityValidator = T.number.check((n) => {\n\tif (n < 0 || n > 1) {\n\t\tthrow new T.ValidationError('Opacity must be between 0 and 1')\n\t}\n})\n"],
5
- "mappings": "AAAA,SAAS,SAAS;AAMX,MAAM,mBAAmB,EAAE,OAAO,MAAM,CAAC,MAAM;AACrD,MAAI,IAAI,KAAK,IAAI,GAAG;AACnB,UAAM,IAAI,EAAE,gBAAgB,iCAAiC;AAAA,EAC9D;AACD,CAAC;",
4
+ "sourcesContent": ["import { T } from '@tldraw/validate'\n\n/**\n * A type representing opacity values in tldraw.\n *\n * Opacity values are numbers between 0 and 1, where 0 is fully transparent\n * and 1 is fully opaque. This type is used throughout the editor to control\n * the transparency of shapes, UI elements, and other visual components.\n *\n * @example\n * ```ts\n * const fullyOpaque: TLOpacityType = 1.0\n * const halfTransparent: TLOpacityType = 0.5\n * const fullyTransparent: TLOpacityType = 0.0\n * const quarterOpaque: TLOpacityType = 0.25\n * ```\n *\n * @public\n */\nexport type TLOpacityType = number\n\n/**\n * A validator for opacity values.\n *\n * This validator ensures that opacity values are numbers between 0 and 1 (inclusive).\n * Values outside this range will cause a validation error. The validator provides\n * runtime type checking for opacity properties throughout the editor.\n *\n * @param n - The number to validate as an opacity value\n * @throws T.ValidationError When the value is not between 0 and 1\n *\n * @example\n * ```ts\n * import { opacityValidator } from '@tldraw/tlschema'\n *\n * // Valid opacity values\n * try {\n * const validOpacity1 = opacityValidator.validate(0.5) // \u2713\n * const validOpacity2 = opacityValidator.validate(1.0) // \u2713\n * const validOpacity3 = opacityValidator.validate(0.0) // \u2713\n * } catch (error) {\n * console.error('Validation failed:', error.message)\n * }\n *\n * // Invalid opacity values\n * try {\n * opacityValidator.validate(-0.1) // \u2717 Throws error\n * opacityValidator.validate(1.5) // \u2717 Throws error\n * } catch (error) {\n * console.error('Invalid opacity:', error.message)\n * }\n * ```\n *\n * @public\n */\nexport const opacityValidator = T.number.check((n) => {\n\tif (n < 0 || n > 1) {\n\t\tthrow new T.ValidationError('Opacity must be between 0 and 1')\n\t}\n})\n"],
5
+ "mappings": "AAAA,SAAS,SAAS;AAuDX,MAAM,mBAAmB,EAAE,OAAO,MAAM,CAAC,MAAM;AACrD,MAAI,IAAI,KAAK,IAAI,GAAG;AACnB,UAAM,IAAI,EAAE,gBAAgB,iCAAiC;AAAA,EAC9D;AACD,CAAC;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/misc/TLRichText.ts"],
4
- "sourcesContent": ["import { T } from '@tldraw/validate'\n\n/** @public */\nexport const richTextValidator = T.object({ type: T.string, content: T.arrayOf(T.unknown) })\n\n/** @public */\nexport type TLRichText = T.TypeOf<typeof richTextValidator>\n\n/** @public */\nexport function toRichText(text: string): TLRichText {\n\tconst lines = text.split('\\n')\n\tconst content = lines.map((text) => {\n\t\tif (!text) {\n\t\t\treturn {\n\t\t\t\ttype: 'paragraph',\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\ttype: 'paragraph',\n\t\t\tcontent: [{ type: 'text', text }],\n\t\t}\n\t})\n\n\treturn {\n\t\ttype: 'doc',\n\t\tcontent,\n\t}\n}\n"],
5
- "mappings": "AAAA,SAAS,SAAS;AAGX,MAAM,oBAAoB,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;AAMpF,SAAS,WAAW,MAA0B;AACpD,QAAM,QAAQ,KAAK,MAAM,IAAI;AAC7B,QAAM,UAAU,MAAM,IAAI,CAACA,UAAS;AACnC,QAAI,CAACA,OAAM;AACV,aAAO;AAAA,QACN,MAAM;AAAA,MACP;AAAA,IACD;AAEA,WAAO;AAAA,MACN,MAAM;AAAA,MACN,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAAA,MAAK,CAAC;AAAA,IACjC;AAAA,EACD,CAAC;AAED,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;",
4
+ "sourcesContent": ["import { T } from '@tldraw/validate'\n\n/**\n * Validator for TLRichText objects that ensures they have the correct structure\n * for document-based rich text content. Validates a document with a type field\n * and an array of content blocks.\n *\n * @public\n * @example\n * ```ts\n * const richText = { type: 'doc', content: [{ type: 'paragraph', content: [{ type: 'text', text: 'Hello' }] }] }\n * const isValid = richTextValidator.check(richText) // true\n * ```\n */\nexport const richTextValidator = T.object({ type: T.string, content: T.arrayOf(T.unknown) })\n\n/**\n * Type representing rich text content in tldraw. Rich text follows a document-based\n * structure with a root document containing an array of content blocks (paragraphs,\n * text nodes, etc.). This enables formatted text with support for multiple paragraphs,\n * styling, and other rich content.\n *\n * @public\n * @example\n * ```ts\n * const richText: TLRichText = {\n * type: 'doc',\n * content: [\n * {\n * type: 'paragraph',\n * content: [{ type: 'text', text: 'Hello world!' }]\n * }\n * ]\n * }\n * ```\n */\nexport type TLRichText = T.TypeOf<typeof richTextValidator>\n\n/**\n * Converts a plain text string into a TLRichText object. Each line of the input\n * text becomes a separate paragraph in the rich text document. Empty lines are\n * preserved as empty paragraphs to maintain the original text structure.\n *\n * @param text - The plain text string to convert to rich text\n * @returns A TLRichText object with the text content structured as paragraphs\n * @public\n * @example\n * ```ts\n * const richText = toRichText('Hello\\nWorld')\n * // Returns:\n * // {\n * // type: 'doc',\n * // content: [\n * // { type: 'paragraph', content: [{ type: 'text', text: 'Hello' }] },\n * // { type: 'paragraph', content: [{ type: 'text', text: 'World' }] }\n * // ]\n * // }\n *\n * const emptyLine = toRichText('Line 1\\n\\nLine 3')\n * // Creates three paragraphs, with the middle one being empty\n * ```\n */\nexport function toRichText(text: string): TLRichText {\n\tconst lines = text.split('\\n')\n\tconst content = lines.map((text) => {\n\t\tif (!text) {\n\t\t\treturn {\n\t\t\t\ttype: 'paragraph',\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\ttype: 'paragraph',\n\t\t\tcontent: [{ type: 'text', text }],\n\t\t}\n\t})\n\n\treturn {\n\t\ttype: 'doc',\n\t\tcontent,\n\t}\n}\n"],
5
+ "mappings": "AAAA,SAAS,SAAS;AAcX,MAAM,oBAAoB,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;AAgDpF,SAAS,WAAW,MAA0B;AACpD,QAAM,QAAQ,KAAK,MAAM,IAAI;AAC7B,QAAM,UAAU,MAAM,IAAI,CAACA,UAAS;AACnC,QAAI,CAACA,OAAM;AACV,aAAO;AAAA,QACN,MAAM;AAAA,MACP;AAAA,IACD;AAEA,WAAO;AAAA,MACN,MAAM;AAAA,MACN,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAAA,MAAK,CAAC;AAAA,IACjC;AAAA,EACD,CAAC;AAED,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;",
6
6
  "names": ["text"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/misc/TLScribble.ts"],
4
- "sourcesContent": ["import { T } from '@tldraw/validate'\nimport { SetValue } from '../util-types'\nimport { TLCanvasUiColor, canvasUiColorTypeValidator } from './TLColor'\nimport { VecModel, vecModelValidator } from './geometry-types'\n\n/**\n * The scribble states used by tldraw.\n *\n * @public */\nexport const TL_SCRIBBLE_STATES = new Set(['starting', 'paused', 'active', 'stopping'] as const)\n\n/**\n * A type for the scribble used by tldraw.\n *\n * @public */\nexport interface TLScribble {\n\tid: string\n\tpoints: VecModel[]\n\tsize: number\n\tcolor: TLCanvasUiColor\n\topacity: number\n\tstate: SetValue<typeof TL_SCRIBBLE_STATES>\n\tdelay: number\n\tshrink: number\n\ttaper: boolean\n}\n\n/** @public */\nexport const scribbleValidator: T.ObjectValidator<TLScribble> = T.object({\n\tid: T.string,\n\tpoints: T.arrayOf(vecModelValidator),\n\tsize: T.positiveNumber,\n\tcolor: canvasUiColorTypeValidator,\n\topacity: T.number,\n\tstate: T.setEnum(TL_SCRIBBLE_STATES),\n\tdelay: T.number,\n\tshrink: T.number,\n\ttaper: T.boolean,\n})\n"],
5
- "mappings": "AAAA,SAAS,SAAS;AAElB,SAA0B,kCAAkC;AAC5D,SAAmB,yBAAyB;AAMrC,MAAM,qBAAqB,oBAAI,IAAI,CAAC,YAAY,UAAU,UAAU,UAAU,CAAU;AAmBxF,MAAM,oBAAmD,EAAE,OAAO;AAAA,EACxE,IAAI,EAAE;AAAA,EACN,QAAQ,EAAE,QAAQ,iBAAiB;AAAA,EACnC,MAAM,EAAE;AAAA,EACR,OAAO;AAAA,EACP,SAAS,EAAE;AAAA,EACX,OAAO,EAAE,QAAQ,kBAAkB;AAAA,EACnC,OAAO,EAAE;AAAA,EACT,QAAQ,EAAE;AAAA,EACV,OAAO,EAAE;AACV,CAAC;",
4
+ "sourcesContent": ["import { T } from '@tldraw/validate'\nimport { SetValue } from '../util-types'\nimport { TLCanvasUiColor, canvasUiColorTypeValidator } from './TLColor'\nimport { VecModel, vecModelValidator } from './geometry-types'\n\n/**\n * All available scribble states used by the tldraw drawing system.\n *\n * Scribble states represent the different phases of a drawing stroke:\n *\n * - `starting`: The scribble is being initiated\n * - `paused`: The scribble is temporarily paused\n * - `active`: The scribble is actively being drawn\n * - `stopping`: The scribble is being finished\n *\n * These states help manage the drawing lifecycle and apply appropriate\n * visual effects during different phases of the stroke.\n *\n * @example\n * ```ts\n * // Check if a scribble state is valid\n * if (TL_SCRIBBLE_STATES.has('active')) {\n * console.log('Valid scribble state')\n * }\n *\n * // Get all available scribble states\n * const allStates = Array.from(TL_SCRIBBLE_STATES)\n * ```\n *\n * @public\n */\nexport const TL_SCRIBBLE_STATES = new Set(['starting', 'paused', 'active', 'stopping'] as const)\n\n/**\n * A scribble object representing a drawing stroke in tldraw.\n *\n * Scribbles are temporary drawing strokes that appear during freehand drawing\n * operations. They provide visual feedback as the user draws and can be styled\n * with various properties like size, color, and effects.\n *\n * @example\n * ```ts\n * // A basic scribble stroke\n * const scribble: TLScribble = {\n * id: 'scribble-123',\n * points: [\n * { x: 0, y: 0, z: 0.5 },\n * { x: 10, y: 5, z: 0.7 },\n * { x: 20, y: 10, z: 0.6 }\n * ],\n * size: 4,\n * color: 'black',\n * opacity: 0.8,\n * state: 'active',\n * delay: 0,\n * shrink: 0.1,\n * taper: true\n * }\n *\n * // A laser pointer scribble\n * const laserScribble: TLScribble = {\n * id: 'laser-pointer',\n * points: [{ x: 50, y: 50, z: 1.0 }],\n * size: 8,\n * color: 'laser',\n * opacity: 1.0,\n * state: 'active',\n * delay: 100,\n * shrink: 0,\n * taper: false\n * }\n * ```\n *\n * @public\n */\nexport interface TLScribble {\n\t/** Unique identifier for the scribble */\n\tid: string\n\t/** Array of points that make up the scribble path */\n\tpoints: VecModel[]\n\t/** The brush size/width of the scribble stroke */\n\tsize: number\n\t/** The color of the scribble using canvas UI color types */\n\tcolor: TLCanvasUiColor\n\t/** The opacity of the scribble (0-1) */\n\topacity: number\n\t/** The current state of the scribble drawing */\n\tstate: SetValue<typeof TL_SCRIBBLE_STATES>\n\t/** Time delay in milliseconds for animation effects */\n\tdelay: number\n\t/** Amount the stroke should shrink over time (0-1) */\n\tshrink: number\n\t/** Whether the stroke should taper at the ends */\n\ttaper: boolean\n}\n\n/**\n * A validator for TLScribble objects.\n *\n * This validator ensures that scribble objects have all required properties\n * with valid types and values. It validates the points array, size constraints,\n * color types, and state values according to the scribble system requirements.\n *\n * @example\n * ```ts\n * import { scribbleValidator } from '@tldraw/tlschema'\n *\n * // Validate a scribble object\n * try {\n * const validScribble = scribbleValidator.validate({\n * id: 'scribble-1',\n * points: [{ x: 0, y: 0, z: 1 }, { x: 10, y: 10, z: 1 }],\n * size: 3,\n * color: 'black',\n * opacity: 0.8,\n * state: 'active',\n * delay: 0,\n * shrink: 0.05,\n * taper: true\n * })\n * console.log('Valid scribble:', validScribble)\n * } catch (error) {\n * console.error('Invalid scribble:', error.message)\n * }\n * ```\n *\n * @public\n */\nexport const scribbleValidator: T.ObjectValidator<TLScribble> = T.object({\n\tid: T.string,\n\tpoints: T.arrayOf(vecModelValidator),\n\tsize: T.positiveNumber,\n\tcolor: canvasUiColorTypeValidator,\n\topacity: T.number,\n\tstate: T.setEnum(TL_SCRIBBLE_STATES),\n\tdelay: T.number,\n\tshrink: T.number,\n\ttaper: T.boolean,\n})\n"],
5
+ "mappings": "AAAA,SAAS,SAAS;AAElB,SAA0B,kCAAkC;AAC5D,SAAmB,yBAAyB;AA4BrC,MAAM,qBAAqB,oBAAI,IAAI,CAAC,YAAY,UAAU,UAAU,UAAU,CAAU;AAiGxF,MAAM,oBAAmD,EAAE,OAAO;AAAA,EACxE,IAAI,EAAE;AAAA,EACN,QAAQ,EAAE,QAAQ,iBAAiB;AAAA,EACnC,MAAM,EAAE;AAAA,EACR,OAAO;AAAA,EACP,SAAS,EAAE;AAAA,EACX,OAAO,EAAE,QAAQ,kBAAkB;AAAA,EACnC,OAAO,EAAE;AAAA,EACT,QAAQ,EAAE;AAAA,EACV,OAAO,EAAE;AACV,CAAC;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/misc/geometry-types.ts"],
4
- "sourcesContent": ["import { T } from '@tldraw/validate'\n\n/**\n * A serializable model for 2D boxes.\n *\n * @public */\nexport interface BoxModel {\n\tx: number\n\ty: number\n\tw: number\n\th: number\n}\n\n/**\n * A serializable model for 2D vectors.\n *\n * @public */\nexport interface VecModel {\n\tx: number\n\ty: number\n\tz?: number\n}\n\n/** @public */\nexport const vecModelValidator: T.ObjectValidator<VecModel> = T.object({\n\tx: T.number,\n\ty: T.number,\n\tz: T.number.optional(),\n})\n\n/** @public */\nexport const boxModelValidator: T.ObjectValidator<BoxModel> = T.object({\n\tx: T.number,\n\ty: T.number,\n\tw: T.number,\n\th: T.number,\n})\n"],
5
- "mappings": "AAAA,SAAS,SAAS;AAwBX,MAAM,oBAAiD,EAAE,OAAO;AAAA,EACtE,GAAG,EAAE;AAAA,EACL,GAAG,EAAE;AAAA,EACL,GAAG,EAAE,OAAO,SAAS;AACtB,CAAC;AAGM,MAAM,oBAAiD,EAAE,OAAO;AAAA,EACtE,GAAG,EAAE;AAAA,EACL,GAAG,EAAE;AAAA,EACL,GAAG,EAAE;AAAA,EACL,GAAG,EAAE;AACN,CAAC;",
4
+ "sourcesContent": ["import { T } from '@tldraw/validate'\n\n/**\n * A serializable model for 2D boxes.\n *\n * @public */\nexport interface BoxModel {\n\tx: number\n\ty: number\n\tw: number\n\th: number\n}\n\n/**\n * A serializable model for 2D vectors.\n *\n * @public */\nexport interface VecModel {\n\tx: number\n\ty: number\n\tz?: number\n}\n\n/**\n * Validator for VecModel objects that ensures they have numeric x and y coordinates,\n * with an optional z coordinate for 3D vectors. Used throughout the schema to\n * validate point and vector data structures.\n *\n * @public\n * @example\n * ```ts\n * const vector2D = { x: 10, y: 20 }\n * const isValid = vecModelValidator.check(vector2D) // true\n *\n * const vector3D = { x: 10, y: 20, z: 30 }\n * const isValid3D = vecModelValidator.check(vector3D) // true\n * ```\n */\nexport const vecModelValidator: T.ObjectValidator<VecModel> = T.object({\n\tx: T.number,\n\ty: T.number,\n\tz: T.number.optional(),\n})\n\n/**\n * Validator for BoxModel objects that ensures they have numeric x, y coordinates\n * for position and w, h values for width and height. Used throughout the schema\n * to validate bounding box and rectangular area data structures.\n *\n * @public\n * @example\n * ```ts\n * const box = { x: 10, y: 20, w: 100, h: 50 }\n * const isValid = boxModelValidator.check(box) // true\n *\n * const invalidBox = { x: 10, y: 20, w: -5, h: 50 }\n * const isValidNegative = boxModelValidator.check(invalidBox) // true (validator allows negative values)\n * ```\n */\nexport const boxModelValidator: T.ObjectValidator<BoxModel> = T.object({\n\tx: T.number,\n\ty: T.number,\n\tw: T.number,\n\th: T.number,\n})\n"],
5
+ "mappings": "AAAA,SAAS,SAAS;AAsCX,MAAM,oBAAiD,EAAE,OAAO;AAAA,EACtE,GAAG,EAAE;AAAA,EACL,GAAG,EAAE;AAAA,EACL,GAAG,EAAE,OAAO,SAAS;AACtB,CAAC;AAiBM,MAAM,oBAAiD,EAAE,OAAO;AAAA,EACtE,GAAG,EAAE;AAAA,EACL,GAAG,EAAE;AAAA,EACL,GAAG,EAAE;AAAA,EACL,GAAG,EAAE;AACN,CAAC;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/misc/id-validator.ts"],
4
- "sourcesContent": ["import type { RecordId, UnknownRecord } from '@tldraw/store'\nimport { T } from '@tldraw/validate'\n\n/** @public */\nexport function idValidator<Id extends RecordId<UnknownRecord>>(\n\tprefix: Id['__type__']['typeName']\n): T.Validator<Id> {\n\treturn T.string.refine((id) => {\n\t\tif (!id.startsWith(`${prefix}:`)) {\n\t\t\tthrow new Error(`${prefix} ID must start with \"${prefix}:\"`)\n\t\t}\n\t\treturn id as Id\n\t})\n}\n"],
5
- "mappings": "AACA,SAAS,SAAS;AAGX,SAAS,YACf,QACkB;AAClB,SAAO,EAAE,OAAO,OAAO,CAAC,OAAO;AAC9B,QAAI,CAAC,GAAG,WAAW,GAAG,MAAM,GAAG,GAAG;AACjC,YAAM,IAAI,MAAM,GAAG,MAAM,wBAAwB,MAAM,IAAI;AAAA,IAC5D;AACA,WAAO;AAAA,EACR,CAAC;AACF;",
4
+ "sourcesContent": ["import type { RecordId, UnknownRecord } from '@tldraw/store'\nimport { T } from '@tldraw/validate'\n\n/**\n * Creates a validator for typed record IDs that ensures they follow the correct\n * format with the specified prefix. Record IDs in tldraw follow the pattern\n * \"prefix:identifier\" where the prefix indicates the record type.\n *\n * @param prefix - The required prefix for the ID (e.g., 'shape', 'page', 'asset')\n * @returns A validator that checks the ID format and returns the typed ID\n * @public\n * @example\n * ```ts\n * const shapeIdValidator = idValidator<TLShapeId>('shape')\n * const validId = shapeIdValidator.validate('shape:abc123') // Returns 'shape:abc123' as TLShapeId\n *\n * const pageIdValidator = idValidator<TLPageId>('page')\n * const pageId = pageIdValidator.validate('page:main') // Returns 'page:main' as TLPageId\n *\n * // This would throw an error:\n * // shapeIdValidator.validate('page:abc123') // Error: shape ID must start with \"shape:\"\n * ```\n */\nexport function idValidator<Id extends RecordId<UnknownRecord>>(\n\tprefix: Id['__type__']['typeName']\n): T.Validator<Id> {\n\treturn T.string.refine((id) => {\n\t\tif (!id.startsWith(`${prefix}:`)) {\n\t\t\tthrow new Error(`${prefix} ID must start with \"${prefix}:\"`)\n\t\t}\n\t\treturn id as Id\n\t})\n}\n"],
5
+ "mappings": "AACA,SAAS,SAAS;AAsBX,SAAS,YACf,QACkB;AAClB,SAAO,EAAE,OAAO,OAAO,CAAC,OAAO;AAC9B,QAAI,CAAC,GAAG,WAAW,GAAG,MAAM,GAAG,GAAG;AACjC,YAAM,IAAI,MAAM,GAAG,MAAM,wBAAwB,MAAM,IAAI;AAAA,IAC5D;AACA,WAAO;AAAA,EACR,CAAC;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/records/TLAsset.ts"],
4
- "sourcesContent": ["import {\n\tcreateMigrationIds,\n\tcreateRecordMigrationSequence,\n\tcreateRecordType,\n\tRecordId,\n} from '@tldraw/store'\nimport { T } from '@tldraw/validate'\nimport { TLBaseAsset } from '../assets/TLBaseAsset'\nimport { bookmarkAssetValidator, TLBookmarkAsset } from '../assets/TLBookmarkAsset'\nimport { imageAssetValidator, TLImageAsset } from '../assets/TLImageAsset'\nimport { TLVideoAsset, videoAssetValidator } from '../assets/TLVideoAsset'\nimport { TLShape } from './TLShape'\n\n/** @public */\nexport type TLAsset = TLImageAsset | TLVideoAsset | TLBookmarkAsset\n\n/** @public */\nexport const assetValidator: T.Validator<TLAsset> = T.model(\n\t'asset',\n\tT.union('type', {\n\t\timage: imageAssetValidator,\n\t\tvideo: videoAssetValidator,\n\t\tbookmark: bookmarkAssetValidator,\n\t})\n)\n\n/** @public */\nexport const assetVersions = createMigrationIds('com.tldraw.asset', {\n\tAddMeta: 1,\n} as const)\n\n/** @public */\nexport const assetMigrations = createRecordMigrationSequence({\n\tsequenceId: 'com.tldraw.asset',\n\trecordType: 'asset',\n\tsequence: [\n\t\t{\n\t\t\tid: assetVersions.AddMeta,\n\t\t\tup: (record) => {\n\t\t\t\t;(record as any).meta = {}\n\t\t\t},\n\t\t},\n\t],\n})\n\n/** @public */\nexport type TLAssetPartial<T extends TLAsset = TLAsset> = T extends T\n\t? {\n\t\t\tid: TLAssetId\n\t\t\ttype: T['type']\n\t\t\tprops?: Partial<T['props']>\n\t\t\tmeta?: Partial<T['meta']>\n\t\t} & Partial<Omit<T, 'type' | 'id' | 'props' | 'meta'>>\n\t: never\n\n/** @public */\nexport const AssetRecordType = createRecordType<TLAsset>('asset', {\n\tvalidator: assetValidator,\n\tscope: 'document',\n}).withDefaultProperties(() => ({\n\tmeta: {},\n}))\n\n/** @public */\nexport type TLAssetId = RecordId<TLBaseAsset<any, any>>\n\n/** @public */\nexport type TLAssetShape = Extract<TLShape, { props: { assetId: TLAssetId } }>\n"],
5
- "mappings": "AAAA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAEM;AACP,SAAS,SAAS;AAElB,SAAS,8BAA+C;AACxD,SAAS,2BAAyC;AAClD,SAAuB,2BAA2B;AAO3C,MAAM,iBAAuC,EAAE;AAAA,EACrD;AAAA,EACA,EAAE,MAAM,QAAQ;AAAA,IACf,OAAO;AAAA,IACP,OAAO;AAAA,IACP,UAAU;AAAA,EACX,CAAC;AACF;AAGO,MAAM,gBAAgB,mBAAmB,oBAAoB;AAAA,EACnE,SAAS;AACV,CAAU;AAGH,MAAM,kBAAkB,8BAA8B;AAAA,EAC5D,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,UAAU;AAAA,IACT;AAAA,MACC,IAAI,cAAc;AAAA,MAClB,IAAI,CAAC,WAAW;AACf;AAAC,QAAC,OAAe,OAAO,CAAC;AAAA,MAC1B;AAAA,IACD;AAAA,EACD;AACD,CAAC;AAaM,MAAM,kBAAkB,iBAA0B,SAAS;AAAA,EACjE,WAAW;AAAA,EACX,OAAO;AACR,CAAC,EAAE,sBAAsB,OAAO;AAAA,EAC/B,MAAM,CAAC;AACR,EAAE;",
4
+ "sourcesContent": ["import {\n\tcreateMigrationIds,\n\tcreateRecordMigrationSequence,\n\tcreateRecordType,\n\tRecordId,\n} from '@tldraw/store'\nimport { T } from '@tldraw/validate'\nimport { TLBaseAsset } from '../assets/TLBaseAsset'\nimport { bookmarkAssetValidator, TLBookmarkAsset } from '../assets/TLBookmarkAsset'\nimport { imageAssetValidator, TLImageAsset } from '../assets/TLImageAsset'\nimport { TLVideoAsset, videoAssetValidator } from '../assets/TLVideoAsset'\nimport { TLShape } from './TLShape'\n\n/**\n * Union type representing all possible asset types in tldraw.\n * Assets represent external resources like images, videos, or bookmarks that can be referenced by shapes.\n *\n * @example\n * ```ts\n * const imageAsset: TLAsset = {\n * id: 'asset:image123',\n * typeName: 'asset',\n * type: 'image',\n * props: {\n * src: 'https://example.com/image.jpg',\n * w: 800,\n * h: 600,\n * mimeType: 'image/jpeg',\n * isAnimated: false\n * },\n * meta: {}\n * }\n * ```\n *\n * @public\n */\nexport type TLAsset = TLImageAsset | TLVideoAsset | TLBookmarkAsset\n\n/**\n * Validator for TLAsset records that ensures runtime type safety.\n * Uses a discriminated union based on the 'type' field to validate different asset types.\n *\n * @example\n * ```ts\n * // Validation happens automatically when assets are stored\n * try {\n * const validatedAsset = assetValidator.validate(assetData)\n * store.put([validatedAsset])\n * } catch (error) {\n * console.error('Asset validation failed:', error.message)\n * }\n * ```\n *\n * @public\n */\nexport const assetValidator: T.Validator<TLAsset> = T.model(\n\t'asset',\n\tT.union('type', {\n\t\timage: imageAssetValidator,\n\t\tvideo: videoAssetValidator,\n\t\tbookmark: bookmarkAssetValidator,\n\t})\n)\n\n/**\n * Migration version identifiers for asset record schema evolution.\n * Each version represents a breaking change that requires data migration.\n *\n * @example\n * ```ts\n * // Check if a migration is needed\n * const needsMigration = currentVersion < assetVersions.AddMeta\n * ```\n *\n * @public\n */\nexport const assetVersions = createMigrationIds('com.tldraw.asset', {\n\tAddMeta: 1,\n} as const)\n\n/**\n * Migration sequence for evolving asset record structure over time.\n * Handles converting asset records from older schema versions to current format.\n *\n * @example\n * ```ts\n * // Migration is applied automatically when loading old documents\n * const migratedStore = migrator.migrateStoreSnapshot({\n * schema: oldSchema,\n * store: oldStoreSnapshot\n * })\n * ```\n *\n * @public\n */\nexport const assetMigrations = createRecordMigrationSequence({\n\tsequenceId: 'com.tldraw.asset',\n\trecordType: 'asset',\n\tsequence: [\n\t\t{\n\t\t\tid: assetVersions.AddMeta,\n\t\t\tup: (record) => {\n\t\t\t\t;(record as any).meta = {}\n\t\t\t},\n\t\t},\n\t],\n})\n\n/**\n * Partial type for TLAsset allowing optional properties except id and type.\n * Useful for creating or updating assets where not all properties need to be specified.\n *\n * @example\n * ```ts\n * // Create a partial asset for updating\n * const partialAsset: TLAssetPartial<TLImageAsset> = {\n * id: 'asset:image123',\n * type: 'image',\n * props: {\n * w: 800 // Only updating width\n * }\n * }\n *\n * // Use in asset updates\n * editor.updateAssets([partialAsset])\n * ```\n *\n * @public\n */\nexport type TLAssetPartial<T extends TLAsset = TLAsset> = T extends T\n\t? {\n\t\t\tid: TLAssetId\n\t\t\ttype: T['type']\n\t\t\tprops?: Partial<T['props']>\n\t\t\tmeta?: Partial<T['meta']>\n\t\t} & Partial<Omit<T, 'type' | 'id' | 'props' | 'meta'>>\n\t: never\n\n/**\n * Record type definition for TLAsset with validation and default properties.\n * Configures assets as document-scoped records that persist across sessions.\n *\n * @example\n * ```ts\n * // Create a new asset record\n * const assetRecord = AssetRecordType.create({\n * id: 'asset:image123',\n * type: 'image',\n * props: {\n * src: 'https://example.com/image.jpg',\n * w: 800,\n * h: 600,\n * mimeType: 'image/jpeg',\n * isAnimated: false\n * }\n * })\n *\n * // Store the asset\n * store.put([assetRecord])\n * ```\n *\n * @public\n */\nexport const AssetRecordType = createRecordType<TLAsset>('asset', {\n\tvalidator: assetValidator,\n\tscope: 'document',\n}).withDefaultProperties(() => ({\n\tmeta: {},\n}))\n\n/**\n * Branded string type for asset record identifiers.\n * Prevents mixing asset IDs with other types of record IDs at compile time.\n *\n * @example\n * ```ts\n * import { createAssetId } from '@tldraw/tlschema'\n *\n * // Create a new asset ID\n * const assetId: TLAssetId = createAssetId()\n *\n * // Use in asset records\n * const asset: TLAsset = {\n * id: assetId,\n * // ... other properties\n * }\n *\n * // Reference in shapes\n * const imageShape: TLImageShape = {\n * props: {\n * assetId: assetId,\n * // ... other properties\n * }\n * }\n * ```\n *\n * @public\n */\nexport type TLAssetId = RecordId<TLBaseAsset<any, any>>\n\n/**\n * Union type of all shapes that reference assets through an assetId property.\n * Includes image shapes, video shapes, and any other shapes that depend on external assets.\n *\n * @example\n * ```ts\n * // Function that works with any asset-based shape\n * function handleAssetShape(shape: TLAssetShape) {\n * const assetId = shape.props.assetId\n * if (assetId) {\n * const asset = editor.getAsset(assetId)\n * // Handle the asset...\n * }\n * }\n *\n * // Use with image or video shapes\n * const imageShape: TLImageShape = { props: { assetId: 'asset:img1' } }\n * const videoShape: TLVideoShape = { props: { assetId: 'asset:vid1' } }\n * handleAssetShape(imageShape) // Works\n * handleAssetShape(videoShape) // Works\n * ```\n *\n * @public\n */\nexport type TLAssetShape = Extract<TLShape, { props: { assetId: TLAssetId } }>\n"],
5
+ "mappings": "AAAA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAEM;AACP,SAAS,SAAS;AAElB,SAAS,8BAA+C;AACxD,SAAS,2BAAyC;AAClD,SAAuB,2BAA2B;AA6C3C,MAAM,iBAAuC,EAAE;AAAA,EACrD;AAAA,EACA,EAAE,MAAM,QAAQ;AAAA,IACf,OAAO;AAAA,IACP,OAAO;AAAA,IACP,UAAU;AAAA,EACX,CAAC;AACF;AAcO,MAAM,gBAAgB,mBAAmB,oBAAoB;AAAA,EACnE,SAAS;AACV,CAAU;AAiBH,MAAM,kBAAkB,8BAA8B;AAAA,EAC5D,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,UAAU;AAAA,IACT;AAAA,MACC,IAAI,cAAc;AAAA,MAClB,IAAI,CAAC,WAAW;AACf;AAAC,QAAC,OAAe,OAAO,CAAC;AAAA,MAC1B;AAAA,IACD;AAAA,EACD;AACD,CAAC;AAyDM,MAAM,kBAAkB,iBAA0B,SAAS;AAAA,EACjE,WAAW;AAAA,EACX,OAAO;AACR,CAAC,EAAE,sBAAsB,OAAO;AAAA,EAC/B,MAAM,CAAC;AACR,EAAE;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/records/TLBinding.ts"],
4
- "sourcesContent": ["import {\n\tRecordId,\n\tUnknownRecord,\n\tcreateMigrationIds,\n\tcreateRecordMigrationSequence,\n\tcreateRecordType,\n} from '@tldraw/store'\nimport { Expand, mapObjectMapValues, uniqueId } from '@tldraw/utils'\nimport { T } from '@tldraw/validate'\nimport { TLArrowBinding } from '../bindings/TLArrowBinding'\nimport { TLBaseBinding, createBindingValidator } from '../bindings/TLBaseBinding'\nimport { SchemaPropsInfo } from '../createTLSchema'\nimport { TLPropsMigrations } from '../recordsWithProps'\n\n/**\n * The default set of bindings that are available in the editor.\n *\n * @public */\nexport type TLDefaultBinding = TLArrowBinding\n\n/**\n * A type for a binding that is available in the editor but whose type is\n * unknown\u2014either one of the editor's default bindings or else a custom binding.\n *\n * @public */\nexport type TLUnknownBinding = TLBaseBinding<string, object>\n\n/**\n * The set of all bindings that are available in the editor, including unknown bindings.\n *\n * @public\n */\nexport type TLBinding = TLDefaultBinding | TLUnknownBinding\n\n/** @public */\nexport type TLBindingUpdate<T extends TLBinding = TLBinding> = Expand<{\n\tid: TLBindingId\n\ttype: T['type']\n\ttypeName?: T['typeName']\n\tfromId?: T['fromId']\n\ttoId?: T['toId']\n\tprops?: Partial<T['props']>\n\tmeta?: Partial<T['meta']>\n}>\n\n/** @public */\nexport type TLBindingCreate<T extends TLBinding = TLBinding> = Expand<{\n\tid?: TLBindingId\n\ttype: T['type']\n\ttypeName?: T['typeName']\n\tfromId: T['fromId']\n\ttoId: T['toId']\n\tprops?: Partial<T['props']>\n\tmeta?: Partial<T['meta']>\n}>\n\n/**\n * An ID for a {@link TLBinding}.\n *\n * @public\n */\nexport type TLBindingId = RecordId<TLUnknownBinding>\n\n/** @public */\nexport const rootBindingVersions = createMigrationIds('com.tldraw.binding', {} as const)\n\n/** @public */\nexport const rootBindingMigrations = createRecordMigrationSequence({\n\tsequenceId: 'com.tldraw.binding',\n\trecordType: 'binding',\n\tsequence: [],\n})\n\n/** @public */\nexport function isBinding(record?: UnknownRecord): record is TLBinding {\n\tif (!record) return false\n\treturn record.typeName === 'binding'\n}\n\n/** @public */\nexport function isBindingId(id?: string): id is TLBindingId {\n\tif (!id) return false\n\treturn id.startsWith('binding:')\n}\n\n/** @public */\nexport function createBindingId(id?: string): TLBindingId {\n\treturn `binding:${id ?? uniqueId()}` as TLBindingId\n}\n\n/**\n * @public\n */\nexport function createBindingPropsMigrationSequence(\n\tmigrations: TLPropsMigrations\n): TLPropsMigrations {\n\treturn migrations\n}\n\n/**\n * @public\n */\nexport function createBindingPropsMigrationIds<S extends string, T extends Record<string, number>>(\n\tbindingType: S,\n\tids: T\n): { [k in keyof T]: `com.tldraw.binding.${S}/${T[k]}` } {\n\treturn mapObjectMapValues(ids, (_k, v) => `com.tldraw.binding.${bindingType}/${v}`) as any\n}\n\n/** @internal */\nexport function createBindingRecordType(bindings: Record<string, SchemaPropsInfo>) {\n\treturn createRecordType<TLBinding>('binding', {\n\t\tscope: 'document',\n\t\tvalidator: T.model(\n\t\t\t'binding',\n\t\t\tT.union(\n\t\t\t\t'type',\n\t\t\t\tmapObjectMapValues(bindings, (type, { props, meta }) =>\n\t\t\t\t\tcreateBindingValidator(type, props, meta)\n\t\t\t\t)\n\t\t\t)\n\t\t),\n\t}).withDefaultProperties(() => ({\n\t\tmeta: {},\n\t}))\n}\n"],
5
- "mappings": "AAAA;AAAA,EAGC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAiB,oBAAoB,gBAAgB;AACrD,SAAS,SAAS;AAElB,SAAwB,8BAA8B;AAsD/C,MAAM,sBAAsB,mBAAmB,sBAAsB,CAAC,CAAU;AAGhF,MAAM,wBAAwB,8BAA8B;AAAA,EAClE,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,UAAU,CAAC;AACZ,CAAC;AAGM,SAAS,UAAU,QAA6C;AACtE,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO,OAAO,aAAa;AAC5B;AAGO,SAAS,YAAY,IAAgC;AAC3D,MAAI,CAAC,GAAI,QAAO;AAChB,SAAO,GAAG,WAAW,UAAU;AAChC;AAGO,SAAS,gBAAgB,IAA0B;AACzD,SAAO,WAAW,MAAM,SAAS,CAAC;AACnC;AAKO,SAAS,oCACf,YACoB;AACpB,SAAO;AACR;AAKO,SAAS,+BACf,aACA,KACwD;AACxD,SAAO,mBAAmB,KAAK,CAAC,IAAI,MAAM,sBAAsB,WAAW,IAAI,CAAC,EAAE;AACnF;AAGO,SAAS,wBAAwB,UAA2C;AAClF,SAAO,iBAA4B,WAAW;AAAA,IAC7C,OAAO;AAAA,IACP,WAAW,EAAE;AAAA,MACZ;AAAA,MACA,EAAE;AAAA,QACD;AAAA,QACA;AAAA,UAAmB;AAAA,UAAU,CAAC,MAAM,EAAE,OAAO,KAAK,MACjD,uBAAuB,MAAM,OAAO,IAAI;AAAA,QACzC;AAAA,MACD;AAAA,IACD;AAAA,EACD,CAAC,EAAE,sBAAsB,OAAO;AAAA,IAC/B,MAAM,CAAC;AAAA,EACR,EAAE;AACH;",
4
+ "sourcesContent": ["import {\n\tRecordId,\n\tUnknownRecord,\n\tcreateMigrationIds,\n\tcreateRecordMigrationSequence,\n\tcreateRecordType,\n} from '@tldraw/store'\nimport { Expand, mapObjectMapValues, uniqueId } from '@tldraw/utils'\nimport { T } from '@tldraw/validate'\nimport { TLArrowBinding } from '../bindings/TLArrowBinding'\nimport { TLBaseBinding, createBindingValidator } from '../bindings/TLBaseBinding'\nimport { SchemaPropsInfo } from '../createTLSchema'\nimport { TLPropsMigrations } from '../recordsWithProps'\n\n/**\n * The default set of bindings that are available in the editor.\n * Currently includes only arrow bindings, but can be extended with custom bindings.\n *\n * @example\n * ```ts\n * // Arrow binding connects an arrow to shapes\n * const arrowBinding: TLDefaultBinding = {\n * id: 'binding:arrow1',\n * typeName: 'binding',\n * type: 'arrow',\n * fromId: 'shape:arrow1',\n * toId: 'shape:rectangle1',\n * props: {\n * terminal: 'end',\n * normalizedAnchor: { x: 0.5, y: 0.5 },\n * isExact: false,\n * isPrecise: true\n * }\n * }\n * ```\n *\n * @public\n */\nexport type TLDefaultBinding = TLArrowBinding\n\n/**\n * A type for a binding that is available in the editor but whose type is\n * unknown\u2014either one of the editor's default bindings or else a custom binding.\n * Used internally for type-safe handling of bindings with unknown structure.\n *\n * @example\n * ```ts\n * // Function that works with any binding type\n * function processBinding(binding: TLUnknownBinding) {\n * console.log(`Processing ${binding.type} binding from ${binding.fromId} to ${binding.toId}`)\n * // Handle binding properties generically\n * }\n * ```\n *\n * @public\n */\nexport type TLUnknownBinding = TLBaseBinding<string, object>\n\n/**\n * The set of all bindings that are available in the editor, including unknown bindings.\n * Bindings represent relationships between shapes, such as arrows connecting to other shapes.\n *\n * @example\n * ```ts\n * // Check binding type and handle accordingly\n * function handleBinding(binding: TLBinding) {\n * switch (binding.type) {\n * case 'arrow':\n * // Handle arrow binding\n * break\n * default:\n * // Handle unknown custom binding\n * break\n * }\n * }\n * ```\n *\n * @public\n */\nexport type TLBinding = TLDefaultBinding | TLUnknownBinding\n\n/**\n * Type for updating existing bindings with partial properties.\n * Only the id and type are required, all other properties are optional.\n *\n * @example\n * ```ts\n * // Update arrow binding properties\n * const bindingUpdate: TLBindingUpdate<TLArrowBinding> = {\n * id: 'binding:arrow1',\n * type: 'arrow',\n * props: {\n * normalizedAnchor: { x: 0.7, y: 0.3 } // Only update anchor position\n * }\n * }\n *\n * editor.updateBindings([bindingUpdate])\n * ```\n *\n * @public\n */\nexport type TLBindingUpdate<T extends TLBinding = TLBinding> = Expand<{\n\tid: TLBindingId\n\ttype: T['type']\n\ttypeName?: T['typeName']\n\tfromId?: T['fromId']\n\ttoId?: T['toId']\n\tprops?: Partial<T['props']>\n\tmeta?: Partial<T['meta']>\n}>\n\n/**\n * Type for creating new bindings with required fromId and toId.\n * The id is optional and will be generated if not provided.\n *\n * @example\n * ```ts\n * // Create a new arrow binding\n * const newBinding: TLBindingCreate<TLArrowBinding> = {\n * type: 'arrow',\n * fromId: 'shape:arrow1',\n * toId: 'shape:rectangle1',\n * props: {\n * terminal: 'end',\n * normalizedAnchor: { x: 0.5, y: 0.5 },\n * isExact: false,\n * isPrecise: true\n * }\n * }\n *\n * editor.createBindings([newBinding])\n * ```\n *\n * @public\n */\nexport type TLBindingCreate<T extends TLBinding = TLBinding> = Expand<{\n\tid?: TLBindingId\n\ttype: T['type']\n\ttypeName?: T['typeName']\n\tfromId: T['fromId']\n\ttoId: T['toId']\n\tprops?: Partial<T['props']>\n\tmeta?: Partial<T['meta']>\n}>\n\n/**\n * Branded string type for binding record identifiers.\n * Prevents mixing binding IDs with other types of record IDs at compile time.\n *\n * @example\n * ```ts\n * import { createBindingId } from '@tldraw/tlschema'\n *\n * // Create a new binding ID\n * const bindingId: TLBindingId = createBindingId()\n *\n * // Use in binding records\n * const binding: TLBinding = {\n * id: bindingId,\n * type: 'arrow',\n * fromId: 'shape:arrow1',\n * toId: 'shape:rectangle1',\n * // ... other properties\n * }\n * ```\n *\n * @public\n */\nexport type TLBindingId = RecordId<TLUnknownBinding>\n\n/**\n * Migration version identifiers for the root binding record schema.\n * Currently empty as no migrations have been applied to the base binding structure.\n *\n * @example\n * ```ts\n * // Future migrations would be defined here\n * const rootBindingVersions = createMigrationIds('com.tldraw.binding', {\n * AddNewProperty: 1,\n * } as const)\n * ```\n *\n * @public\n */\nexport const rootBindingVersions = createMigrationIds('com.tldraw.binding', {} as const)\n\n/**\n * Migration sequence for the root binding record structure.\n * Currently empty as the binding schema has not required any migrations yet.\n *\n * @example\n * ```ts\n * // Migrations would be automatically applied when loading old documents\n * const migratedStore = migrator.migrateStoreSnapshot({\n * schema: oldSchema,\n * store: oldStoreSnapshot\n * })\n * ```\n *\n * @public\n */\nexport const rootBindingMigrations = createRecordMigrationSequence({\n\tsequenceId: 'com.tldraw.binding',\n\trecordType: 'binding',\n\tsequence: [],\n})\n\n/**\n * Type guard to check if a record is a TLBinding.\n * Useful for filtering or type narrowing when working with mixed record types.\n *\n * @param record - The record to check\n * @returns True if the record is a binding, false otherwise\n *\n * @example\n * ```ts\n * // Filter bindings from mixed records\n * const allRecords = store.allRecords()\n * const bindings = allRecords.filter(isBinding)\n *\n * // Type guard usage\n * function processRecord(record: UnknownRecord) {\n * if (isBinding(record)) {\n * // record is now typed as TLBinding\n * console.log(`Binding from ${record.fromId} to ${record.toId}`)\n * }\n * }\n * ```\n *\n * @public\n */\nexport function isBinding(record?: UnknownRecord): record is TLBinding {\n\tif (!record) return false\n\treturn record.typeName === 'binding'\n}\n\n/**\n * Type guard to check if a string is a valid TLBindingId.\n * Validates that the ID follows the correct format for binding identifiers.\n *\n * @param id - The string to check\n * @returns True if the string is a valid binding ID, false otherwise\n *\n * @example\n * ```ts\n * // Validate binding IDs\n * const maybeBindingId = 'binding:abc123'\n * if (isBindingId(maybeBindingId)) {\n * // maybeBindingId is now typed as TLBindingId\n * const binding = store.get(maybeBindingId)\n * }\n *\n * // Filter binding IDs from mixed ID array\n * const mixedIds = ['shape:1', 'binding:2', 'page:3']\n * const bindingIds = mixedIds.filter(isBindingId)\n * ```\n *\n * @public\n */\nexport function isBindingId(id?: string): id is TLBindingId {\n\tif (!id) return false\n\treturn id.startsWith('binding:')\n}\n\n/**\n * Creates a new TLBindingId with proper formatting.\n * Generates a unique ID if none is provided, or formats a provided ID correctly.\n *\n * @param id - Optional custom ID suffix. If not provided, a unique ID is generated\n * @returns A properly formatted binding ID\n *\n * @example\n * ```ts\n * // Create with auto-generated ID\n * const bindingId1 = createBindingId() // 'binding:abc123'\n *\n * // Create with custom ID\n * const bindingId2 = createBindingId('myCustomBinding') // 'binding:myCustomBinding'\n *\n * // Use in binding creation\n * const binding: TLBinding = {\n * id: createBindingId(),\n * type: 'arrow',\n * fromId: 'shape:arrow1',\n * toId: 'shape:rectangle1',\n * // ... other properties\n * }\n * ```\n *\n * @public\n */\nexport function createBindingId(id?: string): TLBindingId {\n\treturn `binding:${id ?? uniqueId()}` as TLBindingId\n}\n\n/**\n * Creates a migration sequence for binding properties.\n * This is a pass-through function that validates and returns the provided migrations.\n *\n * @param migrations - The migration sequence for binding properties\n * @returns The validated migration sequence\n *\n * @example\n * ```ts\n * // Define migrations for custom binding properties\n * const myBindingMigrations = createBindingPropsMigrationSequence({\n * sequence: [\n * {\n * id: 'com.myapp.binding.custom/1.0.0',\n * up: (props) => ({ ...props, newProperty: 'default' }),\n * down: ({ newProperty, ...props }) => props\n * }\n * ]\n * })\n * ```\n *\n * @public\n */\nexport function createBindingPropsMigrationSequence(\n\tmigrations: TLPropsMigrations\n): TLPropsMigrations {\n\treturn migrations\n}\n\n/**\n * Creates properly formatted migration IDs for binding property migrations.\n * Follows the convention: 'com.tldraw.binding.\\{bindingType\\}/\\{version\\}'\n *\n * @param bindingType - The type of binding these migrations apply to\n * @param ids - Object mapping migration names to version numbers\n * @returns Object with formatted migration IDs\n *\n * @example\n * ```ts\n * // Create migration IDs for custom binding\n * const myBindingVersions = createBindingPropsMigrationIds('myCustomBinding', {\n * AddNewProperty: 1,\n * UpdateProperty: 2\n * })\n *\n * // Result:\n * // {\n * // AddNewProperty: 'com.tldraw.binding.myCustomBinding/1',\n * // UpdateProperty: 'com.tldraw.binding.myCustomBinding/2'\n * // }\n * ```\n *\n * @public\n */\nexport function createBindingPropsMigrationIds<S extends string, T extends Record<string, number>>(\n\tbindingType: S,\n\tids: T\n): { [k in keyof T]: `com.tldraw.binding.${S}/${T[k]}` } {\n\treturn mapObjectMapValues(ids, (_k, v) => `com.tldraw.binding.${bindingType}/${v}`) as any\n}\n\n/**\n * Creates a record type for TLBinding with validation based on the provided binding schemas.\n * This function is used internally to configure the binding record type in the schema.\n *\n * @param bindings - Record mapping binding type names to their schema information\n * @returns A configured record type for bindings with validation\n *\n * @example\n * ```ts\n * // Used internally when creating schemas\n * const bindingRecordType = createBindingRecordType({\n * arrow: {\n * props: arrowBindingProps,\n * meta: arrowBindingMeta\n * }\n * })\n * ```\n *\n * @internal\n */\nexport function createBindingRecordType(bindings: Record<string, SchemaPropsInfo>) {\n\treturn createRecordType<TLBinding>('binding', {\n\t\tscope: 'document',\n\t\tvalidator: T.model(\n\t\t\t'binding',\n\t\t\tT.union(\n\t\t\t\t'type',\n\t\t\t\tmapObjectMapValues(bindings, (type, { props, meta }) =>\n\t\t\t\t\tcreateBindingValidator(type, props, meta)\n\t\t\t\t)\n\t\t\t)\n\t\t),\n\t}).withDefaultProperties(() => ({\n\t\tmeta: {},\n\t}))\n}\n"],
5
+ "mappings": "AAAA;AAAA,EAGC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAiB,oBAAoB,gBAAgB;AACrD,SAAS,SAAS;AAElB,SAAwB,8BAA8B;AA8K/C,MAAM,sBAAsB,mBAAmB,sBAAsB,CAAC,CAAU;AAiBhF,MAAM,wBAAwB,8BAA8B;AAAA,EAClE,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,UAAU,CAAC;AACZ,CAAC;AA0BM,SAAS,UAAU,QAA6C;AACtE,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO,OAAO,aAAa;AAC5B;AAyBO,SAAS,YAAY,IAAgC;AAC3D,MAAI,CAAC,GAAI,QAAO;AAChB,SAAO,GAAG,WAAW,UAAU;AAChC;AA6BO,SAAS,gBAAgB,IAA0B;AACzD,SAAO,WAAW,MAAM,SAAS,CAAC;AACnC;AAyBO,SAAS,oCACf,YACoB;AACpB,SAAO;AACR;AA2BO,SAAS,+BACf,aACA,KACwD;AACxD,SAAO,mBAAmB,KAAK,CAAC,IAAI,MAAM,sBAAsB,WAAW,IAAI,CAAC,EAAE;AACnF;AAsBO,SAAS,wBAAwB,UAA2C;AAClF,SAAO,iBAA4B,WAAW;AAAA,IAC7C,OAAO;AAAA,IACP,WAAW,EAAE;AAAA,MACZ;AAAA,MACA,EAAE;AAAA,QACD;AAAA,QACA;AAAA,UAAmB;AAAA,UAAU,CAAC,MAAM,EAAE,OAAO,KAAK,MACjD,uBAAuB,MAAM,OAAO,IAAI;AAAA,QACzC;AAAA,MACD;AAAA,IACD;AAAA,EACD,CAAC,EAAE,sBAAsB,OAAO;AAAA,IAC/B,MAAM,CAAC;AAAA,EACR,EAAE;AACH;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/records/TLCamera.ts"],
4
- "sourcesContent": ["import {\n\tBaseRecord,\n\tcreateMigrationIds,\n\tcreateRecordMigrationSequence,\n\tcreateRecordType,\n\tRecordId,\n} from '@tldraw/store'\nimport { JsonObject } from '@tldraw/utils'\nimport { T } from '@tldraw/validate'\nimport { idValidator } from '../misc/id-validator'\n\n/**\n * A camera record.\n *\n * @public\n */\nexport interface TLCamera extends BaseRecord<'camera', TLCameraId> {\n\tx: number\n\ty: number\n\tz: number\n\tmeta: JsonObject\n}\n\n/**\n * The id of a camera record.\n *\n * @public */\nexport type TLCameraId = RecordId<TLCamera>\n\n/** @public */\nexport const cameraValidator: T.Validator<TLCamera> = T.model(\n\t'camera',\n\tT.object({\n\t\ttypeName: T.literal('camera'),\n\t\tid: idValidator<TLCameraId>('camera'),\n\t\tx: T.number,\n\t\ty: T.number,\n\t\tz: T.number,\n\t\tmeta: T.jsonValue as T.ObjectValidator<JsonObject>,\n\t})\n)\n\n/** @public */\nexport const cameraVersions = createMigrationIds('com.tldraw.camera', {\n\tAddMeta: 1,\n})\n\n/** @public */\nexport const cameraMigrations = createRecordMigrationSequence({\n\tsequenceId: 'com.tldraw.camera',\n\trecordType: 'camera',\n\tsequence: [\n\t\t{\n\t\t\tid: cameraVersions.AddMeta,\n\t\t\tup: (record) => {\n\t\t\t\t;(record as any).meta = {}\n\t\t\t},\n\t\t},\n\t],\n})\n\n/** @public */\nexport const CameraRecordType = createRecordType<TLCamera>('camera', {\n\tvalidator: cameraValidator,\n\tscope: 'session',\n}).withDefaultProperties(\n\t(): Omit<TLCamera, 'id' | 'typeName'> => ({\n\t\tx: 0,\n\t\ty: 0,\n\t\tz: 1,\n\t\tmeta: {},\n\t})\n)\n"],
5
- "mappings": "AAAA;AAAA,EAEC;AAAA,EACA;AAAA,EACA;AAAA,OAEM;AAEP,SAAS,SAAS;AAClB,SAAS,mBAAmB;AAqBrB,MAAM,kBAAyC,EAAE;AAAA,EACvD;AAAA,EACA,EAAE,OAAO;AAAA,IACR,UAAU,EAAE,QAAQ,QAAQ;AAAA,IAC5B,IAAI,YAAwB,QAAQ;AAAA,IACpC,GAAG,EAAE;AAAA,IACL,GAAG,EAAE;AAAA,IACL,GAAG,EAAE;AAAA,IACL,MAAM,EAAE;AAAA,EACT,CAAC;AACF;AAGO,MAAM,iBAAiB,mBAAmB,qBAAqB;AAAA,EACrE,SAAS;AACV,CAAC;AAGM,MAAM,mBAAmB,8BAA8B;AAAA,EAC7D,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,UAAU;AAAA,IACT;AAAA,MACC,IAAI,eAAe;AAAA,MACnB,IAAI,CAAC,WAAW;AACf;AAAC,QAAC,OAAe,OAAO,CAAC;AAAA,MAC1B;AAAA,IACD;AAAA,EACD;AACD,CAAC;AAGM,MAAM,mBAAmB,iBAA2B,UAAU;AAAA,EACpE,WAAW;AAAA,EACX,OAAO;AACR,CAAC,EAAE;AAAA,EACF,OAA0C;AAAA,IACzC,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,MAAM,CAAC;AAAA,EACR;AACD;",
4
+ "sourcesContent": ["import {\n\tBaseRecord,\n\tcreateMigrationIds,\n\tcreateRecordMigrationSequence,\n\tcreateRecordType,\n\tRecordId,\n} from '@tldraw/store'\nimport { JsonObject } from '@tldraw/utils'\nimport { T } from '@tldraw/validate'\nimport { idValidator } from '../misc/id-validator'\n\n/**\n * A camera record representing the viewport's position and zoom level.\n * The camera defines what portion of the infinite canvas is visible to the user.\n *\n * @example\n * ```ts\n * const camera: TLCamera = {\n * id: 'camera:user1',\n * typeName: 'camera',\n * x: 100, // Camera x position (negative values pan right)\n * y: 50, // Camera y position (negative values pan down)\n * z: 0.5, // Zoom level (1 = 100%, 0.5 = 50%, 2 = 200%)\n * meta: {\n * userId: 'user123',\n * lastUpdated: Date.now()\n * }\n * }\n *\n * // Set camera position and zoom\n * editor.setCamera({ x: -200, y: -100, z: 1.5 })\n * ```\n *\n * @public\n */\nexport interface TLCamera extends BaseRecord<'camera', TLCameraId> {\n\t/** Camera x position. Negative values move the viewport right */\n\tx: number\n\t/** Camera y position. Negative values move the viewport down */\n\ty: number\n\t/** Zoom level. 1 = 100%, 0.5 = 50% zoom, 2 = 200% zoom */\n\tz: number\n\t/** User-defined metadata for the camera */\n\tmeta: JsonObject\n}\n\n/**\n * Branded string type for camera record identifiers.\n * Prevents mixing camera IDs with other types of record IDs at compile time.\n *\n * @example\n * ```ts\n * import { CameraRecordType } from '@tldraw/tlschema'\n *\n * // Create a camera ID (typically one per user/session)\n * const cameraId: TLCameraId = CameraRecordType.createId()\n *\n * // Use in camera records\n * const camera: TLCamera = {\n * id: cameraId,\n * typeName: 'camera',\n * x: 0, y: 0, z: 1,\n * meta: {}\n * }\n *\n * // Get camera from store\n * const currentCamera = store.get(cameraId)\n * ```\n *\n * @public\n */\nexport type TLCameraId = RecordId<TLCamera>\n\n/**\n * Validator for TLCamera records that ensures runtime type safety.\n * Validates camera position coordinates and zoom level.\n *\n * @example\n * ```ts\n * // Validation happens automatically when cameras are stored\n * try {\n * const validatedCamera = cameraValidator.validate(cameraData)\n * store.put([validatedCamera])\n * } catch (error) {\n * console.error('Camera validation failed:', error.message)\n * }\n * ```\n *\n * @public\n */\nexport const cameraValidator: T.Validator<TLCamera> = T.model(\n\t'camera',\n\tT.object({\n\t\ttypeName: T.literal('camera'),\n\t\tid: idValidator<TLCameraId>('camera'),\n\t\tx: T.number,\n\t\ty: T.number,\n\t\tz: T.number,\n\t\tmeta: T.jsonValue as T.ObjectValidator<JsonObject>,\n\t})\n)\n\n/**\n * Migration version identifiers for camera record schema evolution.\n * Each version represents a breaking change that requires data migration.\n *\n * @example\n * ```ts\n * // Check if a camera needs migration\n * const needsMigration = currentVersion < cameraVersions.AddMeta\n * ```\n *\n * @public\n */\nexport const cameraVersions = createMigrationIds('com.tldraw.camera', {\n\tAddMeta: 1,\n})\n\n/**\n * Migration sequence for evolving camera record structure over time.\n * Handles converting camera records from older schema versions to current format.\n *\n * @example\n * ```ts\n * // Migration is applied automatically when loading old documents\n * const migratedStore = migrator.migrateStoreSnapshot({\n * schema: oldSchema,\n * store: oldStoreSnapshot\n * })\n * ```\n *\n * @public\n */\nexport const cameraMigrations = createRecordMigrationSequence({\n\tsequenceId: 'com.tldraw.camera',\n\trecordType: 'camera',\n\tsequence: [\n\t\t{\n\t\t\tid: cameraVersions.AddMeta,\n\t\t\tup: (record) => {\n\t\t\t\t;(record as any).meta = {}\n\t\t\t},\n\t\t},\n\t],\n})\n\n/**\n * Record type definition for TLCamera with validation and default properties.\n * Configures cameras as session-scoped records that don't persist across sessions.\n *\n * @example\n * ```ts\n * // Create a new camera record with defaults\n * const cameraRecord = CameraRecordType.create({\n * id: 'camera:main'\n * // x: 0, y: 0, z: 1, meta: {} are applied as defaults\n * })\n *\n * // Create with custom position and zoom\n * const customCamera = CameraRecordType.create({\n * id: 'camera:user1',\n * x: -100,\n * y: -50,\n * z: 1.5,\n * meta: { userId: 'user123' }\n * })\n *\n * // Store the camera\n * store.put([cameraRecord])\n * ```\n *\n * @public\n */\nexport const CameraRecordType = createRecordType<TLCamera>('camera', {\n\tvalidator: cameraValidator,\n\tscope: 'session',\n}).withDefaultProperties(\n\t(): Omit<TLCamera, 'id' | 'typeName'> => ({\n\t\tx: 0,\n\t\ty: 0,\n\t\tz: 1,\n\t\tmeta: {},\n\t})\n)\n"],
5
+ "mappings": "AAAA;AAAA,EAEC;AAAA,EACA;AAAA,EACA;AAAA,OAEM;AAEP,SAAS,SAAS;AAClB,SAAS,mBAAmB;AAiFrB,MAAM,kBAAyC,EAAE;AAAA,EACvD;AAAA,EACA,EAAE,OAAO;AAAA,IACR,UAAU,EAAE,QAAQ,QAAQ;AAAA,IAC5B,IAAI,YAAwB,QAAQ;AAAA,IACpC,GAAG,EAAE;AAAA,IACL,GAAG,EAAE;AAAA,IACL,GAAG,EAAE;AAAA,IACL,MAAM,EAAE;AAAA,EACT,CAAC;AACF;AAcO,MAAM,iBAAiB,mBAAmB,qBAAqB;AAAA,EACrE,SAAS;AACV,CAAC;AAiBM,MAAM,mBAAmB,8BAA8B;AAAA,EAC7D,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,UAAU;AAAA,IACT;AAAA,MACC,IAAI,eAAe;AAAA,MACnB,IAAI,CAAC,WAAW;AACf;AAAC,QAAC,OAAe,OAAO,CAAC;AAAA,MAC1B;AAAA,IACD;AAAA,EACD;AACD,CAAC;AA6BM,MAAM,mBAAmB,iBAA2B,UAAU;AAAA,EACpE,WAAW;AAAA,EACX,OAAO;AACR,CAAC,EAAE;AAAA,EACF,OAA0C;AAAA,IACzC,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,MAAM,CAAC;AAAA,EACR;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/records/TLDocument.ts"],
4
- "sourcesContent": ["import {\n\tBaseRecord,\n\tcreateMigrationIds,\n\tcreateRecordMigrationSequence,\n\tcreateRecordType,\n\tRecordId,\n\tUnknownRecord,\n} from '@tldraw/store'\nimport { JsonObject } from '@tldraw/utils'\nimport { T } from '@tldraw/validate'\n\n/**\n * TLDocument\n *\n * @public\n */\nexport interface TLDocument extends BaseRecord<'document', RecordId<TLDocument>> {\n\tgridSize: number\n\tname: string\n\tmeta: JsonObject\n}\n\n/** @public */\nexport const documentValidator: T.Validator<TLDocument> = T.model(\n\t'document',\n\tT.object({\n\t\ttypeName: T.literal('document'),\n\t\tid: T.literal('document:document' as RecordId<TLDocument>),\n\t\tgridSize: T.number,\n\t\tname: T.string,\n\t\tmeta: T.jsonValue as T.ObjectValidator<JsonObject>,\n\t})\n)\n\n/** @public */\nexport function isDocument(record?: UnknownRecord): record is TLDocument {\n\tif (!record) return false\n\treturn record.typeName === 'document'\n}\n\n/** @public */\nexport const documentVersions = createMigrationIds('com.tldraw.document', {\n\tAddName: 1,\n\tAddMeta: 2,\n} as const)\n\n/** @public */\nexport const documentMigrations = createRecordMigrationSequence({\n\tsequenceId: 'com.tldraw.document',\n\trecordType: 'document',\n\tsequence: [\n\t\t{\n\t\t\tid: documentVersions.AddName,\n\t\t\tup: (document) => {\n\t\t\t\t;(document as any).name = ''\n\t\t\t},\n\t\t\tdown: (document) => {\n\t\t\t\tdelete (document as any).name\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: documentVersions.AddMeta,\n\t\t\tup: (record) => {\n\t\t\t\t;(record as any).meta = {}\n\t\t\t},\n\t\t},\n\t],\n})\n\n/** @public */\nexport const DocumentRecordType = createRecordType<TLDocument>('document', {\n\tvalidator: documentValidator,\n\tscope: 'document',\n}).withDefaultProperties(\n\t(): Omit<TLDocument, 'id' | 'typeName'> => ({\n\t\tgridSize: 10,\n\t\tname: '',\n\t\tmeta: {},\n\t})\n)\n\n// all document records have the same ID: 'document:document'\n/** @public */\nexport const TLDOCUMENT_ID: RecordId<TLDocument> = DocumentRecordType.createId('document')\n"],
5
- "mappings": "AAAA;AAAA,EAEC;AAAA,EACA;AAAA,EACA;AAAA,OAGM;AAEP,SAAS,SAAS;AAcX,MAAM,oBAA6C,EAAE;AAAA,EAC3D;AAAA,EACA,EAAE,OAAO;AAAA,IACR,UAAU,EAAE,QAAQ,UAAU;AAAA,IAC9B,IAAI,EAAE,QAAQ,mBAA2C;AAAA,IACzD,UAAU,EAAE;AAAA,IACZ,MAAM,EAAE;AAAA,IACR,MAAM,EAAE;AAAA,EACT,CAAC;AACF;AAGO,SAAS,WAAW,QAA8C;AACxE,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO,OAAO,aAAa;AAC5B;AAGO,MAAM,mBAAmB,mBAAmB,uBAAuB;AAAA,EACzE,SAAS;AAAA,EACT,SAAS;AACV,CAAU;AAGH,MAAM,qBAAqB,8BAA8B;AAAA,EAC/D,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,UAAU;AAAA,IACT;AAAA,MACC,IAAI,iBAAiB;AAAA,MACrB,IAAI,CAAC,aAAa;AACjB;AAAC,QAAC,SAAiB,OAAO;AAAA,MAC3B;AAAA,MACA,MAAM,CAAC,aAAa;AACnB,eAAQ,SAAiB;AAAA,MAC1B;AAAA,IACD;AAAA,IACA;AAAA,MACC,IAAI,iBAAiB;AAAA,MACrB,IAAI,CAAC,WAAW;AACf;AAAC,QAAC,OAAe,OAAO,CAAC;AAAA,MAC1B;AAAA,IACD;AAAA,EACD;AACD,CAAC;AAGM,MAAM,qBAAqB,iBAA6B,YAAY;AAAA,EAC1E,WAAW;AAAA,EACX,OAAO;AACR,CAAC,EAAE;AAAA,EACF,OAA4C;AAAA,IAC3C,UAAU;AAAA,IACV,MAAM;AAAA,IACN,MAAM,CAAC;AAAA,EACR;AACD;AAIO,MAAM,gBAAsC,mBAAmB,SAAS,UAAU;",
4
+ "sourcesContent": ["import {\n\tBaseRecord,\n\tcreateMigrationIds,\n\tcreateRecordMigrationSequence,\n\tcreateRecordType,\n\tRecordId,\n\tUnknownRecord,\n} from '@tldraw/store'\nimport { JsonObject } from '@tldraw/utils'\nimport { T } from '@tldraw/validate'\n\n/**\n * Document record containing global settings and metadata for a tldraw document.\n * There is exactly one document record per tldraw instance with a fixed ID.\n *\n * @example\n * ```ts\n * const document: TLDocument = {\n * id: 'document:document',\n * typeName: 'document',\n * gridSize: 20, // Grid snap size in pixels\n * name: 'My Drawing', // Document name\n * meta: {\n * createdAt: Date.now(),\n * author: 'user123',\n * version: '1.0.0'\n * }\n * }\n *\n * // Update document settings\n * editor.updateDocumentSettings({\n * name: 'Updated Drawing',\n * gridSize: 25\n * })\n * ```\n *\n * @public\n */\nexport interface TLDocument extends BaseRecord<'document', RecordId<TLDocument>> {\n\t/** Grid snap size in pixels. Used for shape positioning and alignment */\n\tgridSize: number\n\t/** Human-readable name of the document */\n\tname: string\n\t/** User-defined metadata for the document */\n\tmeta: JsonObject\n}\n\n/**\n * Validator for TLDocument records that ensures runtime type safety.\n * Enforces the fixed document ID and validates all document properties.\n *\n * @example\n * ```ts\n * // Validation happens automatically when document is stored\n * try {\n * const validatedDocument = documentValidator.validate(documentData)\n * store.put([validatedDocument])\n * } catch (error) {\n * console.error('Document validation failed:', error.message)\n * }\n * ```\n *\n * @public\n */\nexport const documentValidator: T.Validator<TLDocument> = T.model(\n\t'document',\n\tT.object({\n\t\ttypeName: T.literal('document'),\n\t\tid: T.literal('document:document' as RecordId<TLDocument>),\n\t\tgridSize: T.number,\n\t\tname: T.string,\n\t\tmeta: T.jsonValue as T.ObjectValidator<JsonObject>,\n\t})\n)\n\n/**\n * Type guard to check if a record is a TLDocument.\n * Useful for filtering or type narrowing when working with mixed record types.\n *\n * @param record - The record to check\n * @returns True if the record is a document, false otherwise\n *\n * @example\n * ```ts\n * // Type guard usage\n * function processRecord(record: UnknownRecord) {\n * if (isDocument(record)) {\n * // record is now typed as TLDocument\n * console.log(`Document: ${record.name}, Grid: ${record.gridSize}px`)\n * }\n * }\n *\n * // Filter documents from mixed records\n * const allRecords = store.allRecords()\n * const documents = allRecords.filter(isDocument) // Should be exactly one\n * ```\n *\n * @public\n */\nexport function isDocument(record?: UnknownRecord): record is TLDocument {\n\tif (!record) return false\n\treturn record.typeName === 'document'\n}\n\n/**\n * Migration version identifiers for document record schema evolution.\n * Each version represents a breaking change that requires data migration.\n *\n * @example\n * ```ts\n * // Check if document needs migration\n * const needsNameMigration = currentVersion < documentVersions.AddName\n * const needsMetaMigration = currentVersion < documentVersions.AddMeta\n * ```\n *\n * @public\n */\nexport const documentVersions = createMigrationIds('com.tldraw.document', {\n\tAddName: 1,\n\tAddMeta: 2,\n} as const)\n\n/**\n * Migration sequence for evolving document record structure over time.\n * Handles converting document records from older schema versions to current format.\n *\n * @example\n * ```ts\n * // Migration is applied automatically when loading old documents\n * const migratedStore = migrator.migrateStoreSnapshot({\n * schema: oldSchema,\n * store: oldStoreSnapshot\n * })\n *\n * // The migrations:\n * // v1: Added 'name' property with empty string default\n * // v2: Added 'meta' property with empty object default\n * ```\n *\n * @public\n */\nexport const documentMigrations = createRecordMigrationSequence({\n\tsequenceId: 'com.tldraw.document',\n\trecordType: 'document',\n\tsequence: [\n\t\t{\n\t\t\tid: documentVersions.AddName,\n\t\t\tup: (document) => {\n\t\t\t\t;(document as any).name = ''\n\t\t\t},\n\t\t\tdown: (document) => {\n\t\t\t\tdelete (document as any).name\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: documentVersions.AddMeta,\n\t\t\tup: (record) => {\n\t\t\t\t;(record as any).meta = {}\n\t\t\t},\n\t\t},\n\t],\n})\n\n/**\n * Record type definition for TLDocument with validation and default properties.\n * Configures the document as a document-scoped record that persists across sessions.\n *\n * @example\n * ```ts\n * // Create a document record (usually done automatically)\n * const documentRecord = DocumentRecordType.create({\n * id: TLDOCUMENT_ID,\n * name: 'My Drawing',\n * gridSize: 20,\n * meta: { createdAt: Date.now() }\n * })\n *\n * // Create with defaults\n * const defaultDocument = DocumentRecordType.create({\n * id: TLDOCUMENT_ID\n * // gridSize: 10, name: '', meta: {} are applied as defaults\n * })\n *\n * // Store the document\n * store.put([documentRecord])\n * ```\n *\n * @public\n */\nexport const DocumentRecordType = createRecordType<TLDocument>('document', {\n\tvalidator: documentValidator,\n\tscope: 'document',\n}).withDefaultProperties(\n\t(): Omit<TLDocument, 'id' | 'typeName'> => ({\n\t\tgridSize: 10,\n\t\tname: '',\n\t\tmeta: {},\n\t})\n)\n\n/**\n * The fixed ID for the singleton document record in every tldraw store.\n * All document records use this same ID: 'document:document'\n *\n * @example\n * ```ts\n * // Get the document from store\n * const document = store.get(TLDOCUMENT_ID)\n *\n * // Update document settings\n * store.put([{\n * ...document,\n * name: 'Updated Name',\n * gridSize: 25\n * }])\n *\n * // Access via editor\n * const documentSettings = editor.getDocumentSettings()\n * editor.updateDocumentSettings({ name: 'New Name' })\n * ```\n *\n * @public\n */\nexport const TLDOCUMENT_ID: RecordId<TLDocument> = DocumentRecordType.createId('document')\n"],
5
+ "mappings": "AAAA;AAAA,EAEC;AAAA,EACA;AAAA,EACA;AAAA,OAGM;AAEP,SAAS,SAAS;AAuDX,MAAM,oBAA6C,EAAE;AAAA,EAC3D;AAAA,EACA,EAAE,OAAO;AAAA,IACR,UAAU,EAAE,QAAQ,UAAU;AAAA,IAC9B,IAAI,EAAE,QAAQ,mBAA2C;AAAA,IACzD,UAAU,EAAE;AAAA,IACZ,MAAM,EAAE;AAAA,IACR,MAAM,EAAE;AAAA,EACT,CAAC;AACF;AA0BO,SAAS,WAAW,QAA8C;AACxE,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO,OAAO,aAAa;AAC5B;AAeO,MAAM,mBAAmB,mBAAmB,uBAAuB;AAAA,EACzE,SAAS;AAAA,EACT,SAAS;AACV,CAAU;AAqBH,MAAM,qBAAqB,8BAA8B;AAAA,EAC/D,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,UAAU;AAAA,IACT;AAAA,MACC,IAAI,iBAAiB;AAAA,MACrB,IAAI,CAAC,aAAa;AACjB;AAAC,QAAC,SAAiB,OAAO;AAAA,MAC3B;AAAA,MACA,MAAM,CAAC,aAAa;AACnB,eAAQ,SAAiB;AAAA,MAC1B;AAAA,IACD;AAAA,IACA;AAAA,MACC,IAAI,iBAAiB;AAAA,MACrB,IAAI,CAAC,WAAW;AACf;AAAC,QAAC,OAAe,OAAO,CAAC;AAAA,MAC1B;AAAA,IACD;AAAA,EACD;AACD,CAAC;AA4BM,MAAM,qBAAqB,iBAA6B,YAAY;AAAA,EAC1E,WAAW;AAAA,EACX,OAAO;AACR,CAAC,EAAE;AAAA,EACF,OAA4C;AAAA,IAC3C,UAAU;AAAA,IACV,MAAM;AAAA,IACN,MAAM,CAAC;AAAA,EACR;AACD;AAyBO,MAAM,gBAAsC,mBAAmB,SAAS,UAAU;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/records/TLInstance.ts"],
4
- "sourcesContent": ["import {\n\tBaseRecord,\n\tcreateMigrationIds,\n\tcreateRecordMigrationSequence,\n\tcreateRecordType,\n\tRecordId,\n} from '@tldraw/store'\nimport { filterEntries, JsonObject } from '@tldraw/utils'\nimport { T } from '@tldraw/validate'\nimport { BoxModel, boxModelValidator } from '../misc/geometry-types'\nimport { idValidator } from '../misc/id-validator'\nimport { cursorValidator, TLCursor } from '../misc/TLCursor'\nimport { opacityValidator, TLOpacityType } from '../misc/TLOpacity'\nimport { scribbleValidator, TLScribble } from '../misc/TLScribble'\nimport { StyleProp } from '../styles/StyleProp'\nimport { pageIdValidator, TLPageId } from './TLPage'\nimport { TLShapeId } from './TLShape'\n\n/**\n * TLInstance\n *\n * State that is particular to a single browser tab\n *\n * @public\n */\nexport interface TLInstance extends BaseRecord<'instance', TLInstanceId> {\n\tcurrentPageId: TLPageId\n\topacityForNextShape: TLOpacityType\n\tstylesForNextShape: Record<string, unknown>\n\tfollowingUserId: string | null\n\thighlightedUserIds: string[]\n\tbrush: BoxModel | null\n\tcursor: TLCursor\n\tscribbles: TLScribble[]\n\tisFocusMode: boolean\n\tisDebugMode: boolean\n\tisToolLocked: boolean\n\texportBackground: boolean\n\tscreenBounds: BoxModel\n\tinsets: boolean[]\n\tzoomBrush: BoxModel | null\n\tchatMessage: string\n\tisChatting: boolean\n\tisPenMode: boolean\n\tisGridMode: boolean\n\tisFocused: boolean\n\tdevicePixelRatio: number\n\t/**\n\t * This is whether the primary input mechanism includes a pointing device of limited accuracy,\n\t * such as a finger on a touchscreen.\n\t */\n\tisCoarsePointer: boolean\n\t/**\n\t * Will be null if the pointer doesn't support hovering (e.g. touch), but true or false\n\t * otherwise\n\t */\n\tisHoveringCanvas: boolean | null\n\topenMenus: string[]\n\tisChangingStyle: boolean\n\tisReadonly: boolean\n\tmeta: JsonObject\n\tduplicateProps: {\n\t\tshapeIds: TLShapeId[]\n\t\toffset: {\n\t\t\tx: number\n\t\t\ty: number\n\t\t}\n\t} | null\n}\n\n/** @internal */\nexport const shouldKeyBePreservedBetweenSessions = {\n\t// This object defines keys that should be preserved across calls to loadSnapshot()\n\n\tid: false, // meta\n\ttypeName: false, // meta\n\n\tcurrentPageId: false, // does not preserve because who knows if the page still exists\n\topacityForNextShape: false, // does not preserve because it's a temporary state\n\tstylesForNextShape: false, // does not preserve because it's a temporary state\n\tfollowingUserId: false, // does not preserve because it's a temporary state\n\thighlightedUserIds: false, // does not preserve because it's a temporary state\n\tbrush: false, // does not preserve because it's a temporary state\n\tcursor: false, // does not preserve because it's a temporary state\n\tscribbles: false, // does not preserve because it's a temporary state\n\n\tisFocusMode: true, // preserves because it's a user preference\n\tisDebugMode: true, // preserves because it's a user preference\n\tisToolLocked: true, // preserves because it's a user preference\n\texportBackground: true, // preserves because it's a user preference\n\tscreenBounds: true, // preserves because it's capturing the user's screen state\n\tinsets: true, // preserves because it's capturing the user's screen state\n\n\tzoomBrush: false, // does not preserve because it's a temporary state\n\tchatMessage: false, // does not preserve because it's a temporary state\n\tisChatting: false, // does not preserve because it's a temporary state\n\tisPenMode: false, // does not preserve because it's a temporary state\n\n\tisGridMode: true, // preserves because it's a user preference\n\tisFocused: true, // preserves because obviously\n\tdevicePixelRatio: true, // preserves because it captures the user's screen state\n\tisCoarsePointer: true, // preserves because it captures the user's screen state\n\tisHoveringCanvas: false, // does not preserve because it's a temporary state\n\topenMenus: false, // does not preserve because it's a temporary state\n\tisChangingStyle: false, // does not preserve because it's a temporary state\n\tisReadonly: true, // preserves because it's a config option\n\tmeta: false, // does not preserve because who knows what's in there, leave it up to sdk users to save and reinstate\n\tduplicateProps: false, //\n} as const satisfies { [K in keyof TLInstance]: boolean }\n\n/** @internal */\nexport function pluckPreservingValues(val?: TLInstance | null): null | Partial<TLInstance> {\n\treturn val\n\t\t? (filterEntries(val, (key) => {\n\t\t\t\treturn shouldKeyBePreservedBetweenSessions[key as keyof TLInstance]\n\t\t\t}) as Partial<TLInstance>)\n\t\t: null\n}\n\n/** @public */\nexport type TLInstanceId = RecordId<TLInstance>\n\n/** @public */\nexport const instanceIdValidator = idValidator<TLInstanceId>('instance')\n\nexport function createInstanceRecordType(stylesById: Map<string, StyleProp<unknown>>) {\n\tconst stylesForNextShapeValidators = {} as Record<string, T.Validator<unknown>>\n\tfor (const [id, style] of stylesById) {\n\t\tstylesForNextShapeValidators[id] = T.optional(style)\n\t}\n\n\tconst instanceTypeValidator: T.Validator<TLInstance> = T.model(\n\t\t'instance',\n\t\tT.object({\n\t\t\ttypeName: T.literal('instance'),\n\t\t\tid: idValidator<TLInstanceId>('instance'),\n\t\t\tcurrentPageId: pageIdValidator,\n\t\t\tfollowingUserId: T.string.nullable(),\n\t\t\tbrush: boxModelValidator.nullable(),\n\t\t\topacityForNextShape: opacityValidator,\n\t\t\tstylesForNextShape: T.object(stylesForNextShapeValidators),\n\t\t\tcursor: cursorValidator,\n\t\t\tscribbles: T.arrayOf(scribbleValidator),\n\t\t\tisFocusMode: T.boolean,\n\t\t\tisDebugMode: T.boolean,\n\t\t\tisToolLocked: T.boolean,\n\t\t\texportBackground: T.boolean,\n\t\t\tscreenBounds: boxModelValidator,\n\t\t\tinsets: T.arrayOf(T.boolean),\n\t\t\tzoomBrush: boxModelValidator.nullable(),\n\t\t\tisPenMode: T.boolean,\n\t\t\tisGridMode: T.boolean,\n\t\t\tchatMessage: T.string,\n\t\t\tisChatting: T.boolean,\n\t\t\thighlightedUserIds: T.arrayOf(T.string),\n\t\t\tisFocused: T.boolean,\n\t\t\tdevicePixelRatio: T.number,\n\t\t\tisCoarsePointer: T.boolean,\n\t\t\tisHoveringCanvas: T.boolean.nullable(),\n\t\t\topenMenus: T.arrayOf(T.string),\n\t\t\tisChangingStyle: T.boolean,\n\t\t\tisReadonly: T.boolean,\n\t\t\tmeta: T.jsonValue as T.ObjectValidator<JsonObject>,\n\t\t\tduplicateProps: T.object({\n\t\t\t\tshapeIds: T.arrayOf(idValidator<TLShapeId>('shape')),\n\t\t\t\toffset: T.object({\n\t\t\t\t\tx: T.number,\n\t\t\t\t\ty: T.number,\n\t\t\t\t}),\n\t\t\t}).nullable(),\n\t\t})\n\t)\n\n\treturn createRecordType<TLInstance>('instance', {\n\t\tvalidator: instanceTypeValidator,\n\t\tscope: 'session',\n\t\tephemeralKeys: {\n\t\t\tcurrentPageId: false,\n\t\t\tmeta: false,\n\n\t\t\tfollowingUserId: true,\n\t\t\topacityForNextShape: true,\n\t\t\tstylesForNextShape: true,\n\t\t\tbrush: true,\n\t\t\tcursor: true,\n\t\t\tscribbles: true,\n\t\t\tisFocusMode: true,\n\t\t\tisDebugMode: true,\n\t\t\tisToolLocked: true,\n\t\t\texportBackground: true,\n\t\t\tscreenBounds: true,\n\t\t\tinsets: true,\n\t\t\tzoomBrush: true,\n\t\t\tisPenMode: true,\n\t\t\tisGridMode: true,\n\t\t\tchatMessage: true,\n\t\t\tisChatting: true,\n\t\t\thighlightedUserIds: true,\n\t\t\tisFocused: true,\n\t\t\tdevicePixelRatio: true,\n\t\t\tisCoarsePointer: true,\n\t\t\tisHoveringCanvas: true,\n\t\t\topenMenus: true,\n\t\t\tisChangingStyle: true,\n\t\t\tisReadonly: true,\n\t\t\tduplicateProps: true,\n\t\t},\n\t}).withDefaultProperties(\n\t\t(): Omit<TLInstance, 'typeName' | 'id' | 'currentPageId'> => ({\n\t\t\tfollowingUserId: null,\n\t\t\topacityForNextShape: 1,\n\t\t\tstylesForNextShape: {},\n\t\t\tbrush: null,\n\t\t\tscribbles: [],\n\t\t\tcursor: {\n\t\t\t\ttype: 'default',\n\t\t\t\trotation: 0,\n\t\t\t},\n\t\t\tisFocusMode: false,\n\t\t\texportBackground: false,\n\t\t\tisDebugMode: false,\n\t\t\tisToolLocked: false,\n\t\t\tscreenBounds: { x: 0, y: 0, w: 1080, h: 720 },\n\t\t\tinsets: [false, false, false, false],\n\t\t\tzoomBrush: null,\n\t\t\tisGridMode: false,\n\t\t\tisPenMode: false,\n\t\t\tchatMessage: '',\n\t\t\tisChatting: false,\n\t\t\thighlightedUserIds: [],\n\t\t\tisFocused: false,\n\t\t\tdevicePixelRatio: typeof window === 'undefined' ? 1 : window.devicePixelRatio,\n\t\t\tisCoarsePointer: false,\n\t\t\tisHoveringCanvas: null,\n\t\t\topenMenus: [] as string[],\n\t\t\tisChangingStyle: false,\n\t\t\tisReadonly: false,\n\t\t\tmeta: {},\n\t\t\tduplicateProps: null,\n\t\t})\n\t)\n}\n\n/** @public */\nexport const instanceVersions = createMigrationIds('com.tldraw.instance', {\n\tAddTransparentExportBgs: 1,\n\tRemoveDialog: 2,\n\tAddToolLockMode: 3,\n\tRemoveExtraPropsForNextShape: 4,\n\tAddLabelColor: 5,\n\tAddFollowingUserId: 6,\n\tRemoveAlignJustify: 7,\n\tAddZoom: 8,\n\tAddVerticalAlign: 9,\n\tAddScribbleDelay: 10,\n\tRemoveUserId: 11,\n\tAddIsPenModeAndIsGridMode: 12,\n\tHoistOpacity: 13,\n\tAddChat: 14,\n\tAddHighlightedUserIds: 15,\n\tReplacePropsForNextShapeWithStylesForNextShape: 16,\n\tAddMeta: 17,\n\tRemoveCursorColor: 18,\n\tAddLonelyProperties: 19,\n\tReadOnlyReadonly: 20,\n\tAddHoveringCanvas: 21,\n\tAddScribbles: 22,\n\tAddInset: 23,\n\tAddDuplicateProps: 24,\n\tRemoveCanMoveCamera: 25,\n} as const)\n\n// TODO: rewrite these to use mutation\n\n/** @public */\nexport const instanceMigrations = createRecordMigrationSequence({\n\tsequenceId: 'com.tldraw.instance',\n\trecordType: 'instance',\n\tsequence: [\n\t\t{\n\t\t\tid: instanceVersions.AddTransparentExportBgs,\n\t\t\tup: (instance) => {\n\t\t\t\treturn { ...instance, exportBackground: true }\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.RemoveDialog,\n\t\t\tup: ({ dialog: _, ...instance }: any) => {\n\t\t\t\treturn instance\n\t\t\t},\n\t\t},\n\n\t\t{\n\t\t\tid: instanceVersions.AddToolLockMode,\n\t\t\tup: (instance) => {\n\t\t\t\treturn { ...instance, isToolLocked: false }\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.RemoveExtraPropsForNextShape,\n\t\t\tup: ({ propsForNextShape, ...instance }: any) => {\n\t\t\t\treturn {\n\t\t\t\t\t...instance,\n\t\t\t\t\tpropsForNextShape: Object.fromEntries(\n\t\t\t\t\t\tObject.entries(propsForNextShape).filter(([key]) =>\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t'color',\n\t\t\t\t\t\t\t\t'labelColor',\n\t\t\t\t\t\t\t\t'dash',\n\t\t\t\t\t\t\t\t'fill',\n\t\t\t\t\t\t\t\t'size',\n\t\t\t\t\t\t\t\t'font',\n\t\t\t\t\t\t\t\t'align',\n\t\t\t\t\t\t\t\t'verticalAlign',\n\t\t\t\t\t\t\t\t'icon',\n\t\t\t\t\t\t\t\t'geo',\n\t\t\t\t\t\t\t\t'arrowheadStart',\n\t\t\t\t\t\t\t\t'arrowheadEnd',\n\t\t\t\t\t\t\t\t'spline',\n\t\t\t\t\t\t\t].includes(key)\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.AddLabelColor,\n\t\t\tup: ({ propsForNextShape, ...instance }: any) => {\n\t\t\t\treturn {\n\t\t\t\t\t...instance,\n\t\t\t\t\tpropsForNextShape: {\n\t\t\t\t\t\t...propsForNextShape,\n\t\t\t\t\t\tlabelColor: 'black',\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.AddFollowingUserId,\n\t\t\tup: (instance) => {\n\t\t\t\treturn { ...instance, followingUserId: null }\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.RemoveAlignJustify,\n\t\t\tup: (instance: any) => {\n\t\t\t\tlet newAlign = instance.propsForNextShape.align\n\t\t\t\tif (newAlign === 'justify') {\n\t\t\t\t\tnewAlign = 'start'\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\t...instance,\n\t\t\t\t\tpropsForNextShape: {\n\t\t\t\t\t\t...instance.propsForNextShape,\n\t\t\t\t\t\talign: newAlign,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.AddZoom,\n\t\t\tup: (instance) => {\n\t\t\t\treturn { ...instance, zoomBrush: null }\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.AddVerticalAlign,\n\t\t\tup: (instance: any) => {\n\t\t\t\treturn {\n\t\t\t\t\t...instance,\n\t\t\t\t\tpropsForNextShape: {\n\t\t\t\t\t\t...instance.propsForNextShape,\n\t\t\t\t\t\tverticalAlign: 'middle',\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.AddScribbleDelay,\n\t\t\tup: (instance: any) => {\n\t\t\t\tif (instance.scribble !== null) {\n\t\t\t\t\treturn { ...instance, scribble: { ...instance.scribble, delay: 0 } }\n\t\t\t\t}\n\t\t\t\treturn { ...instance }\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.RemoveUserId,\n\t\t\tup: ({ userId: _, ...instance }: any) => {\n\t\t\t\treturn instance\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.AddIsPenModeAndIsGridMode,\n\t\t\tup: (instance) => {\n\t\t\t\treturn { ...instance, isPenMode: false, isGridMode: false }\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.HoistOpacity,\n\t\t\tup: ({ propsForNextShape: { opacity, ...propsForNextShape }, ...instance }: any) => {\n\t\t\t\treturn { ...instance, opacityForNextShape: Number(opacity ?? '1'), propsForNextShape }\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.AddChat,\n\t\t\tup: (instance) => {\n\t\t\t\treturn { ...instance, chatMessage: '', isChatting: false }\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.AddHighlightedUserIds,\n\t\t\tup: (instance) => {\n\t\t\t\treturn { ...instance, highlightedUserIds: [] }\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.ReplacePropsForNextShapeWithStylesForNextShape,\n\t\t\tup: ({ propsForNextShape: _, ...instance }: any) => {\n\t\t\t\treturn { ...instance, stylesForNextShape: {} }\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.AddMeta,\n\t\t\tup: (record) => {\n\t\t\t\treturn {\n\t\t\t\t\t...record,\n\t\t\t\t\tmeta: {},\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.RemoveCursorColor,\n\t\t\tup: (record: any) => {\n\t\t\t\tconst { color: _, ...cursor } = record.cursor\n\t\t\t\treturn {\n\t\t\t\t\t...record,\n\t\t\t\t\tcursor,\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.AddLonelyProperties,\n\t\t\tup: (record) => {\n\t\t\t\treturn {\n\t\t\t\t\t...record,\n\t\t\t\t\tcanMoveCamera: true,\n\t\t\t\t\tisFocused: false,\n\t\t\t\t\tdevicePixelRatio: 1,\n\t\t\t\t\tisCoarsePointer: false,\n\t\t\t\t\topenMenus: [],\n\t\t\t\t\tisChangingStyle: false,\n\t\t\t\t\tisReadOnly: false,\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.ReadOnlyReadonly,\n\t\t\tup: ({ isReadOnly: _isReadOnly, ...record }: any) => {\n\t\t\t\treturn {\n\t\t\t\t\t...record,\n\t\t\t\t\tisReadonly: _isReadOnly,\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.AddHoveringCanvas,\n\t\t\tup: (record) => {\n\t\t\t\treturn {\n\t\t\t\t\t...record,\n\t\t\t\t\tisHoveringCanvas: null,\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.AddScribbles,\n\t\t\tup: ({ scribble: _, ...record }: any) => {\n\t\t\t\treturn {\n\t\t\t\t\t...record,\n\t\t\t\t\tscribbles: [],\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.AddInset,\n\t\t\tup: (record) => {\n\t\t\t\treturn {\n\t\t\t\t\t...record,\n\t\t\t\t\tinsets: [false, false, false, false],\n\t\t\t\t}\n\t\t\t},\n\t\t\tdown: ({ insets: _, ...record }: any) => {\n\t\t\t\treturn {\n\t\t\t\t\t...record,\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.AddDuplicateProps,\n\t\t\tup: (record) => {\n\t\t\t\treturn {\n\t\t\t\t\t...record,\n\t\t\t\t\tduplicateProps: null,\n\t\t\t\t}\n\t\t\t},\n\t\t\tdown: ({ duplicateProps: _, ...record }: any) => {\n\t\t\t\treturn {\n\t\t\t\t\t...record,\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.RemoveCanMoveCamera,\n\t\t\tup: ({ canMoveCamera: _, ...record }: any) => {\n\t\t\t\treturn {\n\t\t\t\t\t...record,\n\t\t\t\t}\n\t\t\t},\n\t\t\tdown: (instance) => {\n\t\t\t\treturn { ...instance, canMoveCamera: true }\n\t\t\t},\n\t\t},\n\t],\n})\n\n/** @public */\nexport const TLINSTANCE_ID = 'instance:instance' as TLInstanceId\n"],
5
- "mappings": "AAAA;AAAA,EAEC;AAAA,EACA;AAAA,EACA;AAAA,OAEM;AACP,SAAS,qBAAiC;AAC1C,SAAS,SAAS;AAClB,SAAmB,yBAAyB;AAC5C,SAAS,mBAAmB;AAC5B,SAAS,uBAAiC;AAC1C,SAAS,wBAAuC;AAChD,SAAS,yBAAqC;AAE9C,SAAS,uBAAiC;AAwDnC,MAAM,sCAAsC;AAAA;AAAA,EAGlD,IAAI;AAAA;AAAA,EACJ,UAAU;AAAA;AAAA,EAEV,eAAe;AAAA;AAAA,EACf,qBAAqB;AAAA;AAAA,EACrB,oBAAoB;AAAA;AAAA,EACpB,iBAAiB;AAAA;AAAA,EACjB,oBAAoB;AAAA;AAAA,EACpB,OAAO;AAAA;AAAA,EACP,QAAQ;AAAA;AAAA,EACR,WAAW;AAAA;AAAA,EAEX,aAAa;AAAA;AAAA,EACb,aAAa;AAAA;AAAA,EACb,cAAc;AAAA;AAAA,EACd,kBAAkB;AAAA;AAAA,EAClB,cAAc;AAAA;AAAA,EACd,QAAQ;AAAA;AAAA,EAER,WAAW;AAAA;AAAA,EACX,aAAa;AAAA;AAAA,EACb,YAAY;AAAA;AAAA,EACZ,WAAW;AAAA;AAAA,EAEX,YAAY;AAAA;AAAA,EACZ,WAAW;AAAA;AAAA,EACX,kBAAkB;AAAA;AAAA,EAClB,iBAAiB;AAAA;AAAA,EACjB,kBAAkB;AAAA;AAAA,EAClB,WAAW;AAAA;AAAA,EACX,iBAAiB;AAAA;AAAA,EACjB,YAAY;AAAA;AAAA,EACZ,MAAM;AAAA;AAAA,EACN,gBAAgB;AAAA;AACjB;AAGO,SAAS,sBAAsB,KAAqD;AAC1F,SAAO,MACH,cAAc,KAAK,CAAC,QAAQ;AAC7B,WAAO,oCAAoC,GAAuB;AAAA,EACnE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ACN,GAAG;AAAA,UACH,WAAW,CAAC;AAAA,QACb;AAAA,MACD;AAAA,IACD;AAAA,IACA;AAAA,MACC,IAAI,iBAAiB;AAAA,MACrB,IAAI,CAAC,WAAW;AACf,eAAO;AAAA,UACN,GAAG;AAAA,UACH,QAAQ,CAAC,OAAO,OAAO,OAAO,KAAK;AAAA,QACpC;AAAA,MACD;AAAA,MACA,MAAM,CAAC,EAAE,QAAQ,GAAG,GAAG,OAAO,MAAW;AACxC,eAAO;AAAA,UACN,GAAG;AAAA,QACJ;AAAA,MACD;AAAA,IACD;AAAA,IACA;AAAA,MACC,IAAI,iBAAiB;AAAA,MACrB,IAAI,CAAC,WAAW;AACf,eAAO;AAAA,UACN,GAAG;AAAA,UACH,gBAAgB;AAAA,QACjB;AAAA,MACD;AAAA,MACA,MAAM,CAAC,EAAE,gBAAgB,GAAG,GAAG,OAAO,MAAW;AAChD,eAAO;AAAA,UACN,GAAG;AAAA,QACJ;AAAA,MACD;AAAA,IACD;AAAA,IACA;AAAA,MACC,IAAI,iBAAiB;AAAA,MACrB,IAAI,CAAC,EAAE,eAAe,GAAG,GAAG,OAAO,MAAW;AAC7C,eAAO;AAAA,UACN,GAAG;AAAA,QACJ;AAAA,MACD;AAAA,MACA,MAAM,CAAC,aAAa;AACnB,eAAO,EAAE,GAAG,UAAU,eAAe,KAAK;AAAA,MAC3C;AAAA,IACD;AAAA,EACD;AACD,CAAC;AAGM,MAAM,gBAAgB;",
4
+ "sourcesContent": ["import {\n\tBaseRecord,\n\tcreateMigrationIds,\n\tcreateRecordMigrationSequence,\n\tcreateRecordType,\n\tRecordId,\n} from '@tldraw/store'\nimport { filterEntries, JsonObject } from '@tldraw/utils'\nimport { T } from '@tldraw/validate'\nimport { BoxModel, boxModelValidator } from '../misc/geometry-types'\nimport { idValidator } from '../misc/id-validator'\nimport { cursorValidator, TLCursor } from '../misc/TLCursor'\nimport { opacityValidator, TLOpacityType } from '../misc/TLOpacity'\nimport { scribbleValidator, TLScribble } from '../misc/TLScribble'\nimport { StyleProp } from '../styles/StyleProp'\nimport { pageIdValidator, TLPageId } from './TLPage'\nimport { TLShapeId } from './TLShape'\n\n/**\n * State that is particular to a single browser tab. The TLInstance record stores\n * all session-specific state including cursor position, selected tools, UI preferences,\n * and temporary interaction state.\n *\n * Each browser tab has exactly one TLInstance record that persists for the duration\n * of the session and tracks the user's current interaction state.\n *\n * @example\n * ```ts\n * const instance: TLInstance = {\n * id: 'instance:instance',\n * typeName: 'instance',\n * currentPageId: 'page:page1',\n * cursor: { type: 'default', rotation: 0 },\n * screenBounds: { x: 0, y: 0, w: 1920, h: 1080 },\n * isFocusMode: false,\n * isGridMode: true\n * }\n * ```\n *\n * @public\n */\nexport interface TLInstance extends BaseRecord<'instance', TLInstanceId> {\n\tcurrentPageId: TLPageId\n\topacityForNextShape: TLOpacityType\n\tstylesForNextShape: Record<string, unknown>\n\tfollowingUserId: string | null\n\thighlightedUserIds: string[]\n\tbrush: BoxModel | null\n\tcursor: TLCursor\n\tscribbles: TLScribble[]\n\tisFocusMode: boolean\n\tisDebugMode: boolean\n\tisToolLocked: boolean\n\texportBackground: boolean\n\tscreenBounds: BoxModel\n\tinsets: boolean[]\n\tzoomBrush: BoxModel | null\n\tchatMessage: string\n\tisChatting: boolean\n\tisPenMode: boolean\n\tisGridMode: boolean\n\tisFocused: boolean\n\tdevicePixelRatio: number\n\t/**\n\t * This is whether the primary input mechanism includes a pointing device of limited accuracy,\n\t * such as a finger on a touchscreen.\n\t */\n\tisCoarsePointer: boolean\n\t/**\n\t * Will be null if the pointer doesn't support hovering (e.g. touch), but true or false\n\t * otherwise\n\t */\n\tisHoveringCanvas: boolean | null\n\topenMenus: string[]\n\tisChangingStyle: boolean\n\tisReadonly: boolean\n\tmeta: JsonObject\n\tduplicateProps: {\n\t\tshapeIds: TLShapeId[]\n\t\toffset: {\n\t\t\tx: number\n\t\t\ty: number\n\t\t}\n\t} | null\n}\n\n/**\n * Configuration object defining which TLInstance properties should be preserved\n * when loading snapshots across browser sessions. Properties marked as `true`\n * represent user preferences that should persist, while `false` indicates\n * temporary state that should reset.\n *\n * @internal\n */\nexport const shouldKeyBePreservedBetweenSessions = {\n\t// This object defines keys that should be preserved across calls to loadSnapshot()\n\n\tid: false, // meta\n\ttypeName: false, // meta\n\n\tcurrentPageId: false, // does not preserve because who knows if the page still exists\n\topacityForNextShape: false, // does not preserve because it's a temporary state\n\tstylesForNextShape: false, // does not preserve because it's a temporary state\n\tfollowingUserId: false, // does not preserve because it's a temporary state\n\thighlightedUserIds: false, // does not preserve because it's a temporary state\n\tbrush: false, // does not preserve because it's a temporary state\n\tcursor: false, // does not preserve because it's a temporary state\n\tscribbles: false, // does not preserve because it's a temporary state\n\n\tisFocusMode: true, // preserves because it's a user preference\n\tisDebugMode: true, // preserves because it's a user preference\n\tisToolLocked: true, // preserves because it's a user preference\n\texportBackground: true, // preserves because it's a user preference\n\tscreenBounds: true, // preserves because it's capturing the user's screen state\n\tinsets: true, // preserves because it's capturing the user's screen state\n\n\tzoomBrush: false, // does not preserve because it's a temporary state\n\tchatMessage: false, // does not preserve because it's a temporary state\n\tisChatting: false, // does not preserve because it's a temporary state\n\tisPenMode: false, // does not preserve because it's a temporary state\n\n\tisGridMode: true, // preserves because it's a user preference\n\tisFocused: true, // preserves because obviously\n\tdevicePixelRatio: true, // preserves because it captures the user's screen state\n\tisCoarsePointer: true, // preserves because it captures the user's screen state\n\tisHoveringCanvas: false, // does not preserve because it's a temporary state\n\topenMenus: false, // does not preserve because it's a temporary state\n\tisChangingStyle: false, // does not preserve because it's a temporary state\n\tisReadonly: true, // preserves because it's a config option\n\tmeta: false, // does not preserve because who knows what's in there, leave it up to sdk users to save and reinstate\n\tduplicateProps: false, //\n} as const satisfies { [K in keyof TLInstance]: boolean }\n\n/**\n * Extracts only the properties from a TLInstance that should be preserved\n * between browser sessions, filtering out temporary state.\n *\n * @param val - The TLInstance to filter, or null/undefined\n * @returns A partial TLInstance containing only preservable properties, or null\n *\n * @internal\n */\nexport function pluckPreservingValues(val?: TLInstance | null): null | Partial<TLInstance> {\n\treturn val\n\t\t? (filterEntries(val, (key) => {\n\t\t\t\treturn shouldKeyBePreservedBetweenSessions[key as keyof TLInstance]\n\t\t\t}) as Partial<TLInstance>)\n\t\t: null\n}\n\n/**\n * A unique identifier for TLInstance records.\n *\n * TLInstance IDs are always the constant 'instance:instance' since there\n * is exactly one instance record per browser tab.\n *\n * @public\n */\nexport type TLInstanceId = RecordId<TLInstance>\n\n/**\n * Validator for TLInstanceId values. Ensures the ID follows the correct\n * format for instance records.\n *\n * @example\n * ```ts\n * const isValid = instanceIdValidator.isValid('instance:instance') // true\n * const isValid2 = instanceIdValidator.isValid('invalid') // false\n * ```\n *\n * @public\n */\nexport const instanceIdValidator = idValidator<TLInstanceId>('instance')\n\n/**\n * Creates the record type definition for TLInstance records, including validation\n * and default properties. The function takes a map of available style properties\n * to configure validation for the stylesForNextShape field.\n *\n * @param stylesById - Map of style property IDs to their corresponding StyleProp definitions\n * @returns A configured RecordType for TLInstance records\n *\n * @example\n * ```ts\n * const stylesMap = new Map([['color', DefaultColorStyle]])\n * const InstanceRecordType = createInstanceRecordType(stylesMap)\n *\n * const instance = InstanceRecordType.create({\n * id: 'instance:instance',\n * currentPageId: 'page:page1'\n * })\n * ```\n *\n * @public\n */\nexport function createInstanceRecordType(stylesById: Map<string, StyleProp<unknown>>) {\n\tconst stylesForNextShapeValidators = {} as Record<string, T.Validator<unknown>>\n\tfor (const [id, style] of stylesById) {\n\t\tstylesForNextShapeValidators[id] = T.optional(style)\n\t}\n\n\tconst instanceTypeValidator: T.Validator<TLInstance> = T.model(\n\t\t'instance',\n\t\tT.object({\n\t\t\ttypeName: T.literal('instance'),\n\t\t\tid: idValidator<TLInstanceId>('instance'),\n\t\t\tcurrentPageId: pageIdValidator,\n\t\t\tfollowingUserId: T.string.nullable(),\n\t\t\tbrush: boxModelValidator.nullable(),\n\t\t\topacityForNextShape: opacityValidator,\n\t\t\tstylesForNextShape: T.object(stylesForNextShapeValidators),\n\t\t\tcursor: cursorValidator,\n\t\t\tscribbles: T.arrayOf(scribbleValidator),\n\t\t\tisFocusMode: T.boolean,\n\t\t\tisDebugMode: T.boolean,\n\t\t\tisToolLocked: T.boolean,\n\t\t\texportBackground: T.boolean,\n\t\t\tscreenBounds: boxModelValidator,\n\t\t\tinsets: T.arrayOf(T.boolean),\n\t\t\tzoomBrush: boxModelValidator.nullable(),\n\t\t\tisPenMode: T.boolean,\n\t\t\tisGridMode: T.boolean,\n\t\t\tchatMessage: T.string,\n\t\t\tisChatting: T.boolean,\n\t\t\thighlightedUserIds: T.arrayOf(T.string),\n\t\t\tisFocused: T.boolean,\n\t\t\tdevicePixelRatio: T.number,\n\t\t\tisCoarsePointer: T.boolean,\n\t\t\tisHoveringCanvas: T.boolean.nullable(),\n\t\t\topenMenus: T.arrayOf(T.string),\n\t\t\tisChangingStyle: T.boolean,\n\t\t\tisReadonly: T.boolean,\n\t\t\tmeta: T.jsonValue as T.ObjectValidator<JsonObject>,\n\t\t\tduplicateProps: T.object({\n\t\t\t\tshapeIds: T.arrayOf(idValidator<TLShapeId>('shape')),\n\t\t\t\toffset: T.object({\n\t\t\t\t\tx: T.number,\n\t\t\t\t\ty: T.number,\n\t\t\t\t}),\n\t\t\t}).nullable(),\n\t\t})\n\t)\n\n\treturn createRecordType<TLInstance>('instance', {\n\t\tvalidator: instanceTypeValidator,\n\t\tscope: 'session',\n\t\tephemeralKeys: {\n\t\t\tcurrentPageId: false,\n\t\t\tmeta: false,\n\n\t\t\tfollowingUserId: true,\n\t\t\topacityForNextShape: true,\n\t\t\tstylesForNextShape: true,\n\t\t\tbrush: true,\n\t\t\tcursor: true,\n\t\t\tscribbles: true,\n\t\t\tisFocusMode: true,\n\t\t\tisDebugMode: true,\n\t\t\tisToolLocked: true,\n\t\t\texportBackground: true,\n\t\t\tscreenBounds: true,\n\t\t\tinsets: true,\n\t\t\tzoomBrush: true,\n\t\t\tisPenMode: true,\n\t\t\tisGridMode: true,\n\t\t\tchatMessage: true,\n\t\t\tisChatting: true,\n\t\t\thighlightedUserIds: true,\n\t\t\tisFocused: true,\n\t\t\tdevicePixelRatio: true,\n\t\t\tisCoarsePointer: true,\n\t\t\tisHoveringCanvas: true,\n\t\t\topenMenus: true,\n\t\t\tisChangingStyle: true,\n\t\t\tisReadonly: true,\n\t\t\tduplicateProps: true,\n\t\t},\n\t}).withDefaultProperties(\n\t\t(): Omit<TLInstance, 'typeName' | 'id' | 'currentPageId'> => ({\n\t\t\tfollowingUserId: null,\n\t\t\topacityForNextShape: 1,\n\t\t\tstylesForNextShape: {},\n\t\t\tbrush: null,\n\t\t\tscribbles: [],\n\t\t\tcursor: {\n\t\t\t\ttype: 'default',\n\t\t\t\trotation: 0,\n\t\t\t},\n\t\t\tisFocusMode: false,\n\t\t\texportBackground: false,\n\t\t\tisDebugMode: false,\n\t\t\tisToolLocked: false,\n\t\t\tscreenBounds: { x: 0, y: 0, w: 1080, h: 720 },\n\t\t\tinsets: [false, false, false, false],\n\t\t\tzoomBrush: null,\n\t\t\tisGridMode: false,\n\t\t\tisPenMode: false,\n\t\t\tchatMessage: '',\n\t\t\tisChatting: false,\n\t\t\thighlightedUserIds: [],\n\t\t\tisFocused: false,\n\t\t\tdevicePixelRatio: typeof window === 'undefined' ? 1 : window.devicePixelRatio,\n\t\t\tisCoarsePointer: false,\n\t\t\tisHoveringCanvas: null,\n\t\t\topenMenus: [] as string[],\n\t\t\tisChangingStyle: false,\n\t\t\tisReadonly: false,\n\t\t\tmeta: {},\n\t\t\tduplicateProps: null,\n\t\t})\n\t)\n}\n\n/**\n * Migration version identifiers for TLInstance records. Each version represents\n * a schema change that requires data transformation when loading older documents.\n *\n * The versions track the evolution of the instance record structure over time,\n * enabling backward and forward compatibility.\n *\n * @public\n */\nexport const instanceVersions = createMigrationIds('com.tldraw.instance', {\n\tAddTransparentExportBgs: 1,\n\tRemoveDialog: 2,\n\tAddToolLockMode: 3,\n\tRemoveExtraPropsForNextShape: 4,\n\tAddLabelColor: 5,\n\tAddFollowingUserId: 6,\n\tRemoveAlignJustify: 7,\n\tAddZoom: 8,\n\tAddVerticalAlign: 9,\n\tAddScribbleDelay: 10,\n\tRemoveUserId: 11,\n\tAddIsPenModeAndIsGridMode: 12,\n\tHoistOpacity: 13,\n\tAddChat: 14,\n\tAddHighlightedUserIds: 15,\n\tReplacePropsForNextShapeWithStylesForNextShape: 16,\n\tAddMeta: 17,\n\tRemoveCursorColor: 18,\n\tAddLonelyProperties: 19,\n\tReadOnlyReadonly: 20,\n\tAddHoveringCanvas: 21,\n\tAddScribbles: 22,\n\tAddInset: 23,\n\tAddDuplicateProps: 24,\n\tRemoveCanMoveCamera: 25,\n} as const)\n\n// TODO: rewrite these to use mutation\n\n/**\n * Migration sequence for TLInstance records. Defines how to transform instance\n * records between different schema versions, ensuring data compatibility when\n * loading documents created with different versions of tldraw.\n *\n * Each migration includes an 'up' function to migrate forward and optionally\n * a 'down' function for reverse migration.\n *\n * @example\n * ```ts\n * // Migrations are applied automatically when loading documents\n * const migratedInstance = instanceMigrations.migrate(oldInstance, targetVersion)\n * ```\n *\n * @public\n */\nexport const instanceMigrations = createRecordMigrationSequence({\n\tsequenceId: 'com.tldraw.instance',\n\trecordType: 'instance',\n\tsequence: [\n\t\t{\n\t\t\tid: instanceVersions.AddTransparentExportBgs,\n\t\t\tup: (instance) => {\n\t\t\t\treturn { ...instance, exportBackground: true }\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.RemoveDialog,\n\t\t\tup: ({ dialog: _, ...instance }: any) => {\n\t\t\t\treturn instance\n\t\t\t},\n\t\t},\n\n\t\t{\n\t\t\tid: instanceVersions.AddToolLockMode,\n\t\t\tup: (instance) => {\n\t\t\t\treturn { ...instance, isToolLocked: false }\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.RemoveExtraPropsForNextShape,\n\t\t\tup: ({ propsForNextShape, ...instance }: any) => {\n\t\t\t\treturn {\n\t\t\t\t\t...instance,\n\t\t\t\t\tpropsForNextShape: Object.fromEntries(\n\t\t\t\t\t\tObject.entries(propsForNextShape).filter(([key]) =>\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t'color',\n\t\t\t\t\t\t\t\t'labelColor',\n\t\t\t\t\t\t\t\t'dash',\n\t\t\t\t\t\t\t\t'fill',\n\t\t\t\t\t\t\t\t'size',\n\t\t\t\t\t\t\t\t'font',\n\t\t\t\t\t\t\t\t'align',\n\t\t\t\t\t\t\t\t'verticalAlign',\n\t\t\t\t\t\t\t\t'icon',\n\t\t\t\t\t\t\t\t'geo',\n\t\t\t\t\t\t\t\t'arrowheadStart',\n\t\t\t\t\t\t\t\t'arrowheadEnd',\n\t\t\t\t\t\t\t\t'spline',\n\t\t\t\t\t\t\t].includes(key)\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.AddLabelColor,\n\t\t\tup: ({ propsForNextShape, ...instance }: any) => {\n\t\t\t\treturn {\n\t\t\t\t\t...instance,\n\t\t\t\t\tpropsForNextShape: {\n\t\t\t\t\t\t...propsForNextShape,\n\t\t\t\t\t\tlabelColor: 'black',\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.AddFollowingUserId,\n\t\t\tup: (instance) => {\n\t\t\t\treturn { ...instance, followingUserId: null }\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.RemoveAlignJustify,\n\t\t\tup: (instance: any) => {\n\t\t\t\tlet newAlign = instance.propsForNextShape.align\n\t\t\t\tif (newAlign === 'justify') {\n\t\t\t\t\tnewAlign = 'start'\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\t...instance,\n\t\t\t\t\tpropsForNextShape: {\n\t\t\t\t\t\t...instance.propsForNextShape,\n\t\t\t\t\t\talign: newAlign,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.AddZoom,\n\t\t\tup: (instance) => {\n\t\t\t\treturn { ...instance, zoomBrush: null }\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.AddVerticalAlign,\n\t\t\tup: (instance: any) => {\n\t\t\t\treturn {\n\t\t\t\t\t...instance,\n\t\t\t\t\tpropsForNextShape: {\n\t\t\t\t\t\t...instance.propsForNextShape,\n\t\t\t\t\t\tverticalAlign: 'middle',\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.AddScribbleDelay,\n\t\t\tup: (instance: any) => {\n\t\t\t\tif (instance.scribble !== null) {\n\t\t\t\t\treturn { ...instance, scribble: { ...instance.scribble, delay: 0 } }\n\t\t\t\t}\n\t\t\t\treturn { ...instance }\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.RemoveUserId,\n\t\t\tup: ({ userId: _, ...instance }: any) => {\n\t\t\t\treturn instance\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.AddIsPenModeAndIsGridMode,\n\t\t\tup: (instance) => {\n\t\t\t\treturn { ...instance, isPenMode: false, isGridMode: false }\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.HoistOpacity,\n\t\t\tup: ({ propsForNextShape: { opacity, ...propsForNextShape }, ...instance }: any) => {\n\t\t\t\treturn { ...instance, opacityForNextShape: Number(opacity ?? '1'), propsForNextShape }\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.AddChat,\n\t\t\tup: (instance) => {\n\t\t\t\treturn { ...instance, chatMessage: '', isChatting: false }\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.AddHighlightedUserIds,\n\t\t\tup: (instance) => {\n\t\t\t\treturn { ...instance, highlightedUserIds: [] }\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.ReplacePropsForNextShapeWithStylesForNextShape,\n\t\t\tup: ({ propsForNextShape: _, ...instance }: any) => {\n\t\t\t\treturn { ...instance, stylesForNextShape: {} }\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.AddMeta,\n\t\t\tup: (record) => {\n\t\t\t\treturn {\n\t\t\t\t\t...record,\n\t\t\t\t\tmeta: {},\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.RemoveCursorColor,\n\t\t\tup: (record: any) => {\n\t\t\t\tconst { color: _, ...cursor } = record.cursor\n\t\t\t\treturn {\n\t\t\t\t\t...record,\n\t\t\t\t\tcursor,\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.AddLonelyProperties,\n\t\t\tup: (record) => {\n\t\t\t\treturn {\n\t\t\t\t\t...record,\n\t\t\t\t\tcanMoveCamera: true,\n\t\t\t\t\tisFocused: false,\n\t\t\t\t\tdevicePixelRatio: 1,\n\t\t\t\t\tisCoarsePointer: false,\n\t\t\t\t\topenMenus: [],\n\t\t\t\t\tisChangingStyle: false,\n\t\t\t\t\tisReadOnly: false,\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.ReadOnlyReadonly,\n\t\t\tup: ({ isReadOnly: _isReadOnly, ...record }: any) => {\n\t\t\t\treturn {\n\t\t\t\t\t...record,\n\t\t\t\t\tisReadonly: _isReadOnly,\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.AddHoveringCanvas,\n\t\t\tup: (record) => {\n\t\t\t\treturn {\n\t\t\t\t\t...record,\n\t\t\t\t\tisHoveringCanvas: null,\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.AddScribbles,\n\t\t\tup: ({ scribble: _, ...record }: any) => {\n\t\t\t\treturn {\n\t\t\t\t\t...record,\n\t\t\t\t\tscribbles: [],\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.AddInset,\n\t\t\tup: (record) => {\n\t\t\t\treturn {\n\t\t\t\t\t...record,\n\t\t\t\t\tinsets: [false, false, false, false],\n\t\t\t\t}\n\t\t\t},\n\t\t\tdown: ({ insets: _, ...record }: any) => {\n\t\t\t\treturn {\n\t\t\t\t\t...record,\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.AddDuplicateProps,\n\t\t\tup: (record) => {\n\t\t\t\treturn {\n\t\t\t\t\t...record,\n\t\t\t\t\tduplicateProps: null,\n\t\t\t\t}\n\t\t\t},\n\t\t\tdown: ({ duplicateProps: _, ...record }: any) => {\n\t\t\t\treturn {\n\t\t\t\t\t...record,\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: instanceVersions.RemoveCanMoveCamera,\n\t\t\tup: ({ canMoveCamera: _, ...record }: any) => {\n\t\t\t\treturn {\n\t\t\t\t\t...record,\n\t\t\t\t}\n\t\t\t},\n\t\t\tdown: (instance) => {\n\t\t\t\treturn { ...instance, canMoveCamera: true }\n\t\t\t},\n\t\t},\n\t],\n})\n\n/**\n * The constant ID used for the singleton TLInstance record.\n *\n * Since each browser tab has exactly one instance, this constant ID\n * is used universally across the application.\n *\n * @example\n * ```ts\n * const instance = store.get(TLINSTANCE_ID)\n * if (instance) {\n * console.log('Current page:', instance.currentPageId)\n * }\n * ```\n *\n * @public\n */\nexport const TLINSTANCE_ID = 'instance:instance' as TLInstanceId\n"],
5
+ "mappings": "AAAA;AAAA,EAEC;AAAA,EACA;AAAA,EACA;AAAA,OAEM;AACP,SAAS,qBAAiC;AAC1C,SAAS,SAAS;AAClB,SAAmB,yBAAyB;AAC5C,SAAS,mBAAmB;AAC5B,SAAS,uBAAiC;AAC1C,SAAS,wBAAuC;AAChD,SAAS,yBAAqC;AAE9C,SAAS,uBAAiC;AA+EnC,MAAM,sCAAsC;AAAA;AAAA,EAGlD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AAA,MACrB,IAAI,CAAC,WAAW;AACf,eAAO;AAAA,UACN,GAAG;AAAA,UACH,gBAAgB;AAAA,QACjB;AAAA,MACD;AAAA,MACA,MAAM,CAAC,EAAE,gBAAgB,GAAG,GAAG,OAAO,MAAW;AAChD,eAAO;AAAA,UACN,GAAG;AAAA,QACJ;AAAA,MACD;AAAA,IACD;AAAA,IACA;AAAA,MACC,IAAI,iBAAiB;AAAA,MACrB,IAAI,CAAC,EAAE,eAAe,GAAG,GAAG,OAAO,MAAW;AAC7C,eAAO;AAAA,UACN,GAAG;AAAA,QACJ;AAAA,MACD;AAAA,MACA,MAAM,CAAC,aAAa;AACnB,eAAO,EAAE,GAAG,UAAU,eAAe,KAAK;AAAA,MAC3C;AAAA,IACD;AAAA,EACD;AACD,CAAC;AAkBM,MAAM,gBAAgB;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/records/TLPage.ts"],
4
- "sourcesContent": ["import {\n\tBaseRecord,\n\tcreateMigrationIds,\n\tcreateRecordMigrationSequence,\n\tcreateRecordType,\n\tRecordId,\n} from '@tldraw/store'\nimport { IndexKey, JsonObject } from '@tldraw/utils'\nimport { T } from '@tldraw/validate'\nimport { idValidator } from '../misc/id-validator'\n\n/**\n * TLPage\n *\n * @public\n */\nexport interface TLPage extends BaseRecord<'page', TLPageId> {\n\tname: string\n\tindex: IndexKey\n\tmeta: JsonObject\n}\n\n/** @public */\nexport type TLPageId = RecordId<TLPage>\n\n/** @public */\nexport const pageIdValidator = idValidator<TLPageId>('page')\n\n/** @public */\nexport const pageValidator: T.Validator<TLPage> = T.model(\n\t'page',\n\tT.object({\n\t\ttypeName: T.literal('page'),\n\t\tid: pageIdValidator,\n\t\tname: T.string,\n\t\tindex: T.indexKey,\n\t\tmeta: T.jsonValue as T.ObjectValidator<JsonObject>,\n\t})\n)\n\n/** @public */\nexport const pageVersions = createMigrationIds('com.tldraw.page', {\n\tAddMeta: 1,\n})\n\n/** @public */\nexport const pageMigrations = createRecordMigrationSequence({\n\tsequenceId: 'com.tldraw.page',\n\trecordType: 'page',\n\tsequence: [\n\t\t{\n\t\t\tid: pageVersions.AddMeta,\n\t\t\tup: (record: any) => {\n\t\t\t\trecord.meta = {}\n\t\t\t},\n\t\t},\n\t],\n})\n\n/** @public */\nexport const PageRecordType = createRecordType<TLPage>('page', {\n\tvalidator: pageValidator,\n\tscope: 'document',\n}).withDefaultProperties(() => ({\n\tmeta: {},\n}))\n\n/** @public */\nexport function isPageId(id: string): id is TLPageId {\n\treturn PageRecordType.isId(id)\n}\n"],
5
- "mappings": "AAAA;AAAA,EAEC;AAAA,EACA;AAAA,EACA;AAAA,OAEM;AAEP,SAAS,SAAS;AAClB,SAAS,mBAAmB;AAiBrB,MAAM,kBAAkB,YAAsB,MAAM;AAGpD,MAAM,gBAAqC,EAAE;AAAA,EACnD;AAAA,EACA,EAAE,OAAO;AAAA,IACR,UAAU,EAAE,QAAQ,MAAM;AAAA,IAC1B,IAAI;AAAA,IACJ,MAAM,EAAE;AAAA,IACR,OAAO,EAAE;AAAA,IACT,MAAM,EAAE;AAAA,EACT,CAAC;AACF;AAGO,MAAM,eAAe,mBAAmB,mBAAmB;AAAA,EACjE,SAAS;AACV,CAAC;AAGM,MAAM,iBAAiB,8BAA8B;AAAA,EAC3D,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,UAAU;AAAA,IACT;AAAA,MACC,IAAI,aAAa;AAAA,MACjB,IAAI,CAAC,WAAgB;AACpB,eAAO,OAAO,CAAC;AAAA,MAChB;AAAA,IACD;AAAA,EACD;AACD,CAAC;AAGM,MAAM,iBAAiB,iBAAyB,QAAQ;AAAA,EAC9D,WAAW;AAAA,EACX,OAAO;AACR,CAAC,EAAE,sBAAsB,OAAO;AAAA,EAC/B,MAAM,CAAC;AACR,EAAE;AAGK,SAAS,SAAS,IAA4B;AACpD,SAAO,eAAe,KAAK,EAAE;AAC9B;",
4
+ "sourcesContent": ["import {\n\tBaseRecord,\n\tcreateMigrationIds,\n\tcreateRecordMigrationSequence,\n\tcreateRecordType,\n\tRecordId,\n} from '@tldraw/store'\nimport { IndexKey, JsonObject } from '@tldraw/utils'\nimport { T } from '@tldraw/validate'\nimport { idValidator } from '../misc/id-validator'\n\n/**\n * A page within a tldraw document. Pages are containers for shapes and provide\n * a way to organize content into separate canvases. Each document can have multiple\n * pages, and users can navigate between them.\n *\n * Pages have a name for identification, an index for ordering, and can store\n * custom metadata.\n *\n * @example\n * ```ts\n * const page: TLPage = {\n * id: 'page:page1',\n * typeName: 'page',\n * name: 'Page 1',\n * index: 'a1',\n * meta: { description: 'Main design page' }\n * }\n * ```\n *\n * @public\n */\nexport interface TLPage extends BaseRecord<'page', TLPageId> {\n\tname: string\n\tindex: IndexKey\n\tmeta: JsonObject\n}\n\n/**\n * A unique identifier for TLPage records.\n *\n * Page IDs follow the format 'page:' followed by a unique string identifier.\n *\n * @example\n * ```ts\n * const pageId: TLPageId = 'page:main'\n * const pageId2: TLPageId = createShapeId() // generates 'page:abc123'\n * ```\n *\n * @public\n */\nexport type TLPageId = RecordId<TLPage>\n\n/**\n * Validator for TLPageId values. Ensures the ID follows the correct\n * format for page records ('page:' prefix).\n *\n * @example\n * ```ts\n * const isValid = pageIdValidator.isValid('page:main') // true\n * const isValid2 = pageIdValidator.isValid('shape:abc') // false\n * ```\n *\n * @public\n */\nexport const pageIdValidator = idValidator<TLPageId>('page')\n\n/**\n * Runtime validator for TLPage records. Validates the structure and types\n * of all page properties to ensure data integrity.\n *\n * @example\n * ```ts\n * const page = { id: 'page:1', typeName: 'page', name: 'My Page', index: 'a1', meta: {} }\n * const isValid = pageValidator.isValid(page) // true\n * ```\n *\n * @public\n */\nexport const pageValidator: T.Validator<TLPage> = T.model(\n\t'page',\n\tT.object({\n\t\ttypeName: T.literal('page'),\n\t\tid: pageIdValidator,\n\t\tname: T.string,\n\t\tindex: T.indexKey,\n\t\tmeta: T.jsonValue as T.ObjectValidator<JsonObject>,\n\t})\n)\n\n/**\n * Migration version identifiers for TLPage records. Each version represents\n * a schema change that requires data transformation when loading older documents.\n *\n * @public\n */\nexport const pageVersions = createMigrationIds('com.tldraw.page', {\n\tAddMeta: 1,\n})\n\n/**\n * Migration sequence for TLPage records. Defines how to transform page\n * records between different schema versions, ensuring data compatibility.\n *\n * @example\n * ```ts\n * // Migrations are applied automatically when loading documents\n * const migratedPage = pageMigrations.migrate(oldPage, targetVersion)\n * ```\n *\n * @public\n */\nexport const pageMigrations = createRecordMigrationSequence({\n\tsequenceId: 'com.tldraw.page',\n\trecordType: 'page',\n\tsequence: [\n\t\t{\n\t\t\tid: pageVersions.AddMeta,\n\t\t\tup: (record: any) => {\n\t\t\t\trecord.meta = {}\n\t\t\t},\n\t\t},\n\t],\n})\n\n/**\n * The RecordType definition for TLPage records. Defines validation, scope,\n * and default properties for page records in the tldraw store.\n *\n * Pages are scoped to the document level, meaning they persist across sessions\n * and are shared in collaborative environments.\n *\n * @example\n * ```ts\n * const page = PageRecordType.create({\n * id: 'page:main',\n * name: 'Main Page',\n * index: 'a1'\n * })\n * ```\n *\n * @public\n */\nexport const PageRecordType = createRecordType<TLPage>('page', {\n\tvalidator: pageValidator,\n\tscope: 'document',\n}).withDefaultProperties(() => ({\n\tmeta: {},\n}))\n\n/**\n * Type guard to check if a string is a valid TLPageId.\n *\n * @param id - The string to check\n * @returns True if the ID is a valid page ID, false otherwise\n *\n * @example\n * ```ts\n * if (isPageId('page:main')) {\n * // TypeScript knows this is a TLPageId\n * console.log('Valid page ID')\n * }\n * ```\n *\n * @public\n */\nexport function isPageId(id: string): id is TLPageId {\n\treturn PageRecordType.isId(id)\n}\n"],
5
+ "mappings": "AAAA;AAAA,EAEC;AAAA,EACA;AAAA,EACA;AAAA,OAEM;AAEP,SAAS,SAAS;AAClB,SAAS,mBAAmB;AAwDrB,MAAM,kBAAkB,YAAsB,MAAM;AAcpD,MAAM,gBAAqC,EAAE;AAAA,EACnD;AAAA,EACA,EAAE,OAAO;AAAA,IACR,UAAU,EAAE,QAAQ,MAAM;AAAA,IAC1B,IAAI;AAAA,IACJ,MAAM,EAAE;AAAA,IACR,OAAO,EAAE;AAAA,IACT,MAAM,EAAE;AAAA,EACT,CAAC;AACF;AAQO,MAAM,eAAe,mBAAmB,mBAAmB;AAAA,EACjE,SAAS;AACV,CAAC;AAcM,MAAM,iBAAiB,8BAA8B;AAAA,EAC3D,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,UAAU;AAAA,IACT;AAAA,MACC,IAAI,aAAa;AAAA,MACjB,IAAI,CAAC,WAAgB;AACpB,eAAO,OAAO,CAAC;AAAA,MAChB;AAAA,IACD;AAAA,EACD;AACD,CAAC;AAoBM,MAAM,iBAAiB,iBAAyB,QAAQ;AAAA,EAC9D,WAAW;AAAA,EACX,OAAO;AACR,CAAC,EAAE,sBAAsB,OAAO;AAAA,EAC/B,MAAM,CAAC;AACR,EAAE;AAkBK,SAAS,SAAS,IAA4B;AACpD,SAAO,eAAe,KAAK,EAAE;AAC9B;",
6
6
  "names": []
7
7
  }