{title}
+ {subtitle &&{subtitle}
} +| Prop | +Type | +Description | +
|---|---|---|
spec |
+ Spec |
+ The json-render spec to render (required) | +
registry |
+ AstroComponentRegistry |
+ Component registry from defineRegistry() |
+
state |
+ {"Record |
+ State for $state/$cond resolution (merged with spec.state) |
+
loading |
+ boolean |
+ Suppresses warnings for missing components/children during streaming | +
fallback |
+ AstroComponentFactory |
+ Rendered when a component type is not found in the registry | +
{subtitle}
} +| Expression | +Description | +
|---|---|
{'{ "$state": "/path" }'} |
+ Read a value from state | +
{'{ "$cond": ..., "$then": ..., "$else": ... }'} |
+ Conditional value based on a visibility condition | +
{'{ "$template": "Hello, ${/name}!" }'} |
+ Interpolate state values into strings | +
{'{ "$item": "field" }'} |
+ Read from current repeat item | +
{'{ "$index": true }'} |
+ Current repeat index | +
| Island Framework | +Astro Integration | +json-render Renderer | +Hydration Directive | +
|---|---|---|---|
| React | +@astrojs/react |
+ @json-render/react |
+ {"client:load"} or {"client:visible"} |
+
| Vue | +@astrojs/vue |
+ @json-render/vue |
+ {"client:load"} or {"client:visible"} |
+
| Svelte | +@astrojs/svelte |
+ @json-render/svelte |
+ {"client:load"} or {"client:visible"} |
+
| Solid | +@astrojs/solid-js |
+ @json-render/solid |
+ {"client:idle"} or {"client:visible"} |
+
| Aspect | +React / Vue / Svelte / Solid | +Astro | +
|---|---|---|
| Output | +Client-side interactive UI | +Static HTML (zero JS) | +
| Components | +Framework components / render functions | +.astro files with {" |
+
| Actions | +emit(), on(), built-in state actions |
+ None (use islands for interactivity) | +
| State mutations | +$bindState, setState action |
+ Read-only ($state, $cond) |
+
| Providers | +StateProvider, ActionProvider, etc. | +None (state passed as prop) | +
| Hooks / Composables | +useStateStore, useActions, etc. |
+ None (static rendering) | +
| Export | +Description | +
|---|---|
@json-render/astro |
+ Full package: schema, defineRegistry, types | +
@json-render/astro/schema |
+ Schema only | +
@json-render/astro/Renderer.astro |
+ Entry point Astro component | +
@json-render/astro/ElementRenderer.astro |
+ Recursive element renderer | +
| Export | +Description | +
|---|---|
AstroSchema |
+ Schema type | +
{"AstroSpec |
+ Infer the spec type from a catalog | +
AstroComponentRegistry |
+ Registry mapping component names to Astro components | +
{"Components |
+ Typed registry for a specific catalog | +
DefineRegistryResult |
+ Return type of defineRegistry() |
+
StateModel |
+ State model type (re-export from core) | +
{content}
diff --git a/examples/astro/src/components/Badge.astro b/examples/astro/src/components/Badge.astro new file mode 100644 index 00000000..a33bad04 --- /dev/null +++ b/examples/astro/src/components/Badge.astro @@ -0,0 +1,19 @@ +--- +interface Props { + label: string; + variant?: string | null; +} + +const { label, variant } = Astro.props; + +const colors: Record{subtitle}
} +
+ Static SSR via @json-render/astro +
+ interactive island via @json-render/react
+
+ Full static demo +
+{subtitle}
} +