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,58 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { resolveImagePresentation } from '../../../primitives/lib/image-optimization.js';
|
|
3
|
-
/**
|
|
4
|
-
* Optimized image component for non-schema images.
|
|
5
|
-
*
|
|
6
|
-
* Use `StaticImage` for images that don't come from the database —
|
|
7
|
-
* decorative images, hardcoded URLs, generated assets, or any image
|
|
8
|
-
* where you have a direct URL string rather than a `FimoMedia` value
|
|
9
|
-
* from schema hooks.
|
|
10
|
-
*
|
|
11
|
-
* Provides the same Cloudflare Image Resizing optimization as `<Image>`
|
|
12
|
-
* (responsive srcset, quality, format=auto) but without requiring a
|
|
13
|
-
* `FimoMedia` instance or database source tracking.
|
|
14
|
-
*
|
|
15
|
-
* For schema-backed media, use `<Image value={post.cover} />` instead.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* // Basic usage
|
|
19
|
-
* <StaticImage src="/images/hero.jpg" alt="Hero background" width={1200} height={630} />
|
|
20
|
-
*
|
|
21
|
-
* // With Cloudflare optimization
|
|
22
|
-
* <StaticImage src="https://...fimo.site/uploads/photo.jpg" alt="Team" width={800} fit="cover" />
|
|
23
|
-
*
|
|
24
|
-
* // Responsive mode
|
|
25
|
-
* <StaticImage
|
|
26
|
-
* src="https://...fimo.site/uploads/banner.jpg"
|
|
27
|
-
* alt="Banner"
|
|
28
|
-
* sizes="(max-width: 768px) 100vw, 50vw"
|
|
29
|
-
* />
|
|
30
|
-
*
|
|
31
|
-
* // Skip optimization
|
|
32
|
-
* <StaticImage src="/images/logo.svg" alt="Logo" unoptimized />
|
|
33
|
-
*/
|
|
34
|
-
export function StaticImage(props) {
|
|
35
|
-
const { src, alt, quality, unoptimized = false, fit, width, height, srcSet: srcSetOverride, sizes, style, hostSuffixes, ...imgProps } = props;
|
|
36
|
-
if (!src) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
const image = resolveImagePresentation({
|
|
40
|
-
src,
|
|
41
|
-
alt,
|
|
42
|
-
quality,
|
|
43
|
-
fit,
|
|
44
|
-
unoptimized,
|
|
45
|
-
width,
|
|
46
|
-
height,
|
|
47
|
-
sizes,
|
|
48
|
-
srcSet: srcSetOverride,
|
|
49
|
-
hostSuffixes,
|
|
50
|
-
});
|
|
51
|
-
const finalStyle = style?.objectFit
|
|
52
|
-
? style
|
|
53
|
-
: {
|
|
54
|
-
...style,
|
|
55
|
-
objectFit: image.objectFit,
|
|
56
|
-
};
|
|
57
|
-
return (_jsx("img", { src: image.src, alt: image.alt, width: image.width, height: image.height, style: finalStyle, sizes: image.sizes, srcSet: image.srcSet, ...imgProps }));
|
|
58
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type RefObject } from 'react';
|
|
2
|
-
import type { VideoProps } from '../contracts.js';
|
|
3
|
-
interface VideoRendererProps extends VideoProps {
|
|
4
|
-
elementRef?: RefObject<HTMLElement | null>;
|
|
5
|
-
}
|
|
6
|
-
export declare function VideoRenderer({ value: media, children, overrideSrc, autoPlay, loop, muted, playsInline, style, elementRef, ...videoProps }: VideoRendererProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=VideoRenderer.d.ts.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { FIMO_SOURCE } from '../../../primitives/lib/primitives.js';
|
|
3
|
-
export function VideoRenderer({ value: media, children, overrideSrc, autoPlay = true, loop = true, muted = true, playsInline = true, style, elementRef, ...videoProps }) {
|
|
4
|
-
const mediaSource = media[FIMO_SOURCE];
|
|
5
|
-
if (children) {
|
|
6
|
-
return (_jsx("span", { ref: elementRef, "data-fimo-source": mediaSource, children: children(media) }));
|
|
7
|
-
}
|
|
8
|
-
const finalSrc = overrideSrc ?? media.url;
|
|
9
|
-
return (_jsx("video", { ref: elementRef, src: finalSrc, width: media.width, height: media.height, autoPlay: autoPlay, loop: loop, muted: muted, playsInline: playsInline, style: style, ...videoProps, "data-fimo-source": mediaSource }));
|
|
10
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { type RefObject } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* useFimoLiveValue — mirror a Fimo value into React state so live edits
|
|
4
|
-
* coming from the Fimo preview editor flow through reconciliation instead
|
|
5
|
-
* of mutating the DOM directly.
|
|
6
|
-
*
|
|
7
|
-
* In dev mode (editor): the hook subscribes to `fimo:live-edit` CustomEvents
|
|
8
|
-
* on the returned ref, tags the element with `data-fimo-live-edit` so the
|
|
9
|
-
* preview knows to dispatch events instead of falling back to raw DOM writes,
|
|
10
|
-
* and updates internal state when a mutation arrives.
|
|
11
|
-
*
|
|
12
|
-
* The hook is framework-adapter-neutral: Vite and Next.js clients render the
|
|
13
|
-
* same React primitives, and environments that never dispatch
|
|
14
|
-
* `fimo:live-edit` simply keep mirroring the external value.
|
|
15
|
-
*/
|
|
16
|
-
export declare function useFimoLiveValue<T, E extends HTMLElement = HTMLElement>(external: T): {
|
|
17
|
-
value: T;
|
|
18
|
-
ref: RefObject<E | null>;
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=useFimoLiveValue.d.ts.map
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef, useState } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* useFimoLiveValue — mirror a Fimo value into React state so live edits
|
|
4
|
-
* coming from the Fimo preview editor flow through reconciliation instead
|
|
5
|
-
* of mutating the DOM directly.
|
|
6
|
-
*
|
|
7
|
-
* In dev mode (editor): the hook subscribes to `fimo:live-edit` CustomEvents
|
|
8
|
-
* on the returned ref, tags the element with `data-fimo-live-edit` so the
|
|
9
|
-
* preview knows to dispatch events instead of falling back to raw DOM writes,
|
|
10
|
-
* and updates internal state when a mutation arrives.
|
|
11
|
-
*
|
|
12
|
-
* The hook is framework-adapter-neutral: Vite and Next.js clients render the
|
|
13
|
-
* same React primitives, and environments that never dispatch
|
|
14
|
-
* `fimo:live-edit` simply keep mirroring the external value.
|
|
15
|
-
*/
|
|
16
|
-
export function useFimoLiveValue(external) {
|
|
17
|
-
const ref = useRef(null);
|
|
18
|
-
const [value, setValue] = useState(external);
|
|
19
|
-
const externalRef = useRef(external);
|
|
20
|
-
if (externalRef.current !== external) {
|
|
21
|
-
externalRef.current = external;
|
|
22
|
-
setValue(external);
|
|
23
|
-
}
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
const el = ref.current;
|
|
26
|
-
if (!el) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
el.setAttribute('data-fimo-live-edit', '1');
|
|
30
|
-
const handler = (event) => {
|
|
31
|
-
const detail = event.detail;
|
|
32
|
-
if (detail !== undefined) {
|
|
33
|
-
setValue(detail);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
el.addEventListener('fimo:live-edit', handler);
|
|
37
|
-
return () => {
|
|
38
|
-
el.removeEventListener('fimo:live-edit', handler);
|
|
39
|
-
el.removeAttribute('data-fimo-live-edit');
|
|
40
|
-
};
|
|
41
|
-
}, []);
|
|
42
|
-
return { value, ref };
|
|
43
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface ActiveRouterRoute {
|
|
2
|
-
id: string;
|
|
3
|
-
path: string;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Flatten React Router's framework manifest into the route graph the active
|
|
7
|
-
* router actually loaded. This is intentionally separate from fimo-config:
|
|
8
|
-
* metadata describes what Studio expects, while this manifest describes what
|
|
9
|
-
* the iframe can render after its route modules have converged.
|
|
10
|
-
*/
|
|
11
|
-
export declare function getActiveRouterRoutes(manifest: unknown): ActiveRouterRoute[];
|
|
12
|
-
//# sourceMappingURL=active-routes.d.ts.map
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
const normalizeRoutePath = (path) => {
|
|
2
|
-
const withSlash = path.startsWith('/') ? path : `/${path}`;
|
|
3
|
-
const normalized = withSlash.replace(/\/{2,}/g, '/');
|
|
4
|
-
return normalized.length > 1 ? normalized.replace(/\/+$/, '') : normalized;
|
|
5
|
-
};
|
|
6
|
-
const joinRoutePath = (parentPath, childPath) => {
|
|
7
|
-
if (!childPath) {
|
|
8
|
-
return parentPath;
|
|
9
|
-
}
|
|
10
|
-
if (childPath.startsWith('/')) {
|
|
11
|
-
return normalizeRoutePath(childPath);
|
|
12
|
-
}
|
|
13
|
-
return normalizeRoutePath(`${parentPath}/${childPath}`);
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Flatten React Router's framework manifest into the route graph the active
|
|
17
|
-
* router actually loaded. This is intentionally separate from fimo-config:
|
|
18
|
-
* metadata describes what Studio expects, while this manifest describes what
|
|
19
|
-
* the iframe can render after its route modules have converged.
|
|
20
|
-
*/
|
|
21
|
-
export function getActiveRouterRoutes(manifest) {
|
|
22
|
-
const routeRecord = manifest?.routes;
|
|
23
|
-
if (!routeRecord) {
|
|
24
|
-
return [];
|
|
25
|
-
}
|
|
26
|
-
const entries = Object.values(routeRecord).filter(isActiveRouteManifestEntry);
|
|
27
|
-
const byId = new Map(entries.map((entry) => [entry.id, entry]));
|
|
28
|
-
const pathCache = new Map();
|
|
29
|
-
const resolvePath = (entry, resolving = new Set()) => {
|
|
30
|
-
const cached = pathCache.get(entry.id);
|
|
31
|
-
if (cached !== undefined) {
|
|
32
|
-
return cached;
|
|
33
|
-
}
|
|
34
|
-
if (resolving.has(entry.id)) {
|
|
35
|
-
return '';
|
|
36
|
-
}
|
|
37
|
-
const nextResolving = new Set(resolving).add(entry.id);
|
|
38
|
-
const parentPath = entry.parentId
|
|
39
|
-
? resolvePath(byId.get(entry.parentId) ?? { id: entry.parentId }, nextResolving)
|
|
40
|
-
: '';
|
|
41
|
-
const path = entry.index ? parentPath || '/' : joinRoutePath(parentPath, entry.path ?? '');
|
|
42
|
-
pathCache.set(entry.id, path);
|
|
43
|
-
return path;
|
|
44
|
-
};
|
|
45
|
-
return entries.flatMap((entry) => {
|
|
46
|
-
// A pathless/root layout is part of the framework manifest, but it is not
|
|
47
|
-
// a URL the router can navigate to. Treat only an explicit index route as
|
|
48
|
-
// the root path; including the layout would add a phantom `/` entry and
|
|
49
|
-
// make exact route-graph convergence impossible for apps without a home
|
|
50
|
-
// page.
|
|
51
|
-
if ((entry.path === undefined || entry.path === '') && !entry.index) {
|
|
52
|
-
return [];
|
|
53
|
-
}
|
|
54
|
-
const path = normalizeRoutePath(resolvePath(entry));
|
|
55
|
-
return [{ id: entry.id, path }];
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
function isActiveRouteManifestEntry(value) {
|
|
59
|
-
return Boolean(value && typeof value === 'object' && typeof value.id === 'string');
|
|
60
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export { FimoProviders } from '../app/FimoProviders.js';
|
|
2
|
-
export { FimoScripts } from '../app/FimoScripts.js';
|
|
3
|
-
export { useLocale } from '../i18n/FimoLocaleContext.js';
|
|
4
|
-
export { localizeFimoPath, resolveFimoLocale } from '../i18n/locale.js';
|
|
5
|
-
export { FimoLink, useFimoHref, useFimoNavigate } from './navigation.js';
|
|
6
|
-
export { formClient } from '../index.js';
|
|
7
|
-
export { localizeFimoTo } from './navigation-utils.js';
|
|
8
|
-
export type { DisplayRoute, FimoProvidersProps, ParamInfo } from '../app/FimoProviders.js';
|
|
9
|
-
export type { FimoLocaleContextValue } from '../i18n/FimoLocaleContext.js';
|
|
10
|
-
export type { FimoLocaleResolution } from '../i18n/locale.js';
|
|
11
|
-
export type { FimoLinkProps, FimoNavigationOptions } from './navigation.js';
|
|
12
|
-
export { loadFimoMetaData } from '../seo/index.js';
|
|
13
|
-
export * from '../seo/buildSeoForPath.js';
|
|
14
|
-
export * from '../seo/htmlProps.js';
|
|
15
|
-
export * from '../seo/resolver.js';
|
|
16
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// `fimo/react-router` — React Router adapter surface.
|
|
2
|
-
//
|
|
3
|
-
// Re-exports the runtime providers, scripts, and SEO helpers that a React
|
|
4
|
-
// Router framework-mode app needs to wire up Fimo. The underlying source
|
|
5
|
-
// still lives under `runtime/app/` and `runtime/seo/`; this is the
|
|
6
|
-
// public-facing barrel.
|
|
7
|
-
//
|
|
8
|
-
// As we add per-framework adapters (`fimo/next`, `fimo/astro`, ...), each
|
|
9
|
-
// will expose the same provider/scripts surface from its own subpath.
|
|
10
|
-
export { FimoProviders } from '../app/FimoProviders.js';
|
|
11
|
-
export { FimoScripts } from '../app/FimoScripts.js';
|
|
12
|
-
export { useLocale } from '../i18n/FimoLocaleContext.js';
|
|
13
|
-
export { localizeFimoPath, resolveFimoLocale } from '../i18n/locale.js';
|
|
14
|
-
export { FimoLink, useFimoHref, useFimoNavigate } from './navigation.js';
|
|
15
|
-
export { formClient } from '../index.js';
|
|
16
|
-
export { localizeFimoTo } from './navigation-utils.js';
|
|
17
|
-
export { loadFimoMetaData } from '../seo/index.js';
|
|
18
|
-
export * from '../seo/buildSeoForPath.js';
|
|
19
|
-
export * from '../seo/htmlProps.js';
|
|
20
|
-
export * from '../seo/resolver.js';
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { FimoConfig } from '../../shared/fimo-config.types.js';
|
|
2
|
-
export interface FimoReactRouterRoute {
|
|
3
|
-
id?: string;
|
|
4
|
-
path?: string;
|
|
5
|
-
file?: string;
|
|
6
|
-
index?: boolean;
|
|
7
|
-
children?: FimoReactRouterRoute[];
|
|
8
|
-
[key: string]: unknown;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Structural minimum a route entry must satisfy. Deliberately WITHOUT an
|
|
12
|
-
* index signature so framework types like React Router's `RouteConfigEntry`
|
|
13
|
-
* (which has none) remain assignable, and generic so callers get their own
|
|
14
|
-
* entry type back — `fimoRoutes(routes) satisfies RouteConfig` must keep
|
|
15
|
-
* compiling in project code.
|
|
16
|
-
*/
|
|
17
|
-
interface FimoRouteShape {
|
|
18
|
-
id?: string;
|
|
19
|
-
path?: string;
|
|
20
|
-
file?: string;
|
|
21
|
-
index?: boolean;
|
|
22
|
-
children?: FimoRouteShape[];
|
|
23
|
-
}
|
|
24
|
-
export interface FimoRoutesOptions {
|
|
25
|
-
config?: Pick<FimoConfig, 'i18n'>;
|
|
26
|
-
rootDir?: string;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* @deprecated New React Router projects should declare optional `:locale?`
|
|
30
|
-
* segments directly. This compatibility adapter may be removed in a future
|
|
31
|
-
* breaking release.
|
|
32
|
-
*/
|
|
33
|
-
export declare function fimoRoutes<T extends FimoRouteShape>(routes: readonly T[], options?: FimoRoutesOptions): T[];
|
|
34
|
-
export {};
|
|
35
|
-
//# sourceMappingURL=routes.d.ts.map
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { getFimoDefaultLocale, getFimoLocales } from '../../i18n/locale.js';
|
|
2
|
-
import { hasLocaleSegment } from '../../routes/index.js';
|
|
3
|
-
import { getConfigServer } from '../../shared/fimo-config.server.js';
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated New React Router projects should declare optional `:locale?`
|
|
6
|
-
* segments directly. This compatibility adapter may be removed in a future
|
|
7
|
-
* breaking release.
|
|
8
|
-
*/
|
|
9
|
-
export function fimoRoutes(routes, options = {}) {
|
|
10
|
-
const config = options.config ?? getConfigServer(options.rootDir ?? process.cwd());
|
|
11
|
-
const strategy = config.i18n?.routing?.strategy ?? 'path-prefix';
|
|
12
|
-
if (strategy !== 'path-prefix') {
|
|
13
|
-
return [...routes];
|
|
14
|
-
}
|
|
15
|
-
const defaultLocale = getFimoDefaultLocale(config);
|
|
16
|
-
// The default locale renders at the canonical unprefixed path, so it never
|
|
17
|
-
// gets an alias.
|
|
18
|
-
const prefixedLocales = getFimoLocales(config).filter((locale) => locale !== defaultLocale);
|
|
19
|
-
// A route that declares its own `:locale` segment already carries the locale
|
|
20
|
-
// in its path; prefixing it again would produce `/es/:locale/...`.
|
|
21
|
-
const aliasable = routes.filter((route) => !declaresLocaleSegment(route));
|
|
22
|
-
if (prefixedLocales.length === 0 || aliasable.length === 0) {
|
|
23
|
-
return [...routes];
|
|
24
|
-
}
|
|
25
|
-
return [
|
|
26
|
-
...routes,
|
|
27
|
-
...prefixedLocales.flatMap((locale) => aliasable.map((route, index) => localizeRouteEntry(route, {
|
|
28
|
-
locale,
|
|
29
|
-
prefixThisEntry: true,
|
|
30
|
-
routeKey: String(index),
|
|
31
|
-
}))),
|
|
32
|
-
];
|
|
33
|
-
}
|
|
34
|
-
function declaresLocaleSegment(route) {
|
|
35
|
-
if (route.path && hasLocaleSegment(route.path)) {
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
return (route.children ?? []).some(declaresLocaleSegment);
|
|
39
|
-
}
|
|
40
|
-
function localizeRouteEntry(route, options) {
|
|
41
|
-
const clone = {
|
|
42
|
-
...route,
|
|
43
|
-
id: localizedRouteId(route, options.locale, options.routeKey),
|
|
44
|
-
};
|
|
45
|
-
let prefixAppliedHere = false;
|
|
46
|
-
if (options.prefixThisEntry) {
|
|
47
|
-
prefixAppliedHere = applyLocalePrefix(clone, options.locale);
|
|
48
|
-
}
|
|
49
|
-
if (route.children) {
|
|
50
|
-
clone.children = route.children.map((child, index) => localizeRouteEntry(child, {
|
|
51
|
-
locale: options.locale,
|
|
52
|
-
prefixThisEntry: !prefixAppliedHere,
|
|
53
|
-
routeKey: `${options.routeKey}.${index}`,
|
|
54
|
-
}));
|
|
55
|
-
}
|
|
56
|
-
return clone;
|
|
57
|
-
}
|
|
58
|
-
function applyLocalePrefix(route, locale) {
|
|
59
|
-
if (route.index) {
|
|
60
|
-
delete route.index;
|
|
61
|
-
route.path = locale;
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
if (typeof route.path === 'string') {
|
|
65
|
-
route.path = joinRoutePath(locale, route.path);
|
|
66
|
-
return true;
|
|
67
|
-
}
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
function joinRoutePath(prefix, routePath) {
|
|
71
|
-
const cleanPrefix = prefix.replace(/^\/+|\/+$/g, '');
|
|
72
|
-
const cleanPath = routePath.replace(/^\/+|\/+$/g, '');
|
|
73
|
-
return cleanPath ? `${cleanPrefix}/${cleanPath}` : cleanPrefix;
|
|
74
|
-
}
|
|
75
|
-
function localizedRouteId(route, locale, routeKey) {
|
|
76
|
-
const base = route.id ?? route.path ?? (route.index ? 'index' : route.file) ?? `route-${routeKey}`;
|
|
77
|
-
return `fimo.${sanitizeRouteId(locale)}.${sanitizeRouteId(base)}`;
|
|
78
|
-
}
|
|
79
|
-
function sanitizeRouteId(value) {
|
|
80
|
-
const clean = value
|
|
81
|
-
.replace(/^\.?\//, '')
|
|
82
|
-
.replace(/\.[tj]sx?$/i, '')
|
|
83
|
-
.replace(/[^A-Za-z0-9_$-]+/g, '.')
|
|
84
|
-
.replace(/^\.+|\.+$/g, '');
|
|
85
|
-
return clean || 'route';
|
|
86
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { FimoConfig } from '../shared/fimo-config.types.js';
|
|
2
|
-
export type FimoNavigationTo = string | {
|
|
3
|
-
pathname?: string;
|
|
4
|
-
search?: string;
|
|
5
|
-
hash?: string;
|
|
6
|
-
};
|
|
7
|
-
export declare function localizeFimoTo(to: FimoNavigationTo, locale: string, config: Pick<FimoConfig, 'i18n'> | undefined): FimoNavigationTo;
|
|
8
|
-
//# sourceMappingURL=navigation-utils.d.ts.map
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { localizeFimoPath } from '../i18n/locale.js';
|
|
2
|
-
export function localizeFimoTo(to, locale, config) {
|
|
3
|
-
if (typeof to === 'string') {
|
|
4
|
-
return localizeStringTo(to, locale, config);
|
|
5
|
-
}
|
|
6
|
-
if (!to.pathname) {
|
|
7
|
-
return to;
|
|
8
|
-
}
|
|
9
|
-
const localizedPathname = localizePathname(to.pathname, locale, config);
|
|
10
|
-
return localizedPathname === to.pathname ? to : { ...to, pathname: localizedPathname };
|
|
11
|
-
}
|
|
12
|
-
function localizeStringTo(to, locale, config) {
|
|
13
|
-
if (!shouldLocalizeStringPath(to)) {
|
|
14
|
-
return to;
|
|
15
|
-
}
|
|
16
|
-
const match = /^(?<pathname>[^?#]*)(?<search>\?[^#]*)?(?<hash>#.*)?$/.exec(to);
|
|
17
|
-
const pathname = match?.groups?.pathname || '/';
|
|
18
|
-
const search = match?.groups?.search ?? '';
|
|
19
|
-
const hash = match?.groups?.hash ?? '';
|
|
20
|
-
return `${localizePathname(pathname, locale, config)}${search}${hash}`;
|
|
21
|
-
}
|
|
22
|
-
function shouldLocalizeStringPath(to) {
|
|
23
|
-
if (to.startsWith('#') || to.startsWith('?') || to.startsWith('//')) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
if (/^[a-z][a-z\d+.-]*:/i.test(to)) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
return to.startsWith('/');
|
|
30
|
-
}
|
|
31
|
-
function localizePathname(pathname, locale, config) {
|
|
32
|
-
if (!pathname.startsWith('/')) {
|
|
33
|
-
return pathname;
|
|
34
|
-
}
|
|
35
|
-
return localizeFimoPath(pathname, locale, config);
|
|
36
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { LinkProps, NavigateOptions, To } from 'react-router';
|
|
2
|
-
export interface FimoNavigationOptions {
|
|
3
|
-
locale?: string;
|
|
4
|
-
preserveLocale?: boolean;
|
|
5
|
-
}
|
|
6
|
-
export interface FimoLinkProps extends Omit<LinkProps, 'to'>, FimoNavigationOptions {
|
|
7
|
-
to: To;
|
|
8
|
-
}
|
|
9
|
-
export declare function FimoLink({ to, locale, preserveLocale, ...props }: FimoLinkProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export declare function useFimoHref(to: To, options?: FimoNavigationOptions): To;
|
|
11
|
-
export declare function useFimoNavigate(): (to: To | number, options?: NavigateOptions & FimoNavigationOptions) => void;
|
|
12
|
-
//# sourceMappingURL=navigation.d.ts.map
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Link, useNavigate } from 'react-router';
|
|
3
|
-
// @ts-ignore - virtual module provided by fimoConfigPlugin in fimo/vite
|
|
4
|
-
import fimoConfig from 'virtual:fimo-config';
|
|
5
|
-
import { useLocale } from '../i18n/FimoLocaleContext.js';
|
|
6
|
-
import { localizeFimoTo } from './navigation-utils.js';
|
|
7
|
-
export function FimoLink({ to, locale, preserveLocale = true, ...props }) {
|
|
8
|
-
const href = useFimoHref(to, { locale, preserveLocale });
|
|
9
|
-
return _jsx(Link, { ...props, to: href });
|
|
10
|
-
}
|
|
11
|
-
export function useFimoHref(to, options = {}) {
|
|
12
|
-
const active = useLocale();
|
|
13
|
-
const locale = options.locale ?? (options.preserveLocale === false ? undefined : active.locale);
|
|
14
|
-
return locale ? localizeFimoTo(to, locale, fimoConfig) : to;
|
|
15
|
-
}
|
|
16
|
-
export function useFimoNavigate() {
|
|
17
|
-
const navigate = useNavigate();
|
|
18
|
-
const active = useLocale();
|
|
19
|
-
return (to, options = {}) => {
|
|
20
|
-
if (typeof to === 'number') {
|
|
21
|
-
navigate(to);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
const locale = options.locale ?? (options.preserveLocale === false ? undefined : active.locale);
|
|
25
|
-
const localizedTo = locale ? localizeFimoTo(to, locale, fimoConfig) : to;
|
|
26
|
-
navigate(localizedTo, options);
|
|
27
|
-
};
|
|
28
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
interface ReactRouterUserConfig {
|
|
2
|
-
readonly ssr?: boolean;
|
|
3
|
-
}
|
|
4
|
-
interface ReactRouterBuildEndArgs {
|
|
5
|
-
readonly buildManifest: unknown;
|
|
6
|
-
readonly reactRouterConfig: unknown;
|
|
7
|
-
readonly viteConfig: {
|
|
8
|
-
readonly root: string;
|
|
9
|
-
readonly build: {
|
|
10
|
-
readonly assetsDir?: string;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Connect a client-rendered React Router build to Fimo hosting.
|
|
16
|
-
*
|
|
17
|
-
* The hosting-provider build contract stays inside Fimo so applications do not
|
|
18
|
-
* install or import provider packages. SSR needs a deeper server-runtime
|
|
19
|
-
* adapter and is rejected until Fimo supports that contract explicitly.
|
|
20
|
-
*/
|
|
21
|
-
export declare function fimoPreset(): {
|
|
22
|
-
name: string;
|
|
23
|
-
reactRouterConfig({ reactRouterUserConfig }: {
|
|
24
|
-
reactRouterUserConfig: ReactRouterUserConfig;
|
|
25
|
-
}): {
|
|
26
|
-
buildEnd({ buildManifest, reactRouterConfig, viteConfig }: ReactRouterBuildEndArgs): void;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
export {};
|
|
30
|
-
//# sourceMappingURL=preset.d.ts.map
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import { dirname, join } from 'node:path';
|
|
3
|
-
const REACT_ROUTER_BUILD_RESULT = '.vercel/react-router-build-result.json';
|
|
4
|
-
/**
|
|
5
|
-
* Connect a client-rendered React Router build to Fimo hosting.
|
|
6
|
-
*
|
|
7
|
-
* The hosting-provider build contract stays inside Fimo so applications do not
|
|
8
|
-
* install or import provider packages. SSR needs a deeper server-runtime
|
|
9
|
-
* adapter and is rejected until Fimo supports that contract explicitly.
|
|
10
|
-
*/
|
|
11
|
-
export function fimoPreset() {
|
|
12
|
-
return {
|
|
13
|
-
name: 'fimo',
|
|
14
|
-
reactRouterConfig({ reactRouterUserConfig }) {
|
|
15
|
-
if (reactRouterUserConfig.ssr !== false) {
|
|
16
|
-
throw new Error('fimoPreset() currently supports React Router apps configured with ssr: false');
|
|
17
|
-
}
|
|
18
|
-
return {
|
|
19
|
-
buildEnd({ buildManifest, reactRouterConfig, viteConfig }) {
|
|
20
|
-
const buildResultPath = join(viteConfig.root, REACT_ROUTER_BUILD_RESULT);
|
|
21
|
-
const assetsDir = viteConfig.build.assetsDir;
|
|
22
|
-
const result = {
|
|
23
|
-
buildManifest,
|
|
24
|
-
reactRouterConfig,
|
|
25
|
-
viteConfig: assetsDir ? { build: { assetsDir } } : undefined,
|
|
26
|
-
};
|
|
27
|
-
mkdirSync(dirname(buildResultPath), { recursive: true });
|
|
28
|
-
writeFileSync(buildResultPath, `${JSON.stringify(result, null, 2)}\n`);
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
import { useLocation } from 'react-router';
|
|
3
|
-
export function AppResetScrollOnNavigate() {
|
|
4
|
-
const { pathname } = useLocation();
|
|
5
|
-
useEffect(() => {
|
|
6
|
-
try {
|
|
7
|
-
window.scrollTo({ top: 0, left: 0, behavior: 'auto' });
|
|
8
|
-
}
|
|
9
|
-
catch { }
|
|
10
|
-
}, [pathname]);
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { RouteObject } from 'react-router';
|
|
3
|
-
export interface SlugInfo {
|
|
4
|
-
schema: string;
|
|
5
|
-
queryField: string;
|
|
6
|
-
displayField: string;
|
|
7
|
-
}
|
|
8
|
-
export interface AppRoute extends Omit<RouteObject, 'children' | 'element'> {
|
|
9
|
-
name?: string;
|
|
10
|
-
path?: string;
|
|
11
|
-
element: React.ReactNode;
|
|
12
|
-
index?: boolean;
|
|
13
|
-
slugs?: Record<string, SlugInfo>;
|
|
14
|
-
children?: AppRoute[];
|
|
15
|
-
}
|
|
16
|
-
export interface DisplayRoute extends Omit<AppRoute, 'element' | 'children' | 'handle'> {
|
|
17
|
-
name: string;
|
|
18
|
-
path: string;
|
|
19
|
-
}
|
|
20
|
-
export declare function getDisplayRoutes(routes: AppRoute[], basePath?: string): DisplayRoute[];
|
|
21
|
-
export declare function AppRoutesProvider({ appRoutes, children }: {
|
|
22
|
-
appRoutes?: AppRoute[];
|
|
23
|
-
children?: React.ReactNode;
|
|
24
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
25
|
-
//# sourceMappingURL=AppRoutesProvider.d.ts.map
|