fimo 0.14.0 → 0.15.0-staging.2

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 (199) hide show
  1. package/README.md +1 -0
  2. package/assets/astro/components/Boolean.astro +14 -0
  3. package/assets/astro/components/Date.astro +23 -0
  4. package/assets/astro/components/Image.astro +79 -0
  5. package/assets/astro/components/Json.astro +14 -0
  6. package/assets/astro/components/RichText.astro +17 -0
  7. package/assets/astro/components/StaticImage.astro +66 -0
  8. package/assets/astro/components/Text.astro +23 -0
  9. package/assets/astro/components/Video.astro +47 -0
  10. package/assets/astro/components/index.d.ts +8 -0
  11. package/assets/astro/components/index.js +8 -0
  12. package/assets/content-templates/shared/server.eta +56 -0
  13. package/assets/content-templates/sveltekit/content.eta +86 -0
  14. package/assets/skills/fimo/SKILL.md +13 -4
  15. package/assets/skills/fimo-cli/SKILL.md +28 -28
  16. package/assets/skills/fimo-cli/references/account.md +0 -2
  17. package/assets/skills/fimo-cli/references/agent-setup.md +7 -9
  18. package/assets/skills/fimo-cli/references/agents.md +0 -2
  19. package/assets/skills/fimo-cli/references/analytics.md +0 -2
  20. package/assets/skills/fimo-cli/references/assets.md +2 -4
  21. package/assets/skills/fimo-cli/references/branches.md +14 -15
  22. package/assets/skills/fimo-cli/references/content.md +9 -11
  23. package/assets/skills/fimo-cli/references/credits.md +0 -2
  24. package/assets/skills/fimo-cli/references/deploy.md +6 -7
  25. package/assets/skills/fimo-cli/references/describe.md +1 -3
  26. package/assets/skills/fimo-cli/references/domains.md +0 -2
  27. package/assets/skills/fimo-cli/references/forms.md +5 -7
  28. package/assets/skills/fimo-cli/references/history.md +0 -2
  29. package/assets/skills/fimo-cli/references/init.md +34 -26
  30. package/assets/skills/fimo-cli/references/integrations/firecrawl.md +0 -2
  31. package/assets/skills/fimo-cli/references/integrations.md +0 -2
  32. package/assets/skills/fimo-cli/references/invite.md +0 -2
  33. package/assets/skills/fimo-cli/references/labels.md +5 -7
  34. package/assets/skills/fimo-cli/references/locales.md +2 -4
  35. package/assets/skills/fimo-cli/references/mcp.md +2 -4
  36. package/assets/skills/fimo-cli/references/media.md +0 -2
  37. package/assets/skills/fimo-cli/references/preview.md +0 -2
  38. package/assets/skills/fimo-cli/references/project-vars-and-secrets.md +1 -3
  39. package/assets/skills/fimo-cli/references/projects.md +1 -3
  40. package/assets/skills/fimo-cli/references/schedules.md +0 -2
  41. package/assets/skills/fimo-cli/references/support.md +0 -2
  42. package/assets/skills/fimo-cli/references/webhooks.md +0 -2
  43. package/assets/skills/fimo-code/SKILL.md +11 -3
  44. package/assets/skills/fimo-code/references/assets.md +2 -2
  45. package/assets/skills/fimo-code/references/content/clients.md +5 -1
  46. package/assets/skills/fimo-code/references/content.md +3 -1
  47. package/assets/skills/fimo-code/references/frameworks/astro.md +127 -0
  48. package/assets/skills/fimo-code/references/frameworks/compatibility.md +19 -0
  49. package/assets/skills/fimo-code/references/frameworks/hosting.md +15 -3
  50. package/assets/skills/fimo-code/references/frameworks/react-router.md +37 -209
  51. package/assets/skills/fimo-code/references/frameworks/sveltekit.md +110 -0
  52. package/assets/skills/fimo-code/references/frameworks/vite-react.md +35 -166
  53. package/assets/skills/fimo-code/references/labels.md +16 -6
  54. package/assets/skills/fimo-code/references/locales.md +3 -1
  55. package/assets/skills/fimo-code/references/ui.md +19 -15
  56. package/assets/skills/fimo-migration/SKILL.md +99 -146
  57. package/assets/skills/fimo-migration/references/frameworks/nextjs.md +26 -0
  58. package/assets/skills/fimo-migration/references/inventory/coordinator.md +40 -0
  59. package/assets/skills/fimo-migration/references/inventory/locales/next-intl.md +39 -0
  60. package/assets/skills/fimo-migration/references/inventory/locales.md +41 -0
  61. package/assets/skills/fimo-migration/references/workflow.md +3 -2
  62. package/assets/skills/fimo-migration/scripts/inventory/locales/next-intl.mjs +459 -0
  63. package/assets/skills/fimo-studio/SKILL.md +1 -1
  64. package/assets/skills/fimo-studio/references/project-creation.md +10 -18
  65. package/assets/starters/fimo-site/template/.fimo/agents/content-guide/capabilities.yaml +0 -1
  66. package/assets/starters/fimo-site/template/.fimo/agents/site-review/capabilities.yaml +0 -1
  67. package/assets/sveltekit/components/Boolean.svelte +19 -0
  68. package/assets/sveltekit/components/Date.svelte +33 -0
  69. package/assets/sveltekit/components/FimoProvider.svelte +35 -0
  70. package/assets/sveltekit/components/Image.svelte +80 -0
  71. package/assets/sveltekit/components/Json.svelte +18 -0
  72. package/assets/sveltekit/components/Label.svelte +16 -0
  73. package/assets/sveltekit/components/Number.svelte +21 -0
  74. package/assets/sveltekit/components/RichText.svelte +19 -0
  75. package/assets/sveltekit/components/Text.svelte +30 -0
  76. package/assets/sveltekit/components/Video.svelte +37 -0
  77. package/assets/sveltekit/components/index.d.ts +10 -0
  78. package/assets/sveltekit/components/index.js +10 -0
  79. package/dist/build/astro/config.d.ts +4 -0
  80. package/dist/build/astro/config.js +64 -0
  81. package/dist/build/next/config.js +16 -0
  82. package/dist/build/sveltekit/config.d.ts +6 -0
  83. package/dist/build/sveltekit/config.js +8 -0
  84. package/dist/build/sveltekit/data-id.d.ts +3 -0
  85. package/dist/build/sveltekit/data-id.js +171 -0
  86. package/dist/build/sveltekit/vite.d.ts +13 -0
  87. package/dist/build/sveltekit/vite.js +15 -0
  88. package/dist/build/vite/index.js +2 -0
  89. package/dist/build/vite/plugins/data-id.d.ts +9 -0
  90. package/dist/build/vite/plugins/data-id.js +6 -1
  91. package/dist/build/vite/plugins/runtime-env.d.ts +21 -0
  92. package/dist/build/vite/plugins/runtime-env.js +68 -0
  93. package/dist/cli/bundle.json +1 -1
  94. package/dist/cli/index.js +108 -101
  95. package/dist/runtime/app/FimoProviders.d.ts +1 -1
  96. package/dist/runtime/app/FimoProviders.js +11 -5
  97. package/dist/runtime/astro/internal.d.ts +6 -0
  98. package/dist/runtime/astro/internal.js +16 -0
  99. package/dist/runtime/astro/preview.d.ts +14 -0
  100. package/dist/runtime/astro/preview.js +103 -0
  101. package/dist/runtime/astro/render-rich-text.d.ts +2 -0
  102. package/dist/runtime/astro/render-rich-text.js +1 -0
  103. package/dist/runtime/astro/server-runtime.d.ts +3 -0
  104. package/dist/runtime/astro/server-runtime.js +20 -0
  105. package/dist/runtime/astro/server.d.ts +15 -0
  106. package/dist/runtime/astro/server.js +14 -0
  107. package/dist/runtime/content/client/collection-core.d.ts +2 -17
  108. package/dist/runtime/content/client/collection-core.js +15 -8
  109. package/dist/runtime/content/client/core-types.d.ts +96 -0
  110. package/dist/runtime/content/client/core-types.js +1 -0
  111. package/dist/runtime/content/client/internal.d.ts +4 -4
  112. package/dist/runtime/content/client/internal.js +4 -3
  113. package/dist/runtime/content/client/runtime.d.ts +1 -1
  114. package/dist/runtime/content/client/server-content-client.d.ts +3 -3
  115. package/dist/runtime/content/client/server-content-client.js +2 -29
  116. package/dist/runtime/content/client/singleton-core.d.ts +2 -9
  117. package/dist/runtime/content/client/singleton-core.js +9 -4
  118. package/dist/runtime/content/client/types.d.ts +5 -115
  119. package/dist/runtime/content/index.d.ts +3 -3
  120. package/dist/runtime/labels/fetch.js +5 -3
  121. package/dist/runtime/next/client.d.ts +2 -1
  122. package/dist/runtime/next/facade.d.ts +1 -1
  123. package/dist/runtime/next/provider.js +1 -1
  124. package/dist/runtime/next/server-runtime.js +1 -1
  125. package/dist/runtime/next/server.d.ts +5 -4
  126. package/dist/runtime/paths/get-fimo-paths.js +8 -3
  127. package/dist/runtime/preview/bridge.d.ts +8 -0
  128. package/dist/runtime/preview/bridge.js +20 -0
  129. package/dist/runtime/preview/location.d.ts +23 -0
  130. package/dist/runtime/preview/location.js +93 -0
  131. package/dist/runtime/preview/routes.d.ts +10 -0
  132. package/dist/runtime/preview/routes.js +29 -0
  133. package/dist/runtime/primitives/index.d.ts +4 -1
  134. package/dist/runtime/primitives/index.js +1 -0
  135. package/dist/runtime/primitives/lib/image-optimization.d.ts +27 -2
  136. package/dist/runtime/primitives/lib/image-optimization.js +40 -0
  137. package/dist/runtime/primitives/lib/index.d.ts +1 -1
  138. package/dist/runtime/primitives/lib/primitives.d.ts +0 -54
  139. package/dist/runtime/primitives/lib/primitives.js +6 -0
  140. package/dist/runtime/primitives/lib/render-rich-text.d.ts +3 -0
  141. package/dist/runtime/primitives/lib/render-rich-text.js +112 -0
  142. package/dist/runtime/react/primitives/contracts.d.ts +40 -2
  143. package/dist/runtime/react/primitives/renderers/ImageRenderer.js +15 -34
  144. package/dist/runtime/react/primitives/renderers/RichTextRenderer.d.ts +2 -1
  145. package/dist/runtime/react/primitives/renderers/StaticImage.js +13 -30
  146. package/dist/runtime/routing/AppRoutesProvider.js +20 -8
  147. package/dist/runtime/shared/env-identity.d.ts +43 -0
  148. package/dist/runtime/shared/env-identity.js +88 -0
  149. package/dist/runtime/shared/local-runtime-env.d.ts +65 -0
  150. package/dist/runtime/shared/local-runtime-env.js +169 -0
  151. package/dist/runtime/{react-router → shared}/preview-location.d.ts +7 -13
  152. package/dist/runtime/{react-router → shared}/preview-location.js +26 -27
  153. package/dist/runtime/sveltekit/content.d.ts +25 -0
  154. package/dist/runtime/sveltekit/content.js +33 -0
  155. package/dist/runtime/sveltekit/context-contract.d.ts +5 -0
  156. package/dist/runtime/sveltekit/context-contract.js +2 -0
  157. package/dist/runtime/sveltekit/context.d.ts +8 -0
  158. package/dist/runtime/sveltekit/context.js +25 -0
  159. package/dist/runtime/sveltekit/index.d.ts +7 -0
  160. package/dist/runtime/sveltekit/index.js +4 -0
  161. package/dist/runtime/sveltekit/internal.d.ts +6 -0
  162. package/dist/runtime/sveltekit/internal.js +12 -0
  163. package/dist/runtime/sveltekit/labels.d.ts +16 -0
  164. package/dist/runtime/sveltekit/labels.js +13 -0
  165. package/dist/runtime/sveltekit/preview.d.ts +19 -0
  166. package/dist/runtime/sveltekit/preview.js +77 -0
  167. package/dist/runtime/sveltekit/runtime.d.ts +8 -0
  168. package/dist/runtime/sveltekit/runtime.js +17 -0
  169. package/dist/runtime/templates.d.ts +1 -1
  170. package/dist/runtime/templates.js +1 -1
  171. package/dist/runtime/vite/Label.d.ts +13 -0
  172. package/dist/runtime/vite/Label.js +16 -0
  173. package/dist/scripts/extract-translations.js +103 -43
  174. package/dist/scripts/sync-forms.js +1 -1
  175. package/dist/scripts/sync-schemas.js +83 -16
  176. package/package.json +57 -2
  177. package/release.json +2 -2
  178. package/templates/nextjs/AGENTS.md +10 -5
  179. package/templates/nextjs/_gitignore +1 -0
  180. package/templates/react-router/AGENTS.md +4 -3
  181. package/templates/react-router/package.json +1 -1
  182. package/templates/sveltekit/.fimo/config.json +15 -0
  183. package/templates/sveltekit/AGENTS.md +36 -0
  184. package/templates/sveltekit/CLAUDE.md +5 -0
  185. package/templates/sveltekit/_gitignore +16 -0
  186. package/templates/sveltekit/package.json +28 -0
  187. package/templates/sveltekit/pnpm-workspace.yaml +4 -0
  188. package/templates/sveltekit/src/app.html +11 -0
  189. package/templates/sveltekit/src/routes/+layout.server.ts +8 -0
  190. package/templates/sveltekit/src/routes/+layout.svelte +12 -0
  191. package/templates/sveltekit/src/routes/+page.svelte +48 -0
  192. package/templates/sveltekit/svelte.config.js +5 -0
  193. package/templates/sveltekit/tsconfig.json +14 -0
  194. package/templates/sveltekit/vite.config.ts +5 -0
  195. /package/assets/content-templates/{form-template.eta → forms/react.eta} +0 -0
  196. /package/assets/content-templates/{next-client-template.eta → next/client.eta} +0 -0
  197. /package/assets/content-templates/{next-server-template.eta → next/server.eta} +0 -0
  198. /package/assets/content-templates/{hooks-template.eta → react/client.eta} +0 -0
  199. /package/assets/content-templates/{types-template.eta → shared/types.eta} +0 -0
