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
|
@@ -339,7 +339,7 @@ function htmlPropertyToAttribute(propName) {
|
|
|
339
339
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
340
340
|
return attributeName;
|
|
341
341
|
}
|
|
342
|
-
/** version: 2.5.
|
|
342
|
+
/** version: 2.5.8 */
|
|
343
343
|
|
|
344
344
|
/*
|
|
345
345
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -460,7 +460,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
460
460
|
setFeatureFlag(name, value);
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
|
-
/** version: 2.5.
|
|
463
|
+
/** version: 2.5.8 */
|
|
464
464
|
|
|
465
465
|
/* proxy-compat-disable */
|
|
466
466
|
|
|
@@ -512,6 +512,28 @@ function guid() {
|
|
|
512
512
|
}
|
|
513
513
|
|
|
514
514
|
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
515
|
+
} // Borrowed from Vue template compiler.
|
|
516
|
+
// https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
const DECLARATION_DELIMITER = /;(?![^(]*\))/g;
|
|
520
|
+
const PROPERTY_DELIMITER = /:(.+)/;
|
|
521
|
+
|
|
522
|
+
function parseStyleText(cssText) {
|
|
523
|
+
const styleMap = {};
|
|
524
|
+
const declarations = cssText.split(DECLARATION_DELIMITER);
|
|
525
|
+
|
|
526
|
+
for (const declaration of declarations) {
|
|
527
|
+
if (declaration) {
|
|
528
|
+
const [prop, value] = declaration.split(PROPERTY_DELIMITER);
|
|
529
|
+
|
|
530
|
+
if (prop !== undefined && value !== undefined) {
|
|
531
|
+
styleMap[prop.trim()] = value.trim();
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
return styleMap;
|
|
515
537
|
}
|
|
516
538
|
/*
|
|
517
539
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
@@ -693,8 +715,8 @@ function getErrorComponentStack(vm) {
|
|
|
693
715
|
*/
|
|
694
716
|
|
|
695
717
|
|
|
696
|
-
function
|
|
697
|
-
let msg = `[LWC
|
|
718
|
+
function log(method, message, vm) {
|
|
719
|
+
let msg = `[LWC ${method}]: ${message}`;
|
|
698
720
|
|
|
699
721
|
if (!isUndefined$1(vm)) {
|
|
700
722
|
msg = `${msg}\n${getComponentStack(vm)}`;
|
|
@@ -702,7 +724,7 @@ function logError(message, vm) {
|
|
|
702
724
|
|
|
703
725
|
if (process.env.NODE_ENV === 'test') {
|
|
704
726
|
/* eslint-disable-next-line no-console */
|
|
705
|
-
console
|
|
727
|
+
console[method](msg);
|
|
706
728
|
return;
|
|
707
729
|
}
|
|
708
730
|
|
|
@@ -710,9 +732,17 @@ function logError(message, vm) {
|
|
|
710
732
|
throw new Error(msg);
|
|
711
733
|
} catch (e) {
|
|
712
734
|
/* eslint-disable-next-line no-console */
|
|
713
|
-
console
|
|
735
|
+
console[method](e);
|
|
714
736
|
}
|
|
715
737
|
}
|
|
738
|
+
|
|
739
|
+
function logError(message, vm) {
|
|
740
|
+
log('error', message, vm);
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
function logWarn(message, vm) {
|
|
744
|
+
log('warn', message, vm);
|
|
745
|
+
}
|
|
716
746
|
/*
|
|
717
747
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
718
748
|
* All rights reserved.
|
|
@@ -4452,6 +4482,17 @@ function createElmHook(vnode) {
|
|
|
4452
4482
|
modComputedStyle.create(vnode);
|
|
4453
4483
|
}
|
|
4454
4484
|
|
|
4485
|
+
function hydrateElmHook(vnode) {
|
|
4486
|
+
modEvents.create(vnode); // Attrs are already on the element.
|
|
4487
|
+
// modAttrs.create(vnode);
|
|
4488
|
+
|
|
4489
|
+
modProps.create(vnode); // Already set.
|
|
4490
|
+
// modStaticClassName.create(vnode);
|
|
4491
|
+
// modStaticStyle.create(vnode);
|
|
4492
|
+
// modComputedClassName.create(vnode);
|
|
4493
|
+
// modComputedStyle.create(vnode);
|
|
4494
|
+
}
|
|
4495
|
+
|
|
4455
4496
|
function fallbackElmHook(elm, vnode) {
|
|
4456
4497
|
const {
|
|
4457
4498
|
owner
|
|
@@ -4623,6 +4664,179 @@ function createChildrenHook(vnode) {
|
|
|
4623
4664
|
}
|
|
4624
4665
|
}
|
|
4625
4666
|
|
|
4667
|
+
function isElementNode(node) {
|
|
4668
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
4669
|
+
return node.nodeType === Node.ELEMENT_NODE;
|
|
4670
|
+
}
|
|
4671
|
+
|
|
4672
|
+
function vnodesAndElementHaveCompatibleAttrs(vnode, elm) {
|
|
4673
|
+
const {
|
|
4674
|
+
data: {
|
|
4675
|
+
attrs = {}
|
|
4676
|
+
},
|
|
4677
|
+
owner: {
|
|
4678
|
+
renderer
|
|
4679
|
+
}
|
|
4680
|
+
} = vnode;
|
|
4681
|
+
let nodesAreCompatible = true; // Validate attributes, though we could always recovery from those by running the update mods.
|
|
4682
|
+
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
4683
|
+
|
|
4684
|
+
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
4685
|
+
const elmAttrValue = renderer.getAttribute(elm, attrName);
|
|
4686
|
+
|
|
4687
|
+
if (attrValue !== elmAttrValue) {
|
|
4688
|
+
logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
|
|
4689
|
+
nodesAreCompatible = false;
|
|
4690
|
+
}
|
|
4691
|
+
}
|
|
4692
|
+
|
|
4693
|
+
return nodesAreCompatible;
|
|
4694
|
+
}
|
|
4695
|
+
|
|
4696
|
+
function vnodesAndElementHaveCompatibleClass(vnode, elm) {
|
|
4697
|
+
const {
|
|
4698
|
+
data: {
|
|
4699
|
+
className,
|
|
4700
|
+
classMap
|
|
4701
|
+
},
|
|
4702
|
+
owner: {
|
|
4703
|
+
renderer
|
|
4704
|
+
}
|
|
4705
|
+
} = vnode;
|
|
4706
|
+
let nodesAreCompatible = true;
|
|
4707
|
+
let vnodeClassName;
|
|
4708
|
+
|
|
4709
|
+
if (!isUndefined$1(className) && className !== elm.className) {
|
|
4710
|
+
// className is used when class is bound to an expr.
|
|
4711
|
+
nodesAreCompatible = false;
|
|
4712
|
+
vnodeClassName = className;
|
|
4713
|
+
} else if (!isUndefined$1(classMap)) {
|
|
4714
|
+
// classMap is used when class is set to static value.
|
|
4715
|
+
const classList = renderer.getClassList(elm);
|
|
4716
|
+
let computedClassName = ''; // all classes from the vnode should be in the element.classList
|
|
4717
|
+
|
|
4718
|
+
for (const name in classMap) {
|
|
4719
|
+
computedClassName += ' ' + name;
|
|
4720
|
+
|
|
4721
|
+
if (!classList.contains(name)) {
|
|
4722
|
+
nodesAreCompatible = false;
|
|
4723
|
+
}
|
|
4724
|
+
}
|
|
4725
|
+
|
|
4726
|
+
vnodeClassName = computedClassName.trim();
|
|
4727
|
+
|
|
4728
|
+
if (classList.length > keys(classMap).length) {
|
|
4729
|
+
nodesAreCompatible = false;
|
|
4730
|
+
}
|
|
4731
|
+
}
|
|
4732
|
+
|
|
4733
|
+
if (!nodesAreCompatible) {
|
|
4734
|
+
logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "class" has different values, expected "${vnodeClassName}" but found "${elm.className}"`, vnode.owner);
|
|
4735
|
+
}
|
|
4736
|
+
|
|
4737
|
+
return nodesAreCompatible;
|
|
4738
|
+
}
|
|
4739
|
+
|
|
4740
|
+
function vnodesAndElementHaveCompatibleStyle(vnode, elm) {
|
|
4741
|
+
const {
|
|
4742
|
+
data: {
|
|
4743
|
+
style,
|
|
4744
|
+
styleDecls
|
|
4745
|
+
},
|
|
4746
|
+
owner: {
|
|
4747
|
+
renderer
|
|
4748
|
+
}
|
|
4749
|
+
} = vnode;
|
|
4750
|
+
const elmStyle = renderer.getAttribute(elm, 'style') || '';
|
|
4751
|
+
let vnodeStyle;
|
|
4752
|
+
let nodesAreCompatible = true;
|
|
4753
|
+
|
|
4754
|
+
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
4755
|
+
nodesAreCompatible = false;
|
|
4756
|
+
vnodeStyle = style;
|
|
4757
|
+
} else if (!isUndefined$1(styleDecls)) {
|
|
4758
|
+
const parsedVnodeStyle = parseStyleText(elmStyle);
|
|
4759
|
+
const expectedStyle = []; // styleMap is used when style is set to static value.
|
|
4760
|
+
|
|
4761
|
+
for (let i = 0, n = styleDecls.length; i < n; i++) {
|
|
4762
|
+
const [prop, value, important] = styleDecls[i];
|
|
4763
|
+
expectedStyle.push(`${prop}: ${value + (important ? ' important!' : '')}`);
|
|
4764
|
+
const parsedPropValue = parsedVnodeStyle[prop];
|
|
4765
|
+
|
|
4766
|
+
if (isUndefined$1(parsedPropValue)) {
|
|
4767
|
+
nodesAreCompatible = false;
|
|
4768
|
+
} else if (!parsedPropValue.startsWith(value)) {
|
|
4769
|
+
nodesAreCompatible = false;
|
|
4770
|
+
} else if (important && !parsedPropValue.endsWith('!important')) {
|
|
4771
|
+
nodesAreCompatible = false;
|
|
4772
|
+
}
|
|
4773
|
+
}
|
|
4774
|
+
|
|
4775
|
+
if (keys(parsedVnodeStyle).length > styleDecls.length) {
|
|
4776
|
+
nodesAreCompatible = false;
|
|
4777
|
+
}
|
|
4778
|
+
|
|
4779
|
+
vnodeStyle = ArrayJoin.call(expectedStyle, ';');
|
|
4780
|
+
}
|
|
4781
|
+
|
|
4782
|
+
if (!nodesAreCompatible) {
|
|
4783
|
+
// style is used when class is bound to an expr.
|
|
4784
|
+
logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "style" has different values, expected "${vnodeStyle}" but found "${elmStyle}".`, vnode.owner);
|
|
4785
|
+
}
|
|
4786
|
+
|
|
4787
|
+
return nodesAreCompatible;
|
|
4788
|
+
}
|
|
4789
|
+
|
|
4790
|
+
function throwHydrationError() {
|
|
4791
|
+
assert.fail('Server rendered elements do not match client side generated elements');
|
|
4792
|
+
}
|
|
4793
|
+
|
|
4794
|
+
function hydrateChildrenHook(elmChildren, children, vm) {
|
|
4795
|
+
var _a, _b;
|
|
4796
|
+
|
|
4797
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4798
|
+
const filteredVNodes = ArrayFilter.call(children, vnode => !!vnode);
|
|
4799
|
+
|
|
4800
|
+
if (elmChildren.length !== filteredVNodes.length) {
|
|
4801
|
+
logError(`Hydration mismatch: incorrect number of rendered nodes, expected ${filteredVNodes.length} but found ${elmChildren.length}.`, vm);
|
|
4802
|
+
throwHydrationError();
|
|
4803
|
+
}
|
|
4804
|
+
}
|
|
4805
|
+
|
|
4806
|
+
let elmCurrentChildIdx = 0;
|
|
4807
|
+
|
|
4808
|
+
for (let j = 0, n = children.length; j < n; j++) {
|
|
4809
|
+
const ch = children[j];
|
|
4810
|
+
|
|
4811
|
+
if (ch != null) {
|
|
4812
|
+
const childNode = elmChildren[elmCurrentChildIdx];
|
|
4813
|
+
|
|
4814
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4815
|
+
// VComments and VTexts validation is handled in their hooks
|
|
4816
|
+
if (isElementNode(childNode)) {
|
|
4817
|
+
if (((_a = ch.sel) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== childNode.tagName.toLowerCase()) {
|
|
4818
|
+
logError(`Hydration mismatch: expecting element with tag "${(_b = ch.sel) === null || _b === void 0 ? void 0 : _b.toLowerCase()}" but found "${childNode.tagName.toLowerCase()}".`, vm);
|
|
4819
|
+
throwHydrationError();
|
|
4820
|
+
} // Note: props are not yet set
|
|
4821
|
+
|
|
4822
|
+
|
|
4823
|
+
const hasIncompatibleAttrs = vnodesAndElementHaveCompatibleAttrs(ch, childNode);
|
|
4824
|
+
const hasIncompatibleClass = vnodesAndElementHaveCompatibleClass(ch, childNode);
|
|
4825
|
+
const hasIncompatibleStyle = vnodesAndElementHaveCompatibleStyle(ch, childNode);
|
|
4826
|
+
const isVNodeAndElementCompatible = hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
4827
|
+
|
|
4828
|
+
if (!isVNodeAndElementCompatible) {
|
|
4829
|
+
throwHydrationError();
|
|
4830
|
+
}
|
|
4831
|
+
}
|
|
4832
|
+
}
|
|
4833
|
+
|
|
4834
|
+
ch.hook.hydrate(ch, childNode);
|
|
4835
|
+
elmCurrentChildIdx++;
|
|
4836
|
+
}
|
|
4837
|
+
}
|
|
4838
|
+
}
|
|
4839
|
+
|
|
4626
4840
|
function updateCustomElmHook(oldVnode, vnode) {
|
|
4627
4841
|
// Attrs need to be applied to element before props
|
|
4628
4842
|
// IE11 will wipe out value on radio inputs if value
|
|
@@ -4724,7 +4938,26 @@ const TextHook = {
|
|
|
4724
4938
|
update: updateNodeHook,
|
|
4725
4939
|
insert: insertNodeHook,
|
|
4726
4940
|
move: insertNodeHook,
|
|
4727
|
-
remove: removeNodeHook
|
|
4941
|
+
remove: removeNodeHook,
|
|
4942
|
+
hydrate: (vNode, node) => {
|
|
4943
|
+
var _a;
|
|
4944
|
+
|
|
4945
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4946
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
4947
|
+
if (node.nodeType !== Node.TEXT_NODE) {
|
|
4948
|
+
logError('Hydration mismatch: incorrect node type received', vNode.owner);
|
|
4949
|
+
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
4950
|
+
}
|
|
4951
|
+
|
|
4952
|
+
if (node.nodeValue !== vNode.text) {
|
|
4953
|
+
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vNode.owner);
|
|
4954
|
+
}
|
|
4955
|
+
} // always set the text value to the one from the vnode.
|
|
4956
|
+
|
|
4957
|
+
|
|
4958
|
+
node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
|
|
4959
|
+
vNode.elm = node;
|
|
4960
|
+
}
|
|
4728
4961
|
};
|
|
4729
4962
|
const CommentHook = {
|
|
4730
4963
|
create: vnode => {
|
|
@@ -4742,7 +4975,26 @@ const CommentHook = {
|
|
|
4742
4975
|
update: updateNodeHook,
|
|
4743
4976
|
insert: insertNodeHook,
|
|
4744
4977
|
move: insertNodeHook,
|
|
4745
|
-
remove: removeNodeHook
|
|
4978
|
+
remove: removeNodeHook,
|
|
4979
|
+
hydrate: (vNode, node) => {
|
|
4980
|
+
var _a;
|
|
4981
|
+
|
|
4982
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4983
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
4984
|
+
if (node.nodeType !== Node.COMMENT_NODE) {
|
|
4985
|
+
logError('Hydration mismatch: incorrect node type received', vNode.owner);
|
|
4986
|
+
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
4987
|
+
}
|
|
4988
|
+
|
|
4989
|
+
if (node.nodeValue !== vNode.text) {
|
|
4990
|
+
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vNode.owner);
|
|
4991
|
+
}
|
|
4992
|
+
} // always set the text value to the one from the vnode.
|
|
4993
|
+
|
|
4994
|
+
|
|
4995
|
+
node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
|
|
4996
|
+
vNode.elm = node;
|
|
4997
|
+
}
|
|
4746
4998
|
}; // insert is called after update, which is used somewhere else (via a module)
|
|
4747
4999
|
// to mark the vm as inserted, that means we cannot use update as the main channel
|
|
4748
5000
|
// to rehydrate when dirty, because sometimes the element is not inserted just yet,
|
|
@@ -4782,6 +5034,38 @@ const ElementHook = {
|
|
|
4782
5034
|
remove: (vnode, parentNode) => {
|
|
4783
5035
|
removeNodeHook(vnode, parentNode);
|
|
4784
5036
|
removeElmHook(vnode);
|
|
5037
|
+
},
|
|
5038
|
+
hydrate: (vnode, node) => {
|
|
5039
|
+
const elm = node;
|
|
5040
|
+
vnode.elm = elm;
|
|
5041
|
+
const {
|
|
5042
|
+
context
|
|
5043
|
+
} = vnode.data;
|
|
5044
|
+
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
|
|
5045
|
+
/* manual */
|
|
5046
|
+
);
|
|
5047
|
+
|
|
5048
|
+
if (isDomManual) {
|
|
5049
|
+
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
5050
|
+
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
5051
|
+
const {
|
|
5052
|
+
props
|
|
5053
|
+
} = vnode.data;
|
|
5054
|
+
|
|
5055
|
+
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
5056
|
+
if (elm.innerHTML === props.innerHTML) {
|
|
5057
|
+
delete props.innerHTML;
|
|
5058
|
+
} else {
|
|
5059
|
+
logWarn(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
|
|
5060
|
+
}
|
|
5061
|
+
}
|
|
5062
|
+
}
|
|
5063
|
+
|
|
5064
|
+
hydrateElmHook(vnode);
|
|
5065
|
+
|
|
5066
|
+
if (!isDomManual) {
|
|
5067
|
+
hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vnode.owner);
|
|
5068
|
+
}
|
|
4785
5069
|
}
|
|
4786
5070
|
};
|
|
4787
5071
|
const CustomElementHook = {
|
|
@@ -4873,6 +5157,44 @@ const CustomElementHook = {
|
|
|
4873
5157
|
// will take care of disconnecting any child VM attached to its shadow as well.
|
|
4874
5158
|
removeVM(vm);
|
|
4875
5159
|
}
|
|
5160
|
+
},
|
|
5161
|
+
hydrate: (vnode, elm) => {
|
|
5162
|
+
// the element is created, but the vm is not
|
|
5163
|
+
const {
|
|
5164
|
+
sel,
|
|
5165
|
+
mode,
|
|
5166
|
+
ctor,
|
|
5167
|
+
owner
|
|
5168
|
+
} = vnode;
|
|
5169
|
+
const def = getComponentInternalDef(ctor);
|
|
5170
|
+
createVM(elm, def, {
|
|
5171
|
+
mode,
|
|
5172
|
+
owner,
|
|
5173
|
+
tagName: sel,
|
|
5174
|
+
renderer: owner.renderer
|
|
5175
|
+
});
|
|
5176
|
+
vnode.elm = elm;
|
|
5177
|
+
const vm = getAssociatedVM(elm);
|
|
5178
|
+
allocateChildrenHook(vnode, vm);
|
|
5179
|
+
hydrateElmHook(vnode); // Insert hook section:
|
|
5180
|
+
|
|
5181
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5182
|
+
assert.isTrue(vm.state === 0
|
|
5183
|
+
/* created */
|
|
5184
|
+
, `${vm} cannot be recycled.`);
|
|
5185
|
+
}
|
|
5186
|
+
|
|
5187
|
+
runConnectedCallback(vm);
|
|
5188
|
+
|
|
5189
|
+
if (vm.renderMode !== 0
|
|
5190
|
+
/* Light */
|
|
5191
|
+
) {
|
|
5192
|
+
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
5193
|
+
// Note: for Light DOM, this is handled while hydrating the VM
|
|
5194
|
+
hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vm);
|
|
5195
|
+
}
|
|
5196
|
+
|
|
5197
|
+
hydrateVM(vm);
|
|
4876
5198
|
}
|
|
4877
5199
|
};
|
|
4878
5200
|
|
|
@@ -5561,7 +5883,10 @@ function createStylesheet(vm, stylesheets) {
|
|
|
5561
5883
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
5562
5884
|
renderer.insertGlobalStylesheet(stylesheets[i]);
|
|
5563
5885
|
}
|
|
5564
|
-
} else if (renderer.ssr) {
|
|
5886
|
+
} else if (renderer.ssr || renderer.isHydrating) {
|
|
5887
|
+
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
5888
|
+
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
5889
|
+
// the first time the VM renders.
|
|
5565
5890
|
// native shadow or light DOM, SSR
|
|
5566
5891
|
const combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
|
|
5567
5892
|
return createInlineStyleVNode(combinedStylesheetContent);
|
|
@@ -6141,6 +6466,10 @@ function disconnectRootElement(elm) {
|
|
|
6141
6466
|
|
|
6142
6467
|
function appendVM(vm) {
|
|
6143
6468
|
rehydrate(vm);
|
|
6469
|
+
}
|
|
6470
|
+
|
|
6471
|
+
function hydrateVM(vm) {
|
|
6472
|
+
hydrate(vm);
|
|
6144
6473
|
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
6145
6474
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
6146
6475
|
|
|
@@ -6374,6 +6703,22 @@ function rehydrate(vm) {
|
|
|
6374
6703
|
}
|
|
6375
6704
|
}
|
|
6376
6705
|
|
|
6706
|
+
function hydrate(vm) {
|
|
6707
|
+
if (isTrue(vm.isDirty)) {
|
|
6708
|
+
// manually diffing/patching here.
|
|
6709
|
+
// This routine is:
|
|
6710
|
+
// patchShadowRoot(vm, children);
|
|
6711
|
+
// -> addVnodes.
|
|
6712
|
+
const children = renderComponent$1(vm);
|
|
6713
|
+
vm.children = children;
|
|
6714
|
+
const vmChildren = vm.renderMode === 0
|
|
6715
|
+
/* Light */
|
|
6716
|
+
? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;
|
|
6717
|
+
hydrateChildrenHook(vmChildren, children, vm);
|
|
6718
|
+
runRenderedCallback(vm);
|
|
6719
|
+
}
|
|
6720
|
+
}
|
|
6721
|
+
|
|
6377
6722
|
function patchShadowRoot(vm, newCh) {
|
|
6378
6723
|
const {
|
|
6379
6724
|
children: oldCh
|
|
@@ -7187,7 +7532,7 @@ function setHooks(hooks) {
|
|
|
7187
7532
|
hooksAreSet = true;
|
|
7188
7533
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
7189
7534
|
}
|
|
7190
|
-
/* version: 2.5.
|
|
7535
|
+
/* version: 2.5.8 */
|
|
7191
7536
|
|
|
7192
7537
|
/*
|
|
7193
7538
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -7279,6 +7624,11 @@ class HTMLElement$1 {
|
|
|
7279
7624
|
|
|
7280
7625
|
const renderer = {
|
|
7281
7626
|
ssr: true,
|
|
7627
|
+
|
|
7628
|
+
get isHydrating() {
|
|
7629
|
+
return false;
|
|
7630
|
+
},
|
|
7631
|
+
|
|
7282
7632
|
isNativeShadowDefined: false,
|
|
7283
7633
|
isSyntheticShadowDefined: false,
|
|
7284
7634
|
|
|
@@ -7678,7 +8028,7 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
7678
8028
|
|
|
7679
8029
|
freeze(LightningElement);
|
|
7680
8030
|
seal(LightningElement.prototype);
|
|
7681
|
-
/* version: 2.5.
|
|
8031
|
+
/* version: 2.5.8 */
|
|
7682
8032
|
|
|
7683
8033
|
exports.LightningElement = LightningElement;
|
|
7684
8034
|
exports.api = api$1;
|