@lwrjs/client-modules 0.7.0-alpha.4 → 0.7.0-alpha.7
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// TODO: This is a temporal workaround until https://github.com/salesforce/lwc/pull/
|
|
1
|
+
// TODO: This is a temporal workaround until https://github.com/salesforce/lwc/pull/2564 is sorted
|
|
2
2
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3
3
|
// @ts-ignore
|
|
4
4
|
import { hydrateComponent } from 'lwc';
|
|
@@ -6,29 +6,23 @@ export function toKebabCase(specifier) {
|
|
|
6
6
|
return specifier.replace(/\/v\/[a-zA-Z0-9-_.]+$/, '').replace('/', '-').replace(/([A-Z])/g, c => `-${c.toLowerCase()}`);
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export function getPropFromAttrName(propName) {
|
|
15
|
-
return propName.replace(CAMEL_REGEX, g => g[1].toUpperCase());
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Hydrate the given components component(s).
|
|
19
|
-
* @param components - An array of arrays, each one holding a pair of
|
|
20
|
-
* bare specifier and corresponding LightningElement constructor
|
|
9
|
+
* Hydrate the given component(s) which were server-side rendered (see the lwc-ssr/viewTransformer).
|
|
10
|
+
* @param components - An array of arrays, each one holding:
|
|
11
|
+
* 0. a bare specifier
|
|
12
|
+
* 1. the corresponding LightningElement constructor
|
|
13
|
+
* 2. properties to set on the component
|
|
21
14
|
* @example - [['x/appRoot', appCtor], ['x/nav', navCtor]]
|
|
22
15
|
*/
|
|
23
16
|
|
|
24
17
|
export function init(components) {
|
|
25
18
|
if (typeof document !== 'undefined') {
|
|
26
|
-
components.forEach(([moduleSpecifier, ctor]) => {
|
|
19
|
+
components.forEach(([moduleSpecifier, ctor, props]) => {
|
|
27
20
|
// Kebab-case the specifier
|
|
28
|
-
const elementName = toKebabCase(moduleSpecifier);
|
|
21
|
+
const elementName = toKebabCase(moduleSpecifier); // Find all instances of the component in the document, and hydrate them all
|
|
22
|
+
|
|
29
23
|
const customElements = document.querySelectorAll(elementName);
|
|
30
24
|
customElements.forEach(customElement => {
|
|
31
|
-
hydrateComponent(customElement, ctor,
|
|
25
|
+
hydrateComponent(customElement, ctor, props);
|
|
32
26
|
});
|
|
33
27
|
});
|
|
34
28
|
}
|
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.7",
|
|
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.1",
|
|
35
|
-
"@lwrjs/shared-utils": "0.7.0-alpha.
|
|
35
|
+
"@lwrjs/shared-utils": "0.7.0-alpha.7"
|
|
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": "37d42307c304716834ce39944d5677e95d04a63a"
|
|
62
62
|
}
|