@@ -0,0 +1,110 @@
1
+ # SvelteKit integration
2
+
3
+ Use this reference when `fimo describe --json` reports
4
+ `framework.slug: "sveltekit"`. SvelteKit keeps owning routes, load functions,
5
+ locale resolution, links, document metadata, and SEO.
6
+
7
+ ## Compatibility
8
+
9
+ The adapter targets SvelteKit 2 with Svelte 5. The acceptance baseline currently
10
+ uses SvelteKit `2.70.2`, Svelte `5.56.8`, and Vite `8.2.0`; do not assume that
11
+ SvelteKit 1 or Svelte 4 projects are compatible.
12
+
13
+ ## Connect the Vite plugin
14
+
15
+ Add Fimo's source-tagging plugin alongside SvelteKit's own plugin:
16
+
17
+ ```ts
18
+ import { sveltekit } from '@sveltejs/kit/vite';
19
+ import { fimo } from 'fimo/sveltekit/vite';
20
+ import { defineConfig } from 'vite';
21
+
22
+ export default defineConfig({ plugins: [fimo(), sveltekit()] });
23
+ ```
24
+
25
+ The plugin tags native Svelte elements during `vite dev` so Studio can map
26
+ elements back to source. It does not change production output or own routing.
27
+
28
+ ## Hosted configuration
29
+
30
+ For a new Fimo-hosted SvelteKit project, keep the hosting adapter behind Fimo's
31
+ config seam:
32
+
33
+ ```js
34
+ import { fimo } from 'fimo/sveltekit/config';
35
+
36
+ export default {
37
+ kit: { adapter: fimo() },
38
+ };
39
+ ```
40
+
41
+ Do not import or install a provider-specific adapter in the generated project.
42
+ If an adopted project already owns a different adapter, preserve it; Fimo does
43
+ not replace application-owned hosting configuration.
44
+
45
+ ## Read content and labels
46
+
47
+ Use SvelteKit's server `load` functions and pass the request event so Fimo uses
48
+ SvelteKit's request-aware `fetch`:
49
+
50
+ ```ts
51
+ // src/routes/articles/+page.server.ts
52
+ import { createFimo } from 'fimo/sveltekit';
53
+ import { content } from '../../../schemas';
54
+
55
+ export async function load(event) {
56
+ const fimo = createFimo({ content, event });
57
+ const result = await fimo.articles.list({ limit: 12 });
58
+ return { articles: fimo.articles.serialize(result.items) };
59
+ }
60
+ ```
61
+
62
+ Resolve the locale with the application's existing policy, then fetch labels in
63
+ the root server layout and publish the snapshot to descendants:
64
+
65
+ ```ts
66
+ // src/routes/+layout.server.ts
67
+ import { env } from '$env/dynamic/public';
68
+ import { getLabels } from 'fimo/sveltekit';
69
+
70
+ export async function load(event) {
71
+ const locale = 'en'; // replace with the application's resolved locale
72
+ return { labels: await getLabels({ apiUrl: env.PUBLIC_FIMO_API_URL, event, locale }) };
73
+ }
74
+ ```
75
+
76
+ ```svelte
77
+ <!-- src/routes/+layout.svelte -->
78
+ <script lang="ts">
79
+ import { FimoProvider } from 'fimo/sveltekit/components';
80
+ import type { LayoutData } from './$types';
81
+ import type { Snippet } from 'svelte';
82
+
83
+ let { data, children }: { data: LayoutData; children: Snippet } = $props();
84
+ </script>
85
+
86
+ <FimoProvider labels={data.labels}>
87
+ {@render children()}
88
+ </FimoProvider>
89
+ ```
90
+
91
+ Generated values are serialized at a `load` boundary and hydrated in the
92
+ component that renders them. Use `Text`, `RichText`, `Image`, `Video`, `Date`,
93
+ `Boolean`, `Json`, and `Number` from `fimo/sveltekit/components`. `Number`
94
+ formats plain numeric values for display; numeric fields currently have no
95
+ source metadata, so it is not a Studio-editable primitive.
96
+
97
+ ## Live preview
98
+
99
+ `FimoProvider` owns the Studio browser bridge. On mount it reads
100
+ `PUBLIC_FIMO_PREVIEW_SCRIPT_URL` from SvelteKit's dynamic public environment,
101
+ loads that script once, delegates navigation to SvelteKit's `goto`, and
102
+ refreshes data with `invalidateAll()`. Without that environment value it does
103
+ nothing. Do not add a Fimo server hook or a second preview component.
104
+
105
+ ## Boundaries
106
+
107
+ - SvelteKit owns routing, history, 404s, locale URLs, and SEO.
108
+ - `fimo/sveltekit/vite` owns dev source tagging only.
109
+ - `FimoProvider` owns labels and the optional Studio preview bridge.
110
+ - Do not add React, React Query, or a Vite SPA fallback to a SvelteKit project.
@@ -1,100 +1,35 @@
1
- # Setup Fimo on plain Vite + React
1
+ # Vite and React
2
2
 
