@bigbluebutton/tlschema 2.0.0-alpha.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. package/LICENSE +190 -0
  2. package/dist-cjs/TLStore.js +133 -0
  3. package/dist-cjs/TLStore.js.map +7 -0
  4. package/dist-cjs/assets/TLBaseAsset.js +37 -0
  5. package/dist-cjs/assets/TLBaseAsset.js.map +7 -0
  6. package/dist-cjs/assets/TLBookmarkAsset.js +38 -0
  7. package/dist-cjs/assets/TLBookmarkAsset.js.map +7 -0
  8. package/dist-cjs/assets/TLImageAsset.js +76 -0
  9. package/dist-cjs/assets/TLImageAsset.js.map +7 -0
  10. package/dist-cjs/assets/TLVideoAsset.js +76 -0
  11. package/dist-cjs/assets/TLVideoAsset.js.map +7 -0
  12. package/dist-cjs/createPresenceStateDerivation.js +68 -0
  13. package/dist-cjs/createPresenceStateDerivation.js.map +7 -0
  14. package/dist-cjs/createTLSchema.js +68 -0
  15. package/dist-cjs/createTLSchema.js.map +7 -0
  16. package/dist-cjs/index.d.ts +1414 -0
  17. package/dist-cjs/index.js +142 -0
  18. package/dist-cjs/index.js.map +7 -0
  19. package/dist-cjs/misc/TLColor.js +36 -0
  20. package/dist-cjs/misc/TLColor.js.map +7 -0
  21. package/dist-cjs/misc/TLCursor.js +55 -0
  22. package/dist-cjs/misc/TLCursor.js.map +7 -0
  23. package/dist-cjs/misc/TLHandle.js +36 -0
  24. package/dist-cjs/misc/TLHandle.js.map +7 -0
  25. package/dist-cjs/misc/TLOpacity.js +30 -0
  26. package/dist-cjs/misc/TLOpacity.js.map +7 -0
  27. package/dist-cjs/misc/TLScribble.js +40 -0
  28. package/dist-cjs/misc/TLScribble.js.map +7 -0
  29. package/dist-cjs/misc/geometry-types.js +37 -0
  30. package/dist-cjs/misc/geometry-types.js.map +7 -0
  31. package/dist-cjs/misc/id-validator.js +33 -0
  32. package/dist-cjs/misc/id-validator.js.map +7 -0
  33. package/dist-cjs/records/TLAsset.js +74 -0
  34. package/dist-cjs/records/TLAsset.js.map +7 -0
  35. package/dist-cjs/records/TLCamera.js +74 -0
  36. package/dist-cjs/records/TLCamera.js.map +7 -0
  37. package/dist-cjs/records/TLDocument.js +82 -0
  38. package/dist-cjs/records/TLDocument.js.map +7 -0
  39. package/dist-cjs/records/TLInstance.js +452 -0
  40. package/dist-cjs/records/TLInstance.js.map +7 -0
  41. package/dist-cjs/records/TLPage.js +74 -0
  42. package/dist-cjs/records/TLPage.js.map +7 -0
  43. package/dist-cjs/records/TLPageState.js +209 -0
  44. package/dist-cjs/records/TLPageState.js.map +7 -0
  45. package/dist-cjs/records/TLPointer.js +76 -0
  46. package/dist-cjs/records/TLPointer.js.map +7 -0
  47. package/dist-cjs/records/TLPresence.js +170 -0
  48. package/dist-cjs/records/TLPresence.js.map +7 -0
  49. package/dist-cjs/records/TLRecord.js +17 -0
  50. package/dist-cjs/records/TLRecord.js.map +7 -0
  51. package/dist-cjs/records/TLShape.js +147 -0
  52. package/dist-cjs/records/TLShape.js.map +7 -0
  53. package/dist-cjs/shapes/TLArrowShape.js +156 -0
  54. package/dist-cjs/shapes/TLArrowShape.js.map +7 -0
  55. package/dist-cjs/shapes/TLBaseShape.js +52 -0
  56. package/dist-cjs/shapes/TLBaseShape.js.map +7 -0
  57. package/dist-cjs/shapes/TLBookmarkShape.js +57 -0
  58. package/dist-cjs/shapes/TLBookmarkShape.js.map +7 -0
  59. package/dist-cjs/shapes/TLDrawShape.js +89 -0
  60. package/dist-cjs/shapes/TLDrawShape.js.map +7 -0
  61. package/dist-cjs/shapes/TLEmbedShape.js +709 -0
  62. package/dist-cjs/shapes/TLEmbedShape.js.map +7 -0
  63. package/dist-cjs/shapes/TLFrameShape.js +33 -0
  64. package/dist-cjs/shapes/TLFrameShape.js.map +7 -0
  65. package/dist-cjs/shapes/TLGeoShape.js +230 -0
  66. package/dist-cjs/shapes/TLGeoShape.js.map +7 -0
  67. package/dist-cjs/shapes/TLGroupShape.js +28 -0
  68. package/dist-cjs/shapes/TLGroupShape.js.map +7 -0
  69. package/dist-cjs/shapes/TLHighlightShape.js +38 -0
  70. package/dist-cjs/shapes/TLHighlightShape.js.map +7 -0
  71. package/dist-cjs/shapes/TLImageShape.js +69 -0
  72. package/dist-cjs/shapes/TLImageShape.js.map +7 -0
  73. package/dist-cjs/shapes/TLLineShape.js +70 -0
  74. package/dist-cjs/shapes/TLLineShape.js.map +7 -0
  75. package/dist-cjs/shapes/TLNoteShape.js +144 -0
  76. package/dist-cjs/shapes/TLNoteShape.js.map +7 -0
  77. package/dist-cjs/shapes/TLTextShape.js +67 -0
  78. package/dist-cjs/shapes/TLTextShape.js.map +7 -0
  79. package/dist-cjs/shapes/TLVideoShape.js +53 -0
  80. package/dist-cjs/shapes/TLVideoShape.js.map +7 -0
  81. package/dist-cjs/store-migrations.js +81 -0
  82. package/dist-cjs/store-migrations.js.map +7 -0
  83. package/dist-cjs/styles/StyleProp.js +94 -0
  84. package/dist-cjs/styles/StyleProp.js.map +7 -0
  85. package/dist-cjs/styles/TLColorStyle.js +283 -0
  86. package/dist-cjs/styles/TLColorStyle.js.map +7 -0
  87. package/dist-cjs/styles/TLDashStyle.js +29 -0
  88. package/dist-cjs/styles/TLDashStyle.js.map +7 -0
  89. package/dist-cjs/styles/TLFillStyle.js +29 -0
  90. package/dist-cjs/styles/TLFillStyle.js.map +7 -0
  91. package/dist-cjs/styles/TLFontStyle.js +36 -0
  92. package/dist-cjs/styles/TLFontStyle.js.map +7 -0
  93. package/dist-cjs/styles/TLHorizontalAlignStyle.js +29 -0
  94. package/dist-cjs/styles/TLHorizontalAlignStyle.js.map +7 -0
  95. package/dist-cjs/styles/TLSizeStyle.js +29 -0
  96. package/dist-cjs/styles/TLSizeStyle.js.map +7 -0
  97. package/dist-cjs/styles/TLVerticalAlignStyle.js +29 -0
  98. package/dist-cjs/styles/TLVerticalAlignStyle.js.map +7 -0
  99. package/dist-cjs/translations/languages.js +59 -0
  100. package/dist-cjs/translations/languages.js.map +7 -0
  101. package/dist-cjs/translations/translations.js +63 -0
  102. package/dist-cjs/translations/translations.js.map +7 -0
  103. package/dist-cjs/util-types.js +17 -0
  104. package/dist-cjs/util-types.js.map +7 -0
  105. package/dist-esm/TLStore.mjs +113 -0
  106. package/dist-esm/TLStore.mjs.map +7 -0
  107. package/dist-esm/assets/TLBaseAsset.mjs +17 -0
  108. package/dist-esm/assets/TLBaseAsset.mjs.map +7 -0
  109. package/dist-esm/assets/TLBookmarkAsset.mjs +18 -0
  110. package/dist-esm/assets/TLBookmarkAsset.mjs.map +7 -0
  111. package/dist-esm/assets/TLImageAsset.mjs +56 -0
  112. package/dist-esm/assets/TLImageAsset.mjs.map +7 -0
  113. package/dist-esm/assets/TLVideoAsset.mjs +56 -0
  114. package/dist-esm/assets/TLVideoAsset.mjs.map +7 -0
  115. package/dist-esm/createPresenceStateDerivation.mjs +48 -0
  116. package/dist-esm/createPresenceStateDerivation.mjs.map +7 -0
  117. package/dist-esm/createTLSchema.mjs +48 -0
  118. package/dist-esm/createTLSchema.mjs.map +7 -0
  119. package/dist-esm/index.d.mts +1414 -0
  120. package/dist-esm/index.mjs +193 -0
  121. package/dist-esm/index.mjs.map +7 -0
  122. package/dist-esm/misc/TLColor.mjs +16 -0
  123. package/dist-esm/misc/TLColor.mjs.map +7 -0
  124. package/dist-esm/misc/TLCursor.mjs +35 -0
  125. package/dist-esm/misc/TLCursor.mjs.map +7 -0
  126. package/dist-esm/misc/TLHandle.mjs +16 -0
  127. package/dist-esm/misc/TLHandle.mjs.map +7 -0
  128. package/dist-esm/misc/TLOpacity.mjs +10 -0
  129. package/dist-esm/misc/TLOpacity.mjs.map +7 -0
  130. package/dist-esm/misc/TLScribble.mjs +20 -0
  131. package/dist-esm/misc/TLScribble.mjs.map +7 -0
  132. package/dist-esm/misc/geometry-types.mjs +17 -0
  133. package/dist-esm/misc/geometry-types.mjs.map +7 -0
  134. package/dist-esm/misc/id-validator.mjs +13 -0
  135. package/dist-esm/misc/id-validator.mjs.map +7 -0
  136. package/dist-esm/records/TLAsset.mjs +57 -0
  137. package/dist-esm/records/TLAsset.mjs.map +7 -0
  138. package/dist-esm/records/TLCamera.mjs +54 -0
  139. package/dist-esm/records/TLCamera.mjs.map +7 -0
  140. package/dist-esm/records/TLDocument.mjs +62 -0
  141. package/dist-esm/records/TLDocument.mjs.map +7 -0
  142. package/dist-esm/records/TLInstance.mjs +432 -0
  143. package/dist-esm/records/TLInstance.mjs.map +7 -0
  144. package/dist-esm/records/TLPage.mjs +54 -0
  145. package/dist-esm/records/TLPage.mjs.map +7 -0
  146. package/dist-esm/records/TLPageState.mjs +189 -0
  147. package/dist-esm/records/TLPageState.mjs.map +7 -0
  148. package/dist-esm/records/TLPointer.mjs +56 -0
  149. package/dist-esm/records/TLPointer.mjs.map +7 -0
  150. package/dist-esm/records/TLPresence.mjs +150 -0
  151. package/dist-esm/records/TLPresence.mjs.map +7 -0
  152. package/dist-esm/records/TLRecord.mjs +1 -0
  153. package/dist-esm/records/TLRecord.mjs.map +7 -0
  154. package/dist-esm/records/TLShape.mjs +127 -0
  155. package/dist-esm/records/TLShape.mjs.map +7 -0
  156. package/dist-esm/shapes/TLArrowShape.mjs +136 -0
  157. package/dist-esm/shapes/TLArrowShape.mjs.map +7 -0
  158. package/dist-esm/shapes/TLBaseShape.mjs +32 -0
  159. package/dist-esm/shapes/TLBaseShape.mjs.map +7 -0
  160. package/dist-esm/shapes/TLBookmarkShape.mjs +37 -0
  161. package/dist-esm/shapes/TLBookmarkShape.mjs.map +7 -0
  162. package/dist-esm/shapes/TLDrawShape.mjs +69 -0
  163. package/dist-esm/shapes/TLDrawShape.mjs.map +7 -0
  164. package/dist-esm/shapes/TLEmbedShape.mjs +689 -0
  165. package/dist-esm/shapes/TLEmbedShape.mjs.map +7 -0
  166. package/dist-esm/shapes/TLFrameShape.mjs +13 -0
  167. package/dist-esm/shapes/TLFrameShape.mjs.map +7 -0
  168. package/dist-esm/shapes/TLGeoShape.mjs +212 -0
  169. package/dist-esm/shapes/TLGeoShape.mjs.map +7 -0
  170. package/dist-esm/shapes/TLGroupShape.mjs +8 -0
  171. package/dist-esm/shapes/TLGroupShape.mjs.map +7 -0
  172. package/dist-esm/shapes/TLHighlightShape.mjs +18 -0
  173. package/dist-esm/shapes/TLHighlightShape.mjs.map +7 -0
  174. package/dist-esm/shapes/TLImageShape.mjs +49 -0
  175. package/dist-esm/shapes/TLImageShape.mjs.map +7 -0
  176. package/dist-esm/shapes/TLLineShape.mjs +50 -0
  177. package/dist-esm/shapes/TLLineShape.mjs.map +7 -0
  178. package/dist-esm/shapes/TLNoteShape.mjs +126 -0
  179. package/dist-esm/shapes/TLNoteShape.mjs.map +7 -0
  180. package/dist-esm/shapes/TLTextShape.mjs +47 -0
  181. package/dist-esm/shapes/TLTextShape.mjs.map +7 -0
  182. package/dist-esm/shapes/TLVideoShape.mjs +33 -0
  183. package/dist-esm/shapes/TLVideoShape.mjs.map +7 -0
  184. package/dist-esm/store-migrations.mjs +61 -0
  185. package/dist-esm/store-migrations.mjs.map +7 -0
  186. package/dist-esm/styles/StyleProp.mjs +74 -0
  187. package/dist-esm/styles/StyleProp.mjs.map +7 -0
  188. package/dist-esm/styles/TLColorStyle.mjs +263 -0
  189. package/dist-esm/styles/TLColorStyle.mjs.map +7 -0
  190. package/dist-esm/styles/TLDashStyle.mjs +9 -0
  191. package/dist-esm/styles/TLDashStyle.mjs.map +7 -0
  192. package/dist-esm/styles/TLFillStyle.mjs +9 -0
  193. package/dist-esm/styles/TLFillStyle.mjs.map +7 -0
  194. package/dist-esm/styles/TLFontStyle.mjs +16 -0
  195. package/dist-esm/styles/TLFontStyle.mjs.map +7 -0
  196. package/dist-esm/styles/TLHorizontalAlignStyle.mjs +9 -0
  197. package/dist-esm/styles/TLHorizontalAlignStyle.mjs.map +7 -0
  198. package/dist-esm/styles/TLSizeStyle.mjs +9 -0
  199. package/dist-esm/styles/TLSizeStyle.mjs.map +7 -0
  200. package/dist-esm/styles/TLVerticalAlignStyle.mjs +9 -0
  201. package/dist-esm/styles/TLVerticalAlignStyle.mjs.map +7 -0
  202. package/dist-esm/translations/languages.mjs +39 -0
  203. package/dist-esm/translations/languages.mjs.map +7 -0
  204. package/dist-esm/translations/translations.mjs +43 -0
  205. package/dist-esm/translations/translations.mjs.map +7 -0
  206. package/dist-esm/util-types.mjs +1 -0
  207. package/dist-esm/util-types.mjs.map +7 -0
  208. package/package.json +64 -0
  209. package/src/TLStore.ts +160 -0
  210. package/src/assets/TLBaseAsset.ts +44 -0
  211. package/src/assets/TLBookmarkAsset.ts +31 -0
  212. package/src/assets/TLImageAsset.ts +73 -0
  213. package/src/assets/TLVideoAsset.ts +73 -0
  214. package/src/createPresenceStateDerivation.ts +53 -0
  215. package/src/createTLSchema.ts +65 -0
  216. package/src/index.ts +168 -0
  217. package/src/migrations.test.ts +1768 -0
  218. package/src/misc/TLColor.ts +28 -0
  219. package/src/misc/TLCursor.ts +54 -0
  220. package/src/misc/TLHandle.ts +41 -0
  221. package/src/misc/TLOpacity.ts +11 -0
  222. package/src/misc/TLScribble.ts +39 -0
  223. package/src/misc/geometry-types.ts +37 -0
  224. package/src/misc/id-validator.ts +14 -0
  225. package/src/records/TLAsset.ts +80 -0
  226. package/src/records/TLCamera.ts +74 -0
  227. package/src/records/TLDocument.ts +77 -0
  228. package/src/records/TLInstance.ts +493 -0
  229. package/src/records/TLPage.ts +72 -0
  230. package/src/records/TLPageState.ts +216 -0
  231. package/src/records/TLPointer.ts +74 -0
  232. package/src/records/TLPresence.ts +179 -0
  233. package/src/records/TLRecord.ts +21 -0
  234. package/src/records/TLShape.ts +214 -0
  235. package/src/shapes/TLArrowShape.ts +160 -0
  236. package/src/shapes/TLBaseShape.ts +67 -0
  237. package/src/shapes/TLBookmarkShape.ts +44 -0
  238. package/src/shapes/TLDrawShape.ts +89 -0
  239. package/src/shapes/TLEmbedShape.ts +754 -0
  240. package/src/shapes/TLFrameShape.ts +18 -0
  241. package/src/shapes/TLGeoShape.ts +226 -0
  242. package/src/shapes/TLGroupShape.ts +14 -0
  243. package/src/shapes/TLHighlightShape.ts +24 -0
  244. package/src/shapes/TLImageShape.ts +59 -0
  245. package/src/shapes/TLLineShape.ts +61 -0
  246. package/src/shapes/TLNoteShape.ts +137 -0
  247. package/src/shapes/TLTextShape.ts +55 -0
  248. package/src/shapes/TLVideoShape.ts +40 -0
  249. package/src/store-migrations.ts +63 -0
  250. package/src/styles/StyleProp.ts +105 -0
  251. package/src/styles/TLColorStyle.ts +296 -0
  252. package/src/styles/TLDashStyle.ts +11 -0
  253. package/src/styles/TLFillStyle.ts +11 -0
  254. package/src/styles/TLFontStyle.ts +19 -0
  255. package/src/styles/TLHorizontalAlignStyle.ts +11 -0
  256. package/src/styles/TLSizeStyle.ts +11 -0
  257. package/src/styles/TLVerticalAlignStyle.ts +11 -0
  258. package/src/translations/languages.ts +39 -0
  259. package/src/translations/translations.test.ts +43 -0
  260. package/src/translations/translations.ts +73 -0
  261. package/src/util-types.ts +2 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/styles/TLHorizontalAlignStyle.ts"],
