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