lwc 2.23.1 → 2.23.2
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 +1182 -856
- package/dist/engine-dom/iife/es2017/engine-dom.js +1182 -855
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +1101 -803
- package/dist/engine-dom/iife/es5/engine-dom.js +449 -368
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +409 -335
- package/dist/engine-dom/umd/es2017/engine-dom.js +1182 -855
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +1101 -803
- package/dist/engine-dom/umd/es5/engine-dom.js +449 -368
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +409 -335
- package/dist/engine-server/commonjs/es2017/engine-server.js +782 -521
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +782 -521
- 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
|
@@ -313,24 +313,36 @@ function isBooleanAttribute(attrName, tagName) {
|
|
|
313
313
|
return (allowedTagNames !== undefined &&
|
|
314
314
|
(allowedTagNames.size === 0 || allowedTagNames.has(tagName)));
|
|
315
315
|
}
|
|
316
|
+
// This list is based on https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
|
|
316
317
|
const GLOBAL_ATTRIBUTE = new Set([
|
|
317
|
-
'role',
|
|
318
318
|
'accesskey',
|
|
319
|
+
'autocapitalize',
|
|
320
|
+
'autofocus',
|
|
319
321
|
'class',
|
|
320
322
|
'contenteditable',
|
|
321
323
|
'contextmenu',
|
|
322
324
|
'dir',
|
|
323
325
|
'draggable',
|
|
324
|
-
'
|
|
326
|
+
'enterkeyhint',
|
|
327
|
+
'exportparts',
|
|
325
328
|
'hidden',
|
|
326
329
|
'id',
|
|
330
|
+
'inputmode',
|
|
331
|
+
'is',
|
|
332
|
+
'itemid',
|
|
327
333
|
'itemprop',
|
|
334
|
+
'itemref',
|
|
335
|
+
'itemscope',
|
|
336
|
+
'itemtype',
|
|
328
337
|
'lang',
|
|
338
|
+
'nonce',
|
|
339
|
+
'part',
|
|
329
340
|
'slot',
|
|
330
341
|
'spellcheck',
|
|
331
342
|
'style',
|
|
332
343
|
'tabindex',
|
|
333
344
|
'title',
|
|
345
|
+
'translate',
|
|
334
346
|
]);
|
|
335
347
|
function isGlobalHtmlAttribute(attrName) {
|
|
336
348
|
return GLOBAL_ATTRIBUTE.has(attrName);
|
|
@@ -415,9 +427,9 @@ function htmlEscape(str, attrMode = false) {
|
|
|
415
427
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
416
428
|
*/
|
|
417
429
|
// Increment whenever the LWC template compiler changes
|
|
418
|
-
const LWC_VERSION = "2.23.
|
|
430
|
+
const LWC_VERSION = "2.23.2";
|
|
419
431
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
420
|
-
/** version: 2.23.
|
|
432
|
+
/** version: 2.23.2 */
|
|
421
433
|
|
|
422
434
|
/*
|
|
423
435
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -469,6 +481,7 @@ const features = {
|
|
|
469
481
|
ENABLE_HTML_COLLECTIONS_PATCH: null,
|
|
470
482
|
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
471
483
|
ENABLE_MIXED_SHADOW_MODE: null,
|
|
484
|
+
ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
|
|
472
485
|
ENABLE_NODE_LIST_PATCH: null,
|
|
473
486
|
ENABLE_NODE_PATCH: null,
|
|
474
487
|
ENABLE_REACTIVE_SETTER: null,
|
|
@@ -526,7 +539,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
526
539
|
setFeatureFlag(name, value);
|
|
527
540
|
}
|
|
528
541
|
}
|
|
529
|
-
/** version: 2.23.
|
|
542
|
+
/** version: 2.23.2 */
|
|
530
543
|
|
|
531
544
|
/* proxy-compat-disable */
|
|
532
545
|
|
|
@@ -3280,30 +3293,67 @@ function createStylesheet(vm, stylesheets) {
|
|
|
3280
3293
|
* SPDX-License-Identifier: MIT
|
|
3281
3294
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3282
3295
|
*/
|
|
3296
|
+
|
|
3297
|
+
function checkHasVM(elm) {
|
|
3298
|
+
const hasVM = !isUndefined$1(getAssociatedVMIfPresent(elm));
|
|
3299
|
+
|
|
3300
|
+
if (process.env.NODE_ENV !== 'production' && !hasVM) {
|
|
3301
|
+
// Occurs when an element is manually created with the same tag name as an existing LWC component. In that case,
|
|
3302
|
+
// we skip calling the LWC connectedCallback/disconnectedCallback logic and log an error.
|
|
3303
|
+
logError(`VM for tag name "${elm.tagName.toLowerCase()}" is undefined. ` + `This indicates that an element was created with this tag name, ` + `which is already reserved by an LWC component. Use lwc.createElement ` + `instead to create elements.`);
|
|
3304
|
+
}
|
|
3305
|
+
|
|
3306
|
+
return hasVM;
|
|
3307
|
+
}
|
|
3308
|
+
|
|
3283
3309
|
function getUpgradableConstructor(tagName, renderer) {
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3310
|
+
const {
|
|
3311
|
+
getCustomElement,
|
|
3312
|
+
HTMLElementExported: RendererHTMLElement,
|
|
3313
|
+
defineCustomElement
|
|
3314
|
+
} = renderer; // Should never get a tag with upper case letter at this point, the compiler should
|
|
3315
|
+
// produce only tags with lowercase letters
|
|
3316
|
+
// But, for backwards compatibility, we will lower case the tagName
|
|
3317
|
+
|
|
3318
|
+
tagName = tagName.toLowerCase();
|
|
3319
|
+
let CE = getCustomElement(tagName);
|
|
3320
|
+
|
|
3321
|
+
if (!isUndefined$1(CE)) {
|
|
3322
|
+
return CE;
|
|
3323
|
+
}
|
|
3324
|
+
/**
|
|
3325
|
+
* LWC Upgradable Element reference to an element that was created
|
|
3326
|
+
* via the scoped registry mechanism, and that is ready to be upgraded.
|
|
3327
|
+
*/
|
|
3328
|
+
|
|
3329
|
+
|
|
3330
|
+
CE = class LWCUpgradableElement extends RendererHTMLElement {
|
|
3331
|
+
constructor(upgradeCallback) {
|
|
3332
|
+
super();
|
|
3333
|
+
|
|
3334
|
+
if (isFunction$1(upgradeCallback)) {
|
|
3335
|
+
upgradeCallback(this); // nothing to do with the result for now
|
|
3336
|
+
}
|
|
3292
3337
|
}
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
CE =
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
upgradeCallback(this); // nothing to do with the result for now
|
|
3302
|
-
}
|
|
3303
|
-
}
|
|
3338
|
+
|
|
3339
|
+
};
|
|
3340
|
+
|
|
3341
|
+
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
3342
|
+
CE.prototype.connectedCallback = function () {
|
|
3343
|
+
if (checkHasVM(this)) {
|
|
3344
|
+
connectRootElement(this);
|
|
3345
|
+
}
|
|
3304
3346
|
};
|
|
3305
|
-
|
|
3306
|
-
|
|
3347
|
+
|
|
3348
|
+
CE.prototype.disconnectedCallback = function () {
|
|
3349
|
+
if (checkHasVM(this)) {
|
|
3350
|
+
disconnectRootElement(this);
|
|
3351
|
+
}
|
|
3352
|
+
};
|
|
3353
|
+
}
|
|
3354
|
+
|
|
3355
|
+
defineCustomElement(tagName, CE);
|
|
3356
|
+
return CE;
|
|
3307
3357
|
}
|
|
3308
3358
|
|
|
3309
3359
|
/*
|
|
@@ -3549,579 +3599,790 @@ function applyStaticStyleAttribute(vnode, renderer) {
|
|
|
3549
3599
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3550
3600
|
*/
|
|
3551
3601
|
function patchChildren(c1, c2, parent, renderer) {
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
}
|
|
3602
|
+
if (hasDynamicChildren(c2)) {
|
|
3603
|
+
updateDynamicChildren(c1, c2, parent, renderer);
|
|
3604
|
+
} else {
|
|
3605
|
+
updateStaticChildren(c1, c2, parent, renderer);
|
|
3606
|
+
}
|
|
3558
3607
|
}
|
|
3608
|
+
|
|
3559
3609
|
function patch(n1, n2, parent, renderer) {
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
patchText(n1, n2, renderer);
|
|
3576
|
-
break;
|
|
3577
|
-
case 1 /* VNodeType.Comment */:
|
|
3578
|
-
// VComment has no special capability, fallback to the owner's renderer
|
|
3579
|
-
patchComment(n1, n2, renderer);
|
|
3580
|
-
break;
|
|
3581
|
-
case 4 /* VNodeType.Static */:
|
|
3582
|
-
n2.elm = n1.elm;
|
|
3583
|
-
break;
|
|
3584
|
-
case 2 /* VNodeType.Element */:
|
|
3585
|
-
patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3586
|
-
break;
|
|
3587
|
-
case 3 /* VNodeType.CustomElement */:
|
|
3588
|
-
patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3589
|
-
break;
|
|
3610
|
+
var _a, _b;
|
|
3611
|
+
|
|
3612
|
+
if (n1 === n2) {
|
|
3613
|
+
return;
|
|
3614
|
+
}
|
|
3615
|
+
|
|
3616
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3617
|
+
if (!isSameVnode(n1, n2)) {
|
|
3618
|
+
throw new Error('Expected these VNodes to be the same: ' + JSON.stringify({
|
|
3619
|
+
sel: n1.sel,
|
|
3620
|
+
key: n1.key
|
|
3621
|
+
}) + ', ' + JSON.stringify({
|
|
3622
|
+
sel: n2.sel,
|
|
3623
|
+
key: n2.key
|
|
3624
|
+
}));
|
|
3590
3625
|
}
|
|
3626
|
+
}
|
|
3627
|
+
|
|
3628
|
+
switch (n2.type) {
|
|
3629
|
+
case 0
|
|
3630
|
+
/* VNodeType.Text */
|
|
3631
|
+
:
|
|
3632
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
3633
|
+
patchText(n1, n2, renderer);
|
|
3634
|
+
break;
|
|
3635
|
+
|
|
3636
|
+
case 1
|
|
3637
|
+
/* VNodeType.Comment */
|
|
3638
|
+
:
|
|
3639
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
3640
|
+
patchComment(n1, n2, renderer);
|
|
3641
|
+
break;
|
|
3642
|
+
|
|
3643
|
+
case 4
|
|
3644
|
+
/* VNodeType.Static */
|
|
3645
|
+
:
|
|
3646
|
+
n2.elm = n1.elm;
|
|
3647
|
+
break;
|
|
3648
|
+
|
|
3649
|
+
case 2
|
|
3650
|
+
/* VNodeType.Element */
|
|
3651
|
+
:
|
|
3652
|
+
patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3653
|
+
break;
|
|
3654
|
+
|
|
3655
|
+
case 3
|
|
3656
|
+
/* VNodeType.CustomElement */
|
|
3657
|
+
:
|
|
3658
|
+
patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3659
|
+
break;
|
|
3660
|
+
}
|
|
3591
3661
|
}
|
|
3662
|
+
|
|
3592
3663
|
function mount(node, parent, renderer, anchor) {
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3664
|
+
var _a, _b;
|
|
3665
|
+
|
|
3666
|
+
switch (node.type) {
|
|
3667
|
+
case 0
|
|
3668
|
+
/* VNodeType.Text */
|
|
3669
|
+
:
|
|
3670
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
3671
|
+
mountText(node, parent, anchor, renderer);
|
|
3672
|
+
break;
|
|
3673
|
+
|
|
3674
|
+
case 1
|
|
3675
|
+
/* VNodeType.Comment */
|
|
3676
|
+
:
|
|
3677
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
3678
|
+
mountComment(node, parent, anchor, renderer);
|
|
3679
|
+
break;
|
|
3680
|
+
|
|
3681
|
+
case 4
|
|
3682
|
+
/* VNodeType.Static */
|
|
3683
|
+
:
|
|
3684
|
+
// VStatic cannot have a custom renderer associated to them, using owner's renderer
|
|
3685
|
+
mountStatic(node, parent, anchor, renderer);
|
|
3686
|
+
break;
|
|
3687
|
+
|
|
3688
|
+
case 2
|
|
3689
|
+
/* VNodeType.Element */
|
|
3690
|
+
:
|
|
3691
|
+
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
3692
|
+
mountElement(node, parent, anchor, (_a = node.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3693
|
+
break;
|
|
3694
|
+
|
|
3695
|
+
case 3
|
|
3696
|
+
/* VNodeType.CustomElement */
|
|
3697
|
+
:
|
|
3698
|
+
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
3699
|
+
mountCustomElement(node, parent, anchor, (_b = node.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3700
|
+
break;
|
|
3701
|
+
}
|
|
3616
3702
|
}
|
|
3703
|
+
|
|
3617
3704
|
function patchText(n1, n2, renderer) {
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3705
|
+
n2.elm = n1.elm;
|
|
3706
|
+
|
|
3707
|
+
if (n2.text !== n1.text) {
|
|
3708
|
+
updateTextContent(n2, renderer);
|
|
3709
|
+
}
|
|
3622
3710
|
}
|
|
3711
|
+
|
|
3623
3712
|
function mountText(vnode, parent, anchor, renderer) {
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3713
|
+
const {
|
|
3714
|
+
owner
|
|
3715
|
+
} = vnode;
|
|
3716
|
+
const {
|
|
3717
|
+
createText
|
|
3718
|
+
} = renderer;
|
|
3719
|
+
const textNode = vnode.elm = createText(vnode.text);
|
|
3720
|
+
linkNodeToShadow(textNode, owner, renderer);
|
|
3721
|
+
insertNode(textNode, parent, anchor, renderer);
|
|
3629
3722
|
}
|
|
3723
|
+
|
|
3630
3724
|
function patchComment(n1, n2, renderer) {
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3725
|
+
n2.elm = n1.elm; // FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
|
|
3726
|
+
// it is the case today.
|
|
3727
|
+
|
|
3728
|
+
if (n2.text !== n1.text) {
|
|
3729
|
+
updateTextContent(n2, renderer);
|
|
3730
|
+
}
|
|
3637
3731
|
}
|
|
3732
|
+
|
|
3638
3733
|
function mountComment(vnode, parent, anchor, renderer) {
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3734
|
+
const {
|
|
3735
|
+
owner
|
|
3736
|
+
} = vnode;
|
|
3737
|
+
const {
|
|
3738
|
+
createComment
|
|
3739
|
+
} = renderer;
|
|
3740
|
+
const commentNode = vnode.elm = createComment(vnode.text);
|
|
3741
|
+
linkNodeToShadow(commentNode, owner, renderer);
|
|
3742
|
+
insertNode(commentNode, parent, anchor, renderer);
|
|
3644
3743
|
}
|
|
3744
|
+
|
|
3645
3745
|
function mountElement(vnode, parent, anchor, renderer) {
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3746
|
+
const {
|
|
3747
|
+
sel,
|
|
3748
|
+
owner,
|
|
3749
|
+
data: {
|
|
3750
|
+
svg
|
|
3751
|
+
}
|
|
3752
|
+
} = vnode;
|
|
3753
|
+
const {
|
|
3754
|
+
createElement
|
|
3755
|
+
} = renderer;
|
|
3756
|
+
const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
3757
|
+
const elm = vnode.elm = createElement(sel, namespace);
|
|
3758
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3759
|
+
applyStyleScoping(elm, owner, renderer);
|
|
3760
|
+
applyDomManual(elm, vnode);
|
|
3761
|
+
applyElementRestrictions(elm, vnode);
|
|
3762
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
3763
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3764
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
3657
3765
|
}
|
|
3766
|
+
|
|
3658
3767
|
function patchElement(n1, n2, renderer) {
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3768
|
+
const elm = n2.elm = n1.elm;
|
|
3769
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3770
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3662
3771
|
}
|
|
3772
|
+
|
|
3663
3773
|
function mountStatic(vnode, parent, anchor, renderer) {
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3774
|
+
const {
|
|
3775
|
+
owner
|
|
3776
|
+
} = vnode;
|
|
3777
|
+
const {
|
|
3778
|
+
cloneNode,
|
|
3779
|
+
isSyntheticShadowDefined
|
|
3780
|
+
} = renderer;
|
|
3781
|
+
const elm = vnode.elm = cloneNode(vnode.fragment, true);
|
|
3782
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3783
|
+
applyElementRestrictions(elm, vnode); // Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
|
|
3784
|
+
|
|
3785
|
+
const {
|
|
3786
|
+
renderMode,
|
|
3787
|
+
shadowMode
|
|
3788
|
+
} = owner;
|
|
3789
|
+
|
|
3790
|
+
if (isSyntheticShadowDefined) {
|
|
3791
|
+
if (shadowMode === 1
|
|
3792
|
+
/* ShadowMode.Synthetic */
|
|
3793
|
+
|| renderMode === 0
|
|
3794
|
+
/* RenderMode.Light */
|
|
3795
|
+
) {
|
|
3796
|
+
elm[KEY__SHADOW_STATIC] = true;
|
|
3675
3797
|
}
|
|
3676
|
-
|
|
3798
|
+
}
|
|
3799
|
+
|
|
3800
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3677
3801
|
}
|
|
3802
|
+
|
|
3678
3803
|
function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3804
|
+
const {
|
|
3805
|
+
sel,
|
|
3806
|
+
owner
|
|
3807
|
+
} = vnode;
|
|
3808
|
+
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
3809
|
+
/**
|
|
3810
|
+
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
3811
|
+
* with a callback as the first argument, we could implement a more advanced
|
|
3812
|
+
* mechanism that only passes that argument if the constructor is known to be
|
|
3813
|
+
* an upgradable custom element.
|
|
3814
|
+
*/
|
|
3815
|
+
|
|
3816
|
+
let vm;
|
|
3817
|
+
const elm = new UpgradableConstructor(elm => {
|
|
3818
|
+
// the custom element from the registry is expecting an upgrade callback
|
|
3819
|
+
vm = createViewModelHook(elm, vnode, renderer);
|
|
3820
|
+
});
|
|
3821
|
+
vnode.elm = elm;
|
|
3822
|
+
vnode.vm = vm;
|
|
3823
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3824
|
+
applyStyleScoping(elm, owner, renderer);
|
|
3825
|
+
|
|
3826
|
+
if (vm) {
|
|
3827
|
+
allocateChildren(vnode, vm);
|
|
3828
|
+
} else if (vnode.ctor !== UpgradableConstructor) {
|
|
3829
|
+
throw new TypeError(`Incorrect Component Constructor`);
|
|
3830
|
+
}
|
|
3831
|
+
|
|
3832
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
3833
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3834
|
+
|
|
3835
|
+
if (vm) {
|
|
3836
|
+
{
|
|
3837
|
+
// On the server, we don't have native custom element lifecycle callbacks, so we must
|
|
3838
|
+
// manually invoke the connectedCallback for a child component.
|
|
3839
|
+
runConnectedCallback(vm);
|
|
3713
3840
|
}
|
|
3841
|
+
}
|
|
3842
|
+
|
|
3843
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
3844
|
+
|
|
3845
|
+
if (vm) {
|
|
3846
|
+
appendVM(vm);
|
|
3847
|
+
}
|
|
3714
3848
|
}
|
|
3849
|
+
|
|
3715
3850
|
function patchCustomElement(n1, n2, parent, renderer) {
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3851
|
+
if (n1.ctor !== n2.ctor) {
|
|
3852
|
+
// If the constructor, unmount the current component and mount a new one using the new
|
|
3853
|
+
// constructor.
|
|
3854
|
+
const anchor = renderer.nextSibling(n1.elm);
|
|
3855
|
+
unmount(n1, parent, renderer, true);
|
|
3856
|
+
mountCustomElement(n2, parent, anchor, renderer);
|
|
3857
|
+
} else {
|
|
3858
|
+
// Otherwise patch the existing component with new props/attrs/etc.
|
|
3859
|
+
const elm = n2.elm = n1.elm;
|
|
3860
|
+
const vm = n2.vm = n1.vm;
|
|
3861
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3862
|
+
|
|
3863
|
+
if (!isUndefined$1(vm)) {
|
|
3864
|
+
// in fallback mode, the allocation will always set children to
|
|
3865
|
+
// empty and delegate the real allocation to the slot elements
|
|
3866
|
+
allocateChildren(n2, vm);
|
|
3867
|
+
} // in fallback mode, the children will be always empty, so, nothing
|
|
3868
|
+
// will happen, but in native, it does allocate the light dom
|
|
3869
|
+
|
|
3870
|
+
|
|
3871
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3872
|
+
|
|
3873
|
+
if (!isUndefined$1(vm)) {
|
|
3874
|
+
// this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
3875
|
+
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
3876
|
+
rerenderVM(vm);
|
|
3741
3877
|
}
|
|
3878
|
+
}
|
|
3742
3879
|
}
|
|
3880
|
+
|
|
3743
3881
|
function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3882
|
+
for (; start < end; ++start) {
|
|
3883
|
+
const vnode = vnodes[start];
|
|
3884
|
+
|
|
3885
|
+
if (isVNode(vnode)) {
|
|
3886
|
+
mount(vnode, parent, renderer, anchor);
|
|
3749
3887
|
}
|
|
3888
|
+
}
|
|
3750
3889
|
}
|
|
3890
|
+
|
|
3751
3891
|
function unmount(vnode, parent, renderer, doRemove = false) {
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3892
|
+
const {
|
|
3893
|
+
type,
|
|
3894
|
+
elm,
|
|
3895
|
+
sel
|
|
3896
|
+
} = vnode; // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
3897
|
+
// subtree root, is the only element worth unmounting from the subtree.
|
|
3898
|
+
|
|
3899
|
+
if (doRemove) {
|
|
3900
|
+
// The vnode might or might not have a data.renderer associated to it
|
|
3901
|
+
// but the removal used here is from the owner instead.
|
|
3902
|
+
removeNode(elm, parent, renderer);
|
|
3903
|
+
}
|
|
3904
|
+
|
|
3905
|
+
switch (type) {
|
|
3906
|
+
case 2
|
|
3907
|
+
/* VNodeType.Element */
|
|
3908
|
+
:
|
|
3909
|
+
{
|
|
3910
|
+
// Slot content is removed to trigger slotchange event when removing slot.
|
|
3911
|
+
// Only required for synthetic shadow.
|
|
3912
|
+
const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1
|
|
3913
|
+
/* ShadowMode.Synthetic */
|
|
3914
|
+
;
|
|
3915
|
+
unmountVNodes(vnode.children, elm, renderer, shouldRemoveChildren);
|
|
3916
|
+
break;
|
|
3917
|
+
}
|
|
3918
|
+
|
|
3919
|
+
case 3
|
|
3920
|
+
/* VNodeType.CustomElement */
|
|
3921
|
+
:
|
|
3922
|
+
{
|
|
3923
|
+
const {
|
|
3924
|
+
vm
|
|
3925
|
+
} = vnode; // No need to unmount the children here, `removeVM` will take care of removing the
|
|
3926
|
+
// children.
|
|
3927
|
+
|
|
3928
|
+
if (!isUndefined$1(vm)) {
|
|
3929
|
+
removeVM(vm);
|
|
3775
3930
|
}
|
|
3776
|
-
|
|
3931
|
+
}
|
|
3932
|
+
}
|
|
3777
3933
|
}
|
|
3934
|
+
|
|
3778
3935
|
function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, end = vnodes.length) {
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3936
|
+
for (; start < end; ++start) {
|
|
3937
|
+
const ch = vnodes[start];
|
|
3938
|
+
|
|
3939
|
+
if (isVNode(ch)) {
|
|
3940
|
+
unmount(ch, parent, renderer, doRemove);
|
|
3784
3941
|
}
|
|
3942
|
+
}
|
|
3785
3943
|
}
|
|
3944
|
+
|
|
3786
3945
|
function isVNode(vnode) {
|
|
3787
|
-
|
|
3946
|
+
return vnode != null;
|
|
3788
3947
|
}
|
|
3948
|
+
|
|
3789
3949
|
function linkNodeToShadow(elm, owner, renderer) {
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3950
|
+
const {
|
|
3951
|
+
renderRoot,
|
|
3952
|
+
renderMode,
|
|
3953
|
+
shadowMode
|
|
3954
|
+
} = owner;
|
|
3955
|
+
const {
|
|
3956
|
+
isSyntheticShadowDefined
|
|
3957
|
+
} = renderer; // TODO [#1164]: this should eventually be done by the polyfill directly
|
|
3958
|
+
|
|
3959
|
+
if (isSyntheticShadowDefined) {
|
|
3960
|
+
if (shadowMode === 1
|
|
3961
|
+
/* ShadowMode.Synthetic */
|
|
3962
|
+
|| renderMode === 0
|
|
3963
|
+
/* RenderMode.Light */
|
|
3964
|
+
) {
|
|
3965
|
+
elm[KEY__SHADOW_RESOLVER] = renderRoot[KEY__SHADOW_RESOLVER];
|
|
3797
3966
|
}
|
|
3967
|
+
}
|
|
3798
3968
|
}
|
|
3969
|
+
|
|
3799
3970
|
function updateTextContent(vnode, renderer) {
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
setText
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3971
|
+
const {
|
|
3972
|
+
elm,
|
|
3973
|
+
text
|
|
3974
|
+
} = vnode;
|
|
3975
|
+
const {
|
|
3976
|
+
setText
|
|
3977
|
+
} = renderer;
|
|
3978
|
+
|
|
3979
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3980
|
+
unlockDomMutation();
|
|
3981
|
+
}
|
|
3982
|
+
|
|
3983
|
+
setText(elm, text);
|
|
3984
|
+
|
|
3985
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3986
|
+
lockDomMutation();
|
|
3987
|
+
}
|
|
3809
3988
|
}
|
|
3989
|
+
|
|
3810
3990
|
function insertNode(node, parent, anchor, renderer) {
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3991
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3992
|
+
unlockDomMutation();
|
|
3993
|
+
}
|
|
3994
|
+
|
|
3995
|
+
renderer.insert(node, parent, anchor);
|
|
3996
|
+
|
|
3997
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3998
|
+
lockDomMutation();
|
|
3999
|
+
}
|
|
3818
4000
|
}
|
|
4001
|
+
|
|
3819
4002
|
function removeNode(node, parent, renderer) {
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
4003
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4004
|
+
unlockDomMutation();
|
|
4005
|
+
}
|
|
4006
|
+
|
|
4007
|
+
renderer.remove(node, parent);
|
|
4008
|
+
|
|
4009
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4010
|
+
lockDomMutation();
|
|
4011
|
+
}
|
|
3827
4012
|
}
|
|
4013
|
+
|
|
3828
4014
|
function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
4015
|
+
if (isNull(oldVnode)) {
|
|
4016
|
+
applyEventListeners(vnode, renderer);
|
|
4017
|
+
applyStaticClassAttribute(vnode, renderer);
|
|
4018
|
+
applyStaticStyleAttribute(vnode, renderer);
|
|
4019
|
+
} // Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
|
|
4020
|
+
// value is set before type=radio.
|
|
4021
|
+
|
|
4022
|
+
|
|
4023
|
+
patchClassAttribute(oldVnode, vnode, renderer);
|
|
4024
|
+
patchStyleAttribute(oldVnode, vnode, renderer);
|
|
4025
|
+
patchAttributes(oldVnode, vnode, renderer);
|
|
4026
|
+
patchProps(oldVnode, vnode, renderer);
|
|
3840
4027
|
}
|
|
4028
|
+
|
|
3841
4029
|
function applyStyleScoping(elm, owner, renderer) {
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
4030
|
+
// Set the class name for `*.scoped.css` style scoping.
|
|
4031
|
+
const scopeToken = getScopeTokenClass(owner);
|
|
4032
|
+
|
|
4033
|
+
if (!isNull(scopeToken)) {
|
|
4034
|
+
const {
|
|
4035
|
+
getClassList
|
|
4036
|
+
} = renderer; // TODO [#2762]: this dot notation with add is probably problematic
|
|
4037
|
+
// probably we should have a renderer api for just the add operation
|
|
4038
|
+
|
|
4039
|
+
getClassList(elm).add(scopeToken);
|
|
4040
|
+
} // Set property element for synthetic shadow DOM style scoping.
|
|
4041
|
+
|
|
4042
|
+
|
|
4043
|
+
const {
|
|
4044
|
+
stylesheetToken: syntheticToken
|
|
4045
|
+
} = owner.context;
|
|
4046
|
+
|
|
4047
|
+
if (owner.shadowMode === 1
|
|
4048
|
+
/* ShadowMode.Synthetic */
|
|
4049
|
+
&& !isUndefined$1(syntheticToken)) {
|
|
4050
|
+
elm.$shadowToken$ = syntheticToken;
|
|
4051
|
+
}
|
|
3855
4052
|
}
|
|
4053
|
+
|
|
3856
4054
|
function applyDomManual(elm, vnode) {
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
4055
|
+
var _a;
|
|
4056
|
+
|
|
4057
|
+
const {
|
|
4058
|
+
owner,
|
|
4059
|
+
data: {
|
|
4060
|
+
context
|
|
3861
4061
|
}
|
|
4062
|
+
} = vnode;
|
|
4063
|
+
|
|
4064
|
+
if (owner.shadowMode === 1
|
|
4065
|
+
/* ShadowMode.Synthetic */
|
|
4066
|
+
&& ((_a = context === null || context === void 0 ? void 0 : context.lwc) === null || _a === void 0 ? void 0 : _a.dom) === "manual"
|
|
4067
|
+
/* LwcDomMode.Manual */
|
|
4068
|
+
) {
|
|
4069
|
+
elm.$domManual$ = true;
|
|
4070
|
+
}
|
|
3862
4071
|
}
|
|
4072
|
+
|
|
3863
4073
|
function applyElementRestrictions(elm, vnode) {
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
4074
|
+
var _a, _b;
|
|
4075
|
+
|
|
4076
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4077
|
+
const isPortal = vnode.type === 2
|
|
4078
|
+
/* VNodeType.Element */
|
|
4079
|
+
&& ((_b = (_a = vnode.data.context) === null || _a === void 0 ? void 0 : _a.lwc) === null || _b === void 0 ? void 0 : _b.dom) === "manual"
|
|
4080
|
+
/* LwcDomMode.Manual */
|
|
4081
|
+
;
|
|
4082
|
+
const isLight = vnode.owner.renderMode === 0
|
|
4083
|
+
/* RenderMode.Light */
|
|
4084
|
+
;
|
|
4085
|
+
patchElementWithRestrictions(elm, {
|
|
4086
|
+
isPortal,
|
|
4087
|
+
isLight
|
|
4088
|
+
});
|
|
4089
|
+
}
|
|
3873
4090
|
}
|
|
4091
|
+
|
|
3874
4092
|
function allocateChildren(vnode, vm) {
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
4093
|
+
// A component with slots will re-render because:
|
|
4094
|
+
// 1- There is a change of the internal state.
|
|
4095
|
+
// 2- There is a change on the external api (ex: slots)
|
|
4096
|
+
//
|
|
4097
|
+
// In case #1, the vnodes in the cmpSlots will be reused since they didn't changed. This routine emptied the
|
|
4098
|
+
// slotted children when those VCustomElement were rendered and therefore in subsequent calls to allocate children
|
|
4099
|
+
// in a reused VCustomElement, there won't be any slotted children.
|
|
4100
|
+
// For those cases, we will use the reference for allocated children stored when rendering the fresh VCustomElement.
|
|
4101
|
+
//
|
|
4102
|
+
// In case #2, we will always get a fresh VCustomElement.
|
|
4103
|
+
const children = vnode.aChildren || vnode.children;
|
|
4104
|
+
vm.aChildren = children;
|
|
4105
|
+
const {
|
|
4106
|
+
renderMode,
|
|
4107
|
+
shadowMode
|
|
4108
|
+
} = vm;
|
|
4109
|
+
|
|
4110
|
+
if (shadowMode === 1
|
|
4111
|
+
/* ShadowMode.Synthetic */
|
|
4112
|
+
|| renderMode === 0
|
|
4113
|
+
/* RenderMode.Light */
|
|
4114
|
+
) {
|
|
4115
|
+
// slow path
|
|
4116
|
+
allocateInSlot(vm, children); // save the allocated children in case this vnode is reused.
|
|
4117
|
+
|
|
4118
|
+
vnode.aChildren = children; // every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
|
|
4119
|
+
|
|
4120
|
+
vnode.children = EmptyArray;
|
|
4121
|
+
}
|
|
3896
4122
|
}
|
|
4123
|
+
|
|
3897
4124
|
function createViewModelHook(elm, vnode, renderer) {
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
return vm;
|
|
3904
|
-
}
|
|
3905
|
-
const { sel, mode, ctor, owner } = vnode;
|
|
3906
|
-
vm = createVM(elm, ctor, renderer, {
|
|
3907
|
-
mode,
|
|
3908
|
-
owner,
|
|
3909
|
-
tagName: sel,
|
|
3910
|
-
});
|
|
3911
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
3912
|
-
assert.isTrue(isArray$1(vnode.children), `Invalid vnode for a custom element, it must have children defined.`);
|
|
3913
|
-
}
|
|
4125
|
+
let vm = getAssociatedVMIfPresent(elm); // There is a possibility that a custom element is registered under tagName, in which case, the
|
|
4126
|
+
// initialization is already carry on, and there is nothing else to do here since this hook is
|
|
4127
|
+
// called right after invoking `document.createElement`.
|
|
4128
|
+
|
|
4129
|
+
if (!isUndefined$1(vm)) {
|
|
3914
4130
|
return vm;
|
|
4131
|
+
}
|
|
4132
|
+
|
|
4133
|
+
const {
|
|
4134
|
+
sel,
|
|
4135
|
+
mode,
|
|
4136
|
+
ctor,
|
|
4137
|
+
owner
|
|
4138
|
+
} = vnode;
|
|
4139
|
+
vm = createVM(elm, ctor, renderer, {
|
|
4140
|
+
mode,
|
|
4141
|
+
owner,
|
|
4142
|
+
tagName: sel
|
|
4143
|
+
});
|
|
4144
|
+
|
|
4145
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4146
|
+
assert.isTrue(isArray$1(vnode.children), `Invalid vnode for a custom element, it must have children defined.`);
|
|
4147
|
+
}
|
|
4148
|
+
|
|
4149
|
+
return vm;
|
|
3915
4150
|
}
|
|
4151
|
+
|
|
3916
4152
|
function allocateInSlot(vm, children) {
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
4153
|
+
var _a;
|
|
4154
|
+
|
|
4155
|
+
const {
|
|
4156
|
+
cmpSlots: oldSlots
|
|
4157
|
+
} = vm;
|
|
4158
|
+
const cmpSlots = vm.cmpSlots = create(null);
|
|
4159
|
+
|
|
4160
|
+
for (let i = 0, len = children.length; i < len; i += 1) {
|
|
4161
|
+
const vnode = children[i];
|
|
4162
|
+
|
|
4163
|
+
if (isNull(vnode)) {
|
|
4164
|
+
continue;
|
|
4165
|
+
}
|
|
4166
|
+
|
|
4167
|
+
let slotName = '';
|
|
4168
|
+
|
|
4169
|
+
if (isVBaseElement(vnode)) {
|
|
4170
|
+
slotName = ((_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) || '';
|
|
4171
|
+
}
|
|
4172
|
+
|
|
4173
|
+
const vnodes = cmpSlots[slotName] = cmpSlots[slotName] || [];
|
|
4174
|
+
ArrayPush$1.call(vnodes, vnode);
|
|
4175
|
+
}
|
|
4176
|
+
|
|
4177
|
+
if (isFalse(vm.isDirty)) {
|
|
4178
|
+
// We need to determine if the old allocation is really different from the new one
|
|
4179
|
+
// and mark the vm as dirty
|
|
4180
|
+
const oldKeys = keys(oldSlots);
|
|
4181
|
+
|
|
4182
|
+
if (oldKeys.length !== keys(cmpSlots).length) {
|
|
4183
|
+
markComponentAsDirty(vm);
|
|
4184
|
+
return;
|
|
4185
|
+
}
|
|
4186
|
+
|
|
4187
|
+
for (let i = 0, len = oldKeys.length; i < len; i += 1) {
|
|
4188
|
+
const key = oldKeys[i];
|
|
4189
|
+
|
|
4190
|
+
if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
|
|
4191
|
+
markComponentAsDirty(vm);
|
|
4192
|
+
return;
|
|
4193
|
+
}
|
|
4194
|
+
|
|
4195
|
+
const oldVNodes = oldSlots[key];
|
|
4196
|
+
const vnodes = cmpSlots[key];
|
|
4197
|
+
|
|
4198
|
+
for (let j = 0, a = cmpSlots[key].length; j < a; j += 1) {
|
|
4199
|
+
if (oldVNodes[j] !== vnodes[j]) {
|
|
4200
|
+
markComponentAsDirty(vm);
|
|
4201
|
+
return;
|
|
3954
4202
|
}
|
|
4203
|
+
}
|
|
3955
4204
|
}
|
|
3956
|
-
}
|
|
3957
|
-
// Using a WeakMap instead of a WeakSet because this one works in IE11 :(
|
|
3958
|
-
|
|
3959
|
-
|
|
4205
|
+
}
|
|
4206
|
+
} // Using a WeakMap instead of a WeakSet because this one works in IE11 :(
|
|
4207
|
+
|
|
4208
|
+
|
|
4209
|
+
const FromIteration = new WeakMap(); // dynamic children means it was generated by an iteration
|
|
3960
4210
|
// in a template, and will require a more complex diffing algo.
|
|
4211
|
+
|
|
3961
4212
|
function markAsDynamicChildren(children) {
|
|
3962
|
-
|
|
4213
|
+
FromIteration.set(children, 1);
|
|
3963
4214
|
}
|
|
4215
|
+
|
|
3964
4216
|
function hasDynamicChildren(children) {
|
|
3965
|
-
|
|
4217
|
+
return FromIteration.has(children);
|
|
3966
4218
|
}
|
|
4219
|
+
|
|
3967
4220
|
function createKeyToOldIdx(children, beginIdx, endIdx) {
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
4221
|
+
const map = {}; // TODO [#1637]: simplify this by assuming that all vnodes has keys
|
|
4222
|
+
|
|
4223
|
+
for (let j = beginIdx; j <= endIdx; ++j) {
|
|
4224
|
+
const ch = children[j];
|
|
4225
|
+
|
|
4226
|
+
if (isVNode(ch)) {
|
|
4227
|
+
const {
|
|
4228
|
+
key
|
|
4229
|
+
} = ch;
|
|
4230
|
+
|
|
4231
|
+
if (key !== undefined) {
|
|
4232
|
+
map[key] = j;
|
|
4233
|
+
}
|
|
3978
4234
|
}
|
|
3979
|
-
|
|
4235
|
+
}
|
|
4236
|
+
|
|
4237
|
+
return map;
|
|
3980
4238
|
}
|
|
4239
|
+
|
|
3981
4240
|
function updateDynamicChildren(oldCh, newCh, parent, renderer) {
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
}
|
|
4061
|
-
// We've already cloned at least once, so it's no longer read-only
|
|
4062
|
-
oldCh[idxInOld] = undefined;
|
|
4063
|
-
insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
|
|
4064
|
-
}
|
|
4065
|
-
}
|
|
4066
|
-
newStartVnode = newCh[++newStartIdx];
|
|
4067
|
-
}
|
|
4241
|
+
let oldStartIdx = 0;
|
|
4242
|
+
let newStartIdx = 0;
|
|
4243
|
+
let oldEndIdx = oldCh.length - 1;
|
|
4244
|
+
let oldStartVnode = oldCh[0];
|
|
4245
|
+
let oldEndVnode = oldCh[oldEndIdx];
|
|
4246
|
+
const newChEnd = newCh.length - 1;
|
|
4247
|
+
let newEndIdx = newChEnd;
|
|
4248
|
+
let newStartVnode = newCh[0];
|
|
4249
|
+
let newEndVnode = newCh[newEndIdx];
|
|
4250
|
+
let oldKeyToIdx;
|
|
4251
|
+
let idxInOld;
|
|
4252
|
+
let elmToMove;
|
|
4253
|
+
let before;
|
|
4254
|
+
let clonedOldCh = false;
|
|
4255
|
+
|
|
4256
|
+
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
4257
|
+
if (!isVNode(oldStartVnode)) {
|
|
4258
|
+
oldStartVnode = oldCh[++oldStartIdx]; // Vnode might have been moved left
|
|
4259
|
+
} else if (!isVNode(oldEndVnode)) {
|
|
4260
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
|
4261
|
+
} else if (!isVNode(newStartVnode)) {
|
|
4262
|
+
newStartVnode = newCh[++newStartIdx];
|
|
4263
|
+
} else if (!isVNode(newEndVnode)) {
|
|
4264
|
+
newEndVnode = newCh[--newEndIdx];
|
|
4265
|
+
} else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
4266
|
+
patch(oldStartVnode, newStartVnode, parent, renderer);
|
|
4267
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
|
4268
|
+
newStartVnode = newCh[++newStartIdx];
|
|
4269
|
+
} else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
4270
|
+
patch(oldEndVnode, newEndVnode, parent, renderer);
|
|
4271
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
|
4272
|
+
newEndVnode = newCh[--newEndIdx];
|
|
4273
|
+
} else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
4274
|
+
// Vnode moved right
|
|
4275
|
+
patch(oldStartVnode, newEndVnode, parent, renderer);
|
|
4276
|
+
insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
|
|
4277
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
|
4278
|
+
newEndVnode = newCh[--newEndIdx];
|
|
4279
|
+
} else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
4280
|
+
// Vnode moved left
|
|
4281
|
+
patch(oldEndVnode, newStartVnode, parent, renderer);
|
|
4282
|
+
insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
|
|
4283
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
|
4284
|
+
newStartVnode = newCh[++newStartIdx];
|
|
4285
|
+
} else {
|
|
4286
|
+
if (oldKeyToIdx === undefined) {
|
|
4287
|
+
oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
|
|
4288
|
+
}
|
|
4289
|
+
|
|
4290
|
+
idxInOld = oldKeyToIdx[newStartVnode.key];
|
|
4291
|
+
|
|
4292
|
+
if (isUndefined$1(idxInOld)) {
|
|
4293
|
+
// New element
|
|
4294
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4295
|
+
newStartVnode = newCh[++newStartIdx];
|
|
4296
|
+
} else {
|
|
4297
|
+
elmToMove = oldCh[idxInOld];
|
|
4298
|
+
|
|
4299
|
+
if (isVNode(elmToMove)) {
|
|
4300
|
+
if (elmToMove.sel !== newStartVnode.sel) {
|
|
4301
|
+
// New element
|
|
4302
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4303
|
+
} else {
|
|
4304
|
+
patch(elmToMove, newStartVnode, parent, renderer); // Delete the old child, but copy the array since it is read-only.
|
|
4305
|
+
// The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
|
|
4306
|
+
// so we only care about the `oldCh` object inside this function.
|
|
4307
|
+
// To avoid cloning over and over again, we check `clonedOldCh`
|
|
4308
|
+
// and only clone once.
|
|
4309
|
+
|
|
4310
|
+
if (!clonedOldCh) {
|
|
4311
|
+
clonedOldCh = true;
|
|
4312
|
+
oldCh = [...oldCh];
|
|
4313
|
+
} // We've already cloned at least once, so it's no longer read-only
|
|
4314
|
+
|
|
4315
|
+
|
|
4316
|
+
oldCh[idxInOld] = undefined;
|
|
4317
|
+
insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
|
|
4318
|
+
}
|
|
4068
4319
|
}
|
|
4320
|
+
|
|
4321
|
+
newStartVnode = newCh[++newStartIdx];
|
|
4322
|
+
}
|
|
4069
4323
|
}
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4324
|
+
}
|
|
4325
|
+
|
|
4326
|
+
if (oldStartIdx <= oldEndIdx || newStartIdx <= newEndIdx) {
|
|
4327
|
+
if (oldStartIdx > oldEndIdx) {
|
|
4328
|
+
// There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
|
|
4329
|
+
// already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
|
|
4330
|
+
let i = newEndIdx;
|
|
4331
|
+
let n;
|
|
4332
|
+
|
|
4333
|
+
do {
|
|
4334
|
+
n = newCh[++i];
|
|
4335
|
+
} while (!isVNode(n) && i < newChEnd);
|
|
4336
|
+
|
|
4337
|
+
before = isVNode(n) ? n.elm : null;
|
|
4338
|
+
mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
|
|
4339
|
+
} else {
|
|
4340
|
+
unmountVNodes(oldCh, parent, renderer, true, oldStartIdx, oldEndIdx + 1);
|
|
4085
4341
|
}
|
|
4342
|
+
}
|
|
4086
4343
|
}
|
|
4344
|
+
|
|
4087
4345
|
function updateStaticChildren(c1, c2, parent, renderer) {
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
anchor = n2.elm;
|
|
4122
|
-
}
|
|
4346
|
+
const c1Length = c1.length;
|
|
4347
|
+
const c2Length = c2.length;
|
|
4348
|
+
|
|
4349
|
+
if (c1Length === 0) {
|
|
4350
|
+
// the old list is empty, we can directly insert anything new
|
|
4351
|
+
mountVNodes(c2, parent, renderer, null);
|
|
4352
|
+
return;
|
|
4353
|
+
}
|
|
4354
|
+
|
|
4355
|
+
if (c2Length === 0) {
|
|
4356
|
+
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
4357
|
+
// this is the case in which the dynamic children of an if-directive should be removed
|
|
4358
|
+
unmountVNodes(c1, parent, renderer, true);
|
|
4359
|
+
return;
|
|
4360
|
+
} // if the old list is not empty, the new list MUST have the same
|
|
4361
|
+
// amount of nodes, that's why we call this static children
|
|
4362
|
+
|
|
4363
|
+
|
|
4364
|
+
let anchor = null;
|
|
4365
|
+
|
|
4366
|
+
for (let i = c2Length - 1; i >= 0; i -= 1) {
|
|
4367
|
+
const n1 = c1[i];
|
|
4368
|
+
const n2 = c2[i];
|
|
4369
|
+
|
|
4370
|
+
if (n2 !== n1) {
|
|
4371
|
+
if (isVNode(n1)) {
|
|
4372
|
+
if (isVNode(n2)) {
|
|
4373
|
+
// both vnodes are equivalent, and we just need to patch them
|
|
4374
|
+
patch(n1, n2, parent, renderer);
|
|
4375
|
+
anchor = n2.elm;
|
|
4376
|
+
} else {
|
|
4377
|
+
// removing the old vnode since the new one is null
|
|
4378
|
+
unmount(n1, parent, renderer, true);
|
|
4123
4379
|
}
|
|
4380
|
+
} else if (isVNode(n2)) {
|
|
4381
|
+
mount(n2, parent, renderer, anchor);
|
|
4382
|
+
anchor = n2.elm;
|
|
4383
|
+
}
|
|
4124
4384
|
}
|
|
4385
|
+
}
|
|
4125
4386
|
}
|
|
4126
4387
|
|
|
4127
4388
|
/*
|
|
@@ -5976,7 +6237,7 @@ function freezeTemplate(tmpl) {
|
|
|
5976
6237
|
});
|
|
5977
6238
|
}
|
|
5978
6239
|
}
|
|
5979
|
-
/* version: 2.23.
|
|
6240
|
+
/* version: 2.23.2 */
|
|
5980
6241
|
|
|
5981
6242
|
/*
|
|
5982
6243
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -6446,6 +6707,6 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
6446
6707
|
*/
|
|
6447
6708
|
freeze(LightningElement);
|
|
6448
6709
|
seal(LightningElement.prototype);
|
|
6449
|
-
/* version: 2.23.
|
|
6710
|
+
/* version: 2.23.2 */
|
|
6450
6711
|
|
|
6451
6712
|
export { LightningElement, api$1 as api, createContextProvider, freezeTemplate, getComponentDef, isComponentConstructor, parseFragment, parseFragment as parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, renderComponent, renderer, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, track, unwrap, wire };
|