lwc 2.23.0 → 2.23.3
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 +1208 -877
- package/dist/engine-dom/iife/es2017/engine-dom.js +1208 -876
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +1115 -812
- package/dist/engine-dom/iife/es5/engine-dom.js +473 -386
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +424 -344
- package/dist/engine-dom/umd/es2017/engine-dom.js +1208 -876
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +1115 -812
- package/dist/engine-dom/umd/es5/engine-dom.js +473 -386
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +424 -344
- package/dist/engine-server/commonjs/es2017/engine-server.js +803 -537
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +803 -537
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +20 -20
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +20 -20
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +19 -19
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +20 -20
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +19 -19
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +20 -20
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +19 -19
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +20 -20
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +19 -19
- 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 +17 -9
|
@@ -254,7 +254,7 @@ const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
|
254
254
|
// e.g. `</tagName>` or `<tagName />`. For instance, `<meta>` closes on its own; no need for a slash.
|
|
255
255
|
// These only come from HTML; there are no void elements in the SVG or MathML namespaces.
|
|
256
256
|
// See: https://html.spec.whatwg.org/multipage/syntax.html#syntax-tags
|
|
257
|
-
const
|
|
257
|
+
const VOID_ELEMENTS = [
|
|
258
258
|
'area',
|
|
259
259
|
'base',
|
|
260
260
|
'br',
|
|
@@ -268,7 +268,12 @@ const VOID_ELEMENTS_SET = new Set([
|
|
|
268
268
|
'source',
|
|
269
269
|
'track',
|
|
270
270
|
'wbr',
|
|
271
|
-
]
|
|
271
|
+
];
|
|
272
|
+
// These elements have been deprecated but preserving their usage for backwards compatibility
|
|
273
|
+
// until we can officially deprecate them from LWC.
|
|
274
|
+
// See: https://html.spec.whatwg.org/multipage/obsolete.html#obsolete-but-conforming-features
|
|
275
|
+
const DEPRECATED_VOID_ELEMENTS = ['param', 'keygen', 'menuitem'];
|
|
276
|
+
const VOID_ELEMENTS_SET = new Set([...VOID_ELEMENTS, ...DEPRECATED_VOID_ELEMENTS]);
|
|
272
277
|
function isVoidElement(name, namespace) {
|
|
273
278
|
return namespace === HTML_NAMESPACE && VOID_ELEMENTS_SET.has(name.toLowerCase());
|
|
274
279
|
}
|
|
@@ -317,24 +322,36 @@ function isBooleanAttribute(attrName, tagName) {
|
|
|
317
322
|
return (allowedTagNames !== undefined &&
|
|
318
323
|
(allowedTagNames.size === 0 || allowedTagNames.has(tagName)));
|
|
319
324
|
}
|
|
325
|
+
// This list is based on https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
|
|
320
326
|
const GLOBAL_ATTRIBUTE = new Set([
|
|
321
|
-
'role',
|
|
322
327
|
'accesskey',
|
|
328
|
+
'autocapitalize',
|
|
329
|
+
'autofocus',
|
|
323
330
|
'class',
|
|
324
331
|
'contenteditable',
|
|
325
332
|
'contextmenu',
|
|
326
333
|
'dir',
|
|
327
334
|
'draggable',
|
|
328
|
-
'
|
|
335
|
+
'enterkeyhint',
|
|
336
|
+
'exportparts',
|
|
329
337
|
'hidden',
|
|
330
338
|
'id',
|
|
339
|
+
'inputmode',
|
|
340
|
+
'is',
|
|
341
|
+
'itemid',
|
|
331
342
|
'itemprop',
|
|
343
|
+
'itemref',
|
|
344
|
+
'itemscope',
|
|
345
|
+
'itemtype',
|
|
332
346
|
'lang',
|
|
347
|
+
'nonce',
|
|
348
|
+
'part',
|
|
333
349
|
'slot',
|
|
334
350
|
'spellcheck',
|
|
335
351
|
'style',
|
|
336
352
|
'tabindex',
|
|
337
353
|
'title',
|
|
354
|
+
'translate',
|
|
338
355
|
]);
|
|
339
356
|
function isGlobalHtmlAttribute(attrName) {
|
|
340
357
|
return GLOBAL_ATTRIBUTE.has(attrName);
|
|
@@ -419,9 +436,9 @@ function htmlEscape(str, attrMode = false) {
|
|
|
419
436
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
420
437
|
*/
|
|
421
438
|
// Increment whenever the LWC template compiler changes
|
|
422
|
-
const LWC_VERSION = "2.23.
|
|
439
|
+
const LWC_VERSION = "2.23.3";
|
|
423
440
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
424
|
-
/** version: 2.23.
|
|
441
|
+
/** version: 2.23.3 */
|
|
425
442
|
|
|
426
443
|
/*
|
|
427
444
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -473,6 +490,7 @@ const features = {
|
|
|
473
490
|
ENABLE_HTML_COLLECTIONS_PATCH: null,
|
|
474
491
|
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
475
492
|
ENABLE_MIXED_SHADOW_MODE: null,
|
|
493
|
+
ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
|
|
476
494
|
ENABLE_NODE_LIST_PATCH: null,
|
|
477
495
|
ENABLE_NODE_PATCH: null,
|
|
478
496
|
ENABLE_REACTIVE_SETTER: null,
|
|
@@ -481,7 +499,7 @@ const features = {
|
|
|
481
499
|
if (!_globalThis.lwcRuntimeFlags) {
|
|
482
500
|
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
|
|
483
501
|
}
|
|
484
|
-
const
|
|
502
|
+
const lwcRuntimeFlags = _globalThis.lwcRuntimeFlags;
|
|
485
503
|
/**
|
|
486
504
|
* Set the value at runtime of a given feature flag. This method only be invoked once per feature
|
|
487
505
|
* flag. It is meant to be used during the app initialization.
|
|
@@ -508,17 +526,17 @@ function setFeatureFlag(name, value) {
|
|
|
508
526
|
}
|
|
509
527
|
if (process.env.NODE_ENV !== 'production') {
|
|
510
528
|
// Allow the same flag to be set more than once outside of production to enable testing
|
|
511
|
-
|
|
529
|
+
lwcRuntimeFlags[name] = value;
|
|
512
530
|
}
|
|
513
531
|
else {
|
|
514
532
|
// Disallow the same flag to be set more than once in production
|
|
515
|
-
const runtimeValue =
|
|
533
|
+
const runtimeValue = lwcRuntimeFlags[name];
|
|
516
534
|
if (!isUndefined$1(runtimeValue)) {
|
|
517
535
|
// eslint-disable-next-line no-console
|
|
518
536
|
console.error(`Failed to set the value "${value}" for the runtime feature flag "${name}". "${name}" has already been set with the value "${runtimeValue}".`);
|
|
519
537
|
return;
|
|
520
538
|
}
|
|
521
|
-
defineProperty(
|
|
539
|
+
defineProperty(lwcRuntimeFlags, name, { value });
|
|
522
540
|
}
|
|
523
541
|
}
|
|
524
542
|
/**
|
|
@@ -530,7 +548,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
530
548
|
setFeatureFlag(name, value);
|
|
531
549
|
}
|
|
532
550
|
}
|
|
533
|
-
/** version: 2.23.
|
|
551
|
+
/** version: 2.23.3 */
|
|
534
552
|
|
|
535
553
|
/* proxy-compat-disable */
|
|
536
554
|
|
|
@@ -546,7 +564,7 @@ if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
|
546
564
|
window.addEventListener('test-dummy-flag', () => {
|
|
547
565
|
let hasFlag = false;
|
|
548
566
|
|
|
549
|
-
if (
|
|
567
|
+
if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
|
|
550
568
|
hasFlag = true;
|
|
551
569
|
}
|
|
552
570
|
|
|
@@ -2208,7 +2226,7 @@ function createPublicAccessorDescriptor(key, descriptor) {
|
|
|
2208
2226
|
}
|
|
2209
2227
|
|
|
2210
2228
|
if (set) {
|
|
2211
|
-
if (
|
|
2229
|
+
if (lwcRuntimeFlags.ENABLE_REACTIVE_SETTER) {
|
|
2212
2230
|
let ro = vm.oar[key];
|
|
2213
2231
|
|
|
2214
2232
|
if (isUndefined$1(ro)) {
|
|
@@ -2787,7 +2805,7 @@ function getTemplateOrSwappedTemplate(tpl) {
|
|
|
2787
2805
|
throw new ReferenceError();
|
|
2788
2806
|
}
|
|
2789
2807
|
|
|
2790
|
-
if (
|
|
2808
|
+
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2791
2809
|
const visited = new Set();
|
|
2792
2810
|
|
|
2793
2811
|
while (swappedTemplateMap.has(tpl) && !visited.has(tpl)) {
|
|
@@ -2804,7 +2822,7 @@ function getComponentOrSwappedComponent(Ctor) {
|
|
|
2804
2822
|
throw new ReferenceError();
|
|
2805
2823
|
}
|
|
2806
2824
|
|
|
2807
|
-
if (
|
|
2825
|
+
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2808
2826
|
const visited = new Set();
|
|
2809
2827
|
|
|
2810
2828
|
while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {
|
|
@@ -2821,7 +2839,7 @@ function getStyleOrSwappedStyle(style) {
|
|
|
2821
2839
|
throw new ReferenceError();
|
|
2822
2840
|
}
|
|
2823
2841
|
|
|
2824
|
-
if (
|
|
2842
|
+
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2825
2843
|
const visited = new Set();
|
|
2826
2844
|
|
|
2827
2845
|
while (swappedStyleMap.has(style) && !visited.has(style)) {
|
|
@@ -2838,7 +2856,7 @@ function setActiveVM(vm) {
|
|
|
2838
2856
|
throw new ReferenceError();
|
|
2839
2857
|
}
|
|
2840
2858
|
|
|
2841
|
-
if (
|
|
2859
|
+
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2842
2860
|
// tracking active component
|
|
2843
2861
|
const Ctor = vm.def.ctor;
|
|
2844
2862
|
let componentVMs = activeComponents.get(Ctor);
|
|
@@ -2895,7 +2913,7 @@ function removeActiveVM(vm) {
|
|
|
2895
2913
|
throw new ReferenceError();
|
|
2896
2914
|
}
|
|
2897
2915
|
|
|
2898
|
-
if (
|
|
2916
|
+
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2899
2917
|
// tracking inactive component
|
|
2900
2918
|
const Ctor = vm.def.ctor;
|
|
2901
2919
|
let list = activeComponents.get(Ctor);
|
|
@@ -3284,30 +3302,67 @@ function createStylesheet(vm, stylesheets) {
|
|
|
3284
3302
|
* SPDX-License-Identifier: MIT
|
|
3285
3303
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3286
3304
|
*/
|
|
3305
|
+
|
|
3306
|
+
function checkHasVM(elm) {
|
|
3307
|
+
const hasVM = !isUndefined$1(getAssociatedVMIfPresent(elm));
|
|
3308
|
+
|
|
3309
|
+
if (process.env.NODE_ENV !== 'production' && !hasVM) {
|
|
3310
|
+
// Occurs when an element is manually created with the same tag name as an existing LWC component. In that case,
|
|
3311
|
+
// we skip calling the LWC connectedCallback/disconnectedCallback logic and log an error.
|
|
3312
|
+
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.`);
|
|
3313
|
+
}
|
|
3314
|
+
|
|
3315
|
+
return hasVM;
|
|
3316
|
+
}
|
|
3317
|
+
|
|
3287
3318
|
function getUpgradableConstructor(tagName, renderer) {
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3319
|
+
const {
|
|
3320
|
+
getCustomElement,
|
|
3321
|
+
HTMLElementExported: RendererHTMLElement,
|
|
3322
|
+
defineCustomElement
|
|
3323
|
+
} = renderer; // Should never get a tag with upper case letter at this point, the compiler should
|
|
3324
|
+
// produce only tags with lowercase letters
|
|
3325
|
+
// But, for backwards compatibility, we will lower case the tagName
|
|
3326
|
+
|
|
3327
|
+
tagName = tagName.toLowerCase();
|
|
3328
|
+
let CE = getCustomElement(tagName);
|
|
3329
|
+
|
|
3330
|
+
if (!isUndefined$1(CE)) {
|
|
3331
|
+
return CE;
|
|
3332
|
+
}
|
|
3333
|
+
/**
|
|
3334
|
+
* LWC Upgradable Element reference to an element that was created
|
|
3335
|
+
* via the scoped registry mechanism, and that is ready to be upgraded.
|
|
3336
|
+
*/
|
|
3337
|
+
|
|
3338
|
+
|
|
3339
|
+
CE = class LWCUpgradableElement extends RendererHTMLElement {
|
|
3340
|
+
constructor(upgradeCallback) {
|
|
3341
|
+
super();
|
|
3342
|
+
|
|
3343
|
+
if (isFunction$1(upgradeCallback)) {
|
|
3344
|
+
upgradeCallback(this); // nothing to do with the result for now
|
|
3345
|
+
}
|
|
3296
3346
|
}
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
CE =
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
upgradeCallback(this); // nothing to do with the result for now
|
|
3306
|
-
}
|
|
3307
|
-
}
|
|
3347
|
+
|
|
3348
|
+
};
|
|
3349
|
+
|
|
3350
|
+
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
3351
|
+
CE.prototype.connectedCallback = function () {
|
|
3352
|
+
if (checkHasVM(this)) {
|
|
3353
|
+
connectRootElement(this);
|
|
3354
|
+
}
|
|
3308
3355
|
};
|
|
3309
|
-
|
|
3310
|
-
|
|
3356
|
+
|
|
3357
|
+
CE.prototype.disconnectedCallback = function () {
|
|
3358
|
+
if (checkHasVM(this)) {
|
|
3359
|
+
disconnectRootElement(this);
|
|
3360
|
+
}
|
|
3361
|
+
};
|
|
3362
|
+
}
|
|
3363
|
+
|
|
3364
|
+
defineCustomElement(tagName, CE);
|
|
3365
|
+
return CE;
|
|
3311
3366
|
}
|
|
3312
3367
|
|
|
3313
3368
|
/*
|
|
@@ -3553,579 +3608,790 @@ function applyStaticStyleAttribute(vnode, renderer) {
|
|
|
3553
3608
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3554
3609
|
*/
|
|
3555
3610
|
function patchChildren(c1, c2, parent, renderer) {
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
}
|
|
3611
|
+
if (hasDynamicChildren(c2)) {
|
|
3612
|
+
updateDynamicChildren(c1, c2, parent, renderer);
|
|
3613
|
+
} else {
|
|
3614
|
+
updateStaticChildren(c1, c2, parent, renderer);
|
|
3615
|
+
}
|
|
3562
3616
|
}
|
|
3617
|
+
|
|
3563
3618
|
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;
|
|
3619
|
+
var _a, _b;
|
|
3620
|
+
|
|
3621
|
+
if (n1 === n2) {
|
|
3622
|
+
return;
|
|
3623
|
+
}
|
|
3624
|
+
|
|
3625
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3626
|
+
if (!isSameVnode(n1, n2)) {
|
|
3627
|
+
throw new Error('Expected these VNodes to be the same: ' + JSON.stringify({
|
|
3628
|
+
sel: n1.sel,
|
|
3629
|
+
key: n1.key
|
|
3630
|
+
}) + ', ' + JSON.stringify({
|
|
3631
|
+
sel: n2.sel,
|
|
3632
|
+
key: n2.key
|
|
3633
|
+
}));
|
|
3594
3634
|
}
|
|
3635
|
+
}
|
|
3636
|
+
|
|
3637
|
+
switch (n2.type) {
|
|
3638
|
+
case 0
|
|
3639
|
+
/* VNodeType.Text */
|
|
3640
|
+
:
|
|
3641
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
3642
|
+
patchText(n1, n2, renderer);
|
|
3643
|
+
break;
|
|
3644
|
+
|
|
3645
|
+
case 1
|
|
3646
|
+
/* VNodeType.Comment */
|
|
3647
|
+
:
|
|
3648
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
3649
|
+
patchComment(n1, n2, renderer);
|
|
3650
|
+
break;
|
|
3651
|
+
|
|
3652
|
+
case 4
|
|
3653
|
+
/* VNodeType.Static */
|
|
3654
|
+
:
|
|
3655
|
+
n2.elm = n1.elm;
|
|
3656
|
+
break;
|
|
3657
|
+
|
|
3658
|
+
case 2
|
|
3659
|
+
/* VNodeType.Element */
|
|
3660
|
+
:
|
|
3661
|
+
patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3662
|
+
break;
|
|
3663
|
+
|
|
3664
|
+
case 3
|
|
3665
|
+
/* VNodeType.CustomElement */
|
|
3666
|
+
:
|
|
3667
|
+
patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3668
|
+
break;
|
|
3669
|
+
}
|
|
3595
3670
|
}
|
|
3671
|
+
|
|
3596
3672
|
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
|
-
|
|
3673
|
+
var _a, _b;
|
|
3674
|
+
|
|
3675
|
+
switch (node.type) {
|
|
3676
|
+
case 0
|
|
3677
|
+
/* VNodeType.Text */
|
|
3678
|
+
:
|
|
3679
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
3680
|
+
mountText(node, parent, anchor, renderer);
|
|
3681
|
+
break;
|
|
3682
|
+
|
|
3683
|
+
case 1
|
|
3684
|
+
/* VNodeType.Comment */
|
|
3685
|
+
:
|
|
3686
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
3687
|
+
mountComment(node, parent, anchor, renderer);
|
|
3688
|
+
break;
|
|
3689
|
+
|
|
3690
|
+
case 4
|
|
3691
|
+
/* VNodeType.Static */
|
|
3692
|
+
:
|
|
3693
|
+
// VStatic cannot have a custom renderer associated to them, using owner's renderer
|
|
3694
|
+
mountStatic(node, parent, anchor, renderer);
|
|
3695
|
+
break;
|
|
3696
|
+
|
|
3697
|
+
case 2
|
|
3698
|
+
/* VNodeType.Element */
|
|
3699
|
+
:
|
|
3700
|
+
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
3701
|
+
mountElement(node, parent, anchor, (_a = node.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3702
|
+
break;
|
|
3703
|
+
|
|
3704
|
+
case 3
|
|
3705
|
+
/* VNodeType.CustomElement */
|
|
3706
|
+
:
|
|
3707
|
+
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
3708
|
+
mountCustomElement(node, parent, anchor, (_b = node.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3709
|
+
break;
|
|
3710
|
+
}
|
|
3620
3711
|
}
|
|
3712
|
+
|
|
3621
3713
|
function patchText(n1, n2, renderer) {
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3714
|
+
n2.elm = n1.elm;
|
|
3715
|
+
|
|
3716
|
+
if (n2.text !== n1.text) {
|
|
3717
|
+
updateTextContent(n2, renderer);
|
|
3718
|
+
}
|
|
3626
3719
|
}
|
|
3720
|
+
|
|
3627
3721
|
function mountText(vnode, parent, anchor, renderer) {
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3722
|
+
const {
|
|
3723
|
+
owner
|
|
3724
|
+
} = vnode;
|
|
3725
|
+
const {
|
|
3726
|
+
createText
|
|
3727
|
+
} = renderer;
|
|
3728
|
+
const textNode = vnode.elm = createText(vnode.text);
|
|
3729
|
+
linkNodeToShadow(textNode, owner, renderer);
|
|
3730
|
+
insertNode(textNode, parent, anchor, renderer);
|
|
3633
3731
|
}
|
|
3732
|
+
|
|
3634
3733
|
function patchComment(n1, n2, renderer) {
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3734
|
+
n2.elm = n1.elm; // FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
|
|
3735
|
+
// it is the case today.
|
|
3736
|
+
|
|
3737
|
+
if (n2.text !== n1.text) {
|
|
3738
|
+
updateTextContent(n2, renderer);
|
|
3739
|
+
}
|
|
3641
3740
|
}
|
|
3741
|
+
|
|
3642
3742
|
function mountComment(vnode, parent, anchor, renderer) {
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3743
|
+
const {
|
|
3744
|
+
owner
|
|
3745
|
+
} = vnode;
|
|
3746
|
+
const {
|
|
3747
|
+
createComment
|
|
3748
|
+
} = renderer;
|
|
3749
|
+
const commentNode = vnode.elm = createComment(vnode.text);
|
|
3750
|
+
linkNodeToShadow(commentNode, owner, renderer);
|
|
3751
|
+
insertNode(commentNode, parent, anchor, renderer);
|
|
3648
3752
|
}
|
|
3753
|
+
|
|
3649
3754
|
function mountElement(vnode, parent, anchor, renderer) {
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3755
|
+
const {
|
|
3756
|
+
sel,
|
|
3757
|
+
owner,
|
|
3758
|
+
data: {
|
|
3759
|
+
svg
|
|
3760
|
+
}
|
|
3761
|
+
} = vnode;
|
|
3762
|
+
const {
|
|
3763
|
+
createElement
|
|
3764
|
+
} = renderer;
|
|
3765
|
+
const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
3766
|
+
const elm = vnode.elm = createElement(sel, namespace);
|
|
3767
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3768
|
+
applyStyleScoping(elm, owner, renderer);
|
|
3769
|
+
applyDomManual(elm, vnode);
|
|
3770
|
+
applyElementRestrictions(elm, vnode);
|
|
3771
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
3772
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3773
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
3661
3774
|
}
|
|
3775
|
+
|
|
3662
3776
|
function patchElement(n1, n2, renderer) {
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3777
|
+
const elm = n2.elm = n1.elm;
|
|
3778
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3779
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3666
3780
|
}
|
|
3781
|
+
|
|
3667
3782
|
function mountStatic(vnode, parent, anchor, renderer) {
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3783
|
+
const {
|
|
3784
|
+
owner
|
|
3785
|
+
} = vnode;
|
|
3786
|
+
const {
|
|
3787
|
+
cloneNode,
|
|
3788
|
+
isSyntheticShadowDefined
|
|
3789
|
+
} = renderer;
|
|
3790
|
+
const elm = vnode.elm = cloneNode(vnode.fragment, true);
|
|
3791
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3792
|
+
applyElementRestrictions(elm, vnode); // Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
|
|
3793
|
+
|
|
3794
|
+
const {
|
|
3795
|
+
renderMode,
|
|
3796
|
+
shadowMode
|
|
3797
|
+
} = owner;
|
|
3798
|
+
|
|
3799
|
+
if (isSyntheticShadowDefined) {
|
|
3800
|
+
if (shadowMode === 1
|
|
3801
|
+
/* ShadowMode.Synthetic */
|
|
3802
|
+
|| renderMode === 0
|
|
3803
|
+
/* RenderMode.Light */
|
|
3804
|
+
) {
|
|
3805
|
+
elm[KEY__SHADOW_STATIC] = true;
|
|
3679
3806
|
}
|
|
3680
|
-
|
|
3807
|
+
}
|
|
3808
|
+
|
|
3809
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3681
3810
|
}
|
|
3811
|
+
|
|
3682
3812
|
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
|
-
|
|
3813
|
+
const {
|
|
3814
|
+
sel,
|
|
3815
|
+
owner
|
|
3816
|
+
} = vnode;
|
|
3817
|
+
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
3818
|
+
/**
|
|
3819
|
+
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
3820
|
+
* with a callback as the first argument, we could implement a more advanced
|
|
3821
|
+
* mechanism that only passes that argument if the constructor is known to be
|
|
3822
|
+
* an upgradable custom element.
|
|
3823
|
+
*/
|
|
3824
|
+
|
|
3825
|
+
let vm;
|
|
3826
|
+
const elm = new UpgradableConstructor(elm => {
|
|
3827
|
+
// the custom element from the registry is expecting an upgrade callback
|
|
3828
|
+
vm = createViewModelHook(elm, vnode, renderer);
|
|
3829
|
+
});
|
|
3830
|
+
vnode.elm = elm;
|
|
3831
|
+
vnode.vm = vm;
|
|
3832
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3833
|
+
applyStyleScoping(elm, owner, renderer);
|
|
3834
|
+
|
|
3835
|
+
if (vm) {
|
|
3836
|
+
allocateChildren(vnode, vm);
|
|
3837
|
+
} else if (vnode.ctor !== UpgradableConstructor) {
|
|
3838
|
+
throw new TypeError(`Incorrect Component Constructor`);
|
|
3839
|
+
}
|
|
3840
|
+
|
|
3841
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
3842
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3843
|
+
|
|
3844
|
+
if (vm) {
|
|
3845
|
+
{
|
|
3846
|
+
// On the server, we don't have native custom element lifecycle callbacks, so we must
|
|
3847
|
+
// manually invoke the connectedCallback for a child component.
|
|
3848
|
+
runConnectedCallback(vm);
|
|
3717
3849
|
}
|
|
3850
|
+
}
|
|
3851
|
+
|
|
3852
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
3853
|
+
|
|
3854
|
+
if (vm) {
|
|
3855
|
+
appendVM(vm);
|
|
3856
|
+
}
|
|
3718
3857
|
}
|
|
3858
|
+
|
|
3719
3859
|
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
|
-
|
|
3860
|
+
if (n1.ctor !== n2.ctor) {
|
|
3861
|
+
// If the constructor, unmount the current component and mount a new one using the new
|
|
3862
|
+
// constructor.
|
|
3863
|
+
const anchor = renderer.nextSibling(n1.elm);
|
|
3864
|
+
unmount(n1, parent, renderer, true);
|
|
3865
|
+
mountCustomElement(n2, parent, anchor, renderer);
|
|
3866
|
+
} else {
|
|
3867
|
+
// Otherwise patch the existing component with new props/attrs/etc.
|
|
3868
|
+
const elm = n2.elm = n1.elm;
|
|
3869
|
+
const vm = n2.vm = n1.vm;
|
|
3870
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3871
|
+
|
|
3872
|
+
if (!isUndefined$1(vm)) {
|
|
3873
|
+
// in fallback mode, the allocation will always set children to
|
|
3874
|
+
// empty and delegate the real allocation to the slot elements
|
|
3875
|
+
allocateChildren(n2, vm);
|
|
3876
|
+
} // in fallback mode, the children will be always empty, so, nothing
|
|
3877
|
+
// will happen, but in native, it does allocate the light dom
|
|
3878
|
+
|
|
3879
|
+
|
|
3880
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3881
|
+
|
|
3882
|
+
if (!isUndefined$1(vm)) {
|
|
3883
|
+
// this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
3884
|
+
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
3885
|
+
rerenderVM(vm);
|
|
3745
3886
|
}
|
|
3887
|
+
}
|
|
3746
3888
|
}
|
|
3889
|
+
|
|
3747
3890
|
function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3891
|
+
for (; start < end; ++start) {
|
|
3892
|
+
const vnode = vnodes[start];
|
|
3893
|
+
|
|
3894
|
+
if (isVNode(vnode)) {
|
|
3895
|
+
mount(vnode, parent, renderer, anchor);
|
|
3753
3896
|
}
|
|
3897
|
+
}
|
|
3754
3898
|
}
|
|
3899
|
+
|
|
3755
3900
|
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
|
-
|
|
3901
|
+
const {
|
|
3902
|
+
type,
|
|
3903
|
+
elm,
|
|
3904
|
+
sel
|
|
3905
|
+
} = vnode; // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
3906
|
+
// subtree root, is the only element worth unmounting from the subtree.
|
|
3907
|
+
|
|
3908
|
+
if (doRemove) {
|
|
3909
|
+
// The vnode might or might not have a data.renderer associated to it
|
|
3910
|
+
// but the removal used here is from the owner instead.
|
|
3911
|
+
removeNode(elm, parent, renderer);
|
|
3912
|
+
}
|
|
3913
|
+
|
|
3914
|
+
switch (type) {
|
|
3915
|
+
case 2
|
|
3916
|
+
/* VNodeType.Element */
|
|
3917
|
+
:
|
|
3918
|
+
{
|
|
3919
|
+
// Slot content is removed to trigger slotchange event when removing slot.
|
|
3920
|
+
// Only required for synthetic shadow.
|
|
3921
|
+
const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1
|
|
3922
|
+
/* ShadowMode.Synthetic */
|
|
3923
|
+
;
|
|
3924
|
+
unmountVNodes(vnode.children, elm, renderer, shouldRemoveChildren);
|
|
3925
|
+
break;
|
|
3926
|
+
}
|
|
3927
|
+
|
|
3928
|
+
case 3
|
|
3929
|
+
/* VNodeType.CustomElement */
|
|
3930
|
+
:
|
|
3931
|
+
{
|
|
3932
|
+
const {
|
|
3933
|
+
vm
|
|
3934
|
+
} = vnode; // No need to unmount the children here, `removeVM` will take care of removing the
|
|
3935
|
+
// children.
|
|
3936
|
+
|
|
3937
|
+
if (!isUndefined$1(vm)) {
|
|
3938
|
+
removeVM(vm);
|
|
3779
3939
|
}
|
|
3780
|
-
|
|
3940
|
+
}
|
|
3941
|
+
}
|
|
3781
3942
|
}
|
|
3943
|
+
|
|
3782
3944
|
function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, end = vnodes.length) {
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3945
|
+
for (; start < end; ++start) {
|
|
3946
|
+
const ch = vnodes[start];
|
|
3947
|
+
|
|
3948
|
+
if (isVNode(ch)) {
|
|
3949
|
+
unmount(ch, parent, renderer, doRemove);
|
|
3788
3950
|
}
|
|
3951
|
+
}
|
|
3789
3952
|
}
|
|
3953
|
+
|
|
3790
3954
|
function isVNode(vnode) {
|
|
3791
|
-
|
|
3955
|
+
return vnode != null;
|
|
3792
3956
|
}
|
|
3957
|
+
|
|
3793
3958
|
function linkNodeToShadow(elm, owner, renderer) {
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3959
|
+
const {
|
|
3960
|
+
renderRoot,
|
|
3961
|
+
renderMode,
|
|
3962
|
+
shadowMode
|
|
3963
|
+
} = owner;
|
|
3964
|
+
const {
|
|
3965
|
+
isSyntheticShadowDefined
|
|
3966
|
+
} = renderer; // TODO [#1164]: this should eventually be done by the polyfill directly
|
|
3967
|
+
|
|
3968
|
+
if (isSyntheticShadowDefined) {
|
|
3969
|
+
if (shadowMode === 1
|
|
3970
|
+
/* ShadowMode.Synthetic */
|
|
3971
|
+
|| renderMode === 0
|
|
3972
|
+
/* RenderMode.Light */
|
|
3973
|
+
) {
|
|
3974
|
+
elm[KEY__SHADOW_RESOLVER] = renderRoot[KEY__SHADOW_RESOLVER];
|
|
3801
3975
|
}
|
|
3976
|
+
}
|
|
3802
3977
|
}
|
|
3978
|
+
|
|
3803
3979
|
function updateTextContent(vnode, renderer) {
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
setText
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3980
|
+
const {
|
|
3981
|
+
elm,
|
|
3982
|
+
text
|
|
3983
|
+
} = vnode;
|
|
3984
|
+
const {
|
|
3985
|
+
setText
|
|
3986
|
+
} = renderer;
|
|
3987
|
+
|
|
3988
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3989
|
+
unlockDomMutation();
|
|
3990
|
+
}
|
|
3991
|
+
|
|
3992
|
+
setText(elm, text);
|
|
3993
|
+
|
|
3994
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3995
|
+
lockDomMutation();
|
|
3996
|
+
}
|
|
3813
3997
|
}
|
|
3998
|
+
|
|
3814
3999
|
function insertNode(node, parent, anchor, renderer) {
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
4000
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4001
|
+
unlockDomMutation();
|
|
4002
|
+
}
|
|
4003
|
+
|
|
4004
|
+
renderer.insert(node, parent, anchor);
|
|
4005
|
+
|
|
4006
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4007
|
+
lockDomMutation();
|
|
4008
|
+
}
|
|
3822
4009
|
}
|
|
4010
|
+
|
|
3823
4011
|
function removeNode(node, parent, renderer) {
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
4012
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4013
|
+
unlockDomMutation();
|
|
4014
|
+
}
|
|
4015
|
+
|
|
4016
|
+
renderer.remove(node, parent);
|
|
4017
|
+
|
|
4018
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4019
|
+
lockDomMutation();
|
|
4020
|
+
}
|
|
3831
4021
|
}
|
|
4022
|
+
|
|
3832
4023
|
function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
4024
|
+
if (isNull(oldVnode)) {
|
|
4025
|
+
applyEventListeners(vnode, renderer);
|
|
4026
|
+
applyStaticClassAttribute(vnode, renderer);
|
|
4027
|
+
applyStaticStyleAttribute(vnode, renderer);
|
|
4028
|
+
} // Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
|
|
4029
|
+
// value is set before type=radio.
|
|
4030
|
+
|
|
4031
|
+
|
|
4032
|
+
patchClassAttribute(oldVnode, vnode, renderer);
|
|
4033
|
+
patchStyleAttribute(oldVnode, vnode, renderer);
|
|
4034
|
+
patchAttributes(oldVnode, vnode, renderer);
|
|
4035
|
+
patchProps(oldVnode, vnode, renderer);
|
|
3844
4036
|
}
|
|
4037
|
+
|
|
3845
4038
|
function applyStyleScoping(elm, owner, renderer) {
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
4039
|
+
// Set the class name for `*.scoped.css` style scoping.
|
|
4040
|
+
const scopeToken = getScopeTokenClass(owner);
|
|
4041
|
+
|
|
4042
|
+
if (!isNull(scopeToken)) {
|
|
4043
|
+
const {
|
|
4044
|
+
getClassList
|
|
4045
|
+
} = renderer; // TODO [#2762]: this dot notation with add is probably problematic
|
|
4046
|
+
// probably we should have a renderer api for just the add operation
|
|
4047
|
+
|
|
4048
|
+
getClassList(elm).add(scopeToken);
|
|
4049
|
+
} // Set property element for synthetic shadow DOM style scoping.
|
|
4050
|
+
|
|
4051
|
+
|
|
4052
|
+
const {
|
|
4053
|
+
stylesheetToken: syntheticToken
|
|
4054
|
+
} = owner.context;
|
|
4055
|
+
|
|
4056
|
+
if (owner.shadowMode === 1
|
|
4057
|
+
/* ShadowMode.Synthetic */
|
|
4058
|
+
&& !isUndefined$1(syntheticToken)) {
|
|
4059
|
+
elm.$shadowToken$ = syntheticToken;
|
|
4060
|
+
}
|
|
3859
4061
|
}
|
|
4062
|
+
|
|
3860
4063
|
function applyDomManual(elm, vnode) {
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
4064
|
+
var _a;
|
|
4065
|
+
|
|
4066
|
+
const {
|
|
4067
|
+
owner,
|
|
4068
|
+
data: {
|
|
4069
|
+
context
|
|
3865
4070
|
}
|
|
4071
|
+
} = vnode;
|
|
4072
|
+
|
|
4073
|
+
if (owner.shadowMode === 1
|
|
4074
|
+
/* ShadowMode.Synthetic */
|
|
4075
|
+
&& ((_a = context === null || context === void 0 ? void 0 : context.lwc) === null || _a === void 0 ? void 0 : _a.dom) === "manual"
|
|
4076
|
+
/* LwcDomMode.Manual */
|
|
4077
|
+
) {
|
|
4078
|
+
elm.$domManual$ = true;
|
|
4079
|
+
}
|
|
3866
4080
|
}
|
|
4081
|
+
|
|
3867
4082
|
function applyElementRestrictions(elm, vnode) {
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
4083
|
+
var _a, _b;
|
|
4084
|
+
|
|
4085
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4086
|
+
const isPortal = vnode.type === 2
|
|
4087
|
+
/* VNodeType.Element */
|
|
4088
|
+
&& ((_b = (_a = vnode.data.context) === null || _a === void 0 ? void 0 : _a.lwc) === null || _b === void 0 ? void 0 : _b.dom) === "manual"
|
|
4089
|
+
/* LwcDomMode.Manual */
|
|
4090
|
+
;
|
|
4091
|
+
const isLight = vnode.owner.renderMode === 0
|
|
4092
|
+
/* RenderMode.Light */
|
|
4093
|
+
;
|
|
4094
|
+
patchElementWithRestrictions(elm, {
|
|
4095
|
+
isPortal,
|
|
4096
|
+
isLight
|
|
4097
|
+
});
|
|
4098
|
+
}
|
|
3877
4099
|
}
|
|
4100
|
+
|
|
3878
4101
|
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
|
-
|
|
4102
|
+
// A component with slots will re-render because:
|
|
4103
|
+
// 1- There is a change of the internal state.
|
|
4104
|
+
// 2- There is a change on the external api (ex: slots)
|
|
4105
|
+
//
|
|
4106
|
+
// In case #1, the vnodes in the cmpSlots will be reused since they didn't changed. This routine emptied the
|
|
4107
|
+
// slotted children when those VCustomElement were rendered and therefore in subsequent calls to allocate children
|
|
4108
|
+
// in a reused VCustomElement, there won't be any slotted children.
|
|
4109
|
+
// For those cases, we will use the reference for allocated children stored when rendering the fresh VCustomElement.
|
|
4110
|
+
//
|
|
4111
|
+
// In case #2, we will always get a fresh VCustomElement.
|
|
4112
|
+
const children = vnode.aChildren || vnode.children;
|
|
4113
|
+
vm.aChildren = children;
|
|
4114
|
+
const {
|
|
4115
|
+
renderMode,
|
|
4116
|
+
shadowMode
|
|
4117
|
+
} = vm;
|
|
4118
|
+
|
|
4119
|
+
if (shadowMode === 1
|
|
4120
|
+
/* ShadowMode.Synthetic */
|
|
4121
|
+
|| renderMode === 0
|
|
4122
|
+
/* RenderMode.Light */
|
|
4123
|
+
) {
|
|
4124
|
+
// slow path
|
|
4125
|
+
allocateInSlot(vm, children); // save the allocated children in case this vnode is reused.
|
|
4126
|
+
|
|
4127
|
+
vnode.aChildren = children; // every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
|
|
4128
|
+
|
|
4129
|
+
vnode.children = EmptyArray;
|
|
4130
|
+
}
|
|
3900
4131
|
}
|
|
4132
|
+
|
|
3901
4133
|
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
|
-
}
|
|
4134
|
+
let vm = getAssociatedVMIfPresent(elm); // There is a possibility that a custom element is registered under tagName, in which case, the
|
|
4135
|
+
// initialization is already carry on, and there is nothing else to do here since this hook is
|
|
4136
|
+
// called right after invoking `document.createElement`.
|
|
4137
|
+
|
|
4138
|
+
if (!isUndefined$1(vm)) {
|
|
3918
4139
|
return vm;
|
|
4140
|
+
}
|
|
4141
|
+
|
|
4142
|
+
const {
|
|
4143
|
+
sel,
|
|
4144
|
+
mode,
|
|
4145
|
+
ctor,
|
|
4146
|
+
owner
|
|
4147
|
+
} = vnode;
|
|
4148
|
+
vm = createVM(elm, ctor, renderer, {
|
|
4149
|
+
mode,
|
|
4150
|
+
owner,
|
|
4151
|
+
tagName: sel
|
|
4152
|
+
});
|
|
4153
|
+
|
|
4154
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4155
|
+
assert.isTrue(isArray$1(vnode.children), `Invalid vnode for a custom element, it must have children defined.`);
|
|
4156
|
+
}
|
|
4157
|
+
|
|
4158
|
+
return vm;
|
|
3919
4159
|
}
|
|
4160
|
+
|
|
3920
4161
|
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
|
-
|
|
4162
|
+
var _a;
|
|
4163
|
+
|
|
4164
|
+
const {
|
|
4165
|
+
cmpSlots: oldSlots
|
|
4166
|
+
} = vm;
|
|
4167
|
+
const cmpSlots = vm.cmpSlots = create(null);
|
|
4168
|
+
|
|
4169
|
+
for (let i = 0, len = children.length; i < len; i += 1) {
|
|
4170
|
+
const vnode = children[i];
|
|
4171
|
+
|
|
4172
|
+
if (isNull(vnode)) {
|
|
4173
|
+
continue;
|
|
4174
|
+
}
|
|
4175
|
+
|
|
4176
|
+
let slotName = '';
|
|
4177
|
+
|
|
4178
|
+
if (isVBaseElement(vnode)) {
|
|
4179
|
+
slotName = ((_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) || '';
|
|
4180
|
+
}
|
|
4181
|
+
|
|
4182
|
+
const vnodes = cmpSlots[slotName] = cmpSlots[slotName] || [];
|
|
4183
|
+
ArrayPush$1.call(vnodes, vnode);
|
|
4184
|
+
}
|
|
4185
|
+
|
|
4186
|
+
if (isFalse(vm.isDirty)) {
|
|
4187
|
+
// We need to determine if the old allocation is really different from the new one
|
|
4188
|
+
// and mark the vm as dirty
|
|
4189
|
+
const oldKeys = keys(oldSlots);
|
|
4190
|
+
|
|
4191
|
+
if (oldKeys.length !== keys(cmpSlots).length) {
|
|
4192
|
+
markComponentAsDirty(vm);
|
|
4193
|
+
return;
|
|
4194
|
+
}
|
|
4195
|
+
|
|
4196
|
+
for (let i = 0, len = oldKeys.length; i < len; i += 1) {
|
|
4197
|
+
const key = oldKeys[i];
|
|
4198
|
+
|
|
4199
|
+
if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
|
|
4200
|
+
markComponentAsDirty(vm);
|
|
4201
|
+
return;
|
|
4202
|
+
}
|
|
4203
|
+
|
|
4204
|
+
const oldVNodes = oldSlots[key];
|
|
4205
|
+
const vnodes = cmpSlots[key];
|
|
4206
|
+
|
|
4207
|
+
for (let j = 0, a = cmpSlots[key].length; j < a; j += 1) {
|
|
4208
|
+
if (oldVNodes[j] !== vnodes[j]) {
|
|
4209
|
+
markComponentAsDirty(vm);
|
|
4210
|
+
return;
|
|
3958
4211
|
}
|
|
4212
|
+
}
|
|
3959
4213
|
}
|
|
3960
|
-
}
|
|
3961
|
-
// Using a WeakMap instead of a WeakSet because this one works in IE11 :(
|
|
3962
|
-
|
|
3963
|
-
|
|
4214
|
+
}
|
|
4215
|
+
} // Using a WeakMap instead of a WeakSet because this one works in IE11 :(
|
|
4216
|
+
|
|
4217
|
+
|
|
4218
|
+
const FromIteration = new WeakMap(); // dynamic children means it was generated by an iteration
|
|
3964
4219
|
// in a template, and will require a more complex diffing algo.
|
|
4220
|
+
|
|
3965
4221
|
function markAsDynamicChildren(children) {
|
|
3966
|
-
|
|
4222
|
+
FromIteration.set(children, 1);
|
|
3967
4223
|
}
|
|
4224
|
+
|
|
3968
4225
|
function hasDynamicChildren(children) {
|
|
3969
|
-
|
|
4226
|
+
return FromIteration.has(children);
|
|
3970
4227
|
}
|
|
4228
|
+
|
|
3971
4229
|
function createKeyToOldIdx(children, beginIdx, endIdx) {
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
4230
|
+
const map = {}; // TODO [#1637]: simplify this by assuming that all vnodes has keys
|
|
4231
|
+
|
|
4232
|
+
for (let j = beginIdx; j <= endIdx; ++j) {
|
|
4233
|
+
const ch = children[j];
|
|
4234
|
+
|
|
4235
|
+
if (isVNode(ch)) {
|
|
4236
|
+
const {
|
|
4237
|
+
key
|
|
4238
|
+
} = ch;
|
|
4239
|
+
|
|
4240
|
+
if (key !== undefined) {
|
|
4241
|
+
map[key] = j;
|
|
4242
|
+
}
|
|
3982
4243
|
}
|
|
3983
|
-
|
|
4244
|
+
}
|
|
4245
|
+
|
|
4246
|
+
return map;
|
|
3984
4247
|
}
|
|
4248
|
+
|
|
3985
4249
|
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
|
-
}
|
|
4250
|
+
let oldStartIdx = 0;
|
|
4251
|
+
let newStartIdx = 0;
|
|
4252
|
+
let oldEndIdx = oldCh.length - 1;
|
|
4253
|
+
let oldStartVnode = oldCh[0];
|
|
4254
|
+
let oldEndVnode = oldCh[oldEndIdx];
|
|
4255
|
+
const newChEnd = newCh.length - 1;
|
|
4256
|
+
let newEndIdx = newChEnd;
|
|
4257
|
+
let newStartVnode = newCh[0];
|
|
4258
|
+
let newEndVnode = newCh[newEndIdx];
|
|
4259
|
+
let oldKeyToIdx;
|
|
4260
|
+
let idxInOld;
|
|
4261
|
+
let elmToMove;
|
|
4262
|
+
let before;
|
|
4263
|
+
let clonedOldCh = false;
|
|
4264
|
+
|
|
4265
|
+
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
4266
|
+
if (!isVNode(oldStartVnode)) {
|
|
4267
|
+
oldStartVnode = oldCh[++oldStartIdx]; // Vnode might have been moved left
|
|
4268
|
+
} else if (!isVNode(oldEndVnode)) {
|
|
4269
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
|
4270
|
+
} else if (!isVNode(newStartVnode)) {
|
|
4271
|
+
newStartVnode = newCh[++newStartIdx];
|
|
4272
|
+
} else if (!isVNode(newEndVnode)) {
|
|
4273
|
+
newEndVnode = newCh[--newEndIdx];
|
|
4274
|
+
} else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
4275
|
+
patch(oldStartVnode, newStartVnode, parent, renderer);
|
|
4276
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
|
4277
|
+
newStartVnode = newCh[++newStartIdx];
|
|
4278
|
+
} else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
4279
|
+
patch(oldEndVnode, newEndVnode, parent, renderer);
|
|
4280
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
|
4281
|
+
newEndVnode = newCh[--newEndIdx];
|
|
4282
|
+
} else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
4283
|
+
// Vnode moved right
|
|
4284
|
+
patch(oldStartVnode, newEndVnode, parent, renderer);
|
|
4285
|
+
insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
|
|
4286
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
|
4287
|
+
newEndVnode = newCh[--newEndIdx];
|
|
4288
|
+
} else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
4289
|
+
// Vnode moved left
|
|
4290
|
+
patch(oldEndVnode, newStartVnode, parent, renderer);
|
|
4291
|
+
insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
|
|
4292
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
|
4293
|
+
newStartVnode = newCh[++newStartIdx];
|
|
4294
|
+
} else {
|
|
4295
|
+
if (oldKeyToIdx === undefined) {
|
|
4296
|
+
oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
|
|
4297
|
+
}
|
|
4298
|
+
|
|
4299
|
+
idxInOld = oldKeyToIdx[newStartVnode.key];
|
|
4300
|
+
|
|
4301
|
+
if (isUndefined$1(idxInOld)) {
|
|
4302
|
+
// New element
|
|
4303
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4304
|
+
newStartVnode = newCh[++newStartIdx];
|
|
4305
|
+
} else {
|
|
4306
|
+
elmToMove = oldCh[idxInOld];
|
|
4307
|
+
|
|
4308
|
+
if (isVNode(elmToMove)) {
|
|
4309
|
+
if (elmToMove.sel !== newStartVnode.sel) {
|
|
4310
|
+
// New element
|
|
4311
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4312
|
+
} else {
|
|
4313
|
+
patch(elmToMove, newStartVnode, parent, renderer); // Delete the old child, but copy the array since it is read-only.
|
|
4314
|
+
// The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
|
|
4315
|
+
// so we only care about the `oldCh` object inside this function.
|
|
4316
|
+
// To avoid cloning over and over again, we check `clonedOldCh`
|
|
4317
|
+
// and only clone once.
|
|
4318
|
+
|
|
4319
|
+
if (!clonedOldCh) {
|
|
4320
|
+
clonedOldCh = true;
|
|
4321
|
+
oldCh = [...oldCh];
|
|
4322
|
+
} // We've already cloned at least once, so it's no longer read-only
|
|
4323
|
+
|
|
4324
|
+
|
|
4325
|
+
oldCh[idxInOld] = undefined;
|
|
4326
|
+
insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
|
|
4327
|
+
}
|
|
4072
4328
|
}
|
|
4329
|
+
|
|
4330
|
+
newStartVnode = newCh[++newStartIdx];
|
|
4331
|
+
}
|
|
4073
4332
|
}
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4333
|
+
}
|
|
4334
|
+
|
|
4335
|
+
if (oldStartIdx <= oldEndIdx || newStartIdx <= newEndIdx) {
|
|
4336
|
+
if (oldStartIdx > oldEndIdx) {
|
|
4337
|
+
// There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
|
|
4338
|
+
// already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
|
|
4339
|
+
let i = newEndIdx;
|
|
4340
|
+
let n;
|
|
4341
|
+
|
|
4342
|
+
do {
|
|
4343
|
+
n = newCh[++i];
|
|
4344
|
+
} while (!isVNode(n) && i < newChEnd);
|
|
4345
|
+
|
|
4346
|
+
before = isVNode(n) ? n.elm : null;
|
|
4347
|
+
mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
|
|
4348
|
+
} else {
|
|
4349
|
+
unmountVNodes(oldCh, parent, renderer, true, oldStartIdx, oldEndIdx + 1);
|
|
4089
4350
|
}
|
|
4351
|
+
}
|
|
4090
4352
|
}
|
|
4353
|
+
|
|
4091
4354
|
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
|
-
}
|
|
4355
|
+
const c1Length = c1.length;
|
|
4356
|
+
const c2Length = c2.length;
|
|
4357
|
+
|
|
4358
|
+
if (c1Length === 0) {
|
|
4359
|
+
// the old list is empty, we can directly insert anything new
|
|
4360
|
+
mountVNodes(c2, parent, renderer, null);
|
|
4361
|
+
return;
|
|
4362
|
+
}
|
|
4363
|
+
|
|
4364
|
+
if (c2Length === 0) {
|
|
4365
|
+
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
4366
|
+
// this is the case in which the dynamic children of an if-directive should be removed
|
|
4367
|
+
unmountVNodes(c1, parent, renderer, true);
|
|
4368
|
+
return;
|
|
4369
|
+
} // if the old list is not empty, the new list MUST have the same
|
|
4370
|
+
// amount of nodes, that's why we call this static children
|
|
4371
|
+
|
|
4372
|
+
|
|
4373
|
+
let anchor = null;
|
|
4374
|
+
|
|
4375
|
+
for (let i = c2Length - 1; i >= 0; i -= 1) {
|
|
4376
|
+
const n1 = c1[i];
|
|
4377
|
+
const n2 = c2[i];
|
|
4378
|
+
|
|
4379
|
+
if (n2 !== n1) {
|
|
4380
|
+
if (isVNode(n1)) {
|
|
4381
|
+
if (isVNode(n2)) {
|
|
4382
|
+
// both vnodes are equivalent, and we just need to patch them
|
|
4383
|
+
patch(n1, n2, parent, renderer);
|
|
4384
|
+
anchor = n2.elm;
|
|
4385
|
+
} else {
|
|
4386
|
+
// removing the old vnode since the new one is null
|
|
4387
|
+
unmount(n1, parent, renderer, true);
|
|
4127
4388
|
}
|
|
4389
|
+
} else if (isVNode(n2)) {
|
|
4390
|
+
mount(n2, parent, renderer, anchor);
|
|
4391
|
+
anchor = n2.elm;
|
|
4392
|
+
}
|
|
4128
4393
|
}
|
|
4394
|
+
}
|
|
4129
4395
|
}
|
|
4130
4396
|
|
|
4131
4397
|
/*
|
|
@@ -5143,7 +5409,7 @@ function createVM(elm, ctor, renderer, options) {
|
|
|
5143
5409
|
return `[object:vm ${def.name} (${vm.idx})]`;
|
|
5144
5410
|
};
|
|
5145
5411
|
|
|
5146
|
-
if (
|
|
5412
|
+
if (lwcRuntimeFlags.ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST) {
|
|
5147
5413
|
vm.shadowMode = 0
|
|
5148
5414
|
/* ShadowMode.Native */
|
|
5149
5415
|
;
|
|
@@ -5182,7 +5448,7 @@ function computeShadowMode(vm, renderer) {
|
|
|
5182
5448
|
} else if (isNativeShadowDefined) {
|
|
5183
5449
|
// Not combined with above condition because @lwc/features only supports identifiers in
|
|
5184
5450
|
// the if-condition.
|
|
5185
|
-
if (
|
|
5451
|
+
if (lwcRuntimeFlags.ENABLE_MIXED_SHADOW_MODE) {
|
|
5186
5452
|
if (def.shadowSupportMode === "any"
|
|
5187
5453
|
/* ShadowSupportMode.Any */
|
|
5188
5454
|
) {
|
|
@@ -5771,7 +6037,7 @@ function installWireAdapters(vm) {
|
|
|
5771
6037
|
ArrayPush$1.call(wiredConnecting, () => {
|
|
5772
6038
|
connector.connect();
|
|
5773
6039
|
|
|
5774
|
-
if (!
|
|
6040
|
+
if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
|
|
5775
6041
|
if (hasDynamicParams) {
|
|
5776
6042
|
Promise.resolve().then(computeConfigAndUpdate);
|
|
5777
6043
|
return;
|
|
@@ -5980,7 +6246,7 @@ function freezeTemplate(tmpl) {
|
|
|
5980
6246
|
});
|
|
5981
6247
|
}
|
|
5982
6248
|
}
|
|
5983
|
-
/* version: 2.23.
|
|
6249
|
+
/* version: 2.23.3 */
|
|
5984
6250
|
|
|
5985
6251
|
/*
|
|
5986
6252
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -6450,7 +6716,7 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
6450
6716
|
*/
|
|
6451
6717
|
freeze(LightningElement);
|
|
6452
6718
|
seal(LightningElement.prototype);
|
|
6453
|
-
/* version: 2.23.
|
|
6719
|
+
/* version: 2.23.3 */
|
|
6454
6720
|
|
|
6455
6721
|
exports.LightningElement = LightningElement;
|
|
6456
6722
|
exports.api = api$1;
|