lwc 2.5.7 → 2.5.8
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 +490 -68
- package/dist/engine-dom/iife/es2017/engine-dom.js +490 -67
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +306 -60
- package/dist/engine-dom/iife/es5/engine-dom.js +566 -129
- package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +363 -113
- package/dist/engine-dom/umd/es2017/engine-dom.js +490 -67
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +306 -60
- package/dist/engine-dom/umd/es5/engine-dom.js +566 -129
- package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +363 -113
- package/dist/engine-server/commonjs/es2017/engine-server.js +361 -11
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
- package/dist/engine-server/esm/es2017/engine-server.js +361 -11
- 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
|
@@ -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,6 +120,7 @@ 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
126
|
ArrayMap$1 = _Array$prototype.map,
|
|
@@ -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.8 */
|
|
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.8 */
|
|
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.
|
|
@@ -3936,12 +3981,12 @@ var LWC = (function (exports) {
|
|
|
3936
3981
|
function flattenStylesheets(stylesheets) {
|
|
3937
3982
|
var list = [];
|
|
3938
3983
|
|
|
3939
|
-
var
|
|
3940
|
-
|
|
3984
|
+
var _iterator2 = _createForOfIteratorHelper(stylesheets),
|
|
3985
|
+
_step2;
|
|
3941
3986
|
|
|
3942
3987
|
try {
|
|
3943
|
-
for (
|
|
3944
|
-
var stylesheet =
|
|
3988
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
3989
|
+
var stylesheet = _step2.value;
|
|
3945
3990
|
|
|
3946
3991
|
if (!Array.isArray(stylesheet)) {
|
|
3947
3992
|
list.push(stylesheet);
|
|
@@ -3950,9 +3995,9 @@ var LWC = (function (exports) {
|
|
|
3950
3995
|
}
|
|
3951
3996
|
}
|
|
3952
3997
|
} catch (err) {
|
|
3953
|
-
|
|
3998
|
+
_iterator2.e(err);
|
|
3954
3999
|
} finally {
|
|
3955
|
-
|
|
4000
|
+
_iterator2.f();
|
|
3956
4001
|
}
|
|
3957
4002
|
|
|
3958
4003
|
return list;
|
|
@@ -4511,6 +4556,17 @@ var LWC = (function (exports) {
|
|
|
4511
4556
|
modComputedStyle.create(vnode);
|
|
4512
4557
|
}
|
|
4513
4558
|
|
|
4559
|
+
function hydrateElmHook(vnode) {
|
|
4560
|
+
modEvents.create(vnode); // Attrs are already on the element.
|
|
4561
|
+
// modAttrs.create(vnode);
|
|
4562
|
+
|
|
4563
|
+
modProps.create(vnode); // Already set.
|
|
4564
|
+
// modStaticClassName.create(vnode);
|
|
4565
|
+
// modStaticStyle.create(vnode);
|
|
4566
|
+
// modComputedClassName.create(vnode);
|
|
4567
|
+
// modComputedStyle.create(vnode);
|
|
4568
|
+
}
|
|
4569
|
+
|
|
4514
4570
|
function fallbackElmHook(elm, vnode) {
|
|
4515
4571
|
var owner = vnode.owner;
|
|
4516
4572
|
setScopeTokenClassIfNecessary(elm, owner);
|
|
@@ -4660,6 +4716,174 @@ var LWC = (function (exports) {
|
|
|
4660
4716
|
}
|
|
4661
4717
|
}
|
|
4662
4718
|
|
|
4719
|
+
function isElementNode(node) {
|
|
4720
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
4721
|
+
return node.nodeType === Node.ELEMENT_NODE;
|
|
4722
|
+
}
|
|
4723
|
+
|
|
4724
|
+
function vnodesAndElementHaveCompatibleAttrs(vnode, elm) {
|
|
4725
|
+
var _vnode$data$attrs = vnode.data.attrs,
|
|
4726
|
+
attrs = _vnode$data$attrs === void 0 ? {} : _vnode$data$attrs,
|
|
4727
|
+
renderer = vnode.owner.renderer;
|
|
4728
|
+
var nodesAreCompatible = true; // Validate attributes, though we could always recovery from those by running the update mods.
|
|
4729
|
+
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
4730
|
+
|
|
4731
|
+
for (var _i14 = 0, _Object$entries = Object.entries(attrs); _i14 < _Object$entries.length; _i14++) {
|
|
4732
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i14], 2),
|
|
4733
|
+
attrName = _Object$entries$_i[0],
|
|
4734
|
+
attrValue = _Object$entries$_i[1];
|
|
4735
|
+
|
|
4736
|
+
var elmAttrValue = renderer.getAttribute(elm, attrName);
|
|
4737
|
+
|
|
4738
|
+
if (attrValue !== elmAttrValue) {
|
|
4739
|
+
logError("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: attribute \"").concat(attrName, "\" has different values, expected \"").concat(attrValue, "\" but found \"").concat(elmAttrValue, "\""), vnode.owner);
|
|
4740
|
+
nodesAreCompatible = false;
|
|
4741
|
+
}
|
|
4742
|
+
}
|
|
4743
|
+
|
|
4744
|
+
return nodesAreCompatible;
|
|
4745
|
+
}
|
|
4746
|
+
|
|
4747
|
+
function vnodesAndElementHaveCompatibleClass(vnode, elm) {
|
|
4748
|
+
var _vnode$data = vnode.data,
|
|
4749
|
+
className = _vnode$data.className,
|
|
4750
|
+
classMap = _vnode$data.classMap,
|
|
4751
|
+
renderer = vnode.owner.renderer;
|
|
4752
|
+
var nodesAreCompatible = true;
|
|
4753
|
+
var vnodeClassName;
|
|
4754
|
+
|
|
4755
|
+
if (!isUndefined$1(className) && className !== elm.className) {
|
|
4756
|
+
// className is used when class is bound to an expr.
|
|
4757
|
+
nodesAreCompatible = false;
|
|
4758
|
+
vnodeClassName = className;
|
|
4759
|
+
} else if (!isUndefined$1(classMap)) {
|
|
4760
|
+
// classMap is used when class is set to static value.
|
|
4761
|
+
var classList = renderer.getClassList(elm);
|
|
4762
|
+
var computedClassName = ''; // all classes from the vnode should be in the element.classList
|
|
4763
|
+
|
|
4764
|
+
for (var name in classMap) {
|
|
4765
|
+
computedClassName += ' ' + name;
|
|
4766
|
+
|
|
4767
|
+
if (!classList.contains(name)) {
|
|
4768
|
+
nodesAreCompatible = false;
|
|
4769
|
+
}
|
|
4770
|
+
}
|
|
4771
|
+
|
|
4772
|
+
vnodeClassName = computedClassName.trim();
|
|
4773
|
+
|
|
4774
|
+
if (classList.length > keys(classMap).length) {
|
|
4775
|
+
nodesAreCompatible = false;
|
|
4776
|
+
}
|
|
4777
|
+
}
|
|
4778
|
+
|
|
4779
|
+
if (!nodesAreCompatible) {
|
|
4780
|
+
logError("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: attribute \"class\" has different values, expected \"").concat(vnodeClassName, "\" but found \"").concat(elm.className, "\""), vnode.owner);
|
|
4781
|
+
}
|
|
4782
|
+
|
|
4783
|
+
return nodesAreCompatible;
|
|
4784
|
+
}
|
|
4785
|
+
|
|
4786
|
+
function vnodesAndElementHaveCompatibleStyle(vnode, elm) {
|
|
4787
|
+
var _vnode$data2 = vnode.data,
|
|
4788
|
+
style = _vnode$data2.style,
|
|
4789
|
+
styleDecls = _vnode$data2.styleDecls,
|
|
4790
|
+
renderer = vnode.owner.renderer;
|
|
4791
|
+
var elmStyle = renderer.getAttribute(elm, 'style') || '';
|
|
4792
|
+
var vnodeStyle;
|
|
4793
|
+
var nodesAreCompatible = true;
|
|
4794
|
+
|
|
4795
|
+
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
4796
|
+
nodesAreCompatible = false;
|
|
4797
|
+
vnodeStyle = style;
|
|
4798
|
+
} else if (!isUndefined$1(styleDecls)) {
|
|
4799
|
+
var parsedVnodeStyle = parseStyleText(elmStyle);
|
|
4800
|
+
var expectedStyle = []; // styleMap is used when style is set to static value.
|
|
4801
|
+
|
|
4802
|
+
for (var _i15 = 0, n = styleDecls.length; _i15 < n; _i15++) {
|
|
4803
|
+
var _styleDecls$_i2 = _slicedToArray(styleDecls[_i15], 3),
|
|
4804
|
+
prop = _styleDecls$_i2[0],
|
|
4805
|
+
value = _styleDecls$_i2[1],
|
|
4806
|
+
important = _styleDecls$_i2[2];
|
|
4807
|
+
|
|
4808
|
+
expectedStyle.push("".concat(prop, ": ").concat(value + (important ? ' important!' : '')));
|
|
4809
|
+
var parsedPropValue = parsedVnodeStyle[prop];
|
|
4810
|
+
|
|
4811
|
+
if (isUndefined$1(parsedPropValue)) {
|
|
4812
|
+
nodesAreCompatible = false;
|
|
4813
|
+
} else if (!parsedPropValue.startsWith(value)) {
|
|
4814
|
+
nodesAreCompatible = false;
|
|
4815
|
+
} else if (important && !parsedPropValue.endsWith('!important')) {
|
|
4816
|
+
nodesAreCompatible = false;
|
|
4817
|
+
}
|
|
4818
|
+
}
|
|
4819
|
+
|
|
4820
|
+
if (keys(parsedVnodeStyle).length > styleDecls.length) {
|
|
4821
|
+
nodesAreCompatible = false;
|
|
4822
|
+
}
|
|
4823
|
+
|
|
4824
|
+
vnodeStyle = ArrayJoin.call(expectedStyle, ';');
|
|
4825
|
+
}
|
|
4826
|
+
|
|
4827
|
+
if (!nodesAreCompatible) {
|
|
4828
|
+
// style is used when class is bound to an expr.
|
|
4829
|
+
logError("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: attribute \"style\" has different values, expected \"").concat(vnodeStyle, "\" but found \"").concat(elmStyle, "\"."), vnode.owner);
|
|
4830
|
+
}
|
|
4831
|
+
|
|
4832
|
+
return nodesAreCompatible;
|
|
4833
|
+
}
|
|
4834
|
+
|
|
4835
|
+
function throwHydrationError() {
|
|
4836
|
+
assert.fail('Server rendered elements do not match client side generated elements');
|
|
4837
|
+
}
|
|
4838
|
+
|
|
4839
|
+
function hydrateChildrenHook(elmChildren, children, vm) {
|
|
4840
|
+
var _a, _b;
|
|
4841
|
+
|
|
4842
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4843
|
+
var filteredVNodes = ArrayFilter.call(children, function (vnode) {
|
|
4844
|
+
return !!vnode;
|
|
4845
|
+
});
|
|
4846
|
+
|
|
4847
|
+
if (elmChildren.length !== filteredVNodes.length) {
|
|
4848
|
+
logError("Hydration mismatch: incorrect number of rendered nodes, expected ".concat(filteredVNodes.length, " but found ").concat(elmChildren.length, "."), vm);
|
|
4849
|
+
throwHydrationError();
|
|
4850
|
+
}
|
|
4851
|
+
}
|
|
4852
|
+
|
|
4853
|
+
var elmCurrentChildIdx = 0;
|
|
4854
|
+
|
|
4855
|
+
for (var j = 0, n = children.length; j < n; j++) {
|
|
4856
|
+
var ch = children[j];
|
|
4857
|
+
|
|
4858
|
+
if (ch != null) {
|
|
4859
|
+
var childNode = elmChildren[elmCurrentChildIdx];
|
|
4860
|
+
|
|
4861
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4862
|
+
// VComments and VTexts validation is handled in their hooks
|
|
4863
|
+
if (isElementNode(childNode)) {
|
|
4864
|
+
if (((_a = ch.sel) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== childNode.tagName.toLowerCase()) {
|
|
4865
|
+
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);
|
|
4866
|
+
throwHydrationError();
|
|
4867
|
+
} // Note: props are not yet set
|
|
4868
|
+
|
|
4869
|
+
|
|
4870
|
+
var hasIncompatibleAttrs = vnodesAndElementHaveCompatibleAttrs(ch, childNode);
|
|
4871
|
+
var hasIncompatibleClass = vnodesAndElementHaveCompatibleClass(ch, childNode);
|
|
4872
|
+
var hasIncompatibleStyle = vnodesAndElementHaveCompatibleStyle(ch, childNode);
|
|
4873
|
+
var isVNodeAndElementCompatible = hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
4874
|
+
|
|
4875
|
+
if (!isVNodeAndElementCompatible) {
|
|
4876
|
+
throwHydrationError();
|
|
4877
|
+
}
|
|
4878
|
+
}
|
|
4879
|
+
}
|
|
4880
|
+
|
|
4881
|
+
ch.hook.hydrate(ch, childNode);
|
|
4882
|
+
elmCurrentChildIdx++;
|
|
4883
|
+
}
|
|
4884
|
+
}
|
|
4885
|
+
}
|
|
4886
|
+
|
|
4663
4887
|
function updateCustomElmHook(oldVnode, vnode) {
|
|
4664
4888
|
// Attrs need to be applied to element before props
|
|
4665
4889
|
// IE11 will wipe out value on radio inputs if value
|
|
@@ -4767,7 +4991,26 @@ var LWC = (function (exports) {
|
|
|
4767
4991
|
update: updateNodeHook,
|
|
4768
4992
|
insert: insertNodeHook,
|
|
4769
4993
|
move: insertNodeHook,
|
|
4770
|
-
remove: removeNodeHook
|
|
4994
|
+
remove: removeNodeHook,
|
|
4995
|
+
hydrate: function hydrate(vNode, node) {
|
|
4996
|
+
var _a;
|
|
4997
|
+
|
|
4998
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4999
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
5000
|
+
if (node.nodeType !== Node.TEXT_NODE) {
|
|
5001
|
+
logError('Hydration mismatch: incorrect node type received', vNode.owner);
|
|
5002
|
+
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
5003
|
+
}
|
|
5004
|
+
|
|
5005
|
+
if (node.nodeValue !== vNode.text) {
|
|
5006
|
+
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vNode.owner);
|
|
5007
|
+
}
|
|
5008
|
+
} // always set the text value to the one from the vnode.
|
|
5009
|
+
|
|
5010
|
+
|
|
5011
|
+
node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
|
|
5012
|
+
vNode.elm = node;
|
|
5013
|
+
}
|
|
4771
5014
|
};
|
|
4772
5015
|
var CommentHook = {
|
|
4773
5016
|
create: function create(vnode) {
|
|
@@ -4781,7 +5024,26 @@ var LWC = (function (exports) {
|
|
|
4781
5024
|
update: updateNodeHook,
|
|
4782
5025
|
insert: insertNodeHook,
|
|
4783
5026
|
move: insertNodeHook,
|
|
4784
|
-
remove: removeNodeHook
|
|
5027
|
+
remove: removeNodeHook,
|
|
5028
|
+
hydrate: function hydrate(vNode, node) {
|
|
5029
|
+
var _a;
|
|
5030
|
+
|
|
5031
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5032
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
5033
|
+
if (node.nodeType !== Node.COMMENT_NODE) {
|
|
5034
|
+
logError('Hydration mismatch: incorrect node type received', vNode.owner);
|
|
5035
|
+
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
5036
|
+
}
|
|
5037
|
+
|
|
5038
|
+
if (node.nodeValue !== vNode.text) {
|
|
5039
|
+
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vNode.owner);
|
|
5040
|
+
}
|
|
5041
|
+
} // always set the text value to the one from the vnode.
|
|
5042
|
+
|
|
5043
|
+
|
|
5044
|
+
node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
|
|
5045
|
+
vNode.elm = node;
|
|
5046
|
+
}
|
|
4785
5047
|
}; // insert is called after update, which is used somewhere else (via a module)
|
|
4786
5048
|
// to mark the vm as inserted, that means we cannot use update as the main channel
|
|
4787
5049
|
// to rehydrate when dirty, because sometimes the element is not inserted just yet,
|
|
@@ -4815,6 +5077,34 @@ var LWC = (function (exports) {
|
|
|
4815
5077
|
remove: function remove(vnode, parentNode) {
|
|
4816
5078
|
removeNodeHook(vnode, parentNode);
|
|
4817
5079
|
removeElmHook(vnode);
|
|
5080
|
+
},
|
|
5081
|
+
hydrate: function hydrate(vnode, node) {
|
|
5082
|
+
var elm = node;
|
|
5083
|
+
vnode.elm = elm;
|
|
5084
|
+
var context = vnode.data.context;
|
|
5085
|
+
var isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
|
|
5086
|
+
/* manual */
|
|
5087
|
+
);
|
|
5088
|
+
|
|
5089
|
+
if (isDomManual) {
|
|
5090
|
+
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
5091
|
+
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
5092
|
+
var props = vnode.data.props;
|
|
5093
|
+
|
|
5094
|
+
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
5095
|
+
if (elm.innerHTML === props.innerHTML) {
|
|
5096
|
+
delete props.innerHTML;
|
|
5097
|
+
} else {
|
|
5098
|
+
logWarn("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: innerHTML values do not match for element, will recover from the difference"), vnode.owner);
|
|
5099
|
+
}
|
|
5100
|
+
}
|
|
5101
|
+
}
|
|
5102
|
+
|
|
5103
|
+
hydrateElmHook(vnode);
|
|
5104
|
+
|
|
5105
|
+
if (!isDomManual) {
|
|
5106
|
+
hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vnode.owner);
|
|
5107
|
+
}
|
|
4818
5108
|
}
|
|
4819
5109
|
};
|
|
4820
5110
|
var CustomElementHook = {
|
|
@@ -4902,6 +5192,42 @@ var LWC = (function (exports) {
|
|
|
4902
5192
|
// will take care of disconnecting any child VM attached to its shadow as well.
|
|
4903
5193
|
removeVM(vm);
|
|
4904
5194
|
}
|
|
5195
|
+
},
|
|
5196
|
+
hydrate: function hydrate(vnode, elm) {
|
|
5197
|
+
// the element is created, but the vm is not
|
|
5198
|
+
var sel = vnode.sel,
|
|
5199
|
+
mode = vnode.mode,
|
|
5200
|
+
ctor = vnode.ctor,
|
|
5201
|
+
owner = vnode.owner;
|
|
5202
|
+
var def = getComponentInternalDef(ctor);
|
|
5203
|
+
createVM(elm, def, {
|
|
5204
|
+
mode: mode,
|
|
5205
|
+
owner: owner,
|
|
5206
|
+
tagName: sel,
|
|
5207
|
+
renderer: owner.renderer
|
|
5208
|
+
});
|
|
5209
|
+
vnode.elm = elm;
|
|
5210
|
+
var vm = getAssociatedVM(elm);
|
|
5211
|
+
allocateChildrenHook(vnode, vm);
|
|
5212
|
+
hydrateElmHook(vnode); // Insert hook section:
|
|
5213
|
+
|
|
5214
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5215
|
+
assert.isTrue(vm.state === 0
|
|
5216
|
+
/* created */
|
|
5217
|
+
, "".concat(vm, " cannot be recycled."));
|
|
5218
|
+
}
|
|
5219
|
+
|
|
5220
|
+
runConnectedCallback(vm);
|
|
5221
|
+
|
|
5222
|
+
if (vm.renderMode !== 0
|
|
5223
|
+
/* Light */
|
|
5224
|
+
) {
|
|
5225
|
+
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
5226
|
+
// Note: for Light DOM, this is handled while hydrating the VM
|
|
5227
|
+
hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vm);
|
|
5228
|
+
}
|
|
5229
|
+
|
|
5230
|
+
hydrateVM(vm);
|
|
4905
5231
|
}
|
|
4906
5232
|
};
|
|
4907
5233
|
|
|
@@ -5486,8 +5812,8 @@ var LWC = (function (exports) {
|
|
|
5486
5812
|
function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
5487
5813
|
var content = [];
|
|
5488
5814
|
|
|
5489
|
-
for (var
|
|
5490
|
-
var stylesheet = stylesheets[
|
|
5815
|
+
for (var _i16 = 0; _i16 < stylesheets.length; _i16++) {
|
|
5816
|
+
var stylesheet = stylesheets[_i16];
|
|
5491
5817
|
|
|
5492
5818
|
if (isArray$1(stylesheet)) {
|
|
5493
5819
|
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
|
|
@@ -5563,10 +5889,13 @@ var LWC = (function (exports) {
|
|
|
5563
5889
|
&& shadowMode === 1
|
|
5564
5890
|
/* Synthetic */
|
|
5565
5891
|
) {
|
|
5566
|
-
for (var
|
|
5567
|
-
renderer.insertGlobalStylesheet(stylesheets[
|
|
5892
|
+
for (var _i17 = 0; _i17 < stylesheets.length; _i17++) {
|
|
5893
|
+
renderer.insertGlobalStylesheet(stylesheets[_i17]);
|
|
5568
5894
|
}
|
|
5569
|
-
} else if (renderer.ssr) {
|
|
5895
|
+
} else if (renderer.ssr || renderer.isHydrating) {
|
|
5896
|
+
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
5897
|
+
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
5898
|
+
// the first time the VM renders.
|
|
5570
5899
|
// native shadow or light DOM, SSR
|
|
5571
5900
|
var combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
|
|
5572
5901
|
return createInlineStyleVNode(combinedStylesheetContent);
|
|
@@ -5575,12 +5904,12 @@ var LWC = (function (exports) {
|
|
|
5575
5904
|
var root = getNearestNativeShadowComponent(vm);
|
|
5576
5905
|
var isGlobal = isNull(root);
|
|
5577
5906
|
|
|
5578
|
-
for (var
|
|
5907
|
+
for (var _i18 = 0; _i18 < stylesheets.length; _i18++) {
|
|
5579
5908
|
if (isGlobal) {
|
|
5580
|
-
renderer.insertGlobalStylesheet(stylesheets[
|
|
5909
|
+
renderer.insertGlobalStylesheet(stylesheets[_i18]);
|
|
5581
5910
|
} else {
|
|
5582
5911
|
// local level
|
|
5583
|
-
renderer.insertStylesheet(stylesheets[
|
|
5912
|
+
renderer.insertStylesheet(stylesheets[_i18], root.cmpRoot);
|
|
5584
5913
|
}
|
|
5585
5914
|
}
|
|
5586
5915
|
}
|
|
@@ -5857,8 +6186,8 @@ var LWC = (function (exports) {
|
|
|
5857
6186
|
var stylesheets = template.stylesheets;
|
|
5858
6187
|
|
|
5859
6188
|
if (!isUndefined$1(stylesheets)) {
|
|
5860
|
-
for (var
|
|
5861
|
-
if (isTrue(stylesheets[
|
|
6189
|
+
for (var _i19 = 0; _i19 < stylesheets.length; _i19++) {
|
|
6190
|
+
if (isTrue(stylesheets[_i19][KEY__SCOPED_CSS])) {
|
|
5862
6191
|
return true;
|
|
5863
6192
|
}
|
|
5864
6193
|
}
|
|
@@ -6088,8 +6417,8 @@ var LWC = (function (exports) {
|
|
|
6088
6417
|
assert.isTrue(isObject(service), "Invalid service declaration, ".concat(service, ": service must be an object"));
|
|
6089
6418
|
}
|
|
6090
6419
|
|
|
6091
|
-
for (var
|
|
6092
|
-
var hookName = hooks[
|
|
6420
|
+
for (var _i20 = 0; _i20 < hooks.length; ++_i20) {
|
|
6421
|
+
var hookName = hooks[_i20];
|
|
6093
6422
|
|
|
6094
6423
|
if (hookName in service) {
|
|
6095
6424
|
var l = Services[hookName];
|
|
@@ -6112,8 +6441,8 @@ var LWC = (function (exports) {
|
|
|
6112
6441
|
def = vm.def,
|
|
6113
6442
|
context = vm.context;
|
|
6114
6443
|
|
|
6115
|
-
for (var
|
|
6116
|
-
cbs[
|
|
6444
|
+
for (var _i21 = 0, _len6 = cbs.length; _i21 < _len6; ++_i21) {
|
|
6445
|
+
cbs[_i21].call(undefined, component, {}, def, context);
|
|
6117
6446
|
}
|
|
6118
6447
|
}
|
|
6119
6448
|
/*
|
|
@@ -6166,6 +6495,12 @@ var LWC = (function (exports) {
|
|
|
6166
6495
|
, vm);
|
|
6167
6496
|
}
|
|
6168
6497
|
|
|
6498
|
+
function hydrateRootElement(elm) {
|
|
6499
|
+
var vm = getAssociatedVM(elm);
|
|
6500
|
+
runConnectedCallback(vm);
|
|
6501
|
+
hydrateVM(vm);
|
|
6502
|
+
}
|
|
6503
|
+
|
|
6169
6504
|
function disconnectRootElement(elm) {
|
|
6170
6505
|
var vm = getAssociatedVM(elm);
|
|
6171
6506
|
resetComponentStateWhenRemoved(vm);
|
|
@@ -6173,6 +6508,10 @@ var LWC = (function (exports) {
|
|
|
6173
6508
|
|
|
6174
6509
|
function appendVM(vm) {
|
|
6175
6510
|
rehydrate(vm);
|
|
6511
|
+
}
|
|
6512
|
+
|
|
6513
|
+
function hydrateVM(vm) {
|
|
6514
|
+
hydrate(vm);
|
|
6176
6515
|
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
6177
6516
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
6178
6517
|
|
|
@@ -6396,6 +6735,22 @@ var LWC = (function (exports) {
|
|
|
6396
6735
|
}
|
|
6397
6736
|
}
|
|
6398
6737
|
|
|
6738
|
+
function hydrate(vm) {
|
|
6739
|
+
if (isTrue(vm.isDirty)) {
|
|
6740
|
+
// manually diffing/patching here.
|
|
6741
|
+
// This routine is:
|
|
6742
|
+
// patchShadowRoot(vm, children);
|
|
6743
|
+
// -> addVnodes.
|
|
6744
|
+
var children = renderComponent(vm);
|
|
6745
|
+
vm.children = children;
|
|
6746
|
+
var vmChildren = vm.renderMode === 0
|
|
6747
|
+
/* Light */
|
|
6748
|
+
? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;
|
|
6749
|
+
hydrateChildrenHook(vmChildren, children, vm);
|
|
6750
|
+
runRenderedCallback(vm);
|
|
6751
|
+
}
|
|
6752
|
+
}
|
|
6753
|
+
|
|
6399
6754
|
function patchShadowRoot(vm, newCh) {
|
|
6400
6755
|
var oldCh = vm.children; // caching the new children collection
|
|
6401
6756
|
|
|
@@ -6476,19 +6831,19 @@ var LWC = (function (exports) {
|
|
|
6476
6831
|
});
|
|
6477
6832
|
rehydrateQueue = []; // reset to a new queue
|
|
6478
6833
|
|
|
6479
|
-
for (var
|
|
6480
|
-
var vm = vms[
|
|
6834
|
+
for (var _i22 = 0, _len7 = vms.length; _i22 < _len7; _i22 += 1) {
|
|
6835
|
+
var vm = vms[_i22];
|
|
6481
6836
|
|
|
6482
6837
|
try {
|
|
6483
6838
|
rehydrate(vm);
|
|
6484
6839
|
} catch (error) {
|
|
6485
|
-
if (
|
|
6840
|
+
if (_i22 + 1 < _len7) {
|
|
6486
6841
|
// pieces of the queue are still pending to be rehydrated, those should have priority
|
|
6487
6842
|
if (rehydrateQueue.length === 0) {
|
|
6488
6843
|
addCallbackToNextTick(flushRehydrationQueue);
|
|
6489
6844
|
}
|
|
6490
6845
|
|
|
6491
|
-
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms,
|
|
6846
|
+
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i22 + 1));
|
|
6492
6847
|
} // we need to end the measure before throwing.
|
|
6493
6848
|
|
|
6494
6849
|
|
|
@@ -6592,8 +6947,8 @@ var LWC = (function (exports) {
|
|
|
6592
6947
|
var vCustomElementCollection = vm.velements; // Reporting disconnection for every child in inverse order since they are
|
|
6593
6948
|
// inserted in reserved order.
|
|
6594
6949
|
|
|
6595
|
-
for (var
|
|
6596
|
-
var elm = vCustomElementCollection[
|
|
6950
|
+
for (var _i23 = vCustomElementCollection.length - 1; _i23 >= 0; _i23 -= 1) {
|
|
6951
|
+
var elm = vCustomElementCollection[_i23].elm; // There are two cases where the element could be undefined:
|
|
6597
6952
|
// * when there is an error during the construction phase, and an error
|
|
6598
6953
|
// boundary picks it, there is a possibility that the VCustomElement
|
|
6599
6954
|
// is not properly initialized, and therefore is should be ignored.
|
|
@@ -6627,8 +6982,8 @@ var LWC = (function (exports) {
|
|
|
6627
6982
|
|
|
6628
6983
|
|
|
6629
6984
|
function recursivelyDisconnectChildren(vnodes) {
|
|
6630
|
-
for (var
|
|
6631
|
-
var vnode = vnodes[
|
|
6985
|
+
for (var _i24 = 0, _len8 = vnodes.length; _i24 < _len8; _i24 += 1) {
|
|
6986
|
+
var vnode = vnodes[_i24];
|
|
6632
6987
|
|
|
6633
6988
|
if (!isNull(vnode) && isArray$1(vnode.children) && !isUndefined$1(vnode.elm)) {
|
|
6634
6989
|
// vnode is a VElement with children
|
|
@@ -6652,8 +7007,8 @@ var LWC = (function (exports) {
|
|
|
6652
7007
|
renderer = vm.renderer;
|
|
6653
7008
|
var rootNode = getRenderRoot(vm);
|
|
6654
7009
|
|
|
6655
|
-
for (var
|
|
6656
|
-
var child = children[
|
|
7010
|
+
for (var _i25 = 0, _len9 = children.length; _i25 < _len9; _i25++) {
|
|
7011
|
+
var child = children[_i25];
|
|
6657
7012
|
|
|
6658
7013
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
6659
7014
|
renderer.remove(child.elm, rootNode);
|
|
@@ -6698,8 +7053,8 @@ var LWC = (function (exports) {
|
|
|
6698
7053
|
var oldSlots = vm.cmpSlots;
|
|
6699
7054
|
var cmpSlots = vm.cmpSlots = create(null);
|
|
6700
7055
|
|
|
6701
|
-
for (var
|
|
6702
|
-
var vnode = children[
|
|
7056
|
+
for (var _i26 = 0, _len10 = children.length; _i26 < _len10; _i26 += 1) {
|
|
7057
|
+
var vnode = children[_i26];
|
|
6703
7058
|
|
|
6704
7059
|
if (isNull(vnode)) {
|
|
6705
7060
|
continue;
|
|
@@ -6729,8 +7084,8 @@ var LWC = (function (exports) {
|
|
|
6729
7084
|
return;
|
|
6730
7085
|
}
|
|
6731
7086
|
|
|
6732
|
-
for (var
|
|
6733
|
-
var key = oldKeys[
|
|
7087
|
+
for (var _i27 = 0, _len11 = oldKeys.length; _i27 < _len11; _i27 += 1) {
|
|
7088
|
+
var key = oldKeys[_i27];
|
|
6734
7089
|
|
|
6735
7090
|
if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
|
|
6736
7091
|
markComponentAsDirty(vm);
|
|
@@ -7093,8 +7448,8 @@ var LWC = (function (exports) {
|
|
|
7093
7448
|
function connectWireAdapters(vm) {
|
|
7094
7449
|
var wiredConnecting = vm.context.wiredConnecting;
|
|
7095
7450
|
|
|
7096
|
-
for (var
|
|
7097
|
-
wiredConnecting[
|
|
7451
|
+
for (var _i28 = 0, _len12 = wiredConnecting.length; _i28 < _len12; _i28 += 1) {
|
|
7452
|
+
wiredConnecting[_i28]();
|
|
7098
7453
|
}
|
|
7099
7454
|
}
|
|
7100
7455
|
|
|
@@ -7102,8 +7457,8 @@ var LWC = (function (exports) {
|
|
|
7102
7457
|
var wiredDisconnecting = vm.context.wiredDisconnecting;
|
|
7103
7458
|
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
7104
7459
|
// job
|
|
7105
|
-
for (var
|
|
7106
|
-
wiredDisconnecting[
|
|
7460
|
+
for (var _i29 = 0, _len13 = wiredDisconnecting.length; _i29 < _len13; _i29 += 1) {
|
|
7461
|
+
wiredDisconnecting[_i29]();
|
|
7107
7462
|
}
|
|
7108
7463
|
}, noop);
|
|
7109
7464
|
}
|
|
@@ -7193,7 +7548,7 @@ var LWC = (function (exports) {
|
|
|
7193
7548
|
hooksAreSet = true;
|
|
7194
7549
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
7195
7550
|
}
|
|
7196
|
-
/* version: 2.5.
|
|
7551
|
+
/* version: 2.5.8 */
|
|
7197
7552
|
|
|
7198
7553
|
/*
|
|
7199
7554
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7208,8 +7563,8 @@ var LWC = (function (exports) {
|
|
|
7208
7563
|
if (process.env.NODE_ENV === 'development') {
|
|
7209
7564
|
// @ts-ignore
|
|
7210
7565
|
window.__lwcResetGlobalStylesheets = function () {
|
|
7211
|
-
for (var
|
|
7212
|
-
var key = _Object$keys[
|
|
7566
|
+
for (var _i30 = 0, _Object$keys = Object.keys(globalStylesheets); _i30 < _Object$keys.length; _i30++) {
|
|
7567
|
+
var key = _Object$keys[_i30];
|
|
7213
7568
|
delete globalStylesheets[key];
|
|
7214
7569
|
}
|
|
7215
7570
|
};
|
|
@@ -7348,8 +7703,19 @@ var LWC = (function (exports) {
|
|
|
7348
7703
|
HTMLElementConstructor.prototype = HTMLElement.prototype;
|
|
7349
7704
|
}
|
|
7350
7705
|
|
|
7706
|
+
var isHydrating = false;
|
|
7707
|
+
|
|
7708
|
+
function setIsHydrating(v) {
|
|
7709
|
+
isHydrating = v;
|
|
7710
|
+
}
|
|
7711
|
+
|
|
7351
7712
|
var renderer = {
|
|
7352
7713
|
ssr: false,
|
|
7714
|
+
|
|
7715
|
+
get isHydrating() {
|
|
7716
|
+
return isHydrating;
|
|
7717
|
+
},
|
|
7718
|
+
|
|
7353
7719
|
isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
|
|
7354
7720
|
isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
|
|
7355
7721
|
createElement: function createElement(tagName, namespace) {
|
|
@@ -7371,6 +7737,10 @@ var LWC = (function (exports) {
|
|
|
7371
7737
|
return node.nextSibling;
|
|
7372
7738
|
},
|
|
7373
7739
|
attachShadow: function attachShadow(element, options) {
|
|
7740
|
+
if (isHydrating) {
|
|
7741
|
+
return element.shadowRoot;
|
|
7742
|
+
}
|
|
7743
|
+
|
|
7374
7744
|
return element.attachShadow(options);
|
|
7375
7745
|
},
|
|
7376
7746
|
setText: function setText(node, content) {
|
|
@@ -7481,75 +7851,6 @@ var LWC = (function (exports) {
|
|
|
7481
7851
|
getCustomElement: getCustomElement,
|
|
7482
7852
|
HTMLElement: HTMLElementConstructor
|
|
7483
7853
|
};
|
|
7484
|
-
/*
|
|
7485
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
7486
|
-
* All rights reserved.
|
|
7487
|
-
* SPDX-License-Identifier: MIT
|
|
7488
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7489
|
-
*/
|
|
7490
|
-
|
|
7491
|
-
/**
|
|
7492
|
-
* This function builds a Web Component class from a LWC constructor so it can be
|
|
7493
|
-
* registered as a new element via customElements.define() at any given time.
|
|
7494
|
-
*
|
|
7495
|
-
* @deprecated since version 1.3.11
|
|
7496
|
-
*
|
|
7497
|
-
* @example
|
|
7498
|
-
* ```
|
|
7499
|
-
* import { buildCustomElementConstructor } from 'lwc';
|
|
7500
|
-
* import Foo from 'ns/foo';
|
|
7501
|
-
* const WC = buildCustomElementConstructor(Foo);
|
|
7502
|
-
* customElements.define('x-foo', WC);
|
|
7503
|
-
* const elm = document.createElement('x-foo');
|
|
7504
|
-
* ```
|
|
7505
|
-
*/
|
|
7506
|
-
|
|
7507
|
-
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
7508
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
7509
|
-
/* eslint-disable-next-line no-console */
|
|
7510
|
-
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."));
|
|
7511
|
-
}
|
|
7512
|
-
|
|
7513
|
-
return Ctor.CustomElementConstructor;
|
|
7514
|
-
}
|
|
7515
|
-
|
|
7516
|
-
function buildCustomElementConstructor(Ctor) {
|
|
7517
|
-
var def = getComponentInternalDef(Ctor);
|
|
7518
|
-
return /*#__PURE__*/function (_def$bridge) {
|
|
7519
|
-
_inherits(_class, _def$bridge);
|
|
7520
|
-
|
|
7521
|
-
var _super8 = _createSuper(_class);
|
|
7522
|
-
|
|
7523
|
-
function _class() {
|
|
7524
|
-
var _this6;
|
|
7525
|
-
|
|
7526
|
-
_classCallCheck(this, _class);
|
|
7527
|
-
|
|
7528
|
-
_this6 = _super8.call(this);
|
|
7529
|
-
createVM(_assertThisInitialized(_this6), def, {
|
|
7530
|
-
mode: 'open',
|
|
7531
|
-
owner: null,
|
|
7532
|
-
tagName: _this6.tagName,
|
|
7533
|
-
renderer: renderer
|
|
7534
|
-
});
|
|
7535
|
-
return _this6;
|
|
7536
|
-
}
|
|
7537
|
-
|
|
7538
|
-
_createClass(_class, [{
|
|
7539
|
-
key: "connectedCallback",
|
|
7540
|
-
value: function connectedCallback() {
|
|
7541
|
-
connectRootElement(this);
|
|
7542
|
-
}
|
|
7543
|
-
}, {
|
|
7544
|
-
key: "disconnectedCallback",
|
|
7545
|
-
value: function disconnectedCallback() {
|
|
7546
|
-
disconnectRootElement(this);
|
|
7547
|
-
}
|
|
7548
|
-
}]);
|
|
7549
|
-
|
|
7550
|
-
return _class;
|
|
7551
|
-
}(def.bridge);
|
|
7552
|
-
}
|
|
7553
7854
|
/*
|
|
7554
7855
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
7555
7856
|
* All rights reserved.
|
|
@@ -7559,7 +7860,6 @@ var LWC = (function (exports) {
|
|
|
7559
7860
|
// TODO [#2472]: Remove this workaround when appropriate.
|
|
7560
7861
|
// eslint-disable-next-line lwc-internal/no-global-node
|
|
7561
7862
|
|
|
7562
|
-
|
|
7563
7863
|
var _Node$1 = Node;
|
|
7564
7864
|
var ConnectingSlot = new WeakMap();
|
|
7565
7865
|
var DisconnectingSlot = new WeakMap();
|
|
@@ -7669,6 +7969,142 @@ var LWC = (function (exports) {
|
|
|
7669
7969
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7670
7970
|
*/
|
|
7671
7971
|
|
|
7972
|
+
|
|
7973
|
+
function hydrateComponent(element, Ctor) {
|
|
7974
|
+
var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
7975
|
+
|
|
7976
|
+
if (!isFunction$1(Ctor)) {
|
|
7977
|
+
throw new TypeError("\"hydrateComponent\" expects a valid component constructor as the second parameter but instead received ".concat(Ctor, "."));
|
|
7978
|
+
}
|
|
7979
|
+
|
|
7980
|
+
if (!isObject(props) || isNull(props)) {
|
|
7981
|
+
throw new TypeError("\"hydrateComponent\" expects an object as the third parameter but instead received ".concat(props, "."));
|
|
7982
|
+
}
|
|
7983
|
+
|
|
7984
|
+
var def = getComponentInternalDef(Ctor);
|
|
7985
|
+
|
|
7986
|
+
try {
|
|
7987
|
+
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
7988
|
+
// and uses the same algo to create the stylesheets as in SSR.
|
|
7989
|
+
setIsHydrating(true);
|
|
7990
|
+
createVM(element, def, {
|
|
7991
|
+
mode: 'open',
|
|
7992
|
+
owner: null,
|
|
7993
|
+
renderer: renderer,
|
|
7994
|
+
tagName: element.tagName.toLowerCase()
|
|
7995
|
+
});
|
|
7996
|
+
|
|
7997
|
+
for (var _i31 = 0, _Object$entries2 = Object.entries(props); _i31 < _Object$entries2.length; _i31++) {
|
|
7998
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i31], 2),
|
|
7999
|
+
key = _Object$entries2$_i[0],
|
|
8000
|
+
value = _Object$entries2$_i[1];
|
|
8001
|
+
|
|
8002
|
+
element[key] = value;
|
|
8003
|
+
}
|
|
8004
|
+
|
|
8005
|
+
hydrateRootElement(element); // set it back since now we finished hydration.
|
|
8006
|
+
|
|
8007
|
+
setIsHydrating(false);
|
|
8008
|
+
} catch (e) {
|
|
8009
|
+
// Fallback: In case there's an error while hydrating, let's log the error, and replace the element with
|
|
8010
|
+
// the client generated DOM.
|
|
8011
|
+
|
|
8012
|
+
/* eslint-disable-next-line no-console */
|
|
8013
|
+
console.error('Recovering from error while hydrating: ', e);
|
|
8014
|
+
setIsHydrating(false);
|
|
8015
|
+
var newElem = createElement(element.tagName, {
|
|
8016
|
+
is: Ctor,
|
|
8017
|
+
mode: 'open'
|
|
8018
|
+
});
|
|
8019
|
+
|
|
8020
|
+
for (var _i32 = 0, _Object$entries3 = Object.entries(props); _i32 < _Object$entries3.length; _i32++) {
|
|
8021
|
+
var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i32], 2),
|
|
8022
|
+
_key3 = _Object$entries3$_i[0],
|
|
8023
|
+
_value2 = _Object$entries3$_i[1];
|
|
8024
|
+
|
|
8025
|
+
newElem[_key3] = _value2;
|
|
8026
|
+
}
|
|
8027
|
+
|
|
8028
|
+
element.parentNode.replaceChild(newElem, element);
|
|
8029
|
+
}
|
|
8030
|
+
}
|
|
8031
|
+
/*
|
|
8032
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
8033
|
+
* All rights reserved.
|
|
8034
|
+
* SPDX-License-Identifier: MIT
|
|
8035
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8036
|
+
*/
|
|
8037
|
+
|
|
8038
|
+
/**
|
|
8039
|
+
* This function builds a Web Component class from a LWC constructor so it can be
|
|
8040
|
+
* registered as a new element via customElements.define() at any given time.
|
|
8041
|
+
*
|
|
8042
|
+
* @deprecated since version 1.3.11
|
|
8043
|
+
*
|
|
8044
|
+
* @example
|
|
8045
|
+
* ```
|
|
8046
|
+
* import { buildCustomElementConstructor } from 'lwc';
|
|
8047
|
+
* import Foo from 'ns/foo';
|
|
8048
|
+
* const WC = buildCustomElementConstructor(Foo);
|
|
8049
|
+
* customElements.define('x-foo', WC);
|
|
8050
|
+
* const elm = document.createElement('x-foo');
|
|
8051
|
+
* ```
|
|
8052
|
+
*/
|
|
8053
|
+
|
|
8054
|
+
|
|
8055
|
+
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
8056
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
8057
|
+
/* eslint-disable-next-line no-console */
|
|
8058
|
+
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."));
|
|
8059
|
+
}
|
|
8060
|
+
|
|
8061
|
+
return Ctor.CustomElementConstructor;
|
|
8062
|
+
}
|
|
8063
|
+
|
|
8064
|
+
function buildCustomElementConstructor(Ctor) {
|
|
8065
|
+
var def = getComponentInternalDef(Ctor);
|
|
8066
|
+
return /*#__PURE__*/function (_def$bridge) {
|
|
8067
|
+
_inherits(_class, _def$bridge);
|
|
8068
|
+
|
|
8069
|
+
var _super8 = _createSuper(_class);
|
|
8070
|
+
|
|
8071
|
+
function _class() {
|
|
8072
|
+
var _this6;
|
|
8073
|
+
|
|
8074
|
+
_classCallCheck(this, _class);
|
|
8075
|
+
|
|
8076
|
+
_this6 = _super8.call(this);
|
|
8077
|
+
createVM(_assertThisInitialized(_this6), def, {
|
|
8078
|
+
mode: 'open',
|
|
8079
|
+
owner: null,
|
|
8080
|
+
tagName: _this6.tagName,
|
|
8081
|
+
renderer: renderer
|
|
8082
|
+
});
|
|
8083
|
+
return _this6;
|
|
8084
|
+
}
|
|
8085
|
+
|
|
8086
|
+
_createClass(_class, [{
|
|
8087
|
+
key: "connectedCallback",
|
|
8088
|
+
value: function connectedCallback() {
|
|
8089
|
+
connectRootElement(this);
|
|
8090
|
+
}
|
|
8091
|
+
}, {
|
|
8092
|
+
key: "disconnectedCallback",
|
|
8093
|
+
value: function disconnectedCallback() {
|
|
8094
|
+
disconnectRootElement(this);
|
|
8095
|
+
}
|
|
8096
|
+
}]);
|
|
8097
|
+
|
|
8098
|
+
return _class;
|
|
8099
|
+
}(def.bridge);
|
|
8100
|
+
}
|
|
8101
|
+
/*
|
|
8102
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
8103
|
+
* All rights reserved.
|
|
8104
|
+
* SPDX-License-Identifier: MIT
|
|
8105
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8106
|
+
*/
|
|
8107
|
+
|
|
7672
8108
|
/**
|
|
7673
8109
|
* EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
|
|
7674
8110
|
* This API is subject to change or being removed.
|
|
@@ -7767,7 +8203,7 @@ var LWC = (function (exports) {
|
|
|
7767
8203
|
});
|
|
7768
8204
|
freeze(LightningElement);
|
|
7769
8205
|
seal(LightningElement.prototype);
|
|
7770
|
-
/* version: 2.5.
|
|
8206
|
+
/* version: 2.5.8 */
|
|
7771
8207
|
|
|
7772
8208
|
exports.LightningElement = LightningElement;
|
|
7773
8209
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
@@ -7777,6 +8213,7 @@ var LWC = (function (exports) {
|
|
|
7777
8213
|
exports.createElement = createElement;
|
|
7778
8214
|
exports.getComponentConstructor = getComponentConstructor;
|
|
7779
8215
|
exports.getComponentDef = getComponentDef;
|
|
8216
|
+
exports.hydrateComponent = hydrateComponent;
|
|
7780
8217
|
exports.isComponentConstructor = isComponentConstructor;
|
|
7781
8218
|
exports.isNodeFromTemplate = isNodeFromTemplate;
|
|
7782
8219
|
exports.readonly = readonly;
|