lwc 2.9.0 → 2.10.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 +603 -449
- package/dist/engine-dom/iife/es2017/engine-dom.js +603 -449
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +477 -398
- package/dist/engine-dom/iife/es5/engine-dom.js +657 -479
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +509 -425
- package/dist/engine-dom/umd/es2017/engine-dom.js +603 -449
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +477 -398
- package/dist/engine-dom/umd/es5/engine-dom.js +657 -479
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +509 -425
- package/dist/engine-server/commonjs/es2017/engine-server.js +391 -285
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +391 -285
- 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 +7 -7
|
@@ -306,7 +306,17 @@ var LWC = (function (exports) {
|
|
|
306
306
|
const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
|
|
307
307
|
const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
308
308
|
const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
309
|
-
|
|
309
|
+
/*
|
|
310
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
311
|
+
* All rights reserved.
|
|
312
|
+
* SPDX-License-Identifier: MIT
|
|
313
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
314
|
+
*/
|
|
315
|
+
// Increment whenever the LWC template compiler changes
|
|
316
|
+
|
|
317
|
+
const LWC_VERSION = "2.10.0";
|
|
318
|
+
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
319
|
+
/** version: 2.10.0 */
|
|
310
320
|
|
|
311
321
|
/*
|
|
312
322
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -373,7 +383,7 @@ var LWC = (function (exports) {
|
|
|
373
383
|
};
|
|
374
384
|
}
|
|
375
385
|
|
|
376
|
-
function patch(propName) {
|
|
386
|
+
function patch$1(propName) {
|
|
377
387
|
// Typescript is inferring the wrong function type for this particular
|
|
378
388
|
// overloaded method: https://github.com/Microsoft/TypeScript/issues/27972
|
|
379
389
|
// @ts-ignore type-mismatch
|
|
@@ -395,7 +405,7 @@ var LWC = (function (exports) {
|
|
|
395
405
|
const propName = ElementPrototypeAriaPropertyNames[i];
|
|
396
406
|
|
|
397
407
|
if (detect(propName)) {
|
|
398
|
-
patch(propName);
|
|
408
|
+
patch$1(propName);
|
|
399
409
|
}
|
|
400
410
|
}
|
|
401
411
|
/**
|
|
@@ -411,14 +421,15 @@ var LWC = (function (exports) {
|
|
|
411
421
|
|
|
412
422
|
|
|
413
423
|
const features = {
|
|
414
|
-
|
|
415
|
-
ENABLE_HMR: null,
|
|
416
|
-
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
424
|
+
DISABLE_MIXED_SHADOW_MODE: null,
|
|
417
425
|
ENABLE_ELEMENT_PATCH: null,
|
|
418
426
|
ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
|
|
419
|
-
|
|
427
|
+
ENABLE_HMR: null,
|
|
420
428
|
ENABLE_HTML_COLLECTIONS_PATCH: null,
|
|
429
|
+
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
430
|
+
ENABLE_NODE_LIST_PATCH: null,
|
|
421
431
|
ENABLE_NODE_PATCH: null,
|
|
432
|
+
ENABLE_REACTIVE_SETTER: null,
|
|
422
433
|
ENABLE_WIRE_SYNC_EMIT: null
|
|
423
434
|
};
|
|
424
435
|
|
|
@@ -483,7 +494,7 @@ var LWC = (function (exports) {
|
|
|
483
494
|
setFeatureFlag(name, value);
|
|
484
495
|
}
|
|
485
496
|
}
|
|
486
|
-
/** version: 2.
|
|
497
|
+
/** version: 2.10.0 */
|
|
487
498
|
|
|
488
499
|
/* proxy-compat-disable */
|
|
489
500
|
|
|
@@ -570,6 +581,20 @@ var LWC = (function (exports) {
|
|
|
570
581
|
}
|
|
571
582
|
|
|
572
583
|
return result;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
function flattenStylesheets(stylesheets) {
|
|
587
|
+
const list = [];
|
|
588
|
+
|
|
589
|
+
for (const stylesheet of stylesheets) {
|
|
590
|
+
if (!Array.isArray(stylesheet)) {
|
|
591
|
+
list.push(stylesheet);
|
|
592
|
+
} else {
|
|
593
|
+
list.push(...flattenStylesheets(stylesheet));
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
return list;
|
|
573
598
|
} //
|
|
574
599
|
// Primitives
|
|
575
600
|
//
|
|
@@ -3375,6 +3400,47 @@ var LWC = (function (exports) {
|
|
|
3375
3400
|
const meta = signedDecoratorToMetaMap.get(Ctor);
|
|
3376
3401
|
return isUndefined$1(meta) ? defaultMeta : meta;
|
|
3377
3402
|
}
|
|
3403
|
+
/*
|
|
3404
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
3405
|
+
* All rights reserved.
|
|
3406
|
+
* SPDX-License-Identifier: MIT
|
|
3407
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3408
|
+
*/
|
|
3409
|
+
|
|
3410
|
+
|
|
3411
|
+
let warned = false;
|
|
3412
|
+
|
|
3413
|
+
if (process.env.NODE_ENV === 'development') {
|
|
3414
|
+
// @ts-ignore
|
|
3415
|
+
window.__lwcResetWarnedOnVersionMismatch = () => {
|
|
3416
|
+
warned = false;
|
|
3417
|
+
};
|
|
3418
|
+
}
|
|
3419
|
+
|
|
3420
|
+
function checkVersionMismatch(func, type) {
|
|
3421
|
+
const versionMatcher = func.toString().match(LWC_VERSION_COMMENT_REGEX);
|
|
3422
|
+
|
|
3423
|
+
if (!isNull(versionMatcher) && !warned) {
|
|
3424
|
+
const version = versionMatcher[1];
|
|
3425
|
+
const [major, minor] = version.split('.');
|
|
3426
|
+
const [expectedMajor, expectedMinor] = LWC_VERSION.split('.');
|
|
3427
|
+
|
|
3428
|
+
if (major !== expectedMajor || minor !== expectedMinor) {
|
|
3429
|
+
warned = true; // only warn once to avoid flooding the console
|
|
3430
|
+
// stylesheets and templates do not have user-meaningful names, but components do
|
|
3431
|
+
|
|
3432
|
+
const friendlyName = type === 'component' ? `${type} ${func.name}` : type;
|
|
3433
|
+
logError(`LWC WARNING: current engine is v${LWC_VERSION}, but ${friendlyName} was compiled with v${version}.\nPlease update your compiled code or LWC engine so that the versions match.\nNo further warnings will appear.`);
|
|
3434
|
+
}
|
|
3435
|
+
}
|
|
3436
|
+
}
|
|
3437
|
+
/*
|
|
3438
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
3439
|
+
* All rights reserved.
|
|
3440
|
+
* SPDX-License-Identifier: MIT
|
|
3441
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3442
|
+
*/
|
|
3443
|
+
|
|
3378
3444
|
|
|
3379
3445
|
const signedTemplateSet = new Set();
|
|
3380
3446
|
|
|
@@ -3387,6 +3453,16 @@ var LWC = (function (exports) {
|
|
|
3387
3453
|
function isTemplateRegistered(tpl) {
|
|
3388
3454
|
return signedTemplateSet.has(tpl);
|
|
3389
3455
|
}
|
|
3456
|
+
|
|
3457
|
+
function checkTemplateVersionMismatch(template) {
|
|
3458
|
+
checkVersionMismatch(template, 'template');
|
|
3459
|
+
|
|
3460
|
+
if (!isUndefined$1(template.stylesheets)) {
|
|
3461
|
+
for (const stylesheet of flattenStylesheets(template.stylesheets)) {
|
|
3462
|
+
checkVersionMismatch(stylesheet, 'stylesheet');
|
|
3463
|
+
}
|
|
3464
|
+
}
|
|
3465
|
+
}
|
|
3390
3466
|
/**
|
|
3391
3467
|
* INTERNAL: This function can only be invoked by compiled code. The compiler
|
|
3392
3468
|
* will prevent this function from being imported by userland code.
|
|
@@ -3394,6 +3470,10 @@ var LWC = (function (exports) {
|
|
|
3394
3470
|
|
|
3395
3471
|
|
|
3396
3472
|
function registerTemplate(tpl) {
|
|
3473
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3474
|
+
checkTemplateVersionMismatch(tpl);
|
|
3475
|
+
}
|
|
3476
|
+
|
|
3397
3477
|
signedTemplateSet.add(tpl); // chaining this method as a way to wrap existing
|
|
3398
3478
|
// assignment of templates easily, without too much transformation
|
|
3399
3479
|
|
|
@@ -3689,20 +3769,6 @@ var LWC = (function (exports) {
|
|
|
3689
3769
|
return canRefreshAllInstances;
|
|
3690
3770
|
}
|
|
3691
3771
|
|
|
3692
|
-
function flattenStylesheets(stylesheets) {
|
|
3693
|
-
const list = [];
|
|
3694
|
-
|
|
3695
|
-
for (const stylesheet of stylesheets) {
|
|
3696
|
-
if (!Array.isArray(stylesheet)) {
|
|
3697
|
-
list.push(stylesheet);
|
|
3698
|
-
} else {
|
|
3699
|
-
list.push(...flattenStylesheets(stylesheet));
|
|
3700
|
-
}
|
|
3701
|
-
}
|
|
3702
|
-
|
|
3703
|
-
return list;
|
|
3704
|
-
}
|
|
3705
|
-
|
|
3706
3772
|
function getTemplateOrSwappedTemplate(tpl) {
|
|
3707
3773
|
if (process.env.NODE_ENV === 'production') {
|
|
3708
3774
|
// this method should never leak to prod
|
|
@@ -4533,156 +4599,268 @@ var LWC = (function (exports) {
|
|
|
4533
4599
|
*/
|
|
4534
4600
|
|
|
4535
4601
|
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
move: insertNode,
|
|
4548
|
-
remove: removeNode
|
|
4549
|
-
};
|
|
4550
|
-
const CommentHook = {
|
|
4551
|
-
create: vnode => {
|
|
4552
|
-
const {
|
|
4553
|
-
owner,
|
|
4554
|
-
text
|
|
4555
|
-
} = vnode;
|
|
4556
|
-
const elm = createComment$1(text);
|
|
4557
|
-
linkNodeToShadow(elm, owner);
|
|
4558
|
-
vnode.elm = elm;
|
|
4559
|
-
},
|
|
4560
|
-
update: updateNodeHook,
|
|
4561
|
-
insert: insertNode,
|
|
4562
|
-
move: insertNode,
|
|
4563
|
-
remove: removeNode
|
|
4564
|
-
}; // insert is called after update, which is used somewhere else (via a module)
|
|
4565
|
-
// to mark the vm as inserted, that means we cannot use update as the main channel
|
|
4566
|
-
// to rehydrate when dirty, because sometimes the element is not inserted just yet,
|
|
4567
|
-
// which breaks some invariants. For that reason, we have the following for any
|
|
4568
|
-
// Custom Element that is inserted via a template.
|
|
4569
|
-
|
|
4570
|
-
const ElementHook = {
|
|
4571
|
-
create: vnode => {
|
|
4572
|
-
const {
|
|
4573
|
-
sel,
|
|
4574
|
-
owner,
|
|
4575
|
-
data: {
|
|
4576
|
-
svg
|
|
4577
|
-
}
|
|
4578
|
-
} = vnode;
|
|
4579
|
-
const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
4580
|
-
const elm = createElement$2(sel, namespace);
|
|
4581
|
-
linkNodeToShadow(elm, owner);
|
|
4582
|
-
fallbackElmHook(elm, vnode);
|
|
4583
|
-
vnode.elm = elm;
|
|
4584
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
4585
|
-
},
|
|
4586
|
-
update: (oldVnode, vnode) => {
|
|
4587
|
-
patchElementPropsAndAttrs$1(oldVnode, vnode);
|
|
4588
|
-
patchChildren(vnode.elm, oldVnode.children, vnode.children);
|
|
4589
|
-
},
|
|
4590
|
-
insert: (vnode, parentNode, referenceNode) => {
|
|
4591
|
-
insertNode(vnode, parentNode, referenceNode);
|
|
4592
|
-
createChildrenHook(vnode);
|
|
4593
|
-
},
|
|
4594
|
-
move: insertNode,
|
|
4595
|
-
remove: (vnode, parentNode) => {
|
|
4596
|
-
removeNode(vnode, parentNode);
|
|
4597
|
-
removeChildren(vnode);
|
|
4602
|
+
function patchChildren(c1, c2, parent) {
|
|
4603
|
+
if (hasDynamicChildren(c2)) {
|
|
4604
|
+
updateDynamicChildren(c1, c2, parent);
|
|
4605
|
+
} else {
|
|
4606
|
+
updateStaticChildren(c1, c2, parent);
|
|
4607
|
+
}
|
|
4608
|
+
}
|
|
4609
|
+
|
|
4610
|
+
function patch(n1, n2) {
|
|
4611
|
+
if (n1 === n2) {
|
|
4612
|
+
return;
|
|
4598
4613
|
}
|
|
4599
|
-
};
|
|
4600
|
-
const CustomElementHook = {
|
|
4601
|
-
create: vnode => {
|
|
4602
|
-
const {
|
|
4603
|
-
sel,
|
|
4604
|
-
owner
|
|
4605
|
-
} = vnode;
|
|
4606
|
-
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
4607
|
-
/**
|
|
4608
|
-
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
4609
|
-
* with a callback as the first argument, we could implement a more advanced
|
|
4610
|
-
* mechanism that only passes that argument if the constructor is known to be
|
|
4611
|
-
* an upgradable custom element.
|
|
4612
|
-
*/
|
|
4613
|
-
|
|
4614
|
-
let vm;
|
|
4615
|
-
const elm = new UpgradableConstructor(elm => {
|
|
4616
|
-
// the custom element from the registry is expecting an upgrade callback
|
|
4617
|
-
vm = createViewModelHook(elm, vnode);
|
|
4618
|
-
});
|
|
4619
|
-
linkNodeToShadow(elm, owner);
|
|
4620
|
-
vnode.elm = elm;
|
|
4621
4614
|
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4615
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4616
|
+
if (!isSameVnode(n1, n2)) {
|
|
4617
|
+
throw new Error('Expected these VNodes to be the same: ' + JSON.stringify({
|
|
4618
|
+
sel: n1.sel,
|
|
4619
|
+
key: n1.key
|
|
4620
|
+
}) + ', ' + JSON.stringify({
|
|
4621
|
+
sel: n2.sel,
|
|
4622
|
+
key: n2.key
|
|
4623
|
+
}));
|
|
4626
4624
|
}
|
|
4625
|
+
}
|
|
4627
4626
|
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4627
|
+
switch (n2.type) {
|
|
4628
|
+
case 0
|
|
4629
|
+
/* Text */
|
|
4630
|
+
:
|
|
4631
|
+
patchText(n1, n2);
|
|
4632
|
+
break;
|
|
4633
|
+
|
|
4634
|
+
case 1
|
|
4635
|
+
/* Comment */
|
|
4636
|
+
:
|
|
4637
|
+
patchComment(n1, n2);
|
|
4638
|
+
break;
|
|
4633
4639
|
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
// will happen, but in native, it does allocate the light dom
|
|
4640
|
+
case 2
|
|
4641
|
+
/* Element */
|
|
4642
|
+
:
|
|
4643
|
+
patchElement(n1, n2);
|
|
4644
|
+
break;
|
|
4640
4645
|
|
|
4646
|
+
case 3
|
|
4647
|
+
/* CustomElement */
|
|
4648
|
+
:
|
|
4649
|
+
patchCustomElement(n1, n2);
|
|
4650
|
+
break;
|
|
4651
|
+
}
|
|
4652
|
+
}
|
|
4641
4653
|
|
|
4642
|
-
|
|
4654
|
+
function mount(node, parent, anchor) {
|
|
4655
|
+
switch (node.type) {
|
|
4656
|
+
case 0
|
|
4657
|
+
/* Text */
|
|
4658
|
+
:
|
|
4659
|
+
mountText(node, parent, anchor);
|
|
4660
|
+
break;
|
|
4643
4661
|
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4662
|
+
case 1
|
|
4663
|
+
/* Comment */
|
|
4664
|
+
:
|
|
4665
|
+
mountComment(node, parent, anchor);
|
|
4666
|
+
break;
|
|
4667
|
+
|
|
4668
|
+
case 2
|
|
4669
|
+
/* Element */
|
|
4670
|
+
:
|
|
4671
|
+
mountElement(node, parent, anchor);
|
|
4672
|
+
break;
|
|
4673
|
+
|
|
4674
|
+
case 3
|
|
4675
|
+
/* CustomElement */
|
|
4676
|
+
:
|
|
4677
|
+
mountCustomElement(node, parent, anchor);
|
|
4678
|
+
break;
|
|
4679
|
+
}
|
|
4680
|
+
}
|
|
4649
4681
|
|
|
4682
|
+
function patchText(n1, n2) {
|
|
4683
|
+
n2.elm = n1.elm;
|
|
4650
4684
|
|
|
4651
|
-
|
|
4685
|
+
if (n2.text !== n1.text) {
|
|
4686
|
+
updateTextContent(n2);
|
|
4687
|
+
}
|
|
4688
|
+
}
|
|
4689
|
+
|
|
4690
|
+
function mountText(node, parent, anchor) {
|
|
4691
|
+
const {
|
|
4692
|
+
owner
|
|
4693
|
+
} = node;
|
|
4694
|
+
const textNode = node.elm = createText$1(node.text);
|
|
4695
|
+
linkNodeToShadow(textNode, owner);
|
|
4696
|
+
insertNode(textNode, parent, anchor);
|
|
4697
|
+
}
|
|
4698
|
+
|
|
4699
|
+
function patchComment(n1, n2) {
|
|
4700
|
+
n2.elm = n1.elm; // FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
|
|
4701
|
+
// it is the case today.
|
|
4702
|
+
|
|
4703
|
+
if (n2.text !== n1.text) {
|
|
4704
|
+
updateTextContent(n2);
|
|
4705
|
+
}
|
|
4706
|
+
}
|
|
4707
|
+
|
|
4708
|
+
function mountComment(node, parent, anchor) {
|
|
4709
|
+
const {
|
|
4710
|
+
owner
|
|
4711
|
+
} = node;
|
|
4712
|
+
const commentNode = node.elm = createComment$1(node.text);
|
|
4713
|
+
linkNodeToShadow(commentNode, owner);
|
|
4714
|
+
insertNode(commentNode, parent, anchor);
|
|
4715
|
+
}
|
|
4716
|
+
|
|
4717
|
+
function mountElement(vnode, parent, anchor) {
|
|
4718
|
+
const {
|
|
4719
|
+
sel,
|
|
4720
|
+
owner,
|
|
4721
|
+
data: {
|
|
4722
|
+
svg
|
|
4652
4723
|
}
|
|
4653
|
-
}
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4724
|
+
} = vnode;
|
|
4725
|
+
const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
4726
|
+
const elm = createElement$2(sel, namespace);
|
|
4727
|
+
linkNodeToShadow(elm, owner);
|
|
4728
|
+
fallbackElmHook(elm, vnode);
|
|
4729
|
+
vnode.elm = elm;
|
|
4730
|
+
patchElementPropsAndAttrs$1(null, vnode);
|
|
4731
|
+
insertNode(elm, parent, anchor);
|
|
4732
|
+
mountVNodes(vnode.children, elm, null);
|
|
4733
|
+
}
|
|
4657
4734
|
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4735
|
+
function patchElement(n1, n2) {
|
|
4736
|
+
const elm = n2.elm = n1.elm;
|
|
4737
|
+
patchElementPropsAndAttrs$1(n1, n2);
|
|
4738
|
+
patchChildren(n1.children, n2.children, elm);
|
|
4739
|
+
}
|
|
4740
|
+
|
|
4741
|
+
function mountCustomElement(vnode, parent, anchor) {
|
|
4742
|
+
const {
|
|
4743
|
+
sel,
|
|
4744
|
+
owner
|
|
4745
|
+
} = vnode;
|
|
4746
|
+
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
4747
|
+
/**
|
|
4748
|
+
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
4749
|
+
* with a callback as the first argument, we could implement a more advanced
|
|
4750
|
+
* mechanism that only passes that argument if the constructor is known to be
|
|
4751
|
+
* an upgradable custom element.
|
|
4752
|
+
*/
|
|
4753
|
+
|
|
4754
|
+
let vm;
|
|
4755
|
+
const elm = new UpgradableConstructor(elm => {
|
|
4756
|
+
// the custom element from the registry is expecting an upgrade callback
|
|
4757
|
+
vm = createViewModelHook(elm, vnode);
|
|
4758
|
+
});
|
|
4759
|
+
linkNodeToShadow(elm, owner);
|
|
4760
|
+
vnode.elm = elm;
|
|
4761
|
+
vnode.vm = vm;
|
|
4762
|
+
|
|
4763
|
+
if (vm) {
|
|
4764
|
+
allocateChildren(vnode, vm);
|
|
4765
|
+
} else if (vnode.ctor !== UpgradableConstructor) {
|
|
4766
|
+
throw new TypeError(`Incorrect Component Constructor`);
|
|
4767
|
+
}
|
|
4768
|
+
|
|
4769
|
+
patchElementPropsAndAttrs$1(null, vnode);
|
|
4770
|
+
insertNode(elm, parent, anchor);
|
|
4664
4771
|
|
|
4665
|
-
|
|
4772
|
+
if (vm) {
|
|
4773
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4774
|
+
assert.isTrue(vm.state === 0
|
|
4775
|
+
/* created */
|
|
4776
|
+
, `${vm} cannot be recycled.`);
|
|
4666
4777
|
}
|
|
4667
4778
|
|
|
4668
|
-
|
|
4779
|
+
runConnectedCallback(vm);
|
|
4780
|
+
}
|
|
4781
|
+
|
|
4782
|
+
mountVNodes(vnode.children, elm, null);
|
|
4783
|
+
|
|
4784
|
+
if (vm) {
|
|
4785
|
+
appendVM(vm);
|
|
4786
|
+
}
|
|
4787
|
+
}
|
|
4788
|
+
|
|
4789
|
+
function patchCustomElement(n1, n2) {
|
|
4790
|
+
const elm = n2.elm = n1.elm;
|
|
4791
|
+
const vm = n2.vm = n1.vm;
|
|
4792
|
+
patchElementPropsAndAttrs$1(n1, n2);
|
|
4793
|
+
|
|
4794
|
+
if (!isUndefined$1(vm)) {
|
|
4795
|
+
// in fallback mode, the allocation will always set children to
|
|
4796
|
+
// empty and delegate the real allocation to the slot elements
|
|
4797
|
+
allocateChildren(n2, vm);
|
|
4798
|
+
} // in fallback mode, the children will be always empty, so, nothing
|
|
4799
|
+
// will happen, but in native, it does allocate the light dom
|
|
4800
|
+
|
|
4801
|
+
|
|
4802
|
+
patchChildren(n1.children, n2.children, elm);
|
|
4803
|
+
|
|
4804
|
+
if (!isUndefined$1(vm)) {
|
|
4805
|
+
// this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
4806
|
+
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
4807
|
+
rerenderVM(vm);
|
|
4808
|
+
}
|
|
4809
|
+
}
|
|
4810
|
+
|
|
4811
|
+
function mountVNodes(vnodes, parent, anchor, start = 0, end = vnodes.length) {
|
|
4812
|
+
for (; start < end; ++start) {
|
|
4813
|
+
const vnode = vnodes[start];
|
|
4669
4814
|
|
|
4670
|
-
if (
|
|
4671
|
-
|
|
4815
|
+
if (isVNode(vnode)) {
|
|
4816
|
+
mount(vnode, parent, anchor);
|
|
4672
4817
|
}
|
|
4673
|
-
}
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4818
|
+
}
|
|
4819
|
+
}
|
|
4820
|
+
|
|
4821
|
+
function unmount(vnode, parent, doRemove = false) {
|
|
4822
|
+
const {
|
|
4823
|
+
type,
|
|
4824
|
+
elm
|
|
4825
|
+
} = vnode; // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
4826
|
+
// subtree root, is the only element worth unmounting from the subtree.
|
|
4827
|
+
|
|
4828
|
+
if (doRemove) {
|
|
4829
|
+
removeNode(elm, parent);
|
|
4830
|
+
}
|
|
4831
|
+
|
|
4832
|
+
switch (type) {
|
|
4833
|
+
case 2
|
|
4834
|
+
/* Element */
|
|
4835
|
+
:
|
|
4836
|
+
unmountVNodes(vnode.children, elm);
|
|
4837
|
+
break;
|
|
4838
|
+
|
|
4839
|
+
case 3
|
|
4840
|
+
/* CustomElement */
|
|
4841
|
+
:
|
|
4842
|
+
{
|
|
4843
|
+
const {
|
|
4844
|
+
vm
|
|
4845
|
+
} = vnode; // No need to unmount the children here, `removeVM` will take care of removing the
|
|
4846
|
+
// children.
|
|
4847
|
+
|
|
4848
|
+
if (!isUndefined$1(vm)) {
|
|
4849
|
+
removeVM(vm);
|
|
4850
|
+
}
|
|
4851
|
+
}
|
|
4852
|
+
}
|
|
4853
|
+
}
|
|
4854
|
+
|
|
4855
|
+
function unmountVNodes(vnodes, parent, doRemove = false, start = 0, end = vnodes.length) {
|
|
4856
|
+
for (; start < end; ++start) {
|
|
4857
|
+
const ch = vnodes[start];
|
|
4678
4858
|
|
|
4679
|
-
if (
|
|
4680
|
-
|
|
4681
|
-
// will take care of disconnecting any child VM attached to its shadow as well.
|
|
4682
|
-
removeVM(vm);
|
|
4859
|
+
if (isVNode(ch)) {
|
|
4860
|
+
unmount(ch, parent, doRemove);
|
|
4683
4861
|
}
|
|
4684
4862
|
}
|
|
4685
|
-
}
|
|
4863
|
+
}
|
|
4686
4864
|
|
|
4687
4865
|
function isVNode(vnode) {
|
|
4688
4866
|
return vnode != null;
|
|
@@ -4727,43 +4905,41 @@ var LWC = (function (exports) {
|
|
|
4727
4905
|
}
|
|
4728
4906
|
}
|
|
4729
4907
|
|
|
4730
|
-
function
|
|
4908
|
+
function updateTextContent(vnode) {
|
|
4731
4909
|
const {
|
|
4732
4910
|
elm,
|
|
4733
4911
|
text
|
|
4734
4912
|
} = vnode;
|
|
4735
4913
|
|
|
4736
|
-
if (
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
}
|
|
4914
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4915
|
+
unlockDomMutation();
|
|
4916
|
+
}
|
|
4740
4917
|
|
|
4741
|
-
|
|
4918
|
+
setText$1(elm, text);
|
|
4742
4919
|
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
}
|
|
4920
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4921
|
+
lockDomMutation();
|
|
4746
4922
|
}
|
|
4747
4923
|
}
|
|
4748
4924
|
|
|
4749
|
-
function insertNode(
|
|
4925
|
+
function insertNode(node, parent, anchor) {
|
|
4750
4926
|
if (process.env.NODE_ENV !== 'production') {
|
|
4751
4927
|
unlockDomMutation();
|
|
4752
4928
|
}
|
|
4753
4929
|
|
|
4754
|
-
insert$1(
|
|
4930
|
+
insert$1(node, parent, anchor);
|
|
4755
4931
|
|
|
4756
4932
|
if (process.env.NODE_ENV !== 'production') {
|
|
4757
4933
|
lockDomMutation();
|
|
4758
4934
|
}
|
|
4759
4935
|
}
|
|
4760
4936
|
|
|
4761
|
-
function removeNode(
|
|
4937
|
+
function removeNode(node, parent) {
|
|
4762
4938
|
if (process.env.NODE_ENV !== 'production') {
|
|
4763
4939
|
unlockDomMutation();
|
|
4764
4940
|
}
|
|
4765
4941
|
|
|
4766
|
-
remove$1(
|
|
4942
|
+
remove$1(node, parent);
|
|
4767
4943
|
|
|
4768
4944
|
if (process.env.NODE_ENV !== 'production') {
|
|
4769
4945
|
lockDomMutation();
|
|
@@ -4836,14 +5012,6 @@ var LWC = (function (exports) {
|
|
|
4836
5012
|
}
|
|
4837
5013
|
}
|
|
4838
5014
|
|
|
4839
|
-
function patchChildren(parent, oldCh, newCh) {
|
|
4840
|
-
if (hasDynamicChildren(newCh)) {
|
|
4841
|
-
updateDynamicChildren(parent, oldCh, newCh);
|
|
4842
|
-
} else {
|
|
4843
|
-
updateStaticChildren(parent, oldCh, newCh);
|
|
4844
|
-
}
|
|
4845
|
-
}
|
|
4846
|
-
|
|
4847
5015
|
function allocateChildren(vnode, vm) {
|
|
4848
5016
|
// A component with slots will re-render because:
|
|
4849
5017
|
// 1- There is a change of the internal state.
|
|
@@ -4919,50 +5087,16 @@ var LWC = (function (exports) {
|
|
|
4919
5087
|
return vm;
|
|
4920
5088
|
}
|
|
4921
5089
|
|
|
4922
|
-
function
|
|
5090
|
+
function allocateInSlot(vm, children) {
|
|
5091
|
+
var _a;
|
|
5092
|
+
|
|
4923
5093
|
const {
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
5094
|
+
cmpSlots: oldSlots
|
|
5095
|
+
} = vm;
|
|
5096
|
+
const cmpSlots = vm.cmpSlots = create(null);
|
|
4927
5097
|
|
|
4928
|
-
for (let
|
|
4929
|
-
const
|
|
4930
|
-
|
|
4931
|
-
if (ch != null) {
|
|
4932
|
-
ch.hook.create(ch);
|
|
4933
|
-
ch.hook.insert(ch, elm, null);
|
|
4934
|
-
}
|
|
4935
|
-
}
|
|
4936
|
-
}
|
|
4937
|
-
|
|
4938
|
-
function removeChildren(vnode) {
|
|
4939
|
-
// this method only needs to search on child vnodes from template
|
|
4940
|
-
// to trigger the remove hook just in case some of those children
|
|
4941
|
-
// are custom elements.
|
|
4942
|
-
const {
|
|
4943
|
-
children,
|
|
4944
|
-
elm
|
|
4945
|
-
} = vnode;
|
|
4946
|
-
|
|
4947
|
-
for (let j = 0, len = children.length; j < len; ++j) {
|
|
4948
|
-
const ch = children[j];
|
|
4949
|
-
|
|
4950
|
-
if (!isNull(ch)) {
|
|
4951
|
-
ch.hook.remove(ch, elm);
|
|
4952
|
-
}
|
|
4953
|
-
}
|
|
4954
|
-
}
|
|
4955
|
-
|
|
4956
|
-
function allocateInSlot(vm, children) {
|
|
4957
|
-
var _a;
|
|
4958
|
-
|
|
4959
|
-
const {
|
|
4960
|
-
cmpSlots: oldSlots
|
|
4961
|
-
} = vm;
|
|
4962
|
-
const cmpSlots = vm.cmpSlots = create(null);
|
|
4963
|
-
|
|
4964
|
-
for (let i = 0, len = children.length; i < len; i += 1) {
|
|
4965
|
-
const vnode = children[i];
|
|
5098
|
+
for (let i = 0, len = children.length; i < len; i += 1) {
|
|
5099
|
+
const vnode = children[i];
|
|
4966
5100
|
|
|
4967
5101
|
if (isNull(vnode)) {
|
|
4968
5102
|
continue;
|
|
@@ -5049,28 +5183,7 @@ var LWC = (function (exports) {
|
|
|
5049
5183
|
return map;
|
|
5050
5184
|
}
|
|
5051
5185
|
|
|
5052
|
-
function
|
|
5053
|
-
for (; startIdx <= endIdx; ++startIdx) {
|
|
5054
|
-
const ch = vnodes[startIdx];
|
|
5055
|
-
|
|
5056
|
-
if (isVNode(ch)) {
|
|
5057
|
-
ch.hook.create(ch);
|
|
5058
|
-
ch.hook.insert(ch, parentElm, before);
|
|
5059
|
-
}
|
|
5060
|
-
}
|
|
5061
|
-
}
|
|
5062
|
-
|
|
5063
|
-
function removeVnodes(parentElm, vnodes, startIdx, endIdx) {
|
|
5064
|
-
for (; startIdx <= endIdx; ++startIdx) {
|
|
5065
|
-
const ch = vnodes[startIdx]; // text nodes do not have logic associated to them
|
|
5066
|
-
|
|
5067
|
-
if (isVNode(ch)) {
|
|
5068
|
-
ch.hook.remove(ch, parentElm);
|
|
5069
|
-
}
|
|
5070
|
-
}
|
|
5071
|
-
}
|
|
5072
|
-
|
|
5073
|
-
function updateDynamicChildren(parentElm, oldCh, newCh) {
|
|
5186
|
+
function updateDynamicChildren(oldCh, newCh, parent) {
|
|
5074
5187
|
let oldStartIdx = 0;
|
|
5075
5188
|
let newStartIdx = 0;
|
|
5076
5189
|
let oldEndIdx = oldCh.length - 1;
|
|
@@ -5096,23 +5209,23 @@ var LWC = (function (exports) {
|
|
|
5096
5209
|
} else if (!isVNode(newEndVnode)) {
|
|
5097
5210
|
newEndVnode = newCh[--newEndIdx];
|
|
5098
5211
|
} else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
5099
|
-
|
|
5212
|
+
patch(oldStartVnode, newStartVnode);
|
|
5100
5213
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
5101
5214
|
newStartVnode = newCh[++newStartIdx];
|
|
5102
5215
|
} else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
5103
|
-
|
|
5216
|
+
patch(oldEndVnode, newEndVnode);
|
|
5104
5217
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
5105
5218
|
newEndVnode = newCh[--newEndIdx];
|
|
5106
5219
|
} else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
5107
5220
|
// Vnode moved right
|
|
5108
|
-
|
|
5109
|
-
|
|
5221
|
+
patch(oldStartVnode, newEndVnode);
|
|
5222
|
+
insertNode(oldStartVnode.elm, parent, nextSibling$1(oldEndVnode.elm));
|
|
5110
5223
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
5111
5224
|
newEndVnode = newCh[--newEndIdx];
|
|
5112
5225
|
} else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
5113
5226
|
// Vnode moved left
|
|
5114
|
-
|
|
5115
|
-
newStartVnode.
|
|
5227
|
+
patch(oldEndVnode, newStartVnode);
|
|
5228
|
+
insertNode(newStartVnode.elm, parent, oldStartVnode.elm);
|
|
5116
5229
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
5117
5230
|
newStartVnode = newCh[++newStartIdx];
|
|
5118
5231
|
} else {
|
|
@@ -5124,8 +5237,7 @@ var LWC = (function (exports) {
|
|
|
5124
5237
|
|
|
5125
5238
|
if (isUndefined$1(idxInOld)) {
|
|
5126
5239
|
// New element
|
|
5127
|
-
newStartVnode.
|
|
5128
|
-
newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
|
|
5240
|
+
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
5129
5241
|
newStartVnode = newCh[++newStartIdx];
|
|
5130
5242
|
} else {
|
|
5131
5243
|
elmToMove = oldCh[idxInOld];
|
|
@@ -5133,10 +5245,9 @@ var LWC = (function (exports) {
|
|
|
5133
5245
|
if (isVNode(elmToMove)) {
|
|
5134
5246
|
if (elmToMove.sel !== newStartVnode.sel) {
|
|
5135
5247
|
// New element
|
|
5136
|
-
newStartVnode.
|
|
5137
|
-
newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
|
|
5248
|
+
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
5138
5249
|
} else {
|
|
5139
|
-
|
|
5250
|
+
patch(elmToMove, newStartVnode); // Delete the old child, but copy the array since it is read-only.
|
|
5140
5251
|
// The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
|
|
5141
5252
|
// so we only care about the `oldCh` object inside this function.
|
|
5142
5253
|
// To avoid cloning over and over again, we check `clonedOldCh`
|
|
@@ -5149,7 +5260,7 @@ var LWC = (function (exports) {
|
|
|
5149
5260
|
|
|
5150
5261
|
|
|
5151
5262
|
oldCh[idxInOld] = undefined;
|
|
5152
|
-
|
|
5263
|
+
insertNode(elmToMove.elm, parent, oldStartVnode.elm);
|
|
5153
5264
|
}
|
|
5154
5265
|
}
|
|
5155
5266
|
|
|
@@ -5170,65 +5281,55 @@ var LWC = (function (exports) {
|
|
|
5170
5281
|
} while (!isVNode(n) && i < newChEnd);
|
|
5171
5282
|
|
|
5172
5283
|
before = isVNode(n) ? n.elm : null;
|
|
5173
|
-
|
|
5284
|
+
mountVNodes(newCh, parent, before, newStartIdx, newEndIdx + 1);
|
|
5174
5285
|
} else {
|
|
5175
|
-
|
|
5286
|
+
unmountVNodes(oldCh, parent, true, oldStartIdx, oldEndIdx + 1);
|
|
5176
5287
|
}
|
|
5177
5288
|
}
|
|
5178
5289
|
}
|
|
5179
5290
|
|
|
5180
|
-
function updateStaticChildren(
|
|
5181
|
-
const
|
|
5182
|
-
const
|
|
5291
|
+
function updateStaticChildren(c1, c2, parent) {
|
|
5292
|
+
const c1Length = c1.length;
|
|
5293
|
+
const c2Length = c2.length;
|
|
5183
5294
|
|
|
5184
|
-
if (
|
|
5295
|
+
if (c1Length === 0) {
|
|
5185
5296
|
// the old list is empty, we can directly insert anything new
|
|
5186
|
-
|
|
5297
|
+
mountVNodes(c2, parent, null);
|
|
5187
5298
|
return;
|
|
5188
5299
|
}
|
|
5189
5300
|
|
|
5190
|
-
if (
|
|
5301
|
+
if (c2Length === 0) {
|
|
5191
5302
|
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
5192
5303
|
// this is the case in which the dynamic children of an if-directive should be removed
|
|
5193
|
-
|
|
5304
|
+
unmountVNodes(c1, parent, true);
|
|
5194
5305
|
return;
|
|
5195
5306
|
} // if the old list is not empty, the new list MUST have the same
|
|
5196
5307
|
// amount of nodes, that's why we call this static children
|
|
5197
5308
|
|
|
5198
5309
|
|
|
5199
|
-
let
|
|
5310
|
+
let anchor = null;
|
|
5200
5311
|
|
|
5201
|
-
for (let i =
|
|
5202
|
-
const
|
|
5203
|
-
const
|
|
5312
|
+
for (let i = c2Length - 1; i >= 0; i -= 1) {
|
|
5313
|
+
const n1 = c1[i];
|
|
5314
|
+
const n2 = c2[i];
|
|
5204
5315
|
|
|
5205
|
-
if (
|
|
5206
|
-
if (isVNode(
|
|
5207
|
-
if (isVNode(
|
|
5208
|
-
// both vnodes
|
|
5209
|
-
|
|
5210
|
-
|
|
5316
|
+
if (n2 !== n1) {
|
|
5317
|
+
if (isVNode(n1)) {
|
|
5318
|
+
if (isVNode(n2)) {
|
|
5319
|
+
// both vnodes are equivalent, and we just need to patch them
|
|
5320
|
+
patch(n1, n2);
|
|
5321
|
+
anchor = n2.elm;
|
|
5211
5322
|
} else {
|
|
5212
5323
|
// removing the old vnode since the new one is null
|
|
5213
|
-
|
|
5324
|
+
unmount(n1, parent, true);
|
|
5214
5325
|
}
|
|
5215
|
-
} else if (isVNode(
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
vnode.hook.insert(vnode, parentElm, referenceElm);
|
|
5220
|
-
referenceElm = vnode.elm;
|
|
5326
|
+
} else if (isVNode(n2)) {
|
|
5327
|
+
mount(n2, parent, anchor);
|
|
5328
|
+
anchor = n2.elm;
|
|
5221
5329
|
}
|
|
5222
5330
|
}
|
|
5223
5331
|
}
|
|
5224
5332
|
}
|
|
5225
|
-
|
|
5226
|
-
function patchVnode(oldVnode, vnode) {
|
|
5227
|
-
if (oldVnode !== vnode) {
|
|
5228
|
-
vnode.elm = oldVnode.elm;
|
|
5229
|
-
vnode.hook.update(oldVnode, vnode);
|
|
5230
|
-
}
|
|
5231
|
-
}
|
|
5232
5333
|
/*
|
|
5233
5334
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
5234
5335
|
* All rights reserved.
|
|
@@ -5280,7 +5381,6 @@ var LWC = (function (exports) {
|
|
|
5280
5381
|
children,
|
|
5281
5382
|
elm,
|
|
5282
5383
|
key,
|
|
5283
|
-
hook: ElementHook,
|
|
5284
5384
|
owner: vmBeingRendered
|
|
5285
5385
|
};
|
|
5286
5386
|
} // [t]ab[i]ndex function
|
|
@@ -5367,7 +5467,7 @@ var LWC = (function (exports) {
|
|
|
5367
5467
|
const {
|
|
5368
5468
|
key
|
|
5369
5469
|
} = data;
|
|
5370
|
-
let elm;
|
|
5470
|
+
let elm, aChildren, vm;
|
|
5371
5471
|
const vnode = {
|
|
5372
5472
|
type: 3
|
|
5373
5473
|
/* CustomElement */
|
|
@@ -5377,11 +5477,11 @@ var LWC = (function (exports) {
|
|
|
5377
5477
|
children,
|
|
5378
5478
|
elm,
|
|
5379
5479
|
key,
|
|
5380
|
-
hook: CustomElementHook,
|
|
5381
5480
|
ctor: Ctor,
|
|
5382
5481
|
owner: vmBeingRendered,
|
|
5383
|
-
mode: 'open'
|
|
5384
|
-
|
|
5482
|
+
mode: 'open',
|
|
5483
|
+
aChildren,
|
|
5484
|
+
vm
|
|
5385
5485
|
};
|
|
5386
5486
|
addVNodeToChildLWC(vnode);
|
|
5387
5487
|
return vnode;
|
|
@@ -5511,7 +5611,6 @@ var LWC = (function (exports) {
|
|
|
5511
5611
|
text,
|
|
5512
5612
|
elm,
|
|
5513
5613
|
key,
|
|
5514
|
-
hook: TextHook,
|
|
5515
5614
|
owner: getVMBeingRendered()
|
|
5516
5615
|
};
|
|
5517
5616
|
} // [co]mment node
|
|
@@ -5527,7 +5626,6 @@ var LWC = (function (exports) {
|
|
|
5527
5626
|
text,
|
|
5528
5627
|
elm,
|
|
5529
5628
|
key,
|
|
5530
|
-
hook: CommentHook,
|
|
5531
5629
|
owner: getVMBeingRendered()
|
|
5532
5630
|
};
|
|
5533
5631
|
} // [d]ynamic text
|
|
@@ -6394,6 +6492,10 @@ var LWC = (function (exports) {
|
|
|
6394
6492
|
function registerComponent(Ctor, {
|
|
6395
6493
|
tmpl
|
|
6396
6494
|
}) {
|
|
6495
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6496
|
+
checkVersionMismatch(Ctor, 'component');
|
|
6497
|
+
}
|
|
6498
|
+
|
|
6397
6499
|
signedTemplateMap.set(Ctor, tmpl); // chaining this method as a way to wrap existing assignment of component constructor easily,
|
|
6398
6500
|
// without too much transformation
|
|
6399
6501
|
|
|
@@ -6518,7 +6620,7 @@ var LWC = (function (exports) {
|
|
|
6518
6620
|
*/
|
|
6519
6621
|
|
|
6520
6622
|
|
|
6521
|
-
function hydrate
|
|
6623
|
+
function hydrate(vnode, node) {
|
|
6522
6624
|
switch (vnode.type) {
|
|
6523
6625
|
case 0
|
|
6524
6626
|
/* Text */
|
|
@@ -6550,16 +6652,18 @@ var LWC = (function (exports) {
|
|
|
6550
6652
|
var _a;
|
|
6551
6653
|
|
|
6552
6654
|
if (process.env.NODE_ENV !== 'production') {
|
|
6553
|
-
|
|
6554
|
-
|
|
6655
|
+
validateNodeType(vnode, node, 3
|
|
6656
|
+
/* TEXT */
|
|
6657
|
+
);
|
|
6658
|
+
const nodeValue = getProperty$1(node, 'nodeValue');
|
|
6555
6659
|
|
|
6556
|
-
if (
|
|
6660
|
+
if (nodeValue !== vnode.text && !(nodeValue === '\u200D' && vnode.text === '')) {
|
|
6557
6661
|
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);
|
|
6558
6662
|
}
|
|
6559
6663
|
} // always set the text value to the one from the vnode.
|
|
6560
6664
|
|
|
6561
6665
|
|
|
6562
|
-
node
|
|
6666
|
+
setText$1(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
6563
6667
|
vnode.elm = node;
|
|
6564
6668
|
}
|
|
6565
6669
|
|
|
@@ -6567,23 +6671,25 @@ var LWC = (function (exports) {
|
|
|
6567
6671
|
var _a;
|
|
6568
6672
|
|
|
6569
6673
|
if (process.env.NODE_ENV !== 'production') {
|
|
6570
|
-
|
|
6571
|
-
|
|
6674
|
+
validateNodeType(vnode, node, 8
|
|
6675
|
+
/* COMMENT */
|
|
6676
|
+
);
|
|
6572
6677
|
|
|
6573
|
-
if (node
|
|
6678
|
+
if (getProperty$1(node, 'nodeValue') !== vnode.text) {
|
|
6574
6679
|
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vnode.owner);
|
|
6575
6680
|
}
|
|
6576
6681
|
} // always set the text value to the one from the vnode.
|
|
6577
6682
|
|
|
6578
6683
|
|
|
6579
|
-
node
|
|
6684
|
+
setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
6580
6685
|
vnode.elm = node;
|
|
6581
6686
|
}
|
|
6582
6687
|
|
|
6583
6688
|
function hydrateElement(vnode, node) {
|
|
6584
6689
|
if (process.env.NODE_ENV !== 'production') {
|
|
6585
|
-
|
|
6586
|
-
|
|
6690
|
+
validateNodeType(vnode, node, 1
|
|
6691
|
+
/* ELEMENT */
|
|
6692
|
+
);
|
|
6587
6693
|
validateElement(vnode, node);
|
|
6588
6694
|
}
|
|
6589
6695
|
|
|
@@ -6604,13 +6710,13 @@ var LWC = (function (exports) {
|
|
|
6604
6710
|
} = vnode.data;
|
|
6605
6711
|
|
|
6606
6712
|
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
6607
|
-
if (elm
|
|
6713
|
+
if (getProperty$1(elm, 'innerHTML') === props.innerHTML) {
|
|
6608
6714
|
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
|
6609
6715
|
vnode.data = Object.assign(Object.assign({}, vnode.data), {
|
|
6610
6716
|
props: cloneAndOmitKey(props, 'innerHTML')
|
|
6611
6717
|
});
|
|
6612
6718
|
} else {
|
|
6613
|
-
logWarn(`Mismatch hydrating element <${elm
|
|
6719
|
+
logWarn(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
|
|
6614
6720
|
}
|
|
6615
6721
|
}
|
|
6616
6722
|
}
|
|
@@ -6618,19 +6724,19 @@ var LWC = (function (exports) {
|
|
|
6618
6724
|
patchElementPropsAndAttrs(vnode);
|
|
6619
6725
|
|
|
6620
6726
|
if (!isDomManual) {
|
|
6621
|
-
hydrateChildren(vnode.elm
|
|
6727
|
+
hydrateChildren(getChildNodes$1(vnode.elm), vnode.children, vnode.owner);
|
|
6622
6728
|
}
|
|
6623
6729
|
}
|
|
6624
6730
|
|
|
6625
6731
|
function hydrateCustomElement(vnode, node) {
|
|
6626
6732
|
if (process.env.NODE_ENV !== 'production') {
|
|
6627
|
-
|
|
6628
|
-
|
|
6733
|
+
validateNodeType(vnode, node, 1
|
|
6734
|
+
/* ELEMENT */
|
|
6735
|
+
);
|
|
6629
6736
|
validateElement(vnode, node);
|
|
6630
6737
|
}
|
|
6631
6738
|
|
|
6632
6739
|
const elm = node;
|
|
6633
|
-
vnode.elm = elm;
|
|
6634
6740
|
const {
|
|
6635
6741
|
sel,
|
|
6636
6742
|
mode,
|
|
@@ -6642,6 +6748,8 @@ var LWC = (function (exports) {
|
|
|
6642
6748
|
owner,
|
|
6643
6749
|
tagName: sel
|
|
6644
6750
|
});
|
|
6751
|
+
vnode.elm = elm;
|
|
6752
|
+
vnode.vm = vm;
|
|
6645
6753
|
allocateChildren(vnode, vm);
|
|
6646
6754
|
patchElementPropsAndAttrs(vnode); // Insert hook section:
|
|
6647
6755
|
|
|
@@ -6658,7 +6766,7 @@ var LWC = (function (exports) {
|
|
|
6658
6766
|
) {
|
|
6659
6767
|
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
6660
6768
|
// Note: for Light DOM, this is handled while hydrating the VM
|
|
6661
|
-
hydrateChildren(vnode.elm
|
|
6769
|
+
hydrateChildren(getChildNodes$1(vnode.elm), vnode.children, vm);
|
|
6662
6770
|
}
|
|
6663
6771
|
|
|
6664
6772
|
hydrateVM(vm);
|
|
@@ -6681,7 +6789,7 @@ var LWC = (function (exports) {
|
|
|
6681
6789
|
|
|
6682
6790
|
if (!isNull(childVnode)) {
|
|
6683
6791
|
const childNode = elmChildren[childNodeIndex];
|
|
6684
|
-
hydrate
|
|
6792
|
+
hydrate(childVnode, childNode);
|
|
6685
6793
|
childNodeIndex++;
|
|
6686
6794
|
}
|
|
6687
6795
|
}
|
|
@@ -6697,15 +6805,15 @@ var LWC = (function (exports) {
|
|
|
6697
6805
|
}
|
|
6698
6806
|
|
|
6699
6807
|
function validateNodeType(vnode, node, nodeType) {
|
|
6700
|
-
if (node
|
|
6808
|
+
if (getProperty$1(node, 'nodeType') !== nodeType) {
|
|
6701
6809
|
logError('Hydration mismatch: incorrect node type received', vnode.owner);
|
|
6702
6810
|
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
6703
6811
|
}
|
|
6704
6812
|
}
|
|
6705
6813
|
|
|
6706
6814
|
function validateElement(vnode, elm) {
|
|
6707
|
-
if (vnode.sel.toLowerCase() !== elm
|
|
6708
|
-
logError(`Hydration mismatch: expecting element with tag "${vnode.sel.toLowerCase()}" but found "${elm
|
|
6815
|
+
if (vnode.sel.toLowerCase() !== getProperty$1(elm, 'tagName').toLowerCase()) {
|
|
6816
|
+
logError(`Hydration mismatch: expecting element with tag "${vnode.sel.toLowerCase()}" but found "${getProperty$1(elm, 'tagName').toLowerCase()}".`, vnode.owner);
|
|
6709
6817
|
throwHydrationError();
|
|
6710
6818
|
}
|
|
6711
6819
|
|
|
@@ -6732,7 +6840,7 @@ var LWC = (function (exports) {
|
|
|
6732
6840
|
const elmAttrValue = getAttribute$1(elm, attrName);
|
|
6733
6841
|
|
|
6734
6842
|
if (String(attrValue) !== elmAttrValue) {
|
|
6735
|
-
logError(`Mismatch hydrating element <${elm
|
|
6843
|
+
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
|
|
6736
6844
|
nodesAreCompatible = false;
|
|
6737
6845
|
}
|
|
6738
6846
|
}
|
|
@@ -6750,7 +6858,7 @@ var LWC = (function (exports) {
|
|
|
6750
6858
|
let nodesAreCompatible = true;
|
|
6751
6859
|
let vnodeClassName;
|
|
6752
6860
|
|
|
6753
|
-
if (!isUndefined$1(className) && String(className) !== elm
|
|
6861
|
+
if (!isUndefined$1(className) && String(className) !== getProperty$1(elm, 'className')) {
|
|
6754
6862
|
// className is used when class is bound to an expr.
|
|
6755
6863
|
nodesAreCompatible = false;
|
|
6756
6864
|
vnodeClassName = className;
|
|
@@ -6775,7 +6883,7 @@ var LWC = (function (exports) {
|
|
|
6775
6883
|
}
|
|
6776
6884
|
|
|
6777
6885
|
if (!nodesAreCompatible) {
|
|
6778
|
-
logError(`Mismatch hydrating element <${elm
|
|
6886
|
+
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected "${vnodeClassName}" but found "${getProperty$1(elm, 'className')}"`, vnode.owner);
|
|
6779
6887
|
}
|
|
6780
6888
|
|
|
6781
6889
|
return nodesAreCompatible;
|
|
@@ -6822,7 +6930,7 @@ var LWC = (function (exports) {
|
|
|
6822
6930
|
|
|
6823
6931
|
if (!nodesAreCompatible) {
|
|
6824
6932
|
// style is used when class is bound to an expr.
|
|
6825
|
-
logError(`Mismatch hydrating element <${elm
|
|
6933
|
+
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "style" has different values, expected "${vnodeStyle}" but found "${elmStyle}".`, vnode.owner);
|
|
6826
6934
|
}
|
|
6827
6935
|
|
|
6828
6936
|
return nodesAreCompatible;
|
|
@@ -6892,7 +7000,19 @@ var LWC = (function (exports) {
|
|
|
6892
7000
|
}
|
|
6893
7001
|
|
|
6894
7002
|
function hydrateVM(vm) {
|
|
6895
|
-
|
|
7003
|
+
if (isTrue(vm.isDirty)) {
|
|
7004
|
+
// manually diffing/patching here.
|
|
7005
|
+
// This routine is:
|
|
7006
|
+
// patchShadowRoot(vm, children);
|
|
7007
|
+
// -> addVnodes.
|
|
7008
|
+
const children = renderComponent(vm);
|
|
7009
|
+
vm.children = children;
|
|
7010
|
+
const vmChildren = vm.renderMode === 0
|
|
7011
|
+
/* Light */
|
|
7012
|
+
? getChildNodes$1(vm.elm) : getChildNodes$1(vm.elm.shadowRoot);
|
|
7013
|
+
hydrateChildren(vmChildren, children, vm);
|
|
7014
|
+
runRenderedCallback(vm);
|
|
7015
|
+
}
|
|
6896
7016
|
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
6897
7017
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
6898
7018
|
|
|
@@ -7043,7 +7163,11 @@ var LWC = (function (exports) {
|
|
|
7043
7163
|
/* Native */
|
|
7044
7164
|
;
|
|
7045
7165
|
} else if (isNativeShadowDefined$1) {
|
|
7046
|
-
if (
|
|
7166
|
+
if (runtimeFlags.DISABLE_MIXED_SHADOW_MODE) {
|
|
7167
|
+
shadowMode = 1
|
|
7168
|
+
/* Synthetic */
|
|
7169
|
+
;
|
|
7170
|
+
} else if (def.shadowSupportMode === "any"
|
|
7047
7171
|
/* Any */
|
|
7048
7172
|
) {
|
|
7049
7173
|
shadowMode = 0
|
|
@@ -7123,22 +7247,6 @@ var LWC = (function (exports) {
|
|
|
7123
7247
|
}
|
|
7124
7248
|
}
|
|
7125
7249
|
|
|
7126
|
-
function hydrate(vm) {
|
|
7127
|
-
if (isTrue(vm.isDirty)) {
|
|
7128
|
-
// manually diffing/patching here.
|
|
7129
|
-
// This routine is:
|
|
7130
|
-
// patchShadowRoot(vm, children);
|
|
7131
|
-
// -> addVnodes.
|
|
7132
|
-
const children = renderComponent(vm);
|
|
7133
|
-
vm.children = children;
|
|
7134
|
-
const vmChildren = vm.renderMode === 0
|
|
7135
|
-
/* Light */
|
|
7136
|
-
? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;
|
|
7137
|
-
hydrateChildren(vmChildren, children, vm);
|
|
7138
|
-
runRenderedCallback(vm);
|
|
7139
|
-
}
|
|
7140
|
-
}
|
|
7141
|
-
|
|
7142
7250
|
function patchShadowRoot(vm, newCh) {
|
|
7143
7251
|
const {
|
|
7144
7252
|
renderRoot,
|
|
@@ -7158,7 +7266,7 @@ var LWC = (function (exports) {
|
|
|
7158
7266
|
, vm);
|
|
7159
7267
|
}, () => {
|
|
7160
7268
|
// job
|
|
7161
|
-
patchChildren(
|
|
7269
|
+
patchChildren(oldCh, newCh, renderRoot);
|
|
7162
7270
|
}, () => {
|
|
7163
7271
|
// post
|
|
7164
7272
|
logOperationEnd(2
|
|
@@ -7905,7 +8013,7 @@ var LWC = (function (exports) {
|
|
|
7905
8013
|
hooksAreSet = true;
|
|
7906
8014
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
7907
8015
|
}
|
|
7908
|
-
/* version: 2.
|
|
8016
|
+
/* version: 2.10.0 */
|
|
7909
8017
|
|
|
7910
8018
|
/*
|
|
7911
8019
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7931,6 +8039,7 @@ var LWC = (function (exports) {
|
|
|
7931
8039
|
// See also: https://github.com/whatwg/webidl/issues/1027#issuecomment-934510070
|
|
7932
8040
|
|
|
7933
8041
|
const supportsConstructableStyleSheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets);
|
|
8042
|
+
const supportsMutableAdoptedStyleSheets = supportsConstructableStyleSheets && getOwnPropertyDescriptor$1(document.adoptedStyleSheets, 'length').writable;
|
|
7934
8043
|
const styleElements = create(null);
|
|
7935
8044
|
const styleSheets = create(null);
|
|
7936
8045
|
const nodesToStyleSheets = new WeakMap();
|
|
@@ -7974,7 +8083,13 @@ var LWC = (function (exports) {
|
|
|
7974
8083
|
}
|
|
7975
8084
|
|
|
7976
8085
|
if (!target.adoptedStyleSheets.includes(styleSheet)) {
|
|
7977
|
-
|
|
8086
|
+
if (supportsMutableAdoptedStyleSheets) {
|
|
8087
|
+
// This is only supported in later versions of Chromium:
|
|
8088
|
+
// https://chromestatus.com/feature/5638996492288000
|
|
8089
|
+
target.adoptedStyleSheets.push(styleSheet);
|
|
8090
|
+
} else {
|
|
8091
|
+
target.adoptedStyleSheets = [...target.adoptedStyleSheets, styleSheet];
|
|
8092
|
+
}
|
|
7978
8093
|
}
|
|
7979
8094
|
}
|
|
7980
8095
|
|
|
@@ -8276,6 +8391,156 @@ var LWC = (function (exports) {
|
|
|
8276
8391
|
setSetText(setText);
|
|
8277
8392
|
setSsr(ssr);
|
|
8278
8393
|
setAddEventListener(addEventListener);
|
|
8394
|
+
/*
|
|
8395
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
8396
|
+
* All rights reserved.
|
|
8397
|
+
* SPDX-License-Identifier: MIT
|
|
8398
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8399
|
+
*/
|
|
8400
|
+
|
|
8401
|
+
function resetShadowRootAndLightDom(element, Ctor) {
|
|
8402
|
+
if (element.shadowRoot) {
|
|
8403
|
+
const shadowRoot = element.shadowRoot;
|
|
8404
|
+
|
|
8405
|
+
while (!isNull(shadowRoot.firstChild)) {
|
|
8406
|
+
shadowRoot.removeChild(shadowRoot.firstChild);
|
|
8407
|
+
}
|
|
8408
|
+
}
|
|
8409
|
+
|
|
8410
|
+
if (Ctor.renderMode === 'light') {
|
|
8411
|
+
while (!isNull(element.firstChild)) {
|
|
8412
|
+
element.removeChild(element.firstChild);
|
|
8413
|
+
}
|
|
8414
|
+
}
|
|
8415
|
+
}
|
|
8416
|
+
|
|
8417
|
+
function createVMWithProps(element, Ctor, props) {
|
|
8418
|
+
createVM(element, Ctor, {
|
|
8419
|
+
mode: 'open',
|
|
8420
|
+
owner: null,
|
|
8421
|
+
tagName: element.tagName.toLowerCase()
|
|
8422
|
+
});
|
|
8423
|
+
|
|
8424
|
+
for (const [key, value] of Object.entries(props)) {
|
|
8425
|
+
element[key] = value;
|
|
8426
|
+
}
|
|
8427
|
+
}
|
|
8428
|
+
|
|
8429
|
+
function hydrateComponent(element, Ctor, props = {}) {
|
|
8430
|
+
if (!(element instanceof Element)) {
|
|
8431
|
+
throw new TypeError(`"hydrateComponent" expects a valid DOM element as the first parameter but instead received ${element}.`);
|
|
8432
|
+
}
|
|
8433
|
+
|
|
8434
|
+
if (!isFunction$1(Ctor)) {
|
|
8435
|
+
throw new TypeError(`"hydrateComponent" expects a valid component constructor as the second parameter but instead received ${Ctor}.`);
|
|
8436
|
+
}
|
|
8437
|
+
|
|
8438
|
+
if (!isObject(props) || isNull(props)) {
|
|
8439
|
+
throw new TypeError(`"hydrateComponent" expects an object as the third parameter but instead received ${props}.`);
|
|
8440
|
+
}
|
|
8441
|
+
|
|
8442
|
+
if (getAssociatedVMIfPresent(element)) {
|
|
8443
|
+
/* eslint-disable-next-line no-console */
|
|
8444
|
+
console.warn(`"hydrateComponent" expects an element that is not hydrated.`, element);
|
|
8445
|
+
return;
|
|
8446
|
+
}
|
|
8447
|
+
|
|
8448
|
+
try {
|
|
8449
|
+
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
8450
|
+
// and uses the same algo to create the stylesheets as in SSR.
|
|
8451
|
+
setIsHydrating(true);
|
|
8452
|
+
createVMWithProps(element, Ctor, props);
|
|
8453
|
+
hydrateRootElement(element); // set it back since now we finished hydration.
|
|
8454
|
+
|
|
8455
|
+
setIsHydrating(false);
|
|
8456
|
+
} catch (e) {
|
|
8457
|
+
// Fallback: In case there's an error while hydrating, let's log the error, and replace the element content
|
|
8458
|
+
// with the client generated DOM.
|
|
8459
|
+
|
|
8460
|
+
/* eslint-disable-next-line no-console */
|
|
8461
|
+
console.error('Recovering from error while hydrating: ', e); // We want to preserve the element, so we need to reset the shadowRoot and light dom.
|
|
8462
|
+
|
|
8463
|
+
resetShadowRootAndLightDom(element, Ctor); // we need to recreate the vm with the hydration flag on, so it re-uses the existing shadowRoot.
|
|
8464
|
+
|
|
8465
|
+
createVMWithProps(element, Ctor, props);
|
|
8466
|
+
setIsHydrating(false);
|
|
8467
|
+
connectRootElement(element);
|
|
8468
|
+
} finally {
|
|
8469
|
+
// in case there's an error during recovery
|
|
8470
|
+
setIsHydrating(false);
|
|
8471
|
+
}
|
|
8472
|
+
}
|
|
8473
|
+
/*
|
|
8474
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
8475
|
+
* All rights reserved.
|
|
8476
|
+
* SPDX-License-Identifier: MIT
|
|
8477
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8478
|
+
*/
|
|
8479
|
+
|
|
8480
|
+
/**
|
|
8481
|
+
* This function builds a Web Component class from a LWC constructor so it can be
|
|
8482
|
+
* registered as a new element via customElements.define() at any given time.
|
|
8483
|
+
*
|
|
8484
|
+
* @deprecated since version 1.3.11
|
|
8485
|
+
*
|
|
8486
|
+
* @example
|
|
8487
|
+
* ```
|
|
8488
|
+
* import { buildCustomElementConstructor } from 'lwc';
|
|
8489
|
+
* import Foo from 'ns/foo';
|
|
8490
|
+
* const WC = buildCustomElementConstructor(Foo);
|
|
8491
|
+
* customElements.define('x-foo', WC);
|
|
8492
|
+
* const elm = document.createElement('x-foo');
|
|
8493
|
+
* ```
|
|
8494
|
+
*/
|
|
8495
|
+
|
|
8496
|
+
|
|
8497
|
+
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
8498
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
8499
|
+
/* eslint-disable-next-line no-console */
|
|
8500
|
+
console.warn('Deprecated function called: "buildCustomElementConstructor" function is deprecated and it will be removed.' + `Use "${Ctor.name}.CustomElementConstructor" static property of the component constructor to access the corresponding custom element constructor instead.`);
|
|
8501
|
+
}
|
|
8502
|
+
|
|
8503
|
+
return Ctor.CustomElementConstructor;
|
|
8504
|
+
} // Note: WeakSet is not supported in IE11, and the polyfill is not performant enough.
|
|
8505
|
+
// This WeakSet usage is valid because this functionality is not meant to run in IE11.
|
|
8506
|
+
|
|
8507
|
+
|
|
8508
|
+
const hydratedCustomElements = new WeakSet();
|
|
8509
|
+
|
|
8510
|
+
function buildCustomElementConstructor(Ctor) {
|
|
8511
|
+
const HtmlPrototype = getComponentHtmlPrototype(Ctor);
|
|
8512
|
+
return class extends HtmlPrototype {
|
|
8513
|
+
constructor() {
|
|
8514
|
+
super();
|
|
8515
|
+
|
|
8516
|
+
if (this.isConnected) {
|
|
8517
|
+
// this if block is hit when there's already an un-upgraded element in the DOM with the same tag name.
|
|
8518
|
+
hydrateComponent(this, Ctor, {});
|
|
8519
|
+
hydratedCustomElements.add(this);
|
|
8520
|
+
} else {
|
|
8521
|
+
createVM(this, Ctor, {
|
|
8522
|
+
mode: 'open',
|
|
8523
|
+
owner: null,
|
|
8524
|
+
tagName: this.tagName
|
|
8525
|
+
});
|
|
8526
|
+
}
|
|
8527
|
+
}
|
|
8528
|
+
|
|
8529
|
+
connectedCallback() {
|
|
8530
|
+
if (hydratedCustomElements.has(this)) {
|
|
8531
|
+
// This is an un-upgraded element that was hydrated in the constructor.
|
|
8532
|
+
hydratedCustomElements.delete(this);
|
|
8533
|
+
} else {
|
|
8534
|
+
connectRootElement(this);
|
|
8535
|
+
}
|
|
8536
|
+
}
|
|
8537
|
+
|
|
8538
|
+
disconnectedCallback() {
|
|
8539
|
+
disconnectRootElement(this);
|
|
8540
|
+
}
|
|
8541
|
+
|
|
8542
|
+
};
|
|
8543
|
+
}
|
|
8279
8544
|
/*
|
|
8280
8545
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
8281
8546
|
* All rights reserved.
|
|
@@ -8285,6 +8550,7 @@ var LWC = (function (exports) {
|
|
|
8285
8550
|
// TODO [#2472]: Remove this workaround when appropriate.
|
|
8286
8551
|
// eslint-disable-next-line lwc-internal/no-global-node
|
|
8287
8552
|
|
|
8553
|
+
|
|
8288
8554
|
const _Node$1 = Node;
|
|
8289
8555
|
const ConnectingSlot = new WeakMap();
|
|
8290
8556
|
const DisconnectingSlot = new WeakMap();
|
|
@@ -8393,118 +8659,6 @@ var LWC = (function (exports) {
|
|
|
8393
8659
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8394
8660
|
*/
|
|
8395
8661
|
|
|
8396
|
-
|
|
8397
|
-
function hydrateComponent(element, Ctor, props = {}) {
|
|
8398
|
-
if (!(element instanceof Element)) {
|
|
8399
|
-
throw new TypeError(`"hydrateComponent" expects a valid DOM element as the first parameter but instead received ${element}.`);
|
|
8400
|
-
}
|
|
8401
|
-
|
|
8402
|
-
if (!isFunction$1(Ctor)) {
|
|
8403
|
-
throw new TypeError(`"hydrateComponent" expects a valid component constructor as the second parameter but instead received ${Ctor}.`);
|
|
8404
|
-
}
|
|
8405
|
-
|
|
8406
|
-
if (!isObject(props) || isNull(props)) {
|
|
8407
|
-
throw new TypeError(`"hydrateComponent" expects an object as the third parameter but instead received ${props}.`);
|
|
8408
|
-
}
|
|
8409
|
-
|
|
8410
|
-
try {
|
|
8411
|
-
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
8412
|
-
// and uses the same algo to create the stylesheets as in SSR.
|
|
8413
|
-
setIsHydrating(true);
|
|
8414
|
-
createVM(element, Ctor, {
|
|
8415
|
-
mode: 'open',
|
|
8416
|
-
owner: null,
|
|
8417
|
-
tagName: element.tagName.toLowerCase()
|
|
8418
|
-
});
|
|
8419
|
-
|
|
8420
|
-
for (const [key, value] of Object.entries(props)) {
|
|
8421
|
-
element[key] = value;
|
|
8422
|
-
}
|
|
8423
|
-
|
|
8424
|
-
hydrateRootElement(element); // set it back since now we finished hydration.
|
|
8425
|
-
|
|
8426
|
-
setIsHydrating(false);
|
|
8427
|
-
} catch (e) {
|
|
8428
|
-
// Fallback: In case there's an error while hydrating, let's log the error, and replace the element with
|
|
8429
|
-
// the client generated DOM.
|
|
8430
|
-
|
|
8431
|
-
/* eslint-disable-next-line no-console */
|
|
8432
|
-
console.error('Recovering from error while hydrating: ', e);
|
|
8433
|
-
setIsHydrating(false);
|
|
8434
|
-
const newElem = createElement(element.tagName, {
|
|
8435
|
-
is: Ctor,
|
|
8436
|
-
mode: 'open'
|
|
8437
|
-
});
|
|
8438
|
-
|
|
8439
|
-
for (const [key, value] of Object.entries(props)) {
|
|
8440
|
-
newElem[key] = value;
|
|
8441
|
-
}
|
|
8442
|
-
|
|
8443
|
-
element.parentNode.replaceChild(newElem, element);
|
|
8444
|
-
}
|
|
8445
|
-
}
|
|
8446
|
-
/*
|
|
8447
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
8448
|
-
* All rights reserved.
|
|
8449
|
-
* SPDX-License-Identifier: MIT
|
|
8450
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8451
|
-
*/
|
|
8452
|
-
|
|
8453
|
-
/**
|
|
8454
|
-
* This function builds a Web Component class from a LWC constructor so it can be
|
|
8455
|
-
* registered as a new element via customElements.define() at any given time.
|
|
8456
|
-
*
|
|
8457
|
-
* @deprecated since version 1.3.11
|
|
8458
|
-
*
|
|
8459
|
-
* @example
|
|
8460
|
-
* ```
|
|
8461
|
-
* import { buildCustomElementConstructor } from 'lwc';
|
|
8462
|
-
* import Foo from 'ns/foo';
|
|
8463
|
-
* const WC = buildCustomElementConstructor(Foo);
|
|
8464
|
-
* customElements.define('x-foo', WC);
|
|
8465
|
-
* const elm = document.createElement('x-foo');
|
|
8466
|
-
* ```
|
|
8467
|
-
*/
|
|
8468
|
-
|
|
8469
|
-
|
|
8470
|
-
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
8471
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
8472
|
-
/* eslint-disable-next-line no-console */
|
|
8473
|
-
console.warn('Deprecated function called: "buildCustomElementConstructor" function is deprecated and it will be removed.' + `Use "${Ctor.name}.CustomElementConstructor" static property of the component constructor to access the corresponding custom element constructor instead.`);
|
|
8474
|
-
}
|
|
8475
|
-
|
|
8476
|
-
return Ctor.CustomElementConstructor;
|
|
8477
|
-
}
|
|
8478
|
-
|
|
8479
|
-
function buildCustomElementConstructor(Ctor) {
|
|
8480
|
-
const HtmlPrototype = getComponentHtmlPrototype(Ctor);
|
|
8481
|
-
return class extends HtmlPrototype {
|
|
8482
|
-
constructor() {
|
|
8483
|
-
super();
|
|
8484
|
-
createVM(this, Ctor, {
|
|
8485
|
-
mode: 'open',
|
|
8486
|
-
owner: null,
|
|
8487
|
-
tagName: this.tagName
|
|
8488
|
-
});
|
|
8489
|
-
}
|
|
8490
|
-
|
|
8491
|
-
connectedCallback() {
|
|
8492
|
-
connectRootElement(this);
|
|
8493
|
-
}
|
|
8494
|
-
|
|
8495
|
-
disconnectedCallback() {
|
|
8496
|
-
disconnectRootElement(this);
|
|
8497
|
-
}
|
|
8498
|
-
|
|
8499
|
-
};
|
|
8500
|
-
}
|
|
8501
|
-
/*
|
|
8502
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
8503
|
-
* All rights reserved.
|
|
8504
|
-
* SPDX-License-Identifier: MIT
|
|
8505
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8506
|
-
*/
|
|
8507
|
-
|
|
8508
8662
|
/**
|
|
8509
8663
|
* EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
|
|
8510
8664
|
* This API is subject to change or being removed.
|
|
@@ -8605,7 +8759,7 @@ var LWC = (function (exports) {
|
|
|
8605
8759
|
});
|
|
8606
8760
|
freeze(LightningElement);
|
|
8607
8761
|
seal(LightningElement.prototype);
|
|
8608
|
-
/* version: 2.
|
|
8762
|
+
/* version: 2.10.0 */
|
|
8609
8763
|
|
|
8610
8764
|
exports.LightningElement = LightningElement;
|
|
8611
8765
|
exports.__unstable__ProfilerControl = profilerControl;
|