@elytracms/studio 0.0.1
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 +3 -0
- package/convex/assets.ts +107 -0
- package/convex/auth.config.ts +15 -0
- package/convex/auth.ts +50 -0
- package/convex/cliTokens.ts +63 -0
- package/convex/cms.ts +174 -0
- package/convex/content.ts +316 -0
- package/convex/delivery.ts +266 -0
- package/convex/functions.ts +35 -0
- package/convex/graphs.ts +51 -0
- package/convex/guard.ts +67 -0
- package/convex/http.ts +30 -0
- package/convex/members.ts +83 -0
- package/convex/publishing.ts +102 -0
- package/convex/references.ts +168 -0
- package/convex/schema.ts +173 -0
- package/convex/sync.ts +322 -0
- package/convex/tsconfig.json +12 -0
- package/convex/users.ts +23 -0
- package/convex/webhooks.ts +85 -0
- package/dist/components/assets/asset-library.d.ts +14 -0
- package/dist/components/assets/asset-library.js +191 -0
- package/dist/components/assets/asset-library.js.map +1 -0
- package/dist/components/assets/asset-metadata.d.ts +34 -0
- package/dist/components/assets/asset-metadata.js +40 -0
- package/dist/components/assets/asset-metadata.js.map +1 -0
- package/dist/components/assets/asset-search.d.ts +7 -0
- package/dist/components/assets/asset-search.js +12 -0
- package/dist/components/assets/asset-search.js.map +1 -0
- package/dist/components/assets/asset-selection.d.ts +17 -0
- package/dist/components/assets/asset-selection.js +33 -0
- package/dist/components/assets/asset-selection.js.map +1 -0
- package/dist/components/assets/assets-store.d.ts +51 -0
- package/dist/components/assets/assets-store.js +153 -0
- package/dist/components/assets/assets-store.js.map +1 -0
- package/dist/components/auth-context.d.ts +38 -0
- package/dist/components/auth-context.js +88 -0
- package/dist/components/auth-context.js.map +1 -0
- package/dist/components/backend-gate.d.ts +19 -0
- package/dist/components/backend-gate.js +63 -0
- package/dist/components/backend-gate.js.map +1 -0
- package/dist/components/breadcrumb-context.d.ts +39 -0
- package/dist/components/breadcrumb-context.js +38 -0
- package/dist/components/breadcrumb-context.js.map +1 -0
- package/dist/components/builder/blocks-model.d.ts +80 -0
- package/dist/components/builder/blocks-model.js +181 -0
- package/dist/components/builder/blocks-model.js.map +1 -0
- package/dist/components/builder/blocks-panel.d.ts +44 -0
- package/dist/components/builder/blocks-panel.js +147 -0
- package/dist/components/builder/blocks-panel.js.map +1 -0
- package/dist/components/builder/builder-store.d.ts +69 -0
- package/dist/components/builder/builder-store.js +294 -0
- package/dist/components/builder/builder-store.js.map +1 -0
- package/dist/components/builder/canvas-stylesheet.d.ts +4 -0
- package/dist/components/builder/canvas-stylesheet.js +24 -0
- package/dist/components/builder/canvas-stylesheet.js.map +1 -0
- package/dist/components/builder/canvas.d.ts +8 -0
- package/dist/components/builder/canvas.js +723 -0
- package/dist/components/builder/canvas.js.map +1 -0
- package/dist/components/builder/clipboard-actions.d.ts +93 -0
- package/dist/components/builder/clipboard-actions.js +246 -0
- package/dist/components/builder/clipboard-actions.js.map +1 -0
- package/dist/components/builder/composition-field-editor.d.ts +11 -0
- package/dist/components/builder/composition-field-editor.js +150 -0
- package/dist/components/builder/composition-field-editor.js.map +1 -0
- package/dist/components/builder/composition-scope.d.ts +16 -0
- package/dist/components/builder/composition-scope.js +7 -0
- package/dist/components/builder/composition-scope.js.map +1 -0
- package/dist/components/builder/drag-session.d.ts +41 -0
- package/dist/components/builder/drag-session.js +51 -0
- package/dist/components/builder/drag-session.js.map +1 -0
- package/dist/components/builder/fixture-thumbnail.d.ts +18 -0
- package/dist/components/builder/fixture-thumbnail.js +97 -0
- package/dist/components/builder/fixture-thumbnail.js.map +1 -0
- package/dist/components/builder/inline-edit.d.ts +142 -0
- package/dist/components/builder/inline-edit.js +136 -0
- package/dist/components/builder/inline-edit.js.map +1 -0
- package/dist/components/builder/insert-context.d.ts +14 -0
- package/dist/components/builder/insert-context.js +65 -0
- package/dist/components/builder/insert-context.js.map +1 -0
- package/dist/components/builder/insert-menu.d.ts +9 -0
- package/dist/components/builder/insert-menu.js +9 -0
- package/dist/components/builder/insert-menu.js.map +1 -0
- package/dist/components/builder/layout-inspector.d.ts +14 -0
- package/dist/components/builder/layout-inspector.js +84 -0
- package/dist/components/builder/layout-inspector.js.map +1 -0
- package/dist/components/builder/node-factory.d.ts +17 -0
- package/dist/components/builder/node-factory.js +90 -0
- package/dist/components/builder/node-factory.js.map +1 -0
- package/dist/components/builder/page-tree.d.ts +3 -0
- package/dist/components/builder/page-tree.js +207 -0
- package/dist/components/builder/page-tree.js.map +1 -0
- package/dist/components/builder/property-inspector.d.ts +1 -0
- package/dist/components/builder/property-inspector.js +233 -0
- package/dist/components/builder/property-inspector.js.map +1 -0
- package/dist/components/builder/rich-text-toolbar.d.ts +4 -0
- package/dist/components/builder/rich-text-toolbar.js +104 -0
- package/dist/components/builder/rich-text-toolbar.js.map +1 -0
- package/dist/components/builder/spacing-handles.d.ts +22 -0
- package/dist/components/builder/spacing-handles.js +213 -0
- package/dist/components/builder/spacing-handles.js.map +1 -0
- package/dist/components/cms/asset-picker.d.ts +12 -0
- package/dist/components/cms/asset-picker.js +60 -0
- package/dist/components/cms/asset-picker.js.map +1 -0
- package/dist/components/cms/bulk-actions.d.ts +60 -0
- package/dist/components/cms/bulk-actions.js +95 -0
- package/dist/components/cms/bulk-actions.js.map +1 -0
- package/dist/components/cms/bulk-bar.d.ts +23 -0
- package/dist/components/cms/bulk-bar.js +26 -0
- package/dist/components/cms/bulk-bar.js.map +1 -0
- package/dist/components/cms/cell-edit.d.ts +91 -0
- package/dist/components/cms/cell-edit.js +144 -0
- package/dist/components/cms/cell-edit.js.map +1 -0
- package/dist/components/cms/cell.d.ts +29 -0
- package/dist/components/cms/cell.js +127 -0
- package/dist/components/cms/cell.js.map +1 -0
- package/dist/components/cms/cms-index.d.ts +8 -0
- package/dist/components/cms/cms-index.js +23 -0
- package/dist/components/cms/cms-index.js.map +1 -0
- package/dist/components/cms/cms-store.d.ts +188 -0
- package/dist/components/cms/cms-store.js +702 -0
- package/dist/components/cms/cms-store.js.map +1 -0
- package/dist/components/cms/collection-table.d.ts +6 -0
- package/dist/components/cms/collection-table.js +250 -0
- package/dist/components/cms/collection-table.js.map +1 -0
- package/dist/components/cms/collections-sidebar.d.ts +9 -0
- package/dist/components/cms/collections-sidebar.js +25 -0
- package/dist/components/cms/collections-sidebar.js.map +1 -0
- package/dist/components/cms/detail-editor.d.ts +7 -0
- package/dist/components/cms/detail-editor.js +386 -0
- package/dist/components/cms/detail-editor.js.map +1 -0
- package/dist/components/cms/doc-state.d.ts +13 -0
- package/dist/components/cms/doc-state.js +18 -0
- package/dist/components/cms/doc-state.js.map +1 -0
- package/dist/components/cms/document-editor-context.d.ts +48 -0
- package/dist/components/cms/document-editor-context.js +23 -0
- package/dist/components/cms/document-editor-context.js.map +1 -0
- package/dist/components/cms/editable-cell.d.ts +22 -0
- package/dist/components/cms/editable-cell.js +176 -0
- package/dist/components/cms/editable-cell.js.map +1 -0
- package/dist/components/cms/field-control.d.ts +8 -0
- package/dist/components/cms/field-control.js +149 -0
- package/dist/components/cms/field-control.js.map +1 -0
- package/dist/components/cms/filter-builder.d.ts +12 -0
- package/dist/components/cms/filter-builder.js +84 -0
- package/dist/components/cms/filter-builder.js.map +1 -0
- package/dist/components/cms/import-export.d.ts +6 -0
- package/dist/components/cms/import-export.js +33 -0
- package/dist/components/cms/import-export.js.map +1 -0
- package/dist/components/cms/new-page-dialog.d.ts +22 -0
- package/dist/components/cms/new-page-dialog.js +42 -0
- package/dist/components/cms/new-page-dialog.js.map +1 -0
- package/dist/components/cms/reference-confirm.d.ts +25 -0
- package/dist/components/cms/reference-confirm.js +124 -0
- package/dist/components/cms/reference-confirm.js.map +1 -0
- package/dist/components/cms/relation-picker.d.ts +16 -0
- package/dist/components/cms/relation-picker.js +47 -0
- package/dist/components/cms/relation-picker.js.map +1 -0
- package/dist/components/cms/use-cell-edit.d.ts +33 -0
- package/dist/components/cms/use-cell-edit.js +125 -0
- package/dist/components/cms/use-cell-edit.js.map +1 -0
- package/dist/components/cms/versions-model.d.ts +15 -0
- package/dist/components/cms/versions-model.js +23 -0
- package/dist/components/cms/versions-model.js.map +1 -0
- package/dist/components/cms/versions-pane.d.ts +14 -0
- package/dist/components/cms/versions-pane.js +86 -0
- package/dist/components/cms/versions-pane.js.map +1 -0
- package/dist/components/cms/view-bar.d.ts +11 -0
- package/dist/components/cms/view-bar.js +80 -0
- package/dist/components/cms/view-bar.js.map +1 -0
- package/dist/components/collab/collab-context.d.ts +34 -0
- package/dist/components/collab/collab-context.js +52 -0
- package/dist/components/collab/collab-context.js.map +1 -0
- package/dist/components/collab/collab-seed.d.ts +27 -0
- package/dist/components/collab/collab-seed.js +42 -0
- package/dist/components/collab/collab-seed.js.map +1 -0
- package/dist/components/components/component-detail.d.ts +9 -0
- package/dist/components/components/component-detail.js +30 -0
- package/dist/components/components/component-detail.js.map +1 -0
- package/dist/components/components/component-status.d.ts +10 -0
- package/dist/components/components/component-status.js +30 -0
- package/dist/components/components/component-status.js.map +1 -0
- package/dist/components/components/components-index.d.ts +8 -0
- package/dist/components/components/components-index.js +42 -0
- package/dist/components/components/components-index.js.map +1 -0
- package/dist/components/components/field-inspector.d.ts +9 -0
- package/dist/components/components/field-inspector.js +38 -0
- package/dist/components/components/field-inspector.js.map +1 -0
- package/dist/components/components/fixture-runner.d.ts +10 -0
- package/dist/components/components/fixture-runner.js +24 -0
- package/dist/components/components/fixture-runner.js.map +1 -0
- package/dist/components/components/registry-browser.d.ts +4 -0
- package/dist/components/components/registry-browser.js +64 -0
- package/dist/components/components/registry-browser.js.map +1 -0
- package/dist/components/current-user-menu.d.ts +13 -0
- package/dist/components/current-user-menu.js +31 -0
- package/dist/components/current-user-menu.js.map +1 -0
- package/dist/components/dev-login-badge.d.ts +9 -0
- package/dist/components/dev-login-badge.js +18 -0
- package/dist/components/dev-login-badge.js.map +1 -0
- package/dist/components/extensions/extensions-view.d.ts +7 -0
- package/dist/components/extensions/extensions-view.js +126 -0
- package/dist/components/extensions/extensions-view.js.map +1 -0
- package/dist/components/guards.d.ts +27 -0
- package/dist/components/guards.js +46 -0
- package/dist/components/guards.js.map +1 -0
- package/dist/components/inspector/inspector-sidebar.d.ts +26 -0
- package/dist/components/inspector/inspector-sidebar.js +17 -0
- package/dist/components/inspector/inspector-sidebar.js.map +1 -0
- package/dist/components/operation-error.d.ts +17 -0
- package/dist/components/operation-error.js +54 -0
- package/dist/components/operation-error.js.map +1 -0
- package/dist/components/playground-badge.d.ts +10 -0
- package/dist/components/playground-badge.js +19 -0
- package/dist/components/playground-badge.js.map +1 -0
- package/dist/components/project-list.d.ts +15 -0
- package/dist/components/project-list.js +52 -0
- package/dist/components/project-list.js.map +1 -0
- package/dist/components/project-session.d.ts +46 -0
- package/dist/components/project-session.js +107 -0
- package/dist/components/project-session.js.map +1 -0
- package/dist/components/project-switcher.d.ts +11 -0
- package/dist/components/project-switcher.js +44 -0
- package/dist/components/project-switcher.js.map +1 -0
- package/dist/components/references/builder-deep-link.d.ts +12 -0
- package/dist/components/references/builder-deep-link.js +53 -0
- package/dist/components/references/builder-deep-link.js.map +1 -0
- package/dist/components/references/references-panel.d.ts +17 -0
- package/dist/components/references/references-panel.js +66 -0
- package/dist/components/references/references-panel.js.map +1 -0
- package/dist/components/routes/redirect-chain.d.ts +9 -0
- package/dist/components/routes/redirect-chain.js +16 -0
- package/dist/components/routes/redirect-chain.js.map +1 -0
- package/dist/components/routes/redirect-manager.d.ts +13 -0
- package/dist/components/routes/redirect-manager.js +24 -0
- package/dist/components/routes/redirect-manager.js.map +1 -0
- package/dist/components/routes/route-list.d.ts +35 -0
- package/dist/components/routes/route-list.js +69 -0
- package/dist/components/routes/route-list.js.map +1 -0
- package/dist/components/routes/routes-shell.d.ts +14 -0
- package/dist/components/routes/routes-shell.js +68 -0
- package/dist/components/routes/routes-shell.js.map +1 -0
- package/dist/components/section-nav.d.ts +17 -0
- package/dist/components/section-nav.js +33 -0
- package/dist/components/section-nav.js.map +1 -0
- package/dist/components/section-state.d.ts +24 -0
- package/dist/components/section-state.js +78 -0
- package/dist/components/section-state.js.map +1 -0
- package/dist/components/section-surface.d.ts +31 -0
- package/dist/components/section-surface.js +46 -0
- package/dist/components/section-surface.js.map +1 -0
- package/dist/components/sections.d.ts +38 -0
- package/dist/components/sections.js +72 -0
- package/dist/components/sections.js.map +1 -0
- package/dist/components/settings-form.d.ts +10 -0
- package/dist/components/settings-form.js +17 -0
- package/dist/components/settings-form.js.map +1 -0
- package/dist/components/studio-context.d.ts +22 -0
- package/dist/components/studio-context.js +48 -0
- package/dist/components/studio-context.js.map +1 -0
- package/dist/components/studio-project-screen.d.ts +19 -0
- package/dist/components/studio-project-screen.js +195 -0
- package/dist/components/studio-project-screen.js.map +1 -0
- package/dist/components/studio-shell.d.ts +18 -0
- package/dist/components/studio-shell.js +64 -0
- package/dist/components/studio-shell.js.map +1 -0
- package/dist/components/theme-context.d.ts +17 -0
- package/dist/components/theme-context.js +26 -0
- package/dist/components/theme-context.js.map +1 -0
- package/dist/components/workspace-gate.d.ts +12 -0
- package/dist/components/workspace-gate.js +27 -0
- package/dist/components/workspace-gate.js.map +1 -0
- package/dist/components/workspace-projects.d.ts +13 -0
- package/dist/components/workspace-projects.js +18 -0
- package/dist/components/workspace-projects.js.map +1 -0
- package/dist/lib/assets/delete-asset.d.ts +34 -0
- package/dist/lib/assets/delete-asset.js +34 -0
- package/dist/lib/assets/delete-asset.js.map +1 -0
- package/dist/lib/assets/image-dimensions.d.ts +18 -0
- package/dist/lib/assets/image-dimensions.js +26 -0
- package/dist/lib/assets/image-dimensions.js.map +1 -0
- package/dist/lib/assets/index.d.ts +9 -0
- package/dist/lib/assets/index.js +10 -0
- package/dist/lib/assets/index.js.map +1 -0
- package/dist/lib/assets/upload-state.d.ts +53 -0
- package/dist/lib/assets/upload-state.js +59 -0
- package/dist/lib/assets/upload-state.js.map +1 -0
- package/dist/lib/assets/upload.d.ts +56 -0
- package/dist/lib/assets/upload.js +125 -0
- package/dist/lib/assets/upload.js.map +1 -0
- package/dist/lib/auth/auth-adapter.d.ts +57 -0
- package/dist/lib/auth/auth-adapter.js +13 -0
- package/dist/lib/auth/auth-adapter.js.map +1 -0
- package/dist/lib/auth/convex-auth-adapter.d.ts +39 -0
- package/dist/lib/auth/convex-auth-adapter.js +171 -0
- package/dist/lib/auth/convex-auth-adapter.js.map +1 -0
- package/dist/lib/auth/dev-auto-login-adapter.d.ts +25 -0
- package/dist/lib/auth/dev-auto-login-adapter.js +40 -0
- package/dist/lib/auth/dev-auto-login-adapter.js.map +1 -0
- package/dist/lib/auth/index.d.ts +28 -0
- package/dist/lib/auth/index.js +61 -0
- package/dist/lib/auth/index.js.map +1 -0
- package/dist/lib/auth/local-auth-adapter.d.ts +57 -0
- package/dist/lib/auth/local-auth-adapter.js +78 -0
- package/dist/lib/auth/local-auth-adapter.js.map +1 -0
- package/dist/lib/auth/route-guard.d.ts +33 -0
- package/dist/lib/auth/route-guard.js +51 -0
- package/dist/lib/auth/route-guard.js.map +1 -0
- package/dist/lib/auth-errors.d.ts +42 -0
- package/dist/lib/auth-errors.js +74 -0
- package/dist/lib/auth-errors.js.map +1 -0
- package/dist/lib/bindings/section-bindings.d.ts +24 -0
- package/dist/lib/bindings/section-bindings.js +9 -0
- package/dist/lib/bindings/section-bindings.js.map +1 -0
- package/dist/lib/clipboard/index.d.ts +7 -0
- package/dist/lib/clipboard/index.js +8 -0
- package/dist/lib/clipboard/index.js.map +1 -0
- package/dist/lib/clipboard/os-clipboard.d.ts +46 -0
- package/dist/lib/clipboard/os-clipboard.js +105 -0
- package/dist/lib/clipboard/os-clipboard.js.map +1 -0
- package/dist/lib/clipboard/paste-issues.d.ts +34 -0
- package/dist/lib/clipboard/paste-issues.js +67 -0
- package/dist/lib/clipboard/paste-issues.js.map +1 -0
- package/dist/lib/clipboard/paste-target.d.ts +20 -0
- package/dist/lib/clipboard/paste-target.js +28 -0
- package/dist/lib/clipboard/paste-target.js.map +1 -0
- package/dist/lib/cms/published-documents.d.ts +30 -0
- package/dist/lib/cms/published-documents.js +75 -0
- package/dist/lib/cms/published-documents.js.map +1 -0
- package/dist/lib/cms-views/index.d.ts +9 -0
- package/dist/lib/cms-views/index.js +10 -0
- package/dist/lib/cms-views/index.js.map +1 -0
- package/dist/lib/cms-views/selection.d.ts +29 -0
- package/dist/lib/cms-views/selection.js +46 -0
- package/dist/lib/cms-views/selection.js.map +1 -0
- package/dist/lib/cms-views/view-model.d.ts +192 -0
- package/dist/lib/cms-views/view-model.js +353 -0
- package/dist/lib/cms-views/view-model.js.map +1 -0
- package/dist/lib/cms-views/views-store.d.ts +70 -0
- package/dist/lib/cms-views/views-store.js +129 -0
- package/dist/lib/cms-views/views-store.js.map +1 -0
- package/dist/lib/data/collection-content.d.ts +105 -0
- package/dist/lib/data/collection-content.js +196 -0
- package/dist/lib/data/collection-content.js.map +1 -0
- package/dist/lib/data/data-store.d.ts +97 -0
- package/dist/lib/data/data-store.js +205 -0
- package/dist/lib/data/data-store.js.map +1 -0
- package/dist/lib/data/index.d.ts +4 -0
- package/dist/lib/data/index.js +8 -0
- package/dist/lib/data/index.js.map +1 -0
- package/dist/lib/data/providers.d.ts +143 -0
- package/dist/lib/data/providers.js +255 -0
- package/dist/lib/data/providers.js.map +1 -0
- package/dist/lib/data/sample-capture.d.ts +30 -0
- package/dist/lib/data/sample-capture.js +70 -0
- package/dist/lib/data/sample-capture.js.map +1 -0
- package/dist/lib/data/sources-store.d.ts +42 -0
- package/dist/lib/data/sources-store.js +120 -0
- package/dist/lib/data/sources-store.js.map +1 -0
- package/dist/lib/dnd/drop-rules.d.ts +219 -0
- package/dist/lib/dnd/drop-rules.js +257 -0
- package/dist/lib/dnd/drop-rules.js.map +1 -0
- package/dist/lib/dnd/gap-drag.d.ts +66 -0
- package/dist/lib/dnd/gap-drag.js +95 -0
- package/dist/lib/dnd/gap-drag.js.map +1 -0
- package/dist/lib/locale/binding-fallback.d.ts +28 -0
- package/dist/lib/locale/binding-fallback.js +66 -0
- package/dist/lib/locale/binding-fallback.js.map +1 -0
- package/dist/lib/locale/fallback.d.ts +43 -0
- package/dist/lib/locale/fallback.js +52 -0
- package/dist/lib/locale/fallback.js.map +1 -0
- package/dist/lib/locale/index.d.ts +6 -0
- package/dist/lib/locale/index.js +7 -0
- package/dist/lib/locale/index.js.map +1 -0
- package/dist/lib/locale/locale-store.d.ts +40 -0
- package/dist/lib/locale/locale-store.js +61 -0
- package/dist/lib/locale/locale-store.js.map +1 -0
- package/dist/lib/locale/locale-switcher.d.ts +10 -0
- package/dist/lib/locale/locale-switcher.js +24 -0
- package/dist/lib/locale/locale-switcher.js.map +1 -0
- package/dist/lib/locale/route-variant.d.ts +14 -0
- package/dist/lib/locale/route-variant.js +11 -0
- package/dist/lib/locale/route-variant.js.map +1 -0
- package/dist/lib/locale/use-studio-locale.d.ts +10 -0
- package/dist/lib/locale/use-studio-locale.js +8 -0
- package/dist/lib/locale/use-studio-locale.js.map +1 -0
- package/dist/lib/operations/asset-repository.d.ts +15 -0
- package/dist/lib/operations/asset-repository.js +56 -0
- package/dist/lib/operations/asset-repository.js.map +1 -0
- package/dist/lib/operations/cms-persistence.d.ts +35 -0
- package/dist/lib/operations/cms-persistence.js +75 -0
- package/dist/lib/operations/cms-persistence.js.map +1 -0
- package/dist/lib/operations/graph-commands.d.ts +140 -0
- package/dist/lib/operations/graph-commands.js +86 -0
- package/dist/lib/operations/graph-commands.js.map +1 -0
- package/dist/lib/operations/graph-persistence.d.ts +27 -0
- package/dist/lib/operations/graph-persistence.js +35 -0
- package/dist/lib/operations/graph-persistence.js.map +1 -0
- package/dist/lib/operations/index.d.ts +13 -0
- package/dist/lib/operations/index.js +14 -0
- package/dist/lib/operations/index.js.map +1 -0
- package/dist/lib/operations/operations-package.d.ts +6 -0
- package/dist/lib/operations/operations-package.js +7 -0
- package/dist/lib/operations/operations-package.js.map +1 -0
- package/dist/lib/operations/persist-queue.d.ts +16 -0
- package/dist/lib/operations/persist-queue.js +18 -0
- package/dist/lib/operations/persist-queue.js.map +1 -0
- package/dist/lib/operations/session-hydration.d.ts +84 -0
- package/dist/lib/operations/session-hydration.js +112 -0
- package/dist/lib/operations/session-hydration.js.map +1 -0
- package/dist/lib/operations/studio-operations.d.ts +59 -0
- package/dist/lib/operations/studio-operations.js +92 -0
- package/dist/lib/operations/studio-operations.js.map +1 -0
- package/dist/lib/persistence/backend-mode.d.ts +69 -0
- package/dist/lib/persistence/backend-mode.js +120 -0
- package/dist/lib/persistence/backend-mode.js.map +1 -0
- package/dist/lib/persistence/convex-adapter.d.ts +34 -0
- package/dist/lib/persistence/convex-adapter.js +681 -0
- package/dist/lib/persistence/convex-adapter.js.map +1 -0
- package/dist/lib/persistence/convex-blob-storage.d.ts +57 -0
- package/dist/lib/persistence/convex-blob-storage.js +97 -0
- package/dist/lib/persistence/convex-blob-storage.js.map +1 -0
- package/dist/lib/persistence/convex-client.d.ts +19 -0
- package/dist/lib/persistence/convex-client.js +40 -0
- package/dist/lib/persistence/convex-client.js.map +1 -0
- package/dist/lib/persistence/index.d.ts +30 -0
- package/dist/lib/persistence/index.js +60 -0
- package/dist/lib/persistence/index.js.map +1 -0
- package/dist/lib/persona/labels.d.ts +23 -0
- package/dist/lib/persona/labels.js +122 -0
- package/dist/lib/persona/labels.js.map +1 -0
- package/dist/lib/rail.d.ts +11 -0
- package/dist/lib/rail.js +26 -0
- package/dist/lib/rail.js.map +1 -0
- package/dist/lib/references/impact.d.ts +64 -0
- package/dist/lib/references/impact.js +62 -0
- package/dist/lib/references/impact.js.map +1 -0
- package/dist/lib/references/index.d.ts +7 -0
- package/dist/lib/references/index.js +8 -0
- package/dist/lib/references/index.js.map +1 -0
- package/dist/lib/references/reference-model.d.ts +125 -0
- package/dist/lib/references/reference-model.js +242 -0
- package/dist/lib/references/reference-model.js.map +1 -0
- package/dist/lib/references/references-store.d.ts +65 -0
- package/dist/lib/references/references-store.js +221 -0
- package/dist/lib/references/references-store.js.map +1 -0
- package/dist/lib/registry/index.d.ts +65 -0
- package/dist/lib/registry/index.js +114 -0
- package/dist/lib/registry/index.js.map +1 -0
- package/dist/lib/registry/preview.d.ts +15 -0
- package/dist/lib/registry/preview.js +110 -0
- package/dist/lib/registry/preview.js.map +1 -0
- package/dist/lib/registry/project-components.d.ts +16 -0
- package/dist/lib/registry/project-components.js +152 -0
- package/dist/lib/registry/project-components.js.map +1 -0
- package/dist/lib/routing/index.d.ts +10 -0
- package/dist/lib/routing/index.js +11 -0
- package/dist/lib/routing/index.js.map +1 -0
- package/dist/lib/routing/routing-analysis.d.ts +26 -0
- package/dist/lib/routing/routing-analysis.js +37 -0
- package/dist/lib/routing/routing-analysis.js.map +1 -0
- package/dist/lib/routing/routing-store.d.ts +50 -0
- package/dist/lib/routing/routing-store.js +72 -0
- package/dist/lib/routing/routing-store.js.map +1 -0
- package/dist/lib/starters/kit-session.d.ts +5 -0
- package/dist/lib/starters/kit-session.js +17 -0
- package/dist/lib/starters/kit-session.js.map +1 -0
- package/dist/lib/theme.d.ts +21 -0
- package/dist/lib/theme.js +32 -0
- package/dist/lib/theme.js.map +1 -0
- package/dist/lib/utils.d.ts +11 -0
- package/dist/lib/utils.js +28 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/webhooks/config.d.ts +15 -0
- package/dist/lib/webhooks/config.js +64 -0
- package/dist/lib/webhooks/config.js.map +1 -0
- package/dist/lib/webhooks/dispatcher.d.ts +67 -0
- package/dist/lib/webhooks/dispatcher.js +61 -0
- package/dist/lib/webhooks/dispatcher.js.map +1 -0
- package/dist/lib/webhooks/index.d.ts +11 -0
- package/dist/lib/webhooks/index.js +10 -0
- package/dist/lib/webhooks/index.js.map +1 -0
- package/dist/lib/webhooks/signing.d.ts +15 -0
- package/dist/lib/webhooks/signing.js +24 -0
- package/dist/lib/webhooks/signing.js.map +1 -0
- package/dist/lib/webhooks/tags.d.ts +25 -0
- package/dist/lib/webhooks/tags.js +173 -0
- package/dist/lib/webhooks/tags.js.map +1 -0
- package/dist/lib/working-graph.d.ts +82 -0
- package/dist/lib/working-graph.js +113 -0
- package/dist/lib/working-graph.js.map +1 -0
- package/dist/lib/workspace/index.d.ts +109 -0
- package/dist/lib/workspace/index.js +206 -0
- package/dist/lib/workspace/index.js.map +1 -0
- package/dist/lib/workspace/switcher-source.d.ts +39 -0
- package/dist/lib/workspace/switcher-source.js +23 -0
- package/dist/lib/workspace/switcher-source.js.map +1 -0
- package/dist/lib/workspace/workspace-source.d.ts +47 -0
- package/dist/lib/workspace/workspace-source.js +67 -0
- package/dist/lib/workspace/workspace-source.js.map +1 -0
- package/dist/router/index.d.ts +32 -0
- package/dist/router/index.js +32 -0
- package/dist/router/index.js.map +1 -0
- package/dist/router/match.d.ts +75 -0
- package/dist/router/match.js +87 -0
- package/dist/router/match.js.map +1 -0
- package/dist/router/search.d.ts +22 -0
- package/dist/router/search.js +16 -0
- package/dist/router/search.js.map +1 -0
- package/dist/ui/avatar.d.ts +17 -0
- package/dist/ui/avatar.js +38 -0
- package/dist/ui/avatar.js.map +1 -0
- package/dist/ui/badge.d.ts +9 -0
- package/dist/ui/badge.js +23 -0
- package/dist/ui/badge.js.map +1 -0
- package/dist/ui/button.d.ts +11 -0
- package/dist/ui/button.js +30 -0
- package/dist/ui/button.js.map +1 -0
- package/dist/ui/card.d.ts +11 -0
- package/dist/ui/card.js +23 -0
- package/dist/ui/card.js.map +1 -0
- package/dist/ui/dialog.d.ts +12 -0
- package/dist/ui/dialog.js +27 -0
- package/dist/ui/dialog.js.map +1 -0
- package/dist/ui/dropdown-menu.d.ts +15 -0
- package/dist/ui/dropdown-menu.js +24 -0
- package/dist/ui/dropdown-menu.js.map +1 -0
- package/dist/ui/field.d.ts +15 -0
- package/dist/ui/field.js +14 -0
- package/dist/ui/field.js.map +1 -0
- package/dist/ui/index.d.ts +14 -0
- package/dist/ui/index.js +15 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/input.d.ts +3 -0
- package/dist/ui/input.js +7 -0
- package/dist/ui/input.js.map +1 -0
- package/dist/ui/inspector.d.ts +18 -0
- package/dist/ui/inspector.js +14 -0
- package/dist/ui/inspector.js.map +1 -0
- package/dist/ui/layout.d.ts +45 -0
- package/dist/ui/layout.js +48 -0
- package/dist/ui/layout.js.map +1 -0
- package/dist/ui/panel.d.ts +12 -0
- package/dist/ui/panel.js +20 -0
- package/dist/ui/panel.js.map +1 -0
- package/dist/ui/separator.d.ts +6 -0
- package/dist/ui/separator.js +7 -0
- package/dist/ui/separator.js.map +1 -0
- package/dist/ui/toolbar.d.ts +9 -0
- package/dist/ui/toolbar.js +16 -0
- package/dist/ui/toolbar.js.map +1 -0
- package/dist/ui/typography.d.ts +50 -0
- package/dist/ui/typography.js +43 -0
- package/dist/ui/typography.js.map +1 -0
- package/package.json +149 -0
- package/src/styles/studio.css +101 -0
- package/src/styles/tokens.css +63 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { CmsDocument, CollectionDef } from '@elytracms/cms-core';
|
|
3
|
+
import type { OperationResult, OperationsClient } from '../operations';
|
|
4
|
+
/**
|
|
5
|
+
* Saved-view persistence for the CMS collection table (EC-169).
|
|
6
|
+
*
|
|
7
|
+
* Views are project-scoped (shared by every editor on the project) and follow
|
|
8
|
+
* the EC-170 routing-store pattern: one system collection holds one document
|
|
9
|
+
* per saved view, and every mutation goes through the *existing*
|
|
10
|
+
* `@elytracms/operations` commands (`schema.upsertCollection`,
|
|
11
|
+
* `documents.upsert`, `documents.delete`). The settings domain was the other
|
|
12
|
+
* candidate, but `settings.update` patches the closed `projectSettingsSchema`
|
|
13
|
+
* (locales/environments/export target) — saved views don't fit it without a
|
|
14
|
+
* studio-core schema change, while the system collection needs no new
|
|
15
|
+
* operations surface at all.
|
|
16
|
+
*
|
|
17
|
+
* Deleting a saved view is exactly one `documents.delete` against THIS
|
|
18
|
+
* collection — it can never touch content documents.
|
|
19
|
+
*/
|
|
20
|
+
export declare const VIEWS_COLLECTION = "cms-saved-views";
|
|
21
|
+
/** System collection holding one document per {@link SavedViewRecord}. */
|
|
22
|
+
export declare const viewsCollectionDef: CollectionDef;
|
|
23
|
+
/** A persisted saved view: identity + the table state it restores. */
|
|
24
|
+
export declare const savedViewRecordSchema: z.ZodObject<{
|
|
25
|
+
id: z.ZodString;
|
|
26
|
+
name: z.ZodString;
|
|
27
|
+
collection: z.ZodString;
|
|
28
|
+
state: z.ZodObject<{
|
|
29
|
+
filters: z.ZodArray<z.ZodObject<{
|
|
30
|
+
field: z.ZodString;
|
|
31
|
+
op: z.ZodEnum<{
|
|
32
|
+
in: "in";
|
|
33
|
+
eq: "eq";
|
|
34
|
+
gt: "gt";
|
|
35
|
+
gte: "gte";
|
|
36
|
+
lt: "lt";
|
|
37
|
+
lte: "lte";
|
|
38
|
+
}>;
|
|
39
|
+
value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>;
|
|
40
|
+
}, z.core.$strip>>;
|
|
41
|
+
sort: z.ZodNullable<z.ZodObject<{
|
|
42
|
+
field: z.ZodString;
|
|
43
|
+
dir: z.ZodEnum<{
|
|
44
|
+
asc: "asc";
|
|
45
|
+
desc: "desc";
|
|
46
|
+
}>;
|
|
47
|
+
}, z.core.$strip>>;
|
|
48
|
+
columns: z.ZodArray<z.ZodString>;
|
|
49
|
+
hidden: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
export type SavedViewRecord = z.infer<typeof savedViewRecordSchema>;
|
|
53
|
+
export declare function viewToDocument(record: SavedViewRecord): CmsDocument;
|
|
54
|
+
export declare function documentToView(document: CmsDocument): SavedViewRecord | undefined;
|
|
55
|
+
/** Load every persisted saved view of a project (malformed records dropped). */
|
|
56
|
+
export declare function loadSavedViews(operations: OperationsClient, projectId: string): Promise<OperationResult<SavedViewRecord[]>>;
|
|
57
|
+
/** Group loaded records by their content collection (for per-collection lookup). */
|
|
58
|
+
export declare function groupSavedViews(records: readonly SavedViewRecord[]): Record<string, SavedViewRecord[]>;
|
|
59
|
+
/**
|
|
60
|
+
* Make sure the system collection exists in the project's CMS schema so
|
|
61
|
+
* `documents.upsert` accepts view documents. Idempotent. Callers that share a
|
|
62
|
+
* project with the CMS session must run the session's persisted baseline
|
|
63
|
+
* FIRST — creating this collection on a schema-less project would otherwise
|
|
64
|
+
* make the baseline think the content schema is already persisted.
|
|
65
|
+
*/
|
|
66
|
+
export declare function ensureViewsCollection(_operations: OperationsClient, _projectId: string): Promise<OperationResult<void>>;
|
|
67
|
+
/** Create or update a saved view (operations command). */
|
|
68
|
+
export declare function saveSavedView(operations: OperationsClient, projectId: string, record: SavedViewRecord): Promise<OperationResult<void>>;
|
|
69
|
+
/** Delete a saved view — a view-only operation on the system collection. */
|
|
70
|
+
export declare function deleteSavedView(operations: OperationsClient, projectId: string, viewId: string): Promise<OperationResult<void>>;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { tableViewStateSchema } from './view-model';
|
|
3
|
+
/**
|
|
4
|
+
* Saved-view persistence for the CMS collection table (EC-169).
|
|
5
|
+
*
|
|
6
|
+
* Views are project-scoped (shared by every editor on the project) and follow
|
|
7
|
+
* the EC-170 routing-store pattern: one system collection holds one document
|
|
8
|
+
* per saved view, and every mutation goes through the *existing*
|
|
9
|
+
* `@elytracms/operations` commands (`schema.upsertCollection`,
|
|
10
|
+
* `documents.upsert`, `documents.delete`). The settings domain was the other
|
|
11
|
+
* candidate, but `settings.update` patches the closed `projectSettingsSchema`
|
|
12
|
+
* (locales/environments/export target) — saved views don't fit it without a
|
|
13
|
+
* studio-core schema change, while the system collection needs no new
|
|
14
|
+
* operations surface at all.
|
|
15
|
+
*
|
|
16
|
+
* Deleting a saved view is exactly one `documents.delete` against THIS
|
|
17
|
+
* collection — it can never touch content documents.
|
|
18
|
+
*/
|
|
19
|
+
export const VIEWS_COLLECTION = 'cms-saved-views';
|
|
20
|
+
/** System collection holding one document per {@link SavedViewRecord}. */
|
|
21
|
+
export const viewsCollectionDef = {
|
|
22
|
+
id: VIEWS_COLLECTION,
|
|
23
|
+
kind: 'document',
|
|
24
|
+
titleField: 'name',
|
|
25
|
+
form: {
|
|
26
|
+
label: 'Saved views',
|
|
27
|
+
labelSingular: 'Saved view',
|
|
28
|
+
description: 'System collection managed by the CMS collection table.',
|
|
29
|
+
},
|
|
30
|
+
fields: [
|
|
31
|
+
{ name: 'name', type: 'text', validation: { required: true } },
|
|
32
|
+
{ name: 'collection', type: 'text', validation: { required: true } },
|
|
33
|
+
/** The view's filter/sort/column state, JSON-serialized (validated by Zod on read). */
|
|
34
|
+
{ name: 'config', type: 'text', validation: { required: true } },
|
|
35
|
+
],
|
|
36
|
+
};
|
|
37
|
+
/** A persisted saved view: identity + the table state it restores. */
|
|
38
|
+
export const savedViewRecordSchema = z.object({
|
|
39
|
+
id: z.string().min(1),
|
|
40
|
+
name: z.string().min(1),
|
|
41
|
+
/** The content collection the view belongs to. */
|
|
42
|
+
collection: z.string().min(1),
|
|
43
|
+
state: tableViewStateSchema,
|
|
44
|
+
});
|
|
45
|
+
// ---- Record ⇄ document mapping ----
|
|
46
|
+
export function viewToDocument(record) {
|
|
47
|
+
const parsed = savedViewRecordSchema.parse(record);
|
|
48
|
+
return {
|
|
49
|
+
collection: VIEWS_COLLECTION,
|
|
50
|
+
id: parsed.id,
|
|
51
|
+
values: {
|
|
52
|
+
name: parsed.name,
|
|
53
|
+
collection: parsed.collection,
|
|
54
|
+
config: JSON.stringify(parsed.state),
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export function documentToView(document) {
|
|
59
|
+
const values = document.values;
|
|
60
|
+
let state;
|
|
61
|
+
try {
|
|
62
|
+
state = typeof values.config === 'string' ? JSON.parse(values.config) : undefined;
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
const parsed = savedViewRecordSchema.safeParse({
|
|
68
|
+
id: document.id,
|
|
69
|
+
name: values.name,
|
|
70
|
+
collection: values.collection,
|
|
71
|
+
state,
|
|
72
|
+
});
|
|
73
|
+
return parsed.success ? parsed.data : undefined;
|
|
74
|
+
}
|
|
75
|
+
// ---- Reads & writes through @elytracms/operations ----
|
|
76
|
+
/** Load every persisted saved view of a project (malformed records dropped). */
|
|
77
|
+
export async function loadSavedViews(operations, projectId) {
|
|
78
|
+
const result = await operations.documents.list({ projectId, collection: VIEWS_COLLECTION });
|
|
79
|
+
if (!result.ok)
|
|
80
|
+
return result;
|
|
81
|
+
return {
|
|
82
|
+
ok: true,
|
|
83
|
+
value: result.value
|
|
84
|
+
.map((record) => documentToView(record.document))
|
|
85
|
+
.filter((view) => view !== undefined),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/** Group loaded records by their content collection (for per-collection lookup). */
|
|
89
|
+
export function groupSavedViews(records) {
|
|
90
|
+
const grouped = {};
|
|
91
|
+
for (const record of records) {
|
|
92
|
+
;
|
|
93
|
+
(grouped[record.collection] ??= []).push(record);
|
|
94
|
+
}
|
|
95
|
+
return grouped;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Make sure the system collection exists in the project's CMS schema so
|
|
99
|
+
* `documents.upsert` accepts view documents. Idempotent. Callers that share a
|
|
100
|
+
* project with the CMS session must run the session's persisted baseline
|
|
101
|
+
* FIRST — creating this collection on a schema-less project would otherwise
|
|
102
|
+
* make the baseline think the content schema is already persisted.
|
|
103
|
+
*/
|
|
104
|
+
export async function ensureViewsCollection(_operations, _projectId) {
|
|
105
|
+
// No-op (EC-183, AD-11): the saved-views system collection is config-owned and
|
|
106
|
+
// the backend stores documents without a schema-membership check — nothing to
|
|
107
|
+
// register. `viewsCollectionDef` remains the canonical document shape.
|
|
108
|
+
return { ok: true, value: undefined };
|
|
109
|
+
}
|
|
110
|
+
/** Create or update a saved view (operations command). */
|
|
111
|
+
export async function saveSavedView(operations, projectId, record) {
|
|
112
|
+
const ensured = await ensureViewsCollection(operations, projectId);
|
|
113
|
+
if (!ensured.ok)
|
|
114
|
+
return ensured;
|
|
115
|
+
const result = await operations.documents.upsert({
|
|
116
|
+
projectId,
|
|
117
|
+
document: viewToDocument(record),
|
|
118
|
+
});
|
|
119
|
+
return result.ok ? { ok: true, value: undefined } : result;
|
|
120
|
+
}
|
|
121
|
+
/** Delete a saved view — a view-only operation on the system collection. */
|
|
122
|
+
export async function deleteSavedView(operations, projectId, viewId) {
|
|
123
|
+
const result = await operations.documents.delete({
|
|
124
|
+
projectId,
|
|
125
|
+
ref: { collection: VIEWS_COLLECTION, id: viewId },
|
|
126
|
+
});
|
|
127
|
+
return result.ok ? { ok: true, value: undefined } : result;
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=views-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"views-store.js","sourceRoot":"","sources":["../../../src/lib/cms-views/views-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAEnD;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,iBAAiB,CAAA;AAEjD,0EAA0E;AAC1E,MAAM,CAAC,MAAM,kBAAkB,GAAkB;IAC/C,EAAE,EAAE,gBAAgB;IACpB,IAAI,EAAE,UAAU;IAChB,UAAU,EAAE,MAAM;IAClB,IAAI,EAAE;QACJ,KAAK,EAAE,aAAa;QACpB,aAAa,EAAE,YAAY;QAC3B,WAAW,EAAE,wDAAwD;KACtE;IACD,MAAM,EAAE;QACN,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;QAC9D,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,UA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6B,EAC7B,UAAkB;IAElB,+EAA+E;IAC/E,8EAA8E;IAC9E,uEAAuE;IACvE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA;AACvC,CAAC;AAED,0DAA0D;AAC1D,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,UAA4B,EAC5B,SAAiB,EACjB,MAAuB;IAEvB,MAAM,OAAO,GAAG,MAAM,qBAAqB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAA;IAClE,IAAI,CAAC,OAAO,CAAC,EAAE;QAAE,OAAO,OAAO,CAAA;IAC/B,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC;QAC/C,SAAS;QACT,QAAQ,EAAE,cAAc,CAAC,MAAM,CAAC;KACjC,CAAC,CAAA;IACF,OAAO,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,MAAM,CAAA;AAC5D,CAAC;AAED,4EAA4E;AAC5E,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,UAA4B,EAC5B,SAAiB,EACjB,MAAc;IAEd,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC;QAC/C,SAAS;QACT,GAAG,EAAE,EAAE,UAAU,EAAE,gBAAgB,EAAE,EAAE,EAAE,MAAM,EAAE;KAClD,CAAC,CAAA;IACF,OAAO,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,MAAM,CAAA;AAC5D,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { GetDocumentResult, ListDocumentsQuery, ListDocumentsResult, ResolvedDocument } from '@elytracms/content';
|
|
2
|
+
import type { CmsDocument, CollectionDef, DocumentRef, Locale, LocaleConfig } from '@elytracms/cms-core';
|
|
3
|
+
import type { AssetRecord } from '@elytracms/persistence';
|
|
4
|
+
import type { ListingQuery } from '@elytracms/runtime-renderer';
|
|
5
|
+
/**
|
|
6
|
+
* The studio's content delivery engine for canvas previews (EC-166).
|
|
7
|
+
*
|
|
8
|
+
* Repeating sections and template pages preview *delivery-shaped* documents —
|
|
9
|
+
* the exact shape `@elytracms/content` serves in production — so the canvas
|
|
10
|
+
* shows what publishing will show. This module wires the canonical content
|
|
11
|
+
* client (closed AD-3 query vocabulary, published perspective, EC-018 locale
|
|
12
|
+
* fallback, depth-1 population, resolved assets) over a **content session**:
|
|
13
|
+
*
|
|
14
|
+
* - Playground mode (and tests): the deterministic EC-145 sample fixtures —
|
|
15
|
+
* byte-identical to the pre-hydration behavior, no backend.
|
|
16
|
+
* - Convex mode: the project-session gate (`components/studio/project-session`)
|
|
17
|
+
* configures the session with the project's HYDRATED schema + documents, so
|
|
18
|
+
* "Preview with" lists and section previews show the live content — never
|
|
19
|
+
* fixture titles (EC-177 gap 1).
|
|
20
|
+
*
|
|
21
|
+
* Nothing here invents query semantics; both shapes go through the same
|
|
22
|
+
* canonical client.
|
|
23
|
+
*/
|
|
24
|
+
/** The schema + documents the preview engine serves (one project session). */
|
|
25
|
+
export interface ContentSessionState {
|
|
26
|
+
collections: readonly CollectionDef[];
|
|
27
|
+
documents: readonly CmsDocument[];
|
|
28
|
+
/**
|
|
29
|
+
* Published document keys via the version POINTER (EC-224). When present, the
|
|
30
|
+
* preview's published perspective resolves by the pin — never the flat
|
|
31
|
+
* `state` enum — so it matches what delivery serves. Absent (playground
|
|
32
|
+
* fixtures / tests) → the rows' own `state` gates the perspective, unchanged.
|
|
33
|
+
*/
|
|
34
|
+
publishedKeys?: readonly string[];
|
|
35
|
+
/** Locale config of the session content; defaults to the sample config. */
|
|
36
|
+
localeConfig?: LocaleConfig;
|
|
37
|
+
/**
|
|
38
|
+
* The project's asset records (assets table). Wired into the lookup so the
|
|
39
|
+
* content client resolves `asset`-typed FIELDS on listing/relation results
|
|
40
|
+
* (e.g. a ProductGrid product's `gallery`) to delivery shape — the same assets
|
|
41
|
+
* the renderer's `resolveAsset` reads for static props (EC-262). Absent
|
|
42
|
+
* (playground/tests) → assets come only from `asset`-collection fixture docs.
|
|
43
|
+
*/
|
|
44
|
+
assets?: readonly AssetRecord[];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Default (no-session) collection schema: EMPTY. The studio ships no demo content
|
|
48
|
+
* (Oli, 2026-06-19) — with no backend/content session configured, there is nothing
|
|
49
|
+
* to preview, and the studio says so rather than serving fixtures. A real project's
|
|
50
|
+
* collections + documents arrive via {@link configureContentSession} (Convex mode).
|
|
51
|
+
*/
|
|
52
|
+
export declare const playgroundCollections: readonly CollectionDef[];
|
|
53
|
+
/**
|
|
54
|
+
* Point the preview engine at a project's hydrated content (Convex mode), or
|
|
55
|
+
* back at the deterministic playground fixtures (`null` — the default, and
|
|
56
|
+
* the only state playground mode ever sees).
|
|
57
|
+
*/
|
|
58
|
+
export declare function configureContentSession(next: ContentSessionState | null): void;
|
|
59
|
+
/** Whether a hydrated content session is configured (Convex mode). */
|
|
60
|
+
export declare function hasContentSession(): boolean;
|
|
61
|
+
/** Resolve a collection in the active content session (fixtures in playground). */
|
|
62
|
+
export declare function playgroundCollection(id: string): CollectionDef | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Overlay the active session's canonical `filterable` declarations onto a
|
|
65
|
+
* schema that doesn't carry any of its own. The inspector hands the Content
|
|
66
|
+
* tab fixture collection defs; the filter/sort pickers must offer exactly the
|
|
67
|
+
* EC-143 declaration set the delivery engine enforces, so both ends agree. A
|
|
68
|
+
* collection that declares its own filterable fields is left untouched.
|
|
69
|
+
*/
|
|
70
|
+
export declare function withPlaygroundFilterable(collections: readonly CollectionDef[]): readonly CollectionDef[];
|
|
71
|
+
/**
|
|
72
|
+
* Run a closed-vocabulary list query (AD-3: eq/in/lt/lte/gt/gte, AND-only,
|
|
73
|
+
* filterable fields only) and return the delivery-shaped result. Invalid
|
|
74
|
+
* queries come back as structured errors — never thrown, never silently
|
|
75
|
+
* widened. Resolves in the studio's active locale unless one is passed.
|
|
76
|
+
*/
|
|
77
|
+
export declare function runCollectionListQuery(collectionId: string, query?: ListDocumentsQuery, locale?: Locale): ListDocumentsResult;
|
|
78
|
+
/** Resolve one document (by id or slug) into delivery shape. */
|
|
79
|
+
export declare function getCollectionDocument(collectionId: string, idOrSlug: string, locale?: Locale): GetDocumentResult;
|
|
80
|
+
/**
|
|
81
|
+
* Populate a composition-node `relation` prop to delivery shape for the canvas
|
|
82
|
+
* (EC-254) — the studio analog of the host's baked relations map. Resolves the
|
|
83
|
+
* ref through the active session's client (published perspective, active locale),
|
|
84
|
+
* so the canvas previews a block's picked documents (a ProductGrid's products, a
|
|
85
|
+
* Reusable's element) exactly as delivery renders them. `null` when the target is
|
|
86
|
+
* missing or not visible → the block degrades to its own empty state.
|
|
87
|
+
*/
|
|
88
|
+
export declare function resolveCanvasRelation(ref: DocumentRef, locale?: Locale): ResolvedDocument | null;
|
|
89
|
+
/**
|
|
90
|
+
* Resolve a listing block's query to its documents for the canvas (EC-255) — the
|
|
91
|
+
* studio analog of the host's baked listings map. Runs the query (collection +
|
|
92
|
+
* AND-only filter, optional sort/limit) through the active session's client
|
|
93
|
+
* (published perspective, active locale), so the canvas previews a dynamic grid (a
|
|
94
|
+
* ProductGrid keyed to a category) exactly as delivery renders it. An invalid query
|
|
95
|
+
* (structured, never thrown) or a non-list lookup yields `[]` → the block's empty
|
|
96
|
+
* state. Reuses the same `listDocuments` path as `runCollectionListQuery`.
|
|
97
|
+
*/
|
|
98
|
+
export declare function resolveCanvasListing(query: ListingQuery, locale?: Locale): ResolvedDocument[];
|
|
99
|
+
/** A pickable entry of a collection (the template-page preview switcher). */
|
|
100
|
+
export interface CollectionEntrySummary {
|
|
101
|
+
id: string;
|
|
102
|
+
label: string;
|
|
103
|
+
}
|
|
104
|
+
/** Published entries of a collection, labeled by the schema's title field. */
|
|
105
|
+
export declare function listCollectionEntries(collectionId: string): CollectionEntrySummary[];
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { createContentClient, createContentContext, } from '@elytracms/content';
|
|
2
|
+
import { documentKey, sampleLocaleConfig } from '@elytracms/cms-core';
|
|
3
|
+
import { getStudioLocale } from '../locale/locale-store';
|
|
4
|
+
/**
|
|
5
|
+
* Default (no-session) collection schema: EMPTY. The studio ships no demo content
|
|
6
|
+
* (Oli, 2026-06-19) — with no backend/content session configured, there is nothing
|
|
7
|
+
* to preview, and the studio says so rather than serving fixtures. A real project's
|
|
8
|
+
* collections + documents arrive via {@link configureContentSession} (Convex mode).
|
|
9
|
+
*/
|
|
10
|
+
export const playgroundCollections = [];
|
|
11
|
+
let contentSession = null;
|
|
12
|
+
let lookup = createLookup(playgroundCollections, [], []);
|
|
13
|
+
const clients = new Map();
|
|
14
|
+
/**
|
|
15
|
+
* Point the preview engine at a project's hydrated content (Convex mode), or
|
|
16
|
+
* back at the deterministic playground fixtures (`null` — the default, and
|
|
17
|
+
* the only state playground mode ever sees).
|
|
18
|
+
*/
|
|
19
|
+
export function configureContentSession(next) {
|
|
20
|
+
contentSession = next;
|
|
21
|
+
lookup = next
|
|
22
|
+
? createLookup(next.collections, next.documents, next.publishedKeys, next.assets)
|
|
23
|
+
: createLookup(playgroundCollections, [], []);
|
|
24
|
+
clients.clear();
|
|
25
|
+
}
|
|
26
|
+
/** Whether a hydrated content session is configured (Convex mode). */
|
|
27
|
+
export function hasContentSession() {
|
|
28
|
+
return contentSession !== null;
|
|
29
|
+
}
|
|
30
|
+
/** The collections the preview engine currently serves (session or fixtures). */
|
|
31
|
+
function activeCollections() {
|
|
32
|
+
return contentSession?.collections ?? playgroundCollections;
|
|
33
|
+
}
|
|
34
|
+
function activeLocaleConfig() {
|
|
35
|
+
return contentSession?.localeConfig ?? sampleLocaleConfig;
|
|
36
|
+
}
|
|
37
|
+
/** Resolve a collection in the active content session (fixtures in playground). */
|
|
38
|
+
export function playgroundCollection(id) {
|
|
39
|
+
return activeCollections().find((collection) => collection.id === id);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Overlay the active session's canonical `filterable` declarations onto a
|
|
43
|
+
* schema that doesn't carry any of its own. The inspector hands the Content
|
|
44
|
+
* tab fixture collection defs; the filter/sort pickers must offer exactly the
|
|
45
|
+
* EC-143 declaration set the delivery engine enforces, so both ends agree. A
|
|
46
|
+
* collection that declares its own filterable fields is left untouched.
|
|
47
|
+
*/
|
|
48
|
+
export function withPlaygroundFilterable(collections) {
|
|
49
|
+
return collections.map((collection) => {
|
|
50
|
+
if (collection.fields.some((field) => field.filterable === true))
|
|
51
|
+
return collection;
|
|
52
|
+
const counterpart = playgroundCollection(collection.id);
|
|
53
|
+
if (counterpart === undefined)
|
|
54
|
+
return collection;
|
|
55
|
+
const flagged = new Set(counterpart.fields.filter((field) => field.filterable === true).map((field) => field.name));
|
|
56
|
+
if (flagged.size === 0)
|
|
57
|
+
return collection;
|
|
58
|
+
return {
|
|
59
|
+
...collection,
|
|
60
|
+
fields: collection.fields.map((field) => flagged.has(field.name) ? { ...field, filterable: true } : field),
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/** Synthesize the persistence-shaped asset record the asset resolver reads. */
|
|
65
|
+
function assetRecordOf(doc) {
|
|
66
|
+
const values = doc.values;
|
|
67
|
+
const alt = doc.localized?.en?.alt;
|
|
68
|
+
return {
|
|
69
|
+
id: doc.id,
|
|
70
|
+
projectId: 'playground',
|
|
71
|
+
filename: typeof values.filename === 'string' ? values.filename : doc.id,
|
|
72
|
+
contentType: 'image/png',
|
|
73
|
+
byteSize: 0,
|
|
74
|
+
alt: typeof alt === 'string' ? alt : undefined,
|
|
75
|
+
storageKey: typeof values.url === 'string' ? values.url : doc.id,
|
|
76
|
+
createdAt: '2026-01-01T00:00:00.000Z',
|
|
77
|
+
updatedAt: '2026-01-01T00:00:00.000Z',
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function createLookup(collectionDefs, documents, publishedKeys, assetRecords) {
|
|
81
|
+
const collections = new Map(collectionDefs.map((c) => [c.id, c]));
|
|
82
|
+
// EC-224: published-ness is the version POINTER, not the flat `state` enum.
|
|
83
|
+
// A hydrated session hands `publishedKeys` (the pinned set) → wrap each row as
|
|
84
|
+
// a `DocumentHistory` so the published perspective resolves by the pin (the
|
|
85
|
+
// live row is always a draft now) with ZERO dependence on `state`. Without a
|
|
86
|
+
// pointer set (playground fixtures / tests) we keep bare rows, whose own
|
|
87
|
+
// `state` gates the published perspective — byte-identical to before.
|
|
88
|
+
const published = publishedKeys ? new Set(publishedKeys) : null;
|
|
89
|
+
const toSource = (doc) => {
|
|
90
|
+
if (!published)
|
|
91
|
+
return doc;
|
|
92
|
+
return published.has(documentKey({ collection: doc.collection, id: doc.id }))
|
|
93
|
+
? { draft: doc, published: doc, versions: [] }
|
|
94
|
+
: { draft: doc, published: undefined, versions: [] };
|
|
95
|
+
};
|
|
96
|
+
const byKey = new Map(documents.map((doc) => [`${doc.collection}:${doc.id}`, toSource(doc)]));
|
|
97
|
+
// Asset resolution source for `asset`-typed FIELDS on resolved documents
|
|
98
|
+
// (listing/relation results, e.g. a product's `gallery`). Two sources, real
|
|
99
|
+
// records last so they win: (1) `asset`-collection fixture documents — how
|
|
100
|
+
// playground/tests model assets; (2) the project's real asset-table records
|
|
101
|
+
// (EC-262) — a Convex session has its assets here, NOT as `asset` documents,
|
|
102
|
+
// so without these the content client resolves no nested image.
|
|
103
|
+
const assets = new Map();
|
|
104
|
+
for (const doc of documents) {
|
|
105
|
+
if (doc.collection === 'asset')
|
|
106
|
+
assets.set(doc.id, assetRecordOf(doc));
|
|
107
|
+
}
|
|
108
|
+
for (const record of assetRecords ?? [])
|
|
109
|
+
assets.set(record.id, record);
|
|
110
|
+
return {
|
|
111
|
+
collection: (id) => collections.get(id),
|
|
112
|
+
document: (ref) => byKey.get(`${ref.collection}:${ref.id}`),
|
|
113
|
+
documents: (collectionId) => documents.filter((doc) => doc.collection === collectionId).map(toSource),
|
|
114
|
+
asset: (id) => assets.get(id),
|
|
115
|
+
// Prefer the record's resolved servable `url` — the one the renderer's
|
|
116
|
+
// resolveAsset reads (EC-262). Real asset-table records carry a Convex blob
|
|
117
|
+
// locator in `storageKey` and the servable URL in `url`; fixture/`asset`-document
|
|
118
|
+
// records (assetRecordOf) leave `url` unset and store the servable url in
|
|
119
|
+
// `storageKey`. Falling back keeps both correct.
|
|
120
|
+
assetUrl: (asset) => asset.url ?? asset.storageKey,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* One deterministic client per locale: published perspective, EC-018 locale
|
|
125
|
+
* fallback. The studio's ambient active locale (EC-176, `lib/locale`) picks
|
|
126
|
+
* the client at query time, so the canvas previews follow the locale switcher
|
|
127
|
+
* exactly like delivery would. The cache resets whenever the content session changes.
|
|
128
|
+
*/
|
|
129
|
+
function clientFor(locale) {
|
|
130
|
+
const existing = clients.get(locale);
|
|
131
|
+
if (existing)
|
|
132
|
+
return existing;
|
|
133
|
+
const client = createContentClient({
|
|
134
|
+
lookup,
|
|
135
|
+
context: createContentContext({
|
|
136
|
+
locale,
|
|
137
|
+
perspective: 'published',
|
|
138
|
+
locales: activeLocaleConfig(),
|
|
139
|
+
}),
|
|
140
|
+
});
|
|
141
|
+
clients.set(locale, client);
|
|
142
|
+
return client;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Run a closed-vocabulary list query (AD-3: eq/in/lt/lte/gt/gte, AND-only,
|
|
146
|
+
* filterable fields only) and return the delivery-shaped result. Invalid
|
|
147
|
+
* queries come back as structured errors — never thrown, never silently
|
|
148
|
+
* widened. Resolves in the studio's active locale unless one is passed.
|
|
149
|
+
*/
|
|
150
|
+
export function runCollectionListQuery(collectionId, query = {}, locale = getStudioLocale()) {
|
|
151
|
+
return clientFor(locale).listDocuments(collectionId, query);
|
|
152
|
+
}
|
|
153
|
+
/** Resolve one document (by id or slug) into delivery shape. */
|
|
154
|
+
export function getCollectionDocument(collectionId, idOrSlug, locale = getStudioLocale()) {
|
|
155
|
+
return clientFor(locale).getDocument(collectionId, idOrSlug);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Populate a composition-node `relation` prop to delivery shape for the canvas
|
|
159
|
+
* (EC-254) — the studio analog of the host's baked relations map. Resolves the
|
|
160
|
+
* ref through the active session's client (published perspective, active locale),
|
|
161
|
+
* so the canvas previews a block's picked documents (a ProductGrid's products, a
|
|
162
|
+
* Reusable's element) exactly as delivery renders them. `null` when the target is
|
|
163
|
+
* missing or not visible → the block degrades to its own empty state.
|
|
164
|
+
*/
|
|
165
|
+
export function resolveCanvasRelation(ref, locale = getStudioLocale()) {
|
|
166
|
+
return clientFor(locale).resolveRelation(ref);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Resolve a listing block's query to its documents for the canvas (EC-255) — the
|
|
170
|
+
* studio analog of the host's baked listings map. Runs the query (collection +
|
|
171
|
+
* AND-only filter, optional sort/limit) through the active session's client
|
|
172
|
+
* (published perspective, active locale), so the canvas previews a dynamic grid (a
|
|
173
|
+
* ProductGrid keyed to a category) exactly as delivery renders it. An invalid query
|
|
174
|
+
* (structured, never thrown) or a non-list lookup yields `[]` → the block's empty
|
|
175
|
+
* state. Reuses the same `listDocuments` path as `runCollectionListQuery`.
|
|
176
|
+
*/
|
|
177
|
+
export function resolveCanvasListing(query, locale = getStudioLocale()) {
|
|
178
|
+
const result = clientFor(locale).listDocuments(query.collection, {
|
|
179
|
+
where: query.where,
|
|
180
|
+
...(query.sort ? { sort: query.sort } : {}),
|
|
181
|
+
...(query.limit !== undefined ? { limit: query.limit } : {}),
|
|
182
|
+
});
|
|
183
|
+
return result.ok ? result.documents : [];
|
|
184
|
+
}
|
|
185
|
+
/** Published entries of a collection, labeled by the schema's title field. */
|
|
186
|
+
export function listCollectionEntries(collectionId) {
|
|
187
|
+
const collection = playgroundCollection(collectionId);
|
|
188
|
+
const result = runCollectionListQuery(collectionId);
|
|
189
|
+
if (!result.ok)
|
|
190
|
+
return [];
|
|
191
|
+
return result.documents.map((doc) => {
|
|
192
|
+
const title = collection?.titleField ? doc[collection.titleField] : undefined;
|
|
193
|
+
return { id: doc.id, label: typeof title === 'string' && title.length > 0 ? title : doc.id };
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=collection-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection-content.js","sourceRoot":"","sources":["../../../src/lib/data/collection-content.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,oBAAoB,CAAA;AAU3B,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAUrE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AA6CxD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA6B,EAAE,CAAA;AAEjE,IAAI,cAAc,GAA+B,IAAI,CAAA;AACrD,IAAI,MAAM,GAAkB,YAAY,CAAC,qBAAqB,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;AACvE,MAAM,OAAO,GAAG,IAAI,GAAG,EAAyB,CAAA;AAEhD;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAAgC;IACtE,cAAc,GAAG,IAAI,CAAA;IACrB,MAAM,GAAG,IAAI;QACX,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC;QACjF,CAAC,CAAC,YAAY,CAAC,qBAAqB,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;IAC/C,OAAO,CAAC,KAAK,EAAE,CAAA;AACjB,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,iBAAiB;IAC/B,OAAO,cAAc,KAAK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AAG,CAAC,CAAC,GAAG,EAAE,EAAE;QAClC,MAAM,KAAK,GAAG,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;QAC7E,OAAO,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAA;IAC9F,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { SourceRegistry } from '@elytracms/data-binding';
|
|
3
|
+
import type { BindingResolution, ConditionResolution, DataSource, InferredSchema, PayloadStore, RepeaterItemContext } from '@elytracms/data-binding';
|
|
4
|
+
import type { BindingReference, Condition, JsonValue } from '@elytracms/project-graph';
|
|
5
|
+
/**
|
|
6
|
+
* The project's live data layer (brief §4.6, §7.5, EC-167). Holds the source
|
|
7
|
+
* registry the Builder's Content tab binds through, plus the captured payloads
|
|
8
|
+
* that drive binding resolution. One uniform model across CMS queries, data
|
|
9
|
+
* providers, and the built-in REST/Convex kinds — resolution, sampling,
|
|
10
|
+
* inference and tokenization treat them all identically.
|
|
11
|
+
*
|
|
12
|
+
* There is no source-authoring UI (EC-167): sources exist because code declared
|
|
13
|
+
* them (registered data providers), the schema implied them (per-collection CMS
|
|
14
|
+
* queries), or an editor flow provisioned them (repeating sections, template
|
|
15
|
+
* pages).
|
|
16
|
+
*
|
|
17
|
+
* Persistence: when mounted with a `projectId`, the store hydrates the
|
|
18
|
+
* project's persisted source records (the `cms-data-sources` system collection,
|
|
19
|
+
* see `sources-store.ts`) over the deterministic playground seeds — persisted
|
|
20
|
+
* wins by id, but never over a source provisioned/removed in THIS session —
|
|
21
|
+
* and every provision/remove writes through `@elytracms/operations`. Without a
|
|
22
|
+
* `projectId` (tests, fixtures) the store is pure session state, exactly as
|
|
23
|
+
* before.
|
|
24
|
+
*/
|
|
25
|
+
export interface DataStore {
|
|
26
|
+
sources: DataSource[];
|
|
27
|
+
registry: SourceRegistry;
|
|
28
|
+
payloads: PayloadStore;
|
|
29
|
+
knownSourceIds: ReadonlySet<string>;
|
|
30
|
+
getSource: (id: string) => DataSource | undefined;
|
|
31
|
+
removeSource: (id: string) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Create or replace a source with a known id + config and capture its sample
|
|
34
|
+
* immediately (EC-166/EC-167): repeating sections and template pages
|
|
35
|
+
* provision their per-scope CMS query / provider sources through this.
|
|
36
|
+
*/
|
|
37
|
+
provisionSource: (source: DataSource) => void;
|
|
38
|
+
/**
|
|
39
|
+
* The latest persistence failure in plain language, or `null`. Persistence
|
|
40
|
+
* is best-effort on top of the live session (the canvas keeps working on
|
|
41
|
+
* session state), but a failure is recorded here — visible, never silent.
|
|
42
|
+
*/
|
|
43
|
+
persistError: string | null;
|
|
44
|
+
/** The stable path tokens a source exposes from its inferred schema (EC-085). */
|
|
45
|
+
tokensOf: (id: string) => string[];
|
|
46
|
+
schemaOf: (id: string) => InferredSchema | undefined;
|
|
47
|
+
sampleOf: (id: string) => JsonValue | undefined;
|
|
48
|
+
/** Resolve a binding to a renderer-ready resolution (value/props/condition/issue). */
|
|
49
|
+
resolve: (ref: BindingReference, item?: RepeaterItemContext) => BindingResolution;
|
|
50
|
+
/** Resolve a binding to the concrete value the renderer injects (EC-086–089). */
|
|
51
|
+
resolveValue: (ref: BindingReference, item?: RepeaterItemContext) => JsonValue | undefined;
|
|
52
|
+
/** Evaluate a condition against the captured payloads (EC-088). */
|
|
53
|
+
resolveCondition: (condition: Condition, item?: RepeaterItemContext) => ConditionResolution;
|
|
54
|
+
}
|
|
55
|
+
export interface DataState {
|
|
56
|
+
sources: DataSource[];
|
|
57
|
+
/**
|
|
58
|
+
* Ids provisioned or removed in THIS session. Hydration (which resolves
|
|
59
|
+
* asynchronously) never overrides them — the editor's latest action wins
|
|
60
|
+
* over whatever was persisted before it.
|
|
61
|
+
*/
|
|
62
|
+
sessionIds: ReadonlySet<string>;
|
|
63
|
+
}
|
|
64
|
+
export type DataAction = {
|
|
65
|
+
type: 'remove';
|
|
66
|
+
id: string;
|
|
67
|
+
} | {
|
|
68
|
+
type: 'provision';
|
|
69
|
+
source: DataSource;
|
|
70
|
+
}
|
|
71
|
+
/** Merge the project's persisted source records in (persisted wins over seeds). */
|
|
72
|
+
| {
|
|
73
|
+
type: 'hydrate';
|
|
74
|
+
sources: DataSource[];
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* The store's reducer, exported because hydration/session-precedence semantics
|
|
78
|
+
* live here and the app's test harness has no DOM to drive effects through.
|
|
79
|
+
*/
|
|
80
|
+
export declare function dataStateReducer(state: DataState, action: DataAction): DataState;
|
|
81
|
+
/**
|
|
82
|
+
* The session's starting state: EMPTY. The studio seeds no sample sources (Oli,
|
|
83
|
+
* 2026-06-19) — real sources arrive from the project's config collections (the
|
|
84
|
+
* hydrate effect, Convex mode) or are added by the author. Nothing is faked.
|
|
85
|
+
*/
|
|
86
|
+
export declare function initialDataState(): DataState;
|
|
87
|
+
export interface DataProviderProps {
|
|
88
|
+
children: ReactNode;
|
|
89
|
+
/**
|
|
90
|
+
* When set, the store hydrates from and persists to this project's
|
|
91
|
+
* `cms-data-sources` system collection (through `@elytracms/operations`).
|
|
92
|
+
* Without it the store is pure session state (tests, fixtures).
|
|
93
|
+
*/
|
|
94
|
+
projectId?: string;
|
|
95
|
+
}
|
|
96
|
+
export declare function DataProvider({ children, projectId }: DataProviderProps): import("react").JSX.Element;
|
|
97
|
+
export declare function useData(): DataStore;
|