@elytracms/core 0.0.6
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/dist/clipboard/build.d.ts +77 -0
- package/dist/clipboard/build.js +128 -0
- package/dist/clipboard/build.js.map +1 -0
- package/dist/clipboard/clipboard.d.ts +33 -0
- package/dist/clipboard/clipboard.js +45 -0
- package/dist/clipboard/clipboard.js.map +1 -0
- package/dist/clipboard/fragment.d.ts +112 -0
- package/dist/clipboard/fragment.js +79 -0
- package/dist/clipboard/fragment.js.map +1 -0
- package/dist/clipboard/html.d.ts +26 -0
- package/dist/clipboard/html.js +82 -0
- package/dist/clipboard/html.js.map +1 -0
- package/dist/clipboard/index.d.ts +15 -0
- package/dist/clipboard/index.js +16 -0
- package/dist/clipboard/index.js.map +1 -0
- package/dist/clipboard/references.d.ts +50 -0
- package/dist/clipboard/references.js +0 -0
- package/dist/clipboard/references.js.map +1 -0
- package/dist/clipboard/serialize.d.ts +69 -0
- package/dist/clipboard/serialize.js +130 -0
- package/dist/clipboard/serialize.js.map +1 -0
- package/dist/cms-core/collections.d.ts +82 -0
- package/dist/cms-core/collections.js +187 -0
- package/dist/cms-core/collections.js.map +1 -0
- package/dist/cms-core/documents.d.ts +71 -0
- package/dist/cms-core/documents.js +67 -0
- package/dist/cms-core/documents.js.map +1 -0
- package/dist/cms-core/envelopes.d.ts +80 -0
- package/dist/cms-core/envelopes.js +124 -0
- package/dist/cms-core/envelopes.js.map +1 -0
- package/dist/cms-core/fields.d.ts +220 -0
- package/dist/cms-core/fields.js +250 -0
- package/dist/cms-core/fields.js.map +1 -0
- package/dist/cms-core/fixtures.d.ts +92 -0
- package/dist/cms-core/fixtures.js +357 -0
- package/dist/cms-core/fixtures.js.map +1 -0
- package/dist/cms-core/hierarchy.d.ts +113 -0
- package/dist/cms-core/hierarchy.js +223 -0
- package/dist/cms-core/hierarchy.js.map +1 -0
- package/dist/cms-core/index.d.ts +25 -0
- package/dist/cms-core/index.js +26 -0
- package/dist/cms-core/index.js.map +1 -0
- package/dist/cms-core/infer.d.ts +103 -0
- package/dist/cms-core/infer.js +57 -0
- package/dist/cms-core/infer.js.map +1 -0
- package/dist/cms-core/issues.d.ts +92 -0
- package/dist/cms-core/issues.js +74 -0
- package/dist/cms-core/issues.js.map +1 -0
- package/dist/cms-core/json-schema.d.ts +25 -0
- package/dist/cms-core/json-schema.js +110 -0
- package/dist/cms-core/json-schema.js.map +1 -0
- package/dist/cms-core/localization.d.ts +51 -0
- package/dist/cms-core/localization.js +89 -0
- package/dist/cms-core/localization.js.map +1 -0
- package/dist/cms-core/routes.d.ts +76 -0
- package/dist/cms-core/routes.js +220 -0
- package/dist/cms-core/routes.js.map +1 -0
- package/dist/cms-core/self-type.d.ts +41 -0
- package/dist/cms-core/self-type.js +191 -0
- package/dist/cms-core/self-type.js.map +1 -0
- package/dist/cms-core/url-for-document.d.ts +39 -0
- package/dist/cms-core/url-for-document.js +138 -0
- package/dist/cms-core/url-for-document.js.map +1 -0
- package/dist/cms-core/validate-document.d.ts +121 -0
- package/dist/cms-core/validate-document.js +871 -0
- package/dist/cms-core/validate-document.js.map +1 -0
- package/dist/cms-core/versions.d.ts +75 -0
- package/dist/cms-core/versions.js +97 -0
- package/dist/cms-core/versions.js.map +1 -0
- package/dist/collaboration/approval.d.ts +68 -0
- package/dist/collaboration/approval.js +104 -0
- package/dist/collaboration/approval.js.map +1 -0
- package/dist/collaboration/collaboration.d.ts +49 -0
- package/dist/collaboration/collaboration.js +56 -0
- package/dist/collaboration/collaboration.js.map +1 -0
- package/dist/collaboration/comments.d.ts +72 -0
- package/dist/collaboration/comments.js +118 -0
- package/dist/collaboration/comments.js.map +1 -0
- package/dist/collaboration/core.d.ts +25 -0
- package/dist/collaboration/core.js +26 -0
- package/dist/collaboration/core.js.map +1 -0
- package/dist/collaboration/index.d.ts +14 -0
- package/dist/collaboration/index.js +15 -0
- package/dist/collaboration/index.js.map +1 -0
- package/dist/collaboration/presence.d.ts +62 -0
- package/dist/collaboration/presence.js +85 -0
- package/dist/collaboration/presence.js.map +1 -0
- package/dist/collaboration/publishing.d.ts +60 -0
- package/dist/collaboration/publishing.js +93 -0
- package/dist/collaboration/publishing.js.map +1 -0
- package/dist/collaboration/versions.d.ts +52 -0
- package/dist/collaboration/versions.js +81 -0
- package/dist/collaboration/versions.js.map +1 -0
- package/dist/component-registry/index.d.ts +3 -0
- package/dist/component-registry/index.js +4 -0
- package/dist/component-registry/index.js.map +1 -0
- package/dist/component-registry/issues.d.ts +6 -0
- package/dist/component-registry/issues.js +2 -0
- package/dist/component-registry/issues.js.map +1 -0
- package/dist/component-registry/manifest.d.ts +164 -0
- package/dist/component-registry/manifest.js +129 -0
- package/dist/component-registry/manifest.js.map +1 -0
- package/dist/component-registry/registry.d.ts +33 -0
- package/dist/component-registry/registry.js +90 -0
- package/dist/component-registry/registry.js.map +1 -0
- package/dist/content/__fixtures__/filterable-collections.d.ts +14 -0
- package/dist/content/__fixtures__/filterable-collections.js +15 -0
- package/dist/content/__fixtures__/filterable-collections.js.map +1 -0
- package/dist/content/__fixtures__/sample-accessor-types.d.ts +56 -0
- package/dist/content/__fixtures__/sample-accessor-types.js +5 -0
- package/dist/content/__fixtures__/sample-accessor-types.js.map +1 -0
- package/dist/content/__fixtures__/sample-delivery-types.d.ts +122 -0
- package/dist/content/__fixtures__/sample-delivery-types.js +5 -0
- package/dist/content/__fixtures__/sample-delivery-types.js.map +1 -0
- package/dist/content/assets.d.ts +53 -0
- package/dist/content/assets.js +38 -0
- package/dist/content/assets.js.map +1 -0
- package/dist/content/binding-sources.d.ts +53 -0
- package/dist/content/binding-sources.js +73 -0
- package/dist/content/binding-sources.js.map +1 -0
- package/dist/content/client.d.ts +90 -0
- package/dist/content/client.js +383 -0
- package/dist/content/client.js.map +1 -0
- package/dist/content/codegen.d.ts +54 -0
- package/dist/content/codegen.js +305 -0
- package/dist/content/codegen.js.map +1 -0
- package/dist/content/context.d.ts +38 -0
- package/dist/content/context.js +21 -0
- package/dist/content/context.js.map +1 -0
- package/dist/content/cursor.d.ts +33 -0
- package/dist/content/cursor.js +104 -0
- package/dist/content/cursor.js.map +1 -0
- package/dist/content/index.d.ts +28 -0
- package/dist/content/index.js +29 -0
- package/dist/content/index.js.map +1 -0
- package/dist/content/locale.d.ts +30 -0
- package/dist/content/locale.js +26 -0
- package/dist/content/locale.js.map +1 -0
- package/dist/content/perspective.d.ts +29 -0
- package/dist/content/perspective.js +31 -0
- package/dist/content/perspective.js.map +1 -0
- package/dist/content/populate.d.ts +25 -0
- package/dist/content/populate.js +22 -0
- package/dist/content/populate.js.map +1 -0
- package/dist/content/query.d.ts +122 -0
- package/dist/content/query.js +257 -0
- package/dist/content/query.js.map +1 -0
- package/dist/content/raw.d.ts +13 -0
- package/dist/content/raw.js +14 -0
- package/dist/content/raw.js.map +1 -0
- package/dist/content/resolve.d.ts +97 -0
- package/dist/content/resolve.js +261 -0
- package/dist/content/resolve.js.map +1 -0
- package/dist/content/serialize.d.ts +30 -0
- package/dist/content/serialize.js +57 -0
- package/dist/content/serialize.js.map +1 -0
- package/dist/content/tags.d.ts +54 -0
- package/dist/content/tags.js +40 -0
- package/dist/content/tags.js.map +1 -0
- package/dist/data-binding/fixtures.d.ts +20 -0
- package/dist/data-binding/fixtures.js +47 -0
- package/dist/data-binding/fixtures.js.map +1 -0
- package/dist/data-binding/index.d.ts +14 -0
- package/dist/data-binding/index.js +15 -0
- package/dist/data-binding/index.js.map +1 -0
- package/dist/data-binding/issues.d.ts +45 -0
- package/dist/data-binding/issues.js +46 -0
- package/dist/data-binding/issues.js.map +1 -0
- package/dist/data-binding/resolve.d.ts +87 -0
- package/dist/data-binding/resolve.js +204 -0
- package/dist/data-binding/resolve.js.map +1 -0
- package/dist/data-binding/sample.d.ts +21 -0
- package/dist/data-binding/sample.js +23 -0
- package/dist/data-binding/sample.js.map +1 -0
- package/dist/data-binding/sources.d.ts +225 -0
- package/dist/data-binding/sources.js +154 -0
- package/dist/data-binding/sources.js.map +1 -0
- package/dist/data-binding/tokens.d.ts +62 -0
- package/dist/data-binding/tokens.js +150 -0
- package/dist/data-binding/tokens.js.map +1 -0
- package/dist/design-tokens/css.d.ts +34 -0
- package/dist/design-tokens/css.js +51 -0
- package/dist/design-tokens/css.js.map +1 -0
- package/dist/design-tokens/index.d.ts +10 -0
- package/dist/design-tokens/index.js +11 -0
- package/dist/design-tokens/index.js.map +1 -0
- package/dist/design-tokens/style-guide.d.ts +30 -0
- package/dist/design-tokens/style-guide.js +31 -0
- package/dist/design-tokens/style-guide.js.map +1 -0
- package/dist/design-tokens/tokens.d.ts +89 -0
- package/dist/design-tokens/tokens.js +112 -0
- package/dist/design-tokens/tokens.js.map +1 -0
- package/dist/export-sync/builder-source.d.ts +85 -0
- package/dist/export-sync/builder-source.js +124 -0
- package/dist/export-sync/builder-source.js.map +1 -0
- package/dist/export-sync/check.d.ts +61 -0
- package/dist/export-sync/check.js +126 -0
- package/dist/export-sync/check.js.map +1 -0
- package/dist/export-sync/cli.d.ts +89 -0
- package/dist/export-sync/cli.js +323 -0
- package/dist/export-sync/cli.js.map +1 -0
- package/dist/export-sync/core.d.ts +58 -0
- package/dist/export-sync/core.js +41 -0
- package/dist/export-sync/core.js.map +1 -0
- package/dist/export-sync/eject.d.ts +28 -0
- package/dist/export-sync/eject.js +21 -0
- package/dist/export-sync/eject.js.map +1 -0
- package/dist/export-sync/fixtures.d.ts +25 -0
- package/dist/export-sync/fixtures.js +87 -0
- package/dist/export-sync/fixtures.js.map +1 -0
- package/dist/export-sync/generate.d.ts +7 -0
- package/dist/export-sync/generate.js +505 -0
- package/dist/export-sync/generate.js.map +1 -0
- package/dist/export-sync/index.d.ts +37 -0
- package/dist/export-sync/index.js +39 -0
- package/dist/export-sync/index.js.map +1 -0
- package/dist/export-sync/init.d.ts +123 -0
- package/dist/export-sync/init.js +234 -0
- package/dist/export-sync/init.js.map +1 -0
- package/dist/export-sync/manifest-host.d.ts +48 -0
- package/dist/export-sync/manifest-host.js +73 -0
- package/dist/export-sync/manifest-host.js.map +1 -0
- package/dist/export-sync/node.d.ts +20 -0
- package/dist/export-sync/node.js +101 -0
- package/dist/export-sync/node.js.map +1 -0
- package/dist/export-sync/push.d.ts +76 -0
- package/dist/export-sync/push.js +197 -0
- package/dist/export-sync/push.js.map +1 -0
- package/dist/export-sync/registry-sync-client.d.ts +59 -0
- package/dist/export-sync/registry-sync-client.js +97 -0
- package/dist/export-sync/registry-sync-client.js.map +1 -0
- package/dist/export-sync/sync.d.ts +47 -0
- package/dist/export-sync/sync.js +47 -0
- package/dist/export-sync/sync.js.map +1 -0
- package/dist/export-sync/typegen.d.ts +40 -0
- package/dist/export-sync/typegen.js +45 -0
- package/dist/export-sync/typegen.js.map +1 -0
- package/dist/export-sync/validate.d.ts +19 -0
- package/dist/export-sync/validate.js +102 -0
- package/dist/export-sync/validate.js.map +1 -0
- package/dist/export-sync/watch.d.ts +66 -0
- package/dist/export-sync/watch.js +70 -0
- package/dist/export-sync/watch.js.map +1 -0
- package/dist/operations/assets.d.ts +198 -0
- package/dist/operations/assets.js +75 -0
- package/dist/operations/assets.js.map +1 -0
- package/dist/operations/authorization.d.ts +49 -0
- package/dist/operations/authorization.js +128 -0
- package/dist/operations/authorization.js.map +1 -0
- package/dist/operations/changesets.d.ts +160 -0
- package/dist/operations/changesets.js +442 -0
- package/dist/operations/changesets.js.map +1 -0
- package/dist/operations/client.d.ts +49 -0
- package/dist/operations/client.js +57 -0
- package/dist/operations/client.js.map +1 -0
- package/dist/operations/core.d.ts +238 -0
- package/dist/operations/core.js +269 -0
- package/dist/operations/core.js.map +1 -0
- package/dist/operations/documents.d.ts +432 -0
- package/dist/operations/documents.js +344 -0
- package/dist/operations/documents.js.map +1 -0
- package/dist/operations/graph.d.ts +138 -0
- package/dist/operations/graph.js +78 -0
- package/dist/operations/graph.js.map +1 -0
- package/dist/operations/index.d.ts +19 -0
- package/dist/operations/index.js +20 -0
- package/dist/operations/index.js.map +1 -0
- package/dist/operations/members.d.ts +87 -0
- package/dist/operations/members.js +56 -0
- package/dist/operations/members.js.map +1 -0
- package/dist/operations/publishing.d.ts +89 -0
- package/dist/operations/publishing.js +57 -0
- package/dist/operations/publishing.js.map +1 -0
- package/dist/operations/references.d.ts +222 -0
- package/dist/operations/references.js +177 -0
- package/dist/operations/references.js.map +1 -0
- package/dist/operations/schema.d.ts +413 -0
- package/dist/operations/schema.js +138 -0
- package/dist/operations/schema.js.map +1 -0
- package/dist/operations/tokens.d.ts +79 -0
- package/dist/operations/tokens.js +102 -0
- package/dist/operations/tokens.js.map +1 -0
- package/dist/persistence/adapter.d.ts +79 -0
- package/dist/persistence/adapter.js +55 -0
- package/dist/persistence/adapter.js.map +1 -0
- package/dist/persistence/assets.d.ts +120 -0
- package/dist/persistence/assets.js +141 -0
- package/dist/persistence/assets.js.map +1 -0
- package/dist/persistence/backend-validation.d.ts +43 -0
- package/dist/persistence/backend-validation.js +57 -0
- package/dist/persistence/backend-validation.js.map +1 -0
- package/dist/persistence/cli-tokens.d.ts +50 -0
- package/dist/persistence/cli-tokens.js +66 -0
- package/dist/persistence/cli-tokens.js.map +1 -0
- package/dist/persistence/cms.d.ts +148 -0
- package/dist/persistence/cms.js +232 -0
- package/dist/persistence/cms.js.map +1 -0
- package/dist/persistence/contract-scenarios.d.ts +73 -0
- package/dist/persistence/contract-scenarios.js +496 -0
- package/dist/persistence/contract-scenarios.js.map +1 -0
- package/dist/persistence/core.d.ts +96 -0
- package/dist/persistence/core.js +110 -0
- package/dist/persistence/core.js.map +1 -0
- package/dist/persistence/graph.d.ts +61 -0
- package/dist/persistence/graph.js +98 -0
- package/dist/persistence/graph.js.map +1 -0
- package/dist/persistence/index.d.ts +22 -0
- package/dist/persistence/index.js +23 -0
- package/dist/persistence/index.js.map +1 -0
- package/dist/persistence/members.d.ts +70 -0
- package/dist/persistence/members.js +0 -0
- package/dist/persistence/members.js.map +1 -0
- package/dist/persistence/publishing.d.ts +59 -0
- package/dist/persistence/publishing.js +95 -0
- package/dist/persistence/publishing.js.map +1 -0
- package/dist/persistence/reference-extraction.d.ts +44 -0
- package/dist/persistence/reference-extraction.js +204 -0
- package/dist/persistence/reference-extraction.js.map +1 -0
- package/dist/persistence/reference-indexing.d.ts +68 -0
- package/dist/persistence/reference-indexing.js +112 -0
- package/dist/persistence/reference-indexing.js.map +1 -0
- package/dist/persistence/references.d.ts +257 -0
- package/dist/persistence/references.js +0 -0
- package/dist/persistence/references.js.map +1 -0
- package/dist/persistence/seed.d.ts +55 -0
- package/dist/persistence/seed.js +102 -0
- package/dist/persistence/seed.js.map +1 -0
- package/dist/persistence/self-maintaining-adapter.d.ts +41 -0
- package/dist/persistence/self-maintaining-adapter.js +79 -0
- package/dist/persistence/self-maintaining-adapter.js.map +1 -0
- package/dist/plugins/asset-storage.d.ts +76 -0
- package/dist/plugins/asset-storage.js +104 -0
- package/dist/plugins/asset-storage.js.map +1 -0
- package/dist/plugins/component-package.d.ts +54 -0
- package/dist/plugins/component-package.js +92 -0
- package/dist/plugins/component-package.js.map +1 -0
- package/dist/plugins/data-sources.d.ts +78 -0
- package/dist/plugins/data-sources.js +99 -0
- package/dist/plugins/data-sources.js.map +1 -0
- package/dist/plugins/examples.d.ts +47 -0
- package/dist/plugins/examples.js +205 -0
- package/dist/plugins/examples.js.map +1 -0
- package/dist/plugins/export-targets.d.ts +47 -0
- package/dist/plugins/export-targets.js +78 -0
- package/dist/plugins/export-targets.js.map +1 -0
- package/dist/plugins/field-types.d.ts +86 -0
- package/dist/plugins/field-types.js +93 -0
- package/dist/plugins/field-types.js.map +1 -0
- package/dist/plugins/hooks.d.ts +60 -0
- package/dist/plugins/hooks.js +94 -0
- package/dist/plugins/hooks.js.map +1 -0
- package/dist/plugins/index.d.ts +27 -0
- package/dist/plugins/index.js +28 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/marketplace.d.ts +90 -0
- package/dist/plugins/marketplace.js +110 -0
- package/dist/plugins/marketplace.js.map +1 -0
- package/dist/plugins/plugin.d.ts +107 -0
- package/dist/plugins/plugin.js +122 -0
- package/dist/plugins/plugin.js.map +1 -0
- package/dist/plugins/templates.d.ts +66 -0
- package/dist/plugins/templates.js +74 -0
- package/dist/plugins/templates.js.map +1 -0
- package/dist/project-graph/binding.d.ts +68 -0
- package/dist/project-graph/binding.js +39 -0
- package/dist/project-graph/binding.js.map +1 -0
- package/dist/project-graph/container.d.ts +126 -0
- package/dist/project-graph/container.js +221 -0
- package/dist/project-graph/container.js.map +1 -0
- package/dist/project-graph/edit.d.ts +66 -0
- package/dist/project-graph/edit.js +201 -0
- package/dist/project-graph/edit.js.map +1 -0
- package/dist/project-graph/fixtures.d.ts +51 -0
- package/dist/project-graph/fixtures.js +224 -0
- package/dist/project-graph/fixtures.js.map +1 -0
- package/dist/project-graph/ids.d.ts +17 -0
- package/dist/project-graph/ids.js +19 -0
- package/dist/project-graph/ids.js.map +1 -0
- package/dist/project-graph/index.d.ts +12 -0
- package/dist/project-graph/index.js +13 -0
- package/dist/project-graph/index.js.map +1 -0
- package/dist/project-graph/issues.d.ts +61 -0
- package/dist/project-graph/issues.js +44 -0
- package/dist/project-graph/issues.js.map +1 -0
- package/dist/project-graph/json.d.ts +6 -0
- package/dist/project-graph/json.js +10 -0
- package/dist/project-graph/json.js.map +1 -0
- package/dist/project-graph/node.d.ts +48 -0
- package/dist/project-graph/node.js +42 -0
- package/dist/project-graph/node.js.map +1 -0
- package/dist/project-graph/normalize.d.ts +17 -0
- package/dist/project-graph/normalize.js +110 -0
- package/dist/project-graph/normalize.js.map +1 -0
- package/dist/project-graph/serialize.d.ts +36 -0
- package/dist/project-graph/serialize.js +51 -0
- package/dist/project-graph/serialize.js.map +1 -0
- package/dist/project-graph/structure.d.ts +40 -0
- package/dist/project-graph/structure.js +36 -0
- package/dist/project-graph/structure.js.map +1 -0
- package/dist/project-graph/validate.d.ts +84 -0
- package/dist/project-graph/validate.js +158 -0
- package/dist/project-graph/validate.js.map +1 -0
- package/dist/rich-text/adapter.d.ts +43 -0
- package/dist/rich-text/adapter.js +24 -0
- package/dist/rich-text/adapter.js.map +1 -0
- package/dist/rich-text/dom-editor.d.ts +101 -0
- package/dist/rich-text/dom-editor.js +482 -0
- package/dist/rich-text/dom-editor.js.map +1 -0
- package/dist/rich-text/embed.d.ts +70 -0
- package/dist/rich-text/embed.js +70 -0
- package/dist/rich-text/embed.js.map +1 -0
- package/dist/rich-text/fixtures.d.ts +25 -0
- package/dist/rich-text/fixtures.js +115 -0
- package/dist/rich-text/fixtures.js.map +1 -0
- package/dist/rich-text/html.d.ts +5 -0
- package/dist/rich-text/html.js +309 -0
- package/dist/rich-text/html.js.map +1 -0
- package/dist/rich-text/index.d.ts +19 -0
- package/dist/rich-text/index.js +20 -0
- package/dist/rich-text/index.js.map +1 -0
- package/dist/rich-text/markdown.d.ts +7 -0
- package/dist/rich-text/markdown.js +235 -0
- package/dist/rich-text/markdown.js.map +1 -0
- package/dist/rich-text/portable-text.d.ts +50 -0
- package/dist/rich-text/portable-text.js +223 -0
- package/dist/rich-text/portable-text.js.map +1 -0
- package/dist/rich-text/registry.d.ts +48 -0
- package/dist/rich-text/registry.js +16 -0
- package/dist/rich-text/registry.js.map +1 -0
- package/dist/rich-text/render.d.ts +69 -0
- package/dist/rich-text/render.js +205 -0
- package/dist/rich-text/render.js.map +1 -0
- package/dist/rich-text/schema.d.ts +86 -0
- package/dist/rich-text/schema.js +80 -0
- package/dist/rich-text/schema.js.map +1 -0
- package/dist/rich-text/test-support.d.ts +7 -0
- package/dist/rich-text/test-support.js +8 -0
- package/dist/rich-text/test-support.js.map +1 -0
- package/dist/runtime-renderer/client.d.ts +14 -0
- package/dist/runtime-renderer/client.js +15 -0
- package/dist/runtime-renderer/client.js.map +1 -0
- package/dist/runtime-renderer/condition.d.ts +8 -0
- package/dist/runtime-renderer/condition.js +48 -0
- package/dist/runtime-renderer/condition.js.map +1 -0
- package/dist/runtime-renderer/content-client.d.ts +62 -0
- package/dist/runtime-renderer/content-client.js +37 -0
- package/dist/runtime-renderer/content-client.js.map +1 -0
- package/dist/runtime-renderer/context.d.ts +185 -0
- package/dist/runtime-renderer/context.js +7 -0
- package/dist/runtime-renderer/context.js.map +1 -0
- package/dist/runtime-renderer/fallback.d.ts +39 -0
- package/dist/runtime-renderer/fallback.js +45 -0
- package/dist/runtime-renderer/fallback.js.map +1 -0
- package/dist/runtime-renderer/index.d.ts +13 -0
- package/dist/runtime-renderer/index.js +13 -0
- package/dist/runtime-renderer/index.js.map +1 -0
- package/dist/runtime-renderer/primitives.d.ts +85 -0
- package/dist/runtime-renderer/primitives.js +442 -0
- package/dist/runtime-renderer/primitives.js.map +1 -0
- package/dist/runtime-renderer/render.d.ts +138 -0
- package/dist/runtime-renderer/render.js +825 -0
- package/dist/runtime-renderer/render.js.map +1 -0
- package/dist/runtime-renderer/rich-text.d.ts +26 -0
- package/dist/runtime-renderer/rich-text.js +113 -0
- package/dist/runtime-renderer/rich-text.js.map +1 -0
- package/dist/starter-kits/index.d.ts +13 -0
- package/dist/starter-kits/index.js +14 -0
- package/dist/starter-kits/index.js.map +1 -0
- package/dist/starter-kits/instantiate.d.ts +29 -0
- package/dist/starter-kits/instantiate.js +24 -0
- package/dist/starter-kits/instantiate.js.map +1 -0
- package/dist/starter-kits/kit.d.ts +61 -0
- package/dist/starter-kits/kit.js +37 -0
- package/dist/starter-kits/kit.js.map +1 -0
- package/dist/starter-kits/kits.d.ts +7 -0
- package/dist/starter-kits/kits.js +201 -0
- package/dist/starter-kits/kits.js.map +1 -0
- package/dist/starter-kits/manifests.d.ts +7 -0
- package/dist/starter-kits/manifests.js +111 -0
- package/dist/starter-kits/manifests.js.map +1 -0
- package/dist/starter-kits/upgrade.d.ts +39 -0
- package/dist/starter-kits/upgrade.js +54 -0
- package/dist/starter-kits/upgrade.js.map +1 -0
- package/dist/starter-kits/validate.d.ts +16 -0
- package/dist/starter-kits/validate.js +77 -0
- package/dist/starter-kits/validate.js.map +1 -0
- package/dist/studio-core/context.d.ts +27 -0
- package/dist/studio-core/context.js +44 -0
- package/dist/studio-core/context.js.map +1 -0
- package/dist/studio-core/errors.d.ts +58 -0
- package/dist/studio-core/errors.js +74 -0
- package/dist/studio-core/errors.js.map +1 -0
- package/dist/studio-core/fixtures.d.ts +18 -0
- package/dist/studio-core/fixtures.js +83 -0
- package/dist/studio-core/fixtures.js.map +1 -0
- package/dist/studio-core/ids.d.ts +22 -0
- package/dist/studio-core/ids.js +33 -0
- package/dist/studio-core/ids.js.map +1 -0
- package/dist/studio-core/index.d.ts +11 -0
- package/dist/studio-core/index.js +12 -0
- package/dist/studio-core/index.js.map +1 -0
- package/dist/studio-core/issues.d.ts +50 -0
- package/dist/studio-core/issues.js +33 -0
- package/dist/studio-core/issues.js.map +1 -0
- package/dist/studio-core/metadata.d.ts +109 -0
- package/dist/studio-core/metadata.js +74 -0
- package/dist/studio-core/metadata.js.map +1 -0
- package/dist/studio-core/repository.d.ts +73 -0
- package/dist/studio-core/repository.js +202 -0
- package/dist/studio-core/repository.js.map +1 -0
- package/dist/studio-core/sections.d.ts +73 -0
- package/dist/studio-core/sections.js +68 -0
- package/dist/studio-core/sections.js.map +1 -0
- package/dist/studio-core/validate.d.ts +15 -0
- package/dist/studio-core/validate.js +119 -0
- package/dist/studio-core/validate.js.map +1 -0
- package/dist/studio-core/workspace-config.d.ts +587 -0
- package/dist/studio-core/workspace-config.js +434 -0
- package/dist/studio-core/workspace-config.js.map +1 -0
- package/package.json +104 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Stable codes for structured validation issues (brief §4.11, §7.1). */
|
|
3
|
+
export declare const issueCodeSchema: z.ZodEnum<{
|
|
4
|
+
"invalid-component-name": "invalid-component-name";
|
|
5
|
+
"unknown-component": "unknown-component";
|
|
6
|
+
"duplicate-node-id": "duplicate-node-id";
|
|
7
|
+
"unknown-prop": "unknown-prop";
|
|
8
|
+
"invalid-prop": "invalid-prop";
|
|
9
|
+
"binding-not-allowed": "binding-not-allowed";
|
|
10
|
+
"unresolved-binding": "unresolved-binding";
|
|
11
|
+
"missing-required-slot": "missing-required-slot";
|
|
12
|
+
"unknown-slot": "unknown-slot";
|
|
13
|
+
"forbidden-component": "forbidden-component";
|
|
14
|
+
"server-only-component": "server-only-component";
|
|
15
|
+
"unknown-layout": "unknown-layout";
|
|
16
|
+
"route-conflict": "route-conflict";
|
|
17
|
+
"invalid-container-direction": "invalid-container-direction";
|
|
18
|
+
"invalid-container-alignment": "invalid-container-alignment";
|
|
19
|
+
"invalid-container-gap": "invalid-container-gap";
|
|
20
|
+
"invalid-container-columns": "invalid-container-columns";
|
|
21
|
+
"invalid-container-responsive": "invalid-container-responsive";
|
|
22
|
+
}>;
|
|
23
|
+
export type IssueCode = z.infer<typeof issueCodeSchema>;
|
|
24
|
+
export declare const issueSeveritySchema: z.ZodEnum<{
|
|
25
|
+
error: "error";
|
|
26
|
+
warning: "warning";
|
|
27
|
+
}>;
|
|
28
|
+
export type IssueSeverity = z.infer<typeof issueSeveritySchema>;
|
|
29
|
+
/** A structured validation issue carrying a JSON path into the graph. */
|
|
30
|
+
export declare const validationIssueSchema: z.ZodObject<{
|
|
31
|
+
code: z.ZodEnum<{
|
|
32
|
+
"invalid-component-name": "invalid-component-name";
|
|
33
|
+
"unknown-component": "unknown-component";
|
|
34
|
+
"duplicate-node-id": "duplicate-node-id";
|
|
35
|
+
"unknown-prop": "unknown-prop";
|
|
36
|
+
"invalid-prop": "invalid-prop";
|
|
37
|
+
"binding-not-allowed": "binding-not-allowed";
|
|
38
|
+
"unresolved-binding": "unresolved-binding";
|
|
39
|
+
"missing-required-slot": "missing-required-slot";
|
|
40
|
+
"unknown-slot": "unknown-slot";
|
|
41
|
+
"forbidden-component": "forbidden-component";
|
|
42
|
+
"server-only-component": "server-only-component";
|
|
43
|
+
"unknown-layout": "unknown-layout";
|
|
44
|
+
"route-conflict": "route-conflict";
|
|
45
|
+
"invalid-container-direction": "invalid-container-direction";
|
|
46
|
+
"invalid-container-alignment": "invalid-container-alignment";
|
|
47
|
+
"invalid-container-gap": "invalid-container-gap";
|
|
48
|
+
"invalid-container-columns": "invalid-container-columns";
|
|
49
|
+
"invalid-container-responsive": "invalid-container-responsive";
|
|
50
|
+
}>;
|
|
51
|
+
severity: z.ZodEnum<{
|
|
52
|
+
error: "error";
|
|
53
|
+
warning: "warning";
|
|
54
|
+
}>;
|
|
55
|
+
message: z.ZodString;
|
|
56
|
+
path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
57
|
+
nodeId: z.ZodOptional<z.ZodString>;
|
|
58
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./json").JsonValue, unknown, z.core.$ZodTypeInternals<import("./json").JsonValue, unknown>>>>;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
export type ValidationIssue = z.infer<typeof validationIssueSchema>;
|
|
61
|
+
export type GraphPath = ReadonlyArray<string | number>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { idSchema } from './ids';
|
|
3
|
+
import { jsonValueSchema } from './json';
|
|
4
|
+
/** Stable codes for structured validation issues (brief §4.11, §7.1). */
|
|
5
|
+
export const issueCodeSchema = z.enum([
|
|
6
|
+
'invalid-component-name',
|
|
7
|
+
'unknown-component',
|
|
8
|
+
'duplicate-node-id',
|
|
9
|
+
'unknown-prop',
|
|
10
|
+
'invalid-prop',
|
|
11
|
+
'binding-not-allowed',
|
|
12
|
+
'unresolved-binding',
|
|
13
|
+
'missing-required-slot',
|
|
14
|
+
'unknown-slot',
|
|
15
|
+
// Placement constraints (EC-186): a component appears where its slot's `allow`
|
|
16
|
+
// vocabulary — or a composition field's `allow` — forbids it.
|
|
17
|
+
'forbidden-component',
|
|
18
|
+
// Canvas-eligibility (EC-191): a server-only (RSC / non-client-renderable)
|
|
19
|
+
// component was placed in an editor composition, which is client-rendered.
|
|
20
|
+
// Such components belong in dev frames (page.tsx / layout.tsx), not the canvas.
|
|
21
|
+
'server-only-component',
|
|
22
|
+
'unknown-layout',
|
|
23
|
+
'route-conflict',
|
|
24
|
+
// Layout containers (EC-161): malformed Stack/Grid canonical props.
|
|
25
|
+
'invalid-container-direction',
|
|
26
|
+
'invalid-container-alignment',
|
|
27
|
+
'invalid-container-gap',
|
|
28
|
+
'invalid-container-columns',
|
|
29
|
+
// Responsive defaults (EC-163): malformed Grid stack-on-mobile override.
|
|
30
|
+
'invalid-container-responsive',
|
|
31
|
+
]);
|
|
32
|
+
export const issueSeveritySchema = z.enum(['error', 'warning']);
|
|
33
|
+
/** A structured validation issue carrying a JSON path into the graph. */
|
|
34
|
+
export const validationIssueSchema = z.object({
|
|
35
|
+
code: issueCodeSchema,
|
|
36
|
+
severity: issueSeveritySchema,
|
|
37
|
+
message: z.string(),
|
|
38
|
+
/** JSON path into the graph, e.g. ['pages', 0, 'root', 'slots', 'children', 1]. */
|
|
39
|
+
path: z.array(z.union([z.string(), z.number()])),
|
|
40
|
+
/** The offending node id, when applicable. */
|
|
41
|
+
nodeId: idSchema.optional(),
|
|
42
|
+
meta: z.record(z.string(), jsonValueSchema).optional(),
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=issues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issues.js","sourceRoot":"","sources":["../../src/project-graph/issues.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAExC,yEAAyE;AACzE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC;IACpC,wBAAwB;IACxB,mBAAmB;IACnB,mBAAmB;IACnB,cAAc;IACd,cAAc;IACd,qBAAqB;IACrB,oBAAoB;IACpB,uBAAuB;IACvB,cAAc;IACd,+EAA+E;IAC/E,8DAA8D;IAC9D,qBAAqB;IACrB,2EAA2E;IAC3E,2EAA2E;IAC3E,gFAAgF;IAChF,uBAAuB;IACvB,gBAAgB;IAChB,gBAAgB;IAChB,oEAAoE;IACpE,6BAA6B;IAC7B,6BAA6B;IAC7B,uBAAuB;IACvB,2BAA2B;IAC3B,yEAAyE;IACzE,8BAA8B;CAC/B,CAAC,CAAA;AAGF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAA;AAG/D,yEAAyE;AACzE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,IAAI,EAAE,eAAe;IACrB,QAAQ,EAAE,mBAAmB;IAC7B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,mFAAmF;IACnF,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAChD,8CAA8C;IAC9C,MAAM,EAAE,QAAQ,CAAC,QAAQ,EAAE;IAC3B,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,eAAe,CAAC,CAAC,QAAQ,EAAE;CACvD,CAAC,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** A JSON-serializable value. The project graph contains only these — never functions or runtime handles. */
|
|
3
|
+
export type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
4
|
+
[key: string]: JsonValue;
|
|
5
|
+
};
|
|
6
|
+
export declare const jsonValueSchema: z.ZodType<JsonValue>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../src/project-graph/json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAWvB,MAAM,CAAC,MAAM,eAAe,GAAyB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAC/D,CAAC,CAAC,KAAK,CAAC;IACN,CAAC,CAAC,MAAM,EAAE;IACV,CAAC,CAAC,MAAM,EAAE;IACV,CAAC,CAAC,OAAO,EAAE;IACX,CAAC,CAAC,IAAI,EAAE;IACR,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC;IACxB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,eAAe,CAAC;CACtC,CAAC,CACH,CAAA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { BindingReference, Condition } from './binding';
|
|
3
|
+
import type { JsonValue } from './json';
|
|
4
|
+
/** A prop value is either a static JSON value or a binding into a data source. */
|
|
5
|
+
export declare const propValueSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
6
|
+
kind: z.ZodLiteral<"static">;
|
|
7
|
+
value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
8
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
9
|
+
kind: z.ZodLiteral<"binding">;
|
|
10
|
+
binding: z.ZodObject<{
|
|
11
|
+
sourceId: z.ZodString;
|
|
12
|
+
token: z.ZodString;
|
|
13
|
+
mode: z.ZodEnum<{
|
|
14
|
+
object: "object";
|
|
15
|
+
value: "value";
|
|
16
|
+
spread: "spread";
|
|
17
|
+
repeaterItem: "repeaterItem";
|
|
18
|
+
condition: "condition";
|
|
19
|
+
}>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
}, z.core.$strip>], "kind">;
|
|
22
|
+
export type PropValue = z.infer<typeof propValueSchema>;
|
|
23
|
+
/**
|
|
24
|
+
* An instance of a registered component. Recursive via `slots`: each named slot
|
|
25
|
+
* holds an ordered list of child nodes. The reserved slot `children` is the default
|
|
26
|
+
* insertion point.
|
|
27
|
+
*/
|
|
28
|
+
export interface ComponentNode {
|
|
29
|
+
id: string;
|
|
30
|
+
/** Namespaced registered component id (validated semantically, not at parse time). */
|
|
31
|
+
componentId: string;
|
|
32
|
+
props?: Record<string, PropValue>;
|
|
33
|
+
slots?: Record<string, ComponentNode[]>;
|
|
34
|
+
condition?: Condition;
|
|
35
|
+
}
|
|
36
|
+
export declare const componentNodeSchema: z.ZodType<ComponentNode>;
|
|
37
|
+
/** Convenience constructors for prop values. */
|
|
38
|
+
export declare function staticProp(value: JsonValue): PropValue;
|
|
39
|
+
export declare function boundProp(binding: BindingReference): PropValue;
|
|
40
|
+
/** Structural guard for a stored component node (id + componentId present). */
|
|
41
|
+
export declare function isComponentNode(value: unknown): value is ComponentNode;
|
|
42
|
+
/**
|
|
43
|
+
* Coerce a stored blocks/composition field value into its root node list — the
|
|
44
|
+
* inverse of how a `blocks` field persists (a single node for cardinality
|
|
45
|
+
* `one`, an array for `many`). Non-node entries are dropped; anything else
|
|
46
|
+
* yields `[]`.
|
|
47
|
+
*/
|
|
48
|
+
export declare function blockRootsOf(value: unknown): ComponentNode[];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { bindingReferenceSchema, conditionSchema } from './binding';
|
|
3
|
+
import { idSchema } from './ids';
|
|
4
|
+
import { jsonValueSchema } from './json';
|
|
5
|
+
/** A prop value is either a static JSON value or a binding into a data source. */
|
|
6
|
+
export const propValueSchema = z.discriminatedUnion('kind', [
|
|
7
|
+
z.object({ kind: z.literal('static'), value: jsonValueSchema }),
|
|
8
|
+
z.object({ kind: z.literal('binding'), binding: bindingReferenceSchema }),
|
|
9
|
+
]);
|
|
10
|
+
export const componentNodeSchema = z.lazy(() => z.object({
|
|
11
|
+
id: idSchema,
|
|
12
|
+
componentId: idSchema,
|
|
13
|
+
props: z.record(z.string(), propValueSchema).optional(),
|
|
14
|
+
slots: z.record(z.string(), z.array(componentNodeSchema)).optional(),
|
|
15
|
+
condition: conditionSchema.optional(),
|
|
16
|
+
}));
|
|
17
|
+
/** Convenience constructors for prop values. */
|
|
18
|
+
export function staticProp(value) {
|
|
19
|
+
return { kind: 'static', value };
|
|
20
|
+
}
|
|
21
|
+
export function boundProp(binding) {
|
|
22
|
+
return { kind: 'binding', binding };
|
|
23
|
+
}
|
|
24
|
+
/** Structural guard for a stored component node (id + componentId present). */
|
|
25
|
+
export function isComponentNode(value) {
|
|
26
|
+
return (typeof value === 'object' &&
|
|
27
|
+
value !== null &&
|
|
28
|
+
typeof value.id === 'string' &&
|
|
29
|
+
typeof value.componentId === 'string');
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Coerce a stored blocks/composition field value into its root node list — the
|
|
33
|
+
* inverse of how a `blocks` field persists (a single node for cardinality
|
|
34
|
+
* `one`, an array for `many`). Non-node entries are dropped; anything else
|
|
35
|
+
* yields `[]`.
|
|
36
|
+
*/
|
|
37
|
+
export function blockRootsOf(value) {
|
|
38
|
+
if (Array.isArray(value))
|
|
39
|
+
return value.filter(isComponentNode);
|
|
40
|
+
return isComponentNode(value) ? [value] : [];
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../src/project-graph/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAEnE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAGxC,kFAAkF;AAClF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC1D,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC;IAC/D,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,sBAAsB,EAAE,CAAC;CAC1E,CAAC,CAAA;AAiBF,MAAM,CAAC,MAAM,mBAAmB,GAA6B,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CACvE,CAAC,CAAC,MAAM,CAAC;IACP,EAAE,EAAE,QAAQ;IACZ,WAAW,EAAE,QAAQ;IACrB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,eAAe,CAAC,CAAC,QAAQ,EAAE;IACvD,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC,QAAQ,EAAE;IACpE,SAAS,EAAE,eAAe,CAAC,QAAQ,EAAE;CACtC,CAAC,CACH,CAAA;AAED,gDAAgD;AAChD,MAAM,UAAU,UAAU,CAAC,KAAgB;IACzC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAA;AAClC,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,OAAyB;IACjD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAA;AACrC,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,OAAQ,KAA0B,CAAC,EAAE,KAAK,QAAQ;QAClD,OAAQ,KAAmC,CAAC,WAAW,KAAK,QAAQ,CACrE,CAAA;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAA;IAC9D,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;AAC9C,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ComponentNode } from './node';
|
|
2
|
+
import type { ProjectGraph } from './structure';
|
|
3
|
+
/**
|
|
4
|
+
* Normalize the container structure of a page/layout tree. The root itself is the
|
|
5
|
+
* tree's anchor and is never dissolved or removed; its subtree is fully normalized.
|
|
6
|
+
* Returns the same root reference when the tree is already normal.
|
|
7
|
+
*/
|
|
8
|
+
export declare function normalizeContainers(root: ComponentNode): ComponentNode;
|
|
9
|
+
/**
|
|
10
|
+
* Normalize every layout tree in a project graph (EC-187: layouts-only).
|
|
11
|
+
* Identity-preserving: returns the same graph reference when nothing changed, so
|
|
12
|
+
* callers (and undo histories holding normalized snapshots) can detect no-ops by
|
|
13
|
+
* reference.
|
|
14
|
+
*/
|
|
15
|
+
export declare function normalizeProjectGraph(graph: ProjectGraph): ProjectGraph;
|
|
16
|
+
/** True when a tree is already container-normal (normalization would be a no-op). */
|
|
17
|
+
export declare function isContainerNormalized(root: ComponentNode): boolean;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { DEFAULT_SLOT } from './ids';
|
|
2
|
+
import { isLayoutContainerNode } from './container';
|
|
3
|
+
/**
|
|
4
|
+
* Layout-container normalization (EC-161, vision §3.1 / §6).
|
|
5
|
+
*
|
|
6
|
+
* Pure, graph-level functions — no UI, no store coupling — that keep container
|
|
7
|
+
* structure healthy after edits ("no wrapper soup after six months of editing"):
|
|
8
|
+
*
|
|
9
|
+
* 1. **Empty containers are removed.** A `Stack`/`Grid` whose `children` slot is
|
|
10
|
+
* empty disappears from its parent slot.
|
|
11
|
+
* 2. **Single-child containers dissolve in place.** The remaining child takes the
|
|
12
|
+
* container's position in the parent slot.
|
|
13
|
+
* 3. **Cascades resolve in one pass.** Normalization is bottom-up, so dissolving
|
|
14
|
+
* or removing an inner container can dissolve its (now single-child or empty)
|
|
15
|
+
* ancestors in the same call.
|
|
16
|
+
*
|
|
17
|
+
* Guard rails (deliberate non-rules):
|
|
18
|
+
* - **Roots are anchors.** A page/layout root is never dissolved or removed, even
|
|
19
|
+
* when it is an empty or single-child container — pages must keep a root, and
|
|
20
|
+
* the root's identity is stable for selection/undo.
|
|
21
|
+
* - **Conditional containers are meaningful wrappers.** A container carrying a
|
|
22
|
+
* render `condition` gates its children; dissolving it would drop the gate, so
|
|
23
|
+
* it is left intact.
|
|
24
|
+
* - **Foreign slot content is never dropped.** A container with nodes in any slot
|
|
25
|
+
* other than `children` is malformed (validation flags it) but normalization
|
|
26
|
+
* refuses to silently destroy content.
|
|
27
|
+
*
|
|
28
|
+
* Properties (tested): deterministic, identity-preserving on already-normal input
|
|
29
|
+
* (`normalize(g) === g`), and therefore idempotent
|
|
30
|
+
* (`normalize(normalize(g)) === normalize(g)`).
|
|
31
|
+
*/
|
|
32
|
+
/** True when any slot other than `children` holds nodes. */
|
|
33
|
+
function hasForeignSlotContent(node) {
|
|
34
|
+
return Object.entries(node.slots ?? {}).some(([slot, children]) => slot !== DEFAULT_SLOT && children.length > 0);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Decide how an already-normalized child node appears in its parent slot:
|
|
38
|
+
* `[]` removes it, `[child]` dissolves a single-child container in place, and
|
|
39
|
+
* `[node]` keeps it as-is.
|
|
40
|
+
*/
|
|
41
|
+
function resolveChild(node) {
|
|
42
|
+
if (!isLayoutContainerNode(node))
|
|
43
|
+
return [node];
|
|
44
|
+
if (node.condition)
|
|
45
|
+
return [node];
|
|
46
|
+
if (hasForeignSlotContent(node))
|
|
47
|
+
return [node];
|
|
48
|
+
const children = node.slots?.[DEFAULT_SLOT] ?? [];
|
|
49
|
+
if (children.length === 0)
|
|
50
|
+
return []; // rule 1: empty container removed
|
|
51
|
+
if (children.length === 1)
|
|
52
|
+
return [children[0]]; // rule 2: dissolve in place
|
|
53
|
+
return [node];
|
|
54
|
+
}
|
|
55
|
+
/** Bottom-up normalization of a node's slots. Returns the same reference when nothing changed. */
|
|
56
|
+
function normalizeNode(node) {
|
|
57
|
+
if (!node.slots)
|
|
58
|
+
return node;
|
|
59
|
+
let changed = false;
|
|
60
|
+
const slots = {};
|
|
61
|
+
for (const [slot, children] of Object.entries(node.slots)) {
|
|
62
|
+
let slotChanged = false;
|
|
63
|
+
const next = [];
|
|
64
|
+
for (const child of children) {
|
|
65
|
+
const normalized = normalizeNode(child);
|
|
66
|
+
const resolved = resolveChild(normalized);
|
|
67
|
+
if (normalized !== child || resolved.length !== 1 || resolved[0] !== child) {
|
|
68
|
+
slotChanged = true;
|
|
69
|
+
}
|
|
70
|
+
next.push(...resolved);
|
|
71
|
+
}
|
|
72
|
+
slots[slot] = slotChanged ? next : children;
|
|
73
|
+
if (slotChanged)
|
|
74
|
+
changed = true;
|
|
75
|
+
}
|
|
76
|
+
return changed ? { ...node, slots } : node;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Normalize the container structure of a page/layout tree. The root itself is the
|
|
80
|
+
* tree's anchor and is never dissolved or removed; its subtree is fully normalized.
|
|
81
|
+
* Returns the same root reference when the tree is already normal.
|
|
82
|
+
*/
|
|
83
|
+
export function normalizeContainers(root) {
|
|
84
|
+
return normalizeNode(root);
|
|
85
|
+
}
|
|
86
|
+
function normalizeLayout(layout) {
|
|
87
|
+
const root = normalizeContainers(layout.root);
|
|
88
|
+
return root === layout.root ? layout : { ...layout, root };
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Normalize every layout tree in a project graph (EC-187: layouts-only).
|
|
92
|
+
* Identity-preserving: returns the same graph reference when nothing changed, so
|
|
93
|
+
* callers (and undo histories holding normalized snapshots) can detect no-ops by
|
|
94
|
+
* reference.
|
|
95
|
+
*/
|
|
96
|
+
export function normalizeProjectGraph(graph) {
|
|
97
|
+
let changed = false;
|
|
98
|
+
const layouts = graph.layouts.map((layout) => {
|
|
99
|
+
const next = normalizeLayout(layout);
|
|
100
|
+
if (next !== layout)
|
|
101
|
+
changed = true;
|
|
102
|
+
return next;
|
|
103
|
+
});
|
|
104
|
+
return changed ? { ...graph, layouts } : graph;
|
|
105
|
+
}
|
|
106
|
+
/** True when a tree is already container-normal (normalization would be a no-op). */
|
|
107
|
+
export function isContainerNormalized(root) {
|
|
108
|
+
return normalizeContainers(root) === root;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=normalize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../src/project-graph/normalize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAGpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,4DAA4D;AAC5D,SAAS,qBAAqB,CAAC,IAAmB;IAChD,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAC1C,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,IAAI,KAAK,YAAY,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,CACnE,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,SAAS,YAAY,CAAC,IAAmB;IACvC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC;QAAE,OAAO,CAAC,IAAI,CAAC,CAAA;IAC/C,IAAI,IAAI,CAAC,SAAS;QAAE,OAAO,CAAC,IAAI,CAAC,CAAA;IACjC,IAAI,qBAAqB,CAAC,IAAI,CAAC;QAAE,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,CAAA;IACjD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAA,CAAC,kCAAkC;IACvE,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAE,CAAC,CAAA,CAAC,4BAA4B;IAC7E,OAAO,CAAC,IAAI,CAAC,CAAA;AACf,CAAC;AAED,kGAAkG;AAClG,SAAS,aAAa,CAAC,IAAmB;IACxC,IAAI,CAAC,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IAC5B,IAAI,OAAO,GAAG,KAAK,CAAA;IACnB,MAAM,KAAK,GAAoC,EAAE,CAAA;IACjD,KAAK,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1D,IAAI,WAAW,GAAG,KAAK,CAAA;QACvB,MAAM,IAAI,GAAoB,EAAE,CAAA;QAChC,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;YAC7B,MAAM,UAAU,GAAG,aAAa,CAAC,KAAK,CAAC,CAAA;YACvC,MAAM,QAAQ,GAAG,YAAY,CAAC,UAAU,CAAC,CAAA;YACzC,IAAI,UAAU,KAAK,KAAK,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC;gBAC3E,WAAW,GAAG,IAAI,CAAA;YACpB,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAA;QACxB,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAA;QAC3C,IAAI,WAAW;YAAE,OAAO,GAAG,IAAI,CAAA;IACjC,CAAC;IACD,OAAO,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AAC5C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAmB;IACrD,OAAO,aAAa,CAAC,IAAI,CAAC,CAAA;AAC5B,CAAC;AAED,SAAS,eAAe,CAAC,MAAc;IACrC,MAAM,IAAI,GAAG,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC7C,OAAO,IAAI,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,CAAA;AAC5D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAmB;IACvD,IAAI,OAAO,GAAG,KAAK,CAAA;IACnB,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;QAC3C,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,CAAC,CAAA;QACpC,IAAI,IAAI,KAAK,MAAM;YAAE,OAAO,GAAG,IAAI,CAAA;QACnC,OAAO,IAAI,CAAA;IACb,CAAC,CAAC,CAAA;IACF,OAAO,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;AAChD,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,qBAAqB,CAAC,IAAmB;IACvD,OAAO,mBAAmB,CAAC,IAAI,CAAC,KAAK,IAAI,CAAA;AAC3C,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { ProjectGraph } from './structure';
|
|
3
|
+
import type { ComponentNode } from './node';
|
|
4
|
+
/**
|
|
5
|
+
* Serialize a project graph to JSON. Parsing first guarantees the output contains no
|
|
6
|
+
* runtime-only values and that defaults are applied (brief §7.1).
|
|
7
|
+
*/
|
|
8
|
+
export declare function serializeProjectGraph(graph: ProjectGraph): string;
|
|
9
|
+
export type ParseResult = {
|
|
10
|
+
ok: true;
|
|
11
|
+
graph: ProjectGraph;
|
|
12
|
+
} | {
|
|
13
|
+
ok: false;
|
|
14
|
+
error: z.ZodError;
|
|
15
|
+
};
|
|
16
|
+
/** Parse a project graph from a JSON string or already-parsed value. Never throws on invalid input. */
|
|
17
|
+
export declare function parseProjectGraph(input: string | unknown): ParseResult;
|
|
18
|
+
/** True if the graph's schema version matches the version this package understands. */
|
|
19
|
+
export declare function isCompatibleSchemaVersion(graph: ProjectGraph): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Serialize a composition **field value** (EC-186, AD-12) — a single
|
|
22
|
+
* `ComponentNode` tree, not a whole graph. Parsing first applies defaults and
|
|
23
|
+
* strips runtime-only values, exactly like {@link serializeProjectGraph}. A
|
|
24
|
+
* field value is an untethered tree (no `schemaVersion` wrapper); revisions ride
|
|
25
|
+
* the document that holds it.
|
|
26
|
+
*/
|
|
27
|
+
export declare function serializeComponentNode(node: ComponentNode): string;
|
|
28
|
+
export type ParseNodeResult = {
|
|
29
|
+
ok: true;
|
|
30
|
+
node: ComponentNode;
|
|
31
|
+
} | {
|
|
32
|
+
ok: false;
|
|
33
|
+
error: z.ZodError;
|
|
34
|
+
};
|
|
35
|
+
/** Parse a composition field value from a JSON string or value. Never throws on invalid input. */
|
|
36
|
+
export declare function parseComponentNode(input: string | unknown): ParseNodeResult;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { PROJECT_GRAPH_SCHEMA_VERSION, projectGraphSchema } from './structure';
|
|
2
|
+
import { componentNodeSchema } from './node';
|
|
3
|
+
/**
|
|
4
|
+
* Serialize a project graph to JSON. Parsing first guarantees the output contains no
|
|
5
|
+
* runtime-only values and that defaults are applied (brief §7.1).
|
|
6
|
+
*/
|
|
7
|
+
export function serializeProjectGraph(graph) {
|
|
8
|
+
const parsed = projectGraphSchema.parse(graph);
|
|
9
|
+
return JSON.stringify(parsed);
|
|
10
|
+
}
|
|
11
|
+
/** Parse a project graph from a JSON string or already-parsed value. Never throws on invalid input. */
|
|
12
|
+
export function parseProjectGraph(input) {
|
|
13
|
+
let json;
|
|
14
|
+
try {
|
|
15
|
+
json = typeof input === 'string' ? JSON.parse(input) : input;
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
// Treat malformed JSON the same as a failed schema parse of `undefined`.
|
|
19
|
+
json = undefined;
|
|
20
|
+
}
|
|
21
|
+
const result = projectGraphSchema.safeParse(json);
|
|
22
|
+
return result.success ? { ok: true, graph: result.data } : { ok: false, error: result.error };
|
|
23
|
+
}
|
|
24
|
+
/** True if the graph's schema version matches the version this package understands. */
|
|
25
|
+
export function isCompatibleSchemaVersion(graph) {
|
|
26
|
+
return graph.schemaVersion === PROJECT_GRAPH_SCHEMA_VERSION;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Serialize a composition **field value** (EC-186, AD-12) — a single
|
|
30
|
+
* `ComponentNode` tree, not a whole graph. Parsing first applies defaults and
|
|
31
|
+
* strips runtime-only values, exactly like {@link serializeProjectGraph}. A
|
|
32
|
+
* field value is an untethered tree (no `schemaVersion` wrapper); revisions ride
|
|
33
|
+
* the document that holds it.
|
|
34
|
+
*/
|
|
35
|
+
export function serializeComponentNode(node) {
|
|
36
|
+
const parsed = componentNodeSchema.parse(node);
|
|
37
|
+
return JSON.stringify(parsed);
|
|
38
|
+
}
|
|
39
|
+
/** Parse a composition field value from a JSON string or value. Never throws on invalid input. */
|
|
40
|
+
export function parseComponentNode(input) {
|
|
41
|
+
let json;
|
|
42
|
+
try {
|
|
43
|
+
json = typeof input === 'string' ? JSON.parse(input) : input;
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
json = undefined;
|
|
47
|
+
}
|
|
48
|
+
const result = componentNodeSchema.safeParse(json);
|
|
49
|
+
return result.success ? { ok: true, node: result.data } : { ok: false, error: result.error };
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=serialize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialize.js","sourceRoot":"","sources":["../../src/project-graph/serialize.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAE9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAA;AAG5C;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAmB;IACvD,MAAM,MAAM,GAAG,kBAAkB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IAC9C,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;AAC/B,CAAC;AAMD,uGAAuG;AACvG,MAAM,UAAU,iBAAiB,CAAC,KAAuB;IACvD,IAAI,IAAa,CAAA;IACjB,IAAI,CAAC;QACH,IAAI,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;IAC9D,CAAC;IAAC,MAAM,CAAC;QACP,yEAAyE;QACzE,IAAI,GAAG,SAAS,CAAA;IAClB,CAAC;IACD,MAAM,MAAM,GAAG,kBAAkB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IACjD,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAA;AAC/F,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,yBAAyB,CAAC,KAAmB;IAC3D,OAAO,KAAK,CAAC,aAAa,KAAK,4BAA4B,CAAA;AAC7D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAmB;IACxD,MAAM,MAAM,GAAG,mBAAmB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAC9C,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;AAC/B,CAAC;AAMD,kGAAkG;AAClG,MAAM,UAAU,kBAAkB,CAAC,KAAuB;IACxD,IAAI,IAAa,CAAA;IACjB,IAAI,CAAC;QACH,IAAI,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;IAC9D,CAAC;IAAC,MAAM,CAAC;QACP,IAAI,GAAG,SAAS,CAAA;IAClB,CAAC;IACD,MAAM,MAAM,GAAG,mBAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IAClD,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAA;AAC9F,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* A shared layout wrapper. Its root tree contains an `outlet` slot where a page
|
|
4
|
+
* composition renders (EC-187). Layouts are the dev-frame scaffolding — they
|
|
5
|
+
* change rarely and remain in the canonical graph; pages moved OUT of the graph
|
|
6
|
+
* into `page`-collection documents (their `body` is a composition field value).
|
|
7
|
+
*/
|
|
8
|
+
export declare const layoutSchema: z.ZodObject<{
|
|
9
|
+
id: z.ZodString;
|
|
10
|
+
name: z.ZodString;
|
|
11
|
+
root: z.ZodType<import("./node").ComponentNode, unknown, z.core.$ZodTypeInternals<import("./node").ComponentNode, unknown>>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export type Layout = z.infer<typeof layoutSchema>;
|
|
14
|
+
/**
|
|
15
|
+
* Schema version 2 (EC-187): the graph is LAYOUTS-ONLY. Version 1 carried a
|
|
16
|
+
* `pages` array (page-as-graph-node); v2 removes it — a page is now a document
|
|
17
|
+
* in the `page` collection whose `body` composition renders into a layout via
|
|
18
|
+
* `renderCompositionInLayout`. A deployment NOT reseeded to v2 serves a null
|
|
19
|
+
* graph, so the host degrades to its visible fallback rather than crashing.
|
|
20
|
+
*/
|
|
21
|
+
export declare const PROJECT_GRAPH_SCHEMA_VERSION = 2;
|
|
22
|
+
/**
|
|
23
|
+
* The canonical project graph — LAYOUTS-ONLY (EC-187). The single source of
|
|
24
|
+
* truth for the dev-frame layout scaffolding; page content lives in the `page`
|
|
25
|
+
* collection.
|
|
26
|
+
*/
|
|
27
|
+
export declare const projectGraphSchema: z.ZodObject<{
|
|
28
|
+
id: z.ZodString;
|
|
29
|
+
schemaVersion: z.ZodNumber;
|
|
30
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
31
|
+
name: z.ZodOptional<z.ZodString>;
|
|
32
|
+
}, z.core.$strip>>;
|
|
33
|
+
settingsRef: z.ZodOptional<z.ZodString>;
|
|
34
|
+
layouts: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
35
|
+
id: z.ZodString;
|
|
36
|
+
name: z.ZodString;
|
|
37
|
+
root: z.ZodType<import("./node").ComponentNode, unknown, z.core.$ZodTypeInternals<import("./node").ComponentNode, unknown>>;
|
|
38
|
+
}, z.core.$strip>>>;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
export type ProjectGraph = z.infer<typeof projectGraphSchema>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { idSchema } from './ids';
|
|
3
|
+
import { componentNodeSchema } from './node';
|
|
4
|
+
/**
|
|
5
|
+
* A shared layout wrapper. Its root tree contains an `outlet` slot where a page
|
|
6
|
+
* composition renders (EC-187). Layouts are the dev-frame scaffolding — they
|
|
7
|
+
* change rarely and remain in the canonical graph; pages moved OUT of the graph
|
|
8
|
+
* into `page`-collection documents (their `body` is a composition field value).
|
|
9
|
+
*/
|
|
10
|
+
export const layoutSchema = z.object({
|
|
11
|
+
id: idSchema,
|
|
12
|
+
name: z.string().min(1),
|
|
13
|
+
root: componentNodeSchema,
|
|
14
|
+
});
|
|
15
|
+
/**
|
|
16
|
+
* Schema version 2 (EC-187): the graph is LAYOUTS-ONLY. Version 1 carried a
|
|
17
|
+
* `pages` array (page-as-graph-node); v2 removes it — a page is now a document
|
|
18
|
+
* in the `page` collection whose `body` composition renders into a layout via
|
|
19
|
+
* `renderCompositionInLayout`. A deployment NOT reseeded to v2 serves a null
|
|
20
|
+
* graph, so the host degrades to its visible fallback rather than crashing.
|
|
21
|
+
*/
|
|
22
|
+
export const PROJECT_GRAPH_SCHEMA_VERSION = 2;
|
|
23
|
+
/**
|
|
24
|
+
* The canonical project graph — LAYOUTS-ONLY (EC-187). The single source of
|
|
25
|
+
* truth for the dev-frame layout scaffolding; page content lives in the `page`
|
|
26
|
+
* collection.
|
|
27
|
+
*/
|
|
28
|
+
export const projectGraphSchema = z.object({
|
|
29
|
+
id: idSchema,
|
|
30
|
+
schemaVersion: z.number().int().nonnegative(),
|
|
31
|
+
metadata: z.object({ name: z.string().optional() }).optional(),
|
|
32
|
+
/** Link to project settings owned by studio-core. */
|
|
33
|
+
settingsRef: idSchema.optional(),
|
|
34
|
+
layouts: z.array(layoutSchema).default([]),
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=structure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structure.js","sourceRoot":"","sources":["../../src/project-graph/structure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAA;AAE5C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,EAAE,EAAE,QAAQ;IACZ,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,IAAI,EAAE,mBAAmB;CAC1B,CAAC,CAAA;AAGF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAA;AAE7C;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,EAAE,EAAE,QAAQ;IACZ,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IAC7C,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC9D,qDAAqD;IACrD,WAAW,EAAE,QAAQ,CAAC,QAAQ,EAAE;IAChC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;CAC3C,CAAC,CAAA"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { ComponentNode } from './node';
|
|
2
|
+
import type { ValidationIssue } from './issues';
|
|
3
|
+
import type { ProjectGraph } from './structure';
|
|
4
|
+
/**
|
|
5
|
+
* Structural views of a component manifest, supplied by the registry. The graph
|
|
6
|
+
* package depends only on these shapes (not on `@elytracms/core/component-registry`) so it
|
|
7
|
+
* stays free of cycles. The registry's Manifest satisfies these structurally.
|
|
8
|
+
*/
|
|
9
|
+
export interface PropView {
|
|
10
|
+
/** Whether this prop accepts a binding. Defaults to allowed when omitted. */
|
|
11
|
+
bindable?: boolean;
|
|
12
|
+
/** Optional static-value validator (typically backed by the manifest's Zod schema). */
|
|
13
|
+
validate?: (value: unknown) => boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface SlotView {
|
|
16
|
+
name: string;
|
|
17
|
+
required?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Allowed child component ids (EC-186). Omit to allow any registered
|
|
20
|
+
* component; when present, a child whose `componentId` is not listed is a
|
|
21
|
+
* `forbidden-component` error. Mirrors the registry's `SlotSpec.allow`.
|
|
22
|
+
*/
|
|
23
|
+
allow?: readonly string[];
|
|
24
|
+
}
|
|
25
|
+
export interface ManifestView {
|
|
26
|
+
id: string;
|
|
27
|
+
props?: Record<string, PropView>;
|
|
28
|
+
slots?: SlotView[];
|
|
29
|
+
/**
|
|
30
|
+
* Canvas-eligibility (EC-191). `false` marks a server-only / RSC component that
|
|
31
|
+
* is NOT client-renderable, so it may not appear in an editor composition (the
|
|
32
|
+
* canvas is client-rendered). Omitted/true = canvas-eligible. Only enforced when
|
|
33
|
+
* `requireCanvasEligible` is set (i.e. validating a composition value, not a
|
|
34
|
+
* dev-authored page/layout frame).
|
|
35
|
+
*/
|
|
36
|
+
clientRenderable?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface ComponentLookup {
|
|
39
|
+
has(componentId: string): boolean;
|
|
40
|
+
get(componentId: string): ManifestView | undefined;
|
|
41
|
+
}
|
|
42
|
+
export interface ValidateOptions {
|
|
43
|
+
/** When provided, component existence + prop/slot rules are checked. */
|
|
44
|
+
components?: ComponentLookup;
|
|
45
|
+
/** When provided, bindings are checked against the set of known data-source ids. */
|
|
46
|
+
knownSourceIds?: ReadonlySet<string>;
|
|
47
|
+
/**
|
|
48
|
+
* Require every node to be canvas-eligible (EC-191): a server-only component
|
|
49
|
+
* (`clientRenderable === false`) is a `server-only-component` error. Set by
|
|
50
|
+
* `validateCompositionValue` (editor compositions are client-rendered); off for
|
|
51
|
+
* `validateProjectGraph` (dev frames may render RSC components).
|
|
52
|
+
*/
|
|
53
|
+
requireCanvasEligible?: boolean;
|
|
54
|
+
}
|
|
55
|
+
/** Validate a project graph, returning structured issues (never throws on a parsed graph). */
|
|
56
|
+
export declare function validateProjectGraph(graph: ProjectGraph, opts?: ValidateOptions): ValidationIssue[];
|
|
57
|
+
/**
|
|
58
|
+
* Validate a single component-node tree (EC-186, AD-12) — a composition **field
|
|
59
|
+
* value**, not a whole graph. Reuses the exact node-tree walk
|
|
60
|
+
* {@link validateProjectGraph} uses (component/prop/slot/container/binding rules
|
|
61
|
+
* + slot `allow` placement), but applies none of the graph-level invariants
|
|
62
|
+
* (layout refs, route conflicts). Node ids are checked for duplicates within
|
|
63
|
+
* this tree only.
|
|
64
|
+
*/
|
|
65
|
+
export declare function validateComponentNode(node: ComponentNode, opts?: ValidateOptions): ValidationIssue[];
|
|
66
|
+
export interface CompositionValidateOptions extends ValidateOptions {
|
|
67
|
+
/**
|
|
68
|
+
* The composition field's allowed vocabulary (EC-186): component ids permitted
|
|
69
|
+
* as TOP-LEVEL blocks of the value. Omit to allow any registered component;
|
|
70
|
+
* deeper nesting is governed by slot `allow`. A top-level node outside the set
|
|
71
|
+
* is a `forbidden-component` error.
|
|
72
|
+
*/
|
|
73
|
+
allow?: readonly string[];
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Validate a composition **field value** (EC-186, AD-12): one root node
|
|
77
|
+
* (`cardinality: 'one'`) or an ordered list (`'many'`). Each root is validated as
|
|
78
|
+
* a component-node tree; the field's `allow` restricts the top-level vocabulary;
|
|
79
|
+
* duplicate node ids are checked across the whole value. The registry + `allow`
|
|
80
|
+
* are code (the leash); the tree is data.
|
|
81
|
+
*/
|
|
82
|
+
export declare function validateCompositionValue(value: ComponentNode | readonly ComponentNode[], opts?: CompositionValidateOptions): ValidationIssue[];
|
|
83
|
+
/** True if the graph has no error-severity issues. */
|
|
84
|
+
export declare function isGraphValid(issues: ValidationIssue[]): boolean;
|