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
|
@@ -47,7 +47,7 @@ var assert = /*#__PURE__*/Object.freeze({
|
|
|
47
47
|
*/
|
|
48
48
|
const { assign, create, defineProperties, defineProperty, freeze, getOwnPropertyDescriptor: getOwnPropertyDescriptor$1, getOwnPropertyNames: getOwnPropertyNames$1, getPrototypeOf: getPrototypeOf$1, hasOwnProperty: hasOwnProperty$1, isFrozen, keys, seal, setPrototypeOf, } = Object;
|
|
49
49
|
const { isArray: isArray$1 } = Array;
|
|
50
|
-
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;
|
|
50
|
+
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;
|
|
51
51
|
const { fromCharCode: StringFromCharCode } = String;
|
|
52
52
|
const { charCodeAt: StringCharCodeAt, replace: StringReplace, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
|
|
53
53
|
function isUndefined$1(obj) {
|
|
@@ -436,9 +436,9 @@ function htmlEscape(str, attrMode = false) {
|
|
|
436
436
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
437
437
|
*/
|
|
438
438
|
// Increment whenever the LWC template compiler changes
|
|
439
|
-
const LWC_VERSION = "2.
|
|
439
|
+
const LWC_VERSION = "2.27.0";
|
|
440
440
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
441
|
-
/** version: 2.
|
|
441
|
+
/** version: 2.27.0 */
|
|
442
442
|
|
|
443
443
|
/*
|
|
444
444
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -486,7 +486,6 @@ const features = {
|
|
|
486
486
|
DUMMY_TEST_FLAG: null,
|
|
487
487
|
ENABLE_ELEMENT_PATCH: null,
|
|
488
488
|
ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
|
|
489
|
-
ENABLE_HMR: null,
|
|
490
489
|
ENABLE_HTML_COLLECTIONS_PATCH: null,
|
|
491
490
|
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
492
491
|
ENABLE_MIXED_SHADOW_MODE: null,
|
|
@@ -497,6 +496,7 @@ const features = {
|
|
|
497
496
|
ENABLE_WIRE_SYNC_EMIT: null,
|
|
498
497
|
ENABLE_LIGHT_GET_ROOT_NODE_PATCH: null,
|
|
499
498
|
DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
|
|
499
|
+
ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
|
|
500
500
|
};
|
|
501
501
|
if (!_globalThis.lwcRuntimeFlags) {
|
|
502
502
|
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
|
|
@@ -550,7 +550,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
550
550
|
setFeatureFlag(name, value);
|
|
551
551
|
}
|
|
552
552
|
}
|
|
553
|
-
/** version: 2.
|
|
553
|
+
/** version: 2.27.0 */
|
|
554
554
|
|
|
555
555
|
/* proxy-compat-disable */
|
|
556
556
|
|
|
@@ -1859,7 +1859,9 @@ const refsCache = new WeakMap();
|
|
|
1859
1859
|
const LightningElement = function () {
|
|
1860
1860
|
// This should be as performant as possible, while any initialization should be done lazily
|
|
1861
1861
|
if (isNull(vmBeingConstructed)) {
|
|
1862
|
-
|
|
1862
|
+
// Thrown when doing something like `new LightningElement()` or
|
|
1863
|
+
// `class Foo extends LightningElement {}; new Foo()`
|
|
1864
|
+
throw new TypeError('Illegal constructor');
|
|
1863
1865
|
}
|
|
1864
1866
|
const vm = vmBeingConstructed;
|
|
1865
1867
|
const { def, elm } = vm;
|
|
@@ -2880,157 +2882,120 @@ const swappedStyleMap = new WeakMap();
|
|
|
2880
2882
|
const activeTemplates = new WeakMap();
|
|
2881
2883
|
const activeComponents = new WeakMap();
|
|
2882
2884
|
const activeStyles = new WeakMap();
|
|
2883
|
-
|
|
2884
2885
|
function getTemplateOrSwappedTemplate(tpl) {
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2886
|
+
if (process.env.NODE_ENV === 'production') {
|
|
2887
|
+
// this method should never leak to prod
|
|
2888
|
+
throw new ReferenceError();
|
|
2889
|
+
}
|
|
2891
2890
|
const visited = new Set();
|
|
2892
|
-
|
|
2893
2891
|
while (swappedTemplateMap.has(tpl) && !visited.has(tpl)) {
|
|
2894
|
-
|
|
2895
|
-
|
|
2892
|
+
visited.add(tpl);
|
|
2893
|
+
tpl = swappedTemplateMap.get(tpl);
|
|
2896
2894
|
}
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
return tpl;
|
|
2895
|
+
return tpl;
|
|
2900
2896
|
}
|
|
2901
2897
|
function getComponentOrSwappedComponent(Ctor) {
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2898
|
+
if (process.env.NODE_ENV === 'production') {
|
|
2899
|
+
// this method should never leak to prod
|
|
2900
|
+
throw new ReferenceError();
|
|
2901
|
+
}
|
|
2908
2902
|
const visited = new Set();
|
|
2909
|
-
|
|
2910
2903
|
while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {
|
|
2911
|
-
|
|
2912
|
-
|
|
2904
|
+
visited.add(Ctor);
|
|
2905
|
+
Ctor = swappedComponentMap.get(Ctor);
|
|
2913
2906
|
}
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
return Ctor;
|
|
2907
|
+
return Ctor;
|
|
2917
2908
|
}
|
|
2918
2909
|
function getStyleOrSwappedStyle(style) {
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2910
|
+
if (process.env.NODE_ENV === 'production') {
|
|
2911
|
+
// this method should never leak to prod
|
|
2912
|
+
throw new ReferenceError();
|
|
2913
|
+
}
|
|
2925
2914
|
const visited = new Set();
|
|
2926
|
-
|
|
2927
2915
|
while (swappedStyleMap.has(style) && !visited.has(style)) {
|
|
2928
|
-
|
|
2929
|
-
|
|
2916
|
+
visited.add(style);
|
|
2917
|
+
style = swappedStyleMap.get(style);
|
|
2930
2918
|
}
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
return style;
|
|
2919
|
+
return style;
|
|
2934
2920
|
}
|
|
2935
2921
|
function setActiveVM(vm) {
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2922
|
+
if (process.env.NODE_ENV === 'production') {
|
|
2923
|
+
// this method should never leak to prod
|
|
2924
|
+
throw new ReferenceError();
|
|
2925
|
+
}
|
|
2942
2926
|
// tracking active component
|
|
2943
2927
|
const Ctor = vm.def.ctor;
|
|
2944
2928
|
let componentVMs = activeComponents.get(Ctor);
|
|
2945
|
-
|
|
2946
2929
|
if (isUndefined$1(componentVMs)) {
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
}
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2930
|
+
componentVMs = new Set();
|
|
2931
|
+
activeComponents.set(Ctor, componentVMs);
|
|
2932
|
+
}
|
|
2933
|
+
// this will allow us to keep track of the hot components
|
|
2934
|
+
componentVMs.add(vm);
|
|
2935
|
+
// tracking active template
|
|
2954
2936
|
const tpl = vm.cmpTemplate;
|
|
2955
|
-
|
|
2956
2937
|
if (tpl) {
|
|
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
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
stylesheetVMs.add(vm);
|
|
2987
|
-
});
|
|
2988
|
-
}
|
|
2938
|
+
let templateVMs = activeTemplates.get(tpl);
|
|
2939
|
+
if (isUndefined$1(templateVMs)) {
|
|
2940
|
+
templateVMs = new Set();
|
|
2941
|
+
activeTemplates.set(tpl, templateVMs);
|
|
2942
|
+
}
|
|
2943
|
+
// this will allow us to keep track of the templates that are
|
|
2944
|
+
// being used by a hot component
|
|
2945
|
+
templateVMs.add(vm);
|
|
2946
|
+
// tracking active styles associated to template
|
|
2947
|
+
const stylesheets = tpl.stylesheets;
|
|
2948
|
+
if (!isUndefined$1(stylesheets)) {
|
|
2949
|
+
flattenStylesheets(stylesheets).forEach((stylesheet) => {
|
|
2950
|
+
// this is necessary because we don't hold the list of styles
|
|
2951
|
+
// in the vm, we only hold the selected (already swapped template)
|
|
2952
|
+
// but the styles attached to the template might not be the actual
|
|
2953
|
+
// active ones, but the swapped versions of those.
|
|
2954
|
+
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
2955
|
+
let stylesheetVMs = activeStyles.get(stylesheet);
|
|
2956
|
+
if (isUndefined$1(stylesheetVMs)) {
|
|
2957
|
+
stylesheetVMs = new Set();
|
|
2958
|
+
activeStyles.set(stylesheet, stylesheetVMs);
|
|
2959
|
+
}
|
|
2960
|
+
// this will allow us to keep track of the stylesheet that are
|
|
2961
|
+
// being used by a hot component
|
|
2962
|
+
stylesheetVMs.add(vm);
|
|
2963
|
+
});
|
|
2964
|
+
}
|
|
2989
2965
|
}
|
|
2990
|
-
}
|
|
2991
2966
|
}
|
|
2992
2967
|
function removeActiveVM(vm) {
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2968
|
+
if (process.env.NODE_ENV === 'production') {
|
|
2969
|
+
// this method should never leak to prod
|
|
2970
|
+
throw new ReferenceError();
|
|
2971
|
+
}
|
|
2999
2972
|
// tracking inactive component
|
|
3000
2973
|
const Ctor = vm.def.ctor;
|
|
3001
2974
|
let list = activeComponents.get(Ctor);
|
|
3002
|
-
|
|
3003
2975
|
if (!isUndefined$1(list)) {
|
|
3004
|
-
// deleting the vm from the set to avoid leaking memory
|
|
3005
|
-
list.delete(vm);
|
|
3006
|
-
} // removing inactive template
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
const tpl = vm.cmpTemplate;
|
|
3010
|
-
|
|
3011
|
-
if (tpl) {
|
|
3012
|
-
list = activeTemplates.get(tpl);
|
|
3013
|
-
|
|
3014
|
-
if (!isUndefined$1(list)) {
|
|
3015
2976
|
// deleting the vm from the set to avoid leaking memory
|
|
3016
2977
|
list.delete(vm);
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
flattenStylesheets(styles).forEach(style => {
|
|
3024
|
-
list = activeStyles.get(style);
|
|
3025
|
-
|
|
3026
|
-
if (!isUndefined$1(list)) {
|
|
2978
|
+
}
|
|
2979
|
+
// removing inactive template
|
|
2980
|
+
const tpl = vm.cmpTemplate;
|
|
2981
|
+
if (tpl) {
|
|
2982
|
+
list = activeTemplates.get(tpl);
|
|
2983
|
+
if (!isUndefined$1(list)) {
|
|
3027
2984
|
// deleting the vm from the set to avoid leaking memory
|
|
3028
2985
|
list.delete(vm);
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
2986
|
+
}
|
|
2987
|
+
// removing active styles associated to template
|
|
2988
|
+
const styles = tpl.stylesheets;
|
|
2989
|
+
if (!isUndefined$1(styles)) {
|
|
2990
|
+
flattenStylesheets(styles).forEach((style) => {
|
|
2991
|
+
list = activeStyles.get(style);
|
|
2992
|
+
if (!isUndefined$1(list)) {
|
|
2993
|
+
// deleting the vm from the set to avoid leaking memory
|
|
2994
|
+
list.delete(vm);
|
|
2995
|
+
}
|
|
2996
|
+
});
|
|
2997
|
+
}
|
|
3032
2998
|
}
|
|
3033
|
-
}
|
|
3034
2999
|
}
|
|
3035
3000
|
|
|
3036
3001
|
/*
|
|
@@ -3463,75 +3428,6 @@ function createStylesheet(vm, stylesheets) {
|
|
|
3463
3428
|
return null;
|
|
3464
3429
|
}
|
|
3465
3430
|
|
|
3466
|
-
/*
|
|
3467
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
3468
|
-
* All rights reserved.
|
|
3469
|
-
* SPDX-License-Identifier: MIT
|
|
3470
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3471
|
-
*/
|
|
3472
|
-
|
|
3473
|
-
function checkHasVM(elm) {
|
|
3474
|
-
const hasVM = !isUndefined$1(getAssociatedVMIfPresent(elm));
|
|
3475
|
-
|
|
3476
|
-
if (process.env.NODE_ENV !== 'production' && !hasVM) {
|
|
3477
|
-
// Occurs when an element is manually created with the same tag name as an existing LWC component. In that case,
|
|
3478
|
-
// we skip calling the LWC connectedCallback/disconnectedCallback logic and log an error.
|
|
3479
|
-
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.`);
|
|
3480
|
-
}
|
|
3481
|
-
|
|
3482
|
-
return hasVM;
|
|
3483
|
-
}
|
|
3484
|
-
|
|
3485
|
-
function getUpgradableConstructor(tagName, renderer) {
|
|
3486
|
-
const {
|
|
3487
|
-
getCustomElement,
|
|
3488
|
-
HTMLElementExported: RendererHTMLElement,
|
|
3489
|
-
defineCustomElement
|
|
3490
|
-
} = renderer; // Should never get a tag with upper case letter at this point, the compiler should
|
|
3491
|
-
// produce only tags with lowercase letters
|
|
3492
|
-
// But, for backwards compatibility, we will lower case the tagName
|
|
3493
|
-
|
|
3494
|
-
tagName = tagName.toLowerCase();
|
|
3495
|
-
let CE = getCustomElement(tagName);
|
|
3496
|
-
|
|
3497
|
-
if (!isUndefined$1(CE)) {
|
|
3498
|
-
return CE;
|
|
3499
|
-
}
|
|
3500
|
-
/**
|
|
3501
|
-
* LWC Upgradable Element reference to an element that was created
|
|
3502
|
-
* via the scoped registry mechanism, and that is ready to be upgraded.
|
|
3503
|
-
*/
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
CE = class LWCUpgradableElement extends RendererHTMLElement {
|
|
3507
|
-
constructor(upgradeCallback) {
|
|
3508
|
-
super();
|
|
3509
|
-
|
|
3510
|
-
if (isFunction$1(upgradeCallback)) {
|
|
3511
|
-
upgradeCallback(this); // nothing to do with the result for now
|
|
3512
|
-
}
|
|
3513
|
-
}
|
|
3514
|
-
|
|
3515
|
-
};
|
|
3516
|
-
|
|
3517
|
-
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
3518
|
-
CE.prototype.connectedCallback = function () {
|
|
3519
|
-
if (checkHasVM(this)) {
|
|
3520
|
-
connectRootElement(this);
|
|
3521
|
-
}
|
|
3522
|
-
};
|
|
3523
|
-
|
|
3524
|
-
CE.prototype.disconnectedCallback = function () {
|
|
3525
|
-
if (checkHasVM(this)) {
|
|
3526
|
-
disconnectRootElement(this);
|
|
3527
|
-
}
|
|
3528
|
-
};
|
|
3529
|
-
}
|
|
3530
|
-
|
|
3531
|
-
defineCustomElement(tagName, CE);
|
|
3532
|
-
return CE;
|
|
3533
|
-
}
|
|
3534
|
-
|
|
3535
3431
|
/*
|
|
3536
3432
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
3537
3433
|
* All rights reserved.
|
|
@@ -3545,6 +3441,9 @@ function isVBaseElement(vnode) {
|
|
|
3545
3441
|
function isSameVnode(vnode1, vnode2) {
|
|
3546
3442
|
return vnode1.key === vnode2.key && vnode1.sel === vnode2.sel;
|
|
3547
3443
|
}
|
|
3444
|
+
function isVScopedSlotFragment(vnode) {
|
|
3445
|
+
return vnode.type === 6 /* VNodeType.ScopedSlotFragment */;
|
|
3446
|
+
}
|
|
3548
3447
|
|
|
3549
3448
|
/*
|
|
3550
3449
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -4034,7 +3933,9 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
|
4034
3933
|
sel,
|
|
4035
3934
|
owner
|
|
4036
3935
|
} = vnode;
|
|
4037
|
-
const
|
|
3936
|
+
const {
|
|
3937
|
+
createCustomElement
|
|
3938
|
+
} = renderer;
|
|
4038
3939
|
/**
|
|
4039
3940
|
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
4040
3941
|
* with a callback as the first argument, we could implement a more advanced
|
|
@@ -4043,10 +3944,25 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
|
4043
3944
|
*/
|
|
4044
3945
|
|
|
4045
3946
|
let vm;
|
|
4046
|
-
|
|
3947
|
+
|
|
3948
|
+
const upgradeCallback = elm => {
|
|
4047
3949
|
// the custom element from the registry is expecting an upgrade callback
|
|
4048
3950
|
vm = createViewModelHook(elm, vnode, renderer);
|
|
4049
|
-
}
|
|
3951
|
+
};
|
|
3952
|
+
|
|
3953
|
+
const connectedCallback = elm => {
|
|
3954
|
+
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
3955
|
+
connectRootElement(elm);
|
|
3956
|
+
}
|
|
3957
|
+
};
|
|
3958
|
+
|
|
3959
|
+
const disconnectedCallback = elm => {
|
|
3960
|
+
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
3961
|
+
disconnectRootElement(elm);
|
|
3962
|
+
}
|
|
3963
|
+
};
|
|
3964
|
+
|
|
3965
|
+
const elm = createCustomElement(sel, upgradeCallback, connectedCallback, disconnectedCallback);
|
|
4050
3966
|
vnode.elm = elm;
|
|
4051
3967
|
vnode.vm = vm;
|
|
4052
3968
|
linkNodeToShadow(elm, owner, renderer);
|
|
@@ -4054,8 +3970,6 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
|
4054
3970
|
|
|
4055
3971
|
if (vm) {
|
|
4056
3972
|
allocateChildren(vnode, vm);
|
|
4057
|
-
} else if (vnode.ctor !== UpgradableConstructor) {
|
|
4058
|
-
throw new TypeError(`Incorrect Component Constructor`);
|
|
4059
3973
|
}
|
|
4060
3974
|
|
|
4061
3975
|
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
@@ -4348,7 +4262,7 @@ function allocateChildren(vnode, vm) {
|
|
|
4348
4262
|
/* RenderMode.Light */
|
|
4349
4263
|
) {
|
|
4350
4264
|
// slow path
|
|
4351
|
-
allocateInSlot(vm, children); // save the allocated children in case this vnode is reused.
|
|
4265
|
+
allocateInSlot(vm, children, vnode.owner); // save the allocated children in case this vnode is reused.
|
|
4352
4266
|
|
|
4353
4267
|
vnode.aChildren = children; // every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
|
|
4354
4268
|
|
|
@@ -4384,13 +4298,19 @@ function createViewModelHook(elm, vnode, renderer) {
|
|
|
4384
4298
|
return vm;
|
|
4385
4299
|
}
|
|
4386
4300
|
|
|
4387
|
-
function allocateInSlot(vm, children) {
|
|
4388
|
-
var _a;
|
|
4301
|
+
function allocateInSlot(vm, children, owner) {
|
|
4302
|
+
var _a, _b;
|
|
4389
4303
|
|
|
4390
4304
|
const {
|
|
4391
|
-
cmpSlots:
|
|
4305
|
+
cmpSlots: {
|
|
4306
|
+
slotAssignments: oldSlotsMapping
|
|
4307
|
+
}
|
|
4392
4308
|
} = vm;
|
|
4393
|
-
const
|
|
4309
|
+
const cmpSlotsMapping = create(null);
|
|
4310
|
+
vm.cmpSlots = {
|
|
4311
|
+
owner,
|
|
4312
|
+
slotAssignments: cmpSlotsMapping
|
|
4313
|
+
};
|
|
4394
4314
|
|
|
4395
4315
|
for (let i = 0, len = children.length; i < len; i += 1) {
|
|
4396
4316
|
const vnode = children[i];
|
|
@@ -4402,19 +4322,21 @@ function allocateInSlot(vm, children) {
|
|
|
4402
4322
|
let slotName = '';
|
|
4403
4323
|
|
|
4404
4324
|
if (isVBaseElement(vnode)) {
|
|
4405
|
-
slotName = ((_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot)
|
|
4325
|
+
slotName = (_b = (_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) !== null && _b !== void 0 ? _b : '';
|
|
4326
|
+
} else if (isVScopedSlotFragment(vnode)) {
|
|
4327
|
+
slotName = vnode.slotName;
|
|
4406
4328
|
}
|
|
4407
4329
|
|
|
4408
|
-
const vnodes =
|
|
4330
|
+
const vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
|
|
4409
4331
|
ArrayPush$1.call(vnodes, vnode);
|
|
4410
4332
|
}
|
|
4411
4333
|
|
|
4412
4334
|
if (isFalse(vm.isDirty)) {
|
|
4413
4335
|
// We need to determine if the old allocation is really different from the new one
|
|
4414
4336
|
// and mark the vm as dirty
|
|
4415
|
-
const oldKeys = keys(
|
|
4337
|
+
const oldKeys = keys(oldSlotsMapping);
|
|
4416
4338
|
|
|
4417
|
-
if (oldKeys.length !== keys(
|
|
4339
|
+
if (oldKeys.length !== keys(cmpSlotsMapping).length) {
|
|
4418
4340
|
markComponentAsDirty(vm);
|
|
4419
4341
|
return;
|
|
4420
4342
|
}
|
|
@@ -4422,15 +4344,15 @@ function allocateInSlot(vm, children) {
|
|
|
4422
4344
|
for (let i = 0, len = oldKeys.length; i < len; i += 1) {
|
|
4423
4345
|
const key = oldKeys[i];
|
|
4424
4346
|
|
|
4425
|
-
if (isUndefined$1(
|
|
4347
|
+
if (isUndefined$1(cmpSlotsMapping[key]) || oldSlotsMapping[key].length !== cmpSlotsMapping[key].length) {
|
|
4426
4348
|
markComponentAsDirty(vm);
|
|
4427
4349
|
return;
|
|
4428
4350
|
}
|
|
4429
4351
|
|
|
4430
|
-
const oldVNodes =
|
|
4431
|
-
const vnodes =
|
|
4352
|
+
const oldVNodes = oldSlotsMapping[key];
|
|
4353
|
+
const vnodes = cmpSlotsMapping[key];
|
|
4432
4354
|
|
|
4433
|
-
for (let j = 0, a =
|
|
4355
|
+
for (let j = 0, a = cmpSlotsMapping[key].length; j < a; j += 1) {
|
|
4434
4356
|
if (oldVNodes[j] !== vnodes[j]) {
|
|
4435
4357
|
markComponentAsDirty(vm);
|
|
4436
4358
|
return;
|
|
@@ -4630,6 +4552,18 @@ const SymbolIterator = Symbol.iterator;
|
|
|
4630
4552
|
function addVNodeToChildLWC(vnode) {
|
|
4631
4553
|
ArrayPush$1.call(getVMBeingRendered().velements, vnode);
|
|
4632
4554
|
}
|
|
4555
|
+
// [s]coped [s]lot [f]actory
|
|
4556
|
+
function ssf(slotName, factory) {
|
|
4557
|
+
return {
|
|
4558
|
+
type: 6 /* VNodeType.ScopedSlotFragment */,
|
|
4559
|
+
factory,
|
|
4560
|
+
owner: getVMBeingRendered(),
|
|
4561
|
+
elm: undefined,
|
|
4562
|
+
sel: undefined,
|
|
4563
|
+
key: undefined,
|
|
4564
|
+
slotName,
|
|
4565
|
+
};
|
|
4566
|
+
}
|
|
4633
4567
|
// [st]atic node
|
|
4634
4568
|
function st(fragment, key) {
|
|
4635
4569
|
return {
|
|
@@ -4713,9 +4647,31 @@ function s(slotName, data, children, slotset) {
|
|
|
4713
4647
|
assert.isTrue(isArray$1(children), `h() 3rd argument children must be an array.`);
|
|
4714
4648
|
}
|
|
4715
4649
|
if (!isUndefined$1(slotset) &&
|
|
4716
|
-
!isUndefined$1(slotset
|
|
4717
|
-
slotset[slotName]
|
|
4718
|
-
|
|
4650
|
+
!isUndefined$1(slotset.slotAssignments) &&
|
|
4651
|
+
!isUndefined$1(slotset.slotAssignments[slotName]) &&
|
|
4652
|
+
slotset.slotAssignments[slotName].length !== 0) {
|
|
4653
|
+
children = slotset.slotAssignments[slotName].reduce((acc, vnode) => {
|
|
4654
|
+
// If the passed slot content is factory, evaluate it and use the produced vnodes
|
|
4655
|
+
if (vnode && isVScopedSlotFragment(vnode)) {
|
|
4656
|
+
const vmBeingRenderedInception = getVMBeingRendered();
|
|
4657
|
+
let children = [];
|
|
4658
|
+
// Evaluate in the scope of the slot content's owner
|
|
4659
|
+
// if a slotset is provided, there will always be an owner. The only case where owner is
|
|
4660
|
+
// undefined is for root components, but root components cannot accept slotted content
|
|
4661
|
+
setVMBeingRendered(slotset.owner);
|
|
4662
|
+
try {
|
|
4663
|
+
children = vnode.factory(data.slotData);
|
|
4664
|
+
}
|
|
4665
|
+
finally {
|
|
4666
|
+
setVMBeingRendered(vmBeingRenderedInception);
|
|
4667
|
+
}
|
|
4668
|
+
return ArrayConcat$1.call(acc, children);
|
|
4669
|
+
}
|
|
4670
|
+
else {
|
|
4671
|
+
// If the slot content is a static list of child nodes provided by the parent, nothing to do
|
|
4672
|
+
return ArrayConcat$1.call(acc, vnode);
|
|
4673
|
+
}
|
|
4674
|
+
}, []);
|
|
4719
4675
|
}
|
|
4720
4676
|
const vmBeingRendered = getVMBeingRendered();
|
|
4721
4677
|
const { renderMode, shadowMode } = vmBeingRendered;
|
|
@@ -5035,6 +4991,7 @@ const api = freeze({
|
|
|
5035
4991
|
gid,
|
|
5036
4992
|
fid,
|
|
5037
4993
|
shc,
|
|
4994
|
+
ssf,
|
|
5038
4995
|
});
|
|
5039
4996
|
|
|
5040
4997
|
/*
|
|
@@ -5137,9 +5094,9 @@ function validateSlots(vm, html) {
|
|
|
5137
5094
|
}
|
|
5138
5095
|
const { cmpSlots } = vm;
|
|
5139
5096
|
const { slots = EmptyArray } = html;
|
|
5140
|
-
for (const slotName in cmpSlots) {
|
|
5097
|
+
for (const slotName in cmpSlots.slotAssignments) {
|
|
5141
5098
|
// eslint-disable-next-line @lwc/lwc-internal/no-production-assert
|
|
5142
|
-
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}.`);
|
|
5099
|
+
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}.`);
|
|
5143
5100
|
if (slotName !== '' && ArrayIndexOf.call(slots, slotName) === -1) {
|
|
5144
5101
|
// TODO [#1297]: this should never really happen because the compiler should always validate
|
|
5145
5102
|
// eslint-disable-next-line @lwc/lwc-internal/no-production-assert
|
|
@@ -5625,7 +5582,9 @@ function createVM(elm, ctor, renderer, options) {
|
|
|
5625
5582
|
velements: EmptyArray,
|
|
5626
5583
|
cmpProps: create(null),
|
|
5627
5584
|
cmpFields: create(null),
|
|
5628
|
-
cmpSlots:
|
|
5585
|
+
cmpSlots: {
|
|
5586
|
+
slotAssignments: create(null)
|
|
5587
|
+
},
|
|
5629
5588
|
oar: create(null),
|
|
5630
5589
|
cmpTemplate: null,
|
|
5631
5590
|
hydrated: Boolean(hydrated),
|
|
@@ -6497,7 +6456,7 @@ function freezeTemplate(tmpl) {
|
|
|
6497
6456
|
});
|
|
6498
6457
|
}
|
|
6499
6458
|
}
|
|
6500
|
-
/* version: 2.
|
|
6459
|
+
/* version: 2.27.0 */
|
|
6501
6460
|
|
|
6502
6461
|
/*
|
|
6503
6462
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -6561,25 +6520,6 @@ function createElement(tagName, namespace) {
|
|
|
6561
6520
|
[HostEventListenersKey]: {},
|
|
6562
6521
|
};
|
|
6563
6522
|
}
|
|
6564
|
-
const registry = create(null);
|
|
6565
|
-
const reverseRegistry = new WeakMap();
|
|
6566
|
-
function registerCustomElement(name, ctor) {
|
|
6567
|
-
if (name !== StringToLowerCase.call(name) || registry[name]) {
|
|
6568
|
-
throw new TypeError(`Invalid Registration`);
|
|
6569
|
-
}
|
|
6570
|
-
registry[name] = ctor;
|
|
6571
|
-
reverseRegistry.set(ctor, name);
|
|
6572
|
-
}
|
|
6573
|
-
class HTMLElementImpl {
|
|
6574
|
-
constructor() {
|
|
6575
|
-
const { constructor } = this;
|
|
6576
|
-
const tagName = reverseRegistry.get(constructor);
|
|
6577
|
-
if (!tagName) {
|
|
6578
|
-
throw new TypeError(`Invalid Construction`);
|
|
6579
|
-
}
|
|
6580
|
-
return createElement(tagName);
|
|
6581
|
-
}
|
|
6582
|
-
}
|
|
6583
6523
|
const isNativeShadowDefined = false;
|
|
6584
6524
|
const isSyntheticShadowDefined = false;
|
|
6585
6525
|
function insert(node, parent, anchor) {
|
|
@@ -6808,19 +6748,34 @@ const getFirstChild = unsupportedMethod('getFirstChild');
|
|
|
6808
6748
|
const getFirstElementChild = unsupportedMethod('getFirstElementChild');
|
|
6809
6749
|
const getLastChild = unsupportedMethod('getLastChild');
|
|
6810
6750
|
const getLastElementChild = unsupportedMethod('getLastElementChild');
|
|
6811
|
-
function defineCustomElement(name, constructor, _options) {
|
|
6812
|
-
registerCustomElement(name, constructor);
|
|
6813
|
-
}
|
|
6814
|
-
function getCustomElement(name) {
|
|
6815
|
-
return registry[name];
|
|
6816
|
-
}
|
|
6817
|
-
const HTMLElementExported = HTMLElementImpl;
|
|
6818
6751
|
/* noop */
|
|
6819
6752
|
const assertInstanceOfHTMLElement = noop;
|
|
6753
|
+
const localRegistryRecord = new Map();
|
|
6754
|
+
function createUpgradableElementConstructor(tagName) {
|
|
6755
|
+
return function Ctor(upgradeCallback) {
|
|
6756
|
+
const elm = createElement(tagName);
|
|
6757
|
+
if (isFunction$1(upgradeCallback)) {
|
|
6758
|
+
upgradeCallback(elm); // nothing to do with the result for now
|
|
6759
|
+
}
|
|
6760
|
+
return elm;
|
|
6761
|
+
};
|
|
6762
|
+
}
|
|
6763
|
+
function getUpgradableElement(tagName) {
|
|
6764
|
+
let ctor = localRegistryRecord.get(tagName);
|
|
6765
|
+
if (!isUndefined$1(ctor)) {
|
|
6766
|
+
return ctor;
|
|
6767
|
+
}
|
|
6768
|
+
ctor = createUpgradableElementConstructor(tagName);
|
|
6769
|
+
localRegistryRecord.set(tagName, ctor);
|
|
6770
|
+
return ctor;
|
|
6771
|
+
}
|
|
6772
|
+
function createCustomElement(tagName, upgradeCallback) {
|
|
6773
|
+
const UpgradableConstructor = getUpgradableElement(tagName);
|
|
6774
|
+
return new UpgradableConstructor(upgradeCallback);
|
|
6775
|
+
}
|
|
6820
6776
|
const renderer = {
|
|
6821
6777
|
isNativeShadowDefined,
|
|
6822
6778
|
isSyntheticShadowDefined,
|
|
6823
|
-
HTMLElementExported,
|
|
6824
6779
|
insert,
|
|
6825
6780
|
remove,
|
|
6826
6781
|
cloneNode,
|
|
@@ -6828,6 +6783,7 @@ const renderer = {
|
|
|
6828
6783
|
createElement,
|
|
6829
6784
|
createText,
|
|
6830
6785
|
createComment,
|
|
6786
|
+
createCustomElement,
|
|
6831
6787
|
nextSibling,
|
|
6832
6788
|
attachShadow,
|
|
6833
6789
|
getProperty,
|
|
@@ -6855,8 +6811,6 @@ const renderer = {
|
|
|
6855
6811
|
isConnected,
|
|
6856
6812
|
insertStylesheet,
|
|
6857
6813
|
assertInstanceOfHTMLElement,
|
|
6858
|
-
defineCustomElement,
|
|
6859
|
-
getCustomElement,
|
|
6860
6814
|
};
|
|
6861
6815
|
|
|
6862
6816
|
/*
|
|
@@ -6967,7 +6921,7 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
6967
6921
|
*/
|
|
6968
6922
|
freeze(LightningElement);
|
|
6969
6923
|
seal(LightningElement.prototype);
|
|
6970
|
-
/* version: 2.
|
|
6924
|
+
/* version: 2.27.0 */
|
|
6971
6925
|
|
|
6972
6926
|
exports.LightningElement = LightningElement;
|
|
6973
6927
|
exports.api = api$1;
|