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
|
@@ -43,7 +43,7 @@ var assert = /*#__PURE__*/Object.freeze({
|
|
|
43
43
|
*/
|
|
44
44
|
const { assign, create, defineProperties, defineProperty, freeze, getOwnPropertyDescriptor: getOwnPropertyDescriptor$1, getOwnPropertyNames: getOwnPropertyNames$1, getPrototypeOf: getPrototypeOf$1, hasOwnProperty: hasOwnProperty$1, isFrozen, keys, seal, setPrototypeOf, } = Object;
|
|
45
45
|
const { isArray: isArray$1 } = Array;
|
|
46
|
-
const { copyWithin: ArrayCopyWithin, fill: ArrayFill, filter: ArrayFilter, find: ArrayFind, indexOf: ArrayIndexOf, join: ArrayJoin, map: ArrayMap, pop: ArrayPop, push: ArrayPush$1, reduce: ArrayReduce, reverse: ArrayReverse, shift: ArrayShift, slice: ArraySlice, sort: ArraySort, splice: ArraySplice, unshift: ArrayUnshift, forEach, } = Array.prototype;
|
|
46
|
+
const { concat: ArrayConcat$1, copyWithin: ArrayCopyWithin, fill: ArrayFill, filter: ArrayFilter, find: ArrayFind, indexOf: ArrayIndexOf, join: ArrayJoin, map: ArrayMap, pop: ArrayPop, push: ArrayPush$1, reduce: ArrayReduce, reverse: ArrayReverse, shift: ArrayShift, slice: ArraySlice, sort: ArraySort, splice: ArraySplice, unshift: ArrayUnshift, forEach, } = Array.prototype;
|
|
47
47
|
const { fromCharCode: StringFromCharCode } = String;
|
|
48
48
|
const { charCodeAt: StringCharCodeAt, replace: StringReplace, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
|
|
49
49
|
function isUndefined$1(obj) {
|
|
@@ -432,9 +432,9 @@ function htmlEscape(str, attrMode = false) {
|
|
|
432
432
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
433
433
|
*/
|
|
434
434
|
// Increment whenever the LWC template compiler changes
|
|
435
|
-
const LWC_VERSION = "2.
|
|
435
|
+
const LWC_VERSION = "2.27.0";
|
|
436
436
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
437
|
-
/** version: 2.
|
|
437
|
+
/** version: 2.27.0 */
|
|
438
438
|
|
|
439
439
|
/*
|
|
440
440
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -482,7 +482,6 @@ const features = {
|
|
|
482
482
|
DUMMY_TEST_FLAG: null,
|
|
483
483
|
ENABLE_ELEMENT_PATCH: null,
|
|
484
484
|
ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
|
|
485
|
-
ENABLE_HMR: null,
|
|
486
485
|
ENABLE_HTML_COLLECTIONS_PATCH: null,
|
|
487
486
|
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
488
487
|
ENABLE_MIXED_SHADOW_MODE: null,
|
|
@@ -493,6 +492,7 @@ const features = {
|
|
|
493
492
|
ENABLE_WIRE_SYNC_EMIT: null,
|
|
494
493
|
ENABLE_LIGHT_GET_ROOT_NODE_PATCH: null,
|
|
495
494
|
DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
|
|
495
|
+
ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
|
|
496
496
|
};
|
|
497
497
|
if (!_globalThis.lwcRuntimeFlags) {
|
|
498
498
|
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
|
|
@@ -546,7 +546,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
546
546
|
setFeatureFlag(name, value);
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
|
-
/** version: 2.
|
|
549
|
+
/** version: 2.27.0 */
|
|
550
550
|
|
|
551
551
|
/* proxy-compat-disable */
|
|
552
552
|
|
|
@@ -1855,7 +1855,9 @@ const refsCache = new WeakMap();
|
|
|
1855
1855
|
const LightningElement = function () {
|
|
1856
1856
|
// This should be as performant as possible, while any initialization should be done lazily
|
|
1857
1857
|
if (isNull(vmBeingConstructed)) {
|
|
1858
|
-
|
|
1858
|
+
// Thrown when doing something like `new LightningElement()` or
|
|
1859
|
+
// `class Foo extends LightningElement {}; new Foo()`
|
|
1860
|
+
throw new TypeError('Illegal constructor');
|
|
1859
1861
|
}
|
|
1860
1862
|
const vm = vmBeingConstructed;
|
|
1861
1863
|
const { def, elm } = vm;
|
|
@@ -2876,157 +2878,120 @@ const swappedStyleMap = new WeakMap();
|
|
|
2876
2878
|
const activeTemplates = new WeakMap();
|
|
2877
2879
|
const activeComponents = new WeakMap();
|
|
2878
2880
|
const activeStyles = new WeakMap();
|
|
2879
|
-
|
|
2880
2881
|
function getTemplateOrSwappedTemplate(tpl) {
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2882
|
+
if (process.env.NODE_ENV === 'production') {
|
|
2883
|
+
// this method should never leak to prod
|
|
2884
|
+
throw new ReferenceError();
|
|
2885
|
+
}
|
|
2887
2886
|
const visited = new Set();
|
|
2888
|
-
|
|
2889
2887
|
while (swappedTemplateMap.has(tpl) && !visited.has(tpl)) {
|
|
2890
|
-
|
|
2891
|
-
|
|
2888
|
+
visited.add(tpl);
|
|
2889
|
+
tpl = swappedTemplateMap.get(tpl);
|
|
2892
2890
|
}
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
return tpl;
|
|
2891
|
+
return tpl;
|
|
2896
2892
|
}
|
|
2897
2893
|
function getComponentOrSwappedComponent(Ctor) {
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2894
|
+
if (process.env.NODE_ENV === 'production') {
|
|
2895
|
+
// this method should never leak to prod
|
|
2896
|
+
throw new ReferenceError();
|
|
2897
|
+
}
|
|
2904
2898
|
const visited = new Set();
|
|
2905
|
-
|
|
2906
2899
|
while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {
|
|
2907
|
-
|
|
2908
|
-
|
|
2900
|
+
visited.add(Ctor);
|
|
2901
|
+
Ctor = swappedComponentMap.get(Ctor);
|
|
2909
2902
|
}
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
return Ctor;
|
|
2903
|
+
return Ctor;
|
|
2913
2904
|
}
|
|
2914
2905
|
function getStyleOrSwappedStyle(style) {
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2906
|
+
if (process.env.NODE_ENV === 'production') {
|
|
2907
|
+
// this method should never leak to prod
|
|
2908
|
+
throw new ReferenceError();
|
|
2909
|
+
}
|
|
2921
2910
|
const visited = new Set();
|
|
2922
|
-
|
|
2923
2911
|
while (swappedStyleMap.has(style) && !visited.has(style)) {
|
|
2924
|
-
|
|
2925
|
-
|
|
2912
|
+
visited.add(style);
|
|
2913
|
+
style = swappedStyleMap.get(style);
|
|
2926
2914
|
}
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
return style;
|
|
2915
|
+
return style;
|
|
2930
2916
|
}
|
|
2931
2917
|
function setActiveVM(vm) {
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2918
|
+
if (process.env.NODE_ENV === 'production') {
|
|
2919
|
+
// this method should never leak to prod
|
|
2920
|
+
throw new ReferenceError();
|
|
2921
|
+
}
|
|
2938
2922
|
// tracking active component
|
|
2939
2923
|
const Ctor = vm.def.ctor;
|
|
2940
2924
|
let componentVMs = activeComponents.get(Ctor);
|
|
2941
|
-
|
|
2942
2925
|
if (isUndefined$1(componentVMs)) {
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
}
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2926
|
+
componentVMs = new Set();
|
|
2927
|
+
activeComponents.set(Ctor, componentVMs);
|
|
2928
|
+
}
|
|
2929
|
+
// this will allow us to keep track of the hot components
|
|
2930
|
+
componentVMs.add(vm);
|
|
2931
|
+
// tracking active template
|
|
2950
2932
|
const tpl = vm.cmpTemplate;
|
|
2951
|
-
|
|
2952
2933
|
if (tpl) {
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
stylesheetVMs.add(vm);
|
|
2983
|
-
});
|
|
2984
|
-
}
|
|
2934
|
+
let templateVMs = activeTemplates.get(tpl);
|
|
2935
|
+
if (isUndefined$1(templateVMs)) {
|
|
2936
|
+
templateVMs = new Set();
|
|
2937
|
+
activeTemplates.set(tpl, templateVMs);
|
|
2938
|
+
}
|
|
2939
|
+
// this will allow us to keep track of the templates that are
|
|
2940
|
+
// being used by a hot component
|
|
2941
|
+
templateVMs.add(vm);
|
|
2942
|
+
// tracking active styles associated to template
|
|
2943
|
+
const stylesheets = tpl.stylesheets;
|
|
2944
|
+
if (!isUndefined$1(stylesheets)) {
|
|
2945
|
+
flattenStylesheets(stylesheets).forEach((stylesheet) => {
|
|
2946
|
+
// this is necessary because we don't hold the list of styles
|
|
2947
|
+
// in the vm, we only hold the selected (already swapped template)
|
|
2948
|
+
// but the styles attached to the template might not be the actual
|
|
2949
|
+
// active ones, but the swapped versions of those.
|
|
2950
|
+
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
2951
|
+
let stylesheetVMs = activeStyles.get(stylesheet);
|
|
2952
|
+
if (isUndefined$1(stylesheetVMs)) {
|
|
2953
|
+
stylesheetVMs = new Set();
|
|
2954
|
+
activeStyles.set(stylesheet, stylesheetVMs);
|
|
2955
|
+
}
|
|
2956
|
+
// this will allow us to keep track of the stylesheet that are
|
|
2957
|
+
// being used by a hot component
|
|
2958
|
+
stylesheetVMs.add(vm);
|
|
2959
|
+
});
|
|
2960
|
+
}
|
|
2985
2961
|
}
|
|
2986
|
-
}
|
|
2987
2962
|
}
|
|
2988
2963
|
function removeActiveVM(vm) {
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2964
|
+
if (process.env.NODE_ENV === 'production') {
|
|
2965
|
+
// this method should never leak to prod
|
|
2966
|
+
throw new ReferenceError();
|
|
2967
|
+
}
|
|
2995
2968
|
// tracking inactive component
|
|
2996
2969
|
const Ctor = vm.def.ctor;
|
|
2997
2970
|
let list = activeComponents.get(Ctor);
|
|
2998
|
-
|
|
2999
2971
|
if (!isUndefined$1(list)) {
|
|
3000
|
-
// deleting the vm from the set to avoid leaking memory
|
|
3001
|
-
list.delete(vm);
|
|
3002
|
-
} // removing inactive template
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
const tpl = vm.cmpTemplate;
|
|
3006
|
-
|
|
3007
|
-
if (tpl) {
|
|
3008
|
-
list = activeTemplates.get(tpl);
|
|
3009
|
-
|
|
3010
|
-
if (!isUndefined$1(list)) {
|
|
3011
2972
|
// deleting the vm from the set to avoid leaking memory
|
|
3012
2973
|
list.delete(vm);
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
flattenStylesheets(styles).forEach(style => {
|
|
3020
|
-
list = activeStyles.get(style);
|
|
3021
|
-
|
|
3022
|
-
if (!isUndefined$1(list)) {
|
|
2974
|
+
}
|
|
2975
|
+
// removing inactive template
|
|
2976
|
+
const tpl = vm.cmpTemplate;
|
|
2977
|
+
if (tpl) {
|
|
2978
|
+
list = activeTemplates.get(tpl);
|
|
2979
|
+
if (!isUndefined$1(list)) {
|
|
3023
2980
|
// deleting the vm from the set to avoid leaking memory
|
|
3024
2981
|
list.delete(vm);
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
2982
|
+
}
|
|
2983
|
+
// removing active styles associated to template
|
|
2984
|
+
const styles = tpl.stylesheets;
|
|
2985
|
+
if (!isUndefined$1(styles)) {
|
|
2986
|
+
flattenStylesheets(styles).forEach((style) => {
|
|
2987
|
+
list = activeStyles.get(style);
|
|
2988
|
+
if (!isUndefined$1(list)) {
|
|
2989
|
+
// deleting the vm from the set to avoid leaking memory
|
|
2990
|
+
list.delete(vm);
|
|
2991
|
+
}
|
|
2992
|
+
});
|
|
2993
|
+
}
|
|
3028
2994
|
}
|
|
3029
|
-
}
|
|
3030
2995
|
}
|
|
3031
2996
|
|
|
3032
2997
|
/*
|
|
@@ -3459,75 +3424,6 @@ function createStylesheet(vm, stylesheets) {
|
|
|
3459
3424
|
return null;
|
|
3460
3425
|
}
|
|
3461
3426
|
|
|
3462
|
-
/*
|
|
3463
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
3464
|
-
* All rights reserved.
|
|
3465
|
-
* SPDX-License-Identifier: MIT
|
|
3466
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3467
|
-
*/
|
|
3468
|
-
|
|
3469
|
-
function checkHasVM(elm) {
|
|
3470
|
-
const hasVM = !isUndefined$1(getAssociatedVMIfPresent(elm));
|
|
3471
|
-
|
|
3472
|
-
if (process.env.NODE_ENV !== 'production' && !hasVM) {
|
|
3473
|
-
// Occurs when an element is manually created with the same tag name as an existing LWC component. In that case,
|
|
3474
|
-
// we skip calling the LWC connectedCallback/disconnectedCallback logic and log an error.
|
|
3475
|
-
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.`);
|
|
3476
|
-
}
|
|
3477
|
-
|
|
3478
|
-
return hasVM;
|
|
3479
|
-
}
|
|
3480
|
-
|
|
3481
|
-
function getUpgradableConstructor(tagName, renderer) {
|
|
3482
|
-
const {
|
|
3483
|
-
getCustomElement,
|
|
3484
|
-
HTMLElementExported: RendererHTMLElement,
|
|
3485
|
-
defineCustomElement
|
|
3486
|
-
} = renderer; // Should never get a tag with upper case letter at this point, the compiler should
|
|
3487
|
-
// produce only tags with lowercase letters
|
|
3488
|
-
// But, for backwards compatibility, we will lower case the tagName
|
|
3489
|
-
|
|
3490
|
-
tagName = tagName.toLowerCase();
|
|
3491
|
-
let CE = getCustomElement(tagName);
|
|
3492
|
-
|
|
3493
|
-
if (!isUndefined$1(CE)) {
|
|
3494
|
-
return CE;
|
|
3495
|
-
}
|
|
3496
|
-
/**
|
|
3497
|
-
* LWC Upgradable Element reference to an element that was created
|
|
3498
|
-
* via the scoped registry mechanism, and that is ready to be upgraded.
|
|
3499
|
-
*/
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
CE = class LWCUpgradableElement extends RendererHTMLElement {
|
|
3503
|
-
constructor(upgradeCallback) {
|
|
3504
|
-
super();
|
|
3505
|
-
|
|
3506
|
-
if (isFunction$1(upgradeCallback)) {
|
|
3507
|
-
upgradeCallback(this); // nothing to do with the result for now
|
|
3508
|
-
}
|
|
3509
|
-
}
|
|
3510
|
-
|
|
3511
|
-
};
|
|
3512
|
-
|
|
3513
|
-
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
3514
|
-
CE.prototype.connectedCallback = function () {
|
|
3515
|
-
if (checkHasVM(this)) {
|
|
3516
|
-
connectRootElement(this);
|
|
3517
|
-
}
|
|
3518
|
-
};
|
|
3519
|
-
|
|
3520
|
-
CE.prototype.disconnectedCallback = function () {
|
|
3521
|
-
if (checkHasVM(this)) {
|
|
3522
|
-
disconnectRootElement(this);
|
|
3523
|
-
}
|
|
3524
|
-
};
|
|
3525
|
-
}
|
|
3526
|
-
|
|
3527
|
-
defineCustomElement(tagName, CE);
|
|
3528
|
-
return CE;
|
|
3529
|
-
}
|
|
3530
|
-
|
|
3531
3427
|
/*
|
|
3532
3428
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
3533
3429
|
* All rights reserved.
|
|
@@ -3541,6 +3437,9 @@ function isVBaseElement(vnode) {
|
|
|
3541
3437
|
function isSameVnode(vnode1, vnode2) {
|
|
3542
3438
|
return vnode1.key === vnode2.key && vnode1.sel === vnode2.sel;
|
|
3543
3439
|
}
|
|
3440
|
+
function isVScopedSlotFragment(vnode) {
|
|
3441
|
+
return vnode.type === 6 /* VNodeType.ScopedSlotFragment */;
|
|
3442
|
+
}
|
|
3544
3443
|
|
|
3545
3444
|
/*
|
|
3546
3445
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -4030,7 +3929,9 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
|
4030
3929
|
sel,
|
|
4031
3930
|
owner
|
|
4032
3931
|
} = vnode;
|
|
4033
|
-
const
|
|
3932
|
+
const {
|
|
3933
|
+
createCustomElement
|
|
3934
|
+
} = renderer;
|
|
4034
3935
|
/**
|
|
4035
3936
|
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
4036
3937
|
* with a callback as the first argument, we could implement a more advanced
|
|
@@ -4039,10 +3940,25 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
|
4039
3940
|
*/
|
|
4040
3941
|
|
|
4041
3942
|
let vm;
|
|
4042
|
-
|
|
3943
|
+
|
|
3944
|
+
const upgradeCallback = elm => {
|
|
4043
3945
|
// the custom element from the registry is expecting an upgrade callback
|
|
4044
3946
|
vm = createViewModelHook(elm, vnode, renderer);
|
|
4045
|
-
}
|
|
3947
|
+
};
|
|
3948
|
+
|
|
3949
|
+
const connectedCallback = elm => {
|
|
3950
|
+
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
3951
|
+
connectRootElement(elm);
|
|
3952
|
+
}
|
|
3953
|
+
};
|
|
3954
|
+
|
|
3955
|
+
const disconnectedCallback = elm => {
|
|
3956
|
+
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
3957
|
+
disconnectRootElement(elm);
|
|
3958
|
+
}
|
|
3959
|
+
};
|
|
3960
|
+
|
|
3961
|
+
const elm = createCustomElement(sel, upgradeCallback, connectedCallback, disconnectedCallback);
|
|
4046
3962
|
vnode.elm = elm;
|
|
4047
3963
|
vnode.vm = vm;
|
|
4048
3964
|
linkNodeToShadow(elm, owner, renderer);
|
|
@@ -4050,8 +3966,6 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
|
4050
3966
|
|
|
4051
3967
|
if (vm) {
|
|
4052
3968
|
allocateChildren(vnode, vm);
|
|
4053
|
-
} else if (vnode.ctor !== UpgradableConstructor) {
|
|
4054
|
-
throw new TypeError(`Incorrect Component Constructor`);
|
|
4055
3969
|
}
|
|
4056
3970
|
|
|
4057
3971
|
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
@@ -4344,7 +4258,7 @@ function allocateChildren(vnode, vm) {
|
|
|
4344
4258
|
/* RenderMode.Light */
|
|
4345
4259
|
) {
|
|
4346
4260
|
// slow path
|
|
4347
|
-
allocateInSlot(vm, children); // save the allocated children in case this vnode is reused.
|
|
4261
|
+
allocateInSlot(vm, children, vnode.owner); // save the allocated children in case this vnode is reused.
|
|
4348
4262
|
|
|
4349
4263
|
vnode.aChildren = children; // every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
|
|
4350
4264
|
|
|
@@ -4380,13 +4294,19 @@ function createViewModelHook(elm, vnode, renderer) {
|
|
|
4380
4294
|
return vm;
|
|
4381
4295
|
}
|
|
4382
4296
|
|
|
4383
|
-
function allocateInSlot(vm, children) {
|
|
4384
|
-
var _a;
|
|
4297
|
+
function allocateInSlot(vm, children, owner) {
|
|
4298
|
+
var _a, _b;
|
|
4385
4299
|
|
|
4386
4300
|
const {
|
|
4387
|
-
cmpSlots:
|
|
4301
|
+
cmpSlots: {
|
|
4302
|
+
slotAssignments: oldSlotsMapping
|
|
4303
|
+
}
|
|
4388
4304
|
} = vm;
|
|
4389
|
-
const
|
|
4305
|
+
const cmpSlotsMapping = create(null);
|
|
4306
|
+
vm.cmpSlots = {
|
|
4307
|
+
owner,
|
|
4308
|
+
slotAssignments: cmpSlotsMapping
|
|
4309
|
+
};
|
|
4390
4310
|
|
|
4391
4311
|
for (let i = 0, len = children.length; i < len; i += 1) {
|
|
4392
4312
|
const vnode = children[i];
|
|
@@ -4398,19 +4318,21 @@ function allocateInSlot(vm, children) {
|
|
|
4398
4318
|
let slotName = '';
|
|
4399
4319
|
|
|
4400
4320
|
if (isVBaseElement(vnode)) {
|
|
4401
|
-
slotName = ((_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot)
|
|
4321
|
+
slotName = (_b = (_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) !== null && _b !== void 0 ? _b : '';
|
|
4322
|
+
} else if (isVScopedSlotFragment(vnode)) {
|
|
4323
|
+
slotName = vnode.slotName;
|
|
4402
4324
|
}
|
|
4403
4325
|
|
|
4404
|
-
const vnodes =
|
|
4326
|
+
const vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
|
|
4405
4327
|
ArrayPush$1.call(vnodes, vnode);
|
|
4406
4328
|
}
|
|
4407
4329
|
|
|
4408
4330
|
if (isFalse(vm.isDirty)) {
|
|
4409
4331
|
// We need to determine if the old allocation is really different from the new one
|
|
4410
4332
|
// and mark the vm as dirty
|
|
4411
|
-
const oldKeys = keys(
|
|
4333
|
+
const oldKeys = keys(oldSlotsMapping);
|
|
4412
4334
|
|
|
4413
|
-
if (oldKeys.length !== keys(
|
|
4335
|
+
if (oldKeys.length !== keys(cmpSlotsMapping).length) {
|
|
4414
4336
|
markComponentAsDirty(vm);
|
|
4415
4337
|
return;
|
|
4416
4338
|
}
|
|
@@ -4418,15 +4340,15 @@ function allocateInSlot(vm, children) {
|
|
|
4418
4340
|
for (let i = 0, len = oldKeys.length; i < len; i += 1) {
|
|
4419
4341
|
const key = oldKeys[i];
|
|
4420
4342
|
|
|
4421
|
-
if (isUndefined$1(
|
|
4343
|
+
if (isUndefined$1(cmpSlotsMapping[key]) || oldSlotsMapping[key].length !== cmpSlotsMapping[key].length) {
|
|
4422
4344
|
markComponentAsDirty(vm);
|
|
4423
4345
|
return;
|
|
4424
4346
|
}
|
|
4425
4347
|
|
|
4426
|
-
const oldVNodes =
|
|
4427
|
-
const vnodes =
|
|
4348
|
+
const oldVNodes = oldSlotsMapping[key];
|
|
4349
|
+
const vnodes = cmpSlotsMapping[key];
|
|
4428
4350
|
|
|
4429
|
-
for (let j = 0, a =
|
|
4351
|
+
for (let j = 0, a = cmpSlotsMapping[key].length; j < a; j += 1) {
|
|
4430
4352
|
if (oldVNodes[j] !== vnodes[j]) {
|
|
4431
4353
|
markComponentAsDirty(vm);
|
|
4432
4354
|
return;
|
|
@@ -4626,6 +4548,18 @@ const SymbolIterator = Symbol.iterator;
|
|
|
4626
4548
|
function addVNodeToChildLWC(vnode) {
|
|
4627
4549
|
ArrayPush$1.call(getVMBeingRendered().velements, vnode);
|
|
4628
4550
|
}
|
|
4551
|
+
// [s]coped [s]lot [f]actory
|
|
4552
|
+
function ssf(slotName, factory) {
|
|
4553
|
+
return {
|
|
4554
|
+
type: 6 /* VNodeType.ScopedSlotFragment */,
|
|
4555
|
+
factory,
|
|
4556
|
+
owner: getVMBeingRendered(),
|
|
4557
|
+
elm: undefined,
|
|
4558
|
+
sel: undefined,
|
|
4559
|
+
key: undefined,
|
|
4560
|
+
slotName,
|
|
4561
|
+
};
|
|
4562
|
+
}
|
|
4629
4563
|
// [st]atic node
|
|
4630
4564
|
function st(fragment, key) {
|
|
4631
4565
|
return {
|
|
@@ -4709,9 +4643,31 @@ function s(slotName, data, children, slotset) {
|
|
|
4709
4643
|
assert.isTrue(isArray$1(children), `h() 3rd argument children must be an array.`);
|
|
4710
4644
|
}
|
|
4711
4645
|
if (!isUndefined$1(slotset) &&
|
|
4712
|
-
!isUndefined$1(slotset
|
|
4713
|
-
slotset[slotName]
|
|
4714
|
-
|
|
4646
|
+
!isUndefined$1(slotset.slotAssignments) &&
|
|
4647
|
+
!isUndefined$1(slotset.slotAssignments[slotName]) &&
|
|
4648
|
+
slotset.slotAssignments[slotName].length !== 0) {
|
|
4649
|
+
children = slotset.slotAssignments[slotName].reduce((acc, vnode) => {
|
|
4650
|
+
// If the passed slot content is factory, evaluate it and use the produced vnodes
|
|
4651
|
+
if (vnode && isVScopedSlotFragment(vnode)) {
|
|
4652
|
+
const vmBeingRenderedInception = getVMBeingRendered();
|
|
4653
|
+
let children = [];
|
|
4654
|
+
// Evaluate in the scope of the slot content's owner
|
|
4655
|
+
// if a slotset is provided, there will always be an owner. The only case where owner is
|
|
4656
|
+
// undefined is for root components, but root components cannot accept slotted content
|
|
4657
|
+
setVMBeingRendered(slotset.owner);
|
|
4658
|
+
try {
|
|
4659
|
+
children = vnode.factory(data.slotData);
|
|
4660
|
+
}
|
|
4661
|
+
finally {
|
|
4662
|
+
setVMBeingRendered(vmBeingRenderedInception);
|
|
4663
|
+
}
|
|
4664
|
+
return ArrayConcat$1.call(acc, children);
|
|
4665
|
+
}
|
|
4666
|
+
else {
|
|
4667
|
+
// If the slot content is a static list of child nodes provided by the parent, nothing to do
|
|
4668
|
+
return ArrayConcat$1.call(acc, vnode);
|
|
4669
|
+
}
|
|
4670
|
+
}, []);
|
|
4715
4671
|
}
|
|
4716
4672
|
const vmBeingRendered = getVMBeingRendered();
|
|
4717
4673
|
const { renderMode, shadowMode } = vmBeingRendered;
|
|
@@ -5031,6 +4987,7 @@ const api = freeze({
|
|
|
5031
4987
|
gid,
|
|
5032
4988
|
fid,
|
|
5033
4989
|
shc,
|
|
4990
|
+
ssf,
|
|
5034
4991
|
});
|
|
5035
4992
|
|
|
5036
4993
|
/*
|
|
@@ -5133,9 +5090,9 @@ function validateSlots(vm, html) {
|
|
|
5133
5090
|
}
|
|
5134
5091
|
const { cmpSlots } = vm;
|
|
5135
5092
|
const { slots = EmptyArray } = html;
|
|
5136
|
-
for (const slotName in cmpSlots) {
|
|
5093
|
+
for (const slotName in cmpSlots.slotAssignments) {
|
|
5137
5094
|
// eslint-disable-next-line @lwc/lwc-internal/no-production-assert
|
|
5138
|
-
assert.isTrue(isArray$1(cmpSlots[slotName]), `Slots can only be set to an array, instead received ${toString$1(cmpSlots[slotName])} for slot "${slotName}" in ${vm}.`);
|
|
5095
|
+
assert.isTrue(isArray$1(cmpSlots.slotAssignments[slotName]), `Slots can only be set to an array, instead received ${toString$1(cmpSlots.slotAssignments[slotName])} for slot "${slotName}" in ${vm}.`);
|
|
5139
5096
|
if (slotName !== '' && ArrayIndexOf.call(slots, slotName) === -1) {
|
|
5140
5097
|
// TODO [#1297]: this should never really happen because the compiler should always validate
|
|
5141
5098
|
// eslint-disable-next-line @lwc/lwc-internal/no-production-assert
|
|
@@ -5621,7 +5578,9 @@ function createVM(elm, ctor, renderer, options) {
|
|
|
5621
5578
|
velements: EmptyArray,
|
|
5622
5579
|
cmpProps: create(null),
|
|
5623
5580
|
cmpFields: create(null),
|
|
5624
|
-
cmpSlots:
|
|
5581
|
+
cmpSlots: {
|
|
5582
|
+
slotAssignments: create(null)
|
|
5583
|
+
},
|
|
5625
5584
|
oar: create(null),
|
|
5626
5585
|
cmpTemplate: null,
|
|
5627
5586
|
hydrated: Boolean(hydrated),
|
|
@@ -6493,7 +6452,7 @@ function freezeTemplate(tmpl) {
|
|
|
6493
6452
|
});
|
|
6494
6453
|
}
|
|
6495
6454
|
}
|
|
6496
|
-
/* version: 2.
|
|
6455
|
+
/* version: 2.27.0 */
|
|
6497
6456
|
|
|
6498
6457
|
/*
|
|
6499
6458
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -6557,25 +6516,6 @@ function createElement(tagName, namespace) {
|
|
|
6557
6516
|
[HostEventListenersKey]: {},
|
|
6558
6517
|
};
|
|
6559
6518
|
}
|
|
6560
|
-
const registry = create(null);
|
|
6561
|
-
const reverseRegistry = new WeakMap();
|
|
6562
|
-
function registerCustomElement(name, ctor) {
|
|
6563
|
-
if (name !== StringToLowerCase.call(name) || registry[name]) {
|
|
6564
|
-
throw new TypeError(`Invalid Registration`);
|
|
6565
|
-
}
|
|
6566
|
-
registry[name] = ctor;
|
|
6567
|
-
reverseRegistry.set(ctor, name);
|
|
6568
|
-
}
|
|
6569
|
-
class HTMLElementImpl {
|
|
6570
|
-
constructor() {
|
|
6571
|
-
const { constructor } = this;
|
|
6572
|
-
const tagName = reverseRegistry.get(constructor);
|
|
6573
|
-
if (!tagName) {
|
|
6574
|
-
throw new TypeError(`Invalid Construction`);
|
|
6575
|
-
}
|
|
6576
|
-
return createElement(tagName);
|
|
6577
|
-
}
|
|
6578
|
-
}
|
|
6579
6519
|
const isNativeShadowDefined = false;
|
|
6580
6520
|
const isSyntheticShadowDefined = false;
|
|
6581
6521
|
function insert(node, parent, anchor) {
|
|
@@ -6804,19 +6744,34 @@ const getFirstChild = unsupportedMethod('getFirstChild');
|
|
|
6804
6744
|
const getFirstElementChild = unsupportedMethod('getFirstElementChild');
|
|
6805
6745
|
const getLastChild = unsupportedMethod('getLastChild');
|
|
6806
6746
|
const getLastElementChild = unsupportedMethod('getLastElementChild');
|
|
6807
|
-
function defineCustomElement(name, constructor, _options) {
|
|
6808
|
-
registerCustomElement(name, constructor);
|
|
6809
|
-
}
|
|
6810
|
-
function getCustomElement(name) {
|
|
6811
|
-
return registry[name];
|
|
6812
|
-
}
|
|
6813
|
-
const HTMLElementExported = HTMLElementImpl;
|
|
6814
6747
|
/* noop */
|
|
6815
6748
|
const assertInstanceOfHTMLElement = noop;
|
|
6749
|
+
const localRegistryRecord = new Map();
|
|
6750
|
+
function createUpgradableElementConstructor(tagName) {
|
|
6751
|
+
return function Ctor(upgradeCallback) {
|
|
6752
|
+
const elm = createElement(tagName);
|
|
6753
|
+
if (isFunction$1(upgradeCallback)) {
|
|
6754
|
+
upgradeCallback(elm); // nothing to do with the result for now
|
|
6755
|
+
}
|
|
6756
|
+
return elm;
|
|
6757
|
+
};
|
|
6758
|
+
}
|
|
6759
|
+
function getUpgradableElement(tagName) {
|
|
6760
|
+
let ctor = localRegistryRecord.get(tagName);
|
|
6761
|
+
if (!isUndefined$1(ctor)) {
|
|
6762
|
+
return ctor;
|
|
6763
|
+
}
|
|
6764
|
+
ctor = createUpgradableElementConstructor(tagName);
|
|
6765
|
+
localRegistryRecord.set(tagName, ctor);
|
|
6766
|
+
return ctor;
|
|
6767
|
+
}
|
|
6768
|
+
function createCustomElement(tagName, upgradeCallback) {
|
|
6769
|
+
const UpgradableConstructor = getUpgradableElement(tagName);
|
|
6770
|
+
return new UpgradableConstructor(upgradeCallback);
|
|
6771
|
+
}
|
|
6816
6772
|
const renderer = {
|
|
6817
6773
|
isNativeShadowDefined,
|
|
6818
6774
|
isSyntheticShadowDefined,
|
|
6819
|
-
HTMLElementExported,
|
|
6820
6775
|
insert,
|
|
6821
6776
|
remove,
|
|
6822
6777
|
cloneNode,
|
|
@@ -6824,6 +6779,7 @@ const renderer = {
|
|
|
6824
6779
|
createElement,
|
|
6825
6780
|
createText,
|
|
6826
6781
|
createComment,
|
|
6782
|
+
createCustomElement,
|
|
6827
6783
|
nextSibling,
|
|
6828
6784
|
attachShadow,
|
|
6829
6785
|
getProperty,
|
|
@@ -6851,8 +6807,6 @@ const renderer = {
|
|
|
6851
6807
|
isConnected,
|
|
6852
6808
|
insertStylesheet,
|
|
6853
6809
|
assertInstanceOfHTMLElement,
|
|
6854
|
-
defineCustomElement,
|
|
6855
|
-
getCustomElement,
|
|
6856
6810
|
};
|
|
6857
6811
|
|
|
6858
6812
|
/*
|
|
@@ -6963,6 +6917,6 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
6963
6917
|
*/
|
|
6964
6918
|
freeze(LightningElement);
|
|
6965
6919
|
seal(LightningElement.prototype);
|
|
6966
|
-
/* version: 2.
|
|
6920
|
+
/* version: 2.27.0 */
|
|
6967
6921
|
|
|
6968
6922
|
export { LightningElement, api$1 as api, createContextProvider, freezeTemplate, getComponentDef, isComponentConstructor, parseFragment, parseFragment as parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, renderComponent, renderer, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, track, unwrap, wire };
|