lwc 2.21.1 → 2.23.1
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 +222 -199
- package/dist/engine-dom/iife/es2017/engine-dom.js +222 -199
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +211 -188
- package/dist/engine-dom/iife/es5/engine-dom.js +263 -216
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +239 -192
- package/dist/engine-dom/umd/es2017/engine-dom.js +222 -199
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +211 -188
- package/dist/engine-dom/umd/es5/engine-dom.js +263 -216
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +239 -192
- package/dist/engine-server/commonjs/es2017/engine-server.js +116 -403
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +116 -403
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +30 -27
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +30 -27
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +29 -26
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +32 -31
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +31 -30
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +30 -27
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +29 -26
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +32 -31
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +31 -30
- 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 +7 -7
|
@@ -299,9 +299,13 @@ function htmlPropertyToAttribute(propName) {
|
|
|
299
299
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
300
300
|
*/
|
|
301
301
|
// Increment whenever the LWC template compiler changes
|
|
302
|
-
const LWC_VERSION = "2.
|
|
302
|
+
const LWC_VERSION = "2.23.1";
|
|
303
303
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
304
|
-
/** version: 2.
|
|
304
|
+
/** version: 2.23.1 */
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Copyright (C) 2018 salesforce.com, inc.
|
|
308
|
+
*/
|
|
305
309
|
|
|
306
310
|
/*
|
|
307
311
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -310,7 +314,7 @@ const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
|
310
314
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
311
315
|
*/
|
|
312
316
|
function detect(propName) {
|
|
313
|
-
return
|
|
317
|
+
return getOwnPropertyDescriptor$1(Element.prototype, propName) === undefined;
|
|
314
318
|
}
|
|
315
319
|
|
|
316
320
|
/*
|
|
@@ -379,6 +383,7 @@ for (let i = 0, len = ElementPrototypeAriaPropertyNames.length; i < len; i += 1)
|
|
|
379
383
|
patch$1(propName);
|
|
380
384
|
}
|
|
381
385
|
}
|
|
386
|
+
/** version: 2.23.1 */
|
|
382
387
|
|
|
383
388
|
/**
|
|
384
389
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -406,7 +411,7 @@ const features = {
|
|
|
406
411
|
if (!_globalThis.lwcRuntimeFlags) {
|
|
407
412
|
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
|
|
408
413
|
}
|
|
409
|
-
const
|
|
414
|
+
const lwcRuntimeFlags = _globalThis.lwcRuntimeFlags;
|
|
410
415
|
/**
|
|
411
416
|
* Set the value at runtime of a given feature flag. This method only be invoked once per feature
|
|
412
417
|
* flag. It is meant to be used during the app initialization.
|
|
@@ -433,17 +438,17 @@ function setFeatureFlag(name, value) {
|
|
|
433
438
|
}
|
|
434
439
|
if (process.env.NODE_ENV !== 'production') {
|
|
435
440
|
// Allow the same flag to be set more than once outside of production to enable testing
|
|
436
|
-
|
|
441
|
+
lwcRuntimeFlags[name] = value;
|
|
437
442
|
}
|
|
438
443
|
else {
|
|
439
444
|
// Disallow the same flag to be set more than once in production
|
|
440
|
-
const runtimeValue =
|
|
445
|
+
const runtimeValue = lwcRuntimeFlags[name];
|
|
441
446
|
if (!isUndefined$1(runtimeValue)) {
|
|
442
447
|
// eslint-disable-next-line no-console
|
|
443
448
|
console.error(`Failed to set the value "${value}" for the runtime feature flag "${name}". "${name}" has already been set with the value "${runtimeValue}".`);
|
|
444
449
|
return;
|
|
445
450
|
}
|
|
446
|
-
defineProperty(
|
|
451
|
+
defineProperty(lwcRuntimeFlags, name, { value });
|
|
447
452
|
}
|
|
448
453
|
}
|
|
449
454
|
/**
|
|
@@ -455,7 +460,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
455
460
|
setFeatureFlag(name, value);
|
|
456
461
|
}
|
|
457
462
|
}
|
|
458
|
-
/** version: 2.
|
|
463
|
+
/** version: 2.23.1 */
|
|
459
464
|
|
|
460
465
|
/*
|
|
461
466
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -469,7 +474,7 @@ if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
|
469
474
|
window.addEventListener('test-dummy-flag', () => {
|
|
470
475
|
let hasFlag = false;
|
|
471
476
|
|
|
472
|
-
if (
|
|
477
|
+
if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
|
|
473
478
|
hasFlag = true;
|
|
474
479
|
}
|
|
475
480
|
|
|
@@ -496,7 +501,7 @@ if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
|
496
501
|
window.addEventListener('test-dummy-flag', () => {
|
|
497
502
|
let hasFlag = false;
|
|
498
503
|
|
|
499
|
-
if (
|
|
504
|
+
if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
|
|
500
505
|
hasFlag = true;
|
|
501
506
|
}
|
|
502
507
|
|
|
@@ -687,18 +692,21 @@ class ReactiveObserver {
|
|
|
687
692
|
ArrayPush$1.call(this.listeners, reactiveObservers);
|
|
688
693
|
}
|
|
689
694
|
}
|
|
690
|
-
|
|
691
|
-
/*
|
|
692
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
693
|
-
* All rights reserved.
|
|
694
|
-
* SPDX-License-Identifier: MIT
|
|
695
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
696
|
-
*/
|
|
697
695
|
function componentValueMutated(vm, key) {
|
|
698
|
-
|
|
696
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
697
|
+
{
|
|
698
|
+
valueMutated(vm.component, key);
|
|
699
|
+
}
|
|
699
700
|
}
|
|
700
701
|
function componentValueObserved(vm, key) {
|
|
701
|
-
|
|
702
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
703
|
+
{
|
|
704
|
+
valueObserved(vm.component, key);
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
function createReactiveObserver(callback) {
|
|
708
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
709
|
+
return new ReactiveObserver(callback) ;
|
|
702
710
|
}
|
|
703
711
|
|
|
704
712
|
/*
|
|
@@ -1257,6 +1265,14 @@ function patchLightningElementPrototypeWithRestrictions(proto) {
|
|
|
1257
1265
|
defineProperties(proto, getLightningElementPrototypeRestrictionsDescriptors(proto));
|
|
1258
1266
|
}
|
|
1259
1267
|
|
|
1268
|
+
function updateComponentValue(vm, key, newValue) {
|
|
1269
|
+
const { cmpFields } = vm;
|
|
1270
|
+
if (newValue !== cmpFields[key]) {
|
|
1271
|
+
cmpFields[key] = newValue;
|
|
1272
|
+
componentValueMutated(vm, key);
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1260
1276
|
/**
|
|
1261
1277
|
* Copyright (C) 2017 salesforce.com, inc.
|
|
1262
1278
|
*/
|
|
@@ -1820,7 +1836,24 @@ const reactiveMembrane = new ObservableMembrane({
|
|
|
1820
1836
|
* change or being removed.
|
|
1821
1837
|
*/
|
|
1822
1838
|
function unwrap(value) {
|
|
1823
|
-
|
|
1839
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
1840
|
+
return reactiveMembrane.unwrapProxy(value) ;
|
|
1841
|
+
}
|
|
1842
|
+
function getReadOnlyProxy(value) {
|
|
1843
|
+
// We must return a frozen wrapper around the value, so that child components cannot mutate properties passed to
|
|
1844
|
+
// them from their parents. This applies to both the client and server.
|
|
1845
|
+
return reactiveMembrane.getReadOnlyProxy(value);
|
|
1846
|
+
}
|
|
1847
|
+
function getReactiveProxy(value) {
|
|
1848
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
1849
|
+
return reactiveMembrane.getProxy(value) ;
|
|
1850
|
+
}
|
|
1851
|
+
// Making the component instance a live value when using Locker to support expandos.
|
|
1852
|
+
function markLockerLiveObject(obj) {
|
|
1853
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
1854
|
+
{
|
|
1855
|
+
obj[lockerLivePropertyKey] = undefined;
|
|
1856
|
+
}
|
|
1824
1857
|
}
|
|
1825
1858
|
|
|
1826
1859
|
/*
|
|
@@ -1872,10 +1905,7 @@ function createBridgeToElementDescriptor(propName, descriptor) {
|
|
|
1872
1905
|
assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
1873
1906
|
assert.invariant(!isObject(newValue) || isNull(newValue), `Invalid value "${newValue}" for "${propName}" of ${vm}. Value cannot be an object, must be a primitive value.`);
|
|
1874
1907
|
}
|
|
1875
|
-
|
|
1876
|
-
vm.cmpProps[propName] = newValue;
|
|
1877
|
-
componentValueMutated(vm, propName);
|
|
1878
|
-
}
|
|
1908
|
+
updateComponentValue(vm, propName, newValue);
|
|
1879
1909
|
return set.call(vm.elm, newValue);
|
|
1880
1910
|
},
|
|
1881
1911
|
};
|
|
@@ -1910,8 +1940,7 @@ const LightningElement = function () {
|
|
|
1910
1940
|
vm.setHook = setHook;
|
|
1911
1941
|
vm.getHook = getHook;
|
|
1912
1942
|
}
|
|
1913
|
-
|
|
1914
|
-
this[lockerLivePropertyKey] = undefined;
|
|
1943
|
+
markLockerLiveObject(this);
|
|
1915
1944
|
// Linking elm, shadow root and component with the VM.
|
|
1916
1945
|
associateVM(component, vm);
|
|
1917
1946
|
associateVM(elm, vm);
|
|
@@ -2171,15 +2200,51 @@ function createObservedFieldPropertyDescriptor(key) {
|
|
|
2171
2200
|
},
|
|
2172
2201
|
set(newValue) {
|
|
2173
2202
|
const vm = getAssociatedVM(this);
|
|
2174
|
-
|
|
2175
|
-
vm.cmpFields[key] = newValue;
|
|
2176
|
-
componentValueMutated(vm, key);
|
|
2177
|
-
}
|
|
2203
|
+
updateComponentValue(vm, key, newValue);
|
|
2178
2204
|
},
|
|
2179
2205
|
enumerable: true,
|
|
2180
2206
|
configurable: true,
|
|
2181
2207
|
};
|
|
2182
2208
|
}
|
|
2209
|
+
class AccessorReactiveObserver extends ReactiveObserver {
|
|
2210
|
+
constructor(vm, set) {
|
|
2211
|
+
super(() => {
|
|
2212
|
+
if (isFalse(this.debouncing)) {
|
|
2213
|
+
this.debouncing = true;
|
|
2214
|
+
addCallbackToNextTick(() => {
|
|
2215
|
+
if (isTrue(this.debouncing)) {
|
|
2216
|
+
const { value } = this;
|
|
2217
|
+
const { isDirty: dirtyStateBeforeSetterCall, component, idx } = vm;
|
|
2218
|
+
set.call(component, value);
|
|
2219
|
+
// de-bouncing after the call to the original setter to prevent
|
|
2220
|
+
// infinity loop if the setter itself is mutating things that
|
|
2221
|
+
// were accessed during the previous invocation.
|
|
2222
|
+
this.debouncing = false;
|
|
2223
|
+
if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && idx > 0) {
|
|
2224
|
+
// immediate rehydration due to a setter driven mutation, otherwise
|
|
2225
|
+
// the component will get rendered on the second tick, which it is not
|
|
2226
|
+
// desirable.
|
|
2227
|
+
rerenderVM(vm);
|
|
2228
|
+
}
|
|
2229
|
+
}
|
|
2230
|
+
});
|
|
2231
|
+
}
|
|
2232
|
+
});
|
|
2233
|
+
this.debouncing = false;
|
|
2234
|
+
}
|
|
2235
|
+
reset(value) {
|
|
2236
|
+
super.reset();
|
|
2237
|
+
this.debouncing = false;
|
|
2238
|
+
if (arguments.length > 0) {
|
|
2239
|
+
this.value = value;
|
|
2240
|
+
}
|
|
2241
|
+
}
|
|
2242
|
+
}
|
|
2243
|
+
function createAccessorReactiveObserver(vm, set) {
|
|
2244
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
2245
|
+
return new AccessorReactiveObserver(vm, set)
|
|
2246
|
+
;
|
|
2247
|
+
}
|
|
2183
2248
|
|
|
2184
2249
|
/*
|
|
2185
2250
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -2228,50 +2293,6 @@ function createPublicPropertyDescriptor(key) {
|
|
|
2228
2293
|
configurable: true
|
|
2229
2294
|
};
|
|
2230
2295
|
}
|
|
2231
|
-
class AccessorReactiveObserver extends ReactiveObserver {
|
|
2232
|
-
constructor(vm, set) {
|
|
2233
|
-
super(() => {
|
|
2234
|
-
if (isFalse(this.debouncing)) {
|
|
2235
|
-
this.debouncing = true;
|
|
2236
|
-
addCallbackToNextTick(() => {
|
|
2237
|
-
if (isTrue(this.debouncing)) {
|
|
2238
|
-
const {
|
|
2239
|
-
value
|
|
2240
|
-
} = this;
|
|
2241
|
-
const {
|
|
2242
|
-
isDirty: dirtyStateBeforeSetterCall,
|
|
2243
|
-
component,
|
|
2244
|
-
idx
|
|
2245
|
-
} = vm;
|
|
2246
|
-
set.call(component, value); // de-bouncing after the call to the original setter to prevent
|
|
2247
|
-
// infinity loop if the setter itself is mutating things that
|
|
2248
|
-
// were accessed during the previous invocation.
|
|
2249
|
-
|
|
2250
|
-
this.debouncing = false;
|
|
2251
|
-
|
|
2252
|
-
if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && idx > 0) {
|
|
2253
|
-
// immediate rehydration due to a setter driven mutation, otherwise
|
|
2254
|
-
// the component will get rendered on the second tick, which it is not
|
|
2255
|
-
// desirable.
|
|
2256
|
-
rerenderVM(vm);
|
|
2257
|
-
}
|
|
2258
|
-
}
|
|
2259
|
-
});
|
|
2260
|
-
}
|
|
2261
|
-
});
|
|
2262
|
-
this.debouncing = false;
|
|
2263
|
-
}
|
|
2264
|
-
|
|
2265
|
-
reset(value) {
|
|
2266
|
-
super.reset();
|
|
2267
|
-
this.debouncing = false;
|
|
2268
|
-
|
|
2269
|
-
if (arguments.length > 0) {
|
|
2270
|
-
this.value = value;
|
|
2271
|
-
}
|
|
2272
|
-
}
|
|
2273
|
-
|
|
2274
|
-
}
|
|
2275
2296
|
function createPublicAccessorDescriptor(key, descriptor) {
|
|
2276
2297
|
const {
|
|
2277
2298
|
get,
|
|
@@ -2308,11 +2329,11 @@ function createPublicAccessorDescriptor(key, descriptor) {
|
|
|
2308
2329
|
}
|
|
2309
2330
|
|
|
2310
2331
|
if (set) {
|
|
2311
|
-
if (
|
|
2332
|
+
if (lwcRuntimeFlags.ENABLE_REACTIVE_SETTER) {
|
|
2312
2333
|
let ro = vm.oar[key];
|
|
2313
2334
|
|
|
2314
2335
|
if (isUndefined$1(ro)) {
|
|
2315
|
-
ro = vm.oar[key] =
|
|
2336
|
+
ro = vm.oar[key] = createAccessorReactiveObserver(vm, set);
|
|
2316
2337
|
} // every time we invoke this setter from outside (through this wrapper setter)
|
|
2317
2338
|
// we should reset the value and then debounce just in case there is a pending
|
|
2318
2339
|
// invocation the next tick that is not longer relevant since the value is changing
|
|
@@ -2344,7 +2365,7 @@ function createPublicAccessorDescriptor(key, descriptor) {
|
|
|
2344
2365
|
*/
|
|
2345
2366
|
function track(target) {
|
|
2346
2367
|
if (arguments.length === 1) {
|
|
2347
|
-
return
|
|
2368
|
+
return getReactiveProxy(target);
|
|
2348
2369
|
}
|
|
2349
2370
|
if (process.env.NODE_ENV !== 'production') {
|
|
2350
2371
|
assert.fail(`@track decorator can only be used with one argument to return a trackable object, or as a decorator function.`);
|
|
@@ -2365,11 +2386,8 @@ function internalTrackDecorator(key) {
|
|
|
2365
2386
|
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2366
2387
|
assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2367
2388
|
}
|
|
2368
|
-
const reactiveOrAnyValue =
|
|
2369
|
-
|
|
2370
|
-
vm.cmpFields[key] = reactiveOrAnyValue;
|
|
2371
|
-
componentValueMutated(vm, key);
|
|
2372
|
-
}
|
|
2389
|
+
const reactiveOrAnyValue = getReactiveProxy(newValue);
|
|
2390
|
+
updateComponentValue(vm, key, reactiveOrAnyValue);
|
|
2373
2391
|
},
|
|
2374
2392
|
enumerable: true,
|
|
2375
2393
|
configurable: true,
|
|
@@ -2408,10 +2426,7 @@ function internalWireFieldDecorator(key) {
|
|
|
2408
2426
|
* letting the author to do the wrong thing, but it will keep our
|
|
2409
2427
|
* system to be backward compatible.
|
|
2410
2428
|
*/
|
|
2411
|
-
|
|
2412
|
-
vm.cmpFields[key] = value;
|
|
2413
|
-
componentValueMutated(vm, key);
|
|
2414
|
-
}
|
|
2429
|
+
updateComponentValue(vm, key, value);
|
|
2415
2430
|
},
|
|
2416
2431
|
enumerable: true,
|
|
2417
2432
|
configurable: true,
|
|
@@ -2757,7 +2772,7 @@ function createSetter(key) {
|
|
|
2757
2772
|
fn = cachedSetterByKey[key] = function (newValue) {
|
|
2758
2773
|
const vm = getAssociatedVM(this);
|
|
2759
2774
|
const { setHook } = vm;
|
|
2760
|
-
newValue =
|
|
2775
|
+
newValue = getReadOnlyProxy(newValue);
|
|
2761
2776
|
setHook(vm.component, key, newValue);
|
|
2762
2777
|
};
|
|
2763
2778
|
}
|
|
@@ -2966,7 +2981,7 @@ function getTemplateOrSwappedTemplate(tpl) {
|
|
|
2966
2981
|
throw new ReferenceError();
|
|
2967
2982
|
}
|
|
2968
2983
|
|
|
2969
|
-
if (
|
|
2984
|
+
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2970
2985
|
const visited = new Set();
|
|
2971
2986
|
|
|
2972
2987
|
while (swappedTemplateMap.has(tpl) && !visited.has(tpl)) {
|
|
@@ -2983,7 +2998,7 @@ function getComponentOrSwappedComponent(Ctor) {
|
|
|
2983
2998
|
throw new ReferenceError();
|
|
2984
2999
|
}
|
|
2985
3000
|
|
|
2986
|
-
if (
|
|
3001
|
+
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2987
3002
|
const visited = new Set();
|
|
2988
3003
|
|
|
2989
3004
|
while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {
|
|
@@ -3000,7 +3015,7 @@ function getStyleOrSwappedStyle(style) {
|
|
|
3000
3015
|
throw new ReferenceError();
|
|
3001
3016
|
}
|
|
3002
3017
|
|
|
3003
|
-
if (
|
|
3018
|
+
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
3004
3019
|
const visited = new Set();
|
|
3005
3020
|
|
|
3006
3021
|
while (swappedStyleMap.has(style) && !visited.has(style)) {
|
|
@@ -3017,7 +3032,7 @@ function setActiveVM(vm) {
|
|
|
3017
3032
|
throw new ReferenceError();
|
|
3018
3033
|
}
|
|
3019
3034
|
|
|
3020
|
-
if (
|
|
3035
|
+
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
3021
3036
|
// tracking active component
|
|
3022
3037
|
const Ctor = vm.def.ctor;
|
|
3023
3038
|
let componentVMs = activeComponents.get(Ctor);
|
|
@@ -3074,7 +3089,7 @@ function removeActiveVM(vm) {
|
|
|
3074
3089
|
throw new ReferenceError();
|
|
3075
3090
|
}
|
|
3076
3091
|
|
|
3077
|
-
if (
|
|
3092
|
+
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
3078
3093
|
// tracking inactive component
|
|
3079
3094
|
const Ctor = vm.def.ctor;
|
|
3080
3095
|
let list = activeComponents.get(Ctor);
|
|
@@ -3121,7 +3136,7 @@ function swapTemplate(oldTpl, newTpl) {
|
|
|
3121
3136
|
}
|
|
3122
3137
|
}
|
|
3123
3138
|
|
|
3124
|
-
if (!
|
|
3139
|
+
if (!lwcRuntimeFlags.ENABLE_HMR) {
|
|
3125
3140
|
throw new Error('HMR is not enabled');
|
|
3126
3141
|
}
|
|
3127
3142
|
|
|
@@ -3137,7 +3152,7 @@ function swapComponent(oldComponent, newComponent) {
|
|
|
3137
3152
|
}
|
|
3138
3153
|
}
|
|
3139
3154
|
|
|
3140
|
-
if (!
|
|
3155
|
+
if (!lwcRuntimeFlags.ENABLE_HMR) {
|
|
3141
3156
|
throw new Error('HMR is not enabled');
|
|
3142
3157
|
}
|
|
3143
3158
|
|
|
@@ -3151,7 +3166,7 @@ function swapStyle(oldStyle, newStyle) {
|
|
|
3151
3166
|
return rehydrateHotStyle(oldStyle);
|
|
3152
3167
|
}
|
|
3153
3168
|
|
|
3154
|
-
if (!
|
|
3169
|
+
if (!lwcRuntimeFlags.ENABLE_HMR) {
|
|
3155
3170
|
throw new Error('HMR is not enabled');
|
|
3156
3171
|
}
|
|
3157
3172
|
|
|
@@ -3500,13 +3515,13 @@ function getNearestNativeShadowComponent(vm) {
|
|
|
3500
3515
|
return owner;
|
|
3501
3516
|
}
|
|
3502
3517
|
function createStylesheet(vm, stylesheets) {
|
|
3503
|
-
const { renderMode, shadowMode, renderer: {
|
|
3518
|
+
const { renderMode, shadowMode, renderer: { insertStylesheet }, } = vm;
|
|
3504
3519
|
if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
3505
3520
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
3506
3521
|
insertStylesheet(stylesheets[i]);
|
|
3507
3522
|
}
|
|
3508
3523
|
}
|
|
3509
|
-
else if (
|
|
3524
|
+
else if (vm.hydrated) {
|
|
3510
3525
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
3511
3526
|
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
3512
3527
|
// the first time the VM renders.
|
|
@@ -3807,7 +3822,7 @@ function patchChildren(c1, c2, parent, renderer) {
|
|
|
3807
3822
|
updateStaticChildren(c1, c2, parent, renderer);
|
|
3808
3823
|
}
|
|
3809
3824
|
}
|
|
3810
|
-
function patch(n1, n2, renderer) {
|
|
3825
|
+
function patch(n1, n2, parent, renderer) {
|
|
3811
3826
|
var _a, _b;
|
|
3812
3827
|
if (n1 === n2) {
|
|
3813
3828
|
return;
|
|
@@ -3836,7 +3851,7 @@ function patch(n1, n2, renderer) {
|
|
|
3836
3851
|
patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3837
3852
|
break;
|
|
3838
3853
|
case 3 /* VNodeType.CustomElement */:
|
|
3839
|
-
patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3854
|
+
patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3840
3855
|
break;
|
|
3841
3856
|
}
|
|
3842
3857
|
}
|
|
@@ -3963,22 +3978,32 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
|
3963
3978
|
appendVM(vm);
|
|
3964
3979
|
}
|
|
3965
3980
|
}
|
|
3966
|
-
function patchCustomElement(n1, n2, renderer) {
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
allocateChildren(n2, vm);
|
|
3981
|
+
function patchCustomElement(n1, n2, parent, renderer) {
|
|
3982
|
+
if (n1.ctor !== n2.ctor) {
|
|
3983
|
+
// If the constructor, unmount the current component and mount a new one using the new
|
|
3984
|
+
// constructor.
|
|
3985
|
+
const anchor = renderer.nextSibling(n1.elm);
|
|
3986
|
+
unmount(n1, parent, renderer, true);
|
|
3987
|
+
mountCustomElement(n2, parent, anchor, renderer);
|
|
3974
3988
|
}
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3989
|
+
else {
|
|
3990
|
+
// Otherwise patch the existing component with new props/attrs/etc.
|
|
3991
|
+
const elm = (n2.elm = n1.elm);
|
|
3992
|
+
const vm = (n2.vm = n1.vm);
|
|
3993
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3994
|
+
if (!isUndefined$1(vm)) {
|
|
3995
|
+
// in fallback mode, the allocation will always set children to
|
|
3996
|
+
// empty and delegate the real allocation to the slot elements
|
|
3997
|
+
allocateChildren(n2, vm);
|
|
3998
|
+
}
|
|
3999
|
+
// in fallback mode, the children will be always empty, so, nothing
|
|
4000
|
+
// will happen, but in native, it does allocate the light dom
|
|
4001
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
4002
|
+
if (!isUndefined$1(vm)) {
|
|
4003
|
+
// this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
4004
|
+
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
4005
|
+
rerenderVM(vm);
|
|
4006
|
+
}
|
|
3982
4007
|
}
|
|
3983
4008
|
}
|
|
3984
4009
|
function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
|
|
@@ -4248,25 +4273,25 @@ function updateDynamicChildren(oldCh, newCh, parent, renderer) {
|
|
|
4248
4273
|
newEndVnode = newCh[--newEndIdx];
|
|
4249
4274
|
}
|
|
4250
4275
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
4251
|
-
patch(oldStartVnode, newStartVnode, renderer);
|
|
4276
|
+
patch(oldStartVnode, newStartVnode, parent, renderer);
|
|
4252
4277
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
4253
4278
|
newStartVnode = newCh[++newStartIdx];
|
|
4254
4279
|
}
|
|
4255
4280
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
4256
|
-
patch(oldEndVnode, newEndVnode, renderer);
|
|
4281
|
+
patch(oldEndVnode, newEndVnode, parent, renderer);
|
|
4257
4282
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
4258
4283
|
newEndVnode = newCh[--newEndIdx];
|
|
4259
4284
|
}
|
|
4260
4285
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
4261
4286
|
// Vnode moved right
|
|
4262
|
-
patch(oldStartVnode, newEndVnode, renderer);
|
|
4287
|
+
patch(oldStartVnode, newEndVnode, parent, renderer);
|
|
4263
4288
|
insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
|
|
4264
4289
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
4265
4290
|
newEndVnode = newCh[--newEndIdx];
|
|
4266
4291
|
}
|
|
4267
4292
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
4268
4293
|
// Vnode moved left
|
|
4269
|
-
patch(oldEndVnode, newStartVnode, renderer);
|
|
4294
|
+
patch(oldEndVnode, newStartVnode, parent, renderer);
|
|
4270
4295
|
insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
|
|
4271
4296
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
4272
4297
|
newStartVnode = newCh[++newStartIdx];
|
|
@@ -4289,7 +4314,7 @@ function updateDynamicChildren(oldCh, newCh, parent, renderer) {
|
|
|
4289
4314
|
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4290
4315
|
}
|
|
4291
4316
|
else {
|
|
4292
|
-
patch(elmToMove, newStartVnode, renderer);
|
|
4317
|
+
patch(elmToMove, newStartVnode, parent, renderer);
|
|
4293
4318
|
// Delete the old child, but copy the array since it is read-only.
|
|
4294
4319
|
// The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
|
|
4295
4320
|
// so we only care about the `oldCh` object inside this function.
|
|
@@ -4349,7 +4374,7 @@ function updateStaticChildren(c1, c2, parent, renderer) {
|
|
|
4349
4374
|
if (isVNode(n1)) {
|
|
4350
4375
|
if (isVNode(n2)) {
|
|
4351
4376
|
// both vnodes are equivalent, and we just need to patch them
|
|
4352
|
-
patch(n1, n2, renderer);
|
|
4377
|
+
patch(n1, n2, parent, renderer);
|
|
4353
4378
|
anchor = n2.elm;
|
|
4354
4379
|
}
|
|
4355
4380
|
else {
|
|
@@ -4683,13 +4708,6 @@ function fid(url) {
|
|
|
4683
4708
|
}
|
|
4684
4709
|
return url;
|
|
4685
4710
|
}
|
|
4686
|
-
/**
|
|
4687
|
-
* Map to store an index value assigned to any dynamic component reference ingested
|
|
4688
|
-
* by dc() api. This allows us to generate a unique unique per template per dynamic
|
|
4689
|
-
* component reference to avoid diffing algo mismatches.
|
|
4690
|
-
*/
|
|
4691
|
-
const DynamicImportedComponentMap = new Map();
|
|
4692
|
-
let dynamicImportedComponentCounter = 0;
|
|
4693
4711
|
/**
|
|
4694
4712
|
* create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
|
|
4695
4713
|
*/
|
|
@@ -4706,18 +4724,7 @@ function dc(sel, Ctor, data, children = EmptyArray) {
|
|
|
4706
4724
|
if (!isComponentConstructor(Ctor)) {
|
|
4707
4725
|
throw new Error(`Invalid LWC Constructor ${toString$1(Ctor)} for custom element <${sel}>.`);
|
|
4708
4726
|
}
|
|
4709
|
-
|
|
4710
|
-
if (isUndefined$1(idx)) {
|
|
4711
|
-
idx = dynamicImportedComponentCounter++;
|
|
4712
|
-
DynamicImportedComponentMap.set(Ctor, idx);
|
|
4713
|
-
}
|
|
4714
|
-
// the new vnode key is a mix of idx and compiler key, this is required by the diffing algo
|
|
4715
|
-
// to identify different constructors as vnodes with different keys to avoid reusing the
|
|
4716
|
-
// element used for previous constructors.
|
|
4717
|
-
// Shallow clone is necessary here becuase VElementData may be shared across VNodes due to
|
|
4718
|
-
// hoisting optimization.
|
|
4719
|
-
const newData = Object.assign(Object.assign({}, data), { key: `dc:${idx}:${data.key}` });
|
|
4720
|
-
return c(sel, Ctor, newData, children);
|
|
4727
|
+
return c(sel, Ctor, data, children);
|
|
4721
4728
|
}
|
|
4722
4729
|
/**
|
|
4723
4730
|
* slow children collection marking mechanism. this API allows the compiler to signal
|
|
@@ -5193,7 +5200,7 @@ function getComponentRegisteredTemplate(Ctor) {
|
|
|
5193
5200
|
return signedTemplateMap.get(Ctor);
|
|
5194
5201
|
}
|
|
5195
5202
|
function getTemplateReactiveObserver(vm) {
|
|
5196
|
-
return
|
|
5203
|
+
return createReactiveObserver(() => {
|
|
5197
5204
|
const { isDirty } = vm;
|
|
5198
5205
|
if (isFalse(isDirty)) {
|
|
5199
5206
|
markComponentAsDirty(vm);
|
|
@@ -5443,7 +5450,7 @@ function createVM(elm, ctor, renderer, options) {
|
|
|
5443
5450
|
return `[object:vm ${def.name} (${vm.idx})]`;
|
|
5444
5451
|
};
|
|
5445
5452
|
|
|
5446
|
-
if (
|
|
5453
|
+
if (lwcRuntimeFlags.ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST) {
|
|
5447
5454
|
vm.shadowMode = 0
|
|
5448
5455
|
/* ShadowMode.Native */
|
|
5449
5456
|
;
|
|
@@ -5482,7 +5489,7 @@ function computeShadowMode(vm, renderer) {
|
|
|
5482
5489
|
} else if (isNativeShadowDefined) {
|
|
5483
5490
|
// Not combined with above condition because @lwc/features only supports identifiers in
|
|
5484
5491
|
// the if-condition.
|
|
5485
|
-
if (
|
|
5492
|
+
if (lwcRuntimeFlags.ENABLE_MIXED_SHADOW_MODE) {
|
|
5486
5493
|
if (def.shadowSupportMode === "any"
|
|
5487
5494
|
/* ShadowSupportMode.Any */
|
|
5488
5495
|
) {
|
|
@@ -5611,16 +5618,9 @@ function runRenderedCallback(vm) {
|
|
|
5611
5618
|
const {
|
|
5612
5619
|
def: {
|
|
5613
5620
|
renderedCallback
|
|
5614
|
-
},
|
|
5615
|
-
renderer: {
|
|
5616
|
-
ssr
|
|
5617
5621
|
}
|
|
5618
5622
|
} = vm;
|
|
5619
5623
|
|
|
5620
|
-
if (isTrue(ssr)) {
|
|
5621
|
-
return;
|
|
5622
|
-
}
|
|
5623
|
-
|
|
5624
5624
|
const {
|
|
5625
5625
|
rendered
|
|
5626
5626
|
} = Services;
|
|
@@ -5870,13 +5870,7 @@ function resetComponentRoot(vm) {
|
|
|
5870
5870
|
vm.velements = EmptyArray;
|
|
5871
5871
|
}
|
|
5872
5872
|
function scheduleRehydration(vm) {
|
|
5873
|
-
|
|
5874
|
-
renderer: {
|
|
5875
|
-
ssr
|
|
5876
|
-
}
|
|
5877
|
-
} = vm;
|
|
5878
|
-
|
|
5879
|
-
if (isTrue(ssr) || isTrue(vm.isScheduled)) {
|
|
5873
|
+
if (isTrue(vm.isScheduled)) {
|
|
5880
5874
|
return;
|
|
5881
5875
|
}
|
|
5882
5876
|
|
|
@@ -5983,15 +5977,8 @@ class WireContextRegistrationEvent extends CustomEvent {
|
|
|
5983
5977
|
}
|
|
5984
5978
|
|
|
5985
5979
|
function createFieldDataCallback(vm, name) {
|
|
5986
|
-
const {
|
|
5987
|
-
cmpFields
|
|
5988
|
-
} = vm;
|
|
5989
5980
|
return value => {
|
|
5990
|
-
|
|
5991
|
-
// storing the value in the underlying storage
|
|
5992
|
-
cmpFields[name] = value;
|
|
5993
|
-
componentValueMutated(vm, name);
|
|
5994
|
-
}
|
|
5981
|
+
updateComponentValue(vm, name, value);
|
|
5995
5982
|
};
|
|
5996
5983
|
}
|
|
5997
5984
|
|
|
@@ -6008,7 +5995,7 @@ function createMethodDataCallback(vm, method) {
|
|
|
6008
5995
|
function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
|
|
6009
5996
|
let hasPendingConfig = false; // creating the reactive observer for reactive params when needed
|
|
6010
5997
|
|
|
6011
|
-
const ro =
|
|
5998
|
+
const ro = createReactiveObserver(() => {
|
|
6012
5999
|
if (hasPendingConfig === false) {
|
|
6013
6000
|
hasPendingConfig = true; // collect new config in the micro-task
|
|
6014
6001
|
|
|
@@ -6209,7 +6196,7 @@ function installWireAdapters(vm) {
|
|
|
6209
6196
|
ArrayPush$1.call(wiredConnecting, () => {
|
|
6210
6197
|
connector.connect();
|
|
6211
6198
|
|
|
6212
|
-
if (!
|
|
6199
|
+
if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
|
|
6213
6200
|
if (hasDynamicParams) {
|
|
6214
6201
|
Promise.resolve().then(computeConfigAndUpdate);
|
|
6215
6202
|
return;
|
|
@@ -6304,7 +6291,7 @@ function readonly(obj) {
|
|
|
6304
6291
|
assert.fail('@readonly cannot be used as a decorator just yet, use it as a function with one argument to produce a readonly version of the provided value.');
|
|
6305
6292
|
}
|
|
6306
6293
|
}
|
|
6307
|
-
return
|
|
6294
|
+
return getReadOnlyProxy(obj);
|
|
6308
6295
|
}
|
|
6309
6296
|
|
|
6310
6297
|
/*
|
|
@@ -6815,7 +6802,7 @@ function getComponentConstructor(elm) {
|
|
|
6815
6802
|
}
|
|
6816
6803
|
return ctor;
|
|
6817
6804
|
}
|
|
6818
|
-
/* version: 2.
|
|
6805
|
+
/* version: 2.23.1 */
|
|
6819
6806
|
|
|
6820
6807
|
/*
|
|
6821
6808
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6959,6 +6946,69 @@ function insertStylesheet(content, target) {
|
|
|
6959
6946
|
}
|
|
6960
6947
|
}
|
|
6961
6948
|
|
|
6949
|
+
/*
|
|
6950
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6951
|
+
* All rights reserved.
|
|
6952
|
+
* SPDX-License-Identifier: MIT
|
|
6953
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6954
|
+
*/
|
|
6955
|
+
const SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
|
|
6956
|
+
let createFragment;
|
|
6957
|
+
if (SUPPORTS_TEMPLATE) {
|
|
6958
|
+
// Parse the fragment HTML string into DOM
|
|
6959
|
+
createFragment = function (html) {
|
|
6960
|
+
const template = document.createElement('template');
|
|
6961
|
+
template.innerHTML = html;
|
|
6962
|
+
return template.content.firstChild;
|
|
6963
|
+
};
|
|
6964
|
+
}
|
|
6965
|
+
else {
|
|
6966
|
+
// In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
|
|
6967
|
+
// <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
|
|
6968
|
+
// Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
|
|
6969
|
+
// With other elements added from:
|
|
6970
|
+
// https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
|
|
6971
|
+
// Using the test:
|
|
6972
|
+
// document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
|
|
6973
|
+
// And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
|
|
6974
|
+
const topLevelWrappingMap = {
|
|
6975
|
+
caption: ['table'],
|
|
6976
|
+
col: ['colgroup', 'table'],
|
|
6977
|
+
colgroup: ['table'],
|
|
6978
|
+
option: ['select'],
|
|
6979
|
+
tbody: ['table'],
|
|
6980
|
+
td: ['tr', 'tbody', 'table'],
|
|
6981
|
+
th: ['tr', 'tbody', 'table'],
|
|
6982
|
+
thead: ['table'],
|
|
6983
|
+
tfoot: ['table'],
|
|
6984
|
+
tr: ['tbody', 'table'],
|
|
6985
|
+
};
|
|
6986
|
+
// Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
|
|
6987
|
+
const getTagName = function (text) {
|
|
6988
|
+
return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
|
|
6989
|
+
};
|
|
6990
|
+
// Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
|
|
6991
|
+
createFragment = function (html) {
|
|
6992
|
+
const wrapperTags = topLevelWrappingMap[getTagName(html)];
|
|
6993
|
+
if (!isUndefined$1(wrapperTags)) {
|
|
6994
|
+
for (const wrapperTag of wrapperTags) {
|
|
6995
|
+
html = `<${wrapperTag}>${html}</${wrapperTag}>`;
|
|
6996
|
+
}
|
|
6997
|
+
}
|
|
6998
|
+
// For IE11, the document title must not be undefined, but it can be an empty string
|
|
6999
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
|
|
7000
|
+
const doc = document.implementation.createHTMLDocument('');
|
|
7001
|
+
doc.body.innerHTML = html;
|
|
7002
|
+
let content = doc.body;
|
|
7003
|
+
if (!isUndefined$1(wrapperTags)) {
|
|
7004
|
+
for (let i = 0; i < wrapperTags.length; i++) {
|
|
7005
|
+
content = content.firstChild;
|
|
7006
|
+
}
|
|
7007
|
+
}
|
|
7008
|
+
return content.firstChild;
|
|
7009
|
+
};
|
|
7010
|
+
}
|
|
7011
|
+
|
|
6962
7012
|
/*
|
|
6963
7013
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
6964
7014
|
* All rights reserved.
|
|
@@ -7024,22 +7074,11 @@ else {
|
|
|
7024
7074
|
};
|
|
7025
7075
|
HTMLElementConstructor.prototype = HTMLElement.prototype;
|
|
7026
7076
|
}
|
|
7027
|
-
let hydrating = false;
|
|
7028
|
-
function setIsHydrating(value) {
|
|
7029
|
-
hydrating = value;
|
|
7030
|
-
}
|
|
7031
|
-
const ssr = false;
|
|
7032
|
-
function isHydrating() {
|
|
7033
|
-
return hydrating;
|
|
7034
|
-
}
|
|
7035
7077
|
const isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
|
|
7036
7078
|
const isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
|
|
7037
7079
|
function cloneNode(node, deep) {
|
|
7038
7080
|
return node.cloneNode(deep);
|
|
7039
7081
|
}
|
|
7040
|
-
function createFragment(html) {
|
|
7041
|
-
return document.createRange().createContextualFragment(html).firstChild;
|
|
7042
|
-
}
|
|
7043
7082
|
function createElement$1(tagName, namespace) {
|
|
7044
7083
|
return isUndefined$1(namespace)
|
|
7045
7084
|
? document.createElement(tagName)
|
|
@@ -7061,15 +7100,11 @@ function nextSibling(node) {
|
|
|
7061
7100
|
return node.nextSibling;
|
|
7062
7101
|
}
|
|
7063
7102
|
function attachShadow(element, options) {
|
|
7064
|
-
// `
|
|
7103
|
+
// `shadowRoot` will be non-null in two cases:
|
|
7065
7104
|
// 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
|
|
7066
7105
|
// 2. when a webapp author places <c-app> in their static HTML and mounts their
|
|
7067
|
-
// root component with
|
|
7068
|
-
|
|
7069
|
-
// The second case can be treated as a failed hydration with nominal impact
|
|
7070
|
-
// to performance. However, because <c-app> won't have a <template shadowroot>
|
|
7071
|
-
// declarative child, `element.shadowRoot` is `null`.
|
|
7072
|
-
if (hydrating && element.shadowRoot) {
|
|
7106
|
+
// root component with customElement.define('c-app', Ctor)
|
|
7107
|
+
if (!isNull(element.shadowRoot)) {
|
|
7073
7108
|
return element.shadowRoot;
|
|
7074
7109
|
}
|
|
7075
7110
|
return element.attachShadow(options);
|
|
@@ -7165,11 +7200,9 @@ function assertInstanceOfHTMLElement(elm, msg) {
|
|
|
7165
7200
|
}
|
|
7166
7201
|
const HTMLElementExported = HTMLElementConstructor;
|
|
7167
7202
|
const renderer = {
|
|
7168
|
-
ssr,
|
|
7169
7203
|
isNativeShadowDefined,
|
|
7170
7204
|
isSyntheticShadowDefined,
|
|
7171
7205
|
HTMLElementExported,
|
|
7172
|
-
isHydrating,
|
|
7173
7206
|
insert,
|
|
7174
7207
|
remove,
|
|
7175
7208
|
cloneNode,
|
|
@@ -7255,13 +7288,8 @@ function hydrateComponent(element, Ctor, props = {}) {
|
|
|
7255
7288
|
return;
|
|
7256
7289
|
}
|
|
7257
7290
|
try {
|
|
7258
|
-
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
7259
|
-
// and uses the same algo to create the stylesheets as in SSR.
|
|
7260
|
-
setIsHydrating(true);
|
|
7261
7291
|
const vm = createVMWithProps(element, Ctor, props);
|
|
7262
7292
|
hydrateRoot(vm);
|
|
7263
|
-
// set it back since now we finished hydration.
|
|
7264
|
-
setIsHydrating(false);
|
|
7265
7293
|
}
|
|
7266
7294
|
catch (e) {
|
|
7267
7295
|
// Fallback: In case there's an error while hydrating, let's log the error, and replace the element content
|
|
@@ -7272,13 +7300,8 @@ function hydrateComponent(element, Ctor, props = {}) {
|
|
|
7272
7300
|
resetShadowRootAndLightDom(element, Ctor);
|
|
7273
7301
|
// we need to recreate the vm with the hydration flag on, so it re-uses the existing shadowRoot.
|
|
7274
7302
|
createVMWithProps(element, Ctor, props);
|
|
7275
|
-
setIsHydrating(false);
|
|
7276
7303
|
connectRootElement(element);
|
|
7277
7304
|
}
|
|
7278
|
-
finally {
|
|
7279
|
-
// in case there's an error during recovery
|
|
7280
|
-
setIsHydrating(false);
|
|
7281
|
-
}
|
|
7282
7305
|
}
|
|
7283
7306
|
|
|
7284
7307
|
/*
|
|
@@ -7503,6 +7526,6 @@ defineProperty(LightningElement, 'CustomElementConstructor', {
|
|
|
7503
7526
|
});
|
|
7504
7527
|
freeze(LightningElement);
|
|
7505
7528
|
seal(LightningElement.prototype);
|
|
7506
|
-
/* version: 2.
|
|
7529
|
+
/* version: 2.23.1 */
|
|
7507
7530
|
|
|
7508
7531
|
export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, deprecatedBuildCustomElementConstructor as buildCustomElementConstructor, createContextProvider, createElement, freezeTemplate, getComponentConstructor, getComponentDef, hydrateComponent, isComponentConstructor, isNodeShadowed as isNodeFromTemplate, parseFragment, parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, renderer, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
|