lwc 2.5.6 → 2.5.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine-dom/esm/es2017/engine-dom.js +605 -181
- package/dist/engine-dom/iife/es2017/engine-dom.js +605 -181
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +406 -169
- package/dist/engine-dom/iife/es5/engine-dom.js +684 -242
- package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +466 -221
- package/dist/engine-dom/umd/es2017/engine-dom.js +605 -181
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +406 -169
- package/dist/engine-dom/umd/es5/engine-dom.js +684 -242
- package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +466 -221
- package/dist/engine-server/commonjs/es2017/engine-server.js +484 -133
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
- package/dist/engine-server/esm/es2017/engine-server.js +485 -133
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es5/wire-service.js +2 -2
- package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es5/wire-service.js +2 -2
- package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
- package/package.json +8 -8
|
@@ -72,7 +72,7 @@ var LWC = (function (exports) {
|
|
|
72
72
|
find: ArrayFind,
|
|
73
73
|
indexOf: ArrayIndexOf,
|
|
74
74
|
join: ArrayJoin,
|
|
75
|
-
map: ArrayMap
|
|
75
|
+
map: ArrayMap,
|
|
76
76
|
push: ArrayPush$1,
|
|
77
77
|
reduce: ArrayReduce,
|
|
78
78
|
reverse: ArrayReverse,
|
|
@@ -135,7 +135,7 @@ var LWC = (function (exports) {
|
|
|
135
135
|
// Array.prototype.toString directly will cause an error Iterate through
|
|
136
136
|
// all the items and handle individually.
|
|
137
137
|
if (isArray$1(obj)) {
|
|
138
|
-
return ArrayJoin.call(ArrayMap
|
|
138
|
+
return ArrayJoin.call(ArrayMap.call(obj, toString$1), ',');
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
return obj.toString();
|
|
@@ -298,7 +298,7 @@ var LWC = (function (exports) {
|
|
|
298
298
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
299
299
|
return attributeName;
|
|
300
300
|
}
|
|
301
|
-
/** version: 2.5.
|
|
301
|
+
/** version: 2.5.10 */
|
|
302
302
|
|
|
303
303
|
/*
|
|
304
304
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -470,7 +470,7 @@ var LWC = (function (exports) {
|
|
|
470
470
|
|
|
471
471
|
function setFeatureFlagForTest(name, value) {
|
|
472
472
|
}
|
|
473
|
-
/** version: 2.5.
|
|
473
|
+
/** version: 2.5.10 */
|
|
474
474
|
|
|
475
475
|
/* proxy-compat-disable */
|
|
476
476
|
|
|
@@ -512,7 +512,7 @@ var LWC = (function (exports) {
|
|
|
512
512
|
}
|
|
513
513
|
|
|
514
514
|
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
515
|
-
}
|
|
515
|
+
} // Borrowed from Vue template compiler.
|
|
516
516
|
/*
|
|
517
517
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
518
518
|
* All rights reserved.
|
|
@@ -660,6 +660,20 @@ var LWC = (function (exports) {
|
|
|
660
660
|
return `<${StringToLowerCase.call(vm.tagName)}>`;
|
|
661
661
|
} // TODO [#1695]: Unify getComponentStack and getErrorComponentStack
|
|
662
662
|
|
|
663
|
+
|
|
664
|
+
function getComponentStack(vm) {
|
|
665
|
+
const stack = [];
|
|
666
|
+
let prefix = '';
|
|
667
|
+
|
|
668
|
+
while (!isNull(vm.owner)) {
|
|
669
|
+
ArrayPush$1.call(stack, prefix + getComponentTag(vm));
|
|
670
|
+
vm = vm.owner;
|
|
671
|
+
prefix += '\t';
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
return ArrayJoin.call(stack, '\n');
|
|
675
|
+
}
|
|
676
|
+
|
|
663
677
|
function getErrorComponentStack(vm) {
|
|
664
678
|
const wcStack = [];
|
|
665
679
|
let currentVm = vm;
|
|
@@ -679,6 +693,32 @@ var LWC = (function (exports) {
|
|
|
679
693
|
*/
|
|
680
694
|
|
|
681
695
|
|
|
696
|
+
function log(method, message, vm) {
|
|
697
|
+
let msg = `[LWC ${method}]: ${message}`;
|
|
698
|
+
|
|
699
|
+
if (!isUndefined$1(vm)) {
|
|
700
|
+
msg = `${msg}\n${getComponentStack(vm)}`;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
try {
|
|
704
|
+
throw new Error(msg);
|
|
705
|
+
} catch (e) {
|
|
706
|
+
/* eslint-disable-next-line no-console */
|
|
707
|
+
console[method](e);
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
function logWarn(message, vm) {
|
|
712
|
+
log('warn', message, vm);
|
|
713
|
+
}
|
|
714
|
+
/*
|
|
715
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
716
|
+
* All rights reserved.
|
|
717
|
+
* SPDX-License-Identifier: MIT
|
|
718
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
719
|
+
*/
|
|
720
|
+
|
|
721
|
+
|
|
682
722
|
function handleEvent(event, vnode) {
|
|
683
723
|
const {
|
|
684
724
|
type
|
|
@@ -1456,7 +1496,6 @@ var LWC = (function (exports) {
|
|
|
1456
1496
|
getPrototypeOf,
|
|
1457
1497
|
create: ObjectCreate,
|
|
1458
1498
|
defineProperty: ObjectDefineProperty,
|
|
1459
|
-
defineProperties: ObjectDefineProperties,
|
|
1460
1499
|
isExtensible,
|
|
1461
1500
|
getOwnPropertyDescriptor,
|
|
1462
1501
|
getOwnPropertyNames,
|
|
@@ -1466,8 +1505,7 @@ var LWC = (function (exports) {
|
|
|
1466
1505
|
} = Object;
|
|
1467
1506
|
const {
|
|
1468
1507
|
push: ArrayPush,
|
|
1469
|
-
concat: ArrayConcat
|
|
1470
|
-
map: ArrayMap
|
|
1508
|
+
concat: ArrayConcat
|
|
1471
1509
|
} = Array.prototype;
|
|
1472
1510
|
|
|
1473
1511
|
function isUndefined(obj) {
|
|
@@ -1521,7 +1559,9 @@ var LWC = (function (exports) {
|
|
|
1521
1559
|
// but it will always be compatible with the previous descriptor
|
|
1522
1560
|
// to preserve the object invariants, which makes these lines safe.
|
|
1523
1561
|
|
|
1524
|
-
const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key);
|
|
1562
|
+
const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key); // TODO: it should be impossible for the originalDescriptor to ever be undefined, this `if` can be removed
|
|
1563
|
+
|
|
1564
|
+
/* istanbul ignore else */
|
|
1525
1565
|
|
|
1526
1566
|
if (!isUndefined(originalDescriptor)) {
|
|
1527
1567
|
const wrappedDesc = this.wrapDescriptor(originalDescriptor);
|
|
@@ -1549,11 +1589,17 @@ var LWC = (function (exports) {
|
|
|
1549
1589
|
|
|
1550
1590
|
preventExtensions(shadowTarget);
|
|
1551
1591
|
} // Shared Traps
|
|
1592
|
+
// TODO: apply() is never called
|
|
1593
|
+
|
|
1594
|
+
/* istanbul ignore next */
|
|
1552
1595
|
|
|
1553
1596
|
|
|
1554
1597
|
apply(shadowTarget, thisArg, argArray) {
|
|
1555
1598
|
/* No op */
|
|
1556
|
-
}
|
|
1599
|
+
} // TODO: construct() is never called
|
|
1600
|
+
|
|
1601
|
+
/* istanbul ignore next */
|
|
1602
|
+
|
|
1557
1603
|
|
|
1558
1604
|
construct(shadowTarget, argArray, newTarget) {
|
|
1559
1605
|
/* No op */
|
|
@@ -1666,8 +1712,8 @@ var LWC = (function (exports) {
|
|
|
1666
1712
|
|
|
1667
1713
|
}
|
|
1668
1714
|
|
|
1669
|
-
const getterMap = new WeakMap();
|
|
1670
|
-
const setterMap = new WeakMap();
|
|
1715
|
+
const getterMap$1 = new WeakMap();
|
|
1716
|
+
const setterMap$1 = new WeakMap();
|
|
1671
1717
|
const reverseGetterMap = new WeakMap();
|
|
1672
1718
|
const reverseSetterMap = new WeakMap();
|
|
1673
1719
|
|
|
@@ -1677,7 +1723,7 @@ var LWC = (function (exports) {
|
|
|
1677
1723
|
}
|
|
1678
1724
|
|
|
1679
1725
|
wrapGetter(originalGet) {
|
|
1680
|
-
const wrappedGetter = getterMap.get(originalGet);
|
|
1726
|
+
const wrappedGetter = getterMap$1.get(originalGet);
|
|
1681
1727
|
|
|
1682
1728
|
if (!isUndefined(wrappedGetter)) {
|
|
1683
1729
|
return wrappedGetter;
|
|
@@ -1690,13 +1736,13 @@ var LWC = (function (exports) {
|
|
|
1690
1736
|
return handler.wrapValue(originalGet.call(unwrap$1(this)));
|
|
1691
1737
|
};
|
|
1692
1738
|
|
|
1693
|
-
getterMap.set(originalGet, get);
|
|
1739
|
+
getterMap$1.set(originalGet, get);
|
|
1694
1740
|
reverseGetterMap.set(get, originalGet);
|
|
1695
1741
|
return get;
|
|
1696
1742
|
}
|
|
1697
1743
|
|
|
1698
1744
|
wrapSetter(originalSet) {
|
|
1699
|
-
const wrappedSetter = setterMap.get(originalSet);
|
|
1745
|
+
const wrappedSetter = setterMap$1.get(originalSet);
|
|
1700
1746
|
|
|
1701
1747
|
if (!isUndefined(wrappedSetter)) {
|
|
1702
1748
|
return wrappedSetter;
|
|
@@ -1707,7 +1753,7 @@ var LWC = (function (exports) {
|
|
|
1707
1753
|
originalSet.call(unwrap$1(this), unwrap$1(v));
|
|
1708
1754
|
};
|
|
1709
1755
|
|
|
1710
|
-
setterMap.set(originalSet, set);
|
|
1756
|
+
setterMap$1.set(originalSet, set);
|
|
1711
1757
|
reverseSetterMap.set(set, originalSet);
|
|
1712
1758
|
return set;
|
|
1713
1759
|
}
|
|
@@ -1748,7 +1794,7 @@ var LWC = (function (exports) {
|
|
|
1748
1794
|
return unwrap$1(redGet.call(handler.wrapValue(this)));
|
|
1749
1795
|
};
|
|
1750
1796
|
|
|
1751
|
-
getterMap.set(get, redGet);
|
|
1797
|
+
getterMap$1.set(get, redGet);
|
|
1752
1798
|
reverseGetterMap.set(redGet, get);
|
|
1753
1799
|
return get;
|
|
1754
1800
|
}
|
|
@@ -1767,7 +1813,7 @@ var LWC = (function (exports) {
|
|
|
1767
1813
|
redSet.call(handler.wrapValue(this), handler.wrapValue(v));
|
|
1768
1814
|
};
|
|
1769
1815
|
|
|
1770
|
-
setterMap.set(set, redSet);
|
|
1816
|
+
setterMap$1.set(set, redSet);
|
|
1771
1817
|
reverseSetterMap.set(redSet, set);
|
|
1772
1818
|
return set;
|
|
1773
1819
|
}
|
|
@@ -1818,6 +1864,11 @@ var LWC = (function (exports) {
|
|
|
1818
1864
|
preventExtensions(originalTarget); // if the originalTarget is a proxy itself, it might reject
|
|
1819
1865
|
// the preventExtension call, in which case we should not attempt to lock down
|
|
1820
1866
|
// the shadow target.
|
|
1867
|
+
// TODO: It should not actually be possible to reach this `if` statement.
|
|
1868
|
+
// If a proxy rejects extensions, then calling preventExtensions will throw an error:
|
|
1869
|
+
// https://codepen.io/nolanlawson-the-selector/pen/QWMOjbY
|
|
1870
|
+
|
|
1871
|
+
/* istanbul ignore if */
|
|
1821
1872
|
|
|
1822
1873
|
if (isExtensible(originalTarget)) {
|
|
1823
1874
|
return false;
|
|
@@ -1859,8 +1910,8 @@ var LWC = (function (exports) {
|
|
|
1859
1910
|
|
|
1860
1911
|
}
|
|
1861
1912
|
|
|
1862
|
-
const getterMap
|
|
1863
|
-
const setterMap
|
|
1913
|
+
const getterMap = new WeakMap();
|
|
1914
|
+
const setterMap = new WeakMap();
|
|
1864
1915
|
|
|
1865
1916
|
class ReadOnlyHandler extends BaseProxyHandler {
|
|
1866
1917
|
wrapValue(value) {
|
|
@@ -1868,7 +1919,7 @@ var LWC = (function (exports) {
|
|
|
1868
1919
|
}
|
|
1869
1920
|
|
|
1870
1921
|
wrapGetter(originalGet) {
|
|
1871
|
-
const wrappedGetter = getterMap
|
|
1922
|
+
const wrappedGetter = getterMap.get(originalGet);
|
|
1872
1923
|
|
|
1873
1924
|
if (!isUndefined(wrappedGetter)) {
|
|
1874
1925
|
return wrappedGetter;
|
|
@@ -1881,12 +1932,12 @@ var LWC = (function (exports) {
|
|
|
1881
1932
|
return handler.wrapValue(originalGet.call(unwrap$1(this)));
|
|
1882
1933
|
};
|
|
1883
1934
|
|
|
1884
|
-
getterMap
|
|
1935
|
+
getterMap.set(originalGet, get);
|
|
1885
1936
|
return get;
|
|
1886
1937
|
}
|
|
1887
1938
|
|
|
1888
1939
|
wrapSetter(originalSet) {
|
|
1889
|
-
const wrappedSetter = setterMap
|
|
1940
|
+
const wrappedSetter = setterMap.get(originalSet);
|
|
1890
1941
|
|
|
1891
1942
|
if (!isUndefined(wrappedSetter)) {
|
|
1892
1943
|
return wrappedSetter;
|
|
@@ -1895,16 +1946,20 @@ var LWC = (function (exports) {
|
|
|
1895
1946
|
const set = function (v) {
|
|
1896
1947
|
};
|
|
1897
1948
|
|
|
1898
|
-
setterMap
|
|
1949
|
+
setterMap.set(originalSet, set);
|
|
1899
1950
|
return set;
|
|
1900
1951
|
}
|
|
1901
1952
|
|
|
1902
1953
|
set(shadowTarget, key, value) {
|
|
1954
|
+
/* istanbul ignore next */
|
|
1955
|
+
|
|
1903
1956
|
|
|
1904
1957
|
return false;
|
|
1905
1958
|
}
|
|
1906
1959
|
|
|
1907
1960
|
deleteProperty(shadowTarget, key) {
|
|
1961
|
+
/* istanbul ignore next */
|
|
1962
|
+
|
|
1908
1963
|
|
|
1909
1964
|
return false;
|
|
1910
1965
|
}
|
|
@@ -1913,11 +1968,15 @@ var LWC = (function (exports) {
|
|
|
1913
1968
|
}
|
|
1914
1969
|
|
|
1915
1970
|
preventExtensions(shadowTarget) {
|
|
1971
|
+
/* istanbul ignore next */
|
|
1972
|
+
|
|
1916
1973
|
|
|
1917
1974
|
return false;
|
|
1918
1975
|
}
|
|
1919
1976
|
|
|
1920
1977
|
defineProperty(shadowTarget, key, descriptor) {
|
|
1978
|
+
/* istanbul ignore next */
|
|
1979
|
+
|
|
1921
1980
|
|
|
1922
1981
|
return false;
|
|
1923
1982
|
}
|
|
@@ -1965,7 +2024,8 @@ var LWC = (function (exports) {
|
|
|
1965
2024
|
this.valueMutated = defaultValueMutated;
|
|
1966
2025
|
this.valueObserved = defaultValueObserved;
|
|
1967
2026
|
this.valueIsObservable = defaultValueIsObservable;
|
|
1968
|
-
this.
|
|
2027
|
+
this.readOnlyObjectGraph = new WeakMap();
|
|
2028
|
+
this.reactiveObjectGraph = new WeakMap();
|
|
1969
2029
|
|
|
1970
2030
|
if (!isUndefined(options)) {
|
|
1971
2031
|
const {
|
|
@@ -1988,10 +2048,13 @@ var LWC = (function (exports) {
|
|
|
1988
2048
|
const distorted = this.valueDistortion(unwrappedValue);
|
|
1989
2049
|
|
|
1990
2050
|
if (this.valueIsObservable(distorted)) {
|
|
1991
|
-
|
|
1992
|
-
|
|
2051
|
+
if (this.readOnlyObjectGraph.get(distorted) === value) {
|
|
2052
|
+
// when trying to extract the writable version of a readonly
|
|
2053
|
+
// we return the readonly.
|
|
2054
|
+
return value;
|
|
2055
|
+
}
|
|
1993
2056
|
|
|
1994
|
-
return
|
|
2057
|
+
return this.getReactiveHandler(unwrappedValue, distorted);
|
|
1995
2058
|
}
|
|
1996
2059
|
|
|
1997
2060
|
return distorted;
|
|
@@ -2002,7 +2065,7 @@ var LWC = (function (exports) {
|
|
|
2002
2065
|
const distorted = this.valueDistortion(value);
|
|
2003
2066
|
|
|
2004
2067
|
if (this.valueIsObservable(distorted)) {
|
|
2005
|
-
return this.
|
|
2068
|
+
return this.getReadOnlyHandler(value, distorted);
|
|
2006
2069
|
}
|
|
2007
2070
|
|
|
2008
2071
|
return distorted;
|
|
@@ -2012,47 +2075,36 @@ var LWC = (function (exports) {
|
|
|
2012
2075
|
return unwrap$1(p);
|
|
2013
2076
|
}
|
|
2014
2077
|
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
objectGraph
|
|
2018
|
-
} = this;
|
|
2019
|
-
let reactiveState = objectGraph.get(distortedValue);
|
|
2078
|
+
getReactiveHandler(value, distortedValue) {
|
|
2079
|
+
let proxy = this.reactiveObjectGraph.get(distortedValue);
|
|
2020
2080
|
|
|
2021
|
-
if (
|
|
2022
|
-
|
|
2081
|
+
if (isUndefined(proxy)) {
|
|
2082
|
+
// caching the proxy after the first time it is accessed
|
|
2083
|
+
const handler = new ReactiveProxyHandler(this, distortedValue);
|
|
2084
|
+
proxy = new Proxy(createShadowTarget(distortedValue), handler);
|
|
2085
|
+
registerProxy(proxy, value);
|
|
2086
|
+
this.reactiveObjectGraph.set(distortedValue, proxy);
|
|
2023
2087
|
}
|
|
2024
2088
|
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
get reactive() {
|
|
2028
|
-
const reactiveHandler = new ReactiveProxyHandler(membrane, distortedValue); // caching the reactive proxy after the first time it is accessed
|
|
2029
|
-
|
|
2030
|
-
const proxy = new Proxy(createShadowTarget(distortedValue), reactiveHandler);
|
|
2031
|
-
registerProxy(proxy, value);
|
|
2032
|
-
ObjectDefineProperty(this, 'reactive', {
|
|
2033
|
-
value: proxy
|
|
2034
|
-
});
|
|
2035
|
-
return proxy;
|
|
2036
|
-
},
|
|
2089
|
+
return proxy;
|
|
2090
|
+
}
|
|
2037
2091
|
|
|
2038
|
-
|
|
2039
|
-
|
|
2092
|
+
getReadOnlyHandler(value, distortedValue) {
|
|
2093
|
+
let proxy = this.readOnlyObjectGraph.get(distortedValue);
|
|
2040
2094
|
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2095
|
+
if (isUndefined(proxy)) {
|
|
2096
|
+
// caching the proxy after the first time it is accessed
|
|
2097
|
+
const handler = new ReadOnlyHandler(this, distortedValue);
|
|
2098
|
+
proxy = new Proxy(createShadowTarget(distortedValue), handler);
|
|
2099
|
+
registerProxy(proxy, value);
|
|
2100
|
+
this.readOnlyObjectGraph.set(distortedValue, proxy);
|
|
2101
|
+
}
|
|
2048
2102
|
|
|
2049
|
-
|
|
2050
|
-
objectGraph.set(distortedValue, reactiveState);
|
|
2051
|
-
return reactiveState;
|
|
2103
|
+
return proxy;
|
|
2052
2104
|
}
|
|
2053
2105
|
|
|
2054
2106
|
}
|
|
2055
|
-
/** version: 1.
|
|
2107
|
+
/** version: 1.1.5 */
|
|
2056
2108
|
|
|
2057
2109
|
/*
|
|
2058
2110
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -2431,8 +2483,10 @@ var LWC = (function (exports) {
|
|
|
2431
2483
|
} = vm;
|
|
2432
2484
|
|
|
2433
2485
|
return renderer[rendererMethod](elm);
|
|
2434
|
-
}
|
|
2486
|
+
},
|
|
2435
2487
|
|
|
2488
|
+
configurable: true,
|
|
2489
|
+
enumerable: true
|
|
2436
2490
|
};
|
|
2437
2491
|
}
|
|
2438
2492
|
|
|
@@ -2448,8 +2502,11 @@ var LWC = (function (exports) {
|
|
|
2448
2502
|
} = vm;
|
|
2449
2503
|
|
|
2450
2504
|
return renderer[queryMethod](elm, arg);
|
|
2451
|
-
}
|
|
2505
|
+
},
|
|
2452
2506
|
|
|
2507
|
+
configurable: true,
|
|
2508
|
+
enumerable: true,
|
|
2509
|
+
writable: true
|
|
2453
2510
|
};
|
|
2454
2511
|
}
|
|
2455
2512
|
|
|
@@ -3300,7 +3357,7 @@ var LWC = (function (exports) {
|
|
|
3300
3357
|
renderMode: 1
|
|
3301
3358
|
/* Shadow */
|
|
3302
3359
|
,
|
|
3303
|
-
shadowSupportMode: "
|
|
3360
|
+
shadowSupportMode: "reset"
|
|
3304
3361
|
/* Default */
|
|
3305
3362
|
,
|
|
3306
3363
|
wire: EmptyObject,
|
|
@@ -3426,6 +3483,17 @@ var LWC = (function (exports) {
|
|
|
3426
3483
|
modComputedStyle.create(vnode);
|
|
3427
3484
|
}
|
|
3428
3485
|
|
|
3486
|
+
function hydrateElmHook(vnode) {
|
|
3487
|
+
modEvents.create(vnode); // Attrs are already on the element.
|
|
3488
|
+
// modAttrs.create(vnode);
|
|
3489
|
+
|
|
3490
|
+
modProps.create(vnode); // Already set.
|
|
3491
|
+
// modStaticClassName.create(vnode);
|
|
3492
|
+
// modStaticStyle.create(vnode);
|
|
3493
|
+
// modComputedClassName.create(vnode);
|
|
3494
|
+
// modComputedStyle.create(vnode);
|
|
3495
|
+
}
|
|
3496
|
+
|
|
3429
3497
|
function fallbackElmHook(elm, vnode) {
|
|
3430
3498
|
const {
|
|
3431
3499
|
owner
|
|
@@ -3575,6 +3643,22 @@ var LWC = (function (exports) {
|
|
|
3575
3643
|
}
|
|
3576
3644
|
}
|
|
3577
3645
|
|
|
3646
|
+
function hydrateChildrenHook(elmChildren, children, vm) {
|
|
3647
|
+
|
|
3648
|
+
let elmCurrentChildIdx = 0;
|
|
3649
|
+
|
|
3650
|
+
for (let j = 0, n = children.length; j < n; j++) {
|
|
3651
|
+
const ch = children[j];
|
|
3652
|
+
|
|
3653
|
+
if (ch != null) {
|
|
3654
|
+
const childNode = elmChildren[elmCurrentChildIdx];
|
|
3655
|
+
|
|
3656
|
+
ch.hook.hydrate(ch, childNode);
|
|
3657
|
+
elmCurrentChildIdx++;
|
|
3658
|
+
}
|
|
3659
|
+
}
|
|
3660
|
+
}
|
|
3661
|
+
|
|
3578
3662
|
function updateCustomElmHook(oldVnode, vnode) {
|
|
3579
3663
|
// Attrs need to be applied to element before props
|
|
3580
3664
|
// IE11 will wipe out value on radio inputs if value
|
|
@@ -3658,38 +3742,6 @@ var LWC = (function (exports) {
|
|
|
3658
3742
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3659
3743
|
*/
|
|
3660
3744
|
|
|
3661
|
-
/**
|
|
3662
|
-
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
|
3663
|
-
* libraries to sanitize HTML content. This hook process the content passed via the template to
|
|
3664
|
-
* lwc:inner-html directive.
|
|
3665
|
-
* It is meant to be overridden with setSanitizeHtmlContentHook
|
|
3666
|
-
*/
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
let sanitizeHtmlContentHook = () => {
|
|
3670
|
-
// locker-service patches this function during runtime to sanitize HTML content.
|
|
3671
|
-
throw new Error('sanitizeHtmlContent hook must be implemented.');
|
|
3672
|
-
};
|
|
3673
|
-
/**
|
|
3674
|
-
* Sets the sanitizeHtmlContentHook.
|
|
3675
|
-
*
|
|
3676
|
-
* @param newHookImpl
|
|
3677
|
-
* @returns oldHookImplementation.
|
|
3678
|
-
*/
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
function setSanitizeHtmlContentHook(newHookImpl) {
|
|
3682
|
-
const currentHook = sanitizeHtmlContentHook;
|
|
3683
|
-
sanitizeHtmlContentHook = newHookImpl;
|
|
3684
|
-
return currentHook;
|
|
3685
|
-
}
|
|
3686
|
-
/*
|
|
3687
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
3688
|
-
* All rights reserved.
|
|
3689
|
-
* SPDX-License-Identifier: MIT
|
|
3690
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3691
|
-
*/
|
|
3692
|
-
|
|
3693
3745
|
|
|
3694
3746
|
const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
3695
3747
|
const SymbolIterator = Symbol.iterator;
|
|
@@ -3708,7 +3760,14 @@ var LWC = (function (exports) {
|
|
|
3708
3760
|
update: updateNodeHook,
|
|
3709
3761
|
insert: insertNodeHook,
|
|
3710
3762
|
move: insertNodeHook,
|
|
3711
|
-
remove: removeNodeHook
|
|
3763
|
+
remove: removeNodeHook,
|
|
3764
|
+
hydrate: (vNode, node) => {
|
|
3765
|
+
var _a;
|
|
3766
|
+
|
|
3767
|
+
|
|
3768
|
+
node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
|
|
3769
|
+
vNode.elm = node;
|
|
3770
|
+
}
|
|
3712
3771
|
};
|
|
3713
3772
|
const CommentHook = {
|
|
3714
3773
|
create: vnode => {
|
|
@@ -3726,7 +3785,14 @@ var LWC = (function (exports) {
|
|
|
3726
3785
|
update: updateNodeHook,
|
|
3727
3786
|
insert: insertNodeHook,
|
|
3728
3787
|
move: insertNodeHook,
|
|
3729
|
-
remove: removeNodeHook
|
|
3788
|
+
remove: removeNodeHook,
|
|
3789
|
+
hydrate: (vNode, node) => {
|
|
3790
|
+
var _a;
|
|
3791
|
+
|
|
3792
|
+
|
|
3793
|
+
node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
|
|
3794
|
+
vNode.elm = node;
|
|
3795
|
+
}
|
|
3730
3796
|
}; // insert is called after update, which is used somewhere else (via a module)
|
|
3731
3797
|
// to mark the vm as inserted, that means we cannot use update as the main channel
|
|
3732
3798
|
// to rehydrate when dirty, because sometimes the element is not inserted just yet,
|
|
@@ -3766,6 +3832,38 @@ var LWC = (function (exports) {
|
|
|
3766
3832
|
remove: (vnode, parentNode) => {
|
|
3767
3833
|
removeNodeHook(vnode, parentNode);
|
|
3768
3834
|
removeElmHook(vnode);
|
|
3835
|
+
},
|
|
3836
|
+
hydrate: (vnode, node) => {
|
|
3837
|
+
const elm = node;
|
|
3838
|
+
vnode.elm = elm;
|
|
3839
|
+
const {
|
|
3840
|
+
context
|
|
3841
|
+
} = vnode.data;
|
|
3842
|
+
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
|
|
3843
|
+
/* manual */
|
|
3844
|
+
);
|
|
3845
|
+
|
|
3846
|
+
if (isDomManual) {
|
|
3847
|
+
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
3848
|
+
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
3849
|
+
const {
|
|
3850
|
+
props
|
|
3851
|
+
} = vnode.data;
|
|
3852
|
+
|
|
3853
|
+
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
3854
|
+
if (elm.innerHTML === props.innerHTML) {
|
|
3855
|
+
delete props.innerHTML;
|
|
3856
|
+
} else {
|
|
3857
|
+
logWarn(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
|
|
3858
|
+
}
|
|
3859
|
+
}
|
|
3860
|
+
}
|
|
3861
|
+
|
|
3862
|
+
hydrateElmHook(vnode);
|
|
3863
|
+
|
|
3864
|
+
if (!isDomManual) {
|
|
3865
|
+
hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vnode.owner);
|
|
3866
|
+
}
|
|
3769
3867
|
}
|
|
3770
3868
|
};
|
|
3771
3869
|
const CustomElementHook = {
|
|
@@ -3849,6 +3947,38 @@ var LWC = (function (exports) {
|
|
|
3849
3947
|
// will take care of disconnecting any child VM attached to its shadow as well.
|
|
3850
3948
|
removeVM(vm);
|
|
3851
3949
|
}
|
|
3950
|
+
},
|
|
3951
|
+
hydrate: (vnode, elm) => {
|
|
3952
|
+
// the element is created, but the vm is not
|
|
3953
|
+
const {
|
|
3954
|
+
sel,
|
|
3955
|
+
mode,
|
|
3956
|
+
ctor,
|
|
3957
|
+
owner
|
|
3958
|
+
} = vnode;
|
|
3959
|
+
const def = getComponentInternalDef(ctor);
|
|
3960
|
+
createVM(elm, def, {
|
|
3961
|
+
mode,
|
|
3962
|
+
owner,
|
|
3963
|
+
tagName: sel,
|
|
3964
|
+
renderer: owner.renderer
|
|
3965
|
+
});
|
|
3966
|
+
vnode.elm = elm;
|
|
3967
|
+
const vm = getAssociatedVM(elm);
|
|
3968
|
+
allocateChildrenHook(vnode, vm);
|
|
3969
|
+
hydrateElmHook(vnode); // Insert hook section:
|
|
3970
|
+
|
|
3971
|
+
runConnectedCallback(vm);
|
|
3972
|
+
|
|
3973
|
+
if (vm.renderMode !== 0
|
|
3974
|
+
/* Light */
|
|
3975
|
+
) {
|
|
3976
|
+
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
3977
|
+
// Note: for Light DOM, this is handled while hydrating the VM
|
|
3978
|
+
hydrateChildrenHook(vnode.elm.childNodes, vnode.children);
|
|
3979
|
+
}
|
|
3980
|
+
|
|
3981
|
+
hydrateVM(vm);
|
|
3852
3982
|
}
|
|
3853
3983
|
};
|
|
3854
3984
|
|
|
@@ -4058,7 +4188,7 @@ var LWC = (function (exports) {
|
|
|
4058
4188
|
|
|
4059
4189
|
|
|
4060
4190
|
function d(value) {
|
|
4061
|
-
return value == null ? '' : value;
|
|
4191
|
+
return value == null ? '' : String(value);
|
|
4062
4192
|
} // [b]ind function
|
|
4063
4193
|
|
|
4064
4194
|
|
|
@@ -4199,6 +4329,26 @@ var LWC = (function (exports) {
|
|
|
4199
4329
|
|
|
4200
4330
|
markAsDynamicChildren(vnodes);
|
|
4201
4331
|
return vnodes;
|
|
4332
|
+
}
|
|
4333
|
+
/**
|
|
4334
|
+
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
|
4335
|
+
* libraries to sanitize HTML content. This hook process the content passed via the template to
|
|
4336
|
+
* lwc:inner-html directive.
|
|
4337
|
+
* It is meant to be overridden with setSanitizeHtmlContentHook, it throws an error by default.
|
|
4338
|
+
*/
|
|
4339
|
+
|
|
4340
|
+
|
|
4341
|
+
let sanitizeHtmlContentHook = () => {
|
|
4342
|
+
// locker-service patches this function during runtime to sanitize HTML content.
|
|
4343
|
+
throw new Error('sanitizeHtmlContent hook must be implemented.');
|
|
4344
|
+
};
|
|
4345
|
+
/**
|
|
4346
|
+
* Sets the sanitizeHtmlContentHook.
|
|
4347
|
+
*/
|
|
4348
|
+
|
|
4349
|
+
|
|
4350
|
+
function setSanitizeHtmlContentHook(newHookImpl) {
|
|
4351
|
+
sanitizeHtmlContentHook = newHookImpl;
|
|
4202
4352
|
} // [s]anitize [h]tml [c]ontent
|
|
4203
4353
|
|
|
4204
4354
|
|
|
@@ -4387,7 +4537,10 @@ var LWC = (function (exports) {
|
|
|
4387
4537
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4388
4538
|
renderer.insertGlobalStylesheet(stylesheets[i]);
|
|
4389
4539
|
}
|
|
4390
|
-
} else if (renderer.ssr) {
|
|
4540
|
+
} else if (renderer.ssr || renderer.isHydrating()) {
|
|
4541
|
+
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
4542
|
+
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
4543
|
+
// the first time the VM renders.
|
|
4391
4544
|
// native shadow or light DOM, SSR
|
|
4392
4545
|
const combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
|
|
4393
4546
|
return createInlineStyleVNode(combinedStylesheetContent);
|
|
@@ -4886,6 +5039,12 @@ var LWC = (function (exports) {
|
|
|
4886
5039
|
, vm);
|
|
4887
5040
|
}
|
|
4888
5041
|
|
|
5042
|
+
function hydrateRootElement(elm) {
|
|
5043
|
+
const vm = getAssociatedVM(elm);
|
|
5044
|
+
runConnectedCallback(vm);
|
|
5045
|
+
hydrateVM(vm);
|
|
5046
|
+
}
|
|
5047
|
+
|
|
4889
5048
|
function disconnectRootElement(elm) {
|
|
4890
5049
|
const vm = getAssociatedVM(elm);
|
|
4891
5050
|
resetComponentStateWhenRemoved(vm);
|
|
@@ -4893,6 +5052,10 @@ var LWC = (function (exports) {
|
|
|
4893
5052
|
|
|
4894
5053
|
function appendVM(vm) {
|
|
4895
5054
|
rehydrate(vm);
|
|
5055
|
+
}
|
|
5056
|
+
|
|
5057
|
+
function hydrateVM(vm) {
|
|
5058
|
+
hydrate(vm);
|
|
4896
5059
|
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
4897
5060
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
4898
5061
|
|
|
@@ -5087,6 +5250,22 @@ var LWC = (function (exports) {
|
|
|
5087
5250
|
}
|
|
5088
5251
|
}
|
|
5089
5252
|
|
|
5253
|
+
function hydrate(vm) {
|
|
5254
|
+
if (isTrue(vm.isDirty)) {
|
|
5255
|
+
// manually diffing/patching here.
|
|
5256
|
+
// This routine is:
|
|
5257
|
+
// patchShadowRoot(vm, children);
|
|
5258
|
+
// -> addVnodes.
|
|
5259
|
+
const children = renderComponent(vm);
|
|
5260
|
+
vm.children = children;
|
|
5261
|
+
const vmChildren = vm.renderMode === 0
|
|
5262
|
+
/* Light */
|
|
5263
|
+
? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;
|
|
5264
|
+
hydrateChildrenHook(vmChildren, children);
|
|
5265
|
+
runRenderedCallback(vm);
|
|
5266
|
+
}
|
|
5267
|
+
}
|
|
5268
|
+
|
|
5090
5269
|
function patchShadowRoot(vm, newCh) {
|
|
5091
5270
|
const {
|
|
5092
5271
|
children: oldCh
|
|
@@ -5876,25 +6055,12 @@ var LWC = (function (exports) {
|
|
|
5876
6055
|
|
|
5877
6056
|
let hooksAreSet = false;
|
|
5878
6057
|
|
|
5879
|
-
function overrideHooks(hooks) {
|
|
5880
|
-
const oldHooks = {};
|
|
5881
|
-
|
|
5882
|
-
if (!isUndefined$1(hooks.sanitizeHtmlContent)) {
|
|
5883
|
-
oldHooks.sanitizeHtmlContent = setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
5884
|
-
}
|
|
5885
|
-
|
|
5886
|
-
return oldHooks;
|
|
5887
|
-
}
|
|
5888
|
-
|
|
5889
6058
|
function setHooks(hooks) {
|
|
5890
6059
|
assert.isFalse(hooksAreSet, 'Hooks are already overridden, only one definition is allowed.');
|
|
5891
|
-
overrideHooks(hooks);
|
|
5892
6060
|
hooksAreSet = true;
|
|
6061
|
+
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
5893
6062
|
}
|
|
5894
|
-
|
|
5895
|
-
function setHooksForTest(hooks) {
|
|
5896
|
-
}
|
|
5897
|
-
/* version: 2.5.6 */
|
|
6063
|
+
/* version: 2.5.10 */
|
|
5898
6064
|
|
|
5899
6065
|
/*
|
|
5900
6066
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6029,8 +6195,19 @@ var LWC = (function (exports) {
|
|
|
6029
6195
|
HTMLElementConstructor.prototype = HTMLElement.prototype;
|
|
6030
6196
|
}
|
|
6031
6197
|
|
|
6198
|
+
let isHydrating = false;
|
|
6199
|
+
|
|
6200
|
+
function setIsHydrating(v) {
|
|
6201
|
+
isHydrating = v;
|
|
6202
|
+
}
|
|
6203
|
+
|
|
6032
6204
|
const renderer = {
|
|
6033
6205
|
ssr: false,
|
|
6206
|
+
|
|
6207
|
+
isHydrating() {
|
|
6208
|
+
return isHydrating;
|
|
6209
|
+
},
|
|
6210
|
+
|
|
6034
6211
|
isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
|
|
6035
6212
|
isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
|
|
6036
6213
|
|
|
@@ -6059,6 +6236,10 @@ var LWC = (function (exports) {
|
|
|
6059
6236
|
},
|
|
6060
6237
|
|
|
6061
6238
|
attachShadow(element, options) {
|
|
6239
|
+
if (isHydrating) {
|
|
6240
|
+
return element.shadowRoot;
|
|
6241
|
+
}
|
|
6242
|
+
|
|
6062
6243
|
return element.attachShadow(options);
|
|
6063
6244
|
},
|
|
6064
6245
|
|
|
@@ -6190,57 +6371,6 @@ var LWC = (function (exports) {
|
|
|
6190
6371
|
getCustomElement,
|
|
6191
6372
|
HTMLElement: HTMLElementConstructor
|
|
6192
6373
|
};
|
|
6193
|
-
/*
|
|
6194
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
6195
|
-
* All rights reserved.
|
|
6196
|
-
* SPDX-License-Identifier: MIT
|
|
6197
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6198
|
-
*/
|
|
6199
|
-
|
|
6200
|
-
/**
|
|
6201
|
-
* This function builds a Web Component class from a LWC constructor so it can be
|
|
6202
|
-
* registered as a new element via customElements.define() at any given time.
|
|
6203
|
-
*
|
|
6204
|
-
* @deprecated since version 1.3.11
|
|
6205
|
-
*
|
|
6206
|
-
* @example
|
|
6207
|
-
* ```
|
|
6208
|
-
* import { buildCustomElementConstructor } from 'lwc';
|
|
6209
|
-
* import Foo from 'ns/foo';
|
|
6210
|
-
* const WC = buildCustomElementConstructor(Foo);
|
|
6211
|
-
* customElements.define('x-foo', WC);
|
|
6212
|
-
* const elm = document.createElement('x-foo');
|
|
6213
|
-
* ```
|
|
6214
|
-
*/
|
|
6215
|
-
|
|
6216
|
-
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
6217
|
-
|
|
6218
|
-
return Ctor.CustomElementConstructor;
|
|
6219
|
-
}
|
|
6220
|
-
|
|
6221
|
-
function buildCustomElementConstructor(Ctor) {
|
|
6222
|
-
const def = getComponentInternalDef(Ctor);
|
|
6223
|
-
return class extends def.bridge {
|
|
6224
|
-
constructor() {
|
|
6225
|
-
super();
|
|
6226
|
-
createVM(this, def, {
|
|
6227
|
-
mode: 'open',
|
|
6228
|
-
owner: null,
|
|
6229
|
-
tagName: this.tagName,
|
|
6230
|
-
renderer
|
|
6231
|
-
});
|
|
6232
|
-
}
|
|
6233
|
-
|
|
6234
|
-
connectedCallback() {
|
|
6235
|
-
connectRootElement(this);
|
|
6236
|
-
}
|
|
6237
|
-
|
|
6238
|
-
disconnectedCallback() {
|
|
6239
|
-
disconnectRootElement(this);
|
|
6240
|
-
}
|
|
6241
|
-
|
|
6242
|
-
};
|
|
6243
|
-
}
|
|
6244
6374
|
/*
|
|
6245
6375
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
6246
6376
|
* All rights reserved.
|
|
@@ -6250,7 +6380,6 @@ var LWC = (function (exports) {
|
|
|
6250
6380
|
// TODO [#2472]: Remove this workaround when appropriate.
|
|
6251
6381
|
// eslint-disable-next-line lwc-internal/no-global-node
|
|
6252
6382
|
|
|
6253
|
-
|
|
6254
6383
|
const _Node$1 = Node;
|
|
6255
6384
|
const ConnectingSlot = new WeakMap();
|
|
6256
6385
|
const DisconnectingSlot = new WeakMap();
|
|
@@ -6358,6 +6487,114 @@ var LWC = (function (exports) {
|
|
|
6358
6487
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6359
6488
|
*/
|
|
6360
6489
|
|
|
6490
|
+
|
|
6491
|
+
function hydrateComponent(element, Ctor, props = {}) {
|
|
6492
|
+
if (!isFunction$1(Ctor)) {
|
|
6493
|
+
throw new TypeError(`"hydrateComponent" expects a valid component constructor as the second parameter but instead received ${Ctor}.`);
|
|
6494
|
+
}
|
|
6495
|
+
|
|
6496
|
+
if (!isObject(props) || isNull(props)) {
|
|
6497
|
+
throw new TypeError(`"hydrateComponent" expects an object as the third parameter but instead received ${props}.`);
|
|
6498
|
+
}
|
|
6499
|
+
|
|
6500
|
+
const def = getComponentInternalDef(Ctor);
|
|
6501
|
+
|
|
6502
|
+
try {
|
|
6503
|
+
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
6504
|
+
// and uses the same algo to create the stylesheets as in SSR.
|
|
6505
|
+
setIsHydrating(true);
|
|
6506
|
+
createVM(element, def, {
|
|
6507
|
+
mode: 'open',
|
|
6508
|
+
owner: null,
|
|
6509
|
+
renderer,
|
|
6510
|
+
tagName: element.tagName.toLowerCase()
|
|
6511
|
+
});
|
|
6512
|
+
|
|
6513
|
+
for (const [key, value] of Object.entries(props)) {
|
|
6514
|
+
element[key] = value;
|
|
6515
|
+
}
|
|
6516
|
+
|
|
6517
|
+
hydrateRootElement(element); // set it back since now we finished hydration.
|
|
6518
|
+
|
|
6519
|
+
setIsHydrating(false);
|
|
6520
|
+
} catch (e) {
|
|
6521
|
+
// Fallback: In case there's an error while hydrating, let's log the error, and replace the element with
|
|
6522
|
+
// the client generated DOM.
|
|
6523
|
+
|
|
6524
|
+
/* eslint-disable-next-line no-console */
|
|
6525
|
+
console.error('Recovering from error while hydrating: ', e);
|
|
6526
|
+
setIsHydrating(false);
|
|
6527
|
+
const newElem = createElement(element.tagName, {
|
|
6528
|
+
is: Ctor,
|
|
6529
|
+
mode: 'open'
|
|
6530
|
+
});
|
|
6531
|
+
|
|
6532
|
+
for (const [key, value] of Object.entries(props)) {
|
|
6533
|
+
newElem[key] = value;
|
|
6534
|
+
}
|
|
6535
|
+
|
|
6536
|
+
element.parentNode.replaceChild(newElem, element);
|
|
6537
|
+
}
|
|
6538
|
+
}
|
|
6539
|
+
/*
|
|
6540
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6541
|
+
* All rights reserved.
|
|
6542
|
+
* SPDX-License-Identifier: MIT
|
|
6543
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6544
|
+
*/
|
|
6545
|
+
|
|
6546
|
+
/**
|
|
6547
|
+
* This function builds a Web Component class from a LWC constructor so it can be
|
|
6548
|
+
* registered as a new element via customElements.define() at any given time.
|
|
6549
|
+
*
|
|
6550
|
+
* @deprecated since version 1.3.11
|
|
6551
|
+
*
|
|
6552
|
+
* @example
|
|
6553
|
+
* ```
|
|
6554
|
+
* import { buildCustomElementConstructor } from 'lwc';
|
|
6555
|
+
* import Foo from 'ns/foo';
|
|
6556
|
+
* const WC = buildCustomElementConstructor(Foo);
|
|
6557
|
+
* customElements.define('x-foo', WC);
|
|
6558
|
+
* const elm = document.createElement('x-foo');
|
|
6559
|
+
* ```
|
|
6560
|
+
*/
|
|
6561
|
+
|
|
6562
|
+
|
|
6563
|
+
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
6564
|
+
|
|
6565
|
+
return Ctor.CustomElementConstructor;
|
|
6566
|
+
}
|
|
6567
|
+
|
|
6568
|
+
function buildCustomElementConstructor(Ctor) {
|
|
6569
|
+
const def = getComponentInternalDef(Ctor);
|
|
6570
|
+
return class extends def.bridge {
|
|
6571
|
+
constructor() {
|
|
6572
|
+
super();
|
|
6573
|
+
createVM(this, def, {
|
|
6574
|
+
mode: 'open',
|
|
6575
|
+
owner: null,
|
|
6576
|
+
tagName: this.tagName,
|
|
6577
|
+
renderer
|
|
6578
|
+
});
|
|
6579
|
+
}
|
|
6580
|
+
|
|
6581
|
+
connectedCallback() {
|
|
6582
|
+
connectRootElement(this);
|
|
6583
|
+
}
|
|
6584
|
+
|
|
6585
|
+
disconnectedCallback() {
|
|
6586
|
+
disconnectRootElement(this);
|
|
6587
|
+
}
|
|
6588
|
+
|
|
6589
|
+
};
|
|
6590
|
+
}
|
|
6591
|
+
/*
|
|
6592
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6593
|
+
* All rights reserved.
|
|
6594
|
+
* SPDX-License-Identifier: MIT
|
|
6595
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6596
|
+
*/
|
|
6597
|
+
|
|
6361
6598
|
/**
|
|
6362
6599
|
* EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
|
|
6363
6600
|
* This API is subject to change or being removed.
|
|
@@ -6457,7 +6694,7 @@ var LWC = (function (exports) {
|
|
|
6457
6694
|
});
|
|
6458
6695
|
freeze(LightningElement);
|
|
6459
6696
|
seal(LightningElement.prototype);
|
|
6460
|
-
/* version: 2.5.
|
|
6697
|
+
/* version: 2.5.10 */
|
|
6461
6698
|
|
|
6462
6699
|
exports.LightningElement = LightningElement;
|
|
6463
6700
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
@@ -6467,6 +6704,7 @@ var LWC = (function (exports) {
|
|
|
6467
6704
|
exports.createElement = createElement;
|
|
6468
6705
|
exports.getComponentConstructor = getComponentConstructor;
|
|
6469
6706
|
exports.getComponentDef = getComponentDef;
|
|
6707
|
+
exports.hydrateComponent = hydrateComponent;
|
|
6470
6708
|
exports.isComponentConstructor = isComponentConstructor;
|
|
6471
6709
|
exports.isNodeFromTemplate = isNodeFromTemplate;
|
|
6472
6710
|
exports.readonly = readonly;
|
|
@@ -6478,7 +6716,6 @@ var LWC = (function (exports) {
|
|
|
6478
6716
|
exports.setFeatureFlag = setFeatureFlag;
|
|
6479
6717
|
exports.setFeatureFlagForTest = setFeatureFlagForTest;
|
|
6480
6718
|
exports.setHooks = setHooks;
|
|
6481
|
-
exports.setHooksForTest = setHooksForTest;
|
|
6482
6719
|
exports.swapComponent = swapComponent;
|
|
6483
6720
|
exports.swapStyle = swapStyle;
|
|
6484
6721
|
exports.swapTemplate = swapTemplate;
|