@lwrjs/client-modules 0.7.0-alpha.11 → 0.7.0-alpha.12
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.
|
@@ -10,18 +10,20 @@ export function toKebabCase(specifier) {
|
|
|
10
10
|
* @param components - An array of arrays, each one holding:
|
|
11
11
|
* 0. a bare specifier
|
|
12
12
|
* 1. the corresponding LightningElement constructor
|
|
13
|
-
*
|
|
13
|
+
* @param ssrProps - map of properties to set on each component
|
|
14
14
|
* @example - [['x/appRoot', appCtor], ['x/nav', navCtor]]
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
export function init(components) {
|
|
17
|
+
export function init(components, ssrProps = {}) {
|
|
18
18
|
if (typeof document !== 'undefined') {
|
|
19
|
-
components.forEach(([moduleSpecifier, ctor
|
|
19
|
+
components.forEach(([moduleSpecifier, ctor]) => {
|
|
20
20
|
// Kebab-case the specifier
|
|
21
21
|
const elementName = toKebabCase(moduleSpecifier); // Find all instances of the component in the document, and hydrate them all
|
|
22
22
|
|
|
23
23
|
const customElements = document.querySelectorAll(elementName);
|
|
24
24
|
customElements.forEach(customElement => {
|
|
25
|
+
const propsId = customElement.dataset.lwrPropsId;
|
|
26
|
+
const props = ssrProps[propsId] || {};
|
|
25
27
|
hydrateComponent(customElement, ctor, props);
|
|
26
28
|
});
|
|
27
29
|
});
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.7.0-alpha.
|
|
7
|
+
"version": "0.7.0-alpha.12",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@locker/sandbox": "0.16.14",
|
|
35
|
-
"@lwrjs/shared-utils": "0.7.0-alpha.
|
|
35
|
+
"@lwrjs/shared-utils": "0.7.0-alpha.12"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"rollup-plugin-terser": "^7.0.2"
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">=14.15.4 <17"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "785b8380a821b43b7320783dddaf20d1433216e2"
|
|
62
62
|
}
|