lwc 2.3.4 → 2.5.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 (41) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +389 -174
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +389 -174
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +359 -137
  5. package/dist/engine-dom/iife/es5/engine-dom.js +404 -198
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +372 -159
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +389 -174
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +359 -137
  11. package/dist/engine-dom/umd/es5/engine-dom.js +404 -198
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -2
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +372 -159
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +333 -181
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
  16. package/dist/engine-server/esm/es2017/engine-server.js +333 -181
  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.4 */
344
+ /** version: 2.5.1 */
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.4 */
515
+ /** version: 2.5.1 */
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 = {
@@ -2690,8 +2693,15 @@ var LWC = (function (exports) {
2690
2693
 
2691
2694
  descriptor = createPublicAccessorDescriptor(fieldName, descriptor);
2692
2695
  } else {
2696
+ // with the same name, the property is defined as a public accessor. This branch is
2697
+ // only here for backward compatibility reasons.
2698
+
2693
2699
 
2694
- descriptor = createPublicPropertyDescriptor(fieldName);
2700
+ if (!isUndefined$1(descriptor) && !isUndefined$1(descriptor.get)) {
2701
+ descriptor = createPublicAccessorDescriptor(fieldName, descriptor);
2702
+ } else {
2703
+ descriptor = createPublicPropertyDescriptor(fieldName);
2704
+ }
2695
2705
  }
2696
2706
 
2697
2707
  apiFields[fieldName] = descriptor;
@@ -2752,8 +2762,15 @@ var LWC = (function (exports) {
2752
2762
  for (var _i9 = 0, n = fields.length; _i9 < n; _i9++) {
2753
2763
  var _fieldName2 = fields[_i9];
2754
2764
  descriptor = getOwnPropertyDescriptor$1(proto, _fieldName2);
2765
+ // tracked property. This is only here for backward compatibility purposes.
2766
+
2767
+
2768
+ var isDuplicatePublicProp = !isUndefined$1(publicProps) && _fieldName2 in publicProps;
2769
+ var isDuplicateTrackedProp = !isUndefined$1(track) && _fieldName2 in track;
2755
2770
 
2756
- observedFields[_fieldName2] = createObservedFieldPropertyDescriptor(_fieldName2);
2771
+ if (!isDuplicatePublicProp && !isDuplicateTrackedProp) {
2772
+ observedFields[_fieldName2] = createObservedFieldPropertyDescriptor(_fieldName2);
2773
+ }
2757
2774
  }
2758
2775
  }
2759
2776
 
@@ -3293,6 +3310,17 @@ var LWC = (function (exports) {
3293
3310
 
3294
3311
  function setElementShadowToken(elm, token) {
3295
3312
  elm.$shadowToken$ = token;
3313
+ } // Set the scope token class for *.scoped.css styles
3314
+
3315
+
3316
+ function setScopeTokenClassIfNecessary(elm, owner) {
3317
+ var cmpTemplate = owner.cmpTemplate,
3318
+ context = owner.context;
3319
+ var token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
3320
+
3321
+ if (!isUndefined$1(token) && context.hasScopedStyles) {
3322
+ owner.renderer.getClassList(elm).add(token);
3323
+ }
3296
3324
  }
3297
3325
 
3298
3326
  function updateNodeHook(oldVnode, vnode) {
@@ -3333,12 +3361,13 @@ var LWC = (function (exports) {
3333
3361
 
3334
3362
  function fallbackElmHook(elm, vnode) {
3335
3363
  var owner = vnode.owner;
3364
+ setScopeTokenClassIfNecessary(elm, owner);
3336
3365
 
3337
3366
  if (owner.shadowMode === 1
3338
3367
  /* Synthetic */
3339
3368
  ) {
3340
3369
  var context = vnode.data.context;
3341
- var shadowAttribute = owner.context.shadowAttribute;
3370
+ var stylesheetToken = owner.context.stylesheetToken;
3342
3371
 
3343
3372
  if (!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
3344
3373
  /* manual */
@@ -3349,7 +3378,7 @@ var LWC = (function (exports) {
3349
3378
  // into each element from the template, so they can be styled accordingly.
3350
3379
 
3351
3380
 
3352
- setElementShadowToken(elm, shadowAttribute);
3381
+ setElementShadowToken(elm, stylesheetToken);
3353
3382
  }
3354
3383
  }
3355
3384
 
@@ -3414,14 +3443,15 @@ var LWC = (function (exports) {
3414
3443
  mode = vnode.mode,
3415
3444
  ctor = vnode.ctor,
3416
3445
  owner = vnode.owner;
3446
+ setScopeTokenClassIfNecessary(elm, owner);
3417
3447
 
3418
3448
  if (owner.shadowMode === 1
3419
3449
  /* Synthetic */
3420
3450
  ) {
3421
- var shadowAttribute = owner.context.shadowAttribute; // when running in synthetic shadow mode, we need to set the shadowToken value
3451
+ var stylesheetToken = owner.context.stylesheetToken; // when running in synthetic shadow mode, we need to set the shadowToken value
3422
3452
  // into each element from the template, so they can be styled accordingly.
3423
3453
 
3424
- setElementShadowToken(elm, shadowAttribute);
3454
+ setElementShadowToken(elm, stylesheetToken);
3425
3455
  }
3426
3456
 
3427
3457
  var def = getComponentInternalDef(ctor);
@@ -3698,12 +3728,18 @@ var LWC = (function (exports) {
3698
3728
  };
3699
3729
 
3700
3730
  function linkNodeToShadow(elm, owner) {
3701
- var shadowMode = owner.shadowMode; // TODO [#1164]: this should eventually be done by the polyfill directly
3731
+ var renderer = owner.renderer,
3732
+ renderMode = owner.renderMode,
3733
+ shadowMode = owner.shadowMode; // TODO [#1164]: this should eventually be done by the polyfill directly
3702
3734
 
3703
- if (shadowMode === 1
3704
- /* Synthetic */
3705
- ) {
3706
- elm[KEY__SHADOW_RESOLVER] = getRenderRoot(owner)[KEY__SHADOW_RESOLVER];
3735
+ if (renderer.isSyntheticShadowDefined) {
3736
+ if (shadowMode === 1
3737
+ /* Synthetic */
3738
+ || renderMode === 0
3739
+ /* Light */
3740
+ ) {
3741
+ elm[KEY__SHADOW_RESOLVER] = getRenderRoot(owner)[KEY__SHADOW_RESOLVER];
3742
+ }
3707
3743
  }
3708
3744
  }
3709
3745
 
@@ -3931,13 +3967,10 @@ var LWC = (function (exports) {
3931
3967
  }
3932
3968
 
3933
3969
  var idx = vmBeingRendered.idx,
3934
- renderMode = vmBeingRendered.renderMode,
3935
3970
  shadowMode = vmBeingRendered.shadowMode;
3936
3971
 
3937
3972
  if (shadowMode === 1
3938
3973
  /* Synthetic */
3939
- && renderMode === 1
3940
- /* Shadow */
3941
3974
  ) {
3942
3975
  return StringReplace.call(id, /\S+/g, function (id) {
3943
3976
  return "".concat(id, "-").concat(idx);
@@ -3962,13 +3995,10 @@ var LWC = (function (exports) {
3962
3995
  }
3963
3996
 
3964
3997
  var idx = vmBeingRendered.idx,
3965
- renderMode = vmBeingRendered.renderMode,
3966
3998
  shadowMode = vmBeingRendered.shadowMode; // Apply transformation only for fragment-only-urls, and only in shadow DOM
3967
3999
 
3968
4000
  if (shadowMode === 1
3969
4001
  /* Synthetic */
3970
- && renderMode === 1
3971
- /* Shadow */
3972
4002
  && /^#/.test(url)) {
3973
4003
  return "".concat(url, "-").concat(idx);
3974
4004
  }
@@ -4061,6 +4091,10 @@ var LWC = (function (exports) {
4061
4091
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4062
4092
  */
4063
4093
 
4094
+ function makeHostToken(token) {
4095
+ return "".concat(token, "-host");
4096
+ }
4097
+
4064
4098
  function createInlineStyleVNode(content) {
4065
4099
  return h('style', {
4066
4100
  key: 'style',
@@ -4070,49 +4104,86 @@ var LWC = (function (exports) {
4070
4104
  }, [t(content)]);
4071
4105
  }
4072
4106
 
4073
- function updateSyntheticShadowAttributes(vm, template) {
4107
+ function updateStylesheetToken(vm, template) {
4074
4108
  var elm = vm.elm,
4075
4109
  context = vm.context,
4076
4110
  renderer = vm.renderer,
4077
- renderMode = vm.renderMode;
4111
+ renderMode = vm.renderMode,
4112
+ shadowMode = vm.shadowMode;
4078
4113
  var newStylesheets = template.stylesheets,
4079
- newStylesheetTokens = template.stylesheetTokens;
4080
- var newTokens; // Reset the styling token applied to the host element.
4114
+ newStylesheetToken = template.stylesheetToken;
4115
+ var isSyntheticShadow = renderMode === 1
4116
+ /* Shadow */
4117
+ && shadowMode === 1
4118
+ /* Synthetic */
4119
+ ;
4120
+ var hasScopedStyles = context.hasScopedStyles;
4121
+ var newToken;
4122
+ var newHasTokenInClass;
4123
+ var newHasTokenInAttribute; // Reset the styling token applied to the host element.
4081
4124
 
4082
- var oldHostAttribute = context.hostAttribute;
4125
+ var oldToken = context.stylesheetToken,
4126
+ oldHasTokenInClass = context.hasTokenInClass,
4127
+ oldHasTokenInAttribute = context.hasTokenInAttribute;
4083
4128
 
4084
- if (!isUndefined$1(oldHostAttribute)) {
4085
- renderer.removeAttribute(elm, oldHostAttribute);
4129
+ if (oldHasTokenInClass) {
4130
+ renderer.getClassList(elm).remove(makeHostToken(oldToken));
4131
+ }
4132
+
4133
+ if (oldHasTokenInAttribute) {
4134
+ renderer.removeAttribute(elm, makeHostToken(oldToken));
4086
4135
  } // Apply the new template styling token to the host element, if the new template has any
4087
- // associated stylesheets.
4136
+ // associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
4088
4137
 
4089
4138
 
4090
- if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0 && renderMode === 1
4091
- /* Shadow */
4092
- ) {
4093
- newTokens = newStylesheetTokens;
4094
- }
4139
+ if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
4140
+ newToken = newStylesheetToken;
4141
+ } // Set the new styling token on the host element
4142
+
4095
4143
 
4096
- if (!isUndefined$1(newTokens)) {
4097
- renderer.setAttribute(elm, newTokens.hostAttribute, '');
4144
+ if (!isUndefined$1(newToken)) {
4145
+ if (hasScopedStyles) {
4146
+ renderer.getClassList(elm).add(makeHostToken(newToken));
4147
+ newHasTokenInClass = true;
4148
+ }
4149
+
4150
+ if (isSyntheticShadow) {
4151
+ renderer.setAttribute(elm, makeHostToken(newToken), '');
4152
+ newHasTokenInAttribute = true;
4153
+ }
4098
4154
  } // Update the styling tokens present on the context object.
4099
4155
 
4100
4156
 
4101
- context.hostAttribute = newTokens === null || newTokens === void 0 ? void 0 : newTokens.hostAttribute;
4102
- context.shadowAttribute = newTokens === null || newTokens === void 0 ? void 0 : newTokens.shadowAttribute;
4157
+ context.stylesheetToken = newToken;
4158
+ context.hasTokenInClass = newHasTokenInClass;
4159
+ context.hasTokenInAttribute = newHasTokenInAttribute;
4103
4160
  }
4104
4161
 
4105
- function evaluateStylesheetsContent(stylesheets, hostSelector, shadowSelector, nativeShadow) {
4162
+ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
4106
4163
  var content = [];
4107
4164
 
4108
4165
  for (var _i12 = 0; _i12 < stylesheets.length; _i12++) {
4109
4166
  var stylesheet = stylesheets[_i12];
4110
4167
 
4111
4168
  if (isArray$1(stylesheet)) {
4112
- ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, hostSelector, shadowSelector, nativeShadow));
4169
+ ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
4113
4170
  } else {
4114
-
4115
- ArrayPush$1.call(content, stylesheet(hostSelector, shadowSelector, nativeShadow));
4171
+ // native shadow DOM. Synthetic shadow DOM never uses `:host`.
4172
+
4173
+
4174
+ var isScopedCss = stylesheet[KEY__SCOPED_CSS];
4175
+ var useActualHostSelector = vm.renderMode === 0
4176
+ /* Light */
4177
+ ? !isScopedCss : vm.shadowMode === 0
4178
+ /* Native */
4179
+ ; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
4180
+
4181
+ var scopeToken = isScopedCss || vm.shadowMode === 1
4182
+ /* Synthetic */
4183
+ && vm.renderMode === 1
4184
+ /* Shadow */
4185
+ ? stylesheetToken : undefined;
4186
+ ArrayPush$1.call(content, stylesheet(useActualHostSelector, scopeToken));
4116
4187
  }
4117
4188
  }
4118
4189
 
@@ -4121,34 +4192,35 @@ var LWC = (function (exports) {
4121
4192
 
4122
4193
  function getStylesheetsContent(vm, template) {
4123
4194
  var stylesheets = template.stylesheets,
4124
- stylesheetTokens = template.stylesheetTokens;
4125
- var renderMode = vm.renderMode,
4126
- shadowMode = vm.shadowMode;
4195
+ stylesheetToken = template.stylesheetToken;
4127
4196
  var content = [];
4128
4197
 
4129
4198
  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.
4199
+ content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
4200
+ }
4201
+
4202
+ return content;
4203
+ } // It might be worth caching this to avoid doing the lookup repeatedly, but
4204
+ // perf testing has not shown it to be a huge improvement yet:
4205
+ // https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
4206
+
4207
+
4208
+ function getNearestNativeShadowComponent(vm) {
4209
+ var owner = vm;
4133
4210
 
4134
- if (renderMode === 1
4211
+ while (!isNull(owner)) {
4212
+ if (owner.renderMode === 1
4135
4213
  /* 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 = '';
4214
+ && owner.shadowMode === 0
4215
+ /* Native */
4216
+ ) {
4217
+ return owner;
4144
4218
  }
4145
4219
 
4146
- content = evaluateStylesheetsContent(stylesheets, hostSelector, shadowSelector, shadowMode === 0
4147
- /* Native */
4148
- );
4220
+ owner = owner.owner;
4149
4221
  }
4150
4222
 
4151
- return content;
4223
+ return owner;
4152
4224
  }
4153
4225
 
4154
4226
  function createStylesheet(vm, stylesheets) {
@@ -4164,13 +4236,26 @@ var LWC = (function (exports) {
4164
4236
  for (var _i13 = 0; _i13 < stylesheets.length; _i13++) {
4165
4237
  renderer.insertGlobalStylesheet(stylesheets[_i13]);
4166
4238
  }
4167
-
4168
- return null;
4169
- } else {
4170
- // native shadow or light DOM
4239
+ } else if (renderer.ssr) {
4240
+ // native shadow or light DOM, SSR
4171
4241
  var combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
4172
4242
  return createInlineStyleVNode(combinedStylesheetContent);
4243
+ } else {
4244
+ // native shadow or light DOM, DOM renderer
4245
+ var root = getNearestNativeShadowComponent(vm);
4246
+ var isGlobal = isNull(root);
4247
+
4248
+ for (var _i14 = 0; _i14 < stylesheets.length; _i14++) {
4249
+ if (isGlobal) {
4250
+ renderer.insertGlobalStylesheet(stylesheets[_i14]);
4251
+ } else {
4252
+ // local level
4253
+ renderer.insertStylesheet(stylesheets[_i14], root.cmpRoot);
4254
+ }
4255
+ }
4173
4256
  }
4257
+
4258
+ return null;
4174
4259
  }
4175
4260
  /** Indicates if operations should be logged by the profiler. */
4176
4261
 
@@ -4287,8 +4372,7 @@ var LWC = (function (exports) {
4287
4372
  context = vm.context,
4288
4373
  cmpSlots = vm.cmpSlots,
4289
4374
  cmpTemplate = vm.cmpTemplate,
4290
- tro = vm.tro,
4291
- shadowMode = vm.shadowMode;
4375
+ tro = vm.tro;
4292
4376
  tro.observe(function () {
4293
4377
  // Reset the cache memoizer for template when needed.
4294
4378
  if (html !== cmpTemplate) {
@@ -4310,15 +4394,12 @@ var LWC = (function (exports) {
4310
4394
 
4311
4395
  vm.cmpTemplate = html; // Create a brand new template cache for the swapped templated.
4312
4396
 
4313
- context.tplCache = create(null); // Update the synthetic shadow attributes on the host element if necessary.
4397
+ context.tplCache = create(null); // Set the computeHasScopedStyles property in the context, to avoid recomputing it repeatedly.
4314
4398
 
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.
4399
+ context.hasScopedStyles = computeHasScopedStyles(html); // Update the scoping token on the host element.
4321
4400
 
4401
+ updateStylesheetToken(vm, html); // Evaluate, create stylesheet and cache the produced VNode for future
4402
+ // re-rendering.
4322
4403
 
4323
4404
  var stylesheetsContent = getStylesheetsContent(vm, html);
4324
4405
  context.styleVNode = stylesheetsContent.length === 0 ? null : createStylesheet(vm, stylesheetsContent);
@@ -4349,6 +4430,20 @@ var LWC = (function (exports) {
4349
4430
 
4350
4431
  return vnodes;
4351
4432
  }
4433
+
4434
+ function computeHasScopedStyles(template) {
4435
+ var stylesheets = template.stylesheets;
4436
+
4437
+ if (!isUndefined$1(stylesheets)) {
4438
+ for (var _i15 = 0; _i15 < stylesheets.length; _i15++) {
4439
+ if (isTrue(stylesheets[_i15][KEY__SCOPED_CSS])) {
4440
+ return true;
4441
+ }
4442
+ }
4443
+ }
4444
+
4445
+ return false;
4446
+ }
4352
4447
  /*
4353
4448
  * Copyright (c) 2018, salesforce.com, inc.
4354
4449
  * All rights reserved.
@@ -4542,8 +4637,8 @@ var LWC = (function (exports) {
4542
4637
 
4543
4638
  function register(service) {
4544
4639
 
4545
- for (var _i14 = 0; _i14 < hooks.length; ++_i14) {
4546
- var hookName = hooks[_i14];
4640
+ for (var _i16 = 0; _i16 < hooks.length; ++_i16) {
4641
+ var hookName = hooks[_i16];
4547
4642
 
4548
4643
  if (hookName in service) {
4549
4644
  var l = Services[hookName];
@@ -4563,8 +4658,8 @@ var LWC = (function (exports) {
4563
4658
  def = vm.def,
4564
4659
  context = vm.context;
4565
4660
 
4566
- for (var _i15 = 0, _len6 = cbs.length; _i15 < _len6; ++_i15) {
4567
- cbs[_i15].call(undefined, component, {}, def, context);
4661
+ for (var _i17 = 0, _len6 = cbs.length; _i17 < _len6; ++_i17) {
4662
+ cbs[_i17].call(undefined, component, {}, def, context);
4568
4663
  }
4569
4664
  }
4570
4665
  /*
@@ -4575,7 +4670,6 @@ var LWC = (function (exports) {
4575
4670
  */
4576
4671
 
4577
4672
 
4578
- var isNativeShadowRootDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
4579
4673
  var idx = 0;
4580
4674
  /** The internal slot used to associate different objects the engine manipulates with the VM */
4581
4675
 
@@ -4658,27 +4752,23 @@ var LWC = (function (exports) {
4658
4752
  resetComponentStateWhenRemoved(vm);
4659
4753
  }
4660
4754
 
4755
+ function getNearestShadowAncestor(vm) {
4756
+ var ancestor = vm.owner;
4757
+
4758
+ while (!isNull(ancestor) && ancestor.renderMode === 0
4759
+ /* Light */
4760
+ ) {
4761
+ ancestor = ancestor.owner;
4762
+ }
4763
+
4764
+ return ancestor;
4765
+ }
4766
+
4661
4767
  function createVM(elm, def, options) {
4662
4768
  var mode = options.mode,
4663
4769
  owner = options.owner,
4664
4770
  renderer = options.renderer,
4665
4771
  tagName = options.tagName;
4666
- var shadowMode;
4667
-
4668
- if (renderer.syntheticShadow) {
4669
- shadowMode = def.shadowSupportMode === "any"
4670
- /* Any */
4671
- && isNativeShadowRootDefined ? 0
4672
- /* Native */
4673
- : 1
4674
- /* Synthetic */
4675
- ;
4676
- } else {
4677
- shadowMode = 0
4678
- /* Native */
4679
- ;
4680
- }
4681
-
4682
4772
  var vm = {
4683
4773
  elm: elm,
4684
4774
  def: def,
@@ -4701,10 +4791,12 @@ var LWC = (function (exports) {
4701
4791
  oar: create(null),
4702
4792
  cmpTemplate: null,
4703
4793
  renderMode: def.renderMode,
4704
- shadowMode: shadowMode,
4794
+ shadowMode: null,
4705
4795
  context: {
4706
- hostAttribute: undefined,
4707
- shadowAttribute: undefined,
4796
+ stylesheetToken: undefined,
4797
+ hasTokenInClass: undefined,
4798
+ hasTokenInAttribute: undefined,
4799
+ hasScopedStyles: undefined,
4708
4800
  styleVNode: null,
4709
4801
  tplCache: EmptyObject,
4710
4802
  wiredConnecting: EmptyArray,
@@ -4717,18 +4809,77 @@ var LWC = (function (exports) {
4717
4809
  setHook: setHook,
4718
4810
  getHook: getHook
4719
4811
  };
4812
+ vm.shadowMode = computeShadowMode(vm);
4720
4813
  vm.tro = getTemplateReactiveObserver(vm);
4721
4814
 
4722
4815
 
4723
4816
  invokeComponentConstructor(vm, def.ctor); // Initializing the wire decorator per instance only when really needed
4724
4817
 
4725
- if (isFalse(renderer.ssr) && hasWireAdapters(vm)) {
4818
+ if (hasWireAdapters(vm)) {
4726
4819
  installWireAdapters(vm);
4727
4820
  }
4728
4821
 
4729
4822
  return vm;
4730
4823
  }
4731
4824
 
4825
+ function computeShadowMode(vm) {
4826
+ var def = vm.def,
4827
+ renderer = vm.renderer;
4828
+ var isNativeShadowDefined = renderer.isNativeShadowDefined,
4829
+ isSyntheticShadowDefined = renderer.isSyntheticShadowDefined;
4830
+ var shadowMode;
4831
+
4832
+ if (isSyntheticShadowDefined) {
4833
+ if (def.renderMode === 0
4834
+ /* Light */
4835
+ ) {
4836
+ // ShadowMode.Native implies "not synthetic shadow" which is consistent with how
4837
+ // everything defaults to native when the synthetic shadow polyfill is unavailable.
4838
+ shadowMode = 0
4839
+ /* Native */
4840
+ ;
4841
+ } else if (isNativeShadowDefined) {
4842
+ if (def.shadowSupportMode === "any"
4843
+ /* Any */
4844
+ ) {
4845
+ shadowMode = 0
4846
+ /* Native */
4847
+ ;
4848
+ } else {
4849
+ var shadowAncestor = getNearestShadowAncestor(vm);
4850
+
4851
+ if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
4852
+ /* Native */
4853
+ ) {
4854
+ // Transitive support for native Shadow DOM. A component in native mode
4855
+ // transitively opts all of its descendants into native.
4856
+ shadowMode = 0
4857
+ /* Native */
4858
+ ;
4859
+ } else {
4860
+ // Synthetic if neither this component nor any of its ancestors are configured
4861
+ // to be native.
4862
+ shadowMode = 1
4863
+ /* Synthetic */
4864
+ ;
4865
+ }
4866
+ }
4867
+ } else {
4868
+ // Synthetic if there is no native Shadow DOM support.
4869
+ shadowMode = 1
4870
+ /* Synthetic */
4871
+ ;
4872
+ }
4873
+ } else {
4874
+ // Native if the synthetic shadow polyfill is unavailable.
4875
+ shadowMode = 0
4876
+ /* Native */
4877
+ ;
4878
+ }
4879
+
4880
+ return shadowMode;
4881
+ }
4882
+
4732
4883
  function associateVM(obj, vm) {
4733
4884
  ViewModelReflection.set(obj, vm);
4734
4885
  }
@@ -4828,19 +4979,19 @@ var LWC = (function (exports) {
4828
4979
  });
4829
4980
  rehydrateQueue = []; // reset to a new queue
4830
4981
 
4831
- for (var _i16 = 0, _len7 = vms.length; _i16 < _len7; _i16 += 1) {
4832
- var vm = vms[_i16];
4982
+ for (var _i18 = 0, _len7 = vms.length; _i18 < _len7; _i18 += 1) {
4983
+ var vm = vms[_i18];
4833
4984
 
4834
4985
  try {
4835
4986
  rehydrate(vm);
4836
4987
  } catch (error) {
4837
- if (_i16 + 1 < _len7) {
4988
+ if (_i18 + 1 < _len7) {
4838
4989
  // pieces of the queue are still pending to be rehydrated, those should have priority
4839
4990
  if (rehydrateQueue.length === 0) {
4840
4991
  addCallbackToNextTick(flushRehydrationQueue);
4841
4992
  }
4842
4993
 
4843
- ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i16 + 1));
4994
+ ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i18 + 1));
4844
4995
  } // we need to end the measure before throwing.
4845
4996
 
4846
4997
 
@@ -4939,8 +5090,8 @@ var LWC = (function (exports) {
4939
5090
  var vCustomElementCollection = vm.velements; // Reporting disconnection for every child in inverse order since they are
4940
5091
  // inserted in reserved order.
4941
5092
 
4942
- for (var _i17 = vCustomElementCollection.length - 1; _i17 >= 0; _i17 -= 1) {
4943
- var elm = vCustomElementCollection[_i17].elm; // There are two cases where the element could be undefined:
5093
+ for (var _i19 = vCustomElementCollection.length - 1; _i19 >= 0; _i19 -= 1) {
5094
+ var elm = vCustomElementCollection[_i19].elm; // There are two cases where the element could be undefined:
4944
5095
  // * when there is an error during the construction phase, and an error
4945
5096
  // boundary picks it, there is a possibility that the VCustomElement
4946
5097
  // is not properly initialized, and therefore is should be ignored.
@@ -4974,8 +5125,8 @@ var LWC = (function (exports) {
4974
5125
 
4975
5126
 
4976
5127
  function recursivelyDisconnectChildren(vnodes) {
4977
- for (var _i18 = 0, _len8 = vnodes.length; _i18 < _len8; _i18 += 1) {
4978
- var vnode = vnodes[_i18];
5128
+ for (var _i20 = 0, _len8 = vnodes.length; _i20 < _len8; _i20 += 1) {
5129
+ var vnode = vnodes[_i20];
4979
5130
 
4980
5131
  if (!isNull(vnode) && isArray$1(vnode.children) && !isUndefined$1(vnode.elm)) {
4981
5132
  // vnode is a VElement with children
@@ -4999,8 +5150,8 @@ var LWC = (function (exports) {
4999
5150
  renderer = vm.renderer;
5000
5151
  var rootNode = getRenderRoot(vm);
5001
5152
 
5002
- for (var _i19 = 0, _len9 = children.length; _i19 < _len9; _i19++) {
5003
- var child = children[_i19];
5153
+ for (var _i21 = 0, _len9 = children.length; _i21 < _len9; _i21++) {
5154
+ var child = children[_i21];
5004
5155
 
5005
5156
  if (!isNull(child) && !isUndefined$1(child.elm)) {
5006
5157
  renderer.remove(child.elm, rootNode);
@@ -5045,8 +5196,8 @@ var LWC = (function (exports) {
5045
5196
  var oldSlots = vm.cmpSlots;
5046
5197
  var cmpSlots = vm.cmpSlots = create(null);
5047
5198
 
5048
- for (var _i20 = 0, _len10 = children.length; _i20 < _len10; _i20 += 1) {
5049
- var vnode = children[_i20];
5199
+ for (var _i22 = 0, _len10 = children.length; _i22 < _len10; _i22 += 1) {
5200
+ var vnode = children[_i22];
5050
5201
 
5051
5202
  if (isNull(vnode)) {
5052
5203
  continue;
@@ -5076,8 +5227,8 @@ var LWC = (function (exports) {
5076
5227
  return;
5077
5228
  }
5078
5229
 
5079
- for (var _i21 = 0, _len11 = oldKeys.length; _i21 < _len11; _i21 += 1) {
5080
- var key = oldKeys[_i21];
5230
+ for (var _i23 = 0, _len11 = oldKeys.length; _i23 < _len11; _i23 += 1) {
5231
+ var key = oldKeys[_i23];
5081
5232
 
5082
5233
  if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
5083
5234
  markComponentAsDirty(vm);
@@ -5395,11 +5546,14 @@ var LWC = (function (exports) {
5395
5546
  ArrayPush$1.call(wiredConnecting, function () {
5396
5547
  connector.connect();
5397
5548
 
5398
- if (hasDynamicParams) {
5399
- Promise.resolve().then(computeConfigAndUpdate);
5400
- } else {
5401
- computeConfigAndUpdate();
5549
+ if (!runtimeFlags.ENABLE_WIRE_SYNC_EMIT) {
5550
+ if (hasDynamicParams) {
5551
+ Promise.resolve().then(computeConfigAndUpdate);
5552
+ return;
5553
+ }
5402
5554
  }
5555
+
5556
+ computeConfigAndUpdate();
5403
5557
  });
5404
5558
  ArrayPush$1.call(wiredDisconnecting, function () {
5405
5559
  connector.disconnect();
@@ -5413,8 +5567,8 @@ var LWC = (function (exports) {
5413
5567
  function connectWireAdapters(vm) {
5414
5568
  var wiredConnecting = vm.context.wiredConnecting;
5415
5569
 
5416
- for (var _i22 = 0, _len12 = wiredConnecting.length; _i22 < _len12; _i22 += 1) {
5417
- wiredConnecting[_i22]();
5570
+ for (var _i24 = 0, _len12 = wiredConnecting.length; _i24 < _len12; _i24 += 1) {
5571
+ wiredConnecting[_i24]();
5418
5572
  }
5419
5573
  }
5420
5574
 
@@ -5422,8 +5576,8 @@ var LWC = (function (exports) {
5422
5576
  var wiredDisconnecting = vm.context.wiredDisconnecting;
5423
5577
  runWithBoundaryProtection(vm, vm, noop, function () {
5424
5578
  // job
5425
- for (var _i23 = 0, _len13 = wiredDisconnecting.length; _i23 < _len13; _i23 += 1) {
5426
- wiredDisconnecting[_i23]();
5579
+ for (var _i25 = 0, _len13 = wiredDisconnecting.length; _i25 < _len13; _i25 += 1) {
5580
+ wiredDisconnecting[_i25]();
5427
5581
  }
5428
5582
  }, noop);
5429
5583
  }
@@ -5492,7 +5646,7 @@ var LWC = (function (exports) {
5492
5646
 
5493
5647
  return reactiveMembrane.getReadOnlyProxy(obj);
5494
5648
  }
5495
- /* version: 2.3.4 */
5649
+ /* version: 2.5.1 */
5496
5650
 
5497
5651
  /*
5498
5652
  * Copyright (c) 2018, salesforce.com, inc.
@@ -5505,6 +5659,10 @@ var LWC = (function (exports) {
5505
5659
  var globalStylesheets = create(null);
5506
5660
 
5507
5661
  var globalStylesheetsParentElement = document.head || document.body || document;
5662
+ var supportsConstructableStyleSheets = isFunction$1(CSSStyleSheet.prototype.replaceSync);
5663
+ var styleElements = create(null);
5664
+ var styleSheets = create(null);
5665
+ var nodesToStyleSheets = new WeakMap();
5508
5666
  var getCustomElement, defineCustomElement, HTMLElementConstructor;
5509
5667
 
5510
5668
  function isCustomElementRegistryAvailable() {
@@ -5543,6 +5701,52 @@ var LWC = (function (exports) {
5543
5701
  }
5544
5702
  }
5545
5703
 
5704
+ function insertConstructableStyleSheet(content, target) {
5705
+ // It's important for CSSStyleSheets to be unique based on their content, so that
5706
+ // `shadowRoot.adoptedStyleSheets.includes(sheet)` works.
5707
+ var styleSheet = styleSheets[content];
5708
+
5709
+ if (isUndefined$1(styleSheet)) {
5710
+ styleSheet = new CSSStyleSheet();
5711
+ styleSheet.replaceSync(content);
5712
+ styleSheets[content] = styleSheet;
5713
+ }
5714
+
5715
+ if (!target.adoptedStyleSheets.includes(styleSheet)) {
5716
+ target.adoptedStyleSheets = [].concat(_toConsumableArray(target.adoptedStyleSheets), [styleSheet]);
5717
+ }
5718
+ }
5719
+
5720
+ function insertStyleElement(content, target) {
5721
+ // Avoid inserting duplicate `<style>`s
5722
+ var sheets = nodesToStyleSheets.get(target);
5723
+
5724
+ if (isUndefined$1(sheets)) {
5725
+ sheets = create(null);
5726
+ nodesToStyleSheets.set(target, sheets);
5727
+ }
5728
+
5729
+ if (sheets[content]) {
5730
+ return;
5731
+ }
5732
+
5733
+ sheets[content] = true; // This `<style>` may be repeated multiple times in the DOM, so cache it. It's a bit
5734
+ // faster to call `cloneNode()` on an existing node than to recreate it every time.
5735
+
5736
+ var elm = styleElements[content];
5737
+
5738
+ if (isUndefined$1(elm)) {
5739
+ elm = document.createElement('style');
5740
+ elm.type = 'text/css';
5741
+ elm.textContent = content;
5742
+ styleElements[content] = elm;
5743
+ } else {
5744
+ elm = elm.cloneNode(true);
5745
+ }
5746
+
5747
+ target.appendChild(elm);
5748
+ }
5749
+
5546
5750
  if (isCustomElementRegistryAvailable()) {
5547
5751
  getCustomElement = customElements.get.bind(customElements);
5548
5752
  defineCustomElement = customElements.define.bind(customElements);
@@ -5586,7 +5790,8 @@ var LWC = (function (exports) {
5586
5790
 
5587
5791
  var renderer = {
5588
5792
  ssr: false,
5589
- syntheticShadow: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
5793
+ isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
5794
+ isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
5590
5795
  createElement: function createElement(tagName, namespace) {
5591
5796
  return isUndefined$1(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
5592
5797
  },
@@ -5677,6 +5882,14 @@ var LWC = (function (exports) {
5677
5882
  elm.textContent = content;
5678
5883
  globalStylesheetsParentElement.appendChild(elm);
5679
5884
  },
5885
+ insertStylesheet: function insertStylesheet(content, target) {
5886
+ if (supportsConstructableStyleSheets) {
5887
+ insertConstructableStyleSheet(content, target);
5888
+ } else {
5889
+ // Fall back to <style> element
5890
+ insertStyleElement(content, target);
5891
+ }
5892
+ },
5680
5893
  assertInstanceOfHTMLElement: function assertInstanceOfHTMLElement(elm, msg) {
5681
5894
  assert.invariant(elm instanceof HTMLElement, msg);
5682
5895
  },
@@ -5911,7 +6124,7 @@ var LWC = (function (exports) {
5911
6124
  return false;
5912
6125
  }
5913
6126
 
5914
- if (renderer.syntheticShadow) {
6127
+ if (renderer.isSyntheticShadowDefined) {
5915
6128
  // TODO [#1252]: old behavior that is still used by some pieces of the platform,
5916
6129
  // specifically, nodes inserted manually on places where `lwc:dom="manual"` directive is not
5917
6130
  // used, will be considered global elements.
@@ -5963,7 +6176,7 @@ var LWC = (function (exports) {
5963
6176
  });
5964
6177
  freeze(LightningElement);
5965
6178
  seal(LightningElement.prototype);
5966
- /* version: 2.3.4 */
6179
+ /* version: 2.5.1 */
5967
6180
 
5968
6181
  exports.LightningElement = LightningElement;
5969
6182
  exports.__unstable__ProfilerControl = profilerControl;