lwc 2.5.6 → 2.5.10
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/engine-dom/esm/es2017/engine-dom.js +605 -181
- package/dist/engine-dom/iife/es2017/engine-dom.js +605 -181
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +406 -169
- package/dist/engine-dom/iife/es5/engine-dom.js +684 -242
- package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +466 -221
- package/dist/engine-dom/umd/es2017/engine-dom.js +605 -181
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +406 -169
- package/dist/engine-dom/umd/es5/engine-dom.js +684 -242
- package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +466 -221
- package/dist/engine-server/commonjs/es2017/engine-server.js +484 -133
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
- package/dist/engine-server/esm/es2017/engine-server.js +485 -133
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es5/wire-service.js +2 -2
- package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es5/wire-service.js +2 -2
- package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
- package/package.json +8 -8
|
@@ -73,7 +73,7 @@ const {
|
|
|
73
73
|
find: ArrayFind,
|
|
74
74
|
indexOf: ArrayIndexOf,
|
|
75
75
|
join: ArrayJoin,
|
|
76
|
-
map: ArrayMap
|
|
76
|
+
map: ArrayMap,
|
|
77
77
|
push: ArrayPush$1,
|
|
78
78
|
reduce: ArrayReduce,
|
|
79
79
|
reverse: ArrayReverse,
|
|
@@ -140,7 +140,7 @@ function toString$1(obj) {
|
|
|
140
140
|
// Array.prototype.toString directly will cause an error Iterate through
|
|
141
141
|
// all the items and handle individually.
|
|
142
142
|
if (isArray$1(obj)) {
|
|
143
|
-
return ArrayJoin.call(ArrayMap
|
|
143
|
+
return ArrayJoin.call(ArrayMap.call(obj, toString$1), ',');
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
return obj.toString();
|
|
@@ -339,7 +339,7 @@ function htmlPropertyToAttribute(propName) {
|
|
|
339
339
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
340
340
|
return attributeName;
|
|
341
341
|
}
|
|
342
|
-
/** version: 2.5.
|
|
342
|
+
/** version: 2.5.10 */
|
|
343
343
|
|
|
344
344
|
/*
|
|
345
345
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -460,7 +460,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
460
460
|
setFeatureFlag(name, value);
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
|
-
/** version: 2.5.
|
|
463
|
+
/** version: 2.5.10 */
|
|
464
464
|
|
|
465
465
|
/* proxy-compat-disable */
|
|
466
466
|
|
|
@@ -512,6 +512,28 @@ function guid() {
|
|
|
512
512
|
}
|
|
513
513
|
|
|
514
514
|
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
515
|
+
} // Borrowed from Vue template compiler.
|
|
516
|
+
// https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
const DECLARATION_DELIMITER = /;(?![^(]*\))/g;
|
|
520
|
+
const PROPERTY_DELIMITER = /:(.+)/;
|
|
521
|
+
|
|
522
|
+
function parseStyleText(cssText) {
|
|
523
|
+
const styleMap = {};
|
|
524
|
+
const declarations = cssText.split(DECLARATION_DELIMITER);
|
|
525
|
+
|
|
526
|
+
for (const declaration of declarations) {
|
|
527
|
+
if (declaration) {
|
|
528
|
+
const [prop, value] = declaration.split(PROPERTY_DELIMITER);
|
|
529
|
+
|
|
530
|
+
if (prop !== undefined && value !== undefined) {
|
|
531
|
+
styleMap[prop.trim()] = value.trim();
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
return styleMap;
|
|
515
537
|
}
|
|
516
538
|
/*
|
|
517
539
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
@@ -693,8 +715,8 @@ function getErrorComponentStack(vm) {
|
|
|
693
715
|
*/
|
|
694
716
|
|
|
695
717
|
|
|
696
|
-
function
|
|
697
|
-
let msg = `[LWC
|
|
718
|
+
function log(method, message, vm) {
|
|
719
|
+
let msg = `[LWC ${method}]: ${message}`;
|
|
698
720
|
|
|
699
721
|
if (!isUndefined$1(vm)) {
|
|
700
722
|
msg = `${msg}\n${getComponentStack(vm)}`;
|
|
@@ -702,7 +724,7 @@ function logError(message, vm) {
|
|
|
702
724
|
|
|
703
725
|
if (process.env.NODE_ENV === 'test') {
|
|
704
726
|
/* eslint-disable-next-line no-console */
|
|
705
|
-
console
|
|
727
|
+
console[method](msg);
|
|
706
728
|
return;
|
|
707
729
|
}
|
|
708
730
|
|
|
@@ -710,9 +732,17 @@ function logError(message, vm) {
|
|
|
710
732
|
throw new Error(msg);
|
|
711
733
|
} catch (e) {
|
|
712
734
|
/* eslint-disable-next-line no-console */
|
|
713
|
-
console
|
|
735
|
+
console[method](e);
|
|
714
736
|
}
|
|
715
737
|
}
|
|
738
|
+
|
|
739
|
+
function logError(message, vm) {
|
|
740
|
+
log('error', message, vm);
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
function logWarn(message, vm) {
|
|
744
|
+
log('warn', message, vm);
|
|
745
|
+
}
|
|
716
746
|
/*
|
|
717
747
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
718
748
|
* All rights reserved.
|
|
@@ -1880,7 +1910,6 @@ const {
|
|
|
1880
1910
|
getPrototypeOf,
|
|
1881
1911
|
create: ObjectCreate,
|
|
1882
1912
|
defineProperty: ObjectDefineProperty,
|
|
1883
|
-
defineProperties: ObjectDefineProperties,
|
|
1884
1913
|
isExtensible,
|
|
1885
1914
|
getOwnPropertyDescriptor,
|
|
1886
1915
|
getOwnPropertyNames,
|
|
@@ -1890,8 +1919,7 @@ const {
|
|
|
1890
1919
|
} = Object;
|
|
1891
1920
|
const {
|
|
1892
1921
|
push: ArrayPush,
|
|
1893
|
-
concat: ArrayConcat
|
|
1894
|
-
map: ArrayMap
|
|
1922
|
+
concat: ArrayConcat
|
|
1895
1923
|
} = Array.prototype;
|
|
1896
1924
|
const OtS = {}.toString;
|
|
1897
1925
|
|
|
@@ -1956,7 +1984,9 @@ class BaseProxyHandler {
|
|
|
1956
1984
|
// but it will always be compatible with the previous descriptor
|
|
1957
1985
|
// to preserve the object invariants, which makes these lines safe.
|
|
1958
1986
|
|
|
1959
|
-
const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key);
|
|
1987
|
+
const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key); // TODO: it should be impossible for the originalDescriptor to ever be undefined, this `if` can be removed
|
|
1988
|
+
|
|
1989
|
+
/* istanbul ignore else */
|
|
1960
1990
|
|
|
1961
1991
|
if (!isUndefined(originalDescriptor)) {
|
|
1962
1992
|
const wrappedDesc = this.wrapDescriptor(originalDescriptor);
|
|
@@ -1984,11 +2014,17 @@ class BaseProxyHandler {
|
|
|
1984
2014
|
|
|
1985
2015
|
preventExtensions(shadowTarget);
|
|
1986
2016
|
} // Shared Traps
|
|
2017
|
+
// TODO: apply() is never called
|
|
2018
|
+
|
|
2019
|
+
/* istanbul ignore next */
|
|
1987
2020
|
|
|
1988
2021
|
|
|
1989
2022
|
apply(shadowTarget, thisArg, argArray) {
|
|
1990
2023
|
/* No op */
|
|
1991
|
-
}
|
|
2024
|
+
} // TODO: construct() is never called
|
|
2025
|
+
|
|
2026
|
+
/* istanbul ignore next */
|
|
2027
|
+
|
|
1992
2028
|
|
|
1993
2029
|
construct(shadowTarget, argArray, newTarget) {
|
|
1994
2030
|
/* No op */
|
|
@@ -2101,8 +2137,8 @@ class BaseProxyHandler {
|
|
|
2101
2137
|
|
|
2102
2138
|
}
|
|
2103
2139
|
|
|
2104
|
-
const getterMap = new WeakMap();
|
|
2105
|
-
const setterMap = new WeakMap();
|
|
2140
|
+
const getterMap$1 = new WeakMap();
|
|
2141
|
+
const setterMap$1 = new WeakMap();
|
|
2106
2142
|
const reverseGetterMap = new WeakMap();
|
|
2107
2143
|
const reverseSetterMap = new WeakMap();
|
|
2108
2144
|
|
|
@@ -2112,7 +2148,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
|
|
|
2112
2148
|
}
|
|
2113
2149
|
|
|
2114
2150
|
wrapGetter(originalGet) {
|
|
2115
|
-
const wrappedGetter = getterMap.get(originalGet);
|
|
2151
|
+
const wrappedGetter = getterMap$1.get(originalGet);
|
|
2116
2152
|
|
|
2117
2153
|
if (!isUndefined(wrappedGetter)) {
|
|
2118
2154
|
return wrappedGetter;
|
|
@@ -2125,13 +2161,13 @@ class ReactiveProxyHandler extends BaseProxyHandler {
|
|
|
2125
2161
|
return handler.wrapValue(originalGet.call(unwrap$1(this)));
|
|
2126
2162
|
};
|
|
2127
2163
|
|
|
2128
|
-
getterMap.set(originalGet, get);
|
|
2164
|
+
getterMap$1.set(originalGet, get);
|
|
2129
2165
|
reverseGetterMap.set(get, originalGet);
|
|
2130
2166
|
return get;
|
|
2131
2167
|
}
|
|
2132
2168
|
|
|
2133
2169
|
wrapSetter(originalSet) {
|
|
2134
|
-
const wrappedSetter = setterMap.get(originalSet);
|
|
2170
|
+
const wrappedSetter = setterMap$1.get(originalSet);
|
|
2135
2171
|
|
|
2136
2172
|
if (!isUndefined(wrappedSetter)) {
|
|
2137
2173
|
return wrappedSetter;
|
|
@@ -2142,7 +2178,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
|
|
|
2142
2178
|
originalSet.call(unwrap$1(this), unwrap$1(v));
|
|
2143
2179
|
};
|
|
2144
2180
|
|
|
2145
|
-
setterMap.set(originalSet, set);
|
|
2181
|
+
setterMap$1.set(originalSet, set);
|
|
2146
2182
|
reverseSetterMap.set(set, originalSet);
|
|
2147
2183
|
return set;
|
|
2148
2184
|
}
|
|
@@ -2183,7 +2219,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
|
|
|
2183
2219
|
return unwrap$1(redGet.call(handler.wrapValue(this)));
|
|
2184
2220
|
};
|
|
2185
2221
|
|
|
2186
|
-
getterMap.set(get, redGet);
|
|
2222
|
+
getterMap$1.set(get, redGet);
|
|
2187
2223
|
reverseGetterMap.set(redGet, get);
|
|
2188
2224
|
return get;
|
|
2189
2225
|
}
|
|
@@ -2202,7 +2238,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
|
|
|
2202
2238
|
redSet.call(handler.wrapValue(this), handler.wrapValue(v));
|
|
2203
2239
|
};
|
|
2204
2240
|
|
|
2205
|
-
setterMap.set(set, redSet);
|
|
2241
|
+
setterMap$1.set(set, redSet);
|
|
2206
2242
|
reverseSetterMap.set(redSet, set);
|
|
2207
2243
|
return set;
|
|
2208
2244
|
}
|
|
@@ -2243,6 +2279,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
|
|
|
2243
2279
|
}
|
|
2244
2280
|
|
|
2245
2281
|
setPrototypeOf(shadowTarget, prototype) {
|
|
2282
|
+
/* istanbul ignore else */
|
|
2246
2283
|
if (process.env.NODE_ENV !== 'production') {
|
|
2247
2284
|
throw new Error(`Invalid setPrototypeOf invocation for reactive proxy ${toString(this.originalTarget)}. Prototype of reactive objects cannot be changed.`);
|
|
2248
2285
|
}
|
|
@@ -2256,6 +2293,11 @@ class ReactiveProxyHandler extends BaseProxyHandler {
|
|
|
2256
2293
|
preventExtensions(originalTarget); // if the originalTarget is a proxy itself, it might reject
|
|
2257
2294
|
// the preventExtension call, in which case we should not attempt to lock down
|
|
2258
2295
|
// the shadow target.
|
|
2296
|
+
// TODO: It should not actually be possible to reach this `if` statement.
|
|
2297
|
+
// If a proxy rejects extensions, then calling preventExtensions will throw an error:
|
|
2298
|
+
// https://codepen.io/nolanlawson-the-selector/pen/QWMOjbY
|
|
2299
|
+
|
|
2300
|
+
/* istanbul ignore if */
|
|
2259
2301
|
|
|
2260
2302
|
if (isExtensible(originalTarget)) {
|
|
2261
2303
|
return false;
|
|
@@ -2297,8 +2339,8 @@ class ReactiveProxyHandler extends BaseProxyHandler {
|
|
|
2297
2339
|
|
|
2298
2340
|
}
|
|
2299
2341
|
|
|
2300
|
-
const getterMap
|
|
2301
|
-
const setterMap
|
|
2342
|
+
const getterMap = new WeakMap();
|
|
2343
|
+
const setterMap = new WeakMap();
|
|
2302
2344
|
|
|
2303
2345
|
class ReadOnlyHandler extends BaseProxyHandler {
|
|
2304
2346
|
wrapValue(value) {
|
|
@@ -2306,7 +2348,7 @@ class ReadOnlyHandler extends BaseProxyHandler {
|
|
|
2306
2348
|
}
|
|
2307
2349
|
|
|
2308
2350
|
wrapGetter(originalGet) {
|
|
2309
|
-
const wrappedGetter = getterMap
|
|
2351
|
+
const wrappedGetter = getterMap.get(originalGet);
|
|
2310
2352
|
|
|
2311
2353
|
if (!isUndefined(wrappedGetter)) {
|
|
2312
2354
|
return wrappedGetter;
|
|
@@ -2319,12 +2361,12 @@ class ReadOnlyHandler extends BaseProxyHandler {
|
|
|
2319
2361
|
return handler.wrapValue(originalGet.call(unwrap$1(this)));
|
|
2320
2362
|
};
|
|
2321
2363
|
|
|
2322
|
-
getterMap
|
|
2364
|
+
getterMap.set(originalGet, get);
|
|
2323
2365
|
return get;
|
|
2324
2366
|
}
|
|
2325
2367
|
|
|
2326
2368
|
wrapSetter(originalSet) {
|
|
2327
|
-
const wrappedSetter = setterMap
|
|
2369
|
+
const wrappedSetter = setterMap.get(originalSet);
|
|
2328
2370
|
|
|
2329
2371
|
if (!isUndefined(wrappedSetter)) {
|
|
2330
2372
|
return wrappedSetter;
|
|
@@ -2333,6 +2375,7 @@ class ReadOnlyHandler extends BaseProxyHandler {
|
|
|
2333
2375
|
const handler = this;
|
|
2334
2376
|
|
|
2335
2377
|
const set = function (v) {
|
|
2378
|
+
/* istanbul ignore else */
|
|
2336
2379
|
if (process.env.NODE_ENV !== 'production') {
|
|
2337
2380
|
const {
|
|
2338
2381
|
originalTarget
|
|
@@ -2341,33 +2384,41 @@ class ReadOnlyHandler extends BaseProxyHandler {
|
|
|
2341
2384
|
}
|
|
2342
2385
|
};
|
|
2343
2386
|
|
|
2344
|
-
setterMap
|
|
2387
|
+
setterMap.set(originalSet, set);
|
|
2345
2388
|
return set;
|
|
2346
2389
|
}
|
|
2347
2390
|
|
|
2348
2391
|
set(shadowTarget, key, value) {
|
|
2392
|
+
/* istanbul ignore else */
|
|
2349
2393
|
if (process.env.NODE_ENV !== 'production') {
|
|
2350
2394
|
const {
|
|
2351
2395
|
originalTarget
|
|
2352
2396
|
} = this;
|
|
2353
|
-
|
|
2397
|
+
const msg = isArray(originalTarget) ? `Invalid mutation: Cannot mutate array at index ${key.toString()}. Array is read-only.` : `Invalid mutation: Cannot set "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`;
|
|
2398
|
+
throw new Error(msg);
|
|
2354
2399
|
}
|
|
2400
|
+
/* istanbul ignore next */
|
|
2401
|
+
|
|
2355
2402
|
|
|
2356
2403
|
return false;
|
|
2357
2404
|
}
|
|
2358
2405
|
|
|
2359
2406
|
deleteProperty(shadowTarget, key) {
|
|
2407
|
+
/* istanbul ignore else */
|
|
2360
2408
|
if (process.env.NODE_ENV !== 'production') {
|
|
2361
2409
|
const {
|
|
2362
2410
|
originalTarget
|
|
2363
2411
|
} = this;
|
|
2364
2412
|
throw new Error(`Invalid mutation: Cannot delete "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`);
|
|
2365
2413
|
}
|
|
2414
|
+
/* istanbul ignore next */
|
|
2415
|
+
|
|
2366
2416
|
|
|
2367
2417
|
return false;
|
|
2368
2418
|
}
|
|
2369
2419
|
|
|
2370
2420
|
setPrototypeOf(shadowTarget, prototype) {
|
|
2421
|
+
/* istanbul ignore else */
|
|
2371
2422
|
if (process.env.NODE_ENV !== 'production') {
|
|
2372
2423
|
const {
|
|
2373
2424
|
originalTarget
|
|
@@ -2377,23 +2428,29 @@ class ReadOnlyHandler extends BaseProxyHandler {
|
|
|
2377
2428
|
}
|
|
2378
2429
|
|
|
2379
2430
|
preventExtensions(shadowTarget) {
|
|
2431
|
+
/* istanbul ignore else */
|
|
2380
2432
|
if (process.env.NODE_ENV !== 'production') {
|
|
2381
2433
|
const {
|
|
2382
2434
|
originalTarget
|
|
2383
2435
|
} = this;
|
|
2384
2436
|
throw new Error(`Invalid mutation: Cannot preventExtensions on ${originalTarget}". "${originalTarget} is read-only.`);
|
|
2385
2437
|
}
|
|
2438
|
+
/* istanbul ignore next */
|
|
2439
|
+
|
|
2386
2440
|
|
|
2387
2441
|
return false;
|
|
2388
2442
|
}
|
|
2389
2443
|
|
|
2390
2444
|
defineProperty(shadowTarget, key, descriptor) {
|
|
2445
|
+
/* istanbul ignore else */
|
|
2391
2446
|
if (process.env.NODE_ENV !== 'production') {
|
|
2392
2447
|
const {
|
|
2393
2448
|
originalTarget
|
|
2394
2449
|
} = this;
|
|
2395
2450
|
throw new Error(`Invalid mutation: Cannot defineProperty "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`);
|
|
2396
2451
|
}
|
|
2452
|
+
/* istanbul ignore next */
|
|
2453
|
+
|
|
2397
2454
|
|
|
2398
2455
|
return false;
|
|
2399
2456
|
}
|
|
@@ -2451,6 +2508,8 @@ const formatter = {
|
|
|
2451
2508
|
}; // Inspired from paulmillr/es6-shim
|
|
2452
2509
|
// https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js#L176-L185
|
|
2453
2510
|
|
|
2511
|
+
/* istanbul ignore next */
|
|
2512
|
+
|
|
2454
2513
|
function getGlobal() {
|
|
2455
2514
|
// the only reliable means to get the global object is `Function('return this')()`
|
|
2456
2515
|
// However, this causes CSP violations in Chrome apps.
|
|
@@ -2475,6 +2534,7 @@ function getGlobal() {
|
|
|
2475
2534
|
}
|
|
2476
2535
|
|
|
2477
2536
|
function init() {
|
|
2537
|
+
/* istanbul ignore if */
|
|
2478
2538
|
if (process.env.NODE_ENV === 'production') {
|
|
2479
2539
|
// this method should never leak to prod
|
|
2480
2540
|
throw new ReferenceError();
|
|
@@ -2489,6 +2549,8 @@ function init() {
|
|
|
2489
2549
|
ArrayPush.call(devtoolsFormatters, formatter);
|
|
2490
2550
|
global.devtoolsFormatters = devtoolsFormatters;
|
|
2491
2551
|
}
|
|
2552
|
+
/* istanbul ignore else */
|
|
2553
|
+
|
|
2492
2554
|
|
|
2493
2555
|
if (process.env.NODE_ENV !== 'production') {
|
|
2494
2556
|
init();
|
|
@@ -2535,7 +2597,8 @@ class ReactiveMembrane {
|
|
|
2535
2597
|
this.valueMutated = defaultValueMutated;
|
|
2536
2598
|
this.valueObserved = defaultValueObserved;
|
|
2537
2599
|
this.valueIsObservable = defaultValueIsObservable;
|
|
2538
|
-
this.
|
|
2600
|
+
this.readOnlyObjectGraph = new WeakMap();
|
|
2601
|
+
this.reactiveObjectGraph = new WeakMap();
|
|
2539
2602
|
|
|
2540
2603
|
if (!isUndefined(options)) {
|
|
2541
2604
|
const {
|
|
@@ -2558,10 +2621,13 @@ class ReactiveMembrane {
|
|
|
2558
2621
|
const distorted = this.valueDistortion(unwrappedValue);
|
|
2559
2622
|
|
|
2560
2623
|
if (this.valueIsObservable(distorted)) {
|
|
2561
|
-
|
|
2562
|
-
|
|
2624
|
+
if (this.readOnlyObjectGraph.get(distorted) === value) {
|
|
2625
|
+
// when trying to extract the writable version of a readonly
|
|
2626
|
+
// we return the readonly.
|
|
2627
|
+
return value;
|
|
2628
|
+
}
|
|
2563
2629
|
|
|
2564
|
-
return
|
|
2630
|
+
return this.getReactiveHandler(unwrappedValue, distorted);
|
|
2565
2631
|
}
|
|
2566
2632
|
|
|
2567
2633
|
return distorted;
|
|
@@ -2572,7 +2638,7 @@ class ReactiveMembrane {
|
|
|
2572
2638
|
const distorted = this.valueDistortion(value);
|
|
2573
2639
|
|
|
2574
2640
|
if (this.valueIsObservable(distorted)) {
|
|
2575
|
-
return this.
|
|
2641
|
+
return this.getReadOnlyHandler(value, distorted);
|
|
2576
2642
|
}
|
|
2577
2643
|
|
|
2578
2644
|
return distorted;
|
|
@@ -2582,47 +2648,36 @@ class ReactiveMembrane {
|
|
|
2582
2648
|
return unwrap$1(p);
|
|
2583
2649
|
}
|
|
2584
2650
|
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
objectGraph
|
|
2588
|
-
} = this;
|
|
2589
|
-
let reactiveState = objectGraph.get(distortedValue);
|
|
2651
|
+
getReactiveHandler(value, distortedValue) {
|
|
2652
|
+
let proxy = this.reactiveObjectGraph.get(distortedValue);
|
|
2590
2653
|
|
|
2591
|
-
if (
|
|
2592
|
-
|
|
2654
|
+
if (isUndefined(proxy)) {
|
|
2655
|
+
// caching the proxy after the first time it is accessed
|
|
2656
|
+
const handler = new ReactiveProxyHandler(this, distortedValue);
|
|
2657
|
+
proxy = new Proxy(createShadowTarget(distortedValue), handler);
|
|
2658
|
+
registerProxy(proxy, value);
|
|
2659
|
+
this.reactiveObjectGraph.set(distortedValue, proxy);
|
|
2593
2660
|
}
|
|
2594
2661
|
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
get reactive() {
|
|
2598
|
-
const reactiveHandler = new ReactiveProxyHandler(membrane, distortedValue); // caching the reactive proxy after the first time it is accessed
|
|
2599
|
-
|
|
2600
|
-
const proxy = new Proxy(createShadowTarget(distortedValue), reactiveHandler);
|
|
2601
|
-
registerProxy(proxy, value);
|
|
2602
|
-
ObjectDefineProperty(this, 'reactive', {
|
|
2603
|
-
value: proxy
|
|
2604
|
-
});
|
|
2605
|
-
return proxy;
|
|
2606
|
-
},
|
|
2662
|
+
return proxy;
|
|
2663
|
+
}
|
|
2607
2664
|
|
|
2608
|
-
|
|
2609
|
-
|
|
2665
|
+
getReadOnlyHandler(value, distortedValue) {
|
|
2666
|
+
let proxy = this.readOnlyObjectGraph.get(distortedValue);
|
|
2610
2667
|
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2668
|
+
if (isUndefined(proxy)) {
|
|
2669
|
+
// caching the proxy after the first time it is accessed
|
|
2670
|
+
const handler = new ReadOnlyHandler(this, distortedValue);
|
|
2671
|
+
proxy = new Proxy(createShadowTarget(distortedValue), handler);
|
|
2672
|
+
registerProxy(proxy, value);
|
|
2673
|
+
this.readOnlyObjectGraph.set(distortedValue, proxy);
|
|
2674
|
+
}
|
|
2618
2675
|
|
|
2619
|
-
|
|
2620
|
-
objectGraph.set(distortedValue, reactiveState);
|
|
2621
|
-
return reactiveState;
|
|
2676
|
+
return proxy;
|
|
2622
2677
|
}
|
|
2623
2678
|
|
|
2624
2679
|
}
|
|
2625
|
-
/** version: 1.
|
|
2680
|
+
/** version: 1.1.5 */
|
|
2626
2681
|
|
|
2627
2682
|
/*
|
|
2628
2683
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -3076,8 +3131,10 @@ for (const [elementProp, rendererMethod] of childGetters) {
|
|
|
3076
3131
|
}
|
|
3077
3132
|
|
|
3078
3133
|
return renderer[rendererMethod](elm);
|
|
3079
|
-
}
|
|
3134
|
+
},
|
|
3080
3135
|
|
|
3136
|
+
configurable: true,
|
|
3137
|
+
enumerable: true
|
|
3081
3138
|
};
|
|
3082
3139
|
}
|
|
3083
3140
|
|
|
@@ -3097,8 +3154,11 @@ for (const queryMethod of queryMethods) {
|
|
|
3097
3154
|
}
|
|
3098
3155
|
|
|
3099
3156
|
return renderer[queryMethod](elm, arg);
|
|
3100
|
-
}
|
|
3157
|
+
},
|
|
3101
3158
|
|
|
3159
|
+
configurable: true,
|
|
3160
|
+
enumerable: true,
|
|
3161
|
+
writable: true
|
|
3102
3162
|
};
|
|
3103
3163
|
}
|
|
3104
3164
|
|
|
@@ -4136,7 +4196,7 @@ function createComponentDef(Ctor) {
|
|
|
4136
4196
|
if (!isUndefined$1(ctorShadowSupportMode)) {
|
|
4137
4197
|
assert.invariant(ctorShadowSupportMode === "any"
|
|
4138
4198
|
/* Any */
|
|
4139
|
-
|| ctorShadowSupportMode === "
|
|
4199
|
+
|| ctorShadowSupportMode === "reset"
|
|
4140
4200
|
/* Default */
|
|
4141
4201
|
, `Invalid value for static property shadowSupportMode: '${ctorShadowSupportMode}'`);
|
|
4142
4202
|
}
|
|
@@ -4298,7 +4358,7 @@ const lightingElementDef = {
|
|
|
4298
4358
|
renderMode: 1
|
|
4299
4359
|
/* Shadow */
|
|
4300
4360
|
,
|
|
4301
|
-
shadowSupportMode: "
|
|
4361
|
+
shadowSupportMode: "reset"
|
|
4302
4362
|
/* Default */
|
|
4303
4363
|
,
|
|
4304
4364
|
wire: EmptyObject,
|
|
@@ -4447,6 +4507,17 @@ function createElmHook(vnode) {
|
|
|
4447
4507
|
modComputedStyle.create(vnode);
|
|
4448
4508
|
}
|
|
4449
4509
|
|
|
4510
|
+
function hydrateElmHook(vnode) {
|
|
4511
|
+
modEvents.create(vnode); // Attrs are already on the element.
|
|
4512
|
+
// modAttrs.create(vnode);
|
|
4513
|
+
|
|
4514
|
+
modProps.create(vnode); // Already set.
|
|
4515
|
+
// modStaticClassName.create(vnode);
|
|
4516
|
+
// modStaticStyle.create(vnode);
|
|
4517
|
+
// modComputedClassName.create(vnode);
|
|
4518
|
+
// modComputedStyle.create(vnode);
|
|
4519
|
+
}
|
|
4520
|
+
|
|
4450
4521
|
function fallbackElmHook(elm, vnode) {
|
|
4451
4522
|
const {
|
|
4452
4523
|
owner
|
|
@@ -4618,6 +4689,179 @@ function createChildrenHook(vnode) {
|
|
|
4618
4689
|
}
|
|
4619
4690
|
}
|
|
4620
4691
|
|
|
4692
|
+
function isElementNode(node) {
|
|
4693
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
4694
|
+
return node.nodeType === Node.ELEMENT_NODE;
|
|
4695
|
+
}
|
|
4696
|
+
|
|
4697
|
+
function vnodesAndElementHaveCompatibleAttrs(vnode, elm) {
|
|
4698
|
+
const {
|
|
4699
|
+
data: {
|
|
4700
|
+
attrs = {}
|
|
4701
|
+
},
|
|
4702
|
+
owner: {
|
|
4703
|
+
renderer
|
|
4704
|
+
}
|
|
4705
|
+
} = vnode;
|
|
4706
|
+
let nodesAreCompatible = true; // Validate attributes, though we could always recovery from those by running the update mods.
|
|
4707
|
+
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
4708
|
+
|
|
4709
|
+
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
4710
|
+
const elmAttrValue = renderer.getAttribute(elm, attrName);
|
|
4711
|
+
|
|
4712
|
+
if (String(attrValue) !== elmAttrValue) {
|
|
4713
|
+
logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
|
|
4714
|
+
nodesAreCompatible = false;
|
|
4715
|
+
}
|
|
4716
|
+
}
|
|
4717
|
+
|
|
4718
|
+
return nodesAreCompatible;
|
|
4719
|
+
}
|
|
4720
|
+
|
|
4721
|
+
function vnodesAndElementHaveCompatibleClass(vnode, elm) {
|
|
4722
|
+
const {
|
|
4723
|
+
data: {
|
|
4724
|
+
className,
|
|
4725
|
+
classMap
|
|
4726
|
+
},
|
|
4727
|
+
owner: {
|
|
4728
|
+
renderer
|
|
4729
|
+
}
|
|
4730
|
+
} = vnode;
|
|
4731
|
+
let nodesAreCompatible = true;
|
|
4732
|
+
let vnodeClassName;
|
|
4733
|
+
|
|
4734
|
+
if (!isUndefined$1(className) && String(className) !== elm.className) {
|
|
4735
|
+
// className is used when class is bound to an expr.
|
|
4736
|
+
nodesAreCompatible = false;
|
|
4737
|
+
vnodeClassName = className;
|
|
4738
|
+
} else if (!isUndefined$1(classMap)) {
|
|
4739
|
+
// classMap is used when class is set to static value.
|
|
4740
|
+
const classList = renderer.getClassList(elm);
|
|
4741
|
+
let computedClassName = ''; // all classes from the vnode should be in the element.classList
|
|
4742
|
+
|
|
4743
|
+
for (const name in classMap) {
|
|
4744
|
+
computedClassName += ' ' + name;
|
|
4745
|
+
|
|
4746
|
+
if (!classList.contains(name)) {
|
|
4747
|
+
nodesAreCompatible = false;
|
|
4748
|
+
}
|
|
4749
|
+
}
|
|
4750
|
+
|
|
4751
|
+
vnodeClassName = computedClassName.trim();
|
|
4752
|
+
|
|
4753
|
+
if (classList.length > keys(classMap).length) {
|
|
4754
|
+
nodesAreCompatible = false;
|
|
4755
|
+
}
|
|
4756
|
+
}
|
|
4757
|
+
|
|
4758
|
+
if (!nodesAreCompatible) {
|
|
4759
|
+
logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "class" has different values, expected "${vnodeClassName}" but found "${elm.className}"`, vnode.owner);
|
|
4760
|
+
}
|
|
4761
|
+
|
|
4762
|
+
return nodesAreCompatible;
|
|
4763
|
+
}
|
|
4764
|
+
|
|
4765
|
+
function vnodesAndElementHaveCompatibleStyle(vnode, elm) {
|
|
4766
|
+
const {
|
|
4767
|
+
data: {
|
|
4768
|
+
style,
|
|
4769
|
+
styleDecls
|
|
4770
|
+
},
|
|
4771
|
+
owner: {
|
|
4772
|
+
renderer
|
|
4773
|
+
}
|
|
4774
|
+
} = vnode;
|
|
4775
|
+
const elmStyle = renderer.getAttribute(elm, 'style') || '';
|
|
4776
|
+
let vnodeStyle;
|
|
4777
|
+
let nodesAreCompatible = true;
|
|
4778
|
+
|
|
4779
|
+
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
4780
|
+
nodesAreCompatible = false;
|
|
4781
|
+
vnodeStyle = style;
|
|
4782
|
+
} else if (!isUndefined$1(styleDecls)) {
|
|
4783
|
+
const parsedVnodeStyle = parseStyleText(elmStyle);
|
|
4784
|
+
const expectedStyle = []; // styleMap is used when style is set to static value.
|
|
4785
|
+
|
|
4786
|
+
for (let i = 0, n = styleDecls.length; i < n; i++) {
|
|
4787
|
+
const [prop, value, important] = styleDecls[i];
|
|
4788
|
+
expectedStyle.push(`${prop}: ${value + (important ? ' important!' : '')}`);
|
|
4789
|
+
const parsedPropValue = parsedVnodeStyle[prop];
|
|
4790
|
+
|
|
4791
|
+
if (isUndefined$1(parsedPropValue)) {
|
|
4792
|
+
nodesAreCompatible = false;
|
|
4793
|
+
} else if (!parsedPropValue.startsWith(value)) {
|
|
4794
|
+
nodesAreCompatible = false;
|
|
4795
|
+
} else if (important && !parsedPropValue.endsWith('!important')) {
|
|
4796
|
+
nodesAreCompatible = false;
|
|
4797
|
+
}
|
|
4798
|
+
}
|
|
4799
|
+
|
|
4800
|
+
if (keys(parsedVnodeStyle).length > styleDecls.length) {
|
|
4801
|
+
nodesAreCompatible = false;
|
|
4802
|
+
}
|
|
4803
|
+
|
|
4804
|
+
vnodeStyle = ArrayJoin.call(expectedStyle, ';');
|
|
4805
|
+
}
|
|
4806
|
+
|
|
4807
|
+
if (!nodesAreCompatible) {
|
|
4808
|
+
// style is used when class is bound to an expr.
|
|
4809
|
+
logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "style" has different values, expected "${vnodeStyle}" but found "${elmStyle}".`, vnode.owner);
|
|
4810
|
+
}
|
|
4811
|
+
|
|
4812
|
+
return nodesAreCompatible;
|
|
4813
|
+
}
|
|
4814
|
+
|
|
4815
|
+
function throwHydrationError() {
|
|
4816
|
+
assert.fail('Server rendered elements do not match client side generated elements');
|
|
4817
|
+
}
|
|
4818
|
+
|
|
4819
|
+
function hydrateChildrenHook(elmChildren, children, vm) {
|
|
4820
|
+
var _a, _b;
|
|
4821
|
+
|
|
4822
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4823
|
+
const filteredVNodes = ArrayFilter.call(children, vnode => !!vnode);
|
|
4824
|
+
|
|
4825
|
+
if (elmChildren.length !== filteredVNodes.length) {
|
|
4826
|
+
logError(`Hydration mismatch: incorrect number of rendered nodes, expected ${filteredVNodes.length} but found ${elmChildren.length}.`, vm);
|
|
4827
|
+
throwHydrationError();
|
|
4828
|
+
}
|
|
4829
|
+
}
|
|
4830
|
+
|
|
4831
|
+
let elmCurrentChildIdx = 0;
|
|
4832
|
+
|
|
4833
|
+
for (let j = 0, n = children.length; j < n; j++) {
|
|
4834
|
+
const ch = children[j];
|
|
4835
|
+
|
|
4836
|
+
if (ch != null) {
|
|
4837
|
+
const childNode = elmChildren[elmCurrentChildIdx];
|
|
4838
|
+
|
|
4839
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4840
|
+
// VComments and VTexts validation is handled in their hooks
|
|
4841
|
+
if (isElementNode(childNode)) {
|
|
4842
|
+
if (((_a = ch.sel) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== childNode.tagName.toLowerCase()) {
|
|
4843
|
+
logError(`Hydration mismatch: expecting element with tag "${(_b = ch.sel) === null || _b === void 0 ? void 0 : _b.toLowerCase()}" but found "${childNode.tagName.toLowerCase()}".`, vm);
|
|
4844
|
+
throwHydrationError();
|
|
4845
|
+
} // Note: props are not yet set
|
|
4846
|
+
|
|
4847
|
+
|
|
4848
|
+
const hasIncompatibleAttrs = vnodesAndElementHaveCompatibleAttrs(ch, childNode);
|
|
4849
|
+
const hasIncompatibleClass = vnodesAndElementHaveCompatibleClass(ch, childNode);
|
|
4850
|
+
const hasIncompatibleStyle = vnodesAndElementHaveCompatibleStyle(ch, childNode);
|
|
4851
|
+
const isVNodeAndElementCompatible = hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
4852
|
+
|
|
4853
|
+
if (!isVNodeAndElementCompatible) {
|
|
4854
|
+
throwHydrationError();
|
|
4855
|
+
}
|
|
4856
|
+
}
|
|
4857
|
+
}
|
|
4858
|
+
|
|
4859
|
+
ch.hook.hydrate(ch, childNode);
|
|
4860
|
+
elmCurrentChildIdx++;
|
|
4861
|
+
}
|
|
4862
|
+
}
|
|
4863
|
+
}
|
|
4864
|
+
|
|
4621
4865
|
function updateCustomElmHook(oldVnode, vnode) {
|
|
4622
4866
|
// Attrs need to be applied to element before props
|
|
4623
4867
|
// IE11 will wipe out value on radio inputs if value
|
|
@@ -4701,38 +4945,6 @@ function getUpgradableConstructor(tagName, renderer) {
|
|
|
4701
4945
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4702
4946
|
*/
|
|
4703
4947
|
|
|
4704
|
-
/**
|
|
4705
|
-
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
|
4706
|
-
* libraries to sanitize HTML content. This hook process the content passed via the template to
|
|
4707
|
-
* lwc:inner-html directive.
|
|
4708
|
-
* It is meant to be overridden with setSanitizeHtmlContentHook
|
|
4709
|
-
*/
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
let sanitizeHtmlContentHook = () => {
|
|
4713
|
-
// locker-service patches this function during runtime to sanitize HTML content.
|
|
4714
|
-
throw new Error('sanitizeHtmlContent hook must be implemented.');
|
|
4715
|
-
};
|
|
4716
|
-
/**
|
|
4717
|
-
* Sets the sanitizeHtmlContentHook.
|
|
4718
|
-
*
|
|
4719
|
-
* @param newHookImpl
|
|
4720
|
-
* @returns oldHookImplementation.
|
|
4721
|
-
*/
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
function setSanitizeHtmlContentHook(newHookImpl) {
|
|
4725
|
-
const currentHook = sanitizeHtmlContentHook;
|
|
4726
|
-
sanitizeHtmlContentHook = newHookImpl;
|
|
4727
|
-
return currentHook;
|
|
4728
|
-
}
|
|
4729
|
-
/*
|
|
4730
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
4731
|
-
* All rights reserved.
|
|
4732
|
-
* SPDX-License-Identifier: MIT
|
|
4733
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4734
|
-
*/
|
|
4735
|
-
|
|
4736
4948
|
|
|
4737
4949
|
const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
4738
4950
|
const SymbolIterator = Symbol.iterator;
|
|
@@ -4751,7 +4963,26 @@ const TextHook = {
|
|
|
4751
4963
|
update: updateNodeHook,
|
|
4752
4964
|
insert: insertNodeHook,
|
|
4753
4965
|
move: insertNodeHook,
|
|
4754
|
-
remove: removeNodeHook
|
|
4966
|
+
remove: removeNodeHook,
|
|
4967
|
+
hydrate: (vNode, node) => {
|
|
4968
|
+
var _a;
|
|
4969
|
+
|
|
4970
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4971
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
4972
|
+
if (node.nodeType !== Node.TEXT_NODE) {
|
|
4973
|
+
logError('Hydration mismatch: incorrect node type received', vNode.owner);
|
|
4974
|
+
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
4975
|
+
}
|
|
4976
|
+
|
|
4977
|
+
if (node.nodeValue !== vNode.text) {
|
|
4978
|
+
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vNode.owner);
|
|
4979
|
+
}
|
|
4980
|
+
} // always set the text value to the one from the vnode.
|
|
4981
|
+
|
|
4982
|
+
|
|
4983
|
+
node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
|
|
4984
|
+
vNode.elm = node;
|
|
4985
|
+
}
|
|
4755
4986
|
};
|
|
4756
4987
|
const CommentHook = {
|
|
4757
4988
|
create: vnode => {
|
|
@@ -4769,7 +5000,26 @@ const CommentHook = {
|
|
|
4769
5000
|
update: updateNodeHook,
|
|
4770
5001
|
insert: insertNodeHook,
|
|
4771
5002
|
move: insertNodeHook,
|
|
4772
|
-
remove: removeNodeHook
|
|
5003
|
+
remove: removeNodeHook,
|
|
5004
|
+
hydrate: (vNode, node) => {
|
|
5005
|
+
var _a;
|
|
5006
|
+
|
|
5007
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5008
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
5009
|
+
if (node.nodeType !== Node.COMMENT_NODE) {
|
|
5010
|
+
logError('Hydration mismatch: incorrect node type received', vNode.owner);
|
|
5011
|
+
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
5012
|
+
}
|
|
5013
|
+
|
|
5014
|
+
if (node.nodeValue !== vNode.text) {
|
|
5015
|
+
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vNode.owner);
|
|
5016
|
+
}
|
|
5017
|
+
} // always set the text value to the one from the vnode.
|
|
5018
|
+
|
|
5019
|
+
|
|
5020
|
+
node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
|
|
5021
|
+
vNode.elm = node;
|
|
5022
|
+
}
|
|
4773
5023
|
}; // insert is called after update, which is used somewhere else (via a module)
|
|
4774
5024
|
// to mark the vm as inserted, that means we cannot use update as the main channel
|
|
4775
5025
|
// to rehydrate when dirty, because sometimes the element is not inserted just yet,
|
|
@@ -4809,6 +5059,38 @@ const ElementHook = {
|
|
|
4809
5059
|
remove: (vnode, parentNode) => {
|
|
4810
5060
|
removeNodeHook(vnode, parentNode);
|
|
4811
5061
|
removeElmHook(vnode);
|
|
5062
|
+
},
|
|
5063
|
+
hydrate: (vnode, node) => {
|
|
5064
|
+
const elm = node;
|
|
5065
|
+
vnode.elm = elm;
|
|
5066
|
+
const {
|
|
5067
|
+
context
|
|
5068
|
+
} = vnode.data;
|
|
5069
|
+
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
|
|
5070
|
+
/* manual */
|
|
5071
|
+
);
|
|
5072
|
+
|
|
5073
|
+
if (isDomManual) {
|
|
5074
|
+
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
5075
|
+
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
5076
|
+
const {
|
|
5077
|
+
props
|
|
5078
|
+
} = vnode.data;
|
|
5079
|
+
|
|
5080
|
+
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
5081
|
+
if (elm.innerHTML === props.innerHTML) {
|
|
5082
|
+
delete props.innerHTML;
|
|
5083
|
+
} else {
|
|
5084
|
+
logWarn(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
|
|
5085
|
+
}
|
|
5086
|
+
}
|
|
5087
|
+
}
|
|
5088
|
+
|
|
5089
|
+
hydrateElmHook(vnode);
|
|
5090
|
+
|
|
5091
|
+
if (!isDomManual) {
|
|
5092
|
+
hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vnode.owner);
|
|
5093
|
+
}
|
|
4812
5094
|
}
|
|
4813
5095
|
};
|
|
4814
5096
|
const CustomElementHook = {
|
|
@@ -4900,6 +5182,44 @@ const CustomElementHook = {
|
|
|
4900
5182
|
// will take care of disconnecting any child VM attached to its shadow as well.
|
|
4901
5183
|
removeVM(vm);
|
|
4902
5184
|
}
|
|
5185
|
+
},
|
|
5186
|
+
hydrate: (vnode, elm) => {
|
|
5187
|
+
// the element is created, but the vm is not
|
|
5188
|
+
const {
|
|
5189
|
+
sel,
|
|
5190
|
+
mode,
|
|
5191
|
+
ctor,
|
|
5192
|
+
owner
|
|
5193
|
+
} = vnode;
|
|
5194
|
+
const def = getComponentInternalDef(ctor);
|
|
5195
|
+
createVM(elm, def, {
|
|
5196
|
+
mode,
|
|
5197
|
+
owner,
|
|
5198
|
+
tagName: sel,
|
|
5199
|
+
renderer: owner.renderer
|
|
5200
|
+
});
|
|
5201
|
+
vnode.elm = elm;
|
|
5202
|
+
const vm = getAssociatedVM(elm);
|
|
5203
|
+
allocateChildrenHook(vnode, vm);
|
|
5204
|
+
hydrateElmHook(vnode); // Insert hook section:
|
|
5205
|
+
|
|
5206
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5207
|
+
assert.isTrue(vm.state === 0
|
|
5208
|
+
/* created */
|
|
5209
|
+
, `${vm} cannot be recycled.`);
|
|
5210
|
+
}
|
|
5211
|
+
|
|
5212
|
+
runConnectedCallback(vm);
|
|
5213
|
+
|
|
5214
|
+
if (vm.renderMode !== 0
|
|
5215
|
+
/* Light */
|
|
5216
|
+
) {
|
|
5217
|
+
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
5218
|
+
// Note: for Light DOM, this is handled while hydrating the VM
|
|
5219
|
+
hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vm);
|
|
5220
|
+
}
|
|
5221
|
+
|
|
5222
|
+
hydrateVM(vm);
|
|
4903
5223
|
}
|
|
4904
5224
|
};
|
|
4905
5225
|
|
|
@@ -5212,7 +5532,7 @@ function co(text) {
|
|
|
5212
5532
|
|
|
5213
5533
|
|
|
5214
5534
|
function d(value) {
|
|
5215
|
-
return value == null ? '' : value;
|
|
5535
|
+
return value == null ? '' : String(value);
|
|
5216
5536
|
} // [b]ind function
|
|
5217
5537
|
|
|
5218
5538
|
|
|
@@ -5374,6 +5694,26 @@ function sc(vnodes) {
|
|
|
5374
5694
|
|
|
5375
5695
|
markAsDynamicChildren(vnodes);
|
|
5376
5696
|
return vnodes;
|
|
5697
|
+
}
|
|
5698
|
+
/**
|
|
5699
|
+
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
|
5700
|
+
* libraries to sanitize HTML content. This hook process the content passed via the template to
|
|
5701
|
+
* lwc:inner-html directive.
|
|
5702
|
+
* It is meant to be overridden with setSanitizeHtmlContentHook, it throws an error by default.
|
|
5703
|
+
*/
|
|
5704
|
+
|
|
5705
|
+
|
|
5706
|
+
let sanitizeHtmlContentHook = () => {
|
|
5707
|
+
// locker-service patches this function during runtime to sanitize HTML content.
|
|
5708
|
+
throw new Error('sanitizeHtmlContent hook must be implemented.');
|
|
5709
|
+
};
|
|
5710
|
+
/**
|
|
5711
|
+
* Sets the sanitizeHtmlContentHook.
|
|
5712
|
+
*/
|
|
5713
|
+
|
|
5714
|
+
|
|
5715
|
+
function setSanitizeHtmlContentHook(newHookImpl) {
|
|
5716
|
+
sanitizeHtmlContentHook = newHookImpl;
|
|
5377
5717
|
} // [s]anitize [h]tml [c]ontent
|
|
5378
5718
|
|
|
5379
5719
|
|
|
@@ -5568,7 +5908,10 @@ function createStylesheet(vm, stylesheets) {
|
|
|
5568
5908
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
5569
5909
|
renderer.insertGlobalStylesheet(stylesheets[i]);
|
|
5570
5910
|
}
|
|
5571
|
-
} else if (renderer.ssr) {
|
|
5911
|
+
} else if (renderer.ssr || renderer.isHydrating()) {
|
|
5912
|
+
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
5913
|
+
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
5914
|
+
// the first time the VM renders.
|
|
5572
5915
|
// native shadow or light DOM, SSR
|
|
5573
5916
|
const combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
|
|
5574
5917
|
return createInlineStyleVNode(combinedStylesheetContent);
|
|
@@ -6148,6 +6491,10 @@ function disconnectRootElement(elm) {
|
|
|
6148
6491
|
|
|
6149
6492
|
function appendVM(vm) {
|
|
6150
6493
|
rehydrate(vm);
|
|
6494
|
+
}
|
|
6495
|
+
|
|
6496
|
+
function hydrateVM(vm) {
|
|
6497
|
+
hydrate(vm);
|
|
6151
6498
|
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
6152
6499
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
6153
6500
|
|
|
@@ -6381,6 +6728,22 @@ function rehydrate(vm) {
|
|
|
6381
6728
|
}
|
|
6382
6729
|
}
|
|
6383
6730
|
|
|
6731
|
+
function hydrate(vm) {
|
|
6732
|
+
if (isTrue(vm.isDirty)) {
|
|
6733
|
+
// manually diffing/patching here.
|
|
6734
|
+
// This routine is:
|
|
6735
|
+
// patchShadowRoot(vm, children);
|
|
6736
|
+
// -> addVnodes.
|
|
6737
|
+
const children = renderComponent$1(vm);
|
|
6738
|
+
vm.children = children;
|
|
6739
|
+
const vmChildren = vm.renderMode === 0
|
|
6740
|
+
/* Light */
|
|
6741
|
+
? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;
|
|
6742
|
+
hydrateChildrenHook(vmChildren, children, vm);
|
|
6743
|
+
runRenderedCallback(vm);
|
|
6744
|
+
}
|
|
6745
|
+
}
|
|
6746
|
+
|
|
6384
6747
|
function patchShadowRoot(vm, newCh) {
|
|
6385
6748
|
const {
|
|
6386
6749
|
children: oldCh
|
|
@@ -7189,28 +7552,12 @@ function readonly(obj) {
|
|
|
7189
7552
|
|
|
7190
7553
|
let hooksAreSet = false;
|
|
7191
7554
|
|
|
7192
|
-
function overrideHooks(hooks) {
|
|
7193
|
-
const oldHooks = {};
|
|
7194
|
-
|
|
7195
|
-
if (!isUndefined$1(hooks.sanitizeHtmlContent)) {
|
|
7196
|
-
oldHooks.sanitizeHtmlContent = setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
7197
|
-
}
|
|
7198
|
-
|
|
7199
|
-
return oldHooks;
|
|
7200
|
-
}
|
|
7201
|
-
|
|
7202
7555
|
function setHooks(hooks) {
|
|
7203
7556
|
assert.isFalse(hooksAreSet, 'Hooks are already overridden, only one definition is allowed.');
|
|
7204
|
-
overrideHooks(hooks);
|
|
7205
7557
|
hooksAreSet = true;
|
|
7558
|
+
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
7206
7559
|
}
|
|
7207
|
-
|
|
7208
|
-
function setHooksForTest(hooks) {
|
|
7209
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
7210
|
-
return overrideHooks(hooks);
|
|
7211
|
-
}
|
|
7212
|
-
}
|
|
7213
|
-
/* version: 2.5.6 */
|
|
7560
|
+
/* version: 2.5.10 */
|
|
7214
7561
|
|
|
7215
7562
|
/*
|
|
7216
7563
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -7240,7 +7587,7 @@ var HostNodeType;
|
|
|
7240
7587
|
const CLASSNAMES_SEPARATOR = /\s+/g;
|
|
7241
7588
|
|
|
7242
7589
|
function classNameToTokenList(value) {
|
|
7243
|
-
return new Set(value.
|
|
7590
|
+
return new Set(value.split(CLASSNAMES_SEPARATOR).filter(str => str.length));
|
|
7244
7591
|
}
|
|
7245
7592
|
|
|
7246
7593
|
function tokenListToClassName(values) {
|
|
@@ -7302,6 +7649,11 @@ class HTMLElement$1 {
|
|
|
7302
7649
|
|
|
7303
7650
|
const renderer = {
|
|
7304
7651
|
ssr: true,
|
|
7652
|
+
|
|
7653
|
+
isHydrating() {
|
|
7654
|
+
return false;
|
|
7655
|
+
},
|
|
7656
|
+
|
|
7305
7657
|
isNativeShadowDefined: false,
|
|
7306
7658
|
isSyntheticShadowDefined: false,
|
|
7307
7659
|
|
|
@@ -7509,18 +7861,18 @@ const renderer = {
|
|
|
7509
7861
|
},
|
|
7510
7862
|
|
|
7511
7863
|
setCSSStyleProperty(element, name, value, important) {
|
|
7512
|
-
|
|
7864
|
+
const styleAttribute = element.attributes.find(attr => attr.name === 'style' && isNull(attr.namespace));
|
|
7865
|
+
const serializedProperty = `${name}: ${value}${important ? ' !important' : ''}`;
|
|
7513
7866
|
|
|
7514
7867
|
if (isUndefined$1(styleAttribute)) {
|
|
7515
|
-
|
|
7868
|
+
element.attributes.push({
|
|
7516
7869
|
name: 'style',
|
|
7517
7870
|
namespace: null,
|
|
7518
|
-
value:
|
|
7519
|
-
};
|
|
7520
|
-
|
|
7871
|
+
value: serializedProperty
|
|
7872
|
+
});
|
|
7873
|
+
} else {
|
|
7874
|
+
styleAttribute.value += `; ${serializedProperty}`;
|
|
7521
7875
|
}
|
|
7522
|
-
|
|
7523
|
-
styleAttribute.value = `${styleAttribute.value}; ${name}: ${value}${important ? ' !important' : ''}`;
|
|
7524
7876
|
},
|
|
7525
7877
|
|
|
7526
7878
|
isConnected(node) {
|
|
@@ -7701,7 +8053,7 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
7701
8053
|
|
|
7702
8054
|
freeze(LightningElement);
|
|
7703
8055
|
seal(LightningElement.prototype);
|
|
7704
|
-
/* version: 2.5.
|
|
8056
|
+
/* version: 2.5.10 */
|
|
7705
8057
|
|
|
7706
8058
|
exports.LightningElement = LightningElement;
|
|
7707
8059
|
exports.api = api$1;
|
|
@@ -7718,7 +8070,6 @@ exports.sanitizeAttribute = sanitizeAttribute;
|
|
|
7718
8070
|
exports.setFeatureFlag = setFeatureFlag;
|
|
7719
8071
|
exports.setFeatureFlagForTest = setFeatureFlagForTest;
|
|
7720
8072
|
exports.setHooks = setHooks;
|
|
7721
|
-
exports.setHooksForTest = setHooksForTest;
|
|
7722
8073
|
exports.track = track;
|
|
7723
8074
|
exports.unwrap = unwrap;
|
|
7724
8075
|
exports.wire = wire;
|