lwc 2.3.3 → 2.5.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.
Files changed (41) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +360 -198
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +360 -198
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +361 -168
  5. package/dist/engine-dom/iife/es5/engine-dom.js +371 -218
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +370 -186
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +360 -198
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +361 -168
  11. package/dist/engine-dom/umd/es5/engine-dom.js +371 -218
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -2
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +370 -186
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +304 -205
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
  16. package/dist/engine-server/esm/es2017/engine-server.js +304 -205
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +29 -16
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +29 -16
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +29 -16
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +31 -16
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +31 -16
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +29 -16
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +29 -16
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +31 -16
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +31 -16
  30. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  31. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  32. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  33. package/dist/wire-service/iife/es5/wire-service.js +3 -3
  34. package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
  35. package/dist/wire-service/iife/es5/wire-service_debug.js +3 -3
  36. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  37. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  38. package/dist/wire-service/umd/es5/wire-service.js +3 -3
  39. package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
  40. package/dist/wire-service/umd/es5/wire-service_debug.js +3 -3
  41. package/package.json +8 -8
@@ -27,7 +27,7 @@ var LWC = (function (exports) {
27
27
 
28
28
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf2(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf2(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
29
29
 
30
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
30
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
31
31
 
32
32
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
33
33
 
@@ -149,6 +149,10 @@ var LWC = (function (exports) {
149
149
  return obj === false;
150
150
  }
151
151
 
152
+ function isBoolean(obj) {
153
+ return typeof obj === 'boolean';
154
+ }
155
+
152
156
  function isFunction$1(obj) {
153
157
  return typeof obj === 'function';
154
158
  }
@@ -288,6 +292,7 @@ var LWC = (function (exports) {
288
292
  var KEY__SHADOW_RESOLVER = '$shadowResolver$';
289
293
  var KEY__SHADOW_TOKEN = '$shadowToken$';
290
294
  var KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
295
+ var KEY__SCOPED_CSS = '$scoped$';
291
296
  /**
292
297
  * Map composed of properties to attributes not following the HTML property to attribute mapping
293
298
  * convention.
@@ -336,7 +341,7 @@ var LWC = (function (exports) {
336
341
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
337
342
  return attributeName;
338
343
  }
339
- /** version: 2.3.3 */
344
+ /** version: 2.5.0 */
340
345
 
341
346
  /*
342
347
  * Copyright (c) 2018, salesforce.com, inc.
@@ -439,19 +444,33 @@ var LWC = (function (exports) {
439
444
  */
440
445
 
441
446
 
447
+ var features = {
448
+ ENABLE_REACTIVE_SETTER: null,
449
+ ENABLE_HMR: null,
450
+ ENABLE_INNER_OUTER_TEXT_PATCH: null,
451
+ ENABLE_ELEMENT_PATCH: null,
452
+ ENABLE_NODE_LIST_PATCH: null,
453
+ ENABLE_HTML_COLLECTIONS_PATCH: null,
454
+ ENABLE_NODE_PATCH: null,
455
+ ENABLE_NON_COMPOSED_EVENTS_LEAKAGE: null,
456
+ ENABLE_MIXED_SHADOW_MODE: null,
457
+ ENABLE_WIRE_SYNC_EMIT: null
458
+ };
459
+
442
460
  if (!_globalThis.lwcRuntimeFlags) {
443
461
  Object.defineProperty(_globalThis, 'lwcRuntimeFlags', {
444
462
  value: create(null)
445
463
  });
446
464
  }
447
465
 
448
- var runtimeFlags = _globalThis.lwcRuntimeFlags; // This function is not supported for use within components and is meant for
449
- // configuring runtime feature flags during app initialization.
466
+ var runtimeFlags = _globalThis.lwcRuntimeFlags;
467
+ /**
468
+ * Set the value at runtime of a given feature flag. This method only be invoked once per feature
469
+ * flag. It is meant to be used during the app initialization.
470
+ */
450
471
 
451
472
  function setFeatureFlag(name, value) {
452
- var isBoolean = isTrue(value) || isFalse(value);
453
-
454
- if (!isBoolean) {
473
+ if (!isBoolean(value)) {
455
474
  var message = "Failed to set the value \"".concat(value, "\" for the runtime feature flag \"").concat(name, "\". Runtime feature flags can only be set to a boolean value.");
456
475
 
457
476
  {
@@ -461,9 +480,12 @@ var LWC = (function (exports) {
461
480
  }
462
481
  }
463
482
 
464
- if (isUndefined$1(featureFlagLookup[name])) {
465
- // eslint-disable-next-line no-console
466
- console.warn("Failed to set the value \"".concat(value, "\" for the runtime feature flag \"").concat(name, "\" because it is undefined. Possible reasons are that 1) it was misspelled or 2) it was removed from the @lwc/features package."));
483
+ if (isUndefined$1(features[name])) {
484
+ var availableFlags = keys(features).map(function (name) {
485
+ return "\"".concat(name, "\"");
486
+ }).join(', '); // eslint-disable-next-line no-console
487
+
488
+ console.warn("Failed to set the value \"".concat(value, "\" for the runtime feature flag \"").concat(name, "\" because it is undefined. Available flags: ").concat(availableFlags, "."));
467
489
  return;
468
490
  }
469
491
 
@@ -477,34 +499,20 @@ var LWC = (function (exports) {
477
499
  return;
478
500
  }
479
501
 
480
- Object.defineProperty(runtimeFlags, name, {
502
+ defineProperty(runtimeFlags, name, {
481
503
  value: value
482
504
  });
483
505
  }
484
- } // This function is exposed to components to facilitate testing so we add a
485
- // check to make sure it is not invoked in production.
506
+ }
507
+ /**
508
+ * Set the value at runtime of a given feature flag. This method should only be used for testing
509
+ * purposes. It is a no-op when invoked in production mode.
510
+ */
486
511
 
487
512
 
488
513
  function setFeatureFlagForTest(name, value) {
489
514
  }
490
-
491
- var featureFlagLookup = {
492
- ENABLE_REACTIVE_SETTER: null,
493
- ENABLE_HMR: null,
494
- // Flag to toggle on/off the enforcement of innerText/outerText shadow dom semantic in elements when using synthetic shadow.
495
- // Note: Once active, elements outside the lwc boundary are controlled by the ENABLE_ELEMENT_PATCH flag.
496
- ENABLE_INNER_OUTER_TEXT_PATCH: null,
497
- // Flags to toggle on/off the enforcement of shadow dom semantic in element/node outside lwc boundary when using synthetic shadow.
498
- ENABLE_ELEMENT_PATCH: null,
499
- ENABLE_NODE_LIST_PATCH: null,
500
- ENABLE_HTML_COLLECTIONS_PATCH: null,
501
- ENABLE_NODE_PATCH: null,
502
- // Disables the fix for #2121 where non-composed events are visible outside of their shadow root.
503
- ENABLE_NON_COMPOSED_EVENTS_LEAKAGE: null,
504
- ENABLE_LIGHT_DOM_COMPONENTS: null,
505
- ENABLE_MIXED_SHADOW_MODE: null
506
- };
507
- /** version: 2.3.3 */
515
+ /** version: 2.5.0 */
508
516
 
509
517
  /* proxy-compat-disable */
510
518
 
@@ -515,6 +523,7 @@ var LWC = (function (exports) {
515
523
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
516
524
  */
517
525
 
526
+
518
527
  var nextTickCallbackQueue = [];
519
528
  var SPACE_CHAR = 32;
520
529
  var EmptyObject = seal(create(null));
@@ -2210,12 +2219,6 @@ var LWC = (function (exports) {
2210
2219
  associateVM(component, vm);
2211
2220
  associateVM(elm, vm);
2212
2221
 
2213
- if (!runtimeFlags.ENABLE_LIGHT_DOM_COMPONENTS) {
2214
- assert.isTrue(def.renderMode !== 0
2215
- /* Light */
2216
- , "".concat(def.name || 'Anonymous class', " is an invalid LWC component. Light DOM components are not available in this environment."));
2217
- }
2218
-
2219
2222
  if (vm.renderMode === 1
2220
2223
  /* Shadow */
2221
2224
  ) {
@@ -2236,7 +2239,7 @@ var LWC = (function (exports) {
2236
2239
  var cmpRoot = renderer.attachShadow(elm, (_renderer$attachShado = {}, _defineProperty(_renderer$attachShado, KEY__SYNTHETIC_MODE, shadowMode === 1), _defineProperty(_renderer$attachShado, "delegatesFocus", Boolean(ctor.delegatesFocus)), _defineProperty(_renderer$attachShado, "mode", mode), _renderer$attachShado));
2237
2240
  vm.cmpRoot = cmpRoot;
2238
2241
  associateVM(cmpRoot, vm);
2239
- } // @ts-ignore
2242
+ }
2240
2243
 
2241
2244
 
2242
2245
  LightningElement.prototype = {
@@ -3293,6 +3296,17 @@ var LWC = (function (exports) {
3293
3296
 
3294
3297
  function setElementShadowToken(elm, token) {
3295
3298
  elm.$shadowToken$ = token;
3299
+ } // Set the scope token class for *.scoped.css styles
3300
+
3301
+
3302
+ function setScopeTokenClassIfNecessary(elm, owner) {
3303
+ var cmpTemplate = owner.cmpTemplate,
3304
+ context = owner.context;
3305
+ var token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
3306
+
3307
+ if (!isUndefined$1(token) && context.hasScopedStyles) {
3308
+ owner.renderer.getClassList(elm).add(token);
3309
+ }
3296
3310
  }
3297
3311
 
3298
3312
  function updateNodeHook(oldVnode, vnode) {
@@ -3333,12 +3347,13 @@ var LWC = (function (exports) {
3333
3347
 
3334
3348
  function fallbackElmHook(elm, vnode) {
3335
3349
  var owner = vnode.owner;
3350
+ setScopeTokenClassIfNecessary(elm, owner);
3336
3351
 
3337
3352
  if (owner.shadowMode === 1
3338
3353
  /* Synthetic */
3339
3354
  ) {
3340
3355
  var context = vnode.data.context;
3341
- var shadowAttribute = owner.context.shadowAttribute;
3356
+ var stylesheetToken = owner.context.stylesheetToken;
3342
3357
 
3343
3358
  if (!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
3344
3359
  /* manual */
@@ -3349,7 +3364,7 @@ var LWC = (function (exports) {
3349
3364
  // into each element from the template, so they can be styled accordingly.
3350
3365
 
3351
3366
 
3352
- setElementShadowToken(elm, shadowAttribute);
3367
+ setElementShadowToken(elm, stylesheetToken);
3353
3368
  }
3354
3369
  }
3355
3370
 
@@ -3414,14 +3429,15 @@ var LWC = (function (exports) {
3414
3429
  mode = vnode.mode,
3415
3430
  ctor = vnode.ctor,
3416
3431
  owner = vnode.owner;
3432
+ setScopeTokenClassIfNecessary(elm, owner);
3417
3433
 
3418
3434
  if (owner.shadowMode === 1
3419
3435
  /* Synthetic */
3420
3436
  ) {
3421
- var shadowAttribute = owner.context.shadowAttribute; // when running in synthetic shadow mode, we need to set the shadowToken value
3437
+ var stylesheetToken = owner.context.stylesheetToken; // when running in synthetic shadow mode, we need to set the shadowToken value
3422
3438
  // into each element from the template, so they can be styled accordingly.
3423
3439
 
3424
- setElementShadowToken(elm, shadowAttribute);
3440
+ setElementShadowToken(elm, stylesheetToken);
3425
3441
  }
3426
3442
 
3427
3443
  var def = getComponentInternalDef(ctor);
@@ -3698,12 +3714,18 @@ var LWC = (function (exports) {
3698
3714
  };
3699
3715
 
3700
3716
  function linkNodeToShadow(elm, owner) {
3701
- var shadowMode = owner.shadowMode; // TODO [#1164]: this should eventually be done by the polyfill directly
3717
+ var renderer = owner.renderer,
3718
+ renderMode = owner.renderMode,
3719
+ shadowMode = owner.shadowMode; // TODO [#1164]: this should eventually be done by the polyfill directly
3702
3720
 
3703
- if (shadowMode === 1
3704
- /* Synthetic */
3705
- ) {
3706
- elm[KEY__SHADOW_RESOLVER] = getRenderRoot(owner)[KEY__SHADOW_RESOLVER];
3721
+ if (renderer.isSyntheticShadowDefined) {
3722
+ if (shadowMode === 1
3723
+ /* Synthetic */
3724
+ || renderMode === 0
3725
+ /* Light */
3726
+ ) {
3727
+ elm[KEY__SHADOW_RESOLVER] = getRenderRoot(owner)[KEY__SHADOW_RESOLVER];
3728
+ }
3707
3729
  }
3708
3730
  }
3709
3731
 
@@ -3931,13 +3953,10 @@ var LWC = (function (exports) {
3931
3953
  }
3932
3954
 
3933
3955
  var idx = vmBeingRendered.idx,
3934
- renderMode = vmBeingRendered.renderMode,
3935
3956
  shadowMode = vmBeingRendered.shadowMode;
3936
3957
 
3937
3958
  if (shadowMode === 1
3938
3959
  /* Synthetic */
3939
- && renderMode === 1
3940
- /* Shadow */
3941
3960
  ) {
3942
3961
  return StringReplace.call(id, /\S+/g, function (id) {
3943
3962
  return "".concat(id, "-").concat(idx);
@@ -3962,13 +3981,10 @@ var LWC = (function (exports) {
3962
3981
  }
3963
3982
 
3964
3983
  var idx = vmBeingRendered.idx,
3965
- renderMode = vmBeingRendered.renderMode,
3966
3984
  shadowMode = vmBeingRendered.shadowMode; // Apply transformation only for fragment-only-urls, and only in shadow DOM
3967
3985
 
3968
3986
  if (shadowMode === 1
3969
3987
  /* Synthetic */
3970
- && renderMode === 1
3971
- /* Shadow */
3972
3988
  && /^#/.test(url)) {
3973
3989
  return "".concat(url, "-").concat(idx);
3974
3990
  }
@@ -4061,6 +4077,10 @@ var LWC = (function (exports) {
4061
4077
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4062
4078
  */
4063
4079
 
4080
+ function makeHostToken(token) {
4081
+ return "".concat(token, "-host");
4082
+ }
4083
+
4064
4084
  function createInlineStyleVNode(content) {
4065
4085
  return h('style', {
4066
4086
  key: 'style',
@@ -4070,49 +4090,86 @@ var LWC = (function (exports) {
4070
4090
  }, [t(content)]);
4071
4091
  }
4072
4092
 
4073
- function updateSyntheticShadowAttributes(vm, template) {
4093
+ function updateStylesheetToken(vm, template) {
4074
4094
  var elm = vm.elm,
4075
4095
  context = vm.context,
4076
4096
  renderer = vm.renderer,
4077
- renderMode = vm.renderMode;
4097
+ renderMode = vm.renderMode,
4098
+ shadowMode = vm.shadowMode;
4078
4099
  var newStylesheets = template.stylesheets,
4079
- newStylesheetTokens = template.stylesheetTokens;
4080
- var newTokens; // Reset the styling token applied to the host element.
4100
+ newStylesheetToken = template.stylesheetToken;
4101
+ var isSyntheticShadow = renderMode === 1
4102
+ /* Shadow */
4103
+ && shadowMode === 1
4104
+ /* Synthetic */
4105
+ ;
4106
+ var hasScopedStyles = context.hasScopedStyles;
4107
+ var newToken;
4108
+ var newHasTokenInClass;
4109
+ var newHasTokenInAttribute; // Reset the styling token applied to the host element.
4110
+
4111
+ var oldToken = context.stylesheetToken,
4112
+ oldHasTokenInClass = context.hasTokenInClass,
4113
+ oldHasTokenInAttribute = context.hasTokenInAttribute;
4081
4114
 
4082
- var oldHostAttribute = context.hostAttribute;
4115
+ if (oldHasTokenInClass) {
4116
+ renderer.getClassList(elm).remove(makeHostToken(oldToken));
4117
+ }
4083
4118
 
4084
- if (!isUndefined$1(oldHostAttribute)) {
4085
- renderer.removeAttribute(elm, oldHostAttribute);
4119
+ if (oldHasTokenInAttribute) {
4120
+ renderer.removeAttribute(elm, makeHostToken(oldToken));
4086
4121
  } // Apply the new template styling token to the host element, if the new template has any
4087
- // associated stylesheets.
4122
+ // associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
4088
4123
 
4089
4124
 
4090
- if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0 && renderMode === 1
4091
- /* Shadow */
4092
- ) {
4093
- newTokens = newStylesheetTokens;
4094
- }
4125
+ if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
4126
+ newToken = newStylesheetToken;
4127
+ } // Set the new styling token on the host element
4095
4128
 
4096
- if (!isUndefined$1(newTokens)) {
4097
- renderer.setAttribute(elm, newTokens.hostAttribute, '');
4129
+
4130
+ if (!isUndefined$1(newToken)) {
4131
+ if (hasScopedStyles) {
4132
+ renderer.getClassList(elm).add(makeHostToken(newToken));
4133
+ newHasTokenInClass = true;
4134
+ }
4135
+
4136
+ if (isSyntheticShadow) {
4137
+ renderer.setAttribute(elm, makeHostToken(newToken), '');
4138
+ newHasTokenInAttribute = true;
4139
+ }
4098
4140
  } // Update the styling tokens present on the context object.
4099
4141
 
4100
4142
 
4101
- context.hostAttribute = newTokens === null || newTokens === void 0 ? void 0 : newTokens.hostAttribute;
4102
- context.shadowAttribute = newTokens === null || newTokens === void 0 ? void 0 : newTokens.shadowAttribute;
4143
+ context.stylesheetToken = newToken;
4144
+ context.hasTokenInClass = newHasTokenInClass;
4145
+ context.hasTokenInAttribute = newHasTokenInAttribute;
4103
4146
  }
4104
4147
 
4105
- function evaluateStylesheetsContent(stylesheets, hostSelector, shadowSelector, nativeShadow) {
4148
+ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
4106
4149
  var content = [];
4107
4150
 
4108
4151
  for (var _i12 = 0; _i12 < stylesheets.length; _i12++) {
4109
4152
  var stylesheet = stylesheets[_i12];
4110
4153
 
4111
4154
  if (isArray$1(stylesheet)) {
4112
- ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, hostSelector, shadowSelector, nativeShadow));
4155
+ ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
4113
4156
  } else {
4114
-
4115
- ArrayPush$1.call(content, stylesheet(hostSelector, shadowSelector, nativeShadow));
4157
+ // native shadow DOM. Synthetic shadow DOM never uses `:host`.
4158
+
4159
+
4160
+ var isScopedCss = stylesheet[KEY__SCOPED_CSS];
4161
+ var useActualHostSelector = vm.renderMode === 0
4162
+ /* Light */
4163
+ ? !isScopedCss : vm.shadowMode === 0
4164
+ /* Native */
4165
+ ; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
4166
+
4167
+ var scopeToken = isScopedCss || vm.shadowMode === 1
4168
+ /* Synthetic */
4169
+ && vm.renderMode === 1
4170
+ /* Shadow */
4171
+ ? stylesheetToken : undefined;
4172
+ ArrayPush$1.call(content, stylesheet(useActualHostSelector, scopeToken));
4116
4173
  }
4117
4174
  }
4118
4175
 
@@ -4121,34 +4178,35 @@ var LWC = (function (exports) {
4121
4178
 
4122
4179
  function getStylesheetsContent(vm, template) {
4123
4180
  var stylesheets = template.stylesheets,
4124
- stylesheetTokens = template.stylesheetTokens;
4125
- var renderMode = vm.renderMode,
4126
- shadowMode = vm.shadowMode;
4181
+ stylesheetToken = template.stylesheetToken;
4127
4182
  var content = [];
4128
4183
 
4129
4184
  if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
4130
- var hostSelector;
4131
- var shadowSelector; // Scoping with the tokens is only necessary for synthetic shadow. For both
4132
- // light DOM elements and native shadow, we just render the CSS as-is.
4185
+ content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
4186
+ }
4187
+
4188
+ return content;
4189
+ } // It might be worth caching this to avoid doing the lookup repeatedly, but
4190
+ // perf testing has not shown it to be a huge improvement yet:
4191
+ // https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
4192
+
4193
+
4194
+ function getNearestNativeShadowComponent(vm) {
4195
+ var owner = vm;
4133
4196
 
4134
- if (renderMode === 1
4197
+ while (!isNull(owner)) {
4198
+ if (owner.renderMode === 1
4135
4199
  /* Shadow */
4136
- && shadowMode === 1
4137
- /* Synthetic */
4138
- && !isUndefined$1(stylesheetTokens)) {
4139
- hostSelector = "[".concat(stylesheetTokens.hostAttribute, "]");
4140
- shadowSelector = "[".concat(stylesheetTokens.shadowAttribute, "]");
4141
- } else {
4142
- hostSelector = '';
4143
- shadowSelector = '';
4200
+ && owner.shadowMode === 0
4201
+ /* Native */
4202
+ ) {
4203
+ return owner;
4144
4204
  }
4145
4205
 
4146
- content = evaluateStylesheetsContent(stylesheets, hostSelector, shadowSelector, shadowMode === 0
4147
- /* Native */
4148
- );
4206
+ owner = owner.owner;
4149
4207
  }
4150
4208
 
4151
- return content;
4209
+ return owner;
4152
4210
  }
4153
4211
 
4154
4212
  function createStylesheet(vm, stylesheets) {
@@ -4164,13 +4222,26 @@ var LWC = (function (exports) {
4164
4222
  for (var _i13 = 0; _i13 < stylesheets.length; _i13++) {
4165
4223
  renderer.insertGlobalStylesheet(stylesheets[_i13]);
4166
4224
  }
4167
-
4168
- return null;
4169
- } else {
4170
- // native shadow or light DOM
4225
+ } else if (renderer.ssr) {
4226
+ // native shadow or light DOM, SSR
4171
4227
  var combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
4172
4228
  return createInlineStyleVNode(combinedStylesheetContent);
4229
+ } else {
4230
+ // native shadow or light DOM, DOM renderer
4231
+ var root = getNearestNativeShadowComponent(vm);
4232
+ var isGlobal = isNull(root);
4233
+
4234
+ for (var _i14 = 0; _i14 < stylesheets.length; _i14++) {
4235
+ if (isGlobal) {
4236
+ renderer.insertGlobalStylesheet(stylesheets[_i14]);
4237
+ } else {
4238
+ // local level
4239
+ renderer.insertStylesheet(stylesheets[_i14], root.cmpRoot);
4240
+ }
4241
+ }
4173
4242
  }
4243
+
4244
+ return null;
4174
4245
  }
4175
4246
  /** Indicates if operations should be logged by the profiler. */
4176
4247
 
@@ -4287,8 +4358,7 @@ var LWC = (function (exports) {
4287
4358
  context = vm.context,
4288
4359
  cmpSlots = vm.cmpSlots,
4289
4360
  cmpTemplate = vm.cmpTemplate,
4290
- tro = vm.tro,
4291
- shadowMode = vm.shadowMode;
4361
+ tro = vm.tro;
4292
4362
  tro.observe(function () {
4293
4363
  // Reset the cache memoizer for template when needed.
4294
4364
  if (html !== cmpTemplate) {
@@ -4310,15 +4380,12 @@ var LWC = (function (exports) {
4310
4380
 
4311
4381
  vm.cmpTemplate = html; // Create a brand new template cache for the swapped templated.
4312
4382
 
4313
- context.tplCache = create(null); // Update the synthetic shadow attributes on the host element if necessary.
4383
+ context.tplCache = create(null); // Set the computeHasScopedStyles property in the context, to avoid recomputing it repeatedly.
4314
4384
 
4315
- if (shadowMode === 1
4316
- /* Synthetic */
4317
- ) {
4318
- updateSyntheticShadowAttributes(vm, html);
4319
- } // Evaluate, create stylesheet and cache the produced VNode for future
4320
- // re-rendering.
4385
+ context.hasScopedStyles = computeHasScopedStyles(html); // Update the scoping token on the host element.
4321
4386
 
4387
+ updateStylesheetToken(vm, html); // Evaluate, create stylesheet and cache the produced VNode for future
4388
+ // re-rendering.
4322
4389
 
4323
4390
  var stylesheetsContent = getStylesheetsContent(vm, html);
4324
4391
  context.styleVNode = stylesheetsContent.length === 0 ? null : createStylesheet(vm, stylesheetsContent);
@@ -4349,6 +4416,20 @@ var LWC = (function (exports) {
4349
4416
 
4350
4417
  return vnodes;
4351
4418
  }
4419
+
4420
+ function computeHasScopedStyles(template) {
4421
+ var stylesheets = template.stylesheets;
4422
+
4423
+ if (!isUndefined$1(stylesheets)) {
4424
+ for (var _i15 = 0; _i15 < stylesheets.length; _i15++) {
4425
+ if (isTrue(stylesheets[_i15][KEY__SCOPED_CSS])) {
4426
+ return true;
4427
+ }
4428
+ }
4429
+ }
4430
+
4431
+ return false;
4432
+ }
4352
4433
  /*
4353
4434
  * Copyright (c) 2018, salesforce.com, inc.
4354
4435
  * All rights reserved.
@@ -4377,12 +4458,9 @@ var LWC = (function (exports) {
4377
4458
  var component = vm.component,
4378
4459
  callHook = vm.callHook,
4379
4460
  owner = vm.owner;
4380
- var result;
4381
4461
  runWithBoundaryProtection(vm, owner, noop, function () {
4382
- // job
4383
- result = callHook(component, fn, args);
4462
+ callHook(component, fn, args);
4384
4463
  }, noop);
4385
- return result;
4386
4464
  }
4387
4465
 
4388
4466
  function invokeComponentConstructor(vm, Ctor) {
@@ -4447,29 +4525,6 @@ var LWC = (function (exports) {
4447
4525
  return renderInvocationSuccessful ? evaluateTemplate(vm, html) : [];
4448
4526
  }
4449
4527
 
4450
- function invokeComponentRenderedCallback(vm) {
4451
- var renderedCallback = vm.def.renderedCallback,
4452
- component = vm.component,
4453
- callHook = vm.callHook,
4454
- owner = vm.owner;
4455
-
4456
- if (!isUndefined$1(renderedCallback)) {
4457
- runWithBoundaryProtection(vm, owner, function () {
4458
- logOperationStart(4
4459
- /* RenderedCallback */
4460
- , vm);
4461
- }, function () {
4462
- // job
4463
- callHook(component, renderedCallback);
4464
- }, function () {
4465
- // post
4466
- logOperationEnd(4
4467
- /* RenderedCallback */
4468
- , vm);
4469
- });
4470
- }
4471
- }
4472
-
4473
4528
  function invokeEventListener(vm, fn, thisValue, event) {
4474
4529
  var callHook = vm.callHook,
4475
4530
  owner = vm.owner;
@@ -4568,8 +4623,8 @@ var LWC = (function (exports) {
4568
4623
 
4569
4624
  function register(service) {
4570
4625
 
4571
- for (var _i14 = 0; _i14 < hooks.length; ++_i14) {
4572
- var hookName = hooks[_i14];
4626
+ for (var _i16 = 0; _i16 < hooks.length; ++_i16) {
4627
+ var hookName = hooks[_i16];
4573
4628
 
4574
4629
  if (hookName in service) {
4575
4630
  var l = Services[hookName];
@@ -4589,8 +4644,8 @@ var LWC = (function (exports) {
4589
4644
  def = vm.def,
4590
4645
  context = vm.context;
4591
4646
 
4592
- for (var _i15 = 0, _len6 = cbs.length; _i15 < _len6; ++_i15) {
4593
- cbs[_i15].call(undefined, component, {}, def, context);
4647
+ for (var _i17 = 0, _len6 = cbs.length; _i17 < _len6; ++_i17) {
4648
+ cbs[_i17].call(undefined, component, {}, def, context);
4594
4649
  }
4595
4650
  }
4596
4651
  /*
@@ -4601,7 +4656,6 @@ var LWC = (function (exports) {
4601
4656
  */
4602
4657
 
4603
4658
 
4604
- var isNativeShadowRootDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
4605
4659
  var idx = 0;
4606
4660
  /** The internal slot used to associate different objects the engine manipulates with the VM */
4607
4661
 
@@ -4684,27 +4738,23 @@ var LWC = (function (exports) {
4684
4738
  resetComponentStateWhenRemoved(vm);
4685
4739
  }
4686
4740
 
4741
+ function getNearestShadowAncestor(vm) {
4742
+ var ancestor = vm.owner;
4743
+
4744
+ while (!isNull(ancestor) && ancestor.renderMode === 0
4745
+ /* Light */
4746
+ ) {
4747
+ ancestor = ancestor.owner;
4748
+ }
4749
+
4750
+ return ancestor;
4751
+ }
4752
+
4687
4753
  function createVM(elm, def, options) {
4688
4754
  var mode = options.mode,
4689
4755
  owner = options.owner,
4690
4756
  renderer = options.renderer,
4691
4757
  tagName = options.tagName;
4692
- var shadowMode;
4693
-
4694
- if (renderer.syntheticShadow) {
4695
- shadowMode = def.shadowSupportMode === "any"
4696
- /* Any */
4697
- && isNativeShadowRootDefined ? 0
4698
- /* Native */
4699
- : 1
4700
- /* Synthetic */
4701
- ;
4702
- } else {
4703
- shadowMode = 0
4704
- /* Native */
4705
- ;
4706
- }
4707
-
4708
4758
  var vm = {
4709
4759
  elm: elm,
4710
4760
  def: def,
@@ -4727,10 +4777,12 @@ var LWC = (function (exports) {
4727
4777
  oar: create(null),
4728
4778
  cmpTemplate: null,
4729
4779
  renderMode: def.renderMode,
4730
- shadowMode: shadowMode,
4780
+ shadowMode: null,
4731
4781
  context: {
4732
- hostAttribute: undefined,
4733
- shadowAttribute: undefined,
4782
+ stylesheetToken: undefined,
4783
+ hasTokenInClass: undefined,
4784
+ hasTokenInAttribute: undefined,
4785
+ hasScopedStyles: undefined,
4734
4786
  styleVNode: null,
4735
4787
  tplCache: EmptyObject,
4736
4788
  wiredConnecting: EmptyArray,
@@ -4743,18 +4795,77 @@ var LWC = (function (exports) {
4743
4795
  setHook: setHook,
4744
4796
  getHook: getHook
4745
4797
  };
4798
+ vm.shadowMode = computeShadowMode(vm);
4746
4799
  vm.tro = getTemplateReactiveObserver(vm);
4747
4800
 
4748
4801
 
4749
4802
  invokeComponentConstructor(vm, def.ctor); // Initializing the wire decorator per instance only when really needed
4750
4803
 
4751
- if (isFalse(renderer.ssr) && hasWireAdapters(vm)) {
4804
+ if (hasWireAdapters(vm)) {
4752
4805
  installWireAdapters(vm);
4753
4806
  }
4754
4807
 
4755
4808
  return vm;
4756
4809
  }
4757
4810
 
4811
+ function computeShadowMode(vm) {
4812
+ var def = vm.def,
4813
+ renderer = vm.renderer;
4814
+ var isNativeShadowDefined = renderer.isNativeShadowDefined,
4815
+ isSyntheticShadowDefined = renderer.isSyntheticShadowDefined;
4816
+ var shadowMode;
4817
+
4818
+ if (isSyntheticShadowDefined) {
4819
+ if (def.renderMode === 0
4820
+ /* Light */
4821
+ ) {
4822
+ // ShadowMode.Native implies "not synthetic shadow" which is consistent with how
4823
+ // everything defaults to native when the synthetic shadow polyfill is unavailable.
4824
+ shadowMode = 0
4825
+ /* Native */
4826
+ ;
4827
+ } else if (isNativeShadowDefined) {
4828
+ if (def.shadowSupportMode === "any"
4829
+ /* Any */
4830
+ ) {
4831
+ shadowMode = 0
4832
+ /* Native */
4833
+ ;
4834
+ } else {
4835
+ var shadowAncestor = getNearestShadowAncestor(vm);
4836
+
4837
+ if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
4838
+ /* Native */
4839
+ ) {
4840
+ // Transitive support for native Shadow DOM. A component in native mode
4841
+ // transitively opts all of its descendants into native.
4842
+ shadowMode = 0
4843
+ /* Native */
4844
+ ;
4845
+ } else {
4846
+ // Synthetic if neither this component nor any of its ancestors are configured
4847
+ // to be native.
4848
+ shadowMode = 1
4849
+ /* Synthetic */
4850
+ ;
4851
+ }
4852
+ }
4853
+ } else {
4854
+ // Synthetic if there is no native Shadow DOM support.
4855
+ shadowMode = 1
4856
+ /* Synthetic */
4857
+ ;
4858
+ }
4859
+ } else {
4860
+ // Native if the synthetic shadow polyfill is unavailable.
4861
+ shadowMode = 0
4862
+ /* Native */
4863
+ ;
4864
+ }
4865
+
4866
+ return shadowMode;
4867
+ }
4868
+
4758
4869
  function associateVM(obj, vm) {
4759
4870
  ViewModelReflection.set(obj, vm);
4760
4871
  }
@@ -4818,7 +4929,10 @@ var LWC = (function (exports) {
4818
4929
  }
4819
4930
 
4820
4931
  function runRenderedCallback(vm) {
4821
- if (isTrue(vm.renderer.ssr)) {
4932
+ var renderer = vm.renderer,
4933
+ renderedCallback = vm.def.renderedCallback;
4934
+
4935
+ if (isTrue(renderer.ssr)) {
4822
4936
  return;
4823
4937
  }
4824
4938
 
@@ -4828,7 +4942,15 @@ var LWC = (function (exports) {
4828
4942
  invokeServiceHook(vm, rendered);
4829
4943
  }
4830
4944
 
4831
- invokeComponentRenderedCallback(vm);
4945
+ if (!isUndefined$1(renderedCallback)) {
4946
+ logOperationStart(4
4947
+ /* RenderedCallback */
4948
+ , vm);
4949
+ invokeComponentCallback(vm, renderedCallback);
4950
+ logOperationEnd(4
4951
+ /* RenderedCallback */
4952
+ , vm);
4953
+ }
4832
4954
  }
4833
4955
 
4834
4956
  var rehydrateQueue = [];
@@ -4843,19 +4965,19 @@ var LWC = (function (exports) {
4843
4965
  });
4844
4966
  rehydrateQueue = []; // reset to a new queue
4845
4967
 
4846
- for (var _i16 = 0, _len7 = vms.length; _i16 < _len7; _i16 += 1) {
4847
- var vm = vms[_i16];
4968
+ for (var _i18 = 0, _len7 = vms.length; _i18 < _len7; _i18 += 1) {
4969
+ var vm = vms[_i18];
4848
4970
 
4849
4971
  try {
4850
4972
  rehydrate(vm);
4851
4973
  } catch (error) {
4852
- if (_i16 + 1 < _len7) {
4974
+ if (_i18 + 1 < _len7) {
4853
4975
  // pieces of the queue are still pending to be rehydrated, those should have priority
4854
4976
  if (rehydrateQueue.length === 0) {
4855
4977
  addCallbackToNextTick(flushRehydrationQueue);
4856
4978
  }
4857
4979
 
4858
- ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i16 + 1));
4980
+ ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i18 + 1));
4859
4981
  } // we need to end the measure before throwing.
4860
4982
 
4861
4983
 
@@ -4954,8 +5076,8 @@ var LWC = (function (exports) {
4954
5076
  var vCustomElementCollection = vm.velements; // Reporting disconnection for every child in inverse order since they are
4955
5077
  // inserted in reserved order.
4956
5078
 
4957
- for (var _i17 = vCustomElementCollection.length - 1; _i17 >= 0; _i17 -= 1) {
4958
- var elm = vCustomElementCollection[_i17].elm; // There are two cases where the element could be undefined:
5079
+ for (var _i19 = vCustomElementCollection.length - 1; _i19 >= 0; _i19 -= 1) {
5080
+ var elm = vCustomElementCollection[_i19].elm; // There are two cases where the element could be undefined:
4959
5081
  // * when there is an error during the construction phase, and an error
4960
5082
  // boundary picks it, there is a possibility that the VCustomElement
4961
5083
  // is not properly initialized, and therefore is should be ignored.
@@ -4989,8 +5111,8 @@ var LWC = (function (exports) {
4989
5111
 
4990
5112
 
4991
5113
  function recursivelyDisconnectChildren(vnodes) {
4992
- for (var _i18 = 0, _len8 = vnodes.length; _i18 < _len8; _i18 += 1) {
4993
- var vnode = vnodes[_i18];
5114
+ for (var _i20 = 0, _len8 = vnodes.length; _i20 < _len8; _i20 += 1) {
5115
+ var vnode = vnodes[_i20];
4994
5116
 
4995
5117
  if (!isNull(vnode) && isArray$1(vnode.children) && !isUndefined$1(vnode.elm)) {
4996
5118
  // vnode is a VElement with children
@@ -5014,8 +5136,8 @@ var LWC = (function (exports) {
5014
5136
  renderer = vm.renderer;
5015
5137
  var rootNode = getRenderRoot(vm);
5016
5138
 
5017
- for (var _i19 = 0, _len9 = children.length; _i19 < _len9; _i19++) {
5018
- var child = children[_i19];
5139
+ for (var _i21 = 0, _len9 = children.length; _i21 < _len9; _i21++) {
5140
+ var child = children[_i21];
5019
5141
 
5020
5142
  if (!isNull(child) && !isUndefined$1(child.elm)) {
5021
5143
  renderer.remove(child.elm, rootNode);
@@ -5060,8 +5182,8 @@ var LWC = (function (exports) {
5060
5182
  var oldSlots = vm.cmpSlots;
5061
5183
  var cmpSlots = vm.cmpSlots = create(null);
5062
5184
 
5063
- for (var _i20 = 0, _len10 = children.length; _i20 < _len10; _i20 += 1) {
5064
- var vnode = children[_i20];
5185
+ for (var _i22 = 0, _len10 = children.length; _i22 < _len10; _i22 += 1) {
5186
+ var vnode = children[_i22];
5065
5187
 
5066
5188
  if (isNull(vnode)) {
5067
5189
  continue;
@@ -5091,8 +5213,8 @@ var LWC = (function (exports) {
5091
5213
  return;
5092
5214
  }
5093
5215
 
5094
- for (var _i21 = 0, _len11 = oldKeys.length; _i21 < _len11; _i21 += 1) {
5095
- var key = oldKeys[_i21];
5216
+ for (var _i23 = 0, _len11 = oldKeys.length; _i23 < _len11; _i23 += 1) {
5217
+ var key = oldKeys[_i23];
5096
5218
 
5097
5219
  if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
5098
5220
  markComponentAsDirty(vm);
@@ -5410,11 +5532,14 @@ var LWC = (function (exports) {
5410
5532
  ArrayPush$1.call(wiredConnecting, function () {
5411
5533
  connector.connect();
5412
5534
 
5413
- if (hasDynamicParams) {
5414
- Promise.resolve().then(computeConfigAndUpdate);
5415
- } else {
5416
- computeConfigAndUpdate();
5535
+ if (!runtimeFlags.ENABLE_WIRE_SYNC_EMIT) {
5536
+ if (hasDynamicParams) {
5537
+ Promise.resolve().then(computeConfigAndUpdate);
5538
+ return;
5539
+ }
5417
5540
  }
5541
+
5542
+ computeConfigAndUpdate();
5418
5543
  });
5419
5544
  ArrayPush$1.call(wiredDisconnecting, function () {
5420
5545
  connector.disconnect();
@@ -5428,8 +5553,8 @@ var LWC = (function (exports) {
5428
5553
  function connectWireAdapters(vm) {
5429
5554
  var wiredConnecting = vm.context.wiredConnecting;
5430
5555
 
5431
- for (var _i22 = 0, _len12 = wiredConnecting.length; _i22 < _len12; _i22 += 1) {
5432
- wiredConnecting[_i22]();
5556
+ for (var _i24 = 0, _len12 = wiredConnecting.length; _i24 < _len12; _i24 += 1) {
5557
+ wiredConnecting[_i24]();
5433
5558
  }
5434
5559
  }
5435
5560
 
@@ -5437,8 +5562,8 @@ var LWC = (function (exports) {
5437
5562
  var wiredDisconnecting = vm.context.wiredDisconnecting;
5438
5563
  runWithBoundaryProtection(vm, vm, noop, function () {
5439
5564
  // job
5440
- for (var _i23 = 0, _len13 = wiredDisconnecting.length; _i23 < _len13; _i23 += 1) {
5441
- wiredDisconnecting[_i23]();
5565
+ for (var _i25 = 0, _len13 = wiredDisconnecting.length; _i25 < _len13; _i25 += 1) {
5566
+ wiredDisconnecting[_i25]();
5442
5567
  }
5443
5568
  }, noop);
5444
5569
  }
@@ -5507,7 +5632,7 @@ var LWC = (function (exports) {
5507
5632
 
5508
5633
  return reactiveMembrane.getReadOnlyProxy(obj);
5509
5634
  }
5510
- /* version: 2.3.3 */
5635
+ /* version: 2.5.0 */
5511
5636
 
5512
5637
  /*
5513
5638
  * Copyright (c) 2018, salesforce.com, inc.
@@ -5520,6 +5645,10 @@ var LWC = (function (exports) {
5520
5645
  var globalStylesheets = create(null);
5521
5646
 
5522
5647
  var globalStylesheetsParentElement = document.head || document.body || document;
5648
+ var supportsConstructableStyleSheets = isFunction$1(CSSStyleSheet.prototype.replaceSync);
5649
+ var styleElements = create(null);
5650
+ var styleSheets = create(null);
5651
+ var nodesToStyleSheets = new WeakMap();
5523
5652
  var getCustomElement, defineCustomElement, HTMLElementConstructor;
5524
5653
 
5525
5654
  function isCustomElementRegistryAvailable() {
@@ -5558,6 +5687,52 @@ var LWC = (function (exports) {
5558
5687
  }
5559
5688
  }
5560
5689
 
5690
+ function insertConstructableStyleSheet(content, target) {
5691
+ // It's important for CSSStyleSheets to be unique based on their content, so that
5692
+ // `shadowRoot.adoptedStyleSheets.includes(sheet)` works.
5693
+ var styleSheet = styleSheets[content];
5694
+
5695
+ if (isUndefined$1(styleSheet)) {
5696
+ styleSheet = new CSSStyleSheet();
5697
+ styleSheet.replaceSync(content);
5698
+ styleSheets[content] = styleSheet;
5699
+ }
5700
+
5701
+ if (!target.adoptedStyleSheets.includes(styleSheet)) {
5702
+ target.adoptedStyleSheets = [].concat(_toConsumableArray(target.adoptedStyleSheets), [styleSheet]);
5703
+ }
5704
+ }
5705
+
5706
+ function insertStyleElement(content, target) {
5707
+ // Avoid inserting duplicate `<style>`s
5708
+ var sheets = nodesToStyleSheets.get(target);
5709
+
5710
+ if (isUndefined$1(sheets)) {
5711
+ sheets = create(null);
5712
+ nodesToStyleSheets.set(target, sheets);
5713
+ }
5714
+
5715
+ if (sheets[content]) {
5716
+ return;
5717
+ }
5718
+
5719
+ sheets[content] = true; // This `<style>` may be repeated multiple times in the DOM, so cache it. It's a bit
5720
+ // faster to call `cloneNode()` on an existing node than to recreate it every time.
5721
+
5722
+ var elm = styleElements[content];
5723
+
5724
+ if (isUndefined$1(elm)) {
5725
+ elm = document.createElement('style');
5726
+ elm.type = 'text/css';
5727
+ elm.textContent = content;
5728
+ styleElements[content] = elm;
5729
+ } else {
5730
+ elm = elm.cloneNode(true);
5731
+ }
5732
+
5733
+ target.appendChild(elm);
5734
+ }
5735
+
5561
5736
  if (isCustomElementRegistryAvailable()) {
5562
5737
  getCustomElement = customElements.get.bind(customElements);
5563
5738
  defineCustomElement = customElements.define.bind(customElements);
@@ -5601,7 +5776,8 @@ var LWC = (function (exports) {
5601
5776
 
5602
5777
  var renderer = {
5603
5778
  ssr: false,
5604
- syntheticShadow: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
5779
+ isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
5780
+ isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
5605
5781
  createElement: function createElement(tagName, namespace) {
5606
5782
  return isUndefined$1(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
5607
5783
  },
@@ -5692,6 +5868,14 @@ var LWC = (function (exports) {
5692
5868
  elm.textContent = content;
5693
5869
  globalStylesheetsParentElement.appendChild(elm);
5694
5870
  },
5871
+ insertStylesheet: function insertStylesheet(content, target) {
5872
+ if (supportsConstructableStyleSheets) {
5873
+ insertConstructableStyleSheet(content, target);
5874
+ } else {
5875
+ // Fall back to <style> element
5876
+ insertStyleElement(content, target);
5877
+ }
5878
+ },
5695
5879
  assertInstanceOfHTMLElement: function assertInstanceOfHTMLElement(elm, msg) {
5696
5880
  assert.invariant(elm instanceof HTMLElement, msg);
5697
5881
  },
@@ -5926,7 +6110,7 @@ var LWC = (function (exports) {
5926
6110
  return false;
5927
6111
  }
5928
6112
 
5929
- if (renderer.syntheticShadow) {
6113
+ if (renderer.isSyntheticShadowDefined) {
5930
6114
  // TODO [#1252]: old behavior that is still used by some pieces of the platform,
5931
6115
  // specifically, nodes inserted manually on places where `lwc:dom="manual"` directive is not
5932
6116
  // used, will be considered global elements.
@@ -5978,7 +6162,7 @@ var LWC = (function (exports) {
5978
6162
  });
5979
6163
  freeze(LightningElement);
5980
6164
  seal(LightningElement.prototype);
5981
- /* version: 2.3.3 */
6165
+ /* version: 2.5.0 */
5982
6166
 
5983
6167
  exports.LightningElement = LightningElement;
5984
6168
  exports.__unstable__ProfilerControl = profilerControl;