fimo 0.7.0-experimental.1 → 0.7.0-experimental.11

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 (310) hide show
  1. package/assets/content-templates/hooks-template.eta +27 -73
  2. package/assets/content-templates/types-template.eta +1 -4
  3. package/assets/skills/fimo/SKILL.md +2 -2
  4. package/assets/skills/fimo/references/content.md +42 -46
  5. package/assets/skills/fimo/references/locales.md +0 -8
  6. package/assets/skills/fimo/references/setup-react-router.md +2 -2
  7. package/assets/skills/fimo/references/ui.md +1 -1
  8. package/assets/skills/fimo-cli/references/content.md +14 -17
  9. package/assets/skills/fimo-cli/references/locales.md +0 -6
  10. package/assets/skills/fimo-migration/SKILL.md +22 -2
  11. package/assets/skills/fimo-migration/references/content.md +8 -0
  12. package/assets/skills/fimo-migration/references/manifest.md +35 -0
  13. package/assets/skills/fimo-migration/references/qa.md +24 -2
  14. package/assets/skills/fimo-migration/references/workflow.md +12 -1
  15. package/assets/skills/fimo-migration/references/wrap.md +617 -0
  16. package/assets/skills/fimo-studio/references/visual-editing.md +5 -3
  17. package/dist/build/vite/plugins/translations.d.ts +2 -8
  18. package/dist/build/vite/plugins/translations.d.ts.map +1 -1
  19. package/dist/build/vite/plugins/translations.js +3 -121
  20. package/dist/cli/bundle.json +1 -1
  21. package/dist/cli/index.js +20644 -12459
  22. package/dist/runtime/app/FimoProviders.d.ts +1 -11
  23. package/dist/runtime/app/FimoProviders.d.ts.map +1 -1
  24. package/dist/runtime/app/FimoProviders.js +2 -23
  25. package/dist/runtime/astro/index.d.ts +2 -0
  26. package/dist/runtime/astro/index.d.ts.map +1 -0
  27. package/dist/runtime/astro/index.js +3 -0
  28. package/dist/runtime/astro/server.d.ts +3 -0
  29. package/dist/runtime/astro/server.d.ts.map +1 -0
  30. package/dist/runtime/astro/server.js +6 -0
  31. package/dist/runtime/content/utils/retrieve-data-sources.d.ts +0 -1
  32. package/dist/runtime/content/utils/retrieve-data-sources.d.ts.map +1 -1
  33. package/dist/runtime/content/utils/retrieve-data-sources.js +4 -27
  34. package/dist/runtime/i18n/FimoLocaleContext.d.ts.map +1 -1
  35. package/dist/runtime/i18n/FimoLocaleContext.js +1 -0
  36. package/dist/runtime/next/FimoNextProviders.d.ts +24 -0
  37. package/dist/runtime/next/FimoNextProviders.d.ts.map +1 -0
  38. package/dist/runtime/next/FimoNextProviders.js +20 -0
  39. package/dist/runtime/next/FimoNextScripts.d.ts +10 -0
  40. package/dist/runtime/next/FimoNextScripts.d.ts.map +1 -0
  41. package/dist/runtime/next/FimoNextScripts.js +19 -0
  42. package/dist/runtime/next/index.d.ts +14 -0
  43. package/dist/runtime/next/index.d.ts.map +1 -0
  44. package/dist/runtime/next/index.js +14 -0
  45. package/dist/runtime/next/server.d.ts +2 -0
  46. package/dist/runtime/next/server.d.ts.map +1 -0
  47. package/dist/runtime/next/server.js +4 -0
  48. package/dist/runtime/nuxt/composables.d.ts +9 -0
  49. package/dist/runtime/nuxt/composables.d.ts.map +1 -0
  50. package/dist/runtime/nuxt/composables.js +57 -0
  51. package/dist/runtime/nuxt/index.d.ts +3 -0
  52. package/dist/runtime/nuxt/index.d.ts.map +1 -0
  53. package/dist/runtime/nuxt/index.js +6 -0
  54. package/dist/runtime/nuxt/server.d.ts +3 -0
  55. package/dist/runtime/nuxt/server.d.ts.map +1 -0
  56. package/dist/runtime/nuxt/server.js +6 -0
  57. package/dist/runtime/paths/get-fimo-paths.d.ts.map +1 -1
  58. package/dist/runtime/paths/get-fimo-paths.js +5 -15
  59. package/dist/runtime/primitives/labels-hook.d.ts +33 -0
  60. package/dist/runtime/primitives/labels-hook.d.ts.map +1 -0
  61. package/dist/runtime/primitives/labels-hook.js +41 -0
  62. package/dist/runtime/primitives/labels-store.d.ts +12 -0
  63. package/dist/runtime/primitives/labels-store.d.ts.map +1 -0
  64. package/dist/runtime/primitives/labels-store.js +60 -0
  65. package/dist/runtime/primitives/labels-store.test.d.ts +2 -0
  66. package/dist/runtime/primitives/labels-store.test.d.ts.map +1 -0
  67. package/dist/runtime/primitives/labels-store.test.js +66 -0
  68. package/dist/runtime/primitives/lib/primitives.d.ts +2 -2
  69. package/dist/runtime/primitives/lib/primitives.d.ts.map +1 -1
  70. package/dist/runtime/primitives/lib/query.d.ts +3 -5
  71. package/dist/runtime/primitives/lib/query.d.ts.map +1 -1
  72. package/dist/runtime/primitives/lib/useFimoLiveValue.d.ts +5 -3
  73. package/dist/runtime/primitives/lib/useFimoLiveValue.d.ts.map +1 -1
  74. package/dist/runtime/primitives/lib/useFimoLiveValue.js +11 -4
  75. package/dist/runtime/primitives/public-surface.test.js +5 -9
  76. package/dist/runtime/primitives/translations.d.ts +1 -27
  77. package/dist/runtime/primitives/translations.d.ts.map +1 -1
  78. package/dist/runtime/primitives/translations.js +7 -85
  79. package/dist/runtime/react/FimoSpaProviders.d.ts +36 -0
  80. package/dist/runtime/react/FimoSpaProviders.d.ts.map +1 -0
  81. package/dist/runtime/react/FimoSpaProviders.js +63 -0
  82. package/dist/runtime/react/index.d.ts +33 -0
  83. package/dist/runtime/react/index.d.ts.map +1 -0
  84. package/dist/runtime/react/index.js +39 -0
  85. package/dist/runtime/remix/FimoRemixProviders.d.ts +16 -0
  86. package/dist/runtime/remix/FimoRemixProviders.d.ts.map +1 -0
  87. package/dist/runtime/remix/FimoRemixProviders.js +12 -0
  88. package/dist/runtime/remix/FimoRemixScripts.d.ts +10 -0
  89. package/dist/runtime/remix/FimoRemixScripts.d.ts.map +1 -0
  90. package/dist/runtime/remix/FimoRemixScripts.js +19 -0
  91. package/dist/runtime/remix/index.d.ts +12 -0
  92. package/dist/runtime/remix/index.d.ts.map +1 -0
  93. package/dist/runtime/remix/index.js +11 -0
  94. package/dist/runtime/remix/server.d.ts +2 -0
  95. package/dist/runtime/remix/server.d.ts.map +1 -0
  96. package/dist/runtime/remix/server.js +2 -0
  97. package/dist/runtime/seo/buildSeoForPath.d.ts +3 -1
  98. package/dist/runtime/seo/buildSeoForPath.d.ts.map +1 -1
  99. package/dist/runtime/seo/buildSeoForPath.js +1 -4
  100. package/dist/runtime/shared/display-routes.d.ts +14 -0
  101. package/dist/runtime/shared/display-routes.d.ts.map +1 -0
  102. package/dist/runtime/shared/display-routes.js +25 -0
  103. package/dist/runtime/shared/fimo-config.server.d.ts.map +1 -1
  104. package/dist/runtime/shared/fimo-config.server.js +1 -0
  105. package/dist/runtime/shared/fimo-config.types.d.ts +2 -0
  106. package/dist/runtime/shared/fimo-config.types.d.ts.map +1 -1
  107. package/dist/runtime/shared/i18n-messages.d.ts +29 -0
  108. package/dist/runtime/shared/i18n-messages.d.ts.map +1 -0
  109. package/dist/runtime/shared/i18n-messages.js +79 -0
  110. package/dist/runtime/shared/i18n-messages.test.d.ts +2 -0
  111. package/dist/runtime/shared/i18n-messages.test.d.ts.map +1 -0
  112. package/dist/runtime/shared/i18n-messages.test.js +39 -0
  113. package/dist/runtime/shared/labels-fetch.pure.d.ts +17 -0
  114. package/dist/runtime/shared/labels-fetch.pure.d.ts.map +1 -0
  115. package/dist/runtime/shared/labels-fetch.pure.js +71 -0
  116. package/dist/runtime/shared/labels-fetch.server.d.ts +7 -0
  117. package/dist/runtime/shared/labels-fetch.server.d.ts.map +1 -0
  118. package/dist/runtime/shared/labels-fetch.server.js +97 -0
  119. package/dist/runtime/shared/labels-t.pure.d.ts +2 -0
  120. package/dist/runtime/shared/labels-t.pure.d.ts.map +1 -0
  121. package/dist/runtime/shared/labels-t.pure.js +10 -0
  122. package/dist/runtime/strapi/client.d.ts +26 -0
  123. package/dist/runtime/strapi/client.d.ts.map +1 -0
  124. package/dist/runtime/strapi/client.js +88 -0
  125. package/dist/runtime/strapi/client.test.d.ts +2 -0
  126. package/dist/runtime/strapi/client.test.d.ts.map +1 -0
  127. package/dist/runtime/strapi/client.test.js +64 -0
  128. package/dist/runtime/strapi/index.d.ts +5 -0
  129. package/dist/runtime/strapi/index.d.ts.map +1 -0
  130. package/dist/runtime/strapi/index.js +6 -0
  131. package/dist/runtime/strapi/reshape.d.ts +28 -0
  132. package/dist/runtime/strapi/reshape.d.ts.map +1 -0
  133. package/dist/runtime/strapi/reshape.js +79 -0
  134. package/dist/runtime/strapi/reshape.test.d.ts +2 -0
  135. package/dist/runtime/strapi/reshape.test.d.ts.map +1 -0
  136. package/dist/runtime/strapi/reshape.test.js +33 -0
  137. package/dist/runtime/svelte/index.d.ts +3 -0
  138. package/dist/runtime/svelte/index.d.ts.map +1 -0
  139. package/dist/runtime/svelte/index.js +7 -0
  140. package/dist/runtime/svelte/server.d.ts +3 -0
  141. package/dist/runtime/svelte/server.d.ts.map +1 -0
  142. package/dist/runtime/svelte/server.js +6 -0
  143. package/dist/runtime/vue/index.d.ts +3 -0
  144. package/dist/runtime/vue/index.d.ts.map +1 -0
  145. package/dist/runtime/vue/index.js +5 -0
  146. package/dist/runtime/vue/server.d.ts +3 -0
  147. package/dist/runtime/vue/server.d.ts.map +1 -0
  148. package/dist/runtime/vue/server.js +6 -0
  149. package/dist/runtime/wrapped/FimoFileLink.d.ts +17 -0
  150. package/dist/runtime/wrapped/FimoFileLink.d.ts.map +1 -0
  151. package/dist/runtime/wrapped/FimoFileLink.js +19 -0
  152. package/dist/runtime/wrapped/FimoMediaImage.d.ts +14 -0
  153. package/dist/runtime/wrapped/FimoMediaImage.d.ts.map +1 -0
  154. package/dist/runtime/wrapped/FimoMediaImage.js +20 -0
  155. package/dist/runtime/wrapped/FimoMediaVideo.d.ts +14 -0
  156. package/dist/runtime/wrapped/FimoMediaVideo.d.ts.map +1 -0
  157. package/dist/runtime/wrapped/FimoMediaVideo.js +20 -0
  158. package/dist/runtime/wrapped/FimoRichTextBlock.d.ts +23 -0
  159. package/dist/runtime/wrapped/FimoRichTextBlock.d.ts.map +1 -0
  160. package/dist/runtime/wrapped/FimoRichTextBlock.js +22 -0
  161. package/dist/runtime/wrapped/FimoText.d.ts +22 -0
  162. package/dist/runtime/wrapped/FimoText.d.ts.map +1 -0
  163. package/dist/runtime/wrapped/FimoText.js +20 -0
  164. package/dist/runtime/wrapped/WrappedContentContext.d.ts +28 -0
  165. package/dist/runtime/wrapped/WrappedContentContext.d.ts.map +1 -0
  166. package/dist/runtime/wrapped/WrappedContentContext.js +30 -0
  167. package/dist/runtime/wrapped/WrappedProviders.d.ts +33 -0
  168. package/dist/runtime/wrapped/WrappedProviders.d.ts.map +1 -0
  169. package/dist/runtime/wrapped/WrappedProviders.js +101 -0
  170. package/dist/runtime/wrapped/dom.d.ts +4 -0
  171. package/dist/runtime/wrapped/dom.d.ts.map +1 -0
  172. package/dist/runtime/wrapped/dom.js +23 -0
  173. package/dist/runtime/wrapped/dom.test.d.ts +2 -0
  174. package/dist/runtime/wrapped/dom.test.d.ts.map +1 -0
  175. package/dist/runtime/wrapped/dom.test.js +16 -0
  176. package/dist/runtime/wrapped/server.d.ts +77 -0
  177. package/dist/runtime/wrapped/server.d.ts.map +1 -0
  178. package/dist/runtime/wrapped/server.js +237 -0
  179. package/dist/runtime/wrapped/server.test.d.ts +2 -0
  180. package/dist/runtime/wrapped/server.test.d.ts.map +1 -0
  181. package/dist/runtime/wrapped/server.test.js +91 -0
  182. package/dist/scripts/apply-wrap-templates.d.ts +61 -0
  183. package/dist/scripts/apply-wrap-templates.js +132 -0
  184. package/dist/scripts/apply-wrap-templates.test.d.ts +1 -0
  185. package/dist/scripts/apply-wrap-templates.test.js +199 -0
  186. package/dist/scripts/apply-wrap.d.ts +46 -0
  187. package/dist/scripts/apply-wrap.js +278 -0
  188. package/dist/scripts/apply-wrap.test.d.ts +1 -0
  189. package/dist/scripts/apply-wrap.test.js +226 -0
  190. package/dist/scripts/cms/discover.d.ts +2 -0
  191. package/dist/scripts/cms/discover.js +17 -0
  192. package/dist/scripts/cms/example-content.d.ts +32 -0
  193. package/dist/scripts/cms/example-content.js +108 -0
  194. package/dist/scripts/cms/example-content.test.d.ts +1 -0
  195. package/dist/scripts/cms/example-content.test.js +66 -0
  196. package/dist/scripts/cms/strapi/detect.d.ts +2 -0
  197. package/dist/scripts/cms/strapi/detect.js +186 -0
  198. package/dist/scripts/cms/strapi/detect.test.d.ts +1 -0
  199. package/dist/scripts/cms/strapi/detect.test.js +56 -0
  200. package/dist/scripts/cms/strapi/index.d.ts +3 -0
  201. package/dist/scripts/cms/strapi/index.js +25 -0
  202. package/dist/scripts/cms/strapi/list-source.d.ts +17 -0
  203. package/dist/scripts/cms/strapi/list-source.js +90 -0
  204. package/dist/scripts/cms/strapi/list-source.test.d.ts +1 -0
  205. package/dist/scripts/cms/strapi/list-source.test.js +33 -0
  206. package/dist/scripts/cms/strapi/schema-map.d.ts +9 -0
  207. package/dist/scripts/cms/strapi/schema-map.js +149 -0
  208. package/dist/scripts/cms/strapi/schema-map.test.d.ts +1 -0
  209. package/dist/scripts/cms/strapi/schema-map.test.js +91 -0
  210. package/dist/scripts/cms/strapi/touchpoints.d.ts +31 -0
  211. package/dist/scripts/cms/strapi/touchpoints.js +145 -0
  212. package/dist/scripts/cms/strapi/touchpoints.test.d.ts +1 -0
  213. package/dist/scripts/cms/strapi/touchpoints.test.js +62 -0
  214. package/dist/scripts/cms/strapi/wire-client.d.ts +15 -0
  215. package/dist/scripts/cms/strapi/wire-client.js +107 -0
  216. package/dist/scripts/cms/strapi/wire-client.test.d.ts +1 -0
  217. package/dist/scripts/cms/strapi/wire-client.test.js +51 -0
  218. package/dist/scripts/cms/strapi/wiring.d.ts +17 -0
  219. package/dist/scripts/cms/strapi/wiring.js +36 -0
  220. package/dist/scripts/cms/strapi/wiring.test.d.ts +1 -0
  221. package/dist/scripts/cms/strapi/wiring.test.js +27 -0
  222. package/dist/scripts/cms/types.d.ts +117 -0
  223. package/dist/scripts/cms/types.js +11 -0
  224. package/dist/scripts/detect-framework.d.ts +39 -0
  225. package/dist/scripts/detect-framework.js +133 -0
  226. package/dist/scripts/detect-framework.test.d.ts +1 -0
  227. package/dist/scripts/detect-framework.test.js +122 -0
  228. package/dist/scripts/draft-rows.d.ts +19 -0
  229. package/dist/scripts/draft-rows.js +135 -0
  230. package/dist/scripts/draft-rows.test.d.ts +1 -0
  231. package/dist/scripts/draft-rows.test.js +113 -0
  232. package/dist/scripts/draft-schemas.d.ts +27 -0
  233. package/dist/scripts/draft-schemas.js +188 -0
  234. package/dist/scripts/draft-schemas.test.d.ts +1 -0
  235. package/dist/scripts/draft-schemas.test.js +152 -0
  236. package/dist/scripts/extract-translations.js +16 -11
  237. package/dist/scripts/extract-translations.test.d.ts +1 -0
  238. package/dist/scripts/extract-translations.test.js +104 -0
  239. package/dist/scripts/frameworks/astro/routes.d.ts +3 -0
  240. package/dist/scripts/frameworks/astro/routes.js +55 -0
  241. package/dist/scripts/frameworks/astro/template-style.d.ts +7 -0
  242. package/dist/scripts/frameworks/astro/template-style.js +19 -0
  243. package/dist/scripts/frameworks/discover.d.ts +70 -0
  244. package/dist/scripts/frameworks/discover.js +178 -0
  245. package/dist/scripts/frameworks/next/rewire.d.ts +30 -0
  246. package/dist/scripts/frameworks/next/rewire.js +258 -0
  247. package/dist/scripts/frameworks/next/rewire.test.d.ts +1 -0
  248. package/dist/scripts/frameworks/next/rewire.test.js +134 -0
  249. package/dist/scripts/frameworks/next/routes.d.ts +17 -0
  250. package/dist/scripts/frameworks/next/routes.js +134 -0
  251. package/dist/scripts/frameworks/next/routes.test.d.ts +1 -0
  252. package/dist/scripts/frameworks/next/routes.test.js +64 -0
  253. package/dist/scripts/frameworks/next/wiring.d.ts +33 -0
  254. package/dist/scripts/frameworks/next/wiring.js +186 -0
  255. package/dist/scripts/frameworks/next/wiring.test.d.ts +1 -0
  256. package/dist/scripts/frameworks/next/wiring.test.js +174 -0
  257. package/dist/scripts/frameworks/nuxt/routes.d.ts +3 -0
  258. package/dist/scripts/frameworks/nuxt/routes.js +54 -0
  259. package/dist/scripts/frameworks/nuxt/template-style.d.ts +9 -0
  260. package/dist/scripts/frameworks/nuxt/template-style.js +27 -0
  261. package/dist/scripts/frameworks/remix/routes.d.ts +3 -0
  262. package/dist/scripts/frameworks/remix/routes.js +50 -0
  263. package/dist/scripts/frameworks/support.d.ts +75 -0
  264. package/dist/scripts/frameworks/support.js +165 -0
  265. package/dist/scripts/frameworks/support.test.d.ts +1 -0
  266. package/dist/scripts/frameworks/support.test.js +87 -0
  267. package/dist/scripts/frameworks/sveltekit/routes.d.ts +3 -0
  268. package/dist/scripts/frameworks/sveltekit/routes.js +50 -0
  269. package/dist/scripts/frameworks/sveltekit/template-style.d.ts +9 -0
  270. package/dist/scripts/frameworks/sveltekit/template-style.js +54 -0
  271. package/dist/scripts/frameworks/vite/routes.d.ts +15 -0
  272. package/dist/scripts/frameworks/vite/routes.js +93 -0
  273. package/dist/scripts/frameworks/vite/routes.test.d.ts +1 -0
  274. package/dist/scripts/frameworks/vite/routes.test.js +73 -0
  275. package/dist/scripts/frameworks/vite/wiring.d.ts +10 -0
  276. package/dist/scripts/frameworks/vite/wiring.js +99 -0
  277. package/dist/scripts/frameworks/vite/wiring.test.d.ts +1 -0
  278. package/dist/scripts/frameworks/vite/wiring.test.js +88 -0
  279. package/dist/scripts/generated-types.test.js +1 -1
  280. package/dist/scripts/i18n-namespace.d.ts +27 -0
  281. package/dist/scripts/i18n-namespace.js +155 -0
  282. package/dist/scripts/lib/validation-report.d.ts +1 -0
  283. package/dist/scripts/lib/validation-report.js +3 -0
  284. package/dist/scripts/render-parity/capture.d.ts +56 -0
  285. package/dist/scripts/render-parity/capture.js +366 -0
  286. package/dist/scripts/render-parity/capture.test.d.ts +1 -0
  287. package/dist/scripts/render-parity/capture.test.js +306 -0
  288. package/dist/scripts/render-parity/compare.d.ts +59 -0
  289. package/dist/scripts/render-parity/compare.js +0 -0
  290. package/dist/scripts/render-parity/compare.test.d.ts +1 -0
  291. package/dist/scripts/render-parity/compare.test.js +98 -0
  292. package/dist/scripts/render-parity/normalize-html.d.ts +13 -0
  293. package/dist/scripts/render-parity/normalize-html.js +223 -0
  294. package/dist/scripts/render-parity/normalize-html.test.d.ts +1 -0
  295. package/dist/scripts/render-parity/normalize-html.test.js +58 -0
  296. package/dist/scripts/render-parity/types.d.ts +41 -0
  297. package/dist/scripts/render-parity/types.js +1 -0
  298. package/dist/scripts/resolve-routes.js +1 -1
  299. package/dist/scripts/scan-wrappable.d.ts +196 -0
  300. package/dist/scripts/scan-wrappable.js +1232 -0
  301. package/dist/scripts/scan-wrappable.test.d.ts +1 -0
  302. package/dist/scripts/scan-wrappable.test.js +521 -0
  303. package/dist/scripts/sync-schemas.test.js +4 -24
  304. package/dist/scripts/validate-route-metadata.js +11 -0
  305. package/dist/scripts/validate-schemas.test.js +2 -2
  306. package/package.json +92 -5
  307. package/templates/react-router/package.json +7 -10
  308. package/dist/runtime/paths/get-fimo-paths.test.d.ts +0 -2
  309. package/dist/runtime/paths/get-fimo-paths.test.d.ts.map +0 -1
  310. package/dist/runtime/paths/get-fimo-paths.test.js +0 -69