3
- Use this recipe for a Vite + React SPA without React Router framework mode.
4
- This is also the upgrade path for legacy Fimo v3 projects — v3 was plain Vite,
5
- so this layout is what those projects look like now.
3
+ Use this reference for a Vite + React SPA without React Router framework mode. Preserve the application's browser router, provider tree, and build structure.
6
4
 
7
- ## When to use this vs. React Router
5
+ ## Install and build
8
6
 
9
- - **Plain Vite (this recipe):** simplest setup; client-side routing via a
10
- React Router library router (`BrowserRouter`, no framework-mode SSR/SSG);
11
- SEO via build-time HTML rewrite. Per-route SEO that crawlers see requires
12
- prerendering (SSG); without it, the SPA serves one `index.html` for every
13
- URL and crawlers see only the home SEO.
14
- - **React Router (`references/frameworks/react-router.md`):** framework-mode SSR + per-route
15
- SEO via `meta` export; recommended when you want real per-route crawler SEO.
16
-
17
- ## Prerequisites
18
-
19
- - Node 20+
20
- - A Fimo project created via `fimo init`.
21
-
22
- ## Install
23
-
24
- ```
7
+ ```bash
25
8
  pnpm add fimo react react-dom react-router @tanstack/react-query
26
- pnpm add -D vite @vitejs/plugin-react @types/react @types/react-dom typescript
27
- ```
28
-
29
- ## File: `package.json`
30
-
31
- ```json
32
- {
33
- "name": "__PROJECT_SLUG__",
34
- "version": "0.0.0",
35
- "private": true,
36
- "type": "module",
37
- "scripts": {
38
- "dev": "vite --host 0.0.0.0 --port 5173",
39
- "build": "vite build",
40
- "preview": "vite preview --host 0.0.0.0 --port 4173",
41
- "typecheck": "tsc --noEmit"
42
- }
43
- }
9
+ pnpm add -D vite @vitejs/plugin-react
44
10
  ```
45
11
 
46
- ## File: `vite.config.ts`
12
+ Add Fimo's Vite plugins without replacing the application's existing plugins:
47
13
 
48
14
  ```ts
