@conloca/astro-cms 0.1.16 → 0.2.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/README.md +254 -301
- package/dist/internal/acorn-default.mjs +11 -3
- package/dist/internal/page-handler.astro +137 -358
- package/dist/ts/node/content.d.ts +4 -0
- package/dist/ts/node/content.d.ts.map +1 -0
- package/dist/ts/node/content.js +3 -0
- package/dist/ts/node/content.js.map +1 -0
- package/dist/ts/node/index.d.ts +9 -0
- package/dist/ts/node/index.d.ts.map +1 -0
- package/dist/ts/node/index.js +14 -0
- package/dist/ts/node/index.js.map +1 -0
- package/dist/ts/src/asset-ref-base.d.ts +3 -0
- package/dist/ts/src/asset-ref-base.d.ts.map +1 -0
- package/dist/ts/src/asset-ref-base.js +48 -0
- package/dist/ts/src/asset-ref-base.js.map +1 -0
- package/dist/ts/src/checks.d.ts +7 -0
- package/dist/ts/src/checks.d.ts.map +1 -0
- package/dist/ts/src/checks.js +7 -0
- package/dist/ts/src/checks.js.map +1 -0
- package/dist/{src → ts/src}/cms-handler.d.ts +0 -1
- package/dist/ts/src/cms-handler.d.ts.map +1 -0
- package/dist/{src → ts/src}/cms-handler.js +11 -131
- package/dist/ts/src/cms-handler.js.map +1 -0
- package/dist/ts/src/collections.d.ts +161 -0
- package/dist/ts/src/collections.d.ts.map +1 -0
- package/dist/ts/src/collections.js +178 -0
- package/dist/ts/src/collections.js.map +1 -0
- package/dist/{src → ts/src}/components/HydrationWrapper.d.ts +1 -1
- package/dist/ts/src/components/HydrationWrapper.d.ts.map +1 -0
- package/dist/{src → ts/src}/components/HydrationWrapper.js +1 -0
- package/dist/ts/src/components/HydrationWrapper.js.map +1 -0
- package/dist/{src/components/RenderWithBlocks.d.ts → ts/src/components/RenderWithFragments.d.ts} +8 -4
- package/dist/ts/src/components/RenderWithFragments.d.ts.map +1 -0
- package/dist/ts/src/components/RenderWithFragments.js +133 -0
- package/dist/ts/src/components/RenderWithFragments.js.map +1 -0
- package/dist/{src → ts/src}/components/RenderWithHydration.d.ts +6 -2
- package/dist/ts/src/components/RenderWithHydration.d.ts.map +1 -0
- package/dist/{src → ts/src}/components/RenderWithHydration.js +6 -3
- package/dist/ts/src/components/RenderWithHydration.js.map +1 -0
- package/dist/ts/src/components.d.ts +4 -0
- package/dist/ts/src/components.d.ts.map +1 -0
- package/dist/ts/src/components.js +4 -0
- package/dist/ts/src/components.js.map +1 -0
- package/dist/ts/src/discovery/astro-frontmatter.d.ts.map +1 -0
- package/dist/{src → ts/src}/discovery/astro-frontmatter.js +1 -0
- package/dist/ts/src/discovery/astro-frontmatter.js.map +1 -0
- package/dist/ts/src/discovery/discover.d.ts +43 -0
- package/dist/ts/src/discovery/discover.d.ts.map +1 -0
- package/dist/ts/src/discovery/discover.js +87 -0
- package/dist/ts/src/discovery/discover.js.map +1 -0
- package/dist/ts/src/discovery/extract-props-ts.d.ts.map +1 -0
- package/dist/{src → ts/src}/discovery/extract-props-ts.js +1 -0
- package/dist/ts/src/discovery/extract-props-ts.js.map +1 -0
- package/dist/{src → ts/src}/discovery/merge-registry.d.ts +3 -3
- package/dist/ts/src/discovery/merge-registry.d.ts.map +1 -0
- package/dist/{src → ts/src}/discovery/merge-registry.js +1 -0
- package/dist/ts/src/discovery/merge-registry.js.map +1 -0
- package/dist/ts/src/discovery/registry-endpoint.d.ts +27 -0
- package/dist/ts/src/discovery/registry-endpoint.d.ts.map +1 -0
- package/dist/ts/src/discovery/registry-endpoint.js +76 -0
- package/dist/ts/src/discovery/registry-endpoint.js.map +1 -0
- package/dist/{src → ts/src}/discovery/scan-components.d.ts +3 -7
- package/dist/ts/src/discovery/scan-components.d.ts.map +1 -0
- package/dist/{src → ts/src}/discovery/scan-components.js +4 -6
- package/dist/ts/src/discovery/scan-components.js.map +1 -0
- package/dist/ts/src/discovery/scan-mdx.d.ts.map +1 -0
- package/dist/{src → ts/src}/discovery/scan-mdx.js +1 -0
- package/dist/ts/src/discovery/scan-mdx.js.map +1 -0
- package/dist/ts/src/discovery/scan-overrides.d.ts.map +1 -0
- package/dist/{src → ts/src}/discovery/scan-overrides.js +1 -0
- package/dist/ts/src/discovery/scan-overrides.js.map +1 -0
- package/dist/ts/src/editor-descriptors.d.ts +31 -0
- package/dist/ts/src/editor-descriptors.d.ts.map +1 -0
- package/dist/ts/src/editor-descriptors.js +84 -0
- package/dist/ts/src/editor-descriptors.js.map +1 -0
- package/dist/ts/src/handlers/collection-content-api.d.ts +32 -0
- package/dist/ts/src/handlers/collection-content-api.d.ts.map +1 -0
- package/dist/ts/src/handlers/collection-content-api.js +166 -0
- package/dist/ts/src/handlers/collection-content-api.js.map +1 -0
- package/dist/ts/src/handlers/page-render-core.d.ts +137 -0
- package/dist/ts/src/handlers/page-render-core.d.ts.map +1 -0
- package/dist/ts/src/handlers/page-render-core.js +315 -0
- package/dist/ts/src/handlers/page-render-core.js.map +1 -0
- package/dist/ts/src/hydration.d.ts.map +1 -0
- package/dist/{src → ts/src}/hydration.js +1 -0
- package/dist/ts/src/hydration.js.map +1 -0
- package/dist/ts/src/index.d.ts +21 -0
- package/dist/ts/src/index.d.ts.map +1 -0
- package/dist/ts/src/index.js +45 -0
- package/dist/ts/src/index.js.map +1 -0
- package/dist/ts/src/internal/declared-collections.d.ts +30 -0
- package/dist/ts/src/internal/declared-collections.d.ts.map +1 -0
- package/dist/ts/src/internal/declared-collections.js +84 -0
- package/dist/ts/src/internal/declared-collections.js.map +1 -0
- package/dist/ts/src/internal/page-collection-schema.d.ts +44 -0
- package/dist/ts/src/internal/page-collection-schema.d.ts.map +1 -0
- package/dist/ts/src/internal/page-collection-schema.js +152 -0
- package/dist/ts/src/internal/page-collection-schema.js.map +1 -0
- package/dist/ts/src/lib/content-config-guard.d.ts +13 -0
- package/dist/ts/src/lib/content-config-guard.d.ts.map +1 -0
- package/dist/ts/src/lib/content-config-guard.js +45 -0
- package/dist/ts/src/lib/content-config-guard.js.map +1 -0
- package/dist/ts/src/lib/hydration-scanner.d.ts.map +1 -0
- package/dist/{src → ts/src}/lib/hydration-scanner.js +1 -0
- package/dist/ts/src/lib/hydration-scanner.js.map +1 -0
- package/dist/ts/src/lib/hydration-script.d.ts.map +1 -0
- package/dist/{src → ts/src}/lib/hydration-script.js +1 -0
- package/dist/ts/src/lib/hydration-script.js.map +1 -0
- package/dist/ts/src/lib/hydration-utils.d.ts.map +1 -0
- package/dist/{src → ts/src}/lib/hydration-utils.js +1 -0
- package/dist/ts/src/lib/hydration-utils.js.map +1 -0
- package/dist/ts/src/lib/resolve-locale.d.ts +15 -0
- package/dist/ts/src/lib/resolve-locale.d.ts.map +1 -0
- package/dist/ts/src/lib/resolve-locale.js +16 -0
- package/dist/ts/src/lib/resolve-locale.js.map +1 -0
- package/dist/ts/src/lib/resolve-site-name.d.ts +8 -0
- package/dist/ts/src/lib/resolve-site-name.d.ts.map +1 -0
- package/dist/ts/src/lib/resolve-site-name.js +12 -0
- package/dist/ts/src/lib/resolve-site-name.js.map +1 -0
- package/dist/{src → ts/src}/lib/route-utils.d.ts +26 -6
- package/dist/ts/src/lib/route-utils.d.ts.map +1 -0
- package/dist/{src → ts/src}/lib/route-utils.js +33 -15
- package/dist/ts/src/lib/route-utils.js.map +1 -0
- package/dist/{src → ts/src}/lib/routing-config.d.ts +7 -1
- package/dist/ts/src/lib/routing-config.d.ts.map +1 -0
- package/dist/{src → ts/src}/lib/routing-config.js +13 -0
- package/dist/ts/src/lib/routing-config.js.map +1 -0
- package/dist/ts/src/lib/serialize-props.d.ts.map +1 -0
- package/dist/{src → ts/src}/lib/serialize-props.js +1 -0
- package/dist/ts/src/lib/serialize-props.js.map +1 -0
- package/dist/ts/src/lib/unknown-components.d.ts +21 -0
- package/dist/ts/src/lib/unknown-components.d.ts.map +1 -0
- package/dist/ts/src/lib/unknown-components.js +49 -0
- package/dist/ts/src/lib/unknown-components.js.map +1 -0
- package/dist/{src → ts/src}/lib/virtual-module-generators.d.ts +0 -24
- package/dist/ts/src/lib/virtual-module-generators.d.ts.map +1 -0
- package/dist/ts/src/lib/virtual-module-generators.js +51 -0
- package/dist/ts/src/lib/virtual-module-generators.js.map +1 -0
- package/dist/ts/src/lib/withHydration.d.ts.map +1 -0
- package/dist/{src → ts/src}/lib/withHydration.js +1 -0
- package/dist/ts/src/lib/withHydration.js.map +1 -0
- package/dist/ts/src/loader.d.ts +27 -0
- package/dist/ts/src/loader.d.ts.map +1 -0
- package/dist/{src → ts/src}/loader.js +33 -4
- package/dist/ts/src/loader.js.map +1 -0
- package/dist/ts/src/locales-helpers.d.ts.map +1 -0
- package/dist/{src → ts/src}/locales-helpers.js +1 -0
- package/dist/ts/src/locales-helpers.js.map +1 -0
- package/dist/ts/src/mime-types.d.ts.map +1 -0
- package/dist/{src → ts/src}/mime-types.js +1 -0
- package/dist/ts/src/mime-types.js.map +1 -0
- package/dist/ts/src/page-feed.d.ts +13 -0
- package/dist/ts/src/page-feed.d.ts.map +1 -0
- package/dist/ts/src/page-feed.js +20 -0
- package/dist/ts/src/page-feed.js.map +1 -0
- package/dist/ts/src/page-schemas.d.ts +6 -0
- package/dist/ts/src/page-schemas.d.ts.map +1 -0
- package/dist/ts/src/page-schemas.js +6 -0
- package/dist/ts/src/page-schemas.js.map +1 -0
- package/dist/ts/src/path-validation.d.ts.map +1 -0
- package/dist/{src → ts/src}/path-validation.js +1 -0
- package/dist/ts/src/path-validation.js.map +1 -0
- package/dist/{src → ts/src}/plugin-spa.d.ts +28 -10
- package/dist/ts/src/plugin-spa.d.ts.map +1 -0
- package/dist/{src → ts/src}/plugin-spa.js +301 -88
- package/dist/ts/src/plugin-spa.js.map +1 -0
- package/dist/ts/src/puck-manifest/components-endpoint.d.ts +30 -0
- package/dist/ts/src/puck-manifest/components-endpoint.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/components-endpoint.js +54 -0
- package/dist/ts/src/puck-manifest/components-endpoint.js.map +1 -0
- package/dist/ts/src/puck-manifest/field-projection.d.ts +91 -0
- package/dist/ts/src/puck-manifest/field-projection.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/field-projection.js +422 -0
- package/dist/ts/src/puck-manifest/field-projection.js.map +1 -0
- package/dist/ts/src/puck-manifest/index.d.ts +4 -0
- package/dist/ts/src/puck-manifest/index.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/index.js +3 -0
- package/dist/ts/src/puck-manifest/index.js.map +1 -0
- package/dist/ts/src/puck-manifest/literal.d.ts +163 -0
- package/dist/ts/src/puck-manifest/literal.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/literal.js +354 -0
- package/dist/ts/src/puck-manifest/literal.js.map +1 -0
- package/dist/ts/src/puck-manifest/read-config.d.ts +42 -0
- package/dist/ts/src/puck-manifest/read-config.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/read-config.js +517 -0
- package/dist/ts/src/puck-manifest/read-config.js.map +1 -0
- package/dist/ts/src/puck-manifest/read-field.d.ts +7 -0
- package/dist/ts/src/puck-manifest/read-field.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/read-field.js +11 -0
- package/dist/ts/src/puck-manifest/read-field.js.map +1 -0
- package/dist/ts/src/puck-manifest/read-wrapper.d.ts +147 -0
- package/dist/ts/src/puck-manifest/read-wrapper.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/read-wrapper.js +889 -0
- package/dist/ts/src/puck-manifest/read-wrapper.js.map +1 -0
- package/dist/ts/src/puck-manifest/reading-budget.d.ts +50 -0
- package/dist/ts/src/puck-manifest/reading-budget.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/reading-budget.js +113 -0
- package/dist/ts/src/puck-manifest/reading-budget.js.map +1 -0
- package/dist/ts/src/puck-manifest/resolve-reference.d.ts +4 -0
- package/dist/ts/src/puck-manifest/resolve-reference.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/resolve-reference.js +4 -0
- package/dist/ts/src/puck-manifest/resolve-reference.js.map +1 -0
- package/dist/ts/src/puck-manifest/source-reference.d.ts +96 -0
- package/dist/ts/src/puck-manifest/source-reference.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/source-reference.js +424 -0
- package/dist/ts/src/puck-manifest/source-reference.js.map +1 -0
- package/dist/ts/src/puck-manifest/syntax.d.ts +29 -0
- package/dist/ts/src/puck-manifest/syntax.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/syntax.js +79 -0
- package/dist/ts/src/puck-manifest/syntax.js.map +1 -0
- package/dist/ts/src/puck-manifest/types.d.ts +145 -0
- package/dist/ts/src/puck-manifest/types.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/types.js +2 -0
- package/dist/ts/src/puck-manifest/types.js.map +1 -0
- package/dist/ts/src/safe-json-stringify.d.ts.map +1 -0
- package/dist/{src → ts/src}/safe-json-stringify.js +1 -0
- package/dist/ts/src/safe-json-stringify.js.map +1 -0
- package/dist/ts/src/sandbox-frame-handler.d.ts +19 -0
- package/dist/ts/src/sandbox-frame-handler.d.ts.map +1 -0
- package/dist/ts/src/sandbox-frame-handler.js +27 -0
- package/dist/ts/src/sandbox-frame-handler.js.map +1 -0
- package/dist/{src → ts/src}/site-styles/content-wrapper-endpoint.d.ts +2 -5
- package/dist/ts/src/site-styles/content-wrapper-endpoint.d.ts.map +1 -0
- package/dist/{src → ts/src}/site-styles/content-wrapper-endpoint.js +5 -8
- package/dist/ts/src/site-styles/content-wrapper-endpoint.js.map +1 -0
- package/dist/{src → ts/src}/site-styles/render-endpoint.d.ts +4 -9
- package/dist/ts/src/site-styles/render-endpoint.d.ts.map +1 -0
- package/dist/{src → ts/src}/site-styles/render-endpoint.js +1 -0
- package/dist/ts/src/site-styles/render-endpoint.js.map +1 -0
- package/dist/{src → ts/src}/site-styles/styles-endpoint.d.ts +2 -4
- package/dist/ts/src/site-styles/styles-endpoint.d.ts.map +1 -0
- package/dist/{src → ts/src}/site-styles/styles-endpoint.js +3 -5
- package/dist/ts/src/site-styles/styles-endpoint.js.map +1 -0
- package/dist/ts/src/sitemap-options.d.ts +21 -0
- package/dist/ts/src/sitemap-options.d.ts.map +1 -0
- package/dist/ts/src/sitemap-options.js +92 -0
- package/dist/ts/src/sitemap-options.js.map +1 -0
- package/dist/ts/src/tiptap-html-static.d.ts +16 -0
- package/dist/ts/src/tiptap-html-static.d.ts.map +1 -0
- package/dist/ts/src/tiptap-html-static.js +117 -0
- package/dist/ts/src/tiptap-html-static.js.map +1 -0
- package/dist/{src → ts/src}/types.d.ts +26 -110
- package/dist/ts/src/types.d.ts.map +1 -0
- package/dist/ts/src/types.js +2 -0
- package/dist/ts/src/types.js.map +1 -0
- package/dist/virtual-modules.d.ts +12 -93
- package/node/content.ts +14 -0
- package/node/index.ts +22 -0
- package/package.json +161 -73
- package/src/asset-ref-base.ts +48 -0
- package/src/checks.ts +11 -0
- package/src/cms-handler.ts +281 -0
- package/src/collections.ts +271 -0
- package/src/components/HydrationWrapper.tsx +41 -0
- package/src/components/RenderWithFragments.tsx +204 -0
- package/src/components/RenderWithHydration.tsx +55 -0
- package/src/components.ts +3 -0
- package/src/discovery/astro-frontmatter.ts +24 -0
- package/src/discovery/discover.ts +108 -0
- package/src/discovery/extract-props-ts.ts +255 -0
- package/src/discovery/merge-registry.ts +411 -0
- package/src/discovery/registry-endpoint.ts +80 -0
- package/src/discovery/scan-components.ts +458 -0
- package/src/discovery/scan-mdx.ts +190 -0
- package/src/discovery/scan-overrides.ts +92 -0
- package/src/editor-descriptors.ts +96 -0
- package/src/env.d.ts +31 -0
- package/src/handlers/collection-content-api.ts +196 -0
- package/src/handlers/page-handler.astro +320 -0
- package/src/handlers/page-render-core.ts +456 -0
- package/src/hydration.ts +7 -0
- package/src/index.ts +111 -0
- package/src/internal/acorn-default.mjs +37 -0
- package/src/internal/declared-collections.ts +98 -0
- package/src/internal/page-collection-schema.ts +210 -0
- package/src/lib/content-config-guard.ts +53 -0
- package/src/lib/hydration-scanner.ts +176 -0
- package/src/lib/hydration-script.ts +126 -0
- package/src/lib/hydration-utils.ts +120 -0
- package/src/lib/resolve-locale.ts +22 -0
- package/src/lib/resolve-site-name.ts +10 -0
- package/src/lib/route-utils.ts +106 -0
- package/src/lib/routing-config.ts +126 -0
- package/src/lib/serialize-props.ts +7 -0
- package/src/lib/unknown-components.ts +64 -0
- package/src/lib/virtual-module-generators.ts +58 -0
- package/{dist/withHydration-DkKpkmzJ.d.mts → src/lib/withHydration.ts} +25 -8
- package/src/loader.ts +145 -0
- package/{dist/locales-helpers-BvYYqnJ5.d.mts → src/locales-helpers.ts} +21 -17
- package/src/mime-types.ts +19 -0
- package/src/page-feed.ts +26 -0
- package/src/page-schemas.ts +19 -0
- package/src/path-validation.ts +13 -0
- package/src/plugin-spa.ts +1496 -0
- package/src/puck-manifest/components-endpoint.ts +55 -0
- package/src/puck-manifest/field-projection.ts +510 -0
- package/src/puck-manifest/index.ts +3 -0
- package/src/puck-manifest/literal.ts +459 -0
- package/src/puck-manifest/read-config.ts +577 -0
- package/src/puck-manifest/read-field.ts +19 -0
- package/src/puck-manifest/read-wrapper.ts +1056 -0
- package/src/puck-manifest/reading-budget.ts +127 -0
- package/src/puck-manifest/resolve-reference.ts +9 -0
- package/src/puck-manifest/source-reference.ts +484 -0
- package/src/puck-manifest/syntax.ts +104 -0
- package/src/puck-manifest/types.ts +139 -0
- package/src/safe-json-stringify.ts +17 -0
- package/src/sandbox-frame-handler.ts +31 -0
- package/src/site-styles/content-wrapper-endpoint.ts +327 -0
- package/src/site-styles/render-endpoint.ts +331 -0
- package/src/site-styles/styles-endpoint.ts +184 -0
- package/src/sitemap-options.ts +115 -0
- package/src/tiptap-html-static.ts +134 -0
- package/{dist/types-CS9neadI.d.mts → src/types.ts} +87 -124
- package/src/virtual-modules.d.ts +74 -0
- package/dist/collections-Bd7EME4b.mjs +0 -129
- package/dist/collections-Bd7EME4b.mjs.map +0 -1
- package/dist/collections.d.mts +0 -35
- package/dist/collections.d.mts.map +0 -1
- package/dist/collections.mjs +0 -2
- package/dist/components.d.mts +0 -41
- package/dist/components.d.mts.map +0 -1
- package/dist/components.mjs +0 -223
- package/dist/components.mjs.map +0 -1
- package/dist/hydration.d.mts +0 -4
- package/dist/hydration.mjs +0 -2
- package/dist/index.d.mts +0 -108
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs +0 -67
- package/dist/index.mjs.map +0 -1
- package/dist/internal/cms-handler.d.mts +0 -25
- package/dist/internal/cms-handler.d.mts.map +0 -1
- package/dist/internal/cms-handler.mjs +0 -314
- package/dist/internal/cms-handler.mjs.map +0 -1
- package/dist/lib/hydration-script.d.mts +0 -30
- package/dist/lib/hydration-script.d.mts.map +0 -1
- package/dist/lib/hydration-script.mjs +0 -84
- package/dist/lib/hydration-script.mjs.map +0 -1
- package/dist/locales-helpers-BvYYqnJ5.d.mts.map +0 -1
- package/dist/locales-helpers-qiwh7nxS.mjs +0 -54
- package/dist/locales-helpers-qiwh7nxS.mjs.map +0 -1
- package/dist/node/content.d.mts +0 -18
- package/dist/node/content.d.mts.map +0 -1
- package/dist/node/content.d.ts +0 -3
- package/dist/node/content.d.ts.map +0 -1
- package/dist/node/content.js +0 -2
- package/dist/node/content.mjs +0 -2
- package/dist/node/index.d.mts +0 -200
- package/dist/node/index.d.mts.map +0 -1
- package/dist/node/index.d.ts +0 -4
- package/dist/node/index.d.ts.map +0 -1
- package/dist/node/index.js +0 -3
- package/dist/node/index.mjs +0 -2513
- package/dist/node/index.mjs.map +0 -1
- package/dist/serialize-props-BHoNpzH6.mjs +0 -72
- package/dist/serialize-props-BHoNpzH6.mjs.map +0 -1
- package/dist/src/cms-handler.d.ts.map +0 -1
- package/dist/src/collections.d.ts +0 -32
- package/dist/src/collections.d.ts.map +0 -1
- package/dist/src/collections.js +0 -50
- package/dist/src/components/HydrationWrapper.d.ts.map +0 -1
- package/dist/src/components/RenderWithBlocks.d.ts.map +0 -1
- package/dist/src/components/RenderWithBlocks.js +0 -129
- package/dist/src/components/RenderWithHydration.d.ts.map +0 -1
- package/dist/src/components.d.ts +0 -4
- package/dist/src/components.d.ts.map +0 -1
- package/dist/src/components.js +0 -3
- package/dist/src/discovery/astro-frontmatter.d.ts.map +0 -1
- package/dist/src/discovery/extract-props-ts.d.ts.map +0 -1
- package/dist/src/discovery/merge-registry.d.ts.map +0 -1
- package/dist/src/discovery/registry-endpoint.d.ts +0 -42
- package/dist/src/discovery/registry-endpoint.d.ts.map +0 -1
- package/dist/src/discovery/registry-endpoint.js +0 -81
- package/dist/src/discovery/scan-components.d.ts.map +0 -1
- package/dist/src/discovery/scan-mdx.d.ts.map +0 -1
- package/dist/src/discovery/scan-overrides.d.ts.map +0 -1
- package/dist/src/hydration.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -11
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -25
- package/dist/src/lib/hydration-scanner.d.ts.map +0 -1
- package/dist/src/lib/hydration-script.d.ts.map +0 -1
- package/dist/src/lib/hydration-utils.d.ts.map +0 -1
- package/dist/src/lib/page-api.d.ts +0 -77
- package/dist/src/lib/page-api.d.ts.map +0 -1
- package/dist/src/lib/page-api.js +0 -121
- package/dist/src/lib/route-utils.d.ts.map +0 -1
- package/dist/src/lib/routing-config.d.ts.map +0 -1
- package/dist/src/lib/serialize-props.d.ts.map +0 -1
- package/dist/src/lib/virtual-module-generators.d.ts.map +0 -1
- package/dist/src/lib/virtual-module-generators.js +0 -263
- package/dist/src/lib/withHydration.d.ts.map +0 -1
- package/dist/src/loader.d.ts +0 -14
- package/dist/src/loader.d.ts.map +0 -1
- package/dist/src/locales-helpers.d.ts.map +0 -1
- package/dist/src/mime-types.d.ts.map +0 -1
- package/dist/src/path-validation.d.ts.map +0 -1
- package/dist/src/plugin-spa.d.ts.map +0 -1
- package/dist/src/safe-json-stringify.d.ts.map +0 -1
- package/dist/src/site-styles/content-wrapper-endpoint.d.ts.map +0 -1
- package/dist/src/site-styles/render-endpoint.d.ts.map +0 -1
- package/dist/src/site-styles/styles-endpoint.d.ts.map +0 -1
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -1
- package/dist/types-CS9neadI.d.mts.map +0 -1
- package/dist/withHydration-C256ox_6.mjs +0 -49
- package/dist/withHydration-C256ox_6.mjs.map +0 -1
- package/dist/withHydration-DkKpkmzJ.d.mts.map +0 -1
- /package/dist/{src → ts/src}/discovery/astro-frontmatter.d.ts +0 -0
- /package/dist/{src → ts/src}/discovery/extract-props-ts.d.ts +0 -0
- /package/dist/{src → ts/src}/discovery/scan-mdx.d.ts +0 -0
- /package/dist/{src → ts/src}/discovery/scan-overrides.d.ts +0 -0
- /package/dist/{src → ts/src}/hydration.d.ts +0 -0
- /package/dist/{src → ts/src}/lib/hydration-scanner.d.ts +0 -0
- /package/dist/{src → ts/src}/lib/hydration-script.d.ts +0 -0
- /package/dist/{src → ts/src}/lib/hydration-utils.d.ts +0 -0
- /package/dist/{src → ts/src}/lib/serialize-props.d.ts +0 -0
- /package/dist/{src → ts/src}/lib/withHydration.d.ts +0 -0
- /package/dist/{src → ts/src}/locales-helpers.d.ts +0 -0
- /package/dist/{src → ts/src}/mime-types.d.ts +0 -0
- /package/dist/{src → ts/src}/path-validation.d.ts +0 -0
- /package/dist/{src → ts/src}/safe-json-stringify.d.ts +0 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// Drop-in replacement for `@tiptap/html` wherever the site's build resolves it, in
|
|
2
|
+
// the editor and in the server render alike: same named exports, no happy-dom and
|
|
3
|
+
// no `node:vm`. The richtext field render imports `generateHTML`/`generateJSON`
|
|
4
|
+
// from `@tiptap/html`; its browser build needs `window`, and its `/server` build
|
|
5
|
+
// fakes one with happy-dom — whose `Window` constructor calls `node:vm`
|
|
6
|
+
// (`Script.runInContext`). Workers runtimes ship `node:vm` as a stub, so that
|
|
7
|
+
// call throws at render time and every richtext section on the page dies. Here
|
|
8
|
+
// ProseMirror's own serializer, the one `@tiptap/html` runs, writes into a few
|
|
9
|
+
// string-backed elements instead of a DOM, so the same markup comes out on any
|
|
10
|
+
// engine; reading HTML back takes the browser's own parser, or linkedom where
|
|
11
|
+
// there is none.
|
|
12
|
+
import { type Extensions, getSchema, type JSONContent } from '@tiptap/core';
|
|
13
|
+
import {
|
|
14
|
+
DOMSerializer,
|
|
15
|
+
type ParseOptions,
|
|
16
|
+
DOMParser as ProseMirrorDOMParser,
|
|
17
|
+
Node as ProseMirrorNode,
|
|
18
|
+
} from '@tiptap/pm/model';
|
|
19
|
+
import { parseHTML } from 'linkedom/worker';
|
|
20
|
+
|
|
21
|
+
// Elements the HTML parser closes on its own, so a DOM serializer writes no end tag.
|
|
22
|
+
const VOID_ELEMENTS = new Set([
|
|
23
|
+
'area',
|
|
24
|
+
'base',
|
|
25
|
+
'br',
|
|
26
|
+
'col',
|
|
27
|
+
'embed',
|
|
28
|
+
'hr',
|
|
29
|
+
'img',
|
|
30
|
+
'input',
|
|
31
|
+
'link',
|
|
32
|
+
'meta',
|
|
33
|
+
'param',
|
|
34
|
+
'source',
|
|
35
|
+
'track',
|
|
36
|
+
'wbr',
|
|
37
|
+
]);
|
|
38
|
+
|
|
39
|
+
const escapeText = (text: string) =>
|
|
40
|
+
text
|
|
41
|
+
.replace(/&/g, '&')
|
|
42
|
+
.replace(/\u00a0/g, ' ')
|
|
43
|
+
.replace(/</g, '<')
|
|
44
|
+
.replace(/>/g, '>');
|
|
45
|
+
|
|
46
|
+
const escapeAttribute = (value: string) => escapeText(value).replace(/"/g, '"');
|
|
47
|
+
|
|
48
|
+
class StringText {
|
|
49
|
+
readonly nodeType = 3;
|
|
50
|
+
constructor(private readonly text: string) {}
|
|
51
|
+
toString(): string {
|
|
52
|
+
return escapeText(this.text);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* An element as far as ProseMirror's serializer uses one: attributes in the
|
|
58
|
+
* order they were set, children appended. Having no `style` object, it takes
|
|
59
|
+
* `style` as a plain attribute, as written.
|
|
60
|
+
*/
|
|
61
|
+
class StringElement {
|
|
62
|
+
readonly nodeType = 1;
|
|
63
|
+
private readonly attributes = new Map<string, string>();
|
|
64
|
+
private readonly children: (StringElement | StringText)[] = [];
|
|
65
|
+
constructor(private readonly tagName: string) {}
|
|
66
|
+
|
|
67
|
+
setAttribute(name: string, value: unknown): void {
|
|
68
|
+
this.attributes.set(name, String(value));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
setAttributeNS(_namespace: string | null, name: string, value: unknown): void {
|
|
72
|
+
this.setAttribute(name, value);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
appendChild<T extends StringElement | StringText>(child: T): T {
|
|
76
|
+
this.children.push(child);
|
|
77
|
+
return child;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
get innerHTML(): string {
|
|
81
|
+
return this.children.join('');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
toString(): string {
|
|
85
|
+
const attributes = [...this.attributes].map(([name, value]) => ` ${name}="${escapeAttribute(value)}"`).join('');
|
|
86
|
+
const open = `<${this.tagName}${attributes}>`;
|
|
87
|
+
return VOID_ELEMENTS.has(this.tagName) ? open : `${open}${this.innerHTML}</${this.tagName}>`;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const stringDocument = {
|
|
92
|
+
createElement: (tagName: string) => new StringElement(tagName),
|
|
93
|
+
createElementNS: (_namespace: string, tagName: string) => new StringElement(tagName),
|
|
94
|
+
createTextNode: (text: string) => new StringText(text),
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Generates HTML from a ProseMirror JSON document, without a DOM. The
|
|
99
|
+
* serializer keeps a mark's element open across the runs that share it, so a
|
|
100
|
+
* link with one underlined word stays one link.
|
|
101
|
+
*/
|
|
102
|
+
export function generateHTML(doc: JSONContent, extensions: Extensions): string {
|
|
103
|
+
const schema = getSchema(extensions);
|
|
104
|
+
const root = new StringElement('div');
|
|
105
|
+
// The string-backed elements cover every DOM call the serializer makes, under types of their own.
|
|
106
|
+
DOMSerializer.fromSchema(schema).serializeFragment(
|
|
107
|
+
ProseMirrorNode.fromJSON(schema, doc).content,
|
|
108
|
+
{ document: stringDocument as unknown as Document },
|
|
109
|
+
root as unknown as HTMLElement,
|
|
110
|
+
);
|
|
111
|
+
return root.innerHTML;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Reads an HTML string into a ProseMirror JSON document. The richtext field stores
|
|
116
|
+
* the editor's HTML and its render reads it back through here. A browser parses
|
|
117
|
+
* with its own DOMParser; a server render has none, so linkedom parses there —
|
|
118
|
+
* plain JavaScript without `node:vm`, so it runs in Workers runtimes too.
|
|
119
|
+
*/
|
|
120
|
+
export function generateJSON(html: string, extensions: Extensions, options?: ParseOptions): Record<string, unknown> {
|
|
121
|
+
const parser = ProseMirrorDOMParser.fromSchema(getSchema(extensions));
|
|
122
|
+
if (typeof globalThis.DOMParser === 'function') {
|
|
123
|
+
const { body } = new globalThis.DOMParser().parseFromString(html, 'text/html');
|
|
124
|
+
return parser.parse(body, options).toJSON();
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const { document } = parseHTML(`<!DOCTYPE html><html><body>${html}</body></html>`);
|
|
128
|
+
// linkedom's elements implement the part of the DOM ProseMirror reads, under types of their own.
|
|
129
|
+
const doc = parser.parse(document.body as unknown as Node, options).toJSON();
|
|
130
|
+
// linkedom answers `getAttribute('class')` with "" for an element that has no
|
|
131
|
+
// class, where a browser answers null, so every link would read back with an
|
|
132
|
+
// empty class and render as `class=""`. Give the null back.
|
|
133
|
+
return JSON.parse(JSON.stringify(doc), (key, value) => (key === 'class' && value === '' ? null : value));
|
|
134
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import type { DataBindingConfig, PageReference } from '@conloca/content-api';
|
|
2
|
+
import type { Data } from '@puckeditor/core';
|
|
3
|
+
|
|
4
4
|
/**
|
|
5
5
|
* Hydration strategy for Puck components in production.
|
|
6
6
|
*
|
|
@@ -22,7 +22,10 @@ import { DataCollectionEntry, PageReference } from "@conloca/content-api";
|
|
|
22
22
|
* - 'visible': Hydrate when component enters viewport (client:visible)
|
|
23
23
|
* - 'idle': Hydrate when browser is idle (client:idle)
|
|
24
24
|
*/
|
|
25
|
-
type HydrationStrategy = 'none' | 'load' | 'visible' | 'idle';
|
|
25
|
+
export type HydrationStrategy = 'none' | 'load' | 'visible' | 'idle';
|
|
26
|
+
|
|
27
|
+
export type { ContentFragmentSectionProps } from '@conloca/cms-spa';
|
|
28
|
+
|
|
26
29
|
/**
|
|
27
30
|
* Configuration for Conloca's content page routing system.
|
|
28
31
|
*
|
|
@@ -64,7 +67,7 @@ type HydrationStrategy = 'none' | 'load' | 'visible' | 'idle';
|
|
|
64
67
|
* });
|
|
65
68
|
* ```
|
|
66
69
|
*/
|
|
67
|
-
interface RoutingConfig {
|
|
70
|
+
export interface RoutingConfig {
|
|
68
71
|
/**
|
|
69
72
|
* Whether routing is enabled.
|
|
70
73
|
*
|
|
@@ -74,6 +77,7 @@ interface RoutingConfig {
|
|
|
74
77
|
* @default true (when routing config object is provided)
|
|
75
78
|
*/
|
|
76
79
|
enabled?: boolean;
|
|
80
|
+
|
|
77
81
|
/**
|
|
78
82
|
* Route definitions mapping URL patterns to content collections.
|
|
79
83
|
*
|
|
@@ -89,18 +93,22 @@ interface RoutingConfig {
|
|
|
89
93
|
* @default { pages: { pattern: '/[...slug]', collection: 'pages', prerender: true } }
|
|
90
94
|
*/
|
|
91
95
|
routes?: Record<string, RouteConfig>;
|
|
96
|
+
|
|
92
97
|
/**
|
|
93
98
|
* Behavior when a route pattern matches but no content exists.
|
|
94
99
|
*
|
|
95
|
-
* - '404': Return a 404 response (standard behavior)
|
|
96
|
-
* - 'passthrough':
|
|
100
|
+
* - '404': Return a bare 404 response (standard behavior)
|
|
101
|
+
* - 'passthrough': Hand the miss back to Astro's own error handling, which
|
|
102
|
+
* renders the site's /404 route (prerendered included) with a real 404
|
|
103
|
+
* status — never a redirect or a soft-404
|
|
97
104
|
*
|
|
98
|
-
* 'passthrough' is useful when
|
|
99
|
-
*
|
|
105
|
+
* 'passthrough' is useful when the site has its own designed /404 page
|
|
106
|
+
* that should answer for paths the CMS doesn't know.
|
|
100
107
|
*
|
|
101
108
|
* @default '404'
|
|
102
109
|
*/
|
|
103
110
|
fallback?: '404' | 'passthrough';
|
|
111
|
+
|
|
104
112
|
/**
|
|
105
113
|
* What to do when an injected route conflicts with an existing file-based route.
|
|
106
114
|
*
|
|
@@ -113,6 +121,7 @@ interface RoutingConfig {
|
|
|
113
121
|
* @default 'warn'
|
|
114
122
|
*/
|
|
115
123
|
onConflict?: 'warn' | 'error' | 'silent';
|
|
124
|
+
|
|
116
125
|
/**
|
|
117
126
|
* Site name for content resolution.
|
|
118
127
|
*
|
|
@@ -133,6 +142,7 @@ interface RoutingConfig {
|
|
|
133
142
|
* @default 'default'
|
|
134
143
|
*/
|
|
135
144
|
siteName?: string;
|
|
145
|
+
|
|
136
146
|
/**
|
|
137
147
|
* Default locale for content resolution.
|
|
138
148
|
*
|
|
@@ -154,6 +164,7 @@ interface RoutingConfig {
|
|
|
154
164
|
*/
|
|
155
165
|
locale?: string;
|
|
156
166
|
}
|
|
167
|
+
|
|
157
168
|
/**
|
|
158
169
|
* Shorthand for enabling routing with all defaults.
|
|
159
170
|
*
|
|
@@ -167,7 +178,8 @@ interface RoutingConfig {
|
|
|
167
178
|
* }
|
|
168
179
|
* ```
|
|
169
180
|
*/
|
|
170
|
-
type RoutingConfigInput = boolean | RoutingConfig;
|
|
181
|
+
export type RoutingConfigInput = boolean | RoutingConfig;
|
|
182
|
+
|
|
171
183
|
/**
|
|
172
184
|
* Configuration for a single route mapping.
|
|
173
185
|
*
|
|
@@ -203,7 +215,7 @@ type RoutingConfigInput = boolean | RoutingConfig;
|
|
|
203
215
|
* }
|
|
204
216
|
* ```
|
|
205
217
|
*/
|
|
206
|
-
interface RouteConfig {
|
|
218
|
+
export interface RouteConfig {
|
|
207
219
|
/**
|
|
208
220
|
* Astro route pattern for URL matching.
|
|
209
221
|
*
|
|
@@ -217,8 +229,14 @@ interface RouteConfig {
|
|
|
217
229
|
*
|
|
218
230
|
* IMPORTANT: Pattern must start with '/'
|
|
219
231
|
* IMPORTANT: Catch-all patterns ([...param]) capture everything after the prefix
|
|
232
|
+
* IMPORTANT: The parameter name must be unique among the site's routes — Astro's
|
|
233
|
+
* runtime resolves a page's stylesheets by route name, so a Conloca route named
|
|
234
|
+
* like another integration's (Starlight's docs route is '/[...slug]') breaks
|
|
235
|
+
* the styling of one or the other in server output or when rendered on demand.
|
|
236
|
+
* Conloca fails such a build; pick another name, e.g. '/[...page]'.
|
|
220
237
|
*/
|
|
221
238
|
pattern: string;
|
|
239
|
+
|
|
222
240
|
/**
|
|
223
241
|
* Content collection to use for this route.
|
|
224
242
|
*
|
|
@@ -235,6 +253,7 @@ interface RouteConfig {
|
|
|
235
253
|
* @default 'pages'
|
|
236
254
|
*/
|
|
237
255
|
collection?: string;
|
|
256
|
+
|
|
238
257
|
/**
|
|
239
258
|
* Path to the Astro layout component.
|
|
240
259
|
*
|
|
@@ -252,6 +271,7 @@ interface RouteConfig {
|
|
|
252
271
|
* @example './src/layouts/BlogLayout.tsx'
|
|
253
272
|
*/
|
|
254
273
|
layout?: string;
|
|
274
|
+
|
|
255
275
|
/**
|
|
256
276
|
* Whether to statically generate pages at build time.
|
|
257
277
|
*
|
|
@@ -271,6 +291,7 @@ interface RouteConfig {
|
|
|
271
291
|
* @default true
|
|
272
292
|
*/
|
|
273
293
|
prerender?: boolean;
|
|
294
|
+
|
|
274
295
|
/**
|
|
275
296
|
* Additional route metadata passed to the page handler.
|
|
276
297
|
*
|
|
@@ -280,6 +301,7 @@ interface RouteConfig {
|
|
|
280
301
|
* @example { showSidebar: true, theme: 'dark' }
|
|
281
302
|
*/
|
|
282
303
|
meta?: Record<string, unknown>;
|
|
304
|
+
|
|
283
305
|
/**
|
|
284
306
|
* Data binding configuration for this route.
|
|
285
307
|
*
|
|
@@ -298,6 +320,7 @@ interface RouteConfig {
|
|
|
298
320
|
*/
|
|
299
321
|
dataBindings?: DataBindingConfig;
|
|
300
322
|
}
|
|
323
|
+
|
|
301
324
|
/**
|
|
302
325
|
* Complete page data for rendering.
|
|
303
326
|
*
|
|
@@ -309,13 +332,14 @@ interface RouteConfig {
|
|
|
309
332
|
* - Page metadata for SEO/layouts
|
|
310
333
|
* - Route information for context
|
|
311
334
|
*/
|
|
312
|
-
interface PageData {
|
|
335
|
+
export interface PageData {
|
|
313
336
|
/**
|
|
314
337
|
* Unique page identifier from the content collection.
|
|
315
338
|
*
|
|
316
339
|
* Typically matches the URL path (e.g., 'about', 'blog/post-1').
|
|
317
340
|
*/
|
|
318
341
|
id: string;
|
|
342
|
+
|
|
319
343
|
/**
|
|
320
344
|
* Page title from content metadata.
|
|
321
345
|
*
|
|
@@ -327,6 +351,7 @@ interface PageData {
|
|
|
327
351
|
* May be undefined if page has no title set.
|
|
328
352
|
*/
|
|
329
353
|
title?: string;
|
|
354
|
+
|
|
330
355
|
/**
|
|
331
356
|
* Page description for SEO.
|
|
332
357
|
*
|
|
@@ -335,6 +360,7 @@ interface PageData {
|
|
|
335
360
|
* - Social sharing previews
|
|
336
361
|
*/
|
|
337
362
|
description?: string;
|
|
363
|
+
|
|
338
364
|
/**
|
|
339
365
|
* URL pathname for this page.
|
|
340
366
|
*
|
|
@@ -344,6 +370,7 @@ interface PageData {
|
|
|
344
370
|
* @example '/blog/my-first-post'
|
|
345
371
|
*/
|
|
346
372
|
pathname: string;
|
|
373
|
+
|
|
347
374
|
/**
|
|
348
375
|
* Puck editor data for rendering.
|
|
349
376
|
*
|
|
@@ -355,12 +382,14 @@ interface PageData {
|
|
|
355
382
|
* Passed directly to <Render config={} data={puckData} />
|
|
356
383
|
*/
|
|
357
384
|
puckData: Data;
|
|
385
|
+
|
|
358
386
|
/**
|
|
359
387
|
* Content collection this page belongs to.
|
|
360
388
|
*
|
|
361
389
|
* @example 'pages', 'posts', 'docs'
|
|
362
390
|
*/
|
|
363
391
|
collection: string;
|
|
392
|
+
|
|
364
393
|
/**
|
|
365
394
|
* Route configuration that matched this page.
|
|
366
395
|
*
|
|
@@ -373,15 +402,18 @@ interface PageData {
|
|
|
373
402
|
* @example 'pages', 'blog'
|
|
374
403
|
*/
|
|
375
404
|
name: string;
|
|
405
|
+
|
|
376
406
|
/**
|
|
377
407
|
* Original pattern from RouteConfig.
|
|
378
408
|
*/
|
|
379
409
|
pattern: string;
|
|
410
|
+
|
|
380
411
|
/**
|
|
381
412
|
* Route-specific metadata if configured.
|
|
382
413
|
*/
|
|
383
414
|
meta?: Record<string, unknown>;
|
|
384
415
|
};
|
|
416
|
+
|
|
385
417
|
/**
|
|
386
418
|
* Additional page metadata from content.
|
|
387
419
|
*
|
|
@@ -389,29 +421,20 @@ interface PageData {
|
|
|
389
421
|
* Schema depends on the site's content configuration.
|
|
390
422
|
*/
|
|
391
423
|
meta?: Record<string, unknown>;
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
timestamps?: {
|
|
396
|
-
/**
|
|
397
|
-
* When the page was first created.
|
|
398
|
-
*/
|
|
399
|
-
created?: Date;
|
|
400
|
-
/**
|
|
401
|
-
* When the page was last modified.
|
|
402
|
-
*/
|
|
403
|
-
modified?: Date;
|
|
404
|
-
/**
|
|
405
|
-
* When the page was published (if different from created).
|
|
406
|
-
*/
|
|
407
|
-
published?: Date;
|
|
408
|
-
};
|
|
424
|
+
|
|
425
|
+
/** The page's dates, as on PageReference. */
|
|
426
|
+
timestamps?: PageReference['timestamps'];
|
|
409
427
|
}
|
|
428
|
+
|
|
410
429
|
/**
|
|
411
430
|
* Props passed to layout components wrapping page content.
|
|
412
431
|
*
|
|
413
432
|
* Layouts receive common props (title, description) that work with
|
|
414
433
|
* most existing layouts. No special Conloca-specific layout needed.
|
|
434
|
+
* A layout that needs more of the page's settings (an Open Graph image,
|
|
435
|
+
* structured data) reads them from `page` instead of looking the page up
|
|
436
|
+
* again, because a second lookup would have to repeat the handler's language,
|
|
437
|
+
* publication and preview rules.
|
|
415
438
|
*
|
|
416
439
|
* @example Astro layout usage
|
|
417
440
|
* ```astro
|
|
@@ -455,30 +478,48 @@ interface PageData {
|
|
|
455
478
|
* }
|
|
456
479
|
* ```
|
|
457
480
|
*/
|
|
458
|
-
interface LayoutProps {
|
|
481
|
+
export interface LayoutProps {
|
|
459
482
|
/**
|
|
460
483
|
* Page title for the document head.
|
|
461
484
|
*/
|
|
462
485
|
title: string;
|
|
486
|
+
|
|
463
487
|
/**
|
|
464
488
|
* Page description for SEO meta tag.
|
|
465
489
|
*/
|
|
466
490
|
description?: string;
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* The page being rendered, with its settings in `meta`: the version in the
|
|
494
|
+
* route's language that the handler matched, published or the draft a
|
|
495
|
+
* preview renders.
|
|
496
|
+
*/
|
|
497
|
+
page: PageReference;
|
|
498
|
+
|
|
467
499
|
/**
|
|
468
500
|
* The rendered Puck content.
|
|
469
501
|
*
|
|
470
502
|
* In Astro layouts, use <slot /> instead of {children}.
|
|
471
503
|
* In React layouts, render {children} in the content area.
|
|
472
504
|
*/
|
|
473
|
-
children?: unknown;
|
|
505
|
+
children?: unknown; // astro.JSX.Element | React.ReactNode
|
|
474
506
|
}
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* Layout component type for Astro.
|
|
510
|
+
*
|
|
511
|
+
* Layouts must accept LayoutProps and render a page shell
|
|
512
|
+
* with the provided content.
|
|
513
|
+
*/
|
|
514
|
+
export type LayoutComponent = (props: LayoutProps) => unknown;
|
|
515
|
+
|
|
475
516
|
/**
|
|
476
517
|
* Resolved routing configuration with all fields required.
|
|
477
518
|
*
|
|
478
519
|
* This is what the page handler receives via the virtual module,
|
|
479
520
|
* with all defaults applied.
|
|
480
521
|
*/
|
|
481
|
-
interface ResolvedRoutingConfig {
|
|
522
|
+
export interface ResolvedRoutingConfig {
|
|
482
523
|
enabled: boolean;
|
|
483
524
|
routes: Record<string, Required<RouteConfig>>;
|
|
484
525
|
fallback: '404' | 'passthrough';
|
|
@@ -488,94 +529,16 @@ interface ResolvedRoutingConfig {
|
|
|
488
529
|
/** Default locale for content resolution. */
|
|
489
530
|
locale: string;
|
|
490
531
|
}
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
* routes: {
|
|
502
|
-
* pages: {
|
|
503
|
-
* pattern: '/[...slug]',
|
|
504
|
-
* dataBindings: {
|
|
505
|
-
* collections: ['team', 'testimonials'],
|
|
506
|
-
* },
|
|
507
|
-
* },
|
|
508
|
-
* },
|
|
509
|
-
* },
|
|
510
|
-
* });
|
|
511
|
-
* ```
|
|
512
|
-
*/
|
|
513
|
-
interface DataBindingConfig {
|
|
514
|
-
/**
|
|
515
|
-
* Collections to fetch and inject into component resolvers.
|
|
516
|
-
*
|
|
517
|
-
* Each collection name must match a data collection in the content directory.
|
|
518
|
-
* The fetched data will be available in `metadata.collections[collectionName]`
|
|
519
|
-
* within Puck component resolvers.
|
|
520
|
-
*
|
|
521
|
-
* @example ['team', 'testimonials', 'products']
|
|
522
|
-
*/
|
|
523
|
-
collections?: string[];
|
|
524
|
-
/**
|
|
525
|
-
* Locale override for data fetching.
|
|
526
|
-
*
|
|
527
|
-
* Defaults to the route's locale setting (from routing.locale).
|
|
528
|
-
* Use this to fetch data in a specific locale regardless of route config.
|
|
529
|
-
*/
|
|
530
|
-
locale?: string;
|
|
531
|
-
/**
|
|
532
|
-
* Page discovery configuration for listing pages by path prefix.
|
|
533
|
-
*
|
|
534
|
-
* Enables components to access lists of pages matching a URL pattern,
|
|
535
|
-
* useful for blog listings, category pages, and site navigation.
|
|
536
|
-
*
|
|
537
|
-
* @example Blog listing page
|
|
538
|
-
* ```typescript
|
|
539
|
-
* {
|
|
540
|
-
* pattern: '/blog',
|
|
541
|
-
* dataBindings: {
|
|
542
|
-
* pages: {
|
|
543
|
-
* prefix: '/blog/',
|
|
544
|
-
* sort: 'date-desc',
|
|
545
|
-
* limit: 10,
|
|
546
|
-
* },
|
|
547
|
-
* },
|
|
548
|
-
* }
|
|
549
|
-
* ```
|
|
550
|
-
*/
|
|
551
|
-
pages?: {
|
|
552
|
-
/**
|
|
553
|
-
* Path prefix to filter pages.
|
|
554
|
-
*
|
|
555
|
-
* Only pages whose pathname starts with this prefix are included.
|
|
556
|
-
* The listing page itself is excluded.
|
|
557
|
-
*
|
|
558
|
-
* @example '/blog/' matches '/blog/post-1', '/blog/post-2'
|
|
559
|
-
*/
|
|
560
|
-
prefix: string;
|
|
561
|
-
/**
|
|
562
|
-
* Maximum number of pages to return.
|
|
563
|
-
*
|
|
564
|
-
* Useful for showing "latest N posts" on a homepage or sidebar.
|
|
565
|
-
*/
|
|
566
|
-
limit?: number;
|
|
567
|
-
/**
|
|
568
|
-
* Sort order for returned pages.
|
|
569
|
-
*
|
|
570
|
-
* - 'date-desc': Newest first (by modified/created date)
|
|
571
|
-
* - 'date-asc': Oldest first
|
|
572
|
-
* - 'title': Alphabetical by title
|
|
573
|
-
*
|
|
574
|
-
* @default 'date-desc'
|
|
575
|
-
*/
|
|
576
|
-
sort?: 'date-desc' | 'date-asc' | 'title';
|
|
577
|
-
};
|
|
578
|
-
}
|
|
532
|
+
|
|
533
|
+
// Data context and binding types re-exported from content-api (canonical source)
|
|
534
|
+
export type {
|
|
535
|
+
DataBindingConfig,
|
|
536
|
+
DataCollectionEntry,
|
|
537
|
+
DataContext,
|
|
538
|
+
EditorDataBindings,
|
|
539
|
+
PageReference,
|
|
540
|
+
} from '@conloca/content-api';
|
|
541
|
+
|
|
579
542
|
/**
|
|
580
543
|
* Configuration for a page creation template.
|
|
581
544
|
*
|
|
@@ -595,29 +558,29 @@ interface DataBindingConfig {
|
|
|
595
558
|
* });
|
|
596
559
|
* ```
|
|
597
560
|
*/
|
|
598
|
-
interface TemplateConfig {
|
|
561
|
+
export interface TemplateConfig {
|
|
599
562
|
/**
|
|
600
563
|
* Display label shown in the template dropdown.
|
|
601
564
|
* @example 'Blog Post', 'Landing Page', 'Documentation'
|
|
602
565
|
*/
|
|
603
566
|
label: string;
|
|
567
|
+
|
|
604
568
|
/**
|
|
605
569
|
* Puck component name to pre-drop into the page.
|
|
606
570
|
* Must match a component registered in the site's puck.config.
|
|
607
571
|
* @example 'BlogPostTemplate', 'LandingPageTemplate'
|
|
608
572
|
*/
|
|
609
573
|
component: string;
|
|
574
|
+
|
|
610
575
|
/**
|
|
611
576
|
* Optional path prefix to auto-apply when this template is selected.
|
|
612
577
|
* If the user's path doesn't start with this prefix, it's added.
|
|
613
578
|
* @example '/blog/' will turn '/my-post' into '/blog/my-post'
|
|
614
579
|
*/
|
|
615
580
|
pathPrefix?: string;
|
|
581
|
+
|
|
616
582
|
/**
|
|
617
583
|
* Optional description shown in the dropdown.
|
|
618
584
|
*/
|
|
619
585
|
description?: string;
|
|
620
586
|
}
|
|
621
|
-
//#endregion
|
|
622
|
-
export { PageReference as a, TemplateConfig as c, PageData as i, HydrationStrategy as n, ResolvedRoutingConfig as o, LayoutProps as r, RoutingConfigInput as s, DataCollectionEntry as t };
|
|
623
|
-
//# sourceMappingURL=types-CS9neadI.d.mts.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type declarations for Conloca virtual modules.
|
|
3
|
+
*
|
|
4
|
+
* These modules are generated at build/dev time by the Vite plugin
|
|
5
|
+
* and provide routing configuration, layout components and Puck config
|
|
6
|
+
* to page handlers.
|
|
7
|
+
*
|
|
8
|
+
* Every type import lives INSIDE its `declare module` block so this file has
|
|
9
|
+
* no top-level import/export: a file that is itself a module turns these into
|
|
10
|
+
* augmentations of modules that must already resolve, which they never do.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Virtual module: virtual:conloca-routing-config
|
|
15
|
+
*
|
|
16
|
+
* Provides resolved routing configuration to page handlers.
|
|
17
|
+
* All defaults are applied before this module is generated.
|
|
18
|
+
*/
|
|
19
|
+
declare module 'virtual:conloca-routing-config' {
|
|
20
|
+
import type { ResolvedRoutingConfig } from '@conloca/astro-cms';
|
|
21
|
+
|
|
22
|
+
const config: ResolvedRoutingConfig;
|
|
23
|
+
export default config;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Virtual module: virtual:conloca-layout
|
|
28
|
+
*
|
|
29
|
+
* Provides the layout component for content pages.
|
|
30
|
+
* Returns undefined if no layout is configured.
|
|
31
|
+
*
|
|
32
|
+
* Currently uses the first route's layout - multi-layout support
|
|
33
|
+
* is planned for future versions.
|
|
34
|
+
*/
|
|
35
|
+
declare module 'virtual:conloca-layout' {
|
|
36
|
+
import type { LayoutProps } from '@conloca/astro-cms';
|
|
37
|
+
|
|
38
|
+
type LayoutComponent = ((props: LayoutProps) => unknown) | undefined;
|
|
39
|
+
|
|
40
|
+
const Layout: LayoutComponent;
|
|
41
|
+
export default Layout;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Virtual module: virtual:conloca-puck-config
|
|
46
|
+
*
|
|
47
|
+
* Provides Puck configuration for static page rendering.
|
|
48
|
+
*
|
|
49
|
+
* This is separate from the HMR-enabled puck-entry.js used by
|
|
50
|
+
* the CMS SPA. It's a simple re-export without React refresh
|
|
51
|
+
* preamble since it's used for SSG builds.
|
|
52
|
+
*/
|
|
53
|
+
declare module 'virtual:conloca-puck-config' {
|
|
54
|
+
import type { Config } from '@puckeditor/core';
|
|
55
|
+
|
|
56
|
+
const config: Config;
|
|
57
|
+
export default config;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Virtual module: virtual:conloca-hydration-entry
|
|
62
|
+
*
|
|
63
|
+
* Client-side script that handles progressive hydration of interactive
|
|
64
|
+
* components. Loaded only when a page contains hydratable components.
|
|
65
|
+
*/
|
|
66
|
+
declare module 'virtual:conloca-hydration-entry' {}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Virtual module: virtual:conloca-hydration-registry
|
|
70
|
+
*
|
|
71
|
+
* Maps component names to dynamic import functions for lazy-loading
|
|
72
|
+
* hydratable components on the client.
|
|
73
|
+
*/
|
|
74
|
+
declare module 'virtual:conloca-hydration-registry' {}
|