lwc 2.25.1 → 2.27.0
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 +953 -431
- package/dist/engine-dom/iife/es2017/engine-dom.js +953 -431
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +797 -223
- package/dist/engine-dom/iife/es5/engine-dom.js +1025 -330
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +952 -241
- package/dist/engine-dom/umd/es2017/engine-dom.js +953 -431
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +797 -223
- package/dist/engine-dom/umd/es5/engine-dom.js +1025 -330
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +952 -241
- package/dist/engine-server/commonjs/es2017/engine-server.js +201 -247
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +201 -247
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +4 -4
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +4 -4
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +4 -4
- 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 +4 -4
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +4 -4
- 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
|
@@ -120,8 +120,10 @@ var LWC = (function (exports) {
|
|
|
120
120
|
setPrototypeOf = Object.setPrototypeOf;
|
|
121
121
|
var isArray$1 = Array.isArray;
|
|
122
122
|
var _Array$prototype = Array.prototype,
|
|
123
|
+
ArrayConcat$1 = _Array$prototype.concat,
|
|
123
124
|
ArrayCopyWithin = _Array$prototype.copyWithin,
|
|
124
125
|
ArrayFill = _Array$prototype.fill,
|
|
126
|
+
ArrayFilter = _Array$prototype.filter,
|
|
125
127
|
ArrayIndexOf = _Array$prototype.indexOf,
|
|
126
128
|
ArrayJoin = _Array$prototype.join,
|
|
127
129
|
ArrayMap = _Array$prototype.map,
|
|
@@ -365,9 +367,9 @@ var LWC = (function (exports) {
|
|
|
365
367
|
// Increment whenever the LWC template compiler changes
|
|
366
368
|
|
|
367
369
|
|
|
368
|
-
var LWC_VERSION = "2.
|
|
370
|
+
var LWC_VERSION = "2.27.0";
|
|
369
371
|
var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
370
|
-
/** version: 2.
|
|
372
|
+
/** version: 2.27.0 */
|
|
371
373
|
|
|
372
374
|
/**
|
|
373
375
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -461,7 +463,7 @@ var LWC = (function (exports) {
|
|
|
461
463
|
patch$1(propName);
|
|
462
464
|
}
|
|
463
465
|
}
|
|
464
|
-
/** version: 2.
|
|
466
|
+
/** version: 2.27.0 */
|
|
465
467
|
|
|
466
468
|
/**
|
|
467
469
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -479,7 +481,6 @@ var LWC = (function (exports) {
|
|
|
479
481
|
DUMMY_TEST_FLAG: null,
|
|
480
482
|
ENABLE_ELEMENT_PATCH: null,
|
|
481
483
|
ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
|
|
482
|
-
ENABLE_HMR: null,
|
|
483
484
|
ENABLE_HTML_COLLECTIONS_PATCH: null,
|
|
484
485
|
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
485
486
|
ENABLE_MIXED_SHADOW_MODE: null,
|
|
@@ -489,7 +490,8 @@ var LWC = (function (exports) {
|
|
|
489
490
|
ENABLE_REACTIVE_SETTER: null,
|
|
490
491
|
ENABLE_WIRE_SYNC_EMIT: null,
|
|
491
492
|
ENABLE_LIGHT_GET_ROOT_NODE_PATCH: null,
|
|
492
|
-
DISABLE_LIGHT_DOM_UNSCOPED_CSS: null
|
|
493
|
+
DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
|
|
494
|
+
ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null
|
|
493
495
|
};
|
|
494
496
|
|
|
495
497
|
if (!_globalThis.lwcRuntimeFlags) {
|
|
@@ -555,7 +557,7 @@ var LWC = (function (exports) {
|
|
|
555
557
|
setFeatureFlag(name, value);
|
|
556
558
|
}
|
|
557
559
|
}
|
|
558
|
-
/** version: 2.
|
|
560
|
+
/** version: 2.27.0 */
|
|
559
561
|
|
|
560
562
|
/*
|
|
561
563
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -2423,7 +2425,9 @@ var LWC = (function (exports) {
|
|
|
2423
2425
|
var LightningElement = function LightningElement() {
|
|
2424
2426
|
// This should be as performant as possible, while any initialization should be done lazily
|
|
2425
2427
|
if (isNull(vmBeingConstructed)) {
|
|
2426
|
-
|
|
2428
|
+
// Thrown when doing something like `new LightningElement()` or
|
|
2429
|
+
// `class Foo extends LightningElement {}; new Foo()`
|
|
2430
|
+
throw new TypeError('Illegal constructor');
|
|
2427
2431
|
}
|
|
2428
2432
|
|
|
2429
2433
|
var vm = vmBeingConstructed;
|
|
@@ -3787,13 +3791,11 @@ var LWC = (function (exports) {
|
|
|
3787
3791
|
throw new ReferenceError();
|
|
3788
3792
|
}
|
|
3789
3793
|
|
|
3790
|
-
|
|
3791
|
-
var visited = new Set();
|
|
3794
|
+
var visited = new Set();
|
|
3792
3795
|
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
}
|
|
3796
|
+
while (swappedTemplateMap.has(tpl) && !visited.has(tpl)) {
|
|
3797
|
+
visited.add(tpl);
|
|
3798
|
+
tpl = swappedTemplateMap.get(tpl);
|
|
3797
3799
|
}
|
|
3798
3800
|
|
|
3799
3801
|
return tpl;
|
|
@@ -3805,13 +3807,11 @@ var LWC = (function (exports) {
|
|
|
3805
3807
|
throw new ReferenceError();
|
|
3806
3808
|
}
|
|
3807
3809
|
|
|
3808
|
-
|
|
3809
|
-
var visited = new Set();
|
|
3810
|
+
var visited = new Set();
|
|
3810
3811
|
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
}
|
|
3812
|
+
while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {
|
|
3813
|
+
visited.add(Ctor);
|
|
3814
|
+
Ctor = swappedComponentMap.get(Ctor);
|
|
3815
3815
|
}
|
|
3816
3816
|
|
|
3817
3817
|
return Ctor;
|
|
@@ -3823,13 +3823,11 @@ var LWC = (function (exports) {
|
|
|
3823
3823
|
throw new ReferenceError();
|
|
3824
3824
|
}
|
|
3825
3825
|
|
|
3826
|
-
|
|
3827
|
-
var visited = new Set();
|
|
3826
|
+
var visited = new Set();
|
|
3828
3827
|
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
}
|
|
3828
|
+
while (swappedStyleMap.has(style) && !visited.has(style)) {
|
|
3829
|
+
visited.add(style);
|
|
3830
|
+
style = swappedStyleMap.get(style);
|
|
3833
3831
|
}
|
|
3834
3832
|
|
|
3835
3833
|
return style;
|
|
@@ -3839,56 +3837,54 @@ var LWC = (function (exports) {
|
|
|
3839
3837
|
if (process.env.NODE_ENV === 'production') {
|
|
3840
3838
|
// this method should never leak to prod
|
|
3841
3839
|
throw new ReferenceError();
|
|
3842
|
-
}
|
|
3840
|
+
} // tracking active component
|
|
3843
3841
|
|
|
3844
|
-
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
3845
|
-
// tracking active component
|
|
3846
|
-
var Ctor = vm.def.ctor;
|
|
3847
|
-
var componentVMs = activeComponents.get(Ctor);
|
|
3848
3842
|
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
activeComponents.set(Ctor, componentVMs);
|
|
3852
|
-
} // this will allow us to keep track of the hot components
|
|
3843
|
+
var Ctor = vm.def.ctor;
|
|
3844
|
+
var componentVMs = activeComponents.get(Ctor);
|
|
3853
3845
|
|
|
3846
|
+
if (isUndefined$1(componentVMs)) {
|
|
3847
|
+
componentVMs = new Set();
|
|
3848
|
+
activeComponents.set(Ctor, componentVMs);
|
|
3849
|
+
} // this will allow us to keep track of the hot components
|
|
3854
3850
|
|
|
3855
|
-
componentVMs.add(vm); // tracking active template
|
|
3856
3851
|
|
|
3857
|
-
|
|
3852
|
+
componentVMs.add(vm); // tracking active template
|
|
3858
3853
|
|
|
3859
|
-
|
|
3860
|
-
var templateVMs = activeTemplates.get(tpl);
|
|
3854
|
+
var tpl = vm.cmpTemplate;
|
|
3861
3855
|
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
activeTemplates.set(tpl, templateVMs);
|
|
3865
|
-
} // this will allow us to keep track of the templates that are
|
|
3866
|
-
// being used by a hot component
|
|
3856
|
+
if (tpl) {
|
|
3857
|
+
var templateVMs = activeTemplates.get(tpl);
|
|
3867
3858
|
|
|
3859
|
+
if (isUndefined$1(templateVMs)) {
|
|
3860
|
+
templateVMs = new Set();
|
|
3861
|
+
activeTemplates.set(tpl, templateVMs);
|
|
3862
|
+
} // this will allow us to keep track of the templates that are
|
|
3863
|
+
// being used by a hot component
|
|
3868
3864
|
|
|
3869
|
-
templateVMs.add(vm); // tracking active styles associated to template
|
|
3870
3865
|
|
|
3871
|
-
|
|
3866
|
+
templateVMs.add(vm); // tracking active styles associated to template
|
|
3872
3867
|
|
|
3873
|
-
|
|
3874
|
-
flattenStylesheets(stylesheets).forEach(function (stylesheet) {
|
|
3875
|
-
// this is necessary because we don't hold the list of styles
|
|
3876
|
-
// in the vm, we only hold the selected (already swapped template)
|
|
3877
|
-
// but the styles attached to the template might not be the actual
|
|
3878
|
-
// active ones, but the swapped versions of those.
|
|
3879
|
-
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
3880
|
-
var stylesheetVMs = activeStyles.get(stylesheet);
|
|
3868
|
+
var stylesheets = tpl.stylesheets;
|
|
3881
3869
|
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3870
|
+
if (!isUndefined$1(stylesheets)) {
|
|
3871
|
+
flattenStylesheets(stylesheets).forEach(function (stylesheet) {
|
|
3872
|
+
// this is necessary because we don't hold the list of styles
|
|
3873
|
+
// in the vm, we only hold the selected (already swapped template)
|
|
3874
|
+
// but the styles attached to the template might not be the actual
|
|
3875
|
+
// active ones, but the swapped versions of those.
|
|
3876
|
+
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
3877
|
+
var stylesheetVMs = activeStyles.get(stylesheet);
|
|
3887
3878
|
|
|
3879
|
+
if (isUndefined$1(stylesheetVMs)) {
|
|
3880
|
+
stylesheetVMs = new Set();
|
|
3881
|
+
activeStyles.set(stylesheet, stylesheetVMs);
|
|
3882
|
+
} // this will allow us to keep track of the stylesheet that are
|
|
3883
|
+
// being used by a hot component
|
|
3888
3884
|
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
}
|
|
3885
|
+
|
|
3886
|
+
stylesheetVMs.add(vm);
|
|
3887
|
+
});
|
|
3892
3888
|
}
|
|
3893
3889
|
}
|
|
3894
3890
|
}
|
|
@@ -3897,42 +3893,40 @@ var LWC = (function (exports) {
|
|
|
3897
3893
|
if (process.env.NODE_ENV === 'production') {
|
|
3898
3894
|
// this method should never leak to prod
|
|
3899
3895
|
throw new ReferenceError();
|
|
3900
|
-
}
|
|
3896
|
+
} // tracking inactive component
|
|
3901
3897
|
|
|
3902
|
-
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
3903
|
-
// tracking inactive component
|
|
3904
|
-
var Ctor = vm.def.ctor;
|
|
3905
|
-
var list = activeComponents.get(Ctor);
|
|
3906
3898
|
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
list.delete(vm);
|
|
3910
|
-
} // removing inactive template
|
|
3899
|
+
var Ctor = vm.def.ctor;
|
|
3900
|
+
var list = activeComponents.get(Ctor);
|
|
3911
3901
|
|
|
3902
|
+
if (!isUndefined$1(list)) {
|
|
3903
|
+
// deleting the vm from the set to avoid leaking memory
|
|
3904
|
+
list.delete(vm);
|
|
3905
|
+
} // removing inactive template
|
|
3912
3906
|
|
|
3913
|
-
var tpl = vm.cmpTemplate;
|
|
3914
3907
|
|
|
3915
|
-
|
|
3916
|
-
list = activeTemplates.get(tpl);
|
|
3908
|
+
var tpl = vm.cmpTemplate;
|
|
3917
3909
|
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
list.delete(vm);
|
|
3921
|
-
} // removing active styles associated to template
|
|
3910
|
+
if (tpl) {
|
|
3911
|
+
list = activeTemplates.get(tpl);
|
|
3922
3912
|
|
|
3913
|
+
if (!isUndefined$1(list)) {
|
|
3914
|
+
// deleting the vm from the set to avoid leaking memory
|
|
3915
|
+
list.delete(vm);
|
|
3916
|
+
} // removing active styles associated to template
|
|
3923
3917
|
|
|
3924
|
-
var styles = tpl.stylesheets;
|
|
3925
3918
|
|
|
3926
|
-
|
|
3927
|
-
flattenStylesheets(styles).forEach(function (style) {
|
|
3928
|
-
list = activeStyles.get(style);
|
|
3919
|
+
var styles = tpl.stylesheets;
|
|
3929
3920
|
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3921
|
+
if (!isUndefined$1(styles)) {
|
|
3922
|
+
flattenStylesheets(styles).forEach(function (style) {
|
|
3923
|
+
list = activeStyles.get(style);
|
|
3924
|
+
|
|
3925
|
+
if (!isUndefined$1(list)) {
|
|
3926
|
+
// deleting the vm from the set to avoid leaking memory
|
|
3927
|
+
list.delete(vm);
|
|
3928
|
+
}
|
|
3929
|
+
});
|
|
3936
3930
|
}
|
|
3937
3931
|
}
|
|
3938
3932
|
}
|
|
@@ -3947,10 +3941,6 @@ var LWC = (function (exports) {
|
|
|
3947
3941
|
}
|
|
3948
3942
|
}
|
|
3949
3943
|
|
|
3950
|
-
if (!lwcRuntimeFlags.ENABLE_HMR) {
|
|
3951
|
-
throw new Error('HMR is not enabled');
|
|
3952
|
-
}
|
|
3953
|
-
|
|
3954
3944
|
return false;
|
|
3955
3945
|
}
|
|
3956
3946
|
|
|
@@ -3964,10 +3954,6 @@ var LWC = (function (exports) {
|
|
|
3964
3954
|
}
|
|
3965
3955
|
}
|
|
3966
3956
|
|
|
3967
|
-
if (!lwcRuntimeFlags.ENABLE_HMR) {
|
|
3968
|
-
throw new Error('HMR is not enabled');
|
|
3969
|
-
}
|
|
3970
|
-
|
|
3971
3957
|
return false;
|
|
3972
3958
|
}
|
|
3973
3959
|
|
|
@@ -3979,10 +3965,6 @@ var LWC = (function (exports) {
|
|
|
3979
3965
|
return rehydrateHotStyle(oldStyle);
|
|
3980
3966
|
}
|
|
3981
3967
|
|
|
3982
|
-
if (!lwcRuntimeFlags.ENABLE_HMR) {
|
|
3983
|
-
throw new Error('HMR is not enabled');
|
|
3984
|
-
}
|
|
3985
|
-
|
|
3986
3968
|
return false;
|
|
3987
3969
|
}
|
|
3988
3970
|
/*
|
|
@@ -4448,14 +4430,17 @@ var LWC = (function (exports) {
|
|
|
4448
4430
|
/**
|
|
4449
4431
|
* This function returns the host style token for a custom element if it
|
|
4450
4432
|
* exists. Otherwise it returns null.
|
|
4433
|
+
*
|
|
4434
|
+
* A host style token is applied to the component if scoped styles are used.
|
|
4451
4435
|
*/
|
|
4452
4436
|
|
|
4453
4437
|
|
|
4454
4438
|
function getStylesheetTokenHost(vnode) {
|
|
4455
4439
|
var _getComponentInternal = getComponentInternalDef(vnode.ctor),
|
|
4456
|
-
|
|
4440
|
+
template = _getComponentInternal.template;
|
|
4457
4441
|
|
|
4458
|
-
|
|
4442
|
+
var stylesheetToken = template.stylesheetToken;
|
|
4443
|
+
return !isUndefined$1(stylesheetToken) && computeHasScopedStyles(template) ? makeHostToken(stylesheetToken) : null;
|
|
4459
4444
|
}
|
|
4460
4445
|
|
|
4461
4446
|
function getNearestNativeShadowComponent(vm) {
|
|
@@ -4504,84 +4489,6 @@ var LWC = (function (exports) {
|
|
|
4504
4489
|
|
|
4505
4490
|
return null;
|
|
4506
4491
|
}
|
|
4507
|
-
/*
|
|
4508
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
4509
|
-
* All rights reserved.
|
|
4510
|
-
* SPDX-License-Identifier: MIT
|
|
4511
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4512
|
-
*/
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
function checkHasVM(elm) {
|
|
4516
|
-
var hasVM = !isUndefined$1(getAssociatedVMIfPresent(elm));
|
|
4517
|
-
|
|
4518
|
-
if (process.env.NODE_ENV !== 'production' && !hasVM) {
|
|
4519
|
-
// Occurs when an element is manually created with the same tag name as an existing LWC component. In that case,
|
|
4520
|
-
// we skip calling the LWC connectedCallback/disconnectedCallback logic and log an error.
|
|
4521
|
-
logError("VM for tag name \"".concat(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.");
|
|
4522
|
-
}
|
|
4523
|
-
|
|
4524
|
-
return hasVM;
|
|
4525
|
-
}
|
|
4526
|
-
|
|
4527
|
-
function getUpgradableConstructor(tagName, renderer) {
|
|
4528
|
-
var getCustomElement = renderer.getCustomElement,
|
|
4529
|
-
RendererHTMLElement = renderer.HTMLElementExported,
|
|
4530
|
-
defineCustomElement = renderer.defineCustomElement; // Should never get a tag with upper case letter at this point, the compiler should
|
|
4531
|
-
// produce only tags with lowercase letters
|
|
4532
|
-
// But, for backwards compatibility, we will lower case the tagName
|
|
4533
|
-
|
|
4534
|
-
tagName = tagName.toLowerCase();
|
|
4535
|
-
var CE = getCustomElement(tagName);
|
|
4536
|
-
|
|
4537
|
-
if (!isUndefined$1(CE)) {
|
|
4538
|
-
return CE;
|
|
4539
|
-
}
|
|
4540
|
-
/**
|
|
4541
|
-
* LWC Upgradable Element reference to an element that was created
|
|
4542
|
-
* via the scoped registry mechanism, and that is ready to be upgraded.
|
|
4543
|
-
*/
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
CE = /*#__PURE__*/function (_RendererHTMLElement) {
|
|
4547
|
-
_inherits(LWCUpgradableElement, _RendererHTMLElement);
|
|
4548
|
-
|
|
4549
|
-
var _super5 = _createSuper(LWCUpgradableElement);
|
|
4550
|
-
|
|
4551
|
-
function LWCUpgradableElement(upgradeCallback) {
|
|
4552
|
-
var _this4;
|
|
4553
|
-
|
|
4554
|
-
_classCallCheck(this, LWCUpgradableElement);
|
|
4555
|
-
|
|
4556
|
-
_this4 = _super5.call(this);
|
|
4557
|
-
|
|
4558
|
-
if (isFunction$1(upgradeCallback)) {
|
|
4559
|
-
upgradeCallback(_assertThisInitialized(_this4)); // nothing to do with the result for now
|
|
4560
|
-
}
|
|
4561
|
-
|
|
4562
|
-
return _this4;
|
|
4563
|
-
}
|
|
4564
|
-
|
|
4565
|
-
return _createClass(LWCUpgradableElement);
|
|
4566
|
-
}(RendererHTMLElement);
|
|
4567
|
-
|
|
4568
|
-
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
4569
|
-
CE.prototype.connectedCallback = function () {
|
|
4570
|
-
if (checkHasVM(this)) {
|
|
4571
|
-
connectRootElement(this);
|
|
4572
|
-
}
|
|
4573
|
-
};
|
|
4574
|
-
|
|
4575
|
-
CE.prototype.disconnectedCallback = function () {
|
|
4576
|
-
if (checkHasVM(this)) {
|
|
4577
|
-
disconnectRootElement(this);
|
|
4578
|
-
}
|
|
4579
|
-
};
|
|
4580
|
-
}
|
|
4581
|
-
|
|
4582
|
-
defineCustomElement(tagName, CE);
|
|
4583
|
-
return CE;
|
|
4584
|
-
}
|
|
4585
4492
|
/*
|
|
4586
4493
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
4587
4494
|
* All rights reserved.
|
|
@@ -4608,6 +4515,12 @@ var LWC = (function (exports) {
|
|
|
4608
4515
|
/* VNodeType.CustomElement */
|
|
4609
4516
|
;
|
|
4610
4517
|
}
|
|
4518
|
+
|
|
4519
|
+
function isVScopedSlotFragment(vnode) {
|
|
4520
|
+
return vnode.type === 6
|
|
4521
|
+
/* VNodeType.ScopedSlotFragment */
|
|
4522
|
+
;
|
|
4523
|
+
}
|
|
4611
4524
|
/*
|
|
4612
4525
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
4613
4526
|
* All rights reserved.
|
|
@@ -5141,7 +5054,7 @@ var LWC = (function (exports) {
|
|
|
5141
5054
|
function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
5142
5055
|
var sel = vnode.sel,
|
|
5143
5056
|
owner = vnode.owner;
|
|
5144
|
-
var
|
|
5057
|
+
var createCustomElement = renderer.createCustomElement;
|
|
5145
5058
|
/**
|
|
5146
5059
|
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
5147
5060
|
* with a callback as the first argument, we could implement a more advanced
|
|
@@ -5150,10 +5063,25 @@ var LWC = (function (exports) {
|
|
|
5150
5063
|
*/
|
|
5151
5064
|
|
|
5152
5065
|
var vm;
|
|
5153
|
-
|
|
5066
|
+
|
|
5067
|
+
var upgradeCallback = function upgradeCallback(elm) {
|
|
5154
5068
|
// the custom element from the registry is expecting an upgrade callback
|
|
5155
5069
|
vm = createViewModelHook(elm, vnode, renderer);
|
|
5156
|
-
}
|
|
5070
|
+
};
|
|
5071
|
+
|
|
5072
|
+
var connectedCallback = function connectedCallback(elm) {
|
|
5073
|
+
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
5074
|
+
connectRootElement(elm);
|
|
5075
|
+
}
|
|
5076
|
+
};
|
|
5077
|
+
|
|
5078
|
+
var disconnectedCallback = function disconnectedCallback(elm) {
|
|
5079
|
+
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
5080
|
+
disconnectRootElement(elm);
|
|
5081
|
+
}
|
|
5082
|
+
};
|
|
5083
|
+
|
|
5084
|
+
var elm = createCustomElement(sel, upgradeCallback, connectedCallback, disconnectedCallback);
|
|
5157
5085
|
vnode.elm = elm;
|
|
5158
5086
|
vnode.vm = vm;
|
|
5159
5087
|
linkNodeToShadow(elm, owner, renderer);
|
|
@@ -5161,8 +5089,6 @@ var LWC = (function (exports) {
|
|
|
5161
5089
|
|
|
5162
5090
|
if (vm) {
|
|
5163
5091
|
allocateChildren(vnode, vm);
|
|
5164
|
-
} else if (vnode.ctor !== UpgradableConstructor) {
|
|
5165
|
-
throw new TypeError("Incorrect Component Constructor");
|
|
5166
5092
|
}
|
|
5167
5093
|
|
|
5168
5094
|
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
@@ -5449,7 +5375,7 @@ var LWC = (function (exports) {
|
|
|
5449
5375
|
/* RenderMode.Light */
|
|
5450
5376
|
) {
|
|
5451
5377
|
// slow path
|
|
5452
|
-
allocateInSlot(vm, children); // save the allocated children in case this vnode is reused.
|
|
5378
|
+
allocateInSlot(vm, children, vnode.owner); // save the allocated children in case this vnode is reused.
|
|
5453
5379
|
|
|
5454
5380
|
vnode.aChildren = children; // every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
|
|
5455
5381
|
|
|
@@ -5483,11 +5409,15 @@ var LWC = (function (exports) {
|
|
|
5483
5409
|
return vm;
|
|
5484
5410
|
}
|
|
5485
5411
|
|
|
5486
|
-
function allocateInSlot(vm, children) {
|
|
5487
|
-
var _a;
|
|
5412
|
+
function allocateInSlot(vm, children, owner) {
|
|
5413
|
+
var _a, _b;
|
|
5488
5414
|
|
|
5489
|
-
var
|
|
5490
|
-
var
|
|
5415
|
+
var oldSlotsMapping = vm.cmpSlots.slotAssignments;
|
|
5416
|
+
var cmpSlotsMapping = create(null);
|
|
5417
|
+
vm.cmpSlots = {
|
|
5418
|
+
owner: owner,
|
|
5419
|
+
slotAssignments: cmpSlotsMapping
|
|
5420
|
+
};
|
|
5491
5421
|
|
|
5492
5422
|
for (var _i15 = 0, len = children.length; _i15 < len; _i15 += 1) {
|
|
5493
5423
|
var vnode = children[_i15];
|
|
@@ -5499,19 +5429,21 @@ var LWC = (function (exports) {
|
|
|
5499
5429
|
var slotName = '';
|
|
5500
5430
|
|
|
5501
5431
|
if (isVBaseElement(vnode)) {
|
|
5502
|
-
slotName = ((_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot)
|
|
5432
|
+
slotName = (_b = (_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) !== null && _b !== void 0 ? _b : '';
|
|
5433
|
+
} else if (isVScopedSlotFragment(vnode)) {
|
|
5434
|
+
slotName = vnode.slotName;
|
|
5503
5435
|
}
|
|
5504
5436
|
|
|
5505
|
-
var vnodes =
|
|
5437
|
+
var vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
|
|
5506
5438
|
ArrayPush$1.call(vnodes, vnode);
|
|
5507
5439
|
}
|
|
5508
5440
|
|
|
5509
5441
|
if (isFalse(vm.isDirty)) {
|
|
5510
5442
|
// We need to determine if the old allocation is really different from the new one
|
|
5511
5443
|
// and mark the vm as dirty
|
|
5512
|
-
var oldKeys = keys(
|
|
5444
|
+
var oldKeys = keys(oldSlotsMapping);
|
|
5513
5445
|
|
|
5514
|
-
if (oldKeys.length !== keys(
|
|
5446
|
+
if (oldKeys.length !== keys(cmpSlotsMapping).length) {
|
|
5515
5447
|
markComponentAsDirty(vm);
|
|
5516
5448
|
return;
|
|
5517
5449
|
}
|
|
@@ -5519,15 +5451,15 @@ var LWC = (function (exports) {
|
|
|
5519
5451
|
for (var _i16 = 0, _len4 = oldKeys.length; _i16 < _len4; _i16 += 1) {
|
|
5520
5452
|
var key = oldKeys[_i16];
|
|
5521
5453
|
|
|
5522
|
-
if (isUndefined$1(
|
|
5454
|
+
if (isUndefined$1(cmpSlotsMapping[key]) || oldSlotsMapping[key].length !== cmpSlotsMapping[key].length) {
|
|
5523
5455
|
markComponentAsDirty(vm);
|
|
5524
5456
|
return;
|
|
5525
5457
|
}
|
|
5526
5458
|
|
|
5527
|
-
var oldVNodes =
|
|
5528
|
-
var _vnodes =
|
|
5459
|
+
var oldVNodes = oldSlotsMapping[key];
|
|
5460
|
+
var _vnodes = cmpSlotsMapping[key];
|
|
5529
5461
|
|
|
5530
|
-
for (var j = 0, a =
|
|
5462
|
+
for (var j = 0, a = cmpSlotsMapping[key].length; j < a; j += 1) {
|
|
5531
5463
|
if (oldVNodes[j] !== _vnodes[j]) {
|
|
5532
5464
|
markComponentAsDirty(vm);
|
|
5533
5465
|
return;
|
|
@@ -5726,6 +5658,21 @@ var LWC = (function (exports) {
|
|
|
5726
5658
|
|
|
5727
5659
|
function addVNodeToChildLWC(vnode) {
|
|
5728
5660
|
ArrayPush$1.call(getVMBeingRendered().velements, vnode);
|
|
5661
|
+
} // [s]coped [s]lot [f]actory
|
|
5662
|
+
|
|
5663
|
+
|
|
5664
|
+
function ssf(slotName, factory) {
|
|
5665
|
+
return {
|
|
5666
|
+
type: 6
|
|
5667
|
+
/* VNodeType.ScopedSlotFragment */
|
|
5668
|
+
,
|
|
5669
|
+
factory: factory,
|
|
5670
|
+
owner: getVMBeingRendered(),
|
|
5671
|
+
elm: undefined,
|
|
5672
|
+
sel: undefined,
|
|
5673
|
+
key: undefined,
|
|
5674
|
+
slotName: slotName
|
|
5675
|
+
};
|
|
5729
5676
|
} // [st]atic node
|
|
5730
5677
|
|
|
5731
5678
|
|
|
@@ -5829,8 +5776,29 @@ var LWC = (function (exports) {
|
|
|
5829
5776
|
assert.isTrue(isArray$1(children), "h() 3rd argument children must be an array.");
|
|
5830
5777
|
}
|
|
5831
5778
|
|
|
5832
|
-
if (!isUndefined$1(slotset) && !isUndefined$1(slotset[slotName]) && slotset[slotName].length !== 0) {
|
|
5833
|
-
children = slotset[slotName]
|
|
5779
|
+
if (!isUndefined$1(slotset) && !isUndefined$1(slotset.slotAssignments) && !isUndefined$1(slotset.slotAssignments[slotName]) && slotset.slotAssignments[slotName].length !== 0) {
|
|
5780
|
+
children = slotset.slotAssignments[slotName].reduce(function (acc, vnode) {
|
|
5781
|
+
// If the passed slot content is factory, evaluate it and use the produced vnodes
|
|
5782
|
+
if (vnode && isVScopedSlotFragment(vnode)) {
|
|
5783
|
+
var vmBeingRenderedInception = getVMBeingRendered();
|
|
5784
|
+
var _children = []; // Evaluate in the scope of the slot content's owner
|
|
5785
|
+
// if a slotset is provided, there will always be an owner. The only case where owner is
|
|
5786
|
+
// undefined is for root components, but root components cannot accept slotted content
|
|
5787
|
+
|
|
5788
|
+
setVMBeingRendered(slotset.owner);
|
|
5789
|
+
|
|
5790
|
+
try {
|
|
5791
|
+
_children = vnode.factory(data.slotData);
|
|
5792
|
+
} finally {
|
|
5793
|
+
setVMBeingRendered(vmBeingRenderedInception);
|
|
5794
|
+
}
|
|
5795
|
+
|
|
5796
|
+
return ArrayConcat$1.call(acc, _children);
|
|
5797
|
+
} else {
|
|
5798
|
+
// If the slot content is a static list of child nodes provided by the parent, nothing to do
|
|
5799
|
+
return ArrayConcat$1.call(acc, vnode);
|
|
5800
|
+
}
|
|
5801
|
+
}, []);
|
|
5834
5802
|
}
|
|
5835
5803
|
|
|
5836
5804
|
var vmBeingRendered = getVMBeingRendered();
|
|
@@ -6237,7 +6205,8 @@ var LWC = (function (exports) {
|
|
|
6237
6205
|
st: st,
|
|
6238
6206
|
gid: gid,
|
|
6239
6207
|
fid: fid,
|
|
6240
|
-
shc: shc
|
|
6208
|
+
shc: shc,
|
|
6209
|
+
ssf: ssf
|
|
6241
6210
|
});
|
|
6242
6211
|
/*
|
|
6243
6212
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6386,9 +6355,9 @@ var LWC = (function (exports) {
|
|
|
6386
6355
|
var _html$slots = html.slots,
|
|
6387
6356
|
slots = _html$slots === void 0 ? EmptyArray : _html$slots;
|
|
6388
6357
|
|
|
6389
|
-
for (var slotName in cmpSlots) {
|
|
6358
|
+
for (var slotName in cmpSlots.slotAssignments) {
|
|
6390
6359
|
// eslint-disable-next-line @lwc/lwc-internal/no-production-assert
|
|
6391
|
-
assert.isTrue(isArray$1(cmpSlots[slotName]), "Slots can only be set to an array, instead received ".concat(toString$1(cmpSlots[slotName]), " for slot \"").concat(slotName, "\" in ").concat(vm, "."));
|
|
6360
|
+
assert.isTrue(isArray$1(cmpSlots.slotAssignments[slotName]), "Slots can only be set to an array, instead received ".concat(toString$1(cmpSlots.slotAssignments[slotName]), " for slot \"").concat(slotName, "\" in ").concat(vm, "."));
|
|
6392
6361
|
|
|
6393
6362
|
if (slotName !== '' && ArrayIndexOf.call(slots, slotName) === -1) {
|
|
6394
6363
|
// TODO [#1297]: this should never really happen because the compiler should always validate
|
|
@@ -6985,7 +6954,9 @@ var LWC = (function (exports) {
|
|
|
6985
6954
|
velements: EmptyArray,
|
|
6986
6955
|
cmpProps: create(null),
|
|
6987
6956
|
cmpFields: create(null),
|
|
6988
|
-
cmpSlots:
|
|
6957
|
+
cmpSlots: {
|
|
6958
|
+
slotAssignments: create(null)
|
|
6959
|
+
},
|
|
6989
6960
|
oar: create(null),
|
|
6990
6961
|
cmpTemplate: null,
|
|
6991
6962
|
hydrated: Boolean(hydrated),
|
|
@@ -7506,21 +7477,21 @@ var LWC = (function (exports) {
|
|
|
7506
7477
|
var WireContextRegistrationEvent = /*#__PURE__*/function (_CustomEvent) {
|
|
7507
7478
|
_inherits(WireContextRegistrationEvent, _CustomEvent);
|
|
7508
7479
|
|
|
7509
|
-
var
|
|
7480
|
+
var _super5 = _createSuper(WireContextRegistrationEvent);
|
|
7510
7481
|
|
|
7511
7482
|
function WireContextRegistrationEvent(adapterToken, _ref3) {
|
|
7512
|
-
var
|
|
7483
|
+
var _this4;
|
|
7513
7484
|
|
|
7514
7485
|
var setNewContext = _ref3.setNewContext,
|
|
7515
7486
|
setDisconnectedCallback = _ref3.setDisconnectedCallback;
|
|
7516
7487
|
|
|
7517
7488
|
_classCallCheck(this, WireContextRegistrationEvent);
|
|
7518
7489
|
|
|
7519
|
-
|
|
7490
|
+
_this4 = _super5.call(this, adapterToken, {
|
|
7520
7491
|
bubbles: true,
|
|
7521
7492
|
composed: true
|
|
7522
7493
|
});
|
|
7523
|
-
defineProperties(_assertThisInitialized(
|
|
7494
|
+
defineProperties(_assertThisInitialized(_this4), {
|
|
7524
7495
|
setNewContext: {
|
|
7525
7496
|
value: setNewContext
|
|
7526
7497
|
},
|
|
@@ -7528,7 +7499,7 @@ var LWC = (function (exports) {
|
|
|
7528
7499
|
value: setDisconnectedCallback
|
|
7529
7500
|
}
|
|
7530
7501
|
});
|
|
7531
|
-
return
|
|
7502
|
+
return _this4;
|
|
7532
7503
|
}
|
|
7533
7504
|
|
|
7534
7505
|
return _createClass(WireContextRegistrationEvent);
|
|
@@ -8229,13 +8200,27 @@ var LWC = (function (exports) {
|
|
|
8229
8200
|
// Consequently, hydration mismatches will occur if scoped CSS token classnames
|
|
8230
8201
|
// are rendered during SSR. This needs to be accounted for when validating.
|
|
8231
8202
|
|
|
8232
|
-
if (scopedToken) {
|
|
8203
|
+
if (!isNull(scopedToken) || !isNull(stylesheetTokenHost)) {
|
|
8233
8204
|
if (!isUndefined$1(className)) {
|
|
8234
|
-
|
|
8205
|
+
// The order of the className should be scopedToken className stylesheetTokenHost
|
|
8206
|
+
var classTokens = [scopedToken, className, stylesheetTokenHost];
|
|
8207
|
+
var classNames = ArrayFilter.call(classTokens, function (token) {
|
|
8208
|
+
return !isNull(token);
|
|
8209
|
+
});
|
|
8210
|
+
className = ArrayJoin.call(classNames, ' ');
|
|
8235
8211
|
} else if (!isUndefined$1(classMap)) {
|
|
8236
|
-
classMap = Object.assign(Object.assign(Object.assign({}, classMap), _defineProperty({}, scopedToken, true)), isNull(stylesheetTokenHost) ?
|
|
8212
|
+
classMap = Object.assign(Object.assign(Object.assign({}, classMap), !isNull(scopedToken) ? _defineProperty({}, scopedToken, true) : {}), !isNull(stylesheetTokenHost) ? _defineProperty({}, stylesheetTokenHost, true) : {});
|
|
8237
8213
|
} else {
|
|
8238
|
-
|
|
8214
|
+
// The order of the className should be scopedToken stylesheetTokenHost
|
|
8215
|
+
var _classTokens = [scopedToken, stylesheetTokenHost];
|
|
8216
|
+
|
|
8217
|
+
var _classNames = ArrayFilter.call(_classTokens, function (token) {
|
|
8218
|
+
return !isNull(token);
|
|
8219
|
+
});
|
|
8220
|
+
|
|
8221
|
+
if (_classNames.length) {
|
|
8222
|
+
className = ArrayJoin.call(_classNames, ' ');
|
|
8223
|
+
}
|
|
8239
8224
|
}
|
|
8240
8225
|
}
|
|
8241
8226
|
|
|
@@ -8551,7 +8536,7 @@ var LWC = (function (exports) {
|
|
|
8551
8536
|
|
|
8552
8537
|
return ctor;
|
|
8553
8538
|
}
|
|
8554
|
-
/* version: 2.
|
|
8539
|
+
/* version: 2.27.0 */
|
|
8555
8540
|
|
|
8556
8541
|
/*
|
|
8557
8542
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -8711,6 +8696,779 @@ var LWC = (function (exports) {
|
|
|
8711
8696
|
insertLocalStylesheet(content, target);
|
|
8712
8697
|
}
|
|
8713
8698
|
}
|
|
8699
|
+
/*
|
|
8700
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
8701
|
+
* All rights reserved.
|
|
8702
|
+
* SPDX-License-Identifier: MIT
|
|
8703
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8704
|
+
*/
|
|
8705
|
+
|
|
8706
|
+
|
|
8707
|
+
function isCustomElementRegistryAvailable() {
|
|
8708
|
+
if (typeof customElements === 'undefined') {
|
|
8709
|
+
return false;
|
|
8710
|
+
}
|
|
8711
|
+
|
|
8712
|
+
try {
|
|
8713
|
+
// dereference HTMLElement global because babel wraps globals in compat mode with a
|
|
8714
|
+
// _wrapNativeSuper()
|
|
8715
|
+
// This is a problem because LWCUpgradableElement extends renderer.HTMLElement which does not
|
|
8716
|
+
// get wrapped by babel.
|
|
8717
|
+
var HTMLElementAlias = HTMLElement; // In case we use compat mode with a modern browser, the compat mode transformation
|
|
8718
|
+
// invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
|
|
8719
|
+
// which are not equipped to be initialized that way.
|
|
8720
|
+
|
|
8721
|
+
var clazz = /*#__PURE__*/function (_HTMLElementAlias) {
|
|
8722
|
+
_inherits(clazz, _HTMLElementAlias);
|
|
8723
|
+
|
|
8724
|
+
var _super6 = _createSuper(clazz);
|
|
8725
|
+
|
|
8726
|
+
function clazz() {
|
|
8727
|
+
_classCallCheck(this, clazz);
|
|
8728
|
+
|
|
8729
|
+
return _super6.apply(this, arguments);
|
|
8730
|
+
}
|
|
8731
|
+
|
|
8732
|
+
return _createClass(clazz);
|
|
8733
|
+
}(HTMLElementAlias);
|
|
8734
|
+
|
|
8735
|
+
customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
|
|
8736
|
+
new clazz();
|
|
8737
|
+
return true;
|
|
8738
|
+
} catch (_a) {
|
|
8739
|
+
return false;
|
|
8740
|
+
}
|
|
8741
|
+
}
|
|
8742
|
+
|
|
8743
|
+
var hasCustomElements = isCustomElementRegistryAvailable();
|
|
8744
|
+
/*
|
|
8745
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
8746
|
+
* All rights reserved.
|
|
8747
|
+
* SPDX-License-Identifier: MIT
|
|
8748
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8749
|
+
*/
|
|
8750
|
+
// Creates a custom element for compat (legacy) browser environments
|
|
8751
|
+
|
|
8752
|
+
var createCustomElementCompat = function createCustomElementCompat(tagName, upgradeCallback) {
|
|
8753
|
+
var elm = document.createElement(tagName);
|
|
8754
|
+
upgradeCallback(elm); // nothing to do with the result for now
|
|
8755
|
+
|
|
8756
|
+
return elm;
|
|
8757
|
+
};
|
|
8758
|
+
/*
|
|
8759
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
8760
|
+
* All rights reserved.
|
|
8761
|
+
* SPDX-License-Identifier: MIT
|
|
8762
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8763
|
+
*/
|
|
8764
|
+
|
|
8765
|
+
|
|
8766
|
+
var cachedConstructors = new Map();
|
|
8767
|
+
var elementsUpgradedOutsideLWC = new WeakSet();
|
|
8768
|
+
var elementBeingUpgradedByLWC = false; // Creates a constructor that is intended to be used as a vanilla custom element, except that the upgradeCallback is
|
|
8769
|
+
// passed in to the constructor so LWC can reuse the same custom element constructor for multiple components.
|
|
8770
|
+
// Another benefit is that only LWC can create components that actually do anything – if you do
|
|
8771
|
+
// `customElements.define('x-foo')`, then you don't have access to the upgradeCallback, so it's a dummy custom element.
|
|
8772
|
+
// This class should be created once per tag name.
|
|
8773
|
+
|
|
8774
|
+
var createUpgradableConstructor = function createUpgradableConstructor(_connectedCallback, _disconnectedCallback) {
|
|
8775
|
+
// TODO [#2972]: this class should expose observedAttributes as necessary
|
|
8776
|
+
return /*#__PURE__*/function (_HTMLElement) {
|
|
8777
|
+
_inherits(UpgradableConstructor, _HTMLElement);
|
|
8778
|
+
|
|
8779
|
+
var _super7 = _createSuper(UpgradableConstructor);
|
|
8780
|
+
|
|
8781
|
+
function UpgradableConstructor(upgradeCallback) {
|
|
8782
|
+
var _this5;
|
|
8783
|
+
|
|
8784
|
+
_classCallCheck(this, UpgradableConstructor);
|
|
8785
|
+
|
|
8786
|
+
_this5 = _super7.call(this); // If the element is not created using lwc.createElement(), e.g. `document.createElement('x-foo')`,
|
|
8787
|
+
// then elementBeingUpgraded will be false
|
|
8788
|
+
|
|
8789
|
+
if (elementBeingUpgradedByLWC) {
|
|
8790
|
+
upgradeCallback(_assertThisInitialized(_this5));
|
|
8791
|
+
} else {
|
|
8792
|
+
// keep track of elements that were not created by lwc.createElement,
|
|
8793
|
+
// so we can ignore their lifecycle hooks
|
|
8794
|
+
elementsUpgradedOutsideLWC.add(_assertThisInitialized(_this5)); // TODO [#2970]: LWC elements cannot be upgraded via new Ctor()
|
|
8795
|
+
// Do we want to support this? Throw an error? Currently for backwards compat it's a no-op.
|
|
8796
|
+
}
|
|
8797
|
+
|
|
8798
|
+
return _this5;
|
|
8799
|
+
}
|
|
8800
|
+
|
|
8801
|
+
_createClass(UpgradableConstructor, [{
|
|
8802
|
+
key: "connectedCallback",
|
|
8803
|
+
value: function connectedCallback() {
|
|
8804
|
+
if (!elementsUpgradedOutsideLWC.has(this)) {
|
|
8805
|
+
_connectedCallback(this);
|
|
8806
|
+
}
|
|
8807
|
+
}
|
|
8808
|
+
}, {
|
|
8809
|
+
key: "disconnectedCallback",
|
|
8810
|
+
value: function disconnectedCallback() {
|
|
8811
|
+
if (!elementsUpgradedOutsideLWC.has(this)) {
|
|
8812
|
+
_disconnectedCallback(this);
|
|
8813
|
+
}
|
|
8814
|
+
}
|
|
8815
|
+
}]);
|
|
8816
|
+
|
|
8817
|
+
return UpgradableConstructor;
|
|
8818
|
+
}( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
|
|
8819
|
+
};
|
|
8820
|
+
|
|
8821
|
+
var createCustomElementVanilla = function createCustomElementVanilla(tagName, upgradeCallback, connectedCallback, disconnectedCallback) {
|
|
8822
|
+
// use global custom elements registry
|
|
8823
|
+
var UpgradableConstructor = cachedConstructors.get(tagName);
|
|
8824
|
+
|
|
8825
|
+
if (isUndefined$1(UpgradableConstructor)) {
|
|
8826
|
+
if (!isUndefined$1(customElements.get(tagName))) {
|
|
8827
|
+
throw new Error("Unexpected tag name \"".concat(tagName, "\". This name is a registered custom element, preventing LWC to upgrade the element."));
|
|
8828
|
+
}
|
|
8829
|
+
|
|
8830
|
+
UpgradableConstructor = createUpgradableConstructor(connectedCallback, disconnectedCallback);
|
|
8831
|
+
customElements.define(tagName, UpgradableConstructor);
|
|
8832
|
+
cachedConstructors.set(tagName, UpgradableConstructor);
|
|
8833
|
+
}
|
|
8834
|
+
|
|
8835
|
+
elementBeingUpgradedByLWC = true;
|
|
8836
|
+
|
|
8837
|
+
try {
|
|
8838
|
+
return new UpgradableConstructor(upgradeCallback);
|
|
8839
|
+
} finally {
|
|
8840
|
+
elementBeingUpgradedByLWC = false;
|
|
8841
|
+
}
|
|
8842
|
+
};
|
|
8843
|
+
/*
|
|
8844
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
8845
|
+
* All rights reserved.
|
|
8846
|
+
* SPDX-License-Identifier: MIT
|
|
8847
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8848
|
+
*/
|
|
8849
|
+
|
|
8850
|
+
/**
|
|
8851
|
+
* Create a scoped registry, i.e. a function that can create custom elements whose tag names
|
|
8852
|
+
* do not conflict with vanilla custom elements having the same tag name.
|
|
8853
|
+
*/
|
|
8854
|
+
|
|
8855
|
+
|
|
8856
|
+
function createScopedRegistry() {
|
|
8857
|
+
if (!hasCustomElements) {
|
|
8858
|
+
// This code should never be reached, because we don't use the pivot registry if
|
|
8859
|
+
// custom elements are unavailable.
|
|
8860
|
+
throw new Error('Custom elements are not supported in this environment.');
|
|
8861
|
+
}
|
|
8862
|
+
|
|
8863
|
+
var _window = window,
|
|
8864
|
+
NativeHTMLElement = _window.HTMLElement;
|
|
8865
|
+
var _NativeHTMLElement$pr = NativeHTMLElement.prototype,
|
|
8866
|
+
nativeHasAttribute = _NativeHTMLElement$pr.hasAttribute,
|
|
8867
|
+
nativeSetAttribute = _NativeHTMLElement$pr.setAttribute,
|
|
8868
|
+
nativeRemoveAttribute = _NativeHTMLElement$pr.removeAttribute,
|
|
8869
|
+
nativeGetAttribute = _NativeHTMLElement$pr.getAttribute;
|
|
8870
|
+
var definitionForElement = new WeakMap();
|
|
8871
|
+
var pendingRegistryForElement = new WeakMap();
|
|
8872
|
+
var definitionForConstructor = new WeakMap();
|
|
8873
|
+
var registeredUserCtors = new WeakSet();
|
|
8874
|
+
var pivotCtorByTag = new Map();
|
|
8875
|
+
var globalDefinitionsByTag = new Map();
|
|
8876
|
+
var globalDefinitionsByClass = new Map();
|
|
8877
|
+
var awaitingUpgrade = new Map();
|
|
8878
|
+
var EMPTY_SET = new Set();
|
|
8879
|
+
|
|
8880
|
+
function createDefinitionRecord(constructor) {
|
|
8881
|
+
var _a;
|
|
8882
|
+
|
|
8883
|
+
var _constructor$prototyp = constructor.prototype,
|
|
8884
|
+
connectedCallback = _constructor$prototyp.connectedCallback,
|
|
8885
|
+
disconnectedCallback = _constructor$prototyp.disconnectedCallback,
|
|
8886
|
+
adoptedCallback = _constructor$prototyp.adoptedCallback,
|
|
8887
|
+
attributeChangedCallback = _constructor$prototyp.attributeChangedCallback;
|
|
8888
|
+
var observedAttributes = new Set((_a = constructor.observedAttributes) !== null && _a !== void 0 ? _a : []);
|
|
8889
|
+
return {
|
|
8890
|
+
UserCtor: constructor,
|
|
8891
|
+
PivotCtor: undefined,
|
|
8892
|
+
connectedCallback: connectedCallback,
|
|
8893
|
+
disconnectedCallback: disconnectedCallback,
|
|
8894
|
+
adoptedCallback: adoptedCallback,
|
|
8895
|
+
attributeChangedCallback: attributeChangedCallback,
|
|
8896
|
+
observedAttributes: observedAttributes
|
|
8897
|
+
};
|
|
8898
|
+
} // Helper to create stand-in element for each tagName registered that delegates out to the registry for the given
|
|
8899
|
+
// element. Note that the `registeredDefinition` represents the constructor that was used to register during
|
|
8900
|
+
// `customElements.define()`. Whereas the `pivotDefinition` represents the constructor that is passed when the pivot
|
|
8901
|
+
// constructor is invoked with another constructor.
|
|
8902
|
+
|
|
8903
|
+
|
|
8904
|
+
function createPivotingClass(tagName, registeredDefinition) {
|
|
8905
|
+
var PivotCtor = /*#__PURE__*/function (_NativeHTMLElement) {
|
|
8906
|
+
_inherits(PivotCtor, _NativeHTMLElement);
|
|
8907
|
+
|
|
8908
|
+
var _super8 = _createSuper(PivotCtor);
|
|
8909
|
+
|
|
8910
|
+
function PivotCtor(UserCtor) {
|
|
8911
|
+
var _this6;
|
|
8912
|
+
|
|
8913
|
+
_classCallCheck(this, PivotCtor);
|
|
8914
|
+
|
|
8915
|
+
// This constructor can only be invoked by:
|
|
8916
|
+
// a) the browser instantiating an element from parsing or via document.createElement.
|
|
8917
|
+
// b) LWC new PivotClass (This constructor is NOT observable/accessible in user-land).
|
|
8918
|
+
// b) new UserClass.
|
|
8919
|
+
// When LWC instantiates it, it will pass the upgrading definition as an argument
|
|
8920
|
+
// If the caller signals via UserCtor that this is in fact a controlled
|
|
8921
|
+
// definition, we use that one, otherwise fallback to the global
|
|
8922
|
+
// internal registry.
|
|
8923
|
+
_this6 = _super8.call(this);
|
|
8924
|
+
var userCtorIsDefined = !isUndefined$1(UserCtor);
|
|
8925
|
+
|
|
8926
|
+
if (userCtorIsDefined) {
|
|
8927
|
+
if (!isConstructor(UserCtor)) {
|
|
8928
|
+
throw new TypeError("Failed to create custom element: the provided constructor is not a constructor.");
|
|
8929
|
+
}
|
|
8930
|
+
|
|
8931
|
+
if (!registeredUserCtors.has(UserCtor)) {
|
|
8932
|
+
throw new Error("Failed to create custom element: the provided constructor is unregistered: ".concat(UserCtor.name, "."));
|
|
8933
|
+
}
|
|
8934
|
+
}
|
|
8935
|
+
|
|
8936
|
+
var definition = userCtorIsDefined ? getOrCreateDefinitionForConstructor(UserCtor) : globalDefinitionsByTag.get(tagName);
|
|
8937
|
+
|
|
8938
|
+
if (!isUndefined$1(definition)) {
|
|
8939
|
+
internalUpgrade(_assertThisInitialized(_this6), registeredDefinition, definition);
|
|
8940
|
+
} else {
|
|
8941
|
+
// This is the case in which there is no global definition, and
|
|
8942
|
+
// it is not handled by LWC (otherwise it will have a valid UserCtor)
|
|
8943
|
+
// so we need to add it to the pending queue just in case it eventually
|
|
8944
|
+
// gets defined in the global registry.
|
|
8945
|
+
pendingRegistryForElement.set(_assertThisInitialized(_this6), registeredDefinition);
|
|
8946
|
+
}
|
|
8947
|
+
|
|
8948
|
+
return _this6;
|
|
8949
|
+
}
|
|
8950
|
+
|
|
8951
|
+
_createClass(PivotCtor, [{
|
|
8952
|
+
key: "connectedCallback",
|
|
8953
|
+
value: function connectedCallback() {
|
|
8954
|
+
var _a;
|
|
8955
|
+
|
|
8956
|
+
var definition = definitionForElement.get(this);
|
|
8957
|
+
|
|
8958
|
+
if (!isUndefined$1(definition)) {
|
|
8959
|
+
// Delegate out to user callback
|
|
8960
|
+
(_a = definition.connectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
8961
|
+
} else {
|
|
8962
|
+
// Register for upgrade when defined (only when connected, so we don't leak)
|
|
8963
|
+
var awaiting = awaitingUpgrade.get(tagName);
|
|
8964
|
+
|
|
8965
|
+
if (isUndefined$1(awaiting)) {
|
|
8966
|
+
awaitingUpgrade.set(tagName, awaiting = new Set());
|
|
8967
|
+
}
|
|
8968
|
+
|
|
8969
|
+
awaiting.add(this);
|
|
8970
|
+
}
|
|
8971
|
+
}
|
|
8972
|
+
}, {
|
|
8973
|
+
key: "disconnectedCallback",
|
|
8974
|
+
value: function disconnectedCallback() {
|
|
8975
|
+
var _a;
|
|
8976
|
+
|
|
8977
|
+
var definition = definitionForElement.get(this);
|
|
8978
|
+
|
|
8979
|
+
if (!isUndefined$1(definition)) {
|
|
8980
|
+
// Delegate out to user callback
|
|
8981
|
+
(_a = definition.disconnectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
8982
|
+
} else {
|
|
8983
|
+
// Un-register for upgrade when defined (so we don't leak)
|
|
8984
|
+
var awaiting = awaitingUpgrade.get(tagName); // At this point, awaiting should never be undefined, because connectedCallback
|
|
8985
|
+
// must have been called before disconnectedCallback. But just to be safe, we check
|
|
8986
|
+
|
|
8987
|
+
if (!isUndefined$1(awaiting)) {
|
|
8988
|
+
awaiting.delete(this);
|
|
8989
|
+
}
|
|
8990
|
+
}
|
|
8991
|
+
}
|
|
8992
|
+
}, {
|
|
8993
|
+
key: "adoptedCallback",
|
|
8994
|
+
value: function adoptedCallback() {
|
|
8995
|
+
var _a;
|
|
8996
|
+
|
|
8997
|
+
var definition = definitionForElement.get(this);
|
|
8998
|
+
(_a = definition === null || definition === void 0 ? void 0 : definition.adoptedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
8999
|
+
}
|
|
9000
|
+
}, {
|
|
9001
|
+
key: "attributeChangedCallback",
|
|
9002
|
+
value: function attributeChangedCallback(name, oldValue, newValue) {
|
|
9003
|
+
var _a;
|
|
9004
|
+
|
|
9005
|
+
var definition = definitionForElement.get(this); // if both definitions are the same, then the observedAttributes is the same,
|
|
9006
|
+
// but if they are different, only if the runtime definition has the attribute
|
|
9007
|
+
// marked as observed, then it should invoke attributeChangedCallback.
|
|
9008
|
+
|
|
9009
|
+
if (registeredDefinition === definition || (definition === null || definition === void 0 ? void 0 : definition.observedAttributes.has(name))) {
|
|
9010
|
+
(_a = definition.attributeChangedCallback) === null || _a === void 0 ? void 0 : _a.apply(this, [name, oldValue, newValue]);
|
|
9011
|
+
}
|
|
9012
|
+
}
|
|
9013
|
+
}]);
|
|
9014
|
+
|
|
9015
|
+
return PivotCtor;
|
|
9016
|
+
}(NativeHTMLElement);
|
|
9017
|
+
|
|
9018
|
+
PivotCtor.observedAttributes = _toConsumableArray(registeredDefinition.observedAttributes);
|
|
9019
|
+
return PivotCtor;
|
|
9020
|
+
}
|
|
9021
|
+
|
|
9022
|
+
function getNewObservedAttributes(registeredDefinition, pivotDefinition) {
|
|
9023
|
+
var observedAttributes = pivotDefinition.observedAttributes,
|
|
9024
|
+
attributeChangedCallback = pivotDefinition.attributeChangedCallback;
|
|
9025
|
+
|
|
9026
|
+
if (observedAttributes.size === 0 || isUndefined$1(attributeChangedCallback)) {
|
|
9027
|
+
// This instance does not need to observe any attributes, no need to patch
|
|
9028
|
+
return EMPTY_SET;
|
|
9029
|
+
} // Natively, the attributes observed by the registered definition are going to be taken
|
|
9030
|
+
// care of by the browser, only the difference between the two sets has to be taken
|
|
9031
|
+
// care by the patched version.
|
|
9032
|
+
|
|
9033
|
+
|
|
9034
|
+
return new Set(_toConsumableArray(pivotDefinition.observedAttributes).filter(function (x) {
|
|
9035
|
+
return !registeredDefinition.observedAttributes.has(x);
|
|
9036
|
+
}));
|
|
9037
|
+
}
|
|
9038
|
+
|
|
9039
|
+
function throwAsyncError(error) {
|
|
9040
|
+
// Per native custom element behavior, errors thrown in attributeChangedCallback
|
|
9041
|
+
// become unhandled async errors. We use setTimeout() instead of Promise.resolve()
|
|
9042
|
+
// to make it an unhandled error rather than an unhandled rejection.
|
|
9043
|
+
setTimeout(function () {
|
|
9044
|
+
throw error;
|
|
9045
|
+
});
|
|
9046
|
+
} // Helper to patch `setAttribute`/`getAttribute` to implement `attributeChangedCallback`.
|
|
9047
|
+
// Why is this necessary? Well basically, you can't change the `observedAttributes` after
|
|
9048
|
+
// a custom element is defined. So with pivots, if two classes share the same tag name,
|
|
9049
|
+
// and the second class observes attributes that aren't observed by the first one,
|
|
9050
|
+
// then those attributes can never be observed by the native `observedAttributes` system.
|
|
9051
|
+
// So we have to simulate it by patching `getAttribute`/`removeAttribute`. Note that
|
|
9052
|
+
// we only do this when absolutely necessary, though; i.e. because we've determined
|
|
9053
|
+
// that we aren't observing the attributes we need to.
|
|
9054
|
+
|
|
9055
|
+
|
|
9056
|
+
function patchAttributes(instance, registeredDefinition, pivotDefinition) {
|
|
9057
|
+
var newObservedAttributes = getNewObservedAttributes(registeredDefinition, pivotDefinition);
|
|
9058
|
+
|
|
9059
|
+
if (newObservedAttributes.size === 0) {
|
|
9060
|
+
return;
|
|
9061
|
+
}
|
|
9062
|
+
|
|
9063
|
+
var attributeChangedCallback = pivotDefinition.attributeChangedCallback; // Patch the instance.
|
|
9064
|
+
// Note we use the native `getAttribute` rather than the super's `getAttribute` because
|
|
9065
|
+
// we don't actually want it to be observable that we're calling `getAttribute` from
|
|
9066
|
+
// `setAttribute` and `removeAttribute`.
|
|
9067
|
+
// TODO [#2994]: this should handle reflected properties such as `ariaLabel` and `role`.
|
|
9068
|
+
|
|
9069
|
+
defineProperties(instance, {
|
|
9070
|
+
setAttribute: {
|
|
9071
|
+
value: function setAttribute(name, value) {
|
|
9072
|
+
if (newObservedAttributes.has(name)) {
|
|
9073
|
+
var old = nativeGetAttribute.call(this, name);
|
|
9074
|
+
nativeSetAttribute.call(this, name, value);
|
|
9075
|
+
|
|
9076
|
+
try {
|
|
9077
|
+
attributeChangedCallback.call(this, name, old, value + '');
|
|
9078
|
+
} catch (error) {
|
|
9079
|
+
throwAsyncError(error);
|
|
9080
|
+
}
|
|
9081
|
+
} else {
|
|
9082
|
+
nativeSetAttribute.call(this, name, value);
|
|
9083
|
+
}
|
|
9084
|
+
},
|
|
9085
|
+
writable: true,
|
|
9086
|
+
enumerable: true,
|
|
9087
|
+
configurable: true
|
|
9088
|
+
},
|
|
9089
|
+
removeAttribute: {
|
|
9090
|
+
value: function removeAttribute(name) {
|
|
9091
|
+
if (newObservedAttributes.has(name)) {
|
|
9092
|
+
var old = nativeGetAttribute.call(this, name);
|
|
9093
|
+
nativeRemoveAttribute.call(this, name);
|
|
9094
|
+
|
|
9095
|
+
try {
|
|
9096
|
+
attributeChangedCallback.call(this, name, old, null);
|
|
9097
|
+
} catch (error) {
|
|
9098
|
+
throwAsyncError(error);
|
|
9099
|
+
}
|
|
9100
|
+
} else {
|
|
9101
|
+
nativeRemoveAttribute.call(this, name);
|
|
9102
|
+
}
|
|
9103
|
+
},
|
|
9104
|
+
writable: true,
|
|
9105
|
+
enumerable: true,
|
|
9106
|
+
configurable: true
|
|
9107
|
+
}
|
|
9108
|
+
});
|
|
9109
|
+
}
|
|
9110
|
+
|
|
9111
|
+
function patchAttributesDuringUpgrade(instance, registeredDefinition, pivotDefinition) {
|
|
9112
|
+
// The below case patches observed attributes for the case where the HTML element is upgraded
|
|
9113
|
+
// from a pre-existing one in the DOM.
|
|
9114
|
+
var newObservedAttributes = getNewObservedAttributes(registeredDefinition, pivotDefinition);
|
|
9115
|
+
|
|
9116
|
+
if (getNewObservedAttributes(registeredDefinition, pivotDefinition).size === 0) {
|
|
9117
|
+
return;
|
|
9118
|
+
}
|
|
9119
|
+
|
|
9120
|
+
var attributeChangedCallback = pivotDefinition.attributeChangedCallback; // Approximate observedAttributes from the user class, but only for the new observed attributes
|
|
9121
|
+
|
|
9122
|
+
newObservedAttributes.forEach(function (name) {
|
|
9123
|
+
if (nativeHasAttribute.call(instance, name)) {
|
|
9124
|
+
var newValue = nativeGetAttribute.call(instance, name);
|
|
9125
|
+
attributeChangedCallback.call(instance, name, null, newValue);
|
|
9126
|
+
}
|
|
9127
|
+
});
|
|
9128
|
+
} // User extends this HTMLElement, which returns the CE being upgraded
|
|
9129
|
+
|
|
9130
|
+
|
|
9131
|
+
var upgradingInstance; // Helper to upgrade an instance with a CE definition using "constructor call trick"
|
|
9132
|
+
|
|
9133
|
+
function internalUpgrade(instance, registeredDefinition, pivotDefinition) {
|
|
9134
|
+
setPrototypeOf(instance, pivotDefinition.UserCtor.prototype);
|
|
9135
|
+
definitionForElement.set(instance, pivotDefinition); // attributes patches when needed
|
|
9136
|
+
|
|
9137
|
+
if (pivotDefinition !== registeredDefinition) {
|
|
9138
|
+
patchAttributes(instance, registeredDefinition, pivotDefinition);
|
|
9139
|
+
} // Tricking the construction path to believe that a new instance is being created,
|
|
9140
|
+
// that way it will execute the super initialization mechanism but the HTMLElement
|
|
9141
|
+
// constructor will reuse the instance by returning the upgradingInstance.
|
|
9142
|
+
// This is by far the most important piece of the puzzle
|
|
9143
|
+
|
|
9144
|
+
|
|
9145
|
+
upgradingInstance = instance; // By `new`ing the UserCtor, we now jump to the constructor for the overridden global HTMLElement
|
|
9146
|
+
// The reason this happens is that the UserCtor extends HTMLElement, so it calls the `super()`.
|
|
9147
|
+
// Note that `upgradingInstance` is explicitly handled in the HTMLElement constructor.
|
|
9148
|
+
|
|
9149
|
+
new pivotDefinition.UserCtor();
|
|
9150
|
+
patchAttributesDuringUpgrade(instance, registeredDefinition, pivotDefinition);
|
|
9151
|
+
}
|
|
9152
|
+
|
|
9153
|
+
function isConstructor(constructor) {
|
|
9154
|
+
return isFunction$1(constructor) && isObject(constructor.prototype);
|
|
9155
|
+
}
|
|
9156
|
+
|
|
9157
|
+
function getOrCreateDefinitionForConstructor(constructor) {
|
|
9158
|
+
if (!isConstructor(constructor)) {
|
|
9159
|
+
throw new TypeError('The referenced constructor is not a constructor.');
|
|
9160
|
+
}
|
|
9161
|
+
|
|
9162
|
+
var definition = definitionForConstructor.get(constructor);
|
|
9163
|
+
|
|
9164
|
+
if (!isUndefined$1(definition)) {
|
|
9165
|
+
return definition;
|
|
9166
|
+
}
|
|
9167
|
+
|
|
9168
|
+
return createDefinitionRecord(constructor);
|
|
9169
|
+
}
|
|
9170
|
+
|
|
9171
|
+
var _window2 = window,
|
|
9172
|
+
nativeRegistry = _window2.customElements;
|
|
9173
|
+
var nativeDefine = nativeRegistry.define,
|
|
9174
|
+
nativeWhenDefined = nativeRegistry.whenDefined,
|
|
9175
|
+
nativeGet = nativeRegistry.get; // patch for the global registry define mechanism
|
|
9176
|
+
|
|
9177
|
+
CustomElementRegistry.prototype.define = function define(tagName, constructor, options) {
|
|
9178
|
+
if (options && options.extends) {
|
|
9179
|
+
// TODO [#2983]: should we support `extends`?
|
|
9180
|
+
throw new DOMException('NotSupportedError: "extends" key in customElements.define() options is not supported.');
|
|
9181
|
+
}
|
|
9182
|
+
|
|
9183
|
+
if (globalDefinitionsByTag.has(tagName)) {
|
|
9184
|
+
throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': the name \"".concat(tagName, "\" has already been used with this registry"));
|
|
9185
|
+
}
|
|
9186
|
+
|
|
9187
|
+
if (!isUndefined$1(globalDefinitionsByClass.get(constructor))) {
|
|
9188
|
+
throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': this constructor has already been used with this registry");
|
|
9189
|
+
}
|
|
9190
|
+
|
|
9191
|
+
var definition = getOrCreateDefinitionForConstructor(constructor);
|
|
9192
|
+
registeredUserCtors.add(constructor);
|
|
9193
|
+
var PivotCtor = pivotCtorByTag.get(tagName);
|
|
9194
|
+
|
|
9195
|
+
if (isUndefined$1(PivotCtor)) {
|
|
9196
|
+
PivotCtor = createPivotingClass(tagName, definition); // Register a pivoting class which will handle global registry initializations
|
|
9197
|
+
|
|
9198
|
+
nativeDefine.call(nativeRegistry, tagName, PivotCtor);
|
|
9199
|
+
} // Only cache after nativeDefine has been called, because if it throws an error
|
|
9200
|
+
// (e.g. for an invalid tag name), then we don't want to cache anything.
|
|
9201
|
+
|
|
9202
|
+
|
|
9203
|
+
definitionForConstructor.set(constructor, definition);
|
|
9204
|
+
pivotCtorByTag.set(tagName, PivotCtor);
|
|
9205
|
+
globalDefinitionsByTag.set(tagName, definition);
|
|
9206
|
+
globalDefinitionsByClass.set(constructor, definition); // For globally defined custom elements, the definition associated
|
|
9207
|
+
// to the UserCtor has a back-pointer to PivotCtor in case the user
|
|
9208
|
+
// new the UserCtor, so we know how to create the underlying element.
|
|
9209
|
+
|
|
9210
|
+
definition.PivotCtor = PivotCtor; // Upgrade any elements created in this scope before customElements.define
|
|
9211
|
+
// was called, which should be exhibited by the following steps:
|
|
9212
|
+
// 1) LWC registers a tagName for an LWC component.
|
|
9213
|
+
// 2) Element with same tagName is created with document.createElement()
|
|
9214
|
+
// and inserted into DOM.
|
|
9215
|
+
// 3) customElements.define() is called with tagName and non-LWC constructor.
|
|
9216
|
+
// This requires immediate upgrade when the new global tagName is defined.
|
|
9217
|
+
|
|
9218
|
+
var awaiting = awaitingUpgrade.get(tagName);
|
|
9219
|
+
|
|
9220
|
+
if (!isUndefined$1(awaiting)) {
|
|
9221
|
+
awaitingUpgrade.delete(tagName);
|
|
9222
|
+
|
|
9223
|
+
var _iterator6 = _createForOfIteratorHelper(awaiting),
|
|
9224
|
+
_step6;
|
|
9225
|
+
|
|
9226
|
+
try {
|
|
9227
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
9228
|
+
var element = _step6.value;
|
|
9229
|
+
var registeredDefinition = pendingRegistryForElement.get(element); // At this point, registeredDefinition should never be undefined because awaitingUpgrade
|
|
9230
|
+
// is only populated when we haven't run internalUpgrade yet, and we only populate
|
|
9231
|
+
// pendingRegistryForElement when internalUpgrade hasn't run yet.
|
|
9232
|
+
// But just to be safe, we check.
|
|
9233
|
+
|
|
9234
|
+
if (!isUndefined$1(registeredDefinition)) {
|
|
9235
|
+
pendingRegistryForElement.delete(element);
|
|
9236
|
+
internalUpgrade(element, registeredDefinition, definition);
|
|
9237
|
+
}
|
|
9238
|
+
}
|
|
9239
|
+
} catch (err) {
|
|
9240
|
+
_iterator6.e(err);
|
|
9241
|
+
} finally {
|
|
9242
|
+
_iterator6.f();
|
|
9243
|
+
}
|
|
9244
|
+
}
|
|
9245
|
+
};
|
|
9246
|
+
|
|
9247
|
+
CustomElementRegistry.prototype.get = function get(tagName) {
|
|
9248
|
+
var NativeCtor = nativeGet.call(nativeRegistry, tagName);
|
|
9249
|
+
|
|
9250
|
+
if (!isUndefined$1(NativeCtor)) {
|
|
9251
|
+
var definition = globalDefinitionsByTag.get(tagName);
|
|
9252
|
+
|
|
9253
|
+
if (!isUndefined$1(definition)) {
|
|
9254
|
+
return definition.UserCtor; // defined by the patched custom elements registry
|
|
9255
|
+
} // TODO [#3073]: return undefined rather than the pivot constructor (NativeCtor)
|
|
9256
|
+
|
|
9257
|
+
|
|
9258
|
+
return NativeCtor; // return the pivot constructor or constructor that existed before patching
|
|
9259
|
+
}
|
|
9260
|
+
};
|
|
9261
|
+
|
|
9262
|
+
CustomElementRegistry.prototype.whenDefined = function whenDefined(tagName) {
|
|
9263
|
+
return nativeWhenDefined.call(nativeRegistry, tagName).then(function (NativeCtor) {
|
|
9264
|
+
var definition = globalDefinitionsByTag.get(tagName);
|
|
9265
|
+
|
|
9266
|
+
if (!isUndefined$1(definition)) {
|
|
9267
|
+
return definition.UserCtor;
|
|
9268
|
+
} // TODO [#3073]: return undefined rather than the pivot constructor (NativeCtor)
|
|
9269
|
+
// In this case, the custom element must have been defined before the registry patches
|
|
9270
|
+
// were applied. So return the non-pivot constructor
|
|
9271
|
+
|
|
9272
|
+
|
|
9273
|
+
if (isUndefined$1(NativeCtor)) {
|
|
9274
|
+
// Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1335247
|
|
9275
|
+
// We can patch the correct behavior using customElements.get()
|
|
9276
|
+
return nativeGet.call(nativeRegistry, tagName);
|
|
9277
|
+
}
|
|
9278
|
+
|
|
9279
|
+
return NativeCtor;
|
|
9280
|
+
});
|
|
9281
|
+
}; // This constructor is invoked when we call `new pivotDefinition.UserCtor()`
|
|
9282
|
+
// @ts-ignore
|
|
9283
|
+
|
|
9284
|
+
|
|
9285
|
+
window.HTMLElement = function HTMLElement() {
|
|
9286
|
+
// Upgrading case: the pivoting class constructor was run by the browser's
|
|
9287
|
+
// native custom elements and we're in the process of running the
|
|
9288
|
+
// "constructor-call trick" on the natively constructed instance, so just
|
|
9289
|
+
// return that here.
|
|
9290
|
+
// This code path is also called when LWC `new`s a PivotCtor.
|
|
9291
|
+
var instance = upgradingInstance;
|
|
9292
|
+
|
|
9293
|
+
if (!isUndefined$1(instance)) {
|
|
9294
|
+
upgradingInstance = undefined;
|
|
9295
|
+
return instance;
|
|
9296
|
+
} // Construction case: we need to construct the pivoting instance and return it.
|
|
9297
|
+
// This is possible when the user register it via global registry and instantiate
|
|
9298
|
+
// it via `new Ctor()`.
|
|
9299
|
+
|
|
9300
|
+
|
|
9301
|
+
var constructor = this.constructor;
|
|
9302
|
+
var definition = globalDefinitionsByClass.get(constructor);
|
|
9303
|
+
|
|
9304
|
+
if (isUndefined$1(definition) || isUndefined$1(definition.PivotCtor)) {
|
|
9305
|
+
// This code path is hit if someone `new`s a class that extends `HTMLElement` without
|
|
9306
|
+
// doing `customElements.define()` first. This matches native browser behavior:
|
|
9307
|
+
// https://stackoverflow.com/a/61883392
|
|
9308
|
+
throw new TypeError('Illegal constructor');
|
|
9309
|
+
} // This constructor is ONLY invoked when it is the user instantiating
|
|
9310
|
+
// an element via new Ctor while Ctor is a registered global constructor.
|
|
9311
|
+
|
|
9312
|
+
|
|
9313
|
+
var PivotCtor = definition.PivotCtor,
|
|
9314
|
+
UserCtor = definition.UserCtor;
|
|
9315
|
+
return new PivotCtor(UserCtor);
|
|
9316
|
+
};
|
|
9317
|
+
|
|
9318
|
+
HTMLElement.prototype = NativeHTMLElement.prototype;
|
|
9319
|
+
/**
|
|
9320
|
+
* Create a new PivotConstructor for the given tagName, which is capable of being constructed
|
|
9321
|
+
* with a UserConstructor defining the behavior. Passing in the UserConstructor here
|
|
9322
|
+
* is a hint that can be used when registering a custom element with the global custom elements
|
|
9323
|
+
* registry for the first time, which provides certain optimizations. It also marks the UserConstructor
|
|
9324
|
+
* as "safe" to be used when passed in to a PivotConstructor.
|
|
9325
|
+
*
|
|
9326
|
+
* @param tagName - element tag name
|
|
9327
|
+
* @param UserCtor - userland custom element constructor
|
|
9328
|
+
* @returns a new custom element constructor
|
|
9329
|
+
*/
|
|
9330
|
+
|
|
9331
|
+
return function createPivotConstructor(tagName, UserCtor) {
|
|
9332
|
+
tagName = StringToLowerCase.call(tagName);
|
|
9333
|
+
var PivotCtor = pivotCtorByTag.get(tagName);
|
|
9334
|
+
|
|
9335
|
+
if (isUndefined$1(PivotCtor)) {
|
|
9336
|
+
var definition = getOrCreateDefinitionForConstructor(UserCtor);
|
|
9337
|
+
PivotCtor = createPivotingClass(tagName, definition); // Register a pivoting class as a global custom element
|
|
9338
|
+
|
|
9339
|
+
nativeDefine.call(nativeRegistry, tagName, PivotCtor);
|
|
9340
|
+
definition.PivotCtor = PivotCtor; // Only cache after nativeDefine has been called, because if it throws an error
|
|
9341
|
+
// (e.g. for an invalid tag name), then we don't want to cache anything.
|
|
9342
|
+
|
|
9343
|
+
definitionForConstructor.set(UserCtor, definition);
|
|
9344
|
+
pivotCtorByTag.set(tagName, PivotCtor);
|
|
9345
|
+
} // Register a UserConstructor as "safe" to be used within a PivotConstructor
|
|
9346
|
+
|
|
9347
|
+
|
|
9348
|
+
registeredUserCtors.add(UserCtor);
|
|
9349
|
+
return PivotCtor;
|
|
9350
|
+
};
|
|
9351
|
+
}
|
|
9352
|
+
/*
|
|
9353
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
9354
|
+
* All rights reserved.
|
|
9355
|
+
* SPDX-License-Identifier: MIT
|
|
9356
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
9357
|
+
*/
|
|
9358
|
+
|
|
9359
|
+
|
|
9360
|
+
var createScopedConstructor;
|
|
9361
|
+
var CachedHTMLElement; // We only call `createScopedRegistry()` if the browser supports custom elements and
|
|
9362
|
+
// ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is enabled, because we don't want to patch eagerly if the flag is disabled
|
|
9363
|
+
// or we're in a legacy browser.
|
|
9364
|
+
|
|
9365
|
+
if (lwcRuntimeFlags.ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY) {
|
|
9366
|
+
if (hasCustomElements) {
|
|
9367
|
+
// If ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is true, then we eagerly initialize the scoped registry.
|
|
9368
|
+
// It's assumed that ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is set *before* LWC loads, and never changes.
|
|
9369
|
+
//
|
|
9370
|
+
// Why not lazily patch in `createCustomElement`? Well, this could lead to subtle bugs, e.g.:
|
|
9371
|
+
//
|
|
9372
|
+
// 1. LWC loads
|
|
9373
|
+
// 2. `const Ctor = class extends HTMLElement {}`
|
|
9374
|
+
// 3. `lwc.createElement(...)` // here we lazily patch
|
|
9375
|
+
// 4. `customElements.define('x-foo', Ctor)` // throws error because class is bound to stale HTMLElement
|
|
9376
|
+
//
|
|
9377
|
+
// To reduce the risk of this, it's safer to patch the registry eagerly.
|
|
9378
|
+
createScopedConstructor = createScopedRegistry(); // It's important to cache window.HTMLElement here. Otherwise, someone else could overwrite window.HTMLElement (e.g.
|
|
9379
|
+
// another copy of the engine, or another scoping implementation) and we would get "Illegal constructor" errors
|
|
9380
|
+
// because the HTMLElement prototypes are mixed up.
|
|
9381
|
+
//
|
|
9382
|
+
// The reason this happens is that the scoping implementation overwrites window.HTMLElement and expects to work
|
|
9383
|
+
// with that version of HTMLElement. So if you load two copies of the scoping implementation in the same environment,
|
|
9384
|
+
// the second one may accidentally grab window.HTMLElement from the first (when doing `class extends HTMLElement`).
|
|
9385
|
+
// Caching avoids this problem.
|
|
9386
|
+
|
|
9387
|
+
CachedHTMLElement = window.HTMLElement;
|
|
9388
|
+
}
|
|
9389
|
+
} // Creates a constructor that is intended to be used as the UserConstructor in a scoped (pivots) registry.
|
|
9390
|
+
// In this case, the upgradeCallback only needs to be defined once because we create these on-demand,
|
|
9391
|
+
// multiple times per tag name.
|
|
9392
|
+
|
|
9393
|
+
|
|
9394
|
+
var createUserConstructor = function createUserConstructor(upgradeCallback, _connectedCallback2, _disconnectedCallback2, HTMLElementToExtend) {
|
|
9395
|
+
// TODO [#2972]: this class should expose observedAttributes as necessary
|
|
9396
|
+
return /*#__PURE__*/function (_HTMLElementToExtend) {
|
|
9397
|
+
_inherits(UserConstructor, _HTMLElementToExtend);
|
|
9398
|
+
|
|
9399
|
+
var _super9 = _createSuper(UserConstructor);
|
|
9400
|
+
|
|
9401
|
+
function UserConstructor() {
|
|
9402
|
+
var _this7;
|
|
9403
|
+
|
|
9404
|
+
_classCallCheck(this, UserConstructor);
|
|
9405
|
+
|
|
9406
|
+
_this7 = _super9.call(this);
|
|
9407
|
+
upgradeCallback(_assertThisInitialized(_this7));
|
|
9408
|
+
return _this7;
|
|
9409
|
+
}
|
|
9410
|
+
|
|
9411
|
+
_createClass(UserConstructor, [{
|
|
9412
|
+
key: "connectedCallback",
|
|
9413
|
+
value: function connectedCallback() {
|
|
9414
|
+
_connectedCallback2(this);
|
|
9415
|
+
}
|
|
9416
|
+
}, {
|
|
9417
|
+
key: "disconnectedCallback",
|
|
9418
|
+
value: function disconnectedCallback() {
|
|
9419
|
+
_disconnectedCallback2(this);
|
|
9420
|
+
}
|
|
9421
|
+
}]);
|
|
9422
|
+
|
|
9423
|
+
return UserConstructor;
|
|
9424
|
+
}(HTMLElementToExtend);
|
|
9425
|
+
};
|
|
9426
|
+
|
|
9427
|
+
function createCustomElementScoped(tagName, upgradeCallback, connectedCallback, disconnectedCallback) {
|
|
9428
|
+
if (isUndefined$1(createScopedConstructor) || isUndefined$1(CachedHTMLElement)) {
|
|
9429
|
+
// This error should be impossible to hit
|
|
9430
|
+
throw new Error('The flag ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY must be set to true to use this feature');
|
|
9431
|
+
}
|
|
9432
|
+
|
|
9433
|
+
var UserConstructor = createUserConstructor(upgradeCallback, connectedCallback, disconnectedCallback, CachedHTMLElement);
|
|
9434
|
+
var ScopedConstructor = createScopedConstructor(tagName, UserConstructor);
|
|
9435
|
+
return new ScopedConstructor(UserConstructor);
|
|
9436
|
+
}
|
|
9437
|
+
/*
|
|
9438
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
9439
|
+
* All rights reserved.
|
|
9440
|
+
* SPDX-License-Identifier: MIT
|
|
9441
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
9442
|
+
*/
|
|
9443
|
+
|
|
9444
|
+
/**
|
|
9445
|
+
* We have three modes for creating custom elements:
|
|
9446
|
+
*
|
|
9447
|
+
* 1. Compat (legacy) browser support (e.g. IE11). Totally custom, doesn't rely on native browser APIs.
|
|
9448
|
+
* 2. "Vanilla" custom elements registry. This system actually still allows us to have two LWC components with the
|
|
9449
|
+
* same tag name, via a simple trick: every custom element constructor we define in the registry is basically
|
|
9450
|
+
* the same. It's essentially a dummy `class extends HTMLElement` that accepts an `upgradeCallback` in its
|
|
9451
|
+
* constructor, which allows us to have completely customized functionality for different components.
|
|
9452
|
+
* 3. "Scoped" (or "pivot") custom elements. This relies on a sophisticated system that emulates the "scoped custom
|
|
9453
|
+
* elements registry" proposal, with support for avoiding conflicts in tag names both between LWC components and
|
|
9454
|
+
* between LWC components and third-party elements. This uses a similar trick to #2, but is much more complex
|
|
9455
|
+
* because it must patch the global `customElements` and `HTMLElement` objects.
|
|
9456
|
+
*/
|
|
9457
|
+
|
|
9458
|
+
|
|
9459
|
+
var createCustomElement;
|
|
9460
|
+
|
|
9461
|
+
if (hasCustomElements) {
|
|
9462
|
+
if (lwcRuntimeFlags.ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY) {
|
|
9463
|
+
createCustomElement = createCustomElementScoped;
|
|
9464
|
+
} else {
|
|
9465
|
+
// use global custom elements registry (vanilla)
|
|
9466
|
+
createCustomElement = createCustomElementVanilla;
|
|
9467
|
+
}
|
|
9468
|
+
} else {
|
|
9469
|
+
// no registry available here
|
|
9470
|
+
createCustomElement = createCustomElementCompat;
|
|
9471
|
+
}
|
|
8714
9472
|
/*
|
|
8715
9473
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
8716
9474
|
* All rights reserved.
|
|
@@ -8779,7 +9537,7 @@ var LWC = (function (exports) {
|
|
|
8779
9537
|
function isNull(obj) {
|
|
8780
9538
|
return obj === null;
|
|
8781
9539
|
}
|
|
8782
|
-
/** version: 2.
|
|
9540
|
+
/** version: 2.27.0 */
|
|
8783
9541
|
|
|
8784
9542
|
/*
|
|
8785
9543
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -8789,87 +9547,6 @@ var LWC = (function (exports) {
|
|
|
8789
9547
|
*/
|
|
8790
9548
|
|
|
8791
9549
|
|
|
8792
|
-
exports.getCustomElement = void 0;
|
|
8793
|
-
exports.defineCustomElement = void 0;
|
|
8794
|
-
var HTMLElementConstructor;
|
|
8795
|
-
|
|
8796
|
-
function isCustomElementRegistryAvailable() {
|
|
8797
|
-
if (typeof customElements === 'undefined') {
|
|
8798
|
-
return false;
|
|
8799
|
-
}
|
|
8800
|
-
|
|
8801
|
-
try {
|
|
8802
|
-
// dereference HTMLElement global because babel wraps globals in compat mode with a
|
|
8803
|
-
// _wrapNativeSuper()
|
|
8804
|
-
// This is a problem because LWCUpgradableElement extends renderer.HTMLElementExported which does not
|
|
8805
|
-
// get wrapped by babel.
|
|
8806
|
-
var HTMLElementAlias = HTMLElement; // In case we use compat mode with a modern browser, the compat mode transformation
|
|
8807
|
-
// invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
|
|
8808
|
-
// which are not equipped to be initialized that way.
|
|
8809
|
-
|
|
8810
|
-
var clazz = /*#__PURE__*/function (_HTMLElementAlias) {
|
|
8811
|
-
_inherits(clazz, _HTMLElementAlias);
|
|
8812
|
-
|
|
8813
|
-
var _super7 = _createSuper(clazz);
|
|
8814
|
-
|
|
8815
|
-
function clazz() {
|
|
8816
|
-
_classCallCheck(this, clazz);
|
|
8817
|
-
|
|
8818
|
-
return _super7.apply(this, arguments);
|
|
8819
|
-
}
|
|
8820
|
-
|
|
8821
|
-
return _createClass(clazz);
|
|
8822
|
-
}(HTMLElementAlias);
|
|
8823
|
-
|
|
8824
|
-
customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
|
|
8825
|
-
new clazz();
|
|
8826
|
-
return true;
|
|
8827
|
-
} catch (_a) {
|
|
8828
|
-
return false;
|
|
8829
|
-
}
|
|
8830
|
-
}
|
|
8831
|
-
|
|
8832
|
-
if (isCustomElementRegistryAvailable()) {
|
|
8833
|
-
exports.getCustomElement = customElements.get.bind(customElements);
|
|
8834
|
-
exports.defineCustomElement = customElements.define.bind(customElements);
|
|
8835
|
-
HTMLElementConstructor = HTMLElement;
|
|
8836
|
-
} else {
|
|
8837
|
-
var registry = Object.create(null);
|
|
8838
|
-
var reverseRegistry = new WeakMap();
|
|
8839
|
-
|
|
8840
|
-
exports.defineCustomElement = function define(name, ctor) {
|
|
8841
|
-
if (name !== String.prototype.toLowerCase.call(name) || registry[name]) {
|
|
8842
|
-
throw new TypeError("Invalid Registration");
|
|
8843
|
-
}
|
|
8844
|
-
|
|
8845
|
-
registry[name] = ctor;
|
|
8846
|
-
reverseRegistry.set(ctor, name);
|
|
8847
|
-
};
|
|
8848
|
-
|
|
8849
|
-
exports.getCustomElement = function get(name) {
|
|
8850
|
-
return registry[name];
|
|
8851
|
-
};
|
|
8852
|
-
|
|
8853
|
-
HTMLElementConstructor = function HTMLElement() {
|
|
8854
|
-
if (!(this instanceof HTMLElement)) {
|
|
8855
|
-
throw new TypeError("Invalid Invocation");
|
|
8856
|
-
}
|
|
8857
|
-
|
|
8858
|
-
var constructor = this.constructor;
|
|
8859
|
-
var name = reverseRegistry.get(constructor);
|
|
8860
|
-
|
|
8861
|
-
if (!name) {
|
|
8862
|
-
throw new TypeError("Invalid Construction");
|
|
8863
|
-
}
|
|
8864
|
-
|
|
8865
|
-
var elm = document.createElement(name);
|
|
8866
|
-
Object.setPrototypeOf(elm, constructor.prototype);
|
|
8867
|
-
return elm;
|
|
8868
|
-
};
|
|
8869
|
-
|
|
8870
|
-
HTMLElementConstructor.prototype = HTMLElement.prototype;
|
|
8871
|
-
}
|
|
8872
|
-
|
|
8873
9550
|
function cloneNode(node, deep) {
|
|
8874
9551
|
return node.cloneNode(deep);
|
|
8875
9552
|
}
|
|
@@ -8928,18 +9605,18 @@ var LWC = (function (exports) {
|
|
|
8928
9605
|
var wrapperTags = topLevelWrappingMap[getTagName(html)];
|
|
8929
9606
|
|
|
8930
9607
|
if (!isUndefined(wrapperTags)) {
|
|
8931
|
-
var
|
|
8932
|
-
|
|
9608
|
+
var _iterator7 = _createForOfIteratorHelper(wrapperTags),
|
|
9609
|
+
_step7;
|
|
8933
9610
|
|
|
8934
9611
|
try {
|
|
8935
|
-
for (
|
|
8936
|
-
var wrapperTag =
|
|
9612
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
9613
|
+
var wrapperTag = _step7.value;
|
|
8937
9614
|
html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
|
|
8938
9615
|
}
|
|
8939
9616
|
} catch (err) {
|
|
8940
|
-
|
|
9617
|
+
_iterator7.e(err);
|
|
8941
9618
|
} finally {
|
|
8942
|
-
|
|
9619
|
+
_iterator7.f();
|
|
8943
9620
|
}
|
|
8944
9621
|
} // For IE11, the document title must not be undefined, but it can be an empty string
|
|
8945
9622
|
// https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
|
|
@@ -9085,8 +9762,6 @@ var LWC = (function (exports) {
|
|
|
9085
9762
|
assert.invariant(elm instanceof HTMLElement, msg);
|
|
9086
9763
|
}
|
|
9087
9764
|
|
|
9088
|
-
var HTMLElementExported = HTMLElementConstructor;
|
|
9089
|
-
exports.HTMLElementExported = HTMLElementExported;
|
|
9090
9765
|
exports.addEventListener = addEventListener;
|
|
9091
9766
|
exports.assertInstanceOfHTMLElement = assertInstanceOfHTMLElement;
|
|
9092
9767
|
exports.attachShadow = attachShadow;
|
|
@@ -9145,6 +9820,8 @@ var LWC = (function (exports) {
|
|
|
9145
9820
|
{
|
|
9146
9821
|
// insertStyleSheet implementation shares a global cache of stylesheet data
|
|
9147
9822
|
insertStylesheet: insertStylesheet,
|
|
9823
|
+
// relies on a shared global cache
|
|
9824
|
+
createCustomElement: createCustomElement,
|
|
9148
9825
|
isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
|
|
9149
9826
|
isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN)
|
|
9150
9827
|
});
|
|
@@ -9265,35 +9942,39 @@ var LWC = (function (exports) {
|
|
|
9265
9942
|
var hydratedCustomElements = new WeakSet();
|
|
9266
9943
|
|
|
9267
9944
|
function buildCustomElementConstructor(Ctor) {
|
|
9945
|
+
var _a;
|
|
9946
|
+
|
|
9268
9947
|
var HtmlPrototype = getComponentHtmlPrototype(Ctor);
|
|
9269
|
-
|
|
9270
|
-
|
|
9948
|
+
var observedAttributes = HtmlPrototype.observedAttributes;
|
|
9949
|
+
var _attributeChangedCallback = HtmlPrototype.prototype.attributeChangedCallback;
|
|
9950
|
+
return _a = /*#__PURE__*/function (_HTMLElement2) {
|
|
9951
|
+
_inherits(_a, _HTMLElement2);
|
|
9271
9952
|
|
|
9272
|
-
var
|
|
9953
|
+
var _super10 = _createSuper(_a);
|
|
9273
9954
|
|
|
9274
|
-
function
|
|
9275
|
-
var
|
|
9955
|
+
function _a() {
|
|
9956
|
+
var _this8;
|
|
9276
9957
|
|
|
9277
|
-
_classCallCheck(this,
|
|
9958
|
+
_classCallCheck(this, _a);
|
|
9278
9959
|
|
|
9279
|
-
|
|
9960
|
+
_this8 = _super10.call(this);
|
|
9280
9961
|
|
|
9281
|
-
if (
|
|
9962
|
+
if (_this8.isConnected) {
|
|
9282
9963
|
// this if block is hit when there's already an un-upgraded element in the DOM with the same tag name.
|
|
9283
|
-
hydrateComponent(_assertThisInitialized(
|
|
9284
|
-
hydratedCustomElements.add(_assertThisInitialized(
|
|
9964
|
+
hydrateComponent(_assertThisInitialized(_this8), Ctor, {});
|
|
9965
|
+
hydratedCustomElements.add(_assertThisInitialized(_this8));
|
|
9285
9966
|
} else {
|
|
9286
|
-
createVM(_assertThisInitialized(
|
|
9967
|
+
createVM(_assertThisInitialized(_this8), Ctor, renderer, {
|
|
9287
9968
|
mode: 'open',
|
|
9288
9969
|
owner: null,
|
|
9289
|
-
tagName:
|
|
9970
|
+
tagName: _this8.tagName
|
|
9290
9971
|
});
|
|
9291
9972
|
}
|
|
9292
9973
|
|
|
9293
|
-
return
|
|
9974
|
+
return _this8;
|
|
9294
9975
|
}
|
|
9295
9976
|
|
|
9296
|
-
_createClass(
|
|
9977
|
+
_createClass(_a, [{
|
|
9297
9978
|
key: "connectedCallback",
|
|
9298
9979
|
value: function connectedCallback() {
|
|
9299
9980
|
if (hydratedCustomElements.has(this)) {
|
|
@@ -9308,10 +9989,15 @@ var LWC = (function (exports) {
|
|
|
9308
9989
|
value: function disconnectedCallback() {
|
|
9309
9990
|
disconnectRootElement(this);
|
|
9310
9991
|
}
|
|
9992
|
+
}, {
|
|
9993
|
+
key: "attributeChangedCallback",
|
|
9994
|
+
value: function attributeChangedCallback(name, oldValue, newValue) {
|
|
9995
|
+
_attributeChangedCallback.call(this, name, oldValue, newValue);
|
|
9996
|
+
}
|
|
9311
9997
|
}]);
|
|
9312
9998
|
|
|
9313
|
-
return
|
|
9314
|
-
}(
|
|
9999
|
+
return _a;
|
|
10000
|
+
}( /*#__PURE__*/_wrapNativeSuper(HTMLElement)), _a.observedAttributes = observedAttributes, _a;
|
|
9315
10001
|
}
|
|
9316
10002
|
/*
|
|
9317
10003
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -9397,8 +10083,11 @@ var LWC = (function (exports) {
|
|
|
9397
10083
|
throw new TypeError("\"createElement\" function expects an \"is\" option with a valid component constructor.");
|
|
9398
10084
|
}
|
|
9399
10085
|
|
|
9400
|
-
var
|
|
9401
|
-
|
|
10086
|
+
var createCustomElement = renderer.createCustomElement; // tagName must be all lowercase, unfortunately, we have legacy code that is
|
|
10087
|
+
// passing `sel` as a camel-case, which makes them invalid custom elements name
|
|
10088
|
+
// the following line guarantees that this does not leaks beyond this point.
|
|
10089
|
+
|
|
10090
|
+
var tagName = StringToLowerCase.call(sel); // the custom element from the registry is expecting an upgrade callback
|
|
9402
10091
|
|
|
9403
10092
|
/**
|
|
9404
10093
|
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
@@ -9407,9 +10096,9 @@ var LWC = (function (exports) {
|
|
|
9407
10096
|
* an upgradable custom element.
|
|
9408
10097
|
*/
|
|
9409
10098
|
|
|
9410
|
-
var
|
|
10099
|
+
var upgradeCallback = function upgradeCallback(elm) {
|
|
9411
10100
|
createVM(elm, Ctor, renderer, {
|
|
9412
|
-
tagName:
|
|
10101
|
+
tagName: tagName,
|
|
9413
10102
|
mode: options.mode !== 'closed' ? 'open' : 'closed',
|
|
9414
10103
|
owner: null
|
|
9415
10104
|
});
|
|
@@ -9418,15 +10107,21 @@ var LWC = (function (exports) {
|
|
|
9418
10107
|
ConnectingSlot.set(elm, connectRootElement);
|
|
9419
10108
|
DisconnectingSlot.set(elm, disconnectRootElement);
|
|
9420
10109
|
}
|
|
10110
|
+
};
|
|
9421
10111
|
|
|
9422
|
-
|
|
9423
|
-
|
|
10112
|
+
var connectedCallback = function connectedCallback(elm) {
|
|
10113
|
+
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
10114
|
+
connectRootElement(elm);
|
|
10115
|
+
}
|
|
10116
|
+
};
|
|
9424
10117
|
|
|
9425
|
-
|
|
9426
|
-
|
|
9427
|
-
|
|
9428
|
-
|
|
10118
|
+
var disconnectedCallback = function disconnectedCallback(elm) {
|
|
10119
|
+
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
10120
|
+
disconnectRootElement(elm);
|
|
10121
|
+
}
|
|
10122
|
+
};
|
|
9429
10123
|
|
|
10124
|
+
var element = createCustomElement(tagName, upgradeCallback, connectedCallback, disconnectedCallback);
|
|
9430
10125
|
return element;
|
|
9431
10126
|
}
|
|
9432
10127
|
/*
|
|
@@ -9509,7 +10204,7 @@ var LWC = (function (exports) {
|
|
|
9509
10204
|
});
|
|
9510
10205
|
freeze(LightningElement);
|
|
9511
10206
|
seal(LightningElement.prototype);
|
|
9512
|
-
/* version: 2.
|
|
10207
|
+
/* version: 2.27.0 */
|
|
9513
10208
|
|
|
9514
10209
|
exports.LightningElement = LightningElement;
|
|
9515
10210
|
exports.__unstable__ProfilerControl = profilerControl;
|