@se-studio/core-ui 1.0.3 → 1.0.4
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/dist/CmsRendererConfig.d.ts +6 -6
- package/dist/CmsRendererConfig.d.ts.map +1 -1
- package/dist/components/Animation.d.ts +3 -0
- package/dist/components/Animation.d.ts.map +1 -0
- package/dist/components/Animation.js +2 -0
- package/dist/components/Animation.js.map +1 -0
- package/dist/components/AnimationComponent.d.ts +7 -11
- package/dist/components/AnimationComponent.d.ts.map +1 -1
- package/dist/components/AnimationComponent.js +15 -3
- package/dist/components/AnimationComponent.js.map +1 -1
- package/dist/components/AnimationServer.d.ts +9 -0
- package/dist/components/AnimationServer.d.ts.map +1 -0
- package/dist/components/AnimationServer.js +34 -0
- package/dist/components/AnimationServer.js.map +1 -0
- package/dist/components/CmsCollection.d.ts +10 -14
- package/dist/components/CmsCollection.d.ts.map +1 -1
- package/dist/components/CmsCollection.js +19 -22
- package/dist/components/CmsCollection.js.map +1 -1
- package/dist/components/CmsComponent.d.ts +10 -14
- package/dist/components/CmsComponent.d.ts.map +1 -1
- package/dist/components/CmsComponent.js +19 -11
- package/dist/components/CmsComponent.js.map +1 -1
- package/dist/components/CmsContent.d.ts +5 -0
- package/dist/components/CmsContent.d.ts.map +1 -1
- package/dist/components/CmsContent.js.map +1 -1
- package/dist/components/CmsEmbeddedContent.d.ts +6 -0
- package/dist/components/CmsEmbeddedContent.d.ts.map +1 -0
- package/dist/components/{EmbeddedContent.js → CmsEmbeddedContent.js} +9 -10
- package/dist/components/CmsEmbeddedContent.js.map +1 -0
- package/dist/components/CmsExternalComponent.d.ts +10 -14
- package/dist/components/CmsExternalComponent.d.ts.map +1 -1
- package/dist/components/CmsExternalComponent.js +19 -21
- package/dist/components/CmsExternalComponent.js.map +1 -1
- package/dist/components/ExternalVideoComponent.d.ts +9 -0
- package/dist/components/ExternalVideoComponent.d.ts.map +1 -0
- package/dist/components/ExternalVideoComponent.js +32 -0
- package/dist/components/ExternalVideoComponent.js.map +1 -0
- package/dist/components/ExternalVideoServer.d.ts +9 -0
- package/dist/components/ExternalVideoServer.d.ts.map +1 -0
- package/dist/components/ExternalVideoServer.js +26 -0
- package/dist/components/ExternalVideoServer.js.map +1 -0
- package/dist/components/ExternalVimeoEmbed.d.ts +10 -0
- package/dist/components/ExternalVimeoEmbed.d.ts.map +1 -0
- package/dist/components/ExternalVimeoEmbed.js +18 -0
- package/dist/components/ExternalVimeoEmbed.js.map +1 -0
- package/dist/components/ExternalYouTubeEmbed.d.ts +9 -0
- package/dist/components/ExternalYouTubeEmbed.d.ts.map +1 -0
- package/dist/components/ExternalYouTubeEmbed.js +17 -0
- package/dist/components/ExternalYouTubeEmbed.js.map +1 -0
- package/dist/components/{LocalVideo.d.ts → LocalVideoServer.d.ts} +3 -3
- package/dist/components/LocalVideoServer.d.ts.map +1 -0
- package/dist/components/{LocalVideo.js → LocalVideoServer.js} +3 -3
- package/dist/components/LocalVideoServer.js.map +1 -0
- package/dist/components/VideoComponent.d.ts.map +1 -1
- package/dist/components/VideoComponent.js +7 -3
- package/dist/components/VideoComponent.js.map +1 -1
- package/dist/components/VisualComponent.d.ts.map +1 -1
- package/dist/components/VisualComponent.js +2 -2
- package/dist/components/VisualComponent.js.map +1 -1
- package/dist/components/svg.d.ts +3 -0
- package/dist/components/svg.d.ts.map +1 -0
- package/dist/components/svg.js +64 -0
- package/dist/components/svg.js.map +1 -0
- package/dist/elements/RtfOrString.d.ts +1 -0
- package/dist/elements/RtfOrString.d.ts.map +1 -1
- package/dist/elements/RtfOrString.js +2 -2
- package/dist/elements/RtfOrString.js.map +1 -1
- package/dist/index.d.ts +4 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/rtf/rtf.d.ts +2 -1
- package/dist/rtf/rtf.d.ts.map +1 -1
- package/dist/rtf/rtf.js +9 -7
- package/dist/rtf/rtf.js.map +1 -1
- package/package.json +5 -4
- package/dist/components/EmbeddedContent.d.ts +0 -10
- package/dist/components/EmbeddedContent.d.ts.map +0 -1
- package/dist/components/EmbeddedContent.js.map +0 -1
- package/dist/components/LocalVideo.d.ts.map +0 -1
- package/dist/components/LocalVideo.js.map +0 -1
- package/dist/embeddable/BuildEmbed.d.ts +0 -6
- package/dist/embeddable/BuildEmbed.d.ts.map +0 -1
- package/dist/embeddable/BuildEmbed.js +0 -15
- package/dist/embeddable/BuildEmbed.js.map +0 -1
- package/dist/embeddable/EmbeddableContext.d.ts +0 -14
- package/dist/embeddable/EmbeddableContext.d.ts.map +0 -1
- package/dist/embeddable/EmbeddableContext.js +0 -2
- package/dist/embeddable/EmbeddableContext.js.map +0 -1
- package/dist/embeddable/EmbeddableMaps.d.ts +0 -7
- package/dist/embeddable/EmbeddableMaps.d.ts.map +0 -1
- package/dist/embeddable/EmbeddableMaps.js +0 -7
- package/dist/embeddable/EmbeddableMaps.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { IContentContext } from '@se-studio/core-data-types';
|
|
2
2
|
import type { React } from 'next/dist/server/route-modules/app-page/vendored/rsc/entrypoints';
|
|
3
|
-
import type { CollectionMap, CollectionRenderer } from './components/CmsCollection';
|
|
4
|
-
import type { ComponentMap, ComponentRenderer } from './components/CmsComponent';
|
|
3
|
+
import type { CollectionMap, CollectionRenderer, EmbeddedCollectionMap } from './components/CmsCollection';
|
|
4
|
+
import type { ComponentMap, ComponentRenderer, EmbeddedComponentMap } from './components/CmsComponent';
|
|
5
5
|
import type { InternalLinkRenderer, VisualComponentRenderer } from './components/CmsContent';
|
|
6
|
-
import type { ExternalComponentMap } from './components/CmsExternalComponent';
|
|
6
|
+
import type { EmbeddedExternalComponentMap, ExternalComponentMap } from './components/CmsExternalComponent';
|
|
7
7
|
export type CmsRendererTypes = {
|
|
8
8
|
ComponentNameType: string;
|
|
9
9
|
ComponentType: any;
|
|
@@ -14,11 +14,11 @@ export type CmsRendererTypes = {
|
|
|
14
14
|
};
|
|
15
15
|
export interface CmsRendererConfig<TConfig extends CmsRendererTypes = CmsRendererTypes> {
|
|
16
16
|
componentMap: ComponentMap<TConfig['ComponentNameType'], TConfig['ComponentType']>;
|
|
17
|
-
embeddedComponentMap:
|
|
17
|
+
embeddedComponentMap: EmbeddedComponentMap<TConfig['ComponentNameType'], TConfig['ComponentType']>;
|
|
18
18
|
collectionMap: CollectionMap<TConfig['CollectionNameType'], TConfig['CollectionType']>;
|
|
19
|
-
embeddedCollectionMap:
|
|
19
|
+
embeddedCollectionMap: EmbeddedCollectionMap<TConfig['CollectionNameType'], TConfig['CollectionType']>;
|
|
20
20
|
externalComponentMap: ExternalComponentMap<TConfig['ExternaComponentNameType'], TConfig['ExternalComponentType']>;
|
|
21
|
-
embeddedExternalComponentMap:
|
|
21
|
+
embeddedExternalComponentMap: EmbeddedExternalComponentMap<TConfig['ExternaComponentNameType'], TConfig['ExternalComponentType']>;
|
|
22
22
|
visualComponentRenderer: VisualComponentRenderer;
|
|
23
23
|
internalLinkRenderer: InternalLinkRenderer;
|
|
24
24
|
customContentMap?: Partial<Record<string, React.FC<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CmsRendererConfig.d.ts","sourceRoot":"","sources":["../src/CmsRendererConfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kEAAkE,CAAC;AAC9F,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"CmsRendererConfig.d.ts","sourceRoot":"","sources":["../src/CmsRendererConfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kEAAkE,CAAC;AAC9F,OAAO,KAAK,EACV,aAAa,EACb,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;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AAC;IAc3C,gBAAgB,CAAC,EAAE,OAAO,CACxB,MAAM,CACJ,MAAM,EACN,KAAK,CAAC,EAAE,CAAC;QACP,WAAW,EAAE,GAAG,CAAC;QACjB,cAAc,EAAE,eAAe,CAAC;KACjC,CAAC,CACH,CACF,CAAC;IAQF,qBAAqB,EAAE,OAAO,CAAC;IAQ/B,gBAAgB,EAAE,OAAO,CAAC;IAE1B,wBAAwB,EAAE,iBAAiB,CAAC,GAAG,CAAC,CAAC;IACjD,yBAAyB,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAC;CACpD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Animation.d.ts","sourceRoot":"","sources":["../../src/components/Animation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,eAAe,CAAC,GAAG,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Animation.js","sourceRoot":"","sources":["../../src/components/Animation.ts"],"names":[],"mappings":""}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import type { IAnimation } from '@se-studio/core-data-types';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
direction?: number;
|
|
5
|
-
controls?: boolean;
|
|
6
|
-
count?: number;
|
|
7
|
-
hover?: boolean;
|
|
8
|
-
}
|
|
9
|
-
declare function Animation({ className, style, }: {
|
|
1
|
+
import type { IAnalyticsContext, IAnimation } from '@se-studio/core-data-types';
|
|
2
|
+
import type { IAnimationProps } from './Animation';
|
|
3
|
+
declare function AnimationComponent({ animation, autoplay, autoPlay, loop, intermission, loopDelay, className, style, ...props }: {
|
|
10
4
|
animation: IAnimation;
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
analyticsContext: IAnalyticsContext | null | undefined;
|
|
6
|
+
componentLabel: string | null | undefined;
|
|
7
|
+
} & IAnimationProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default AnimationComponent;
|
|
13
9
|
//# sourceMappingURL=AnimationComponent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimationComponent.d.ts","sourceRoot":"","sources":["../../src/components/AnimationComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"AnimationComponent.d.ts","sourceRoot":"","sources":["../../src/components/AnimationComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAGhF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAInD,iBAAS,kBAAkB,CAAC,EAC1B,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE;IACD,SAAS,EAAE,UAAU,CAAC;IACtB,gBAAgB,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,CAAC;IACvD,cAAc,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CAC3C,GAAG,eAAe,2CAmClB;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { cn } from '../utils/cn';
|
|
3
|
+
import { convertObjectFitAndPositionToPreserveAspectRatio } from './svg';
|
|
4
|
+
import { calculateCropDetails } from './Visual';
|
|
5
|
+
function AnimationComponent({ animation, autoplay, autoPlay, loop, intermission, loopDelay, className, style, ...props }) {
|
|
6
|
+
const { animationSrc, optimised, description, name } = animation;
|
|
7
|
+
const realAutoPlay = autoPlay ?? autoplay ?? animation.autoPlay ?? undefined;
|
|
8
|
+
const realLoop = loop ?? animation.loop ?? undefined;
|
|
9
|
+
const realLoopDelay = intermission ?? loopDelay ?? animation.loopDelay ?? undefined;
|
|
10
|
+
const { objectFit, objectPosition } = calculateCropDetails(animation);
|
|
11
|
+
const preserveAspectRatio = convertObjectFitAndPositionToPreserveAspectRatio(objectFit, objectPosition);
|
|
12
|
+
const containerStyle = optimised && optimised.width > 1 && optimised.height > 1
|
|
13
|
+
? { aspectRatio: `${optimised.width}/${optimised.height}` }
|
|
14
|
+
: undefined;
|
|
15
|
+
return (_jsx("div", { className: cn('relative', className), "aria-label": description ?? name, role: "img", style: containerStyle, children: _jsx("lottie-player", { src: animationSrc, loop: realLoop, intermission: realLoopDelay, preserveAspectRatio: preserveAspectRatio, style: style, autoplay: realAutoPlay, ...props }) }));
|
|
4
16
|
}
|
|
5
|
-
export default
|
|
17
|
+
export default AnimationComponent;
|
|
6
18
|
//# sourceMappingURL=AnimationComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimationComponent.js","sourceRoot":"","sources":["../../src/components/AnimationComponent.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"AnimationComponent.js","sourceRoot":"","sources":["../../src/components/AnimationComponent.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEjC,OAAO,EAAE,gDAAgD,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD,SAAS,kBAAkB,CAAC,EAC1B,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EAKS;IACjB,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC;IAEjE,MAAM,YAAY,GAAG,QAAQ,IAAI,QAAQ,IAAI,SAAS,CAAC,QAAQ,IAAI,SAAS,CAAC;IAC7E,MAAM,QAAQ,GAAG,IAAI,IAAI,SAAS,CAAC,IAAI,IAAI,SAAS,CAAC;IACrD,MAAM,aAAa,GAAG,YAAY,IAAI,SAAS,IAAI,SAAS,CAAC,SAAS,IAAI,SAAS,CAAC;IACpF,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,oBAAoB,CAAC,SAAS,CAAC,CAAC;IACtE,MAAM,mBAAmB,GAAG,gDAAgD,CAC1E,SAAS,EACT,cAAc,CACf,CAAC;IAEF,MAAM,cAAc,GAClB,SAAS,IAAI,SAAS,CAAC,KAAK,GAAG,CAAC,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC;QACtD,CAAC,CAAC,EAAE,WAAW,EAAE,GAAG,SAAS,CAAC,KAAK,IAAI,SAAS,CAAC,MAAM,EAAE,EAAE;QAC3D,CAAC,CAAC,SAAS,CAAC;IAEhB,OAAO,CACL,cACE,SAAS,EAAE,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,gBACxB,WAAW,IAAI,IAAI,EAC/B,IAAI,EAAC,KAAK,EACV,KAAK,EAAE,cAAc,YAErB,wBACE,GAAG,EAAE,YAAY,EACjB,IAAI,EAAE,QAAQ,EACd,YAAY,EAAE,aAAa,EAC3B,mBAAmB,EAAE,mBAAmB,EACxC,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,YAAY,KAClB,KAAK,GACT,GACE,CACP,CAAC;AACJ,CAAC;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IAnalyticsContext, IAnimation } from '@se-studio/core-data-types';
|
|
2
|
+
import type { IAnimationProps } from './Animation';
|
|
3
|
+
declare const AnimationServer: React.FC<{
|
|
4
|
+
animation: IAnimation;
|
|
5
|
+
analyticsContext: IAnalyticsContext | null | undefined;
|
|
6
|
+
componentLabel: string | null | undefined;
|
|
7
|
+
} & IAnimationProps>;
|
|
8
|
+
export default AnimationServer;
|
|
9
|
+
//# sourceMappingURL=AnimationServer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimationServer.d.ts","sourceRoot":"","sources":["../../src/components/AnimationServer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAiB,MAAM,4BAA4B,CAAC;AAC/F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAsCnD,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAC7B;IACE,SAAS,EAAE,UAAU,CAAC;IACtB,gBAAgB,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,CAAC;IACvD,cAAc,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CAC3C,GAAG,eAAe,CAKpB,CAAC;AACF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import AnimationComponent from './AnimationComponent';
|
|
3
|
+
async function loadFirstLottieFrameAsSvg(url) {
|
|
4
|
+
const response = await fetch(url, {
|
|
5
|
+
cache: 'force-cache',
|
|
6
|
+
});
|
|
7
|
+
if (!response.ok) {
|
|
8
|
+
throw new Error(`Failed to load lottie: ${response.status} (${response.statusText})`);
|
|
9
|
+
}
|
|
10
|
+
const json = (await response.json());
|
|
11
|
+
const { width, height } = getLottieDimensions(json);
|
|
12
|
+
const data = `<svg width="${width}" height="${height}" viewbox="0 0 ${width} ${height}" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" style="width: 100%; height: 100%"></svg>`;
|
|
13
|
+
return { width, height, data };
|
|
14
|
+
}
|
|
15
|
+
function getLottieDimensions(lottieJson) {
|
|
16
|
+
const width = lottieJson.w || lottieJson.width || 0;
|
|
17
|
+
const height = lottieJson.h || lottieJson.height || 0;
|
|
18
|
+
return { width, height };
|
|
19
|
+
}
|
|
20
|
+
async function tryLoadFirstOptimisedFrameAsSvg(url) {
|
|
21
|
+
try {
|
|
22
|
+
return await loadFirstLottieFrameAsSvg(url);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const AnimationServer = async ({ animation, ...props }) => {
|
|
29
|
+
const optimised = await tryLoadFirstOptimisedFrameAsSvg(animation.animationSrc);
|
|
30
|
+
const updatedAnimation = { ...animation, optimised };
|
|
31
|
+
return _jsx(AnimationComponent, { animation: updatedAnimation, ...props });
|
|
32
|
+
};
|
|
33
|
+
export default AnimationServer;
|
|
34
|
+
//# sourceMappingURL=AnimationServer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimationServer.js","sourceRoot":"","sources":["../../src/components/AnimationServer.tsx"],"names":[],"mappings":";AAEA,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAStD,KAAK,UAAU,yBAAyB,CAAC,GAAW;IAClD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAChC,KAAK,EAAE,aAAa;KACrB,CAAC,CAAC;IACH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,0BAA0B,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,UAAU,GAAG,CAAC,CAAC;IACxF,CAAC;IACD,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAoB,CAAC;IACxD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACpD,MAAM,IAAI,GAAG,eAAe,KAAK,aAAa,MAAM,kBAAkB,KAAK,IAAI,MAAM,mHAAmH,CAAC;IACzM,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AACjC,CAAC;AAED,SAAS,mBAAmB,CAAC,UAA2B;IACtD,MAAM,KAAK,GAAG,UAAU,CAAC,CAAC,IAAI,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC;IACpD,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,IAAI,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;IAEtD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC3B,CAAC;AAED,KAAK,UAAU,+BAA+B,CAAC,GAAW;IACxD,IAAI,CAAC;QACH,OAAO,MAAM,yBAAyB,CAAC,GAAG,CAAC,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,MAAM,eAAe,GAMjB,KAAK,EAAE,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IACpC,MAAM,SAAS,GAAG,MAAM,+BAA+B,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IAChF,MAAM,gBAAgB,GAAe,EAAE,GAAG,SAAS,EAAE,SAAS,EAAE,CAAC;IACjE,OAAO,KAAC,kBAAkB,IAAC,SAAS,EAAE,gBAAgB,KAAM,KAAK,GAAI,CAAC;AACxE,CAAC,CAAC;AACF,eAAe,eAAe,CAAC"}
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
import type { IContentContext } from '@se-studio/core-data-types';
|
|
1
|
+
import type { IBaseCollection, IContentContext, ITyped } from '@se-studio/core-data-types';
|
|
2
2
|
import type React from 'react';
|
|
3
3
|
import type { CmsRendererConfig } from '../CmsRendererConfig';
|
|
4
|
-
|
|
4
|
+
import type { EmbeddedRendererProps } from './CmsContent';
|
|
5
|
+
export type CollectionRendererProps<TInformation extends ITyped> = {
|
|
5
6
|
information: TInformation;
|
|
6
7
|
contentContext: IContentContext;
|
|
7
8
|
rendererConfig: CmsRendererConfig;
|
|
8
|
-
}
|
|
9
|
-
export type
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export declare function CmsCollection({ information, contentContext, rendererConfig, }: {
|
|
16
|
-
information: any;
|
|
17
|
-
contentContext: IContentContext;
|
|
18
|
-
rendererConfig: CmsRendererConfig;
|
|
19
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
};
|
|
10
|
+
export type CollectionRenderer<TInformation extends ITyped> = React.FC<CollectionRendererProps<TInformation>>;
|
|
11
|
+
export type EmbeddedCollectionRenderer<TInformation extends ITyped = ITyped> = React.FC<CollectionRendererProps<TInformation> & EmbeddedRendererProps>;
|
|
12
|
+
export type CollectionMap<TKey extends string, TInformation extends ITyped> = Partial<Record<TKey, CollectionRenderer<TInformation>>>;
|
|
13
|
+
export type EmbeddedCollectionMap<TKey extends string, TInformation extends IBaseCollection> = Partial<Record<TKey, EmbeddedCollectionRenderer<TInformation>>>;
|
|
14
|
+
export declare const CmsCollection: CollectionRenderer<IBaseCollection>;
|
|
15
|
+
export declare const CmsEmbeddedCollection: EmbeddedCollectionRenderer<IBaseCollection>;
|
|
20
16
|
//# sourceMappingURL=CmsCollection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CmsCollection.d.ts","sourceRoot":"","sources":["../../src/components/CmsCollection.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"CmsCollection.d.ts","sourceRoot":"","sources":["../../src/components/CmsCollection.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE1D,MAAM,MAAM,uBAAuB,CAAC,YAAY,SAAS,MAAM,IAAI;IACjE,WAAW,EAAE,YAAY,CAAC;IAC1B,cAAc,EAAE,eAAe,CAAC;IAChC,cAAc,EAAE,iBAAiB,CAAC;CACnC,CAAC;AAiBF,MAAM,MAAM,kBAAkB,CAAC,YAAY,SAAS,MAAM,IAAI,KAAK,CAAC,EAAE,CACpE,uBAAuB,CAAC,YAAY,CAAC,CACtC,CAAC;AA2BF,MAAM,MAAM,0BAA0B,CAAC,YAAY,SAAS,MAAM,GAAG,MAAM,IAAI,KAAK,CAAC,EAAE,CACrF,uBAAuB,CAAC,YAAY,CAAC,GAAG,qBAAqB,CAC9D,CAAC;AAQF,MAAM,MAAM,aAAa,CAAC,IAAI,SAAS,MAAM,EAAE,YAAY,SAAS,MAAM,IAAI,OAAO,CACnF,MAAM,CAAC,IAAI,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC,CAC/C,CAAC;AAEF,MAAM,MAAM,qBAAqB,CAC/B,IAAI,SAAS,MAAM,EACnB,YAAY,SAAS,eAAe,IAClC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,0BAA0B,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;AA8CpE,eAAO,MAAM,aAAa,EAAE,kBAAkB,CAAC,eAAe,CAyD7D,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,0BAA0B,CAAC,eAAe,CA0D7E,CAAC"}
|
|
@@ -10,35 +10,32 @@ const CollectionTypeError = ({ information, availableTypes, showInProduction = f
|
|
|
10
10
|
borderRadius: '4px',
|
|
11
11
|
}, children: [_jsx("h3", { style: { color: '#856404', marginBottom: '0.5rem' }, children: "Unknown Collection Type" }), _jsxs("div", { style: { fontSize: '0.875rem' }, children: [_jsxs("p", { children: [_jsx("strong", { children: "Collection Type:" }), " ", String(information.collectionType)] }), _jsxs("p", { children: [_jsx("strong", { children: "Collection ID:" }), " ", information.id] }), _jsxs("p", { children: [_jsx("strong", { children: "Available Types:" }), " ", availableTypes.join(', ')] }), _jsx("p", { style: { color: '#856404', marginTop: '0.5rem' }, children: "This collection type is not registered in CollectionMap. Using Generic fallback." })] })] }));
|
|
12
12
|
};
|
|
13
|
-
|
|
14
|
-
const { showUnknownTypeErrors } = rendererConfig;
|
|
15
|
-
const Element =
|
|
13
|
+
export const CmsCollection = ({ information, contentContext, rendererConfig, }) => {
|
|
14
|
+
const { showUnknownTypeErrors, collectionMap, defaultCollectionRenderer: DefaultRenderer, } = rendererConfig;
|
|
15
|
+
const Element = collectionMap[information.collectionType];
|
|
16
16
|
if (Element) {
|
|
17
17
|
const result = (_jsx(Element, { information: information, contentContext: contentContext, rendererConfig: rendererConfig }));
|
|
18
18
|
return result;
|
|
19
19
|
}
|
|
20
|
-
const availableTypes = Object.keys(
|
|
20
|
+
const availableTypes = Object.keys(collectionMap);
|
|
21
21
|
console.log(`Unknown collection type: ${String(information.collectionType)} (ID: ${information.id}). Available types:`, availableTypes.join(','));
|
|
22
22
|
const shouldShowError = showUnknownTypeErrors ||
|
|
23
23
|
(typeof process !== 'undefined' && process.env?.NODE_ENV === 'development');
|
|
24
24
|
const result = (_jsxs(_Fragment, { children: [shouldShowError && (_jsx(CollectionTypeError, { information: information, availableTypes: availableTypes, showInProduction: showUnknownTypeErrors })), DefaultRenderer && (_jsx(DefaultRenderer, { information: information, contentContext: contentContext, rendererConfig: rendererConfig }))] }));
|
|
25
25
|
return result;
|
|
26
|
-
}
|
|
27
|
-
export
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
rendererConfig,
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
defaultCollectionRenderer: rendererConfig.defaultCollectionRenderer,
|
|
42
|
-
});
|
|
43
|
-
}
|
|
26
|
+
};
|
|
27
|
+
export const CmsEmbeddedCollection = ({ information, rendererConfig, contentContext, ...props }) => {
|
|
28
|
+
const { showUnknownTypeErrors, embeddedCollectionMap, defaultCollectionRenderer: DefaultRenderer, } = rendererConfig;
|
|
29
|
+
const Element = embeddedCollectionMap[information.collectionType];
|
|
30
|
+
if (Element) {
|
|
31
|
+
const result = (_jsx(Element, { information: information, rendererConfig: rendererConfig, contentContext: contentContext, ...props }));
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
const availableTypes = Object.keys(embeddedCollectionMap);
|
|
35
|
+
console.log(`Unknown embedded collection type: ${String(information.collectionType)} (ID: ${information.id}). Available types:`, availableTypes.join(','));
|
|
36
|
+
const shouldShowError = showUnknownTypeErrors ||
|
|
37
|
+
(typeof process !== 'undefined' && process.env?.NODE_ENV === 'development');
|
|
38
|
+
const result = (_jsxs(_Fragment, { children: [shouldShowError && (_jsx(CollectionTypeError, { information: information, availableTypes: availableTypes, showInProduction: showUnknownTypeErrors })), DefaultRenderer && (_jsx(DefaultRenderer, { information: information, contentContext: contentContext, rendererConfig: rendererConfig }))] }));
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
44
41
|
//# sourceMappingURL=CmsCollection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CmsCollection.js","sourceRoot":"","sources":["../../src/components/CmsCollection.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"CmsCollection.js","sourceRoot":"","sources":["../../src/components/CmsCollection.tsx"],"names":[],"mappings":";AA+EA,MAAM,mBAAmB,GAAG,CAAC,EAC3B,WAAW,EACX,cAAc,EACd,gBAAgB,GAAG,KAAK,GAKzB,EAAE,EAAE;IACH,IAAI,CAAC,gBAAgB,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,EAAE,QAAQ,KAAK,YAAY;QAC/F,OAAO,IAAI,CAAC;IAEd,OAAO,CACL,eACE,KAAK,EAAE;YACL,MAAM,EAAE,kBAAkB;YAC1B,UAAU,EAAE,SAAS;YACrB,OAAO,EAAE,MAAM;YACf,MAAM,EAAE,MAAM;YACd,YAAY,EAAE,KAAK;SACpB,aAED,aAAI,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,wCA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EAAE,cAAc,EAC9B,gBAAgB,EAAE,qBAAqB,GACvC,CACH,EACA,eAAe,IAAI,CAClB,KAAC,eAAe,IACd,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,cAAc,GAC9B,CACH,IACA,CACJ,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
import type { IContentContext } from '@se-studio/core-data-types';
|
|
1
|
+
import type { IBaseComponent, IContentContext, ITyped } from '@se-studio/core-data-types';
|
|
2
2
|
import type React from 'react';
|
|
3
3
|
import type { CmsRendererConfig } from '../CmsRendererConfig';
|
|
4
|
-
|
|
4
|
+
import type { EmbeddedRendererProps } from './CmsContent';
|
|
5
|
+
export type ComponentRendererProps<TInformation extends ITyped> = {
|
|
5
6
|
information: TInformation;
|
|
6
7
|
contentContext: IContentContext;
|
|
7
8
|
rendererConfig: CmsRendererConfig;
|
|
8
|
-
}
|
|
9
|
-
export type
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export declare function CmsComponent({ information, contentContext, rendererConfig, }: {
|
|
16
|
-
information: any;
|
|
17
|
-
contentContext: IContentContext;
|
|
18
|
-
rendererConfig: CmsRendererConfig;
|
|
19
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
};
|
|
10
|
+
export type ComponentRenderer<TInformation extends ITyped> = React.FC<ComponentRendererProps<TInformation>>;
|
|
11
|
+
export type EmbeddedComponentRenderer<TInformation extends ITyped = ITyped> = React.FC<ComponentRendererProps<TInformation> & EmbeddedRendererProps>;
|
|
12
|
+
export type ComponentMap<TKey extends string, TInformation extends ITyped> = Partial<Record<TKey, ComponentRenderer<TInformation>>>;
|
|
13
|
+
export type EmbeddedComponentMap<TKey extends string, TInformation extends ITyped> = Partial<Record<TKey, EmbeddedComponentRenderer<TInformation>>>;
|
|
14
|
+
export declare const CmsComponent: ComponentRenderer<IBaseComponent>;
|
|
15
|
+
export declare const CmsEmbeddedComponent: EmbeddedComponentRenderer<IBaseComponent>;
|
|
20
16
|
//# sourceMappingURL=CmsComponent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CmsComponent.d.ts","sourceRoot":"","sources":["../../src/components/CmsComponent.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"CmsComponent.d.ts","sourceRoot":"","sources":["../../src/components/CmsComponent.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAC1F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE1D,MAAM,MAAM,sBAAsB,CAAC,YAAY,SAAS,MAAM,IAAI;IAChE,WAAW,EAAE,YAAY,CAAC;IAC1B,cAAc,EAAE,eAAe,CAAC;IAChC,cAAc,EAAE,iBAAiB,CAAC;CACnC,CAAC;AAgBF,MAAM,MAAM,iBAAiB,CAAC,YAAY,SAAS,MAAM,IAAI,KAAK,CAAC,EAAE,CACnE,sBAAsB,CAAC,YAAY,CAAC,CACrC,CAAC;AA2BF,MAAM,MAAM,yBAAyB,CAAC,YAAY,SAAS,MAAM,GAAG,MAAM,IAAI,KAAK,CAAC,EAAE,CACpF,sBAAsB,CAAC,YAAY,CAAC,GAAG,qBAAqB,CAC7D,CAAC;AAOF,MAAM,MAAM,YAAY,CAAC,IAAI,SAAS,MAAM,EAAE,YAAY,SAAS,MAAM,IAAI,OAAO,CAClF,MAAM,CAAC,IAAI,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAC,CAC9C,CAAC;AACF,MAAM,MAAM,oBAAoB,CAAC,IAAI,SAAS,MAAM,EAAE,YAAY,SAAS,MAAM,IAAI,OAAO,CAC1F,MAAM,CAAC,IAAI,EAAE,yBAAyB,CAAC,YAAY,CAAC,CAAC,CACtD,CAAC;AA8CF,eAAO,MAAM,YAAY,EAAE,iBAAiB,CAAC,cAAc,CAyD1D,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,yBAAyB,CAAC,cAAc,CA0D1E,CAAC"}
|
|
@@ -10,24 +10,32 @@ const ComponentTypeError = ({ information, availableTypes, showInProduction = fa
|
|
|
10
10
|
borderRadius: '4px',
|
|
11
11
|
}, children: [_jsx("h3", { style: { color: '#856404', marginBottom: '0.5rem' }, children: "Unknown Component Type" }), _jsxs("div", { style: { fontSize: '0.875rem' }, children: [_jsxs("p", { children: [_jsx("strong", { children: "Component Type:" }), " ", String(information.componentType)] }), _jsxs("p", { children: [_jsx("strong", { children: "Component ID:" }), " ", information.id] }), _jsxs("p", { children: [_jsx("strong", { children: "Available Types:" }), " ", availableTypes.join(', ')] }), _jsx("p", { style: { color: '#856404', marginTop: '0.5rem' }, children: "This component type is not registered in ComponentMap. Using Generic fallback." })] })] }));
|
|
12
12
|
};
|
|
13
|
-
|
|
14
|
-
const { showUnknownTypeErrors } = rendererConfig;
|
|
15
|
-
const Element =
|
|
13
|
+
export const CmsComponent = ({ information, contentContext, rendererConfig, }) => {
|
|
14
|
+
const { showUnknownTypeErrors, componentMap, defaultComponentRenderer: DefaultRenderer, } = rendererConfig;
|
|
15
|
+
const Element = componentMap[information.componentType];
|
|
16
16
|
if (Element) {
|
|
17
17
|
const result = (_jsx(Element, { information: information, contentContext: contentContext, rendererConfig: rendererConfig }));
|
|
18
18
|
return result;
|
|
19
19
|
}
|
|
20
|
-
const availableTypes = Object.keys(
|
|
20
|
+
const availableTypes = Object.keys(componentMap);
|
|
21
21
|
console.log(`Unknown component type: ${String(information.componentType)} (ID: ${information.id}). Available types:`, availableTypes.join(','));
|
|
22
22
|
const shouldShowError = showUnknownTypeErrors ||
|
|
23
23
|
(typeof process !== 'undefined' && process.env?.NODE_ENV === 'development');
|
|
24
24
|
const result = (_jsxs(_Fragment, { children: [shouldShowError && (_jsx(ComponentTypeError, { information: information, availableTypes: availableTypes, showInProduction: showUnknownTypeErrors })), DefaultRenderer && (_jsx(DefaultRenderer, { information: information, contentContext: contentContext, rendererConfig: rendererConfig }))] }));
|
|
25
25
|
return result;
|
|
26
|
-
}
|
|
27
|
-
export
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
};
|
|
27
|
+
export const CmsEmbeddedComponent = ({ information, contentContext, rendererConfig, ...props }) => {
|
|
28
|
+
const { showUnknownTypeErrors, embeddedComponentMap, defaultComponentRenderer: DefaultRenderer, } = rendererConfig;
|
|
29
|
+
const Element = embeddedComponentMap[information.componentType];
|
|
30
|
+
if (Element) {
|
|
31
|
+
const result = (_jsx(Element, { information: information, contentContext: contentContext, rendererConfig: rendererConfig, ...props }));
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
const availableTypes = Object.keys(embeddedComponentMap);
|
|
35
|
+
console.log(`Unknown embedded component type: ${String(information.componentType)} (ID: ${information.id}). Available types:`, availableTypes.join(','));
|
|
36
|
+
const shouldShowError = showUnknownTypeErrors ||
|
|
37
|
+
(typeof process !== 'undefined' && process.env?.NODE_ENV === 'development');
|
|
38
|
+
const result = (_jsxs(_Fragment, { children: [shouldShowError && (_jsx(ComponentTypeError, { information: information, availableTypes: availableTypes, showInProduction: showUnknownTypeErrors })), DefaultRenderer && (_jsx(DefaultRenderer, { information: information, contentContext: contentContext, rendererConfig: rendererConfig }))] }));
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
33
41
|
//# sourceMappingURL=CmsComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CmsComponent.js","sourceRoot":"","sources":["../../src/components/CmsComponent.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"CmsComponent.js","sourceRoot":"","s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T,CACH,CAAC;QAEF,OAAO,MAAM,CAAC;IAChB,CAAC;IAGD,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACzD,OAAO,CAAC,GAAG,CACT,oCAAoC,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,SAAS,WAAW,CAAC,EAAE,qBAAqB,EACjH,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CACzB,CAAC;IAGF,MAAM,eAAe,GACnB,qBAAqB;QACrB,CAAC,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,EAAE,QAAQ,KAAK,aAAa,CAAC,CAAC;IAE9E,MAAM,MAAM,GAAG,CACb,8BACG,eAAe,IAAI,CAClB,KAAC,kBAAkB,IACjB,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE,cAAc,EAC9B,gBAAgB,EAAE,qBAAqB,GACvC,CACH,EACA,eAAe,IAAI,CAClB,KAAC,eAAe,IACd,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,cAAc,GAC9B,CACH,IACA,CACJ,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -9,6 +9,11 @@ export type InternalLinkRenderer = React.FC<{
|
|
|
9
9
|
information: unknown;
|
|
10
10
|
contentContext: IContentContext;
|
|
11
11
|
}>;
|
|
12
|
+
export type EmbeddedRendererProps = {
|
|
13
|
+
positionClassName: string;
|
|
14
|
+
embeddedIndex: number;
|
|
15
|
+
parentIndex: number;
|
|
16
|
+
};
|
|
12
17
|
export declare const ContentError: ({ error, content, showInProduction, }: {
|
|
13
18
|
error: Error;
|
|
14
19
|
content: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CmsContent.d.ts","sourceRoot":"","sources":["../../src/components/CmsContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"CmsContent.d.ts","sourceRoot":"","sources":["../../src/components/CmsContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,eAAe,EACf,YAAY,EACZ,MAAM,EACN,OAAO,EACR,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AA2B9D,MAAM,MAAM,uBAAuB,GAAG,KAAK,CAAC,EAAE,CAAC;IAC7C,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,eAAe,CAAC;CACjC,CAAC,CAAC;AAKH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,EAAE,CAAC;IAC1C,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,eAAe,CAAC;CACjC,CAAC,CAAC;AAaH,MAAM,MAAM,qBAAqB,GAAG;IAClC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAKF,eAAO,MAAM,YAAY,GAAI,uCAI1B;IACD,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,mDA0CA,CAAC;AA4KF,wBAAgB,UAAU,CAAC,EACzB,WAAW,EACX,QAAQ,EACR,cAAc,GACf,EAAE;IACD,WAAW,EAAE,YAAY,CAAC;IAC1B,QAAQ,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACjC,cAAc,EAAE,iBAAiB,CAAC;CACnC,kDAmBA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CmsContent.js","sourceRoot":"","sources":["../../src/components/CmsContent.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"CmsContent.js","sourceRoot":"","sources":["../../src/components/Cm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,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;YACnE,OAAO,CACL,KAAC,aAAa,IAEZ,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,cAAc,IAFzB,GAAG,OAAO,CAAC,EAAE,IAAI,KAAK,EAAE,CAG7B,CACH,CAAC;QACJ,CAAC,CAAC,GACD,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type EmbeddedCollectionRenderer } from './CmsCollection';
|
|
2
|
+
import { type EmbeddedComponentRenderer } from './CmsComponent';
|
|
3
|
+
import { type EmbeddedExternalComponentRenderer } from './CmsExternalComponent';
|
|
4
|
+
export type EmbeddedContentRenderer = EmbeddedComponentRenderer | EmbeddedCollectionRenderer | EmbeddedExternalComponentRenderer;
|
|
5
|
+
export declare const CmsEmbeddedContent: EmbeddedContentRenderer;
|
|
6
|
+
//# sourceMappingURL=CmsEmbeddedContent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CmsEmbeddedContent.d.ts","sourceRoot":"","sources":["../../src/components/CmsEmbeddedContent.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAyB,KAAK,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AACzF,OAAO,EAAwB,KAAK,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAEtF,OAAO,EAEL,KAAK,iCAAiC,EACvC,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,uBAAuB,GAC/B,yBAAyB,GACzB,0BAA0B,GAC1B,iCAAiC,CAAC;AAKtC,eAAO,MAAM,kBAAkB,EAAE,uBAkDhC,CAAC"}
|
|
@@ -2,33 +2,32 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { CmsEmbeddedCollection } from './CmsCollection';
|
|
3
3
|
import { CmsEmbeddedComponent } from './CmsComponent';
|
|
4
4
|
import { ContentError } from './CmsContent';
|
|
5
|
-
import { CmsEmbeddedExternalComponent } from './CmsExternalComponent';
|
|
6
|
-
const
|
|
5
|
+
import { CmsEmbeddedExternalComponent, } from './CmsExternalComponent';
|
|
6
|
+
export const CmsEmbeddedContent = ({ information, ...props }) => {
|
|
7
7
|
try {
|
|
8
8
|
let result;
|
|
9
9
|
switch (information.type) {
|
|
10
10
|
case 'Component':
|
|
11
|
-
result =
|
|
11
|
+
result = _jsx(CmsEmbeddedComponent, { information: information, ...props });
|
|
12
12
|
break;
|
|
13
13
|
case 'Collection':
|
|
14
|
-
result =
|
|
14
|
+
result = _jsx(CmsEmbeddedCollection, { information: information, ...props });
|
|
15
15
|
break;
|
|
16
16
|
case 'External component':
|
|
17
|
-
result = (_jsx(CmsEmbeddedExternalComponent, { information: information,
|
|
17
|
+
result = (_jsx(CmsEmbeddedExternalComponent, { information: information, ...props }));
|
|
18
18
|
break;
|
|
19
19
|
default:
|
|
20
|
-
result = (_jsx(ContentError, { error: new Error('Unknown content type'), content: information, showInProduction: rendererConfig.showUnknownTypeErrors }));
|
|
20
|
+
result = (_jsx(ContentError, { error: new Error('Unknown content type'), content: information, showInProduction: props.rendererConfig.showUnknownTypeErrors }));
|
|
21
21
|
}
|
|
22
22
|
return result;
|
|
23
23
|
}
|
|
24
24
|
catch (error) {
|
|
25
25
|
console.error('Error rendering content:', error);
|
|
26
|
-
if (rendererConfig.showRenderErrors ||
|
|
26
|
+
if (props.rendererConfig.showRenderErrors ||
|
|
27
27
|
(typeof process !== 'undefined' && process.env?.NODE_ENV === 'development')) {
|
|
28
|
-
return (_jsx(ContentError, { error: error, content: information, showInProduction: rendererConfig.showRenderErrors }));
|
|
28
|
+
return (_jsx(ContentError, { error: error, content: information, showInProduction: props.rendererConfig.showRenderErrors }));
|
|
29
29
|
}
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
|
-
|
|
34
|
-
//# sourceMappingURL=EmbeddedContent.js.map
|
|
33
|
+
//# sourceMappingURL=CmsEmbeddedContent.js.map
|
|
@@ -0,0 +1 @@
|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KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,EAAE,QAAQ,KAAK,aAAa,CAAC,EAC3E,CAAC;YACD,OAAO,CACL,KAAC,YAAY,IACX,KAAK,EAAE,KAAc,EACrB,OAAO,EAAE,WAAW,EACpB,gBAAgB,EAAE,KAAK,CAAC,cAAc,CAAC,gBAAgB,GACvD,CACH,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
import type { IContentContext } from '@se-studio/core-data-types';
|
|
1
|
+
import type { IBaseExternalComponent, IContentContext, ITyped } from '@se-studio/core-data-types';
|
|
2
2
|
import type { CmsRendererConfig } from '../CmsRendererConfig';
|
|
3
|
-
|
|
3
|
+
import type { EmbeddedRendererProps } from './CmsContent';
|
|
4
|
+
export type ExternalComponentRendererProps<TInformation extends ITyped> = {
|
|
4
5
|
information: TInformation;
|
|
5
6
|
contentContext: IContentContext;
|
|
6
7
|
rendererConfig: CmsRendererConfig;
|
|
7
|
-
}
|
|
8
|
-
export type
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export declare const CmsExternalComponent: ({ information, contentContext, rendererConfig, }: {
|
|
15
|
-
information: any;
|
|
16
|
-
contentContext: IContentContext;
|
|
17
|
-
rendererConfig: CmsRendererConfig;
|
|
18
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
};
|
|
9
|
+
export type ExternalComponentRenderer<TInformation extends ITyped> = React.FC<ExternalComponentRendererProps<TInformation>>;
|
|
10
|
+
export type EmbeddedExternalComponentRenderer<TInformation extends ITyped = ITyped> = React.FC<ExternalComponentRendererProps<TInformation> & EmbeddedRendererProps>;
|
|
11
|
+
export type ExternalComponentMap<TKey extends string, TInformation extends ITyped> = Partial<Record<TKey, ExternalComponentRenderer<TInformation>>>;
|
|
12
|
+
export type EmbeddedExternalComponentMap<TKey extends string, TInformation extends ITyped> = Partial<Record<TKey, EmbeddedExternalComponentRenderer<TInformation>>>;
|
|
13
|
+
export declare const CmsExternalComponent: ExternalComponentRenderer<IBaseExternalComponent>;
|
|
14
|
+
export declare const CmsEmbeddedExternalComponent: EmbeddedExternalComponentRenderer<IBaseExternalComponent>;
|
|
19
15
|
//# sourceMappingURL=CmsExternalComponent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CmsExternalComponent.d.ts","sourceRoot":"","sources":["../../src/components/CmsExternalComponent.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"CmsExternalComponent.d.ts","sourceRoot":"","sources":["../../src/components/CmsExternalComponent.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAClG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE1D,MAAM,MAAM,8BAA8B,CAAC,YAAY,SAAS,MAAM,IAAI;IACxE,WAAW,EAAE,YAAY,CAAC;IAC1B,cAAc,EAAE,eAAe,CAAC;IAChC,cAAc,EAAE,iBAAiB,CAAC;CACnC,CAAC;AAiBF,MAAM,MAAM,yBAAyB,CAAC,YAAY,SAAS,MAAM,IAAI,KAAK,CAAC,EAAE,CAC3E,8BAA8B,CAAC,YAAY,CAAC,CAC7C,CAAC;AA2BF,MAAM,MAAM,iCAAiC,CAAC,YAAY,SAAS,MAAM,GAAG,MAAM,IAAI,KAAK,CAAC,EAAE,CAC5F,8BAA8B,CAAC,YAAY,CAAC,GAAG,qBAAqB,CACrE,CAAC;AAIF,MAAM,MAAM,oBAAoB,CAAC,IAAI,SAAS,MAAM,EAAE,YAAY,SAAS,MAAM,IAAI,OAAO,CAC1F,MAAM,CAAC,IAAI,EAAE,yBAAyB,CAAC,Y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