fimo 0.9.0-experimental.1 → 0.9.0

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 (205) hide show
  1. package/assets/skills/fimo/SKILL.md +17 -54
  2. package/assets/skills/fimo-cli/SKILL.md +15 -15
  3. package/assets/skills/fimo-cli/references/agent-setup.md +36 -53
  4. package/assets/skills/fimo-cli/references/agents.md +4 -4
  5. package/assets/skills/fimo-cli/references/content.md +2 -2
  6. package/assets/skills/fimo-cli/references/deploy.md +1 -1
  7. package/assets/skills/fimo-cli/references/forms.md +1 -1
  8. package/assets/skills/fimo-cli/references/init.md +16 -24
  9. package/assets/skills/fimo-cli/references/project-vars-and-secrets.md +14 -11
  10. package/assets/skills/fimo-cli/references/projects.md +1 -1
  11. package/assets/skills/fimo-cli/references/support.md +11 -9
  12. package/assets/skills/fimo-cli/references/webhooks.md +3 -1
  13. package/assets/skills/fimo-code/SKILL.md +67 -0
  14. package/assets/skills/fimo-migration/SKILL.md +2 -22
  15. package/assets/skills/fimo-migration/references/content.md +0 -24
  16. package/assets/skills/fimo-migration/references/manifest.md +0 -35
  17. package/assets/skills/fimo-migration/references/qa.md +2 -24
  18. package/assets/skills/fimo-migration/references/workflow.md +1 -12
  19. package/assets/skills/fimo-studio/references/visual-editing.md +3 -5
  20. package/assets/skills/fimo-studio/references/webhooks.md +1 -1
  21. package/dist/build/vite/plugins/translations.d.ts +8 -2
  22. package/dist/build/vite/plugins/translations.js +121 -3
  23. package/dist/cli/bundle.json +2 -2
  24. package/dist/cli/index.js +311 -1209
  25. package/dist/runtime/app/FimoProviders.d.ts +11 -1
  26. package/dist/runtime/app/FimoProviders.js +23 -2
  27. package/dist/runtime/content/client/createContentClient.js +2 -1
  28. package/dist/runtime/i18n/FimoLocaleContext.js +0 -1
  29. package/dist/runtime/primitives/lib/useFimoLiveValue.d.ts +3 -5
  30. package/dist/runtime/primitives/lib/useFimoLiveValue.js +4 -11
  31. package/dist/runtime/primitives/translations.d.ts +27 -1
  32. package/dist/runtime/primitives/translations.js +85 -7
  33. package/dist/runtime/shared/fimo-config.server.js +0 -1
  34. package/dist/runtime/shared/fimo-config.types.d.ts +0 -2
  35. package/dist/scripts/extract-translations.js +11 -16
  36. package/dist/scripts/lib/validation-report.d.ts +0 -1
  37. package/dist/scripts/lib/validation-report.js +0 -3
  38. package/dist/scripts/validate-route-metadata.js +0 -11
  39. package/package.json +4 -84
  40. package/release.json +2 -2
  41. package/scripts/postinstall.mjs +11 -65
  42. package/templates/react-router/AGENTS.md +44 -0
  43. package/templates/react-router/CLAUDE.md +5 -0
  44. package/templates/react-router/package.json +1 -1
  45. package/assets/agents-starter/AGENTS.md +0 -66
  46. package/assets/skills/fimo-migration/references/wrap.md +0 -617
  47. package/dist/runtime/astro/index.d.ts +0 -2
  48. package/dist/runtime/astro/index.js +0 -3
  49. package/dist/runtime/astro/server.d.ts +0 -3
  50. package/dist/runtime/astro/server.js +0 -6
  51. package/dist/runtime/next/FimoNextProviders.d.ts +0 -24
  52. package/dist/runtime/next/FimoNextProviders.js +0 -20
  53. package/dist/runtime/next/FimoNextScripts.d.ts +0 -10
  54. package/dist/runtime/next/FimoNextScripts.js +0 -19
  55. package/dist/runtime/next/index.d.ts +0 -14
  56. package/dist/runtime/next/index.js +0 -14
  57. package/dist/runtime/next/server.d.ts +0 -2
  58. package/dist/runtime/next/server.js +0 -4
  59. package/dist/runtime/nuxt/composables.d.ts +0 -9
  60. package/dist/runtime/nuxt/composables.js +0 -57
  61. package/dist/runtime/nuxt/index.d.ts +0 -3
  62. package/dist/runtime/nuxt/index.js +0 -6
  63. package/dist/runtime/nuxt/server.d.ts +0 -3
  64. package/dist/runtime/nuxt/server.js +0 -6
  65. package/dist/runtime/primitives/labels-hook.d.ts +0 -33
  66. package/dist/runtime/primitives/labels-hook.js +0 -41
  67. package/dist/runtime/primitives/labels-store.d.ts +0 -12
  68. package/dist/runtime/primitives/labels-store.js +0 -60
  69. package/dist/runtime/react/FimoSpaProviders.d.ts +0 -36
  70. package/dist/runtime/react/FimoSpaProviders.js +0 -63
  71. package/dist/runtime/react/index.d.ts +0 -33
  72. package/dist/runtime/react/index.js +0 -39
  73. package/dist/runtime/remix/FimoRemixProviders.d.ts +0 -16
  74. package/dist/runtime/remix/FimoRemixProviders.js +0 -12
  75. package/dist/runtime/remix/FimoRemixScripts.d.ts +0 -10
  76. package/dist/runtime/remix/FimoRemixScripts.js +0 -19
  77. package/dist/runtime/remix/index.d.ts +0 -12
  78. package/dist/runtime/remix/index.js +0 -11
  79. package/dist/runtime/remix/server.d.ts +0 -2
  80. package/dist/runtime/remix/server.js +0 -2
  81. package/dist/runtime/shared/display-routes.d.ts +0 -14
  82. package/dist/runtime/shared/display-routes.js +0 -25
  83. package/dist/runtime/shared/i18n-messages.d.ts +0 -29
  84. package/dist/runtime/shared/i18n-messages.js +0 -79
  85. package/dist/runtime/shared/labels-fetch.pure.d.ts +0 -17
  86. package/dist/runtime/shared/labels-fetch.pure.js +0 -71
  87. package/dist/runtime/shared/labels-fetch.server.d.ts +0 -7
  88. package/dist/runtime/shared/labels-fetch.server.js +0 -97
  89. package/dist/runtime/shared/labels-t.pure.d.ts +0 -2
  90. package/dist/runtime/shared/labels-t.pure.js +0 -10
  91. package/dist/runtime/strapi/client.d.ts +0 -30
  92. package/dist/runtime/strapi/client.js +0 -89
  93. package/dist/runtime/strapi/index.d.ts +0 -5
  94. package/dist/runtime/strapi/index.js +0 -6
  95. package/dist/runtime/strapi/reshape.d.ts +0 -46
  96. package/dist/runtime/strapi/reshape.js +0 -114
  97. package/dist/runtime/svelte/index.d.ts +0 -3
  98. package/dist/runtime/svelte/index.js +0 -7
  99. package/dist/runtime/svelte/server.d.ts +0 -3
  100. package/dist/runtime/svelte/server.js +0 -6
  101. package/dist/runtime/vue/index.d.ts +0 -3
  102. package/dist/runtime/vue/index.js +0 -5
  103. package/dist/runtime/vue/server.d.ts +0 -3
  104. package/dist/runtime/vue/server.js +0 -6
  105. package/dist/runtime/wrapped/FimoFileLink.d.ts +0 -17
  106. package/dist/runtime/wrapped/FimoFileLink.js +0 -19
  107. package/dist/runtime/wrapped/FimoMediaImage.d.ts +0 -14
  108. package/dist/runtime/wrapped/FimoMediaImage.js +0 -20
  109. package/dist/runtime/wrapped/FimoMediaVideo.d.ts +0 -14
  110. package/dist/runtime/wrapped/FimoMediaVideo.js +0 -20
  111. package/dist/runtime/wrapped/FimoRichTextBlock.d.ts +0 -23
  112. package/dist/runtime/wrapped/FimoRichTextBlock.js +0 -22
  113. package/dist/runtime/wrapped/FimoText.d.ts +0 -22
  114. package/dist/runtime/wrapped/FimoText.js +0 -20
  115. package/dist/runtime/wrapped/WrappedContentContext.d.ts +0 -28
  116. package/dist/runtime/wrapped/WrappedContentContext.js +0 -30
  117. package/dist/runtime/wrapped/WrappedProviders.d.ts +0 -33
  118. package/dist/runtime/wrapped/WrappedProviders.js +0 -101
  119. package/dist/runtime/wrapped/dom.d.ts +0 -4
  120. package/dist/runtime/wrapped/dom.js +0 -23
  121. package/dist/runtime/wrapped/server.d.ts +0 -77
  122. package/dist/runtime/wrapped/server.js +0 -237
  123. package/dist/scripts/apply-wrap-templates.d.ts +0 -61
  124. package/dist/scripts/apply-wrap-templates.js +0 -132
  125. package/dist/scripts/apply-wrap.d.ts +0 -46
  126. package/dist/scripts/apply-wrap.js +0 -278
  127. package/dist/scripts/cms/discover.d.ts +0 -2
  128. package/dist/scripts/cms/discover.js +0 -17
  129. package/dist/scripts/cms/example-content.d.ts +0 -33
  130. package/dist/scripts/cms/example-content.js +0 -162
  131. package/dist/scripts/cms/strapi/detect.d.ts +0 -2
  132. package/dist/scripts/cms/strapi/detect.js +0 -186
  133. package/dist/scripts/cms/strapi/index.d.ts +0 -3
  134. package/dist/scripts/cms/strapi/index.js +0 -25
  135. package/dist/scripts/cms/strapi/list-source.d.ts +0 -17
  136. package/dist/scripts/cms/strapi/list-source.js +0 -90
  137. package/dist/scripts/cms/strapi/schema-map.d.ts +0 -9
  138. package/dist/scripts/cms/strapi/schema-map.js +0 -277
  139. package/dist/scripts/cms/strapi/shapes.d.ts +0 -23
  140. package/dist/scripts/cms/strapi/shapes.js +0 -38
  141. package/dist/scripts/cms/strapi/touchpoints.d.ts +0 -31
  142. package/dist/scripts/cms/strapi/touchpoints.js +0 -145
  143. package/dist/scripts/cms/strapi/wire-client.d.ts +0 -15
  144. package/dist/scripts/cms/strapi/wire-client.js +0 -107
  145. package/dist/scripts/cms/strapi/wiring.d.ts +0 -17
  146. package/dist/scripts/cms/strapi/wiring.js +0 -46
  147. package/dist/scripts/cms/types.d.ts +0 -145
  148. package/dist/scripts/cms/types.js +0 -11
  149. package/dist/scripts/detect-framework.d.ts +0 -39
  150. package/dist/scripts/detect-framework.js +0 -133
  151. package/dist/scripts/draft-rows.d.ts +0 -19
  152. package/dist/scripts/draft-rows.js +0 -135
  153. package/dist/scripts/draft-schemas.d.ts +0 -27
  154. package/dist/scripts/draft-schemas.js +0 -188
  155. package/dist/scripts/frameworks/astro/routes.d.ts +0 -3
  156. package/dist/scripts/frameworks/astro/routes.js +0 -55
  157. package/dist/scripts/frameworks/astro/template-style.d.ts +0 -7
  158. package/dist/scripts/frameworks/astro/template-style.js +0 -19
  159. package/dist/scripts/frameworks/discover.d.ts +0 -70
  160. package/dist/scripts/frameworks/discover.js +0 -178
  161. package/dist/scripts/frameworks/next/rewire.d.ts +0 -30
  162. package/dist/scripts/frameworks/next/rewire.js +0 -258
  163. package/dist/scripts/frameworks/next/routes.d.ts +0 -17
  164. package/dist/scripts/frameworks/next/routes.js +0 -134
  165. package/dist/scripts/frameworks/next/wiring.d.ts +0 -33
  166. package/dist/scripts/frameworks/next/wiring.js +0 -186
  167. package/dist/scripts/frameworks/nuxt/routes.d.ts +0 -3
  168. package/dist/scripts/frameworks/nuxt/routes.js +0 -54
  169. package/dist/scripts/frameworks/nuxt/template-style.d.ts +0 -9
  170. package/dist/scripts/frameworks/nuxt/template-style.js +0 -27
  171. package/dist/scripts/frameworks/remix/routes.d.ts +0 -3
  172. package/dist/scripts/frameworks/remix/routes.js +0 -50
  173. package/dist/scripts/frameworks/support.d.ts +0 -75
  174. package/dist/scripts/frameworks/support.js +0 -165
  175. package/dist/scripts/frameworks/sveltekit/routes.d.ts +0 -3
  176. package/dist/scripts/frameworks/sveltekit/routes.js +0 -50
  177. package/dist/scripts/frameworks/sveltekit/template-style.d.ts +0 -9
  178. package/dist/scripts/frameworks/sveltekit/template-style.js +0 -54
  179. package/dist/scripts/frameworks/vite/routes.d.ts +0 -15
  180. package/dist/scripts/frameworks/vite/routes.js +0 -93
  181. package/dist/scripts/frameworks/vite/wiring.d.ts +0 -10
  182. package/dist/scripts/frameworks/vite/wiring.js +0 -99
  183. package/dist/scripts/i18n-namespace.d.ts +0 -27
  184. package/dist/scripts/i18n-namespace.js +0 -155
  185. package/dist/scripts/render-parity/capture.d.ts +0 -56
  186. package/dist/scripts/render-parity/capture.js +0 -366
  187. package/dist/scripts/render-parity/compare.d.ts +0 -59
  188. package/dist/scripts/render-parity/compare.js +0 -0
  189. package/dist/scripts/render-parity/normalize-html.d.ts +0 -13
  190. package/dist/scripts/render-parity/normalize-html.js +0 -223
  191. package/dist/scripts/render-parity/types.d.ts +0 -41
  192. package/dist/scripts/render-parity/types.js +0 -1
  193. package/dist/scripts/scan-wrappable.d.ts +0 -196
  194. package/dist/scripts/scan-wrappable.js +0 -1232
  195. /package/assets/skills/{fimo → fimo-code}/assets/react-router-locales/navigation.tsx +0 -0
  196. /package/assets/skills/{fimo → fimo-code}/assets/react-router-locales/routes.ts +0 -0
  197. /package/assets/skills/{fimo → fimo-code}/references/assets.md +0 -0
  198. /package/assets/skills/{fimo → fimo-code}/references/content.md +0 -0
  199. /package/assets/skills/{fimo → fimo-code}/references/design.md +0 -0
  200. /package/assets/skills/{fimo → fimo-code}/references/forms.md +0 -0
  201. /package/assets/skills/{fimo → fimo-code}/references/labels.md +0 -0
  202. /package/assets/skills/{fimo → fimo-code}/references/locales.md +0 -0
  203. /package/assets/skills/{fimo → fimo-code}/references/setup-plain-vite.md +0 -0
  204. /package/assets/skills/{fimo → fimo-code}/references/setup-react-router.md +0 -0
  205. /package/assets/skills/{fimo → fimo-code}/references/ui.md +0 -0
