@workday/canvas-kit-popup-stack 12.6.7 → 12.6.9
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupStack.d.ts","sourceRoot":"","sources":["../../../lib/PopupStack.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,OAAO,EAAE,WAAW,CAAC;IACrB;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AASD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAO9D;AA2CD,UAAU,KAAK;IACb,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,WAAW,KAAK,WAAW,CAAC;IACnD,MAAM,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,OAAO,QAAQ,CAAC;KAC3B,CAAC;IACF,QAAQ,EAAE,OAAO,CAAC,OAAO,UAAU,CAAC,CAAC;CACtC;AAuGD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,UAAU;IACrB;;;;;OAKG;uBACgB,WAAW;IAS9B;;;;;OAKG;cACO,cAAc,GAAG,IAAI;IAY/B;;;;;;OAMG;oBACa,WAAW,GAAG,IAAI;IAgBlC;;;;OAIG;uBACgB,WAAW,GAAG,OAAO;IAaxC;;;;OAIG;gCACyB,KAAK,GAAG,WAAW,EAAE;IAQjD;;;;;;;;;;;OAWG;wBACiB,WAAW,GAAG,IAAI;IA6BtC;;;;;;;;;;OAUG;sBACe,WAAW,eAAe,WAAW,GAAG,OAAO;
|
|
1
|
+
{"version":3,"file":"PopupStack.d.ts","sourceRoot":"","sources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AAa,QAAQ,iBAAiB,CAAC,SAEhE,CAAC"}
|
|
@@ -309,26 +309,38 @@ exports.PopupStack = {
|
|
|
309
309
|
* is not inside `element`).
|
|
310
310
|
*/
|
|
311
311
|
contains(element, eventTarget) {
|
|
312
|
-
var _a
|
|
312
|
+
var _a;
|
|
313
313
|
const stack = getTopStack();
|
|
314
314
|
if ((_a = stack._adapter) === null || _a === void 0 ? void 0 : _a.contains) {
|
|
315
315
|
return stack._adapter.contains(element, eventTarget);
|
|
316
316
|
}
|
|
317
|
+
// find the stack item that contains the event target
|
|
317
318
|
const item = stack.items.find(i => i.element === element);
|
|
318
|
-
const containsOwnerOfAnotherPopupTargeted = stack.items.some(currentItem => {
|
|
319
|
-
var _a;
|
|
320
|
-
return ((item === null || item === void 0 ? void 0 : item.element.contains(currentItem.owner || null)) &&
|
|
321
|
-
(eventTarget === currentItem.owner ||
|
|
322
|
-
((_a = currentItem.owner) === null || _a === void 0 ? void 0 : _a.contains(eventTarget)) ||
|
|
323
|
-
currentItem.element.contains(eventTarget)));
|
|
324
|
-
});
|
|
325
319
|
if (item) {
|
|
326
|
-
return (
|
|
327
|
-
eventTarget === item.owner ||
|
|
328
|
-
((_b = item.owner) === null || _b === void 0 ? void 0 : _b.contains(eventTarget)) ||
|
|
329
|
-
element.contains(eventTarget));
|
|
320
|
+
return ownsElement(item, eventTarget);
|
|
330
321
|
}
|
|
331
322
|
return false;
|
|
323
|
+
function ownsElement(item, eventTarget, depth = 0) {
|
|
324
|
+
var _a;
|
|
325
|
+
if (depth > 30) {
|
|
326
|
+
// Prevent infinite loop
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
// See if the event target is inside the popup element or the owner element
|
|
330
|
+
if (item.element === eventTarget ||
|
|
331
|
+
item.owner === eventTarget ||
|
|
332
|
+
item.element.contains(eventTarget) ||
|
|
333
|
+
((_a = item.owner) === null || _a === void 0 ? void 0 : _a.contains(eventTarget))) {
|
|
334
|
+
return true;
|
|
335
|
+
}
|
|
336
|
+
// Find the popup that has an owner element inside this popup
|
|
337
|
+
const owningPopup = stack.items.find(i => i.owner && item.element.contains(i.owner));
|
|
338
|
+
if (owningPopup) {
|
|
339
|
+
// Check if the event target is inside the owning popup
|
|
340
|
+
return ownsElement(owningPopup, eventTarget, depth + 1);
|
|
341
|
+
}
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
332
344
|
},
|
|
333
345
|
/**
|
|
334
346
|
* Add a new stack context for popups. This method could be called with the same element multiple
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupStack.d.ts","sourceRoot":"","sources":["../../../lib/PopupStack.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,OAAO,EAAE,WAAW,CAAC;IACrB;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AASD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAO9D;AA2CD,UAAU,KAAK;IACb,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,WAAW,KAAK,WAAW,CAAC;IACnD,MAAM,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,OAAO,QAAQ,CAAC;KAC3B,CAAC;IACF,QAAQ,EAAE,OAAO,CAAC,OAAO,UAAU,CAAC,CAAC;CACtC;AAuGD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,UAAU;IACrB;;;;;OAKG;uBACgB,WAAW;IAS9B;;;;;OAKG;cACO,cAAc,GAAG,IAAI;IAY/B;;;;;;OAMG;oBACa,WAAW,GAAG,IAAI;IAgBlC;;;;OAIG;uBACgB,WAAW,GAAG,OAAO;IAaxC;;;;OAIG;gCACyB,KAAK,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IG;+BACwB,WAAW,GAAG,IAAI;IAY7C;;;;;;;;;;;;;;OAcG;mCAC4B,cAAc,GAAG,IAAI;CAqBrD,CAAC;AAEF;;;GAGG;AACH,wBAAgB,UAAU,SAEzB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,YAAa,QAAQ,iBAAiB,CAAC,SAEhE,CAAC"}
|
|
@@ -302,26 +302,38 @@ export const PopupStack = {
|
|
|
302
302
|
* is not inside `element`).
|
|
303
303
|
*/
|
|
304
304
|
contains(element, eventTarget) {
|
|
305
|
-
var _a
|
|
305
|
+
var _a;
|
|
306
306
|
const stack = getTopStack();
|
|
307
307
|
if ((_a = stack._adapter) === null || _a === void 0 ? void 0 : _a.contains) {
|
|
308
308
|
return stack._adapter.contains(element, eventTarget);
|
|
309
309
|
}
|
|
310
|
+
// find the stack item that contains the event target
|
|
310
311
|
const item = stack.items.find(i => i.element === element);
|
|
311
|
-
const containsOwnerOfAnotherPopupTargeted = stack.items.some(currentItem => {
|
|
312
|
-
var _a;
|
|
313
|
-
return ((item === null || item === void 0 ? void 0 : item.element.contains(currentItem.owner || null)) &&
|
|
314
|
-
(eventTarget === currentItem.owner ||
|
|
315
|
-
((_a = currentItem.owner) === null || _a === void 0 ? void 0 : _a.contains(eventTarget)) ||
|
|
316
|
-
currentItem.element.contains(eventTarget)));
|
|
317
|
-
});
|
|
318
312
|
if (item) {
|
|
319
|
-
return (
|
|
320
|
-
eventTarget === item.owner ||
|
|
321
|
-
((_b = item.owner) === null || _b === void 0 ? void 0 : _b.contains(eventTarget)) ||
|
|
322
|
-
element.contains(eventTarget));
|
|
313
|
+
return ownsElement(item, eventTarget);
|
|
323
314
|
}
|
|
324
315
|
return false;
|
|
316
|
+
function ownsElement(item, eventTarget, depth = 0) {
|
|
317
|
+
var _a;
|
|
318
|
+
if (depth > 30) {
|
|
319
|
+
// Prevent infinite loop
|
|
320
|
+
return false;
|
|
321
|
+
}
|
|
322
|
+
// See if the event target is inside the popup element or the owner element
|
|
323
|
+
if (item.element === eventTarget ||
|
|
324
|
+
item.owner === eventTarget ||
|
|
325
|
+
item.element.contains(eventTarget) ||
|
|
326
|
+
((_a = item.owner) === null || _a === void 0 ? void 0 : _a.contains(eventTarget))) {
|
|
327
|
+
return true;
|
|
328
|
+
}
|
|
329
|
+
// Find the popup that has an owner element inside this popup
|
|
330
|
+
const owningPopup = stack.items.find(i => i.owner && item.element.contains(i.owner));
|
|
331
|
+
if (owningPopup) {
|
|
332
|
+
// Check if the event target is inside the owning popup
|
|
333
|
+
return ownsElement(owningPopup, eventTarget, depth + 1);
|
|
334
|
+
}
|
|
335
|
+
return false;
|
|
336
|
+
}
|
|
325
337
|
},
|
|
326
338
|
/**
|
|
327
339
|
* Add a new stack context for popups. This method could be called with the same element multiple
|
package/lib/PopupStack.ts
CHANGED
|
@@ -369,26 +369,39 @@ export const PopupStack = {
|
|
|
369
369
|
if (stack._adapter?.contains) {
|
|
370
370
|
return stack._adapter.contains(element, eventTarget);
|
|
371
371
|
}
|
|
372
|
-
const item = stack.items.find(i => i.element === element);
|
|
373
|
-
|
|
374
|
-
const containsOwnerOfAnotherPopupTargeted = stack.items.some(currentItem => {
|
|
375
|
-
return (
|
|
376
|
-
item?.element.contains(currentItem.owner || null) &&
|
|
377
|
-
(eventTarget === currentItem.owner ||
|
|
378
|
-
currentItem.owner?.contains(eventTarget) ||
|
|
379
|
-
currentItem.element.contains(eventTarget))
|
|
380
|
-
);
|
|
381
|
-
});
|
|
382
372
|
|
|
373
|
+
// find the stack item that contains the event target
|
|
374
|
+
const item = stack.items.find(i => i.element === element);
|
|
383
375
|
if (item) {
|
|
384
|
-
return (
|
|
385
|
-
containsOwnerOfAnotherPopupTargeted ||
|
|
386
|
-
eventTarget === item.owner ||
|
|
387
|
-
item.owner?.contains(eventTarget) ||
|
|
388
|
-
element.contains(eventTarget)
|
|
389
|
-
);
|
|
376
|
+
return ownsElement(item, eventTarget);
|
|
390
377
|
}
|
|
391
378
|
return false;
|
|
379
|
+
|
|
380
|
+
function ownsElement(item: PopupStackItem, eventTarget: HTMLElement, depth = 0): boolean {
|
|
381
|
+
if (depth > 30) {
|
|
382
|
+
// Prevent infinite loop
|
|
383
|
+
return false;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// See if the event target is inside the popup element or the owner element
|
|
387
|
+
if (
|
|
388
|
+
item.element === eventTarget ||
|
|
389
|
+
item.owner === eventTarget ||
|
|
390
|
+
item.element.contains(eventTarget) ||
|
|
391
|
+
item.owner?.contains(eventTarget)
|
|
392
|
+
) {
|
|
393
|
+
return true;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// Find the popup that has an owner element inside this popup
|
|
397
|
+
const owningPopup = stack.items.find(i => i.owner && item.element.contains(i.owner));
|
|
398
|
+
if (owningPopup) {
|
|
399
|
+
// Check if the event target is inside the owning popup
|
|
400
|
+
return ownsElement(owningPopup, eventTarget, depth + 1);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
return false;
|
|
404
|
+
}
|
|
392
405
|
},
|
|
393
406
|
|
|
394
407
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-popup-stack",
|
|
3
|
-
"version": "12.6.
|
|
3
|
+
"version": "12.6.9",
|
|
4
4
|
"description": "Stack for managing popup UIs to coordinate global concerns like escape key handling and rendering order",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"screenfull": "^5.2.0"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "6439fb540cd5ae6d35fbbc1c4594f824eeb62b73"
|
|
41
41
|
}
|