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
|
@@ -335,7 +335,7 @@ function htmlPropertyToAttribute(propName) {
|
|
|
335
335
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
336
336
|
return attributeName;
|
|
337
337
|
}
|
|
338
|
-
/** version: 2.5.
|
|
338
|
+
/** version: 2.5.10-alpha1 */
|
|
339
339
|
|
|
340
340
|
/*
|
|
341
341
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -456,7 +456,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
456
456
|
setFeatureFlag(name, value);
|
|
457
457
|
}
|
|
458
458
|
}
|
|
459
|
-
/** version: 2.5.
|
|
459
|
+
/** version: 2.5.10-alpha1 */
|
|
460
460
|
|
|
461
461
|
/* proxy-compat-disable */
|
|
462
462
|
|
|
@@ -508,6 +508,28 @@ function guid() {
|
|
|
508
508
|
}
|
|
509
509
|
|
|
510
510
|
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
511
|
+
} // Borrowed from Vue template compiler.
|
|
512
|
+
// https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
const DECLARATION_DELIMITER = /;(?![^(]*\))/g;
|
|
516
|
+
const PROPERTY_DELIMITER = /:(.+)/;
|
|
517
|
+
|
|
518
|
+
function parseStyleText(cssText) {
|
|
519
|
+
const styleMap = {};
|
|
520
|
+
const declarations = cssText.split(DECLARATION_DELIMITER);
|
|
521
|
+
|
|
522
|
+
for (const declaration of declarations) {
|
|
523
|
+
if (declaration) {
|
|
524
|
+
const [prop, value] = declaration.split(PROPERTY_DELIMITER);
|
|
525
|
+
|
|
526
|
+
if (prop !== undefined && value !== undefined) {
|
|
527
|
+
styleMap[prop.trim()] = value.trim();
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
return styleMap;
|
|
511
533
|
}
|
|
512
534
|
/*
|
|
513
535
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
@@ -689,8 +711,8 @@ function getErrorComponentStack(vm) {
|
|
|
689
711
|
*/
|
|
690
712
|
|
|
691
713
|
|
|
692
|
-
function
|
|
693
|
-
let msg = `[LWC
|
|
714
|
+
function log(method, message, vm) {
|
|
715
|
+
let msg = `[LWC ${method}]: ${message}`;
|
|
694
716
|
|
|
695
717
|
if (!isUndefined$1(vm)) {
|
|
696
718
|
msg = `${msg}\n${getComponentStack(vm)}`;
|
|
@@ -698,7 +720,7 @@ function logError(message, vm) {
|
|
|
698
720
|
|
|
699
721
|
if (process.env.NODE_ENV === 'test') {
|
|
700
722
|
/* eslint-disable-next-line no-console */
|
|
701
|
-
console
|
|
723
|
+
console[method](msg);
|
|
702
724
|
return;
|
|
703
725
|
}
|
|
704
726
|
|
|
@@ -706,9 +728,17 @@ function logError(message, vm) {
|
|
|
706
728
|
throw new Error(msg);
|
|
707
729
|
} catch (e) {
|
|
708
730
|
/* eslint-disable-next-line no-console */
|
|
709
|
-
console
|
|
731
|
+
console[method](e);
|
|
710
732
|
}
|
|
711
733
|
}
|
|
734
|
+
|
|
735
|
+
function logError(message, vm) {
|
|
736
|
+
log('error', message, vm);
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
function logWarn(message, vm) {
|
|
740
|
+
log('warn', message, vm);
|
|
741
|
+
}
|
|
712
742
|
/*
|
|
713
743
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
714
744
|
* All rights reserved.
|
|
@@ -3072,8 +3102,10 @@ for (const [elementProp, rendererMethod] of childGetters) {
|
|
|
3072
3102
|
}
|
|
3073
3103
|
|
|
3074
3104
|
return renderer[rendererMethod](elm);
|
|
3075
|
-
}
|
|
3105
|
+
},
|
|
3076
3106
|
|
|
3107
|
+
configurable: true,
|
|
3108
|
+
enumerable: true
|
|
3077
3109
|
};
|
|
3078
3110
|
}
|
|
3079
3111
|
|
|
@@ -3093,8 +3125,11 @@ for (const queryMethod of queryMethods) {
|
|
|
3093
3125
|
}
|
|
3094
3126
|
|
|
3095
3127
|
return renderer[queryMethod](elm, arg);
|
|
3096
|
-
}
|
|
3128
|
+
},
|
|
3097
3129
|
|
|
3130
|
+
configurable: true,
|
|
3131
|
+
enumerable: true,
|
|
3132
|
+
writable: true
|
|
3098
3133
|
};
|
|
3099
3134
|
}
|
|
3100
3135
|
|
|
@@ -4132,7 +4167,7 @@ function createComponentDef(Ctor) {
|
|
|
4132
4167
|
if (!isUndefined$1(ctorShadowSupportMode)) {
|
|
4133
4168
|
assert.invariant(ctorShadowSupportMode === "any"
|
|
4134
4169
|
/* Any */
|
|
4135
|
-
|| ctorShadowSupportMode === "
|
|
4170
|
+
|| ctorShadowSupportMode === "reset"
|
|
4136
4171
|
/* Default */
|
|
4137
4172
|
, `Invalid value for static property shadowSupportMode: '${ctorShadowSupportMode}'`);
|
|
4138
4173
|
}
|
|
@@ -4294,7 +4329,7 @@ const lightingElementDef = {
|
|
|
4294
4329
|
renderMode: 1
|
|
4295
4330
|
/* Shadow */
|
|
4296
4331
|
,
|
|
4297
|
-
shadowSupportMode: "
|
|
4332
|
+
shadowSupportMode: "reset"
|
|
4298
4333
|
/* Default */
|
|
4299
4334
|
,
|
|
4300
4335
|
wire: EmptyObject,
|
|
@@ -4443,6 +4478,17 @@ function createElmHook(vnode) {
|
|
|
4443
4478
|
modComputedStyle.create(vnode);
|
|
4444
4479
|
}
|
|
4445
4480
|
|
|
4481
|
+
function hydrateElmHook(vnode) {
|
|
4482
|
+
modEvents.create(vnode); // Attrs are already on the element.
|
|
4483
|
+
// modAttrs.create(vnode);
|
|
4484
|
+
|
|
4485
|
+
modProps.create(vnode); // Already set.
|
|
4486
|
+
// modStaticClassName.create(vnode);
|
|
4487
|
+
// modStaticStyle.create(vnode);
|
|
4488
|
+
// modComputedClassName.create(vnode);
|
|
4489
|
+
// modComputedStyle.create(vnode);
|
|
4490
|
+
}
|
|
4491
|
+
|
|
4446
4492
|
function fallbackElmHook(elm, vnode) {
|
|
4447
4493
|
const {
|
|
4448
4494
|
owner
|
|
@@ -4614,6 +4660,179 @@ function createChildrenHook(vnode) {
|
|
|
4614
4660
|
}
|
|
4615
4661
|
}
|
|
4616
4662
|
|
|
4663
|
+
function isElementNode(node) {
|
|
4664
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
4665
|
+
return node.nodeType === Node.ELEMENT_NODE;
|
|
4666
|
+
}
|
|
4667
|
+
|
|
4668
|
+
function vnodesAndElementHaveCompatibleAttrs(vnode, elm) {
|
|
4669
|
+
const {
|
|
4670
|
+
data: {
|
|
4671
|
+
attrs = {}
|
|
4672
|
+
},
|
|
4673
|
+
owner: {
|
|
4674
|
+
renderer
|
|
4675
|
+
}
|
|
4676
|
+
} = vnode;
|
|
4677
|
+
let nodesAreCompatible = true; // Validate attributes, though we could always recovery from those by running the update mods.
|
|
4678
|
+
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
4679
|
+
|
|
4680
|
+
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
4681
|
+
const elmAttrValue = renderer.getAttribute(elm, attrName);
|
|
4682
|
+
|
|
4683
|
+
if (String(attrValue) !== elmAttrValue) {
|
|
4684
|
+
logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
|
|
4685
|
+
nodesAreCompatible = false;
|
|
4686
|
+
}
|
|
4687
|
+
}
|
|
4688
|
+
|
|
4689
|
+
return nodesAreCompatible;
|
|
4690
|
+
}
|
|
4691
|
+
|
|
4692
|
+
function vnodesAndElementHaveCompatibleClass(vnode, elm) {
|
|
4693
|
+
const {
|
|
4694
|
+
data: {
|
|
4695
|
+
className,
|
|
4696
|
+
classMap
|
|
4697
|
+
},
|
|
4698
|
+
owner: {
|
|
4699
|
+
renderer
|
|
4700
|
+
}
|
|
4701
|
+
} = vnode;
|
|
4702
|
+
let nodesAreCompatible = true;
|
|
4703
|
+
let vnodeClassName;
|
|
4704
|
+
|
|
4705
|
+
if (!isUndefined$1(className) && String(className) !== elm.className) {
|
|
4706
|
+
// className is used when class is bound to an expr.
|
|
4707
|
+
nodesAreCompatible = false;
|
|
4708
|
+
vnodeClassName = className;
|
|
4709
|
+
} else if (!isUndefined$1(classMap)) {
|
|
4710
|
+
// classMap is used when class is set to static value.
|
|
4711
|
+
const classList = renderer.getClassList(elm);
|
|
4712
|
+
let computedClassName = ''; // all classes from the vnode should be in the element.classList
|
|
4713
|
+
|
|
4714
|
+
for (const name in classMap) {
|
|
4715
|
+
computedClassName += ' ' + name;
|
|
4716
|
+
|
|
4717
|
+
if (!classList.contains(name)) {
|
|
4718
|
+
nodesAreCompatible = false;
|
|
4719
|
+
}
|
|
4720
|
+
}
|
|
4721
|
+
|
|
4722
|
+
vnodeClassName = computedClassName.trim();
|
|
4723
|
+
|
|
4724
|
+
if (classList.length > keys(classMap).length) {
|
|
4725
|
+
nodesAreCompatible = false;
|
|
4726
|
+
}
|
|
4727
|
+
}
|
|
4728
|
+
|
|
4729
|
+
if (!nodesAreCompatible) {
|
|
4730
|
+
logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "class" has different values, expected "${vnodeClassName}" but found "${elm.className}"`, vnode.owner);
|
|
4731
|
+
}
|
|
4732
|
+
|
|
4733
|
+
return nodesAreCompatible;
|
|
4734
|
+
}
|
|
4735
|
+
|
|
4736
|
+
function vnodesAndElementHaveCompatibleStyle(vnode, elm) {
|
|
4737
|
+
const {
|
|
4738
|
+
data: {
|
|
4739
|
+
style,
|
|
4740
|
+
styleDecls
|
|
4741
|
+
},
|
|
4742
|
+
owner: {
|
|
4743
|
+
renderer
|
|
4744
|
+
}
|
|
4745
|
+
} = vnode;
|
|
4746
|
+
const elmStyle = renderer.getAttribute(elm, 'style') || '';
|
|
4747
|
+
let vnodeStyle;
|
|
4748
|
+
let nodesAreCompatible = true;
|
|
4749
|
+
|
|
4750
|
+
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
4751
|
+
nodesAreCompatible = false;
|
|
4752
|
+
vnodeStyle = style;
|
|
4753
|
+
} else if (!isUndefined$1(styleDecls)) {
|
|
4754
|
+
const parsedVnodeStyle = parseStyleText(elmStyle);
|
|
4755
|
+
const expectedStyle = []; // styleMap is used when style is set to static value.
|
|
4756
|
+
|
|
4757
|
+
for (let i = 0, n = styleDecls.length; i < n; i++) {
|
|
4758
|
+
const [prop, value, important] = styleDecls[i];
|
|
4759
|
+
expectedStyle.push(`${prop}: ${value + (important ? ' important!' : '')}`);
|
|
4760
|
+
const parsedPropValue = parsedVnodeStyle[prop];
|
|
4761
|
+
|
|
4762
|
+
if (isUndefined$1(parsedPropValue)) {
|
|
4763
|
+
nodesAreCompatible = false;
|
|
4764
|
+
} else if (!parsedPropValue.startsWith(value)) {
|
|
4765
|
+
nodesAreCompatible = false;
|
|
4766
|
+
} else if (important && !parsedPropValue.endsWith('!important')) {
|
|
4767
|
+
nodesAreCompatible = false;
|
|
4768
|
+
}
|
|
4769
|
+
}
|
|
4770
|
+
|
|
4771
|
+
if (keys(parsedVnodeStyle).length > styleDecls.length) {
|
|
4772
|
+
nodesAreCompatible = false;
|
|
4773
|
+
}
|
|
4774
|
+
|
|
4775
|
+
vnodeStyle = ArrayJoin.call(expectedStyle, ';');
|
|
4776
|
+
}
|
|
4777
|
+
|
|
4778
|
+
if (!nodesAreCompatible) {
|
|
4779
|
+
// style is used when class is bound to an expr.
|
|
4780
|
+
logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "style" has different values, expected "${vnodeStyle}" but found "${elmStyle}".`, vnode.owner);
|
|
4781
|
+
}
|
|
4782
|
+
|
|
4783
|
+
return nodesAreCompatible;
|
|
4784
|
+
}
|
|
4785
|
+
|
|
4786
|
+
function throwHydrationError() {
|
|
4787
|
+
assert.fail('Server rendered elements do not match client side generated elements');
|
|
4788
|
+
}
|
|
4789
|
+
|
|
4790
|
+
function hydrateChildrenHook(elmChildren, children, vm) {
|
|
4791
|
+
var _a, _b;
|
|
4792
|
+
|
|
4793
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4794
|
+
const filteredVNodes = ArrayFilter.call(children, vnode => !!vnode);
|
|
4795
|
+
|
|
4796
|
+
if (elmChildren.length !== filteredVNodes.length) {
|
|
4797
|
+
logError(`Hydration mismatch: incorrect number of rendered nodes, expected ${filteredVNodes.length} but found ${elmChildren.length}.`, vm);
|
|
4798
|
+
throwHydrationError();
|
|
4799
|
+
}
|
|
4800
|
+
}
|
|
4801
|
+
|
|
4802
|
+
let elmCurrentChildIdx = 0;
|
|
4803
|
+
|
|
4804
|
+
for (let j = 0, n = children.length; j < n; j++) {
|
|
4805
|
+
const ch = children[j];
|
|
4806
|
+
|
|
4807
|
+
if (ch != null) {
|
|
4808
|
+
const childNode = elmChildren[elmCurrentChildIdx];
|
|
4809
|
+
|
|
4810
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4811
|
+
// VComments and VTexts validation is handled in their hooks
|
|
4812
|
+
if (isElementNode(childNode)) {
|
|
4813
|
+
if (((_a = ch.sel) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== childNode.tagName.toLowerCase()) {
|
|
4814
|
+
logError(`Hydration mismatch: expecting element with tag "${(_b = ch.sel) === null || _b === void 0 ? void 0 : _b.toLowerCase()}" but found "${childNode.tagName.toLowerCase()}".`, vm);
|
|
4815
|
+
throwHydrationError();
|
|
4816
|
+
} // Note: props are not yet set
|
|
4817
|
+
|
|
4818
|
+
|
|
4819
|
+
const hasIncompatibleAttrs = vnodesAndElementHaveCompatibleAttrs(ch, childNode);
|
|
4820
|
+
const hasIncompatibleClass = vnodesAndElementHaveCompatibleClass(ch, childNode);
|
|
4821
|
+
const hasIncompatibleStyle = vnodesAndElementHaveCompatibleStyle(ch, childNode);
|
|
4822
|
+
const isVNodeAndElementCompatible = hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
4823
|
+
|
|
4824
|
+
if (!isVNodeAndElementCompatible) {
|
|
4825
|
+
throwHydrationError();
|
|
4826
|
+
}
|
|
4827
|
+
}
|
|
4828
|
+
}
|
|
4829
|
+
|
|
4830
|
+
ch.hook.hydrate(ch, childNode);
|
|
4831
|
+
elmCurrentChildIdx++;
|
|
4832
|
+
}
|
|
4833
|
+
}
|
|
4834
|
+
}
|
|
4835
|
+
|
|
4617
4836
|
function updateCustomElmHook(oldVnode, vnode) {
|
|
4618
4837
|
// Attrs need to be applied to element before props
|
|
4619
4838
|
// IE11 will wipe out value on radio inputs if value
|
|
@@ -4697,38 +4916,6 @@ function getUpgradableConstructor(tagName, renderer) {
|
|
|
4697
4916
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4698
4917
|
*/
|
|
4699
4918
|
|
|
4700
|
-
/**
|
|
4701
|
-
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
|
4702
|
-
* libraries to sanitize HTML content. This hook process the content passed via the template to
|
|
4703
|
-
* lwc:inner-html directive.
|
|
4704
|
-
* It is meant to be overridden with setSanitizeHtmlContentHook
|
|
4705
|
-
*/
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
let sanitizeHtmlContentHook = () => {
|
|
4709
|
-
// locker-service patches this function during runtime to sanitize HTML content.
|
|
4710
|
-
throw new Error('sanitizeHtmlContent hook must be implemented.');
|
|
4711
|
-
};
|
|
4712
|
-
/**
|
|
4713
|
-
* Sets the sanitizeHtmlContentHook.
|
|
4714
|
-
*
|
|
4715
|
-
* @param newHookImpl
|
|
4716
|
-
* @returns oldHookImplementation.
|
|
4717
|
-
*/
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
function setSanitizeHtmlContentHook(newHookImpl) {
|
|
4721
|
-
const currentHook = sanitizeHtmlContentHook;
|
|
4722
|
-
sanitizeHtmlContentHook = newHookImpl;
|
|
4723
|
-
return currentHook;
|
|
4724
|
-
}
|
|
4725
|
-
/*
|
|
4726
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
4727
|
-
* All rights reserved.
|
|
4728
|
-
* SPDX-License-Identifier: MIT
|
|
4729
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4730
|
-
*/
|
|
4731
|
-
|
|
4732
4919
|
|
|
4733
4920
|
const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
4734
4921
|
const SymbolIterator = Symbol.iterator;
|
|
@@ -4747,7 +4934,26 @@ const TextHook = {
|
|
|
4747
4934
|
update: updateNodeHook,
|
|
4748
4935
|
insert: insertNodeHook,
|
|
4749
4936
|
move: insertNodeHook,
|
|
4750
|
-
remove: removeNodeHook
|
|
4937
|
+
remove: removeNodeHook,
|
|
4938
|
+
hydrate: (vNode, node) => {
|
|
4939
|
+
var _a;
|
|
4940
|
+
|
|
4941
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4942
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
4943
|
+
if (node.nodeType !== Node.TEXT_NODE) {
|
|
4944
|
+
logError('Hydration mismatch: incorrect node type received', vNode.owner);
|
|
4945
|
+
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
4946
|
+
}
|
|
4947
|
+
|
|
4948
|
+
if (node.nodeValue !== vNode.text) {
|
|
4949
|
+
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vNode.owner);
|
|
4950
|
+
}
|
|
4951
|
+
} // always set the text value to the one from the vnode.
|
|
4952
|
+
|
|
4953
|
+
|
|
4954
|
+
node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
|
|
4955
|
+
vNode.elm = node;
|
|
4956
|
+
}
|
|
4751
4957
|
};
|
|
4752
4958
|
const CommentHook = {
|
|
4753
4959
|
create: vnode => {
|
|
@@ -4765,7 +4971,26 @@ const CommentHook = {
|
|
|
4765
4971
|
update: updateNodeHook,
|
|
4766
4972
|
insert: insertNodeHook,
|
|
4767
4973
|
move: insertNodeHook,
|
|
4768
|
-
remove: removeNodeHook
|
|
4974
|
+
remove: removeNodeHook,
|
|
4975
|
+
hydrate: (vNode, node) => {
|
|
4976
|
+
var _a;
|
|
4977
|
+
|
|
4978
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4979
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
4980
|
+
if (node.nodeType !== Node.COMMENT_NODE) {
|
|
4981
|
+
logError('Hydration mismatch: incorrect node type received', vNode.owner);
|
|
4982
|
+
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
4983
|
+
}
|
|
4984
|
+
|
|
4985
|
+
if (node.nodeValue !== vNode.text) {
|
|
4986
|
+
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vNode.owner);
|
|
4987
|
+
}
|
|
4988
|
+
} // always set the text value to the one from the vnode.
|
|
4989
|
+
|
|
4990
|
+
|
|
4991
|
+
node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
|
|
4992
|
+
vNode.elm = node;
|
|
4993
|
+
}
|
|
4769
4994
|
}; // insert is called after update, which is used somewhere else (via a module)
|
|
4770
4995
|
// to mark the vm as inserted, that means we cannot use update as the main channel
|
|
4771
4996
|
// to rehydrate when dirty, because sometimes the element is not inserted just yet,
|
|
@@ -4805,6 +5030,38 @@ const ElementHook = {
|
|
|
4805
5030
|
remove: (vnode, parentNode) => {
|
|
4806
5031
|
removeNodeHook(vnode, parentNode);
|
|
4807
5032
|
removeElmHook(vnode);
|
|
5033
|
+
},
|
|
5034
|
+
hydrate: (vnode, node) => {
|
|
5035
|
+
const elm = node;
|
|
5036
|
+
vnode.elm = elm;
|
|
5037
|
+
const {
|
|
5038
|
+
context
|
|
5039
|
+
} = vnode.data;
|
|
5040
|
+
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
|
|
5041
|
+
/* manual */
|
|
5042
|
+
);
|
|
5043
|
+
|
|
5044
|
+
if (isDomManual) {
|
|
5045
|
+
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
5046
|
+
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
5047
|
+
const {
|
|
5048
|
+
props
|
|
5049
|
+
} = vnode.data;
|
|
5050
|
+
|
|
5051
|
+
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
5052
|
+
if (elm.innerHTML === props.innerHTML) {
|
|
5053
|
+
delete props.innerHTML;
|
|
5054
|
+
} else {
|
|
5055
|
+
logWarn(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
|
|
5056
|
+
}
|
|
5057
|
+
}
|
|
5058
|
+
}
|
|
5059
|
+
|
|
5060
|
+
hydrateElmHook(vnode);
|
|
5061
|
+
|
|
5062
|
+
if (!isDomManual) {
|
|
5063
|
+
hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vnode.owner);
|
|
5064
|
+
}
|
|
4808
5065
|
}
|
|
4809
5066
|
};
|
|
4810
5067
|
const CustomElementHook = {
|
|
@@ -4896,6 +5153,44 @@ const CustomElementHook = {
|
|
|
4896
5153
|
// will take care of disconnecting any child VM attached to its shadow as well.
|
|
4897
5154
|
removeVM(vm);
|
|
4898
5155
|
}
|
|
5156
|
+
},
|
|
5157
|
+
hydrate: (vnode, elm) => {
|
|
5158
|
+
// the element is created, but the vm is not
|
|
5159
|
+
const {
|
|
5160
|
+
sel,
|
|
5161
|
+
mode,
|
|
5162
|
+
ctor,
|
|
5163
|
+
owner
|
|
5164
|
+
} = vnode;
|
|
5165
|
+
const def = getComponentInternalDef(ctor);
|
|
5166
|
+
createVM(elm, def, {
|
|
5167
|
+
mode,
|
|
5168
|
+
owner,
|
|
5169
|
+
tagName: sel,
|
|
5170
|
+
renderer: owner.renderer
|
|
5171
|
+
});
|
|
5172
|
+
vnode.elm = elm;
|
|
5173
|
+
const vm = getAssociatedVM(elm);
|
|
5174
|
+
allocateChildrenHook(vnode, vm);
|
|
5175
|
+
hydrateElmHook(vnode); // Insert hook section:
|
|
5176
|
+
|
|
5177
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5178
|
+
assert.isTrue(vm.state === 0
|
|
5179
|
+
/* created */
|
|
5180
|
+
, `${vm} cannot be recycled.`);
|
|
5181
|
+
}
|
|
5182
|
+
|
|
5183
|
+
runConnectedCallback(vm);
|
|
5184
|
+
|
|
5185
|
+
if (vm.renderMode !== 0
|
|
5186
|
+
/* Light */
|
|
5187
|
+
) {
|
|
5188
|
+
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
5189
|
+
// Note: for Light DOM, this is handled while hydrating the VM
|
|
5190
|
+
hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vm);
|
|
5191
|
+
}
|
|
5192
|
+
|
|
5193
|
+
hydrateVM(vm);
|
|
4899
5194
|
}
|
|
4900
5195
|
};
|
|
4901
5196
|
|
|
@@ -5208,7 +5503,7 @@ function co(text) {
|
|
|
5208
5503
|
|
|
5209
5504
|
|
|
5210
5505
|
function d(value) {
|
|
5211
|
-
return value == null ? '' : value;
|
|
5506
|
+
return value == null ? '' : String(value);
|
|
5212
5507
|
} // [b]ind function
|
|
5213
5508
|
|
|
5214
5509
|
|
|
@@ -5370,6 +5665,26 @@ function sc(vnodes) {
|
|
|
5370
5665
|
|
|
5371
5666
|
markAsDynamicChildren(vnodes);
|
|
5372
5667
|
return vnodes;
|
|
5668
|
+
}
|
|
5669
|
+
/**
|
|
5670
|
+
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
|
5671
|
+
* libraries to sanitize HTML content. This hook process the content passed via the template to
|
|
5672
|
+
* lwc:inner-html directive.
|
|
5673
|
+
* It is meant to be overridden with setSanitizeHtmlContentHook, it throws an error by default.
|
|
5674
|
+
*/
|
|
5675
|
+
|
|
5676
|
+
|
|
5677
|
+
let sanitizeHtmlContentHook = () => {
|
|
5678
|
+
// locker-service patches this function during runtime to sanitize HTML content.
|
|
5679
|
+
throw new Error('sanitizeHtmlContent hook must be implemented.');
|
|
5680
|
+
};
|
|
5681
|
+
/**
|
|
5682
|
+
* Sets the sanitizeHtmlContentHook.
|
|
5683
|
+
*/
|
|
5684
|
+
|
|
5685
|
+
|
|
5686
|
+
function setSanitizeHtmlContentHook(newHookImpl) {
|
|
5687
|
+
sanitizeHtmlContentHook = newHookImpl;
|
|
5373
5688
|
} // [s]anitize [h]tml [c]ontent
|
|
5374
5689
|
|
|
5375
5690
|
|
|
@@ -5564,7 +5879,10 @@ function createStylesheet(vm, stylesheets) {
|
|
|
5564
5879
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
5565
5880
|
renderer.insertGlobalStylesheet(stylesheets[i]);
|
|
5566
5881
|
}
|
|
5567
|
-
} else if (renderer.ssr) {
|
|
5882
|
+
} else if (renderer.ssr || renderer.isHydrating()) {
|
|
5883
|
+
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
5884
|
+
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
5885
|
+
// the first time the VM renders.
|
|
5568
5886
|
// native shadow or light DOM, SSR
|
|
5569
5887
|
const combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
|
|
5570
5888
|
return createInlineStyleVNode(combinedStylesheetContent);
|
|
@@ -6144,6 +6462,10 @@ function disconnectRootElement(elm) {
|
|
|
6144
6462
|
|
|
6145
6463
|
function appendVM(vm) {
|
|
6146
6464
|
rehydrate(vm);
|
|
6465
|
+
}
|
|
6466
|
+
|
|
6467
|
+
function hydrateVM(vm) {
|
|
6468
|
+
hydrate(vm);
|
|
6147
6469
|
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
6148
6470
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
6149
6471
|
|
|
@@ -6377,6 +6699,22 @@ function rehydrate(vm) {
|
|
|
6377
6699
|
}
|
|
6378
6700
|
}
|
|
6379
6701
|
|
|
6702
|
+
function hydrate(vm) {
|
|
6703
|
+
if (isTrue(vm.isDirty)) {
|
|
6704
|
+
// manually diffing/patching here.
|
|
6705
|
+
// This routine is:
|
|
6706
|
+
// patchShadowRoot(vm, children);
|
|
6707
|
+
// -> addVnodes.
|
|
6708
|
+
const children = renderComponent$1(vm);
|
|
6709
|
+
vm.children = children;
|
|
6710
|
+
const vmChildren = vm.renderMode === 0
|
|
6711
|
+
/* Light */
|
|
6712
|
+
? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;
|
|
6713
|
+
hydrateChildrenHook(vmChildren, children, vm);
|
|
6714
|
+
runRenderedCallback(vm);
|
|
6715
|
+
}
|
|
6716
|
+
}
|
|
6717
|
+
|
|
6380
6718
|
function patchShadowRoot(vm, newCh) {
|
|
6381
6719
|
const {
|
|
6382
6720
|
children: oldCh
|
|
@@ -7185,28 +7523,12 @@ function readonly(obj) {
|
|
|
7185
7523
|
|
|
7186
7524
|
let hooksAreSet = false;
|
|
7187
7525
|
|
|
7188
|
-
function overrideHooks(hooks) {
|
|
7189
|
-
const oldHooks = {};
|
|
7190
|
-
|
|
7191
|
-
if (!isUndefined$1(hooks.sanitizeHtmlContent)) {
|
|
7192
|
-
oldHooks.sanitizeHtmlContent = setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
7193
|
-
}
|
|
7194
|
-
|
|
7195
|
-
return oldHooks;
|
|
7196
|
-
}
|
|
7197
|
-
|
|
7198
7526
|
function setHooks(hooks) {
|
|
7199
7527
|
assert.isFalse(hooksAreSet, 'Hooks are already overridden, only one definition is allowed.');
|
|
7200
|
-
overrideHooks(hooks);
|
|
7201
7528
|
hooksAreSet = true;
|
|
7529
|
+
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
7202
7530
|
}
|
|
7203
|
-
|
|
7204
|
-
function setHooksForTest(hooks) {
|
|
7205
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
7206
|
-
return overrideHooks(hooks);
|
|
7207
|
-
}
|
|
7208
|
-
}
|
|
7209
|
-
/* version: 2.5.6 */
|
|
7531
|
+
/* version: 2.5.10-alpha1 */
|
|
7210
7532
|
|
|
7211
7533
|
/*
|
|
7212
7534
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -7236,7 +7558,7 @@ var HostNodeType;
|
|
|
7236
7558
|
const CLASSNAMES_SEPARATOR = /\s+/g;
|
|
7237
7559
|
|
|
7238
7560
|
function classNameToTokenList(value) {
|
|
7239
|
-
return new Set(value.
|
|
7561
|
+
return new Set(value.split(CLASSNAMES_SEPARATOR).filter(str => str.length));
|
|
7240
7562
|
}
|
|
7241
7563
|
|
|
7242
7564
|
function tokenListToClassName(values) {
|
|
@@ -7298,6 +7620,11 @@ class HTMLElement$1 {
|
|
|
7298
7620
|
|
|
7299
7621
|
const renderer = {
|
|
7300
7622
|
ssr: true,
|
|
7623
|
+
|
|
7624
|
+
isHydrating() {
|
|
7625
|
+
return false;
|
|
7626
|
+
},
|
|
7627
|
+
|
|
7301
7628
|
isNativeShadowDefined: false,
|
|
7302
7629
|
isSyntheticShadowDefined: false,
|
|
7303
7630
|
|
|
@@ -7505,18 +7832,18 @@ const renderer = {
|
|
|
7505
7832
|
},
|
|
7506
7833
|
|
|
7507
7834
|
setCSSStyleProperty(element, name, value, important) {
|
|
7508
|
-
|
|
7835
|
+
const styleAttribute = element.attributes.find(attr => attr.name === 'style' && isNull(attr.namespace));
|
|
7836
|
+
const serializedProperty = `${name}: ${value}${important ? ' !important' : ''}`;
|
|
7509
7837
|
|
|
7510
7838
|
if (isUndefined$1(styleAttribute)) {
|
|
7511
|
-
|
|
7839
|
+
element.attributes.push({
|
|
7512
7840
|
name: 'style',
|
|
7513
7841
|
namespace: null,
|
|
7514
|
-
value:
|
|
7515
|
-
};
|
|
7516
|
-
|
|
7842
|
+
value: serializedProperty
|
|
7843
|
+
});
|
|
7844
|
+
} else {
|
|
7845
|
+
styleAttribute.value += `; ${serializedProperty}`;
|
|
7517
7846
|
}
|
|
7518
|
-
|
|
7519
|
-
styleAttribute.value = `${styleAttribute.value}; ${name}: ${value}${important ? ' !important' : ''}`;
|
|
7520
7847
|
},
|
|
7521
7848
|
|
|
7522
7849
|
isConnected(node) {
|
|
@@ -7697,6 +8024,6 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
7697
8024
|
|
|
7698
8025
|
freeze(LightningElement);
|
|
7699
8026
|
seal(LightningElement.prototype);
|
|
7700
|
-
/* version: 2.5.
|
|
8027
|
+
/* version: 2.5.10-alpha1 */
|
|
7701
8028
|
|
|
7702
|
-
export { LightningElement, api$1 as api, createContextProvider, getComponentDef, isComponentConstructor, readonly, register, registerComponent, registerDecorators, registerTemplate, renderComponent, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks,
|
|
8029
|
+
export { LightningElement, api$1 as api, createContextProvider, getComponentDef, isComponentConstructor, readonly, register, registerComponent, registerDecorators, registerTemplate, renderComponent, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, track, unwrap, wire };
|
|
@@ -194,7 +194,7 @@ const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
|
|
|
194
194
|
// we can't use typeof since it will fail when transpiling.
|
|
195
195
|
|
|
196
196
|
const hasNativeSymbolSupport = /*@__PURE__*/(() => Symbol('x').toString() === 'Symbol(x)')();
|
|
197
|
-
/** version: 2.5.
|
|
197
|
+
/** version: 2.5.10-alpha1 */
|
|
198
198
|
|
|
199
199
|
/*
|
|
200
200
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -533,7 +533,7 @@ if (!_globalThis.lwcRuntimeFlags) {
|
|
|
533
533
|
}
|
|
534
534
|
|
|
535
535
|
const runtimeFlags = _globalThis.lwcRuntimeFlags;
|
|
536
|
-
/** version: 2.5.
|
|
536
|
+
/** version: 2.5.10-alpha1 */
|
|
537
537
|
|
|
538
538
|
/*
|
|
539
539
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5829,4 +5829,4 @@ defineProperty(Element.prototype, '$domManual$', {
|
|
|
5829
5829
|
|
|
5830
5830
|
configurable: true
|
|
5831
5831
|
});
|
|
5832
|
-
/** version: 2.5.
|
|
5832
|
+
/** version: 2.5.10-alpha1 */
|