lwc 2.21.0 → 2.23.0
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 +234 -236
- package/dist/engine-dom/iife/es2017/engine-dom.js +234 -236
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +221 -224
- package/dist/engine-dom/iife/es5/engine-dom.js +282 -265
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +257 -237
- package/dist/engine-dom/umd/es2017/engine-dom.js +234 -236
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +221 -224
- package/dist/engine-dom/umd/es5/engine-dom.js +282 -265
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +257 -237
- package/dist/engine-server/commonjs/es2017/engine-server.js +138 -445
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +138 -445
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +13 -10
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +13 -10
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +13 -10
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +15 -14
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +15 -14
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +13 -10
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +13 -10
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +15 -14
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +15 -14
- 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,7 @@
|
|
|
294
294
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
295
295
|
return attributeName;
|
|
296
296
|
}
|
|
297
|
-
/** version: 2.
|
|
297
|
+
/** version: 2.23.0 */
|
|
298
298
|
|
|
299
299
|
/*
|
|
300
300
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -595,18 +595,21 @@
|
|
|
595
595
|
ArrayPush$1.call(this.listeners, reactiveObservers);
|
|
596
596
|
}
|
|
597
597
|
}
|
|
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
598
|
function componentValueMutated(vm, key) {
|
|
606
|
-
|
|
599
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
600
|
+
{
|
|
601
|
+
valueMutated(vm.component, key);
|
|
602
|
+
}
|
|
607
603
|
}
|
|
608
604
|
function componentValueObserved(vm, key) {
|
|
609
|
-
|
|
605
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
606
|
+
{
|
|
607
|
+
valueObserved(vm.component, key);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
function createReactiveObserver(callback) {
|
|
611
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
612
|
+
return new ReactiveObserver(callback) ;
|
|
610
613
|
}
|
|
611
614
|
|
|
612
615
|
/*
|
|
@@ -859,6 +862,14 @@
|
|
|
859
862
|
}
|
|
860
863
|
});
|
|
861
864
|
|
|
865
|
+
function updateComponentValue(vm, key, newValue) {
|
|
866
|
+
const { cmpFields } = vm;
|
|
867
|
+
if (newValue !== cmpFields[key]) {
|
|
868
|
+
cmpFields[key] = newValue;
|
|
869
|
+
componentValueMutated(vm, key);
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
|
|
862
873
|
/**
|
|
863
874
|
* Copyright (C) 2017 salesforce.com, inc.
|
|
864
875
|
*/
|
|
@@ -1289,7 +1300,24 @@
|
|
|
1289
1300
|
* change or being removed.
|
|
1290
1301
|
*/
|
|
1291
1302
|
function unwrap(value) {
|
|
1292
|
-
|
|
1303
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
1304
|
+
return reactiveMembrane.unwrapProxy(value) ;
|
|
1305
|
+
}
|
|
1306
|
+
function getReadOnlyProxy(value) {
|
|
1307
|
+
// We must return a frozen wrapper around the value, so that child components cannot mutate properties passed to
|
|
1308
|
+
// them from their parents. This applies to both the client and server.
|
|
1309
|
+
return reactiveMembrane.getReadOnlyProxy(value);
|
|
1310
|
+
}
|
|
1311
|
+
function getReactiveProxy(value) {
|
|
1312
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
1313
|
+
return reactiveMembrane.getProxy(value) ;
|
|
1314
|
+
}
|
|
1315
|
+
// Making the component instance a live value when using Locker to support expandos.
|
|
1316
|
+
function markLockerLiveObject(obj) {
|
|
1317
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
1318
|
+
{
|
|
1319
|
+
obj[lockerLivePropertyKey] = undefined;
|
|
1320
|
+
}
|
|
1293
1321
|
}
|
|
1294
1322
|
|
|
1295
1323
|
/*
|
|
@@ -1325,10 +1353,7 @@
|
|
|
1325
1353
|
},
|
|
1326
1354
|
set(newValue) {
|
|
1327
1355
|
const vm = getAssociatedVM(this);
|
|
1328
|
-
|
|
1329
|
-
vm.cmpProps[propName] = newValue;
|
|
1330
|
-
componentValueMutated(vm, propName);
|
|
1331
|
-
}
|
|
1356
|
+
updateComponentValue(vm, propName, newValue);
|
|
1332
1357
|
return set.call(vm.elm, newValue);
|
|
1333
1358
|
},
|
|
1334
1359
|
};
|
|
@@ -1359,8 +1384,7 @@
|
|
|
1359
1384
|
vm.setHook = setHook;
|
|
1360
1385
|
vm.getHook = getHook;
|
|
1361
1386
|
}
|
|
1362
|
-
|
|
1363
|
-
this[lockerLivePropertyKey] = undefined;
|
|
1387
|
+
markLockerLiveObject(this);
|
|
1364
1388
|
// Linking elm, shadow root and component with the VM.
|
|
1365
1389
|
associateVM(component, vm);
|
|
1366
1390
|
associateVM(elm, vm);
|
|
@@ -1558,15 +1582,51 @@
|
|
|
1558
1582
|
},
|
|
1559
1583
|
set(newValue) {
|
|
1560
1584
|
const vm = getAssociatedVM(this);
|
|
1561
|
-
|
|
1562
|
-
vm.cmpFields[key] = newValue;
|
|
1563
|
-
componentValueMutated(vm, key);
|
|
1564
|
-
}
|
|
1585
|
+
updateComponentValue(vm, key, newValue);
|
|
1565
1586
|
},
|
|
1566
1587
|
enumerable: true,
|
|
1567
1588
|
configurable: true,
|
|
1568
1589
|
};
|
|
1569
1590
|
}
|
|
1591
|
+
class AccessorReactiveObserver extends ReactiveObserver {
|
|
1592
|
+
constructor(vm, set) {
|
|
1593
|
+
super(() => {
|
|
1594
|
+
if (isFalse(this.debouncing)) {
|
|
1595
|
+
this.debouncing = true;
|
|
1596
|
+
addCallbackToNextTick(() => {
|
|
1597
|
+
if (isTrue(this.debouncing)) {
|
|
1598
|
+
const { value } = this;
|
|
1599
|
+
const { isDirty: dirtyStateBeforeSetterCall, component, idx } = vm;
|
|
1600
|
+
set.call(component, value);
|
|
1601
|
+
// de-bouncing after the call to the original setter to prevent
|
|
1602
|
+
// infinity loop if the setter itself is mutating things that
|
|
1603
|
+
// were accessed during the previous invocation.
|
|
1604
|
+
this.debouncing = false;
|
|
1605
|
+
if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && idx > 0) {
|
|
1606
|
+
// immediate rehydration due to a setter driven mutation, otherwise
|
|
1607
|
+
// the component will get rendered on the second tick, which it is not
|
|
1608
|
+
// desirable.
|
|
1609
|
+
rerenderVM(vm);
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
});
|
|
1613
|
+
}
|
|
1614
|
+
});
|
|
1615
|
+
this.debouncing = false;
|
|
1616
|
+
}
|
|
1617
|
+
reset(value) {
|
|
1618
|
+
super.reset();
|
|
1619
|
+
this.debouncing = false;
|
|
1620
|
+
if (arguments.length > 0) {
|
|
1621
|
+
this.value = value;
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
function createAccessorReactiveObserver(vm, set) {
|
|
1626
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
1627
|
+
return new AccessorReactiveObserver(vm, set)
|
|
1628
|
+
;
|
|
1629
|
+
}
|
|
1570
1630
|
|
|
1571
1631
|
/*
|
|
1572
1632
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -1603,50 +1663,6 @@
|
|
|
1603
1663
|
configurable: true
|
|
1604
1664
|
};
|
|
1605
1665
|
}
|
|
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
1666
|
function createPublicAccessorDescriptor(key, descriptor) {
|
|
1651
1667
|
const {
|
|
1652
1668
|
get,
|
|
@@ -1674,7 +1690,7 @@
|
|
|
1674
1690
|
let ro = vm.oar[key];
|
|
1675
1691
|
|
|
1676
1692
|
if (isUndefined$1(ro)) {
|
|
1677
|
-
ro = vm.oar[key] =
|
|
1693
|
+
ro = vm.oar[key] = createAccessorReactiveObserver(vm, set);
|
|
1678
1694
|
} // every time we invoke this setter from outside (through this wrapper setter)
|
|
1679
1695
|
// we should reset the value and then debounce just in case there is a pending
|
|
1680
1696
|
// invocation the next tick that is not longer relevant since the value is changing
|
|
@@ -1704,7 +1720,7 @@
|
|
|
1704
1720
|
*/
|
|
1705
1721
|
function track(target) {
|
|
1706
1722
|
if (arguments.length === 1) {
|
|
1707
|
-
return
|
|
1723
|
+
return getReactiveProxy(target);
|
|
1708
1724
|
}
|
|
1709
1725
|
throw new Error();
|
|
1710
1726
|
}
|
|
@@ -1717,11 +1733,8 @@
|
|
|
1717
1733
|
},
|
|
1718
1734
|
set(newValue) {
|
|
1719
1735
|
const vm = getAssociatedVM(this);
|
|
1720
|
-
const reactiveOrAnyValue =
|
|
1721
|
-
|
|
1722
|
-
vm.cmpFields[key] = reactiveOrAnyValue;
|
|
1723
|
-
componentValueMutated(vm, key);
|
|
1724
|
-
}
|
|
1736
|
+
const reactiveOrAnyValue = getReactiveProxy(newValue);
|
|
1737
|
+
updateComponentValue(vm, key, reactiveOrAnyValue);
|
|
1725
1738
|
},
|
|
1726
1739
|
enumerable: true,
|
|
1727
1740
|
configurable: true,
|
|
@@ -1757,10 +1770,7 @@
|
|
|
1757
1770
|
* letting the author to do the wrong thing, but it will keep our
|
|
1758
1771
|
* system to be backward compatible.
|
|
1759
1772
|
*/
|
|
1760
|
-
|
|
1761
|
-
vm.cmpFields[key] = value;
|
|
1762
|
-
componentValueMutated(vm, key);
|
|
1763
|
-
}
|
|
1773
|
+
updateComponentValue(vm, key, value);
|
|
1764
1774
|
},
|
|
1765
1775
|
enumerable: true,
|
|
1766
1776
|
configurable: true,
|
|
@@ -1970,7 +1980,7 @@
|
|
|
1970
1980
|
fn = cachedSetterByKey[key] = function (newValue) {
|
|
1971
1981
|
const vm = getAssociatedVM(this);
|
|
1972
1982
|
const { setHook } = vm;
|
|
1973
|
-
newValue =
|
|
1983
|
+
newValue = getReadOnlyProxy(newValue);
|
|
1974
1984
|
setHook(vm.component, key, newValue);
|
|
1975
1985
|
};
|
|
1976
1986
|
}
|
|
@@ -2429,13 +2439,13 @@
|
|
|
2429
2439
|
return owner;
|
|
2430
2440
|
}
|
|
2431
2441
|
function createStylesheet(vm, stylesheets) {
|
|
2432
|
-
const { renderMode, shadowMode, renderer: {
|
|
2442
|
+
const { renderMode, shadowMode, renderer: { insertStylesheet }, } = vm;
|
|
2433
2443
|
if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
2434
2444
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
2435
2445
|
insertStylesheet(stylesheets[i]);
|
|
2436
2446
|
}
|
|
2437
2447
|
}
|
|
2438
|
-
else if (
|
|
2448
|
+
else if (vm.hydrated) {
|
|
2439
2449
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
2440
2450
|
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
2441
2451
|
// the first time the VM renders.
|
|
@@ -2732,7 +2742,7 @@
|
|
|
2732
2742
|
updateStaticChildren(c1, c2, parent, renderer);
|
|
2733
2743
|
}
|
|
2734
2744
|
}
|
|
2735
|
-
function patch(n1, n2, renderer) {
|
|
2745
|
+
function patch(n1, n2, parent, renderer) {
|
|
2736
2746
|
var _a, _b;
|
|
2737
2747
|
if (n1 === n2) {
|
|
2738
2748
|
return;
|
|
@@ -2753,7 +2763,7 @@
|
|
|
2753
2763
|
patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
2754
2764
|
break;
|
|
2755
2765
|
case 3 /* VNodeType.CustomElement */:
|
|
2756
|
-
patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
2766
|
+
patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
2757
2767
|
break;
|
|
2758
2768
|
}
|
|
2759
2769
|
}
|
|
@@ -2814,10 +2824,10 @@
|
|
|
2814
2824
|
const { sel, owner, data: { svg }, } = vnode;
|
|
2815
2825
|
const { createElement } = renderer;
|
|
2816
2826
|
const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
2817
|
-
const elm = createElement(sel, namespace);
|
|
2827
|
+
const elm = (vnode.elm = createElement(sel, namespace));
|
|
2818
2828
|
linkNodeToShadow(elm, owner, renderer);
|
|
2819
|
-
|
|
2820
|
-
|
|
2829
|
+
applyStyleScoping(elm, owner, renderer);
|
|
2830
|
+
applyDomManual(elm, vnode);
|
|
2821
2831
|
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
2822
2832
|
insertNode(elm, parent, anchor, renderer);
|
|
2823
2833
|
mountVNodes(vnode.children, elm, renderer, null);
|
|
@@ -2855,9 +2865,10 @@
|
|
|
2855
2865
|
// the custom element from the registry is expecting an upgrade callback
|
|
2856
2866
|
vm = createViewModelHook(elm, vnode, renderer);
|
|
2857
2867
|
});
|
|
2858
|
-
linkNodeToShadow(elm, owner, renderer);
|
|
2859
2868
|
vnode.elm = elm;
|
|
2860
2869
|
vnode.vm = vm;
|
|
2870
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
2871
|
+
applyStyleScoping(elm, owner, renderer);
|
|
2861
2872
|
if (vm) {
|
|
2862
2873
|
allocateChildren(vnode, vm);
|
|
2863
2874
|
}
|
|
@@ -2874,22 +2885,32 @@
|
|
|
2874
2885
|
appendVM(vm);
|
|
2875
2886
|
}
|
|
2876
2887
|
}
|
|
2877
|
-
function patchCustomElement(n1, n2, renderer) {
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
allocateChildren(n2, vm);
|
|
2888
|
+
function patchCustomElement(n1, n2, parent, renderer) {
|
|
2889
|
+
if (n1.ctor !== n2.ctor) {
|
|
2890
|
+
// If the constructor, unmount the current component and mount a new one using the new
|
|
2891
|
+
// constructor.
|
|
2892
|
+
const anchor = renderer.nextSibling(n1.elm);
|
|
2893
|
+
unmount(n1, parent, renderer, true);
|
|
2894
|
+
mountCustomElement(n2, parent, anchor, renderer);
|
|
2885
2895
|
}
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2896
|
+
else {
|
|
2897
|
+
// Otherwise patch the existing component with new props/attrs/etc.
|
|
2898
|
+
const elm = (n2.elm = n1.elm);
|
|
2899
|
+
const vm = (n2.vm = n1.vm);
|
|
2900
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
2901
|
+
if (!isUndefined$1(vm)) {
|
|
2902
|
+
// in fallback mode, the allocation will always set children to
|
|
2903
|
+
// empty and delegate the real allocation to the slot elements
|
|
2904
|
+
allocateChildren(n2, vm);
|
|
2905
|
+
}
|
|
2906
|
+
// in fallback mode, the children will be always empty, so, nothing
|
|
2907
|
+
// will happen, but in native, it does allocate the light dom
|
|
2908
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
2909
|
+
if (!isUndefined$1(vm)) {
|
|
2910
|
+
// this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
2911
|
+
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
2912
|
+
rerenderVM(vm);
|
|
2913
|
+
}
|
|
2893
2914
|
}
|
|
2894
2915
|
}
|
|
2895
2916
|
function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
|
|
@@ -2938,22 +2959,6 @@
|
|
|
2938
2959
|
function isVNode(vnode) {
|
|
2939
2960
|
return vnode != null;
|
|
2940
2961
|
}
|
|
2941
|
-
function observeElementChildNodes(elm) {
|
|
2942
|
-
elm.$domManual$ = true;
|
|
2943
|
-
}
|
|
2944
|
-
function setElementShadowToken(elm, token) {
|
|
2945
|
-
elm.$shadowToken$ = token;
|
|
2946
|
-
}
|
|
2947
|
-
// Set the scope token class for *.scoped.css styles
|
|
2948
|
-
function setScopeTokenClassIfNecessary(elm, owner, renderer) {
|
|
2949
|
-
const token = getScopeTokenClass(owner);
|
|
2950
|
-
if (!isNull(token)) {
|
|
2951
|
-
const { getClassList } = renderer;
|
|
2952
|
-
// TODO [#2762]: this dot notation with add is probably problematic
|
|
2953
|
-
// probably we should have a renderer api for just the add operation
|
|
2954
|
-
getClassList(elm).add(token);
|
|
2955
|
-
}
|
|
2956
|
-
}
|
|
2957
2962
|
function linkNodeToShadow(elm, owner, renderer) {
|
|
2958
2963
|
const { renderRoot, renderMode, shadowMode } = owner;
|
|
2959
2964
|
const { isSyntheticShadowDefined } = renderer;
|
|
@@ -2988,23 +2993,26 @@
|
|
|
2988
2993
|
patchAttributes(oldVnode, vnode, renderer);
|
|
2989
2994
|
patchProps(oldVnode, vnode, renderer);
|
|
2990
2995
|
}
|
|
2991
|
-
function
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
if (
|
|
2995
|
-
const {
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
2996
|
+
function applyStyleScoping(elm, owner, renderer) {
|
|
2997
|
+
// Set the class name for `*.scoped.css` style scoping.
|
|
2998
|
+
const scopeToken = getScopeTokenClass(owner);
|
|
2999
|
+
if (!isNull(scopeToken)) {
|
|
3000
|
+
const { getClassList } = renderer;
|
|
3001
|
+
// TODO [#2762]: this dot notation with add is probably problematic
|
|
3002
|
+
// probably we should have a renderer api for just the add operation
|
|
3003
|
+
getClassList(elm).add(scopeToken);
|
|
3004
|
+
}
|
|
3005
|
+
// Set property element for synthetic shadow DOM style scoping.
|
|
3006
|
+
const { stylesheetToken: syntheticToken } = owner.context;
|
|
3007
|
+
if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ && !isUndefined$1(syntheticToken)) {
|
|
3008
|
+
elm.$shadowToken$ = syntheticToken;
|
|
3009
|
+
}
|
|
3010
|
+
}
|
|
3011
|
+
function applyDomManual(elm, vnode) {
|
|
3012
|
+
var _a;
|
|
3013
|
+
const { owner, data: { context }, } = vnode;
|
|
3014
|
+
if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ && ((_a = context === null || context === void 0 ? void 0 : context.lwc) === null || _a === void 0 ? void 0 : _a.dom) === "manual" /* LwcDomMode.Manual */) {
|
|
3015
|
+
elm.$domManual$ = true;
|
|
3008
3016
|
}
|
|
3009
3017
|
}
|
|
3010
3018
|
function allocateChildren(vnode, vm) {
|
|
@@ -3039,15 +3047,6 @@
|
|
|
3039
3047
|
return vm;
|
|
3040
3048
|
}
|
|
3041
3049
|
const { sel, mode, ctor, owner } = vnode;
|
|
3042
|
-
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
3043
|
-
if (owner.shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
3044
|
-
const { stylesheetToken } = owner.context;
|
|
3045
|
-
// when running in synthetic shadow mode, we need to set the shadowToken value
|
|
3046
|
-
// into each element from the template, so they can be styled accordingly.
|
|
3047
|
-
if (!isUndefined$1(stylesheetToken)) {
|
|
3048
|
-
setElementShadowToken(elm, stylesheetToken);
|
|
3049
|
-
}
|
|
3050
|
-
}
|
|
3051
3050
|
vm = createVM(elm, ctor, renderer, {
|
|
3052
3051
|
mode,
|
|
3053
3052
|
owner,
|
|
@@ -3149,25 +3148,25 @@
|
|
|
3149
3148
|
newEndVnode = newCh[--newEndIdx];
|
|
3150
3149
|
}
|
|
3151
3150
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
3152
|
-
patch(oldStartVnode, newStartVnode, renderer);
|
|
3151
|
+
patch(oldStartVnode, newStartVnode, parent, renderer);
|
|
3153
3152
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
3154
3153
|
newStartVnode = newCh[++newStartIdx];
|
|
3155
3154
|
}
|
|
3156
3155
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
3157
|
-
patch(oldEndVnode, newEndVnode, renderer);
|
|
3156
|
+
patch(oldEndVnode, newEndVnode, parent, renderer);
|
|
3158
3157
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
3159
3158
|
newEndVnode = newCh[--newEndIdx];
|
|
3160
3159
|
}
|
|
3161
3160
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
3162
3161
|
// Vnode moved right
|
|
3163
|
-
patch(oldStartVnode, newEndVnode, renderer);
|
|
3162
|
+
patch(oldStartVnode, newEndVnode, parent, renderer);
|
|
3164
3163
|
insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
|
|
3165
3164
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
3166
3165
|
newEndVnode = newCh[--newEndIdx];
|
|
3167
3166
|
}
|
|
3168
3167
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
3169
3168
|
// Vnode moved left
|
|
3170
|
-
patch(oldEndVnode, newStartVnode, renderer);
|
|
3169
|
+
patch(oldEndVnode, newStartVnode, parent, renderer);
|
|
3171
3170
|
insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
|
|
3172
3171
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
3173
3172
|
newStartVnode = newCh[++newStartIdx];
|
|
@@ -3190,7 +3189,7 @@
|
|
|
3190
3189
|
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
3191
3190
|
}
|
|
3192
3191
|
else {
|
|
3193
|
-
patch(elmToMove, newStartVnode, renderer);
|
|
3192
|
+
patch(elmToMove, newStartVnode, parent, renderer);
|
|
3194
3193
|
// Delete the old child, but copy the array since it is read-only.
|
|
3195
3194
|
// The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
|
|
3196
3195
|
// so we only care about the `oldCh` object inside this function.
|
|
@@ -3250,7 +3249,7 @@
|
|
|
3250
3249
|
if (isVNode(n1)) {
|
|
3251
3250
|
if (isVNode(n2)) {
|
|
3252
3251
|
// both vnodes are equivalent, and we just need to patch them
|
|
3253
|
-
patch(n1, n2, renderer);
|
|
3252
|
+
patch(n1, n2, parent, renderer);
|
|
3254
3253
|
anchor = n2.elm;
|
|
3255
3254
|
}
|
|
3256
3255
|
else {
|
|
@@ -3479,13 +3478,6 @@
|
|
|
3479
3478
|
}
|
|
3480
3479
|
return url;
|
|
3481
3480
|
}
|
|
3482
|
-
/**
|
|
3483
|
-
* Map to store an index value assigned to any dynamic component reference ingested
|
|
3484
|
-
* by dc() api. This allows us to generate a unique unique per template per dynamic
|
|
3485
|
-
* component reference to avoid diffing algo mismatches.
|
|
3486
|
-
*/
|
|
3487
|
-
const DynamicImportedComponentMap = new Map();
|
|
3488
|
-
let dynamicImportedComponentCounter = 0;
|
|
3489
3481
|
/**
|
|
3490
3482
|
* create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
|
|
3491
3483
|
*/
|
|
@@ -3497,18 +3489,7 @@
|
|
|
3497
3489
|
if (!isComponentConstructor(Ctor)) {
|
|
3498
3490
|
throw new Error(`Invalid LWC Constructor ${toString$1(Ctor)} for custom element <${sel}>.`);
|
|
3499
3491
|
}
|
|
3500
|
-
|
|
3501
|
-
if (isUndefined$1(idx)) {
|
|
3502
|
-
idx = dynamicImportedComponentCounter++;
|
|
3503
|
-
DynamicImportedComponentMap.set(Ctor, idx);
|
|
3504
|
-
}
|
|
3505
|
-
// the new vnode key is a mix of idx and compiler key, this is required by the diffing algo
|
|
3506
|
-
// to identify different constructors as vnodes with different keys to avoid reusing the
|
|
3507
|
-
// element used for previous constructors.
|
|
3508
|
-
// Shallow clone is necessary here becuase VElementData may be shared across VNodes due to
|
|
3509
|
-
// hoisting optimization.
|
|
3510
|
-
const newData = Object.assign(Object.assign({}, data), { key: `dc:${idx}:${data.key}` });
|
|
3511
|
-
return c(sel, Ctor, newData, children);
|
|
3492
|
+
return c(sel, Ctor, data, children);
|
|
3512
3493
|
}
|
|
3513
3494
|
/**
|
|
3514
3495
|
* slow children collection marking mechanism. this API allows the compiler to signal
|
|
@@ -3864,7 +3845,7 @@
|
|
|
3864
3845
|
return signedTemplateMap.get(Ctor);
|
|
3865
3846
|
}
|
|
3866
3847
|
function getTemplateReactiveObserver(vm) {
|
|
3867
|
-
return
|
|
3848
|
+
return createReactiveObserver(() => {
|
|
3868
3849
|
const { isDirty } = vm;
|
|
3869
3850
|
if (isFalse(isDirty)) {
|
|
3870
3851
|
markComponentAsDirty(vm);
|
|
@@ -4228,16 +4209,9 @@
|
|
|
4228
4209
|
const {
|
|
4229
4210
|
def: {
|
|
4230
4211
|
renderedCallback
|
|
4231
|
-
},
|
|
4232
|
-
renderer: {
|
|
4233
|
-
ssr
|
|
4234
4212
|
}
|
|
4235
4213
|
} = vm;
|
|
4236
4214
|
|
|
4237
|
-
if (isTrue(ssr)) {
|
|
4238
|
-
return;
|
|
4239
|
-
}
|
|
4240
|
-
|
|
4241
4215
|
const {
|
|
4242
4216
|
rendered
|
|
4243
4217
|
} = Services;
|
|
@@ -4478,13 +4452,7 @@
|
|
|
4478
4452
|
vm.velements = EmptyArray;
|
|
4479
4453
|
}
|
|
4480
4454
|
function scheduleRehydration(vm) {
|
|
4481
|
-
|
|
4482
|
-
renderer: {
|
|
4483
|
-
ssr
|
|
4484
|
-
}
|
|
4485
|
-
} = vm;
|
|
4486
|
-
|
|
4487
|
-
if (isTrue(ssr) || isTrue(vm.isScheduled)) {
|
|
4455
|
+
if (isTrue(vm.isScheduled)) {
|
|
4488
4456
|
return;
|
|
4489
4457
|
}
|
|
4490
4458
|
|
|
@@ -4574,15 +4542,8 @@
|
|
|
4574
4542
|
}
|
|
4575
4543
|
|
|
4576
4544
|
function createFieldDataCallback(vm, name) {
|
|
4577
|
-
const {
|
|
4578
|
-
cmpFields
|
|
4579
|
-
} = vm;
|
|
4580
4545
|
return value => {
|
|
4581
|
-
|
|
4582
|
-
// storing the value in the underlying storage
|
|
4583
|
-
cmpFields[name] = value;
|
|
4584
|
-
componentValueMutated(vm, name);
|
|
4585
|
-
}
|
|
4546
|
+
updateComponentValue(vm, name, value);
|
|
4586
4547
|
};
|
|
4587
4548
|
}
|
|
4588
4549
|
|
|
@@ -4599,7 +4560,7 @@
|
|
|
4599
4560
|
function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
|
|
4600
4561
|
let hasPendingConfig = false; // creating the reactive observer for reactive params when needed
|
|
4601
4562
|
|
|
4602
|
-
const ro =
|
|
4563
|
+
const ro = createReactiveObserver(() => {
|
|
4603
4564
|
if (hasPendingConfig === false) {
|
|
4604
4565
|
hasPendingConfig = true; // collect new config in the micro-task
|
|
4605
4566
|
|
|
@@ -4885,7 +4846,7 @@
|
|
|
4885
4846
|
* being removed.
|
|
4886
4847
|
*/
|
|
4887
4848
|
function readonly(obj) {
|
|
4888
|
-
return
|
|
4849
|
+
return getReadOnlyProxy(obj);
|
|
4889
4850
|
}
|
|
4890
4851
|
|
|
4891
4852
|
/*
|
|
@@ -5237,7 +5198,7 @@
|
|
|
5237
5198
|
}
|
|
5238
5199
|
return ctor;
|
|
5239
5200
|
}
|
|
5240
|
-
/* version: 2.
|
|
5201
|
+
/* version: 2.23.0 */
|
|
5241
5202
|
|
|
5242
5203
|
/*
|
|
5243
5204
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5372,6 +5333,69 @@
|
|
|
5372
5333
|
}
|
|
5373
5334
|
}
|
|
5374
5335
|
|
|
5336
|
+
/*
|
|
5337
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
5338
|
+
* All rights reserved.
|
|
5339
|
+
* SPDX-License-Identifier: MIT
|
|
5340
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5341
|
+
*/
|
|
5342
|
+
const SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
|
|
5343
|
+
let createFragment;
|
|
5344
|
+
if (SUPPORTS_TEMPLATE) {
|
|
5345
|
+
// Parse the fragment HTML string into DOM
|
|
5346
|
+
createFragment = function (html) {
|
|
5347
|
+
const template = document.createElement('template');
|
|
5348
|
+
template.innerHTML = html;
|
|
5349
|
+
return template.content.firstChild;
|
|
5350
|
+
};
|
|
5351
|
+
}
|
|
5352
|
+
else {
|
|
5353
|
+
// In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
|
|
5354
|
+
// <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
|
|
5355
|
+
// Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
|
|
5356
|
+
// With other elements added from:
|
|
5357
|
+
// https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
|
|
5358
|
+
// Using the test:
|
|
5359
|
+
// document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
|
|
5360
|
+
// And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
|
|
5361
|
+
const topLevelWrappingMap = {
|
|
5362
|
+
caption: ['table'],
|
|
5363
|
+
col: ['colgroup', 'table'],
|
|
5364
|
+
colgroup: ['table'],
|
|
5365
|
+
option: ['select'],
|
|
5366
|
+
tbody: ['table'],
|
|
5367
|
+
td: ['tr', 'tbody', 'table'],
|
|
5368
|
+
th: ['tr', 'tbody', 'table'],
|
|
5369
|
+
thead: ['table'],
|
|
5370
|
+
tfoot: ['table'],
|
|
5371
|
+
tr: ['tbody', 'table'],
|
|
5372
|
+
};
|
|
5373
|
+
// Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
|
|
5374
|
+
const getTagName = function (text) {
|
|
5375
|
+
return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
|
|
5376
|
+
};
|
|
5377
|
+
// Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
|
|
5378
|
+
createFragment = function (html) {
|
|
5379
|
+
const wrapperTags = topLevelWrappingMap[getTagName(html)];
|
|
5380
|
+
if (!isUndefined$1(wrapperTags)) {
|
|
5381
|
+
for (const wrapperTag of wrapperTags) {
|
|
5382
|
+
html = `<${wrapperTag}>${html}</${wrapperTag}>`;
|
|
5383
|
+
}
|
|
5384
|
+
}
|
|
5385
|
+
// For IE11, the document title must not be undefined, but it can be an empty string
|
|
5386
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
|
|
5387
|
+
const doc = document.implementation.createHTMLDocument('');
|
|
5388
|
+
doc.body.innerHTML = html;
|
|
5389
|
+
let content = doc.body;
|
|
5390
|
+
if (!isUndefined$1(wrapperTags)) {
|
|
5391
|
+
for (let i = 0; i < wrapperTags.length; i++) {
|
|
5392
|
+
content = content.firstChild;
|
|
5393
|
+
}
|
|
5394
|
+
}
|
|
5395
|
+
return content.firstChild;
|
|
5396
|
+
};
|
|
5397
|
+
}
|
|
5398
|
+
|
|
5375
5399
|
/*
|
|
5376
5400
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
5377
5401
|
* All rights reserved.
|
|
@@ -5437,22 +5461,11 @@
|
|
|
5437
5461
|
};
|
|
5438
5462
|
HTMLElementConstructor.prototype = HTMLElement.prototype;
|
|
5439
5463
|
}
|
|
5440
|
-
let hydrating = false;
|
|
5441
|
-
function setIsHydrating(value) {
|
|
5442
|
-
hydrating = value;
|
|
5443
|
-
}
|
|
5444
|
-
const ssr = false;
|
|
5445
|
-
function isHydrating() {
|
|
5446
|
-
return hydrating;
|
|
5447
|
-
}
|
|
5448
5464
|
const isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
|
|
5449
5465
|
const isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
|
|
5450
5466
|
function cloneNode(node, deep) {
|
|
5451
5467
|
return node.cloneNode(deep);
|
|
5452
5468
|
}
|
|
5453
|
-
function createFragment(html) {
|
|
5454
|
-
return document.createRange().createContextualFragment(html).firstChild;
|
|
5455
|
-
}
|
|
5456
5469
|
function createElement$1(tagName, namespace) {
|
|
5457
5470
|
return isUndefined$1(namespace)
|
|
5458
5471
|
? document.createElement(tagName)
|
|
@@ -5474,15 +5487,11 @@
|
|
|
5474
5487
|
return node.nextSibling;
|
|
5475
5488
|
}
|
|
5476
5489
|
function attachShadow(element, options) {
|
|
5477
|
-
// `
|
|
5490
|
+
// `shadowRoot` will be non-null in two cases:
|
|
5478
5491
|
// 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
|
|
5479
5492
|
// 2. when a webapp author places <c-app> in their static HTML and mounts their
|
|
5480
|
-
// root component with
|
|
5481
|
-
|
|
5482
|
-
// The second case can be treated as a failed hydration with nominal impact
|
|
5483
|
-
// to performance. However, because <c-app> won't have a <template shadowroot>
|
|
5484
|
-
// declarative child, `element.shadowRoot` is `null`.
|
|
5485
|
-
if (hydrating && element.shadowRoot) {
|
|
5493
|
+
// root component with customElement.define('c-app', Ctor)
|
|
5494
|
+
if (!isNull(element.shadowRoot)) {
|
|
5486
5495
|
return element.shadowRoot;
|
|
5487
5496
|
}
|
|
5488
5497
|
return element.attachShadow(options);
|
|
@@ -5572,11 +5581,9 @@
|
|
|
5572
5581
|
}
|
|
5573
5582
|
const HTMLElementExported = HTMLElementConstructor;
|
|
5574
5583
|
const renderer = {
|
|
5575
|
-
ssr,
|
|
5576
5584
|
isNativeShadowDefined,
|
|
5577
5585
|
isSyntheticShadowDefined,
|
|
5578
5586
|
HTMLElementExported,
|
|
5579
|
-
isHydrating,
|
|
5580
5587
|
insert,
|
|
5581
5588
|
remove,
|
|
5582
5589
|
cloneNode,
|
|
@@ -5662,13 +5669,8 @@
|
|
|
5662
5669
|
return;
|
|
5663
5670
|
}
|
|
5664
5671
|
try {
|
|
5665
|
-
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
5666
|
-
// and uses the same algo to create the stylesheets as in SSR.
|
|
5667
|
-
setIsHydrating(true);
|
|
5668
5672
|
const vm = createVMWithProps(element, Ctor, props);
|
|
5669
5673
|
hydrateRoot(vm);
|
|
5670
|
-
// set it back since now we finished hydration.
|
|
5671
|
-
setIsHydrating(false);
|
|
5672
5674
|
}
|
|
5673
5675
|
catch (e) {
|
|
5674
5676
|
// Fallback: In case there's an error while hydrating, let's log the error, and replace the element content
|
|
@@ -5679,13 +5681,8 @@
|
|
|
5679
5681
|
resetShadowRootAndLightDom(element, Ctor);
|
|
5680
5682
|
// we need to recreate the vm with the hydration flag on, so it re-uses the existing shadowRoot.
|
|
5681
5683
|
createVMWithProps(element, Ctor, props);
|
|
5682
|
-
setIsHydrating(false);
|
|
5683
5684
|
connectRootElement(element);
|
|
5684
5685
|
}
|
|
5685
|
-
finally {
|
|
5686
|
-
// in case there's an error during recovery
|
|
5687
|
-
setIsHydrating(false);
|
|
5688
|
-
}
|
|
5689
5686
|
}
|
|
5690
5687
|
|
|
5691
5688
|
/*
|
|
@@ -5902,7 +5899,7 @@
|
|
|
5902
5899
|
});
|
|
5903
5900
|
freeze(LightningElement);
|
|
5904
5901
|
seal(LightningElement.prototype);
|
|
5905
|
-
/* version: 2.
|
|
5902
|
+
/* version: 2.23.0 */
|
|
5906
5903
|
|
|
5907
5904
|
exports.LightningElement = LightningElement;
|
|
5908
5905
|
exports.__unstable__ProfilerControl = profilerControl;
|