@conloca/astro-cms 0.1.15 → 0.1.16

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.
Files changed (160) hide show
  1. package/README.md +65 -5
  2. package/dist/collections-Bd7EME4b.mjs +129 -0
  3. package/dist/collections-Bd7EME4b.mjs.map +1 -0
  4. package/dist/collections.d.mts +0 -1
  5. package/dist/collections.d.mts.map +1 -1
  6. package/dist/collections.mjs +1 -64
  7. package/dist/components.d.mts +2 -7
  8. package/dist/components.d.mts.map +1 -1
  9. package/dist/components.mjs +3 -6
  10. package/dist/components.mjs.map +1 -1
  11. package/dist/hydration.d.mts +2 -2
  12. package/dist/hydration.mjs +2 -3
  13. package/dist/index.d.mts +6 -37
  14. package/dist/index.d.mts.map +1 -1
  15. package/dist/index.mjs +7 -6
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/internal/cms-handler.d.mts +0 -1
  18. package/dist/internal/cms-handler.d.mts.map +1 -1
  19. package/dist/internal/cms-handler.mjs +55 -8
  20. package/dist/internal/cms-handler.mjs.map +1 -1
  21. package/dist/lib/hydration-script.d.mts +1 -2
  22. package/dist/lib/hydration-script.d.mts.map +1 -1
  23. package/dist/lib/hydration-script.mjs +1 -2
  24. package/dist/lib/hydration-script.mjs.map +1 -1
  25. package/dist/locales-helpers-BvYYqnJ5.d.mts +64 -0
  26. package/dist/locales-helpers-BvYYqnJ5.d.mts.map +1 -0
  27. package/dist/locales-helpers-qiwh7nxS.mjs +54 -0
  28. package/dist/locales-helpers-qiwh7nxS.mjs.map +1 -0
  29. package/dist/node/content.d.mts +0 -1
  30. package/dist/node/content.d.mts.map +1 -1
  31. package/dist/node/content.d.ts +3 -0
  32. package/dist/node/content.d.ts.map +1 -0
  33. package/dist/node/content.js +2 -0
  34. package/dist/node/content.mjs +2 -4
  35. package/dist/node/index.d.mts +151 -3
  36. package/dist/node/index.d.mts.map +1 -1
  37. package/dist/node/index.d.ts +4 -0
  38. package/dist/node/index.d.ts.map +1 -0
  39. package/dist/node/index.js +3 -0
  40. package/dist/node/index.mjs +1857 -97
  41. package/dist/node/index.mjs.map +1 -1
  42. package/dist/{serialize-props-Dhv_MnkY.mjs → serialize-props-BHoNpzH6.mjs} +2 -3
  43. package/dist/{serialize-props-Dhv_MnkY.mjs.map → serialize-props-BHoNpzH6.mjs.map} +1 -1
  44. package/dist/src/cms-handler.d.ts +19 -0
  45. package/dist/src/cms-handler.d.ts.map +1 -0
  46. package/dist/src/cms-handler.js +366 -0
  47. package/dist/src/collections.d.ts +32 -0
  48. package/dist/src/collections.d.ts.map +1 -0
  49. package/dist/src/collections.js +50 -0
  50. package/dist/src/components/HydrationWrapper.d.ts +18 -0
  51. package/dist/src/components/HydrationWrapper.d.ts.map +1 -0
  52. package/dist/src/components/HydrationWrapper.js +21 -0
  53. package/dist/src/components/RenderWithBlocks.d.ts +23 -0
  54. package/dist/src/components/RenderWithBlocks.d.ts.map +1 -0
  55. package/dist/src/components/RenderWithBlocks.js +129 -0
  56. package/dist/src/components/RenderWithHydration.d.ts +17 -0
  57. package/dist/src/components/RenderWithHydration.d.ts.map +1 -0
  58. package/dist/src/components/RenderWithHydration.js +36 -0
  59. package/dist/src/components.d.ts +4 -0
  60. package/dist/src/components.d.ts.map +1 -0
  61. package/dist/src/components.js +3 -0
  62. package/dist/src/discovery/astro-frontmatter.d.ts +18 -0
  63. package/dist/src/discovery/astro-frontmatter.d.ts.map +1 -0
  64. package/dist/src/discovery/astro-frontmatter.js +24 -0
  65. package/dist/src/discovery/extract-props-ts.d.ts +41 -0
  66. package/dist/src/discovery/extract-props-ts.d.ts.map +1 -0
  67. package/dist/src/discovery/extract-props-ts.js +231 -0
  68. package/dist/src/discovery/merge-registry.d.ts +58 -0
  69. package/dist/src/discovery/merge-registry.d.ts.map +1 -0
  70. package/dist/src/discovery/merge-registry.js +332 -0
  71. package/dist/src/discovery/registry-endpoint.d.ts +42 -0
  72. package/dist/src/discovery/registry-endpoint.d.ts.map +1 -0
  73. package/dist/src/discovery/registry-endpoint.js +81 -0
  74. package/dist/src/discovery/scan-components.d.ts +98 -0
  75. package/dist/src/discovery/scan-components.d.ts.map +1 -0
  76. package/dist/src/discovery/scan-components.js +399 -0
  77. package/dist/src/discovery/scan-mdx.d.ts +63 -0
  78. package/dist/src/discovery/scan-mdx.d.ts.map +1 -0
  79. package/dist/src/discovery/scan-mdx.js +112 -0
  80. package/dist/src/discovery/scan-overrides.d.ts +71 -0
  81. package/dist/src/discovery/scan-overrides.d.ts.map +1 -0
  82. package/dist/src/discovery/scan-overrides.js +33 -0
  83. package/dist/src/hydration.d.ts +4 -0
  84. package/dist/src/hydration.d.ts.map +1 -0
  85. package/dist/src/hydration.js +4 -0
  86. package/dist/src/index.d.ts +11 -0
  87. package/dist/src/index.d.ts.map +1 -0
  88. package/dist/src/index.js +25 -0
  89. package/dist/src/lib/hydration-scanner.d.ts +47 -0
  90. package/dist/src/lib/hydration-scanner.d.ts.map +1 -0
  91. package/dist/src/lib/hydration-scanner.js +135 -0
  92. package/dist/src/lib/hydration-script.d.ts +28 -0
  93. package/dist/src/lib/hydration-script.d.ts.map +1 -0
  94. package/dist/src/lib/hydration-script.js +88 -0
  95. package/dist/src/lib/hydration-utils.d.ts +51 -0
  96. package/dist/src/lib/hydration-utils.d.ts.map +1 -0
  97. package/dist/src/lib/hydration-utils.js +83 -0
  98. package/dist/src/lib/page-api.d.ts +77 -0
  99. package/dist/src/lib/page-api.d.ts.map +1 -0
  100. package/dist/src/lib/page-api.js +121 -0
  101. package/dist/src/lib/route-utils.d.ts +41 -0
  102. package/dist/src/lib/route-utils.d.ts.map +1 -0
  103. package/dist/src/lib/route-utils.js +78 -0
  104. package/dist/src/lib/routing-config.d.ts +32 -0
  105. package/dist/src/lib/routing-config.d.ts.map +1 -0
  106. package/dist/src/lib/routing-config.js +93 -0
  107. package/dist/src/lib/serialize-props.d.ts +6 -0
  108. package/dist/src/lib/serialize-props.d.ts.map +1 -0
  109. package/dist/src/lib/serialize-props.js +7 -0
  110. package/dist/src/lib/virtual-module-generators.d.ts +57 -0
  111. package/dist/src/lib/virtual-module-generators.d.ts.map +1 -0
  112. package/dist/src/lib/virtual-module-generators.js +263 -0
  113. package/dist/src/lib/withHydration.d.ts +51 -0
  114. package/dist/src/lib/withHydration.d.ts.map +1 -0
  115. package/dist/src/lib/withHydration.js +49 -0
  116. package/dist/src/loader.d.ts +14 -0
  117. package/dist/src/loader.d.ts.map +1 -0
  118. package/dist/src/loader.js +89 -0
  119. package/dist/src/locales-helpers.d.ts +61 -0
  120. package/dist/src/locales-helpers.d.ts.map +1 -0
  121. package/dist/src/locales-helpers.js +49 -0
  122. package/dist/src/mime-types.d.ts +3 -0
  123. package/dist/src/mime-types.d.ts.map +1 -0
  124. package/dist/src/mime-types.js +19 -0
  125. package/dist/src/path-validation.d.ts +8 -0
  126. package/dist/src/path-validation.d.ts.map +1 -0
  127. package/dist/src/path-validation.js +12 -0
  128. package/dist/src/plugin-spa.d.ts +164 -0
  129. package/dist/src/plugin-spa.d.ts.map +1 -0
  130. package/dist/src/plugin-spa.js +972 -0
  131. package/dist/src/safe-json-stringify.d.ts +13 -0
  132. package/dist/src/safe-json-stringify.d.ts.map +1 -0
  133. package/dist/src/safe-json-stringify.js +6 -0
  134. package/dist/src/site-styles/content-wrapper-endpoint.d.ts +76 -0
  135. package/dist/src/site-styles/content-wrapper-endpoint.d.ts.map +1 -0
  136. package/dist/src/site-styles/content-wrapper-endpoint.js +227 -0
  137. package/dist/src/site-styles/render-endpoint.d.ts +55 -0
  138. package/dist/src/site-styles/render-endpoint.d.ts.map +1 -0
  139. package/dist/src/site-styles/render-endpoint.js +263 -0
  140. package/dist/src/site-styles/styles-endpoint.d.ts +61 -0
  141. package/dist/src/site-styles/styles-endpoint.d.ts.map +1 -0
  142. package/dist/src/site-styles/styles-endpoint.js +158 -0
  143. package/dist/src/types.d.ts +627 -0
  144. package/dist/src/types.d.ts.map +1 -0
  145. package/dist/src/types.js +1 -0
  146. package/dist/{types-CVQNmPxF.d.mts → types-CS9neadI.d.mts} +193 -3
  147. package/dist/types-CS9neadI.d.mts.map +1 -0
  148. package/dist/virtual-modules.d.ts +155 -0
  149. package/dist/{withHydration-EzyzBQ-Y.mjs → withHydration-C256ox_6.mjs} +2 -2
  150. package/dist/{withHydration-EzyzBQ-Y.mjs.map → withHydration-C256ox_6.mjs.map} +1 -1
  151. package/dist/{withHydration-HIvO9ysY.d.mts → withHydration-DkKpkmzJ.d.mts} +1 -2
  152. package/dist/withHydration-DkKpkmzJ.d.mts.map +1 -0
  153. package/package.json +82 -26
  154. package/dist/collections.mjs.map +0 -1
  155. package/dist/hydration-scanner-B0NjYkZ_.mjs +0 -109
  156. package/dist/hydration-scanner-B0NjYkZ_.mjs.map +0 -1
  157. package/dist/loader-By-AQWHc.mjs +0 -68
  158. package/dist/loader-By-AQWHc.mjs.map +0 -1
  159. package/dist/types-CVQNmPxF.d.mts.map +0 -1
  160. package/dist/withHydration-HIvO9ysY.d.mts.map +0 -1
