@lwc/synthetic-shadow 2.34.0 → 2.35.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.
@@ -44,7 +44,7 @@ var assert = /*#__PURE__*/Object.freeze({
44
44
  const { assign, create, defineProperties, defineProperty, freeze, getOwnPropertyDescriptor, getOwnPropertyNames, getPrototypeOf, hasOwnProperty, isFrozen, keys, seal, setPrototypeOf, } = Object;
45
45
  const { isArray } = Array;
46
46
  const { concat: ArrayConcat, copyWithin: ArrayCopyWithin, fill: ArrayFill, filter: ArrayFilter, find: ArrayFind, indexOf: ArrayIndexOf, join: ArrayJoin, map: ArrayMap, pop: ArrayPop, push: ArrayPush, reduce: ArrayReduce, reverse: ArrayReverse, shift: ArrayShift, slice: ArraySlice, some: ArraySome, sort: ArraySort, splice: ArraySplice, unshift: ArrayUnshift, forEach, } = Array.prototype;
47
- const { charCodeAt: StringCharCodeAt, replace: StringReplace, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
47
+ const { charCodeAt: StringCharCodeAt, replace: StringReplace, split: StringSplit, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
48
48
  function isUndefined(obj) {
49
49
  return obj === undefined;
50
50
  }
@@ -88,41 +88,11 @@ function toString(obj) {
88
88
  * SPDX-License-Identifier: MIT
89
89
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
90
90
  */
91
- // Inspired from: https://mathiasbynens.be/notes/globalthis
92
- const _globalThis = /*@__PURE__*/ (function () {
93
- // On recent browsers, `globalThis` is already defined. In this case return it directly.
94
- if (typeof globalThis === 'object') {
95
- return globalThis;
96
- }
97
- let _globalThis;
98
- try {
99
- // eslint-disable-next-line no-extend-native
100
- Object.defineProperty(Object.prototype, '__magic__', {
101
- get: function () {
102
- return this;
103
- },
104
- configurable: true,
105
- });
106
- // __magic__ is undefined in Safari 10 and IE10 and older.
107
- // @ts-ignore
108
- // eslint-disable-next-line no-undef
109
- _globalThis = __magic__;
110
- // @ts-ignore
111
- delete Object.prototype.__magic__;
112
- }
113
- catch (ex) {
114
- // In IE8, Object.defineProperty only works on DOM objects.
115
- }
116
- finally {
117
- // If the magic above fails for some reason we assume that we are in a legacy browser.
118
- // Assume `window` exists in this case.
119
- if (typeof _globalThis === 'undefined') {
120
- // @ts-ignore
121
- _globalThis = window;
122
- }
123
- }
124
- return _globalThis;
125
- })();
91
+ // See browser support for globalThis:
92
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis#browser_compatibility
93
+ /* istanbul ignore next */
94
+ // @ts-ignore
95
+ const _globalThis = typeof globalThis === 'object' ? globalThis : window;
126
96
 
127
97
  /*
128
98
  * Copyright (c) 2018, salesforce.com, inc.
@@ -138,6 +108,8 @@ const KEY__SHADOW_STATIC_PRIVATE = '$shadowStaticNodeKey$';
138
108
  const KEY__SHADOW_TOKEN = '$shadowToken$';
139
109
  const KEY__SHADOW_TOKEN_PRIVATE = '$$ShadowTokenKey$$';
140
110
  const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
111
+ const KEY__NATIVE_GET_ELEMENT_BY_ID = '$nativeGetElementById$';
112
+ const KEY__NATIVE_QUERY_SELECTOR_ALL = '$nativeQuerySelectorAll$';
141
113
 
142
114
  /*
143
115
  * Copyright (c) 2018, salesforce.com, inc.
@@ -148,7 +120,7 @@ const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
148
120
  // We use this to detect symbol support in order to avoid the expensive symbol polyfill. Note that
149
121
  // we can't use typeof since it will fail when transpiling.
150
122
  const hasNativeSymbolSupport = /*@__PURE__*/ (() => Symbol('x').toString() === 'Symbol(x)')();
151
- /** version: 2.34.0 */
123
+ /** version: 2.35.1 */
152
124
 
153
125
  /*
154
126
  * Copyright (c) 2018, salesforce.com, inc.
@@ -463,7 +435,7 @@ if (!_globalThis.lwcRuntimeFlags) {
463
435
  Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
464
436
  }
465
437
  const lwcRuntimeFlags = _globalThis.lwcRuntimeFlags;
466
- /** version: 2.34.0 */
438
+ /** version: 2.35.1 */
467
439
 
468
440
  /*
469
441
  * Copyright (c) 2018, salesforce.com, inc.
@@ -1805,6 +1777,15 @@ defineProperty(_Node.prototype, KEY__SHADOW_RESOLVER, {
1805
1777
  defineProperty(_globalThis, KEY__IS_NATIVE_SHADOW_ROOT_DEFINED, {
1806
1778
  value: isNativeShadowRootDefined,
1807
1779
  });
1780
+ // The isUndefined check is because two copies of synthetic shadow may be loaded on the same page, and this
1781
+ // would throw an error if we tried to redefine it. Plus the whole point is to expose the native method.
1782
+ if (isUndefined(_globalThis[KEY__NATIVE_GET_ELEMENT_BY_ID])) {
1783
+ defineProperty(_globalThis, KEY__NATIVE_GET_ELEMENT_BY_ID, { value: getElementById });
1784
+ }
1785
+ // See note above.
1786
+ if (isUndefined(_globalThis[KEY__NATIVE_QUERY_SELECTOR_ALL])) {
1787
+ defineProperty(_globalThis, KEY__NATIVE_QUERY_SELECTOR_ALL, { value: querySelectorAll });
1788
+ }
1808
1789
  function getShadowRootResolver(node) {
1809
1790
  return node[KEY__SHADOW_RESOLVER];
1810
1791
  }
@@ -4701,8 +4682,7 @@ defineProperty(Element.prototype, '$domManual$', {
4701
4682
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4702
4683
  */
4703
4684
  // Only used in LWC's Karma tests
4704
- // @ts-ignore
4705
- if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
4685
+ if (process.env.NODE_ENV === 'test-karma-lwc') {
4706
4686
  window.addEventListener('test-dummy-flag', () => {
4707
4687
  let hasFlag = false;
4708
4688
  if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
@@ -4716,4 +4696,4 @@ if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
4716
4696
  }));
4717
4697
  });
4718
4698
  }
4719
- /** version: 2.34.0 */
4699
+ /** version: 2.35.1 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lwc/synthetic-shadow",
3
- "version": "2.34.0",
3
+ "version": "2.35.1",
4
4
  "description": "Synthetic Shadow Root for LWC",
5
5
  "homepage": "https://lwc.dev/",
6
6
  "repository": {
@@ -36,8 +36,8 @@
36
36
  "access": "public"
37
37
  },
38
38
  "devDependencies": {
39
- "@lwc/features": "2.34.0",
40
- "@lwc/shared": "2.34.0"
39
+ "@lwc/features": "2.35.1",
40
+ "@lwc/shared": "2.35.1"
41
41
  },
42
42
  "nx": {
43
43
  "targets": {