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
|
@@ -299,9 +299,13 @@ function htmlPropertyToAttribute(propName) {
|
|
|
299
299
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
300
300
|
*/
|
|
301
301
|
// Increment whenever the LWC template compiler changes
|
|
302
|
-
const LWC_VERSION = "2.23.
|
|
302
|
+
const LWC_VERSION = "2.23.3";
|
|
303
303
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
304
|
-
/** version: 2.23.
|
|
304
|
+
/** version: 2.23.3 */
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Copyright (C) 2018 salesforce.com, inc.
|
|
308
|
+
*/
|
|
305
309
|
|
|
306
310
|
/*
|
|
307
311
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -310,7 +314,7 @@ const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
|
310
314
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
311
315
|
*/
|
|
312
316
|
function detect(propName) {
|
|
313
|
-
return
|
|
317
|
+
return getOwnPropertyDescriptor$1(Element.prototype, propName) === undefined;
|
|
314
318
|
}
|
|
315
319
|
|
|
316
320
|
/*
|
|
@@ -379,6 +383,7 @@ for (let i = 0, len = ElementPrototypeAriaPropertyNames.length; i < len; i += 1)
|
|
|
379
383
|
patch$1(propName);
|
|
380
384
|
}
|
|
381
385
|
}
|
|
386
|
+
/** version: 2.23.3 */
|
|
382
387
|
|
|
383
388
|
/**
|
|
384
389
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -398,6 +403,7 @@ const features = {
|
|
|
398
403
|
ENABLE_HTML_COLLECTIONS_PATCH: null,
|
|
399
404
|
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
400
405
|
ENABLE_MIXED_SHADOW_MODE: null,
|
|
406
|
+
ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
|
|
401
407
|
ENABLE_NODE_LIST_PATCH: null,
|
|
402
408
|
ENABLE_NODE_PATCH: null,
|
|
403
409
|
ENABLE_REACTIVE_SETTER: null,
|
|
@@ -406,7 +412,7 @@ const features = {
|
|
|
406
412
|
if (!_globalThis.lwcRuntimeFlags) {
|
|
407
413
|
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
|
|
408
414
|
}
|
|
409
|
-
const
|
|
415
|
+
const lwcRuntimeFlags = _globalThis.lwcRuntimeFlags;
|
|
410
416
|
/**
|
|
411
417
|
* Set the value at runtime of a given feature flag. This method only be invoked once per feature
|
|
412
418
|
* flag. It is meant to be used during the app initialization.
|
|
@@ -433,17 +439,17 @@ function setFeatureFlag(name, value) {
|
|
|
433
439
|
}
|
|
434
440
|
if (process.env.NODE_ENV !== 'production') {
|
|
435
441
|
// Allow the same flag to be set more than once outside of production to enable testing
|
|
436
|
-
|
|
442
|
+
lwcRuntimeFlags[name] = value;
|
|
437
443
|
}
|
|
438
444
|
else {
|
|
439
445
|
// Disallow the same flag to be set more than once in production
|
|
440
|
-
const runtimeValue =
|
|
446
|
+
const runtimeValue = lwcRuntimeFlags[name];
|
|
441
447
|
if (!isUndefined$1(runtimeValue)) {
|
|
442
448
|
// eslint-disable-next-line no-console
|
|
443
449
|
console.error(`Failed to set the value "${value}" for the runtime feature flag "${name}". "${name}" has already been set with the value "${runtimeValue}".`);
|
|
444
450
|
return;
|
|
445
451
|
}
|
|
446
|
-
defineProperty(
|
|
452
|
+
defineProperty(lwcRuntimeFlags, name, { value });
|
|
447
453
|
}
|
|
448
454
|
}
|
|
449
455
|
/**
|
|
@@ -455,7 +461,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
455
461
|
setFeatureFlag(name, value);
|
|
456
462
|
}
|
|
457
463
|
}
|
|
458
|
-
/** version: 2.23.
|
|
464
|
+
/** version: 2.23.3 */
|
|
459
465
|
|
|
460
466
|
/*
|
|
461
467
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -469,7 +475,7 @@ if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
|
469
475
|
window.addEventListener('test-dummy-flag', () => {
|
|
470
476
|
let hasFlag = false;
|
|
471
477
|
|
|
472
|
-
if (
|
|
478
|
+
if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
|
|
473
479
|
hasFlag = true;
|
|
474
480
|
}
|
|
475
481
|
|
|
@@ -496,7 +502,7 @@ if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
|
496
502
|
window.addEventListener('test-dummy-flag', () => {
|
|
497
503
|
let hasFlag = false;
|
|
498
504
|
|
|
499
|
-
if (
|
|
505
|
+
if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
|
|
500
506
|
hasFlag = true;
|
|
501
507
|
}
|
|
502
508
|
|
|
@@ -804,8 +810,8 @@ function isCircularModuleDependency(obj) {
|
|
|
804
810
|
*/
|
|
805
811
|
// This is a temporary workaround to get the @lwc/engine-server to evaluate in node without having
|
|
806
812
|
// to inject at runtime.
|
|
807
|
-
const HTMLElementConstructor
|
|
808
|
-
const HTMLElementPrototype = HTMLElementConstructor
|
|
813
|
+
const HTMLElementConstructor = typeof HTMLElement !== 'undefined' ? HTMLElement : function () { };
|
|
814
|
+
const HTMLElementPrototype = HTMLElementConstructor.prototype;
|
|
809
815
|
|
|
810
816
|
/*
|
|
811
817
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -2324,7 +2330,7 @@ function createPublicAccessorDescriptor(key, descriptor) {
|
|
|
2324
2330
|
}
|
|
2325
2331
|
|
|
2326
2332
|
if (set) {
|
|
2327
|
-
if (
|
|
2333
|
+
if (lwcRuntimeFlags.ENABLE_REACTIVE_SETTER) {
|
|
2328
2334
|
let ro = vm.oar[key];
|
|
2329
2335
|
|
|
2330
2336
|
if (isUndefined$1(ro)) {
|
|
@@ -2882,7 +2888,7 @@ function HTMLBridgeElementFactory(SuperClass, props, methods) {
|
|
|
2882
2888
|
defineProperties(HTMLBridgeElement.prototype, descriptors);
|
|
2883
2889
|
return HTMLBridgeElement;
|
|
2884
2890
|
}
|
|
2885
|
-
const BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor
|
|
2891
|
+
const BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);
|
|
2886
2892
|
freeze(BaseBridgeElement);
|
|
2887
2893
|
seal(BaseBridgeElement.prototype);
|
|
2888
2894
|
|
|
@@ -2976,7 +2982,7 @@ function getTemplateOrSwappedTemplate(tpl) {
|
|
|
2976
2982
|
throw new ReferenceError();
|
|
2977
2983
|
}
|
|
2978
2984
|
|
|
2979
|
-
if (
|
|
2985
|
+
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2980
2986
|
const visited = new Set();
|
|
2981
2987
|
|
|
2982
2988
|
while (swappedTemplateMap.has(tpl) && !visited.has(tpl)) {
|
|
@@ -2993,7 +2999,7 @@ function getComponentOrSwappedComponent(Ctor) {
|
|
|
2993
2999
|
throw new ReferenceError();
|
|
2994
3000
|
}
|
|
2995
3001
|
|
|
2996
|
-
if (
|
|
3002
|
+
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2997
3003
|
const visited = new Set();
|
|
2998
3004
|
|
|
2999
3005
|
while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {
|
|
@@ -3010,7 +3016,7 @@ function getStyleOrSwappedStyle(style) {
|
|
|
3010
3016
|
throw new ReferenceError();
|
|
3011
3017
|
}
|
|
3012
3018
|
|
|
3013
|
-
if (
|
|
3019
|
+
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
3014
3020
|
const visited = new Set();
|
|
3015
3021
|
|
|
3016
3022
|
while (swappedStyleMap.has(style) && !visited.has(style)) {
|
|
@@ -3027,7 +3033,7 @@ function setActiveVM(vm) {
|
|
|
3027
3033
|
throw new ReferenceError();
|
|
3028
3034
|
}
|
|
3029
3035
|
|
|
3030
|
-
if (
|
|
3036
|
+
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
3031
3037
|
// tracking active component
|
|
3032
3038
|
const Ctor = vm.def.ctor;
|
|
3033
3039
|
let componentVMs = activeComponents.get(Ctor);
|
|
@@ -3084,7 +3090,7 @@ function removeActiveVM(vm) {
|
|
|
3084
3090
|
throw new ReferenceError();
|
|
3085
3091
|
}
|
|
3086
3092
|
|
|
3087
|
-
if (
|
|
3093
|
+
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
3088
3094
|
// tracking inactive component
|
|
3089
3095
|
const Ctor = vm.def.ctor;
|
|
3090
3096
|
let list = activeComponents.get(Ctor);
|
|
@@ -3131,7 +3137,7 @@ function swapTemplate(oldTpl, newTpl) {
|
|
|
3131
3137
|
}
|
|
3132
3138
|
}
|
|
3133
3139
|
|
|
3134
|
-
if (!
|
|
3140
|
+
if (!lwcRuntimeFlags.ENABLE_HMR) {
|
|
3135
3141
|
throw new Error('HMR is not enabled');
|
|
3136
3142
|
}
|
|
3137
3143
|
|
|
@@ -3147,7 +3153,7 @@ function swapComponent(oldComponent, newComponent) {
|
|
|
3147
3153
|
}
|
|
3148
3154
|
}
|
|
3149
3155
|
|
|
3150
|
-
if (!
|
|
3156
|
+
if (!lwcRuntimeFlags.ENABLE_HMR) {
|
|
3151
3157
|
throw new Error('HMR is not enabled');
|
|
3152
3158
|
}
|
|
3153
3159
|
|
|
@@ -3161,7 +3167,7 @@ function swapStyle(oldStyle, newStyle) {
|
|
|
3161
3167
|
return rehydrateHotStyle(oldStyle);
|
|
3162
3168
|
}
|
|
3163
3169
|
|
|
3164
|
-
if (!
|
|
3170
|
+
if (!lwcRuntimeFlags.ENABLE_HMR) {
|
|
3165
3171
|
throw new Error('HMR is not enabled');
|
|
3166
3172
|
}
|
|
3167
3173
|
|
|
@@ -3541,30 +3547,67 @@ function createStylesheet(vm, stylesheets) {
|
|
|
3541
3547
|
* SPDX-License-Identifier: MIT
|
|
3542
3548
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3543
3549
|
*/
|
|
3550
|
+
|
|
3551
|
+
function checkHasVM(elm) {
|
|
3552
|
+
const hasVM = !isUndefined$1(getAssociatedVMIfPresent(elm));
|
|
3553
|
+
|
|
3554
|
+
if (process.env.NODE_ENV !== 'production' && !hasVM) {
|
|
3555
|
+
// Occurs when an element is manually created with the same tag name as an existing LWC component. In that case,
|
|
3556
|
+
// we skip calling the LWC connectedCallback/disconnectedCallback logic and log an error.
|
|
3557
|
+
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.`);
|
|
3558
|
+
}
|
|
3559
|
+
|
|
3560
|
+
return hasVM;
|
|
3561
|
+
}
|
|
3562
|
+
|
|
3544
3563
|
function getUpgradableConstructor(tagName, renderer) {
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3564
|
+
const {
|
|
3565
|
+
getCustomElement,
|
|
3566
|
+
HTMLElementExported: RendererHTMLElement,
|
|
3567
|
+
defineCustomElement
|
|
3568
|
+
} = renderer; // Should never get a tag with upper case letter at this point, the compiler should
|
|
3569
|
+
// produce only tags with lowercase letters
|
|
3570
|
+
// But, for backwards compatibility, we will lower case the tagName
|
|
3571
|
+
|
|
3572
|
+
tagName = tagName.toLowerCase();
|
|
3573
|
+
let CE = getCustomElement(tagName);
|
|
3574
|
+
|
|
3575
|
+
if (!isUndefined$1(CE)) {
|
|
3576
|
+
return CE;
|
|
3577
|
+
}
|
|
3578
|
+
/**
|
|
3579
|
+
* LWC Upgradable Element reference to an element that was created
|
|
3580
|
+
* via the scoped registry mechanism, and that is ready to be upgraded.
|
|
3581
|
+
*/
|
|
3582
|
+
|
|
3583
|
+
|
|
3584
|
+
CE = class LWCUpgradableElement extends RendererHTMLElement {
|
|
3585
|
+
constructor(upgradeCallback) {
|
|
3586
|
+
super();
|
|
3587
|
+
|
|
3588
|
+
if (isFunction$1(upgradeCallback)) {
|
|
3589
|
+
upgradeCallback(this); // nothing to do with the result for now
|
|
3590
|
+
}
|
|
3553
3591
|
}
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
CE =
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
upgradeCallback(this); // nothing to do with the result for now
|
|
3563
|
-
}
|
|
3564
|
-
}
|
|
3592
|
+
|
|
3593
|
+
};
|
|
3594
|
+
|
|
3595
|
+
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
3596
|
+
CE.prototype.connectedCallback = function () {
|
|
3597
|
+
if (checkHasVM(this)) {
|
|
3598
|
+
connectRootElement(this);
|
|
3599
|
+
}
|
|
3565
3600
|
};
|
|
3566
|
-
|
|
3567
|
-
|
|
3601
|
+
|
|
3602
|
+
CE.prototype.disconnectedCallback = function () {
|
|
3603
|
+
if (checkHasVM(this)) {
|
|
3604
|
+
disconnectRootElement(this);
|
|
3605
|
+
}
|
|
3606
|
+
};
|
|
3607
|
+
}
|
|
3608
|
+
|
|
3609
|
+
defineCustomElement(tagName, CE);
|
|
3610
|
+
return CE;
|
|
3568
3611
|
}
|
|
3569
3612
|
|
|
3570
3613
|
/*
|
|
@@ -3652,6 +3695,14 @@ function patchProps(oldVnode, vnode, renderer) {
|
|
|
3652
3695
|
// different than the one previously set.
|
|
3653
3696
|
if (isFirstPatch ||
|
|
3654
3697
|
cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key])) {
|
|
3698
|
+
// Additional verification if properties are supported by the element
|
|
3699
|
+
// Validation relies on html properties and public properties being defined on the element,
|
|
3700
|
+
// SSR has its own custom validation.
|
|
3701
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3702
|
+
if (!(key in elm)) {
|
|
3703
|
+
logWarn(`Unknown public property "${key}" of element <${elm.tagName.toLowerCase()}>. This is either a typo on the corresponding attribute "${htmlPropertyToAttribute(key)}", or the attribute does not exist in this browser or DOM implementation.`);
|
|
3704
|
+
}
|
|
3705
|
+
}
|
|
3655
3706
|
setProperty(elm, key, cur);
|
|
3656
3707
|
}
|
|
3657
3708
|
}
|
|
@@ -3810,579 +3861,798 @@ function applyStaticStyleAttribute(vnode, renderer) {
|
|
|
3810
3861
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3811
3862
|
*/
|
|
3812
3863
|
function patchChildren(c1, c2, parent, renderer) {
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
}
|
|
3864
|
+
if (hasDynamicChildren(c2)) {
|
|
3865
|
+
updateDynamicChildren(c1, c2, parent, renderer);
|
|
3866
|
+
} else {
|
|
3867
|
+
updateStaticChildren(c1, c2, parent, renderer);
|
|
3868
|
+
}
|
|
3819
3869
|
}
|
|
3870
|
+
|
|
3820
3871
|
function patch(n1, n2, parent, renderer) {
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
patchText(n1, n2, renderer);
|
|
3837
|
-
break;
|
|
3838
|
-
case 1 /* VNodeType.Comment */:
|
|
3839
|
-
// VComment has no special capability, fallback to the owner's renderer
|
|
3840
|
-
patchComment(n1, n2, renderer);
|
|
3841
|
-
break;
|
|
3842
|
-
case 4 /* VNodeType.Static */:
|
|
3843
|
-
n2.elm = n1.elm;
|
|
3844
|
-
break;
|
|
3845
|
-
case 2 /* VNodeType.Element */:
|
|
3846
|
-
patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3847
|
-
break;
|
|
3848
|
-
case 3 /* VNodeType.CustomElement */:
|
|
3849
|
-
patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3850
|
-
break;
|
|
3872
|
+
var _a, _b;
|
|
3873
|
+
|
|
3874
|
+
if (n1 === n2) {
|
|
3875
|
+
return;
|
|
3876
|
+
}
|
|
3877
|
+
|
|
3878
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3879
|
+
if (!isSameVnode(n1, n2)) {
|
|
3880
|
+
throw new Error('Expected these VNodes to be the same: ' + JSON.stringify({
|
|
3881
|
+
sel: n1.sel,
|
|
3882
|
+
key: n1.key
|
|
3883
|
+
}) + ', ' + JSON.stringify({
|
|
3884
|
+
sel: n2.sel,
|
|
3885
|
+
key: n2.key
|
|
3886
|
+
}));
|
|
3851
3887
|
}
|
|
3888
|
+
}
|
|
3889
|
+
|
|
3890
|
+
switch (n2.type) {
|
|
3891
|
+
case 0
|
|
3892
|
+
/* VNodeType.Text */
|
|
3893
|
+
:
|
|
3894
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
3895
|
+
patchText(n1, n2, renderer);
|
|
3896
|
+
break;
|
|
3897
|
+
|
|
3898
|
+
case 1
|
|
3899
|
+
/* VNodeType.Comment */
|
|
3900
|
+
:
|
|
3901
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
3902
|
+
patchComment(n1, n2, renderer);
|
|
3903
|
+
break;
|
|
3904
|
+
|
|
3905
|
+
case 4
|
|
3906
|
+
/* VNodeType.Static */
|
|
3907
|
+
:
|
|
3908
|
+
n2.elm = n1.elm;
|
|
3909
|
+
break;
|
|
3910
|
+
|
|
3911
|
+
case 2
|
|
3912
|
+
/* VNodeType.Element */
|
|
3913
|
+
:
|
|
3914
|
+
patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3915
|
+
break;
|
|
3916
|
+
|
|
3917
|
+
case 3
|
|
3918
|
+
/* VNodeType.CustomElement */
|
|
3919
|
+
:
|
|
3920
|
+
patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3921
|
+
break;
|
|
3922
|
+
}
|
|
3852
3923
|
}
|
|
3924
|
+
|
|
3853
3925
|
function mount(node, parent, renderer, anchor) {
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3926
|
+
var _a, _b;
|
|
3927
|
+
|
|
3928
|
+
switch (node.type) {
|
|
3929
|
+
case 0
|
|
3930
|
+
/* VNodeType.Text */
|
|
3931
|
+
:
|
|
3932
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
3933
|
+
mountText(node, parent, anchor, renderer);
|
|
3934
|
+
break;
|
|
3935
|
+
|
|
3936
|
+
case 1
|
|
3937
|
+
/* VNodeType.Comment */
|
|
3938
|
+
:
|
|
3939
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
3940
|
+
mountComment(node, parent, anchor, renderer);
|
|
3941
|
+
break;
|
|
3942
|
+
|
|
3943
|
+
case 4
|
|
3944
|
+
/* VNodeType.Static */
|
|
3945
|
+
:
|
|
3946
|
+
// VStatic cannot have a custom renderer associated to them, using owner's renderer
|
|
3947
|
+
mountStatic(node, parent, anchor, renderer);
|
|
3948
|
+
break;
|
|
3949
|
+
|
|
3950
|
+
case 2
|
|
3951
|
+
/* VNodeType.Element */
|
|
3952
|
+
:
|
|
3953
|
+
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
3954
|
+
mountElement(node, parent, anchor, (_a = node.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3955
|
+
break;
|
|
3956
|
+
|
|
3957
|
+
case 3
|
|
3958
|
+
/* VNodeType.CustomElement */
|
|
3959
|
+
:
|
|
3960
|
+
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
3961
|
+
mountCustomElement(node, parent, anchor, (_b = node.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3962
|
+
break;
|
|
3963
|
+
}
|
|
3877
3964
|
}
|
|
3965
|
+
|
|
3878
3966
|
function patchText(n1, n2, renderer) {
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3967
|
+
n2.elm = n1.elm;
|
|
3968
|
+
|
|
3969
|
+
if (n2.text !== n1.text) {
|
|
3970
|
+
updateTextContent(n2, renderer);
|
|
3971
|
+
}
|
|
3883
3972
|
}
|
|
3973
|
+
|
|
3884
3974
|
function mountText(vnode, parent, anchor, renderer) {
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3975
|
+
const {
|
|
3976
|
+
owner
|
|
3977
|
+
} = vnode;
|
|
3978
|
+
const {
|
|
3979
|
+
createText
|
|
3980
|
+
} = renderer;
|
|
3981
|
+
const textNode = vnode.elm = createText(vnode.text);
|
|
3982
|
+
linkNodeToShadow(textNode, owner, renderer);
|
|
3983
|
+
insertNode(textNode, parent, anchor, renderer);
|
|
3890
3984
|
}
|
|
3985
|
+
|
|
3891
3986
|
function patchComment(n1, n2, renderer) {
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3987
|
+
n2.elm = n1.elm; // FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
|
|
3988
|
+
// it is the case today.
|
|
3989
|
+
|
|
3990
|
+
if (n2.text !== n1.text) {
|
|
3991
|
+
updateTextContent(n2, renderer);
|
|
3992
|
+
}
|
|
3898
3993
|
}
|
|
3994
|
+
|
|
3899
3995
|
function mountComment(vnode, parent, anchor, renderer) {
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3996
|
+
const {
|
|
3997
|
+
owner
|
|
3998
|
+
} = vnode;
|
|
3999
|
+
const {
|
|
4000
|
+
createComment
|
|
4001
|
+
} = renderer;
|
|
4002
|
+
const commentNode = vnode.elm = createComment(vnode.text);
|
|
4003
|
+
linkNodeToShadow(commentNode, owner, renderer);
|
|
4004
|
+
insertNode(commentNode, parent, anchor, renderer);
|
|
3905
4005
|
}
|
|
4006
|
+
|
|
3906
4007
|
function mountElement(vnode, parent, anchor, renderer) {
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
4008
|
+
const {
|
|
4009
|
+
sel,
|
|
4010
|
+
owner,
|
|
4011
|
+
data: {
|
|
4012
|
+
svg
|
|
4013
|
+
}
|
|
4014
|
+
} = vnode;
|
|
4015
|
+
const {
|
|
4016
|
+
createElement
|
|
4017
|
+
} = renderer;
|
|
4018
|
+
const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
4019
|
+
const elm = vnode.elm = createElement(sel, namespace);
|
|
4020
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
4021
|
+
applyStyleScoping(elm, owner, renderer);
|
|
4022
|
+
applyDomManual(elm, vnode);
|
|
4023
|
+
applyElementRestrictions(elm, vnode);
|
|
4024
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
4025
|
+
insertNode(elm, parent, anchor, renderer);
|
|
4026
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
3918
4027
|
}
|
|
4028
|
+
|
|
3919
4029
|
function patchElement(n1, n2, renderer) {
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
4030
|
+
const elm = n2.elm = n1.elm;
|
|
4031
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
4032
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3923
4033
|
}
|
|
4034
|
+
|
|
3924
4035
|
function mountStatic(vnode, parent, anchor, renderer) {
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
4036
|
+
const {
|
|
4037
|
+
owner
|
|
4038
|
+
} = vnode;
|
|
4039
|
+
const {
|
|
4040
|
+
cloneNode,
|
|
4041
|
+
isSyntheticShadowDefined
|
|
4042
|
+
} = renderer;
|
|
4043
|
+
const elm = vnode.elm = cloneNode(vnode.fragment, true);
|
|
4044
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
4045
|
+
applyElementRestrictions(elm, vnode); // Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
|
|
4046
|
+
|
|
4047
|
+
const {
|
|
4048
|
+
renderMode,
|
|
4049
|
+
shadowMode
|
|
4050
|
+
} = owner;
|
|
4051
|
+
|
|
4052
|
+
if (isSyntheticShadowDefined) {
|
|
4053
|
+
if (shadowMode === 1
|
|
4054
|
+
/* ShadowMode.Synthetic */
|
|
4055
|
+
|| renderMode === 0
|
|
4056
|
+
/* RenderMode.Light */
|
|
4057
|
+
) {
|
|
4058
|
+
elm[KEY__SHADOW_STATIC] = true;
|
|
3936
4059
|
}
|
|
3937
|
-
|
|
4060
|
+
}
|
|
4061
|
+
|
|
4062
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3938
4063
|
}
|
|
4064
|
+
|
|
3939
4065
|
function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
4066
|
+
const {
|
|
4067
|
+
sel,
|
|
4068
|
+
owner
|
|
4069
|
+
} = vnode;
|
|
4070
|
+
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
4071
|
+
/**
|
|
4072
|
+
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
4073
|
+
* with a callback as the first argument, we could implement a more advanced
|
|
4074
|
+
* mechanism that only passes that argument if the constructor is known to be
|
|
4075
|
+
* an upgradable custom element.
|
|
4076
|
+
*/
|
|
4077
|
+
|
|
4078
|
+
let vm;
|
|
4079
|
+
const elm = new UpgradableConstructor(elm => {
|
|
4080
|
+
// the custom element from the registry is expecting an upgrade callback
|
|
4081
|
+
vm = createViewModelHook(elm, vnode, renderer);
|
|
4082
|
+
});
|
|
4083
|
+
vnode.elm = elm;
|
|
4084
|
+
vnode.vm = vm;
|
|
4085
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
4086
|
+
applyStyleScoping(elm, owner, renderer);
|
|
4087
|
+
|
|
4088
|
+
if (vm) {
|
|
4089
|
+
allocateChildren(vnode, vm);
|
|
4090
|
+
} else if (vnode.ctor !== UpgradableConstructor) {
|
|
4091
|
+
throw new TypeError(`Incorrect Component Constructor`);
|
|
4092
|
+
}
|
|
4093
|
+
|
|
4094
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
4095
|
+
insertNode(elm, parent, anchor, renderer);
|
|
4096
|
+
|
|
4097
|
+
if (vm) {
|
|
4098
|
+
{
|
|
4099
|
+
if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
3966
4100
|
if (process.env.NODE_ENV !== 'production') {
|
|
3967
|
-
|
|
4101
|
+
// With synthetic lifecycle callbacks, it's possible for elements to be removed without the engine
|
|
4102
|
+
// noticing it (e.g. `appendChild` the same host element twice). This test ensures we don't regress.
|
|
4103
|
+
assert.isTrue(vm.state === 0
|
|
4104
|
+
/* VMState.created */
|
|
4105
|
+
, `${vm} cannot be recycled.`);
|
|
3968
4106
|
}
|
|
4107
|
+
|
|
3969
4108
|
runConnectedCallback(vm);
|
|
4109
|
+
}
|
|
3970
4110
|
}
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
4111
|
+
}
|
|
4112
|
+
|
|
4113
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
4114
|
+
|
|
4115
|
+
if (vm) {
|
|
4116
|
+
appendVM(vm);
|
|
4117
|
+
}
|
|
3975
4118
|
}
|
|
4119
|
+
|
|
3976
4120
|
function patchCustomElement(n1, n2, parent, renderer) {
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4121
|
+
if (n1.ctor !== n2.ctor) {
|
|
4122
|
+
// If the constructor, unmount the current component and mount a new one using the new
|
|
4123
|
+
// constructor.
|
|
4124
|
+
const anchor = renderer.nextSibling(n1.elm);
|
|
4125
|
+
unmount(n1, parent, renderer, true);
|
|
4126
|
+
mountCustomElement(n2, parent, anchor, renderer);
|
|
4127
|
+
} else {
|
|
4128
|
+
// Otherwise patch the existing component with new props/attrs/etc.
|
|
4129
|
+
const elm = n2.elm = n1.elm;
|
|
4130
|
+
const vm = n2.vm = n1.vm;
|
|
4131
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
4132
|
+
|
|
4133
|
+
if (!isUndefined$1(vm)) {
|
|
4134
|
+
// in fallback mode, the allocation will always set children to
|
|
4135
|
+
// empty and delegate the real allocation to the slot elements
|
|
4136
|
+
allocateChildren(n2, vm);
|
|
4137
|
+
} // in fallback mode, the children will be always empty, so, nothing
|
|
4138
|
+
// will happen, but in native, it does allocate the light dom
|
|
4139
|
+
|
|
4140
|
+
|
|
4141
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
4142
|
+
|
|
4143
|
+
if (!isUndefined$1(vm)) {
|
|
4144
|
+
// this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
4145
|
+
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
4146
|
+
rerenderVM(vm);
|
|
4002
4147
|
}
|
|
4148
|
+
}
|
|
4003
4149
|
}
|
|
4150
|
+
|
|
4004
4151
|
function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4152
|
+
for (; start < end; ++start) {
|
|
4153
|
+
const vnode = vnodes[start];
|
|
4154
|
+
|
|
4155
|
+
if (isVNode(vnode)) {
|
|
4156
|
+
mount(vnode, parent, renderer, anchor);
|
|
4010
4157
|
}
|
|
4158
|
+
}
|
|
4011
4159
|
}
|
|
4160
|
+
|
|
4012
4161
|
function unmount(vnode, parent, renderer, doRemove = false) {
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4162
|
+
const {
|
|
4163
|
+
type,
|
|
4164
|
+
elm,
|
|
4165
|
+
sel
|
|
4166
|
+
} = vnode; // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
4167
|
+
// subtree root, is the only element worth unmounting from the subtree.
|
|
4168
|
+
|
|
4169
|
+
if (doRemove) {
|
|
4170
|
+
// The vnode might or might not have a data.renderer associated to it
|
|
4171
|
+
// but the removal used here is from the owner instead.
|
|
4172
|
+
removeNode(elm, parent, renderer);
|
|
4173
|
+
}
|
|
4174
|
+
|
|
4175
|
+
switch (type) {
|
|
4176
|
+
case 2
|
|
4177
|
+
/* VNodeType.Element */
|
|
4178
|
+
:
|
|
4179
|
+
{
|
|
4180
|
+
// Slot content is removed to trigger slotchange event when removing slot.
|
|
4181
|
+
// Only required for synthetic shadow.
|
|
4182
|
+
const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1
|
|
4183
|
+
/* ShadowMode.Synthetic */
|
|
4184
|
+
;
|
|
4185
|
+
unmountVNodes(vnode.children, elm, renderer, shouldRemoveChildren);
|
|
4186
|
+
break;
|
|
4187
|
+
}
|
|
4188
|
+
|
|
4189
|
+
case 3
|
|
4190
|
+
/* VNodeType.CustomElement */
|
|
4191
|
+
:
|
|
4192
|
+
{
|
|
4193
|
+
const {
|
|
4194
|
+
vm
|
|
4195
|
+
} = vnode; // No need to unmount the children here, `removeVM` will take care of removing the
|
|
4196
|
+
// children.
|
|
4197
|
+
|
|
4198
|
+
if (!isUndefined$1(vm)) {
|
|
4199
|
+
removeVM(vm);
|
|
4036
4200
|
}
|
|
4037
|
-
|
|
4201
|
+
}
|
|
4202
|
+
}
|
|
4038
4203
|
}
|
|
4204
|
+
|
|
4039
4205
|
function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, end = vnodes.length) {
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4206
|
+
for (; start < end; ++start) {
|
|
4207
|
+
const ch = vnodes[start];
|
|
4208
|
+
|
|
4209
|
+
if (isVNode(ch)) {
|
|
4210
|
+
unmount(ch, parent, renderer, doRemove);
|
|
4045
4211
|
}
|
|
4212
|
+
}
|
|
4046
4213
|
}
|
|
4214
|
+
|
|
4047
4215
|
function isVNode(vnode) {
|
|
4048
|
-
|
|
4216
|
+
return vnode != null;
|
|
4049
4217
|
}
|
|
4218
|
+
|
|
4050
4219
|
function linkNodeToShadow(elm, owner, renderer) {
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4220
|
+
const {
|
|
4221
|
+
renderRoot,
|
|
4222
|
+
renderMode,
|
|
4223
|
+
shadowMode
|
|
4224
|
+
} = owner;
|
|
4225
|
+
const {
|
|
4226
|
+
isSyntheticShadowDefined
|
|
4227
|
+
} = renderer; // TODO [#1164]: this should eventually be done by the polyfill directly
|
|
4228
|
+
|
|
4229
|
+
if (isSyntheticShadowDefined) {
|
|
4230
|
+
if (shadowMode === 1
|
|
4231
|
+
/* ShadowMode.Synthetic */
|
|
4232
|
+
|| renderMode === 0
|
|
4233
|
+
/* RenderMode.Light */
|
|
4234
|
+
) {
|
|
4235
|
+
elm[KEY__SHADOW_RESOLVER] = renderRoot[KEY__SHADOW_RESOLVER];
|
|
4058
4236
|
}
|
|
4237
|
+
}
|
|
4059
4238
|
}
|
|
4239
|
+
|
|
4060
4240
|
function updateTextContent(vnode, renderer) {
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
setText
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4241
|
+
const {
|
|
4242
|
+
elm,
|
|
4243
|
+
text
|
|
4244
|
+
} = vnode;
|
|
4245
|
+
const {
|
|
4246
|
+
setText
|
|
4247
|
+
} = renderer;
|
|
4248
|
+
|
|
4249
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4250
|
+
unlockDomMutation();
|
|
4251
|
+
}
|
|
4252
|
+
|
|
4253
|
+
setText(elm, text);
|
|
4254
|
+
|
|
4255
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4256
|
+
lockDomMutation();
|
|
4257
|
+
}
|
|
4070
4258
|
}
|
|
4259
|
+
|
|
4071
4260
|
function insertNode(node, parent, anchor, renderer) {
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4261
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4262
|
+
unlockDomMutation();
|
|
4263
|
+
}
|
|
4264
|
+
|
|
4265
|
+
renderer.insert(node, parent, anchor);
|
|
4266
|
+
|
|
4267
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4268
|
+
lockDomMutation();
|
|
4269
|
+
}
|
|
4079
4270
|
}
|
|
4271
|
+
|
|
4080
4272
|
function removeNode(node, parent, renderer) {
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4273
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4274
|
+
unlockDomMutation();
|
|
4275
|
+
}
|
|
4276
|
+
|
|
4277
|
+
renderer.remove(node, parent);
|
|
4278
|
+
|
|
4279
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4280
|
+
lockDomMutation();
|
|
4281
|
+
}
|
|
4088
4282
|
}
|
|
4283
|
+
|
|
4089
4284
|
function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4285
|
+
if (isNull(oldVnode)) {
|
|
4286
|
+
applyEventListeners(vnode, renderer);
|
|
4287
|
+
applyStaticClassAttribute(vnode, renderer);
|
|
4288
|
+
applyStaticStyleAttribute(vnode, renderer);
|
|
4289
|
+
} // Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
|
|
4290
|
+
// value is set before type=radio.
|
|
4291
|
+
|
|
4292
|
+
|
|
4293
|
+
patchClassAttribute(oldVnode, vnode, renderer);
|
|
4294
|
+
patchStyleAttribute(oldVnode, vnode, renderer);
|
|
4295
|
+
patchAttributes(oldVnode, vnode, renderer);
|
|
4296
|
+
patchProps(oldVnode, vnode, renderer);
|
|
4101
4297
|
}
|
|
4298
|
+
|
|
4102
4299
|
function applyStyleScoping(elm, owner, renderer) {
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4300
|
+
// Set the class name for `*.scoped.css` style scoping.
|
|
4301
|
+
const scopeToken = getScopeTokenClass(owner);
|
|
4302
|
+
|
|
4303
|
+
if (!isNull(scopeToken)) {
|
|
4304
|
+
const {
|
|
4305
|
+
getClassList
|
|
4306
|
+
} = renderer; // TODO [#2762]: this dot notation with add is probably problematic
|
|
4307
|
+
// probably we should have a renderer api for just the add operation
|
|
4308
|
+
|
|
4309
|
+
getClassList(elm).add(scopeToken);
|
|
4310
|
+
} // Set property element for synthetic shadow DOM style scoping.
|
|
4311
|
+
|
|
4312
|
+
|
|
4313
|
+
const {
|
|
4314
|
+
stylesheetToken: syntheticToken
|
|
4315
|
+
} = owner.context;
|
|
4316
|
+
|
|
4317
|
+
if (owner.shadowMode === 1
|
|
4318
|
+
/* ShadowMode.Synthetic */
|
|
4319
|
+
&& !isUndefined$1(syntheticToken)) {
|
|
4320
|
+
elm.$shadowToken$ = syntheticToken;
|
|
4321
|
+
}
|
|
4322
|
+
}
|
|
4323
|
+
|
|
4324
|
+
function applyDomManual(elm, vnode) {
|
|
4325
|
+
var _a;
|
|
4326
|
+
|
|
4327
|
+
const {
|
|
4328
|
+
owner,
|
|
4329
|
+
data: {
|
|
4330
|
+
context
|
|
4133
4331
|
}
|
|
4332
|
+
} = vnode;
|
|
4333
|
+
|
|
4334
|
+
if (owner.shadowMode === 1
|
|
4335
|
+
/* ShadowMode.Synthetic */
|
|
4336
|
+
&& ((_a = context === null || context === void 0 ? void 0 : context.lwc) === null || _a === void 0 ? void 0 : _a.dom) === "manual"
|
|
4337
|
+
/* LwcDomMode.Manual */
|
|
4338
|
+
) {
|
|
4339
|
+
elm.$domManual$ = true;
|
|
4340
|
+
}
|
|
4134
4341
|
}
|
|
4342
|
+
|
|
4343
|
+
function applyElementRestrictions(elm, vnode) {
|
|
4344
|
+
var _a, _b;
|
|
4345
|
+
|
|
4346
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4347
|
+
const isPortal = vnode.type === 2
|
|
4348
|
+
/* VNodeType.Element */
|
|
4349
|
+
&& ((_b = (_a = vnode.data.context) === null || _a === void 0 ? void 0 : _a.lwc) === null || _b === void 0 ? void 0 : _b.dom) === "manual"
|
|
4350
|
+
/* LwcDomMode.Manual */
|
|
4351
|
+
;
|
|
4352
|
+
const isLight = vnode.owner.renderMode === 0
|
|
4353
|
+
/* RenderMode.Light */
|
|
4354
|
+
;
|
|
4355
|
+
patchElementWithRestrictions(elm, {
|
|
4356
|
+
isPortal,
|
|
4357
|
+
isLight
|
|
4358
|
+
});
|
|
4359
|
+
}
|
|
4360
|
+
}
|
|
4361
|
+
|
|
4135
4362
|
function allocateChildren(vnode, vm) {
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4363
|
+
// A component with slots will re-render because:
|
|
4364
|
+
// 1- There is a change of the internal state.
|
|
4365
|
+
// 2- There is a change on the external api (ex: slots)
|
|
4366
|
+
//
|
|
4367
|
+
// In case #1, the vnodes in the cmpSlots will be reused since they didn't changed. This routine emptied the
|
|
4368
|
+
// slotted children when those VCustomElement were rendered and therefore in subsequent calls to allocate children
|
|
4369
|
+
// in a reused VCustomElement, there won't be any slotted children.
|
|
4370
|
+
// For those cases, we will use the reference for allocated children stored when rendering the fresh VCustomElement.
|
|
4371
|
+
//
|
|
4372
|
+
// In case #2, we will always get a fresh VCustomElement.
|
|
4373
|
+
const children = vnode.aChildren || vnode.children;
|
|
4374
|
+
vm.aChildren = children;
|
|
4375
|
+
const {
|
|
4376
|
+
renderMode,
|
|
4377
|
+
shadowMode
|
|
4378
|
+
} = vm;
|
|
4379
|
+
|
|
4380
|
+
if (shadowMode === 1
|
|
4381
|
+
/* ShadowMode.Synthetic */
|
|
4382
|
+
|| renderMode === 0
|
|
4383
|
+
/* RenderMode.Light */
|
|
4384
|
+
) {
|
|
4385
|
+
// slow path
|
|
4386
|
+
allocateInSlot(vm, children); // save the allocated children in case this vnode is reused.
|
|
4387
|
+
|
|
4388
|
+
vnode.aChildren = children; // every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
|
|
4389
|
+
|
|
4390
|
+
vnode.children = EmptyArray;
|
|
4391
|
+
}
|
|
4157
4392
|
}
|
|
4393
|
+
|
|
4158
4394
|
function createViewModelHook(elm, vnode, renderer) {
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
return vm;
|
|
4165
|
-
}
|
|
4166
|
-
const { sel, mode, ctor, owner } = vnode;
|
|
4167
|
-
vm = createVM(elm, ctor, renderer, {
|
|
4168
|
-
mode,
|
|
4169
|
-
owner,
|
|
4170
|
-
tagName: sel,
|
|
4171
|
-
});
|
|
4172
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
4173
|
-
assert.isTrue(isArray$1(vnode.children), `Invalid vnode for a custom element, it must have children defined.`);
|
|
4174
|
-
}
|
|
4395
|
+
let vm = getAssociatedVMIfPresent(elm); // There is a possibility that a custom element is registered under tagName, in which case, the
|
|
4396
|
+
// initialization is already carry on, and there is nothing else to do here since this hook is
|
|
4397
|
+
// called right after invoking `document.createElement`.
|
|
4398
|
+
|
|
4399
|
+
if (!isUndefined$1(vm)) {
|
|
4175
4400
|
return vm;
|
|
4401
|
+
}
|
|
4402
|
+
|
|
4403
|
+
const {
|
|
4404
|
+
sel,
|
|
4405
|
+
mode,
|
|
4406
|
+
ctor,
|
|
4407
|
+
owner
|
|
4408
|
+
} = vnode;
|
|
4409
|
+
vm = createVM(elm, ctor, renderer, {
|
|
4410
|
+
mode,
|
|
4411
|
+
owner,
|
|
4412
|
+
tagName: sel
|
|
4413
|
+
});
|
|
4414
|
+
|
|
4415
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4416
|
+
assert.isTrue(isArray$1(vnode.children), `Invalid vnode for a custom element, it must have children defined.`);
|
|
4417
|
+
}
|
|
4418
|
+
|
|
4419
|
+
return vm;
|
|
4176
4420
|
}
|
|
4421
|
+
|
|
4177
4422
|
function allocateInSlot(vm, children) {
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4423
|
+
var _a;
|
|
4424
|
+
|
|
4425
|
+
const {
|
|
4426
|
+
cmpSlots: oldSlots
|
|
4427
|
+
} = vm;
|
|
4428
|
+
const cmpSlots = vm.cmpSlots = create(null);
|
|
4429
|
+
|
|
4430
|
+
for (let i = 0, len = children.length; i < len; i += 1) {
|
|
4431
|
+
const vnode = children[i];
|
|
4432
|
+
|
|
4433
|
+
if (isNull(vnode)) {
|
|
4434
|
+
continue;
|
|
4435
|
+
}
|
|
4436
|
+
|
|
4437
|
+
let slotName = '';
|
|
4438
|
+
|
|
4439
|
+
if (isVBaseElement(vnode)) {
|
|
4440
|
+
slotName = ((_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) || '';
|
|
4441
|
+
}
|
|
4442
|
+
|
|
4443
|
+
const vnodes = cmpSlots[slotName] = cmpSlots[slotName] || [];
|
|
4444
|
+
ArrayPush$1.call(vnodes, vnode);
|
|
4445
|
+
}
|
|
4446
|
+
|
|
4447
|
+
if (isFalse(vm.isDirty)) {
|
|
4448
|
+
// We need to determine if the old allocation is really different from the new one
|
|
4449
|
+
// and mark the vm as dirty
|
|
4450
|
+
const oldKeys = keys(oldSlots);
|
|
4451
|
+
|
|
4452
|
+
if (oldKeys.length !== keys(cmpSlots).length) {
|
|
4453
|
+
markComponentAsDirty(vm);
|
|
4454
|
+
return;
|
|
4455
|
+
}
|
|
4456
|
+
|
|
4457
|
+
for (let i = 0, len = oldKeys.length; i < len; i += 1) {
|
|
4458
|
+
const key = oldKeys[i];
|
|
4459
|
+
|
|
4460
|
+
if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
|
|
4461
|
+
markComponentAsDirty(vm);
|
|
4462
|
+
return;
|
|
4463
|
+
}
|
|
4464
|
+
|
|
4465
|
+
const oldVNodes = oldSlots[key];
|
|
4466
|
+
const vnodes = cmpSlots[key];
|
|
4467
|
+
|
|
4468
|
+
for (let j = 0, a = cmpSlots[key].length; j < a; j += 1) {
|
|
4469
|
+
if (oldVNodes[j] !== vnodes[j]) {
|
|
4470
|
+
markComponentAsDirty(vm);
|
|
4471
|
+
return;
|
|
4215
4472
|
}
|
|
4473
|
+
}
|
|
4216
4474
|
}
|
|
4217
|
-
}
|
|
4218
|
-
// Using a WeakMap instead of a WeakSet because this one works in IE11 :(
|
|
4219
|
-
|
|
4220
|
-
|
|
4475
|
+
}
|
|
4476
|
+
} // Using a WeakMap instead of a WeakSet because this one works in IE11 :(
|
|
4477
|
+
|
|
4478
|
+
|
|
4479
|
+
const FromIteration = new WeakMap(); // dynamic children means it was generated by an iteration
|
|
4221
4480
|
// in a template, and will require a more complex diffing algo.
|
|
4481
|
+
|
|
4222
4482
|
function markAsDynamicChildren(children) {
|
|
4223
|
-
|
|
4483
|
+
FromIteration.set(children, 1);
|
|
4224
4484
|
}
|
|
4485
|
+
|
|
4225
4486
|
function hasDynamicChildren(children) {
|
|
4226
|
-
|
|
4487
|
+
return FromIteration.has(children);
|
|
4227
4488
|
}
|
|
4489
|
+
|
|
4228
4490
|
function createKeyToOldIdx(children, beginIdx, endIdx) {
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4491
|
+
const map = {}; // TODO [#1637]: simplify this by assuming that all vnodes has keys
|
|
4492
|
+
|
|
4493
|
+
for (let j = beginIdx; j <= endIdx; ++j) {
|
|
4494
|
+
const ch = children[j];
|
|
4495
|
+
|
|
4496
|
+
if (isVNode(ch)) {
|
|
4497
|
+
const {
|
|
4498
|
+
key
|
|
4499
|
+
} = ch;
|
|
4500
|
+
|
|
4501
|
+
if (key !== undefined) {
|
|
4502
|
+
map[key] = j;
|
|
4503
|
+
}
|
|
4239
4504
|
}
|
|
4240
|
-
|
|
4505
|
+
}
|
|
4506
|
+
|
|
4507
|
+
return map;
|
|
4241
4508
|
}
|
|
4509
|
+
|
|
4242
4510
|
function updateDynamicChildren(oldCh, newCh, parent, renderer) {
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
}
|
|
4322
|
-
// We've already cloned at least once, so it's no longer read-only
|
|
4323
|
-
oldCh[idxInOld] = undefined;
|
|
4324
|
-
insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
|
|
4325
|
-
}
|
|
4326
|
-
}
|
|
4327
|
-
newStartVnode = newCh[++newStartIdx];
|
|
4328
|
-
}
|
|
4511
|
+
let oldStartIdx = 0;
|
|
4512
|
+
let newStartIdx = 0;
|
|
4513
|
+
let oldEndIdx = oldCh.length - 1;
|
|
4514
|
+
let oldStartVnode = oldCh[0];
|
|
4515
|
+
let oldEndVnode = oldCh[oldEndIdx];
|
|
4516
|
+
const newChEnd = newCh.length - 1;
|
|
4517
|
+
let newEndIdx = newChEnd;
|
|
4518
|
+
let newStartVnode = newCh[0];
|
|
4519
|
+
let newEndVnode = newCh[newEndIdx];
|
|
4520
|
+
let oldKeyToIdx;
|
|
4521
|
+
let idxInOld;
|
|
4522
|
+
let elmToMove;
|
|
4523
|
+
let before;
|
|
4524
|
+
let clonedOldCh = false;
|
|
4525
|
+
|
|
4526
|
+
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
4527
|
+
if (!isVNode(oldStartVnode)) {
|
|
4528
|
+
oldStartVnode = oldCh[++oldStartIdx]; // Vnode might have been moved left
|
|
4529
|
+
} else if (!isVNode(oldEndVnode)) {
|
|
4530
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
|
4531
|
+
} else if (!isVNode(newStartVnode)) {
|
|
4532
|
+
newStartVnode = newCh[++newStartIdx];
|
|
4533
|
+
} else if (!isVNode(newEndVnode)) {
|
|
4534
|
+
newEndVnode = newCh[--newEndIdx];
|
|
4535
|
+
} else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
4536
|
+
patch(oldStartVnode, newStartVnode, parent, renderer);
|
|
4537
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
|
4538
|
+
newStartVnode = newCh[++newStartIdx];
|
|
4539
|
+
} else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
4540
|
+
patch(oldEndVnode, newEndVnode, parent, renderer);
|
|
4541
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
|
4542
|
+
newEndVnode = newCh[--newEndIdx];
|
|
4543
|
+
} else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
4544
|
+
// Vnode moved right
|
|
4545
|
+
patch(oldStartVnode, newEndVnode, parent, renderer);
|
|
4546
|
+
insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
|
|
4547
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
|
4548
|
+
newEndVnode = newCh[--newEndIdx];
|
|
4549
|
+
} else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
4550
|
+
// Vnode moved left
|
|
4551
|
+
patch(oldEndVnode, newStartVnode, parent, renderer);
|
|
4552
|
+
insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
|
|
4553
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
|
4554
|
+
newStartVnode = newCh[++newStartIdx];
|
|
4555
|
+
} else {
|
|
4556
|
+
if (oldKeyToIdx === undefined) {
|
|
4557
|
+
oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
|
|
4558
|
+
}
|
|
4559
|
+
|
|
4560
|
+
idxInOld = oldKeyToIdx[newStartVnode.key];
|
|
4561
|
+
|
|
4562
|
+
if (isUndefined$1(idxInOld)) {
|
|
4563
|
+
// New element
|
|
4564
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4565
|
+
newStartVnode = newCh[++newStartIdx];
|
|
4566
|
+
} else {
|
|
4567
|
+
elmToMove = oldCh[idxInOld];
|
|
4568
|
+
|
|
4569
|
+
if (isVNode(elmToMove)) {
|
|
4570
|
+
if (elmToMove.sel !== newStartVnode.sel) {
|
|
4571
|
+
// New element
|
|
4572
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4573
|
+
} else {
|
|
4574
|
+
patch(elmToMove, newStartVnode, parent, renderer); // Delete the old child, but copy the array since it is read-only.
|
|
4575
|
+
// The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
|
|
4576
|
+
// so we only care about the `oldCh` object inside this function.
|
|
4577
|
+
// To avoid cloning over and over again, we check `clonedOldCh`
|
|
4578
|
+
// and only clone once.
|
|
4579
|
+
|
|
4580
|
+
if (!clonedOldCh) {
|
|
4581
|
+
clonedOldCh = true;
|
|
4582
|
+
oldCh = [...oldCh];
|
|
4583
|
+
} // We've already cloned at least once, so it's no longer read-only
|
|
4584
|
+
|
|
4585
|
+
|
|
4586
|
+
oldCh[idxInOld] = undefined;
|
|
4587
|
+
insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
|
|
4588
|
+
}
|
|
4329
4589
|
}
|
|
4590
|
+
|
|
4591
|
+
newStartVnode = newCh[++newStartIdx];
|
|
4592
|
+
}
|
|
4330
4593
|
}
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4594
|
+
}
|
|
4595
|
+
|
|
4596
|
+
if (oldStartIdx <= oldEndIdx || newStartIdx <= newEndIdx) {
|
|
4597
|
+
if (oldStartIdx > oldEndIdx) {
|
|
4598
|
+
// There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
|
|
4599
|
+
// already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
|
|
4600
|
+
let i = newEndIdx;
|
|
4601
|
+
let n;
|
|
4602
|
+
|
|
4603
|
+
do {
|
|
4604
|
+
n = newCh[++i];
|
|
4605
|
+
} while (!isVNode(n) && i < newChEnd);
|
|
4606
|
+
|
|
4607
|
+
before = isVNode(n) ? n.elm : null;
|
|
4608
|
+
mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
|
|
4609
|
+
} else {
|
|
4610
|
+
unmountVNodes(oldCh, parent, renderer, true, oldStartIdx, oldEndIdx + 1);
|
|
4346
4611
|
}
|
|
4612
|
+
}
|
|
4347
4613
|
}
|
|
4614
|
+
|
|
4348
4615
|
function updateStaticChildren(c1, c2, parent, renderer) {
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
anchor = n2.elm;
|
|
4383
|
-
}
|
|
4616
|
+
const c1Length = c1.length;
|
|
4617
|
+
const c2Length = c2.length;
|
|
4618
|
+
|
|
4619
|
+
if (c1Length === 0) {
|
|
4620
|
+
// the old list is empty, we can directly insert anything new
|
|
4621
|
+
mountVNodes(c2, parent, renderer, null);
|
|
4622
|
+
return;
|
|
4623
|
+
}
|
|
4624
|
+
|
|
4625
|
+
if (c2Length === 0) {
|
|
4626
|
+
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
4627
|
+
// this is the case in which the dynamic children of an if-directive should be removed
|
|
4628
|
+
unmountVNodes(c1, parent, renderer, true);
|
|
4629
|
+
return;
|
|
4630
|
+
} // if the old list is not empty, the new list MUST have the same
|
|
4631
|
+
// amount of nodes, that's why we call this static children
|
|
4632
|
+
|
|
4633
|
+
|
|
4634
|
+
let anchor = null;
|
|
4635
|
+
|
|
4636
|
+
for (let i = c2Length - 1; i >= 0; i -= 1) {
|
|
4637
|
+
const n1 = c1[i];
|
|
4638
|
+
const n2 = c2[i];
|
|
4639
|
+
|
|
4640
|
+
if (n2 !== n1) {
|
|
4641
|
+
if (isVNode(n1)) {
|
|
4642
|
+
if (isVNode(n2)) {
|
|
4643
|
+
// both vnodes are equivalent, and we just need to patch them
|
|
4644
|
+
patch(n1, n2, parent, renderer);
|
|
4645
|
+
anchor = n2.elm;
|
|
4646
|
+
} else {
|
|
4647
|
+
// removing the old vnode since the new one is null
|
|
4648
|
+
unmount(n1, parent, renderer, true);
|
|
4384
4649
|
}
|
|
4650
|
+
} else if (isVNode(n2)) {
|
|
4651
|
+
mount(n2, parent, renderer, anchor);
|
|
4652
|
+
anchor = n2.elm;
|
|
4653
|
+
}
|
|
4385
4654
|
}
|
|
4655
|
+
}
|
|
4386
4656
|
}
|
|
4387
4657
|
|
|
4388
4658
|
/*
|
|
@@ -5445,7 +5715,7 @@ function createVM(elm, ctor, renderer, options) {
|
|
|
5445
5715
|
return `[object:vm ${def.name} (${vm.idx})]`;
|
|
5446
5716
|
};
|
|
5447
5717
|
|
|
5448
|
-
if (
|
|
5718
|
+
if (lwcRuntimeFlags.ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST) {
|
|
5449
5719
|
vm.shadowMode = 0
|
|
5450
5720
|
/* ShadowMode.Native */
|
|
5451
5721
|
;
|
|
@@ -5484,7 +5754,7 @@ function computeShadowMode(vm, renderer) {
|
|
|
5484
5754
|
} else if (isNativeShadowDefined) {
|
|
5485
5755
|
// Not combined with above condition because @lwc/features only supports identifiers in
|
|
5486
5756
|
// the if-condition.
|
|
5487
|
-
if (
|
|
5757
|
+
if (lwcRuntimeFlags.ENABLE_MIXED_SHADOW_MODE) {
|
|
5488
5758
|
if (def.shadowSupportMode === "any"
|
|
5489
5759
|
/* ShadowSupportMode.Any */
|
|
5490
5760
|
) {
|
|
@@ -6191,7 +6461,7 @@ function installWireAdapters(vm) {
|
|
|
6191
6461
|
ArrayPush$1.call(wiredConnecting, () => {
|
|
6192
6462
|
connector.connect();
|
|
6193
6463
|
|
|
6194
|
-
if (!
|
|
6464
|
+
if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
|
|
6195
6465
|
if (hasDynamicParams) {
|
|
6196
6466
|
Promise.resolve().then(computeConfigAndUpdate);
|
|
6197
6467
|
return;
|
|
@@ -6337,6 +6607,7 @@ function hydrateNode(node, vnode, renderer) {
|
|
|
6337
6607
|
}
|
|
6338
6608
|
return renderer.nextSibling(hydratedNode);
|
|
6339
6609
|
}
|
|
6610
|
+
const NODE_VALUE_PROP = 'nodeValue';
|
|
6340
6611
|
function hydrateText(node, vnode, renderer) {
|
|
6341
6612
|
var _a;
|
|
6342
6613
|
if (!hasCorrectNodeType(vnode, node, 3 /* EnvNodeTypes.TEXT */, renderer)) {
|
|
@@ -6344,7 +6615,7 @@ function hydrateText(node, vnode, renderer) {
|
|
|
6344
6615
|
}
|
|
6345
6616
|
if (process.env.NODE_ENV !== 'production') {
|
|
6346
6617
|
const { getProperty } = renderer;
|
|
6347
|
-
const nodeValue = getProperty(node,
|
|
6618
|
+
const nodeValue = getProperty(node, NODE_VALUE_PROP);
|
|
6348
6619
|
if (nodeValue !== vnode.text && !(nodeValue === '\u200D' && vnode.text === '')) {
|
|
6349
6620
|
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);
|
|
6350
6621
|
}
|
|
@@ -6361,13 +6632,13 @@ function hydrateComment(node, vnode, renderer) {
|
|
|
6361
6632
|
}
|
|
6362
6633
|
if (process.env.NODE_ENV !== 'production') {
|
|
6363
6634
|
const { getProperty } = renderer;
|
|
6364
|
-
const nodeValue = getProperty(node,
|
|
6635
|
+
const nodeValue = getProperty(node, NODE_VALUE_PROP);
|
|
6365
6636
|
if (nodeValue !== vnode.text) {
|
|
6366
6637
|
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vnode.owner);
|
|
6367
6638
|
}
|
|
6368
6639
|
}
|
|
6369
6640
|
const { setProperty } = renderer;
|
|
6370
|
-
setProperty(node,
|
|
6641
|
+
setProperty(node, NODE_VALUE_PROP, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
6371
6642
|
vnode.elm = node;
|
|
6372
6643
|
return node;
|
|
6373
6644
|
}
|
|
@@ -6635,13 +6906,13 @@ function areCompatibleNodes(client, ssr, vnode, renderer) {
|
|
|
6635
6906
|
if (!hasCorrectNodeType(vnode, ssr, 3 /* EnvNodeTypes.TEXT */, renderer)) {
|
|
6636
6907
|
return false;
|
|
6637
6908
|
}
|
|
6638
|
-
return getProperty(client,
|
|
6909
|
+
return getProperty(client, NODE_VALUE_PROP) === getProperty(ssr, NODE_VALUE_PROP);
|
|
6639
6910
|
}
|
|
6640
6911
|
if (getProperty(client, 'nodeType') === 8 /* EnvNodeTypes.COMMENT */) {
|
|
6641
6912
|
if (!hasCorrectNodeType(vnode, ssr, 8 /* EnvNodeTypes.COMMENT */, renderer)) {
|
|
6642
6913
|
return false;
|
|
6643
6914
|
}
|
|
6644
|
-
return getProperty(client,
|
|
6915
|
+
return getProperty(client, NODE_VALUE_PROP) === getProperty(ssr, NODE_VALUE_PROP);
|
|
6645
6916
|
}
|
|
6646
6917
|
if (!hasCorrectNodeType(vnode, ssr, 1 /* EnvNodeTypes.ELEMENT */, renderer)) {
|
|
6647
6918
|
return false;
|
|
@@ -6797,7 +7068,7 @@ function getComponentConstructor(elm) {
|
|
|
6797
7068
|
}
|
|
6798
7069
|
return ctor;
|
|
6799
7070
|
}
|
|
6800
|
-
/* version: 2.23.
|
|
7071
|
+
/* version: 2.23.3 */
|
|
6801
7072
|
|
|
6802
7073
|
/*
|
|
6803
7074
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6947,61 +7218,303 @@ function insertStylesheet(content, target) {
|
|
|
6947
7218
|
* SPDX-License-Identifier: MIT
|
|
6948
7219
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6949
7220
|
*/
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
|
|
6953
|
-
|
|
6954
|
-
|
|
6955
|
-
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
//
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
|
|
6986
|
-
|
|
6987
|
-
|
|
6988
|
-
|
|
6989
|
-
|
|
6990
|
-
html = `<${wrapperTag}>${html}</${wrapperTag}>`;
|
|
7221
|
+
/**
|
|
7222
|
+
* A factory function that produces a renderer.
|
|
7223
|
+
* Renderer encapsulates operations that are required to render an LWC component into the underlying
|
|
7224
|
+
* runtime environment. In the case of @lwc/enigne-dom, it is meant to be used in a DOM environment.
|
|
7225
|
+
* Example usage:
|
|
7226
|
+
* import { renderer, rendererFactory } from 'lwc';
|
|
7227
|
+
* const customRenderer = rendererFactory(renderer);
|
|
7228
|
+
*
|
|
7229
|
+
* @param baseRenderer Either null or the base renderer imported from 'lwc'.
|
|
7230
|
+
*/
|
|
7231
|
+
function rendererFactory(baseRenderer) {
|
|
7232
|
+
// Util functions
|
|
7233
|
+
function assertInvariant(value, msg) {
|
|
7234
|
+
if (!value) {
|
|
7235
|
+
throw new Error(`Invariant Violation: ${msg}`);
|
|
7236
|
+
}
|
|
7237
|
+
}
|
|
7238
|
+
function isNull(obj) {
|
|
7239
|
+
return obj === null;
|
|
7240
|
+
}
|
|
7241
|
+
function isUndefined(obj) {
|
|
7242
|
+
return obj === undefined;
|
|
7243
|
+
}
|
|
7244
|
+
let getCustomElement;
|
|
7245
|
+
let defineCustomElement;
|
|
7246
|
+
let HTMLElementConstructor;
|
|
7247
|
+
function isCustomElementRegistryAvailable() {
|
|
7248
|
+
if (typeof customElements === 'undefined') {
|
|
7249
|
+
return false;
|
|
7250
|
+
}
|
|
7251
|
+
try {
|
|
7252
|
+
// dereference HTMLElement global because babel wraps globals in compat mode with a
|
|
7253
|
+
// _wrapNativeSuper()
|
|
7254
|
+
// This is a problem because LWCUpgradableElement extends renderer.HTMLElementExported which does not
|
|
7255
|
+
// get wrapped by babel.
|
|
7256
|
+
const HTMLElementAlias = HTMLElement;
|
|
7257
|
+
// In case we use compat mode with a modern browser, the compat mode transformation
|
|
7258
|
+
// invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
|
|
7259
|
+
// which are not equipped to be initialized that way.
|
|
7260
|
+
class clazz extends HTMLElementAlias {
|
|
6991
7261
|
}
|
|
7262
|
+
customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
|
|
7263
|
+
new clazz();
|
|
7264
|
+
return true;
|
|
7265
|
+
}
|
|
7266
|
+
catch (_a) {
|
|
7267
|
+
return false;
|
|
6992
7268
|
}
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7269
|
+
}
|
|
7270
|
+
if (isCustomElementRegistryAvailable()) {
|
|
7271
|
+
getCustomElement = customElements.get.bind(customElements);
|
|
7272
|
+
defineCustomElement = customElements.define.bind(customElements);
|
|
7273
|
+
HTMLElementConstructor = HTMLElement;
|
|
7274
|
+
}
|
|
7275
|
+
else {
|
|
7276
|
+
const registry = Object.create(null);
|
|
7277
|
+
const reverseRegistry = new WeakMap();
|
|
7278
|
+
defineCustomElement = function define(name, ctor) {
|
|
7279
|
+
if (name !== String.prototype.toLowerCase.call(name) || registry[name]) {
|
|
7280
|
+
throw new TypeError(`Invalid Registration`);
|
|
7281
|
+
}
|
|
7282
|
+
registry[name] = ctor;
|
|
7283
|
+
reverseRegistry.set(ctor, name);
|
|
7284
|
+
};
|
|
7285
|
+
getCustomElement = function get(name) {
|
|
7286
|
+
return registry[name];
|
|
7287
|
+
};
|
|
7288
|
+
HTMLElementConstructor = function HTMLElement() {
|
|
7289
|
+
if (!(this instanceof HTMLElement)) {
|
|
7290
|
+
throw new TypeError(`Invalid Invocation`);
|
|
7291
|
+
}
|
|
7292
|
+
const { constructor } = this;
|
|
7293
|
+
const name = reverseRegistry.get(constructor);
|
|
7294
|
+
if (!name) {
|
|
7295
|
+
throw new TypeError(`Invalid Construction`);
|
|
7296
|
+
}
|
|
7297
|
+
const elm = document.createElement(name);
|
|
7298
|
+
Object.setPrototypeOf(elm, constructor.prototype);
|
|
7299
|
+
return elm;
|
|
7300
|
+
};
|
|
7301
|
+
HTMLElementConstructor.prototype = HTMLElement.prototype;
|
|
7302
|
+
}
|
|
7303
|
+
function cloneNode(node, deep) {
|
|
7304
|
+
return node.cloneNode(deep);
|
|
7305
|
+
}
|
|
7306
|
+
function createElement(tagName, namespace) {
|
|
7307
|
+
return isUndefined(namespace)
|
|
7308
|
+
? document.createElement(tagName)
|
|
7309
|
+
: document.createElementNS(namespace, tagName);
|
|
7310
|
+
}
|
|
7311
|
+
function createText(content) {
|
|
7312
|
+
return document.createTextNode(content);
|
|
7313
|
+
}
|
|
7314
|
+
function createComment(content) {
|
|
7315
|
+
return document.createComment(content);
|
|
7316
|
+
}
|
|
7317
|
+
let createFragment;
|
|
7318
|
+
// IE11 lacks support for this feature
|
|
7319
|
+
const SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
|
|
7320
|
+
if (SUPPORTS_TEMPLATE) {
|
|
7321
|
+
// Parse the fragment HTML string into DOM
|
|
7322
|
+
createFragment = function (html) {
|
|
7323
|
+
const template = document.createElement('template');
|
|
7324
|
+
template.innerHTML = html;
|
|
7325
|
+
return template.content.firstChild;
|
|
7326
|
+
};
|
|
7327
|
+
}
|
|
7328
|
+
else {
|
|
7329
|
+
// In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
|
|
7330
|
+
// <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
|
|
7331
|
+
// Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
|
|
7332
|
+
// With other elements added from:
|
|
7333
|
+
// https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
|
|
7334
|
+
// Using the test:
|
|
7335
|
+
// document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
|
|
7336
|
+
// And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
|
|
7337
|
+
const topLevelWrappingMap = {
|
|
7338
|
+
caption: ['table'],
|
|
7339
|
+
col: ['colgroup', 'table'],
|
|
7340
|
+
colgroup: ['table'],
|
|
7341
|
+
option: ['select'],
|
|
7342
|
+
tbody: ['table'],
|
|
7343
|
+
td: ['tr', 'tbody', 'table'],
|
|
7344
|
+
th: ['tr', 'tbody', 'table'],
|
|
7345
|
+
thead: ['table'],
|
|
7346
|
+
tfoot: ['table'],
|
|
7347
|
+
tr: ['tbody', 'table'],
|
|
7348
|
+
};
|
|
7349
|
+
// Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
|
|
7350
|
+
const getTagName = function (text) {
|
|
7351
|
+
return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
|
|
7352
|
+
};
|
|
7353
|
+
// Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
|
|
7354
|
+
createFragment = function (html) {
|
|
7355
|
+
const wrapperTags = topLevelWrappingMap[getTagName(html)];
|
|
7356
|
+
if (!isUndefined(wrapperTags)) {
|
|
7357
|
+
for (const wrapperTag of wrapperTags) {
|
|
7358
|
+
html = `<${wrapperTag}>${html}</${wrapperTag}>`;
|
|
7359
|
+
}
|
|
7001
7360
|
}
|
|
7361
|
+
// For IE11, the document title must not be undefined, but it can be an empty string
|
|
7362
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
|
|
7363
|
+
const doc = document.implementation.createHTMLDocument('');
|
|
7364
|
+
doc.body.innerHTML = html;
|
|
7365
|
+
let content = doc.body;
|
|
7366
|
+
if (!isUndefined(wrapperTags)) {
|
|
7367
|
+
for (let i = 0; i < wrapperTags.length; i++) {
|
|
7368
|
+
content = content.firstChild;
|
|
7369
|
+
}
|
|
7370
|
+
}
|
|
7371
|
+
return content.firstChild;
|
|
7372
|
+
};
|
|
7373
|
+
}
|
|
7374
|
+
function insert(node, parent, anchor) {
|
|
7375
|
+
parent.insertBefore(node, anchor);
|
|
7376
|
+
}
|
|
7377
|
+
function remove(node, parent) {
|
|
7378
|
+
parent.removeChild(node);
|
|
7379
|
+
}
|
|
7380
|
+
function nextSibling(node) {
|
|
7381
|
+
return node.nextSibling;
|
|
7382
|
+
}
|
|
7383
|
+
function attachShadow(element, options) {
|
|
7384
|
+
// `shadowRoot` will be non-null in two cases:
|
|
7385
|
+
// 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
|
|
7386
|
+
// 2. when a webapp author places <c-app> in their static HTML and mounts their
|
|
7387
|
+
// root component with customElement.define('c-app', Ctor)
|
|
7388
|
+
if (!isNull(element.shadowRoot)) {
|
|
7389
|
+
return element.shadowRoot;
|
|
7390
|
+
}
|
|
7391
|
+
return element.attachShadow(options);
|
|
7392
|
+
}
|
|
7393
|
+
function setText(node, content) {
|
|
7394
|
+
node.nodeValue = content;
|
|
7395
|
+
}
|
|
7396
|
+
function getProperty(node, key) {
|
|
7397
|
+
return node[key];
|
|
7398
|
+
}
|
|
7399
|
+
function setProperty(node, key, value) {
|
|
7400
|
+
node[key] = value;
|
|
7401
|
+
}
|
|
7402
|
+
function getAttribute(element, name, namespace) {
|
|
7403
|
+
return isUndefined(namespace)
|
|
7404
|
+
? element.getAttribute(name)
|
|
7405
|
+
: element.getAttributeNS(namespace, name);
|
|
7406
|
+
}
|
|
7407
|
+
function setAttribute(element, name, value, namespace) {
|
|
7408
|
+
return isUndefined(namespace)
|
|
7409
|
+
? element.setAttribute(name, value)
|
|
7410
|
+
: element.setAttributeNS(namespace, name, value);
|
|
7411
|
+
}
|
|
7412
|
+
function removeAttribute(element, name, namespace) {
|
|
7413
|
+
if (isUndefined(namespace)) {
|
|
7414
|
+
element.removeAttribute(name);
|
|
7002
7415
|
}
|
|
7003
|
-
|
|
7416
|
+
else {
|
|
7417
|
+
element.removeAttributeNS(namespace, name);
|
|
7418
|
+
}
|
|
7419
|
+
}
|
|
7420
|
+
function addEventListener(target, type, callback, options) {
|
|
7421
|
+
target.addEventListener(type, callback, options);
|
|
7422
|
+
}
|
|
7423
|
+
function removeEventListener(target, type, callback, options) {
|
|
7424
|
+
target.removeEventListener(type, callback, options);
|
|
7425
|
+
}
|
|
7426
|
+
function dispatchEvent(target, event) {
|
|
7427
|
+
return target.dispatchEvent(event);
|
|
7428
|
+
}
|
|
7429
|
+
function getClassList(element) {
|
|
7430
|
+
return element.classList;
|
|
7431
|
+
}
|
|
7432
|
+
function setCSSStyleProperty(element, name, value, important) {
|
|
7433
|
+
// TODO [#0]: How to avoid this type casting? Shall we use a different type interface to
|
|
7434
|
+
// represent elements in the engine?
|
|
7435
|
+
element.style.setProperty(name, value, important ? 'important' : '');
|
|
7436
|
+
}
|
|
7437
|
+
function getBoundingClientRect(element) {
|
|
7438
|
+
return element.getBoundingClientRect();
|
|
7439
|
+
}
|
|
7440
|
+
function querySelector(element, selectors) {
|
|
7441
|
+
return element.querySelector(selectors);
|
|
7442
|
+
}
|
|
7443
|
+
function querySelectorAll(element, selectors) {
|
|
7444
|
+
return element.querySelectorAll(selectors);
|
|
7445
|
+
}
|
|
7446
|
+
function getElementsByTagName(element, tagNameOrWildCard) {
|
|
7447
|
+
return element.getElementsByTagName(tagNameOrWildCard);
|
|
7448
|
+
}
|
|
7449
|
+
function getElementsByClassName(element, names) {
|
|
7450
|
+
return element.getElementsByClassName(names);
|
|
7451
|
+
}
|
|
7452
|
+
function getChildren(element) {
|
|
7453
|
+
return element.children;
|
|
7454
|
+
}
|
|
7455
|
+
function getChildNodes(element) {
|
|
7456
|
+
return element.childNodes;
|
|
7457
|
+
}
|
|
7458
|
+
function getFirstChild(element) {
|
|
7459
|
+
return element.firstChild;
|
|
7460
|
+
}
|
|
7461
|
+
function getFirstElementChild(element) {
|
|
7462
|
+
return element.firstElementChild;
|
|
7463
|
+
}
|
|
7464
|
+
function getLastChild(element) {
|
|
7465
|
+
return element.lastChild;
|
|
7466
|
+
}
|
|
7467
|
+
function getLastElementChild(element) {
|
|
7468
|
+
return element.lastElementChild;
|
|
7469
|
+
}
|
|
7470
|
+
function isConnected(node) {
|
|
7471
|
+
return node.isConnected;
|
|
7472
|
+
}
|
|
7473
|
+
function assertInstanceOfHTMLElement(elm, msg) {
|
|
7474
|
+
assertInvariant(elm instanceof HTMLElement, msg);
|
|
7475
|
+
}
|
|
7476
|
+
const HTMLElementExported = HTMLElementConstructor;
|
|
7477
|
+
const renderer = {
|
|
7478
|
+
HTMLElementExported,
|
|
7479
|
+
insert,
|
|
7480
|
+
remove,
|
|
7481
|
+
cloneNode,
|
|
7482
|
+
createFragment,
|
|
7483
|
+
createElement,
|
|
7484
|
+
createText,
|
|
7485
|
+
createComment,
|
|
7486
|
+
nextSibling,
|
|
7487
|
+
attachShadow,
|
|
7488
|
+
getProperty,
|
|
7489
|
+
setProperty,
|
|
7490
|
+
setText,
|
|
7491
|
+
getAttribute,
|
|
7492
|
+
setAttribute,
|
|
7493
|
+
removeAttribute,
|
|
7494
|
+
addEventListener,
|
|
7495
|
+
removeEventListener,
|
|
7496
|
+
dispatchEvent,
|
|
7497
|
+
getClassList,
|
|
7498
|
+
setCSSStyleProperty,
|
|
7499
|
+
getBoundingClientRect,
|
|
7500
|
+
querySelector,
|
|
7501
|
+
querySelectorAll,
|
|
7502
|
+
getElementsByTagName,
|
|
7503
|
+
getElementsByClassName,
|
|
7504
|
+
getChildren,
|
|
7505
|
+
getChildNodes,
|
|
7506
|
+
getFirstChild,
|
|
7507
|
+
getFirstElementChild,
|
|
7508
|
+
getLastChild,
|
|
7509
|
+
getLastElementChild,
|
|
7510
|
+
isConnected,
|
|
7511
|
+
assertInstanceOfHTMLElement,
|
|
7512
|
+
defineCustomElement,
|
|
7513
|
+
getCustomElement,
|
|
7004
7514
|
};
|
|
7515
|
+
// Meant to inherit any properties passed via the base renderer as the argument to the factory.
|
|
7516
|
+
Object.setPrototypeOf(renderer, baseRenderer);
|
|
7517
|
+
return renderer;
|
|
7005
7518
|
}
|
|
7006
7519
|
|
|
7007
7520
|
/*
|
|
@@ -7010,231 +7523,21 @@ else {
|
|
|
7010
7523
|
* SPDX-License-Identifier: MIT
|
|
7011
7524
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7012
7525
|
*/
|
|
7013
|
-
|
|
7014
|
-
|
|
7015
|
-
|
|
7016
|
-
|
|
7017
|
-
|
|
7018
|
-
|
|
7019
|
-
|
|
7020
|
-
|
|
7021
|
-
|
|
7022
|
-
|
|
7023
|
-
|
|
7024
|
-
// get wrapped by babel.
|
|
7025
|
-
const HTMLElementAlias = HTMLElement;
|
|
7026
|
-
// In case we use compat mode with a modern browser, the compat mode transformation
|
|
7027
|
-
// invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
|
|
7028
|
-
// which are not equipped to be initialized that way.
|
|
7029
|
-
class clazz extends HTMLElementAlias {
|
|
7030
|
-
}
|
|
7031
|
-
customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
|
|
7032
|
-
new clazz();
|
|
7033
|
-
return true;
|
|
7034
|
-
}
|
|
7035
|
-
catch (_a) {
|
|
7036
|
-
return false;
|
|
7037
|
-
}
|
|
7038
|
-
}
|
|
7039
|
-
if (isCustomElementRegistryAvailable()) {
|
|
7040
|
-
getCustomElement = customElements.get.bind(customElements);
|
|
7041
|
-
defineCustomElement = customElements.define.bind(customElements);
|
|
7042
|
-
HTMLElementConstructor = HTMLElement;
|
|
7043
|
-
}
|
|
7044
|
-
else {
|
|
7045
|
-
const registry = create(null);
|
|
7046
|
-
const reverseRegistry = new WeakMap();
|
|
7047
|
-
defineCustomElement = function define(name, ctor) {
|
|
7048
|
-
if (name !== StringToLowerCase.call(name) || registry[name]) {
|
|
7049
|
-
throw new TypeError(`Invalid Registration`);
|
|
7050
|
-
}
|
|
7051
|
-
registry[name] = ctor;
|
|
7052
|
-
reverseRegistry.set(ctor, name);
|
|
7053
|
-
};
|
|
7054
|
-
getCustomElement = function get(name) {
|
|
7055
|
-
return registry[name];
|
|
7056
|
-
};
|
|
7057
|
-
HTMLElementConstructor = function HTMLElement() {
|
|
7058
|
-
if (!(this instanceof HTMLElement)) {
|
|
7059
|
-
throw new TypeError(`Invalid Invocation`);
|
|
7060
|
-
}
|
|
7061
|
-
const { constructor } = this;
|
|
7062
|
-
const name = reverseRegistry.get(constructor);
|
|
7063
|
-
if (!name) {
|
|
7064
|
-
throw new TypeError(`Invalid Construction`);
|
|
7065
|
-
}
|
|
7066
|
-
const elm = document.createElement(name);
|
|
7067
|
-
setPrototypeOf(elm, constructor.prototype);
|
|
7068
|
-
return elm;
|
|
7069
|
-
};
|
|
7070
|
-
HTMLElementConstructor.prototype = HTMLElement.prototype;
|
|
7071
|
-
}
|
|
7072
|
-
const isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
|
|
7073
|
-
const isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
|
|
7074
|
-
function cloneNode(node, deep) {
|
|
7075
|
-
return node.cloneNode(deep);
|
|
7076
|
-
}
|
|
7077
|
-
function createElement$1(tagName, namespace) {
|
|
7078
|
-
return isUndefined$1(namespace)
|
|
7079
|
-
? document.createElement(tagName)
|
|
7080
|
-
: document.createElementNS(namespace, tagName);
|
|
7081
|
-
}
|
|
7082
|
-
function createText(content) {
|
|
7083
|
-
return document.createTextNode(content);
|
|
7084
|
-
}
|
|
7085
|
-
function createComment(content) {
|
|
7086
|
-
return document.createComment(content);
|
|
7087
|
-
}
|
|
7088
|
-
function insert(node, parent, anchor) {
|
|
7089
|
-
parent.insertBefore(node, anchor);
|
|
7090
|
-
}
|
|
7091
|
-
function remove(node, parent) {
|
|
7092
|
-
parent.removeChild(node);
|
|
7093
|
-
}
|
|
7094
|
-
function nextSibling(node) {
|
|
7095
|
-
return node.nextSibling;
|
|
7096
|
-
}
|
|
7097
|
-
function attachShadow(element, options) {
|
|
7098
|
-
// `shadowRoot` will be non-null in two cases:
|
|
7099
|
-
// 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
|
|
7100
|
-
// 2. when a webapp author places <c-app> in their static HTML and mounts their
|
|
7101
|
-
// root component with customElement.define('c-app', Ctor)
|
|
7102
|
-
if (!isNull(element.shadowRoot)) {
|
|
7103
|
-
return element.shadowRoot;
|
|
7104
|
-
}
|
|
7105
|
-
return element.attachShadow(options);
|
|
7106
|
-
}
|
|
7107
|
-
function setText(node, content) {
|
|
7108
|
-
node.nodeValue = content;
|
|
7109
|
-
}
|
|
7110
|
-
function getProperty(node, key) {
|
|
7111
|
-
return node[key];
|
|
7112
|
-
}
|
|
7113
|
-
function setProperty(node, key, value) {
|
|
7114
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
7115
|
-
if (node instanceof Element && !(key in node)) {
|
|
7116
|
-
// TODO [#1297]: Move this validation to the compiler
|
|
7117
|
-
assert.fail(`Unknown public property "${key}" of element <${node.tagName}>. This is likely a typo on the corresponding attribute "${htmlPropertyToAttribute(key)}".`);
|
|
7118
|
-
}
|
|
7119
|
-
}
|
|
7120
|
-
node[key] = value;
|
|
7121
|
-
}
|
|
7122
|
-
function getAttribute(element, name, namespace) {
|
|
7123
|
-
return isUndefined$1(namespace)
|
|
7124
|
-
? element.getAttribute(name)
|
|
7125
|
-
: element.getAttributeNS(namespace, name);
|
|
7126
|
-
}
|
|
7127
|
-
function setAttribute(element, name, value, namespace) {
|
|
7128
|
-
return isUndefined$1(namespace)
|
|
7129
|
-
? element.setAttribute(name, value)
|
|
7130
|
-
: element.setAttributeNS(namespace, name, value);
|
|
7131
|
-
}
|
|
7132
|
-
function removeAttribute(element, name, namespace) {
|
|
7133
|
-
if (isUndefined$1(namespace)) {
|
|
7134
|
-
element.removeAttribute(name);
|
|
7135
|
-
}
|
|
7136
|
-
else {
|
|
7137
|
-
element.removeAttributeNS(namespace, name);
|
|
7138
|
-
}
|
|
7139
|
-
}
|
|
7140
|
-
function addEventListener(target, type, callback, options) {
|
|
7141
|
-
target.addEventListener(type, callback, options);
|
|
7142
|
-
}
|
|
7143
|
-
function removeEventListener(target, type, callback, options) {
|
|
7144
|
-
target.removeEventListener(type, callback, options);
|
|
7145
|
-
}
|
|
7146
|
-
function dispatchEvent(target, event) {
|
|
7147
|
-
return target.dispatchEvent(event);
|
|
7148
|
-
}
|
|
7149
|
-
function getClassList(element) {
|
|
7150
|
-
return element.classList;
|
|
7151
|
-
}
|
|
7152
|
-
function setCSSStyleProperty(element, name, value, important) {
|
|
7153
|
-
// TODO [#0]: How to avoid this type casting? Shall we use a different type interface to
|
|
7154
|
-
// represent elements in the engine?
|
|
7155
|
-
element.style.setProperty(name, value, important ? 'important' : '');
|
|
7156
|
-
}
|
|
7157
|
-
function getBoundingClientRect(element) {
|
|
7158
|
-
return element.getBoundingClientRect();
|
|
7159
|
-
}
|
|
7160
|
-
function querySelector(element, selectors) {
|
|
7161
|
-
return element.querySelector(selectors);
|
|
7162
|
-
}
|
|
7163
|
-
function querySelectorAll(element, selectors) {
|
|
7164
|
-
return element.querySelectorAll(selectors);
|
|
7165
|
-
}
|
|
7166
|
-
function getElementsByTagName(element, tagNameOrWildCard) {
|
|
7167
|
-
return element.getElementsByTagName(tagNameOrWildCard);
|
|
7168
|
-
}
|
|
7169
|
-
function getElementsByClassName(element, names) {
|
|
7170
|
-
return element.getElementsByClassName(names);
|
|
7171
|
-
}
|
|
7172
|
-
function getChildren(element) {
|
|
7173
|
-
return element.children;
|
|
7174
|
-
}
|
|
7175
|
-
function getChildNodes(element) {
|
|
7176
|
-
return element.childNodes;
|
|
7177
|
-
}
|
|
7178
|
-
function getFirstChild(element) {
|
|
7179
|
-
return element.firstChild;
|
|
7180
|
-
}
|
|
7181
|
-
function getFirstElementChild(element) {
|
|
7182
|
-
return element.firstElementChild;
|
|
7183
|
-
}
|
|
7184
|
-
function getLastChild(element) {
|
|
7185
|
-
return element.lastChild;
|
|
7186
|
-
}
|
|
7187
|
-
function getLastElementChild(element) {
|
|
7188
|
-
return element.lastElementChild;
|
|
7189
|
-
}
|
|
7190
|
-
function isConnected(node) {
|
|
7191
|
-
return node.isConnected;
|
|
7192
|
-
}
|
|
7193
|
-
function assertInstanceOfHTMLElement(elm, msg) {
|
|
7194
|
-
assert.invariant(elm instanceof HTMLElement, msg);
|
|
7195
|
-
}
|
|
7196
|
-
const HTMLElementExported = HTMLElementConstructor;
|
|
7197
|
-
const renderer = {
|
|
7198
|
-
isNativeShadowDefined,
|
|
7199
|
-
isSyntheticShadowDefined,
|
|
7200
|
-
HTMLElementExported,
|
|
7201
|
-
insert,
|
|
7202
|
-
remove,
|
|
7203
|
-
cloneNode,
|
|
7204
|
-
createFragment,
|
|
7205
|
-
createElement: createElement$1,
|
|
7206
|
-
createText,
|
|
7207
|
-
createComment,
|
|
7208
|
-
nextSibling,
|
|
7209
|
-
attachShadow,
|
|
7210
|
-
getProperty,
|
|
7211
|
-
setProperty,
|
|
7212
|
-
setText,
|
|
7213
|
-
getAttribute,
|
|
7214
|
-
setAttribute,
|
|
7215
|
-
removeAttribute,
|
|
7216
|
-
addEventListener,
|
|
7217
|
-
removeEventListener,
|
|
7218
|
-
dispatchEvent,
|
|
7219
|
-
getClassList,
|
|
7220
|
-
setCSSStyleProperty,
|
|
7221
|
-
getBoundingClientRect,
|
|
7222
|
-
querySelector,
|
|
7223
|
-
querySelectorAll,
|
|
7224
|
-
getElementsByTagName,
|
|
7225
|
-
getElementsByClassName,
|
|
7226
|
-
getChildren,
|
|
7227
|
-
getChildNodes,
|
|
7228
|
-
getFirstChild,
|
|
7229
|
-
getFirstElementChild,
|
|
7230
|
-
getLastChild,
|
|
7231
|
-
getLastElementChild,
|
|
7232
|
-
isConnected,
|
|
7526
|
+
/**
|
|
7527
|
+
* The base renderer that will be used by engine-core.
|
|
7528
|
+
* This will be used for DOM operations when lwc is running in a browser environment.
|
|
7529
|
+
*/
|
|
7530
|
+
const renderer = assign(
|
|
7531
|
+
// The base renderer will invoke the factory with null and assign additional properties that are
|
|
7532
|
+
// shared across renderers
|
|
7533
|
+
rendererFactory(null),
|
|
7534
|
+
// Properties that are either not required to be sandboxed or rely on a globally shared information
|
|
7535
|
+
{
|
|
7536
|
+
// insertStyleSheet implementation shares a global cache of stylesheet data
|
|
7233
7537
|
insertStylesheet,
|
|
7234
|
-
|
|
7235
|
-
|
|
7236
|
-
|
|
7237
|
-
};
|
|
7538
|
+
isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
|
|
7539
|
+
isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
|
|
7540
|
+
});
|
|
7238
7541
|
|
|
7239
7542
|
/*
|
|
7240
7543
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7370,44 +7673,60 @@ function buildCustomElementConstructor(Ctor) {
|
|
|
7370
7673
|
* SPDX-License-Identifier: MIT
|
|
7371
7674
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7372
7675
|
*/
|
|
7373
|
-
// TODO [#2472]: Remove this workaround when appropriate.
|
|
7374
7676
|
// eslint-disable-next-line @lwc/lwc-internal/no-global-node
|
|
7677
|
+
|
|
7375
7678
|
const _Node$1 = Node;
|
|
7376
7679
|
const ConnectingSlot = new WeakMap();
|
|
7377
7680
|
const DisconnectingSlot = new WeakMap();
|
|
7681
|
+
|
|
7378
7682
|
function callNodeSlot(node, slot) {
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7683
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7684
|
+
assert.isTrue(node, `callNodeSlot() should not be called for a non-object`);
|
|
7685
|
+
}
|
|
7686
|
+
|
|
7687
|
+
const fn = slot.get(node);
|
|
7688
|
+
|
|
7689
|
+
if (!isUndefined$1(fn)) {
|
|
7690
|
+
fn(node);
|
|
7691
|
+
}
|
|
7692
|
+
|
|
7693
|
+
return node; // for convenience
|
|
7387
7694
|
}
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7695
|
+
|
|
7696
|
+
if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
7697
|
+
// Monkey patching Node methods to be able to detect the insertions and removal of root elements
|
|
7698
|
+
// created via createElement.
|
|
7699
|
+
const {
|
|
7700
|
+
appendChild,
|
|
7701
|
+
insertBefore,
|
|
7702
|
+
removeChild,
|
|
7703
|
+
replaceChild
|
|
7704
|
+
} = _Node$1.prototype;
|
|
7705
|
+
assign(_Node$1.prototype, {
|
|
7392
7706
|
appendChild(newChild) {
|
|
7393
|
-
|
|
7394
|
-
|
|
7707
|
+
const appendedNode = appendChild.call(this, newChild);
|
|
7708
|
+
return callNodeSlot(appendedNode, ConnectingSlot);
|
|
7395
7709
|
},
|
|
7710
|
+
|
|
7396
7711
|
insertBefore(newChild, referenceNode) {
|
|
7397
|
-
|
|
7398
|
-
|
|
7712
|
+
const insertedNode = insertBefore.call(this, newChild, referenceNode);
|
|
7713
|
+
return callNodeSlot(insertedNode, ConnectingSlot);
|
|
7399
7714
|
},
|
|
7715
|
+
|
|
7400
7716
|
removeChild(oldChild) {
|
|
7401
|
-
|
|
7402
|
-
|
|
7717
|
+
const removedNode = removeChild.call(this, oldChild);
|
|
7718
|
+
return callNodeSlot(removedNode, DisconnectingSlot);
|
|
7403
7719
|
},
|
|
7720
|
+
|
|
7404
7721
|
replaceChild(newChild, oldChild) {
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7409
|
-
}
|
|
7410
|
-
|
|
7722
|
+
const replacedNode = replaceChild.call(this, newChild, oldChild);
|
|
7723
|
+
callNodeSlot(replacedNode, DisconnectingSlot);
|
|
7724
|
+
callNodeSlot(newChild, ConnectingSlot);
|
|
7725
|
+
return replacedNode;
|
|
7726
|
+
}
|
|
7727
|
+
|
|
7728
|
+
});
|
|
7729
|
+
}
|
|
7411
7730
|
/**
|
|
7412
7731
|
* EXPERIMENTAL: This function is almost identical to document.createElement with the slightly
|
|
7413
7732
|
* difference that in the options, you can pass the `is` property set to a Constructor instead of
|
|
@@ -7419,38 +7738,50 @@ assign(_Node$1.prototype, {
|
|
|
7419
7738
|
* const el = createElement('x-foo', { is: FooCtor });
|
|
7420
7739
|
* ```
|
|
7421
7740
|
*/
|
|
7741
|
+
|
|
7742
|
+
|
|
7422
7743
|
function createElement(sel, options) {
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
|
|
7446
|
-
|
|
7447
|
-
|
|
7744
|
+
if (!isObject(options) || isNull(options)) {
|
|
7745
|
+
throw new TypeError(`"createElement" function expects an object as second parameter but received "${toString$1(options)}".`);
|
|
7746
|
+
}
|
|
7747
|
+
|
|
7748
|
+
const Ctor = options.is;
|
|
7749
|
+
|
|
7750
|
+
if (!isFunction$1(Ctor)) {
|
|
7751
|
+
throw new TypeError(`"createElement" function expects an "is" option with a valid component constructor.`);
|
|
7752
|
+
}
|
|
7753
|
+
|
|
7754
|
+
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
7755
|
+
let wasComponentUpgraded = false; // the custom element from the registry is expecting an upgrade callback
|
|
7756
|
+
|
|
7757
|
+
/**
|
|
7758
|
+
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
7759
|
+
* with a callback as the first argument, we could implement a more advanced
|
|
7760
|
+
* mechanism that only passes that argument if the constructor is known to be
|
|
7761
|
+
* an upgradable custom element.
|
|
7762
|
+
*/
|
|
7763
|
+
|
|
7764
|
+
const element = new UpgradableConstructor(elm => {
|
|
7765
|
+
createVM(elm, Ctor, renderer, {
|
|
7766
|
+
tagName: sel,
|
|
7767
|
+
mode: options.mode !== 'closed' ? 'open' : 'closed',
|
|
7768
|
+
owner: null
|
|
7448
7769
|
});
|
|
7449
|
-
|
|
7450
|
-
|
|
7451
|
-
|
|
7770
|
+
|
|
7771
|
+
if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
7772
|
+
ConnectingSlot.set(elm, connectRootElement);
|
|
7773
|
+
DisconnectingSlot.set(elm, disconnectRootElement);
|
|
7452
7774
|
}
|
|
7453
|
-
|
|
7775
|
+
|
|
7776
|
+
wasComponentUpgraded = true;
|
|
7777
|
+
});
|
|
7778
|
+
|
|
7779
|
+
if (!wasComponentUpgraded) {
|
|
7780
|
+
/* eslint-disable-next-line no-console */
|
|
7781
|
+
console.error(`Unexpected tag name "${sel}". This name is a registered custom element, preventing LWC to upgrade the element.`);
|
|
7782
|
+
}
|
|
7783
|
+
|
|
7784
|
+
return element;
|
|
7454
7785
|
}
|
|
7455
7786
|
|
|
7456
7787
|
/*
|
|
@@ -7484,7 +7815,7 @@ function isNodeShadowed(node) {
|
|
|
7484
7815
|
}
|
|
7485
7816
|
// TODO [#1252]: Old behavior that is still used by some pieces of the platform. Manually
|
|
7486
7817
|
// inserted nodes without the `lwc:dom=manual` directive will be considered as global elements.
|
|
7487
|
-
return isSyntheticShadowDefined && !isUndefined$1(node[KEY__SHADOW_RESOLVER]);
|
|
7818
|
+
return renderer.isSyntheticShadowDefined && !isUndefined$1(node[KEY__SHADOW_RESOLVER]);
|
|
7488
7819
|
}
|
|
7489
7820
|
|
|
7490
7821
|
/*
|
|
@@ -7521,6 +7852,6 @@ defineProperty(LightningElement, 'CustomElementConstructor', {
|
|
|
7521
7852
|
});
|
|
7522
7853
|
freeze(LightningElement);
|
|
7523
7854
|
seal(LightningElement.prototype);
|
|
7524
|
-
/* version: 2.23.
|
|
7855
|
+
/* version: 2.23.3 */
|
|
7525
7856
|
|
|
7526
|
-
export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, deprecatedBuildCustomElementConstructor as buildCustomElementConstructor, createContextProvider, createElement, freezeTemplate, getComponentConstructor, getComponentDef, hydrateComponent, isComponentConstructor, isNodeShadowed as isNodeFromTemplate, parseFragment, parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, renderer, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
|
|
7857
|
+
export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, deprecatedBuildCustomElementConstructor as buildCustomElementConstructor, createContextProvider, createElement, freezeTemplate, getComponentConstructor, getComponentDef, hydrateComponent, isComponentConstructor, isNodeShadowed as isNodeFromTemplate, parseFragment, parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, renderer, rendererFactory, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
|