@@ -0,0 +1,88 @@
1
+ // Native `fimo/strapi` read adapter — the generic interception point. Every
2
+ // Strapi client (hand-rolled or `@strapi/client`) ultimately does a single
3
+ // `fetch(<strapiRestUrl>)`; this returns a `fetch`-compatible function that
4
+ // serves that request from Fimo (via `fetchEntries` + the reshape) when the URL
5
+ // maps to a scaffolded content type, and transparently falls through to the
6
+ // real fetch (the live CMS) otherwise. Intercepting at the fetch boundary is
7
+ // what makes "any Strapi project" work — the client's method surface is
8
+ // irrelevant.
9
+ import { fetchEntries } from '../wrapped/server.js';
10
+ import { fimoEntriesToStrapiList, fimoEntryToStrapiSingle } from './reshape.js';
11
+ function positiveInt(value) {
12
+ if (value == null) {
13
+ return undefined;
14
+ }
15
+ const n = Number(value);
16
+ return Number.isFinite(n) && n > 0 ? n : undefined;
17
+ }
18
+ /**
19
+ * Parse a Strapi REST URL into the parts the Fimo read needs. Best-effort:
20
+ * pagination + locale + top-level `$eq` filters (enough for list, detail-by-slug,
21
+ * and singleton reads); richer `qs` filters are ignored (fake content tolerates
22
+ * an unfiltered set).
23
+ */
24
+ export function parseStrapiUrl(rawUrl, apiPrefix = '/api') {
25
+ let url;
26
+ try {
27
+ url = new URL(rawUrl, 'http://fimo.local');
28
+ }
29
+ catch {
30
+ return null;
31
+ }
32
+ const marker = `${apiPrefix}/`;
33
+ const at = url.pathname.indexOf(marker);
34
+ if (at === -1) {
35
+ return null;
36
+ }
37
+ const segments = url.pathname
38
+ .slice(at + marker.length)
39
+ .split('/')
40
+ .filter(Boolean);
41
+ if (segments.length === 0) {
42
+ return null;
43
+ }
44
+ const q = url.searchParams;
45
+ const where = {};
46
+ for (const [key, value] of q.entries()) {
47
+ const eq = key.match(/^filters\[([^\][]+)\]\[\$eq\]$/);
48
+ if (eq) {
49
+ where[eq[1]] = value;
50
+ }
51
+ }
52
+ return {
53
+ pluralName: segments[0],
54
+ documentId: segments[1],
55
+ locale: q.get('locale') ?? undefined,
56
+ pageSize: positiveInt(q.get('pagination[pageSize]') ?? q.get('pagination[limit]')),
57
+ where: Object.keys(where).length > 0 ? where : undefined,
58
+ };
59
+ }
60
+ /** Build a `fetch`-compatible function that serves scaffolded content from Fimo. */
61
+ export function createFimoStrapiFetch(options, realFetch = fetch) {
62
+ const singletons = new Set(options.singletons ?? []);
63
+ const read = { apiUrl: options.apiUrl, rootDir: options.rootDir };
64
+ return (async (input, init) => {
65
+ const rawUrl = typeof input === 'string' ? input : input instanceof URL ? input.href : input.url;
66
+ const parsed = parseStrapiUrl(rawUrl ?? '', options.apiPrefix);
67
+ const typeName = parsed ? options.types[parsed.pluralName] : undefined;
68
+ if (!parsed || !typeName) {
69
+ return realFetch(input, init); // not a mapped content read → real CMS
70
+ }
71
+ const entries = await fetchEntries(typeName, {
72
+ ...read,
73
+ ...(parsed.where ? { where: parsed.where } : {}),
74
+ ...(parsed.pageSize ? { limit: parsed.pageSize } : {}),
75
+ });
76
+ if (entries.length === 0) {
77
+ return realFetch(input, init); // nothing scaffolded → fall back to the CMS
78
+ }
79
+ const single = Boolean(parsed.documentId) || singletons.has(typeName);
80
+ const payload = single
81
+ ? fimoEntryToStrapiSingle(parsed.documentId ? (entries.find((e) => e.id === parsed.documentId) ?? entries[0]) : entries[0])
82
+ : fimoEntriesToStrapiList(entries, { pageSize: parsed.pageSize, total: entries.length });
83
+ return new Response(JSON.stringify(payload), {
84
+ status: 200,
85
+ headers: { 'content-type': 'application/json' },
86
+ });
87
+ });
88
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=client.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.test.d.ts","sourceRoot":"","sources":["../../../src/runtime/strapi/client.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,64 @@
1
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
2
+ const fetchEntriesMock = vi.fn();
3
+ vi.mock('../wrapped/server.js', () => ({
4
+ fetchEntries: (...args) => fetchEntriesMock(...args),
5
+ }));
6
+ import { createFimoStrapiFetch, parseStrapiUrl } from './client.js';
7
+ describe('parseStrapiUrl', () => {
8
+ it('parses type, pagination, locale and $eq filters', () => {
9
+ const parsed = parseStrapiUrl('https://cms.example/api/blog-posts?locale=en&pagination[pageSize]=5&filters[slug][$eq]=hello');
10
+ expect(parsed).toMatchObject({ pluralName: 'blog-posts', locale: 'en', pageSize: 5, where: { slug: 'hello' } });
11
+ });
12
+ it('parses a documentId path', () => {
13
+ expect(parseStrapiUrl('https://cms.example/api/pages/abc123')).toMatchObject({
14
+ pluralName: 'pages',
15
+ documentId: 'abc123',
16
+ });
17
+ });
18
+ it('returns null for non-/api paths', () => {
19
+ expect(parseStrapiUrl('https://cms.example/health')).toBeNull();
20
+ });
21
+ });
22
+ describe('createFimoStrapiFetch', () => {
23
+ const realFetch = vi.fn(async () => new Response('REAL', { status: 200 }));
24
+ beforeEach(() => {
25
+ fetchEntriesMock.mockReset();
26
+ realFetch.mockClear();
27
+ });
28
+ it('serves a mapped collection from Fimo as a Strapi list envelope', async () => {
29
+ fetchEntriesMock.mockResolvedValue([
30
+ { id: '1', data: { title: 'A' } },
31
+ { id: '2', data: { title: 'B' } },
32
+ ]);
33
+ const fimoFetch = createFimoStrapiFetch({ types: { 'blog-posts': 'BlogPost' } }, realFetch);
34
+ const body = await (await fimoFetch('https://cms.example/api/blog-posts?pagination[pageSize]=10')).json();
35
+ expect(body.data).toHaveLength(2);
36
+ expect(body.data[0]).toMatchObject({ id: '1', documentId: '1', title: 'A' });
37
+ expect(body.meta.pagination.total).toBe(2);
38
+ expect(realFetch).not.toHaveBeenCalled();
39
+ expect(fetchEntriesMock).toHaveBeenCalledWith('BlogPost', expect.objectContaining({ limit: 10 }));
40
+ });
41
+ it('serves a singleton as a single envelope, not a list', async () => {
42
+ fetchEntriesMock.mockResolvedValue([{ id: 'g', data: { siteName: 'X' } }]);
43
+ const fimoFetch = createFimoStrapiFetch({ types: { global: 'Global' }, singletons: ['Global'] }, realFetch);
44
+ const body = await (await fimoFetch('https://cms.example/api/global')).json();
45
+ expect(Array.isArray(body.data)).toBe(false);
46
+ expect(body.data).toMatchObject({ id: 'g', siteName: 'X' });
47
+ });
48
+ it('passes a slug filter through to fetchEntries', async () => {
49
+ fetchEntriesMock.mockResolvedValue([{ id: '1', data: { slug: 'hello' } }]);
50
+ const fimoFetch = createFimoStrapiFetch({ types: { 'blog-posts': 'BlogPost' } }, realFetch);
51
+ await fimoFetch('https://cms.example/api/blog-posts?filters[slug][$eq]=hello');
52
+ expect(fetchEntriesMock).toHaveBeenCalledWith('BlogPost', expect.objectContaining({ where: { slug: 'hello' } }));
53
+ });
54
+ it('falls through to the real fetch for an unmapped path', async () => {
55
+ const fimoFetch = createFimoStrapiFetch({ types: { 'blog-posts': 'BlogPost' } }, realFetch);
56
+ expect(await (await fimoFetch('https://cms.example/api/users?filters[slug][$eq]=x')).text()).toBe('REAL');
57
+ expect(realFetch).toHaveBeenCalled();
58
+ });
59
+ it('falls through when Fimo has nothing scaffolded for the type', async () => {
60
+ fetchEntriesMock.mockResolvedValue([]);
61
+ const fimoFetch = createFimoStrapiFetch({ types: { 'blog-posts': 'BlogPost' } }, realFetch);
62
+ expect(await (await fimoFetch('https://cms.example/api/blog-posts')).text()).toBe('REAL');
63
+ });
64
+ });
@@ -0,0 +1,5 @@
1
+ export { createFimoStrapiFetch, parseStrapiUrl } from './client.js';
2
+ export type { FimoStrapiFetchOptions, ParsedStrapiUrl } from './client.js';
3
+ export { fimoEntriesToStrapiList, fimoEntryToStrapiItem, fimoEntryToStrapiSingle } from './reshape.js';
4
+ export type { StrapiListEnvelope, StrapiPagination, StrapiSingleEnvelope } from './reshape.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/strapi/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACpE,YAAY,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvG,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,6 @@
1
+ // `fimo/strapi` — native read adapter that serves a wrapped Strapi frontend's
2
+ // content from Fimo. Drop `createFimoStrapiFetch(...)` in at the CMS client's
3
+ // single `fetch` and every read (list, detail, singleton) is served from Fimo,
4
+ // falling through to the live CMS for anything not scaffolded.
5
+ export { createFimoStrapiFetch, parseStrapiUrl } from './client.js';
6
+ export { fimoEntriesToStrapiList, fimoEntryToStrapiItem, fimoEntryToStrapiSingle } from './reshape.js';
@@ -0,0 +1,28 @@
1
+ import type { FimoEntry } from '../wrapped/server.js';
2
+ export interface StrapiPagination {
3
+ page: number;
4
+ pageSize: number;
5
+ pageCount: number;
6
+ total: number;
7
+ }
8
+ export interface StrapiListEnvelope {
9
+ data: Record<string, unknown>[];
10
+ meta: {
11
+ pagination: StrapiPagination;
12
+ };
13
+ }
14
+ export interface StrapiSingleEnvelope {
15
+ data: Record<string, unknown> | null;
16
+ meta: Record<string, unknown>;
17
+ }
18
+ /** One Fimo entry → one Strapi-v5 item (flat fields, `id` + `documentId`). */
19
+ export declare function fimoEntryToStrapiItem(entry: FimoEntry): Record<string, unknown>;
20
+ /** Fimo entries → a Strapi-v5 collection envelope (`{ data, meta.pagination }`). */
21
+ export declare function fimoEntriesToStrapiList(entries: FimoEntry[], options?: {
22
+ page?: number;
23
+ pageSize?: number;
24
+ total?: number;
25
+ }): StrapiListEnvelope;
26
+ /** Fimo entry → a Strapi-v5 single/singleton envelope (`{ data, meta }`). */
27
+ export declare function fimoEntryToStrapiSingle(entry: FimoEntry | undefined): StrapiSingleEnvelope;
28
+ //# sourceMappingURL=reshape.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reshape.d.ts","sourceRoot":"","sources":["../../../src/runtime/strapi/reshape.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAChC,IAAI,EAAE;QAAE,UAAU,EAAE,gBAAgB,CAAA;KAAE,CAAC;CACxC;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAqDD,8EAA8E;AAC9E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAM/E;AAED,oFAAoF;AACpF,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,SAAS,EAAE,EACpB,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GACjE,kBAAkB,CAepB;AAED,6EAA6E;AAC7E,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,oBAAoB,CAE1F"}
@@ -0,0 +1,79 @@
1
+ // Native `fimo/strapi` read adapter — the generic reshape from Fimo entries
2
+ // (as `fetchEntries` returns them) into the Strapi-v5 response shape a wrapped
3
+ // Strapi frontend's components read. Value-inspection based, so it is generic:
4
+ // no content-type or field names are hardcoded. Relation POPULATION (turning a
5
+ // reference handle into a nested object) is resolved one level up in the client
6
+ // — this module reshapes a single entry's own field values.
7
+ /** ProseMirror/TipTap doc → plain text (Strapi richtext is a string; string
8
+ * consumers like read-time estimates must never receive an object). */
9
+ function docToText(node) {
10
+ if (!node || typeof node !== 'object') {
11
+ return '';
12
+ }
13
+ const record = node;
14
+ if (typeof record.text === 'string') {
15
+ return record.text;
16
+ }
17
+ if (Array.isArray(record.content)) {
18
+ return record.content.map(docToText).join(' ').trim();
19
+ }
20
+ return '';
21
+ }
22
+ function isRichTextDoc(value) {
23
+ return Boolean(value) && typeof value === 'object' && value.type === 'doc';
24
+ }
25
+ /** A Fimo media value (seeded/loaded as `{ url, alt, width, height, … }`). */
26
+ function isMedia(value) {
27
+ return (Boolean(value) &&
28
+ typeof value === 'object' &&
29
+ !Array.isArray(value) &&
30
+ typeof value.url === 'string');
31
+ }
32
+ function reshapeMedia(value) {
33
+ return {
34
+ url: value.url,
35
+ alternativeText: value.alt ?? value.alternativeText ?? null,
36
+ ...(typeof value.width === 'number' ? { width: value.width } : {}),
37
+ ...(typeof value.height === 'number' ? { height: value.height } : {}),
38
+ ...(typeof value.name === 'string' ? { name: value.name } : {}),
39
+ ...(typeof value.mime === 'string' ? { mime: value.mime } : {}),
40
+ };
41
+ }
42
+ function reshapeValue(value) {
43
+ if (isRichTextDoc(value)) {
44
+ return docToText(value);
45
+ }
46
+ if (isMedia(value)) {
47
+ return reshapeMedia(value);
48
+ }
49
+ return value; // scalars, arrays, reference handles pass through
50
+ }
51
+ /** One Fimo entry → one Strapi-v5 item (flat fields, `id` + `documentId`). */
52
+ export function fimoEntryToStrapiItem(entry) {
53
+ const item = { id: entry.id, documentId: entry.id };
54
+ for (const [field, value] of Object.entries(entry.data)) {
55
+ item[field] = reshapeValue(value);
56
+ }
57
+ return item;
58
+ }
59
+ /** Fimo entries → a Strapi-v5 collection envelope (`{ data, meta.pagination }`). */
60
+ export function fimoEntriesToStrapiList(entries, options = {}) {
61
+ const data = entries.map(fimoEntryToStrapiItem);
62
+ const total = options.total ?? data.length;
63
+ const pageSize = options.pageSize ?? (data.length || 1);
64
+ return {
65
+ data,
66
+ meta: {
67
+ pagination: {
68
+ page: options.page ?? 1,
69
+ pageSize,
70
+ pageCount: pageSize > 0 ? Math.max(1, Math.ceil(total / pageSize)) : 1,
71
+ total,
72
+ },
73
+ },
74
+ };
75
+ }
76
+ /** Fimo entry → a Strapi-v5 single/singleton envelope (`{ data, meta }`). */
77
+ export function fimoEntryToStrapiSingle(entry) {
78
+ return { data: entry ? fimoEntryToStrapiItem(entry) : null, meta: {} };
79
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=reshape.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reshape.test.d.ts","sourceRoot":"","sources":["../../../src/runtime/strapi/reshape.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,33 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { fimoEntriesToStrapiList, fimoEntryToStrapiItem, fimoEntryToStrapiSingle } from './reshape.js';
3
+ const entry = {
4
+ id: 'abc',
5
+ data: {
6
+ title: 'Hello',
7
+ readTime: 3,
8
+ content: { type: 'doc', content: [{ type: 'paragraph', content: [{ type: 'text', text: 'Body text' }] }] },
9
+ cover: { source: 'local', url: '/img/x.png', alt: 'Alt', width: 800, height: 600 },
10
+ category: 'post-category-example-1',
11
+ },
12
+ };
13
+ describe('reshape', () => {
14
+ it('flattens an entry to a Strapi-v5 item (id + documentId, richtext→text, media→strapi shape)', () => {
15
+ const item = fimoEntryToStrapiItem(entry);
16
+ expect(item.id).toBe('abc');
17
+ expect(item.documentId).toBe('abc');
18
+ expect(item.title).toBe('Hello');
19
+ expect(item.readTime).toBe(3);
20
+ expect(item.content).toBe('Body text');
21
+ expect(item.cover).toEqual({ url: '/img/x.png', alternativeText: 'Alt', width: 800, height: 600 });
22
+ expect(item.category).toBe('post-category-example-1'); // reference handle passes through
23
+ });
24
+ it('wraps a list in a Strapi envelope with correct pagination', () => {
25
+ const env = fimoEntriesToStrapiList([entry, entry], { total: 5, pageSize: 2 });
26
+ expect(env.data).toHaveLength(2);
27
+ expect(env.meta.pagination).toEqual({ page: 1, pageSize: 2, pageCount: 3, total: 5 });
28
+ });
29
+ it('wraps a single/singleton entry, or null when absent', () => {
30
+ expect(fimoEntryToStrapiSingle(entry).data).toMatchObject({ id: 'abc', title: 'Hello' });
31
+ expect(fimoEntryToStrapiSingle(undefined).data).toBeNull();
32
+ });
33
+ });
@@ -0,0 +1,3 @@
1
+ export { fimoLabelAttrs, fimoMediaAttrs, FIMO_SOURCE_ATTR } from '../wrapped/dom.js';
2
+ export { makeFimoT } from '../shared/labels-t.pure.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/svelte/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,7 @@
1
+ // fimo/svelte — CLIENT-SAFE surface for .svelte components (they hydrate:
2
+ // importing the server barrel here pulls node builtins into the client
3
+ // bundle, the exact class the Nuxt dogfood broke on). Server loaders live in
4
+ // fimo/svelte/server, called from +layout.server.ts / +page.server.ts —
5
+ // SvelteKit's own server-only convention.
6
+ export { fimoLabelAttrs, fimoMediaAttrs, FIMO_SOURCE_ATTR } from '../wrapped/dom.js';
7
+ export { makeFimoT } from '../shared/labels-t.pure.js';
@@ -0,0 +1,3 @@
1
+ export * from '../wrapped/server.js';
2
+ export { fimoLabelAttrs, fimoMediaAttrs } from '../wrapped/dom.js';
3
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/runtime/svelte/server.ts"],"names":[],"mappings":"AAIA,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,6 @@
1
+ // fimo/svelte/server — SvelteKit adapter, server surface. The loaders are
2
+ // framework-neutral (SvelteKit needs no React): call them in server-side code
3
+ // (frontmatter / load functions / useAsyncData) and render values with the
4
+ // DOM attribute helpers so edit mode can select the elements.
5
+ export * from '../wrapped/server.js';
6
+ export { fimoLabelAttrs, fimoMediaAttrs } from '../wrapped/dom.js';
@@ -0,0 +1,3 @@
1
+ export { fimoLabelAttrs, fimoMediaAttrs, FIMO_SOURCE_ATTR } from '../wrapped/dom.js';
2
+ export { makeFimoT } from '../shared/labels-t.pure.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/vue/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,5 @@
1
+ // fimo/vue — CLIENT-SAFE surface for Vue SFCs (same rule as fimo/svelte:
2
+ // never re-export the server barrel from a surface component code imports).
3
+ // Server loaders live in fimo/vue/server.
4
+ export { fimoLabelAttrs, fimoMediaAttrs, FIMO_SOURCE_ATTR } from '../wrapped/dom.js';
5
+ export { makeFimoT } from '../shared/labels-t.pure.js';
@@ -0,0 +1,3 @@
1
+ export * from '../wrapped/server.js';
2
+ export { fimoLabelAttrs, fimoMediaAttrs } from '../wrapped/dom.js';
3
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/runtime/vue/server.ts"],"names":[],"mappings":"AAIA,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,6 @@
1
+ // fimo/vue/server — Vue adapter, server surface. The loaders are
2
+ // framework-neutral (Vue needs no React): call them in server-side code
3
+ // (frontmatter / load functions / useAsyncData) and render values with the
4
+ // DOM attribute helpers so edit mode can select the elements.
5
+ export * from '../wrapped/server.js';
6
+ export { fimoLabelAttrs, fimoMediaAttrs } from '../wrapped/dom.js';
@@ -0,0 +1,17 @@
1
+ import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
2
+ type FimoFileLinkProps = Omit<ComponentPropsWithoutRef<'a'>, 'id'> & {
3
+ /** WrappedMedia entry key, e.g. `home.whitepaper`. Seeded at migration time. */
4
+ id: string;
5
+ children?: ReactNode;
6
+ };
7
+ /**
8
+ * Wraps a hardcoded file link (pdf, zip, ...) so the file becomes replaceable
9
+ * in Fimo. The original `href` stays in code as the fallback:
10
+ *
11
+ * <FimoFileLink id="home.whitepaper" href="/whitepaper.pdf">
12
+ * <FimoText id="home.whitepaper.cta">Download the whitepaper</FimoText>
13
+ * </FimoFileLink>
14
+ */
15
+ export declare function FimoFileLink({ id, href, children, ...props }: FimoFileLinkProps): import("react/jsx-runtime").JSX.Element;
16
+ export {};
17
+ //# sourceMappingURL=FimoFileLink.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FimoFileLink.d.ts","sourceRoot":"","sources":["../../../src/runtime/wrapped/FimoFileLink.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,wBAAwB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAKtE,KAAK,iBAAiB,GAAG,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG;IACnE,gFAAgF;IAChF,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,iBAAiB,2CAgB/E"}
@@ -0,0 +1,19 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { FIMO_SOURCE } from '../primitives/lib/index.js';
4
+ import { useWrappedMedia } from './WrappedContentContext.js';
5
+ /**
6
+ * Wraps a hardcoded file link (pdf, zip, ...) so the file becomes replaceable
7
+ * in Fimo. The original `href` stays in code as the fallback:
8
+ *
9
+ * <FimoFileLink id="home.whitepaper" href="/whitepaper.pdf">
10
+ * <FimoText id="home.whitepaper.cta">Download the whitepaper</FimoText>
11
+ * </FimoFileLink>
12
+ */
13
+ export function FimoFileLink({ id, href, children, ...props }) {
14
+ const media = useWrappedMedia(id);
15
+ if (media) {
16
+ return (_jsx("a", { href: media.url, "data-fimo-source": media[FIMO_SOURCE], ...props, children: children }));
17
+ }
18
+ return (_jsx("a", { href: href, ...props, children: children }));
19
+ }
@@ -0,0 +1,14 @@
1
+ import { type ComponentPropsWithoutRef } from 'react';
2
+ type FimoMediaImageProps = Omit<ComponentPropsWithoutRef<'img'>, 'id' | 'children'> & {
3
+ /** WrappedMedia entry key, e.g. `home.hero.image`. Seeded at migration time. */
4
+ id: string;
5
+ };
6
+ /**
7
+ * Wraps a hardcoded image so it becomes replaceable in Fimo. The original
8
+ * `src` stays in code as the fallback until the WrappedMedia entry resolves:
9
+ *
10
+ * <FimoMediaImage id="home.hero.image" src="/images/dashboard.png" alt="Dashboard" width={1200} height={630} />
11
+ */
12
+ export declare function FimoMediaImage({ id, src, alt, ...props }: FimoMediaImageProps): import("react/jsx-runtime").JSX.Element | null;
13
+ export {};
14
+ //# sourceMappingURL=FimoMediaImage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FimoMediaImage.d.ts","sourceRoot":"","sources":["../../../src/runtime/wrapped/FimoMediaImage.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAKtD,KAAK,mBAAmB,GAAG,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,IAAI,GAAG,UAAU,CAAC,GAAG;IACpF,gFAAgF;IAChF,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,KAAK,EAAE,EAAE,mBAAmB,kDAY7E"}
@@ -0,0 +1,20 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Image } from '../primitives/components/Image.js';
4
+ import { useWrappedMedia } from './WrappedContentContext.js';
5
+ /**
6
+ * Wraps a hardcoded image so it becomes replaceable in Fimo. The original
7
+ * `src` stays in code as the fallback until the WrappedMedia entry resolves:
8
+ *
9
+ * <FimoMediaImage id="home.hero.image" src="/images/dashboard.png" alt="Dashboard" width={1200} height={630} />
10
+ */
11
+ export function FimoMediaImage({ id, src, alt, ...props }) {
12
+ const media = useWrappedMedia(id);
13
+ if (media) {
14
+ return _jsx(Image, { value: media, alt: alt, ...props });
15
+ }
16
+ if (!src) {
17
+ return null;
18
+ }
19
+ return _jsx("img", { src: src, alt: alt, ...props });
20
+ }
@@ -0,0 +1,14 @@
1
+ import { type ComponentPropsWithoutRef } from 'react';
2
+ type FimoMediaVideoProps = Omit<ComponentPropsWithoutRef<'video'>, 'id' | 'children'> & {
3
+ /** WrappedMedia entry key, e.g. `home.demo.video`. Seeded at migration time. */
4
+ id: string;
5
+ };
6
+ /**
7
+ * Wraps a hardcoded video so it becomes replaceable in Fimo. The original
8
+ * `src` stays in code as the fallback until the WrappedMedia entry resolves:
9
+ *
10
+ * <FimoMediaVideo id="home.demo.video" src="/demo.mp4" autoPlay muted loop />
11
+ */
12
+ export declare function FimoMediaVideo({ id, src, autoPlay, loop, muted, playsInline, ...props }: FimoMediaVideoProps): import("react/jsx-runtime").JSX.Element | null;
13
+ export {};
14
+ //# sourceMappingURL=FimoMediaVideo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FimoMediaVideo.d.ts","sourceRoot":"","sources":["../../../src/runtime/wrapped/FimoMediaVideo.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAKtD,KAAK,mBAAmB,GAAG,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,EAAE,IAAI,GAAG,UAAU,CAAC,GAAG;IACtF,gFAAgF;IAChF,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,KAAK,EAAE,EAAE,mBAAmB,kDAY5G"}
@@ -0,0 +1,20 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Video } from '../primitives/components/Video.js';
4
+ import { useWrappedMedia } from './WrappedContentContext.js';
5
+ /**
6
+ * Wraps a hardcoded video so it becomes replaceable in Fimo. The original
7
+ * `src` stays in code as the fallback until the WrappedMedia entry resolves:
8
+ *
9
+ * <FimoMediaVideo id="home.demo.video" src="/demo.mp4" autoPlay muted loop />
10
+ */
11
+ export function FimoMediaVideo({ id, src, autoPlay, loop, muted, playsInline, ...props }) {
12
+ const media = useWrappedMedia(id);
13
+ if (media) {
14
+ return _jsx(Video, { value: media, autoPlay: autoPlay, loop: loop, muted: muted, playsInline: playsInline, ...props });
15
+ }
16
+ if (!src) {
17
+ return null;
18
+ }
19
+ return _jsx("video", { src: src, autoPlay: autoPlay, loop: loop, muted: muted, playsInline: playsInline, ...props });
20
+ }
@@ -0,0 +1,23 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type FimoRichTextComponents } from '../primitives/lib/index.js';
3
+ interface FimoRichTextBlockProps {
4
+ /** WrappedRichText entry key, e.g. `home.hero.subtitle`. Seeded at migration time. */
5
+ id: string;
6
+ /** The original formatted markup — rendered when the entry is absent. */
7
+ children?: ReactNode;
8
+ components?: FimoRichTextComponents;
9
+ className?: string;
10
+ }
11
+ /**
12
+ * Wraps formatted text (bold, italic, underline, links) so it becomes
13
+ * editable with marks in Fimo. Seeding converts the original markup to
14
+ * TipTap JSON; the renderer emits the same tags back. The original JSX
15
+ * stays in code as the fallback:
16
+ *
17
+ * <FimoRichTextBlock id="home.hero.subtitle">
18
+ * <p>We help teams <strong>ship faster</strong> and <em>stay safe</em>.</p>
19
+ * </FimoRichTextBlock>
20
+ */
21
+ export declare function FimoRichTextBlock({ id, children, components, className }: FimoRichTextBlockProps): import("react/jsx-runtime").JSX.Element;
22
+ export {};
23
+ //# sourceMappingURL=FimoRichTextBlock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FimoRichTextBlock.d.ts","sourceRoot":"","sources":["../../../src/runtime/wrapped/FimoRichTextBlock.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,EAAgB,KAAK,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAGvF,UAAU,sBAAsB;IAC9B,sFAAsF;IACtF,EAAE,EAAE,MAAM,CAAC;IACX,yEAAyE;IACzE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,UAAU,CAAC,EAAE,sBAAsB,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,sBAAsB,2CAUhG"}
@@ -0,0 +1,22 @@
1
+ 'use client';
2
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
3
+ import { RichText } from '../primitives/components/RichText.js';
4
+ import { FimoRichText } from '../primitives/lib/index.js';
5
+ import { useWrappedRichText } from './WrappedContentContext.js';
6
+ /**
7
+ * Wraps formatted text (bold, italic, underline, links) so it becomes
8
+ * editable with marks in Fimo. Seeding converts the original markup to
9
+ * TipTap JSON; the renderer emits the same tags back. The original JSX
10
+ * stays in code as the fallback:
11
+ *
12
+ * <FimoRichTextBlock id="home.hero.subtitle">
13
+ * <p>We help teams <strong>ship faster</strong> and <em>stay safe</em>.</p>
14
+ * </FimoRichTextBlock>
15
+ */
16
+ export function FimoRichTextBlock({ id, children, components, className }) {
17
+ const entry = useWrappedRichText(id);
18
+ if (!entry) {
19
+ return _jsx(_Fragment, { children: children });
20
+ }
21
+ return (_jsx(RichText, { value: new FimoRichText(entry.content, entry.source), components: components, className: className }));
22
+ }
@@ -0,0 +1,22 @@
1
+ import { type ComponentPropsWithoutRef, type ElementType } from 'react';
2
+ type FimoTextProps<T extends ElementType = 'span'> = {
3
+ /** Label key, e.g. `home.hero.title`. Seeded at migration time. */
4
+ id: string;
5
+ /** The original hardcoded string — rendered when the key has no value. */
6
+ children?: string;
7
+ as?: T;
8
+ } & Omit<ComponentPropsWithoutRef<T>, 'id' | 'as' | 'children'>;
9
+ /**
10
+ * Wraps a hardcoded string so it becomes editable in Fimo. The original
11
+ * string stays in code as the fallback:
12
+ *
13
+ * <h1><FimoText id="home.hero.title">Ship your site in hours</FimoText></h1>
14
+ *
15
+ * For attribute strings use the two-argument label function instead:
16
+ *
17
+ * const { t } = useLabels();
18
+ * <input placeholder={String(t('home.newsletter.placeholder', 'Your work email'))} />
19
+ */
20
+ export declare function FimoText<T extends ElementType = 'span'>({ id, children, as, ...props }: FimoTextProps<T>): import("react/jsx-runtime").JSX.Element;
21
+ export {};
22
+ //# sourceMappingURL=FimoText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FimoText.d.ts","sourceRoot":"","sources":["../../../src/runtime/wrapped/FimoText.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,wBAAwB,EAAE,KAAK,WAAW,EAAE,MAAM,OAAO,CAAC;AAKxE,KAAK,aAAa,CAAC,CAAC,SAAS,WAAW,GAAG,MAAM,IAAI;IACnD,mEAAmE;IACnE,EAAE,EAAE,MAAM,CAAC;IACX,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,EAAE,CAAC,EAAE,CAAC,CAAC;CACR,GAAG,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,UAAU,CAAC,CAAC;AAEhE;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,WAAW,GAAG,MAAM,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,CAAC,CAAC,CAAC,2CAIxG"}
@@ -0,0 +1,20 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Text } from '../primitives/components/Text.js';
4
+ import { useLabels } from '../primitives/labels-hook.js';
5
+ /**
6
+ * Wraps a hardcoded string so it becomes editable in Fimo. The original
7
+ * string stays in code as the fallback:
8
+ *
9
+ * <h1><FimoText id="home.hero.title">Ship your site in hours</FimoText></h1>
10
+ *
11
+ * For attribute strings use the two-argument label function instead:
12
+ *
13
+ * const { t } = useLabels();
14
+ * <input placeholder={String(t('home.newsletter.placeholder', 'Your work email'))} />
15
+ */
16
+ export function FimoText({ id, children, as, ...props }) {
17
+ const { t } = useLabels();
18
+ const textProps = { value: t(id, children), as, ...props };
19
+ return _jsx(Text, { ...textProps });
20
+ }