alinea 1.7.0 → 2.0.0-preview.1

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 (1393) hide show
  1. package/dist/.init/content/pages/welcome.json +1 -1
  2. package/dist/.init/src/app/(alinea)/api/cms/route.ts +8 -8
  3. package/dist/.init/src/cms.ts +45 -47
  4. package/dist/LICENSES.md +236 -561
  5. package/dist/adapter/core/cms.js +1 -1
  6. package/dist/adapter/core/handler.js +1 -1
  7. package/dist/adapter/core/preview.js +2 -2
  8. package/dist/adapter/core/previewContext.d.ts +1 -1
  9. package/dist/adapter/core/previewContext.js +1 -1
  10. package/dist/adapter/next/cms.d.ts +1 -1
  11. package/dist/adapter/next/cms.js +7 -7
  12. package/dist/adapter/next/context.js +1 -1
  13. package/dist/adapter/next/handler.d.ts +2 -4
  14. package/dist/adapter/next/handler.js +11 -5
  15. package/dist/adapter/next/previews.d.ts +2 -2
  16. package/dist/adapter/next/previews.js +13 -17
  17. package/dist/adapter/next/with-alinea.js +20 -10
  18. package/dist/adapter/vite/plugin.d.ts +2 -0
  19. package/dist/adapter/vite/plugin.js +66 -0
  20. package/dist/backend/Auth.js +1 -1
  21. package/dist/backend/HandleAction.d.ts +1 -0
  22. package/dist/backend/HandleAction.js +2 -1
  23. package/dist/backend/Handler.js +142 -31
  24. package/dist/backend/Previews.d.ts +2 -5
  25. package/dist/backend/api/BasicAuth.d.ts +2 -2
  26. package/dist/backend/api/BasicAuth.js +5 -3
  27. package/dist/backend/api/CreateBackend.d.ts +11 -2
  28. package/dist/backend/api/CreateBackend.js +45 -2502
  29. package/dist/backend/api/DatabaseApi.d.ts +8 -2
  30. package/dist/backend/api/DatabaseApi.js +252 -123
  31. package/dist/backend/api/GithubApi.d.ts +0 -4
  32. package/dist/backend/api/GithubApi.js +11 -7
  33. package/dist/backend/api/OAuth2.d.ts +3 -3
  34. package/dist/backend/api/OAuth2.js +36 -25
  35. package/dist/backend/api/S3Uploads.d.ts +32 -0
  36. package/dist/backend/api/S3Uploads.js +178 -0
  37. package/dist/backend/api/SupabaseUploads.d.ts +28 -0
  38. package/dist/backend/api/SupabaseUploads.js +41 -0
  39. package/dist/backend/api/UploadPaths.d.ts +7 -0
  40. package/dist/backend/api/UploadPaths.js +53 -0
  41. package/dist/backend/api/auth.d.ts +5 -0
  42. package/dist/backend/api/auth.js +15 -0
  43. package/dist/backend/api/database.d.ts +2 -0
  44. package/dist/backend/api/database.js +16 -0
  45. package/dist/backend/api/github.d.ts +3 -0
  46. package/dist/backend/api/github.js +10 -0
  47. package/dist/backend/api/uploads.d.ts +9 -0
  48. package/dist/backend/api/uploads.js +23 -0
  49. package/dist/backend/loader/JsonLoader.js +1 -1
  50. package/dist/backend/resolver/ParsePreview.js +2 -2
  51. package/dist/backend/router/NodeHandler.js +1 -1
  52. package/dist/backend/router/Router.d.ts +1 -0
  53. package/dist/backend/router/Router.js +53 -21
  54. package/dist/backend/store/GeneratedRelease.js +1 -1
  55. package/dist/backend/store/GeneratedSource.js +1 -1
  56. package/dist/backend/util/ExecGit.js +4 -4
  57. package/dist/backend/util/JWTPreviews.d.ts +3 -3
  58. package/dist/backend/util/JWTPreviews.js +19 -5
  59. package/dist/backend/util/JsonPatch.js +1 -1
  60. package/dist/backend/util/ORM.js +2 -2
  61. package/dist/backend/util/Syncable.js +2 -2
  62. package/dist/backend.d.ts +5 -0
  63. package/dist/backend.js +17 -0
  64. package/dist/bundled.d.ts +8368 -8238
  65. package/dist/chunks/chunk-53DZYORR.js +3705 -0
  66. package/dist/chunks/chunk-6UT4N4CO.js +919 -0
  67. package/dist/chunks/chunk-7ORQ7BYK.js +1187 -0
  68. package/dist/chunks/chunk-AC4U3IMS.js +205 -0
  69. package/dist/chunks/chunk-BYJRQTFR.js +57 -0
  70. package/dist/chunks/chunk-CQ52GEHY.js +39 -0
  71. package/dist/chunks/chunk-F36YGSHN.js +335 -0
  72. package/dist/chunks/chunk-FRYHNUEK.js +79 -0
  73. package/dist/chunks/chunk-G6E35DMJ.js +1997 -0
  74. package/dist/chunks/chunk-I4GC3E65.js +170 -0
  75. package/dist/chunks/chunk-I4OYYAX5.js +63 -0
  76. package/dist/chunks/chunk-I7X64JTZ.js +10402 -0
  77. package/dist/chunks/chunk-IWN3T3FL.js +19493 -0
  78. package/dist/chunks/chunk-IYAQC63Y.js +1265 -0
  79. package/dist/chunks/chunk-JFROOUG6.js +6363 -0
  80. package/dist/chunks/chunk-LB3UYTOL.js +95 -0
  81. package/dist/chunks/chunk-LUBOGJCG.js +129 -0
  82. package/dist/chunks/chunk-NWQXN4SB.js +227 -0
  83. package/dist/chunks/chunk-RKDPDEF7.js +160 -0
  84. package/dist/chunks/chunk-SJBZFMQ2.js +2966 -0
  85. package/dist/chunks/chunk-STAJCW4Z.js +322 -0
  86. package/dist/chunks/chunk-TL7ZW6BX.js +17963 -0
  87. package/dist/chunks/chunk-U4VOHNR2.js +210 -0
  88. package/dist/chunks/chunk-U5Z2VE7Z.js +120 -0
  89. package/dist/chunks/chunk-X47OVDF3.js +1974 -0
  90. package/dist/chunks/chunk-Y7XOMJOC.js +791 -0
  91. package/dist/chunks/chunk-YK3OSMDM.js +5473 -0
  92. package/dist/chunks/crypto-UO2XRCJS.js +11 -0
  93. package/dist/cli/Generate.js +9 -4
  94. package/dist/cli/Init.js +1 -1
  95. package/dist/cli/Serve.d.ts +2 -2
  96. package/dist/cli/Serve.js +54 -100
  97. package/dist/cli/bin.js +85 -12
  98. package/dist/cli/build/BuildEmitter.js +1 -1
  99. package/dist/cli/build/BuildOptions.js +1 -1
  100. package/dist/cli/generate/CompileConfig.d.ts +1 -1
  101. package/dist/cli/generate/CompileConfig.js +4 -3
  102. package/dist/cli/generate/CopyStaticFiles.js +2 -1
  103. package/dist/cli/generate/DevDB.js +2 -8
  104. package/dist/cli/generate/FillCache.js +2 -2
  105. package/dist/cli/generate/GenerateDashboard.js +1 -1
  106. package/dist/cli/generate/LoadConfig.js +2 -3
  107. package/dist/cli/serve/CreateLocalServer.d.ts +1 -1
  108. package/dist/cli/serve/CreateLocalServer.js +81 -26
  109. package/dist/cli/serve/DevServer.d.ts +19 -0
  110. package/dist/cli/serve/DevServer.js +134 -0
  111. package/dist/cli/serve/GitHistory.d.ts +1 -2
  112. package/dist/cli/serve/GitHistory.js +15 -2
  113. package/dist/cli/serve/LiveReload.js +1 -1
  114. package/dist/cli/serve/LocalAuth.js +1 -1
  115. package/dist/cli/serve/MemoryDrafts.js +1 -1
  116. package/dist/cli/serve/StartServer.js +1 -1
  117. package/dist/cli/static/init/cms.js +45 -47
  118. package/dist/cli/static/init/next-handler.js +8 -8
  119. package/dist/cli/util/CommitMessage.js +1 -1
  120. package/dist/cli/util/CommitSha.js +1 -1
  121. package/dist/cli/util/Dirname.js +1 -1
  122. package/dist/cli/util/Emitter.js +1 -1
  123. package/dist/cli/util/EnsureEnv.js +1 -1
  124. package/dist/cli/util/EnsureLibs.js +1 -1
  125. package/dist/cli/util/EnsureNode.js +1 -1
  126. package/dist/cli/util/FS.js +1 -1
  127. package/dist/cli/util/FindConfigFile.js +1 -1
  128. package/dist/cli/util/ForwardCommand.js +1 -1
  129. package/dist/cli/util/IgnorePlugin.js +1 -1
  130. package/dist/cli/util/PublicDefines.js +1 -1
  131. package/dist/cli/util/Report.js +1 -1
  132. package/dist/cli/util/ViewsPlugin.js +2 -2
  133. package/dist/cli/util/WarnPublicEnv.js +1 -1
  134. package/dist/cli/util/Watcher.js +1 -1
  135. package/dist/cloud/AuthResult.js +1 -1
  136. package/dist/cloud/CloudConfig.d.ts +1 -0
  137. package/dist/cloud/CloudConfig.js +2 -1
  138. package/dist/cloud/CloudRemote.d.ts +12 -5
  139. package/dist/cloud/CloudRemote.js +58 -10
  140. package/dist/components/Breadcrumbs.d.ts +3 -0
  141. package/dist/components/Breadcrumbs.js +42 -0
  142. package/dist/components/Button.d.ts +10 -0
  143. package/dist/components/Button.js +57 -0
  144. package/dist/components/Calendar.d.ts +3 -0
  145. package/dist/components/Calendar.js +94 -0
  146. package/dist/components/Checkbox.d.ts +9 -0
  147. package/dist/components/Checkbox.js +75 -0
  148. package/dist/components/CheckboxGroup.d.ts +6 -0
  149. package/dist/components/CheckboxGroup.js +45 -0
  150. package/dist/components/ColorSwatch.d.ts +2 -0
  151. package/dist/components/ColorSwatch.js +45 -0
  152. package/dist/components/ColorSwatchPicker.d.ts +3 -0
  153. package/dist/components/ColorSwatchPicker.js +66 -0
  154. package/dist/components/ComboBox.d.ts +13 -0
  155. package/dist/components/ComboBox.js +147 -0
  156. package/dist/components/DateField.d.ts +5 -0
  157. package/dist/components/DateField.js +61 -0
  158. package/dist/components/DatePicker.d.ts +5 -0
  159. package/dist/components/DatePicker.js +78 -0
  160. package/dist/components/DateRangePicker.d.ts +5 -0
  161. package/dist/components/DateRangePicker.js +95 -0
  162. package/dist/components/Dialog.d.ts +3 -0
  163. package/dist/components/Dialog.js +43 -0
  164. package/dist/components/Disclosure.d.ts +5 -0
  165. package/dist/components/Disclosure.js +106 -0
  166. package/dist/components/DropZone.d.ts +4 -0
  167. package/dist/components/DropZone.js +41 -0
  168. package/dist/components/FoldIcon.d.ts +6 -0
  169. package/dist/components/FoldIcon.js +31 -0
  170. package/dist/components/Icon.d.ts +7 -0
  171. package/dist/components/Icon.js +40 -0
  172. package/dist/components/Label.d.ts +48 -0
  173. package/dist/components/Label.js +210 -0
  174. package/dist/components/Link.d.ts +5 -0
  175. package/dist/components/Link.js +42 -0
  176. package/dist/components/List.d.ts +99 -0
  177. package/dist/components/List.js +397 -0
  178. package/dist/components/Menu.d.ts +16 -0
  179. package/dist/components/Menu.js +95 -0
  180. package/dist/components/Modal.d.ts +7 -0
  181. package/dist/components/Modal.js +58 -0
  182. package/dist/components/MultipleSelect.d.ts +25 -0
  183. package/dist/components/MultipleSelect.js +278 -0
  184. package/dist/components/NumberField.d.ts +6 -0
  185. package/dist/components/NumberField.js +90 -0
  186. package/dist/components/Popover.d.ts +6 -0
  187. package/dist/components/Popover.js +42 -0
  188. package/dist/components/ProgressCircle.d.ts +6 -0
  189. package/dist/components/ProgressCircle.js +96 -0
  190. package/dist/components/RadioGroup.d.ts +8 -0
  191. package/dist/components/RadioGroup.js +64 -0
  192. package/dist/components/SearchField.d.ts +8 -0
  193. package/dist/components/SearchField.js +86 -0
  194. package/dist/components/Select.d.ts +13 -0
  195. package/dist/components/Select.js +150 -0
  196. package/dist/components/Surface.d.ts +15 -0
  197. package/dist/components/Surface.js +53 -0
  198. package/dist/components/Switch.d.ts +5 -0
  199. package/dist/components/Switch.js +47 -0
  200. package/dist/components/Table.d.ts +14 -0
  201. package/dist/components/Table.js +147 -0
  202. package/dist/components/Tabs.d.ts +13 -0
  203. package/dist/components/Tabs.js +96 -0
  204. package/dist/components/TagGroup.d.ts +10 -0
  205. package/dist/components/TagGroup.js +81 -0
  206. package/dist/components/TextField.d.ts +13 -0
  207. package/dist/components/TextField.js +77 -0
  208. package/dist/components/TimeField.d.ts +5 -0
  209. package/dist/components/TimeField.js +55 -0
  210. package/dist/components/Toggle.d.ts +8 -0
  211. package/dist/components/Toggle.js +61 -0
  212. package/dist/components/Toolbar.d.ts +8 -0
  213. package/dist/components/Toolbar.js +80 -0
  214. package/dist/components/Tooltip.d.ts +7 -0
  215. package/dist/components/Tooltip.js +54 -0
  216. package/dist/components/Tree.d.ts +23 -0
  217. package/dist/components/Tree.js +130 -0
  218. package/dist/components.d.ts +38 -0
  219. package/dist/components.js +39 -0
  220. package/dist/config.js +1 -1
  221. package/dist/core/BlobTransport.d.ts +5 -0
  222. package/dist/core/BlobTransport.js +79 -0
  223. package/dist/core/CMS.js +1 -1
  224. package/dist/core/Client.d.ts +13 -8
  225. package/dist/core/Client.js +67 -20
  226. package/dist/core/Config.d.ts +2 -0
  227. package/dist/core/Config.js +1 -3
  228. package/dist/core/Connection.d.ts +30 -10
  229. package/dist/core/Document.js +10 -8
  230. package/dist/core/Draft.js +1 -1
  231. package/dist/core/Entry.d.ts +6 -0
  232. package/dist/core/Entry.js +16 -1
  233. package/dist/core/EntryFields.d.ts +4 -0
  234. package/dist/core/EntryFields.js +4 -2
  235. package/dist/core/EntryRecord.js +1 -1
  236. package/dist/core/Expr.d.ts +1 -0
  237. package/dist/core/Expr.js +1 -1
  238. package/dist/core/Field.d.ts +46 -5
  239. package/dist/core/Field.js +56 -10
  240. package/dist/core/Graph.d.ts +6 -0
  241. package/dist/core/Graph.js +1 -1
  242. package/dist/core/HttpError.js +1 -1
  243. package/dist/core/Id.js +1 -1
  244. package/dist/core/Infer.d.ts +1 -1
  245. package/dist/core/Internal.js +6 -6
  246. package/dist/core/ListRow.d.ts +10 -0
  247. package/dist/core/ListRow.js +12 -0
  248. package/dist/core/Outcome.js +1 -1
  249. package/dist/core/Page.js +2 -2
  250. package/dist/core/Picker.d.ts +0 -2
  251. package/dist/core/Picker.js +1 -1
  252. package/dist/core/Reference.js +1 -1
  253. package/dist/core/Role.d.ts +3 -0
  254. package/dist/core/Role.js +7 -1
  255. package/dist/core/Root.d.ts +4 -0
  256. package/dist/core/Root.js +7 -2
  257. package/dist/core/Schema.d.ts +0 -2
  258. package/dist/core/Schema.js +2 -16
  259. package/dist/core/Scope.js +1 -1
  260. package/dist/core/Section.js +2 -2
  261. package/dist/core/TextDoc.d.ts +4 -0
  262. package/dist/core/TextDoc.js +3 -1
  263. package/dist/core/Tracker.d.ts +1 -6
  264. package/dist/core/Tracker.js +2 -12
  265. package/dist/core/Trigger.js +1 -1
  266. package/dist/core/Type.d.ts +22 -7
  267. package/dist/core/Type.js +108 -28
  268. package/dist/core/UnionRow.d.ts +11 -0
  269. package/dist/core/UnionRow.js +11 -0
  270. package/dist/core/User.d.ts +7 -1
  271. package/dist/core/User.js +1 -1
  272. package/dist/core/View.js +1 -1
  273. package/dist/core/Workspace.d.ts +4 -1
  274. package/dist/core/Workspace.js +1 -1
  275. package/dist/core/db/CommitRequest.d.ts +2 -0
  276. package/dist/core/db/CommitRequest.js +1 -1
  277. package/dist/core/db/EntryAliases.d.ts +2 -0
  278. package/dist/core/db/EntryAliases.js +28 -0
  279. package/dist/core/db/EntryDB.d.ts +2 -2
  280. package/dist/core/db/EntryDB.js +3 -3
  281. package/dist/core/db/EntryIndex.d.ts +9 -2
  282. package/dist/core/db/EntryIndex.js +182 -39
  283. package/dist/core/db/EntryReference.d.ts +44 -0
  284. package/dist/core/db/EntryReference.js +9 -0
  285. package/dist/core/db/EntryReferenceIndex.d.ts +21 -0
  286. package/dist/core/db/EntryReferenceIndex.js +131 -0
  287. package/dist/core/db/EntryResolver.d.ts +10 -7
  288. package/dist/core/db/EntryResolver.js +90 -35
  289. package/dist/core/db/EntryTransaction.d.ts +1 -1
  290. package/dist/core/db/EntryTransaction.js +390 -57
  291. package/dist/core/db/EntryUrlConflictError.d.ts +11 -0
  292. package/dist/core/db/EntryUrlConflictError.js +16 -0
  293. package/dist/core/db/IndexEvent.d.ts +5 -2
  294. package/dist/core/db/IndexEvent.js +2 -1
  295. package/dist/core/db/LinkResolver.d.ts +1 -1
  296. package/dist/core/db/LinkResolver.js +4 -1
  297. package/dist/core/db/LocalDB.d.ts +7 -4
  298. package/dist/core/db/LocalDB.js +22 -10
  299. package/dist/core/db/Mutation.d.ts +3 -3
  300. package/dist/core/db/Operation.d.ts +8 -3
  301. package/dist/core/db/Operation.js +67 -23
  302. package/dist/core/db/TestDB.d.ts +9 -1
  303. package/dist/core/db/TestDB.js +24 -1
  304. package/dist/core/db/WriteableGraph.d.ts +15 -4
  305. package/dist/core/db/WriteableGraph.js +14 -2
  306. package/dist/core/field/CreateField.d.ts +5 -4
  307. package/dist/core/field/CreateField.js +9 -5
  308. package/dist/core/field/ListField.d.ts +13 -4
  309. package/dist/core/field/ListField.js +146 -13
  310. package/dist/core/field/RecordField.d.ts +5 -3
  311. package/dist/core/field/RecordField.js +58 -2
  312. package/dist/core/field/RichTextField.d.ts +7 -2
  313. package/dist/core/field/RichTextField.js +309 -10
  314. package/dist/core/field/ScalarField.js +9 -7
  315. package/dist/core/field/UnionField.d.ts +2 -3
  316. package/dist/core/field/UnionField.js +61 -12
  317. package/dist/core/media/CreatePreview.browser.js +5 -5
  318. package/dist/core/media/CreatePreview.js +15 -10
  319. package/dist/core/media/IsImage.js +1 -1
  320. package/dist/core/media/MediaAltField.d.ts +9 -0
  321. package/dist/core/media/MediaAltField.js +17 -0
  322. package/dist/core/media/MediaLocation.d.ts +42 -0
  323. package/dist/core/media/MediaLocation.js +54 -2
  324. package/dist/core/media/MediaRoot.d.ts +2 -2
  325. package/dist/core/media/MediaRoot.js +12 -11
  326. package/dist/core/media/MediaTypes.d.ts +21 -15
  327. package/dist/core/media/MediaTypes.js +44 -16
  328. package/dist/core/media/Summary.d.ts +8 -8
  329. package/dist/core/media/Summary.js +1 -1
  330. package/dist/core/media/UploadLimits.d.ts +1 -0
  331. package/dist/core/media/UploadLimits.js +20 -0
  332. package/dist/core/pages/Snippet.js +1 -1
  333. package/dist/core/shape/ListShape.d.ts +1 -47
  334. package/dist/core/shape/ListShape.js +1 -224
  335. package/dist/core/source/CombinedSource.d.ts +2 -2
  336. package/dist/core/source/CombinedSource.js +7 -4
  337. package/dist/core/source/FSSource.d.ts +7 -5
  338. package/dist/core/source/FSSource.js +79 -34
  339. package/dist/core/source/FilePatch.js +5 -2
  340. package/dist/core/source/GitDelta.js +1 -1
  341. package/dist/core/source/GitUtils.js +1 -1
  342. package/dist/core/source/GithubSource.d.ts +3 -2
  343. package/dist/core/source/GithubSource.js +38 -13
  344. package/dist/core/source/IndexedDBSource.d.ts +2 -2
  345. package/dist/core/source/IndexedDBSource.js +26 -12
  346. package/dist/core/source/MemorySource.d.ts +2 -2
  347. package/dist/core/source/MemorySource.js +4 -2
  348. package/dist/core/source/ShaMismatchError.js +3 -1
  349. package/dist/core/source/Source.d.ts +4 -1
  350. package/dist/core/source/Source.js +1 -1
  351. package/dist/core/source/SourceExport.js +3 -3
  352. package/dist/core/source/Tree.js +1 -1
  353. package/dist/core/source/Utils.js +2 -5
  354. package/dist/core/util/Anchors.d.ts +4 -0
  355. package/dist/core/util/Anchors.js +45 -0
  356. package/dist/core/util/ArrayBuffers.js +1 -1
  357. package/dist/core/util/Assert.js +1 -1
  358. package/dist/core/util/Async.d.ts +8 -2
  359. package/dist/core/util/Async.js +68 -1
  360. package/dist/core/util/BufferToBase64.js +1 -1
  361. package/dist/core/util/Callable.js +1 -1
  362. package/dist/core/util/Checks.js +2 -2
  363. package/dist/core/util/CodeGen.js +3 -1
  364. package/dist/core/util/ContentHash.js +1 -1
  365. package/dist/core/util/Debounce.js +1 -1
  366. package/dist/core/util/DeepMap.d.ts +14 -0
  367. package/dist/core/util/DeepMap.js +75 -0
  368. package/dist/core/util/Encoding.js +1 -1
  369. package/dist/core/util/EntryFilenames.d.ts +2 -3
  370. package/dist/core/util/EntryFilenames.js +5 -9
  371. package/dist/core/util/EntryRows.js +1 -1
  372. package/dist/core/util/FractionalIndexing.js +1 -1
  373. package/dist/core/util/GetRandomColor.js +20 -20
  374. package/dist/core/util/Identifiers.js +1 -1
  375. package/dist/core/util/JWT.js +1 -1
  376. package/dist/core/util/Lazy.js +1 -1
  377. package/dist/core/util/LazyRecord.js +1 -1
  378. package/dist/core/util/Logger.js +2 -1
  379. package/dist/core/util/Objects.d.ts +1 -0
  380. package/dist/core/util/Objects.js +5 -1
  381. package/dist/core/util/Paths.js +2 -2
  382. package/dist/core/util/RowId.js +1 -1
  383. package/dist/core/util/Slugs.js +1 -1
  384. package/dist/core/util/Timer.js +1 -1
  385. package/dist/core/util/Types.js +1 -1
  386. package/dist/core/util/Urls.js +1 -1
  387. package/dist/core.d.ts +1 -0
  388. package/dist/core.js +2 -1
  389. package/dist/dashboard/App.css +319 -0
  390. package/dist/dashboard/App.d.ts +8 -8
  391. package/dist/dashboard/App.js +188 -142
  392. package/dist/dashboard/StoryProvider.d.ts +12 -0
  393. package/dist/dashboard/StoryProvider.js +82 -0
  394. package/dist/dashboard/ViewKeys.d.ts +26 -0
  395. package/dist/dashboard/ViewKeys.js +32 -0
  396. package/dist/dashboard/app/AccessDenied.d.ts +5 -0
  397. package/dist/dashboard/app/AccessDenied.js +53 -0
  398. package/dist/dashboard/app/ActivityStatus.d.ts +10 -0
  399. package/dist/dashboard/app/ActivityStatus.js +459 -0
  400. package/dist/dashboard/app/AlineaLogo.d.ts +4 -0
  401. package/dist/dashboard/app/AlineaLogo.js +26 -0
  402. package/dist/dashboard/app/AppShell.d.ts +4 -0
  403. package/dist/dashboard/app/AppShell.js +29 -0
  404. package/dist/dashboard/app/AuthView.d.ts +8 -0
  405. package/dist/dashboard/app/AuthView.js +111 -0
  406. package/dist/dashboard/app/Badge.d.ts +8 -0
  407. package/dist/dashboard/app/Badge.js +42 -0
  408. package/dist/dashboard/app/CompactField.d.ts +14 -0
  409. package/dist/dashboard/app/CompactField.js +178 -0
  410. package/dist/dashboard/app/DashboardErrorBoundary.d.ts +2 -0
  411. package/dist/dashboard/app/DashboardErrorBoundary.js +122 -0
  412. package/dist/dashboard/app/DashboardLayout.d.ts +18 -0
  413. package/dist/dashboard/app/DashboardLayout.js +88 -0
  414. package/dist/dashboard/app/DashboardMeta.d.ts +7 -0
  415. package/dist/dashboard/app/DashboardMeta.js +28 -0
  416. package/dist/dashboard/app/EditorBackButton.d.ts +5 -0
  417. package/dist/dashboard/app/EditorBackButton.js +33 -0
  418. package/dist/dashboard/app/EntryFields.d.ts +21 -0
  419. package/dist/dashboard/app/EntryFields.js +101 -0
  420. package/dist/dashboard/app/EntryHeader.d.ts +15 -0
  421. package/dist/dashboard/app/EntryHeader.js +452 -0
  422. package/dist/dashboard/app/EntryHeaderActions.d.ts +37 -0
  423. package/dist/dashboard/app/EntryHeaderActions.js +71 -0
  424. package/dist/dashboard/app/EntryReferences.d.ts +6 -0
  425. package/dist/dashboard/app/EntryReferences.js +209 -0
  426. package/dist/dashboard/app/EntrySidebar.d.ts +25 -0
  427. package/dist/dashboard/app/EntrySidebar.js +378 -0
  428. package/dist/dashboard/app/EntrySidebarPreview.d.ts +10 -0
  429. package/dist/dashboard/app/EntrySidebarPreview.js +260 -0
  430. package/dist/dashboard/app/EntrySidebarPreview.story.d.ts +1 -0
  431. package/dist/dashboard/app/EntrySidebarToggle.d.ts +6 -0
  432. package/dist/dashboard/app/EntrySidebarToggle.js +29 -0
  433. package/dist/dashboard/app/EntryTranslationBanner.d.ts +7 -0
  434. package/dist/dashboard/app/EntryTranslationBanner.js +60 -0
  435. package/dist/dashboard/app/Explorer.d.ts +41 -0
  436. package/dist/dashboard/app/Explorer.js +812 -0
  437. package/dist/dashboard/app/ExplorerCards.d.ts +12 -0
  438. package/dist/dashboard/app/ExplorerCards.js +389 -0
  439. package/dist/dashboard/app/ExplorerFileCard.d.ts +10 -0
  440. package/dist/dashboard/app/ExplorerFileCard.js +115 -0
  441. package/dist/dashboard/app/ExplorerList.d.ts +9 -0
  442. package/dist/dashboard/app/ExplorerList.js +165 -0
  443. package/dist/dashboard/app/ExplorerModal.d.ts +16 -0
  444. package/dist/dashboard/app/ExplorerModal.js +89 -0
  445. package/dist/dashboard/app/ExplorerPickerContent.d.ts +13 -0
  446. package/dist/dashboard/app/ExplorerPickerContent.js +114 -0
  447. package/dist/dashboard/app/ExplorerTable.d.ts +14 -0
  448. package/dist/dashboard/app/ExplorerTable.js +512 -0
  449. package/dist/dashboard/app/ExternalLinkPicker.d.ts +12 -0
  450. package/dist/dashboard/app/ExternalLinkPicker.js +97 -0
  451. package/dist/dashboard/app/ImagePicker.d.ts +6 -0
  452. package/dist/dashboard/app/ImagePicker.js +145 -0
  453. package/dist/dashboard/app/LinkPicker.d.ts +9 -0
  454. package/dist/dashboard/app/LinkPicker.js +317 -0
  455. package/dist/dashboard/app/LocaleMenu.d.ts +8 -0
  456. package/dist/dashboard/app/LocaleMenu.js +110 -0
  457. package/dist/dashboard/app/LogoShape.d.ts +8 -0
  458. package/dist/dashboard/app/LogoShape.js +60 -0
  459. package/dist/dashboard/app/SidebarTree.d.ts +37 -0
  460. package/dist/dashboard/app/SidebarTree.js +433 -0
  461. package/dist/dashboard/app/StatusBadge.d.ts +6 -0
  462. package/dist/dashboard/app/StatusBadge.js +26 -0
  463. package/dist/dashboard/app/ViewToggle.d.ts +7 -0
  464. package/dist/dashboard/app/ViewToggle.js +27 -0
  465. package/dist/dashboard/app/WorkspaceMenu.d.ts +24 -0
  466. package/dist/dashboard/app/WorkspaceMenu.js +264 -0
  467. package/dist/dashboard/app/WorkspaceMenu.stories.d.ts +5 -0
  468. package/dist/dashboard/app/WorkspaceRoots.d.ts +6 -0
  469. package/dist/dashboard/app/WorkspaceRoots.js +285 -0
  470. package/dist/dashboard/app/editor/FileEditor.d.ts +6 -0
  471. package/dist/dashboard/app/editor/FileEditor.js +200 -0
  472. package/dist/dashboard/app/editor/FilePreview.d.ts +13 -0
  473. package/dist/dashboard/app/editor/FilePreview.js +196 -0
  474. package/dist/dashboard/app/editor/MediaAltField.view.d.ts +5 -0
  475. package/dist/dashboard/app/editor/MediaAltField.view.js +98 -0
  476. package/dist/dashboard/app/modals/CreateEntry.d.ts +1 -0
  477. package/dist/dashboard/app/modals/CreateEntry.js +283 -0
  478. package/dist/dashboard/app/pages/EntryPage.d.ts +11 -0
  479. package/dist/dashboard/app/pages/EntryPage.js +356 -0
  480. package/dist/dashboard/app/pages/RootPage.d.ts +9 -0
  481. package/dist/dashboard/app/pages/RootPage.js +90 -0
  482. package/dist/dashboard/app/pages/UsersPage.d.ts +7 -0
  483. package/dist/dashboard/app/pages/UsersPage.js +552 -0
  484. package/dist/dashboard/app/ui/DashboardModal.d.ts +34 -0
  485. package/dist/dashboard/app/ui/DashboardModal.js +192 -0
  486. package/dist/dashboard/app/ui/Rail.d.ts +18 -0
  487. package/dist/dashboard/app/ui/Rail.js +41 -0
  488. package/dist/dashboard/app/ui/Sidebar.d.ts +15 -0
  489. package/dist/dashboard/app/ui/Sidebar.js +55 -0
  490. package/dist/dashboard/atoms/ReactiveNode.d.ts +41 -0
  491. package/dist/dashboard/atoms/ReactiveNode.js +248 -0
  492. package/dist/dashboard/atoms/activity.d.ts +48 -0
  493. package/dist/dashboard/atoms/activity.js +189 -0
  494. package/dist/dashboard/atoms/auth.d.ts +38 -0
  495. package/dist/dashboard/atoms/auth.js +106 -0
  496. package/dist/dashboard/atoms/config.d.ts +27 -0
  497. package/dist/dashboard/atoms/config.js +49 -0
  498. package/dist/dashboard/atoms/core.d.ts +15 -0
  499. package/dist/dashboard/atoms/core.js +37 -0
  500. package/dist/dashboard/atoms/create.d.ts +13 -0
  501. package/dist/dashboard/atoms/create.js +79 -0
  502. package/dist/dashboard/atoms/dashboard.d.ts +12 -0
  503. package/dist/dashboard/atoms/dashboard.js +71 -0
  504. package/dist/dashboard/atoms/editor.d.ts +80 -0
  505. package/dist/dashboard/atoms/editor.js +132 -0
  506. package/dist/dashboard/atoms/entry.d.ts +267 -0
  507. package/dist/dashboard/atoms/entry.js +774 -0
  508. package/dist/dashboard/atoms/explorer.d.ts +257 -0
  509. package/dist/dashboard/atoms/explorer.js +677 -0
  510. package/dist/dashboard/atoms/graph.d.ts +5 -0
  511. package/dist/dashboard/atoms/graph.js +62 -0
  512. package/dist/dashboard/atoms/link.d.ts +24 -0
  513. package/dist/dashboard/atoms/link.js +82 -0
  514. package/dist/dashboard/atoms/nav.d.ts +47 -0
  515. package/dist/dashboard/atoms/nav.js +220 -0
  516. package/dist/dashboard/atoms/preview.d.ts +4 -0
  517. package/dist/dashboard/atoms/preview.js +10 -0
  518. package/dist/dashboard/atoms/root.d.ts +91 -0
  519. package/dist/dashboard/atoms/root.js +383 -0
  520. package/dist/dashboard/atoms/upload.d.ts +9 -0
  521. package/dist/dashboard/atoms/upload.js +81 -0
  522. package/dist/dashboard/atoms/user.d.ts +9 -0
  523. package/dist/dashboard/atoms/user.js +75 -0
  524. package/dist/dashboard/atoms/utils.d.ts +17 -0
  525. package/dist/dashboard/atoms/utils.js +151 -0
  526. package/dist/dashboard/boot/ActivityEvent.d.ts +44 -0
  527. package/dist/dashboard/boot/ActivityEvent.js +14 -0
  528. package/dist/dashboard/boot/Boot.js +9 -5
  529. package/dist/dashboard/boot/BootDev.js +2 -1
  530. package/dist/dashboard/boot/BootProd.js +1 -1
  531. package/dist/dashboard/boot/DashboardWorker.d.ts +7 -7
  532. package/dist/dashboard/boot/DashboardWorker.js +370 -30
  533. package/dist/dashboard/boot/LoadWorker.js +6 -3
  534. package/dist/dashboard/boot/WorkerDB.d.ts +9 -2
  535. package/dist/dashboard/boot/WorkerDB.js +20 -3
  536. package/dist/dashboard/editor/UseField.d.ts +29 -10
  537. package/dist/dashboard/editor/UseField.js +27 -59
  538. package/dist/dashboard/fixture/cms.d.ts +116 -0
  539. package/dist/dashboard/fixture/cms.js +230 -0
  540. package/dist/dashboard/hook/UseEntryEditor.d.ts +25 -6
  541. package/dist/dashboard/hook/UseEntryEditor.js +34 -12
  542. package/dist/dashboard/hook/UseGraph.d.ts +3 -0
  543. package/dist/dashboard/hook/UseGraph.js +5 -5
  544. package/dist/dashboard/hook/UseLocale.d.ts +4 -1
  545. package/dist/dashboard/hook/UseLocale.js +5 -7
  546. package/dist/dashboard/hook/UseRoot.d.ts +7 -12
  547. package/dist/dashboard/hook/UseRoot.js +8 -5
  548. package/dist/dashboard/hook/UseWorkspace.d.ts +7 -9
  549. package/dist/dashboard/hook/UseWorkspace.js +5 -7
  550. package/dist/dashboard/hooks.d.ts +157 -0
  551. package/dist/dashboard/hooks.js +229 -0
  552. package/dist/dashboard/icons.d.ts +171 -0
  553. package/dist/dashboard/icons.js +2686 -0
  554. package/dist/dashboard/plugins/alineaFixturePlugin.d.ts +2 -0
  555. package/dist/dashboard/plugins/alineaFixturePlugin.js +200 -0
  556. package/dist/dashboard.d.ts +1 -2
  557. package/dist/dashboard.js +6 -2
  558. package/dist/edit.d.ts +1 -1
  559. package/dist/edit.js +2 -4
  560. package/dist/field/check/CheckField.js +3 -3
  561. package/dist/field/check/CheckField.view.d.ts +3 -3
  562. package/dist/field/check/CheckField.view.js +37 -84
  563. package/dist/field/code/CodeField.js +2 -2
  564. package/dist/field/code/CodeField.view.d.ts +21 -3
  565. package/dist/field/code/CodeField.view.js +177 -39
  566. package/dist/field/code/SimpleCodeEditor.d.ts +50 -0
  567. package/dist/field/code/SimpleCodeEditor.js +452 -0
  568. package/dist/field/date/DateField.js +3 -3
  569. package/dist/field/date/DateField.view.d.ts +3 -3
  570. package/dist/field/date/DateField.view.js +26 -26
  571. package/dist/field/hidden/HiddenField.js +2 -2
  572. package/dist/field/hidden/HiddenField.view.js +1 -1
  573. package/dist/field/json/JsonField.js +2 -2
  574. package/dist/field/json/JsonField.view.d.ts +4 -4
  575. package/dist/field/json/JsonField.view.js +53 -76
  576. package/dist/field/link/EntryLink.d.ts +9 -8
  577. package/dist/field/link/EntryLink.js +4 -2
  578. package/dist/field/link/FileLink.d.ts +7 -7
  579. package/dist/field/link/FileLink.js +12 -6
  580. package/dist/field/link/ImageLink.d.ts +5 -3
  581. package/dist/field/link/ImageLink.js +5 -2
  582. package/dist/field/link/Link.d.ts +1 -1
  583. package/dist/field/link/Link.js +1 -1
  584. package/dist/field/link/LinkEditor.d.ts +1 -1
  585. package/dist/field/link/LinkEditor.js +1 -1
  586. package/dist/field/link/LinkField.d.ts +5 -3
  587. package/dist/field/link/LinkField.js +56 -17
  588. package/dist/field/link/LinkField.stories.d.ts +11 -1
  589. package/dist/field/link/LinkField.view.d.ts +8 -10
  590. package/dist/field/link/LinkField.view.js +1461 -363
  591. package/dist/field/link/UrlLink.d.ts +2 -2
  592. package/dist/field/link/UrlLink.js +4 -2
  593. package/dist/field/list/ListField.d.ts +3 -3
  594. package/dist/field/list/ListField.js +5 -6
  595. package/dist/field/list/ListField.stories.d.ts +2 -1
  596. package/dist/field/list/ListField.view.d.ts +15 -7
  597. package/dist/field/list/ListField.view.js +888 -377
  598. package/dist/field/localiser/LocalisedField.view.d.ts +5 -0
  599. package/dist/field/localiser/LocalisedField.view.js +63 -0
  600. package/dist/field/localiser/LocalisedFieldTabs.d.ts +8 -0
  601. package/dist/field/localiser/LocalisedFieldTabs.js +38 -0
  602. package/dist/field/localiser/Localiser.d.ts +25 -0
  603. package/dist/field/localiser/Localiser.js +140 -0
  604. package/dist/field/localiser.d.ts +1 -0
  605. package/dist/field/localiser.js +2 -0
  606. package/dist/field/metadata/MetadataAliases.d.ts +20 -0
  607. package/dist/field/metadata/MetadataAliases.js +22 -0
  608. package/dist/field/metadata/MetadataField.d.ts +31 -8
  609. package/dist/field/metadata/MetadataField.js +127 -11
  610. package/dist/field/metadata/MetadataField.view.d.ts +11 -3
  611. package/dist/field/metadata/MetadataField.view.js +130 -96
  612. package/dist/field/number/NumberField.js +3 -3
  613. package/dist/field/number/NumberField.view.d.ts +3 -3
  614. package/dist/field/number/NumberField.view.js +22 -54
  615. package/dist/field/object/ObjectField.d.ts +1 -1
  616. package/dist/field/object/ObjectField.js +11 -4
  617. package/dist/field/object/ObjectField.view.d.ts +4 -4
  618. package/dist/field/object/ObjectField.view.js +28 -19
  619. package/dist/field/path/PathField.js +3 -3
  620. package/dist/field/path/PathField.view.d.ts +3 -3
  621. package/dist/field/path/PathField.view.js +33 -133
  622. package/dist/field/path/SlugField.d.ts +16 -0
  623. package/dist/field/path/SlugField.js +52 -0
  624. package/dist/field/richtext/Extensions.d.ts +1 -28
  625. package/dist/field/richtext/Extensions.js +2 -4146
  626. package/dist/field/richtext/PickTextAnchor.d.ts +19 -0
  627. package/dist/field/richtext/PickTextAnchor.js +99 -0
  628. package/dist/field/richtext/PickTextLink.d.ts +18 -17
  629. package/dist/field/richtext/PickTextLink.js +133 -88
  630. package/dist/field/richtext/ReferenceLink.d.ts +2 -0
  631. package/dist/field/richtext/ReferenceLink.js +13 -4
  632. package/dist/field/richtext/RichTextBlock.d.ts +11 -0
  633. package/dist/field/richtext/RichTextBlock.js +143 -0
  634. package/dist/field/richtext/RichTextBlockHost.d.ts +13 -0
  635. package/dist/field/richtext/RichTextBlockHost.js +56 -0
  636. package/dist/field/richtext/RichTextBlockValue.d.ts +5 -0
  637. package/dist/field/richtext/RichTextBlockValue.js +34 -0
  638. package/dist/field/richtext/RichTextBlocks.d.ts +16 -0
  639. package/dist/field/richtext/RichTextBlocks.js +40 -0
  640. package/dist/field/richtext/RichTextDocument.d.ts +4 -0
  641. package/dist/field/richtext/RichTextDocument.js +162 -0
  642. package/dist/field/richtext/RichTextExtensions.d.ts +67 -0
  643. package/dist/field/richtext/RichTextExtensions.js +8219 -0
  644. package/dist/field/richtext/RichTextField.d.ts +10 -3
  645. package/dist/field/richtext/RichTextField.js +13 -3
  646. package/dist/field/richtext/RichTextField.story.d.ts +8 -0
  647. package/dist/field/richtext/RichTextField.view.d.ts +11 -5
  648. package/dist/field/richtext/RichTextField.view.js +385 -2447
  649. package/dist/field/richtext/RichTextInsertMenu.d.ts +9 -0
  650. package/dist/field/richtext/RichTextInsertMenu.js +1014 -0
  651. package/dist/field/richtext/RichTextState.d.ts +6 -0
  652. package/dist/field/richtext/RichTextState.js +58 -0
  653. package/dist/field/richtext/RichTextToolbar.d.ts +9 -36
  654. package/dist/field/richtext/RichTextToolbar.js +206 -178
  655. package/dist/field/richtext/Toolbar.d.ts +111 -65
  656. package/dist/field/richtext/Toolbar.js +60 -45
  657. package/dist/field/richtext/extensions/Anchor.d.ts +19 -0
  658. package/dist/field/richtext/extensions/Anchor.js +94 -0
  659. package/dist/field/richtext/extensions/Link.d.ts +3 -13
  660. package/dist/field/richtext/extensions/Link.js +15 -37
  661. package/dist/field/richtext/extensions/Small.d.ts +1 -10
  662. package/dist/field/richtext/extensions/Small.js +7 -19
  663. package/dist/field/select/SelectField.d.ts +15 -4
  664. package/dist/field/select/SelectField.js +17 -2
  665. package/dist/field/select/SelectField.view.d.ts +7 -3
  666. package/dist/field/select/SelectField.view.js +112 -155
  667. package/dist/field/tabs/Tabs.js +3 -2
  668. package/dist/field/tabs/Tabs.view.d.ts +1 -6
  669. package/dist/field/tabs/Tabs.view.js +22 -29
  670. package/dist/field/text/TextField.js +8 -3
  671. package/dist/field/text/TextField.view.d.ts +2 -2
  672. package/dist/field/text/TextField.view.js +40 -60
  673. package/dist/field/time/TimeField.js +3 -3
  674. package/dist/field/time/TimeField.view.d.ts +3 -3
  675. package/dist/field/time/TimeField.view.js +30 -30
  676. package/dist/field/view/View.js +1 -1
  677. package/dist/field/views.d.ts +2 -0
  678. package/dist/field/views.js +65 -0
  679. package/dist/field.d.ts +1 -0
  680. package/dist/field.js +3 -1
  681. package/dist/index.css +7039 -3624
  682. package/dist/index.js +1 -1
  683. package/dist/inter-latin-500-normal-JSHNAZJU.woff2 +0 -0
  684. package/dist/inter-latin-ext-500-normal-5ARINTHO.woff2 +0 -0
  685. package/dist/next.cjs +19 -9
  686. package/dist/next.edge.js +1 -1
  687. package/dist/next.js +1 -1
  688. package/dist/picker/entry/EntryPicker.d.ts +9 -4
  689. package/dist/picker/entry/EntryPicker.js +71 -19
  690. package/dist/picker/entry/EntryReference.d.ts +4 -0
  691. package/dist/picker/entry/EntryReference.js +3 -1
  692. package/dist/picker/url/UrlPicker.js +2 -12
  693. package/dist/preview/ChunkCookieValue.js +1 -1
  694. package/dist/preview/PreviewCookies.js +1 -1
  695. package/dist/preview/PreviewMessage.js +1 -1
  696. package/dist/preview/PreviewPayload.js +35 -23
  697. package/dist/preview/RegisterPreview.js +1 -1
  698. package/dist/preview/react.js +10 -3
  699. package/dist/preview/widget.js +1 -1
  700. package/dist/query.d.ts +116 -92
  701. package/dist/query.js +7 -1
  702. package/dist/types.d.ts +1 -0
  703. package/dist/ui/Link.d.ts +6 -5
  704. package/dist/ui/Link.js +37 -13
  705. package/dist/ui/RichText.d.ts +37 -11
  706. package/dist/ui/RichText.js +81 -44
  707. package/dist/ui/Stack.d.ts +11 -22
  708. package/dist/ui/Stack.js +54 -67
  709. package/dist/ui/icons/IcAlignCenter.d.ts +4 -2
  710. package/dist/ui/icons/IcAlignCenter.js +6 -12
  711. package/dist/ui/icons/IcOutlineGridView.d.ts +3 -2
  712. package/dist/ui/icons/IcOutlineGridView.js +3 -11
  713. package/dist/ui/icons/IcOutlineSettings.d.ts +3 -2
  714. package/dist/ui/icons/IcOutlineSettings.js +3 -11
  715. package/dist/ui/icons/IcRoundAccountTree.d.ts +4 -2
  716. package/dist/ui/icons/IcRoundAccountTree.js +6 -22
  717. package/dist/ui/icons/IcRoundClose.d.ts +4 -2
  718. package/dist/ui/icons/IcRoundClose.js +6 -12
  719. package/dist/ui/icons/IcRoundCode.d.ts +4 -2
  720. package/dist/ui/icons/IcRoundCode.js +6 -12
  721. package/dist/ui/icons/IcRoundDateRange.d.ts +3 -2
  722. package/dist/ui/icons/IcRoundDateRange.js +3 -11
  723. package/dist/ui/icons/IcRoundDelete.d.ts +4 -2
  724. package/dist/ui/icons/IcRoundDelete.js +6 -12
  725. package/dist/ui/icons/IcRoundEdit.d.ts +4 -2
  726. package/dist/ui/icons/IcRoundEdit.js +6 -12
  727. package/dist/ui/icons/IcRoundFormatListNumbered.d.ts +3 -2
  728. package/dist/ui/icons/IcRoundFormatListNumbered.js +3 -11
  729. package/dist/ui/icons/IcRoundLink.d.ts +4 -2
  730. package/dist/ui/icons/IcRoundLink.js +6 -12
  731. package/dist/ui/icons/IcRoundOpenInNew.d.ts +4 -2
  732. package/dist/ui/icons/IcRoundOpenInNew.js +6 -12
  733. package/dist/ui/icons/IcRoundPanorama.d.ts +4 -2
  734. package/dist/ui/icons/IcRoundPanorama.js +6 -6
  735. package/dist/ui/icons/IcRoundRefresh.d.ts +3 -2
  736. package/dist/ui/icons/IcRoundRefresh.js +3 -11
  737. package/dist/ui/icons/IcRoundSave.d.ts +4 -2
  738. package/dist/ui/icons/IcRoundSave.js +6 -22
  739. package/dist/ui/icons/IcRoundSearch.d.ts +4 -2
  740. package/dist/ui/icons/IcRoundSearch.js +6 -12
  741. package/dist/ui/icons/IcRoundShare.d.ts +4 -2
  742. package/dist/ui/icons/IcRoundShare.js +6 -12
  743. package/dist/ui/icons/IcRoundSync.d.ts +4 -2
  744. package/dist/ui/icons/IcRoundSync.js +6 -22
  745. package/dist/ui/icons/MaterialSymbolsDatabase.d.ts +4 -2
  746. package/dist/ui/icons/MaterialSymbolsDatabase.js +6 -22
  747. package/dist/ui/icons/TableInsert.d.ts +4 -2
  748. package/dist/ui/icons/TableInsert.js +6 -12
  749. package/dist/ui/util/ImageBlurUrl.js +1 -1
  750. package/dist/ui.d.ts +0 -8
  751. package/dist/ui.js +0 -8
  752. package/package.json +49 -64
  753. package/dist/backend/router/Proxy.d.ts +0 -1
  754. package/dist/backend/router/Proxy.js +0 -32
  755. package/dist/chunks/chunk-2NTSADJL.js +0 -20
  756. package/dist/chunks/chunk-2STBQ2Y4.js +0 -166
  757. package/dist/chunks/chunk-2X5P2RZV.js +0 -94
  758. package/dist/chunks/chunk-3DIW62EI.js +0 -2900
  759. package/dist/chunks/chunk-3TNMMA3W.js +0 -249
  760. package/dist/chunks/chunk-467JA2PB.js +0 -29
  761. package/dist/chunks/chunk-5LTN67OE.js +0 -51
  762. package/dist/chunks/chunk-76QF5YTJ.js +0 -107
  763. package/dist/chunks/chunk-A5O3N2GS.js +0 -63
  764. package/dist/chunks/chunk-AICQFCVN.js +0 -19
  765. package/dist/chunks/chunk-AJJSW27C.js +0 -728
  766. package/dist/chunks/chunk-C53YJRET.js +0 -112
  767. package/dist/chunks/chunk-CKT37OYJ.js +0 -9
  768. package/dist/chunks/chunk-F2HHHLEQ.js +0 -72
  769. package/dist/chunks/chunk-FKWEJTSK.js +0 -16282
  770. package/dist/chunks/chunk-G2AFWRAD.js +0 -12
  771. package/dist/chunks/chunk-HSIHEWFC.js +0 -101
  772. package/dist/chunks/chunk-I26ZIF6Q.js +0 -360
  773. package/dist/chunks/chunk-JL5K3F7X.js +0 -1116
  774. package/dist/chunks/chunk-NZLE2WMY.js +0 -35
  775. package/dist/chunks/chunk-ORDS5C6Z.js +0 -83
  776. package/dist/chunks/chunk-PNILF4WM.js +0 -251
  777. package/dist/chunks/chunk-QUIANN6B.js +0 -8001
  778. package/dist/chunks/chunk-RSX2DILK.js +0 -335
  779. package/dist/chunks/chunk-SKF4L7JN.js +0 -401
  780. package/dist/chunks/chunk-SOTBYUJY.js +0 -120
  781. package/dist/chunks/chunk-TOJF2G3X.js +0 -96
  782. package/dist/chunks/chunk-TPUTTEHF.js +0 -3002
  783. package/dist/chunks/chunk-VUACWPFC.js +0 -892
  784. package/dist/chunks/chunk-WD7H5L2L.js +0 -168
  785. package/dist/chunks/chunk-WDCPVJJC.js +0 -341
  786. package/dist/chunks/chunk-WJ67RR7S.js +0 -554
  787. package/dist/chunks/chunk-WKC37UOZ.js +0 -143
  788. package/dist/chunks/chunk-WLKPH7JA.js +0 -2786
  789. package/dist/chunks/chunk-YWCPLD22.js +0 -2343
  790. package/dist/chunks/crypto-HZTUU327.js +0 -11
  791. package/dist/cli/util/ExternalPlugin.d.ts +0 -2
  792. package/dist/cli/util/ExternalPlugin.js +0 -810
  793. package/dist/cloud/view/CloudAuth.browser.d.ts +0 -2
  794. package/dist/cloud/view/CloudAuth.browser.js +0 -111
  795. package/dist/cloud/view/CloudAuth.d.ts +0 -1
  796. package/dist/cloud/view/CloudAuth.js +0 -9
  797. package/dist/core/Doc.d.ts +0 -11
  798. package/dist/core/Doc.js +0 -44
  799. package/dist/core/Role.test.d.ts +0 -1
  800. package/dist/core/Shape.d.ts +0 -19
  801. package/dist/core/Trigger.test.d.ts +0 -1
  802. package/dist/core/Type.test.d.ts +0 -1
  803. package/dist/core/db/EntryIndex.test.d.ts +0 -1
  804. package/dist/core/db/EntryResolver.test.d.ts +0 -1
  805. package/dist/core/db/LocalDB.test.d.ts +0 -1
  806. package/dist/core/field/RichTextField.test.d.ts +0 -1
  807. package/dist/core/shape/ListShape.test.d.ts +0 -1
  808. package/dist/core/shape/RecordShape.d.ts +0 -26
  809. package/dist/core/shape/RecordShape.js +0 -102
  810. package/dist/core/shape/RecordShape.test.d.ts +0 -1
  811. package/dist/core/shape/RichTextShape.d.ts +0 -75
  812. package/dist/core/shape/RichTextShape.js +0 -435
  813. package/dist/core/shape/RichTextShape.test.d.ts +0 -1
  814. package/dist/core/shape/ScalarShape.d.ts +0 -20
  815. package/dist/core/shape/ScalarShape.js +0 -53
  816. package/dist/core/shape/ScalarShape.test.d.ts +0 -1
  817. package/dist/core/shape/UnionShape.d.ts +0 -34
  818. package/dist/core/shape/UnionShape.js +0 -141
  819. package/dist/core/shape/UnionShape.test.d.ts +0 -1
  820. package/dist/core/source/CombinedSource.test.d.ts +0 -1
  821. package/dist/core/source/FSSource.test.d.ts +0 -1
  822. package/dist/core/source/FilePatch.test.d.ts +0 -1
  823. package/dist/core/source/GitDelta.test.d.ts +0 -1
  824. package/dist/core/source/GitUtils.test.d.ts +0 -1
  825. package/dist/core/source/GithubSource.test.d.ts +0 -1
  826. package/dist/core/source/IndexedDBSource.test.d.ts +0 -1
  827. package/dist/core/source/MemorySource.test.d.ts +0 -1
  828. package/dist/core/source/SourceExport.test.d.ts +0 -1
  829. package/dist/core/source/Tree.test.d.ts +0 -1
  830. package/dist/core/source/Utils.test.d.ts +0 -1
  831. package/dist/core/util/CodeGen.test.d.ts +0 -1
  832. package/dist/core/util/EntryFilenames.test.d.ts +0 -1
  833. package/dist/core/util/JWT.test.d.ts +0 -1
  834. package/dist/core/util/Paths.test.d.ts +0 -1
  835. package/dist/core/util/Slugs.test.d.ts +0 -1
  836. package/dist/dashboard/DashboardNav.d.ts +0 -22
  837. package/dist/dashboard/DashboardNav.js +0 -44
  838. package/dist/dashboard/DashboardProvider.d.ts +0 -16
  839. package/dist/dashboard/DashboardProvider.js +0 -28
  840. package/dist/dashboard/Routes.d.ts +0 -111
  841. package/dist/dashboard/Routes.js +0 -78
  842. package/dist/dashboard/Welcome.d.ts +0 -1
  843. package/dist/dashboard/Welcome.js +0 -21
  844. package/dist/dashboard/atoms/DashboardAtoms.d.ts +0 -18
  845. package/dist/dashboard/atoms/DashboardAtoms.js +0 -86
  846. package/dist/dashboard/atoms/DbAtoms.d.ts +0 -5
  847. package/dist/dashboard/atoms/DbAtoms.js +0 -95
  848. package/dist/dashboard/atoms/Edits.d.ts +0 -31
  849. package/dist/dashboard/atoms/Edits.js +0 -93
  850. package/dist/dashboard/atoms/EntryAtoms.d.ts +0 -34
  851. package/dist/dashboard/atoms/EntryAtoms.js +0 -298
  852. package/dist/dashboard/atoms/EntryEditorAtoms.d.ts +0 -255
  853. package/dist/dashboard/atoms/EntryEditorAtoms.js +0 -629
  854. package/dist/dashboard/atoms/EntrySummaryAtoms.d.ts +0 -21
  855. package/dist/dashboard/atoms/EntrySummaryAtoms.js +0 -58
  856. package/dist/dashboard/atoms/ErrorAtoms.d.ts +0 -4
  857. package/dist/dashboard/atoms/ErrorAtoms.js +0 -18
  858. package/dist/dashboard/atoms/FormAtoms.d.ts +0 -56
  859. package/dist/dashboard/atoms/FormAtoms.js +0 -189
  860. package/dist/dashboard/atoms/LocationAtoms.d.ts +0 -25
  861. package/dist/dashboard/atoms/LocationAtoms.js +0 -104
  862. package/dist/dashboard/atoms/NavigationAtoms.d.ts +0 -38
  863. package/dist/dashboard/atoms/NavigationAtoms.js +0 -124
  864. package/dist/dashboard/atoms/PolicyAtom.d.ts +0 -6
  865. package/dist/dashboard/atoms/PolicyAtom.js +0 -29
  866. package/dist/dashboard/atoms/PreferencesAtoms.d.ts +0 -16
  867. package/dist/dashboard/atoms/PreferencesAtoms.js +0 -53
  868. package/dist/dashboard/atoms/RouterAtoms.d.ts +0 -78
  869. package/dist/dashboard/atoms/RouterAtoms.js +0 -161
  870. package/dist/dashboard/atoms/StyleAtoms.d.ts +0 -1
  871. package/dist/dashboard/atoms/StyleAtoms.js +0 -14
  872. package/dist/dashboard/atoms/YAtom.d.ts +0 -2
  873. package/dist/dashboard/atoms/YAtom.js +0 -24
  874. package/dist/dashboard/editor/DefaultViews.d.ts +0 -19
  875. package/dist/dashboard/editor/DefaultViews.js +0 -52
  876. package/dist/dashboard/editor/InputForm.d.ts +0 -26
  877. package/dist/dashboard/editor/InputForm.js +0 -53
  878. package/dist/dashboard/editor/ViewKeys.d.ts +0 -23
  879. package/dist/dashboard/editor/ViewKeys.js +0 -29
  880. package/dist/dashboard/hook/UseConfig.d.ts +0 -1
  881. package/dist/dashboard/hook/UseConfig.js +0 -12
  882. package/dist/dashboard/hook/UseDashboard.d.ts +0 -1
  883. package/dist/dashboard/hook/UseDashboard.js +0 -12
  884. package/dist/dashboard/hook/UseDb.d.ts +0 -2
  885. package/dist/dashboard/hook/UseDb.js +0 -14
  886. package/dist/dashboard/hook/UseDebounce.d.ts +0 -1
  887. package/dist/dashboard/hook/UseDebounce.js +0 -23
  888. package/dist/dashboard/hook/UseEntryLocation.d.ts +0 -1
  889. package/dist/dashboard/hook/UseEntryLocation.js +0 -12
  890. package/dist/dashboard/hook/UseEntrySummary.d.ts +0 -1
  891. package/dist/dashboard/hook/UseEntrySummary.js +0 -16
  892. package/dist/dashboard/hook/UseExplorer.d.ts +0 -14
  893. package/dist/dashboard/hook/UseExplorer.js +0 -13
  894. package/dist/dashboard/hook/UseFocusList.d.ts +0 -14
  895. package/dist/dashboard/hook/UseFocusList.js +0 -113
  896. package/dist/dashboard/hook/UseNav.d.ts +0 -10
  897. package/dist/dashboard/hook/UseNav.js +0 -12
  898. package/dist/dashboard/hook/UsePolicy.d.ts +0 -1
  899. package/dist/dashboard/hook/UsePolicy.js +0 -14
  900. package/dist/dashboard/hook/UsePreferences.d.ts +0 -6
  901. package/dist/dashboard/hook/UsePreferences.js +0 -30
  902. package/dist/dashboard/hook/UseSession.d.ts +0 -1
  903. package/dist/dashboard/hook/UseSession.js +0 -12
  904. package/dist/dashboard/hook/UseUploads.d.ts +0 -42
  905. package/dist/dashboard/hook/UseUploads.js +0 -91
  906. package/dist/dashboard/pages/ContentView.d.ts +0 -5
  907. package/dist/dashboard/pages/ContentView.js +0 -96
  908. package/dist/dashboard/util/Atoms.d.ts +0 -2
  909. package/dist/dashboard/util/Atoms.js +0 -21
  910. package/dist/dashboard/util/DebounceAtom.d.ts +0 -2
  911. package/dist/dashboard/util/DebounceAtom.js +0 -26
  912. package/dist/dashboard/util/HashRouter.d.ts +0 -1
  913. package/dist/dashboard/util/HashRouter.js +0 -2
  914. package/dist/dashboard/util/Head.d.ts +0 -2
  915. package/dist/dashboard/util/Head.js +0 -10
  916. package/dist/dashboard/util/KeepInView.d.ts +0 -2
  917. package/dist/dashboard/util/KeepInView.js +0 -19
  918. package/dist/dashboard/util/KeepPreviousData.d.ts +0 -9
  919. package/dist/dashboard/util/KeepPreviousData.js +0 -32
  920. package/dist/dashboard/util/Loader.d.ts +0 -17
  921. package/dist/dashboard/util/Loader.js +0 -31
  922. package/dist/dashboard/util/SuspenseBoundary.d.ts +0 -4
  923. package/dist/dashboard/util/SuspenseBoundary.js +0 -23
  924. package/dist/dashboard/util/WithResolvers.d.ts +0 -2
  925. package/dist/dashboard/util/WithResolvers.js +0 -16
  926. package/dist/dashboard/view/AlineaLogo.d.ts +0 -2
  927. package/dist/dashboard/view/AlineaLogo.js +0 -16
  928. package/dist/dashboard/view/Breadcrumbs.d.ts +0 -3
  929. package/dist/dashboard/view/Breadcrumbs.js +0 -33
  930. package/dist/dashboard/view/Create.d.ts +0 -13
  931. package/dist/dashboard/view/Create.js +0 -75
  932. package/dist/dashboard/view/EntryEdit.d.ts +0 -5
  933. package/dist/dashboard/view/EntryEdit.js +0 -222
  934. package/dist/dashboard/view/EntryTree.d.ts +0 -5
  935. package/dist/dashboard/view/EntryTree.js +0 -1463
  936. package/dist/dashboard/view/ErrorBoundary.d.ts +0 -6
  937. package/dist/dashboard/view/ErrorBoundary.js +0 -95
  938. package/dist/dashboard/view/IconButton.d.ts +0 -18
  939. package/dist/dashboard/view/IconButton.js +0 -51
  940. package/dist/dashboard/view/InputLabel.d.ts +0 -36
  941. package/dist/dashboard/view/InputLabel.js +0 -151
  942. package/dist/dashboard/view/MediaExplorer.d.ts +0 -7
  943. package/dist/dashboard/view/MediaExplorer.js +0 -121
  944. package/dist/dashboard/view/Modal.d.ts +0 -8
  945. package/dist/dashboard/view/Modal.js +0 -63
  946. package/dist/dashboard/view/PageHeader.d.ts +0 -5
  947. package/dist/dashboard/view/PageHeader.js +0 -26
  948. package/dist/dashboard/view/Preview.d.ts +0 -3
  949. package/dist/dashboard/view/Preview.js +0 -20
  950. package/dist/dashboard/view/RootOverview.d.ts +0 -5
  951. package/dist/dashboard/view/RootOverview.js +0 -46
  952. package/dist/dashboard/view/SearchBox.d.ts +0 -1
  953. package/dist/dashboard/view/SearchBox.js +0 -126
  954. package/dist/dashboard/view/Sidebar.d.ts +0 -21
  955. package/dist/dashboard/view/Sidebar.js +0 -312
  956. package/dist/dashboard/view/Toolbar.d.ts +0 -9
  957. package/dist/dashboard/view/Toolbar.js +0 -240
  958. package/dist/dashboard/view/Viewport.d.ts +0 -8
  959. package/dist/dashboard/view/Viewport.js +0 -69
  960. package/dist/dashboard/view/WorkspaceLabel.d.ts +0 -7
  961. package/dist/dashboard/view/WorkspaceLabel.js +0 -32
  962. package/dist/dashboard/view/diff/ChangeBox.d.ts +0 -14
  963. package/dist/dashboard/view/diff/ChangeBox.js +0 -36
  964. package/dist/dashboard/view/diff/DiffUtils.d.ts +0 -16
  965. package/dist/dashboard/view/diff/DiffUtils.js +0 -82
  966. package/dist/dashboard/view/diff/DiffUtils.test.d.ts +0 -1
  967. package/dist/dashboard/view/diff/EntryDiff.d.ts +0 -6
  968. package/dist/dashboard/view/diff/EntryDiff.js +0 -45
  969. package/dist/dashboard/view/diff/FieldDiff.d.ts +0 -10
  970. package/dist/dashboard/view/diff/FieldDiff.js +0 -51
  971. package/dist/dashboard/view/diff/FieldsDiff.d.ts +0 -7
  972. package/dist/dashboard/view/diff/FieldsDiff.js +0 -24
  973. package/dist/dashboard/view/diff/ListDiff.d.ts +0 -10
  974. package/dist/dashboard/view/diff/ListDiff.js +0 -32
  975. package/dist/dashboard/view/diff/RichTextDiff.d.ts +0 -11
  976. package/dist/dashboard/view/diff/RichTextDiff.js +0 -94
  977. package/dist/dashboard/view/diff/ScalarDiff.d.ts +0 -5
  978. package/dist/dashboard/view/diff/ScalarDiff.js +0 -1520
  979. package/dist/dashboard/view/entry/EditModeToggle.d.ts +0 -9
  980. package/dist/dashboard/view/entry/EditModeToggle.js +0 -51
  981. package/dist/dashboard/view/entry/EntryHeader.d.ts +0 -5
  982. package/dist/dashboard/view/entry/EntryHeader.js +0 -414
  983. package/dist/dashboard/view/entry/EntryHistory.d.ts +0 -2
  984. package/dist/dashboard/view/entry/EntryHistory.js +0 -78
  985. package/dist/dashboard/view/entry/EntryNotice.d.ts +0 -7
  986. package/dist/dashboard/view/entry/EntryNotice.js +0 -44
  987. package/dist/dashboard/view/entry/EntryPreview.d.ts +0 -10
  988. package/dist/dashboard/view/entry/EntryPreview.js +0 -44
  989. package/dist/dashboard/view/entry/EntrySummary.d.ts +0 -3
  990. package/dist/dashboard/view/entry/EntrySummary.js +0 -75
  991. package/dist/dashboard/view/entry/EntryTitle.d.ts +0 -7
  992. package/dist/dashboard/view/entry/EntryTitle.js +0 -64
  993. package/dist/dashboard/view/entry/FieldToolbar.d.ts +0 -11
  994. package/dist/dashboard/view/entry/FieldToolbar.js +0 -41
  995. package/dist/dashboard/view/entry/LangSwitch.d.ts +0 -7
  996. package/dist/dashboard/view/entry/LangSwitch.js +0 -110
  997. package/dist/dashboard/view/entry/NewEntry.d.ts +0 -4
  998. package/dist/dashboard/view/entry/NewEntry.js +0 -288
  999. package/dist/dashboard/view/entry/RootHeader.d.ts +0 -4
  1000. package/dist/dashboard/view/entry/RootHeader.js +0 -61
  1001. package/dist/dashboard/view/explorer/Explorer.d.ts +0 -24
  1002. package/dist/dashboard/view/explorer/Explorer.js +0 -2230
  1003. package/dist/dashboard/view/explorer/ExplorerItem.d.ts +0 -11
  1004. package/dist/dashboard/view/explorer/ExplorerItem.js +0 -128
  1005. package/dist/dashboard/view/explorer/ExplorerRow.d.ts +0 -15
  1006. package/dist/dashboard/view/explorer/ExplorerRow.js +0 -73
  1007. package/dist/dashboard/view/media/CardOverview.d.ts +0 -1
  1008. package/dist/dashboard/view/media/CardOverview.js +0 -10
  1009. package/dist/dashboard/view/media/FileEntry.d.ts +0 -6
  1010. package/dist/dashboard/view/media/FileEntry.js +0 -223
  1011. package/dist/dashboard/view/media/FileSummary.d.ts +0 -3
  1012. package/dist/dashboard/view/media/FileSummary.js +0 -102
  1013. package/dist/dashboard/view/media/FileUploadRow.d.ts +0 -2
  1014. package/dist/dashboard/view/media/FileUploadRow.js +0 -53
  1015. package/dist/dashboard/view/media/FileUploader.d.ts +0 -10
  1016. package/dist/dashboard/view/media/FileUploader.js +0 -151
  1017. package/dist/dashboard/view/media/MediaThumbnail.d.ts +0 -11
  1018. package/dist/dashboard/view/media/MediaThumbnail.js +0 -55
  1019. package/dist/dashboard/view/preview/BrowserPreview.d.ts +0 -12
  1020. package/dist/dashboard/view/preview/BrowserPreview.js +0 -210
  1021. package/dist/dashboard/view/sidebar/SidebarSettings.d.ts +0 -1
  1022. package/dist/dashboard/view/sidebar/SidebarSettings.js +0 -192
  1023. package/dist/field/check/CheckField.stories.d.ts +0 -5
  1024. package/dist/field/code/CodeField.stories.d.ts +0 -5
  1025. package/dist/field/date/DateField.stories.d.ts +0 -5
  1026. package/dist/field/json/JsonField.stories.d.ts +0 -5
  1027. package/dist/field/metadata/MetadataField.stories.d.ts +0 -5
  1028. package/dist/field/number/NumberField.stories.d.ts +0 -5
  1029. package/dist/field/object/ObjectField.stories.d.ts +0 -5
  1030. package/dist/field/path/PathField.stories.d.ts +0 -5
  1031. package/dist/field/richtext/RichText.stories.d.ts +0 -5
  1032. package/dist/field/select/SelectField.stories.d.ts +0 -5
  1033. package/dist/field/tabs/Tabs.stories.d.ts +0 -5
  1034. package/dist/field/text/TextField.stories.d.ts +0 -5
  1035. package/dist/field/time/TimeField.stories.d.ts +0 -5
  1036. package/dist/picker/entry/EntryPicker.browser.d.ts +0 -7
  1037. package/dist/picker/entry/EntryPicker.browser.js +0 -373
  1038. package/dist/picker/entry/EntryPicker.stories.d.ts +0 -2
  1039. package/dist/picker/entry/EntryPickerRow.d.ts +0 -5
  1040. package/dist/picker/entry/EntryPickerRow.js +0 -24
  1041. package/dist/picker/url/UrlPicker.browser.d.ts +0 -6
  1042. package/dist/picker/url/UrlPicker.browser.js +0 -83
  1043. package/dist/picker/url/UrlPicker.stories.d.ts +0 -5
  1044. package/dist/picker/url/UrlPickerRow.d.ts +0 -5
  1045. package/dist/picker/url/UrlPickerRow.js +0 -38
  1046. package/dist/preview/ChunkCookieValue.test.d.ts +0 -1
  1047. package/dist/preview/PreviewPayload.test.d.ts +0 -1
  1048. package/dist/test/EntryFixture.d.ts +0 -30
  1049. package/dist/test/EntryFixture.js +0 -91
  1050. package/dist/test/broken-index.test.d.ts +0 -1
  1051. package/dist/test/cms.d.ts +0 -17
  1052. package/dist/test/cms.js +0 -38
  1053. package/dist/test/drafts.test.d.ts +0 -1
  1054. package/dist/test/example.d.ts +0 -137
  1055. package/dist/test/example.js +0 -230
  1056. package/dist/test/insert-order.test.d.ts +0 -1
  1057. package/dist/test/links.test.d.ts +0 -1
  1058. package/dist/test/locales.test.d.ts +0 -1
  1059. package/dist/test/moves.test.d.ts +0 -1
  1060. package/dist/test/mutate.test.d.ts +0 -1
  1061. package/dist/test/query.test.d.ts +0 -1
  1062. package/dist/test/renames.test.d.ts +0 -1
  1063. package/dist/test/roles.test.d.ts +0 -1
  1064. package/dist/test/schema/DemoHome.d.ts +0 -25
  1065. package/dist/test/schema/DemoHome.js +0 -25
  1066. package/dist/test/schema/DemoRecipe.d.ts +0 -14
  1067. package/dist/test/schema/DemoRecipe.js +0 -22
  1068. package/dist/test/schema/DemoRecipes.d.ts +0 -4
  1069. package/dist/test/schema/DemoRecipes.js +0 -14
  1070. package/dist/test/schema/index.d.ts +0 -3
  1071. package/dist/test/schema/index.js +0 -4
  1072. package/dist/test/seeding.test.d.ts +0 -1
  1073. package/dist/test/shared.test.d.ts +0 -1
  1074. package/dist/test/status.test.d.ts +0 -1
  1075. package/dist/test/uploads.test.d.ts +0 -1
  1076. package/dist/ui/AppBar.d.ts +0 -14
  1077. package/dist/ui/AppBar.js +0 -68
  1078. package/dist/ui/Avatar.d.ts +0 -6
  1079. package/dist/ui/Avatar.js +0 -33
  1080. package/dist/ui/Badge.d.ts +0 -9
  1081. package/dist/ui/Badge.js +0 -44
  1082. package/dist/ui/Button.d.ts +0 -9
  1083. package/dist/ui/Button.js +0 -57
  1084. package/dist/ui/Button.stories.d.ts +0 -6
  1085. package/dist/ui/Chip.d.ts +0 -8
  1086. package/dist/ui/Chip.js +0 -46
  1087. package/dist/ui/DropdownMenu.d.ts +0 -12
  1088. package/dist/ui/DropdownMenu.js +0 -415
  1089. package/dist/ui/Ellipsis.d.ts +0 -2
  1090. package/dist/ui/Ellipsis.js +0 -33
  1091. package/dist/ui/ErrorMessage.d.ts +0 -4
  1092. package/dist/ui/ErrorMessage.js +0 -17
  1093. package/dist/ui/Icon.d.ts +0 -9
  1094. package/dist/ui/Icon.js +0 -41
  1095. package/dist/ui/Lift.d.ts +0 -3
  1096. package/dist/ui/Lift.js +0 -22
  1097. package/dist/ui/Loader.d.ts +0 -8
  1098. package/dist/ui/Loader.js +0 -32
  1099. package/dist/ui/Main.d.ts +0 -12
  1100. package/dist/ui/Main.js +0 -56
  1101. package/dist/ui/Pane.d.ts +0 -9
  1102. package/dist/ui/Pane.js +0 -132
  1103. package/dist/ui/PopoverMenu.d.ts +0 -12
  1104. package/dist/ui/PopoverMenu.js +0 -418
  1105. package/dist/ui/Property.d.ts +0 -1
  1106. package/dist/ui/Property.js +0 -7
  1107. package/dist/ui/Sink.d.ts +0 -9
  1108. package/dist/ui/Sink.js +0 -49
  1109. package/dist/ui/Statusbar.d.ts +0 -15
  1110. package/dist/ui/Statusbar.js +0 -54
  1111. package/dist/ui/Tabs.d.ts +0 -11
  1112. package/dist/ui/Tabs.js +0 -293
  1113. package/dist/ui/TextLabel.d.ts +0 -5
  1114. package/dist/ui/TextLabel.js +0 -10
  1115. package/dist/ui/Typo.d.ts +0 -35
  1116. package/dist/ui/Typo.js +0 -28
  1117. package/dist/ui/UIStory.d.ts +0 -8
  1118. package/dist/ui/branding/FavIcon.d.ts +0 -5
  1119. package/dist/ui/branding/FavIcon.js +0 -56
  1120. package/dist/ui/branding/LogoShape.d.ts +0 -6
  1121. package/dist/ui/branding/LogoShape.js +0 -52
  1122. package/dist/ui/hook/UseAutoHide.d.ts +0 -8
  1123. package/dist/ui/hook/UseAutoHide.js +0 -43
  1124. package/dist/ui/hook/UseColorScheme.d.ts +0 -4
  1125. package/dist/ui/hook/UseColorScheme.js +0 -13
  1126. package/dist/ui/hook/UseContrastColor.d.ts +0 -1
  1127. package/dist/ui/hook/UseContrastColor.js +0 -12
  1128. package/dist/ui/hook/UseElementSize.d.ts +0 -6
  1129. package/dist/ui/hook/UseElementSize.js +0 -52
  1130. package/dist/ui/hook/UseForceUpdate.d.ts +0 -1
  1131. package/dist/ui/hook/UseForceUpdate.js +0 -11
  1132. package/dist/ui/hook/UseHash.d.ts +0 -1
  1133. package/dist/ui/hook/UseHash.js +0 -24
  1134. package/dist/ui/hook/UseInitialEffect.d.ts +0 -2
  1135. package/dist/ui/hook/UseInitialEffect.js +0 -15
  1136. package/dist/ui/hook/UseLocalStorage.d.ts +0 -1
  1137. package/dist/ui/hook/UseLocalStorage.js +0 -36
  1138. package/dist/ui/hook/UseNonInitialEffect.d.ts +0 -2
  1139. package/dist/ui/hook/UseNonInitialEffect.js +0 -17
  1140. package/dist/ui/hook/UseTrigger.d.ts +0 -7
  1141. package/dist/ui/hook/UseTrigger.js +0 -29
  1142. package/dist/ui/icons/IcAlignJustify.d.ts +0 -3
  1143. package/dist/ui/icons/IcAlignJustify.js +0 -18
  1144. package/dist/ui/icons/IcAlignLeft.d.ts +0 -2
  1145. package/dist/ui/icons/IcAlignLeft.js +0 -16
  1146. package/dist/ui/icons/IcAlignRight.d.ts +0 -2
  1147. package/dist/ui/icons/IcAlignRight.js +0 -16
  1148. package/dist/ui/icons/IcBaselineAccountCircle.d.ts +0 -2
  1149. package/dist/ui/icons/IcBaselineAccountCircle.js +0 -26
  1150. package/dist/ui/icons/IcBaselineContentCopy.d.ts +0 -2
  1151. package/dist/ui/icons/IcBaselineContentCopy.js +0 -26
  1152. package/dist/ui/icons/IcBaselineContentPasteGo.d.ts +0 -2
  1153. package/dist/ui/icons/IcBaselineContentPasteGo.js +0 -35
  1154. package/dist/ui/icons/IcBaselineDesktopMac.d.ts +0 -2
  1155. package/dist/ui/icons/IcBaselineDesktopMac.js +0 -16
  1156. package/dist/ui/icons/IcBaselineErrorOutline.d.ts +0 -2
  1157. package/dist/ui/icons/IcBaselineErrorOutline.js +0 -26
  1158. package/dist/ui/icons/IcBaselinePause.d.ts +0 -2
  1159. package/dist/ui/icons/IcBaselinePause.js +0 -20
  1160. package/dist/ui/icons/IcBaselinePhoneIphone.d.ts +0 -2
  1161. package/dist/ui/icons/IcBaselinePhoneIphone.js +0 -16
  1162. package/dist/ui/icons/IcBaselineWifiTethering.d.ts +0 -2
  1163. package/dist/ui/icons/IcBaselineWifiTethering.js +0 -26
  1164. package/dist/ui/icons/IcOutlineArchive.d.ts +0 -2
  1165. package/dist/ui/icons/IcOutlineArchive.js +0 -26
  1166. package/dist/ui/icons/IcOutlineArrowCircleRight.d.ts +0 -2
  1167. package/dist/ui/icons/IcOutlineArrowCircleRight.js +0 -16
  1168. package/dist/ui/icons/IcOutlineAvTimer.d.ts +0 -2
  1169. package/dist/ui/icons/IcOutlineAvTimer.js +0 -26
  1170. package/dist/ui/icons/IcOutlineCloudUpload.d.ts +0 -2
  1171. package/dist/ui/icons/IcOutlineCloudUpload.js +0 -26
  1172. package/dist/ui/icons/IcOutlineDarkMode.d.ts +0 -2
  1173. package/dist/ui/icons/IcOutlineDarkMode.js +0 -16
  1174. package/dist/ui/icons/IcOutlineDescription.d.ts +0 -2
  1175. package/dist/ui/icons/IcOutlineDescription.js +0 -26
  1176. package/dist/ui/icons/IcOutlineDrafts.d.ts +0 -2
  1177. package/dist/ui/icons/IcOutlineDrafts.js +0 -26
  1178. package/dist/ui/icons/IcOutlineFolder.d.ts +0 -2
  1179. package/dist/ui/icons/IcOutlineFolder.js +0 -26
  1180. package/dist/ui/icons/IcOutlineInsertDriveFile.d.ts +0 -2
  1181. package/dist/ui/icons/IcOutlineInsertDriveFile.js +0 -26
  1182. package/dist/ui/icons/IcOutlineKeyboardTab.d.ts +0 -2
  1183. package/dist/ui/icons/IcOutlineKeyboardTab.js +0 -26
  1184. package/dist/ui/icons/IcOutlineLightMode.d.ts +0 -2
  1185. package/dist/ui/icons/IcOutlineLightMode.js +0 -16
  1186. package/dist/ui/icons/IcOutlineList.d.ts +0 -3
  1187. package/dist/ui/icons/IcOutlineList.js +0 -18
  1188. package/dist/ui/icons/IcOutlineLock.d.ts +0 -2
  1189. package/dist/ui/icons/IcOutlineLock.js +0 -26
  1190. package/dist/ui/icons/IcOutlineMoreHoriz.d.ts +0 -3
  1191. package/dist/ui/icons/IcOutlineMoreHoriz.js +0 -18
  1192. package/dist/ui/icons/IcOutlinePreview.d.ts +0 -2
  1193. package/dist/ui/icons/IcOutlinePreview.js +0 -16
  1194. package/dist/ui/icons/IcOutlineRemoveRedEye.d.ts +0 -2
  1195. package/dist/ui/icons/IcOutlineRemoveRedEye.js +0 -26
  1196. package/dist/ui/icons/IcOutlineScreenshot.d.ts +0 -2
  1197. package/dist/ui/icons/IcOutlineScreenshot.js +0 -16
  1198. package/dist/ui/icons/IcOutlineTableRows.d.ts +0 -2
  1199. package/dist/ui/icons/IcOutlineTableRows.js +0 -26
  1200. package/dist/ui/icons/IcRoundAdd.d.ts +0 -2
  1201. package/dist/ui/icons/IcRoundAdd.js +0 -16
  1202. package/dist/ui/icons/IcRoundAddCircle.d.ts +0 -3
  1203. package/dist/ui/icons/IcRoundAddCircle.js +0 -18
  1204. package/dist/ui/icons/IcRoundAddCircleOutline.d.ts +0 -2
  1205. package/dist/ui/icons/IcRoundAddCircleOutline.js +0 -16
  1206. package/dist/ui/icons/IcRoundArchive.d.ts +0 -2
  1207. package/dist/ui/icons/IcRoundArchive.js +0 -16
  1208. package/dist/ui/icons/IcRoundArrowBack.d.ts +0 -2
  1209. package/dist/ui/icons/IcRoundArrowBack.js +0 -16
  1210. package/dist/ui/icons/IcRoundArrowDownward.d.ts +0 -2
  1211. package/dist/ui/icons/IcRoundArrowDownward.js +0 -26
  1212. package/dist/ui/icons/IcRoundArrowDropDown.d.ts +0 -3
  1213. package/dist/ui/icons/IcRoundArrowDropDown.js +0 -18
  1214. package/dist/ui/icons/IcRoundArrowDropDownCircle.d.ts +0 -3
  1215. package/dist/ui/icons/IcRoundArrowDropDownCircle.js +0 -18
  1216. package/dist/ui/icons/IcRoundArrowDropUp.d.ts +0 -3
  1217. package/dist/ui/icons/IcRoundArrowDropUp.js +0 -18
  1218. package/dist/ui/icons/IcRoundArrowForward.d.ts +0 -2
  1219. package/dist/ui/icons/IcRoundArrowForward.js +0 -16
  1220. package/dist/ui/icons/IcRoundArrowUpward.d.ts +0 -2
  1221. package/dist/ui/icons/IcRoundArrowUpward.js +0 -26
  1222. package/dist/ui/icons/IcRoundAttachFile.d.ts +0 -2
  1223. package/dist/ui/icons/IcRoundAttachFile.js +0 -10
  1224. package/dist/ui/icons/IcRoundCheck.d.ts +0 -2
  1225. package/dist/ui/icons/IcRoundCheck.js +0 -16
  1226. package/dist/ui/icons/IcRoundCheckBox.d.ts +0 -2
  1227. package/dist/ui/icons/IcRoundCheckBox.js +0 -16
  1228. package/dist/ui/icons/IcRoundCheckBoxOutlineBlank.d.ts +0 -2
  1229. package/dist/ui/icons/IcRoundCheckBoxOutlineBlank.js +0 -16
  1230. package/dist/ui/icons/IcRoundChevronRight.d.ts +0 -2
  1231. package/dist/ui/icons/IcRoundChevronRight.js +0 -26
  1232. package/dist/ui/icons/IcRoundDescription.d.ts +0 -2
  1233. package/dist/ui/icons/IcRoundDescription.js +0 -26
  1234. package/dist/ui/icons/IcRoundDragHandle.d.ts +0 -3
  1235. package/dist/ui/icons/IcRoundDragHandle.js +0 -18
  1236. package/dist/ui/icons/IcRoundExitToApp.d.ts +0 -2
  1237. package/dist/ui/icons/IcRoundExitToApp.js +0 -26
  1238. package/dist/ui/icons/IcRoundFeed.d.ts +0 -2
  1239. package/dist/ui/icons/IcRoundFeed.js +0 -16
  1240. package/dist/ui/icons/IcRoundFormatBold.d.ts +0 -3
  1241. package/dist/ui/icons/IcRoundFormatBold.js +0 -18
  1242. package/dist/ui/icons/IcRoundFormatClear.d.ts +0 -3
  1243. package/dist/ui/icons/IcRoundFormatClear.js +0 -18
  1244. package/dist/ui/icons/IcRoundFormatItalic.d.ts +0 -3
  1245. package/dist/ui/icons/IcRoundFormatItalic.js +0 -18
  1246. package/dist/ui/icons/IcRoundFormatListBulleted.d.ts +0 -3
  1247. package/dist/ui/icons/IcRoundFormatListBulleted.js +0 -18
  1248. package/dist/ui/icons/IcRoundFormatPaint.d.ts +0 -2
  1249. package/dist/ui/icons/IcRoundFormatPaint.js +0 -10
  1250. package/dist/ui/icons/IcRoundHamburger.d.ts +0 -3
  1251. package/dist/ui/icons/IcRoundHamburger.js +0 -18
  1252. package/dist/ui/icons/IcRoundHdrStrong.d.ts +0 -3
  1253. package/dist/ui/icons/IcRoundHdrStrong.js +0 -18
  1254. package/dist/ui/icons/IcRoundHorizontalRule.d.ts +0 -3
  1255. package/dist/ui/icons/IcRoundHorizontalRule.js +0 -19
  1256. package/dist/ui/icons/IcRoundInsertDriveFile.d.ts +0 -2
  1257. package/dist/ui/icons/IcRoundInsertDriveFile.js +0 -16
  1258. package/dist/ui/icons/IcRoundKeyboardArrowDown.d.ts +0 -2
  1259. package/dist/ui/icons/IcRoundKeyboardArrowDown.js +0 -16
  1260. package/dist/ui/icons/IcRoundKeyboardArrowLeft.d.ts +0 -3
  1261. package/dist/ui/icons/IcRoundKeyboardArrowLeft.js +0 -18
  1262. package/dist/ui/icons/IcRoundKeyboardArrowRight.d.ts +0 -2
  1263. package/dist/ui/icons/IcRoundKeyboardArrowRight.js +0 -16
  1264. package/dist/ui/icons/IcRoundKeyboardArrowUp.d.ts +0 -2
  1265. package/dist/ui/icons/IcRoundKeyboardArrowUp.js +0 -16
  1266. package/dist/ui/icons/IcRoundLanguage.d.ts +0 -2
  1267. package/dist/ui/icons/IcRoundLanguage.js +0 -16
  1268. package/dist/ui/icons/IcRoundLastPage.d.ts +0 -2
  1269. package/dist/ui/icons/IcRoundLastPage.js +0 -26
  1270. package/dist/ui/icons/IcRoundLock.d.ts +0 -3
  1271. package/dist/ui/icons/IcRoundLock.js +0 -18
  1272. package/dist/ui/icons/IcRoundMenu.d.ts +0 -2
  1273. package/dist/ui/icons/IcRoundMenu.js +0 -16
  1274. package/dist/ui/icons/IcRoundMoreHoriz.d.ts +0 -2
  1275. package/dist/ui/icons/IcRoundMoreHoriz.js +0 -16
  1276. package/dist/ui/icons/IcRoundMoreVert.d.ts +0 -2
  1277. package/dist/ui/icons/IcRoundMoreVert.js +0 -26
  1278. package/dist/ui/icons/IcRoundNorthEast.d.ts +0 -2
  1279. package/dist/ui/icons/IcRoundNorthEast.js +0 -16
  1280. package/dist/ui/icons/IcRoundNotes.d.ts +0 -2
  1281. package/dist/ui/icons/IcRoundNotes.js +0 -16
  1282. package/dist/ui/icons/IcRoundNumbers.d.ts +0 -2
  1283. package/dist/ui/icons/IcRoundNumbers.js +0 -16
  1284. package/dist/ui/icons/IcRoundPermMedia.d.ts +0 -2
  1285. package/dist/ui/icons/IcRoundPermMedia.js +0 -25
  1286. package/dist/ui/icons/IcRoundPublish.d.ts +0 -2
  1287. package/dist/ui/icons/IcRoundPublish.js +0 -16
  1288. package/dist/ui/icons/IcRoundPublishedWithChanges.d.ts +0 -2
  1289. package/dist/ui/icons/IcRoundPublishedWithChanges.js +0 -26
  1290. package/dist/ui/icons/IcRoundQuote.d.ts +0 -2
  1291. package/dist/ui/icons/IcRoundQuote.js +0 -16
  1292. package/dist/ui/icons/IcRoundRedo.d.ts +0 -3
  1293. package/dist/ui/icons/IcRoundRedo.js +0 -18
  1294. package/dist/ui/icons/IcRoundRemoveCircleOutline.d.ts +0 -2
  1295. package/dist/ui/icons/IcRoundRemoveCircleOutline.js +0 -16
  1296. package/dist/ui/icons/IcRoundRotateLeft.d.ts +0 -2
  1297. package/dist/ui/icons/IcRoundRotateLeft.js +0 -16
  1298. package/dist/ui/icons/IcRoundSend.d.ts +0 -2
  1299. package/dist/ui/icons/IcRoundSend.js +0 -26
  1300. package/dist/ui/icons/IcRoundSouthWest.d.ts +0 -2
  1301. package/dist/ui/icons/IcRoundSouthWest.js +0 -16
  1302. package/dist/ui/icons/IcRoundSubscript.d.ts +0 -2
  1303. package/dist/ui/icons/IcRoundSubscript.js +0 -26
  1304. package/dist/ui/icons/IcRoundSuperscript.d.ts +0 -2
  1305. package/dist/ui/icons/IcRoundSuperscript.js +0 -26
  1306. package/dist/ui/icons/IcRoundTabletMac.d.ts +0 -2
  1307. package/dist/ui/icons/IcRoundTabletMac.js +0 -16
  1308. package/dist/ui/icons/IcRoundTextFields.d.ts +0 -2
  1309. package/dist/ui/icons/IcRoundTextFields.js +0 -16
  1310. package/dist/ui/icons/IcRoundTranslate.d.ts +0 -2
  1311. package/dist/ui/icons/IcRoundTranslate.js +0 -26
  1312. package/dist/ui/icons/IcRoundUndo.d.ts +0 -3
  1313. package/dist/ui/icons/IcRoundUndo.js +0 -18
  1314. package/dist/ui/icons/IcRoundUnfoldLess.d.ts +0 -2
  1315. package/dist/ui/icons/IcRoundUnfoldLess.js +0 -26
  1316. package/dist/ui/icons/IcRoundUnfoldMore.d.ts +0 -2
  1317. package/dist/ui/icons/IcRoundUnfoldMore.js +0 -16
  1318. package/dist/ui/icons/IcRoundUploadFile.d.ts +0 -3
  1319. package/dist/ui/icons/IcRoundUploadFile.js +0 -18
  1320. package/dist/ui/icons/IcRoundVisibilityOff.d.ts +0 -2
  1321. package/dist/ui/icons/IcRoundVisibilityOff.js +0 -16
  1322. package/dist/ui/icons/IcRoundWarning.d.ts +0 -2
  1323. package/dist/ui/icons/IcRoundWarning.js +0 -16
  1324. package/dist/ui/icons/IcSharpBrightnessMedium.d.ts +0 -2
  1325. package/dist/ui/icons/IcSharpBrightnessMedium.js +0 -16
  1326. package/dist/ui/icons/IcSharpVerticalAlignCenter.d.ts +0 -2
  1327. package/dist/ui/icons/IcSharpVerticalAlignCenter.js +0 -16
  1328. package/dist/ui/icons/IcTwotoneDescription.d.ts +0 -2
  1329. package/dist/ui/icons/IcTwotoneDescription.js +0 -37
  1330. package/dist/ui/icons/IcTwotoneFolder.d.ts +0 -2
  1331. package/dist/ui/icons/IcTwotoneFolder.js +0 -37
  1332. package/dist/ui/icons/IcTwotoneInsertDriveFile.d.ts +0 -2
  1333. package/dist/ui/icons/IcTwotoneInsertDriveFile.js +0 -30
  1334. package/dist/ui/icons/MdiGithub.d.ts +0 -3
  1335. package/dist/ui/icons/MdiGithub.js +0 -18
  1336. package/dist/ui/icons/MdiSourceBranch.d.ts +0 -2
  1337. package/dist/ui/icons/MdiSourceBranch.js +0 -16
  1338. package/dist/ui/icons/MdiTwitterCircle.d.ts +0 -2
  1339. package/dist/ui/icons/MdiTwitterCircle.js +0 -26
  1340. package/dist/ui/icons/MiLayers.d.ts +0 -3
  1341. package/dist/ui/icons/MiLayers.js +0 -16
  1342. package/dist/ui/icons/PhGlobe.d.ts +0 -2
  1343. package/dist/ui/icons/PhGlobe.js +0 -26
  1344. package/dist/ui/icons/RiFlashlightFill.d.ts +0 -2
  1345. package/dist/ui/icons/RiFlashlightFill.js +0 -10
  1346. package/dist/ui/icons/TableDelete.d.ts +0 -2
  1347. package/dist/ui/icons/TableDelete.js +0 -25
  1348. package/dist/ui/icons/TableDeleteColumn.d.ts +0 -2
  1349. package/dist/ui/icons/TableDeleteColumn.js +0 -16
  1350. package/dist/ui/icons/TableDeleteRow.d.ts +0 -2
  1351. package/dist/ui/icons/TableDeleteRow.js +0 -16
  1352. package/dist/ui/icons/TableHeaderCell.d.ts +0 -2
  1353. package/dist/ui/icons/TableHeaderCell.js +0 -16
  1354. package/dist/ui/icons/TableHeaderColumn.d.ts +0 -2
  1355. package/dist/ui/icons/TableHeaderColumn.js +0 -16
  1356. package/dist/ui/icons/TableHeaderRow.d.ts +0 -2
  1357. package/dist/ui/icons/TableHeaderRow.js +0 -16
  1358. package/dist/ui/icons/TableInsertColumnAfter.d.ts +0 -2
  1359. package/dist/ui/icons/TableInsertColumnAfter.js +0 -16
  1360. package/dist/ui/icons/TableInsertColumnBefore.d.ts +0 -2
  1361. package/dist/ui/icons/TableInsertColumnBefore.js +0 -16
  1362. package/dist/ui/icons/TableInsertRowAfter.d.ts +0 -2
  1363. package/dist/ui/icons/TableInsertRowAfter.js +0 -16
  1364. package/dist/ui/icons/TableInsertRowBefore.d.ts +0 -2
  1365. package/dist/ui/icons/TableInsertRowBefore.js +0 -16
  1366. package/dist/ui/icons/TableMergeCells.d.ts +0 -2
  1367. package/dist/ui/icons/TableMergeCells.js +0 -16
  1368. package/dist/ui/icons/TableSplitCell.d.ts +0 -2
  1369. package/dist/ui/icons/TableSplitCell.js +0 -16
  1370. package/dist/ui/util/ContrastColor.d.ts +0 -1
  1371. package/dist/ui/util/ContrastColor.js +0 -17
  1372. package/dist/ui/util/CreateTypo.d.ts +0 -62
  1373. package/dist/ui/util/CreateTypo.js +0 -119
  1374. package/dist/ui/util/Elevation.d.ts +0 -12
  1375. package/dist/ui/util/Elevation.js +0 -20
  1376. package/dist/ui/util/PropsWithAs.d.ts +0 -12
  1377. package/dist/ui/util/PropsWithAs.js +0 -10
  1378. package/dist/ui/util/Slots.d.ts +0 -11
  1379. package/dist/ui/util/Slots.js +0 -50
  1380. package/dist/ui/util/TextareaAutosize.d.ts +0 -2
  1381. package/dist/ui/util/TextareaAutosize.js +0 -40
  1382. package/dist/ui/util/Units.d.ts +0 -1
  1383. package/dist/ui/util/Units.js +0 -7
  1384. package/dist/ui/util/UseId.d.ts +0 -1
  1385. package/dist/ui/util/UseId.js +0 -11
  1386. package/dist/yjs.d.ts +0 -1
  1387. package/dist/yjs.js +0 -206
  1388. /package/dist/{core/Shape.js → chunks/chunk-NUFRM6SI.js} +0 -0
  1389. /package/dist/{backend/Handler.test.d.ts → dashboard/app/EntrySidebarPreview.spec.d.ts} +0 -0
  1390. /package/dist/{backend/router/Router.test.d.ts → dashboard/app/WorkspaceMenu.spec.d.ts} +0 -0
  1391. /package/dist/{cli/Init.test.d.ts → field/link/LinkField.spec.d.ts} +0 -0
  1392. /package/dist/{cli/util/CommitMessage.test.d.ts → field/list/ListField.spec.d.ts} +0 -0
  1393. /package/dist/{core/Config.test.d.ts → field/richtext/RichTextField.spec.d.ts} +0 -0
@@ -1,2496 +1,434 @@
1
1
  import {
2
- FloatingMenuPlugin
3
- } from "../../chunks/chunk-3DIW62EI.js";
2
+ EditorContent,
3
+ useEditor
4
+ } from "../../chunks/chunk-7ORQ7BYK.js";
5
+ import "../../chunks/chunk-TL7ZW6BX.js";
4
6
  import {
5
- Editor,
6
- Extension,
7
- Fragment,
8
- Node,
9
- NodeView,
10
- Plugin,
11
- PluginKey,
12
- Slice,
13
- TextSelection,
14
- getRenderedAttributes,
15
- mergeAttributes
16
- } from "../../chunks/chunk-FKWEJTSK.js";
7
+ useAtomValue,
8
+ useSetAtom,
9
+ useStore
10
+ } from "../../chunks/chunk-U4VOHNR2.js";
11
+ import "../../chunks/chunk-Y7XOMJOC.js";
12
+ import "../../chunks/chunk-RKDPDEF7.js";
17
13
  import {
18
14
  dist_default
19
- } from "../../chunks/chunk-A5O3N2GS.js";
15
+ } from "../../chunks/chunk-I4OYYAX5.js";
16
+ import "../../chunks/chunk-CQ52GEHY.js";
17
+
18
+ // src/field/richtext/RichTextField.view.tsx
19
+ import { Label } from "alinea/components";
20
+ import { createId } from "alinea/core/Id";
21
+ import { BlockNode, Node } from "alinea/core/TextDoc";
22
+ import { Type } from "alinea/core/Type";
23
+ import { isRecord } from "alinea/core/util/Objects";
24
+ import { rootEditor } from "alinea/dashboard/atoms/editor";
25
+ import {
26
+ useEditor as useDashboardEditor,
27
+ useFieldError,
28
+ useFieldNode,
29
+ useFieldOptions
30
+ } from "alinea/dashboard/hooks";
31
+ import {
32
+ configureRichTextExtensions
33
+ } from "./RichTextField.js";
34
+ import { PickTextLink, usePickTextLink } from "./PickTextLink.js";
20
35
  import {
21
- ContentFormat,
22
- ContentString,
23
- ContentType,
24
- Doc,
25
- Item,
26
- RelativePosition,
27
- Snapshot,
28
- UndoManager,
29
- YText,
30
- YXmlElement,
31
- YXmlText,
32
- applyUpdateV2,
33
- createAbsolutePositionFromRelativePosition,
34
- createDeleteSet,
35
- createID,
36
- createRelativePositionFromTypeIndex,
37
- createSnapshot,
38
- doc,
39
- findRootTypeKey,
40
- isBrowser,
41
- isDeleted,
42
- isParentOf,
43
- iterateDeletedStructs,
44
- keys,
45
- oneOf,
46
- snapshot,
47
- timeout,
48
- typeListToArraySnapshot
49
- } from "../../chunks/chunk-QUIANN6B.js";
36
+ useCallback,
37
+ useEffect,
38
+ useId,
39
+ useMemo,
40
+ useRef,
41
+ useState,
42
+ useSyncExternalStore
43
+ } from "react";
44
+ import { createPortal } from "react-dom";
45
+ import { RichTextBlock } from "./RichTextBlock.js";
50
46
  import {
51
- create,
52
- max,
53
- methodUnimplemented,
54
- min,
55
- unexpectedCase
56
- } from "../../chunks/chunk-AJJSW27C.js";
57
- import "../../chunks/chunk-NZLE2WMY.js";
47
+ richTextStructureAtom
48
+ } from "./RichTextBlocks.js";
49
+ import {
50
+ RichTextBlockHosts
51
+ } from "./RichTextBlockHost.js";
52
+ import { editorContent, editorNodes } from "./RichTextDocument.js";
53
+ import {
54
+ defaultExtensionConfig,
55
+ richTextBlockClipboard,
56
+ richTextBlockExtensions,
57
+ richTextDocumentExtension
58
+ } from "./RichTextExtensions.js";
59
+ import {
60
+ blockAttributes,
61
+ decodeBlockValue,
62
+ encodeBlockValue,
63
+ richTextBlockValueAttribute
64
+ } from "./RichTextBlockValue.js";
58
65
 
