lwc 2.5.6 → 2.5.10-alpha1
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/esm/es2017/engine.js +7981 -0
- package/dist/engine/iife/es2017/engine.js +8013 -0
- package/dist/engine/iife/es2017/engine.min.js +9 -0
- package/dist/engine/iife/es2017/engine_debug.js +6541 -0
- package/dist/engine/iife/es5/engine.js +6060 -0
- package/dist/engine/iife/es5/engine.min.js +23 -0
- package/dist/engine/iife/es5/engine_debug.js +4856 -0
- package/dist/engine/umd/es2017/engine.js +8014 -0
- package/dist/engine/umd/es2017/engine.min.js +9 -0
- package/dist/engine/umd/es2017/engine_debug.js +6542 -0
- package/dist/engine/umd/es5/engine.js +6061 -0
- package/dist/engine/umd/es5/engine.min.js +23 -0
- package/dist/engine/umd/es5/engine_debug.js +4857 -0
- package/dist/engine-dom/esm/es2017/engine-dom.js +521 -122
- package/dist/engine-dom/iife/es2017/engine-dom.js +522 -123
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +337 -112
- package/dist/engine-dom/iife/es5/engine-dom.js +596 -185
- package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +392 -165
- package/dist/engine-dom/umd/es2017/engine-dom.js +523 -124
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +338 -113
- package/dist/engine-dom/umd/es5/engine-dom.js +597 -186
- package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +393 -166
- package/dist/engine-server/commonjs/es2017/engine-server.js +400 -74
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
- package/dist/engine-server/esm/es2017/engine-server.js +401 -74
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +4 -4
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +4 -4
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +4 -4
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +4 -4
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +5 -5
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +5 -5
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +5 -5
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +5 -5
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +3 -3
- package/dist/wire-service/iife/es2017/wire-service_debug.js +3 -3
- package/dist/wire-service/iife/es5/wire-service.js +3 -3
- package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
- package/dist/wire-service/iife/es5/wire-service_debug.js +3 -3
- package/dist/wire-service/umd/es2017/wire-service.js +4 -4
- package/dist/wire-service/umd/es2017/wire-service_debug.js +4 -4
- package/dist/wire-service/umd/es5/wire-service.js +4 -4
- package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
- package/dist/wire-service/umd/es5/wire-service_debug.js +4 -4
- package/package.json +8 -8
|
@@ -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.10-alpha1 */
|
|
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.10-alpha1 */
|
|
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.
|
|
@@ -3076,8 +3106,10 @@ for (const [elementProp, rendererMethod] of childGetters) {
|
|
|
3076
3106
|
}
|
|
3077
3107
|
|
|
3078
3108
|
return renderer[rendererMethod](elm);
|
|
3079
|
-
}
|
|
3109
|
+
},
|
|
3080
3110
|
|
|
3111
|
+
configurable: true,
|
|
3112
|
+
enumerable: true
|
|
3081
3113
|
};
|
|
3082
3114
|
}
|
|
3083
3115
|
|
|
@@ -3097,8 +3129,11 @@ for (const queryMethod of queryMethods) {
|
|
|
3097
3129
|
}
|
|
3098
3130
|
|
|
3099
3131
|
return renderer[queryMethod](elm, arg);
|
|
3100
|
-
}
|
|
3132
|
+
},
|
|
3101
3133
|
|
|
3134
|
+
configurable: true,
|
|
3135
|
+
enumerable: true,
|
|
3136
|
+
writable: true
|
|
3102
3137
|
};
|
|
3103
3138
|
}
|
|
3104
3139
|
|
|
@@ -4136,7 +4171,7 @@ function createComponentDef(Ctor) {
|
|
|
4136
4171
|
if (!isUndefined$1(ctorShadowSupportMode)) {
|
|
4137
4172
|
assert.invariant(ctorShadowSupportMode === "any"
|
|
4138
4173
|
/* Any */
|
|
4139
|
-
|| ctorShadowSupportMode === "
|
|
4174
|
+
|| ctorShadowSupportMode === "reset"
|
|
4140
4175
|
/* Default */
|
|
4141
4176
|
, `Invalid value for static property shadowSupportMode: '${ctorShadowSupportMode}'`);
|
|
4142
4177
|
}
|
|
@@ -4298,7 +4333,7 @@ const lightingElementDef = {
|
|
|
4298
4333
|
renderMode: 1
|
|
4299
4334
|
/* Shadow */
|
|
4300
4335
|
,
|
|
4301
|
-
shadowSupportMode: "
|
|
4336
|
+
shadowSupportMode: "reset"
|
|
4302
4337
|
/* Default */
|
|
4303
4338
|
,
|
|
4304
4339
|
wire: EmptyObject,
|
|
@@ -4447,6 +4482,17 @@ function createElmHook(vnode) {
|
|
|
4447
4482
|
modComputedStyle.create(vnode);
|
|
4448
4483
|
}
|
|
4449
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
|
+
|
|
4450
4496
|
function fallbackElmHook(elm, vnode) {
|
|
4451
4497
|
const {
|
|
4452
4498
|
owner
|
|
@@ -4618,6 +4664,179 @@ function createChildrenHook(vnode) {
|
|
|
4618
4664
|
}
|
|
4619
4665
|
}
|
|
4620
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 (String(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) && String(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
|
+
|
|
4621
4840
|
function updateCustomElmHook(oldVnode, vnode) {
|
|
4622
4841
|
// Attrs need to be applied to element before props
|
|
4623
4842
|
// IE11 will wipe out value on radio inputs if value
|
|
@@ -4701,38 +4920,6 @@ function getUpgradableConstructor(tagName, renderer) {
|
|
|
4701
4920
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4702
4921
|
*/
|
|
4703
4922
|
|
|
4704
|
-
/**
|
|
4705
|
-
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
|
4706
|
-
* libraries to sanitize HTML content. This hook process the content passed via the template to
|
|
4707
|
-
* lwc:inner-html directive.
|
|
4708
|
-
* It is meant to be overridden with setSanitizeHtmlContentHook
|
|
4709
|
-
*/
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
let sanitizeHtmlContentHook = () => {
|
|
4713
|
-
// locker-service patches this function during runtime to sanitize HTML content.
|
|
4714
|
-
throw new Error('sanitizeHtmlContent hook must be implemented.');
|
|
4715
|
-
};
|
|
4716
|
-
/**
|
|
4717
|
-
* Sets the sanitizeHtmlContentHook.
|
|
4718
|
-
*
|
|
4719
|
-
* @param newHookImpl
|
|
4720
|
-
* @returns oldHookImplementation.
|
|
4721
|
-
*/
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
function setSanitizeHtmlContentHook(newHookImpl) {
|
|
4725
|
-
const currentHook = sanitizeHtmlContentHook;
|
|
4726
|
-
sanitizeHtmlContentHook = newHookImpl;
|
|
4727
|
-
return currentHook;
|
|
4728
|
-
}
|
|
4729
|
-
/*
|
|
4730
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
4731
|
-
* All rights reserved.
|
|
4732
|
-
* SPDX-License-Identifier: MIT
|
|
4733
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4734
|
-
*/
|
|
4735
|
-
|
|
4736
4923
|
|
|
4737
4924
|
const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
4738
4925
|
const SymbolIterator = Symbol.iterator;
|
|
@@ -4751,7 +4938,26 @@ const TextHook = {
|
|
|
4751
4938
|
update: updateNodeHook,
|
|
4752
4939
|
insert: insertNodeHook,
|
|
4753
4940
|
move: insertNodeHook,
|
|
4754
|
-
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
|
+
}
|
|
4755
4961
|
};
|
|
4756
4962
|
const CommentHook = {
|
|
4757
4963
|
create: vnode => {
|
|
@@ -4769,7 +4975,26 @@ const CommentHook = {
|
|
|
4769
4975
|
update: updateNodeHook,
|
|
4770
4976
|
insert: insertNodeHook,
|
|
4771
4977
|
move: insertNodeHook,
|
|
4772
|
-
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
|
+
}
|
|
4773
4998
|
}; // insert is called after update, which is used somewhere else (via a module)
|
|
4774
4999
|
// to mark the vm as inserted, that means we cannot use update as the main channel
|
|
4775
5000
|
// to rehydrate when dirty, because sometimes the element is not inserted just yet,
|
|
@@ -4809,6 +5034,38 @@ const ElementHook = {
|
|
|
4809
5034
|
remove: (vnode, parentNode) => {
|
|
4810
5035
|
removeNodeHook(vnode, parentNode);
|
|
4811
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
|
+
}
|
|
4812
5069
|
}
|
|
4813
5070
|
};
|
|
4814
5071
|
const CustomElementHook = {
|
|
@@ -4900,6 +5157,44 @@ const CustomElementHook = {
|
|
|
4900
5157
|
// will take care of disconnecting any child VM attached to its shadow as well.
|
|
4901
5158
|
removeVM(vm);
|
|
4902
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);
|
|
4903
5198
|
}
|
|
4904
5199
|
};
|
|
4905
5200
|
|
|
@@ -5212,7 +5507,7 @@ function co(text) {
|
|
|
5212
5507
|
|
|
5213
5508
|
|
|
5214
5509
|
function d(value) {
|
|
5215
|
-
return value == null ? '' : value;
|
|
5510
|
+
return value == null ? '' : String(value);
|
|
5216
5511
|
} // [b]ind function
|
|
5217
5512
|
|
|
5218
5513
|
|
|
@@ -5374,6 +5669,26 @@ function sc(vnodes) {
|
|
|
5374
5669
|
|
|
5375
5670
|
markAsDynamicChildren(vnodes);
|
|
5376
5671
|
return vnodes;
|
|
5672
|
+
}
|
|
5673
|
+
/**
|
|
5674
|
+
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
|
5675
|
+
* libraries to sanitize HTML content. This hook process the content passed via the template to
|
|
5676
|
+
* lwc:inner-html directive.
|
|
5677
|
+
* It is meant to be overridden with setSanitizeHtmlContentHook, it throws an error by default.
|
|
5678
|
+
*/
|
|
5679
|
+
|
|
5680
|
+
|
|
5681
|
+
let sanitizeHtmlContentHook = () => {
|
|
5682
|
+
// locker-service patches this function during runtime to sanitize HTML content.
|
|
5683
|
+
throw new Error('sanitizeHtmlContent hook must be implemented.');
|
|
5684
|
+
};
|
|
5685
|
+
/**
|
|
5686
|
+
* Sets the sanitizeHtmlContentHook.
|
|
5687
|
+
*/
|
|
5688
|
+
|
|
5689
|
+
|
|
5690
|
+
function setSanitizeHtmlContentHook(newHookImpl) {
|
|
5691
|
+
sanitizeHtmlContentHook = newHookImpl;
|
|
5377
5692
|
} // [s]anitize [h]tml [c]ontent
|
|
5378
5693
|
|
|
5379
5694
|
|
|
@@ -5568,7 +5883,10 @@ function createStylesheet(vm, stylesheets) {
|
|
|
5568
5883
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
5569
5884
|
renderer.insertGlobalStylesheet(stylesheets[i]);
|
|
5570
5885
|
}
|
|
5571
|
-
} 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.
|
|
5572
5890
|
// native shadow or light DOM, SSR
|
|
5573
5891
|
const combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
|
|
5574
5892
|
return createInlineStyleVNode(combinedStylesheetContent);
|
|
@@ -6148,6 +6466,10 @@ function disconnectRootElement(elm) {
|
|
|
6148
6466
|
|
|
6149
6467
|
function appendVM(vm) {
|
|
6150
6468
|
rehydrate(vm);
|
|
6469
|
+
}
|
|
6470
|
+
|
|
6471
|
+
function hydrateVM(vm) {
|
|
6472
|
+
hydrate(vm);
|
|
6151
6473
|
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
6152
6474
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
6153
6475
|
|
|
@@ -6381,6 +6703,22 @@ function rehydrate(vm) {
|
|
|
6381
6703
|
}
|
|
6382
6704
|
}
|
|
6383
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
|
+
|
|
6384
6722
|
function patchShadowRoot(vm, newCh) {
|
|
6385
6723
|
const {
|
|
6386
6724
|
children: oldCh
|
|
@@ -7189,28 +7527,12 @@ function readonly(obj) {
|
|
|
7189
7527
|
|
|
7190
7528
|
let hooksAreSet = false;
|
|
7191
7529
|
|
|
7192
|
-
function overrideHooks(hooks) {
|
|
7193
|
-
const oldHooks = {};
|
|
7194
|
-
|
|
7195
|
-
if (!isUndefined$1(hooks.sanitizeHtmlContent)) {
|
|
7196
|
-
oldHooks.sanitizeHtmlContent = setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
7197
|
-
}
|
|
7198
|
-
|
|
7199
|
-
return oldHooks;
|
|
7200
|
-
}
|
|
7201
|
-
|
|
7202
7530
|
function setHooks(hooks) {
|
|
7203
7531
|
assert.isFalse(hooksAreSet, 'Hooks are already overridden, only one definition is allowed.');
|
|
7204
|
-
overrideHooks(hooks);
|
|
7205
7532
|
hooksAreSet = true;
|
|
7533
|
+
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
7206
7534
|
}
|
|
7207
|
-
|
|
7208
|
-
function setHooksForTest(hooks) {
|
|
7209
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
7210
|
-
return overrideHooks(hooks);
|
|
7211
|
-
}
|
|
7212
|
-
}
|
|
7213
|
-
/* version: 2.5.6 */
|
|
7535
|
+
/* version: 2.5.10-alpha1 */
|
|
7214
7536
|
|
|
7215
7537
|
/*
|
|
7216
7538
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -7240,7 +7562,7 @@ var HostNodeType;
|
|
|
7240
7562
|
const CLASSNAMES_SEPARATOR = /\s+/g;
|
|
7241
7563
|
|
|
7242
7564
|
function classNameToTokenList(value) {
|
|
7243
|
-
return new Set(value.
|
|
7565
|
+
return new Set(value.split(CLASSNAMES_SEPARATOR).filter(str => str.length));
|
|
7244
7566
|
}
|
|
7245
7567
|
|
|
7246
7568
|
function tokenListToClassName(values) {
|
|
@@ -7302,6 +7624,11 @@ class HTMLElement$1 {
|
|
|
7302
7624
|
|
|
7303
7625
|
const renderer = {
|
|
7304
7626
|
ssr: true,
|
|
7627
|
+
|
|
7628
|
+
isHydrating() {
|
|
7629
|
+
return false;
|
|
7630
|
+
},
|
|
7631
|
+
|
|
7305
7632
|
isNativeShadowDefined: false,
|
|
7306
7633
|
isSyntheticShadowDefined: false,
|
|
7307
7634
|
|
|
@@ -7509,18 +7836,18 @@ const renderer = {
|
|
|
7509
7836
|
},
|
|
7510
7837
|
|
|
7511
7838
|
setCSSStyleProperty(element, name, value, important) {
|
|
7512
|
-
|
|
7839
|
+
const styleAttribute = element.attributes.find(attr => attr.name === 'style' && isNull(attr.namespace));
|
|
7840
|
+
const serializedProperty = `${name}: ${value}${important ? ' !important' : ''}`;
|
|
7513
7841
|
|
|
7514
7842
|
if (isUndefined$1(styleAttribute)) {
|
|
7515
|
-
|
|
7843
|
+
element.attributes.push({
|
|
7516
7844
|
name: 'style',
|
|
7517
7845
|
namespace: null,
|
|
7518
|
-
value:
|
|
7519
|
-
};
|
|
7520
|
-
|
|
7846
|
+
value: serializedProperty
|
|
7847
|
+
});
|
|
7848
|
+
} else {
|
|
7849
|
+
styleAttribute.value += `; ${serializedProperty}`;
|
|
7521
7850
|
}
|
|
7522
|
-
|
|
7523
|
-
styleAttribute.value = `${styleAttribute.value}; ${name}: ${value}${important ? ' !important' : ''}`;
|
|
7524
7851
|
},
|
|
7525
7852
|
|
|
7526
7853
|
isConnected(node) {
|
|
@@ -7701,7 +8028,7 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
7701
8028
|
|
|
7702
8029
|
freeze(LightningElement);
|
|
7703
8030
|
seal(LightningElement.prototype);
|
|
7704
|
-
/* version: 2.5.
|
|
8031
|
+
/* version: 2.5.10-alpha1 */
|
|
7705
8032
|
|
|
7706
8033
|
exports.LightningElement = LightningElement;
|
|
7707
8034
|
exports.api = api$1;
|
|
@@ -7718,7 +8045,6 @@ exports.sanitizeAttribute = sanitizeAttribute;
|
|
|
7718
8045
|
exports.setFeatureFlag = setFeatureFlag;
|
|
7719
8046
|
exports.setFeatureFlagForTest = setFeatureFlagForTest;
|
|
7720
8047
|
exports.setHooks = setHooks;
|
|
7721
|
-
exports.setHooksForTest = setHooksForTest;
|
|
7722
8048
|
exports.track = track;
|
|
7723
8049
|
exports.unwrap = unwrap;
|
|
7724
8050
|
exports.wire = wire;
|