Socket
Socket
Sign inDemoInstall

@chakra-ui/utils

Package Overview
Dependencies
4
Maintainers
4
Versions
257
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.8.1 to 1.8.2-next.0

14

CHANGELOG.md
# Change Log
## 1.8.2-next.0
### Patch Changes
- [`4c1071969`](https://github.com/chakra-ui/chakra-ui/commit/4c1071969a9b41a952b374f9990ac0bb89d24fa0)
[#4437](https://github.com/chakra-ui/chakra-ui/pull/4437) Thanks
[@Toxiapo](https://github.com/Toxiapo)! - Remove code that was added as a
workaround for pre-releases of React concurrent mode.
* [`43f66097b`](https://github.com/chakra-ui/chakra-ui/commit/43f66097b39f1c37a4627dd6ca8a85555f35b95c)
[#4458](https://github.com/chakra-ui/chakra-ui/pull/4458) Thanks
[@agundermann](https://github.com/agundermann)! - Fix issues when rendering
chakra components in different window
## 1.8.1

@@ -4,0 +18,0 @@

6

dist/cjs/dom-query.js

@@ -15,2 +15,4 @@ "use strict";

var _dom = require("./dom");
var _tabbable = require("./tabbable");

@@ -78,3 +80,3 @@

if (nextTabbable && (0, _tabbable.isHTMLElement)(nextTabbable)) {
if (nextTabbable && (0, _dom.isHTMLElement)(nextTabbable)) {
nextTabbable.focus();

@@ -87,3 +89,3 @@ }

if (previousTabbable && (0, _tabbable.isHTMLElement)(previousTabbable)) {
if (previousTabbable && (0, _dom.isHTMLElement)(previousTabbable)) {
previousTabbable.focus();

@@ -90,0 +92,0 @@ }

"use strict";
exports.__esModule = true;
exports.isElement = isElement;
exports.isHTMLElement = isHTMLElement;
exports.getOwnerWindow = getOwnerWindow;
exports.getOwnerDocument = getOwnerDocument;
exports.getEventWindow = getEventWindow;
exports.canUseDOM = canUseDOM;

@@ -15,6 +18,21 @@ exports.getActiveElement = getActiveElement;

function isElement(el) {
return el != null && typeof el == "object" && "nodeType" in el && el.nodeType === Node.ELEMENT_NODE;
}
function isHTMLElement(el) {
var _el$ownerDocument$def;
if (!isElement(el)) {
return false;
}
var win = (_el$ownerDocument$def = el.ownerDocument.defaultView) != null ? _el$ownerDocument$def : window;
return el instanceof win.HTMLElement;
}
function getOwnerWindow(node) {
var _getOwnerDocument$def, _getOwnerDocument;
return node instanceof Element ? (_getOwnerDocument$def = (_getOwnerDocument = getOwnerDocument(node)) == null ? void 0 : _getOwnerDocument.defaultView) != null ? _getOwnerDocument$def : window : window;
return isElement(node) ? (_getOwnerDocument$def = (_getOwnerDocument = getOwnerDocument(node)) == null ? void 0 : _getOwnerDocument.defaultView) != null ? _getOwnerDocument$def : window : window;
}

@@ -25,5 +43,11 @@

return node instanceof Element ? (_node$ownerDocument = node.ownerDocument) != null ? _node$ownerDocument : document : document;
return isElement(node) ? (_node$ownerDocument = node.ownerDocument) != null ? _node$ownerDocument : document : document;
}
function getEventWindow(event) {
var _view;
return (_view = event.view) != null ? _view : window;
}
function canUseDOM() {

@@ -30,0 +54,0 @@ return !!(typeof window !== "undefined" && window.document && window.document.createElement);

@@ -91,3 +91,6 @@ "use strict";

function getScrollableElements(element) {
var _doc$defaultView;
var doc = (0, _dom.getOwnerDocument)(element);
var win = (_doc$defaultView = doc.defaultView) != null ? _doc$defaultView : window;
var parent = element.parentNode;

@@ -97,3 +100,3 @@ var scrollableElements = [];

while (parent instanceof HTMLElement && parent !== rootScrollingElement) {
while (parent instanceof win.HTMLElement && parent !== rootScrollingElement) {
if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth) {

@@ -110,3 +113,3 @@ scrollableElements.push({

if (rootScrollingElement instanceof HTMLElement) {
if (rootScrollingElement instanceof win.HTMLElement) {
scrollableElements.push({

@@ -113,0 +116,0 @@ element: rootScrollingElement,

@@ -9,3 +9,3 @@ "use strict";

exports.distance = distance;
exports.pipe = exports.scheduleMicrotask = exports.error = exports.warn = exports.noop = exports.compose = void 0;
exports.pipe = exports.error = exports.warn = exports.noop = exports.compose = void 0;

@@ -104,11 +104,2 @@ var _assertion = require("./assertion");

var promiseMicrotask = function promiseMicrotask(callback) {
Promise.resolve().then(callback);
};
var scheduleMicrotask = _assertion.__TEST__ ? function (fn) {
return fn();
} : typeof queueMicrotask === "function" ? queueMicrotask : promiseMicrotask;
exports.scheduleMicrotask = scheduleMicrotask;
var pipe = function pipe() {

@@ -115,0 +106,0 @@ for (var _len6 = arguments.length, fns = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {

@@ -20,8 +20,9 @@ "use strict";

function isMouseEvent(event) {
// PointerEvent inherits from MouseEvent so we can't use a straight instanceof check.
if (typeof PointerEvent !== "undefined" && event instanceof PointerEvent) {
var win = (0, _dom.getEventWindow)(event); // PointerEvent inherits from MouseEvent so we can't use a straight instanceof check.
if (typeof win.PointerEvent !== "undefined" && event instanceof win.PointerEvent) {
return !!(event.pointerType === "mouse");
}
return event instanceof MouseEvent;
return event instanceof win.MouseEvent;
}

@@ -40,3 +41,4 @@

return function (event) {
var isMouseEvent = event instanceof MouseEvent;
var win = (0, _dom.getEventWindow)(event);
var isMouseEvent = event instanceof win.MouseEvent;
var isPrimaryPointer = !isMouseEvent || isMouseEvent && event.button === 0;

@@ -43,0 +45,0 @@

@@ -8,3 +8,2 @@ "use strict";

exports.hasFocusWithin = hasFocusWithin;
exports.isHTMLElement = isHTMLElement;
exports.isHidden = isHidden;

@@ -43,7 +42,7 @@ exports.isContentEditable = isContentEditable;

function isInputElement(element) {
return isHTMLElement(element) && element.tagName.toLowerCase() === "input" && "select" in element;
return (0, _dom.isHTMLElement)(element) && element.tagName.toLowerCase() === "input" && "select" in element;
}
function isActiveElement(element) {
var doc = element instanceof HTMLElement ? (0, _dom.getOwnerDocument)(element) : document;
var doc = (0, _dom.isHTMLElement)(element) ? (0, _dom.getOwnerDocument)(element) : document;
return doc.activeElement === element;

@@ -57,6 +56,2 @@ }

function isHTMLElement(element) {
return element instanceof HTMLElement;
}
function isHidden(element) {

@@ -73,3 +68,3 @@ if (element.parentElement && isHidden(element.parentElement)) return true;

function isFocusable(element) {
if (!isHTMLElement(element) || isHidden(element) || isDisabled(element)) {
if (!(0, _dom.isHTMLElement)(element) || isHidden(element) || isDisabled(element)) {
return false;

@@ -103,4 +98,4 @@ }

if (!element) return false;
return isHTMLElement(element) && isFocusable(element) && !hasNegativeTabIndex(element);
return (0, _dom.isHTMLElement)(element) && isFocusable(element) && !hasNegativeTabIndex(element);
}
//# sourceMappingURL=tabbable.js.map

@@ -1,2 +0,3 @@

import { isFocusable, isTabbable, isHTMLElement } from "./tabbable";
import { isHTMLElement } from "./dom";
import { isFocusable, isTabbable } from "./tabbable";
var focusableElList = ["input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])", "embed", "iframe", "object", "a[href]", "area[href]", "button:not([disabled])", "[tabindex]", "audio[controls]", "video[controls]", "*[tabindex]:not([aria-disabled])", "*[contenteditable]"];

@@ -3,0 +4,0 @@ var focusableElSelector = focusableElList.join();

@@ -0,5 +1,18 @@

export function isElement(el) {
return el != null && typeof el == "object" && "nodeType" in el && el.nodeType === Node.ELEMENT_NODE;
}
export function isHTMLElement(el) {
var _el$ownerDocument$def;
if (!isElement(el)) {
return false;
}
var win = (_el$ownerDocument$def = el.ownerDocument.defaultView) != null ? _el$ownerDocument$def : window;
return el instanceof win.HTMLElement;
}
export function getOwnerWindow(node) {
var _getOwnerDocument$def, _getOwnerDocument;
return node instanceof Element ? (_getOwnerDocument$def = (_getOwnerDocument = getOwnerDocument(node)) == null ? void 0 : _getOwnerDocument.defaultView) != null ? _getOwnerDocument$def : window : window;
return isElement(node) ? (_getOwnerDocument$def = (_getOwnerDocument = getOwnerDocument(node)) == null ? void 0 : _getOwnerDocument.defaultView) != null ? _getOwnerDocument$def : window : window;
}

@@ -9,4 +22,9 @@ export function getOwnerDocument(node) {

return node instanceof Element ? (_node$ownerDocument = node.ownerDocument) != null ? _node$ownerDocument : document : document;
return isElement(node) ? (_node$ownerDocument = node.ownerDocument) != null ? _node$ownerDocument : document : document;
}
export function getEventWindow(event) {
var _view;
return (_view = event.view) != null ? _view : window;
}
export function canUseDOM() {

@@ -13,0 +31,0 @@ return !!(typeof window !== "undefined" && window.document && window.document.createElement);

@@ -78,3 +78,6 @@ // Original licensing for the following methods can be found in the

function getScrollableElements(element) {
var _doc$defaultView;
var doc = getOwnerDocument(element);
var win = (_doc$defaultView = doc.defaultView) != null ? _doc$defaultView : window;
var parent = element.parentNode;

@@ -84,3 +87,3 @@ var scrollableElements = [];

while (parent instanceof HTMLElement && parent !== rootScrollingElement) {
while (parent instanceof win.HTMLElement && parent !== rootScrollingElement) {
if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth) {

@@ -97,3 +100,3 @@ scrollableElements.push({

if (rootScrollingElement instanceof HTMLElement) {
if (rootScrollingElement instanceof win.HTMLElement) {
scrollableElements.push({

@@ -100,0 +103,0 @@ element: rootScrollingElement,

/* eslint-disable no-nested-ternary */
import { isFunction, isNumber, __DEV__, __TEST__ } from "./assertion";
import { isFunction, isNumber, __DEV__ } from "./assertion";
export function runIfFn(valueOrFn) {

@@ -78,8 +78,2 @@ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {

});
var promiseMicrotask = callback => {
Promise.resolve().then(callback);
};
export var scheduleMicrotask = __TEST__ ? fn => fn() : typeof queueMicrotask === "function" ? queueMicrotask : promiseMicrotask;
export var pipe = function pipe() {

@@ -86,0 +80,0 @@ for (var _len6 = arguments.length, fns = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {

@@ -5,10 +5,11 @@ /**

*/
import { addDomEvent, isBrowser } from "./dom";
import { addDomEvent, getEventWindow, isBrowser } from "./dom";
export function isMouseEvent(event) {
// PointerEvent inherits from MouseEvent so we can't use a straight instanceof check.
if (typeof PointerEvent !== "undefined" && event instanceof PointerEvent) {
var win = getEventWindow(event); // PointerEvent inherits from MouseEvent so we can't use a straight instanceof check.
if (typeof win.PointerEvent !== "undefined" && event instanceof win.PointerEvent) {
return !!(event.pointerType === "mouse");
}
return event instanceof MouseEvent;
return event instanceof win.MouseEvent;
}

@@ -26,3 +27,4 @@ export function isTouchEvent(event) {

return event => {
var isMouseEvent = event instanceof MouseEvent;
var win = getEventWindow(event);
var isMouseEvent = event instanceof win.MouseEvent;
var isPrimaryPointer = !isMouseEvent || isMouseEvent && event.button === 0;

@@ -29,0 +31,0 @@

// Really great work done by Diego Haz on this one
// https://github.com/reakit/reakit/blob/master/packages/reakit-utils/src/tabbable.ts
import { getOwnerDocument } from "./dom";
import { getOwnerDocument, isHTMLElement } from "./dom";
export var hasDisplayNone = element => window.getComputedStyle(element).display === "none";

@@ -14,3 +14,3 @@ export var hasTabIndex = element => element.hasAttribute("tabindex");

export function isActiveElement(element) {
var doc = element instanceof HTMLElement ? getOwnerDocument(element) : document;
var doc = isHTMLElement(element) ? getOwnerDocument(element) : document;
return doc.activeElement === element;

@@ -22,5 +22,2 @@ }

}
export function isHTMLElement(element) {
return element instanceof HTMLElement;
}
export function isHidden(element) {

@@ -27,0 +24,0 @@ if (element.parentElement && isHidden(element.parentElement)) return true;

import { Booleanish, EventKeys } from "./types";
export declare function getOwnerWindow(node?: HTMLElement | null): Window;
export declare function getOwnerDocument(node?: HTMLElement | null): Document;
export declare function isElement(el: any): el is Element;
export declare function isHTMLElement(el: any): el is HTMLElement;
export declare function getOwnerWindow(node?: Element | null): typeof globalThis;
export declare function getOwnerDocument(node?: Element | null): Document;
export declare function getEventWindow(event: Event): typeof globalThis;
export declare function canUseDOM(): boolean;

@@ -5,0 +8,0 @@ export declare const isBrowser: boolean;

@@ -14,3 +14,2 @@ import { AnyFunction, FunctionArguments } from "./types";

export declare const error: (this: any, options: MessageOptions) => any;
export declare const scheduleMicrotask: typeof queueMicrotask;
export declare const pipe: <R>(...fns: ((a: R) => R)[]) => (v: R) => R;

@@ -17,0 +16,0 @@ declare type Point = {

@@ -11,3 +11,2 @@ export declare const hasDisplayNone: (element: HTMLElement) => boolean;

export declare function hasFocusWithin(element: HTMLElement): boolean;
export declare function isHTMLElement(element: any): element is HTMLElement;
export declare function isHidden(element: HTMLElement): boolean;

@@ -14,0 +13,0 @@ export declare function isContentEditable(element: HTMLElement): boolean;

{
"name": "@chakra-ui/utils",
"version": "1.8.1",
"version": "1.8.2-next.0",
"description": "Common utilties and types for Chakra UI",

@@ -27,3 +27,4 @@ "author": "Segun Adebayo <sage@adebayosegun.com>",

"type": "git",
"url": "git+https://github.com/chakra-ui/chakra-ui.git"
"url": "git+https://github.com/chakra-ui/chakra-ui.git",
"directory": "packages/utils"
},

@@ -30,0 +31,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc