Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@workday/canvas-kit-popup-stack

Package Overview
Dependencies
Maintainers
0
Versions
1251
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@workday/canvas-kit-popup-stack - npm Package Compare versions

Comparing version 11.0.18 to 11.0.19

5

dist/commonjs/lib/PopupStack.d.ts

@@ -37,3 +37,6 @@ /**

items: PopupStackItem[];
container?: () => HTMLElement;
/**
* Returns the container of a stack given an optional element.
*/
container?: (element?: HTMLElement) => HTMLElement;
zIndex: {

@@ -40,0 +43,0 @@ min: number;

@@ -126,2 +126,16 @@ "use strict";

};
/**
* TODO: Remove this after v12 and use `stack.container(el)` directly. This is temporary to make
* sure Popups can open in new windows while supporting older versions of Canvas Kit AND full screen
* mode.
*/
const getContainer = (stack, element) => {
var _a;
let stackContainer = (_a = stack.container) === null || _a === void 0 ? void 0 : _a.call(stack);
if (stackContainer === document.body) {
// Here's the transitory code
stackContainer = element === null || element === void 0 ? void 0 : element.ownerDocument.body;
}
return stackContainer || document.body;
};
// We need to make sure only one stack is ever in use on the page - ever. If a stack is already

@@ -132,3 +146,3 @@ // defined on the page, we need to use that one. Never, ever, ever change this variable name on

description: 'Global popup stack from @workday/canvas-kit/popup-stack',
container: () => document.body,
container: el => (el === null || el === void 0 ? void 0 : el.ownerDocument.body) || document.body,
items: [],

@@ -187,3 +201,3 @@ zIndex: { min: 30, max: 50, getValue: getValue },

add(item) {
var _a, _b;
var _a;
const stack = getTopStack();

@@ -195,3 +209,3 @@ if ((_a = stack._adapter) === null || _a === void 0 ? void 0 : _a.add) {

stack.items.push(item);
(((_b = stack.container) === null || _b === void 0 ? void 0 : _b.call(stack)) || document.body).appendChild(item.element);
getContainer(stack, item.owner).appendChild(item.element);
setZIndexOfElements(exports.PopupStack.getElements());

@@ -207,3 +221,3 @@ },

remove(element) {
var _a, _b;
var _a;
// Find the stack the popup belongs to.

@@ -216,4 +230,5 @@ const stack = stacks.find(stack => !!exports.PopupStack.getElements(stack).find(el => el === element));

}
const item = stack.items.find(item => item.element === element);
stack.items = stack.items.filter(item => item.element !== element);
(((_b = stack.container) === null || _b === void 0 ? void 0 : _b.call(stack)) || document.body).removeChild(element);
getContainer(stack, item === null || item === void 0 ? void 0 : item.owner).removeChild(element);
setZIndexOfElements(exports.PopupStack.getElements(stack));

@@ -220,0 +235,0 @@ }

@@ -37,3 +37,6 @@ /**

items: PopupStackItem[];
container?: () => HTMLElement;
/**
* Returns the container of a stack given an optional element.
*/
container?: (element?: HTMLElement) => HTMLElement;
zIndex: {

@@ -40,0 +43,0 @@ min: number;

@@ -119,2 +119,16 @@ import screenfull from 'screenfull';

};
/**
* TODO: Remove this after v12 and use `stack.container(el)` directly. This is temporary to make
* sure Popups can open in new windows while supporting older versions of Canvas Kit AND full screen
* mode.
*/
const getContainer = (stack, element) => {
var _a;
let stackContainer = (_a = stack.container) === null || _a === void 0 ? void 0 : _a.call(stack);
if (stackContainer === document.body) {
// Here's the transitory code
stackContainer = element === null || element === void 0 ? void 0 : element.ownerDocument.body;
}
return stackContainer || document.body;
};
// We need to make sure only one stack is ever in use on the page - ever. If a stack is already

@@ -125,3 +139,3 @@ // defined on the page, we need to use that one. Never, ever, ever change this variable name on

description: 'Global popup stack from @workday/canvas-kit/popup-stack',
container: () => document.body,
container: el => (el === null || el === void 0 ? void 0 : el.ownerDocument.body) || document.body,
items: [],

@@ -180,3 +194,3 @@ zIndex: { min: 30, max: 50, getValue: getValue },

add(item) {
var _a, _b;
var _a;
const stack = getTopStack();

@@ -188,3 +202,3 @@ if ((_a = stack._adapter) === null || _a === void 0 ? void 0 : _a.add) {

stack.items.push(item);
(((_b = stack.container) === null || _b === void 0 ? void 0 : _b.call(stack)) || document.body).appendChild(item.element);
getContainer(stack, item.owner).appendChild(item.element);
setZIndexOfElements(PopupStack.getElements());

@@ -200,3 +214,3 @@ },

remove(element) {
var _a, _b;
var _a;
// Find the stack the popup belongs to.

@@ -209,4 +223,5 @@ const stack = stacks.find(stack => !!PopupStack.getElements(stack).find(el => el === element));

}
const item = stack.items.find(item => item.element === element);
stack.items = stack.items.filter(item => item.element !== element);
(((_b = stack.container) === null || _b === void 0 ? void 0 : _b.call(stack)) || document.body).removeChild(element);
getContainer(stack, item === null || item === void 0 ? void 0 : item.owner).removeChild(element);
setZIndexOfElements(PopupStack.getElements(stack));

@@ -213,0 +228,0 @@ }

27

lib/PopupStack.ts

@@ -96,3 +96,6 @@ import screenfull from 'screenfull';

items: PopupStackItem[];
container?: () => HTMLElement;
/**
* Returns the container of a stack given an optional element.
*/
container?: (element?: HTMLElement) => HTMLElement;
zIndex: {

@@ -171,2 +174,17 @@ min: number;

/**
* TODO: Remove this after v12 and use `stack.container(el)` directly. This is temporary to make
* sure Popups can open in new windows while supporting older versions of Canvas Kit AND full screen
* mode.
*/
const getContainer = (stack: Stack, element?: HTMLElement): HTMLElement => {
let stackContainer = stack.container?.();
if (stackContainer === document.body) {
// Here's the transitory code
stackContainer = element?.ownerDocument.body;
}
return stackContainer || document.body;
};
// We need to make sure only one stack is ever in use on the page - ever. If a stack is already

@@ -177,3 +195,3 @@ // defined on the page, we need to use that one. Never, ever, ever change this variable name on

description: 'Global popup stack from @workday/canvas-kit/popup-stack',
container: () => document.body,
container: el => el?.ownerDocument.body || document.body,
items: [],

@@ -241,3 +259,3 @@ zIndex: {min: 30, max: 50, getValue: getValue},

stack.items.push(item);
(stack.container?.() || document.body).appendChild(item.element);
getContainer(stack, item.owner).appendChild(item.element);

@@ -262,4 +280,5 @@ setZIndexOfElements(PopupStack.getElements());

}
const item = stack.items.find(item => item.element === element);
stack.items = stack.items.filter(item => item.element !== element);
(stack.container?.() || document.body).removeChild(element);
getContainer(stack, item?.owner).removeChild(element);

@@ -266,0 +285,0 @@ setZIndexOfElements(PopupStack.getElements(stack));

{
"name": "@workday/canvas-kit-popup-stack",
"version": "11.0.18",
"version": "11.0.19",
"description": "Stack for managing popup UIs to coordinate global concerns like escape key handling and rendering order",

@@ -40,3 +40,3 @@ "author": "Workday, Inc. (https://www.workday.com)",

},
"gitHead": "b8919f552eadd3b280dffd8e6c4d445a275d2ee5"
"gitHead": "c2d95558a8716248923ecb281c94406c0071792c"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc