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
|
@@ -294,7 +294,11 @@
|
|
|
294
294
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
295
295
|
return attributeName;
|
|
296
296
|
}
|
|
297
|
-
/** version: 2.
|
|
297
|
+
/** version: 2.23.1 */
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Copyright (C) 2018 salesforce.com, inc.
|
|
301
|
+
*/
|
|
298
302
|
|
|
299
303
|
/*
|
|
300
304
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -303,7 +307,7 @@
|
|
|
303
307
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
304
308
|
*/
|
|
305
309
|
function detect(propName) {
|
|
306
|
-
return
|
|
310
|
+
return getOwnPropertyDescriptor$1(Element.prototype, propName) === undefined;
|
|
307
311
|
}
|
|
308
312
|
|
|
309
313
|
/*
|
|
@@ -372,6 +376,7 @@
|
|
|
372
376
|
patch$1(propName);
|
|
373
377
|
}
|
|
374
378
|
}
|
|
379
|
+
/** version: 2.23.1 */
|
|
375
380
|
|
|
376
381
|
/**
|
|
377
382
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -399,7 +404,7 @@
|
|
|
399
404
|
if (!_globalThis.lwcRuntimeFlags) {
|
|
400
405
|
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
|
|
401
406
|
}
|
|
402
|
-
const
|
|
407
|
+
const lwcRuntimeFlags = _globalThis.lwcRuntimeFlags;
|
|
403
408
|
/**
|
|
404
409
|
* Set the value at runtime of a given feature flag. This method only be invoked once per feature
|
|
405
410
|
* flag. It is meant to be used during the app initialization.
|
|
@@ -423,13 +428,13 @@
|
|
|
423
428
|
}
|
|
424
429
|
{
|
|
425
430
|
// Disallow the same flag to be set more than once in production
|
|
426
|
-
const runtimeValue =
|
|
431
|
+
const runtimeValue = lwcRuntimeFlags[name];
|
|
427
432
|
if (!isUndefined$1(runtimeValue)) {
|
|
428
433
|
// eslint-disable-next-line no-console
|
|
429
434
|
console.error(`Failed to set the value "${value}" for the runtime feature flag "${name}". "${name}" has already been set with the value "${runtimeValue}".`);
|
|
430
435
|
return;
|
|
431
436
|
}
|
|
432
|
-
defineProperty(
|
|
437
|
+
defineProperty(lwcRuntimeFlags, name, { value });
|
|
433
438
|
}
|
|
434
439
|
}
|
|
435
440
|
/**
|
|
@@ -595,18 +600,21 @@
|
|
|
595
600
|
ArrayPush$1.call(this.listeners, reactiveObservers);
|
|
596
601
|
}
|
|
597
602
|
}
|
|
598
|
-
|
|
599
|
-
/*
|
|
600
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
601
|
-
* All rights reserved.
|
|
602
|
-
* SPDX-License-Identifier: MIT
|
|
603
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
604
|
-
*/
|
|
605
603
|
function componentValueMutated(vm, key) {
|
|
606
|
-
|
|
604
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
605
|
+
{
|
|
606
|
+
valueMutated(vm.component, key);
|
|
607
|
+
}
|
|
607
608
|
}
|
|
608
609
|
function componentValueObserved(vm, key) {
|
|
609
|
-
|
|
610
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
611
|
+
{
|
|
612
|
+
valueObserved(vm.component, key);
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
function createReactiveObserver(callback) {
|
|
616
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
617
|
+
return new ReactiveObserver(callback) ;
|
|
610
618
|
}
|
|
611
619
|
|
|
612
620
|
/*
|
|
@@ -859,6 +867,14 @@
|
|
|
859
867
|
}
|
|
860
868
|
});
|
|
861
869
|
|
|
870
|
+
function updateComponentValue(vm, key, newValue) {
|
|
871
|
+
const { cmpFields } = vm;
|
|
872
|
+
if (newValue !== cmpFields[key]) {
|
|
873
|
+
cmpFields[key] = newValue;
|
|
874
|
+
componentValueMutated(vm, key);
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
|
|
862
878
|
/**
|
|
863
879
|
* Copyright (C) 2017 salesforce.com, inc.
|
|
864
880
|
*/
|
|
@@ -1289,7 +1305,24 @@
|
|
|
1289
1305
|
* change or being removed.
|
|
1290
1306
|
*/
|
|
1291
1307
|
function unwrap(value) {
|
|
1292
|
-
|
|
1308
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
1309
|
+
return reactiveMembrane.unwrapProxy(value) ;
|
|
1310
|
+
}
|
|
1311
|
+
function getReadOnlyProxy(value) {
|
|
1312
|
+
// We must return a frozen wrapper around the value, so that child components cannot mutate properties passed to
|
|
1313
|
+
// them from their parents. This applies to both the client and server.
|
|
1314
|
+
return reactiveMembrane.getReadOnlyProxy(value);
|
|
1315
|
+
}
|
|
1316
|
+
function getReactiveProxy(value) {
|
|
1317
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
1318
|
+
return reactiveMembrane.getProxy(value) ;
|
|
1319
|
+
}
|
|
1320
|
+
// Making the component instance a live value when using Locker to support expandos.
|
|
1321
|
+
function markLockerLiveObject(obj) {
|
|
1322
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
1323
|
+
{
|
|
1324
|
+
obj[lockerLivePropertyKey] = undefined;
|
|
1325
|
+
}
|
|
1293
1326
|
}
|
|
1294
1327
|
|
|
1295
1328
|
/*
|
|
@@ -1325,10 +1358,7 @@
|
|
|
1325
1358
|
},
|
|
1326
1359
|
set(newValue) {
|
|
1327
1360
|
const vm = getAssociatedVM(this);
|
|
1328
|
-
|
|
1329
|
-
vm.cmpProps[propName] = newValue;
|
|
1330
|
-
componentValueMutated(vm, propName);
|
|
1331
|
-
}
|
|
1361
|
+
updateComponentValue(vm, propName, newValue);
|
|
1332
1362
|
return set.call(vm.elm, newValue);
|
|
1333
1363
|
},
|
|
1334
1364
|
};
|
|
@@ -1359,8 +1389,7 @@
|
|
|
1359
1389
|
vm.setHook = setHook;
|
|
1360
1390
|
vm.getHook = getHook;
|
|
1361
1391
|
}
|
|
1362
|
-
|
|
1363
|
-
this[lockerLivePropertyKey] = undefined;
|
|
1392
|
+
markLockerLiveObject(this);
|
|
1364
1393
|
// Linking elm, shadow root and component with the VM.
|
|
1365
1394
|
associateVM(component, vm);
|
|
1366
1395
|
associateVM(elm, vm);
|
|
@@ -1558,15 +1587,51 @@
|
|
|
1558
1587
|
},
|
|
1559
1588
|
set(newValue) {
|
|
1560
1589
|
const vm = getAssociatedVM(this);
|
|
1561
|
-
|
|
1562
|
-
vm.cmpFields[key] = newValue;
|
|
1563
|
-
componentValueMutated(vm, key);
|
|
1564
|
-
}
|
|
1590
|
+
updateComponentValue(vm, key, newValue);
|
|
1565
1591
|
},
|
|
1566
1592
|
enumerable: true,
|
|
1567
1593
|
configurable: true,
|
|
1568
1594
|
};
|
|
1569
1595
|
}
|
|
1596
|
+
class AccessorReactiveObserver extends ReactiveObserver {
|
|
1597
|
+
constructor(vm, set) {
|
|
1598
|
+
super(() => {
|
|
1599
|
+
if (isFalse(this.debouncing)) {
|
|
1600
|
+
this.debouncing = true;
|
|
1601
|
+
addCallbackToNextTick(() => {
|
|
1602
|
+
if (isTrue(this.debouncing)) {
|
|
1603
|
+
const { value } = this;
|
|
1604
|
+
const { isDirty: dirtyStateBeforeSetterCall, component, idx } = vm;
|
|
1605
|
+
set.call(component, value);
|
|
1606
|
+
// de-bouncing after the call to the original setter to prevent
|
|
1607
|
+
// infinity loop if the setter itself is mutating things that
|
|
1608
|
+
// were accessed during the previous invocation.
|
|
1609
|
+
this.debouncing = false;
|
|
1610
|
+
if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && idx > 0) {
|
|
1611
|
+
// immediate rehydration due to a setter driven mutation, otherwise
|
|
1612
|
+
// the component will get rendered on the second tick, which it is not
|
|
1613
|
+
// desirable.
|
|
1614
|
+
rerenderVM(vm);
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
});
|
|
1618
|
+
}
|
|
1619
|
+
});
|
|
1620
|
+
this.debouncing = false;
|
|
1621
|
+
}
|
|
1622
|
+
reset(value) {
|
|
1623
|
+
super.reset();
|
|
1624
|
+
this.debouncing = false;
|
|
1625
|
+
if (arguments.length > 0) {
|
|
1626
|
+
this.value = value;
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
function createAccessorReactiveObserver(vm, set) {
|
|
1631
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
1632
|
+
return new AccessorReactiveObserver(vm, set)
|
|
1633
|
+
;
|
|
1634
|
+
}
|
|
1570
1635
|
|
|
1571
1636
|
/*
|
|
1572
1637
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -1603,50 +1668,6 @@
|
|
|
1603
1668
|
configurable: true
|
|
1604
1669
|
};
|
|
1605
1670
|
}
|
|
1606
|
-
class AccessorReactiveObserver extends ReactiveObserver {
|
|
1607
|
-
constructor(vm, set) {
|
|
1608
|
-
super(() => {
|
|
1609
|
-
if (isFalse(this.debouncing)) {
|
|
1610
|
-
this.debouncing = true;
|
|
1611
|
-
addCallbackToNextTick(() => {
|
|
1612
|
-
if (isTrue(this.debouncing)) {
|
|
1613
|
-
const {
|
|
1614
|
-
value
|
|
1615
|
-
} = this;
|
|
1616
|
-
const {
|
|
1617
|
-
isDirty: dirtyStateBeforeSetterCall,
|
|
1618
|
-
component,
|
|
1619
|
-
idx
|
|
1620
|
-
} = vm;
|
|
1621
|
-
set.call(component, value); // de-bouncing after the call to the original setter to prevent
|
|
1622
|
-
// infinity loop if the setter itself is mutating things that
|
|
1623
|
-
// were accessed during the previous invocation.
|
|
1624
|
-
|
|
1625
|
-
this.debouncing = false;
|
|
1626
|
-
|
|
1627
|
-
if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && idx > 0) {
|
|
1628
|
-
// immediate rehydration due to a setter driven mutation, otherwise
|
|
1629
|
-
// the component will get rendered on the second tick, which it is not
|
|
1630
|
-
// desirable.
|
|
1631
|
-
rerenderVM(vm);
|
|
1632
|
-
}
|
|
1633
|
-
}
|
|
1634
|
-
});
|
|
1635
|
-
}
|
|
1636
|
-
});
|
|
1637
|
-
this.debouncing = false;
|
|
1638
|
-
}
|
|
1639
|
-
|
|
1640
|
-
reset(value) {
|
|
1641
|
-
super.reset();
|
|
1642
|
-
this.debouncing = false;
|
|
1643
|
-
|
|
1644
|
-
if (arguments.length > 0) {
|
|
1645
|
-
this.value = value;
|
|
1646
|
-
}
|
|
1647
|
-
}
|
|
1648
|
-
|
|
1649
|
-
}
|
|
1650
1671
|
function createPublicAccessorDescriptor(key, descriptor) {
|
|
1651
1672
|
const {
|
|
1652
1673
|
get,
|
|
@@ -1670,11 +1691,11 @@
|
|
|
1670
1691
|
const vm = getAssociatedVM(this);
|
|
1671
1692
|
|
|
1672
1693
|
if (set) {
|
|
1673
|
-
if (
|
|
1694
|
+
if (lwcRuntimeFlags.ENABLE_REACTIVE_SETTER) {
|
|
1674
1695
|
let ro = vm.oar[key];
|
|
1675
1696
|
|
|
1676
1697
|
if (isUndefined$1(ro)) {
|
|
1677
|
-
ro = vm.oar[key] =
|
|
1698
|
+
ro = vm.oar[key] = createAccessorReactiveObserver(vm, set);
|
|
1678
1699
|
} // every time we invoke this setter from outside (through this wrapper setter)
|
|
1679
1700
|
// we should reset the value and then debounce just in case there is a pending
|
|
1680
1701
|
// invocation the next tick that is not longer relevant since the value is changing
|
|
@@ -1704,7 +1725,7 @@
|
|
|
1704
1725
|
*/
|
|
1705
1726
|
function track(target) {
|
|
1706
1727
|
if (arguments.length === 1) {
|
|
1707
|
-
return
|
|
1728
|
+
return getReactiveProxy(target);
|
|
1708
1729
|
}
|
|
1709
1730
|
throw new Error();
|
|
1710
1731
|
}
|
|
@@ -1717,11 +1738,8 @@
|
|
|
1717
1738
|
},
|
|
1718
1739
|
set(newValue) {
|
|
1719
1740
|
const vm = getAssociatedVM(this);
|
|
1720
|
-
const reactiveOrAnyValue =
|
|
1721
|
-
|
|
1722
|
-
vm.cmpFields[key] = reactiveOrAnyValue;
|
|
1723
|
-
componentValueMutated(vm, key);
|
|
1724
|
-
}
|
|
1741
|
+
const reactiveOrAnyValue = getReactiveProxy(newValue);
|
|
1742
|
+
updateComponentValue(vm, key, reactiveOrAnyValue);
|
|
1725
1743
|
},
|
|
1726
1744
|
enumerable: true,
|
|
1727
1745
|
configurable: true,
|
|
@@ -1757,10 +1775,7 @@
|
|
|
1757
1775
|
* letting the author to do the wrong thing, but it will keep our
|
|
1758
1776
|
* system to be backward compatible.
|
|
1759
1777
|
*/
|
|
1760
|
-
|
|
1761
|
-
vm.cmpFields[key] = value;
|
|
1762
|
-
componentValueMutated(vm, key);
|
|
1763
|
-
}
|
|
1778
|
+
updateComponentValue(vm, key, value);
|
|
1764
1779
|
},
|
|
1765
1780
|
enumerable: true,
|
|
1766
1781
|
configurable: true,
|
|
@@ -1970,7 +1985,7 @@
|
|
|
1970
1985
|
fn = cachedSetterByKey[key] = function (newValue) {
|
|
1971
1986
|
const vm = getAssociatedVM(this);
|
|
1972
1987
|
const { setHook } = vm;
|
|
1973
|
-
newValue =
|
|
1988
|
+
newValue = getReadOnlyProxy(newValue);
|
|
1974
1989
|
setHook(vm.component, key, newValue);
|
|
1975
1990
|
};
|
|
1976
1991
|
}
|
|
@@ -2096,7 +2111,7 @@
|
|
|
2096
2111
|
}
|
|
2097
2112
|
function swapTemplate(oldTpl, newTpl) {
|
|
2098
2113
|
|
|
2099
|
-
if (!
|
|
2114
|
+
if (!lwcRuntimeFlags.ENABLE_HMR) {
|
|
2100
2115
|
throw new Error('HMR is not enabled');
|
|
2101
2116
|
}
|
|
2102
2117
|
|
|
@@ -2104,7 +2119,7 @@
|
|
|
2104
2119
|
}
|
|
2105
2120
|
function swapComponent(oldComponent, newComponent) {
|
|
2106
2121
|
|
|
2107
|
-
if (!
|
|
2122
|
+
if (!lwcRuntimeFlags.ENABLE_HMR) {
|
|
2108
2123
|
throw new Error('HMR is not enabled');
|
|
2109
2124
|
}
|
|
2110
2125
|
|
|
@@ -2112,7 +2127,7 @@
|
|
|
2112
2127
|
}
|
|
2113
2128
|
function swapStyle(oldStyle, newStyle) {
|
|
2114
2129
|
|
|
2115
|
-
if (!
|
|
2130
|
+
if (!lwcRuntimeFlags.ENABLE_HMR) {
|
|
2116
2131
|
throw new Error('HMR is not enabled');
|
|
2117
2132
|
}
|
|
2118
2133
|
|
|
@@ -2429,13 +2444,13 @@
|
|
|
2429
2444
|
return owner;
|
|
2430
2445
|
}
|
|
2431
2446
|
function createStylesheet(vm, stylesheets) {
|
|
2432
|
-
const { renderMode, shadowMode, renderer: {
|
|
2447
|
+
const { renderMode, shadowMode, renderer: { insertStylesheet }, } = vm;
|
|
2433
2448
|
if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
2434
2449
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
2435
2450
|
insertStylesheet(stylesheets[i]);
|
|
2436
2451
|
}
|
|
2437
2452
|
}
|
|
2438
|
-
else if (
|
|
2453
|
+
else if (vm.hydrated) {
|
|
2439
2454
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
2440
2455
|
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
2441
2456
|
// the first time the VM renders.
|
|
@@ -2732,7 +2747,7 @@
|
|
|
2732
2747
|
updateStaticChildren(c1, c2, parent, renderer);
|
|
2733
2748
|
}
|
|
2734
2749
|
}
|
|
2735
|
-
function patch(n1, n2, renderer) {
|
|
2750
|
+
function patch(n1, n2, parent, renderer) {
|
|
2736
2751
|
var _a, _b;
|
|
2737
2752
|
if (n1 === n2) {
|
|
2738
2753
|
return;
|
|
@@ -2753,7 +2768,7 @@
|
|
|
2753
2768
|
patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
2754
2769
|
break;
|
|
2755
2770
|
case 3 /* VNodeType.CustomElement */:
|
|
2756
|
-
patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
2771
|
+
patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
2757
2772
|
break;
|
|
2758
2773
|
}
|
|
2759
2774
|
}
|
|
@@ -2875,22 +2890,32 @@
|
|
|
2875
2890
|
appendVM(vm);
|
|
2876
2891
|
}
|
|
2877
2892
|
}
|
|
2878
|
-
function patchCustomElement(n1, n2, renderer) {
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
allocateChildren(n2, vm);
|
|
2893
|
+
function patchCustomElement(n1, n2, parent, renderer) {
|
|
2894
|
+
if (n1.ctor !== n2.ctor) {
|
|
2895
|
+
// If the constructor, unmount the current component and mount a new one using the new
|
|
2896
|
+
// constructor.
|
|
2897
|
+
const anchor = renderer.nextSibling(n1.elm);
|
|
2898
|
+
unmount(n1, parent, renderer, true);
|
|
2899
|
+
mountCustomElement(n2, parent, anchor, renderer);
|
|
2886
2900
|
}
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2901
|
+
else {
|
|
2902
|
+
// Otherwise patch the existing component with new props/attrs/etc.
|
|
2903
|
+
const elm = (n2.elm = n1.elm);
|
|
2904
|
+
const vm = (n2.vm = n1.vm);
|
|
2905
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
2906
|
+
if (!isUndefined$1(vm)) {
|
|
2907
|
+
// in fallback mode, the allocation will always set children to
|
|
2908
|
+
// empty and delegate the real allocation to the slot elements
|
|
2909
|
+
allocateChildren(n2, vm);
|
|
2910
|
+
}
|
|
2911
|
+
// in fallback mode, the children will be always empty, so, nothing
|
|
2912
|
+
// will happen, but in native, it does allocate the light dom
|
|
2913
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
2914
|
+
if (!isUndefined$1(vm)) {
|
|
2915
|
+
// this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
2916
|
+
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
2917
|
+
rerenderVM(vm);
|
|
2918
|
+
}
|
|
2894
2919
|
}
|
|
2895
2920
|
}
|
|
2896
2921
|
function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
|
|
@@ -3128,25 +3153,25 @@
|
|
|
3128
3153
|
newEndVnode = newCh[--newEndIdx];
|
|
3129
3154
|
}
|
|
3130
3155
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
3131
|
-
patch(oldStartVnode, newStartVnode, renderer);
|
|
3156
|
+
patch(oldStartVnode, newStartVnode, parent, renderer);
|
|
3132
3157
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
3133
3158
|
newStartVnode = newCh[++newStartIdx];
|
|
3134
3159
|
}
|
|
3135
3160
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
3136
|
-
patch(oldEndVnode, newEndVnode, renderer);
|
|
3161
|
+
patch(oldEndVnode, newEndVnode, parent, renderer);
|
|
3137
3162
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
3138
3163
|
newEndVnode = newCh[--newEndIdx];
|
|
3139
3164
|
}
|
|
3140
3165
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
3141
3166
|
// Vnode moved right
|
|
3142
|
-
patch(oldStartVnode, newEndVnode, renderer);
|
|
3167
|
+
patch(oldStartVnode, newEndVnode, parent, renderer);
|
|
3143
3168
|
insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
|
|
3144
3169
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
3145
3170
|
newEndVnode = newCh[--newEndIdx];
|
|
3146
3171
|
}
|
|
3147
3172
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
3148
3173
|
// Vnode moved left
|
|
3149
|
-
patch(oldEndVnode, newStartVnode, renderer);
|
|
3174
|
+
patch(oldEndVnode, newStartVnode, parent, renderer);
|
|
3150
3175
|
insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
|
|
3151
3176
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
3152
3177
|
newStartVnode = newCh[++newStartIdx];
|
|
@@ -3169,7 +3194,7 @@
|
|
|
3169
3194
|
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
3170
3195
|
}
|
|
3171
3196
|
else {
|
|
3172
|
-
patch(elmToMove, newStartVnode, renderer);
|
|
3197
|
+
patch(elmToMove, newStartVnode, parent, renderer);
|
|
3173
3198
|
// Delete the old child, but copy the array since it is read-only.
|
|
3174
3199
|
// The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
|
|
3175
3200
|
// so we only care about the `oldCh` object inside this function.
|
|
@@ -3229,7 +3254,7 @@
|
|
|
3229
3254
|
if (isVNode(n1)) {
|
|
3230
3255
|
if (isVNode(n2)) {
|
|
3231
3256
|
// both vnodes are equivalent, and we just need to patch them
|
|
3232
|
-
patch(n1, n2, renderer);
|
|
3257
|
+
patch(n1, n2, parent, renderer);
|
|
3233
3258
|
anchor = n2.elm;
|
|
3234
3259
|
}
|
|
3235
3260
|
else {
|
|
@@ -3458,13 +3483,6 @@
|
|
|
3458
3483
|
}
|
|
3459
3484
|
return url;
|
|
3460
3485
|
}
|
|
3461
|
-
/**
|
|
3462
|
-
* Map to store an index value assigned to any dynamic component reference ingested
|
|
3463
|
-
* by dc() api. This allows us to generate a unique unique per template per dynamic
|
|
3464
|
-
* component reference to avoid diffing algo mismatches.
|
|
3465
|
-
*/
|
|
3466
|
-
const DynamicImportedComponentMap = new Map();
|
|
3467
|
-
let dynamicImportedComponentCounter = 0;
|
|
3468
3486
|
/**
|
|
3469
3487
|
* create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
|
|
3470
3488
|
*/
|
|
@@ -3476,18 +3494,7 @@
|
|
|
3476
3494
|
if (!isComponentConstructor(Ctor)) {
|
|
3477
3495
|
throw new Error(`Invalid LWC Constructor ${toString$1(Ctor)} for custom element <${sel}>.`);
|
|
3478
3496
|
}
|
|
3479
|
-
|
|
3480
|
-
if (isUndefined$1(idx)) {
|
|
3481
|
-
idx = dynamicImportedComponentCounter++;
|
|
3482
|
-
DynamicImportedComponentMap.set(Ctor, idx);
|
|
3483
|
-
}
|
|
3484
|
-
// the new vnode key is a mix of idx and compiler key, this is required by the diffing algo
|
|
3485
|
-
// to identify different constructors as vnodes with different keys to avoid reusing the
|
|
3486
|
-
// element used for previous constructors.
|
|
3487
|
-
// Shallow clone is necessary here becuase VElementData may be shared across VNodes due to
|
|
3488
|
-
// hoisting optimization.
|
|
3489
|
-
const newData = Object.assign(Object.assign({}, data), { key: `dc:${idx}:${data.key}` });
|
|
3490
|
-
return c(sel, Ctor, newData, children);
|
|
3497
|
+
return c(sel, Ctor, data, children);
|
|
3491
3498
|
}
|
|
3492
3499
|
/**
|
|
3493
3500
|
* slow children collection marking mechanism. this API allows the compiler to signal
|
|
@@ -3843,7 +3850,7 @@
|
|
|
3843
3850
|
return signedTemplateMap.get(Ctor);
|
|
3844
3851
|
}
|
|
3845
3852
|
function getTemplateReactiveObserver(vm) {
|
|
3846
|
-
return
|
|
3853
|
+
return createReactiveObserver(() => {
|
|
3847
3854
|
const { isDirty } = vm;
|
|
3848
3855
|
if (isFalse(isDirty)) {
|
|
3849
3856
|
markComponentAsDirty(vm);
|
|
@@ -4094,7 +4101,7 @@
|
|
|
4094
4101
|
} else if (isNativeShadowDefined) {
|
|
4095
4102
|
// Not combined with above condition because @lwc/features only supports identifiers in
|
|
4096
4103
|
// the if-condition.
|
|
4097
|
-
if (
|
|
4104
|
+
if (lwcRuntimeFlags.ENABLE_MIXED_SHADOW_MODE) {
|
|
4098
4105
|
if (def.shadowSupportMode === "any"
|
|
4099
4106
|
/* ShadowSupportMode.Any */
|
|
4100
4107
|
) {
|
|
@@ -4207,16 +4214,9 @@
|
|
|
4207
4214
|
const {
|
|
4208
4215
|
def: {
|
|
4209
4216
|
renderedCallback
|
|
4210
|
-
},
|
|
4211
|
-
renderer: {
|
|
4212
|
-
ssr
|
|
4213
4217
|
}
|
|
4214
4218
|
} = vm;
|
|
4215
4219
|
|
|
4216
|
-
if (isTrue(ssr)) {
|
|
4217
|
-
return;
|
|
4218
|
-
}
|
|
4219
|
-
|
|
4220
4220
|
const {
|
|
4221
4221
|
rendered
|
|
4222
4222
|
} = Services;
|
|
@@ -4457,13 +4457,7 @@
|
|
|
4457
4457
|
vm.velements = EmptyArray;
|
|
4458
4458
|
}
|
|
4459
4459
|
function scheduleRehydration(vm) {
|
|
4460
|
-
|
|
4461
|
-
renderer: {
|
|
4462
|
-
ssr
|
|
4463
|
-
}
|
|
4464
|
-
} = vm;
|
|
4465
|
-
|
|
4466
|
-
if (isTrue(ssr) || isTrue(vm.isScheduled)) {
|
|
4460
|
+
if (isTrue(vm.isScheduled)) {
|
|
4467
4461
|
return;
|
|
4468
4462
|
}
|
|
4469
4463
|
|
|
@@ -4553,15 +4547,8 @@
|
|
|
4553
4547
|
}
|
|
4554
4548
|
|
|
4555
4549
|
function createFieldDataCallback(vm, name) {
|
|
4556
|
-
const {
|
|
4557
|
-
cmpFields
|
|
4558
|
-
} = vm;
|
|
4559
4550
|
return value => {
|
|
4560
|
-
|
|
4561
|
-
// storing the value in the underlying storage
|
|
4562
|
-
cmpFields[name] = value;
|
|
4563
|
-
componentValueMutated(vm, name);
|
|
4564
|
-
}
|
|
4551
|
+
updateComponentValue(vm, name, value);
|
|
4565
4552
|
};
|
|
4566
4553
|
}
|
|
4567
4554
|
|
|
@@ -4578,7 +4565,7 @@
|
|
|
4578
4565
|
function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
|
|
4579
4566
|
let hasPendingConfig = false; // creating the reactive observer for reactive params when needed
|
|
4580
4567
|
|
|
4581
|
-
const ro =
|
|
4568
|
+
const ro = createReactiveObserver(() => {
|
|
4582
4569
|
if (hasPendingConfig === false) {
|
|
4583
4570
|
hasPendingConfig = true; // collect new config in the micro-task
|
|
4584
4571
|
|
|
@@ -4775,7 +4762,7 @@
|
|
|
4775
4762
|
ArrayPush$1.call(wiredConnecting, () => {
|
|
4776
4763
|
connector.connect();
|
|
4777
4764
|
|
|
4778
|
-
if (!
|
|
4765
|
+
if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
|
|
4779
4766
|
if (hasDynamicParams) {
|
|
4780
4767
|
Promise.resolve().then(computeConfigAndUpdate);
|
|
4781
4768
|
return;
|
|
@@ -4864,7 +4851,7 @@
|
|
|
4864
4851
|
* being removed.
|
|
4865
4852
|
*/
|
|
4866
4853
|
function readonly(obj) {
|
|
4867
|
-
return
|
|
4854
|
+
return getReadOnlyProxy(obj);
|
|
4868
4855
|
}
|
|
4869
4856
|
|
|
4870
4857
|
/*
|
|
@@ -5216,7 +5203,7 @@
|
|
|
5216
5203
|
}
|
|
5217
5204
|
return ctor;
|
|
5218
5205
|
}
|
|
5219
|
-
/* version: 2.
|
|
5206
|
+
/* version: 2.23.1 */
|
|
5220
5207
|
|
|
5221
5208
|
/*
|
|
5222
5209
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5351,6 +5338,69 @@
|
|
|
5351
5338
|
}
|
|
5352
5339
|
}
|
|
5353
5340
|
|
|
5341
|
+
/*
|
|
5342
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
5343
|
+
* All rights reserved.
|
|
5344
|
+
* SPDX-License-Identifier: MIT
|
|
5345
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5346
|
+
*/
|
|
5347
|
+
const SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
|
|
5348
|
+
let createFragment;
|
|
5349
|
+
if (SUPPORTS_TEMPLATE) {
|
|
5350
|
+
// Parse the fragment HTML string into DOM
|
|
5351
|
+
createFragment = function (html) {
|
|
5352
|
+
const template = document.createElement('template');
|
|
5353
|
+
template.innerHTML = html;
|
|
5354
|
+
return template.content.firstChild;
|
|
5355
|
+
};
|
|
5356
|
+
}
|
|
5357
|
+
else {
|
|
5358
|
+
// In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
|
|
5359
|
+
// <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
|
|
5360
|
+
// Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
|
|
5361
|
+
// With other elements added from:
|
|
5362
|
+
// https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
|
|
5363
|
+
// Using the test:
|
|
5364
|
+
// document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
|
|
5365
|
+
// And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
|
|
5366
|
+
const topLevelWrappingMap = {
|
|
5367
|
+
caption: ['table'],
|
|
5368
|
+
col: ['colgroup', 'table'],
|
|
5369
|
+
colgroup: ['table'],
|
|
5370
|
+
option: ['select'],
|
|
5371
|
+
tbody: ['table'],
|
|
5372
|
+
td: ['tr', 'tbody', 'table'],
|
|
5373
|
+
th: ['tr', 'tbody', 'table'],
|
|
5374
|
+
thead: ['table'],
|
|
5375
|
+
tfoot: ['table'],
|
|
5376
|
+
tr: ['tbody', 'table'],
|
|
5377
|
+
};
|
|
5378
|
+
// Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
|
|
5379
|
+
const getTagName = function (text) {
|
|
5380
|
+
return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
|
|
5381
|
+
};
|
|
5382
|
+
// Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
|
|
5383
|
+
createFragment = function (html) {
|
|
5384
|
+
const wrapperTags = topLevelWrappingMap[getTagName(html)];
|
|
5385
|
+
if (!isUndefined$1(wrapperTags)) {
|
|
5386
|
+
for (const wrapperTag of wrapperTags) {
|
|
5387
|
+
html = `<${wrapperTag}>${html}</${wrapperTag}>`;
|
|
5388
|
+
}
|
|
5389
|
+
}
|
|
5390
|
+
// For IE11, the document title must not be undefined, but it can be an empty string
|
|
5391
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
|
|
5392
|
+
const doc = document.implementation.createHTMLDocument('');
|
|
5393
|
+
doc.body.innerHTML = html;
|
|
5394
|
+
let content = doc.body;
|
|
5395
|
+
if (!isUndefined$1(wrapperTags)) {
|
|
5396
|
+
for (let i = 0; i < wrapperTags.length; i++) {
|
|
5397
|
+
content = content.firstChild;
|
|
5398
|
+
}
|
|
5399
|
+
}
|
|
5400
|
+
return content.firstChild;
|
|
5401
|
+
};
|
|
5402
|
+
}
|
|
5403
|
+
|
|
5354
5404
|
/*
|
|
5355
5405
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
5356
5406
|
* All rights reserved.
|
|
@@ -5416,22 +5466,11 @@
|
|
|
5416
5466
|
};
|
|
5417
5467
|
HTMLElementConstructor.prototype = HTMLElement.prototype;
|
|
5418
5468
|
}
|
|
5419
|
-
let hydrating = false;
|
|
5420
|
-
function setIsHydrating(value) {
|
|
5421
|
-
hydrating = value;
|
|
5422
|
-
}
|
|
5423
|
-
const ssr = false;
|
|
5424
|
-
function isHydrating() {
|
|
5425
|
-
return hydrating;
|
|
5426
|
-
}
|
|
5427
5469
|
const isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
|
|
5428
5470
|
const isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
|
|
5429
5471
|
function cloneNode(node, deep) {
|
|
5430
5472
|
return node.cloneNode(deep);
|
|
5431
5473
|
}
|
|
5432
|
-
function createFragment(html) {
|
|
5433
|
-
return document.createRange().createContextualFragment(html).firstChild;
|
|
5434
|
-
}
|
|
5435
5474
|
function createElement$1(tagName, namespace) {
|
|
5436
5475
|
return isUndefined$1(namespace)
|
|
5437
5476
|
? document.createElement(tagName)
|
|
@@ -5453,15 +5492,11 @@
|
|
|
5453
5492
|
return node.nextSibling;
|
|
5454
5493
|
}
|
|
5455
5494
|
function attachShadow(element, options) {
|
|
5456
|
-
// `
|
|
5495
|
+
// `shadowRoot` will be non-null in two cases:
|
|
5457
5496
|
// 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
|
|
5458
5497
|
// 2. when a webapp author places <c-app> in their static HTML and mounts their
|
|
5459
|
-
// root component with
|
|
5460
|
-
|
|
5461
|
-
// The second case can be treated as a failed hydration with nominal impact
|
|
5462
|
-
// to performance. However, because <c-app> won't have a <template shadowroot>
|
|
5463
|
-
// declarative child, `element.shadowRoot` is `null`.
|
|
5464
|
-
if (hydrating && element.shadowRoot) {
|
|
5498
|
+
// root component with customElement.define('c-app', Ctor)
|
|
5499
|
+
if (!isNull(element.shadowRoot)) {
|
|
5465
5500
|
return element.shadowRoot;
|
|
5466
5501
|
}
|
|
5467
5502
|
return element.attachShadow(options);
|
|
@@ -5551,11 +5586,9 @@
|
|
|
5551
5586
|
}
|
|
5552
5587
|
const HTMLElementExported = HTMLElementConstructor;
|
|
5553
5588
|
const renderer = {
|
|
5554
|
-
ssr,
|
|
5555
5589
|
isNativeShadowDefined,
|
|
5556
5590
|
isSyntheticShadowDefined,
|
|
5557
5591
|
HTMLElementExported,
|
|
5558
|
-
isHydrating,
|
|
5559
5592
|
insert,
|
|
5560
5593
|
remove,
|
|
5561
5594
|
cloneNode,
|
|
@@ -5641,13 +5674,8 @@
|
|
|
5641
5674
|
return;
|
|
5642
5675
|
}
|
|
5643
5676
|
try {
|
|
5644
|
-
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
5645
|
-
// and uses the same algo to create the stylesheets as in SSR.
|
|
5646
|
-
setIsHydrating(true);
|
|
5647
5677
|
const vm = createVMWithProps(element, Ctor, props);
|
|
5648
5678
|
hydrateRoot(vm);
|
|
5649
|
-
// set it back since now we finished hydration.
|
|
5650
|
-
setIsHydrating(false);
|
|
5651
5679
|
}
|
|
5652
5680
|
catch (e) {
|
|
5653
5681
|
// Fallback: In case there's an error while hydrating, let's log the error, and replace the element content
|
|
@@ -5658,13 +5686,8 @@
|
|
|
5658
5686
|
resetShadowRootAndLightDom(element, Ctor);
|
|
5659
5687
|
// we need to recreate the vm with the hydration flag on, so it re-uses the existing shadowRoot.
|
|
5660
5688
|
createVMWithProps(element, Ctor, props);
|
|
5661
|
-
setIsHydrating(false);
|
|
5662
5689
|
connectRootElement(element);
|
|
5663
5690
|
}
|
|
5664
|
-
finally {
|
|
5665
|
-
// in case there's an error during recovery
|
|
5666
|
-
setIsHydrating(false);
|
|
5667
|
-
}
|
|
5668
5691
|
}
|
|
5669
5692
|
|
|
5670
5693
|
/*
|
|
@@ -5881,7 +5904,7 @@
|
|
|
5881
5904
|
});
|
|
5882
5905
|
freeze(LightningElement);
|
|
5883
5906
|
seal(LightningElement.prototype);
|
|
5884
|
-
/* version: 2.
|
|
5907
|
+
/* version: 2.23.1 */
|
|
5885
5908
|
|
|
5886
5909
|
exports.LightningElement = LightningElement;
|
|
5887
5910
|
exports.__unstable__ProfilerControl = profilerControl;
|