fimo 0.6.0 → 0.7.0-experimental.10

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 (297) hide show
  1. package/assets/skills/fimo/SKILL.md +2 -2
  2. package/assets/skills/fimo/references/locales.md +0 -8
  3. package/assets/skills/fimo/references/setup-react-router.md +2 -2
  4. package/assets/skills/fimo/references/ui.md +1 -1
  5. package/assets/skills/fimo-cli/references/content.md +0 -3
  6. package/assets/skills/fimo-cli/references/locales.md +0 -6
  7. package/assets/skills/fimo-migration/SKILL.md +22 -2
  8. package/assets/skills/fimo-migration/references/content.md +8 -0
  9. package/assets/skills/fimo-migration/references/manifest.md +35 -0
  10. package/assets/skills/fimo-migration/references/qa.md +24 -2
  11. package/assets/skills/fimo-migration/references/workflow.md +12 -1
  12. package/assets/skills/fimo-migration/references/wrap.md +617 -0
  13. package/assets/skills/fimo-studio/references/visual-editing.md +5 -3
  14. package/dist/build/vite/plugins/translations.d.ts +2 -8
  15. package/dist/build/vite/plugins/translations.d.ts.map +1 -1
  16. package/dist/build/vite/plugins/translations.js +3 -121
  17. package/dist/cli/bundle.json +1 -1
  18. package/dist/cli/index.js +29490 -21165
  19. package/dist/runtime/app/FimoProviders.d.ts +1 -11
  20. package/dist/runtime/app/FimoProviders.d.ts.map +1 -1
  21. package/dist/runtime/app/FimoProviders.js +2 -23
  22. package/dist/runtime/astro/index.d.ts +2 -0
  23. package/dist/runtime/astro/index.d.ts.map +1 -0
  24. package/dist/runtime/astro/index.js +3 -0
  25. package/dist/runtime/astro/server.d.ts +3 -0
  26. package/dist/runtime/astro/server.d.ts.map +1 -0
  27. package/dist/runtime/astro/server.js +6 -0
  28. package/dist/runtime/i18n/FimoLocaleContext.d.ts.map +1 -1
  29. package/dist/runtime/i18n/FimoLocaleContext.js +1 -0
  30. package/dist/runtime/next/FimoNextProviders.d.ts +24 -0
  31. package/dist/runtime/next/FimoNextProviders.d.ts.map +1 -0
  32. package/dist/runtime/next/FimoNextProviders.js +20 -0
  33. package/dist/runtime/next/FimoNextScripts.d.ts +10 -0
  34. package/dist/runtime/next/FimoNextScripts.d.ts.map +1 -0
  35. package/dist/runtime/next/FimoNextScripts.js +19 -0
  36. package/dist/runtime/next/index.d.ts +14 -0
  37. package/dist/runtime/next/index.d.ts.map +1 -0
  38. package/dist/runtime/next/index.js +14 -0
  39. package/dist/runtime/next/server.d.ts +2 -0
  40. package/dist/runtime/next/server.d.ts.map +1 -0
  41. package/dist/runtime/next/server.js +4 -0
  42. package/dist/runtime/nuxt/composables.d.ts +9 -0
  43. package/dist/runtime/nuxt/composables.d.ts.map +1 -0
  44. package/dist/runtime/nuxt/composables.js +57 -0
  45. package/dist/runtime/nuxt/index.d.ts +3 -0
  46. package/dist/runtime/nuxt/index.d.ts.map +1 -0
  47. package/dist/runtime/nuxt/index.js +6 -0
  48. package/dist/runtime/nuxt/server.d.ts +3 -0
  49. package/dist/runtime/nuxt/server.d.ts.map +1 -0
  50. package/dist/runtime/nuxt/server.js +6 -0
  51. package/dist/runtime/paths/get-fimo-paths.d.ts.map +1 -1
  52. package/dist/runtime/paths/get-fimo-paths.js +5 -15
  53. package/dist/runtime/primitives/labels-hook.d.ts +33 -0
  54. package/dist/runtime/primitives/labels-hook.d.ts.map +1 -0
  55. package/dist/runtime/primitives/labels-hook.js +41 -0
  56. package/dist/runtime/primitives/labels-store.d.ts +12 -0
  57. package/dist/runtime/primitives/labels-store.d.ts.map +1 -0
  58. package/dist/runtime/primitives/labels-store.js +60 -0
  59. package/dist/runtime/primitives/labels-store.test.d.ts +2 -0
  60. package/dist/runtime/primitives/labels-store.test.d.ts.map +1 -0
  61. package/dist/runtime/primitives/labels-store.test.js +66 -0
  62. package/dist/runtime/primitives/lib/useFimoLiveValue.d.ts +5 -3
  63. package/dist/runtime/primitives/lib/useFimoLiveValue.d.ts.map +1 -1
  64. package/dist/runtime/primitives/lib/useFimoLiveValue.js +11 -4
  65. package/dist/runtime/primitives/translations.d.ts +1 -27
  66. package/dist/runtime/primitives/translations.d.ts.map +1 -1
  67. package/dist/runtime/primitives/translations.js +7 -85
  68. package/dist/runtime/react/FimoSpaProviders.d.ts +36 -0
  69. package/dist/runtime/react/FimoSpaProviders.d.ts.map +1 -0
  70. package/dist/runtime/react/FimoSpaProviders.js +63 -0
  71. package/dist/runtime/react/index.d.ts +33 -0
  72. package/dist/runtime/react/index.d.ts.map +1 -0
  73. package/dist/runtime/react/index.js +39 -0
  74. package/dist/runtime/remix/FimoRemixProviders.d.ts +16 -0
  75. package/dist/runtime/remix/FimoRemixProviders.d.ts.map +1 -0
  76. package/dist/runtime/remix/FimoRemixProviders.js +12 -0
  77. package/dist/runtime/remix/FimoRemixScripts.d.ts +10 -0
  78. package/dist/runtime/remix/FimoRemixScripts.d.ts.map +1 -0
  79. package/dist/runtime/remix/FimoRemixScripts.js +19 -0
  80. package/dist/runtime/remix/index.d.ts +12 -0
  81. package/dist/runtime/remix/index.d.ts.map +1 -0
  82. package/dist/runtime/remix/index.js +11 -0
  83. package/dist/runtime/remix/server.d.ts +2 -0
  84. package/dist/runtime/remix/server.d.ts.map +1 -0
  85. package/dist/runtime/remix/server.js +2 -0
  86. package/dist/runtime/seo/buildSeoForPath.d.ts +3 -1
  87. package/dist/runtime/seo/buildSeoForPath.d.ts.map +1 -1
  88. package/dist/runtime/seo/buildSeoForPath.js +1 -4
  89. package/dist/runtime/shared/display-routes.d.ts +14 -0
  90. package/dist/runtime/shared/display-routes.d.ts.map +1 -0
  91. package/dist/runtime/shared/display-routes.js +25 -0
  92. package/dist/runtime/shared/fimo-config.server.d.ts.map +1 -1
  93. package/dist/runtime/shared/fimo-config.server.js +1 -0
  94. package/dist/runtime/shared/fimo-config.types.d.ts +2 -0
  95. package/dist/runtime/shared/fimo-config.types.d.ts.map +1 -1
  96. package/dist/runtime/shared/i18n-messages.d.ts +29 -0
  97. package/dist/runtime/shared/i18n-messages.d.ts.map +1 -0
  98. package/dist/runtime/shared/i18n-messages.js +79 -0
  99. package/dist/runtime/shared/i18n-messages.test.d.ts +2 -0
  100. package/dist/runtime/shared/i18n-messages.test.d.ts.map +1 -0
  101. package/dist/runtime/shared/i18n-messages.test.js +39 -0
  102. package/dist/runtime/shared/labels-fetch.pure.d.ts +17 -0
  103. package/dist/runtime/shared/labels-fetch.pure.d.ts.map +1 -0
  104. package/dist/runtime/shared/labels-fetch.pure.js +71 -0
  105. package/dist/runtime/shared/labels-fetch.server.d.ts +7 -0
  106. package/dist/runtime/shared/labels-fetch.server.d.ts.map +1 -0
  107. package/dist/runtime/shared/labels-fetch.server.js +97 -0
  108. package/dist/runtime/shared/labels-t.pure.d.ts +2 -0
  109. package/dist/runtime/shared/labels-t.pure.d.ts.map +1 -0
  110. package/dist/runtime/shared/labels-t.pure.js +10 -0
  111. package/dist/runtime/strapi/client.d.ts +26 -0
  112. package/dist/runtime/strapi/client.d.ts.map +1 -0
  113. package/dist/runtime/strapi/client.js +88 -0
  114. package/dist/runtime/strapi/client.test.d.ts +2 -0
  115. package/dist/runtime/strapi/client.test.d.ts.map +1 -0
  116. package/dist/runtime/strapi/client.test.js +64 -0
  117. package/dist/runtime/strapi/index.d.ts +5 -0
  118. package/dist/runtime/strapi/index.d.ts.map +1 -0
  119. package/dist/runtime/strapi/index.js +6 -0
  120. package/dist/runtime/strapi/reshape.d.ts +28 -0
  121. package/dist/runtime/strapi/reshape.d.ts.map +1 -0
  122. package/dist/runtime/strapi/reshape.js +79 -0
  123. package/dist/runtime/strapi/reshape.test.d.ts +2 -0
  124. package/dist/runtime/strapi/reshape.test.d.ts.map +1 -0
  125. package/dist/runtime/strapi/reshape.test.js +33 -0
  126. package/dist/runtime/svelte/index.d.ts +3 -0
  127. package/dist/runtime/svelte/index.d.ts.map +1 -0
  128. package/dist/runtime/svelte/index.js +7 -0
  129. package/dist/runtime/svelte/server.d.ts +3 -0
  130. package/dist/runtime/svelte/server.d.ts.map +1 -0
  131. package/dist/runtime/svelte/server.js +6 -0
  132. package/dist/runtime/vue/index.d.ts +3 -0
  133. package/dist/runtime/vue/index.d.ts.map +1 -0
  134. package/dist/runtime/vue/index.js +5 -0
  135. package/dist/runtime/vue/server.d.ts +3 -0
  136. package/dist/runtime/vue/server.d.ts.map +1 -0
  137. package/dist/runtime/vue/server.js +6 -0
  138. package/dist/runtime/wrapped/FimoFileLink.d.ts +17 -0
  139. package/dist/runtime/wrapped/FimoFileLink.d.ts.map +1 -0
  140. package/dist/runtime/wrapped/FimoFileLink.js +19 -0
  141. package/dist/runtime/wrapped/FimoMediaImage.d.ts +14 -0
  142. package/dist/runtime/wrapped/FimoMediaImage.d.ts.map +1 -0
  143. package/dist/runtime/wrapped/FimoMediaImage.js +20 -0
  144. package/dist/runtime/wrapped/FimoMediaVideo.d.ts +14 -0
  145. package/dist/runtime/wrapped/FimoMediaVideo.d.ts.map +1 -0
  146. package/dist/runtime/wrapped/FimoMediaVideo.js +20 -0
  147. package/dist/runtime/wrapped/FimoRichTextBlock.d.ts +23 -0
  148. package/dist/runtime/wrapped/FimoRichTextBlock.d.ts.map +1 -0
  149. package/dist/runtime/wrapped/FimoRichTextBlock.js +22 -0
  150. package/dist/runtime/wrapped/FimoText.d.ts +22 -0
  151. package/dist/runtime/wrapped/FimoText.d.ts.map +1 -0
  152. package/dist/runtime/wrapped/FimoText.js +20 -0
  153. package/dist/runtime/wrapped/WrappedContentContext.d.ts +28 -0
  154. package/dist/runtime/wrapped/WrappedContentContext.d.ts.map +1 -0
  155. package/dist/runtime/wrapped/WrappedContentContext.js +30 -0
  156. package/dist/runtime/wrapped/WrappedProviders.d.ts +33 -0
  157. package/dist/runtime/wrapped/WrappedProviders.d.ts.map +1 -0
  158. package/dist/runtime/wrapped/WrappedProviders.js +101 -0
  159. package/dist/runtime/wrapped/dom.d.ts +4 -0
  160. package/dist/runtime/wrapped/dom.d.ts.map +1 -0
  161. package/dist/runtime/wrapped/dom.js +23 -0
  162. package/dist/runtime/wrapped/dom.test.d.ts +2 -0
  163. package/dist/runtime/wrapped/dom.test.d.ts.map +1 -0
  164. package/dist/runtime/wrapped/dom.test.js +16 -0
  165. package/dist/runtime/wrapped/server.d.ts +77 -0
  166. package/dist/runtime/wrapped/server.d.ts.map +1 -0
  167. package/dist/runtime/wrapped/server.js +237 -0
  168. package/dist/runtime/wrapped/server.test.d.ts +2 -0
  169. package/dist/runtime/wrapped/server.test.d.ts.map +1 -0
  170. package/dist/runtime/wrapped/server.test.js +91 -0
  171. package/dist/scripts/apply-wrap-templates.d.ts +61 -0
  172. package/dist/scripts/apply-wrap-templates.js +132 -0
  173. package/dist/scripts/apply-wrap-templates.test.d.ts +1 -0
  174. package/dist/scripts/apply-wrap-templates.test.js +199 -0
  175. package/dist/scripts/apply-wrap.d.ts +46 -0
  176. package/dist/scripts/apply-wrap.js +278 -0
  177. package/dist/scripts/apply-wrap.test.d.ts +1 -0
  178. package/dist/scripts/apply-wrap.test.js +226 -0
  179. package/dist/scripts/cms/discover.d.ts +2 -0
  180. package/dist/scripts/cms/discover.js +17 -0
  181. package/dist/scripts/cms/example-content.d.ts +32 -0
  182. package/dist/scripts/cms/example-content.js +108 -0
  183. package/dist/scripts/cms/example-content.test.d.ts +1 -0
  184. package/dist/scripts/cms/example-content.test.js +66 -0
  185. package/dist/scripts/cms/strapi/detect.d.ts +2 -0
  186. package/dist/scripts/cms/strapi/detect.js +186 -0
  187. package/dist/scripts/cms/strapi/detect.test.d.ts +1 -0
  188. package/dist/scripts/cms/strapi/detect.test.js +56 -0
  189. package/dist/scripts/cms/strapi/index.d.ts +3 -0
  190. package/dist/scripts/cms/strapi/index.js +25 -0
  191. package/dist/scripts/cms/strapi/list-source.d.ts +17 -0
  192. package/dist/scripts/cms/strapi/list-source.js +90 -0
  193. package/dist/scripts/cms/strapi/list-source.test.d.ts +1 -0
  194. package/dist/scripts/cms/strapi/list-source.test.js +33 -0
  195. package/dist/scripts/cms/strapi/schema-map.d.ts +9 -0
  196. package/dist/scripts/cms/strapi/schema-map.js +149 -0
  197. package/dist/scripts/cms/strapi/schema-map.test.d.ts +1 -0
  198. package/dist/scripts/cms/strapi/schema-map.test.js +91 -0
  199. package/dist/scripts/cms/strapi/touchpoints.d.ts +31 -0
  200. package/dist/scripts/cms/strapi/touchpoints.js +145 -0
  201. package/dist/scripts/cms/strapi/touchpoints.test.d.ts +1 -0
  202. package/dist/scripts/cms/strapi/touchpoints.test.js +62 -0
  203. package/dist/scripts/cms/strapi/wire-client.d.ts +15 -0
  204. package/dist/scripts/cms/strapi/wire-client.js +107 -0
  205. package/dist/scripts/cms/strapi/wire-client.test.d.ts +1 -0
  206. package/dist/scripts/cms/strapi/wire-client.test.js +51 -0
  207. package/dist/scripts/cms/strapi/wiring.d.ts +17 -0
  208. package/dist/scripts/cms/strapi/wiring.js +36 -0
  209. package/dist/scripts/cms/strapi/wiring.test.d.ts +1 -0
  210. package/dist/scripts/cms/strapi/wiring.test.js +27 -0
  211. package/dist/scripts/cms/types.d.ts +117 -0
  212. package/dist/scripts/cms/types.js +11 -0
  213. package/dist/scripts/detect-framework.d.ts +39 -0
  214. package/dist/scripts/detect-framework.js +133 -0
  215. package/dist/scripts/detect-framework.test.d.ts +1 -0
  216. package/dist/scripts/detect-framework.test.js +122 -0
  217. package/dist/scripts/draft-rows.d.ts +19 -0
  218. package/dist/scripts/draft-rows.js +135 -0
  219. package/dist/scripts/draft-rows.test.d.ts +1 -0
  220. package/dist/scripts/draft-rows.test.js +113 -0
  221. package/dist/scripts/draft-schemas.d.ts +27 -0
  222. package/dist/scripts/draft-schemas.js +188 -0
  223. package/dist/scripts/draft-schemas.test.d.ts +1 -0
  224. package/dist/scripts/draft-schemas.test.js +152 -0
  225. package/dist/scripts/extract-translations.js +16 -11
  226. package/dist/scripts/extract-translations.test.d.ts +1 -0
  227. package/dist/scripts/extract-translations.test.js +66 -0
  228. package/dist/scripts/frameworks/astro/routes.d.ts +3 -0
  229. package/dist/scripts/frameworks/astro/routes.js +55 -0
  230. package/dist/scripts/frameworks/astro/template-style.d.ts +7 -0
  231. package/dist/scripts/frameworks/astro/template-style.js +19 -0
  232. package/dist/scripts/frameworks/discover.d.ts +70 -0
  233. package/dist/scripts/frameworks/discover.js +178 -0
  234. package/dist/scripts/frameworks/next/rewire.d.ts +30 -0
  235. package/dist/scripts/frameworks/next/rewire.js +258 -0
  236. package/dist/scripts/frameworks/next/rewire.test.d.ts +1 -0
  237. package/dist/scripts/frameworks/next/rewire.test.js +134 -0
  238. package/dist/scripts/frameworks/next/routes.d.ts +17 -0
  239. package/dist/scripts/frameworks/next/routes.js +134 -0
  240. package/dist/scripts/frameworks/next/routes.test.d.ts +1 -0
  241. package/dist/scripts/frameworks/next/routes.test.js +64 -0
  242. package/dist/scripts/frameworks/next/wiring.d.ts +33 -0
  243. package/dist/scripts/frameworks/next/wiring.js +186 -0
  244. package/dist/scripts/frameworks/next/wiring.test.d.ts +1 -0
  245. package/dist/scripts/frameworks/next/wiring.test.js +174 -0
  246. package/dist/scripts/frameworks/nuxt/routes.d.ts +3 -0
  247. package/dist/scripts/frameworks/nuxt/routes.js +54 -0
  248. package/dist/scripts/frameworks/nuxt/template-style.d.ts +9 -0
  249. package/dist/scripts/frameworks/nuxt/template-style.js +27 -0
  250. package/dist/scripts/frameworks/remix/routes.d.ts +3 -0
  251. package/dist/scripts/frameworks/remix/routes.js +50 -0
  252. package/dist/scripts/frameworks/support.d.ts +75 -0
  253. package/dist/scripts/frameworks/support.js +165 -0
  254. package/dist/scripts/frameworks/support.test.d.ts +1 -0
  255. package/dist/scripts/frameworks/support.test.js +87 -0
  256. package/dist/scripts/frameworks/sveltekit/routes.d.ts +3 -0
  257. package/dist/scripts/frameworks/sveltekit/routes.js +50 -0
  258. package/dist/scripts/frameworks/sveltekit/template-style.d.ts +9 -0
  259. package/dist/scripts/frameworks/sveltekit/template-style.js +54 -0
  260. package/dist/scripts/frameworks/vite/routes.d.ts +15 -0
  261. package/dist/scripts/frameworks/vite/routes.js +93 -0
  262. package/dist/scripts/frameworks/vite/routes.test.d.ts +1 -0
  263. package/dist/scripts/frameworks/vite/routes.test.js +73 -0
  264. package/dist/scripts/frameworks/vite/wiring.d.ts +10 -0
  265. package/dist/scripts/frameworks/vite/wiring.js +99 -0
  266. package/dist/scripts/frameworks/vite/wiring.test.d.ts +1 -0
  267. package/dist/scripts/frameworks/vite/wiring.test.js +88 -0
  268. package/dist/scripts/i18n-namespace.d.ts +25 -0
  269. package/dist/scripts/i18n-namespace.js +53 -0
  270. package/dist/scripts/lib/validation-report.d.ts +1 -0
  271. package/dist/scripts/lib/validation-report.js +3 -0
  272. package/dist/scripts/render-parity/capture.d.ts +56 -0
  273. package/dist/scripts/render-parity/capture.js +366 -0
  274. package/dist/scripts/render-parity/capture.test.d.ts +1 -0
  275. package/dist/scripts/render-parity/capture.test.js +306 -0
  276. package/dist/scripts/render-parity/compare.d.ts +59 -0
  277. package/dist/scripts/render-parity/compare.js +0 -0
  278. package/dist/scripts/render-parity/compare.test.d.ts +1 -0
  279. package/dist/scripts/render-parity/compare.test.js +98 -0
  280. package/dist/scripts/render-parity/normalize-html.d.ts +13 -0
  281. package/dist/scripts/render-parity/normalize-html.js +223 -0
  282. package/dist/scripts/render-parity/normalize-html.test.d.ts +1 -0
  283. package/dist/scripts/render-parity/normalize-html.test.js +58 -0
  284. package/dist/scripts/render-parity/types.d.ts +41 -0
  285. package/dist/scripts/render-parity/types.js +1 -0
  286. package/dist/scripts/resolve-routes.js +1 -1
  287. package/dist/scripts/scan-wrappable.d.ts +196 -0
  288. package/dist/scripts/scan-wrappable.js +1227 -0
  289. package/dist/scripts/scan-wrappable.test.d.ts +1 -0
  290. package/dist/scripts/scan-wrappable.test.js +521 -0
  291. package/dist/scripts/validate-route-metadata.js +11 -0
  292. package/package.json +92 -5
  293. package/release.json +2 -2
  294. package/templates/react-router/package.json +7 -10
  295. package/dist/runtime/paths/get-fimo-paths.test.d.ts +0 -2
  296. package/dist/runtime/paths/get-fimo-paths.test.d.ts.map +0 -1
  297. package/dist/runtime/paths/get-fimo-paths.test.js +0 -69
