@dxos/plugin-tldraw 0.10.0

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 (401) hide show
  1. package/LICENSE +105 -0
  2. package/PLUGIN.mdl +412 -0
  3. package/README.md +3 -0
  4. package/dist/assets/embed-icons/codepen.png +0 -0
  5. package/dist/assets/embed-icons/codesandbox.png +0 -0
  6. package/dist/assets/embed-icons/desmos.png +0 -0
  7. package/dist/assets/embed-icons/excalidraw.png +0 -0
  8. package/dist/assets/embed-icons/felt.png +0 -0
  9. package/dist/assets/embed-icons/figma.png +0 -0
  10. package/dist/assets/embed-icons/github_gist.png +0 -0
  11. package/dist/assets/embed-icons/google_calendar.png +0 -0
  12. package/dist/assets/embed-icons/google_maps.png +0 -0
  13. package/dist/assets/embed-icons/google_slides.png +0 -0
  14. package/dist/assets/embed-icons/observable.png +0 -0
  15. package/dist/assets/embed-icons/replit.png +0 -0
  16. package/dist/assets/embed-icons/scratch.png +0 -0
  17. package/dist/assets/embed-icons/spotify.png +0 -0
  18. package/dist/assets/embed-icons/tldraw.png +0 -0
  19. package/dist/assets/embed-icons/val_town.png +0 -0
  20. package/dist/assets/embed-icons/vimeo.png +0 -0
  21. package/dist/assets/embed-icons/youtube.png +0 -0
  22. package/dist/assets/fonts/IBMPlexMono-Medium.woff2 +0 -0
  23. package/dist/assets/fonts/IBMPlexSans-Medium.woff2 +0 -0
  24. package/dist/assets/fonts/IBMPlexSerif-Medium.woff2 +0 -0
  25. package/dist/assets/fonts/Montserrat-Regular.woff2 +0 -0
  26. package/dist/assets/fonts/Shantell_Sans-Tldrawish.woff2 +0 -0
  27. package/dist/assets/icons/icon/0_merged.svg +1 -0
  28. package/dist/assets/icons/icon/align-bottom.svg +1 -0
  29. package/dist/assets/icons/icon/align-center-horizontal.svg +1 -0
  30. package/dist/assets/icons/icon/align-center-vertical.svg +1 -0
  31. package/dist/assets/icons/icon/align-left.svg +1 -0
  32. package/dist/assets/icons/icon/align-right.svg +1 -0
  33. package/dist/assets/icons/icon/align-top.svg +1 -0
  34. package/dist/assets/icons/icon/arrow-left.svg +1 -0
  35. package/dist/assets/icons/icon/arrowhead-arrow.svg +1 -0
  36. package/dist/assets/icons/icon/arrowhead-bar.svg +1 -0
  37. package/dist/assets/icons/icon/arrowhead-diamond.svg +1 -0
  38. package/dist/assets/icons/icon/arrowhead-dot.svg +1 -0
  39. package/dist/assets/icons/icon/arrowhead-none.svg +1 -0
  40. package/dist/assets/icons/icon/arrowhead-square.svg +1 -0
  41. package/dist/assets/icons/icon/arrowhead-triangle-inverted.svg +1 -0
  42. package/dist/assets/icons/icon/arrowhead-triangle.svg +1 -0
  43. package/dist/assets/icons/icon/blob.svg +1 -0
  44. package/dist/assets/icons/icon/bring-forward.svg +1 -0
  45. package/dist/assets/icons/icon/bring-to-front.svg +1 -0
  46. package/dist/assets/icons/icon/broken.svg +1 -0
  47. package/dist/assets/icons/icon/chat-teardrop-text.svg +1 -0
  48. package/dist/assets/icons/icon/check-circle.svg +1 -0
  49. package/dist/assets/icons/icon/check.svg +1 -0
  50. package/dist/assets/icons/icon/chevron-down.svg +1 -0
  51. package/dist/assets/icons/icon/chevron-left.svg +1 -0
  52. package/dist/assets/icons/icon/chevron-right.svg +1 -0
  53. package/dist/assets/icons/icon/chevron-up.svg +1 -0
  54. package/dist/assets/icons/icon/chevrons-ne.svg +1 -0
  55. package/dist/assets/icons/icon/chevrons-sw.svg +1 -0
  56. package/dist/assets/icons/icon/clipboard-copied.svg +1 -0
  57. package/dist/assets/icons/icon/clipboard-copy.svg +1 -0
  58. package/dist/assets/icons/icon/color.svg +1 -0
  59. package/dist/assets/icons/icon/cross-2.svg +1 -0
  60. package/dist/assets/icons/icon/cross-circle.svg +1 -0
  61. package/dist/assets/icons/icon/dash-dashed.svg +1 -0
  62. package/dist/assets/icons/icon/dash-dotted.svg +1 -0
  63. package/dist/assets/icons/icon/dash-draw.svg +1 -0
  64. package/dist/assets/icons/icon/dash-solid.svg +1 -0
  65. package/dist/assets/icons/icon/disconnected.svg +1 -0
  66. package/dist/assets/icons/icon/discord.svg +1 -0
  67. package/dist/assets/icons/icon/distribute-horizontal.svg +1 -0
  68. package/dist/assets/icons/icon/distribute-vertical.svg +1 -0
  69. package/dist/assets/icons/icon/dot.svg +1 -0
  70. package/dist/assets/icons/icon/dots-horizontal.svg +1 -0
  71. package/dist/assets/icons/icon/dots-vertical.svg +1 -0
  72. package/dist/assets/icons/icon/drag-handle-dots.svg +1 -0
  73. package/dist/assets/icons/icon/duplicate.svg +1 -0
  74. package/dist/assets/icons/icon/edit.svg +1 -0
  75. package/dist/assets/icons/icon/external-link.svg +1 -0
  76. package/dist/assets/icons/icon/fill-fill.svg +1 -0
  77. package/dist/assets/icons/icon/fill-none.svg +1 -0
  78. package/dist/assets/icons/icon/fill-pattern.svg +1 -0
  79. package/dist/assets/icons/icon/fill-semi.svg +1 -0
  80. package/dist/assets/icons/icon/fill-solid.svg +1 -0
  81. package/dist/assets/icons/icon/follow.svg +1 -0
  82. package/dist/assets/icons/icon/following.svg +1 -0
  83. package/dist/assets/icons/icon/font-draw.svg +8 -0
  84. package/dist/assets/icons/icon/font-mono.svg +1 -0
  85. package/dist/assets/icons/icon/font-sans.svg +1 -0
  86. package/dist/assets/icons/icon/font-serif.svg +1 -0
  87. package/dist/assets/icons/icon/geo-arrow-down.svg +1 -0
  88. package/dist/assets/icons/icon/geo-arrow-left.svg +1 -0
  89. package/dist/assets/icons/icon/geo-arrow-right.svg +1 -0
  90. package/dist/assets/icons/icon/geo-arrow-up.svg +1 -0
  91. package/dist/assets/icons/icon/geo-check-box.svg +1 -0
  92. package/dist/assets/icons/icon/geo-cloud.svg +1 -0
  93. package/dist/assets/icons/icon/geo-diamond.svg +1 -0
  94. package/dist/assets/icons/icon/geo-ellipse.svg +1 -0
  95. package/dist/assets/icons/icon/geo-heart.svg +1 -0
  96. package/dist/assets/icons/icon/geo-hexagon.svg +1 -0
  97. package/dist/assets/icons/icon/geo-octagon.svg +1 -0
  98. package/dist/assets/icons/icon/geo-oval.svg +1 -0
  99. package/dist/assets/icons/icon/geo-pentagon.svg +1 -0
  100. package/dist/assets/icons/icon/geo-rectangle.svg +1 -0
  101. package/dist/assets/icons/icon/geo-rhombus-2.svg +1 -0
  102. package/dist/assets/icons/icon/geo-rhombus.svg +1 -0
  103. package/dist/assets/icons/icon/geo-star.svg +1 -0
  104. package/dist/assets/icons/icon/geo-trapezoid.svg +1 -0
  105. package/dist/assets/icons/icon/geo-triangle.svg +1 -0
  106. package/dist/assets/icons/icon/geo-x-box.svg +1 -0
  107. package/dist/assets/icons/icon/github.svg +1 -0
  108. package/dist/assets/icons/icon/group.svg +1 -0
  109. package/dist/assets/icons/icon/horizontal-align-end.svg +1 -0
  110. package/dist/assets/icons/icon/horizontal-align-middle.svg +1 -0
  111. package/dist/assets/icons/icon/horizontal-align-start.svg +1 -0
  112. package/dist/assets/icons/icon/icon-names.json +143 -0
  113. package/dist/assets/icons/icon/info-circle.svg +1 -0
  114. package/dist/assets/icons/icon/leading.svg +1 -0
  115. package/dist/assets/icons/icon/link.svg +1 -0
  116. package/dist/assets/icons/icon/lock.svg +1 -0
  117. package/dist/assets/icons/icon/menu.svg +1 -0
  118. package/dist/assets/icons/icon/minus.svg +1 -0
  119. package/dist/assets/icons/icon/mixed.svg +1 -0
  120. package/dist/assets/icons/icon/pack.svg +1 -0
  121. package/dist/assets/icons/icon/plus.svg +1 -0
  122. package/dist/assets/icons/icon/question-mark-circle.svg +1 -0
  123. package/dist/assets/icons/icon/question-mark.svg +1 -0
  124. package/dist/assets/icons/icon/redo.svg +1 -0
  125. package/dist/assets/icons/icon/reset-zoom.svg +1 -0
  126. package/dist/assets/icons/icon/rotate-ccw.svg +1 -0
  127. package/dist/assets/icons/icon/rotate-cw.svg +1 -0
  128. package/dist/assets/icons/icon/send-backward.svg +1 -0
  129. package/dist/assets/icons/icon/send-to-back.svg +1 -0
  130. package/dist/assets/icons/icon/share-1.svg +1 -0
  131. package/dist/assets/icons/icon/size-extra-large.svg +1 -0
  132. package/dist/assets/icons/icon/size-large.svg +1 -0
  133. package/dist/assets/icons/icon/size-medium.svg +1 -0
  134. package/dist/assets/icons/icon/size-small.svg +1 -0
  135. package/dist/assets/icons/icon/spline-cubic.svg +1 -0
  136. package/dist/assets/icons/icon/spline-line.svg +1 -0
  137. package/dist/assets/icons/icon/stack-horizontal.svg +1 -0
  138. package/dist/assets/icons/icon/stack-vertical.svg +1 -0
  139. package/dist/assets/icons/icon/status-offline.svg +1 -0
  140. package/dist/assets/icons/icon/stretch-horizontal.svg +1 -0
  141. package/dist/assets/icons/icon/stretch-vertical.svg +1 -0
  142. package/dist/assets/icons/icon/text-align-center.svg +1 -0
  143. package/dist/assets/icons/icon/text-align-left.svg +1 -0
  144. package/dist/assets/icons/icon/text-align-right.svg +1 -0
  145. package/dist/assets/icons/icon/toggle-off.svg +1 -0
  146. package/dist/assets/icons/icon/toggle-on.svg +1 -0
  147. package/dist/assets/icons/icon/tool-arrow.svg +1 -0
  148. package/dist/assets/icons/icon/tool-eraser.svg +1 -0
  149. package/dist/assets/icons/icon/tool-frame.svg +1 -0
  150. package/dist/assets/icons/icon/tool-hand.svg +1 -0
  151. package/dist/assets/icons/icon/tool-highlight.svg +1 -0
  152. package/dist/assets/icons/icon/tool-laser.svg +1 -0
  153. package/dist/assets/icons/icon/tool-line.svg +1 -0
  154. package/dist/assets/icons/icon/tool-media.svg +1 -0
  155. package/dist/assets/icons/icon/tool-note.svg +1 -0
  156. package/dist/assets/icons/icon/tool-pencil.svg +1 -0
  157. package/dist/assets/icons/icon/tool-pointer.svg +1 -0
  158. package/dist/assets/icons/icon/tool-screenshot.svg +1 -0
  159. package/dist/assets/icons/icon/tool-text.svg +1 -0
  160. package/dist/assets/icons/icon/trash.svg +1 -0
  161. package/dist/assets/icons/icon/twitter.svg +1 -0
  162. package/dist/assets/icons/icon/undo.svg +1 -0
  163. package/dist/assets/icons/icon/ungroup.svg +1 -0
  164. package/dist/assets/icons/icon/unlock.svg +1 -0
  165. package/dist/assets/icons/icon/vertical-align-end.svg +1 -0
  166. package/dist/assets/icons/icon/vertical-align-middle.svg +1 -0
  167. package/dist/assets/icons/icon/vertical-align-start.svg +1 -0
  168. package/dist/assets/icons/icon/warning-triangle.svg +1 -0
  169. package/dist/assets/icons/icon/zoom-in.svg +1 -0
  170. package/dist/assets/icons/icon/zoom-out.svg +1 -0
  171. package/dist/assets/translations/ar.json +295 -0
  172. package/dist/assets/translations/ca.json +295 -0
  173. package/dist/assets/translations/cs.json +352 -0
  174. package/dist/assets/translations/da.json +160 -0
  175. package/dist/assets/translations/de.json +310 -0
  176. package/dist/assets/translations/en.json +1 -0
  177. package/dist/assets/translations/es.json +299 -0
  178. package/dist/assets/translations/fa.json +384 -0
  179. package/dist/assets/translations/fi.json +312 -0
  180. package/dist/assets/translations/fr.json +372 -0
  181. package/dist/assets/translations/gl.json +349 -0
  182. package/dist/assets/translations/he.json +86 -0
  183. package/dist/assets/translations/hi-in.json +290 -0
  184. package/dist/assets/translations/hr.json +358 -0
  185. package/dist/assets/translations/hu.json +365 -0
  186. package/dist/assets/translations/id.json +373 -0
  187. package/dist/assets/translations/it.json +330 -0
  188. package/dist/assets/translations/ja.json +351 -0
  189. package/dist/assets/translations/ko-kr.json +396 -0
  190. package/dist/assets/translations/ku.json +93 -0
  191. package/dist/assets/translations/languages.json +150 -0
  192. package/dist/assets/translations/main.json +396 -0
  193. package/dist/assets/translations/my.json +112 -0
  194. package/dist/assets/translations/ne.json +295 -0
  195. package/dist/assets/translations/no.json +62 -0
  196. package/dist/assets/translations/pl.json +113 -0
  197. package/dist/assets/translations/pt-br.json +333 -0
  198. package/dist/assets/translations/pt-pt.json +86 -0
  199. package/dist/assets/translations/ro.json +371 -0
  200. package/dist/assets/translations/ru.json +375 -0
  201. package/dist/assets/translations/sl.json +373 -0
  202. package/dist/assets/translations/sv.json +96 -0
  203. package/dist/assets/translations/te.json +112 -0
  204. package/dist/assets/translations/th.json +295 -0
  205. package/dist/assets/translations/tr.json +355 -0
  206. package/dist/assets/translations/uk.json +375 -0
  207. package/dist/assets/translations/vi.json +295 -0
  208. package/dist/assets/translations/zh-cn.json +386 -0
  209. package/dist/assets/translations/zh-tw.json +340 -0
  210. package/dist/lib/TldrawPlugin.mjs +22 -0
  211. package/dist/lib/TldrawPlugin.mjs.map +1 -0
  212. package/dist/lib/assets/plugin-tldraw-BDrn_mrV.css +24 -0
  213. package/dist/lib/capabilities.mjs +8 -0
  214. package/dist/lib/capabilities.mjs.map +1 -0
  215. package/dist/lib/chunk-TldrawArticle.mjs +60 -0
  216. package/dist/lib/chunk-TldrawArticle.mjs.map +1 -0
  217. package/dist/lib/chunk-TldrawCard.mjs +35 -0
  218. package/dist/lib/chunk-TldrawCard.mjs.map +1 -0
  219. package/dist/lib/chunk-meta.mjs +40 -0
  220. package/dist/lib/chunk-meta.mjs.map +1 -0
  221. package/dist/lib/chunk-settings.mjs +23 -0
  222. package/dist/lib/chunk-settings.mjs.map +1 -0
  223. package/dist/lib/chunk-sketch-variant.mjs +23 -0
  224. package/dist/lib/chunk-sketch-variant.mjs.map +1 -0
  225. package/dist/lib/chunk-types.mjs +73 -0
  226. package/dist/lib/chunk-types.mjs.map +1 -0
  227. package/dist/lib/components.mjs +443 -0
  228. package/dist/lib/components.mjs.map +1 -0
  229. package/dist/lib/containers.mjs +8 -0
  230. package/dist/lib/containers.mjs.map +1 -0
  231. package/dist/lib/hooks.mjs +116 -0
  232. package/dist/lib/hooks.mjs.map +1 -0
  233. package/dist/lib/index.mjs +4 -0
  234. package/dist/lib/meta.mjs +2 -0
  235. package/dist/lib/model.mjs +905 -0
  236. package/dist/lib/model.mjs.map +1 -0
  237. package/dist/lib/plugin.mjs +8 -0
  238. package/dist/lib/plugin.mjs.map +1 -0
  239. package/dist/lib/testing.mjs +246 -0
  240. package/dist/lib/testing.mjs.map +1 -0
  241. package/dist/lib/translations.mjs +10 -0
  242. package/dist/lib/translations.mjs.map +1 -0
  243. package/dist/lib/types.mjs +2 -0
  244. package/dist/types/dx.config.d.ts +28 -0
  245. package/dist/types/dx.config.d.ts.map +1 -0
  246. package/dist/types/src/TldrawPlugin.d.ts +4 -0
  247. package/dist/types/src/TldrawPlugin.d.ts.map +1 -0
  248. package/dist/types/src/capabilities/index.d.ts +4 -0
  249. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  250. package/dist/types/src/capabilities/settings.d.ts +5 -0
  251. package/dist/types/src/capabilities/settings.d.ts.map +1 -0
  252. package/dist/types/src/capabilities/sketch-variant.d.ts +5 -0
  253. package/dist/types/src/capabilities/sketch-variant.d.ts.map +1 -0
  254. package/dist/types/src/components/Canvas/Canvas.d.ts +17 -0
  255. package/dist/types/src/components/Canvas/Canvas.d.ts.map +1 -0
  256. package/dist/types/src/components/Canvas/Canvas.stories.d.ts +15 -0
  257. package/dist/types/src/components/Canvas/Canvas.stories.d.ts.map +1 -0
  258. package/dist/types/src/components/Canvas/index.d.ts +4 -0
  259. package/dist/types/src/components/Canvas/index.d.ts.map +1 -0
  260. package/dist/types/src/components/actions.d.ts +6 -0
  261. package/dist/types/src/components/actions.d.ts.map +1 -0
  262. package/dist/types/src/components/custom/CustomGrid.d.ts +12 -0
  263. package/dist/types/src/components/custom/CustomGrid.d.ts.map +1 -0
  264. package/dist/types/src/components/custom/CustomMenu.d.ts +4 -0
  265. package/dist/types/src/components/custom/CustomMenu.d.ts.map +1 -0
  266. package/dist/types/src/components/custom/CustomStylePanel.d.ts +4 -0
  267. package/dist/types/src/components/custom/CustomStylePanel.d.ts.map +1 -0
  268. package/dist/types/src/components/custom/CustomToolbar.d.ts +10 -0
  269. package/dist/types/src/components/custom/CustomToolbar.d.ts.map +1 -0
  270. package/dist/types/src/components/custom/DottedGrid.d.ts +4 -0
  271. package/dist/types/src/components/custom/DottedGrid.d.ts.map +1 -0
  272. package/dist/types/src/components/custom/MeshGrid.d.ts +4 -0
  273. package/dist/types/src/components/custom/MeshGrid.d.ts.map +1 -0
  274. package/dist/types/src/components/custom/index.d.ts +6 -0
  275. package/dist/types/src/components/custom/index.d.ts.map +1 -0
  276. package/dist/types/src/components/index.d.ts +2 -0
  277. package/dist/types/src/components/index.d.ts.map +1 -0
  278. package/dist/types/src/containers/TldrawArticle/TldrawArticle.d.ts +8 -0
  279. package/dist/types/src/containers/TldrawArticle/TldrawArticle.d.ts.map +1 -0
  280. package/dist/types/src/containers/TldrawArticle/index.d.ts +2 -0
  281. package/dist/types/src/containers/TldrawArticle/index.d.ts.map +1 -0
  282. package/dist/types/src/containers/TldrawCard/TldrawCard.d.ts +9 -0
  283. package/dist/types/src/containers/TldrawCard/TldrawCard.d.ts.map +1 -0
  284. package/dist/types/src/containers/TldrawCard/TldrawCard.stories.d.ts +15 -0
  285. package/dist/types/src/containers/TldrawCard/TldrawCard.stories.d.ts.map +1 -0
  286. package/dist/types/src/containers/TldrawCard/index.d.ts +2 -0
  287. package/dist/types/src/containers/TldrawCard/index.d.ts.map +1 -0
  288. package/dist/types/src/containers/index.d.ts +4 -0
  289. package/dist/types/src/containers/index.d.ts.map +1 -0
  290. package/dist/types/src/hooks/adapter.d.ts +15 -0
  291. package/dist/types/src/hooks/adapter.d.ts.map +1 -0
  292. package/dist/types/src/hooks/adapter.test.d.ts +2 -0
  293. package/dist/types/src/hooks/adapter.test.d.ts.map +1 -0
  294. package/dist/types/src/hooks/index.d.ts +3 -0
  295. package/dist/types/src/hooks/index.d.ts.map +1 -0
  296. package/dist/types/src/hooks/useStoreAdapter.d.ts +11 -0
  297. package/dist/types/src/hooks/useStoreAdapter.d.ts.map +1 -0
  298. package/dist/types/src/index.d.ts +4 -0
  299. package/dist/types/src/index.d.ts.map +1 -0
  300. package/dist/types/src/meta.d.ts +33 -0
  301. package/dist/types/src/meta.d.ts.map +1 -0
  302. package/dist/types/src/migrations/index.d.ts +3 -0
  303. package/dist/types/src/migrations/index.d.ts.map +1 -0
  304. package/dist/types/src/migrations/migrate.d.ts +9 -0
  305. package/dist/types/src/migrations/migrate.d.ts.map +1 -0
  306. package/dist/types/src/migrations/schema.d.ts +7 -0
  307. package/dist/types/src/migrations/schema.d.ts.map +1 -0
  308. package/dist/types/src/model/TldrawBuilder.d.ts +110 -0
  309. package/dist/types/src/model/TldrawBuilder.d.ts.map +1 -0
  310. package/dist/types/src/model/TldrawBuilder.test.d.ts +2 -0
  311. package/dist/types/src/model/TldrawBuilder.test.d.ts.map +1 -0
  312. package/dist/types/src/model/apply.d.ts +5 -0
  313. package/dist/types/src/model/apply.d.ts.map +1 -0
  314. package/dist/types/src/model/builder.d.ts +3 -0
  315. package/dist/types/src/model/builder.d.ts.map +1 -0
  316. package/dist/types/src/model/index.d.ts +6 -0
  317. package/dist/types/src/model/index.d.ts.map +1 -0
  318. package/dist/types/src/model/read.d.ts +8 -0
  319. package/dist/types/src/model/read.d.ts.map +1 -0
  320. package/dist/types/src/model/render.d.ts +27 -0
  321. package/dist/types/src/model/render.d.ts.map +1 -0
  322. package/dist/types/src/model/scene.test.d.ts +2 -0
  323. package/dist/types/src/model/scene.test.d.ts.map +1 -0
  324. package/dist/types/src/plugin.d.ts +3 -0
  325. package/dist/types/src/plugin.d.ts.map +1 -0
  326. package/dist/types/src/testing/data.d.ts +242 -0
  327. package/dist/types/src/testing/data.d.ts.map +1 -0
  328. package/dist/types/src/testing/index.d.ts +2 -0
  329. package/dist/types/src/testing/index.d.ts.map +1 -0
  330. package/dist/types/src/testing/schema.d.ts +7 -0
  331. package/dist/types/src/testing/schema.d.ts.map +1 -0
  332. package/dist/types/src/translations.d.ts +9 -0
  333. package/dist/types/src/translations.d.ts.map +1 -0
  334. package/dist/types/src/types/Settings.d.ts +10 -0
  335. package/dist/types/src/types/Settings.d.ts.map +1 -0
  336. package/dist/types/src/types/Tldraw.d.ts +25 -0
  337. package/dist/types/src/types/Tldraw.d.ts.map +1 -0
  338. package/dist/types/src/types/TldrawCapabilities.d.ts +4 -0
  339. package/dist/types/src/types/TldrawCapabilities.d.ts.map +1 -0
  340. package/dist/types/src/types/index.d.ts +4 -0
  341. package/dist/types/src/types/index.d.ts.map +1 -0
  342. package/dist/types/src/types/types.d.ts +6 -0
  343. package/dist/types/src/types/types.d.ts.map +1 -0
  344. package/dist/types/src/variant.test.d.ts +2 -0
  345. package/dist/types/src/variant.test.d.ts.map +1 -0
  346. package/dist/types/tsconfig.tsbuildinfo +1 -0
  347. package/dx.config.ts +35 -0
  348. package/package.json +157 -0
  349. package/src/TldrawPlugin.tsx +31 -0
  350. package/src/capabilities/index.ts +8 -0
  351. package/src/capabilities/settings.ts +31 -0
  352. package/src/capabilities/sketch-variant.ts +29 -0
  353. package/src/components/Canvas/Canvas.stories.tsx +101 -0
  354. package/src/components/Canvas/Canvas.tsx +284 -0
  355. package/src/components/Canvas/index.ts +9 -0
  356. package/src/components/Canvas/theme.css +23 -0
  357. package/src/components/actions.ts +42 -0
  358. package/src/components/custom/CustomGrid.tsx +61 -0
  359. package/src/components/custom/CustomMenu.tsx +31 -0
  360. package/src/components/custom/CustomStylePanel.tsx +38 -0
  361. package/src/components/custom/CustomToolbar.tsx +88 -0
  362. package/src/components/custom/DottedGrid.tsx +53 -0
  363. package/src/components/custom/MeshGrid.tsx +47 -0
  364. package/src/components/custom/index.ts +9 -0
  365. package/src/components/index.ts +5 -0
  366. package/src/containers/TldrawArticle/TldrawArticle.tsx +78 -0
  367. package/src/containers/TldrawArticle/index.ts +5 -0
  368. package/src/containers/TldrawCard/TldrawCard.stories.tsx +53 -0
  369. package/src/containers/TldrawCard/TldrawCard.tsx +32 -0
  370. package/src/containers/TldrawCard/index.ts +5 -0
  371. package/src/containers/index.ts +8 -0
  372. package/src/hooks/adapter.test.ts +20 -0
  373. package/src/hooks/adapter.ts +83 -0
  374. package/src/hooks/index.ts +6 -0
  375. package/src/hooks/useStoreAdapter.ts +55 -0
  376. package/src/index.ts +7 -0
  377. package/src/meta.ts +9 -0
  378. package/src/migrations/index.ts +6 -0
  379. package/src/migrations/migrate.ts +49 -0
  380. package/src/migrations/schema.ts +98 -0
  381. package/src/model/TldrawBuilder.test.ts +72 -0
  382. package/src/model/TldrawBuilder.ts +443 -0
  383. package/src/model/apply.ts +132 -0
  384. package/src/model/builder.ts +31 -0
  385. package/src/model/index.ts +9 -0
  386. package/src/model/read.ts +203 -0
  387. package/src/model/render.ts +191 -0
  388. package/src/model/scene.test.ts +222 -0
  389. package/src/plugin.ts +9 -0
  390. package/src/testing/data.ts +238 -0
  391. package/src/testing/index.ts +5 -0
  392. package/src/testing/schema.ts +98 -0
  393. package/src/translations.ts +18 -0
  394. package/src/types/Settings.ts +32 -0
  395. package/src/types/Tldraw.ts +38 -0
  396. package/src/types/TldrawCapabilities.ts +17 -0
  397. package/src/types/index.ts +8 -0
  398. package/src/types/types.ts +11 -0
  399. package/src/typings.d.ts +8 -0
  400. package/src/variant.test.ts +142 -0
  401. package/src/vite-env.d.ts +10 -0
