lwc 2.5.5-canary1 → 2.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine-dom/esm/es2017/engine-dom.js +672 -214
- package/dist/engine-dom/iife/es2017/engine-dom.js +673 -215
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +473 -202
- package/dist/engine-dom/iife/es5/engine-dom.js +741 -265
- package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +522 -243
- package/dist/engine-dom/umd/es2017/engine-dom.js +674 -216
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +474 -203
- package/dist/engine-dom/umd/es5/engine-dom.js +742 -266
- package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +523 -244
- package/dist/engine-server/commonjs/es2017/engine-server.js +551 -166
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
- package/dist/engine-server/esm/es2017/engine-server.js +552 -166
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +9 -39
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +10 -40
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +10 -40
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +10 -40
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +10 -40
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +11 -41
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +11 -41
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +11 -41
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +11 -41
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +3 -3
- package/dist/wire-service/iife/es2017/wire-service_debug.js +3 -3
- package/dist/wire-service/iife/es5/wire-service.js +3 -3
- package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
- package/dist/wire-service/iife/es5/wire-service_debug.js +3 -3
- package/dist/wire-service/umd/es2017/wire-service.js +4 -4
- package/dist/wire-service/umd/es2017/wire-service_debug.js +4 -4
- package/dist/wire-service/umd/es5/wire-service.js +4 -4
- package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
- package/dist/wire-service/umd/es5/wire-service_debug.js +4 -4
- package/package.json +8 -8
|
@@ -72,7 +72,7 @@ var LWC = (function (exports) {
|
|
|
72
72
|
find: ArrayFind,
|
|
73
73
|
indexOf: ArrayIndexOf,
|
|
74
74
|
join: ArrayJoin,
|
|
75
|
-
map: ArrayMap
|
|
75
|
+
map: ArrayMap,
|
|
76
76
|
push: ArrayPush$1,
|
|
77
77
|
reduce: ArrayReduce,
|
|
78
78
|
reverse: ArrayReverse,
|
|
@@ -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.9 */
|
|
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.9 */
|
|
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
|
|
|
@@ -3984,7 +4114,7 @@ var LWC = (function (exports) {
|
|
|
3984
4114
|
next = iterator.next();
|
|
3985
4115
|
last = next.done; // template factory logic based on the previous collected value
|
|
3986
4116
|
|
|
3987
|
-
const vnode = factory(value, j, j === 0, last);
|
|
4117
|
+
const vnode = factory(value, j, j === 0, last === true);
|
|
3988
4118
|
|
|
3989
4119
|
if (isArray$1(vnode)) {
|
|
3990
4120
|
ArrayPush$1.apply(list, vnode);
|
|
@@ -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
|
|
|
@@ -4206,24 +4356,22 @@ var LWC = (function (exports) {
|
|
|
4206
4356
|
return sanitizeHtmlContentHook(content);
|
|
4207
4357
|
}
|
|
4208
4358
|
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
h
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
gid
|
|
4223
|
-
fid
|
|
4224
|
-
|
|
4225
|
-
sc: sc,
|
|
4226
|
-
shc: shc
|
|
4359
|
+
const api = freeze({
|
|
4360
|
+
s,
|
|
4361
|
+
h,
|
|
4362
|
+
c,
|
|
4363
|
+
i,
|
|
4364
|
+
f,
|
|
4365
|
+
t,
|
|
4366
|
+
d,
|
|
4367
|
+
b,
|
|
4368
|
+
k,
|
|
4369
|
+
co,
|
|
4370
|
+
dc,
|
|
4371
|
+
ti,
|
|
4372
|
+
gid,
|
|
4373
|
+
fid,
|
|
4374
|
+
shc
|
|
4227
4375
|
});
|
|
4228
4376
|
/*
|
|
4229
4377
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -4237,12 +4385,12 @@ var LWC = (function (exports) {
|
|
|
4237
4385
|
}
|
|
4238
4386
|
|
|
4239
4387
|
function createInlineStyleVNode(content) {
|
|
4240
|
-
return h('style', {
|
|
4388
|
+
return api.h('style', {
|
|
4241
4389
|
key: 'style',
|
|
4242
4390
|
attrs: {
|
|
4243
4391
|
type: 'text/css'
|
|
4244
4392
|
}
|
|
4245
|
-
}, [t(content)]);
|
|
4393
|
+
}, [api.t(content)]);
|
|
4246
4394
|
}
|
|
4247
4395
|
|
|
4248
4396
|
function updateStylesheetToken(vm, template) {
|
|
@@ -4310,6 +4458,7 @@ var LWC = (function (exports) {
|
|
|
4310
4458
|
|
|
4311
4459
|
function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
4312
4460
|
const content = [];
|
|
4461
|
+
let root;
|
|
4313
4462
|
|
|
4314
4463
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4315
4464
|
let stylesheet = stylesheets[i];
|
|
@@ -4317,22 +4466,45 @@ var LWC = (function (exports) {
|
|
|
4317
4466
|
if (isArray$1(stylesheet)) {
|
|
4318
4467
|
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
|
|
4319
4468
|
} else {
|
|
4320
|
-
// native shadow DOM. Synthetic shadow DOM never uses `:host`.
|
|
4321
4469
|
|
|
4470
|
+
const isScopedCss = stylesheet[KEY__SCOPED_CSS]; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
|
|
4471
|
+
|
|
4472
|
+
const scopeToken = isScopedCss || vm.shadowMode === 1
|
|
4473
|
+
/* Synthetic */
|
|
4474
|
+
&& vm.renderMode === 1
|
|
4475
|
+
/* Shadow */
|
|
4476
|
+
? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
|
|
4477
|
+
// native shadow DOM. Synthetic shadow DOM never uses `:host`.
|
|
4322
4478
|
|
|
4323
|
-
const isScopedCss = stylesheet[KEY__SCOPED_CSS];
|
|
4324
4479
|
const useActualHostSelector = vm.renderMode === 0
|
|
4325
4480
|
/* Light */
|
|
4326
4481
|
? !isScopedCss : vm.shadowMode === 0
|
|
4327
4482
|
/* Native */
|
|
4328
|
-
; //
|
|
4483
|
+
; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
|
|
4484
|
+
// we use an attribute selector on the host to simulate :dir().
|
|
4329
4485
|
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4486
|
+
let useNativeDirPseudoclass;
|
|
4487
|
+
|
|
4488
|
+
if (vm.renderMode === 1
|
|
4333
4489
|
/* Shadow */
|
|
4334
|
-
|
|
4335
|
-
|
|
4490
|
+
) {
|
|
4491
|
+
useNativeDirPseudoclass = vm.shadowMode === 0
|
|
4492
|
+
/* Native */
|
|
4493
|
+
;
|
|
4494
|
+
} else {
|
|
4495
|
+
// Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
|
|
4496
|
+
// At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
|
|
4497
|
+
if (isUndefined$1(root)) {
|
|
4498
|
+
// Only calculate the root once as necessary
|
|
4499
|
+
root = getNearestShadowComponent(vm);
|
|
4500
|
+
}
|
|
4501
|
+
|
|
4502
|
+
useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
|
|
4503
|
+
/* Native */
|
|
4504
|
+
;
|
|
4505
|
+
}
|
|
4506
|
+
|
|
4507
|
+
ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
|
|
4336
4508
|
}
|
|
4337
4509
|
}
|
|
4338
4510
|
|
|
@@ -4356,14 +4528,12 @@ var LWC = (function (exports) {
|
|
|
4356
4528
|
// https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
|
|
4357
4529
|
|
|
4358
4530
|
|
|
4359
|
-
function
|
|
4531
|
+
function getNearestShadowComponent(vm) {
|
|
4360
4532
|
let owner = vm;
|
|
4361
4533
|
|
|
4362
4534
|
while (!isNull(owner)) {
|
|
4363
4535
|
if (owner.renderMode === 1
|
|
4364
4536
|
/* Shadow */
|
|
4365
|
-
&& owner.shadowMode === 0
|
|
4366
|
-
/* Native */
|
|
4367
4537
|
) {
|
|
4368
4538
|
return owner;
|
|
4369
4539
|
}
|
|
@@ -4374,6 +4544,20 @@ var LWC = (function (exports) {
|
|
|
4374
4544
|
return owner;
|
|
4375
4545
|
}
|
|
4376
4546
|
|
|
4547
|
+
function getNearestNativeShadowComponent(vm) {
|
|
4548
|
+
const owner = getNearestShadowComponent(vm);
|
|
4549
|
+
|
|
4550
|
+
if (!isNull(owner) && owner.shadowMode === 1
|
|
4551
|
+
/* Synthetic */
|
|
4552
|
+
) {
|
|
4553
|
+
// Synthetic-within-native is impossible. So if the nearest shadow component is
|
|
4554
|
+
// synthetic, we know we won't find a native component if we go any further.
|
|
4555
|
+
return null;
|
|
4556
|
+
}
|
|
4557
|
+
|
|
4558
|
+
return owner;
|
|
4559
|
+
}
|
|
4560
|
+
|
|
4377
4561
|
function createStylesheet(vm, stylesheets) {
|
|
4378
4562
|
const {
|
|
4379
4563
|
renderer,
|
|
@@ -4389,7 +4573,10 @@ var LWC = (function (exports) {
|
|
|
4389
4573
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4390
4574
|
renderer.insertGlobalStylesheet(stylesheets[i]);
|
|
4391
4575
|
}
|
|
4392
|
-
} else if (renderer.ssr) {
|
|
4576
|
+
} else if (renderer.ssr || renderer.isHydrating()) {
|
|
4577
|
+
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
4578
|
+
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
4579
|
+
// the first time the VM renders.
|
|
4393
4580
|
// native shadow or light DOM, SSR
|
|
4394
4581
|
const combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
|
|
4395
4582
|
return createInlineStyleVNode(combinedStylesheetContent);
|
|
@@ -4888,6 +5075,12 @@ var LWC = (function (exports) {
|
|
|
4888
5075
|
, vm);
|
|
4889
5076
|
}
|
|
4890
5077
|
|
|
5078
|
+
function hydrateRootElement(elm) {
|
|
5079
|
+
const vm = getAssociatedVM(elm);
|
|
5080
|
+
runConnectedCallback(vm);
|
|
5081
|
+
hydrateVM(vm);
|
|
5082
|
+
}
|
|
5083
|
+
|
|
4891
5084
|
function disconnectRootElement(elm) {
|
|
4892
5085
|
const vm = getAssociatedVM(elm);
|
|
4893
5086
|
resetComponentStateWhenRemoved(vm);
|
|
@@ -4895,6 +5088,10 @@ var LWC = (function (exports) {
|
|
|
4895
5088
|
|
|
4896
5089
|
function appendVM(vm) {
|
|
4897
5090
|
rehydrate(vm);
|
|
5091
|
+
}
|
|
5092
|
+
|
|
5093
|
+
function hydrateVM(vm) {
|
|
5094
|
+
hydrate(vm);
|
|
4898
5095
|
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
4899
5096
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
4900
5097
|
|
|
@@ -5089,6 +5286,22 @@ var LWC = (function (exports) {
|
|
|
5089
5286
|
}
|
|
5090
5287
|
}
|
|
5091
5288
|
|
|
5289
|
+
function hydrate(vm) {
|
|
5290
|
+
if (isTrue(vm.isDirty)) {
|
|
5291
|
+
// manually diffing/patching here.
|
|
5292
|
+
// This routine is:
|
|
5293
|
+
// patchShadowRoot(vm, children);
|
|
5294
|
+
// -> addVnodes.
|
|
5295
|
+
const children = renderComponent(vm);
|
|
5296
|
+
vm.children = children;
|
|
5297
|
+
const vmChildren = vm.renderMode === 0
|
|
5298
|
+
/* Light */
|
|
5299
|
+
? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;
|
|
5300
|
+
hydrateChildrenHook(vmChildren, children);
|
|
5301
|
+
runRenderedCallback(vm);
|
|
5302
|
+
}
|
|
5303
|
+
}
|
|
5304
|
+
|
|
5092
5305
|
function patchShadowRoot(vm, newCh) {
|
|
5093
5306
|
const {
|
|
5094
5307
|
children: oldCh
|
|
@@ -5878,25 +6091,12 @@ var LWC = (function (exports) {
|
|
|
5878
6091
|
|
|
5879
6092
|
let hooksAreSet = false;
|
|
5880
6093
|
|
|
5881
|
-
function overrideHooks(hooks) {
|
|
5882
|
-
const oldHooks = {};
|
|
5883
|
-
|
|
5884
|
-
if (!isUndefined$1(hooks.sanitizeHtmlContent)) {
|
|
5885
|
-
oldHooks.sanitizeHtmlContent = setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
5886
|
-
}
|
|
5887
|
-
|
|
5888
|
-
return oldHooks;
|
|
5889
|
-
}
|
|
5890
|
-
|
|
5891
6094
|
function setHooks(hooks) {
|
|
5892
6095
|
assert.isFalse(hooksAreSet, 'Hooks are already overridden, only one definition is allowed.');
|
|
5893
|
-
overrideHooks(hooks);
|
|
5894
6096
|
hooksAreSet = true;
|
|
6097
|
+
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
5895
6098
|
}
|
|
5896
|
-
|
|
5897
|
-
function setHooksForTest(hooks) {
|
|
5898
|
-
}
|
|
5899
|
-
/* version: 2.5.5-canary1 */
|
|
6099
|
+
/* version: 2.5.9 */
|
|
5900
6100
|
|
|
5901
6101
|
/*
|
|
5902
6102
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6031,8 +6231,19 @@ var LWC = (function (exports) {
|
|
|
6031
6231
|
HTMLElementConstructor.prototype = HTMLElement.prototype;
|
|
6032
6232
|
}
|
|
6033
6233
|
|
|
6234
|
+
let isHydrating = false;
|
|
6235
|
+
|
|
6236
|
+
function setIsHydrating(v) {
|
|
6237
|
+
isHydrating = v;
|
|
6238
|
+
}
|
|
6239
|
+
|
|
6034
6240
|
const renderer = {
|
|
6035
6241
|
ssr: false,
|
|
6242
|
+
|
|
6243
|
+
isHydrating() {
|
|
6244
|
+
return isHydrating;
|
|
6245
|
+
},
|
|
6246
|
+
|
|
6036
6247
|
isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
|
|
6037
6248
|
isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
|
|
6038
6249
|
|
|
@@ -6061,6 +6272,10 @@ var LWC = (function (exports) {
|
|
|
6061
6272
|
},
|
|
6062
6273
|
|
|
6063
6274
|
attachShadow(element, options) {
|
|
6275
|
+
if (isHydrating) {
|
|
6276
|
+
return element.shadowRoot;
|
|
6277
|
+
}
|
|
6278
|
+
|
|
6064
6279
|
return element.attachShadow(options);
|
|
6065
6280
|
},
|
|
6066
6281
|
|
|
@@ -6192,57 +6407,6 @@ var LWC = (function (exports) {
|
|
|
6192
6407
|
getCustomElement,
|
|
6193
6408
|
HTMLElement: HTMLElementConstructor
|
|
6194
6409
|
};
|
|
6195
|
-
/*
|
|
6196
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
6197
|
-
* All rights reserved.
|
|
6198
|
-
* SPDX-License-Identifier: MIT
|
|
6199
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6200
|
-
*/
|
|
6201
|
-
|
|
6202
|
-
/**
|
|
6203
|
-
* This function builds a Web Component class from a LWC constructor so it can be
|
|
6204
|
-
* registered as a new element via customElements.define() at any given time.
|
|
6205
|
-
*
|
|
6206
|
-
* @deprecated since version 1.3.11
|
|
6207
|
-
*
|
|
6208
|
-
* @example
|
|
6209
|
-
* ```
|
|
6210
|
-
* import { buildCustomElementConstructor } from 'lwc';
|
|
6211
|
-
* import Foo from 'ns/foo';
|
|
6212
|
-
* const WC = buildCustomElementConstructor(Foo);
|
|
6213
|
-
* customElements.define('x-foo', WC);
|
|
6214
|
-
* const elm = document.createElement('x-foo');
|
|
6215
|
-
* ```
|
|
6216
|
-
*/
|
|
6217
|
-
|
|
6218
|
-
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
6219
|
-
|
|
6220
|
-
return Ctor.CustomElementConstructor;
|
|
6221
|
-
}
|
|
6222
|
-
|
|
6223
|
-
function buildCustomElementConstructor(Ctor) {
|
|
6224
|
-
const def = getComponentInternalDef(Ctor);
|
|
6225
|
-
return class extends def.bridge {
|
|
6226
|
-
constructor() {
|
|
6227
|
-
super();
|
|
6228
|
-
createVM(this, def, {
|
|
6229
|
-
mode: 'open',
|
|
6230
|
-
owner: null,
|
|
6231
|
-
tagName: this.tagName,
|
|
6232
|
-
renderer
|
|
6233
|
-
});
|
|
6234
|
-
}
|
|
6235
|
-
|
|
6236
|
-
connectedCallback() {
|
|
6237
|
-
connectRootElement(this);
|
|
6238
|
-
}
|
|
6239
|
-
|
|
6240
|
-
disconnectedCallback() {
|
|
6241
|
-
disconnectRootElement(this);
|
|
6242
|
-
}
|
|
6243
|
-
|
|
6244
|
-
};
|
|
6245
|
-
}
|
|
6246
6410
|
/*
|
|
6247
6411
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
6248
6412
|
* All rights reserved.
|
|
@@ -6252,7 +6416,6 @@ var LWC = (function (exports) {
|
|
|
6252
6416
|
// TODO [#2472]: Remove this workaround when appropriate.
|
|
6253
6417
|
// eslint-disable-next-line lwc-internal/no-global-node
|
|
6254
6418
|
|
|
6255
|
-
|
|
6256
6419
|
const _Node$1 = Node;
|
|
6257
6420
|
const ConnectingSlot = new WeakMap();
|
|
6258
6421
|
const DisconnectingSlot = new WeakMap();
|
|
@@ -6360,6 +6523,114 @@ var LWC = (function (exports) {
|
|
|
6360
6523
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6361
6524
|
*/
|
|
6362
6525
|
|
|
6526
|
+
|
|
6527
|
+
function hydrateComponent(element, Ctor, props = {}) {
|
|
6528
|
+
if (!isFunction$1(Ctor)) {
|
|
6529
|
+
throw new TypeError(`"hydrateComponent" expects a valid component constructor as the second parameter but instead received ${Ctor}.`);
|
|
6530
|
+
}
|
|
6531
|
+
|
|
6532
|
+
if (!isObject(props) || isNull(props)) {
|
|
6533
|
+
throw new TypeError(`"hydrateComponent" expects an object as the third parameter but instead received ${props}.`);
|
|
6534
|
+
}
|
|
6535
|
+
|
|
6536
|
+
const def = getComponentInternalDef(Ctor);
|
|
6537
|
+
|
|
6538
|
+
try {
|
|
6539
|
+
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
6540
|
+
// and uses the same algo to create the stylesheets as in SSR.
|
|
6541
|
+
setIsHydrating(true);
|
|
6542
|
+
createVM(element, def, {
|
|
6543
|
+
mode: 'open',
|
|
6544
|
+
owner: null,
|
|
6545
|
+
renderer,
|
|
6546
|
+
tagName: element.tagName.toLowerCase()
|
|
6547
|
+
});
|
|
6548
|
+
|
|
6549
|
+
for (const [key, value] of Object.entries(props)) {
|
|
6550
|
+
element[key] = value;
|
|
6551
|
+
}
|
|
6552
|
+
|
|
6553
|
+
hydrateRootElement(element); // set it back since now we finished hydration.
|
|
6554
|
+
|
|
6555
|
+
setIsHydrating(false);
|
|
6556
|
+
} catch (e) {
|
|
6557
|
+
// Fallback: In case there's an error while hydrating, let's log the error, and replace the element with
|
|
6558
|
+
// the client generated DOM.
|
|
6559
|
+
|
|
6560
|
+
/* eslint-disable-next-line no-console */
|
|
6561
|
+
console.error('Recovering from error while hydrating: ', e);
|
|
6562
|
+
setIsHydrating(false);
|
|
6563
|
+
const newElem = createElement(element.tagName, {
|
|
6564
|
+
is: Ctor,
|
|
6565
|
+
mode: 'open'
|
|
6566
|
+
});
|
|
6567
|
+
|
|
6568
|
+
for (const [key, value] of Object.entries(props)) {
|
|
6569
|
+
newElem[key] = value;
|
|
6570
|
+
}
|
|
6571
|
+
|
|
6572
|
+
element.parentNode.replaceChild(newElem, element);
|
|
6573
|
+
}
|
|
6574
|
+
}
|
|
6575
|
+
/*
|
|
6576
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6577
|
+
* All rights reserved.
|
|
6578
|
+
* SPDX-License-Identifier: MIT
|
|
6579
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6580
|
+
*/
|
|
6581
|
+
|
|
6582
|
+
/**
|
|
6583
|
+
* This function builds a Web Component class from a LWC constructor so it can be
|
|
6584
|
+
* registered as a new element via customElements.define() at any given time.
|
|
6585
|
+
*
|
|
6586
|
+
* @deprecated since version 1.3.11
|
|
6587
|
+
*
|
|
6588
|
+
* @example
|
|
6589
|
+
* ```
|
|
6590
|
+
* import { buildCustomElementConstructor } from 'lwc';
|
|
6591
|
+
* import Foo from 'ns/foo';
|
|
6592
|
+
* const WC = buildCustomElementConstructor(Foo);
|
|
6593
|
+
* customElements.define('x-foo', WC);
|
|
6594
|
+
* const elm = document.createElement('x-foo');
|
|
6595
|
+
* ```
|
|
6596
|
+
*/
|
|
6597
|
+
|
|
6598
|
+
|
|
6599
|
+
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
6600
|
+
|
|
6601
|
+
return Ctor.CustomElementConstructor;
|
|
6602
|
+
}
|
|
6603
|
+
|
|
6604
|
+
function buildCustomElementConstructor(Ctor) {
|
|
6605
|
+
const def = getComponentInternalDef(Ctor);
|
|
6606
|
+
return class extends def.bridge {
|
|
6607
|
+
constructor() {
|
|
6608
|
+
super();
|
|
6609
|
+
createVM(this, def, {
|
|
6610
|
+
mode: 'open',
|
|
6611
|
+
owner: null,
|
|
6612
|
+
tagName: this.tagName,
|
|
6613
|
+
renderer
|
|
6614
|
+
});
|
|
6615
|
+
}
|
|
6616
|
+
|
|
6617
|
+
connectedCallback() {
|
|
6618
|
+
connectRootElement(this);
|
|
6619
|
+
}
|
|
6620
|
+
|
|
6621
|
+
disconnectedCallback() {
|
|
6622
|
+
disconnectRootElement(this);
|
|
6623
|
+
}
|
|
6624
|
+
|
|
6625
|
+
};
|
|
6626
|
+
}
|
|
6627
|
+
/*
|
|
6628
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6629
|
+
* All rights reserved.
|
|
6630
|
+
* SPDX-License-Identifier: MIT
|
|
6631
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6632
|
+
*/
|
|
6633
|
+
|
|
6363
6634
|
/**
|
|
6364
6635
|
* EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
|
|
6365
6636
|
* This API is subject to change or being removed.
|
|
@@ -6459,7 +6730,7 @@ var LWC = (function (exports) {
|
|
|
6459
6730
|
});
|
|
6460
6731
|
freeze(LightningElement);
|
|
6461
6732
|
seal(LightningElement.prototype);
|
|
6462
|
-
/* version: 2.5.
|
|
6733
|
+
/* version: 2.5.9 */
|
|
6463
6734
|
|
|
6464
6735
|
exports.LightningElement = LightningElement;
|
|
6465
6736
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
@@ -6469,6 +6740,7 @@ var LWC = (function (exports) {
|
|
|
6469
6740
|
exports.createElement = createElement;
|
|
6470
6741
|
exports.getComponentConstructor = getComponentConstructor;
|
|
6471
6742
|
exports.getComponentDef = getComponentDef;
|
|
6743
|
+
exports.hydrateComponent = hydrateComponent;
|
|
6472
6744
|
exports.isComponentConstructor = isComponentConstructor;
|
|
6473
6745
|
exports.isNodeFromTemplate = isNodeFromTemplate;
|
|
6474
6746
|
exports.readonly = readonly;
|
|
@@ -6480,7 +6752,6 @@ var LWC = (function (exports) {
|
|
|
6480
6752
|
exports.setFeatureFlag = setFeatureFlag;
|
|
6481
6753
|
exports.setFeatureFlagForTest = setFeatureFlagForTest;
|
|
6482
6754
|
exports.setHooks = setHooks;
|
|
6483
|
-
exports.setHooksForTest = setHooksForTest;
|
|
6484
6755
|
exports.swapComponent = swapComponent;
|
|
6485
6756
|
exports.swapStyle = swapStyle;
|
|
6486
6757
|
exports.swapTemplate = swapTemplate;
|
|
@@ -6492,4 +6763,4 @@ var LWC = (function (exports) {
|
|
|
6492
6763
|
|
|
6493
6764
|
return exports;
|
|
6494
6765
|
|
|
6495
|
-
}({})
|
|
6766
|
+
})({});
|