@@ -0,0 +1,627 @@
1
+ import type { Data } from '@puckeditor/core';
2
+ /**
3
+ * Hydration strategy for Puck components in production.
4
+ *
5
+ * Determines when a component's React code loads and hydrates on the client.
6
+ * Only components with explicit hydration strategy will ship JavaScript.
7
+ *
8
+ * @example In puck.config.tsx
9
+ * ```typescript
10
+ * const FilteredGrid: ComponentConfig<Props> & { hydration?: HydrationStrategy } = {
11
+ * hydration: 'visible', // Hydrate when scrolled into view
12
+ * fields: { ... },
13
+ * render: (props) => <FilteredGridComponent {...props} />,
14
+ * }
15
+ * ```
16
+ *
17
+ * Strategies:
18
+ * - 'none': No hydration, pure static HTML (default, current behavior)
19
+ * - 'load': Hydrate immediately on page load (client:load)
20
+ * - 'visible': Hydrate when component enters viewport (client:visible)
21
+ * - 'idle': Hydrate when browser is idle (client:idle)
22
+ */
23
+ export type HydrationStrategy = 'none' | 'load' | 'visible' | 'idle';
24
+ /**
25
+ * Configuration for Conloca's content page routing system.
26
+ *
27
+ * The routing system allows sites to declare which URL patterns
28
+ * map to which content collections, eliminating the need for
29
+ * manual [...slug].astro files.
30
+ *
31
+ * @example Minimal configuration (uses all defaults)
32
+ * ```typescript
33
+ * conlocaCMS({
34
+ * contentRoot: '../content',
35
+ * puckConfigPath: './src/puck.config.tsx',
36
+ * routing: true, // Enable with all defaults
37
+ * });
38
+ * ```
39
+ *
40
+ * @example Full configuration
41
+ * ```typescript
42
+ * conlocaCMS({
43
+ * contentRoot: '../content',
44
+ * puckConfigPath: './src/puck.config.tsx',
45
+ * routing: {
46
+ * enabled: true,
47
+ * routes: {
48
+ * pages: {
49
+ * pattern: '/[...slug]',
50
+ * collection: 'pages',
51
+ * layout: './src/layouts/Layout.astro',
52
+ * prerender: true,
53
+ * },
54
+ * blog: {
55
+ * pattern: '/blog/[slug]',
56
+ * collection: 'posts',
57
+ * layout: './src/layouts/BlogLayout.astro',
58
+ * },
59
+ * },
60
+ * fallback: '404',
61
+ * },
62
+ * });
63
+ * ```
64
+ */
65
+ export interface RoutingConfig {
66
+ /**
67
+ * Whether routing is enabled.
68
+ *
69
+ * When false, no content routes are injected and sites must
70
+ * handle routing manually (backward-compatible mode).
71
+ *
72
+ * @default true (when routing config object is provided)
73
+ */
74
+ enabled?: boolean;
75
+ /**
76
+ * Route definitions mapping URL patterns to content collections.
77
+ *
78
+ * Each key is a route identifier (for debugging/logging).
79
+ * The value defines how that route behaves.
80
+ *
81
+ * If not provided, a default 'pages' route is created:
82
+ * - pattern: '/[...slug]'
83
+ * - collection: 'pages' (auto-discovered from content)
84
+ * - layout: undefined (uses default Astro layout behavior)
85
+ * - prerender: true
86
+ *
87
+ * @default { pages: { pattern: '/[...slug]', collection: 'pages', prerender: true } }
88
+ */
89
+ routes?: Record<string, RouteConfig>;
90
+ /**
91
+ * Behavior when a route pattern matches but no content exists.
92
+ *
93
+ * - '404': Return a 404 response (standard behavior)
94
+ * - 'passthrough': Let Astro continue to the next route handler
95
+ *
96
+ * 'passthrough' is useful when you have both CMS-managed pages
97
+ * and file-based pages coexisting during migration.
98
+ *
99
+ * @default '404'
100
+ */
101
+ fallback?: '404' | 'passthrough';
102
+ /**
103
+ * What to do when an injected route conflicts with an existing file-based route.
104
+ *
105
+ * - 'warn': Log a warning but proceed (injected route takes precedence)
106
+ * - 'error': Fail the build with an error
107
+ * - 'silent': No message (injected route takes precedence)
108
+ *
109
+ * Conflicts are detected during the 'astro:routes:resolved' hook.
110
+ *
111
+ * @default 'warn'
112
+ */
113
+ onConflict?: 'warn' | 'error' | 'silent';
114
+ /**
115
+ * Site name for content resolution.
116
+ *
117
+ * Used by PageAPI to call contentApi.getSite(siteName).
118
+ * Allows multi-site content directories with a single configuration.
119
+ *
120
+ * @example Multi-site setup with different content directories
121
+ * ```typescript
122
+ * conlocaCMS({
123
+ * contentRoot: '../content',
124
+ * routing: {
125
+ * enabled: true,
126
+ * siteName: 'marketing', // Load content from 'marketing' site
127
+ * },
128
+ * });
129
+ * ```
130
+ *
131
+ * @default 'default'
132
+ */
133
+ siteName?: string;
134
+ /**
135
+ * Default locale for content resolution.
136
+ *
137
+ * Used by PageAPI for listPages(locale) and getByPathname(pathname, locale).
138
+ * Can be extended later for multi-locale routing.
139
+ *
140
+ * @example Non-English content site
141
+ * ```typescript
142
+ * conlocaCMS({
143
+ * contentRoot: '../content',
144
+ * routing: {
145
+ * enabled: true,
146
+ * locale: 'de', // German content
147
+ * },
148
+ * });
149
+ * ```
150
+ *
151
+ * @default 'en'
152
+ */
153
+ locale?: string;
154
+ }
155
+ /**
156
+ * Shorthand for enabling routing with all defaults.
157
+ *
158
+ * When `routing: true` is passed, it's equivalent to:
159
+ * ```typescript
160
+ * routing: {
161
+ * enabled: true,
162
+ * routes: { pages: { pattern: '/[...slug]', collection: 'pages', prerender: true } },
163
+ * fallback: '404',
164
+ * onConflict: 'warn',
165
+ * }
166
+ * ```
167
+ */
168
+ export type RoutingConfigInput = boolean | RoutingConfig;
169
+ /**
170
+ * Configuration for a single route mapping.
171
+ *
172
+ * Defines how a URL pattern maps to content from a collection,
173
+ * which layout to use, and rendering behavior.
174
+ *
175
+ * @example Catch-all pages route
176
+ * ```typescript
177
+ * {
178
+ * pattern: '/[...slug]',
179
+ * collection: 'pages',
180
+ * layout: './src/layouts/Layout.astro',
181
+ * prerender: true,
182
+ * }
183
+ * ```
184
+ *
185
+ * @example Blog route with specific prefix
186
+ * ```typescript
187
+ * {
188
+ * pattern: '/blog/[slug]',
189
+ * collection: 'posts',
190
+ * layout: './src/layouts/BlogLayout.astro',
191
+ * prerender: true,
192
+ * }
193
+ * ```
194
+ *
195
+ * @example SSR route (no static generation)
196
+ * ```typescript
197
+ * {
198
+ * pattern: '/preview/[...slug]',
199
+ * collection: 'pages',
200
+ * prerender: false,
201
+ * }
202
+ * ```
203
+ */
204
+ export interface RouteConfig {
205
+ /**
206
+ * Astro route pattern for URL matching.
207
+ *
208
+ * Must be a valid Astro route pattern:
209
+ * - '/about' - Exact match
210
+ * - '/blog/[slug]' - Single dynamic segment
211
+ * - '/[...slug]' - Catch-all (rest parameter)
212
+ * - '/docs/[...path]' - Catch-all with prefix
213
+ *
214
+ * The pattern is passed directly to Astro's injectRoute() API.
215
+ *
216
+ * IMPORTANT: Pattern must start with '/'
217
+ * IMPORTANT: Catch-all patterns ([...param]) capture everything after the prefix
218
+ */
219
+ pattern: string;
220
+ /**
221
+ * Content collection to use for this route.
222
+ *
223
+ * Must match a collection in the content directory.
224
+ * Typically 'pages' for general content or a specific
225
+ * collection like 'posts' for blog content.
226
+ *
227
+ * If not specified, defaults to 'pages'.
228
+ *
229
+ * The collection is used to:
230
+ * 1. Discover available paths for getStaticPaths()
231
+ * 2. Load page data for the matched route
232
+ *
233
+ * @default 'pages'
234
+ */
235
+ collection?: string;
236
+ /**
237
+ * Path to the Astro layout component.
238
+ *
239
+ * The layout wraps the Puck-rendered content. It receives
240
+ * LayoutProps with page metadata and children.
241
+ *
242
+ * Path resolution:
243
+ * - Relative paths (./src/...) resolve from project root
244
+ * - Can be an Astro component (.astro) or React component (.tsx)
245
+ *
246
+ * If not specified, the page handler renders content without
247
+ * a layout wrapper (Puck content only).
248
+ *
249
+ * @example './src/layouts/Layout.astro'
250
+ * @example './src/layouts/BlogLayout.tsx'
251
+ */
252
+ layout?: string;
253
+ /**
254
+ * Whether to statically generate pages at build time.
255
+ *
256
+ * - true: Generate static HTML at build time (SSG)
257
+ * - false: Render on each request (SSR)
258
+ *
259
+ * SSG (true) is recommended for most content sites:
260
+ * - Faster page loads
261
+ * - Lower hosting costs
262
+ * - Works with static hosting
263
+ *
264
+ * SSR (false) is useful for:
265
+ * - Preview routes
266
+ * - Personalized content
267
+ * - Frequently updated content
268
+ *
269
+ * @default true
270
+ */
271
+ prerender?: boolean;
272
+ /**
273
+ * Additional route metadata passed to the page handler.
274
+ *
275
+ * This allows route-specific customization that the
276
+ * layout or page handler can access.
277
+ *
278
+ * @example { showSidebar: true, theme: 'dark' }
279
+ */
280
+ meta?: Record<string, unknown>;
281
+ /**
282
+ * Data binding configuration for this route.
283
+ *
284
+ * Specifies which data collections should be fetched and
285
+ * injected into Puck component resolvers via metadata.
286
+ *
287
+ * @example Inject team and testimonials data
288
+ * ```typescript
289
+ * {
290
+ * pattern: '/[...slug]',
291
+ * dataBindings: {
292
+ * collections: ['team', 'testimonials'],
293
+ * },
294
+ * }
295
+ * ```
296
+ */
297
+ dataBindings?: DataBindingConfig;
298
+ }
299
+ /**
300
+ * Complete page data for rendering.
301
+ *
302
+ * This is what the page-handler.astro receives after
303
+ * loading content from the matched route.
304
+ *
305
+ * Contains:
306
+ * - Puck editor data for rendering
307
+ * - Page metadata for SEO/layouts
308
+ * - Route information for context
309
+ */
310
+ export interface PageData {
311
+ /**
312
+ * Unique page identifier from the content collection.
313
+ *
314
+ * Typically matches the URL path (e.g., 'about', 'blog/post-1').
315
+ */
316
+ id: string;
317
+ /**
318
+ * Page title from content metadata.
319
+ *
320
+ * Used for:
321
+ * - <title> tag
322
+ * - Layout heading
323
+ * - Navigation/breadcrumbs
324
+ *
325
+ * May be undefined if page has no title set.
326
+ */
327
+ title?: string;
328
+ /**
329
+ * Page description for SEO.
330
+ *
331
+ * Used for:
332
+ * - <meta name="description">
333
+ * - Social sharing previews
334
+ */
335
+ description?: string;
336
+ /**
337
+ * URL pathname for this page.
338
+ *
339
+ * Always starts with '/' and matches the route pattern.
340
+ *
341
+ * @example '/about'
342
+ * @example '/blog/my-first-post'
343
+ */
344
+ pathname: string;
345
+ /**
346
+ * Puck editor data for rendering.
347
+ *
348
+ * This is the Data object from @puckeditor/core containing:
349
+ * - root: Root component props
350
+ * - content: Array of component instances
351
+ * - zones: Named drop zones with nested content
352
+ *
353
+ * Passed directly to <Render config={} data={puckData} />
354
+ */
355
+ puckData: Data;
356
+ /**
357
+ * Content collection this page belongs to.
358
+ *
359
+ * @example 'pages', 'posts', 'docs'
360
+ */
361
+ collection: string;
362
+ /**
363
+ * Route configuration that matched this page.
364
+ *
365
+ * Includes the pattern, layout path, and any meta.
366
+ * Useful for conditional rendering based on route.
367
+ */
368
+ route: {
369
+ /**
370
+ * Route identifier from the config.
371
+ * @example 'pages', 'blog'
372
+ */
373
+ name: string;
374
+ /**
375
+ * Original pattern from RouteConfig.
376
+ */
377
+ pattern: string;
378
+ /**
379
+ * Route-specific metadata if configured.
380
+ */
381
+ meta?: Record<string, unknown>;
382
+ };
383
+ /**
384
+ * Additional page metadata from content.
385
+ *
386
+ * Custom fields stored in the page's frontmatter/metadata.
387
+ * Schema depends on the site's content configuration.
388
+ */
389
+ meta?: Record<string, unknown>;
390
+ /**
391
+ * Timestamps for the page content.
392
+ */
393
+ timestamps?: {
394
+ /**
395
+ * When the page was first created.
396
+ */
397
+ created?: Date;
398
+ /**
399
+ * When the page was last modified.
400
+ */
401
+ modified?: Date;
402
+ /**
403
+ * When the page was published (if different from created).
404
+ */
405
+ published?: Date;
406
+ };
407
+ }
408
+ /**
409
+ * Props passed to layout components wrapping page content.
410
+ *
411
+ * Layouts receive common props (title, description) that work with
412
+ * most existing layouts. No special Conloca-specific layout needed.
413
+ *
414
+ * @example Astro layout usage
415
+ * ```astro
416
+ * ---
417
+ * interface Props {
418
+ * title: string;
419
+ * description?: string;
420
+ * }
421
+ *
422
+ * const { title, description } = Astro.props;
423
+ * ---
424
+ *
425
+ * <html>
426
+ * <head>
427
+ * <title>{title}</title>
428
+ * {description && <meta name="description" content={description} />}
429
+ * </head>
430
+ * <body>
431
+ * <slot />
432
+ * </body>
433
+ * </html>
434
+ * ```
435
+ *
436
+ * @example React layout usage
437
+ * ```tsx
438
+ * interface LayoutProps {
439
+ * title: string;
440
+ * description?: string;
441
+ * children: React.ReactNode;
442
+ * }
443
+ *
444
+ * export default function Layout({ title, children }: LayoutProps) {
445
+ * return (
446
+ * <div className="layout">
447
+ * <header>
448
+ * <h1>{title}</h1>
449
+ * </header>
450
+ * <main>{children}</main>
451
+ * </div>
452
+ * );
453
+ * }
454
+ * ```
455
+ */
456
+ export interface LayoutProps {
457
+ /**
458
+ * Page title for the document head.
459
+ */
460
+ title: string;
461
+ /**
462
+ * Page description for SEO meta tag.
463
+ */
464
+ description?: string;
465
+ /**
466
+ * The rendered Puck content.
467
+ *
468
+ * In Astro layouts, use <slot /> instead of {children}.
469
+ * In React layouts, render {children} in the content area.
470
+ */
471
+ children?: unknown;
472
+ }
473
+ /**
474
+ * Layout component type for Astro.
475
+ *
476
+ * Layouts must accept LayoutProps and render a page shell
477
+ * with the provided content.
478
+ */
479
+ export type LayoutComponent = (props: LayoutProps) => unknown;
480
+ /**
481
+ * Resolved routing configuration with all fields required.
482
+ *
483
+ * This is what the page handler receives via the virtual module,
484
+ * with all defaults applied.
485
+ */
486
+ export interface ResolvedRoutingConfig {
487
+ enabled: boolean;
488
+ routes: Record<string, Required<RouteConfig>>;
489
+ fallback: '404' | 'passthrough';
490
+ onConflict: 'warn' | 'error' | 'silent';
491
+ /** Site name for content resolution. */
492
+ siteName: string;
493
+ /** Default locale for content resolution. */
494
+ locale: string;
495
+ }
496
+ /**
497
+ * Configuration for automatic data collection injection into Puck components.
498
+ *
499
+ * Allows components to declare data dependencies on Conloca data collections,
500
+ * which are automatically fetched and injected via Puck's metadata system.
501
+ *
502
+ * @example Route with data bindings
503
+ * ```typescript
504
+ * conlocaCMS({
505
+ * routing: {
506
+ * routes: {
507
+ * pages: {
508
+ * pattern: '/[...slug]',
509
+ * dataBindings: {
510
+ * collections: ['team', 'testimonials'],
511
+ * },
512
+ * },
513
+ * },
514
+ * },
515
+ * });
516
+ * ```
517
+ */
518
+ export interface DataBindingConfig {
519
+ /**
520
+ * Collections to fetch and inject into component resolvers.
521
+ *
522
+ * Each collection name must match a data collection in the content directory.
523
+ * The fetched data will be available in `metadata.collections[collectionName]`
524
+ * within Puck component resolvers.
525
+ *
526
+ * @example ['team', 'testimonials', 'products']
527
+ */
528
+ collections?: string[];
529
+ /**
530
+ * Locale override for data fetching.
531
+ *
532
+ * Defaults to the route's locale setting (from routing.locale).
533
+ * Use this to fetch data in a specific locale regardless of route config.
534
+ */
535
+ locale?: string;
536
+ /**
537
+ * Page discovery configuration for listing pages by path prefix.
538
+ *
539
+ * Enables components to access lists of pages matching a URL pattern,
540
+ * useful for blog listings, category pages, and site navigation.
541
+ *
542
+ * @example Blog listing page
543
+ * ```typescript
544
+ * {
545
+ * pattern: '/blog',
546
+ * dataBindings: {
547
+ * pages: {
548
+ * prefix: '/blog/',
549
+ * sort: 'date-desc',
550
+ * limit: 10,
551
+ * },
552
+ * },
553
+ * }
554
+ * ```
555
+ */
556
+ pages?: {
557
+ /**
558
+ * Path prefix to filter pages.
559
+ *
560
+ * Only pages whose pathname starts with this prefix are included.
561
+ * The listing page itself is excluded.
562
+ *
563
+ * @example '/blog/' matches '/blog/post-1', '/blog/post-2'
564
+ */
565
+ prefix: string;
566
+ /**
567
+ * Maximum number of pages to return.
568
+ *
569
+ * Useful for showing "latest N posts" on a homepage or sidebar.
570
+ */
571
+ limit?: number;
572
+ /**
573
+ * Sort order for returned pages.
574
+ *
575
+ * - 'date-desc': Newest first (by modified/created date)
576
+ * - 'date-asc': Oldest first
577
+ * - 'title': Alphabetical by title
578
+ *
579
+ * @default 'date-desc'
580
+ */
581
+ sort?: 'date-desc' | 'date-asc' | 'title';
582
+ };
583
+ }
584
+ export type { DataCollectionEntry, DataContext, PageReference } from '@conloca/content-api';
585
+ /**
586
+ * Configuration for a page creation template.
587
+ *
588
+ * Templates allow sites to define pre-built page structures
589
+ * that users can select when creating new pages in the CMS.
590
+ *
591
+ * @example Blog template configuration
592
+ * ```typescript
593
+ * conlocaCMS({
594
+ * templates: {
595
+ * blog: {
596
+ * label: 'Blog Post',
597
+ * component: 'BlogPostTemplate',
598
+ * pathPrefix: '/blog/',
599
+ * },
600
+ * },
601
+ * });
602
+ * ```
603
+ */
604
+ export interface TemplateConfig {
605
+ /**
606
+ * Display label shown in the template dropdown.
607
+ * @example 'Blog Post', 'Landing Page', 'Documentation'
608
+ */
609
+ label: string;
610
+ /**
611
+ * Puck component name to pre-drop into the page.
612
+ * Must match a component registered in the site's puck.config.
613
+ * @example 'BlogPostTemplate', 'LandingPageTemplate'
614
+ */
615
+ component: string;
616
+ /**
617
+ * Optional path prefix to auto-apply when this template is selected.
618
+ * If the user's path doesn't start with this prefix, it's added.
619
+ * @example '/blog/' will turn '/my-post' into '/blog/my-post'
620
+ */
621
+ pathPrefix?: string;
622
+ /**
623
+ * Optional description shown in the dropdown.
624
+ */
625
+ description?: string;
626
+ }
627
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH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