reakit-utils
Advanced tools
Comparing version 0.6.7 to 0.7.0
@@ -6,2 +6,10 @@ # Change Log | ||
# [0.7.0](https://github.com/reakit/reakit/tree/master/packages/reakit-utils/compare/reakit-utils@0.6.7...reakit-utils@0.7.0) (2019-11-08) | ||
**Note:** Version bump only for package reakit-utils | ||
## [0.6.7](https://github.com/reakit/reakit/tree/master/packages/reakit-utils/compare/reakit-utils@0.6.6...reakit-utils@0.6.7) (2019-11-02) | ||
@@ -8,0 +16,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],n):n((e=e||self).ReakitUtils={},e.React)}(this,function(e,n){"use strict";function t(e,n){return"matches"in e?e.matches(n):"msMatchesSelector"in e?e.msMatchesSelector(n):e.webkitMatchesSelector(n)}function r(e){return"object"==typeof e&&null!=e}function o(e,n){return-1===n?e:[].concat(e.slice(0,n),e.slice(n+1))}var u="input, select, textarea, a[href], button, [tabindex], audio[controls], video[controls], [contenteditable]:not([contenteditable=false])";function i(e){return e instanceof HTMLElement}function a(e){return e.hasAttribute("tabindex")}function f(e){if(!i(e))return!1;if(function e(n){return!(!n.parentElement||!e(n.parentElement))||n.hidden}(e))return!1;if(function(e){return Boolean(e.disabled)}(e))return!1;var n=e.localName;if(["input","select","textarea","button"].indexOf(n)>=0)return!0;var t={a:function(){return e.hasAttribute("href")},audio:function(){return e.hasAttribute("controls")},video:function(){return e.hasAttribute("controls")}};return n in t?t[n]():!!function(e){var n=e.getAttribute("contenteditable");return"false"!==n&&null!=n}(e)||a(e)}function c(e){return i(e)&&f(e)&&!function(e){return a(e)&&e.tabIndex<0}(e)}function l(e){var n=Array.from(e.querySelectorAll(u));return n.unshift(e),n.filter(f)}function s(e,n){var t=Array.from(e.querySelectorAll(u)),r=t.filter(c);return c(e)&&r.unshift(e),!r.length&&n?t:r}function v(e,n){var t=l(e),r=t.indexOf(document.activeElement),o=t.slice(r+1);return o.find(c)||t.find(c)||(n?o[0]:null)}function d(e,n){var t=l(e).reverse(),r=t.indexOf(document.activeElement),o=t.slice(r+1);return o.find(c)||t.find(c)||(n?o[0]:null)}function b(e){return document.activeElement===e}var y="id-",m=n.createContext(function(e){return void 0===e&&(e=y),""+e+Math.random().toString(32).substr(2,6)});e.IdProvider=function(e){var t=e.children,r=e.unstable_prefix,o=void 0===r?"":r,u=n.useRef(0),i=n.useMemo(function(){return function(e){return void 0===e&&(e=y),""+o+e+ ++u.current}},[o]);return n.createElement(m.Provider,{value:i},t)},e.closest=function(e,n){if("closest"in e)return e.closest(n);do{if(t(e,n))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null},e.createOnKeyDown=function(e){var n=void 0===e?{}:e,t=n.keyMap,r=n.onKey,o=n.stopPropagation,u=n.onKeyDown,i=n.shouldKeyDown,a=void 0===i?function(){return!0}:i,f=n.preventDefault,c=void 0===f||f;return function(e){if(t){var n="function"==typeof t?t(e):t,i="function"==typeof c?c(e):c,f="function"==typeof o?o(e):o;if(e.key in n){var l=n[e.key];if("function"==typeof l&&a(e))return i&&e.preventDefault(),f&&e.stopPropagation(),r&&r(e),void l(e)}u&&u(e)}}},e.cx=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return n.filter(Boolean).join(" ")||void 0},e.ensureFocus=function(e,n){var t=void 0===n?{}:n,r=t.isActive,o=void 0===r?b:r,u=t.preventScroll;return o(e)?-1:(e.focus({preventScroll:u}),o(e)?-1:requestAnimationFrame(function(){e.focus({preventScroll:u})}))},e.focusNextTabbableIn=function(e,n){var t=v(e,n);t&&i(t)&&t.focus()},e.focusPreviousTabbableIn=function(e,n){var t=d(e,n);t&&i(t)&&t.focus()},e.getAllFocusableIn=l,e.getAllTabbableIn=s,e.getFirstFocusableIn=function(e){var n=l(e);return n.length?n[0]:null},e.getFirstTabbableIn=function(e,n){return s(e,n)[0]||null},e.getLastTabbableIn=function(e,n){var t=s(e,n);return t[t.length-1]||null},e.getNextTabbableIn=v,e.getPreviousTabbableIn=d,e.hasFocusWithin=function(e){return!!document.activeElement&&e.contains(document.activeElement)},e.isEmpty=function(e){return Array.isArray(e)?!e.length:r(e)?!Object.keys(e).length:null==e||""===e},e.isFocusable=f,e.isInteger=function(e){return"number"==typeof e?Math.floor(e)===e:String(Math.floor(Number(e)))===e},e.isObject=r,e.isPromise=function(e){return Boolean(e&&e.then)},e.isTabbable=c,e.mergeRefs=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r=n.filter(Boolean);return r.length?1===r.length?r[0]:function(e){var n=r,t=Array.isArray(n),o=0;for(n=t?n:n[Symbol.iterator]();;){var u;if(t){if(o>=n.length)break;u=n[o++]}else{if((o=n.next()).done)break;u=o.value}var i=u;"function"==typeof i?i(e):i&&(i.current=e)}}:null},e.omit=function(e,n){for(var t=Object.keys(e),r={},o=0;o<t.length;o+=1){var u=t[o];-1===n.indexOf(u)&&(r[u]=e[u])}return r},e.pick=function(e,n){for(var t=Object.keys(e),r={},o=0;o<t.length;o+=1){var u=t[o];n.indexOf(u)>=0&&(r[u]=e[u])}return r},e.removeIndexFromArray=o,e.removeItemFromArray=function(e,n){var t=e.indexOf(n);return o(e,t)},e.splitProps=function(e,n){for(var t={},r={},o=0,u=Object.keys(e);o<u.length;o++){var i=u[o];n.indexOf(i)>=0?t[i]=e[i]:r[i]=e[i]}return[t,r]},e.toArray=function(e){return Array.isArray(e)?e:void 0!==e?[e]:[]},e.useAllCallbacks=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.useCallback(function(){var e=t.filter(Boolean),n=e,r=Array.isArray(n),o=0;for(n=r?n:n[Symbol.iterator]();;){var u;if(r){if(o>=n.length)break;u=n[o++]}else{if((o=n.next()).done)break;u=o.value}var i=u;i.apply(void 0,arguments)}},t)},e.useId=function(e){void 0===e&&(e=y);var t=n.useContext(m);return n.useState(function(){return t(e)})[0]},e.useLiveRef=function(e){var t=n.useRef(e);return n.useEffect(function(){t.current=e}),t},e.usePipe=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.useCallback(function(e){return t.filter(Boolean).reduce(function(e,n){return n(e)},e)},t)},e.useSealedState=function(e){return n.useState(e)[0]},e.useUpdateEffect=function(e,t){var r=n.useRef(!1);n.useEffect(function(){if(r.current)return e();r.current=!0},t)},e.warning=function(e,n){},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],n):n((e=e||self).ReakitUtils={},e.React)}(this,function(e,n){"use strict";function t(e,n){return"matches"in e?e.matches(n):"msMatchesSelector"in e?e.msMatchesSelector(n):e.webkitMatchesSelector(n)}function r(e){return"object"==typeof e&&null!=e}function o(e,n){return-1===n?e:[].concat(e.slice(0,n),e.slice(n+1))}var u="input, select, textarea, a[href], button, [tabindex], audio[controls], video[controls], [contenteditable]:not([contenteditable=false])";function i(e){return e instanceof HTMLElement}function a(e){return e.hasAttribute("tabindex")}function f(e){if(!i(e))return!1;if(function e(n){return!(!n.parentElement||!e(n.parentElement))||n.hidden}(e))return!1;if(function(e){return Boolean(e.disabled)}(e))return!1;var n=e.localName;if(["input","select","textarea","button"].indexOf(n)>=0)return!0;var t={a:function(){return e.hasAttribute("href")},audio:function(){return e.hasAttribute("controls")},video:function(){return e.hasAttribute("controls")}};return n in t?t[n]():!!function(e){var n=e.getAttribute("contenteditable");return"false"!==n&&null!=n}(e)||a(e)}function c(e){return i(e)&&f(e)&&!function(e){return a(e)&&e.tabIndex<0}(e)}function l(e){var n=Array.from(e.querySelectorAll(u));return n.unshift(e),n.filter(f)}function s(e,n){var t=Array.from(e.querySelectorAll(u)),r=t.filter(c);return c(e)&&r.unshift(e),!r.length&&n?t:r}function v(e,n){var t=l(e),r=t.indexOf(document.activeElement),o=t.slice(r+1);return o.find(c)||t.find(c)||(n?o[0]:null)}function d(e,n){var t=l(e).reverse(),r=t.indexOf(document.activeElement),o=t.slice(r+1);return o.find(c)||t.find(c)||(n?o[0]:null)}function b(e){return document.activeElement===e}var y="id-",m=n.createContext(function(e){return void 0===e&&(e=y),""+e+Math.random().toString(32).substr(2,6)});e.IdProvider=function(e){var t=e.children,r=e.unstable_prefix,o=void 0===r?"":r,u=n.useRef(0),i=n.useMemo(function(){return function(e){return void 0===e&&(e=y),""+o+e+ ++u.current}},[o]);return n.createElement(m.Provider,{value:i},t)},e.closest=function(e,n){if("closest"in e)return e.closest(n);do{if(t(e,n))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null},e.createOnKeyDown=function(e){var n=void 0===e?{}:e,t=n.keyMap,r=n.onKey,o=n.stopPropagation,u=n.onKeyDown,i=n.shouldKeyDown,a=void 0===i?function(){return!0}:i,f=n.preventDefault,c=void 0===f||f;return function(e){if(t){var n="function"==typeof t?t(e):t,i="function"==typeof c?c(e):c,f="function"==typeof o?o(e):o;if(e.key in n){var l=n[e.key];if("function"==typeof l&&a(e))return i&&e.preventDefault(),f&&e.stopPropagation(),r&&r(e),void l(e)}u&&u(e)}}},e.cx=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return n.filter(Boolean).join(" ")||void 0},e.ensureFocus=function(e,n){var t=void 0===n?{}:n,r=t.isActive,o=void 0===r?b:r,u=t.preventScroll;return o(e)?-1:(e.focus({preventScroll:u}),o(e)?-1:requestAnimationFrame(function(){e.focus({preventScroll:u})}))},e.focusNextTabbableIn=function(e,n){var t=v(e,n);t&&i(t)&&t.focus()},e.focusPreviousTabbableIn=function(e,n){var t=d(e,n);t&&i(t)&&t.focus()},e.getAllFocusableIn=l,e.getAllTabbableIn=s,e.getFirstFocusableIn=function(e){var n=l(e);return n.length?n[0]:null},e.getFirstTabbableIn=function(e,n){return s(e,n)[0]||null},e.getLastTabbableIn=function(e,n){var t=s(e,n);return t[t.length-1]||null},e.getNextTabbableIn=v,e.getPreviousTabbableIn=d,e.hasFocusWithin=function(e){return!!document.activeElement&&e.contains(document.activeElement)},e.isEmpty=function(e){return Array.isArray(e)?!e.length:r(e)?!Object.keys(e).length:null==e||""===e},e.isFocusable=f,e.isInteger=function(e){return"number"==typeof e?Math.floor(e)===e:String(Math.floor(Number(e)))===e},e.isObject=r,e.isPromise=function(e){return Boolean(e&&e.then)},e.isTabbable=c,e.mergeRefs=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r=n.filter(Boolean);return r.length?1===r.length?r[0]:function(e){var n=r,t=Array.isArray(n),o=0;for(n=t?n:n[Symbol.iterator]();;){var u;if(t){if(o>=n.length)break;u=n[o++]}else{if((o=n.next()).done)break;u=o.value}var i=u;"function"==typeof i?i(e):i&&(i.current=e)}}:null},e.omit=function(e,n){for(var t=Object.keys(e),r={},o=0;o<t.length;o+=1){var u=t[o];-1===n.indexOf(u)&&(r[u]=e[u])}return r},e.pick=function(e,n){for(var t=Object.keys(e),r={},o=0;o<t.length;o+=1){var u=t[o];n.indexOf(u)>=0&&(r[u]=e[u])}return r},e.removeIndexFromArray=o,e.removeItemFromArray=function(e,n){var t=e.indexOf(n);return o(e,t)},e.splitProps=function(e,n){for(var t={},r={},o=0,u=Object.keys(e);o<u.length;o++){var i=u[o];n.indexOf(i)>=0?t[i]=e[i]:r[i]=e[i]}return[t,r]},e.toArray=function(e){return Array.isArray(e)?e:void 0!==e?[e]:[]},e.useAllCallbacks=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.useCallback(function(){var e=t.filter(Boolean),n=e,r=Array.isArray(n),o=0;for(n=r?n:n[Symbol.iterator]();;){var u;if(r){if(o>=n.length)break;u=n[o++]}else{if((o=n.next()).done)break;u=o.value}var i=u;i.apply(void 0,arguments)}},t)},e.useId=function(e){void 0===e&&(e=y);var t=n.useContext(m);return n.useState(function(){return t(e)})[0]},e.useLiveRef=function(e){var t=n.useRef(e);return n.useEffect(function(){t.current=e}),t},e.usePipe=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.useCallback(function(e){return t.filter(Boolean).reduce(function(e,n){return n(e)},e)},t)},e.useSealedState=function(e){return n.useState(e)[0]},e.useUpdateEffect=function(e,t){var r=n.useRef(!1);n.useEffect(function(){if(r.current)return e();r.current=!0},t)},e.warning=function(e){},Object.defineProperty(e,"__esModule",{value:!0})}); |
var isProduction = process.env.NODE_ENV === "production"; | ||
function warning(condition, label) { | ||
function warning(condition) { | ||
if (!isProduction) { | ||
if (!condition) return; | ||
var finalLabel = label ? "[reakit/" + label + "]\n" : "[reakit]\n"; | ||
for (var _len = arguments.length, messages = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { | ||
messages[_key - 2] = arguments[_key]; | ||
for (var _len = arguments.length, messages = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
messages[_key - 1] = arguments[_key]; | ||
} | ||
var text = "" + finalLabel + messages.join("\n\n"); // eslint-disable-next-line no-console | ||
var text = messages.join("\n"); // eslint-disable-next-line no-console | ||
@@ -13,0 +12,0 @@ console.warn(text); // Throwing an error and catching it immediately to improve debugging |
@@ -6,12 +6,11 @@ 'use strict'; | ||
var isProduction = process.env.NODE_ENV === "production"; | ||
function warning(condition, label) { | ||
function warning(condition) { | ||
if (!isProduction) { | ||
if (!condition) return; | ||
var finalLabel = label ? "[reakit/" + label + "]\n" : "[reakit]\n"; | ||
for (var _len = arguments.length, messages = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { | ||
messages[_key - 2] = arguments[_key]; | ||
for (var _len = arguments.length, messages = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
messages[_key - 1] = arguments[_key]; | ||
} | ||
var text = "" + finalLabel + messages.join("\n\n"); // eslint-disable-next-line no-console | ||
var text = messages.join("\n"); // eslint-disable-next-line no-console | ||
@@ -18,0 +17,0 @@ console.warn(text); // Throwing an error and catching it immediately to improve debugging |
{ | ||
"name": "reakit-utils", | ||
"version": "0.6.7", | ||
"version": "0.7.0", | ||
"description": "Reakit utils", | ||
@@ -37,3 +37,3 @@ "sideEffects": false, | ||
}, | ||
"gitHead": "3c6befa1642a77c6881c6c84a1d54842c9abd6f4" | ||
"gitHead": "3a989a72b6161b69e40207bda5436da117554c0b" | ||
} |
const isProduction = process.env.NODE_ENV === "production"; | ||
export function warning( | ||
condition: boolean, | ||
label?: string, | ||
...messages: string[] | ||
) { | ||
export function warning(condition: boolean, ...messages: string[]) { | ||
if (!isProduction) { | ||
if (!condition) return; | ||
const finalLabel = label ? `[reakit/${label}]\n` : "[reakit]\n"; | ||
const text = `${finalLabel}${messages.join("\n\n")}`; | ||
const text = messages.join("\n"); | ||
@@ -14,0 +9,0 @@ // eslint-disable-next-line no-console |
@@ -1,1 +0,1 @@ | ||
export declare function warning(condition: boolean, label?: string, ...messages: string[]): void; | ||
export declare function warning(condition: boolean, ...messages: string[]): void; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
276412
174
2032