@lwc/synthetic-shadow 6.3.1 → 6.3.3
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.
- package/dist/index.cjs.js +60 -53
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +60 -53
- package/dist/index.js.map +1 -1
- package/dist/shared/utils.d.ts +1 -0
- package/package.json +3 -3
package/dist/index.cjs.js
CHANGED
@@ -210,7 +210,7 @@ const KEY__LEGACY_SHADOW_TOKEN_PRIVATE = '$$LegacyShadowTokenKey$$';
|
|
210
210
|
const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
|
211
211
|
const KEY__NATIVE_GET_ELEMENT_BY_ID = '$nativeGetElementById$';
|
212
212
|
const KEY__NATIVE_QUERY_SELECTOR_ALL = '$nativeQuerySelectorAll$';
|
213
|
-
/** version: 6.3.
|
213
|
+
/** version: 6.3.3 */
|
214
214
|
|
215
215
|
/**
|
216
216
|
* Copyright (c) 2024 Salesforce, Inc.
|
@@ -218,7 +218,7 @@ const KEY__NATIVE_QUERY_SELECTOR_ALL = '$nativeQuerySelectorAll$';
|
|
218
218
|
if (!globalThis.lwcRuntimeFlags) {
|
219
219
|
Object.defineProperty(globalThis, 'lwcRuntimeFlags', { value: create(null) });
|
220
220
|
}
|
221
|
-
/** version: 6.3.
|
221
|
+
/** version: 6.3.3 */
|
222
222
|
|
223
223
|
/*
|
224
224
|
* Copyright (c) 2018, salesforce.com, inc.
|
@@ -377,54 +377,6 @@ const MutationObserverObserve = MO.prototype.observe;
|
|
377
377
|
const NativeShadowRoot = ShadowRoot;
|
378
378
|
const isInstanceOfNativeShadowRoot = (node) => node instanceof NativeShadowRoot;
|
379
379
|
|
380
|
-
/*
|
381
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
382
|
-
* All rights reserved.
|
383
|
-
* SPDX-License-Identifier: MIT
|
384
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
385
|
-
*/
|
386
|
-
// Helpful for tests running with jsdom
|
387
|
-
function getOwnerDocument(node) {
|
388
|
-
const doc = ownerDocumentGetter.call(node);
|
389
|
-
// if doc is null, it means `this` is actually a document instance
|
390
|
-
return doc === null ? node : doc;
|
391
|
-
}
|
392
|
-
function getOwnerWindow(node) {
|
393
|
-
const doc = getOwnerDocument(node);
|
394
|
-
const win = defaultViewGetter.call(doc);
|
395
|
-
if (win === null) {
|
396
|
-
// this method should never be called with a node that is not part
|
397
|
-
// of a qualifying connected node.
|
398
|
-
throw new TypeError();
|
399
|
-
}
|
400
|
-
return win;
|
401
|
-
}
|
402
|
-
let skipGlobalPatching;
|
403
|
-
// Note: we deviate from native shadow here, but are not fixing
|
404
|
-
// due to backwards compat: https://github.com/salesforce/lwc/pull/3103
|
405
|
-
function isGlobalPatchingSkipped(node) {
|
406
|
-
// we lazily compute this value instead of doing it during evaluation, this helps
|
407
|
-
// for apps that are setting this after the engine code is evaluated.
|
408
|
-
if (isUndefined(skipGlobalPatching)) {
|
409
|
-
const ownerDocument = getOwnerDocument(node);
|
410
|
-
skipGlobalPatching =
|
411
|
-
ownerDocument.body &&
|
412
|
-
getAttribute.call(ownerDocument.body, 'data-global-patching-bypass') ===
|
413
|
-
'temporary-bypass';
|
414
|
-
}
|
415
|
-
return isTrue(skipGlobalPatching);
|
416
|
-
}
|
417
|
-
function arrayFromCollection(collection) {
|
418
|
-
const size = collection.length;
|
419
|
-
const cloned = [];
|
420
|
-
if (size > 0) {
|
421
|
-
for (let i = 0; i < size; i++) {
|
422
|
-
cloned[i] = collection[i];
|
423
|
-
}
|
424
|
-
}
|
425
|
-
return cloned;
|
426
|
-
}
|
427
|
-
|
428
380
|
/*
|
429
381
|
* Copyright (c) 2023, Salesforce.com, inc.
|
430
382
|
* All rights reserved.
|
@@ -2299,6 +2251,57 @@ defineProperty(SyntheticShadowRoot, Symbol.hasInstance, {
|
|
2299
2251
|
},
|
2300
2252
|
});
|
2301
2253
|
|
2254
|
+
/*
|
2255
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
2256
|
+
* All rights reserved.
|
2257
|
+
* SPDX-License-Identifier: MIT
|
2258
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
2259
|
+
*/
|
2260
|
+
function isSyntheticOrNativeShadowRoot(node) {
|
2261
|
+
return isSyntheticShadowRoot(node) || isInstanceOfNativeShadowRoot(node);
|
2262
|
+
}
|
2263
|
+
// Helpful for tests running with jsdom
|
2264
|
+
function getOwnerDocument(node) {
|
2265
|
+
const doc = ownerDocumentGetter.call(node);
|
2266
|
+
// if doc is null, it means `this` is actually a document instance
|
2267
|
+
return doc === null ? node : doc;
|
2268
|
+
}
|
2269
|
+
function getOwnerWindow(node) {
|
2270
|
+
const doc = getOwnerDocument(node);
|
2271
|
+
const win = defaultViewGetter.call(doc);
|
2272
|
+
if (win === null) {
|
2273
|
+
// this method should never be called with a node that is not part
|
2274
|
+
// of a qualifying connected node.
|
2275
|
+
throw new TypeError();
|
2276
|
+
}
|
2277
|
+
return win;
|
2278
|
+
}
|
2279
|
+
let skipGlobalPatching;
|
2280
|
+
// Note: we deviate from native shadow here, but are not fixing
|
2281
|
+
// due to backwards compat: https://github.com/salesforce/lwc/pull/3103
|
2282
|
+
function isGlobalPatchingSkipped(node) {
|
2283
|
+
// we lazily compute this value instead of doing it during evaluation, this helps
|
2284
|
+
// for apps that are setting this after the engine code is evaluated.
|
2285
|
+
if (isUndefined(skipGlobalPatching)) {
|
2286
|
+
const ownerDocument = getOwnerDocument(node);
|
2287
|
+
skipGlobalPatching =
|
2288
|
+
ownerDocument.body &&
|
2289
|
+
getAttribute.call(ownerDocument.body, 'data-global-patching-bypass') ===
|
2290
|
+
'temporary-bypass';
|
2291
|
+
}
|
2292
|
+
return isTrue(skipGlobalPatching);
|
2293
|
+
}
|
2294
|
+
function arrayFromCollection(collection) {
|
2295
|
+
const size = collection.length;
|
2296
|
+
const cloned = [];
|
2297
|
+
if (size > 0) {
|
2298
|
+
for (let i = 0; i < size; i++) {
|
2299
|
+
cloned[i] = collection[i];
|
2300
|
+
}
|
2301
|
+
}
|
2302
|
+
return cloned;
|
2303
|
+
}
|
2304
|
+
|
2302
2305
|
/*
|
2303
2306
|
* Copyright (c) 2018, salesforce.com, inc.
|
2304
2307
|
* All rights reserved.
|
@@ -2338,8 +2341,7 @@ function pathComposer(startNode, composed) {
|
|
2338
2341
|
current = current.parentNode;
|
2339
2342
|
}
|
2340
2343
|
}
|
2341
|
-
else if ((
|
2342
|
-
(composed || current !== startRoot)) {
|
2344
|
+
else if (isSyntheticOrNativeShadowRoot(current) && (composed || current !== startRoot)) {
|
2343
2345
|
current = current.host;
|
2344
2346
|
}
|
2345
2347
|
else if (current instanceof _Node) {
|
@@ -2390,10 +2392,15 @@ function retarget(refNode, path) {
|
|
2390
2392
|
for (let i = 0, ancestor, lastRoot, root, rootIdx; i < p$.length; i++) {
|
2391
2393
|
ancestor = p$[i];
|
2392
2394
|
root = ancestor instanceof Window ? ancestor : ancestor.getRootNode();
|
2395
|
+
// Retarget to ancestor if ancestor is not shadowed
|
2396
|
+
if (!isSyntheticOrNativeShadowRoot(root)) {
|
2397
|
+
return ancestor;
|
2398
|
+
}
|
2393
2399
|
if (root !== lastRoot) {
|
2394
2400
|
rootIdx = refNodePath.indexOf(root);
|
2395
2401
|
lastRoot = root;
|
2396
2402
|
}
|
2403
|
+
// Retarget to ancestor if ancestor is shadowed by refNode's shadow root
|
2397
2404
|
if (!isUndefined(rootIdx) && rootIdx > -1) {
|
2398
2405
|
return ancestor;
|
2399
2406
|
}
|
@@ -4356,6 +4363,6 @@ defineProperty(Element.prototype, '$domManual$', {
|
|
4356
4363
|
},
|
4357
4364
|
configurable: true,
|
4358
4365
|
});
|
4359
|
-
/** version: 6.3.
|
4366
|
+
/** version: 6.3.3 */
|
4360
4367
|
}
|
4361
4368
|
//# sourceMappingURL=index.cjs.js.map
|