15
+ import react from '@vitejs/plugin-react';
49
16
  import { defineConfig } from 'vite';
50
-
51
17
  import { fimo } from 'fimo/vite';
52
18
 
53
- export default defineConfig(() => ({
54
- plugins: fimo({ seo: true }),
55
- }));
56
- ```
57
-
58
- Notes:
59
-
60
- - `fimo({ seo: true })` opts in to the build-time SEO plugin
61
- (`transformIndexHtml`-based). This is the right tool for plain Vite — there's
62
- no framework `meta` export to plug into.
63
- - Add `fimo({ seo: true, sitemap: true, robots: true })` to also emit
64
- `sitemap.xml` and `robots.txt` at build.
65
-
66
- ## File: `index.html`
67
-
68
- ```html
69
- <!doctype html>
70
- <html lang="en">
71
- <head>
72
- <meta charset="UTF-8" />
73
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
74
- <title>__PROJECT_SLUG__</title>
75
- </head>
76
- <body>
77
- <div id="root"></div>
78
- <script type="module" src="/src/main.tsx"></script>
79
- </body>
80
- </html>
19
+ export default defineConfig({
20
+ plugins: [react(), ...fimo({ seo: true })],
21
+ });
81
22
  ```
82
23
 
83
- The `seo` plugin rewrites `<title>`, og, twitter, canonical tags from
84
- `.fimo/config.json#seo` at build time. You can leave a placeholder title in
85
- `index.html`; it'll be replaced.
24
+ `fimo()` is synchronous and returns a `PluginOption[]`. `seo: true` updates the shared `index.html` at build time. Add `sitemap: true` or `robots: true` only when requested.
86
25
 
