lwc 2.25.1 → 2.26.1

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.
Files changed (35) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +890 -411
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +890 -411
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +736 -205
  5. package/dist/engine-dom/iife/es5/engine-dom.js +959 -311
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +888 -224
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +890 -411
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +736 -205
  11. package/dist/engine-dom/umd/es5/engine-dom.js +959 -311
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +888 -224
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +138 -227
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +138 -227
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
  20. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
  22. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
  23. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
  24. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
  25. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
  26. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  27. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  28. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  29. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  30. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  31. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  32. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  33. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  34. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  35. package/package.json +8 -8
@@ -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.25.1";
305
+ const LWC_VERSION = "2.26.1";
306
306
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
307
- /** version: 2.25.1 */
307
+ /** version: 2.26.1 */
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.25.1 */
389
+ /** version: 2.26.1 */
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.25.1 */
469
+ /** version: 2.26.1 */
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
- throw new ReferenceError('Illegal constructor');
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
- const list = activeTemplates.get(tpl);
2995
-
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
- }); // resetting the Set to release the memory of those vm references
3004
- // since they are not longer related to this template, instead
3005
- // they will get re-associated once these instances are rehydrated.
3006
-
3007
- list.clear();
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
- const list = activeStyles.get(style);
3015
-
3016
- if (!isUndefined$1(list)) {
3017
- list.forEach(vm => {
3018
- // if a style definition is swapped, we must reset
3019
- // vm's template content in the next micro-task:
3020
- forceRehydration(vm);
3021
- }); // resetting the Set to release the memory of those vm references
3022
- // since they are not longer related to this style, instead
3023
- // they will get re-associated once these instances are rehydrated.
3024
-
3025
- list.clear();
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
- const list = activeComponents.get(Ctor);
3033
- let canRefreshAllInstances = true;
3034
-
3035
- if (!isUndefined$1(list)) {
3036
- list.forEach(vm => {
3037
- const {
3038
- owner
3039
- } = vm;
3040
-
3041
- if (!isNull(owner)) {
3042
- // if a component class definition is swapped, we must reset
3043
- // owner's template content in the next micro-task:
3044
- forceRehydration(owner);
3045
- } else {
3046
- // the hot swapping for components only work for instances of components
3047
- // created from a template, root elements can't be swapped because we
3048
- // don't have a way to force the creation of the element with the same state
3049
- // of the current element.
3050
- // Instead, we can report the problem to the caller so it can take action,
3051
- // for example: reload the entire page.
3052
- canRefreshAllInstances = false;
3053
- }
3054
- }); // resetting the Set to release the memory of those vm references
3055
- // since they are not longer related to this constructor, instead
3056
- // they will get re-associated once these instances are rehydrated.
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
- if (process.env.NODE_ENV === 'production') {
3066
- // this method should never leak to prod
3067
- throw new ReferenceError();
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
- visited.add(tpl);
3075
- tpl = swappedTemplateMap.get(tpl);
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
- if (process.env.NODE_ENV === 'production') {
3083
- // this method should never leak to prod
3084
- throw new ReferenceError();
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
- visited.add(Ctor);
3092
- Ctor = swappedComponentMap.get(Ctor);
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
- if (process.env.NODE_ENV === 'production') {
3100
- // this method should never leak to prod
3101
- throw new ReferenceError();
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
- visited.add(style);
3109
- style = swappedStyleMap.get(style);
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
- if (process.env.NODE_ENV === 'production') {
3117
- // this method should never leak to prod
3118
- throw new ReferenceError();
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
- componentVMs = new Set();
3128
- activeComponents.set(Ctor, componentVMs);
3129
- } // this will allow us to keep track of the hot components
3130
-
3131
-
3132
- componentVMs.add(vm); // tracking active template
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
- let templateVMs = activeTemplates.get(tpl);
3138
-
3139
- if (isUndefined$1(templateVMs)) {
3140
- templateVMs = new Set();
3141
- activeTemplates.set(tpl, templateVMs);
3142
- } // this will allow us to keep track of the templates that are
3143
- // being used by a hot component
3144
-
3145
-
3146
- templateVMs.add(vm); // tracking active styles associated to template
3147
-
3148
- const stylesheets = tpl.stylesheets;
3149
-
3150
- if (!isUndefined$1(stylesheets)) {
3151
- flattenStylesheets(stylesheets).forEach(stylesheet => {
3152
- // this is necessary because we don't hold the list of styles
3153
- // in the vm, we only hold the selected (already swapped template)
3154
- // but the styles attached to the template might not be the actual
3155
- // active ones, but the swapped versions of those.
3156
- stylesheet = getStyleOrSwappedStyle(stylesheet);
3157
- let stylesheetVMs = activeStyles.get(stylesheet);
3158
-
3159
- if (isUndefined$1(stylesheetVMs)) {
3160
- stylesheetVMs = new Set();
3161
- activeStyles.set(stylesheet, stylesheetVMs);
3162
- } // this will allow us to keep track of the stylesheet that are
3163
- // being used by a hot component
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
- if (process.env.NODE_ENV === 'production') {
3174
- // this method should never leak to prod
3175
- throw new ReferenceError();
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
- } // removing active styles associated to template
3198
-
3199
-
3200
- const styles = tpl.stylesheets;
3201
-
3202
- if (!isUndefined$1(styles)) {
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
- if (process.env.NODE_ENV !== 'production') {
3217
- if (isTemplateRegistered(oldTpl) && isTemplateRegistered(newTpl)) {
3218
- swappedTemplateMap.set(oldTpl, newTpl);
3219
- return rehydrateHotTemplate(oldTpl);
3220
- } else {
3221
- throw new TypeError(`Invalid Template`);
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
- if (process.env.NODE_ENV !== 'production') {
3233
- if (isComponentConstructor(oldComponent) && isComponentConstructor(newComponent)) {
3234
- swappedComponentMap.set(oldComponent, newComponent);
3235
- return rehydrateHotComponent(oldComponent);
3236
- } else {
3237
- throw new TypeError(`Invalid Component`);
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
- if (process.env.NODE_ENV !== 'production') {
3249
- // TODO [#1887]: once the support for registering styles is implemented
3250
- // we can add the validation of both styles around this block.
3251
- swappedStyleMap.set(oldStyle, newStyle);
3252
- return rehydrateHotStyle(oldStyle);
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
- return !isUndefined$1(stylesheetToken) ? makeHostToken(stylesheetToken) : null;
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.
@@ -4311,7 +4186,9 @@ var LWC = (function (exports) {
4311
4186
  sel,
4312
4187
  owner
4313
4188
  } = vnode;
4314
- const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
4189
+ const {
4190
+ createCustomElement
4191
+ } = renderer;
4315
4192
  /**
4316
4193
  * Note: if the upgradable constructor does not expect, or throw when we new it
4317
4194
  * with a callback as the first argument, we could implement a more advanced
@@ -4320,10 +4197,30 @@ var LWC = (function (exports) {
4320
4197
  */
4321
4198
 
4322
4199
  let vm;
4323
- const elm = new UpgradableConstructor(elm => {
4200
+
4201
+ const upgradeCallback = elm => {
4324
4202
  // the custom element from the registry is expecting an upgrade callback
4325
4203
  vm = createViewModelHook(elm, vnode, renderer);
4326
- });
4204
+ };
4205
+
4206
+ const connectedCallback = elm => {
4207
+ if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
4208
+ connectRootElement(elm);
4209
+ }
4210
+ };
4211
+
4212
+ const disconnectedCallback = elm => {
4213
+ if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
4214
+ disconnectRootElement(elm);
4215
+ }
4216
+ }; // Should never get a tag with upper case letter at this point; the compiler
4217
+ // should produce only tags with lowercase letters. However, the Java
4218
+ // compiler may generate tagnames with uppercase letters so - for backwards
4219
+ // compatibility, we lower case the tagname here.
4220
+
4221
+
4222
+ const normalizedTagname = sel.toLowerCase();
4223
+ const elm = createCustomElement(normalizedTagname, upgradeCallback, connectedCallback, disconnectedCallback);
4327
4224
  vnode.elm = elm;
4328
4225
  vnode.vm = vm;
4329
4226
  linkNodeToShadow(elm, owner, renderer);
@@ -4331,8 +4228,6 @@ var LWC = (function (exports) {
4331
4228
 
4332
4229
  if (vm) {
4333
4230
  allocateChildren(vnode, vm);
4334
- } else if (vnode.ctor !== UpgradableConstructor) {
4335
- throw new TypeError(`Incorrect Component Constructor`);
4336
4231
  }
4337
4232
 
4338
4233
  patchElementPropsAndAttrs$1(null, vnode, renderer);
@@ -7106,19 +7001,23 @@ var LWC = (function (exports) {
7106
7001
  //
7107
7002
  // Consequently, hydration mismatches will occur if scoped CSS token classnames
7108
7003
  // are rendered during SSR. This needs to be accounted for when validating.
7109
- if (scopedToken) {
7004
+ if (!isNull(scopedToken) || !isNull(stylesheetTokenHost)) {
7110
7005
  if (!isUndefined$1(className)) {
7111
- className = isNull(stylesheetTokenHost)
7112
- ? `${scopedToken} ${className}`
7113
- : `${scopedToken} ${className} ${stylesheetTokenHost}`;
7006
+ // The order of the className should be scopedToken className stylesheetTokenHost
7007
+ const classTokens = [scopedToken, className, stylesheetTokenHost];
7008
+ const classNames = ArrayFilter.call(classTokens, (token) => !isNull(token));
7009
+ className = ArrayJoin.call(classNames, ' ');
7114
7010
  }
7115
7011
  else if (!isUndefined$1(classMap)) {
7116
- classMap = Object.assign(Object.assign(Object.assign({}, classMap), { [scopedToken]: true }), (isNull(stylesheetTokenHost) ? {} : { [stylesheetTokenHost]: true }));
7012
+ classMap = Object.assign(Object.assign(Object.assign({}, classMap), (!isNull(scopedToken) ? { [scopedToken]: true } : {})), (!isNull(stylesheetTokenHost) ? { [stylesheetTokenHost]: true } : {}));
7117
7013
  }
7118
7014
  else {
7119
- className = isNull(stylesheetTokenHost)
7120
- ? `${scopedToken}`
7121
- : `${scopedToken} ${stylesheetTokenHost}`;
7015
+ // The order of the className should be scopedToken stylesheetTokenHost
7016
+ const classTokens = [scopedToken, stylesheetTokenHost];
7017
+ const classNames = ArrayFilter.call(classTokens, (token) => !isNull(token));
7018
+ if (classNames.length) {
7019
+ className = ArrayJoin.call(classNames, ' ');
7020
+ }
7122
7021
  }
7123
7022
  }
7124
7023
  let nodesAreCompatible = true;
@@ -7360,7 +7259,7 @@ var LWC = (function (exports) {
7360
7259
  }
7361
7260
  return ctor;
7362
7261
  }
7363
- /* version: 2.25.1 */
7262
+ /* version: 2.26.1 */
7364
7263
 
7365
7264
  /*
7366
7265
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7504,6 +7403,626 @@ var LWC = (function (exports) {
7504
7403
  }
7505
7404
  }
7506
7405
 
7406
+ /*
7407
+ * Copyright (c) 2020, salesforce.com, inc.
7408
+ * All rights reserved.
7409
+ * SPDX-License-Identifier: MIT
7410
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7411
+ */
7412
+ function isCustomElementRegistryAvailable() {
7413
+ if (typeof customElements === 'undefined') {
7414
+ return false;
7415
+ }
7416
+ try {
7417
+ // dereference HTMLElement global because babel wraps globals in compat mode with a
7418
+ // _wrapNativeSuper()
7419
+ // This is a problem because LWCUpgradableElement extends renderer.HTMLElement which does not
7420
+ // get wrapped by babel.
7421
+ const HTMLElementAlias = HTMLElement;
7422
+ // In case we use compat mode with a modern browser, the compat mode transformation
7423
+ // invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
7424
+ // which are not equipped to be initialized that way.
7425
+ class clazz extends HTMLElementAlias {
7426
+ }
7427
+ customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
7428
+ new clazz();
7429
+ return true;
7430
+ }
7431
+ catch (_a) {
7432
+ return false;
7433
+ }
7434
+ }
7435
+ const hasCustomElements = isCustomElementRegistryAvailable();
7436
+
7437
+ /*
7438
+ * Copyright (c) 2018, salesforce.com, inc.
7439
+ * All rights reserved.
7440
+ * SPDX-License-Identifier: MIT
7441
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7442
+ */
7443
+ // Creates a custom element for compat (legacy) browser environments
7444
+ const createCustomElementCompat = (tagName, upgradeCallback) => {
7445
+ const elm = document.createElement(tagName);
7446
+ upgradeCallback(elm); // nothing to do with the result for now
7447
+ return elm;
7448
+ };
7449
+
7450
+ /*
7451
+ * Copyright (c) 2018, salesforce.com, inc.
7452
+ * All rights reserved.
7453
+ * SPDX-License-Identifier: MIT
7454
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7455
+ */
7456
+ const cachedConstructors = new Map();
7457
+ const elementsUpgradedOutsideLWC = new WeakSet();
7458
+ let elementBeingUpgradedByLWC = false;
7459
+ // Creates a constructor that is intended to be used as a vanilla custom element, except that the upgradeCallback is
7460
+ // passed in to the constructor so LWC can reuse the same custom element constructor for multiple components.
7461
+ // Another benefit is that only LWC can create components that actually do anything – if you do
7462
+ // `customElements.define('x-foo')`, then you don't have access to the upgradeCallback, so it's a dummy custom element.
7463
+ // This class should be created once per tag name.
7464
+ const createUpgradableConstructor = (connectedCallback, disconnectedCallback) => {
7465
+ // TODO [#2972]: this class should expose observedAttributes as necessary
7466
+ return class UpgradableConstructor extends HTMLElement {
7467
+ constructor(upgradeCallback) {
7468
+ super();
7469
+ // If the element is not created using lwc.createElement(), e.g. `document.createElement('x-foo')`,
7470
+ // then elementBeingUpgraded will be false
7471
+ if (elementBeingUpgradedByLWC) {
7472
+ upgradeCallback(this);
7473
+ }
7474
+ else {
7475
+ // keep track of elements that were not created by lwc.createElement,
7476
+ // so we can ignore their lifecycle hooks
7477
+ elementsUpgradedOutsideLWC.add(this);
7478
+ // TODO [#2970]: LWC elements cannot be upgraded via new Ctor()
7479
+ // Do we want to support this? Throw an error? Currently for backwards compat it's a no-op.
7480
+ }
7481
+ }
7482
+ connectedCallback() {
7483
+ if (!elementsUpgradedOutsideLWC.has(this)) {
7484
+ connectedCallback(this);
7485
+ }
7486
+ }
7487
+ disconnectedCallback() {
7488
+ if (!elementsUpgradedOutsideLWC.has(this)) {
7489
+ disconnectedCallback(this);
7490
+ }
7491
+ }
7492
+ };
7493
+ };
7494
+ const createCustomElementVanilla = (tagName, upgradeCallback, connectedCallback, disconnectedCallback) => {
7495
+ // use global custom elements registry
7496
+ let UpgradableConstructor = cachedConstructors.get(tagName);
7497
+ if (isUndefined$1(UpgradableConstructor)) {
7498
+ if (!isUndefined$1(customElements.get(tagName))) {
7499
+ throw new Error(`Unexpected tag name "${tagName}". This name is a registered custom element, preventing LWC to upgrade the element.`);
7500
+ }
7501
+ UpgradableConstructor = createUpgradableConstructor(connectedCallback, disconnectedCallback);
7502
+ customElements.define(tagName, UpgradableConstructor);
7503
+ cachedConstructors.set(tagName, UpgradableConstructor);
7504
+ }
7505
+ elementBeingUpgradedByLWC = true;
7506
+ try {
7507
+ return new UpgradableConstructor(upgradeCallback);
7508
+ }
7509
+ finally {
7510
+ elementBeingUpgradedByLWC = false;
7511
+ }
7512
+ };
7513
+
7514
+ /*
7515
+ * Copyright (c) 2020, salesforce.com, inc.
7516
+ * All rights reserved.
7517
+ * SPDX-License-Identifier: MIT
7518
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7519
+ */
7520
+ /**
7521
+ * Create a scoped registry, i.e. a function that can create custom elements whose tag names
7522
+ * do not conflict with vanilla custom elements having the same tag name.
7523
+ */
7524
+ function createScopedRegistry() {
7525
+ if (!hasCustomElements) {
7526
+ // This code should never be reached, because we don't use the pivot registry if
7527
+ // custom elements are unavailable.
7528
+ throw new Error('Custom elements are not supported in this environment.');
7529
+ }
7530
+ const { HTMLElement: NativeHTMLElement } = window;
7531
+ const { hasAttribute: nativeHasAttribute, setAttribute: nativeSetAttribute, removeAttribute: nativeRemoveAttribute, getAttribute: nativeGetAttribute, } = NativeHTMLElement.prototype;
7532
+ const definitionForElement = new WeakMap();
7533
+ const pendingRegistryForElement = new WeakMap();
7534
+ const definitionForConstructor = new WeakMap();
7535
+ const registeredUserCtors = new WeakSet();
7536
+ const pivotCtorByTag = new Map();
7537
+ const globalDefinitionsByTag = new Map();
7538
+ const globalDefinitionsByClass = new Map();
7539
+ const awaitingUpgrade = new Map();
7540
+ const EMPTY_SET = new Set();
7541
+ function createDefinitionRecord(constructor) {
7542
+ var _a;
7543
+ const { connectedCallback, disconnectedCallback, adoptedCallback, attributeChangedCallback, } = constructor.prototype;
7544
+ const observedAttributes = new Set((_a = constructor.observedAttributes) !== null && _a !== void 0 ? _a : []);
7545
+ return {
7546
+ UserCtor: constructor,
7547
+ PivotCtor: undefined,
7548
+ connectedCallback,
7549
+ disconnectedCallback,
7550
+ adoptedCallback,
7551
+ attributeChangedCallback,
7552
+ observedAttributes,
7553
+ };
7554
+ }
7555
+ // Helper to create stand-in element for each tagName registered that delegates out to the registry for the given
7556
+ // element. Note that the `registeredDefinition` represents the constructor that was used to register during
7557
+ // `customElements.define()`. Whereas the `pivotDefinition` represents the constructor that is passed when the pivot
7558
+ // constructor is invoked with another constructor.
7559
+ function createPivotingClass(tagName, registeredDefinition) {
7560
+ class PivotCtor extends NativeHTMLElement {
7561
+ constructor(UserCtor) {
7562
+ // This constructor can only be invoked by:
7563
+ // a) the browser instantiating an element from parsing or via document.createElement.
7564
+ // b) LWC new PivotClass (This constructor is NOT observable/accessible in user-land).
7565
+ // b) new UserClass.
7566
+ // When LWC instantiates it, it will pass the upgrading definition as an argument
7567
+ // If the caller signals via UserCtor that this is in fact a controlled
7568
+ // definition, we use that one, otherwise fallback to the global
7569
+ // internal registry.
7570
+ super();
7571
+ const userCtorIsDefined = !isUndefined$1(UserCtor);
7572
+ if (userCtorIsDefined) {
7573
+ if (!isConstructor(UserCtor)) {
7574
+ throw new TypeError(`Failed to create custom element: the provided constructor is not a constructor.`);
7575
+ }
7576
+ if (!registeredUserCtors.has(UserCtor)) {
7577
+ throw new Error(`Failed to create custom element: the provided constructor is unregistered: ${UserCtor.name}.`);
7578
+ }
7579
+ }
7580
+ const definition = userCtorIsDefined
7581
+ ? getOrCreateDefinitionForConstructor(UserCtor)
7582
+ : globalDefinitionsByTag.get(tagName);
7583
+ if (!isUndefined$1(definition)) {
7584
+ internalUpgrade(this, registeredDefinition, definition);
7585
+ }
7586
+ else {
7587
+ // This is the case in which there is no global definition, and
7588
+ // it is not handled by LWC (otherwise it will have a valid UserCtor)
7589
+ // so we need to add it to the pending queue just in case it eventually
7590
+ // gets defined in the global registry.
7591
+ pendingRegistryForElement.set(this, registeredDefinition);
7592
+ }
7593
+ }
7594
+ connectedCallback() {
7595
+ var _a;
7596
+ const definition = definitionForElement.get(this);
7597
+ if (!isUndefined$1(definition)) {
7598
+ // Delegate out to user callback
7599
+ (_a = definition.connectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
7600
+ }
7601
+ else {
7602
+ // Register for upgrade when defined (only when connected, so we don't leak)
7603
+ let awaiting = awaitingUpgrade.get(tagName);
7604
+ if (isUndefined$1(awaiting)) {
7605
+ awaitingUpgrade.set(tagName, (awaiting = new Set()));
7606
+ }
7607
+ awaiting.add(this);
7608
+ }
7609
+ }
7610
+ disconnectedCallback() {
7611
+ var _a;
7612
+ const definition = definitionForElement.get(this);
7613
+ if (!isUndefined$1(definition)) {
7614
+ // Delegate out to user callback
7615
+ (_a = definition.disconnectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
7616
+ }
7617
+ else {
7618
+ // Un-register for upgrade when defined (so we don't leak)
7619
+ const awaiting = awaitingUpgrade.get(tagName);
7620
+ // At this point, awaiting should never be undefined, because connectedCallback
7621
+ // must have been called before disconnectedCallback. But just to be safe, we check
7622
+ if (!isUndefined$1(awaiting)) {
7623
+ awaiting.delete(this);
7624
+ }
7625
+ }
7626
+ }
7627
+ adoptedCallback() {
7628
+ var _a;
7629
+ const definition = definitionForElement.get(this);
7630
+ (_a = definition === null || definition === void 0 ? void 0 : definition.adoptedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
7631
+ }
7632
+ attributeChangedCallback(name, oldValue, newValue) {
7633
+ var _a;
7634
+ const definition = definitionForElement.get(this);
7635
+ // if both definitions are the same, then the observedAttributes is the same,
7636
+ // but if they are different, only if the runtime definition has the attribute
7637
+ // marked as observed, then it should invoke attributeChangedCallback.
7638
+ if (registeredDefinition === definition ||
7639
+ (definition === null || definition === void 0 ? void 0 : definition.observedAttributes.has(name))) {
7640
+ (_a = definition.attributeChangedCallback) === null || _a === void 0 ? void 0 : _a.apply(this, [name, oldValue, newValue]);
7641
+ }
7642
+ }
7643
+ }
7644
+ PivotCtor.observedAttributes = [...registeredDefinition.observedAttributes];
7645
+ return PivotCtor;
7646
+ }
7647
+ function getNewObservedAttributes(registeredDefinition, pivotDefinition) {
7648
+ const { observedAttributes, attributeChangedCallback } = pivotDefinition;
7649
+ if (observedAttributes.size === 0 || isUndefined$1(attributeChangedCallback)) {
7650
+ // This instance does not need to observe any attributes, no need to patch
7651
+ return EMPTY_SET;
7652
+ }
7653
+ // Natively, the attributes observed by the registered definition are going to be taken
7654
+ // care of by the browser, only the difference between the two sets has to be taken
7655
+ // care by the patched version.
7656
+ return new Set([...pivotDefinition.observedAttributes].filter((x) => !registeredDefinition.observedAttributes.has(x)));
7657
+ }
7658
+ function throwAsyncError(error) {
7659
+ // Per native custom element behavior, errors thrown in attributeChangedCallback
7660
+ // become unhandled async errors. We use setTimeout() instead of Promise.resolve()
7661
+ // to make it an unhandled error rather than an unhandled rejection.
7662
+ setTimeout(() => {
7663
+ throw error;
7664
+ });
7665
+ }
7666
+ // Helper to patch `setAttribute`/`getAttribute` to implement `attributeChangedCallback`.
7667
+ // Why is this necessary? Well basically, you can't change the `observedAttributes` after
7668
+ // a custom element is defined. So with pivots, if two classes share the same tag name,
7669
+ // and the second class observes attributes that aren't observed by the first one,
7670
+ // then those attributes can never be observed by the native `observedAttributes` system.
7671
+ // So we have to simulate it by patching `getAttribute`/`removeAttribute`. Note that
7672
+ // we only do this when absolutely necessary, though; i.e. because we've determined
7673
+ // that we aren't observing the attributes we need to.
7674
+ function patchAttributes(instance, registeredDefinition, pivotDefinition) {
7675
+ const newObservedAttributes = getNewObservedAttributes(registeredDefinition, pivotDefinition);
7676
+ if (newObservedAttributes.size === 0) {
7677
+ return;
7678
+ }
7679
+ const { attributeChangedCallback } = pivotDefinition;
7680
+ // Patch the instance.
7681
+ // Note we use the native `getAttribute` rather than the super's `getAttribute` because
7682
+ // we don't actually want it to be observable that we're calling `getAttribute` from
7683
+ // `setAttribute` and `removeAttribute`.
7684
+ // TODO [#2994]: this should handle reflected properties such as `ariaLabel` and `role`.
7685
+ defineProperties(instance, {
7686
+ setAttribute: {
7687
+ value: function setAttribute(name, value) {
7688
+ if (newObservedAttributes.has(name)) {
7689
+ const old = nativeGetAttribute.call(this, name);
7690
+ nativeSetAttribute.call(this, name, value);
7691
+ try {
7692
+ attributeChangedCallback.call(this, name, old, value + '');
7693
+ }
7694
+ catch (error) {
7695
+ throwAsyncError(error);
7696
+ }
7697
+ }
7698
+ else {
7699
+ nativeSetAttribute.call(this, name, value);
7700
+ }
7701
+ },
7702
+ writable: true,
7703
+ enumerable: true,
7704
+ configurable: true,
7705
+ },
7706
+ removeAttribute: {
7707
+ value: function removeAttribute(name) {
7708
+ if (newObservedAttributes.has(name)) {
7709
+ const old = nativeGetAttribute.call(this, name);
7710
+ nativeRemoveAttribute.call(this, name);
7711
+ try {
7712
+ attributeChangedCallback.call(this, name, old, null);
7713
+ }
7714
+ catch (error) {
7715
+ throwAsyncError(error);
7716
+ }
7717
+ }
7718
+ else {
7719
+ nativeRemoveAttribute.call(this, name);
7720
+ }
7721
+ },
7722
+ writable: true,
7723
+ enumerable: true,
7724
+ configurable: true,
7725
+ },
7726
+ });
7727
+ }
7728
+ function patchAttributesDuringUpgrade(instance, registeredDefinition, pivotDefinition) {
7729
+ // The below case patches observed attributes for the case where the HTML element is upgraded
7730
+ // from a pre-existing one in the DOM.
7731
+ const newObservedAttributes = getNewObservedAttributes(registeredDefinition, pivotDefinition);
7732
+ if (getNewObservedAttributes(registeredDefinition, pivotDefinition).size === 0) {
7733
+ return;
7734
+ }
7735
+ const { attributeChangedCallback } = pivotDefinition;
7736
+ // Approximate observedAttributes from the user class, but only for the new observed attributes
7737
+ newObservedAttributes.forEach((name) => {
7738
+ if (nativeHasAttribute.call(instance, name)) {
7739
+ const newValue = nativeGetAttribute.call(instance, name);
7740
+ attributeChangedCallback.call(instance, name, null, newValue);
7741
+ }
7742
+ });
7743
+ }
7744
+ // User extends this HTMLElement, which returns the CE being upgraded
7745
+ let upgradingInstance;
7746
+ // Helper to upgrade an instance with a CE definition using "constructor call trick"
7747
+ function internalUpgrade(instance, registeredDefinition, pivotDefinition) {
7748
+ setPrototypeOf(instance, pivotDefinition.UserCtor.prototype);
7749
+ definitionForElement.set(instance, pivotDefinition);
7750
+ // attributes patches when needed
7751
+ if (pivotDefinition !== registeredDefinition) {
7752
+ patchAttributes(instance, registeredDefinition, pivotDefinition);
7753
+ }
7754
+ // Tricking the construction path to believe that a new instance is being created,
7755
+ // that way it will execute the super initialization mechanism but the HTMLElement
7756
+ // constructor will reuse the instance by returning the upgradingInstance.
7757
+ // This is by far the most important piece of the puzzle
7758
+ upgradingInstance = instance;
7759
+ // By `new`ing the UserCtor, we now jump to the constructor for the overridden global HTMLElement
7760
+ // The reason this happens is that the UserCtor extends HTMLElement, so it calls the `super()`.
7761
+ // Note that `upgradingInstance` is explicitly handled in the HTMLElement constructor.
7762
+ new pivotDefinition.UserCtor();
7763
+ patchAttributesDuringUpgrade(instance, registeredDefinition, pivotDefinition);
7764
+ }
7765
+ function isConstructor(constructor) {
7766
+ return isFunction$1(constructor) && isObject(constructor.prototype);
7767
+ }
7768
+ function getOrCreateDefinitionForConstructor(constructor) {
7769
+ if (!isConstructor(constructor)) {
7770
+ throw new TypeError('The referenced constructor is not a constructor.');
7771
+ }
7772
+ const definition = definitionForConstructor.get(constructor);
7773
+ if (!isUndefined$1(definition)) {
7774
+ return definition;
7775
+ }
7776
+ return createDefinitionRecord(constructor);
7777
+ }
7778
+ const { customElements: nativeRegistry } = window;
7779
+ const { define: nativeDefine, whenDefined: nativeWhenDefined, get: nativeGet } = nativeRegistry;
7780
+ // patch for the global registry define mechanism
7781
+ CustomElementRegistry.prototype.define = function define(tagName, constructor, options) {
7782
+ if (options && options.extends) {
7783
+ // TODO [#2983]: should we support `extends`?
7784
+ throw new DOMException('NotSupportedError: "extends" key in customElements.define() options is not supported.');
7785
+ }
7786
+ if (globalDefinitionsByTag.has(tagName)) {
7787
+ throw new DOMException(`Failed to execute 'define' on 'CustomElementRegistry': the name "${tagName}" has already been used with this registry`);
7788
+ }
7789
+ if (!isUndefined$1(globalDefinitionsByClass.get(constructor))) {
7790
+ throw new DOMException(`Failed to execute 'define' on 'CustomElementRegistry': this constructor has already been used with this registry`);
7791
+ }
7792
+ const definition = getOrCreateDefinitionForConstructor(constructor);
7793
+ registeredUserCtors.add(constructor);
7794
+ let PivotCtor = pivotCtorByTag.get(tagName);
7795
+ if (isUndefined$1(PivotCtor)) {
7796
+ PivotCtor = createPivotingClass(tagName, definition);
7797
+ // Register a pivoting class which will handle global registry initializations
7798
+ nativeDefine.call(nativeRegistry, tagName, PivotCtor);
7799
+ }
7800
+ // Only cache after nativeDefine has been called, because if it throws an error
7801
+ // (e.g. for an invalid tag name), then we don't want to cache anything.
7802
+ definitionForConstructor.set(constructor, definition);
7803
+ pivotCtorByTag.set(tagName, PivotCtor);
7804
+ globalDefinitionsByTag.set(tagName, definition);
7805
+ globalDefinitionsByClass.set(constructor, definition);
7806
+ // For globally defined custom elements, the definition associated
7807
+ // to the UserCtor has a back-pointer to PivotCtor in case the user
7808
+ // new the UserCtor, so we know how to create the underlying element.
7809
+ definition.PivotCtor = PivotCtor;
7810
+ // Upgrade any elements created in this scope before customElements.define
7811
+ // was called, which should be exhibited by the following steps:
7812
+ // 1) LWC registers a tagName for an LWC component.
7813
+ // 2) Element with same tagName is created with document.createElement()
7814
+ // and inserted into DOM.
7815
+ // 3) customElements.define() is called with tagName and non-LWC constructor.
7816
+ // This requires immediate upgrade when the new global tagName is defined.
7817
+ const awaiting = awaitingUpgrade.get(tagName);
7818
+ if (!isUndefined$1(awaiting)) {
7819
+ awaitingUpgrade.delete(tagName);
7820
+ for (const element of awaiting) {
7821
+ const registeredDefinition = pendingRegistryForElement.get(element);
7822
+ // At this point, registeredDefinition should never be undefined because awaitingUpgrade
7823
+ // is only populated when we haven't run internalUpgrade yet, and we only populate
7824
+ // pendingRegistryForElement when internalUpgrade hasn't run yet.
7825
+ // But just to be safe, we check.
7826
+ if (!isUndefined$1(registeredDefinition)) {
7827
+ pendingRegistryForElement.delete(element);
7828
+ internalUpgrade(element, registeredDefinition, definition);
7829
+ }
7830
+ }
7831
+ }
7832
+ };
7833
+ CustomElementRegistry.prototype.get = function get(tagName) {
7834
+ const NativeCtor = nativeGet.call(nativeRegistry, tagName);
7835
+ if (!isUndefined$1(NativeCtor)) {
7836
+ const definition = globalDefinitionsByTag.get(tagName);
7837
+ if (!isUndefined$1(definition)) {
7838
+ return definition.UserCtor; // defined by the patched custom elements registry
7839
+ }
7840
+ // TODO [#3073]: return undefined rather than the pivot constructor (NativeCtor)
7841
+ return NativeCtor; // return the pivot constructor or constructor that existed before patching
7842
+ }
7843
+ };
7844
+ CustomElementRegistry.prototype.whenDefined = function whenDefined(tagName) {
7845
+ return nativeWhenDefined.call(nativeRegistry, tagName).then((NativeCtor) => {
7846
+ const definition = globalDefinitionsByTag.get(tagName);
7847
+ if (!isUndefined$1(definition)) {
7848
+ return definition.UserCtor;
7849
+ }
7850
+ // TODO [#3073]: return undefined rather than the pivot constructor (NativeCtor)
7851
+ // In this case, the custom element must have been defined before the registry patches
7852
+ // were applied. So return the non-pivot constructor
7853
+ if (isUndefined$1(NativeCtor)) {
7854
+ // Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1335247
7855
+ // We can patch the correct behavior using customElements.get()
7856
+ return nativeGet.call(nativeRegistry, tagName);
7857
+ }
7858
+ return NativeCtor;
7859
+ });
7860
+ };
7861
+ // This constructor is invoked when we call `new pivotDefinition.UserCtor()`
7862
+ // @ts-ignore
7863
+ window.HTMLElement = function HTMLElement() {
7864
+ // Upgrading case: the pivoting class constructor was run by the browser's
7865
+ // native custom elements and we're in the process of running the
7866
+ // "constructor-call trick" on the natively constructed instance, so just
7867
+ // return that here.
7868
+ // This code path is also called when LWC `new`s a PivotCtor.
7869
+ const instance = upgradingInstance;
7870
+ if (!isUndefined$1(instance)) {
7871
+ upgradingInstance = undefined;
7872
+ return instance;
7873
+ }
7874
+ // Construction case: we need to construct the pivoting instance and return it.
7875
+ // This is possible when the user register it via global registry and instantiate
7876
+ // it via `new Ctor()`.
7877
+ const { constructor } = this;
7878
+ const definition = globalDefinitionsByClass.get(constructor);
7879
+ if (isUndefined$1(definition) || isUndefined$1(definition.PivotCtor)) {
7880
+ // This code path is hit if someone `new`s a class that extends `HTMLElement` without
7881
+ // doing `customElements.define()` first. This matches native browser behavior:
7882
+ // https://stackoverflow.com/a/61883392
7883
+ throw new TypeError('Illegal constructor');
7884
+ }
7885
+ // This constructor is ONLY invoked when it is the user instantiating
7886
+ // an element via new Ctor while Ctor is a registered global constructor.
7887
+ const { PivotCtor, UserCtor } = definition;
7888
+ return new PivotCtor(UserCtor);
7889
+ };
7890
+ HTMLElement.prototype = NativeHTMLElement.prototype;
7891
+ /**
7892
+ * Create a new PivotConstructor for the given tagName, which is capable of being constructed
7893
+ * with a UserConstructor defining the behavior. Passing in the UserConstructor here
7894
+ * is a hint that can be used when registering a custom element with the global custom elements
7895
+ * registry for the first time, which provides certain optimizations. It also marks the UserConstructor
7896
+ * as "safe" to be used when passed in to a PivotConstructor.
7897
+ *
7898
+ * @param tagName - element tag name
7899
+ * @param UserCtor - userland custom element constructor
7900
+ * @returns a new custom element constructor
7901
+ */
7902
+ return function createPivotConstructor(tagName, UserCtor) {
7903
+ tagName = StringToLowerCase.call(tagName);
7904
+ let PivotCtor = pivotCtorByTag.get(tagName);
7905
+ if (isUndefined$1(PivotCtor)) {
7906
+ const definition = getOrCreateDefinitionForConstructor(UserCtor);
7907
+ PivotCtor = createPivotingClass(tagName, definition);
7908
+ // Register a pivoting class as a global custom element
7909
+ nativeDefine.call(nativeRegistry, tagName, PivotCtor);
7910
+ definition.PivotCtor = PivotCtor;
7911
+ // Only cache after nativeDefine has been called, because if it throws an error
7912
+ // (e.g. for an invalid tag name), then we don't want to cache anything.
7913
+ definitionForConstructor.set(UserCtor, definition);
7914
+ pivotCtorByTag.set(tagName, PivotCtor);
7915
+ }
7916
+ // Register a UserConstructor as "safe" to be used within a PivotConstructor
7917
+ registeredUserCtors.add(UserCtor);
7918
+ return PivotCtor;
7919
+ };
7920
+ }
7921
+
7922
+ /*
7923
+ * Copyright (c) 2018, salesforce.com, inc.
7924
+ * All rights reserved.
7925
+ * SPDX-License-Identifier: MIT
7926
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7927
+ */
7928
+ let createScopedConstructor;
7929
+ let CachedHTMLElement; // We only call `createScopedRegistry()` if the browser supports custom elements and
7930
+ // ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is enabled, because we don't want to patch eagerly if the flag is disabled
7931
+ // or we're in a legacy browser.
7932
+
7933
+ if (lwcRuntimeFlags.ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY) {
7934
+ if (hasCustomElements) {
7935
+ // If ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is true, then we eagerly initialize the scoped registry.
7936
+ // It's assumed that ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is set *before* LWC loads, and never changes.
7937
+ //
7938
+ // Why not lazily patch in `createCustomElement`? Well, this could lead to subtle bugs, e.g.:
7939
+ //
7940
+ // 1. LWC loads
7941
+ // 2. `const Ctor = class extends HTMLElement {}`
7942
+ // 3. `lwc.createElement(...)` // here we lazily patch
7943
+ // 4. `customElements.define('x-foo', Ctor)` // throws error because class is bound to stale HTMLElement
7944
+ //
7945
+ // To reduce the risk of this, it's safer to patch the registry eagerly.
7946
+ createScopedConstructor = createScopedRegistry(); // It's important to cache window.HTMLElement here. Otherwise, someone else could overwrite window.HTMLElement (e.g.
7947
+ // another copy of the engine, or another scoping implementation) and we would get "Illegal constructor" errors
7948
+ // because the HTMLElement prototypes are mixed up.
7949
+ //
7950
+ // The reason this happens is that the scoping implementation overwrites window.HTMLElement and expects to work
7951
+ // with that version of HTMLElement. So if you load two copies of the scoping implementation in the same environment,
7952
+ // the second one may accidentally grab window.HTMLElement from the first (when doing `class extends HTMLElement`).
7953
+ // Caching avoids this problem.
7954
+
7955
+ CachedHTMLElement = window.HTMLElement;
7956
+ }
7957
+ } // Creates a constructor that is intended to be used as the UserConstructor in a scoped (pivots) registry.
7958
+ // In this case, the upgradeCallback only needs to be defined once because we create these on-demand,
7959
+ // multiple times per tag name.
7960
+
7961
+
7962
+ const createUserConstructor = (upgradeCallback, connectedCallback, disconnectedCallback, HTMLElementToExtend) => {
7963
+ // TODO [#2972]: this class should expose observedAttributes as necessary
7964
+ return class UserConstructor extends HTMLElementToExtend {
7965
+ constructor() {
7966
+ super();
7967
+ upgradeCallback(this);
7968
+ }
7969
+
7970
+ connectedCallback() {
7971
+ connectedCallback(this);
7972
+ }
7973
+
7974
+ disconnectedCallback() {
7975
+ disconnectedCallback(this);
7976
+ }
7977
+
7978
+ };
7979
+ };
7980
+
7981
+ function createCustomElementScoped(tagName, upgradeCallback, connectedCallback, disconnectedCallback) {
7982
+ if (isUndefined$1(createScopedConstructor) || isUndefined$1(CachedHTMLElement)) {
7983
+ // This error should be impossible to hit
7984
+ throw new Error('The flag ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY must be set to true to use this feature');
7985
+ }
7986
+
7987
+ const UserConstructor = createUserConstructor(upgradeCallback, connectedCallback, disconnectedCallback, CachedHTMLElement);
7988
+ const ScopedConstructor = createScopedConstructor(tagName, UserConstructor);
7989
+ return new ScopedConstructor(UserConstructor);
7990
+ }
7991
+
7992
+ /*
7993
+ * Copyright (c) 2018, salesforce.com, inc.
7994
+ * All rights reserved.
7995
+ * SPDX-License-Identifier: MIT
7996
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7997
+ */
7998
+ /**
7999
+ * We have three modes for creating custom elements:
8000
+ *
8001
+ * 1. Compat (legacy) browser support (e.g. IE11). Totally custom, doesn't rely on native browser APIs.
8002
+ * 2. "Vanilla" custom elements registry. This system actually still allows us to have two LWC components with the
8003
+ * same tag name, via a simple trick: every custom element constructor we define in the registry is basically
8004
+ * the same. It's essentially a dummy `class extends HTMLElement` that accepts an `upgradeCallback` in its
8005
+ * constructor, which allows us to have completely customized functionality for different components.
8006
+ * 3. "Scoped" (or "pivot") custom elements. This relies on a sophisticated system that emulates the "scoped custom
8007
+ * elements registry" proposal, with support for avoiding conflicts in tag names both between LWC components and
8008
+ * between LWC components and third-party elements. This uses a similar trick to #2, but is much more complex
8009
+ * because it must patch the global `customElements` and `HTMLElement` objects.
8010
+ */
8011
+
8012
+ let createCustomElement;
8013
+
8014
+ if (hasCustomElements) {
8015
+ if (lwcRuntimeFlags.ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY) {
8016
+ createCustomElement = createCustomElementScoped;
8017
+ } else {
8018
+ // use global custom elements registry (vanilla)
8019
+ createCustomElement = createCustomElementVanilla;
8020
+ }
8021
+ } else {
8022
+ // no registry available here
8023
+ createCustomElement = createCustomElementCompat;
8024
+ }
8025
+
7507
8026
  /*
7508
8027
  * Copyright (c) 2018, salesforce.com, inc.
7509
8028
  * All rights reserved.
@@ -7564,7 +8083,7 @@ var LWC = (function (exports) {
7564
8083
  function isNull(obj) {
7565
8084
  return obj === null;
7566
8085
  }
7567
- /** version: 2.25.1 */
8086
+ /** version: 2.26.1 */
7568
8087
 
7569
8088
  /*
7570
8089
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7572,65 +8091,6 @@ var LWC = (function (exports) {
7572
8091
  * SPDX-License-Identifier: MIT
7573
8092
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7574
8093
  */
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
8094
  function cloneNode(node, deep) {
7635
8095
  return node.cloneNode(deep);
7636
8096
  }
@@ -7804,9 +8264,7 @@ var LWC = (function (exports) {
7804
8264
  function assertInstanceOfHTMLElement(elm, msg) {
7805
8265
  assert.invariant(elm instanceof HTMLElement, msg);
7806
8266
  }
7807
- const HTMLElementExported = HTMLElementConstructor;
7808
8267
 
7809
- exports.HTMLElementExported = HTMLElementExported;
7810
8268
  exports.addEventListener = addEventListener;
7811
8269
  exports.assertInstanceOfHTMLElement = assertInstanceOfHTMLElement;
7812
8270
  exports.attachShadow = attachShadow;
@@ -7866,6 +8324,8 @@ var LWC = (function (exports) {
7866
8324
  {
7867
8325
  // insertStyleSheet implementation shares a global cache of stylesheet data
7868
8326
  insertStylesheet,
8327
+ // relies on a shared global cache
8328
+ createCustomElement,
7869
8329
  isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
7870
8330
  isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
7871
8331
  });
@@ -7966,36 +8426,44 @@ var LWC = (function (exports) {
7966
8426
  // This WeakSet usage is valid because this functionality is not meant to run in IE11.
7967
8427
  const hydratedCustomElements = new WeakSet();
7968
8428
  function buildCustomElementConstructor(Ctor) {
8429
+ var _a;
7969
8430
  const HtmlPrototype = getComponentHtmlPrototype(Ctor);
7970
- return class extends HtmlPrototype {
7971
- constructor() {
7972
- super();
7973
- if (this.isConnected) {
7974
- // this if block is hit when there's already an un-upgraded element in the DOM with the same tag name.
7975
- hydrateComponent(this, Ctor, {});
7976
- hydratedCustomElements.add(this);
8431
+ const { observedAttributes } = HtmlPrototype;
8432
+ const { attributeChangedCallback } = HtmlPrototype.prototype;
8433
+ return _a = class extends HTMLElement {
8434
+ constructor() {
8435
+ super();
8436
+ if (this.isConnected) {
8437
+ // this if block is hit when there's already an un-upgraded element in the DOM with the same tag name.
8438
+ hydrateComponent(this, Ctor, {});
8439
+ hydratedCustomElements.add(this);
8440
+ }
8441
+ else {
8442
+ createVM(this, Ctor, renderer, {
8443
+ mode: 'open',
8444
+ owner: null,
8445
+ tagName: this.tagName,
8446
+ });
8447
+ }
7977
8448
  }
7978
- else {
7979
- createVM(this, Ctor, renderer, {
7980
- mode: 'open',
7981
- owner: null,
7982
- tagName: this.tagName,
7983
- });
8449
+ connectedCallback() {
8450
+ if (hydratedCustomElements.has(this)) {
8451
+ // This is an un-upgraded element that was hydrated in the constructor.
8452
+ hydratedCustomElements.delete(this);
8453
+ }
8454
+ else {
8455
+ connectRootElement(this);
8456
+ }
7984
8457
  }
7985
- }
7986
- connectedCallback() {
7987
- if (hydratedCustomElements.has(this)) {
7988
- // This is an un-upgraded element that was hydrated in the constructor.
7989
- hydratedCustomElements.delete(this);
8458
+ disconnectedCallback() {
8459
+ disconnectRootElement(this);
7990
8460
  }
7991
- else {
7992
- connectRootElement(this);
8461
+ attributeChangedCallback(name, oldValue, newValue) {
8462
+ attributeChangedCallback.call(this, name, oldValue, newValue);
7993
8463
  }
7994
- }
7995
- disconnectedCallback() {
7996
- disconnectRootElement(this);
7997
- }
7998
- };
8464
+ },
8465
+ _a.observedAttributes = observedAttributes,
8466
+ _a;
7999
8467
  }
8000
8468
 
8001
8469
  /*
@@ -8082,8 +8550,13 @@ var LWC = (function (exports) {
8082
8550
  throw new TypeError(`"createElement" function expects an "is" option with a valid component constructor.`);
8083
8551
  }
8084
8552
 
8085
- const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
8086
- let wasComponentUpgraded = false; // the custom element from the registry is expecting an upgrade callback
8553
+ const {
8554
+ createCustomElement
8555
+ } = renderer; // tagName must be all lowercase, unfortunately, we have legacy code that is
8556
+ // passing `sel` as a camel-case, which makes them invalid custom elements name
8557
+ // the following line guarantees that this does not leaks beyond this point.
8558
+
8559
+ const tagName = StringToLowerCase.call(sel); // the custom element from the registry is expecting an upgrade callback
8087
8560
 
8088
8561
  /**
8089
8562
  * Note: if the upgradable constructor does not expect, or throw when we new it
@@ -8092,9 +8565,9 @@ var LWC = (function (exports) {
8092
8565
  * an upgradable custom element.
8093
8566
  */
8094
8567
 
8095
- const element = new UpgradableConstructor(elm => {
8568
+ const upgradeCallback = elm => {
8096
8569
  createVM(elm, Ctor, renderer, {
8097
- tagName: sel,
8570
+ tagName,
8098
8571
  mode: options.mode !== 'closed' ? 'open' : 'closed',
8099
8572
  owner: null
8100
8573
  });
@@ -8103,15 +8576,21 @@ var LWC = (function (exports) {
8103
8576
  ConnectingSlot.set(elm, connectRootElement);
8104
8577
  DisconnectingSlot.set(elm, disconnectRootElement);
8105
8578
  }
8579
+ };
8106
8580
 
8107
- wasComponentUpgraded = true;
8108
- });
8581
+ const connectedCallback = elm => {
8582
+ if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
8583
+ connectRootElement(elm);
8584
+ }
8585
+ };
8109
8586
 
8110
- if (!wasComponentUpgraded) {
8111
- /* eslint-disable-next-line no-console */
8112
- console.error(`Unexpected tag name "${sel}". This name is a registered custom element, preventing LWC to upgrade the element.`);
8113
- }
8587
+ const disconnectedCallback = elm => {
8588
+ if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
8589
+ disconnectRootElement(elm);
8590
+ }
8591
+ };
8114
8592
 
8593
+ const element = createCustomElement(tagName, upgradeCallback, connectedCallback, disconnectedCallback);
8115
8594
  return element;
8116
8595
  }
8117
8596
 
@@ -8183,7 +8662,7 @@ var LWC = (function (exports) {
8183
8662
  });
8184
8663
  freeze(LightningElement);
8185
8664
  seal(LightningElement.prototype);
8186
- /* version: 2.25.1 */
8665
+ /* version: 2.26.1 */
8187
8666
 
8188
8667
  exports.LightningElement = LightningElement;
8189
8668
  exports.__unstable__ProfilerControl = profilerControl;