@contentful/experiences-svelte 0.5.8 → 0.5.10

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/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## 0.5.10 (2026-08-26)
2
+
3
+ ### 🧱 Updated Dependencies
4
+
5
+ - Updated client to 0.3.9
6
+ - Updated design to 0.7.9
7
+ - Updated core to 0.7.9
8
+
9
+ ## 0.5.9 (2026-08-24)
10
+
11
+ ### 🧱 Updated Dependencies
12
+
13
+ - Updated client to 0.3.8
14
+ - Updated design to 0.7.8
15
+ - Updated core to 0.7.8
16
+
1
17
  ## 0.5.8 (2026-08-21)
2
18
 
3
19
  ### 🧱 Updated Dependencies
@@ -1,6 +1,6 @@
1
1
  <!--
2
2
  * Recursive renderer over PortableRenderNodes. Customer components receive
3
- * the merged content / design / resolveData prop bag plus one prop per slot,
3
+ * the merged content / design / resolveData props plus one prop per slot,
4
4
  * each an ARRAY of Snippets — one zero-arg Snippet per pre-rendered child
5
5
  * node. A slot named `content` arrives as `content?: Snippet[]`; the
6
6
  * conventional default slot arrives as `children?: Snippet[]`. A component
@@ -59,9 +59,9 @@
59
59
  }
60
60
 
61
61
  // Build one Snippet[] per slot so every slot becomes a named prop. Snippets
62
- // themselves are compile-time entities, but the *prop bag* is plain runtime
63
- // data — so an unbounded set of payload-driven slot names is fine as long as
64
- // each snippet comes from `toChildSnippet`.
62
+ // themselves are compile-time entities, but the merged props object is
63
+ // plain runtime data — so an unbounded set of payload-driven slot names is
64
+ // fine as long as each snippet comes from `toChildSnippet`.
65
65
  function toSlotSnippets(node: PortableRenderNode): Record<string, Snippet[]> {
66
66
  const slotSnippets: Record<string, Snippet[]> = {};
67
67
  for (const [slotName, children] of Object.entries(node.slots)) {
@@ -264,6 +264,29 @@ describe('ServerExperienceRenderer', () => {
264
264
  expect(container.innerHTML).toContain('data-variant="fromContent"');
265
265
  expect(container.innerHTML).toContain('data-priority="low"');
266
266
  });
267
+ it('treats an explicitly-empty content value as set (beats a non-empty default)', async () => {
268
+ const itemConfig = {
269
+ components: {
270
+ item: {
271
+ defaults: { variant: 'fromDefault' },
272
+ component: ItemFixture,
273
+ },
274
+ },
275
+ };
276
+ const plan = await resolveExperience({
277
+ viewports: VIEWPORTS,
278
+ nodes: [
279
+ componentNode('item', {
280
+ id: 'i',
281
+ contentProperties: { variant: '' },
282
+ }),
283
+ ],
284
+ }, itemConfig);
285
+ const { container } = render(ServerExperienceRenderer, {
286
+ props: { experience: plan, config: itemConfig },
287
+ });
288
+ expect(container.innerHTML).toContain('data-variant=""');
289
+ });
267
290
  it('respects merge precedence: defaults < content < resolved', () => {
268
291
  const precedenceConfig = {
269
292
  components: {
package/dist/types.d.ts CHANGED
@@ -63,6 +63,10 @@ export interface RenderContext extends ExperienceContext {
63
63
  * `getExperience()` / `getContentfulComponent()`.
64
64
  */
65
65
  export interface ComponentConfig<Props extends object = Record<string, unknown>> {
66
+ /**
67
+ * Lowest-precedence defaults object. Merged in before content / resolveData /
68
+ * slots. Useful for variant fallbacks the editorial layer doesn't always supply.
69
+ */
66
70
  defaults?: Partial<Props>;
67
71
  resolveData?: (ctx: ResolveContext) => Partial<Props> | Promise<Partial<Props>>;
68
72
  component: Component<any>;
@@ -85,6 +89,10 @@ export type Registration<Props extends object = Record<string, unknown>> = Compo
85
89
  * prop), so there is no `children` special case.
86
90
  */
87
91
  export interface ExperienceTemplateConfig<Props extends object = Record<string, unknown>> {
92
+ /**
93
+ * Lowest-precedence defaults object. Merged in before content / resolveData /
94
+ * slots. Useful for variant fallbacks the editorial layer doesn't always supply.
95
+ */
88
96
  defaults?: Partial<Props>;
89
97
  resolveData?: (ctx: ResolveContext) => Partial<Props> | Promise<Partial<Props>>;
90
98
  component: Component<any>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,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S,MAAM,EACtE,GAAG,EAAE,8BAA8B,CAAC,CAAC,CAAC,GACrC,wBAAwB,CAAC,CAAC,CAAC,CAM7B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experiences-svelte",
3
- "version": "0.5.8",
3
+ "version": "0.5.10",
4
4
  "description": "Svelte adapter for Contentful Experiences — Server and Client renderers over a PortableRenderPlan",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -35,9 +35,9 @@
35
35
  "check": "svelte-check --tsconfig ./tsconfig.json"
36
36
  },
37
37
  "dependencies": {
38
- "@contentful/experiences-client": "0.3.7",
39
- "@contentful/experiences-sdk-core": "0.7.7",
40
- "@contentful/experiences-design": "0.7.7"
38
+ "@contentful/experiences-client": "0.3.9",
39
+ "@contentful/experiences-sdk-core": "0.7.9",
40
+ "@contentful/experiences-design": "0.7.9"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "svelte": "^5.55.7"
@@ -48,8 +48,8 @@
48
48
  "@testing-library/jest-dom": "^7.0.1",
49
49
  "@testing-library/svelte": "^5.4.2",
50
50
  "jsdom": "^30.0.1",
51
- "publint": "^0.3.23",
52
- "svelte": "^5.56.8",
53
- "svelte-check": "^4.7.5"
51
+ "publint": "^0.3.24",
52
+ "svelte": "^5.56.10",
53
+ "svelte-check": "^4.7.6"
54
54
  }
55
55
  }