@lwrjs/shared-utils 0.20.1 → 0.20.2
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/build/cjs/html-meta.cjs +7 -1
- package/build/es/html-meta.d.ts +10 -3
- package/build/es/html-meta.js +10 -1
- package/package.json +4 -4
package/build/cjs/html-meta.cjs
CHANGED
|
@@ -27,10 +27,12 @@ __export(exports, {
|
|
|
27
27
|
HYDRATE_CLIENT_VALUE: () => HYDRATE_CLIENT_VALUE,
|
|
28
28
|
HYDRATE_DIRECTIVE: () => HYDRATE_DIRECTIVE,
|
|
29
29
|
HYDRATE_LOAD_VALUE: () => HYDRATE_LOAD_VALUE,
|
|
30
|
+
HYDRATE_VISIBLE_VALUE: () => HYDRATE_VISIBLE_VALUE,
|
|
30
31
|
extractMetadataFromHtml: () => extractMetadataFromHtml,
|
|
31
32
|
getHydrateDirective: () => getHydrateDirective,
|
|
32
33
|
isCsrIsland: () => isCsrIsland,
|
|
33
34
|
isHydrateOnLoad: () => isHydrateOnLoad,
|
|
35
|
+
isHydrateVisible: () => isHydrateVisible,
|
|
34
36
|
isRelative: () => isRelative,
|
|
35
37
|
isSelfUrl: () => isSelfUrl
|
|
36
38
|
});
|
|
@@ -172,8 +174,9 @@ function extractMetadataFromHtml(htmlSource, viewMetadata, appConfig) {
|
|
|
172
174
|
}
|
|
173
175
|
var HYDRATE_DIRECTIVE = "lwr:hydrate";
|
|
174
176
|
var HYDRATE_LOAD_VALUE = "load";
|
|
177
|
+
var HYDRATE_VISIBLE_VALUE = "visible";
|
|
175
178
|
var HYDRATE_CLIENT_VALUE = "client-only";
|
|
176
|
-
var HYDRATION_VALUES = [HYDRATE_LOAD_VALUE, HYDRATE_CLIENT_VALUE];
|
|
179
|
+
var HYDRATION_VALUES = [HYDRATE_LOAD_VALUE, HYDRATE_CLIENT_VALUE, HYDRATE_VISIBLE_VALUE];
|
|
177
180
|
function getHydrateDirective(props = {}) {
|
|
178
181
|
const rawValue = props[HYDRATE_DIRECTIVE];
|
|
179
182
|
const value = rawValue === "true" ? HYDRATE_LOAD_VALUE : rawValue;
|
|
@@ -183,6 +186,9 @@ function getHydrateDirective(props = {}) {
|
|
|
183
186
|
function isHydrateOnLoad(props = {}) {
|
|
184
187
|
return getHydrateDirective(props) === HYDRATE_LOAD_VALUE;
|
|
185
188
|
}
|
|
189
|
+
function isHydrateVisible(props = {}) {
|
|
190
|
+
return getHydrateDirective(props) === HYDRATE_VISIBLE_VALUE;
|
|
191
|
+
}
|
|
186
192
|
function isCsrIsland(props = {}) {
|
|
187
193
|
return getHydrateDirective(props) === HYDRATE_CLIENT_VALUE;
|
|
188
194
|
}
|
package/build/es/html-meta.d.ts
CHANGED
|
@@ -8,8 +8,15 @@ export declare function isSelfUrl(url: string): boolean;
|
|
|
8
8
|
export declare function extractMetadataFromHtml(htmlSource: string, viewMetadata: RenderedViewMetadata, appConfig: NormalizedLwrGlobalConfig): HtmlMetadata;
|
|
9
9
|
export declare const HYDRATE_DIRECTIVE = "lwr:hydrate";
|
|
10
10
|
export declare const HYDRATE_LOAD_VALUE = "load";
|
|
11
|
+
export declare const HYDRATE_VISIBLE_VALUE = "visible";
|
|
11
12
|
export declare const HYDRATE_CLIENT_VALUE = "client-only";
|
|
12
|
-
export declare function getHydrateDirective(props?: Record<string, string
|
|
13
|
-
export declare function isHydrateOnLoad(props?:
|
|
14
|
-
|
|
13
|
+
export declare function getHydrateDirective(props?: Readonly<Record<string, string>>): string | undefined;
|
|
14
|
+
export declare function isHydrateOnLoad(props?: Readonly<Record<string, string>>): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Checks if the custom element is a hydration visible island by on the lwr:hydrate attribute.
|
|
17
|
+
* @param props - The custom element properties
|
|
18
|
+
* @returns True if the custom element is a hydration visible island
|
|
19
|
+
*/
|
|
20
|
+
export declare function isHydrateVisible(props?: Readonly<Record<string, string>>): boolean;
|
|
21
|
+
export declare function isCsrIsland(props?: Readonly<Record<string, string>>): boolean;
|
|
15
22
|
//# sourceMappingURL=html-meta.d.ts.map
|
package/build/es/html-meta.js
CHANGED
|
@@ -171,8 +171,9 @@ export function extractMetadataFromHtml(htmlSource, viewMetadata, appConfig) {
|
|
|
171
171
|
}
|
|
172
172
|
export const HYDRATE_DIRECTIVE = 'lwr:hydrate';
|
|
173
173
|
export const HYDRATE_LOAD_VALUE = 'load';
|
|
174
|
+
export const HYDRATE_VISIBLE_VALUE = 'visible';
|
|
174
175
|
export const HYDRATE_CLIENT_VALUE = 'client-only';
|
|
175
|
-
const HYDRATION_VALUES = [HYDRATE_LOAD_VALUE, HYDRATE_CLIENT_VALUE];
|
|
176
|
+
const HYDRATION_VALUES = [HYDRATE_LOAD_VALUE, HYDRATE_CLIENT_VALUE, HYDRATE_VISIBLE_VALUE];
|
|
176
177
|
export function getHydrateDirective(props = {}) {
|
|
177
178
|
const rawValue = props[HYDRATE_DIRECTIVE];
|
|
178
179
|
const value = rawValue === 'true' ? HYDRATE_LOAD_VALUE : rawValue; // valueless hyration directives => lwr:hydrate="load"
|
|
@@ -182,6 +183,14 @@ export function getHydrateDirective(props = {}) {
|
|
|
182
183
|
export function isHydrateOnLoad(props = {}) {
|
|
183
184
|
return getHydrateDirective(props) === HYDRATE_LOAD_VALUE;
|
|
184
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* Checks if the custom element is a hydration visible island by on the lwr:hydrate attribute.
|
|
188
|
+
* @param props - The custom element properties
|
|
189
|
+
* @returns True if the custom element is a hydration visible island
|
|
190
|
+
*/
|
|
191
|
+
export function isHydrateVisible(props = {}) {
|
|
192
|
+
return getHydrateDirective(props) === HYDRATE_VISIBLE_VALUE;
|
|
193
|
+
}
|
|
185
194
|
export function isCsrIsland(props = {}) {
|
|
186
195
|
return getHydrateDirective(props) === HYDRATE_CLIENT_VALUE;
|
|
187
196
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.20.
|
|
7
|
+
"version": "0.20.2",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"build/**/*.d.ts"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@lwrjs/diagnostics": "0.20.
|
|
40
|
+
"@lwrjs/diagnostics": "0.20.2",
|
|
41
41
|
"es-module-lexer": "^1.5.4",
|
|
42
42
|
"fast-json-stable-stringify": "^2.1.0",
|
|
43
43
|
"magic-string": "^0.30.9",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"slugify": "^1.4.5"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@lwrjs/types": "0.20.
|
|
53
|
+
"@lwrjs/types": "0.20.2",
|
|
54
54
|
"@types/mime-types": "2.1.4",
|
|
55
55
|
"@types/path-to-regexp": "^1.7.0",
|
|
56
56
|
"memfs": "^4.13.0"
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">=20.0.0"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "be82aca54f9a3b6cd18a4aac86f2f96c0184a930"
|
|
62
62
|
}
|