87
- ## File: `src/main.tsx`
26
+ ## Application root
88
27
 
89
- `FimoProviders` requires a React Router `<Router>` ancestor (it reads
90
- `useLocation`/`useNavigate`). It reuses a host app's
91
- `@tanstack/react-query` client when one exists and supplies a stable fallback
92
- for adopted SPAs. This recipe still mounts an explicit provider so the app owns
93
- the shared cache and its configuration:
28
+ `FimoProviders` needs a React Router context for Studio navigation and pageview tracking. Keep the application's existing router type:
94
29
 
95
30
  ```tsx
96
- import { FimoProviders } from 'fimo/react-router';
97
31
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
32
+ import { FimoProviders } from 'fimo/react-router';
98
33
  import React from 'react';
99
34
  import { createRoot } from 'react-dom/client';
100
35
  import { BrowserRouter } from 'react-router';
@@ -116,111 +51,45 @@ createRoot(document.getElementById('root')!).render(
116
51
  );
117
52
  ```
118
53
 
119
- `react-router` and `@tanstack/react-query` are peer dependencies of `fimo`;
120
- both are in the install command above. `FimoProviders` is exported only from
121
- the `fimo/react-router` adapter barrel. Keep the explicit QueryClientProvider
122
- when the app needs custom query defaults or shared cache access; adopted SPAs
123
- can omit it.
54
+ An adopted SPA can omit the explicit `QueryClientProvider` when it does not need custom defaults; Fimo supplies a stable fallback.
55
+
56
+ ## Content and labels
124
57
 
