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
|
@@ -69,7 +69,7 @@ const {
|
|
|
69
69
|
find: ArrayFind,
|
|
70
70
|
indexOf: ArrayIndexOf,
|
|
71
71
|
join: ArrayJoin,
|
|
72
|
-
map: ArrayMap
|
|
72
|
+
map: ArrayMap,
|
|
73
73
|
push: ArrayPush$1,
|
|
74
74
|
reduce: ArrayReduce,
|
|
75
75
|
reverse: ArrayReverse,
|
|
@@ -136,7 +136,7 @@ function toString$1(obj) {
|
|
|
136
136
|
// Array.prototype.toString directly will cause an error Iterate through
|
|
137
137
|
// all the items and handle individually.
|
|
138
138
|
if (isArray$1(obj)) {
|
|
139
|
-
return ArrayJoin.call(ArrayMap
|
|
139
|
+
return ArrayJoin.call(ArrayMap.call(obj, toString$1), ',');
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
return obj.toString();
|
|
@@ -335,7 +335,7 @@ function htmlPropertyToAttribute(propName) {
|
|
|
335
335
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
336
336
|
return attributeName;
|
|
337
337
|
}
|
|
338
|
-
/** version: 2.5.
|
|
338
|
+
/** version: 2.5.10 */
|
|
339
339
|
|
|
340
340
|
/*
|
|
341
341
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -456,7 +456,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
456
456
|
setFeatureFlag(name, value);
|
|
457
457
|
}
|
|
458
458
|
}
|
|
459
|
-
/** version: 2.5.
|
|
459
|
+
/** version: 2.5.10 */
|
|
460
460
|
|
|
461
461
|
/* proxy-compat-disable */
|
|
462
462
|
|
|
@@ -508,6 +508,28 @@ function guid() {
|
|
|
508
508
|
}
|
|
509
509
|
|
|
510
510
|
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
511
|
+
} // Borrowed from Vue template compiler.
|
|
512
|
+
// https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
const DECLARATION_DELIMITER = /;(?![^(]*\))/g;
|
|
516
|
+
const PROPERTY_DELIMITER = /:(.+)/;
|
|
517
|
+
|
|
518
|
+
function parseStyleText(cssText) {
|
|
519
|
+
const styleMap = {};
|
|
520
|
+
const declarations = cssText.split(DECLARATION_DELIMITER);
|
|
521
|
+
|
|
522
|
+
for (const declaration of declarations) {
|
|
523
|
+
if (declaration) {
|
|
524
|
+
const [prop, value] = declaration.split(PROPERTY_DELIMITER);
|
|
525
|
+
|
|
526
|
+
if (prop !== undefined && value !== undefined) {
|
|
527
|
+
styleMap[prop.trim()] = value.trim();
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
return styleMap;
|
|
511
533
|
}
|
|
512
534
|
/*
|
|
513
535
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
@@ -689,8 +711,8 @@ function getErrorComponentStack(vm) {
|
|
|
689
711
|
*/
|
|
690
712
|
|
|
691
713
|
|
|
692
|
-
function
|
|
693
|
-
let msg = `[LWC
|
|
714
|
+
function log(method, message, vm) {
|
|
715
|
+
let msg = `[LWC ${method}]: ${message}`;
|
|
694
716
|
|
|
695
717
|
if (!isUndefined$1(vm)) {
|
|
696
718
|
msg = `${msg}\n${getComponentStack(vm)}`;
|
|
@@ -698,7 +720,7 @@ function logError(message, vm) {
|
|
|
698
720
|
|
|
699
721
|
if (process.env.NODE_ENV === 'test') {
|
|
700
722
|
/* eslint-disable-next-line no-console */
|
|
701
|
-
console
|
|
723
|
+
console[method](msg);
|
|
702
724
|
return;
|
|
703
725
|
}
|
|
704
726
|
|
|
@@ -706,9 +728,17 @@ function logError(message, vm) {
|
|
|
706
728
|
throw new Error(msg);
|
|
707
729
|
} catch (e) {
|
|
708
730
|
/* eslint-disable-next-line no-console */
|
|
709
|
-
console
|
|
731
|
+
console[method](e);
|
|
710
732
|
}
|
|
711
733
|
}
|
|
734
|
+
|
|
735
|
+
function logError(message, vm) {
|
|
736
|
+
log('error', message, vm);
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
function logWarn(message, vm) {
|
|
740
|
+
log('warn', message, vm);
|
|
741
|
+
}
|
|
712
742
|
/*
|
|
713
743
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
714
744
|
* All rights reserved.
|
|
@@ -1876,7 +1906,6 @@ const {
|
|
|
1876
1906
|
getPrototypeOf,
|
|
1877
1907
|
create: ObjectCreate,
|
|
1878
1908
|
defineProperty: ObjectDefineProperty,
|
|
1879
|
-
defineProperties: ObjectDefineProperties,
|
|
1880
1909
|
isExtensible,
|
|
1881
1910
|
getOwnPropertyDescriptor,
|
|
1882
1911
|
getOwnPropertyNames,
|
|
@@ -1886,8 +1915,7 @@ const {
|
|
|
1886
1915
|
} = Object;
|
|
1887
1916
|
const {
|
|
1888
1917
|
push: ArrayPush,
|
|
1889
|
-
concat: ArrayConcat
|
|
1890
|
-
map: ArrayMap
|
|
1918
|
+
concat: ArrayConcat
|
|
1891
1919
|
} = Array.prototype;
|
|
1892
1920
|
const OtS = {}.toString;
|
|
1893
1921
|
|
|
@@ -1952,7 +1980,9 @@ class BaseProxyHandler {
|
|
|
1952
1980
|
// but it will always be compatible with the previous descriptor
|
|
1953
1981
|
// to preserve the object invariants, which makes these lines safe.
|
|
1954
1982
|
|
|
1955
|
-
const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key);
|
|
1983
|
+
const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key); // TODO: it should be impossible for the originalDescriptor to ever be undefined, this `if` can be removed
|
|
1984
|
+
|
|
1985
|
+
/* istanbul ignore else */
|
|
1956
1986
|
|
|
1957
1987
|
if (!isUndefined(originalDescriptor)) {
|
|
1958
1988
|
const wrappedDesc = this.wrapDescriptor(originalDescriptor);
|
|
@@ -1980,11 +2010,17 @@ class BaseProxyHandler {
|
|
|
1980
2010
|
|
|
1981
2011
|
preventExtensions(shadowTarget);
|
|
1982
2012
|
} // Shared Traps
|
|
2013
|
+
// TODO: apply() is never called
|
|
2014
|
+
|
|
2015
|
+
/* istanbul ignore next */
|
|
1983
2016
|
|
|
1984
2017
|
|
|
1985
2018
|
apply(shadowTarget, thisArg, argArray) {
|
|
1986
2019
|
/* No op */
|
|
1987
|
-
}
|
|
2020
|
+
} // TODO: construct() is never called
|
|
2021
|
+
|
|
2022
|
+
/* istanbul ignore next */
|
|
2023
|
+
|
|
1988
2024
|
|
|
1989
2025
|
construct(shadowTarget, argArray, newTarget) {
|
|
1990
2026
|
/* No op */
|
|
@@ -2097,8 +2133,8 @@ class BaseProxyHandler {
|
|
|
2097
2133
|
|
|
2098
2134
|
}
|
|
2099
2135
|
|
|
2100
|
-
const getterMap = new WeakMap();
|
|
2101
|
-
const setterMap = new WeakMap();
|
|
2136
|
+
const getterMap$1 = new WeakMap();
|
|
2137
|
+
const setterMap$1 = new WeakMap();
|
|
2102
2138
|
const reverseGetterMap = new WeakMap();
|
|
2103
2139
|
const reverseSetterMap = new WeakMap();
|
|
2104
2140
|
|
|
@@ -2108,7 +2144,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
|
|
|
2108
2144
|
}
|
|
2109
2145
|
|
|
2110
2146
|
wrapGetter(originalGet) {
|
|
2111
|
-
const wrappedGetter = getterMap.get(originalGet);
|
|
2147
|
+
const wrappedGetter = getterMap$1.get(originalGet);
|
|
2112
2148
|
|
|
2113
2149
|
if (!isUndefined(wrappedGetter)) {
|
|
2114
2150
|
return wrappedGetter;
|
|
@@ -2121,13 +2157,13 @@ class ReactiveProxyHandler extends BaseProxyHandler {
|
|
|
2121
2157
|
return handler.wrapValue(originalGet.call(unwrap$1(this)));
|
|
2122
2158
|
};
|
|
2123
2159
|
|
|
2124
|
-
getterMap.set(originalGet, get);
|
|
2160
|
+
getterMap$1.set(originalGet, get);
|
|
2125
2161
|
reverseGetterMap.set(get, originalGet);
|
|
2126
2162
|
return get;
|
|
2127
2163
|
}
|
|
2128
2164
|
|
|
2129
2165
|
wrapSetter(originalSet) {
|
|
2130
|
-
const wrappedSetter = setterMap.get(originalSet);
|
|
2166
|
+
const wrappedSetter = setterMap$1.get(originalSet);
|
|
2131
2167
|
|
|
2132
2168
|
if (!isUndefined(wrappedSetter)) {
|
|
2133
2169
|
return wrappedSetter;
|
|
@@ -2138,7 +2174,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
|
|
|
2138
2174
|
originalSet.call(unwrap$1(this), unwrap$1(v));
|
|
2139
2175
|
};
|
|
2140
2176
|
|
|
2141
|
-
setterMap.set(originalSet, set);
|
|
2177
|
+
setterMap$1.set(originalSet, set);
|
|
2142
2178
|
reverseSetterMap.set(set, originalSet);
|
|
2143
2179
|
return set;
|
|
2144
2180
|
}
|
|
@@ -2179,7 +2215,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
|
|
|
2179
2215
|
return unwrap$1(redGet.call(handler.wrapValue(this)));
|
|
2180
2216
|
};
|
|
2181
2217
|
|
|
2182
|
-
getterMap.set(get, redGet);
|
|
2218
|
+
getterMap$1.set(get, redGet);
|
|
2183
2219
|
reverseGetterMap.set(redGet, get);
|
|
2184
2220
|
return get;
|
|
2185
2221
|
}
|
|
@@ -2198,7 +2234,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
|
|
|
2198
2234
|
redSet.call(handler.wrapValue(this), handler.wrapValue(v));
|
|
2199
2235
|
};
|
|
2200
2236
|
|
|
2201
|
-
setterMap.set(set, redSet);
|
|
2237
|
+
setterMap$1.set(set, redSet);
|
|
2202
2238
|
reverseSetterMap.set(redSet, set);
|
|
2203
2239
|
return set;
|
|
2204
2240
|
}
|
|
@@ -2239,6 +2275,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
|
|
|
2239
2275
|
}
|
|
2240
2276
|
|
|
2241
2277
|
setPrototypeOf(shadowTarget, prototype) {
|
|
2278
|
+
/* istanbul ignore else */
|
|
2242
2279
|
if (process.env.NODE_ENV !== 'production') {
|
|
2243
2280
|
throw new Error(`Invalid setPrototypeOf invocation for reactive proxy ${toString(this.originalTarget)}. Prototype of reactive objects cannot be changed.`);
|
|
2244
2281
|
}
|
|
@@ -2252,6 +2289,11 @@ class ReactiveProxyHandler extends BaseProxyHandler {
|
|
|
2252
2289
|
preventExtensions(originalTarget); // if the originalTarget is a proxy itself, it might reject
|
|
2253
2290
|
// the preventExtension call, in which case we should not attempt to lock down
|
|
2254
2291
|
// the shadow target.
|
|
2292
|
+
// TODO: It should not actually be possible to reach this `if` statement.
|
|
2293
|
+
// If a proxy rejects extensions, then calling preventExtensions will throw an error:
|
|
2294
|
+
// https://codepen.io/nolanlawson-the-selector/pen/QWMOjbY
|
|
2295
|
+
|
|
2296
|
+
/* istanbul ignore if */
|
|
2255
2297
|
|
|
2256
2298
|
if (isExtensible(originalTarget)) {
|
|
2257
2299
|
return false;
|
|
@@ -2293,8 +2335,8 @@ class ReactiveProxyHandler extends BaseProxyHandler {
|
|
|
2293
2335
|
|
|
2294
2336
|
}
|
|
2295
2337
|
|
|
2296
|
-
const getterMap
|
|
2297
|
-
const setterMap
|
|
2338
|
+
const getterMap = new WeakMap();
|
|
2339
|
+
const setterMap = new WeakMap();
|
|
2298
2340
|
|
|
2299
2341
|
class ReadOnlyHandler extends BaseProxyHandler {
|
|
2300
2342
|
wrapValue(value) {
|
|
@@ -2302,7 +2344,7 @@ class ReadOnlyHandler extends BaseProxyHandler {
|
|
|
2302
2344
|
}
|
|
2303
2345
|
|
|
2304
2346
|
wrapGetter(originalGet) {
|
|
2305
|
-
const wrappedGetter = getterMap
|
|
2347
|
+
const wrappedGetter = getterMap.get(originalGet);
|
|
2306
2348
|
|
|
2307
2349
|
if (!isUndefined(wrappedGetter)) {
|
|
2308
2350
|
return wrappedGetter;
|
|
@@ -2315,12 +2357,12 @@ class ReadOnlyHandler extends BaseProxyHandler {
|
|
|
2315
2357
|
return handler.wrapValue(originalGet.call(unwrap$1(this)));
|
|
2316
2358
|
};
|
|
2317
2359
|
|
|
2318
|
-
getterMap
|
|
2360
|
+
getterMap.set(originalGet, get);
|
|
2319
2361
|
return get;
|
|
2320
2362
|
}
|
|
2321
2363
|
|
|
2322
2364
|
wrapSetter(originalSet) {
|
|
2323
|
-
const wrappedSetter = setterMap
|
|
2365
|
+
const wrappedSetter = setterMap.get(originalSet);
|
|
2324
2366
|
|
|
2325
2367
|
if (!isUndefined(wrappedSetter)) {
|
|
2326
2368
|
return wrappedSetter;
|
|
@@ -2329,6 +2371,7 @@ class ReadOnlyHandler extends BaseProxyHandler {
|
|
|
2329
2371
|
const handler = this;
|
|
2330
2372
|
|
|
2331
2373
|
const set = function (v) {
|
|
2374
|
+
/* istanbul ignore else */
|
|
2332
2375
|
if (process.env.NODE_ENV !== 'production') {
|
|
2333
2376
|
const {
|
|
2334
2377
|
originalTarget
|
|
@@ -2337,33 +2380,41 @@ class ReadOnlyHandler extends BaseProxyHandler {
|
|
|
2337
2380
|
}
|
|
2338
2381
|
};
|
|
2339
2382
|
|
|
2340
|
-
setterMap
|
|
2383
|
+
setterMap.set(originalSet, set);
|
|
2341
2384
|
return set;
|
|
2342
2385
|
}
|
|
2343
2386
|
|
|
2344
2387
|
set(shadowTarget, key, value) {
|
|
2388
|
+
/* istanbul ignore else */
|
|
2345
2389
|
if (process.env.NODE_ENV !== 'production') {
|
|
2346
2390
|
const {
|
|
2347
2391
|
originalTarget
|
|
2348
2392
|
} = this;
|
|
2349
|
-
|
|
2393
|
+
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.`;
|
|
2394
|
+
throw new Error(msg);
|
|
2350
2395
|
}
|
|
2396
|
+
/* istanbul ignore next */
|
|
2397
|
+
|
|
2351
2398
|
|
|
2352
2399
|
return false;
|
|
2353
2400
|
}
|
|
2354
2401
|
|
|
2355
2402
|
deleteProperty(shadowTarget, key) {
|
|
2403
|
+
/* istanbul ignore else */
|
|
2356
2404
|
if (process.env.NODE_ENV !== 'production') {
|
|
2357
2405
|
const {
|
|
2358
2406
|
originalTarget
|
|
2359
2407
|
} = this;
|
|
2360
2408
|
throw new Error(`Invalid mutation: Cannot delete "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`);
|
|
2361
2409
|
}
|
|
2410
|
+
/* istanbul ignore next */
|
|
2411
|
+
|
|
2362
2412
|
|
|
2363
2413
|
return false;
|
|
2364
2414
|
}
|
|
2365
2415
|
|
|
2366
2416
|
setPrototypeOf(shadowTarget, prototype) {
|
|
2417
|
+
/* istanbul ignore else */
|
|
2367
2418
|
if (process.env.NODE_ENV !== 'production') {
|
|
2368
2419
|
const {
|
|
2369
2420
|
originalTarget
|
|
@@ -2373,23 +2424,29 @@ class ReadOnlyHandler extends BaseProxyHandler {
|
|
|
2373
2424
|
}
|
|
2374
2425
|
|
|
2375
2426
|
preventExtensions(shadowTarget) {
|
|
2427
|
+
/* istanbul ignore else */
|
|
2376
2428
|
if (process.env.NODE_ENV !== 'production') {
|
|
2377
2429
|
const {
|
|
2378
2430
|
originalTarget
|
|
2379
2431
|
} = this;
|
|
2380
2432
|
throw new Error(`Invalid mutation: Cannot preventExtensions on ${originalTarget}". "${originalTarget} is read-only.`);
|
|
2381
2433
|
}
|
|
2434
|
+
/* istanbul ignore next */
|
|
2435
|
+
|
|
2382
2436
|
|
|
2383
2437
|
return false;
|
|
2384
2438
|
}
|
|
2385
2439
|
|
|
2386
2440
|
defineProperty(shadowTarget, key, descriptor) {
|
|
2441
|
+
/* istanbul ignore else */
|
|
2387
2442
|
if (process.env.NODE_ENV !== 'production') {
|
|
2388
2443
|
const {
|
|
2389
2444
|
originalTarget
|
|
2390
2445
|
} = this;
|
|
2391
2446
|
throw new Error(`Invalid mutation: Cannot defineProperty "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`);
|
|
2392
2447
|
}
|
|
2448
|
+
/* istanbul ignore next */
|
|
2449
|
+
|
|
2393
2450
|
|
|
2394
2451
|
return false;
|
|
2395
2452
|
}
|
|
@@ -2447,6 +2504,8 @@ const formatter = {
|
|
|
2447
2504
|
}; // Inspired from paulmillr/es6-shim
|
|
2448
2505
|
// https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js#L176-L185
|
|
2449
2506
|
|
|
2507
|
+
/* istanbul ignore next */
|
|
2508
|
+
|
|
2450
2509
|
function getGlobal() {
|
|
2451
2510
|
// the only reliable means to get the global object is `Function('return this')()`
|
|
2452
2511
|
// However, this causes CSP violations in Chrome apps.
|
|
@@ -2471,6 +2530,7 @@ function getGlobal() {
|
|
|
2471
2530
|
}
|
|
2472
2531
|
|
|
2473
2532
|
function init() {
|
|
2533
|
+
/* istanbul ignore if */
|
|
2474
2534
|
if (process.env.NODE_ENV === 'production') {
|
|
2475
2535
|
// this method should never leak to prod
|
|
2476
2536
|
throw new ReferenceError();
|
|
@@ -2485,6 +2545,8 @@ function init() {
|
|
|
2485
2545
|
ArrayPush.call(devtoolsFormatters, formatter);
|
|
2486
2546
|
global.devtoolsFormatters = devtoolsFormatters;
|
|
2487
2547
|
}
|
|
2548
|
+
/* istanbul ignore else */
|
|
2549
|
+
|
|
2488
2550
|
|
|
2489
2551
|
if (process.env.NODE_ENV !== 'production') {
|
|
2490
2552
|
init();
|
|
@@ -2531,7 +2593,8 @@ class ReactiveMembrane {
|
|
|
2531
2593
|
this.valueMutated = defaultValueMutated;
|
|
2532
2594
|
this.valueObserved = defaultValueObserved;
|
|
2533
2595
|
this.valueIsObservable = defaultValueIsObservable;
|
|
2534
|
-
this.
|
|
2596
|
+
this.readOnlyObjectGraph = new WeakMap();
|
|
2597
|
+
this.reactiveObjectGraph = new WeakMap();
|
|
2535
2598
|
|
|
2536
2599
|
if (!isUndefined(options)) {
|
|
2537
2600
|
const {
|
|
@@ -2554,10 +2617,13 @@ class ReactiveMembrane {
|
|
|
2554
2617
|
const distorted = this.valueDistortion(unwrappedValue);
|
|
2555
2618
|
|
|
2556
2619
|
if (this.valueIsObservable(distorted)) {
|
|
2557
|
-
|
|
2558
|
-
|
|
2620
|
+
if (this.readOnlyObjectGraph.get(distorted) === value) {
|
|
2621
|
+
// when trying to extract the writable version of a readonly
|
|
2622
|
+
// we return the readonly.
|
|
2623
|
+
return value;
|
|
2624
|
+
}
|
|
2559
2625
|
|
|
2560
|
-
return
|
|
2626
|
+
return this.getReactiveHandler(unwrappedValue, distorted);
|
|
2561
2627
|
}
|
|
2562
2628
|
|
|
2563
2629
|
return distorted;
|
|
@@ -2568,7 +2634,7 @@ class ReactiveMembrane {
|
|
|
2568
2634
|
const distorted = this.valueDistortion(value);
|
|
2569
2635
|
|
|
2570
2636
|
if (this.valueIsObservable(distorted)) {
|
|
2571
|
-
return this.
|
|
2637
|
+
return this.getReadOnlyHandler(value, distorted);
|
|
2572
2638
|
}
|
|
2573
2639
|
|
|
2574
2640
|
return distorted;
|
|
@@ -2578,47 +2644,36 @@ class ReactiveMembrane {
|
|
|
2578
2644
|
return unwrap$1(p);
|
|
2579
2645
|
}
|
|
2580
2646
|
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
objectGraph
|
|
2584
|
-
} = this;
|
|
2585
|
-
let reactiveState = objectGraph.get(distortedValue);
|
|
2647
|
+
getReactiveHandler(value, distortedValue) {
|
|
2648
|
+
let proxy = this.reactiveObjectGraph.get(distortedValue);
|
|
2586
2649
|
|
|
2587
|
-
if (
|
|
2588
|
-
|
|
2650
|
+
if (isUndefined(proxy)) {
|
|
2651
|
+
// caching the proxy after the first time it is accessed
|
|
2652
|
+
const handler = new ReactiveProxyHandler(this, distortedValue);
|
|
2653
|
+
proxy = new Proxy(createShadowTarget(distortedValue), handler);
|
|
2654
|
+
registerProxy(proxy, value);
|
|
2655
|
+
this.reactiveObjectGraph.set(distortedValue, proxy);
|
|
2589
2656
|
}
|
|
2590
2657
|
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
get reactive() {
|
|
2594
|
-
const reactiveHandler = new ReactiveProxyHandler(membrane, distortedValue); // caching the reactive proxy after the first time it is accessed
|
|
2595
|
-
|
|
2596
|
-
const proxy = new Proxy(createShadowTarget(distortedValue), reactiveHandler);
|
|
2597
|
-
registerProxy(proxy, value);
|
|
2598
|
-
ObjectDefineProperty(this, 'reactive', {
|
|
2599
|
-
value: proxy
|
|
2600
|
-
});
|
|
2601
|
-
return proxy;
|
|
2602
|
-
},
|
|
2658
|
+
return proxy;
|
|
2659
|
+
}
|
|
2603
2660
|
|
|
2604
|
-
|
|
2605
|
-
|
|
2661
|
+
getReadOnlyHandler(value, distortedValue) {
|
|
2662
|
+
let proxy = this.readOnlyObjectGraph.get(distortedValue);
|
|
2606
2663
|
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2664
|
+
if (isUndefined(proxy)) {
|
|
2665
|
+
// caching the proxy after the first time it is accessed
|
|
2666
|
+
const handler = new ReadOnlyHandler(this, distortedValue);
|
|
2667
|
+
proxy = new Proxy(createShadowTarget(distortedValue), handler);
|
|
2668
|
+
registerProxy(proxy, value);
|
|
2669
|
+
this.readOnlyObjectGraph.set(distortedValue, proxy);
|
|
2670
|
+
}
|
|
2614
2671
|
|
|
2615
|
-
|
|
2616
|
-
objectGraph.set(distortedValue, reactiveState);
|
|
2617
|
-
return reactiveState;
|
|
2672
|
+
return proxy;
|
|
2618
2673
|
}
|
|
2619
2674
|
|
|
2620
2675
|
}
|
|
2621
|
-
/** version: 1.
|
|
2676
|
+
/** version: 1.1.5 */
|
|
2622
2677
|
|
|
2623
2678
|
/*
|
|
2624
2679
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -3072,8 +3127,10 @@ for (const [elementProp, rendererMethod] of childGetters) {
|
|
|
3072
3127
|
}
|
|
3073
3128
|
|
|
3074
3129
|
return renderer[rendererMethod](elm);
|
|
3075
|
-
}
|
|
3130
|
+
},
|
|
3076
3131
|
|
|
3132
|
+
configurable: true,
|
|
3133
|
+
enumerable: true
|
|
3077
3134
|
};
|
|
3078
3135
|
}
|
|
3079
3136
|
|
|
@@ -3093,8 +3150,11 @@ for (const queryMethod of queryMethods) {
|
|
|
3093
3150
|
}
|
|
3094
3151
|
|
|
3095
3152
|
return renderer[queryMethod](elm, arg);
|
|
3096
|
-
}
|
|
3153
|
+
},
|
|
3097
3154
|
|
|
3155
|
+
configurable: true,
|
|
3156
|
+
enumerable: true,
|
|
3157
|
+
writable: true
|
|
3098
3158
|
};
|
|
3099
3159
|
}
|
|
3100
3160
|
|
|
@@ -4132,7 +4192,7 @@ function createComponentDef(Ctor) {
|
|
|
4132
4192
|
if (!isUndefined$1(ctorShadowSupportMode)) {
|
|
4133
4193
|
assert.invariant(ctorShadowSupportMode === "any"
|
|
4134
4194
|
/* Any */
|
|
4135
|
-
|| ctorShadowSupportMode === "
|
|
4195
|
+
|| ctorShadowSupportMode === "reset"
|
|
4136
4196
|
/* Default */
|
|
4137
4197
|
, `Invalid value for static property shadowSupportMode: '${ctorShadowSupportMode}'`);
|
|
4138
4198
|
}
|
|
@@ -4294,7 +4354,7 @@ const lightingElementDef = {
|
|
|
4294
4354
|
renderMode: 1
|
|
4295
4355
|
/* Shadow */
|
|
4296
4356
|
,
|
|
4297
|
-
shadowSupportMode: "
|
|
4357
|
+
shadowSupportMode: "reset"
|
|
4298
4358
|
/* Default */
|
|
4299
4359
|
,
|
|
4300
4360
|
wire: EmptyObject,
|
|
@@ -4443,6 +4503,17 @@ function createElmHook(vnode) {
|
|
|
4443
4503
|
modComputedStyle.create(vnode);
|
|
4444
4504
|
}
|
|
4445
4505
|
|
|
4506
|
+
function hydrateElmHook(vnode) {
|
|
4507
|
+
modEvents.create(vnode); // Attrs are already on the element.
|
|
4508
|
+
// modAttrs.create(vnode);
|
|
4509
|
+
|
|
4510
|
+
modProps.create(vnode); // Already set.
|
|
4511
|
+
// modStaticClassName.create(vnode);
|
|
4512
|
+
// modStaticStyle.create(vnode);
|
|
4513
|
+
// modComputedClassName.create(vnode);
|
|
4514
|
+
// modComputedStyle.create(vnode);
|
|
4515
|
+
}
|
|
4516
|
+
|
|
4446
4517
|
function fallbackElmHook(elm, vnode) {
|
|
4447
4518
|
const {
|
|
4448
4519
|
owner
|
|
@@ -4614,6 +4685,179 @@ function createChildrenHook(vnode) {
|
|
|
4614
4685
|
}
|
|
4615
4686
|
}
|
|
4616
4687
|
|
|
4688
|
+
function isElementNode(node) {
|
|
4689
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
4690
|
+
return node.nodeType === Node.ELEMENT_NODE;
|
|
4691
|
+
}
|
|
4692
|
+
|
|
4693
|
+
function vnodesAndElementHaveCompatibleAttrs(vnode, elm) {
|
|
4694
|
+
const {
|
|
4695
|
+
data: {
|
|
4696
|
+
attrs = {}
|
|
4697
|
+
},
|
|
4698
|
+
owner: {
|
|
4699
|
+
renderer
|
|
4700
|
+
}
|
|
4701
|
+
} = vnode;
|
|
4702
|
+
let nodesAreCompatible = true; // Validate attributes, though we could always recovery from those by running the update mods.
|
|
4703
|
+
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
4704
|
+
|
|
4705
|
+
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
4706
|
+
const elmAttrValue = renderer.getAttribute(elm, attrName);
|
|
4707
|
+
|
|
4708
|
+
if (String(attrValue) !== elmAttrValue) {
|
|
4709
|
+
logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
|
|
4710
|
+
nodesAreCompatible = false;
|
|
4711
|
+
}
|
|
4712
|
+
}
|
|
4713
|
+
|
|
4714
|
+
return nodesAreCompatible;
|
|
4715
|
+
}
|
|
4716
|
+
|
|
4717
|
+
function vnodesAndElementHaveCompatibleClass(vnode, elm) {
|
|
4718
|
+
const {
|
|
4719
|
+
data: {
|
|
4720
|
+
className,
|
|
4721
|
+
classMap
|
|
4722
|
+
},
|
|
4723
|
+
owner: {
|
|
4724
|
+
renderer
|
|
4725
|
+
}
|
|
4726
|
+
} = vnode;
|
|
4727
|
+
let nodesAreCompatible = true;
|
|
4728
|
+
let vnodeClassName;
|
|
4729
|
+
|
|
4730
|
+
if (!isUndefined$1(className) && String(className) !== elm.className) {
|
|
4731
|
+
// className is used when class is bound to an expr.
|
|
4732
|
+
nodesAreCompatible = false;
|
|
4733
|
+
vnodeClassName = className;
|
|
4734
|
+
} else if (!isUndefined$1(classMap)) {
|
|
4735
|
+
// classMap is used when class is set to static value.
|
|
4736
|
+
const classList = renderer.getClassList(elm);
|
|
4737
|
+
let computedClassName = ''; // all classes from the vnode should be in the element.classList
|
|
4738
|
+
|
|
4739
|
+
for (const name in classMap) {
|
|
4740
|
+
computedClassName += ' ' + name;
|
|
4741
|
+
|
|
4742
|
+
if (!classList.contains(name)) {
|
|
4743
|
+
nodesAreCompatible = false;
|
|
4744
|
+
}
|
|
4745
|
+
}
|
|
4746
|
+
|
|
4747
|
+
vnodeClassName = computedClassName.trim();
|
|
4748
|
+
|
|
4749
|
+
if (classList.length > keys(classMap).length) {
|
|
4750
|
+
nodesAreCompatible = false;
|
|
4751
|
+
}
|
|
4752
|
+
}
|
|
4753
|
+
|
|
4754
|
+
if (!nodesAreCompatible) {
|
|
4755
|
+
logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "class" has different values, expected "${vnodeClassName}" but found "${elm.className}"`, vnode.owner);
|
|
4756
|
+
}
|
|
4757
|
+
|
|
4758
|
+
return nodesAreCompatible;
|
|
4759
|
+
}
|
|
4760
|
+
|
|
4761
|
+
function vnodesAndElementHaveCompatibleStyle(vnode, elm) {
|
|
4762
|
+
const {
|
|
4763
|
+
data: {
|
|
4764
|
+
style,
|
|
4765
|
+
styleDecls
|
|
4766
|
+
},
|
|
4767
|
+
owner: {
|
|
4768
|
+
renderer
|
|
4769
|
+
}
|
|
4770
|
+
} = vnode;
|
|
4771
|
+
const elmStyle = renderer.getAttribute(elm, 'style') || '';
|
|
4772
|
+
let vnodeStyle;
|
|
4773
|
+
let nodesAreCompatible = true;
|
|
4774
|
+
|
|
4775
|
+
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
4776
|
+
nodesAreCompatible = false;
|
|
4777
|
+
vnodeStyle = style;
|
|
4778
|
+
} else if (!isUndefined$1(styleDecls)) {
|
|
4779
|
+
const parsedVnodeStyle = parseStyleText(elmStyle);
|
|
4780
|
+
const expectedStyle = []; // styleMap is used when style is set to static value.
|
|
4781
|
+
|
|
4782
|
+
for (let i = 0, n = styleDecls.length; i < n; i++) {
|
|
4783
|
+
const [prop, value, important] = styleDecls[i];
|
|
4784
|
+
expectedStyle.push(`${prop}: ${value + (important ? ' important!' : '')}`);
|
|
4785
|
+
const parsedPropValue = parsedVnodeStyle[prop];
|
|
4786
|
+
|
|
4787
|
+
if (isUndefined$1(parsedPropValue)) {
|
|
4788
|
+
nodesAreCompatible = false;
|
|
4789
|
+
} else if (!parsedPropValue.startsWith(value)) {
|
|
4790
|
+
nodesAreCompatible = false;
|
|
4791
|
+
} else if (important && !parsedPropValue.endsWith('!important')) {
|
|
4792
|
+
nodesAreCompatible = false;
|
|
4793
|
+
}
|
|
4794
|
+
}
|
|
4795
|
+
|
|
4796
|
+
if (keys(parsedVnodeStyle).length > styleDecls.length) {
|
|
4797
|
+
nodesAreCompatible = false;
|
|
4798
|
+
}
|
|
4799
|
+
|
|
4800
|
+
vnodeStyle = ArrayJoin.call(expectedStyle, ';');
|
|
4801
|
+
}
|
|
4802
|
+
|
|
4803
|
+
if (!nodesAreCompatible) {
|
|
4804
|
+
// style is used when class is bound to an expr.
|
|
4805
|
+
logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "style" has different values, expected "${vnodeStyle}" but found "${elmStyle}".`, vnode.owner);
|
|
4806
|
+
}
|
|
4807
|
+
|
|
4808
|
+
return nodesAreCompatible;
|
|
4809
|
+
}
|
|
4810
|
+
|
|
4811
|
+
function throwHydrationError() {
|
|
4812
|
+
assert.fail('Server rendered elements do not match client side generated elements');
|
|
4813
|
+
}
|
|
4814
|
+
|
|
4815
|
+
function hydrateChildrenHook(elmChildren, children, vm) {
|
|
4816
|
+
var _a, _b;
|
|
4817
|
+
|
|
4818
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4819
|
+
const filteredVNodes = ArrayFilter.call(children, vnode => !!vnode);
|
|
4820
|
+
|
|
4821
|
+
if (elmChildren.length !== filteredVNodes.length) {
|
|
4822
|
+
logError(`Hydration mismatch: incorrect number of rendered nodes, expected ${filteredVNodes.length} but found ${elmChildren.length}.`, vm);
|
|
4823
|
+
throwHydrationError();
|
|
4824
|
+
}
|
|
4825
|
+
}
|
|
4826
|
+
|
|
4827
|
+
let elmCurrentChildIdx = 0;
|
|
4828
|
+
|
|
4829
|
+
for (let j = 0, n = children.length; j < n; j++) {
|
|
4830
|
+
const ch = children[j];
|
|
4831
|
+
|
|
4832
|
+
if (ch != null) {
|
|
4833
|
+
const childNode = elmChildren[elmCurrentChildIdx];
|
|
4834
|
+
|
|
4835
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4836
|
+
// VComments and VTexts validation is handled in their hooks
|
|
4837
|
+
if (isElementNode(childNode)) {
|
|
4838
|
+
if (((_a = ch.sel) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== childNode.tagName.toLowerCase()) {
|
|
4839
|
+
logError(`Hydration mismatch: expecting element with tag "${(_b = ch.sel) === null || _b === void 0 ? void 0 : _b.toLowerCase()}" but found "${childNode.tagName.toLowerCase()}".`, vm);
|
|
4840
|
+
throwHydrationError();
|
|
4841
|
+
} // Note: props are not yet set
|
|
4842
|
+
|
|
4843
|
+
|
|
4844
|
+
const hasIncompatibleAttrs = vnodesAndElementHaveCompatibleAttrs(ch, childNode);
|
|
4845
|
+
const hasIncompatibleClass = vnodesAndElementHaveCompatibleClass(ch, childNode);
|
|
4846
|
+
const hasIncompatibleStyle = vnodesAndElementHaveCompatibleStyle(ch, childNode);
|
|
4847
|
+
const isVNodeAndElementCompatible = hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
4848
|
+
|
|
4849
|
+
if (!isVNodeAndElementCompatible) {
|
|
4850
|
+
throwHydrationError();
|
|
4851
|
+
}
|
|
4852
|
+
}
|
|
4853
|
+
}
|
|
4854
|
+
|
|
4855
|
+
ch.hook.hydrate(ch, childNode);
|
|
4856
|
+
elmCurrentChildIdx++;
|
|
4857
|
+
}
|
|
4858
|
+
}
|
|
4859
|
+
}
|
|
4860
|
+
|
|
4617
4861
|
function updateCustomElmHook(oldVnode, vnode) {
|
|
4618
4862
|
// Attrs need to be applied to element before props
|
|
4619
4863
|
// IE11 will wipe out value on radio inputs if value
|
|
@@ -4697,38 +4941,6 @@ function getUpgradableConstructor(tagName, renderer) {
|
|
|
4697
4941
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4698
4942
|
*/
|
|
4699
4943
|
|
|
4700
|
-
/**
|
|
4701
|
-
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
|
4702
|
-
* libraries to sanitize HTML content. This hook process the content passed via the template to
|
|
4703
|
-
* lwc:inner-html directive.
|
|
4704
|
-
* It is meant to be overridden with setSanitizeHtmlContentHook
|
|
4705
|
-
*/
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
let sanitizeHtmlContentHook = () => {
|
|
4709
|
-
// locker-service patches this function during runtime to sanitize HTML content.
|
|
4710
|
-
throw new Error('sanitizeHtmlContent hook must be implemented.');
|
|
4711
|
-
};
|
|
4712
|
-
/**
|
|
4713
|
-
* Sets the sanitizeHtmlContentHook.
|
|
4714
|
-
*
|
|
4715
|
-
* @param newHookImpl
|
|
4716
|
-
* @returns oldHookImplementation.
|
|
4717
|
-
*/
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
function setSanitizeHtmlContentHook(newHookImpl) {
|
|
4721
|
-
const currentHook = sanitizeHtmlContentHook;
|
|
4722
|
-
sanitizeHtmlContentHook = newHookImpl;
|
|
4723
|
-
return currentHook;
|
|
4724
|
-
}
|
|
4725
|
-
/*
|
|
4726
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
4727
|
-
* All rights reserved.
|
|
4728
|
-
* SPDX-License-Identifier: MIT
|
|
4729
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4730
|
-
*/
|
|
4731
|
-
|
|
4732
4944
|
|
|
4733
4945
|
const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
4734
4946
|
const SymbolIterator = Symbol.iterator;
|
|
@@ -4747,7 +4959,26 @@ const TextHook = {
|
|
|
4747
4959
|
update: updateNodeHook,
|
|
4748
4960
|
insert: insertNodeHook,
|
|
4749
4961
|
move: insertNodeHook,
|
|
4750
|
-
remove: removeNodeHook
|
|
4962
|
+
remove: removeNodeHook,
|
|
4963
|
+
hydrate: (vNode, node) => {
|
|
4964
|
+
var _a;
|
|
4965
|
+
|
|
4966
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4967
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
4968
|
+
if (node.nodeType !== Node.TEXT_NODE) {
|
|
4969
|
+
logError('Hydration mismatch: incorrect node type received', vNode.owner);
|
|
4970
|
+
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
4971
|
+
}
|
|
4972
|
+
|
|
4973
|
+
if (node.nodeValue !== vNode.text) {
|
|
4974
|
+
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vNode.owner);
|
|
4975
|
+
}
|
|
4976
|
+
} // always set the text value to the one from the vnode.
|
|
4977
|
+
|
|
4978
|
+
|
|
4979
|
+
node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
|
|
4980
|
+
vNode.elm = node;
|
|
4981
|
+
}
|
|
4751
4982
|
};
|
|
4752
4983
|
const CommentHook = {
|
|
4753
4984
|
create: vnode => {
|
|
@@ -4765,7 +4996,26 @@ const CommentHook = {
|
|
|
4765
4996
|
update: updateNodeHook,
|
|
4766
4997
|
insert: insertNodeHook,
|
|
4767
4998
|
move: insertNodeHook,
|
|
4768
|
-
remove: removeNodeHook
|
|
4999
|
+
remove: removeNodeHook,
|
|
5000
|
+
hydrate: (vNode, node) => {
|
|
5001
|
+
var _a;
|
|
5002
|
+
|
|
5003
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5004
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
5005
|
+
if (node.nodeType !== Node.COMMENT_NODE) {
|
|
5006
|
+
logError('Hydration mismatch: incorrect node type received', vNode.owner);
|
|
5007
|
+
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
5008
|
+
}
|
|
5009
|
+
|
|
5010
|
+
if (node.nodeValue !== vNode.text) {
|
|
5011
|
+
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vNode.owner);
|
|
5012
|
+
}
|
|
5013
|
+
} // always set the text value to the one from the vnode.
|
|
5014
|
+
|
|
5015
|
+
|
|
5016
|
+
node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
|
|
5017
|
+
vNode.elm = node;
|
|
5018
|
+
}
|
|
4769
5019
|
}; // insert is called after update, which is used somewhere else (via a module)
|
|
4770
5020
|
// to mark the vm as inserted, that means we cannot use update as the main channel
|
|
4771
5021
|
// to rehydrate when dirty, because sometimes the element is not inserted just yet,
|
|
@@ -4805,6 +5055,38 @@ const ElementHook = {
|
|
|
4805
5055
|
remove: (vnode, parentNode) => {
|
|
4806
5056
|
removeNodeHook(vnode, parentNode);
|
|
4807
5057
|
removeElmHook(vnode);
|
|
5058
|
+
},
|
|
5059
|
+
hydrate: (vnode, node) => {
|
|
5060
|
+
const elm = node;
|
|
5061
|
+
vnode.elm = elm;
|
|
5062
|
+
const {
|
|
5063
|
+
context
|
|
5064
|
+
} = vnode.data;
|
|
5065
|
+
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
|
|
5066
|
+
/* manual */
|
|
5067
|
+
);
|
|
5068
|
+
|
|
5069
|
+
if (isDomManual) {
|
|
5070
|
+
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
5071
|
+
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
5072
|
+
const {
|
|
5073
|
+
props
|
|
5074
|
+
} = vnode.data;
|
|
5075
|
+
|
|
5076
|
+
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
5077
|
+
if (elm.innerHTML === props.innerHTML) {
|
|
5078
|
+
delete props.innerHTML;
|
|
5079
|
+
} else {
|
|
5080
|
+
logWarn(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
|
|
5081
|
+
}
|
|
5082
|
+
}
|
|
5083
|
+
}
|
|
5084
|
+
|
|
5085
|
+
hydrateElmHook(vnode);
|
|
5086
|
+
|
|
5087
|
+
if (!isDomManual) {
|
|
5088
|
+
hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vnode.owner);
|
|
5089
|
+
}
|
|
4808
5090
|
}
|
|
4809
5091
|
};
|
|
4810
5092
|
const CustomElementHook = {
|
|
@@ -4896,6 +5178,44 @@ const CustomElementHook = {
|
|
|
4896
5178
|
// will take care of disconnecting any child VM attached to its shadow as well.
|
|
4897
5179
|
removeVM(vm);
|
|
4898
5180
|
}
|
|
5181
|
+
},
|
|
5182
|
+
hydrate: (vnode, elm) => {
|
|
5183
|
+
// the element is created, but the vm is not
|
|
5184
|
+
const {
|
|
5185
|
+
sel,
|
|
5186
|
+
mode,
|
|
5187
|
+
ctor,
|
|
5188
|
+
owner
|
|
5189
|
+
} = vnode;
|
|
5190
|
+
const def = getComponentInternalDef(ctor);
|
|
5191
|
+
createVM(elm, def, {
|
|
5192
|
+
mode,
|
|
5193
|
+
owner,
|
|
5194
|
+
tagName: sel,
|
|
5195
|
+
renderer: owner.renderer
|
|
5196
|
+
});
|
|
5197
|
+
vnode.elm = elm;
|
|
5198
|
+
const vm = getAssociatedVM(elm);
|
|
5199
|
+
allocateChildrenHook(vnode, vm);
|
|
5200
|
+
hydrateElmHook(vnode); // Insert hook section:
|
|
5201
|
+
|
|
5202
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5203
|
+
assert.isTrue(vm.state === 0
|
|
5204
|
+
/* created */
|
|
5205
|
+
, `${vm} cannot be recycled.`);
|
|
5206
|
+
}
|
|
5207
|
+
|
|
5208
|
+
runConnectedCallback(vm);
|
|
5209
|
+
|
|
5210
|
+
if (vm.renderMode !== 0
|
|
5211
|
+
/* Light */
|
|
5212
|
+
) {
|
|
5213
|
+
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
5214
|
+
// Note: for Light DOM, this is handled while hydrating the VM
|
|
5215
|
+
hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vm);
|
|
5216
|
+
}
|
|
5217
|
+
|
|
5218
|
+
hydrateVM(vm);
|
|
4899
5219
|
}
|
|
4900
5220
|
};
|
|
4901
5221
|
|
|
@@ -5208,7 +5528,7 @@ function co(text) {
|
|
|
5208
5528
|
|
|
5209
5529
|
|
|
5210
5530
|
function d(value) {
|
|
5211
|
-
return value == null ? '' : value;
|
|
5531
|
+
return value == null ? '' : String(value);
|
|
5212
5532
|
} // [b]ind function
|
|
5213
5533
|
|
|
5214
5534
|
|
|
@@ -5370,6 +5690,26 @@ function sc(vnodes) {
|
|
|
5370
5690
|
|
|
5371
5691
|
markAsDynamicChildren(vnodes);
|
|
5372
5692
|
return vnodes;
|
|
5693
|
+
}
|
|
5694
|
+
/**
|
|
5695
|
+
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
|
5696
|
+
* libraries to sanitize HTML content. This hook process the content passed via the template to
|
|
5697
|
+
* lwc:inner-html directive.
|
|
5698
|
+
* It is meant to be overridden with setSanitizeHtmlContentHook, it throws an error by default.
|
|
5699
|
+
*/
|
|
5700
|
+
|
|
5701
|
+
|
|
5702
|
+
let sanitizeHtmlContentHook = () => {
|
|
5703
|
+
// locker-service patches this function during runtime to sanitize HTML content.
|
|
5704
|
+
throw new Error('sanitizeHtmlContent hook must be implemented.');
|
|
5705
|
+
};
|
|
5706
|
+
/**
|
|
5707
|
+
* Sets the sanitizeHtmlContentHook.
|
|
5708
|
+
*/
|
|
5709
|
+
|
|
5710
|
+
|
|
5711
|
+
function setSanitizeHtmlContentHook(newHookImpl) {
|
|
5712
|
+
sanitizeHtmlContentHook = newHookImpl;
|
|
5373
5713
|
} // [s]anitize [h]tml [c]ontent
|
|
5374
5714
|
|
|
5375
5715
|
|
|
@@ -5564,7 +5904,10 @@ function createStylesheet(vm, stylesheets) {
|
|
|
5564
5904
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
5565
5905
|
renderer.insertGlobalStylesheet(stylesheets[i]);
|
|
5566
5906
|
}
|
|
5567
|
-
} else if (renderer.ssr) {
|
|
5907
|
+
} else if (renderer.ssr || renderer.isHydrating()) {
|
|
5908
|
+
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
5909
|
+
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
5910
|
+
// the first time the VM renders.
|
|
5568
5911
|
// native shadow or light DOM, SSR
|
|
5569
5912
|
const combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
|
|
5570
5913
|
return createInlineStyleVNode(combinedStylesheetContent);
|
|
@@ -6144,6 +6487,10 @@ function disconnectRootElement(elm) {
|
|
|
6144
6487
|
|
|
6145
6488
|
function appendVM(vm) {
|
|
6146
6489
|
rehydrate(vm);
|
|
6490
|
+
}
|
|
6491
|
+
|
|
6492
|
+
function hydrateVM(vm) {
|
|
6493
|
+
hydrate(vm);
|
|
6147
6494
|
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
6148
6495
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
6149
6496
|
|
|
@@ -6377,6 +6724,22 @@ function rehydrate(vm) {
|
|
|
6377
6724
|
}
|
|
6378
6725
|
}
|
|
6379
6726
|
|
|
6727
|
+
function hydrate(vm) {
|
|
6728
|
+
if (isTrue(vm.isDirty)) {
|
|
6729
|
+
// manually diffing/patching here.
|
|
6730
|
+
// This routine is:
|
|
6731
|
+
// patchShadowRoot(vm, children);
|
|
6732
|
+
// -> addVnodes.
|
|
6733
|
+
const children = renderComponent$1(vm);
|
|
6734
|
+
vm.children = children;
|
|
6735
|
+
const vmChildren = vm.renderMode === 0
|
|
6736
|
+
/* Light */
|
|
6737
|
+
? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;
|
|
6738
|
+
hydrateChildrenHook(vmChildren, children, vm);
|
|
6739
|
+
runRenderedCallback(vm);
|
|
6740
|
+
}
|
|
6741
|
+
}
|
|
6742
|
+
|
|
6380
6743
|
function patchShadowRoot(vm, newCh) {
|
|
6381
6744
|
const {
|
|
6382
6745
|
children: oldCh
|
|
@@ -7185,28 +7548,12 @@ function readonly(obj) {
|
|
|
7185
7548
|
|
|
7186
7549
|
let hooksAreSet = false;
|
|
7187
7550
|
|
|
7188
|
-
function overrideHooks(hooks) {
|
|
7189
|
-
const oldHooks = {};
|
|
7190
|
-
|
|
7191
|
-
if (!isUndefined$1(hooks.sanitizeHtmlContent)) {
|
|
7192
|
-
oldHooks.sanitizeHtmlContent = setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
7193
|
-
}
|
|
7194
|
-
|
|
7195
|
-
return oldHooks;
|
|
7196
|
-
}
|
|
7197
|
-
|
|
7198
7551
|
function setHooks(hooks) {
|
|
7199
7552
|
assert.isFalse(hooksAreSet, 'Hooks are already overridden, only one definition is allowed.');
|
|
7200
|
-
overrideHooks(hooks);
|
|
7201
7553
|
hooksAreSet = true;
|
|
7554
|
+
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
7202
7555
|
}
|
|
7203
|
-
|
|
7204
|
-
function setHooksForTest(hooks) {
|
|
7205
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
7206
|
-
return overrideHooks(hooks);
|
|
7207
|
-
}
|
|
7208
|
-
}
|
|
7209
|
-
/* version: 2.5.6 */
|
|
7556
|
+
/* version: 2.5.10 */
|
|
7210
7557
|
|
|
7211
7558
|
/*
|
|
7212
7559
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -7236,7 +7583,7 @@ var HostNodeType;
|
|
|
7236
7583
|
const CLASSNAMES_SEPARATOR = /\s+/g;
|
|
7237
7584
|
|
|
7238
7585
|
function classNameToTokenList(value) {
|
|
7239
|
-
return new Set(value.
|
|
7586
|
+
return new Set(value.split(CLASSNAMES_SEPARATOR).filter(str => str.length));
|
|
7240
7587
|
}
|
|
7241
7588
|
|
|
7242
7589
|
function tokenListToClassName(values) {
|
|
@@ -7298,6 +7645,11 @@ class HTMLElement$1 {
|
|
|
7298
7645
|
|
|
7299
7646
|
const renderer = {
|
|
7300
7647
|
ssr: true,
|
|
7648
|
+
|
|
7649
|
+
isHydrating() {
|
|
7650
|
+
return false;
|
|
7651
|
+
},
|
|
7652
|
+
|
|
7301
7653
|
isNativeShadowDefined: false,
|
|
7302
7654
|
isSyntheticShadowDefined: false,
|
|
7303
7655
|
|
|
@@ -7505,18 +7857,18 @@ const renderer = {
|
|
|
7505
7857
|
},
|
|
7506
7858
|
|
|
7507
7859
|
setCSSStyleProperty(element, name, value, important) {
|
|
7508
|
-
|
|
7860
|
+
const styleAttribute = element.attributes.find(attr => attr.name === 'style' && isNull(attr.namespace));
|
|
7861
|
+
const serializedProperty = `${name}: ${value}${important ? ' !important' : ''}`;
|
|
7509
7862
|
|
|
7510
7863
|
if (isUndefined$1(styleAttribute)) {
|
|
7511
|
-
|
|
7864
|
+
element.attributes.push({
|
|
7512
7865
|
name: 'style',
|
|
7513
7866
|
namespace: null,
|
|
7514
|
-
value:
|
|
7515
|
-
};
|
|
7516
|
-
|
|
7867
|
+
value: serializedProperty
|
|
7868
|
+
});
|
|
7869
|
+
} else {
|
|
7870
|
+
styleAttribute.value += `; ${serializedProperty}`;
|
|
7517
7871
|
}
|
|
7518
|
-
|
|
7519
|
-
styleAttribute.value = `${styleAttribute.value}; ${name}: ${value}${important ? ' !important' : ''}`;
|
|
7520
7872
|
},
|
|
7521
7873
|
|
|
7522
7874
|
isConnected(node) {
|
|
@@ -7697,6 +8049,6 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
7697
8049
|
|
|
7698
8050
|
freeze(LightningElement);
|
|
7699
8051
|
seal(LightningElement.prototype);
|
|
7700
|
-
/* version: 2.5.
|
|
8052
|
+
/* version: 2.5.10 */
|
|
7701
8053
|
|
|
7702
|
-
export { LightningElement, api$1 as api, createContextProvider, getComponentDef, isComponentConstructor, readonly, register, registerComponent, registerDecorators, registerTemplate, renderComponent, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks,
|
|
8054
|
+
export { LightningElement, api$1 as api, createContextProvider, getComponentDef, isComponentConstructor, readonly, register, registerComponent, registerDecorators, registerTemplate, renderComponent, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, track, unwrap, wire };
|