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