@contentful/experiences-svelte 0.3.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 +52 -0
- package/README.md +107 -0
- package/dist/ClientExperienceRenderer.svelte +81 -0
- package/dist/ClientExperienceRenderer.svelte.d.ts +4 -0
- package/dist/ClientExperienceRenderer.svelte.d.ts.map +1 -0
- package/dist/MissingComponent.svelte +35 -0
- package/dist/MissingComponent.svelte.d.ts +5 -0
- package/dist/MissingComponent.svelte.d.ts.map +1 -0
- package/dist/NodeRenderer.svelte +83 -0
- package/dist/NodeRenderer.svelte.d.ts +15 -0
- package/dist/NodeRenderer.svelte.d.ts.map +1 -0
- package/dist/NodesRenderer.svelte +51 -0
- package/dist/NodesRenderer.svelte.d.ts +14 -0
- package/dist/NodesRenderer.svelte.d.ts.map +1 -0
- package/dist/ServerExperienceRenderer.svelte +70 -0
- package/dist/ServerExperienceRenderer.svelte.d.ts +5 -0
- package/dist/ServerExperienceRenderer.svelte.d.ts.map +1 -0
- package/dist/WrapWithTemplate.svelte +87 -0
- package/dist/WrapWithTemplate.svelte.d.ts +13 -0
- package/dist/WrapWithTemplate.svelte.d.ts.map +1 -0
- package/dist/component-props.d.ts +18 -0
- package/dist/component-props.d.ts.map +1 -0
- package/dist/component-props.js +13 -0
- package/dist/context.d.ts +20 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +61 -0
- package/dist/design-utils.d.ts +16 -0
- package/dist/design-utils.d.ts.map +1 -0
- package/dist/design-utils.js +27 -0
- package/dist/get-design-values.d.ts +14 -0
- package/dist/get-design-values.d.ts.map +1 -0
- package/dist/get-design-values.js +16 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/server-renderer.test.d.ts +2 -0
- package/dist/server-renderer.test.d.ts.map +1 -0
- package/dist/server-renderer.test.js +566 -0
- package/dist/test-fixtures/ButtonFixture.svelte +8 -0
- package/dist/test-fixtures/ButtonFixture.svelte.d.ts +7 -0
- package/dist/test-fixtures/ButtonFixture.svelte.d.ts.map +1 -0
- package/dist/test-fixtures/CapturingComponent.svelte +18 -0
- package/dist/test-fixtures/CapturingComponent.svelte.d.ts +4 -0
- package/dist/test-fixtures/CapturingComponent.svelte.d.ts.map +1 -0
- package/dist/test-fixtures/ContainerFixture.svelte +12 -0
- package/dist/test-fixtures/ContainerFixture.svelte.d.ts +8 -0
- package/dist/test-fixtures/ContainerFixture.svelte.d.ts.map +1 -0
- package/dist/test-fixtures/HeadingFixture.svelte +8 -0
- package/dist/test-fixtures/HeadingFixture.svelte.d.ts +7 -0
- package/dist/test-fixtures/HeadingFixture.svelte.d.ts.map +1 -0
- package/dist/test-fixtures/ItemFixture.svelte +11 -0
- package/dist/test-fixtures/ItemFixture.svelte.d.ts +8 -0
- package/dist/test-fixtures/ItemFixture.svelte.d.ts.map +1 -0
- package/dist/test-fixtures/PrecedenceFixture.svelte +5 -0
- package/dist/test-fixtures/PrecedenceFixture.svelte.d.ts +7 -0
- package/dist/test-fixtures/PrecedenceFixture.svelte.d.ts.map +1 -0
- package/dist/test-fixtures/TemplateFixture.svelte +18 -0
- package/dist/test-fixtures/TemplateFixture.svelte.d.ts +9 -0
- package/dist/test-fixtures/TemplateFixture.svelte.d.ts.map +1 -0
- package/dist/test-fixtures/capture-sink.d.ts +10 -0
- package/dist/test-fixtures/capture-sink.d.ts.map +1 -0
- package/dist/test-fixtures/capture-sink.js +5 -0
- package/dist/types.d.ts +99 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +26 -0
- package/dist/use-active-viewport.svelte.d.ts +14 -0
- package/dist/use-active-viewport.svelte.d.ts.map +1 -0
- package/dist/use-active-viewport.svelte.js +83 -0
- package/package.json +55 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Component } from 'svelte';
|
|
2
|
+
import type { ExperienceContext, PortableRenderPlan } from '@contentful/experiences-core';
|
|
3
|
+
import type { Config } from './types.js';
|
|
4
|
+
export interface ServerExperienceRendererProps {
|
|
5
|
+
experience: PortableRenderPlan | null | undefined;
|
|
6
|
+
config: Config;
|
|
7
|
+
initialViewportId?: string;
|
|
8
|
+
context?: Partial<ExperienceContext>;
|
|
9
|
+
renderUnknown?: RenderUnknown;
|
|
10
|
+
}
|
|
11
|
+
export type ClientExperienceRendererProps = ServerExperienceRendererProps;
|
|
12
|
+
export interface MissingComponentProps {
|
|
13
|
+
componentTypeId: string;
|
|
14
|
+
/** Optional — only present when the payload supplied an id for this node. */
|
|
15
|
+
nodeId?: string;
|
|
16
|
+
}
|
|
17
|
+
export type RenderUnknown = Component<MissingComponentProps>;
|
|
18
|
+
//# sourceMappingURL=component-props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-props.d.ts","sourceRoot":"","sources":["../src/component-props.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAE1F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,WAAW,6BAA6B;IAC5C,UAAU,EAAE,kBAAkB,GAAG,IAAI,GAAG,SAAS,CAAC;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACrC,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,MAAM,MAAM,6BAA6B,GAAG,6BAA6B,CAAC;AAE1E,MAAM,WAAW,qBAAqB;IACpC,eAAe,EAAE,MAAM,CAAC;IACxB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,aAAa,GAAG,SAAS,CAAC,qBAAqB,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Public prop-shape types for the renderer components. They're declared
|
|
3
|
+
* here (rather than inside `<script module>` blocks of the .svelte files)
|
|
4
|
+
* so that:
|
|
5
|
+
*
|
|
6
|
+
* - `tsc --noEmit` typechecks the package without the Svelte language
|
|
7
|
+
* server. tsc can't see exports inside a .svelte module block;
|
|
8
|
+
* `svelte-check` can. Keeping prop types in plain TS keeps both happy.
|
|
9
|
+
* - `index.ts` re-exports them with `export type`, which compiles cleanly.
|
|
10
|
+
*
|
|
11
|
+
* The .svelte files import these and use them as their `$props()` type.
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ContentfulComponent, ContentfulTemplate, RenderContext } from './types.js';
|
|
2
|
+
export declare function setExperience(ctx: RenderContext): void;
|
|
3
|
+
export declare function setContentfulComponent(node: ContentfulComponent): void;
|
|
4
|
+
export declare function setContentfulTemplate(tpl: ContentfulTemplate): void;
|
|
5
|
+
/**
|
|
6
|
+
* Publish the resolved design values for the enclosing node/template. Takes a
|
|
7
|
+
* getter (not a snapshot) so callers reading it inside a `$derived` stay
|
|
8
|
+
* reactive across viewport changes.
|
|
9
|
+
*/
|
|
10
|
+
export declare function setResolvedDesign(getDesign: () => Record<string, unknown>): void;
|
|
11
|
+
export declare function getExperience(): RenderContext;
|
|
12
|
+
export declare function getContentfulComponent(): ContentfulComponent | undefined;
|
|
13
|
+
export declare function getContentfulTemplate(): ContentfulTemplate | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Read the design values the renderer resolved for the enclosing node or
|
|
16
|
+
* template. Returns `undefined` outside a rendered node/template, which
|
|
17
|
+
* `getDesignValues` treats as "nothing to read."
|
|
18
|
+
*/
|
|
19
|
+
export declare function getResolvedDesign(): Record<string, unknown> | undefined;
|
|
20
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAOzF,wBAAgB,aAAa,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAEtD;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,mBAAmB,GAAG,IAAI,CAEtE;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,kBAAkB,GAAG,IAAI,CAEnE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAEhF;AAED,wBAAgB,aAAa,IAAI,aAAa,CAQ7C;AAED,wBAAgB,sBAAsB,IAAI,mBAAmB,GAAG,SAAS,CAExE;AAED,wBAAgB,qBAAqB,IAAI,kBAAkB,GAAG,SAAS,CAEtE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAGvE"}
|
package/dist/context.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Svelte context keys + helpers that expose runtime context and the raw
|
|
3
|
+
* Contentful payload to descendants of a rendered Experience. Customer
|
|
4
|
+
* components receive only their declared props via the renderer; anything
|
|
5
|
+
* that needs the Experience runtime context or the underlying payload calls
|
|
6
|
+
* the helper from the top of its `<script>` block.
|
|
7
|
+
*
|
|
8
|
+
* Reactivity: the client renderer stores a `$state` proxy in context, so
|
|
9
|
+
* reads through the returned object (`exp.activeViewport`, from the
|
|
10
|
+
* template or a `$derived`) stay reactive across viewport changes.
|
|
11
|
+
* Destructuring the return of `getExperience()` loses that reactivity —
|
|
12
|
+
* same rule as Svelte 5 `$props()`.
|
|
13
|
+
*
|
|
14
|
+
* `getContext` / `setContext` must be called during synchronous component
|
|
15
|
+
* initialization (top of the `<script>` block), not inside async callbacks
|
|
16
|
+
* or event handlers.
|
|
17
|
+
*/
|
|
18
|
+
import { getContext, setContext } from 'svelte';
|
|
19
|
+
const EXPERIENCE_KEY = Symbol('@contentful/experiences-svelte::experience');
|
|
20
|
+
const COMPONENT_KEY = Symbol('@contentful/experiences-svelte::contentful-component');
|
|
21
|
+
const TEMPLATE_KEY = Symbol('@contentful/experiences-svelte::contentful-template');
|
|
22
|
+
const RESOLVED_DESIGN_KEY = Symbol('@contentful/experiences-svelte::resolved-design');
|
|
23
|
+
export function setExperience(ctx) {
|
|
24
|
+
setContext(EXPERIENCE_KEY, ctx);
|
|
25
|
+
}
|
|
26
|
+
export function setContentfulComponent(node) {
|
|
27
|
+
setContext(COMPONENT_KEY, node);
|
|
28
|
+
}
|
|
29
|
+
export function setContentfulTemplate(tpl) {
|
|
30
|
+
setContext(TEMPLATE_KEY, tpl);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Publish the resolved design values for the enclosing node/template. Takes a
|
|
34
|
+
* getter (not a snapshot) so callers reading it inside a `$derived` stay
|
|
35
|
+
* reactive across viewport changes.
|
|
36
|
+
*/
|
|
37
|
+
export function setResolvedDesign(getDesign) {
|
|
38
|
+
setContext(RESOLVED_DESIGN_KEY, getDesign);
|
|
39
|
+
}
|
|
40
|
+
export function getExperience() {
|
|
41
|
+
const ctx = getContext(EXPERIENCE_KEY);
|
|
42
|
+
if (!ctx) {
|
|
43
|
+
throw new Error('getExperience() must be called inside a <ServerExperienceRenderer> or <ClientExperienceRenderer> subtree.');
|
|
44
|
+
}
|
|
45
|
+
return ctx;
|
|
46
|
+
}
|
|
47
|
+
export function getContentfulComponent() {
|
|
48
|
+
return getContext(COMPONENT_KEY);
|
|
49
|
+
}
|
|
50
|
+
export function getContentfulTemplate() {
|
|
51
|
+
return getContext(TEMPLATE_KEY);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Read the design values the renderer resolved for the enclosing node or
|
|
55
|
+
* template. Returns `undefined` outside a rendered node/template, which
|
|
56
|
+
* `getDesignValues` treats as "nothing to read."
|
|
57
|
+
*/
|
|
58
|
+
export function getResolvedDesign() {
|
|
59
|
+
const getDesign = getContext(RESOLVED_DESIGN_KEY);
|
|
60
|
+
return getDesign?.();
|
|
61
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface ToCssOptions {
|
|
2
|
+
/** Keys to skip, matched against the original record key. */
|
|
3
|
+
exclude?: string[];
|
|
4
|
+
/** When set, only these keys pass through (still whitelist-filtered). */
|
|
5
|
+
include?: string[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Convert a design record into a plain style object, keeping only keys that
|
|
9
|
+
* normalize to a known CSS property. Non-CSS keys (`variant`, `as`, …) and
|
|
10
|
+
* non-scalar values are dropped; read those off the `getDesignValues()`
|
|
11
|
+
* record directly.
|
|
12
|
+
*
|
|
13
|
+
* toCss({ fontSize: '20px', variant: 'h1' }) //=> { fontSize: '20px' }
|
|
14
|
+
*/
|
|
15
|
+
export declare function toCss(design: object, { include, exclude }?: ToCssOptions): Record<string, string | number>;
|
|
16
|
+
//# sourceMappingURL=design-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"design-utils.d.ts","sourceRoot":"","sources":["../src/design-utils.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,KAAK,CACnB,MAAM,EAAE,MAAM,EACd,EAAE,OAAO,EAAE,OAAO,EAAE,GAAE,YAAiB,GACtC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAYjC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { isCssProperty, toCssKey } from '@contentful/experiences-design';
|
|
2
|
+
/**
|
|
3
|
+
* Convert a design record into a plain style object, keeping only keys that
|
|
4
|
+
* normalize to a known CSS property. Non-CSS keys (`variant`, `as`, …) and
|
|
5
|
+
* non-scalar values are dropped; read those off the `getDesignValues()`
|
|
6
|
+
* record directly.
|
|
7
|
+
*
|
|
8
|
+
* toCss({ fontSize: '20px', variant: 'h1' }) //=> { fontSize: '20px' }
|
|
9
|
+
*/
|
|
10
|
+
export function toCss(design, { include, exclude } = {}) {
|
|
11
|
+
const out = {};
|
|
12
|
+
for (const [key, value] of Object.entries(design)) {
|
|
13
|
+
if (include && !include.includes(key))
|
|
14
|
+
continue;
|
|
15
|
+
if (exclude?.includes(key))
|
|
16
|
+
continue;
|
|
17
|
+
if (value === undefined || value === null)
|
|
18
|
+
continue;
|
|
19
|
+
if (typeof value !== 'string' && typeof value !== 'number')
|
|
20
|
+
continue;
|
|
21
|
+
const cssKey = toCssKey(key);
|
|
22
|
+
if (!isCssProperty(cssKey))
|
|
23
|
+
continue;
|
|
24
|
+
out[cssKey] = value;
|
|
25
|
+
}
|
|
26
|
+
return out;
|
|
27
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read the current node's resolved design values (viewport-cascaded +
|
|
3
|
+
* token-resolved). Returns `{}` when there's no design in scope. Read it
|
|
4
|
+
* inside a `$derived` to stay current across viewport changes.
|
|
5
|
+
*
|
|
6
|
+
* Pass a type argument to shape the bag:
|
|
7
|
+
*
|
|
8
|
+
* const design = $derived(getDesignValues<{ as?: 'h1' | 'h2' }>());
|
|
9
|
+
*
|
|
10
|
+
* `T` is a convenience assertion, not validated at runtime — treat keys as
|
|
11
|
+
* possibly `undefined`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getDesignValues<T extends object = Record<string, unknown>>(): T;
|
|
14
|
+
//# sourceMappingURL=get-design-values.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-design-values.d.ts","sourceRoot":"","sources":["../src/get-design-values.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,CAE/E"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { getResolvedDesign } from './context.js';
|
|
2
|
+
/**
|
|
3
|
+
* Read the current node's resolved design values (viewport-cascaded +
|
|
4
|
+
* token-resolved). Returns `{}` when there's no design in scope. Read it
|
|
5
|
+
* inside a `$derived` to stay current across viewport changes.
|
|
6
|
+
*
|
|
7
|
+
* Pass a type argument to shape the bag:
|
|
8
|
+
*
|
|
9
|
+
* const design = $derived(getDesignValues<{ as?: 'h1' | 'h2' }>());
|
|
10
|
+
*
|
|
11
|
+
* `T` is a convenience assertion, not validated at runtime — treat keys as
|
|
12
|
+
* possibly `undefined`.
|
|
13
|
+
*/
|
|
14
|
+
export function getDesignValues() {
|
|
15
|
+
return (getResolvedDesign() ?? {});
|
|
16
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { default as ClientExperienceRenderer } from './ClientExperienceRenderer.svelte';
|
|
2
|
+
export { default as ExperienceRenderer } from './ClientExperienceRenderer.svelte';
|
|
3
|
+
export { default as ServerExperienceRenderer } from './ServerExperienceRenderer.svelte';
|
|
4
|
+
export { default as MissingComponent } from './MissingComponent.svelte';
|
|
5
|
+
export { default as NodesRenderer } from './NodesRenderer.svelte';
|
|
6
|
+
export { useActiveViewport } from './use-active-viewport.svelte.js';
|
|
7
|
+
export type { UseActiveViewportResult } from './use-active-viewport.svelte.js';
|
|
8
|
+
export { getExperience, getContentfulComponent, getContentfulTemplate } from './context.js';
|
|
9
|
+
export { getDesignValues } from './get-design-values.js';
|
|
10
|
+
export { toCss } from './design-utils.js';
|
|
11
|
+
export type { ToCssOptions } from './design-utils.js';
|
|
12
|
+
export type { ClientExperienceRendererProps, ClientExperienceRendererProps as ExperienceRendererProps, MissingComponentProps, RenderUnknown, ServerExperienceRendererProps, } from './component-props.js';
|
|
13
|
+
export { defineComponent, defineTemplate, normalizeComponentRegistration, normalizeTemplateRegistration, } from './types.js';
|
|
14
|
+
export type { ComponentConfig, Components, Config, ContentfulComponent, ContentfulTemplate, Registration, RenderContext, ResolveToken, TemplateConfig, TemplateRegistration, Templates, } from './types.js';
|
|
15
|
+
export { resolveExperience } from '@contentful/experiences-core';
|
|
16
|
+
export type { ResolverConfig, ResolveExperienceOptions } from '@contentful/experiences-core';
|
|
17
|
+
export type { ComponentTypeNode, ComponentTypeRef, DesignPropValue, DesignToken, ExperienceContext, ExperienceNode, ExperiencePayload, ExperienceSys, ManualDesignValue, PortableRegistration, PortableRenderNode, PortableRenderPlan, PortableTemplate, ResolveContext, TemplateNode, TemplateRef, ValuesByViewport, ViewportDef, } from '@contentful/experiences-core';
|
|
18
|
+
export { CSS_PROPERTIES, getValueForViewport, getViewportIndex, isCssProperty, resolveDesignProperties, toCssKey, toCssMediaQuery, } from '@contentful/experiences-design';
|
|
19
|
+
export { ContentfulViewDelivery, ContentfulViewDeliveryClient, NotFoundError, createClient, fetchExperience, } from '@contentful/experiences-client';
|
|
20
|
+
export type { ClientOptions, CreateClientOptions, ExperienceOptions, ResolveOptions, } from '@contentful/experiences-client';
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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;AAIxE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAElE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,YAAY,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAG/E,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAItD,YAAY,EACV,6BAA6B,EAC7B,6BAA6B,IAAI,uBAAuB,EACxD,qBAAqB,EACrB,aAAa,EACb,6BAA6B,GAC9B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,eAAe,EACf,cAAc,EACd,8BAA8B,EAC9B,6BAA6B,GAC9B,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,eAAe,EACf,UAAU,EACV,MAAM,EACN,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,cAAc,EACd,oBAAoB,EACpB,SAAS,GACV,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,YAAY,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAG7F,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,WAAW,GACZ,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,uBAAuB,EACvB,QAAQ,EACR,eAAe,GAChB,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAC5B,aAAa,EACb,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
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Public API surface for `@contentful/experiences-svelte`.
|
|
3
|
+
*
|
|
4
|
+
* Customers add ONLY this package to their app's dependencies. Everything
|
|
5
|
+
* needed to render an Experience — types, the resolver, viewport utilities,
|
|
6
|
+
* the renderer components, the authoring helpers — is re-exported from here.
|
|
7
|
+
* The internal `@contentful/experiences-core` and
|
|
8
|
+
* `@contentful/experiences-design` packages are workspace-only implementation
|
|
9
|
+
* details; they are not part of the public API.
|
|
10
|
+
*
|
|
11
|
+
* `ExperienceRenderer` is an alias for `ClientExperienceRenderer`; SSR
|
|
12
|
+
* consumers explicitly import `ServerExperienceRenderer`.
|
|
13
|
+
*/
|
|
14
|
+
// ─── Renderers ─────────────────────────────────────────────────────────────
|
|
15
|
+
export { default as ClientExperienceRenderer } from './ClientExperienceRenderer.svelte';
|
|
16
|
+
export { default as ExperienceRenderer } from './ClientExperienceRenderer.svelte';
|
|
17
|
+
export { default as ServerExperienceRenderer } from './ServerExperienceRenderer.svelte';
|
|
18
|
+
export { default as MissingComponent } from './MissingComponent.svelte';
|
|
19
|
+
// Exposed so advanced customers can render non-`children` slots manually:
|
|
20
|
+
// e.g. `<NodesRenderer nodes={contentful.slots.header as PortableRenderNode[]} ... />`.
|
|
21
|
+
export { default as NodesRenderer } from './NodesRenderer.svelte';
|
|
22
|
+
export { useActiveViewport } from './use-active-viewport.svelte.js';
|
|
23
|
+
// ─── Runtime context helpers ─────────────────────────────────────────────
|
|
24
|
+
export { getExperience, getContentfulComponent, getContentfulTemplate } from './context.js';
|
|
25
|
+
export { getDesignValues } from './get-design-values.js';
|
|
26
|
+
export { toCss } from './design-utils.js';
|
|
27
|
+
// ─── Authoring helpers + Config types ─────────────────────────────────────
|
|
28
|
+
export { defineComponent, defineTemplate, normalizeComponentRegistration, normalizeTemplateRegistration, } from './types.js';
|
|
29
|
+
// ─── Resolver (re-exported from render-core) ──────────────────────────────
|
|
30
|
+
export { resolveExperience } from '@contentful/experiences-core';
|
|
31
|
+
// ─── Design utilities (re-exported from design) ───────────────────────────
|
|
32
|
+
export { CSS_PROPERTIES, getValueForViewport, getViewportIndex, isCssProperty, resolveDesignProperties, toCssKey, toCssMediaQuery, } from '@contentful/experiences-design';
|
|
33
|
+
// ─── Delivery client + fetchExperience ────────────────────────────────────
|
|
34
|
+
export { ContentfulViewDelivery, ContentfulViewDeliveryClient, NotFoundError, createClient, fetchExperience, } from '@contentful/experiences-client';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-renderer.test.d.ts","sourceRoot":"","sources":["../src/server-renderer.test.ts"],"names":[],"mappings":""}
|