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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.LWC = {}));
|
|
5
|
-
}(this, (function (exports) { 'use strict';
|
|
5
|
+
})(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
7
|
/* proxy-compat-disable */
|
|
8
8
|
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
find: ArrayFind,
|
|
76
76
|
indexOf: ArrayIndexOf,
|
|
77
77
|
join: ArrayJoin,
|
|
78
|
-
map: ArrayMap
|
|
78
|
+
map: ArrayMap,
|
|
79
79
|
push: ArrayPush$1,
|
|
80
80
|
reduce: ArrayReduce,
|
|
81
81
|
reverse: ArrayReverse,
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
// Array.prototype.toString directly will cause an error Iterate through
|
|
139
139
|
// all the items and handle individually.
|
|
140
140
|
if (isArray$1(obj)) {
|
|
141
|
-
return ArrayJoin.call(ArrayMap
|
|
141
|
+
return ArrayJoin.call(ArrayMap.call(obj, toString$1), ',');
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
return obj.toString();
|
|
@@ -301,7 +301,7 @@
|
|
|
301
301
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
302
302
|
return attributeName;
|
|
303
303
|
}
|
|
304
|
-
/** version: 2.5.
|
|
304
|
+
/** version: 2.5.9 */
|
|
305
305
|
|
|
306
306
|
/*
|
|
307
307
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -473,7 +473,7 @@
|
|
|
473
473
|
|
|
474
474
|
function setFeatureFlagForTest(name, value) {
|
|
475
475
|
}
|
|
476
|
-
/** version: 2.5.
|
|
476
|
+
/** version: 2.5.9 */
|
|
477
477
|
|
|
478
478
|
/* proxy-compat-disable */
|
|
479
479
|
|
|
@@ -515,7 +515,7 @@
|
|
|
515
515
|
}
|
|
516
516
|
|
|
517
517
|
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
518
|
-
}
|
|
518
|
+
} // Borrowed from Vue template compiler.
|
|
519
519
|
/*
|
|
520
520
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
521
521
|
* All rights reserved.
|
|
@@ -663,6 +663,20 @@
|
|
|
663
663
|
return `<${StringToLowerCase.call(vm.tagName)}>`;
|
|
664
664
|
} // TODO [#1695]: Unify getComponentStack and getErrorComponentStack
|
|
665
665
|
|
|
666
|
+
|
|
667
|
+
function getComponentStack(vm) {
|
|
668
|
+
const stack = [];
|
|
669
|
+
let prefix = '';
|
|
670
|
+
|
|
671
|
+
while (!isNull(vm.owner)) {
|
|
672
|
+
ArrayPush$1.call(stack, prefix + getComponentTag(vm));
|
|
673
|
+
vm = vm.owner;
|
|
674
|
+
prefix += '\t';
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
return ArrayJoin.call(stack, '\n');
|
|
678
|
+
}
|
|
679
|
+
|
|
666
680
|
function getErrorComponentStack(vm) {
|
|
667
681
|
const wcStack = [];
|
|
668
682
|
let currentVm = vm;
|
|
@@ -682,6 +696,32 @@
|
|
|
682
696
|
*/
|
|
683
697
|
|
|
684
698
|
|
|
699
|
+
function log(method, message, vm) {
|
|
700
|
+
let msg = `[LWC ${method}]: ${message}`;
|
|
701
|
+
|
|
702
|
+
if (!isUndefined$1(vm)) {
|
|
703
|
+
msg = `${msg}\n${getComponentStack(vm)}`;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
try {
|
|
707
|
+
throw new Error(msg);
|
|
708
|
+
} catch (e) {
|
|
709
|
+
/* eslint-disable-next-line no-console */
|
|
710
|
+
console[method](e);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
function logWarn(message, vm) {
|
|
715
|
+
log('warn', message, vm);
|
|
716
|
+
}
|
|
717
|
+
/*
|
|
718
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
719
|
+
* All rights reserved.
|
|
720
|
+
* SPDX-License-Identifier: MIT
|
|
721
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
722
|
+
*/
|
|
723
|
+
|
|
724
|
+
|
|
685
725
|
function handleEvent(event, vnode) {
|
|
686
726
|
const {
|
|
687
727
|
type
|
|
@@ -1459,7 +1499,6 @@
|
|
|
1459
1499
|
getPrototypeOf,
|
|
1460
1500
|
create: ObjectCreate,
|
|
1461
1501
|
defineProperty: ObjectDefineProperty,
|
|
1462
|
-
defineProperties: ObjectDefineProperties,
|
|
1463
1502
|
isExtensible,
|
|
1464
1503
|
getOwnPropertyDescriptor,
|
|
1465
1504
|
getOwnPropertyNames,
|
|
@@ -1469,8 +1508,7 @@
|
|
|
1469
1508
|
} = Object;
|
|
1470
1509
|
const {
|
|
1471
1510
|
push: ArrayPush,
|
|
1472
|
-
concat: ArrayConcat
|
|
1473
|
-
map: ArrayMap
|
|
1511
|
+
concat: ArrayConcat
|
|
1474
1512
|
} = Array.prototype;
|
|
1475
1513
|
|
|
1476
1514
|
function isUndefined(obj) {
|
|
@@ -1524,7 +1562,9 @@
|
|
|
1524
1562
|
// but it will always be compatible with the previous descriptor
|
|
1525
1563
|
// to preserve the object invariants, which makes these lines safe.
|
|
1526
1564
|
|
|
1527
|
-
const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key);
|
|
1565
|
+
const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key); // TODO: it should be impossible for the originalDescriptor to ever be undefined, this `if` can be removed
|
|
1566
|
+
|
|
1567
|
+
/* istanbul ignore else */
|
|
1528
1568
|
|
|
1529
1569
|
if (!isUndefined(originalDescriptor)) {
|
|
1530
1570
|
const wrappedDesc = this.wrapDescriptor(originalDescriptor);
|
|
@@ -1552,11 +1592,17 @@
|
|
|
1552
1592
|
|
|
1553
1593
|
preventExtensions(shadowTarget);
|
|
1554
1594
|
} // Shared Traps
|
|
1595
|
+
// TODO: apply() is never called
|
|
1596
|
+
|
|
1597
|
+
/* istanbul ignore next */
|
|
1555
1598
|
|
|
1556
1599
|
|
|
1557
1600
|
apply(shadowTarget, thisArg, argArray) {
|
|
1558
1601
|
/* No op */
|
|
1559
|
-
}
|
|
1602
|
+
} // TODO: construct() is never called
|
|
1603
|
+
|
|
1604
|
+
/* istanbul ignore next */
|
|
1605
|
+
|
|
1560
1606
|
|
|
1561
1607
|
construct(shadowTarget, argArray, newTarget) {
|
|
1562
1608
|
/* No op */
|
|
@@ -1669,8 +1715,8 @@
|
|
|
1669
1715
|
|
|
1670
1716
|
}
|
|
1671
1717
|
|
|
1672
|
-
const getterMap = new WeakMap();
|
|
1673
|
-
const setterMap = new WeakMap();
|
|
1718
|
+
const getterMap$1 = new WeakMap();
|
|
1719
|
+
const setterMap$1 = new WeakMap();
|
|
1674
1720
|
const reverseGetterMap = new WeakMap();
|
|
1675
1721
|
const reverseSetterMap = new WeakMap();
|
|
1676
1722
|
|
|
@@ -1680,7 +1726,7 @@
|
|
|
1680
1726
|
}
|
|
1681
1727
|
|
|
1682
1728
|
wrapGetter(originalGet) {
|
|
1683
|
-
const wrappedGetter = getterMap.get(originalGet);
|
|
1729
|
+
const wrappedGetter = getterMap$1.get(originalGet);
|
|
1684
1730
|
|
|
1685
1731
|
if (!isUndefined(wrappedGetter)) {
|
|
1686
1732
|
return wrappedGetter;
|
|
@@ -1693,13 +1739,13 @@
|
|
|
1693
1739
|
return handler.wrapValue(originalGet.call(unwrap$1(this)));
|
|
1694
1740
|
};
|
|
1695
1741
|
|
|
1696
|
-
getterMap.set(originalGet, get);
|
|
1742
|
+
getterMap$1.set(originalGet, get);
|
|
1697
1743
|
reverseGetterMap.set(get, originalGet);
|
|
1698
1744
|
return get;
|
|
1699
1745
|
}
|
|
1700
1746
|
|
|
1701
1747
|
wrapSetter(originalSet) {
|
|
1702
|
-
const wrappedSetter = setterMap.get(originalSet);
|
|
1748
|
+
const wrappedSetter = setterMap$1.get(originalSet);
|
|
1703
1749
|
|
|
1704
1750
|
if (!isUndefined(wrappedSetter)) {
|
|
1705
1751
|
return wrappedSetter;
|
|
@@ -1710,7 +1756,7 @@
|
|
|
1710
1756
|
originalSet.call(unwrap$1(this), unwrap$1(v));
|
|
1711
1757
|
};
|
|
1712
1758
|
|
|
1713
|
-
setterMap.set(originalSet, set);
|
|
1759
|
+
setterMap$1.set(originalSet, set);
|
|
1714
1760
|
reverseSetterMap.set(set, originalSet);
|
|
1715
1761
|
return set;
|
|
1716
1762
|
}
|
|
@@ -1751,7 +1797,7 @@
|
|
|
1751
1797
|
return unwrap$1(redGet.call(handler.wrapValue(this)));
|
|
1752
1798
|
};
|
|
1753
1799
|
|
|
1754
|
-
getterMap.set(get, redGet);
|
|
1800
|
+
getterMap$1.set(get, redGet);
|
|
1755
1801
|
reverseGetterMap.set(redGet, get);
|
|
1756
1802
|
return get;
|
|
1757
1803
|
}
|
|
@@ -1770,7 +1816,7 @@
|
|
|
1770
1816
|
redSet.call(handler.wrapValue(this), handler.wrapValue(v));
|
|
1771
1817
|
};
|
|
1772
1818
|
|
|
1773
|
-
setterMap.set(set, redSet);
|
|
1819
|
+
setterMap$1.set(set, redSet);
|
|
1774
1820
|
reverseSetterMap.set(redSet, set);
|
|
1775
1821
|
return set;
|
|
1776
1822
|
}
|
|
@@ -1821,6 +1867,11 @@
|
|
|
1821
1867
|
preventExtensions(originalTarget); // if the originalTarget is a proxy itself, it might reject
|
|
1822
1868
|
// the preventExtension call, in which case we should not attempt to lock down
|
|
1823
1869
|
// the shadow target.
|
|
1870
|
+
// TODO: It should not actually be possible to reach this `if` statement.
|
|
1871
|
+
// If a proxy rejects extensions, then calling preventExtensions will throw an error:
|
|
1872
|
+
// https://codepen.io/nolanlawson-the-selector/pen/QWMOjbY
|
|
1873
|
+
|
|
1874
|
+
/* istanbul ignore if */
|
|
1824
1875
|
|
|
1825
1876
|
if (isExtensible(originalTarget)) {
|
|
1826
1877
|
return false;
|
|
@@ -1862,8 +1913,8 @@
|
|
|
1862
1913
|
|
|
1863
1914
|
}
|
|
1864
1915
|
|
|
1865
|
-
const getterMap
|
|
1866
|
-
const setterMap
|
|
1916
|
+
const getterMap = new WeakMap();
|
|
1917
|
+
const setterMap = new WeakMap();
|
|
1867
1918
|
|
|
1868
1919
|
class ReadOnlyHandler extends BaseProxyHandler {
|
|
1869
1920
|
wrapValue(value) {
|
|
@@ -1871,7 +1922,7 @@
|
|
|
1871
1922
|
}
|
|
1872
1923
|
|
|
1873
1924
|
wrapGetter(originalGet) {
|
|
1874
|
-
const wrappedGetter = getterMap
|
|
1925
|
+
const wrappedGetter = getterMap.get(originalGet);
|
|
1875
1926
|
|
|
1876
1927
|
if (!isUndefined(wrappedGetter)) {
|
|
1877
1928
|
return wrappedGetter;
|
|
@@ -1884,12 +1935,12 @@
|
|
|
1884
1935
|
return handler.wrapValue(originalGet.call(unwrap$1(this)));
|
|
1885
1936
|
};
|
|
1886
1937
|
|
|
1887
|
-
getterMap
|
|
1938
|
+
getterMap.set(originalGet, get);
|
|
1888
1939
|
return get;
|
|
1889
1940
|
}
|
|
1890
1941
|
|
|
1891
1942
|
wrapSetter(originalSet) {
|
|
1892
|
-
const wrappedSetter = setterMap
|
|
1943
|
+
const wrappedSetter = setterMap.get(originalSet);
|
|
1893
1944
|
|
|
1894
1945
|
if (!isUndefined(wrappedSetter)) {
|
|
1895
1946
|
return wrappedSetter;
|
|
@@ -1898,16 +1949,20 @@
|
|
|
1898
1949
|
const set = function (v) {
|
|
1899
1950
|
};
|
|
1900
1951
|
|
|
1901
|
-
setterMap
|
|
1952
|
+
setterMap.set(originalSet, set);
|
|
1902
1953
|
return set;
|
|
1903
1954
|
}
|
|
1904
1955
|
|
|
1905
1956
|
set(shadowTarget, key, value) {
|
|
1957
|
+
/* istanbul ignore next */
|
|
1958
|
+
|
|
1906
1959
|
|
|
1907
1960
|
return false;
|
|
1908
1961
|
}
|
|
1909
1962
|
|
|
1910
1963
|
deleteProperty(shadowTarget, key) {
|
|
1964
|
+
/* istanbul ignore next */
|
|
1965
|
+
|
|
1911
1966
|
|
|
1912
1967
|
return false;
|
|
1913
1968
|
}
|
|
@@ -1916,11 +1971,15 @@
|
|
|
1916
1971
|
}
|
|
1917
1972
|
|
|
1918
1973
|
preventExtensions(shadowTarget) {
|
|
1974
|
+
/* istanbul ignore next */
|
|
1975
|
+
|
|
1919
1976
|
|
|
1920
1977
|
return false;
|
|
1921
1978
|
}
|
|
1922
1979
|
|
|
1923
1980
|
defineProperty(shadowTarget, key, descriptor) {
|
|
1981
|
+
/* istanbul ignore next */
|
|
1982
|
+
|
|
1924
1983
|
|
|
1925
1984
|
return false;
|
|
1926
1985
|
}
|
|
@@ -1968,7 +2027,8 @@
|
|
|
1968
2027
|
this.valueMutated = defaultValueMutated;
|
|
1969
2028
|
this.valueObserved = defaultValueObserved;
|
|
1970
2029
|
this.valueIsObservable = defaultValueIsObservable;
|
|
1971
|
-
this.
|
|
2030
|
+
this.readOnlyObjectGraph = new WeakMap();
|
|
2031
|
+
this.reactiveObjectGraph = new WeakMap();
|
|
1972
2032
|
|
|
1973
2033
|
if (!isUndefined(options)) {
|
|
1974
2034
|
const {
|
|
@@ -1991,10 +2051,13 @@
|
|
|
1991
2051
|
const distorted = this.valueDistortion(unwrappedValue);
|
|
1992
2052
|
|
|
1993
2053
|
if (this.valueIsObservable(distorted)) {
|
|
1994
|
-
|
|
1995
|
-
|
|
2054
|
+
if (this.readOnlyObjectGraph.get(distorted) === value) {
|
|
2055
|
+
// when trying to extract the writable version of a readonly
|
|
2056
|
+
// we return the readonly.
|
|
2057
|
+
return value;
|
|
2058
|
+
}
|
|
1996
2059
|
|
|
1997
|
-
return
|
|
2060
|
+
return this.getReactiveHandler(unwrappedValue, distorted);
|
|
1998
2061
|
}
|
|
1999
2062
|
|
|
2000
2063
|
return distorted;
|
|
@@ -2005,7 +2068,7 @@
|
|
|
2005
2068
|
const distorted = this.valueDistortion(value);
|
|
2006
2069
|
|
|
2007
2070
|
if (this.valueIsObservable(distorted)) {
|
|
2008
|
-
return this.
|
|
2071
|
+
return this.getReadOnlyHandler(value, distorted);
|
|
2009
2072
|
}
|
|
2010
2073
|
|
|
2011
2074
|
return distorted;
|
|
@@ -2015,47 +2078,36 @@
|
|
|
2015
2078
|
return unwrap$1(p);
|
|
2016
2079
|
}
|
|
2017
2080
|
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
objectGraph
|
|
2021
|
-
} = this;
|
|
2022
|
-
let reactiveState = objectGraph.get(distortedValue);
|
|
2081
|
+
getReactiveHandler(value, distortedValue) {
|
|
2082
|
+
let proxy = this.reactiveObjectGraph.get(distortedValue);
|
|
2023
2083
|
|
|
2024
|
-
if (
|
|
2025
|
-
|
|
2084
|
+
if (isUndefined(proxy)) {
|
|
2085
|
+
// caching the proxy after the first time it is accessed
|
|
2086
|
+
const handler = new ReactiveProxyHandler(this, distortedValue);
|
|
2087
|
+
proxy = new Proxy(createShadowTarget(distortedValue), handler);
|
|
2088
|
+
registerProxy(proxy, value);
|
|
2089
|
+
this.reactiveObjectGraph.set(distortedValue, proxy);
|
|
2026
2090
|
}
|
|
2027
2091
|
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
get reactive() {
|
|
2031
|
-
const reactiveHandler = new ReactiveProxyHandler(membrane, distortedValue); // caching the reactive proxy after the first time it is accessed
|
|
2032
|
-
|
|
2033
|
-
const proxy = new Proxy(createShadowTarget(distortedValue), reactiveHandler);
|
|
2034
|
-
registerProxy(proxy, value);
|
|
2035
|
-
ObjectDefineProperty(this, 'reactive', {
|
|
2036
|
-
value: proxy
|
|
2037
|
-
});
|
|
2038
|
-
return proxy;
|
|
2039
|
-
},
|
|
2092
|
+
return proxy;
|
|
2093
|
+
}
|
|
2040
2094
|
|
|
2041
|
-
|
|
2042
|
-
|
|
2095
|
+
getReadOnlyHandler(value, distortedValue) {
|
|
2096
|
+
let proxy = this.readOnlyObjectGraph.get(distortedValue);
|
|
2043
2097
|
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2098
|
+
if (isUndefined(proxy)) {
|
|
2099
|
+
// caching the proxy after the first time it is accessed
|
|
2100
|
+
const handler = new ReadOnlyHandler(this, distortedValue);
|
|
2101
|
+
proxy = new Proxy(createShadowTarget(distortedValue), handler);
|
|
2102
|
+
registerProxy(proxy, value);
|
|
2103
|
+
this.readOnlyObjectGraph.set(distortedValue, proxy);
|
|
2104
|
+
}
|
|
2051
2105
|
|
|
2052
|
-
|
|
2053
|
-
objectGraph.set(distortedValue, reactiveState);
|
|
2054
|
-
return reactiveState;
|
|
2106
|
+
return proxy;
|
|
2055
2107
|
}
|
|
2056
2108
|
|
|
2057
2109
|
}
|
|
2058
|
-
/** version: 1.
|
|
2110
|
+
/** version: 1.1.5 */
|
|
2059
2111
|
|
|
2060
2112
|
/*
|
|
2061
2113
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -2434,8 +2486,10 @@
|
|
|
2434
2486
|
} = vm;
|
|
2435
2487
|
|
|
2436
2488
|
return renderer[rendererMethod](elm);
|
|
2437
|
-
}
|
|
2489
|
+
},
|
|
2438
2490
|
|
|
2491
|
+
configurable: true,
|
|
2492
|
+
enumerable: true
|
|
2439
2493
|
};
|
|
2440
2494
|
}
|
|
2441
2495
|
|
|
@@ -2451,8 +2505,11 @@
|
|
|
2451
2505
|
} = vm;
|
|
2452
2506
|
|
|
2453
2507
|
return renderer[queryMethod](elm, arg);
|
|
2454
|
-
}
|
|
2508
|
+
},
|
|
2455
2509
|
|
|
2510
|
+
configurable: true,
|
|
2511
|
+
enumerable: true,
|
|
2512
|
+
writable: true
|
|
2456
2513
|
};
|
|
2457
2514
|
}
|
|
2458
2515
|
|
|
@@ -3303,7 +3360,7 @@
|
|
|
3303
3360
|
renderMode: 1
|
|
3304
3361
|
/* Shadow */
|
|
3305
3362
|
,
|
|
3306
|
-
shadowSupportMode: "
|
|
3363
|
+
shadowSupportMode: "reset"
|
|
3307
3364
|
/* Default */
|
|
3308
3365
|
,
|
|
3309
3366
|
wire: EmptyObject,
|
|
@@ -3429,6 +3486,17 @@
|
|
|
3429
3486
|
modComputedStyle.create(vnode);
|
|
3430
3487
|
}
|
|
3431
3488
|
|
|
3489
|
+
function hydrateElmHook(vnode) {
|
|
3490
|
+
modEvents.create(vnode); // Attrs are already on the element.
|
|
3491
|
+
// modAttrs.create(vnode);
|
|
3492
|
+
|
|
3493
|
+
modProps.create(vnode); // Already set.
|
|
3494
|
+
// modStaticClassName.create(vnode);
|
|
3495
|
+
// modStaticStyle.create(vnode);
|
|
3496
|
+
// modComputedClassName.create(vnode);
|
|
3497
|
+
// modComputedStyle.create(vnode);
|
|
3498
|
+
}
|
|
3499
|
+
|
|
3432
3500
|
function fallbackElmHook(elm, vnode) {
|
|
3433
3501
|
const {
|
|
3434
3502
|
owner
|
|
@@ -3578,6 +3646,22 @@
|
|
|
3578
3646
|
}
|
|
3579
3647
|
}
|
|
3580
3648
|
|
|
3649
|
+
function hydrateChildrenHook(elmChildren, children, vm) {
|
|
3650
|
+
|
|
3651
|
+
let elmCurrentChildIdx = 0;
|
|
3652
|
+
|
|
3653
|
+
for (let j = 0, n = children.length; j < n; j++) {
|
|
3654
|
+
const ch = children[j];
|
|
3655
|
+
|
|
3656
|
+
if (ch != null) {
|
|
3657
|
+
const childNode = elmChildren[elmCurrentChildIdx];
|
|
3658
|
+
|
|
3659
|
+
ch.hook.hydrate(ch, childNode);
|
|
3660
|
+
elmCurrentChildIdx++;
|
|
3661
|
+
}
|
|
3662
|
+
}
|
|
3663
|
+
}
|
|
3664
|
+
|
|
3581
3665
|
function updateCustomElmHook(oldVnode, vnode) {
|
|
3582
3666
|
// Attrs need to be applied to element before props
|
|
3583
3667
|
// IE11 will wipe out value on radio inputs if value
|
|
@@ -3661,38 +3745,6 @@
|
|
|
3661
3745
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3662
3746
|
*/
|
|
3663
3747
|
|
|
3664
|
-
/**
|
|
3665
|
-
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
|
3666
|
-
* libraries to sanitize HTML content. This hook process the content passed via the template to
|
|
3667
|
-
* lwc:inner-html directive.
|
|
3668
|
-
* It is meant to be overridden with setSanitizeHtmlContentHook
|
|
3669
|
-
*/
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
let sanitizeHtmlContentHook = () => {
|
|
3673
|
-
// locker-service patches this function during runtime to sanitize HTML content.
|
|
3674
|
-
throw new Error('sanitizeHtmlContent hook must be implemented.');
|
|
3675
|
-
};
|
|
3676
|
-
/**
|
|
3677
|
-
* Sets the sanitizeHtmlContentHook.
|
|
3678
|
-
*
|
|
3679
|
-
* @param newHookImpl
|
|
3680
|
-
* @returns oldHookImplementation.
|
|
3681
|
-
*/
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
function setSanitizeHtmlContentHook(newHookImpl) {
|
|
3685
|
-
const currentHook = sanitizeHtmlContentHook;
|
|
3686
|
-
sanitizeHtmlContentHook = newHookImpl;
|
|
3687
|
-
return currentHook;
|
|
3688
|
-
}
|
|
3689
|
-
/*
|
|
3690
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
3691
|
-
* All rights reserved.
|
|
3692
|
-
* SPDX-License-Identifier: MIT
|
|
3693
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3694
|
-
*/
|
|
3695
|
-
|
|
3696
3748
|
|
|
3697
3749
|
const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
3698
3750
|
const SymbolIterator = Symbol.iterator;
|
|
@@ -3711,7 +3763,14 @@
|
|
|
3711
3763
|
update: updateNodeHook,
|
|
3712
3764
|
insert: insertNodeHook,
|
|
3713
3765
|
move: insertNodeHook,
|
|
3714
|
-
remove: removeNodeHook
|
|
3766
|
+
remove: removeNodeHook,
|
|
3767
|
+
hydrate: (vNode, node) => {
|
|
3768
|
+
var _a;
|
|
3769
|
+
|
|
3770
|
+
|
|
3771
|
+
node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
|
|
3772
|
+
vNode.elm = node;
|
|
3773
|
+
}
|
|
3715
3774
|
};
|
|
3716
3775
|
const CommentHook = {
|
|
3717
3776
|
create: vnode => {
|
|
@@ -3729,7 +3788,14 @@
|
|
|
3729
3788
|
update: updateNodeHook,
|
|
3730
3789
|
insert: insertNodeHook,
|
|
3731
3790
|
move: insertNodeHook,
|
|
3732
|
-
remove: removeNodeHook
|
|
3791
|
+
remove: removeNodeHook,
|
|
3792
|
+
hydrate: (vNode, node) => {
|
|
3793
|
+
var _a;
|
|
3794
|
+
|
|
3795
|
+
|
|
3796
|
+
node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
|
|
3797
|
+
vNode.elm = node;
|
|
3798
|
+
}
|
|
3733
3799
|
}; // insert is called after update, which is used somewhere else (via a module)
|
|
3734
3800
|
// to mark the vm as inserted, that means we cannot use update as the main channel
|
|
3735
3801
|
// to rehydrate when dirty, because sometimes the element is not inserted just yet,
|
|
@@ -3769,6 +3835,38 @@
|
|
|
3769
3835
|
remove: (vnode, parentNode) => {
|
|
3770
3836
|
removeNodeHook(vnode, parentNode);
|
|
3771
3837
|
removeElmHook(vnode);
|
|
3838
|
+
},
|
|
3839
|
+
hydrate: (vnode, node) => {
|
|
3840
|
+
const elm = node;
|
|
3841
|
+
vnode.elm = elm;
|
|
3842
|
+
const {
|
|
3843
|
+
context
|
|
3844
|
+
} = vnode.data;
|
|
3845
|
+
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
|
|
3846
|
+
/* manual */
|
|
3847
|
+
);
|
|
3848
|
+
|
|
3849
|
+
if (isDomManual) {
|
|
3850
|
+
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
3851
|
+
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
3852
|
+
const {
|
|
3853
|
+
props
|
|
3854
|
+
} = vnode.data;
|
|
3855
|
+
|
|
3856
|
+
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
3857
|
+
if (elm.innerHTML === props.innerHTML) {
|
|
3858
|
+
delete props.innerHTML;
|
|
3859
|
+
} else {
|
|
3860
|
+
logWarn(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
|
|
3861
|
+
}
|
|
3862
|
+
}
|
|
3863
|
+
}
|
|
3864
|
+
|
|
3865
|
+
hydrateElmHook(vnode);
|
|
3866
|
+
|
|
3867
|
+
if (!isDomManual) {
|
|
3868
|
+
hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vnode.owner);
|
|
3869
|
+
}
|
|
3772
3870
|
}
|
|
3773
3871
|
};
|
|
3774
3872
|
const CustomElementHook = {
|
|
@@ -3852,6 +3950,38 @@
|
|
|
3852
3950
|
// will take care of disconnecting any child VM attached to its shadow as well.
|
|
3853
3951
|
removeVM(vm);
|
|
3854
3952
|
}
|
|
3953
|
+
},
|
|
3954
|
+
hydrate: (vnode, elm) => {
|
|
3955
|
+
// the element is created, but the vm is not
|
|
3956
|
+
const {
|
|
3957
|
+
sel,
|
|
3958
|
+
mode,
|
|
3959
|
+
ctor,
|
|
3960
|
+
owner
|
|
3961
|
+
} = vnode;
|
|
3962
|
+
const def = getComponentInternalDef(ctor);
|
|
3963
|
+
createVM(elm, def, {
|
|
3964
|
+
mode,
|
|
3965
|
+
owner,
|
|
3966
|
+
tagName: sel,
|
|
3967
|
+
renderer: owner.renderer
|
|
3968
|
+
});
|
|
3969
|
+
vnode.elm = elm;
|
|
3970
|
+
const vm = getAssociatedVM(elm);
|
|
3971
|
+
allocateChildrenHook(vnode, vm);
|
|
3972
|
+
hydrateElmHook(vnode); // Insert hook section:
|
|
3973
|
+
|
|
3974
|
+
runConnectedCallback(vm);
|
|
3975
|
+
|
|
3976
|
+
if (vm.renderMode !== 0
|
|
3977
|
+
/* Light */
|
|
3978
|
+
) {
|
|
3979
|
+
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
3980
|
+
// Note: for Light DOM, this is handled while hydrating the VM
|
|
3981
|
+
hydrateChildrenHook(vnode.elm.childNodes, vnode.children);
|
|
3982
|
+
}
|
|
3983
|
+
|
|
3984
|
+
hydrateVM(vm);
|
|
3855
3985
|
}
|
|
3856
3986
|
};
|
|
3857
3987
|
|
|
@@ -3987,7 +4117,7 @@
|
|
|
3987
4117
|
next = iterator.next();
|
|
3988
4118
|
last = next.done; // template factory logic based on the previous collected value
|
|
3989
4119
|
|
|
3990
|
-
const vnode = factory(value, j, j === 0, last);
|
|
4120
|
+
const vnode = factory(value, j, j === 0, last === true);
|
|
3991
4121
|
|
|
3992
4122
|
if (isArray$1(vnode)) {
|
|
3993
4123
|
ArrayPush$1.apply(list, vnode);
|
|
@@ -4061,7 +4191,7 @@
|
|
|
4061
4191
|
|
|
4062
4192
|
|
|
4063
4193
|
function d(value) {
|
|
4064
|
-
return value == null ? '' : value;
|
|
4194
|
+
return value == null ? '' : String(value);
|
|
4065
4195
|
} // [b]ind function
|
|
4066
4196
|
|
|
4067
4197
|
|
|
@@ -4202,6 +4332,26 @@
|
|
|
4202
4332
|
|
|
4203
4333
|
markAsDynamicChildren(vnodes);
|
|
4204
4334
|
return vnodes;
|
|
4335
|
+
}
|
|
4336
|
+
/**
|
|
4337
|
+
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
|
4338
|
+
* libraries to sanitize HTML content. This hook process the content passed via the template to
|
|
4339
|
+
* lwc:inner-html directive.
|
|
4340
|
+
* It is meant to be overridden with setSanitizeHtmlContentHook, it throws an error by default.
|
|
4341
|
+
*/
|
|
4342
|
+
|
|
4343
|
+
|
|
4344
|
+
let sanitizeHtmlContentHook = () => {
|
|
4345
|
+
// locker-service patches this function during runtime to sanitize HTML content.
|
|
4346
|
+
throw new Error('sanitizeHtmlContent hook must be implemented.');
|
|
4347
|
+
};
|
|
4348
|
+
/**
|
|
4349
|
+
* Sets the sanitizeHtmlContentHook.
|
|
4350
|
+
*/
|
|
4351
|
+
|
|
4352
|
+
|
|
4353
|
+
function setSanitizeHtmlContentHook(newHookImpl) {
|
|
4354
|
+
sanitizeHtmlContentHook = newHookImpl;
|
|
4205
4355
|
} // [s]anitize [h]tml [c]ontent
|
|
4206
4356
|
|
|
4207
4357
|
|
|
@@ -4209,24 +4359,22 @@
|
|
|
4209
4359
|
return sanitizeHtmlContentHook(content);
|
|
4210
4360
|
}
|
|
4211
4361
|
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
h
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
gid
|
|
4226
|
-
fid
|
|
4227
|
-
|
|
4228
|
-
sc: sc,
|
|
4229
|
-
shc: shc
|
|
4362
|
+
const api = freeze({
|
|
4363
|
+
s,
|
|
4364
|
+
h,
|
|
4365
|
+
c,
|
|
4366
|
+
i,
|
|
4367
|
+
f,
|
|
4368
|
+
t,
|
|
4369
|
+
d,
|
|
4370
|
+
b,
|
|
4371
|
+
k,
|
|
4372
|
+
co,
|
|
4373
|
+
dc,
|
|
4374
|
+
ti,
|
|
4375
|
+
gid,
|
|
4376
|
+
fid,
|
|
4377
|
+
shc
|
|
4230
4378
|
});
|
|
4231
4379
|
/*
|
|
4232
4380
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -4240,12 +4388,12 @@
|
|
|
4240
4388
|
}
|
|
4241
4389
|
|
|
4242
4390
|
function createInlineStyleVNode(content) {
|
|
4243
|
-
return h('style', {
|
|
4391
|
+
return api.h('style', {
|
|
4244
4392
|
key: 'style',
|
|
4245
4393
|
attrs: {
|
|
4246
4394
|
type: 'text/css'
|
|
4247
4395
|
}
|
|
4248
|
-
}, [t(content)]);
|
|
4396
|
+
}, [api.t(content)]);
|
|
4249
4397
|
}
|
|
4250
4398
|
|
|
4251
4399
|
function updateStylesheetToken(vm, template) {
|
|
@@ -4313,6 +4461,7 @@
|
|
|
4313
4461
|
|
|
4314
4462
|
function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
4315
4463
|
const content = [];
|
|
4464
|
+
let root;
|
|
4316
4465
|
|
|
4317
4466
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4318
4467
|
let stylesheet = stylesheets[i];
|
|
@@ -4320,22 +4469,45 @@
|
|
|
4320
4469
|
if (isArray$1(stylesheet)) {
|
|
4321
4470
|
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
|
|
4322
4471
|
} else {
|
|
4323
|
-
// native shadow DOM. Synthetic shadow DOM never uses `:host`.
|
|
4324
4472
|
|
|
4473
|
+
const isScopedCss = stylesheet[KEY__SCOPED_CSS]; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
|
|
4474
|
+
|
|
4475
|
+
const scopeToken = isScopedCss || vm.shadowMode === 1
|
|
4476
|
+
/* Synthetic */
|
|
4477
|
+
&& vm.renderMode === 1
|
|
4478
|
+
/* Shadow */
|
|
4479
|
+
? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
|
|
4480
|
+
// native shadow DOM. Synthetic shadow DOM never uses `:host`.
|
|
4325
4481
|
|
|
4326
|
-
const isScopedCss = stylesheet[KEY__SCOPED_CSS];
|
|
4327
4482
|
const useActualHostSelector = vm.renderMode === 0
|
|
4328
4483
|
/* Light */
|
|
4329
4484
|
? !isScopedCss : vm.shadowMode === 0
|
|
4330
4485
|
/* Native */
|
|
4331
|
-
; //
|
|
4486
|
+
; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
|
|
4487
|
+
// we use an attribute selector on the host to simulate :dir().
|
|
4332
4488
|
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4489
|
+
let useNativeDirPseudoclass;
|
|
4490
|
+
|
|
4491
|
+
if (vm.renderMode === 1
|
|
4336
4492
|
/* Shadow */
|
|
4337
|
-
|
|
4338
|
-
|
|
4493
|
+
) {
|
|
4494
|
+
useNativeDirPseudoclass = vm.shadowMode === 0
|
|
4495
|
+
/* Native */
|
|
4496
|
+
;
|
|
4497
|
+
} else {
|
|
4498
|
+
// Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
|
|
4499
|
+
// At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
|
|
4500
|
+
if (isUndefined$1(root)) {
|
|
4501
|
+
// Only calculate the root once as necessary
|
|
4502
|
+
root = getNearestShadowComponent(vm);
|
|
4503
|
+
}
|
|
4504
|
+
|
|
4505
|
+
useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
|
|
4506
|
+
/* Native */
|
|
4507
|
+
;
|
|
4508
|
+
}
|
|
4509
|
+
|
|
4510
|
+
ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
|
|
4339
4511
|
}
|
|
4340
4512
|
}
|
|
4341
4513
|
|
|
@@ -4359,14 +4531,12 @@
|
|
|
4359
4531
|
// https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
|
|
4360
4532
|
|
|
4361
4533
|
|
|
4362
|
-
function
|
|
4534
|
+
function getNearestShadowComponent(vm) {
|
|
4363
4535
|
let owner = vm;
|
|
4364
4536
|
|
|
4365
4537
|
while (!isNull(owner)) {
|
|
4366
4538
|
if (owner.renderMode === 1
|
|
4367
4539
|
/* Shadow */
|
|
4368
|
-
&& owner.shadowMode === 0
|
|
4369
|
-
/* Native */
|
|
4370
4540
|
) {
|
|
4371
4541
|
return owner;
|
|
4372
4542
|
}
|
|
@@ -4377,6 +4547,20 @@
|
|
|
4377
4547
|
return owner;
|
|
4378
4548
|
}
|
|
4379
4549
|
|
|
4550
|
+
function getNearestNativeShadowComponent(vm) {
|
|
4551
|
+
const owner = getNearestShadowComponent(vm);
|
|
4552
|
+
|
|
4553
|
+
if (!isNull(owner) && owner.shadowMode === 1
|
|
4554
|
+
/* Synthetic */
|
|
4555
|
+
) {
|
|
4556
|
+
// Synthetic-within-native is impossible. So if the nearest shadow component is
|
|
4557
|
+
// synthetic, we know we won't find a native component if we go any further.
|
|
4558
|
+
return null;
|
|
4559
|
+
}
|
|
4560
|
+
|
|
4561
|
+
return owner;
|
|
4562
|
+
}
|
|
4563
|
+
|
|
4380
4564
|
function createStylesheet(vm, stylesheets) {
|
|
4381
4565
|
const {
|
|
4382
4566
|
renderer,
|
|
@@ -4392,7 +4576,10 @@
|
|
|
4392
4576
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4393
4577
|
renderer.insertGlobalStylesheet(stylesheets[i]);
|
|
4394
4578
|
}
|
|
4395
|
-
} else if (renderer.ssr) {
|
|
4579
|
+
} else if (renderer.ssr || renderer.isHydrating()) {
|
|
4580
|
+
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
4581
|
+
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
4582
|
+
// the first time the VM renders.
|
|
4396
4583
|
// native shadow or light DOM, SSR
|
|
4397
4584
|
const combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
|
|
4398
4585
|
return createInlineStyleVNode(combinedStylesheetContent);
|
|
@@ -4891,6 +5078,12 @@
|
|
|
4891
5078
|
, vm);
|
|
4892
5079
|
}
|
|
4893
5080
|
|
|
5081
|
+
function hydrateRootElement(elm) {
|
|
5082
|
+
const vm = getAssociatedVM(elm);
|
|
5083
|
+
runConnectedCallback(vm);
|
|
5084
|
+
hydrateVM(vm);
|
|
5085
|
+
}
|
|
5086
|
+
|
|
4894
5087
|
function disconnectRootElement(elm) {
|
|
4895
5088
|
const vm = getAssociatedVM(elm);
|
|
4896
5089
|
resetComponentStateWhenRemoved(vm);
|
|
@@ -4898,6 +5091,10 @@
|
|
|
4898
5091
|
|
|
4899
5092
|
function appendVM(vm) {
|
|
4900
5093
|
rehydrate(vm);
|
|
5094
|
+
}
|
|
5095
|
+
|
|
5096
|
+
function hydrateVM(vm) {
|
|
5097
|
+
hydrate(vm);
|
|
4901
5098
|
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
4902
5099
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
4903
5100
|
|
|
@@ -5092,6 +5289,22 @@
|
|
|
5092
5289
|
}
|
|
5093
5290
|
}
|
|
5094
5291
|
|
|
5292
|
+
function hydrate(vm) {
|
|
5293
|
+
if (isTrue(vm.isDirty)) {
|
|
5294
|
+
// manually diffing/patching here.
|
|
5295
|
+
// This routine is:
|
|
5296
|
+
// patchShadowRoot(vm, children);
|
|
5297
|
+
// -> addVnodes.
|
|
5298
|
+
const children = renderComponent(vm);
|
|
5299
|
+
vm.children = children;
|
|
5300
|
+
const vmChildren = vm.renderMode === 0
|
|
5301
|
+
/* Light */
|
|
5302
|
+
? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;
|
|
5303
|
+
hydrateChildrenHook(vmChildren, children);
|
|
5304
|
+
runRenderedCallback(vm);
|
|
5305
|
+
}
|
|
5306
|
+
}
|
|
5307
|
+
|
|
5095
5308
|
function patchShadowRoot(vm, newCh) {
|
|
5096
5309
|
const {
|
|
5097
5310
|
children: oldCh
|
|
@@ -5881,25 +6094,12 @@
|
|
|
5881
6094
|
|
|
5882
6095
|
let hooksAreSet = false;
|
|
5883
6096
|
|
|
5884
|
-
function overrideHooks(hooks) {
|
|
5885
|
-
const oldHooks = {};
|
|
5886
|
-
|
|
5887
|
-
if (!isUndefined$1(hooks.sanitizeHtmlContent)) {
|
|
5888
|
-
oldHooks.sanitizeHtmlContent = setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
5889
|
-
}
|
|
5890
|
-
|
|
5891
|
-
return oldHooks;
|
|
5892
|
-
}
|
|
5893
|
-
|
|
5894
6097
|
function setHooks(hooks) {
|
|
5895
6098
|
assert.isFalse(hooksAreSet, 'Hooks are already overridden, only one definition is allowed.');
|
|
5896
|
-
overrideHooks(hooks);
|
|
5897
6099
|
hooksAreSet = true;
|
|
6100
|
+
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
5898
6101
|
}
|
|
5899
|
-
|
|
5900
|
-
function setHooksForTest(hooks) {
|
|
5901
|
-
}
|
|
5902
|
-
/* version: 2.5.5-canary1 */
|
|
6102
|
+
/* version: 2.5.9 */
|
|
5903
6103
|
|
|
5904
6104
|
/*
|
|
5905
6105
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6034,8 +6234,19 @@
|
|
|
6034
6234
|
HTMLElementConstructor.prototype = HTMLElement.prototype;
|
|
6035
6235
|
}
|
|
6036
6236
|
|
|
6237
|
+
let isHydrating = false;
|
|
6238
|
+
|
|
6239
|
+
function setIsHydrating(v) {
|
|
6240
|
+
isHydrating = v;
|
|
6241
|
+
}
|
|
6242
|
+
|
|
6037
6243
|
const renderer = {
|
|
6038
6244
|
ssr: false,
|
|
6245
|
+
|
|
6246
|
+
isHydrating() {
|
|
6247
|
+
return isHydrating;
|
|
6248
|
+
},
|
|
6249
|
+
|
|
6039
6250
|
isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
|
|
6040
6251
|
isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
|
|
6041
6252
|
|
|
@@ -6064,6 +6275,10 @@
|
|
|
6064
6275
|
},
|
|
6065
6276
|
|
|
6066
6277
|
attachShadow(element, options) {
|
|
6278
|
+
if (isHydrating) {
|
|
6279
|
+
return element.shadowRoot;
|
|
6280
|
+
}
|
|
6281
|
+
|
|
6067
6282
|
return element.attachShadow(options);
|
|
6068
6283
|
},
|
|
6069
6284
|
|
|
@@ -6195,57 +6410,6 @@
|
|
|
6195
6410
|
getCustomElement,
|
|
6196
6411
|
HTMLElement: HTMLElementConstructor
|
|
6197
6412
|
};
|
|
6198
|
-
/*
|
|
6199
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
6200
|
-
* All rights reserved.
|
|
6201
|
-
* SPDX-License-Identifier: MIT
|
|
6202
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6203
|
-
*/
|
|
6204
|
-
|
|
6205
|
-
/**
|
|
6206
|
-
* This function builds a Web Component class from a LWC constructor so it can be
|
|
6207
|
-
* registered as a new element via customElements.define() at any given time.
|
|
6208
|
-
*
|
|
6209
|
-
* @deprecated since version 1.3.11
|
|
6210
|
-
*
|
|
6211
|
-
* @example
|
|
6212
|
-
* ```
|
|
6213
|
-
* import { buildCustomElementConstructor } from 'lwc';
|
|
6214
|
-
* import Foo from 'ns/foo';
|
|
6215
|
-
* const WC = buildCustomElementConstructor(Foo);
|
|
6216
|
-
* customElements.define('x-foo', WC);
|
|
6217
|
-
* const elm = document.createElement('x-foo');
|
|
6218
|
-
* ```
|
|
6219
|
-
*/
|
|
6220
|
-
|
|
6221
|
-
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
6222
|
-
|
|
6223
|
-
return Ctor.CustomElementConstructor;
|
|
6224
|
-
}
|
|
6225
|
-
|
|
6226
|
-
function buildCustomElementConstructor(Ctor) {
|
|
6227
|
-
const def = getComponentInternalDef(Ctor);
|
|
6228
|
-
return class extends def.bridge {
|
|
6229
|
-
constructor() {
|
|
6230
|
-
super();
|
|
6231
|
-
createVM(this, def, {
|
|
6232
|
-
mode: 'open',
|
|
6233
|
-
owner: null,
|
|
6234
|
-
tagName: this.tagName,
|
|
6235
|
-
renderer
|
|
6236
|
-
});
|
|
6237
|
-
}
|
|
6238
|
-
|
|
6239
|
-
connectedCallback() {
|
|
6240
|
-
connectRootElement(this);
|
|
6241
|
-
}
|
|
6242
|
-
|
|
6243
|
-
disconnectedCallback() {
|
|
6244
|
-
disconnectRootElement(this);
|
|
6245
|
-
}
|
|
6246
|
-
|
|
6247
|
-
};
|
|
6248
|
-
}
|
|
6249
6413
|
/*
|
|
6250
6414
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
6251
6415
|
* All rights reserved.
|
|
@@ -6255,7 +6419,6 @@
|
|
|
6255
6419
|
// TODO [#2472]: Remove this workaround when appropriate.
|
|
6256
6420
|
// eslint-disable-next-line lwc-internal/no-global-node
|
|
6257
6421
|
|
|
6258
|
-
|
|
6259
6422
|
const _Node$1 = Node;
|
|
6260
6423
|
const ConnectingSlot = new WeakMap();
|
|
6261
6424
|
const DisconnectingSlot = new WeakMap();
|
|
@@ -6363,6 +6526,114 @@
|
|
|
6363
6526
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6364
6527
|
*/
|
|
6365
6528
|
|
|
6529
|
+
|
|
6530
|
+
function hydrateComponent(element, Ctor, props = {}) {
|
|
6531
|
+
if (!isFunction$1(Ctor)) {
|
|
6532
|
+
throw new TypeError(`"hydrateComponent" expects a valid component constructor as the second parameter but instead received ${Ctor}.`);
|
|
6533
|
+
}
|
|
6534
|
+
|
|
6535
|
+
if (!isObject(props) || isNull(props)) {
|
|
6536
|
+
throw new TypeError(`"hydrateComponent" expects an object as the third parameter but instead received ${props}.`);
|
|
6537
|
+
}
|
|
6538
|
+
|
|
6539
|
+
const def = getComponentInternalDef(Ctor);
|
|
6540
|
+
|
|
6541
|
+
try {
|
|
6542
|
+
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
6543
|
+
// and uses the same algo to create the stylesheets as in SSR.
|
|
6544
|
+
setIsHydrating(true);
|
|
6545
|
+
createVM(element, def, {
|
|
6546
|
+
mode: 'open',
|
|
6547
|
+
owner: null,
|
|
6548
|
+
renderer,
|
|
6549
|
+
tagName: element.tagName.toLowerCase()
|
|
6550
|
+
});
|
|
6551
|
+
|
|
6552
|
+
for (const [key, value] of Object.entries(props)) {
|
|
6553
|
+
element[key] = value;
|
|
6554
|
+
}
|
|
6555
|
+
|
|
6556
|
+
hydrateRootElement(element); // set it back since now we finished hydration.
|
|
6557
|
+
|
|
6558
|
+
setIsHydrating(false);
|
|
6559
|
+
} catch (e) {
|
|
6560
|
+
// Fallback: In case there's an error while hydrating, let's log the error, and replace the element with
|
|
6561
|
+
// the client generated DOM.
|
|
6562
|
+
|
|
6563
|
+
/* eslint-disable-next-line no-console */
|
|
6564
|
+
console.error('Recovering from error while hydrating: ', e);
|
|
6565
|
+
setIsHydrating(false);
|
|
6566
|
+
const newElem = createElement(element.tagName, {
|
|
6567
|
+
is: Ctor,
|
|
6568
|
+
mode: 'open'
|
|
6569
|
+
});
|
|
6570
|
+
|
|
6571
|
+
for (const [key, value] of Object.entries(props)) {
|
|
6572
|
+
newElem[key] = value;
|
|
6573
|
+
}
|
|
6574
|
+
|
|
6575
|
+
element.parentNode.replaceChild(newElem, element);
|
|
6576
|
+
}
|
|
6577
|
+
}
|
|
6578
|
+
/*
|
|
6579
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6580
|
+
* All rights reserved.
|
|
6581
|
+
* SPDX-License-Identifier: MIT
|
|
6582
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6583
|
+
*/
|
|
6584
|
+
|
|
6585
|
+
/**
|
|
6586
|
+
* This function builds a Web Component class from a LWC constructor so it can be
|
|
6587
|
+
* registered as a new element via customElements.define() at any given time.
|
|
6588
|
+
*
|
|
6589
|
+
* @deprecated since version 1.3.11
|
|
6590
|
+
*
|
|
6591
|
+
* @example
|
|
6592
|
+
* ```
|
|
6593
|
+
* import { buildCustomElementConstructor } from 'lwc';
|
|
6594
|
+
* import Foo from 'ns/foo';
|
|
6595
|
+
* const WC = buildCustomElementConstructor(Foo);
|
|
6596
|
+
* customElements.define('x-foo', WC);
|
|
6597
|
+
* const elm = document.createElement('x-foo');
|
|
6598
|
+
* ```
|
|
6599
|
+
*/
|
|
6600
|
+
|
|
6601
|
+
|
|
6602
|
+
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
6603
|
+
|
|
6604
|
+
return Ctor.CustomElementConstructor;
|
|
6605
|
+
}
|
|
6606
|
+
|
|
6607
|
+
function buildCustomElementConstructor(Ctor) {
|
|
6608
|
+
const def = getComponentInternalDef(Ctor);
|
|
6609
|
+
return class extends def.bridge {
|
|
6610
|
+
constructor() {
|
|
6611
|
+
super();
|
|
6612
|
+
createVM(this, def, {
|
|
6613
|
+
mode: 'open',
|
|
6614
|
+
owner: null,
|
|
6615
|
+
tagName: this.tagName,
|
|
6616
|
+
renderer
|
|
6617
|
+
});
|
|
6618
|
+
}
|
|
6619
|
+
|
|
6620
|
+
connectedCallback() {
|
|
6621
|
+
connectRootElement(this);
|
|
6622
|
+
}
|
|
6623
|
+
|
|
6624
|
+
disconnectedCallback() {
|
|
6625
|
+
disconnectRootElement(this);
|
|
6626
|
+
}
|
|
6627
|
+
|
|
6628
|
+
};
|
|
6629
|
+
}
|
|
6630
|
+
/*
|
|
6631
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6632
|
+
* All rights reserved.
|
|
6633
|
+
* SPDX-License-Identifier: MIT
|
|
6634
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6635
|
+
*/
|
|
6636
|
+
|
|
6366
6637
|
/**
|
|
6367
6638
|
* EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
|
|
6368
6639
|
* This API is subject to change or being removed.
|
|
@@ -6462,7 +6733,7 @@
|
|
|
6462
6733
|
});
|
|
6463
6734
|
freeze(LightningElement);
|
|
6464
6735
|
seal(LightningElement.prototype);
|
|
6465
|
-
/* version: 2.5.
|
|
6736
|
+
/* version: 2.5.9 */
|
|
6466
6737
|
|
|
6467
6738
|
exports.LightningElement = LightningElement;
|
|
6468
6739
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
@@ -6472,6 +6743,7 @@
|
|
|
6472
6743
|
exports.createElement = createElement;
|
|
6473
6744
|
exports.getComponentConstructor = getComponentConstructor;
|
|
6474
6745
|
exports.getComponentDef = getComponentDef;
|
|
6746
|
+
exports.hydrateComponent = hydrateComponent;
|
|
6475
6747
|
exports.isComponentConstructor = isComponentConstructor;
|
|
6476
6748
|
exports.isNodeFromTemplate = isNodeFromTemplate;
|
|
6477
6749
|
exports.readonly = readonly;
|
|
@@ -6483,7 +6755,6 @@
|
|
|
6483
6755
|
exports.setFeatureFlag = setFeatureFlag;
|
|
6484
6756
|
exports.setFeatureFlagForTest = setFeatureFlagForTest;
|
|
6485
6757
|
exports.setHooks = setHooks;
|
|
6486
|
-
exports.setHooksForTest = setHooksForTest;
|
|
6487
6758
|
exports.swapComponent = swapComponent;
|
|
6488
6759
|
exports.swapStyle = swapStyle;
|
|
6489
6760
|
exports.swapTemplate = swapTemplate;
|
|
@@ -6493,4 +6764,4 @@
|
|
|
6493
6764
|
|
|
6494
6765
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
6495
6766
|
|
|
6496
|
-
}))
|
|
6767
|
+
}));
|