59
- // node_modules/lib0/mutex.js
60
- var createMutex = () => {
61
- let token = true;
62
- return (f, g) => {
63
- if (token) {
64
- token = false;
65
- try {
66
- f();
67
- } finally {
68
- token = true;
69
- }
70
- } else if (g !== void 0) {
71
- g();
72
- }
73
- };
66
+ // src/field/richtext/RichTextField.module.css
67
+ var RichTextField_default = {
68
+ "RichTextFieldView-unsupportedBlock": "alinea-RichTextFieldView-unsupportedBlock",
69
+ "RichTextFieldViewUnsupportedBlock": "alinea-RichTextFieldView-unsupportedBlock",
70
+ "RichTextFieldCompactView": "alinea-RichTextFieldCompactView",
71
+ "RichTextFieldView": "alinea-RichTextFieldView"
74
72
  };
75
73
 
76
- // node_modules/lib0/diff.js
77
- var highSurrogateRegex = /[\uD800-\uDBFF]/;
78
- var lowSurrogateRegex = /[\uDC00-\uDFFF]/;
79
- var simpleDiffString = (a, b) => {
80
- let left = 0;
81
- let right = 0;
82
- while (left < a.length && left < b.length && a[left] === b[left]) {
83
- left++;
84
- }
85
- if (left > 0 && highSurrogateRegex.test(a[left - 1])) left--;
86
- while (right + left < a.length && right + left < b.length && a[a.length - right - 1] === b[b.length - right - 1]) {
87
- right++;
88
- }
89
- if (right > 0 && lowSurrogateRegex.test(a[a.length - right])) right--;
90
- return {
91
- index: left,
92
- remove: a.length - left - right,
93
- insert: b.slice(left, b.length - right)
94
- };
95
- };
96
- var simpleDiff = simpleDiffString;
97
-
98
- // node_modules/y-prosemirror/src/plugins/keys.js
99
- var ySyncPluginKey = new PluginKey("y-sync");
100
- var yUndoPluginKey = new PluginKey("y-undo");
101
- var yCursorPluginKey = new PluginKey("yjs-cursor");
102
-
103
- // node_modules/y-prosemirror/src/plugins/sync-plugin.js
104
- var isVisible = (item, snapshot2) => snapshot2 === void 0 ? !item.deleted : snapshot2.sv.has(item.id.client) && /** @type {number} */
105
- snapshot2.sv.get(item.id.client) > item.id.clock && !isDeleted(snapshot2.ds, item.id);
106
- var defaultColors = [{ light: "#ecd44433", dark: "#ecd444" }];
107
- var getUserColor = (colorMapping, colors, user) => {
108
- if (!colorMapping.has(user)) {
109
- if (colorMapping.size < colors.length) {
110
- const usedColors = create();
111
- colorMapping.forEach((color) => usedColors.add(color));
112
- colors = colors.filter((color) => !usedColors.has(color));
113
- }
114
- colorMapping.set(user, oneOf(colors));
115
- }
116
- return (
117
- /** @type {ColorDef} */
118
- colorMapping.get(user)
74
+ // src/field/richtext/RichTextField.view.tsx
75
+ import { RichTextInsertMenu } from "./RichTextInsertMenu.js";
76
+ import { documentUpdateAtom } from "./RichTextState.js";
77
+ import { RichTextToolbar } from "./RichTextToolbar.js";
78
+ import { PickTextAnchor, usePickTextAnchor } from "./PickTextAnchor.js";
79
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
80
+ var styles = dist_default(RichTextField_default);
81
+ function RichTextFieldView({
82
+ field
83
+ }) {
84
+ const options = useFieldOptions(field);
85
+ const error = useFieldError(field);
86
+ const fieldNode = useFieldNode(field);
87
+ const store = useStore();
88
+ const { blocks, structure } = useAtomValue(
89
+ useMemo(() => richTextStructureAtom(fieldNode), [fieldNode])
119
90
  );
120
- };
121
- var ySyncPlugin = (yXmlFragment, {
122
- colors = defaultColors,
123
- colorMapping = /* @__PURE__ */ new Map(),
124
- permanentUserData = null,
125
- onFirstRender = () => {
126
- },
127
- mapping
128
- } = {}) => {
129
- let initialContentChanged = false;
130
- const binding = new ProsemirrorBinding(yXmlFragment, mapping);
131
- const plugin = new Plugin({
132
- props: {
133
- editable: (state) => {
134
- const syncState = ySyncPluginKey.getState(state);
135
- return syncState.snapshot == null && syncState.prevSnapshot == null;
136
- }
137
- },
138
- key: ySyncPluginKey,
139
- state: {
140
- /**
141
- * @returns {any}
142
- */
143
- init: (_initargs, _state) => {
144
- return {
145
- type: yXmlFragment,
146
- doc: yXmlFragment.doc,
147
- binding,
148
- snapshot: null,
149
- prevSnapshot: null,
150
- isChangeOrigin: false,
151
- isUndoRedoOperation: false,
152
- addToHistory: true,
153
- colors,
154
- colorMapping,
155
- permanentUserData
156
- };
157
- },
158
- apply: (tr, pluginState) => {
159
- const change = tr.getMeta(ySyncPluginKey);
160
- if (change !== void 0) {
161
- pluginState = Object.assign({}, pluginState);
162
- for (const key in change) {
163
- pluginState[key] = change[key];
164
- }
165
- }
166
- pluginState.addToHistory = tr.getMeta("addToHistory") !== false;
167
- pluginState.isChangeOrigin = change !== void 0 && !!change.isChangeOrigin;
168
- pluginState.isUndoRedoOperation = change !== void 0 && !!change.isChangeOrigin && !!change.isUndoRedoOperation;
169
- if (binding.prosemirrorView !== null) {
170
- if (change !== void 0 && (change.snapshot != null || change.prevSnapshot != null)) {
171
- timeout(0, () => {
172
- if (binding.prosemirrorView == null) {
173
- return;
174
- }
175
- if (change.restore == null) {
176
- binding._renderSnapshot(
177
- change.snapshot,
178
- change.prevSnapshot,
179
- pluginState
180
- );
181
- } else {
182
- binding._renderSnapshot(
183
- change.snapshot,
184
- change.snapshot,
185
- pluginState
186
- );
187
- delete pluginState.restore;
188
- delete pluginState.snapshot;
189
- delete pluginState.prevSnapshot;
190
- binding.mux(() => {
191
- binding._prosemirrorChanged(
192
- binding.prosemirrorView.state.doc
193
- );
194
- });
195
- }
196
- });
197
- }
198
- }
199
- return pluginState;
200
- }
201
- },
202
- view: (view) => {
203
- binding.initView(view);
204
- if (mapping == null) {
205
- binding._forceRerender();
206
- }
207
- onFirstRender();
208
- return {
209
- update: () => {
210
- const pluginState = plugin.getState(view.state);
211
- if (pluginState.snapshot == null && pluginState.prevSnapshot == null) {
212
- if (
213
- // If the content doesn't change initially, we don't render anything to Yjs
214
- // If the content was cleared by a user action, we want to catch the change and
215
- // represent it in Yjs
216
- initialContentChanged || view.state.doc.content.findDiffStart(
217
- view.state.doc.type.createAndFill().content
218
- ) !== null
219
- ) {
220
- initialContentChanged = true;
221
- if (pluginState.addToHistory === false && !pluginState.isChangeOrigin) {
222
- const yUndoPluginState = yUndoPluginKey.getState(view.state);
223
- const um = yUndoPluginState && yUndoPluginState.undoManager;
224
- if (um) {
225
- um.stopCapturing();
226
- }
227
- }
228
- binding.mux(() => {
229
- pluginState.doc.transact((tr) => {
230
- tr.meta.set("addToHistory", pluginState.addToHistory);
231
- binding._prosemirrorChanged(view.state.doc);
232
- }, ySyncPluginKey);
233
- });
234
- }
235
- }
236
- },
237
- destroy: () => {
238
- binding.destroy();
239
- }
240
- };
241
- }
242
- });
243
- return plugin;
244
- };
245
- var restoreRelativeSelection = (tr, relSel, binding) => {
246
- if (relSel !== null && relSel.anchor !== null && relSel.head !== null) {
247
- const anchor = relativePositionToAbsolutePosition(
248
- binding.doc,
249
- binding.type,
250
- relSel.anchor,
251
- binding.mapping
252
- );
253
- const head = relativePositionToAbsolutePosition(
254
- binding.doc,
255
- binding.type,
256
- relSel.head,
257
- binding.mapping
258
- );
259
- if (anchor !== null && head !== null) {
260
- tr = tr.setSelection(TextSelection.create(tr.doc, anchor, head));
261
- }
262
- }
263
- };
264
- var getRelativeSelection = (pmbinding, state) => ({
265
- anchor: absolutePositionToRelativePosition(
266
- state.selection.anchor,
267
- pmbinding.type,
268
- pmbinding.mapping
269
- ),
270
- head: absolutePositionToRelativePosition(
271
- state.selection.head,
272
- pmbinding.type,
273
- pmbinding.mapping
274
- )
275
- });
276
- var ProsemirrorBinding = class {
277
- /**
278
- * @param {Y.XmlFragment} yXmlFragment The bind source
279
- * @param {ProsemirrorMapping} mapping
280
- */
281
- constructor(yXmlFragment, mapping = /* @__PURE__ */ new Map()) {
282
- this.type = yXmlFragment;
283
- this.prosemirrorView = null;
284
- this.mux = createMutex();
285
- this.mapping = mapping;
286
- this._observeFunction = this._typeChanged.bind(this);
287
- this.doc = yXmlFragment.doc;
288
- this.beforeTransactionSelection = null;
289
- this.beforeAllTransactions = () => {
290
- if (this.beforeTransactionSelection === null && this.prosemirrorView != null) {
291
- this.beforeTransactionSelection = getRelativeSelection(
292
- this,
293
- this.prosemirrorView.state
294
- );
295
- }
296
- };
297
- this.afterAllTransactions = () => {
298
- this.beforeTransactionSelection = null;
299
- };
300
- this._domSelectionInView = null;
301
- }
302
- /**
303
- * Create a transaction for changing the prosemirror state.
304
- *
305
- * @returns
306
- */
307
- get _tr() {
308
- return this.prosemirrorView.state.tr.setMeta("addToHistory", false);
309
- }
310
- _isLocalCursorInView() {
311
- if (!this.prosemirrorView.hasFocus()) return false;
312
- if (isBrowser && this._domSelectionInView === null) {
313
- timeout(0, () => {
314
- this._domSelectionInView = null;
315
- });
316
- this._domSelectionInView = this._isDomSelectionInView();
317
- }
318
- return this._domSelectionInView;
319
- }
320
- _isDomSelectionInView() {
321
- const selection = this.prosemirrorView._root.getSelection();
322
- if (selection == null || selection.anchorNode == null) return false;
323
- const range = this.prosemirrorView._root.createRange();
324
- range.setStart(selection.anchorNode, selection.anchorOffset);
325
- range.setEnd(selection.focusNode, selection.focusOffset);
326
- const rects = range.getClientRects();
327
- if (rects.length === 0) {
328
- if (range.startContainer && range.collapsed) {
329
- range.selectNodeContents(range.startContainer);
330
- }
331
- }
332
- const bounding = range.getBoundingClientRect();
333
- const documentElement = doc.documentElement;
334
- return bounding.bottom >= 0 && bounding.right >= 0 && bounding.left <= (window.innerWidth || documentElement.clientWidth || 0) && bounding.top <= (window.innerHeight || documentElement.clientHeight || 0);
335
- }
336
- /**
337
- * @param {Y.Snapshot} snapshot
338
- * @param {Y.Snapshot} prevSnapshot
339
- */
340
- renderSnapshot(snapshot2, prevSnapshot) {
341
- if (!prevSnapshot) {
342
- prevSnapshot = createSnapshot(createDeleteSet(), /* @__PURE__ */ new Map());
343
- }
344
- this.prosemirrorView.dispatch(
345
- this._tr.setMeta(ySyncPluginKey, { snapshot: snapshot2, prevSnapshot })
346
- );
347
- }
348
- unrenderSnapshot() {
349
- this.mapping.clear();
350
- this.mux(() => {
351
- const fragmentContent = this.type.toArray().map(
352
- (t) => createNodeFromYElement(
353
- /** @type {Y.XmlElement} */
354
- t,
355
- this.prosemirrorView.state.schema,
356
- this.mapping
357
- )
358
- ).filter((n) => n !== null);
359
- const tr = this._tr.replace(
360
- 0,
361
- this.prosemirrorView.state.doc.content.size,
362
- new Slice(Fragment.from(fragmentContent), 0, 0)
363
- );
364
- tr.setMeta(ySyncPluginKey, { snapshot: null, prevSnapshot: null });
365
- this.prosemirrorView.dispatch(tr);
366
- });
367
- }
368
- _forceRerender() {
369
- this.mapping.clear();
370
- this.mux(() => {
371
- const sel = this.beforeTransactionSelection !== null ? null : this.prosemirrorView.state.selection;
372
- const fragmentContent = this.type.toArray().map(
373
- (t) => createNodeFromYElement(
374
- /** @type {Y.XmlElement} */
375
- t,
376
- this.prosemirrorView.state.schema,
377
- this.mapping
378
- )
379
- ).filter((n) => n !== null);
380
- const tr = this._tr.replace(
381
- 0,
382
- this.prosemirrorView.state.doc.content.size,
383
- new Slice(Fragment.from(fragmentContent), 0, 0)
384
- );
385
- if (sel) {
386
- const clampedAnchor = min(max(sel.anchor, 0), tr.doc.content.size);
387
- const clampedHead = min(max(sel.head, 0), tr.doc.content.size);
388
- tr.setSelection(TextSelection.create(tr.doc, clampedAnchor, clampedHead));
389
- }
390
- this.prosemirrorView.dispatch(
391
- tr.setMeta(ySyncPluginKey, { isChangeOrigin: true, binding: this })
392
- );
393
- });
394
- }
395
- /**
396
- * @param {Y.Snapshot|Uint8Array} snapshot
397
- * @param {Y.Snapshot|Uint8Array} prevSnapshot
398
- * @param {Object} pluginState
399
- */
400
- _renderSnapshot(snapshot2, prevSnapshot, pluginState) {
401
- let historyDoc = this.doc;
402
- if (!snapshot2) {
403
- snapshot2 = snapshot(this.doc);
404
- }
405
- if (snapshot2 instanceof Uint8Array || prevSnapshot instanceof Uint8Array) {
406
- if (!(snapshot2 instanceof Uint8Array) || !(prevSnapshot instanceof Uint8Array)) {
407
- unexpectedCase();
408
- }
409
- historyDoc = new Doc({ gc: false });
410
- applyUpdateV2(historyDoc, prevSnapshot);
411
- prevSnapshot = snapshot(historyDoc);
412
- applyUpdateV2(historyDoc, snapshot2);
413
- snapshot2 = snapshot(historyDoc);
414
- }
415
- this.mapping.clear();
416
- this.mux(() => {
417
- historyDoc.transact((transaction) => {
418
- const pud = pluginState.permanentUserData;
419
- if (pud) {
420
- pud.dss.forEach((ds) => {
421
- iterateDeletedStructs(transaction, ds, (_item) => {
422
- });
423
- });
424
- }
425
- const computeYChange = (type, id) => {
426
- const user = type === "added" ? pud.getUserByClientId(id.client) : pud.getUserByDeletedId(id);
427
- return {
428
- user,
429
- type,
430
- color: getUserColor(
431
- pluginState.colorMapping,
432
- pluginState.colors,
433
- user
434
- )
435
- };
436
- };
437
- const fragmentContent = typeListToArraySnapshot(
438
- this.type,
439
- new Snapshot(prevSnapshot.ds, snapshot2.sv)
440
- ).map((t) => {
441
- if (!t._item.deleted || isVisible(t._item, snapshot2) || isVisible(t._item, prevSnapshot)) {
442
- return createNodeFromYElement(
443
- t,
444
- this.prosemirrorView.state.schema,
445
- /* @__PURE__ */ new Map(),
446
- snapshot2,
447
- prevSnapshot,
448
- computeYChange
449
- );
450
- } else {
451
- return null;
452
- }
453
- }).filter((n) => n !== null);
454
- const tr = this._tr.replace(
455
- 0,
456
- this.prosemirrorView.state.doc.content.size,
457
- new Slice(Fragment.from(fragmentContent), 0, 0)
458
- );
459
- this.prosemirrorView.dispatch(
460
- tr.setMeta(ySyncPluginKey, { isChangeOrigin: true })
461
- );
462
- }, ySyncPluginKey);
463
- });
464
- }
465
- /**
466
- * @param {Array<Y.YEvent<any>>} events
467
- * @param {Y.Transaction} transaction
468
- */
469
- _typeChanged(events, transaction) {
470
- if (this.prosemirrorView == null) return;
471
- const syncState = ySyncPluginKey.getState(this.prosemirrorView.state);
472
- if (events.length === 0 || syncState.snapshot != null || syncState.prevSnapshot != null) {
473
- this.renderSnapshot(syncState.snapshot, syncState.prevSnapshot);
474
- return;
475
- }
476
- this.mux(() => {
477
- const delType = (_, type) => this.mapping.delete(type);
478
- iterateDeletedStructs(
479
- transaction,
480
- transaction.deleteSet,
481
- (struct) => {
482
- if (struct.constructor === Item) {
483
- const type = (
484
- /** @type {Y.ContentType} */
485
- /** @type {Y.Item} */
486
- struct.content.type
487
- );
488
- type && this.mapping.delete(type);
489
- }
490
- }
491
- );
492
- transaction.changed.forEach(delType);
493
- transaction.changedParentTypes.forEach(delType);
494
- const fragmentContent = this.type.toArray().map(
495
- (t) => createNodeIfNotExists(
496
- /** @type {Y.XmlElement | Y.XmlHook} */
497
- t,
498
- this.prosemirrorView.state.schema,
499
- this.mapping
500
- )
501
- ).filter((n) => n !== null);
502
- let tr = this._tr.replace(
503
- 0,
504
- this.prosemirrorView.state.doc.content.size,
505
- new Slice(Fragment.from(fragmentContent), 0, 0)
506
- );
507
- restoreRelativeSelection(tr, this.beforeTransactionSelection, this);
508
- tr = tr.setMeta(ySyncPluginKey, { isChangeOrigin: true, isUndoRedoOperation: transaction.origin instanceof UndoManager });
509
- if (this.beforeTransactionSelection !== null && this._isLocalCursorInView()) {
510
- tr.scrollIntoView();
511
- }
512
- this.prosemirrorView.dispatch(tr);
513
- });
514
- }
515
- _prosemirrorChanged(doc2) {
516
- this.doc.transact(() => {
517
- updateYFragment(this.doc, this.type, doc2, this.mapping);
518
- this.beforeTransactionSelection = getRelativeSelection(
519
- this,
520
- this.prosemirrorView.state
521
- );
522
- }, ySyncPluginKey);
523
- }
524
- /**
525
- * View is ready to listen to changes. Register observers.
526
- * @param {any} prosemirrorView
527
- */
528
- initView(prosemirrorView) {
529
- if (this.prosemirrorView != null) this.destroy();
530
- this.prosemirrorView = prosemirrorView;
531
- this.doc.on("beforeAllTransactions", this.beforeAllTransactions);
532
- this.doc.on("afterAllTransactions", this.afterAllTransactions);
533
- this.type.observeDeep(this._observeFunction);
534
- }
535
- destroy() {
536
- if (this.prosemirrorView == null) return;
537
- this.prosemirrorView = null;
538
- this.type.unobserveDeep(this._observeFunction);
539
- this.doc.off("beforeAllTransactions", this.beforeAllTransactions);
540
- this.doc.off("afterAllTransactions", this.afterAllTransactions);
541
- }
542
- };
543
- var createNodeIfNotExists = (el, schema, mapping, snapshot2, prevSnapshot, computeYChange) => {
544
- const node = (
545
- /** @type {PModel.Node} */
546
- mapping.get(el)
91
+ const blocksById = useMemo(
92
+ () => new Map(blocks.map((block) => [block.id, block])),
93
+ [blocks]
547
94
  );
548
- if (node === void 0) {
549
- if (el instanceof YXmlElement) {
550
- return createNodeFromYElement(
551
- el,
552
- schema,
553
- mapping,
554
- snapshot2,
555
- prevSnapshot,
556
- computeYChange
557
- );
558
- } else {
559
- throw methodUnimplemented();
560
- }
561
- }
562
- return node;
563
- };
564
- var createNodeFromYElement = (el, schema, mapping, snapshot2, prevSnapshot, computeYChange) => {
565
- const children = [];
566
- const createChildren = (type) => {
567
- if (type.constructor === YXmlElement) {
568
- const n = createNodeIfNotExists(
569
- type,
570
- schema,
571
- mapping,
572
- snapshot2,
573
- prevSnapshot,
574
- computeYChange
575
- );
576
- if (n !== null) {
577
- children.push(n);
578
- }
579
- } else {
580
- const nextytext = type._item.right?.content.type;
581
- if (nextytext instanceof YText && !nextytext._item.deleted && nextytext._item.id.client === nextytext.doc.clientID) {
582
- type.applyDelta([
583
- { retain: type.length },
584
- ...nextytext.toDelta()
585
- ]);
586
- nextytext.doc.transact((tr) => {
587
- nextytext._item.delete(tr);
588
- });
589
- }
590
- const ns = createTextNodesFromYText(
591
- type,
592
- schema,
593
- mapping,
594
- snapshot2,
595
- prevSnapshot,
596
- computeYChange
597
- );
598
- if (ns !== null) {
599
- ns.forEach((textchild) => {
600
- if (textchild !== null) {
601
- children.push(textchild);
602
- }
603
- });
604
- }
605
- }
606
- };
607
- if (snapshot2 === void 0 || prevSnapshot === void 0) {
608
- el.toArray().forEach(createChildren);
609
- } else {
610
- typeListToArraySnapshot(el, new Snapshot(prevSnapshot.ds, snapshot2.sv)).forEach(createChildren);
611
- }
612
- try {
613
- const attrs = el.getAttributes(snapshot2);
614
- if (snapshot2 !== void 0) {
615
- if (!isVisible(
616
- /** @type {Y.Item} */
617
- el._item,
618
- snapshot2
619
- )) {
620
- attrs.ychange = computeYChange ? computeYChange(
621
- "removed",
622
- /** @type {Y.Item} */
623
- el._item.id
624
- ) : { type: "removed" };
625
- } else if (!isVisible(
626
- /** @type {Y.Item} */
627
- el._item,
628
- prevSnapshot
629
- )) {
630
- attrs.ychange = computeYChange ? computeYChange(
631
- "added",
632
- /** @type {Y.Item} */
633
- el._item.id
634
- ) : { type: "added" };
635
- }
636
- }
637
- const node = schema.node(el.nodeName, attrs, children);
638
- mapping.set(el, node);
639
- return node;
640
- } catch (e) {
641
- el.doc.transact((transaction) => {
642
- el._item.delete(transaction);
643
- }, ySyncPluginKey);
644
- mapping.delete(el);
645
- return null;
646
- }
647
- };
648
- var createTextNodesFromYText = (text, schema, _mapping, snapshot2, prevSnapshot, computeYChange) => {
649
- const nodes = [];
650
- const deltas = text.toDelta(snapshot2, prevSnapshot, computeYChange);
651
- try {
652
- for (let i = 0; i < deltas.length; i++) {
653
- const delta = deltas[i];
654
- const marks = [];
655
- for (const markName in delta.attributes) {
656
- marks.push(schema.mark(markName, delta.attributes[markName]));
657
- }
658
- nodes.push(schema.text(delta.insert, marks));
659
- }
660
- } catch (e) {
661
- text.doc.transact((transaction) => {
662
- text._item.delete(transaction);
663
- }, ySyncPluginKey);
664
- return null;
665
- }
666
- return nodes;
667
- };
668
- var createTypeFromTextNodes = (nodes, mapping) => {
669
- const type = new YXmlText();
670
- const delta = nodes.map((node) => ({
671
- // @ts-ignore
672
- insert: node.text,
673
- attributes: marksToAttributes(node.marks)
674
- }));
675
- type.applyDelta(delta);
676
- mapping.set(type, nodes);
677
- return type;
678
- };
679
- var createTypeFromElementNode = (node, mapping) => {
680
- const type = new YXmlElement(node.type.name);
681
- for (const key in node.attrs) {
682
- const val = node.attrs[key];
683
- if (val !== null && key !== "ychange") {
684
- type.setAttribute(key, val);
685
- }
686
- }
687
- type.insert(
688
- 0,
689
- normalizePNodeContent(node).map(
690
- (n) => createTypeFromTextOrElementNode(n, mapping)
691
- )
95
+ const blocksByIdRef = useRef(blocksById);
96
+ blocksByIdRef.current = blocksById;
97
+ const lastEditorDocument = useRef();
98
+ const pendingExternalDocument = useRef();
99
+ const documentKey = documentStructureKey(structure);
100
+ if (lastEditorDocument.current && lastEditorDocument.current !== documentKey)
101
+ pendingExternalDocument.current = documentKey;
102
+ const updateDocument = useSetAtom(
103
+ useMemo(() => documentUpdateAtom(fieldNode), [fieldNode])
692
104
  );
693
- mapping.set(type, node);
694
- return type;
695
- };
696
- var createTypeFromTextOrElementNode = (node, mapping) => node instanceof Array ? createTypeFromTextNodes(node, mapping) : createTypeFromElementNode(node, mapping);
697
- var isObject = (val) => typeof val === "object" && val !== null;
698
- var equalAttrs = (pattrs, yattrs) => {
699
- const keys2 = Object.keys(pattrs).filter((key) => pattrs[key] !== null);
700
- let eq = keys2.length === Object.keys(yattrs).filter((key) => yattrs[key] !== null).length;
701
- for (let i = 0; i < keys2.length && eq; i++) {
702
- const key = keys2[i];
703
- const l = pattrs[key];
704
- const r = yattrs[key];
705
- eq = key === "ychange" || l === r || isObject(l) && isObject(r) && equalAttrs(l, r);
706
- }
707
- return eq;
708
- };
709
- var normalizePNodeContent = (pnode) => {
710
- const c = pnode.content.content;
711
- const res = [];
712
- for (let i = 0; i < c.length; i++) {
713
- const n = c[i];
714
- if (n.isText) {
715
- const textNodes = [];
716
- for (let tnode = c[i]; i < c.length && tnode.isText; tnode = c[++i]) {
717
- textNodes.push(tnode);
718
- }
719
- i--;
720
- res.push(textNodes);
721
- } else {
722
- res.push(n);
723
- }
724
- }
725
- return res;
726
- };
727
- var equalYTextPText = (ytext, ptexts) => {
728
- const delta = ytext.toDelta();
729
- return delta.length === ptexts.length && delta.every(
730
- (d, i) => d.insert === /** @type {any} */
731
- ptexts[i].text && keys(d.attributes || {}).length === ptexts[i].marks.length && ptexts[i].marks.every(
732
- (mark) => equalAttrs(d.attributes[mark.type.name] || {}, mark.attrs)
733
- )
105
+ const hosts = useMemo(() => new RichTextBlockHosts(), []);
106
+ const pendingBlocks = useRef(/* @__PURE__ */ new Map());
107
+ const [activeEditor, setActiveEditor] = useState();
108
+ const [focused, setFocused] = useState(false);
109
+ const [innerBlockFocused, setInnerBlockFocused] = useState(false);
110
+ const root = useRef(null);
111
+ const ownerId = useId();
112
+ const picker = usePickTextLink();
113
+ const anchorPicker = usePickTextAnchor();
114
+ const dashboardEditor = useDashboardEditor();
115
+ const entryAnchors = rootEditor(dashboardEditor).anchors;
116
+ const getEntryAnchors = useCallback(
117
+ () => store.get(entryAnchors).map((anchor) => anchor.id),
118
+ [entryAnchors, store]
734
119
  );
735
- };
736
- var equalYTypePNode = (ytype, pnode) => {
737
- if (ytype instanceof YXmlElement && !(pnode instanceof Array) && matchNodeName(ytype, pnode)) {
738
- const normalizedContent = normalizePNodeContent(pnode);
739
- return ytype._length === normalizedContent.length && equalAttrs(ytype.getAttributes(), pnode.attrs) && ytype.toArray().every(
740
- (ychild, i) => equalYTypePNode(ychild, normalizedContent[i])
120
+ const readOnly = Boolean(options.readOnly || fieldNode.readOnly);
121
+ const extensions = useMemo(() => {
122
+ const configured = Object.values(
123
+ configureRichTextExtensions(
124
+ options.extensions,
125
+ defaultExtensionConfig(getEntryAnchors)
126
+ )
741
127
  );
742
- }
743
- return ytype instanceof YXmlText && pnode instanceof Array && equalYTextPText(ytype, pnode);
744
- };
745
- var mappedIdentity = (mapped, pcontent) => mapped === pcontent || mapped instanceof Array && pcontent instanceof Array && mapped.length === pcontent.length && mapped.every(
746
- (a, i) => pcontent[i] === a
747
- );
748
- var computeChildEqualityFactor = (ytype, pnode, mapping) => {
749
- const yChildren = ytype.toArray();
750
- const pChildren = normalizePNodeContent(pnode);
751
- const pChildCnt = pChildren.length;
752
- const yChildCnt = yChildren.length;
753
- const minCnt = min(yChildCnt, pChildCnt);
754
- let left = 0;
755
- let right = 0;
756
- let foundMappedChild = false;
757
- for (; left < minCnt; left++) {
758
- const leftY = yChildren[left];
759
- const leftP = pChildren[left];
760
- if (mappedIdentity(mapping.get(leftY), leftP)) {
761
- foundMappedChild = true;
762
- } else if (!equalYTypePNode(leftY, leftP)) {
763
- break;
764
- }
765
- }
766
- for (; left + right < minCnt; right++) {
767
- const rightY = yChildren[yChildCnt - right - 1];
768
- const rightP = pChildren[pChildCnt - right - 1];
769
- if (mappedIdentity(mapping.get(rightY), rightP)) {
770
- foundMappedChild = true;
771
- } else if (!equalYTypePNode(rightY, rightP)) {
772
- break;
773
- }
774
- }
775
- return {
776
- equalityFactor: left + right,
777
- foundMappedChild
778
- };
779
- };
780
- var ytextTrans = (ytext) => {
781
- let str = "";
782
- let n = ytext._start;
783
- const nAttrs = {};
784
- while (n !== null) {
785
- if (!n.deleted) {
786
- if (n.countable && n.content instanceof ContentString) {
787
- str += n.content.str;
788
- } else if (n.content instanceof ContentFormat) {
789
- nAttrs[n.content.key] = null;
790
- }
791
- }
792
- n = n.right;
793
- }
794
- return {
795
- str,
796
- nAttrs
797
- };
798
- };
799
- var updateYText = (ytext, ptexts, mapping) => {
800
- mapping.set(ytext, ptexts);
801
- const { nAttrs, str } = ytextTrans(ytext);
802
- const content = ptexts.map((p) => ({
803
- insert: (
804
- /** @type {any} */
805
- p.text
806
- ),
807
- attributes: Object.assign({}, nAttrs, marksToAttributes(p.marks))
808
- }));
809
- const { insert, remove, index } = simpleDiff(
810
- str,
811
- content.map((c) => c.insert).join("")
812
- );
813
- ytext.delete(index, remove);
814
- ytext.insert(index, insert);
815
- ytext.applyDelta(
816
- content.map((c) => ({ retain: c.insert.length, attributes: c.attributes }))
817
- );
818
- };
819
- var marksToAttributes = (marks) => {
820
- const pattrs = {};
821
- marks.forEach((mark) => {
822
- if (mark.type.name !== "ychange") {
823
- pattrs[mark.type.name] = mark.attrs;
824
- }
825
- });
826
- return pattrs;
827
- };
828
- var updateYFragment = (y, yDomFragment, pNode, mapping) => {
829
- if (yDomFragment instanceof YXmlElement && yDomFragment.nodeName !== pNode.type.name) {
830
- throw new Error("node name mismatch!");
831
- }
832
- mapping.set(yDomFragment, pNode);
833
- if (yDomFragment instanceof YXmlElement) {
834
- const yDomAttrs = yDomFragment.getAttributes();
835
- const pAttrs = pNode.attrs;
836
- for (const key in pAttrs) {
837
- if (pAttrs[key] !== null) {
838
- if (yDomAttrs[key] !== pAttrs[key] && key !== "ychange") {
839
- yDomFragment.setAttribute(key, pAttrs[key]);
840
- }
841
- } else {
842
- yDomFragment.removeAttribute(key);
843
- }
844
- }
845
- for (const key in yDomAttrs) {
846
- if (pAttrs[key] === void 0) {
847
- yDomFragment.removeAttribute(key);
848
- }
849
- }
850
- }
851
- const pChildren = normalizePNodeContent(pNode);
852
- const pChildCnt = pChildren.length;
853
- const yChildren = yDomFragment.toArray();
854
- const yChildCnt = yChildren.length;
855
- const minCnt = min(pChildCnt, yChildCnt);
856
- let left = 0;
857
- let right = 0;
858
- for (; left < minCnt; left++) {
859
- const leftY = yChildren[left];
860
- const leftP = pChildren[left];
861
- if (!mappedIdentity(mapping.get(leftY), leftP)) {
862
- if (equalYTypePNode(leftY, leftP)) {
863
- mapping.set(leftY, leftP);
864
- } else {
865
- break;
866
- }
867
- }
868
- }
869
- for (; right + left + 1 < minCnt; right++) {
870
- const rightY = yChildren[yChildCnt - right - 1];
871
- const rightP = pChildren[pChildCnt - right - 1];
872
- if (!mappedIdentity(mapping.get(rightY), rightP)) {
873
- if (equalYTypePNode(rightY, rightP)) {
874
- mapping.set(rightY, rightP);
875
- } else {
876
- break;
877
- }
878
- }
879
- }
880
- y.transact(() => {
881
- while (yChildCnt - left - right > 0 && pChildCnt - left - right > 0) {
882
- const leftY = yChildren[left];
883
- const leftP = pChildren[left];
884
- const rightY = yChildren[yChildCnt - right - 1];
885
- const rightP = pChildren[pChildCnt - right - 1];
886
- if (leftY instanceof YXmlText && leftP instanceof Array) {
887
- if (!equalYTextPText(leftY, leftP)) {
888
- updateYText(leftY, leftP, mapping);
889
- }
890
- left += 1;
891
- } else {
892
- let updateLeft = leftY instanceof YXmlElement && matchNodeName(leftY, leftP);
893
- let updateRight = rightY instanceof YXmlElement && matchNodeName(rightY, rightP);
894
- if (updateLeft && updateRight) {
895
- const equalityLeft = computeChildEqualityFactor(
896
- /** @type {Y.XmlElement} */
897
- leftY,
898
- /** @type {PModel.Node} */
899
- leftP,
900
- mapping
901
- );
902
- const equalityRight = computeChildEqualityFactor(
903
- /** @type {Y.XmlElement} */
904
- rightY,
905
- /** @type {PModel.Node} */
906
- rightP,
907
- mapping
908
- );
909
- if (equalityLeft.foundMappedChild && !equalityRight.foundMappedChild) {
910
- updateRight = false;
911
- } else if (!equalityLeft.foundMappedChild && equalityRight.foundMappedChild) {
912
- updateLeft = false;
913
- } else if (equalityLeft.equalityFactor < equalityRight.equalityFactor) {
914
- updateLeft = false;
915
- } else {
916
- updateRight = false;
917
- }
918
- }
919
- if (updateLeft) {
920
- updateYFragment(
921
- y,
922
- /** @type {Y.XmlFragment} */
923
- leftY,
924
- /** @type {PModel.Node} */
925
- leftP,
926
- mapping
927
- );
928
- left += 1;
929
- } else if (updateRight) {
930
- updateYFragment(
931
- y,
932
- /** @type {Y.XmlFragment} */
933
- rightY,
934
- /** @type {PModel.Node} */
935
- rightP,
936
- mapping
937
- );
938
- right += 1;
939
- } else {
940
- mapping.delete(yDomFragment.get(left));
941
- yDomFragment.delete(left, 1);
942
- yDomFragment.insert(left, [
943
- createTypeFromTextOrElementNode(leftP, mapping)
944
- ]);
945
- left += 1;
946
- }
947
- }
948
- }
949
- const yDelLen = yChildCnt - left - right;
950
- if (yChildCnt === 1 && pChildCnt === 0 && yChildren[0] instanceof YXmlText) {
951
- mapping.delete(yChildren[0]);
952
- yChildren[0].delete(0, yChildren[0].length);
953
- } else if (yDelLen > 0) {
954
- yDomFragment.slice(left, left + yDelLen).forEach((type) => mapping.delete(type));
955
- yDomFragment.delete(left, yDelLen);
956
- }
957
- if (left + right < pChildCnt) {
958
- const ins = [];
959
- for (let i = left; i < pChildCnt - right; i++) {
960
- ins.push(createTypeFromTextOrElementNode(pChildren[i], mapping));
961
- }
962
- yDomFragment.insert(left, ins);
963
- }
964
- }, ySyncPluginKey);
965
- };
966
- var matchNodeName = (yElement, pNode) => !(pNode instanceof Array) && yElement.nodeName === pNode.type.name;
967
-
968
- // node_modules/y-prosemirror/src/lib.js
969
- var absolutePositionToRelativePosition = (pos, type, mapping) => {
970
- if (pos === 0) {
971
- return createRelativePositionFromTypeIndex(type, 0, -1);
972
- }
973
- let n = type._first === null ? null : (
974
- /** @type {Y.ContentType} */
975
- type._first.content.type
128
+ const blocks2 = richTextBlockExtensions(options.schema, hosts);
129
+ return [
130
+ richTextDocumentExtension(blocks2.length > 0),
131
+ richTextBlockClipboard,
132
+ ...configured.filter((extension) => extension.name !== "doc"),
133
+ ...blocks2
134
+ ];
135
+ }, [getEntryAnchors, hosts, options.extensions, options.schema]);
136
+ const content = useMemo(
137
+ () => editorContent(store.get(fieldNode.value)),
138
+ [fieldNode, store]
976
139
  );
977
- while (n !== null && type !== n) {
978
- if (n instanceof YXmlText) {
979
- if (n._length >= pos) {
980
- return createRelativePositionFromTypeIndex(n, pos, -1);
981
- } else {
982
- pos -= n._length;
983
- }
984
- if (n._item !== null && n._item.next !== null) {
985
- n = /** @type {Y.ContentType} */
986
- n._item.next.content.type;
987
- } else {
988
- do {
989
- n = n._item === null ? null : n._item.parent;
990
- pos--;
991
- } while (n !== type && n !== null && n._item !== null && n._item.next === null);
992
- if (n !== null && n !== type) {
993
- n = n._item === null ? null : (
994
- /** @type {Y.ContentType} */
995
- /** @type Y.Item */
996
- n._item.next.content.type
997
- );
998
- }
999
- }
1000
- } else {
1001
- const pNodeSize = (
1002
- /** @type {any} */
1003
- (mapping.get(n) || { nodeSize: 0 }).nodeSize
1004
- );
1005
- if (n._first !== null && pos < pNodeSize) {
1006
- n = /** @type {Y.ContentType} */
1007
- n._first.content.type;
1008
- pos--;
1009
- } else {
1010
- if (pos === 1 && n._length === 0 && pNodeSize > 1) {
1011
- return new RelativePosition(n._item === null ? null : n._item.id, n._item === null ? findRootTypeKey(n) : null, null);
1012
- }
1013
- pos -= pNodeSize;
1014
- if (n._item !== null && n._item.next !== null) {
1015
- n = /** @type {Y.ContentType} */
1016
- n._item.next.content.type;
1017
- } else {
1018
- if (pos === 0) {
1019
- n = n._item === null ? n : n._item.parent;
1020
- return new RelativePosition(n._item === null ? null : n._item.id, n._item === null ? findRootTypeKey(n) : null, null);
1021
- }
1022
- do {
1023
- n = /** @type {Y.Item} */
1024
- n._item.parent;
1025
- pos--;
1026
- } while (n !== type && /** @type {Y.Item} */
1027
- n._item.next === null);
1028
- if (n !== type) {
1029
- n = /** @type {Y.ContentType} */
1030
- /** @type {Y.Item} */
1031
- /** @type {Y.Item} */
1032
- n._item.next.content.type;
1033
- }
1034
- }
1035
- }
1036
- }
1037
- if (n === null) {
1038
- throw unexpectedCase();
1039
- }
1040
- if (pos === 0 && n.constructor !== YXmlText && n !== type) {
1041
- return createRelativePosition(n._item.parent, n._item);
1042
- }
1043
- }
1044
- return createRelativePositionFromTypeIndex(type, type._length, -1);
1045
- };
1046
- var createRelativePosition = (type, item) => {
1047
- let typeid = null;
1048
- let tname = null;
1049
- if (type._item === null) {
1050
- tname = findRootTypeKey(type);
1051
- } else {
1052
- typeid = createID(type._item.id.client, type._item.id.clock);
1053
- }
1054
- return new RelativePosition(typeid, tname, item.id);
1055
- };
1056
- var relativePositionToAbsolutePosition = (y, documentType, relPos, mapping) => {
1057
- const decodedPos = createAbsolutePositionFromRelativePosition(relPos, y);
1058
- if (decodedPos === null || decodedPos.type !== documentType && !isParentOf(documentType, decodedPos.type._item)) {
1059
- return null;
1060
- }
1061
- let type = decodedPos.type;
1062
- let pos = 0;
1063
- if (type.constructor === YXmlText) {
1064
- pos = decodedPos.index;
1065
- } else if (type._item === null || !type._item.deleted) {
1066
- let n = type._first;
1067
- let i = 0;
1068
- while (i < type._length && i < decodedPos.index && n !== null) {
1069
- if (!n.deleted) {
1070
- const t = (
1071
- /** @type {Y.ContentType} */
1072
- n.content.type
1073
- );
1074
- i++;
1075
- if (t instanceof YXmlText) {
1076
- pos += t._length;
1077
- } else {
1078
- pos += /** @type {any} */
1079
- mapping.get(t).nodeSize;
1080
- }
1081
- }
1082
- n = /** @type {Y.Item} */
1083
- n.right;
1084
- }
1085
- pos += 1;
1086
- }
1087
- while (type !== documentType && type._item !== null) {
1088
- const parent = type._item.parent;
1089
- if (parent._item === null || !parent._item.deleted) {
1090
- pos += 1;
1091
- let n = (
1092
- /** @type {Y.AbstractType} */
1093
- parent._first
1094
- );
1095
- while (n !== null) {
1096
- const contentType = (
1097
- /** @type {Y.ContentType} */
1098
- n.content.type
1099
- );
1100
- if (contentType === type) {
1101
- break;
1102
- }
1103
- if (!n.deleted) {
1104
- if (contentType instanceof YXmlText) {
1105
- pos += contentType._length;
1106
- } else {
1107
- pos += /** @type {any} */
1108
- mapping.get(contentType).nodeSize;
1109
- }
1110
- }
1111
- n = n.right;
1112
- }
1113
- }
1114
- type = /** @type {Y.AbstractType} */
1115
- parent;
1116
- }
1117
- return pos - 1;
1118
- };
1119
- function yXmlFragmentToProsemirrorJSON(xmlFragment) {
1120
- const items = xmlFragment.toArray();
1121
- function serialize(item) {
1122
- let response;
1123
- if (!item.nodeName) {
1124
- const delta = item.toDelta();
1125
- response = delta.map((d) => {
1126
- const text = {
1127
- type: "text",
1128
- text: d.insert
1129
- };
1130
- if (d.attributes) {
1131
- text.marks = Object.keys(d.attributes).map((type) => {
1132
- const attrs = d.attributes[type];
1133
- const mark = {
1134
- type
1135
- };
1136
- if (Object.keys(attrs)) {
1137
- mark.attrs = attrs;
1138
- }
1139
- return mark;
1140
- });
1141
- }
1142
- return text;
1143
- });
1144
- } else {
1145
- response = {
1146
- type: item.nodeName
1147
- };
1148
- const attrs = item.getAttributes();
1149
- if (Object.keys(attrs).length) {
1150
- response.attrs = attrs;
1151
- }
1152
- const children = item.toArray();
1153
- if (children.length) {
1154
- response.content = children.map(serialize).flat();
1155
- }
1156
- }
1157
- return response;
1158
- }
1159
- return {
1160
- type: "doc",
1161
- content: items.map(serialize)
1162
- };
1163
- }
1164
-
1165
- // node_modules/y-prosemirror/src/plugins/undo-plugin.js
1166
- var undo = (state) => {
1167
- const undoManager = yUndoPluginKey.getState(state).undoManager;
1168
- if (undoManager != null) {
1169
- undoManager.undo();
1170
- return true;
1171
- }
1172
- };
1173
- var redo = (state) => {
1174
- const undoManager = yUndoPluginKey.getState(state).undoManager;
1175
- if (undoManager != null) {
1176
- undoManager.redo();
1177
- return true;
1178
- }
1179
- };
1180
- var defaultProtectedNodes = /* @__PURE__ */ new Set(["paragraph"]);
1181
- var defaultDeleteFilter = (item, protectedNodes) => !(item instanceof Item) || !(item.content instanceof ContentType) || !(item.content.type instanceof YText || item.content.type instanceof YXmlElement && protectedNodes.has(item.content.type.nodeName)) || item.content.type._length === 0;
1182
- var yUndoPlugin = ({ protectedNodes = defaultProtectedNodes, trackedOrigins = [], undoManager = null } = {}) => new Plugin({
1183
- key: yUndoPluginKey,
1184
- state: {
1185
- init: (initargs, state) => {
1186
- const ystate = ySyncPluginKey.getState(state);
1187
- const _undoManager = undoManager || new UndoManager(ystate.type, {
1188
- trackedOrigins: new Set([ySyncPluginKey].concat(trackedOrigins)),
1189
- deleteFilter: (item) => defaultDeleteFilter(item, protectedNodes),
1190
- captureTransaction: (tr) => tr.meta.get("addToHistory") !== false
1191
- });
140
+ const resolveBlock = useCallback(
141
+ function resolveBlock2(id, typeName, snapshot) {
142
+ const pending = pendingBlocks.current.get(id);
143
+ if (pending) return pending;
144
+ const part = blocksByIdRef.current.get(id);
145
+ if (part) {
146
+ const value = store.get(part.node.value);
147
+ if (Node.isBlock(value)) return value;
148
+ }
149
+ if (snapshot?.[Node.type] === typeName) return snapshot;
150
+ const type = options.schema?.[typeName];
151
+ if (!type) return;
1192
152
  return {
1193
- undoManager: _undoManager,
1194
- prevSel: null,
1195
- hasUndoOps: _undoManager.undoStack.length > 0,
1196
- hasRedoOps: _undoManager.redoStack.length > 0
153
+ [Node.type]: typeName,
154
+ [BlockNode.id]: id,
155
+ ...Type.initialValue(type)
1197
156
  };
1198
157
  },
1199
- /**
1200
- * @returns {any}
1201
- */
1202
- apply: (tr, val, oldState, state) => {
1203
- const binding = ySyncPluginKey.getState(state).binding;
1204
- const undoManager2 = val.undoManager;
1205
- const hasUndoOps = undoManager2.undoStack.length > 0;
1206
- const hasRedoOps = undoManager2.redoStack.length > 0;
1207
- if (binding) {
1208
- return {
1209
- undoManager: undoManager2,
1210
- prevSel: getRelativeSelection(binding, oldState),
1211
- hasUndoOps,
1212
- hasRedoOps
1213
- };
1214
- } else {
1215
- if (hasUndoOps !== val.hasUndoOps || hasRedoOps !== val.hasRedoOps) {
1216
- return Object.assign({}, val, {
1217
- hasUndoOps: undoManager2.undoStack.length > 0,
1218
- hasRedoOps: undoManager2.redoStack.length > 0
1219
- });
1220
- } else {
1221
- return val;
1222
- }
1223
- }
158
+ [options.schema, store]
159
+ );
160
+ const editor = useEditor({
161
+ content,
162
+ extensions,
163
+ editable: !readOnly,
164
+ onCreate({ editor: editor2 }) {
165
+ setEditorReadOnly(editor2, readOnly);
166
+ lastEditorDocument.current = documentStructureKey(
167
+ editorNodes(editor2.getJSON(), resolveBlock)
168
+ );
169
+ },
170
+ onFocus({ editor: editor2 }) {
171
+ setActiveEditor(editor2);
172
+ setFocused(true);
173
+ },
174
+ onUpdate({ editor: editor2, transaction }) {
175
+ if (!transaction.docChanged) return;
176
+ const next = editorNodes(editor2.getJSON(), resolveBlock);
177
+ const nextKey = documentStructureKey(next);
178
+ if (pendingExternalDocument.current && nextKey === lastEditorDocument.current)
179
+ return;
180
+ lastEditorDocument.current = nextKey;
181
+ if (nextKey === pendingExternalDocument.current)
182
+ pendingExternalDocument.current = void 0;
183
+ updateDocument(next);
184
+ for (const node of next)
185
+ if (Node.isBlock(node))
186
+ pendingBlocks.current.delete(String(node[BlockNode.id]));
1224
187
  }
1225
- },
1226
- view: (view) => {
1227
- const ystate = ySyncPluginKey.getState(view.state);
1228
- const undoManager2 = yUndoPluginKey.getState(view.state).undoManager;
1229
- undoManager2.on("stack-item-added", ({ stackItem }) => {
1230
- const binding = ystate.binding;
1231
- if (binding) {
1232
- stackItem.meta.set(binding, yUndoPluginKey.getState(view.state).prevSel);
1233
- }
188
+ });
189
+ useEffect(() => {
190
+ if (editor) setEditorReadOnly(editor, readOnly);
191
+ }, [editor, readOnly]);
192
+ useEffect(() => {
193
+ if (!editor) return;
194
+ const current = editorNodes(editor.getJSON(), resolveBlock);
195
+ if (documentKey === documentStructureKey(current)) return;
196
+ const documentValue = store.get(fieldNode.value);
197
+ editor.commands.setContent(editorContent(documentValue), {
198
+ emitUpdate: false
1234
199
  });
1235
- undoManager2.on("stack-item-popped", ({ stackItem }) => {
1236
- const binding = ystate.binding;
1237
- if (binding) {
1238
- binding.beforeTransactionSelection = stackItem.meta.get(binding) || binding.beforeTransactionSelection;
1239
- }
200
+ lastEditorDocument.current = documentKey;
201
+ pendingExternalDocument.current = void 0;
202
+ }, [documentKey, editor, fieldNode, resolveBlock, store]);
203
+ const toolbarTarget = typeof document === "undefined" ? null : document.getElementById("alinea-toolbar");
204
+ function insertBlock(block) {
205
+ if (!editor || editor.state.selection.$from.depth !== 1) return;
206
+ const id = String(block[BlockNode.id]);
207
+ pendingBlocks.current.set(id, block);
208
+ const inserted = editor.chain().insertContent({ type: block[Node.type], attrs: { [BlockNode.id]: id } }).run();
209
+ if (!inserted) pendingBlocks.current.delete(id);
210
+ }
211
+ function checkFocus() {
212
+ requestAnimationFrame(() => {
213
+ const target = document.activeElement;
214
+ setFocused(ownsFocus(target));
215
+ setInnerBlockFocused(isInnerBlockField(target));
1240
216
  });
1241
- return {
1242
- destroy: () => {
1243
- undoManager2.destroy();
1244
- }
1245
- };
1246
- }
1247
- });
1248
-
1249
- // node_modules/@tiptap/extension-collaboration/dist/index.js
1250
- var Collaboration = Extension.create({
1251
- name: "collaboration",
1252
- priority: 1e3,
1253
- addOptions() {
1254
- return {
1255
- document: null,
1256
- field: "default",
1257
- fragment: null
1258
- };
1259
- },
1260
- addStorage() {
1261
- return {
1262
- isDisabled: false
1263
- };
1264
- },
1265
- onCreate() {
1266
- if (this.editor.extensionManager.extensions.find((extension) => extension.name === "history")) {
1267
- console.warn('[tiptap warn]: "@tiptap/extension-collaboration" comes with its own history support and is not compatible with "@tiptap/extension-history".');
1268
- }
1269
- },
1270
- addCommands() {
1271
- return {
1272
- undo: () => ({ tr, state, dispatch }) => {
1273
- tr.setMeta("preventDispatch", true);
1274
- const undoManager = yUndoPluginKey.getState(state).undoManager;
1275
- if (undoManager.undoStack.length === 0) {
1276
- return false;
1277
- }
1278
- if (!dispatch) {
1279
- return true;
1280
- }
1281
- return undo(state);
1282
- },
1283
- redo: () => ({ tr, state, dispatch }) => {
1284
- tr.setMeta("preventDispatch", true);
1285
- const undoManager = yUndoPluginKey.getState(state).undoManager;
1286
- if (undoManager.redoStack.length === 0) {
1287
- return false;
1288
- }
1289
- if (!dispatch) {
1290
- return true;
1291
- }
1292
- return redo(state);
1293
- }
1294
- };
1295
- },
1296
- addKeyboardShortcuts() {
1297
- return {
1298
- "Mod-z": () => this.editor.commands.undo(),
1299
- "Mod-y": () => this.editor.commands.redo(),
1300
- "Shift-Mod-z": () => this.editor.commands.redo()
1301
- };
1302
- },
1303
- addProseMirrorPlugins() {
1304
- var _a;
1305
- const fragment = this.options.fragment ? this.options.fragment : this.options.document.getXmlFragment(this.options.field);
1306
- const yUndoPluginInstance = yUndoPlugin(this.options.yUndoOptions);
1307
- const originalUndoPluginView = yUndoPluginInstance.spec.view;
1308
- yUndoPluginInstance.spec.view = (view) => {
1309
- const { undoManager } = yUndoPluginKey.getState(view.state);
1310
- if (undoManager.restore) {
1311
- undoManager.restore();
1312
- undoManager.restore = () => {
1313
- };
1314
- }
1315
- const viewRet = originalUndoPluginView ? originalUndoPluginView(view) : void 0;
1316
- return {
1317
- destroy: () => {
1318
- const hasUndoManSelf = undoManager.trackedOrigins.has(undoManager);
1319
- const observers = undoManager._observers;
1320
- undoManager.restore = () => {
1321
- if (hasUndoManSelf) {
1322
- undoManager.trackedOrigins.add(undoManager);
1323
- }
1324
- undoManager.doc.on("afterTransaction", undoManager.afterTransactionHandler);
1325
- undoManager._observers = observers;
1326
- };
1327
- if (viewRet === null || viewRet === void 0 ? void 0 : viewRet.destroy) {
1328
- viewRet.destroy();
1329
- }
1330
- }
1331
- };
1332
- };
1333
- const ySyncPluginOptions = {
1334
- ...this.options.ySyncOptions,
1335
- onFirstRender: this.options.onFirstRender
1336
- };
1337
- const ySyncPluginInstance = ySyncPlugin(fragment, ySyncPluginOptions);
1338
- if (this.editor.options.enableContentCheck) {
1339
- (_a = fragment.doc) === null || _a === void 0 ? void 0 : _a.on("beforeTransaction", () => {
1340
- try {
1341
- const jsonContent = yXmlFragmentToProsemirrorJSON(fragment);
1342
- if (jsonContent.content.length === 0) {
1343
- return;
1344
- }
1345
- this.editor.schema.nodeFromJSON(jsonContent).check();
1346
- } catch (error) {
1347
- this.editor.emit("contentError", {
1348
- error,
1349
- editor: this.editor,
1350
- disableCollaboration: () => {
1351
- var _a2;
1352
- (_a2 = fragment.doc) === null || _a2 === void 0 ? void 0 : _a2.destroy();
1353
- this.storage.isDisabled = true;
1354
- }
1355
- });
1356
- return false;
1357
- }
1358
- });
1359
- }
1360
- return [
1361
- ySyncPluginInstance,
1362
- yUndoPluginInstance,
1363
- // Only add the filterInvalidContent plugin if content checking is enabled
1364
- this.editor.options.enableContentCheck && new Plugin({
1365
- key: new PluginKey("filterInvalidContent"),
1366
- filterTransaction: () => {
1367
- var _a2;
1368
- if (this.storage.isDisabled) {
1369
- (_a2 = fragment.doc) === null || _a2 === void 0 ? void 0 : _a2.destroy();
1370
- return true;
1371
- }
1372
- return true;
1373
- }
1374
- })
1375
- ].filter(Boolean);
1376
- }
1377
- });
1378
-
1379
- // node_modules/@tiptap/react/dist/index.js
1380
- import React, { forwardRef, useState, useDebugValue, useLayoutEffect, useEffect, useRef, createContext, useContext } from "react";
1381
- import ReactDOM, { flushSync } from "react-dom";
1382
- var shim = { exports: {} };
1383
- var useSyncExternalStoreShim_production_min = {};
1384
- var hasRequiredUseSyncExternalStoreShim_production_min;
1385
- function requireUseSyncExternalStoreShim_production_min() {
1386
- if (hasRequiredUseSyncExternalStoreShim_production_min) return useSyncExternalStoreShim_production_min;
1387
- hasRequiredUseSyncExternalStoreShim_production_min = 1;
1388
- var e = React;
1389
- function h(a, b) {
1390
- return a === b && (0 !== a || 1 / a === 1 / b) || a !== a && b !== b;
1391
217
  }
1392
- var k = "function" === typeof Object.is ? Object.is : h, l = e.useState, m = e.useEffect, n = e.useLayoutEffect, p = e.useDebugValue;
1393
- function q(a, b) {
1394
- var d = b(), f = l({ inst: { value: d, getSnapshot: b } }), c = f[0].inst, g = f[1];
1395
- n(function() {
1396
- c.value = d;
1397
- c.getSnapshot = b;
1398
- r(c) && g({ inst: c });
1399
- }, [a, d, b]);
1400
- m(function() {
1401
- r(c) && g({ inst: c });
1402
- return a(function() {
1403
- r(c) && g({ inst: c });
1404
- });
1405
- }, [a]);
1406
- p(d);
1407
- return d;
218
+ function handleBlur(nextTarget) {
219
+ if (nextTarget instanceof HTMLElement) {
220
+ setFocused(ownsFocus(nextTarget));
221
+ setInnerBlockFocused(isInnerBlockField(nextTarget));
222
+ } else checkFocus();
1408
223
  }
1409
- function r(a) {
1410
- var b = a.getSnapshot;
1411
- a = a.value;
1412
- try {
1413
- var d = b();
1414
- return !k(a, d);
1415
- } catch (f) {
1416
- return true;
1417
- }
224
+ function ownsFocus(target) {
225
+ if (!(target instanceof HTMLElement)) return false;
226
+ const richText = target.closest("[data-richtext-field]");
227
+ if (richText && richText !== root.current) return false;
228
+ if (root.current?.contains(target)) return true;
229
+ const toolbar = target.closest("[data-richtext-toolbar-owner]");
230
+ return toolbar?.dataset.richtextToolbarOwner === ownerId;
1418
231
  }
1419
- function t(a, b) {
1420
- return b();
232
+ function isInnerBlockField(target) {
233
+ return target instanceof HTMLElement && root.current?.contains(target) === true && target.closest("[data-richtext-block-editor]") !== null;
1421
234
  }
1422
- var u = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? t : q;
1423
- useSyncExternalStoreShim_production_min.useSyncExternalStore = void 0 !== e.useSyncExternalStore ? e.useSyncExternalStore : u;
1424
- return useSyncExternalStoreShim_production_min;
1425
- }
1426
- var useSyncExternalStoreShim_development = {};
1427
- var hasRequiredUseSyncExternalStoreShim_development;
1428
- function requireUseSyncExternalStoreShim_development() {
1429
- if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
1430
- hasRequiredUseSyncExternalStoreShim_development = 1;
1431
- if (process.env.NODE_ENV !== "production") {
1432
- (function() {
1433
- if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
1434
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
1435
- }
1436
- var React$1 = React;
1437
- var ReactSharedInternals = React$1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
1438
- function error(format) {
1439
- {
235
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
236
+ /* @__PURE__ */ jsx(PickTextLink, { picker }),
237
+ /* @__PURE__ */ jsx(PickTextAnchor, { picker: anchorPicker }),
238
+ /* @__PURE__ */ jsx(
239
+ Label,
240
+ {
241
+ description: options.help,
242
+ errorMessage: error,
243
+ isRequired: options.required,
244
+ label: options.label,
245
+ shared: options.shared,
246
+ children: /* @__PURE__ */ jsxs(
247
+ "div",
1440
248
  {
1441
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1442
- args[_key2 - 1] = arguments[_key2];
1443
- }
1444
- printWarning("error", format, args);
1445
- }
1446
- }
1447
- }
1448
- function printWarning(level, format, args) {
1449
- {
1450
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
1451
- var stack = ReactDebugCurrentFrame.getStackAddendum();
1452
- if (stack !== "") {
1453
- format += "%s";
1454
- args = args.concat([stack]);
249
+ ref: root,
250
+ className: styles.RichTextFieldView(),
251
+ "data-richtext-field": ownerId,
252
+ "data-inline": options.inline || void 0,
253
+ "data-invalid": Boolean(error) || void 0,
254
+ "data-focused": focused && !innerBlockFocused && !readOnly ? "true" : void 0,
255
+ "data-read-only": readOnly || void 0,
256
+ onFocusCapture: (event) => {
257
+ setFocused(ownsFocus(event.target));
258
+ setInnerBlockFocused(isInnerBlockField(event.target));
259
+ },
260
+ onBlurCapture: (event) => handleBlur(event.relatedTarget),
261
+ children: [
262
+ editor && !readOnly && options.schema && /* @__PURE__ */ jsx(
263
+ RichTextInsertMenu,
264
+ {
265
+ editor,
266
+ schema: options.schema,
267
+ onInsert: insertBlock
268
+ }
269
+ ),
270
+ /* @__PURE__ */ jsx(EditorContent, { editor }),
271
+ editor && /* @__PURE__ */ jsx(
272
+ RichTextBlockPortals,
273
+ {
274
+ blocksById,
275
+ editor,
276
+ hosts,
277
+ pendingBlocks: pendingBlocks.current,
278
+ readOnly,
279
+ schema: options.schema,
280
+ store
281
+ }
282
+ )
283
+ ]
1455
284
  }
1456
- var argsWithFormat = args.map(function(item) {
1457
- return String(item);
1458
- });
1459
- argsWithFormat.unshift("Warning: " + format);
1460
- Function.prototype.apply.call(console[level], console, argsWithFormat);
1461
- }
1462
- }
1463
- function is(x, y) {
1464
- return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y;
285
+ )
1465
286
  }
1466
- var objectIs = typeof Object.is === "function" ? Object.is : is;
1467
- var useState3 = React$1.useState, useEffect3 = React$1.useEffect, useLayoutEffect2 = React$1.useLayoutEffect, useDebugValue2 = React$1.useDebugValue;
1468
- var didWarnOld18Alpha = false;
1469
- var didWarnUncachedGetSnapshot = false;
1470
- function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
1471
- {
1472
- if (!didWarnOld18Alpha) {
1473
- if (React$1.startTransition !== void 0) {
1474
- didWarnOld18Alpha = true;
1475
- error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release.");
1476
- }
1477
- }
1478
- }
1479
- var value = getSnapshot();
287
+ ),
288
+ toolbarTarget && editor && activeEditor === editor && focused && !readOnly ? createPortal(
289
+ /* @__PURE__ */ jsx(
290
+ RichTextToolbar,
1480
291
  {
1481
- if (!didWarnUncachedGetSnapshot) {
1482
- var cachedValue = getSnapshot();
1483
- if (!objectIs(value, cachedValue)) {
1484
- error("The result of getSnapshot should be cached to avoid an infinite loop");
1485
- didWarnUncachedGetSnapshot = true;
1486
- }
1487
- }
1488
- }
1489
- var _useState = useState3({
1490
- inst: {
1491
- value,
1492
- getSnapshot
292
+ editor,
293
+ enableTables: options.enableTables,
294
+ ownerId,
295
+ pickLink: picker.pickLink,
296
+ pickAnchor: anchorPicker.pickAnchor,
297
+ getEntryAnchors,
298
+ toolbar: options.toolbar,
299
+ onFocusChange: (next, nextTarget) => {
300
+ if (next) setFocused(true);
301
+ else handleBlur(nextTarget ?? null);
1493
302
  }
1494
- }), inst = _useState[0].inst, forceUpdate = _useState[1];
1495
- useLayoutEffect2(function() {
1496
- inst.value = value;
1497
- inst.getSnapshot = getSnapshot;
1498
- if (checkIfSnapshotChanged(inst)) {
1499
- forceUpdate({
1500
- inst
1501
- });
1502
- }
1503
- }, [subscribe, value, getSnapshot]);
1504
- useEffect3(function() {
1505
- if (checkIfSnapshotChanged(inst)) {
1506
- forceUpdate({
1507
- inst
1508
- });
1509
- }
1510
- var handleStoreChange = function() {
1511
- if (checkIfSnapshotChanged(inst)) {
1512
- forceUpdate({
1513
- inst
1514
- });
1515
- }
1516
- };
1517
- return subscribe(handleStoreChange);
1518
- }, [subscribe]);
1519
- useDebugValue2(value);
1520
- return value;
1521
- }
1522
- function checkIfSnapshotChanged(inst) {
1523
- var latestGetSnapshot = inst.getSnapshot;
1524
- var prevValue = inst.value;
1525
- try {
1526
- var nextValue = latestGetSnapshot();
1527
- return !objectIs(prevValue, nextValue);
1528
- } catch (error2) {
1529
- return true;
1530
303
  }
1531
- }
1532
- function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
1533
- return getSnapshot();
1534
- }
1535
- var canUseDOM = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
1536
- var isServerEnvironment = !canUseDOM;
1537
- var shim2 = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;
1538
- var useSyncExternalStore$2 = React$1.useSyncExternalStore !== void 0 ? React$1.useSyncExternalStore : shim2;
1539
- useSyncExternalStoreShim_development.useSyncExternalStore = useSyncExternalStore$2;
1540
- if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
1541
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
1542
- }
1543
- })();
1544
- }
1545
- return useSyncExternalStoreShim_development;
304
+ ),
305
+ toolbarTarget
306
+ ) : null
307
+ ] });
1546
308
  }
1547
- if (process.env.NODE_ENV === "production") {
1548
- shim.exports = requireUseSyncExternalStoreShim_production_min();
1549
- } else {
1550
- shim.exports = requireUseSyncExternalStoreShim_development();
309
+ function setEditorReadOnly(editor, readOnly) {
310
+ if (editor.isDestroyed) return;
311
+ editor.setEditable(!readOnly, false);
312
+ editor.view.dom.contentEditable = readOnly ? "false" : "plaintext-only";
1551
313
  }
1552
- var shimExports = shim.exports;
1553
- var mergeRefs = (...refs) => {
1554
- return (node) => {
1555
- refs.forEach((ref) => {
1556
- if (typeof ref === "function") {
1557
- ref(node);
1558
- } else if (ref) {
1559
- ref.current = node;
1560
- }
1561
- });
1562
- };
1563
- };
1564
- var Portals = ({ contentComponent }) => {
1565
- const renderers = shimExports.useSyncExternalStore(contentComponent.subscribe, contentComponent.getSnapshot, contentComponent.getServerSnapshot);
1566
- return React.createElement(React.Fragment, null, Object.values(renderers));
1567
- };
1568
- function getInstance() {
1569
- const subscribers = /* @__PURE__ */ new Set();
1570
- let renderers = {};
1571
- return {
1572
- /**
1573
- * Subscribe to the editor instance's changes.
1574
- */
1575
- subscribe(callback) {
1576
- subscribers.add(callback);
1577
- return () => {
1578
- subscribers.delete(callback);
1579
- };
1580
- },
1581
- getSnapshot() {
1582
- return renderers;
1583
- },
1584
- getServerSnapshot() {
1585
- return renderers;
1586
- },
1587
- /**
1588
- * Adds a new NodeView Renderer to the editor.
1589
- */
1590
- setRenderer(id, renderer) {
1591
- renderers = {
1592
- ...renderers,
1593
- [id]: ReactDOM.createPortal(renderer.reactElement, renderer.element, id)
1594
- };
1595
- subscribers.forEach((subscriber) => subscriber());
1596
- },
1597
- /**
1598
- * Removes a NodeView Renderer from the editor.
1599
- */
1600
- removeRenderer(id) {
1601
- const nextRenderers = { ...renderers };
1602
- delete nextRenderers[id];
1603
- renderers = nextRenderers;
1604
- subscribers.forEach((subscriber) => subscriber());
1605
- }
1606
- };
1607
- }
1608
- var PureEditorContent = class extends React.Component {
1609
- constructor(props) {
1610
- var _a;
1611
- super(props);
1612
- this.editorContentRef = React.createRef();
1613
- this.initialized = false;
1614
- this.state = {
1615
- hasContentComponentInitialized: Boolean((_a = props.editor) === null || _a === void 0 ? void 0 : _a.contentComponent)
1616
- };
1617
- }
1618
- componentDidMount() {
1619
- this.init();
1620
- }
1621
- componentDidUpdate() {
1622
- this.init();
1623
- }
1624
- init() {
1625
- const editor = this.props.editor;
1626
- if (editor && !editor.isDestroyed && editor.options.element) {
1627
- if (editor.contentComponent) {
1628
- return;
1629
- }
1630
- const element = this.editorContentRef.current;
1631
- element.append(...editor.options.element.childNodes);
1632
- editor.setOptions({
1633
- element
1634
- });
1635
- editor.contentComponent = getInstance();
1636
- if (!this.state.hasContentComponentInitialized) {
1637
- this.unsubscribeToContentComponent = editor.contentComponent.subscribe(() => {
1638
- this.setState((prevState) => {
1639
- if (!prevState.hasContentComponentInitialized) {
1640
- return {
1641
- hasContentComponentInitialized: true
1642
- };
1643
- }
1644
- return prevState;
1645
- });
1646
- if (this.unsubscribeToContentComponent) {
1647
- this.unsubscribeToContentComponent();
314
+ function RichTextBlockPortals({
315
+ blocksById,
316
+ editor,
317
+ hosts,
318
+ pendingBlocks,
319
+ readOnly,
320
+ schema,
321
+ store
322
+ }) {
323
+ const mounted = useSyncExternalStore(
324
+ hosts.subscribe,
325
+ hosts.snapshot,
326
+ hosts.snapshot
327
+ );
328
+ function remove(host) {
329
+ const position = host.getPos();
330
+ if (typeof position !== "number") return;
331
+ editor.commands.deleteRange({ from: position, to: position + 1 });
332
+ }
333
+ function duplicate(host, part) {
334
+ const position = host.getPos();
335
+ if (typeof position !== "number") return;
336
+ const value = store.get(part.node.value);
337
+ if (!Node.isBlock(value)) return;
338
+ const id = createId();
339
+ const block = { ...value, [BlockNode.id]: id };
340
+ pendingBlocks.set(id, block);
341
+ const inserted = editor.chain().insertContentAt(position + 1, {
342
+ type: host.typeName,
343
+ attrs: { [BlockNode.id]: id }
344
+ }).run();
345
+ if (!inserted) pendingBlocks.delete(id);
346
+ }
347
+ return mounted.map((host) => {
348
+ const part = blocksById.get(host.id);
349
+ const type = schema?.[host.typeName];
350
+ if (!part || !type) return null;
351
+ return createPortal(
352
+ /* @__PURE__ */ jsxs(Fragment, { children: [
353
+ /* @__PURE__ */ jsx(RichTextBlockSnapshot, { editor, host, node: part.node }),
354
+ /* @__PURE__ */ jsx(
355
+ RichTextBlock,
356
+ {
357
+ id: part.id,
358
+ node: part.node,
359
+ type,
360
+ readOnly,
361
+ onDelete: () => remove(host),
362
+ onDuplicate: () => duplicate(host, part)
1648
363
  }
1649
- });
1650
- }
1651
- editor.createNodeViews();
1652
- this.initialized = true;
1653
- }
1654
- }
1655
- componentWillUnmount() {
1656
- const editor = this.props.editor;
1657
- if (!editor) {
1658
- return;
1659
- }
1660
- this.initialized = false;
1661
- if (!editor.isDestroyed) {
1662
- editor.view.setProps({
1663
- nodeViews: {}
1664
- });
1665
- }
1666
- if (this.unsubscribeToContentComponent) {
1667
- this.unsubscribeToContentComponent();
1668
- }
1669
- editor.contentComponent = null;
1670
- if (!editor.options.element.firstChild) {
1671
- return;
1672
- }
1673
- const newElement = document.createElement("div");
1674
- newElement.append(...editor.options.element.childNodes);
1675
- editor.setOptions({
1676
- element: newElement
1677
- });
1678
- }
1679
- render() {
1680
- const { editor, innerRef, ...rest } = this.props;
1681
- return React.createElement(
1682
- React.Fragment,
1683
- null,
1684
- React.createElement("div", { ref: mergeRefs(innerRef, this.editorContentRef), ...rest }),
1685
- (editor === null || editor === void 0 ? void 0 : editor.contentComponent) && React.createElement(Portals, { contentComponent: editor.contentComponent })
364
+ )
365
+ ] }),
366
+ host.dom,
367
+ host.id
1686
368
  );
1687
- }
1688
- };
1689
- var EditorContentWithKey = forwardRef((props, ref) => {
1690
- const key = React.useMemo(() => {
1691
- return Math.floor(Math.random() * 4294967295).toString();
1692
- }, [props.editor]);
1693
- return React.createElement(PureEditorContent, {
1694
- key,
1695
- innerRef: ref,
1696
- ...props
1697
369
  });
1698
- });
1699
- var EditorContent = React.memo(EditorContentWithKey);
1700
- var withSelector = { exports: {} };
1701
- var withSelector_production_min = {};
1702
- var hasRequiredWithSelector_production_min;
1703
- function requireWithSelector_production_min() {
1704
- if (hasRequiredWithSelector_production_min) return withSelector_production_min;
1705
- hasRequiredWithSelector_production_min = 1;
1706
- var h = React, n = shimExports;
1707
- function p(a, b) {
1708
- return a === b && (0 !== a || 1 / a === 1 / b) || a !== a && b !== b;
1709
- }
1710
- var q = "function" === typeof Object.is ? Object.is : p, r = n.useSyncExternalStore, t = h.useRef, u = h.useEffect, v = h.useMemo, w = h.useDebugValue;
1711
- withSelector_production_min.useSyncExternalStoreWithSelector = function(a, b, e, l, g) {
1712
- var c = t(null);
1713
- if (null === c.current) {
1714
- var f = { hasValue: false, value: null };
1715
- c.current = f;
1716
- } else f = c.current;
1717
- c = v(function() {
1718
- function a2(a3) {
1719
- if (!c2) {
1720
- c2 = true;
1721
- d2 = a3;
1722
- a3 = l(a3);
1723
- if (void 0 !== g && f.hasValue) {
1724
- var b2 = f.value;
1725
- if (g(b2, a3)) return k = b2;
1726
- }
1727
- return k = a3;
1728
- }
1729
- b2 = k;
1730
- if (q(d2, a3)) return b2;
1731
- var e2 = l(a3);
1732
- if (void 0 !== g && g(b2, e2)) return b2;
1733
- d2 = a3;
1734
- return k = e2;
1735
- }
1736
- var c2 = false, d2, k, m = void 0 === e ? null : e;
1737
- return [function() {
1738
- return a2(b());
1739
- }, null === m ? void 0 : function() {
1740
- return a2(m());
1741
- }];
1742
- }, [b, e, l, g]);
1743
- var d = r(a, c[0], c[1]);
1744
- u(function() {
1745
- f.hasValue = true;
1746
- f.value = d;
1747
- }, [d]);
1748
- w(d);
1749
- return d;
1750
- };
1751
- return withSelector_production_min;
1752
370
  }
1753
- var withSelector_development = {};
1754
- var hasRequiredWithSelector_development;
1755
- function requireWithSelector_development() {
1756
- if (hasRequiredWithSelector_development) return withSelector_development;
1757
- hasRequiredWithSelector_development = 1;
1758
- if (process.env.NODE_ENV !== "production") {
1759
- (function() {
1760
- if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
1761
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
1762
- }
1763
- var React$1 = React;
1764
- var shim2 = shimExports;
1765
- function is(x, y) {
1766
- return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y;
1767
- }
1768
- var objectIs = typeof Object.is === "function" ? Object.is : is;
1769
- var useSyncExternalStore = shim2.useSyncExternalStore;
1770
- var useRef3 = React$1.useRef, useEffect3 = React$1.useEffect, useMemo2 = React$1.useMemo, useDebugValue2 = React$1.useDebugValue;
1771
- function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
1772
- var instRef = useRef3(null);
1773
- var inst;
1774
- if (instRef.current === null) {
1775
- inst = {
1776
- hasValue: false,
1777
- value: null
1778
- };
1779
- instRef.current = inst;
1780
- } else {
1781
- inst = instRef.current;
1782
- }
1783
- var _useMemo = useMemo2(function() {
1784
- var hasMemo = false;
1785
- var memoizedSnapshot;
1786
- var memoizedSelection;
1787
- var memoizedSelector = function(nextSnapshot) {
1788
- if (!hasMemo) {
1789
- hasMemo = true;
1790
- memoizedSnapshot = nextSnapshot;
1791
- var _nextSelection = selector(nextSnapshot);
1792
- if (isEqual !== void 0) {
1793
- if (inst.hasValue) {
1794
- var currentSelection = inst.value;
1795
- if (isEqual(currentSelection, _nextSelection)) {
1796
- memoizedSelection = currentSelection;
1797
- return currentSelection;
1798
- }
1799
- }
1800
- }
1801
- memoizedSelection = _nextSelection;
1802
- return _nextSelection;
1803
- }
1804
- var prevSnapshot = memoizedSnapshot;
1805
- var prevSelection = memoizedSelection;
1806
- if (objectIs(prevSnapshot, nextSnapshot)) {
1807
- return prevSelection;
1808
- }
1809
- var nextSelection = selector(nextSnapshot);
1810
- if (isEqual !== void 0 && isEqual(prevSelection, nextSelection)) {
1811
- return prevSelection;
1812
- }
1813
- memoizedSnapshot = nextSnapshot;
1814
- memoizedSelection = nextSelection;
1815
- return nextSelection;
1816
- };
1817
- var maybeGetServerSnapshot = getServerSnapshot === void 0 ? null : getServerSnapshot;
1818
- var getSnapshotWithSelector = function() {
1819
- return memoizedSelector(getSnapshot());
1820
- };
1821
- var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? void 0 : function() {
1822
- return memoizedSelector(maybeGetServerSnapshot());
1823
- };
1824
- return [getSnapshotWithSelector, getServerSnapshotWithSelector];
1825
- }, [getSnapshot, getServerSnapshot, selector, isEqual]), getSelection = _useMemo[0], getServerSelection = _useMemo[1];
1826
- var value = useSyncExternalStore(subscribe, getSelection, getServerSelection);
1827
- useEffect3(function() {
1828
- inst.hasValue = true;
1829
- inst.value = value;
1830
- }, [value]);
1831
- useDebugValue2(value);
1832
- return value;
1833
- }
1834
- withSelector_development.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector;
1835
- if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
1836
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
1837
- }
1838
- })();
1839
- }
1840
- return withSelector_development;
1841
- }
1842
- if (process.env.NODE_ENV === "production") {
1843
- withSelector.exports = requireWithSelector_production_min();
1844
- } else {
1845
- withSelector.exports = requireWithSelector_development();
1846
- }
1847
- var withSelectorExports = withSelector.exports;
1848
- var isDev = process.env.NODE_ENV !== "production";
1849
- var isSSR = typeof window === "undefined";
1850
- var isNext = isSSR || Boolean(typeof window !== "undefined" && window.next);
1851
- var EditorContext = createContext({
1852
- editor: null
1853
- });
1854
- var EditorConsumer = EditorContext.Consumer;
1855
- var useCurrentEditor = () => useContext(EditorContext);
1856
- var FloatingMenu = (props) => {
1857
- const [element, setElement] = useState(null);
1858
- const { editor: currentEditor } = useCurrentEditor();
371
+ function RichTextBlockSnapshot({
372
+ editor,
373
+ host,
374
+ node
375
+ }) {
376
+ const value = useAtomValue(node.value);
1859
377
  useEffect(() => {
1860
- var _a;
1861
- if (!element) {
1862
- return;
1863
- }
1864
- if (((_a = props.editor) === null || _a === void 0 ? void 0 : _a.isDestroyed) || (currentEditor === null || currentEditor === void 0 ? void 0 : currentEditor.isDestroyed)) {
1865
- return;
1866
- }
1867
- const { pluginKey = "floatingMenu", editor, tippyOptions = {}, shouldShow = null } = props;
1868
- const menuEditor = editor || currentEditor;
1869
- if (!menuEditor) {
1870
- console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");
1871
- return;
1872
- }
1873
- const plugin = FloatingMenuPlugin({
1874
- pluginKey,
1875
- editor: menuEditor,
1876
- element,
1877
- tippyOptions,
1878
- shouldShow
1879
- });
1880
- menuEditor.registerPlugin(plugin);
1881
- return () => {
1882
- menuEditor.unregisterPlugin(pluginKey);
1883
- };
1884
- }, [
1885
- props.editor,
1886
- currentEditor,
1887
- element
1888
- ]);
1889
- return React.createElement("div", { ref: setElement, className: props.className, style: { visibility: "hidden" } }, props.children);
1890
- };
1891
- var ReactNodeViewContext = createContext({
1892
- onDragStart: void 0
1893
- });
1894
- var useReactNodeView = () => useContext(ReactNodeViewContext);
1895
- var NodeViewWrapper = React.forwardRef((props, ref) => {
1896
- const { onDragStart } = useReactNodeView();
1897
- const Tag = props.as || "div";
1898
- return (
1899
- // @ts-ignore
1900
- React.createElement(Tag, { ...props, ref, "data-node-view-wrapper": "", onDragStart, style: {
1901
- whiteSpace: "normal",
1902
- ...props.style
1903
- } })
1904
- );
1905
- });
1906
- function isClassComponent(Component) {
1907
- return !!(typeof Component === "function" && Component.prototype && Component.prototype.isReactComponent);
1908
- }
1909
- function isForwardRefComponent(Component) {
1910
- var _a;
1911
- return !!(typeof Component === "object" && ((_a = Component.$$typeof) === null || _a === void 0 ? void 0 : _a.toString()) === "Symbol(react.forward_ref)");
1912
- }
1913
- var ReactRenderer = class {
1914
- /**
1915
- * Immediately creates element and renders the provided React component.
1916
- */
1917
- constructor(component, { editor, props = {}, as = "div", className = "" }) {
1918
- this.ref = null;
1919
- this.id = Math.floor(Math.random() * 4294967295).toString();
1920
- this.component = component;
1921
- this.editor = editor;
1922
- this.props = props;
1923
- this.element = document.createElement(as);
1924
- this.element.classList.add("react-renderer");
1925
- if (className) {
1926
- this.element.classList.add(...className.split(" "));
1927
- }
1928
- if (this.editor.isInitialized) {
1929
- flushSync(() => {
1930
- this.render();
1931
- });
1932
- } else {
1933
- this.render();
1934
- }
1935
- }
1936
- /**
1937
- * Render the React component.
1938
- */
1939
- render() {
1940
- var _a;
1941
- const Component = this.component;
1942
- const props = this.props;
1943
- const editor = this.editor;
1944
- if (isClassComponent(Component) || isForwardRefComponent(Component)) {
1945
- props.ref = (ref) => {
1946
- this.ref = ref;
1947
- };
1948
- }
1949
- this.reactElement = React.createElement(Component, { ...props });
1950
- (_a = editor === null || editor === void 0 ? void 0 : editor.contentComponent) === null || _a === void 0 ? void 0 : _a.setRenderer(this.id, this);
1951
- }
1952
- /**
1953
- * Re-renders the React component with new props.
1954
- */
1955
- updateProps(props = {}) {
1956
- this.props = {
1957
- ...this.props,
1958
- ...props
1959
- };
1960
- this.render();
1961
- }
1962
- /**
1963
- * Destroy the React component.
1964
- */
1965
- destroy() {
1966
- var _a;
1967
- const editor = this.editor;
1968
- (_a = editor === null || editor === void 0 ? void 0 : editor.contentComponent) === null || _a === void 0 ? void 0 : _a.removeRenderer(this.id);
1969
- }
1970
- /**
1971
- * Update the attributes of the element that holds the React component.
1972
- */
1973
- updateAttributes(attributes) {
1974
- Object.keys(attributes).forEach((key) => {
1975
- this.element.setAttribute(key, attributes[key]);
1976
- });
1977
- }
1978
- };
1979
- var ReactNodeView = class extends NodeView {
1980
- /**
1981
- * Setup the React component.
1982
- * Called on initialization.
1983
- */
1984
- mount() {
1985
- const props = {
1986
- editor: this.editor,
1987
- node: this.node,
1988
- decorations: this.decorations,
1989
- innerDecorations: this.innerDecorations,
1990
- view: this.view,
1991
- selected: false,
1992
- extension: this.extension,
1993
- HTMLAttributes: this.HTMLAttributes,
1994
- getPos: () => this.getPos(),
1995
- updateAttributes: (attributes = {}) => this.updateAttributes(attributes),
1996
- deleteNode: () => this.deleteNode()
1997
- };
1998
- if (!this.component.displayName) {
1999
- const capitalizeFirstChar = (string) => {
2000
- return string.charAt(0).toUpperCase() + string.substring(1);
2001
- };
2002
- this.component.displayName = capitalizeFirstChar(this.extension.name);
2003
- }
2004
- const onDragStart = this.onDragStart.bind(this);
2005
- const nodeViewContentRef = (element) => {
2006
- if (element && this.contentDOMElement && element.firstChild !== this.contentDOMElement) {
2007
- element.appendChild(this.contentDOMElement);
2008
- }
2009
- };
2010
- const context = { onDragStart, nodeViewContentRef };
2011
- const Component = this.component;
2012
- const ReactNodeViewProvider = React.memo((componentProps) => {
2013
- return React.createElement(ReactNodeViewContext.Provider, { value: context }, React.createElement(Component, componentProps));
2014
- });
2015
- ReactNodeViewProvider.displayName = "ReactNodeView";
2016
- if (this.node.isLeaf) {
2017
- this.contentDOMElement = null;
2018
- } else if (this.options.contentDOMElementTag) {
2019
- this.contentDOMElement = document.createElement(this.options.contentDOMElementTag);
2020
- } else {
2021
- this.contentDOMElement = document.createElement(this.node.isInline ? "span" : "div");
2022
- }
2023
- if (this.contentDOMElement) {
2024
- this.contentDOMElement.dataset.nodeViewContentReact = "";
2025
- this.contentDOMElement.style.whiteSpace = "inherit";
2026
- }
2027
- let as = this.node.isInline ? "span" : "div";
2028
- if (this.options.as) {
2029
- as = this.options.as;
2030
- }
2031
- const { className = "" } = this.options;
2032
- this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this);
2033
- this.renderer = new ReactRenderer(ReactNodeViewProvider, {
2034
- editor: this.editor,
2035
- props,
2036
- as,
2037
- className: `node-${this.node.type.name} ${className}`.trim()
2038
- });
2039
- this.editor.on("selectionUpdate", this.handleSelectionUpdate);
2040
- this.updateElementAttributes();
2041
- }
2042
- /**
2043
- * Return the DOM element.
2044
- * This is the element that will be used to display the node view.
2045
- */
2046
- get dom() {
2047
- var _a;
2048
- if (this.renderer.element.firstElementChild && !((_a = this.renderer.element.firstElementChild) === null || _a === void 0 ? void 0 : _a.hasAttribute("data-node-view-wrapper"))) {
2049
- throw Error("Please use the NodeViewWrapper component for your node view.");
2050
- }
2051
- return this.renderer.element;
2052
- }
2053
- /**
2054
- * Return the content DOM element.
2055
- * This is the element that will be used to display the rich-text content of the node.
2056
- */
2057
- get contentDOM() {
2058
- if (this.node.isLeaf) {
2059
- return null;
2060
- }
2061
- return this.contentDOMElement;
2062
- }
2063
- /**
2064
- * On editor selection update, check if the node is selected.
2065
- * If it is, call `selectNode`, otherwise call `deselectNode`.
2066
- */
2067
- handleSelectionUpdate() {
2068
- const { from, to } = this.editor.state.selection;
2069
- const pos = this.getPos();
2070
- if (typeof pos !== "number") {
2071
- return;
2072
- }
2073
- if (from <= pos && to >= pos + this.node.nodeSize) {
2074
- if (this.renderer.props.selected) {
2075
- return;
2076
- }
2077
- this.selectNode();
2078
- } else {
2079
- if (!this.renderer.props.selected) {
2080
- return;
2081
- }
2082
- this.deselectNode();
2083
- }
2084
- }
2085
- /**
2086
- * On update, update the React component.
2087
- * To prevent unnecessary updates, the `update` option can be used.
2088
- */
2089
- update(node, decorations, innerDecorations) {
2090
- const rerenderComponent = (props) => {
2091
- this.renderer.updateProps(props);
2092
- if (typeof this.options.attrs === "function") {
2093
- this.updateElementAttributes();
2094
- }
2095
- };
2096
- if (node.type !== this.node.type) {
2097
- return false;
2098
- }
2099
- if (typeof this.options.update === "function") {
2100
- const oldNode = this.node;
2101
- const oldDecorations = this.decorations;
2102
- const oldInnerDecorations = this.innerDecorations;
2103
- this.node = node;
2104
- this.decorations = decorations;
2105
- this.innerDecorations = innerDecorations;
2106
- return this.options.update({
2107
- oldNode,
2108
- oldDecorations,
2109
- newNode: node,
2110
- newDecorations: decorations,
2111
- oldInnerDecorations,
2112
- innerDecorations,
2113
- updateProps: () => rerenderComponent({ node, decorations, innerDecorations })
2114
- });
2115
- }
2116
- if (node === this.node && this.decorations === decorations && this.innerDecorations === innerDecorations) {
2117
- return true;
2118
- }
2119
- this.node = node;
2120
- this.decorations = decorations;
2121
- this.innerDecorations = innerDecorations;
2122
- rerenderComponent({ node, decorations, innerDecorations });
2123
- return true;
2124
- }
2125
- /**
2126
- * Select the node.
2127
- * Add the `selected` prop and the `ProseMirror-selectednode` class.
2128
- */
2129
- selectNode() {
2130
- this.renderer.updateProps({
2131
- selected: true
2132
- });
2133
- this.renderer.element.classList.add("ProseMirror-selectednode");
2134
- }
2135
- /**
2136
- * Deselect the node.
2137
- * Remove the `selected` prop and the `ProseMirror-selectednode` class.
2138
- */
2139
- deselectNode() {
2140
- this.renderer.updateProps({
2141
- selected: false
2142
- });
2143
- this.renderer.element.classList.remove("ProseMirror-selectednode");
2144
- }
2145
- /**
2146
- * Destroy the React component instance.
2147
- */
2148
- destroy() {
2149
- this.renderer.destroy();
2150
- this.editor.off("selectionUpdate", this.handleSelectionUpdate);
2151
- this.contentDOMElement = null;
2152
- }
2153
- /**
2154
- * Update the attributes of the top-level element that holds the React component.
2155
- * Applying the attributes defined in the `attrs` option.
2156
- */
2157
- updateElementAttributes() {
2158
- if (this.options.attrs) {
2159
- let attrsObj = {};
2160
- if (typeof this.options.attrs === "function") {
2161
- const extensionAttributes = this.editor.extensionManager.attributes;
2162
- const HTMLAttributes = getRenderedAttributes(this.node, extensionAttributes);
2163
- attrsObj = this.options.attrs({ node: this.node, HTMLAttributes });
2164
- } else {
2165
- attrsObj = this.options.attrs;
2166
- }
2167
- this.renderer.updateAttributes(attrsObj);
2168
- }
2169
- }
2170
- };
2171
- function ReactNodeViewRenderer(component, options) {
2172
- return (props) => {
2173
- if (!props.editor.contentComponent) {
2174
- return {};
2175
- }
2176
- return new ReactNodeView(component, props, options);
2177
- };
378
+ if (!Node.isBlock(value)) return;
379
+ const position = host.getPos();
380
+ if (typeof position !== "number") return;
381
+ const editorNode = editor.state.doc.nodeAt(position);
382
+ if (!editorNode || editorNode.type.name !== host.typeName) return;
383
+ const current = decodeBlockValue(
384
+ editorNode.attrs[richTextBlockValueAttribute]
385
+ );
386
+ if (encodeBlockValue(current) === encodeBlockValue(value)) return;
387
+ const transaction = editor.state.tr.setNodeMarkup(
388
+ position,
389
+ void 0,
390
+ blockAttributes(value)
391
+ );
392
+ transaction.setMeta("addToHistory", false);
393
+ editor.view.dispatch(transaction);
394
+ }, [editor, host, value]);
395
+ return null;
2178
396
  }
2179
-
2180
- // src/field/richtext/RichTextField.view.tsx
2181
- import { createId } from "alinea/core/Id";
2182
- import { getType } from "alinea/core/Internal";
2183
- import { BlockNode, ElementNode, Mark, Node as Node2, TextNode } from "alinea/core/TextDoc";
2184
- import { Type } from "alinea/core/Type";
2185
- import { entries, values } from "alinea/core/util/Objects";
2186
- import { FormRow } from "alinea/dashboard/atoms/FormAtoms";
2187
- import { InputForm } from "alinea/dashboard/editor/InputForm";
2188
- import { useField, useFieldOptions } from "alinea/dashboard/editor/UseField";
2189
- import { FieldToolbar } from "alinea/dashboard/view/entry/FieldToolbar";
2190
- import { IconButton } from "alinea/dashboard/view/IconButton";
2191
- import { InputLabel } from "alinea/dashboard/view/InputLabel";
2192
- import { HStack, Icon, px, TextLabel } from "alinea/ui";
2193
- import { DropdownMenu } from "alinea/ui/DropdownMenu";
2194
- import { useForceUpdate } from "alinea/ui/hook/UseForceUpdate";
2195
- import { useNonInitialEffect } from "alinea/ui/hook/UseNonInitialEffect";
2196
- import IcRoundAddCircle from "alinea/ui/icons/IcRoundAddCircle";
2197
- import { IcRoundClose } from "alinea/ui/icons/IcRoundClose";
2198
- import { IcRoundDragHandle } from "alinea/ui/icons/IcRoundDragHandle";
2199
- import { IcRoundNotes } from "alinea/ui/icons/IcRoundNotes";
2200
- import { Sink } from "alinea/ui/Sink";
2201
- import { useCallback, useEffect as useEffect2, useMemo, useRef as useRef2, useState as useState2 } from "react";
2202
- import { extensions as baseExtensions } from "./Extensions.js";
2203
- import { PickTextLink, usePickTextLink } from "./PickTextLink.js";
2204
-
2205
- // src/field/richtext/RichTextField.module.scss
2206
- var RichTextField_module_default = {
2207
- "hyphenate": "alinea-RichTextField-hyphenate",
2208
- "link": "alinea-RichTextField-link",
2209
- "p": "alinea-RichTextField-p",
2210
- "h5": "alinea-RichTextField-h5",
2211
- "h4": "alinea-RichTextField-h4",
2212
- "h3": "alinea-RichTextField-h3",
2213
- "h2": "alinea-RichTextField-h2",
2214
- "h1": "alinea-RichTextField-h1",
2215
- "is-flat": "alinea-RichTextField-is-flat",
2216
- "isFlat": "alinea-RichTextField-is-flat",
2217
- "monospace": "alinea-RichTextField-monospace",
2218
- "small": "alinea-RichTextField-small",
2219
- "root-editor": "alinea-RichTextField-editor",
2220
- "rootEditor": "alinea-RichTextField-editor",
2221
- "is-focus": "alinea-RichTextField-is-focus",
2222
- "isFocus": "alinea-RichTextField-is-focus",
2223
- "is-readonly": "alinea-RichTextField-is-readonly",
2224
- "isReadonly": "alinea-RichTextField-is-readonly",
2225
- "insert-trigger": "alinea-RichTextField-insert-trigger",
2226
- "insertTrigger": "alinea-RichTextField-insert-trigger"
2227
- };
2228
-
2229
- // src/field/richtext/RichTextField.view.tsx
2230
- import { RichTextToolbar } from "./RichTextToolbar.js";
2231
- import { Fragment as Fragment2, jsx, jsxs } from "react/jsx-runtime";
2232
- var styles = dist_default(RichTextField_module_default);
2233
- function typeExtension(field, name, type) {
2234
- function View({ node, deleteNode }) {
2235
- const { [BlockNode.id]: id } = node.attrs;
2236
- const meta = getType(type);
2237
- const { readOnly } = useFieldOptions(field);
2238
- return /* @__PURE__ */ jsx(FormRow, { field, type, rowId: id, readOnly, children: /* @__PURE__ */ jsx(NodeViewWrapper, { children: /* @__PURE__ */ jsxs(Sink.Root, { style: { margin: `${px(18)} 0` }, children: [
2239
- /* @__PURE__ */ jsxs(Sink.Header, { children: [
2240
- /* @__PURE__ */ jsx(Sink.Options, { children: /* @__PURE__ */ jsx(
2241
- IconButton,
2242
- {
2243
- icon: meta.icon || IcRoundDragHandle,
2244
- "data-drag-handle": true,
2245
- style: { cursor: "grab" }
2246
- }
2247
- ) }),
2248
- /* @__PURE__ */ jsx(Sink.Title, { children: /* @__PURE__ */ jsx(TextLabel, { label: Type.label(type) }) }),
2249
- /* @__PURE__ */ jsx(Sink.Options, { children: /* @__PURE__ */ jsx(IconButton, { icon: IcRoundClose, onClick: deleteNode }) })
2250
- ] }),
2251
- /* @__PURE__ */ jsx(Sink.Content, { children: /* @__PURE__ */ jsx(InputForm, { type }) })
2252
- ] }) }) });
2253
- }
2254
- return Node.create({
2255
- name,
2256
- group: "block",
2257
- atom: true,
2258
- draggable: true,
2259
- parseHTML() {
2260
- return [{ tag: name }];
2261
- },
2262
- renderHTML({ HTMLAttributes }) {
2263
- return [name, mergeAttributes(HTMLAttributes)];
2264
- },
2265
- addNodeView() {
2266
- return ReactNodeViewRenderer(View);
2267
- },
2268
- addAttributes() {
2269
- return {
2270
- [BlockNode.id]: { default: null }
2271
- };
2272
- }
2273
- });
397
+ function documentStructureKey(value) {
398
+ return stableStringify(
399
+ value.map(
400
+ (node) => Node.isBlock(node) ? { [Node.type]: node[Node.type], [BlockNode.id]: node[BlockNode.id] } : node
401
+ )
402
+ );
2274
403
  }
2275
- function schemaToExtensions(field, schema) {
2276
- if (!schema) return [];
2277
- return entries(schema).map(([name, type]) => {
2278
- return typeExtension(field, name, type);
2279
- });
404
+ function stableStringify(value) {
405
+ if (Array.isArray(value))
406
+ return `[${value.map((item) => stableStringify(item)).join(",")}]`;
407
+ if (isRecord(value))
408
+ return `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${stableStringify(value[key])}`).join(",")}}`;
409
+ return JSON.stringify(value) ?? String(value);
2280
410
  }
2281
- function InsertMenu({ editor, schema, onInsert }) {
2282
- const id = createId();
2283
- if (!schema) return null;
2284
- const blocks = entries(schema).map(([key, type]) => {
2285
- return /* @__PURE__ */ jsx(
2286
- DropdownMenu.Item,
2287
- {
2288
- onClick: () => {
2289
- onInsert(id, key);
2290
- editor.chain().focus().insertContent({
2291
- type: key,
2292
- attrs: { [BlockNode.id]: id }
2293
- }).run();
2294
- },
2295
- children: /* @__PURE__ */ jsxs(HStack, { center: true, gap: 8, children: [
2296
- /* @__PURE__ */ jsx(Icon, { icon: getType(type).icon ?? IcRoundAddCircle }),
2297
- /* @__PURE__ */ jsx(TextLabel, { label: Type.label(type) })
2298
- ] })
2299
- },
2300
- key
2301
- );
2302
- });
411
+ function RichTextFieldCompactView({
412
+ value
413
+ }) {
414
+ const text = previewText(value);
2303
415
  return /* @__PURE__ */ jsx(
2304
- FloatingMenu,
416
+ "span",
2305
417
  {
2306
- editor,
2307
- tippyOptions: {
2308
- zIndex: 1,
2309
- maxWidth: "none"
2310
- },
2311
- children: /* @__PURE__ */ jsxs(DropdownMenu.Root, { bottom: true, children: [
2312
- /* @__PURE__ */ jsxs(DropdownMenu.Trigger, { className: styles.insert.trigger(), children: [
2313
- /* @__PURE__ */ jsx(Icon, { icon: IcRoundAddCircle }),
2314
- /* @__PURE__ */ jsx("span", { children: "Insert block" })
2315
- ] }),
2316
- /* @__PURE__ */ jsx(DropdownMenu.Items, { children: blocks })
2317
- ] })
418
+ className: styles.RichTextFieldCompactView(),
419
+ "data-empty": text ? void 0 : "true",
420
+ children: text || "-"
2318
421
  }
2319
422
  );
2320
423
  }
2321
- function RichTextInput({
2322
- field
2323
- }) {
2324
- const { value, mutator, options, error } = useField(field);
2325
- const forceUpdate = useForceUpdate();
2326
- const { fragment, insert } = mutator;
2327
- const picker = usePickTextLink();
2328
- const { readOnly, schema, enableTables, toolbar } = options;
2329
- const [focus, setFocus] = useState2(false);
2330
- const containerRef = useRef2(null);
2331
- const focusToggle = useCallback(
2332
- function focusToggle2(target) {
2333
- const element = target || document.activeElement;
2334
- const editorElement = () => containerRef.current?.querySelector(
2335
- `.${styles.root.editor()} > .ProseMirror`
2336
- );
2337
- const isInToolbar = element?.closest?.('[data-richtext-toolbar="true"]') !== null;
2338
- const editor2 = editorElement();
2339
- const isInEditor = !!editor2 && (editor2 === element || editor2.contains(element));
2340
- const isFocused = isInToolbar || isInEditor;
2341
- setFocus(isFocused);
2342
- },
2343
- [setFocus, containerRef]
2344
- );
2345
- const blocks = useMemo(() => {
2346
- return schemaToExtensions(field, schema);
2347
- }, [field, schema]);
2348
- const base = useMemo(() => {
2349
- return values(options.extensions ?? baseExtensions);
2350
- }, [options.extensions]);
2351
- const extensions = useMemo(() => {
2352
- return [Collaboration.configure({ fragment }), ...base, ...blocks];
2353
- }, [fragment, blocks, base]);
2354
- const content = useMemo(
2355
- () => ({
2356
- type: "doc",
2357
- content: value.map(toContent)
2358
- }),
2359
- [fragment]
2360
- );
2361
- const onFocus = useCallback(
2362
- ({ event }) => focusToggle(event.currentTarget),
2363
- [focusToggle]
2364
- );
2365
- const onBlur = useCallback(
2366
- ({ event }) => focusToggle(event.relatedTarget),
2367
- [focusToggle]
2368
- );
2369
- const isEditable = !options.readOnly && !readOnly;
2370
- const editor = useMemo(() => {
2371
- const doc2 = fragment.doc;
2372
- let editor2;
2373
- doc2.transact(() => {
2374
- editor2 = new Editor({
2375
- content,
2376
- onFocus,
2377
- onBlur,
2378
- extensions,
2379
- editable: isEditable
2380
- });
2381
- }, "self");
2382
- return editor2;
2383
- }, [fragment]);
2384
- useNonInitialEffect(() => {
2385
- editor.setOptions({ editable: isEditable });
2386
- }, [isEditable]);
2387
- useEffect2(() => {
2388
- editor.on("transaction", forceUpdate);
2389
- return () => editor.destroy();
2390
- }, [editor]);
2391
- return /* @__PURE__ */ jsxs(Fragment2, { children: [
2392
- isEditable && focus && /* @__PURE__ */ jsx(FieldToolbar.Slot, { children: /* @__PURE__ */ jsx(
2393
- RichTextToolbar,
2394
- {
2395
- editor,
2396
- focusToggle,
2397
- pickLink: picker.pickLink,
2398
- enableTables,
2399
- toolbar
2400
- }
2401
- ) }),
2402
- /* @__PURE__ */ jsx(PickTextLink, { picker }),
2403
- /* @__PURE__ */ jsxs(
2404
- InputLabel,
2405
- {
2406
- ...options,
2407
- focused: focus,
2408
- icon: IcRoundNotes,
2409
- empty: editor.isEmpty,
2410
- ref: containerRef,
2411
- error,
2412
- children: [
2413
- /* @__PURE__ */ jsx(InsertMenu, { editor, schema, onInsert: insert }),
2414
- /* @__PURE__ */ jsx(
2415
- EditorContent,
2416
- {
2417
- className: styles.root.editor({ focus, readonly: options.readOnly }),
2418
- editor
2419
- }
2420
- )
2421
- ]
2422
- }
2423
- )
2424
- ] });
2425
- }
2426
- function toContent(node) {
2427
- if (Node2.isText(node))
2428
- return {
2429
- type: "text",
2430
- text: node[TextNode.text],
2431
- marks: node[TextNode.marks]?.map((mark) => {
2432
- const { [Mark.type]: type, ...attrs } = mark;
2433
- const res = Object.fromEntries(
2434
- entries(attrs).map(([key, value]) => {
2435
- if (key.startsWith("_")) return [`data-${key.slice(1)}`, value];
2436
- return [key, value];
2437
- })
2438
- );
2439
- return { type, attrs: res };
2440
- })
2441
- };
2442
- if (Node2.isElement(node)) {
2443
- const { [Node2.type]: type, [ElementNode.content]: content, ...attrs } = node;
2444
- return { type, content: content?.map(toContent), attrs };
2445
- }
2446
- if (Node2.isBlock(node)) {
2447
- const { [Node2.type]: type } = node;
2448
- return { type, attrs: { [BlockNode.id]: node[BlockNode.id] } };
2449
- }
2450
- throw new TypeError("Invalid node");
424
+ function previewText(value) {
425
+ if (typeof value === "string") return value;
426
+ if (Array.isArray(value))
427
+ return value.map(previewText).filter(Boolean).join(" ");
428
+ if (!isRecord(value)) return "";
429
+ return [previewText(value.text), previewText(value.content)].filter(Boolean).join(" ");
2451
430
  }
2452
431
  export {
2453
- RichTextInput
432
+ RichTextFieldCompactView,
433
+ RichTextFieldView
2454
434
  };
2455
- /*! Bundled license information:
2456
-
2457
- @tiptap/react/dist/index.js:
2458
- (**
2459
- * @license React
2460
- * use-sync-external-store-shim.production.min.js
2461
- *
2462
- * Copyright (c) Facebook, Inc. and its affiliates.
2463
- *
2464
- * This source code is licensed under the MIT license found in the
2465
- * LICENSE file in the root directory of this source tree.
2466
- *)
2467
- (**
2468
- * @license React
2469
- * use-sync-external-store-shim.development.js
2470
- *
2471
- * Copyright (c) Facebook, Inc. and its affiliates.
2472
- *
2473
- * This source code is licensed under the MIT license found in the
2474
- * LICENSE file in the root directory of this source tree.
2475
- *)
2476
-
2477
- @tiptap/react/dist/index.js:
2478
- (**
2479
- * @license React
2480
- * use-sync-external-store-shim/with-selector.production.min.js
2481
- *
2482
- * Copyright (c) Facebook, Inc. and its affiliates.
2483
- *
2484
- * This source code is licensed under the MIT license found in the
2485
- * LICENSE file in the root directory of this source tree.
2486
- *)
2487
- (**
2488
- * @license React
2489
- * use-sync-external-store-shim/with-selector.development.js
2490
- *
2491
- * Copyright (c) Facebook, Inc. and its affiliates.
2492
- *
2493
- * This source code is licensed under the MIT license found in the
2494
- * LICENSE file in the root directory of this source tree.
2495
- *)
2496
- */