lwc 2.5.6 → 2.5.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine-dom/esm/es2017/engine-dom.js +605 -181
- package/dist/engine-dom/iife/es2017/engine-dom.js +605 -181
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +406 -169
- package/dist/engine-dom/iife/es5/engine-dom.js +684 -242
- package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +466 -221
- package/dist/engine-dom/umd/es2017/engine-dom.js +605 -181
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +406 -169
- package/dist/engine-dom/umd/es5/engine-dom.js +684 -242
- package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +466 -221
- package/dist/engine-server/commonjs/es2017/engine-server.js +484 -133
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
- package/dist/engine-server/esm/es2017/engine-server.js +485 -133
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es5/wire-service.js +2 -2
- package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es5/wire-service.js +2 -2
- package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
- package/package.json +8 -8
|
@@ -10,8 +10,6 @@
|
|
|
10
10
|
|
|
11
11
|
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
|
|
12
12
|
|
|
13
|
-
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; } } }; }
|
|
14
|
-
|
|
15
13
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
16
14
|
|
|
17
15
|
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."); }
|
|
@@ -40,23 +38,25 @@
|
|
|
40
38
|
|
|
41
39
|
function _getPrototypeOf2(o) { _getPrototypeOf2 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf2(o); }
|
|
42
40
|
|
|
43
|
-
function
|
|
41
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
44
42
|
|
|
45
|
-
function
|
|
43
|
+
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); } }
|
|
46
44
|
|
|
47
|
-
function
|
|
45
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
48
46
|
|
|
49
|
-
function
|
|
47
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
48
|
+
|
|
49
|
+
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."); }
|
|
50
50
|
|
|
51
51
|
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; }
|
|
52
52
|
|
|
53
53
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
54
54
|
|
|
55
|
-
function
|
|
55
|
+
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; } } }; }
|
|
56
56
|
|
|
57
|
-
function
|
|
57
|
+
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); }
|
|
58
58
|
|
|
59
|
-
function
|
|
59
|
+
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; }
|
|
60
60
|
|
|
61
61
|
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); }
|
|
62
62
|
|
|
@@ -123,9 +123,10 @@
|
|
|
123
123
|
setPrototypeOf = Object.setPrototypeOf;
|
|
124
124
|
var isArray$1 = Array.isArray;
|
|
125
125
|
var _Array$prototype = Array.prototype,
|
|
126
|
+
ArrayFilter = _Array$prototype.filter,
|
|
126
127
|
ArrayIndexOf = _Array$prototype.indexOf,
|
|
127
128
|
ArrayJoin = _Array$prototype.join,
|
|
128
|
-
ArrayMap
|
|
129
|
+
ArrayMap = _Array$prototype.map,
|
|
129
130
|
ArrayPush$1 = _Array$prototype.push,
|
|
130
131
|
ArraySlice = _Array$prototype.slice,
|
|
131
132
|
ArraySplice = _Array$prototype.splice,
|
|
@@ -186,7 +187,7 @@
|
|
|
186
187
|
// Array.prototype.toString directly will cause an error Iterate through
|
|
187
188
|
// all the items and handle individually.
|
|
188
189
|
if (isArray$1(obj)) {
|
|
189
|
-
return ArrayJoin.call(ArrayMap
|
|
190
|
+
return ArrayJoin.call(ArrayMap.call(obj, toString$1), ',');
|
|
190
191
|
}
|
|
191
192
|
|
|
192
193
|
return obj.toString();
|
|
@@ -350,7 +351,7 @@
|
|
|
350
351
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
351
352
|
return attributeName;
|
|
352
353
|
}
|
|
353
|
-
/** version: 2.5.
|
|
354
|
+
/** version: 2.5.10 */
|
|
354
355
|
|
|
355
356
|
/*
|
|
356
357
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -530,7 +531,7 @@
|
|
|
530
531
|
setFeatureFlag(name, value);
|
|
531
532
|
}
|
|
532
533
|
}
|
|
533
|
-
/** version: 2.5.
|
|
534
|
+
/** version: 2.5.10 */
|
|
534
535
|
|
|
535
536
|
/* proxy-compat-disable */
|
|
536
537
|
|
|
@@ -582,6 +583,42 @@
|
|
|
582
583
|
}
|
|
583
584
|
|
|
584
585
|
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
586
|
+
} // Borrowed from Vue template compiler.
|
|
587
|
+
// https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
var DECLARATION_DELIMITER = /;(?![^(]*\))/g;
|
|
591
|
+
var PROPERTY_DELIMITER = /:(.+)/;
|
|
592
|
+
|
|
593
|
+
function parseStyleText(cssText) {
|
|
594
|
+
var styleMap = {};
|
|
595
|
+
var declarations = cssText.split(DECLARATION_DELIMITER);
|
|
596
|
+
|
|
597
|
+
var _iterator = _createForOfIteratorHelper(declarations),
|
|
598
|
+
_step;
|
|
599
|
+
|
|
600
|
+
try {
|
|
601
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
602
|
+
var declaration = _step.value;
|
|
603
|
+
|
|
604
|
+
if (declaration) {
|
|
605
|
+
var _declaration$split = declaration.split(PROPERTY_DELIMITER),
|
|
606
|
+
_declaration$split2 = _slicedToArray(_declaration$split, 2),
|
|
607
|
+
prop = _declaration$split2[0],
|
|
608
|
+
value = _declaration$split2[1];
|
|
609
|
+
|
|
610
|
+
if (prop !== undefined && value !== undefined) {
|
|
611
|
+
styleMap[prop.trim()] = value.trim();
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
} catch (err) {
|
|
616
|
+
_iterator.e(err);
|
|
617
|
+
} finally {
|
|
618
|
+
_iterator.f();
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
return styleMap;
|
|
585
622
|
}
|
|
586
623
|
/*
|
|
587
624
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
@@ -770,8 +807,8 @@
|
|
|
770
807
|
*/
|
|
771
808
|
|
|
772
809
|
|
|
773
|
-
function
|
|
774
|
-
var msg = "[LWC
|
|
810
|
+
function log(method, message, vm) {
|
|
811
|
+
var msg = "[LWC ".concat(method, "]: ").concat(message);
|
|
775
812
|
|
|
776
813
|
if (!isUndefined$1(vm)) {
|
|
777
814
|
msg = "".concat(msg, "\n").concat(getComponentStack(vm));
|
|
@@ -779,7 +816,7 @@
|
|
|
779
816
|
|
|
780
817
|
if (process.env.NODE_ENV === 'test') {
|
|
781
818
|
/* eslint-disable-next-line no-console */
|
|
782
|
-
console
|
|
819
|
+
console[method](msg);
|
|
783
820
|
return;
|
|
784
821
|
}
|
|
785
822
|
|
|
@@ -787,9 +824,17 @@
|
|
|
787
824
|
throw new Error(msg);
|
|
788
825
|
} catch (e) {
|
|
789
826
|
/* eslint-disable-next-line no-console */
|
|
790
|
-
console
|
|
827
|
+
console[method](e);
|
|
791
828
|
}
|
|
792
829
|
}
|
|
830
|
+
|
|
831
|
+
function logError(message, vm) {
|
|
832
|
+
log('error', message, vm);
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
function logWarn(message, vm) {
|
|
836
|
+
log('warn', message, vm);
|
|
837
|
+
}
|
|
793
838
|
/*
|
|
794
839
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
795
840
|
* All rights reserved.
|
|
@@ -1948,7 +1993,10 @@
|
|
|
1948
1993
|
// but it will always be compatible with the previous descriptor
|
|
1949
1994
|
// to preserve the object invariants, which makes these lines safe.
|
|
1950
1995
|
|
|
1951
|
-
var originalDescriptor = _getOwnPropertyDescriptor(originalTarget, key);
|
|
1996
|
+
var originalDescriptor = _getOwnPropertyDescriptor(originalTarget, key); // TODO: it should be impossible for the originalDescriptor to ever be undefined, this `if` can be removed
|
|
1997
|
+
|
|
1998
|
+
/* istanbul ignore else */
|
|
1999
|
+
|
|
1952
2000
|
|
|
1953
2001
|
if (!isUndefined(originalDescriptor)) {
|
|
1954
2002
|
var wrappedDesc = this.wrapDescriptor(originalDescriptor);
|
|
@@ -1973,12 +2021,18 @@
|
|
|
1973
2021
|
|
|
1974
2022
|
_preventExtensions(shadowTarget);
|
|
1975
2023
|
} // Shared Traps
|
|
2024
|
+
// TODO: apply() is never called
|
|
2025
|
+
|
|
2026
|
+
/* istanbul ignore next */
|
|
1976
2027
|
|
|
1977
2028
|
}, {
|
|
1978
2029
|
key: "apply",
|
|
1979
2030
|
value: function apply(shadowTarget, thisArg, argArray) {
|
|
1980
2031
|
/* No op */
|
|
1981
|
-
}
|
|
2032
|
+
} // TODO: construct() is never called
|
|
2033
|
+
|
|
2034
|
+
/* istanbul ignore next */
|
|
2035
|
+
|
|
1982
2036
|
}, {
|
|
1983
2037
|
key: "construct",
|
|
1984
2038
|
value: function construct(shadowTarget, argArray, newTarget) {
|
|
@@ -2083,8 +2137,8 @@
|
|
|
2083
2137
|
return BaseProxyHandler;
|
|
2084
2138
|
}();
|
|
2085
2139
|
|
|
2086
|
-
var getterMap = new WeakMap();
|
|
2087
|
-
var setterMap = new WeakMap();
|
|
2140
|
+
var getterMap$1 = new WeakMap();
|
|
2141
|
+
var setterMap$1 = new WeakMap();
|
|
2088
2142
|
var reverseGetterMap = new WeakMap();
|
|
2089
2143
|
var reverseSetterMap = new WeakMap();
|
|
2090
2144
|
|
|
@@ -2107,7 +2161,7 @@
|
|
|
2107
2161
|
}, {
|
|
2108
2162
|
key: "wrapGetter",
|
|
2109
2163
|
value: function wrapGetter(originalGet) {
|
|
2110
|
-
var wrappedGetter = getterMap.get(originalGet);
|
|
2164
|
+
var wrappedGetter = getterMap$1.get(originalGet);
|
|
2111
2165
|
|
|
2112
2166
|
if (!isUndefined(wrappedGetter)) {
|
|
2113
2167
|
return wrappedGetter;
|
|
@@ -2120,14 +2174,14 @@
|
|
|
2120
2174
|
return handler.wrapValue(originalGet.call(unwrap$1(this)));
|
|
2121
2175
|
};
|
|
2122
2176
|
|
|
2123
|
-
getterMap.set(originalGet, get);
|
|
2177
|
+
getterMap$1.set(originalGet, get);
|
|
2124
2178
|
reverseGetterMap.set(get, originalGet);
|
|
2125
2179
|
return get;
|
|
2126
2180
|
}
|
|
2127
2181
|
}, {
|
|
2128
2182
|
key: "wrapSetter",
|
|
2129
2183
|
value: function wrapSetter(originalSet) {
|
|
2130
|
-
var wrappedSetter = setterMap.get(originalSet);
|
|
2184
|
+
var wrappedSetter = setterMap$1.get(originalSet);
|
|
2131
2185
|
|
|
2132
2186
|
if (!isUndefined(wrappedSetter)) {
|
|
2133
2187
|
return wrappedSetter;
|
|
@@ -2138,7 +2192,7 @@
|
|
|
2138
2192
|
originalSet.call(unwrap$1(this), unwrap$1(v));
|
|
2139
2193
|
};
|
|
2140
2194
|
|
|
2141
|
-
setterMap.set(originalSet, set);
|
|
2195
|
+
setterMap$1.set(originalSet, set);
|
|
2142
2196
|
reverseSetterMap.set(set, originalSet);
|
|
2143
2197
|
return set;
|
|
2144
2198
|
}
|
|
@@ -2179,7 +2233,7 @@
|
|
|
2179
2233
|
return unwrap$1(redGet.call(handler.wrapValue(this)));
|
|
2180
2234
|
};
|
|
2181
2235
|
|
|
2182
|
-
getterMap.set(get, redGet);
|
|
2236
|
+
getterMap$1.set(get, redGet);
|
|
2183
2237
|
reverseGetterMap.set(redGet, get);
|
|
2184
2238
|
return get;
|
|
2185
2239
|
}
|
|
@@ -2199,7 +2253,7 @@
|
|
|
2199
2253
|
redSet.call(handler.wrapValue(this), handler.wrapValue(v));
|
|
2200
2254
|
};
|
|
2201
2255
|
|
|
2202
|
-
setterMap.set(set, redSet);
|
|
2256
|
+
setterMap$1.set(set, redSet);
|
|
2203
2257
|
reverseSetterMap.set(redSet, set);
|
|
2204
2258
|
return set;
|
|
2205
2259
|
}
|
|
@@ -2235,6 +2289,7 @@
|
|
|
2235
2289
|
}, {
|
|
2236
2290
|
key: "setPrototypeOf",
|
|
2237
2291
|
value: function setPrototypeOf(shadowTarget, prototype) {
|
|
2292
|
+
/* istanbul ignore else */
|
|
2238
2293
|
if (process.env.NODE_ENV !== 'production') {
|
|
2239
2294
|
throw new Error("Invalid setPrototypeOf invocation for reactive proxy ".concat(toString(this.originalTarget), ". Prototype of reactive objects cannot be changed."));
|
|
2240
2295
|
}
|
|
@@ -2248,6 +2303,11 @@
|
|
|
2248
2303
|
_preventExtensions(originalTarget); // if the originalTarget is a proxy itself, it might reject
|
|
2249
2304
|
// the preventExtension call, in which case we should not attempt to lock down
|
|
2250
2305
|
// the shadow target.
|
|
2306
|
+
// TODO: It should not actually be possible to reach this `if` statement.
|
|
2307
|
+
// If a proxy rejects extensions, then calling preventExtensions will throw an error:
|
|
2308
|
+
// https://codepen.io/nolanlawson-the-selector/pen/QWMOjbY
|
|
2309
|
+
|
|
2310
|
+
/* istanbul ignore if */
|
|
2251
2311
|
|
|
2252
2312
|
|
|
2253
2313
|
if (_isExtensible(originalTarget)) {
|
|
@@ -2290,8 +2350,8 @@
|
|
|
2290
2350
|
return ReactiveProxyHandler;
|
|
2291
2351
|
}(BaseProxyHandler);
|
|
2292
2352
|
|
|
2293
|
-
var getterMap
|
|
2294
|
-
var setterMap
|
|
2353
|
+
var getterMap = new WeakMap();
|
|
2354
|
+
var setterMap = new WeakMap();
|
|
2295
2355
|
|
|
2296
2356
|
var ReadOnlyHandler = /*#__PURE__*/function (_BaseProxyHandler2) {
|
|
2297
2357
|
_inherits(ReadOnlyHandler, _BaseProxyHandler2);
|
|
@@ -2312,7 +2372,7 @@
|
|
|
2312
2372
|
}, {
|
|
2313
2373
|
key: "wrapGetter",
|
|
2314
2374
|
value: function wrapGetter(originalGet) {
|
|
2315
|
-
var wrappedGetter = getterMap
|
|
2375
|
+
var wrappedGetter = getterMap.get(originalGet);
|
|
2316
2376
|
|
|
2317
2377
|
if (!isUndefined(wrappedGetter)) {
|
|
2318
2378
|
return wrappedGetter;
|
|
@@ -2325,13 +2385,13 @@
|
|
|
2325
2385
|
return handler.wrapValue(originalGet.call(unwrap$1(this)));
|
|
2326
2386
|
};
|
|
2327
2387
|
|
|
2328
|
-
getterMap
|
|
2388
|
+
getterMap.set(originalGet, get);
|
|
2329
2389
|
return get;
|
|
2330
2390
|
}
|
|
2331
2391
|
}, {
|
|
2332
2392
|
key: "wrapSetter",
|
|
2333
2393
|
value: function wrapSetter(originalSet) {
|
|
2334
|
-
var wrappedSetter = setterMap
|
|
2394
|
+
var wrappedSetter = setterMap.get(originalSet);
|
|
2335
2395
|
|
|
2336
2396
|
if (!isUndefined(wrappedSetter)) {
|
|
2337
2397
|
return wrappedSetter;
|
|
@@ -2340,38 +2400,47 @@
|
|
|
2340
2400
|
var handler = this;
|
|
2341
2401
|
|
|
2342
2402
|
var set = function set(v) {
|
|
2403
|
+
/* istanbul ignore else */
|
|
2343
2404
|
if (process.env.NODE_ENV !== 'production') {
|
|
2344
2405
|
var originalTarget = handler.originalTarget;
|
|
2345
2406
|
throw new Error("Invalid mutation: Cannot invoke a setter on \"".concat(originalTarget, "\". \"").concat(originalTarget, "\" is read-only."));
|
|
2346
2407
|
}
|
|
2347
2408
|
};
|
|
2348
2409
|
|
|
2349
|
-
setterMap
|
|
2410
|
+
setterMap.set(originalSet, set);
|
|
2350
2411
|
return set;
|
|
2351
2412
|
}
|
|
2352
2413
|
}, {
|
|
2353
2414
|
key: "set",
|
|
2354
2415
|
value: function set(shadowTarget, key, value) {
|
|
2416
|
+
/* istanbul ignore else */
|
|
2355
2417
|
if (process.env.NODE_ENV !== 'production') {
|
|
2356
2418
|
var originalTarget = this.originalTarget;
|
|
2357
|
-
|
|
2419
|
+
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.");
|
|
2420
|
+
throw new Error(msg);
|
|
2358
2421
|
}
|
|
2422
|
+
/* istanbul ignore next */
|
|
2423
|
+
|
|
2359
2424
|
|
|
2360
2425
|
return false;
|
|
2361
2426
|
}
|
|
2362
2427
|
}, {
|
|
2363
2428
|
key: "deleteProperty",
|
|
2364
2429
|
value: function deleteProperty(shadowTarget, key) {
|
|
2430
|
+
/* istanbul ignore else */
|
|
2365
2431
|
if (process.env.NODE_ENV !== 'production') {
|
|
2366
2432
|
var originalTarget = this.originalTarget;
|
|
2367
2433
|
throw new Error("Invalid mutation: Cannot delete \"".concat(key.toString(), "\" on \"").concat(originalTarget, "\". \"").concat(originalTarget, "\" is read-only."));
|
|
2368
2434
|
}
|
|
2435
|
+
/* istanbul ignore next */
|
|
2436
|
+
|
|
2369
2437
|
|
|
2370
2438
|
return false;
|
|
2371
2439
|
}
|
|
2372
2440
|
}, {
|
|
2373
2441
|
key: "setPrototypeOf",
|
|
2374
2442
|
value: function setPrototypeOf(shadowTarget, prototype) {
|
|
2443
|
+
/* istanbul ignore else */
|
|
2375
2444
|
if (process.env.NODE_ENV !== 'production') {
|
|
2376
2445
|
var originalTarget = this.originalTarget;
|
|
2377
2446
|
throw new Error("Invalid prototype mutation: Cannot set prototype on \"".concat(originalTarget, "\". \"").concat(originalTarget, "\" prototype is read-only."));
|
|
@@ -2380,20 +2449,26 @@
|
|
|
2380
2449
|
}, {
|
|
2381
2450
|
key: "preventExtensions",
|
|
2382
2451
|
value: function preventExtensions(shadowTarget) {
|
|
2452
|
+
/* istanbul ignore else */
|
|
2383
2453
|
if (process.env.NODE_ENV !== 'production') {
|
|
2384
2454
|
var originalTarget = this.originalTarget;
|
|
2385
2455
|
throw new Error("Invalid mutation: Cannot preventExtensions on ".concat(originalTarget, "\". \"").concat(originalTarget, " is read-only."));
|
|
2386
2456
|
}
|
|
2457
|
+
/* istanbul ignore next */
|
|
2458
|
+
|
|
2387
2459
|
|
|
2388
2460
|
return false;
|
|
2389
2461
|
}
|
|
2390
2462
|
}, {
|
|
2391
2463
|
key: "defineProperty",
|
|
2392
2464
|
value: function defineProperty(shadowTarget, key, descriptor) {
|
|
2465
|
+
/* istanbul ignore else */
|
|
2393
2466
|
if (process.env.NODE_ENV !== 'production') {
|
|
2394
2467
|
var originalTarget = this.originalTarget;
|
|
2395
2468
|
throw new Error("Invalid mutation: Cannot defineProperty \"".concat(key.toString(), "\" on \"").concat(originalTarget, "\". \"").concat(originalTarget, "\" is read-only."));
|
|
2396
2469
|
}
|
|
2470
|
+
/* istanbul ignore next */
|
|
2471
|
+
|
|
2397
2472
|
|
|
2398
2473
|
return false;
|
|
2399
2474
|
}
|
|
@@ -2453,6 +2528,8 @@
|
|
|
2453
2528
|
}; // Inspired from paulmillr/es6-shim
|
|
2454
2529
|
// https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js#L176-L185
|
|
2455
2530
|
|
|
2531
|
+
/* istanbul ignore next */
|
|
2532
|
+
|
|
2456
2533
|
function getGlobal() {
|
|
2457
2534
|
// the only reliable means to get the global object is `Function('return this')()`
|
|
2458
2535
|
// However, this causes CSP violations in Chrome apps.
|
|
@@ -2477,6 +2554,7 @@
|
|
|
2477
2554
|
}
|
|
2478
2555
|
|
|
2479
2556
|
function init() {
|
|
2557
|
+
/* istanbul ignore if */
|
|
2480
2558
|
if (process.env.NODE_ENV === 'production') {
|
|
2481
2559
|
// this method should never leak to prod
|
|
2482
2560
|
throw new ReferenceError();
|
|
@@ -2491,6 +2569,8 @@
|
|
|
2491
2569
|
ArrayPush.call(devtoolsFormatters, formatter);
|
|
2492
2570
|
global.devtoolsFormatters = devtoolsFormatters;
|
|
2493
2571
|
}
|
|
2572
|
+
/* istanbul ignore else */
|
|
2573
|
+
|
|
2494
2574
|
|
|
2495
2575
|
if (process.env.NODE_ENV !== 'production') {
|
|
2496
2576
|
init();
|
|
@@ -2542,7 +2622,8 @@
|
|
|
2542
2622
|
this.valueMutated = defaultValueMutated;
|
|
2543
2623
|
this.valueObserved = defaultValueObserved;
|
|
2544
2624
|
this.valueIsObservable = defaultValueIsObservable;
|
|
2545
|
-
this.
|
|
2625
|
+
this.readOnlyObjectGraph = new WeakMap();
|
|
2626
|
+
this.reactiveObjectGraph = new WeakMap();
|
|
2546
2627
|
|
|
2547
2628
|
if (!isUndefined(options)) {
|
|
2548
2629
|
var _valueDistortion = options.valueDistortion,
|
|
@@ -2565,10 +2646,13 @@
|
|
|
2565
2646
|
var distorted = this.valueDistortion(unwrappedValue);
|
|
2566
2647
|
|
|
2567
2648
|
if (this.valueIsObservable(distorted)) {
|
|
2568
|
-
|
|
2569
|
-
|
|
2649
|
+
if (this.readOnlyObjectGraph.get(distorted) === value) {
|
|
2650
|
+
// when trying to extract the writable version of a readonly
|
|
2651
|
+
// we return the readonly.
|
|
2652
|
+
return value;
|
|
2653
|
+
}
|
|
2570
2654
|
|
|
2571
|
-
return
|
|
2655
|
+
return this.getReactiveHandler(unwrappedValue, distorted);
|
|
2572
2656
|
}
|
|
2573
2657
|
|
|
2574
2658
|
return distorted;
|
|
@@ -2580,7 +2664,7 @@
|
|
|
2580
2664
|
var distorted = this.valueDistortion(value);
|
|
2581
2665
|
|
|
2582
2666
|
if (this.valueIsObservable(distorted)) {
|
|
2583
|
-
return this.
|
|
2667
|
+
return this.getReadOnlyHandler(value, distorted);
|
|
2584
2668
|
}
|
|
2585
2669
|
|
|
2586
2670
|
return distorted;
|
|
@@ -2591,48 +2675,40 @@
|
|
|
2591
2675
|
return unwrap$1(p);
|
|
2592
2676
|
}
|
|
2593
2677
|
}, {
|
|
2594
|
-
key: "
|
|
2595
|
-
value: function
|
|
2596
|
-
var
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2678
|
+
key: "getReactiveHandler",
|
|
2679
|
+
value: function getReactiveHandler(value, distortedValue) {
|
|
2680
|
+
var proxy = this.reactiveObjectGraph.get(distortedValue);
|
|
2681
|
+
|
|
2682
|
+
if (isUndefined(proxy)) {
|
|
2683
|
+
// caching the proxy after the first time it is accessed
|
|
2684
|
+
var handler = new ReactiveProxyHandler(this, distortedValue);
|
|
2685
|
+
proxy = new Proxy(createShadowTarget(distortedValue), handler);
|
|
2686
|
+
registerProxy(proxy, value);
|
|
2687
|
+
this.reactiveObjectGraph.set(distortedValue, proxy);
|
|
2601
2688
|
}
|
|
2602
2689
|
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
var readOnlyHandler = new ReadOnlyHandler(membrane, distortedValue); // caching the readOnly proxy after the first time it is accessed
|
|
2618
|
-
|
|
2619
|
-
var proxy = new Proxy(createShadowTarget(distortedValue), readOnlyHandler);
|
|
2620
|
-
registerProxy(proxy, value);
|
|
2621
|
-
ObjectDefineProperty(this, 'readOnly', {
|
|
2622
|
-
value: proxy
|
|
2623
|
-
});
|
|
2624
|
-
return proxy;
|
|
2625
|
-
}
|
|
2690
|
+
return proxy;
|
|
2691
|
+
}
|
|
2692
|
+
}, {
|
|
2693
|
+
key: "getReadOnlyHandler",
|
|
2694
|
+
value: function getReadOnlyHandler(value, distortedValue) {
|
|
2695
|
+
var proxy = this.readOnlyObjectGraph.get(distortedValue);
|
|
2696
|
+
|
|
2697
|
+
if (isUndefined(proxy)) {
|
|
2698
|
+
// caching the proxy after the first time it is accessed
|
|
2699
|
+
var handler = new ReadOnlyHandler(this, distortedValue);
|
|
2700
|
+
proxy = new Proxy(createShadowTarget(distortedValue), handler);
|
|
2701
|
+
registerProxy(proxy, value);
|
|
2702
|
+
this.readOnlyObjectGraph.set(distortedValue, proxy);
|
|
2703
|
+
}
|
|
2626
2704
|
|
|
2627
|
-
|
|
2628
|
-
objectGraph.set(distortedValue, reactiveState);
|
|
2629
|
-
return reactiveState;
|
|
2705
|
+
return proxy;
|
|
2630
2706
|
}
|
|
2631
2707
|
}]);
|
|
2632
2708
|
|
|
2633
2709
|
return ReactiveMembrane;
|
|
2634
2710
|
}();
|
|
2635
|
-
/** version: 1.
|
|
2711
|
+
/** version: 1.1.5 */
|
|
2636
2712
|
|
|
2637
2713
|
/*
|
|
2638
2714
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -3018,7 +3094,9 @@
|
|
|
3018
3094
|
}
|
|
3019
3095
|
|
|
3020
3096
|
return renderer[rendererMethod](elm);
|
|
3021
|
-
}
|
|
3097
|
+
},
|
|
3098
|
+
configurable: true,
|
|
3099
|
+
enumerable: true
|
|
3022
3100
|
};
|
|
3023
3101
|
};
|
|
3024
3102
|
|
|
@@ -3041,7 +3119,10 @@
|
|
|
3041
3119
|
}
|
|
3042
3120
|
|
|
3043
3121
|
return renderer[queryMethod](elm, arg);
|
|
3044
|
-
}
|
|
3122
|
+
},
|
|
3123
|
+
configurable: true,
|
|
3124
|
+
enumerable: true,
|
|
3125
|
+
writable: true
|
|
3045
3126
|
};
|
|
3046
3127
|
};
|
|
3047
3128
|
|
|
@@ -3934,12 +4015,12 @@
|
|
|
3934
4015
|
function flattenStylesheets(stylesheets) {
|
|
3935
4016
|
var list = [];
|
|
3936
4017
|
|
|
3937
|
-
var
|
|
3938
|
-
|
|
4018
|
+
var _iterator2 = _createForOfIteratorHelper(stylesheets),
|
|
4019
|
+
_step2;
|
|
3939
4020
|
|
|
3940
4021
|
try {
|
|
3941
|
-
for (
|
|
3942
|
-
var stylesheet =
|
|
4022
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
4023
|
+
var stylesheet = _step2.value;
|
|
3943
4024
|
|
|
3944
4025
|
if (!Array.isArray(stylesheet)) {
|
|
3945
4026
|
list.push(stylesheet);
|
|
@@ -3948,9 +4029,9 @@
|
|
|
3948
4029
|
}
|
|
3949
4030
|
}
|
|
3950
4031
|
} catch (err) {
|
|
3951
|
-
|
|
4032
|
+
_iterator2.e(err);
|
|
3952
4033
|
} finally {
|
|
3953
|
-
|
|
4034
|
+
_iterator2.f();
|
|
3954
4035
|
}
|
|
3955
4036
|
|
|
3956
4037
|
return list;
|
|
@@ -4214,7 +4295,7 @@
|
|
|
4214
4295
|
if (!isUndefined$1(ctorShadowSupportMode)) {
|
|
4215
4296
|
assert.invariant(ctorShadowSupportMode === "any"
|
|
4216
4297
|
/* Any */
|
|
4217
|
-
|| ctorShadowSupportMode === "
|
|
4298
|
+
|| ctorShadowSupportMode === "reset"
|
|
4218
4299
|
/* Default */
|
|
4219
4300
|
, "Invalid value for static property shadowSupportMode: '".concat(ctorShadowSupportMode, "'"));
|
|
4220
4301
|
}
|
|
@@ -4372,7 +4453,7 @@
|
|
|
4372
4453
|
renderMode: 1
|
|
4373
4454
|
/* Shadow */
|
|
4374
4455
|
,
|
|
4375
|
-
shadowSupportMode: "
|
|
4456
|
+
shadowSupportMode: "reset"
|
|
4376
4457
|
/* Default */
|
|
4377
4458
|
,
|
|
4378
4459
|
wire: EmptyObject,
|
|
@@ -4509,6 +4590,17 @@
|
|
|
4509
4590
|
modComputedStyle.create(vnode);
|
|
4510
4591
|
}
|
|
4511
4592
|
|
|
4593
|
+
function hydrateElmHook(vnode) {
|
|
4594
|
+
modEvents.create(vnode); // Attrs are already on the element.
|
|
4595
|
+
// modAttrs.create(vnode);
|
|
4596
|
+
|
|
4597
|
+
modProps.create(vnode); // Already set.
|
|
4598
|
+
// modStaticClassName.create(vnode);
|
|
4599
|
+
// modStaticStyle.create(vnode);
|
|
4600
|
+
// modComputedClassName.create(vnode);
|
|
4601
|
+
// modComputedStyle.create(vnode);
|
|
4602
|
+
}
|
|
4603
|
+
|
|
4512
4604
|
function fallbackElmHook(elm, vnode) {
|
|
4513
4605
|
var owner = vnode.owner;
|
|
4514
4606
|
setScopeTokenClassIfNecessary(elm, owner);
|
|
@@ -4658,6 +4750,174 @@
|
|
|
4658
4750
|
}
|
|
4659
4751
|
}
|
|
4660
4752
|
|
|
4753
|
+
function isElementNode(node) {
|
|
4754
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
4755
|
+
return node.nodeType === Node.ELEMENT_NODE;
|
|
4756
|
+
}
|
|
4757
|
+
|
|
4758
|
+
function vnodesAndElementHaveCompatibleAttrs(vnode, elm) {
|
|
4759
|
+
var _vnode$data$attrs = vnode.data.attrs,
|
|
4760
|
+
attrs = _vnode$data$attrs === void 0 ? {} : _vnode$data$attrs,
|
|
4761
|
+
renderer = vnode.owner.renderer;
|
|
4762
|
+
var nodesAreCompatible = true; // Validate attributes, though we could always recovery from those by running the update mods.
|
|
4763
|
+
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
4764
|
+
|
|
4765
|
+
for (var _i14 = 0, _Object$entries = Object.entries(attrs); _i14 < _Object$entries.length; _i14++) {
|
|
4766
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i14], 2),
|
|
4767
|
+
attrName = _Object$entries$_i[0],
|
|
4768
|
+
attrValue = _Object$entries$_i[1];
|
|
4769
|
+
|
|
4770
|
+
var elmAttrValue = renderer.getAttribute(elm, attrName);
|
|
4771
|
+
|
|
4772
|
+
if (String(attrValue) !== elmAttrValue) {
|
|
4773
|
+
logError("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: attribute \"").concat(attrName, "\" has different values, expected \"").concat(attrValue, "\" but found \"").concat(elmAttrValue, "\""), vnode.owner);
|
|
4774
|
+
nodesAreCompatible = false;
|
|
4775
|
+
}
|
|
4776
|
+
}
|
|
4777
|
+
|
|
4778
|
+
return nodesAreCompatible;
|
|
4779
|
+
}
|
|
4780
|
+
|
|
4781
|
+
function vnodesAndElementHaveCompatibleClass(vnode, elm) {
|
|
4782
|
+
var _vnode$data = vnode.data,
|
|
4783
|
+
className = _vnode$data.className,
|
|
4784
|
+
classMap = _vnode$data.classMap,
|
|
4785
|
+
renderer = vnode.owner.renderer;
|
|
4786
|
+
var nodesAreCompatible = true;
|
|
4787
|
+
var vnodeClassName;
|
|
4788
|
+
|
|
4789
|
+
if (!isUndefined$1(className) && String(className) !== elm.className) {
|
|
4790
|
+
// className is used when class is bound to an expr.
|
|
4791
|
+
nodesAreCompatible = false;
|
|
4792
|
+
vnodeClassName = className;
|
|
4793
|
+
} else if (!isUndefined$1(classMap)) {
|
|
4794
|
+
// classMap is used when class is set to static value.
|
|
4795
|
+
var classList = renderer.getClassList(elm);
|
|
4796
|
+
var computedClassName = ''; // all classes from the vnode should be in the element.classList
|
|
4797
|
+
|
|
4798
|
+
for (var name in classMap) {
|
|
4799
|
+
computedClassName += ' ' + name;
|
|
4800
|
+
|
|
4801
|
+
if (!classList.contains(name)) {
|
|
4802
|
+
nodesAreCompatible = false;
|
|
4803
|
+
}
|
|
4804
|
+
}
|
|
4805
|
+
|
|
4806
|
+
vnodeClassName = computedClassName.trim();
|
|
4807
|
+
|
|
4808
|
+
if (classList.length > keys(classMap).length) {
|
|
4809
|
+
nodesAreCompatible = false;
|
|
4810
|
+
}
|
|
4811
|
+
}
|
|
4812
|
+
|
|
4813
|
+
if (!nodesAreCompatible) {
|
|
4814
|
+
logError("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: attribute \"class\" has different values, expected \"").concat(vnodeClassName, "\" but found \"").concat(elm.className, "\""), vnode.owner);
|
|
4815
|
+
}
|
|
4816
|
+
|
|
4817
|
+
return nodesAreCompatible;
|
|
4818
|
+
}
|
|
4819
|
+
|
|
4820
|
+
function vnodesAndElementHaveCompatibleStyle(vnode, elm) {
|
|
4821
|
+
var _vnode$data2 = vnode.data,
|
|
4822
|
+
style = _vnode$data2.style,
|
|
4823
|
+
styleDecls = _vnode$data2.styleDecls,
|
|
4824
|
+
renderer = vnode.owner.renderer;
|
|
4825
|
+
var elmStyle = renderer.getAttribute(elm, 'style') || '';
|
|
4826
|
+
var vnodeStyle;
|
|
4827
|
+
var nodesAreCompatible = true;
|
|
4828
|
+
|
|
4829
|
+
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
4830
|
+
nodesAreCompatible = false;
|
|
4831
|
+
vnodeStyle = style;
|
|
4832
|
+
} else if (!isUndefined$1(styleDecls)) {
|
|
4833
|
+
var parsedVnodeStyle = parseStyleText(elmStyle);
|
|
4834
|
+
var expectedStyle = []; // styleMap is used when style is set to static value.
|
|
4835
|
+
|
|
4836
|
+
for (var _i15 = 0, n = styleDecls.length; _i15 < n; _i15++) {
|
|
4837
|
+
var _styleDecls$_i2 = _slicedToArray(styleDecls[_i15], 3),
|
|
4838
|
+
prop = _styleDecls$_i2[0],
|
|
4839
|
+
value = _styleDecls$_i2[1],
|
|
4840
|
+
important = _styleDecls$_i2[2];
|
|
4841
|
+
|
|
4842
|
+
expectedStyle.push("".concat(prop, ": ").concat(value + (important ? ' important!' : '')));
|
|
4843
|
+
var parsedPropValue = parsedVnodeStyle[prop];
|
|
4844
|
+
|
|
4845
|
+
if (isUndefined$1(parsedPropValue)) {
|
|
4846
|
+
nodesAreCompatible = false;
|
|
4847
|
+
} else if (!parsedPropValue.startsWith(value)) {
|
|
4848
|
+
nodesAreCompatible = false;
|
|
4849
|
+
} else if (important && !parsedPropValue.endsWith('!important')) {
|
|
4850
|
+
nodesAreCompatible = false;
|
|
4851
|
+
}
|
|
4852
|
+
}
|
|
4853
|
+
|
|
4854
|
+
if (keys(parsedVnodeStyle).length > styleDecls.length) {
|
|
4855
|
+
nodesAreCompatible = false;
|
|
4856
|
+
}
|
|
4857
|
+
|
|
4858
|
+
vnodeStyle = ArrayJoin.call(expectedStyle, ';');
|
|
4859
|
+
}
|
|
4860
|
+
|
|
4861
|
+
if (!nodesAreCompatible) {
|
|
4862
|
+
// style is used when class is bound to an expr.
|
|
4863
|
+
logError("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: attribute \"style\" has different values, expected \"").concat(vnodeStyle, "\" but found \"").concat(elmStyle, "\"."), vnode.owner);
|
|
4864
|
+
}
|
|
4865
|
+
|
|
4866
|
+
return nodesAreCompatible;
|
|
4867
|
+
}
|
|
4868
|
+
|
|
4869
|
+
function throwHydrationError() {
|
|
4870
|
+
assert.fail('Server rendered elements do not match client side generated elements');
|
|
4871
|
+
}
|
|
4872
|
+
|
|
4873
|
+
function hydrateChildrenHook(elmChildren, children, vm) {
|
|
4874
|
+
var _a, _b;
|
|
4875
|
+
|
|
4876
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4877
|
+
var filteredVNodes = ArrayFilter.call(children, function (vnode) {
|
|
4878
|
+
return !!vnode;
|
|
4879
|
+
});
|
|
4880
|
+
|
|
4881
|
+
if (elmChildren.length !== filteredVNodes.length) {
|
|
4882
|
+
logError("Hydration mismatch: incorrect number of rendered nodes, expected ".concat(filteredVNodes.length, " but found ").concat(elmChildren.length, "."), vm);
|
|
4883
|
+
throwHydrationError();
|
|
4884
|
+
}
|
|
4885
|
+
}
|
|
4886
|
+
|
|
4887
|
+
var elmCurrentChildIdx = 0;
|
|
4888
|
+
|
|
4889
|
+
for (var j = 0, n = children.length; j < n; j++) {
|
|
4890
|
+
var ch = children[j];
|
|
4891
|
+
|
|
4892
|
+
if (ch != null) {
|
|
4893
|
+
var childNode = elmChildren[elmCurrentChildIdx];
|
|
4894
|
+
|
|
4895
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4896
|
+
// VComments and VTexts validation is handled in their hooks
|
|
4897
|
+
if (isElementNode(childNode)) {
|
|
4898
|
+
if (((_a = ch.sel) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== childNode.tagName.toLowerCase()) {
|
|
4899
|
+
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);
|
|
4900
|
+
throwHydrationError();
|
|
4901
|
+
} // Note: props are not yet set
|
|
4902
|
+
|
|
4903
|
+
|
|
4904
|
+
var hasIncompatibleAttrs = vnodesAndElementHaveCompatibleAttrs(ch, childNode);
|
|
4905
|
+
var hasIncompatibleClass = vnodesAndElementHaveCompatibleClass(ch, childNode);
|
|
4906
|
+
var hasIncompatibleStyle = vnodesAndElementHaveCompatibleStyle(ch, childNode);
|
|
4907
|
+
var isVNodeAndElementCompatible = hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
4908
|
+
|
|
4909
|
+
if (!isVNodeAndElementCompatible) {
|
|
4910
|
+
throwHydrationError();
|
|
4911
|
+
}
|
|
4912
|
+
}
|
|
4913
|
+
}
|
|
4914
|
+
|
|
4915
|
+
ch.hook.hydrate(ch, childNode);
|
|
4916
|
+
elmCurrentChildIdx++;
|
|
4917
|
+
}
|
|
4918
|
+
}
|
|
4919
|
+
}
|
|
4920
|
+
|
|
4661
4921
|
function updateCustomElmHook(oldVnode, vnode) {
|
|
4662
4922
|
// Attrs need to be applied to element before props
|
|
4663
4923
|
// IE11 will wipe out value on radio inputs if value
|
|
@@ -4751,38 +5011,6 @@
|
|
|
4751
5011
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4752
5012
|
*/
|
|
4753
5013
|
|
|
4754
|
-
/**
|
|
4755
|
-
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
|
4756
|
-
* libraries to sanitize HTML content. This hook process the content passed via the template to
|
|
4757
|
-
* lwc:inner-html directive.
|
|
4758
|
-
* It is meant to be overridden with setSanitizeHtmlContentHook
|
|
4759
|
-
*/
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
var sanitizeHtmlContentHook = function sanitizeHtmlContentHook() {
|
|
4763
|
-
// locker-service patches this function during runtime to sanitize HTML content.
|
|
4764
|
-
throw new Error('sanitizeHtmlContent hook must be implemented.');
|
|
4765
|
-
};
|
|
4766
|
-
/**
|
|
4767
|
-
* Sets the sanitizeHtmlContentHook.
|
|
4768
|
-
*
|
|
4769
|
-
* @param newHookImpl
|
|
4770
|
-
* @returns oldHookImplementation.
|
|
4771
|
-
*/
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
function setSanitizeHtmlContentHook(newHookImpl) {
|
|
4775
|
-
var currentHook = sanitizeHtmlContentHook;
|
|
4776
|
-
sanitizeHtmlContentHook = newHookImpl;
|
|
4777
|
-
return currentHook;
|
|
4778
|
-
}
|
|
4779
|
-
/*
|
|
4780
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
4781
|
-
* All rights reserved.
|
|
4782
|
-
* SPDX-License-Identifier: MIT
|
|
4783
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4784
|
-
*/
|
|
4785
|
-
|
|
4786
5014
|
|
|
4787
5015
|
var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
4788
5016
|
var SymbolIterator = Symbol.iterator;
|
|
@@ -4797,7 +5025,26 @@
|
|
|
4797
5025
|
update: updateNodeHook,
|
|
4798
5026
|
insert: insertNodeHook,
|
|
4799
5027
|
move: insertNodeHook,
|
|
4800
|
-
remove: removeNodeHook
|
|
5028
|
+
remove: removeNodeHook,
|
|
5029
|
+
hydrate: function hydrate(vNode, node) {
|
|
5030
|
+
var _a;
|
|
5031
|
+
|
|
5032
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5033
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
5034
|
+
if (node.nodeType !== Node.TEXT_NODE) {
|
|
5035
|
+
logError('Hydration mismatch: incorrect node type received', vNode.owner);
|
|
5036
|
+
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
5037
|
+
}
|
|
5038
|
+
|
|
5039
|
+
if (node.nodeValue !== vNode.text) {
|
|
5040
|
+
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vNode.owner);
|
|
5041
|
+
}
|
|
5042
|
+
} // always set the text value to the one from the vnode.
|
|
5043
|
+
|
|
5044
|
+
|
|
5045
|
+
node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
|
|
5046
|
+
vNode.elm = node;
|
|
5047
|
+
}
|
|
4801
5048
|
};
|
|
4802
5049
|
var CommentHook = {
|
|
4803
5050
|
create: function create(vnode) {
|
|
@@ -4811,7 +5058,26 @@
|
|
|
4811
5058
|
update: updateNodeHook,
|
|
4812
5059
|
insert: insertNodeHook,
|
|
4813
5060
|
move: insertNodeHook,
|
|
4814
|
-
remove: removeNodeHook
|
|
5061
|
+
remove: removeNodeHook,
|
|
5062
|
+
hydrate: function hydrate(vNode, node) {
|
|
5063
|
+
var _a;
|
|
5064
|
+
|
|
5065
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5066
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
5067
|
+
if (node.nodeType !== Node.COMMENT_NODE) {
|
|
5068
|
+
logError('Hydration mismatch: incorrect node type received', vNode.owner);
|
|
5069
|
+
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
5070
|
+
}
|
|
5071
|
+
|
|
5072
|
+
if (node.nodeValue !== vNode.text) {
|
|
5073
|
+
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vNode.owner);
|
|
5074
|
+
}
|
|
5075
|
+
} // always set the text value to the one from the vnode.
|
|
5076
|
+
|
|
5077
|
+
|
|
5078
|
+
node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
|
|
5079
|
+
vNode.elm = node;
|
|
5080
|
+
}
|
|
4815
5081
|
}; // insert is called after update, which is used somewhere else (via a module)
|
|
4816
5082
|
// to mark the vm as inserted, that means we cannot use update as the main channel
|
|
4817
5083
|
// to rehydrate when dirty, because sometimes the element is not inserted just yet,
|
|
@@ -4845,6 +5111,34 @@
|
|
|
4845
5111
|
remove: function remove(vnode, parentNode) {
|
|
4846
5112
|
removeNodeHook(vnode, parentNode);
|
|
4847
5113
|
removeElmHook(vnode);
|
|
5114
|
+
},
|
|
5115
|
+
hydrate: function hydrate(vnode, node) {
|
|
5116
|
+
var elm = node;
|
|
5117
|
+
vnode.elm = elm;
|
|
5118
|
+
var context = vnode.data.context;
|
|
5119
|
+
var isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
|
|
5120
|
+
/* manual */
|
|
5121
|
+
);
|
|
5122
|
+
|
|
5123
|
+
if (isDomManual) {
|
|
5124
|
+
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
5125
|
+
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
5126
|
+
var props = vnode.data.props;
|
|
5127
|
+
|
|
5128
|
+
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
5129
|
+
if (elm.innerHTML === props.innerHTML) {
|
|
5130
|
+
delete props.innerHTML;
|
|
5131
|
+
} else {
|
|
5132
|
+
logWarn("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: innerHTML values do not match for element, will recover from the difference"), vnode.owner);
|
|
5133
|
+
}
|
|
5134
|
+
}
|
|
5135
|
+
}
|
|
5136
|
+
|
|
5137
|
+
hydrateElmHook(vnode);
|
|
5138
|
+
|
|
5139
|
+
if (!isDomManual) {
|
|
5140
|
+
hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vnode.owner);
|
|
5141
|
+
}
|
|
4848
5142
|
}
|
|
4849
5143
|
};
|
|
4850
5144
|
var CustomElementHook = {
|
|
@@ -4932,6 +5226,42 @@
|
|
|
4932
5226
|
// will take care of disconnecting any child VM attached to its shadow as well.
|
|
4933
5227
|
removeVM(vm);
|
|
4934
5228
|
}
|
|
5229
|
+
},
|
|
5230
|
+
hydrate: function hydrate(vnode, elm) {
|
|
5231
|
+
// the element is created, but the vm is not
|
|
5232
|
+
var sel = vnode.sel,
|
|
5233
|
+
mode = vnode.mode,
|
|
5234
|
+
ctor = vnode.ctor,
|
|
5235
|
+
owner = vnode.owner;
|
|
5236
|
+
var def = getComponentInternalDef(ctor);
|
|
5237
|
+
createVM(elm, def, {
|
|
5238
|
+
mode: mode,
|
|
5239
|
+
owner: owner,
|
|
5240
|
+
tagName: sel,
|
|
5241
|
+
renderer: owner.renderer
|
|
5242
|
+
});
|
|
5243
|
+
vnode.elm = elm;
|
|
5244
|
+
var vm = getAssociatedVM(elm);
|
|
5245
|
+
allocateChildrenHook(vnode, vm);
|
|
5246
|
+
hydrateElmHook(vnode); // Insert hook section:
|
|
5247
|
+
|
|
5248
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5249
|
+
assert.isTrue(vm.state === 0
|
|
5250
|
+
/* created */
|
|
5251
|
+
, "".concat(vm, " cannot be recycled."));
|
|
5252
|
+
}
|
|
5253
|
+
|
|
5254
|
+
runConnectedCallback(vm);
|
|
5255
|
+
|
|
5256
|
+
if (vm.renderMode !== 0
|
|
5257
|
+
/* Light */
|
|
5258
|
+
) {
|
|
5259
|
+
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
5260
|
+
// Note: for Light DOM, this is handled while hydrating the VM
|
|
5261
|
+
hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vm);
|
|
5262
|
+
}
|
|
5263
|
+
|
|
5264
|
+
hydrateVM(vm);
|
|
4935
5265
|
}
|
|
4936
5266
|
};
|
|
4937
5267
|
|
|
@@ -5234,7 +5564,7 @@
|
|
|
5234
5564
|
|
|
5235
5565
|
|
|
5236
5566
|
function d(value) {
|
|
5237
|
-
return value == null ? '' : value;
|
|
5567
|
+
return value == null ? '' : String(value);
|
|
5238
5568
|
} // [b]ind function
|
|
5239
5569
|
|
|
5240
5570
|
|
|
@@ -5394,6 +5724,26 @@
|
|
|
5394
5724
|
|
|
5395
5725
|
markAsDynamicChildren(vnodes);
|
|
5396
5726
|
return vnodes;
|
|
5727
|
+
}
|
|
5728
|
+
/**
|
|
5729
|
+
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
|
5730
|
+
* libraries to sanitize HTML content. This hook process the content passed via the template to
|
|
5731
|
+
* lwc:inner-html directive.
|
|
5732
|
+
* It is meant to be overridden with setSanitizeHtmlContentHook, it throws an error by default.
|
|
5733
|
+
*/
|
|
5734
|
+
|
|
5735
|
+
|
|
5736
|
+
var sanitizeHtmlContentHook = function sanitizeHtmlContentHook() {
|
|
5737
|
+
// locker-service patches this function during runtime to sanitize HTML content.
|
|
5738
|
+
throw new Error('sanitizeHtmlContent hook must be implemented.');
|
|
5739
|
+
};
|
|
5740
|
+
/**
|
|
5741
|
+
* Sets the sanitizeHtmlContentHook.
|
|
5742
|
+
*/
|
|
5743
|
+
|
|
5744
|
+
|
|
5745
|
+
function setSanitizeHtmlContentHook(newHookImpl) {
|
|
5746
|
+
sanitizeHtmlContentHook = newHookImpl;
|
|
5397
5747
|
} // [s]anitize [h]tml [c]ontent
|
|
5398
5748
|
|
|
5399
5749
|
|
|
@@ -5496,8 +5846,8 @@
|
|
|
5496
5846
|
function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
5497
5847
|
var content = [];
|
|
5498
5848
|
|
|
5499
|
-
for (var
|
|
5500
|
-
var stylesheet = stylesheets[
|
|
5849
|
+
for (var _i16 = 0; _i16 < stylesheets.length; _i16++) {
|
|
5850
|
+
var stylesheet = stylesheets[_i16];
|
|
5501
5851
|
|
|
5502
5852
|
if (isArray$1(stylesheet)) {
|
|
5503
5853
|
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
|
|
@@ -5573,10 +5923,13 @@
|
|
|
5573
5923
|
&& shadowMode === 1
|
|
5574
5924
|
/* Synthetic */
|
|
5575
5925
|
) {
|
|
5576
|
-
for (var
|
|
5577
|
-
renderer.insertGlobalStylesheet(stylesheets[
|
|
5926
|
+
for (var _i17 = 0; _i17 < stylesheets.length; _i17++) {
|
|
5927
|
+
renderer.insertGlobalStylesheet(stylesheets[_i17]);
|
|
5578
5928
|
}
|
|
5579
|
-
} else if (renderer.ssr) {
|
|
5929
|
+
} else if (renderer.ssr || renderer.isHydrating()) {
|
|
5930
|
+
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
5931
|
+
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
5932
|
+
// the first time the VM renders.
|
|
5580
5933
|
// native shadow or light DOM, SSR
|
|
5581
5934
|
var combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
|
|
5582
5935
|
return createInlineStyleVNode(combinedStylesheetContent);
|
|
@@ -5585,12 +5938,12 @@
|
|
|
5585
5938
|
var root = getNearestNativeShadowComponent(vm);
|
|
5586
5939
|
var isGlobal = isNull(root);
|
|
5587
5940
|
|
|
5588
|
-
for (var
|
|
5941
|
+
for (var _i18 = 0; _i18 < stylesheets.length; _i18++) {
|
|
5589
5942
|
if (isGlobal) {
|
|
5590
|
-
renderer.insertGlobalStylesheet(stylesheets[
|
|
5943
|
+
renderer.insertGlobalStylesheet(stylesheets[_i18]);
|
|
5591
5944
|
} else {
|
|
5592
5945
|
// local level
|
|
5593
|
-
renderer.insertStylesheet(stylesheets[
|
|
5946
|
+
renderer.insertStylesheet(stylesheets[_i18], root.cmpRoot);
|
|
5594
5947
|
}
|
|
5595
5948
|
}
|
|
5596
5949
|
}
|
|
@@ -5867,8 +6220,8 @@
|
|
|
5867
6220
|
var stylesheets = template.stylesheets;
|
|
5868
6221
|
|
|
5869
6222
|
if (!isUndefined$1(stylesheets)) {
|
|
5870
|
-
for (var
|
|
5871
|
-
if (isTrue(stylesheets[
|
|
6223
|
+
for (var _i19 = 0; _i19 < stylesheets.length; _i19++) {
|
|
6224
|
+
if (isTrue(stylesheets[_i19][KEY__SCOPED_CSS])) {
|
|
5872
6225
|
return true;
|
|
5873
6226
|
}
|
|
5874
6227
|
}
|
|
@@ -6098,8 +6451,8 @@
|
|
|
6098
6451
|
assert.isTrue(isObject(service), "Invalid service declaration, ".concat(service, ": service must be an object"));
|
|
6099
6452
|
}
|
|
6100
6453
|
|
|
6101
|
-
for (var
|
|
6102
|
-
var hookName = hooks[
|
|
6454
|
+
for (var _i20 = 0; _i20 < hooks.length; ++_i20) {
|
|
6455
|
+
var hookName = hooks[_i20];
|
|
6103
6456
|
|
|
6104
6457
|
if (hookName in service) {
|
|
6105
6458
|
var l = Services[hookName];
|
|
@@ -6122,8 +6475,8 @@
|
|
|
6122
6475
|
def = vm.def,
|
|
6123
6476
|
context = vm.context;
|
|
6124
6477
|
|
|
6125
|
-
for (var
|
|
6126
|
-
cbs[
|
|
6478
|
+
for (var _i21 = 0, _len6 = cbs.length; _i21 < _len6; ++_i21) {
|
|
6479
|
+
cbs[_i21].call(undefined, component, {}, def, context);
|
|
6127
6480
|
}
|
|
6128
6481
|
}
|
|
6129
6482
|
/*
|
|
@@ -6176,6 +6529,12 @@
|
|
|
6176
6529
|
, vm);
|
|
6177
6530
|
}
|
|
6178
6531
|
|
|
6532
|
+
function hydrateRootElement(elm) {
|
|
6533
|
+
var vm = getAssociatedVM(elm);
|
|
6534
|
+
runConnectedCallback(vm);
|
|
6535
|
+
hydrateVM(vm);
|
|
6536
|
+
}
|
|
6537
|
+
|
|
6179
6538
|
function disconnectRootElement(elm) {
|
|
6180
6539
|
var vm = getAssociatedVM(elm);
|
|
6181
6540
|
resetComponentStateWhenRemoved(vm);
|
|
@@ -6183,6 +6542,10 @@
|
|
|
6183
6542
|
|
|
6184
6543
|
function appendVM(vm) {
|
|
6185
6544
|
rehydrate(vm);
|
|
6545
|
+
}
|
|
6546
|
+
|
|
6547
|
+
function hydrateVM(vm) {
|
|
6548
|
+
hydrate(vm);
|
|
6186
6549
|
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
6187
6550
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
6188
6551
|
|
|
@@ -6406,6 +6769,22 @@
|
|
|
6406
6769
|
}
|
|
6407
6770
|
}
|
|
6408
6771
|
|
|
6772
|
+
function hydrate(vm) {
|
|
6773
|
+
if (isTrue(vm.isDirty)) {
|
|
6774
|
+
// manually diffing/patching here.
|
|
6775
|
+
// This routine is:
|
|
6776
|
+
// patchShadowRoot(vm, children);
|
|
6777
|
+
// -> addVnodes.
|
|
6778
|
+
var children = renderComponent(vm);
|
|
6779
|
+
vm.children = children;
|
|
6780
|
+
var vmChildren = vm.renderMode === 0
|
|
6781
|
+
/* Light */
|
|
6782
|
+
? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;
|
|
6783
|
+
hydrateChildrenHook(vmChildren, children, vm);
|
|
6784
|
+
runRenderedCallback(vm);
|
|
6785
|
+
}
|
|
6786
|
+
}
|
|
6787
|
+
|
|
6409
6788
|
function patchShadowRoot(vm, newCh) {
|
|
6410
6789
|
var oldCh = vm.children; // caching the new children collection
|
|
6411
6790
|
|
|
@@ -6486,19 +6865,19 @@
|
|
|
6486
6865
|
});
|
|
6487
6866
|
rehydrateQueue = []; // reset to a new queue
|
|
6488
6867
|
|
|
6489
|
-
for (var
|
|
6490
|
-
var vm = vms[
|
|
6868
|
+
for (var _i22 = 0, _len7 = vms.length; _i22 < _len7; _i22 += 1) {
|
|
6869
|
+
var vm = vms[_i22];
|
|
6491
6870
|
|
|
6492
6871
|
try {
|
|
6493
6872
|
rehydrate(vm);
|
|
6494
6873
|
} catch (error) {
|
|
6495
|
-
if (
|
|
6874
|
+
if (_i22 + 1 < _len7) {
|
|
6496
6875
|
// pieces of the queue are still pending to be rehydrated, those should have priority
|
|
6497
6876
|
if (rehydrateQueue.length === 0) {
|
|
6498
6877
|
addCallbackToNextTick(flushRehydrationQueue);
|
|
6499
6878
|
}
|
|
6500
6879
|
|
|
6501
|
-
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms,
|
|
6880
|
+
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i22 + 1));
|
|
6502
6881
|
} // we need to end the measure before throwing.
|
|
6503
6882
|
|
|
6504
6883
|
|
|
@@ -6602,8 +6981,8 @@
|
|
|
6602
6981
|
var vCustomElementCollection = vm.velements; // Reporting disconnection for every child in inverse order since they are
|
|
6603
6982
|
// inserted in reserved order.
|
|
6604
6983
|
|
|
6605
|
-
for (var
|
|
6606
|
-
var elm = vCustomElementCollection[
|
|
6984
|
+
for (var _i23 = vCustomElementCollection.length - 1; _i23 >= 0; _i23 -= 1) {
|
|
6985
|
+
var elm = vCustomElementCollection[_i23].elm; // There are two cases where the element could be undefined:
|
|
6607
6986
|
// * when there is an error during the construction phase, and an error
|
|
6608
6987
|
// boundary picks it, there is a possibility that the VCustomElement
|
|
6609
6988
|
// is not properly initialized, and therefore is should be ignored.
|
|
@@ -6637,8 +7016,8 @@
|
|
|
6637
7016
|
|
|
6638
7017
|
|
|
6639
7018
|
function recursivelyDisconnectChildren(vnodes) {
|
|
6640
|
-
for (var
|
|
6641
|
-
var vnode = vnodes[
|
|
7019
|
+
for (var _i24 = 0, _len8 = vnodes.length; _i24 < _len8; _i24 += 1) {
|
|
7020
|
+
var vnode = vnodes[_i24];
|
|
6642
7021
|
|
|
6643
7022
|
if (!isNull(vnode) && isArray$1(vnode.children) && !isUndefined$1(vnode.elm)) {
|
|
6644
7023
|
// vnode is a VElement with children
|
|
@@ -6662,8 +7041,8 @@
|
|
|
6662
7041
|
renderer = vm.renderer;
|
|
6663
7042
|
var rootNode = getRenderRoot(vm);
|
|
6664
7043
|
|
|
6665
|
-
for (var
|
|
6666
|
-
var child = children[
|
|
7044
|
+
for (var _i25 = 0, _len9 = children.length; _i25 < _len9; _i25++) {
|
|
7045
|
+
var child = children[_i25];
|
|
6667
7046
|
|
|
6668
7047
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
6669
7048
|
renderer.remove(child.elm, rootNode);
|
|
@@ -6708,8 +7087,8 @@
|
|
|
6708
7087
|
var oldSlots = vm.cmpSlots;
|
|
6709
7088
|
var cmpSlots = vm.cmpSlots = create(null);
|
|
6710
7089
|
|
|
6711
|
-
for (var
|
|
6712
|
-
var vnode = children[
|
|
7090
|
+
for (var _i26 = 0, _len10 = children.length; _i26 < _len10; _i26 += 1) {
|
|
7091
|
+
var vnode = children[_i26];
|
|
6713
7092
|
|
|
6714
7093
|
if (isNull(vnode)) {
|
|
6715
7094
|
continue;
|
|
@@ -6739,8 +7118,8 @@
|
|
|
6739
7118
|
return;
|
|
6740
7119
|
}
|
|
6741
7120
|
|
|
6742
|
-
for (var
|
|
6743
|
-
var key = oldKeys[
|
|
7121
|
+
for (var _i27 = 0, _len11 = oldKeys.length; _i27 < _len11; _i27 += 1) {
|
|
7122
|
+
var key = oldKeys[_i27];
|
|
6744
7123
|
|
|
6745
7124
|
if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
|
|
6746
7125
|
markComponentAsDirty(vm);
|
|
@@ -7103,8 +7482,8 @@
|
|
|
7103
7482
|
function connectWireAdapters(vm) {
|
|
7104
7483
|
var wiredConnecting = vm.context.wiredConnecting;
|
|
7105
7484
|
|
|
7106
|
-
for (var
|
|
7107
|
-
wiredConnecting[
|
|
7485
|
+
for (var _i28 = 0, _len12 = wiredConnecting.length; _i28 < _len12; _i28 += 1) {
|
|
7486
|
+
wiredConnecting[_i28]();
|
|
7108
7487
|
}
|
|
7109
7488
|
}
|
|
7110
7489
|
|
|
@@ -7112,8 +7491,8 @@
|
|
|
7112
7491
|
var wiredDisconnecting = vm.context.wiredDisconnecting;
|
|
7113
7492
|
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
7114
7493
|
// job
|
|
7115
|
-
for (var
|
|
7116
|
-
wiredDisconnecting[
|
|
7494
|
+
for (var _i29 = 0, _len13 = wiredDisconnecting.length; _i29 < _len13; _i29 += 1) {
|
|
7495
|
+
wiredDisconnecting[_i29]();
|
|
7117
7496
|
}
|
|
7118
7497
|
}, noop);
|
|
7119
7498
|
}
|
|
@@ -7198,28 +7577,12 @@
|
|
|
7198
7577
|
|
|
7199
7578
|
var hooksAreSet = false;
|
|
7200
7579
|
|
|
7201
|
-
function overrideHooks(hooks) {
|
|
7202
|
-
var oldHooks = {};
|
|
7203
|
-
|
|
7204
|
-
if (!isUndefined$1(hooks.sanitizeHtmlContent)) {
|
|
7205
|
-
oldHooks.sanitizeHtmlContent = setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
7206
|
-
}
|
|
7207
|
-
|
|
7208
|
-
return oldHooks;
|
|
7209
|
-
}
|
|
7210
|
-
|
|
7211
7580
|
function setHooks(hooks) {
|
|
7212
7581
|
assert.isFalse(hooksAreSet, 'Hooks are already overridden, only one definition is allowed.');
|
|
7213
|
-
overrideHooks(hooks);
|
|
7214
7582
|
hooksAreSet = true;
|
|
7583
|
+
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
7215
7584
|
}
|
|
7216
|
-
|
|
7217
|
-
function setHooksForTest(hooks) {
|
|
7218
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
7219
|
-
return overrideHooks(hooks);
|
|
7220
|
-
}
|
|
7221
|
-
}
|
|
7222
|
-
/* version: 2.5.6 */
|
|
7585
|
+
/* version: 2.5.10 */
|
|
7223
7586
|
|
|
7224
7587
|
/*
|
|
7225
7588
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7234,8 +7597,8 @@
|
|
|
7234
7597
|
if (process.env.NODE_ENV === 'development') {
|
|
7235
7598
|
// @ts-ignore
|
|
7236
7599
|
window.__lwcResetGlobalStylesheets = function () {
|
|
7237
|
-
for (var
|
|
7238
|
-
var key = _Object$keys[
|
|
7600
|
+
for (var _i30 = 0, _Object$keys = Object.keys(globalStylesheets); _i30 < _Object$keys.length; _i30++) {
|
|
7601
|
+
var key = _Object$keys[_i30];
|
|
7239
7602
|
delete globalStylesheets[key];
|
|
7240
7603
|
}
|
|
7241
7604
|
};
|
|
@@ -7374,8 +7737,17 @@
|
|
|
7374
7737
|
HTMLElementConstructor.prototype = HTMLElement.prototype;
|
|
7375
7738
|
}
|
|
7376
7739
|
|
|
7740
|
+
var _isHydrating = false;
|
|
7741
|
+
|
|
7742
|
+
function setIsHydrating(v) {
|
|
7743
|
+
_isHydrating = v;
|
|
7744
|
+
}
|
|
7745
|
+
|
|
7377
7746
|
var renderer = {
|
|
7378
7747
|
ssr: false,
|
|
7748
|
+
isHydrating: function isHydrating() {
|
|
7749
|
+
return _isHydrating;
|
|
7750
|
+
},
|
|
7379
7751
|
isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
|
|
7380
7752
|
isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
|
|
7381
7753
|
createElement: function createElement(tagName, namespace) {
|
|
@@ -7397,6 +7769,10 @@
|
|
|
7397
7769
|
return node.nextSibling;
|
|
7398
7770
|
},
|
|
7399
7771
|
attachShadow: function attachShadow(element, options) {
|
|
7772
|
+
if (_isHydrating) {
|
|
7773
|
+
return element.shadowRoot;
|
|
7774
|
+
}
|
|
7775
|
+
|
|
7400
7776
|
return element.attachShadow(options);
|
|
7401
7777
|
},
|
|
7402
7778
|
setText: function setText(node, content) {
|
|
@@ -7507,75 +7883,6 @@
|
|
|
7507
7883
|
getCustomElement: getCustomElement,
|
|
7508
7884
|
HTMLElement: HTMLElementConstructor
|
|
7509
7885
|
};
|
|
7510
|
-
/*
|
|
7511
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
7512
|
-
* All rights reserved.
|
|
7513
|
-
* SPDX-License-Identifier: MIT
|
|
7514
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7515
|
-
*/
|
|
7516
|
-
|
|
7517
|
-
/**
|
|
7518
|
-
* This function builds a Web Component class from a LWC constructor so it can be
|
|
7519
|
-
* registered as a new element via customElements.define() at any given time.
|
|
7520
|
-
*
|
|
7521
|
-
* @deprecated since version 1.3.11
|
|
7522
|
-
*
|
|
7523
|
-
* @example
|
|
7524
|
-
* ```
|
|
7525
|
-
* import { buildCustomElementConstructor } from 'lwc';
|
|
7526
|
-
* import Foo from 'ns/foo';
|
|
7527
|
-
* const WC = buildCustomElementConstructor(Foo);
|
|
7528
|
-
* customElements.define('x-foo', WC);
|
|
7529
|
-
* const elm = document.createElement('x-foo');
|
|
7530
|
-
* ```
|
|
7531
|
-
*/
|
|
7532
|
-
|
|
7533
|
-
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
7534
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
7535
|
-
/* eslint-disable-next-line no-console */
|
|
7536
|
-
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."));
|
|
7537
|
-
}
|
|
7538
|
-
|
|
7539
|
-
return Ctor.CustomElementConstructor;
|
|
7540
|
-
}
|
|
7541
|
-
|
|
7542
|
-
function buildCustomElementConstructor(Ctor) {
|
|
7543
|
-
var def = getComponentInternalDef(Ctor);
|
|
7544
|
-
return /*#__PURE__*/function (_def$bridge) {
|
|
7545
|
-
_inherits(_class, _def$bridge);
|
|
7546
|
-
|
|
7547
|
-
var _super8 = _createSuper(_class);
|
|
7548
|
-
|
|
7549
|
-
function _class() {
|
|
7550
|
-
var _this6;
|
|
7551
|
-
|
|
7552
|
-
_classCallCheck(this, _class);
|
|
7553
|
-
|
|
7554
|
-
_this6 = _super8.call(this);
|
|
7555
|
-
createVM(_assertThisInitialized(_this6), def, {
|
|
7556
|
-
mode: 'open',
|
|
7557
|
-
owner: null,
|
|
7558
|
-
tagName: _this6.tagName,
|
|
7559
|
-
renderer: renderer
|
|
7560
|
-
});
|
|
7561
|
-
return _this6;
|
|
7562
|
-
}
|
|
7563
|
-
|
|
7564
|
-
_createClass(_class, [{
|
|
7565
|
-
key: "connectedCallback",
|
|
7566
|
-
value: function connectedCallback() {
|
|
7567
|
-
connectRootElement(this);
|
|
7568
|
-
}
|
|
7569
|
-
}, {
|
|
7570
|
-
key: "disconnectedCallback",
|
|
7571
|
-
value: function disconnectedCallback() {
|
|
7572
|
-
disconnectRootElement(this);
|
|
7573
|
-
}
|
|
7574
|
-
}]);
|
|
7575
|
-
|
|
7576
|
-
return _class;
|
|
7577
|
-
}(def.bridge);
|
|
7578
|
-
}
|
|
7579
7886
|
/*
|
|
7580
7887
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
7581
7888
|
* All rights reserved.
|
|
@@ -7585,7 +7892,6 @@
|
|
|
7585
7892
|
// TODO [#2472]: Remove this workaround when appropriate.
|
|
7586
7893
|
// eslint-disable-next-line lwc-internal/no-global-node
|
|
7587
7894
|
|
|
7588
|
-
|
|
7589
7895
|
var _Node$1 = Node;
|
|
7590
7896
|
var ConnectingSlot = new WeakMap();
|
|
7591
7897
|
var DisconnectingSlot = new WeakMap();
|
|
@@ -7695,6 +8001,142 @@
|
|
|
7695
8001
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7696
8002
|
*/
|
|
7697
8003
|
|
|
8004
|
+
|
|
8005
|
+
function hydrateComponent(element, Ctor) {
|
|
8006
|
+
var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
8007
|
+
|
|
8008
|
+
if (!isFunction$1(Ctor)) {
|
|
8009
|
+
throw new TypeError("\"hydrateComponent\" expects a valid component constructor as the second parameter but instead received ".concat(Ctor, "."));
|
|
8010
|
+
}
|
|
8011
|
+
|
|
8012
|
+
if (!isObject(props) || isNull(props)) {
|
|
8013
|
+
throw new TypeError("\"hydrateComponent\" expects an object as the third parameter but instead received ".concat(props, "."));
|
|
8014
|
+
}
|
|
8015
|
+
|
|
8016
|
+
var def = getComponentInternalDef(Ctor);
|
|
8017
|
+
|
|
8018
|
+
try {
|
|
8019
|
+
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
8020
|
+
// and uses the same algo to create the stylesheets as in SSR.
|
|
8021
|
+
setIsHydrating(true);
|
|
8022
|
+
createVM(element, def, {
|
|
8023
|
+
mode: 'open',
|
|
8024
|
+
owner: null,
|
|
8025
|
+
renderer: renderer,
|
|
8026
|
+
tagName: element.tagName.toLowerCase()
|
|
8027
|
+
});
|
|
8028
|
+
|
|
8029
|
+
for (var _i31 = 0, _Object$entries2 = Object.entries(props); _i31 < _Object$entries2.length; _i31++) {
|
|
8030
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i31], 2),
|
|
8031
|
+
key = _Object$entries2$_i[0],
|
|
8032
|
+
value = _Object$entries2$_i[1];
|
|
8033
|
+
|
|
8034
|
+
element[key] = value;
|
|
8035
|
+
}
|
|
8036
|
+
|
|
8037
|
+
hydrateRootElement(element); // set it back since now we finished hydration.
|
|
8038
|
+
|
|
8039
|
+
setIsHydrating(false);
|
|
8040
|
+
} catch (e) {
|
|
8041
|
+
// Fallback: In case there's an error while hydrating, let's log the error, and replace the element with
|
|
8042
|
+
// the client generated DOM.
|
|
8043
|
+
|
|
8044
|
+
/* eslint-disable-next-line no-console */
|
|
8045
|
+
console.error('Recovering from error while hydrating: ', e);
|
|
8046
|
+
setIsHydrating(false);
|
|
8047
|
+
var newElem = createElement(element.tagName, {
|
|
8048
|
+
is: Ctor,
|
|
8049
|
+
mode: 'open'
|
|
8050
|
+
});
|
|
8051
|
+
|
|
8052
|
+
for (var _i32 = 0, _Object$entries3 = Object.entries(props); _i32 < _Object$entries3.length; _i32++) {
|
|
8053
|
+
var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i32], 2),
|
|
8054
|
+
_key3 = _Object$entries3$_i[0],
|
|
8055
|
+
_value2 = _Object$entries3$_i[1];
|
|
8056
|
+
|
|
8057
|
+
newElem[_key3] = _value2;
|
|
8058
|
+
}
|
|
8059
|
+
|
|
8060
|
+
element.parentNode.replaceChild(newElem, element);
|
|
8061
|
+
}
|
|
8062
|
+
}
|
|
8063
|
+
/*
|
|
8064
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
8065
|
+
* All rights reserved.
|
|
8066
|
+
* SPDX-License-Identifier: MIT
|
|
8067
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8068
|
+
*/
|
|
8069
|
+
|
|
8070
|
+
/**
|
|
8071
|
+
* This function builds a Web Component class from a LWC constructor so it can be
|
|
8072
|
+
* registered as a new element via customElements.define() at any given time.
|
|
8073
|
+
*
|
|
8074
|
+
* @deprecated since version 1.3.11
|
|
8075
|
+
*
|
|
8076
|
+
* @example
|
|
8077
|
+
* ```
|
|
8078
|
+
* import { buildCustomElementConstructor } from 'lwc';
|
|
8079
|
+
* import Foo from 'ns/foo';
|
|
8080
|
+
* const WC = buildCustomElementConstructor(Foo);
|
|
8081
|
+
* customElements.define('x-foo', WC);
|
|
8082
|
+
* const elm = document.createElement('x-foo');
|
|
8083
|
+
* ```
|
|
8084
|
+
*/
|
|
8085
|
+
|
|
8086
|
+
|
|
8087
|
+
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
8088
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
8089
|
+
/* eslint-disable-next-line no-console */
|
|
8090
|
+
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."));
|
|
8091
|
+
}
|
|
8092
|
+
|
|
8093
|
+
return Ctor.CustomElementConstructor;
|
|
8094
|
+
}
|
|
8095
|
+
|
|
8096
|
+
function buildCustomElementConstructor(Ctor) {
|
|
8097
|
+
var def = getComponentInternalDef(Ctor);
|
|
8098
|
+
return /*#__PURE__*/function (_def$bridge) {
|
|
8099
|
+
_inherits(_class, _def$bridge);
|
|
8100
|
+
|
|
8101
|
+
var _super8 = _createSuper(_class);
|
|
8102
|
+
|
|
8103
|
+
function _class() {
|
|
8104
|
+
var _this6;
|
|
8105
|
+
|
|
8106
|
+
_classCallCheck(this, _class);
|
|
8107
|
+
|
|
8108
|
+
_this6 = _super8.call(this);
|
|
8109
|
+
createVM(_assertThisInitialized(_this6), def, {
|
|
8110
|
+
mode: 'open',
|
|
8111
|
+
owner: null,
|
|
8112
|
+
tagName: _this6.tagName,
|
|
8113
|
+
renderer: renderer
|
|
8114
|
+
});
|
|
8115
|
+
return _this6;
|
|
8116
|
+
}
|
|
8117
|
+
|
|
8118
|
+
_createClass(_class, [{
|
|
8119
|
+
key: "connectedCallback",
|
|
8120
|
+
value: function connectedCallback() {
|
|
8121
|
+
connectRootElement(this);
|
|
8122
|
+
}
|
|
8123
|
+
}, {
|
|
8124
|
+
key: "disconnectedCallback",
|
|
8125
|
+
value: function disconnectedCallback() {
|
|
8126
|
+
disconnectRootElement(this);
|
|
8127
|
+
}
|
|
8128
|
+
}]);
|
|
8129
|
+
|
|
8130
|
+
return _class;
|
|
8131
|
+
}(def.bridge);
|
|
8132
|
+
}
|
|
8133
|
+
/*
|
|
8134
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
8135
|
+
* All rights reserved.
|
|
8136
|
+
* SPDX-License-Identifier: MIT
|
|
8137
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8138
|
+
*/
|
|
8139
|
+
|
|
7698
8140
|
/**
|
|
7699
8141
|
* EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
|
|
7700
8142
|
* This API is subject to change or being removed.
|
|
@@ -7793,7 +8235,7 @@
|
|
|
7793
8235
|
});
|
|
7794
8236
|
freeze(LightningElement);
|
|
7795
8237
|
seal(LightningElement.prototype);
|
|
7796
|
-
/* version: 2.5.
|
|
8238
|
+
/* version: 2.5.10 */
|
|
7797
8239
|
|
|
7798
8240
|
exports.LightningElement = LightningElement;
|
|
7799
8241
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
@@ -7803,6 +8245,7 @@
|
|
|
7803
8245
|
exports.createElement = createElement;
|
|
7804
8246
|
exports.getComponentConstructor = getComponentConstructor;
|
|
7805
8247
|
exports.getComponentDef = getComponentDef;
|
|
8248
|
+
exports.hydrateComponent = hydrateComponent;
|
|
7806
8249
|
exports.isComponentConstructor = isComponentConstructor;
|
|
7807
8250
|
exports.isNodeFromTemplate = isNodeFromTemplate;
|
|
7808
8251
|
exports.readonly = readonly;
|
|
@@ -7814,7 +8257,6 @@
|
|
|
7814
8257
|
exports.setFeatureFlag = setFeatureFlag;
|
|
7815
8258
|
exports.setFeatureFlagForTest = setFeatureFlagForTest;
|
|
7816
8259
|
exports.setHooks = setHooks;
|
|
7817
|
-
exports.setHooksForTest = setHooksForTest;
|
|
7818
8260
|
exports.swapComponent = swapComponent;
|
|
7819
8261
|
exports.swapStyle = swapStyle;
|
|
7820
8262
|
exports.swapTemplate = swapTemplate;
|