fimo 0.20.0 → 0.21.0-experimental.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.
Files changed (322) hide show
  1. package/README.md +1 -1
  2. package/assets/agent-templates/_default/GOAL.md +10 -0
  3. package/assets/agent-templates/_default/capabilities.yaml +10 -0
  4. package/assets/content-templates/shared/types.eta +1 -1
  5. package/assets/skills/fimo-cli/SKILL.md +2 -1
  6. package/assets/skills/fimo-cli/references/agents.md +136 -36
  7. package/assets/skills/fimo-cli/references/branches.md +8 -5
  8. package/assets/skills/fimo-cli/references/deploy.md +11 -2
  9. package/assets/skills/fimo-cli/references/domains.md +12 -0
  10. package/assets/skills/fimo-cli/references/forms.md +1 -1
  11. package/assets/skills/fimo-cli/references/init.md +9 -2
  12. package/assets/skills/fimo-cli/references/locales.md +1 -1
  13. package/assets/skills/fimo-cli/references/mcp.md +1 -1
  14. package/assets/skills/fimo-cli/references/media.md +18 -1
  15. package/assets/skills/fimo-cli/references/project-vars-and-secrets.md +3 -1
  16. package/assets/skills/fimo-cli/references/projects.md +7 -7
  17. package/assets/skills/fimo-code/assets/react-router-locales/navigation.tsx +1 -1
  18. package/assets/skills/fimo-code/references/assets.md +2 -2
  19. package/assets/skills/fimo-code/references/best-practices/next.md +1 -1
  20. package/assets/skills/fimo-code/references/content/schema.md +23 -0
  21. package/assets/skills/fimo-code/references/forms.md +1 -1
  22. package/assets/skills/fimo-code/references/frameworks/astro.md +8 -2
  23. package/assets/skills/fimo-code/references/frameworks/compatibility.md +9 -9
  24. package/assets/skills/fimo-code/references/frameworks/hosting.md +17 -13
  25. package/assets/skills/fimo-code/references/frameworks/next/app-router.md +8 -9
  26. package/assets/skills/fimo-code/references/frameworks/next/locales.md +5 -5
  27. package/assets/skills/fimo-code/references/frameworks/next/pages-router.md +5 -5
  28. package/assets/skills/fimo-code/references/frameworks/next.md +41 -32
  29. package/assets/skills/fimo-code/references/frameworks/react-router.md +10 -7
  30. package/assets/skills/fimo-code/references/frameworks/sveltekit.md +22 -15
  31. package/assets/skills/fimo-code/references/frameworks/vite-react.md +7 -5
  32. package/assets/skills/fimo-code/references/labels.md +4 -4
  33. package/assets/skills/fimo-code/references/locales.md +2 -2
  34. package/assets/skills/fimo-code/references/ui.md +4 -4
  35. package/assets/skills/fimo-migration/SKILL.md +51 -30
  36. package/assets/skills/fimo-migration/references/frameworks/nextjs.md +12 -15
  37. package/assets/skills/fimo-migration/references/media.md +12 -8
  38. package/assets/skills/fimo-migration/references/qa.md +12 -11
  39. package/assets/skills/fimo-migration/references/workers/content-planner.md +33 -4
  40. package/assets/skills/fimo-migration/references/workers/validator.md +10 -0
  41. package/assets/skills/fimo-migration/references/workers.md +19 -10
  42. package/assets/skills/fimo-migration/references/workflow.md +29 -11
  43. package/assets/skills/fimo-studio/references/ai-chat.md +1 -1
  44. package/assets/skills/fimo-studio/references/billing-and-credits.md +18 -1
  45. package/assets/skills/fimo-studio/references/cms.md +2 -0
  46. package/assets/skills/fimo-studio/references/preview-and-responsive.md +1 -0
  47. package/assets/starters/fimo-site/template/src/pages/Contact.tsx +1 -1
  48. package/assets/starters/fimo-site/template/src/pages/SiteContent.tsx +1 -1
  49. package/assets/starters/fimo-site/template/src/schemas/HomePage.ts +3 -3
  50. package/assets/starters/fimo-site/template/src/schemas/HomePage.types.ts +1 -1
  51. package/dist/build/astro/config.d.ts +13 -2
  52. package/dist/build/astro/config.js +9 -24
  53. package/dist/build/next/moved.d.ts +2 -0
  54. package/dist/build/next/moved.js +2 -0
  55. package/dist/build/react/router-moved.d.ts +2 -0
  56. package/dist/build/react/router-moved.js +2 -0
  57. package/dist/build/react/router-preset-moved.d.ts +2 -0
  58. package/dist/build/react/router-preset-moved.js +2 -0
  59. package/dist/build/react/router-routes-moved.d.ts +2 -0
  60. package/dist/build/react/router-routes-moved.js +2 -0
  61. package/dist/build/react/ui-moved.d.ts +2 -0
  62. package/dist/build/react/ui-moved.js +2 -0
  63. package/dist/build/react/vite-moved.d.ts +2 -0
  64. package/dist/build/react/vite-moved.js +2 -0
  65. package/dist/build/sveltekit/config.d.ts +5 -4
  66. package/dist/build/sveltekit/config.js +6 -15
  67. package/dist/build/sveltekit/moved.d.ts +13 -0
  68. package/dist/build/sveltekit/moved.js +3 -0
  69. package/dist/build/vite/data-id.d.ts +11 -0
  70. package/dist/build/vite/data-id.js +20 -0
  71. package/dist/build/vite/plugins/runtime-env.d.ts +1 -1
  72. package/dist/build/vite/plugins/runtime-env.js +6 -2
  73. package/dist/build/vite/runtime-env.d.ts +2 -0
  74. package/dist/build/vite/runtime-env.js +1 -0
  75. package/dist/cli/bundle.json +1 -1
  76. package/dist/cli/index.js +115 -110
  77. package/dist/runtime/content/client/internal.js +1 -1
  78. package/dist/runtime/content/index.d.ts +6 -1
  79. package/dist/runtime/content/index.js +6 -0
  80. package/dist/runtime/i18n/index.d.ts +2 -0
  81. package/dist/runtime/i18n/index.js +1 -0
  82. package/dist/runtime/labels/index.d.ts +3 -0
  83. package/dist/runtime/labels/index.js +2 -0
  84. package/dist/runtime/preview/index.d.ts +5 -0
  85. package/dist/runtime/preview/index.js +4 -0
  86. package/dist/runtime/preview/script.d.ts +3 -0
  87. package/dist/runtime/preview/script.js +14 -0
  88. package/dist/runtime/primitives/lib/index.d.ts +2 -0
  89. package/dist/runtime/primitives/lib/index.js +2 -0
  90. package/dist/runtime/seo/index.d.ts +0 -8
  91. package/dist/runtime/seo/index.js +0 -8
  92. package/dist/runtime/shared/config.d.ts +6 -0
  93. package/dist/runtime/shared/config.js +4 -0
  94. package/dist/runtime/shared/local-runtime-env.d.ts +2 -2
  95. package/dist/runtime/shared/local-runtime-env.js +7 -5
  96. package/dist/runtime/templates.d.ts +20 -4
  97. package/dist/runtime/templates.js +60 -18
  98. package/dist/scripts/extract-translations.js +8 -3
  99. package/dist/scripts/index.d.ts +3 -0
  100. package/dist/scripts/index.js +2 -0
  101. package/dist/scripts/sync-forms.js +21 -9
  102. package/dist/scripts/sync-schemas.js +129 -21
  103. package/dist/scripts/validate-schemas.js +63 -2
  104. package/package.json +72 -71
  105. package/release.json +2 -2
  106. package/templates/astro/AGENTS.md +1 -1
  107. package/templates/astro/astro.config.mjs +1 -1
  108. package/templates/astro/package.json +4 -2
  109. package/templates/astro/pnpm-workspace.yaml +6 -2
  110. package/templates/nextjs/.fimo/config.json +1 -2
  111. package/templates/nextjs/AGENTS.md +6 -16
  112. package/templates/nextjs/next.config.ts +4 -2
  113. package/templates/nextjs/package.json +4 -2
  114. package/templates/nextjs/pnpm-workspace.yaml +6 -2
  115. package/templates/nextjs/src/app/layout.tsx +16 -0
  116. package/templates/nextjs/src/locales.ts +3 -6
  117. package/templates/react-router/AGENTS.md +1 -1
  118. package/templates/react-router/package.json +5 -2
  119. package/templates/react-router/pnpm-workspace.yaml +6 -6
  120. package/templates/react-router/react-router.config.ts +1 -1
  121. package/templates/react-router/src/pages/legal/LegalPage.tsx +1 -1
  122. package/templates/react-router/src/root.tsx +1 -1
  123. package/templates/react-router/src/vite-env.d.ts +0 -1
  124. package/templates/react-router/vite.config.ts +1 -1
  125. package/templates/sveltekit/AGENTS.md +1 -1
  126. package/templates/sveltekit/package.json +4 -2
  127. package/templates/sveltekit/pnpm-workspace.yaml +6 -2
  128. package/templates/sveltekit/src/routes/+layout.server.ts +1 -1
  129. package/templates/sveltekit/src/routes/+layout.svelte +1 -1
  130. package/templates/sveltekit/svelte.config.js +1 -1
  131. package/templates/sveltekit/vite.config.ts +1 -1
  132. package/assets/sveltekit/components/Boolean.svelte +0 -19
  133. package/assets/sveltekit/components/Date.svelte +0 -33
  134. package/assets/sveltekit/components/DateTime.svelte +0 -35
  135. package/assets/sveltekit/components/FimoProvider.svelte +0 -35
  136. package/assets/sveltekit/components/Image.svelte +0 -80
  137. package/assets/sveltekit/components/Json.svelte +0 -18
  138. package/assets/sveltekit/components/Label.svelte +0 -16
  139. package/assets/sveltekit/components/Number.svelte +0 -21
  140. package/assets/sveltekit/components/RichText.svelte +0 -19
  141. package/assets/sveltekit/components/Text.svelte +0 -30
  142. package/assets/sveltekit/components/Video.svelte +0 -37
  143. package/assets/sveltekit/components/index.d.ts +0 -11
  144. package/assets/sveltekit/components/index.js +0 -11
  145. package/dist/build/next/config.d.ts +0 -17
  146. package/dist/build/next/config.js +0 -66
  147. package/dist/build/sveltekit/data-id.d.ts +0 -3
  148. package/dist/build/sveltekit/data-id.js +0 -171
  149. package/dist/build/sveltekit/files/edge.js +0 -68
  150. package/dist/build/sveltekit/files/serverless.js +0 -42
  151. package/dist/build/sveltekit/vite.d.ts +0 -12
  152. package/dist/build/sveltekit/vite.js +0 -14
  153. package/dist/build/vite/index.d.ts +0 -42
  154. package/dist/build/vite/index.js +0 -160
  155. package/dist/build/vite/plugins/content-sync.d.ts +0 -11
  156. package/dist/build/vite/plugins/content-sync.js +0 -41
  157. package/dist/build/vite/plugins/data-id.d.ts +0 -12
  158. package/dist/build/vite/plugins/data-id.js +0 -109
  159. package/dist/build/vite/plugins/fimo-config.d.ts +0 -12
  160. package/dist/build/vite/plugins/fimo-config.js +0 -68
  161. package/dist/build/vite/plugins/overlay.d.ts +0 -3
  162. package/dist/build/vite/plugins/overlay.js +0 -154
  163. package/dist/build/vite/plugins/robots.d.ts +0 -10
  164. package/dist/build/vite/plugins/robots.js +0 -56
  165. package/dist/build/vite/plugins/seo.d.ts +0 -3
  166. package/dist/build/vite/plugins/seo.js +0 -112
  167. package/dist/build/vite/plugins/server-config.d.ts +0 -3
  168. package/dist/build/vite/plugins/server-config.js +0 -36
  169. package/dist/build/vite/plugins/sitemap.d.ts +0 -3
  170. package/dist/build/vite/plugins/sitemap.js +0 -73
  171. package/dist/build/vite/plugins/translations.d.ts +0 -11
  172. package/dist/build/vite/plugins/translations.js +0 -601
  173. package/dist/runtime/app/FimoProviders.d.ts +0 -30
  174. package/dist/runtime/app/FimoProviders.js +0 -186
  175. package/dist/runtime/app/FimoScripts.d.ts +0 -14
  176. package/dist/runtime/app/FimoScripts.js +0 -48
  177. package/dist/runtime/app/index.d.ts +0 -8
  178. package/dist/runtime/app/index.js +0 -4
  179. package/dist/runtime/app/prefetch.d.ts +0 -9
  180. package/dist/runtime/app/prefetch.js +0 -39
  181. package/dist/runtime/content/DataSourcesProvider.d.ts +0 -4
  182. package/dist/runtime/content/DataSourcesProvider.js +0 -63
  183. package/dist/runtime/content/RefreshContentProvider.d.ts +0 -19
  184. package/dist/runtime/content/RefreshContentProvider.js +0 -71
  185. package/dist/runtime/content/client/createContentClient.d.ts +0 -7
  186. package/dist/runtime/content/client/createContentClient.js +0 -7
  187. package/dist/runtime/content/client/createSingletonClient.d.ts +0 -5
  188. package/dist/runtime/content/client/createSingletonClient.js +0 -6
  189. package/dist/runtime/content/client/react-content-client.d.ts +0 -10
  190. package/dist/runtime/content/client/react-content-client.js +0 -165
  191. package/dist/runtime/content/client/react-singleton-client.d.ts +0 -7
  192. package/dist/runtime/content/client/react-singleton-client.js +0 -38
  193. package/dist/runtime/content/client/types.d.ts +0 -42
  194. package/dist/runtime/content/client/types.js +0 -1
  195. package/dist/runtime/content/client/useQueryLocale.d.ts +0 -2
  196. package/dist/runtime/content/client/useQueryLocale.js +0 -5
  197. package/dist/runtime/content/client/vite-runtime.d.ts +0 -3
  198. package/dist/runtime/content/client/vite-runtime.js +0 -23
  199. package/dist/runtime/content/utils/retrieve-data-sources.d.ts +0 -29
  200. package/dist/runtime/content/utils/retrieve-data-sources.js +0 -107
  201. package/dist/runtime/core/AppErrorBoundary.d.ts +0 -10
  202. package/dist/runtime/core/AppErrorBoundary.js +0 -27
  203. package/dist/runtime/core/ViteLifecycles.d.ts +0 -5
  204. package/dist/runtime/core/ViteLifecycles.js +0 -35
  205. package/dist/runtime/i18n/FimoLocaleContext.d.ts +0 -9
  206. package/dist/runtime/i18n/FimoLocaleContext.js +0 -17
  207. package/dist/runtime/iframe/ConsoleErrorProvider.d.ts +0 -3
  208. package/dist/runtime/iframe/ConsoleErrorProvider.js +0 -103
  209. package/dist/runtime/iframe/ScreenshotProvider.d.ts +0 -3
  210. package/dist/runtime/iframe/ScreenshotProvider.js +0 -60
  211. package/dist/runtime/iframe/runtime/overlay-hmr.d.ts +0 -2
  212. package/dist/runtime/iframe/runtime/overlay-hmr.js +0 -27
  213. package/dist/runtime/iframe/runtime/overlay-runtime.d.ts +0 -2
  214. package/dist/runtime/iframe/runtime/overlay-runtime.js +0 -103
  215. package/dist/runtime/index.d.ts +0 -22
  216. package/dist/runtime/index.js +0 -23
  217. package/dist/runtime/next/client-runtime.d.ts +0 -3
  218. package/dist/runtime/next/client-runtime.js +0 -24
  219. package/dist/runtime/next/client.d.ts +0 -28
  220. package/dist/runtime/next/client.js +0 -25
  221. package/dist/runtime/next/facade.d.ts +0 -8
  222. package/dist/runtime/next/facade.js +0 -34
  223. package/dist/runtime/next/labels.d.ts +0 -7
  224. package/dist/runtime/next/labels.js +0 -9
  225. package/dist/runtime/next/preview.d.ts +0 -13
  226. package/dist/runtime/next/preview.js +0 -34
  227. package/dist/runtime/next/primitives/Text.d.ts +0 -10
  228. package/dist/runtime/next/primitives/Text.js +0 -18
  229. package/dist/runtime/next/primitives/server.d.ts +0 -11
  230. package/dist/runtime/next/primitives/server.js +0 -54
  231. package/dist/runtime/next/provider.d.ts +0 -18
  232. package/dist/runtime/next/provider.js +0 -39
  233. package/dist/runtime/next/server-runtime.d.ts +0 -3
  234. package/dist/runtime/next/server-runtime.js +0 -23
  235. package/dist/runtime/next/server.d.ts +0 -21
  236. package/dist/runtime/next/server.js +0 -16
  237. package/dist/runtime/primitives/index.d.ts +0 -16
  238. package/dist/runtime/primitives/index.js +0 -17
  239. package/dist/runtime/react/primitives/contracts.d.ts +0 -94
  240. package/dist/runtime/react/primitives/contracts.js +0 -1
  241. package/dist/runtime/react/primitives/editable/Boolean.d.ts +0 -5
  242. package/dist/runtime/react/primitives/editable/Boolean.js +0 -11
  243. package/dist/runtime/react/primitives/editable/Date.d.ts +0 -4
  244. package/dist/runtime/react/primitives/editable/Date.js +0 -12
  245. package/dist/runtime/react/primitives/editable/DateTime.d.ts +0 -4
  246. package/dist/runtime/react/primitives/editable/DateTime.js +0 -13
  247. package/dist/runtime/react/primitives/editable/Image.d.ts +0 -4
  248. package/dist/runtime/react/primitives/editable/Image.js +0 -10
  249. package/dist/runtime/react/primitives/editable/Json.d.ts +0 -5
  250. package/dist/runtime/react/primitives/editable/Json.js +0 -11
  251. package/dist/runtime/react/primitives/editable/RichText.d.ts +0 -4
  252. package/dist/runtime/react/primitives/editable/RichText.js +0 -11
  253. package/dist/runtime/react/primitives/editable/Text.d.ts +0 -20
  254. package/dist/runtime/react/primitives/editable/Text.js +0 -36
  255. package/dist/runtime/react/primitives/editable/Video.d.ts +0 -4
  256. package/dist/runtime/react/primitives/editable/Video.js +0 -10
  257. package/dist/runtime/react/primitives/renderers/DateRenderer.d.ts +0 -17
  258. package/dist/runtime/react/primitives/renderers/DateRenderer.js +0 -17
  259. package/dist/runtime/react/primitives/renderers/ImageRenderer.d.ts +0 -8
  260. package/dist/runtime/react/primitives/renderers/ImageRenderer.js +0 -31
  261. package/dist/runtime/react/primitives/renderers/RichTextRenderer.d.ts +0 -12
  262. package/dist/runtime/react/primitives/renderers/RichTextRenderer.js +0 -135
  263. package/dist/runtime/react/primitives/renderers/StaticImage.d.ts +0 -35
  264. package/dist/runtime/react/primitives/renderers/StaticImage.js +0 -58
  265. package/dist/runtime/react/primitives/renderers/VideoRenderer.d.ts +0 -8
  266. package/dist/runtime/react/primitives/renderers/VideoRenderer.js +0 -10
  267. package/dist/runtime/react/useFimoLiveValue.d.ts +0 -20
  268. package/dist/runtime/react/useFimoLiveValue.js +0 -43
  269. package/dist/runtime/react-router/active-routes.d.ts +0 -12
  270. package/dist/runtime/react-router/active-routes.js +0 -60
  271. package/dist/runtime/react-router/index.d.ts +0 -16
  272. package/dist/runtime/react-router/index.js +0 -20
  273. package/dist/runtime/react-router/legacy/routes.d.ts +0 -35
  274. package/dist/runtime/react-router/legacy/routes.js +0 -86
  275. package/dist/runtime/react-router/navigation-utils.d.ts +0 -8
  276. package/dist/runtime/react-router/navigation-utils.js +0 -36
  277. package/dist/runtime/react-router/navigation.d.ts +0 -12
  278. package/dist/runtime/react-router/navigation.js +0 -28
  279. package/dist/runtime/react-router/preset.d.ts +0 -30
  280. package/dist/runtime/react-router/preset.js +0 -33
  281. package/dist/runtime/routing/AppResetScrollOnNavigate.d.ts +0 -2
  282. package/dist/runtime/routing/AppResetScrollOnNavigate.js +0 -12
  283. package/dist/runtime/routing/AppRoutesProvider.d.ts +0 -25
  284. package/dist/runtime/routing/AppRoutesProvider.js +0 -112
  285. package/dist/runtime/seo/buildSeoForPath.d.ts +0 -74
  286. package/dist/runtime/seo/buildSeoForPath.js +0 -55
  287. package/dist/runtime/seo/htmlProps.d.ts +0 -13
  288. package/dist/runtime/seo/htmlProps.js +0 -15
  289. package/dist/runtime/sveltekit/content.d.ts +0 -25
  290. package/dist/runtime/sveltekit/content.js +0 -33
  291. package/dist/runtime/sveltekit/context-contract.d.ts +0 -5
  292. package/dist/runtime/sveltekit/context-contract.js +0 -2
  293. package/dist/runtime/sveltekit/context.d.ts +0 -8
  294. package/dist/runtime/sveltekit/context.js +0 -25
  295. package/dist/runtime/sveltekit/forms.d.ts +0 -15
  296. package/dist/runtime/sveltekit/forms.js +0 -15
  297. package/dist/runtime/sveltekit/index.d.ts +0 -9
  298. package/dist/runtime/sveltekit/index.js +0 -5
  299. package/dist/runtime/sveltekit/internal.d.ts +0 -6
  300. package/dist/runtime/sveltekit/internal.js +0 -12
  301. package/dist/runtime/sveltekit/labels.d.ts +0 -20
  302. package/dist/runtime/sveltekit/labels.js +0 -13
  303. package/dist/runtime/sveltekit/preview.d.ts +0 -28
  304. package/dist/runtime/sveltekit/preview.js +0 -82
  305. package/dist/runtime/sveltekit/runtime.d.ts +0 -9
  306. package/dist/runtime/sveltekit/runtime.js +0 -26
  307. package/dist/runtime/t/OptionalTracking.d.ts +0 -13
  308. package/dist/runtime/t/OptionalTracking.js +0 -28
  309. package/dist/runtime/t/Pageview.d.ts +0 -9
  310. package/dist/runtime/t/Pageview.js +0 -118
  311. package/dist/runtime/vite/Label.d.ts +0 -13
  312. package/dist/runtime/vite/Label.js +0 -16
  313. package/dist/runtime/vite/primitives/Images.d.ts +0 -4
  314. package/dist/runtime/vite/primitives/Images.js +0 -12
  315. package/dist/runtime/vite/translations.d.ts +0 -28
  316. package/dist/runtime/vite/translations.js +0 -103
  317. package/templates/nextjs/src/app/(default)/layout.tsx +0 -10
  318. package/templates/nextjs/src/app/[locale]/layout.tsx +0 -22
  319. package/templates/nextjs/src/app/[locale]/page.tsx +0 -1
  320. package/templates/nextjs/src/components/Document.tsx +0 -26
  321. package/templates/nextjs/src/components/FimoPreviewBridge.tsx +0 -13
  322. /package/templates/nextjs/src/app/{(default)/page.tsx → page.tsx} +0 -0
@@ -1,112 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useCallback, useEffect, useMemo } from 'react';
3
- import { ErrorBoundary } from 'react-error-boundary';
4
- import { useLocation, useNavigate, useRoutes } from 'react-router';
5
- import { DataSourcesProvider } from '../content/DataSourcesProvider.js';
6
- import { RefreshContentProvider } from '../content/RefreshContentProvider.js';
7
- import { AppErrorBoundary, onError } from '../core/AppErrorBoundary.js';
8
- import { ViteLifecycles } from '../core/ViteLifecycles.js';
9
- import { ScreenshotProvider } from '../iframe/ScreenshotProvider.js';
10
- import { getSafePreviewNavigationPath, isPreviewRuntimeEnabled } from '../preview/bridge.js';
11
- import { getDocumentLocale, getPreviewLocationChange, getPreviewParentOrigin } from '../preview/location.js';
12
- import { OptionalTracking } from '../t/OptionalTracking.js';
13
- import { AppResetScrollOnNavigate } from './AppResetScrollOnNavigate.js';
14
- const titleCase = (seg) => seg
15
- .replace(/[_-]+/g, ' ')
16
- .replace(/([a-z])([A-Z])/g, '$1 $2')
17
- .split(/\s+/)
18
- .filter(Boolean)
19
- .map((w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase())
20
- .join(' ');
21
- const generateRouteName = (path) => {
22
- if (path === '/') {
23
- return 'Home';
24
- }
25
- const firstSegment = path.replace(/^\//, '').split('/')[0];
26
- return titleCase(firstSegment);
27
- };
28
- export function getDisplayRoutes(routes, basePath = '') {
29
- const displayRoutes = [];
30
- for (const route of routes) {
31
- const { children, ...rest } = route;
32
- let fullPath;
33
- if (rest.path) {
34
- fullPath = rest.path.startsWith('/') ? rest.path : `${basePath.replace(/\/$/, '')}/${rest.path}`;
35
- }
36
- else {
37
- fullPath = basePath;
38
- }
39
- if (rest.path) {
40
- displayRoutes.push({
41
- path: fullPath,
42
- index: rest.index,
43
- slugs: rest.slugs,
44
- name: rest.name || generateRouteName(fullPath),
45
- });
46
- }
47
- if (children) {
48
- displayRoutes.push(...getDisplayRoutes(children, fullPath));
49
- }
50
- }
51
- return displayRoutes;
52
- }
53
- export function AppRoutesProvider({ appRoutes, children }) {
54
- const routing = useRoutes((appRoutes ?? []));
55
- const navigate = useNavigate();
56
- const location = useLocation();
57
- const displayRoutes = useMemo(() => getDisplayRoutes(appRoutes ?? []), [appRoutes]);
58
- // @ts-ignore - import.meta.env is provided by Vite.
59
- const previewEnabled = isPreviewRuntimeEnabled(import.meta.env.VITE_PREVIEW_SCRIPT_URL);
60
- const sendRoutes = useCallback(() => {
61
- if (!previewEnabled || !appRoutes?.length) {
62
- return;
63
- }
64
- window.parent.postMessage({ type: 'nav/routes', payload: { routes: displayRoutes } }, getPreviewParentOrigin() ?? '*');
65
- }, [appRoutes, displayRoutes, previewEnabled]);
66
- // This runtime predates locale-aware routing and has no fimo-config to read,
67
- // so the document's own `lang` is the only locale the app has declared.
68
- const sendLocationChange = useCallback(() => {
69
- if (!previewEnabled) {
70
- return;
71
- }
72
- const parentOrigin = getPreviewParentOrigin();
73
- window.parent.postMessage({
74
- type: 'nav/locationChange',
75
- payload: getPreviewLocationChange(location, getDocumentLocale(document, 'en'), parentOrigin),
76
- }, parentOrigin ?? '*');
77
- }, [location.hash, location.pathname, location.search, previewEnabled]);
78
- useEffect(sendRoutes, [sendRoutes]);
79
- useEffect(sendLocationChange, [sendLocationChange]);
80
- useEffect(() => {
81
- if (!previewEnabled) {
82
- return;
83
- }
84
- const handleMessage = (event) => {
85
- const parentOrigin = getPreviewParentOrigin();
86
- if (event.source !== window.parent || !parentOrigin || event.origin !== parentOrigin) {
87
- return;
88
- }
89
- const type = event.data?.type;
90
- const payload = event.data?.payload;
91
- switch (type) {
92
- case 'nav/navigate':
93
- {
94
- const target = getSafePreviewNavigationPath(payload?.to, window.location.origin);
95
- if (target) {
96
- navigate(target);
97
- }
98
- }
99
- return;
100
- case 'nav/read-routes':
101
- sendRoutes();
102
- sendLocationChange();
103
- return;
104
- }
105
- };
106
- window.addEventListener('message', handleMessage);
107
- return () => {
108
- window.removeEventListener('message', handleMessage);
109
- };
110
- }, [navigate, previewEnabled, sendRoutes, sendLocationChange]);
111
- return (_jsx(ErrorBoundary, { FallbackComponent: AppErrorBoundary, onError: onError, children: _jsx(DataSourcesProvider, { children: _jsx(ScreenshotProvider, { children: _jsx(ViteLifecycles, { children: _jsxs(RefreshContentProvider, { children: [_jsx(OptionalTracking, { routes: displayRoutes }), _jsx(AppResetScrollOnNavigate, {}), appRoutes?.length ? routing : children] }) }) }) }) }));
112
- }
@@ -1,74 +0,0 @@
1
- import type { FimoSEO } from '../shared/fimo-config.types.js';
2
- export declare function getSeoForPath(pathname: string, routeData?: unknown): FimoSEO | undefined;
3
- export declare function buildMetaForPath(pathname: string, routeData?: unknown): ({
4
- title: string;
5
- name?: undefined;
6
- property?: undefined;
7
- content?: undefined;
8
- tagName?: undefined;
9
- rel?: undefined;
10
- href?: undefined;
11
- } | {
12
- title?: undefined;
13
- name: string;
14
- content: string;
15
- property?: undefined;
16
- tagName?: undefined;
17
- rel?: undefined;
18
- href?: undefined;
19
- } | {
20
- title?: undefined;
21
- name?: undefined;
22
- property: string;
23
- content: string;
24
- tagName?: undefined;
25
- rel?: undefined;
26
- href?: undefined;
27
- } | {
28
- title?: undefined;
29
- name?: undefined;
30
- property?: undefined;
31
- content?: undefined;
32
- tagName: string;
33
- rel: string;
34
- href: string;
35
- })[];
36
- export declare function buildFimoMeta(args: {
37
- location: {
38
- pathname: string;
39
- };
40
- matches: readonly unknown[];
41
- }): ({
42
- title: string;
43
- name?: undefined;
44
- property?: undefined;
45
- content?: undefined;
46
- tagName?: undefined;
47
- rel?: undefined;
48
- href?: undefined;
49
- } | {
50
- title?: undefined;
51
- name: string;
52
- content: string;
53
- property?: undefined;
54
- tagName?: undefined;
55
- rel?: undefined;
56
- href?: undefined;
57
- } | {
58
- title?: undefined;
59
- name?: undefined;
60
- property: string;
61
- content: string;
62
- tagName?: undefined;
63
- rel?: undefined;
64
- href?: undefined;
65
- } | {
66
- title?: undefined;
67
- name?: undefined;
68
- property?: undefined;
69
- content?: undefined;
70
- tagName: string;
71
- rel: string;
72
- href: string;
73
- })[];
74
- //# sourceMappingURL=buildSeoForPath.d.ts.map
@@ -1,55 +0,0 @@
1
- // @ts-ignore - virtual module provided by fimoConfigPlugin in fimo/vite
2
- import rawConfig from 'virtual:fimo-config';
3
- import { normalizePathname, resolveSeoForPath } from './resolver.js';
4
- const config = rawConfig;
5
- export function getSeoForPath(pathname, routeData) {
6
- return resolveSeoForPath(pathname, config, routeData);
7
- }
8
- function buildCanonicalUrl(seoUrl, pathname) {
9
- if (!seoUrl) {
10
- return undefined;
11
- }
12
- try {
13
- return new URL(normalizePathname(pathname), seoUrl).toString();
14
- }
15
- catch {
16
- return undefined;
17
- }
18
- }
19
- function seoToMeta(seo, pathname) {
20
- const canonical = buildCanonicalUrl(seo.url, pathname);
21
- return [
22
- ...(seo.title ? [{ title: seo.title }] : []),
23
- ...(seo.description ? [{ name: 'description', content: seo.description }] : []),
24
- ...(seo.siteName ? [{ property: 'og:site_name', content: seo.siteName }] : []),
25
- ...(seo.title ? [{ property: 'og:title', content: seo.title }] : []),
26
- ...(seo.description ? [{ property: 'og:description', content: seo.description }] : []),
27
- ...(canonical ? [{ property: 'og:url', content: canonical }] : []),
28
- ...(seo.image ? [{ property: 'og:image', content: seo.image }] : []),
29
- ...(seo.locale ? [{ property: 'og:locale', content: seo.locale }] : []),
30
- ...(seo.title ? [{ name: 'twitter:title', content: seo.title }] : []),
31
- ...(seo.description ? [{ name: 'twitter:description', content: seo.description }] : []),
32
- ...(seo.image ? [{ name: 'twitter:image', content: seo.image }] : []),
33
- ...(canonical ? [{ tagName: 'link', rel: 'canonical', href: canonical }] : []),
34
- ];
35
- }
36
- export function buildMetaForPath(pathname, routeData) {
37
- const seo = getSeoForPath(pathname, routeData);
38
- if (!seo) {
39
- return [];
40
- }
41
- return seoToMeta(seo, pathname);
42
- }
43
- export function buildFimoMeta(args) {
44
- const pathname = args.location.pathname;
45
- const firstMatch = args.matches[0];
46
- const rootData = firstMatch && typeof firstMatch === 'object' && 'data' in firstMatch
47
- ? firstMatch.data
48
- : undefined;
49
- const routeData = rootData && typeof rootData === 'object' ? rootData.fimoMetaData : undefined;
50
- const seo = getSeoForPath(pathname, routeData);
51
- if (!seo) {
52
- return [];
53
- }
54
- return seoToMeta(seo, pathname);
55
- }
@@ -1,13 +0,0 @@
1
- /**
2
- * Returns the attributes Fimo injects onto the root `<html>` element.
3
- * Currently: `lang` derived from the active locale or `i18n.defaultLocale`.
4
- * May grow to include `dir`, `data-theme`, or other a11y/theming attributes
5
- * without requiring changes to root.tsx.
6
- */
7
- export declare function fimoHtmlProps(localeOrOptions?: string | {
8
- locale?: string;
9
- }): {
10
- lang: string;
11
- dir: 'ltr' | 'rtl';
12
- };
13
- //# sourceMappingURL=htmlProps.d.ts.map
@@ -1,15 +0,0 @@
1
- // @ts-ignore - virtual module provided by fimoConfigPlugin in fimo/vite
2
- import rawConfig from 'virtual:fimo-config';
3
- import { getFimoTextDirection, toHtmlLang } from '../i18n/locale.js';
4
- const config = rawConfig;
5
- /**
6
- * Returns the attributes Fimo injects onto the root `<html>` element.
7
- * Currently: `lang` derived from the active locale or `i18n.defaultLocale`.
8
- * May grow to include `dir`, `data-theme`, or other a11y/theming attributes
9
- * without requiring changes to root.tsx.
10
- */
11
- export function fimoHtmlProps(localeOrOptions) {
12
- const explicitLocale = typeof localeOrOptions === 'string' ? localeOrOptions : localeOrOptions?.locale;
13
- const locale = explicitLocale ?? config.i18n?.defaultLocale ?? 'en';
14
- return { lang: toHtmlLang(locale), dir: getFimoTextDirection(locale) };
15
- }
@@ -1,25 +0,0 @@
1
- import type { CollectionContentCore, ContentClientConfig, ContentClientHandle, SingletonContentCore } from '../content/client/core-types.js';
2
- export interface SvelteKitContentClientConfig extends ContentClientConfig {
3
- apiUrl: string | undefined;
4
- defaultLocale?: string;
5
- }
6
- export interface SvelteKitEvent {
7
- fetch: typeof globalThis.fetch;
8
- }
9
- export interface SvelteKitContentModule {
10
- default: ContentClientHandle;
11
- }
12
- export type SvelteKitContentRegistry = Readonly<Record<string, SvelteKitContentModule>>;
13
- export interface CreateFimoOptions<TContent extends SvelteKitContentRegistry> {
14
- content: TContent;
15
- event: SvelteKitEvent;
16
- locale?: string;
17
- }
18
- export declare function createContentClient<T extends {
19
- id: string;
20
- }, TInput extends object>(config: SvelteKitContentClientConfig): CollectionContentCore<T, TInput>;
21
- export declare function createSingletonClient<T extends {
22
- id: string;
23
- }, TInput extends object>(config: SvelteKitContentClientConfig): SingletonContentCore<T, TInput>;
24
- export declare function createFimo<const TContent extends SvelteKitContentRegistry>({ content, event, locale, }: CreateFimoOptions<TContent>): TContent;
25
- //# sourceMappingURL=content.d.ts.map
@@ -1,33 +0,0 @@
1
- import { createServerContentClient, createServerSingletonClient } from '../content/client/server-content-client.js';
2
- import { createSvelteKitContentRuntime } from './runtime.js';
3
- const requestClientFactories = new WeakMap();
4
- export function createContentClient(config) {
5
- const create = (requestFetch, locale) => createServerContentClient(config, createSvelteKitContentRuntime({
6
- apiUrl: config.apiUrl,
7
- defaultLocale: locale ?? config.defaultLocale,
8
- fetch: requestFetch,
9
- }));
10
- const client = create(globalThis.fetch);
11
- requestClientFactories.set(client, create);
12
- return client;
13
- }
14
- export function createSingletonClient(config) {
15
- const create = (requestFetch, locale) => createServerSingletonClient(config, createSvelteKitContentRuntime({
16
- apiUrl: config.apiUrl,
17
- defaultLocale: locale ?? config.defaultLocale,
18
- fetch: requestFetch,
19
- }));
20
- const client = create(globalThis.fetch);
21
- requestClientFactories.set(client, create);
22
- return client;
23
- }
24
- export function createFimo({ content, event, locale, }) {
25
- return Object.fromEntries(Object.entries(content).map(([key, contentModule]) => {
26
- const create = requestClientFactories.get(contentModule.default);
27
- if (!create) {
28
- throw new Error(`Content module "${key}" was not created by fimo/sveltekit.`);
29
- }
30
- const client = create(event.fetch, locale);
31
- return [key, { ...contentModule, ...client, default: client }];
32
- }));
33
- }
@@ -1,5 +0,0 @@
1
- import type { LabelsSnapshot } from '../labels/core.js';
2
- /** Shared by duplicated `fimo` package instances in the same Svelte tree. */
3
- export declare const LABELS_KEY: unique symbol;
4
- export type LabelsSource = () => LabelsSnapshot;
5
- //# sourceMappingURL=context-contract.d.ts.map
@@ -1,2 +0,0 @@
1
- /** Shared by duplicated `fimo` package instances in the same Svelte tree. */
2
- export const LABELS_KEY = Symbol.for('fimo.sveltekit.labels');
@@ -1,8 +0,0 @@
1
- import { type Labels } from '../labels/core.js';
2
- /**
3
- * Read the labels installed by `FimoProvider`. Call it while a component
4
- * initializes; the returned `t()` is usable at any time afterwards and returns
5
- * a source-tracked `FimoString`, empty for keys the project has no value for.
6
- */
7
- export declare function useLabels(): Labels;
8
- //# sourceMappingURL=context.d.ts.map
@@ -1,25 +0,0 @@
1
- import { getContext } from 'svelte';
2
- import { createLabels } from '../labels/core.js';
3
- import { LABELS_KEY } from './context-contract.js';
4
- /**
5
- * Read the labels installed by `FimoProvider`. Call it while a component
6
- * initializes; the returned `t()` is usable at any time afterwards and returns
7
- * a source-tracked `FimoString`, empty for keys the project has no value for.
8
- */
9
- export function useLabels() {
10
- const readSnapshot = getContext(LABELS_KEY);
11
- if (!readSnapshot) {
12
- throw new Error('useLabels() found no Fimo labels. Render FimoProvider with the label snapshot from your root layout load.');
13
- }
14
- // Every member reads the snapshot on access: binding one `createLabels` result
15
- // here would freeze the labels at initialization and stop tracking `data`.
16
- return {
17
- get locale() {
18
- return readSnapshot().locale;
19
- },
20
- get snapshot() {
21
- return readSnapshot();
22
- },
23
- t: (key) => createLabels(readSnapshot()).t(key),
24
- };
25
- }
@@ -1,15 +0,0 @@
1
- import { type FormClient } from '../forms/index.js';
2
- import type { SvelteKitEvent } from './content.js';
3
- export interface CreateFimoFormClientOptions {
4
- event?: SvelteKitEvent;
5
- apiUrl?: string;
6
- defaultLocale?: string;
7
- }
8
- /**
9
- * Create a form client for a SvelteKit request. Pass `event` from a server
10
- * action or load function when the request-aware fetch should be preserved.
11
- */
12
- export declare function createFimoFormClient({ event, apiUrl, defaultLocale }?: CreateFimoFormClientOptions): FormClient;
13
- /** Browser-friendly default for simple client-side submissions. */
14
- export declare const formClient: FormClient;
15
- //# sourceMappingURL=forms.d.ts.map
@@ -1,15 +0,0 @@
1
- import { createFormClient } from '../forms/index.js';
2
- import { createSvelteKitContentRuntime } from './runtime.js';
3
- /**
4
- * Create a form client for a SvelteKit request. Pass `event` from a server
5
- * action or load function when the request-aware fetch should be preserved.
6
- */
7
- export function createFimoFormClient({ event, apiUrl, defaultLocale } = {}) {
8
- return createFormClient(createSvelteKitContentRuntime({
9
- apiUrl,
10
- defaultLocale,
11
- fetch: event?.fetch ?? globalThis.fetch,
12
- }));
13
- }
14
- /** Browser-friendly default for simple client-side submissions. */
15
- export const formClient = createFimoFormClient();
@@ -1,9 +0,0 @@
1
- export { createContentClient, createFimo, createSingletonClient, type CreateFimoOptions, type SvelteKitContentClientConfig, type SvelteKitContentModule, type SvelteKitContentRegistry, type SvelteKitEvent, } from './content.js';
2
- export { useLabels } from './context.js';
3
- export { getLabels, type GetLabelsOptions } from './labels.js';
4
- export { createFimoFormClient, formClient } from './forms.js';
5
- export { type FormClient, type FormSubmissionResult } from '../forms/index.js';
6
- export type { Labels, LabelsSnapshot } from '../labels/core.js';
7
- export type { CollectionContentCore as CollectionContentClient, SingletonContentCore as SingletonContentClient, } from '../content/client/core-types.js';
8
- export * from '../content/index.js';
9
- //# sourceMappingURL=index.d.ts.map
@@ -1,5 +0,0 @@
1
- export { createContentClient, createFimo, createSingletonClient, } from './content.js';
2
- export { useLabels } from './context.js';
3
- export { getLabels } from './labels.js';
4
- export { createFimoFormClient, formClient } from './forms.js';
5
- export * from '../content/index.js';
@@ -1,6 +0,0 @@
1
- export { renderRichTextHtml } from '../primitives/lib/render-rich-text.js';
2
- export { resolveImagePresentation, type ImageFit } from '../primitives/lib/image-optimization.js';
3
- export { LABELS_KEY, type LabelsSource } from './context-contract.js';
4
- export { connectPreview, ensurePreviewScript, sendPreviewLocation, type PreviewNavigation } from './preview.js';
5
- export declare function mergeSvelteImageStyle(style: string | null | undefined, objectFit: string): string;
6
- //# sourceMappingURL=internal.d.ts.map
@@ -1,12 +0,0 @@
1
- export { renderRichTextHtml } from '../primitives/lib/render-rich-text.js';
2
- export { resolveImagePresentation } from '../primitives/lib/image-optimization.js';
3
- export { LABELS_KEY } from './context-contract.js';
4
- export { connectPreview, ensurePreviewScript, sendPreviewLocation } from './preview.js';
5
- export function mergeSvelteImageStyle(style, objectFit) {
6
- if (style && /(?:^|;)\s*object-fit\s*:/i.test(style)) {
7
- return style;
8
- }
9
- const value = style?.trim() ?? '';
10
- const separator = value === '' || value.endsWith(';') ? '' : ';';
11
- return `${value}${separator}object-fit:${objectFit}`;
12
- }
@@ -1,20 +0,0 @@
1
- import type { LabelsSnapshot } from '../labels/core.js';
2
- import type { SvelteKitEvent } from './content.js';
3
- export interface GetLabelsOptions {
4
- /** Optional escape hatch for a custom content API endpoint. */
5
- apiUrl?: string;
6
- event: SvelteKitEvent;
7
- /**
8
- * The application resolves the active locale; Fimo never infers it from the
9
- * URL. Omit it to let the Fimo API answer with the project default.
10
- */
11
- locale?: string;
12
- }
13
- /**
14
- * Read the label dictionary for one locale through the request `fetch`.
15
- *
16
- * Returns plain data because SvelteKit serializes whatever a `load` returns:
17
- * pass it to `FimoProvider` in a layout to expose `Label` and `useLabels()`.
18
- */
19
- export declare function getLabels({ apiUrl, event, locale }: GetLabelsOptions): Promise<LabelsSnapshot>;
20
- //# sourceMappingURL=labels.d.ts.map
@@ -1,13 +0,0 @@
1
- import { fetchLabels } from '../labels/fetch.js';
2
- import { createSvelteKitContentRuntime } from './runtime.js';
3
- /**
4
- * Read the label dictionary for one locale through the request `fetch`.
5
- *
6
- * Returns plain data because SvelteKit serializes whatever a `load` returns:
7
- * pass it to `FimoProvider` in a layout to expose `Label` and `useLabels()`.
8
- */
9
- export async function getLabels({ apiUrl, event, locale }) {
10
- const runtime = createSvelteKitContentRuntime({ apiUrl, fetch: event.fetch });
11
- const labels = await fetchLabels(runtime, { locale });
12
- return labels.snapshot;
13
- }
@@ -1,28 +0,0 @@
1
- export interface PreviewNavigation {
2
- /** SvelteKit `goto` — the app router stays in charge of the transition. */
3
- goto: (to: string) => unknown;
4
- /** SvelteKit `invalidateAll` — reruns every `load` against fresh content. */
5
- invalidateAll: () => Promise<unknown>;
6
- /** Optional app-owned locale resolver, evaluated for every bridge message. */
7
- locale?: () => string | undefined;
8
- }
9
- /** Load the platform preview script once. Empty configuration keeps preview disabled. */
10
- export declare function ensurePreviewScript(src: string | undefined): boolean;
11
- /**
12
- * Report where the app is now, and in which locale. Studio keeps its URL,
13
- * route selector and content locale in sync from this.
14
- *
15
- * `locale` defaults to the locale the SvelteKit shell rendered into
16
- * `<html lang>`; pass one explicitly when the app resolves it somewhere the
17
- * document does not show, for example a cookie or a user preference.
18
- */
19
- export declare function sendPreviewLocation(locale?: string): void;
20
- /**
21
- * Listen for the live Studio preview protocol and answer it with SvelteKit's
22
- * own navigation APIs. Returns the disconnect function.
23
- *
24
- * Only messages from the established parent origin are honored. History stays
25
- * native, so Studio's back/forward controls need no protocol of their own.
26
- */
27
- export declare function connectPreview({ goto, invalidateAll, locale }: PreviewNavigation): () => void;
28
- //# sourceMappingURL=preview.d.ts.map
@@ -1,82 +0,0 @@
1
- import { getDocumentLocale, getPreviewLocationChange, getPreviewParentOrigin } from '../shared/preview-location.js';
2
- /** Load the platform preview script once. Empty configuration keeps preview disabled. */
3
- export function ensurePreviewScript(src) {
4
- if (!src) {
5
- return false;
6
- }
7
- const exists = Array.from(document.scripts).some((script) => script.getAttribute('src') === src);
8
- if (!exists) {
9
- const script = document.createElement('script');
10
- script.src = src;
11
- script.defer = true;
12
- document.head.appendChild(script);
13
- }
14
- return true;
15
- }
16
- /**
17
- * Report where the app is now, and in which locale. Studio keeps its URL,
18
- * route selector and content locale in sync from this.
19
- *
20
- * `locale` defaults to the locale the SvelteKit shell rendered into
21
- * `<html lang>`; pass one explicitly when the app resolves it somewhere the
22
- * document does not show, for example a cookie or a user preference.
23
- */
24
- export function sendPreviewLocation(locale) {
25
- const parentOrigin = getPreviewParentOrigin();
26
- window.parent.postMessage({
27
- type: 'nav/locationChange',
28
- payload: getPreviewLocationChange(window.location, locale ?? getDocumentLocale(document, 'en'), parentOrigin),
29
- }, parentOrigin ?? '*');
30
- }
31
- /** Reliable-delivery reply: the parent retries an unacknowledged message forever. */
32
- function acknowledge(message, result) {
33
- const parentOrigin = getPreviewParentOrigin();
34
- if (!message.requiresAck || typeof message.messageId !== 'string' || !parentOrigin) {
35
- return;
36
- }
37
- window.parent.postMessage({ type: 'ack', payload: { messageId: message.messageId, ...result } }, parentOrigin);
38
- }
39
- async function refreshContent(message, invalidateAll) {
40
- try {
41
- await invalidateAll();
42
- acknowledge(message, { ok: true });
43
- }
44
- catch (error) {
45
- console.error(error);
46
- acknowledge(message, { ok: false, error: error instanceof Error ? error.message : String(error) });
47
- }
48
- }
49
- /**
50
- * Listen for the live Studio preview protocol and answer it with SvelteKit's
51
- * own navigation APIs. Returns the disconnect function.
52
- *
53
- * Only messages from the established parent origin are honored. History stays
54
- * native, so Studio's back/forward controls need no protocol of their own.
55
- */
56
- export function connectPreview({ goto, invalidateAll, locale }) {
57
- const onMessage = (event) => {
58
- const parentOrigin = getPreviewParentOrigin();
59
- if (event.source !== window.parent || !parentOrigin || event.origin !== parentOrigin) {
60
- return;
61
- }
62
- const message = (event.data ?? {});
63
- switch (message.type) {
64
- case 'nav/navigate':
65
- if (typeof message.payload?.to === 'string') {
66
- void goto(message.payload.to);
67
- }
68
- return;
69
- case 'nav/read-routes':
70
- // The app owns its route table; answer with where it actually is.
71
- sendPreviewLocation(locale?.());
72
- return;
73
- case 'content/refresh':
74
- void refreshContent(message, invalidateAll);
75
- return;
76
- }
77
- };
78
- window.addEventListener('message', onMessage);
79
- return () => {
80
- window.removeEventListener('message', onMessage);
81
- };
82
- }
@@ -1,9 +0,0 @@
1
- import { type ContentRuntime } from '../content/client/runtime.js';
2
- export interface SvelteKitContentRuntimeOptions {
3
- /** Optional escape hatch for tests or deliberately custom API endpoints. */
4
- apiUrl?: string;
5
- defaultLocale?: string;
6
- fetch: typeof globalThis.fetch;
7
- }
8
- export declare function createSvelteKitContentRuntime(options: SvelteKitContentRuntimeOptions): ContentRuntime;
9
- //# sourceMappingURL=runtime.d.ts.map
@@ -1,26 +0,0 @@
1
- import { env as publicEnv } from '$env/dynamic/public';
2
- import { requireContentApiUrl } from '../content/client/runtime.js';
3
- function resolveApiUrl(apiUrl) {
4
- return (apiUrl ??
5
- publicEnv.PUBLIC_FIMO_API_URL ??
6
- (typeof process === 'undefined' ? undefined : process.env.PUBLIC_FIMO_API_URL));
7
- }
8
- export function createSvelteKitContentRuntime(options) {
9
- const apiUrl = resolveApiUrl(options.apiUrl);
10
- return {
11
- apiBase() {
12
- return requireContentApiUrl(apiUrl, 'PUBLIC_FIMO_API_URL');
13
- },
14
- defaultLocale() {
15
- // `undefined` leaves `locale` off the request so the Fimo API answers with
16
- // the project default; hardcoding `en` here would silently override it.
17
- return options.defaultLocale?.trim() || undefined;
18
- },
19
- headers(extra) {
20
- return { ...extra };
21
- },
22
- fetch(input, init) {
23
- return options.fetch(input, init);
24
- },
25
- };
26
- }
@@ -1,13 +0,0 @@
1
- import type { Pageview } from './Pageview.js';
2
- type PageviewComponent = typeof Pageview;
3
- type PageviewModule = {
4
- Pageview: PageviewComponent;
5
- };
6
- type PageviewLoader = () => Promise<PageviewModule>;
7
- type DisplayRoute = Parameters<PageviewComponent>[0]['routes'][number];
8
- export declare function loadPageviewComponent(loadPageview?: PageviewLoader): Promise<typeof Pageview | null>;
9
- export declare function OptionalTracking({ routes }: {
10
- routes: DisplayRoute[];
11
- }): import("react/jsx-runtime").JSX.Element | null;
12
- export {};
13
- //# sourceMappingURL=OptionalTracking.d.ts.map