@contentful/experiences-svelte 0.4.1 → 0.5.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/CHANGELOG.md +99 -0
- package/README.md +39 -8
- package/dist/ClientExperienceRenderer.svelte +3 -3
- package/dist/DebugExperience.svelte +3 -1
- package/dist/DebugExperience.svelte.d.ts.map +1 -1
- package/dist/DebugExperience.test.js +6 -6
- package/dist/MissingComponent.svelte +6 -6
- package/dist/NodeRenderer.svelte +5 -5
- package/dist/NodeRenderer.svelte.d.ts +1 -1
- package/dist/NodeRenderer.svelte.d.ts.map +1 -1
- package/dist/NodesRenderer.svelte +29 -21
- package/dist/NodesRenderer.svelte.d.ts +0 -1
- package/dist/NodesRenderer.svelte.d.ts.map +1 -1
- package/dist/ServerExperienceRenderer.svelte +3 -3
- package/dist/WrapWithExperienceTemplate.svelte +87 -0
- package/dist/WrapWithExperienceTemplate.svelte.d.ts +13 -0
- package/dist/WrapWithExperienceTemplate.svelte.d.ts.map +1 -0
- package/dist/component-props.d.ts +1 -1
- package/dist/component-props.d.ts.map +1 -1
- package/dist/context.d.ts +6 -5
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +8 -7
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/server-renderer.test.js +90 -29
- package/dist/test-fixtures/ContainerFixture.svelte +4 -2
- package/dist/test-fixtures/ContainerFixture.svelte.d.ts +1 -1
- package/dist/test-fixtures/ContainerFixture.svelte.d.ts.map +1 -1
- package/dist/test-fixtures/{TemplateFixture.svelte → ExperienceTemplateFixture.svelte} +1 -1
- package/dist/test-fixtures/ExperienceTemplateFixture.svelte.d.ts +9 -0
- package/dist/test-fixtures/ExperienceTemplateFixture.svelte.d.ts.map +1 -0
- package/dist/test-fixtures/WrappingContainerFixture.svelte +27 -0
- package/dist/test-fixtures/WrappingContainerFixture.svelte.d.ts +8 -0
- package/dist/test-fixtures/WrappingContainerFixture.svelte.d.ts.map +1 -0
- package/dist/types.d.ts +13 -12
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -2
- package/package.json +5 -5
- package/dist/WrapWithTemplate.svelte +0 -87
- package/dist/WrapWithTemplate.svelte.d.ts +0 -13
- package/dist/WrapWithTemplate.svelte.d.ts.map +0 -1
- package/dist/test-fixtures/TemplateFixture.svelte.d.ts +0 -9
- package/dist/test-fixtures/TemplateFixture.svelte.d.ts.map +0 -1
package/dist/context.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
import { getContext, setContext } from 'svelte';
|
|
19
19
|
const EXPERIENCE_KEY = Symbol('@contentful/experiences-svelte::experience');
|
|
20
20
|
const COMPONENT_KEY = Symbol('@contentful/experiences-svelte::contentful-component');
|
|
21
|
-
const
|
|
21
|
+
const EXPERIENCE_TEMPLATE_KEY = Symbol('@contentful/experiences-svelte::contentful-experience-template');
|
|
22
22
|
const RESOLVED_DESIGN_KEY = Symbol('@contentful/experiences-svelte::resolved-design');
|
|
23
23
|
export function setExperience(ctx) {
|
|
24
24
|
setContext(EXPERIENCE_KEY, ctx);
|
|
@@ -26,11 +26,11 @@ export function setExperience(ctx) {
|
|
|
26
26
|
export function setContentfulComponent(node) {
|
|
27
27
|
setContext(COMPONENT_KEY, node);
|
|
28
28
|
}
|
|
29
|
-
export function
|
|
30
|
-
setContext(
|
|
29
|
+
export function setContentfulExperienceTemplate(tpl) {
|
|
30
|
+
setContext(EXPERIENCE_TEMPLATE_KEY, tpl);
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
|
-
* Publish the resolved design values for the enclosing node
|
|
33
|
+
* Publish the resolved design values for the enclosing node or experience template. Takes a
|
|
34
34
|
* getter (not a snapshot) so callers reading it inside a `$derived` stay
|
|
35
35
|
* reactive across viewport changes.
|
|
36
36
|
*/
|
|
@@ -47,12 +47,13 @@ export function getExperience() {
|
|
|
47
47
|
export function getContentfulComponent() {
|
|
48
48
|
return getContext(COMPONENT_KEY);
|
|
49
49
|
}
|
|
50
|
-
export function
|
|
51
|
-
return getContext(
|
|
50
|
+
export function getContentfulExperienceTemplate() {
|
|
51
|
+
return getContext(EXPERIENCE_TEMPLATE_KEY);
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
54
|
* Read the design values the renderer resolved for the enclosing node or
|
|
55
|
-
* template. Returns `undefined` outside a rendered node
|
|
55
|
+
* experience template. Returns `undefined` outside a rendered node or
|
|
56
|
+
* experience template, which
|
|
56
57
|
* `getDesignValues` treats as "nothing to read."
|
|
57
58
|
*/
|
|
58
59
|
export function getResolvedDesign() {
|
package/dist/index.d.ts
CHANGED
|
@@ -6,17 +6,17 @@ export { default as DebugExperience } from './DebugExperience.svelte';
|
|
|
6
6
|
export { default as NodesRenderer } from './NodesRenderer.svelte';
|
|
7
7
|
export { useActiveViewport } from './use-active-viewport.svelte.js';
|
|
8
8
|
export type { UseActiveViewportResult } from './use-active-viewport.svelte.js';
|
|
9
|
-
export { getExperience, getContentfulComponent,
|
|
9
|
+
export { getExperience, getContentfulComponent, getContentfulExperienceTemplate, } from './context.js';
|
|
10
10
|
export { getDesignValues } from './get-design-values.js';
|
|
11
11
|
export { toCss } from './design-utils.js';
|
|
12
12
|
export type { ToCssOptions } from './design-utils.js';
|
|
13
13
|
export type { ClientExperienceRendererProps, ClientExperienceRendererProps as ExperienceRendererProps, DebugExperienceProps, MissingComponentProps, RenderUnknown, ServerExperienceRendererProps, } from './component-props.js';
|
|
14
|
-
export { defineComponent,
|
|
15
|
-
export type { ComponentConfig, Components, Config, ContentfulComponent,
|
|
14
|
+
export { defineComponent, defineExperienceTemplate, normalizeComponentRegistration, normalizeExperienceTemplateRegistration, } from './types.js';
|
|
15
|
+
export type { ComponentConfig, Components, Config, ContentfulComponent, ContentfulExperienceTemplate, ExperienceTemplateConfig, ExperienceTemplateRegistration, ExperienceTemplates, Registration, RenderContext, ResolveToken, } from './types.js';
|
|
16
16
|
export { resolveExperience } from '@contentful/experiences-sdk-core';
|
|
17
17
|
export type { ResolverConfig, ResolveExperienceOptions } from '@contentful/experiences-sdk-core';
|
|
18
|
-
export type {
|
|
18
|
+
export type { ComponentNode, ComponentRef, DesignPropValue, DesignToken, ExperienceContext, ExperienceNode, ExperiencePayload, ExperienceSys, ExperienceTemplateNode, ExperienceTemplateRef, ManualDesignValue, PortableExperienceTemplate, PortableRegistration, PortableRenderNode, PortableRenderPlan, ResolveContext, ValuesByViewport, ViewportDef, } from '@contentful/experiences-sdk-core';
|
|
19
19
|
export { CSS_PROPERTIES, getValueForViewport, getViewportIndex, isCssProperty, resolveDesignProperties, toCssKey, toCssMediaQuery, } from '@contentful/experiences-design';
|
|
20
|
-
export { ContentfulViewDelivery, ContentfulViewDeliveryClient, DELIVERY_HOST, NotFoundError, PREVIEW_HOST, createClient, fetchExperience, } from '@contentful/experiences-client';
|
|
20
|
+
export { ALPHA_FEATURE_HEADER, ContentfulViewDelivery, ContentfulViewDeliveryClient, DELIVERY_HOST, NEW_EXO_ENTITY_TYPES, NEW_EXO_ENTITY_TYPES_HEADERS, NotFoundError, PREVIEW_HOST, createClient, fetchExperience, } from '@contentful/experiences-client';
|
|
21
21
|
export type { ClientOptions, CreateClientOptions, ExperienceOptions, ResolveOptions, } from '@contentful/experiences-client';
|
|
22
22
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AACxF,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AACxF,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,eAA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AACpB,YAAY,EACV,eAAe,EACf,UAAU,EACV,MAAM,EACN,mBAAmB,EACnB,4BAA4B,EAC5B,wBAAwB,EACxB,8BAA8B,EAC9B,mBAAmB,EACnB,YAAY,EACZ,aAAa,EACb,YAAY,GACb,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,YAAY,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAGjG,YAAY,EACV,aAAa,EACb,YAAY,EACZ,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,EACjB,0BAA0B,EAC1B,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,WAAW,GACZ,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,uBAAuB,EACvB,QAAQ,EACR,eAAe,GAChB,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,4BAA4B,EAC5B,aAAa,EACb,oBAAoB,EACpB,4BAA4B,EAC5B,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,eAAe,GAChB,MAAM,gCAAgC,CAAC;AACxC,YAAY,EACV,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,GACf,MAAM,gCAAgC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -22,14 +22,14 @@ export { default as DebugExperience } from './DebugExperience.svelte';
|
|
|
22
22
|
export { default as NodesRenderer } from './NodesRenderer.svelte';
|
|
23
23
|
export { useActiveViewport } from './use-active-viewport.svelte.js';
|
|
24
24
|
// ─── Runtime context helpers ─────────────────────────────────────────────
|
|
25
|
-
export { getExperience, getContentfulComponent,
|
|
25
|
+
export { getExperience, getContentfulComponent, getContentfulExperienceTemplate, } from './context.js';
|
|
26
26
|
export { getDesignValues } from './get-design-values.js';
|
|
27
27
|
export { toCss } from './design-utils.js';
|
|
28
28
|
// ─── Authoring helpers + Config types ─────────────────────────────────────
|
|
29
|
-
export { defineComponent,
|
|
29
|
+
export { defineComponent, defineExperienceTemplate, normalizeComponentRegistration, normalizeExperienceTemplateRegistration, } from './types.js';
|
|
30
30
|
// ─── Resolver (re-exported from render-core) ──────────────────────────────
|
|
31
31
|
export { resolveExperience } from '@contentful/experiences-sdk-core';
|
|
32
32
|
// ─── Design utilities (re-exported from design) ───────────────────────────
|
|
33
33
|
export { CSS_PROPERTIES, getValueForViewport, getViewportIndex, isCssProperty, resolveDesignProperties, toCssKey, toCssMediaQuery, } from '@contentful/experiences-design';
|
|
34
34
|
// ─── Delivery client + fetchExperience ────────────────────────────────────
|
|
35
|
-
export { ContentfulViewDelivery, ContentfulViewDeliveryClient, DELIVERY_HOST, NotFoundError, PREVIEW_HOST, createClient, fetchExperience, } from '@contentful/experiences-client';
|
|
35
|
+
export { ALPHA_FEATURE_HEADER, ContentfulViewDelivery, ContentfulViewDeliveryClient, DELIVERY_HOST, NEW_EXO_ENTITY_TYPES, NEW_EXO_ENTITY_TYPES_HEADERS, NotFoundError, PREVIEW_HOST, createClient, fetchExperience, } from '@contentful/experiences-client';
|
|
@@ -8,7 +8,8 @@ import ContainerFixture from './test-fixtures/ContainerFixture.svelte';
|
|
|
8
8
|
import HeadingFixture from './test-fixtures/HeadingFixture.svelte';
|
|
9
9
|
import ItemFixture from './test-fixtures/ItemFixture.svelte';
|
|
10
10
|
import PrecedenceFixture from './test-fixtures/PrecedenceFixture.svelte';
|
|
11
|
-
import
|
|
11
|
+
import ExperienceTemplateFixture from './test-fixtures/ExperienceTemplateFixture.svelte';
|
|
12
|
+
import WrappingContainerFixture from './test-fixtures/WrappingContainerFixture.svelte';
|
|
12
13
|
import { captureSink } from './test-fixtures/capture-sink.js';
|
|
13
14
|
import { toCss } from './design-utils.js';
|
|
14
15
|
const VIEWPORTS = [
|
|
@@ -24,11 +25,11 @@ const vbv = (values) => ({
|
|
|
24
25
|
const dt = (value) => ({ type: 'DesignToken', value });
|
|
25
26
|
function componentNode(typeId, rest = {}) {
|
|
26
27
|
return {
|
|
27
|
-
|
|
28
|
+
component: {
|
|
28
29
|
sys: {
|
|
29
30
|
type: 'ResourceLink',
|
|
30
|
-
linkType: 'Contentful:
|
|
31
|
-
urn: `crn:contentful:::experience:spaces/$self/environments/$self/
|
|
31
|
+
linkType: 'Contentful:Component',
|
|
32
|
+
urn: `crn:contentful:::experience:spaces/$self/environments/$self/components/${typeId}`,
|
|
32
33
|
},
|
|
33
34
|
},
|
|
34
35
|
...rest,
|
|
@@ -156,13 +157,13 @@ describe('ServerExperienceRenderer', () => {
|
|
|
156
157
|
nodes: [
|
|
157
158
|
{
|
|
158
159
|
nodeId: 'root',
|
|
159
|
-
registration: {
|
|
160
|
+
registration: { componentId: 'contentful-container' },
|
|
160
161
|
props: { content: {}, design: {} },
|
|
161
162
|
slots: {
|
|
162
163
|
children: [
|
|
163
164
|
{
|
|
164
165
|
nodeId: 'ghost',
|
|
165
|
-
registration: {
|
|
166
|
+
registration: { componentId: 'NotRegistered' },
|
|
166
167
|
props: { content: {}, design: {} },
|
|
167
168
|
slots: {},
|
|
168
169
|
},
|
|
@@ -244,7 +245,7 @@ describe('ServerExperienceRenderer', () => {
|
|
|
244
245
|
nodes: [
|
|
245
246
|
{
|
|
246
247
|
nodeId: 'r',
|
|
247
|
-
registration: {
|
|
248
|
+
registration: { componentId: 'item' },
|
|
248
249
|
props: {
|
|
249
250
|
content: { value: 'fromContent' },
|
|
250
251
|
design: {},
|
|
@@ -259,20 +260,20 @@ describe('ServerExperienceRenderer', () => {
|
|
|
259
260
|
});
|
|
260
261
|
expect(container.innerHTML).toContain('data-value="fromResolveData"');
|
|
261
262
|
});
|
|
262
|
-
it('wraps rendered nodes with the registered
|
|
263
|
+
it('wraps rendered nodes with the registered experienceTemplate', async () => {
|
|
263
264
|
const tplConfig = {
|
|
264
265
|
components: { item: PrecedenceFixture },
|
|
265
|
-
|
|
266
|
-
page: { component:
|
|
266
|
+
experienceTemplates: {
|
|
267
|
+
page: { component: ExperienceTemplateFixture, defaults: { title: 'Default Title' } },
|
|
267
268
|
},
|
|
268
269
|
};
|
|
269
270
|
const tplPayload = {
|
|
270
271
|
sys: {
|
|
271
|
-
|
|
272
|
+
experienceTemplate: {
|
|
272
273
|
sys: {
|
|
273
274
|
type: 'ResourceLink',
|
|
274
|
-
linkType: 'Contentful:
|
|
275
|
-
urn: 'crn:contentful:::experience:spaces/$self/environments/$self/
|
|
275
|
+
linkType: 'Contentful:ExperienceTemplate',
|
|
276
|
+
urn: 'crn:contentful:::experience:spaces/$self/environments/$self/experienceTemplates/page',
|
|
276
277
|
},
|
|
277
278
|
},
|
|
278
279
|
},
|
|
@@ -283,20 +284,20 @@ describe('ServerExperienceRenderer', () => {
|
|
|
283
284
|
const { container } = render(ServerExperienceRenderer, {
|
|
284
285
|
props: { experience: plan, config: tplConfig },
|
|
285
286
|
});
|
|
286
|
-
expect(container.innerHTML).toContain('data-template="page"');
|
|
287
|
+
expect(container.innerHTML).toContain('data-experience-template="page"');
|
|
287
288
|
expect(container.innerHTML).toContain('data-title="Default Title"');
|
|
288
289
|
expect(container.innerHTML).toContain('inside');
|
|
289
290
|
});
|
|
290
|
-
it('renders nodes unwrapped + warns when the
|
|
291
|
+
it('renders nodes unwrapped + warns when the experienceTemplate is not registered', async () => {
|
|
291
292
|
const warn = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
292
293
|
const cfg = { components: { item: PrecedenceFixture } };
|
|
293
294
|
const tplPayload = {
|
|
294
295
|
sys: {
|
|
295
|
-
|
|
296
|
+
experienceTemplate: {
|
|
296
297
|
sys: {
|
|
297
298
|
type: 'ResourceLink',
|
|
298
|
-
linkType: 'Contentful:
|
|
299
|
-
urn: 'crn:contentful:::experience:spaces/$self/environments/$self/
|
|
299
|
+
linkType: 'Contentful:ExperienceTemplate',
|
|
300
|
+
urn: 'crn:contentful:::experience:spaces/$self/environments/$self/experienceTemplates/missing-experienceTemplate',
|
|
300
301
|
},
|
|
301
302
|
},
|
|
302
303
|
},
|
|
@@ -308,11 +309,71 @@ describe('ServerExperienceRenderer', () => {
|
|
|
308
309
|
props: { experience: plan, config: cfg },
|
|
309
310
|
});
|
|
310
311
|
expect(container.innerHTML).toContain('data-value="unwrapped"');
|
|
311
|
-
expect(container.innerHTML).not.toContain('data-template');
|
|
312
|
-
expect(warn).toHaveBeenCalledWith(expect.stringContaining('missing-
|
|
312
|
+
expect(container.innerHTML).not.toContain('data-experience-template');
|
|
313
|
+
expect(warn).toHaveBeenCalledWith(expect.stringContaining('missing-experienceTemplate'));
|
|
313
314
|
warn.mockRestore();
|
|
314
315
|
});
|
|
315
316
|
});
|
|
317
|
+
describe('ServerExperienceRenderer — slot children as an array', () => {
|
|
318
|
+
const childrenPayload = () => ({
|
|
319
|
+
viewports: VIEWPORTS,
|
|
320
|
+
nodes: [
|
|
321
|
+
componentNode('contentful-container', {
|
|
322
|
+
id: 'c',
|
|
323
|
+
slots: {
|
|
324
|
+
children: [
|
|
325
|
+
componentNode('contentful-heading', {
|
|
326
|
+
id: 'a',
|
|
327
|
+
contentProperties: { text: 'one' },
|
|
328
|
+
}),
|
|
329
|
+
componentNode('contentful-heading', {
|
|
330
|
+
id: 'b',
|
|
331
|
+
contentProperties: { text: 'two' },
|
|
332
|
+
}),
|
|
333
|
+
componentNode('contentful-heading', {
|
|
334
|
+
id: 'd',
|
|
335
|
+
contentProperties: { text: 'three' },
|
|
336
|
+
}),
|
|
337
|
+
],
|
|
338
|
+
},
|
|
339
|
+
}),
|
|
340
|
+
],
|
|
341
|
+
});
|
|
342
|
+
it('passes slot children as a Snippet[] a component can wrap individually', async () => {
|
|
343
|
+
const cfg = {
|
|
344
|
+
components: {
|
|
345
|
+
'contentful-container': WrappingContainerFixture,
|
|
346
|
+
'contentful-heading': HeadingFixture,
|
|
347
|
+
},
|
|
348
|
+
};
|
|
349
|
+
const plan = await resolveExperience(childrenPayload(), cfg);
|
|
350
|
+
const { container } = render(ServerExperienceRenderer, {
|
|
351
|
+
props: { experience: plan, config: cfg },
|
|
352
|
+
});
|
|
353
|
+
// The component received a real array of the right length.
|
|
354
|
+
expect(captureSink[0].props.childrenIsArray).toBe(true);
|
|
355
|
+
expect(captureSink[0].props.childCount).toBe(3);
|
|
356
|
+
// Each child got its own wrapper — proves per-child rendering control.
|
|
357
|
+
const wrappers = container.querySelectorAll('.wrap');
|
|
358
|
+
expect(wrappers.length).toBe(3);
|
|
359
|
+
expect(container.querySelector('[data-index="0"]')).not.toBeNull();
|
|
360
|
+
expect(container.querySelector('[data-index="2"]')).not.toBeNull();
|
|
361
|
+
expect(container.textContent).toContain('one');
|
|
362
|
+
expect(container.textContent).toContain('three');
|
|
363
|
+
});
|
|
364
|
+
it('renders an empty container when the slot has no children', async () => {
|
|
365
|
+
const cfg = {
|
|
366
|
+
components: { 'contentful-container': WrappingContainerFixture },
|
|
367
|
+
};
|
|
368
|
+
const plan = await resolveExperience({ viewports: VIEWPORTS, nodes: [componentNode('contentful-container', { id: 'c' })] }, cfg);
|
|
369
|
+
const { container } = render(ServerExperienceRenderer, {
|
|
370
|
+
props: { experience: plan, config: cfg },
|
|
371
|
+
});
|
|
372
|
+
expect(captureSink[0].props.childCount).toBe(0);
|
|
373
|
+
expect(container.querySelectorAll('.wrap').length).toBe(0);
|
|
374
|
+
expect(container.querySelector('[data-container]')).not.toBeNull();
|
|
375
|
+
});
|
|
376
|
+
});
|
|
316
377
|
describe('ServerExperienceRenderer — bare-component registrations', () => {
|
|
317
378
|
it('accepts a bare Svelte component as a registry entry', async () => {
|
|
318
379
|
const cfg = { components: { item: PrecedenceFixture } };
|
|
@@ -365,7 +426,7 @@ describe('ServerExperienceRenderer — getContentfulComponent()', () => {
|
|
|
365
426
|
});
|
|
366
427
|
const contentful = captureSink[0].contentful;
|
|
367
428
|
expect(contentful).toMatchObject({
|
|
368
|
-
|
|
429
|
+
componentId: 'capture',
|
|
369
430
|
nodeId: 'btn-1',
|
|
370
431
|
content: { label: 'Buy now' },
|
|
371
432
|
design: { cfPadding: vbv({ desktop: m('40px') }) },
|
|
@@ -434,7 +495,7 @@ describe('ServerExperienceRenderer — resolveToken', () => {
|
|
|
434
495
|
expect(warn).toHaveBeenCalledWith(expect.stringContaining('contentful-button'));
|
|
435
496
|
warn.mockRestore();
|
|
436
497
|
});
|
|
437
|
-
it('leaves envelopes untouched when no resolver is supplied
|
|
498
|
+
it('leaves envelopes untouched when no resolver is supplied', async () => {
|
|
438
499
|
const cfg = { components: { 'contentful-button': ButtonFixture } };
|
|
439
500
|
const plan = await resolveExperience({
|
|
440
501
|
viewports: VIEWPORTS,
|
|
@@ -454,19 +515,19 @@ describe('ServerExperienceRenderer — resolveToken', () => {
|
|
|
454
515
|
// unchanged, so the customer can inspect it or resolve it themselves.
|
|
455
516
|
expect(container.innerHTML).toContain('data-bg="[object Object]"');
|
|
456
517
|
});
|
|
457
|
-
it('runs on page-level
|
|
518
|
+
it('runs on page-level experienceTemplate design props too', async () => {
|
|
458
519
|
const tplConfig = {
|
|
459
520
|
components: { item: PrecedenceFixture },
|
|
460
|
-
|
|
521
|
+
experienceTemplates: { page: ExperienceTemplateFixture },
|
|
461
522
|
resolveToken: (ref) => (ref.value === 'brand/canvas' ? '#111827' : undefined),
|
|
462
523
|
};
|
|
463
524
|
const tplPayload = {
|
|
464
525
|
sys: {
|
|
465
|
-
|
|
526
|
+
experienceTemplate: {
|
|
466
527
|
sys: {
|
|
467
528
|
type: 'ResourceLink',
|
|
468
|
-
linkType: 'Contentful:
|
|
469
|
-
urn: 'crn:contentful:::experience:spaces/$self/environments/$self/
|
|
529
|
+
linkType: 'Contentful:ExperienceTemplate',
|
|
530
|
+
urn: 'crn:contentful:::experience:spaces/$self/environments/$self/experienceTemplates/page',
|
|
470
531
|
},
|
|
471
532
|
},
|
|
472
533
|
},
|
|
@@ -475,8 +536,8 @@ describe('ServerExperienceRenderer — resolveToken', () => {
|
|
|
475
536
|
};
|
|
476
537
|
const plan = await resolveExperience(tplPayload, tplConfig);
|
|
477
538
|
// Templates don't carry design props in the current XDA payload shape;
|
|
478
|
-
// seed one on the resolved plan so we exercise the
|
|
479
|
-
plan.
|
|
539
|
+
// seed one on the resolved plan so we exercise the experienceTemplate path.
|
|
540
|
+
plan.experienceTemplate.props.design = { cfBackground: dt('brand/canvas') };
|
|
480
541
|
const { container } = render(ServerExperienceRenderer, {
|
|
481
542
|
props: { experience: plan, config: tplConfig },
|
|
482
543
|
});
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
import { getDesignValues } from '../get-design-values.js';
|
|
5
5
|
|
|
6
|
-
let { children }: { children?: Snippet } = $props();
|
|
6
|
+
let { children }: { children?: Snippet[] } = $props();
|
|
7
7
|
const design = $derived(getDesignValues());
|
|
8
8
|
</script>
|
|
9
9
|
|
|
10
10
|
<div data-padding={design.cfPadding as string}>
|
|
11
|
-
{#
|
|
11
|
+
{#each children ?? [] as child}
|
|
12
|
+
{@render child()}
|
|
13
|
+
{/each}
|
|
12
14
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
type $$ComponentProps = {
|
|
3
|
-
children?: Snippet;
|
|
3
|
+
children?: Snippet[];
|
|
4
4
|
};
|
|
5
5
|
declare const ContainerFixture: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
6
|
type ContainerFixture = ReturnType<typeof ContainerFixture>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContainerFixture.svelte.d.ts","sourceRoot":"","sources":["../../src/test-fixtures/ContainerFixture.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAIrC,KAAK,gBAAgB,GAAI;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"ContainerFixture.svelte.d.ts","sourceRoot":"","sources":["../../src/test-fixtures/ContainerFixture.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAIrC,KAAK,gBAAgB,GAAI;IAAE,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAA;CAAE,CAAC;AAkBnD,QAAA,MAAM,gBAAgB,sDAAwC,CAAC;AAC/D,KAAK,gBAAgB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC5D,eAAe,gBAAgB,CAAC"}
|
|
@@ -13,6 +13,6 @@
|
|
|
13
13
|
const design = $derived(getDesignValues());
|
|
14
14
|
</script>
|
|
15
15
|
|
|
16
|
-
<main data-template="page" data-title={title} data-bg={design.cfBackground as string}>
|
|
16
|
+
<main data-experience-template="page" data-title={title} data-bg={design.cfBackground as string}>
|
|
17
17
|
{@render children()}
|
|
18
18
|
</main>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
title?: string;
|
|
4
|
+
children: Snippet;
|
|
5
|
+
};
|
|
6
|
+
declare const ExperienceTemplateFixture: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type ExperienceTemplateFixture = ReturnType<typeof ExperienceTemplateFixture>;
|
|
8
|
+
export default ExperienceTemplateFixture;
|
|
9
|
+
//# sourceMappingURL=ExperienceTemplateFixture.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExperienceTemplateFixture.svelte.d.ts","sourceRoot":"","sources":["../../src/test-fixtures/ExperienceTemplateFixture.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAIrC,KAAK,gBAAgB,GAAI;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAmBJ,QAAA,MAAM,yBAAyB,sDAAwC,CAAC;AACxE,KAAK,yBAAyB,GAAG,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC9E,eAAe,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Test fixture: proves slot children arrive as an array of Snippets that a
|
|
3
|
+
component can iterate and wrap individually. Also records the received array
|
|
4
|
+
length in the capture sink.
|
|
5
|
+
-->
|
|
6
|
+
<script lang="ts">
|
|
7
|
+
import type { Snippet } from 'svelte';
|
|
8
|
+
|
|
9
|
+
import { getContentfulComponent, getExperience } from '../context.js';
|
|
10
|
+
import { captureSink } from './capture-sink.js';
|
|
11
|
+
|
|
12
|
+
let { children }: { children?: Snippet[] } = $props();
|
|
13
|
+
|
|
14
|
+
captureSink.push({
|
|
15
|
+
props: { childCount: children?.length ?? 0, childrenIsArray: Array.isArray(children) },
|
|
16
|
+
experience: getExperience(),
|
|
17
|
+
contentful: getContentfulComponent(),
|
|
18
|
+
});
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<div data-container>
|
|
22
|
+
{#each children ?? [] as child, i}
|
|
23
|
+
<div class="wrap" data-index={i}>
|
|
24
|
+
{@render child()}
|
|
25
|
+
</div>
|
|
26
|
+
{/each}
|
|
27
|
+
</div>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
children?: Snippet[];
|
|
4
|
+
};
|
|
5
|
+
declare const WrappingContainerFixture: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
+
type WrappingContainerFixture = ReturnType<typeof WrappingContainerFixture>;
|
|
7
|
+
export default WrappingContainerFixture;
|
|
8
|
+
//# sourceMappingURL=WrappingContainerFixture.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WrappingContainerFixture.svelte.d.ts","sourceRoot":"","sources":["../../src/test-fixtures/WrappingContainerFixture.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAKrC,KAAK,gBAAgB,GAAI;IAAE,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAA;CAAE,CAAC;AA2BnD,QAAA,MAAM,wBAAwB,sDAAwC,CAAC;AACvE,KAAK,wBAAwB,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC5E,eAAe,wBAAwB,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export type { ResolveContext, ResolveToken };
|
|
|
5
5
|
* The full Contentful-side payload for a single component instance, exposed
|
|
6
6
|
* via `getContentfulComponent()` to any descendant of a rendered Experience
|
|
7
7
|
* node. Useful for custom design-property resolution outside the SDK's
|
|
8
|
-
* cascade, branching by `
|
|
8
|
+
* cascade, branching by `componentId` in a generic wrapper, keying
|
|
9
9
|
* analytics on `nodeId`, rendering a raw-payload panel in preview, or
|
|
10
10
|
* rendering non-`children` slots through the exported `<NodesRenderer />`.
|
|
11
11
|
*
|
|
@@ -14,7 +14,7 @@ export type { ResolveContext, ResolveToken };
|
|
|
14
14
|
* resolved values are what `getDesignValues()` returns.
|
|
15
15
|
*/
|
|
16
16
|
export interface ContentfulComponent {
|
|
17
|
-
|
|
17
|
+
componentId: string;
|
|
18
18
|
nodeId?: string;
|
|
19
19
|
content: Record<string, unknown>;
|
|
20
20
|
design: Record<string, DesignPropValue>;
|
|
@@ -28,11 +28,12 @@ export interface ContentfulComponent {
|
|
|
28
28
|
slots: Record<string, unknown>;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
|
-
* Same shape as `ContentfulComponent`, but for the page-level
|
|
32
|
-
*
|
|
31
|
+
* Same shape as `ContentfulComponent`, but for the page-level Experience
|
|
32
|
+
* Template.
|
|
33
|
+
* Exposed via `getContentfulExperienceTemplate()` inside an Experience Template's component tree.
|
|
33
34
|
*/
|
|
34
|
-
export interface
|
|
35
|
-
|
|
35
|
+
export interface ContentfulExperienceTemplate {
|
|
36
|
+
experienceTemplateId: string;
|
|
36
37
|
content: Record<string, unknown>;
|
|
37
38
|
design: Record<string, DesignPropValue>;
|
|
38
39
|
resolved?: Record<string, unknown>;
|
|
@@ -68,19 +69,19 @@ export interface ComponentConfig<Props extends object = Record<string, unknown>>
|
|
|
68
69
|
* card: defineComponent<CardProps>({ component: Card, resolveData: ... }),
|
|
69
70
|
*/
|
|
70
71
|
export type Registration<Props extends object = Record<string, unknown>> = Component<any> | ComponentConfig<Props>;
|
|
71
|
-
export interface
|
|
72
|
+
export interface ExperienceTemplateConfig<Props extends object = Record<string, unknown>> {
|
|
72
73
|
defaults?: Partial<Props>;
|
|
73
74
|
resolveData?: (ctx: ResolveContext) => Partial<Props> | Promise<Partial<Props>>;
|
|
74
75
|
component: Component<any>;
|
|
75
76
|
}
|
|
76
|
-
export type
|
|
77
|
-
export declare function
|
|
77
|
+
export type ExperienceTemplateRegistration<Props extends object = Record<string, unknown>> = Component<any> | ExperienceTemplateConfig<Props>;
|
|
78
|
+
export declare function defineExperienceTemplate<Props extends object = Record<string, unknown>>(config: ExperienceTemplateConfig<Props>): ExperienceTemplateConfig<Props>;
|
|
78
79
|
export declare function defineComponent<Props extends object = Record<string, unknown>>(config: ComponentConfig<Props>): ComponentConfig<Props>;
|
|
79
80
|
export type Components = Record<string, Registration<any>>;
|
|
80
|
-
export type
|
|
81
|
+
export type ExperienceTemplates = Record<string, ExperienceTemplateRegistration<any>>;
|
|
81
82
|
export interface Config {
|
|
82
83
|
components: Components;
|
|
83
|
-
|
|
84
|
+
experienceTemplates?: ExperienceTemplates;
|
|
84
85
|
/**
|
|
85
86
|
* Resolves `DesignToken` envelopes to runtime values before they reach a
|
|
86
87
|
* component. If omitted, envelopes pass through unchanged. See `ResolveToken`
|
|
@@ -95,5 +96,5 @@ export interface Config {
|
|
|
95
96
|
* a `component` field, so `typeof` is enough to discriminate.
|
|
96
97
|
*/
|
|
97
98
|
export declare function normalizeComponentRegistration<P extends object>(reg: Registration<P>): ComponentConfig<P>;
|
|
98
|
-
export declare function
|
|
99
|
+
export declare function normalizeExperienceTemplateRegistration<P extends object>(reg: ExperienceTemplateRegistration<P>): ExperienceTemplateConfig<P>;
|
|
99
100
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,WAAW,EACZ,MAAM,kCAAkC,CAAC;AAE1C,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC;AAE7C;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,mBAAmB;IAClC,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,WAAW,EACZ,MAAM,kCAAkC,CAAC;AAE1C,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC;AAE7C;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC;;;;;OAKG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
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function
|
|
1
|
+
export function defineExperienceTemplate(config) {
|
|
2
2
|
return config;
|
|
3
3
|
}
|
|
4
4
|
export function defineComponent(config) {
|
|
@@ -17,7 +17,7 @@ export function normalizeComponentRegistration(reg) {
|
|
|
17
17
|
}
|
|
18
18
|
return reg;
|
|
19
19
|
}
|
|
20
|
-
export function
|
|
20
|
+
export function normalizeExperienceTemplateRegistration(reg) {
|
|
21
21
|
if (typeof reg === 'function') {
|
|
22
22
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
23
|
return { component: reg };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experiences-svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
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.
|
|
39
|
-
"@contentful/experiences-sdk-core": "0.
|
|
40
|
-
"@contentful/experiences-design": "0.
|
|
38
|
+
"@contentful/experiences-client": "0.3.0",
|
|
39
|
+
"@contentful/experiences-sdk-core": "0.7.0",
|
|
40
|
+
"@contentful/experiences-design": "0.7.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"svelte": "^5.55.7"
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@testing-library/jest-dom": "^6.9.1",
|
|
49
49
|
"@testing-library/svelte": "^5.4.2",
|
|
50
50
|
"jsdom": "^29.1.1",
|
|
51
|
-
"publint": "^0.3.
|
|
51
|
+
"publint": "^0.3.23",
|
|
52
52
|
"svelte": "^5.56.8",
|
|
53
53
|
"svelte-check": "^4.7.4"
|
|
54
54
|
}
|