@phtngyn/cms 0.2.0-beta.8 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (524) hide show
  1. package/LICENSE +18 -10
  2. package/README.md +59 -404
  3. package/drizzle/20261003215543_initial/migration.sql +251 -0
  4. package/drizzle/20261003215543_initial/snapshot.json +1941 -0
  5. package/package.json +75 -71
  6. package/src/Authoring.d.ts +41 -49
  7. package/src/Authoring.js +1 -1
  8. package/src/Blocks-BrxSemnd.js +40 -0
  9. package/src/Client.d.ts +8186 -0
  10. package/src/Client.js +41 -0
  11. package/src/Collections.d.ts +142 -0
  12. package/src/Collections.js +142 -0
  13. package/src/Config-CMiwciub.js +130 -0
  14. package/src/Config.d.ts +172 -0
  15. package/src/Config.js +2 -0
  16. package/src/Configuration-Dk2k3OIc.js +73 -0
  17. package/src/DataTransfer-BmECvPHB.js +488 -0
  18. package/src/Database-DSsNCGft.d.ts +3 -0
  19. package/src/Delivery.d.ts +28 -0
  20. package/src/Delivery.js +7 -0
  21. package/src/Document-CKXMSEf1.js +293 -0
  22. package/src/Document-TgwYKJZM.d.ts +220 -0
  23. package/src/DocumentRenderer-Wz2xaNyf.js +394 -0
  24. package/src/EditorSchema-wrDv-id6.js +296 -0
  25. package/src/Fields-BegSgYhj.d.ts +166 -0
  26. package/src/Fields-ioGaMEh9.js +130 -0
  27. package/src/Forms-BuKAXQxr.d.ts +203 -0
  28. package/src/Forms.d.ts +48 -11
  29. package/src/Forms.js +342 -7
  30. package/src/I18n-Ckf9h0rC.js +154 -0
  31. package/src/I18n.d.ts +45 -2
  32. package/src/I18n.js +2 -1
  33. package/src/Image-CJWPLnhP.js +110 -0
  34. package/src/Links-CJYyy7rC.js +28 -0
  35. package/src/Links-Dx1yOni8.d.ts +28 -0
  36. package/src/Locales-Ch7a5xuA.js +67 -0
  37. package/src/Locales-jwbmJaOp.d.ts +43 -0
  38. package/src/Locales.d.ts +3 -0
  39. package/src/Locales.js +3 -0
  40. package/src/Media-BQ0uL4w7.d.ts +15 -0
  41. package/src/Media-DSyvd14o.js +87 -0
  42. package/src/Module.d.ts +2 -10
  43. package/src/Module.js +1040 -152
  44. package/src/Operations.d.ts +57 -0
  45. package/src/Operations.js +263 -0
  46. package/src/People-DvNZauWw.js +69 -0
  47. package/src/PreviewFocus-C_EelZO5.js +104 -0
  48. package/src/Query-C0kGJF5_.d.ts +261 -0
  49. package/src/RevisionPreview-IVwbJ9Wy.js +133 -0
  50. package/src/Routes-BaZvm2LE.js +126 -0
  51. package/src/Routes-DM1rRp3r.d.ts +15 -0
  52. package/src/S3MediaObjects-y-WacEi9.js +193 -0
  53. package/src/Seo-BcpqxoAs.d.ts +57 -0
  54. package/src/Seo-CjNUtUkj.js +254 -0
  55. package/src/StudioApi-CXLwwocX.js +833 -0
  56. package/src/StudioErrors-T5zLGQ1M.js +117 -0
  57. package/src/StudioErrors-kq-E44lQ.d.ts +104 -0
  58. package/src/StudioServer.d.ts +20 -0
  59. package/src/StudioServer.js +34 -0
  60. package/src/answers-DcTg0Xv2.js +41 -0
  61. package/src/cli.js +681 -187
  62. package/src/contracts-rprW3ZOB.js +130 -0
  63. package/src/forms-3xuf0Ym7.d.ts +206 -0
  64. package/src/localeConfiguration-BPbkLi7-.js +32 -0
  65. package/src/localeContext-DhF3SPvM.js +59 -0
  66. package/src/locales-6OD4XGIZ.js +12 -0
  67. package/src/nuxtDelivery-BYX_Cddb.js +466 -0
  68. package/src/plugin-DTYuDaQu.js +7171 -0
  69. package/src/previewContext-dt3ZUh-w.js +4 -0
  70. package/src/previewRegions-CXjk5cbP.js +145 -0
  71. package/src/previewSource-fb-q3ESM.js +144 -0
  72. package/src/rendering-D9LVeEKX.js +47 -0
  73. package/src/rolldown-runtime-8H4AJuhK.js +14 -0
  74. package/src/runtime/CmsImage.js +38 -0
  75. package/src/runtime/DocumentPage.vue +10 -0
  76. package/src/runtime/DocumentPageContent.js +48 -0
  77. package/src/runtime/DocumentRenderer.d.ts +129 -0
  78. package/src/runtime/DocumentRenderer.js +2 -0
  79. package/src/runtime/api.js +48 -6
  80. package/src/runtime/delivery/useCmsDocument.js +2 -0
  81. package/src/runtime/delivery/useCmsDocumentQuery.js +2 -0
  82. package/src/runtime/delivery/useCmsDocumentSeo.js +2 -114
  83. package/src/runtime/delivery/useCmsLocale.js +10 -0
  84. package/src/runtime/plugin.js +2 -40
  85. package/src/runtime/preview.css +85 -0
  86. package/src/runtime/preview.js +277 -0
  87. package/src/runtime/previewSource.js +82 -0
  88. package/src/runtime/revisionPrivacy.js +13 -0
  89. package/src/runtime/studio.js +10 -0
  90. package/src/runtime/studioIcons.js +36 -0
  91. package/src/validation-3pggwcnm.js +396 -0
  92. package/src/validation-DpUwPC8Y.js +224 -0
  93. package/studio/THIRD-PARTY-LICENSES.md +2406 -0
  94. package/studio/chunks/AccountPage-DL3DitDM.js +288 -0
  95. package/studio/chunks/AccountPage-DL3DitDM.js.br +0 -0
  96. package/studio/chunks/AccountPage-DL3DitDM.js.gz +0 -0
  97. package/studio/chunks/ActivityPage-CLqVUqTh.js +584 -0
  98. package/studio/chunks/ActivityPage-CLqVUqTh.js.br +0 -0
  99. package/studio/chunks/ActivityPage-CLqVUqTh.js.gz +0 -0
  100. package/studio/chunks/Alert-D0D24z_a.js +335 -0
  101. package/studio/chunks/Alert-D0D24z_a.js.br +0 -0
  102. package/studio/chunks/Alert-D0D24z_a.js.gz +0 -0
  103. package/studio/chunks/Badge-BBFs88TI.js +346 -0
  104. package/studio/chunks/Badge-BBFs88TI.js.br +0 -0
  105. package/studio/chunks/Badge-BBFs88TI.js.gz +0 -0
  106. package/studio/chunks/Button-BT3ztSPx.js +14319 -0
  107. package/studio/chunks/Button-BT3ztSPx.js.br +0 -0
  108. package/studio/chunks/Button-BT3ztSPx.js.gz +0 -0
  109. package/studio/chunks/Collapsible-CKnEYIlp.js +246 -0
  110. package/studio/chunks/Collapsible-CKnEYIlp.js.br +0 -0
  111. package/studio/chunks/Collapsible-CKnEYIlp.js.gz +0 -0
  112. package/studio/chunks/ContentInventory-D7nsFA6U.js +1745 -0
  113. package/studio/chunks/ContentInventory-D7nsFA6U.js.br +0 -0
  114. package/studio/chunks/ContentInventory-D7nsFA6U.js.gz +0 -0
  115. package/studio/chunks/ContentPage-DCxt6BeD.js +18 -0
  116. package/studio/chunks/ContentPage-DCxt6BeD.js.br +0 -0
  117. package/studio/chunks/ContentPage-DCxt6BeD.js.gz +0 -0
  118. package/studio/chunks/DashboardSearch-DjyMjJwF.js +2413 -0
  119. package/studio/chunks/DashboardSearch-DjyMjJwF.js.br +0 -0
  120. package/studio/chunks/DashboardSearch-DjyMjJwF.js.gz +0 -0
  121. package/studio/chunks/DocumentLocaleMenu-0EkkOr6_.js +26063 -0
  122. package/studio/chunks/DocumentLocaleMenu-0EkkOr6_.js.br +0 -0
  123. package/studio/chunks/DocumentLocaleMenu-0EkkOr6_.js.gz +0 -0
  124. package/studio/chunks/DropdownMenu-CA9fB0uZ.js +4400 -0
  125. package/studio/chunks/DropdownMenu-CA9fB0uZ.js.br +0 -0
  126. package/studio/chunks/DropdownMenu-CA9fB0uZ.js.gz +0 -0
  127. package/studio/chunks/EditorPage-D_PAYEE4.js +7799 -0
  128. package/studio/chunks/EditorPage-D_PAYEE4.js.br +0 -0
  129. package/studio/chunks/EditorPage-D_PAYEE4.js.gz +0 -0
  130. package/studio/chunks/FormField-CgM6l2Yn.js +198 -0
  131. package/studio/chunks/FormField-CgM6l2Yn.js.br +0 -0
  132. package/studio/chunks/FormField-CgM6l2Yn.js.gz +0 -0
  133. package/studio/chunks/HelpPage-C-vrFcT_.js +552 -0
  134. package/studio/chunks/HelpPage-C-vrFcT_.js.br +0 -0
  135. package/studio/chunks/HelpPage-C-vrFcT_.js.gz +0 -0
  136. package/studio/chunks/Kbd-Ot7TIhVZ.js +271 -0
  137. package/studio/chunks/Kbd-Ot7TIhVZ.js.br +0 -0
  138. package/studio/chunks/Kbd-Ot7TIhVZ.js.gz +0 -0
  139. package/studio/chunks/MediaFolderDialog-DYu-eu-q.js +101 -0
  140. package/studio/chunks/MediaFolderDialog-DYu-eu-q.js.br +0 -0
  141. package/studio/chunks/MediaFolderDialog-DYu-eu-q.js.gz +0 -0
  142. package/studio/chunks/MediaPage-D-jaWtdl.js +923 -0
  143. package/studio/chunks/MediaPage-D-jaWtdl.js.br +0 -0
  144. package/studio/chunks/MediaPage-D-jaWtdl.js.gz +0 -0
  145. package/studio/chunks/MediaPicker-BZs2wUFz.js +837 -0
  146. package/studio/chunks/MediaPicker-BZs2wUFz.js.br +0 -0
  147. package/studio/chunks/MediaPicker-BZs2wUFz.js.gz +0 -0
  148. package/studio/chunks/MediaUploadPanel-C7Kyg6aR.js +1173 -0
  149. package/studio/chunks/MediaUploadPanel-C7Kyg6aR.js.br +0 -0
  150. package/studio/chunks/MediaUploadPanel-C7Kyg6aR.js.gz +0 -0
  151. package/studio/chunks/Modal-D6hSvxHd.js +265 -0
  152. package/studio/chunks/Modal-D6hSvxHd.js.br +0 -0
  153. package/studio/chunks/Modal-D6hSvxHd.js.gz +0 -0
  154. package/studio/chunks/NewDocumentDialog-C8B6_r3J.js +277 -0
  155. package/studio/chunks/NewDocumentDialog-C8B6_r3J.js.br +0 -0
  156. package/studio/chunks/NewDocumentDialog-C8B6_r3J.js.gz +0 -0
  157. package/studio/chunks/Pagination-D9BSo5H2.js +573 -0
  158. package/studio/chunks/Pagination-D9BSo5H2.js.br +0 -0
  159. package/studio/chunks/Pagination-D9BSo5H2.js.gz +0 -0
  160. package/studio/chunks/PeoplePage-CWIXitBD.js +783 -0
  161. package/studio/chunks/PeoplePage-CWIXitBD.js.br +0 -0
  162. package/studio/chunks/PeoplePage-CWIXitBD.js.gz +0 -0
  163. package/studio/chunks/Popover-B63bkTMS.js +128 -0
  164. package/studio/chunks/Popover-B63bkTMS.js.br +0 -0
  165. package/studio/chunks/Popover-B63bkTMS.js.gz +0 -0
  166. package/studio/chunks/PublicationActionDialog-Cm_P0C3I.js +255 -0
  167. package/studio/chunks/PublicationActionDialog-Cm_P0C3I.js.br +0 -0
  168. package/studio/chunks/PublicationActionDialog-Cm_P0C3I.js.gz +0 -0
  169. package/studio/chunks/Routes-DLYHmulE.js +102 -0
  170. package/studio/chunks/Routes-DLYHmulE.js.br +0 -0
  171. package/studio/chunks/Routes-DLYHmulE.js.gz +0 -0
  172. package/studio/chunks/RovingFocusItem-QZNg-wWF.js +95 -0
  173. package/studio/chunks/RovingFocusItem-QZNg-wWF.js.br +0 -0
  174. package/studio/chunks/RovingFocusItem-QZNg-wWF.js.gz +0 -0
  175. package/studio/chunks/ScheduledPage-C0hqrkr5.js +332 -0
  176. package/studio/chunks/ScheduledPage-C0hqrkr5.js.br +0 -0
  177. package/studio/chunks/ScheduledPage-C0hqrkr5.js.gz +0 -0
  178. package/studio/chunks/Search-BEgCe9Aj.js +14646 -0
  179. package/studio/chunks/Search-BEgCe9Aj.js.br +0 -0
  180. package/studio/chunks/Search-BEgCe9Aj.js.gz +0 -0
  181. package/studio/chunks/Select-B50WZMW-.js +2145 -0
  182. package/studio/chunks/Select-B50WZMW-.js.br +0 -0
  183. package/studio/chunks/Select-B50WZMW-.js.gz +0 -0
  184. package/studio/chunks/SelectMenu-DSweWGMz.js +2109 -0
  185. package/studio/chunks/SelectMenu-DSweWGMz.js.br +0 -0
  186. package/studio/chunks/SelectMenu-DSweWGMz.js.gz +0 -0
  187. package/studio/chunks/SeoPage-CNNxGe4h.js +846 -0
  188. package/studio/chunks/SeoPage-CNNxGe4h.js.br +0 -0
  189. package/studio/chunks/SeoPage-CNNxGe4h.js.gz +0 -0
  190. package/studio/chunks/Skeleton-COz8dcrw.js +39 -0
  191. package/studio/chunks/Skeleton-COz8dcrw.js.br +2 -0
  192. package/studio/chunks/Skeleton-COz8dcrw.js.gz +0 -0
  193. package/studio/chunks/Slideover-QMMHAAys.js +289 -0
  194. package/studio/chunks/Slideover-QMMHAAys.js.br +0 -0
  195. package/studio/chunks/Slideover-QMMHAAys.js.gz +0 -0
  196. package/studio/chunks/StudioPage-ngEIDr5d.js +80 -0
  197. package/studio/chunks/StudioPage-ngEIDr5d.js.br +0 -0
  198. package/studio/chunks/StudioPage-ngEIDr5d.js.gz +0 -0
  199. package/studio/chunks/StudioPageToolbar-BwHnqyr6.js +2524 -0
  200. package/studio/chunks/StudioPageToolbar-BwHnqyr6.js.br +0 -0
  201. package/studio/chunks/StudioPageToolbar-BwHnqyr6.js.gz +0 -0
  202. package/studio/chunks/Switch-qKl1aDn7.js +484 -0
  203. package/studio/chunks/Switch-qKl1aDn7.js.br +0 -0
  204. package/studio/chunks/Switch-qKl1aDn7.js.gz +0 -0
  205. package/studio/chunks/ToolPage-DxoVAJVk.js +29 -0
  206. package/studio/chunks/ToolPage-DxoVAJVk.js.br +0 -0
  207. package/studio/chunks/ToolPage-DxoVAJVk.js.gz +0 -0
  208. package/studio/chunks/Tooltip-Bu15m_DB.js +693 -0
  209. package/studio/chunks/Tooltip-Bu15m_DB.js.br +0 -0
  210. package/studio/chunks/Tooltip-Bu15m_DB.js.gz +0 -0
  211. package/studio/chunks/TrashPage-lhqLLdoG.js +12 -0
  212. package/studio/chunks/TrashPage-lhqLLdoG.js.br +0 -0
  213. package/studio/chunks/TrashPage-lhqLLdoG.js.gz +0 -0
  214. package/studio/chunks/VersionsPage-Cqy6UAp9.js +2349 -0
  215. package/studio/chunks/VersionsPage-Cqy6UAp9.js.br +0 -0
  216. package/studio/chunks/VersionsPage-Cqy6UAp9.js.gz +0 -0
  217. package/studio/chunks/VisuallyHiddenInput-Cu8hQLRf.js +113 -0
  218. package/studio/chunks/VisuallyHiddenInput-Cu8hQLRf.js.br +0 -0
  219. package/studio/chunks/VisuallyHiddenInput-Cu8hQLRf.js.gz +0 -0
  220. package/studio/chunks/arrays-CUJkmV4I.js +10 -0
  221. package/studio/chunks/arrays-CUJkmV4I.js.br +0 -0
  222. package/studio/chunks/arrays-CUJkmV4I.js.gz +0 -0
  223. package/studio/chunks/base-DkTekJe8.js +213 -0
  224. package/studio/chunks/base-DkTekJe8.js.br +0 -0
  225. package/studio/chunks/base-DkTekJe8.js.gz +0 -0
  226. package/studio/chunks/content-DUGl3N4d.js +6012 -0
  227. package/studio/chunks/content-DUGl3N4d.js.br +0 -0
  228. package/studio/chunks/content-DUGl3N4d.js.gz +0 -0
  229. package/studio/chunks/destinations-DPIQVQa6.js +227 -0
  230. package/studio/chunks/destinations-DPIQVQa6.js.br +0 -0
  231. package/studio/chunks/destinations-DPIQVQa6.js.gz +0 -0
  232. package/studio/chunks/en-073cjKW4.js +152 -0
  233. package/studio/chunks/en-073cjKW4.js.br +0 -0
  234. package/studio/chunks/en-073cjKW4.js.gz +0 -0
  235. package/studio/chunks/en-Bn8mxPuf.js +134 -0
  236. package/studio/chunks/en-Bn8mxPuf.js.br +0 -0
  237. package/studio/chunks/en-Bn8mxPuf.js.gz +0 -0
  238. package/studio/chunks/en-C9OiaUDZ.js +251 -0
  239. package/studio/chunks/en-C9OiaUDZ.js.br +0 -0
  240. package/studio/chunks/en-C9OiaUDZ.js.gz +0 -0
  241. package/studio/chunks/en-CHAR6jzx.js +147 -0
  242. package/studio/chunks/en-CHAR6jzx.js.br +0 -0
  243. package/studio/chunks/en-CHAR6jzx.js.gz +0 -0
  244. package/studio/chunks/en-Cq4N1vEF.js +93 -0
  245. package/studio/chunks/en-Cq4N1vEF.js.br +2 -0
  246. package/studio/chunks/en-Cq4N1vEF.js.gz +0 -0
  247. package/studio/chunks/en-D2hRqlse.js +140 -0
  248. package/studio/chunks/en-D2hRqlse.js.br +0 -0
  249. package/studio/chunks/en-D2hRqlse.js.gz +0 -0
  250. package/studio/chunks/en-DiUC3-j6.js +144 -0
  251. package/studio/chunks/en-DiUC3-j6.js.br +0 -0
  252. package/studio/chunks/en-DiUC3-j6.js.gz +0 -0
  253. package/studio/chunks/english-Cs_Adu-u.js +8 -0
  254. package/studio/chunks/english-Cs_Adu-u.js.br +0 -0
  255. package/studio/chunks/english-Cs_Adu-u.js.gz +0 -0
  256. package/studio/chunks/esm-D6DqSiL1.js +752 -0
  257. package/studio/chunks/esm-D6DqSiL1.js.br +0 -0
  258. package/studio/chunks/esm-D6DqSiL1.js.gz +0 -0
  259. package/studio/chunks/externalRequest-CTzr2nDq.js +23 -0
  260. package/studio/chunks/externalRequest-CTzr2nDq.js.br +0 -0
  261. package/studio/chunks/externalRequest-CTzr2nDq.js.gz +0 -0
  262. package/studio/chunks/iconify-DR9ryCPv.js +1007 -0
  263. package/studio/chunks/iconify-DR9ryCPv.js.br +0 -0
  264. package/studio/chunks/iconify-DR9ryCPv.js.gz +0 -0
  265. package/studio/chunks/icons-D2MsAaXq.js +183 -0
  266. package/studio/chunks/icons-D2MsAaXq.js.br +0 -0
  267. package/studio/chunks/icons-D2MsAaXq.js.gz +0 -0
  268. package/studio/chunks/leaveGuards-D22fTGgr.js +26 -0
  269. package/studio/chunks/leaveGuards-D22fTGgr.js.br +0 -0
  270. package/studio/chunks/leaveGuards-D22fTGgr.js.gz +0 -0
  271. package/studio/chunks/lucideIcons-EyqyPBsX.js +238 -0
  272. package/studio/chunks/lucideIcons-EyqyPBsX.js.br +0 -0
  273. package/studio/chunks/lucideIcons-EyqyPBsX.js.gz +0 -0
  274. package/studio/chunks/mediaRoute--8cY8rUe.js +17 -0
  275. package/studio/chunks/mediaRoute--8cY8rUe.js.br +0 -0
  276. package/studio/chunks/mediaRoute--8cY8rUe.js.gz +0 -0
  277. package/studio/chunks/newDocumentPlanning-C26DHpvh.js +77 -0
  278. package/studio/chunks/newDocumentPlanning-C26DHpvh.js.br +0 -0
  279. package/studio/chunks/newDocumentPlanning-C26DHpvh.js.gz +0 -0
  280. package/studio/chunks/notifications-OKOLc40v.js +110 -0
  281. package/studio/chunks/notifications-OKOLc40v.js.br +0 -0
  282. package/studio/chunks/notifications-OKOLc40v.js.gz +0 -0
  283. package/studio/chunks/operations-CjNHyrEX.js +57 -0
  284. package/studio/chunks/operations-CjNHyrEX.js.br +0 -0
  285. package/studio/chunks/operations-CjNHyrEX.js.gz +0 -0
  286. package/studio/chunks/overlay-DnqFLZTc.js +1733 -0
  287. package/studio/chunks/overlay-DnqFLZTc.js.br +0 -0
  288. package/studio/chunks/overlay-DnqFLZTc.js.gz +0 -0
  289. package/studio/chunks/presentation-DF83w0hE.js +57 -0
  290. package/studio/chunks/presentation-DF83w0hE.js.br +0 -0
  291. package/studio/chunks/presentation-DF83w0hE.js.gz +0 -0
  292. package/studio/chunks/runtime-core.esm-bundler-DKFA9Rep.js +4557 -0
  293. package/studio/chunks/runtime-core.esm-bundler-DKFA9Rep.js.br +0 -0
  294. package/studio/chunks/runtime-core.esm-bundler-DKFA9Rep.js.gz +0 -0
  295. package/studio/chunks/searchPresentation-DFwxQkt3.js +76 -0
  296. package/studio/chunks/searchPresentation-DFwxQkt3.js.br +0 -0
  297. package/studio/chunks/searchPresentation-DFwxQkt3.js.gz +0 -0
  298. package/studio/chunks/status-DQv6ihkU.js +38 -0
  299. package/studio/chunks/status-DQv6ihkU.js.br +0 -0
  300. package/studio/chunks/status-DQv6ihkU.js.gz +0 -0
  301. package/studio/chunks/studioContext-I8HozGU1.js +4953 -0
  302. package/studio/chunks/studioContext-I8HozGU1.js.br +0 -0
  303. package/studio/chunks/studioContext-I8HozGU1.js.gz +0 -0
  304. package/studio/chunks/studioQueries-BR-9NT5F.js +73 -0
  305. package/studio/chunks/studioQueries-BR-9NT5F.js.br +0 -0
  306. package/studio/chunks/studioQueries-BR-9NT5F.js.gz +0 -0
  307. package/studio/chunks/studioSearch-ByaL-QpM.js +1095 -0
  308. package/studio/chunks/studioSearch-ByaL-QpM.js.br +0 -0
  309. package/studio/chunks/studioSearch-ByaL-QpM.js.gz +0 -0
  310. package/studio/chunks/useAcknowledgedDraft-0_c9sWI6.js +62 -0
  311. package/studio/chunks/useAcknowledgedDraft-0_c9sWI6.js.br +0 -0
  312. package/studio/chunks/useAcknowledgedDraft-0_c9sWI6.js.gz +0 -0
  313. package/studio/chunks/useApi-CUWMwLLw-B3Q3g2nf.js +189 -0
  314. package/studio/chunks/useApi-CUWMwLLw-B3Q3g2nf.js.br +0 -0
  315. package/studio/chunks/useApi-CUWMwLLw-B3Q3g2nf.js.gz +0 -0
  316. package/studio/chunks/useDocumentMessage-BAWvc38w.js +16 -0
  317. package/studio/chunks/useDocumentMessage-BAWvc38w.js.br +3 -0
  318. package/studio/chunks/useDocumentMessage-BAWvc38w.js.gz +0 -0
  319. package/studio/chunks/useFilter-DzyiTR7f.js +87 -0
  320. package/studio/chunks/useFilter-DzyiTR7f.js.br +0 -0
  321. package/studio/chunks/useFilter-DzyiTR7f.js.gz +0 -0
  322. package/studio/chunks/useFormControl-CL7sSCUo.js +8 -0
  323. package/studio/chunks/useFormControl-CL7sSCUo.js.br +0 -0
  324. package/studio/chunks/useFormControl-CL7sSCUo.js.gz +0 -0
  325. package/studio/chunks/useGraceArea-Chcy25IQ.js +154 -0
  326. package/studio/chunks/useGraceArea-Chcy25IQ.js.br +0 -0
  327. package/studio/chunks/useGraceArea-Chcy25IQ.js.gz +0 -0
  328. package/studio/chunks/useLeaveConfirmation-_iCSnKEp.js +44 -0
  329. package/studio/chunks/useLeaveConfirmation-_iCSnKEp.js.br +8 -0
  330. package/studio/chunks/useLeaveConfirmation-_iCSnKEp.js.gz +0 -0
  331. package/studio/chunks/useLinkCopy-CMjQteCy.js +35 -0
  332. package/studio/chunks/useLinkCopy-CMjQteCy.js.br +0 -0
  333. package/studio/chunks/useLinkCopy-CMjQteCy.js.gz +0 -0
  334. package/studio/chunks/usePointerMotion-DwRcwBNQ.js +16 -0
  335. package/studio/chunks/usePointerMotion-DwRcwBNQ.js.br +0 -0
  336. package/studio/chunks/usePointerMotion-DwRcwBNQ.js.gz +0 -0
  337. package/studio/chunks/useStudioNavigation-CLwtSYpb.js +298 -0
  338. package/studio/chunks/useStudioNavigation-CLwtSYpb.js.br +0 -0
  339. package/studio/chunks/useStudioNavigation-CLwtSYpb.js.gz +0 -0
  340. package/studio/chunks/useStudioPages-DR9qmYLg.js +79 -0
  341. package/studio/chunks/useStudioPages-DR9qmYLg.js.br +0 -0
  342. package/studio/chunks/useStudioPages-DR9qmYLg.js.gz +0 -0
  343. package/studio/chunks/utils-mdScC0v0.js +59 -0
  344. package/studio/chunks/utils-mdScC0v0.js.br +0 -0
  345. package/studio/chunks/utils-mdScC0v0.js.gz +0 -0
  346. package/studio/chunks/virtualizer-D1S0bZ4t.js +781 -0
  347. package/studio/chunks/virtualizer-D1S0bZ4t.js.br +0 -0
  348. package/studio/chunks/virtualizer-D1S0bZ4t.js.gz +0 -0
  349. package/studio/help/64f767fe29c2-save-and-publish.svg +7 -0
  350. package/studio/host.css +1 -1
  351. package/studio/host.css.br +0 -0
  352. package/studio/host.css.gz +0 -0
  353. package/studio/host.js +8793 -39395
  354. package/studio/host.js.br +0 -0
  355. package/studio/host.js.gz +0 -0
  356. package/CHANGELOG.md +0 -14
  357. package/bin/cms.mjs +0 -2
  358. package/src/ApplicationTypes.d.ts +0 -84
  359. package/src/ApplicationTypes.js +0 -1
  360. package/src/Configuration-CMweD9bn.js +0 -1191
  361. package/src/Configuration-CMweD9bn.js.map +0 -1
  362. package/src/Configuration.d.ts +0 -82
  363. package/src/Configuration.js +0 -8
  364. package/src/Configuration.js.map +0 -1
  365. package/src/Content.d.ts +0 -68
  366. package/src/Content.js +0 -373
  367. package/src/Content.js.map +0 -1
  368. package/src/ContentTransfer-BxwswWn3.js +0 -86
  369. package/src/ContentTransfer-BxwswWn3.js.map +0 -1
  370. package/src/ContentTransfer-Z9FHyLez.d.ts +0 -72
  371. package/src/DocumentEngine-tYtwbBjr.js +0 -978
  372. package/src/DocumentEngine-tYtwbBjr.js.map +0 -1
  373. package/src/DocumentModel.d.ts +0 -52
  374. package/src/DocumentModel.js +0 -66
  375. package/src/DocumentModel.js.map +0 -1
  376. package/src/Forms-CX-hwmJF.js +0 -391
  377. package/src/Forms-CX-hwmJF.js.map +0 -1
  378. package/src/Forms-CfNPTiCr.js +0 -110
  379. package/src/Forms-CfNPTiCr.js.map +0 -1
  380. package/src/Forms-R0HoTR-o.d.ts +0 -92
  381. package/src/Forms.js.map +0 -1
  382. package/src/HttpPaths-Be3vshPJ.js +0 -20
  383. package/src/HttpPaths-Be3vshPJ.js.map +0 -1
  384. package/src/I18n-wxswIRyY.d.ts +0 -30
  385. package/src/Media-j1bTritO.js +0 -112
  386. package/src/Media-j1bTritO.js.map +0 -1
  387. package/src/Module.js.map +0 -1
  388. package/src/References-CCPDAPve.js +0 -45
  389. package/src/References-CCPDAPve.js.map +0 -1
  390. package/src/S3MediaObjects-BXfjaZOu.js +0 -2756
  391. package/src/S3MediaObjects-BXfjaZOu.js.map +0 -1
  392. package/src/Seo-402YumpT.d.ts +0 -198
  393. package/src/cli/content.js +0 -101
  394. package/src/cli/content.js.map +0 -1
  395. package/src/cli.js.map +0 -1
  396. package/src/connection-BP80q4d-.js +0 -92
  397. package/src/connection-BP80q4d-.js.map +0 -1
  398. package/src/dev-lifecycle-3I_pozUl.js +0 -535
  399. package/src/dev-lifecycle-3I_pozUl.js.map +0 -1
  400. package/src/installation-DxqSSVbH.js +0 -9105
  401. package/src/installation-DxqSSVbH.js.map +0 -1
  402. package/src/internal/application-types.js +0 -43
  403. package/src/internal/application-types.js.map +0 -1
  404. package/src/internal/authoring-catalog.js +0 -158
  405. package/src/internal/authoring-catalog.js.map +0 -1
  406. package/src/internal/authoring-compiler.js +0 -146
  407. package/src/internal/authoring-compiler.js.map +0 -1
  408. package/src/internal/authoring-metadata.js +0 -191
  409. package/src/internal/authoring-metadata.js.map +0 -1
  410. package/src/internal/cms-config.js +0 -45
  411. package/src/internal/cms-config.js.map +0 -1
  412. package/src/internal/configuration.js +0 -228
  413. package/src/internal/configuration.js.map +0 -1
  414. package/src/internal/dev-lifecycle.js +0 -3
  415. package/src/internal/diagnostics.js +0 -47
  416. package/src/internal/diagnostics.js.map +0 -1
  417. package/src/internal/document-model.js +0 -376
  418. package/src/internal/document-model.js.map +0 -1
  419. package/src/internal/field-metadata.js +0 -7
  420. package/src/internal/field-metadata.js.map +0 -1
  421. package/src/internal/form-capabilities.js +0 -12
  422. package/src/internal/form-capabilities.js.map +0 -1
  423. package/src/internal/i18n.js +0 -73
  424. package/src/internal/i18n.js.map +0 -1
  425. package/src/internal/studio-app.js +0 -68
  426. package/src/internal/studio-app.js.map +0 -1
  427. package/src/location-CMNGO3lU.js +0 -35
  428. package/src/location-CMNGO3lU.js.map +0 -1
  429. package/src/metadata-DN9_K6Yl.js +0 -201
  430. package/src/metadata-DN9_K6Yl.js.map +0 -1
  431. package/src/models-5j67LMqW.js +0 -131
  432. package/src/models-5j67LMqW.js.map +0 -1
  433. package/src/models-VmGmG19-.js +0 -628
  434. package/src/models-VmGmG19-.js.map +0 -1
  435. package/src/runtime/api.js.map +0 -1
  436. package/src/runtime/blocks.js +0 -30
  437. package/src/runtime/blocks.js.map +0 -1
  438. package/src/runtime/collaboration.js +0 -45
  439. package/src/runtime/collaboration.js.map +0 -1
  440. package/src/runtime/delivery/DocumentField.js +0 -23
  441. package/src/runtime/delivery/DocumentField.js.map +0 -1
  442. package/src/runtime/delivery/DocumentRenderer.js +0 -61
  443. package/src/runtime/delivery/DocumentRenderer.js.map +0 -1
  444. package/src/runtime/delivery/DocumentScope.js +0 -41
  445. package/src/runtime/delivery/DocumentScope.js.map +0 -1
  446. package/src/runtime/delivery/blocks.js +0 -8
  447. package/src/runtime/delivery/blocks.js.map +0 -1
  448. package/src/runtime/delivery/context.js +0 -12
  449. package/src/runtime/delivery/context.js.map +0 -1
  450. package/src/runtime/delivery/document-page.js +0 -21
  451. package/src/runtime/delivery/document-page.js.map +0 -1
  452. package/src/runtime/delivery/document.js +0 -43
  453. package/src/runtime/delivery/document.js.map +0 -1
  454. package/src/runtime/delivery/error.js +0 -11
  455. package/src/runtime/delivery/error.js.map +0 -1
  456. package/src/runtime/delivery/plugin.js +0 -104
  457. package/src/runtime/delivery/plugin.js.map +0 -1
  458. package/src/runtime/delivery/preview.d.ts +0 -11
  459. package/src/runtime/delivery/preview.js +0 -6
  460. package/src/runtime/delivery/preview.js.map +0 -1
  461. package/src/runtime/delivery/types.d.ts +0 -2
  462. package/src/runtime/delivery/types.js +0 -1
  463. package/src/runtime/delivery/useCmsDocumentSeo.d.ts +0 -67
  464. package/src/runtime/delivery/useCmsDocumentSeo.js.map +0 -1
  465. package/src/runtime/delivery/useDocument.d.ts +0 -6
  466. package/src/runtime/delivery/useDocument.js +0 -23
  467. package/src/runtime/delivery/useDocument.js.map +0 -1
  468. package/src/runtime/delivery/useDocumentQuery.d.ts +0 -7
  469. package/src/runtime/delivery/useDocumentQuery.js +0 -29
  470. package/src/runtime/delivery/useDocumentQuery.js.map +0 -1
  471. package/src/runtime/forms/document.js +0 -38
  472. package/src/runtime/forms/document.js.map +0 -1
  473. package/src/runtime/forms/useCmsForm.js +0 -257
  474. package/src/runtime/forms/useCmsForm.js.map +0 -1
  475. package/src/runtime/i18n/translator.js +0 -58
  476. package/src/runtime/i18n/translator.js.map +0 -1
  477. package/src/runtime/i18n/useCmsI18n.d.ts +0 -13
  478. package/src/runtime/i18n/useCmsI18n.js +0 -38
  479. package/src/runtime/i18n/useCmsI18n.js.map +0 -1
  480. package/src/runtime/installation.js +0 -3
  481. package/src/runtime/plugin.js.map +0 -1
  482. package/src/runtime/preview/CmsStudioPreviewMarker.js +0 -29
  483. package/src/runtime/preview/CmsStudioPreviewMarker.js.map +0 -1
  484. package/src/runtime/preview/comark-document.js +0 -37
  485. package/src/runtime/preview/comark-document.js.map +0 -1
  486. package/src/runtime/preview/connection.js +0 -3
  487. package/src/runtime/preview/controller.js +0 -265
  488. package/src/runtime/preview/controller.js.map +0 -1
  489. package/src/runtime/preview/crypto.js +0 -16
  490. package/src/runtime/preview/crypto.js.map +0 -1
  491. package/src/runtime/preview/overlay.js +0 -122
  492. package/src/runtime/preview/overlay.js.map +0 -1
  493. package/src/runtime/preview/plugin.client.js +0 -68
  494. package/src/runtime/preview/plugin.client.js.map +0 -1
  495. package/src/runtime/preview/preview.css +0 -91
  496. package/src/runtime/preview/protocol.d.ts +0 -16
  497. package/src/runtime/preview/protocol.js +0 -23
  498. package/src/runtime/preview/protocol.js.map +0 -1
  499. package/src/runtime/preview/regions.js +0 -142
  500. package/src/runtime/preview/regions.js.map +0 -1
  501. package/src/runtime/preview/store.js +0 -4
  502. package/src/runtime/sitemap-entries.js +0 -17
  503. package/src/runtime/sitemap-entries.js.map +0 -1
  504. package/src/runtime/sitemap.js +0 -23
  505. package/src/runtime/sitemap.js.map +0 -1
  506. package/src/runtime/studio-app.js +0 -17
  507. package/src/runtime/studio-app.js.map +0 -1
  508. package/src/runtime/studio-document.js +0 -46
  509. package/src/runtime/studio-document.js.map +0 -1
  510. package/src/runtime/studio-entry.js +0 -19
  511. package/src/runtime/studio-entry.js.map +0 -1
  512. package/src/runtime/studio-navigation.js +0 -11
  513. package/src/runtime/studio-navigation.js.map +0 -1
  514. package/src/scalars-CA6kyipS.d.ts +0 -7
  515. package/src/scalars-CVZqT3L0.js +0 -22
  516. package/src/scalars-CVZqT3L0.js.map +0 -1
  517. package/src/store-X1e1o_MF.js +0 -209
  518. package/src/store-X1e1o_MF.js.map +0 -1
  519. package/src/types-DZ0IV-Ow.d.ts +0 -101
  520. package/studio/CreateDocumentDialog-C4_JBo1w.js +0 -335
  521. package/studio/SelectMenu-wXqxymUw.js +0 -34045
  522. package/studio/collaboration-DcK2F6v9.js +0 -4566
  523. package/studio/editor-P2rB7Csp.js +0 -30128
  524. package/studio/rolldown-runtime-Dy4uBu1J.js +0 -11
