fimo 0.11.1-staging.1 → 0.12.0-staging.2

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 (108) hide show
  1. package/assets/content-templates/hooks-template.eta +8 -8
  2. package/assets/content-templates/next-client-template.eta +102 -0
  3. package/assets/content-templates/next-server-template.eta +75 -0
  4. package/assets/content-templates/types-template.eta +2 -2
  5. package/assets/skills/fimo-cli/SKILL.md +2 -0
  6. package/assets/skills/fimo-cli/references/deploy.md +22 -1
  7. package/assets/skills/fimo-cli/references/preview.md +4 -3
  8. package/assets/skills/fimo-code/references/setup-plain-vite.md +4 -2
  9. package/assets/skills/fimo-code/references/setup-react-router.md +4 -2
  10. package/assets/skills/fimo-studio/SKILL.md +3 -1
  11. package/assets/skills/fimo-studio/references/ai-chat.md +1 -1
  12. package/assets/skills/fimo-studio/references/command-palette.md +31 -0
  13. package/dist/cli/bundle.json +1 -1
  14. package/dist/cli/index.js +50 -48
  15. package/dist/runtime/content/client/collection-core.d.ts +37 -0
  16. package/dist/runtime/content/client/collection-core.js +149 -0
  17. package/dist/runtime/content/client/createContentClient.d.ts +3 -16
  18. package/dist/runtime/content/client/createContentClient.js +4 -321
  19. package/dist/runtime/content/client/createSingletonClient.js +3 -108
  20. package/dist/runtime/content/client/internal.d.ts +1 -3
  21. package/dist/runtime/content/client/internal.js +3 -21
  22. package/dist/runtime/content/client/react-content-client.d.ts +10 -0
  23. package/dist/runtime/content/client/react-content-client.js +165 -0
  24. package/dist/runtime/content/client/react-singleton-client.d.ts +7 -0
  25. package/dist/runtime/content/client/react-singleton-client.js +38 -0
  26. package/dist/runtime/content/client/runtime.d.ts +8 -0
  27. package/dist/runtime/content/client/runtime.js +7 -0
  28. package/dist/runtime/content/client/server-content-client.d.ts +9 -0
  29. package/dist/runtime/content/client/server-content-client.js +35 -0
  30. package/dist/runtime/content/client/singleton-core.d.ts +26 -0
  31. package/dist/runtime/content/client/singleton-core.js +73 -0
  32. package/dist/runtime/content/client/useQueryLocale.d.ts +1 -1
  33. package/dist/runtime/content/client/useQueryLocale.js +2 -3
  34. package/dist/runtime/content/client/vite-runtime.d.ts +3 -0
  35. package/dist/runtime/content/client/vite-runtime.js +23 -0
  36. package/dist/runtime/content/index.d.ts +16 -0
  37. package/dist/runtime/content/index.js +10 -0
  38. package/dist/runtime/content/serialization.d.ts +22 -0
  39. package/dist/runtime/content/serialization.js +42 -0
  40. package/dist/runtime/next/client-runtime.d.ts +3 -0
  41. package/dist/runtime/next/client-runtime.js +20 -0
  42. package/dist/runtime/next/client.d.ts +23 -0
  43. package/dist/runtime/next/client.js +22 -0
  44. package/dist/runtime/next/primitives/Text.d.ts +10 -0
  45. package/dist/runtime/next/primitives/Text.js +18 -0
  46. package/dist/runtime/next/primitives/server.d.ts +9 -0
  47. package/dist/runtime/next/primitives/server.js +46 -0
  48. package/dist/runtime/next/provider.d.ts +10 -0
  49. package/dist/runtime/next/provider.js +12 -0
  50. package/dist/runtime/next/server-runtime.d.ts +3 -0
  51. package/dist/runtime/next/server-runtime.js +20 -0
  52. package/dist/runtime/next/server.d.ts +13 -0
  53. package/dist/runtime/next/server.js +12 -0
  54. package/dist/runtime/primitives/index.d.ts +10 -10
  55. package/dist/runtime/primitives/index.js +10 -10
  56. package/dist/runtime/primitives/lib/image-optimization.d.ts +10 -1
  57. package/dist/runtime/primitives/lib/image-optimization.js +12 -12
  58. package/dist/runtime/primitives/lib/index.d.ts +0 -1
  59. package/dist/runtime/primitives/lib/index.js +0 -1
  60. package/dist/runtime/primitives/lib/query.d.ts +1 -1
  61. package/dist/runtime/react/primitives/contracts.d.ts +56 -0
  62. package/dist/runtime/react/primitives/contracts.js +1 -0
  63. package/dist/runtime/react/primitives/editable/Boolean.d.ts +5 -0
  64. package/dist/runtime/react/primitives/editable/Boolean.js +11 -0
  65. package/dist/runtime/react/primitives/editable/Date.d.ts +4 -0
  66. package/dist/runtime/react/primitives/editable/Date.js +12 -0
  67. package/dist/runtime/react/primitives/editable/Image.d.ts +4 -0
  68. package/dist/runtime/react/primitives/editable/Image.js +10 -0
  69. package/dist/runtime/react/primitives/editable/Json.d.ts +5 -0
  70. package/dist/runtime/react/primitives/editable/Json.js +11 -0
  71. package/dist/runtime/react/primitives/editable/RichText.d.ts +4 -0
  72. package/dist/runtime/react/primitives/editable/RichText.js +11 -0
  73. package/dist/runtime/{primitives/components → react/primitives/editable}/Text.d.ts +3 -7
  74. package/dist/runtime/{primitives/components → react/primitives/editable}/Text.js +2 -1
  75. package/dist/runtime/react/primitives/editable/Video.d.ts +4 -0
  76. package/dist/runtime/react/primitives/editable/Video.js +10 -0
  77. package/dist/runtime/react/primitives/renderers/DateRenderer.d.ts +11 -0
  78. package/dist/runtime/react/primitives/renderers/DateRenderer.js +14 -0
  79. package/dist/runtime/react/primitives/renderers/ImageRenderer.d.ts +8 -0
  80. package/dist/runtime/react/primitives/renderers/ImageRenderer.js +50 -0
  81. package/dist/runtime/react/primitives/renderers/RichTextRenderer.d.ts +11 -0
  82. package/dist/runtime/{primitives/components/RichText.js → react/primitives/renderers/RichTextRenderer.js} +4 -6
  83. package/dist/runtime/{primitives/components → react/primitives/renderers}/StaticImage.d.ts +2 -11
  84. package/dist/runtime/{primitives/components → react/primitives/renderers}/StaticImage.js +5 -3
  85. package/dist/runtime/react/primitives/renderers/VideoRenderer.d.ts +8 -0
  86. package/dist/runtime/react/primitives/renderers/VideoRenderer.js +10 -0
  87. package/dist/runtime/{primitives/lib → react}/useFimoLiveValue.d.ts +4 -6
  88. package/dist/runtime/{primitives/lib → react}/useFimoLiveValue.js +4 -10
  89. package/dist/runtime/vite/primitives/Images.d.ts +4 -0
  90. package/dist/runtime/vite/primitives/Images.js +12 -0
  91. package/dist/runtime/{primitives → vite}/translations.d.ts +1 -1
  92. package/dist/runtime/{primitives → vite}/translations.js +1 -1
  93. package/dist/scripts/sync-schemas.js +67 -16
  94. package/package.json +14 -1
  95. package/templates/react-router/package.json +1 -1
  96. package/dist/runtime/primitives/components/Boolean.d.ts +0 -29
  97. package/dist/runtime/primitives/components/Boolean.js +0 -33
  98. package/dist/runtime/primitives/components/Date.d.ts +0 -30
  99. package/dist/runtime/primitives/components/Date.js +0 -43
  100. package/dist/runtime/primitives/components/Image.d.ts +0 -72
  101. package/dist/runtime/primitives/components/Image.js +0 -108
  102. package/dist/runtime/primitives/components/Json.d.ts +0 -25
  103. package/dist/runtime/primitives/components/Json.js +0 -29
  104. package/dist/runtime/primitives/components/RichText.d.ts +0 -9
  105. package/dist/runtime/primitives/components/Video.d.ts +0 -31
  106. package/dist/runtime/primitives/components/Video.js +0 -34
  107. package/dist/runtime/primitives/components/index.d.ts +0 -6
  108. package/dist/runtime/primitives/components/index.js +0 -5
