@lwc/synthetic-shadow 2.14.2 → 2.15.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -133,6 +133,8 @@ const _globalThis = /*@__PURE__*/ (function () {
133
133
  const KEY__IS_NATIVE_SHADOW_ROOT_DEFINED = '$isNativeShadowRootDefined$';
134
134
  const KEY__SHADOW_RESOLVER = '$shadowResolver$';
135
135
  const KEY__SHADOW_RESOLVER_PRIVATE = '$$ShadowResolverKey$$';
136
+ const KEY__SHADOW_STATIC = '$shadowStaticNode$';
137
+ const KEY__SHADOW_STATIC_PRIVATE = '$shadowStaticNodeKey$';
136
138
  const KEY__SHADOW_TOKEN = '$shadowToken$';
137
139
  const KEY__SHADOW_TOKEN_PRIVATE = '$$ShadowTokenKey$$';
138
140
  const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
@@ -146,7 +148,7 @@ const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
146
148
  // We use this to detect symbol support in order to avoid the expensive symbol polyfill. Note that
147
149
  // we can't use typeof since it will fail when transpiling.
148
150
  const hasNativeSymbolSupport = /*@__PURE__*/ (() => Symbol('x').toString() === 'Symbol(x)')();
149
- /** version: 2.14.2 */
151
+ /** version: 2.15.0 */
150
152
 
151
153
  /*
152
154
  * Copyright (c) 2018, salesforce.com, inc.
@@ -297,7 +299,7 @@ const elementsFromPoint = hasOwnProperty.call(Document.prototype, 'elementsFromP
297
299
  // defaultView can be null when a document has no browsing context. For example, the owner document
298
300
  // of a node in a template doesn't have a default view: https://jsfiddle.net/hv9z0q5a/
299
301
  const defaultViewGetter = getOwnPropertyDescriptor(Document.prototype, 'defaultView').get;
300
- const { createComment, querySelectorAll, getElementById, getElementsByClassName, getElementsByTagName, getElementsByTagNameNS, } = Document.prototype;
302
+ const { createComment, createTreeWalker, querySelectorAll, getElementById, getElementsByClassName, getElementsByTagName, getElementsByTagNameNS, } = Document.prototype;
301
303
  // In Firefox v57 and lower, getElementsByName is defined on HTMLDocument.prototype
302
304
  // In all other browsers have the method on Document.prototype
303
305
  const { getElementsByName } = HTMLDocument.prototype;
@@ -1122,7 +1124,7 @@ if (!_globalThis.lwcRuntimeFlags) {
1122
1124
  Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
1123
1125
  }
1124
1126
  const runtimeFlags = _globalThis.lwcRuntimeFlags;
1125
- /** version: 2.14.2 */
1127
+ /** version: 2.15.0 */
1126
1128
 
1127
1129
  /*
1128
1130
  * Copyright (c) 2018, salesforce.com, inc.
@@ -4951,6 +4953,24 @@ defineProperty(Element.prototype, KEY__SHADOW_TOKEN, {
4951
4953
  },
4952
4954
  configurable: true,
4953
4955
  });
4956
+ defineProperty(Element.prototype, KEY__SHADOW_STATIC, {
4957
+ set(v) {
4958
+ // Marking an element as static will propagate the shadow resolver to the children.
4959
+ const fn = this[KEY__SHADOW_RESOLVER];
4960
+ if (v) {
4961
+ const treeWalker = createTreeWalker.call(getOwnerDocument(this), this, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, () => NodeFilter.FILTER_ACCEPT, false);
4962
+ let currentNode;
4963
+ while ((currentNode = treeWalker.nextNode())) {
4964
+ currentNode[KEY__SHADOW_RESOLVER] = fn;
4965
+ }
4966
+ }
4967
+ this[KEY__SHADOW_STATIC_PRIVATE] = v;
4968
+ },
4969
+ get() {
4970
+ return this[KEY__SHADOW_STATIC_PRIVATE];
4971
+ },
4972
+ configurable: true,
4973
+ });
4954
4974
 
4955
4975
  /*
4956
4976
  * Copyright (c) 2018, salesforce.com, inc.
@@ -5091,4 +5111,4 @@ if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
5091
5111
  }));
5092
5112
  });
5093
5113
  }
5094
- /** version: 2.14.2 */
5114
+ /** version: 2.15.0 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lwc/synthetic-shadow",
3
- "version": "2.14.2",
3
+ "version": "2.15.0",
4
4
  "description": "Synthetic Shadow Root for LWC",
5
5
  "homepage": "https://lwc.dev/",
6
6
  "repository": {
@@ -37,7 +37,7 @@
37
37
  "access": "public"
38
38
  },
39
39
  "devDependencies": {
40
- "@lwc/features": "2.14.2",
41
- "@lwc/shared": "2.14.2"
40
+ "@lwc/features": "2.15.0",
41
+ "@lwc/shared": "2.15.0"
42
42
  }
43
43
  }