@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.
- package/LICENSE +18 -10
- package/README.md +59 -401
- package/drizzle/20261003215543_initial/migration.sql +251 -0
- package/drizzle/20261003215543_initial/snapshot.json +1941 -0
- package/package.json +75 -71
- package/src/Authoring.d.ts +41 -49
- package/src/Authoring.js +1 -1
- package/src/Blocks-BrxSemnd.js +40 -0
- package/src/Client.d.ts +8186 -0
- package/src/Client.js +41 -0
- package/src/Collections.d.ts +142 -0
- package/src/Collections.js +142 -0
- package/src/Config-CMiwciub.js +130 -0
- package/src/Config.d.ts +172 -0
- package/src/Config.js +2 -0
- package/src/Configuration-Dk2k3OIc.js +73 -0
- package/src/DataTransfer-BmECvPHB.js +488 -0
- package/src/Database-DSsNCGft.d.ts +3 -0
- package/src/Delivery.d.ts +28 -0
- package/src/Delivery.js +7 -0
- package/src/Document-CKXMSEf1.js +293 -0
- package/src/Document-TgwYKJZM.d.ts +220 -0
- package/src/DocumentRenderer-Wz2xaNyf.js +394 -0
- package/src/EditorSchema-wrDv-id6.js +296 -0
- package/src/Fields-BegSgYhj.d.ts +166 -0
- package/src/Fields-ioGaMEh9.js +130 -0
- package/src/Forms-BuKAXQxr.d.ts +203 -0
- package/src/Forms.d.ts +48 -11
- package/src/Forms.js +342 -7
- package/src/I18n-Ckf9h0rC.js +154 -0
- package/src/I18n.d.ts +45 -2
- package/src/I18n.js +2 -1
- package/src/Image-CJWPLnhP.js +110 -0
- package/src/Links-CJYyy7rC.js +28 -0
- package/src/Links-Dx1yOni8.d.ts +28 -0
- package/src/Locales-Ch7a5xuA.js +67 -0
- package/src/Locales-jwbmJaOp.d.ts +43 -0
- package/src/Locales.d.ts +3 -0
- package/src/Locales.js +3 -0
- package/src/Media-BQ0uL4w7.d.ts +15 -0
- package/src/Media-DSyvd14o.js +87 -0
- package/src/Module.d.ts +2 -10
- package/src/Module.js +1039 -162
- package/src/Operations.d.ts +57 -0
- package/src/Operations.js +263 -0
- package/src/People-DvNZauWw.js +69 -0
- package/src/PreviewFocus-C_EelZO5.js +104 -0
- package/src/Query-C0kGJF5_.d.ts +261 -0
- package/src/RevisionPreview-IVwbJ9Wy.js +133 -0
- package/src/Routes-BaZvm2LE.js +126 -0
- package/src/Routes-DM1rRp3r.d.ts +15 -0
- package/src/S3MediaObjects-y-WacEi9.js +193 -0
- package/src/Seo-BcpqxoAs.d.ts +57 -0
- package/src/Seo-CjNUtUkj.js +254 -0
- package/src/StudioApi-CXLwwocX.js +833 -0
- package/src/StudioErrors-T5zLGQ1M.js +117 -0
- package/src/StudioErrors-kq-E44lQ.d.ts +104 -0
- package/src/StudioServer.d.ts +20 -0
- package/src/StudioServer.js +34 -0
- package/src/answers-DcTg0Xv2.js +41 -0
- package/src/cli.js +681 -187
- package/src/contracts-rprW3ZOB.js +130 -0
- package/src/forms-3xuf0Ym7.d.ts +206 -0
- package/src/localeConfiguration-BPbkLi7-.js +32 -0
- package/src/localeContext-DhF3SPvM.js +59 -0
- package/src/locales-6OD4XGIZ.js +12 -0
- package/src/nuxtDelivery-BYX_Cddb.js +466 -0
- package/src/plugin-DTYuDaQu.js +7171 -0
- package/src/previewContext-dt3ZUh-w.js +4 -0
- package/src/previewRegions-CXjk5cbP.js +145 -0
- package/src/previewSource-fb-q3ESM.js +144 -0
- package/src/rendering-D9LVeEKX.js +47 -0
- package/src/rolldown-runtime-8H4AJuhK.js +14 -0
- package/src/runtime/CmsImage.js +38 -0
- package/src/runtime/DocumentPage.vue +10 -0
- package/src/runtime/DocumentPageContent.js +48 -0
- package/src/runtime/DocumentRenderer.d.ts +129 -0
- package/src/runtime/DocumentRenderer.js +2 -0
- package/src/runtime/api.js +48 -6
- package/src/runtime/delivery/useCmsDocument.js +2 -0
- package/src/runtime/delivery/useCmsDocumentQuery.js +2 -0
- package/src/runtime/delivery/useCmsDocumentSeo.js +2 -114
- package/src/runtime/delivery/useCmsLocale.js +10 -0
- package/src/runtime/plugin.js +2 -40
- package/src/runtime/preview.css +85 -0
- package/src/runtime/preview.js +277 -0
- package/src/runtime/previewSource.js +82 -0
- package/src/runtime/revisionPrivacy.js +13 -0
- package/src/runtime/studio.js +10 -0
- package/src/runtime/studioIcons.js +36 -0
- package/src/validation-3pggwcnm.js +396 -0
- package/src/validation-DpUwPC8Y.js +224 -0
- package/studio/THIRD-PARTY-LICENSES.md +2406 -0
- package/studio/chunks/AccountPage-DL3DitDM.js +288 -0
- package/studio/chunks/AccountPage-DL3DitDM.js.br +0 -0
- package/studio/chunks/AccountPage-DL3DitDM.js.gz +0 -0
- package/studio/chunks/ActivityPage-CLqVUqTh.js +584 -0
- package/studio/chunks/ActivityPage-CLqVUqTh.js.br +0 -0
- package/studio/chunks/ActivityPage-CLqVUqTh.js.gz +0 -0
- package/studio/chunks/Alert-D0D24z_a.js +335 -0
- package/studio/chunks/Alert-D0D24z_a.js.br +0 -0
- package/studio/chunks/Alert-D0D24z_a.js.gz +0 -0
- package/studio/chunks/Badge-BBFs88TI.js +346 -0
- package/studio/chunks/Badge-BBFs88TI.js.br +0 -0
- package/studio/chunks/Badge-BBFs88TI.js.gz +0 -0
- package/studio/chunks/Button-BT3ztSPx.js +14319 -0
- package/studio/chunks/Button-BT3ztSPx.js.br +0 -0
- package/studio/chunks/Button-BT3ztSPx.js.gz +0 -0
- package/studio/chunks/Collapsible-CKnEYIlp.js +246 -0
- package/studio/chunks/Collapsible-CKnEYIlp.js.br +0 -0
- package/studio/chunks/Collapsible-CKnEYIlp.js.gz +0 -0
- package/studio/chunks/ContentInventory-D7nsFA6U.js +1745 -0
- package/studio/chunks/ContentInventory-D7nsFA6U.js.br +0 -0
- package/studio/chunks/ContentInventory-D7nsFA6U.js.gz +0 -0
- package/studio/chunks/ContentPage-DCxt6BeD.js +18 -0
- package/studio/chunks/ContentPage-DCxt6BeD.js.br +0 -0
- package/studio/chunks/ContentPage-DCxt6BeD.js.gz +0 -0
- package/studio/chunks/DashboardSearch-DjyMjJwF.js +2413 -0
- package/studio/chunks/DashboardSearch-DjyMjJwF.js.br +0 -0
- package/studio/chunks/DashboardSearch-DjyMjJwF.js.gz +0 -0
- package/studio/chunks/DocumentLocaleMenu-0EkkOr6_.js +26063 -0
- package/studio/chunks/DocumentLocaleMenu-0EkkOr6_.js.br +0 -0
- package/studio/chunks/DocumentLocaleMenu-0EkkOr6_.js.gz +0 -0
- package/studio/chunks/DropdownMenu-CA9fB0uZ.js +4400 -0
- package/studio/chunks/DropdownMenu-CA9fB0uZ.js.br +0 -0
- package/studio/chunks/DropdownMenu-CA9fB0uZ.js.gz +0 -0
- package/studio/chunks/EditorPage-D_PAYEE4.js +7799 -0
- package/studio/chunks/EditorPage-D_PAYEE4.js.br +0 -0
- package/studio/chunks/EditorPage-D_PAYEE4.js.gz +0 -0
- package/studio/chunks/FormField-CgM6l2Yn.js +198 -0
- package/studio/chunks/FormField-CgM6l2Yn.js.br +0 -0
- package/studio/chunks/FormField-CgM6l2Yn.js.gz +0 -0
- package/studio/chunks/HelpPage-C-vrFcT_.js +552 -0
- package/studio/chunks/HelpPage-C-vrFcT_.js.br +0 -0
- package/studio/chunks/HelpPage-C-vrFcT_.js.gz +0 -0
- package/studio/chunks/Kbd-Ot7TIhVZ.js +271 -0
- package/studio/chunks/Kbd-Ot7TIhVZ.js.br +0 -0
- package/studio/chunks/Kbd-Ot7TIhVZ.js.gz +0 -0
- package/studio/chunks/MediaFolderDialog-DYu-eu-q.js +101 -0
- package/studio/chunks/MediaFolderDialog-DYu-eu-q.js.br +0 -0
- package/studio/chunks/MediaFolderDialog-DYu-eu-q.js.gz +0 -0
- package/studio/chunks/MediaPage-D-jaWtdl.js +923 -0
- package/studio/chunks/MediaPage-D-jaWtdl.js.br +0 -0
- package/studio/chunks/MediaPage-D-jaWtdl.js.gz +0 -0
- package/studio/chunks/MediaPicker-BZs2wUFz.js +837 -0
- package/studio/chunks/MediaPicker-BZs2wUFz.js.br +0 -0
- package/studio/chunks/MediaPicker-BZs2wUFz.js.gz +0 -0
- package/studio/chunks/MediaUploadPanel-C7Kyg6aR.js +1173 -0
- package/studio/chunks/MediaUploadPanel-C7Kyg6aR.js.br +0 -0
- package/studio/chunks/MediaUploadPanel-C7Kyg6aR.js.gz +0 -0
- package/studio/chunks/Modal-D6hSvxHd.js +265 -0
- package/studio/chunks/Modal-D6hSvxHd.js.br +0 -0
- package/studio/chunks/Modal-D6hSvxHd.js.gz +0 -0
- package/studio/chunks/NewDocumentDialog-C8B6_r3J.js +277 -0
- package/studio/chunks/NewDocumentDialog-C8B6_r3J.js.br +0 -0
- package/studio/chunks/NewDocumentDialog-C8B6_r3J.js.gz +0 -0
- package/studio/chunks/Pagination-D9BSo5H2.js +573 -0
- package/studio/chunks/Pagination-D9BSo5H2.js.br +0 -0
- package/studio/chunks/Pagination-D9BSo5H2.js.gz +0 -0
- package/studio/chunks/PeoplePage-CWIXitBD.js +783 -0
- package/studio/chunks/PeoplePage-CWIXitBD.js.br +0 -0
- package/studio/chunks/PeoplePage-CWIXitBD.js.gz +0 -0
- package/studio/chunks/Popover-B63bkTMS.js +128 -0
- package/studio/chunks/Popover-B63bkTMS.js.br +0 -0
- package/studio/chunks/Popover-B63bkTMS.js.gz +0 -0
- package/studio/chunks/PublicationActionDialog-Cm_P0C3I.js +255 -0
- package/studio/chunks/PublicationActionDialog-Cm_P0C3I.js.br +0 -0
- package/studio/chunks/PublicationActionDialog-Cm_P0C3I.js.gz +0 -0
- package/studio/chunks/Routes-DLYHmulE.js +102 -0
- package/studio/chunks/Routes-DLYHmulE.js.br +0 -0
- package/studio/chunks/Routes-DLYHmulE.js.gz +0 -0
- package/studio/chunks/RovingFocusItem-QZNg-wWF.js +95 -0
- package/studio/chunks/RovingFocusItem-QZNg-wWF.js.br +0 -0
- package/studio/chunks/RovingFocusItem-QZNg-wWF.js.gz +0 -0
- package/studio/chunks/ScheduledPage-C0hqrkr5.js +332 -0
- package/studio/chunks/ScheduledPage-C0hqrkr5.js.br +0 -0
- package/studio/chunks/ScheduledPage-C0hqrkr5.js.gz +0 -0
- package/studio/chunks/Search-BEgCe9Aj.js +14646 -0
- package/studio/chunks/Search-BEgCe9Aj.js.br +0 -0
- package/studio/chunks/Search-BEgCe9Aj.js.gz +0 -0
- package/studio/chunks/Select-B50WZMW-.js +2145 -0
- package/studio/chunks/Select-B50WZMW-.js.br +0 -0
- package/studio/chunks/Select-B50WZMW-.js.gz +0 -0
- package/studio/chunks/SelectMenu-DSweWGMz.js +2109 -0
- package/studio/chunks/SelectMenu-DSweWGMz.js.br +0 -0
- package/studio/chunks/SelectMenu-DSweWGMz.js.gz +0 -0
- package/studio/chunks/SeoPage-CNNxGe4h.js +846 -0
- package/studio/chunks/SeoPage-CNNxGe4h.js.br +0 -0
- package/studio/chunks/SeoPage-CNNxGe4h.js.gz +0 -0
- package/studio/chunks/Skeleton-COz8dcrw.js +39 -0
- package/studio/chunks/Skeleton-COz8dcrw.js.br +2 -0
- package/studio/chunks/Skeleton-COz8dcrw.js.gz +0 -0
- package/studio/chunks/Slideover-QMMHAAys.js +289 -0
- package/studio/chunks/Slideover-QMMHAAys.js.br +0 -0
- package/studio/chunks/Slideover-QMMHAAys.js.gz +0 -0
- package/studio/chunks/StudioPage-ngEIDr5d.js +80 -0
- package/studio/chunks/StudioPage-ngEIDr5d.js.br +0 -0
- package/studio/chunks/StudioPage-ngEIDr5d.js.gz +0 -0
- package/studio/chunks/StudioPageToolbar-BwHnqyr6.js +2524 -0
- package/studio/chunks/StudioPageToolbar-BwHnqyr6.js.br +0 -0
- package/studio/chunks/StudioPageToolbar-BwHnqyr6.js.gz +0 -0
- package/studio/chunks/Switch-qKl1aDn7.js +484 -0
- package/studio/chunks/Switch-qKl1aDn7.js.br +0 -0
- package/studio/chunks/Switch-qKl1aDn7.js.gz +0 -0
- package/studio/chunks/ToolPage-DxoVAJVk.js +29 -0
- package/studio/chunks/ToolPage-DxoVAJVk.js.br +0 -0
- package/studio/chunks/ToolPage-DxoVAJVk.js.gz +0 -0
- package/studio/chunks/Tooltip-Bu15m_DB.js +693 -0
- package/studio/chunks/Tooltip-Bu15m_DB.js.br +0 -0
- package/studio/chunks/Tooltip-Bu15m_DB.js.gz +0 -0
- package/studio/chunks/TrashPage-lhqLLdoG.js +12 -0
- package/studio/chunks/TrashPage-lhqLLdoG.js.br +0 -0
- package/studio/chunks/TrashPage-lhqLLdoG.js.gz +0 -0
- package/studio/chunks/VersionsPage-Cqy6UAp9.js +2349 -0
- package/studio/chunks/VersionsPage-Cqy6UAp9.js.br +0 -0
- package/studio/chunks/VersionsPage-Cqy6UAp9.js.gz +0 -0
- package/studio/chunks/VisuallyHiddenInput-Cu8hQLRf.js +113 -0
- package/studio/chunks/VisuallyHiddenInput-Cu8hQLRf.js.br +0 -0
- package/studio/chunks/VisuallyHiddenInput-Cu8hQLRf.js.gz +0 -0
- package/studio/chunks/arrays-CUJkmV4I.js +10 -0
- package/studio/chunks/arrays-CUJkmV4I.js.br +0 -0
- package/studio/chunks/arrays-CUJkmV4I.js.gz +0 -0
- package/studio/chunks/base-DkTekJe8.js +213 -0
- package/studio/chunks/base-DkTekJe8.js.br +0 -0
- package/studio/chunks/base-DkTekJe8.js.gz +0 -0
- package/studio/chunks/content-DUGl3N4d.js +6012 -0
- package/studio/chunks/content-DUGl3N4d.js.br +0 -0
- package/studio/chunks/content-DUGl3N4d.js.gz +0 -0
- package/studio/chunks/destinations-DPIQVQa6.js +227 -0
- package/studio/chunks/destinations-DPIQVQa6.js.br +0 -0
- package/studio/chunks/destinations-DPIQVQa6.js.gz +0 -0
- package/studio/chunks/en-073cjKW4.js +152 -0
- package/studio/chunks/en-073cjKW4.js.br +0 -0
- package/studio/chunks/en-073cjKW4.js.gz +0 -0
- package/studio/chunks/en-Bn8mxPuf.js +134 -0
- package/studio/chunks/en-Bn8mxPuf.js.br +0 -0
- package/studio/chunks/en-Bn8mxPuf.js.gz +0 -0
- package/studio/chunks/en-C9OiaUDZ.js +251 -0
- package/studio/chunks/en-C9OiaUDZ.js.br +0 -0
- package/studio/chunks/en-C9OiaUDZ.js.gz +0 -0
- package/studio/chunks/en-CHAR6jzx.js +147 -0
- package/studio/chunks/en-CHAR6jzx.js.br +0 -0
- package/studio/chunks/en-CHAR6jzx.js.gz +0 -0
- package/studio/chunks/en-Cq4N1vEF.js +93 -0
- package/studio/chunks/en-Cq4N1vEF.js.br +2 -0
- package/studio/chunks/en-Cq4N1vEF.js.gz +0 -0
- package/studio/chunks/en-D2hRqlse.js +140 -0
- package/studio/chunks/en-D2hRqlse.js.br +0 -0
- package/studio/chunks/en-D2hRqlse.js.gz +0 -0
- package/studio/chunks/en-DiUC3-j6.js +144 -0
- package/studio/chunks/en-DiUC3-j6.js.br +0 -0
- package/studio/chunks/en-DiUC3-j6.js.gz +0 -0
- package/studio/chunks/english-Cs_Adu-u.js +8 -0
- package/studio/chunks/english-Cs_Adu-u.js.br +0 -0
- package/studio/chunks/english-Cs_Adu-u.js.gz +0 -0
- package/studio/chunks/esm-D6DqSiL1.js +752 -0
- package/studio/chunks/esm-D6DqSiL1.js.br +0 -0
- package/studio/chunks/esm-D6DqSiL1.js.gz +0 -0
- package/studio/chunks/externalRequest-CTzr2nDq.js +23 -0
- package/studio/chunks/externalRequest-CTzr2nDq.js.br +0 -0
- package/studio/chunks/externalRequest-CTzr2nDq.js.gz +0 -0
- package/studio/chunks/iconify-DR9ryCPv.js +1007 -0
- package/studio/chunks/iconify-DR9ryCPv.js.br +0 -0
- package/studio/chunks/iconify-DR9ryCPv.js.gz +0 -0
- package/studio/chunks/icons-D2MsAaXq.js +183 -0
- package/studio/chunks/icons-D2MsAaXq.js.br +0 -0
- package/studio/chunks/icons-D2MsAaXq.js.gz +0 -0
- package/studio/chunks/leaveGuards-D22fTGgr.js +26 -0
- package/studio/chunks/leaveGuards-D22fTGgr.js.br +0 -0
- package/studio/chunks/leaveGuards-D22fTGgr.js.gz +0 -0
- package/studio/chunks/lucideIcons-EyqyPBsX.js +238 -0
- package/studio/chunks/lucideIcons-EyqyPBsX.js.br +0 -0
- package/studio/chunks/lucideIcons-EyqyPBsX.js.gz +0 -0
- package/studio/chunks/mediaRoute--8cY8rUe.js +17 -0
- package/studio/chunks/mediaRoute--8cY8rUe.js.br +0 -0
- package/studio/chunks/mediaRoute--8cY8rUe.js.gz +0 -0
- package/studio/chunks/newDocumentPlanning-C26DHpvh.js +77 -0
- package/studio/chunks/newDocumentPlanning-C26DHpvh.js.br +0 -0
- package/studio/chunks/newDocumentPlanning-C26DHpvh.js.gz +0 -0
- package/studio/chunks/notifications-OKOLc40v.js +110 -0
- package/studio/chunks/notifications-OKOLc40v.js.br +0 -0
- package/studio/chunks/notifications-OKOLc40v.js.gz +0 -0
- package/studio/chunks/operations-CjNHyrEX.js +57 -0
- package/studio/chunks/operations-CjNHyrEX.js.br +0 -0
- package/studio/chunks/operations-CjNHyrEX.js.gz +0 -0
- package/studio/chunks/overlay-DnqFLZTc.js +1733 -0
- package/studio/chunks/overlay-DnqFLZTc.js.br +0 -0
- package/studio/chunks/overlay-DnqFLZTc.js.gz +0 -0
- package/studio/chunks/presentation-DF83w0hE.js +57 -0
- package/studio/chunks/presentation-DF83w0hE.js.br +0 -0
- package/studio/chunks/presentation-DF83w0hE.js.gz +0 -0
- package/studio/chunks/runtime-core.esm-bundler-DKFA9Rep.js +4557 -0
- package/studio/chunks/runtime-core.esm-bundler-DKFA9Rep.js.br +0 -0
- package/studio/chunks/runtime-core.esm-bundler-DKFA9Rep.js.gz +0 -0
- package/studio/chunks/searchPresentation-DFwxQkt3.js +76 -0
- package/studio/chunks/searchPresentation-DFwxQkt3.js.br +0 -0
- package/studio/chunks/searchPresentation-DFwxQkt3.js.gz +0 -0
- package/studio/chunks/status-DQv6ihkU.js +38 -0
- package/studio/chunks/status-DQv6ihkU.js.br +0 -0
- package/studio/chunks/status-DQv6ihkU.js.gz +0 -0
- package/studio/chunks/studioContext-I8HozGU1.js +4953 -0
- package/studio/chunks/studioContext-I8HozGU1.js.br +0 -0
- package/studio/chunks/studioContext-I8HozGU1.js.gz +0 -0
- package/studio/chunks/studioQueries-BR-9NT5F.js +73 -0
- package/studio/chunks/studioQueries-BR-9NT5F.js.br +0 -0
- package/studio/chunks/studioQueries-BR-9NT5F.js.gz +0 -0
- package/studio/chunks/studioSearch-ByaL-QpM.js +1095 -0
- package/studio/chunks/studioSearch-ByaL-QpM.js.br +0 -0
- package/studio/chunks/studioSearch-ByaL-QpM.js.gz +0 -0
- package/studio/chunks/useAcknowledgedDraft-0_c9sWI6.js +62 -0
- package/studio/chunks/useAcknowledgedDraft-0_c9sWI6.js.br +0 -0
- package/studio/chunks/useAcknowledgedDraft-0_c9sWI6.js.gz +0 -0
- package/studio/chunks/useApi-CUWMwLLw-B3Q3g2nf.js +189 -0
- package/studio/chunks/useApi-CUWMwLLw-B3Q3g2nf.js.br +0 -0
- package/studio/chunks/useApi-CUWMwLLw-B3Q3g2nf.js.gz +0 -0
- package/studio/chunks/useDocumentMessage-BAWvc38w.js +16 -0
- package/studio/chunks/useDocumentMessage-BAWvc38w.js.br +3 -0
- package/studio/chunks/useDocumentMessage-BAWvc38w.js.gz +0 -0
- package/studio/chunks/useFilter-DzyiTR7f.js +87 -0
- package/studio/chunks/useFilter-DzyiTR7f.js.br +0 -0
- package/studio/chunks/useFilter-DzyiTR7f.js.gz +0 -0
- package/studio/chunks/useFormControl-CL7sSCUo.js +8 -0
- package/studio/chunks/useFormControl-CL7sSCUo.js.br +0 -0
- package/studio/chunks/useFormControl-CL7sSCUo.js.gz +0 -0
- package/studio/chunks/useGraceArea-Chcy25IQ.js +154 -0
- package/studio/chunks/useGraceArea-Chcy25IQ.js.br +0 -0
- package/studio/chunks/useGraceArea-Chcy25IQ.js.gz +0 -0
- package/studio/chunks/useLeaveConfirmation-_iCSnKEp.js +44 -0
- package/studio/chunks/useLeaveConfirmation-_iCSnKEp.js.br +8 -0
- package/studio/chunks/useLeaveConfirmation-_iCSnKEp.js.gz +0 -0
- package/studio/chunks/useLinkCopy-CMjQteCy.js +35 -0
- package/studio/chunks/useLinkCopy-CMjQteCy.js.br +0 -0
- package/studio/chunks/useLinkCopy-CMjQteCy.js.gz +0 -0
- package/studio/chunks/usePointerMotion-DwRcwBNQ.js +16 -0
- package/studio/chunks/usePointerMotion-DwRcwBNQ.js.br +0 -0
- package/studio/chunks/usePointerMotion-DwRcwBNQ.js.gz +0 -0
- package/studio/chunks/useStudioNavigation-CLwtSYpb.js +298 -0
- package/studio/chunks/useStudioNavigation-CLwtSYpb.js.br +0 -0
- package/studio/chunks/useStudioNavigation-CLwtSYpb.js.gz +0 -0
- package/studio/chunks/useStudioPages-DR9qmYLg.js +79 -0
- package/studio/chunks/useStudioPages-DR9qmYLg.js.br +0 -0
- package/studio/chunks/useStudioPages-DR9qmYLg.js.gz +0 -0
- package/studio/chunks/utils-mdScC0v0.js +59 -0
- package/studio/chunks/utils-mdScC0v0.js.br +0 -0
- package/studio/chunks/utils-mdScC0v0.js.gz +0 -0
- package/studio/chunks/virtualizer-D1S0bZ4t.js +781 -0
- package/studio/chunks/virtualizer-D1S0bZ4t.js.br +0 -0
- package/studio/chunks/virtualizer-D1S0bZ4t.js.gz +0 -0
- package/studio/help/64f767fe29c2-save-and-publish.svg +7 -0
- package/studio/host.css +1 -1
- package/studio/host.css.br +0 -0
- package/studio/host.css.gz +0 -0
- package/studio/host.js +8757 -39178
- package/studio/host.js.br +0 -0
- package/studio/host.js.gz +0 -0
- package/CHANGELOG.md +0 -13
- package/bin/cms.mjs +0 -2
- package/src/ApplicationTypes.d.ts +0 -84
- package/src/ApplicationTypes.js +0 -1
- package/src/Configuration-Da5B2PVH.js +0 -1191
- package/src/Configuration-Da5B2PVH.js.map +0 -1
- package/src/Configuration.d.ts +0 -82
- package/src/Configuration.js +0 -8
- package/src/Configuration.js.map +0 -1
- package/src/Content.d.ts +0 -68
- package/src/Content.js +0 -373
- package/src/Content.js.map +0 -1
- package/src/ContentTransfer-BxwswWn3.js +0 -86
- package/src/ContentTransfer-BxwswWn3.js.map +0 -1
- package/src/ContentTransfer-Z9FHyLez.d.ts +0 -72
- package/src/DocumentEngine-hh_IGPXO.js +0 -978
- package/src/DocumentEngine-hh_IGPXO.js.map +0 -1
- package/src/DocumentModel.d.ts +0 -52
- package/src/DocumentModel.js +0 -66
- package/src/DocumentModel.js.map +0 -1
- package/src/Forms-CX-hwmJF.js +0 -391
- package/src/Forms-CX-hwmJF.js.map +0 -1
- package/src/Forms-CfNPTiCr.js +0 -110
- package/src/Forms-CfNPTiCr.js.map +0 -1
- package/src/Forms-R0HoTR-o.d.ts +0 -92
- package/src/Forms.js.map +0 -1
- package/src/HttpPaths-c9nLZ9H2.js +0 -21
- package/src/HttpPaths-c9nLZ9H2.js.map +0 -1
- package/src/I18n-zbqpWxki.d.ts +0 -29
- package/src/Media-j1bTritO.js +0 -112
- package/src/Media-j1bTritO.js.map +0 -1
- package/src/Module.js.map +0 -1
- package/src/References-CCPDAPve.js +0 -45
- package/src/References-CCPDAPve.js.map +0 -1
- package/src/S3MediaObjects-Dwhl2deX.js +0 -2742
- package/src/S3MediaObjects-Dwhl2deX.js.map +0 -1
- package/src/Seo-402YumpT.d.ts +0 -198
- package/src/cli/content.js +0 -101
- package/src/cli/content.js.map +0 -1
- package/src/cli.js.map +0 -1
- package/src/connection-BP80q4d-.js +0 -92
- package/src/connection-BP80q4d-.js.map +0 -1
- package/src/dev-lifecycle-CjDq63Ft.js +0 -535
- package/src/dev-lifecycle-CjDq63Ft.js.map +0 -1
- package/src/installation-DYNQQBD3.js +0 -9114
- package/src/installation-DYNQQBD3.js.map +0 -1
- package/src/internal/application-types.js +0 -43
- package/src/internal/application-types.js.map +0 -1
- package/src/internal/authoring-catalog.js +0 -158
- package/src/internal/authoring-catalog.js.map +0 -1
- package/src/internal/authoring-compiler.js +0 -146
- package/src/internal/authoring-compiler.js.map +0 -1
- package/src/internal/authoring-metadata.js +0 -191
- package/src/internal/authoring-metadata.js.map +0 -1
- package/src/internal/cms-config.js +0 -45
- package/src/internal/cms-config.js.map +0 -1
- package/src/internal/configuration.js +0 -228
- package/src/internal/configuration.js.map +0 -1
- package/src/internal/dev-lifecycle.js +0 -3
- package/src/internal/diagnostics.js +0 -47
- package/src/internal/diagnostics.js.map +0 -1
- package/src/internal/document-model.js +0 -376
- package/src/internal/document-model.js.map +0 -1
- package/src/internal/field-metadata.js +0 -7
- package/src/internal/field-metadata.js.map +0 -1
- package/src/internal/form-capabilities.js +0 -12
- package/src/internal/form-capabilities.js.map +0 -1
- package/src/internal/i18n.js +0 -73
- package/src/internal/i18n.js.map +0 -1
- package/src/internal/studio-app.js +0 -68
- package/src/internal/studio-app.js.map +0 -1
- package/src/location-CMNGO3lU.js +0 -35
- package/src/location-CMNGO3lU.js.map +0 -1
- package/src/metadata-DN9_K6Yl.js +0 -201
- package/src/metadata-DN9_K6Yl.js.map +0 -1
- package/src/models-5j67LMqW.js +0 -131
- package/src/models-5j67LMqW.js.map +0 -1
- package/src/models-VmGmG19-.js +0 -628
- package/src/models-VmGmG19-.js.map +0 -1
- package/src/runtime/api.js.map +0 -1
- package/src/runtime/blocks.js +0 -30
- package/src/runtime/blocks.js.map +0 -1
- package/src/runtime/collaboration.js +0 -45
- package/src/runtime/collaboration.js.map +0 -1
- package/src/runtime/delivery/DocumentField.js +0 -23
- package/src/runtime/delivery/DocumentField.js.map +0 -1
- package/src/runtime/delivery/DocumentRenderer.js +0 -61
- package/src/runtime/delivery/DocumentRenderer.js.map +0 -1
- package/src/runtime/delivery/DocumentScope.js +0 -41
- package/src/runtime/delivery/DocumentScope.js.map +0 -1
- package/src/runtime/delivery/blocks.js +0 -8
- package/src/runtime/delivery/blocks.js.map +0 -1
- package/src/runtime/delivery/context.js +0 -12
- package/src/runtime/delivery/context.js.map +0 -1
- package/src/runtime/delivery/document-page.js +0 -21
- package/src/runtime/delivery/document-page.js.map +0 -1
- package/src/runtime/delivery/document.js +0 -43
- package/src/runtime/delivery/document.js.map +0 -1
- package/src/runtime/delivery/error.js +0 -11
- package/src/runtime/delivery/error.js.map +0 -1
- package/src/runtime/delivery/plugin.js +0 -99
- package/src/runtime/delivery/plugin.js.map +0 -1
- package/src/runtime/delivery/preview.d.ts +0 -11
- package/src/runtime/delivery/preview.js +0 -6
- package/src/runtime/delivery/preview.js.map +0 -1
- package/src/runtime/delivery/types.d.ts +0 -2
- package/src/runtime/delivery/types.js +0 -1
- package/src/runtime/delivery/useCmsDocumentSeo.d.ts +0 -67
- package/src/runtime/delivery/useCmsDocumentSeo.js.map +0 -1
- package/src/runtime/delivery/useDocument.d.ts +0 -6
- package/src/runtime/delivery/useDocument.js +0 -23
- package/src/runtime/delivery/useDocument.js.map +0 -1
- package/src/runtime/delivery/useDocumentQuery.d.ts +0 -7
- package/src/runtime/delivery/useDocumentQuery.js +0 -29
- package/src/runtime/delivery/useDocumentQuery.js.map +0 -1
- package/src/runtime/forms/document.js +0 -38
- package/src/runtime/forms/document.js.map +0 -1
- package/src/runtime/forms/useCmsForm.js +0 -257
- package/src/runtime/forms/useCmsForm.js.map +0 -1
- package/src/runtime/i18n/translator.js +0 -51
- package/src/runtime/i18n/translator.js.map +0 -1
- package/src/runtime/i18n/useCmsI18n.d.ts +0 -13
- package/src/runtime/i18n/useCmsI18n.js +0 -38
- package/src/runtime/i18n/useCmsI18n.js.map +0 -1
- package/src/runtime/installation.js +0 -3
- package/src/runtime/plugin.js.map +0 -1
- package/src/runtime/preview/CmsStudioPreviewMarker.js +0 -29
- package/src/runtime/preview/CmsStudioPreviewMarker.js.map +0 -1
- package/src/runtime/preview/comark-document.js +0 -37
- package/src/runtime/preview/comark-document.js.map +0 -1
- package/src/runtime/preview/connection.js +0 -3
- package/src/runtime/preview/controller.js +0 -265
- package/src/runtime/preview/controller.js.map +0 -1
- package/src/runtime/preview/crypto.js +0 -16
- package/src/runtime/preview/crypto.js.map +0 -1
- package/src/runtime/preview/overlay.js +0 -122
- package/src/runtime/preview/overlay.js.map +0 -1
- package/src/runtime/preview/plugin.client.js +0 -68
- package/src/runtime/preview/plugin.client.js.map +0 -1
- package/src/runtime/preview/preview.css +0 -91
- package/src/runtime/preview/protocol.d.ts +0 -16
- package/src/runtime/preview/protocol.js +0 -23
- package/src/runtime/preview/protocol.js.map +0 -1
- package/src/runtime/preview/regions.js +0 -142
- package/src/runtime/preview/regions.js.map +0 -1
- package/src/runtime/preview/store.js +0 -4
- package/src/runtime/sitemap-entries.js +0 -17
- package/src/runtime/sitemap-entries.js.map +0 -1
- package/src/runtime/sitemap.js +0 -23
- package/src/runtime/sitemap.js.map +0 -1
- package/src/runtime/studio-app.js +0 -17
- package/src/runtime/studio-app.js.map +0 -1
- package/src/runtime/studio-document.js +0 -46
- package/src/runtime/studio-document.js.map +0 -1
- package/src/runtime/studio-entry.js +0 -19
- package/src/runtime/studio-entry.js.map +0 -1
- package/src/runtime/studio-navigation.js +0 -11
- package/src/runtime/studio-navigation.js.map +0 -1
- package/src/scalars-CA6kyipS.d.ts +0 -7
- package/src/scalars-CVZqT3L0.js +0 -22
- package/src/scalars-CVZqT3L0.js.map +0 -1
- package/src/store-X1e1o_MF.js +0 -209
- package/src/store-X1e1o_MF.js.map +0 -1
- package/src/types-DZ0IV-Ow.d.ts +0 -101
- package/studio/CreateDocumentDialog-BpjBYGfI.js +0 -335
- package/studio/SelectMenu-KiXwx4Y_.js +0 -34032
- package/studio/collaboration-DcK2F6v9.js +0 -4566
- package/studio/editor-P2rB7Csp.js +0 -30128
- package/studio/rolldown-runtime-Dy4uBu1J.js +0 -11
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
import { i as MediaId, m as mediaPath } from "./Media-DSyvd14o.js";
|
|
2
|
+
import { l as DocumentId } from "./Document-CKXMSEf1.js";
|
|
3
|
+
import { n as ImagePosition, o as imagePlacementStyle, r as ImageZoom } from "./Image-CJWPLnhP.js";
|
|
4
|
+
import { i as editorSchema, n as checkedBody } from "./EditorSchema-wrDv-id6.js";
|
|
5
|
+
import { n as resolveBlockProps, r as responsiveImageSrcSet, t as blockComponentName } from "./rendering-D9LVeEKX.js";
|
|
6
|
+
import { a as encodePreviewSource } from "./PreviewFocus-C_EelZO5.js";
|
|
7
|
+
import { a as blockRenderingKey, n as previewSourceAt } from "./previewRegions-CXjk5cbP.js";
|
|
8
|
+
import { t as previewContextKey } from "./previewContext-dt3ZUh-w.js";
|
|
9
|
+
import { CmsPreviewRegion } from "./runtime/previewSource.js";
|
|
10
|
+
import { n as localeConfigurationKey, t as contentLanguageAttributes } from "./locales-6OD4XGIZ.js";
|
|
11
|
+
import { Schema } from "effect";
|
|
12
|
+
import { Fragment, createCommentVNode, defineComponent, h, inject, onErrorCaptured, resolveComponent, shallowRef } from "vue";
|
|
13
|
+
import { ssrRenderComponent } from "vue/server-renderer";
|
|
14
|
+
//#region src/internal/bodyRendering.ts
|
|
15
|
+
/** Shared website markup for strict delivery and prepared saved-revision nodes. */
|
|
16
|
+
function renderBodyNode(node, children, attributes = {}, inlineParagraph = false, onMediaError) {
|
|
17
|
+
const encoded = attributes["data-cms-source"];
|
|
18
|
+
if (node.isText) {
|
|
19
|
+
let content = node.text ?? "";
|
|
20
|
+
for (const mark of node.marks) {
|
|
21
|
+
if (mark.type.name === "bold") content = h("strong", content);
|
|
22
|
+
if (mark.type.name === "italic") content = h("em", content);
|
|
23
|
+
if (mark.type.name === "strike") content = h("s", content);
|
|
24
|
+
if (mark.type.name === "code") content = h("code", content);
|
|
25
|
+
if (mark.type.name === "link" && Schema.is(Schema.String)(mark.attrs.href)) content = h("a", { href: mark.attrs.href }, content);
|
|
26
|
+
}
|
|
27
|
+
return content;
|
|
28
|
+
}
|
|
29
|
+
if (node.type.name === "image" && Schema.is(MediaId)(node.attrs.mediaId)) {
|
|
30
|
+
const mediaId = node.attrs.mediaId;
|
|
31
|
+
const framed = node.attrs.layout !== "natural";
|
|
32
|
+
const image = {
|
|
33
|
+
src: mediaPath(mediaId),
|
|
34
|
+
srcset: responsiveImageSrcSet(mediaId),
|
|
35
|
+
sizes: node.attrs.layout === "content" ? "(min-width: 768px) 768px, 100vw" : "100vw",
|
|
36
|
+
alt: node.attrs.alt,
|
|
37
|
+
loading: "lazy",
|
|
38
|
+
onError: onMediaError,
|
|
39
|
+
"data-cms-layout": node.attrs.layout
|
|
40
|
+
};
|
|
41
|
+
if (!framed) return h("img", {
|
|
42
|
+
...image,
|
|
43
|
+
...attributes,
|
|
44
|
+
class: "my-4 h-auto max-w-full rounded-md object-contain"
|
|
45
|
+
});
|
|
46
|
+
return h("div", {
|
|
47
|
+
...attributes,
|
|
48
|
+
class: `relative my-4 aspect-video w-full overflow-hidden rounded-md ${node.attrs.layout === "content" ? "max-w-3xl" : ""}`
|
|
49
|
+
}, [h("img", {
|
|
50
|
+
...image,
|
|
51
|
+
class: "absolute inset-0 size-full max-w-none",
|
|
52
|
+
style: imagePlacementStyle({
|
|
53
|
+
focalX: Schema.is(ImagePosition)(node.attrs.focalX) ? node.attrs.focalX : void 0,
|
|
54
|
+
focalY: Schema.is(ImagePosition)(node.attrs.focalY) ? node.attrs.focalY : void 0,
|
|
55
|
+
zoom: Schema.is(ImageZoom)(node.attrs.zoom) ? node.attrs.zoom : void 0
|
|
56
|
+
})
|
|
57
|
+
})]);
|
|
58
|
+
}
|
|
59
|
+
if (node.type.name === "video" && Schema.is(MediaId)(node.attrs.mediaId)) return h("video", {
|
|
60
|
+
src: mediaPath(node.attrs.mediaId),
|
|
61
|
+
title: node.attrs.title,
|
|
62
|
+
controls: true,
|
|
63
|
+
onError: onMediaError,
|
|
64
|
+
preload: "metadata",
|
|
65
|
+
playsinline: true,
|
|
66
|
+
poster: Schema.is(MediaId)(node.attrs.posterMediaId) ? mediaPath(node.attrs.posterMediaId) : void 0,
|
|
67
|
+
"data-cms-layout": node.attrs.layout,
|
|
68
|
+
...attributes,
|
|
69
|
+
class: `my-4 block h-auto w-full rounded-lg bg-black ${node.attrs.layout === "full" ? "" : "max-w-3xl"}`
|
|
70
|
+
});
|
|
71
|
+
if (node.type.name === "paragraph") {
|
|
72
|
+
const content = encoded ? [
|
|
73
|
+
createCommentVNode(`cms-source:${encoded}:start`),
|
|
74
|
+
...children,
|
|
75
|
+
createCommentVNode(`cms-source:${encoded}:end`)
|
|
76
|
+
] : children;
|
|
77
|
+
return inlineParagraph ? h(Fragment, null, content) : h("p", attributes, content);
|
|
78
|
+
}
|
|
79
|
+
if (node.type.name === "heading") return h(`h${node.attrs.level}`, attributes, children);
|
|
80
|
+
if (node.type.name === "blockquote") return h("blockquote", {
|
|
81
|
+
...attributes,
|
|
82
|
+
class: "my-4 border-s-2 border-default ps-4 italic"
|
|
83
|
+
}, children);
|
|
84
|
+
if (node.type.name === "bulletList") return h("ul", {
|
|
85
|
+
...attributes,
|
|
86
|
+
class: "my-4 list-disc ps-6"
|
|
87
|
+
}, children);
|
|
88
|
+
if (node.type.name === "orderedList") return h("ol", {
|
|
89
|
+
...attributes,
|
|
90
|
+
start: node.attrs.start,
|
|
91
|
+
class: "my-4 list-decimal ps-6"
|
|
92
|
+
}, children);
|
|
93
|
+
if (node.type.name === "listItem") return h("li", attributes, children);
|
|
94
|
+
if (node.type.name === "codeBlock") return h("pre", {
|
|
95
|
+
...attributes,
|
|
96
|
+
class: "my-4 overflow-x-auto rounded-md bg-muted px-4 py-3"
|
|
97
|
+
}, [h("code", children)]);
|
|
98
|
+
if (node.type.name === "horizontalRule") return h("hr", {
|
|
99
|
+
...attributes,
|
|
100
|
+
class: "my-6 border-default"
|
|
101
|
+
});
|
|
102
|
+
if (node.type.name === "hardBreak") return h("br");
|
|
103
|
+
return h("span", children);
|
|
104
|
+
}
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region src/runtime/internal/RevisionRenderGuard.ts
|
|
107
|
+
async function unroll(buffer) {
|
|
108
|
+
const parts = await buffer;
|
|
109
|
+
const output = [];
|
|
110
|
+
for (const part of parts) output.push(Schema.is(Schema.String)(part) ? part : await unroll(part));
|
|
111
|
+
return output.join("");
|
|
112
|
+
}
|
|
113
|
+
const FragmentContent = defineComponent({
|
|
114
|
+
props: { read: {
|
|
115
|
+
type: Function,
|
|
116
|
+
required: true
|
|
117
|
+
} },
|
|
118
|
+
setup: (props) => () => props.read()
|
|
119
|
+
});
|
|
120
|
+
/** Buffer one saved region before sending HTML; Vue client error capture alone cannot recover SSR. */
|
|
121
|
+
var RevisionRenderGuard_default = defineComponent({
|
|
122
|
+
name: "CmsRevisionRenderGuard",
|
|
123
|
+
props: {
|
|
124
|
+
content: {
|
|
125
|
+
type: Function,
|
|
126
|
+
required: true
|
|
127
|
+
},
|
|
128
|
+
fallback: {
|
|
129
|
+
type: Function,
|
|
130
|
+
required: true
|
|
131
|
+
},
|
|
132
|
+
onFailed: {
|
|
133
|
+
type: Function,
|
|
134
|
+
required: true
|
|
135
|
+
},
|
|
136
|
+
initiallyFailed: Boolean
|
|
137
|
+
},
|
|
138
|
+
setup(props) {
|
|
139
|
+
const failed = shallowRef(props.initiallyFailed);
|
|
140
|
+
function fail() {
|
|
141
|
+
failed.value = true;
|
|
142
|
+
props.onFailed();
|
|
143
|
+
}
|
|
144
|
+
onErrorCaptured(() => {
|
|
145
|
+
fail();
|
|
146
|
+
return false;
|
|
147
|
+
});
|
|
148
|
+
return {
|
|
149
|
+
failed,
|
|
150
|
+
fail
|
|
151
|
+
};
|
|
152
|
+
},
|
|
153
|
+
render() {
|
|
154
|
+
return h(FragmentContent, { read: this.failed ? this.fallback : this.content });
|
|
155
|
+
},
|
|
156
|
+
ssrRender(context, push, parent) {
|
|
157
|
+
if (import.meta.server === false) return;
|
|
158
|
+
push((async () => {
|
|
159
|
+
if (!context.failed) try {
|
|
160
|
+
const html = await unroll(ssrRenderComponent(FragmentContent, { read: context.content }, null, parent));
|
|
161
|
+
if (!context.failed) return [html];
|
|
162
|
+
} catch {
|
|
163
|
+
context.fail();
|
|
164
|
+
}
|
|
165
|
+
return [await unroll(ssrRenderComponent(FragmentContent, { read: context.fallback }, null, parent))];
|
|
166
|
+
})());
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region src/runtime/internal/RevisionRenderer.ts
|
|
171
|
+
const MediaNode = defineComponent({
|
|
172
|
+
props: { value: {
|
|
173
|
+
type: Object,
|
|
174
|
+
required: true
|
|
175
|
+
} },
|
|
176
|
+
setup(props) {
|
|
177
|
+
const failed = shallowRef(false);
|
|
178
|
+
return () => failed.value ? h("p", {
|
|
179
|
+
role: "note",
|
|
180
|
+
class: "my-4 text-muted"
|
|
181
|
+
}, "This saved media is unavailable.") : renderBodyNode(editorSchema.nodeFromJSON(props.value.node), [], {}, false, () => {
|
|
182
|
+
failed.value = true;
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
function plainValue(value) {
|
|
187
|
+
return Schema.is(Schema.String)(value) ? value : JSON.stringify(value, null, 2);
|
|
188
|
+
}
|
|
189
|
+
var RevisionRenderer_default = defineComponent({
|
|
190
|
+
name: "CmsRevisionRenderer",
|
|
191
|
+
props: { value: {
|
|
192
|
+
type: Object,
|
|
193
|
+
required: true
|
|
194
|
+
} },
|
|
195
|
+
setup(props) {
|
|
196
|
+
const blocks = inject(blockRenderingKey, /* @__PURE__ */ new Map());
|
|
197
|
+
return () => {
|
|
198
|
+
const value = props.value;
|
|
199
|
+
const plan = value.renderPlan;
|
|
200
|
+
if (!plan) return null;
|
|
201
|
+
const failures = value.renderFailures ??= [];
|
|
202
|
+
const forms = new Map(value.forms?.map((form) => [form.blockId, form]));
|
|
203
|
+
function guard(id, content, fallback) {
|
|
204
|
+
return h(RevisionRenderGuard_default, {
|
|
205
|
+
key: id,
|
|
206
|
+
content,
|
|
207
|
+
fallback,
|
|
208
|
+
initiallyFailed: failures.includes(id),
|
|
209
|
+
onFailed: () => {
|
|
210
|
+
if (!failures.includes(id)) failures.push(id);
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
function render(node, mode = "current", inline = false) {
|
|
215
|
+
if (node.kind === "placeholder") return h("p", {
|
|
216
|
+
role: "note",
|
|
217
|
+
class: "text-muted"
|
|
218
|
+
}, node.label);
|
|
219
|
+
if (node.kind === "fallback") {
|
|
220
|
+
const children = node.children.map((child) => render(child, mode, inline));
|
|
221
|
+
return h(Fragment, mode === "readable" ? [node.text, ...children] : [
|
|
222
|
+
h("span", { class: "text-sm text-muted" }, node.label),
|
|
223
|
+
node.text ? h("span", { class: "whitespace-pre-wrap wrap-break-word" }, node.text) : null,
|
|
224
|
+
...children
|
|
225
|
+
]);
|
|
226
|
+
}
|
|
227
|
+
if (node.kind === "node") {
|
|
228
|
+
if (node.node.type === "image" || node.node.type === "video") return h(MediaNode, { value: node });
|
|
229
|
+
return renderBodyNode(editorSchema.nodeFromJSON(node.node), node.children.map((child) => render(child, mode)), {}, inline);
|
|
230
|
+
}
|
|
231
|
+
if (mode === "readable") return h("section", { class: "my-4 space-y-3" }, [
|
|
232
|
+
h("p", { class: "text-sm text-muted" }, "Saved content"),
|
|
233
|
+
Object.keys(node.props).length ? h("pre", { class: "whitespace-pre-wrap wrap-break-word text-sm" }, plainValue(node.props)) : null,
|
|
234
|
+
...node.slots.flatMap((slot) => slot.children.map((child) => render(child, mode)))
|
|
235
|
+
]);
|
|
236
|
+
const component = resolveComponent(blockComponentName(node.name));
|
|
237
|
+
if (Schema.is(Schema.String)(component)) return render(node, "readable");
|
|
238
|
+
return guard(node.id, () => {
|
|
239
|
+
const slots = Object.fromEntries(node.slots.map((slot) => [slot.name, () => slot.children.map((child) => render(child, mode, blocks.get(node.name)?.inlineSlots.has(slot.name)))]));
|
|
240
|
+
const form = forms.get(node.id);
|
|
241
|
+
const properties = resolveBlockProps(node.props, node.id, value.referencePaths, blocks.get(node.name)?.definition.fields ?? []);
|
|
242
|
+
return h(component, Object.assign({}, properties, form ? { cmsForm: form } : void 0), slots);
|
|
243
|
+
}, () => render(node, "readable"));
|
|
244
|
+
}
|
|
245
|
+
const title = value.source.fields.title;
|
|
246
|
+
const heading = () => Schema.is(Schema.String)(title) ? h("h1", title) : null;
|
|
247
|
+
const fields = () => h("dl", { class: "my-4 space-y-3" }, Object.entries(plan.fields.values).filter(([name]) => name !== "title").flatMap(([name, field]) => [h("dt", { class: "font-medium" }, name), h("dd", { class: "whitespace-pre-wrap wrap-break-word" }, plainValue(field))]));
|
|
248
|
+
return h("article", { "data-cms-document": value.identity.documentId }, [guard("document", () => h(Fragment, [
|
|
249
|
+
heading(),
|
|
250
|
+
plan.fields.mode === "readable" ? fields() : null,
|
|
251
|
+
...plan.body.map((node) => render(node))
|
|
252
|
+
]), () => h(Fragment, [
|
|
253
|
+
heading(),
|
|
254
|
+
fields(),
|
|
255
|
+
...plan.body.map((node) => render(node, "readable"))
|
|
256
|
+
]))]);
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
//#endregion
|
|
261
|
+
//#region src/runtime/DocumentRenderer.ts
|
|
262
|
+
var DocumentRenderer_default = defineComponent({
|
|
263
|
+
name: "CmsDocumentRenderer",
|
|
264
|
+
props: {
|
|
265
|
+
value: { type: Object },
|
|
266
|
+
source: { type: Object },
|
|
267
|
+
documentId: { type: String },
|
|
268
|
+
forms: { type: Array },
|
|
269
|
+
formBlockNames: { type: Array },
|
|
270
|
+
referencePaths: { type: Object },
|
|
271
|
+
previewFocus: {
|
|
272
|
+
type: Boolean,
|
|
273
|
+
default: void 0
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
emits: { focusTarget: (_target) => true },
|
|
277
|
+
setup(props, { emit }) {
|
|
278
|
+
const preview = inject(previewContextKey, null);
|
|
279
|
+
const blocks = inject(blockRenderingKey, /* @__PURE__ */ new Map());
|
|
280
|
+
const locales = inject(localeConfigurationKey, void 0);
|
|
281
|
+
return () => {
|
|
282
|
+
const value = props.value;
|
|
283
|
+
const source = props.source ?? (value && value.source);
|
|
284
|
+
if (!source) return null;
|
|
285
|
+
const language = contentLanguageAttributes(value?.locale, locales);
|
|
286
|
+
if (value?.renderPlan) return h(RevisionRenderer_default, {
|
|
287
|
+
value,
|
|
288
|
+
...language
|
|
289
|
+
});
|
|
290
|
+
const document = checkedBody(source.body);
|
|
291
|
+
const title = source.fields.title;
|
|
292
|
+
const focus = props.previewFocus ?? preview?.mapped.value ?? false;
|
|
293
|
+
const id = props.documentId ?? (value && value.identity.documentId);
|
|
294
|
+
const documentId = Schema.is(DocumentId)(id) ? id : void 0;
|
|
295
|
+
const children = [];
|
|
296
|
+
const deliveredForms = props.forms ?? props.value?.forms ?? [];
|
|
297
|
+
const forms = new Map(deliveredForms.map((form) => [form.blockId, form]));
|
|
298
|
+
const formBlockNames = new Set(props.formBlockNames ?? deliveredForms.map((form) => form.name));
|
|
299
|
+
const referencePaths = props.referencePaths ?? props.value?.referencePaths ?? {};
|
|
300
|
+
const context = {
|
|
301
|
+
blocks,
|
|
302
|
+
forms,
|
|
303
|
+
formBlockNames,
|
|
304
|
+
referencePaths,
|
|
305
|
+
preview: focus && documentId ? {
|
|
306
|
+
documentId,
|
|
307
|
+
sources: preview?.sources
|
|
308
|
+
} : null
|
|
309
|
+
};
|
|
310
|
+
document.forEach((node, _offset, index) => children.push(renderNode(node, [index], context)));
|
|
311
|
+
return h("article", {
|
|
312
|
+
...language,
|
|
313
|
+
"data-cms-document": id,
|
|
314
|
+
"data-cms-source": focus && documentId ? encodePreviewSource({
|
|
315
|
+
documentId,
|
|
316
|
+
target: { kind: "document" },
|
|
317
|
+
approximate: true
|
|
318
|
+
}) : void 0,
|
|
319
|
+
onClick: focus ? (event) => {
|
|
320
|
+
if (!(event.target instanceof Element)) return;
|
|
321
|
+
const article = event.currentTarget;
|
|
322
|
+
const selected = article instanceof Element ? previewSourceAt(article, event.target) : null;
|
|
323
|
+
if (!selected) return;
|
|
324
|
+
event.preventDefault();
|
|
325
|
+
event.stopPropagation();
|
|
326
|
+
emit("focusTarget", selected.target);
|
|
327
|
+
} : void 0
|
|
328
|
+
}, [Schema.is(Schema.String)(title) ? h("h1", focus ? { "data-cms-source": documentId ? encodePreviewSource({
|
|
329
|
+
documentId,
|
|
330
|
+
target: { kind: "title" },
|
|
331
|
+
approximate: false
|
|
332
|
+
}) : void 0 } : {}, title) : void 0, ...children]);
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
function renderNode(node, path, context, containingBlockId, inlineParagraph = false) {
|
|
337
|
+
const { forms, formBlockNames, referencePaths, preview } = context;
|
|
338
|
+
const target = {
|
|
339
|
+
kind: "body",
|
|
340
|
+
path
|
|
341
|
+
};
|
|
342
|
+
if (Schema.is(Schema.NonEmptyString)(node.attrs.id)) Object.assign(target, { nodeId: node.attrs.id });
|
|
343
|
+
if (containingBlockId) Object.assign(target, { blockId: containingBlockId });
|
|
344
|
+
const source = preview ? {
|
|
345
|
+
documentId: preview.documentId,
|
|
346
|
+
target,
|
|
347
|
+
approximate: false
|
|
348
|
+
} : null;
|
|
349
|
+
const attributes = { "data-cms-source": source ? encodePreviewSource(source) : void 0 };
|
|
350
|
+
if (node.isText) return renderBodyNode(node, [], attributes);
|
|
351
|
+
if (node.type.name === "cmsBlock") {
|
|
352
|
+
const name = node.attrs.name;
|
|
353
|
+
const blockId = String(node.attrs.id);
|
|
354
|
+
const component = resolveComponent(blockComponentName(Schema.is(Schema.String)(name) ? name : ""));
|
|
355
|
+
const blockProps = Schema.is(Schema.JsonObject)(node.attrs.props) ? node.attrs.props : {};
|
|
356
|
+
const block = context.blocks.get(String(name));
|
|
357
|
+
const slots = {};
|
|
358
|
+
node.forEach((region, _offset, regionIndex) => {
|
|
359
|
+
const slotName = region.attrs.name;
|
|
360
|
+
if (!Schema.is(Schema.String)(slotName)) return;
|
|
361
|
+
const inlineParagraph = block?.inlineSlots.has(slotName) ?? false;
|
|
362
|
+
slots[slotName] = () => {
|
|
363
|
+
const children = [];
|
|
364
|
+
region.forEach((child, _offset, childIndex) => children.push(renderNode(child, [
|
|
365
|
+
...path,
|
|
366
|
+
regionIndex,
|
|
367
|
+
childIndex
|
|
368
|
+
], context, blockId, inlineParagraph)));
|
|
369
|
+
return children;
|
|
370
|
+
};
|
|
371
|
+
});
|
|
372
|
+
const resolvedProps = resolveBlockProps(blockProps, blockId, referencePaths, block?.definition.fields ?? []);
|
|
373
|
+
const componentProps = Object.assign({}, resolvedProps);
|
|
374
|
+
if (formBlockNames.has(name)) componentProps.cmsForm = forms.get(blockId);
|
|
375
|
+
const properties = preview ? preview.sources?.block(resolvedProps, String(name), blockId, preview.documentId) ?? {} : {};
|
|
376
|
+
const blockSource = preview ? {
|
|
377
|
+
documentId: preview.documentId,
|
|
378
|
+
target: {
|
|
379
|
+
kind: "block",
|
|
380
|
+
blockId
|
|
381
|
+
},
|
|
382
|
+
approximate: false
|
|
383
|
+
} : null;
|
|
384
|
+
return preview ? h(CmsPreviewRegion, {
|
|
385
|
+
source: blockSource,
|
|
386
|
+
properties
|
|
387
|
+
}, { default: () => [h(component, componentProps, slots)] }) : h(component, componentProps, slots);
|
|
388
|
+
}
|
|
389
|
+
const children = [];
|
|
390
|
+
node.forEach((child, _offset, childIndex) => children.push(renderNode(child, [...path, childIndex], context, containingBlockId)));
|
|
391
|
+
return renderBodyNode(node, children, attributes, inlineParagraph);
|
|
392
|
+
}
|
|
393
|
+
//#endregion
|
|
394
|
+
export { DocumentRenderer_default as t };
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { _ as canonicalContent } from "./Seo-CjNUtUkj.js";
|
|
2
|
+
import { i as MediaId, m as mediaPath, o as MediaLayout } from "./Media-DSyvd14o.js";
|
|
3
|
+
import { _ as DocumentSource, r as DocumentBody } from "./Document-CKXMSEf1.js";
|
|
4
|
+
import { n as safeLinkHref } from "./Links-CJYyy7rC.js";
|
|
5
|
+
import { n as ImagePosition, r as ImageZoom } from "./Image-CJWPLnhP.js";
|
|
6
|
+
import { Schema } from "effect";
|
|
7
|
+
import { Schema as Schema$1 } from "@tiptap/pm/model";
|
|
8
|
+
import { Transform } from "@tiptap/pm/transform";
|
|
9
|
+
//#region ../model/src/EditorSchema.ts
|
|
10
|
+
/** The durable body schema shared by Studio, collaboration, and publication. */
|
|
11
|
+
const editorSchema = new Schema$1({
|
|
12
|
+
nodes: {
|
|
13
|
+
doc: { content: "block+" },
|
|
14
|
+
paragraph: {
|
|
15
|
+
attrs: { id: { default: null } },
|
|
16
|
+
group: "block",
|
|
17
|
+
content: "inline*",
|
|
18
|
+
parseDOM: [{ tag: "p" }],
|
|
19
|
+
toDOM: () => ["p", 0]
|
|
20
|
+
},
|
|
21
|
+
heading: {
|
|
22
|
+
attrs: {
|
|
23
|
+
id: { default: null },
|
|
24
|
+
level: { default: 2 }
|
|
25
|
+
},
|
|
26
|
+
group: "block",
|
|
27
|
+
content: "inline*",
|
|
28
|
+
parseDOM: [
|
|
29
|
+
{
|
|
30
|
+
tag: "h1",
|
|
31
|
+
attrs: { level: 1 }
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
tag: "h2",
|
|
35
|
+
attrs: { level: 2 }
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
tag: "h3",
|
|
39
|
+
attrs: { level: 3 }
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
toDOM: (node) => [`h${node.attrs.level}`, 0]
|
|
43
|
+
},
|
|
44
|
+
blockquote: {
|
|
45
|
+
attrs: { id: { default: null } },
|
|
46
|
+
group: "block",
|
|
47
|
+
content: "block+",
|
|
48
|
+
parseDOM: [{ tag: "blockquote" }],
|
|
49
|
+
toDOM: () => ["blockquote", 0]
|
|
50
|
+
},
|
|
51
|
+
bulletList: {
|
|
52
|
+
group: "block",
|
|
53
|
+
content: "listItem+",
|
|
54
|
+
attrs: { id: { default: null } },
|
|
55
|
+
parseDOM: [{ tag: "ul" }],
|
|
56
|
+
toDOM: () => ["ul", 0]
|
|
57
|
+
},
|
|
58
|
+
orderedList: {
|
|
59
|
+
group: "block",
|
|
60
|
+
content: "listItem+",
|
|
61
|
+
attrs: {
|
|
62
|
+
id: { default: null },
|
|
63
|
+
start: { default: 1 }
|
|
64
|
+
},
|
|
65
|
+
parseDOM: [{
|
|
66
|
+
tag: "ol",
|
|
67
|
+
getAttrs: (element) => ({ start: Number(element.getAttribute("start") ?? 1) })
|
|
68
|
+
}],
|
|
69
|
+
toDOM: (node) => [
|
|
70
|
+
"ol",
|
|
71
|
+
{ start: node.attrs.start },
|
|
72
|
+
0
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
listItem: {
|
|
76
|
+
content: "paragraph block*",
|
|
77
|
+
attrs: { id: { default: null } },
|
|
78
|
+
parseDOM: [{ tag: "li" }],
|
|
79
|
+
toDOM: () => ["li", 0]
|
|
80
|
+
},
|
|
81
|
+
codeBlock: {
|
|
82
|
+
group: "block",
|
|
83
|
+
content: "text*",
|
|
84
|
+
marks: "",
|
|
85
|
+
code: true,
|
|
86
|
+
attrs: {
|
|
87
|
+
id: { default: null },
|
|
88
|
+
language: { default: null }
|
|
89
|
+
},
|
|
90
|
+
parseDOM: [{ tag: "pre" }],
|
|
91
|
+
toDOM: () => ["pre", ["code", 0]]
|
|
92
|
+
},
|
|
93
|
+
horizontalRule: {
|
|
94
|
+
group: "block",
|
|
95
|
+
atom: true,
|
|
96
|
+
attrs: { id: { default: null } },
|
|
97
|
+
parseDOM: [{ tag: "hr" }],
|
|
98
|
+
toDOM: () => ["hr"]
|
|
99
|
+
},
|
|
100
|
+
hardBreak: {
|
|
101
|
+
group: "inline",
|
|
102
|
+
inline: true,
|
|
103
|
+
selectable: false,
|
|
104
|
+
parseDOM: [{ tag: "br" }],
|
|
105
|
+
toDOM: () => ["br"]
|
|
106
|
+
},
|
|
107
|
+
cmsBlock: {
|
|
108
|
+
group: "block",
|
|
109
|
+
content: "cmsSlot*",
|
|
110
|
+
attrs: {
|
|
111
|
+
id: {},
|
|
112
|
+
name: {},
|
|
113
|
+
props: { default: {} }
|
|
114
|
+
},
|
|
115
|
+
toDOM: (node) => [
|
|
116
|
+
"section",
|
|
117
|
+
{ "data-cms-block": node.attrs.name },
|
|
118
|
+
0
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
cmsSlot: {
|
|
122
|
+
content: "block*",
|
|
123
|
+
attrs: { name: {} },
|
|
124
|
+
toDOM: (node) => [
|
|
125
|
+
"div",
|
|
126
|
+
{ "data-cms-slot": node.attrs.name },
|
|
127
|
+
0
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
image: {
|
|
131
|
+
group: "block",
|
|
132
|
+
atom: true,
|
|
133
|
+
attrs: {
|
|
134
|
+
id: { default: null },
|
|
135
|
+
mediaId: {},
|
|
136
|
+
alt: { default: "" },
|
|
137
|
+
layout: { default: "natural" },
|
|
138
|
+
focalX: { default: null },
|
|
139
|
+
focalY: { default: null },
|
|
140
|
+
zoom: { default: null }
|
|
141
|
+
},
|
|
142
|
+
toDOM: (node) => ["img", {
|
|
143
|
+
src: mediaPath(node.attrs.mediaId),
|
|
144
|
+
alt: node.attrs.alt
|
|
145
|
+
}]
|
|
146
|
+
},
|
|
147
|
+
video: {
|
|
148
|
+
group: "block",
|
|
149
|
+
atom: true,
|
|
150
|
+
attrs: {
|
|
151
|
+
id: { default: null },
|
|
152
|
+
mediaId: {},
|
|
153
|
+
title: { default: "" },
|
|
154
|
+
layout: { default: "content" },
|
|
155
|
+
posterMediaId: { default: null }
|
|
156
|
+
},
|
|
157
|
+
toDOM: (node) => ["video", {
|
|
158
|
+
src: mediaPath(node.attrs.mediaId),
|
|
159
|
+
controls: "controls"
|
|
160
|
+
}]
|
|
161
|
+
},
|
|
162
|
+
text: { group: "inline" }
|
|
163
|
+
},
|
|
164
|
+
marks: {
|
|
165
|
+
bold: {
|
|
166
|
+
parseDOM: [{ tag: "strong" }],
|
|
167
|
+
toDOM: () => ["strong", 0]
|
|
168
|
+
},
|
|
169
|
+
italic: {
|
|
170
|
+
parseDOM: [{ tag: "em" }],
|
|
171
|
+
toDOM: () => ["em", 0]
|
|
172
|
+
},
|
|
173
|
+
strike: {
|
|
174
|
+
parseDOM: [{ tag: "s" }],
|
|
175
|
+
toDOM: () => ["s", 0]
|
|
176
|
+
},
|
|
177
|
+
code: {
|
|
178
|
+
code: true,
|
|
179
|
+
parseDOM: [{ tag: "code" }],
|
|
180
|
+
toDOM: () => ["code", 0]
|
|
181
|
+
},
|
|
182
|
+
link: {
|
|
183
|
+
attrs: { href: {} },
|
|
184
|
+
inclusive: false,
|
|
185
|
+
parseDOM: [{
|
|
186
|
+
tag: "a[href]",
|
|
187
|
+
getAttrs: (element) => ({ href: element.getAttribute("href") })
|
|
188
|
+
}],
|
|
189
|
+
toDOM: (mark) => [
|
|
190
|
+
"a",
|
|
191
|
+
{ href: mark.attrs.href },
|
|
192
|
+
0
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
function checkedBody(body) {
|
|
198
|
+
const document = editorSchema.nodeFromJSON(body);
|
|
199
|
+
document.check();
|
|
200
|
+
document.descendants((node) => {
|
|
201
|
+
if (node.type.name === "heading" && ![
|
|
202
|
+
1,
|
|
203
|
+
2,
|
|
204
|
+
3
|
|
205
|
+
].includes(node.attrs.level)) throw new Error("Body heading has an unsupported level.");
|
|
206
|
+
if (node.type.name === "orderedList" && (!Number.isSafeInteger(node.attrs.start) || node.attrs.start < 1 || node.attrs.start > 1e6)) throw new Error("Body numbered list has an invalid start.");
|
|
207
|
+
if (node.type.name === "image" || node.type.name === "video") {
|
|
208
|
+
if (!Schema.is(MediaId)(node.attrs.mediaId)) throw new Error("Body media needs a valid asset ID.");
|
|
209
|
+
if (!Schema.is(MediaLayout)(node.attrs.layout)) throw new Error("Body media needs a valid layout.");
|
|
210
|
+
if (node.type.name === "image" && !Schema.is(Schema.String)(node.attrs.alt)) throw new Error("Body image needs alternative text or an empty decorative description.");
|
|
211
|
+
if (node.type.name === "image") {
|
|
212
|
+
if (node.attrs.focalX !== null && !Schema.is(ImagePosition)(node.attrs.focalX) || node.attrs.focalY !== null && !Schema.is(ImagePosition)(node.attrs.focalY) || node.attrs.zoom !== null && !Schema.is(ImageZoom)(node.attrs.zoom)) throw new Error("Body image has invalid framing values.");
|
|
213
|
+
}
|
|
214
|
+
if (node.type.name === "video" && !Schema.is(Schema.String)(node.attrs.title)) throw new Error("Body video needs a title.");
|
|
215
|
+
if (node.type.name === "video" && node.attrs.posterMediaId !== null && !Schema.is(MediaId)(node.attrs.posterMediaId)) throw new Error("Body video poster needs a valid image asset ID.");
|
|
216
|
+
}
|
|
217
|
+
for (const mark of node.marks) {
|
|
218
|
+
if (mark.type.name !== "link") continue;
|
|
219
|
+
const href = mark.attrs.href;
|
|
220
|
+
if (!Schema.is(Schema.String)(href) || !safeLinkHref(href)) throw new Error("Document link has an unsafe URL.");
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
return document;
|
|
224
|
+
}
|
|
225
|
+
/** Seed missing identity once, without a browser opening the document producing an edit. */
|
|
226
|
+
function withBodyNodeIds(body) {
|
|
227
|
+
const document = checkedBody(body);
|
|
228
|
+
const transaction = new Transform(document);
|
|
229
|
+
const reserved = /* @__PURE__ */ new Set();
|
|
230
|
+
const seen = /* @__PURE__ */ new Set();
|
|
231
|
+
document.descendants((node) => {
|
|
232
|
+
if (Schema.is(Schema.NonEmptyString)(node.attrs.id)) reserved.add(node.attrs.id);
|
|
233
|
+
});
|
|
234
|
+
document.descendants((node, position) => {
|
|
235
|
+
if (!Object.hasOwn(node.attrs, "id")) return;
|
|
236
|
+
const id = node.attrs.id;
|
|
237
|
+
if (Schema.is(Schema.NonEmptyString)(id) && !seen.has(id)) {
|
|
238
|
+
seen.add(id);
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
let initial = `initial:${position}`;
|
|
242
|
+
let suffix = 0;
|
|
243
|
+
while (reserved.has(initial)) initial = `initial:${position}:${++suffix}`;
|
|
244
|
+
reserved.add(initial);
|
|
245
|
+
seen.add(initial);
|
|
246
|
+
transaction.setNodeMarkup(position, void 0, {
|
|
247
|
+
...node.attrs,
|
|
248
|
+
id: initial
|
|
249
|
+
});
|
|
250
|
+
});
|
|
251
|
+
return transaction.doc;
|
|
252
|
+
}
|
|
253
|
+
/** Schema defaults and initial body identity do not constitute an authored change. */
|
|
254
|
+
function sameDocumentSource(left, right) {
|
|
255
|
+
if (canonicalContent(left) === canonicalContent(right)) return true;
|
|
256
|
+
const normalize = (source) => {
|
|
257
|
+
const normalized = Object.assign({}, source, { body: withBodyNodeIds(source.body).toJSON() });
|
|
258
|
+
if (source.translations) Object.assign(normalized, { translations: Object.fromEntries(Object.entries(source.translations).map(([locale, content]) => [locale, Object.assign({}, content, { body: withBodyNodeIds(content.body).toJSON() })])) });
|
|
259
|
+
return Schema.encodeSync(DocumentSource)(normalized);
|
|
260
|
+
};
|
|
261
|
+
return canonicalContent(normalize(left)) === canonicalContent(normalize(right));
|
|
262
|
+
}
|
|
263
|
+
function sameDocumentContent(left, right) {
|
|
264
|
+
const settings = { placement: { kind: "home" } };
|
|
265
|
+
return sameDocumentSource(Object.assign({}, left, { settings }), Object.assign({}, right, { settings }));
|
|
266
|
+
}
|
|
267
|
+
function bodyMediaReferences(body) {
|
|
268
|
+
const references = [];
|
|
269
|
+
checkedBody(body).descendants((node, position) => {
|
|
270
|
+
if ((node.type.name === "image" || node.type.name === "video") && Schema.is(MediaId)(node.attrs.mediaId)) references.push({
|
|
271
|
+
mediaId: node.attrs.mediaId,
|
|
272
|
+
kind: node.type.name,
|
|
273
|
+
path: `body.${position}`
|
|
274
|
+
});
|
|
275
|
+
if (node.type.name === "video" && Schema.is(MediaId)(node.attrs.posterMediaId)) references.push({
|
|
276
|
+
mediaId: node.attrs.posterMediaId,
|
|
277
|
+
kind: "image",
|
|
278
|
+
path: `body.${position}.poster`
|
|
279
|
+
});
|
|
280
|
+
});
|
|
281
|
+
return references;
|
|
282
|
+
}
|
|
283
|
+
/** Independent copies retain content and references, while renewing authoring identities. */
|
|
284
|
+
function copyDocumentBody(body, nextId) {
|
|
285
|
+
const document = checkedBody(body);
|
|
286
|
+
const transaction = new Transform(document);
|
|
287
|
+
document.descendants((node, position) => {
|
|
288
|
+
if (Object.hasOwn(node.attrs, "id")) transaction.setNodeMarkup(position, void 0, {
|
|
289
|
+
...node.attrs,
|
|
290
|
+
id: nextId()
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
return Schema.decodeUnknownSync(DocumentBody)(transaction.doc.toJSON());
|
|
294
|
+
}
|
|
295
|
+
//#endregion
|
|
296
|
+
export { sameDocumentContent as a, editorSchema as i, checkedBody as n, sameDocumentSource as o, copyDocumentBody as r, withBodyNodeIds as s, bodyMediaReferences as t };
|