sandcms 0.5.2
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 +57 -0
- package/README.md +84 -0
- package/dist/Image.svelte +53 -0
- package/dist/Image.svelte.d.ts +10 -0
- package/dist/Seo.svelte +29 -0
- package/dist/Seo.svelte.d.ts +10 -0
- package/dist/admin/Access.svelte +129 -0
- package/dist/admin/Access.svelte.d.ts +7 -0
- package/dist/admin/Account.svelte +190 -0
- package/dist/admin/Account.svelte.d.ts +7 -0
- package/dist/admin/Admin.svelte +42 -0
- package/dist/admin/Admin.svelte.d.ts +8 -0
- package/dist/admin/AssetAttachment.svelte +77 -0
- package/dist/admin/AssetAttachment.svelte.d.ts +15 -0
- package/dist/admin/Collection.svelte +52 -0
- package/dist/admin/Collection.svelte.d.ts +7 -0
- package/dist/admin/Dashboard.svelte +105 -0
- package/dist/admin/Dashboard.svelte.d.ts +7 -0
- package/dist/admin/Editor.svelte +192 -0
- package/dist/admin/Editor.svelte.d.ts +7 -0
- package/dist/admin/Fields.svelte +221 -0
- package/dist/admin/Fields.svelte.d.ts +17 -0
- package/dist/admin/Gallery.svelte +130 -0
- package/dist/admin/Gallery.svelte.d.ts +16 -0
- package/dist/admin/Inbox.svelte +154 -0
- package/dist/admin/Inbox.svelte.d.ts +8 -0
- package/dist/admin/Login.svelte +104 -0
- package/dist/admin/Login.svelte.d.ts +7 -0
- package/dist/admin/MediaLibrary.svelte +231 -0
- package/dist/admin/MediaLibrary.svelte.d.ts +7 -0
- package/dist/admin/MediaPicker.svelte +273 -0
- package/dist/admin/MediaPicker.svelte.d.ts +16 -0
- package/dist/admin/Notice.svelte +13 -0
- package/dist/admin/Notice.svelte.d.ts +8 -0
- package/dist/admin/NotificationSettings.svelte +153 -0
- package/dist/admin/NotificationSettings.svelte.d.ts +7 -0
- package/dist/admin/RichText.svelte +103 -0
- package/dist/admin/RichText.svelte.d.ts +9 -0
- package/dist/admin/RichTextLink.svelte +71 -0
- package/dist/admin/RichTextLink.svelte.d.ts +7 -0
- package/dist/admin/SelectField.svelte +39 -0
- package/dist/admin/SelectField.svelte.d.ts +15 -0
- package/dist/admin/Shell.svelte +106 -0
- package/dist/admin/Shell.svelte.d.ts +9 -0
- package/dist/admin/SortableList.svelte +104 -0
- package/dist/admin/SortableList.svelte.d.ts +30 -0
- package/dist/admin/UnsavedChanges.svelte +54 -0
- package/dist/admin/UnsavedChanges.svelte.d.ts +6 -0
- package/dist/admin/UploadButton.svelte +42 -0
- package/dist/admin/UploadButton.svelte.d.ts +10 -0
- package/dist/admin/UploadQueue.svelte +40 -0
- package/dist/admin/UploadQueue.svelte.d.ts +7 -0
- package/dist/admin/Users.svelte +185 -0
- package/dist/admin/Users.svelte.d.ts +7 -0
- package/dist/admin/client.d.ts +720 -0
- package/dist/admin/client.js +29 -0
- package/dist/admin/components/ui/alert/alert-action.svelte +20 -0
- package/dist/admin/components/ui/alert/alert-action.svelte.d.ts +5 -0
- package/dist/admin/components/ui/alert/alert-description.svelte +23 -0
- package/dist/admin/components/ui/alert/alert-description.svelte.d.ts +5 -0
- package/dist/admin/components/ui/alert/alert-title.svelte +23 -0
- package/dist/admin/components/ui/alert/alert-title.svelte.d.ts +5 -0
- package/dist/admin/components/ui/alert/alert.svelte +44 -0
- package/dist/admin/components/ui/alert/alert.svelte.d.ts +26 -0
- package/dist/admin/components/ui/alert/index.d.ts +6 -0
- package/dist/admin/components/ui/alert/index.js +8 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-action.svelte +27 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-action.svelte.d.ts +9 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-cancel.svelte +27 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-cancel.svelte.d.ts +9 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-content.svelte +32 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-content.svelte.d.ts +11 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-description.svelte +20 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-description.svelte.d.ts +4 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-footer.svelte +23 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-footer.svelte.d.ts +5 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-header.svelte +23 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-header.svelte.d.ts +5 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-media.svelte +23 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-media.svelte.d.ts +5 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-overlay.svelte +20 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-overlay.svelte.d.ts +4 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-portal.svelte +7 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-portal.svelte.d.ts +3 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-title.svelte +20 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-title.svelte.d.ts +4 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-trigger.svelte +7 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-trigger.svelte.d.ts +4 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog.svelte +7 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog.svelte.d.ts +3 -0
- package/dist/admin/components/ui/alert-dialog/index.d.ts +13 -0
- package/dist/admin/components/ui/alert-dialog/index.js +15 -0
- package/dist/admin/components/ui/attachment/attachment-action.svelte +21 -0
- package/dist/admin/components/ui/attachment/attachment-action.svelte.d.ts +4 -0
- package/dist/admin/components/ui/attachment/attachment-actions.svelte +23 -0
- package/dist/admin/components/ui/attachment/attachment-actions.svelte.d.ts +5 -0
- package/dist/admin/components/ui/attachment/attachment-content.svelte +23 -0
- package/dist/admin/components/ui/attachment/attachment-content.svelte.d.ts +5 -0
- package/dist/admin/components/ui/attachment/attachment-description.svelte +24 -0
- package/dist/admin/components/ui/attachment/attachment-description.svelte.d.ts +5 -0
- package/dist/admin/components/ui/attachment/attachment-group.svelte +23 -0
- package/dist/admin/components/ui/attachment/attachment-group.svelte.d.ts +5 -0
- package/dist/admin/components/ui/attachment/attachment-media.svelte +44 -0
- package/dist/admin/components/ui/attachment/attachment-media.svelte.d.ts +26 -0
- package/dist/admin/components/ui/attachment/attachment-title.svelte +23 -0
- package/dist/admin/components/ui/attachment/attachment-title.svelte.d.ts +5 -0
- package/dist/admin/components/ui/attachment/attachment-trigger.svelte +29 -0
- package/dist/admin/components/ui/attachment/attachment-trigger.svelte.d.ts +11 -0
- package/dist/admin/components/ui/attachment/attachment.svelte +54 -0
- package/dist/admin/components/ui/attachment/attachment.svelte.d.ts +45 -0
- package/dist/admin/components/ui/attachment/index.d.ts +10 -0
- package/dist/admin/components/ui/attachment/index.js +12 -0
- package/dist/admin/components/ui/avatar/avatar-badge.svelte +26 -0
- package/dist/admin/components/ui/avatar/avatar-badge.svelte.d.ts +5 -0
- package/dist/admin/components/ui/avatar/avatar-fallback.svelte +20 -0
- package/dist/admin/components/ui/avatar/avatar-fallback.svelte.d.ts +4 -0
- package/dist/admin/components/ui/avatar/avatar-group-count.svelte +23 -0
- package/dist/admin/components/ui/avatar/avatar-group-count.svelte.d.ts +5 -0
- package/dist/admin/components/ui/avatar/avatar-group.svelte +23 -0
- package/dist/admin/components/ui/avatar/avatar-group.svelte.d.ts +5 -0
- package/dist/admin/components/ui/avatar/avatar-image.svelte +17 -0
- package/dist/admin/components/ui/avatar/avatar-image.svelte.d.ts +4 -0
- package/dist/admin/components/ui/avatar/avatar.svelte +26 -0
- package/dist/admin/components/ui/avatar/avatar.svelte.d.ts +7 -0
- package/dist/admin/components/ui/avatar/index.d.ts +7 -0
- package/dist/admin/components/ui/avatar/index.js +9 -0
- package/dist/admin/components/ui/badge/badge.svelte +50 -0
- package/dist/admin/components/ui/badge/badge.svelte.d.ts +38 -0
- package/dist/admin/components/ui/badge/index.d.ts +2 -0
- package/dist/admin/components/ui/badge/index.js +2 -0
- package/dist/admin/components/ui/button/button.svelte +87 -0
- package/dist/admin/components/ui/button/button.svelte.d.ts +70 -0
- package/dist/admin/components/ui/button/index.d.ts +2 -0
- package/dist/admin/components/ui/button/index.js +4 -0
- package/dist/admin/components/ui/card/card-action.svelte +20 -0
- package/dist/admin/components/ui/card/card-action.svelte.d.ts +5 -0
- package/dist/admin/components/ui/card/card-content.svelte +20 -0
- package/dist/admin/components/ui/card/card-content.svelte.d.ts +5 -0
- package/dist/admin/components/ui/card/card-description.svelte +20 -0
- package/dist/admin/components/ui/card/card-description.svelte.d.ts +5 -0
- package/dist/admin/components/ui/card/card-footer.svelte +20 -0
- package/dist/admin/components/ui/card/card-footer.svelte.d.ts +5 -0
- package/dist/admin/components/ui/card/card-header.svelte +23 -0
- package/dist/admin/components/ui/card/card-header.svelte.d.ts +5 -0
- package/dist/admin/components/ui/card/card-title.svelte +20 -0
- package/dist/admin/components/ui/card/card-title.svelte.d.ts +5 -0
- package/dist/admin/components/ui/card/card.svelte +25 -0
- package/dist/admin/components/ui/card/card.svelte.d.ts +8 -0
- package/dist/admin/components/ui/card/index.d.ts +8 -0
- package/dist/admin/components/ui/card/index.js +10 -0
- package/dist/admin/components/ui/checkbox/checkbox.svelte +39 -0
- package/dist/admin/components/ui/checkbox/checkbox.svelte.d.ts +4 -0
- package/dist/admin/components/ui/checkbox/index.d.ts +2 -0
- package/dist/admin/components/ui/checkbox/index.js +4 -0
- package/dist/admin/components/ui/dialog/dialog-close.svelte +11 -0
- package/dist/admin/components/ui/dialog/dialog-close.svelte.d.ts +4 -0
- package/dist/admin/components/ui/dialog/dialog-content.svelte +48 -0
- package/dist/admin/components/ui/dialog/dialog-content.svelte.d.ts +13 -0
- package/dist/admin/components/ui/dialog/dialog-description.svelte +20 -0
- package/dist/admin/components/ui/dialog/dialog-description.svelte.d.ts +4 -0
- package/dist/admin/components/ui/dialog/dialog-footer.svelte +32 -0
- package/dist/admin/components/ui/dialog/dialog-footer.svelte.d.ts +8 -0
- package/dist/admin/components/ui/dialog/dialog-header.svelte +20 -0
- package/dist/admin/components/ui/dialog/dialog-header.svelte.d.ts +5 -0
- package/dist/admin/components/ui/dialog/dialog-overlay.svelte +20 -0
- package/dist/admin/components/ui/dialog/dialog-overlay.svelte.d.ts +4 -0
- package/dist/admin/components/ui/dialog/dialog-portal.svelte +7 -0
- package/dist/admin/components/ui/dialog/dialog-portal.svelte.d.ts +3 -0
- package/dist/admin/components/ui/dialog/dialog-title.svelte +17 -0
- package/dist/admin/components/ui/dialog/dialog-title.svelte.d.ts +4 -0
- package/dist/admin/components/ui/dialog/dialog-trigger.svelte +11 -0
- package/dist/admin/components/ui/dialog/dialog-trigger.svelte.d.ts +4 -0
- package/dist/admin/components/ui/dialog/dialog.svelte +7 -0
- package/dist/admin/components/ui/dialog/dialog.svelte.d.ts +3 -0
- package/dist/admin/components/ui/dialog/index.d.ts +11 -0
- package/dist/admin/components/ui/dialog/index.js +13 -0
- package/dist/admin/components/ui/input/index.d.ts +2 -0
- package/dist/admin/components/ui/input/index.js +4 -0
- package/dist/admin/components/ui/input/input.svelte +48 -0
- package/dist/admin/components/ui/input/input.svelte.d.ts +13 -0
- package/dist/admin/components/ui/label/index.d.ts +2 -0
- package/dist/admin/components/ui/label/index.js +4 -0
- package/dist/admin/components/ui/label/label.svelte +20 -0
- package/dist/admin/components/ui/label/label.svelte.d.ts +4 -0
- package/dist/admin/components/ui/select/index.d.ts +13 -0
- package/dist/admin/components/ui/select/index.js +15 -0
- package/dist/admin/components/ui/select/select-content.svelte +45 -0
- package/dist/admin/components/ui/select/select-content.svelte.d.ts +11 -0
- package/dist/admin/components/ui/select/select-group-heading.svelte +21 -0
- package/dist/admin/components/ui/select/select-group-heading.svelte.d.ts +10 -0
- package/dist/admin/components/ui/select/select-group.svelte +17 -0
- package/dist/admin/components/ui/select/select-group.svelte.d.ts +4 -0
- package/dist/admin/components/ui/select/select-item.svelte +42 -0
- package/dist/admin/components/ui/select/select-item.svelte.d.ts +4 -0
- package/dist/admin/components/ui/select/select-label.svelte +20 -0
- package/dist/admin/components/ui/select/select-label.svelte.d.ts +6 -0
- package/dist/admin/components/ui/select/select-portal.svelte +7 -0
- package/dist/admin/components/ui/select/select-portal.svelte.d.ts +3 -0
- package/dist/admin/components/ui/select/select-scroll-down-button.svelte +23 -0
- package/dist/admin/components/ui/select/select-scroll-down-button.svelte.d.ts +4 -0
- package/dist/admin/components/ui/select/select-scroll-up-button.svelte +23 -0
- package/dist/admin/components/ui/select/select-scroll-up-button.svelte.d.ts +4 -0
- package/dist/admin/components/ui/select/select-separator.svelte +18 -0
- package/dist/admin/components/ui/select/select-separator.svelte.d.ts +4 -0
- package/dist/admin/components/ui/select/select-trigger.svelte +29 -0
- package/dist/admin/components/ui/select/select-trigger.svelte.d.ts +8 -0
- package/dist/admin/components/ui/select/select-value.svelte +7 -0
- package/dist/admin/components/ui/select/select-value.svelte.d.ts +4 -0
- package/dist/admin/components/ui/select/select.svelte +11 -0
- package/dist/admin/components/ui/select/select.svelte.d.ts +3 -0
- package/dist/admin/components/ui/separator/index.d.ts +2 -0
- package/dist/admin/components/ui/separator/index.js +4 -0
- package/dist/admin/components/ui/separator/separator.svelte +21 -0
- package/dist/admin/components/ui/separator/separator.svelte.d.ts +4 -0
- package/dist/admin/components/ui/switch/index.d.ts +2 -0
- package/dist/admin/components/ui/switch/index.js +4 -0
- package/dist/admin/components/ui/switch/switch.svelte +34 -0
- package/dist/admin/components/ui/switch/switch.svelte.d.ts +8 -0
- package/dist/admin/components/ui/table/index.d.ts +9 -0
- package/dist/admin/components/ui/table/index.js +11 -0
- package/dist/admin/components/ui/table/table-body.svelte +20 -0
- package/dist/admin/components/ui/table/table-body.svelte.d.ts +5 -0
- package/dist/admin/components/ui/table/table-caption.svelte +20 -0
- package/dist/admin/components/ui/table/table-caption.svelte.d.ts +5 -0
- package/dist/admin/components/ui/table/table-cell.svelte +20 -0
- package/dist/admin/components/ui/table/table-cell.svelte.d.ts +5 -0
- package/dist/admin/components/ui/table/table-footer.svelte +20 -0
- package/dist/admin/components/ui/table/table-footer.svelte.d.ts +5 -0
- package/dist/admin/components/ui/table/table-head.svelte +23 -0
- package/dist/admin/components/ui/table/table-head.svelte.d.ts +5 -0
- package/dist/admin/components/ui/table/table-header.svelte +20 -0
- package/dist/admin/components/ui/table/table-header.svelte.d.ts +5 -0
- package/dist/admin/components/ui/table/table-row.svelte +23 -0
- package/dist/admin/components/ui/table/table-row.svelte.d.ts +5 -0
- package/dist/admin/components/ui/table/table.svelte +22 -0
- package/dist/admin/components/ui/table/table.svelte.d.ts +5 -0
- package/dist/admin/components/ui/textarea/index.d.ts +2 -0
- package/dist/admin/components/ui/textarea/index.js +4 -0
- package/dist/admin/components/ui/textarea/textarea.svelte +22 -0
- package/dist/admin/components/ui/textarea/textarea.svelte.d.ts +5 -0
- package/dist/admin/components/ui/toggle/index.d.ts +3 -0
- package/dist/admin/components/ui/toggle/index.js +5 -0
- package/dist/admin/components/ui/toggle/toggle.svelte +52 -0
- package/dist/admin/components/ui/toggle/toggle.svelte.d.ts +43 -0
- package/dist/admin/generated/FONT-LICENSE +93 -0
- package/dist/admin/generated/Geist-LICENSE.txt +93 -0
- package/dist/admin/generated/admin.css +3276 -0
- package/dist/admin/generated/fonts/geist-cyrillic-ext-wght-italic.woff2 +0 -0
- package/dist/admin/generated/fonts/geist-cyrillic-ext-wght-normal.woff2 +0 -0
- package/dist/admin/generated/fonts/geist-cyrillic-wght-italic.woff2 +0 -0
- package/dist/admin/generated/fonts/geist-cyrillic-wght-normal.woff2 +0 -0
- package/dist/admin/generated/fonts/geist-latin-ext-wght-italic.woff2 +0 -0
- package/dist/admin/generated/fonts/geist-latin-ext-wght-normal.woff2 +0 -0
- package/dist/admin/generated/fonts/geist-latin-wght-italic.woff2 +0 -0
- package/dist/admin/generated/fonts/geist-latin-wght-normal.woff2 +0 -0
- package/dist/admin/generated/fonts/geist-vietnamese-wght-italic.woff2 +0 -0
- package/dist/admin/generated/fonts/geist-vietnamese-wght-normal.woff2 +0 -0
- package/dist/admin/generated/geist-cyrillic-ext-wght-normal.woff2 +0 -0
- package/dist/admin/generated/geist-cyrillic-wght-normal.woff2 +0 -0
- package/dist/admin/generated/geist-latin-ext-wght-normal.woff2 +0 -0
- package/dist/admin/generated/geist-latin-wght-normal.woff2 +0 -0
- package/dist/admin/generated/geist-vietnamese-wght-normal.woff2 +0 -0
- package/dist/admin/generated/styles.css +2772 -0
- package/dist/admin/index.d.ts +2 -0
- package/dist/admin/index.js +1 -0
- package/dist/admin/types.d.ts +63 -0
- package/dist/admin/types.js +1 -0
- package/dist/admin/uploads.d.ts +12 -0
- package/dist/admin/uploads.js +23 -0
- package/dist/admin/utils.d.ts +11 -0
- package/dist/admin/utils.js +1 -0
- package/dist/blueprints/files.d.ts +7 -0
- package/dist/blueprints/files.js +112 -0
- package/dist/blueprints/gallery.d.ts +3 -0
- package/dist/blueprints/gallery.js +14 -0
- package/dist/blueprints/load.d.ts +6 -0
- package/dist/blueprints/load.js +186 -0
- package/dist/blueprints/merge.d.ts +2 -0
- package/dist/blueprints/merge.js +18 -0
- package/dist/blueprints/types.d.ts +58 -0
- package/dist/blueprints/types.js +1 -0
- package/dist/blueprints/validate.d.ts +8 -0
- package/dist/blueprints/validate.js +133 -0
- package/dist/cli/backup.d.ts +6 -0
- package/dist/cli/backup.js +85 -0
- package/dist/cli/cloudflare.d.ts +8 -0
- package/dist/cli/cloudflare.js +123 -0
- package/dist/cli/doctor.d.ts +1 -0
- package/dist/cli/doctor.js +56 -0
- package/dist/cli/files.d.ts +30 -0
- package/dist/cli/files.js +114 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +182 -0
- package/dist/cli/prompts.d.ts +5 -0
- package/dist/cli/prompts.js +41 -0
- package/dist/cli/scaffold.d.ts +2 -0
- package/dist/cli/scaffold.js +58 -0
- package/dist/cli/setup.d.ts +11 -0
- package/dist/cli/setup.js +116 -0
- package/dist/cli/upgrade.d.ts +1 -0
- package/dist/cli/upgrade.js +47 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4 -0
- package/dist/media.d.ts +26 -0
- package/dist/media.js +27 -0
- package/dist/notification-fields.d.ts +8 -0
- package/dist/notification-fields.js +26 -0
- package/dist/richtext.d.ts +14 -0
- package/dist/richtext.js +73 -0
- package/dist/server/access.d.ts +16 -0
- package/dist/server/access.js +216 -0
- package/dist/server/admin-load.d.ts +342 -0
- package/dist/server/admin-load.js +135 -0
- package/dist/server/api.d.ts +3 -0
- package/dist/server/api.js +144 -0
- package/dist/server/auth.d.ts +744 -0
- package/dist/server/auth.js +142 -0
- package/dist/server/blueprint-icons.d.ts +4 -0
- package/dist/server/blueprint-icons.js +14 -0
- package/dist/server/cms.d.ts +1054 -0
- package/dist/server/cms.js +58 -0
- package/dist/server/content.d.ts +101 -0
- package/dist/server/content.js +285 -0
- package/dist/server/db/migration-data.d.ts +4 -0
- package/dist/server/db/migration-data.js +7 -0
- package/dist/server/db/migrations/0000_foundation.sql +180 -0
- package/dist/server/db/migrations/meta/0000_snapshot.json +1188 -0
- package/dist/server/db/migrations/meta/_journal.json +13 -0
- package/dist/server/db/schema.d.ts +2212 -0
- package/dist/server/db/schema.js +171 -0
- package/dist/server/db/store.d.ts +33 -0
- package/dist/server/db/store.js +131 -0
- package/dist/server/email/index.d.ts +50 -0
- package/dist/server/email/index.js +175 -0
- package/dist/server/email/template.d.ts +8 -0
- package/dist/server/email/template.js +53 -0
- package/dist/server/forms.d.ts +40 -0
- package/dist/server/forms.js +84 -0
- package/dist/server/hooks.d.ts +3 -0
- package/dist/server/hooks.js +85 -0
- package/dist/server/http.d.ts +3 -0
- package/dist/server/http.js +3 -0
- package/dist/server/index.d.ts +8 -0
- package/dist/server/index.js +7 -0
- package/dist/server/media/delivery.d.ts +3 -0
- package/dist/server/media/delivery.js +42 -0
- package/dist/server/media/presets.d.ts +2 -0
- package/dist/server/media/presets.js +8 -0
- package/dist/server/media/runner.d.ts +2 -0
- package/dist/server/media/runner.js +128 -0
- package/dist/server/media/service.d.ts +144 -0
- package/dist/server/media/service.js +280 -0
- package/dist/server/notifications.d.ts +9 -0
- package/dist/server/notifications.js +161 -0
- package/dist/server/request.d.ts +2 -0
- package/dist/server/request.js +39 -0
- package/dist/server/seo.d.ts +12 -0
- package/dist/server/seo.js +62 -0
- package/dist/worker/index.d.ts +10 -0
- package/dist/worker/index.js +266 -0
- package/dist/worker/source.d.ts +2 -0
- package/dist/worker/source.js +31 -0
- package/dist/worker/svg.d.ts +5 -0
- package/dist/worker/svg.js +142 -0
- package/docs/acceptance.md +58 -0
- package/docs/cloudflare.md +146 -0
- package/docs/content.md +188 -0
- package/docs/deployment.md +89 -0
- package/docs/email.md +124 -0
- package/docs/forms.md +18 -0
- package/docs/media.md +105 -0
- package/docs/package.md +84 -0
- package/docs/releases.md +29 -0
- package/docs/upgrades.md +62 -0
- package/package.json +124 -0
- package/templates/dockerignore +15 -0
- package/templates/hooks.server.ts +4 -0
- package/templates/integration.ts +20 -0
- package/templates/railpack.json +7 -0
- package/templates/routes/admin/+page.server.ts +3 -0
- package/templates/routes/admin/+page.svelte +6 -0
- package/templates/routes/api/+server.ts +4 -0
- package/templates/sandcms/blueprints/collections/photographers.yaml +6 -0
- package/templates/sandcms/blueprints/collections/projects.yaml +26 -0
- package/templates/sandcms/blueprints/files/image.yaml +6 -0
- package/templates/sandcms/blueprints/forms/registration.yaml +15 -0
- package/templates/sandcms/blueprints/pages/home.yaml +9 -0
- package/templates/sandcms/blueprints/site.yaml +13 -0
- package/templates/sandcms/config.yaml +12 -0
- package/templates/sandcms/worker/index.ts +1 -0
- package/templates/sandcms/worker/wrangler.jsonc +7 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Admin } from './Admin.svelte';
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Blueprint, FileBlueprint } from '../blueprints/types.js';
|
|
2
|
+
import type { LucideIconData } from '@lucide/svelte';
|
|
3
|
+
import type { documents, media, submissions, NotificationSettings } from '../server/db/schema.js';
|
|
4
|
+
import type { CmsUser } from '../server/auth.js';
|
|
5
|
+
export type Entry = typeof documents.$inferSelect;
|
|
6
|
+
export type Asset = typeof media.$inferSelect;
|
|
7
|
+
export type Submission = typeof submissions.$inferSelect;
|
|
8
|
+
export type Relations = Record<string, {
|
|
9
|
+
id: string;
|
|
10
|
+
label: string;
|
|
11
|
+
}[]>;
|
|
12
|
+
export interface AdminData {
|
|
13
|
+
screen: string;
|
|
14
|
+
emailEnabled?: boolean;
|
|
15
|
+
next?: string;
|
|
16
|
+
invitations?: {
|
|
17
|
+
id: string;
|
|
18
|
+
email: string;
|
|
19
|
+
role: string;
|
|
20
|
+
expiresAt: number;
|
|
21
|
+
status: string;
|
|
22
|
+
}[];
|
|
23
|
+
notificationSettings?: NotificationSettings;
|
|
24
|
+
notificationsEnabled?: boolean;
|
|
25
|
+
notificationUsers?: {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
email: string;
|
|
29
|
+
}[];
|
|
30
|
+
selectedSubmission?: string | null;
|
|
31
|
+
user: CmsUser | null;
|
|
32
|
+
site?: string;
|
|
33
|
+
blueprints?: (Blueprint & {
|
|
34
|
+
navigationIcon: LucideIconData;
|
|
35
|
+
})[];
|
|
36
|
+
workerUrl?: string;
|
|
37
|
+
fileBlueprints?: FileBlueprint[];
|
|
38
|
+
defaultFileBlueprint?: string;
|
|
39
|
+
mediaVersion?: string;
|
|
40
|
+
blueprint?: Blueprint;
|
|
41
|
+
entry?: Entry | null;
|
|
42
|
+
entries?: (Entry & {
|
|
43
|
+
label?: string;
|
|
44
|
+
})[];
|
|
45
|
+
editing?: boolean;
|
|
46
|
+
assets?: Asset[];
|
|
47
|
+
relations?: Relations;
|
|
48
|
+
photographerCollection?: string;
|
|
49
|
+
uploadLimit?: number;
|
|
50
|
+
usages?: Record<string, {
|
|
51
|
+
documentId: string;
|
|
52
|
+
snapshot: string;
|
|
53
|
+
blueprint: string;
|
|
54
|
+
}[]>;
|
|
55
|
+
submissions?: Submission[];
|
|
56
|
+
users?: Pick<CmsUser, 'id' | 'name' | 'email' | 'role' | 'twoFactorEnabled'>[];
|
|
57
|
+
stats?: {
|
|
58
|
+
entries: number;
|
|
59
|
+
published: number;
|
|
60
|
+
media: number;
|
|
61
|
+
unread: number;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Asset } from './types.js';
|
|
2
|
+
export type UploadItem = {
|
|
3
|
+
name: string;
|
|
4
|
+
bytes: number;
|
|
5
|
+
state: 'idle' | 'uploading' | 'error' | 'done';
|
|
6
|
+
error?: string;
|
|
7
|
+
};
|
|
8
|
+
export type UploadFailure = {
|
|
9
|
+
file: File;
|
|
10
|
+
message: string;
|
|
11
|
+
};
|
|
12
|
+
export declare function uploadImages(files: File[], onAsset: (asset: Asset) => void, onProgress: (completed: number, total: number, failed: number) => void, blueprint?: string, onState?: (index: number, state: UploadItem['state'], error?: string) => void): Promise<UploadFailure[]>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { api, message } from './client.js';
|
|
2
|
+
export async function uploadImages(files, onAsset, onProgress, blueprint, onState) {
|
|
3
|
+
const failures = [];
|
|
4
|
+
onProgress(0, files.length, 0);
|
|
5
|
+
// One bounded request at a time keeps large batches within the server's per-file limit.
|
|
6
|
+
for (const [index, file] of files.entries()) {
|
|
7
|
+
onState?.(index, 'uploading');
|
|
8
|
+
try {
|
|
9
|
+
const form = new FormData();
|
|
10
|
+
form.set('file', file);
|
|
11
|
+
if (blueprint)
|
|
12
|
+
form.set('blueprint', blueprint);
|
|
13
|
+
onAsset(await api('media/upload', form));
|
|
14
|
+
onState?.(index, 'done');
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
failures.push({ file, message: `${file.name}: ${message(error)}` });
|
|
18
|
+
onState?.(index, 'error', message(error));
|
|
19
|
+
}
|
|
20
|
+
onProgress(index + 1, files.length, failures.length);
|
|
21
|
+
}
|
|
22
|
+
return failures;
|
|
23
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { cn } from 'cn';
|
|
2
|
+
export type WithoutChild<T> = T extends {
|
|
3
|
+
child?: any;
|
|
4
|
+
} ? Omit<T, 'child'> : T;
|
|
5
|
+
export type WithoutChildren<T> = T extends {
|
|
6
|
+
children?: any;
|
|
7
|
+
} ? Omit<T, 'children'> : T;
|
|
8
|
+
export type WithoutChildrenOrChild<T> = WithoutChildren<WithoutChild<T>>;
|
|
9
|
+
export type WithElementRef<T, U extends HTMLElement = HTMLElement> = T & {
|
|
10
|
+
ref?: U | null;
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { cn } from 'cn';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Field, FileBlueprint, Payload, SiteDefinition } from './types.js';
|
|
2
|
+
export declare const imageMimeTypes: string[];
|
|
3
|
+
export declare function fileBlueprints(definition: SiteDefinition): FileBlueprint[];
|
|
4
|
+
export declare function getFileBlueprint(definition: SiteDefinition, id?: string | null): FileBlueprint;
|
|
5
|
+
export declare function effectiveMetadata(defaults: Payload, overrides: Payload, fields: Record<string, Field>): Payload;
|
|
6
|
+
export declare function publicMetadata(fields: Record<string, Field>, values: Payload): Payload;
|
|
7
|
+
export declare function configureFileFields(definition: SiteDefinition): SiteDefinition;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
export const imageMimeTypes = [
|
|
2
|
+
'image/jpeg',
|
|
3
|
+
'image/png',
|
|
4
|
+
'image/webp',
|
|
5
|
+
'image/avif',
|
|
6
|
+
'image/gif',
|
|
7
|
+
'image/svg+xml'
|
|
8
|
+
];
|
|
9
|
+
export function fileBlueprints(definition) {
|
|
10
|
+
const configured = definition.fileBlueprints ?? [];
|
|
11
|
+
if (configured.some((b) => b.id === 'default'))
|
|
12
|
+
return configured;
|
|
13
|
+
return [
|
|
14
|
+
...configured,
|
|
15
|
+
{
|
|
16
|
+
id: 'default',
|
|
17
|
+
kind: 'file',
|
|
18
|
+
label: 'Default image',
|
|
19
|
+
accept: imageMimeTypes,
|
|
20
|
+
fields: {
|
|
21
|
+
alt: { type: 'text', label: 'Alternative text' },
|
|
22
|
+
...(definition.config.media.photographerCollection
|
|
23
|
+
? {
|
|
24
|
+
photographer: {
|
|
25
|
+
type: 'relation',
|
|
26
|
+
label: 'Photographer',
|
|
27
|
+
collection: definition.config.media.photographerCollection
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
: {})
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
];
|
|
34
|
+
}
|
|
35
|
+
export function getFileBlueprint(definition, id) {
|
|
36
|
+
const key = id ?? definition.config.media.defaultFileBlueprint ?? 'default';
|
|
37
|
+
const blueprint = fileBlueprints(definition).find((b) => b.id === key);
|
|
38
|
+
if (!blueprint)
|
|
39
|
+
throw new Error(`Unknown file blueprint: ${key}`);
|
|
40
|
+
return blueprint;
|
|
41
|
+
}
|
|
42
|
+
export function effectiveMetadata(defaults, overrides, fields) {
|
|
43
|
+
const result = { ...defaults };
|
|
44
|
+
for (const key of Object.keys(fields)) {
|
|
45
|
+
if (overrides[key] !== undefined && overrides[key] !== null)
|
|
46
|
+
result[key] = overrides[key];
|
|
47
|
+
}
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
// Keep retired metadata stored without exposing fields removed from the blueprint.
|
|
51
|
+
export function publicMetadata(fields, values) {
|
|
52
|
+
const result = {};
|
|
53
|
+
for (const [key, field] of Object.entries(fields)) {
|
|
54
|
+
const value = values[key];
|
|
55
|
+
if (value === undefined)
|
|
56
|
+
continue;
|
|
57
|
+
if (field.type === 'group' && value && typeof value === 'object' && !Array.isArray(value))
|
|
58
|
+
result[key] = publicMetadata(field.fields, value);
|
|
59
|
+
else if (field.type === 'repeatable' && Array.isArray(value))
|
|
60
|
+
result[key] = value.map((row) => publicMetadata(field.fields, row));
|
|
61
|
+
else
|
|
62
|
+
result[key] = value;
|
|
63
|
+
}
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
export function configureFileFields(definition) {
|
|
67
|
+
const blueprints = fileBlueprints(definition);
|
|
68
|
+
const ids = new Set();
|
|
69
|
+
for (const blueprint of blueprints) {
|
|
70
|
+
if (ids.has(blueprint.id))
|
|
71
|
+
throw new Error(`Duplicate file blueprint: ${blueprint.id}`);
|
|
72
|
+
ids.add(blueprint.id);
|
|
73
|
+
if (!blueprint.accept.length || blueprint.accept.some((mime) => !imageMimeTypes.includes(mime)))
|
|
74
|
+
throw new Error(`${blueprint.id}: only supported image MIME types can be accepted for now`);
|
|
75
|
+
if (blueprint.fields.image)
|
|
76
|
+
throw new Error(`${blueprint.id}: image is reserved for gallery references`);
|
|
77
|
+
const check = (fields) => {
|
|
78
|
+
for (const field of Object.values(fields)) {
|
|
79
|
+
if (['media', 'media-list', 'gallery'].includes(field.type))
|
|
80
|
+
throw new Error(`${blueprint.id}: file metadata cannot contain media fields`);
|
|
81
|
+
if (field.type === 'relation' &&
|
|
82
|
+
!definition.blueprints.some((b) => b.kind === 'collection' && b.id === field.collection))
|
|
83
|
+
throw new Error(`${blueprint.id}: unknown relation collection ${field.collection}`);
|
|
84
|
+
if (field.fields)
|
|
85
|
+
check(field.fields);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
check(blueprint.fields);
|
|
89
|
+
}
|
|
90
|
+
definition.fileBlueprints = blueprints;
|
|
91
|
+
getFileBlueprint(definition);
|
|
92
|
+
const visit = (fields) => {
|
|
93
|
+
for (const field of Object.values(fields)) {
|
|
94
|
+
if (['media', 'media-list', 'gallery'].includes(field.type)) {
|
|
95
|
+
const file = getFileBlueprint(definition, field.fileBlueprint);
|
|
96
|
+
field.fileBlueprint = file.id;
|
|
97
|
+
if (field.type === 'gallery') {
|
|
98
|
+
field.fields = {};
|
|
99
|
+
for (const key of field.overrides ?? []) {
|
|
100
|
+
if (!file.fields[key])
|
|
101
|
+
throw new Error(`Unknown override ${key} in file blueprint ${file.id}`);
|
|
102
|
+
field.fields[key] = { ...file.fields[key], required: false };
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (field.fields)
|
|
107
|
+
visit(field.fields);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
definition.blueprints.forEach((blueprint) => visit(blueprint.fields));
|
|
111
|
+
return definition;
|
|
112
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Gallery rows retain the same shape as existing repeatable image rows.
|
|
2
|
+
export function galleryFields(field) {
|
|
3
|
+
return {
|
|
4
|
+
image: { type: 'media', required: true, fileBlueprint: field.fileBlueprint },
|
|
5
|
+
...field.fields
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export function selectGalleryImages(rows, ids) {
|
|
9
|
+
const remaining = [...rows];
|
|
10
|
+
return ids.map((image) => {
|
|
11
|
+
const index = remaining.findIndex((row) => row.image === image);
|
|
12
|
+
return index < 0 ? { image } : remaining.splice(index, 1)[0];
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { Blueprint, Field, SiteDefinition } from './types.js';
|
|
3
|
+
export declare function yamlFile<T>(path: string, schema: z.ZodType<T>): T;
|
|
4
|
+
export declare function loadDefinition(root?: string): SiteDefinition;
|
|
5
|
+
export declare function visitFields(fields: Record<string, Field>, visit: (field: Field, key: string) => void): void;
|
|
6
|
+
export declare function validateDefinitions(defs: Blueprint[]): void;
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { configureFileFields, imageMimeTypes } from './files.js';
|
|
2
|
+
import { readFileSync, readdirSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { parseDocument, LineCounter } from 'yaml';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { isBlueprintIcon } from '../server/blueprint-icons.js';
|
|
7
|
+
const key = z
|
|
8
|
+
.string()
|
|
9
|
+
.regex(/^[a-z][a-zA-Z0-9_-]*$/, 'Use a stable machine key starting with a lowercase letter')
|
|
10
|
+
.refine((v) => !['__proto__', 'constructor', 'prototype'].includes(v), 'Reserved machine key');
|
|
11
|
+
const field = z.lazy(() => z
|
|
12
|
+
.object({
|
|
13
|
+
type: z.enum([
|
|
14
|
+
'text',
|
|
15
|
+
'slug',
|
|
16
|
+
'textarea',
|
|
17
|
+
'number',
|
|
18
|
+
'date',
|
|
19
|
+
'boolean',
|
|
20
|
+
'select',
|
|
21
|
+
'multiselect',
|
|
22
|
+
'richtext',
|
|
23
|
+
'media',
|
|
24
|
+
'media-list',
|
|
25
|
+
'gallery',
|
|
26
|
+
'relation',
|
|
27
|
+
'group',
|
|
28
|
+
'repeatable'
|
|
29
|
+
]),
|
|
30
|
+
label: z.string().optional(),
|
|
31
|
+
description: z.string().optional(),
|
|
32
|
+
required: z.boolean().optional(),
|
|
33
|
+
from: key.optional(),
|
|
34
|
+
fileBlueprint: key.optional(),
|
|
35
|
+
overrides: z
|
|
36
|
+
.array(key)
|
|
37
|
+
.refine((v) => new Set(v).size === v.length, 'Duplicate override')
|
|
38
|
+
.optional(),
|
|
39
|
+
collection: key.optional(),
|
|
40
|
+
options: z.array(z.string()).nonempty().optional(),
|
|
41
|
+
fields: z.record(key, field).optional(),
|
|
42
|
+
min: z.number().optional(),
|
|
43
|
+
max: z.number().optional()
|
|
44
|
+
})
|
|
45
|
+
.strict()
|
|
46
|
+
.superRefine((v, ctx) => {
|
|
47
|
+
if (['group', 'repeatable'].includes(v.type) && !v.fields)
|
|
48
|
+
ctx.addIssue({ code: 'custom', message: 'Nested fields are required' });
|
|
49
|
+
if (v.type === 'gallery' && v.fields)
|
|
50
|
+
ctx.addIssue({
|
|
51
|
+
code: 'custom',
|
|
52
|
+
message: 'Use fileBlueprint and overrides to configure gallery fields'
|
|
53
|
+
});
|
|
54
|
+
if (v.overrides && v.type !== 'gallery')
|
|
55
|
+
ctx.addIssue({ code: 'custom', message: 'Only galleries support overrides' });
|
|
56
|
+
if (v.fileBlueprint && !['media', 'media-list', 'gallery'].includes(v.type))
|
|
57
|
+
ctx.addIssue({
|
|
58
|
+
code: 'custom',
|
|
59
|
+
message: 'fileBlueprint requires a media or gallery field'
|
|
60
|
+
});
|
|
61
|
+
if (v.type === 'gallery' && v.collection)
|
|
62
|
+
ctx.addIssue({ code: 'custom', message: 'Define gallery relations in a file blueprint' });
|
|
63
|
+
if (v.type === 'relation' && !v.collection)
|
|
64
|
+
ctx.addIssue({ code: 'custom', message: 'Relation collection is required' });
|
|
65
|
+
if (['select', 'multiselect'].includes(v.type) && !v.options)
|
|
66
|
+
ctx.addIssue({ code: 'custom', message: 'Select options are required' });
|
|
67
|
+
}));
|
|
68
|
+
const blueprint = z
|
|
69
|
+
.object({
|
|
70
|
+
id: key,
|
|
71
|
+
label: z.string().min(1),
|
|
72
|
+
kind: z.enum(['page', 'site', 'collection', 'form']),
|
|
73
|
+
icon: z
|
|
74
|
+
.string()
|
|
75
|
+
.refine(isBlueprintIcon, 'Unknown Lucide icon; use a lowercase kebab-case name from lucide.dev/icons')
|
|
76
|
+
.optional(),
|
|
77
|
+
description: z.string().optional(),
|
|
78
|
+
preview: z
|
|
79
|
+
.string()
|
|
80
|
+
.regex(/^\/(?!\/)[^?#]*$/)
|
|
81
|
+
.optional(),
|
|
82
|
+
fields: z.record(key, field),
|
|
83
|
+
columns: z.array(key).optional(),
|
|
84
|
+
export: z.array(key).optional()
|
|
85
|
+
})
|
|
86
|
+
.strict();
|
|
87
|
+
const fileBlueprint = z
|
|
88
|
+
.object({
|
|
89
|
+
id: key,
|
|
90
|
+
kind: z.literal('file'),
|
|
91
|
+
label: z.string().min(1),
|
|
92
|
+
accept: z.array(z.string()).nonempty().default(imageMimeTypes),
|
|
93
|
+
fields: z.record(key, field)
|
|
94
|
+
})
|
|
95
|
+
.strict();
|
|
96
|
+
const anyBlueprint = z.discriminatedUnion('kind', [blueprint, fileBlueprint]);
|
|
97
|
+
const config = z
|
|
98
|
+
.object({
|
|
99
|
+
name: z.string().min(1),
|
|
100
|
+
media: z
|
|
101
|
+
.object({
|
|
102
|
+
workerUrl: z.url(),
|
|
103
|
+
photographerCollection: key.optional(),
|
|
104
|
+
defaultFileBlueprint: key.optional(),
|
|
105
|
+
uploadLimit: z.number().int().min(1).max(100_000_000).default(100_000_000),
|
|
106
|
+
presets: z
|
|
107
|
+
.record(z.string().regex(/^[a-z][a-z0-9_-]*$/, 'Use a lowercase media preset key'), z
|
|
108
|
+
.object({
|
|
109
|
+
sizes: z.array(z.number().int().min(1).max(8192)).min(1).max(12),
|
|
110
|
+
formats: z
|
|
111
|
+
.object({
|
|
112
|
+
webp: z.number().int().min(1).max(100).optional(),
|
|
113
|
+
avif: z.number().int().min(1).max(100).optional(),
|
|
114
|
+
jpeg: z.number().int().min(1).max(100).optional()
|
|
115
|
+
})
|
|
116
|
+
.strict()
|
|
117
|
+
.refine((v) => Object.keys(v).length > 0, 'Choose at least one output format')
|
|
118
|
+
})
|
|
119
|
+
.strict())
|
|
120
|
+
.refine((v) => Object.keys(v).length > 0, 'Define an image preset')
|
|
121
|
+
})
|
|
122
|
+
.strict()
|
|
123
|
+
})
|
|
124
|
+
.strict();
|
|
125
|
+
export function yamlFile(path, schema) {
|
|
126
|
+
const lines = new LineCounter();
|
|
127
|
+
const doc = parseDocument(readFileSync(path, 'utf8'), { lineCounter: lines, uniqueKeys: true });
|
|
128
|
+
if (doc.errors.length)
|
|
129
|
+
throw new Error(`${path}: ${doc.errors.map((e) => e.message).join('; ')}`);
|
|
130
|
+
const result = schema.safeParse(doc.toJS({ maxAliasCount: 20 }));
|
|
131
|
+
if (!result.success)
|
|
132
|
+
throw new Error(result.error.issues
|
|
133
|
+
.map((i) => {
|
|
134
|
+
const node = doc.getIn(i.path.filter((p) => typeof p !== 'symbol'), true);
|
|
135
|
+
return `${path}:${lines.linePos(node?.range?.[0] ?? 0).line}: ${i.path.join('.')}: ${i.message}`;
|
|
136
|
+
})
|
|
137
|
+
.join('\n'));
|
|
138
|
+
return result.data;
|
|
139
|
+
}
|
|
140
|
+
function files(dir) {
|
|
141
|
+
return readdirSync(dir, { withFileTypes: true }).flatMap((f) => f.isDirectory() ? files(join(dir, f.name)) : /\.ya?ml$/.test(f.name) ? [join(dir, f.name)] : []);
|
|
142
|
+
}
|
|
143
|
+
export function loadDefinition(root = 'sandcms') {
|
|
144
|
+
const settings = yamlFile(join(root, 'config.yaml'), config);
|
|
145
|
+
const definitions = files(join(root, 'blueprints'))
|
|
146
|
+
.sort()
|
|
147
|
+
.map((p) => yamlFile(p, anyBlueprint));
|
|
148
|
+
const content = definitions.filter((b) => b.kind !== 'file');
|
|
149
|
+
validateDefinitions(content);
|
|
150
|
+
if (settings.media.photographerCollection &&
|
|
151
|
+
!definitions.some((b) => b.kind === 'collection' && b.id === settings.media.photographerCollection))
|
|
152
|
+
throw new Error('media.photographerCollection must name a collection');
|
|
153
|
+
return configureFileFields({
|
|
154
|
+
config: settings,
|
|
155
|
+
blueprints: content,
|
|
156
|
+
fileBlueprints: definitions.filter((b) => b.kind === 'file')
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
export function visitFields(fields, visit) {
|
|
160
|
+
for (const [key, f] of Object.entries(fields)) {
|
|
161
|
+
visit(f, key);
|
|
162
|
+
if (f.fields)
|
|
163
|
+
visitFields(f.fields, visit);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
export function validateDefinitions(defs) {
|
|
167
|
+
const ids = new Set(), routes = new Set();
|
|
168
|
+
for (const b of defs) {
|
|
169
|
+
if (ids.has(b.id))
|
|
170
|
+
throw new Error(`Duplicate blueprint key: ${b.id}`);
|
|
171
|
+
ids.add(b.id);
|
|
172
|
+
if (b.preview) {
|
|
173
|
+
const route = b.preview.replace(/\{[^}]+\}/g, '{}');
|
|
174
|
+
if (routes.has(route))
|
|
175
|
+
throw new Error(`Duplicate preview route ownership: ${b.preview}`);
|
|
176
|
+
routes.add(route);
|
|
177
|
+
}
|
|
178
|
+
visitFields(b.fields, (f) => {
|
|
179
|
+
if (f.collection && !defs.some((d) => d.id === f.collection && d.kind === 'collection'))
|
|
180
|
+
throw new Error(`${b.id}: unknown relation collection ${f.collection}`);
|
|
181
|
+
});
|
|
182
|
+
for (const col of [...(b.columns ?? []), ...(b.export ?? [])])
|
|
183
|
+
if (!b.fields[col])
|
|
184
|
+
throw new Error(`${b.id}: unknown form column ${col}`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Preserve data hidden by removed blueprint fields, while still allowing explicit nulls/removals.
|
|
2
|
+
export function mergeDraft(fields, previous, updates) {
|
|
3
|
+
const merged = { ...previous, ...updates };
|
|
4
|
+
for (const [key, field] of Object.entries(fields)) {
|
|
5
|
+
const old = previous[key], value = updates[key];
|
|
6
|
+
if (field.type === 'group' &&
|
|
7
|
+
old &&
|
|
8
|
+
value &&
|
|
9
|
+
typeof old === 'object' &&
|
|
10
|
+
!Array.isArray(old) &&
|
|
11
|
+
typeof value === 'object' &&
|
|
12
|
+
!Array.isArray(value))
|
|
13
|
+
merged[key] = mergeDraft(field.fields, old, value);
|
|
14
|
+
// Repeatable rows are complete objects, including hidden data, supplied by the editor.
|
|
15
|
+
// Merging by index would move retired field values to unrelated rows after reordering.
|
|
16
|
+
}
|
|
17
|
+
return merged;
|
|
18
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export type Json = null | boolean | number | string | Json[] | {
|
|
2
|
+
[key: string]: Json;
|
|
3
|
+
};
|
|
4
|
+
export type Payload = {
|
|
5
|
+
[key: string]: Json;
|
|
6
|
+
};
|
|
7
|
+
export type FieldType = 'text' | 'slug' | 'textarea' | 'number' | 'date' | 'boolean' | 'select' | 'multiselect' | 'richtext' | 'media' | 'media-list' | 'gallery' | 'relation' | 'group' | 'repeatable';
|
|
8
|
+
export interface Field {
|
|
9
|
+
type: FieldType;
|
|
10
|
+
label?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
required?: boolean;
|
|
13
|
+
from?: string;
|
|
14
|
+
collection?: string;
|
|
15
|
+
options?: string[];
|
|
16
|
+
fields?: Record<string, Field>;
|
|
17
|
+
fileBlueprint?: string;
|
|
18
|
+
overrides?: string[];
|
|
19
|
+
min?: number;
|
|
20
|
+
max?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface Blueprint {
|
|
23
|
+
id: string;
|
|
24
|
+
label: string;
|
|
25
|
+
kind: 'page' | 'site' | 'collection' | 'form';
|
|
26
|
+
icon?: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
preview?: string;
|
|
29
|
+
fields: Record<string, Field>;
|
|
30
|
+
columns?: string[];
|
|
31
|
+
export?: string[];
|
|
32
|
+
}
|
|
33
|
+
export interface FileBlueprint {
|
|
34
|
+
id: string;
|
|
35
|
+
kind: 'file';
|
|
36
|
+
label: string;
|
|
37
|
+
accept: string[];
|
|
38
|
+
fields: Record<string, Field>;
|
|
39
|
+
}
|
|
40
|
+
export interface ImagePreset {
|
|
41
|
+
sizes: number[];
|
|
42
|
+
formats: Partial<Record<'webp' | 'avif' | 'jpeg', number>>;
|
|
43
|
+
}
|
|
44
|
+
export interface SiteConfig {
|
|
45
|
+
name: string;
|
|
46
|
+
media: {
|
|
47
|
+
workerUrl: string;
|
|
48
|
+
photographerCollection?: string;
|
|
49
|
+
defaultFileBlueprint?: string;
|
|
50
|
+
uploadLimit: number;
|
|
51
|
+
presets: Record<string, ImagePreset>;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export interface SiteDefinition {
|
|
55
|
+
config: SiteConfig;
|
|
56
|
+
blueprints: Blueprint[];
|
|
57
|
+
fileBlueprints?: FileBlueprint[];
|
|
58
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Field, Json, Payload } from './types.js';
|
|
2
|
+
export declare class ValidationError extends Error {
|
|
3
|
+
fields: Record<string, string>;
|
|
4
|
+
constructor(fields: Record<string, string>);
|
|
5
|
+
}
|
|
6
|
+
export declare function jsonPayload(value: unknown, maxBytes?: number): Payload;
|
|
7
|
+
export declare function validatePayload(fields: Record<string, Field>, value: unknown, publish?: boolean): Payload;
|
|
8
|
+
export declare function walkValues(fields: Record<string, Field>, payload: Payload, visit: (field: Field, value: Json, key: string) => Json | undefined): Payload;
|