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
|
@@ -46,7 +46,7 @@ var LWC = (function (exports) {
|
|
|
46
46
|
*/
|
|
47
47
|
const { assign, create, defineProperties, defineProperty, freeze, getOwnPropertyDescriptor: getOwnPropertyDescriptor$1, getOwnPropertyNames: getOwnPropertyNames$1, getPrototypeOf: getPrototypeOf$1, hasOwnProperty: hasOwnProperty$1, isFrozen, keys, seal, setPrototypeOf, } = Object;
|
|
48
48
|
const { isArray: isArray$1 } = Array;
|
|
49
|
-
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;
|
|
49
|
+
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;
|
|
50
50
|
const { fromCharCode: StringFromCharCode } = String;
|
|
51
51
|
const { charCodeAt: StringCharCodeAt, replace: StringReplace, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
|
|
52
52
|
function isUndefined$1(obj) {
|
|
@@ -302,9 +302,9 @@ var LWC = (function (exports) {
|
|
|
302
302
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
303
303
|
*/
|
|
304
304
|
// Increment whenever the LWC template compiler changes
|
|
305
|
-
const LWC_VERSION = "2.
|
|
305
|
+
const LWC_VERSION = "2.27.0";
|
|
306
306
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
307
|
-
/** version: 2.
|
|
307
|
+
/** version: 2.27.0 */
|
|
308
308
|
|
|
309
309
|
/**
|
|
310
310
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -386,7 +386,7 @@ var LWC = (function (exports) {
|
|
|
386
386
|
patch$1(propName);
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
|
-
/** version: 2.
|
|
389
|
+
/** version: 2.27.0 */
|
|
390
390
|
|
|
391
391
|
/**
|
|
392
392
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -402,7 +402,6 @@ var LWC = (function (exports) {
|
|
|
402
402
|
DUMMY_TEST_FLAG: null,
|
|
403
403
|
ENABLE_ELEMENT_PATCH: null,
|
|
404
404
|
ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
|
|
405
|
-
ENABLE_HMR: null,
|
|
406
405
|
ENABLE_HTML_COLLECTIONS_PATCH: null,
|
|
407
406
|
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
408
407
|
ENABLE_MIXED_SHADOW_MODE: null,
|
|
@@ -413,6 +412,7 @@ var LWC = (function (exports) {
|
|
|
413
412
|
ENABLE_WIRE_SYNC_EMIT: null,
|
|
414
413
|
ENABLE_LIGHT_GET_ROOT_NODE_PATCH: null,
|
|
415
414
|
DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
|
|
415
|
+
ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
|
|
416
416
|
};
|
|
417
417
|
if (!_globalThis.lwcRuntimeFlags) {
|
|
418
418
|
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
|
|
@@ -466,7 +466,7 @@ var LWC = (function (exports) {
|
|
|
466
466
|
setFeatureFlag(name, value);
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
|
-
/** version: 2.
|
|
469
|
+
/** version: 2.27.0 */
|
|
470
470
|
|
|
471
471
|
/*
|
|
472
472
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -1940,7 +1940,9 @@ var LWC = (function (exports) {
|
|
|
1940
1940
|
const LightningElement = function () {
|
|
1941
1941
|
// This should be as performant as possible, while any initialization should be done lazily
|
|
1942
1942
|
if (isNull(vmBeingConstructed)) {
|
|
1943
|
-
|
|
1943
|
+
// Thrown when doing something like `new LightningElement()` or
|
|
1944
|
+
// `class Foo extends LightningElement {}; new Foo()`
|
|
1945
|
+
throw new TypeError('Illegal constructor');
|
|
1944
1946
|
}
|
|
1945
1947
|
const vm = vmBeingConstructed;
|
|
1946
1948
|
const { def, elm } = vm;
|
|
@@ -2989,274 +2991,213 @@ var LWC = (function (exports) {
|
|
|
2989
2991
|
const activeTemplates = new WeakMap();
|
|
2990
2992
|
const activeComponents = new WeakMap();
|
|
2991
2993
|
const activeStyles = new WeakMap();
|
|
2992
|
-
|
|
2993
2994
|
function rehydrateHotTemplate(tpl) {
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
return true;
|
|
2995
|
+
const list = activeTemplates.get(tpl);
|
|
2996
|
+
if (!isUndefined$1(list)) {
|
|
2997
|
+
list.forEach((vm) => {
|
|
2998
|
+
if (isFalse(vm.isDirty)) {
|
|
2999
|
+
// forcing the vm to rehydrate in the micro-task:
|
|
3000
|
+
markComponentAsDirty(vm);
|
|
3001
|
+
scheduleRehydration(vm);
|
|
3002
|
+
}
|
|
3003
|
+
});
|
|
3004
|
+
// resetting the Set to release the memory of those vm references
|
|
3005
|
+
// since they are not longer related to this template, instead
|
|
3006
|
+
// they will get re-associated once these instances are rehydrated.
|
|
3007
|
+
list.clear();
|
|
3008
|
+
}
|
|
3009
|
+
return true;
|
|
3011
3010
|
}
|
|
3012
|
-
|
|
3013
3011
|
function rehydrateHotStyle(style) {
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
return true;
|
|
3012
|
+
const list = activeStyles.get(style);
|
|
3013
|
+
if (!isUndefined$1(list)) {
|
|
3014
|
+
list.forEach((vm) => {
|
|
3015
|
+
// if a style definition is swapped, we must reset
|
|
3016
|
+
// vm's template content in the next micro-task:
|
|
3017
|
+
forceRehydration(vm);
|
|
3018
|
+
});
|
|
3019
|
+
// resetting the Set to release the memory of those vm references
|
|
3020
|
+
// since they are not longer related to this style, instead
|
|
3021
|
+
// they will get re-associated once these instances are rehydrated.
|
|
3022
|
+
list.clear();
|
|
3023
|
+
}
|
|
3024
|
+
return true;
|
|
3029
3025
|
}
|
|
3030
|
-
|
|
3031
3026
|
function rehydrateHotComponent(Ctor) {
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
list.clear();
|
|
3059
|
-
}
|
|
3060
|
-
|
|
3061
|
-
return canRefreshAllInstances;
|
|
3027
|
+
const list = activeComponents.get(Ctor);
|
|
3028
|
+
let canRefreshAllInstances = true;
|
|
3029
|
+
if (!isUndefined$1(list)) {
|
|
3030
|
+
list.forEach((vm) => {
|
|
3031
|
+
const { owner } = vm;
|
|
3032
|
+
if (!isNull(owner)) {
|
|
3033
|
+
// if a component class definition is swapped, we must reset
|
|
3034
|
+
// owner's template content in the next micro-task:
|
|
3035
|
+
forceRehydration(owner);
|
|
3036
|
+
}
|
|
3037
|
+
else {
|
|
3038
|
+
// the hot swapping for components only work for instances of components
|
|
3039
|
+
// created from a template, root elements can't be swapped because we
|
|
3040
|
+
// don't have a way to force the creation of the element with the same state
|
|
3041
|
+
// of the current element.
|
|
3042
|
+
// Instead, we can report the problem to the caller so it can take action,
|
|
3043
|
+
// for example: reload the entire page.
|
|
3044
|
+
canRefreshAllInstances = false;
|
|
3045
|
+
}
|
|
3046
|
+
});
|
|
3047
|
+
// resetting the Set to release the memory of those vm references
|
|
3048
|
+
// since they are not longer related to this constructor, instead
|
|
3049
|
+
// they will get re-associated once these instances are rehydrated.
|
|
3050
|
+
list.clear();
|
|
3051
|
+
}
|
|
3052
|
+
return canRefreshAllInstances;
|
|
3062
3053
|
}
|
|
3063
|
-
|
|
3064
3054
|
function getTemplateOrSwappedTemplate(tpl) {
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
3055
|
+
if (process.env.NODE_ENV === 'production') {
|
|
3056
|
+
// this method should never leak to prod
|
|
3057
|
+
throw new ReferenceError();
|
|
3058
|
+
}
|
|
3071
3059
|
const visited = new Set();
|
|
3072
|
-
|
|
3073
3060
|
while (swappedTemplateMap.has(tpl) && !visited.has(tpl)) {
|
|
3074
|
-
|
|
3075
|
-
|
|
3061
|
+
visited.add(tpl);
|
|
3062
|
+
tpl = swappedTemplateMap.get(tpl);
|
|
3076
3063
|
}
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
return tpl;
|
|
3064
|
+
return tpl;
|
|
3080
3065
|
}
|
|
3081
3066
|
function getComponentOrSwappedComponent(Ctor) {
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
3067
|
+
if (process.env.NODE_ENV === 'production') {
|
|
3068
|
+
// this method should never leak to prod
|
|
3069
|
+
throw new ReferenceError();
|
|
3070
|
+
}
|
|
3088
3071
|
const visited = new Set();
|
|
3089
|
-
|
|
3090
3072
|
while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {
|
|
3091
|
-
|
|
3092
|
-
|
|
3073
|
+
visited.add(Ctor);
|
|
3074
|
+
Ctor = swappedComponentMap.get(Ctor);
|
|
3093
3075
|
}
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
return Ctor;
|
|
3076
|
+
return Ctor;
|
|
3097
3077
|
}
|
|
3098
3078
|
function getStyleOrSwappedStyle(style) {
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
3079
|
+
if (process.env.NODE_ENV === 'production') {
|
|
3080
|
+
// this method should never leak to prod
|
|
3081
|
+
throw new ReferenceError();
|
|
3082
|
+
}
|
|
3105
3083
|
const visited = new Set();
|
|
3106
|
-
|
|
3107
3084
|
while (swappedStyleMap.has(style) && !visited.has(style)) {
|
|
3108
|
-
|
|
3109
|
-
|
|
3085
|
+
visited.add(style);
|
|
3086
|
+
style = swappedStyleMap.get(style);
|
|
3110
3087
|
}
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
return style;
|
|
3088
|
+
return style;
|
|
3114
3089
|
}
|
|
3115
3090
|
function setActiveVM(vm) {
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
3091
|
+
if (process.env.NODE_ENV === 'production') {
|
|
3092
|
+
// this method should never leak to prod
|
|
3093
|
+
throw new ReferenceError();
|
|
3094
|
+
}
|
|
3122
3095
|
// tracking active component
|
|
3123
3096
|
const Ctor = vm.def.ctor;
|
|
3124
3097
|
let componentVMs = activeComponents.get(Ctor);
|
|
3125
|
-
|
|
3126
3098
|
if (isUndefined$1(componentVMs)) {
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
}
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3099
|
+
componentVMs = new Set();
|
|
3100
|
+
activeComponents.set(Ctor, componentVMs);
|
|
3101
|
+
}
|
|
3102
|
+
// this will allow us to keep track of the hot components
|
|
3103
|
+
componentVMs.add(vm);
|
|
3104
|
+
// tracking active template
|
|
3134
3105
|
const tpl = vm.cmpTemplate;
|
|
3135
|
-
|
|
3136
3106
|
if (tpl) {
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
stylesheetVMs.add(vm);
|
|
3167
|
-
});
|
|
3168
|
-
}
|
|
3107
|
+
let templateVMs = activeTemplates.get(tpl);
|
|
3108
|
+
if (isUndefined$1(templateVMs)) {
|
|
3109
|
+
templateVMs = new Set();
|
|
3110
|
+
activeTemplates.set(tpl, templateVMs);
|
|
3111
|
+
}
|
|
3112
|
+
// this will allow us to keep track of the templates that are
|
|
3113
|
+
// being used by a hot component
|
|
3114
|
+
templateVMs.add(vm);
|
|
3115
|
+
// tracking active styles associated to template
|
|
3116
|
+
const stylesheets = tpl.stylesheets;
|
|
3117
|
+
if (!isUndefined$1(stylesheets)) {
|
|
3118
|
+
flattenStylesheets(stylesheets).forEach((stylesheet) => {
|
|
3119
|
+
// this is necessary because we don't hold the list of styles
|
|
3120
|
+
// in the vm, we only hold the selected (already swapped template)
|
|
3121
|
+
// but the styles attached to the template might not be the actual
|
|
3122
|
+
// active ones, but the swapped versions of those.
|
|
3123
|
+
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
3124
|
+
let stylesheetVMs = activeStyles.get(stylesheet);
|
|
3125
|
+
if (isUndefined$1(stylesheetVMs)) {
|
|
3126
|
+
stylesheetVMs = new Set();
|
|
3127
|
+
activeStyles.set(stylesheet, stylesheetVMs);
|
|
3128
|
+
}
|
|
3129
|
+
// this will allow us to keep track of the stylesheet that are
|
|
3130
|
+
// being used by a hot component
|
|
3131
|
+
stylesheetVMs.add(vm);
|
|
3132
|
+
});
|
|
3133
|
+
}
|
|
3169
3134
|
}
|
|
3170
|
-
}
|
|
3171
3135
|
}
|
|
3172
3136
|
function removeActiveVM(vm) {
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
3137
|
+
if (process.env.NODE_ENV === 'production') {
|
|
3138
|
+
// this method should never leak to prod
|
|
3139
|
+
throw new ReferenceError();
|
|
3140
|
+
}
|
|
3179
3141
|
// tracking inactive component
|
|
3180
3142
|
const Ctor = vm.def.ctor;
|
|
3181
3143
|
let list = activeComponents.get(Ctor);
|
|
3182
|
-
|
|
3183
3144
|
if (!isUndefined$1(list)) {
|
|
3184
|
-
// deleting the vm from the set to avoid leaking memory
|
|
3185
|
-
list.delete(vm);
|
|
3186
|
-
} // removing inactive template
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
const tpl = vm.cmpTemplate;
|
|
3190
|
-
|
|
3191
|
-
if (tpl) {
|
|
3192
|
-
list = activeTemplates.get(tpl);
|
|
3193
|
-
|
|
3194
|
-
if (!isUndefined$1(list)) {
|
|
3195
3145
|
// deleting the vm from the set to avoid leaking memory
|
|
3196
3146
|
list.delete(vm);
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
flattenStylesheets(styles).forEach(style => {
|
|
3204
|
-
list = activeStyles.get(style);
|
|
3205
|
-
|
|
3206
|
-
if (!isUndefined$1(list)) {
|
|
3147
|
+
}
|
|
3148
|
+
// removing inactive template
|
|
3149
|
+
const tpl = vm.cmpTemplate;
|
|
3150
|
+
if (tpl) {
|
|
3151
|
+
list = activeTemplates.get(tpl);
|
|
3152
|
+
if (!isUndefined$1(list)) {
|
|
3207
3153
|
// deleting the vm from the set to avoid leaking memory
|
|
3208
3154
|
list.delete(vm);
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3155
|
+
}
|
|
3156
|
+
// removing active styles associated to template
|
|
3157
|
+
const styles = tpl.stylesheets;
|
|
3158
|
+
if (!isUndefined$1(styles)) {
|
|
3159
|
+
flattenStylesheets(styles).forEach((style) => {
|
|
3160
|
+
list = activeStyles.get(style);
|
|
3161
|
+
if (!isUndefined$1(list)) {
|
|
3162
|
+
// deleting the vm from the set to avoid leaking memory
|
|
3163
|
+
list.delete(vm);
|
|
3164
|
+
}
|
|
3165
|
+
});
|
|
3166
|
+
}
|
|
3212
3167
|
}
|
|
3213
|
-
}
|
|
3214
3168
|
}
|
|
3215
3169
|
function swapTemplate(oldTpl, newTpl) {
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3170
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3171
|
+
if (isTemplateRegistered(oldTpl) && isTemplateRegistered(newTpl)) {
|
|
3172
|
+
swappedTemplateMap.set(oldTpl, newTpl);
|
|
3173
|
+
return rehydrateHotTemplate(oldTpl);
|
|
3174
|
+
}
|
|
3175
|
+
else {
|
|
3176
|
+
throw new TypeError(`Invalid Template`);
|
|
3177
|
+
}
|
|
3222
3178
|
}
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
if (!lwcRuntimeFlags.ENABLE_HMR) {
|
|
3226
|
-
throw new Error('HMR is not enabled');
|
|
3227
|
-
}
|
|
3228
|
-
|
|
3229
|
-
return false;
|
|
3179
|
+
return false;
|
|
3230
3180
|
}
|
|
3231
3181
|
function swapComponent(oldComponent, newComponent) {
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3182
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3183
|
+
if (isComponentConstructor(oldComponent) && isComponentConstructor(newComponent)) {
|
|
3184
|
+
swappedComponentMap.set(oldComponent, newComponent);
|
|
3185
|
+
return rehydrateHotComponent(oldComponent);
|
|
3186
|
+
}
|
|
3187
|
+
else {
|
|
3188
|
+
throw new TypeError(`Invalid Component`);
|
|
3189
|
+
}
|
|
3238
3190
|
}
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
if (!lwcRuntimeFlags.ENABLE_HMR) {
|
|
3242
|
-
throw new Error('HMR is not enabled');
|
|
3243
|
-
}
|
|
3244
|
-
|
|
3245
|
-
return false;
|
|
3191
|
+
return false;
|
|
3246
3192
|
}
|
|
3247
3193
|
function swapStyle(oldStyle, newStyle) {
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
if (!lwcRuntimeFlags.ENABLE_HMR) {
|
|
3256
|
-
throw new Error('HMR is not enabled');
|
|
3257
|
-
}
|
|
3258
|
-
|
|
3259
|
-
return false;
|
|
3194
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3195
|
+
// TODO [#1887]: once the support for registering styles is implemented
|
|
3196
|
+
// we can add the validation of both styles around this block.
|
|
3197
|
+
swappedStyleMap.set(oldStyle, newStyle);
|
|
3198
|
+
return rehydrateHotStyle(oldStyle);
|
|
3199
|
+
}
|
|
3200
|
+
return false;
|
|
3260
3201
|
}
|
|
3261
3202
|
|
|
3262
3203
|
/*
|
|
@@ -3667,15 +3608,18 @@ var LWC = (function (exports) {
|
|
|
3667
3608
|
/**
|
|
3668
3609
|
* This function returns the host style token for a custom element if it
|
|
3669
3610
|
* exists. Otherwise it returns null.
|
|
3611
|
+
*
|
|
3612
|
+
* A host style token is applied to the component if scoped styles are used.
|
|
3670
3613
|
*/
|
|
3671
3614
|
|
|
3672
3615
|
function getStylesheetTokenHost(vnode) {
|
|
3673
3616
|
const {
|
|
3674
|
-
template
|
|
3675
|
-
stylesheetToken
|
|
3676
|
-
}
|
|
3617
|
+
template
|
|
3677
3618
|
} = getComponentInternalDef(vnode.ctor);
|
|
3678
|
-
|
|
3619
|
+
const {
|
|
3620
|
+
stylesheetToken
|
|
3621
|
+
} = template;
|
|
3622
|
+
return !isUndefined$1(stylesheetToken) && computeHasScopedStyles(template) ? makeHostToken(stylesheetToken) : null;
|
|
3679
3623
|
}
|
|
3680
3624
|
|
|
3681
3625
|
function getNearestNativeShadowComponent(vm) {
|
|
@@ -3729,75 +3673,6 @@ var LWC = (function (exports) {
|
|
|
3729
3673
|
return null;
|
|
3730
3674
|
}
|
|
3731
3675
|
|
|
3732
|
-
/*
|
|
3733
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
3734
|
-
* All rights reserved.
|
|
3735
|
-
* SPDX-License-Identifier: MIT
|
|
3736
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3737
|
-
*/
|
|
3738
|
-
|
|
3739
|
-
function checkHasVM(elm) {
|
|
3740
|
-
const hasVM = !isUndefined$1(getAssociatedVMIfPresent(elm));
|
|
3741
|
-
|
|
3742
|
-
if (process.env.NODE_ENV !== 'production' && !hasVM) {
|
|
3743
|
-
// Occurs when an element is manually created with the same tag name as an existing LWC component. In that case,
|
|
3744
|
-
// we skip calling the LWC connectedCallback/disconnectedCallback logic and log an error.
|
|
3745
|
-
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.`);
|
|
3746
|
-
}
|
|
3747
|
-
|
|
3748
|
-
return hasVM;
|
|
3749
|
-
}
|
|
3750
|
-
|
|
3751
|
-
function getUpgradableConstructor(tagName, renderer) {
|
|
3752
|
-
const {
|
|
3753
|
-
getCustomElement,
|
|
3754
|
-
HTMLElementExported: RendererHTMLElement,
|
|
3755
|
-
defineCustomElement
|
|
3756
|
-
} = renderer; // Should never get a tag with upper case letter at this point, the compiler should
|
|
3757
|
-
// produce only tags with lowercase letters
|
|
3758
|
-
// But, for backwards compatibility, we will lower case the tagName
|
|
3759
|
-
|
|
3760
|
-
tagName = tagName.toLowerCase();
|
|
3761
|
-
let CE = getCustomElement(tagName);
|
|
3762
|
-
|
|
3763
|
-
if (!isUndefined$1(CE)) {
|
|
3764
|
-
return CE;
|
|
3765
|
-
}
|
|
3766
|
-
/**
|
|
3767
|
-
* LWC Upgradable Element reference to an element that was created
|
|
3768
|
-
* via the scoped registry mechanism, and that is ready to be upgraded.
|
|
3769
|
-
*/
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
CE = class LWCUpgradableElement extends RendererHTMLElement {
|
|
3773
|
-
constructor(upgradeCallback) {
|
|
3774
|
-
super();
|
|
3775
|
-
|
|
3776
|
-
if (isFunction$1(upgradeCallback)) {
|
|
3777
|
-
upgradeCallback(this); // nothing to do with the result for now
|
|
3778
|
-
}
|
|
3779
|
-
}
|
|
3780
|
-
|
|
3781
|
-
};
|
|
3782
|
-
|
|
3783
|
-
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
3784
|
-
CE.prototype.connectedCallback = function () {
|
|
3785
|
-
if (checkHasVM(this)) {
|
|
3786
|
-
connectRootElement(this);
|
|
3787
|
-
}
|
|
3788
|
-
};
|
|
3789
|
-
|
|
3790
|
-
CE.prototype.disconnectedCallback = function () {
|
|
3791
|
-
if (checkHasVM(this)) {
|
|
3792
|
-
disconnectRootElement(this);
|
|
3793
|
-
}
|
|
3794
|
-
};
|
|
3795
|
-
}
|
|
3796
|
-
|
|
3797
|
-
defineCustomElement(tagName, CE);
|
|
3798
|
-
return CE;
|
|
3799
|
-
}
|
|
3800
|
-
|
|
3801
3676
|
/*
|
|
3802
3677
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
3803
3678
|
* All rights reserved.
|
|
@@ -3814,6 +3689,9 @@ var LWC = (function (exports) {
|
|
|
3814
3689
|
function isVCustomElement(vnode) {
|
|
3815
3690
|
return vnode.type === 3 /* VNodeType.CustomElement */;
|
|
3816
3691
|
}
|
|
3692
|
+
function isVScopedSlotFragment(vnode) {
|
|
3693
|
+
return vnode.type === 6 /* VNodeType.ScopedSlotFragment */;
|
|
3694
|
+
}
|
|
3817
3695
|
|
|
3818
3696
|
/*
|
|
3819
3697
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -4311,7 +4189,9 @@ var LWC = (function (exports) {
|
|
|
4311
4189
|
sel,
|
|
4312
4190
|
owner
|
|
4313
4191
|
} = vnode;
|
|
4314
|
-
const
|
|
4192
|
+
const {
|
|
4193
|
+
createCustomElement
|
|
4194
|
+
} = renderer;
|
|
4315
4195
|
/**
|
|
4316
4196
|
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
4317
4197
|
* with a callback as the first argument, we could implement a more advanced
|
|
@@ -4320,10 +4200,25 @@ var LWC = (function (exports) {
|
|
|
4320
4200
|
*/
|
|
4321
4201
|
|
|
4322
4202
|
let vm;
|
|
4323
|
-
|
|
4203
|
+
|
|
4204
|
+
const upgradeCallback = elm => {
|
|
4324
4205
|
// the custom element from the registry is expecting an upgrade callback
|
|
4325
4206
|
vm = createViewModelHook(elm, vnode, renderer);
|
|
4326
|
-
}
|
|
4207
|
+
};
|
|
4208
|
+
|
|
4209
|
+
const connectedCallback = elm => {
|
|
4210
|
+
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
4211
|
+
connectRootElement(elm);
|
|
4212
|
+
}
|
|
4213
|
+
};
|
|
4214
|
+
|
|
4215
|
+
const disconnectedCallback = elm => {
|
|
4216
|
+
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
4217
|
+
disconnectRootElement(elm);
|
|
4218
|
+
}
|
|
4219
|
+
};
|
|
4220
|
+
|
|
4221
|
+
const elm = createCustomElement(sel, upgradeCallback, connectedCallback, disconnectedCallback);
|
|
4327
4222
|
vnode.elm = elm;
|
|
4328
4223
|
vnode.vm = vm;
|
|
4329
4224
|
linkNodeToShadow(elm, owner, renderer);
|
|
@@ -4331,8 +4226,6 @@ var LWC = (function (exports) {
|
|
|
4331
4226
|
|
|
4332
4227
|
if (vm) {
|
|
4333
4228
|
allocateChildren(vnode, vm);
|
|
4334
|
-
} else if (vnode.ctor !== UpgradableConstructor) {
|
|
4335
|
-
throw new TypeError(`Incorrect Component Constructor`);
|
|
4336
4229
|
}
|
|
4337
4230
|
|
|
4338
4231
|
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
@@ -4633,7 +4526,7 @@ var LWC = (function (exports) {
|
|
|
4633
4526
|
/* RenderMode.Light */
|
|
4634
4527
|
) {
|
|
4635
4528
|
// slow path
|
|
4636
|
-
allocateInSlot(vm, children); // save the allocated children in case this vnode is reused.
|
|
4529
|
+
allocateInSlot(vm, children, vnode.owner); // save the allocated children in case this vnode is reused.
|
|
4637
4530
|
|
|
4638
4531
|
vnode.aChildren = children; // every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
|
|
4639
4532
|
|
|
@@ -4669,13 +4562,19 @@ var LWC = (function (exports) {
|
|
|
4669
4562
|
return vm;
|
|
4670
4563
|
}
|
|
4671
4564
|
|
|
4672
|
-
function allocateInSlot(vm, children) {
|
|
4673
|
-
var _a;
|
|
4565
|
+
function allocateInSlot(vm, children, owner) {
|
|
4566
|
+
var _a, _b;
|
|
4674
4567
|
|
|
4675
4568
|
const {
|
|
4676
|
-
cmpSlots:
|
|
4569
|
+
cmpSlots: {
|
|
4570
|
+
slotAssignments: oldSlotsMapping
|
|
4571
|
+
}
|
|
4677
4572
|
} = vm;
|
|
4678
|
-
const
|
|
4573
|
+
const cmpSlotsMapping = create(null);
|
|
4574
|
+
vm.cmpSlots = {
|
|
4575
|
+
owner,
|
|
4576
|
+
slotAssignments: cmpSlotsMapping
|
|
4577
|
+
};
|
|
4679
4578
|
|
|
4680
4579
|
for (let i = 0, len = children.length; i < len; i += 1) {
|
|
4681
4580
|
const vnode = children[i];
|
|
@@ -4687,19 +4586,21 @@ var LWC = (function (exports) {
|
|
|
4687
4586
|
let slotName = '';
|
|
4688
4587
|
|
|
4689
4588
|
if (isVBaseElement(vnode)) {
|
|
4690
|
-
slotName = ((_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot)
|
|
4589
|
+
slotName = (_b = (_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) !== null && _b !== void 0 ? _b : '';
|
|
4590
|
+
} else if (isVScopedSlotFragment(vnode)) {
|
|
4591
|
+
slotName = vnode.slotName;
|
|
4691
4592
|
}
|
|
4692
4593
|
|
|
4693
|
-
const vnodes =
|
|
4594
|
+
const vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
|
|
4694
4595
|
ArrayPush$1.call(vnodes, vnode);
|
|
4695
4596
|
}
|
|
4696
4597
|
|
|
4697
4598
|
if (isFalse(vm.isDirty)) {
|
|
4698
4599
|
// We need to determine if the old allocation is really different from the new one
|
|
4699
4600
|
// and mark the vm as dirty
|
|
4700
|
-
const oldKeys = keys(
|
|
4601
|
+
const oldKeys = keys(oldSlotsMapping);
|
|
4701
4602
|
|
|
4702
|
-
if (oldKeys.length !== keys(
|
|
4603
|
+
if (oldKeys.length !== keys(cmpSlotsMapping).length) {
|
|
4703
4604
|
markComponentAsDirty(vm);
|
|
4704
4605
|
return;
|
|
4705
4606
|
}
|
|
@@ -4707,15 +4608,15 @@ var LWC = (function (exports) {
|
|
|
4707
4608
|
for (let i = 0, len = oldKeys.length; i < len; i += 1) {
|
|
4708
4609
|
const key = oldKeys[i];
|
|
4709
4610
|
|
|
4710
|
-
if (isUndefined$1(
|
|
4611
|
+
if (isUndefined$1(cmpSlotsMapping[key]) || oldSlotsMapping[key].length !== cmpSlotsMapping[key].length) {
|
|
4711
4612
|
markComponentAsDirty(vm);
|
|
4712
4613
|
return;
|
|
4713
4614
|
}
|
|
4714
4615
|
|
|
4715
|
-
const oldVNodes =
|
|
4716
|
-
const vnodes =
|
|
4616
|
+
const oldVNodes = oldSlotsMapping[key];
|
|
4617
|
+
const vnodes = cmpSlotsMapping[key];
|
|
4717
4618
|
|
|
4718
|
-
for (let j = 0, a =
|
|
4619
|
+
for (let j = 0, a = cmpSlotsMapping[key].length; j < a; j += 1) {
|
|
4719
4620
|
if (oldVNodes[j] !== vnodes[j]) {
|
|
4720
4621
|
markComponentAsDirty(vm);
|
|
4721
4622
|
return;
|
|
@@ -4915,6 +4816,18 @@ var LWC = (function (exports) {
|
|
|
4915
4816
|
function addVNodeToChildLWC(vnode) {
|
|
4916
4817
|
ArrayPush$1.call(getVMBeingRendered().velements, vnode);
|
|
4917
4818
|
}
|
|
4819
|
+
// [s]coped [s]lot [f]actory
|
|
4820
|
+
function ssf(slotName, factory) {
|
|
4821
|
+
return {
|
|
4822
|
+
type: 6 /* VNodeType.ScopedSlotFragment */,
|
|
4823
|
+
factory,
|
|
4824
|
+
owner: getVMBeingRendered(),
|
|
4825
|
+
elm: undefined,
|
|
4826
|
+
sel: undefined,
|
|
4827
|
+
key: undefined,
|
|
4828
|
+
slotName,
|
|
4829
|
+
};
|
|
4830
|
+
}
|
|
4918
4831
|
// [st]atic node
|
|
4919
4832
|
function st(fragment, key) {
|
|
4920
4833
|
return {
|
|
@@ -4998,9 +4911,31 @@ var LWC = (function (exports) {
|
|
|
4998
4911
|
assert.isTrue(isArray$1(children), `h() 3rd argument children must be an array.`);
|
|
4999
4912
|
}
|
|
5000
4913
|
if (!isUndefined$1(slotset) &&
|
|
5001
|
-
!isUndefined$1(slotset
|
|
5002
|
-
slotset[slotName]
|
|
5003
|
-
|
|
4914
|
+
!isUndefined$1(slotset.slotAssignments) &&
|
|
4915
|
+
!isUndefined$1(slotset.slotAssignments[slotName]) &&
|
|
4916
|
+
slotset.slotAssignments[slotName].length !== 0) {
|
|
4917
|
+
children = slotset.slotAssignments[slotName].reduce((acc, vnode) => {
|
|
4918
|
+
// If the passed slot content is factory, evaluate it and use the produced vnodes
|
|
4919
|
+
if (vnode && isVScopedSlotFragment(vnode)) {
|
|
4920
|
+
const vmBeingRenderedInception = getVMBeingRendered();
|
|
4921
|
+
let children = [];
|
|
4922
|
+
// Evaluate in the scope of the slot content's owner
|
|
4923
|
+
// if a slotset is provided, there will always be an owner. The only case where owner is
|
|
4924
|
+
// undefined is for root components, but root components cannot accept slotted content
|
|
4925
|
+
setVMBeingRendered(slotset.owner);
|
|
4926
|
+
try {
|
|
4927
|
+
children = vnode.factory(data.slotData);
|
|
4928
|
+
}
|
|
4929
|
+
finally {
|
|
4930
|
+
setVMBeingRendered(vmBeingRenderedInception);
|
|
4931
|
+
}
|
|
4932
|
+
return ArrayConcat$1.call(acc, children);
|
|
4933
|
+
}
|
|
4934
|
+
else {
|
|
4935
|
+
// If the slot content is a static list of child nodes provided by the parent, nothing to do
|
|
4936
|
+
return ArrayConcat$1.call(acc, vnode);
|
|
4937
|
+
}
|
|
4938
|
+
}, []);
|
|
5004
4939
|
}
|
|
5005
4940
|
const vmBeingRendered = getVMBeingRendered();
|
|
5006
4941
|
const { renderMode, shadowMode } = vmBeingRendered;
|
|
@@ -5320,6 +5255,7 @@ var LWC = (function (exports) {
|
|
|
5320
5255
|
gid,
|
|
5321
5256
|
fid,
|
|
5322
5257
|
shc,
|
|
5258
|
+
ssf,
|
|
5323
5259
|
});
|
|
5324
5260
|
|
|
5325
5261
|
/*
|
|
@@ -5456,9 +5392,9 @@ var LWC = (function (exports) {
|
|
|
5456
5392
|
}
|
|
5457
5393
|
const { cmpSlots } = vm;
|
|
5458
5394
|
const { slots = EmptyArray } = html;
|
|
5459
|
-
for (const slotName in cmpSlots) {
|
|
5395
|
+
for (const slotName in cmpSlots.slotAssignments) {
|
|
5460
5396
|
// eslint-disable-next-line @lwc/lwc-internal/no-production-assert
|
|
5461
|
-
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}.`);
|
|
5397
|
+
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}.`);
|
|
5462
5398
|
if (slotName !== '' && ArrayIndexOf.call(slots, slotName) === -1) {
|
|
5463
5399
|
// TODO [#1297]: this should never really happen because the compiler should always validate
|
|
5464
5400
|
// eslint-disable-next-line @lwc/lwc-internal/no-production-assert
|
|
@@ -5955,7 +5891,9 @@ var LWC = (function (exports) {
|
|
|
5955
5891
|
velements: EmptyArray,
|
|
5956
5892
|
cmpProps: create(null),
|
|
5957
5893
|
cmpFields: create(null),
|
|
5958
|
-
cmpSlots:
|
|
5894
|
+
cmpSlots: {
|
|
5895
|
+
slotAssignments: create(null)
|
|
5896
|
+
},
|
|
5959
5897
|
oar: create(null),
|
|
5960
5898
|
cmpTemplate: null,
|
|
5961
5899
|
hydrated: Boolean(hydrated),
|
|
@@ -7106,19 +7044,23 @@ var LWC = (function (exports) {
|
|
|
7106
7044
|
//
|
|
7107
7045
|
// Consequently, hydration mismatches will occur if scoped CSS token classnames
|
|
7108
7046
|
// are rendered during SSR. This needs to be accounted for when validating.
|
|
7109
|
-
if (scopedToken) {
|
|
7047
|
+
if (!isNull(scopedToken) || !isNull(stylesheetTokenHost)) {
|
|
7110
7048
|
if (!isUndefined$1(className)) {
|
|
7111
|
-
className
|
|
7112
|
-
|
|
7113
|
-
|
|
7049
|
+
// The order of the className should be scopedToken className stylesheetTokenHost
|
|
7050
|
+
const classTokens = [scopedToken, className, stylesheetTokenHost];
|
|
7051
|
+
const classNames = ArrayFilter.call(classTokens, (token) => !isNull(token));
|
|
7052
|
+
className = ArrayJoin.call(classNames, ' ');
|
|
7114
7053
|
}
|
|
7115
7054
|
else if (!isUndefined$1(classMap)) {
|
|
7116
|
-
classMap = Object.assign(Object.assign(Object.assign({}, classMap), { [scopedToken]: true }), (isNull(stylesheetTokenHost) ? {
|
|
7055
|
+
classMap = Object.assign(Object.assign(Object.assign({}, classMap), (!isNull(scopedToken) ? { [scopedToken]: true } : {})), (!isNull(stylesheetTokenHost) ? { [stylesheetTokenHost]: true } : {}));
|
|
7117
7056
|
}
|
|
7118
7057
|
else {
|
|
7119
|
-
className
|
|
7120
|
-
|
|
7121
|
-
|
|
7058
|
+
// The order of the className should be scopedToken stylesheetTokenHost
|
|
7059
|
+
const classTokens = [scopedToken, stylesheetTokenHost];
|
|
7060
|
+
const classNames = ArrayFilter.call(classTokens, (token) => !isNull(token));
|
|
7061
|
+
if (classNames.length) {
|
|
7062
|
+
className = ArrayJoin.call(classNames, ' ');
|
|
7063
|
+
}
|
|
7122
7064
|
}
|
|
7123
7065
|
}
|
|
7124
7066
|
let nodesAreCompatible = true;
|
|
@@ -7360,7 +7302,7 @@ var LWC = (function (exports) {
|
|
|
7360
7302
|
}
|
|
7361
7303
|
return ctor;
|
|
7362
7304
|
}
|
|
7363
|
-
/* version: 2.
|
|
7305
|
+
/* version: 2.27.0 */
|
|
7364
7306
|
|
|
7365
7307
|
/*
|
|
7366
7308
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7504,6 +7446,626 @@ var LWC = (function (exports) {
|
|
|
7504
7446
|
}
|
|
7505
7447
|
}
|
|
7506
7448
|
|
|
7449
|
+
/*
|
|
7450
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
7451
|
+
* All rights reserved.
|
|
7452
|
+
* SPDX-License-Identifier: MIT
|
|
7453
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7454
|
+
*/
|
|
7455
|
+
function isCustomElementRegistryAvailable() {
|
|
7456
|
+
if (typeof customElements === 'undefined') {
|
|
7457
|
+
return false;
|
|
7458
|
+
}
|
|
7459
|
+
try {
|
|
7460
|
+
// dereference HTMLElement global because babel wraps globals in compat mode with a
|
|
7461
|
+
// _wrapNativeSuper()
|
|
7462
|
+
// This is a problem because LWCUpgradableElement extends renderer.HTMLElement which does not
|
|
7463
|
+
// get wrapped by babel.
|
|
7464
|
+
const HTMLElementAlias = HTMLElement;
|
|
7465
|
+
// In case we use compat mode with a modern browser, the compat mode transformation
|
|
7466
|
+
// invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
|
|
7467
|
+
// which are not equipped to be initialized that way.
|
|
7468
|
+
class clazz extends HTMLElementAlias {
|
|
7469
|
+
}
|
|
7470
|
+
customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
|
|
7471
|
+
new clazz();
|
|
7472
|
+
return true;
|
|
7473
|
+
}
|
|
7474
|
+
catch (_a) {
|
|
7475
|
+
return false;
|
|
7476
|
+
}
|
|
7477
|
+
}
|
|
7478
|
+
const hasCustomElements = isCustomElementRegistryAvailable();
|
|
7479
|
+
|
|
7480
|
+
/*
|
|
7481
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
7482
|
+
* All rights reserved.
|
|
7483
|
+
* SPDX-License-Identifier: MIT
|
|
7484
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7485
|
+
*/
|
|
7486
|
+
// Creates a custom element for compat (legacy) browser environments
|
|
7487
|
+
const createCustomElementCompat = (tagName, upgradeCallback) => {
|
|
7488
|
+
const elm = document.createElement(tagName);
|
|
7489
|
+
upgradeCallback(elm); // nothing to do with the result for now
|
|
7490
|
+
return elm;
|
|
7491
|
+
};
|
|
7492
|
+
|
|
7493
|
+
/*
|
|
7494
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
7495
|
+
* All rights reserved.
|
|
7496
|
+
* SPDX-License-Identifier: MIT
|
|
7497
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7498
|
+
*/
|
|
7499
|
+
const cachedConstructors = new Map();
|
|
7500
|
+
const elementsUpgradedOutsideLWC = new WeakSet();
|
|
7501
|
+
let elementBeingUpgradedByLWC = false;
|
|
7502
|
+
// Creates a constructor that is intended to be used as a vanilla custom element, except that the upgradeCallback is
|
|
7503
|
+
// passed in to the constructor so LWC can reuse the same custom element constructor for multiple components.
|
|
7504
|
+
// Another benefit is that only LWC can create components that actually do anything – if you do
|
|
7505
|
+
// `customElements.define('x-foo')`, then you don't have access to the upgradeCallback, so it's a dummy custom element.
|
|
7506
|
+
// This class should be created once per tag name.
|
|
7507
|
+
const createUpgradableConstructor = (connectedCallback, disconnectedCallback) => {
|
|
7508
|
+
// TODO [#2972]: this class should expose observedAttributes as necessary
|
|
7509
|
+
return class UpgradableConstructor extends HTMLElement {
|
|
7510
|
+
constructor(upgradeCallback) {
|
|
7511
|
+
super();
|
|
7512
|
+
// If the element is not created using lwc.createElement(), e.g. `document.createElement('x-foo')`,
|
|
7513
|
+
// then elementBeingUpgraded will be false
|
|
7514
|
+
if (elementBeingUpgradedByLWC) {
|
|
7515
|
+
upgradeCallback(this);
|
|
7516
|
+
}
|
|
7517
|
+
else {
|
|
7518
|
+
// keep track of elements that were not created by lwc.createElement,
|
|
7519
|
+
// so we can ignore their lifecycle hooks
|
|
7520
|
+
elementsUpgradedOutsideLWC.add(this);
|
|
7521
|
+
// TODO [#2970]: LWC elements cannot be upgraded via new Ctor()
|
|
7522
|
+
// Do we want to support this? Throw an error? Currently for backwards compat it's a no-op.
|
|
7523
|
+
}
|
|
7524
|
+
}
|
|
7525
|
+
connectedCallback() {
|
|
7526
|
+
if (!elementsUpgradedOutsideLWC.has(this)) {
|
|
7527
|
+
connectedCallback(this);
|
|
7528
|
+
}
|
|
7529
|
+
}
|
|
7530
|
+
disconnectedCallback() {
|
|
7531
|
+
if (!elementsUpgradedOutsideLWC.has(this)) {
|
|
7532
|
+
disconnectedCallback(this);
|
|
7533
|
+
}
|
|
7534
|
+
}
|
|
7535
|
+
};
|
|
7536
|
+
};
|
|
7537
|
+
const createCustomElementVanilla = (tagName, upgradeCallback, connectedCallback, disconnectedCallback) => {
|
|
7538
|
+
// use global custom elements registry
|
|
7539
|
+
let UpgradableConstructor = cachedConstructors.get(tagName);
|
|
7540
|
+
if (isUndefined$1(UpgradableConstructor)) {
|
|
7541
|
+
if (!isUndefined$1(customElements.get(tagName))) {
|
|
7542
|
+
throw new Error(`Unexpected tag name "${tagName}". This name is a registered custom element, preventing LWC to upgrade the element.`);
|
|
7543
|
+
}
|
|
7544
|
+
UpgradableConstructor = createUpgradableConstructor(connectedCallback, disconnectedCallback);
|
|
7545
|
+
customElements.define(tagName, UpgradableConstructor);
|
|
7546
|
+
cachedConstructors.set(tagName, UpgradableConstructor);
|
|
7547
|
+
}
|
|
7548
|
+
elementBeingUpgradedByLWC = true;
|
|
7549
|
+
try {
|
|
7550
|
+
return new UpgradableConstructor(upgradeCallback);
|
|
7551
|
+
}
|
|
7552
|
+
finally {
|
|
7553
|
+
elementBeingUpgradedByLWC = false;
|
|
7554
|
+
}
|
|
7555
|
+
};
|
|
7556
|
+
|
|
7557
|
+
/*
|
|
7558
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
7559
|
+
* All rights reserved.
|
|
7560
|
+
* SPDX-License-Identifier: MIT
|
|
7561
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7562
|
+
*/
|
|
7563
|
+
/**
|
|
7564
|
+
* Create a scoped registry, i.e. a function that can create custom elements whose tag names
|
|
7565
|
+
* do not conflict with vanilla custom elements having the same tag name.
|
|
7566
|
+
*/
|
|
7567
|
+
function createScopedRegistry() {
|
|
7568
|
+
if (!hasCustomElements) {
|
|
7569
|
+
// This code should never be reached, because we don't use the pivot registry if
|
|
7570
|
+
// custom elements are unavailable.
|
|
7571
|
+
throw new Error('Custom elements are not supported in this environment.');
|
|
7572
|
+
}
|
|
7573
|
+
const { HTMLElement: NativeHTMLElement } = window;
|
|
7574
|
+
const { hasAttribute: nativeHasAttribute, setAttribute: nativeSetAttribute, removeAttribute: nativeRemoveAttribute, getAttribute: nativeGetAttribute, } = NativeHTMLElement.prototype;
|
|
7575
|
+
const definitionForElement = new WeakMap();
|
|
7576
|
+
const pendingRegistryForElement = new WeakMap();
|
|
7577
|
+
const definitionForConstructor = new WeakMap();
|
|
7578
|
+
const registeredUserCtors = new WeakSet();
|
|
7579
|
+
const pivotCtorByTag = new Map();
|
|
7580
|
+
const globalDefinitionsByTag = new Map();
|
|
7581
|
+
const globalDefinitionsByClass = new Map();
|
|
7582
|
+
const awaitingUpgrade = new Map();
|
|
7583
|
+
const EMPTY_SET = new Set();
|
|
7584
|
+
function createDefinitionRecord(constructor) {
|
|
7585
|
+
var _a;
|
|
7586
|
+
const { connectedCallback, disconnectedCallback, adoptedCallback, attributeChangedCallback, } = constructor.prototype;
|
|
7587
|
+
const observedAttributes = new Set((_a = constructor.observedAttributes) !== null && _a !== void 0 ? _a : []);
|
|
7588
|
+
return {
|
|
7589
|
+
UserCtor: constructor,
|
|
7590
|
+
PivotCtor: undefined,
|
|
7591
|
+
connectedCallback,
|
|
7592
|
+
disconnectedCallback,
|
|
7593
|
+
adoptedCallback,
|
|
7594
|
+
attributeChangedCallback,
|
|
7595
|
+
observedAttributes,
|
|
7596
|
+
};
|
|
7597
|
+
}
|
|
7598
|
+
// Helper to create stand-in element for each tagName registered that delegates out to the registry for the given
|
|
7599
|
+
// element. Note that the `registeredDefinition` represents the constructor that was used to register during
|
|
7600
|
+
// `customElements.define()`. Whereas the `pivotDefinition` represents the constructor that is passed when the pivot
|
|
7601
|
+
// constructor is invoked with another constructor.
|
|
7602
|
+
function createPivotingClass(tagName, registeredDefinition) {
|
|
7603
|
+
class PivotCtor extends NativeHTMLElement {
|
|
7604
|
+
constructor(UserCtor) {
|
|
7605
|
+
// This constructor can only be invoked by:
|
|
7606
|
+
// a) the browser instantiating an element from parsing or via document.createElement.
|
|
7607
|
+
// b) LWC new PivotClass (This constructor is NOT observable/accessible in user-land).
|
|
7608
|
+
// b) new UserClass.
|
|
7609
|
+
// When LWC instantiates it, it will pass the upgrading definition as an argument
|
|
7610
|
+
// If the caller signals via UserCtor that this is in fact a controlled
|
|
7611
|
+
// definition, we use that one, otherwise fallback to the global
|
|
7612
|
+
// internal registry.
|
|
7613
|
+
super();
|
|
7614
|
+
const userCtorIsDefined = !isUndefined$1(UserCtor);
|
|
7615
|
+
if (userCtorIsDefined) {
|
|
7616
|
+
if (!isConstructor(UserCtor)) {
|
|
7617
|
+
throw new TypeError(`Failed to create custom element: the provided constructor is not a constructor.`);
|
|
7618
|
+
}
|
|
7619
|
+
if (!registeredUserCtors.has(UserCtor)) {
|
|
7620
|
+
throw new Error(`Failed to create custom element: the provided constructor is unregistered: ${UserCtor.name}.`);
|
|
7621
|
+
}
|
|
7622
|
+
}
|
|
7623
|
+
const definition = userCtorIsDefined
|
|
7624
|
+
? getOrCreateDefinitionForConstructor(UserCtor)
|
|
7625
|
+
: globalDefinitionsByTag.get(tagName);
|
|
7626
|
+
if (!isUndefined$1(definition)) {
|
|
7627
|
+
internalUpgrade(this, registeredDefinition, definition);
|
|
7628
|
+
}
|
|
7629
|
+
else {
|
|
7630
|
+
// This is the case in which there is no global definition, and
|
|
7631
|
+
// it is not handled by LWC (otherwise it will have a valid UserCtor)
|
|
7632
|
+
// so we need to add it to the pending queue just in case it eventually
|
|
7633
|
+
// gets defined in the global registry.
|
|
7634
|
+
pendingRegistryForElement.set(this, registeredDefinition);
|
|
7635
|
+
}
|
|
7636
|
+
}
|
|
7637
|
+
connectedCallback() {
|
|
7638
|
+
var _a;
|
|
7639
|
+
const definition = definitionForElement.get(this);
|
|
7640
|
+
if (!isUndefined$1(definition)) {
|
|
7641
|
+
// Delegate out to user callback
|
|
7642
|
+
(_a = definition.connectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
7643
|
+
}
|
|
7644
|
+
else {
|
|
7645
|
+
// Register for upgrade when defined (only when connected, so we don't leak)
|
|
7646
|
+
let awaiting = awaitingUpgrade.get(tagName);
|
|
7647
|
+
if (isUndefined$1(awaiting)) {
|
|
7648
|
+
awaitingUpgrade.set(tagName, (awaiting = new Set()));
|
|
7649
|
+
}
|
|
7650
|
+
awaiting.add(this);
|
|
7651
|
+
}
|
|
7652
|
+
}
|
|
7653
|
+
disconnectedCallback() {
|
|
7654
|
+
var _a;
|
|
7655
|
+
const definition = definitionForElement.get(this);
|
|
7656
|
+
if (!isUndefined$1(definition)) {
|
|
7657
|
+
// Delegate out to user callback
|
|
7658
|
+
(_a = definition.disconnectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
7659
|
+
}
|
|
7660
|
+
else {
|
|
7661
|
+
// Un-register for upgrade when defined (so we don't leak)
|
|
7662
|
+
const awaiting = awaitingUpgrade.get(tagName);
|
|
7663
|
+
// At this point, awaiting should never be undefined, because connectedCallback
|
|
7664
|
+
// must have been called before disconnectedCallback. But just to be safe, we check
|
|
7665
|
+
if (!isUndefined$1(awaiting)) {
|
|
7666
|
+
awaiting.delete(this);
|
|
7667
|
+
}
|
|
7668
|
+
}
|
|
7669
|
+
}
|
|
7670
|
+
adoptedCallback() {
|
|
7671
|
+
var _a;
|
|
7672
|
+
const definition = definitionForElement.get(this);
|
|
7673
|
+
(_a = definition === null || definition === void 0 ? void 0 : definition.adoptedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
7674
|
+
}
|
|
7675
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
7676
|
+
var _a;
|
|
7677
|
+
const definition = definitionForElement.get(this);
|
|
7678
|
+
// if both definitions are the same, then the observedAttributes is the same,
|
|
7679
|
+
// but if they are different, only if the runtime definition has the attribute
|
|
7680
|
+
// marked as observed, then it should invoke attributeChangedCallback.
|
|
7681
|
+
if (registeredDefinition === definition ||
|
|
7682
|
+
(definition === null || definition === void 0 ? void 0 : definition.observedAttributes.has(name))) {
|
|
7683
|
+
(_a = definition.attributeChangedCallback) === null || _a === void 0 ? void 0 : _a.apply(this, [name, oldValue, newValue]);
|
|
7684
|
+
}
|
|
7685
|
+
}
|
|
7686
|
+
}
|
|
7687
|
+
PivotCtor.observedAttributes = [...registeredDefinition.observedAttributes];
|
|
7688
|
+
return PivotCtor;
|
|
7689
|
+
}
|
|
7690
|
+
function getNewObservedAttributes(registeredDefinition, pivotDefinition) {
|
|
7691
|
+
const { observedAttributes, attributeChangedCallback } = pivotDefinition;
|
|
7692
|
+
if (observedAttributes.size === 0 || isUndefined$1(attributeChangedCallback)) {
|
|
7693
|
+
// This instance does not need to observe any attributes, no need to patch
|
|
7694
|
+
return EMPTY_SET;
|
|
7695
|
+
}
|
|
7696
|
+
// Natively, the attributes observed by the registered definition are going to be taken
|
|
7697
|
+
// care of by the browser, only the difference between the two sets has to be taken
|
|
7698
|
+
// care by the patched version.
|
|
7699
|
+
return new Set([...pivotDefinition.observedAttributes].filter((x) => !registeredDefinition.observedAttributes.has(x)));
|
|
7700
|
+
}
|
|
7701
|
+
function throwAsyncError(error) {
|
|
7702
|
+
// Per native custom element behavior, errors thrown in attributeChangedCallback
|
|
7703
|
+
// become unhandled async errors. We use setTimeout() instead of Promise.resolve()
|
|
7704
|
+
// to make it an unhandled error rather than an unhandled rejection.
|
|
7705
|
+
setTimeout(() => {
|
|
7706
|
+
throw error;
|
|
7707
|
+
});
|
|
7708
|
+
}
|
|
7709
|
+
// Helper to patch `setAttribute`/`getAttribute` to implement `attributeChangedCallback`.
|
|
7710
|
+
// Why is this necessary? Well basically, you can't change the `observedAttributes` after
|
|
7711
|
+
// a custom element is defined. So with pivots, if two classes share the same tag name,
|
|
7712
|
+
// and the second class observes attributes that aren't observed by the first one,
|
|
7713
|
+
// then those attributes can never be observed by the native `observedAttributes` system.
|
|
7714
|
+
// So we have to simulate it by patching `getAttribute`/`removeAttribute`. Note that
|
|
7715
|
+
// we only do this when absolutely necessary, though; i.e. because we've determined
|
|
7716
|
+
// that we aren't observing the attributes we need to.
|
|
7717
|
+
function patchAttributes(instance, registeredDefinition, pivotDefinition) {
|
|
7718
|
+
const newObservedAttributes = getNewObservedAttributes(registeredDefinition, pivotDefinition);
|
|
7719
|
+
if (newObservedAttributes.size === 0) {
|
|
7720
|
+
return;
|
|
7721
|
+
}
|
|
7722
|
+
const { attributeChangedCallback } = pivotDefinition;
|
|
7723
|
+
// Patch the instance.
|
|
7724
|
+
// Note we use the native `getAttribute` rather than the super's `getAttribute` because
|
|
7725
|
+
// we don't actually want it to be observable that we're calling `getAttribute` from
|
|
7726
|
+
// `setAttribute` and `removeAttribute`.
|
|
7727
|
+
// TODO [#2994]: this should handle reflected properties such as `ariaLabel` and `role`.
|
|
7728
|
+
defineProperties(instance, {
|
|
7729
|
+
setAttribute: {
|
|
7730
|
+
value: function setAttribute(name, value) {
|
|
7731
|
+
if (newObservedAttributes.has(name)) {
|
|
7732
|
+
const old = nativeGetAttribute.call(this, name);
|
|
7733
|
+
nativeSetAttribute.call(this, name, value);
|
|
7734
|
+
try {
|
|
7735
|
+
attributeChangedCallback.call(this, name, old, value + '');
|
|
7736
|
+
}
|
|
7737
|
+
catch (error) {
|
|
7738
|
+
throwAsyncError(error);
|
|
7739
|
+
}
|
|
7740
|
+
}
|
|
7741
|
+
else {
|
|
7742
|
+
nativeSetAttribute.call(this, name, value);
|
|
7743
|
+
}
|
|
7744
|
+
},
|
|
7745
|
+
writable: true,
|
|
7746
|
+
enumerable: true,
|
|
7747
|
+
configurable: true,
|
|
7748
|
+
},
|
|
7749
|
+
removeAttribute: {
|
|
7750
|
+
value: function removeAttribute(name) {
|
|
7751
|
+
if (newObservedAttributes.has(name)) {
|
|
7752
|
+
const old = nativeGetAttribute.call(this, name);
|
|
7753
|
+
nativeRemoveAttribute.call(this, name);
|
|
7754
|
+
try {
|
|
7755
|
+
attributeChangedCallback.call(this, name, old, null);
|
|
7756
|
+
}
|
|
7757
|
+
catch (error) {
|
|
7758
|
+
throwAsyncError(error);
|
|
7759
|
+
}
|
|
7760
|
+
}
|
|
7761
|
+
else {
|
|
7762
|
+
nativeRemoveAttribute.call(this, name);
|
|
7763
|
+
}
|
|
7764
|
+
},
|
|
7765
|
+
writable: true,
|
|
7766
|
+
enumerable: true,
|
|
7767
|
+
configurable: true,
|
|
7768
|
+
},
|
|
7769
|
+
});
|
|
7770
|
+
}
|
|
7771
|
+
function patchAttributesDuringUpgrade(instance, registeredDefinition, pivotDefinition) {
|
|
7772
|
+
// The below case patches observed attributes for the case where the HTML element is upgraded
|
|
7773
|
+
// from a pre-existing one in the DOM.
|
|
7774
|
+
const newObservedAttributes = getNewObservedAttributes(registeredDefinition, pivotDefinition);
|
|
7775
|
+
if (getNewObservedAttributes(registeredDefinition, pivotDefinition).size === 0) {
|
|
7776
|
+
return;
|
|
7777
|
+
}
|
|
7778
|
+
const { attributeChangedCallback } = pivotDefinition;
|
|
7779
|
+
// Approximate observedAttributes from the user class, but only for the new observed attributes
|
|
7780
|
+
newObservedAttributes.forEach((name) => {
|
|
7781
|
+
if (nativeHasAttribute.call(instance, name)) {
|
|
7782
|
+
const newValue = nativeGetAttribute.call(instance, name);
|
|
7783
|
+
attributeChangedCallback.call(instance, name, null, newValue);
|
|
7784
|
+
}
|
|
7785
|
+
});
|
|
7786
|
+
}
|
|
7787
|
+
// User extends this HTMLElement, which returns the CE being upgraded
|
|
7788
|
+
let upgradingInstance;
|
|
7789
|
+
// Helper to upgrade an instance with a CE definition using "constructor call trick"
|
|
7790
|
+
function internalUpgrade(instance, registeredDefinition, pivotDefinition) {
|
|
7791
|
+
setPrototypeOf(instance, pivotDefinition.UserCtor.prototype);
|
|
7792
|
+
definitionForElement.set(instance, pivotDefinition);
|
|
7793
|
+
// attributes patches when needed
|
|
7794
|
+
if (pivotDefinition !== registeredDefinition) {
|
|
7795
|
+
patchAttributes(instance, registeredDefinition, pivotDefinition);
|
|
7796
|
+
}
|
|
7797
|
+
// Tricking the construction path to believe that a new instance is being created,
|
|
7798
|
+
// that way it will execute the super initialization mechanism but the HTMLElement
|
|
7799
|
+
// constructor will reuse the instance by returning the upgradingInstance.
|
|
7800
|
+
// This is by far the most important piece of the puzzle
|
|
7801
|
+
upgradingInstance = instance;
|
|
7802
|
+
// By `new`ing the UserCtor, we now jump to the constructor for the overridden global HTMLElement
|
|
7803
|
+
// The reason this happens is that the UserCtor extends HTMLElement, so it calls the `super()`.
|
|
7804
|
+
// Note that `upgradingInstance` is explicitly handled in the HTMLElement constructor.
|
|
7805
|
+
new pivotDefinition.UserCtor();
|
|
7806
|
+
patchAttributesDuringUpgrade(instance, registeredDefinition, pivotDefinition);
|
|
7807
|
+
}
|
|
7808
|
+
function isConstructor(constructor) {
|
|
7809
|
+
return isFunction$1(constructor) && isObject(constructor.prototype);
|
|
7810
|
+
}
|
|
7811
|
+
function getOrCreateDefinitionForConstructor(constructor) {
|
|
7812
|
+
if (!isConstructor(constructor)) {
|
|
7813
|
+
throw new TypeError('The referenced constructor is not a constructor.');
|
|
7814
|
+
}
|
|
7815
|
+
const definition = definitionForConstructor.get(constructor);
|
|
7816
|
+
if (!isUndefined$1(definition)) {
|
|
7817
|
+
return definition;
|
|
7818
|
+
}
|
|
7819
|
+
return createDefinitionRecord(constructor);
|
|
7820
|
+
}
|
|
7821
|
+
const { customElements: nativeRegistry } = window;
|
|
7822
|
+
const { define: nativeDefine, whenDefined: nativeWhenDefined, get: nativeGet } = nativeRegistry;
|
|
7823
|
+
// patch for the global registry define mechanism
|
|
7824
|
+
CustomElementRegistry.prototype.define = function define(tagName, constructor, options) {
|
|
7825
|
+
if (options && options.extends) {
|
|
7826
|
+
// TODO [#2983]: should we support `extends`?
|
|
7827
|
+
throw new DOMException('NotSupportedError: "extends" key in customElements.define() options is not supported.');
|
|
7828
|
+
}
|
|
7829
|
+
if (globalDefinitionsByTag.has(tagName)) {
|
|
7830
|
+
throw new DOMException(`Failed to execute 'define' on 'CustomElementRegistry': the name "${tagName}" has already been used with this registry`);
|
|
7831
|
+
}
|
|
7832
|
+
if (!isUndefined$1(globalDefinitionsByClass.get(constructor))) {
|
|
7833
|
+
throw new DOMException(`Failed to execute 'define' on 'CustomElementRegistry': this constructor has already been used with this registry`);
|
|
7834
|
+
}
|
|
7835
|
+
const definition = getOrCreateDefinitionForConstructor(constructor);
|
|
7836
|
+
registeredUserCtors.add(constructor);
|
|
7837
|
+
let PivotCtor = pivotCtorByTag.get(tagName);
|
|
7838
|
+
if (isUndefined$1(PivotCtor)) {
|
|
7839
|
+
PivotCtor = createPivotingClass(tagName, definition);
|
|
7840
|
+
// Register a pivoting class which will handle global registry initializations
|
|
7841
|
+
nativeDefine.call(nativeRegistry, tagName, PivotCtor);
|
|
7842
|
+
}
|
|
7843
|
+
// Only cache after nativeDefine has been called, because if it throws an error
|
|
7844
|
+
// (e.g. for an invalid tag name), then we don't want to cache anything.
|
|
7845
|
+
definitionForConstructor.set(constructor, definition);
|
|
7846
|
+
pivotCtorByTag.set(tagName, PivotCtor);
|
|
7847
|
+
globalDefinitionsByTag.set(tagName, definition);
|
|
7848
|
+
globalDefinitionsByClass.set(constructor, definition);
|
|
7849
|
+
// For globally defined custom elements, the definition associated
|
|
7850
|
+
// to the UserCtor has a back-pointer to PivotCtor in case the user
|
|
7851
|
+
// new the UserCtor, so we know how to create the underlying element.
|
|
7852
|
+
definition.PivotCtor = PivotCtor;
|
|
7853
|
+
// Upgrade any elements created in this scope before customElements.define
|
|
7854
|
+
// was called, which should be exhibited by the following steps:
|
|
7855
|
+
// 1) LWC registers a tagName for an LWC component.
|
|
7856
|
+
// 2) Element with same tagName is created with document.createElement()
|
|
7857
|
+
// and inserted into DOM.
|
|
7858
|
+
// 3) customElements.define() is called with tagName and non-LWC constructor.
|
|
7859
|
+
// This requires immediate upgrade when the new global tagName is defined.
|
|
7860
|
+
const awaiting = awaitingUpgrade.get(tagName);
|
|
7861
|
+
if (!isUndefined$1(awaiting)) {
|
|
7862
|
+
awaitingUpgrade.delete(tagName);
|
|
7863
|
+
for (const element of awaiting) {
|
|
7864
|
+
const registeredDefinition = pendingRegistryForElement.get(element);
|
|
7865
|
+
// At this point, registeredDefinition should never be undefined because awaitingUpgrade
|
|
7866
|
+
// is only populated when we haven't run internalUpgrade yet, and we only populate
|
|
7867
|
+
// pendingRegistryForElement when internalUpgrade hasn't run yet.
|
|
7868
|
+
// But just to be safe, we check.
|
|
7869
|
+
if (!isUndefined$1(registeredDefinition)) {
|
|
7870
|
+
pendingRegistryForElement.delete(element);
|
|
7871
|
+
internalUpgrade(element, registeredDefinition, definition);
|
|
7872
|
+
}
|
|
7873
|
+
}
|
|
7874
|
+
}
|
|
7875
|
+
};
|
|
7876
|
+
CustomElementRegistry.prototype.get = function get(tagName) {
|
|
7877
|
+
const NativeCtor = nativeGet.call(nativeRegistry, tagName);
|
|
7878
|
+
if (!isUndefined$1(NativeCtor)) {
|
|
7879
|
+
const definition = globalDefinitionsByTag.get(tagName);
|
|
7880
|
+
if (!isUndefined$1(definition)) {
|
|
7881
|
+
return definition.UserCtor; // defined by the patched custom elements registry
|
|
7882
|
+
}
|
|
7883
|
+
// TODO [#3073]: return undefined rather than the pivot constructor (NativeCtor)
|
|
7884
|
+
return NativeCtor; // return the pivot constructor or constructor that existed before patching
|
|
7885
|
+
}
|
|
7886
|
+
};
|
|
7887
|
+
CustomElementRegistry.prototype.whenDefined = function whenDefined(tagName) {
|
|
7888
|
+
return nativeWhenDefined.call(nativeRegistry, tagName).then((NativeCtor) => {
|
|
7889
|
+
const definition = globalDefinitionsByTag.get(tagName);
|
|
7890
|
+
if (!isUndefined$1(definition)) {
|
|
7891
|
+
return definition.UserCtor;
|
|
7892
|
+
}
|
|
7893
|
+
// TODO [#3073]: return undefined rather than the pivot constructor (NativeCtor)
|
|
7894
|
+
// In this case, the custom element must have been defined before the registry patches
|
|
7895
|
+
// were applied. So return the non-pivot constructor
|
|
7896
|
+
if (isUndefined$1(NativeCtor)) {
|
|
7897
|
+
// Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1335247
|
|
7898
|
+
// We can patch the correct behavior using customElements.get()
|
|
7899
|
+
return nativeGet.call(nativeRegistry, tagName);
|
|
7900
|
+
}
|
|
7901
|
+
return NativeCtor;
|
|
7902
|
+
});
|
|
7903
|
+
};
|
|
7904
|
+
// This constructor is invoked when we call `new pivotDefinition.UserCtor()`
|
|
7905
|
+
// @ts-ignore
|
|
7906
|
+
window.HTMLElement = function HTMLElement() {
|
|
7907
|
+
// Upgrading case: the pivoting class constructor was run by the browser's
|
|
7908
|
+
// native custom elements and we're in the process of running the
|
|
7909
|
+
// "constructor-call trick" on the natively constructed instance, so just
|
|
7910
|
+
// return that here.
|
|
7911
|
+
// This code path is also called when LWC `new`s a PivotCtor.
|
|
7912
|
+
const instance = upgradingInstance;
|
|
7913
|
+
if (!isUndefined$1(instance)) {
|
|
7914
|
+
upgradingInstance = undefined;
|
|
7915
|
+
return instance;
|
|
7916
|
+
}
|
|
7917
|
+
// Construction case: we need to construct the pivoting instance and return it.
|
|
7918
|
+
// This is possible when the user register it via global registry and instantiate
|
|
7919
|
+
// it via `new Ctor()`.
|
|
7920
|
+
const { constructor } = this;
|
|
7921
|
+
const definition = globalDefinitionsByClass.get(constructor);
|
|
7922
|
+
if (isUndefined$1(definition) || isUndefined$1(definition.PivotCtor)) {
|
|
7923
|
+
// This code path is hit if someone `new`s a class that extends `HTMLElement` without
|
|
7924
|
+
// doing `customElements.define()` first. This matches native browser behavior:
|
|
7925
|
+
// https://stackoverflow.com/a/61883392
|
|
7926
|
+
throw new TypeError('Illegal constructor');
|
|
7927
|
+
}
|
|
7928
|
+
// This constructor is ONLY invoked when it is the user instantiating
|
|
7929
|
+
// an element via new Ctor while Ctor is a registered global constructor.
|
|
7930
|
+
const { PivotCtor, UserCtor } = definition;
|
|
7931
|
+
return new PivotCtor(UserCtor);
|
|
7932
|
+
};
|
|
7933
|
+
HTMLElement.prototype = NativeHTMLElement.prototype;
|
|
7934
|
+
/**
|
|
7935
|
+
* Create a new PivotConstructor for the given tagName, which is capable of being constructed
|
|
7936
|
+
* with a UserConstructor defining the behavior. Passing in the UserConstructor here
|
|
7937
|
+
* is a hint that can be used when registering a custom element with the global custom elements
|
|
7938
|
+
* registry for the first time, which provides certain optimizations. It also marks the UserConstructor
|
|
7939
|
+
* as "safe" to be used when passed in to a PivotConstructor.
|
|
7940
|
+
*
|
|
7941
|
+
* @param tagName - element tag name
|
|
7942
|
+
* @param UserCtor - userland custom element constructor
|
|
7943
|
+
* @returns a new custom element constructor
|
|
7944
|
+
*/
|
|
7945
|
+
return function createPivotConstructor(tagName, UserCtor) {
|
|
7946
|
+
tagName = StringToLowerCase.call(tagName);
|
|
7947
|
+
let PivotCtor = pivotCtorByTag.get(tagName);
|
|
7948
|
+
if (isUndefined$1(PivotCtor)) {
|
|
7949
|
+
const definition = getOrCreateDefinitionForConstructor(UserCtor);
|
|
7950
|
+
PivotCtor = createPivotingClass(tagName, definition);
|
|
7951
|
+
// Register a pivoting class as a global custom element
|
|
7952
|
+
nativeDefine.call(nativeRegistry, tagName, PivotCtor);
|
|
7953
|
+
definition.PivotCtor = PivotCtor;
|
|
7954
|
+
// Only cache after nativeDefine has been called, because if it throws an error
|
|
7955
|
+
// (e.g. for an invalid tag name), then we don't want to cache anything.
|
|
7956
|
+
definitionForConstructor.set(UserCtor, definition);
|
|
7957
|
+
pivotCtorByTag.set(tagName, PivotCtor);
|
|
7958
|
+
}
|
|
7959
|
+
// Register a UserConstructor as "safe" to be used within a PivotConstructor
|
|
7960
|
+
registeredUserCtors.add(UserCtor);
|
|
7961
|
+
return PivotCtor;
|
|
7962
|
+
};
|
|
7963
|
+
}
|
|
7964
|
+
|
|
7965
|
+
/*
|
|
7966
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
7967
|
+
* All rights reserved.
|
|
7968
|
+
* SPDX-License-Identifier: MIT
|
|
7969
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7970
|
+
*/
|
|
7971
|
+
let createScopedConstructor;
|
|
7972
|
+
let CachedHTMLElement; // We only call `createScopedRegistry()` if the browser supports custom elements and
|
|
7973
|
+
// ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is enabled, because we don't want to patch eagerly if the flag is disabled
|
|
7974
|
+
// or we're in a legacy browser.
|
|
7975
|
+
|
|
7976
|
+
if (lwcRuntimeFlags.ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY) {
|
|
7977
|
+
if (hasCustomElements) {
|
|
7978
|
+
// If ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is true, then we eagerly initialize the scoped registry.
|
|
7979
|
+
// It's assumed that ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is set *before* LWC loads, and never changes.
|
|
7980
|
+
//
|
|
7981
|
+
// Why not lazily patch in `createCustomElement`? Well, this could lead to subtle bugs, e.g.:
|
|
7982
|
+
//
|
|
7983
|
+
// 1. LWC loads
|
|
7984
|
+
// 2. `const Ctor = class extends HTMLElement {}`
|
|
7985
|
+
// 3. `lwc.createElement(...)` // here we lazily patch
|
|
7986
|
+
// 4. `customElements.define('x-foo', Ctor)` // throws error because class is bound to stale HTMLElement
|
|
7987
|
+
//
|
|
7988
|
+
// To reduce the risk of this, it's safer to patch the registry eagerly.
|
|
7989
|
+
createScopedConstructor = createScopedRegistry(); // It's important to cache window.HTMLElement here. Otherwise, someone else could overwrite window.HTMLElement (e.g.
|
|
7990
|
+
// another copy of the engine, or another scoping implementation) and we would get "Illegal constructor" errors
|
|
7991
|
+
// because the HTMLElement prototypes are mixed up.
|
|
7992
|
+
//
|
|
7993
|
+
// The reason this happens is that the scoping implementation overwrites window.HTMLElement and expects to work
|
|
7994
|
+
// with that version of HTMLElement. So if you load two copies of the scoping implementation in the same environment,
|
|
7995
|
+
// the second one may accidentally grab window.HTMLElement from the first (when doing `class extends HTMLElement`).
|
|
7996
|
+
// Caching avoids this problem.
|
|
7997
|
+
|
|
7998
|
+
CachedHTMLElement = window.HTMLElement;
|
|
7999
|
+
}
|
|
8000
|
+
} // Creates a constructor that is intended to be used as the UserConstructor in a scoped (pivots) registry.
|
|
8001
|
+
// In this case, the upgradeCallback only needs to be defined once because we create these on-demand,
|
|
8002
|
+
// multiple times per tag name.
|
|
8003
|
+
|
|
8004
|
+
|
|
8005
|
+
const createUserConstructor = (upgradeCallback, connectedCallback, disconnectedCallback, HTMLElementToExtend) => {
|
|
8006
|
+
// TODO [#2972]: this class should expose observedAttributes as necessary
|
|
8007
|
+
return class UserConstructor extends HTMLElementToExtend {
|
|
8008
|
+
constructor() {
|
|
8009
|
+
super();
|
|
8010
|
+
upgradeCallback(this);
|
|
8011
|
+
}
|
|
8012
|
+
|
|
8013
|
+
connectedCallback() {
|
|
8014
|
+
connectedCallback(this);
|
|
8015
|
+
}
|
|
8016
|
+
|
|
8017
|
+
disconnectedCallback() {
|
|
8018
|
+
disconnectedCallback(this);
|
|
8019
|
+
}
|
|
8020
|
+
|
|
8021
|
+
};
|
|
8022
|
+
};
|
|
8023
|
+
|
|
8024
|
+
function createCustomElementScoped(tagName, upgradeCallback, connectedCallback, disconnectedCallback) {
|
|
8025
|
+
if (isUndefined$1(createScopedConstructor) || isUndefined$1(CachedHTMLElement)) {
|
|
8026
|
+
// This error should be impossible to hit
|
|
8027
|
+
throw new Error('The flag ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY must be set to true to use this feature');
|
|
8028
|
+
}
|
|
8029
|
+
|
|
8030
|
+
const UserConstructor = createUserConstructor(upgradeCallback, connectedCallback, disconnectedCallback, CachedHTMLElement);
|
|
8031
|
+
const ScopedConstructor = createScopedConstructor(tagName, UserConstructor);
|
|
8032
|
+
return new ScopedConstructor(UserConstructor);
|
|
8033
|
+
}
|
|
8034
|
+
|
|
8035
|
+
/*
|
|
8036
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
8037
|
+
* All rights reserved.
|
|
8038
|
+
* SPDX-License-Identifier: MIT
|
|
8039
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8040
|
+
*/
|
|
8041
|
+
/**
|
|
8042
|
+
* We have three modes for creating custom elements:
|
|
8043
|
+
*
|
|
8044
|
+
* 1. Compat (legacy) browser support (e.g. IE11). Totally custom, doesn't rely on native browser APIs.
|
|
8045
|
+
* 2. "Vanilla" custom elements registry. This system actually still allows us to have two LWC components with the
|
|
8046
|
+
* same tag name, via a simple trick: every custom element constructor we define in the registry is basically
|
|
8047
|
+
* the same. It's essentially a dummy `class extends HTMLElement` that accepts an `upgradeCallback` in its
|
|
8048
|
+
* constructor, which allows us to have completely customized functionality for different components.
|
|
8049
|
+
* 3. "Scoped" (or "pivot") custom elements. This relies on a sophisticated system that emulates the "scoped custom
|
|
8050
|
+
* elements registry" proposal, with support for avoiding conflicts in tag names both between LWC components and
|
|
8051
|
+
* between LWC components and third-party elements. This uses a similar trick to #2, but is much more complex
|
|
8052
|
+
* because it must patch the global `customElements` and `HTMLElement` objects.
|
|
8053
|
+
*/
|
|
8054
|
+
|
|
8055
|
+
let createCustomElement;
|
|
8056
|
+
|
|
8057
|
+
if (hasCustomElements) {
|
|
8058
|
+
if (lwcRuntimeFlags.ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY) {
|
|
8059
|
+
createCustomElement = createCustomElementScoped;
|
|
8060
|
+
} else {
|
|
8061
|
+
// use global custom elements registry (vanilla)
|
|
8062
|
+
createCustomElement = createCustomElementVanilla;
|
|
8063
|
+
}
|
|
8064
|
+
} else {
|
|
8065
|
+
// no registry available here
|
|
8066
|
+
createCustomElement = createCustomElementCompat;
|
|
8067
|
+
}
|
|
8068
|
+
|
|
7507
8069
|
/*
|
|
7508
8070
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
7509
8071
|
* All rights reserved.
|
|
@@ -7564,7 +8126,7 @@ var LWC = (function (exports) {
|
|
|
7564
8126
|
function isNull(obj) {
|
|
7565
8127
|
return obj === null;
|
|
7566
8128
|
}
|
|
7567
|
-
/** version: 2.
|
|
8129
|
+
/** version: 2.27.0 */
|
|
7568
8130
|
|
|
7569
8131
|
/*
|
|
7570
8132
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7572,65 +8134,6 @@ var LWC = (function (exports) {
|
|
|
7572
8134
|
* SPDX-License-Identifier: MIT
|
|
7573
8135
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7574
8136
|
*/
|
|
7575
|
-
exports.getCustomElement = void 0;
|
|
7576
|
-
exports.defineCustomElement = void 0;
|
|
7577
|
-
let HTMLElementConstructor;
|
|
7578
|
-
function isCustomElementRegistryAvailable() {
|
|
7579
|
-
if (typeof customElements === 'undefined') {
|
|
7580
|
-
return false;
|
|
7581
|
-
}
|
|
7582
|
-
try {
|
|
7583
|
-
// dereference HTMLElement global because babel wraps globals in compat mode with a
|
|
7584
|
-
// _wrapNativeSuper()
|
|
7585
|
-
// This is a problem because LWCUpgradableElement extends renderer.HTMLElementExported which does not
|
|
7586
|
-
// get wrapped by babel.
|
|
7587
|
-
const HTMLElementAlias = HTMLElement;
|
|
7588
|
-
// In case we use compat mode with a modern browser, the compat mode transformation
|
|
7589
|
-
// invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
|
|
7590
|
-
// which are not equipped to be initialized that way.
|
|
7591
|
-
class clazz extends HTMLElementAlias {
|
|
7592
|
-
}
|
|
7593
|
-
customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
|
|
7594
|
-
new clazz();
|
|
7595
|
-
return true;
|
|
7596
|
-
}
|
|
7597
|
-
catch (_a) {
|
|
7598
|
-
return false;
|
|
7599
|
-
}
|
|
7600
|
-
}
|
|
7601
|
-
if (isCustomElementRegistryAvailable()) {
|
|
7602
|
-
exports.getCustomElement = customElements.get.bind(customElements);
|
|
7603
|
-
exports.defineCustomElement = customElements.define.bind(customElements);
|
|
7604
|
-
HTMLElementConstructor = HTMLElement;
|
|
7605
|
-
}
|
|
7606
|
-
else {
|
|
7607
|
-
const registry = Object.create(null);
|
|
7608
|
-
const reverseRegistry = new WeakMap();
|
|
7609
|
-
exports.defineCustomElement = function define(name, ctor) {
|
|
7610
|
-
if (name !== String.prototype.toLowerCase.call(name) || registry[name]) {
|
|
7611
|
-
throw new TypeError(`Invalid Registration`);
|
|
7612
|
-
}
|
|
7613
|
-
registry[name] = ctor;
|
|
7614
|
-
reverseRegistry.set(ctor, name);
|
|
7615
|
-
};
|
|
7616
|
-
exports.getCustomElement = function get(name) {
|
|
7617
|
-
return registry[name];
|
|
7618
|
-
};
|
|
7619
|
-
HTMLElementConstructor = function HTMLElement() {
|
|
7620
|
-
if (!(this instanceof HTMLElement)) {
|
|
7621
|
-
throw new TypeError(`Invalid Invocation`);
|
|
7622
|
-
}
|
|
7623
|
-
const { constructor } = this;
|
|
7624
|
-
const name = reverseRegistry.get(constructor);
|
|
7625
|
-
if (!name) {
|
|
7626
|
-
throw new TypeError(`Invalid Construction`);
|
|
7627
|
-
}
|
|
7628
|
-
const elm = document.createElement(name);
|
|
7629
|
-
Object.setPrototypeOf(elm, constructor.prototype);
|
|
7630
|
-
return elm;
|
|
7631
|
-
};
|
|
7632
|
-
HTMLElementConstructor.prototype = HTMLElement.prototype;
|
|
7633
|
-
}
|
|
7634
8137
|
function cloneNode(node, deep) {
|
|
7635
8138
|
return node.cloneNode(deep);
|
|
7636
8139
|
}
|
|
@@ -7804,9 +8307,7 @@ var LWC = (function (exports) {
|
|
|
7804
8307
|
function assertInstanceOfHTMLElement(elm, msg) {
|
|
7805
8308
|
assert.invariant(elm instanceof HTMLElement, msg);
|
|
7806
8309
|
}
|
|
7807
|
-
const HTMLElementExported = HTMLElementConstructor;
|
|
7808
8310
|
|
|
7809
|
-
exports.HTMLElementExported = HTMLElementExported;
|
|
7810
8311
|
exports.addEventListener = addEventListener;
|
|
7811
8312
|
exports.assertInstanceOfHTMLElement = assertInstanceOfHTMLElement;
|
|
7812
8313
|
exports.attachShadow = attachShadow;
|
|
@@ -7866,6 +8367,8 @@ var LWC = (function (exports) {
|
|
|
7866
8367
|
{
|
|
7867
8368
|
// insertStyleSheet implementation shares a global cache of stylesheet data
|
|
7868
8369
|
insertStylesheet,
|
|
8370
|
+
// relies on a shared global cache
|
|
8371
|
+
createCustomElement,
|
|
7869
8372
|
isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
|
|
7870
8373
|
isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
|
|
7871
8374
|
});
|
|
@@ -7966,36 +8469,44 @@ var LWC = (function (exports) {
|
|
|
7966
8469
|
// This WeakSet usage is valid because this functionality is not meant to run in IE11.
|
|
7967
8470
|
const hydratedCustomElements = new WeakSet();
|
|
7968
8471
|
function buildCustomElementConstructor(Ctor) {
|
|
8472
|
+
var _a;
|
|
7969
8473
|
const HtmlPrototype = getComponentHtmlPrototype(Ctor);
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
8474
|
+
const { observedAttributes } = HtmlPrototype;
|
|
8475
|
+
const { attributeChangedCallback } = HtmlPrototype.prototype;
|
|
8476
|
+
return _a = class extends HTMLElement {
|
|
8477
|
+
constructor() {
|
|
8478
|
+
super();
|
|
8479
|
+
if (this.isConnected) {
|
|
8480
|
+
// this if block is hit when there's already an un-upgraded element in the DOM with the same tag name.
|
|
8481
|
+
hydrateComponent(this, Ctor, {});
|
|
8482
|
+
hydratedCustomElements.add(this);
|
|
8483
|
+
}
|
|
8484
|
+
else {
|
|
8485
|
+
createVM(this, Ctor, renderer, {
|
|
8486
|
+
mode: 'open',
|
|
8487
|
+
owner: null,
|
|
8488
|
+
tagName: this.tagName,
|
|
8489
|
+
});
|
|
8490
|
+
}
|
|
7977
8491
|
}
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
8492
|
+
connectedCallback() {
|
|
8493
|
+
if (hydratedCustomElements.has(this)) {
|
|
8494
|
+
// This is an un-upgraded element that was hydrated in the constructor.
|
|
8495
|
+
hydratedCustomElements.delete(this);
|
|
8496
|
+
}
|
|
8497
|
+
else {
|
|
8498
|
+
connectRootElement(this);
|
|
8499
|
+
}
|
|
7984
8500
|
}
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
if (hydratedCustomElements.has(this)) {
|
|
7988
|
-
// This is an un-upgraded element that was hydrated in the constructor.
|
|
7989
|
-
hydratedCustomElements.delete(this);
|
|
8501
|
+
disconnectedCallback() {
|
|
8502
|
+
disconnectRootElement(this);
|
|
7990
8503
|
}
|
|
7991
|
-
|
|
7992
|
-
|
|
8504
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
8505
|
+
attributeChangedCallback.call(this, name, oldValue, newValue);
|
|
7993
8506
|
}
|
|
7994
|
-
}
|
|
7995
|
-
|
|
7996
|
-
|
|
7997
|
-
}
|
|
7998
|
-
};
|
|
8507
|
+
},
|
|
8508
|
+
_a.observedAttributes = observedAttributes,
|
|
8509
|
+
_a;
|
|
7999
8510
|
}
|
|
8000
8511
|
|
|
8001
8512
|
/*
|
|
@@ -8082,8 +8593,13 @@ var LWC = (function (exports) {
|
|
|
8082
8593
|
throw new TypeError(`"createElement" function expects an "is" option with a valid component constructor.`);
|
|
8083
8594
|
}
|
|
8084
8595
|
|
|
8085
|
-
const
|
|
8086
|
-
|
|
8596
|
+
const {
|
|
8597
|
+
createCustomElement
|
|
8598
|
+
} = renderer; // tagName must be all lowercase, unfortunately, we have legacy code that is
|
|
8599
|
+
// passing `sel` as a camel-case, which makes them invalid custom elements name
|
|
8600
|
+
// the following line guarantees that this does not leaks beyond this point.
|
|
8601
|
+
|
|
8602
|
+
const tagName = StringToLowerCase.call(sel); // the custom element from the registry is expecting an upgrade callback
|
|
8087
8603
|
|
|
8088
8604
|
/**
|
|
8089
8605
|
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
@@ -8092,9 +8608,9 @@ var LWC = (function (exports) {
|
|
|
8092
8608
|
* an upgradable custom element.
|
|
8093
8609
|
*/
|
|
8094
8610
|
|
|
8095
|
-
const
|
|
8611
|
+
const upgradeCallback = elm => {
|
|
8096
8612
|
createVM(elm, Ctor, renderer, {
|
|
8097
|
-
tagName
|
|
8613
|
+
tagName,
|
|
8098
8614
|
mode: options.mode !== 'closed' ? 'open' : 'closed',
|
|
8099
8615
|
owner: null
|
|
8100
8616
|
});
|
|
@@ -8103,15 +8619,21 @@ var LWC = (function (exports) {
|
|
|
8103
8619
|
ConnectingSlot.set(elm, connectRootElement);
|
|
8104
8620
|
DisconnectingSlot.set(elm, disconnectRootElement);
|
|
8105
8621
|
}
|
|
8622
|
+
};
|
|
8106
8623
|
|
|
8107
|
-
|
|
8108
|
-
|
|
8624
|
+
const connectedCallback = elm => {
|
|
8625
|
+
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
8626
|
+
connectRootElement(elm);
|
|
8627
|
+
}
|
|
8628
|
+
};
|
|
8109
8629
|
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
|
|
8113
|
-
|
|
8630
|
+
const disconnectedCallback = elm => {
|
|
8631
|
+
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
8632
|
+
disconnectRootElement(elm);
|
|
8633
|
+
}
|
|
8634
|
+
};
|
|
8114
8635
|
|
|
8636
|
+
const element = createCustomElement(tagName, upgradeCallback, connectedCallback, disconnectedCallback);
|
|
8115
8637
|
return element;
|
|
8116
8638
|
}
|
|
8117
8639
|
|
|
@@ -8183,7 +8705,7 @@ var LWC = (function (exports) {
|
|
|
8183
8705
|
});
|
|
8184
8706
|
freeze(LightningElement);
|
|
8185
8707
|
seal(LightningElement.prototype);
|
|
8186
|
-
/* version: 2.
|
|
8708
|
+
/* version: 2.27.0 */
|
|
8187
8709
|
|
|
8188
8710
|
exports.LightningElement = LightningElement;
|
|
8189
8711
|
exports.__unstable__ProfilerControl = profilerControl;
|