fimo 0.20.0 → 0.21.0-experimental.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/assets/agent-templates/_default/GOAL.md +10 -0
- package/assets/agent-templates/_default/capabilities.yaml +10 -0
- package/assets/content-templates/shared/types.eta +1 -1
- package/assets/skills/fimo-cli/SKILL.md +2 -1
- package/assets/skills/fimo-cli/references/agents.md +136 -36
- package/assets/skills/fimo-cli/references/branches.md +8 -5
- package/assets/skills/fimo-cli/references/deploy.md +11 -2
- package/assets/skills/fimo-cli/references/domains.md +12 -0
- package/assets/skills/fimo-cli/references/forms.md +1 -1
- package/assets/skills/fimo-cli/references/init.md +9 -2
- package/assets/skills/fimo-cli/references/locales.md +1 -1
- package/assets/skills/fimo-cli/references/mcp.md +1 -1
- package/assets/skills/fimo-cli/references/media.md +18 -1
- package/assets/skills/fimo-cli/references/project-vars-and-secrets.md +3 -1
- package/assets/skills/fimo-cli/references/projects.md +7 -7
- package/assets/skills/fimo-code/assets/react-router-locales/navigation.tsx +1 -1
- package/assets/skills/fimo-code/references/assets.md +2 -2
- package/assets/skills/fimo-code/references/best-practices/next.md +1 -1
- package/assets/skills/fimo-code/references/content/schema.md +23 -0
- package/assets/skills/fimo-code/references/forms.md +1 -1
- package/assets/skills/fimo-code/references/frameworks/astro.md +8 -2
- package/assets/skills/fimo-code/references/frameworks/compatibility.md +9 -9
- package/assets/skills/fimo-code/references/frameworks/hosting.md +17 -13
- package/assets/skills/fimo-code/references/frameworks/next/app-router.md +8 -9
- package/assets/skills/fimo-code/references/frameworks/next/locales.md +5 -5
- package/assets/skills/fimo-code/references/frameworks/next/pages-router.md +5 -5
- package/assets/skills/fimo-code/references/frameworks/next.md +41 -32
- package/assets/skills/fimo-code/references/frameworks/react-router.md +10 -7
- package/assets/skills/fimo-code/references/frameworks/sveltekit.md +22 -15
- package/assets/skills/fimo-code/references/frameworks/vite-react.md +7 -5
- package/assets/skills/fimo-code/references/labels.md +4 -4
- package/assets/skills/fimo-code/references/locales.md +2 -2
- package/assets/skills/fimo-code/references/ui.md +4 -4
- package/assets/skills/fimo-migration/SKILL.md +51 -30
- package/assets/skills/fimo-migration/references/frameworks/nextjs.md +12 -15
- package/assets/skills/fimo-migration/references/media.md +12 -8
- package/assets/skills/fimo-migration/references/qa.md +12 -11
- package/assets/skills/fimo-migration/references/workers/content-planner.md +33 -4
- package/assets/skills/fimo-migration/references/workers/validator.md +10 -0
- package/assets/skills/fimo-migration/references/workers.md +19 -10
- package/assets/skills/fimo-migration/references/workflow.md +29 -11
- package/assets/skills/fimo-studio/references/ai-chat.md +1 -1
- package/assets/skills/fimo-studio/references/billing-and-credits.md +18 -1
- package/assets/skills/fimo-studio/references/cms.md +2 -0
- package/assets/skills/fimo-studio/references/preview-and-responsive.md +1 -0
- package/assets/starters/fimo-site/template/src/pages/Contact.tsx +1 -1
- package/assets/starters/fimo-site/template/src/pages/SiteContent.tsx +1 -1
- package/assets/starters/fimo-site/template/src/schemas/HomePage.ts +3 -3
- package/assets/starters/fimo-site/template/src/schemas/HomePage.types.ts +1 -1
- package/dist/build/astro/config.d.ts +13 -2
- package/dist/build/astro/config.js +9 -24
- package/dist/build/next/moved.d.ts +2 -0
- package/dist/build/next/moved.js +2 -0
- package/dist/build/react/router-moved.d.ts +2 -0
- package/dist/build/react/router-moved.js +2 -0
- package/dist/build/react/router-preset-moved.d.ts +2 -0
- package/dist/build/react/router-preset-moved.js +2 -0
- package/dist/build/react/router-routes-moved.d.ts +2 -0
- package/dist/build/react/router-routes-moved.js +2 -0
- package/dist/build/react/ui-moved.d.ts +2 -0
- package/dist/build/react/ui-moved.js +2 -0
- package/dist/build/react/vite-moved.d.ts +2 -0
- package/dist/build/react/vite-moved.js +2 -0
- package/dist/build/sveltekit/config.d.ts +5 -4
- package/dist/build/sveltekit/config.js +6 -15
- package/dist/build/sveltekit/moved.d.ts +13 -0
- package/dist/build/sveltekit/moved.js +3 -0
- package/dist/build/vite/data-id.d.ts +11 -0
- package/dist/build/vite/data-id.js +20 -0
- package/dist/build/vite/plugins/runtime-env.d.ts +1 -1
- package/dist/build/vite/plugins/runtime-env.js +6 -2
- package/dist/build/vite/runtime-env.d.ts +2 -0
- package/dist/build/vite/runtime-env.js +1 -0
- package/dist/cli/bundle.json +1 -1
- package/dist/cli/index.js +115 -110
- package/dist/runtime/content/client/internal.js +1 -1
- package/dist/runtime/content/index.d.ts +6 -1
- package/dist/runtime/content/index.js +6 -0
- package/dist/runtime/i18n/index.d.ts +2 -0
- package/dist/runtime/i18n/index.js +1 -0
- package/dist/runtime/labels/index.d.ts +3 -0
- package/dist/runtime/labels/index.js +2 -0
- package/dist/runtime/preview/index.d.ts +5 -0
- package/dist/runtime/preview/index.js +4 -0
- package/dist/runtime/preview/script.d.ts +3 -0
- package/dist/runtime/preview/script.js +14 -0
- package/dist/runtime/primitives/lib/index.d.ts +2 -0
- package/dist/runtime/primitives/lib/index.js +2 -0
- package/dist/runtime/seo/index.d.ts +0 -8
- package/dist/runtime/seo/index.js +0 -8
- package/dist/runtime/shared/config.d.ts +6 -0
- package/dist/runtime/shared/config.js +4 -0
- package/dist/runtime/shared/local-runtime-env.d.ts +2 -2
- package/dist/runtime/shared/local-runtime-env.js +7 -5
- package/dist/runtime/templates.d.ts +20 -4
- package/dist/runtime/templates.js +60 -18
- package/dist/scripts/extract-translations.js +8 -3
- package/dist/scripts/index.d.ts +3 -0
- package/dist/scripts/index.js +2 -0
- package/dist/scripts/sync-forms.js +21 -9
- package/dist/scripts/sync-schemas.js +129 -21
- package/dist/scripts/validate-schemas.js +63 -2
- package/package.json +72 -71
- package/release.json +2 -2
- package/templates/astro/AGENTS.md +1 -1
- package/templates/astro/astro.config.mjs +1 -1
- package/templates/astro/package.json +4 -2
- package/templates/astro/pnpm-workspace.yaml +6 -2
- package/templates/nextjs/.fimo/config.json +1 -2
- package/templates/nextjs/AGENTS.md +6 -16
- package/templates/nextjs/next.config.ts +4 -2
- package/templates/nextjs/package.json +4 -2
- package/templates/nextjs/pnpm-workspace.yaml +6 -2
- package/templates/nextjs/src/app/layout.tsx +16 -0
- package/templates/nextjs/src/locales.ts +3 -6
- package/templates/react-router/AGENTS.md +1 -1
- package/templates/react-router/package.json +5 -2
- package/templates/react-router/pnpm-workspace.yaml +6 -6
- package/templates/react-router/react-router.config.ts +1 -1
- package/templates/react-router/src/pages/legal/LegalPage.tsx +1 -1
- package/templates/react-router/src/root.tsx +1 -1
- package/templates/react-router/src/vite-env.d.ts +0 -1
- package/templates/react-router/vite.config.ts +1 -1
- package/templates/sveltekit/AGENTS.md +1 -1
- package/templates/sveltekit/package.json +4 -2
- package/templates/sveltekit/pnpm-workspace.yaml +6 -2
- package/templates/sveltekit/src/routes/+layout.server.ts +1 -1
- package/templates/sveltekit/src/routes/+layout.svelte +1 -1
- package/templates/sveltekit/svelte.config.js +1 -1
- package/templates/sveltekit/vite.config.ts +1 -1
- package/assets/sveltekit/components/Boolean.svelte +0 -19
- package/assets/sveltekit/components/Date.svelte +0 -33
- package/assets/sveltekit/components/DateTime.svelte +0 -35
- package/assets/sveltekit/components/FimoProvider.svelte +0 -35
- package/assets/sveltekit/components/Image.svelte +0 -80
- package/assets/sveltekit/components/Json.svelte +0 -18
- package/assets/sveltekit/components/Label.svelte +0 -16
- package/assets/sveltekit/components/Number.svelte +0 -21
- package/assets/sveltekit/components/RichText.svelte +0 -19
- package/assets/sveltekit/components/Text.svelte +0 -30
- package/assets/sveltekit/components/Video.svelte +0 -37
- package/assets/sveltekit/components/index.d.ts +0 -11
- package/assets/sveltekit/components/index.js +0 -11
- package/dist/build/next/config.d.ts +0 -17
- package/dist/build/next/config.js +0 -66
- package/dist/build/sveltekit/data-id.d.ts +0 -3
- package/dist/build/sveltekit/data-id.js +0 -171
- package/dist/build/sveltekit/files/edge.js +0 -68
- package/dist/build/sveltekit/files/serverless.js +0 -42
- package/dist/build/sveltekit/vite.d.ts +0 -12
- package/dist/build/sveltekit/vite.js +0 -14
- package/dist/build/vite/index.d.ts +0 -42
- package/dist/build/vite/index.js +0 -160
- package/dist/build/vite/plugins/content-sync.d.ts +0 -11
- package/dist/build/vite/plugins/content-sync.js +0 -41
- package/dist/build/vite/plugins/data-id.d.ts +0 -12
- package/dist/build/vite/plugins/data-id.js +0 -109
- package/dist/build/vite/plugins/fimo-config.d.ts +0 -12
- package/dist/build/vite/plugins/fimo-config.js +0 -68
- package/dist/build/vite/plugins/overlay.d.ts +0 -3
- package/dist/build/vite/plugins/overlay.js +0 -154
- package/dist/build/vite/plugins/robots.d.ts +0 -10
- package/dist/build/vite/plugins/robots.js +0 -56
- package/dist/build/vite/plugins/seo.d.ts +0 -3
- package/dist/build/vite/plugins/seo.js +0 -112
- package/dist/build/vite/plugins/server-config.d.ts +0 -3
- package/dist/build/vite/plugins/server-config.js +0 -36
- package/dist/build/vite/plugins/sitemap.d.ts +0 -3
- package/dist/build/vite/plugins/sitemap.js +0 -73
- package/dist/build/vite/plugins/translations.d.ts +0 -11
- package/dist/build/vite/plugins/translations.js +0 -601
- package/dist/runtime/app/FimoProviders.d.ts +0 -30
- package/dist/runtime/app/FimoProviders.js +0 -186
- package/dist/runtime/app/FimoScripts.d.ts +0 -14
- package/dist/runtime/app/FimoScripts.js +0 -48
- package/dist/runtime/app/index.d.ts +0 -8
- package/dist/runtime/app/index.js +0 -4
- package/dist/runtime/app/prefetch.d.ts +0 -9
- package/dist/runtime/app/prefetch.js +0 -39
- package/dist/runtime/content/DataSourcesProvider.d.ts +0 -4
- package/dist/runtime/content/DataSourcesProvider.js +0 -63
- package/dist/runtime/content/RefreshContentProvider.d.ts +0 -19
- package/dist/runtime/content/RefreshContentProvider.js +0 -71
- package/dist/runtime/content/client/createContentClient.d.ts +0 -7
- package/dist/runtime/content/client/createContentClient.js +0 -7
- package/dist/runtime/content/client/createSingletonClient.d.ts +0 -5
- package/dist/runtime/content/client/createSingletonClient.js +0 -6
- package/dist/runtime/content/client/react-content-client.d.ts +0 -10
- package/dist/runtime/content/client/react-content-client.js +0 -165
- package/dist/runtime/content/client/react-singleton-client.d.ts +0 -7
- package/dist/runtime/content/client/react-singleton-client.js +0 -38
- package/dist/runtime/content/client/types.d.ts +0 -42
- package/dist/runtime/content/client/types.js +0 -1
- package/dist/runtime/content/client/useQueryLocale.d.ts +0 -2
- package/dist/runtime/content/client/useQueryLocale.js +0 -5
- package/dist/runtime/content/client/vite-runtime.d.ts +0 -3
- package/dist/runtime/content/client/vite-runtime.js +0 -23
- package/dist/runtime/content/utils/retrieve-data-sources.d.ts +0 -29
- package/dist/runtime/content/utils/retrieve-data-sources.js +0 -107
- package/dist/runtime/core/AppErrorBoundary.d.ts +0 -10
- package/dist/runtime/core/AppErrorBoundary.js +0 -27
- package/dist/runtime/core/ViteLifecycles.d.ts +0 -5
- package/dist/runtime/core/ViteLifecycles.js +0 -35
- package/dist/runtime/i18n/FimoLocaleContext.d.ts +0 -9
- package/dist/runtime/i18n/FimoLocaleContext.js +0 -17
- package/dist/runtime/iframe/ConsoleErrorProvider.d.ts +0 -3
- package/dist/runtime/iframe/ConsoleErrorProvider.js +0 -103
- package/dist/runtime/iframe/ScreenshotProvider.d.ts +0 -3
- package/dist/runtime/iframe/ScreenshotProvider.js +0 -60
- package/dist/runtime/iframe/runtime/overlay-hmr.d.ts +0 -2
- package/dist/runtime/iframe/runtime/overlay-hmr.js +0 -27
- package/dist/runtime/iframe/runtime/overlay-runtime.d.ts +0 -2
- package/dist/runtime/iframe/runtime/overlay-runtime.js +0 -103
- package/dist/runtime/index.d.ts +0 -22
- package/dist/runtime/index.js +0 -23
- package/dist/runtime/next/client-runtime.d.ts +0 -3
- package/dist/runtime/next/client-runtime.js +0 -24
- package/dist/runtime/next/client.d.ts +0 -28
- package/dist/runtime/next/client.js +0 -25
- package/dist/runtime/next/facade.d.ts +0 -8
- package/dist/runtime/next/facade.js +0 -34
- package/dist/runtime/next/labels.d.ts +0 -7
- package/dist/runtime/next/labels.js +0 -9
- package/dist/runtime/next/preview.d.ts +0 -13
- package/dist/runtime/next/preview.js +0 -34
- package/dist/runtime/next/primitives/Text.d.ts +0 -10
- package/dist/runtime/next/primitives/Text.js +0 -18
- package/dist/runtime/next/primitives/server.d.ts +0 -11
- package/dist/runtime/next/primitives/server.js +0 -54
- package/dist/runtime/next/provider.d.ts +0 -18
- package/dist/runtime/next/provider.js +0 -39
- package/dist/runtime/next/server-runtime.d.ts +0 -3
- package/dist/runtime/next/server-runtime.js +0 -23
- package/dist/runtime/next/server.d.ts +0 -21
- package/dist/runtime/next/server.js +0 -16
- package/dist/runtime/primitives/index.d.ts +0 -16
- package/dist/runtime/primitives/index.js +0 -17
- package/dist/runtime/react/primitives/contracts.d.ts +0 -94
- package/dist/runtime/react/primitives/contracts.js +0 -1
- package/dist/runtime/react/primitives/editable/Boolean.d.ts +0 -5
- package/dist/runtime/react/primitives/editable/Boolean.js +0 -11
- package/dist/runtime/react/primitives/editable/Date.d.ts +0 -4
- package/dist/runtime/react/primitives/editable/Date.js +0 -12
- package/dist/runtime/react/primitives/editable/DateTime.d.ts +0 -4
- package/dist/runtime/react/primitives/editable/DateTime.js +0 -13
- package/dist/runtime/react/primitives/editable/Image.d.ts +0 -4
- package/dist/runtime/react/primitives/editable/Image.js +0 -10
- package/dist/runtime/react/primitives/editable/Json.d.ts +0 -5
- package/dist/runtime/react/primitives/editable/Json.js +0 -11
- package/dist/runtime/react/primitives/editable/RichText.d.ts +0 -4
- package/dist/runtime/react/primitives/editable/RichText.js +0 -11
- package/dist/runtime/react/primitives/editable/Text.d.ts +0 -20
- package/dist/runtime/react/primitives/editable/Text.js +0 -36
- package/dist/runtime/react/primitives/editable/Video.d.ts +0 -4
- package/dist/runtime/react/primitives/editable/Video.js +0 -10
- package/dist/runtime/react/primitives/renderers/DateRenderer.d.ts +0 -17
- package/dist/runtime/react/primitives/renderers/DateRenderer.js +0 -17
- package/dist/runtime/react/primitives/renderers/ImageRenderer.d.ts +0 -8
- package/dist/runtime/react/primitives/renderers/ImageRenderer.js +0 -31
- package/dist/runtime/react/primitives/renderers/RichTextRenderer.d.ts +0 -12
- package/dist/runtime/react/primitives/renderers/RichTextRenderer.js +0 -135
- package/dist/runtime/react/primitives/renderers/StaticImage.d.ts +0 -35
- package/dist/runtime/react/primitives/renderers/StaticImage.js +0 -58
- package/dist/runtime/react/primitives/renderers/VideoRenderer.d.ts +0 -8
- package/dist/runtime/react/primitives/renderers/VideoRenderer.js +0 -10
- package/dist/runtime/react/useFimoLiveValue.d.ts +0 -20
- package/dist/runtime/react/useFimoLiveValue.js +0 -43
- package/dist/runtime/react-router/active-routes.d.ts +0 -12
- package/dist/runtime/react-router/active-routes.js +0 -60
- package/dist/runtime/react-router/index.d.ts +0 -16
- package/dist/runtime/react-router/index.js +0 -20
- package/dist/runtime/react-router/legacy/routes.d.ts +0 -35
- package/dist/runtime/react-router/legacy/routes.js +0 -86
- package/dist/runtime/react-router/navigation-utils.d.ts +0 -8
- package/dist/runtime/react-router/navigation-utils.js +0 -36
- package/dist/runtime/react-router/navigation.d.ts +0 -12
- package/dist/runtime/react-router/navigation.js +0 -28
- package/dist/runtime/react-router/preset.d.ts +0 -30
- package/dist/runtime/react-router/preset.js +0 -33
- package/dist/runtime/routing/AppResetScrollOnNavigate.d.ts +0 -2
- package/dist/runtime/routing/AppResetScrollOnNavigate.js +0 -12
- package/dist/runtime/routing/AppRoutesProvider.d.ts +0 -25
- package/dist/runtime/routing/AppRoutesProvider.js +0 -112
- package/dist/runtime/seo/buildSeoForPath.d.ts +0 -74
- package/dist/runtime/seo/buildSeoForPath.js +0 -55
- package/dist/runtime/seo/htmlProps.d.ts +0 -13
- package/dist/runtime/seo/htmlProps.js +0 -15
- package/dist/runtime/sveltekit/content.d.ts +0 -25
- package/dist/runtime/sveltekit/content.js +0 -33
- package/dist/runtime/sveltekit/context-contract.d.ts +0 -5
- package/dist/runtime/sveltekit/context-contract.js +0 -2
- package/dist/runtime/sveltekit/context.d.ts +0 -8
- package/dist/runtime/sveltekit/context.js +0 -25
- package/dist/runtime/sveltekit/forms.d.ts +0 -15
- package/dist/runtime/sveltekit/forms.js +0 -15
- package/dist/runtime/sveltekit/index.d.ts +0 -9
- package/dist/runtime/sveltekit/index.js +0 -5
- package/dist/runtime/sveltekit/internal.d.ts +0 -6
- package/dist/runtime/sveltekit/internal.js +0 -12
- package/dist/runtime/sveltekit/labels.d.ts +0 -20
- package/dist/runtime/sveltekit/labels.js +0 -13
- package/dist/runtime/sveltekit/preview.d.ts +0 -28
- package/dist/runtime/sveltekit/preview.js +0 -82
- package/dist/runtime/sveltekit/runtime.d.ts +0 -9
- package/dist/runtime/sveltekit/runtime.js +0 -26
- package/dist/runtime/t/OptionalTracking.d.ts +0 -13
- package/dist/runtime/t/OptionalTracking.js +0 -28
- package/dist/runtime/t/Pageview.d.ts +0 -9
- package/dist/runtime/t/Pageview.js +0 -118
- package/dist/runtime/vite/Label.d.ts +0 -13
- package/dist/runtime/vite/Label.js +0 -16
- package/dist/runtime/vite/primitives/Images.d.ts +0 -4
- package/dist/runtime/vite/primitives/Images.js +0 -12
- package/dist/runtime/vite/translations.d.ts +0 -28
- package/dist/runtime/vite/translations.js +0 -103
- package/templates/nextjs/src/app/(default)/layout.tsx +0 -10
- package/templates/nextjs/src/app/[locale]/layout.tsx +0 -22
- package/templates/nextjs/src/app/[locale]/page.tsx +0 -1
- package/templates/nextjs/src/components/Document.tsx +0 -26
- package/templates/nextjs/src/components/FimoPreviewBridge.tsx +0 -13
- /package/templates/nextjs/src/app/{(default)/page.tsx → page.tsx} +0 -0
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
3
|
-
const defaultLoadPageview = () => import('./Pageview.js');
|
|
4
|
-
export async function loadPageviewComponent(loadPageview = defaultLoadPageview) {
|
|
5
|
-
try {
|
|
6
|
-
return (await loadPageview()).Pageview;
|
|
7
|
-
}
|
|
8
|
-
catch {
|
|
9
|
-
return null;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
export function OptionalTracking({ routes }) {
|
|
13
|
-
const [PageviewComponent, setPageviewComponent] = useState(null);
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
let cancelled = false;
|
|
16
|
-
loadPageviewComponent()
|
|
17
|
-
.then((component) => {
|
|
18
|
-
if (!cancelled) {
|
|
19
|
-
setPageviewComponent(() => component);
|
|
20
|
-
}
|
|
21
|
-
})
|
|
22
|
-
.catch(() => { });
|
|
23
|
-
return () => {
|
|
24
|
-
cancelled = true;
|
|
25
|
-
};
|
|
26
|
-
}, []);
|
|
27
|
-
return PageviewComponent ? _jsx(PageviewComponent, { routes: routes }) : null;
|
|
28
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef } from 'react';
|
|
2
|
-
import { useLocation } from 'react-router';
|
|
3
|
-
const VISITOR_ID_STORAGE_KEY = 'fimo.analytics.visitor-id';
|
|
4
|
-
const SESSION_ID_STORAGE_KEY = 'fimo.analytics.session-id';
|
|
5
|
-
const viteEnv = import.meta.env;
|
|
6
|
-
const API_BASE_URL = viteEnv?.VITE_API_URL?.replace(/\/$/, '');
|
|
7
|
-
const ENABLE_ANALYTICS = (viteEnv?.VITE_ENABLE_ANALYTICS ?? '').toLowerCase() === 'true';
|
|
8
|
-
function isPreviewContext() {
|
|
9
|
-
if (typeof window === 'undefined') {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
const search = new URLSearchParams(window.location.search);
|
|
13
|
-
return search.has('bl_preview_token');
|
|
14
|
-
}
|
|
15
|
-
function createId() {
|
|
16
|
-
if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
|
|
17
|
-
return crypto.randomUUID();
|
|
18
|
-
}
|
|
19
|
-
return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
20
|
-
}
|
|
21
|
-
function readOrCreateStoredId(storage, key) {
|
|
22
|
-
const existing = storage.getItem(key);
|
|
23
|
-
if (existing && existing.length > 0) {
|
|
24
|
-
return existing;
|
|
25
|
-
}
|
|
26
|
-
const generated = createId();
|
|
27
|
-
storage.setItem(key, generated);
|
|
28
|
-
return generated;
|
|
29
|
-
}
|
|
30
|
-
function getVisitorId() {
|
|
31
|
-
if (typeof window === 'undefined') {
|
|
32
|
-
return createId();
|
|
33
|
-
}
|
|
34
|
-
try {
|
|
35
|
-
return readOrCreateStoredId(window.localStorage, VISITOR_ID_STORAGE_KEY);
|
|
36
|
-
}
|
|
37
|
-
catch {
|
|
38
|
-
return createId();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
function getSessionId() {
|
|
42
|
-
if (typeof window === 'undefined') {
|
|
43
|
-
return createId();
|
|
44
|
-
}
|
|
45
|
-
try {
|
|
46
|
-
return readOrCreateStoredId(window.sessionStorage, SESSION_ID_STORAGE_KEY);
|
|
47
|
-
}
|
|
48
|
-
catch {
|
|
49
|
-
return createId();
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
function normalizePath(path) {
|
|
53
|
-
const trimmed = path.trim();
|
|
54
|
-
if (!trimmed) {
|
|
55
|
-
return '/';
|
|
56
|
-
}
|
|
57
|
-
if (trimmed === '/') {
|
|
58
|
-
return '/';
|
|
59
|
-
}
|
|
60
|
-
return trimmed.replace(/\/+$/, '');
|
|
61
|
-
}
|
|
62
|
-
function findRouteName(pathname, routes) {
|
|
63
|
-
const currentPath = normalizePath(pathname);
|
|
64
|
-
const exactMatch = routes.find((route) => normalizePath(route.path) === currentPath);
|
|
65
|
-
if (exactMatch) {
|
|
66
|
-
return exactMatch.name;
|
|
67
|
-
}
|
|
68
|
-
const dynamicMatch = routes.find((route) => {
|
|
69
|
-
const normalizedPattern = normalizePath(route.path);
|
|
70
|
-
const regex = new RegExp(`^${normalizedPattern.replace(/:\w+/g, '[^/]+')}$`);
|
|
71
|
-
return regex.test(currentPath);
|
|
72
|
-
});
|
|
73
|
-
if (dynamicMatch) {
|
|
74
|
-
return dynamicMatch.name;
|
|
75
|
-
}
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
function sendPageview(path, pageName) {
|
|
79
|
-
if (typeof window === 'undefined' || !API_BASE_URL || !ENABLE_ANALYTICS || isPreviewContext()) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
const payload = new URLSearchParams({
|
|
83
|
-
p: path || '/',
|
|
84
|
-
n: pageName,
|
|
85
|
-
v: getVisitorId(),
|
|
86
|
-
s: getSessionId(),
|
|
87
|
-
});
|
|
88
|
-
if (document.referrer) {
|
|
89
|
-
payload.set('r', document.referrer);
|
|
90
|
-
}
|
|
91
|
-
if (navigator.userAgent) {
|
|
92
|
-
payload.set('u', navigator.userAgent);
|
|
93
|
-
}
|
|
94
|
-
void fetch(`${API_BASE_URL}/e/p`, {
|
|
95
|
-
method: 'POST',
|
|
96
|
-
body: payload,
|
|
97
|
-
keepalive: true,
|
|
98
|
-
mode: 'cors',
|
|
99
|
-
credentials: 'omit',
|
|
100
|
-
}).catch(() => {
|
|
101
|
-
// best-effort analytics
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
export function Pageview({ routes }) {
|
|
105
|
-
const location = useLocation();
|
|
106
|
-
const lastTrackedPath = useRef(null);
|
|
107
|
-
useEffect(() => {
|
|
108
|
-
const currentPath = `${location.pathname}${location.search}`;
|
|
109
|
-
const routeName = findRouteName(location.pathname, routes);
|
|
110
|
-
const currentPageName = routeName ?? normalizePath(location.pathname);
|
|
111
|
-
if (currentPath === lastTrackedPath.current) {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
lastTrackedPath.current = currentPath;
|
|
115
|
-
sendPageview(currentPath, currentPageName);
|
|
116
|
-
}, [location.pathname, location.search, routes]);
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ElementType } from 'react';
|
|
2
|
-
import type { LabelProps } from '../react/primitives/contracts.js';
|
|
3
|
-
export type { LabelProps } from '../react/primitives/contracts.js';
|
|
4
|
-
/**
|
|
5
|
-
* Render one editable label from the Vite/React Router label context.
|
|
6
|
-
*
|
|
7
|
-
* For attributes, metadata, and composed strings, use `useLabels().t()`.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* <Label value="hero.title" as="h1" />
|
|
11
|
-
*/
|
|
12
|
-
export declare function Label<T extends ElementType = 'span'>({ value, ...props }: LabelProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
//# sourceMappingURL=Label.d.ts.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Text } from '../react/primitives/editable/Text.js';
|
|
3
|
-
import { useLabels } from './translations.js';
|
|
4
|
-
/**
|
|
5
|
-
* Render one editable label from the Vite/React Router label context.
|
|
6
|
-
*
|
|
7
|
-
* For attributes, metadata, and composed strings, use `useLabels().t()`.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* <Label value="hero.title" as="h1" />
|
|
11
|
-
*/
|
|
12
|
-
export function Label({ value, ...props }) {
|
|
13
|
-
const { t } = useLabels();
|
|
14
|
-
const textProps = { ...props, value: t(value) };
|
|
15
|
-
return _jsx(Text, { ...textProps });
|
|
16
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ImageProps, StaticImageProps } from '../../react/primitives/contracts.js';
|
|
2
|
-
export declare function Image(props: ImageProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
-
export declare function StaticImage(props: StaticImageProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
//# sourceMappingURL=Images.d.ts.map
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { parseImageHostSuffixes } from '../../primitives/lib/image-optimization.js';
|
|
3
|
-
import { Image as BaseImage } from '../../react/primitives/editable/Image.js';
|
|
4
|
-
import { StaticImage as BaseStaticImage } from '../../react/primitives/renderers/StaticImage.js';
|
|
5
|
-
const viteEnvironment = import.meta.env;
|
|
6
|
-
const IMAGE_HOST_SUFFIXES = parseImageHostSuffixes(viteEnvironment?.VITE_FIMO_IMAGE_HOSTS);
|
|
7
|
-
export function Image(props) {
|
|
8
|
-
return _jsx(BaseImage, { ...props, hostSuffixes: IMAGE_HOST_SUFFIXES });
|
|
9
|
-
}
|
|
10
|
-
export function StaticImage(props) {
|
|
11
|
-
return _jsx(BaseStaticImage, { ...props, hostSuffixes: IMAGE_HOST_SUFFIXES });
|
|
12
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { FimoString } from '../primitives/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
|
-
* @example
|
|
9
|
-
* const { t } = useLabels();
|
|
10
|
-
*
|
|
11
|
-
* // With Text component (recommended)
|
|
12
|
-
* <Text value={t('welcome')} />
|
|
13
|
-
*
|
|
14
|
-
* // Escape hatch for attributes
|
|
15
|
-
* <input placeholder={String(t('email.placeholder'))} />
|
|
16
|
-
*/
|
|
17
|
-
export declare function useLabels(): {
|
|
18
|
-
t: (fullKey: string) => FimoString;
|
|
19
|
-
locale: string;
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Legacy alias for older projects. Prefer useLabels() in new code.
|
|
23
|
-
*/
|
|
24
|
-
export declare function useTranslations(): {
|
|
25
|
-
t: (fullKey: string) => FimoString;
|
|
26
|
-
locale: string;
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=translations.d.ts.map
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { useSyncExternalStore } from 'react';
|
|
2
|
-
import { defaultLocale as bundledDefaultLocale, dictionaries as bundledDictionaries, signature as translationSignature, updatedAt as bundledUpdatedAt, } from 'virtual:translations';
|
|
3
|
-
import { useLocale } from '../i18n/FimoLocaleContext.js';
|
|
4
|
-
import { FimoString } from '../primitives/lib/index.js';
|
|
5
|
-
const labelListeners = new Set();
|
|
6
|
-
let labelState = {
|
|
7
|
-
dictionaries: bundledDictionaries ?? {},
|
|
8
|
-
defaultLocale: bundledDefaultLocale || 'en',
|
|
9
|
-
signature: translationSignature,
|
|
10
|
-
updatedAt: bundledUpdatedAt ?? null,
|
|
11
|
-
};
|
|
12
|
-
function subscribeLabels(listener) {
|
|
13
|
-
labelListeners.add(listener);
|
|
14
|
-
return () => {
|
|
15
|
-
labelListeners.delete(listener);
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
function getLabelSnapshot() {
|
|
19
|
-
return labelState;
|
|
20
|
-
}
|
|
21
|
-
function setLabelState(next) {
|
|
22
|
-
if (next.signature === labelState.signature) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
labelState = next;
|
|
26
|
-
for (const listener of labelListeners) {
|
|
27
|
-
listener();
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
function isRecord(value) {
|
|
31
|
-
return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
32
|
-
}
|
|
33
|
-
function normalizeDictionaries(value) {
|
|
34
|
-
if (!isRecord(value)) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
const dictionaries = {};
|
|
38
|
-
for (const [locale, labels] of Object.entries(value)) {
|
|
39
|
-
if (!isRecord(labels)) {
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
dictionaries[locale] = Object.fromEntries(Object.entries(labels).filter((entry) => typeof entry[1] === 'string'));
|
|
43
|
-
}
|
|
44
|
-
return dictionaries;
|
|
45
|
-
}
|
|
46
|
-
function applyLabelUpdate(payload) {
|
|
47
|
-
if (!isRecord(payload)) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
const dictionaries = normalizeDictionaries(payload.dictionaries);
|
|
51
|
-
if (!dictionaries) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
const defaultLocale = typeof payload.defaultLocale === 'string' ? payload.defaultLocale : labelState.defaultLocale;
|
|
55
|
-
const signature = typeof payload.signature === 'string' ? payload.signature : JSON.stringify({ dictionaries, defaultLocale });
|
|
56
|
-
const updatedAt = typeof payload.updatedAt === 'string' ? payload.updatedAt : null;
|
|
57
|
-
setLabelState({ dictionaries, defaultLocale, signature, updatedAt });
|
|
58
|
-
}
|
|
59
|
-
// @ts-ignore - import.meta.hot is provided by Vite during development.
|
|
60
|
-
if (import.meta.hot) {
|
|
61
|
-
const onLabelsUpdated = (payload) => {
|
|
62
|
-
applyLabelUpdate(payload);
|
|
63
|
-
};
|
|
64
|
-
// @ts-ignore - import.meta.hot is provided by Vite during development.
|
|
65
|
-
import.meta.hot.on('fimo:labels-updated', onLabelsUpdated);
|
|
66
|
-
// @ts-ignore - import.meta.hot is provided by Vite during development.
|
|
67
|
-
import.meta.hot.dispose(() => {
|
|
68
|
-
// @ts-ignore - import.meta.hot is provided by Vite during development.
|
|
69
|
-
import.meta.hot.off('fimo:labels-updated', onLabelsUpdated);
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Hook to provide a label function (`t`).
|
|
74
|
-
*
|
|
75
|
-
* Returns FimoString with source tracking for inline editing.
|
|
76
|
-
* Use with <Text> component for rendering, or String() for escape hatch.
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* const { t } = useLabels();
|
|
80
|
-
*
|
|
81
|
-
* // With Text component (recommended)
|
|
82
|
-
* <Text value={t('welcome')} />
|
|
83
|
-
*
|
|
84
|
-
* // Escape hatch for attributes
|
|
85
|
-
* <input placeholder={String(t('email.placeholder'))} />
|
|
86
|
-
*/
|
|
87
|
-
export function useLabels() {
|
|
88
|
-
const localeContext = useLocale();
|
|
89
|
-
const labels = useSyncExternalStore(subscribeLabels, getLabelSnapshot, getLabelSnapshot);
|
|
90
|
-
const t = (fullKey) => {
|
|
91
|
-
const locale = localeContext.locale || labels.defaultLocale || 'en';
|
|
92
|
-
const dictionary = labels.dictionaries[locale] ?? labels.dictionaries[labels.defaultLocale] ?? {};
|
|
93
|
-
const text = dictionary[fullKey] ?? '';
|
|
94
|
-
return new FimoString(text, `__labels.${locale}.${fullKey}.value`);
|
|
95
|
-
};
|
|
96
|
-
return { t, locale: localeContext.locale };
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Legacy alias for older projects. Prefer useLabels() in new code.
|
|
100
|
-
*/
|
|
101
|
-
export function useTranslations() {
|
|
102
|
-
return useLabels();
|
|
103
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
import Document from '../../components/Document';
|
|
4
|
-
import { defaultLocale } from '../../locales';
|
|
5
|
-
|
|
6
|
-
import '../globals.css';
|
|
7
|
-
|
|
8
|
-
export default function DefaultLocaleLayout({ children }: Readonly<{ children: ReactNode }>) {
|
|
9
|
-
return <Document locale={defaultLocale}>{children}</Document>;
|
|
10
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { notFound } from 'next/navigation';
|
|
2
|
-
import type { ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
import Document from '../../components/Document';
|
|
5
|
-
import { prefixedLocales } from '../../locales';
|
|
6
|
-
|
|
7
|
-
import '../globals.css';
|
|
8
|
-
|
|
9
|
-
export default async function LocaleLayout({
|
|
10
|
-
children,
|
|
11
|
-
params,
|
|
12
|
-
}: Readonly<{ children: ReactNode; params: Promise<{ locale: string }> }>) {
|
|
13
|
-
const { locale } = await params;
|
|
14
|
-
|
|
15
|
-
// The default locale is served unprefixed by `app/(default)`, so its prefix
|
|
16
|
-
// is not a second URL for the same page.
|
|
17
|
-
if (!prefixedLocales.has(locale)) {
|
|
18
|
-
notFound();
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return <Document locale={locale}>{children}</Document>;
|
|
22
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from '../(default)/page';
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { FimoProvider } from 'fimo/next/client';
|
|
2
|
-
import type { ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
import FimoPreviewBridge from './FimoPreviewBridge';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* The HTML document for one locale tree. Only a root layout may render `<html>`
|
|
8
|
-
* in the App Router, so each locale tree has its own root layout and renders
|
|
9
|
-
* this with the locale that tree serves. That is what makes `<html lang>` and
|
|
10
|
-
* the Fimo locale context correct on both the unprefixed and prefixed routes.
|
|
11
|
-
*/
|
|
12
|
-
export default function Document({ children, locale }: Readonly<{ children: ReactNode; locale: string }>) {
|
|
13
|
-
const previewScriptUrl = process.env.NEXT_PUBLIC_FIMO_PREVIEW_SCRIPT_URL;
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<html lang={locale}>
|
|
17
|
-
<body>
|
|
18
|
-
<FimoProvider locale={locale}>
|
|
19
|
-
<FimoPreviewBridge />
|
|
20
|
-
{children}
|
|
21
|
-
</FimoProvider>
|
|
22
|
-
{previewScriptUrl ? <script src={previewScriptUrl} defer /> : null}
|
|
23
|
-
</body>
|
|
24
|
-
</html>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { FimoPreviewBridge as RuntimeFimoPreviewBridge } from 'fimo/next/client';
|
|
4
|
-
import { usePathname, useRouter } from 'next/navigation';
|
|
5
|
-
import { useCallback } from 'react';
|
|
6
|
-
|
|
7
|
-
export default function FimoPreviewBridge() {
|
|
8
|
-
const pathname = usePathname();
|
|
9
|
-
const router = useRouter();
|
|
10
|
-
const navigate = useCallback((to: string) => router.push(to), [router]);
|
|
11
|
-
|
|
12
|
-
return <RuntimeFimoPreviewBridge pathname={pathname} navigate={navigate} />;
|
|
13
|
-
}
|
|
File without changes
|