package/LICENSE ADDED
@@ -0,0 +1,105 @@
1
+ # Functional Source License, Version 1.1, ALv2 Future License
2
+
3
+ ## Abbreviation
4
+
5
+ FSL-1.1-Apache-2.0
6
+
7
+ ## Notice
8
+
9
+ Copyright 2026 DXOS
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Patents,
26
+ Redistribution and Trademark clauses below, we hereby grant you the right to
27
+ use, copy, modify, create derivative works, publicly perform, publicly display
28
+ and redistribute the Software for any Permitted Purpose identified below.
29
+
30
+ ### Permitted Purpose
31
+
32
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
33
+ means making the Software available to others in a commercial product or
34
+ service that:
35
+
36
+ 1. substitutes for the Software;
37
+
38
+ 2. substitutes for any other product or service we offer using the Software
39
+ that exists as of the date we make the Software available; or
40
+
41
+ 3. offers the same or substantially similar functionality as the Software.
42
+
43
+ Permitted Purposes specifically include using the Software:
44
+
45
+ 1. for your internal use and access;
46
+
47
+ 2. for non-commercial education;
48
+
49
+ 3. for non-commercial research; and
50
+
51
+ 4. in connection with professional services that you provide to a licensee
52
+ using the Software in accordance with these Terms and Conditions.
53
+
54
+ ### Patents
55
+
56
+ To the extent your use for a Permitted Purpose would necessarily infringe our
57
+ patents, the license grant above includes a license under our patents. If you
58
+ make a claim against any party that the Software infringes or contributes to
59
+ the infringement of any patent, then your patent license to the Software ends
60
+ immediately.
61
+
62
+ ### Redistribution
63
+
64
+ The Terms and Conditions apply to all copies, modifications and derivatives of
65
+ the Software.
66
+
67
+ If you redistribute any copies, modifications or derivatives of the Software,
68
+ you must include a copy of or a link to these Terms and Conditions and not
69
+ remove any copyright notices provided in or with the Software.
70
+
71
+ ### Disclaimer
72
+
73
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
74
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
75
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
+
77
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
78
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
79
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
+
81
+ ### Trademarks
82
+
83
+ Except for displaying the License Details and identifying us as the origin of
84
+ the Software, you have no right under these Terms and Conditions to use our
85
+ trademarks, trade names, service marks or product names.
86
+
87
+ ## Grant of Future License
88
+
89
+ We hereby irrevocably grant you an additional license to use the Software under
90
+ the Apache License, Version 2.0 that is effective on the second anniversary of
91
+ the date we make the Software available. On or after that date, you may use the
92
+ Software under the Apache License, Version 2.0, in which case the following
93
+ will apply:
94
+
95
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
96
+ this file except in compliance with the License.
97
+
98
+ You may obtain a copy of the License at
99
+
100
+ http://www.apache.org/licenses/LICENSE-2.0
101
+
102
+ Unless required by applicable law or agreed to in writing, software distributed
103
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
104
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
105
+ specific language governing permissions and limitations under the License.
package/PLUGIN.mdl ADDED
@@ -0,0 +1,412 @@
1
+ ---
2
+ id: org.dxos.plugin.tldraw
3
+ name: TldrawPlugin
4
+ version: 0.1.0
5
+ ---
6
+
7
+ A collaborative whiteboard plugin for `DXOS` Composer — powered by tldraw, persisted in ECHO, and available as a first-class workspace object.
8
+
9
+ ## Extensions
10
+
11
+ The following extension dialects are used in this document.
12
+ Each extension is defined in the Appendix or resolved via its URI.
13
+
14
+ | Term | URI |
15
+ |-------------|--------------------------------|
16
+ | `type` | `org.dxos.mdl.type@1.0` |
17
+ | `feat` | `org.dxos.mdl.feat@1.0` |
18
+ | `test` | `org.dxos.mdl.test@1.0` |
19
+ | `component` | `org.dxos.mdl.component@1.0` |
20
+ | `op` | `org.dxos.mdl.op@1.0` |
21
+
22
+ ## Types
23
+
24
+ ```mdl
25
+ type Canvas
26
+ desc: Low-level drawing document backed by a tldraw store.
27
+ fields:
28
+ schema?: string # external schema reference (default: tldraw.com/2)
29
+ content: Map<string, any> # tldraw store snapshot — shapes, bindings, assets
30
+ ```
31
+
32
+ ```mdl
33
+ type Sketch
34
+ desc: User-facing whiteboard object that wraps a Canvas.
35
+ fields:
36
+ name?: string
37
+ canvas: Ref<Canvas> # reference to the tldraw content store
38
+ ```
39
+
40
+ ```mdl
41
+ type SketchGrid
42
+ literals: mesh | dotted
43
+ ```
44
+
45
+ ```mdl
46
+ type Settings
47
+ fields:
48
+ showGrid?: boolean # display a background grid on the canvas
49
+ gridType?: SketchGrid # mesh or dotted pattern
50
+ ```
51
+
52
+ ```mdl
53
+ type Scene
54
+ desc: |
55
+ Backend-neutral scene DSL (src/model). A diagram is a set of world objects
56
+ ("face", "hat") composed of elements in object-local units; a compiler maps
57
+ the scene to tldraw records with identity stamped in record meta
58
+ ({ object, element, kind, scale, dialect }) so edits address shapes by id.
59
+ fields:
60
+ objects: WorldObject[]
61
+ ```
62
+
63
+ ```mdl
64
+ type WorldObject
65
+ fields:
66
+ id: string # semantic id ("face"); addressing key for edits
67
+ origin?: Point # canvas px; derived from bbox top-left on read
68
+ scale?: number # canvas px per local unit (default 1)
69
+ elements: Element[] # rect | ellipse | circle | diamond | triangle |
70
+ # line | curve | arc | text | arrow
71
+ ```
72
+
73
+ ```mdl
74
+ type Command
75
+ desc: Scene edit commands (D2-Oracle-style, addressed by id).
76
+ literals: upsert-object | upsert-elements | remove-elements | remove-object | move-object
77
+ ```
78
+
79
+ ## Components
80
+
81
+ ```mdl
82
+ component SketchArticle
83
+ desc: Full-screen whiteboard surface for a Sketch object. Renders inside article, section, and slide roles.
84
+ props:
85
+ subject: Sketch
86
+ settings: Settings
87
+ attendableId: string
88
+ role: article | section | slide
89
+ state:
90
+ editor?: Editor # tldraw Editor instance
91
+ hasAttention: boolean
92
+ slots:
93
+ toolbar?: ReactNode # injected tldraw toolbar actions
94
+ actions:
95
+ createThread() # opens a comment thread anchored to a selection
96
+ layout: |
97
+ ┌─────────────────────────────────┐
98
+ │ tldraw toolbar (when attended) │
99
+ ├─────────────────────────────────┤
100
+ │ │
101
+ │ infinite canvas (tldraw) │
102
+ │ shapes / freehand / text │
103
+ │ │
104
+ │ [comment thread anchors] │
105
+ │ │
106
+ └─────────────────────────────────┘
107
+ ```
108
+
109
+ ```mdl
110
+ component SketchSettings
111
+ desc: Settings panel for the Sketch plugin — controls grid visibility and type.
112
+ props:
113
+ settings: Settings
114
+ onSettingsChange?: (updater: (s: Settings) => Settings) => void
115
+ ```
116
+
117
+ ## Operations
118
+
119
+ ```mdl
120
+ op createSketch
121
+ desc: Creates a new Sketch with an associated Canvas and adds it to the target space or collection.
122
+ input:
123
+ name?: string
124
+ schema?: string # tldraw schema version (default: tldraw.com/2)
125
+ content?: Map<string, any> # optional initial tldraw store snapshot
126
+ output: Sketch
127
+ effects: [echo:write]
128
+ ```
129
+
130
+ ```mdl
131
+ op readSketch
132
+ desc: |
133
+ Returns the derived Scene (world objects with object-local coordinates) read
134
+ from the live canvas records, plus a count of unmanaged (hand-drawn) shapes.
135
+ Origins derive from bounding boxes, so the scene stays coherent after users
136
+ drag shapes. The agent calls this before editing an existing sketch.
137
+ input:
138
+ sketch: Ref<Sketch>
139
+ output: { scene: Scene, unmanaged: number }
140
+ requires: [Database]
141
+ ```
142
+
143
+ ```mdl
144
+ op editSketch
145
+ desc: |
146
+ Applies scene commands atomically (one Obj.update): upsert/move/remove world
147
+ objects or individual elements by id. Returns the resulting scene so the
148
+ agent can maintain its mental model across turns.
149
+ input:
150
+ sketch: Ref<Sketch>
151
+ commands: Command[]
152
+ output: { scene: Scene, unmanaged: number, upserted: string[], removed: number }
153
+ effects: [echo:write]
154
+ requires: [Database]
155
+ ```
156
+
157
+ ## Features
158
+
159
+ ```mdl
160
+ feat F-1: Whiteboard Canvas
161
+
162
+ req F-1.1: Each Sketch owns exactly one Canvas; the Canvas holds the full tldraw store snapshot.
163
+ req F-1.2: Canvas content is stored as a plain record in ECHO — no binary blobs.
164
+ req F-1.3: All tldraw shape types (freehand, geometric, text, arrow, image) are supported.
165
+ ```
166
+
167
+ ```mdl
168
+ feat F-2: ECHO Persistence
169
+
170
+ req F-2.1:
171
+ when: user makes any edit in the whiteboard
172
+ then: Canvas.content is updated in ECHO within the debounce window
173
+
174
+ req F-2.2:
175
+ when: Sketch is opened after a page reload
176
+ then: tldraw store is hydrated from Canvas.content; no drawing is lost
177
+
178
+ req F-2.3: Canvas is a separate ECHO object from Sketch so it can be replicated independently.
179
+ ```
180
+
181
+ ```mdl
182
+ feat F-3: Real-time Collaboration
183
+
184
+ req F-3.1:
185
+ when: two or more peers open the same Sketch
186
+ then: edits by each peer appear on the other's canvas via ECHO replication
187
+
188
+ req F-3.2:
189
+ when: a peer is offline and makes edits
190
+ then: changes merge with remote state on reconnection using ECHO CRDT semantics
191
+ ```
192
+
193
+ ```mdl
194
+ feat F-4: Roles and Presentation
195
+
196
+ req F-4.1:
197
+ when: role is article
198
+ then: full tldraw toolbar shown when the sketch has attention; hidden otherwise
199
+
200
+ req F-4.2:
201
+ when: role is slide
202
+ then: canvas is read-only; zoom capped at 1.5×
203
+
204
+ req F-4.3:
205
+ when: role is section
206
+ then: canvas auto-zooms to fit content; no toolbar shown
207
+ ```
208
+
209
+ ```mdl
210
+ feat F-5: Comment Threads
211
+
212
+ req F-5.1:
213
+ when: user activates the thread tool in the toolbar
214
+ then: a new comment thread is created anchored to the current selection
215
+
216
+ req F-5.2: Thread anchor positions are stored alongside the drawing so they survive reloads.
217
+ ```
218
+
219
+ ```mdl
220
+ feat F-6: Grid Settings
221
+
222
+ req F-6.1:
223
+ when: Settings.showGrid is true
224
+ then: a background grid rendered beneath drawing content
225
+
226
+ req F-6.2:
227
+ when: Settings.gridType is mesh
228
+ then: a square-mesh grid is shown
229
+
230
+ req F-6.3:
231
+ when: Settings.gridType is dotted
232
+ then: a dotted grid is shown
233
+ ```
234
+
235
+ ```mdl
236
+ feat F-7: Create Sketch Operation
237
+
238
+ req F-7.1: Plugin contributes op:createSketch to the operation registry.
239
+ req F-7.2:
240
+ when: op:createSketch is invoked
241
+ then: a Sketch + Canvas pair is created and returned; the Sketch is added to the target collection
242
+ ```
243
+
244
+ ```mdl
245
+ feat F-8: Scene DSL and Agent Skill
246
+
247
+ req F-8.1: The scene model (src/model) is backend-neutral — no tldraw imports in scene.ts;
248
+ the tldraw compiler (render.ts/read.ts) is one backend, Excalidraw can be added later.
249
+ req F-8.2: Every DSL-generated tldraw record carries meta { object, element, kind, scale, dialect };
250
+ record ids are deterministic (shape:<object>/<element>) so re-rendering an element reuses its id.
251
+ req F-8.3:
252
+ when: op:editSketch upserts elements of an existing object
253
+ then: only records with matching element ids are replaced; sibling elements are untouched
254
+ req F-8.4:
255
+ when: a shape bound by an arrow is removed
256
+ then: its bindings are removed too; no dangling binding records remain
257
+ req F-8.5:
258
+ when: op:readSketch runs after a user drags shapes in the UI
259
+ then: the derived scene reflects the moved geometry (origin = bbox top-left)
260
+ req F-8.6: Plugin contributes the org.dxos.skill.sketch skill (create/read/edit tools +
261
+ DSL instructions: object-local units, semantic ids, read-before-edit workflow).
262
+ req F-8.7: A dialect registry (scene only for now) reserves the extension point for
263
+ mermaid / d2 / sequence / uml-class compilers that emit scene commands.
264
+ ```
265
+
266
+ ## Acceptance
267
+
268
+ ```mdl
269
+ test T-1: Create and open sketch
270
+ given: a Composer space is active
271
+ when: op:createSketch runs with name "My Diagram"
272
+ then:
273
+ - a Sketch object is created with name "My Diagram"
274
+ - Sketch.canvas references a new Canvas with empty content
275
+ - Sketch appears in the space object list
276
+ ```
277
+
278
+ ```mdl
279
+ test T-2: Drawing persists across reload
280
+ given: a Sketch is open and the user draws a freehand stroke
281
+ when: the page is reloaded and the Sketch is reopened
282
+ then:
283
+ - the stroke is visible on the canvas
284
+ - Canvas.content is non-empty
285
+ ```
286
+
287
+ ```mdl
288
+ test T-3: Collaborative edit
289
+ given: two peers have the same Sketch open
290
+ when: peer A draws a rectangle
291
+ then:
292
+ - peer B sees the rectangle appear within the ECHO sync window
293
+ - no data loss if both peers edit simultaneously
294
+ ```
295
+
296
+ ```mdl
297
+ test T-4: Read-only slide role
298
+ given: a Sketch is rendered in role slide
299
+ then:
300
+ - tldraw toolbar is not shown
301
+ - all drawing tools are disabled
302
+ - zoom is capped at 1.5×
303
+ ```
304
+
305
+ ```mdl
306
+ test T-5: Grid toggle
307
+ given: SketchSettings panel is open
308
+ when: user enables the grid and selects "dotted"
309
+ then:
310
+ - Settings.showGrid === true
311
+ - Settings.gridType === dotted
312
+ - dotted grid appears on the canvas immediately
313
+ ```
314
+
315
+ ```mdl
316
+ test T-6: Attention-aware toolbar
317
+ given: a Sketch is open in article role alongside other articles
318
+ when: user clicks on the sketch to give it attention
319
+ then: tldraw toolbar becomes visible
320
+ when: user clicks away, removing attention
321
+ then: tldraw toolbar is hidden
322
+ ```
323
+
324
+ ```mdl
325
+ test T-7: Scene DSL round-trip
326
+ given: an empty Sketch
327
+ when: editSketch upserts a "face" object (head/eyes/smile), then upserts a "hat" object and
328
+ replaces only the "smile" element, then removes the "hat"
329
+ then:
330
+ - readSketch returns the face with derived origin and all element ids
331
+ - the untouched face elements are byte-identical across the hat edit
332
+ - removing the hat removes exactly its records and no bindings dangle
333
+ # Covered by src/operations/operations.test.ts and src/model/scene.test.ts.
334
+ ```
335
+
336
+ ```mdl
337
+ test T-8: Conversational drawing (live AI)
338
+ given: the stories-assistant Sketch storybook (config.remote) with the sketch skill bound
339
+ when: the user prompts "Draw a smiley face", then "Add a hat"
340
+ then:
341
+ - the agent creates a "face" world object via editSketch
342
+ - the follow-up adds a "hat" object WITHOUT redrawing the face (mental-model test)
343
+ # Manual: stories/stories-assistant/Sketch → DrawAndUpdateTest / Reflection (tags: ['!test']).
344
+ # Verified live 2026-07-23 (remote EDGE, claude-opus-4-8): face drawn, hat composed on top,
345
+ # face records untouched.
346
+ ```
347
+
348
+ ---
349
+
350
+ ## Appendix: Extension Definitions
351
+
352
+ ```mdl
353
+ ext type
354
+ uri: org.dxos.mdl.type@1.0
355
+ desc: A named data structure with typed fields and optional literals.
356
+ fields:
357
+ desc?: Prose
358
+ fields?: FieldMap
359
+ literals?: UnionList
360
+ extends?: TypeRef[]
361
+ ```
362
+
363
+ ```mdl
364
+ ext feat
365
+ uri: org.dxos.mdl.feat@1.0
366
+ desc: A named feature grouping one or more requirements.
367
+ fields:
368
+ desc?: Prose
369
+ req: RequirementList
370
+ nesting: self
371
+ ```
372
+
373
+ ```mdl
374
+ ext test
375
+ uri: org.dxos.mdl.test@1.0
376
+ desc: An acceptance scenario expressed as given / when / then steps.
377
+ fields:
378
+ given?: Step | Step[]
379
+ when?: Step | Step[]
380
+ then: Step | Step[]
381
+ tags?: TagList
382
+ ```
383
+
384
+ ```mdl
385
+ ext component
386
+ uri: org.dxos.mdl.component@1.0
387
+ desc: A UI component with props, internal state, slots, actions, and events.
388
+ fields:
389
+ desc?: Prose
390
+ props?: FieldMap
391
+ state?: FieldMap
392
+ slots?: FieldMap
393
+ actions?: ActionMap
394
+ emits?: EventMap
395
+ layout?: CodeBlock
396
+ ```
397
+
398
+ ```mdl
399
+ ext op
400
+ uri: org.dxos.mdl.op@1.0
401
+ desc: |
402
+ A named operation with typed inputs, outputs, and declared errors.
403
+ Pure ops have no effects or requires. Effectful ops declare both.
404
+ fields:
405
+ desc?: Prose
406
+ input?: FieldMap
407
+ output?: TypeExpr
408
+ errors?: ErrorMap
409
+ effects?: EffectList
410
+ requires?: ServiceList
411
+ note?: Prose
412
+ ```
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # @dxos/plugin-sketch
2
+
3
+ Surface plugin for sketch entities using Tldraw.
Binary file