@phtngyn/cms 0.2.0-beta.7 → 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 -401
  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 +1039 -162
  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 +8757 -39178
  354. package/studio/host.js.br +0 -0
  355. package/studio/host.js.gz +0 -0
  356. package/CHANGELOG.md +0 -13
  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-Da5B2PVH.js +0 -1191
  361. package/src/Configuration-Da5B2PVH.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-hh_IGPXO.js +0 -978
  372. package/src/DocumentEngine-hh_IGPXO.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-c9nLZ9H2.js +0 -21
  383. package/src/HttpPaths-c9nLZ9H2.js.map +0 -1
  384. package/src/I18n-zbqpWxki.d.ts +0 -29
  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-Dwhl2deX.js +0 -2742
  391. package/src/S3MediaObjects-Dwhl2deX.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-CjDq63Ft.js +0 -535
  399. package/src/dev-lifecycle-CjDq63Ft.js.map +0 -1
  400. package/src/installation-DYNQQBD3.js +0 -9114
  401. package/src/installation-DYNQQBD3.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 -99
  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 -51
  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-BpjBYGfI.js +0 -335
  521. package/studio/SelectMenu-KiXwx4Y_.js +0 -34032
  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
@@ -0,0 +1,396 @@
1
+ import { h as issue } from "./Seo-CjNUtUkj.js";
2
+ import { i as MediaId, u as MediaSelection } from "./Media-DSyvd14o.js";
3
+ import { t as LinkTarget } from "./Links-CJYyy7rC.js";
4
+ import { a as validateObjectDefinition, n as inspectObjectValues, o as fieldPath, s as walk } from "./validation-DpUwPC8Y.js";
5
+ import { a as FormOption, c as FormSteps, i as FormFieldType } from "./contracts-rprW3ZOB.js";
6
+ import { n as checkedBody } from "./EditorSchema-wrDv-id6.js";
7
+ import { i as studioErrorReason } from "./StudioErrors-T5zLGQ1M.js";
8
+ import { n as BlockId } from "./Blocks-BrxSemnd.js";
9
+ import { Result, Schema } from "effect";
10
+ //#region ../model/src/internal/fields/operations.ts
11
+ const ImageReference = Schema.Struct({
12
+ kind: Schema.Literal("image"),
13
+ mediaId: MediaId
14
+ });
15
+ function initialFieldValues(collection, title) {
16
+ return Object.assign({ title }, initialObjectValues(collection.fields));
17
+ }
18
+ function initialObjectValues(fields) {
19
+ const values = {};
20
+ for (const field of fields) if ("defaultValue" in field && field.defaultValue !== void 0) values[field.name] = structuredClone(field.defaultValue);
21
+ else if (field.required) values[field.name] = defaultValue(field);
22
+ return values;
23
+ }
24
+ function defaultValue(field) {
25
+ switch (field.kind) {
26
+ case "object": return initialObjectValues(field.fields);
27
+ case "list": return [];
28
+ case "link": return {
29
+ kind: "url",
30
+ href: ""
31
+ };
32
+ case "multi-select": return [];
33
+ case "number": return 0;
34
+ case "boolean": return false;
35
+ case "select": return field.options[0]?.value ?? "";
36
+ default: return "";
37
+ }
38
+ }
39
+ function allFieldDefinitions(fields) {
40
+ return fields.flatMap((field) => field.kind === "object" || field.kind === "list" ? [field, ...allFieldDefinitions(field.fields)] : [field]);
41
+ }
42
+ function documentReferences(fields, values) {
43
+ const found = [];
44
+ for (const location of walk(fields, values)) {
45
+ if (location.kind !== "field") continue;
46
+ const { field, value, path, label } = location;
47
+ if (field.kind === "document") found.push({
48
+ path: fieldPath(path),
49
+ label,
50
+ value,
51
+ collections: field.collections
52
+ });
53
+ else if (field.kind === "link" && Schema.is(LinkTarget)(value) && value.kind === "document") found.push({
54
+ path: fieldPath(path),
55
+ label,
56
+ value: value.documentId
57
+ });
58
+ }
59
+ return found;
60
+ }
61
+ /** Retention is strict about asset identity, but does not require valid image framing. */
62
+ function mediaSelections(value, fields) {
63
+ if (!Schema.is(Schema.JsonObject)(value)) return [];
64
+ const found = [];
65
+ for (const location of walk(fields, value)) {
66
+ if (location.kind !== "field" || location.value === void 0 || location.value === "") continue;
67
+ const { field, value: selection } = location;
68
+ if (field.kind === "image") {
69
+ if (!Schema.is(ImageReference)(selection)) throw new Error("Structured image needs a valid asset ID.");
70
+ found.push({
71
+ kind: "media",
72
+ mediaId: selection.mediaId,
73
+ mediaKind: "image"
74
+ });
75
+ } else if (field.kind === "media") {
76
+ if (!Schema.is(MediaSelection)(selection)) throw new Error("Structured media needs a valid asset ID and kind.");
77
+ found.push(selection);
78
+ }
79
+ }
80
+ return found;
81
+ }
82
+ function copyFieldValues(fields, input, nextId) {
83
+ const copied = structuredClone(input);
84
+ for (const location of walk(fields, copied)) if (location.kind === "object" && location.listItem) Object.assign(location.values, { id: nextId() });
85
+ return copied;
86
+ }
87
+ //#endregion
88
+ //#region ../model/src/internal/forms/structure.ts
89
+ const DraftFormField = Schema.Struct({
90
+ id: Schema.NonEmptyString,
91
+ label: Schema.NonEmptyString,
92
+ answerKey: Schema.optionalKey(Schema.NonEmptyString),
93
+ type: FormFieldType,
94
+ help: Schema.optionalKey(Schema.String),
95
+ required: Schema.optionalKey(Schema.Boolean),
96
+ minLength: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),
97
+ maxLength: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),
98
+ min: Schema.optionalKey(Schema.Finite),
99
+ max: Schema.optionalKey(Schema.Finite),
100
+ options: Schema.optionalKey(Schema.Array(FormOption))
101
+ });
102
+ const DraftFormSteps = Schema.Array(Schema.Struct({
103
+ id: Schema.NonEmptyString,
104
+ title: Schema.NonEmptyString,
105
+ fields: Schema.Array(DraftFormField).check(Schema.isMinLength(1), Schema.isMaxLength(100))
106
+ })).check(Schema.isMinLength(1), Schema.isMaxLength(20));
107
+ function formRevision(name, capabilities, steps) {
108
+ return revisionSource(name, capabilities, steps);
109
+ }
110
+ function formStructureIssues(input, capabilities, name) {
111
+ const parsed = parseFormSteps(input, capabilities, name);
112
+ return Result.isFailure(parsed) ? parsed.failure : [];
113
+ }
114
+ function parseFormSteps(input, capabilities, name) {
115
+ const decoded = Schema.decodeUnknownResult(DraftFormSteps)(input, { onExcessProperty: "error" });
116
+ if (Result.isFailure(decoded)) return Result.fail([studioErrorReason("errors.form.structure")]);
117
+ const issues = [];
118
+ if (new TextEncoder().encode(revisionSource(name, capabilities, decoded.success)).byteLength > 6e4) issues.push(studioErrorReason("errors.form.size"));
119
+ const ids = /* @__PURE__ */ new Set();
120
+ const keys = /* @__PURE__ */ new Set();
121
+ for (const step of decoded.success) {
122
+ if (ids.has(step.id)) issues.push(studioErrorReason("errors.form.identity"));
123
+ ids.add(step.id);
124
+ for (const field of step.fields) {
125
+ if (ids.has(field.id)) issues.push(studioErrorReason("errors.form.identity"));
126
+ ids.add(field.id);
127
+ const key = field.answerKey ?? field.id;
128
+ if (keys.has(key)) issues.push(studioErrorReason("errors.form.answerKeys"));
129
+ keys.add(key);
130
+ if ([
131
+ "_form",
132
+ "__proto__",
133
+ "constructor",
134
+ "prototype"
135
+ ].includes(key)) issues.push(studioErrorReason("errors.form.answerKeyReserved"));
136
+ if (!capabilities.fieldTypes.includes(field.type)) issues.push(studioErrorReason("errors.form.typeUnavailable", { label: field.label }));
137
+ for (const rule of [
138
+ "required",
139
+ "minLength",
140
+ "maxLength",
141
+ "min",
142
+ "max"
143
+ ]) if (field[rule] !== void 0 && !capabilities.rules.includes(rule)) issues.push(studioErrorReason(`errors.form.${rule}Unavailable`, { label: field.label }));
144
+ if (field.type !== "text" && field.type !== "email" && field.type !== "textarea") {
145
+ if (field.minLength !== void 0 || field.maxLength !== void 0) issues.push(studioErrorReason("errors.form.textLimits", { label: field.label }));
146
+ }
147
+ if (field.type !== "number" && (field.min !== void 0 || field.max !== void 0)) issues.push(studioErrorReason("errors.form.numberLimits", { label: field.label }));
148
+ if (field.min !== void 0 && field.max !== void 0 && field.min > field.max) issues.push(studioErrorReason("errors.form.range", { label: field.label }));
149
+ if (field.minLength !== void 0 && field.maxLength !== void 0 && field.minLength > field.maxLength) issues.push(studioErrorReason("errors.form.lengthRange", { label: field.label }));
150
+ if (field.type === "select") {
151
+ if (!field.options?.length || new Set(field.options.map((option) => option.id)).size !== field.options.length) issues.push(studioErrorReason("errors.form.options", { label: field.label }));
152
+ } else if (field.options?.length) issues.push(studioErrorReason("errors.form.selectOptions", { label: field.label }));
153
+ }
154
+ }
155
+ if (issues.length) return Result.fail(issues);
156
+ return Schema.decodeUnknownResult(FormSteps)(decoded.success, { onExcessProperty: "error" }).pipe(Result.mapError(() => [studioErrorReason("errors.form.structure")]));
157
+ }
158
+ function revisionSource(name, capabilities, steps) {
159
+ return JSON.stringify([
160
+ name,
161
+ capabilities.fieldTypes,
162
+ capabilities.rules,
163
+ steps
164
+ ]);
165
+ }
166
+ //#endregion
167
+ //#region ../model/src/internal/blocks/seed.ts
168
+ /** One editable block with named content regions and stable identity. */
169
+ function seedBlock(block) {
170
+ const props = block.form ? { steps: seedFormSteps(block.form) } : initialObjectValues(block.fields);
171
+ return {
172
+ type: "cmsBlock",
173
+ attrs: {
174
+ id: crypto.randomUUID(),
175
+ name: block.name,
176
+ props
177
+ },
178
+ content: block.slots.filter((slot) => slot.required || slot.initial !== void 0).map(seedSlot)
179
+ };
180
+ }
181
+ /** One named content region, also used when an optional region is added later. */
182
+ function seedSlot(slot) {
183
+ return {
184
+ type: "cmsSlot",
185
+ attrs: { name: slot.name },
186
+ content: slot.initial?.length ? structuredClone(slot.initial) : slot.kind === "blocks" ? [] : [{ type: "paragraph" }]
187
+ };
188
+ }
189
+ function seedFormSteps(capabilities) {
190
+ const firstType = capabilities.fieldTypes[0];
191
+ const question = firstType === "select" ? {
192
+ id: crypto.randomUUID(),
193
+ label: "Your answer",
194
+ type: firstType,
195
+ options: [{
196
+ id: crypto.randomUUID(),
197
+ label: "First choice"
198
+ }]
199
+ } : {
200
+ id: crypto.randomUUID(),
201
+ label: "Your answer",
202
+ type: firstType ?? "text"
203
+ };
204
+ return [{
205
+ id: crypto.randomUUID(),
206
+ title: "Your details",
207
+ fields: [question]
208
+ }];
209
+ }
210
+ //#endregion
211
+ //#region ../model/src/internal/blocks/validation.ts
212
+ function allowedBlocks(blocks, policy) {
213
+ if (!policy) return blocks;
214
+ return blocks.filter((block) => policy.blocks?.includes(block.name) || block.group && policy.groups?.includes(block.group));
215
+ }
216
+ function validateBlockConfiguration(blocks, collections) {
217
+ const issues = [];
218
+ const names = /* @__PURE__ */ new Set();
219
+ for (const block of blocks) {
220
+ if (names.has(block.name)) issues.push(`Block "${block.name}" is configured twice.`);
221
+ names.add(block.name);
222
+ issues.push(...validateObjectDefinition(block.fields, block.label));
223
+ if (block.form) {
224
+ if (block.fields.length || block.slots.length) issues.push(`Form block "${block.name}" cannot define ordinary fields or content regions.`);
225
+ if (new Set(block.form.fieldTypes).size !== block.form.fieldTypes.length) issues.push(`Form block "${block.name}" repeats a question type.`);
226
+ if (new Set(block.form.rules).size !== block.form.rules.length) issues.push(`Form block "${block.name}" repeats a rule.`);
227
+ }
228
+ const slots = /* @__PURE__ */ new Set();
229
+ for (const slot of block.slots) {
230
+ if (slots.has(slot.name)) issues.push(`Block "${block.name}" repeats slot "${slot.name}".`);
231
+ slots.add(slot.name);
232
+ if (slot.kind === "text" || slot.kind === "inline-text" || slot.kind === "rich-text") {
233
+ if (slot.blocks || slot.groups) issues.push(`Slot "${block.name}.${slot.name}" cannot select blocks.`);
234
+ } else if (slot.features) issues.push(`Slot "${block.name}.${slot.name}" cannot select text features.`);
235
+ if (slot.kind === "text" && slot.features?.length) issues.push(`Text slot "${block.name}.${slot.name}" must be plain text.`);
236
+ if (slot.kind === "inline-text" && slot.features?.includes("bullet-list")) issues.push(`Inline text slot "${block.name}.${slot.name}" cannot allow lists.`);
237
+ issues.push(...selectorIssues(slot, blocks, `slot "${block.name}.${slot.name}"`));
238
+ }
239
+ try {
240
+ const initial = checkedBody({
241
+ type: "doc",
242
+ content: [seedBlock(block)]
243
+ });
244
+ issues.push(...bodyBlockIssues(initial, blocks, void 0, "working").map((issue) => `Block "${block.name}" initial content: ${issue}`));
245
+ } catch (cause) {
246
+ issues.push(`Block "${block.name}" initial content is invalid: ${cause instanceof Error ? cause.message : String(cause)}`);
247
+ }
248
+ }
249
+ for (const collection of collections) if (collection.body) issues.push(...selectorIssues(collection.body, blocks, `collection "${collection.collection}"`));
250
+ return issues;
251
+ }
252
+ function selectorIssues(selector, blocks, owner) {
253
+ const issues = [];
254
+ for (const name of selector.blocks ?? []) if (!blocks.some((block) => block.name === name)) issues.push(`Unknown block "${name}" in ${owner}.`);
255
+ for (const group of selector.groups ?? []) if (!blocks.some((block) => block.group === group)) issues.push(`Unknown block group "${group}" in ${owner}.`);
256
+ return issues;
257
+ }
258
+ /** Check block identities, properties, content regions, and nested placement against one collection. */
259
+ function inspectBodyBlocks(document, blocks, policy, purpose) {
260
+ const issues = [];
261
+ const permitted = new Set(allowedBlocks(blocks, policy).map((block) => block.name));
262
+ const byName = new Map(blocks.map((block) => [block.name, block]));
263
+ const ids = /* @__PURE__ */ new Set();
264
+ function visit(content, allowed, location) {
265
+ content.forEach((node, _offset, index) => {
266
+ const path = `${location}[${index}]`;
267
+ if (node.type.name === "cmsBlock") visitBlock(node, allowed, path);
268
+ else if (node.type.name === "cmsSlot") issues.push(issue("body.region", { kind: "body" }, `${path} is a content region outside a block.`, { path }));
269
+ else visit(node, allowed, path);
270
+ });
271
+ }
272
+ function visitBlock(node, allowed, path) {
273
+ const name = node.attrs.name;
274
+ const id = node.attrs.id;
275
+ const location = Schema.is(BlockId)(id) ? {
276
+ kind: "block",
277
+ blockId: id,
278
+ path: []
279
+ } : {
280
+ kind: "block",
281
+ path: []
282
+ };
283
+ const problem = (code, message) => {
284
+ const blockName = Schema.is(Schema.String)(name) ? name : "";
285
+ const label = byName.get(blockName)?.label;
286
+ return issue(code, location, message, {
287
+ name: blockName,
288
+ ...label !== void 0 && { label }
289
+ });
290
+ };
291
+ if (!Schema.is(BlockId)(id) || ids.has(id)) issues.push(problem("block.identity", `${path} needs a unique block ID.`));
292
+ else ids.add(id);
293
+ if (!Schema.is(Schema.String)(name)) {
294
+ issues.push(problem("block.name", `${path} needs a block name.`));
295
+ return;
296
+ }
297
+ const definition = byName.get(name);
298
+ if (!definition) {
299
+ issues.push(problem("block.unknown", `Block "${name}" is not configured.`));
300
+ return;
301
+ }
302
+ if (!allowed.has(name)) issues.push(problem("block.placement", `${definition.label} is not allowed in this content region.`));
303
+ const props = node.attrs.props;
304
+ const form = definition.form;
305
+ if (!Schema.is(Schema.JsonObject)(props)) issues.push(problem("block.properties.type", `${definition.label} properties must be an object.`));
306
+ else if (form) {
307
+ if (purpose === "publish") {
308
+ if (Object.keys(props).some((key) => key !== "steps")) issues.push(problem("block.properties.unknown", `${definition.label} has unknown properties.`));
309
+ issues.push(...formStructureIssues(props.steps, form, definition.name).map((problem) => issue(problem.code, {
310
+ ...location,
311
+ path: ["steps"]
312
+ }, problem.message, {
313
+ fieldTypes: form.fieldTypes,
314
+ rules: form.rules,
315
+ ...problem.details
316
+ })));
317
+ }
318
+ } else issues.push(...inspectObjectValues(definition.fields, props, purpose, definition.label).map((problem) => ({
319
+ ...problem,
320
+ location: {
321
+ ...location,
322
+ path: "path" in problem.location ? problem.location.path ?? [] : []
323
+ }
324
+ })));
325
+ const usedSlots = /* @__PURE__ */ new Set();
326
+ node.forEach((region) => {
327
+ const slotName = region.attrs.name;
328
+ if (!Schema.is(Schema.String)(slotName)) {
329
+ issues.push(problem("block.slot.name", `${definition.label} has an unnamed content region.`));
330
+ return;
331
+ }
332
+ if (usedSlots.has(slotName)) issues.push(issue("block.slot.duplicate", {
333
+ ...location,
334
+ path: ["slots", slotName]
335
+ }, `${definition.label} repeats content region "${slotName}".`, { label: definition.label }));
336
+ usedSlots.add(slotName);
337
+ const slot = definition.slots.find((candidate) => candidate.name === slotName);
338
+ if (!slot) {
339
+ issues.push(issue("block.slot.unknown", {
340
+ ...location,
341
+ path: ["slots", slotName]
342
+ }, `${definition.label} has unknown content region "${slotName}".`, { label: definition.label }));
343
+ return;
344
+ }
345
+ validateSlot(region, slot, `${definition.label} → ${slot.label}`, {
346
+ ...location,
347
+ path: ["slots", slot.name]
348
+ });
349
+ });
350
+ if (purpose === "publish") {
351
+ for (const slot of definition.slots) if (slot.required && !usedSlots.has(slot.name)) issues.push(issue("block.slot.required", {
352
+ ...location,
353
+ path: ["slots", slot.name]
354
+ }, `${definition.label} → ${slot.label} is required.`, { label: `${definition.label} → ${slot.label}` }));
355
+ }
356
+ }
357
+ function validateSlot(region, slot, label, location) {
358
+ const problem = (code, message) => issue(code, location, message, {
359
+ label,
360
+ kind: slot.kind,
361
+ features: slot.features ?? []
362
+ });
363
+ let containsContent = false;
364
+ region.descendants((node) => {
365
+ if (node.type.name === "cmsBlock" || slot.kind === "content" && ["image", "video"].includes(node.type.name)) containsContent = true;
366
+ });
367
+ if (purpose === "publish" && slot.required && !region.textContent.trim() && !containsContent) issues.push(problem("block.slot.required", `${label} is required.`));
368
+ if (slot.kind === "text" || slot.kind === "inline-text" || slot.kind === "rich-text") {
369
+ if (slot.kind !== "rich-text" && region.childCount > 1) issues.push(problem("block.slot.paragraphs", `${label} allows one paragraph.`));
370
+ region.forEach((child) => {
371
+ if (child.type.name === "paragraph") return;
372
+ if (slot.kind === "rich-text" && child.type.name === "bulletList" && slot.features?.includes("bullet-list")) return;
373
+ issues.push(problem("block.slot.content", `${label} allows text only.`));
374
+ });
375
+ region.descendants((child) => {
376
+ if (child.type.name !== "paragraph" && child.type.name !== "text" && child.type.name !== "hardBreak" && !(slot.kind === "rich-text" && slot.features?.includes("bullet-list") && (child.type.name === "bulletList" || child.type.name === "listItem"))) issues.push(problem("block.slot.content", `${label} allows text only.`));
377
+ for (const mark of child.marks) {
378
+ const name = mark.type.name;
379
+ if (slot.kind === "text" || !slot.features?.some((feature) => feature === name)) issues.push(problem("block.slot.format", `${label} does not allow ${mark.type.name} formatting.`));
380
+ }
381
+ });
382
+ return;
383
+ }
384
+ if (slot.kind === "blocks") region.forEach((child) => {
385
+ if (child.type.name !== "cmsBlock") issues.push(problem("block.slot.content", `${label} allows blocks only.`));
386
+ });
387
+ visit(region, new Set(allowedBlocks(blocks, slot.blocks === void 0 && slot.groups === void 0 ? void 0 : slot).map((block) => block.name).filter((name) => permitted.has(name))), label);
388
+ }
389
+ visit(document, permitted, "Body");
390
+ return issues;
391
+ }
392
+ function bodyBlockIssues(...args) {
393
+ return inspectBodyBlocks(...args).map((issue) => issue.message);
394
+ }
395
+ //#endregion
396
+ export { parseFormSteps as a, documentReferences as c, formRevision as i, initialFieldValues as l, inspectBodyBlocks as n, allFieldDefinitions as o, validateBlockConfiguration as r, copyFieldValues as s, bodyBlockIssues as t, mediaSelections as u };
@@ -0,0 +1,224 @@
1
+ import { f as isCalendarDate, h as issue, p as IssuePath } from "./Seo-CjNUtUkj.js";
2
+ import { u as MediaSelection } from "./Media-DSyvd14o.js";
3
+ import { l as DocumentId } from "./Document-CKXMSEf1.js";
4
+ import { n as safeLinkHref, t as LinkTarget } from "./Links-CJYyy7rC.js";
5
+ import { t as AuthoredImage } from "./Image-CJWPLnhP.js";
6
+ import { r as ListItemId } from "./Fields-ioGaMEh9.js";
7
+ import { Predicate, Result, Schema, SchemaIssue } from "effect";
8
+ //#region ../model/src/internal/fields/walk.ts
9
+ /** Traverse only configured containers; shape alone never makes ordinary data a managed reference. */
10
+ function* walk(fields, values, path = [], label = "", listItem = false) {
11
+ yield {
12
+ kind: "object",
13
+ fields,
14
+ values,
15
+ path,
16
+ label,
17
+ listItem
18
+ };
19
+ for (const field of fields) {
20
+ const value = values[field.name];
21
+ const currentPath = [...path, field.name];
22
+ const currentLabel = label ? label + " → " + field.label : field.label;
23
+ yield {
24
+ kind: "field",
25
+ field,
26
+ value,
27
+ path: currentPath,
28
+ label: currentLabel
29
+ };
30
+ if (field.kind === "object" && Schema.is(Schema.JsonObject)(value)) yield* walk(field.fields, value, currentPath, currentLabel);
31
+ else if (field.kind === "list" && Array.isArray(value)) {
32
+ for (const [index, item] of value.entries()) if (Schema.is(Schema.JsonObject)(item)) yield* walk(field.fields, item, [...currentPath, index], currentLabel + " item " + (index + 1), true);
33
+ }
34
+ }
35
+ }
36
+ function fieldPath(path) {
37
+ return path.reduce((result, segment) => result + (Schema.is(Schema.Finite)(segment) ? "[" + segment + "]" : (result ? "." : "") + segment), "");
38
+ }
39
+ //#endregion
40
+ //#region ../model/src/internal/fields/validation.ts
41
+ function validateCollectionDefinition(collection) {
42
+ const issues = definitionIssues(collection.fields, collection.collection, true);
43
+ if (collection.title && !ordered(collection.title.minLength, collection.title.maxLength)) issues.push("Title bounds must be ordered.");
44
+ return issues;
45
+ }
46
+ function validateObjectDefinition(fields, label) {
47
+ return definitionIssues(fields, label);
48
+ }
49
+ function definitionIssues(fields, scope, topLevel = false) {
50
+ const issues = [];
51
+ const names = new Set(topLevel ? ["title"] : ["id"]);
52
+ for (const field of fields) {
53
+ if (names.has(field.name)) issues.push(`${topLevel ? `Collection "${scope}"` : scope} repeats field "${field.name}".`);
54
+ names.add(field.name);
55
+ if (field.kind === "text" || field.kind === "textarea") {
56
+ if (!ordered(field.minLength, field.maxLength)) issues.push(field.label + " bounds must be ordered.");
57
+ } else if (field.kind === "number" && !ordered(field.min, field.max)) issues.push(field.label + " bounds must be ordered.");
58
+ if (field.kind === "select" || field.kind === "multi-select") {
59
+ const values = field.options.map((option) => option.value);
60
+ if (field.kind === "select" && values.length === 0 || new Set(values).size !== values.length) issues.push(`Field "${field.label}" needs unique choices.`);
61
+ }
62
+ if (field.kind === "document" && field.collections) {
63
+ if (field.collections.length === 0) issues.push(`Field "${field.label}" needs an allowed collection.`);
64
+ if (new Set(field.collections).size !== field.collections.length) issues.push(`Field "${field.label}" repeats an allowed collection.`);
65
+ }
66
+ if (field.kind === "object" || field.kind === "list") {
67
+ if (field.fields.length === 0) issues.push(`Field "${field.label}" needs child fields.`);
68
+ issues.push(...definitionIssues(field.fields, field.label));
69
+ } else if ("defaultValue" in field && field.defaultValue !== void 0) {
70
+ const issue = fieldIssues({
71
+ ...field,
72
+ required: field.kind === "link" && field.required
73
+ }, field.defaultValue, "publish")[0];
74
+ if (issue) issues.push(`Invalid default for ${field.label}: ${issue.message}`);
75
+ }
76
+ }
77
+ return issues;
78
+ }
79
+ function inspectFieldValues(collection, values, purpose) {
80
+ const issues = [];
81
+ const title = values.title;
82
+ if (!Schema.is(Schema.String)(title) || !title.trim()) issues.push(issue("field.required", {
83
+ kind: "field",
84
+ path: ["title"]
85
+ }, "Document title is required."));
86
+ else if (collection.title) issues.push(...fieldIssues({
87
+ name: "title",
88
+ kind: "text",
89
+ label: "Title",
90
+ required: true,
91
+ ...collection.title
92
+ }, title, purpose));
93
+ issues.push(...objectIssues(collection.fields, values, purpose, collection.label, true));
94
+ return issues;
95
+ }
96
+ function ordered(min, max) {
97
+ return min === void 0 || max === void 0 || min <= max;
98
+ }
99
+ function objectIssues(fields, values, purpose, label, topLevel = false) {
100
+ const issues = [];
101
+ for (const location of walk(fields, values, [], topLevel ? "" : label)) {
102
+ if (location.kind === "field") {
103
+ issues.push(...fieldIssues(location.field, location.value, purpose, location.path, location.label));
104
+ continue;
105
+ }
106
+ const root = topLevel && location.path.length === 0;
107
+ const names = /* @__PURE__ */ new Set([...root ? ["title"] : [], ...location.fields.map((field) => field.name)]);
108
+ for (const name of Object.keys(location.values)) {
109
+ if (names.has(name) || location.listItem && name === "id") continue;
110
+ issues.push(issue("field.unknown", {
111
+ kind: "field",
112
+ path: [...location.path, name]
113
+ }, root ? "Field \"" + name + "\" is not configured for " + label + "." : location.label + " contains unconfigured field \"" + name + "\"."));
114
+ }
115
+ }
116
+ return issues;
117
+ }
118
+ function fieldIssues(field, value, purpose, path = [field.name], label = field.label) {
119
+ const details = field.kind === "select" || field.kind === "multi-select" ? {
120
+ kind: field.kind,
121
+ label: field.label,
122
+ choices: field.options.map((option) => option.value).sort()
123
+ } : {
124
+ kind: field.kind,
125
+ label: field.label,
126
+ ...field.kind === "media" && { mediaKind: field.mediaKind },
127
+ ...(field.kind === "text" || field.kind === "textarea") && {
128
+ ...field.minLength !== void 0 && { minLength: field.minLength },
129
+ ...field.maxLength !== void 0 && { maxLength: field.maxLength }
130
+ },
131
+ ...field.kind === "number" && {
132
+ ...field.integer !== void 0 && { integer: field.integer },
133
+ ...field.min !== void 0 && { min: field.min },
134
+ ...field.max !== void 0 && { max: field.max }
135
+ }
136
+ };
137
+ const problem = (code, message, at = path) => issue(code, {
138
+ kind: "field",
139
+ path: at
140
+ }, message, details);
141
+ if (value === void 0) return field.required && purpose === "publish" ? [problem("field.required", `${label} is required.`)] : [];
142
+ if (field.kind === "object") {
143
+ if (!Schema.is(Schema.JsonObject)(value)) return [problem("field.type", `${label} must be an object.`)];
144
+ return [];
145
+ }
146
+ if (field.kind === "list") {
147
+ if (!Array.isArray(value)) return [problem("field.type", `${label} must be a list.`)];
148
+ if (field.required && purpose === "publish" && value.length === 0) return [problem("field.required", `${label} is required.`)];
149
+ const issues = [];
150
+ const ids = /* @__PURE__ */ new Set();
151
+ value.forEach((item, index) => {
152
+ const itemLabel = `${label} item ${index + 1}`;
153
+ if (!Schema.is(Schema.JsonObject)(item)) {
154
+ issues.push(problem("field.type", `${itemLabel} must be an object.`, [...path, index]));
155
+ return;
156
+ }
157
+ if (!Schema.is(ListItemId)(item.id) || ids.has(item.id)) issues.push(problem("field.identity", `${itemLabel} needs a unique ID.`, [...path, index]));
158
+ else ids.add(item.id);
159
+ });
160
+ return issues;
161
+ }
162
+ if (field.kind === "multi-select") {
163
+ if (!Array.isArray(value)) return [problem("field.type", `${label} must be a list of text.`)];
164
+ const values = value.filter(Schema.is(Schema.String));
165
+ if (values.length !== value.length) return [problem("field.type", `${label} must be a list of text.`)];
166
+ if (field.required && purpose === "publish" && values.length === 0) return [problem("field.required", `${label} is required.`)];
167
+ if (values.some((item) => !item.trim()) || new Set(values).size !== values.length) return [problem("field.format", `${label} needs unique, nonempty values.`)];
168
+ if (field.options.length && values.some((item) => !field.options.some((option) => option.value === item))) return [problem("field.choice", `${label} must use available choices.`)];
169
+ return [];
170
+ }
171
+ if (field.kind === "document") {
172
+ if (value === "" && (purpose === "working" || !field.required)) return [];
173
+ return Schema.is(DocumentId)(value) ? [] : [problem("field.format", `${label} needs a valid document.`)];
174
+ }
175
+ if (field.kind === "link") {
176
+ if (!Schema.is(LinkTarget)(value)) return [problem("field.format", `${label} needs a valid link.`)];
177
+ if (value.kind === "url") {
178
+ if (!value.href) return field.required && purpose === "publish" ? [problem("field.required", `${label} is required.`)] : [];
179
+ return purpose === "working" || safeLinkHref(value.href) ? [] : [problem("field.format", `${label} needs a valid link.`)];
180
+ }
181
+ return value.path.startsWith("/") && safeLinkHref(value.path) ? [] : [problem("field.format", `${label} needs a valid page route.`)];
182
+ }
183
+ if (field.kind === "media") {
184
+ if (value === "" && (purpose === "working" || !field.required)) return [];
185
+ return Schema.is(MediaSelection)(value) && value.mediaKind === field.mediaKind ? [] : [problem("field.format", `${label} needs a valid ${field.mediaKind}.`)];
186
+ }
187
+ if (field.kind === "image") {
188
+ if (value === "" && (purpose === "working" || !field.required)) return [];
189
+ const result = Schema.decodeUnknownResult(AuthoredImage, { errors: "all" })(value);
190
+ if (Result.isSuccess(result)) return [];
191
+ return SchemaIssue.makeFormatterStandardSchemaV1()(result.failure.issue).issues.map((failure) => {
192
+ const suffix = failure.path?.map((segment) => Predicate.isObject(segment) ? segment.key : segment) ?? [];
193
+ return problem("field.format", label + " needs a valid image.", [...path, ...Schema.is(IssuePath)(suffix) ? suffix : []]);
194
+ });
195
+ }
196
+ if (field.kind === "number") {
197
+ if (!Schema.is(Schema.Finite)(value)) return [problem("field.type", label + " must be a number.")];
198
+ if (purpose === "publish") {
199
+ if (field.integer && !Number.isSafeInteger(value)) return [problem("field.integer", label + ": Needs a whole number.")];
200
+ if (field.min !== void 0 && value < field.min) return [problem("field.minimum", label + ": Needs a value of at least " + field.min + ".")];
201
+ if (field.max !== void 0 && value > field.max) return [problem("field.maximum", label + ": Needs a value of at most " + field.max + ".")];
202
+ }
203
+ return [];
204
+ }
205
+ if (field.kind === "boolean") return Schema.is(Schema.Boolean)(value) ? [] : [problem("field.type", `${label} must be a toggle.`)];
206
+ if (!Schema.is(Schema.String)(value)) return [problem("field.type", `${label} must be text.`)];
207
+ if (purpose === "publish" && field.required && !value.trim()) return [problem("field.required", `${label} is required.`)];
208
+ if (purpose === "publish" && (field.kind === "text" || field.kind === "textarea")) {
209
+ if (field.minLength !== void 0 && value.trim().length < field.minLength) return [problem("field.minimumLength", label + ": Needs at least " + field.minLength + " characters.")];
210
+ if (field.maxLength !== void 0 && value.length > field.maxLength) return [problem("field.maximumLength", label + ": Needs at most " + field.maxLength + " characters.")];
211
+ }
212
+ if (field.kind === "select" && value && !field.options.some((option) => option.value === value)) return [problem("field.choice", `${label} must use an available choice.`)];
213
+ if (field.kind === "icon" && value && !/^i-lucide-[a-z0-9-]+$/u.test(value)) return [problem("field.format", `${label} needs a Lucide icon.`)];
214
+ if (field.kind === "date" && value && !isCalendarDate(value)) return [problem("field.format", `${label} needs a valid date.`)];
215
+ return [];
216
+ }
217
+ function inspectObjectValues(fields, values, purpose, label) {
218
+ return objectIssues(fields, values, purpose, label);
219
+ }
220
+ function validateFieldValues(collection, values, purpose) {
221
+ return inspectFieldValues(collection, values, purpose).map((issue) => issue.message);
222
+ }
223
+ //#endregion
224
+ export { validateObjectDefinition as a, validateFieldValues as i, inspectObjectValues as n, fieldPath as o, validateCollectionDefinition as r, walk as s, inspectFieldValues as t };