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,4151 +1,7 @@
1
- import {
2
- FloatingMenu
3
- } from "../../chunks/chunk-3DIW62EI.js";
4
- import {
5
- Decoration,
6
- DecorationSet,
7
- Extension,
8
- Fragment,
9
- Mark,
10
- Node,
11
- NodeSelection,
12
- Plugin,
13
- PluginKey,
14
- Selection,
15
- SelectionRange,
16
- Slice,
17
- TextSelection,
18
- Transform,
19
- callOrReturn,
20
- dropPoint,
21
- findParentNodeClosestToPos,
22
- getExtensionField,
23
- isNodeSelection,
24
- keydownHandler,
25
- markInputRule,
26
- markPasteRule,
27
- mergeAttributes,
28
- nodeInputRule,
29
- textblockTypeInputRule,
30
- wrappingInputRule
31
- } from "../../chunks/chunk-FKWEJTSK.js";
32
- import {
33
- dist_default
34
- } from "../../chunks/chunk-A5O3N2GS.js";
35
- import "../../chunks/chunk-NZLE2WMY.js";
36
-
37
- // node_modules/@tiptap/extension-blockquote/dist/index.js
38
- var inputRegex = /^\s*>\s$/;
39
- var Blockquote = Node.create({
40
- name: "blockquote",
41
- addOptions() {
42
- return {
43
- HTMLAttributes: {}
44
- };
45
- },
46
- content: "block+",
47
- group: "block",
48
- defining: true,
49
- parseHTML() {
50
- return [
51
- { tag: "blockquote" }
52
- ];
53
- },
54
- renderHTML({ HTMLAttributes }) {
55
- return ["blockquote", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
56
- },
57
- addCommands() {
58
- return {
59
- setBlockquote: () => ({ commands }) => {
60
- return commands.wrapIn(this.name);
61
- },
62
- toggleBlockquote: () => ({ commands }) => {
63
- return commands.toggleWrap(this.name);
64
- },
65
- unsetBlockquote: () => ({ commands }) => {
66
- return commands.lift(this.name);
67
- }
68
- };
69
- },
70
- addKeyboardShortcuts() {
71
- return {
72
- "Mod-Shift-b": () => this.editor.commands.toggleBlockquote()
73
- };
74
- },
75
- addInputRules() {
76
- return [
77
- wrappingInputRule({
78
- find: inputRegex,
79
- type: this.type
80
- })
81
- ];
82
- }
83
- });
84
-
85
- // node_modules/@tiptap/extension-bold/dist/index.js
86
- var starInputRegex = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/;
87
- var starPasteRegex = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g;
88
- var underscoreInputRegex = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/;
89
- var underscorePasteRegex = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g;
90
- var Bold = Mark.create({
91
- name: "bold",
92
- addOptions() {
93
- return {
94
- HTMLAttributes: {}
95
- };
96
- },
97
- parseHTML() {
98
- return [
99
- {
100
- tag: "strong"
101
- },
102
- {
103
- tag: "b",
104
- getAttrs: (node) => node.style.fontWeight !== "normal" && null
105
- },
106
- {
107
- style: "font-weight=400",
108
- clearMark: (mark) => mark.type.name === this.name
109
- },
110
- {
111
- style: "font-weight",
112
- getAttrs: (value) => /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null
113
- }
114
- ];
115
- },
116
- renderHTML({ HTMLAttributes }) {
117
- return ["strong", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
118
- },
119
- addCommands() {
120
- return {
121
- setBold: () => ({ commands }) => {
122
- return commands.setMark(this.name);
123
- },
124
- toggleBold: () => ({ commands }) => {
125
- return commands.toggleMark(this.name);
126
- },
127
- unsetBold: () => ({ commands }) => {
128
- return commands.unsetMark(this.name);
129
- }
130
- };
131
- },
132
- addKeyboardShortcuts() {
133
- return {
134
- "Mod-b": () => this.editor.commands.toggleBold(),
135
- "Mod-B": () => this.editor.commands.toggleBold()
136
- };
137
- },
138
- addInputRules() {
139
- return [
140
- markInputRule({
141
- find: starInputRegex,
142
- type: this.type
143
- }),
144
- markInputRule({
145
- find: underscoreInputRegex,
146
- type: this.type
147
- })
148
- ];
149
- },
150
- addPasteRules() {
151
- return [
152
- markPasteRule({
153
- find: starPasteRegex,
154
- type: this.type
155
- }),
156
- markPasteRule({
157
- find: underscorePasteRegex,
158
- type: this.type
159
- })
160
- ];
161
- }
162
- });
163
-
164
- // node_modules/@tiptap/extension-bullet-list/dist/index.js
165
- var ListItemName = "listItem";
166
- var TextStyleName = "textStyle";
167
- var inputRegex2 = /^\s*([-+*])\s$/;
168
- var BulletList = Node.create({
169
- name: "bulletList",
170
- addOptions() {
171
- return {
172
- itemTypeName: "listItem",
173
- HTMLAttributes: {},
174
- keepMarks: false,
175
- keepAttributes: false
176
- };
177
- },
178
- group: "block list",
179
- content() {
180
- return `${this.options.itemTypeName}+`;
181
- },
182
- parseHTML() {
183
- return [
184
- { tag: "ul" }
185
- ];
186
- },
187
- renderHTML({ HTMLAttributes }) {
188
- return ["ul", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
189
- },
190
- addCommands() {
191
- return {
192
- toggleBulletList: () => ({ commands, chain }) => {
193
- if (this.options.keepAttributes) {
194
- return chain().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ListItemName, this.editor.getAttributes(TextStyleName)).run();
195
- }
196
- return commands.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks);
197
- }
198
- };
199
- },
200
- addKeyboardShortcuts() {
201
- return {
202
- "Mod-Shift-8": () => this.editor.commands.toggleBulletList()
203
- };
204
- },
205
- addInputRules() {
206
- let inputRule = wrappingInputRule({
207
- find: inputRegex2,
208
- type: this.type
209
- });
210
- if (this.options.keepMarks || this.options.keepAttributes) {
211
- inputRule = wrappingInputRule({
212
- find: inputRegex2,
213
- type: this.type,
214
- keepMarks: this.options.keepMarks,
215
- keepAttributes: this.options.keepAttributes,
216
- getAttributes: () => {
217
- return this.editor.getAttributes(TextStyleName);
218
- },
219
- editor: this.editor
220
- });
221
- }
222
- return [
223
- inputRule
224
- ];
225
- }
226
- });
227
-
228
- // node_modules/@tiptap/extension-document/dist/index.js
229
- var Document = Node.create({
230
- name: "doc",
231
- topNode: true,
232
- content: "block+"
233
- });
234
-
235
- // node_modules/prosemirror-dropcursor/dist/index.js
236
- function dropCursor(options = {}) {
237
- return new Plugin({
238
- view(editorView) {
239
- return new DropCursorView(editorView, options);
240
- }
241
- });
242
- }
243
- var DropCursorView = class {
244
- constructor(editorView, options) {
245
- var _a;
246
- this.editorView = editorView;
247
- this.cursorPos = null;
248
- this.element = null;
249
- this.timeout = -1;
250
- this.width = (_a = options.width) !== null && _a !== void 0 ? _a : 1;
251
- this.color = options.color === false ? void 0 : options.color || "black";
252
- this.class = options.class;
253
- this.handlers = ["dragover", "dragend", "drop", "dragleave"].map((name) => {
254
- let handler = (e) => {
255
- this[name](e);
256
- };
257
- editorView.dom.addEventListener(name, handler);
258
- return { name, handler };
259
- });
260
- }
261
- destroy() {
262
- this.handlers.forEach(({ name, handler }) => this.editorView.dom.removeEventListener(name, handler));
263
- }
264
- update(editorView, prevState) {
265
- if (this.cursorPos != null && prevState.doc != editorView.state.doc) {
266
- if (this.cursorPos > editorView.state.doc.content.size)
267
- this.setCursor(null);
268
- else
269
- this.updateOverlay();
270
- }
271
- }
272
- setCursor(pos) {
273
- if (pos == this.cursorPos)
274
- return;
275
- this.cursorPos = pos;
276
- if (pos == null) {
277
- this.element.parentNode.removeChild(this.element);
278
- this.element = null;
279
- } else {
280
- this.updateOverlay();
281
- }
282
- }
283
- updateOverlay() {
284
- let $pos = this.editorView.state.doc.resolve(this.cursorPos);
285
- let isBlock = !$pos.parent.inlineContent, rect;
286
- if (isBlock) {
287
- let before = $pos.nodeBefore, after = $pos.nodeAfter;
288
- if (before || after) {
289
- let node = this.editorView.nodeDOM(this.cursorPos - (before ? before.nodeSize : 0));
290
- if (node) {
291
- let nodeRect = node.getBoundingClientRect();
292
- let top = before ? nodeRect.bottom : nodeRect.top;
293
- if (before && after)
294
- top = (top + this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top) / 2;
295
- rect = { left: nodeRect.left, right: nodeRect.right, top: top - this.width / 2, bottom: top + this.width / 2 };
296
- }
297
- }
298
- }
299
- if (!rect) {
300
- let coords = this.editorView.coordsAtPos(this.cursorPos);
301
- rect = { left: coords.left - this.width / 2, right: coords.left + this.width / 2, top: coords.top, bottom: coords.bottom };
302
- }
303
- let parent = this.editorView.dom.offsetParent;
304
- if (!this.element) {
305
- this.element = parent.appendChild(document.createElement("div"));
306
- if (this.class)
307
- this.element.className = this.class;
308
- this.element.style.cssText = "position: absolute; z-index: 50; pointer-events: none;";
309
- if (this.color) {
310
- this.element.style.backgroundColor = this.color;
311
- }
312
- }
313
- this.element.classList.toggle("prosemirror-dropcursor-block", isBlock);
314
- this.element.classList.toggle("prosemirror-dropcursor-inline", !isBlock);
315
- let parentLeft, parentTop;
316
- if (!parent || parent == document.body && getComputedStyle(parent).position == "static") {
317
- parentLeft = -pageXOffset;
318
- parentTop = -pageYOffset;
319
- } else {
320
- let rect2 = parent.getBoundingClientRect();
321
- parentLeft = rect2.left - parent.scrollLeft;
322
- parentTop = rect2.top - parent.scrollTop;
323
- }
324
- this.element.style.left = rect.left - parentLeft + "px";
325
- this.element.style.top = rect.top - parentTop + "px";
326
- this.element.style.width = rect.right - rect.left + "px";
327
- this.element.style.height = rect.bottom - rect.top + "px";
328
- }
329
- scheduleRemoval(timeout) {
330
- clearTimeout(this.timeout);
331
- this.timeout = setTimeout(() => this.setCursor(null), timeout);
332
- }
333
- dragover(event) {
334
- if (!this.editorView.editable)
335
- return;
336
- let pos = this.editorView.posAtCoords({ left: event.clientX, top: event.clientY });
337
- let node = pos && pos.inside >= 0 && this.editorView.state.doc.nodeAt(pos.inside);
338
- let disableDropCursor = node && node.type.spec.disableDropCursor;
339
- let disabled = typeof disableDropCursor == "function" ? disableDropCursor(this.editorView, pos, event) : disableDropCursor;
340
- if (pos && !disabled) {
341
- let target = pos.pos;
342
- if (this.editorView.dragging && this.editorView.dragging.slice) {
343
- let point = dropPoint(this.editorView.state.doc, target, this.editorView.dragging.slice);
344
- if (point != null)
345
- target = point;
346
- }
347
- this.setCursor(target);
348
- this.scheduleRemoval(5e3);
349
- }
350
- }
351
- dragend() {
352
- this.scheduleRemoval(20);
353
- }
354
- drop() {
355
- this.scheduleRemoval(20);
356
- }
357
- dragleave(event) {
358
- if (event.target == this.editorView.dom || !this.editorView.dom.contains(event.relatedTarget))
359
- this.setCursor(null);
360
- }
361
- };
362
-
363
- // node_modules/@tiptap/extension-dropcursor/dist/index.js
364
- var Dropcursor = Extension.create({
365
- name: "dropCursor",
366
- addOptions() {
367
- return {
368
- color: "currentColor",
369
- width: 1,
370
- class: void 0
371
- };
372
- },
373
- addProseMirrorPlugins() {
374
- return [
375
- dropCursor(this.options)
376
- ];
377
- }
378
- });
379
-
380
- // node_modules/prosemirror-gapcursor/dist/index.js
381
- var GapCursor = class _GapCursor extends Selection {
382
- /**
383
- Create a gap cursor.
384
- */
385
- constructor($pos) {
386
- super($pos, $pos);
387
- }
388
- map(doc, mapping) {
389
- let $pos = doc.resolve(mapping.map(this.head));
390
- return _GapCursor.valid($pos) ? new _GapCursor($pos) : Selection.near($pos);
391
- }
392
- content() {
393
- return Slice.empty;
394
- }
395
- eq(other) {
396
- return other instanceof _GapCursor && other.head == this.head;
397
- }
398
- toJSON() {
399
- return { type: "gapcursor", pos: this.head };
400
- }
401
- /**
402
- @internal
403
- */
404
- static fromJSON(doc, json) {
405
- if (typeof json.pos != "number")
406
- throw new RangeError("Invalid input for GapCursor.fromJSON");
407
- return new _GapCursor(doc.resolve(json.pos));
408
- }
409
- /**
410
- @internal
411
- */
412
- getBookmark() {
413
- return new GapBookmark(this.anchor);
414
- }
415
- /**
416
- @internal
417
- */
418
- static valid($pos) {
419
- let parent = $pos.parent;
420
- if (parent.isTextblock || !closedBefore($pos) || !closedAfter($pos))
421
- return false;
422
- let override = parent.type.spec.allowGapCursor;
423
- if (override != null)
424
- return override;
425
- let deflt = parent.contentMatchAt($pos.index()).defaultType;
426
- return deflt && deflt.isTextblock;
427
- }
428
- /**
429
- @internal
430
- */
431
- static findGapCursorFrom($pos, dir, mustMove = false) {
432
- search: for (; ; ) {
433
- if (!mustMove && _GapCursor.valid($pos))
434
- return $pos;
435
- let pos = $pos.pos, next = null;
436
- for (let d = $pos.depth; ; d--) {
437
- let parent = $pos.node(d);
438
- if (dir > 0 ? $pos.indexAfter(d) < parent.childCount : $pos.index(d) > 0) {
439
- next = parent.child(dir > 0 ? $pos.indexAfter(d) : $pos.index(d) - 1);
440
- break;
441
- } else if (d == 0) {
442
- return null;
443
- }
444
- pos += dir;
445
- let $cur = $pos.doc.resolve(pos);
446
- if (_GapCursor.valid($cur))
447
- return $cur;
448
- }
449
- for (; ; ) {
450
- let inside = dir > 0 ? next.firstChild : next.lastChild;
451
- if (!inside) {
452
- if (next.isAtom && !next.isText && !NodeSelection.isSelectable(next)) {
453
- $pos = $pos.doc.resolve(pos + next.nodeSize * dir);
454
- mustMove = false;
455
- continue search;
456
- }
457
- break;
458
- }
459
- next = inside;
460
- pos += dir;
461
- let $cur = $pos.doc.resolve(pos);
462
- if (_GapCursor.valid($cur))
463
- return $cur;
464
- }
465
- return null;
466
- }
467
- }
468
- };
469
- GapCursor.prototype.visible = false;
470
- GapCursor.findFrom = GapCursor.findGapCursorFrom;
471
- Selection.jsonID("gapcursor", GapCursor);
472
- var GapBookmark = class _GapBookmark {
473
- constructor(pos) {
474
- this.pos = pos;
475
- }
476
- map(mapping) {
477
- return new _GapBookmark(mapping.map(this.pos));
478
- }
479
- resolve(doc) {
480
- let $pos = doc.resolve(this.pos);
481
- return GapCursor.valid($pos) ? new GapCursor($pos) : Selection.near($pos);
482
- }
483
- };
484
- function closedBefore($pos) {
485
- for (let d = $pos.depth; d >= 0; d--) {
486
- let index = $pos.index(d), parent = $pos.node(d);
487
- if (index == 0) {
488
- if (parent.type.spec.isolating)
489
- return true;
490
- continue;
491
- }
492
- for (let before = parent.child(index - 1); ; before = before.lastChild) {
493
- if (before.childCount == 0 && !before.inlineContent || before.isAtom || before.type.spec.isolating)
494
- return true;
495
- if (before.inlineContent)
496
- return false;
497
- }
498
- }
499
- return true;
500
- }
501
- function closedAfter($pos) {
502
- for (let d = $pos.depth; d >= 0; d--) {
503
- let index = $pos.indexAfter(d), parent = $pos.node(d);
504
- if (index == parent.childCount) {
505
- if (parent.type.spec.isolating)
506
- return true;
507
- continue;
508
- }
509
- for (let after = parent.child(index); ; after = after.firstChild) {
510
- if (after.childCount == 0 && !after.inlineContent || after.isAtom || after.type.spec.isolating)
511
- return true;
512
- if (after.inlineContent)
513
- return false;
514
- }
515
- }
516
- return true;
517
- }
518
- function gapCursor() {
519
- return new Plugin({
520
- props: {
521
- decorations: drawGapCursor,
522
- createSelectionBetween(_view, $anchor, $head) {
523
- return $anchor.pos == $head.pos && GapCursor.valid($head) ? new GapCursor($head) : null;
524
- },
525
- handleClick,
526
- handleKeyDown,
527
- handleDOMEvents: { beforeinput }
528
- }
529
- });
530
- }
531
- var handleKeyDown = keydownHandler({
532
- "ArrowLeft": arrow("horiz", -1),
533
- "ArrowRight": arrow("horiz", 1),
534
- "ArrowUp": arrow("vert", -1),
535
- "ArrowDown": arrow("vert", 1)
536
- });
537
- function arrow(axis, dir) {
538
- const dirStr = axis == "vert" ? dir > 0 ? "down" : "up" : dir > 0 ? "right" : "left";
539
- return function(state, dispatch, view) {
540
- let sel = state.selection;
541
- let $start = dir > 0 ? sel.$to : sel.$from, mustMove = sel.empty;
542
- if (sel instanceof TextSelection) {
543
- if (!view.endOfTextblock(dirStr) || $start.depth == 0)
544
- return false;
545
- mustMove = false;
546
- $start = state.doc.resolve(dir > 0 ? $start.after() : $start.before());
547
- }
548
- let $found = GapCursor.findGapCursorFrom($start, dir, mustMove);
549
- if (!$found)
550
- return false;
551
- if (dispatch)
552
- dispatch(state.tr.setSelection(new GapCursor($found)));
553
- return true;
554
- };
555
- }
556
- function handleClick(view, pos, event) {
557
- if (!view || !view.editable)
558
- return false;
559
- let $pos = view.state.doc.resolve(pos);
560
- if (!GapCursor.valid($pos))
561
- return false;
562
- let clickPos = view.posAtCoords({ left: event.clientX, top: event.clientY });
563
- if (clickPos && clickPos.inside > -1 && NodeSelection.isSelectable(view.state.doc.nodeAt(clickPos.inside)))
564
- return false;
565
- view.dispatch(view.state.tr.setSelection(new GapCursor($pos)));
566
- return true;
567
- }
568
- function beforeinput(view, event) {
569
- if (event.inputType != "insertCompositionText" || !(view.state.selection instanceof GapCursor))
570
- return false;
571
- let { $from } = view.state.selection;
572
- let insert = $from.parent.contentMatchAt($from.index()).findWrapping(view.state.schema.nodes.text);
573
- if (!insert)
574
- return false;
575
- let frag = Fragment.empty;
576
- for (let i = insert.length - 1; i >= 0; i--)
577
- frag = Fragment.from(insert[i].createAndFill(null, frag));
578
- let tr = view.state.tr.replace($from.pos, $from.pos, new Slice(frag, 0, 0));
579
- tr.setSelection(TextSelection.near(tr.doc.resolve($from.pos + 1)));
580
- view.dispatch(tr);
581
- return false;
582
- }
583
- function drawGapCursor(state) {
584
- if (!(state.selection instanceof GapCursor))
585
- return null;
586
- let node = document.createElement("div");
587
- node.className = "ProseMirror-gapcursor";
588
- return DecorationSet.create(state.doc, [Decoration.widget(state.selection.head, node, { key: "gapcursor" })]);
589
- }
590
-
591
- // node_modules/@tiptap/extension-gapcursor/dist/index.js
592
- var Gapcursor = Extension.create({
593
- name: "gapCursor",
594
- addProseMirrorPlugins() {
595
- return [
596
- gapCursor()
597
- ];
598
- },
599
- extendNodeSchema(extension) {
600
- var _a;
601
- const context = {
602
- name: extension.name,
603
- options: extension.options,
604
- storage: extension.storage
605
- };
606
- return {
607
- allowGapCursor: (_a = callOrReturn(getExtensionField(extension, "allowGapCursor", context))) !== null && _a !== void 0 ? _a : null
608
- };
609
- }
610
- });
611
-
612
- // node_modules/@tiptap/extension-hard-break/dist/index.js
613
- var HardBreak = Node.create({
614
- name: "hardBreak",
615
- addOptions() {
616
- return {
617
- keepMarks: true,
618
- HTMLAttributes: {}
619
- };
620
- },
621
- inline: true,
622
- group: "inline",
623
- selectable: false,
624
- linebreakReplacement: true,
625
- parseHTML() {
626
- return [
627
- { tag: "br" }
628
- ];
629
- },
630
- renderHTML({ HTMLAttributes }) {
631
- return ["br", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
632
- },
633
- renderText() {
634
- return "\n";
635
- },
636
- addCommands() {
637
- return {
638
- setHardBreak: () => ({ commands, chain, state, editor }) => {
639
- return commands.first([
640
- () => commands.exitCode(),
641
- () => commands.command(() => {
642
- const { selection, storedMarks } = state;
643
- if (selection.$from.parent.type.spec.isolating) {
644
- return false;
645
- }
646
- const { keepMarks } = this.options;
647
- const { splittableMarks } = editor.extensionManager;
648
- const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();
649
- return chain().insertContent({ type: this.name }).command(({ tr, dispatch }) => {
650
- if (dispatch && marks && keepMarks) {
651
- const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));
652
- tr.ensureMarks(filteredMarks);
653
- }
654
- return true;
655
- }).run();
656
- })
657
- ]);
658
- }
659
- };
660
- },
661
- addKeyboardShortcuts() {
662
- return {
663
- "Mod-Enter": () => this.editor.commands.setHardBreak(),
664
- "Shift-Enter": () => this.editor.commands.setHardBreak()
665
- };
666
- }
667
- });
668
-
669
- // node_modules/@tiptap/extension-heading/dist/index.js
670
- var Heading = Node.create({
671
- name: "heading",
672
- addOptions() {
673
- return {
674
- levels: [1, 2, 3, 4, 5, 6],
675
- HTMLAttributes: {}
676
- };
677
- },
678
- content: "inline*",
679
- group: "block",
680
- defining: true,
681
- addAttributes() {
682
- return {
683
- level: {
684
- default: 1,
685
- rendered: false
686
- }
687
- };
688
- },
689
- parseHTML() {
690
- return this.options.levels.map((level) => ({
691
- tag: `h${level}`,
692
- attrs: { level }
693
- }));
694
- },
695
- renderHTML({ node, HTMLAttributes }) {
696
- const hasLevel = this.options.levels.includes(node.attrs.level);
697
- const level = hasLevel ? node.attrs.level : this.options.levels[0];
698
- return [`h${level}`, mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
699
- },
700
- addCommands() {
701
- return {
702
- setHeading: (attributes) => ({ commands }) => {
703
- if (!this.options.levels.includes(attributes.level)) {
704
- return false;
705
- }
706
- return commands.setNode(this.name, attributes);
707
- },
708
- toggleHeading: (attributes) => ({ commands }) => {
709
- if (!this.options.levels.includes(attributes.level)) {
710
- return false;
711
- }
712
- return commands.toggleNode(this.name, "paragraph", attributes);
713
- }
714
- };
715
- },
716
- addKeyboardShortcuts() {
717
- return this.options.levels.reduce((items, level) => ({
718
- ...items,
719
- ...{
720
- [`Mod-Alt-${level}`]: () => this.editor.commands.toggleHeading({ level })
721
- }
722
- }), {});
723
- },
724
- addInputRules() {
725
- return this.options.levels.map((level) => {
726
- return textblockTypeInputRule({
727
- find: new RegExp(`^(#{${Math.min(...this.options.levels)},${level}})\\s$`),
728
- type: this.type,
729
- getAttributes: {
730
- level
731
- }
732
- });
733
- });
734
- }
735
- });
736
-
737
- // node_modules/@tiptap/extension-highlight/dist/index.js
738
- var inputRegex3 = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/;
739
- var pasteRegex = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g;
740
- var Highlight = Mark.create({
741
- name: "highlight",
742
- addOptions() {
743
- return {
744
- multicolor: false,
745
- HTMLAttributes: {}
746
- };
747
- },
748
- addAttributes() {
749
- if (!this.options.multicolor) {
750
- return {};
751
- }
752
- return {
753
- color: {
754
- default: null,
755
- parseHTML: (element) => element.getAttribute("data-color") || element.style.backgroundColor,
756
- renderHTML: (attributes) => {
757
- if (!attributes.color) {
758
- return {};
759
- }
760
- return {
761
- "data-color": attributes.color,
762
- style: `background-color: ${attributes.color}; color: inherit`
763
- };
764
- }
765
- }
766
- };
767
- },
768
- parseHTML() {
769
- return [
770
- {
771
- tag: "mark"
772
- }
773
- ];
774
- },
775
- renderHTML({ HTMLAttributes }) {
776
- return ["mark", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
777
- },
778
- renderMarkdown: (node, h) => {
779
- return `==${h.renderChildren(node)}==`;
780
- },
781
- parseMarkdown: (token, h) => {
782
- return h.applyMark("highlight", h.parseInline(token.tokens || []));
783
- },
784
- markdownTokenizer: {
785
- name: "highlight",
786
- level: "inline",
787
- start: (src) => src.indexOf("=="),
788
- tokenize(src, _, h) {
789
- const rule = /^(==)([^=]+)(==)/;
790
- const match = rule.exec(src);
791
- if (match) {
792
- const innerContent = match[2].trim();
793
- const children = h.inlineTokens(innerContent);
794
- return {
795
- type: "highlight",
796
- raw: match[0],
797
- text: innerContent,
798
- tokens: children
799
- };
800
- }
801
- }
802
- },
803
- addCommands() {
804
- return {
805
- setHighlight: (attributes) => ({ commands }) => {
806
- return commands.setMark(this.name, attributes);
807
- },
808
- toggleHighlight: (attributes) => ({ commands }) => {
809
- return commands.toggleMark(this.name, attributes);
810
- },
811
- unsetHighlight: () => ({ commands }) => {
812
- return commands.unsetMark(this.name);
813
- }
814
- };
815
- },
816
- addKeyboardShortcuts() {
817
- return {
818
- "Mod-Shift-h": () => this.editor.commands.toggleHighlight()
819
- };
820
- },
821
- addInputRules() {
822
- return [
823
- markInputRule({
824
- find: inputRegex3,
825
- type: this.type
826
- })
827
- ];
828
- },
829
- addPasteRules() {
830
- return [
831
- markPasteRule({
832
- find: pasteRegex,
833
- type: this.type
834
- })
835
- ];
836
- }
837
- });
838
- var index_default = Highlight;
839
-
840
- // node_modules/@tiptap/extension-horizontal-rule/dist/index.js
841
- var HorizontalRule = Node.create({
842
- name: "horizontalRule",
843
- addOptions() {
844
- return {
845
- HTMLAttributes: {}
846
- };
847
- },
848
- group: "block",
849
- parseHTML() {
850
- return [{ tag: "hr" }];
851
- },
852
- renderHTML({ HTMLAttributes }) {
853
- return ["hr", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
854
- },
855
- addCommands() {
856
- return {
857
- setHorizontalRule: () => ({ chain, state }) => {
858
- const { selection } = state;
859
- const { $from: $originFrom, $to: $originTo } = selection;
860
- const currentChain = chain();
861
- if ($originFrom.parentOffset === 0) {
862
- currentChain.insertContentAt({
863
- from: Math.max($originFrom.pos - 1, 0),
864
- to: $originTo.pos
865
- }, {
866
- type: this.name
867
- });
868
- } else if (isNodeSelection(selection)) {
869
- currentChain.insertContentAt($originTo.pos, {
870
- type: this.name
871
- });
872
- } else {
873
- currentChain.insertContent({ type: this.name });
874
- }
875
- return currentChain.command(({ tr, dispatch }) => {
876
- var _a;
877
- if (dispatch) {
878
- const { $to } = tr.selection;
879
- const posAfter = $to.end();
880
- if ($to.nodeAfter) {
881
- if ($to.nodeAfter.isTextblock) {
882
- tr.setSelection(TextSelection.create(tr.doc, $to.pos + 1));
883
- } else if ($to.nodeAfter.isBlock) {
884
- tr.setSelection(NodeSelection.create(tr.doc, $to.pos));
885
- } else {
886
- tr.setSelection(TextSelection.create(tr.doc, $to.pos));
887
- }
888
- } else {
889
- const node = (_a = $to.parent.type.contentMatch.defaultType) === null || _a === void 0 ? void 0 : _a.create();
890
- if (node) {
891
- tr.insert(posAfter, node);
892
- tr.setSelection(TextSelection.create(tr.doc, posAfter + 1));
893
- }
894
- }
895
- tr.scrollIntoView();
896
- }
897
- return true;
898
- }).run();
899
- }
900
- };
901
- },
902
- addInputRules() {
903
- return [
904
- nodeInputRule({
905
- find: /^(?:---|—-|___\s|\*\*\*\s)$/,
906
- type: this.type
907
- })
908
- ];
909
- }
910
- });
911
-
912
- // node_modules/@tiptap/extension-italic/dist/index.js
913
- var starInputRegex2 = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/;
914
- var starPasteRegex2 = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g;
915
- var underscoreInputRegex2 = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/;
916
- var underscorePasteRegex2 = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g;
917
- var Italic = Mark.create({
918
- name: "italic",
919
- addOptions() {
920
- return {
921
- HTMLAttributes: {}
922
- };
923
- },
924
- parseHTML() {
925
- return [
926
- {
927
- tag: "em"
928
- },
929
- {
930
- tag: "i",
931
- getAttrs: (node) => node.style.fontStyle !== "normal" && null
932
- },
933
- {
934
- style: "font-style=normal",
935
- clearMark: (mark) => mark.type.name === this.name
936
- },
937
- {
938
- style: "font-style=italic"
939
- }
940
- ];
941
- },
942
- renderHTML({ HTMLAttributes }) {
943
- return ["em", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
944
- },
945
- addCommands() {
946
- return {
947
- setItalic: () => ({ commands }) => {
948
- return commands.setMark(this.name);
949
- },
950
- toggleItalic: () => ({ commands }) => {
951
- return commands.toggleMark(this.name);
952
- },
953
- unsetItalic: () => ({ commands }) => {
954
- return commands.unsetMark(this.name);
955
- }
956
- };
957
- },
958
- addKeyboardShortcuts() {
959
- return {
960
- "Mod-i": () => this.editor.commands.toggleItalic(),
961
- "Mod-I": () => this.editor.commands.toggleItalic()
962
- };
963
- },
964
- addInputRules() {
965
- return [
966
- markInputRule({
967
- find: starInputRegex2,
968
- type: this.type
969
- }),
970
- markInputRule({
971
- find: underscoreInputRegex2,
972
- type: this.type
973
- })
974
- ];
975
- },
976
- addPasteRules() {
977
- return [
978
- markPasteRule({
979
- find: starPasteRegex2,
980
- type: this.type
981
- }),
982
- markPasteRule({
983
- find: underscorePasteRegex2,
984
- type: this.type
985
- })
986
- ];
987
- }
988
- });
989
-
990
- // node_modules/@tiptap/extension-list-item/dist/index.js
991
- var ListItem = Node.create({
992
- name: "listItem",
993
- addOptions() {
994
- return {
995
- HTMLAttributes: {},
996
- bulletListTypeName: "bulletList",
997
- orderedListTypeName: "orderedList"
998
- };
999
- },
1000
- content: "paragraph block*",
1001
- defining: true,
1002
- parseHTML() {
1003
- return [
1004
- {
1005
- tag: "li"
1006
- }
1007
- ];
1008
- },
1009
- renderHTML({ HTMLAttributes }) {
1010
- return ["li", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
1011
- },
1012
- addKeyboardShortcuts() {
1013
- return {
1014
- Enter: () => this.editor.commands.splitListItem(this.name),
1015
- Tab: () => this.editor.commands.sinkListItem(this.name),
1016
- "Shift-Tab": () => this.editor.commands.liftListItem(this.name)
1017
- };
1018
- }
1019
- });
1020
-
1021
- // node_modules/@tiptap/extension-ordered-list/dist/index.js
1022
- var ListItemName2 = "listItem";
1023
- var TextStyleName2 = "textStyle";
1024
- var inputRegex4 = /^(\d+)\.\s$/;
1025
- var OrderedList = Node.create({
1026
- name: "orderedList",
1027
- addOptions() {
1028
- return {
1029
- itemTypeName: "listItem",
1030
- HTMLAttributes: {},
1031
- keepMarks: false,
1032
- keepAttributes: false
1033
- };
1034
- },
1035
- group: "block list",
1036
- content() {
1037
- return `${this.options.itemTypeName}+`;
1038
- },
1039
- addAttributes() {
1040
- return {
1041
- start: {
1042
- default: 1,
1043
- parseHTML: (element) => {
1044
- return element.hasAttribute("start") ? parseInt(element.getAttribute("start") || "", 10) : 1;
1045
- }
1046
- },
1047
- type: {
1048
- default: void 0,
1049
- parseHTML: (element) => element.getAttribute("type")
1050
- }
1051
- };
1052
- },
1053
- parseHTML() {
1054
- return [
1055
- {
1056
- tag: "ol"
1057
- }
1058
- ];
1059
- },
1060
- renderHTML({ HTMLAttributes }) {
1061
- const { start, ...attributesWithoutStart } = HTMLAttributes;
1062
- return start === 1 ? ["ol", mergeAttributes(this.options.HTMLAttributes, attributesWithoutStart), 0] : ["ol", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
1063
- },
1064
- addCommands() {
1065
- return {
1066
- toggleOrderedList: () => ({ commands, chain }) => {
1067
- if (this.options.keepAttributes) {
1068
- return chain().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ListItemName2, this.editor.getAttributes(TextStyleName2)).run();
1069
- }
1070
- return commands.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks);
1071
- }
1072
- };
1073
- },
1074
- addKeyboardShortcuts() {
1075
- return {
1076
- "Mod-Shift-7": () => this.editor.commands.toggleOrderedList()
1077
- };
1078
- },
1079
- addInputRules() {
1080
- let inputRule = wrappingInputRule({
1081
- find: inputRegex4,
1082
- type: this.type,
1083
- getAttributes: (match) => ({ start: +match[1] }),
1084
- joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1]
1085
- });
1086
- if (this.options.keepMarks || this.options.keepAttributes) {
1087
- inputRule = wrappingInputRule({
1088
- find: inputRegex4,
1089
- type: this.type,
1090
- keepMarks: this.options.keepMarks,
1091
- keepAttributes: this.options.keepAttributes,
1092
- getAttributes: (match) => ({ start: +match[1], ...this.editor.getAttributes(TextStyleName2) }),
1093
- joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1],
1094
- editor: this.editor
1095
- });
1096
- }
1097
- return [
1098
- inputRule
1099
- ];
1100
- }
1101
- });
1102
-
1103
- // node_modules/@tiptap/extension-paragraph/dist/index.js
1104
- var Paragraph = Node.create({
1105
- name: "paragraph",
1106
- priority: 1e3,
1107
- addOptions() {
1108
- return {
1109
- HTMLAttributes: {}
1110
- };
1111
- },
1112
- group: "block",
1113
- content: "inline*",
1114
- parseHTML() {
1115
- return [
1116
- { tag: "p" }
1117
- ];
1118
- },
1119
- renderHTML({ HTMLAttributes }) {
1120
- return ["p", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
1121
- },
1122
- addCommands() {
1123
- return {
1124
- setParagraph: () => ({ commands }) => {
1125
- return commands.setNode(this.name);
1126
- }
1127
- };
1128
- },
1129
- addKeyboardShortcuts() {
1130
- return {
1131
- "Mod-Alt-0": () => this.editor.commands.setParagraph()
1132
- };
1133
- }
1134
- });
1135
-
1136
- // node_modules/@tiptap/extension-strike/dist/index.js
1137
- var inputRegex5 = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/;
1138
- var pasteRegex2 = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g;
1139
- var Strike = Mark.create({
1140
- name: "strike",
1141
- addOptions() {
1142
- return {
1143
- HTMLAttributes: {}
1144
- };
1145
- },
1146
- parseHTML() {
1147
- return [
1148
- {
1149
- tag: "s"
1150
- },
1151
- {
1152
- tag: "del"
1153
- },
1154
- {
1155
- tag: "strike"
1156
- },
1157
- {
1158
- style: "text-decoration",
1159
- consuming: false,
1160
- getAttrs: (style) => style.includes("line-through") ? {} : false
1161
- }
1162
- ];
1163
- },
1164
- renderHTML({ HTMLAttributes }) {
1165
- return ["s", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
1166
- },
1167
- addCommands() {
1168
- return {
1169
- setStrike: () => ({ commands }) => {
1170
- return commands.setMark(this.name);
1171
- },
1172
- toggleStrike: () => ({ commands }) => {
1173
- return commands.toggleMark(this.name);
1174
- },
1175
- unsetStrike: () => ({ commands }) => {
1176
- return commands.unsetMark(this.name);
1177
- }
1178
- };
1179
- },
1180
- addKeyboardShortcuts() {
1181
- return {
1182
- "Mod-Shift-s": () => this.editor.commands.toggleStrike()
1183
- };
1184
- },
1185
- addInputRules() {
1186
- return [
1187
- markInputRule({
1188
- find: inputRegex5,
1189
- type: this.type
1190
- })
1191
- ];
1192
- },
1193
- addPasteRules() {
1194
- return [
1195
- markPasteRule({
1196
- find: pasteRegex2,
1197
- type: this.type
1198
- })
1199
- ];
1200
- }
1201
- });
1202
-
1203
- // node_modules/@tiptap/extension-subscript/dist/index.js
1204
- var Subscript = Mark.create({
1205
- name: "subscript",
1206
- addOptions() {
1207
- return {
1208
- HTMLAttributes: {}
1209
- };
1210
- },
1211
- parseHTML() {
1212
- return [
1213
- {
1214
- tag: "sub"
1215
- },
1216
- {
1217
- style: "vertical-align",
1218
- getAttrs(value) {
1219
- if (value !== "sub") {
1220
- return false;
1221
- }
1222
- return null;
1223
- }
1224
- }
1225
- ];
1226
- },
1227
- renderHTML({ HTMLAttributes }) {
1228
- return ["sub", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
1229
- },
1230
- addCommands() {
1231
- return {
1232
- setSubscript: () => ({ commands }) => {
1233
- return commands.setMark(this.name);
1234
- },
1235
- toggleSubscript: () => ({ commands }) => {
1236
- return commands.toggleMark(this.name);
1237
- },
1238
- unsetSubscript: () => ({ commands }) => {
1239
- return commands.unsetMark(this.name);
1240
- }
1241
- };
1242
- },
1243
- addKeyboardShortcuts() {
1244
- return {
1245
- "Mod-,": () => this.editor.commands.toggleSubscript()
1246
- };
1247
- }
1248
- });
1249
-
1250
- // node_modules/@tiptap/extension-superscript/dist/index.js
1251
- var Superscript = Mark.create({
1252
- name: "superscript",
1253
- addOptions() {
1254
- return {
1255
- HTMLAttributes: {}
1256
- };
1257
- },
1258
- parseHTML() {
1259
- return [
1260
- {
1261
- tag: "sup"
1262
- },
1263
- {
1264
- style: "vertical-align",
1265
- getAttrs(value) {
1266
- if (value !== "super") {
1267
- return false;
1268
- }
1269
- return null;
1270
- }
1271
- }
1272
- ];
1273
- },
1274
- renderHTML({ HTMLAttributes }) {
1275
- return ["sup", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
1276
- },
1277
- addCommands() {
1278
- return {
1279
- setSuperscript: () => ({ commands }) => {
1280
- return commands.setMark(this.name);
1281
- },
1282
- toggleSuperscript: () => ({ commands }) => {
1283
- return commands.toggleMark(this.name);
1284
- },
1285
- unsetSuperscript: () => ({ commands }) => {
1286
- return commands.unsetMark(this.name);
1287
- }
1288
- };
1289
- },
1290
- addKeyboardShortcuts() {
1291
- return {
1292
- "Mod-.": () => this.editor.commands.toggleSuperscript()
1293
- };
1294
- }
1295
- });
1296
-
1297
- // node_modules/prosemirror-tables/dist/index.js
1298
- var readFromCache;
1299
- var addToCache;
1300
- if (typeof WeakMap != "undefined") {
1301
- let cache = /* @__PURE__ */ new WeakMap();
1302
- readFromCache = (key) => cache.get(key);
1303
- addToCache = (key, value) => {
1304
- cache.set(key, value);
1305
- return value;
1306
- };
1307
- } else {
1308
- const cache = [];
1309
- const cacheSize = 10;
1310
- let cachePos = 0;
1311
- readFromCache = (key) => {
1312
- for (let i = 0; i < cache.length; i += 2)
1313
- if (cache[i] == key)
1314
- return cache[i + 1];
1315
- };
1316
- addToCache = (key, value) => {
1317
- if (cachePos == cacheSize)
1318
- cachePos = 0;
1319
- cache[cachePos++] = key;
1320
- return cache[cachePos++] = value;
1321
- };
1322
- }
1323
- var TableMap = class {
1324
- constructor(width, height, map, problems) {
1325
- this.width = width;
1326
- this.height = height;
1327
- this.map = map;
1328
- this.problems = problems;
1329
- }
1330
- // Find the dimensions of the cell at the given position.
1331
- findCell(pos) {
1332
- for (let i = 0; i < this.map.length; i++) {
1333
- const curPos = this.map[i];
1334
- if (curPos != pos)
1335
- continue;
1336
- const left = i % this.width;
1337
- const top = i / this.width | 0;
1338
- let right = left + 1;
1339
- let bottom = top + 1;
1340
- for (let j = 1; right < this.width && this.map[i + j] == curPos; j++) {
1341
- right++;
1342
- }
1343
- for (let j = 1; bottom < this.height && this.map[i + this.width * j] == curPos; j++) {
1344
- bottom++;
1345
- }
1346
- return { left, top, right, bottom };
1347
- }
1348
- throw new RangeError(`No cell with offset ${pos} found`);
1349
- }
1350
- // Find the left side of the cell at the given position.
1351
- colCount(pos) {
1352
- for (let i = 0; i < this.map.length; i++) {
1353
- if (this.map[i] == pos) {
1354
- return i % this.width;
1355
- }
1356
- }
1357
- throw new RangeError(`No cell with offset ${pos} found`);
1358
- }
1359
- // Find the next cell in the given direction, starting from the cell
1360
- // at `pos`, if any.
1361
- nextCell(pos, axis, dir) {
1362
- const { left, right, top, bottom } = this.findCell(pos);
1363
- if (axis == "horiz") {
1364
- if (dir < 0 ? left == 0 : right == this.width)
1365
- return null;
1366
- return this.map[top * this.width + (dir < 0 ? left - 1 : right)];
1367
- } else {
1368
- if (dir < 0 ? top == 0 : bottom == this.height)
1369
- return null;
1370
- return this.map[left + this.width * (dir < 0 ? top - 1 : bottom)];
1371
- }
1372
- }
1373
- // Get the rectangle spanning the two given cells.
1374
- rectBetween(a, b) {
1375
- const {
1376
- left: leftA,
1377
- right: rightA,
1378
- top: topA,
1379
- bottom: bottomA
1380
- } = this.findCell(a);
1381
- const {
1382
- left: leftB,
1383
- right: rightB,
1384
- top: topB,
1385
- bottom: bottomB
1386
- } = this.findCell(b);
1387
- return {
1388
- left: Math.min(leftA, leftB),
1389
- top: Math.min(topA, topB),
1390
- right: Math.max(rightA, rightB),
1391
- bottom: Math.max(bottomA, bottomB)
1392
- };
1393
- }
1394
- // Return the position of all cells that have the top left corner in
1395
- // the given rectangle.
1396
- cellsInRect(rect) {
1397
- const result = [];
1398
- const seen = {};
1399
- for (let row = rect.top; row < rect.bottom; row++) {
1400
- for (let col = rect.left; col < rect.right; col++) {
1401
- const index = row * this.width + col;
1402
- const pos = this.map[index];
1403
- if (seen[pos])
1404
- continue;
1405
- seen[pos] = true;
1406
- if (col == rect.left && col && this.map[index - 1] == pos || row == rect.top && row && this.map[index - this.width] == pos) {
1407
- continue;
1408
- }
1409
- result.push(pos);
1410
- }
1411
- }
1412
- return result;
1413
- }
1414
- // Return the position at which the cell at the given row and column
1415
- // starts, or would start, if a cell started there.
1416
- positionAt(row, col, table) {
1417
- for (let i = 0, rowStart = 0; ; i++) {
1418
- const rowEnd = rowStart + table.child(i).nodeSize;
1419
- if (i == row) {
1420
- let index = col + row * this.width;
1421
- const rowEndIndex = (row + 1) * this.width;
1422
- while (index < rowEndIndex && this.map[index] < rowStart)
1423
- index++;
1424
- return index == rowEndIndex ? rowEnd - 1 : this.map[index];
1425
- }
1426
- rowStart = rowEnd;
1427
- }
1428
- }
1429
- // Find the table map for the given table node.
1430
- static get(table) {
1431
- return readFromCache(table) || addToCache(table, computeMap(table));
1432
- }
1433
- };
1434
- function computeMap(table) {
1435
- if (table.type.spec.tableRole != "table")
1436
- throw new RangeError("Not a table node: " + table.type.name);
1437
- const width = findWidth(table), height = table.childCount;
1438
- const map = [];
1439
- let mapPos = 0;
1440
- let problems = null;
1441
- const colWidths = [];
1442
- for (let i = 0, e = width * height; i < e; i++)
1443
- map[i] = 0;
1444
- for (let row = 0, pos = 0; row < height; row++) {
1445
- const rowNode = table.child(row);
1446
- pos++;
1447
- for (let i = 0; ; i++) {
1448
- while (mapPos < map.length && map[mapPos] != 0)
1449
- mapPos++;
1450
- if (i == rowNode.childCount)
1451
- break;
1452
- const cellNode = rowNode.child(i);
1453
- const { colspan, rowspan, colwidth } = cellNode.attrs;
1454
- for (let h = 0; h < rowspan; h++) {
1455
- if (h + row >= height) {
1456
- (problems || (problems = [])).push({
1457
- type: "overlong_rowspan",
1458
- pos,
1459
- n: rowspan - h
1460
- });
1461
- break;
1462
- }
1463
- const start = mapPos + h * width;
1464
- for (let w = 0; w < colspan; w++) {
1465
- if (map[start + w] == 0)
1466
- map[start + w] = pos;
1467
- else
1468
- (problems || (problems = [])).push({
1469
- type: "collision",
1470
- row,
1471
- pos,
1472
- n: colspan - w
1473
- });
1474
- const colW = colwidth && colwidth[w];
1475
- if (colW) {
1476
- const widthIndex = (start + w) % width * 2, prev = colWidths[widthIndex];
1477
- if (prev == null || prev != colW && colWidths[widthIndex + 1] == 1) {
1478
- colWidths[widthIndex] = colW;
1479
- colWidths[widthIndex + 1] = 1;
1480
- } else if (prev == colW) {
1481
- colWidths[widthIndex + 1]++;
1482
- }
1483
- }
1484
- }
1485
- }
1486
- mapPos += colspan;
1487
- pos += cellNode.nodeSize;
1488
- }
1489
- const expectedPos = (row + 1) * width;
1490
- let missing = 0;
1491
- while (mapPos < expectedPos)
1492
- if (map[mapPos++] == 0)
1493
- missing++;
1494
- if (missing)
1495
- (problems || (problems = [])).push({ type: "missing", row, n: missing });
1496
- pos++;
1497
- }
1498
- const tableMap = new TableMap(width, height, map, problems);
1499
- let badWidths = false;
1500
- for (let i = 0; !badWidths && i < colWidths.length; i += 2)
1501
- if (colWidths[i] != null && colWidths[i + 1] < height)
1502
- badWidths = true;
1503
- if (badWidths)
1504
- findBadColWidths(tableMap, colWidths, table);
1505
- return tableMap;
1506
- }
1507
- function findWidth(table) {
1508
- let width = -1;
1509
- let hasRowSpan = false;
1510
- for (let row = 0; row < table.childCount; row++) {
1511
- const rowNode = table.child(row);
1512
- let rowWidth = 0;
1513
- if (hasRowSpan)
1514
- for (let j = 0; j < row; j++) {
1515
- const prevRow = table.child(j);
1516
- for (let i = 0; i < prevRow.childCount; i++) {
1517
- const cell = prevRow.child(i);
1518
- if (j + cell.attrs.rowspan > row)
1519
- rowWidth += cell.attrs.colspan;
1520
- }
1521
- }
1522
- for (let i = 0; i < rowNode.childCount; i++) {
1523
- const cell = rowNode.child(i);
1524
- rowWidth += cell.attrs.colspan;
1525
- if (cell.attrs.rowspan > 1)
1526
- hasRowSpan = true;
1527
- }
1528
- if (width == -1)
1529
- width = rowWidth;
1530
- else if (width != rowWidth)
1531
- width = Math.max(width, rowWidth);
1532
- }
1533
- return width;
1534
- }
1535
- function findBadColWidths(map, colWidths, table) {
1536
- if (!map.problems)
1537
- map.problems = [];
1538
- const seen = {};
1539
- for (let i = 0; i < map.map.length; i++) {
1540
- const pos = map.map[i];
1541
- if (seen[pos])
1542
- continue;
1543
- seen[pos] = true;
1544
- const node = table.nodeAt(pos);
1545
- if (!node) {
1546
- throw new RangeError(`No cell with offset ${pos} found`);
1547
- }
1548
- let updated = null;
1549
- const attrs = node.attrs;
1550
- for (let j = 0; j < attrs.colspan; j++) {
1551
- const col = (i + j) % map.width;
1552
- const colWidth = colWidths[col * 2];
1553
- if (colWidth != null && (!attrs.colwidth || attrs.colwidth[j] != colWidth))
1554
- (updated || (updated = freshColWidth(attrs)))[j] = colWidth;
1555
- }
1556
- if (updated)
1557
- map.problems.unshift({
1558
- type: "colwidth mismatch",
1559
- pos,
1560
- colwidth: updated
1561
- });
1562
- }
1563
- }
1564
- function freshColWidth(attrs) {
1565
- if (attrs.colwidth)
1566
- return attrs.colwidth.slice();
1567
- const result = [];
1568
- for (let i = 0; i < attrs.colspan; i++)
1569
- result.push(0);
1570
- return result;
1571
- }
1572
- function tableNodeTypes(schema) {
1573
- let result = schema.cached.tableNodeTypes;
1574
- if (!result) {
1575
- result = schema.cached.tableNodeTypes = {};
1576
- for (const name in schema.nodes) {
1577
- const type = schema.nodes[name], role = type.spec.tableRole;
1578
- if (role)
1579
- result[role] = type;
1580
- }
1581
- }
1582
- return result;
1583
- }
1584
- var tableEditingKey = new PluginKey("selectingCells");
1585
- function cellAround($pos) {
1586
- for (let d = $pos.depth - 1; d > 0; d--)
1587
- if ($pos.node(d).type.spec.tableRole == "row")
1588
- return $pos.node(0).resolve($pos.before(d + 1));
1589
- return null;
1590
- }
1591
- function cellWrapping($pos) {
1592
- for (let d = $pos.depth; d > 0; d--) {
1593
- const role = $pos.node(d).type.spec.tableRole;
1594
- if (role === "cell" || role === "header_cell")
1595
- return $pos.node(d);
1596
- }
1597
- return null;
1598
- }
1599
- function isInTable(state) {
1600
- const $head = state.selection.$head;
1601
- for (let d = $head.depth; d > 0; d--)
1602
- if ($head.node(d).type.spec.tableRole == "row")
1603
- return true;
1604
- return false;
1605
- }
1606
- function selectionCell(state) {
1607
- const sel = state.selection;
1608
- if ("$anchorCell" in sel && sel.$anchorCell) {
1609
- return sel.$anchorCell.pos > sel.$headCell.pos ? sel.$anchorCell : sel.$headCell;
1610
- } else if ("node" in sel && sel.node && sel.node.type.spec.tableRole == "cell") {
1611
- return sel.$anchor;
1612
- }
1613
- const $cell = cellAround(sel.$head) || cellNear(sel.$head);
1614
- if ($cell) {
1615
- return $cell;
1616
- }
1617
- throw new RangeError(`No cell found around position ${sel.head}`);
1618
- }
1619
- function cellNear($pos) {
1620
- for (let after = $pos.nodeAfter, pos = $pos.pos; after; after = after.firstChild, pos++) {
1621
- const role = after.type.spec.tableRole;
1622
- if (role == "cell" || role == "header_cell")
1623
- return $pos.doc.resolve(pos);
1624
- }
1625
- for (let before = $pos.nodeBefore, pos = $pos.pos; before; before = before.lastChild, pos--) {
1626
- const role = before.type.spec.tableRole;
1627
- if (role == "cell" || role == "header_cell")
1628
- return $pos.doc.resolve(pos - before.nodeSize);
1629
- }
1630
- }
1631
- function pointsAtCell($pos) {
1632
- return $pos.parent.type.spec.tableRole == "row" && !!$pos.nodeAfter;
1633
- }
1634
- function moveCellForward($pos) {
1635
- return $pos.node(0).resolve($pos.pos + $pos.nodeAfter.nodeSize);
1636
- }
1637
- function inSameTable($cellA, $cellB) {
1638
- return $cellA.depth == $cellB.depth && $cellA.pos >= $cellB.start(-1) && $cellA.pos <= $cellB.end(-1);
1639
- }
1640
- function nextCell($pos, axis, dir) {
1641
- const table = $pos.node(-1);
1642
- const map = TableMap.get(table);
1643
- const tableStart = $pos.start(-1);
1644
- const moved = map.nextCell($pos.pos - tableStart, axis, dir);
1645
- return moved == null ? null : $pos.node(0).resolve(tableStart + moved);
1646
- }
1647
- function removeColSpan(attrs, pos, n = 1) {
1648
- const result = { ...attrs, colspan: attrs.colspan - n };
1649
- if (result.colwidth) {
1650
- result.colwidth = result.colwidth.slice();
1651
- result.colwidth.splice(pos, n);
1652
- if (!result.colwidth.some((w) => w > 0))
1653
- result.colwidth = null;
1654
- }
1655
- return result;
1656
- }
1657
- function addColSpan(attrs, pos, n = 1) {
1658
- const result = { ...attrs, colspan: attrs.colspan + n };
1659
- if (result.colwidth) {
1660
- result.colwidth = result.colwidth.slice();
1661
- for (let i = 0; i < n; i++)
1662
- result.colwidth.splice(pos, 0, 0);
1663
- }
1664
- return result;
1665
- }
1666
- function columnIsHeader(map, table, col) {
1667
- const headerCell = tableNodeTypes(table.type.schema).header_cell;
1668
- for (let row = 0; row < map.height; row++)
1669
- if (table.nodeAt(map.map[col + row * map.width]).type != headerCell)
1670
- return false;
1671
- return true;
1672
- }
1673
- var CellSelection = class _CellSelection extends Selection {
1674
- // A table selection is identified by its anchor and head cells. The
1675
- // positions given to this constructor should point _before_ two
1676
- // cells in the same table. They may be the same, to select a single
1677
- // cell.
1678
- constructor($anchorCell, $headCell = $anchorCell) {
1679
- const table = $anchorCell.node(-1);
1680
- const map = TableMap.get(table);
1681
- const tableStart = $anchorCell.start(-1);
1682
- const rect = map.rectBetween(
1683
- $anchorCell.pos - tableStart,
1684
- $headCell.pos - tableStart
1685
- );
1686
- const doc = $anchorCell.node(0);
1687
- const cells = map.cellsInRect(rect).filter((p) => p != $headCell.pos - tableStart);
1688
- cells.unshift($headCell.pos - tableStart);
1689
- const ranges = cells.map((pos) => {
1690
- const cell = table.nodeAt(pos);
1691
- if (!cell) {
1692
- throw RangeError(`No cell with offset ${pos} found`);
1693
- }
1694
- const from = tableStart + pos + 1;
1695
- return new SelectionRange(
1696
- doc.resolve(from),
1697
- doc.resolve(from + cell.content.size)
1698
- );
1699
- });
1700
- super(ranges[0].$from, ranges[0].$to, ranges);
1701
- this.$anchorCell = $anchorCell;
1702
- this.$headCell = $headCell;
1703
- }
1704
- map(doc, mapping) {
1705
- const $anchorCell = doc.resolve(mapping.map(this.$anchorCell.pos));
1706
- const $headCell = doc.resolve(mapping.map(this.$headCell.pos));
1707
- if (pointsAtCell($anchorCell) && pointsAtCell($headCell) && inSameTable($anchorCell, $headCell)) {
1708
- const tableChanged = this.$anchorCell.node(-1) != $anchorCell.node(-1);
1709
- if (tableChanged && this.isRowSelection())
1710
- return _CellSelection.rowSelection($anchorCell, $headCell);
1711
- else if (tableChanged && this.isColSelection())
1712
- return _CellSelection.colSelection($anchorCell, $headCell);
1713
- else
1714
- return new _CellSelection($anchorCell, $headCell);
1715
- }
1716
- return TextSelection.between($anchorCell, $headCell);
1717
- }
1718
- // Returns a rectangular slice of table rows containing the selected
1719
- // cells.
1720
- content() {
1721
- const table = this.$anchorCell.node(-1);
1722
- const map = TableMap.get(table);
1723
- const tableStart = this.$anchorCell.start(-1);
1724
- const rect = map.rectBetween(
1725
- this.$anchorCell.pos - tableStart,
1726
- this.$headCell.pos - tableStart
1727
- );
1728
- const seen = {};
1729
- const rows = [];
1730
- for (let row = rect.top; row < rect.bottom; row++) {
1731
- const rowContent = [];
1732
- for (let index = row * map.width + rect.left, col = rect.left; col < rect.right; col++, index++) {
1733
- const pos = map.map[index];
1734
- if (seen[pos])
1735
- continue;
1736
- seen[pos] = true;
1737
- const cellRect = map.findCell(pos);
1738
- let cell = table.nodeAt(pos);
1739
- if (!cell) {
1740
- throw RangeError(`No cell with offset ${pos} found`);
1741
- }
1742
- const extraLeft = rect.left - cellRect.left;
1743
- const extraRight = cellRect.right - rect.right;
1744
- if (extraLeft > 0 || extraRight > 0) {
1745
- let attrs = cell.attrs;
1746
- if (extraLeft > 0) {
1747
- attrs = removeColSpan(attrs, 0, extraLeft);
1748
- }
1749
- if (extraRight > 0) {
1750
- attrs = removeColSpan(
1751
- attrs,
1752
- attrs.colspan - extraRight,
1753
- extraRight
1754
- );
1755
- }
1756
- if (cellRect.left < rect.left) {
1757
- cell = cell.type.createAndFill(attrs);
1758
- if (!cell) {
1759
- throw RangeError(
1760
- `Could not create cell with attrs ${JSON.stringify(attrs)}`
1761
- );
1762
- }
1763
- } else {
1764
- cell = cell.type.create(attrs, cell.content);
1765
- }
1766
- }
1767
- if (cellRect.top < rect.top || cellRect.bottom > rect.bottom) {
1768
- const attrs = {
1769
- ...cell.attrs,
1770
- rowspan: Math.min(cellRect.bottom, rect.bottom) - Math.max(cellRect.top, rect.top)
1771
- };
1772
- if (cellRect.top < rect.top) {
1773
- cell = cell.type.createAndFill(attrs);
1774
- } else {
1775
- cell = cell.type.create(attrs, cell.content);
1776
- }
1777
- }
1778
- rowContent.push(cell);
1779
- }
1780
- rows.push(table.child(row).copy(Fragment.from(rowContent)));
1781
- }
1782
- const fragment = this.isColSelection() && this.isRowSelection() ? table : rows;
1783
- return new Slice(Fragment.from(fragment), 1, 1);
1784
- }
1785
- replace(tr, content = Slice.empty) {
1786
- const mapFrom = tr.steps.length, ranges = this.ranges;
1787
- for (let i = 0; i < ranges.length; i++) {
1788
- const { $from, $to } = ranges[i], mapping = tr.mapping.slice(mapFrom);
1789
- tr.replace(
1790
- mapping.map($from.pos),
1791
- mapping.map($to.pos),
1792
- i ? Slice.empty : content
1793
- );
1794
- }
1795
- const sel = Selection.findFrom(
1796
- tr.doc.resolve(tr.mapping.slice(mapFrom).map(this.to)),
1797
- -1
1798
- );
1799
- if (sel)
1800
- tr.setSelection(sel);
1801
- }
1802
- replaceWith(tr, node) {
1803
- this.replace(tr, new Slice(Fragment.from(node), 0, 0));
1804
- }
1805
- forEachCell(f) {
1806
- const table = this.$anchorCell.node(-1);
1807
- const map = TableMap.get(table);
1808
- const tableStart = this.$anchorCell.start(-1);
1809
- const cells = map.cellsInRect(
1810
- map.rectBetween(
1811
- this.$anchorCell.pos - tableStart,
1812
- this.$headCell.pos - tableStart
1813
- )
1814
- );
1815
- for (let i = 0; i < cells.length; i++) {
1816
- f(table.nodeAt(cells[i]), tableStart + cells[i]);
1817
- }
1818
- }
1819
- // True if this selection goes all the way from the top to the
1820
- // bottom of the table.
1821
- isColSelection() {
1822
- const anchorTop = this.$anchorCell.index(-1);
1823
- const headTop = this.$headCell.index(-1);
1824
- if (Math.min(anchorTop, headTop) > 0)
1825
- return false;
1826
- const anchorBottom = anchorTop + this.$anchorCell.nodeAfter.attrs.rowspan;
1827
- const headBottom = headTop + this.$headCell.nodeAfter.attrs.rowspan;
1828
- return Math.max(anchorBottom, headBottom) == this.$headCell.node(-1).childCount;
1829
- }
1830
- // Returns the smallest column selection that covers the given anchor
1831
- // and head cell.
1832
- static colSelection($anchorCell, $headCell = $anchorCell) {
1833
- const table = $anchorCell.node(-1);
1834
- const map = TableMap.get(table);
1835
- const tableStart = $anchorCell.start(-1);
1836
- const anchorRect = map.findCell($anchorCell.pos - tableStart);
1837
- const headRect = map.findCell($headCell.pos - tableStart);
1838
- const doc = $anchorCell.node(0);
1839
- if (anchorRect.top <= headRect.top) {
1840
- if (anchorRect.top > 0)
1841
- $anchorCell = doc.resolve(tableStart + map.map[anchorRect.left]);
1842
- if (headRect.bottom < map.height)
1843
- $headCell = doc.resolve(
1844
- tableStart + map.map[map.width * (map.height - 1) + headRect.right - 1]
1845
- );
1846
- } else {
1847
- if (headRect.top > 0)
1848
- $headCell = doc.resolve(tableStart + map.map[headRect.left]);
1849
- if (anchorRect.bottom < map.height)
1850
- $anchorCell = doc.resolve(
1851
- tableStart + map.map[map.width * (map.height - 1) + anchorRect.right - 1]
1852
- );
1853
- }
1854
- return new _CellSelection($anchorCell, $headCell);
1855
- }
1856
- // True if this selection goes all the way from the left to the
1857
- // right of the table.
1858
- isRowSelection() {
1859
- const table = this.$anchorCell.node(-1);
1860
- const map = TableMap.get(table);
1861
- const tableStart = this.$anchorCell.start(-1);
1862
- const anchorLeft = map.colCount(this.$anchorCell.pos - tableStart);
1863
- const headLeft = map.colCount(this.$headCell.pos - tableStart);
1864
- if (Math.min(anchorLeft, headLeft) > 0)
1865
- return false;
1866
- const anchorRight = anchorLeft + this.$anchorCell.nodeAfter.attrs.colspan;
1867
- const headRight = headLeft + this.$headCell.nodeAfter.attrs.colspan;
1868
- return Math.max(anchorRight, headRight) == map.width;
1869
- }
1870
- eq(other) {
1871
- return other instanceof _CellSelection && other.$anchorCell.pos == this.$anchorCell.pos && other.$headCell.pos == this.$headCell.pos;
1872
- }
1873
- // Returns the smallest row selection that covers the given anchor
1874
- // and head cell.
1875
- static rowSelection($anchorCell, $headCell = $anchorCell) {
1876
- const table = $anchorCell.node(-1);
1877
- const map = TableMap.get(table);
1878
- const tableStart = $anchorCell.start(-1);
1879
- const anchorRect = map.findCell($anchorCell.pos - tableStart);
1880
- const headRect = map.findCell($headCell.pos - tableStart);
1881
- const doc = $anchorCell.node(0);
1882
- if (anchorRect.left <= headRect.left) {
1883
- if (anchorRect.left > 0)
1884
- $anchorCell = doc.resolve(
1885
- tableStart + map.map[anchorRect.top * map.width]
1886
- );
1887
- if (headRect.right < map.width)
1888
- $headCell = doc.resolve(
1889
- tableStart + map.map[map.width * (headRect.top + 1) - 1]
1890
- );
1891
- } else {
1892
- if (headRect.left > 0)
1893
- $headCell = doc.resolve(tableStart + map.map[headRect.top * map.width]);
1894
- if (anchorRect.right < map.width)
1895
- $anchorCell = doc.resolve(
1896
- tableStart + map.map[map.width * (anchorRect.top + 1) - 1]
1897
- );
1898
- }
1899
- return new _CellSelection($anchorCell, $headCell);
1900
- }
1901
- toJSON() {
1902
- return {
1903
- type: "cell",
1904
- anchor: this.$anchorCell.pos,
1905
- head: this.$headCell.pos
1906
- };
1907
- }
1908
- static fromJSON(doc, json) {
1909
- return new _CellSelection(doc.resolve(json.anchor), doc.resolve(json.head));
1910
- }
1911
- static create(doc, anchorCell, headCell = anchorCell) {
1912
- return new _CellSelection(doc.resolve(anchorCell), doc.resolve(headCell));
1913
- }
1914
- getBookmark() {
1915
- return new CellBookmark(this.$anchorCell.pos, this.$headCell.pos);
1916
- }
1917
- };
1918
- CellSelection.prototype.visible = false;
1919
- Selection.jsonID("cell", CellSelection);
1920
- var CellBookmark = class _CellBookmark {
1921
- constructor(anchor, head) {
1922
- this.anchor = anchor;
1923
- this.head = head;
1924
- }
1925
- map(mapping) {
1926
- return new _CellBookmark(mapping.map(this.anchor), mapping.map(this.head));
1927
- }
1928
- resolve(doc) {
1929
- const $anchorCell = doc.resolve(this.anchor), $headCell = doc.resolve(this.head);
1930
- if ($anchorCell.parent.type.spec.tableRole == "row" && $headCell.parent.type.spec.tableRole == "row" && $anchorCell.index() < $anchorCell.parent.childCount && $headCell.index() < $headCell.parent.childCount && inSameTable($anchorCell, $headCell))
1931
- return new CellSelection($anchorCell, $headCell);
1932
- else
1933
- return Selection.near($headCell, 1);
1934
- }
1935
- };
1936
- function drawCellSelection(state) {
1937
- if (!(state.selection instanceof CellSelection))
1938
- return null;
1939
- const cells = [];
1940
- state.selection.forEachCell((node, pos) => {
1941
- cells.push(
1942
- Decoration.node(pos, pos + node.nodeSize, { class: "selectedCell" })
1943
- );
1944
- });
1945
- return DecorationSet.create(state.doc, cells);
1946
- }
1947
- function isCellBoundarySelection({ $from, $to }) {
1948
- if ($from.pos == $to.pos || $from.pos < $to.pos - 6)
1949
- return false;
1950
- let afterFrom = $from.pos;
1951
- let beforeTo = $to.pos;
1952
- let depth = $from.depth;
1953
- for (; depth >= 0; depth--, afterFrom++)
1954
- if ($from.after(depth + 1) < $from.end(depth))
1955
- break;
1956
- for (let d = $to.depth; d >= 0; d--, beforeTo--)
1957
- if ($to.before(d + 1) > $to.start(d))
1958
- break;
1959
- return afterFrom == beforeTo && /row|table/.test($from.node(depth).type.spec.tableRole);
1960
- }
1961
- function isTextSelectionAcrossCells({ $from, $to }) {
1962
- let fromCellBoundaryNode;
1963
- let toCellBoundaryNode;
1964
- for (let i = $from.depth; i > 0; i--) {
1965
- const node = $from.node(i);
1966
- if (node.type.spec.tableRole === "cell" || node.type.spec.tableRole === "header_cell") {
1967
- fromCellBoundaryNode = node;
1968
- break;
1969
- }
1970
- }
1971
- for (let i = $to.depth; i > 0; i--) {
1972
- const node = $to.node(i);
1973
- if (node.type.spec.tableRole === "cell" || node.type.spec.tableRole === "header_cell") {
1974
- toCellBoundaryNode = node;
1975
- break;
1976
- }
1977
- }
1978
- return fromCellBoundaryNode !== toCellBoundaryNode && $to.parentOffset === 0;
1979
- }
1980
- function normalizeSelection(state, tr, allowTableNodeSelection) {
1981
- const sel = (tr || state).selection;
1982
- const doc = (tr || state).doc;
1983
- let normalize;
1984
- let role;
1985
- if (sel instanceof NodeSelection && (role = sel.node.type.spec.tableRole)) {
1986
- if (role == "cell" || role == "header_cell") {
1987
- normalize = CellSelection.create(doc, sel.from);
1988
- } else if (role == "row") {
1989
- const $cell = doc.resolve(sel.from + 1);
1990
- normalize = CellSelection.rowSelection($cell, $cell);
1991
- } else if (!allowTableNodeSelection) {
1992
- const map = TableMap.get(sel.node);
1993
- const start = sel.from + 1;
1994
- const lastCell = start + map.map[map.width * map.height - 1];
1995
- normalize = CellSelection.create(doc, start + 1, lastCell);
1996
- }
1997
- } else if (sel instanceof TextSelection && isCellBoundarySelection(sel)) {
1998
- normalize = TextSelection.create(doc, sel.from);
1999
- } else if (sel instanceof TextSelection && isTextSelectionAcrossCells(sel)) {
2000
- normalize = TextSelection.create(doc, sel.$from.start(), sel.$from.end());
2001
- }
2002
- if (normalize)
2003
- (tr || (tr = state.tr)).setSelection(normalize);
2004
- return tr;
2005
- }
2006
- var fixTablesKey = new PluginKey("fix-tables");
2007
- function changedDescendants(old, cur, offset, f) {
2008
- const oldSize = old.childCount, curSize = cur.childCount;
2009
- outer:
2010
- for (let i = 0, j = 0; i < curSize; i++) {
2011
- const child = cur.child(i);
2012
- for (let scan = j, e = Math.min(oldSize, i + 3); scan < e; scan++) {
2013
- if (old.child(scan) == child) {
2014
- j = scan + 1;
2015
- offset += child.nodeSize;
2016
- continue outer;
2017
- }
2018
- }
2019
- f(child, offset);
2020
- if (j < oldSize && old.child(j).sameMarkup(child))
2021
- changedDescendants(old.child(j), child, offset + 1, f);
2022
- else
2023
- child.nodesBetween(0, child.content.size, f, offset + 1);
2024
- offset += child.nodeSize;
2025
- }
2026
- }
2027
- function fixTables(state, oldState) {
2028
- let tr;
2029
- const check = (node, pos) => {
2030
- if (node.type.spec.tableRole == "table")
2031
- tr = fixTable(state, node, pos, tr);
2032
- };
2033
- if (!oldState)
2034
- state.doc.descendants(check);
2035
- else if (oldState.doc != state.doc)
2036
- changedDescendants(oldState.doc, state.doc, 0, check);
2037
- return tr;
2038
- }
2039
- function fixTable(state, table, tablePos, tr) {
2040
- const map = TableMap.get(table);
2041
- if (!map.problems)
2042
- return tr;
2043
- if (!tr)
2044
- tr = state.tr;
2045
- const mustAdd = [];
2046
- for (let i = 0; i < map.height; i++)
2047
- mustAdd.push(0);
2048
- for (let i = 0; i < map.problems.length; i++) {
2049
- const prob = map.problems[i];
2050
- if (prob.type == "collision") {
2051
- const cell = table.nodeAt(prob.pos);
2052
- if (!cell)
2053
- continue;
2054
- const attrs = cell.attrs;
2055
- for (let j = 0; j < attrs.rowspan; j++)
2056
- mustAdd[prob.row + j] += prob.n;
2057
- tr.setNodeMarkup(
2058
- tr.mapping.map(tablePos + 1 + prob.pos),
2059
- null,
2060
- removeColSpan(attrs, attrs.colspan - prob.n, prob.n)
2061
- );
2062
- } else if (prob.type == "missing") {
2063
- mustAdd[prob.row] += prob.n;
2064
- } else if (prob.type == "overlong_rowspan") {
2065
- const cell = table.nodeAt(prob.pos);
2066
- if (!cell)
2067
- continue;
2068
- tr.setNodeMarkup(tr.mapping.map(tablePos + 1 + prob.pos), null, {
2069
- ...cell.attrs,
2070
- rowspan: cell.attrs.rowspan - prob.n
2071
- });
2072
- } else if (prob.type == "colwidth mismatch") {
2073
- const cell = table.nodeAt(prob.pos);
2074
- if (!cell)
2075
- continue;
2076
- tr.setNodeMarkup(tr.mapping.map(tablePos + 1 + prob.pos), null, {
2077
- ...cell.attrs,
2078
- colwidth: prob.colwidth
2079
- });
2080
- }
2081
- }
2082
- let first, last;
2083
- for (let i = 0; i < mustAdd.length; i++)
2084
- if (mustAdd[i]) {
2085
- if (first == null)
2086
- first = i;
2087
- last = i;
2088
- }
2089
- for (let i = 0, pos = tablePos + 1; i < map.height; i++) {
2090
- const row = table.child(i);
2091
- const end = pos + row.nodeSize;
2092
- const add = mustAdd[i];
2093
- if (add > 0) {
2094
- let role = "cell";
2095
- if (row.firstChild) {
2096
- role = row.firstChild.type.spec.tableRole;
2097
- }
2098
- const nodes = [];
2099
- for (let j = 0; j < add; j++) {
2100
- const node = tableNodeTypes(state.schema)[role].createAndFill();
2101
- if (node)
2102
- nodes.push(node);
2103
- }
2104
- const side = (i == 0 || first == i - 1) && last == i ? pos + 1 : end - 1;
2105
- tr.insert(tr.mapping.map(side), nodes);
2106
- }
2107
- pos = end;
2108
- }
2109
- return tr.setMeta(fixTablesKey, { fixTables: true });
2110
- }
2111
- function selectedRect(state) {
2112
- const sel = state.selection;
2113
- const $pos = selectionCell(state);
2114
- const table = $pos.node(-1);
2115
- const tableStart = $pos.start(-1);
2116
- const map = TableMap.get(table);
2117
- const rect = sel instanceof CellSelection ? map.rectBetween(
2118
- sel.$anchorCell.pos - tableStart,
2119
- sel.$headCell.pos - tableStart
2120
- ) : map.findCell($pos.pos - tableStart);
2121
- return { ...rect, tableStart, map, table };
2122
- }
2123
- function addColumn(tr, { map, tableStart, table }, col) {
2124
- let refColumn = col > 0 ? -1 : 0;
2125
- if (columnIsHeader(map, table, col + refColumn)) {
2126
- refColumn = col == 0 || col == map.width ? null : 0;
2127
- }
2128
- for (let row = 0; row < map.height; row++) {
2129
- const index = row * map.width + col;
2130
- if (col > 0 && col < map.width && map.map[index - 1] == map.map[index]) {
2131
- const pos = map.map[index];
2132
- const cell = table.nodeAt(pos);
2133
- tr.setNodeMarkup(
2134
- tr.mapping.map(tableStart + pos),
2135
- null,
2136
- addColSpan(cell.attrs, col - map.colCount(pos))
2137
- );
2138
- row += cell.attrs.rowspan - 1;
2139
- } else {
2140
- const type = refColumn == null ? tableNodeTypes(table.type.schema).cell : table.nodeAt(map.map[index + refColumn]).type;
2141
- const pos = map.positionAt(row, col, table);
2142
- tr.insert(tr.mapping.map(tableStart + pos), type.createAndFill());
2143
- }
2144
- }
2145
- return tr;
2146
- }
2147
- function addColumnBefore(state, dispatch) {
2148
- if (!isInTable(state))
2149
- return false;
2150
- if (dispatch) {
2151
- const rect = selectedRect(state);
2152
- dispatch(addColumn(state.tr, rect, rect.left));
2153
- }
2154
- return true;
2155
- }
2156
- function addColumnAfter(state, dispatch) {
2157
- if (!isInTable(state))
2158
- return false;
2159
- if (dispatch) {
2160
- const rect = selectedRect(state);
2161
- dispatch(addColumn(state.tr, rect, rect.right));
2162
- }
2163
- return true;
2164
- }
2165
- function removeColumn(tr, { map, table, tableStart }, col) {
2166
- const mapStart = tr.mapping.maps.length;
2167
- for (let row = 0; row < map.height; ) {
2168
- const index = row * map.width + col;
2169
- const pos = map.map[index];
2170
- const cell = table.nodeAt(pos);
2171
- const attrs = cell.attrs;
2172
- if (col > 0 && map.map[index - 1] == pos || col < map.width - 1 && map.map[index + 1] == pos) {
2173
- tr.setNodeMarkup(
2174
- tr.mapping.slice(mapStart).map(tableStart + pos),
2175
- null,
2176
- removeColSpan(attrs, col - map.colCount(pos))
2177
- );
2178
- } else {
2179
- const start = tr.mapping.slice(mapStart).map(tableStart + pos);
2180
- tr.delete(start, start + cell.nodeSize);
2181
- }
2182
- row += attrs.rowspan;
2183
- }
2184
- }
2185
- function deleteColumn(state, dispatch) {
2186
- if (!isInTable(state))
2187
- return false;
2188
- if (dispatch) {
2189
- const rect = selectedRect(state);
2190
- const tr = state.tr;
2191
- if (rect.left == 0 && rect.right == rect.map.width)
2192
- return false;
2193
- for (let i = rect.right - 1; ; i--) {
2194
- removeColumn(tr, rect, i);
2195
- if (i == rect.left)
2196
- break;
2197
- const table = rect.tableStart ? tr.doc.nodeAt(rect.tableStart - 1) : tr.doc;
2198
- if (!table) {
2199
- throw RangeError("No table found");
2200
- }
2201
- rect.table = table;
2202
- rect.map = TableMap.get(table);
2203
- }
2204
- dispatch(tr);
2205
- }
2206
- return true;
2207
- }
2208
- function rowIsHeader(map, table, row) {
2209
- var _a;
2210
- const headerCell = tableNodeTypes(table.type.schema).header_cell;
2211
- for (let col = 0; col < map.width; col++)
2212
- if (((_a = table.nodeAt(map.map[col + row * map.width])) == null ? void 0 : _a.type) != headerCell)
2213
- return false;
2214
- return true;
2215
- }
2216
- function addRow(tr, { map, tableStart, table }, row) {
2217
- var _a;
2218
- let rowPos = tableStart;
2219
- for (let i = 0; i < row; i++)
2220
- rowPos += table.child(i).nodeSize;
2221
- const cells = [];
2222
- let refRow = row > 0 ? -1 : 0;
2223
- if (rowIsHeader(map, table, row + refRow))
2224
- refRow = row == 0 || row == map.height ? null : 0;
2225
- for (let col = 0, index = map.width * row; col < map.width; col++, index++) {
2226
- if (row > 0 && row < map.height && map.map[index] == map.map[index - map.width]) {
2227
- const pos = map.map[index];
2228
- const attrs = table.nodeAt(pos).attrs;
2229
- tr.setNodeMarkup(tableStart + pos, null, {
2230
- ...attrs,
2231
- rowspan: attrs.rowspan + 1
2232
- });
2233
- col += attrs.colspan - 1;
2234
- } else {
2235
- const type = refRow == null ? tableNodeTypes(table.type.schema).cell : (_a = table.nodeAt(map.map[index + refRow * map.width])) == null ? void 0 : _a.type;
2236
- const node = type == null ? void 0 : type.createAndFill();
2237
- if (node)
2238
- cells.push(node);
2239
- }
2240
- }
2241
- tr.insert(rowPos, tableNodeTypes(table.type.schema).row.create(null, cells));
2242
- return tr;
2243
- }
2244
- function addRowBefore(state, dispatch) {
2245
- if (!isInTable(state))
2246
- return false;
2247
- if (dispatch) {
2248
- const rect = selectedRect(state);
2249
- dispatch(addRow(state.tr, rect, rect.top));
2250
- }
2251
- return true;
2252
- }
2253
- function addRowAfter(state, dispatch) {
2254
- if (!isInTable(state))
2255
- return false;
2256
- if (dispatch) {
2257
- const rect = selectedRect(state);
2258
- dispatch(addRow(state.tr, rect, rect.bottom));
2259
- }
2260
- return true;
2261
- }
2262
- function removeRow(tr, { map, table, tableStart }, row) {
2263
- let rowPos = 0;
2264
- for (let i = 0; i < row; i++)
2265
- rowPos += table.child(i).nodeSize;
2266
- const nextRow = rowPos + table.child(row).nodeSize;
2267
- const mapFrom = tr.mapping.maps.length;
2268
- tr.delete(rowPos + tableStart, nextRow + tableStart);
2269
- const seen = /* @__PURE__ */ new Set();
2270
- for (let col = 0, index = row * map.width; col < map.width; col++, index++) {
2271
- const pos = map.map[index];
2272
- if (seen.has(pos))
2273
- continue;
2274
- seen.add(pos);
2275
- if (row > 0 && pos == map.map[index - map.width]) {
2276
- const attrs = table.nodeAt(pos).attrs;
2277
- tr.setNodeMarkup(tr.mapping.slice(mapFrom).map(pos + tableStart), null, {
2278
- ...attrs,
2279
- rowspan: attrs.rowspan - 1
2280
- });
2281
- col += attrs.colspan - 1;
2282
- } else if (row < map.height && pos == map.map[index + map.width]) {
2283
- const cell = table.nodeAt(pos);
2284
- const attrs = cell.attrs;
2285
- const copy = cell.type.create(
2286
- { ...attrs, rowspan: cell.attrs.rowspan - 1 },
2287
- cell.content
2288
- );
2289
- const newPos = map.positionAt(row + 1, col, table);
2290
- tr.insert(tr.mapping.slice(mapFrom).map(tableStart + newPos), copy);
2291
- col += attrs.colspan - 1;
2292
- }
2293
- }
2294
- }
2295
- function deleteRow(state, dispatch) {
2296
- if (!isInTable(state))
2297
- return false;
2298
- if (dispatch) {
2299
- const rect = selectedRect(state), tr = state.tr;
2300
- if (rect.top == 0 && rect.bottom == rect.map.height)
2301
- return false;
2302
- for (let i = rect.bottom - 1; ; i--) {
2303
- removeRow(tr, rect, i);
2304
- if (i == rect.top)
2305
- break;
2306
- const table = rect.tableStart ? tr.doc.nodeAt(rect.tableStart - 1) : tr.doc;
2307
- if (!table) {
2308
- throw RangeError("No table found");
2309
- }
2310
- rect.table = table;
2311
- rect.map = TableMap.get(rect.table);
2312
- }
2313
- dispatch(tr);
2314
- }
2315
- return true;
2316
- }
2317
- function isEmpty(cell) {
2318
- const c = cell.content;
2319
- return c.childCount == 1 && c.child(0).isTextblock && c.child(0).childCount == 0;
2320
- }
2321
- function cellsOverlapRectangle({ width, height, map }, rect) {
2322
- let indexTop = rect.top * width + rect.left, indexLeft = indexTop;
2323
- let indexBottom = (rect.bottom - 1) * width + rect.left, indexRight = indexTop + (rect.right - rect.left - 1);
2324
- for (let i = rect.top; i < rect.bottom; i++) {
2325
- if (rect.left > 0 && map[indexLeft] == map[indexLeft - 1] || rect.right < width && map[indexRight] == map[indexRight + 1])
2326
- return true;
2327
- indexLeft += width;
2328
- indexRight += width;
2329
- }
2330
- for (let i = rect.left; i < rect.right; i++) {
2331
- if (rect.top > 0 && map[indexTop] == map[indexTop - width] || rect.bottom < height && map[indexBottom] == map[indexBottom + width])
2332
- return true;
2333
- indexTop++;
2334
- indexBottom++;
2335
- }
2336
- return false;
2337
- }
2338
- function mergeCells(state, dispatch) {
2339
- const sel = state.selection;
2340
- if (!(sel instanceof CellSelection) || sel.$anchorCell.pos == sel.$headCell.pos)
2341
- return false;
2342
- const rect = selectedRect(state), { map } = rect;
2343
- if (cellsOverlapRectangle(map, rect))
2344
- return false;
2345
- if (dispatch) {
2346
- const tr = state.tr;
2347
- const seen = {};
2348
- let content = Fragment.empty;
2349
- let mergedPos;
2350
- let mergedCell;
2351
- for (let row = rect.top; row < rect.bottom; row++) {
2352
- for (let col = rect.left; col < rect.right; col++) {
2353
- const cellPos = map.map[row * map.width + col];
2354
- const cell = rect.table.nodeAt(cellPos);
2355
- if (seen[cellPos] || !cell)
2356
- continue;
2357
- seen[cellPos] = true;
2358
- if (mergedPos == null) {
2359
- mergedPos = cellPos;
2360
- mergedCell = cell;
2361
- } else {
2362
- if (!isEmpty(cell))
2363
- content = content.append(cell.content);
2364
- const mapped = tr.mapping.map(cellPos + rect.tableStart);
2365
- tr.delete(mapped, mapped + cell.nodeSize);
2366
- }
2367
- }
2368
- }
2369
- if (mergedPos == null || mergedCell == null) {
2370
- return true;
2371
- }
2372
- tr.setNodeMarkup(mergedPos + rect.tableStart, null, {
2373
- ...addColSpan(
2374
- mergedCell.attrs,
2375
- mergedCell.attrs.colspan,
2376
- rect.right - rect.left - mergedCell.attrs.colspan
2377
- ),
2378
- rowspan: rect.bottom - rect.top
2379
- });
2380
- if (content.size) {
2381
- const end = mergedPos + 1 + mergedCell.content.size;
2382
- const start = isEmpty(mergedCell) ? mergedPos + 1 : end;
2383
- tr.replaceWith(start + rect.tableStart, end + rect.tableStart, content);
2384
- }
2385
- tr.setSelection(
2386
- new CellSelection(tr.doc.resolve(mergedPos + rect.tableStart))
2387
- );
2388
- dispatch(tr);
2389
- }
2390
- return true;
2391
- }
2392
- function splitCell(state, dispatch) {
2393
- const nodeTypes = tableNodeTypes(state.schema);
2394
- return splitCellWithType(({ node }) => {
2395
- return nodeTypes[node.type.spec.tableRole];
2396
- })(state, dispatch);
2397
- }
2398
- function splitCellWithType(getCellType) {
2399
- return (state, dispatch) => {
2400
- var _a;
2401
- const sel = state.selection;
2402
- let cellNode;
2403
- let cellPos;
2404
- if (!(sel instanceof CellSelection)) {
2405
- cellNode = cellWrapping(sel.$from);
2406
- if (!cellNode)
2407
- return false;
2408
- cellPos = (_a = cellAround(sel.$from)) == null ? void 0 : _a.pos;
2409
- } else {
2410
- if (sel.$anchorCell.pos != sel.$headCell.pos)
2411
- return false;
2412
- cellNode = sel.$anchorCell.nodeAfter;
2413
- cellPos = sel.$anchorCell.pos;
2414
- }
2415
- if (cellNode == null || cellPos == null) {
2416
- return false;
2417
- }
2418
- if (cellNode.attrs.colspan == 1 && cellNode.attrs.rowspan == 1) {
2419
- return false;
2420
- }
2421
- if (dispatch) {
2422
- let baseAttrs = cellNode.attrs;
2423
- const attrs = [];
2424
- const colwidth = baseAttrs.colwidth;
2425
- if (baseAttrs.rowspan > 1)
2426
- baseAttrs = { ...baseAttrs, rowspan: 1 };
2427
- if (baseAttrs.colspan > 1)
2428
- baseAttrs = { ...baseAttrs, colspan: 1 };
2429
- const rect = selectedRect(state), tr = state.tr;
2430
- for (let i = 0; i < rect.right - rect.left; i++)
2431
- attrs.push(
2432
- colwidth ? {
2433
- ...baseAttrs,
2434
- colwidth: colwidth && colwidth[i] ? [colwidth[i]] : null
2435
- } : baseAttrs
2436
- );
2437
- let lastCell;
2438
- for (let row = rect.top; row < rect.bottom; row++) {
2439
- let pos = rect.map.positionAt(row, rect.left, rect.table);
2440
- if (row == rect.top)
2441
- pos += cellNode.nodeSize;
2442
- for (let col = rect.left, i = 0; col < rect.right; col++, i++) {
2443
- if (col == rect.left && row == rect.top)
2444
- continue;
2445
- tr.insert(
2446
- lastCell = tr.mapping.map(pos + rect.tableStart, 1),
2447
- getCellType({ node: cellNode, row, col }).createAndFill(attrs[i])
2448
- );
2449
- }
2450
- }
2451
- tr.setNodeMarkup(
2452
- cellPos,
2453
- getCellType({ node: cellNode, row: rect.top, col: rect.left }),
2454
- attrs[0]
2455
- );
2456
- if (sel instanceof CellSelection)
2457
- tr.setSelection(
2458
- new CellSelection(
2459
- tr.doc.resolve(sel.$anchorCell.pos),
2460
- lastCell ? tr.doc.resolve(lastCell) : void 0
2461
- )
2462
- );
2463
- dispatch(tr);
2464
- }
2465
- return true;
2466
- };
2467
- }
2468
- function setCellAttr(name, value) {
2469
- return function(state, dispatch) {
2470
- if (!isInTable(state))
2471
- return false;
2472
- const $cell = selectionCell(state);
2473
- if ($cell.nodeAfter.attrs[name] === value)
2474
- return false;
2475
- if (dispatch) {
2476
- const tr = state.tr;
2477
- if (state.selection instanceof CellSelection)
2478
- state.selection.forEachCell((node, pos) => {
2479
- if (node.attrs[name] !== value)
2480
- tr.setNodeMarkup(pos, null, {
2481
- ...node.attrs,
2482
- [name]: value
2483
- });
2484
- });
2485
- else
2486
- tr.setNodeMarkup($cell.pos, null, {
2487
- ...$cell.nodeAfter.attrs,
2488
- [name]: value
2489
- });
2490
- dispatch(tr);
2491
- }
2492
- return true;
2493
- };
2494
- }
2495
- function deprecated_toggleHeader(type) {
2496
- return function(state, dispatch) {
2497
- if (!isInTable(state))
2498
- return false;
2499
- if (dispatch) {
2500
- const types = tableNodeTypes(state.schema);
2501
- const rect = selectedRect(state), tr = state.tr;
2502
- const cells = rect.map.cellsInRect(
2503
- type == "column" ? {
2504
- left: rect.left,
2505
- top: 0,
2506
- right: rect.right,
2507
- bottom: rect.map.height
2508
- } : type == "row" ? {
2509
- left: 0,
2510
- top: rect.top,
2511
- right: rect.map.width,
2512
- bottom: rect.bottom
2513
- } : rect
2514
- );
2515
- const nodes = cells.map((pos) => rect.table.nodeAt(pos));
2516
- for (let i = 0; i < cells.length; i++)
2517
- if (nodes[i].type == types.header_cell)
2518
- tr.setNodeMarkup(
2519
- rect.tableStart + cells[i],
2520
- types.cell,
2521
- nodes[i].attrs
2522
- );
2523
- if (tr.steps.length == 0)
2524
- for (let i = 0; i < cells.length; i++)
2525
- tr.setNodeMarkup(
2526
- rect.tableStart + cells[i],
2527
- types.header_cell,
2528
- nodes[i].attrs
2529
- );
2530
- dispatch(tr);
2531
- }
2532
- return true;
2533
- };
2534
- }
2535
- function isHeaderEnabledByType(type, rect, types) {
2536
- const cellPositions = rect.map.cellsInRect({
2537
- left: 0,
2538
- top: 0,
2539
- right: type == "row" ? rect.map.width : 1,
2540
- bottom: type == "column" ? rect.map.height : 1
2541
- });
2542
- for (let i = 0; i < cellPositions.length; i++) {
2543
- const cell = rect.table.nodeAt(cellPositions[i]);
2544
- if (cell && cell.type !== types.header_cell) {
2545
- return false;
2546
- }
2547
- }
2548
- return true;
2549
- }
2550
- function toggleHeader(type, options) {
2551
- options = options || { useDeprecatedLogic: false };
2552
- if (options.useDeprecatedLogic)
2553
- return deprecated_toggleHeader(type);
2554
- return function(state, dispatch) {
2555
- if (!isInTable(state))
2556
- return false;
2557
- if (dispatch) {
2558
- const types = tableNodeTypes(state.schema);
2559
- const rect = selectedRect(state), tr = state.tr;
2560
- const isHeaderRowEnabled = isHeaderEnabledByType("row", rect, types);
2561
- const isHeaderColumnEnabled = isHeaderEnabledByType(
2562
- "column",
2563
- rect,
2564
- types
2565
- );
2566
- const isHeaderEnabled = type === "column" ? isHeaderRowEnabled : type === "row" ? isHeaderColumnEnabled : false;
2567
- const selectionStartsAt = isHeaderEnabled ? 1 : 0;
2568
- const cellsRect = type == "column" ? {
2569
- left: 0,
2570
- top: selectionStartsAt,
2571
- right: 1,
2572
- bottom: rect.map.height
2573
- } : type == "row" ? {
2574
- left: selectionStartsAt,
2575
- top: 0,
2576
- right: rect.map.width,
2577
- bottom: 1
2578
- } : rect;
2579
- const newType = type == "column" ? isHeaderColumnEnabled ? types.cell : types.header_cell : type == "row" ? isHeaderRowEnabled ? types.cell : types.header_cell : types.cell;
2580
- rect.map.cellsInRect(cellsRect).forEach((relativeCellPos) => {
2581
- const cellPos = relativeCellPos + rect.tableStart;
2582
- const cell = tr.doc.nodeAt(cellPos);
2583
- if (cell) {
2584
- tr.setNodeMarkup(cellPos, newType, cell.attrs);
2585
- }
2586
- });
2587
- dispatch(tr);
2588
- }
2589
- return true;
2590
- };
2591
- }
2592
- var toggleHeaderRow = toggleHeader("row", {
2593
- useDeprecatedLogic: true
2594
- });
2595
- var toggleHeaderColumn = toggleHeader("column", {
2596
- useDeprecatedLogic: true
2597
- });
2598
- var toggleHeaderCell = toggleHeader("cell", {
2599
- useDeprecatedLogic: true
2600
- });
2601
- function findNextCell($cell, dir) {
2602
- if (dir < 0) {
2603
- const before = $cell.nodeBefore;
2604
- if (before)
2605
- return $cell.pos - before.nodeSize;
2606
- for (let row = $cell.index(-1) - 1, rowEnd = $cell.before(); row >= 0; row--) {
2607
- const rowNode = $cell.node(-1).child(row);
2608
- const lastChild = rowNode.lastChild;
2609
- if (lastChild) {
2610
- return rowEnd - 1 - lastChild.nodeSize;
2611
- }
2612
- rowEnd -= rowNode.nodeSize;
2613
- }
2614
- } else {
2615
- if ($cell.index() < $cell.parent.childCount - 1) {
2616
- return $cell.pos + $cell.nodeAfter.nodeSize;
2617
- }
2618
- const table = $cell.node(-1);
2619
- for (let row = $cell.indexAfter(-1), rowStart = $cell.after(); row < table.childCount; row++) {
2620
- const rowNode = table.child(row);
2621
- if (rowNode.childCount)
2622
- return rowStart + 1;
2623
- rowStart += rowNode.nodeSize;
2624
- }
2625
- }
2626
- return null;
2627
- }
2628
- function goToNextCell(direction) {
2629
- return function(state, dispatch) {
2630
- if (!isInTable(state))
2631
- return false;
2632
- const cell = findNextCell(selectionCell(state), direction);
2633
- if (cell == null)
2634
- return false;
2635
- if (dispatch) {
2636
- const $cell = state.doc.resolve(cell);
2637
- dispatch(
2638
- state.tr.setSelection(TextSelection.between($cell, moveCellForward($cell))).scrollIntoView()
2639
- );
2640
- }
2641
- return true;
2642
- };
2643
- }
2644
- function deleteTable(state, dispatch) {
2645
- const $pos = state.selection.$anchor;
2646
- for (let d = $pos.depth; d > 0; d--) {
2647
- const node = $pos.node(d);
2648
- if (node.type.spec.tableRole == "table") {
2649
- if (dispatch)
2650
- dispatch(
2651
- state.tr.delete($pos.before(d), $pos.after(d)).scrollIntoView()
2652
- );
2653
- return true;
2654
- }
2655
- }
2656
- return false;
2657
- }
2658
- function deleteCellSelection(state, dispatch) {
2659
- const sel = state.selection;
2660
- if (!(sel instanceof CellSelection))
2661
- return false;
2662
- if (dispatch) {
2663
- const tr = state.tr;
2664
- const baseContent = tableNodeTypes(state.schema).cell.createAndFill().content;
2665
- sel.forEachCell((cell, pos) => {
2666
- if (!cell.content.eq(baseContent))
2667
- tr.replace(
2668
- tr.mapping.map(pos + 1),
2669
- tr.mapping.map(pos + cell.nodeSize - 1),
2670
- new Slice(baseContent, 0, 0)
2671
- );
2672
- });
2673
- if (tr.docChanged)
2674
- dispatch(tr);
2675
- }
2676
- return true;
2677
- }
2678
- function pastedCells(slice) {
2679
- if (!slice.size)
2680
- return null;
2681
- let { content, openStart, openEnd } = slice;
2682
- while (content.childCount == 1 && (openStart > 0 && openEnd > 0 || content.child(0).type.spec.tableRole == "table")) {
2683
- openStart--;
2684
- openEnd--;
2685
- content = content.child(0).content;
2686
- }
2687
- const first = content.child(0);
2688
- const role = first.type.spec.tableRole;
2689
- const schema = first.type.schema, rows = [];
2690
- if (role == "row") {
2691
- for (let i = 0; i < content.childCount; i++) {
2692
- let cells = content.child(i).content;
2693
- const left = i ? 0 : Math.max(0, openStart - 1);
2694
- const right = i < content.childCount - 1 ? 0 : Math.max(0, openEnd - 1);
2695
- if (left || right)
2696
- cells = fitSlice(
2697
- tableNodeTypes(schema).row,
2698
- new Slice(cells, left, right)
2699
- ).content;
2700
- rows.push(cells);
2701
- }
2702
- } else if (role == "cell" || role == "header_cell") {
2703
- rows.push(
2704
- openStart || openEnd ? fitSlice(
2705
- tableNodeTypes(schema).row,
2706
- new Slice(content, openStart, openEnd)
2707
- ).content : content
2708
- );
2709
- } else {
2710
- return null;
2711
- }
2712
- return ensureRectangular(schema, rows);
2713
- }
2714
- function ensureRectangular(schema, rows) {
2715
- const widths = [];
2716
- for (let i = 0; i < rows.length; i++) {
2717
- const row = rows[i];
2718
- for (let j = row.childCount - 1; j >= 0; j--) {
2719
- const { rowspan, colspan } = row.child(j).attrs;
2720
- for (let r = i; r < i + rowspan; r++)
2721
- widths[r] = (widths[r] || 0) + colspan;
2722
- }
2723
- }
2724
- let width = 0;
2725
- for (let r = 0; r < widths.length; r++)
2726
- width = Math.max(width, widths[r]);
2727
- for (let r = 0; r < widths.length; r++) {
2728
- if (r >= rows.length)
2729
- rows.push(Fragment.empty);
2730
- if (widths[r] < width) {
2731
- const empty = tableNodeTypes(schema).cell.createAndFill();
2732
- const cells = [];
2733
- for (let i = widths[r]; i < width; i++) {
2734
- cells.push(empty);
2735
- }
2736
- rows[r] = rows[r].append(Fragment.from(cells));
2737
- }
2738
- }
2739
- return { height: rows.length, width, rows };
2740
- }
2741
- function fitSlice(nodeType, slice) {
2742
- const node = nodeType.createAndFill();
2743
- const tr = new Transform(node).replace(0, node.content.size, slice);
2744
- return tr.doc;
2745
- }
2746
- function clipCells({ width, height, rows }, newWidth, newHeight) {
2747
- if (width != newWidth) {
2748
- const added = [];
2749
- const newRows = [];
2750
- for (let row = 0; row < rows.length; row++) {
2751
- const frag = rows[row], cells = [];
2752
- for (let col = added[row] || 0, i = 0; col < newWidth; i++) {
2753
- let cell = frag.child(i % frag.childCount);
2754
- if (col + cell.attrs.colspan > newWidth)
2755
- cell = cell.type.createChecked(
2756
- removeColSpan(
2757
- cell.attrs,
2758
- cell.attrs.colspan,
2759
- col + cell.attrs.colspan - newWidth
2760
- ),
2761
- cell.content
2762
- );
2763
- cells.push(cell);
2764
- col += cell.attrs.colspan;
2765
- for (let j = 1; j < cell.attrs.rowspan; j++)
2766
- added[row + j] = (added[row + j] || 0) + cell.attrs.colspan;
2767
- }
2768
- newRows.push(Fragment.from(cells));
2769
- }
2770
- rows = newRows;
2771
- width = newWidth;
2772
- }
2773
- if (height != newHeight) {
2774
- const newRows = [];
2775
- for (let row = 0, i = 0; row < newHeight; row++, i++) {
2776
- const cells = [], source = rows[i % height];
2777
- for (let j = 0; j < source.childCount; j++) {
2778
- let cell = source.child(j);
2779
- if (row + cell.attrs.rowspan > newHeight)
2780
- cell = cell.type.create(
2781
- {
2782
- ...cell.attrs,
2783
- rowspan: Math.max(1, newHeight - cell.attrs.rowspan)
2784
- },
2785
- cell.content
2786
- );
2787
- cells.push(cell);
2788
- }
2789
- newRows.push(Fragment.from(cells));
2790
- }
2791
- rows = newRows;
2792
- height = newHeight;
2793
- }
2794
- return { width, height, rows };
2795
- }
2796
- function growTable(tr, map, table, start, width, height, mapFrom) {
2797
- const schema = tr.doc.type.schema;
2798
- const types = tableNodeTypes(schema);
2799
- let empty;
2800
- let emptyHead;
2801
- if (width > map.width) {
2802
- for (let row = 0, rowEnd = 0; row < map.height; row++) {
2803
- const rowNode = table.child(row);
2804
- rowEnd += rowNode.nodeSize;
2805
- const cells = [];
2806
- let add;
2807
- if (rowNode.lastChild == null || rowNode.lastChild.type == types.cell)
2808
- add = empty || (empty = types.cell.createAndFill());
2809
- else
2810
- add = emptyHead || (emptyHead = types.header_cell.createAndFill());
2811
- for (let i = map.width; i < width; i++)
2812
- cells.push(add);
2813
- tr.insert(tr.mapping.slice(mapFrom).map(rowEnd - 1 + start), cells);
2814
- }
2815
- }
2816
- if (height > map.height) {
2817
- const cells = [];
2818
- for (let i = 0, start2 = (map.height - 1) * map.width; i < Math.max(map.width, width); i++) {
2819
- const header = i >= map.width ? false : table.nodeAt(map.map[start2 + i]).type == types.header_cell;
2820
- cells.push(
2821
- header ? emptyHead || (emptyHead = types.header_cell.createAndFill()) : empty || (empty = types.cell.createAndFill())
2822
- );
2823
- }
2824
- const emptyRow = types.row.create(null, Fragment.from(cells)), rows = [];
2825
- for (let i = map.height; i < height; i++)
2826
- rows.push(emptyRow);
2827
- tr.insert(tr.mapping.slice(mapFrom).map(start + table.nodeSize - 2), rows);
2828
- }
2829
- return !!(empty || emptyHead);
2830
- }
2831
- function isolateHorizontal(tr, map, table, start, left, right, top, mapFrom) {
2832
- if (top == 0 || top == map.height)
2833
- return false;
2834
- let found = false;
2835
- for (let col = left; col < right; col++) {
2836
- const index = top * map.width + col, pos = map.map[index];
2837
- if (map.map[index - map.width] == pos) {
2838
- found = true;
2839
- const cell = table.nodeAt(pos);
2840
- const { top: cellTop, left: cellLeft } = map.findCell(pos);
2841
- tr.setNodeMarkup(tr.mapping.slice(mapFrom).map(pos + start), null, {
2842
- ...cell.attrs,
2843
- rowspan: top - cellTop
2844
- });
2845
- tr.insert(
2846
- tr.mapping.slice(mapFrom).map(map.positionAt(top, cellLeft, table)),
2847
- cell.type.createAndFill({
2848
- ...cell.attrs,
2849
- rowspan: cellTop + cell.attrs.rowspan - top
2850
- })
2851
- );
2852
- col += cell.attrs.colspan - 1;
2853
- }
2854
- }
2855
- return found;
2856
- }
2857
- function isolateVertical(tr, map, table, start, top, bottom, left, mapFrom) {
2858
- if (left == 0 || left == map.width)
2859
- return false;
2860
- let found = false;
2861
- for (let row = top; row < bottom; row++) {
2862
- const index = row * map.width + left, pos = map.map[index];
2863
- if (map.map[index - 1] == pos) {
2864
- found = true;
2865
- const cell = table.nodeAt(pos);
2866
- const cellLeft = map.colCount(pos);
2867
- const updatePos = tr.mapping.slice(mapFrom).map(pos + start);
2868
- tr.setNodeMarkup(
2869
- updatePos,
2870
- null,
2871
- removeColSpan(
2872
- cell.attrs,
2873
- left - cellLeft,
2874
- cell.attrs.colspan - (left - cellLeft)
2875
- )
2876
- );
2877
- tr.insert(
2878
- updatePos + cell.nodeSize,
2879
- cell.type.createAndFill(
2880
- removeColSpan(cell.attrs, 0, left - cellLeft)
2881
- )
2882
- );
2883
- row += cell.attrs.rowspan - 1;
2884
- }
2885
- }
2886
- return found;
2887
- }
2888
- function insertCells(state, dispatch, tableStart, rect, cells) {
2889
- let table = tableStart ? state.doc.nodeAt(tableStart - 1) : state.doc;
2890
- if (!table) {
2891
- throw new Error("No table found");
2892
- }
2893
- let map = TableMap.get(table);
2894
- const { top, left } = rect;
2895
- const right = left + cells.width, bottom = top + cells.height;
2896
- const tr = state.tr;
2897
- let mapFrom = 0;
2898
- function recomp() {
2899
- table = tableStart ? tr.doc.nodeAt(tableStart - 1) : tr.doc;
2900
- if (!table) {
2901
- throw new Error("No table found");
2902
- }
2903
- map = TableMap.get(table);
2904
- mapFrom = tr.mapping.maps.length;
2905
- }
2906
- if (growTable(tr, map, table, tableStart, right, bottom, mapFrom))
2907
- recomp();
2908
- if (isolateHorizontal(tr, map, table, tableStart, left, right, top, mapFrom))
2909
- recomp();
2910
- if (isolateHorizontal(tr, map, table, tableStart, left, right, bottom, mapFrom))
2911
- recomp();
2912
- if (isolateVertical(tr, map, table, tableStart, top, bottom, left, mapFrom))
2913
- recomp();
2914
- if (isolateVertical(tr, map, table, tableStart, top, bottom, right, mapFrom))
2915
- recomp();
2916
- for (let row = top; row < bottom; row++) {
2917
- const from = map.positionAt(row, left, table), to = map.positionAt(row, right, table);
2918
- tr.replace(
2919
- tr.mapping.slice(mapFrom).map(from + tableStart),
2920
- tr.mapping.slice(mapFrom).map(to + tableStart),
2921
- new Slice(cells.rows[row - top], 0, 0)
2922
- );
2923
- }
2924
- recomp();
2925
- tr.setSelection(
2926
- new CellSelection(
2927
- tr.doc.resolve(tableStart + map.positionAt(top, left, table)),
2928
- tr.doc.resolve(tableStart + map.positionAt(bottom - 1, right - 1, table))
2929
- )
2930
- );
2931
- dispatch(tr);
2932
- }
2933
- var handleKeyDown2 = keydownHandler({
2934
- ArrowLeft: arrow2("horiz", -1),
2935
- ArrowRight: arrow2("horiz", 1),
2936
- ArrowUp: arrow2("vert", -1),
2937
- ArrowDown: arrow2("vert", 1),
2938
- "Shift-ArrowLeft": shiftArrow("horiz", -1),
2939
- "Shift-ArrowRight": shiftArrow("horiz", 1),
2940
- "Shift-ArrowUp": shiftArrow("vert", -1),
2941
- "Shift-ArrowDown": shiftArrow("vert", 1),
2942
- Backspace: deleteCellSelection,
2943
- "Mod-Backspace": deleteCellSelection,
2944
- Delete: deleteCellSelection,
2945
- "Mod-Delete": deleteCellSelection
2946
- });
2947
- function maybeSetSelection(state, dispatch, selection) {
2948
- if (selection.eq(state.selection))
2949
- return false;
2950
- if (dispatch)
2951
- dispatch(state.tr.setSelection(selection).scrollIntoView());
2952
- return true;
2953
- }
2954
- function arrow2(axis, dir) {
2955
- return (state, dispatch, view) => {
2956
- if (!view)
2957
- return false;
2958
- const sel = state.selection;
2959
- if (sel instanceof CellSelection) {
2960
- return maybeSetSelection(
2961
- state,
2962
- dispatch,
2963
- Selection.near(sel.$headCell, dir)
2964
- );
2965
- }
2966
- if (axis != "horiz" && !sel.empty)
2967
- return false;
2968
- const end = atEndOfCell(view, axis, dir);
2969
- if (end == null)
2970
- return false;
2971
- if (axis == "horiz") {
2972
- return maybeSetSelection(
2973
- state,
2974
- dispatch,
2975
- Selection.near(state.doc.resolve(sel.head + dir), dir)
2976
- );
2977
- } else {
2978
- const $cell = state.doc.resolve(end);
2979
- const $next = nextCell($cell, axis, dir);
2980
- let newSel;
2981
- if ($next)
2982
- newSel = Selection.near($next, 1);
2983
- else if (dir < 0)
2984
- newSel = Selection.near(state.doc.resolve($cell.before(-1)), -1);
2985
- else
2986
- newSel = Selection.near(state.doc.resolve($cell.after(-1)), 1);
2987
- return maybeSetSelection(state, dispatch, newSel);
2988
- }
2989
- };
2990
- }
2991
- function shiftArrow(axis, dir) {
2992
- return (state, dispatch, view) => {
2993
- if (!view)
2994
- return false;
2995
- const sel = state.selection;
2996
- let cellSel;
2997
- if (sel instanceof CellSelection) {
2998
- cellSel = sel;
2999
- } else {
3000
- const end = atEndOfCell(view, axis, dir);
3001
- if (end == null)
3002
- return false;
3003
- cellSel = new CellSelection(state.doc.resolve(end));
3004
- }
3005
- const $head = nextCell(cellSel.$headCell, axis, dir);
3006
- if (!$head)
3007
- return false;
3008
- return maybeSetSelection(
3009
- state,
3010
- dispatch,
3011
- new CellSelection(cellSel.$anchorCell, $head)
3012
- );
3013
- };
3014
- }
3015
- function handleTripleClick(view, pos) {
3016
- const doc = view.state.doc, $cell = cellAround(doc.resolve(pos));
3017
- if (!$cell)
3018
- return false;
3019
- view.dispatch(view.state.tr.setSelection(new CellSelection($cell)));
3020
- return true;
3021
- }
3022
- function handlePaste(view, _, slice) {
3023
- if (!isInTable(view.state))
3024
- return false;
3025
- let cells = pastedCells(slice);
3026
- const sel = view.state.selection;
3027
- if (sel instanceof CellSelection) {
3028
- if (!cells)
3029
- cells = {
3030
- width: 1,
3031
- height: 1,
3032
- rows: [
3033
- Fragment.from(
3034
- fitSlice(tableNodeTypes(view.state.schema).cell, slice)
3035
- )
3036
- ]
3037
- };
3038
- const table = sel.$anchorCell.node(-1);
3039
- const start = sel.$anchorCell.start(-1);
3040
- const rect = TableMap.get(table).rectBetween(
3041
- sel.$anchorCell.pos - start,
3042
- sel.$headCell.pos - start
3043
- );
3044
- cells = clipCells(cells, rect.right - rect.left, rect.bottom - rect.top);
3045
- insertCells(view.state, view.dispatch, start, rect, cells);
3046
- return true;
3047
- } else if (cells) {
3048
- const $cell = selectionCell(view.state);
3049
- const start = $cell.start(-1);
3050
- insertCells(
3051
- view.state,
3052
- view.dispatch,
3053
- start,
3054
- TableMap.get($cell.node(-1)).findCell($cell.pos - start),
3055
- cells
3056
- );
3057
- return true;
3058
- } else {
3059
- return false;
3060
- }
3061
- }
3062
- function handleMouseDown(view, startEvent) {
3063
- var _a;
3064
- if (startEvent.ctrlKey || startEvent.metaKey)
3065
- return;
3066
- const startDOMCell = domInCell(view, startEvent.target);
3067
- let $anchor;
3068
- if (startEvent.shiftKey && view.state.selection instanceof CellSelection) {
3069
- setCellSelection(view.state.selection.$anchorCell, startEvent);
3070
- startEvent.preventDefault();
3071
- } else if (startEvent.shiftKey && startDOMCell && ($anchor = cellAround(view.state.selection.$anchor)) != null && ((_a = cellUnderMouse(view, startEvent)) == null ? void 0 : _a.pos) != $anchor.pos) {
3072
- setCellSelection($anchor, startEvent);
3073
- startEvent.preventDefault();
3074
- } else if (!startDOMCell) {
3075
- return;
3076
- }
3077
- function setCellSelection($anchor2, event) {
3078
- let $head = cellUnderMouse(view, event);
3079
- const starting = tableEditingKey.getState(view.state) == null;
3080
- if (!$head || !inSameTable($anchor2, $head)) {
3081
- if (starting)
3082
- $head = $anchor2;
3083
- else
3084
- return;
3085
- }
3086
- const selection = new CellSelection($anchor2, $head);
3087
- if (starting || !view.state.selection.eq(selection)) {
3088
- const tr = view.state.tr.setSelection(selection);
3089
- if (starting)
3090
- tr.setMeta(tableEditingKey, $anchor2.pos);
3091
- view.dispatch(tr);
3092
- }
3093
- }
3094
- function stop() {
3095
- view.root.removeEventListener("mouseup", stop);
3096
- view.root.removeEventListener("dragstart", stop);
3097
- view.root.removeEventListener("mousemove", move);
3098
- if (tableEditingKey.getState(view.state) != null)
3099
- view.dispatch(view.state.tr.setMeta(tableEditingKey, -1));
3100
- }
3101
- function move(_event) {
3102
- const event = _event;
3103
- const anchor = tableEditingKey.getState(view.state);
3104
- let $anchor2;
3105
- if (anchor != null) {
3106
- $anchor2 = view.state.doc.resolve(anchor);
3107
- } else if (domInCell(view, event.target) != startDOMCell) {
3108
- $anchor2 = cellUnderMouse(view, startEvent);
3109
- if (!$anchor2)
3110
- return stop();
3111
- }
3112
- if ($anchor2)
3113
- setCellSelection($anchor2, event);
3114
- }
3115
- view.root.addEventListener("mouseup", stop);
3116
- view.root.addEventListener("dragstart", stop);
3117
- view.root.addEventListener("mousemove", move);
3118
- }
3119
- function atEndOfCell(view, axis, dir) {
3120
- if (!(view.state.selection instanceof TextSelection))
3121
- return null;
3122
- const { $head } = view.state.selection;
3123
- for (let d = $head.depth - 1; d >= 0; d--) {
3124
- const parent = $head.node(d), index = dir < 0 ? $head.index(d) : $head.indexAfter(d);
3125
- if (index != (dir < 0 ? 0 : parent.childCount))
3126
- return null;
3127
- if (parent.type.spec.tableRole == "cell" || parent.type.spec.tableRole == "header_cell") {
3128
- const cellPos = $head.before(d);
3129
- const dirStr = axis == "vert" ? dir > 0 ? "down" : "up" : dir > 0 ? "right" : "left";
3130
- return view.endOfTextblock(dirStr) ? cellPos : null;
3131
- }
3132
- }
3133
- return null;
3134
- }
3135
- function domInCell(view, dom) {
3136
- for (; dom && dom != view.dom; dom = dom.parentNode) {
3137
- if (dom.nodeName == "TD" || dom.nodeName == "TH") {
3138
- return dom;
3139
- }
3140
- }
3141
- return null;
3142
- }
3143
- function cellUnderMouse(view, event) {
3144
- const mousePos = view.posAtCoords({
3145
- left: event.clientX,
3146
- top: event.clientY
3147
- });
3148
- if (!mousePos)
3149
- return null;
3150
- return mousePos ? cellAround(view.state.doc.resolve(mousePos.pos)) : null;
3151
- }
3152
- var TableView = class {
3153
- constructor(node, defaultCellMinWidth) {
3154
- this.node = node;
3155
- this.defaultCellMinWidth = defaultCellMinWidth;
3156
- this.dom = document.createElement("div");
3157
- this.dom.className = "tableWrapper";
3158
- this.table = this.dom.appendChild(document.createElement("table"));
3159
- this.table.style.setProperty(
3160
- "--default-cell-min-width",
3161
- `${defaultCellMinWidth}px`
3162
- );
3163
- this.colgroup = this.table.appendChild(document.createElement("colgroup"));
3164
- updateColumnsOnResize(node, this.colgroup, this.table, defaultCellMinWidth);
3165
- this.contentDOM = this.table.appendChild(document.createElement("tbody"));
3166
- }
3167
- update(node) {
3168
- if (node.type != this.node.type)
3169
- return false;
3170
- this.node = node;
3171
- updateColumnsOnResize(
3172
- node,
3173
- this.colgroup,
3174
- this.table,
3175
- this.defaultCellMinWidth
3176
- );
3177
- return true;
3178
- }
3179
- ignoreMutation(record) {
3180
- return record.type == "attributes" && (record.target == this.table || this.colgroup.contains(record.target));
3181
- }
3182
- };
3183
- function updateColumnsOnResize(node, colgroup, table, defaultCellMinWidth, overrideCol, overrideValue) {
3184
- var _a;
3185
- let totalWidth = 0;
3186
- let fixedWidth = true;
3187
- let nextDOM = colgroup.firstChild;
3188
- const row = node.firstChild;
3189
- if (!row)
3190
- return;
3191
- for (let i = 0, col = 0; i < row.childCount; i++) {
3192
- const { colspan, colwidth } = row.child(i).attrs;
3193
- for (let j = 0; j < colspan; j++, col++) {
3194
- const hasWidth = overrideCol == col ? overrideValue : colwidth && colwidth[j];
3195
- const cssWidth = hasWidth ? hasWidth + "px" : "";
3196
- totalWidth += hasWidth || defaultCellMinWidth;
3197
- if (!hasWidth)
3198
- fixedWidth = false;
3199
- if (!nextDOM) {
3200
- const col2 = document.createElement("col");
3201
- col2.style.width = cssWidth;
3202
- colgroup.appendChild(col2);
3203
- } else {
3204
- if (nextDOM.style.width != cssWidth) {
3205
- nextDOM.style.width = cssWidth;
3206
- }
3207
- nextDOM = nextDOM.nextSibling;
3208
- }
3209
- }
3210
- }
3211
- while (nextDOM) {
3212
- const after = nextDOM.nextSibling;
3213
- (_a = nextDOM.parentNode) == null ? void 0 : _a.removeChild(nextDOM);
3214
- nextDOM = after;
3215
- }
3216
- if (fixedWidth) {
3217
- table.style.width = totalWidth + "px";
3218
- table.style.minWidth = "";
3219
- } else {
3220
- table.style.width = "";
3221
- table.style.minWidth = totalWidth + "px";
3222
- }
3223
- }
3224
- var columnResizingPluginKey = new PluginKey(
3225
- "tableColumnResizing"
3226
- );
3227
- function columnResizing({
3228
- handleWidth = 5,
3229
- cellMinWidth = 25,
3230
- defaultCellMinWidth = 100,
3231
- View = TableView,
3232
- lastColumnResizable = true
3233
- } = {}) {
3234
- const plugin = new Plugin({
3235
- key: columnResizingPluginKey,
3236
- state: {
3237
- init(_, state) {
3238
- var _a, _b;
3239
- const nodeViews = (_b = (_a = plugin.spec) == null ? void 0 : _a.props) == null ? void 0 : _b.nodeViews;
3240
- const tableName = tableNodeTypes(state.schema).table.name;
3241
- if (View && nodeViews) {
3242
- nodeViews[tableName] = (node, view) => {
3243
- return new View(node, defaultCellMinWidth, view);
3244
- };
3245
- }
3246
- return new ResizeState(-1, false);
3247
- },
3248
- apply(tr, prev) {
3249
- return prev.apply(tr);
3250
- }
3251
- },
3252
- props: {
3253
- attributes: (state) => {
3254
- const pluginState = columnResizingPluginKey.getState(state);
3255
- return pluginState && pluginState.activeHandle > -1 ? { class: "resize-cursor" } : {};
3256
- },
3257
- handleDOMEvents: {
3258
- mousemove: (view, event) => {
3259
- handleMouseMove(view, event, handleWidth, lastColumnResizable);
3260
- },
3261
- mouseleave: (view) => {
3262
- handleMouseLeave(view);
3263
- },
3264
- mousedown: (view, event) => {
3265
- handleMouseDown2(view, event, cellMinWidth, defaultCellMinWidth);
3266
- }
3267
- },
3268
- decorations: (state) => {
3269
- const pluginState = columnResizingPluginKey.getState(state);
3270
- if (pluginState && pluginState.activeHandle > -1) {
3271
- return handleDecorations(state, pluginState.activeHandle);
3272
- }
3273
- },
3274
- nodeViews: {}
3275
- }
3276
- });
3277
- return plugin;
3278
- }
3279
- var ResizeState = class _ResizeState {
3280
- constructor(activeHandle, dragging) {
3281
- this.activeHandle = activeHandle;
3282
- this.dragging = dragging;
3283
- }
3284
- apply(tr) {
3285
- const state = this;
3286
- const action = tr.getMeta(columnResizingPluginKey);
3287
- if (action && action.setHandle != null)
3288
- return new _ResizeState(action.setHandle, false);
3289
- if (action && action.setDragging !== void 0)
3290
- return new _ResizeState(state.activeHandle, action.setDragging);
3291
- if (state.activeHandle > -1 && tr.docChanged) {
3292
- let handle = tr.mapping.map(state.activeHandle, -1);
3293
- if (!pointsAtCell(tr.doc.resolve(handle))) {
3294
- handle = -1;
3295
- }
3296
- return new _ResizeState(handle, state.dragging);
3297
- }
3298
- return state;
3299
- }
3300
- };
3301
- function handleMouseMove(view, event, handleWidth, lastColumnResizable) {
3302
- const pluginState = columnResizingPluginKey.getState(view.state);
3303
- if (!pluginState)
3304
- return;
3305
- if (!pluginState.dragging) {
3306
- const target = domCellAround(event.target);
3307
- let cell = -1;
3308
- if (target) {
3309
- const { left, right } = target.getBoundingClientRect();
3310
- if (event.clientX - left <= handleWidth)
3311
- cell = edgeCell(view, event, "left", handleWidth);
3312
- else if (right - event.clientX <= handleWidth)
3313
- cell = edgeCell(view, event, "right", handleWidth);
3314
- }
3315
- if (cell != pluginState.activeHandle) {
3316
- if (!lastColumnResizable && cell !== -1) {
3317
- const $cell = view.state.doc.resolve(cell);
3318
- const table = $cell.node(-1);
3319
- const map = TableMap.get(table);
3320
- const tableStart = $cell.start(-1);
3321
- const col = map.colCount($cell.pos - tableStart) + $cell.nodeAfter.attrs.colspan - 1;
3322
- if (col == map.width - 1) {
3323
- return;
3324
- }
3325
- }
3326
- updateHandle(view, cell);
3327
- }
3328
- }
3329
- }
3330
- function handleMouseLeave(view) {
3331
- const pluginState = columnResizingPluginKey.getState(view.state);
3332
- if (pluginState && pluginState.activeHandle > -1 && !pluginState.dragging)
3333
- updateHandle(view, -1);
3334
- }
3335
- function handleMouseDown2(view, event, cellMinWidth, defaultCellMinWidth) {
3336
- var _a;
3337
- const win = (_a = view.dom.ownerDocument.defaultView) != null ? _a : window;
3338
- const pluginState = columnResizingPluginKey.getState(view.state);
3339
- if (!pluginState || pluginState.activeHandle == -1 || pluginState.dragging)
3340
- return false;
3341
- const cell = view.state.doc.nodeAt(pluginState.activeHandle);
3342
- const width = currentColWidth(view, pluginState.activeHandle, cell.attrs);
3343
- view.dispatch(
3344
- view.state.tr.setMeta(columnResizingPluginKey, {
3345
- setDragging: { startX: event.clientX, startWidth: width }
3346
- })
3347
- );
3348
- function finish(event2) {
3349
- win.removeEventListener("mouseup", finish);
3350
- win.removeEventListener("mousemove", move);
3351
- const pluginState2 = columnResizingPluginKey.getState(view.state);
3352
- if (pluginState2 == null ? void 0 : pluginState2.dragging) {
3353
- updateColumnWidth(
3354
- view,
3355
- pluginState2.activeHandle,
3356
- draggedWidth(pluginState2.dragging, event2, cellMinWidth)
3357
- );
3358
- view.dispatch(
3359
- view.state.tr.setMeta(columnResizingPluginKey, { setDragging: null })
3360
- );
3361
- }
3362
- }
3363
- function move(event2) {
3364
- if (!event2.which)
3365
- return finish(event2);
3366
- const pluginState2 = columnResizingPluginKey.getState(view.state);
3367
- if (!pluginState2)
3368
- return;
3369
- if (pluginState2.dragging) {
3370
- const dragged = draggedWidth(pluginState2.dragging, event2, cellMinWidth);
3371
- displayColumnWidth(
3372
- view,
3373
- pluginState2.activeHandle,
3374
- dragged,
3375
- defaultCellMinWidth
3376
- );
3377
- }
3378
- }
3379
- displayColumnWidth(
3380
- view,
3381
- pluginState.activeHandle,
3382
- width,
3383
- defaultCellMinWidth
3384
- );
3385
- win.addEventListener("mouseup", finish);
3386
- win.addEventListener("mousemove", move);
3387
- event.preventDefault();
3388
- return true;
3389
- }
3390
- function currentColWidth(view, cellPos, { colspan, colwidth }) {
3391
- const width = colwidth && colwidth[colwidth.length - 1];
3392
- if (width)
3393
- return width;
3394
- const dom = view.domAtPos(cellPos);
3395
- const node = dom.node.childNodes[dom.offset];
3396
- let domWidth = node.offsetWidth, parts = colspan;
3397
- if (colwidth) {
3398
- for (let i = 0; i < colspan; i++)
3399
- if (colwidth[i]) {
3400
- domWidth -= colwidth[i];
3401
- parts--;
3402
- }
3403
- }
3404
- return domWidth / parts;
3405
- }
3406
- function domCellAround(target) {
3407
- while (target && target.nodeName != "TD" && target.nodeName != "TH")
3408
- target = target.classList && target.classList.contains("ProseMirror") ? null : target.parentNode;
3409
- return target;
3410
- }
3411
- function edgeCell(view, event, side, handleWidth) {
3412
- const offset = side == "right" ? -handleWidth : handleWidth;
3413
- const found = view.posAtCoords({
3414
- left: event.clientX + offset,
3415
- top: event.clientY
3416
- });
3417
- if (!found)
3418
- return -1;
3419
- const { pos } = found;
3420
- const $cell = cellAround(view.state.doc.resolve(pos));
3421
- if (!$cell)
3422
- return -1;
3423
- if (side == "right")
3424
- return $cell.pos;
3425
- const map = TableMap.get($cell.node(-1)), start = $cell.start(-1);
3426
- const index = map.map.indexOf($cell.pos - start);
3427
- return index % map.width == 0 ? -1 : start + map.map[index - 1];
3428
- }
3429
- function draggedWidth(dragging, event, resizeMinWidth) {
3430
- const offset = event.clientX - dragging.startX;
3431
- return Math.max(resizeMinWidth, dragging.startWidth + offset);
3432
- }
3433
- function updateHandle(view, value) {
3434
- view.dispatch(
3435
- view.state.tr.setMeta(columnResizingPluginKey, { setHandle: value })
3436
- );
3437
- }
3438
- function updateColumnWidth(view, cell, width) {
3439
- const $cell = view.state.doc.resolve(cell);
3440
- const table = $cell.node(-1), map = TableMap.get(table), start = $cell.start(-1);
3441
- const col = map.colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1;
3442
- const tr = view.state.tr;
3443
- for (let row = 0; row < map.height; row++) {
3444
- const mapIndex = row * map.width + col;
3445
- if (row && map.map[mapIndex] == map.map[mapIndex - map.width])
3446
- continue;
3447
- const pos = map.map[mapIndex];
3448
- const attrs = table.nodeAt(pos).attrs;
3449
- const index = attrs.colspan == 1 ? 0 : col - map.colCount(pos);
3450
- if (attrs.colwidth && attrs.colwidth[index] == width)
3451
- continue;
3452
- const colwidth = attrs.colwidth ? attrs.colwidth.slice() : zeroes(attrs.colspan);
3453
- colwidth[index] = width;
3454
- tr.setNodeMarkup(start + pos, null, { ...attrs, colwidth });
3455
- }
3456
- if (tr.docChanged)
3457
- view.dispatch(tr);
3458
- }
3459
- function displayColumnWidth(view, cell, width, defaultCellMinWidth) {
3460
- const $cell = view.state.doc.resolve(cell);
3461
- const table = $cell.node(-1), start = $cell.start(-1);
3462
- const col = TableMap.get(table).colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1;
3463
- let dom = view.domAtPos($cell.start(-1)).node;
3464
- while (dom && dom.nodeName != "TABLE") {
3465
- dom = dom.parentNode;
3466
- }
3467
- if (!dom)
3468
- return;
3469
- updateColumnsOnResize(
3470
- table,
3471
- dom.firstChild,
3472
- dom,
3473
- defaultCellMinWidth,
3474
- col,
3475
- width
3476
- );
3477
- }
3478
- function zeroes(n) {
3479
- return Array(n).fill(0);
3480
- }
3481
- function handleDecorations(state, cell) {
3482
- var _a;
3483
- const decorations = [];
3484
- const $cell = state.doc.resolve(cell);
3485
- const table = $cell.node(-1);
3486
- if (!table) {
3487
- return DecorationSet.empty;
3488
- }
3489
- const map = TableMap.get(table);
3490
- const start = $cell.start(-1);
3491
- const col = map.colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1;
3492
- for (let row = 0; row < map.height; row++) {
3493
- const index = col + row * map.width;
3494
- if ((col == map.width - 1 || map.map[index] != map.map[index + 1]) && (row == 0 || map.map[index] != map.map[index - map.width])) {
3495
- const cellPos = map.map[index];
3496
- const pos = start + cellPos + table.nodeAt(cellPos).nodeSize - 1;
3497
- const dom = document.createElement("div");
3498
- dom.className = "column-resize-handle";
3499
- if ((_a = columnResizingPluginKey.getState(state)) == null ? void 0 : _a.dragging) {
3500
- decorations.push(
3501
- Decoration.node(
3502
- start + cellPos,
3503
- start + cellPos + table.nodeAt(cellPos).nodeSize,
3504
- {
3505
- class: "column-resize-dragging"
3506
- }
3507
- )
3508
- );
3509
- }
3510
- decorations.push(Decoration.widget(pos, dom));
3511
- }
3512
- }
3513
- return DecorationSet.create(state.doc, decorations);
3514
- }
3515
- function tableEditing({
3516
- allowTableNodeSelection = false
3517
- } = {}) {
3518
- return new Plugin({
3519
- key: tableEditingKey,
3520
- // This piece of state is used to remember when a mouse-drag
3521
- // cell-selection is happening, so that it can continue even as
3522
- // transactions (which might move its anchor cell) come in.
3523
- state: {
3524
- init() {
3525
- return null;
3526
- },
3527
- apply(tr, cur) {
3528
- const set = tr.getMeta(tableEditingKey);
3529
- if (set != null)
3530
- return set == -1 ? null : set;
3531
- if (cur == null || !tr.docChanged)
3532
- return cur;
3533
- const { deleted, pos } = tr.mapping.mapResult(cur);
3534
- return deleted ? null : pos;
3535
- }
3536
- },
3537
- props: {
3538
- decorations: drawCellSelection,
3539
- handleDOMEvents: {
3540
- mousedown: handleMouseDown
3541
- },
3542
- createSelectionBetween(view) {
3543
- return tableEditingKey.getState(view.state) != null ? view.state.selection : null;
3544
- },
3545
- handleTripleClick,
3546
- handleKeyDown: handleKeyDown2,
3547
- handlePaste
3548
- },
3549
- appendTransaction(_, oldState, state) {
3550
- return normalizeSelection(
3551
- state,
3552
- fixTables(state, oldState),
3553
- allowTableNodeSelection
3554
- );
3555
- }
3556
- });
3557
- }
3558
-
3559
- // node_modules/@tiptap/extension-table/dist/index.js
3560
- function getColStyleDeclaration(minWidth, width) {
3561
- if (width) {
3562
- return ["width", `${Math.max(width, minWidth)}px`];
3563
- }
3564
- return ["min-width", `${minWidth}px`];
3565
- }
3566
- function updateColumns(node, colgroup, table, cellMinWidth, overrideCol, overrideValue) {
3567
- var _a;
3568
- let totalWidth = 0;
3569
- let fixedWidth = true;
3570
- let nextDOM = colgroup.firstChild;
3571
- const row = node.firstChild;
3572
- if (row !== null) {
3573
- for (let i = 0, col = 0; i < row.childCount; i += 1) {
3574
- const { colspan, colwidth } = row.child(i).attrs;
3575
- for (let j = 0; j < colspan; j += 1, col += 1) {
3576
- const hasWidth = overrideCol === col ? overrideValue : colwidth && colwidth[j];
3577
- const cssWidth = hasWidth ? `${hasWidth}px` : "";
3578
- totalWidth += hasWidth || cellMinWidth;
3579
- if (!hasWidth) {
3580
- fixedWidth = false;
3581
- }
3582
- if (!nextDOM) {
3583
- const colElement = document.createElement("col");
3584
- const [propertyKey, propertyValue] = getColStyleDeclaration(cellMinWidth, hasWidth);
3585
- colElement.style.setProperty(propertyKey, propertyValue);
3586
- colgroup.appendChild(colElement);
3587
- } else {
3588
- if (nextDOM.style.width !== cssWidth) {
3589
- const [propertyKey, propertyValue] = getColStyleDeclaration(cellMinWidth, hasWidth);
3590
- nextDOM.style.setProperty(propertyKey, propertyValue);
3591
- }
3592
- nextDOM = nextDOM.nextSibling;
3593
- }
3594
- }
3595
- }
3596
- }
3597
- while (nextDOM) {
3598
- const after = nextDOM.nextSibling;
3599
- (_a = nextDOM.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(nextDOM);
3600
- nextDOM = after;
3601
- }
3602
- if (fixedWidth) {
3603
- table.style.width = `${totalWidth}px`;
3604
- table.style.minWidth = "";
3605
- } else {
3606
- table.style.width = "";
3607
- table.style.minWidth = `${totalWidth}px`;
3608
- }
3609
- }
3610
- var TableView2 = class {
3611
- constructor(node, cellMinWidth) {
3612
- this.node = node;
3613
- this.cellMinWidth = cellMinWidth;
3614
- this.dom = document.createElement("div");
3615
- this.dom.className = "tableWrapper";
3616
- this.table = this.dom.appendChild(document.createElement("table"));
3617
- this.colgroup = this.table.appendChild(document.createElement("colgroup"));
3618
- updateColumns(node, this.colgroup, this.table, cellMinWidth);
3619
- this.contentDOM = this.table.appendChild(document.createElement("tbody"));
3620
- }
3621
- update(node) {
3622
- if (node.type !== this.node.type) {
3623
- return false;
3624
- }
3625
- this.node = node;
3626
- updateColumns(node, this.colgroup, this.table, this.cellMinWidth);
3627
- return true;
3628
- }
3629
- ignoreMutation(mutation) {
3630
- return mutation.type === "attributes" && (mutation.target === this.table || this.colgroup.contains(mutation.target));
3631
- }
3632
- };
3633
- function createColGroup(node, cellMinWidth, overrideCol, overrideValue) {
3634
- let totalWidth = 0;
3635
- let fixedWidth = true;
3636
- const cols = [];
3637
- const row = node.firstChild;
3638
- if (!row) {
3639
- return {};
3640
- }
3641
- for (let i = 0, col = 0; i < row.childCount; i += 1) {
3642
- const { colspan, colwidth } = row.child(i).attrs;
3643
- for (let j = 0; j < colspan; j += 1, col += 1) {
3644
- const hasWidth = overrideCol === col ? overrideValue : colwidth && colwidth[j];
3645
- totalWidth += hasWidth || cellMinWidth;
3646
- if (!hasWidth) {
3647
- fixedWidth = false;
3648
- }
3649
- const [property, value] = getColStyleDeclaration(cellMinWidth, hasWidth);
3650
- cols.push([
3651
- "col",
3652
- { style: `${property}: ${value}` }
3653
- ]);
3654
- }
3655
- }
3656
- const tableWidth = fixedWidth ? `${totalWidth}px` : "";
3657
- const tableMinWidth = fixedWidth ? "" : `${totalWidth}px`;
3658
- const colgroup = ["colgroup", {}, ...cols];
3659
- return { colgroup, tableWidth, tableMinWidth };
3660
- }
3661
- function createCell(cellType, cellContent) {
3662
- if (cellContent) {
3663
- return cellType.createChecked(null, cellContent);
3664
- }
3665
- return cellType.createAndFill();
3666
- }
3667
- function getTableNodeTypes(schema) {
3668
- if (schema.cached.tableNodeTypes) {
3669
- return schema.cached.tableNodeTypes;
3670
- }
3671
- const roles = {};
3672
- Object.keys(schema.nodes).forEach((type) => {
3673
- const nodeType = schema.nodes[type];
3674
- if (nodeType.spec.tableRole) {
3675
- roles[nodeType.spec.tableRole] = nodeType;
3676
- }
3677
- });
3678
- schema.cached.tableNodeTypes = roles;
3679
- return roles;
3680
- }
3681
- function createTable(schema, rowsCount, colsCount, withHeaderRow, cellContent) {
3682
- const types = getTableNodeTypes(schema);
3683
- const headerCells = [];
3684
- const cells = [];
3685
- for (let index = 0; index < colsCount; index += 1) {
3686
- const cell = createCell(types.cell, cellContent);
3687
- if (cell) {
3688
- cells.push(cell);
3689
- }
3690
- if (withHeaderRow) {
3691
- const headerCell = createCell(types.header_cell, cellContent);
3692
- if (headerCell) {
3693
- headerCells.push(headerCell);
3694
- }
3695
- }
3696
- }
3697
- const rows = [];
3698
- for (let index = 0; index < rowsCount; index += 1) {
3699
- rows.push(types.row.createChecked(null, withHeaderRow && index === 0 ? headerCells : cells));
3700
- }
3701
- return types.table.createChecked(null, rows);
3702
- }
3703
- function isCellSelection(value) {
3704
- return value instanceof CellSelection;
3705
- }
3706
- var deleteTableWhenAllCellsSelected = ({ editor }) => {
3707
- const { selection } = editor.state;
3708
- if (!isCellSelection(selection)) {
3709
- return false;
3710
- }
3711
- let cellCount = 0;
3712
- const table = findParentNodeClosestToPos(selection.ranges[0].$from, (node) => {
3713
- return node.type.name === "table";
3714
- });
3715
- table === null || table === void 0 ? void 0 : table.node.descendants((node) => {
3716
- if (node.type.name === "table") {
3717
- return false;
3718
- }
3719
- if (["tableCell", "tableHeader"].includes(node.type.name)) {
3720
- cellCount += 1;
3721
- }
3722
- });
3723
- const allCellsSelected = cellCount === selection.ranges.length;
3724
- if (!allCellsSelected) {
3725
- return false;
3726
- }
3727
- editor.commands.deleteTable();
3728
- return true;
3729
- };
3730
- var Table = Node.create({
3731
- name: "table",
3732
- // @ts-ignore
3733
- addOptions() {
3734
- return {
3735
- HTMLAttributes: {},
3736
- resizable: false,
3737
- handleWidth: 5,
3738
- cellMinWidth: 25,
3739
- // TODO: fix
3740
- View: TableView2,
3741
- lastColumnResizable: true,
3742
- allowTableNodeSelection: false
3743
- };
3744
- },
3745
- content: "tableRow+",
3746
- tableRole: "table",
3747
- isolating: true,
3748
- group: "block",
3749
- parseHTML() {
3750
- return [{ tag: "table" }];
3751
- },
3752
- renderHTML({ node, HTMLAttributes }) {
3753
- const { colgroup, tableWidth, tableMinWidth } = createColGroup(node, this.options.cellMinWidth);
3754
- const table = [
3755
- "table",
3756
- mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, {
3757
- style: tableWidth ? `width: ${tableWidth}` : `min-width: ${tableMinWidth}`
3758
- }),
3759
- colgroup,
3760
- ["tbody", 0]
3761
- ];
3762
- return table;
3763
- },
3764
- addCommands() {
3765
- return {
3766
- insertTable: ({ rows = 3, cols = 3, withHeaderRow = true } = {}) => ({ tr, dispatch, editor }) => {
3767
- const node = createTable(editor.schema, rows, cols, withHeaderRow);
3768
- if (dispatch) {
3769
- const offset = tr.selection.from + 1;
3770
- tr.replaceSelectionWith(node).scrollIntoView().setSelection(TextSelection.near(tr.doc.resolve(offset)));
3771
- }
3772
- return true;
3773
- },
3774
- addColumnBefore: () => ({ state, dispatch }) => {
3775
- return addColumnBefore(state, dispatch);
3776
- },
3777
- addColumnAfter: () => ({ state, dispatch }) => {
3778
- return addColumnAfter(state, dispatch);
3779
- },
3780
- deleteColumn: () => ({ state, dispatch }) => {
3781
- return deleteColumn(state, dispatch);
3782
- },
3783
- addRowBefore: () => ({ state, dispatch }) => {
3784
- return addRowBefore(state, dispatch);
3785
- },
3786
- addRowAfter: () => ({ state, dispatch }) => {
3787
- return addRowAfter(state, dispatch);
3788
- },
3789
- deleteRow: () => ({ state, dispatch }) => {
3790
- return deleteRow(state, dispatch);
3791
- },
3792
- deleteTable: () => ({ state, dispatch }) => {
3793
- return deleteTable(state, dispatch);
3794
- },
3795
- mergeCells: () => ({ state, dispatch }) => {
3796
- return mergeCells(state, dispatch);
3797
- },
3798
- splitCell: () => ({ state, dispatch }) => {
3799
- return splitCell(state, dispatch);
3800
- },
3801
- toggleHeaderColumn: () => ({ state, dispatch }) => {
3802
- return toggleHeader("column")(state, dispatch);
3803
- },
3804
- toggleHeaderRow: () => ({ state, dispatch }) => {
3805
- return toggleHeader("row")(state, dispatch);
3806
- },
3807
- toggleHeaderCell: () => ({ state, dispatch }) => {
3808
- return toggleHeaderCell(state, dispatch);
3809
- },
3810
- mergeOrSplit: () => ({ state, dispatch }) => {
3811
- if (mergeCells(state, dispatch)) {
3812
- return true;
3813
- }
3814
- return splitCell(state, dispatch);
3815
- },
3816
- setCellAttribute: (name, value) => ({ state, dispatch }) => {
3817
- return setCellAttr(name, value)(state, dispatch);
3818
- },
3819
- goToNextCell: () => ({ state, dispatch }) => {
3820
- return goToNextCell(1)(state, dispatch);
3821
- },
3822
- goToPreviousCell: () => ({ state, dispatch }) => {
3823
- return goToNextCell(-1)(state, dispatch);
3824
- },
3825
- fixTables: () => ({ state, dispatch }) => {
3826
- if (dispatch) {
3827
- fixTables(state);
3828
- }
3829
- return true;
3830
- },
3831
- setCellSelection: (position) => ({ tr, dispatch }) => {
3832
- if (dispatch) {
3833
- const selection = CellSelection.create(tr.doc, position.anchorCell, position.headCell);
3834
- tr.setSelection(selection);
3835
- }
3836
- return true;
3837
- }
3838
- };
3839
- },
3840
- addKeyboardShortcuts() {
3841
- return {
3842
- Tab: () => {
3843
- if (this.editor.commands.goToNextCell()) {
3844
- return true;
3845
- }
3846
- if (!this.editor.can().addRowAfter()) {
3847
- return false;
3848
- }
3849
- return this.editor.chain().addRowAfter().goToNextCell().run();
3850
- },
3851
- "Shift-Tab": () => this.editor.commands.goToPreviousCell(),
3852
- Backspace: deleteTableWhenAllCellsSelected,
3853
- "Mod-Backspace": deleteTableWhenAllCellsSelected,
3854
- Delete: deleteTableWhenAllCellsSelected,
3855
- "Mod-Delete": deleteTableWhenAllCellsSelected
3856
- };
3857
- },
3858
- addProseMirrorPlugins() {
3859
- const isResizable = this.options.resizable && this.editor.isEditable;
3860
- return [
3861
- ...isResizable ? [
3862
- columnResizing({
3863
- handleWidth: this.options.handleWidth,
3864
- cellMinWidth: this.options.cellMinWidth,
3865
- defaultCellMinWidth: this.options.cellMinWidth,
3866
- View: this.options.View,
3867
- lastColumnResizable: this.options.lastColumnResizable
3868
- })
3869
- ] : [],
3870
- tableEditing({
3871
- allowTableNodeSelection: this.options.allowTableNodeSelection
3872
- })
3873
- ];
3874
- },
3875
- extendNodeSchema(extension) {
3876
- const context = {
3877
- name: extension.name,
3878
- options: extension.options,
3879
- storage: extension.storage
3880
- };
3881
- return {
3882
- tableRole: callOrReturn(getExtensionField(extension, "tableRole", context))
3883
- };
3884
- }
3885
- });
3886
-
3887
- // node_modules/@tiptap/extension-table-cell/dist/index.js
3888
- var TableCell = Node.create({
3889
- name: "tableCell",
3890
- addOptions() {
3891
- return {
3892
- HTMLAttributes: {}
3893
- };
3894
- },
3895
- content: "block+",
3896
- addAttributes() {
3897
- return {
3898
- colspan: {
3899
- default: 1
3900
- },
3901
- rowspan: {
3902
- default: 1
3903
- },
3904
- colwidth: {
3905
- default: null,
3906
- parseHTML: (element) => {
3907
- const colwidth = element.getAttribute("colwidth");
3908
- const value = colwidth ? colwidth.split(",").map((width) => parseInt(width, 10)) : null;
3909
- return value;
3910
- }
3911
- }
3912
- };
3913
- },
3914
- tableRole: "cell",
3915
- isolating: true,
3916
- parseHTML() {
3917
- return [
3918
- { tag: "td" }
3919
- ];
3920
- },
3921
- renderHTML({ HTMLAttributes }) {
3922
- return ["td", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
3923
- }
3924
- });
3925
-
3926
- // node_modules/@tiptap/extension-table-header/dist/index.js
3927
- var TableHeader = Node.create({
3928
- name: "tableHeader",
3929
- addOptions() {
3930
- return {
3931
- HTMLAttributes: {}
3932
- };
3933
- },
3934
- content: "block+",
3935
- addAttributes() {
3936
- return {
3937
- colspan: {
3938
- default: 1
3939
- },
3940
- rowspan: {
3941
- default: 1
3942
- },
3943
- colwidth: {
3944
- default: null,
3945
- parseHTML: (element) => {
3946
- const colwidth = element.getAttribute("colwidth");
3947
- const value = colwidth ? colwidth.split(",").map((width) => parseInt(width, 10)) : null;
3948
- return value;
3949
- }
3950
- }
3951
- };
3952
- },
3953
- tableRole: "header_cell",
3954
- isolating: true,
3955
- parseHTML() {
3956
- return [
3957
- { tag: "th" }
3958
- ];
3959
- },
3960
- renderHTML({ HTMLAttributes }) {
3961
- return ["th", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
3962
- }
3963
- });
3964
-
3965
- // node_modules/@tiptap/extension-table-row/dist/index.js
3966
- var TableRow = Node.create({
3967
- name: "tableRow",
3968
- addOptions() {
3969
- return {
3970
- HTMLAttributes: {}
3971
- };
3972
- },
3973
- content: "(tableCell | tableHeader)*",
3974
- tableRole: "row",
3975
- parseHTML() {
3976
- return [
3977
- { tag: "tr" }
3978
- ];
3979
- },
3980
- renderHTML({ HTMLAttributes }) {
3981
- return ["tr", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
3982
- }
3983
- });
3984
-
3985
- // node_modules/@tiptap/extension-text/dist/index.js
3986
- var Text = Node.create({
3987
- name: "text",
3988
- group: "inline"
3989
- });
3990
-
3991
- // node_modules/@tiptap/extension-text-align/dist/index.js
3992
- var TextAlign = Extension.create({
3993
- name: "textAlign",
3994
- addOptions() {
3995
- return {
3996
- types: [],
3997
- alignments: ["left", "center", "right", "justify"],
3998
- defaultAlignment: null
3999
- };
4000
- },
4001
- addGlobalAttributes() {
4002
- return [
4003
- {
4004
- types: this.options.types,
4005
- attributes: {
4006
- textAlign: {
4007
- default: this.options.defaultAlignment,
4008
- parseHTML: (element) => {
4009
- const alignment = element.style.textAlign;
4010
- return this.options.alignments.includes(alignment) ? alignment : this.options.defaultAlignment;
4011
- },
4012
- renderHTML: (attributes) => {
4013
- if (!attributes.textAlign) {
4014
- return {};
4015
- }
4016
- return { style: `text-align: ${attributes.textAlign}` };
4017
- }
4018
- }
4019
- }
4020
- }
4021
- ];
4022
- },
4023
- addCommands() {
4024
- return {
4025
- setTextAlign: (alignment) => ({ commands }) => {
4026
- if (!this.options.alignments.includes(alignment)) {
4027
- return false;
4028
- }
4029
- return this.options.types.map((type) => commands.updateAttributes(type, { textAlign: alignment })).every((response) => response);
4030
- },
4031
- unsetTextAlign: () => ({ commands }) => {
4032
- return this.options.types.map((type) => commands.resetAttributes(type, "textAlign")).every((response) => response);
4033
- }
4034
- };
4035
- },
4036
- addKeyboardShortcuts() {
4037
- return {
4038
- "Mod-Shift-l": () => this.editor.commands.setTextAlign("left"),
4039
- "Mod-Shift-e": () => this.editor.commands.setTextAlign("center"),
4040
- "Mod-Shift-r": () => this.editor.commands.setTextAlign("right"),
4041
- "Mod-Shift-j": () => this.editor.commands.setTextAlign("justify")
4042
- };
4043
- }
4044
- });
4045
-
4046
- // src/field/richtext/Extensions.module.scss
4047
- var Extensions_module_default = {
4048
- "hyphenate": "alinea-Extensions-hyphenate",
4049
- "link": "alinea-Extensions-link",
4050
- "p": "alinea-Extensions-p",
4051
- "h5": "alinea-Extensions-h5",
4052
- "h4": "alinea-Extensions-h4",
4053
- "h3": "alinea-Extensions-h3",
4054
- "heading": "alinea-Extensions-heading",
4055
- "h2": "alinea-Extensions-h2",
4056
- "h1": "alinea-Extensions-h1",
4057
- "is-flat": "alinea-Extensions-is-flat",
4058
- "isFlat": "alinea-Extensions-is-flat",
4059
- "monospace": "alinea-Extensions-monospace",
4060
- "small": "alinea-Extensions-small",
4061
- "paragraph": "alinea-Extensions-paragraph",
4062
- "list": "alinea-Extensions-list",
4063
- "listItem": "alinea-Extensions-listItem",
4064
- "blockquote": "alinea-Extensions-blockquote",
4065
- "table": "alinea-Extensions-table",
4066
- "td": "alinea-Extensions-td",
4067
- "th": "alinea-Extensions-th",
4068
- "highlight": "alinea-Extensions-highlight"
4069
- };
1
+ import "../../chunks/chunk-CQ52GEHY.js";
4070
2
 
4071
3
  // src/field/richtext/Extensions.ts
4072
- import { Link } from "./extensions/Link.js";
4073
- import Small from "./extensions/Small.js";
4074
- var styles = dist_default(Extensions_module_default);
4075
- var extensions = {
4076
- Document,
4077
- Text,
4078
- Paragraph: Paragraph.configure({
4079
- HTMLAttributes: {
4080
- class: styles.paragraph()
4081
- }
4082
- }),
4083
- Small,
4084
- Bold,
4085
- Italic,
4086
- Strike,
4087
- HorizontalRule,
4088
- BulletList: BulletList.configure({
4089
- HTMLAttributes: {
4090
- class: styles.list()
4091
- }
4092
- }),
4093
- OrderedList: OrderedList.configure({
4094
- HTMLAttributes: {
4095
- class: styles.list()
4096
- }
4097
- }),
4098
- ListItem: ListItem.configure({
4099
- HTMLAttributes: {
4100
- class: styles.listItem()
4101
- }
4102
- }),
4103
- Blockquote: Blockquote.configure({
4104
- HTMLAttributes: {
4105
- class: styles.blockquote()
4106
- }
4107
- }),
4108
- HardBreak,
4109
- Heading: Heading.configure({
4110
- HTMLAttributes: {
4111
- class: styles.heading()
4112
- }
4113
- }),
4114
- TextAlign: TextAlign.configure({
4115
- types: ["heading", "paragraph"]
4116
- }),
4117
- Dropcursor,
4118
- Gapcursor,
4119
- Link: Link.configure({
4120
- HTMLAttributes: {
4121
- class: styles.link()
4122
- }
4123
- }),
4124
- FloatingMenu,
4125
- SuperScript: Superscript,
4126
- SubScript: Subscript,
4127
- Table: Table.configure({
4128
- HTMLAttributes: {
4129
- class: styles.table()
4130
- }
4131
- }),
4132
- TableCell: TableCell.configure({
4133
- HTMLAttributes: {
4134
- class: styles.td()
4135
- }
4136
- }),
4137
- TableHeader: TableHeader.configure({
4138
- HTMLAttributes: {
4139
- class: styles.th()
4140
- }
4141
- }),
4142
- TableRow,
4143
- Highlight: index_default.configure({
4144
- HTMLAttributes: {
4145
- class: styles.highlight()
4146
- }
4147
- })
4148
- };
4
+ import { extensions } from "./RichTextExtensions.js";
4149
5
  export {
4150
6
  extensions
4151
7
  };