@sitecore-content-sdk/react 1.3.0-canary.21 → 1.3.0-canary.22
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/DesignLibrary.js +12 -4
- package/dist/cjs/components/DesignLibrary/DesignLibraryServer.js +11 -4
- package/dist/cjs/components/Placeholder/AppPlaceholder.js +3 -1
- package/dist/cjs/components/Placeholder/PlaceholderMetadata.js +6 -1
- package/dist/esm/components/DesignLibrary/DesignLibrary.js +9 -1
- package/dist/esm/components/DesignLibrary/DesignLibraryServer.js +10 -3
- package/dist/esm/components/Placeholder/AppPlaceholder.js +3 -1
- package/dist/esm/components/Placeholder/PlaceholderMetadata.js +6 -1
- package/package.json +3 -3
- package/types/components/DesignLibrary/DesignLibrary.d.ts.map +1 -1
- package/types/components/DesignLibrary/DesignLibraryServer.d.ts.map +1 -1
- package/types/components/Placeholder/AppPlaceholder.d.ts.map +1 -1
- package/types/components/Placeholder/PlaceholderMetadata.d.ts +7 -1
- package/types/components/Placeholder/PlaceholderMetadata.d.ts.map +1 -1
|
@@ -41,13 +41,21 @@ const react_1 = __importStar(require("react"));
|
|
|
41
41
|
const layout_1 = require("@sitecore-content-sdk/core/layout");
|
|
42
42
|
const editing_1 = require("@sitecore-content-sdk/core/editing");
|
|
43
43
|
const codegen = __importStar(require("@sitecore-content-sdk/core/codegen"));
|
|
44
|
+
const editing = __importStar(require("@sitecore-content-sdk/core/editing"));
|
|
44
45
|
const withSitecore_1 = require("../../enhancers/withSitecore");
|
|
45
46
|
const Placeholder_1 = require("../Placeholder");
|
|
46
47
|
const DesignLibraryErrorBoundary_1 = require("./DesignLibraryErrorBoundary");
|
|
47
48
|
const withLoadImportMap_1 = require("../../enhancers/withLoadImportMap");
|
|
48
49
|
let { getDesignLibraryImportMapEvent, getDesignLibraryComponentPropsEvent, addComponentPreviewHandler, sendErrorEvent, } = codegen;
|
|
50
|
+
let { postToDesignLibrary } = editing;
|
|
49
51
|
const __mockDependencies = (mocks) => {
|
|
50
52
|
addComponentPreviewHandler = mocks.addComponentPreviewHandler;
|
|
53
|
+
if (mocks.postToDesignLibrary) {
|
|
54
|
+
postToDesignLibrary = mocks.postToDesignLibrary;
|
|
55
|
+
}
|
|
56
|
+
if (mocks.sendErrorEvent) {
|
|
57
|
+
sendErrorEvent = mocks.sendErrorEvent;
|
|
58
|
+
}
|
|
51
59
|
};
|
|
52
60
|
exports.__mockDependencies = __mockDependencies;
|
|
53
61
|
/**
|
|
@@ -80,7 +88,7 @@ exports.DesignLibrary = (0, withLoadImportMap_1.withLoadImportMap)(({ loadImport
|
|
|
80
88
|
return null;
|
|
81
89
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
82
90
|
(0, react_1.useEffect)(() => {
|
|
83
|
-
|
|
91
|
+
postToDesignLibrary((0, editing_1.getDesignLibraryStatusEvent)(editing_1.DesignLibraryStatus.READY, rendering.uid));
|
|
84
92
|
if (!isVariantGeneration) {
|
|
85
93
|
requestAnimationFrame(() => {
|
|
86
94
|
setRenderKey((k) => (k === 0 ? k + 1 : k));
|
|
@@ -98,7 +106,7 @@ exports.DesignLibrary = (0, withLoadImportMap_1.withLoadImportMap)(({ loadImport
|
|
|
98
106
|
// Send a rendered event only as effect of a component update command
|
|
99
107
|
if (renderKey === 0)
|
|
100
108
|
return;
|
|
101
|
-
|
|
109
|
+
postToDesignLibrary((0, editing_1.getDesignLibraryStatusEvent)(editing_1.DesignLibraryStatus.RENDERED, rendering.uid));
|
|
102
110
|
}, [renderKey, rendering]);
|
|
103
111
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
104
112
|
(0, react_1.useEffect)(() => {
|
|
@@ -133,9 +141,9 @@ exports.DesignLibrary = (0, withLoadImportMap_1.withLoadImportMap)(({ loadImport
|
|
|
133
141
|
setRenderKey((k) => k + 1);
|
|
134
142
|
});
|
|
135
143
|
const importMapEvent = getDesignLibraryImportMapEvent(rendering.uid, importMap);
|
|
136
|
-
|
|
144
|
+
postToDesignLibrary(importMapEvent);
|
|
137
145
|
const propsEvent = getDesignLibraryComponentPropsEvent(rendering.uid, propsState.fields, propsState.params);
|
|
138
|
-
|
|
146
|
+
postToDesignLibrary(propsEvent);
|
|
139
147
|
})();
|
|
140
148
|
// return function that calls unsubscribe - if the component was mounted correctly
|
|
141
149
|
return () => {
|
|
@@ -47,11 +47,18 @@ const codegen = __importStar(require("@sitecore-content-sdk/core/codegen"));
|
|
|
47
47
|
const Placeholder_1 = require("../Placeholder");
|
|
48
48
|
const DesignLibraryErrorBoundary_1 = require("./DesignLibraryErrorBoundary");
|
|
49
49
|
let { getCacheAndClean, hasCache } = globalCache;
|
|
50
|
-
let { createComponentInstance } = codegen;
|
|
50
|
+
let { createComponentInstance, getImportMapInfo } = codegen;
|
|
51
|
+
let updateComponent = editing_1.updateComponent;
|
|
51
52
|
const __mockDependencies = async (mocks) => {
|
|
52
53
|
getCacheAndClean = mocks.getCacheAndClean;
|
|
53
54
|
hasCache = mocks.hasCache;
|
|
54
55
|
createComponentInstance = mocks.createComponentInstance;
|
|
56
|
+
if (mocks.updateComponent) {
|
|
57
|
+
updateComponent = mocks.updateComponent;
|
|
58
|
+
}
|
|
59
|
+
if (mocks.getImportMapInfo) {
|
|
60
|
+
getImportMapInfo = mocks.getImportMapInfo;
|
|
61
|
+
}
|
|
55
62
|
};
|
|
56
63
|
exports.__mockDependencies = __mockDependencies;
|
|
57
64
|
/**
|
|
@@ -104,7 +111,7 @@ const DesignLibraryServerVariantGeneration = async ({ page, rendering, loadServe
|
|
|
104
111
|
try {
|
|
105
112
|
const mod = await loadServerImportMap();
|
|
106
113
|
importMap = mod.default;
|
|
107
|
-
importMapInfo =
|
|
114
|
+
importMapInfo = getImportMapInfo(importMap);
|
|
108
115
|
}
|
|
109
116
|
catch (e) {
|
|
110
117
|
importMapError = `Error loading import map: ${e}`;
|
|
@@ -119,7 +126,7 @@ const DesignLibraryServerVariantGeneration = async ({ page, rendering, loadServe
|
|
|
119
126
|
const updateData = getCacheAndClean(componentUpdateKey);
|
|
120
127
|
// apply the updates to the component rendering
|
|
121
128
|
if (updateData.updatedComponent) {
|
|
122
|
-
|
|
129
|
+
updateComponent(componentToUpdate, updateData.updatedComponent.fields, updateData.updatedComponent.params);
|
|
123
130
|
}
|
|
124
131
|
if (updateData.previewComponent && !importMapError) {
|
|
125
132
|
previewComponentData = updateData.previewComponent;
|
|
@@ -164,7 +171,7 @@ const DesignLibraryServerPreview = async ({ page, rendering, componentMap, }) =>
|
|
|
164
171
|
const updateData = getCacheAndClean(componentUpdateKey);
|
|
165
172
|
// apply the updates to the component rendering
|
|
166
173
|
if (updateData.updatedComponent) {
|
|
167
|
-
|
|
174
|
+
updateComponent(componentToUpdate, updateData.updatedComponent.fields, updateData.updatedComponent.params);
|
|
168
175
|
}
|
|
169
176
|
}
|
|
170
177
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
@@ -26,6 +26,8 @@ const AppPlaceholder = (props) => {
|
|
|
26
26
|
const { component: Component, isEmpty, componentType, dynamic, } = (0, placeholder_utils_1.getComponentForRendering)(rendering, props.name, componentMap, props.hiddenRenderingComponent, props.missingComponentComponent);
|
|
27
27
|
const isClient = componentType === 'client';
|
|
28
28
|
const key = rendering.uid || `component-${index}`;
|
|
29
|
+
// Use rsc context to determine the current runtime
|
|
30
|
+
const componentRuntime = _rsc_env_1.rsc ? 'server' : 'client';
|
|
29
31
|
const renderedProps = (0, placeholder_utils_1.getAppComponentProps)(props, rendering);
|
|
30
32
|
const finalRenderedProps = props.modifyComponentProps
|
|
31
33
|
? props.modifyComponentProps(renderedProps)
|
|
@@ -43,7 +45,7 @@ const AppPlaceholder = (props) => {
|
|
|
43
45
|
// if in edit mode then emit shallow chromes for hydration in Pages
|
|
44
46
|
if (page.mode.isEditing) {
|
|
45
47
|
const key = rendering.uid || `component-${index}`;
|
|
46
|
-
return (react_1.default.createElement(PlaceholderMetadata_1.PlaceholderMetadata, { key: key, rendering: rendering }, rendered));
|
|
48
|
+
return (react_1.default.createElement(PlaceholderMetadata_1.PlaceholderMetadata, { key: key, rendering: rendering, componentRuntime: componentRuntime }, rendered));
|
|
47
49
|
}
|
|
48
50
|
return rendered;
|
|
49
51
|
})
|
|
@@ -14,10 +14,11 @@ const editing_1 = require("@sitecore-content-sdk/core/editing");
|
|
|
14
14
|
* @param {object} props The properties passed to the component.
|
|
15
15
|
* @param {ComponentRendering} props.rendering The rendering data.
|
|
16
16
|
* @param {string} [props.placeholderName] The name of the placeholder.
|
|
17
|
+
* @param {'server' | 'client'} [props.componentRuntime] Component runtime type. Used to add data-csdk-component-runtime attribute to rendering chromes.
|
|
17
18
|
* @param {JSX.Element} props.children The child components or elements to be wrapped by the metadata code blocks.
|
|
18
19
|
* @returns {JSX.Element} A React fragment containing open and close code blocks surrounding the children elements.
|
|
19
20
|
*/
|
|
20
|
-
const PlaceholderMetadata = ({ rendering, placeholderName, children, }) => {
|
|
21
|
+
const PlaceholderMetadata = ({ rendering, placeholderName, children, componentRuntime, }) => {
|
|
21
22
|
const getCodeBlockAttributes = (kind, id, placeholderName) => {
|
|
22
23
|
const chrometype = placeholderName ? 'placeholder' : 'rendering';
|
|
23
24
|
const attributes = {
|
|
@@ -51,6 +52,10 @@ const PlaceholderMetadata = ({ rendering, placeholderName, children, }) => {
|
|
|
51
52
|
else {
|
|
52
53
|
attributes.id = id;
|
|
53
54
|
}
|
|
55
|
+
// Add component runtime attribute for rendering chromes
|
|
56
|
+
if (chrometype === 'rendering' && componentRuntime) {
|
|
57
|
+
attributes['data-csdk-component-runtime'] = componentRuntime;
|
|
58
|
+
}
|
|
54
59
|
}
|
|
55
60
|
return attributes;
|
|
56
61
|
};
|
|
@@ -3,15 +3,23 @@
|
|
|
3
3
|
/* eslint-disable prefer-const */
|
|
4
4
|
import React, { useEffect, useState } from 'react';
|
|
5
5
|
import { EDITING_COMPONENT_ID, EDITING_COMPONENT_PLACEHOLDER, } from '@sitecore-content-sdk/core/layout';
|
|
6
|
-
import { DesignLibraryStatus, getDesignLibraryStatusEvent, addComponentUpdateHandler,
|
|
6
|
+
import { DesignLibraryStatus, getDesignLibraryStatusEvent, addComponentUpdateHandler, } from '@sitecore-content-sdk/core/editing';
|
|
7
7
|
import * as codegen from '@sitecore-content-sdk/core/codegen';
|
|
8
|
+
import * as editing from '@sitecore-content-sdk/core/editing';
|
|
8
9
|
import { useSitecore } from '../../enhancers/withSitecore';
|
|
9
10
|
import { Placeholder, PlaceholderMetadata } from '../Placeholder';
|
|
10
11
|
import { DesignLibraryErrorBoundary } from './DesignLibraryErrorBoundary';
|
|
11
12
|
import { withLoadImportMap } from '../../enhancers/withLoadImportMap';
|
|
12
13
|
let { getDesignLibraryImportMapEvent, getDesignLibraryComponentPropsEvent, addComponentPreviewHandler, sendErrorEvent, } = codegen;
|
|
14
|
+
let { postToDesignLibrary } = editing;
|
|
13
15
|
export const __mockDependencies = (mocks) => {
|
|
14
16
|
addComponentPreviewHandler = mocks.addComponentPreviewHandler;
|
|
17
|
+
if (mocks.postToDesignLibrary) {
|
|
18
|
+
postToDesignLibrary = mocks.postToDesignLibrary;
|
|
19
|
+
}
|
|
20
|
+
if (mocks.sendErrorEvent) {
|
|
21
|
+
sendErrorEvent = mocks.sendErrorEvent;
|
|
22
|
+
}
|
|
15
23
|
};
|
|
16
24
|
/**
|
|
17
25
|
* Design Library component.
|
|
@@ -3,16 +3,23 @@ import React from 'react';
|
|
|
3
3
|
import { EDITING_COMPONENT_PLACEHOLDER } from '@sitecore-content-sdk/core/layout';
|
|
4
4
|
import { DesignLibraryPreviewEvents, DesignLibraryVariantGenerationEvents, } from './DesignLibraryClientEvents';
|
|
5
5
|
import * as globalCache from '@sitecore-content-sdk/core/utils';
|
|
6
|
-
import { DesignLibraryStatus, COMPONENT_UPDATE_CACHE_KEY_PREFIX, updateComponent, } from '@sitecore-content-sdk/core/editing';
|
|
6
|
+
import { DesignLibraryStatus, COMPONENT_UPDATE_CACHE_KEY_PREFIX, updateComponent as updateComponentOriginal, } from '@sitecore-content-sdk/core/editing';
|
|
7
7
|
import * as codegen from '@sitecore-content-sdk/core/codegen';
|
|
8
8
|
import { AppPlaceholder, PlaceholderMetadata } from '../Placeholder';
|
|
9
9
|
import { DesignLibraryErrorBoundary } from './DesignLibraryErrorBoundary';
|
|
10
10
|
let { getCacheAndClean, hasCache } = globalCache;
|
|
11
|
-
let { createComponentInstance } = codegen;
|
|
11
|
+
let { createComponentInstance, getImportMapInfo } = codegen;
|
|
12
|
+
let updateComponent = updateComponentOriginal;
|
|
12
13
|
export const __mockDependencies = async (mocks) => {
|
|
13
14
|
getCacheAndClean = mocks.getCacheAndClean;
|
|
14
15
|
hasCache = mocks.hasCache;
|
|
15
16
|
createComponentInstance = mocks.createComponentInstance;
|
|
17
|
+
if (mocks.updateComponent) {
|
|
18
|
+
updateComponent = mocks.updateComponent;
|
|
19
|
+
}
|
|
20
|
+
if (mocks.getImportMapInfo) {
|
|
21
|
+
getImportMapInfo = mocks.getImportMapInfo;
|
|
22
|
+
}
|
|
16
23
|
};
|
|
17
24
|
/**
|
|
18
25
|
* Design Library component for rendering server components in app router application.
|
|
@@ -63,7 +70,7 @@ export const DesignLibraryServerVariantGeneration = async ({ page, rendering, lo
|
|
|
63
70
|
try {
|
|
64
71
|
const mod = await loadServerImportMap();
|
|
65
72
|
importMap = mod.default;
|
|
66
|
-
importMapInfo =
|
|
73
|
+
importMapInfo = getImportMapInfo(importMap);
|
|
67
74
|
}
|
|
68
75
|
catch (e) {
|
|
69
76
|
importMapError = `Error loading import map: ${e}`;
|
|
@@ -20,6 +20,8 @@ export const AppPlaceholder = (props) => {
|
|
|
20
20
|
const { component: Component, isEmpty, componentType, dynamic, } = getComponentForRendering(rendering, props.name, componentMap, props.hiddenRenderingComponent, props.missingComponentComponent);
|
|
21
21
|
const isClient = componentType === 'client';
|
|
22
22
|
const key = rendering.uid || `component-${index}`;
|
|
23
|
+
// Use rsc context to determine the current runtime
|
|
24
|
+
const componentRuntime = rsc ? 'server' : 'client';
|
|
23
25
|
const renderedProps = getAppComponentProps(props, rendering);
|
|
24
26
|
const finalRenderedProps = props.modifyComponentProps
|
|
25
27
|
? props.modifyComponentProps(renderedProps)
|
|
@@ -37,7 +39,7 @@ export const AppPlaceholder = (props) => {
|
|
|
37
39
|
// if in edit mode then emit shallow chromes for hydration in Pages
|
|
38
40
|
if (page.mode.isEditing) {
|
|
39
41
|
const key = rendering.uid || `component-${index}`;
|
|
40
|
-
return (React.createElement(PlaceholderMetadata, { key: key, rendering: rendering }, rendered));
|
|
42
|
+
return (React.createElement(PlaceholderMetadata, { key: key, rendering: rendering, componentRuntime: componentRuntime }, rendered));
|
|
41
43
|
}
|
|
42
44
|
return rendered;
|
|
43
45
|
})
|
|
@@ -8,10 +8,11 @@ import { MetadataKind, DEFAULT_PLACEHOLDER_UID } from '@sitecore-content-sdk/cor
|
|
|
8
8
|
* @param {object} props The properties passed to the component.
|
|
9
9
|
* @param {ComponentRendering} props.rendering The rendering data.
|
|
10
10
|
* @param {string} [props.placeholderName] The name of the placeholder.
|
|
11
|
+
* @param {'server' | 'client'} [props.componentRuntime] Component runtime type. Used to add data-csdk-component-runtime attribute to rendering chromes.
|
|
11
12
|
* @param {JSX.Element} props.children The child components or elements to be wrapped by the metadata code blocks.
|
|
12
13
|
* @returns {JSX.Element} A React fragment containing open and close code blocks surrounding the children elements.
|
|
13
14
|
*/
|
|
14
|
-
export const PlaceholderMetadata = ({ rendering, placeholderName, children, }) => {
|
|
15
|
+
export const PlaceholderMetadata = ({ rendering, placeholderName, children, componentRuntime, }) => {
|
|
15
16
|
const getCodeBlockAttributes = (kind, id, placeholderName) => {
|
|
16
17
|
const chrometype = placeholderName ? 'placeholder' : 'rendering';
|
|
17
18
|
const attributes = {
|
|
@@ -45,6 +46,10 @@ export const PlaceholderMetadata = ({ rendering, placeholderName, children, }) =
|
|
|
45
46
|
else {
|
|
46
47
|
attributes.id = id;
|
|
47
48
|
}
|
|
49
|
+
// Add component runtime attribute for rendering chromes
|
|
50
|
+
if (chrometype === 'rendering' && componentRuntime) {
|
|
51
|
+
attributes['data-csdk-component-runtime'] = componentRuntime;
|
|
52
|
+
}
|
|
48
53
|
}
|
|
49
54
|
return attributes;
|
|
50
55
|
};
|
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.22",
|
|
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.22",
|
|
80
80
|
"fast-deep-equal": "^3.1.3"
|
|
81
81
|
},
|
|
82
82
|
"description": "",
|
|
83
83
|
"types": "types/index.d.ts",
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "a4694b7c21fb202316c9521f1c160e0b9075152b",
|
|
85
85
|
"files": [
|
|
86
86
|
"dist",
|
|
87
87
|
"types"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DesignLibrary.d.ts","sourceRoot":"","sources":["../../../src/components/DesignLibrary/DesignLibrary.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAenD,OAAO,EAAE,kBAAkB,EAAoB,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"DesignLibrary.d.ts","sourceRoot":"","sources":["../../../src/components/DesignLibrary/DesignLibrary.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAenD,OAAO,EAAE,kBAAkB,EAAoB,MAAM,UAAU,CAAC;AAWhE,eAAO,MAAM,kBAAkB,GAAI,OAAO,GAAG,SAQ5C,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa;;;CAyHxB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DesignLibraryServer.d.ts","sourceRoot":"","sources":["../../../src/components/DesignLibrary/DesignLibraryServer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAiB1B,OAAO,EAEL,wBAAwB,EACxB,+BAA+B,EAC/B,yCAAyC,EAC1C,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"DesignLibraryServer.d.ts","sourceRoot":"","sources":["../../../src/components/DesignLibrary/DesignLibraryServer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAiB1B,OAAO,EAEL,wBAAwB,EACxB,+BAA+B,EAC/B,yCAAyC,EAC1C,MAAM,UAAU,CAAC;AAMlB,eAAO,MAAM,kBAAkB,GAAU,OAAO,GAAG,kBAUlD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,GAAU,yDAKvC,wBAAwB,+BAqB1B,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,oCAAoC,GAAU,yDAKxD,yCAAyC,+BAiF3C,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,0BAA0B,GAAU,oCAI9C,+BAA+B,+BAqCjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppPlaceholder.d.ts","sourceRoot":"","sources":["../../../src/components/Placeholder/AppPlaceholder.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAO/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,mBAAmB,
|
|
1
|
+
{"version":3,"file":"AppPlaceholder.d.ts","sourceRoot":"","sources":["../../../src/components/Placeholder/AppPlaceholder.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAO/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,mBAAmB,8fAyHxD,CAAC"}
|
|
@@ -7,6 +7,10 @@ export interface PlaceholderMetadataProps {
|
|
|
7
7
|
rendering: ComponentRendering;
|
|
8
8
|
placeholderName?: string;
|
|
9
9
|
children?: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Component runtime type. Used to add data-csdk-component-runtime attribute to rendering chromes
|
|
12
|
+
*/
|
|
13
|
+
componentRuntime?: 'server' | 'client';
|
|
10
14
|
}
|
|
11
15
|
export type CodeBlockAttributes = {
|
|
12
16
|
type: string;
|
|
@@ -14,6 +18,7 @@ export type CodeBlockAttributes = {
|
|
|
14
18
|
className: string;
|
|
15
19
|
kind: string;
|
|
16
20
|
id?: string;
|
|
21
|
+
'data-csdk-component-runtime'?: 'server' | 'client';
|
|
17
22
|
};
|
|
18
23
|
/**
|
|
19
24
|
* A React component to generate metadata blocks for a placeholder or rendering.
|
|
@@ -22,8 +27,9 @@ export type CodeBlockAttributes = {
|
|
|
22
27
|
* @param {object} props The properties passed to the component.
|
|
23
28
|
* @param {ComponentRendering} props.rendering The rendering data.
|
|
24
29
|
* @param {string} [props.placeholderName] The name of the placeholder.
|
|
30
|
+
* @param {'server' | 'client'} [props.componentRuntime] Component runtime type. Used to add data-csdk-component-runtime attribute to rendering chromes.
|
|
25
31
|
* @param {JSX.Element} props.children The child components or elements to be wrapped by the metadata code blocks.
|
|
26
32
|
* @returns {JSX.Element} A React fragment containing open and close code blocks surrounding the children elements.
|
|
27
33
|
*/
|
|
28
|
-
export declare const PlaceholderMetadata: ({ rendering, placeholderName, children, }: PlaceholderMetadataProps) => JSX.Element;
|
|
34
|
+
export declare const PlaceholderMetadata: ({ rendering, placeholderName, children, componentRuntime, }: PlaceholderMetadataProps) => JSX.Element;
|
|
29
35
|
//# sourceMappingURL=PlaceholderMetadata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlaceholderMetadata.d.ts","sourceRoot":"","sources":["../../../src/components/Placeholder/PlaceholderMetadata.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EACL,kBAAkB,EAGnB,MAAM,mCAAmC,CAAC;AAG3C;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,kBAAkB,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"PlaceholderMetadata.d.ts","sourceRoot":"","sources":["../../../src/components/Placeholder/PlaceholderMetadata.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EACL,kBAAkB,EAGnB,MAAM,mCAAmC,CAAC;AAG3C;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,kBAAkB,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;OAEG;IACH,gBAAgB,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CACxC;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,6BAA6B,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CACrD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,GAAI,6DAKjC,wBAAwB,KAAG,GAAG,CAAC,OA8DjC,CAAC"}
|