@@ -1,15 +1,5 @@
1
1
  import React from 'react';
2
- export interface ParamInfo {
3
- schema: string;
4
- queryField: string;
5
- displayField: string;
6
- }
7
- export interface DisplayRoute {
8
- id: string;
9
- name: string;
10
- path: string;
11
- params?: Record<string, ParamInfo>;
12
- }
2
+ export type { DisplayRoute, ParamInfo } from '../shared/display-routes.js';
13
3
  export interface FimoProvidersProps {
14
4
  children?: React.ReactNode;
15
5
  locale?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"FimoProviders.d.ts","sourceRoot":"","sources":["../../../src/runtime/app/FimoProviders.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAezE,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACpC;AAwFD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,kBAAkB,2CAwCrE"}
1
+ {"version":3,"file":"FimoProviders.d.ts","sourceRoot":"","sources":["../../../src/runtime/app/FimoProviders.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAgBzE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AA+D3E,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,kBAAkB,2CAwCrE"}
@@ -11,31 +11,10 @@ import { ViteLifecycles } from '../core/ViteLifecycles.js';
11
11
  import { FimoLocaleProvider } from '../i18n/FimoLocaleContext.js';
12
12
  import { getFimoTextDirection, resolveFimoLocale, toHtmlLang } from '../i18n/locale.js';
13
13
  import { ScreenshotProvider } from '../iframe/ScreenshotProvider.js';
14
+ import { getDisplayRoutes as getDisplayRoutesFromConfig } from '../shared/display-routes.js';
14
15
  import { OptionalTracking } from '../t/OptionalTracking.js';
15
- const titleCase = (seg) => seg
16
- .replace(/[_\-]+/g, ' ')
17
- .replace(/([a-z])([A-Z])/g, '$1 $2')
18
- .split(/\s+/)
19
- .filter(Boolean)
20
- .map((w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase())
21
- .join(' ');
22
- const generateRouteName = (path) => {
23
- if (path === '/') {
24
- return 'Home';
25
- }
26
- const firstSegment = path.replace(/^\//, '').split('/')[0];
27
- return titleCase(firstSegment);
28
- };
29
16
  function getDisplayRoutes() {
30
- const configRoutes = fimoConfig.routes ?? {};
31
- return Object.entries(configRoutes)
32
- .filter(([, route]) => route.path)
33
- .map(([id, route]) => ({
34
- id,
35
- path: route.path,
36
- name: route.name || generateRouteName(route.path),
37
- params: route.params,
38
- }));
17
+ return getDisplayRoutesFromConfig(fimoConfig);
39
18
  }
40
19
  function PreviewBridge() {
41
20
  const navigate = useNavigate();
@@ -0,0 +1,2 @@
1
+ export * from './server.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/astro/index.ts"],"names":[],"mappings":"AAEA,cAAc,aAAa,CAAC"}
@@ -0,0 +1,3 @@
1
+ // fimo/astro — see ./server.js (Astro is server-loader + DOM-attrs based;
2
+ // no client component set in v1).
3
+ export * from './server.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/astro/server.ts"],"names":[],"mappings":"AAIA,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,6 @@
1
+ // fimo/astro/server — Astro adapter, server surface. The loaders are
2
+ // framework-neutral (Astro 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';
@@ -1 +1 @@
1
- {"version":3,"file":"FimoLocaleContext.d.ts","sourceRoot":"","sources":["../../../src/runtime/i18n/FimoLocaleContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAEzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACvC,oBAAoB,EACpB,QAAQ,GAAG,eAAe,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,KAAK,CAC1E,CAAC;AAaF,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;IAAE,KAAK,EAAE,sBAAsB,CAAC;IAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAEpH;AAED,wBAAgB,SAAS,IAAI,sBAAsB,CAElD"}
1
+ {"version":3,"file":"FimoLocaleContext.d.ts","sourceRoot":"","sources":["../../../src/runtime/i18n/FimoLocaleContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAEzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACvC,oBAAoB,EACpB,QAAQ,GAAG,eAAe,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,KAAK,CAC1E,CAAC;AAaF,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;IAAE,KAAK,EAAE,sBAAsB,CAAC;IAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAEpH;AAED,wBAAgB,SAAS,IAAI,sBAAsB,CAElD"}
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { jsx as _jsx } from "react/jsx-runtime";
2
3
  import { createContext, useContext } from 'react';
3
4
  const fallbackLocale = {
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import type { FimoConfig } from '../shared/fimo-config.types.js';
3
+ import type { WrappedMediaEntry, WrappedRichTextEntry } from '../wrapped/WrappedContentContext.js';
4
+ import { type WrappedLabels } from '../wrapped/WrappedProviders.js';
5
+ export type FimoNextLabels = WrappedLabels;
6
+ export interface FimoNextProvidersProps {
7
+ config: FimoConfig;
8
+ labels?: FimoNextLabels;
9
+ media?: Record<string, WrappedMediaEntry>;
10
+ richText?: Record<string, WrappedRichTextEntry>;
11
+ locale?: string;
12
+ children?: React.ReactNode;
13
+ }
14
+ /**
15
+ * Fimo providers for wrapped Next.js apps — the Next adapter supplies only
16
+ * the navigation hooks; everything else lives in the framework-neutral
17
+ * WrappedProviders. Mount once in the root layout:
18
+ *
19
+ * const config = loadFimoConfig();
20
+ * const labels = await loadFimoLabels();
21
+ * <FimoNextProviders config={config} labels={labels}>{children}</FimoNextProviders>
22
+ */
23
+ export declare function FimoNextProviders(props: FimoNextProvidersProps): import("react/jsx-runtime").JSX.Element;
24
+ //# sourceMappingURL=FimoNextProviders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FimoNextProviders.d.ts","sourceRoot":"","sources":["../../../src/runtime/next/FimoNextProviders.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AACnG,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAEtF,MAAM,MAAM,cAAc,GAAG,aAAa,CAAC;AAE3C,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,2CAK9D"}
@@ -0,0 +1,20 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { usePathname, useRouter } from 'next/navigation';
4
+ import { useMemo } from 'react';
5
+ import { WrappedProviders } from '../wrapped/WrappedProviders.js';
6
+ /**
7
+ * Fimo providers for wrapped Next.js apps — the Next adapter supplies only
8
+ * the navigation hooks; everything else lives in the framework-neutral
9
+ * WrappedProviders. Mount once in the root layout:
10
+ *
11
+ * const config = loadFimoConfig();
12
+ * const labels = await loadFimoLabels();
13
+ * <FimoNextProviders config={config} labels={labels}>{children}</FimoNextProviders>
14
+ */
15
+ export function FimoNextProviders(props) {
16
+ const router = useRouter();
17
+ const pathname = usePathname();
18
+ const navigation = useMemo(() => ({ pathname, navigate: (to) => router.push(to) }), [pathname, router]);
19
+ return _jsx(WrappedProviders, { ...props, navigation: navigation });
20
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Renders the Fimo preview client script in development so the Fimo Studio
3
+ * preview can select/edit elements. Mount inside <head> in the root layout.
4
+ *
5
+ * The script URL comes from NEXT_PUBLIC_FIMO_PREVIEW_SCRIPT_URL (written by
6
+ * `fimo init` for wrapped projects, pointing at `<apiUrl>/preview.js`).
7
+ * Renders nothing in production builds.
8
+ */
9
+ export declare function FimoNextScripts(): import("react/jsx-runtime").JSX.Element | null;
10
+ //# sourceMappingURL=FimoNextScripts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FimoNextScripts.d.ts","sourceRoot":"","sources":["../../../src/runtime/next/FimoNextScripts.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,eAAe,mDAW9B"}
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * Renders the Fimo preview client script in development so the Fimo Studio
4
+ * preview can select/edit elements. Mount inside <head> in the root layout.
5
+ *
6
+ * The script URL comes from NEXT_PUBLIC_FIMO_PREVIEW_SCRIPT_URL (written by
7
+ * `fimo init` for wrapped projects, pointing at `<apiUrl>/preview.js`).
8
+ * Renders nothing in production builds.
9
+ */
10
+ export function FimoNextScripts() {
11
+ if (process.env.NODE_ENV !== 'development') {
12
+ return null;
13
+ }
14
+ const previewScriptUrl = process.env.NEXT_PUBLIC_FIMO_PREVIEW_SCRIPT_URL;
15
+ if (!previewScriptUrl) {
16
+ return null;
17
+ }
18
+ return _jsx("script", { type: "module", src: previewScriptUrl });
19
+ }
@@ -0,0 +1,14 @@
1
+ export { FimoNextProviders } from './FimoNextProviders.js';
2
+ export type { FimoNextLabels, FimoNextProvidersProps } from './FimoNextProviders.js';
3
+ export { FimoNextScripts } from './FimoNextScripts.js';
4
+ export { FimoText } from '../wrapped/FimoText.js';
5
+ export { FimoRichTextBlock } from '../wrapped/FimoRichTextBlock.js';
6
+ export { FimoMediaImage } from '../wrapped/FimoMediaImage.js';
7
+ export { FimoMediaVideo } from '../wrapped/FimoMediaVideo.js';
8
+ export { FimoFileLink } from '../wrapped/FimoFileLink.js';
9
+ export { useWrappedMedia, useWrappedRichText } from '../wrapped/WrappedContentContext.js';
10
+ export type { WrappedMediaEntry, WrappedRichTextEntry } from '../wrapped/WrappedContentContext.js';
11
+ export { useLabels, useTranslations } from '../primitives/labels-hook.js';
12
+ export { Text, Image, Video, RichText } from '../react/index.js';
13
+ export type { FimoConfig } from '../shared/fimo-config.types.js';
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/next/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,YAAY,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC1F,YAAY,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAInG,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACjE,YAAY,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC"}
@@ -0,0 +1,14 @@
1
+ // fimo/next — the Next.js adapter for wrapped (migrated) sites.
2
+ // Client components; server loaders live in fimo/next/server.
3
+ export { FimoNextProviders } from './FimoNextProviders.js';
4
+ export { FimoNextScripts } from './FimoNextScripts.js';
5
+ export { FimoText } from '../wrapped/FimoText.js';
6
+ export { FimoRichTextBlock } from '../wrapped/FimoRichTextBlock.js';
7
+ export { FimoMediaImage } from '../wrapped/FimoMediaImage.js';
8
+ export { FimoMediaVideo } from '../wrapped/FimoMediaVideo.js';
9
+ export { FimoFileLink } from '../wrapped/FimoFileLink.js';
10
+ export { useWrappedMedia, useWrappedRichText } from '../wrapped/WrappedContentContext.js';
11
+ // Framework-neutral React surface, re-exported for convenience so wrapped
12
+ // apps import everything from fimo/next.
13
+ export { useLabels, useTranslations } from '../primitives/labels-hook.js';
14
+ export { Text, Image, Video, RichText } from '../react/index.js';
@@ -0,0 +1,2 @@
1
+ export * from '../wrapped/server.js';
2
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/runtime/next/server.ts"],"names":[],"mappings":"AAGA,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,4 @@
1
+ // fimo/next/server — the Next.js adapter's server surface. The loaders are
2
+ // framework-neutral and live in ../wrapped/server.js; this module is the
3
+ // adapter-facing entry so future adapters (fimo/astro) mirror it.
4
+ export * from '../wrapped/server.js';
@@ -0,0 +1,9 @@
1
+ export declare function useFimoLabels(locale?: string): Promise<Record<string, string>>;
2
+ /**
3
+ * Server-loaded, hydration-safe label accessor for `<script setup>`:
4
+ *
5
+ * const t = await useFimoT();
6
+ * <h1 v-bind="fimoLabelAttrs('hero.title')">{{ t('hero.title', 'Fallback') }}</h1>
7
+ */
8
+ export declare function useFimoT(locale?: string): Promise<(key: string, fallback?: string) => string>;
9
+ //# sourceMappingURL=composables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composables.d.ts","sourceRoot":"","sources":["../../../src/runtime/nuxt/composables.ts"],"names":[],"mappings":"AA8BA,wBAAsB,aAAa,CAAC,MAAM,SAAO,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAyBlF;AAED;;;;;GAKG;AACH,wBAAsB,QAAQ,CAAC,MAAM,SAAO,GAAG,OAAO,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC,CAGjG"}
@@ -0,0 +1,57 @@
1
+ // Nuxt composables over the PURE label-fetch core. Constraints proven by the
2
+ // nuxtship dogfood, in order:
3
+ // - no node builtins anywhere in this module graph (`<script setup>` imports
4
+ // land in the client bundle; named imports from externalized builtins hard-
5
+ // fail `nuxt build`);
6
+ // - no `#app` import (Vite's dep optimizer prebundles node_modules with no
7
+ // knowledge of Nuxt aliases);
8
+ // - no `nuxt/app` import either (server-side the package is a nitro external
9
+ // resolved by raw node, where nuxt/app's internal `#build/*` imports do not
10
+ // exist).
11
+ // So: import only from 'vue', reach the Nuxt app via the current component
12
+ // instance, and hand labels to the client through `nuxtApp.payload.data` —
13
+ // the exact bucket useAsyncData serializes into the page payload.
14
+ import { getCurrentInstance } from 'vue';
15
+ import { fetchLabelDictionary, resolveTenantApiUrl } from '../shared/labels-fetch.pure.js';
16
+ function currentNuxtApp() {
17
+ const instance = getCurrentInstance();
18
+ const vueApp = instance?.appContext?.app;
19
+ return vueApp?.$nuxt ?? vueApp?.config?.globalProperties?.$nuxt ?? instance?.proxy?.$nuxt;
20
+ }
21
+ export async function useFimoLabels(locale = 'en') {
22
+ const key = `__fimo_labels_${locale}`;
23
+ const payloadData = currentNuxtApp()?.payload?.data;
24
+ const cached = payloadData?.[key];
25
+ if (cached) {
26
+ return cached;
27
+ }
28
+ // `typeof window` (not import.meta.server): as a nitro external this module
29
+ // runs as plain node ESM where Nuxt's import.meta flags do not exist.
30
+ if (typeof window !== 'undefined') {
31
+ return {};
32
+ }
33
+ const apiUrl = resolveTenantApiUrl(process.env);
34
+ if (!apiUrl) {
35
+ return {};
36
+ }
37
+ try {
38
+ const { labels } = await fetchLabelDictionary(apiUrl, locale);
39
+ if (payloadData) {
40
+ payloadData[key] = labels;
41
+ }
42
+ return labels;
43
+ }
44
+ catch {
45
+ return {};
46
+ }
47
+ }
48
+ /**
49
+ * Server-loaded, hydration-safe label accessor for `<script setup>`:
50
+ *
51
+ * const t = await useFimoT();
52
+ * <h1 v-bind="fimoLabelAttrs('hero.title')">{{ t('hero.title', 'Fallback') }}</h1>
53
+ */
54
+ export async function useFimoT(locale = 'en') {
55
+ const labels = await useFimoLabels(locale);
56
+ return (key, fallback = '') => labels[key] ?? fallback;
57
+ }
@@ -0,0 +1,3 @@
1
+ export { fimoLabelAttrs, fimoMediaAttrs, FIMO_SOURCE_ATTR } from '../wrapped/dom.js';
2
+ export { useFimoLabels, useFimoT } from './composables.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/nuxt/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,6 @@
1
+ // fimo/nuxt — CLIENT-SAFE surface for universal Vue SFCs. Never re-export
2
+ // the server barrel here: a `<script setup>` import lands in the client
3
+ // bundle, and the server loaders read fs/env (the nuxtship dogfood broke
4
+ // `nuxt build` exactly this way). Server routes import fimo/nuxt/server.
5
+ export { fimoLabelAttrs, fimoMediaAttrs, FIMO_SOURCE_ATTR } from '../wrapped/dom.js';
6
+ export { useFimoLabels, useFimoT } from './composables.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/nuxt/server.ts"],"names":[],"mappings":"AAIA,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,6 @@
1
+ // fimo/nuxt/server — Nuxt adapter, server surface. The loaders are
2
+ // framework-neutral (Nuxt 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';
@@ -1 +1 @@
1
- {"version":3,"file":"get-fimo-paths.d.ts","sourceRoot":"","sources":["../../../src/runtime/paths/get-fimo-paths.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAkFhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAsB,YAAY,CAAC,IAAI,GAAE,mBAAwB,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAoGtF"}
1
+ {"version":3,"file":"get-fimo-paths.d.ts","sourceRoot":"","sources":["../../../src/runtime/paths/get-fimo-paths.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAoEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAsB,YAAY,CAAC,IAAI,GAAE,mBAAwB,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAoGtF"}
@@ -7,9 +7,6 @@ import { getFimoLocales, localizeFimoPath } from '../i18n/locale.js';
7
7
  import { resolveSeoForPath } from '../seo/resolver.js';
8
8
  import { getConfigServer } from '../shared/fimo-config.server.js';
9
9
  const isValidationBuild = !!process.env.FIMO_VALIDATION_BUILD;
10
- const MAX_FETCH_ATTEMPTS = 3;
11
- const RETRYABLE_FETCH_STATUSES = new Set([502, 503, 504]);
12
- const RETRY_BASE_DELAY_MS = 250;
13
10
  function readEnvValue(rootDir, key) {
14
11
  if (process.env[key]) {
15
12
  return process.env[key];
@@ -45,19 +42,12 @@ async function fetchEntries(baseUrl, schema, rootDir, locale) {
45
42
  if (branch) {
46
43
  headers['X-Fimo-Branch'] = branch;
47
44
  }
48
- for (let attempt = 1; attempt <= MAX_FETCH_ATTEMPTS; attempt += 1) {
49
- const res = await fetch(url, { headers });
50
- if (res.ok) {
51
- const payload = (await res.json());
52
- return Array.isArray(payload?.data) ? payload.data : [];
53
- }
54
- if (!RETRYABLE_FETCH_STATUSES.has(res.status) || attempt === MAX_FETCH_ATTEMPTS) {
55
- const attemptDetail = attempt > 1 ? ` after ${attempt} attempts` : '';
56
- throw new Error(`Failed to fetch ${schema}: ${res.status}${attemptDetail}`);
57
- }
58
- await new Promise((resolveDelay) => setTimeout(resolveDelay, RETRY_BASE_DELAY_MS * attempt));
45
+ const res = await fetch(url, { headers });
46
+ if (!res.ok) {
47
+ throw new Error(`Failed to fetch ${schema}: ${res.status}`);
59
48
  }
60
- throw new Error(`Failed to fetch ${schema}`);
49
+ const payload = (await res.json());
50
+ return Array.isArray(payload?.data) ? payload.data : [];
61
51
  }
62
52
  // Glob-ish matcher for route keys: '*' matches one segment, '**' matches any.
63
53
  function compilePattern(pattern) {
@@ -0,0 +1,33 @@
1
+ import { FimoString } from './lib/index.js';
2
+ /**
3
+ * Hook to provide a label function (`t`).
4
+ *
5
+ * Returns FimoString with source tracking for inline editing.
6
+ * Use with <Text> component for rendering, or String() for escape hatch.
7
+ *
8
+ * The optional `fallback` renders when the key has no value in the store —
9
+ * used by wrapped (migrated) projects where the original hardcoded string
10
+ * stays in code as a resilience fallback. Template projects keep the
11
+ * single-argument form (labels are DB-owned there).
12
+ *
13
+ * @example
14
+ * const { t } = useLabels();
15
+ *
16
+ * // With Text component (recommended)
17
+ * <Text value={t('welcome')} />
18
+ *
19
+ * // Escape hatch for attributes
20
+ * <input placeholder={String(t('email.placeholder'))} />
21
+ */
22
+ export declare function useLabels(): {
23
+ t: (fullKey: string, fallback?: string) => FimoString;
24
+ locale: string;
25
+ };
26
+ /**
27
+ * Legacy alias for older projects. Prefer useLabels() in new code.
28
+ */
29
+ export declare function useTranslations(): {
30
+ t: (fullKey: string, fallback?: string) => FimoString;
31
+ locale: string;
32
+ };
33
+ //# sourceMappingURL=labels-hook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"labels-hook.d.ts","sourceRoot":"","sources":["../../../src/runtime/primitives/labels-hook.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,SAAS;iBAIH,MAAM,aAAa,MAAM,KAAG,UAAU;;EAS3D;AAED;;GAEG;AACH,wBAAgB,eAAe;iBAdT,MAAM,aAAa,MAAM,KAAG,UAAU;;EAgB3D"}
@@ -0,0 +1,41 @@
1
+ import { useSyncExternalStore } from 'react';
2
+ import { useLocale } from '../i18n/FimoLocaleContext.js';
3
+ import { getLabelSnapshot, subscribeLabels } from './labels-store.js';
4
+ import { FimoString } from './lib/index.js';
5
+ /**
6
+ * Hook to provide a label function (`t`).
7
+ *
8
+ * Returns FimoString with source tracking for inline editing.
9
+ * Use with <Text> component for rendering, or String() for escape hatch.
10
+ *
11
+ * The optional `fallback` renders when the key has no value in the store —
12
+ * used by wrapped (migrated) projects where the original hardcoded string
13
+ * stays in code as a resilience fallback. Template projects keep the
14
+ * single-argument form (labels are DB-owned there).
15
+ *
16
+ * @example
17
+ * const { t } = useLabels();
18
+ *
19
+ * // With Text component (recommended)
20
+ * <Text value={t('welcome')} />
21
+ *
22
+ * // Escape hatch for attributes
23
+ * <input placeholder={String(t('email.placeholder'))} />
24
+ */
25
+ export function useLabels() {
26
+ const localeContext = useLocale();
27
+ const labels = useSyncExternalStore(subscribeLabels, getLabelSnapshot, getLabelSnapshot);
28
+ const t = (fullKey, fallback) => {
29
+ const locale = localeContext.locale || labels.defaultLocale || 'en';
30
+ const dictionary = labels.dictionaries[locale] ?? labels.dictionaries[labels.defaultLocale] ?? {};
31
+ const text = dictionary[fullKey] ?? fallback ?? '';
32
+ return new FimoString(text, `__labels.${locale}.${fullKey}.value`);
33
+ };
34
+ return { t, locale: localeContext.locale };
35
+ }
36
+ /**
37
+ * Legacy alias for older projects. Prefer useLabels() in new code.
38
+ */
39
+ export function useTranslations() {
40
+ return useLabels();
41
+ }
@@ -0,0 +1,12 @@
1
+ export interface LabelState {
2
+ dictionaries: Record<string, Record<string, string>>;
3
+ defaultLocale: string;
4
+ signature: string;
5
+ updatedAt: string | null;
6
+ }
7
+ export declare function subscribeLabels(listener: () => void): () => void;
8
+ export declare function getLabelSnapshot(): LabelState;
9
+ export declare function setLabelState(next: LabelState): void;
10
+ export declare function hydrateLabels(bundle: LabelState): void;
11
+ export declare function applyLabelUpdate(payload: unknown): void;
12
+ //# sourceMappingURL=labels-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"labels-store.d.ts","sourceRoot":"","sources":["../../../src/runtime/primitives/labels-store.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACrD,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAUD,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAKhE;AAED,wBAAgB,gBAAgB,IAAI,UAAU,CAE7C;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAQpD;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAEtD;AAuBD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAgBvD"}
@@ -0,0 +1,60 @@
1
+ // Framework-neutral label store. No Vite virtual modules, no HMR, no React:
2
+ // adapters (fimo/ui via ./translations.ts, fimo/next, ...) hydrate it with
3
+ // their own label source and the hook layer subscribes to it.
4
+ const labelListeners = new Set();
5
+ let labelState = {
6
+ dictionaries: {},
7
+ defaultLocale: 'en',
8
+ signature: '__fimo-labels-uninitialized__',
9
+ updatedAt: null,
10
+ };
11
+ export function subscribeLabels(listener) {
12
+ labelListeners.add(listener);
13
+ return () => {
14
+ labelListeners.delete(listener);
15
+ };
16
+ }
17
+ export function getLabelSnapshot() {
18
+ return labelState;
19
+ }
20
+ export function setLabelState(next) {
21
+ if (next.signature === labelState.signature) {
22
+ return;
23
+ }
24
+ labelState = next;
25
+ for (const listener of labelListeners) {
26
+ listener();
27
+ }
28
+ }
29
+ export function hydrateLabels(bundle) {
30
+ setLabelState(bundle);
31
+ }
32
+ function isRecord(value) {
33
+ return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
34
+ }
35
+ function normalizeDictionaries(value) {
36
+ if (!isRecord(value)) {
37
+ return null;
38
+ }
39
+ const dictionaries = {};
40
+ for (const [locale, labels] of Object.entries(value)) {
41
+ if (!isRecord(labels)) {
42
+ continue;
43
+ }
44
+ dictionaries[locale] = Object.fromEntries(Object.entries(labels).filter((entry) => typeof entry[1] === 'string'));
45
+ }
46
+ return dictionaries;
47
+ }
48
+ export function applyLabelUpdate(payload) {
49
+ if (!isRecord(payload)) {
50
+ return;
51
+ }
52
+ const dictionaries = normalizeDictionaries(payload.dictionaries);
53
+ if (!dictionaries) {
54
+ return;
55
+ }
56
+ const defaultLocale = typeof payload.defaultLocale === 'string' ? payload.defaultLocale : labelState.defaultLocale;
57
+ const signature = typeof payload.signature === 'string' ? payload.signature : JSON.stringify({ dictionaries, defaultLocale });
58
+ const updatedAt = typeof payload.updatedAt === 'string' ? payload.updatedAt : null;
59
+ setLabelState({ dictionaries, defaultLocale, signature, updatedAt });
60
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=labels-store.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"labels-store.test.d.ts","sourceRoot":"","sources":["../../../src/runtime/primitives/labels-store.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,66 @@
1
+ import { describe, expect, it, vi } from 'vitest';
2
+ import { applyLabelUpdate, getLabelSnapshot, hydrateLabels, subscribeLabels } from './labels-store.js';
3
+ describe('labels-store', () => {
4
+ it('hydrates the store and notifies subscribers', () => {
5
+ const listener = vi.fn();
6
+ const unsubscribe = subscribeLabels(listener);
7
+ hydrateLabels({
8
+ dictionaries: { en: { 'hero.title': 'Welcome' } },
9
+ defaultLocale: 'en',
10
+ signature: 'sig-hydrate-1',
11
+ updatedAt: null,
12
+ });
13
+ expect(getLabelSnapshot().dictionaries.en['hero.title']).toBe('Welcome');
14
+ expect(listener).toHaveBeenCalledTimes(1);
15
+ unsubscribe();
16
+ });
17
+ it('ignores updates with an unchanged signature', () => {
18
+ const listener = vi.fn();
19
+ const unsubscribe = subscribeLabels(listener);
20
+ hydrateLabels({
21
+ dictionaries: { en: { a: '1' } },
22
+ defaultLocale: 'en',
23
+ signature: 'sig-same',
24
+ updatedAt: null,
25
+ });
26
+ hydrateLabels({
27
+ dictionaries: { en: { a: '2' } },
28
+ defaultLocale: 'en',
29
+ signature: 'sig-same',
30
+ updatedAt: null,
31
+ });
32
+ expect(getLabelSnapshot().dictionaries.en.a).toBe('1');
33
+ expect(listener).toHaveBeenCalledTimes(1);
34
+ unsubscribe();
35
+ });
36
+ it('normalizes payloads in applyLabelUpdate and drops non-string values', () => {
37
+ applyLabelUpdate({
38
+ dictionaries: { en: { keep: 'yes', drop: 42 }, fr: 'not-a-record' },
39
+ defaultLocale: 'en',
40
+ signature: 'sig-normalize',
41
+ });
42
+ const snapshot = getLabelSnapshot();
43
+ expect(snapshot.dictionaries.en).toEqual({ keep: 'yes' });
44
+ expect(snapshot.dictionaries.fr).toBeUndefined();
45
+ expect(snapshot.updatedAt).toBeNull();
46
+ });
47
+ it('rejects payloads without dictionaries', () => {
48
+ const before = getLabelSnapshot();
49
+ applyLabelUpdate({ defaultLocale: 'de' });
50
+ applyLabelUpdate(null);
51
+ applyLabelUpdate('nope');
52
+ expect(getLabelSnapshot()).toBe(before);
53
+ });
54
+ it('stops notifying after unsubscribe', () => {
55
+ const listener = vi.fn();
56
+ const unsubscribe = subscribeLabels(listener);
57
+ unsubscribe();
58
+ hydrateLabels({
59
+ dictionaries: { en: {} },
60
+ defaultLocale: 'en',
61
+ signature: 'sig-after-unsub',
62
+ updatedAt: null,
63
+ });
64
+ expect(listener).not.toHaveBeenCalled();
65
+ });
66
+ });