@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 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/locale/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Locale, LocaleConfig } from '@elytracms/cms-core';
|
|
2
|
+
/**
|
|
3
|
+
* The studio's ambient locale (EC-176) — framework-free core.
|
|
4
|
+
*
|
|
5
|
+
* One studio-level active locale, set once via the locale switcher, that the
|
|
6
|
+
* builder canvas preview, the CMS table, and the detail editor all follow.
|
|
7
|
+
* Module-level (not React context) on purpose: the playground's content
|
|
8
|
+
* client (`lib/data/collection-content`) reads it at query time without any
|
|
9
|
+
* provider plumbing, and React surfaces subscribe through
|
|
10
|
+
* `useStudioLocale` (`useSyncExternalStore`).
|
|
11
|
+
*
|
|
12
|
+
* Deliberately NOT part of `lib/data/data-store` — the locale is studio
|
|
13
|
+
* state, not a data source.
|
|
14
|
+
*/
|
|
15
|
+
interface StudioLocaleState {
|
|
16
|
+
readonly config: LocaleConfig;
|
|
17
|
+
readonly active: Locale;
|
|
18
|
+
}
|
|
19
|
+
/** Snapshot of `{ config, active }` — stable identity until the next change. */
|
|
20
|
+
export declare function getStudioLocaleState(): StudioLocaleState;
|
|
21
|
+
/** The active studio locale every surface renders in. */
|
|
22
|
+
export declare function getStudioLocale(): Locale;
|
|
23
|
+
/** The project locale config driving the switcher options. */
|
|
24
|
+
export declare function getStudioLocaleConfig(): LocaleConfig;
|
|
25
|
+
/**
|
|
26
|
+
* Switch the ambient locale. Unknown locales are ignored (the switcher only
|
|
27
|
+
* offers configured ones; programmatic callers get a no-op, never a crash).
|
|
28
|
+
*/
|
|
29
|
+
export declare function setStudioLocale(locale: Locale): void;
|
|
30
|
+
/**
|
|
31
|
+
* Install the project's locale config (e.g. when a CMS session or builder
|
|
32
|
+
* shell mounts with a starter kit's locales). The active locale is kept when
|
|
33
|
+
* it is still configured, otherwise it snaps back to the new default.
|
|
34
|
+
*/
|
|
35
|
+
export declare function configureStudioLocales(config: LocaleConfig): void;
|
|
36
|
+
/** Subscribe to locale/config changes. Returns the unsubscribe function. */
|
|
37
|
+
export declare function subscribeStudioLocale(listener: () => void): () => void;
|
|
38
|
+
/** Reset to the sample defaults (tests only — module state is shared). */
|
|
39
|
+
export declare function resetStudioLocale(): void;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { createLocaleConfig, isKnownLocale, sampleLocaleConfig } from '@elytracms/cms-core';
|
|
2
|
+
let state = {
|
|
3
|
+
config: sampleLocaleConfig,
|
|
4
|
+
active: sampleLocaleConfig.default,
|
|
5
|
+
};
|
|
6
|
+
const listeners = new Set();
|
|
7
|
+
function emit() {
|
|
8
|
+
for (const listener of listeners)
|
|
9
|
+
listener();
|
|
10
|
+
}
|
|
11
|
+
/** Snapshot of `{ config, active }` — stable identity until the next change. */
|
|
12
|
+
export function getStudioLocaleState() {
|
|
13
|
+
return state;
|
|
14
|
+
}
|
|
15
|
+
/** The active studio locale every surface renders in. */
|
|
16
|
+
export function getStudioLocale() {
|
|
17
|
+
return state.active;
|
|
18
|
+
}
|
|
19
|
+
/** The project locale config driving the switcher options. */
|
|
20
|
+
export function getStudioLocaleConfig() {
|
|
21
|
+
return state.config;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Switch the ambient locale. Unknown locales are ignored (the switcher only
|
|
25
|
+
* offers configured ones; programmatic callers get a no-op, never a crash).
|
|
26
|
+
*/
|
|
27
|
+
export function setStudioLocale(locale) {
|
|
28
|
+
if (locale === state.active || !isKnownLocale(state.config, locale))
|
|
29
|
+
return;
|
|
30
|
+
state = { ...state, active: locale };
|
|
31
|
+
emit();
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Install the project's locale config (e.g. when a CMS session or builder
|
|
35
|
+
* shell mounts with a starter kit's locales). The active locale is kept when
|
|
36
|
+
* it is still configured, otherwise it snaps back to the new default.
|
|
37
|
+
*/
|
|
38
|
+
export function configureStudioLocales(config) {
|
|
39
|
+
const normalized = createLocaleConfig({ default: config.default, locales: config.locales });
|
|
40
|
+
const sameConfig = normalized.default === state.config.default &&
|
|
41
|
+
normalized.locales.length === state.config.locales.length &&
|
|
42
|
+
normalized.locales.every((locale, i) => locale === state.config.locales[i]);
|
|
43
|
+
const active = isKnownLocale(normalized, state.active) ? state.active : normalized.default;
|
|
44
|
+
if (sameConfig && active === state.active)
|
|
45
|
+
return;
|
|
46
|
+
state = { config: normalized, active };
|
|
47
|
+
emit();
|
|
48
|
+
}
|
|
49
|
+
/** Subscribe to locale/config changes. Returns the unsubscribe function. */
|
|
50
|
+
export function subscribeStudioLocale(listener) {
|
|
51
|
+
listeners.add(listener);
|
|
52
|
+
return () => {
|
|
53
|
+
listeners.delete(listener);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/** Reset to the sample defaults (tests only — module state is shared). */
|
|
57
|
+
export function resetStudioLocale() {
|
|
58
|
+
state = { config: sampleLocaleConfig, active: sampleLocaleConfig.default };
|
|
59
|
+
emit();
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=locale-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale-store.js","sourceRoot":"","sources":["../../../src/lib/locale/locale-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAsB3F,IAAI,KAAK,GAAsB;IAC7B,MAAM,EAAE,kBAAkB;IAC1B,MAAM,EAAE,kBAAkB,CAAC,OAAO;CACnC,CAAA;AAED,MAAM,SAAS,GAAG,IAAI,GAAG,EAAc,CAAA;AAEvC,SAAS,IAAI;IACX,KAAK,MAAM,QAAQ,IAAI,SAAS;QAAE,QAAQ,EAAE,CAAA;AAC9C,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,oBAAoB;IAClC,OAAO,KAAK,CAAA;AACd,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,eAAe;IAC7B,OAAO,KAAK,CAAC,MAAM,CAAA;AACrB,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,qBAAqB;IACnC,OAAO,KAAK,CAAC,MAAM,CAAA;AACrB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,IAAI,MAAM,KAAK,KAAK,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC;QAAE,OAAM;IAC3E,KAAK,GAAG,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;IACpC,IAAI,EAAE,CAAA;AACR,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAoB;IACzD,MAAM,UAAU,GAAG,kBAAkB,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAA;IAC3F,MAAM,UAAU,GACd,UAAU,CAAC,OAAO,KAAK,KAAK,CAAC,MAAM,CAAC,OAAO;QAC3C,UAAU,CAAC,OAAO,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM;QACzD,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAA;IAC7E,MAAM,MAAM,GAAG,aAAa,CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAA;IAC1F,IAAI,UAAU,IAAI,MAAM,KAAK,KAAK,CAAC,MAAM;QAAE,OAAM;IACjD,KAAK,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,CAAA;IACtC,IAAI,EAAE,CAAA;AACR,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,qBAAqB,CAAC,QAAoB;IACxD,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IACvB,OAAO,GAAG,EAAE;QACV,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IAC5B,CAAC,CAAA;AACH,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,iBAAiB;IAC/B,KAAK,GAAG,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,kBAAkB,CAAC,OAAO,EAAE,CAAA;IAC1E,IAAI,EAAE,CAAA;AACR,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ambient locale switcher (EC-176): one segmented control, mounted in the
|
|
3
|
+
* builder toolbar and the CMS surface header, both driving the same
|
|
4
|
+
* studio-level active locale. Options come from the project locale config;
|
|
5
|
+
* the default locale is marked. Renders nothing for single-locale projects —
|
|
6
|
+
* no per-control locale ceremony anywhere else.
|
|
7
|
+
*/
|
|
8
|
+
export declare function LocaleSwitcher({ className }: {
|
|
9
|
+
className?: string;
|
|
10
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Globe } from 'lucide-react';
|
|
3
|
+
import { cn } from '../utils';
|
|
4
|
+
import { localeChipLabel } from './fallback';
|
|
5
|
+
import { useStudioLocale } from './use-studio-locale';
|
|
6
|
+
/**
|
|
7
|
+
* The ambient locale switcher (EC-176): one segmented control, mounted in the
|
|
8
|
+
* builder toolbar and the CMS surface header, both driving the same
|
|
9
|
+
* studio-level active locale. Options come from the project locale config;
|
|
10
|
+
* the default locale is marked. Renders nothing for single-locale projects —
|
|
11
|
+
* no per-control locale ceremony anywhere else.
|
|
12
|
+
*/
|
|
13
|
+
export function LocaleSwitcher({ className }) {
|
|
14
|
+
const { locale, config, setLocale } = useStudioLocale();
|
|
15
|
+
if (config.locales.length <= 1)
|
|
16
|
+
return null;
|
|
17
|
+
return (_jsxs("div", { role: "group", "aria-label": "Active locale", "data-testid": "locale-switcher", className: cn('flex items-center gap-1 rounded-md bg-muted/50 p-0.5', className), children: [_jsx(Globe, { "aria-hidden": true, className: "ml-1 size-3.5 self-center text-muted-foreground" }), config.locales.map((option) => {
|
|
18
|
+
const isDefault = option === config.default;
|
|
19
|
+
return (_jsxs("button", { type: "button", "aria-pressed": option === locale, title: isDefault ? `${localeChipLabel(option)} (default locale)` : localeChipLabel(option), "data-testid": `locale-option-${option}`, onClick: () => setLocale(option), className: cn('rounded-[5px] px-2 py-0.5 text-xs font-medium uppercase transition-colors', option === locale
|
|
20
|
+
? 'bg-background text-foreground shadow-sm'
|
|
21
|
+
: 'text-muted-foreground hover:text-foreground'), children: [option, isDefault ? _jsx("span", { className: "ml-0.5 text-muted-foreground/70", children: "\u00B7" }) : null] }, option));
|
|
22
|
+
})] }));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=locale-switcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale-switcher.js","sourceRoot":"","sources":["../../../src/lib/locale/locale-switcher.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACpC,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAA;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAErD;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,SAAS,EAA0B;IAClE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,eAAe,EAAE,CAAA;IACvD,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA;IAE3C,OAAO,CACL,eACE,IAAI,EAAC,OAAO,gBACD,eAAe,iBACd,iBAAiB,EAC7B,SAAS,EAAE,EAAE,CAAC,sDAAsD,EAAE,SAAS,CAAC,aAEhF,KAAC,KAAK,yBAAa,SAAS,EAAC,iDAAiD,GAAG,EAChF,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;gBAC7B,MAAM,SAAS,GAAG,MAAM,KAAK,MAAM,CAAC,OAAO,CAAA;gBAC3C,OAAO,CACL,kBAEE,IAAI,EAAC,QAAQ,kBACC,MAAM,KAAK,MAAM,EAC/B,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,iBAC7E,iBAAiB,MAAM,EAAE,EACtC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,EAChC,SAAS,EAAE,EAAE,CACX,2EAA2E,EAC3E,MAAM,KAAK,MAAM;wBACf,CAAC,CAAC,yCAAyC;wBAC3C,CAAC,CAAC,6CAA6C,CAClD,aAEA,MAAM,EACN,SAAS,CAAC,CAAC,CAAC,eAAM,SAAS,EAAC,iCAAiC,uBAAS,CAAC,CAAC,CAAC,IAAI,KAdzE,MAAM,CAeJ,CACV,CAAA;YACH,CAAC,CAAC,IACE,CACP,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Locale, RouteRecord } from '@elytracms/cms-core';
|
|
2
|
+
/**
|
|
3
|
+
* Per-locale URL preview (EC-176 over EC-170's per-locale routes): given the
|
|
4
|
+
* route records serving one page/template, pick the variant the active locale
|
|
5
|
+
* is actually served by — the locale's own route, else a locale-agnostic
|
|
6
|
+
* route, else the default locale's route *marked as a fallback* (the page has
|
|
7
|
+
* no address of its own in the active locale yet).
|
|
8
|
+
*/
|
|
9
|
+
export interface LocaleRouteVariant {
|
|
10
|
+
route: RouteRecord;
|
|
11
|
+
/** True when the active locale has no own/agnostic route — the URL shown is the default locale's. */
|
|
12
|
+
fellBack: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function localeRouteVariant(routes: readonly RouteRecord[], locale: Locale, defaultLocale: Locale): LocaleRouteVariant | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function localeRouteVariant(routes, locale, defaultLocale) {
|
|
2
|
+
const own = routes.find((route) => route.locale === locale);
|
|
3
|
+
if (own)
|
|
4
|
+
return { route: own, fellBack: false };
|
|
5
|
+
const agnostic = routes.find((route) => route.locale === undefined);
|
|
6
|
+
if (agnostic)
|
|
7
|
+
return { route: agnostic, fellBack: false };
|
|
8
|
+
const fallback = routes.find((route) => route.locale === defaultLocale) ?? routes[0];
|
|
9
|
+
return fallback ? { route: fallback, fellBack: true } : null;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=route-variant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-variant.js","sourceRoot":"","sources":["../../../src/lib/locale/route-variant.ts"],"names":[],"mappings":"AAgBA,MAAM,UAAU,kBAAkB,CAChC,MAA8B,EAC9B,MAAc,EACd,aAAqB;IAErB,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,CAAA;IAC3D,IAAI,GAAG;QAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAA;IAC/C,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAA;IACnE,IAAI,QAAQ;QAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAA;IACzD,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,aAAa,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAA;IACpF,OAAO,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AAC9D,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Locale, LocaleConfig } from '@elytracms/cms-core';
|
|
2
|
+
export interface StudioLocale {
|
|
3
|
+
/** The ambient active locale every studio surface renders in. */
|
|
4
|
+
locale: Locale;
|
|
5
|
+
/** The project locale config driving the switcher options. */
|
|
6
|
+
config: LocaleConfig;
|
|
7
|
+
setLocale: (locale: Locale) => void;
|
|
8
|
+
}
|
|
9
|
+
/** Subscribe a React surface to the studio's ambient locale (EC-176). */
|
|
10
|
+
export declare function useStudioLocale(): StudioLocale;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useSyncExternalStore } from 'react';
|
|
2
|
+
import { getStudioLocaleState, setStudioLocale, subscribeStudioLocale, } from './locale-store';
|
|
3
|
+
/** Subscribe a React surface to the studio's ambient locale (EC-176). */
|
|
4
|
+
export function useStudioLocale() {
|
|
5
|
+
const state = useSyncExternalStore(subscribeStudioLocale, getStudioLocaleState, getStudioLocaleState);
|
|
6
|
+
return { locale: state.active, config: state.config, setLocale: setStudioLocale };
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=use-studio-locale.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-studio-locale.js","sourceRoot":"","sources":["../../../src/lib/locale/use-studio-locale.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAA;AAE5C,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,qBAAqB,GACtB,MAAM,gBAAgB,CAAA;AAUvB,yEAAyE;AACzE,MAAM,UAAU,eAAe;IAC7B,MAAM,KAAK,GAAG,oBAAoB,CAChC,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,CACrB,CAAA;IACD,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,CAAA;AACnF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AssetRepository } from '@elytracms/persistence';
|
|
2
|
+
import type { OperationsClient } from './operations-package';
|
|
3
|
+
/**
|
|
4
|
+
* `AssetRepository` facade over the operations layer (EC-141). The asset
|
|
5
|
+
* flows (upload confirm, reference-respecting delete — EC-151) are written
|
|
6
|
+
* against the repository interface; this facade keeps those flows intact
|
|
7
|
+
* while routing every metadata *write* through `assets.*` commands (validate →
|
|
8
|
+
* authorize → mutate → event) and serving reads through `assets.*` queries.
|
|
9
|
+
* Blob bytes stay on `adapter.blobs` — transport, not domain.
|
|
10
|
+
*
|
|
11
|
+
* Operation failures are re-thrown as errors carrying the structured message;
|
|
12
|
+
* the asset flows already convert thrown failures into their structured
|
|
13
|
+
* results (`UploadResult` / `DeleteAssetResult`), which the UI renders.
|
|
14
|
+
*/
|
|
15
|
+
export declare function operationsAssetRepository(operations: OperationsClient): AssetRepository;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `AssetRepository` facade over the operations layer (EC-141). The asset
|
|
3
|
+
* flows (upload confirm, reference-respecting delete — EC-151) are written
|
|
4
|
+
* against the repository interface; this facade keeps those flows intact
|
|
5
|
+
* while routing every metadata *write* through `assets.*` commands (validate →
|
|
6
|
+
* authorize → mutate → event) and serving reads through `assets.*` queries.
|
|
7
|
+
* Blob bytes stay on `adapter.blobs` — transport, not domain.
|
|
8
|
+
*
|
|
9
|
+
* Operation failures are re-thrown as errors carrying the structured message;
|
|
10
|
+
* the asset flows already convert thrown failures into their structured
|
|
11
|
+
* results (`UploadResult` / `DeleteAssetResult`), which the UI renders.
|
|
12
|
+
*/
|
|
13
|
+
export function operationsAssetRepository(operations) {
|
|
14
|
+
return {
|
|
15
|
+
async upsertAsset(pid, input) {
|
|
16
|
+
const result = await operations.assets.upsert({ projectId: pid, asset: input });
|
|
17
|
+
if (!result.ok)
|
|
18
|
+
throw new Error(result.error.message);
|
|
19
|
+
return result.value;
|
|
20
|
+
},
|
|
21
|
+
async removeAsset(pid, id) {
|
|
22
|
+
const result = await operations.assets.remove({ projectId: pid, assetId: id });
|
|
23
|
+
if (!result.ok)
|
|
24
|
+
throw new Error(result.error.message);
|
|
25
|
+
},
|
|
26
|
+
async getAsset(pid, id) {
|
|
27
|
+
const result = await operations.assets.get({ projectId: pid, assetId: id });
|
|
28
|
+
if (!result.ok)
|
|
29
|
+
throw new Error(result.error.message);
|
|
30
|
+
return result.value;
|
|
31
|
+
},
|
|
32
|
+
async findAsset(pid, id) {
|
|
33
|
+
const result = await operations.assets.get({ projectId: pid, assetId: id });
|
|
34
|
+
if (!result.ok) {
|
|
35
|
+
if (result.error.code === 'not-found')
|
|
36
|
+
return undefined;
|
|
37
|
+
throw new Error(result.error.message);
|
|
38
|
+
}
|
|
39
|
+
return result.value;
|
|
40
|
+
},
|
|
41
|
+
async listAssets(pid) {
|
|
42
|
+
const result = await operations.assets.list({ projectId: pid });
|
|
43
|
+
if (!result.ok)
|
|
44
|
+
throw new Error(result.error.message);
|
|
45
|
+
return result.value;
|
|
46
|
+
},
|
|
47
|
+
async resolveMany(pid, ids) {
|
|
48
|
+
const result = await operations.assets.list({ projectId: pid });
|
|
49
|
+
if (!result.ok)
|
|
50
|
+
throw new Error(result.error.message);
|
|
51
|
+
const wanted = new Set(ids);
|
|
52
|
+
return new Map(result.value.filter((a) => wanted.has(a.id)).map((a) => [a.id, a]));
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=asset-repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-repository.js","sourceRoot":"","sources":["../../../src/lib/operations/asset-repository.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { CmsDocument, CollectionDef, DocumentRef } from '@elytracms/cms-core';
|
|
2
|
+
import type { OperationError, OperationsClient } from './operations-package';
|
|
3
|
+
/**
|
|
4
|
+
* CMS session → operations persistence (EC-141). The CMS store keeps documents
|
|
5
|
+
* and collections as optimistic session state (synchronous editing, validation
|
|
6
|
+
* feedback while typing); every mutation is mirrored onto the operations layer
|
|
7
|
+
* through `documents.*` / `schema.*` commands in dispatch order.
|
|
8
|
+
*
|
|
9
|
+
* Baseline: the persisted seed only covers the sample project. Before the
|
|
10
|
+
* first mirrored command, the persister ensures the project has a persisted
|
|
11
|
+
* schema + documents matching the session's starting state (kit imports,
|
|
12
|
+
* sample fixtures), so deletes/updates address records that exist.
|
|
13
|
+
*/
|
|
14
|
+
export interface CmsPersister {
|
|
15
|
+
upsertDocument(doc: CmsDocument): void;
|
|
16
|
+
deleteDocument(ref: DocumentRef): void;
|
|
17
|
+
/** Publish (EC-224): snapshot the current draft as a new version and pin it live. */
|
|
18
|
+
publishDocument(ref: DocumentRef): void;
|
|
19
|
+
/** Unpublish (EC-224): clear the live version pin + any legacy published marker. */
|
|
20
|
+
unpublishDocument(ref: DocumentRef): void;
|
|
21
|
+
upsertCollection(collection: CollectionDef): void;
|
|
22
|
+
/** Run the baseline seed now (e.g. before applying an AI changeset). */
|
|
23
|
+
ensureBaseline(): Promise<void>;
|
|
24
|
+
/** Await every queued command. */
|
|
25
|
+
flush(): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
export interface CmsPersisterOptions {
|
|
28
|
+
projectId: string;
|
|
29
|
+
getOperations: () => Promise<OperationsClient>;
|
|
30
|
+
/** Session collections/documents at baseline time (read lazily via refs). */
|
|
31
|
+
getCollections: () => readonly CollectionDef[];
|
|
32
|
+
getDocuments: () => readonly CmsDocument[];
|
|
33
|
+
onError: (error: OperationError) => void;
|
|
34
|
+
}
|
|
35
|
+
export declare function createCmsPersister(options: CmsPersisterOptions): CmsPersister;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { createPersistQueue } from './persist-queue';
|
|
2
|
+
export function createCmsPersister(options) {
|
|
3
|
+
const queue = createPersistQueue();
|
|
4
|
+
let baselineDone = false;
|
|
5
|
+
async function ensureBaselineNow() {
|
|
6
|
+
if (baselineDone)
|
|
7
|
+
return true;
|
|
8
|
+
const operations = await options.getOperations();
|
|
9
|
+
const schema = await operations.schema.get({ projectId: options.projectId });
|
|
10
|
+
if (schema.ok) {
|
|
11
|
+
// A persisted schema exists (seeded sample project or an earlier
|
|
12
|
+
// session) — the session started from the same fixtures, so commands
|
|
13
|
+
// can apply directly.
|
|
14
|
+
baselineDone = true;
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
const saved = await operations.schema.save({
|
|
18
|
+
projectId: options.projectId,
|
|
19
|
+
collections: [...options.getCollections()],
|
|
20
|
+
});
|
|
21
|
+
if (!saved.ok) {
|
|
22
|
+
options.onError(saved.error);
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
for (const document of options.getDocuments()) {
|
|
26
|
+
const result = await operations.documents.upsert({
|
|
27
|
+
projectId: options.projectId,
|
|
28
|
+
document,
|
|
29
|
+
});
|
|
30
|
+
if (!result.ok) {
|
|
31
|
+
options.onError(result.error);
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
baselineDone = true;
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
function command(run) {
|
|
39
|
+
queue.push(async () => {
|
|
40
|
+
// A failed baseline already surfaced through onError — running the
|
|
41
|
+
// command against missing records would only add a confusing follow-up.
|
|
42
|
+
if (!(await ensureBaselineNow()))
|
|
43
|
+
return;
|
|
44
|
+
const operations = await options.getOperations();
|
|
45
|
+
const result = await run(operations);
|
|
46
|
+
if (!result.ok)
|
|
47
|
+
options.onError(result.error);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
upsertDocument(doc) {
|
|
52
|
+
command((operations) => operations.documents.upsert({ projectId: options.projectId, document: doc }));
|
|
53
|
+
},
|
|
54
|
+
deleteDocument(ref) {
|
|
55
|
+
command((operations) => operations.documents.delete({ projectId: options.projectId, ref }));
|
|
56
|
+
},
|
|
57
|
+
publishDocument(ref) {
|
|
58
|
+
command((operations) => operations.documents.publish({ projectId: options.projectId, ref }));
|
|
59
|
+
},
|
|
60
|
+
unpublishDocument(ref) {
|
|
61
|
+
command((operations) => operations.documents.unpublish({ projectId: options.projectId, ref }));
|
|
62
|
+
},
|
|
63
|
+
upsertCollection(collection) {
|
|
64
|
+
command((operations) => operations.schema.upsertCollection({ projectId: options.projectId, collection }));
|
|
65
|
+
},
|
|
66
|
+
async ensureBaseline() {
|
|
67
|
+
queue.push(async () => {
|
|
68
|
+
await ensureBaselineNow();
|
|
69
|
+
});
|
|
70
|
+
await queue.flush();
|
|
71
|
+
},
|
|
72
|
+
flush: () => queue.flush(),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=cms-persistence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cms-persistence.js","sourceRoot":"","sources":["../../../src/lib/operations/cms-persistence.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import type { ComponentNode, Condition, InsertTarget, ProjectGraph, PropValue } from '@elytracms/project-graph';
|
|
2
|
+
import type { WorkingGraph, WorkingPageSeo } from '../working-graph';
|
|
3
|
+
import type { OperationResult, OperationsClient } from './operations-package';
|
|
4
|
+
/**
|
|
5
|
+
* Builder action → graph operation mapping (EC-141, reshaped by EC-187).
|
|
6
|
+
*
|
|
7
|
+
* The canonical `ProjectGraph` is now LAYOUTS-ONLY, and the page-node graph
|
|
8
|
+
* commands (`graph.insertNode`/`removeNode`/`duplicateNode`/`moveNode`/
|
|
9
|
+
* `reorderNode`/`setNodeProp`/`removeNodeProp`/`setNodeCondition`) were DELETED
|
|
10
|
+
* from the operations layer — a page is a CMS document now, edited through the
|
|
11
|
+
* composition-field path, not mirrored as node ops. So every page-tree edit
|
|
12
|
+
* here returns `null`: the legacy `/builder` page editor is in-memory-only for
|
|
13
|
+
* page edits (it is retired in a later slice).
|
|
14
|
+
*
|
|
15
|
+
* What still persists: `loadGraph` (restoring a saved revision), `undo`, and
|
|
16
|
+
* `redo` each save the whole graph via `graph.save` — but a `graph.save`
|
|
17
|
+
* persists a CANONICAL layouts-only `ProjectGraph`, so the WorkingGraph
|
|
18
|
+
* `present` is converted via `toProjectGraph` before it is sent.
|
|
19
|
+
*/
|
|
20
|
+
/** The builder store's action union (owned here so the mapping stays React-free). */
|
|
21
|
+
export type BuilderAction =
|
|
22
|
+
/** `pageId` additionally switches the active page (reference deep links, EC-172). */
|
|
23
|
+
{
|
|
24
|
+
type: 'select';
|
|
25
|
+
id: string | null;
|
|
26
|
+
pageId?: string;
|
|
27
|
+
} | {
|
|
28
|
+
type: 'hover';
|
|
29
|
+
id: string | null;
|
|
30
|
+
} | {
|
|
31
|
+
type: 'viewport';
|
|
32
|
+
viewport: 'desktop' | 'tablet' | 'mobile';
|
|
33
|
+
} | {
|
|
34
|
+
type: 'undo';
|
|
35
|
+
} | {
|
|
36
|
+
type: 'redo';
|
|
37
|
+
} | {
|
|
38
|
+
type: 'insert';
|
|
39
|
+
target: InsertTarget;
|
|
40
|
+
node: ComponentNode;
|
|
41
|
+
select?: boolean;
|
|
42
|
+
} | {
|
|
43
|
+
type: 'remove';
|
|
44
|
+
id: string;
|
|
45
|
+
} | {
|
|
46
|
+
type: 'duplicate';
|
|
47
|
+
id: string;
|
|
48
|
+
} | {
|
|
49
|
+
type: 'reorder';
|
|
50
|
+
id: string;
|
|
51
|
+
delta: -1 | 1;
|
|
52
|
+
} | {
|
|
53
|
+
type: 'move';
|
|
54
|
+
id: string;
|
|
55
|
+
target: InsertTarget;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* EC-162 layout gesture: wrap the reference node and the dragged subject in
|
|
59
|
+
* a two-column Grid container as ONE atomic structural edit (one undo step).
|
|
60
|
+
*/
|
|
61
|
+
| {
|
|
62
|
+
type: 'wrap';
|
|
63
|
+
referenceId: string;
|
|
64
|
+
side: 'left' | 'right';
|
|
65
|
+
subject: {
|
|
66
|
+
kind: 'node';
|
|
67
|
+
nodeId: string;
|
|
68
|
+
} | {
|
|
69
|
+
kind: 'component';
|
|
70
|
+
node: ComponentNode;
|
|
71
|
+
};
|
|
72
|
+
} | {
|
|
73
|
+
type: 'setProp';
|
|
74
|
+
id: string;
|
|
75
|
+
name: string;
|
|
76
|
+
value: PropValue;
|
|
77
|
+
coalesceKey?: string;
|
|
78
|
+
} | {
|
|
79
|
+
type: 'removeProp';
|
|
80
|
+
id: string;
|
|
81
|
+
name: string;
|
|
82
|
+
} | {
|
|
83
|
+
type: 'setCondition';
|
|
84
|
+
id: string;
|
|
85
|
+
condition: Condition | undefined;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* EC-171 legacy page SEO (in-memory only): set a working page's `seo` block.
|
|
89
|
+
* Page SEO persists via the `page` CMS document now, never as a node op — so
|
|
90
|
+
* this action does not mirror to a `graph.*` command.
|
|
91
|
+
*/
|
|
92
|
+
| {
|
|
93
|
+
type: 'setPageSeo';
|
|
94
|
+
pageId: string;
|
|
95
|
+
seo: WorkingPageSeo | undefined;
|
|
96
|
+
} | {
|
|
97
|
+
type: 'loadGraph';
|
|
98
|
+
graph: ProjectGraph;
|
|
99
|
+
};
|
|
100
|
+
/** The slice of builder state the mapping needs (pre-dispatch snapshot). */
|
|
101
|
+
export interface BuilderSnapshot {
|
|
102
|
+
present: WorkingGraph;
|
|
103
|
+
pageId: string;
|
|
104
|
+
nodeSeq: number;
|
|
105
|
+
}
|
|
106
|
+
/** A graph operation invocation, dispatchable via `operations.execute`. */
|
|
107
|
+
export interface GraphInvocation {
|
|
108
|
+
operation: string;
|
|
109
|
+
input: unknown;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Map a dispatched builder action onto the `graph.*` command that persists it.
|
|
113
|
+
*
|
|
114
|
+
* After EC-187 only the whole-graph operations survive: `loadGraph`/`undo`/
|
|
115
|
+
* `redo` persist a layouts-only `ProjectGraph` via `graph.save`. Every
|
|
116
|
+
* page-tree edit (insert/remove/duplicate/move/reorder/wrap/setProp/
|
|
117
|
+
* removeProp/setCondition) returns `null` — page-node graph commands are gone;
|
|
118
|
+
* those edits stay in-memory until the page is saved as a CMS document.
|
|
119
|
+
*/
|
|
120
|
+
export declare function graphInvocationFor(projectId: string, action: BuilderAction, prev: BuilderSnapshot, next: {
|
|
121
|
+
present: WorkingGraph;
|
|
122
|
+
}): GraphInvocation | null;
|
|
123
|
+
/**
|
|
124
|
+
* Make the persisted latest revision equal `graph` (the session's working
|
|
125
|
+
* graph) so node-level `graph.*` commands apply onto identical state. Saves a
|
|
126
|
+
* baseline revision when the project has no revision yet or the persisted
|
|
127
|
+
* latest diverged from the session (the builder session is the source of
|
|
128
|
+
* truth for the draft timeline — see the builder-store design note).
|
|
129
|
+
*/
|
|
130
|
+
export declare function ensureGraphBaseline(operations: OperationsClient, projectId: string, graph: ProjectGraph | WorkingGraph): Promise<OperationResult<unknown>>;
|
|
131
|
+
/**
|
|
132
|
+
* Persist "publish the session's latest state" (EC-141): ensure the working
|
|
133
|
+
* graph is the persisted latest revision (as the canonical layouts-only
|
|
134
|
+
* graph), then pin it live via `publishing.publish`. Single-environment
|
|
135
|
+
* (EC-179): a deployment IS one environment, so there is no target environment
|
|
136
|
+
* and no promote.
|
|
137
|
+
*/
|
|
138
|
+
export declare function persistPublish(operations: OperationsClient, projectId: string, workingGraph: ProjectGraph | WorkingGraph): Promise<OperationResult<unknown>>;
|
|
139
|
+
/** Persist an unpublish: revert the deployment to draft. */
|
|
140
|
+
export declare function persistUnpublish(operations: OperationsClient, projectId: string): Promise<OperationResult<unknown>>;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { toProjectGraph } from '../working-graph';
|
|
2
|
+
/**
|
|
3
|
+
* Map a dispatched builder action onto the `graph.*` command that persists it.
|
|
4
|
+
*
|
|
5
|
+
* After EC-187 only the whole-graph operations survive: `loadGraph`/`undo`/
|
|
6
|
+
* `redo` persist a layouts-only `ProjectGraph` via `graph.save`. Every
|
|
7
|
+
* page-tree edit (insert/remove/duplicate/move/reorder/wrap/setProp/
|
|
8
|
+
* removeProp/setCondition) returns `null` — page-node graph commands are gone;
|
|
9
|
+
* those edits stay in-memory until the page is saved as a CMS document.
|
|
10
|
+
*/
|
|
11
|
+
export function graphInvocationFor(projectId, action, prev, next) {
|
|
12
|
+
switch (action.type) {
|
|
13
|
+
case 'undo':
|
|
14
|
+
case 'redo': {
|
|
15
|
+
if (prev.present === next.present)
|
|
16
|
+
return null;
|
|
17
|
+
return {
|
|
18
|
+
operation: 'graph.save',
|
|
19
|
+
input: {
|
|
20
|
+
projectId,
|
|
21
|
+
// graph.save persists the canonical layouts-only graph.
|
|
22
|
+
graph: toProjectGraph(next.present),
|
|
23
|
+
message: action.type === 'undo' ? 'Undo' : 'Redo',
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
case 'loadGraph':
|
|
28
|
+
return {
|
|
29
|
+
operation: 'graph.save',
|
|
30
|
+
// `loadGraph` carries a canonical (layouts-only) ProjectGraph restore.
|
|
31
|
+
input: { projectId, graph: action.graph, message: 'Load graph' },
|
|
32
|
+
};
|
|
33
|
+
// Page-tree edits no longer mirror to node-level graph commands (those
|
|
34
|
+
// operations were deleted) — the page editor is in-memory-only now.
|
|
35
|
+
case 'select':
|
|
36
|
+
case 'hover':
|
|
37
|
+
case 'viewport':
|
|
38
|
+
case 'insert':
|
|
39
|
+
case 'remove':
|
|
40
|
+
case 'duplicate':
|
|
41
|
+
case 'reorder':
|
|
42
|
+
case 'move':
|
|
43
|
+
case 'wrap':
|
|
44
|
+
case 'setProp':
|
|
45
|
+
case 'removeProp':
|
|
46
|
+
case 'setCondition':
|
|
47
|
+
case 'setPageSeo':
|
|
48
|
+
return null;
|
|
49
|
+
default:
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Make the persisted latest revision equal `graph` (the session's working
|
|
55
|
+
* graph) so node-level `graph.*` commands apply onto identical state. Saves a
|
|
56
|
+
* baseline revision when the project has no revision yet or the persisted
|
|
57
|
+
* latest diverged from the session (the builder session is the source of
|
|
58
|
+
* truth for the draft timeline — see the builder-store design note).
|
|
59
|
+
*/
|
|
60
|
+
export async function ensureGraphBaseline(operations, projectId, graph) {
|
|
61
|
+
// A working graph (the live session) is persisted as the canonical
|
|
62
|
+
// layouts-only graph; a canonical graph passes through unchanged.
|
|
63
|
+
const canonical = 'pages' in graph ? toProjectGraph(graph) : graph;
|
|
64
|
+
const latest = await operations.graph.getLatest({ projectId });
|
|
65
|
+
if (latest.ok && JSON.stringify(latest.value.graph) === JSON.stringify(canonical))
|
|
66
|
+
return latest;
|
|
67
|
+
return operations.graph.save({ projectId, graph: canonical, message: 'Builder session baseline' });
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Persist "publish the session's latest state" (EC-141): ensure the working
|
|
71
|
+
* graph is the persisted latest revision (as the canonical layouts-only
|
|
72
|
+
* graph), then pin it live via `publishing.publish`. Single-environment
|
|
73
|
+
* (EC-179): a deployment IS one environment, so there is no target environment
|
|
74
|
+
* and no promote.
|
|
75
|
+
*/
|
|
76
|
+
export async function persistPublish(operations, projectId, workingGraph) {
|
|
77
|
+
const baseline = await ensureGraphBaseline(operations, projectId, workingGraph);
|
|
78
|
+
if (!baseline.ok)
|
|
79
|
+
return baseline;
|
|
80
|
+
return operations.publishing.publish({ projectId });
|
|
81
|
+
}
|
|
82
|
+
/** Persist an unpublish: revert the deployment to draft. */
|
|
83
|
+
export async function persistUnpublish(operations, projectId) {
|
|
84
|
+
return operations.publishing.unpublish({ projectId });
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=graph-commands.js.map
|