@velastack/cms 0.1.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 +21 -0
- package/README.md +644 -0
- package/dist/cms.d.ts +6 -0
- package/dist/cms.js +30 -0
- package/dist/components/admin-bar/admin-bar-internal.svelte +1697 -0
- package/dist/components/admin-bar/admin-bar-internal.svelte.d.ts +12 -0
- package/dist/components/admin-bar/admin-bar.css +5 -0
- package/dist/components/admin-bar/admin-bar.svelte +355 -0
- package/dist/components/admin-bar/admin-bar.svelte.d.ts +7 -0
- package/dist/components/admin-bar/click-outside.d.ts +8 -0
- package/dist/components/admin-bar/click-outside.js +17 -0
- package/dist/components/admin-bar/css-root.svelte +23 -0
- package/dist/components/admin-bar/css-root.svelte.d.ts +19 -0
- package/dist/components/admin-bar/delete-page-dialog.svelte +326 -0
- package/dist/components/admin-bar/delete-page-dialog.svelte.d.ts +32 -0
- package/dist/components/admin-bar/history-panel.svelte +264 -0
- package/dist/components/admin-bar/history-panel.svelte.d.ts +8 -0
- package/dist/components/admin-bar/icons/bold.svelte +13 -0
- package/dist/components/admin-bar/icons/bold.svelte.d.ts +3 -0
- package/dist/components/admin-bar/icons/check.svelte +11 -0
- package/dist/components/admin-bar/icons/check.svelte.d.ts +3 -0
- package/dist/components/admin-bar/icons/chevron-down.svelte +11 -0
- package/dist/components/admin-bar/icons/chevron-down.svelte.d.ts +3 -0
- package/dist/components/admin-bar/icons/chevron-right.svelte +11 -0
- package/dist/components/admin-bar/icons/chevron-right.svelte.d.ts +3 -0
- package/dist/components/admin-bar/icons/chevron-up.svelte +11 -0
- package/dist/components/admin-bar/icons/chevron-up.svelte.d.ts +3 -0
- package/dist/components/admin-bar/icons/code.svelte +14 -0
- package/dist/components/admin-bar/icons/code.svelte.d.ts +3 -0
- package/dist/components/admin-bar/icons/external-link.svelte +15 -0
- package/dist/components/admin-bar/icons/external-link.svelte.d.ts +3 -0
- package/dist/components/admin-bar/icons/file.svelte +19 -0
- package/dist/components/admin-bar/icons/file.svelte.d.ts +3 -0
- package/dist/components/admin-bar/icons/heading-2.svelte +16 -0
- package/dist/components/admin-bar/icons/heading-2.svelte.d.ts +3 -0
- package/dist/components/admin-bar/icons/heading-3.svelte +17 -0
- package/dist/components/admin-bar/icons/heading-3.svelte.d.ts +3 -0
- package/dist/components/admin-bar/icons/icon.svelte +41 -0
- package/dist/components/admin-bar/icons/icon.svelte.d.ts +21 -0
- package/dist/components/admin-bar/icons/images.svelte +16 -0
- package/dist/components/admin-bar/icons/images.svelte.d.ts +3 -0
- package/dist/components/admin-bar/icons/italic.svelte +15 -0
- package/dist/components/admin-bar/icons/italic.svelte.d.ts +3 -0
- package/dist/components/admin-bar/icons/link-2-off.svelte +16 -0
- package/dist/components/admin-bar/icons/link-2-off.svelte.d.ts +3 -0
- package/dist/components/admin-bar/icons/link.svelte +14 -0
- package/dist/components/admin-bar/icons/link.svelte.d.ts +3 -0
- package/dist/components/admin-bar/icons/list-ordered.svelte +18 -0
- package/dist/components/admin-bar/icons/list-ordered.svelte.d.ts +3 -0
- package/dist/components/admin-bar/icons/list.svelte +18 -0
- package/dist/components/admin-bar/icons/list.svelte.d.ts +3 -0
- package/dist/components/admin-bar/icons/loader-circle.svelte +11 -0
- package/dist/components/admin-bar/icons/loader-circle.svelte.d.ts +3 -0
- package/dist/components/admin-bar/icons/minus.svelte +11 -0
- package/dist/components/admin-bar/icons/minus.svelte.d.ts +3 -0
- package/dist/components/admin-bar/icons/quote.svelte +24 -0
- package/dist/components/admin-bar/icons/quote.svelte.d.ts +3 -0
- package/dist/components/admin-bar/icons/search.svelte +14 -0
- package/dist/components/admin-bar/icons/search.svelte.d.ts +3 -0
- package/dist/components/admin-bar/icons/trash-2.svelte +17 -0
- package/dist/components/admin-bar/icons/trash-2.svelte.d.ts +3 -0
- package/dist/components/admin-bar/icons/triangle-alert.svelte +15 -0
- package/dist/components/admin-bar/icons/triangle-alert.svelte.d.ts +3 -0
- package/dist/components/admin-bar/icons/types.d.ts +7 -0
- package/dist/components/admin-bar/icons/types.js +1 -0
- package/dist/components/admin-bar/icons/undo-2.svelte +14 -0
- package/dist/components/admin-bar/icons/undo-2.svelte.d.ts +3 -0
- package/dist/components/admin-bar/icons/upload.svelte +15 -0
- package/dist/components/admin-bar/icons/upload.svelte.d.ts +3 -0
- package/dist/components/admin-bar/icons/x.svelte +14 -0
- package/dist/components/admin-bar/icons/x.svelte.d.ts +3 -0
- package/dist/components/admin-bar/keyboard-shortcuts-dialog.svelte +96 -0
- package/dist/components/admin-bar/keyboard-shortcuts-dialog.svelte.d.ts +7 -0
- package/dist/components/admin-bar/locales-panel.svelte +137 -0
- package/dist/components/admin-bar/locales-panel.svelte.d.ts +9 -0
- package/dist/components/admin-bar/media-panel.svelte +282 -0
- package/dist/components/admin-bar/media-panel.svelte.d.ts +7 -0
- package/dist/components/admin-bar/new-page-chooser-dialog.svelte +56 -0
- package/dist/components/admin-bar/new-page-chooser-dialog.svelte.d.ts +10 -0
- package/dist/components/admin-bar/new-page-dialog.svelte +126 -0
- package/dist/components/admin-bar/new-page-dialog.svelte.d.ts +14 -0
- package/dist/components/admin-bar/page-config.d.ts +61 -0
- package/dist/components/admin-bar/page-config.js +24 -0
- package/dist/components/admin-bar/pages-panel.svelte +639 -0
- package/dist/components/admin-bar/pages-panel.svelte.d.ts +13 -0
- package/dist/components/admin-bar/panel-footer.svelte +21 -0
- package/dist/components/admin-bar/panel-footer.svelte.d.ts +8 -0
- package/dist/components/admin-bar/panel-header.svelte +29 -0
- package/dist/components/admin-bar/panel-header.svelte.d.ts +10 -0
- package/dist/components/admin-bar/panel.svelte +41 -0
- package/dist/components/admin-bar/panel.svelte.d.ts +10 -0
- package/dist/components/admin-bar/publish-dialog.svelte +387 -0
- package/dist/components/admin-bar/publish-dialog.svelte.d.ts +16 -0
- package/dist/components/admin-bar/resolve-route.d.ts +20 -0
- package/dist/components/admin-bar/resolve-route.js +50 -0
- package/dist/components/admin-bar/seo-panel.svelte +387 -0
- package/dist/components/admin-bar/seo-panel.svelte.d.ts +7 -0
- package/dist/components/admin-bar/share-preview-link-dialog.svelte +97 -0
- package/dist/components/admin-bar/share-preview-link-dialog.svelte.d.ts +9 -0
- package/dist/components/admin-bar/site-settings-panel.svelte +225 -0
- package/dist/components/admin-bar/site-settings-panel.svelte.d.ts +7 -0
- package/dist/components/admin-bar/status-pill.svelte +49 -0
- package/dist/components/admin-bar/status-pill.svelte.d.ts +11 -0
- package/dist/components/admin-bar/theme.svelte.d.ts +16 -0
- package/dist/components/admin-bar/theme.svelte.js +39 -0
- package/dist/components/admin-bar/ui/badge/badge.svelte +57 -0
- package/dist/components/admin-bar/ui/badge/badge.svelte.d.ts +16 -0
- package/dist/components/admin-bar/ui/badge/index.d.ts +4 -0
- package/dist/components/admin-bar/ui/badge/index.js +4 -0
- package/dist/components/admin-bar/ui/button/button.svelte +73 -0
- package/dist/components/admin-bar/ui/button/button.svelte.d.ts +16 -0
- package/dist/components/admin-bar/ui/button/index.d.ts +4 -0
- package/dist/components/admin-bar/ui/button/index.js +4 -0
- package/dist/components/admin-bar/ui/collapsible/collapsible-content.svelte +7 -0
- package/dist/components/admin-bar/ui/collapsible/collapsible-content.svelte.d.ts +4 -0
- package/dist/components/admin-bar/ui/collapsible/collapsible-trigger.svelte +7 -0
- package/dist/components/admin-bar/ui/collapsible/collapsible-trigger.svelte.d.ts +4 -0
- package/dist/components/admin-bar/ui/collapsible/collapsible.svelte +7 -0
- package/dist/components/admin-bar/ui/collapsible/collapsible.svelte.d.ts +4 -0
- package/dist/components/admin-bar/ui/collapsible/index.d.ts +4 -0
- package/dist/components/admin-bar/ui/collapsible/index.js +6 -0
- package/dist/components/admin-bar/ui/dialog/dialog-close.svelte +7 -0
- package/dist/components/admin-bar/ui/dialog/dialog-close.svelte.d.ts +4 -0
- package/dist/components/admin-bar/ui/dialog/dialog-content.svelte +46 -0
- package/dist/components/admin-bar/ui/dialog/dialog-content.svelte.d.ts +11 -0
- package/dist/components/admin-bar/ui/dialog/dialog-description.svelte +17 -0
- package/dist/components/admin-bar/ui/dialog/dialog-description.svelte.d.ts +4 -0
- package/dist/components/admin-bar/ui/dialog/dialog-footer.svelte +23 -0
- package/dist/components/admin-bar/ui/dialog/dialog-footer.svelte.d.ts +5 -0
- package/dist/components/admin-bar/ui/dialog/dialog-header.svelte +20 -0
- package/dist/components/admin-bar/ui/dialog/dialog-header.svelte.d.ts +5 -0
- package/dist/components/admin-bar/ui/dialog/dialog-overlay.svelte +20 -0
- package/dist/components/admin-bar/ui/dialog/dialog-overlay.svelte.d.ts +4 -0
- package/dist/components/admin-bar/ui/dialog/dialog-portal.svelte +7 -0
- package/dist/components/admin-bar/ui/dialog/dialog-portal.svelte.d.ts +3 -0
- package/dist/components/admin-bar/ui/dialog/dialog-title.svelte +17 -0
- package/dist/components/admin-bar/ui/dialog/dialog-title.svelte.d.ts +4 -0
- package/dist/components/admin-bar/ui/dialog/dialog-trigger.svelte +7 -0
- package/dist/components/admin-bar/ui/dialog/dialog-trigger.svelte.d.ts +4 -0
- package/dist/components/admin-bar/ui/dialog/dialog.svelte +7 -0
- package/dist/components/admin-bar/ui/dialog/dialog.svelte.d.ts +3 -0
- package/dist/components/admin-bar/ui/dialog/index.d.ts +11 -0
- package/dist/components/admin-bar/ui/dialog/index.js +13 -0
- package/dist/components/admin-bar/ui/input/index.d.ts +3 -0
- package/dist/components/admin-bar/ui/input/index.js +3 -0
- package/dist/components/admin-bar/ui/input/input.svelte +24 -0
- package/dist/components/admin-bar/ui/input/input.svelte.d.ts +5 -0
- package/dist/components/admin-bar/ui/kbd/index.d.ts +4 -0
- package/dist/components/admin-bar/ui/kbd/index.js +6 -0
- package/dist/components/admin-bar/ui/kbd/kbd-group.svelte +20 -0
- package/dist/components/admin-bar/ui/kbd/kbd-group.svelte.d.ts +5 -0
- package/dist/components/admin-bar/ui/kbd/kbd-shortcut.svelte +52 -0
- package/dist/components/admin-bar/ui/kbd/kbd-shortcut.svelte.d.ts +8 -0
- package/dist/components/admin-bar/ui/kbd/kbd.svelte +27 -0
- package/dist/components/admin-bar/ui/kbd/kbd.svelte.d.ts +5 -0
- package/dist/components/admin-bar/ui/label/index.d.ts +3 -0
- package/dist/components/admin-bar/ui/label/index.js +3 -0
- package/dist/components/admin-bar/ui/label/label.svelte +20 -0
- package/dist/components/admin-bar/ui/label/label.svelte.d.ts +4 -0
- package/dist/components/admin-bar/ui/menubar/index.d.ts +18 -0
- package/dist/components/admin-bar/ui/menubar/index.js +20 -0
- package/dist/components/admin-bar/ui/menubar/menubar-checkbox-item.svelte +46 -0
- package/dist/components/admin-bar/ui/menubar/menubar-checkbox-item.svelte.d.ts +10 -0
- package/dist/components/admin-bar/ui/menubar/menubar-content.svelte +28 -0
- package/dist/components/admin-bar/ui/menubar/menubar-content.svelte.d.ts +4 -0
- package/dist/components/admin-bar/ui/menubar/menubar-group-heading.svelte +25 -0
- package/dist/components/admin-bar/ui/menubar/menubar-group-heading.svelte.d.ts +8 -0
- package/dist/components/admin-bar/ui/menubar/menubar-group.svelte +12 -0
- package/dist/components/admin-bar/ui/menubar/menubar-group.svelte.d.ts +7 -0
- package/dist/components/admin-bar/ui/menubar/menubar-item.svelte +27 -0
- package/dist/components/admin-bar/ui/menubar/menubar-item.svelte.d.ts +8 -0
- package/dist/components/admin-bar/ui/menubar/menubar-label.svelte +25 -0
- package/dist/components/admin-bar/ui/menubar/menubar-label.svelte.d.ts +8 -0
- package/dist/components/admin-bar/ui/menubar/menubar-menu.svelte +7 -0
- package/dist/components/admin-bar/ui/menubar/menubar-menu.svelte.d.ts +3 -0
- package/dist/components/admin-bar/ui/menubar/menubar-portal.svelte +7 -0
- package/dist/components/admin-bar/ui/menubar/menubar-portal.svelte.d.ts +3 -0
- package/dist/components/admin-bar/ui/menubar/menubar-radio-group.svelte +11 -0
- package/dist/components/admin-bar/ui/menubar/menubar-radio-group.svelte.d.ts +4 -0
- package/dist/components/admin-bar/ui/menubar/menubar-radio-item.svelte +37 -0
- package/dist/components/admin-bar/ui/menubar/menubar-radio-item.svelte.d.ts +8 -0
- package/dist/components/admin-bar/ui/menubar/menubar-separator.svelte +17 -0
- package/dist/components/admin-bar/ui/menubar/menubar-separator.svelte.d.ts +4 -0
- package/dist/components/admin-bar/ui/menubar/menubar-shortcut.svelte +23 -0
- package/dist/components/admin-bar/ui/menubar/menubar-shortcut.svelte.d.ts +5 -0
- package/dist/components/admin-bar/ui/menubar/menubar-sub-content.svelte +20 -0
- package/dist/components/admin-bar/ui/menubar/menubar-sub-content.svelte.d.ts +4 -0
- package/dist/components/admin-bar/ui/menubar/menubar-sub-trigger.svelte +29 -0
- package/dist/components/admin-bar/ui/menubar/menubar-sub-trigger.svelte.d.ts +8 -0
- package/dist/components/admin-bar/ui/menubar/menubar-sub.svelte +7 -0
- package/dist/components/admin-bar/ui/menubar/menubar-sub.svelte.d.ts +4 -0
- package/dist/components/admin-bar/ui/menubar/menubar-trigger.svelte +20 -0
- package/dist/components/admin-bar/ui/menubar/menubar-trigger.svelte.d.ts +4 -0
- package/dist/components/admin-bar/ui/menubar/menubar.svelte +20 -0
- package/dist/components/admin-bar/ui/menubar/menubar.svelte.d.ts +4 -0
- package/dist/components/admin-bar/ui/select/index.d.ts +12 -0
- package/dist/components/admin-bar/ui/select/index.js +14 -0
- package/dist/components/admin-bar/ui/select/select-content.svelte +45 -0
- package/dist/components/admin-bar/ui/select/select-content.svelte.d.ts +11 -0
- package/dist/components/admin-bar/ui/select/select-group-heading.svelte +21 -0
- package/dist/components/admin-bar/ui/select/select-group-heading.svelte.d.ts +10 -0
- package/dist/components/admin-bar/ui/select/select-group.svelte +17 -0
- package/dist/components/admin-bar/ui/select/select-group.svelte.d.ts +4 -0
- package/dist/components/admin-bar/ui/select/select-item.svelte +40 -0
- package/dist/components/admin-bar/ui/select/select-item.svelte.d.ts +5 -0
- package/dist/components/admin-bar/ui/select/select-label.svelte +20 -0
- package/dist/components/admin-bar/ui/select/select-label.svelte.d.ts +6 -0
- package/dist/components/admin-bar/ui/select/select-portal.svelte +7 -0
- package/dist/components/admin-bar/ui/select/select-portal.svelte.d.ts +3 -0
- package/dist/components/admin-bar/ui/select/select-scroll-down-button.svelte +23 -0
- package/dist/components/admin-bar/ui/select/select-scroll-down-button.svelte.d.ts +5 -0
- package/dist/components/admin-bar/ui/select/select-scroll-up-button.svelte +23 -0
- package/dist/components/admin-bar/ui/select/select-scroll-up-button.svelte.d.ts +5 -0
- package/dist/components/admin-bar/ui/select/select-separator.svelte +21 -0
- package/dist/components/admin-bar/ui/select/select-separator.svelte.d.ts +4 -0
- package/dist/components/admin-bar/ui/select/select-trigger.svelte +31 -0
- package/dist/components/admin-bar/ui/select/select-trigger.svelte.d.ts +8 -0
- package/dist/components/admin-bar/ui/select/select.svelte +11 -0
- package/dist/components/admin-bar/ui/select/select.svelte.d.ts +3 -0
- package/dist/components/admin-bar/ui/separator/index.d.ts +2 -0
- package/dist/components/admin-bar/ui/separator/index.js +4 -0
- package/dist/components/admin-bar/ui/separator/separator.svelte +21 -0
- package/dist/components/admin-bar/ui/separator/separator.svelte.d.ts +4 -0
- package/dist/components/admin-bar/ui/textarea/index.d.ts +3 -0
- package/dist/components/admin-bar/ui/textarea/index.js +3 -0
- package/dist/components/admin-bar/ui/textarea/textarea.svelte +21 -0
- package/dist/components/admin-bar/ui/textarea/textarea.svelte.d.ts +5 -0
- package/dist/components/admin-bar/user-avatar.svelte +29 -0
- package/dist/components/admin-bar/user-avatar.svelte.d.ts +7 -0
- package/dist/components/admin-bar/utils.d.ts +10 -0
- package/dist/components/admin-bar/utils.js +46 -0
- package/dist/components/admin-bar/variants.d.ts +20 -0
- package/dist/components/admin-bar/variants.js +14 -0
- package/dist/components/cms/cms-boolean.svelte +102 -0
- package/dist/components/cms/cms-boolean.svelte.d.ts +10 -0
- package/dist/components/cms/cms-date-time-editable.svelte +66 -0
- package/dist/components/cms/cms-date-time-editable.svelte.d.ts +11 -0
- package/dist/components/cms/cms-date-time.svelte +67 -0
- package/dist/components/cms/cms-date-time.svelte.d.ts +19 -0
- package/dist/components/cms/cms-entries.svelte +24 -0
- package/dist/components/cms/cms-entries.svelte.d.ts +31 -0
- package/dist/components/cms/cms-image-editable.svelte +439 -0
- package/dist/components/cms/cms-image-editable.svelte.d.ts +11 -0
- package/dist/components/cms/cms-image.svelte +78 -0
- package/dist/components/cms/cms-image.svelte.d.ts +18 -0
- package/dist/components/cms/cms-link-editable.svelte +429 -0
- package/dist/components/cms/cms-link-editable.svelte.d.ts +13 -0
- package/dist/components/cms/cms-link.svelte +92 -0
- package/dist/components/cms/cms-link.svelte.d.ts +25 -0
- package/dist/components/cms/cms-markdown-editable.svelte +74 -0
- package/dist/components/cms/cms-markdown-editable.svelte.d.ts +9 -0
- package/dist/components/cms/cms-markdown.svelte +56 -0
- package/dist/components/cms/cms-markdown.svelte.d.ts +10 -0
- package/dist/components/cms/cms-media-picker.svelte +150 -0
- package/dist/components/cms/cms-media-picker.svelte.d.ts +8 -0
- package/dist/components/cms/cms-number-editable.svelte +77 -0
- package/dist/components/cms/cms-number-editable.svelte.d.ts +13 -0
- package/dist/components/cms/cms-number.svelte +63 -0
- package/dist/components/cms/cms-number.svelte.d.ts +16 -0
- package/dist/components/cms/cms-repeater-editable.svelte +137 -0
- package/dist/components/cms/cms-repeater-editable.svelte.d.ts +31 -0
- package/dist/components/cms/cms-repeater.svelte +55 -0
- package/dist/components/cms/cms-repeater.svelte.d.ts +30 -0
- package/dist/components/cms/cms-rich-text-editable.svelte +101 -0
- package/dist/components/cms/cms-rich-text-editable.svelte.d.ts +9 -0
- package/dist/components/cms/cms-rich-text-toolbar.svelte +246 -0
- package/dist/components/cms/cms-rich-text-toolbar.svelte.d.ts +9 -0
- package/dist/components/cms/cms-rich-text.svelte +74 -0
- package/dist/components/cms/cms-rich-text.svelte.d.ts +10 -0
- package/dist/components/cms/cms-store.svelte.d.ts +294 -0
- package/dist/components/cms/cms-store.svelte.js +625 -0
- package/dist/components/cms/cms-text.svelte +131 -0
- package/dist/components/cms/cms-text.svelte.d.ts +11 -0
- package/dist/components/cms/index.d.ts +13 -0
- package/dist/components/cms/index.js +11 -0
- package/dist/components/cms/install-scope.svelte.d.ts +7 -0
- package/dist/components/cms/install-scope.svelte.js +33 -0
- package/dist/components/cms/locale-merge.d.ts +41 -0
- package/dist/components/cms/locale-merge.js +77 -0
- package/dist/components/cms/overlay-sync.d.ts +82 -0
- package/dist/components/cms/overlay-sync.js +76 -0
- package/dist/components/cms/path.d.ts +30 -0
- package/dist/components/cms/path.js +156 -0
- package/dist/components/cms/scope.d.ts +120 -0
- package/dist/components/cms/scope.js +23 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +28 -0
- package/dist/srv/README.md +341 -0
- package/dist/srv/api-adapter.d.ts +20 -0
- package/dist/srv/api-adapter.js +178 -0
- package/dist/srv/cms.d.ts +62 -0
- package/dist/srv/cms.js +35 -0
- package/dist/srv/index.d.ts +5 -0
- package/dist/srv/index.js +4 -0
- package/dist/srv/load-cms.d.ts +105 -0
- package/dist/srv/load-cms.js +227 -0
- package/dist/srv/mock-adapter.d.ts +96 -0
- package/dist/srv/mock-adapter.js +171 -0
- package/dist/srv/types.d.ts +114 -0
- package/dist/srv/types.js +1 -0
- package/package.json +116 -0
- package/plugin/README.md +137 -0
- package/plugin/dist/adapter.d.ts +35 -0
- package/plugin/dist/adapter.js +346 -0
- package/plugin/dist/adapter.js.map +1 -0
- package/plugin/dist/build-state.d.ts +10 -0
- package/plugin/dist/build-state.js +26 -0
- package/plugin/dist/build-state.js.map +1 -0
- package/plugin/dist/fallback-shim.js +194 -0
- package/plugin/dist/index.d.ts +56 -0
- package/plugin/dist/index.js +396 -0
- package/plugin/dist/index.js.map +1 -0
- package/plugin/dist/manifest.d.ts +76 -0
- package/plugin/dist/manifest.js +367 -0
- package/plugin/dist/manifest.js.map +1 -0
- package/plugin/dist/media.d.ts +36 -0
- package/plugin/dist/media.js +153 -0
- package/plugin/dist/media.js.map +1 -0
- package/plugin/dist/parse-svelte.d.ts +35 -0
- package/plugin/dist/parse-svelte.js +120 -0
- package/plugin/dist/parse-svelte.js.map +1 -0
- package/plugin/dist/route-tree.d.ts +27 -0
- package/plugin/dist/route-tree.js +69 -0
- package/plugin/dist/route-tree.js.map +1 -0
- package/plugin/dist/transforms.d.ts +42 -0
- package/plugin/dist/transforms.js +95 -0
- package/plugin/dist/transforms.js.map +1 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
export declare const CMS_SCOPE: unique symbol;
|
|
2
|
+
export type CmsScope = {
|
|
3
|
+
scopeId: string;
|
|
4
|
+
kind: 'layout' | 'page';
|
|
5
|
+
routeId: string;
|
|
6
|
+
params: Record<string, string>;
|
|
7
|
+
};
|
|
8
|
+
export type CmsScopeEntry = {
|
|
9
|
+
scopeId: string;
|
|
10
|
+
kind: 'layout' | 'page';
|
|
11
|
+
routeId: string;
|
|
12
|
+
params: Record<string, string>;
|
|
13
|
+
/**
|
|
14
|
+
* Lodash-style paths used by Cms* components in this scope. For pages the
|
|
15
|
+
* `metadata` branch shows up here too (e.g. `'metadata.title'`).
|
|
16
|
+
*/
|
|
17
|
+
fields: string[];
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Schema for the project-wide site scope. Authored on `createCms({ site })`.
|
|
21
|
+
* Top-level keys are sections rendered as groups in the Site Settings panel;
|
|
22
|
+
* each section's `fields` keys become path segments in the stored tree
|
|
23
|
+
* (`branding.name`, `social.twitter`).
|
|
24
|
+
*
|
|
25
|
+
* `type` selects the input widget. Storage is unconstrained — the schema is
|
|
26
|
+
* a UI hint, not an enforced type for the underlying tree (to keep the data
|
|
27
|
+
* model uniform with pages/layouts and avoid destructive prunes when fields
|
|
28
|
+
* are added/removed).
|
|
29
|
+
*/
|
|
30
|
+
export type SiteFieldType = 'text' | 'markdown' | 'number' | 'datetime' | 'url' | 'color' | 'image';
|
|
31
|
+
export type SiteFieldSchema = {
|
|
32
|
+
type: SiteFieldType;
|
|
33
|
+
label: string;
|
|
34
|
+
placeholder?: string;
|
|
35
|
+
};
|
|
36
|
+
export type SiteSectionSchema = {
|
|
37
|
+
label: string;
|
|
38
|
+
fields: Record<string, SiteFieldSchema>;
|
|
39
|
+
};
|
|
40
|
+
export type SiteSchema = Record<string, SiteSectionSchema>;
|
|
41
|
+
/**
|
|
42
|
+
* Resolved identity of the page-kind doc for the current request. Set only
|
|
43
|
+
* when a page-kind scope is present on the route; `null` otherwise.
|
|
44
|
+
*/
|
|
45
|
+
export type CmsPagePointer = {
|
|
46
|
+
scopeId: string;
|
|
47
|
+
routeId: string;
|
|
48
|
+
params: Record<string, string>;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* One publishable page-kind entry. Mirrored from `srv/types.ts` so client-only
|
|
52
|
+
* code (`<CmsEntries>`, the merged `cms` view) can read entries without
|
|
53
|
+
* importing server modules. The server type re-exports this one.
|
|
54
|
+
*
|
|
55
|
+
* `redirectTo` and `gone` are tombstone flags — when set, this entry is not a
|
|
56
|
+
* listable page but a deletion marker. Adapters surface tombstones in
|
|
57
|
+
* `fetchEntries` so prerender visits redirect URLs (and SvelteKit emits the
|
|
58
|
+
* redirect file); consumer-facing payloads (`cms.entries[routeId]`) should
|
|
59
|
+
* filter tombstones out before display.
|
|
60
|
+
*/
|
|
61
|
+
export type CmsEntry<Params extends Record<string, string> = Record<string, string>> = {
|
|
62
|
+
params: Params;
|
|
63
|
+
metadata: Record<string, unknown>;
|
|
64
|
+
redirectTo?: string;
|
|
65
|
+
gone?: boolean;
|
|
66
|
+
};
|
|
67
|
+
export type CmsPayload = {
|
|
68
|
+
/** BCP-47 locale resolved for this request. */
|
|
69
|
+
locale: string;
|
|
70
|
+
/**
|
|
71
|
+
* BCP-47 supported locales from `createCms({ locales })`. First entry is
|
|
72
|
+
* the default locale used for read-time fallback when a value is missing
|
|
73
|
+
* in the requested `locale`.
|
|
74
|
+
*/
|
|
75
|
+
locales: string[];
|
|
76
|
+
/** Keyed by `scopeId`. */
|
|
77
|
+
docs: Record<string, Record<string, unknown>>;
|
|
78
|
+
/** Keyed by `scopeId`. */
|
|
79
|
+
scopes: Record<string, CmsScopeEntry>;
|
|
80
|
+
/** Page-scoped metadata for the current route (top-level by design — see PLAN.md). */
|
|
81
|
+
metadata: Record<string, unknown>;
|
|
82
|
+
/** Entries for routes referenced by `<CmsEntries routeId="…">` on this route. Keyed by routeId. */
|
|
83
|
+
entries: Record<string, CmsEntry[]>;
|
|
84
|
+
endpoint: string;
|
|
85
|
+
page: CmsPagePointer | null;
|
|
86
|
+
/**
|
|
87
|
+
* Project-wide site settings: schema authored on `createCms({ site })`,
|
|
88
|
+
* tree fetched per request from `/site` (preview-overlay-aware). Read at
|
|
89
|
+
* runtime through the reactive `cmsStore.site` — the load payload is the
|
|
90
|
+
* SSR seed.
|
|
91
|
+
*/
|
|
92
|
+
site: {
|
|
93
|
+
schema: SiteSchema;
|
|
94
|
+
tree: Record<string, unknown>;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
export type CmsManifestScope = {
|
|
98
|
+
scopeId: string;
|
|
99
|
+
kind: 'layout' | 'page';
|
|
100
|
+
routeId: string;
|
|
101
|
+
ownedParams: string[];
|
|
102
|
+
/**
|
|
103
|
+
* Lodash-style paths used by Cms* components in this scope. For pages the
|
|
104
|
+
* `metadata` branch shows up here too (e.g. `'metadata.title'`).
|
|
105
|
+
*/
|
|
106
|
+
fields: string[];
|
|
107
|
+
};
|
|
108
|
+
export type CmsManifestRoute = {
|
|
109
|
+
scopes: CmsManifestScope[];
|
|
110
|
+
/** Route ids referenced by `<CmsEntries routeId="…">` anywhere in this route's chain. */
|
|
111
|
+
entriesRouteIds: string[];
|
|
112
|
+
};
|
|
113
|
+
export type CmsManifest = {
|
|
114
|
+
version: 1;
|
|
115
|
+
routes: Record<string, CmsManifestRoute>;
|
|
116
|
+
};
|
|
117
|
+
export declare const getCmsScope: () => CmsScope | undefined;
|
|
118
|
+
export declare const getCmsValue: (cms: CmsPayload | undefined, scope: CmsScope | undefined, name: string) => unknown;
|
|
119
|
+
/** Find the page-scoped entry in a payload (the leaf scope), if any. */
|
|
120
|
+
export declare const getPageScope: (cms: CmsPayload | undefined) => CmsScopeEntry | undefined;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scope context shared by CMS components. The Vite plugin auto-injects
|
|
3
|
+
* `setContext(CMS_SCOPE, …)` into every `+layout.svelte` / `+page.svelte` via
|
|
4
|
+
* the `installCmsScope` helper.
|
|
5
|
+
*/
|
|
6
|
+
import { getContext } from 'svelte';
|
|
7
|
+
export const CMS_SCOPE = Symbol('vela-cms:scope');
|
|
8
|
+
export const getCmsScope = () => getContext(CMS_SCOPE);
|
|
9
|
+
export const getCmsValue = (cms, scope, name) => {
|
|
10
|
+
if (!cms || !scope)
|
|
11
|
+
return undefined;
|
|
12
|
+
return cms.docs[scope.scopeId]?.[name];
|
|
13
|
+
};
|
|
14
|
+
/** Find the page-scoped entry in a payload (the leaf scope), if any. */
|
|
15
|
+
export const getPageScope = (cms) => {
|
|
16
|
+
if (!cms)
|
|
17
|
+
return undefined;
|
|
18
|
+
for (const entry of Object.values(cms.scopes)) {
|
|
19
|
+
if (entry.kind === 'page')
|
|
20
|
+
return entry;
|
|
21
|
+
}
|
|
22
|
+
return undefined;
|
|
23
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public client-side API for Velastack CMS.
|
|
3
|
+
*
|
|
4
|
+
* Server entry points (`loadCms`, `mockAdapter`, the `CmsAdapter` interface)
|
|
5
|
+
* live at `@velastack/cms/server`. The Vite plugin lives at `@velastack/cms/vite`.
|
|
6
|
+
*/
|
|
7
|
+
export { default as CmsText } from './components/cms/cms-text.svelte';
|
|
8
|
+
export { default as CmsRichText } from './components/cms/cms-rich-text.svelte';
|
|
9
|
+
export { default as CmsMarkdown } from './components/cms/cms-markdown.svelte';
|
|
10
|
+
export { default as CmsImage } from './components/cms/cms-image.svelte';
|
|
11
|
+
export { default as CmsBoolean } from './components/cms/cms-boolean.svelte';
|
|
12
|
+
export { default as CmsNumber } from './components/cms/cms-number.svelte';
|
|
13
|
+
export type { CmsNumberProps } from './components/cms/cms-number.svelte';
|
|
14
|
+
export { default as CmsDateTime } from './components/cms/cms-date-time.svelte';
|
|
15
|
+
export type { CmsDateTimeMode, CmsDateTimeProps } from './components/cms/cms-date-time.svelte';
|
|
16
|
+
export { default as CmsLink } from './components/cms/cms-link.svelte';
|
|
17
|
+
export type { CmsLinkValue, CmsLinkRenderProps } from './components/cms/cms-link.svelte';
|
|
18
|
+
export { default as CmsRepeater } from './components/cms/cms-repeater.svelte';
|
|
19
|
+
export { default as CmsEntries } from './components/cms/cms-entries.svelte';
|
|
20
|
+
export { default as AdminBar } from './components/admin-bar/admin-bar.svelte';
|
|
21
|
+
export { definePage } from './components/admin-bar/page-config.js';
|
|
22
|
+
export type { CmsPageConfig, CmsCreatablePageConfig, CmsStaticPageConfig, CmsPageField, CmsPageMetadataSchema, MetadataFieldSchema, MetadataPrimitive } from './components/admin-bar/page-config.js';
|
|
23
|
+
export { cmsStore } from './components/cms/cms-store.svelte.js';
|
|
24
|
+
export { cms } from './components/cms/cms-store.svelte.js';
|
|
25
|
+
export { CMS_SCOPE, getCmsScope, getCmsValue, getPageScope } from './components/cms/scope.js';
|
|
26
|
+
export { installCmsScope } from './components/cms/install-scope.svelte.js';
|
|
27
|
+
export type { CmsEntry, CmsManifest, CmsManifestRoute, CmsManifestScope, CmsPayload, CmsScope, CmsScopeEntry } from './components/cms/scope.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public client-side API for Velastack CMS.
|
|
3
|
+
*
|
|
4
|
+
* Server entry points (`loadCms`, `mockAdapter`, the `CmsAdapter` interface)
|
|
5
|
+
* live at `@velastack/cms/server`. The Vite plugin lives at `@velastack/cms/vite`.
|
|
6
|
+
*/
|
|
7
|
+
// Display components
|
|
8
|
+
export { default as CmsText } from './components/cms/cms-text.svelte';
|
|
9
|
+
export { default as CmsRichText } from './components/cms/cms-rich-text.svelte';
|
|
10
|
+
export { default as CmsMarkdown } from './components/cms/cms-markdown.svelte';
|
|
11
|
+
export { default as CmsImage } from './components/cms/cms-image.svelte';
|
|
12
|
+
export { default as CmsBoolean } from './components/cms/cms-boolean.svelte';
|
|
13
|
+
export { default as CmsNumber } from './components/cms/cms-number.svelte';
|
|
14
|
+
export { default as CmsDateTime } from './components/cms/cms-date-time.svelte';
|
|
15
|
+
export { default as CmsLink } from './components/cms/cms-link.svelte';
|
|
16
|
+
export { default as CmsRepeater } from './components/cms/cms-repeater.svelte';
|
|
17
|
+
export { default as CmsEntries } from './components/cms/cms-entries.svelte';
|
|
18
|
+
// Admin bar (sync wrapper; admin-bar-internal + seo-panel are async chunks)
|
|
19
|
+
export { default as AdminBar } from './components/admin-bar/admin-bar.svelte';
|
|
20
|
+
// Per-route page configuration — declare in `page.cms.ts` next to `+page.svelte`.
|
|
21
|
+
export { definePage } from './components/admin-bar/page-config.js';
|
|
22
|
+
// Edit-mode store
|
|
23
|
+
export { cmsStore } from './components/cms/cms-store.svelte.js';
|
|
24
|
+
// Merged CMS read view (server payload + client overlay), shaped like CmsPayload
|
|
25
|
+
export { cms } from './components/cms/cms-store.svelte.js';
|
|
26
|
+
// Scope context + helpers (used by the Vite plugin's auto-injection)
|
|
27
|
+
export { CMS_SCOPE, getCmsScope, getCmsValue, getPageScope } from './components/cms/scope.js';
|
|
28
|
+
export { installCmsScope } from './components/cms/install-scope.svelte.js';
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
# `@velastack/cms/server` — server-side runtime
|
|
2
|
+
|
|
3
|
+
The piece that runs inside SvelteKit's server load. Reads the build-time
|
|
4
|
+
manifest produced by [`@velastack/cms/vite`](../../../plugin/README.md), asks a
|
|
5
|
+
backend-agnostic adapter for the relevant docs, and shapes a `CmsPayload`
|
|
6
|
+
the runtime CMS components consume via `getContext(CMS_SCOPE)`.
|
|
7
|
+
|
|
8
|
+
```ts
|
|
9
|
+
import { createCms, mockAdapter } from '@velastack/cms/server';
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Quick start
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
// src/lib/cms.ts
|
|
16
|
+
import { createCms, mockAdapter } from '@velastack/cms/server';
|
|
17
|
+
|
|
18
|
+
const adapter = mockAdapter({
|
|
19
|
+
layoutDocs: {/* keyed by [locale][routeId] */},
|
|
20
|
+
pageDocs: {/* keyed by [locale][routeId], list of entries */}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export const { load: loadCms, generateEntries } = createCms({
|
|
24
|
+
adapter,
|
|
25
|
+
locales: ['en', 'es'] // first entry is the default locale
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
// src/routes/+layout.server.ts
|
|
31
|
+
import { error, redirect } from '@sveltejs/kit';
|
|
32
|
+
import { loadCms } from '$lib/cms.js';
|
|
33
|
+
|
|
34
|
+
export const load = async (event) => {
|
|
35
|
+
// Pick the locale however you like — pathname, Accept-Language, cookie, …
|
|
36
|
+
const locale = event.url.searchParams.get('locale') ?? 'en';
|
|
37
|
+
|
|
38
|
+
const { cms, notFound, gone, redirectTo } = await loadCms(event, { locale });
|
|
39
|
+
if (redirectTo) redirect(308, redirectTo);
|
|
40
|
+
if (gone) error(410, 'Gone');
|
|
41
|
+
if (notFound) error(404, 'Not found');
|
|
42
|
+
return { cms };
|
|
43
|
+
};
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## `createCms({ adapter, locales })`
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
type Cms = {
|
|
52
|
+
load: (event: ServerLoadEvent, options: { locale: string }) => Promise<LoadCmsResult>;
|
|
53
|
+
generateEntries: <R extends RouteId>(routeId?: R) => Promise<CmsEntry<RouteParams<R>>[]>;
|
|
54
|
+
};
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
- `load(event, { locale })` — call from a `+layout.server.ts` or
|
|
58
|
+
`+page.server.ts`. Reads `event.route.id`, `event.params`, and the
|
|
59
|
+
`?preview=` / `?version=` URL params; resolves the per-request locale from
|
|
60
|
+
the second argument. Returns a `LoadCmsResult` (see below).
|
|
61
|
+
- `generateEntries(routeId?)` — wrap with SvelteKit's
|
|
62
|
+
`export const entries = generateEntries`. The Vite plugin substitutes the
|
|
63
|
+
importing file's `routeId` into the zero-arg form at build time. Pass it
|
|
64
|
+
explicitly when you want strongly typed `params`. Always runs against the
|
|
65
|
+
default locale (`locales[0]`).
|
|
66
|
+
|
|
67
|
+
`locales` is the BCP-47 supported set; the first entry is the **default
|
|
68
|
+
locale** used for read-time fallback when a value is missing in the requested
|
|
69
|
+
locale.
|
|
70
|
+
|
|
71
|
+
## `loadCms(event, options)`
|
|
72
|
+
|
|
73
|
+
Lower-level form of `createCms({...}).load`. Use when you want to bind the
|
|
74
|
+
adapter ad-hoc per request:
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
import { loadCms } from '@velastack/cms/server';
|
|
78
|
+
|
|
79
|
+
export const load = (event) =>
|
|
80
|
+
loadCms(event, { adapter, locale: 'es-MX', locales: ['en', 'es-MX'] });
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### `LoadCmsResult`
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
type LoadCmsResult = {
|
|
87
|
+
cms: CmsPayload;
|
|
88
|
+
notFound: boolean;
|
|
89
|
+
gone: boolean;
|
|
90
|
+
redirectTo: string | null;
|
|
91
|
+
};
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The three flags are mutually exclusive page-kind resolutions; consumers
|
|
95
|
+
should branch in this priority order:
|
|
96
|
+
|
|
97
|
+
1. **`redirectTo`** — set to a target URL when the page was replaced with a
|
|
98
|
+
permanent redirect. Caller should `redirect(308, redirectTo)`.
|
|
99
|
+
2. **`gone`** — `true` when the page was deliberately permanently removed.
|
|
100
|
+
Caller should `error(410, …)`.
|
|
101
|
+
3. **`notFound`** — `true` when the page-kind scope had owned params and the
|
|
102
|
+
adapter returned no doc and no tombstone. Caller should `error(404, …)`.
|
|
103
|
+
4. None set — render normally with `cms`.
|
|
104
|
+
|
|
105
|
+
Layout scopes never tombstone — only page-kind scopes can resolve to `gone`
|
|
106
|
+
or `redirectTo`.
|
|
107
|
+
|
|
108
|
+
## `CmsPayload`
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
type CmsPayload = {
|
|
112
|
+
locale: string; // resolved locale for this request
|
|
113
|
+
locales: string[]; // supported set; first entry is the default locale
|
|
114
|
+
docs: Record<string, Record<string, unknown>>; // keyed by scopeId
|
|
115
|
+
scopes: Record<string, CmsScopeEntry>; // keyed by scopeId
|
|
116
|
+
metadata: Record<string, unknown>; // alias of page-scope `metadata` branch
|
|
117
|
+
entries: Record<string, CmsEntry[]>; // keyed by routeId (tombstones filtered)
|
|
118
|
+
endpoint: string;
|
|
119
|
+
page: CmsPagePointer | null;
|
|
120
|
+
};
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## `CmsAdapter` — the backend contract
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
interface CmsAdapter {
|
|
127
|
+
readonly endpoint?: string;
|
|
128
|
+
|
|
129
|
+
fetchDocs(
|
|
130
|
+
queries: CmsScopeQuery[],
|
|
131
|
+
context: CmsAdapterContext
|
|
132
|
+
): Promise<Record<string, CmsAdapterResolution>> | Record<string, CmsAdapterResolution>;
|
|
133
|
+
|
|
134
|
+
fetchEntries(routeId: string, context: CmsAdapterContext): Promise<CmsEntry[]> | CmsEntry[];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
type CmsAdapterContext = {
|
|
138
|
+
fetch: typeof fetch; // SvelteKit's request-scoped fetch
|
|
139
|
+
previewKey?: string | null; // ?preview=
|
|
140
|
+
versionKey?: string | null; // ?version= (mutually exclusive with previewKey; version wins)
|
|
141
|
+
locale: string; // BCP-47 bound at loadCms({ locale }) time
|
|
142
|
+
locales: string[]; // supported set; first entry is the default locale
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
type CmsScopeQuery = {
|
|
146
|
+
scopeId: string;
|
|
147
|
+
kind: 'layout' | 'page';
|
|
148
|
+
routeId: string;
|
|
149
|
+
params: Record<string, string>; // owned params for this scope only
|
|
150
|
+
fields: string[];
|
|
151
|
+
locale: string; // mirrors context.locale, repeated per query for convenience
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
type CmsAdapterResolution = CmsAdapterDoc | CmsAdapterTombstone;
|
|
155
|
+
type CmsAdapterDoc = { contents: Record<string, unknown> };
|
|
156
|
+
type CmsAdapterTombstone = { kind: 'gone' } | { kind: 'redirect'; to: string };
|
|
157
|
+
|
|
158
|
+
type CmsEntry<P = Record<string, string>> = {
|
|
159
|
+
params: P;
|
|
160
|
+
metadata: Record<string, unknown>;
|
|
161
|
+
redirectTo?: string; // set when this entry is a permanent-redirect tombstone
|
|
162
|
+
gone?: boolean; // set when this entry is a 410-gone tombstone
|
|
163
|
+
};
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
- **`fetchDocs`** is called once per request with one query per scope in the
|
|
167
|
+
route's chain (root layout → leaf page). Return a map keyed by
|
|
168
|
+
`query.scopeId`. Missing entries fall back to component `fallback`s. A
|
|
169
|
+
page-kind scope may resolve to a `CmsAdapterTombstone` (redirect / gone)
|
|
170
|
+
instead of a doc; the loader short-circuits the page render and surfaces
|
|
171
|
+
the outcome on `LoadCmsResult.{ gone, redirectTo }`.
|
|
172
|
+
- **`fetchEntries`** is called from prerender setups via `generateEntries`,
|
|
173
|
+
and by the loader to populate `cms.entries[routeId]`. Return all entries
|
|
174
|
+
including tombstoned ones (with their `redirectTo` / `gone` flag) so
|
|
175
|
+
prerender visits the URL and SvelteKit emits the redirect file. The loader
|
|
176
|
+
filters tombstones out of `cms.entries` before display.
|
|
177
|
+
|
|
178
|
+
The adapter doesn't need to implement default-locale fallback —
|
|
179
|
+
`resolveCmsPayload` issues a parallel default-locale `fetchDocs` /
|
|
180
|
+
`fetchEntries` when `locale !== locales[0]` and merges trees on the loader
|
|
181
|
+
side. Just return what's stored for the requested locale.
|
|
182
|
+
|
|
183
|
+
### The `metadata` branch
|
|
184
|
+
|
|
185
|
+
A page-kind doc may include a `metadata` object on its tree. `loadCms`
|
|
186
|
+
aliases it onto `payload.metadata` (handy for `definePageMetaTags(...)`)
|
|
187
|
+
without removing it — components addressing `metadata.title` etc. read
|
|
188
|
+
straight through. Use it for title, description, canonical, robots.
|
|
189
|
+
|
|
190
|
+
### Release-preview overlay
|
|
191
|
+
|
|
192
|
+
When `?preview=KEY` is on the request, `loadCms` forwards
|
|
193
|
+
`context.previewKey` to the adapter. Adapters that support preview should:
|
|
194
|
+
|
|
195
|
+
1. Look up the open release matching the key.
|
|
196
|
+
2. For each query, overlay any matching pending edits onto the published
|
|
197
|
+
content (deep-merge plain objects; arrays replace wholesale).
|
|
198
|
+
3. Suppress page results that have a staged `page-delete` (or surface its
|
|
199
|
+
`outcome` tombstone if set).
|
|
200
|
+
|
|
201
|
+
`mockAdapter` does all of this when given a `resolvePreview` function.
|
|
202
|
+
|
|
203
|
+
### Past-version snapshot (`?version=`)
|
|
204
|
+
|
|
205
|
+
Mutually exclusive with `previewKey`; when both are present, `versionKey`
|
|
206
|
+
wins. Adapters resolve it to a past published release and return that
|
|
207
|
+
release's snapshot — no overlay, no drafts.
|
|
208
|
+
|
|
209
|
+
## Locales
|
|
210
|
+
|
|
211
|
+
Locales sit between the release dimension and the scope dimension: every
|
|
212
|
+
release contains items across every locale you've touched, so publishing
|
|
213
|
+
ships all locales atomically.
|
|
214
|
+
|
|
215
|
+
- **Configure** the supported set with `createCms({ locales })`. First entry
|
|
216
|
+
is the default locale.
|
|
217
|
+
- **Pass per-request locale** to `loadCms(event, { locale })`. The library
|
|
218
|
+
doesn't decide how the locale was derived — pathname, `Accept-Language`,
|
|
219
|
+
cookie, `?locale=`, anything.
|
|
220
|
+
- **Default-locale fallback** is automatic. When the request's locale isn't
|
|
221
|
+
the default, the loader fetches both locales in parallel and
|
|
222
|
+
`mergeTree(default, requested)`s per scope so missing keys inherit.
|
|
223
|
+
Arrays replace wholesale — an explicit ES gallery overrides EN; an absent
|
|
224
|
+
ES gallery inherits.
|
|
225
|
+
- **Tombstones interact with fallback** by precedence: a requested-locale
|
|
226
|
+
tombstone always wins; a default-locale tombstone applies only when the
|
|
227
|
+
requested locale has no doc.
|
|
228
|
+
- **`?locale=` URL param** is reserved for the admin bar's preview-locale
|
|
229
|
+
override. The library doesn't read it; the consumer's locale-resolution
|
|
230
|
+
logic is expected to honor it (typical pattern: `?locale=` wins over
|
|
231
|
+
pathname-derived locale when the bar is mounted).
|
|
232
|
+
|
|
233
|
+
## Tombstones (gone / redirect)
|
|
234
|
+
|
|
235
|
+
A page-kind URL has four possible outcomes:
|
|
236
|
+
|
|
237
|
+
| Outcome | HTTP | Source |
|
|
238
|
+
| --------------- | ---- | --------------------------------------------------------------- |
|
|
239
|
+
| Render normally | 200 | Adapter returned `{ contents }` for the page scope. |
|
|
240
|
+
| `redirectTo` | 308 | Adapter returned `{ kind: 'redirect', to }` for the page scope. |
|
|
241
|
+
| `gone` | 410 | Adapter returned `{ kind: 'gone' }` for the page scope. |
|
|
242
|
+
| `notFound` | 404 | Adapter returned nothing AND the page scope has owned params. |
|
|
243
|
+
|
|
244
|
+
Tombstones come from two places in the adapter:
|
|
245
|
+
|
|
246
|
+
1. **Published tombstones** — stored on the entry itself
|
|
247
|
+
(`PageEntry.tombstone` in `mockAdapter`). The page was deleted with a
|
|
248
|
+
non-404 outcome in a prior release; `fetchDocs` returns the tombstone
|
|
249
|
+
instead of `{ contents }`.
|
|
250
|
+
2. **Staged tombstones** — set on a release's `page-delete` item via
|
|
251
|
+
`outcome` (in `mockAdapter`'s `ReleaseItemSnapshot`). The page is being
|
|
252
|
+
deleted in the open release; in preview, the adapter emits the staged
|
|
253
|
+
outcome. After publish, the staged outcome becomes a published tombstone.
|
|
254
|
+
Omitting `outcome` means hard delete (404).
|
|
255
|
+
|
|
256
|
+
For prerender, `fetchEntries` returns tombstoned entries with `redirectTo`
|
|
257
|
+
or `gone: true` so SvelteKit visits the URL and emits the redirect file
|
|
258
|
+
(or surfaces the 410). The consumer-facing `cms.entries[routeId]` filters
|
|
259
|
+
them out — `<CmsEntries>` lists never display deleted pages.
|
|
260
|
+
|
|
261
|
+
## `mockAdapter(options)`
|
|
262
|
+
|
|
263
|
+
In-memory adapter for tests, demos, and local development:
|
|
264
|
+
|
|
265
|
+
```ts
|
|
266
|
+
type MockAdapterOptions = {
|
|
267
|
+
layoutDocs?: Record<string /* locale */, Record<string /* routeId */, Record<string, unknown>>>;
|
|
268
|
+
pageDocs?: Record<string /* locale */, Record<string /* routeId */, PageEntry[]>>;
|
|
269
|
+
resolvePreview?: (key: string) => ReleaseSnapshot | null | undefined;
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
type PageEntry = {
|
|
273
|
+
params: Record<string, string>;
|
|
274
|
+
published: Record<string, unknown>;
|
|
275
|
+
tombstone?: CmsAdapterTombstone; // mark as a published gone/redirect
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
type ReleaseItemSnapshot =
|
|
279
|
+
| { kind: 'page'; routeId: string; params: Record<string, string>; locale: string; tree: Tree }
|
|
280
|
+
| { kind: 'layout'; routeId: string; locale: string; tree: Tree }
|
|
281
|
+
| {
|
|
282
|
+
kind: 'page-delete';
|
|
283
|
+
routeId: string;
|
|
284
|
+
params: Record<string, string>;
|
|
285
|
+
locale: string;
|
|
286
|
+
outcome?: CmsAdapterTombstone;
|
|
287
|
+
}; // omit for hard delete (404 after publish)
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Layout queries are looked up by `[locale][routeId]`; page queries by
|
|
291
|
+
`[locale][routeId]` plus exact `params` match. Release items are filtered by
|
|
292
|
+
`item.locale === query.locale` so an `es` edit doesn't leak into an `en`
|
|
293
|
+
preview. Default-locale fallback is the loader's job, not the adapter's.
|
|
294
|
+
|
|
295
|
+
```ts
|
|
296
|
+
const adapter = mockAdapter({
|
|
297
|
+
layoutDocs: {
|
|
298
|
+
en: { '/': { footer: { copy: '© 2026' } } },
|
|
299
|
+
es: { '/': { footer: { copy: '© 2026' } } }
|
|
300
|
+
},
|
|
301
|
+
pageDocs: {
|
|
302
|
+
en: {
|
|
303
|
+
'/(marketing)/about': [
|
|
304
|
+
{ params: {}, published: { hero: { title: 'About us' }, metadata: { title: 'About us' } } }
|
|
305
|
+
],
|
|
306
|
+
'/(marketing)/rooms/[slug]': [
|
|
307
|
+
{ params: { slug: 'suite-1' }, published: { hero: { title: 'Suite 1' } } },
|
|
308
|
+
// Permanent redirect after a URL change.
|
|
309
|
+
{
|
|
310
|
+
params: { slug: 'legacy' },
|
|
311
|
+
published: {},
|
|
312
|
+
tombstone: { kind: 'redirect', to: '/rooms/suite-1' }
|
|
313
|
+
},
|
|
314
|
+
// Hard 410 — URL is gone for good.
|
|
315
|
+
{ params: { slug: 'old-suite' }, published: {}, tombstone: { kind: 'gone' } }
|
|
316
|
+
]
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
Pass `resolvePreview` to enable release-preview overlay. A staged delete
|
|
323
|
+
in flight, with a redirect outcome, looks like:
|
|
324
|
+
|
|
325
|
+
```ts
|
|
326
|
+
{
|
|
327
|
+
kind: 'page-delete',
|
|
328
|
+
routeId: '/(marketing)/rooms/[slug]',
|
|
329
|
+
params: { slug: 'legacy' },
|
|
330
|
+
locale: 'en',
|
|
331
|
+
outcome: { kind: 'redirect', to: '/rooms/suite-1' }
|
|
332
|
+
}
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
## Stability
|
|
336
|
+
|
|
337
|
+
Pre-1.0. `createCms`, `loadCms`, `LoadCmsResult`, the `CmsAdapter`
|
|
338
|
+
interface, `CmsAdapterResolution` / `CmsAdapterDoc` / `CmsAdapterTombstone`,
|
|
339
|
+
`CmsAdapterContext`, `CmsScopeQuery`, `CmsEntry` (including its `redirectTo`
|
|
340
|
+
/ `gone` flags), and the page-doc `metadata` branch convention are public;
|
|
341
|
+
`mockAdapter` and its option shape are public; everything else is internal.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CmsAdapter } from './types.ts';
|
|
2
|
+
export type ApiAdapterOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* Base URL of the CMS backend, e.g.
|
|
5
|
+
* `'https://velastack.dev/v1/projects/velastack-cms/cms'`. Trailing slash is
|
|
6
|
+
* stripped.
|
|
7
|
+
*/
|
|
8
|
+
endpoint: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* HTTP-backed adapter that talks to a remote @velastack/cms backend.
|
|
12
|
+
*
|
|
13
|
+
* Mirrors the in-memory mock's wire shape (one GET `/docs` per scope query;
|
|
14
|
+
* GET `/pages` for entry enumeration) so the same backend powers both the
|
|
15
|
+
* in-process mock and this adapter while the migration is in flight. Forwards
|
|
16
|
+
* `previewKey` as `?preview=…` so the backend overlays pending release edits
|
|
17
|
+
* when present. Uses the request-scoped `context.fetch` so SvelteKit can
|
|
18
|
+
* forward cookies during SSR.
|
|
19
|
+
*/
|
|
20
|
+
export declare const apiAdapter: (options: ApiAdapterOptions) => CmsAdapter;
|