@@ -1,20 +0,0 @@
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
- }
@@ -1,10 +0,0 @@
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
@@ -1,19 +0,0 @@
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
- }
@@ -1,14 +0,0 @@
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
@@ -1,14 +0,0 @@
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';
@@ -1,2 +0,0 @@
1
- export * from '../wrapped/server.js';
2
- //# sourceMappingURL=server.d.ts.map
@@ -1,4 +0,0 @@
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';
@@ -1,9 +0,0 @@
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
@@ -1,57 +0,0 @@
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
- }
@@ -1,3 +0,0 @@
1
- export { fimoLabelAttrs, fimoMediaAttrs, FIMO_SOURCE_ATTR } from '../wrapped/dom.js';
2
- export { useFimoLabels, useFimoT } from './composables.js';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1,6 +0,0 @@
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';
@@ -1,3 +0,0 @@
1
- export * from '../wrapped/server.js';
2
- export { fimoLabelAttrs, fimoMediaAttrs } from '../wrapped/dom.js';
3
- //# sourceMappingURL=server.d.ts.map
@@ -1,6 +0,0 @@
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,33 +0,0 @@
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
@@ -1,41 +0,0 @@
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
- }
@@ -1,12 +0,0 @@
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
@@ -1,60 +0,0 @@
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
- }
@@ -1,36 +0,0 @@
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
- export interface FimoSpaProvidersProps {
5
- /** The project's fimo-config.json — import it directly: `import config from '../fimo-config.json'`. */
6
- config: FimoConfig;
7
- /** Tenant API base URL, e.g. `import.meta.env.VITE_API_URL`. Without it, wrapped values render their inline fallbacks. */
8
- apiUrl?: string;
9
- /** Preview client script for Fimo Studio edit mode. Pass only in dev, e.g. `import.meta.env.DEV ? import.meta.env.VITE_FIMO_PREVIEW_SCRIPT_URL : undefined`. */
10
- previewScriptUrl?: string;
11
- media?: Record<string, WrappedMediaEntry>;
12
- richText?: Record<string, WrappedRichTextEntry>;
13
- locale?: string;
14
- children?: React.ReactNode;
15
- }
16
- /**
17
- * Fimo providers for wrapped CLIENT-RENDERED React apps (Vite SPAs). There is
18
- * no server pass to load labels in, so this adapter fetches the dictionary in
19
- * the browser and hydrates the framework-neutral WrappedProviders; until the
20
- * fetch resolves (or when it fails), every wrapped value renders its inline
21
- * fallback — the original hardcoded string. Mount once around the app root:
22
- *
23
- * import config from '../fimo-config.json';
24
- * <FimoSpaProviders
25
- * config={config}
26
- * apiUrl={import.meta.env.VITE_API_URL}
27
- * previewScriptUrl={import.meta.env.DEV ? import.meta.env.VITE_FIMO_PREVIEW_SCRIPT_URL : undefined}
28
- * >
29
- * <App />
30
- * </FimoSpaProviders>
31
- *
32
- * Navigation is History-API based (full page load): correct for any SPA
33
- * router without depending on one.
34
- */
35
- export declare function FimoSpaProviders({ config, apiUrl, previewScriptUrl, media, richText, locale, children, }: FimoSpaProvidersProps): import("react/jsx-runtime").JSX.Element;
36
- //# sourceMappingURL=FimoSpaProviders.d.ts.map
@@ -1,63 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useEffect, useMemo, useState } from 'react';
4
- import { getFimoDefaultLocale, getFimoLocales } from '../i18n/locale.js';
5
- import { fetchLabelBundle, serializeBundle } from '../shared/labels-fetch.pure.js';
6
- import { WrappedProviders } from '../wrapped/WrappedProviders.js';
7
- /** Browser-safe stable signature (labelSignature uses Buffer, server-only). */
8
- function bundleSignature(bundle) {
9
- const serialized = serializeBundle(bundle);
10
- let hash = 5381;
11
- for (let i = 0; i < serialized.length; i++) {
12
- hash = ((hash << 5) + hash + serialized.charCodeAt(i)) | 0;
13
- }
14
- return `spa-${hash}`;
15
- }
16
- /**
17
- * Fimo providers for wrapped CLIENT-RENDERED React apps (Vite SPAs). There is
18
- * no server pass to load labels in, so this adapter fetches the dictionary in
19
- * the browser and hydrates the framework-neutral WrappedProviders; until the
20
- * fetch resolves (or when it fails), every wrapped value renders its inline
21
- * fallback — the original hardcoded string. Mount once around the app root:
22
- *
23
- * import config from '../fimo-config.json';
24
- * <FimoSpaProviders
25
- * config={config}
26
- * apiUrl={import.meta.env.VITE_API_URL}
27
- * previewScriptUrl={import.meta.env.DEV ? import.meta.env.VITE_FIMO_PREVIEW_SCRIPT_URL : undefined}
28
- * >
29
- * <App />
30
- * </FimoSpaProviders>
31
- *
32
- * Navigation is History-API based (full page load): correct for any SPA
33
- * router without depending on one.
34
- */
35
- export function FimoSpaProviders({ config, apiUrl, previewScriptUrl, media, richText, locale, children, }) {
36
- const [labels, setLabels] = useState(undefined);
37
- useEffect(() => {
38
- if (!apiUrl) {
39
- return;
40
- }
41
- let cancelled = false;
42
- const defaultLocale = getFimoDefaultLocale(config);
43
- fetchLabelBundle(apiUrl, getFimoLocales(config), defaultLocale)
44
- .then((bundle) => {
45
- if (!cancelled) {
46
- setLabels({ ...bundle, signature: bundleSignature(bundle) });
47
- }
48
- })
49
- .catch(() => {
50
- // Unreachable API: keep rendering the inline fallbacks.
51
- });
52
- return () => {
53
- cancelled = true;
54
- };
55
- }, [apiUrl, config]);
56
- const navigation = useMemo(() => ({
57
- pathname: typeof window !== 'undefined' ? window.location.pathname : null,
58
- navigate: (to) => {
59
- window.location.assign(to);
60
- },
61
- }), []);
62
- return (_jsxs(WrappedProviders, { config: config, labels: labels, media: media, richText: richText, locale: locale, navigation: navigation, children: [previewScriptUrl ? _jsx("script", { type: "module", src: previewScriptUrl }) : null, children] }));
63
- }
@@ -1,33 +0,0 @@
1
- export { Text } from '../primitives/components/Text.js';
2
- export { Image } from '../primitives/components/Image.js';
3
- export { StaticImage } from '../primitives/components/StaticImage.js';
4
- export { Video } from '../primitives/components/Video.js';
5
- export { Date } from '../primitives/components/Date.js';
6
- export { Boolean } from '../primitives/components/Boolean.js';
7
- export { RichText } from '../primitives/components/RichText.js';
8
- export { useLabels, useTranslations } from '../primitives/labels-hook.js';
9
- export { applyLabelUpdate, getLabelSnapshot, hydrateLabels, subscribeLabels } from '../primitives/labels-store.js';
10
- export type { LabelState } from '../primitives/labels-store.js';
11
- export { FimoText } from '../wrapped/FimoText.js';
12
- export { FimoRichTextBlock } from '../wrapped/FimoRichTextBlock.js';
13
- export { FimoMediaImage } from '../wrapped/FimoMediaImage.js';
14
- export { FimoMediaVideo } from '../wrapped/FimoMediaVideo.js';
15
- export { FimoFileLink } from '../wrapped/FimoFileLink.js';
16
- export { useWrappedMedia, useWrappedRichText } from '../wrapped/WrappedContentContext.js';
17
- export type { WrappedMediaEntry, WrappedRichTextEntry } from '../wrapped/WrappedContentContext.js';
18
- export { FimoSpaProviders } from './FimoSpaProviders.js';
19
- export type { FimoSpaProvidersProps } from './FimoSpaProviders.js';
20
- export { FimoString, FimoDate, FimoMedia, FimoBoolean, FimoRichText, type FimoSource, type FimoPart, type FimoRichTextContent, type FimoRichTextNodeProps, type FimoRichTextMarkProps, type FimoRichTextComponents, FIMO_SOURCE, FIMO_PARTS, isFimoString, isFimoDate, hasFimoSource, getFimoSource, getFimoParts, } from '../primitives/lib/index.js';
21
- export { fimo } from '../primitives/lib/template.js';
22
- export { useFimoLiveValue } from '../primitives/lib/useFimoLiveValue.js';
23
- export { DataSourcesProvider } from '../content/DataSourcesProvider.js';
24
- export { ConsoleErrorProvider } from '../iframe/ConsoleErrorProvider.js';
25
- export { ScreenshotProvider } from '../iframe/ScreenshotProvider.js';
26
- export { FimoLocaleProvider, useLocale } from '../i18n/FimoLocaleContext.js';
27
- export type { FimoLocaleContextValue } from '../i18n/FimoLocaleContext.js';
28
- export { getFimoDefaultLocale, getFimoLocales, getFimoTextDirection, localizeFimoPath, resolveFimoLocale, toHtmlLang, } from '../i18n/locale.js';
29
- export type { FimoLocaleResolution } from '../i18n/locale.js';
30
- export { getDisplayRoutes } from '../shared/display-routes.js';
31
- export type { DisplayRoute, ParamInfo } from '../shared/display-routes.js';
32
- export type { FimoConfig, FimoRouteConfig, FimoSEO } from '../shared/fimo-config.types.js';
33
- //# sourceMappingURL=index.d.ts.map
@@ -1,39 +0,0 @@
1
- // fimo/react — the framework-agnostic React core of the Fimo runtime.
2
- // No Vite virtual modules, no react-router, no bundler assumptions:
3
- // per-framework adapters (fimo/react-router via fimo/ui, fimo/next, ...)
4
- // build on this surface.
5
- // Inline-editing components
6
- export { Text } from '../primitives/components/Text.js';
7
- export { Image } from '../primitives/components/Image.js';
8
- export { StaticImage } from '../primitives/components/StaticImage.js';
9
- export { Video } from '../primitives/components/Video.js';
10
- export { Date } from '../primitives/components/Date.js';
11
- export { Boolean } from '../primitives/components/Boolean.js';
12
- export { RichText } from '../primitives/components/RichText.js';
13
- // Labels (framework-neutral store + hook; adapters hydrate the store)
14
- export { useLabels, useTranslations } from '../primitives/labels-hook.js';
15
- export { applyLabelUpdate, getLabelSnapshot, hydrateLabels, subscribeLabels } from '../primitives/labels-store.js';
16
- // Wrapped-site primitives (the --apply codemod imports these from fimo/react
17
- // in Vite React SPAs) + the client-side providers that hydrate them. All are
18
- // fallback-safe without a provider: FimoText renders its children, media
19
- // elements render their original src.
20
- export { FimoText } from '../wrapped/FimoText.js';
21
- export { FimoRichTextBlock } from '../wrapped/FimoRichTextBlock.js';
22
- export { FimoMediaImage } from '../wrapped/FimoMediaImage.js';
23
- export { FimoMediaVideo } from '../wrapped/FimoMediaVideo.js';
24
- export { FimoFileLink } from '../wrapped/FimoFileLink.js';
25
- export { useWrappedMedia, useWrappedRichText } from '../wrapped/WrappedContentContext.js';
26
- export { FimoSpaProviders } from './FimoSpaProviders.js';
27
- // Source-tracking primitives & utilities
28
- export { FimoString, FimoDate, FimoMedia, FimoBoolean, FimoRichText, FIMO_SOURCE, FIMO_PARTS, isFimoString, isFimoDate, hasFimoSource, getFimoSource, getFimoParts, } from '../primitives/lib/index.js';
29
- export { fimo } from '../primitives/lib/template.js';
30
- export { useFimoLiveValue } from '../primitives/lib/useFimoLiveValue.js';
31
- // Preview/editor bridge providers (postMessage-based, framework-free)
32
- export { DataSourcesProvider } from '../content/DataSourcesProvider.js';
33
- export { ConsoleErrorProvider } from '../iframe/ConsoleErrorProvider.js';
34
- export { ScreenshotProvider } from '../iframe/ScreenshotProvider.js';
35
- // Locale
36
- export { FimoLocaleProvider, useLocale } from '../i18n/FimoLocaleContext.js';
37
- export { getFimoDefaultLocale, getFimoLocales, getFimoTextDirection, localizeFimoPath, resolveFimoLocale, toHtmlLang, } from '../i18n/locale.js';
38
- // Config + routes
39
- export { getDisplayRoutes } from '../shared/display-routes.js';
@@ -1,16 +0,0 @@
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 FimoRemixLabels = WrappedLabels;
6
- export interface FimoRemixProvidersProps {
7
- config: FimoConfig;
8
- labels?: FimoRemixLabels;
9
- media?: Record<string, WrappedMediaEntry>;
10
- richText?: Record<string, WrappedRichTextEntry>;
11
- locale?: string;
12
- children?: React.ReactNode;
13
- }
14
- /** Fimo providers for wrapped Remix apps — mount once in app/root.tsx. */
15
- export declare function FimoRemixProviders(props: FimoRemixProvidersProps): import("react/jsx-runtime").JSX.Element;
16
- //# sourceMappingURL=FimoRemixProviders.d.ts.map
@@ -1,12 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useLocation, useNavigate } from '@remix-run/react';
4
- import { useMemo } from 'react';
5
- import { WrappedProviders } from '../wrapped/WrappedProviders.js';
6
- /** Fimo providers for wrapped Remix apps — mount once in app/root.tsx. */
7
- export function FimoRemixProviders(props) {
8
- const location = useLocation();
9
- const navigate = useNavigate();
10
- const navigation = useMemo(() => ({ pathname: location.pathname, navigate: (to) => navigate(to) }), [location.pathname, navigate]);
11
- return _jsx(WrappedProviders, { ...props, navigation: navigation });
12
- }
@@ -1,10 +0,0 @@
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 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 FimoRemixScripts(): import("react/jsx-runtime").JSX.Element | null;
10
- //# sourceMappingURL=FimoRemixScripts.d.ts.map
@@ -1,19 +0,0 @@
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 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 FimoRemixScripts() {
11
- if (process.env.NODE_ENV !== 'development') {
12
- return null;
13
- }
14
- const previewScriptUrl = process.env.FIMO_PREVIEW_SCRIPT_URL;
15
- if (!previewScriptUrl) {
16
- return null;
17
- }
18
- return _jsx("script", { type: "module", src: previewScriptUrl });
19
- }
@@ -1,12 +0,0 @@
1
- export { FimoRemixProviders } from './FimoRemixProviders.js';
2
- export type { FimoRemixLabels, FimoRemixProvidersProps } from './FimoRemixProviders.js';
3
- export { FimoRemixScripts } from './FimoRemixScripts.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 } from '../primitives/labels-hook.js';
12
- //# sourceMappingURL=index.d.ts.map
@@ -1,11 +0,0 @@
1
- // fimo/remix — the Remix adapter. Framework-neutral pieces live in
2
- // ../wrapped and are re-exported; this module only adds the Remix wiring.
3
- export { FimoRemixProviders } from './FimoRemixProviders.js';
4
- export { FimoRemixScripts } from './FimoRemixScripts.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
- export { useLabels } from '../primitives/labels-hook.js';
@@ -1,2 +0,0 @@
1
- export * from '../wrapped/server.js';
2
- //# sourceMappingURL=server.d.ts.map
@@ -1,2 +0,0 @@
1
- // fimo/remix/server — same framework-neutral loaders as every adapter.
2
- export * from '../wrapped/server.js';
@@ -1,14 +0,0 @@
1
- import type { FimoConfig } from './fimo-config.types.js';
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
- }
13
- export declare function getDisplayRoutes(config: Pick<FimoConfig, 'routes'> | undefined): DisplayRoute[];
14
- //# sourceMappingURL=display-routes.d.ts.map