@sitecore-content-sdk/react 1.3.0-canary.23 → 1.3.0-canary.25
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/cjs/components/DesignLibrary/DesignLibraryApp.js +2 -2
- package/dist/cjs/enhancers/withLoadImportMap.js +2 -1
- package/dist/esm/components/DesignLibrary/DesignLibraryApp.js +2 -2
- package/dist/esm/enhancers/withLoadImportMap.js +2 -1
- package/package.json +3 -3
- package/types/components/DesignLibrary/DesignLibraryApp.d.ts +1 -1
- package/types/components/DesignLibrary/DesignLibraryApp.d.ts.map +1 -1
- package/types/components/DesignLibrary/models.d.ts +9 -3
- package/types/components/DesignLibrary/models.d.ts.map +1 -1
|
@@ -18,7 +18,7 @@ const DesignLibrary_1 = require("./DesignLibrary");
|
|
|
18
18
|
* @param {DesingLibraryAppProps} props - The properties for the Design Library App.
|
|
19
19
|
* @public
|
|
20
20
|
*/
|
|
21
|
-
const DesignLibraryApp = ({ page, componentMap, loadServerImportMap, }) => {
|
|
21
|
+
const DesignLibraryApp = ({ page, componentMap, loadServerImportMap, loadClientImportMap, }) => {
|
|
22
22
|
var _a;
|
|
23
23
|
const { route } = page.layout.sitecore;
|
|
24
24
|
if (!route)
|
|
@@ -26,6 +26,6 @@ const DesignLibraryApp = ({ page, componentMap, loadServerImportMap, }) => {
|
|
|
26
26
|
const rendering = (_a = route === null || route === void 0 ? void 0 : route.placeholders[layout_1.EDITING_COMPONENT_PLACEHOLDER]) === null || _a === void 0 ? void 0 : _a[0];
|
|
27
27
|
const component = componentMap.get((rendering === null || rendering === void 0 ? void 0 : rendering.componentName) || '');
|
|
28
28
|
const isClient = component && component.componentType === 'client';
|
|
29
|
-
return (react_1.default.createElement(react_1.default.Fragment, null, isClient ? (react_1.default.createElement(DesignLibrary_1.DesignLibrary,
|
|
29
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, isClient ? (react_1.default.createElement(DesignLibrary_1.DesignLibrary, { loadImportMap: loadClientImportMap })) : (react_1.default.createElement(DesignLibraryServer_1.DesignLibraryServer, { page: page, componentMap: componentMap, loadServerImportMap: loadServerImportMap, rendering: route }))));
|
|
30
30
|
};
|
|
31
31
|
exports.DesignLibraryApp = DesignLibraryApp;
|
|
@@ -45,7 +45,8 @@ const SitecoreProvider_1 = require("../components/SitecoreProvider");
|
|
|
45
45
|
function withLoadImportMap(Component) {
|
|
46
46
|
const WithLoadImportMap = (props) => {
|
|
47
47
|
const loadImportMapContext = (0, react_1.useContext)(SitecoreProvider_1.ImportMapReactContext);
|
|
48
|
-
|
|
48
|
+
const loadClientImportMap = props.loadImportMap || loadImportMapContext;
|
|
49
|
+
return react_1.default.createElement(Component, Object.assign({}, props, { loadImportMap: loadClientImportMap }));
|
|
49
50
|
};
|
|
50
51
|
WithLoadImportMap.displayName = `withLoadImportMap(${Component.displayName || Component.name || 'Component'})`;
|
|
51
52
|
return WithLoadImportMap;
|
|
@@ -12,7 +12,7 @@ import { DesignLibrary } from './DesignLibrary';
|
|
|
12
12
|
* @param {DesingLibraryAppProps} props - The properties for the Design Library App.
|
|
13
13
|
* @public
|
|
14
14
|
*/
|
|
15
|
-
export const DesignLibraryApp = ({ page, componentMap, loadServerImportMap, }) => {
|
|
15
|
+
export const DesignLibraryApp = ({ page, componentMap, loadServerImportMap, loadClientImportMap, }) => {
|
|
16
16
|
var _a;
|
|
17
17
|
const { route } = page.layout.sitecore;
|
|
18
18
|
if (!route)
|
|
@@ -20,5 +20,5 @@ export const DesignLibraryApp = ({ page, componentMap, loadServerImportMap, }) =
|
|
|
20
20
|
const rendering = (_a = route === null || route === void 0 ? void 0 : route.placeholders[EDITING_COMPONENT_PLACEHOLDER]) === null || _a === void 0 ? void 0 : _a[0];
|
|
21
21
|
const component = componentMap.get((rendering === null || rendering === void 0 ? void 0 : rendering.componentName) || '');
|
|
22
22
|
const isClient = component && component.componentType === 'client';
|
|
23
|
-
return (React.createElement(React.Fragment, null, isClient ? (React.createElement(DesignLibrary,
|
|
23
|
+
return (React.createElement(React.Fragment, null, isClient ? (React.createElement(DesignLibrary, { loadImportMap: loadClientImportMap })) : (React.createElement(DesignLibraryServer, { page: page, componentMap: componentMap, loadServerImportMap: loadServerImportMap, rendering: route }))));
|
|
24
24
|
};
|
|
@@ -9,7 +9,8 @@ import { ImportMapReactContext } from '../components/SitecoreProvider';
|
|
|
9
9
|
export function withLoadImportMap(Component) {
|
|
10
10
|
const WithLoadImportMap = (props) => {
|
|
11
11
|
const loadImportMapContext = useContext(ImportMapReactContext);
|
|
12
|
-
|
|
12
|
+
const loadClientImportMap = props.loadImportMap || loadImportMapContext;
|
|
13
|
+
return React.createElement(Component, Object.assign({}, props, { loadImportMap: loadClientImportMap }));
|
|
13
14
|
};
|
|
14
15
|
WithLoadImportMap.displayName = `withLoadImportMap(${Component.displayName || Component.name || 'Component'})`;
|
|
15
16
|
return WithLoadImportMap;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sitecore-content-sdk/react",
|
|
3
|
-
"version": "1.3.0-canary.
|
|
3
|
+
"version": "1.3.0-canary.25",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -76,12 +76,12 @@
|
|
|
76
76
|
"react-dom": "^19.1.0"
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"@sitecore-content-sdk/core": "1.3.0-canary.
|
|
79
|
+
"@sitecore-content-sdk/core": "1.3.0-canary.25",
|
|
80
80
|
"fast-deep-equal": "^3.1.3"
|
|
81
81
|
},
|
|
82
82
|
"description": "",
|
|
83
83
|
"types": "types/index.d.ts",
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "faba3dcdd0a59101bff0e358f0efc70fc1e53ee6",
|
|
85
85
|
"files": [
|
|
86
86
|
"dist",
|
|
87
87
|
"types"
|
|
@@ -10,5 +10,5 @@ import { DesingLibraryAppProps } from './models';
|
|
|
10
10
|
* @param {DesingLibraryAppProps} props - The properties for the Design Library App.
|
|
11
11
|
* @public
|
|
12
12
|
*/
|
|
13
|
-
export declare const DesignLibraryApp: ({ page, componentMap, loadServerImportMap, }: DesingLibraryAppProps) => React.JSX.Element;
|
|
13
|
+
export declare const DesignLibraryApp: ({ page, componentMap, loadServerImportMap, loadClientImportMap, }: DesingLibraryAppProps) => React.JSX.Element;
|
|
14
14
|
//# sourceMappingURL=DesignLibraryApp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DesignLibraryApp.d.ts","sourceRoot":"","sources":["../../../src/components/DesignLibrary/DesignLibraryApp.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAIjD;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,GAAI,
|
|
1
|
+
{"version":3,"file":"DesignLibraryApp.d.ts","sourceRoot":"","sources":["../../../src/components/DesignLibrary/DesignLibraryApp.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAIjD;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,GAAI,mEAK9B,qBAAqB,sBAsBvB,CAAC"}
|
|
@@ -33,12 +33,18 @@ export type DesignLibraryServerProps = {
|
|
|
33
33
|
*/
|
|
34
34
|
page: Page;
|
|
35
35
|
/**
|
|
36
|
-
* The dynamic import for import map to be used in variant generation mode.
|
|
37
|
-
* Currently it's optional but it will be required in the next major version.
|
|
36
|
+
* The dynamic import for sever import map to be used in variant generation mode.
|
|
38
37
|
*/
|
|
39
38
|
loadServerImportMap: () => Promise<ImportMapImport>;
|
|
40
39
|
};
|
|
41
|
-
export type
|
|
40
|
+
export type DesignLibraryClientProps = {
|
|
41
|
+
/**
|
|
42
|
+
* The dynamic import for client import map to be used in variant generation mode.
|
|
43
|
+
* Overrides the value from Sitecore Context if both are provided.
|
|
44
|
+
*/
|
|
45
|
+
loadClientImportMap?: () => Promise<ImportMapImport>;
|
|
46
|
+
};
|
|
47
|
+
export type DesingLibraryAppProps = DesignLibraryServerProps & DesignLibraryClientProps;
|
|
42
48
|
export type DesignLibraryServerPreviewProps = Omit<DesignLibraryServerProps, 'loadServerImportMap'>;
|
|
43
49
|
export type DesignLibraryServerVariantGenerationProps = DesignLibraryServerProps;
|
|
44
50
|
export type DesignLibraryPreviewEventsProps = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/components/DesignLibrary/models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EACL,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,SAAS,EACV,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,IAAI,EAAE,MAAM,mCAAmC,CAAC;AACzD,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAAC;IACjD,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,EAAE,eAAe,CAAC;CACzB,CAAC,CAAC;AAGH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,eAAe,CAAC,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,wBAA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