4
+ "sourcesContent": ["import { T } from '@bigbluebutton/validate'\nimport { StyleProp } from './StyleProp'\n\n/** @public */\nexport const DefaultHorizontalAlignStyle = StyleProp.defineEnum('tldraw:horizontalAlign', {\n\tdefaultValue: 'middle',\n\tvalues: ['start', 'middle', 'end', 'start-legacy', 'end-legacy', 'middle-legacy'],\n})\n\n/** @public */\nexport type TLDefaultHorizontalAlignStyle = T.TypeOf<typeof DefaultHorizontalAlignStyle>\n"],
5
+ "mappings": "AACA,SAAS,iBAAiB;AAGnB,MAAM,8BAA8B,UAAU,WAAW,0BAA0B;AAAA,EACzF,cAAc;AAAA,EACd,QAAQ,CAAC,SAAS,UAAU,OAAO,gBAAgB,cAAc,eAAe;AACjF,CAAC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,9 @@
1
+ import { StyleProp } from "./StyleProp.mjs";
2
+ const DefaultSizeStyle = StyleProp.defineEnum("tldraw:size", {
3
+ defaultValue: "m",
4
+ values: ["s", "m", "l", "xl"]
5
+ });
6
+ export {
7
+ DefaultSizeStyle
8
+ };
9
+ //# sourceMappingURL=TLSizeStyle.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/styles/TLSizeStyle.ts"],
4
+ "sourcesContent": ["import { T } from '@bigbluebutton/validate'\nimport { StyleProp } from './StyleProp'\n\n/** @public */\nexport const DefaultSizeStyle = StyleProp.defineEnum('tldraw:size', {\n\tdefaultValue: 'm',\n\tvalues: ['s', 'm', 'l', 'xl'],\n})\n\n/** @public */\nexport type TLDefaultSizeStyle = T.TypeOf<typeof DefaultSizeStyle>\n"],
5
+ "mappings": "AACA,SAAS,iBAAiB;AAGnB,MAAM,mBAAmB,UAAU,WAAW,eAAe;AAAA,EACnE,cAAc;AAAA,EACd,QAAQ,CAAC,KAAK,KAAK,KAAK,IAAI;AAC7B,CAAC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,9 @@
1
+ import { StyleProp } from "./StyleProp.mjs";
2
+ const DefaultVerticalAlignStyle = StyleProp.defineEnum("tldraw:verticalAlign", {
3
+ defaultValue: "middle",
4
+ values: ["start", "middle", "end"]
5
+ });
6
+ export {
7
+ DefaultVerticalAlignStyle
8
+ };
9
+ //# sourceMappingURL=TLVerticalAlignStyle.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/styles/TLVerticalAlignStyle.ts"],
4
+ "sourcesContent": ["import { T } from '@bigbluebutton/validate'\nimport { StyleProp } from './StyleProp'\n\n/** @public */\nexport const DefaultVerticalAlignStyle = StyleProp.defineEnum('tldraw:verticalAlign', {\n\tdefaultValue: 'middle',\n\tvalues: ['start', 'middle', 'end'],\n})\n\n/** @public */\nexport type TLDefaultVerticalAlignStyle = T.TypeOf<typeof DefaultVerticalAlignStyle>\n"],
5
+ "mappings": "AACA,SAAS,iBAAiB;AAGnB,MAAM,4BAA4B,UAAU,WAAW,wBAAwB;AAAA,EACrF,cAAc;AAAA,EACd,QAAQ,CAAC,SAAS,UAAU,KAAK;AAClC,CAAC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,39 @@
1
+ const LANGUAGES = [
2
+ { locale: "ar", label: "\u0639\u0631\u0628\u064A" },
3
+ { locale: "ca", label: "Catal\xE0" },
4
+ { locale: "da", label: "Danish" },
5
+ { locale: "de", label: "Deutsch" },
6
+ { locale: "en", label: "English" },
7
+ { locale: "es", label: "Espa\xF1ol" },
8
+ { locale: "fa", label: "\u0641\u0627\u0631\u0633\u06CC" },
9
+ { locale: "fi", label: "Suomi" },
10
+ { locale: "fr", label: "Fran\xE7ais" },
11
+ { locale: "gl", label: "Galego" },
12
+ { locale: "he", label: "\u05E2\u05D1\u05E8\u05D9\u05EA" },
13
+ { locale: "it", label: "Italiano" },
14
+ { locale: "ja", label: "\u65E5\u672C\u8A9E" },
15
+ { locale: "ko-kr", label: "\uD55C\uAD6D\uC5B4" },
16
+ { locale: "ku", label: "\u06A9\u0648\u0631\u062F\u06CC" },
17
+ { locale: "hi-in", label: "\u0939\u093F\u0928\u094D\u0926\u0940" },
18
+ { locale: "hu", label: "Magyar" },
19
+ { locale: "my", label: "\u1019\u103C\u1014\u103A\u1019\u102C\u1005\u102C" },
20
+ { locale: "ne", label: "\u0928\u0947\u092A\u093E\u0932\u0940" },
21
+ { locale: "no", label: "Norwegian" },
22
+ { locale: "pl", label: "Polski" },
23
+ { locale: "pt-br", label: "Portugu\xEAs - Brasil" },
24
+ { locale: "pt-pt", label: "Portugu\xEAs - Europeu" },
25
+ { locale: "ro", label: "Rom\xE2n\u0103" },
26
+ { locale: "ru", label: "Russian" },
27
+ { locale: "sv", label: "Svenska" },
28
+ { locale: "te", label: "\u0C24\u0C46\u0C32\u0C41\u0C17\u0C41" },
29
+ { locale: "th", label: "\u0E20\u0E32\u0E29\u0E32\u0E44\u0E17\u0E22" },
30
+ { locale: "tr", label: "T\xFCrk\xE7e" },
31
+ { locale: "uk", label: "Ukrainian" },
32
+ { locale: "vi", label: "Ti\u1EBFng Vi\u1EC7t" },
33
+ { locale: "zh-cn", label: "Chinese - Simplified" },
34
+ { locale: "zh-tw", label: "\u7E41\u9AD4\u4E2D\u6587 (\u53F0\u7063)" }
35
+ ];
36
+ export {
37
+ LANGUAGES
38
+ };
39
+ //# sourceMappingURL=languages.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/translations/languages.ts"],
4
+ "sourcesContent": ["// This file is automatically generated by scripts/refresh-assets.ts.\n// Do not edit manually.\n\n/** @public */\nexport const LANGUAGES = [\n\t{ locale: 'ar', label: '\u0639\u0631\u0628\u064A' },\n\t{ locale: 'ca', label: 'Catal\u00E0' },\n\t{ locale: 'da', label: 'Danish' },\n\t{ locale: 'de', label: 'Deutsch' },\n\t{ locale: 'en', label: 'English' },\n\t{ locale: 'es', label: 'Espa\u00F1ol' },\n\t{ locale: 'fa', label: '\u0641\u0627\u0631\u0633\u06CC' },\n\t{ locale: 'fi', label: 'Suomi' },\n\t{ locale: 'fr', label: 'Fran\u00E7ais' },\n\t{ locale: 'gl', label: 'Galego' },\n\t{ locale: 'he', label: '\u05E2\u05D1\u05E8\u05D9\u05EA' },\n\t{ locale: 'it', label: 'Italiano' },\n\t{ locale: 'ja', label: '\u65E5\u672C\u8A9E' },\n\t{ locale: 'ko-kr', label: '\uD55C\uAD6D\uC5B4' },\n\t{ locale: 'ku', label: '\u06A9\u0648\u0631\u062F\u06CC' },\n\t{ locale: 'hi-in', label: '\u0939\u093F\u0928\u094D\u0926\u0940' },\n\t{ locale: 'hu', label: 'Magyar' },\n\t{ locale: 'my', label: '\u1019\u103C\u1014\u103A\u1019\u102C\u1005\u102C' },\n\t{ locale: 'ne', label: '\u0928\u0947\u092A\u093E\u0932\u0940' },\n\t{ locale: 'no', label: 'Norwegian' },\n\t{ locale: 'pl', label: 'Polski' },\n\t{ locale: 'pt-br', label: 'Portugu\u00EAs - Brasil' },\n\t{ locale: 'pt-pt', label: 'Portugu\u00EAs - Europeu' },\n\t{ locale: 'ro', label: 'Rom\u00E2n\u0103' },\n\t{ locale: 'ru', label: 'Russian' },\n\t{ locale: 'sv', label: 'Svenska' },\n\t{ locale: 'te', label: '\u0C24\u0C46\u0C32\u0C41\u0C17\u0C41' },\n\t{ locale: 'th', label: '\u0E20\u0E32\u0E29\u0E32\u0E44\u0E17\u0E22' },\n\t{ locale: 'tr', label: 'T\u00FCrk\u00E7e' },\n\t{ locale: 'uk', label: 'Ukrainian' },\n\t{ locale: 'vi', label: 'Ti\u1EBFng Vi\u1EC7t' },\n\t{ locale: 'zh-cn', label: 'Chinese - Simplified' },\n\t{ locale: 'zh-tw', label: '\u7E41\u9AD4\u4E2D\u6587 (\u53F0\u7063)' },\n] as const\n"],
5
+ "mappings": "AAIO,MAAM,YAAY;AAAA,EACxB,EAAE,QAAQ,MAAM,OAAO,2BAAO;AAAA,EAC9B,EAAE,QAAQ,MAAM,OAAO,YAAS;AAAA,EAChC,EAAE,QAAQ,MAAM,OAAO,SAAS;AAAA,EAChC,EAAE,QAAQ,MAAM,OAAO,UAAU;AAAA,EACjC,EAAE,QAAQ,MAAM,OAAO,UAAU;AAAA,EACjC,EAAE,QAAQ,MAAM,OAAO,aAAU;AAAA,EACjC,EAAE,QAAQ,MAAM,OAAO,iCAAQ;AAAA,EAC/B,EAAE,QAAQ,MAAM,OAAO,QAAQ;AAAA,EAC/B,EAAE,QAAQ,MAAM,OAAO,cAAW;AAAA,EAClC,EAAE,QAAQ,MAAM,OAAO,SAAS;AAAA,EAChC,EAAE,QAAQ,MAAM,OAAO,iCAAQ;AAAA,EAC/B,EAAE,QAAQ,MAAM,OAAO,WAAW;AAAA,EAClC,EAAE,QAAQ,MAAM,OAAO,qBAAM;AAAA,EAC7B,EAAE,QAAQ,SAAS,OAAO,qBAAM;AAAA,EAChC,EAAE,QAAQ,MAAM,OAAO,iCAAQ;AAAA,EAC/B,EAAE,QAAQ,SAAS,OAAO,uCAAS;AAAA,EACnC,EAAE,QAAQ,MAAM,OAAO,SAAS;AAAA,EAChC,EAAE,QAAQ,MAAM,OAAO,mDAAW;AAAA,EAClC,EAAE,QAAQ,MAAM,OAAO,uCAAS;AAAA,EAChC,EAAE,QAAQ,MAAM,OAAO,YAAY;AAAA,EACnC,EAAE,QAAQ,MAAM,OAAO,SAAS;AAAA,EAChC,EAAE,QAAQ,SAAS,OAAO,wBAAqB;AAAA,EAC/C,EAAE,QAAQ,SAAS,OAAO,yBAAsB;AAAA,EAChD,EAAE,QAAQ,MAAM,OAAO,iBAAS;AAAA,EAChC,EAAE,QAAQ,MAAM,OAAO,UAAU;AAAA,EACjC,EAAE,QAAQ,MAAM,OAAO,UAAU;AAAA,EACjC,EAAE,QAAQ,MAAM,OAAO,uCAAS;AAAA,EAChC,EAAE,QAAQ,MAAM,OAAO,6CAAU;AAAA,EACjC,EAAE,QAAQ,MAAM,OAAO,eAAS;AAAA,EAChC,EAAE,QAAQ,MAAM,OAAO,YAAY;AAAA,EACnC,EAAE,QAAQ,MAAM,OAAO,uBAAa;AAAA,EACpC,EAAE,QAAQ,SAAS,OAAO,uBAAuB;AAAA,EACjD,EAAE,QAAQ,SAAS,OAAO,0CAAY;AACvC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,43 @@
1
+ import { LANGUAGES } from "./languages.mjs";
2
+ function getDefaultTranslationLocale() {
3
+ const locales = typeof window !== "undefined" ? window.navigator.languages ?? ["en"] : ["en"];
4
+ return _getDefaultTranslationLocale(locales);
5
+ }
6
+ function _getDefaultTranslationLocale(locales) {
7
+ for (const locale of locales) {
8
+ const supportedLocale = getSupportedLocale(locale);
9
+ if (supportedLocale) {
10
+ return supportedLocale;
11
+ }
12
+ }
13
+ return "en";
14
+ }
15
+ const DEFAULT_LOCALE_REGIONS = {
16
+ zh: "zh-cn",
17
+ pt: "pt-br",
18
+ ko: "ko-kr",
19
+ hi: "hi-in"
20
+ };
21
+ function getSupportedLocale(locale) {
22
+ const exactMatch = LANGUAGES.find((t) => t.locale === locale.toLowerCase());
23
+ if (exactMatch) {
24
+ return exactMatch.locale;
25
+ }
26
+ const [language, region] = locale.split(/[-_]/).map((s) => s.toLowerCase());
27
+ if (region) {
28
+ const languageMatch = LANGUAGES.find((t) => t.locale === language);
29
+ if (languageMatch) {
30
+ return languageMatch.locale;
31
+ }
32
+ }
33
+ if (language in DEFAULT_LOCALE_REGIONS) {
34
+ return DEFAULT_LOCALE_REGIONS[language];
35
+ }
36
+ return null;
37
+ }
38
+ export {
39
+ LANGUAGES,
40
+ _getDefaultTranslationLocale,
41
+ getDefaultTranslationLocale
42
+ };
43
+ //# sourceMappingURL=translations.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/translations/translations.ts"],
4
+ "sourcesContent": ["import { LANGUAGES } from './languages'\n\n/** @public */\nexport { LANGUAGES }\n\n/** @public */\nexport type TLLanguage = (typeof LANGUAGES)[number]\n// {\n// \treadonly locale: string\n// \treadonly label: string\n// }\n\n/** @public */\nexport function getDefaultTranslationLocale(): TLLanguage['locale'] {\n\tconst locales = typeof window !== 'undefined' ? window.navigator.languages ?? ['en'] : ['en']\n\treturn _getDefaultTranslationLocale(locales)\n}\n\n/** @internal */\nexport function _getDefaultTranslationLocale(locales: readonly string[]): TLLanguage['locale'] {\n\tfor (const locale of locales) {\n\t\tconst supportedLocale = getSupportedLocale(locale)\n\t\tif (supportedLocale) {\n\t\t\treturn supportedLocale\n\t\t}\n\t}\n\treturn 'en'\n}\n\n/** @public */\nconst DEFAULT_LOCALE_REGIONS: { [locale: string]: TLLanguage['locale'] } = {\n\tzh: 'zh-cn',\n\tpt: 'pt-br',\n\tko: 'ko-kr',\n\thi: 'hi-in',\n}\n\n/** @public */\nfunction getSupportedLocale(locale: string): TLLanguage['locale'] | null {\n\t// If we have an exact match, return it!\n\t// (e.g. if the user has 'fr' and we have 'fr')\n\t// (or if the user has 'pt-BR' and we have 'pt-br')\n\tconst exactMatch = LANGUAGES.find((t) => t.locale === locale.toLowerCase())\n\tif (exactMatch) {\n\t\treturn exactMatch.locale\n\t}\n\n\t// Otherwise, we need to be more flexible...\n\tconst [language, region] = locale.split(/[-_]/).map((s) => s.toLowerCase())\n\n\t// If the user's language has a region...\n\t// let's try to find non-region-specific locale for them\n\t// (e.g. if they have 'fr-CA' but we only have 'fr')\n\tif (region) {\n\t\tconst languageMatch = LANGUAGES.find((t) => t.locale === language)\n\t\tif (languageMatch) {\n\t\t\treturn languageMatch.locale\n\t\t}\n\t}\n\n\t// If the user's language doesn't have a region...\n\t// let's try to find a region-specific locale for them\n\t// (e.g. if they have 'pt' but we only have 'pt-pt' or 'pt-br')\n\t//\n\t// In this case, we choose the hard-coded default region for that language\n\tif (language in DEFAULT_LOCALE_REGIONS) {\n\t\treturn DEFAULT_LOCALE_REGIONS[language]\n\t}\n\n\t// Oh no! We don't have a translation for this language!\n\t// Let's give up...\n\treturn null\n}\n"],
5
+ "mappings": "AAAA,SAAS,iBAAiB;AAanB,SAAS,8BAAoD;AACnE,QAAM,UAAU,OAAO,WAAW,cAAc,OAAO,UAAU,aAAa,CAAC,IAAI,IAAI,CAAC,IAAI;AAC5F,SAAO,6BAA6B,OAAO;AAC5C;AAGO,SAAS,6BAA6B,SAAkD;AAC9F,aAAW,UAAU,SAAS;AAC7B,UAAM,kBAAkB,mBAAmB,MAAM;AACjD,QAAI,iBAAiB;AACpB,aAAO;AAAA,IACR;AAAA,EACD;AACA,SAAO;AACR;AAGA,MAAM,yBAAqE;AAAA,EAC1E,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACL;AAGA,SAAS,mBAAmB,QAA6C;AAIxE,QAAM,aAAa,UAAU,KAAK,CAAC,MAAM,EAAE,WAAW,OAAO,YAAY,CAAC;AAC1E,MAAI,YAAY;AACf,WAAO,WAAW;AAAA,EACnB;AAGA,QAAM,CAAC,UAAU,MAAM,IAAI,OAAO,MAAM,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC;AAK1E,MAAI,QAAQ;AACX,UAAM,gBAAgB,UAAU,KAAK,CAAC,MAAM,EAAE,WAAW,QAAQ;AACjE,QAAI,eAAe;AAClB,aAAO,cAAc;AAAA,IACtB;AAAA,EACD;AAOA,MAAI,YAAY,wBAAwB;AACvC,WAAO,uBAAuB,QAAQ;AAAA,EACvC;AAIA,SAAO;AACR;",
6
+ "names": []
7
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=util-types.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@bigbluebutton/tlschema",
3
+ "description": "BigBlueButton's fork of tldraw 2.0-alpha.19",
4
+ "version": "2.0.0-alpha.19",
5
+ "packageManager": "yarn@3.5.0",
6
+ "author": {
7
+ "name": "tldraw GB Ltd.",
8
+ "email": "hello@tldraw.com"
9
+ },
10
+ "license": "Apache-2.0",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/bigbluebutton/tldraw"
14
+ },
15
+ "bugs": {
16
+ "url": "https://github.com/bigbluebutton/tldraw/issues"
17
+ },
18
+ "main": "dist-cjs/index.js",
19
+ "files": [
20
+ "dist-esm",
21
+ "dist-cjs",
22
+ "src"
23
+ ],
24
+ "scripts": {
25
+ "test": "lazy inherit",
26
+ "test-coverage": "lazy inherit",
27
+ "index": "node ./scripts/build-index.js && yarn format",
28
+ "format": "yarn run -T prettier --write --cache \"src/**/*.{ts,tsx,js,jsx,json,md}\"",
29
+ "build": "yarn run -T tsx ../../scripts/build-package.ts",
30
+ "build-api": "yarn run -T tsx ../../scripts/build-api.ts",
31
+ "prepack": "yarn run -T tsx ../../scripts/prepack.ts",
32
+ "postpack": "../../scripts/postpack.sh",
33
+ "pack-tarball": "yarn pack",
34
+ "lint": "yarn run -T tsx ../../scripts/lint.ts"
35
+ },
36
+ "devDependencies": {
37
+ "kleur": "^4.1.5",
38
+ "lazyrepo": "0.0.0-alpha.27"
39
+ },
40
+ "jest": {
41
+ "preset": "config/jest/node",
42
+ "moduleNameMapper": {
43
+ "^~(.*)": "<rootDir>/src/$1"
44
+ },
45
+ "transformIgnorePatterns": [
46
+ "node_modules/(?!(nanoid)/)"
47
+ ]
48
+ },
49
+ "dependencies": {
50
+ "@bigbluebutton/state": "2.0.0-alpha.19",
51
+ "@bigbluebutton/store": "2.0.0-alpha.19",
52
+ "@bigbluebutton/utils": "2.0.0-alpha.19",
53
+ "@bigbluebutton/validate": "2.0.0-alpha.19",
54
+ "nanoid": "4.0.2"
55
+ },
56
+ "module": "dist-esm/index.mjs",
57
+ "source": "src/index.ts",
58
+ "exports": {
59
+ ".": {
60
+ "import": "./dist-esm/index.mjs",
61
+ "require": "./dist-cjs/index.js"
62
+ }
63
+ }
64
+ }
package/src/TLStore.ts ADDED
@@ -0,0 +1,160 @@
1
+ import {
2
+ SerializedStore,
3
+ Store,
4
+ StoreSchema,
5
+ StoreSchemaOptions,
6
+ StoreSnapshot,
7
+ } from '@bigbluebutton/store'
8
+ import { annotateError, structuredClone } from '@bigbluebutton/utils'
9
+ import { CameraRecordType, TLCameraId } from './records/TLCamera'
10
+ import { DocumentRecordType, TLDOCUMENT_ID } from './records/TLDocument'
11
+ import { TLINSTANCE_ID } from './records/TLInstance'
12
+ import { PageRecordType, TLPageId } from './records/TLPage'
13
+ import { InstancePageStateRecordType, TLInstancePageStateId } from './records/TLPageState'
14
+ import { PointerRecordType, TLPOINTER_ID } from './records/TLPointer'
15
+ import { TLRecord } from './records/TLRecord'
16
+
17
+ function sortByIndex<T extends { index: string }>(a: T, b: T) {
18
+ if (a.index < b.index) {
19
+ return -1
20
+ } else if (a.index > b.index) {
21
+ return 1
22
+ }
23
+ return 0
24
+ }
25
+
26
+ function redactRecordForErrorReporting(record: any) {
27
+ if (record.typeName === 'asset') {
28
+ if ('src' in record) {
29
+ record.src = '<redacted>'
30
+ }
31
+
32
+ if ('src' in record.props) {
33
+ record.props.src = '<redacted>'
34
+ }
35
+ }
36
+ }
37
+
38
+ /** @public */
39
+ export type TLStoreSchema = StoreSchema<TLRecord, TLStoreProps>
40
+
41
+ /** @public */
42
+ export type TLSerializedStore = SerializedStore<TLRecord>
43
+
44
+ /** @public */
45
+ export type TLStoreSnapshot = StoreSnapshot<TLRecord>
46
+
47
+ /** @public */
48
+ export type TLStoreProps = {
49
+ defaultName: string
50
+ }
51
+
52
+ /** @public */
53
+ export type TLStore = Store<TLRecord, TLStoreProps>
54
+
55
+ /** @public */
56
+ export const onValidationFailure: StoreSchemaOptions<
57
+ TLRecord,
58
+ TLStoreProps
59
+ >['onValidationFailure'] = ({ error, phase, record, recordBefore }): TLRecord => {
60
+ const isExistingValidationIssue =
61
+ // if we're initializing the store for the first time, we should
62
+ // allow invalid records so people can load old buggy data:
63
+ phase === 'initialize'
64
+
65
+ annotateError(error, {
66
+ tags: {
67
+ origin: 'store.validateRecord',
68
+ storePhase: phase,
69
+ isExistingValidationIssue,
70
+ },
71
+ extras: {
72
+ recordBefore: recordBefore
73
+ ? redactRecordForErrorReporting(structuredClone(recordBefore))
74
+ : undefined,
75
+ recordAfter: redactRecordForErrorReporting(structuredClone(record)),
76
+ },
77
+ })
78
+
79
+ throw error
80
+ }
81
+
82
+ function getDefaultPages() {
83
+ return [
84
+ PageRecordType.create({ id: 'page:page' as TLPageId, name: 'Page 1', index: 'a1', meta: {} }),
85
+ ]
86
+ }
87
+
88
+ /** @internal */
89
+ export function createIntegrityChecker(store: TLStore): () => void {
90
+ const $pageIds = store.query.ids('page')
91
+
92
+ const ensureStoreIsUsable = (): void => {
93
+ // make sure we have exactly one document
94
+ if (!store.has(TLDOCUMENT_ID)) {
95
+ store.put([DocumentRecordType.create({ id: TLDOCUMENT_ID, name: store.props.defaultName })])
96
+ return ensureStoreIsUsable()
97
+ }
98
+
99
+ if (!store.has(TLPOINTER_ID)) {
100
+ store.put([PointerRecordType.create({ id: TLPOINTER_ID })])
101
+ return ensureStoreIsUsable()
102
+ }
103
+
104
+ // make sure there is at least one page
105
+ const pageIds = $pageIds.get()
106
+ if (pageIds.size === 0) {
107
+ store.put(getDefaultPages())
108
+ return ensureStoreIsUsable()
109
+ }
110
+
111
+ const getFirstPageId = () => [...pageIds].map((id) => store.get(id)!).sort(sortByIndex)[0].id!
112
+
113
+ // make sure we have state for the current user's current tab
114
+ const instanceState = store.get(TLINSTANCE_ID)
115
+ if (!instanceState) {
116
+ store.put([
117
+ store.schema.types.instance.create({
118
+ id: TLINSTANCE_ID,
119
+ currentPageId: getFirstPageId(),
120
+ exportBackground: true,
121
+ }),
122
+ ])
123
+
124
+ return ensureStoreIsUsable()
125
+ } else if (!pageIds.has(instanceState.currentPageId)) {
126
+ store.put([{ ...instanceState, currentPageId: getFirstPageId() }])
127
+ return ensureStoreIsUsable()
128
+ }
129
+
130
+ // make sure we have page states and cameras for all the pages
131
+ const missingPageStateIds = new Set<TLInstancePageStateId>()
132
+ const missingCameraIds = new Set<TLCameraId>()
133
+ for (const id of pageIds) {
134
+ const pageStateId = InstancePageStateRecordType.createId(id)
135
+ if (!store.has(pageStateId)) {
136
+ missingPageStateIds.add(pageStateId)
137
+ }
138
+ const cameraId = CameraRecordType.createId(id)
139
+ if (!store.has(cameraId)) {
140
+ missingCameraIds.add(cameraId)
141
+ }
142
+ }
143
+
144
+ if (missingPageStateIds.size > 0) {
145
+ store.put(
146
+ [...missingPageStateIds].map((id) =>
147
+ InstancePageStateRecordType.create({
148
+ id,
149
+ pageId: InstancePageStateRecordType.parseId(id) as TLPageId,
150
+ })
151
+ )
152
+ )
153
+ }
154
+ if (missingCameraIds.size > 0) {
155
+ store.put([...missingCameraIds].map((id) => CameraRecordType.create({ id })))
156
+ }
157
+ }
158
+
159
+ return ensureStoreIsUsable
160
+ }
@@ -0,0 +1,44 @@
1
+ import { BaseRecord } from '@bigbluebutton/store'
2
+ import { JsonObject } from '@bigbluebutton/utils'
3
+ import { T } from '@bigbluebutton/validate'
4
+ import { idValidator } from '../misc/id-validator'
5
+ import { TLAssetId } from '../records/TLAsset'
6
+
7
+ /** @public */
8
+ export interface TLBaseAsset<Type extends string, Props> extends BaseRecord<'asset', TLAssetId> {
9
+ type: Type
10
+ props: Props
11
+ meta: JsonObject
12
+ }
13
+
14
+ /**
15
+ * A validator for asset record type Ids.
16
+ *
17
+ * @public */
18
+ export const assetIdValidator = idValidator<TLAssetId>('asset')
19
+
20
+ /**
21
+ * Create a validator for an asset record type.
22
+ *
23
+ * @param type - The type of the asset
24
+ * @param props - The validator for the asset's props
25
+ *
26
+ * @public */
27
+ export function createAssetValidator<Type extends string, Props extends JsonObject>(
28
+ type: Type,
29
+ props: T.Validator<Props>
30
+ ): T.ObjectValidator<{
31
+ id: TLAssetId
32
+ typeName: 'asset'
33
+ type: Type
34
+ props: Props
35
+ meta: JsonObject
36
+ }> {
37
+ return T.object({
38
+ id: assetIdValidator,
39
+ typeName: T.literal('asset'),
40
+ type: T.literal(type),
41
+ props,
42
+ meta: T.jsonValue as T.ObjectValidator<JsonObject>,
43
+ })
44
+ }
@@ -0,0 +1,31 @@
1
+ import { defineMigrations } from '@bigbluebutton/store'
2
+ import { T } from '@bigbluebutton/validate'
3
+ import { createAssetValidator, TLBaseAsset } from './TLBaseAsset'
4
+
5
+ /**
6
+ * An asset used for URL bookmarks, used by the TLBookmarkShape.
7
+ *
8
+ * @public */
9
+ export type TLBookmarkAsset = TLBaseAsset<
10
+ 'bookmark',
11
+ {
12
+ title: string
13
+ description: string
14
+ image: string
15
+ src: string | null
16
+ }
17
+ >
18
+
19
+ /** @internal */
20
+ export const bookmarkAssetValidator: T.Validator<TLBookmarkAsset> = createAssetValidator(
21
+ 'bookmark',
22
+ T.object({
23
+ title: T.string,
24
+ description: T.string,
25
+ image: T.string,
26
+ src: T.string.nullable(),
27
+ })
28
+ )
29
+
30
+ /** @internal */
31
+ export const bookmarkAssetMigrations = defineMigrations({})
@@ -0,0 +1,73 @@
1
+ import { defineMigrations } from '@bigbluebutton/store'
2
+ import { T } from '@bigbluebutton/validate'
3
+ import { createAssetValidator, TLBaseAsset } from './TLBaseAsset'
4
+
5
+ /**
6
+ * An asset for images such as PNGs and JPEGs, used by the TLImageShape.
7
+ *
8
+ * @public */
9
+ export type TLImageAsset = TLBaseAsset<
10
+ 'image',
11
+ {
12
+ w: number
13
+ h: number
14
+ name: string
15
+ isAnimated: boolean
16
+ mimeType: string | null
17
+ src: string | null
18
+ }
19
+ >
20
+
21
+ /** @internal */
22
+ export const imageAssetValidator: T.Validator<TLImageAsset> = createAssetValidator(
23
+ 'image',
24
+ T.object({
25
+ w: T.number,
26
+ h: T.number,
27
+ name: T.string,
28
+ isAnimated: T.boolean,
29
+ mimeType: T.string.nullable(),
30
+ src: T.string.nullable(),
31
+ })
32
+ )
33
+
34
+ const Versions = {
35
+ AddIsAnimated: 1,
36
+ RenameWidthHeight: 2,
37
+ } as const
38
+
39
+ /** @internal */
40
+ export const imageAssetMigrations = defineMigrations({
41
+ currentVersion: Versions.RenameWidthHeight,
42
+ migrators: {
43
+ [Versions.AddIsAnimated]: {
44
+ up: (asset) => {
45
+ return {
46
+ ...asset,
47
+ props: {
48
+ ...asset.props,
49
+ isAnimated: false,
50
+ },
51
+ }
52
+ },
53
+ down: (asset) => {
54
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
55
+ const { isAnimated, ...rest } = asset.props
56
+ return {
57
+ ...asset,
58
+ props: rest,
59
+ }
60
+ },
61
+ },
62
+ [Versions.RenameWidthHeight]: {
63
+ up: (asset) => {
64
+ const { width, height, ...others } = asset.props
65
+ return { ...asset, props: { w: width, h: height, ...others } }
66
+ },
67
+ down: (asset) => {
68
+ const { w, h, ...others } = asset.props
69
+ return { ...asset, props: { width: w, height: h, ...others } }
70
+ },
71
+ },
72
+ },
73
+ })
@@ -0,0 +1,73 @@
1
+ import { defineMigrations } from '@bigbluebutton/store'
2
+ import { T } from '@bigbluebutton/validate'
3
+ import { createAssetValidator, TLBaseAsset } from './TLBaseAsset'
4
+
5
+ /**
6
+ * An asset used for videos, used by the TLVideoShape.
7
+ *
8
+ * @public */
9
+ export type TLVideoAsset = TLBaseAsset<
10
+ 'video',
11
+ {
12
+ w: number
13
+ h: number
14
+ name: string
15
+ isAnimated: boolean
16
+ mimeType: string | null
17
+ src: string | null
18
+ }
19
+ >
20
+
21
+ /** @internal */
22
+ export const videoAssetValidator: T.Validator<TLVideoAsset> = createAssetValidator(
23
+ 'video',
24
+ T.object({
25
+ w: T.number,
26
+ h: T.number,
27
+ name: T.string,
28
+ isAnimated: T.boolean,
29
+ mimeType: T.string.nullable(),
30
+ src: T.string.nullable(),
31
+ })
32
+ )
33
+
34
+ const Versions = {
35
+ AddIsAnimated: 1,
36
+ RenameWidthHeight: 2,
37
+ } as const
38
+
39
+ /** @internal */
40
+ export const videoAssetMigrations = defineMigrations({
41
+ currentVersion: Versions.RenameWidthHeight,
42
+ migrators: {
43
+ [Versions.AddIsAnimated]: {
44
+ up: (asset) => {
45
+ return {
46
+ ...asset,
47
+ props: {
48
+ ...asset.props,
49
+ isAnimated: false,
50
+ },
51
+ }
52
+ },
53
+ down: (asset) => {
54
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
55
+ const { isAnimated, ...rest } = asset.props
56
+ return {
57
+ ...asset,
58
+ props: rest,
59
+ }
60
+ },
61
+ },
62
+ [Versions.RenameWidthHeight]: {
63
+ up: (asset) => {
64
+ const { width, height, ...others } = asset.props
65
+ return { ...asset, props: { w: width, h: height, ...others } }
66
+ },
67
+ down: (asset) => {
68
+ const { w, h, ...others } = asset.props
69
+ return { ...asset, props: { width: w, height: h, ...others } }
70
+ },
71
+ },
72
+ },
73
+ })
@@ -0,0 +1,53 @@
1
+ import { Signal, computed } from '@bigbluebutton/state'
2
+ import { TLStore } from './TLStore'
3
+ import { CameraRecordType } from './records/TLCamera'
4
+ import { TLINSTANCE_ID } from './records/TLInstance'
5
+ import { InstancePageStateRecordType } from './records/TLPageState'
6
+ import { TLPOINTER_ID } from './records/TLPointer'
7
+ import { InstancePresenceRecordType, TLInstancePresence } from './records/TLPresence'
8
+
9
+ /** @public */
10
+ export const createPresenceStateDerivation =
11
+ (
12
+ $user: Signal<{ id: string; color: string; name: string }>,
13
+ instanceId?: TLInstancePresence['id']
14
+ ) =>
15
+ (store: TLStore): Signal<TLInstancePresence | null> => {
16
+ return computed('instancePresence', () => {
17
+ const instance = store.get(TLINSTANCE_ID)
18
+ const pageState = store.get(InstancePageStateRecordType.createId(instance?.currentPageId))
19
+ const camera = store.get(CameraRecordType.createId(instance?.currentPageId))
20
+ const pointer = store.get(TLPOINTER_ID)
21
+ const user = $user.get()
22
+ if (!pageState || !instance || !camera || !pointer || !user) {
23
+ return null
24
+ }
25
+
26
+ return InstancePresenceRecordType.create({
27
+ id: instanceId ?? InstancePresenceRecordType.createId(store.id),
28
+ selectedShapeIds: pageState.selectedShapeIds,
29
+ brush: instance.brush,
30
+ scribbles: instance.scribbles,
31
+ userId: user.id,
32
+ userName: user.name,
33
+ followingUserId: instance.followingUserId,
34
+ camera: {
35
+ x: camera.x,
36
+ y: camera.y,
37
+ z: camera.z,
38
+ },
39
+ color: user.color,
40
+ currentPageId: instance.currentPageId,
41
+ cursor: {
42
+ x: pointer.x,
43
+ y: pointer.y,
44
+ rotation: instance.cursor.rotation,
45
+ type: instance.cursor.type,
46
+ },
47
+ lastActivityTimestamp: pointer.lastActivityTimestamp,
48
+ screenBounds: instance.screenBounds,
49
+ chatMessage: instance.chatMessage,
50
+ meta: {},
51
+ })
52
+ })
53
+ }