125
- ## File: `src/App.tsx`
58
+ Use `fimo/ui` for tracked values:
126
59
 
127
60
  ```tsx
128
- import { Text, useLabels } from 'fimo/ui';
61
+ import { Label } from 'fimo/ui';
129
62
 
130
63
  export function App() {
131
- const { t } = useLabels();
132
-
133
- return (
134
- <main>
135
- <Text value={t('home.hero.title')} as="h1" />
136
- </main>
137
- );
64
+ return <Label value="home.hero.title" as="h1" />;
138
65
  }
139
66
  ```
140
67
 
141
- ## File: `.fimo/config.json`
68
+ Use `useLabels().t()` for attributes, metadata, or composed strings. `references/labels.md` owns the complete contract.
69
+
70
+ ## Project profile and browser routes
71
+
72
+ Vite defaults to `dist`. Declare a different output only when the application intentionally emits elsewhere.
73
+
74
+ A `BrowserRouter` SPA needs an application-shell rewrite for direct visits to client routes:
142
75
 
143
76
  ```json
144
77
  {
145
78
  "runtime": { "framework": "vite" },
146
79
  "hosting": {
147
80
  "rewrites": [{ "source": "/(.*)", "destination": "/index.html" }]
148
- },
149
- "version": "4",
150
- "seo": {
151
- "title": "__PROJECT_SLUG__",
152
- "siteName": "__PROJECT_SLUG__"
153
- },
154
- "routes": {
155
- "home": {
156
- "label": "Home",
157
- "path": "/"
158
- }
159
81
  }
160
82
  }
161
83
  ```
162
84
 
163
- The rewrite is required for direct visits to `BrowserRouter` routes on Fimo
164
- hosting. Omit it for `HashRouter` or real per-route static output. See
165
- `references/frameworks/hosting.md`.
166
-
167
- ## File: `.fimo/project.json`
168
-
169
- ```json
170
- {
171
- "projectId": "__PROJECT_ID__",
172
- "organizationId": "__ORG_ID__",
173
- "apiUrl": "__API_URL__"
174
- }
175
- ```
85
+ Omit the rewrite for `HashRouter` or real per-route static output. The catch-all lets the browser router render its own not-found page, but the initial host response remains HTTP 200.
176
86
 
177
- ## File: `tsconfig.json`
87
+ The optional `routes` object is Studio's page catalog, not production routing.
178
88
 
179
- ```json
180
- {
181
- "compilerOptions": {
182
- "target": "ES2022",
183
- "lib": ["DOM", "DOM.Iterable", "ES2022"],
184
- "module": "ESNext",
185
- "moduleResolution": "Bundler",
186
- "jsx": "react-jsx",
187
- "strict": true,
188
- "esModuleInterop": true,
189
- "skipLibCheck": true,
190
- "resolveJsonModule": true,
191
- "isolatedModules": true,
192
- "types": ["vite/client"]
193
- },
194
- "include": ["src", "*.config.ts"]
195
- }
196
- ```
89
+ ## Boundaries
197
90
 
