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