@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,164 @@
1
+ import type { UIConfig } from '@conloca/cms-spa';
2
+ import type { AstroIntegration } from 'astro';
3
+ import type { ConlocaLocales } from './locales-helpers.js';
4
+ import type { RoutingConfigInput, TemplateConfig } from './types.js';
5
+ export interface ConlocaCMSOptions extends Omit<UIConfig, 'basename'> {
6
+ contentRoot: string;
7
+ canvasDir?: string;
8
+ route?: string;
9
+ puckConfigPath: string;
10
+ schemasPath?: string;
11
+ /**
12
+ * Default layout for content pages.
13
+ * When provided without routing config, enables routing with catch-all pattern.
14
+ * For multi-route setups, use routing.routes.{name}.layout instead.
15
+ *
16
+ * @example './src/layouts/Layout.astro'
17
+ */
18
+ layout?: string;
19
+ routing?: RoutingConfigInput;
20
+ templates?: Record<string, TemplateConfig>;
21
+ /**
22
+ * Paths to scan for hydratable components.
23
+ * Components using withHydration() in these directories are auto-discovered.
24
+ *
25
+ * @example ['src/components/puck']
26
+ */
27
+ componentPaths?: string[];
28
+ /**
29
+ * Folders to scan for locally-authored MDX components. Their
30
+ * `interface Props { ... }` is parsed into the editor's prop
31
+ * panel automatically — no hand-written descriptors needed.
32
+ *
33
+ * Combined with the MDX usage scan (which picks up imports from
34
+ * npm packages like `@astrojs/starlight/components`), this powers
35
+ * the auto-discover registry served at `/__cms/api/registry`.
36
+ *
37
+ * Paths are project-relative. Defaults to `['src/components/mdx']`.
38
+ *
39
+ * @example ['src/components/mdx', 'src/components/blocks']
40
+ */
41
+ mdxComponentFolders?: string[];
42
+ /**
43
+ * Path to the assets directory for image uploads.
44
+ * When provided, enables the Media Library and asset upload API routes.
45
+ *
46
+ * @example 'src/assets/uploads'
47
+ */
48
+ assetsPath?: string;
49
+ /**
50
+ * CSS files to load in the CMS editor for component preview styling.
51
+ *
52
+ * Each file is processed by Vite (Tailwind, PostCSS, etc.) and injected
53
+ * directly into Puck's preview iframe `<head>`. Site CSS never enters the
54
+ * CMS admin's parent document, so host-site styles cannot bleed into the
55
+ * CMS chrome (drawer, sidebar, etc.).
56
+ *
57
+ * @example './src/styles/global.css'
58
+ * @example ['./src/styles/global.css', './src/styles/theme.css']
59
+ */
60
+ siteStyles?: string | string[];
61
+ /**
62
+ * Narrow CSS path injected into the MDX editor's admin document while the
63
+ * editor is mounted. Use this to ship host-component styling
64
+ * (`.conloca-aside`, `.conloca-card`, etc.) so the editor preview matches
65
+ * the published surface, WITHOUT pulling in host Tailwind utilities or
66
+ * `:root` token overrides that would collide with admin chrome.
67
+ *
68
+ * What belongs here: stylesheets that target only host-component class
69
+ * selectors. Examples: `./src/styles/asides.css`,
70
+ * `./src/styles/starlight-components.css`, `./src/styles/code-blocks.css`.
71
+ *
72
+ * What does NOT belong: the host's `global.css` (Tailwind base, theme,
73
+ * utilities), `prose.css` (already loaded by `@conloca/mdx`), or any
74
+ * stylesheet with `body`, `:root`, or `*` rules that would override
75
+ * admin chrome. Those go in `siteStyles` instead — that path is only
76
+ * injected into the Puck iframe, never the admin shell.
77
+ *
78
+ * @example ['./src/styles/asides.css', './src/styles/starlight-components.css']
79
+ */
80
+ editorStyles?: string | string[];
81
+ /**
82
+ * Route URL whose styles + content-wrapper shape get applied when
83
+ * editing a standalone BLOCK (not a page). Blocks aren't tied to a
84
+ * specific route, but they're consumed inside pages — so the
85
+ * authoring experience should look like the user's actual site. The
86
+ * editor fetches this route's CSS (via `/api/styles?url=…`) and its
87
+ * content-root wrapper (via `/api/content-wrapper?url=…`) the same
88
+ * way it does for pages, then renders the block inside that frame.
89
+ *
90
+ * Pick a representative content page on your site — typically the
91
+ * site root or a docs landing page. Hosts that ship rich typography
92
+ * benefit most; for hosts whose body bg matches the editor chrome,
93
+ * the value barely matters. Defaults to `/` (site root).
94
+ *
95
+ * Per-block overrides via block frontmatter remain on the roadmap
96
+ * for cases where one block ships only inside a specific layout.
97
+ *
98
+ * @example '/getting-started/'
99
+ */
100
+ blockPreviewRoute?: string;
101
+ /**
102
+ * Inline CSS to inject into the editor's `conloca-host-preview`
103
+ * layer, applied AFTER auto-discovered host stylesheets. The
104
+ * editor's content surround, prose card, and individual MDX
105
+ * components all surface here; anything you write at this layer
106
+ * wins on cascade order against the auto-discovery output (same
107
+ * specificity, later layer position).
108
+ *
109
+ * Use for one-off overrides when:
110
+ * - Your host body bg doesn't read well behind the editor chrome
111
+ * and you want a specific color regardless.
112
+ * - You want a different prose surface only inside the editor
113
+ * (eg lighter for accessibility while authoring).
114
+ * - A component renders correctly on the published page but
115
+ * needs a small visual tweak in the editor — toolbar gutter,
116
+ * focus ring, etc.
117
+ *
118
+ * Pure raw CSS. Conloca does no scoping or transformation, so any
119
+ * selector you write needs to be specific enough not to leak into
120
+ * the admin chrome (the chrome's selectors live in the `cms-admin`
121
+ * layer, which sits LOWER in the cascade — so without explicitly
122
+ * naming admin selectors, your CSS only reaches host components
123
+ * and the content surround).
124
+ *
125
+ * @example `
126
+ * /* Force a darker editor body even though the live page is light. *\/
127
+ * body { background-color: #0a0a0f; }
128
+ * /* Custom focus ring for the prose surface. *\/
129
+ * .conloca-prose--editor:focus-within { outline: 2px solid hotpink; }
130
+ * `
131
+ */
132
+ editorCSS?: string;
133
+ /**
134
+ * The site's supported locales and default locale.
135
+ *
136
+ * When set, Conloca uses this list as the single source of truth for
137
+ * locale detection — folders or filename suffixes that don't match
138
+ * one of these locales are left in the slug rather than silently
139
+ * classified as a language. When omitted, falls back to the
140
+ * `globalLocales` field in `<contentRoot>/sites.json` (the existing
141
+ * behavior; preserved for backwards compatibility).
142
+ *
143
+ * Use one of the framework-bridge helpers exported from
144
+ * `@conloca/astro-cms` to keep the declaration in a single spot:
145
+ *
146
+ * @example Pass Astro's i18n config directly:
147
+ * ```ts
148
+ * import { conlocaCMS, localesFromAstroI18n } from '@conloca/astro-cms';
149
+ * const i18n = { defaultLocale: 'en', locales: ['en', 'de'] };
150
+ * defineConfig({
151
+ * i18n,
152
+ * integrations: [conlocaCMS({ locales: localesFromAstroI18n(i18n) })],
153
+ * });
154
+ * ```
155
+ *
156
+ * @example Pass a literal list:
157
+ * ```ts
158
+ * conlocaCMS({ locales: { list: ['en', 'de'], defaultLocale: 'en' } });
159
+ * ```
160
+ */
161
+ locales?: ConlocaLocales;
162
+ }
163
+ export declare function conlocaCMS(options: ConlocaCMSOptions): AstroIntegration;
164
+ //# sourceMappingURL=plugin-spa.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-spa.d.ts","sourceRoot":"","sources":["../../src/plugin-spa.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAK9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAgC3D,OAAO,KAAK,EAAyB,kBAAkB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAgC5F,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC;IACnE,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAE3C;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAE1B;;;;;;;;;;;;OAYG;IACH,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE/B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;;;;;;OAUG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE/B;;;;;;;;;;;;;;;;;;OAkBG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAEjC;;;;;;;;;;;;;;;;;;OAkBG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B;AAqKD,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,CAm0BvE"}