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