lwc 2.5.5-canary1 → 2.5.9
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 +672 -214
- package/dist/engine-dom/iife/es2017/engine-dom.js +673 -215
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +473 -202
- package/dist/engine-dom/iife/es5/engine-dom.js +741 -265
- package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +522 -243
- package/dist/engine-dom/umd/es2017/engine-dom.js +674 -216
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +474 -203
- package/dist/engine-dom/umd/es5/engine-dom.js +742 -266
- package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +523 -244
- package/dist/engine-server/commonjs/es2017/engine-server.js +551 -166
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
- package/dist/engine-server/esm/es2017/engine-server.js +552 -166
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +9 -39
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +10 -40
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +10 -40
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +10 -40
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +10 -40
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +11 -41
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +11 -41
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +11 -41
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +11 -41
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +3 -3
- package/dist/wire-service/iife/es2017/wire-service_debug.js +3 -3
- package/dist/wire-service/iife/es5/wire-service.js +3 -3
- package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
- package/dist/wire-service/iife/es5/wire-service_debug.js +3 -3
- package/dist/wire-service/umd/es2017/wire-service.js +4 -4
- package/dist/wire-service/umd/es2017/wire-service_debug.js +4 -4
- package/dist/wire-service/umd/es5/wire-service.js +4 -4
- package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
- package/dist/wire-service/umd/es5/wire-service_debug.js +4 -4
- package/package.json +8 -8
|
@@ -72,7 +72,7 @@ var LWC = (function (exports) {
|
|
|
72
72
|
find: ArrayFind,
|
|
73
73
|
indexOf: ArrayIndexOf,
|
|
74
74
|
join: ArrayJoin,
|
|
75
|
-
map: ArrayMap
|
|
75
|
+
map: ArrayMap,
|
|
76
76
|
push: ArrayPush$1,
|
|
77
77
|
reduce: ArrayReduce,
|
|
78
78
|
reverse: ArrayReverse,
|
|
@@ -139,7 +139,7 @@ var LWC = (function (exports) {
|
|
|
139
139
|
// Array.prototype.toString directly will cause an error Iterate through
|
|
140
140
|
// all the items and handle individually.
|
|
141
141
|
if (isArray$1(obj)) {
|
|
142
|
-
return ArrayJoin.call(ArrayMap
|
|
142
|
+
return ArrayJoin.call(ArrayMap.call(obj, toString$1), ',');
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
return obj.toString();
|
|
@@ -302,7 +302,7 @@ var LWC = (function (exports) {
|
|
|
302
302
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
303
303
|
return attributeName;
|
|
304
304
|
}
|
|
305
|
-
/** version: 2.5.
|
|
305
|
+
/** version: 2.5.9 */
|
|
306
306
|
|
|
307
307
|
/*
|
|
308
308
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -482,7 +482,7 @@ var LWC = (function (exports) {
|
|
|
482
482
|
setFeatureFlag(name, value);
|
|
483
483
|
}
|
|
484
484
|
}
|
|
485
|
-
/** version: 2.5.
|
|
485
|
+
/** version: 2.5.9 */
|
|
486
486
|
|
|
487
487
|
/* proxy-compat-disable */
|
|
488
488
|
|
|
@@ -534,6 +534,28 @@ var LWC = (function (exports) {
|
|
|
534
534
|
}
|
|
535
535
|
|
|
536
536
|
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
537
|
+
} // Borrowed from Vue template compiler.
|
|
538
|
+
// https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
const DECLARATION_DELIMITER = /;(?![^(]*\))/g;
|
|
542
|
+
const PROPERTY_DELIMITER = /:(.+)/;
|
|
543
|
+
|
|
544
|
+
function parseStyleText(cssText) {
|
|
545
|
+
const styleMap = {};
|
|
546
|
+
const declarations = cssText.split(DECLARATION_DELIMITER);
|
|
547
|
+
|
|
548
|
+
for (const declaration of declarations) {
|
|
549
|
+
if (declaration) {
|
|
550
|
+
const [prop, value] = declaration.split(PROPERTY_DELIMITER);
|
|
551
|
+
|
|
552
|
+
if (prop !== undefined && value !== undefined) {
|
|
553
|
+
styleMap[prop.trim()] = value.trim();
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
return styleMap;
|
|
537
559
|
}
|
|
538
560
|
/*
|
|
539
561
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
@@ -715,8 +737,8 @@ var LWC = (function (exports) {
|
|
|
715
737
|
*/
|
|
716
738
|
|
|
717
739
|
|
|
718
|
-
function
|
|
719
|
-
let msg = `[LWC
|
|
740
|
+
function log(method, message, vm) {
|
|
741
|
+
let msg = `[LWC ${method}]: ${message}`;
|
|
720
742
|
|
|
721
743
|
if (!isUndefined$1(vm)) {
|
|
722
744
|
msg = `${msg}\n${getComponentStack(vm)}`;
|
|
@@ -724,7 +746,7 @@ var LWC = (function (exports) {
|
|
|
724
746
|
|
|
725
747
|
if (process.env.NODE_ENV === 'test') {
|
|
726
748
|
/* eslint-disable-next-line no-console */
|
|
727
|
-
console
|
|
749
|
+
console[method](msg);
|
|
728
750
|
return;
|
|
729
751
|
}
|
|
730
752
|
|
|
@@ -732,9 +754,17 @@ var LWC = (function (exports) {
|
|
|
732
754
|
throw new Error(msg);
|
|
733
755
|
} catch (e) {
|
|
734
756
|
/* eslint-disable-next-line no-console */
|
|
735
|
-
console
|
|
757
|
+
console[method](e);
|
|
736
758
|
}
|
|
737
759
|
}
|
|
760
|
+
|
|
761
|
+
function logError(message, vm) {
|
|
762
|
+
log('error', message, vm);
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
function logWarn(message, vm) {
|
|
766
|
+
log('warn', message, vm);
|
|
767
|
+
}
|
|
738
768
|
/*
|
|
739
769
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
740
770
|
* All rights reserved.
|
|
@@ -1902,7 +1932,6 @@ var LWC = (function (exports) {
|
|
|
1902
1932
|
getPrototypeOf,
|
|
1903
1933
|
create: ObjectCreate,
|
|
1904
1934
|
defineProperty: ObjectDefineProperty,
|
|
1905
|
-
defineProperties: ObjectDefineProperties,
|
|
1906
1935
|
isExtensible,
|
|
1907
1936
|
getOwnPropertyDescriptor,
|
|
1908
1937
|
getOwnPropertyNames,
|
|
@@ -1912,8 +1941,7 @@ var LWC = (function (exports) {
|
|
|
1912
1941
|
} = Object;
|
|
1913
1942
|
const {
|
|
1914
1943
|
push: ArrayPush,
|
|
1915
|
-
concat: ArrayConcat
|
|
1916
|
-
map: ArrayMap
|
|
1944
|
+
concat: ArrayConcat
|
|
1917
1945
|
} = Array.prototype;
|
|
1918
1946
|
const OtS = {}.toString;
|
|
1919
1947
|
|
|
@@ -1978,7 +2006,9 @@ var LWC = (function (exports) {
|
|
|
1978
2006
|
// but it will always be compatible with the previous descriptor
|
|
1979
2007
|
// to preserve the object invariants, which makes these lines safe.
|
|
1980
2008
|
|
|
1981
|
-
const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key);
|
|
2009
|
+
const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key); // TODO: it should be impossible for the originalDescriptor to ever be undefined, this `if` can be removed
|
|
2010
|
+
|
|
2011
|
+
/* istanbul ignore else */
|
|
1982
2012
|
|
|
1983
2013
|
if (!isUndefined(originalDescriptor)) {
|
|
1984
2014
|
const wrappedDesc = this.wrapDescriptor(originalDescriptor);
|
|
@@ -2006,11 +2036,17 @@ var LWC = (function (exports) {
|
|
|
2006
2036
|
|
|
2007
2037
|
preventExtensions(shadowTarget);
|
|
2008
2038
|
} // Shared Traps
|
|
2039
|
+
// TODO: apply() is never called
|
|
2040
|
+
|
|
2041
|
+
/* istanbul ignore next */
|
|
2009
2042
|
|
|
2010
2043
|
|
|
2011
2044
|
apply(shadowTarget, thisArg, argArray) {
|
|
2012
2045
|
/* No op */
|
|
2013
|
-
}
|
|
2046
|
+
} // TODO: construct() is never called
|
|
2047
|
+
|
|
2048
|
+
/* istanbul ignore next */
|
|
2049
|
+
|
|
2014
2050
|
|
|
2015
2051
|
construct(shadowTarget, argArray, newTarget) {
|
|
2016
2052
|
/* No op */
|
|
@@ -2123,8 +2159,8 @@ var LWC = (function (exports) {
|
|
|
2123
2159
|
|
|
2124
2160
|
}
|
|
2125
2161
|
|
|
2126
|
-
const getterMap = new WeakMap();
|
|
2127
|
-
const setterMap = new WeakMap();
|
|
2162
|
+
const getterMap$1 = new WeakMap();
|
|
2163
|
+
const setterMap$1 = new WeakMap();
|
|
2128
2164
|
const reverseGetterMap = new WeakMap();
|
|
2129
2165
|
const reverseSetterMap = new WeakMap();
|
|
2130
2166
|
|
|
@@ -2134,7 +2170,7 @@ var LWC = (function (exports) {
|
|
|
2134
2170
|
}
|
|
2135
2171
|
|
|
2136
2172
|
wrapGetter(originalGet) {
|
|
2137
|
-
const wrappedGetter = getterMap.get(originalGet);
|
|
2173
|
+
const wrappedGetter = getterMap$1.get(originalGet);
|
|
2138
2174
|
|
|
2139
2175
|
if (!isUndefined(wrappedGetter)) {
|
|
2140
2176
|
return wrappedGetter;
|
|
@@ -2147,13 +2183,13 @@ var LWC = (function (exports) {
|
|
|
2147
2183
|
return handler.wrapValue(originalGet.call(unwrap$1(this)));
|
|
2148
2184
|
};
|
|
2149
2185
|
|
|
2150
|
-
getterMap.set(originalGet, get);
|
|
2186
|
+
getterMap$1.set(originalGet, get);
|
|
2151
2187
|
reverseGetterMap.set(get, originalGet);
|
|
2152
2188
|
return get;
|
|
2153
2189
|
}
|
|
2154
2190
|
|
|
2155
2191
|
wrapSetter(originalSet) {
|
|
2156
|
-
const wrappedSetter = setterMap.get(originalSet);
|
|
2192
|
+
const wrappedSetter = setterMap$1.get(originalSet);
|
|
2157
2193
|
|
|
2158
2194
|
if (!isUndefined(wrappedSetter)) {
|
|
2159
2195
|
return wrappedSetter;
|
|
@@ -2164,7 +2200,7 @@ var LWC = (function (exports) {
|
|
|
2164
2200
|
originalSet.call(unwrap$1(this), unwrap$1(v));
|
|
2165
2201
|
};
|
|
2166
2202
|
|
|
2167
|
-
setterMap.set(originalSet, set);
|
|
2203
|
+
setterMap$1.set(originalSet, set);
|
|
2168
2204
|
reverseSetterMap.set(set, originalSet);
|
|
2169
2205
|
return set;
|
|
2170
2206
|
}
|
|
@@ -2205,7 +2241,7 @@ var LWC = (function (exports) {
|
|
|
2205
2241
|
return unwrap$1(redGet.call(handler.wrapValue(this)));
|
|
2206
2242
|
};
|
|
2207
2243
|
|
|
2208
|
-
getterMap.set(get, redGet);
|
|
2244
|
+
getterMap$1.set(get, redGet);
|
|
2209
2245
|
reverseGetterMap.set(redGet, get);
|
|
2210
2246
|
return get;
|
|
2211
2247
|
}
|
|
@@ -2224,7 +2260,7 @@ var LWC = (function (exports) {
|
|
|
2224
2260
|
redSet.call(handler.wrapValue(this), handler.wrapValue(v));
|
|
2225
2261
|
};
|
|
2226
2262
|
|
|
2227
|
-
setterMap.set(set, redSet);
|
|
2263
|
+
setterMap$1.set(set, redSet);
|
|
2228
2264
|
reverseSetterMap.set(redSet, set);
|
|
2229
2265
|
return set;
|
|
2230
2266
|
}
|
|
@@ -2265,6 +2301,7 @@ var LWC = (function (exports) {
|
|
|
2265
2301
|
}
|
|
2266
2302
|
|
|
2267
2303
|
setPrototypeOf(shadowTarget, prototype) {
|
|
2304
|
+
/* istanbul ignore else */
|
|
2268
2305
|
if (process.env.NODE_ENV !== 'production') {
|
|
2269
2306
|
throw new Error(`Invalid setPrototypeOf invocation for reactive proxy ${toString(this.originalTarget)}. Prototype of reactive objects cannot be changed.`);
|
|
2270
2307
|
}
|
|
@@ -2278,6 +2315,11 @@ var LWC = (function (exports) {
|
|
|
2278
2315
|
preventExtensions(originalTarget); // if the originalTarget is a proxy itself, it might reject
|
|
2279
2316
|
// the preventExtension call, in which case we should not attempt to lock down
|
|
2280
2317
|
// the shadow target.
|
|
2318
|
+
// TODO: It should not actually be possible to reach this `if` statement.
|
|
2319
|
+
// If a proxy rejects extensions, then calling preventExtensions will throw an error:
|
|
2320
|
+
// https://codepen.io/nolanlawson-the-selector/pen/QWMOjbY
|
|
2321
|
+
|
|
2322
|
+
/* istanbul ignore if */
|
|
2281
2323
|
|
|
2282
2324
|
if (isExtensible(originalTarget)) {
|
|
2283
2325
|
return false;
|
|
@@ -2319,8 +2361,8 @@ var LWC = (function (exports) {
|
|
|
2319
2361
|
|
|
2320
2362
|
}
|
|
2321
2363
|
|
|
2322
|
-
const getterMap
|
|
2323
|
-
const setterMap
|
|
2364
|
+
const getterMap = new WeakMap();
|
|
2365
|
+
const setterMap = new WeakMap();
|
|
2324
2366
|
|
|
2325
2367
|
class ReadOnlyHandler extends BaseProxyHandler {
|
|
2326
2368
|
wrapValue(value) {
|
|
@@ -2328,7 +2370,7 @@ var LWC = (function (exports) {
|
|
|
2328
2370
|
}
|
|
2329
2371
|
|
|
2330
2372
|
wrapGetter(originalGet) {
|
|
2331
|
-
const wrappedGetter = getterMap
|
|
2373
|
+
const wrappedGetter = getterMap.get(originalGet);
|
|
2332
2374
|
|
|
2333
2375
|
if (!isUndefined(wrappedGetter)) {
|
|
2334
2376
|
return wrappedGetter;
|
|
@@ -2341,12 +2383,12 @@ var LWC = (function (exports) {
|
|
|
2341
2383
|
return handler.wrapValue(originalGet.call(unwrap$1(this)));
|
|
2342
2384
|
};
|
|
2343
2385
|
|
|
2344
|
-
getterMap
|
|
2386
|
+
getterMap.set(originalGet, get);
|
|
2345
2387
|
return get;
|
|
2346
2388
|
}
|
|
2347
2389
|
|
|
2348
2390
|
wrapSetter(originalSet) {
|
|
2349
|
-
const wrappedSetter = setterMap
|
|
2391
|
+
const wrappedSetter = setterMap.get(originalSet);
|
|
2350
2392
|
|
|
2351
2393
|
if (!isUndefined(wrappedSetter)) {
|
|
2352
2394
|
return wrappedSetter;
|
|
@@ -2355,6 +2397,7 @@ var LWC = (function (exports) {
|
|
|
2355
2397
|
const handler = this;
|
|
2356
2398
|
|
|
2357
2399
|
const set = function (v) {
|
|
2400
|
+
/* istanbul ignore else */
|
|
2358
2401
|
if (process.env.NODE_ENV !== 'production') {
|
|
2359
2402
|
const {
|
|
2360
2403
|
originalTarget
|
|
@@ -2363,33 +2406,41 @@ var LWC = (function (exports) {
|
|
|
2363
2406
|
}
|
|
2364
2407
|
};
|
|
2365
2408
|
|
|
2366
|
-
setterMap
|
|
2409
|
+
setterMap.set(originalSet, set);
|
|
2367
2410
|
return set;
|
|
2368
2411
|
}
|
|
2369
2412
|
|
|
2370
2413
|
set(shadowTarget, key, value) {
|
|
2414
|
+
/* istanbul ignore else */
|
|
2371
2415
|
if (process.env.NODE_ENV !== 'production') {
|
|
2372
2416
|
const {
|
|
2373
2417
|
originalTarget
|
|
2374
2418
|
} = this;
|
|
2375
|
-
|
|
2419
|
+
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.`;
|
|
2420
|
+
throw new Error(msg);
|
|
2376
2421
|
}
|
|
2422
|
+
/* istanbul ignore next */
|
|
2423
|
+
|
|
2377
2424
|
|
|
2378
2425
|
return false;
|
|
2379
2426
|
}
|
|
2380
2427
|
|
|
2381
2428
|
deleteProperty(shadowTarget, key) {
|
|
2429
|
+
/* istanbul ignore else */
|
|
2382
2430
|
if (process.env.NODE_ENV !== 'production') {
|
|
2383
2431
|
const {
|
|
2384
2432
|
originalTarget
|
|
2385
2433
|
} = this;
|
|
2386
2434
|
throw new Error(`Invalid mutation: Cannot delete "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`);
|
|
2387
2435
|
}
|
|
2436
|
+
/* istanbul ignore next */
|
|
2437
|
+
|
|
2388
2438
|
|
|
2389
2439
|
return false;
|
|
2390
2440
|
}
|
|
2391
2441
|
|
|
2392
2442
|
setPrototypeOf(shadowTarget, prototype) {
|
|
2443
|
+
/* istanbul ignore else */
|
|
2393
2444
|
if (process.env.NODE_ENV !== 'production') {
|
|
2394
2445
|
const {
|
|
2395
2446
|
originalTarget
|
|
@@ -2399,23 +2450,29 @@ var LWC = (function (exports) {
|
|
|
2399
2450
|
}
|
|
2400
2451
|
|
|
2401
2452
|
preventExtensions(shadowTarget) {
|
|
2453
|
+
/* istanbul ignore else */
|
|
2402
2454
|
if (process.env.NODE_ENV !== 'production') {
|
|
2403
2455
|
const {
|
|
2404
2456
|
originalTarget
|
|
2405
2457
|
} = this;
|
|
2406
2458
|
throw new Error(`Invalid mutation: Cannot preventExtensions on ${originalTarget}". "${originalTarget} is read-only.`);
|
|
2407
2459
|
}
|
|
2460
|
+
/* istanbul ignore next */
|
|
2461
|
+
|
|
2408
2462
|
|
|
2409
2463
|
return false;
|
|
2410
2464
|
}
|
|
2411
2465
|
|
|
2412
2466
|
defineProperty(shadowTarget, key, descriptor) {
|
|
2467
|
+
/* istanbul ignore else */
|
|
2413
2468
|
if (process.env.NODE_ENV !== 'production') {
|
|
2414
2469
|
const {
|
|
2415
2470
|
originalTarget
|
|
2416
2471
|
} = this;
|
|
2417
2472
|
throw new Error(`Invalid mutation: Cannot defineProperty "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`);
|
|
2418
2473
|
}
|
|
2474
|
+
/* istanbul ignore next */
|
|
2475
|
+
|
|
2419
2476
|
|
|
2420
2477
|
return false;
|
|
2421
2478
|
}
|
|
@@ -2473,6 +2530,8 @@ var LWC = (function (exports) {
|
|
|
2473
2530
|
}; // Inspired from paulmillr/es6-shim
|
|
2474
2531
|
// https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js#L176-L185
|
|
2475
2532
|
|
|
2533
|
+
/* istanbul ignore next */
|
|
2534
|
+
|
|
2476
2535
|
function getGlobal() {
|
|
2477
2536
|
// the only reliable means to get the global object is `Function('return this')()`
|
|
2478
2537
|
// However, this causes CSP violations in Chrome apps.
|
|
@@ -2497,6 +2556,7 @@ var LWC = (function (exports) {
|
|
|
2497
2556
|
}
|
|
2498
2557
|
|
|
2499
2558
|
function init() {
|
|
2559
|
+
/* istanbul ignore if */
|
|
2500
2560
|
if (process.env.NODE_ENV === 'production') {
|
|
2501
2561
|
// this method should never leak to prod
|
|
2502
2562
|
throw new ReferenceError();
|
|
@@ -2511,6 +2571,8 @@ var LWC = (function (exports) {
|
|
|
2511
2571
|
ArrayPush.call(devtoolsFormatters, formatter);
|
|
2512
2572
|
global.devtoolsFormatters = devtoolsFormatters;
|
|
2513
2573
|
}
|
|
2574
|
+
/* istanbul ignore else */
|
|
2575
|
+
|
|
2514
2576
|
|
|
2515
2577
|
if (process.env.NODE_ENV !== 'production') {
|
|
2516
2578
|
init();
|
|
@@ -2557,7 +2619,8 @@ var LWC = (function (exports) {
|
|
|
2557
2619
|
this.valueMutated = defaultValueMutated;
|
|
2558
2620
|
this.valueObserved = defaultValueObserved;
|
|
2559
2621
|
this.valueIsObservable = defaultValueIsObservable;
|
|
2560
|
-
this.
|
|
2622
|
+
this.readOnlyObjectGraph = new WeakMap();
|
|
2623
|
+
this.reactiveObjectGraph = new WeakMap();
|
|
2561
2624
|
|
|
2562
2625
|
if (!isUndefined(options)) {
|
|
2563
2626
|
const {
|
|
@@ -2580,10 +2643,13 @@ var LWC = (function (exports) {
|
|
|
2580
2643
|
const distorted = this.valueDistortion(unwrappedValue);
|
|
2581
2644
|
|
|
2582
2645
|
if (this.valueIsObservable(distorted)) {
|
|
2583
|
-
|
|
2584
|
-
|
|
2646
|
+
if (this.readOnlyObjectGraph.get(distorted) === value) {
|
|
2647
|
+
// when trying to extract the writable version of a readonly
|
|
2648
|
+
// we return the readonly.
|
|
2649
|
+
return value;
|
|
2650
|
+
}
|
|
2585
2651
|
|
|
2586
|
-
return
|
|
2652
|
+
return this.getReactiveHandler(unwrappedValue, distorted);
|
|
2587
2653
|
}
|
|
2588
2654
|
|
|
2589
2655
|
return distorted;
|
|
@@ -2594,7 +2660,7 @@ var LWC = (function (exports) {
|
|
|
2594
2660
|
const distorted = this.valueDistortion(value);
|
|
2595
2661
|
|
|
2596
2662
|
if (this.valueIsObservable(distorted)) {
|
|
2597
|
-
return this.
|
|
2663
|
+
return this.getReadOnlyHandler(value, distorted);
|
|
2598
2664
|
}
|
|
2599
2665
|
|
|
2600
2666
|
return distorted;
|
|
@@ -2604,47 +2670,36 @@ var LWC = (function (exports) {
|
|
|
2604
2670
|
return unwrap$1(p);
|
|
2605
2671
|
}
|
|
2606
2672
|
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
objectGraph
|
|
2610
|
-
} = this;
|
|
2611
|
-
let reactiveState = objectGraph.get(distortedValue);
|
|
2673
|
+
getReactiveHandler(value, distortedValue) {
|
|
2674
|
+
let proxy = this.reactiveObjectGraph.get(distortedValue);
|
|
2612
2675
|
|
|
2613
|
-
if (
|
|
2614
|
-
|
|
2676
|
+
if (isUndefined(proxy)) {
|
|
2677
|
+
// caching the proxy after the first time it is accessed
|
|
2678
|
+
const handler = new ReactiveProxyHandler(this, distortedValue);
|
|
2679
|
+
proxy = new Proxy(createShadowTarget(distortedValue), handler);
|
|
2680
|
+
registerProxy(proxy, value);
|
|
2681
|
+
this.reactiveObjectGraph.set(distortedValue, proxy);
|
|
2615
2682
|
}
|
|
2616
2683
|
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
get reactive() {
|
|
2620
|
-
const reactiveHandler = new ReactiveProxyHandler(membrane, distortedValue); // caching the reactive proxy after the first time it is accessed
|
|
2621
|
-
|
|
2622
|
-
const proxy = new Proxy(createShadowTarget(distortedValue), reactiveHandler);
|
|
2623
|
-
registerProxy(proxy, value);
|
|
2624
|
-
ObjectDefineProperty(this, 'reactive', {
|
|
2625
|
-
value: proxy
|
|
2626
|
-
});
|
|
2627
|
-
return proxy;
|
|
2628
|
-
},
|
|
2684
|
+
return proxy;
|
|
2685
|
+
}
|
|
2629
2686
|
|
|
2630
|
-
|
|
2631
|
-
|
|
2687
|
+
getReadOnlyHandler(value, distortedValue) {
|
|
2688
|
+
let proxy = this.readOnlyObjectGraph.get(distortedValue);
|
|
2632
2689
|
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2690
|
+
if (isUndefined(proxy)) {
|
|
2691
|
+
// caching the proxy after the first time it is accessed
|
|
2692
|
+
const handler = new ReadOnlyHandler(this, distortedValue);
|
|
2693
|
+
proxy = new Proxy(createShadowTarget(distortedValue), handler);
|
|
2694
|
+
registerProxy(proxy, value);
|
|
2695
|
+
this.readOnlyObjectGraph.set(distortedValue, proxy);
|
|
2696
|
+
}
|
|
2640
2697
|
|
|
2641
|
-
|
|
2642
|
-
objectGraph.set(distortedValue, reactiveState);
|
|
2643
|
-
return reactiveState;
|
|
2698
|
+
return proxy;
|
|
2644
2699
|
}
|
|
2645
2700
|
|
|
2646
2701
|
}
|
|
2647
|
-
/** version: 1.
|
|
2702
|
+
/** version: 1.1.5 */
|
|
2648
2703
|
|
|
2649
2704
|
/*
|
|
2650
2705
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -3098,8 +3153,10 @@ var LWC = (function (exports) {
|
|
|
3098
3153
|
}
|
|
3099
3154
|
|
|
3100
3155
|
return renderer[rendererMethod](elm);
|
|
3101
|
-
}
|
|
3156
|
+
},
|
|
3102
3157
|
|
|
3158
|
+
configurable: true,
|
|
3159
|
+
enumerable: true
|
|
3103
3160
|
};
|
|
3104
3161
|
}
|
|
3105
3162
|
|
|
@@ -3119,8 +3176,11 @@ var LWC = (function (exports) {
|
|
|
3119
3176
|
}
|
|
3120
3177
|
|
|
3121
3178
|
return renderer[queryMethod](elm, arg);
|
|
3122
|
-
}
|
|
3179
|
+
},
|
|
3123
3180
|
|
|
3181
|
+
configurable: true,
|
|
3182
|
+
enumerable: true,
|
|
3183
|
+
writable: true
|
|
3124
3184
|
};
|
|
3125
3185
|
}
|
|
3126
3186
|
|
|
@@ -4278,7 +4338,7 @@ var LWC = (function (exports) {
|
|
|
4278
4338
|
if (!isUndefined$1(ctorShadowSupportMode)) {
|
|
4279
4339
|
assert.invariant(ctorShadowSupportMode === "any"
|
|
4280
4340
|
/* Any */
|
|
4281
|
-
|| ctorShadowSupportMode === "
|
|
4341
|
+
|| ctorShadowSupportMode === "reset"
|
|
4282
4342
|
/* Default */
|
|
4283
4343
|
, `Invalid value for static property shadowSupportMode: '${ctorShadowSupportMode}'`);
|
|
4284
4344
|
}
|
|
@@ -4440,7 +4500,7 @@ var LWC = (function (exports) {
|
|
|
4440
4500
|
renderMode: 1
|
|
4441
4501
|
/* Shadow */
|
|
4442
4502
|
,
|
|
4443
|
-
shadowSupportMode: "
|
|
4503
|
+
shadowSupportMode: "reset"
|
|
4444
4504
|
/* Default */
|
|
4445
4505
|
,
|
|
4446
4506
|
wire: EmptyObject,
|
|
@@ -4589,6 +4649,17 @@ var LWC = (function (exports) {
|
|
|
4589
4649
|
modComputedStyle.create(vnode);
|
|
4590
4650
|
}
|
|
4591
4651
|
|
|
4652
|
+
function hydrateElmHook(vnode) {
|
|
4653
|
+
modEvents.create(vnode); // Attrs are already on the element.
|
|
4654
|
+
// modAttrs.create(vnode);
|
|
4655
|
+
|
|
4656
|
+
modProps.create(vnode); // Already set.
|
|
4657
|
+
// modStaticClassName.create(vnode);
|
|
4658
|
+
// modStaticStyle.create(vnode);
|
|
4659
|
+
// modComputedClassName.create(vnode);
|
|
4660
|
+
// modComputedStyle.create(vnode);
|
|
4661
|
+
}
|
|
4662
|
+
|
|
4592
4663
|
function fallbackElmHook(elm, vnode) {
|
|
4593
4664
|
const {
|
|
4594
4665
|
owner
|
|
@@ -4760,6 +4831,179 @@ var LWC = (function (exports) {
|
|
|
4760
4831
|
}
|
|
4761
4832
|
}
|
|
4762
4833
|
|
|
4834
|
+
function isElementNode(node) {
|
|
4835
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
4836
|
+
return node.nodeType === Node.ELEMENT_NODE;
|
|
4837
|
+
}
|
|
4838
|
+
|
|
4839
|
+
function vnodesAndElementHaveCompatibleAttrs(vnode, elm) {
|
|
4840
|
+
const {
|
|
4841
|
+
data: {
|
|
4842
|
+
attrs = {}
|
|
4843
|
+
},
|
|
4844
|
+
owner: {
|
|
4845
|
+
renderer
|
|
4846
|
+
}
|
|
4847
|
+
} = vnode;
|
|
4848
|
+
let nodesAreCompatible = true; // Validate attributes, though we could always recovery from those by running the update mods.
|
|
4849
|
+
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
4850
|
+
|
|
4851
|
+
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
4852
|
+
const elmAttrValue = renderer.getAttribute(elm, attrName);
|
|
4853
|
+
|
|
4854
|
+
if (String(attrValue) !== elmAttrValue) {
|
|
4855
|
+
logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
|
|
4856
|
+
nodesAreCompatible = false;
|
|
4857
|
+
}
|
|
4858
|
+
}
|
|
4859
|
+
|
|
4860
|
+
return nodesAreCompatible;
|
|
4861
|
+
}
|
|
4862
|
+
|
|
4863
|
+
function vnodesAndElementHaveCompatibleClass(vnode, elm) {
|
|
4864
|
+
const {
|
|
4865
|
+
data: {
|
|
4866
|
+
className,
|
|
4867
|
+
classMap
|
|
4868
|
+
},
|
|
4869
|
+
owner: {
|
|
4870
|
+
renderer
|
|
4871
|
+
}
|
|
4872
|
+
} = vnode;
|
|
4873
|
+
let nodesAreCompatible = true;
|
|
4874
|
+
let vnodeClassName;
|
|
4875
|
+
|
|
4876
|
+
if (!isUndefined$1(className) && String(className) !== elm.className) {
|
|
4877
|
+
// className is used when class is bound to an expr.
|
|
4878
|
+
nodesAreCompatible = false;
|
|
4879
|
+
vnodeClassName = className;
|
|
4880
|
+
} else if (!isUndefined$1(classMap)) {
|
|
4881
|
+
// classMap is used when class is set to static value.
|
|
4882
|
+
const classList = renderer.getClassList(elm);
|
|
4883
|
+
let computedClassName = ''; // all classes from the vnode should be in the element.classList
|
|
4884
|
+
|
|
4885
|
+
for (const name in classMap) {
|
|
4886
|
+
computedClassName += ' ' + name;
|
|
4887
|
+
|
|
4888
|
+
if (!classList.contains(name)) {
|
|
4889
|
+
nodesAreCompatible = false;
|
|
4890
|
+
}
|
|
4891
|
+
}
|
|
4892
|
+
|
|
4893
|
+
vnodeClassName = computedClassName.trim();
|
|
4894
|
+
|
|
4895
|
+
if (classList.length > keys(classMap).length) {
|
|
4896
|
+
nodesAreCompatible = false;
|
|
4897
|
+
}
|
|
4898
|
+
}
|
|
4899
|
+
|
|
4900
|
+
if (!nodesAreCompatible) {
|
|
4901
|
+
logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "class" has different values, expected "${vnodeClassName}" but found "${elm.className}"`, vnode.owner);
|
|
4902
|
+
}
|
|
4903
|
+
|
|
4904
|
+
return nodesAreCompatible;
|
|
4905
|
+
}
|
|
4906
|
+
|
|
4907
|
+
function vnodesAndElementHaveCompatibleStyle(vnode, elm) {
|
|
4908
|
+
const {
|
|
4909
|
+
data: {
|
|
4910
|
+
style,
|
|
4911
|
+
styleDecls
|
|
4912
|
+
},
|
|
4913
|
+
owner: {
|
|
4914
|
+
renderer
|
|
4915
|
+
}
|
|
4916
|
+
} = vnode;
|
|
4917
|
+
const elmStyle = renderer.getAttribute(elm, 'style') || '';
|
|
4918
|
+
let vnodeStyle;
|
|
4919
|
+
let nodesAreCompatible = true;
|
|
4920
|
+
|
|
4921
|
+
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
4922
|
+
nodesAreCompatible = false;
|
|
4923
|
+
vnodeStyle = style;
|
|
4924
|
+
} else if (!isUndefined$1(styleDecls)) {
|
|
4925
|
+
const parsedVnodeStyle = parseStyleText(elmStyle);
|
|
4926
|
+
const expectedStyle = []; // styleMap is used when style is set to static value.
|
|
4927
|
+
|
|
4928
|
+
for (let i = 0, n = styleDecls.length; i < n; i++) {
|
|
4929
|
+
const [prop, value, important] = styleDecls[i];
|
|
4930
|
+
expectedStyle.push(`${prop}: ${value + (important ? ' important!' : '')}`);
|
|
4931
|
+
const parsedPropValue = parsedVnodeStyle[prop];
|
|
4932
|
+
|
|
4933
|
+
if (isUndefined$1(parsedPropValue)) {
|
|
4934
|
+
nodesAreCompatible = false;
|
|
4935
|
+
} else if (!parsedPropValue.startsWith(value)) {
|
|
4936
|
+
nodesAreCompatible = false;
|
|
4937
|
+
} else if (important && !parsedPropValue.endsWith('!important')) {
|
|
4938
|
+
nodesAreCompatible = false;
|
|
4939
|
+
}
|
|
4940
|
+
}
|
|
4941
|
+
|
|
4942
|
+
if (keys(parsedVnodeStyle).length > styleDecls.length) {
|
|
4943
|
+
nodesAreCompatible = false;
|
|
4944
|
+
}
|
|
4945
|
+
|
|
4946
|
+
vnodeStyle = ArrayJoin.call(expectedStyle, ';');
|
|
4947
|
+
}
|
|
4948
|
+
|
|
4949
|
+
if (!nodesAreCompatible) {
|
|
4950
|
+
// style is used when class is bound to an expr.
|
|
4951
|
+
logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "style" has different values, expected "${vnodeStyle}" but found "${elmStyle}".`, vnode.owner);
|
|
4952
|
+
}
|
|
4953
|
+
|
|
4954
|
+
return nodesAreCompatible;
|
|
4955
|
+
}
|
|
4956
|
+
|
|
4957
|
+
function throwHydrationError() {
|
|
4958
|
+
assert.fail('Server rendered elements do not match client side generated elements');
|
|
4959
|
+
}
|
|
4960
|
+
|
|
4961
|
+
function hydrateChildrenHook(elmChildren, children, vm) {
|
|
4962
|
+
var _a, _b;
|
|
4963
|
+
|
|
4964
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4965
|
+
const filteredVNodes = ArrayFilter.call(children, vnode => !!vnode);
|
|
4966
|
+
|
|
4967
|
+
if (elmChildren.length !== filteredVNodes.length) {
|
|
4968
|
+
logError(`Hydration mismatch: incorrect number of rendered nodes, expected ${filteredVNodes.length} but found ${elmChildren.length}.`, vm);
|
|
4969
|
+
throwHydrationError();
|
|
4970
|
+
}
|
|
4971
|
+
}
|
|
4972
|
+
|
|
4973
|
+
let elmCurrentChildIdx = 0;
|
|
4974
|
+
|
|
4975
|
+
for (let j = 0, n = children.length; j < n; j++) {
|
|
4976
|
+
const ch = children[j];
|
|
4977
|
+
|
|
4978
|
+
if (ch != null) {
|
|
4979
|
+
const childNode = elmChildren[elmCurrentChildIdx];
|
|
4980
|
+
|
|
4981
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4982
|
+
// VComments and VTexts validation is handled in their hooks
|
|
4983
|
+
if (isElementNode(childNode)) {
|
|
4984
|
+
if (((_a = ch.sel) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== childNode.tagName.toLowerCase()) {
|
|
4985
|
+
logError(`Hydration mismatch: expecting element with tag "${(_b = ch.sel) === null || _b === void 0 ? void 0 : _b.toLowerCase()}" but found "${childNode.tagName.toLowerCase()}".`, vm);
|
|
4986
|
+
throwHydrationError();
|
|
4987
|
+
} // Note: props are not yet set
|
|
4988
|
+
|
|
4989
|
+
|
|
4990
|
+
const hasIncompatibleAttrs = vnodesAndElementHaveCompatibleAttrs(ch, childNode);
|
|
4991
|
+
const hasIncompatibleClass = vnodesAndElementHaveCompatibleClass(ch, childNode);
|
|
4992
|
+
const hasIncompatibleStyle = vnodesAndElementHaveCompatibleStyle(ch, childNode);
|
|
4993
|
+
const isVNodeAndElementCompatible = hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
4994
|
+
|
|
4995
|
+
if (!isVNodeAndElementCompatible) {
|
|
4996
|
+
throwHydrationError();
|
|
4997
|
+
}
|
|
4998
|
+
}
|
|
4999
|
+
}
|
|
5000
|
+
|
|
5001
|
+
ch.hook.hydrate(ch, childNode);
|
|
5002
|
+
elmCurrentChildIdx++;
|
|
5003
|
+
}
|
|
5004
|
+
}
|
|
5005
|
+
}
|
|
5006
|
+
|
|
4763
5007
|
function updateCustomElmHook(oldVnode, vnode) {
|
|
4764
5008
|
// Attrs need to be applied to element before props
|
|
4765
5009
|
// IE11 will wipe out value on radio inputs if value
|
|
@@ -4843,38 +5087,6 @@ var LWC = (function (exports) {
|
|
|
4843
5087
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4844
5088
|
*/
|
|
4845
5089
|
|
|
4846
|
-
/**
|
|
4847
|
-
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
|
4848
|
-
* libraries to sanitize HTML content. This hook process the content passed via the template to
|
|
4849
|
-
* lwc:inner-html directive.
|
|
4850
|
-
* It is meant to be overridden with setSanitizeHtmlContentHook
|
|
4851
|
-
*/
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
let sanitizeHtmlContentHook = () => {
|
|
4855
|
-
// locker-service patches this function during runtime to sanitize HTML content.
|
|
4856
|
-
throw new Error('sanitizeHtmlContent hook must be implemented.');
|
|
4857
|
-
};
|
|
4858
|
-
/**
|
|
4859
|
-
* Sets the sanitizeHtmlContentHook.
|
|
4860
|
-
*
|
|
4861
|
-
* @param newHookImpl
|
|
4862
|
-
* @returns oldHookImplementation.
|
|
4863
|
-
*/
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
function setSanitizeHtmlContentHook(newHookImpl) {
|
|
4867
|
-
const currentHook = sanitizeHtmlContentHook;
|
|
4868
|
-
sanitizeHtmlContentHook = newHookImpl;
|
|
4869
|
-
return currentHook;
|
|
4870
|
-
}
|
|
4871
|
-
/*
|
|
4872
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
4873
|
-
* All rights reserved.
|
|
4874
|
-
* SPDX-License-Identifier: MIT
|
|
4875
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4876
|
-
*/
|
|
4877
|
-
|
|
4878
5090
|
|
|
4879
5091
|
const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
4880
5092
|
const SymbolIterator = Symbol.iterator;
|
|
@@ -4893,7 +5105,26 @@ var LWC = (function (exports) {
|
|
|
4893
5105
|
update: updateNodeHook,
|
|
4894
5106
|
insert: insertNodeHook,
|
|
4895
5107
|
move: insertNodeHook,
|
|
4896
|
-
remove: removeNodeHook
|
|
5108
|
+
remove: removeNodeHook,
|
|
5109
|
+
hydrate: (vNode, node) => {
|
|
5110
|
+
var _a;
|
|
5111
|
+
|
|
5112
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5113
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
5114
|
+
if (node.nodeType !== Node.TEXT_NODE) {
|
|
5115
|
+
logError('Hydration mismatch: incorrect node type received', vNode.owner);
|
|
5116
|
+
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
5117
|
+
}
|
|
5118
|
+
|
|
5119
|
+
if (node.nodeValue !== vNode.text) {
|
|
5120
|
+
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vNode.owner);
|
|
5121
|
+
}
|
|
5122
|
+
} // always set the text value to the one from the vnode.
|
|
5123
|
+
|
|
5124
|
+
|
|
5125
|
+
node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
|
|
5126
|
+
vNode.elm = node;
|
|
5127
|
+
}
|
|
4897
5128
|
};
|
|
4898
5129
|
const CommentHook = {
|
|
4899
5130
|
create: vnode => {
|
|
@@ -4911,7 +5142,26 @@ var LWC = (function (exports) {
|
|
|
4911
5142
|
update: updateNodeHook,
|
|
4912
5143
|
insert: insertNodeHook,
|
|
4913
5144
|
move: insertNodeHook,
|
|
4914
|
-
remove: removeNodeHook
|
|
5145
|
+
remove: removeNodeHook,
|
|
5146
|
+
hydrate: (vNode, node) => {
|
|
5147
|
+
var _a;
|
|
5148
|
+
|
|
5149
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5150
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
5151
|
+
if (node.nodeType !== Node.COMMENT_NODE) {
|
|
5152
|
+
logError('Hydration mismatch: incorrect node type received', vNode.owner);
|
|
5153
|
+
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
5154
|
+
}
|
|
5155
|
+
|
|
5156
|
+
if (node.nodeValue !== vNode.text) {
|
|
5157
|
+
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vNode.owner);
|
|
5158
|
+
}
|
|
5159
|
+
} // always set the text value to the one from the vnode.
|
|
5160
|
+
|
|
5161
|
+
|
|
5162
|
+
node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
|
|
5163
|
+
vNode.elm = node;
|
|
5164
|
+
}
|
|
4915
5165
|
}; // insert is called after update, which is used somewhere else (via a module)
|
|
4916
5166
|
// to mark the vm as inserted, that means we cannot use update as the main channel
|
|
4917
5167
|
// to rehydrate when dirty, because sometimes the element is not inserted just yet,
|
|
@@ -4951,6 +5201,38 @@ var LWC = (function (exports) {
|
|
|
4951
5201
|
remove: (vnode, parentNode) => {
|
|
4952
5202
|
removeNodeHook(vnode, parentNode);
|
|
4953
5203
|
removeElmHook(vnode);
|
|
5204
|
+
},
|
|
5205
|
+
hydrate: (vnode, node) => {
|
|
5206
|
+
const elm = node;
|
|
5207
|
+
vnode.elm = elm;
|
|
5208
|
+
const {
|
|
5209
|
+
context
|
|
5210
|
+
} = vnode.data;
|
|
5211
|
+
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
|
|
5212
|
+
/* manual */
|
|
5213
|
+
);
|
|
5214
|
+
|
|
5215
|
+
if (isDomManual) {
|
|
5216
|
+
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
5217
|
+
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
5218
|
+
const {
|
|
5219
|
+
props
|
|
5220
|
+
} = vnode.data;
|
|
5221
|
+
|
|
5222
|
+
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
5223
|
+
if (elm.innerHTML === props.innerHTML) {
|
|
5224
|
+
delete props.innerHTML;
|
|
5225
|
+
} else {
|
|
5226
|
+
logWarn(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
|
|
5227
|
+
}
|
|
5228
|
+
}
|
|
5229
|
+
}
|
|
5230
|
+
|
|
5231
|
+
hydrateElmHook(vnode);
|
|
5232
|
+
|
|
5233
|
+
if (!isDomManual) {
|
|
5234
|
+
hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vnode.owner);
|
|
5235
|
+
}
|
|
4954
5236
|
}
|
|
4955
5237
|
};
|
|
4956
5238
|
const CustomElementHook = {
|
|
@@ -5042,6 +5324,44 @@ var LWC = (function (exports) {
|
|
|
5042
5324
|
// will take care of disconnecting any child VM attached to its shadow as well.
|
|
5043
5325
|
removeVM(vm);
|
|
5044
5326
|
}
|
|
5327
|
+
},
|
|
5328
|
+
hydrate: (vnode, elm) => {
|
|
5329
|
+
// the element is created, but the vm is not
|
|
5330
|
+
const {
|
|
5331
|
+
sel,
|
|
5332
|
+
mode,
|
|
5333
|
+
ctor,
|
|
5334
|
+
owner
|
|
5335
|
+
} = vnode;
|
|
5336
|
+
const def = getComponentInternalDef(ctor);
|
|
5337
|
+
createVM(elm, def, {
|
|
5338
|
+
mode,
|
|
5339
|
+
owner,
|
|
5340
|
+
tagName: sel,
|
|
5341
|
+
renderer: owner.renderer
|
|
5342
|
+
});
|
|
5343
|
+
vnode.elm = elm;
|
|
5344
|
+
const vm = getAssociatedVM(elm);
|
|
5345
|
+
allocateChildrenHook(vnode, vm);
|
|
5346
|
+
hydrateElmHook(vnode); // Insert hook section:
|
|
5347
|
+
|
|
5348
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5349
|
+
assert.isTrue(vm.state === 0
|
|
5350
|
+
/* created */
|
|
5351
|
+
, `${vm} cannot be recycled.`);
|
|
5352
|
+
}
|
|
5353
|
+
|
|
5354
|
+
runConnectedCallback(vm);
|
|
5355
|
+
|
|
5356
|
+
if (vm.renderMode !== 0
|
|
5357
|
+
/* Light */
|
|
5358
|
+
) {
|
|
5359
|
+
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
5360
|
+
// Note: for Light DOM, this is handled while hydrating the VM
|
|
5361
|
+
hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vm);
|
|
5362
|
+
}
|
|
5363
|
+
|
|
5364
|
+
hydrateVM(vm);
|
|
5045
5365
|
}
|
|
5046
5366
|
};
|
|
5047
5367
|
|
|
@@ -5250,7 +5570,7 @@ var LWC = (function (exports) {
|
|
|
5250
5570
|
next = iterator.next();
|
|
5251
5571
|
last = next.done; // template factory logic based on the previous collected value
|
|
5252
5572
|
|
|
5253
|
-
const vnode = factory(value, j, j === 0, last);
|
|
5573
|
+
const vnode = factory(value, j, j === 0, last === true);
|
|
5254
5574
|
|
|
5255
5575
|
if (isArray$1(vnode)) {
|
|
5256
5576
|
ArrayPush$1.apply(list, vnode);
|
|
@@ -5354,7 +5674,7 @@ var LWC = (function (exports) {
|
|
|
5354
5674
|
|
|
5355
5675
|
|
|
5356
5676
|
function d(value) {
|
|
5357
|
-
return value == null ? '' : value;
|
|
5677
|
+
return value == null ? '' : String(value);
|
|
5358
5678
|
} // [b]ind function
|
|
5359
5679
|
|
|
5360
5680
|
|
|
@@ -5516,6 +5836,26 @@ var LWC = (function (exports) {
|
|
|
5516
5836
|
|
|
5517
5837
|
markAsDynamicChildren(vnodes);
|
|
5518
5838
|
return vnodes;
|
|
5839
|
+
}
|
|
5840
|
+
/**
|
|
5841
|
+
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
|
5842
|
+
* libraries to sanitize HTML content. This hook process the content passed via the template to
|
|
5843
|
+
* lwc:inner-html directive.
|
|
5844
|
+
* It is meant to be overridden with setSanitizeHtmlContentHook, it throws an error by default.
|
|
5845
|
+
*/
|
|
5846
|
+
|
|
5847
|
+
|
|
5848
|
+
let sanitizeHtmlContentHook = () => {
|
|
5849
|
+
// locker-service patches this function during runtime to sanitize HTML content.
|
|
5850
|
+
throw new Error('sanitizeHtmlContent hook must be implemented.');
|
|
5851
|
+
};
|
|
5852
|
+
/**
|
|
5853
|
+
* Sets the sanitizeHtmlContentHook.
|
|
5854
|
+
*/
|
|
5855
|
+
|
|
5856
|
+
|
|
5857
|
+
function setSanitizeHtmlContentHook(newHookImpl) {
|
|
5858
|
+
sanitizeHtmlContentHook = newHookImpl;
|
|
5519
5859
|
} // [s]anitize [h]tml [c]ontent
|
|
5520
5860
|
|
|
5521
5861
|
|
|
@@ -5523,24 +5863,22 @@ var LWC = (function (exports) {
|
|
|
5523
5863
|
return sanitizeHtmlContentHook(content);
|
|
5524
5864
|
}
|
|
5525
5865
|
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
h
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
gid
|
|
5540
|
-
fid
|
|
5541
|
-
|
|
5542
|
-
sc: sc,
|
|
5543
|
-
shc: shc
|
|
5866
|
+
const api = freeze({
|
|
5867
|
+
s,
|
|
5868
|
+
h,
|
|
5869
|
+
c,
|
|
5870
|
+
i,
|
|
5871
|
+
f,
|
|
5872
|
+
t,
|
|
5873
|
+
d,
|
|
5874
|
+
b,
|
|
5875
|
+
k,
|
|
5876
|
+
co,
|
|
5877
|
+
dc,
|
|
5878
|
+
ti,
|
|
5879
|
+
gid,
|
|
5880
|
+
fid,
|
|
5881
|
+
shc
|
|
5544
5882
|
});
|
|
5545
5883
|
/*
|
|
5546
5884
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5554,12 +5892,12 @@ var LWC = (function (exports) {
|
|
|
5554
5892
|
}
|
|
5555
5893
|
|
|
5556
5894
|
function createInlineStyleVNode(content) {
|
|
5557
|
-
return h('style', {
|
|
5895
|
+
return api.h('style', {
|
|
5558
5896
|
key: 'style',
|
|
5559
5897
|
attrs: {
|
|
5560
5898
|
type: 'text/css'
|
|
5561
5899
|
}
|
|
5562
|
-
}, [t(content)]);
|
|
5900
|
+
}, [api.t(content)]);
|
|
5563
5901
|
}
|
|
5564
5902
|
|
|
5565
5903
|
function updateStylesheetToken(vm, template) {
|
|
@@ -5627,6 +5965,7 @@ var LWC = (function (exports) {
|
|
|
5627
5965
|
|
|
5628
5966
|
function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
5629
5967
|
const content = [];
|
|
5968
|
+
let root;
|
|
5630
5969
|
|
|
5631
5970
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
5632
5971
|
let stylesheet = stylesheets[i];
|
|
@@ -5639,23 +5978,46 @@ var LWC = (function (exports) {
|
|
|
5639
5978
|
// the component instance might be attempting to use an old version of
|
|
5640
5979
|
// the stylesheet, while internally, we have a replacement for it.
|
|
5641
5980
|
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
5642
|
-
}
|
|
5643
|
-
|
|
5981
|
+
}
|
|
5982
|
+
|
|
5983
|
+
const isScopedCss = stylesheet[KEY__SCOPED_CSS]; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
|
|
5644
5984
|
|
|
5985
|
+
const scopeToken = isScopedCss || vm.shadowMode === 1
|
|
5986
|
+
/* Synthetic */
|
|
5987
|
+
&& vm.renderMode === 1
|
|
5988
|
+
/* Shadow */
|
|
5989
|
+
? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
|
|
5990
|
+
// native shadow DOM. Synthetic shadow DOM never uses `:host`.
|
|
5645
5991
|
|
|
5646
|
-
const isScopedCss = stylesheet[KEY__SCOPED_CSS];
|
|
5647
5992
|
const useActualHostSelector = vm.renderMode === 0
|
|
5648
5993
|
/* Light */
|
|
5649
5994
|
? !isScopedCss : vm.shadowMode === 0
|
|
5650
5995
|
/* Native */
|
|
5651
|
-
; //
|
|
5996
|
+
; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
|
|
5997
|
+
// we use an attribute selector on the host to simulate :dir().
|
|
5652
5998
|
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5999
|
+
let useNativeDirPseudoclass;
|
|
6000
|
+
|
|
6001
|
+
if (vm.renderMode === 1
|
|
5656
6002
|
/* Shadow */
|
|
5657
|
-
|
|
5658
|
-
|
|
6003
|
+
) {
|
|
6004
|
+
useNativeDirPseudoclass = vm.shadowMode === 0
|
|
6005
|
+
/* Native */
|
|
6006
|
+
;
|
|
6007
|
+
} else {
|
|
6008
|
+
// Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
|
|
6009
|
+
// At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
|
|
6010
|
+
if (isUndefined$1(root)) {
|
|
6011
|
+
// Only calculate the root once as necessary
|
|
6012
|
+
root = getNearestShadowComponent(vm);
|
|
6013
|
+
}
|
|
6014
|
+
|
|
6015
|
+
useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
|
|
6016
|
+
/* Native */
|
|
6017
|
+
;
|
|
6018
|
+
}
|
|
6019
|
+
|
|
6020
|
+
ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
|
|
5659
6021
|
}
|
|
5660
6022
|
}
|
|
5661
6023
|
|
|
@@ -5679,14 +6041,12 @@ var LWC = (function (exports) {
|
|
|
5679
6041
|
// https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
|
|
5680
6042
|
|
|
5681
6043
|
|
|
5682
|
-
function
|
|
6044
|
+
function getNearestShadowComponent(vm) {
|
|
5683
6045
|
let owner = vm;
|
|
5684
6046
|
|
|
5685
6047
|
while (!isNull(owner)) {
|
|
5686
6048
|
if (owner.renderMode === 1
|
|
5687
6049
|
/* Shadow */
|
|
5688
|
-
&& owner.shadowMode === 0
|
|
5689
|
-
/* Native */
|
|
5690
6050
|
) {
|
|
5691
6051
|
return owner;
|
|
5692
6052
|
}
|
|
@@ -5697,6 +6057,20 @@ var LWC = (function (exports) {
|
|
|
5697
6057
|
return owner;
|
|
5698
6058
|
}
|
|
5699
6059
|
|
|
6060
|
+
function getNearestNativeShadowComponent(vm) {
|
|
6061
|
+
const owner = getNearestShadowComponent(vm);
|
|
6062
|
+
|
|
6063
|
+
if (!isNull(owner) && owner.shadowMode === 1
|
|
6064
|
+
/* Synthetic */
|
|
6065
|
+
) {
|
|
6066
|
+
// Synthetic-within-native is impossible. So if the nearest shadow component is
|
|
6067
|
+
// synthetic, we know we won't find a native component if we go any further.
|
|
6068
|
+
return null;
|
|
6069
|
+
}
|
|
6070
|
+
|
|
6071
|
+
return owner;
|
|
6072
|
+
}
|
|
6073
|
+
|
|
5700
6074
|
function createStylesheet(vm, stylesheets) {
|
|
5701
6075
|
const {
|
|
5702
6076
|
renderer,
|
|
@@ -5712,7 +6086,10 @@ var LWC = (function (exports) {
|
|
|
5712
6086
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
5713
6087
|
renderer.insertGlobalStylesheet(stylesheets[i]);
|
|
5714
6088
|
}
|
|
5715
|
-
} else if (renderer.ssr) {
|
|
6089
|
+
} else if (renderer.ssr || renderer.isHydrating()) {
|
|
6090
|
+
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
6091
|
+
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
6092
|
+
// the first time the VM renders.
|
|
5716
6093
|
// native shadow or light DOM, SSR
|
|
5717
6094
|
const combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
|
|
5718
6095
|
return createInlineStyleVNode(combinedStylesheetContent);
|
|
@@ -6337,6 +6714,12 @@ var LWC = (function (exports) {
|
|
|
6337
6714
|
, vm);
|
|
6338
6715
|
}
|
|
6339
6716
|
|
|
6717
|
+
function hydrateRootElement(elm) {
|
|
6718
|
+
const vm = getAssociatedVM(elm);
|
|
6719
|
+
runConnectedCallback(vm);
|
|
6720
|
+
hydrateVM(vm);
|
|
6721
|
+
}
|
|
6722
|
+
|
|
6340
6723
|
function disconnectRootElement(elm) {
|
|
6341
6724
|
const vm = getAssociatedVM(elm);
|
|
6342
6725
|
resetComponentStateWhenRemoved(vm);
|
|
@@ -6344,6 +6727,10 @@ var LWC = (function (exports) {
|
|
|
6344
6727
|
|
|
6345
6728
|
function appendVM(vm) {
|
|
6346
6729
|
rehydrate(vm);
|
|
6730
|
+
}
|
|
6731
|
+
|
|
6732
|
+
function hydrateVM(vm) {
|
|
6733
|
+
hydrate(vm);
|
|
6347
6734
|
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
6348
6735
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
6349
6736
|
|
|
@@ -6577,6 +6964,22 @@ var LWC = (function (exports) {
|
|
|
6577
6964
|
}
|
|
6578
6965
|
}
|
|
6579
6966
|
|
|
6967
|
+
function hydrate(vm) {
|
|
6968
|
+
if (isTrue(vm.isDirty)) {
|
|
6969
|
+
// manually diffing/patching here.
|
|
6970
|
+
// This routine is:
|
|
6971
|
+
// patchShadowRoot(vm, children);
|
|
6972
|
+
// -> addVnodes.
|
|
6973
|
+
const children = renderComponent(vm);
|
|
6974
|
+
vm.children = children;
|
|
6975
|
+
const vmChildren = vm.renderMode === 0
|
|
6976
|
+
/* Light */
|
|
6977
|
+
? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;
|
|
6978
|
+
hydrateChildrenHook(vmChildren, children, vm);
|
|
6979
|
+
runRenderedCallback(vm);
|
|
6980
|
+
}
|
|
6981
|
+
}
|
|
6982
|
+
|
|
6580
6983
|
function patchShadowRoot(vm, newCh) {
|
|
6581
6984
|
const {
|
|
6582
6985
|
children: oldCh
|
|
@@ -7403,28 +7806,12 @@ var LWC = (function (exports) {
|
|
|
7403
7806
|
|
|
7404
7807
|
let hooksAreSet = false;
|
|
7405
7808
|
|
|
7406
|
-
function overrideHooks(hooks) {
|
|
7407
|
-
const oldHooks = {};
|
|
7408
|
-
|
|
7409
|
-
if (!isUndefined$1(hooks.sanitizeHtmlContent)) {
|
|
7410
|
-
oldHooks.sanitizeHtmlContent = setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
7411
|
-
}
|
|
7412
|
-
|
|
7413
|
-
return oldHooks;
|
|
7414
|
-
}
|
|
7415
|
-
|
|
7416
7809
|
function setHooks(hooks) {
|
|
7417
7810
|
assert.isFalse(hooksAreSet, 'Hooks are already overridden, only one definition is allowed.');
|
|
7418
|
-
overrideHooks(hooks);
|
|
7419
7811
|
hooksAreSet = true;
|
|
7812
|
+
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
7420
7813
|
}
|
|
7421
|
-
|
|
7422
|
-
function setHooksForTest(hooks) {
|
|
7423
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
7424
|
-
return overrideHooks(hooks);
|
|
7425
|
-
}
|
|
7426
|
-
}
|
|
7427
|
-
/* version: 2.5.5-canary1 */
|
|
7814
|
+
/* version: 2.5.9 */
|
|
7428
7815
|
|
|
7429
7816
|
/*
|
|
7430
7817
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7568,8 +7955,19 @@ var LWC = (function (exports) {
|
|
|
7568
7955
|
HTMLElementConstructor.prototype = HTMLElement.prototype;
|
|
7569
7956
|
}
|
|
7570
7957
|
|
|
7958
|
+
let isHydrating = false;
|
|
7959
|
+
|
|
7960
|
+
function setIsHydrating(v) {
|
|
7961
|
+
isHydrating = v;
|
|
7962
|
+
}
|
|
7963
|
+
|
|
7571
7964
|
const renderer = {
|
|
7572
7965
|
ssr: false,
|
|
7966
|
+
|
|
7967
|
+
isHydrating() {
|
|
7968
|
+
return isHydrating;
|
|
7969
|
+
},
|
|
7970
|
+
|
|
7573
7971
|
isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
|
|
7574
7972
|
isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
|
|
7575
7973
|
|
|
@@ -7598,6 +7996,10 @@ var LWC = (function (exports) {
|
|
|
7598
7996
|
},
|
|
7599
7997
|
|
|
7600
7998
|
attachShadow(element, options) {
|
|
7999
|
+
if (isHydrating) {
|
|
8000
|
+
return element.shadowRoot;
|
|
8001
|
+
}
|
|
8002
|
+
|
|
7601
8003
|
return element.attachShadow(options);
|
|
7602
8004
|
},
|
|
7603
8005
|
|
|
@@ -7735,61 +8137,6 @@ var LWC = (function (exports) {
|
|
|
7735
8137
|
getCustomElement,
|
|
7736
8138
|
HTMLElement: HTMLElementConstructor
|
|
7737
8139
|
};
|
|
7738
|
-
/*
|
|
7739
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
7740
|
-
* All rights reserved.
|
|
7741
|
-
* SPDX-License-Identifier: MIT
|
|
7742
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7743
|
-
*/
|
|
7744
|
-
|
|
7745
|
-
/**
|
|
7746
|
-
* This function builds a Web Component class from a LWC constructor so it can be
|
|
7747
|
-
* registered as a new element via customElements.define() at any given time.
|
|
7748
|
-
*
|
|
7749
|
-
* @deprecated since version 1.3.11
|
|
7750
|
-
*
|
|
7751
|
-
* @example
|
|
7752
|
-
* ```
|
|
7753
|
-
* import { buildCustomElementConstructor } from 'lwc';
|
|
7754
|
-
* import Foo from 'ns/foo';
|
|
7755
|
-
* const WC = buildCustomElementConstructor(Foo);
|
|
7756
|
-
* customElements.define('x-foo', WC);
|
|
7757
|
-
* const elm = document.createElement('x-foo');
|
|
7758
|
-
* ```
|
|
7759
|
-
*/
|
|
7760
|
-
|
|
7761
|
-
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
7762
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
7763
|
-
/* eslint-disable-next-line no-console */
|
|
7764
|
-
console.warn('Deprecated function called: "buildCustomElementConstructor" function is deprecated and it will be removed.' + `Use "${Ctor.name}.CustomElementConstructor" static property of the component constructor to access the corresponding custom element constructor instead.`);
|
|
7765
|
-
}
|
|
7766
|
-
|
|
7767
|
-
return Ctor.CustomElementConstructor;
|
|
7768
|
-
}
|
|
7769
|
-
|
|
7770
|
-
function buildCustomElementConstructor(Ctor) {
|
|
7771
|
-
const def = getComponentInternalDef(Ctor);
|
|
7772
|
-
return class extends def.bridge {
|
|
7773
|
-
constructor() {
|
|
7774
|
-
super();
|
|
7775
|
-
createVM(this, def, {
|
|
7776
|
-
mode: 'open',
|
|
7777
|
-
owner: null,
|
|
7778
|
-
tagName: this.tagName,
|
|
7779
|
-
renderer
|
|
7780
|
-
});
|
|
7781
|
-
}
|
|
7782
|
-
|
|
7783
|
-
connectedCallback() {
|
|
7784
|
-
connectRootElement(this);
|
|
7785
|
-
}
|
|
7786
|
-
|
|
7787
|
-
disconnectedCallback() {
|
|
7788
|
-
disconnectRootElement(this);
|
|
7789
|
-
}
|
|
7790
|
-
|
|
7791
|
-
};
|
|
7792
|
-
}
|
|
7793
8140
|
/*
|
|
7794
8141
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
7795
8142
|
* All rights reserved.
|
|
@@ -7799,7 +8146,6 @@ var LWC = (function (exports) {
|
|
|
7799
8146
|
// TODO [#2472]: Remove this workaround when appropriate.
|
|
7800
8147
|
// eslint-disable-next-line lwc-internal/no-global-node
|
|
7801
8148
|
|
|
7802
|
-
|
|
7803
8149
|
const _Node$1 = Node;
|
|
7804
8150
|
const ConnectingSlot = new WeakMap();
|
|
7805
8151
|
const DisconnectingSlot = new WeakMap();
|
|
@@ -7910,6 +8256,118 @@ var LWC = (function (exports) {
|
|
|
7910
8256
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7911
8257
|
*/
|
|
7912
8258
|
|
|
8259
|
+
|
|
8260
|
+
function hydrateComponent(element, Ctor, props = {}) {
|
|
8261
|
+
if (!isFunction$1(Ctor)) {
|
|
8262
|
+
throw new TypeError(`"hydrateComponent" expects a valid component constructor as the second parameter but instead received ${Ctor}.`);
|
|
8263
|
+
}
|
|
8264
|
+
|
|
8265
|
+
if (!isObject(props) || isNull(props)) {
|
|
8266
|
+
throw new TypeError(`"hydrateComponent" expects an object as the third parameter but instead received ${props}.`);
|
|
8267
|
+
}
|
|
8268
|
+
|
|
8269
|
+
const def = getComponentInternalDef(Ctor);
|
|
8270
|
+
|
|
8271
|
+
try {
|
|
8272
|
+
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
8273
|
+
// and uses the same algo to create the stylesheets as in SSR.
|
|
8274
|
+
setIsHydrating(true);
|
|
8275
|
+
createVM(element, def, {
|
|
8276
|
+
mode: 'open',
|
|
8277
|
+
owner: null,
|
|
8278
|
+
renderer,
|
|
8279
|
+
tagName: element.tagName.toLowerCase()
|
|
8280
|
+
});
|
|
8281
|
+
|
|
8282
|
+
for (const [key, value] of Object.entries(props)) {
|
|
8283
|
+
element[key] = value;
|
|
8284
|
+
}
|
|
8285
|
+
|
|
8286
|
+
hydrateRootElement(element); // set it back since now we finished hydration.
|
|
8287
|
+
|
|
8288
|
+
setIsHydrating(false);
|
|
8289
|
+
} catch (e) {
|
|
8290
|
+
// Fallback: In case there's an error while hydrating, let's log the error, and replace the element with
|
|
8291
|
+
// the client generated DOM.
|
|
8292
|
+
|
|
8293
|
+
/* eslint-disable-next-line no-console */
|
|
8294
|
+
console.error('Recovering from error while hydrating: ', e);
|
|
8295
|
+
setIsHydrating(false);
|
|
8296
|
+
const newElem = createElement(element.tagName, {
|
|
8297
|
+
is: Ctor,
|
|
8298
|
+
mode: 'open'
|
|
8299
|
+
});
|
|
8300
|
+
|
|
8301
|
+
for (const [key, value] of Object.entries(props)) {
|
|
8302
|
+
newElem[key] = value;
|
|
8303
|
+
}
|
|
8304
|
+
|
|
8305
|
+
element.parentNode.replaceChild(newElem, element);
|
|
8306
|
+
}
|
|
8307
|
+
}
|
|
8308
|
+
/*
|
|
8309
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
8310
|
+
* All rights reserved.
|
|
8311
|
+
* SPDX-License-Identifier: MIT
|
|
8312
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8313
|
+
*/
|
|
8314
|
+
|
|
8315
|
+
/**
|
|
8316
|
+
* This function builds a Web Component class from a LWC constructor so it can be
|
|
8317
|
+
* registered as a new element via customElements.define() at any given time.
|
|
8318
|
+
*
|
|
8319
|
+
* @deprecated since version 1.3.11
|
|
8320
|
+
*
|
|
8321
|
+
* @example
|
|
8322
|
+
* ```
|
|
8323
|
+
* import { buildCustomElementConstructor } from 'lwc';
|
|
8324
|
+
* import Foo from 'ns/foo';
|
|
8325
|
+
* const WC = buildCustomElementConstructor(Foo);
|
|
8326
|
+
* customElements.define('x-foo', WC);
|
|
8327
|
+
* const elm = document.createElement('x-foo');
|
|
8328
|
+
* ```
|
|
8329
|
+
*/
|
|
8330
|
+
|
|
8331
|
+
|
|
8332
|
+
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
8333
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
8334
|
+
/* eslint-disable-next-line no-console */
|
|
8335
|
+
console.warn('Deprecated function called: "buildCustomElementConstructor" function is deprecated and it will be removed.' + `Use "${Ctor.name}.CustomElementConstructor" static property of the component constructor to access the corresponding custom element constructor instead.`);
|
|
8336
|
+
}
|
|
8337
|
+
|
|
8338
|
+
return Ctor.CustomElementConstructor;
|
|
8339
|
+
}
|
|
8340
|
+
|
|
8341
|
+
function buildCustomElementConstructor(Ctor) {
|
|
8342
|
+
const def = getComponentInternalDef(Ctor);
|
|
8343
|
+
return class extends def.bridge {
|
|
8344
|
+
constructor() {
|
|
8345
|
+
super();
|
|
8346
|
+
createVM(this, def, {
|
|
8347
|
+
mode: 'open',
|
|
8348
|
+
owner: null,
|
|
8349
|
+
tagName: this.tagName,
|
|
8350
|
+
renderer
|
|
8351
|
+
});
|
|
8352
|
+
}
|
|
8353
|
+
|
|
8354
|
+
connectedCallback() {
|
|
8355
|
+
connectRootElement(this);
|
|
8356
|
+
}
|
|
8357
|
+
|
|
8358
|
+
disconnectedCallback() {
|
|
8359
|
+
disconnectRootElement(this);
|
|
8360
|
+
}
|
|
8361
|
+
|
|
8362
|
+
};
|
|
8363
|
+
}
|
|
8364
|
+
/*
|
|
8365
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
8366
|
+
* All rights reserved.
|
|
8367
|
+
* SPDX-License-Identifier: MIT
|
|
8368
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8369
|
+
*/
|
|
8370
|
+
|
|
7913
8371
|
/**
|
|
7914
8372
|
* EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
|
|
7915
8373
|
* This API is subject to change or being removed.
|
|
@@ -8009,7 +8467,7 @@ var LWC = (function (exports) {
|
|
|
8009
8467
|
});
|
|
8010
8468
|
freeze(LightningElement);
|
|
8011
8469
|
seal(LightningElement.prototype);
|
|
8012
|
-
/* version: 2.5.
|
|
8470
|
+
/* version: 2.5.9 */
|
|
8013
8471
|
|
|
8014
8472
|
exports.LightningElement = LightningElement;
|
|
8015
8473
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
@@ -8019,6 +8477,7 @@ var LWC = (function (exports) {
|
|
|
8019
8477
|
exports.createElement = createElement;
|
|
8020
8478
|
exports.getComponentConstructor = getComponentConstructor;
|
|
8021
8479
|
exports.getComponentDef = getComponentDef;
|
|
8480
|
+
exports.hydrateComponent = hydrateComponent;
|
|
8022
8481
|
exports.isComponentConstructor = isComponentConstructor;
|
|
8023
8482
|
exports.isNodeFromTemplate = isNodeFromTemplate;
|
|
8024
8483
|
exports.readonly = readonly;
|
|
@@ -8030,7 +8489,6 @@ var LWC = (function (exports) {
|
|
|
8030
8489
|
exports.setFeatureFlag = setFeatureFlag;
|
|
8031
8490
|
exports.setFeatureFlagForTest = setFeatureFlagForTest;
|
|
8032
8491
|
exports.setHooks = setHooks;
|
|
8033
|
-
exports.setHooksForTest = setHooksForTest;
|
|
8034
8492
|
exports.swapComponent = swapComponent;
|
|
8035
8493
|
exports.swapStyle = swapStyle;
|
|
8036
8494
|
exports.swapTemplate = swapTemplate;
|
|
@@ -8042,4 +8500,4 @@ var LWC = (function (exports) {
|
|
|
8042
8500
|
|
|
8043
8501
|
return exports;
|
|
8044
8502
|
|
|
8045
|
-
}({})
|
|
8503
|
+
})({});
|