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