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
|
@@ -7,8 +7,6 @@ var LWC = (function (exports) {
|
|
|
7
7
|
|
|
8
8
|
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
|
|
9
9
|
|
|
10
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
11
|
-
|
|
12
10
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
13
11
|
|
|
14
12
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -37,23 +35,25 @@ var LWC = (function (exports) {
|
|
|
37
35
|
|
|
38
36
|
function _getPrototypeOf2(o) { _getPrototypeOf2 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf2(o); }
|
|
39
37
|
|
|
40
|
-
function
|
|
38
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
41
39
|
|
|
42
|
-
function
|
|
40
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
43
41
|
|
|
44
|
-
function
|
|
42
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
45
43
|
|
|
46
|
-
function
|
|
44
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
45
|
+
|
|
46
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
47
47
|
|
|
48
48
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
49
49
|
|
|
50
50
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
51
51
|
|
|
52
|
-
function
|
|
52
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
53
53
|
|
|
54
|
-
function
|
|
54
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
55
55
|
|
|
56
|
-
function
|
|
56
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
57
57
|
|
|
58
58
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
59
59
|
|
|
@@ -120,9 +120,10 @@ var LWC = (function (exports) {
|
|
|
120
120
|
setPrototypeOf = Object.setPrototypeOf;
|
|
121
121
|
var isArray$1 = Array.isArray;
|
|
122
122
|
var _Array$prototype = Array.prototype,
|
|
123
|
+
ArrayFilter = _Array$prototype.filter,
|
|
123
124
|
ArrayIndexOf = _Array$prototype.indexOf,
|
|
124
125
|
ArrayJoin = _Array$prototype.join,
|
|
125
|
-
ArrayMap
|
|
126
|
+
ArrayMap = _Array$prototype.map,
|
|
126
127
|
ArrayPush$1 = _Array$prototype.push,
|
|
127
128
|
ArraySlice = _Array$prototype.slice,
|
|
128
129
|
ArraySplice = _Array$prototype.splice,
|
|
@@ -183,7 +184,7 @@ var LWC = (function (exports) {
|
|
|
183
184
|
// Array.prototype.toString directly will cause an error Iterate through
|
|
184
185
|
// all the items and handle individually.
|
|
185
186
|
if (isArray$1(obj)) {
|
|
186
|
-
return ArrayJoin.call(ArrayMap
|
|
187
|
+
return ArrayJoin.call(ArrayMap.call(obj, toString$1), ',');
|
|
187
188
|
}
|
|
188
189
|
|
|
189
190
|
return obj.toString();
|
|
@@ -347,7 +348,7 @@ var LWC = (function (exports) {
|
|
|
347
348
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
348
349
|
return attributeName;
|
|
349
350
|
}
|
|
350
|
-
/** version: 2.5.
|
|
351
|
+
/** version: 2.5.9 */
|
|
351
352
|
|
|
352
353
|
/*
|
|
353
354
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -527,7 +528,7 @@ var LWC = (function (exports) {
|
|
|
527
528
|
setFeatureFlag(name, value);
|
|
528
529
|
}
|
|
529
530
|
}
|
|
530
|
-
/** version: 2.5.
|
|
531
|
+
/** version: 2.5.9 */
|
|
531
532
|
|
|
532
533
|
/* proxy-compat-disable */
|
|
533
534
|
|
|
@@ -579,6 +580,42 @@ var LWC = (function (exports) {
|
|
|
579
580
|
}
|
|
580
581
|
|
|
581
582
|
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
583
|
+
} // Borrowed from Vue template compiler.
|
|
584
|
+
// https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
var DECLARATION_DELIMITER = /;(?![^(]*\))/g;
|
|
588
|
+
var PROPERTY_DELIMITER = /:(.+)/;
|
|
589
|
+
|
|
590
|
+
function parseStyleText(cssText) {
|
|
591
|
+
var styleMap = {};
|
|
592
|
+
var declarations = cssText.split(DECLARATION_DELIMITER);
|
|
593
|
+
|
|
594
|
+
var _iterator = _createForOfIteratorHelper(declarations),
|
|
595
|
+
_step;
|
|
596
|
+
|
|
597
|
+
try {
|
|
598
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
599
|
+
var declaration = _step.value;
|
|
600
|
+
|
|
601
|
+
if (declaration) {
|
|
602
|
+
var _declaration$split = declaration.split(PROPERTY_DELIMITER),
|
|
603
|
+
_declaration$split2 = _slicedToArray(_declaration$split, 2),
|
|
604
|
+
prop = _declaration$split2[0],
|
|
605
|
+
value = _declaration$split2[1];
|
|
606
|
+
|
|
607
|
+
if (prop !== undefined && value !== undefined) {
|
|
608
|
+
styleMap[prop.trim()] = value.trim();
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
} catch (err) {
|
|
613
|
+
_iterator.e(err);
|
|
614
|
+
} finally {
|
|
615
|
+
_iterator.f();
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
return styleMap;
|
|
582
619
|
}
|
|
583
620
|
/*
|
|
584
621
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
@@ -767,8 +804,8 @@ var LWC = (function (exports) {
|
|
|
767
804
|
*/
|
|
768
805
|
|
|
769
806
|
|
|
770
|
-
function
|
|
771
|
-
var msg = "[LWC
|
|
807
|
+
function log(method, message, vm) {
|
|
808
|
+
var msg = "[LWC ".concat(method, "]: ").concat(message);
|
|
772
809
|
|
|
773
810
|
if (!isUndefined$1(vm)) {
|
|
774
811
|
msg = "".concat(msg, "\n").concat(getComponentStack(vm));
|
|
@@ -776,7 +813,7 @@ var LWC = (function (exports) {
|
|
|
776
813
|
|
|
777
814
|
if (process.env.NODE_ENV === 'test') {
|
|
778
815
|
/* eslint-disable-next-line no-console */
|
|
779
|
-
console
|
|
816
|
+
console[method](msg);
|
|
780
817
|
return;
|
|
781
818
|
}
|
|
782
819
|
|
|
@@ -784,9 +821,17 @@ var LWC = (function (exports) {
|
|
|
784
821
|
throw new Error(msg);
|
|
785
822
|
} catch (e) {
|
|
786
823
|
/* eslint-disable-next-line no-console */
|
|
787
|
-
console
|
|
824
|
+
console[method](e);
|
|
788
825
|
}
|
|
789
826
|
}
|
|
827
|
+
|
|
828
|
+
function logError(message, vm) {
|
|
829
|
+
log('error', message, vm);
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
function logWarn(message, vm) {
|
|
833
|
+
log('warn', message, vm);
|
|
834
|
+
}
|
|
790
835
|
/*
|
|
791
836
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
792
837
|
* All rights reserved.
|
|
@@ -1945,7 +1990,10 @@ var LWC = (function (exports) {
|
|
|
1945
1990
|
// but it will always be compatible with the previous descriptor
|
|
1946
1991
|
// to preserve the object invariants, which makes these lines safe.
|
|
1947
1992
|
|
|
1948
|
-
var originalDescriptor = _getOwnPropertyDescriptor(originalTarget, key);
|
|
1993
|
+
var originalDescriptor = _getOwnPropertyDescriptor(originalTarget, key); // TODO: it should be impossible for the originalDescriptor to ever be undefined, this `if` can be removed
|
|
1994
|
+
|
|
1995
|
+
/* istanbul ignore else */
|
|
1996
|
+
|
|
1949
1997
|
|
|
1950
1998
|
if (!isUndefined(originalDescriptor)) {
|
|
1951
1999
|
var wrappedDesc = this.wrapDescriptor(originalDescriptor);
|
|
@@ -1970,12 +2018,18 @@ var LWC = (function (exports) {
|
|
|
1970
2018
|
|
|
1971
2019
|
_preventExtensions(shadowTarget);
|
|
1972
2020
|
} // Shared Traps
|
|
2021
|
+
// TODO: apply() is never called
|
|
2022
|
+
|
|
2023
|
+
/* istanbul ignore next */
|
|
1973
2024
|
|
|
1974
2025
|
}, {
|
|
1975
2026
|
key: "apply",
|
|
1976
2027
|
value: function apply(shadowTarget, thisArg, argArray) {
|
|
1977
2028
|
/* No op */
|
|
1978
|
-
}
|
|
2029
|
+
} // TODO: construct() is never called
|
|
2030
|
+
|
|
2031
|
+
/* istanbul ignore next */
|
|
2032
|
+
|
|
1979
2033
|
}, {
|
|
1980
2034
|
key: "construct",
|
|
1981
2035
|
value: function construct(shadowTarget, argArray, newTarget) {
|
|
@@ -2080,8 +2134,8 @@ var LWC = (function (exports) {
|
|
|
2080
2134
|
return BaseProxyHandler;
|
|
2081
2135
|
}();
|
|
2082
2136
|
|
|
2083
|
-
var getterMap = new WeakMap();
|
|
2084
|
-
var setterMap = new WeakMap();
|
|
2137
|
+
var getterMap$1 = new WeakMap();
|
|
2138
|
+
var setterMap$1 = new WeakMap();
|
|
2085
2139
|
var reverseGetterMap = new WeakMap();
|
|
2086
2140
|
var reverseSetterMap = new WeakMap();
|
|
2087
2141
|
|
|
@@ -2104,7 +2158,7 @@ var LWC = (function (exports) {
|
|
|
2104
2158
|
}, {
|
|
2105
2159
|
key: "wrapGetter",
|
|
2106
2160
|
value: function wrapGetter(originalGet) {
|
|
2107
|
-
var wrappedGetter = getterMap.get(originalGet);
|
|
2161
|
+
var wrappedGetter = getterMap$1.get(originalGet);
|
|
2108
2162
|
|
|
2109
2163
|
if (!isUndefined(wrappedGetter)) {
|
|
2110
2164
|
return wrappedGetter;
|
|
@@ -2117,14 +2171,14 @@ var LWC = (function (exports) {
|
|
|
2117
2171
|
return handler.wrapValue(originalGet.call(unwrap$1(this)));
|
|
2118
2172
|
};
|
|
2119
2173
|
|
|
2120
|
-
getterMap.set(originalGet, get);
|
|
2174
|
+
getterMap$1.set(originalGet, get);
|
|
2121
2175
|
reverseGetterMap.set(get, originalGet);
|
|
2122
2176
|
return get;
|
|
2123
2177
|
}
|
|
2124
2178
|
}, {
|
|
2125
2179
|
key: "wrapSetter",
|
|
2126
2180
|
value: function wrapSetter(originalSet) {
|
|
2127
|
-
var wrappedSetter = setterMap.get(originalSet);
|
|
2181
|
+
var wrappedSetter = setterMap$1.get(originalSet);
|
|
2128
2182
|
|
|
2129
2183
|
if (!isUndefined(wrappedSetter)) {
|
|
2130
2184
|
return wrappedSetter;
|
|
@@ -2135,7 +2189,7 @@ var LWC = (function (exports) {
|
|
|
2135
2189
|
originalSet.call(unwrap$1(this), unwrap$1(v));
|
|
2136
2190
|
};
|
|
2137
2191
|
|
|
2138
|
-
setterMap.set(originalSet, set);
|
|
2192
|
+
setterMap$1.set(originalSet, set);
|
|
2139
2193
|
reverseSetterMap.set(set, originalSet);
|
|
2140
2194
|
return set;
|
|
2141
2195
|
}
|
|
@@ -2176,7 +2230,7 @@ var LWC = (function (exports) {
|
|
|
2176
2230
|
return unwrap$1(redGet.call(handler.wrapValue(this)));
|
|
2177
2231
|
};
|
|
2178
2232
|
|
|
2179
|
-
getterMap.set(get, redGet);
|
|
2233
|
+
getterMap$1.set(get, redGet);
|
|
2180
2234
|
reverseGetterMap.set(redGet, get);
|
|
2181
2235
|
return get;
|
|
2182
2236
|
}
|
|
@@ -2196,7 +2250,7 @@ var LWC = (function (exports) {
|
|
|
2196
2250
|
redSet.call(handler.wrapValue(this), handler.wrapValue(v));
|
|
2197
2251
|
};
|
|
2198
2252
|
|
|
2199
|
-
setterMap.set(set, redSet);
|
|
2253
|
+
setterMap$1.set(set, redSet);
|
|
2200
2254
|
reverseSetterMap.set(redSet, set);
|
|
2201
2255
|
return set;
|
|
2202
2256
|
}
|
|
@@ -2232,6 +2286,7 @@ var LWC = (function (exports) {
|
|
|
2232
2286
|
}, {
|
|
2233
2287
|
key: "setPrototypeOf",
|
|
2234
2288
|
value: function setPrototypeOf(shadowTarget, prototype) {
|
|
2289
|
+
/* istanbul ignore else */
|
|
2235
2290
|
if (process.env.NODE_ENV !== 'production') {
|
|
2236
2291
|
throw new Error("Invalid setPrototypeOf invocation for reactive proxy ".concat(toString(this.originalTarget), ". Prototype of reactive objects cannot be changed."));
|
|
2237
2292
|
}
|
|
@@ -2245,6 +2300,11 @@ var LWC = (function (exports) {
|
|
|
2245
2300
|
_preventExtensions(originalTarget); // if the originalTarget is a proxy itself, it might reject
|
|
2246
2301
|
// the preventExtension call, in which case we should not attempt to lock down
|
|
2247
2302
|
// the shadow target.
|
|
2303
|
+
// TODO: It should not actually be possible to reach this `if` statement.
|
|
2304
|
+
// If a proxy rejects extensions, then calling preventExtensions will throw an error:
|
|
2305
|
+
// https://codepen.io/nolanlawson-the-selector/pen/QWMOjbY
|
|
2306
|
+
|
|
2307
|
+
/* istanbul ignore if */
|
|
2248
2308
|
|
|
2249
2309
|
|
|
2250
2310
|
if (_isExtensible(originalTarget)) {
|
|
@@ -2287,8 +2347,8 @@ var LWC = (function (exports) {
|
|
|
2287
2347
|
return ReactiveProxyHandler;
|
|
2288
2348
|
}(BaseProxyHandler);
|
|
2289
2349
|
|
|
2290
|
-
var getterMap
|
|
2291
|
-
var setterMap
|
|
2350
|
+
var getterMap = new WeakMap();
|
|
2351
|
+
var setterMap = new WeakMap();
|
|
2292
2352
|
|
|
2293
2353
|
var ReadOnlyHandler = /*#__PURE__*/function (_BaseProxyHandler2) {
|
|
2294
2354
|
_inherits(ReadOnlyHandler, _BaseProxyHandler2);
|
|
@@ -2309,7 +2369,7 @@ var LWC = (function (exports) {
|
|
|
2309
2369
|
}, {
|
|
2310
2370
|
key: "wrapGetter",
|
|
2311
2371
|
value: function wrapGetter(originalGet) {
|
|
2312
|
-
var wrappedGetter = getterMap
|
|
2372
|
+
var wrappedGetter = getterMap.get(originalGet);
|
|
2313
2373
|
|
|
2314
2374
|
if (!isUndefined(wrappedGetter)) {
|
|
2315
2375
|
return wrappedGetter;
|
|
@@ -2322,13 +2382,13 @@ var LWC = (function (exports) {
|
|
|
2322
2382
|
return handler.wrapValue(originalGet.call(unwrap$1(this)));
|
|
2323
2383
|
};
|
|
2324
2384
|
|
|
2325
|
-
getterMap
|
|
2385
|
+
getterMap.set(originalGet, get);
|
|
2326
2386
|
return get;
|
|
2327
2387
|
}
|
|
2328
2388
|
}, {
|
|
2329
2389
|
key: "wrapSetter",
|
|
2330
2390
|
value: function wrapSetter(originalSet) {
|
|
2331
|
-
var wrappedSetter = setterMap
|
|
2391
|
+
var wrappedSetter = setterMap.get(originalSet);
|
|
2332
2392
|
|
|
2333
2393
|
if (!isUndefined(wrappedSetter)) {
|
|
2334
2394
|
return wrappedSetter;
|
|
@@ -2337,38 +2397,47 @@ var LWC = (function (exports) {
|
|
|
2337
2397
|
var handler = this;
|
|
2338
2398
|
|
|
2339
2399
|
var set = function set(v) {
|
|
2400
|
+
/* istanbul ignore else */
|
|
2340
2401
|
if (process.env.NODE_ENV !== 'production') {
|
|
2341
2402
|
var originalTarget = handler.originalTarget;
|
|
2342
2403
|
throw new Error("Invalid mutation: Cannot invoke a setter on \"".concat(originalTarget, "\". \"").concat(originalTarget, "\" is read-only."));
|
|
2343
2404
|
}
|
|
2344
2405
|
};
|
|
2345
2406
|
|
|
2346
|
-
setterMap
|
|
2407
|
+
setterMap.set(originalSet, set);
|
|
2347
2408
|
return set;
|
|
2348
2409
|
}
|
|
2349
2410
|
}, {
|
|
2350
2411
|
key: "set",
|
|
2351
2412
|
value: function set(shadowTarget, key, value) {
|
|
2413
|
+
/* istanbul ignore else */
|
|
2352
2414
|
if (process.env.NODE_ENV !== 'production') {
|
|
2353
2415
|
var originalTarget = this.originalTarget;
|
|
2354
|
-
|
|
2416
|
+
var msg = isArray(originalTarget) ? "Invalid mutation: Cannot mutate array at index ".concat(key.toString(), ". Array is read-only.") : "Invalid mutation: Cannot set \"".concat(key.toString(), "\" on \"").concat(originalTarget, "\". \"").concat(originalTarget, "\" is read-only.");
|
|
2417
|
+
throw new Error(msg);
|
|
2355
2418
|
}
|
|
2419
|
+
/* istanbul ignore next */
|
|
2420
|
+
|
|
2356
2421
|
|
|
2357
2422
|
return false;
|
|
2358
2423
|
}
|
|
2359
2424
|
}, {
|
|
2360
2425
|
key: "deleteProperty",
|
|
2361
2426
|
value: function deleteProperty(shadowTarget, key) {
|
|
2427
|
+
/* istanbul ignore else */
|
|
2362
2428
|
if (process.env.NODE_ENV !== 'production') {
|
|
2363
2429
|
var originalTarget = this.originalTarget;
|
|
2364
2430
|
throw new Error("Invalid mutation: Cannot delete \"".concat(key.toString(), "\" on \"").concat(originalTarget, "\". \"").concat(originalTarget, "\" is read-only."));
|
|
2365
2431
|
}
|
|
2432
|
+
/* istanbul ignore next */
|
|
2433
|
+
|
|
2366
2434
|
|
|
2367
2435
|
return false;
|
|
2368
2436
|
}
|
|
2369
2437
|
}, {
|
|
2370
2438
|
key: "setPrototypeOf",
|
|
2371
2439
|
value: function setPrototypeOf(shadowTarget, prototype) {
|
|
2440
|
+
/* istanbul ignore else */
|
|
2372
2441
|
if (process.env.NODE_ENV !== 'production') {
|
|
2373
2442
|
var originalTarget = this.originalTarget;
|
|
2374
2443
|
throw new Error("Invalid prototype mutation: Cannot set prototype on \"".concat(originalTarget, "\". \"").concat(originalTarget, "\" prototype is read-only."));
|
|
@@ -2377,20 +2446,26 @@ var LWC = (function (exports) {
|
|
|
2377
2446
|
}, {
|
|
2378
2447
|
key: "preventExtensions",
|
|
2379
2448
|
value: function preventExtensions(shadowTarget) {
|
|
2449
|
+
/* istanbul ignore else */
|
|
2380
2450
|
if (process.env.NODE_ENV !== 'production') {
|
|
2381
2451
|
var originalTarget = this.originalTarget;
|
|
2382
2452
|
throw new Error("Invalid mutation: Cannot preventExtensions on ".concat(originalTarget, "\". \"").concat(originalTarget, " is read-only."));
|
|
2383
2453
|
}
|
|
2454
|
+
/* istanbul ignore next */
|
|
2455
|
+
|
|
2384
2456
|
|
|
2385
2457
|
return false;
|
|
2386
2458
|
}
|
|
2387
2459
|
}, {
|
|
2388
2460
|
key: "defineProperty",
|
|
2389
2461
|
value: function defineProperty(shadowTarget, key, descriptor) {
|
|
2462
|
+
/* istanbul ignore else */
|
|
2390
2463
|
if (process.env.NODE_ENV !== 'production') {
|
|
2391
2464
|
var originalTarget = this.originalTarget;
|
|
2392
2465
|
throw new Error("Invalid mutation: Cannot defineProperty \"".concat(key.toString(), "\" on \"").concat(originalTarget, "\". \"").concat(originalTarget, "\" is read-only."));
|
|
2393
2466
|
}
|
|
2467
|
+
/* istanbul ignore next */
|
|
2468
|
+
|
|
2394
2469
|
|
|
2395
2470
|
return false;
|
|
2396
2471
|
}
|
|
@@ -2450,6 +2525,8 @@ var LWC = (function (exports) {
|
|
|
2450
2525
|
}; // Inspired from paulmillr/es6-shim
|
|
2451
2526
|
// https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js#L176-L185
|
|
2452
2527
|
|
|
2528
|
+
/* istanbul ignore next */
|
|
2529
|
+
|
|
2453
2530
|
function getGlobal() {
|
|
2454
2531
|
// the only reliable means to get the global object is `Function('return this')()`
|
|
2455
2532
|
// However, this causes CSP violations in Chrome apps.
|
|
@@ -2474,6 +2551,7 @@ var LWC = (function (exports) {
|
|
|
2474
2551
|
}
|
|
2475
2552
|
|
|
2476
2553
|
function init() {
|
|
2554
|
+
/* istanbul ignore if */
|
|
2477
2555
|
if (process.env.NODE_ENV === 'production') {
|
|
2478
2556
|
// this method should never leak to prod
|
|
2479
2557
|
throw new ReferenceError();
|
|
@@ -2488,6 +2566,8 @@ var LWC = (function (exports) {
|
|
|
2488
2566
|
ArrayPush.call(devtoolsFormatters, formatter);
|
|
2489
2567
|
global.devtoolsFormatters = devtoolsFormatters;
|
|
2490
2568
|
}
|
|
2569
|
+
/* istanbul ignore else */
|
|
2570
|
+
|
|
2491
2571
|
|
|
2492
2572
|
if (process.env.NODE_ENV !== 'production') {
|
|
2493
2573
|
init();
|
|
@@ -2539,7 +2619,8 @@ var LWC = (function (exports) {
|
|
|
2539
2619
|
this.valueMutated = defaultValueMutated;
|
|
2540
2620
|
this.valueObserved = defaultValueObserved;
|
|
2541
2621
|
this.valueIsObservable = defaultValueIsObservable;
|
|
2542
|
-
this.
|
|
2622
|
+
this.readOnlyObjectGraph = new WeakMap();
|
|
2623
|
+
this.reactiveObjectGraph = new WeakMap();
|
|
2543
2624
|
|
|
2544
2625
|
if (!isUndefined(options)) {
|
|
2545
2626
|
var _valueDistortion = options.valueDistortion,
|
|
@@ -2562,10 +2643,13 @@ var LWC = (function (exports) {
|
|
|
2562
2643
|
var distorted = this.valueDistortion(unwrappedValue);
|
|
2563
2644
|
|
|
2564
2645
|
if (this.valueIsObservable(distorted)) {
|
|
2565
|
-
|
|
2566
|
-
|
|
2646
|
+
if (this.readOnlyObjectGraph.get(distorted) === value) {
|
|
2647
|
+
// when trying to extract the writable version of a readonly
|
|
2648
|
+
// we return the readonly.
|
|
2649
|
+
return value;
|
|
2650
|
+
}
|
|
2567
2651
|
|
|
2568
|
-
return
|
|
2652
|
+
return this.getReactiveHandler(unwrappedValue, distorted);
|
|
2569
2653
|
}
|
|
2570
2654
|
|
|
2571
2655
|
return distorted;
|
|
@@ -2577,7 +2661,7 @@ var LWC = (function (exports) {
|
|
|
2577
2661
|
var distorted = this.valueDistortion(value);
|
|
2578
2662
|
|
|
2579
2663
|
if (this.valueIsObservable(distorted)) {
|
|
2580
|
-
return this.
|
|
2664
|
+
return this.getReadOnlyHandler(value, distorted);
|
|
2581
2665
|
}
|
|
2582
2666
|
|
|
2583
2667
|
return distorted;
|
|
@@ -2588,48 +2672,40 @@ var LWC = (function (exports) {
|
|
|
2588
2672
|
return unwrap$1(p);
|
|
2589
2673
|
}
|
|
2590
2674
|
}, {
|
|
2591
|
-
key: "
|
|
2592
|
-
value: function
|
|
2593
|
-
var
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2675
|
+
key: "getReactiveHandler",
|
|
2676
|
+
value: function getReactiveHandler(value, distortedValue) {
|
|
2677
|
+
var proxy = this.reactiveObjectGraph.get(distortedValue);
|
|
2678
|
+
|
|
2679
|
+
if (isUndefined(proxy)) {
|
|
2680
|
+
// caching the proxy after the first time it is accessed
|
|
2681
|
+
var handler = new ReactiveProxyHandler(this, distortedValue);
|
|
2682
|
+
proxy = new Proxy(createShadowTarget(distortedValue), handler);
|
|
2683
|
+
registerProxy(proxy, value);
|
|
2684
|
+
this.reactiveObjectGraph.set(distortedValue, proxy);
|
|
2598
2685
|
}
|
|
2599
2686
|
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
var readOnlyHandler = new ReadOnlyHandler(membrane, distortedValue); // caching the readOnly proxy after the first time it is accessed
|
|
2615
|
-
|
|
2616
|
-
var proxy = new Proxy(createShadowTarget(distortedValue), readOnlyHandler);
|
|
2617
|
-
registerProxy(proxy, value);
|
|
2618
|
-
ObjectDefineProperty(this, 'readOnly', {
|
|
2619
|
-
value: proxy
|
|
2620
|
-
});
|
|
2621
|
-
return proxy;
|
|
2622
|
-
}
|
|
2687
|
+
return proxy;
|
|
2688
|
+
}
|
|
2689
|
+
}, {
|
|
2690
|
+
key: "getReadOnlyHandler",
|
|
2691
|
+
value: function getReadOnlyHandler(value, distortedValue) {
|
|
2692
|
+
var proxy = this.readOnlyObjectGraph.get(distortedValue);
|
|
2693
|
+
|
|
2694
|
+
if (isUndefined(proxy)) {
|
|
2695
|
+
// caching the proxy after the first time it is accessed
|
|
2696
|
+
var handler = new ReadOnlyHandler(this, distortedValue);
|
|
2697
|
+
proxy = new Proxy(createShadowTarget(distortedValue), handler);
|
|
2698
|
+
registerProxy(proxy, value);
|
|
2699
|
+
this.readOnlyObjectGraph.set(distortedValue, proxy);
|
|
2700
|
+
}
|
|
2623
2701
|
|
|
2624
|
-
|
|
2625
|
-
objectGraph.set(distortedValue, reactiveState);
|
|
2626
|
-
return reactiveState;
|
|
2702
|
+
return proxy;
|
|
2627
2703
|
}
|
|
2628
2704
|
}]);
|
|
2629
2705
|
|
|
2630
2706
|
return ReactiveMembrane;
|
|
2631
2707
|
}();
|
|
2632
|
-
/** version: 1.
|
|
2708
|
+
/** version: 1.1.5 */
|
|
2633
2709
|
|
|
2634
2710
|
/*
|
|
2635
2711
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -3015,7 +3091,9 @@ var LWC = (function (exports) {
|
|
|
3015
3091
|
}
|
|
3016
3092
|
|
|
3017
3093
|
return renderer[rendererMethod](elm);
|
|
3018
|
-
}
|
|
3094
|
+
},
|
|
3095
|
+
configurable: true,
|
|
3096
|
+
enumerable: true
|
|
3019
3097
|
};
|
|
3020
3098
|
};
|
|
3021
3099
|
|
|
@@ -3038,7 +3116,10 @@ var LWC = (function (exports) {
|
|
|
3038
3116
|
}
|
|
3039
3117
|
|
|
3040
3118
|
return renderer[queryMethod](elm, arg);
|
|
3041
|
-
}
|
|
3119
|
+
},
|
|
3120
|
+
configurable: true,
|
|
3121
|
+
enumerable: true,
|
|
3122
|
+
writable: true
|
|
3042
3123
|
};
|
|
3043
3124
|
};
|
|
3044
3125
|
|
|
@@ -3931,12 +4012,12 @@ var LWC = (function (exports) {
|
|
|
3931
4012
|
function flattenStylesheets(stylesheets) {
|
|
3932
4013
|
var list = [];
|
|
3933
4014
|
|
|
3934
|
-
var
|
|
3935
|
-
|
|
4015
|
+
var _iterator2 = _createForOfIteratorHelper(stylesheets),
|
|
4016
|
+
_step2;
|
|
3936
4017
|
|
|
3937
4018
|
try {
|
|
3938
|
-
for (
|
|
3939
|
-
var stylesheet =
|
|
4019
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
4020
|
+
var stylesheet = _step2.value;
|
|
3940
4021
|
|
|
3941
4022
|
if (!Array.isArray(stylesheet)) {
|
|
3942
4023
|
list.push(stylesheet);
|
|
@@ -3945,9 +4026,9 @@ var LWC = (function (exports) {
|
|
|
3945
4026
|
}
|
|
3946
4027
|
}
|
|
3947
4028
|
} catch (err) {
|
|
3948
|
-
|
|
4029
|
+
_iterator2.e(err);
|
|
3949
4030
|
} finally {
|
|
3950
|
-
|
|
4031
|
+
_iterator2.f();
|
|
3951
4032
|
}
|
|
3952
4033
|
|
|
3953
4034
|
return list;
|
|
@@ -4211,7 +4292,7 @@ var LWC = (function (exports) {
|
|
|
4211
4292
|
if (!isUndefined$1(ctorShadowSupportMode)) {
|
|
4212
4293
|
assert.invariant(ctorShadowSupportMode === "any"
|
|
4213
4294
|
/* Any */
|
|
4214
|
-
|| ctorShadowSupportMode === "
|
|
4295
|
+
|| ctorShadowSupportMode === "reset"
|
|
4215
4296
|
/* Default */
|
|
4216
4297
|
, "Invalid value for static property shadowSupportMode: '".concat(ctorShadowSupportMode, "'"));
|
|
4217
4298
|
}
|
|
@@ -4369,7 +4450,7 @@ var LWC = (function (exports) {
|
|
|
4369
4450
|
renderMode: 1
|
|
4370
4451
|
/* Shadow */
|
|
4371
4452
|
,
|
|
4372
|
-
shadowSupportMode: "
|
|
4453
|
+
shadowSupportMode: "reset"
|
|
4373
4454
|
/* Default */
|
|
4374
4455
|
,
|
|
4375
4456
|
wire: EmptyObject,
|
|
@@ -4506,6 +4587,17 @@ var LWC = (function (exports) {
|
|
|
4506
4587
|
modComputedStyle.create(vnode);
|
|
4507
4588
|
}
|
|
4508
4589
|
|
|
4590
|
+
function hydrateElmHook(vnode) {
|
|
4591
|
+
modEvents.create(vnode); // Attrs are already on the element.
|
|
4592
|
+
// modAttrs.create(vnode);
|
|
4593
|
+
|
|
4594
|
+
modProps.create(vnode); // Already set.
|
|
4595
|
+
// modStaticClassName.create(vnode);
|
|
4596
|
+
// modStaticStyle.create(vnode);
|
|
4597
|
+
// modComputedClassName.create(vnode);
|
|
4598
|
+
// modComputedStyle.create(vnode);
|
|
4599
|
+
}
|
|
4600
|
+
|
|
4509
4601
|
function fallbackElmHook(elm, vnode) {
|
|
4510
4602
|
var owner = vnode.owner;
|
|
4511
4603
|
setScopeTokenClassIfNecessary(elm, owner);
|
|
@@ -4655,6 +4747,174 @@ var LWC = (function (exports) {
|
|
|
4655
4747
|
}
|
|
4656
4748
|
}
|
|
4657
4749
|
|
|
4750
|
+
function isElementNode(node) {
|
|
4751
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
4752
|
+
return node.nodeType === Node.ELEMENT_NODE;
|
|
4753
|
+
}
|
|
4754
|
+
|
|
4755
|
+
function vnodesAndElementHaveCompatibleAttrs(vnode, elm) {
|
|
4756
|
+
var _vnode$data$attrs = vnode.data.attrs,
|
|
4757
|
+
attrs = _vnode$data$attrs === void 0 ? {} : _vnode$data$attrs,
|
|
4758
|
+
renderer = vnode.owner.renderer;
|
|
4759
|
+
var nodesAreCompatible = true; // Validate attributes, though we could always recovery from those by running the update mods.
|
|
4760
|
+
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
4761
|
+
|
|
4762
|
+
for (var _i14 = 0, _Object$entries = Object.entries(attrs); _i14 < _Object$entries.length; _i14++) {
|
|
4763
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i14], 2),
|
|
4764
|
+
attrName = _Object$entries$_i[0],
|
|
4765
|
+
attrValue = _Object$entries$_i[1];
|
|
4766
|
+
|
|
4767
|
+
var elmAttrValue = renderer.getAttribute(elm, attrName);
|
|
4768
|
+
|
|
4769
|
+
if (String(attrValue) !== elmAttrValue) {
|
|
4770
|
+
logError("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: attribute \"").concat(attrName, "\" has different values, expected \"").concat(attrValue, "\" but found \"").concat(elmAttrValue, "\""), vnode.owner);
|
|
4771
|
+
nodesAreCompatible = false;
|
|
4772
|
+
}
|
|
4773
|
+
}
|
|
4774
|
+
|
|
4775
|
+
return nodesAreCompatible;
|
|
4776
|
+
}
|
|
4777
|
+
|
|
4778
|
+
function vnodesAndElementHaveCompatibleClass(vnode, elm) {
|
|
4779
|
+
var _vnode$data = vnode.data,
|
|
4780
|
+
className = _vnode$data.className,
|
|
4781
|
+
classMap = _vnode$data.classMap,
|
|
4782
|
+
renderer = vnode.owner.renderer;
|
|
4783
|
+
var nodesAreCompatible = true;
|
|
4784
|
+
var vnodeClassName;
|
|
4785
|
+
|
|
4786
|
+
if (!isUndefined$1(className) && String(className) !== elm.className) {
|
|
4787
|
+
// className is used when class is bound to an expr.
|
|
4788
|
+
nodesAreCompatible = false;
|
|
4789
|
+
vnodeClassName = className;
|
|
4790
|
+
} else if (!isUndefined$1(classMap)) {
|
|
4791
|
+
// classMap is used when class is set to static value.
|
|
4792
|
+
var classList = renderer.getClassList(elm);
|
|
4793
|
+
var computedClassName = ''; // all classes from the vnode should be in the element.classList
|
|
4794
|
+
|
|
4795
|
+
for (var name in classMap) {
|
|
4796
|
+
computedClassName += ' ' + name;
|
|
4797
|
+
|
|
4798
|
+
if (!classList.contains(name)) {
|
|
4799
|
+
nodesAreCompatible = false;
|
|
4800
|
+
}
|
|
4801
|
+
}
|
|
4802
|
+
|
|
4803
|
+
vnodeClassName = computedClassName.trim();
|
|
4804
|
+
|
|
4805
|
+
if (classList.length > keys(classMap).length) {
|
|
4806
|
+
nodesAreCompatible = false;
|
|
4807
|
+
}
|
|
4808
|
+
}
|
|
4809
|
+
|
|
4810
|
+
if (!nodesAreCompatible) {
|
|
4811
|
+
logError("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: attribute \"class\" has different values, expected \"").concat(vnodeClassName, "\" but found \"").concat(elm.className, "\""), vnode.owner);
|
|
4812
|
+
}
|
|
4813
|
+
|
|
4814
|
+
return nodesAreCompatible;
|
|
4815
|
+
}
|
|
4816
|
+
|
|
4817
|
+
function vnodesAndElementHaveCompatibleStyle(vnode, elm) {
|
|
4818
|
+
var _vnode$data2 = vnode.data,
|
|
4819
|
+
style = _vnode$data2.style,
|
|
4820
|
+
styleDecls = _vnode$data2.styleDecls,
|
|
4821
|
+
renderer = vnode.owner.renderer;
|
|
4822
|
+
var elmStyle = renderer.getAttribute(elm, 'style') || '';
|
|
4823
|
+
var vnodeStyle;
|
|
4824
|
+
var nodesAreCompatible = true;
|
|
4825
|
+
|
|
4826
|
+
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
4827
|
+
nodesAreCompatible = false;
|
|
4828
|
+
vnodeStyle = style;
|
|
4829
|
+
} else if (!isUndefined$1(styleDecls)) {
|
|
4830
|
+
var parsedVnodeStyle = parseStyleText(elmStyle);
|
|
4831
|
+
var expectedStyle = []; // styleMap is used when style is set to static value.
|
|
4832
|
+
|
|
4833
|
+
for (var _i15 = 0, n = styleDecls.length; _i15 < n; _i15++) {
|
|
4834
|
+
var _styleDecls$_i2 = _slicedToArray(styleDecls[_i15], 3),
|
|
4835
|
+
prop = _styleDecls$_i2[0],
|
|
4836
|
+
value = _styleDecls$_i2[1],
|
|
4837
|
+
important = _styleDecls$_i2[2];
|
|
4838
|
+
|
|
4839
|
+
expectedStyle.push("".concat(prop, ": ").concat(value + (important ? ' important!' : '')));
|
|
4840
|
+
var parsedPropValue = parsedVnodeStyle[prop];
|
|
4841
|
+
|
|
4842
|
+
if (isUndefined$1(parsedPropValue)) {
|
|
4843
|
+
nodesAreCompatible = false;
|
|
4844
|
+
} else if (!parsedPropValue.startsWith(value)) {
|
|
4845
|
+
nodesAreCompatible = false;
|
|
4846
|
+
} else if (important && !parsedPropValue.endsWith('!important')) {
|
|
4847
|
+
nodesAreCompatible = false;
|
|
4848
|
+
}
|
|
4849
|
+
}
|
|
4850
|
+
|
|
4851
|
+
if (keys(parsedVnodeStyle).length > styleDecls.length) {
|
|
4852
|
+
nodesAreCompatible = false;
|
|
4853
|
+
}
|
|
4854
|
+
|
|
4855
|
+
vnodeStyle = ArrayJoin.call(expectedStyle, ';');
|
|
4856
|
+
}
|
|
4857
|
+
|
|
4858
|
+
if (!nodesAreCompatible) {
|
|
4859
|
+
// style is used when class is bound to an expr.
|
|
4860
|
+
logError("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: attribute \"style\" has different values, expected \"").concat(vnodeStyle, "\" but found \"").concat(elmStyle, "\"."), vnode.owner);
|
|
4861
|
+
}
|
|
4862
|
+
|
|
4863
|
+
return nodesAreCompatible;
|
|
4864
|
+
}
|
|
4865
|
+
|
|
4866
|
+
function throwHydrationError() {
|
|
4867
|
+
assert.fail('Server rendered elements do not match client side generated elements');
|
|
4868
|
+
}
|
|
4869
|
+
|
|
4870
|
+
function hydrateChildrenHook(elmChildren, children, vm) {
|
|
4871
|
+
var _a, _b;
|
|
4872
|
+
|
|
4873
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4874
|
+
var filteredVNodes = ArrayFilter.call(children, function (vnode) {
|
|
4875
|
+
return !!vnode;
|
|
4876
|
+
});
|
|
4877
|
+
|
|
4878
|
+
if (elmChildren.length !== filteredVNodes.length) {
|
|
4879
|
+
logError("Hydration mismatch: incorrect number of rendered nodes, expected ".concat(filteredVNodes.length, " but found ").concat(elmChildren.length, "."), vm);
|
|
4880
|
+
throwHydrationError();
|
|
4881
|
+
}
|
|
4882
|
+
}
|
|
4883
|
+
|
|
4884
|
+
var elmCurrentChildIdx = 0;
|
|
4885
|
+
|
|
4886
|
+
for (var j = 0, n = children.length; j < n; j++) {
|
|
4887
|
+
var ch = children[j];
|
|
4888
|
+
|
|
4889
|
+
if (ch != null) {
|
|
4890
|
+
var childNode = elmChildren[elmCurrentChildIdx];
|
|
4891
|
+
|
|
4892
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4893
|
+
// VComments and VTexts validation is handled in their hooks
|
|
4894
|
+
if (isElementNode(childNode)) {
|
|
4895
|
+
if (((_a = ch.sel) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== childNode.tagName.toLowerCase()) {
|
|
4896
|
+
logError("Hydration mismatch: expecting element with tag \"".concat((_b = ch.sel) === null || _b === void 0 ? void 0 : _b.toLowerCase(), "\" but found \"").concat(childNode.tagName.toLowerCase(), "\"."), vm);
|
|
4897
|
+
throwHydrationError();
|
|
4898
|
+
} // Note: props are not yet set
|
|
4899
|
+
|
|
4900
|
+
|
|
4901
|
+
var hasIncompatibleAttrs = vnodesAndElementHaveCompatibleAttrs(ch, childNode);
|
|
4902
|
+
var hasIncompatibleClass = vnodesAndElementHaveCompatibleClass(ch, childNode);
|
|
4903
|
+
var hasIncompatibleStyle = vnodesAndElementHaveCompatibleStyle(ch, childNode);
|
|
4904
|
+
var isVNodeAndElementCompatible = hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
4905
|
+
|
|
4906
|
+
if (!isVNodeAndElementCompatible) {
|
|
4907
|
+
throwHydrationError();
|
|
4908
|
+
}
|
|
4909
|
+
}
|
|
4910
|
+
}
|
|
4911
|
+
|
|
4912
|
+
ch.hook.hydrate(ch, childNode);
|
|
4913
|
+
elmCurrentChildIdx++;
|
|
4914
|
+
}
|
|
4915
|
+
}
|
|
4916
|
+
}
|
|
4917
|
+
|
|
4658
4918
|
function updateCustomElmHook(oldVnode, vnode) {
|
|
4659
4919
|
// Attrs need to be applied to element before props
|
|
4660
4920
|
// IE11 will wipe out value on radio inputs if value
|
|
@@ -4748,38 +5008,6 @@ var LWC = (function (exports) {
|
|
|
4748
5008
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4749
5009
|
*/
|
|
4750
5010
|
|
|
4751
|
-
/**
|
|
4752
|
-
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
|
4753
|
-
* libraries to sanitize HTML content. This hook process the content passed via the template to
|
|
4754
|
-
* lwc:inner-html directive.
|
|
4755
|
-
* It is meant to be overridden with setSanitizeHtmlContentHook
|
|
4756
|
-
*/
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
var sanitizeHtmlContentHook = function sanitizeHtmlContentHook() {
|
|
4760
|
-
// locker-service patches this function during runtime to sanitize HTML content.
|
|
4761
|
-
throw new Error('sanitizeHtmlContent hook must be implemented.');
|
|
4762
|
-
};
|
|
4763
|
-
/**
|
|
4764
|
-
* Sets the sanitizeHtmlContentHook.
|
|
4765
|
-
*
|
|
4766
|
-
* @param newHookImpl
|
|
4767
|
-
* @returns oldHookImplementation.
|
|
4768
|
-
*/
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
function setSanitizeHtmlContentHook(newHookImpl) {
|
|
4772
|
-
var currentHook = sanitizeHtmlContentHook;
|
|
4773
|
-
sanitizeHtmlContentHook = newHookImpl;
|
|
4774
|
-
return currentHook;
|
|
4775
|
-
}
|
|
4776
|
-
/*
|
|
4777
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
4778
|
-
* All rights reserved.
|
|
4779
|
-
* SPDX-License-Identifier: MIT
|
|
4780
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4781
|
-
*/
|
|
4782
|
-
|
|
4783
5011
|
|
|
4784
5012
|
var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
4785
5013
|
var SymbolIterator = Symbol.iterator;
|
|
@@ -4794,7 +5022,26 @@ var LWC = (function (exports) {
|
|
|
4794
5022
|
update: updateNodeHook,
|
|
4795
5023
|
insert: insertNodeHook,
|
|
4796
5024
|
move: insertNodeHook,
|
|
4797
|
-
remove: removeNodeHook
|
|
5025
|
+
remove: removeNodeHook,
|
|
5026
|
+
hydrate: function hydrate(vNode, node) {
|
|
5027
|
+
var _a;
|
|
5028
|
+
|
|
5029
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5030
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
5031
|
+
if (node.nodeType !== Node.TEXT_NODE) {
|
|
5032
|
+
logError('Hydration mismatch: incorrect node type received', vNode.owner);
|
|
5033
|
+
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
5034
|
+
}
|
|
5035
|
+
|
|
5036
|
+
if (node.nodeValue !== vNode.text) {
|
|
5037
|
+
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vNode.owner);
|
|
5038
|
+
}
|
|
5039
|
+
} // always set the text value to the one from the vnode.
|
|
5040
|
+
|
|
5041
|
+
|
|
5042
|
+
node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
|
|
5043
|
+
vNode.elm = node;
|
|
5044
|
+
}
|
|
4798
5045
|
};
|
|
4799
5046
|
var CommentHook = {
|
|
4800
5047
|
create: function create(vnode) {
|
|
@@ -4808,7 +5055,26 @@ var LWC = (function (exports) {
|
|
|
4808
5055
|
update: updateNodeHook,
|
|
4809
5056
|
insert: insertNodeHook,
|
|
4810
5057
|
move: insertNodeHook,
|
|
4811
|
-
remove: removeNodeHook
|
|
5058
|
+
remove: removeNodeHook,
|
|
5059
|
+
hydrate: function hydrate(vNode, node) {
|
|
5060
|
+
var _a;
|
|
5061
|
+
|
|
5062
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5063
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
5064
|
+
if (node.nodeType !== Node.COMMENT_NODE) {
|
|
5065
|
+
logError('Hydration mismatch: incorrect node type received', vNode.owner);
|
|
5066
|
+
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
5067
|
+
}
|
|
5068
|
+
|
|
5069
|
+
if (node.nodeValue !== vNode.text) {
|
|
5070
|
+
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vNode.owner);
|
|
5071
|
+
}
|
|
5072
|
+
} // always set the text value to the one from the vnode.
|
|
5073
|
+
|
|
5074
|
+
|
|
5075
|
+
node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
|
|
5076
|
+
vNode.elm = node;
|
|
5077
|
+
}
|
|
4812
5078
|
}; // insert is called after update, which is used somewhere else (via a module)
|
|
4813
5079
|
// to mark the vm as inserted, that means we cannot use update as the main channel
|
|
4814
5080
|
// to rehydrate when dirty, because sometimes the element is not inserted just yet,
|
|
@@ -4842,6 +5108,34 @@ var LWC = (function (exports) {
|
|
|
4842
5108
|
remove: function remove(vnode, parentNode) {
|
|
4843
5109
|
removeNodeHook(vnode, parentNode);
|
|
4844
5110
|
removeElmHook(vnode);
|
|
5111
|
+
},
|
|
5112
|
+
hydrate: function hydrate(vnode, node) {
|
|
5113
|
+
var elm = node;
|
|
5114
|
+
vnode.elm = elm;
|
|
5115
|
+
var context = vnode.data.context;
|
|
5116
|
+
var isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
|
|
5117
|
+
/* manual */
|
|
5118
|
+
);
|
|
5119
|
+
|
|
5120
|
+
if (isDomManual) {
|
|
5121
|
+
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
5122
|
+
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
5123
|
+
var props = vnode.data.props;
|
|
5124
|
+
|
|
5125
|
+
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
5126
|
+
if (elm.innerHTML === props.innerHTML) {
|
|
5127
|
+
delete props.innerHTML;
|
|
5128
|
+
} else {
|
|
5129
|
+
logWarn("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: innerHTML values do not match for element, will recover from the difference"), vnode.owner);
|
|
5130
|
+
}
|
|
5131
|
+
}
|
|
5132
|
+
}
|
|
5133
|
+
|
|
5134
|
+
hydrateElmHook(vnode);
|
|
5135
|
+
|
|
5136
|
+
if (!isDomManual) {
|
|
5137
|
+
hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vnode.owner);
|
|
5138
|
+
}
|
|
4845
5139
|
}
|
|
4846
5140
|
};
|
|
4847
5141
|
var CustomElementHook = {
|
|
@@ -4929,6 +5223,42 @@ var LWC = (function (exports) {
|
|
|
4929
5223
|
// will take care of disconnecting any child VM attached to its shadow as well.
|
|
4930
5224
|
removeVM(vm);
|
|
4931
5225
|
}
|
|
5226
|
+
},
|
|
5227
|
+
hydrate: function hydrate(vnode, elm) {
|
|
5228
|
+
// the element is created, but the vm is not
|
|
5229
|
+
var sel = vnode.sel,
|
|
5230
|
+
mode = vnode.mode,
|
|
5231
|
+
ctor = vnode.ctor,
|
|
5232
|
+
owner = vnode.owner;
|
|
5233
|
+
var def = getComponentInternalDef(ctor);
|
|
5234
|
+
createVM(elm, def, {
|
|
5235
|
+
mode: mode,
|
|
5236
|
+
owner: owner,
|
|
5237
|
+
tagName: sel,
|
|
5238
|
+
renderer: owner.renderer
|
|
5239
|
+
});
|
|
5240
|
+
vnode.elm = elm;
|
|
5241
|
+
var vm = getAssociatedVM(elm);
|
|
5242
|
+
allocateChildrenHook(vnode, vm);
|
|
5243
|
+
hydrateElmHook(vnode); // Insert hook section:
|
|
5244
|
+
|
|
5245
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5246
|
+
assert.isTrue(vm.state === 0
|
|
5247
|
+
/* created */
|
|
5248
|
+
, "".concat(vm, " cannot be recycled."));
|
|
5249
|
+
}
|
|
5250
|
+
|
|
5251
|
+
runConnectedCallback(vm);
|
|
5252
|
+
|
|
5253
|
+
if (vm.renderMode !== 0
|
|
5254
|
+
/* Light */
|
|
5255
|
+
) {
|
|
5256
|
+
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
5257
|
+
// Note: for Light DOM, this is handled while hydrating the VM
|
|
5258
|
+
hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vm);
|
|
5259
|
+
}
|
|
5260
|
+
|
|
5261
|
+
hydrateVM(vm);
|
|
4932
5262
|
}
|
|
4933
5263
|
};
|
|
4934
5264
|
|
|
@@ -5129,7 +5459,7 @@ var LWC = (function (exports) {
|
|
|
5129
5459
|
next = iterator.next();
|
|
5130
5460
|
last = next.done; // template factory logic based on the previous collected value
|
|
5131
5461
|
|
|
5132
|
-
var vnode = factory(value, j, j === 0, last);
|
|
5462
|
+
var vnode = factory(value, j, j === 0, last === true);
|
|
5133
5463
|
|
|
5134
5464
|
if (isArray$1(vnode)) {
|
|
5135
5465
|
ArrayPush$1.apply(list, vnode);
|
|
@@ -5231,7 +5561,7 @@ var LWC = (function (exports) {
|
|
|
5231
5561
|
|
|
5232
5562
|
|
|
5233
5563
|
function d(value) {
|
|
5234
|
-
return value == null ? '' : value;
|
|
5564
|
+
return value == null ? '' : String(value);
|
|
5235
5565
|
} // [b]ind function
|
|
5236
5566
|
|
|
5237
5567
|
|
|
@@ -5391,6 +5721,26 @@ var LWC = (function (exports) {
|
|
|
5391
5721
|
|
|
5392
5722
|
markAsDynamicChildren(vnodes);
|
|
5393
5723
|
return vnodes;
|
|
5724
|
+
}
|
|
5725
|
+
/**
|
|
5726
|
+
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
|
5727
|
+
* libraries to sanitize HTML content. This hook process the content passed via the template to
|
|
5728
|
+
* lwc:inner-html directive.
|
|
5729
|
+
* It is meant to be overridden with setSanitizeHtmlContentHook, it throws an error by default.
|
|
5730
|
+
*/
|
|
5731
|
+
|
|
5732
|
+
|
|
5733
|
+
var sanitizeHtmlContentHook = function sanitizeHtmlContentHook() {
|
|
5734
|
+
// locker-service patches this function during runtime to sanitize HTML content.
|
|
5735
|
+
throw new Error('sanitizeHtmlContent hook must be implemented.');
|
|
5736
|
+
};
|
|
5737
|
+
/**
|
|
5738
|
+
* Sets the sanitizeHtmlContentHook.
|
|
5739
|
+
*/
|
|
5740
|
+
|
|
5741
|
+
|
|
5742
|
+
function setSanitizeHtmlContentHook(newHookImpl) {
|
|
5743
|
+
sanitizeHtmlContentHook = newHookImpl;
|
|
5394
5744
|
} // [s]anitize [h]tml [c]ontent
|
|
5395
5745
|
|
|
5396
5746
|
|
|
@@ -5398,23 +5748,21 @@ var LWC = (function (exports) {
|
|
|
5398
5748
|
return sanitizeHtmlContentHook(content);
|
|
5399
5749
|
}
|
|
5400
5750
|
|
|
5401
|
-
var api =
|
|
5402
|
-
__proto__: null,
|
|
5403
|
-
h: h,
|
|
5404
|
-
ti: ti,
|
|
5751
|
+
var api = freeze({
|
|
5405
5752
|
s: s,
|
|
5753
|
+
h: h,
|
|
5406
5754
|
c: c,
|
|
5407
5755
|
i: i,
|
|
5408
5756
|
f: f,
|
|
5409
5757
|
t: t,
|
|
5410
|
-
co: co,
|
|
5411
5758
|
d: d,
|
|
5412
5759
|
b: b,
|
|
5413
5760
|
k: k,
|
|
5761
|
+
co: co,
|
|
5762
|
+
dc: dc,
|
|
5763
|
+
ti: ti,
|
|
5414
5764
|
gid: gid,
|
|
5415
5765
|
fid: fid,
|
|
5416
|
-
dc: dc,
|
|
5417
|
-
sc: sc,
|
|
5418
5766
|
shc: shc
|
|
5419
5767
|
});
|
|
5420
5768
|
/*
|
|
@@ -5429,12 +5777,12 @@ var LWC = (function (exports) {
|
|
|
5429
5777
|
}
|
|
5430
5778
|
|
|
5431
5779
|
function createInlineStyleVNode(content) {
|
|
5432
|
-
return h('style', {
|
|
5780
|
+
return api.h('style', {
|
|
5433
5781
|
key: 'style',
|
|
5434
5782
|
attrs: {
|
|
5435
5783
|
type: 'text/css'
|
|
5436
5784
|
}
|
|
5437
|
-
}, [t(content)]);
|
|
5785
|
+
}, [api.t(content)]);
|
|
5438
5786
|
}
|
|
5439
5787
|
|
|
5440
5788
|
function updateStylesheetToken(vm, template) {
|
|
@@ -5494,9 +5842,10 @@ var LWC = (function (exports) {
|
|
|
5494
5842
|
|
|
5495
5843
|
function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
5496
5844
|
var content = [];
|
|
5845
|
+
var root;
|
|
5497
5846
|
|
|
5498
|
-
for (var
|
|
5499
|
-
var stylesheet = stylesheets[
|
|
5847
|
+
for (var _i16 = 0; _i16 < stylesheets.length; _i16++) {
|
|
5848
|
+
var stylesheet = stylesheets[_i16];
|
|
5500
5849
|
|
|
5501
5850
|
if (isArray$1(stylesheet)) {
|
|
5502
5851
|
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
|
|
@@ -5506,23 +5855,46 @@ var LWC = (function (exports) {
|
|
|
5506
5855
|
// the component instance might be attempting to use an old version of
|
|
5507
5856
|
// the stylesheet, while internally, we have a replacement for it.
|
|
5508
5857
|
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
5509
|
-
}
|
|
5510
|
-
// native shadow DOM. Synthetic shadow DOM never uses `:host`.
|
|
5858
|
+
}
|
|
5511
5859
|
|
|
5860
|
+
var isScopedCss = stylesheet[KEY__SCOPED_CSS]; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
|
|
5861
|
+
|
|
5862
|
+
var scopeToken = isScopedCss || vm.shadowMode === 1
|
|
5863
|
+
/* Synthetic */
|
|
5864
|
+
&& vm.renderMode === 1
|
|
5865
|
+
/* Shadow */
|
|
5866
|
+
? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
|
|
5867
|
+
// native shadow DOM. Synthetic shadow DOM never uses `:host`.
|
|
5512
5868
|
|
|
5513
|
-
var isScopedCss = stylesheet[KEY__SCOPED_CSS];
|
|
5514
5869
|
var useActualHostSelector = vm.renderMode === 0
|
|
5515
5870
|
/* Light */
|
|
5516
5871
|
? !isScopedCss : vm.shadowMode === 0
|
|
5517
5872
|
/* Native */
|
|
5518
|
-
; //
|
|
5873
|
+
; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
|
|
5874
|
+
// we use an attribute selector on the host to simulate :dir().
|
|
5519
5875
|
|
|
5520
|
-
var
|
|
5521
|
-
|
|
5522
|
-
|
|
5876
|
+
var useNativeDirPseudoclass = void 0;
|
|
5877
|
+
|
|
5878
|
+
if (vm.renderMode === 1
|
|
5523
5879
|
/* Shadow */
|
|
5524
|
-
|
|
5525
|
-
|
|
5880
|
+
) {
|
|
5881
|
+
useNativeDirPseudoclass = vm.shadowMode === 0
|
|
5882
|
+
/* Native */
|
|
5883
|
+
;
|
|
5884
|
+
} else {
|
|
5885
|
+
// Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
|
|
5886
|
+
// At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
|
|
5887
|
+
if (isUndefined$1(root)) {
|
|
5888
|
+
// Only calculate the root once as necessary
|
|
5889
|
+
root = getNearestShadowComponent(vm);
|
|
5890
|
+
}
|
|
5891
|
+
|
|
5892
|
+
useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
|
|
5893
|
+
/* Native */
|
|
5894
|
+
;
|
|
5895
|
+
}
|
|
5896
|
+
|
|
5897
|
+
ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
|
|
5526
5898
|
}
|
|
5527
5899
|
}
|
|
5528
5900
|
|
|
@@ -5544,14 +5916,12 @@ var LWC = (function (exports) {
|
|
|
5544
5916
|
// https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
|
|
5545
5917
|
|
|
5546
5918
|
|
|
5547
|
-
function
|
|
5919
|
+
function getNearestShadowComponent(vm) {
|
|
5548
5920
|
var owner = vm;
|
|
5549
5921
|
|
|
5550
5922
|
while (!isNull(owner)) {
|
|
5551
5923
|
if (owner.renderMode === 1
|
|
5552
5924
|
/* Shadow */
|
|
5553
|
-
&& owner.shadowMode === 0
|
|
5554
|
-
/* Native */
|
|
5555
5925
|
) {
|
|
5556
5926
|
return owner;
|
|
5557
5927
|
}
|
|
@@ -5562,6 +5932,20 @@ var LWC = (function (exports) {
|
|
|
5562
5932
|
return owner;
|
|
5563
5933
|
}
|
|
5564
5934
|
|
|
5935
|
+
function getNearestNativeShadowComponent(vm) {
|
|
5936
|
+
var owner = getNearestShadowComponent(vm);
|
|
5937
|
+
|
|
5938
|
+
if (!isNull(owner) && owner.shadowMode === 1
|
|
5939
|
+
/* Synthetic */
|
|
5940
|
+
) {
|
|
5941
|
+
// Synthetic-within-native is impossible. So if the nearest shadow component is
|
|
5942
|
+
// synthetic, we know we won't find a native component if we go any further.
|
|
5943
|
+
return null;
|
|
5944
|
+
}
|
|
5945
|
+
|
|
5946
|
+
return owner;
|
|
5947
|
+
}
|
|
5948
|
+
|
|
5565
5949
|
function createStylesheet(vm, stylesheets) {
|
|
5566
5950
|
var renderer = vm.renderer,
|
|
5567
5951
|
renderMode = vm.renderMode,
|
|
@@ -5572,10 +5956,13 @@ var LWC = (function (exports) {
|
|
|
5572
5956
|
&& shadowMode === 1
|
|
5573
5957
|
/* Synthetic */
|
|
5574
5958
|
) {
|
|
5575
|
-
for (var
|
|
5576
|
-
renderer.insertGlobalStylesheet(stylesheets[
|
|
5959
|
+
for (var _i17 = 0; _i17 < stylesheets.length; _i17++) {
|
|
5960
|
+
renderer.insertGlobalStylesheet(stylesheets[_i17]);
|
|
5577
5961
|
}
|
|
5578
|
-
} else if (renderer.ssr) {
|
|
5962
|
+
} else if (renderer.ssr || renderer.isHydrating()) {
|
|
5963
|
+
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
5964
|
+
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
5965
|
+
// the first time the VM renders.
|
|
5579
5966
|
// native shadow or light DOM, SSR
|
|
5580
5967
|
var combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
|
|
5581
5968
|
return createInlineStyleVNode(combinedStylesheetContent);
|
|
@@ -5584,12 +5971,12 @@ var LWC = (function (exports) {
|
|
|
5584
5971
|
var root = getNearestNativeShadowComponent(vm);
|
|
5585
5972
|
var isGlobal = isNull(root);
|
|
5586
5973
|
|
|
5587
|
-
for (var
|
|
5974
|
+
for (var _i18 = 0; _i18 < stylesheets.length; _i18++) {
|
|
5588
5975
|
if (isGlobal) {
|
|
5589
|
-
renderer.insertGlobalStylesheet(stylesheets[
|
|
5976
|
+
renderer.insertGlobalStylesheet(stylesheets[_i18]);
|
|
5590
5977
|
} else {
|
|
5591
5978
|
// local level
|
|
5592
|
-
renderer.insertStylesheet(stylesheets[
|
|
5979
|
+
renderer.insertStylesheet(stylesheets[_i18], root.cmpRoot);
|
|
5593
5980
|
}
|
|
5594
5981
|
}
|
|
5595
5982
|
}
|
|
@@ -5866,8 +6253,8 @@ var LWC = (function (exports) {
|
|
|
5866
6253
|
var stylesheets = template.stylesheets;
|
|
5867
6254
|
|
|
5868
6255
|
if (!isUndefined$1(stylesheets)) {
|
|
5869
|
-
for (var
|
|
5870
|
-
if (isTrue(stylesheets[
|
|
6256
|
+
for (var _i19 = 0; _i19 < stylesheets.length; _i19++) {
|
|
6257
|
+
if (isTrue(stylesheets[_i19][KEY__SCOPED_CSS])) {
|
|
5871
6258
|
return true;
|
|
5872
6259
|
}
|
|
5873
6260
|
}
|
|
@@ -6097,8 +6484,8 @@ var LWC = (function (exports) {
|
|
|
6097
6484
|
assert.isTrue(isObject(service), "Invalid service declaration, ".concat(service, ": service must be an object"));
|
|
6098
6485
|
}
|
|
6099
6486
|
|
|
6100
|
-
for (var
|
|
6101
|
-
var hookName = hooks[
|
|
6487
|
+
for (var _i20 = 0; _i20 < hooks.length; ++_i20) {
|
|
6488
|
+
var hookName = hooks[_i20];
|
|
6102
6489
|
|
|
6103
6490
|
if (hookName in service) {
|
|
6104
6491
|
var l = Services[hookName];
|
|
@@ -6121,8 +6508,8 @@ var LWC = (function (exports) {
|
|
|
6121
6508
|
def = vm.def,
|
|
6122
6509
|
context = vm.context;
|
|
6123
6510
|
|
|
6124
|
-
for (var
|
|
6125
|
-
cbs[
|
|
6511
|
+
for (var _i21 = 0, _len6 = cbs.length; _i21 < _len6; ++_i21) {
|
|
6512
|
+
cbs[_i21].call(undefined, component, {}, def, context);
|
|
6126
6513
|
}
|
|
6127
6514
|
}
|
|
6128
6515
|
/*
|
|
@@ -6175,6 +6562,12 @@ var LWC = (function (exports) {
|
|
|
6175
6562
|
, vm);
|
|
6176
6563
|
}
|
|
6177
6564
|
|
|
6565
|
+
function hydrateRootElement(elm) {
|
|
6566
|
+
var vm = getAssociatedVM(elm);
|
|
6567
|
+
runConnectedCallback(vm);
|
|
6568
|
+
hydrateVM(vm);
|
|
6569
|
+
}
|
|
6570
|
+
|
|
6178
6571
|
function disconnectRootElement(elm) {
|
|
6179
6572
|
var vm = getAssociatedVM(elm);
|
|
6180
6573
|
resetComponentStateWhenRemoved(vm);
|
|
@@ -6182,6 +6575,10 @@ var LWC = (function (exports) {
|
|
|
6182
6575
|
|
|
6183
6576
|
function appendVM(vm) {
|
|
6184
6577
|
rehydrate(vm);
|
|
6578
|
+
}
|
|
6579
|
+
|
|
6580
|
+
function hydrateVM(vm) {
|
|
6581
|
+
hydrate(vm);
|
|
6185
6582
|
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
6186
6583
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
6187
6584
|
|
|
@@ -6405,6 +6802,22 @@ var LWC = (function (exports) {
|
|
|
6405
6802
|
}
|
|
6406
6803
|
}
|
|
6407
6804
|
|
|
6805
|
+
function hydrate(vm) {
|
|
6806
|
+
if (isTrue(vm.isDirty)) {
|
|
6807
|
+
// manually diffing/patching here.
|
|
6808
|
+
// This routine is:
|
|
6809
|
+
// patchShadowRoot(vm, children);
|
|
6810
|
+
// -> addVnodes.
|
|
6811
|
+
var children = renderComponent(vm);
|
|
6812
|
+
vm.children = children;
|
|
6813
|
+
var vmChildren = vm.renderMode === 0
|
|
6814
|
+
/* Light */
|
|
6815
|
+
? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;
|
|
6816
|
+
hydrateChildrenHook(vmChildren, children, vm);
|
|
6817
|
+
runRenderedCallback(vm);
|
|
6818
|
+
}
|
|
6819
|
+
}
|
|
6820
|
+
|
|
6408
6821
|
function patchShadowRoot(vm, newCh) {
|
|
6409
6822
|
var oldCh = vm.children; // caching the new children collection
|
|
6410
6823
|
|
|
@@ -6485,19 +6898,19 @@ var LWC = (function (exports) {
|
|
|
6485
6898
|
});
|
|
6486
6899
|
rehydrateQueue = []; // reset to a new queue
|
|
6487
6900
|
|
|
6488
|
-
for (var
|
|
6489
|
-
var vm = vms[
|
|
6901
|
+
for (var _i22 = 0, _len7 = vms.length; _i22 < _len7; _i22 += 1) {
|
|
6902
|
+
var vm = vms[_i22];
|
|
6490
6903
|
|
|
6491
6904
|
try {
|
|
6492
6905
|
rehydrate(vm);
|
|
6493
6906
|
} catch (error) {
|
|
6494
|
-
if (
|
|
6907
|
+
if (_i22 + 1 < _len7) {
|
|
6495
6908
|
// pieces of the queue are still pending to be rehydrated, those should have priority
|
|
6496
6909
|
if (rehydrateQueue.length === 0) {
|
|
6497
6910
|
addCallbackToNextTick(flushRehydrationQueue);
|
|
6498
6911
|
}
|
|
6499
6912
|
|
|
6500
|
-
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms,
|
|
6913
|
+
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i22 + 1));
|
|
6501
6914
|
} // we need to end the measure before throwing.
|
|
6502
6915
|
|
|
6503
6916
|
|
|
@@ -6601,8 +7014,8 @@ var LWC = (function (exports) {
|
|
|
6601
7014
|
var vCustomElementCollection = vm.velements; // Reporting disconnection for every child in inverse order since they are
|
|
6602
7015
|
// inserted in reserved order.
|
|
6603
7016
|
|
|
6604
|
-
for (var
|
|
6605
|
-
var elm = vCustomElementCollection[
|
|
7017
|
+
for (var _i23 = vCustomElementCollection.length - 1; _i23 >= 0; _i23 -= 1) {
|
|
7018
|
+
var elm = vCustomElementCollection[_i23].elm; // There are two cases where the element could be undefined:
|
|
6606
7019
|
// * when there is an error during the construction phase, and an error
|
|
6607
7020
|
// boundary picks it, there is a possibility that the VCustomElement
|
|
6608
7021
|
// is not properly initialized, and therefore is should be ignored.
|
|
@@ -6636,8 +7049,8 @@ var LWC = (function (exports) {
|
|
|
6636
7049
|
|
|
6637
7050
|
|
|
6638
7051
|
function recursivelyDisconnectChildren(vnodes) {
|
|
6639
|
-
for (var
|
|
6640
|
-
var vnode = vnodes[
|
|
7052
|
+
for (var _i24 = 0, _len8 = vnodes.length; _i24 < _len8; _i24 += 1) {
|
|
7053
|
+
var vnode = vnodes[_i24];
|
|
6641
7054
|
|
|
6642
7055
|
if (!isNull(vnode) && isArray$1(vnode.children) && !isUndefined$1(vnode.elm)) {
|
|
6643
7056
|
// vnode is a VElement with children
|
|
@@ -6661,8 +7074,8 @@ var LWC = (function (exports) {
|
|
|
6661
7074
|
renderer = vm.renderer;
|
|
6662
7075
|
var rootNode = getRenderRoot(vm);
|
|
6663
7076
|
|
|
6664
|
-
for (var
|
|
6665
|
-
var child = children[
|
|
7077
|
+
for (var _i25 = 0, _len9 = children.length; _i25 < _len9; _i25++) {
|
|
7078
|
+
var child = children[_i25];
|
|
6666
7079
|
|
|
6667
7080
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
6668
7081
|
renderer.remove(child.elm, rootNode);
|
|
@@ -6707,8 +7120,8 @@ var LWC = (function (exports) {
|
|
|
6707
7120
|
var oldSlots = vm.cmpSlots;
|
|
6708
7121
|
var cmpSlots = vm.cmpSlots = create(null);
|
|
6709
7122
|
|
|
6710
|
-
for (var
|
|
6711
|
-
var vnode = children[
|
|
7123
|
+
for (var _i26 = 0, _len10 = children.length; _i26 < _len10; _i26 += 1) {
|
|
7124
|
+
var vnode = children[_i26];
|
|
6712
7125
|
|
|
6713
7126
|
if (isNull(vnode)) {
|
|
6714
7127
|
continue;
|
|
@@ -6738,8 +7151,8 @@ var LWC = (function (exports) {
|
|
|
6738
7151
|
return;
|
|
6739
7152
|
}
|
|
6740
7153
|
|
|
6741
|
-
for (var
|
|
6742
|
-
var key = oldKeys[
|
|
7154
|
+
for (var _i27 = 0, _len11 = oldKeys.length; _i27 < _len11; _i27 += 1) {
|
|
7155
|
+
var key = oldKeys[_i27];
|
|
6743
7156
|
|
|
6744
7157
|
if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
|
|
6745
7158
|
markComponentAsDirty(vm);
|
|
@@ -7102,8 +7515,8 @@ var LWC = (function (exports) {
|
|
|
7102
7515
|
function connectWireAdapters(vm) {
|
|
7103
7516
|
var wiredConnecting = vm.context.wiredConnecting;
|
|
7104
7517
|
|
|
7105
|
-
for (var
|
|
7106
|
-
wiredConnecting[
|
|
7518
|
+
for (var _i28 = 0, _len12 = wiredConnecting.length; _i28 < _len12; _i28 += 1) {
|
|
7519
|
+
wiredConnecting[_i28]();
|
|
7107
7520
|
}
|
|
7108
7521
|
}
|
|
7109
7522
|
|
|
@@ -7111,8 +7524,8 @@ var LWC = (function (exports) {
|
|
|
7111
7524
|
var wiredDisconnecting = vm.context.wiredDisconnecting;
|
|
7112
7525
|
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
7113
7526
|
// job
|
|
7114
|
-
for (var
|
|
7115
|
-
wiredDisconnecting[
|
|
7527
|
+
for (var _i29 = 0, _len13 = wiredDisconnecting.length; _i29 < _len13; _i29 += 1) {
|
|
7528
|
+
wiredDisconnecting[_i29]();
|
|
7116
7529
|
}
|
|
7117
7530
|
}, noop);
|
|
7118
7531
|
}
|
|
@@ -7197,28 +7610,12 @@ var LWC = (function (exports) {
|
|
|
7197
7610
|
|
|
7198
7611
|
var hooksAreSet = false;
|
|
7199
7612
|
|
|
7200
|
-
function overrideHooks(hooks) {
|
|
7201
|
-
var oldHooks = {};
|
|
7202
|
-
|
|
7203
|
-
if (!isUndefined$1(hooks.sanitizeHtmlContent)) {
|
|
7204
|
-
oldHooks.sanitizeHtmlContent = setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
7205
|
-
}
|
|
7206
|
-
|
|
7207
|
-
return oldHooks;
|
|
7208
|
-
}
|
|
7209
|
-
|
|
7210
7613
|
function setHooks(hooks) {
|
|
7211
7614
|
assert.isFalse(hooksAreSet, 'Hooks are already overridden, only one definition is allowed.');
|
|
7212
|
-
overrideHooks(hooks);
|
|
7213
7615
|
hooksAreSet = true;
|
|
7616
|
+
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
7214
7617
|
}
|
|
7215
|
-
|
|
7216
|
-
function setHooksForTest(hooks) {
|
|
7217
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
7218
|
-
return overrideHooks(hooks);
|
|
7219
|
-
}
|
|
7220
|
-
}
|
|
7221
|
-
/* version: 2.5.5-canary1 */
|
|
7618
|
+
/* version: 2.5.9 */
|
|
7222
7619
|
|
|
7223
7620
|
/*
|
|
7224
7621
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7233,8 +7630,8 @@ var LWC = (function (exports) {
|
|
|
7233
7630
|
if (process.env.NODE_ENV === 'development') {
|
|
7234
7631
|
// @ts-ignore
|
|
7235
7632
|
window.__lwcResetGlobalStylesheets = function () {
|
|
7236
|
-
for (var
|
|
7237
|
-
var key = _Object$keys[
|
|
7633
|
+
for (var _i30 = 0, _Object$keys = Object.keys(globalStylesheets); _i30 < _Object$keys.length; _i30++) {
|
|
7634
|
+
var key = _Object$keys[_i30];
|
|
7238
7635
|
delete globalStylesheets[key];
|
|
7239
7636
|
}
|
|
7240
7637
|
};
|
|
@@ -7373,8 +7770,17 @@ var LWC = (function (exports) {
|
|
|
7373
7770
|
HTMLElementConstructor.prototype = HTMLElement.prototype;
|
|
7374
7771
|
}
|
|
7375
7772
|
|
|
7773
|
+
var _isHydrating = false;
|
|
7774
|
+
|
|
7775
|
+
function setIsHydrating(v) {
|
|
7776
|
+
_isHydrating = v;
|
|
7777
|
+
}
|
|
7778
|
+
|
|
7376
7779
|
var renderer = {
|
|
7377
7780
|
ssr: false,
|
|
7781
|
+
isHydrating: function isHydrating() {
|
|
7782
|
+
return _isHydrating;
|
|
7783
|
+
},
|
|
7378
7784
|
isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
|
|
7379
7785
|
isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
|
|
7380
7786
|
createElement: function createElement(tagName, namespace) {
|
|
@@ -7396,6 +7802,10 @@ var LWC = (function (exports) {
|
|
|
7396
7802
|
return node.nextSibling;
|
|
7397
7803
|
},
|
|
7398
7804
|
attachShadow: function attachShadow(element, options) {
|
|
7805
|
+
if (_isHydrating) {
|
|
7806
|
+
return element.shadowRoot;
|
|
7807
|
+
}
|
|
7808
|
+
|
|
7399
7809
|
return element.attachShadow(options);
|
|
7400
7810
|
},
|
|
7401
7811
|
setText: function setText(node, content) {
|
|
@@ -7506,75 +7916,6 @@ var LWC = (function (exports) {
|
|
|
7506
7916
|
getCustomElement: getCustomElement,
|
|
7507
7917
|
HTMLElement: HTMLElementConstructor
|
|
7508
7918
|
};
|
|
7509
|
-
/*
|
|
7510
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
7511
|
-
* All rights reserved.
|
|
7512
|
-
* SPDX-License-Identifier: MIT
|
|
7513
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7514
|
-
*/
|
|
7515
|
-
|
|
7516
|
-
/**
|
|
7517
|
-
* This function builds a Web Component class from a LWC constructor so it can be
|
|
7518
|
-
* registered as a new element via customElements.define() at any given time.
|
|
7519
|
-
*
|
|
7520
|
-
* @deprecated since version 1.3.11
|
|
7521
|
-
*
|
|
7522
|
-
* @example
|
|
7523
|
-
* ```
|
|
7524
|
-
* import { buildCustomElementConstructor } from 'lwc';
|
|
7525
|
-
* import Foo from 'ns/foo';
|
|
7526
|
-
* const WC = buildCustomElementConstructor(Foo);
|
|
7527
|
-
* customElements.define('x-foo', WC);
|
|
7528
|
-
* const elm = document.createElement('x-foo');
|
|
7529
|
-
* ```
|
|
7530
|
-
*/
|
|
7531
|
-
|
|
7532
|
-
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
7533
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
7534
|
-
/* eslint-disable-next-line no-console */
|
|
7535
|
-
console.warn('Deprecated function called: "buildCustomElementConstructor" function is deprecated and it will be removed.' + "Use \"".concat(Ctor.name, ".CustomElementConstructor\" static property of the component constructor to access the corresponding custom element constructor instead."));
|
|
7536
|
-
}
|
|
7537
|
-
|
|
7538
|
-
return Ctor.CustomElementConstructor;
|
|
7539
|
-
}
|
|
7540
|
-
|
|
7541
|
-
function buildCustomElementConstructor(Ctor) {
|
|
7542
|
-
var def = getComponentInternalDef(Ctor);
|
|
7543
|
-
return /*#__PURE__*/function (_def$bridge) {
|
|
7544
|
-
_inherits(_class, _def$bridge);
|
|
7545
|
-
|
|
7546
|
-
var _super8 = _createSuper(_class);
|
|
7547
|
-
|
|
7548
|
-
function _class() {
|
|
7549
|
-
var _this6;
|
|
7550
|
-
|
|
7551
|
-
_classCallCheck(this, _class);
|
|
7552
|
-
|
|
7553
|
-
_this6 = _super8.call(this);
|
|
7554
|
-
createVM(_assertThisInitialized(_this6), def, {
|
|
7555
|
-
mode: 'open',
|
|
7556
|
-
owner: null,
|
|
7557
|
-
tagName: _this6.tagName,
|
|
7558
|
-
renderer: renderer
|
|
7559
|
-
});
|
|
7560
|
-
return _this6;
|
|
7561
|
-
}
|
|
7562
|
-
|
|
7563
|
-
_createClass(_class, [{
|
|
7564
|
-
key: "connectedCallback",
|
|
7565
|
-
value: function connectedCallback() {
|
|
7566
|
-
connectRootElement(this);
|
|
7567
|
-
}
|
|
7568
|
-
}, {
|
|
7569
|
-
key: "disconnectedCallback",
|
|
7570
|
-
value: function disconnectedCallback() {
|
|
7571
|
-
disconnectRootElement(this);
|
|
7572
|
-
}
|
|
7573
|
-
}]);
|
|
7574
|
-
|
|
7575
|
-
return _class;
|
|
7576
|
-
}(def.bridge);
|
|
7577
|
-
}
|
|
7578
7919
|
/*
|
|
7579
7920
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
7580
7921
|
* All rights reserved.
|
|
@@ -7584,7 +7925,6 @@ var LWC = (function (exports) {
|
|
|
7584
7925
|
// TODO [#2472]: Remove this workaround when appropriate.
|
|
7585
7926
|
// eslint-disable-next-line lwc-internal/no-global-node
|
|
7586
7927
|
|
|
7587
|
-
|
|
7588
7928
|
var _Node$1 = Node;
|
|
7589
7929
|
var ConnectingSlot = new WeakMap();
|
|
7590
7930
|
var DisconnectingSlot = new WeakMap();
|
|
@@ -7694,6 +8034,142 @@ var LWC = (function (exports) {
|
|
|
7694
8034
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7695
8035
|
*/
|
|
7696
8036
|
|
|
8037
|
+
|
|
8038
|
+
function hydrateComponent(element, Ctor) {
|
|
8039
|
+
var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
8040
|
+
|
|
8041
|
+
if (!isFunction$1(Ctor)) {
|
|
8042
|
+
throw new TypeError("\"hydrateComponent\" expects a valid component constructor as the second parameter but instead received ".concat(Ctor, "."));
|
|
8043
|
+
}
|
|
8044
|
+
|
|
8045
|
+
if (!isObject(props) || isNull(props)) {
|
|
8046
|
+
throw new TypeError("\"hydrateComponent\" expects an object as the third parameter but instead received ".concat(props, "."));
|
|
8047
|
+
}
|
|
8048
|
+
|
|
8049
|
+
var def = getComponentInternalDef(Ctor);
|
|
8050
|
+
|
|
8051
|
+
try {
|
|
8052
|
+
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
8053
|
+
// and uses the same algo to create the stylesheets as in SSR.
|
|
8054
|
+
setIsHydrating(true);
|
|
8055
|
+
createVM(element, def, {
|
|
8056
|
+
mode: 'open',
|
|
8057
|
+
owner: null,
|
|
8058
|
+
renderer: renderer,
|
|
8059
|
+
tagName: element.tagName.toLowerCase()
|
|
8060
|
+
});
|
|
8061
|
+
|
|
8062
|
+
for (var _i31 = 0, _Object$entries2 = Object.entries(props); _i31 < _Object$entries2.length; _i31++) {
|
|
8063
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i31], 2),
|
|
8064
|
+
key = _Object$entries2$_i[0],
|
|
8065
|
+
value = _Object$entries2$_i[1];
|
|
8066
|
+
|
|
8067
|
+
element[key] = value;
|
|
8068
|
+
}
|
|
8069
|
+
|
|
8070
|
+
hydrateRootElement(element); // set it back since now we finished hydration.
|
|
8071
|
+
|
|
8072
|
+
setIsHydrating(false);
|
|
8073
|
+
} catch (e) {
|
|
8074
|
+
// Fallback: In case there's an error while hydrating, let's log the error, and replace the element with
|
|
8075
|
+
// the client generated DOM.
|
|
8076
|
+
|
|
8077
|
+
/* eslint-disable-next-line no-console */
|
|
8078
|
+
console.error('Recovering from error while hydrating: ', e);
|
|
8079
|
+
setIsHydrating(false);
|
|
8080
|
+
var newElem = createElement(element.tagName, {
|
|
8081
|
+
is: Ctor,
|
|
8082
|
+
mode: 'open'
|
|
8083
|
+
});
|
|
8084
|
+
|
|
8085
|
+
for (var _i32 = 0, _Object$entries3 = Object.entries(props); _i32 < _Object$entries3.length; _i32++) {
|
|
8086
|
+
var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i32], 2),
|
|
8087
|
+
_key3 = _Object$entries3$_i[0],
|
|
8088
|
+
_value2 = _Object$entries3$_i[1];
|
|
8089
|
+
|
|
8090
|
+
newElem[_key3] = _value2;
|
|
8091
|
+
}
|
|
8092
|
+
|
|
8093
|
+
element.parentNode.replaceChild(newElem, element);
|
|
8094
|
+
}
|
|
8095
|
+
}
|
|
8096
|
+
/*
|
|
8097
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
8098
|
+
* All rights reserved.
|
|
8099
|
+
* SPDX-License-Identifier: MIT
|
|
8100
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8101
|
+
*/
|
|
8102
|
+
|
|
8103
|
+
/**
|
|
8104
|
+
* This function builds a Web Component class from a LWC constructor so it can be
|
|
8105
|
+
* registered as a new element via customElements.define() at any given time.
|
|
8106
|
+
*
|
|
8107
|
+
* @deprecated since version 1.3.11
|
|
8108
|
+
*
|
|
8109
|
+
* @example
|
|
8110
|
+
* ```
|
|
8111
|
+
* import { buildCustomElementConstructor } from 'lwc';
|
|
8112
|
+
* import Foo from 'ns/foo';
|
|
8113
|
+
* const WC = buildCustomElementConstructor(Foo);
|
|
8114
|
+
* customElements.define('x-foo', WC);
|
|
8115
|
+
* const elm = document.createElement('x-foo');
|
|
8116
|
+
* ```
|
|
8117
|
+
*/
|
|
8118
|
+
|
|
8119
|
+
|
|
8120
|
+
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
8121
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
8122
|
+
/* eslint-disable-next-line no-console */
|
|
8123
|
+
console.warn('Deprecated function called: "buildCustomElementConstructor" function is deprecated and it will be removed.' + "Use \"".concat(Ctor.name, ".CustomElementConstructor\" static property of the component constructor to access the corresponding custom element constructor instead."));
|
|
8124
|
+
}
|
|
8125
|
+
|
|
8126
|
+
return Ctor.CustomElementConstructor;
|
|
8127
|
+
}
|
|
8128
|
+
|
|
8129
|
+
function buildCustomElementConstructor(Ctor) {
|
|
8130
|
+
var def = getComponentInternalDef(Ctor);
|
|
8131
|
+
return /*#__PURE__*/function (_def$bridge) {
|
|
8132
|
+
_inherits(_class, _def$bridge);
|
|
8133
|
+
|
|
8134
|
+
var _super8 = _createSuper(_class);
|
|
8135
|
+
|
|
8136
|
+
function _class() {
|
|
8137
|
+
var _this6;
|
|
8138
|
+
|
|
8139
|
+
_classCallCheck(this, _class);
|
|
8140
|
+
|
|
8141
|
+
_this6 = _super8.call(this);
|
|
8142
|
+
createVM(_assertThisInitialized(_this6), def, {
|
|
8143
|
+
mode: 'open',
|
|
8144
|
+
owner: null,
|
|
8145
|
+
tagName: _this6.tagName,
|
|
8146
|
+
renderer: renderer
|
|
8147
|
+
});
|
|
8148
|
+
return _this6;
|
|
8149
|
+
}
|
|
8150
|
+
|
|
8151
|
+
_createClass(_class, [{
|
|
8152
|
+
key: "connectedCallback",
|
|
8153
|
+
value: function connectedCallback() {
|
|
8154
|
+
connectRootElement(this);
|
|
8155
|
+
}
|
|
8156
|
+
}, {
|
|
8157
|
+
key: "disconnectedCallback",
|
|
8158
|
+
value: function disconnectedCallback() {
|
|
8159
|
+
disconnectRootElement(this);
|
|
8160
|
+
}
|
|
8161
|
+
}]);
|
|
8162
|
+
|
|
8163
|
+
return _class;
|
|
8164
|
+
}(def.bridge);
|
|
8165
|
+
}
|
|
8166
|
+
/*
|
|
8167
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
8168
|
+
* All rights reserved.
|
|
8169
|
+
* SPDX-License-Identifier: MIT
|
|
8170
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8171
|
+
*/
|
|
8172
|
+
|
|
7697
8173
|
/**
|
|
7698
8174
|
* EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
|
|
7699
8175
|
* This API is subject to change or being removed.
|
|
@@ -7792,7 +8268,7 @@ var LWC = (function (exports) {
|
|
|
7792
8268
|
});
|
|
7793
8269
|
freeze(LightningElement);
|
|
7794
8270
|
seal(LightningElement.prototype);
|
|
7795
|
-
/* version: 2.5.
|
|
8271
|
+
/* version: 2.5.9 */
|
|
7796
8272
|
|
|
7797
8273
|
exports.LightningElement = LightningElement;
|
|
7798
8274
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
@@ -7802,6 +8278,7 @@ var LWC = (function (exports) {
|
|
|
7802
8278
|
exports.createElement = createElement;
|
|
7803
8279
|
exports.getComponentConstructor = getComponentConstructor;
|
|
7804
8280
|
exports.getComponentDef = getComponentDef;
|
|
8281
|
+
exports.hydrateComponent = hydrateComponent;
|
|
7805
8282
|
exports.isComponentConstructor = isComponentConstructor;
|
|
7806
8283
|
exports.isNodeFromTemplate = isNodeFromTemplate;
|
|
7807
8284
|
exports.readonly = readonly;
|
|
@@ -7813,7 +8290,6 @@ var LWC = (function (exports) {
|
|
|
7813
8290
|
exports.setFeatureFlag = setFeatureFlag;
|
|
7814
8291
|
exports.setFeatureFlagForTest = setFeatureFlagForTest;
|
|
7815
8292
|
exports.setHooks = setHooks;
|
|
7816
|
-
exports.setHooksForTest = setHooksForTest;
|
|
7817
8293
|
exports.swapComponent = swapComponent;
|
|
7818
8294
|
exports.swapStyle = swapStyle;
|
|
7819
8295
|
exports.swapTemplate = swapTemplate;
|
|
@@ -7825,4 +8301,4 @@ var LWC = (function (exports) {
|
|
|
7825
8301
|
|
|
7826
8302
|
return exports;
|
|
7827
8303
|
|
|
7828
|
-
}({})
|
|
8304
|
+
})({});
|