198
- ## Verify and iterate
199
-
200
- Run the app with the project's package-manager `dev` script (`pnpm dev` /
201
- `npm run dev` / `yarn dev` / `bun dev` — match the lockfile). It serves the site
202
- on localhost with live reload — this is your iteration loop: edit, see the change,
203
- repeat with the developer. `fimo deploy` is on-demand (hosted preview / shareable
204
- link / go live), run only on the developer's signal; the dashboard's preview iframe
205
- shows the **deployed** app, not the localhost dev server.
206
-
207
- ## Known limitations vs. React Router
208
-
209
- - **Per-route SEO that crawlers see** requires either (a) using React Router
210
- framework mode with prerender, (b) a Vite SSG plugin like `vite-plugin-ssg`,
211
- or (c) accepting that the crawler sees the home SEO for every URL.
212
- - **Dashboard "live edit SEO" preview** requires a reload on plain Vite —
213
- there's no React-side head-mutation component yet. The static `seo` plugin
214
- bakes SEO at build time.
215
- - **Routing**: `FimoProviders` requires a React Router context, so this recipe
216
- wires `BrowserRouter` from `react-router`. You can swap it for another
217
- React Router setup (e.g. a `createBrowserRouter` data router with
218
- `<RouterProvider>`), but a `<Router>` ancestor is mandatory — the runtime's
219
- preview bridge and pageview tracker call `useLocation`/`useNavigate`.
220
-
221
- ## What to do next
222
-
223
- - Add a sitemap: pass `fimo({ seo: true, sitemap: true })` and set
224
- `.fimo/config.json#seo.url` to your production base URL.
225
- - Look up exports: see `references/ui.md`.
226
- - Use schema content: see `references/content.md`.
91
+ - The application owns routes, links, locale resolution, and browser behavior.
92
+ - Build-time SEO changes one HTML shell. Crawler-visible per-route SEO requires prerendering or a framework with native route output.
93
+ - Do not add React Router framework-mode files to a plain Vite application.
94
+ - Use `fimo deploy` only when the developer requests a hosted preview or publication.
95
+ - Load `references/ui.md` for rendering and `references/frameworks/hosting.md` for hosting overrides.
@@ -4,16 +4,24 @@ Labels are project-wide, locale-scoped, editor-managed static copy. Use them for
4
4
 
5
5
  For label CLI writes and missing-key validation, load `fimo-cli/references/labels.md`.
6
6
 
7
- ## Stable contract
7
+ ## Vite and React Router
8
+
9
+ Standalone visible copy can use `Label` because these runtimes already provide label context:
10
+
11
+ ```tsx
12
+ <Label value="hero.title" as="h1" />
13
+ ```
14
+
15
+ Use `t()` for attributes, metadata, and composed strings:
8
16
 
9
17
  ```tsx
10
18
  const { t } = useLabels();
11
- return <Text value={t('hero.title')} as="h1" />;
19
+ return <input placeholder={String(t('email.placeholder'))} />;
12
20
  ```
13
21
 
14
- `t(key)` returns a source-tracked `FimoString`. Render it with `<Text>` when possible so Studio can select it. Convert with `String(t(...))` only for HTML attributes or framework APIs that require a primitive.
22
+ `t(key)` returns a source-tracked `FimoString`. Render visible values with `Text`; convert with `String(t(...))` only for HTML attributes or framework APIs that require a primitive.
15
23
 
16
- The first argument must be a string literal so extraction and source tracking remain deterministic:
24
+ Label keys — the first argument to `t()` and the `value` of `Label` — must be string literals so extraction and source tracking remain deterministic:
17
25
 