@@ -1,108 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { clampQuality, resolveFit, toObjectFit, toPositiveInt, isOptimizableFimoUrl, buildOptimizedUrl, computeImageOptimizationConfig, } from '../lib/image-optimization.js';
3
- import { FIMO_SOURCE, useFimoLiveValue } from '../lib/index.js';
4
- /**
5
- * Image component for rendering schema media with optional optimization.
6
- *
7
- * Optimization:
8
- * - Applies only to http(s) URLs on *.fimo.team, *.fimo.ai, and *.fimo.site.
9
- * - Generates optimized `src` automatically only when at least one sizing hint
10
- * is provided (`width`, `height`, or `sizes`).
11
- * - Uses default quality 85 and internal format=auto.
12
- * - Maps `fit` to CSS object-fit by default.
13
- *
14
- * Escape hatch:
15
- * - Pass `unoptimized` to bypass all URL rewriting.
16
- *
17
- * Use children render function for custom rendering (e.g., picture element).
18
- *
19
- * @example
20
- * <Image value={post.coverImage} />
21
- * <Image value={post.coverImage} className="rounded-lg" loading="lazy" />
22
- *
23
- * // With render function for custom markup
24
- * <Image value={post.cover}>
25
- * {(media) => (
26
- * <img src={media.url} alt={media.alt} />
27
- * )}
28
- * </Image>
29
- *
30
- * // Fixed-size mode (no `sizes`): uses DPR candidates
31
- * <Image value={post.coverImage} width={320} />
32
- * // srcSet:
33
- * // ...?w=320&q=85&fit=scale-down&f=auto&dpr=1 1x,
34
- * // ...?w=320&q=85&fit=scale-down&f=auto&dpr=2 2x
35
- * // src:
36
- * // ...?w=320&q=85&fit=scale-down&f=auto&dpr=2
37
- *
38
- * // Responsive mode (`sizes`): uses width candidates
39
- * <Image
40
- * value={post.coverImage}
41
- * sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw"
42
- * />
43
- * // srcSet (example):
44
- * // ...?w=640&q=85&fit=scale-down&f=auto 640w,
45
- * // ...?w=750&q=85&fit=scale-down&f=auto 750w,
46
- * // ...?w=828&q=85&fit=scale-down&f=auto 828w
47
- *
48
- * // No `width`/`height`/`sizes`: keep source URL unchanged
49
- * <Image value={post.coverImage} />
50
- * // src: original media URL
51
- */
52
- export function Image(props) {
53
- const { value: media, children, quality, unoptimized = false, fit, width, height, alt: altOverride, overrideSrc, srcSet: srcSetOverride, sizes, style, ...imgProps } = props;
54
- const { value: liveMedia, ref } = useFimoLiveValue(media ?? null);
55
- // Defensive: return null if no media
56
- if (!liveMedia) {
57
- return null;
58
- }
59
- const mediaSource = liveMedia[FIMO_SOURCE];
60
- if (children) {
61
- return (_jsx("span", { ref: ref, "data-fimo-source": mediaSource, children: children(liveMedia) }));
62
- }
63
- const normalizedQuality = clampQuality(quality);
64
- const normalizedFit = resolveFit(fit);
65
- const requestedWidth = toPositiveInt(width);
66
- const requestedHeight = toPositiveInt(height);
67
- const displayWidth = requestedWidth ?? liveMedia.width;
68
- const displayHeight = requestedHeight ?? liveMedia.height;
69
- const originalSrc = liveMedia.url;
70
- const resolvedAlt = altOverride ?? liveMedia.alt;
71
- // User-defined sizes attribute
72
- const hasSizesAttr = typeof sizes === 'string' && sizes.trim().length > 0;
73
- const hasSizingHint = hasSizesAttr || requestedWidth !== undefined || requestedHeight !== undefined;
74
- const canOptimizeSource = !unoptimized && isOptimizableFimoUrl(originalSrc);
75
- const shouldOptimize = canOptimizeSource && hasSizingHint;
76
- const { generatedSrcSet, transformWidth, transformDpr } = computeImageOptimizationConfig({
77
- shouldOptimize,
78
- hasSizesAttr,
79
- srcSetOverride,
80
- originalSrc,
81
- mediaWidth: media.width,
82
- renderWidth: displayWidth,
83
- quality: normalizedQuality,
84
- fit: normalizedFit,
85
- });
86
- const finalSrcSet = srcSetOverride ?? generatedSrcSet;
87
- const optimizedSrc = shouldOptimize
88
- ? buildOptimizedUrl(originalSrc, {
89
- width: transformWidth,
90
- quality: normalizedQuality,
91
- fit: normalizedFit,
92
- dpr: transformDpr,
93
- })
94
- : originalSrc;
95
- const finalSrc = overrideSrc ?? optimizedSrc;
96
- /**
97
- * Apply browser-side object fitting so the rendered image also respects
98
- * the container box. Cloudflare `fit` controls transformed pixels, while
99
- * `object-fit` controls layout behavior at render time.
100
- */
101
- const finalStyle = style?.objectFit
102
- ? style
103
- : {
104
- ...style,
105
- objectFit: toObjectFit(normalizedFit),
106
- };
107
- return (_jsx("img", { ref: ref, src: finalSrc, alt: resolvedAlt, width: displayWidth, height: displayHeight, style: finalStyle, sizes: sizes, srcSet: finalSrcSet, ...imgProps, "data-fimo-source": mediaSource }));
108
- }
@@ -1,25 +0,0 @@
1
- import { type ComponentPropsWithoutRef, type ElementType, type ReactNode } from 'react';
2
- type JsonProps<T extends ElementType = 'span'> = {
3
- value: unknown;
4
- as?: T;
5
- children?: (value: unknown) => ReactNode;
6
- } & Omit<ComponentPropsWithoutRef<T>, 'value' | 'as' | 'children'>;
7
- /**
8
- * Json component for rendering JSON field values with source tracking.
9
- *
10
- * Use children render function to customize how the value is displayed.
11
- * Pass `as="pre"` (with a `white-space: pre-wrap` class) for formatted output.
12
- *
13
- * @example
14
- * // Default (single-line JSON text)
15
- * <Json value={product.metadata} />
16
- *
17
- * // Pretty-printed
18
- * <Json value={product.metadata} as="pre" className="whitespace-pre-wrap" />
19
- *
20
- * // With render function for custom display
21
- * <Json value={product.metadata}>{(val) => val.tags?.join(', ')}</Json>
22
- */
23
- export declare function Json<T extends ElementType = 'span'>({ value, as, children, ...props }: JsonProps<T>): import("react/jsx-runtime").JSX.Element | null;
24
- export {};
25
- //# sourceMappingURL=Json.d.ts.map
@@ -1,29 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { getFimoSource, useFimoLiveValue } from '../lib/index.js';
3
- /**
4
- * Json component for rendering JSON field values with source tracking.
5
- *
6
- * Use children render function to customize how the value is displayed.
7
- * Pass `as="pre"` (with a `white-space: pre-wrap` class) for formatted output.
8
- *
9
- * @example
10
- * // Default (single-line JSON text)
11
- * <Json value={product.metadata} />
12
- *
13
- * // Pretty-printed
14
- * <Json value={product.metadata} as="pre" className="whitespace-pre-wrap" />
15
- *
16
- * // With render function for custom display
17
- * <Json value={product.metadata}>{(val) => val.tags?.join(', ')}</Json>
18
- */
19
- export function Json({ value, as, children, ...props }) {
20
- const Component = as || 'span';
21
- const { value: liveValue, ref } = useFimoLiveValue(value);
22
- // Defensive: return null if no value
23
- if (value === null || value === undefined) {
24
- return null;
25
- }
26
- const source = getFimoSource(value);
27
- const content = children ? children(liveValue) : JSON.stringify(liveValue);
28
- return (_jsx(Component, { ref: ref, ...props, "data-fimo-source": source, children: content }));
29
- }
@@ -1,9 +0,0 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
2
- import { type FimoRichText, type FimoRichTextComponents } from '../lib/index.js';
3
- type RichTextProps = {
4
- value: FimoRichText | null | undefined;
5
- components?: FimoRichTextComponents;
6
- } & Omit<ComponentPropsWithoutRef<'div'>, 'children'>;
7
- export declare function RichText({ value, components, ...props }: RichTextProps): import("react/jsx-runtime").JSX.Element | null;
8
- export {};
9
- //# sourceMappingURL=RichText.d.ts.map
@@ -1,31 +0,0 @@
1
- import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
2
- import { type FimoMedia } from '../lib/index.js';
3
- type BaseVideoProps = Omit<ComponentPropsWithoutRef<'video'>, 'src' | 'children'> & {
4
- overrideSrc?: string;
5
- };
6
- type VideoProps = BaseVideoProps & {
7
- value: FimoMedia;
8
- children?: (media: FimoMedia) => ReactNode;
9
- };
10
- /**
11
- * Video component for rendering schema media with source tracking.
12
- *
13
- * Renders a native `<video>` element with `data-fimo-source` for edit tracking.
14
- * Defaults to `autoPlay`, `loop`, `muted`, and `playsInline` for hero/background use.
15
- * All defaults can be overridden via props.
16
- *
17
- * @example
18
- * <Video value={post.heroVideo} />
19
- * <Video value={post.heroVideo} autoPlay={false} controls />
20
- * <Video value={post.bgVideo} className="absolute inset-0 object-cover" />
21
- *
22
- * // With render function for custom markup
23
- * <Video value={post.video}>
24
- * {(media) => (
25
- * <video src={media.url} controls />
26
- * )}
27
- * </Video>
28
- */
29
- export declare function Video(props: VideoProps): import("react/jsx-runtime").JSX.Element | null;
30
- export {};
31
- //# sourceMappingURL=Video.d.ts.map
@@ -1,34 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { FIMO_SOURCE, useFimoLiveValue } from '../lib/index.js';
3
- /**
4
- * Video component for rendering schema media with source tracking.
5
- *
6
- * Renders a native `<video>` element with `data-fimo-source` for edit tracking.
7
- * Defaults to `autoPlay`, `loop`, `muted`, and `playsInline` for hero/background use.
8
- * All defaults can be overridden via props.
9
- *
10
- * @example
11
- * <Video value={post.heroVideo} />
12
- * <Video value={post.heroVideo} autoPlay={false} controls />
13
- * <Video value={post.bgVideo} className="absolute inset-0 object-cover" />
14
- *
15
- * // With render function for custom markup
16
- * <Video value={post.video}>
17
- * {(media) => (
18
- * <video src={media.url} controls />
19
- * )}
20
- * </Video>
21
- */
22
- export function Video(props) {
23
- const { value: media, children, overrideSrc, autoPlay = true, loop = true, muted = true, playsInline = true, style, ...videoProps } = props;
24
- const { value: liveMedia, ref } = useFimoLiveValue(media ?? null);
25
- if (!liveMedia) {
26
- return null;
27
- }
28
- const mediaSource = liveMedia[FIMO_SOURCE];
29
- if (children) {
30
- return (_jsx("span", { ref: ref, "data-fimo-source": mediaSource, children: children(liveMedia) }));
31
- }
32
- const finalSrc = overrideSrc ?? liveMedia.url;
33
- return (_jsx("video", { ref: ref, src: finalSrc, width: liveMedia.width, height: liveMedia.height, autoPlay: autoPlay, loop: loop, muted: muted, playsInline: playsInline, style: style, ...videoProps, "data-fimo-source": mediaSource }));
34
- }
@@ -1,6 +0,0 @@
1
- export { Text } from './Text.js';
2
- export { Image } from './Image.js';
3
- export { Date } from './Date.js';
4
- export { Boolean } from './Boolean.js';
5
- export { RichText } from './RichText.js';
6
- //# sourceMappingURL=index.d.ts.map
@@ -1,5 +0,0 @@
1
- export { Text } from './Text.js';
2
- export { Image } from './Image.js';
3
- export { Date } from './Date.js';
4
- export { Boolean } from './Boolean.js';
5
- export { RichText } from './RichText.js';