lwc 2.11.0 → 2.12.0
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 +309 -263
- package/dist/engine-dom/iife/es2017/engine-dom.js +309 -263
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +264 -126
- package/dist/engine-dom/iife/es5/engine-dom.js +1104 -1047
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +391 -181
- package/dist/engine-dom/umd/es2017/engine-dom.js +309 -263
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +264 -126
- package/dist/engine-dom/umd/es5/engine-dom.js +1104 -1047
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +391 -181
- package/dist/engine-server/commonjs/es2017/engine-server.js +14 -11
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +14 -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 +10 -10
|
@@ -298,9 +298,9 @@ const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
|
298
298
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
299
299
|
*/
|
|
300
300
|
// Increment whenever the LWC template compiler changes
|
|
301
|
-
const LWC_VERSION = "2.
|
|
301
|
+
const LWC_VERSION = "2.12.0";
|
|
302
302
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
303
|
-
/** version: 2.
|
|
303
|
+
/** version: 2.12.0 */
|
|
304
304
|
|
|
305
305
|
/*
|
|
306
306
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -453,7 +453,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
453
453
|
setFeatureFlag(name, value);
|
|
454
454
|
}
|
|
455
455
|
}
|
|
456
|
-
/** version: 2.
|
|
456
|
+
/** version: 2.12.0 */
|
|
457
457
|
|
|
458
458
|
/* proxy-compat-disable */
|
|
459
459
|
|
|
@@ -5156,11 +5156,15 @@ const signedTemplateMap = new Map();
|
|
|
5156
5156
|
* INTERNAL: This function can only be invoked by compiled code. The compiler
|
|
5157
5157
|
* will prevent this function from being imported by userland code.
|
|
5158
5158
|
*/
|
|
5159
|
-
function registerComponent(
|
|
5160
|
-
|
|
5161
|
-
|
|
5159
|
+
function registerComponent(
|
|
5160
|
+
// We typically expect a LightningElementConstructor, but technically you can call this with anything
|
|
5161
|
+
Ctor, { tmpl }) {
|
|
5162
|
+
if (isFunction$1(Ctor)) {
|
|
5163
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5164
|
+
checkVersionMismatch(Ctor, 'component');
|
|
5165
|
+
}
|
|
5166
|
+
signedTemplateMap.set(Ctor, tmpl);
|
|
5162
5167
|
}
|
|
5163
|
-
signedTemplateMap.set(Ctor, tmpl);
|
|
5164
5168
|
// chaining this method as a way to wrap existing assignment of component constructor easily,
|
|
5165
5169
|
// without too much transformation
|
|
5166
5170
|
return Ctor;
|
|
@@ -5249,236 +5253,6 @@ function invokeServiceHook(vm, cbs) {
|
|
|
5249
5253
|
}
|
|
5250
5254
|
}
|
|
5251
5255
|
|
|
5252
|
-
/*
|
|
5253
|
-
* Copyright (c) 2022, salesforce.com, inc.
|
|
5254
|
-
* All rights reserved.
|
|
5255
|
-
* SPDX-License-Identifier: MIT
|
|
5256
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5257
|
-
*/
|
|
5258
|
-
function hydrate(vnode, node) {
|
|
5259
|
-
switch (vnode.type) {
|
|
5260
|
-
case 0 /* Text */:
|
|
5261
|
-
hydrateText(vnode, node);
|
|
5262
|
-
break;
|
|
5263
|
-
case 1 /* Comment */:
|
|
5264
|
-
hydrateComment(vnode, node);
|
|
5265
|
-
break;
|
|
5266
|
-
case 2 /* Element */:
|
|
5267
|
-
hydrateElement(vnode, node);
|
|
5268
|
-
break;
|
|
5269
|
-
case 3 /* CustomElement */:
|
|
5270
|
-
hydrateCustomElement(vnode, node);
|
|
5271
|
-
break;
|
|
5272
|
-
}
|
|
5273
|
-
}
|
|
5274
|
-
function hydrateText(vnode, node) {
|
|
5275
|
-
var _a;
|
|
5276
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5277
|
-
validateNodeType(vnode, node, 3 /* TEXT */);
|
|
5278
|
-
const nodeValue = getProperty$1(node, 'nodeValue');
|
|
5279
|
-
if (nodeValue !== vnode.text && !(nodeValue === '\u200D' && vnode.text === '')) {
|
|
5280
|
-
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);
|
|
5281
|
-
}
|
|
5282
|
-
}
|
|
5283
|
-
// always set the text value to the one from the vnode.
|
|
5284
|
-
setText$1(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
5285
|
-
vnode.elm = node;
|
|
5286
|
-
}
|
|
5287
|
-
function hydrateComment(vnode, node) {
|
|
5288
|
-
var _a;
|
|
5289
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5290
|
-
validateNodeType(vnode, node, 8 /* COMMENT */);
|
|
5291
|
-
if (getProperty$1(node, 'nodeValue') !== vnode.text) {
|
|
5292
|
-
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vnode.owner);
|
|
5293
|
-
}
|
|
5294
|
-
}
|
|
5295
|
-
// always set the text value to the one from the vnode.
|
|
5296
|
-
setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
5297
|
-
vnode.elm = node;
|
|
5298
|
-
}
|
|
5299
|
-
function hydrateElement(vnode, node) {
|
|
5300
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5301
|
-
validateNodeType(vnode, node, 1 /* ELEMENT */);
|
|
5302
|
-
validateElement(vnode, node);
|
|
5303
|
-
}
|
|
5304
|
-
const elm = node;
|
|
5305
|
-
vnode.elm = elm;
|
|
5306
|
-
const { context } = vnode.data;
|
|
5307
|
-
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual" /* Manual */);
|
|
5308
|
-
if (isDomManual) {
|
|
5309
|
-
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
5310
|
-
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
5311
|
-
const { props } = vnode.data;
|
|
5312
|
-
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
5313
|
-
if (getProperty$1(elm, 'innerHTML') === props.innerHTML) {
|
|
5314
|
-
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
|
5315
|
-
vnode.data = Object.assign(Object.assign({}, vnode.data), { props: cloneAndOmitKey(props, 'innerHTML') });
|
|
5316
|
-
}
|
|
5317
|
-
else {
|
|
5318
|
-
logWarn(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
|
|
5319
|
-
}
|
|
5320
|
-
}
|
|
5321
|
-
}
|
|
5322
|
-
patchElementPropsAndAttrs(vnode);
|
|
5323
|
-
if (!isDomManual) {
|
|
5324
|
-
hydrateChildren(getChildNodes$1(vnode.elm), vnode.children, vnode.owner);
|
|
5325
|
-
}
|
|
5326
|
-
}
|
|
5327
|
-
function hydrateCustomElement(vnode, node) {
|
|
5328
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5329
|
-
validateNodeType(vnode, node, 1 /* ELEMENT */);
|
|
5330
|
-
validateElement(vnode, node);
|
|
5331
|
-
}
|
|
5332
|
-
const elm = node;
|
|
5333
|
-
const { sel, mode, ctor, owner } = vnode;
|
|
5334
|
-
const vm = createVM(elm, ctor, {
|
|
5335
|
-
mode,
|
|
5336
|
-
owner,
|
|
5337
|
-
tagName: sel,
|
|
5338
|
-
});
|
|
5339
|
-
vnode.elm = elm;
|
|
5340
|
-
vnode.vm = vm;
|
|
5341
|
-
allocateChildren(vnode, vm);
|
|
5342
|
-
patchElementPropsAndAttrs(vnode);
|
|
5343
|
-
// Insert hook section:
|
|
5344
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5345
|
-
assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
|
|
5346
|
-
}
|
|
5347
|
-
runConnectedCallback(vm);
|
|
5348
|
-
if (vm.renderMode !== 0 /* Light */) {
|
|
5349
|
-
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
5350
|
-
// Note: for Light DOM, this is handled while hydrating the VM
|
|
5351
|
-
hydrateChildren(getChildNodes$1(vnode.elm), vnode.children, vm);
|
|
5352
|
-
}
|
|
5353
|
-
hydrateVM(vm);
|
|
5354
|
-
}
|
|
5355
|
-
function hydrateChildren(elmChildren, children, vm) {
|
|
5356
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5357
|
-
const filteredVNodes = ArrayFilter.call(children, (vnode) => !!vnode);
|
|
5358
|
-
if (elmChildren.length !== filteredVNodes.length) {
|
|
5359
|
-
logError(`Hydration mismatch: incorrect number of rendered nodes, expected ${filteredVNodes.length} but found ${elmChildren.length}.`, vm);
|
|
5360
|
-
throwHydrationError();
|
|
5361
|
-
}
|
|
5362
|
-
}
|
|
5363
|
-
let childNodeIndex = 0;
|
|
5364
|
-
for (let i = 0; i < children.length; i++) {
|
|
5365
|
-
const childVnode = children[i];
|
|
5366
|
-
if (!isNull(childVnode)) {
|
|
5367
|
-
const childNode = elmChildren[childNodeIndex];
|
|
5368
|
-
hydrate(childVnode, childNode);
|
|
5369
|
-
childNodeIndex++;
|
|
5370
|
-
}
|
|
5371
|
-
}
|
|
5372
|
-
}
|
|
5373
|
-
function patchElementPropsAndAttrs(vnode) {
|
|
5374
|
-
applyEventListeners(vnode);
|
|
5375
|
-
patchProps(null, vnode);
|
|
5376
|
-
}
|
|
5377
|
-
function throwHydrationError() {
|
|
5378
|
-
assert.fail('Server rendered elements do not match client side generated elements');
|
|
5379
|
-
}
|
|
5380
|
-
function validateNodeType(vnode, node, nodeType) {
|
|
5381
|
-
if (getProperty$1(node, 'nodeType') !== nodeType) {
|
|
5382
|
-
logError('Hydration mismatch: incorrect node type received', vnode.owner);
|
|
5383
|
-
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
5384
|
-
}
|
|
5385
|
-
}
|
|
5386
|
-
function validateElement(vnode, elm) {
|
|
5387
|
-
if (vnode.sel.toLowerCase() !== getProperty$1(elm, 'tagName').toLowerCase()) {
|
|
5388
|
-
logError(`Hydration mismatch: expecting element with tag "${vnode.sel.toLowerCase()}" but found "${getProperty$1(elm, 'tagName').toLowerCase()}".`, vnode.owner);
|
|
5389
|
-
throwHydrationError();
|
|
5390
|
-
}
|
|
5391
|
-
const hasIncompatibleAttrs = validateAttrs(vnode, elm);
|
|
5392
|
-
const hasIncompatibleClass = validateClassAttr(vnode, elm);
|
|
5393
|
-
const hasIncompatibleStyle = validateStyleAttr(vnode, elm);
|
|
5394
|
-
const isVNodeAndElementCompatible = hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
5395
|
-
if (!isVNodeAndElementCompatible) {
|
|
5396
|
-
throwHydrationError();
|
|
5397
|
-
}
|
|
5398
|
-
}
|
|
5399
|
-
function validateAttrs(vnode, elm) {
|
|
5400
|
-
const { data: { attrs = {} }, } = vnode;
|
|
5401
|
-
let nodesAreCompatible = true;
|
|
5402
|
-
// Validate attributes, though we could always recovery from those by running the update mods.
|
|
5403
|
-
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
5404
|
-
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
5405
|
-
const elmAttrValue = getAttribute$1(elm, attrName);
|
|
5406
|
-
if (String(attrValue) !== elmAttrValue) {
|
|
5407
|
-
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
|
|
5408
|
-
nodesAreCompatible = false;
|
|
5409
|
-
}
|
|
5410
|
-
}
|
|
5411
|
-
return nodesAreCompatible;
|
|
5412
|
-
}
|
|
5413
|
-
function validateClassAttr(vnode, elm) {
|
|
5414
|
-
const { data: { className, classMap }, } = vnode;
|
|
5415
|
-
let nodesAreCompatible = true;
|
|
5416
|
-
let vnodeClassName;
|
|
5417
|
-
if (!isUndefined$1(className) && String(className) !== getProperty$1(elm, 'className')) {
|
|
5418
|
-
// className is used when class is bound to an expr.
|
|
5419
|
-
nodesAreCompatible = false;
|
|
5420
|
-
vnodeClassName = className;
|
|
5421
|
-
}
|
|
5422
|
-
else if (!isUndefined$1(classMap)) {
|
|
5423
|
-
// classMap is used when class is set to static value.
|
|
5424
|
-
const classList = getClassList$1(elm);
|
|
5425
|
-
let computedClassName = '';
|
|
5426
|
-
// all classes from the vnode should be in the element.classList
|
|
5427
|
-
for (const name in classMap) {
|
|
5428
|
-
computedClassName += ' ' + name;
|
|
5429
|
-
if (!classList.contains(name)) {
|
|
5430
|
-
nodesAreCompatible = false;
|
|
5431
|
-
}
|
|
5432
|
-
}
|
|
5433
|
-
vnodeClassName = computedClassName.trim();
|
|
5434
|
-
if (classList.length > keys(classMap).length) {
|
|
5435
|
-
nodesAreCompatible = false;
|
|
5436
|
-
}
|
|
5437
|
-
}
|
|
5438
|
-
if (!nodesAreCompatible) {
|
|
5439
|
-
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected "${vnodeClassName}" but found "${getProperty$1(elm, 'className')}"`, vnode.owner);
|
|
5440
|
-
}
|
|
5441
|
-
return nodesAreCompatible;
|
|
5442
|
-
}
|
|
5443
|
-
function validateStyleAttr(vnode, elm) {
|
|
5444
|
-
const { data: { style, styleDecls }, } = vnode;
|
|
5445
|
-
const elmStyle = getAttribute$1(elm, 'style') || '';
|
|
5446
|
-
let vnodeStyle;
|
|
5447
|
-
let nodesAreCompatible = true;
|
|
5448
|
-
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
5449
|
-
nodesAreCompatible = false;
|
|
5450
|
-
vnodeStyle = style;
|
|
5451
|
-
}
|
|
5452
|
-
else if (!isUndefined$1(styleDecls)) {
|
|
5453
|
-
const parsedVnodeStyle = parseStyleText(elmStyle);
|
|
5454
|
-
const expectedStyle = [];
|
|
5455
|
-
// styleMap is used when style is set to static value.
|
|
5456
|
-
for (let i = 0, n = styleDecls.length; i < n; i++) {
|
|
5457
|
-
const [prop, value, important] = styleDecls[i];
|
|
5458
|
-
expectedStyle.push(`${prop}: ${value + (important ? ' important!' : '')}`);
|
|
5459
|
-
const parsedPropValue = parsedVnodeStyle[prop];
|
|
5460
|
-
if (isUndefined$1(parsedPropValue)) {
|
|
5461
|
-
nodesAreCompatible = false;
|
|
5462
|
-
}
|
|
5463
|
-
else if (!parsedPropValue.startsWith(value)) {
|
|
5464
|
-
nodesAreCompatible = false;
|
|
5465
|
-
}
|
|
5466
|
-
else if (important && !parsedPropValue.endsWith('!important')) {
|
|
5467
|
-
nodesAreCompatible = false;
|
|
5468
|
-
}
|
|
5469
|
-
}
|
|
5470
|
-
if (keys(parsedVnodeStyle).length > styleDecls.length) {
|
|
5471
|
-
nodesAreCompatible = false;
|
|
5472
|
-
}
|
|
5473
|
-
vnodeStyle = ArrayJoin.call(expectedStyle, ';');
|
|
5474
|
-
}
|
|
5475
|
-
if (!nodesAreCompatible) {
|
|
5476
|
-
// style is used when class is bound to an expr.
|
|
5477
|
-
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "style" has different values, expected "${vnodeStyle}" but found "${elmStyle}".`, vnode.owner);
|
|
5478
|
-
}
|
|
5479
|
-
return nodesAreCompatible;
|
|
5480
|
-
}
|
|
5481
|
-
|
|
5482
5256
|
/*
|
|
5483
5257
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
5484
5258
|
* All rights reserved.
|
|
@@ -5524,32 +5298,12 @@ function connectRootElement(elm) {
|
|
|
5524
5298
|
/* GlobalHydrate */
|
|
5525
5299
|
, vm);
|
|
5526
5300
|
}
|
|
5527
|
-
function hydrateRootElement(elm) {
|
|
5528
|
-
const vm = getAssociatedVM(elm);
|
|
5529
|
-
runConnectedCallback(vm);
|
|
5530
|
-
hydrateVM(vm);
|
|
5531
|
-
}
|
|
5532
5301
|
function disconnectRootElement(elm) {
|
|
5533
5302
|
const vm = getAssociatedVM(elm);
|
|
5534
5303
|
resetComponentStateWhenRemoved(vm);
|
|
5535
5304
|
}
|
|
5536
5305
|
function appendVM(vm) {
|
|
5537
5306
|
rehydrate(vm);
|
|
5538
|
-
}
|
|
5539
|
-
function hydrateVM(vm) {
|
|
5540
|
-
if (isTrue(vm.isDirty)) {
|
|
5541
|
-
// manually diffing/patching here.
|
|
5542
|
-
// This routine is:
|
|
5543
|
-
// patchShadowRoot(vm, children);
|
|
5544
|
-
// -> addVnodes.
|
|
5545
|
-
const children = renderComponent(vm);
|
|
5546
|
-
vm.children = children;
|
|
5547
|
-
const vmChildren = vm.renderMode === 0
|
|
5548
|
-
/* Light */
|
|
5549
|
-
? getChildNodes$1(vm.elm) : getChildNodes$1(vm.elm.shadowRoot);
|
|
5550
|
-
hydrateChildren(vmChildren, children, vm);
|
|
5551
|
-
runRenderedCallback(vm);
|
|
5552
|
-
}
|
|
5553
5307
|
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
5554
5308
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
5555
5309
|
|
|
@@ -5854,7 +5608,6 @@ function runRenderedCallback(vm) {
|
|
|
5854
5608
|
, vm);
|
|
5855
5609
|
}
|
|
5856
5610
|
}
|
|
5857
|
-
|
|
5858
5611
|
let rehydrateQueue = [];
|
|
5859
5612
|
|
|
5860
5613
|
function flushRehydrationQueue() {
|
|
@@ -6511,6 +6264,298 @@ function readonly(obj) {
|
|
|
6511
6264
|
return reactiveMembrane.getReadOnlyProxy(obj);
|
|
6512
6265
|
}
|
|
6513
6266
|
|
|
6267
|
+
/*
|
|
6268
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
6269
|
+
* All rights reserved.
|
|
6270
|
+
* SPDX-License-Identifier: MIT
|
|
6271
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6272
|
+
*/
|
|
6273
|
+
// flag indicating if the hydration recovered from the DOM mismatch
|
|
6274
|
+
let hasMismatch = false;
|
|
6275
|
+
function hydrateRoot(vm) {
|
|
6276
|
+
hasMismatch = false;
|
|
6277
|
+
runConnectedCallback(vm);
|
|
6278
|
+
hydrateVM(vm);
|
|
6279
|
+
if (hasMismatch) {
|
|
6280
|
+
logError('Hydration completed with errors.', vm);
|
|
6281
|
+
}
|
|
6282
|
+
}
|
|
6283
|
+
function hydrateVM(vm) {
|
|
6284
|
+
const children = renderComponent(vm);
|
|
6285
|
+
vm.children = children;
|
|
6286
|
+
const parentNode = vm.renderRoot;
|
|
6287
|
+
hydrateChildren(getFirstChild$1(parentNode), children, parentNode, vm);
|
|
6288
|
+
runRenderedCallback(vm);
|
|
6289
|
+
}
|
|
6290
|
+
function hydrateNode(node, vnode) {
|
|
6291
|
+
let hydratedNode;
|
|
6292
|
+
switch (vnode.type) {
|
|
6293
|
+
case 0 /* Text */:
|
|
6294
|
+
hydratedNode = hydrateText(node, vnode);
|
|
6295
|
+
break;
|
|
6296
|
+
case 1 /* Comment */:
|
|
6297
|
+
hydratedNode = hydrateComment(node, vnode);
|
|
6298
|
+
break;
|
|
6299
|
+
case 2 /* Element */:
|
|
6300
|
+
hydratedNode = hydrateElement(node, vnode);
|
|
6301
|
+
break;
|
|
6302
|
+
case 3 /* CustomElement */:
|
|
6303
|
+
hydratedNode = hydrateCustomElement(node, vnode);
|
|
6304
|
+
break;
|
|
6305
|
+
}
|
|
6306
|
+
return nextSibling$1(hydratedNode);
|
|
6307
|
+
}
|
|
6308
|
+
function hydrateText(node, vnode) {
|
|
6309
|
+
var _a;
|
|
6310
|
+
if (!hasCorrectNodeType(vnode, node, 3 /* TEXT */)) {
|
|
6311
|
+
return handleMismatch(node, vnode);
|
|
6312
|
+
}
|
|
6313
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6314
|
+
const nodeValue = getProperty$1(node, 'nodeValue');
|
|
6315
|
+
if (nodeValue !== vnode.text && !(nodeValue === '\u200D' && vnode.text === '')) {
|
|
6316
|
+
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);
|
|
6317
|
+
}
|
|
6318
|
+
}
|
|
6319
|
+
setText$1(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
6320
|
+
vnode.elm = node;
|
|
6321
|
+
return node;
|
|
6322
|
+
}
|
|
6323
|
+
function hydrateComment(node, vnode) {
|
|
6324
|
+
var _a;
|
|
6325
|
+
if (!hasCorrectNodeType(vnode, node, 8 /* COMMENT */)) {
|
|
6326
|
+
return handleMismatch(node, vnode);
|
|
6327
|
+
}
|
|
6328
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6329
|
+
const nodeValue = getProperty$1(node, 'nodeValue');
|
|
6330
|
+
if (nodeValue !== vnode.text) {
|
|
6331
|
+
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vnode.owner);
|
|
6332
|
+
}
|
|
6333
|
+
}
|
|
6334
|
+
setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
6335
|
+
vnode.elm = node;
|
|
6336
|
+
return node;
|
|
6337
|
+
}
|
|
6338
|
+
function hydrateElement(elm, vnode) {
|
|
6339
|
+
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */) ||
|
|
6340
|
+
!isMatchingElement(vnode, elm)) {
|
|
6341
|
+
return handleMismatch(elm, vnode);
|
|
6342
|
+
}
|
|
6343
|
+
vnode.elm = elm;
|
|
6344
|
+
const { context } = vnode.data;
|
|
6345
|
+
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual" /* Manual */);
|
|
6346
|
+
if (isDomManual) {
|
|
6347
|
+
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
6348
|
+
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
6349
|
+
const { props } = vnode.data;
|
|
6350
|
+
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
6351
|
+
if (getProperty$1(elm, 'innerHTML') === props.innerHTML) {
|
|
6352
|
+
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
|
6353
|
+
vnode.data = Object.assign(Object.assign({}, vnode.data), { props: cloneAndOmitKey(props, 'innerHTML') });
|
|
6354
|
+
}
|
|
6355
|
+
else {
|
|
6356
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6357
|
+
logWarn(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
|
|
6358
|
+
}
|
|
6359
|
+
}
|
|
6360
|
+
}
|
|
6361
|
+
}
|
|
6362
|
+
patchElementPropsAndAttrs(vnode);
|
|
6363
|
+
if (!isDomManual) {
|
|
6364
|
+
hydrateChildren(getFirstChild$1(elm), vnode.children, elm, vnode.owner);
|
|
6365
|
+
}
|
|
6366
|
+
return elm;
|
|
6367
|
+
}
|
|
6368
|
+
function hydrateCustomElement(elm, vnode) {
|
|
6369
|
+
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */) ||
|
|
6370
|
+
!isMatchingElement(vnode, elm)) {
|
|
6371
|
+
return handleMismatch(elm, vnode);
|
|
6372
|
+
}
|
|
6373
|
+
const { sel, mode, ctor, owner } = vnode;
|
|
6374
|
+
const vm = createVM(elm, ctor, {
|
|
6375
|
+
mode,
|
|
6376
|
+
owner,
|
|
6377
|
+
tagName: sel,
|
|
6378
|
+
});
|
|
6379
|
+
vnode.elm = elm;
|
|
6380
|
+
vnode.vm = vm;
|
|
6381
|
+
allocateChildren(vnode, vm);
|
|
6382
|
+
patchElementPropsAndAttrs(vnode);
|
|
6383
|
+
// Insert hook section:
|
|
6384
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6385
|
+
assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
|
|
6386
|
+
}
|
|
6387
|
+
runConnectedCallback(vm);
|
|
6388
|
+
if (vm.renderMode !== 0 /* Light */) {
|
|
6389
|
+
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
6390
|
+
// Note: for Light DOM, this is handled while hydrating the VM
|
|
6391
|
+
hydrateChildren(getFirstChild$1(elm), vnode.children, elm, vm);
|
|
6392
|
+
}
|
|
6393
|
+
hydrateVM(vm);
|
|
6394
|
+
return elm;
|
|
6395
|
+
}
|
|
6396
|
+
function hydrateChildren(node, children, parentNode, owner) {
|
|
6397
|
+
let hasWarned = false;
|
|
6398
|
+
let nextNode = node;
|
|
6399
|
+
let anchor = null;
|
|
6400
|
+
for (let i = 0; i < children.length; i++) {
|
|
6401
|
+
const childVnode = children[i];
|
|
6402
|
+
if (!isNull(childVnode)) {
|
|
6403
|
+
if (nextNode) {
|
|
6404
|
+
nextNode = hydrateNode(nextNode, childVnode);
|
|
6405
|
+
anchor = childVnode.elm;
|
|
6406
|
+
}
|
|
6407
|
+
else {
|
|
6408
|
+
hasMismatch = true;
|
|
6409
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6410
|
+
if (!hasWarned) {
|
|
6411
|
+
hasWarned = true;
|
|
6412
|
+
logError(`Hydration mismatch: incorrect number of rendered nodes. Client produced more nodes than the server.`, owner);
|
|
6413
|
+
}
|
|
6414
|
+
}
|
|
6415
|
+
mount(childVnode, parentNode, anchor);
|
|
6416
|
+
anchor = childVnode.elm;
|
|
6417
|
+
}
|
|
6418
|
+
}
|
|
6419
|
+
}
|
|
6420
|
+
if (nextNode) {
|
|
6421
|
+
hasMismatch = true;
|
|
6422
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6423
|
+
if (!hasWarned) {
|
|
6424
|
+
logError(`Hydration mismatch: incorrect number of rendered nodes. Server rendered more nodes than the client.`, owner);
|
|
6425
|
+
}
|
|
6426
|
+
}
|
|
6427
|
+
do {
|
|
6428
|
+
const current = nextNode;
|
|
6429
|
+
nextNode = nextSibling$1(nextNode);
|
|
6430
|
+
removeNode(current, parentNode);
|
|
6431
|
+
} while (nextNode);
|
|
6432
|
+
}
|
|
6433
|
+
}
|
|
6434
|
+
function handleMismatch(node, vnode, msg) {
|
|
6435
|
+
hasMismatch = true;
|
|
6436
|
+
if (!isUndefined$1(msg)) {
|
|
6437
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6438
|
+
logError(msg, vnode.owner);
|
|
6439
|
+
}
|
|
6440
|
+
}
|
|
6441
|
+
const parentNode = getProperty$1(node, 'parentNode');
|
|
6442
|
+
mount(vnode, parentNode, node);
|
|
6443
|
+
removeNode(node, parentNode);
|
|
6444
|
+
return vnode.elm;
|
|
6445
|
+
}
|
|
6446
|
+
function patchElementPropsAndAttrs(vnode) {
|
|
6447
|
+
applyEventListeners(vnode);
|
|
6448
|
+
patchProps(null, vnode);
|
|
6449
|
+
}
|
|
6450
|
+
function hasCorrectNodeType(vnode, node, nodeType) {
|
|
6451
|
+
if (getProperty$1(node, 'nodeType') !== nodeType) {
|
|
6452
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6453
|
+
logError('Hydration mismatch: incorrect node type received', vnode.owner);
|
|
6454
|
+
}
|
|
6455
|
+
return false;
|
|
6456
|
+
}
|
|
6457
|
+
return true;
|
|
6458
|
+
}
|
|
6459
|
+
function isMatchingElement(vnode, elm) {
|
|
6460
|
+
if (vnode.sel.toLowerCase() !== getProperty$1(elm, 'tagName').toLowerCase()) {
|
|
6461
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6462
|
+
logError(`Hydration mismatch: expecting element with tag "${vnode.sel.toLowerCase()}" but found "${getProperty$1(elm, 'tagName').toLowerCase()}".`, vnode.owner);
|
|
6463
|
+
}
|
|
6464
|
+
return false;
|
|
6465
|
+
}
|
|
6466
|
+
const hasIncompatibleAttrs = validateAttrs(vnode, elm);
|
|
6467
|
+
const hasIncompatibleClass = validateClassAttr(vnode, elm);
|
|
6468
|
+
const hasIncompatibleStyle = validateStyleAttr(vnode, elm);
|
|
6469
|
+
return hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
6470
|
+
}
|
|
6471
|
+
function validateAttrs(vnode, elm) {
|
|
6472
|
+
const { data: { attrs = {} }, } = vnode;
|
|
6473
|
+
let nodesAreCompatible = true;
|
|
6474
|
+
// Validate attributes, though we could always recovery from those by running the update mods.
|
|
6475
|
+
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
6476
|
+
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
6477
|
+
const elmAttrValue = getAttribute$1(elm, attrName);
|
|
6478
|
+
if (String(attrValue) !== elmAttrValue) {
|
|
6479
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6480
|
+
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
|
|
6481
|
+
}
|
|
6482
|
+
nodesAreCompatible = false;
|
|
6483
|
+
}
|
|
6484
|
+
}
|
|
6485
|
+
return nodesAreCompatible;
|
|
6486
|
+
}
|
|
6487
|
+
function validateClassAttr(vnode, elm) {
|
|
6488
|
+
const { data: { className, classMap }, } = vnode;
|
|
6489
|
+
let nodesAreCompatible = true;
|
|
6490
|
+
let vnodeClassName;
|
|
6491
|
+
if (!isUndefined$1(className) && String(className) !== getProperty$1(elm, 'className')) {
|
|
6492
|
+
// className is used when class is bound to an expr.
|
|
6493
|
+
nodesAreCompatible = false;
|
|
6494
|
+
vnodeClassName = className;
|
|
6495
|
+
}
|
|
6496
|
+
else if (!isUndefined$1(classMap)) {
|
|
6497
|
+
// classMap is used when class is set to static value.
|
|
6498
|
+
const classList = getClassList$1(elm);
|
|
6499
|
+
let computedClassName = '';
|
|
6500
|
+
// all classes from the vnode should be in the element.classList
|
|
6501
|
+
for (const name in classMap) {
|
|
6502
|
+
computedClassName += ' ' + name;
|
|
6503
|
+
if (!classList.contains(name)) {
|
|
6504
|
+
nodesAreCompatible = false;
|
|
6505
|
+
}
|
|
6506
|
+
}
|
|
6507
|
+
vnodeClassName = computedClassName.trim();
|
|
6508
|
+
if (classList.length > keys(classMap).length) {
|
|
6509
|
+
nodesAreCompatible = false;
|
|
6510
|
+
}
|
|
6511
|
+
}
|
|
6512
|
+
if (!nodesAreCompatible) {
|
|
6513
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6514
|
+
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected "${vnodeClassName}" but found "${getProperty$1(elm, 'className')}"`, vnode.owner);
|
|
6515
|
+
}
|
|
6516
|
+
}
|
|
6517
|
+
return nodesAreCompatible;
|
|
6518
|
+
}
|
|
6519
|
+
function validateStyleAttr(vnode, elm) {
|
|
6520
|
+
const { data: { style, styleDecls }, } = vnode;
|
|
6521
|
+
const elmStyle = getAttribute$1(elm, 'style') || '';
|
|
6522
|
+
let vnodeStyle;
|
|
6523
|
+
let nodesAreCompatible = true;
|
|
6524
|
+
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
6525
|
+
nodesAreCompatible = false;
|
|
6526
|
+
vnodeStyle = style;
|
|
6527
|
+
}
|
|
6528
|
+
else if (!isUndefined$1(styleDecls)) {
|
|
6529
|
+
const parsedVnodeStyle = parseStyleText(elmStyle);
|
|
6530
|
+
const expectedStyle = [];
|
|
6531
|
+
// styleMap is used when style is set to static value.
|
|
6532
|
+
for (let i = 0, n = styleDecls.length; i < n; i++) {
|
|
6533
|
+
const [prop, value, important] = styleDecls[i];
|
|
6534
|
+
expectedStyle.push(`${prop}: ${value + (important ? ' important!' : '')}`);
|
|
6535
|
+
const parsedPropValue = parsedVnodeStyle[prop];
|
|
6536
|
+
if (isUndefined$1(parsedPropValue)) {
|
|
6537
|
+
nodesAreCompatible = false;
|
|
6538
|
+
}
|
|
6539
|
+
else if (!parsedPropValue.startsWith(value)) {
|
|
6540
|
+
nodesAreCompatible = false;
|
|
6541
|
+
}
|
|
6542
|
+
else if (important && !parsedPropValue.endsWith('!important')) {
|
|
6543
|
+
nodesAreCompatible = false;
|
|
6544
|
+
}
|
|
6545
|
+
}
|
|
6546
|
+
if (keys(parsedVnodeStyle).length > styleDecls.length) {
|
|
6547
|
+
nodesAreCompatible = false;
|
|
6548
|
+
}
|
|
6549
|
+
vnodeStyle = ArrayJoin.call(expectedStyle, ';');
|
|
6550
|
+
}
|
|
6551
|
+
if (!nodesAreCompatible) {
|
|
6552
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6553
|
+
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "style" has different values, expected "${vnodeStyle}" but found "${elmStyle}".`, vnode.owner);
|
|
6554
|
+
}
|
|
6555
|
+
}
|
|
6556
|
+
return nodesAreCompatible;
|
|
6557
|
+
}
|
|
6558
|
+
|
|
6514
6559
|
/*
|
|
6515
6560
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
6516
6561
|
* All rights reserved.
|
|
@@ -6523,7 +6568,7 @@ function setHooks(hooks) {
|
|
|
6523
6568
|
hooksAreSet = true;
|
|
6524
6569
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
6525
6570
|
}
|
|
6526
|
-
/* version: 2.
|
|
6571
|
+
/* version: 2.12.0 */
|
|
6527
6572
|
|
|
6528
6573
|
/*
|
|
6529
6574
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6868,7 +6913,7 @@ function resetShadowRootAndLightDom(element, Ctor) {
|
|
|
6868
6913
|
}
|
|
6869
6914
|
}
|
|
6870
6915
|
function createVMWithProps(element, Ctor, props) {
|
|
6871
|
-
createVM(element, Ctor, {
|
|
6916
|
+
const vm = createVM(element, Ctor, {
|
|
6872
6917
|
mode: 'open',
|
|
6873
6918
|
owner: null,
|
|
6874
6919
|
tagName: element.tagName.toLowerCase(),
|
|
@@ -6876,6 +6921,7 @@ function createVMWithProps(element, Ctor, props) {
|
|
|
6876
6921
|
for (const [key, value] of Object.entries(props)) {
|
|
6877
6922
|
element[key] = value;
|
|
6878
6923
|
}
|
|
6924
|
+
return vm;
|
|
6879
6925
|
}
|
|
6880
6926
|
function hydrateComponent(element, Ctor, props = {}) {
|
|
6881
6927
|
if (!(element instanceof Element)) {
|
|
@@ -6896,8 +6942,8 @@ function hydrateComponent(element, Ctor, props = {}) {
|
|
|
6896
6942
|
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
6897
6943
|
// and uses the same algo to create the stylesheets as in SSR.
|
|
6898
6944
|
setIsHydrating(true);
|
|
6899
|
-
createVMWithProps(element, Ctor, props);
|
|
6900
|
-
|
|
6945
|
+
const vm = createVMWithProps(element, Ctor, props);
|
|
6946
|
+
hydrateRoot(vm);
|
|
6901
6947
|
// set it back since now we finished hydration.
|
|
6902
6948
|
setIsHydrating(false);
|
|
6903
6949
|
}
|
|
@@ -7162,6 +7208,6 @@ defineProperty(LightningElement, 'CustomElementConstructor', {
|
|
|
7162
7208
|
});
|
|
7163
7209
|
freeze(LightningElement);
|
|
7164
7210
|
seal(LightningElement.prototype);
|
|
7165
|
-
/* version: 2.
|
|
7211
|
+
/* version: 2.12.0 */
|
|
7166
7212
|
|
|
7167
7213
|
export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, deprecatedBuildCustomElementConstructor as buildCustomElementConstructor, createContextProvider, createElement, getComponentConstructor, getComponentDef, hydrateComponent, isComponentConstructor, isNodeShadowed as isNodeFromTemplate, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
|