18
26
  ```tsx
19
27
  const items = [
@@ -32,9 +40,11 @@ The label contract is shared; acquisition differs by runtime:
32
40
 
33
41
  - Next server: `getLabels({ locale? })` from `fimo/next`.
34
42
  - Next client: `useLabels()` from `fimo/next/client`, under `FimoProvider`.
35
- - React Router/Vite client: `useLabels()` from `fimo/ui`, under the existing framework integration.
43
+ - React Router/Vite client: `Label` and `useLabels()` from `fimo/ui`, under the existing framework integration.
44
+ - SvelteKit: resolve the locale in the root server load and return `getLabels({ apiUrl, event, locale })`. Wrap the root layout with `FimoProvider` from `fimo/sveltekit/components`; the snapshot supplies its locale. Descendants use `Label` from that entrypoint or `useLabels().t()` from `fimo/sveltekit`. Pass the same resolved locale to `createFimo({ content, event, locale })` in content loads.
45
+ - Astro server page: `getLabels({ locale? })` from `fimo/astro`; no provider.
36
46
 
37
- Load `references/frameworks/next.md`, `references/frameworks/react-router.md`, or `references/frameworks/vite-react.md` before adding a provider.
47
+ Load the matching framework reference before choosing a provider or server reader.
38
48
 
39
49
  ## Locale behavior
40
50
 
@@ -27,13 +27,15 @@ For an already linked project, enable each locale in Fimo before writing non-def
27
27
  ## Fimo responsibilities
28
28
 
29
29
  - Fetch the correct localized content variant and label dictionary after receiving locale.
30
- - Use `defaultLocale` when no explicit locale is supplied.
30
+ - Resolve an omitted locale to the project default; server reads let the tenant API choose it.
31
31
  - Preserve one shared entry for schemas with `i18n.enabled: false`.
32
32
  - Preserve source metadata for editing.
33
33
 
34
34
  ## Framework handoff
35
35
 
36
36
  - Next.js → load `references/frameworks/next/locales.md`.
37
+ - Astro → load `references/frameworks/astro.md` and pass the locale resolved by the page.
38
+ - SvelteKit → load `references/frameworks/sveltekit.md`; resolve locale in the app's load functions and pass it to Fimo reads.
37
39
  - React Router standard locale routing → load `references/frameworks/react-router.md`.
38
40
  - Vite + React/custom React router → load `references/frameworks/vite-react.md` and pass locale through its existing provider seam.
39
41
 
@@ -1,20 +1,20 @@
1
- # React rendering primitives
1
+ # Rendering primitives
2
2
 
3
3
  Use Fimo components for source-tracked schema and label values so Studio can identify the field being rendered. Generated reads wrap editable fields with source metadata; pass the whole value to the matching primitive because unwrapping it first removes Studio's edit target.
4
4
 
5
- | Schema/read value | Component | Use |
6
- | -------------------------------- | ------------- | ----------------------------------------- |
7
- | string/text/date as `FimoString` | `Text` | editable text and `t()` values |
8
- | richtext as `FimoRichText` | `RichText` | Tiptap JSONContent |
9
- | media as `FimoMedia` | `Image` | schema media images |
10
- | non-schema URL | `StaticImage` | decorative/static image URLs |
11
- | media as `FimoMedia` | `Video` | schema media videos |
12
- | date as `FimoString` | `Date` | schema dates |
13
- | boolean as `FimoBoolean` | `Boolean` | schema booleans |
14
- | source-tagged plain JSON | `Json` | schema JSON |
15
- | number | normal JSX | numbers stay plain; no `Number` primitive |
16
- | reference | target fields | populate before rendering |
17
- | blocks | nested fields | render each value with its primitive |
5
+ | Schema/read value | Component | Use |
6
+ | -------------------------------- | ------------------------------ | ------------------------------------------------------------------ |
7
+ | string/text/date as `FimoString` | `Text` | editable text and `t()` values |
8
+ | richtext as `FimoRichText` | `RichText` | Tiptap JSONContent |
9
+ | media as `FimoMedia` | `Image` | schema media images |
10
+ | non-schema URL | `StaticImage` | decorative/static image URLs |
11
+ | media as `FimoMedia` | `Video` | schema media videos |
12
+ | date as `FimoString` | `Date` | schema dates |
13
+ | boolean as `FimoBoolean` | `Boolean` | schema booleans |
14
+ | source-tagged plain JSON | `Json` | schema JSON |
15
+ | number | normal JSX; SvelteKit `Number` | numbers stay plain; SvelteKit `Number` formats display-only values |
16
+ | reference | target fields | populate before rendering |
17
+ | blocks | nested fields | render each value with its primitive |
18
18
 
19
19
  ```tsx
20
20
  <Text value={article.title} as="h1" />
@@ -46,6 +46,8 @@ Do not render those values as `{program.title}` or `{highlight.label}`. That dis
46
46
 
47
47
  Use `<StaticImage>` only when the image is deliberately not editor-managed. Use `String(value)` for attributes/third-party APIs that cannot accept a `FimoString`; keep editable visible text in `<Text>`.
48
48
 
49
+ Numeric fields stay plain JavaScript numbers, so they do not carry Studio source metadata. SvelteKit's `Number` component is an optional display/formatting helper; it is not source-editable. Other framework surfaces should render numeric fields normally until a shared tracked-number contract exists.
50
+
49
51
  Never construct `FimoString`, `FimoRichText`, `FimoBoolean`, or `FimoMedia` manually. Generated clients and label readers attach the correct source path.
50
52
 
51
53
  ## Imports
@@ -55,8 +57,10 @@ Choose the framework surface:
55
57
  - Next Server Components and data functions → `fimo/next`
56
58
  - Next Client Components → `fimo/next/client`
57
59
  - React Router/Vite client → `fimo/ui`
60
+ - Astro pages → `fimo/astro/components`
61
+ - Svelte components → `fimo/sveltekit/components`
58
62
 
59
- Load the framework reference before copying an example. Next server and client imports are deliberately separate so React Query/client code does not leak into server bundles.
63
+ Load the framework reference before copying an example. Next server and client imports are deliberately separate so React Query/client code does not leak into server bundles. Astro uses native `.astro` components and does not require React.
60
64
 
61
65
  ## Component ownership
62
66