@lwc/engine-core 2.14.0 → 2.14.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.
@@ -2319,7 +2319,8 @@ function getDecoratorsMeta(Ctor) {
2319
2319
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2320
2320
  */
2321
2321
  let warned = false;
2322
- if (process.env.NODE_ENV === 'development') {
2322
+ // @ts-ignore
2323
+ if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
2323
2324
  // @ts-ignore
2324
2325
  window.__lwcResetWarnedOnVersionMismatch = () => {
2325
2326
  warned = false;
@@ -3459,11 +3460,14 @@ function unmount(vnode, parent, doRemove = false) {
3459
3460
  if (doRemove) {
3460
3461
  removeNode(elm, parent);
3461
3462
  }
3462
- const removeChildren = sel === 'slot'; // slot content is removed to trigger slotchange event when removing slot
3463
3463
  switch (type) {
3464
- case 2 /* Element */:
3464
+ case 2 /* Element */: {
3465
+ // Slot content is removed to trigger slotchange event when removing slot.
3466
+ // Only required for synthetic shadow.
3467
+ const removeChildren = sel === 'slot' && vnode.owner.shadowMode === 1 /* Synthetic */;
3465
3468
  unmountVNodes(vnode.children, elm, removeChildren);
3466
3469
  break;
3470
+ }
3467
3471
  case 3 /* CustomElement */: {
3468
3472
  const { vm } = vnode;
3469
3473
  // No need to unmount the children here, `removeVM` will take care of removing the
@@ -4939,9 +4943,20 @@ function removeVM(vm) {
4939
4943
 
4940
4944
  resetComponentStateWhenRemoved(vm);
4941
4945
  }
4942
- function createVM(elm, ctor, options) {
4943
- var _a;
4944
4946
 
4947
+ function getNearestShadowAncestor(vm) {
4948
+ let ancestor = vm.owner;
4949
+
4950
+ while (!shared.isNull(ancestor) && ancestor.renderMode === 0
4951
+ /* Light */
4952
+ ) {
4953
+ ancestor = ancestor.owner;
4954
+ }
4955
+
4956
+ return ancestor;
4957
+ }
4958
+
4959
+ function createVM(elm, ctor, options) {
4945
4960
  const {
4946
4961
  mode,
4947
4962
  owner,
@@ -4971,8 +4986,6 @@ function createVM(elm, ctor, options) {
4971
4986
  cmpTemplate: null,
4972
4987
  hydrated: Boolean(hydrated),
4973
4988
  renderMode: def.renderMode,
4974
- shadowMode: computeShadowMode(def, owner),
4975
- nearestShadowMode: (owner === null || owner === void 0 ? void 0 : owner.shadowRoot) ? owner.shadowMode : (_a = owner === null || owner === void 0 ? void 0 : owner.nearestShadowMode) !== null && _a !== void 0 ? _a : null,
4976
4989
  context: {
4977
4990
  stylesheetToken: undefined,
4978
4991
  hasTokenInClass: undefined,
@@ -4985,6 +4998,7 @@ function createVM(elm, ctor, options) {
4985
4998
  },
4986
4999
  // Properties set right after VM creation.
4987
5000
  tro: null,
5001
+ shadowMode: null,
4988
5002
  // Properties set by the LightningElement constructor.
4989
5003
  component: null,
4990
5004
  shadowRoot: null,
@@ -4993,6 +5007,7 @@ function createVM(elm, ctor, options) {
4993
5007
  setHook,
4994
5008
  getHook
4995
5009
  };
5010
+ vm.shadowMode = computeShadowMode(vm);
4996
5011
  vm.tro = getTemplateReactiveObserver(vm);
4997
5012
 
4998
5013
  if (process.env.NODE_ENV !== 'production') {
@@ -5017,9 +5032,10 @@ function createVM(elm, ctor, options) {
5017
5032
  return vm;
5018
5033
  }
5019
5034
 
5020
- function computeShadowMode(def, owner) {
5021
- var _a;
5022
-
5035
+ function computeShadowMode(vm) {
5036
+ const {
5037
+ def
5038
+ } = vm;
5023
5039
  let shadowMode;
5024
5040
 
5025
5041
  if (isSyntheticShadowDefined) {
@@ -5042,13 +5058,23 @@ function computeShadowMode(def, owner) {
5042
5058
  /* Native */
5043
5059
  ;
5044
5060
  } else {
5045
- // Transitive support for native Shadow DOM. A component in native mode
5046
- // transitively opts all of its descendants into native.
5047
- // Synthetic if neither this component nor any of its ancestors are configured
5048
- // to be native.
5049
- shadowMode = (_a = owner === null || owner === void 0 ? void 0 : owner.nearestShadowMode) !== null && _a !== void 0 ? _a : 1
5050
- /* Synthetic */
5051
- ;
5061
+ const shadowAncestor = getNearestShadowAncestor(vm);
5062
+
5063
+ if (!shared.isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
5064
+ /* Native */
5065
+ ) {
5066
+ // Transitive support for native Shadow DOM. A component in native mode
5067
+ // transitively opts all of its descendants into native.
5068
+ shadowMode = 0
5069
+ /* Native */
5070
+ ;
5071
+ } else {
5072
+ // Synthetic if neither this component nor any of its ancestors are configured
5073
+ // to be native.
5074
+ shadowMode = 1
5075
+ /* Synthetic */
5076
+ ;
5077
+ }
5052
5078
  }
5053
5079
  } else {
5054
5080
  shadowMode = 1
@@ -6336,4 +6362,4 @@ exports.swapTemplate = swapTemplate;
6336
6362
  exports.track = track;
6337
6363
  exports.unwrap = unwrap;
6338
6364
  exports.wire = wire;
6339
- /* version: 2.14.0 */
6365
+ /* version: 2.14.1 */
@@ -2316,7 +2316,8 @@ function getDecoratorsMeta(Ctor) {
2316
2316
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2317
2317
  */
2318
2318
  let warned = false;
2319
- if (process.env.NODE_ENV === 'development') {
2319
+ // @ts-ignore
2320
+ if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
2320
2321
  // @ts-ignore
2321
2322
  window.__lwcResetWarnedOnVersionMismatch = () => {
2322
2323
  warned = false;
@@ -3456,11 +3457,14 @@ function unmount(vnode, parent, doRemove = false) {
3456
3457
  if (doRemove) {
3457
3458
  removeNode(elm, parent);
3458
3459
  }
3459
- const removeChildren = sel === 'slot'; // slot content is removed to trigger slotchange event when removing slot
3460
3460
  switch (type) {
3461
- case 2 /* Element */:
3461
+ case 2 /* Element */: {
3462
+ // Slot content is removed to trigger slotchange event when removing slot.
3463
+ // Only required for synthetic shadow.
3464
+ const removeChildren = sel === 'slot' && vnode.owner.shadowMode === 1 /* Synthetic */;
3462
3465
  unmountVNodes(vnode.children, elm, removeChildren);
3463
3466
  break;
3467
+ }
3464
3468
  case 3 /* CustomElement */: {
3465
3469
  const { vm } = vnode;
3466
3470
  // No need to unmount the children here, `removeVM` will take care of removing the
@@ -4936,9 +4940,20 @@ function removeVM(vm) {
4936
4940
 
4937
4941
  resetComponentStateWhenRemoved(vm);
4938
4942
  }
4939
- function createVM(elm, ctor, options) {
4940
- var _a;
4941
4943
 
4944
+ function getNearestShadowAncestor(vm) {
4945
+ let ancestor = vm.owner;
4946
+
4947
+ while (!isNull(ancestor) && ancestor.renderMode === 0
4948
+ /* Light */
4949
+ ) {
4950
+ ancestor = ancestor.owner;
4951
+ }
4952
+
4953
+ return ancestor;
4954
+ }
4955
+
4956
+ function createVM(elm, ctor, options) {
4942
4957
  const {
4943
4958
  mode,
4944
4959
  owner,
@@ -4968,8 +4983,6 @@ function createVM(elm, ctor, options) {
4968
4983
  cmpTemplate: null,
4969
4984
  hydrated: Boolean(hydrated),
4970
4985
  renderMode: def.renderMode,
4971
- shadowMode: computeShadowMode(def, owner),
4972
- nearestShadowMode: (owner === null || owner === void 0 ? void 0 : owner.shadowRoot) ? owner.shadowMode : (_a = owner === null || owner === void 0 ? void 0 : owner.nearestShadowMode) !== null && _a !== void 0 ? _a : null,
4973
4986
  context: {
4974
4987
  stylesheetToken: undefined,
4975
4988
  hasTokenInClass: undefined,
@@ -4982,6 +4995,7 @@ function createVM(elm, ctor, options) {
4982
4995
  },
4983
4996
  // Properties set right after VM creation.
4984
4997
  tro: null,
4998
+ shadowMode: null,
4985
4999
  // Properties set by the LightningElement constructor.
4986
5000
  component: null,
4987
5001
  shadowRoot: null,
@@ -4990,6 +5004,7 @@ function createVM(elm, ctor, options) {
4990
5004
  setHook,
4991
5005
  getHook
4992
5006
  };
5007
+ vm.shadowMode = computeShadowMode(vm);
4993
5008
  vm.tro = getTemplateReactiveObserver(vm);
4994
5009
 
4995
5010
  if (process.env.NODE_ENV !== 'production') {
@@ -5014,9 +5029,10 @@ function createVM(elm, ctor, options) {
5014
5029
  return vm;
5015
5030
  }
5016
5031
 
5017
- function computeShadowMode(def, owner) {
5018
- var _a;
5019
-
5032
+ function computeShadowMode(vm) {
5033
+ const {
5034
+ def
5035
+ } = vm;
5020
5036
  let shadowMode;
5021
5037
 
5022
5038
  if (isSyntheticShadowDefined) {
@@ -5039,13 +5055,23 @@ function computeShadowMode(def, owner) {
5039
5055
  /* Native */
5040
5056
  ;
5041
5057
  } else {
5042
- // Transitive support for native Shadow DOM. A component in native mode
5043
- // transitively opts all of its descendants into native.
5044
- // Synthetic if neither this component nor any of its ancestors are configured
5045
- // to be native.
5046
- shadowMode = (_a = owner === null || owner === void 0 ? void 0 : owner.nearestShadowMode) !== null && _a !== void 0 ? _a : 1
5047
- /* Synthetic */
5048
- ;
5058
+ const shadowAncestor = getNearestShadowAncestor(vm);
5059
+
5060
+ if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
5061
+ /* Native */
5062
+ ) {
5063
+ // Transitive support for native Shadow DOM. A component in native mode
5064
+ // transitively opts all of its descendants into native.
5065
+ shadowMode = 0
5066
+ /* Native */
5067
+ ;
5068
+ } else {
5069
+ // Synthetic if neither this component nor any of its ancestors are configured
5070
+ // to be native.
5071
+ shadowMode = 1
5072
+ /* Synthetic */
5073
+ ;
5074
+ }
5049
5075
  }
5050
5076
  } else {
5051
5077
  shadowMode = 1
@@ -6259,4 +6285,4 @@ function getComponentConstructor(elm) {
6259
6285
  }
6260
6286
 
6261
6287
  export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, connectRootElement, createContextProvider, createVM, disconnectRootElement, freezeTemplate, getAssociatedVMIfPresent, getComponentConstructor, getComponentDef, getComponentHtmlPrototype, getUpgradableConstructor, hydrateRoot, isComponentConstructor, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setAddEventListener, setAssertInstanceOfHTMLElement, setAttachShadow, setCreateComment, setCreateElement, setCreateText, setDefineCustomElement, setDispatchEvent, setGetAttribute, setGetBoundingClientRect, setGetChildNodes, setGetChildren, setGetClassList, setGetCustomElement, setGetElementsByClassName, setGetElementsByTagName, setGetFirstChild, setGetFirstElementChild, setGetLastChild, setGetLastElementChild, setGetProperty, setHTMLElement, setHooks, setInsert, setInsertStylesheet, setIsConnected, setIsHydrating, setIsNativeShadowDefined, setIsSyntheticShadowDefined, setNextSibling, setQuerySelector, setQuerySelectorAll, setRemove, setRemoveAttribute, setRemoveEventListener, setSetAttribute, setSetCSSStyleProperty, setSetProperty, setSetText, setSsr, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
6262
- /* version: 2.14.0 */
6288
+ /* version: 2.14.1 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lwc/engine-core",
3
- "version": "2.14.0",
3
+ "version": "2.14.1",
4
4
  "description": "Core LWC engine APIs.",
5
5
  "homepage": "https://lwc.dev/",
6
6
  "repository": {
@@ -25,8 +25,8 @@
25
25
  "types/"
26
26
  ],
27
27
  "dependencies": {
28
- "@lwc/features": "2.14.0",
29
- "@lwc/shared": "2.14.0"
28
+ "@lwc/features": "2.14.1",
29
+ "@lwc/shared": "2.14.1"
30
30
  },
31
31
  "devDependencies": {
32
32
  "observable-membrane": "2.0.0"
@@ -65,11 +65,8 @@ export interface VM<N = HostNode, E = HostElement> {
65
65
  /** Whether or not the VM was hydrated */
66
66
  readonly hydrated: boolean;
67
67
  /** Rendering operations associated with the VM */
68
- readonly renderMode: RenderMode;
68
+ renderMode: RenderMode;
69
69
  shadowMode: ShadowMode;
70
- /** Transitive support for native Shadow DOM. A component in native mode
71
- * transitively opts all of its descendants into native. */
72
- readonly nearestShadowMode: ShadowMode | null;
73
70
  /** The component creation index. */
74
71
  idx: number;
75
72
  /** Component state, analogous to Element.isConnected */