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
|
@@ -35,23 +35,23 @@ var LWC = (function (exports) {
|
|
|
35
35
|
|
|
36
36
|
function _getPrototypeOf2(o) { _getPrototypeOf2 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf2(o); }
|
|
37
37
|
|
|
38
|
-
function
|
|
38
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
39
39
|
|
|
40
|
-
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); } }
|
|
41
41
|
|
|
42
|
-
function
|
|
42
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
43
43
|
|
|
44
|
-
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."); }
|
|
45
47
|
|
|
46
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; }
|
|
47
49
|
|
|
48
50
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
49
51
|
|
|
50
|
-
function
|
|
51
|
-
|
|
52
|
-
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); } }
|
|
52
|
+
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); }
|
|
53
53
|
|
|
54
|
-
function
|
|
54
|
+
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; }
|
|
55
55
|
|
|
56
56
|
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); }
|
|
57
57
|
|
|
@@ -341,7 +341,7 @@ var LWC = (function (exports) {
|
|
|
341
341
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
342
342
|
return attributeName;
|
|
343
343
|
}
|
|
344
|
-
/** version: 2.5.
|
|
344
|
+
/** version: 2.5.8 */
|
|
345
345
|
|
|
346
346
|
/*
|
|
347
347
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -513,7 +513,7 @@ var LWC = (function (exports) {
|
|
|
513
513
|
|
|
514
514
|
function setFeatureFlagForTest(name, value) {
|
|
515
515
|
}
|
|
516
|
-
/** version: 2.5.
|
|
516
|
+
/** version: 2.5.8 */
|
|
517
517
|
|
|
518
518
|
/* proxy-compat-disable */
|
|
519
519
|
|
|
@@ -555,7 +555,7 @@ var LWC = (function (exports) {
|
|
|
555
555
|
}
|
|
556
556
|
|
|
557
557
|
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
558
|
-
}
|
|
558
|
+
} // Borrowed from Vue template compiler.
|
|
559
559
|
/*
|
|
560
560
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
561
561
|
* All rights reserved.
|
|
@@ -710,6 +710,20 @@ var LWC = (function (exports) {
|
|
|
710
710
|
return "<".concat(StringToLowerCase.call(vm.tagName), ">");
|
|
711
711
|
} // TODO [#1695]: Unify getComponentStack and getErrorComponentStack
|
|
712
712
|
|
|
713
|
+
|
|
714
|
+
function getComponentStack(vm) {
|
|
715
|
+
var stack = [];
|
|
716
|
+
var prefix = '';
|
|
717
|
+
|
|
718
|
+
while (!isNull(vm.owner)) {
|
|
719
|
+
ArrayPush$1.call(stack, prefix + getComponentTag(vm));
|
|
720
|
+
vm = vm.owner;
|
|
721
|
+
prefix += '\t';
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
return ArrayJoin.call(stack, '\n');
|
|
725
|
+
}
|
|
726
|
+
|
|
713
727
|
function getErrorComponentStack(vm) {
|
|
714
728
|
var wcStack = [];
|
|
715
729
|
var currentVm = vm;
|
|
@@ -729,6 +743,32 @@ var LWC = (function (exports) {
|
|
|
729
743
|
*/
|
|
730
744
|
|
|
731
745
|
|
|
746
|
+
function log(method, message, vm) {
|
|
747
|
+
var msg = "[LWC ".concat(method, "]: ").concat(message);
|
|
748
|
+
|
|
749
|
+
if (!isUndefined$1(vm)) {
|
|
750
|
+
msg = "".concat(msg, "\n").concat(getComponentStack(vm));
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
try {
|
|
754
|
+
throw new Error(msg);
|
|
755
|
+
} catch (e) {
|
|
756
|
+
/* eslint-disable-next-line no-console */
|
|
757
|
+
console[method](e);
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
function logWarn(message, vm) {
|
|
762
|
+
log('warn', message, vm);
|
|
763
|
+
}
|
|
764
|
+
/*
|
|
765
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
766
|
+
* All rights reserved.
|
|
767
|
+
* SPDX-License-Identifier: MIT
|
|
768
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
769
|
+
*/
|
|
770
|
+
|
|
771
|
+
|
|
732
772
|
function handleEvent(event, vnode) {
|
|
733
773
|
var type = event.type;
|
|
734
774
|
var on = vnode.data.on;
|
|
@@ -3379,6 +3419,17 @@ var LWC = (function (exports) {
|
|
|
3379
3419
|
modComputedStyle.create(vnode);
|
|
3380
3420
|
}
|
|
3381
3421
|
|
|
3422
|
+
function hydrateElmHook(vnode) {
|
|
3423
|
+
modEvents.create(vnode); // Attrs are already on the element.
|
|
3424
|
+
// modAttrs.create(vnode);
|
|
3425
|
+
|
|
3426
|
+
modProps.create(vnode); // Already set.
|
|
3427
|
+
// modStaticClassName.create(vnode);
|
|
3428
|
+
// modStaticStyle.create(vnode);
|
|
3429
|
+
// modComputedClassName.create(vnode);
|
|
3430
|
+
// modComputedStyle.create(vnode);
|
|
3431
|
+
}
|
|
3432
|
+
|
|
3382
3433
|
function fallbackElmHook(elm, vnode) {
|
|
3383
3434
|
var owner = vnode.owner;
|
|
3384
3435
|
setScopeTokenClassIfNecessary(elm, owner);
|
|
@@ -3510,6 +3561,22 @@ var LWC = (function (exports) {
|
|
|
3510
3561
|
}
|
|
3511
3562
|
}
|
|
3512
3563
|
|
|
3564
|
+
function hydrateChildrenHook(elmChildren, children, vm) {
|
|
3565
|
+
|
|
3566
|
+
var elmCurrentChildIdx = 0;
|
|
3567
|
+
|
|
3568
|
+
for (var j = 0, n = children.length; j < n; j++) {
|
|
3569
|
+
var ch = children[j];
|
|
3570
|
+
|
|
3571
|
+
if (ch != null) {
|
|
3572
|
+
var childNode = elmChildren[elmCurrentChildIdx];
|
|
3573
|
+
|
|
3574
|
+
ch.hook.hydrate(ch, childNode);
|
|
3575
|
+
elmCurrentChildIdx++;
|
|
3576
|
+
}
|
|
3577
|
+
}
|
|
3578
|
+
}
|
|
3579
|
+
|
|
3513
3580
|
function updateCustomElmHook(oldVnode, vnode) {
|
|
3514
3581
|
// Attrs need to be applied to element before props
|
|
3515
3582
|
// IE11 will wipe out value on radio inputs if value
|
|
@@ -3617,7 +3684,14 @@ var LWC = (function (exports) {
|
|
|
3617
3684
|
update: updateNodeHook,
|
|
3618
3685
|
insert: insertNodeHook,
|
|
3619
3686
|
move: insertNodeHook,
|
|
3620
|
-
remove: removeNodeHook
|
|
3687
|
+
remove: removeNodeHook,
|
|
3688
|
+
hydrate: function hydrate(vNode, node) {
|
|
3689
|
+
var _a;
|
|
3690
|
+
|
|
3691
|
+
|
|
3692
|
+
node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
|
|
3693
|
+
vNode.elm = node;
|
|
3694
|
+
}
|
|
3621
3695
|
};
|
|
3622
3696
|
var CommentHook = {
|
|
3623
3697
|
create: function create(vnode) {
|
|
@@ -3631,7 +3705,14 @@ var LWC = (function (exports) {
|
|
|
3631
3705
|
update: updateNodeHook,
|
|
3632
3706
|
insert: insertNodeHook,
|
|
3633
3707
|
move: insertNodeHook,
|
|
3634
|
-
remove: removeNodeHook
|
|
3708
|
+
remove: removeNodeHook,
|
|
3709
|
+
hydrate: function hydrate(vNode, node) {
|
|
3710
|
+
var _a;
|
|
3711
|
+
|
|
3712
|
+
|
|
3713
|
+
node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
|
|
3714
|
+
vNode.elm = node;
|
|
3715
|
+
}
|
|
3635
3716
|
}; // insert is called after update, which is used somewhere else (via a module)
|
|
3636
3717
|
// to mark the vm as inserted, that means we cannot use update as the main channel
|
|
3637
3718
|
// to rehydrate when dirty, because sometimes the element is not inserted just yet,
|
|
@@ -3665,6 +3746,34 @@ var LWC = (function (exports) {
|
|
|
3665
3746
|
remove: function remove(vnode, parentNode) {
|
|
3666
3747
|
removeNodeHook(vnode, parentNode);
|
|
3667
3748
|
removeElmHook(vnode);
|
|
3749
|
+
},
|
|
3750
|
+
hydrate: function hydrate(vnode, node) {
|
|
3751
|
+
var elm = node;
|
|
3752
|
+
vnode.elm = elm;
|
|
3753
|
+
var context = vnode.data.context;
|
|
3754
|
+
var isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
|
|
3755
|
+
/* manual */
|
|
3756
|
+
);
|
|
3757
|
+
|
|
3758
|
+
if (isDomManual) {
|
|
3759
|
+
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
3760
|
+
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
3761
|
+
var props = vnode.data.props;
|
|
3762
|
+
|
|
3763
|
+
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
3764
|
+
if (elm.innerHTML === props.innerHTML) {
|
|
3765
|
+
delete props.innerHTML;
|
|
3766
|
+
} else {
|
|
3767
|
+
logWarn("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: innerHTML values do not match for element, will recover from the difference"), vnode.owner);
|
|
3768
|
+
}
|
|
3769
|
+
}
|
|
3770
|
+
}
|
|
3771
|
+
|
|
3772
|
+
hydrateElmHook(vnode);
|
|
3773
|
+
|
|
3774
|
+
if (!isDomManual) {
|
|
3775
|
+
hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vnode.owner);
|
|
3776
|
+
}
|
|
3668
3777
|
}
|
|
3669
3778
|
};
|
|
3670
3779
|
var CustomElementHook = {
|
|
@@ -3744,6 +3853,36 @@ var LWC = (function (exports) {
|
|
|
3744
3853
|
// will take care of disconnecting any child VM attached to its shadow as well.
|
|
3745
3854
|
removeVM(vm);
|
|
3746
3855
|
}
|
|
3856
|
+
},
|
|
3857
|
+
hydrate: function hydrate(vnode, elm) {
|
|
3858
|
+
// the element is created, but the vm is not
|
|
3859
|
+
var sel = vnode.sel,
|
|
3860
|
+
mode = vnode.mode,
|
|
3861
|
+
ctor = vnode.ctor,
|
|
3862
|
+
owner = vnode.owner;
|
|
3863
|
+
var def = getComponentInternalDef(ctor);
|
|
3864
|
+
createVM(elm, def, {
|
|
3865
|
+
mode: mode,
|
|
3866
|
+
owner: owner,
|
|
3867
|
+
tagName: sel,
|
|
3868
|
+
renderer: owner.renderer
|
|
3869
|
+
});
|
|
3870
|
+
vnode.elm = elm;
|
|
3871
|
+
var vm = getAssociatedVM(elm);
|
|
3872
|
+
allocateChildrenHook(vnode, vm);
|
|
3873
|
+
hydrateElmHook(vnode); // Insert hook section:
|
|
3874
|
+
|
|
3875
|
+
runConnectedCallback(vm);
|
|
3876
|
+
|
|
3877
|
+
if (vm.renderMode !== 0
|
|
3878
|
+
/* Light */
|
|
3879
|
+
) {
|
|
3880
|
+
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
3881
|
+
// Note: for Light DOM, this is handled while hydrating the VM
|
|
3882
|
+
hydrateChildrenHook(vnode.elm.childNodes, vnode.children);
|
|
3883
|
+
}
|
|
3884
|
+
|
|
3885
|
+
hydrateVM(vm);
|
|
3747
3886
|
}
|
|
3748
3887
|
};
|
|
3749
3888
|
|
|
@@ -4206,8 +4345,8 @@ var LWC = (function (exports) {
|
|
|
4206
4345
|
function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
4207
4346
|
var content = [];
|
|
4208
4347
|
|
|
4209
|
-
for (var
|
|
4210
|
-
var stylesheet = stylesheets[
|
|
4348
|
+
for (var _i16 = 0; _i16 < stylesheets.length; _i16++) {
|
|
4349
|
+
var stylesheet = stylesheets[_i16];
|
|
4211
4350
|
|
|
4212
4351
|
if (isArray$1(stylesheet)) {
|
|
4213
4352
|
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
|
|
@@ -4277,10 +4416,13 @@ var LWC = (function (exports) {
|
|
|
4277
4416
|
&& shadowMode === 1
|
|
4278
4417
|
/* Synthetic */
|
|
4279
4418
|
) {
|
|
4280
|
-
for (var
|
|
4281
|
-
renderer.insertGlobalStylesheet(stylesheets[
|
|
4419
|
+
for (var _i17 = 0; _i17 < stylesheets.length; _i17++) {
|
|
4420
|
+
renderer.insertGlobalStylesheet(stylesheets[_i17]);
|
|
4282
4421
|
}
|
|
4283
|
-
} else if (renderer.ssr) {
|
|
4422
|
+
} else if (renderer.ssr || renderer.isHydrating) {
|
|
4423
|
+
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
4424
|
+
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
4425
|
+
// the first time the VM renders.
|
|
4284
4426
|
// native shadow or light DOM, SSR
|
|
4285
4427
|
var combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
|
|
4286
4428
|
return createInlineStyleVNode(combinedStylesheetContent);
|
|
@@ -4289,12 +4431,12 @@ var LWC = (function (exports) {
|
|
|
4289
4431
|
var root = getNearestNativeShadowComponent(vm);
|
|
4290
4432
|
var isGlobal = isNull(root);
|
|
4291
4433
|
|
|
4292
|
-
for (var
|
|
4434
|
+
for (var _i18 = 0; _i18 < stylesheets.length; _i18++) {
|
|
4293
4435
|
if (isGlobal) {
|
|
4294
|
-
renderer.insertGlobalStylesheet(stylesheets[
|
|
4436
|
+
renderer.insertGlobalStylesheet(stylesheets[_i18]);
|
|
4295
4437
|
} else {
|
|
4296
4438
|
// local level
|
|
4297
|
-
renderer.insertStylesheet(stylesheets[
|
|
4439
|
+
renderer.insertStylesheet(stylesheets[_i18], root.cmpRoot);
|
|
4298
4440
|
}
|
|
4299
4441
|
}
|
|
4300
4442
|
}
|
|
@@ -4479,8 +4621,8 @@ var LWC = (function (exports) {
|
|
|
4479
4621
|
var stylesheets = template.stylesheets;
|
|
4480
4622
|
|
|
4481
4623
|
if (!isUndefined$1(stylesheets)) {
|
|
4482
|
-
for (var
|
|
4483
|
-
if (isTrue(stylesheets[
|
|
4624
|
+
for (var _i19 = 0; _i19 < stylesheets.length; _i19++) {
|
|
4625
|
+
if (isTrue(stylesheets[_i19][KEY__SCOPED_CSS])) {
|
|
4484
4626
|
return true;
|
|
4485
4627
|
}
|
|
4486
4628
|
}
|
|
@@ -4681,8 +4823,8 @@ var LWC = (function (exports) {
|
|
|
4681
4823
|
|
|
4682
4824
|
function register(service) {
|
|
4683
4825
|
|
|
4684
|
-
for (var
|
|
4685
|
-
var hookName = hooks[
|
|
4826
|
+
for (var _i20 = 0; _i20 < hooks.length; ++_i20) {
|
|
4827
|
+
var hookName = hooks[_i20];
|
|
4686
4828
|
|
|
4687
4829
|
if (hookName in service) {
|
|
4688
4830
|
var l = Services[hookName];
|
|
@@ -4702,8 +4844,8 @@ var LWC = (function (exports) {
|
|
|
4702
4844
|
def = vm.def,
|
|
4703
4845
|
context = vm.context;
|
|
4704
4846
|
|
|
4705
|
-
for (var
|
|
4706
|
-
cbs[
|
|
4847
|
+
for (var _i21 = 0, _len6 = cbs.length; _i21 < _len6; ++_i21) {
|
|
4848
|
+
cbs[_i21].call(undefined, component, {}, def, context);
|
|
4707
4849
|
}
|
|
4708
4850
|
}
|
|
4709
4851
|
/*
|
|
@@ -4756,6 +4898,12 @@ var LWC = (function (exports) {
|
|
|
4756
4898
|
, vm);
|
|
4757
4899
|
}
|
|
4758
4900
|
|
|
4901
|
+
function hydrateRootElement(elm) {
|
|
4902
|
+
var vm = getAssociatedVM(elm);
|
|
4903
|
+
runConnectedCallback(vm);
|
|
4904
|
+
hydrateVM(vm);
|
|
4905
|
+
}
|
|
4906
|
+
|
|
4759
4907
|
function disconnectRootElement(elm) {
|
|
4760
4908
|
var vm = getAssociatedVM(elm);
|
|
4761
4909
|
resetComponentStateWhenRemoved(vm);
|
|
@@ -4763,6 +4911,10 @@ var LWC = (function (exports) {
|
|
|
4763
4911
|
|
|
4764
4912
|
function appendVM(vm) {
|
|
4765
4913
|
rehydrate(vm);
|
|
4914
|
+
}
|
|
4915
|
+
|
|
4916
|
+
function hydrateVM(vm) {
|
|
4917
|
+
hydrate(vm);
|
|
4766
4918
|
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
4767
4919
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
4768
4920
|
|
|
@@ -4947,6 +5099,22 @@ var LWC = (function (exports) {
|
|
|
4947
5099
|
}
|
|
4948
5100
|
}
|
|
4949
5101
|
|
|
5102
|
+
function hydrate(vm) {
|
|
5103
|
+
if (isTrue(vm.isDirty)) {
|
|
5104
|
+
// manually diffing/patching here.
|
|
5105
|
+
// This routine is:
|
|
5106
|
+
// patchShadowRoot(vm, children);
|
|
5107
|
+
// -> addVnodes.
|
|
5108
|
+
var children = renderComponent(vm);
|
|
5109
|
+
vm.children = children;
|
|
5110
|
+
var vmChildren = vm.renderMode === 0
|
|
5111
|
+
/* Light */
|
|
5112
|
+
? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;
|
|
5113
|
+
hydrateChildrenHook(vmChildren, children);
|
|
5114
|
+
runRenderedCallback(vm);
|
|
5115
|
+
}
|
|
5116
|
+
}
|
|
5117
|
+
|
|
4950
5118
|
function patchShadowRoot(vm, newCh) {
|
|
4951
5119
|
var oldCh = vm.children; // caching the new children collection
|
|
4952
5120
|
|
|
@@ -5023,19 +5191,19 @@ var LWC = (function (exports) {
|
|
|
5023
5191
|
});
|
|
5024
5192
|
rehydrateQueue = []; // reset to a new queue
|
|
5025
5193
|
|
|
5026
|
-
for (var
|
|
5027
|
-
var vm = vms[
|
|
5194
|
+
for (var _i22 = 0, _len7 = vms.length; _i22 < _len7; _i22 += 1) {
|
|
5195
|
+
var vm = vms[_i22];
|
|
5028
5196
|
|
|
5029
5197
|
try {
|
|
5030
5198
|
rehydrate(vm);
|
|
5031
5199
|
} catch (error) {
|
|
5032
|
-
if (
|
|
5200
|
+
if (_i22 + 1 < _len7) {
|
|
5033
5201
|
// pieces of the queue are still pending to be rehydrated, those should have priority
|
|
5034
5202
|
if (rehydrateQueue.length === 0) {
|
|
5035
5203
|
addCallbackToNextTick(flushRehydrationQueue);
|
|
5036
5204
|
}
|
|
5037
5205
|
|
|
5038
|
-
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms,
|
|
5206
|
+
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i22 + 1));
|
|
5039
5207
|
} // we need to end the measure before throwing.
|
|
5040
5208
|
|
|
5041
5209
|
|
|
@@ -5134,8 +5302,8 @@ var LWC = (function (exports) {
|
|
|
5134
5302
|
var vCustomElementCollection = vm.velements; // Reporting disconnection for every child in inverse order since they are
|
|
5135
5303
|
// inserted in reserved order.
|
|
5136
5304
|
|
|
5137
|
-
for (var
|
|
5138
|
-
var elm = vCustomElementCollection[
|
|
5305
|
+
for (var _i23 = vCustomElementCollection.length - 1; _i23 >= 0; _i23 -= 1) {
|
|
5306
|
+
var elm = vCustomElementCollection[_i23].elm; // There are two cases where the element could be undefined:
|
|
5139
5307
|
// * when there is an error during the construction phase, and an error
|
|
5140
5308
|
// boundary picks it, there is a possibility that the VCustomElement
|
|
5141
5309
|
// is not properly initialized, and therefore is should be ignored.
|
|
@@ -5169,8 +5337,8 @@ var LWC = (function (exports) {
|
|
|
5169
5337
|
|
|
5170
5338
|
|
|
5171
5339
|
function recursivelyDisconnectChildren(vnodes) {
|
|
5172
|
-
for (var
|
|
5173
|
-
var vnode = vnodes[
|
|
5340
|
+
for (var _i24 = 0, _len8 = vnodes.length; _i24 < _len8; _i24 += 1) {
|
|
5341
|
+
var vnode = vnodes[_i24];
|
|
5174
5342
|
|
|
5175
5343
|
if (!isNull(vnode) && isArray$1(vnode.children) && !isUndefined$1(vnode.elm)) {
|
|
5176
5344
|
// vnode is a VElement with children
|
|
@@ -5194,8 +5362,8 @@ var LWC = (function (exports) {
|
|
|
5194
5362
|
renderer = vm.renderer;
|
|
5195
5363
|
var rootNode = getRenderRoot(vm);
|
|
5196
5364
|
|
|
5197
|
-
for (var
|
|
5198
|
-
var child = children[
|
|
5365
|
+
for (var _i25 = 0, _len9 = children.length; _i25 < _len9; _i25++) {
|
|
5366
|
+
var child = children[_i25];
|
|
5199
5367
|
|
|
5200
5368
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
5201
5369
|
renderer.remove(child.elm, rootNode);
|
|
@@ -5240,8 +5408,8 @@ var LWC = (function (exports) {
|
|
|
5240
5408
|
var oldSlots = vm.cmpSlots;
|
|
5241
5409
|
var cmpSlots = vm.cmpSlots = create(null);
|
|
5242
5410
|
|
|
5243
|
-
for (var
|
|
5244
|
-
var vnode = children[
|
|
5411
|
+
for (var _i26 = 0, _len10 = children.length; _i26 < _len10; _i26 += 1) {
|
|
5412
|
+
var vnode = children[_i26];
|
|
5245
5413
|
|
|
5246
5414
|
if (isNull(vnode)) {
|
|
5247
5415
|
continue;
|
|
@@ -5271,8 +5439,8 @@ var LWC = (function (exports) {
|
|
|
5271
5439
|
return;
|
|
5272
5440
|
}
|
|
5273
5441
|
|
|
5274
|
-
for (var
|
|
5275
|
-
var key = oldKeys[
|
|
5442
|
+
for (var _i27 = 0, _len11 = oldKeys.length; _i27 < _len11; _i27 += 1) {
|
|
5443
|
+
var key = oldKeys[_i27];
|
|
5276
5444
|
|
|
5277
5445
|
if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
|
|
5278
5446
|
markComponentAsDirty(vm);
|
|
@@ -5611,8 +5779,8 @@ var LWC = (function (exports) {
|
|
|
5611
5779
|
function connectWireAdapters(vm) {
|
|
5612
5780
|
var wiredConnecting = vm.context.wiredConnecting;
|
|
5613
5781
|
|
|
5614
|
-
for (var
|
|
5615
|
-
wiredConnecting[
|
|
5782
|
+
for (var _i28 = 0, _len12 = wiredConnecting.length; _i28 < _len12; _i28 += 1) {
|
|
5783
|
+
wiredConnecting[_i28]();
|
|
5616
5784
|
}
|
|
5617
5785
|
}
|
|
5618
5786
|
|
|
@@ -5620,8 +5788,8 @@ var LWC = (function (exports) {
|
|
|
5620
5788
|
var wiredDisconnecting = vm.context.wiredDisconnecting;
|
|
5621
5789
|
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
5622
5790
|
// job
|
|
5623
|
-
for (var
|
|
5624
|
-
wiredDisconnecting[
|
|
5791
|
+
for (var _i29 = 0, _len13 = wiredDisconnecting.length; _i29 < _len13; _i29 += 1) {
|
|
5792
|
+
wiredDisconnecting[_i29]();
|
|
5625
5793
|
}
|
|
5626
5794
|
}, noop);
|
|
5627
5795
|
}
|
|
@@ -5705,7 +5873,7 @@ var LWC = (function (exports) {
|
|
|
5705
5873
|
hooksAreSet = true;
|
|
5706
5874
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
5707
5875
|
}
|
|
5708
|
-
/* version: 2.5.
|
|
5876
|
+
/* version: 2.5.8 */
|
|
5709
5877
|
|
|
5710
5878
|
/*
|
|
5711
5879
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5850,8 +6018,19 @@ var LWC = (function (exports) {
|
|
|
5850
6018
|
HTMLElementConstructor.prototype = HTMLElement.prototype;
|
|
5851
6019
|
}
|
|
5852
6020
|
|
|
6021
|
+
var isHydrating = false;
|
|
6022
|
+
|
|
6023
|
+
function setIsHydrating(v) {
|
|
6024
|
+
isHydrating = v;
|
|
6025
|
+
}
|
|
6026
|
+
|
|
5853
6027
|
var renderer = {
|
|
5854
6028
|
ssr: false,
|
|
6029
|
+
|
|
6030
|
+
get isHydrating() {
|
|
6031
|
+
return isHydrating;
|
|
6032
|
+
},
|
|
6033
|
+
|
|
5855
6034
|
isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
|
|
5856
6035
|
isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
|
|
5857
6036
|
createElement: function createElement(tagName, namespace) {
|
|
@@ -5873,6 +6052,10 @@ var LWC = (function (exports) {
|
|
|
5873
6052
|
return node.nextSibling;
|
|
5874
6053
|
},
|
|
5875
6054
|
attachShadow: function attachShadow(element, options) {
|
|
6055
|
+
if (isHydrating) {
|
|
6056
|
+
return element.shadowRoot;
|
|
6057
|
+
}
|
|
6058
|
+
|
|
5876
6059
|
return element.attachShadow(options);
|
|
5877
6060
|
},
|
|
5878
6061
|
setText: function setText(node, content) {
|
|
@@ -5977,71 +6160,6 @@ var LWC = (function (exports) {
|
|
|
5977
6160
|
getCustomElement: getCustomElement,
|
|
5978
6161
|
HTMLElement: HTMLElementConstructor
|
|
5979
6162
|
};
|
|
5980
|
-
/*
|
|
5981
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
5982
|
-
* All rights reserved.
|
|
5983
|
-
* SPDX-License-Identifier: MIT
|
|
5984
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5985
|
-
*/
|
|
5986
|
-
|
|
5987
|
-
/**
|
|
5988
|
-
* This function builds a Web Component class from a LWC constructor so it can be
|
|
5989
|
-
* registered as a new element via customElements.define() at any given time.
|
|
5990
|
-
*
|
|
5991
|
-
* @deprecated since version 1.3.11
|
|
5992
|
-
*
|
|
5993
|
-
* @example
|
|
5994
|
-
* ```
|
|
5995
|
-
* import { buildCustomElementConstructor } from 'lwc';
|
|
5996
|
-
* import Foo from 'ns/foo';
|
|
5997
|
-
* const WC = buildCustomElementConstructor(Foo);
|
|
5998
|
-
* customElements.define('x-foo', WC);
|
|
5999
|
-
* const elm = document.createElement('x-foo');
|
|
6000
|
-
* ```
|
|
6001
|
-
*/
|
|
6002
|
-
|
|
6003
|
-
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
6004
|
-
|
|
6005
|
-
return Ctor.CustomElementConstructor;
|
|
6006
|
-
}
|
|
6007
|
-
|
|
6008
|
-
function buildCustomElementConstructor(Ctor) {
|
|
6009
|
-
var def = getComponentInternalDef(Ctor);
|
|
6010
|
-
return /*#__PURE__*/function (_def$bridge) {
|
|
6011
|
-
_inherits(_class, _def$bridge);
|
|
6012
|
-
|
|
6013
|
-
var _super8 = _createSuper(_class);
|
|
6014
|
-
|
|
6015
|
-
function _class() {
|
|
6016
|
-
var _this6;
|
|
6017
|
-
|
|
6018
|
-
_classCallCheck(this, _class);
|
|
6019
|
-
|
|
6020
|
-
_this6 = _super8.call(this);
|
|
6021
|
-
createVM(_assertThisInitialized(_this6), def, {
|
|
6022
|
-
mode: 'open',
|
|
6023
|
-
owner: null,
|
|
6024
|
-
tagName: _this6.tagName,
|
|
6025
|
-
renderer: renderer
|
|
6026
|
-
});
|
|
6027
|
-
return _this6;
|
|
6028
|
-
}
|
|
6029
|
-
|
|
6030
|
-
_createClass(_class, [{
|
|
6031
|
-
key: "connectedCallback",
|
|
6032
|
-
value: function connectedCallback() {
|
|
6033
|
-
connectRootElement(this);
|
|
6034
|
-
}
|
|
6035
|
-
}, {
|
|
6036
|
-
key: "disconnectedCallback",
|
|
6037
|
-
value: function disconnectedCallback() {
|
|
6038
|
-
disconnectRootElement(this);
|
|
6039
|
-
}
|
|
6040
|
-
}]);
|
|
6041
|
-
|
|
6042
|
-
return _class;
|
|
6043
|
-
}(def.bridge);
|
|
6044
|
-
}
|
|
6045
6163
|
/*
|
|
6046
6164
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
6047
6165
|
* All rights reserved.
|
|
@@ -6051,7 +6169,6 @@ var LWC = (function (exports) {
|
|
|
6051
6169
|
// TODO [#2472]: Remove this workaround when appropriate.
|
|
6052
6170
|
// eslint-disable-next-line lwc-internal/no-global-node
|
|
6053
6171
|
|
|
6054
|
-
|
|
6055
6172
|
var _Node$1 = Node;
|
|
6056
6173
|
var ConnectingSlot = new WeakMap();
|
|
6057
6174
|
var DisconnectingSlot = new WeakMap();
|
|
@@ -6158,6 +6275,138 @@ var LWC = (function (exports) {
|
|
|
6158
6275
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6159
6276
|
*/
|
|
6160
6277
|
|
|
6278
|
+
|
|
6279
|
+
function hydrateComponent(element, Ctor) {
|
|
6280
|
+
var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
6281
|
+
|
|
6282
|
+
if (!isFunction$1(Ctor)) {
|
|
6283
|
+
throw new TypeError("\"hydrateComponent\" expects a valid component constructor as the second parameter but instead received ".concat(Ctor, "."));
|
|
6284
|
+
}
|
|
6285
|
+
|
|
6286
|
+
if (!isObject(props) || isNull(props)) {
|
|
6287
|
+
throw new TypeError("\"hydrateComponent\" expects an object as the third parameter but instead received ".concat(props, "."));
|
|
6288
|
+
}
|
|
6289
|
+
|
|
6290
|
+
var def = getComponentInternalDef(Ctor);
|
|
6291
|
+
|
|
6292
|
+
try {
|
|
6293
|
+
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
6294
|
+
// and uses the same algo to create the stylesheets as in SSR.
|
|
6295
|
+
setIsHydrating(true);
|
|
6296
|
+
createVM(element, def, {
|
|
6297
|
+
mode: 'open',
|
|
6298
|
+
owner: null,
|
|
6299
|
+
renderer: renderer,
|
|
6300
|
+
tagName: element.tagName.toLowerCase()
|
|
6301
|
+
});
|
|
6302
|
+
|
|
6303
|
+
for (var _i31 = 0, _Object$entries2 = Object.entries(props); _i31 < _Object$entries2.length; _i31++) {
|
|
6304
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i31], 2),
|
|
6305
|
+
key = _Object$entries2$_i[0],
|
|
6306
|
+
value = _Object$entries2$_i[1];
|
|
6307
|
+
|
|
6308
|
+
element[key] = value;
|
|
6309
|
+
}
|
|
6310
|
+
|
|
6311
|
+
hydrateRootElement(element); // set it back since now we finished hydration.
|
|
6312
|
+
|
|
6313
|
+
setIsHydrating(false);
|
|
6314
|
+
} catch (e) {
|
|
6315
|
+
// Fallback: In case there's an error while hydrating, let's log the error, and replace the element with
|
|
6316
|
+
// the client generated DOM.
|
|
6317
|
+
|
|
6318
|
+
/* eslint-disable-next-line no-console */
|
|
6319
|
+
console.error('Recovering from error while hydrating: ', e);
|
|
6320
|
+
setIsHydrating(false);
|
|
6321
|
+
var newElem = createElement(element.tagName, {
|
|
6322
|
+
is: Ctor,
|
|
6323
|
+
mode: 'open'
|
|
6324
|
+
});
|
|
6325
|
+
|
|
6326
|
+
for (var _i32 = 0, _Object$entries3 = Object.entries(props); _i32 < _Object$entries3.length; _i32++) {
|
|
6327
|
+
var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i32], 2),
|
|
6328
|
+
_key3 = _Object$entries3$_i[0],
|
|
6329
|
+
_value2 = _Object$entries3$_i[1];
|
|
6330
|
+
|
|
6331
|
+
newElem[_key3] = _value2;
|
|
6332
|
+
}
|
|
6333
|
+
|
|
6334
|
+
element.parentNode.replaceChild(newElem, element);
|
|
6335
|
+
}
|
|
6336
|
+
}
|
|
6337
|
+
/*
|
|
6338
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6339
|
+
* All rights reserved.
|
|
6340
|
+
* SPDX-License-Identifier: MIT
|
|
6341
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6342
|
+
*/
|
|
6343
|
+
|
|
6344
|
+
/**
|
|
6345
|
+
* This function builds a Web Component class from a LWC constructor so it can be
|
|
6346
|
+
* registered as a new element via customElements.define() at any given time.
|
|
6347
|
+
*
|
|
6348
|
+
* @deprecated since version 1.3.11
|
|
6349
|
+
*
|
|
6350
|
+
* @example
|
|
6351
|
+
* ```
|
|
6352
|
+
* import { buildCustomElementConstructor } from 'lwc';
|
|
6353
|
+
* import Foo from 'ns/foo';
|
|
6354
|
+
* const WC = buildCustomElementConstructor(Foo);
|
|
6355
|
+
* customElements.define('x-foo', WC);
|
|
6356
|
+
* const elm = document.createElement('x-foo');
|
|
6357
|
+
* ```
|
|
6358
|
+
*/
|
|
6359
|
+
|
|
6360
|
+
|
|
6361
|
+
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
6362
|
+
|
|
6363
|
+
return Ctor.CustomElementConstructor;
|
|
6364
|
+
}
|
|
6365
|
+
|
|
6366
|
+
function buildCustomElementConstructor(Ctor) {
|
|
6367
|
+
var def = getComponentInternalDef(Ctor);
|
|
6368
|
+
return /*#__PURE__*/function (_def$bridge) {
|
|
6369
|
+
_inherits(_class, _def$bridge);
|
|
6370
|
+
|
|
6371
|
+
var _super8 = _createSuper(_class);
|
|
6372
|
+
|
|
6373
|
+
function _class() {
|
|
6374
|
+
var _this6;
|
|
6375
|
+
|
|
6376
|
+
_classCallCheck(this, _class);
|
|
6377
|
+
|
|
6378
|
+
_this6 = _super8.call(this);
|
|
6379
|
+
createVM(_assertThisInitialized(_this6), def, {
|
|
6380
|
+
mode: 'open',
|
|
6381
|
+
owner: null,
|
|
6382
|
+
tagName: _this6.tagName,
|
|
6383
|
+
renderer: renderer
|
|
6384
|
+
});
|
|
6385
|
+
return _this6;
|
|
6386
|
+
}
|
|
6387
|
+
|
|
6388
|
+
_createClass(_class, [{
|
|
6389
|
+
key: "connectedCallback",
|
|
6390
|
+
value: function connectedCallback() {
|
|
6391
|
+
connectRootElement(this);
|
|
6392
|
+
}
|
|
6393
|
+
}, {
|
|
6394
|
+
key: "disconnectedCallback",
|
|
6395
|
+
value: function disconnectedCallback() {
|
|
6396
|
+
disconnectRootElement(this);
|
|
6397
|
+
}
|
|
6398
|
+
}]);
|
|
6399
|
+
|
|
6400
|
+
return _class;
|
|
6401
|
+
}(def.bridge);
|
|
6402
|
+
}
|
|
6403
|
+
/*
|
|
6404
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6405
|
+
* All rights reserved.
|
|
6406
|
+
* SPDX-License-Identifier: MIT
|
|
6407
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6408
|
+
*/
|
|
6409
|
+
|
|
6161
6410
|
/**
|
|
6162
6411
|
* EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
|
|
6163
6412
|
* This API is subject to change or being removed.
|
|
@@ -6256,7 +6505,7 @@ var LWC = (function (exports) {
|
|
|
6256
6505
|
});
|
|
6257
6506
|
freeze(LightningElement);
|
|
6258
6507
|
seal(LightningElement.prototype);
|
|
6259
|
-
/* version: 2.5.
|
|
6508
|
+
/* version: 2.5.8 */
|
|
6260
6509
|
|
|
6261
6510
|
exports.LightningElement = LightningElement;
|
|
6262
6511
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
@@ -6266,6 +6515,7 @@ var LWC = (function (exports) {
|
|
|
6266
6515
|
exports.createElement = createElement;
|
|
6267
6516
|
exports.getComponentConstructor = getComponentConstructor;
|
|
6268
6517
|
exports.getComponentDef = getComponentDef;
|
|
6518
|
+
exports.hydrateComponent = hydrateComponent;
|
|
6269
6519
|
exports.isComponentConstructor = isComponentConstructor;
|
|
6270
6520
|
exports.isNodeFromTemplate = isNodeFromTemplate;
|
|
6271
6521
|
exports.readonly = readonly;
|