@@ -1,1191 +0,0 @@
1
- import { S as MarkdownNode, at as Locale, it as CollectionName, n as CmsMarkdownDocument, ot as RoutePattern } from "./models-VmGmG19-.js";
2
- import { i as decodeManagedMediaReference, r as decodeAuthoredDocumentReference } from "./References-CCPDAPve.js";
3
- import { r as FormCapabilities } from "./Forms-CfNPTiCr.js";
4
- import { c as resolveCmsComarkAttributes, d as createCmsComarkRenderData, l as withCmsComarkProps, r as formStructureIssues, s as projectCmsEditorComponentAttributes } from "./Forms-CX-hwmJF.js";
5
- import { a as createEditorNodeId, n as editorMetadata, o as editorNodeId } from "./metadata-DN9_K6Yl.js";
6
- import { Effect, Option, Predicate, Schema } from "effect";
7
- import { Extension } from "@tiptap/core";
8
- import { ySyncPluginKey } from "@tiptap/y-tiptap";
9
- import { createMarkdownParser } from "comark/parse";
10
- import alert from "comark/plugins/alert";
11
- import attributes from "comark/plugins/attributes";
12
- import components from "comark/plugins/components";
13
- import frontmatter from "comark/plugins/frontmatter";
14
- import headings from "comark/plugins/headings";
15
- import security from "comark/plugins/security";
16
- import taskList from "comark/plugins/task-list";
17
- import toc from "comark/plugins/toc";
18
-
19
- //#region ../document/src/internal/editor/attributes.ts
20
- function compactJsonAttributes(attributes) {
21
- return Object.fromEntries(Object.entries(attributes).filter((entry) => entry[1] !== void 0));
22
- }
23
- function nonEmptyStringAttribute(value) {
24
- return Predicate.isString(value) && value ? value : void 0;
25
- }
26
- function finiteNumberAttribute(value, fallback) {
27
- const number = Predicate.isNumber(value) ? value : Number(value);
28
- return Number.isFinite(number) ? number : fallback;
29
- }
30
-
31
- //#endregion
32
- //#region ../document/src/internal/editor/image.ts
33
- const isJsonObject$3 = Schema.is(Schema.JsonObject);
34
- const EditorImageLayout = Schema.Literals([
35
- "natural",
36
- "content",
37
- "full"
38
- ]);
39
- const isEditorImageLayout = Schema.is(EditorImageLayout);
40
- const EDITOR_IMAGE_LAYOUT_ATTRIBUTE = "data-cms-layout";
41
- const IMAGE_DECORATIVE_ATTRIBUTE = "data-cms-decorative";
42
- const IMAGE_SEMANTIC_ATTRIBUTES = /* @__PURE__ */ new Set([
43
- "alt",
44
- IMAGE_DECORATIVE_ATTRIBUTE,
45
- EDITOR_IMAGE_LAYOUT_ATTRIBUTE,
46
- "src",
47
- "title"
48
- ]);
49
- function decodeEditorImageAttributes(attributes) {
50
- const cmsProps = Object.fromEntries(Object.entries(attributes).filter(([name]) => !IMAGE_SEMANTIC_ATTRIBUTES.has(name)));
51
- return compactJsonAttributes({
52
- alt: attributes[IMAGE_DECORATIVE_ATTRIBUTE] !== void 0 ? "" : Predicate.isString(attributes.alt) ? attributes.alt : null,
53
- cmsProps: Object.keys(cmsProps).length ? cmsProps : null,
54
- layout: normalizeEditorImageLayout(attributes[EDITOR_IMAGE_LAYOUT_ATTRIBUTE]),
55
- src: stringValue(attributes.src) || null,
56
- title: stringValue(attributes.title) || null
57
- });
58
- }
59
- function encodeEditorImageAttributes(value) {
60
- const attributes = jsonObject$1(value);
61
- const alt = attributes.alt;
62
- const layout = normalizeEditorImageLayout(attributes.layout);
63
- return compactJsonAttributes(Object.assign({}, jsonObject$1(attributes.cmsProps), {
64
- alt: Predicate.isString(alt) ? alt : void 0,
65
- [IMAGE_DECORATIVE_ATTRIBUTE]: alt === "" ? "true" : void 0,
66
- [EDITOR_IMAGE_LAYOUT_ATTRIBUTE]: layout === "natural" ? void 0 : layout,
67
- src: stringValue(attributes.src) || void 0,
68
- title: stringValue(attributes.title) || void 0
69
- }));
70
- }
71
- function normalizeEditorImageLayout(value) {
72
- return isEditorImageLayout(value) ? value : "natural";
73
- }
74
- function jsonObject$1(value) {
75
- return isJsonObject$3(value) ? value : {};
76
- }
77
- function stringValue(value) {
78
- return Predicate.isString(value) || Predicate.isNumber(value) ? String(value) : "";
79
- }
80
-
81
- //#endregion
82
- //#region ../document/src/internal/editor/marks.ts
83
- const EDITOR_MARKS = [
84
- ["bold", "strong"],
85
- ["code", "code"],
86
- ["italic", "em"],
87
- ["link", "a"],
88
- ["strike", "del"],
89
- ["underline", "u"]
90
- ];
91
- const EDITOR_MARK_TYPES = EDITOR_MARKS.map(([type]) => type);
92
- const editorToComark = new Map(EDITOR_MARKS);
93
- const comarkToEditor$1 = new Map(EDITOR_MARKS.map(([type, tag]) => [tag, type]));
94
- function comarkTagForEditorMark(type) {
95
- return editorToComark.get(type);
96
- }
97
- function editorMarkForComarkTag(tag) {
98
- return comarkToEditor$1.get(tag);
99
- }
100
- function isEditorMark(type) {
101
- return editorToComark.has(type);
102
- }
103
- function isComarkMark(tag) {
104
- return comarkToEditor$1.has(tag);
105
- }
106
-
107
- //#endregion
108
- //#region ../document/src/internal/comark/to-editor.ts
109
- const isJsonObject$2 = Schema.is(Schema.JsonObject);
110
- const OPAQUE_BLOCK_TAGS = /* @__PURE__ */ new Set([
111
- "math",
112
- "table",
113
- "tbody",
114
- "td",
115
- "th",
116
- "thead",
117
- "tr"
118
- ]);
119
- function comarkToEditor(nodes, renderData = {
120
- data: {},
121
- frontmatter: {},
122
- meta: {},
123
- props: {}
124
- }) {
125
- return decodeBlocks(nodes, { usedIds: /* @__PURE__ */ new Set() }, renderData);
126
- }
127
- function decodeBlocks(nodes, context, renderData, wrapInlineContent = false) {
128
- const content = [];
129
- let inlineNodes = [];
130
- const flushInlineNodes = () => {
131
- const inline = decodeInlines(inlineNodes, context, renderData);
132
- if (inline.length) content.push({
133
- type: "paragraph",
134
- attrs: wrapInlineContent ? { cmsSynthetic: true } : { cmsNodeId: claimIdentity(context) },
135
- content: inline
136
- });
137
- inlineNodes = [];
138
- };
139
- for (const node of nodes) {
140
- if (Predicate.isString(node) || isInlineElement(node)) {
141
- inlineNodes.push(node);
142
- continue;
143
- }
144
- flushInlineNodes();
145
- content.push(decodeBlock(node, context, renderData));
146
- }
147
- flushInlineNodes();
148
- return content;
149
- }
150
- function decodeBlock(node, context, renderData) {
151
- if (node[0] === null) return opaqueBlock(node, "Comment", claimIdentity(context, node[1]));
152
- const [tag, rawAttributes, ...children] = node;
153
- const attrs = cleanAttrs(rawAttributes);
154
- const childRenderData = withCmsComarkProps(renderData, resolveCmsComarkAttributes(rawAttributes, renderData));
155
- const metadata = editorMetadata(rawAttributes);
156
- const cmsNodeId = claimIdentity(context, rawAttributes);
157
- const commonAttrs = compactJsonAttributes({
158
- cmsNodeId,
159
- cmsProps: attrs
160
- });
161
- if (/^h[1-6]$/u.test(tag)) return {
162
- type: "heading",
163
- attrs: mergeJsonAttributes(commonAttrs, { level: Number(tag.slice(1)) }),
164
- content: decodeInlines(children, context, childRenderData)
165
- };
166
- switch (tag) {
167
- case "p": return {
168
- type: "paragraph",
169
- attrs: commonAttrs,
170
- content: decodeInlines(children, context, childRenderData)
171
- };
172
- case "blockquote": return {
173
- type: "blockquote",
174
- attrs: commonAttrs,
175
- content: decodeBlocks(children, context, childRenderData)
176
- };
177
- case "ul": return {
178
- type: "bulletList",
179
- attrs: commonAttrs,
180
- content: decodeListItems(children, context, childRenderData)
181
- };
182
- case "ol": return {
183
- type: "orderedList",
184
- attrs: mergeJsonAttributes(commonAttrs, { start: finiteNumberAttribute(attrs.start, 1) }),
185
- content: decodeListItems(children, context, childRenderData)
186
- };
187
- case "li": return {
188
- type: "listItem",
189
- attrs: commonAttrs,
190
- content: decodeBlocks(children, context, childRenderData)
191
- };
192
- case "pre": {
193
- const code = children.find(isElementNode$1);
194
- return {
195
- type: "codeBlock",
196
- attrs: mergeJsonAttributes(commonAttrs, { language: nonEmptyStringAttribute(attrs.language) ?? nonEmptyStringAttribute(code?.[1].class)?.replace(/^language-/u, "") }),
197
- content: textContent(code ? elementChildren(code) : children)
198
- };
199
- }
200
- case "hr": return {
201
- type: "horizontalRule",
202
- attrs: commonAttrs
203
- };
204
- default:
205
- if (OPAQUE_BLOCK_TAGS.has(tag)) return opaqueBlock(node, tag, cmsNodeId);
206
- const projection = projectCmsEditorComponentAttributes(rawAttributes, renderData);
207
- return {
208
- type: "cmsBlock",
209
- attrs: compactJsonAttributes({
210
- bindings: projection.bindings,
211
- cmsNodeId,
212
- props: projection.props,
213
- tag
214
- }),
215
- content: decodeComponentSlots(children, context, projection.renderData, metadata?.implicitSlotId)
216
- };
217
- }
218
- }
219
- function decodeComponentSlots(children, context, renderData, implicitSlotId) {
220
- const templates = children.filter(isSlotTemplate);
221
- const regular = children.filter((node) => !isSlotTemplate(node));
222
- const slots = templates.map((node) => decodeSlot(node, context, renderData));
223
- if (!regular.length) return slots;
224
- const defaultContent = slotContent(decodeBlocks(regular, context, renderData, true));
225
- const explicitDefault = slots.find((slot) => slot.attrs?.name === "default");
226
- if (explicitDefault) {
227
- explicitDefault.content = [...explicitDefault.content ?? [], ...defaultContent];
228
- return slots;
229
- }
230
- return [{
231
- type: "cmsSlot",
232
- attrs: {
233
- cmsNodeId: claimIdentityValue(context, implicitSlotId),
234
- implicit: true,
235
- name: "default",
236
- props: {}
237
- },
238
- content: defaultContent
239
- }, ...slots];
240
- }
241
- function decodeSlot(node, context, renderData) {
242
- const attrs = cleanAttrs(node[1]);
243
- const childRenderData = withCmsComarkProps(renderData, resolveCmsComarkAttributes(node[1], renderData));
244
- const name = slotName(attrs);
245
- const { name: _name, ...slotProps } = attrs;
246
- return {
247
- type: "cmsSlot",
248
- attrs: {
249
- cmsNodeId: claimIdentity(context, node[1]),
250
- implicit: false,
251
- name,
252
- props: slotProps
253
- },
254
- content: slotContent(decodeBlocks(elementChildren(node), context, childRenderData, true))
255
- };
256
- }
257
- function decodeListItems(nodes, context, renderData) {
258
- return nodes.flatMap((node) => isElementNode$1(node) && node[0] === "li" ? [decodeBlock(node, context, renderData)] : []);
259
- }
260
- function decodeInlines(nodes, context, renderData, inheritedMarks = []) {
261
- const result = [];
262
- for (const node of nodes) {
263
- if (Predicate.isString(node)) {
264
- if (node) result.push(withMarks({
265
- type: "text",
266
- text: node
267
- }, inheritedMarks));
268
- continue;
269
- }
270
- if (node[0] === null) {
271
- result.push(withMarks({
272
- type: "cmsInlineOpaque",
273
- attrs: {
274
- label: "Comment",
275
- node: stripInternalMetadata(node)
276
- }
277
- }, inheritedMarks));
278
- continue;
279
- }
280
- const markType = editorMarkForComarkTag(node[0]);
281
- if (markType) {
282
- const attrs = cleanAttrs(node[1]);
283
- const childRenderData = withCmsComarkProps(renderData, resolveCmsComarkAttributes(node[1], renderData));
284
- const markAttrs = markType === "link" ? mergeJsonAttributes(attrs, { cmsProps: attrs }) : Object.keys(attrs).length ? { cmsProps: attrs } : void 0;
285
- const mark = markAttrs === void 0 ? { type: markType } : {
286
- attrs: markAttrs,
287
- type: markType
288
- };
289
- result.push(...decodeInlines(elementChildren(node), context, childRenderData, [...inheritedMarks, mark]));
290
- continue;
291
- }
292
- if (node[0] === "br") {
293
- result.push(withMarks({ type: "hardBreak" }, inheritedMarks));
294
- continue;
295
- }
296
- if (node[0] === "img") {
297
- result.push(withMarks({
298
- type: "image",
299
- attrs: mergeJsonAttributes(decodeEditorImageAttributes(cleanAttrs(node[1])), { cmsNodeId: claimIdentity(context, node[1]) })
300
- }, inheritedMarks));
301
- continue;
302
- }
303
- result.push(withMarks({
304
- type: "cmsInlineOpaque",
305
- attrs: {
306
- label: node[0],
307
- node: stripInternalMetadata(node)
308
- }
309
- }, inheritedMarks));
310
- }
311
- return result;
312
- }
313
- function claimIdentity(context, attributes) {
314
- return claimIdentityValue(context, attributes ? editorMetadata(attributes)?.nodeId : void 0);
315
- }
316
- function claimIdentityValue(context, candidate) {
317
- const existing = editorNodeId(candidate);
318
- if (existing !== void 0 && !context.usedIds.has(existing)) {
319
- context.usedIds.add(existing);
320
- return existing;
321
- }
322
- for (let attempt = 0; attempt < 100; attempt++) {
323
- const created = createEditorNodeId();
324
- if (!context.usedIds.has(created)) {
325
- context.usedIds.add(created);
326
- return created;
327
- }
328
- }
329
- throw new Error("The editor identity factory did not produce a unique identity.");
330
- }
331
- function opaqueBlock(node, label, cmsNodeId) {
332
- return {
333
- type: "cmsOpaque",
334
- attrs: {
335
- cmsNodeId,
336
- label,
337
- node: stripInternalMetadata(node)
338
- }
339
- };
340
- }
341
- function stripInternalMetadata(node) {
342
- if (node[0] === null) return [
343
- null,
344
- cleanAttrs(node[1]),
345
- node[2]
346
- ];
347
- const [tag, attributes, ...children] = node;
348
- return [
349
- tag,
350
- cleanAttrs(attributes),
351
- ...children.map((child) => Predicate.isString(child) ? child : stripInternalMetadata(child))
352
- ];
353
- }
354
- function slotContent(content) {
355
- return content.length ? content : [{
356
- type: "paragraph",
357
- attrs: { cmsSynthetic: true }
358
- }];
359
- }
360
- function slotName(attrs) {
361
- return nonEmptyStringAttribute(attrs.name) ?? "default";
362
- }
363
- function cleanAttrs(attrs) {
364
- const { $: _internal, "data-cms-node": _marker, ...clean } = attrs;
365
- return structuredClone(clean);
366
- }
367
- function textContent(nodes) {
368
- const text = nodes.map((node) => Predicate.isString(node) ? node : node[0] === null ? node[2] : textContent(elementChildren(node))?.map((child) => child.text ?? "").join("") ?? "").join("");
369
- return text ? [{
370
- type: "text",
371
- text
372
- }] : void 0;
373
- }
374
- function isInlineElement(node) {
375
- return node[0] !== null && (isComarkMark(node[0]) || node[0] === "br" || node[0] === "img" || jsonObject(node[1].$).block === 0);
376
- }
377
- function isSlotTemplate(node) {
378
- return isElementNode$1(node) && node[0] === "template";
379
- }
380
- function isElementNode$1(node) {
381
- return Array.isArray(node) && Predicate.isString(node[0]);
382
- }
383
- function elementChildren(node) {
384
- const [, , ...children] = node;
385
- return children;
386
- }
387
- function jsonObject(value) {
388
- return isJsonObject$2(value) ? value : {};
389
- }
390
- function mergeJsonAttributes(attributes, additions) {
391
- return compactJsonAttributes(Object.assign({}, attributes, additions));
392
- }
393
- function withMarks(content, marks) {
394
- return marks.length ? Object.assign({}, content, { marks }) : content;
395
- }
396
-
397
- //#endregion
398
- //#region ../document/src/internal/comark/source-mapping.ts
399
- const SOURCE_MAPPINGS_META_KEY = "__cmsSourceMappings";
400
- const BLOCK_TAGS = /* @__PURE__ */ new Map([
401
- ["blockquote_open", "blockquote"],
402
- ["bullet_list_open", "ul"],
403
- ["list_item_open", "li"],
404
- ["ordered_list_open", "ol"],
405
- ["paragraph_open", "p"],
406
- ["table_open", "table"],
407
- ["tbody_open", "tbody"],
408
- ["td_open", "td"],
409
- ["th_open", "th"],
410
- ["thead_open", "thead"],
411
- ["tr_open", "tr"]
412
- ]);
413
- const ComarkToken = Schema.Struct({
414
- attrs: Schema.optionalKey(Schema.NullOr(Schema.Array(Schema.Tuple([Schema.String, Schema.String])))),
415
- hidden: Schema.optionalKey(Schema.Boolean),
416
- level: Schema.optionalKey(Schema.Finite),
417
- map: Schema.optionalKey(Schema.NullOr(Schema.Tuple([Schema.Finite, Schema.Finite]))),
418
- nesting: Schema.optionalKey(Schema.Finite),
419
- tag: Schema.optionalKey(Schema.String),
420
- type: Schema.optionalKey(Schema.String)
421
- });
422
- const WRAPPER_TAGS = /* @__PURE__ */ new Set([
423
- "blockquote",
424
- "ol",
425
- "pre",
426
- "table",
427
- "ul"
428
- ]);
429
- function sourceCapturePlugin() {
430
- return {
431
- name: "cms-source-capture",
432
- pre(state) {
433
- state.__cmsOriginalMarkdown = state.markdown;
434
- }
435
- };
436
- }
437
- function sourceMappingPlugin() {
438
- return {
439
- name: "cms-source-mapping",
440
- post(state) {
441
- const source = state.__cmsOriginalMarkdown ?? state.markdown;
442
- const descriptors = createBlockDescriptors(state.tokens.flatMap((token) => {
443
- const decoded = Schema.decodeUnknownOption(ComarkToken)(token);
444
- return Option.isSome(decoded) ? [decoded.value] : [];
445
- }), source, state.markdown, state.parsedLines ?? 0);
446
- const mappings = [];
447
- mapNodes(state.tree.nodes, descriptors, [], mappings);
448
- state.tree.meta[SOURCE_MAPPINGS_META_KEY] = mappings;
449
- }
450
- };
451
- }
452
- function createBlockDescriptors(tokens, source, parsedMarkdown, parsedLines) {
453
- const roots = [];
454
- const stack = [];
455
- const sourceLineStarts = indexLineStarts(source);
456
- const parsedLineStarts = indexLineStarts(parsedMarkdown);
457
- const parsedOffset = source.lastIndexOf(parsedMarkdown);
458
- const slotMaps = createSlotTokenMaps(tokens, parsedMarkdown);
459
- for (let tokenIndex = 0; tokenIndex < tokens.length; tokenIndex++) {
460
- const token = tokens[tokenIndex];
461
- if (!token) continue;
462
- const tag = blockTag(token);
463
- const tokenMap = token.map ?? slotMaps.get(tokenIndex);
464
- if (!tag || !tokenMap) continue;
465
- const level = token.level ?? 0;
466
- while (true) {
467
- const current = stack.at(-1);
468
- if (!current || current.level < level) break;
469
- stack.pop();
470
- }
471
- const descriptor = {
472
- children: [],
473
- range: rangeFromParsedLines(source, sourceLineStarts, parsedMarkdown, parsedLineStarts, parsedOffset, tokenMap[0], tokenMap[1] + (token.type === "mdc_block_open" ? 1 : 0), parsedLines),
474
- tag
475
- };
476
- ((stack.at(-1)?.descriptor)?.children ?? roots).push(descriptor);
477
- if (token.nesting === 1) stack.push({
478
- descriptor,
479
- level
480
- });
481
- }
482
- return roots.map(collapseComarkWrapper).map(groupProjectedSlotContent);
483
- }
484
- function blockTag(token) {
485
- if (token.hidden || !token.type) return void 0;
486
- if (token.type === "heading_open") return token.tag;
487
- if (token.type === "mdc_block_open" || token.type === "mdc_block_shorthand" && token.nesting !== -1) return token.tag || "component";
488
- if (token.type === "mdc_block_slot" && token.nesting === 1) return "template";
489
- if ([
490
- "fence",
491
- "fenced_code_block",
492
- "code_block"
493
- ].includes(token.type)) return "pre";
494
- if (token.type === "math_block") return "math";
495
- if (token.type === "html_block") return "*";
496
- if (token.type === "hr") return "hr";
497
- return BLOCK_TAGS.get(token.type);
498
- }
499
- function createSlotTokenMaps(tokens, parsedMarkdown) {
500
- const maps = /* @__PURE__ */ new Map();
501
- const markers = slotMarkers(parsedMarkdown);
502
- const stack = [];
503
- let nextMarker = 0;
504
- for (let index = 0; index < tokens.length; index++) {
505
- const token = tokens[index];
506
- if (!token || token.type !== "mdc_block_slot") continue;
507
- if (token.nesting === 1) {
508
- const name = token.attrs?.[0]?.[0]?.replace(/^#/u, "");
509
- let markerIndex = nextMarker;
510
- while (markerIndex < markers.length && markers[markerIndex]?.name !== name) markerIndex++;
511
- const marker = markers[markerIndex];
512
- if (marker) {
513
- stack.push({
514
- index,
515
- marker: marker.line
516
- });
517
- nextMarker = markerIndex + 1;
518
- }
519
- continue;
520
- }
521
- if (token.nesting !== -1) continue;
522
- const open = stack.pop();
523
- if (!open) continue;
524
- let endLine = open.marker + 1;
525
- for (let childIndex = open.index + 1; childIndex < index; childIndex++) {
526
- const child = tokens[childIndex];
527
- const map = child?.map ?? maps.get(childIndex);
528
- if (child && map) endLine = Math.max(endLine, map[1] + (child.type === "mdc_block_open" ? 1 : 0));
529
- }
530
- maps.set(open.index, [open.marker, endLine]);
531
- }
532
- return maps;
533
- }
534
- function slotMarkers(source) {
535
- return source.split(/\r?\n/u).flatMap((line, index) => {
536
- const name = line.match(/^\s*#([^\s{]+)/u)?.[1];
537
- return name ? [{
538
- line: index,
539
- name
540
- }] : [];
541
- });
542
- }
543
- function collapseComarkWrapper(descriptor) {
544
- const children = descriptor.children.map(collapseComarkWrapper);
545
- if (WRAPPER_TAGS.has(descriptor.tag) && children.length === 1 && children[0]?.tag === descriptor.tag) return {
546
- ...descriptor,
547
- children: children[0].children
548
- };
549
- return {
550
- ...descriptor,
551
- children
552
- };
553
- }
554
- /** Comark projects siblings after a named slot into that active slot. */
555
- function groupProjectedSlotContent(descriptor) {
556
- const grouped = [];
557
- let activeSlot;
558
- for (const rawChild of descriptor.children) {
559
- const child = groupProjectedSlotContent(rawChild);
560
- if (child.tag === "template") {
561
- activeSlot = child;
562
- grouped.push(child);
563
- continue;
564
- }
565
- if (!activeSlot) {
566
- grouped.push(child);
567
- continue;
568
- }
569
- activeSlot.children.push(child);
570
- if (child.range.end.offset > activeSlot.range.end.offset) activeSlot.range = {
571
- start: activeSlot.range.start,
572
- end: child.range.end
573
- };
574
- }
575
- return {
576
- ...descriptor,
577
- children: grouped
578
- };
579
- }
580
- function mapNodes(nodes, descriptors, parentPath, mappings) {
581
- let descriptorIndex = 0;
582
- for (let nodeIndex = 0; nodeIndex < nodes.length; nodeIndex++) {
583
- const node = nodes[nodeIndex];
584
- if (!node || !isElementNode(node)) continue;
585
- let matchIndex = descriptorIndex;
586
- while (matchIndex < descriptors.length && descriptors[matchIndex]?.tag !== "*" && descriptors[matchIndex]?.tag !== node[0]) matchIndex++;
587
- const descriptor = descriptors[matchIndex];
588
- if (!descriptor) continue;
589
- descriptorIndex = matchIndex + 1;
590
- const nodePath = [...parentPath, nodeIndex];
591
- mappings.push({
592
- nodePath,
593
- range: descriptor.range
594
- });
595
- const [, , ...children] = node;
596
- mapNodes(children, descriptor.children, nodePath, mappings);
597
- }
598
- }
599
- function isElementNode(node) {
600
- return Array.isArray(node) && Predicate.isString(node[0]);
601
- }
602
- function indexLineStarts(source) {
603
- const starts = [0];
604
- for (let offset = 0; offset < source.length; offset++) if (source.charCodeAt(offset) === 10) starts.push(offset + 1);
605
- return starts;
606
- }
607
- function rangeFromParsedLines(source, sourceLineStarts, parsedMarkdown, parsedLineStarts, parsedOffset, startLine, endLine, fallbackLineOffset) {
608
- const startOffset = parsedOffset >= 0 ? parsedOffset + (parsedLineStarts[startLine] ?? parsedMarkdown.length) : sourceLineStarts[startLine + fallbackLineOffset] ?? source.length;
609
- const endOffset = parsedOffset >= 0 ? parsedOffset + (parsedLineStarts[endLine] ?? parsedMarkdown.length) : sourceLineStarts[endLine + fallbackLineOffset] ?? source.length;
610
- return {
611
- start: pointAt(source, sourceLineStarts, startOffset),
612
- end: pointAt(source, sourceLineStarts, Math.max(startOffset, endOffset))
613
- };
614
- }
615
- function pointAt(source, lineStarts, rawOffset) {
616
- const offset = Math.min(Math.max(rawOffset, 0), source.length);
617
- let low = 0;
618
- let high = lineStarts.length - 1;
619
- while (low < high) {
620
- const middle = Math.ceil((low + high) / 2);
621
- if ((lineStarts[middle] ?? source.length) <= offset) low = middle;
622
- else high = middle - 1;
623
- }
624
- return {
625
- offset,
626
- line: low + 1,
627
- column: offset - (lineStarts[low] ?? 0) + 1
628
- };
629
- }
630
-
631
- //#endregion
632
- //#region ../document/src/internal/comark/grammar.ts
633
- /**
634
- * Changes when parsing, normalization, or projection semantics change. Stored
635
- * with compiled documents so migrations can identify stale derived content.
636
- */
637
- const DOCUMENT_ENGINE_FINGERPRINT = "comark@0.6.2/frontmatter+alert+task-list+components+attributes+security+headings+toc+source-mapping/v1";
638
- function createDocumentParser() {
639
- return createMarkdownParser({
640
- autoClose: false,
641
- registerDefaultPlugins: false,
642
- plugins: [
643
- sourceCapturePlugin(),
644
- frontmatter(),
645
- alert(),
646
- taskList(),
647
- components(),
648
- attributes(),
649
- security(),
650
- headings(),
651
- toc({
652
- depth: 5,
653
- searchDepth: 6
654
- }),
655
- sourceMappingPlugin()
656
- ]
657
- });
658
- }
659
-
660
- //#endregion
661
- //#region ../document/src/internal/editor/errors.ts
662
- var EditorDocumentInvalid = class extends Schema.TaggedError()("EditorDocument.Invalid", {
663
- message: Schema.NonEmptyString,
664
- cause: Schema.Defect()
665
- }) {};
666
- var EditorRenderFailed = class extends Schema.TaggedError()("EditorDocument.RenderFailed", { cause: Schema.Defect() }) {};
667
-
668
- //#endregion
669
- //#region ../document/src/StructuredFields.ts
670
- function compileStructuredFields(definitions) {
671
- const fields = new Map(definitions.map((field) => [field.name, field]));
672
- if (fields.size !== definitions.length) throw new Error("Structured field names must be unique.");
673
- for (const field of definitions) {
674
- if (field.defaultValue === void 0) continue;
675
- const issue = fieldIssue(field, field.defaultValue, "working");
676
- if (issue) throw new Error(`Invalid default for ${field.label}: ${issue.message}`);
677
- }
678
- const listField = (name) => {
679
- const field = fields.get(name);
680
- if (!field || field.type !== "array" || field.input !== "list") throw new Error(`Structured field "${name}" is not a repeatable object.`);
681
- return field;
682
- };
683
- const validateDetailed = (value, purpose) => {
684
- const issues = [];
685
- for (const name of Object.keys(value)) if (!fields.has(name)) issues.push({
686
- message: `${name} is not editable.`,
687
- path: [name]
688
- });
689
- for (const field of definitions) {
690
- const issue = fieldIssue(field, value[field.name] ?? (value[field.name] === null ? null : field.defaultValue), purpose, [field.name]);
691
- if (issue) issues.push(issue);
692
- }
693
- return issues;
694
- };
695
- return {
696
- create: () => createObject(definitions),
697
- set(current, name, value) {
698
- const field = fields.get(name);
699
- if (!field) throw new Error(`Structured field "${name}" is unavailable.`);
700
- const issue = fieldIssue(field, value, "working");
701
- if (issue) throw new Error(issue.message);
702
- const next = Object.fromEntries(Object.entries(current));
703
- if (value === void 0) delete next[name];
704
- else next[name] = structuredClone(value);
705
- return next;
706
- },
707
- validate: (value, purpose) => validateDetailed(value, purpose).map((issue) => issue.message),
708
- validateDetailed,
709
- validateIdentities: (value) => identityIssues(definitions, value),
710
- createListItem(name) {
711
- return createObject(listField(name).fields ?? [], true);
712
- },
713
- duplicateListItem(name, item) {
714
- const field = listField(name);
715
- const copied = cloneWithFreshIdentities(item, field.fields ?? []);
716
- return Object.assign(createObject(field.fields ?? [], true), copied, { id: createEditorNodeId() });
717
- },
718
- moveListItem(items, id, offset) {
719
- const index = items.findIndex((item) => item.id === id);
720
- const target = index + offset;
721
- if (index < 0 || target < 0 || target >= items.length) return items;
722
- const next = [...items];
723
- const item = next.splice(index, 1)[0];
724
- if (!item) return items;
725
- next.splice(target, 0, item);
726
- return next;
727
- },
728
- removeListItem: (items, id) => items.filter((item) => item.id !== id)
729
- };
730
- }
731
- function identityIssues(fields, value, parent = []) {
732
- return fields.flatMap((field) => {
733
- const current = value[field.name];
734
- const path = [...parent, field.name];
735
- if (field.type === "object" && isJsonObject$1(current)) return identityIssues(field.fields ?? [], current, path);
736
- if (field.type !== "array" || !Array.isArray(current)) return [];
737
- const seen = /* @__PURE__ */ new Set();
738
- return current.flatMap((item, index) => {
739
- if (!isJsonObject$1(item)) return [];
740
- const id = item.id;
741
- const issue = !Predicate.isString(id) || !id || seen.has(id) ? [{
742
- message: `${field.label} items need unique identities.`,
743
- path: [
744
- ...path,
745
- index,
746
- "id"
747
- ]
748
- }] : [];
749
- if (Predicate.isString(id) && id) seen.add(id);
750
- return [...issue, ...identityIssues(field.fields ?? [], item, [...path, index])];
751
- });
752
- });
753
- }
754
- function createObject(fields, listItem = false) {
755
- return {
756
- ...listItem ? { id: createEditorNodeId() } : void 0,
757
- ...Object.fromEntries(fields.flatMap((field) => field.required || field.defaultValue !== void 0 ? [[field.name, structuredClone(field.defaultValue ?? defaultValue(field))]] : []))
758
- };
759
- }
760
- function defaultValue(field) {
761
- if (field.type === "object") return createObject(field.fields ?? []);
762
- if (field.type === "array") return [];
763
- if (field.type === "string[]") return [];
764
- if (field.type === "number") return 0;
765
- if (field.type === "boolean") return false;
766
- return field.options[0]?.value ?? "";
767
- }
768
- function cloneWithFreshIdentities(value, fields) {
769
- const byName = new Map(fields.map((field) => [field.name, field]));
770
- const copy = {};
771
- for (const [name, child] of Object.entries(value)) {
772
- if (name === "id") continue;
773
- const field = byName.get(name);
774
- if (field?.type === "object" && isJsonObject$1(child)) copy[name] = cloneWithFreshIdentities(child, field.fields ?? []);
775
- else if (field?.type === "array" && Array.isArray(child)) copy[name] = child.map((item) => isJsonObject$1(item) ? Object.assign(cloneWithFreshIdentities(item, field.fields ?? []), { id: createEditorNodeId() }) : structuredClone(item));
776
- else copy[name] = structuredClone(child);
777
- }
778
- return copy;
779
- }
780
- function fieldIssue(field, value, purpose, path = [field.name]) {
781
- const issue = (message, issuePath = path) => ({
782
- message,
783
- path: issuePath
784
- });
785
- if (value === void 0) return field.required && purpose === "publish" ? issue(`${field.label} is required.`) : void 0;
786
- if (value === null && field.nullable) return void 0;
787
- if (!(field.type === "string" || field.type === "date" ? Predicate.isString(value) : field.type === "number" ? Predicate.isNumber(value) && Number.isFinite(value) : field.type === "boolean" ? Predicate.isBoolean(value) : field.type === "string[]" ? Array.isArray(value) && value.every(Predicate.isString) : field.type === "array" ? Array.isArray(value) : isJsonObject$1(value))) return issue(`${field.label} must be ${field.type}.`);
788
- if (field.type === "object" || field.type === "array") {
789
- const entries = Array.isArray(value) ? value : [value];
790
- const ids = /* @__PURE__ */ new Set();
791
- for (const [index, entry] of entries.entries()) {
792
- const entryPath = field.type === "array" ? [...path, index] : path;
793
- if (!isJsonObject$1(entry)) return issue(`${field.label} must contain objects.`, entryPath);
794
- if (field.type === "array") {
795
- const id = entry.id;
796
- if (!Predicate.isString(id) || !id || ids.has(id)) return issue(`${field.label} items need unique identities.`, [...entryPath, "id"]);
797
- ids.add(id);
798
- }
799
- for (const key of Object.keys(entry)) if (!(field.type === "array" && key === "id") && !field.fields?.some((child) => child.name === key)) return issue(`${field.label} contains an unavailable field.`, [...entryPath, key]);
800
- for (const child of field.fields ?? []) {
801
- const childIssue = fieldIssue(child, entry[child.name], purpose, [...entryPath, child.name]);
802
- if (childIssue) return {
803
- ...childIssue,
804
- message: `${field.label}: ${childIssue.message}`
805
- };
806
- }
807
- }
808
- }
809
- if (purpose === "publish" && field.required && value === "" && [
810
- "image",
811
- "link",
812
- "document",
813
- "media"
814
- ].includes(field.input)) return issue(`${field.label} is required.`);
815
- if (purpose === "publish" && Predicate.isString(value) && value && (field.input === "image" || field.input === "link") && !(field.input === "link" && decodeAuthoredDocumentReference(value)) && !validAuthoringUrl(value, field.input)) return issue(`${field.label} needs a valid ${field.input === "image" ? "image URL" : "link"}.`);
816
- if (purpose === "publish" && Predicate.isString(value) && value && field.input === "document" && !decodeAuthoredDocumentReference(value)) return issue(`${field.label} needs a valid document reference.`);
817
- if (purpose === "publish" && Predicate.isString(value) && value && field.input === "media" && !decodeManagedMediaReference(value)) return issue(`${field.label} needs a valid managed-media reference.`);
818
- if (field.options.length) {
819
- if ((Array.isArray(value) ? value : [value]).some((entry) => !field.options.some((option) => option.value === entry))) return issue(`${field.label} must use only available choices.`);
820
- }
821
- }
822
- function isJsonObject$1(value) {
823
- return Schema.is(Schema.JsonObject)(value);
824
- }
825
- /** URL values remain ordinary strings; identity-backed references use dedicated field inputs. */
826
- function validAuthoringUrl(value, input) {
827
- if (value.trim() !== value || value.includes("\\")) return false;
828
- for (const character of value) if (character.charCodeAt(0) <= 32) return false;
829
- if (value.startsWith("/") && !value.startsWith("//")) return true;
830
- if (input === "link" && value.startsWith("#")) return true;
831
- try {
832
- const url = new URL(value);
833
- return [
834
- "https:",
835
- "http:",
836
- ...input === "link" ? ["mailto:", "tel:"] : []
837
- ].includes(url.protocol);
838
- } catch {
839
- return false;
840
- }
841
- }
842
-
843
- //#endregion
844
- //#region ../document/src/AuthoringSchema.ts
845
- const parseAuthoringContent = Effect.fn("AuthoringSchema.parseContent")(function* (markdown) {
846
- const body = yield* Effect.tryPromise({
847
- try: () => createDocumentParser()(markdown),
848
- catch: (cause) => new EditorDocumentInvalid({
849
- cause,
850
- message: "Invalid initial Markdown content."
851
- })
852
- });
853
- return (yield* Schema.decodeUnknownEffect(CmsMarkdownDocument)(body)).nodes;
854
- });
855
- const isJsonObject = Schema.is(Schema.JsonObject);
856
- function collectionComponents(components, body) {
857
- if (!body) return components;
858
- return components.filter((component) => body.blocks?.includes(component.name) || component.authoring.group !== void 0 && body.groups?.includes(component.authoring.group));
859
- }
860
- /** Configuration errors belong to developers, before an installation adopts the catalog. */
861
- function validateCollectionBody(components, body) {
862
- return [
863
- ...components.flatMap((component) => component.authoring.slots.flatMap((slot) => slot.input === "blocks" ? [...(slot.blocks ?? []).filter((name) => !components.some((candidate) => candidate.name === name)).map((name) => `Unknown block "${name}" in ${slot.label}.`), ...(slot.groups ?? []).filter((group) => !components.some((candidate) => candidate.authoring.group === group)).map((group) => `Unknown block group "${group}" in ${slot.label}.`)] : [])),
864
- ...(body?.blocks ?? []).filter((name) => !components.some((component) => component.name === name)).map((name) => `Unknown block "${name}".`),
865
- ...(body?.groups ?? []).filter((group) => !components.some((component) => component.authoring.group === group)).map((group) => `Unknown block group "${group}".`)
866
- ];
867
- }
868
- function contentIssues(node, schemas, allowed, purpose, collectionAllowed = allowed) {
869
- const issues = [];
870
- if (node.type === "cmsBlock") {
871
- const name = String(node.attrs?.tag ?? "unknown").toLowerCase() || "unknown";
872
- const schema = schemas.get(name);
873
- if (!schema) issues.push({
874
- component: name,
875
- message: "This block is unavailable. Ask your site developer to restore its definition."
876
- });
877
- else {
878
- if (!allowed.has(name)) issues.push({
879
- component: name,
880
- message: `${schema.definition.label} is not allowed in this content region.`
881
- });
882
- issues.push(...schema.validateDetailed(node, purpose));
883
- if (purpose === "publish" && schema.definition.form) issues.push(...formStructureIssues(node.attrs?.props?.steps, schema.definition.form, name).map((message) => ({
884
- component: name,
885
- message
886
- })));
887
- }
888
- }
889
- if (node.type === "cmsOpaque" || node.type === "cmsInlineOpaque") issues.push({
890
- component: String(node.attrs?.tag ?? node.type),
891
- message: "This content is unsupported. Ask your site developer to update it before publishing."
892
- });
893
- if (node.type === "cmsBlock") {
894
- const schema = schemas.get(String(node.attrs?.tag).toLowerCase());
895
- for (const region of node.content ?? []) {
896
- const slot = schema?.definition.slots.find((candidate) => candidate.name === region.attrs?.name);
897
- const permitted = slot?.input === "blocks" ? new Set(collectionComponents([...schemas].map(([name, schema]) => ({
898
- name,
899
- authoring: schema.definition
900
- })), slot.blocks === void 0 && slot.groups === void 0 ? void 0 : slot).map((component) => component.name).filter((name) => collectionAllowed.has(name))) : collectionAllowed;
901
- issues.push(...contentIssues(region, schemas, permitted, purpose, collectionAllowed));
902
- }
903
- return issues;
904
- }
905
- return [...issues, ...(node.content ?? []).flatMap((child) => contentIssues(child, schemas, allowed, purpose, collectionAllowed))];
906
- }
907
- /** Resolves a component catalog once so document compilation can reuse its authoring rules. */
908
- function createAuthoringDocumentValidator(components) {
909
- const definitions = [...components.values()];
910
- const schemas = new Map(definitions.map((component) => [component.name, createAuthoringSchema(component.name, component.authoring)]));
911
- return (body, bodyPolicy) => {
912
- const allowed = new Set(collectionComponents(definitions, bodyPolicy).map((component) => component.name));
913
- return comarkToEditor(body.nodes, createCmsComarkRenderData(body)).flatMap((node) => contentIssues(node, schemas, allowed, "publish"));
914
- };
915
- }
916
- function createAuthoringSchema(name, definition) {
917
- const structuredFields = compileStructuredFields(definition.props);
918
- const fields = new Map(definition.props.map((field) => [field.name, field]));
919
- const slots = new Map(definition.slots.map((slot) => [slot.name, slot]));
920
- if (fields.size !== definition.props.length || slots.size !== definition.slots.length) throw new Error(`${definition.label}: authoring names must be unique.`);
921
- const initialProps = Object.assign({}, structuredFields.create(), definition.initialProps);
922
- function createSlot(slotName) {
923
- const slot = slots.get(slotName);
924
- if (!slot) throw new Error(`${definition.label}: unknown content region ${slotName}.`);
925
- const content = slot.initial ? comarkToEditor(slot.initial) : [];
926
- return {
927
- type: "cmsSlot",
928
- attrs: {
929
- cmsNodeId: createEditorNodeId(),
930
- name: slotName,
931
- implicit: slotName === "default",
932
- props: {}
933
- },
934
- content: content.length ? content : [{
935
- type: "paragraph",
936
- attrs: { cmsNodeId: createEditorNodeId() }
937
- }]
938
- };
939
- }
940
- function createContent() {
941
- return {
942
- type: "cmsBlock",
943
- attrs: {
944
- cmsNodeId: createEditorNodeId(),
945
- tag: name,
946
- props: structuredClone(initialProps)
947
- },
948
- content: definition.slots.filter((slot) => slot.required || slot.initial !== void 0).map((slot) => createSlot(slot.name))
949
- };
950
- }
951
- function validateDetailed(node, purpose) {
952
- const issues = [];
953
- const attributes = node.attrs?.props;
954
- const values = isJsonObject(attributes) ? attributes : {};
955
- issues.push(...structuredFields.validateDetailed(values, purpose).map((issue) => ({
956
- component: name,
957
- field: issue.path,
958
- message: issue.message
959
- })));
960
- const used = /* @__PURE__ */ new Set();
961
- for (const region of node.content ?? []) {
962
- const key = String(region.attrs?.name ?? "default");
963
- const slot = slots.get(key);
964
- if (!slot || region.type !== "cmsSlot") {
965
- issues.push({
966
- component: name,
967
- message: `${definition.label}: unsupported content region ${key}.`
968
- });
969
- continue;
970
- }
971
- if (used.has(key)) issues.push({
972
- component: name,
973
- message: `${slot.label} can only appear once.`
974
- });
975
- used.add(key);
976
- if (!validRegion(slot, region.content ?? [])) issues.push({
977
- component: name,
978
- message: `${slot.label} contains unsupported formatting or blocks.`
979
- });
980
- }
981
- for (const slot of definition.slots) if (slot.required && !used.has(slot.name)) issues.push({
982
- component: name,
983
- message: `${slot.label} is required.`
984
- });
985
- return issues;
986
- }
987
- const validate = (node, purpose) => validateDetailed(node, purpose).map((issue) => issue.message);
988
- const schema = {
989
- definition,
990
- createContent,
991
- createSlot,
992
- validate,
993
- validateDetailed,
994
- setProperty(current, key, value) {
995
- return structuredFields.set(current, key, value);
996
- }
997
- };
998
- const issues = validate(createContent(), "publish");
999
- if (issues.length) throw new Error(`Invalid initial content for ${definition.label}: ${issues.join(" ")}`);
1000
- return schema;
1001
- }
1002
- function validRegion(slot, content) {
1003
- if (slot.input === "blocks") return content.every((node) => node.type === "cmsBlock" || node.type === "paragraph" && !node.content?.length);
1004
- const types = /* @__PURE__ */ new Set([
1005
- "paragraph",
1006
- "text",
1007
- "hardBreak"
1008
- ]);
1009
- const marks = /* @__PURE__ */ new Set();
1010
- if (slot.input !== "rich-text" && content.length > 1) return false;
1011
- if (slot.input === "inline-text" || slot.input === "rich-text") for (const feature of slot.features) if (feature === "bullet-list") {
1012
- types.add("bulletList");
1013
- types.add("listItem");
1014
- } else marks.add(feature);
1015
- const valid = (node) => types.has(node.type ?? "") && (node.marks ?? []).every((mark) => marks.has(mark.type)) && (node.content ?? []).every(valid);
1016
- return content.every(valid);
1017
- }
1018
-
1019
- //#endregion
1020
- //#region ../protocol/src/StructuredFields.ts
1021
- const presentation = {
1022
- name: Schema.NonEmptyString,
1023
- label: Schema.NonEmptyString,
1024
- description: Schema.optionalKey(Schema.String),
1025
- defaultValue: Schema.optionalKey(Schema.Json),
1026
- required: Schema.Boolean,
1027
- nullable: Schema.Boolean
1028
- };
1029
- const stringOptions = Schema.Array(Schema.Struct({
1030
- value: Schema.String,
1031
- label: Schema.String
1032
- }));
1033
- const numberOptions = Schema.Array(Schema.Struct({
1034
- value: Schema.Finite,
1035
- label: Schema.String
1036
- }));
1037
- const noOptions = Schema.Tuple([]);
1038
- const StructuredField = Schema.Union([
1039
- Schema.Struct({
1040
- ...presentation,
1041
- type: Schema.tag("boolean"),
1042
- input: Schema.Literal("toggle"),
1043
- options: noOptions
1044
- }),
1045
- Schema.Struct({
1046
- ...presentation,
1047
- type: Schema.tag("date"),
1048
- input: Schema.Literal("date"),
1049
- options: noOptions
1050
- }),
1051
- Schema.Struct({
1052
- ...presentation,
1053
- type: Schema.tag("number"),
1054
- input: Schema.Literals(["number", "select"]),
1055
- options: numberOptions
1056
- }),
1057
- Schema.Struct({
1058
- ...presentation,
1059
- type: Schema.tag("string"),
1060
- input: Schema.Literals([
1061
- "select",
1062
- "text",
1063
- "textarea",
1064
- "image",
1065
- "link",
1066
- "document",
1067
- "media"
1068
- ]),
1069
- options: stringOptions
1070
- }),
1071
- Schema.Struct({
1072
- ...presentation,
1073
- type: Schema.tag("string[]"),
1074
- input: Schema.Literal("multiselect"),
1075
- options: stringOptions
1076
- }),
1077
- Schema.Struct({
1078
- ...presentation,
1079
- type: Schema.tag("object"),
1080
- input: Schema.Literal("object"),
1081
- options: noOptions,
1082
- fields: Schema.Array(Schema.suspend(() => StructuredField))
1083
- }),
1084
- Schema.Struct({
1085
- ...presentation,
1086
- type: Schema.tag("array"),
1087
- input: Schema.Literal("list"),
1088
- options: noOptions,
1089
- fields: Schema.Array(Schema.suspend(() => StructuredField))
1090
- })
1091
- ]);
1092
-
1093
- //#endregion
1094
- //#region ../protocol/src/Authoring.ts
1095
- const inlineTextFeature = Schema.Literals([
1096
- "bold",
1097
- "italic",
1098
- "link",
1099
- "code"
1100
- ]);
1101
- const richTextFeature = Schema.Union([inlineTextFeature, Schema.Literal("bullet-list")]);
1102
- const slotBase = {
1103
- name: Schema.NonEmptyString,
1104
- label: Schema.NonEmptyString,
1105
- help: Schema.optionalKey(Schema.String),
1106
- required: Schema.Boolean,
1107
- initial: Schema.optionalKey(Schema.Array(MarkdownNode))
1108
- };
1109
- const noFeatures = Schema.Tuple([]);
1110
- const BlockSlot = Schema.Union([
1111
- Schema.Struct({
1112
- ...slotBase,
1113
- input: Schema.Literal("text"),
1114
- features: noFeatures
1115
- }),
1116
- Schema.Struct({
1117
- ...slotBase,
1118
- input: Schema.Literal("inline-text"),
1119
- features: Schema.Array(inlineTextFeature)
1120
- }),
1121
- Schema.Struct({
1122
- ...slotBase,
1123
- input: Schema.Literal("rich-text"),
1124
- features: Schema.Array(richTextFeature)
1125
- }),
1126
- Schema.Struct({
1127
- ...slotBase,
1128
- input: Schema.Literal("blocks"),
1129
- features: noFeatures,
1130
- blocks: Schema.optionalKey(Schema.Array(Schema.NonEmptyString)),
1131
- groups: Schema.optionalKey(Schema.Array(Schema.NonEmptyString))
1132
- })
1133
- ]);
1134
- const BlockAuthoring = Schema.Struct({
1135
- version: Schema.Literal(1),
1136
- form: Schema.optionalKey(FormCapabilities),
1137
- label: Schema.NonEmptyString,
1138
- description: Schema.optionalKey(Schema.String),
1139
- group: Schema.optionalKey(Schema.String),
1140
- icon: Schema.optionalKey(Schema.String),
1141
- props: Schema.Array(StructuredField),
1142
- slots: Schema.Array(BlockSlot),
1143
- initialProps: Schema.JsonObject
1144
- });
1145
-
1146
- //#endregion
1147
- //#region ../protocol/src/Configuration.ts
1148
- const CollectionBody = Schema.Struct({
1149
- blocks: Schema.optionalKey(Schema.Array(Schema.NonEmptyString)),
1150
- groups: Schema.optionalKey(Schema.Array(Schema.NonEmptyString))
1151
- });
1152
- const CollectionRoutes = Schema.Struct({
1153
- home: RoutePattern,
1154
- entry: RoutePattern
1155
- }).annotate({ identifier: "CollectionRoutes" });
1156
- const CollectionDefinition = Schema.Struct({
1157
- collection: CollectionName,
1158
- body: Schema.optionalKey(CollectionBody),
1159
- label: Schema.NonEmptyString,
1160
- description: Schema.String,
1161
- routes: CollectionRoutes,
1162
- hierarchy: Schema.Boolean,
1163
- canCreate: Schema.Boolean,
1164
- authoringFields: Schema.Array(StructuredField)
1165
- }).annotate({ identifier: "CollectionDefinition" });
1166
- const LocaleConfiguration = Schema.Struct({
1167
- locales: Schema.Array(Locale),
1168
- defaultLocale: Locale,
1169
- fallbackLocale: Schema.NullOr(Locale),
1170
- prefix: Schema.NullOr(Schema.Literal("always"))
1171
- }).annotate({ identifier: "LocaleConfiguration" });
1172
- const DocumentConfiguration = Schema.Struct({
1173
- types: Schema.Array(CollectionDefinition),
1174
- locales: Schema.optionalKey(LocaleConfiguration)
1175
- }).annotate({ identifier: "DocumentConfiguration" });
1176
- const ComponentDefinition = Schema.Struct({
1177
- authoring: BlockAuthoring,
1178
- name: Schema.NonEmptyString
1179
- }).annotate({ identifier: "ComponentDefinition" });
1180
- const AuthoringCatalog = Schema.Struct({
1181
- revision: Schema.NonEmptyString,
1182
- components: Schema.Array(ComponentDefinition)
1183
- });
1184
- const MediaConfiguration = Schema.Struct({
1185
- enabled: Schema.Boolean,
1186
- maxUploadBytes: Schema.Int.check(Schema.isGreaterThan(0))
1187
- });
1188
-
1189
- //#endregion
1190
- export { compactJsonAttributes as C, normalizeEditorImageLayout as S, nonEmptyStringAttribute as T, EDITOR_MARK_TYPES as _, BlockAuthoring as a, EDITOR_IMAGE_LAYOUT_ATTRIBUTE as b, parseAuthoringContent as c, EditorDocumentInvalid as d, EditorRenderFailed as f, comarkToEditor as g, SOURCE_MAPPINGS_META_KEY as h, MediaConfiguration as i, validateCollectionBody as l, createDocumentParser as m, ComponentDefinition as n, createAuthoringDocumentValidator as o, DOCUMENT_ENGINE_FINGERPRINT as p, DocumentConfiguration as r, createAuthoringSchema as s, AuthoringCatalog as t, compileStructuredFields as u, comarkTagForEditorMark as v, finiteNumberAttribute as w, encodeEditorImageAttributes as x, isEditorMark as y };
1191
- //# sourceMappingURL=Configuration-CMweD9bn.js.map