@uniweb/kit 0.9.14 → 0.9.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/kit",
3
- "version": "0.9.14",
3
+ "version": "0.9.15",
4
4
  "description": "Standard component library for Uniweb foundations",
5
5
  "type": "module",
6
6
  "exports": {
@@ -39,7 +39,8 @@
39
39
  "fuse.js": "^7.0.0",
40
40
  "shiki": "^3.0.0",
41
41
  "tailwind-merge": "^2.6.0",
42
- "@uniweb/core": "0.7.12"
42
+ "@uniweb/core": "0.7.12",
43
+ "@uniweb/scene": "0.1.1"
43
44
  },
44
45
  "peerDependencies": {
45
46
  "react": "^18.0.0 || ^19.0.0",
package/src/index.js CHANGED
@@ -121,6 +121,7 @@ export { Article } from './styled/Article/index.jsx'
121
121
  export { Code, Alert, Warning, Table, Details, Divider } from './styled/Section/renderers/index.js'
122
122
  export { Disclaimer } from './styled/Disclaimer/index.js'
123
123
  export { Visual } from './styled/Visual/index.jsx'
124
+ export { Scene } from './styled/Scene/index.jsx'
124
125
 
125
126
  // ============================================================================
126
127
  // Search
@@ -0,0 +1,47 @@
1
+ import { Scene as SceneRenderer, composeScene } from '@uniweb/scene'
2
+
3
+ // The @uniweb/scene renderer reads `--vc-*` custom properties for its default
4
+ // colors (an explicit value in the scene JSON always wins). Text, font, and
5
+ // separator already fall back to `currentColor` / `inherit`, so they inherit the
6
+ // section's context color and font for free — we only theme the decorative
7
+ // defaults (shape + spray/accent fills) from the site's semantic tokens.
8
+ const THEME_VARS = {
9
+ '--vc-shape': 'var(--primary, #ffffff)',
10
+ '--vc-accent': 'var(--accent, #ff3300)'
11
+ }
12
+
13
+ /**
14
+ * Scene — themed wrapper around the `@uniweb/scene` renderer (the Scene
15
+ * Composition Format, surfaced to authors as a "Visual Design").
16
+ *
17
+ * Pass `composition` — an SCF document, e.g. `content.data.scene`. For
18
+ * content-driven templates, also pass `overrides` (named-slot, keyed by layer
19
+ * id) and/or `content` (an ordered stream); they run through `composeScene`
20
+ * before rendering so authored content flows into a branded template.
21
+ *
22
+ * Maps the site's `--primary` / `--accent` tokens onto the renderer's decorative
23
+ * defaults so an unstyled scene adopts the theme; text and fonts inherit the
24
+ * section context automatically. All other props (`mobileBreakpoint`,
25
+ * `initialWidth`, `sanitizeSvg`, `className`, `style`, and the editing hooks)
26
+ * forward straight through.
27
+ *
28
+ * @example
29
+ * <Scene composition={content.data.scene} />
30
+ * <Scene composition={template} overrides={{ title: { content: content.title } }} />
31
+ */
32
+ export function Scene({ composition, overrides, content, style, ...rest }) {
33
+ const data =
34
+ overrides || content
35
+ ? composeScene(composition, { overrides, content })
36
+ : composition
37
+
38
+ return (
39
+ <SceneRenderer
40
+ composition={data}
41
+ style={{ ...THEME_VARS, ...style }}
42
+ {...rest}
43
+ />
44
+ )
45
+ }
46
+
47
+ export default Scene