@committed/hooks
Advanced tools
Comparing version 0.5.0 to 0.6.0
@@ -46,3 +46,58 @@ 'use strict'; | ||
/** type guard to check if value or function */ | ||
function isValue(arg) { | ||
return typeof arg !== 'function'; | ||
} | ||
/** no operation */ | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
function noop() {} | ||
/** | ||
* useControllableState hook for when the state may be controlled or uncontrolled. | ||
* | ||
* Returns as the standard useState hook, but has additional props of a controlled value and a controlled change handler. | ||
* Set these using the components incoming props for the state, if defined they will be used, if not you get the standard useState behaviour. | ||
* | ||
* @param {T | undefined} value The controlled value (of type T) or undefined for an uncontrolled value | ||
* @param {React.Dispatch<React.SetStateAction<T>> | undefined} setValue The dispatch handler for state changes or undefined for when an uncontrolled value, ignored if uncontrolled | ||
* @param {T | (() => T | undefined) | undefined} initialState The initial state value, or state initializer for when uncontrolled, ignored if controlled | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
function useControllableState(value, setValue, initialState) { | ||
var _useRef = React.useRef(value !== undefined), | ||
wasControlled = _useRef.current; | ||
var isControlled = value !== undefined; | ||
var _useState = React.useState(function () { | ||
if (value === undefined) { | ||
if (initialState !== undefined) { | ||
return isValue(initialState) ? initialState : initialState(); | ||
} | ||
} | ||
return undefined; | ||
}), | ||
uncontrolled = _useState[0], | ||
setUncontrolled = _useState[1]; | ||
var effect = noop; | ||
{ | ||
effect = function effect() { | ||
if (wasControlled !== isControlled) { | ||
console.warn('Components should not switch from uncontrolled to controlled (or vice versa)'); | ||
} | ||
}; | ||
} | ||
React.useEffect(effect, [effect, isControlled]); | ||
return [wasControlled ? value : uncontrolled, wasControlled ? setValue : setUncontrolled]; | ||
} | ||
/** | ||
* Debounce the update to a value. | ||
@@ -777,57 +832,2 @@ * | ||
/** type guard to check if value or function */ | ||
function isValue(arg) { | ||
return typeof arg !== 'function'; | ||
} | ||
/** no operation */ | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
function noop() {} | ||
/** | ||
* useControllableState hook for when the state may be controlled or uncontrolled. | ||
* | ||
* Returns as the standard useState hook, but has additional props of a controlled value and a controlled change handler. | ||
* Set these using the components incoming props for the state, if defined they will be used, if not you get the standard useState behaviour. | ||
* | ||
* @param {T | undefined} value The controlled value (of type T) or undefined for an uncontrolled value | ||
* @param {React.Dispatch<React.SetStateAction<T>> | undefined} setValue The dispatch handler for state changes or undefined for when an uncontrolled value, ignored if uncontrolled | ||
* @param {T | (() => T | undefined) | undefined} initialState The initial state value, or state initializer for when uncontrolled, ignored if controlled | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
function useControllableState(value, setValue, initialState) { | ||
var _useRef = React.useRef(value !== undefined), | ||
wasControlled = _useRef.current; | ||
var isControlled = value !== undefined; | ||
var _useState = React.useState(function () { | ||
if (value === undefined) { | ||
if (initialState !== undefined) { | ||
return isValue(initialState) ? initialState : initialState(); | ||
} | ||
} | ||
return undefined; | ||
}), | ||
uncontrolled = _useState[0], | ||
setUncontrolled = _useState[1]; | ||
var effect = noop; | ||
{ | ||
effect = function effect() { | ||
if (wasControlled !== isControlled) { | ||
console.warn('Components should not switch from uncontrolled to controlled (or vice versa)'); | ||
} | ||
}; | ||
} | ||
React.useEffect(effect, [isControlled]); | ||
return [wasControlled ? value : uncontrolled, wasControlled ? setValue : setUncontrolled]; | ||
} | ||
exports.KEYBOARD_MODIFIERS = KEYBOARD_MODIFIERS; | ||
@@ -834,0 +834,0 @@ exports.useBoolean = useBoolean; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e;function r(e,n,r,u){var o=t.useRef();t.useEffect((function(){o.current=n}),[n]),t.useEffect((function(){var t;if(!0!==u){var n=null!=(t=null==r?void 0:r.current)?t:window;return n.addEventListener(e,c),function(){n.removeEventListener(e,c)}}function c(e){var t=o.current;null!=t&&t(e)}}),[e,r])}var u={gif:"image/gif",ico:"image/x-icon",jpeg:"image/jpeg",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml"};function o(e){var t=e.querySelector("link[rel*='icon']");return null!==t?{type:t.getAttribute("type"),href:t.getAttribute("href")}:null}function c(e,t){if(null===t||null===t.href||null===t.type){var n;null==(n=e.querySelector("link[rel*='icon']"))||n.remove()}else{var r,u=null!=(r=e.querySelector("link[rel*='icon']"))?r:e.createElement("link");u.type=t.type,u.href=t.href,u.rel="shortcut icon",e.getElementsByTagName("head")[0].appendChild(u)}}var i=["Alt","Control","Meta","OS","Shift"],f={alt:"Alt",ctrl:"Control",control:"Control",shift:"Shift",meta:"Meta",option:"Alt"},a={plus:"+",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",space:" ",esc:"Escape"};function l(e,t){return""===e?function(){return!0}:function(n){if(t.ignoreRepeat&&n.repeat)return!1;var r=e.split("+").filter((function(e){return e.length>0}));return r.length===function(e){var t=0;return i.forEach((function(n){e.getModifierState(n)&&t++})),i.includes(e.key)||t++,t}(n)&&r.every((function(e){var r,u=null!=(r=f[e.toLowerCase()])?r:e;return!!n.getModifierState(u)||n.key===e||n.key===a[e.toLowerCase()]||n.key.length>1&&n.key.toLowerCase()===e.toLowerCase()||n.code===e||!t.ignoreKey&&n.code==="Key"+e.toUpperCase()}))}}function s(e){return"function"==typeof e}function v(){}exports.KEYBOARD_MODIFIERS=i,exports.useBoolean=function(e){void 0===e&&(e=!1);var r=t.useState(e),u=r[1];return[r[0],n.useMemo((function(){return{toggle:function(){return u((function(e){return!e}))},setTrue:function(){return u(!0)},setFalse:function(){return u(!1)}}}),[u])]},exports.useControllableState=function(e,n,r){var u=t.useRef(void 0!==e).current,o=void 0!==e,c=t.useState((function(){if(void 0===e&&void 0!==r)return"function"!=typeof r?r:r()})),i=c[0],f=c[1];return t.useEffect(v,[o]),[u?e:i,u?n:f]},exports.useDebounce=function(e,n){var r=t.useState(e),u=r[0],o=r[1];return t.useEffect((function(){if(null!==n){var t=setTimeout((function(){o(e)}),n);return function(){clearTimeout(t)}}o(e)}),[e,n]),[u,function(){return o(e)}]},exports.useDebug=function(e,n,r){void 0===n&&(n={}),void 0===r&&(r={}),t.useRef(n),t.useRef(r),t.useEffect((function(){}))},exports.useEventListener=r,exports.useFavicon=function(e,n){void 0===n&&(n={});var r=t.useRef(o(document)),i=n.retain,f=void 0!==i&&i;t.useLayoutEffect((function(){return r.current=o(document),f?void 0:function(){c(document,r.current)}}),[f]),t.useLayoutEffect((function(){var t,n=e.toLowerCase().split(".").pop();void 0!==(t=n)&&Object.keys(u).includes(t)&&c(document,{type:u[n],href:e})}),[e])},exports.useHover=function(e){var n=t.useState(!1),u=n[0],o=n[1];return r("mouseover",(function(){return o(!0)}),e),r("mouseout",(function(){return o(!1)}),e),[u]},exports.useInterval=function(e,n){var r=t.useRef();t.useEffect((function(){r.current=e}),[e]),t.useEffect((function(){if(null!==n){var e=setInterval((function(){var e=r.current;null!=e&&e()}),n);return function(){return clearInterval(e)}}}),[n])},exports.useKeyboard=function(e,n,u){void 0===u&&(u={});var o=t.useRef();t.useEffect((function(){o.current=n}),[n]);var c=u.element,i=u.event,f=void 0===i?"keydown":i,a=u.development,s=u.ignoreKey,v=void 0!==s&&s,d=u.ignoreRepeat,p=void 0!==d&&d,g=t.useMemo((function(){var t={ignoreKey:v,ignoreRepeat:p};return"function"==typeof e?e:function(e){return Array.isArray(e)}(e)?function(n){return e.map((function(e){return l(e,t)})).some((function(e){return e(n)}))}:l(e,t)}),[e,v,p]);r(f,t.useCallback((function(e){null!=o.current&&g(e)&&o.current(e)}),[g]),c,a)},exports.useLocalState=function(e,t,r){var u=void 0===r?{serialize:JSON.stringify,deserialize:JSON.parse}:r,o=u.serialize,c=u.deserialize,i=n.useState((function(){var n=window.localStorage.getItem(e);if(null!=n)try{return c(n)}catch(t){window.localStorage.removeItem(e)}return function(e){return"function"==typeof e}(t)?t():t})),f=i[0],a=i[1],l=n.useRef(e);n.useEffect((function(){var t=l.current;t!==e&&window.localStorage.removeItem(t),l.current=e,null==f?window.localStorage.removeItem(e):window.localStorage.setItem(e,o(f))}),[e,f,o]);var s=n.useCallback((function(){window.localStorage.removeItem(e)}),[e]);return[f,a,s]},exports.usePoll=function(e,n){var r=t.useRef();t.useEffect((function(){r.current=e}),[e]),t.useEffect((function(){var e=null;function t(){null!==n&&(e=setTimeout(u,n))}function u(){var e=function(){var e=r.current,t=void 0;return null!=e&&(t=e()),t}();e instanceof Promise?e.then(t):t()}return u(),function(){e&&clearTimeout(e),e=null}}),[n])},exports.useTimeout=function(e,n){var r=t.useRef();t.useEffect((function(){r.current=e}),[e]),t.useEffect((function(){if(null!==n){var e=setTimeout((function(){var e=r.current;null!=e&&e()}),n);return function(){return clearTimeout(e)}}}),[n])},exports.useTitle=function(e,n){void 0===n&&(n={});var r=n.append,u=void 0!==r&&r,o=n.retain,c=void 0!==o&&o,i=n.separator,f=void 0===i?"":i,a=t.useRef(document.title);t.useLayoutEffect((function(){return a.current=document.title,c?void 0:function(){document.title=a.current}}),[c]),t.useLayoutEffect((function(){document.title=u?a.current+f+e:e}),[e,f,u])},exports.useTrackedState=function(e){var n,r=t.useState({current:(n=e,"function"==typeof n?e():e),undoStack:[],redoStack:[]}),u=r[0],o=r[1],c=t.useCallback((function(){o((function(e){if(0===e.undoStack.length)return e;var t=e.current,n=e.undoStack,r=e.redoStack;return{current:n[n.length-1],undoStack:n.slice(0,n.length-1),redoStack:[].concat(r,[t])}}))}),[]),i=t.useCallback((function(){o((function(e){if(0===e.redoStack.length)return e;var t=e.redoStack;return{current:t[t.length-1],undoStack:[].concat(e.undoStack,[e.current]),redoStack:t.slice(0,t.length-1)}}))}),[]),f=t.useCallback((function(e){o((function(t){var n=t.current,r=t.undoStack;return{current:s(e)?e(n):e,undoStack:[].concat(r,[n]),redoStack:[]}}))}),[]);return[u.current,f,{undo:c,redo:i,canUndo:u.undoStack.length>0,canRedo:u.redoStack.length>0}]}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e;function r(){}function u(e,n,r,u){var o=t.useRef();t.useEffect((function(){o.current=n}),[n]),t.useEffect((function(){var t;if(!0!==u){var n=null!=(t=null==r?void 0:r.current)?t:window;return n.addEventListener(e,c),function(){n.removeEventListener(e,c)}}function c(e){var t=o.current;null!=t&&t(e)}}),[e,r])}var o={gif:"image/gif",ico:"image/x-icon",jpeg:"image/jpeg",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml"};function c(e){var t=e.querySelector("link[rel*='icon']");return null!==t?{type:t.getAttribute("type"),href:t.getAttribute("href")}:null}function i(e,t){if(null===t||null===t.href||null===t.type){var n;null==(n=e.querySelector("link[rel*='icon']"))||n.remove()}else{var r,u=null!=(r=e.querySelector("link[rel*='icon']"))?r:e.createElement("link");u.type=t.type,u.href=t.href,u.rel="shortcut icon",e.getElementsByTagName("head")[0].appendChild(u)}}var f=["Alt","Control","Meta","OS","Shift"],a={alt:"Alt",ctrl:"Control",control:"Control",shift:"Shift",meta:"Meta",option:"Alt"},l={plus:"+",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",space:" ",esc:"Escape"};function s(e,t){return""===e?function(){return!0}:function(n){if(t.ignoreRepeat&&n.repeat)return!1;var r=e.split("+").filter((function(e){return e.length>0}));return r.length===function(e){var t=0;return f.forEach((function(n){e.getModifierState(n)&&t++})),f.includes(e.key)||t++,t}(n)&&r.every((function(e){var r,u=null!=(r=a[e.toLowerCase()])?r:e;return!!n.getModifierState(u)||n.key===e||n.key===l[e.toLowerCase()]||n.key.length>1&&n.key.toLowerCase()===e.toLowerCase()||n.code===e||!t.ignoreKey&&n.code==="Key"+e.toUpperCase()}))}}function v(e){return"function"==typeof e}exports.KEYBOARD_MODIFIERS=f,exports.useBoolean=function(e){void 0===e&&(e=!1);var r=t.useState(e),u=r[1];return[r[0],n.useMemo((function(){return{toggle:function(){return u((function(e){return!e}))},setTrue:function(){return u(!0)},setFalse:function(){return u(!1)}}}),[u])]},exports.useControllableState=function(e,n,u){var o=t.useRef(void 0!==e).current,c=void 0!==e,i=t.useState((function(){if(void 0===e&&void 0!==u)return"function"!=typeof u?u:u()})),f=i[0],a=i[1];return t.useEffect(r,[r,c]),[o?e:f,o?n:a]},exports.useDebounce=function(e,n){var r=t.useState(e),u=r[0],o=r[1];return t.useEffect((function(){if(null!==n){var t=setTimeout((function(){o(e)}),n);return function(){clearTimeout(t)}}o(e)}),[e,n]),[u,function(){return o(e)}]},exports.useDebug=function(e,n,r){void 0===n&&(n={}),void 0===r&&(r={}),t.useRef(n),t.useRef(r),t.useEffect((function(){}))},exports.useEventListener=u,exports.useFavicon=function(e,n){void 0===n&&(n={});var r=t.useRef(c(document)),u=n.retain,f=void 0!==u&&u;t.useLayoutEffect((function(){return r.current=c(document),f?void 0:function(){i(document,r.current)}}),[f]),t.useLayoutEffect((function(){var t,n=e.toLowerCase().split(".").pop();void 0!==(t=n)&&Object.keys(o).includes(t)&&i(document,{type:o[n],href:e})}),[e])},exports.useHover=function(e){var n=t.useState(!1),r=n[0],o=n[1];return u("mouseover",(function(){return o(!0)}),e),u("mouseout",(function(){return o(!1)}),e),[r]},exports.useInterval=function(e,n){var r=t.useRef();t.useEffect((function(){r.current=e}),[e]),t.useEffect((function(){if(null!==n){var e=setInterval((function(){var e=r.current;null!=e&&e()}),n);return function(){return clearInterval(e)}}}),[n])},exports.useKeyboard=function(e,n,r){void 0===r&&(r={});var o=t.useRef();t.useEffect((function(){o.current=n}),[n]);var c=r.element,i=r.event,f=void 0===i?"keydown":i,a=r.development,l=r.ignoreKey,v=void 0!==l&&l,d=r.ignoreRepeat,p=void 0!==d&&d,g=t.useMemo((function(){var t={ignoreKey:v,ignoreRepeat:p};return"function"==typeof e?e:function(e){return Array.isArray(e)}(e)?function(n){return e.map((function(e){return s(e,t)})).some((function(e){return e(n)}))}:s(e,t)}),[e,v,p]);u(f,t.useCallback((function(e){null!=o.current&&g(e)&&o.current(e)}),[g]),c,a)},exports.useLocalState=function(e,t,r){var u=void 0===r?{serialize:JSON.stringify,deserialize:JSON.parse}:r,o=u.serialize,c=u.deserialize,i=n.useState((function(){var n=window.localStorage.getItem(e);if(null!=n)try{return c(n)}catch(t){window.localStorage.removeItem(e)}return function(e){return"function"==typeof e}(t)?t():t})),f=i[0],a=i[1],l=n.useRef(e);n.useEffect((function(){var t=l.current;t!==e&&window.localStorage.removeItem(t),l.current=e,null==f?window.localStorage.removeItem(e):window.localStorage.setItem(e,o(f))}),[e,f,o]);var s=n.useCallback((function(){window.localStorage.removeItem(e)}),[e]);return[f,a,s]},exports.usePoll=function(e,n){var r=t.useRef();t.useEffect((function(){r.current=e}),[e]),t.useEffect((function(){var e=null;function t(){null!==n&&(e=setTimeout(u,n))}function u(){var e=function(){var e=r.current,t=void 0;return null!=e&&(t=e()),t}();e instanceof Promise?e.then(t):t()}return u(),function(){e&&clearTimeout(e),e=null}}),[n])},exports.useTimeout=function(e,n){var r=t.useRef();t.useEffect((function(){r.current=e}),[e]),t.useEffect((function(){if(null!==n){var e=setTimeout((function(){var e=r.current;null!=e&&e()}),n);return function(){return clearTimeout(e)}}}),[n])},exports.useTitle=function(e,n){void 0===n&&(n={});var r=n.append,u=void 0!==r&&r,o=n.retain,c=void 0!==o&&o,i=n.separator,f=void 0===i?"":i,a=t.useRef(document.title);t.useLayoutEffect((function(){return a.current=document.title,c?void 0:function(){document.title=a.current}}),[c]),t.useLayoutEffect((function(){document.title=u?a.current+f+e:e}),[e,f,u])},exports.useTrackedState=function(e){var n,r=t.useState({current:(n=e,"function"==typeof n?e():e),undoStack:[],redoStack:[]}),u=r[0],o=r[1],c=t.useCallback((function(){o((function(e){if(0===e.undoStack.length)return e;var t=e.current,n=e.undoStack,r=e.redoStack;return{current:n[n.length-1],undoStack:n.slice(0,n.length-1),redoStack:[].concat(r,[t])}}))}),[]),i=t.useCallback((function(){o((function(e){if(0===e.redoStack.length)return e;var t=e.redoStack;return{current:t[t.length-1],undoStack:[].concat(e.undoStack,[e.current]),redoStack:t.slice(0,t.length-1)}}))}),[]),f=t.useCallback((function(e){o((function(t){var n=t.current,r=t.undoStack;return{current:v(e)?e(n):e,undoStack:[].concat(r,[n]),redoStack:[]}}))}),[]);return[u.current,f,{undo:c,redo:i,canUndo:u.undoStack.length>0,canRedo:u.redoStack.length>0}]}; | ||
//# sourceMappingURL=hooks.cjs.production.min.js.map |
@@ -1,2 +0,2 @@ | ||
import React, { useState, useEffect, useRef, useLayoutEffect, useMemo, useCallback } from 'react'; | ||
import React, { useState, useRef, useEffect, useLayoutEffect, useMemo, useCallback } from 'react'; | ||
@@ -39,3 +39,58 @@ /** | ||
/** type guard to check if value or function */ | ||
function isValue(arg) { | ||
return typeof arg !== 'function'; | ||
} | ||
/** no operation */ | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
function noop() {} | ||
/** | ||
* useControllableState hook for when the state may be controlled or uncontrolled. | ||
* | ||
* Returns as the standard useState hook, but has additional props of a controlled value and a controlled change handler. | ||
* Set these using the components incoming props for the state, if defined they will be used, if not you get the standard useState behaviour. | ||
* | ||
* @param {T | undefined} value The controlled value (of type T) or undefined for an uncontrolled value | ||
* @param {React.Dispatch<React.SetStateAction<T>> | undefined} setValue The dispatch handler for state changes or undefined for when an uncontrolled value, ignored if uncontrolled | ||
* @param {T | (() => T | undefined) | undefined} initialState The initial state value, or state initializer for when uncontrolled, ignored if controlled | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
function useControllableState(value, setValue, initialState) { | ||
var _useRef = useRef(value !== undefined), | ||
wasControlled = _useRef.current; | ||
var isControlled = value !== undefined; | ||
var _useState = useState(function () { | ||
if (value === undefined) { | ||
if (initialState !== undefined) { | ||
return isValue(initialState) ? initialState : initialState(); | ||
} | ||
} | ||
return undefined; | ||
}), | ||
uncontrolled = _useState[0], | ||
setUncontrolled = _useState[1]; | ||
var effect = noop; | ||
if (process.env.NODE_ENV !== 'production') { | ||
effect = function effect() { | ||
if (wasControlled !== isControlled) { | ||
console.warn('Components should not switch from uncontrolled to controlled (or vice versa)'); | ||
} | ||
}; | ||
} | ||
useEffect(effect, [effect, isControlled]); | ||
return [wasControlled ? value : uncontrolled, wasControlled ? setValue : setUncontrolled]; | ||
} | ||
/** | ||
* Debounce the update to a value. | ||
@@ -773,58 +828,3 @@ * | ||
/** type guard to check if value or function */ | ||
function isValue(arg) { | ||
return typeof arg !== 'function'; | ||
} | ||
/** no operation */ | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
function noop() {} | ||
/** | ||
* useControllableState hook for when the state may be controlled or uncontrolled. | ||
* | ||
* Returns as the standard useState hook, but has additional props of a controlled value and a controlled change handler. | ||
* Set these using the components incoming props for the state, if defined they will be used, if not you get the standard useState behaviour. | ||
* | ||
* @param {T | undefined} value The controlled value (of type T) or undefined for an uncontrolled value | ||
* @param {React.Dispatch<React.SetStateAction<T>> | undefined} setValue The dispatch handler for state changes or undefined for when an uncontrolled value, ignored if uncontrolled | ||
* @param {T | (() => T | undefined) | undefined} initialState The initial state value, or state initializer for when uncontrolled, ignored if controlled | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
function useControllableState(value, setValue, initialState) { | ||
var _useRef = useRef(value !== undefined), | ||
wasControlled = _useRef.current; | ||
var isControlled = value !== undefined; | ||
var _useState = useState(function () { | ||
if (value === undefined) { | ||
if (initialState !== undefined) { | ||
return isValue(initialState) ? initialState : initialState(); | ||
} | ||
} | ||
return undefined; | ||
}), | ||
uncontrolled = _useState[0], | ||
setUncontrolled = _useState[1]; | ||
var effect = noop; | ||
if (process.env.NODE_ENV !== 'production') { | ||
effect = function effect() { | ||
if (wasControlled !== isControlled) { | ||
console.warn('Components should not switch from uncontrolled to controlled (or vice versa)'); | ||
} | ||
}; | ||
} | ||
useEffect(effect, [isControlled]); | ||
return [wasControlled ? value : uncontrolled, wasControlled ? setValue : setUncontrolled]; | ||
} | ||
export { KEYBOARD_MODIFIERS, useBoolean, useControllableState, useDebounce, useDebug, useEventListener, useFavicon, useHover, useInterval, useKeyboard, useLocalState, usePoll, useTimeout, useTitle, useTrackedState }; | ||
//# sourceMappingURL=hooks.esm.js.map |
export * from './useBoolean'; | ||
export * from './useControllableState'; | ||
export * from './useDebounce'; | ||
@@ -14,2 +15,1 @@ export * from './useDebug'; | ||
export * from './useTrackedState'; | ||
export * from './useControllableState'; |
{ | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"name": "@committed/hooks", | ||
@@ -22,14 +22,17 @@ "description": "Committed hooks library", | ||
"clean": "shx rm -rf dist", | ||
"commit": "cz", | ||
"start": "tsdx watch", | ||
"build": "tsdx build", | ||
"test": "tsdx test --passWithNoTests", | ||
"test": "tsdx test", | ||
"lint": "tsdx lint", | ||
"prepare": "tsdx build", | ||
"size": "size-limit", | ||
"analyze": "size-limit --why", | ||
"storybook": "start-storybook -p 6006", | ||
"build-storybook": "build-storybook --no-dll", | ||
"storybook": "start-storybook -p 6006 -h 0.0.0.0", | ||
"build-storybook": "build-storybook", | ||
"format": "prettier --write '**/{src,test,stories}/**/{*.js,*.ts,*.tsx,*.json,*.md,*.mdx}'", | ||
"format:check": "prettier --check '**/{src,test,stories}/**/{*.js,*.ts,*.tsx,*.json,*.md,*.mdx}'", | ||
"deploy-storybook": "storybook-to-ghpages", | ||
"generate": "plop --plopfile ./generators/plopfile.js" | ||
"generate": "plop --plopfile ./generators/plopfile.js", | ||
"prepare": "husky install && tsdx build", | ||
"semantic-release": "semantic-release" | ||
}, | ||
@@ -71,12 +74,32 @@ "peerDependencies": { | ||
}, | ||
"release": { | ||
"branches": [ | ||
"main", | ||
{ | ||
"name": "beta", | ||
"prerelease": true | ||
} | ||
] | ||
}, | ||
"commitlint": { | ||
"extends": [ | ||
"@commitlint/config-conventional" | ||
] | ||
}, | ||
"config": { | ||
"commitizen": { | ||
"path": "./node_modules/cz-conventional-changelog" | ||
} | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.12.3", | ||
"@committed/components": "^4.0.0", | ||
"@material-ui/core": "^4.11.0", | ||
"@material-ui/icons": "^4.9.1", | ||
"@material-ui/lab": "^4.0.0-alpha.56", | ||
"@commitlint/cli": "^16.2.3", | ||
"@commitlint/config-conventional": "^16.2.1", | ||
"@committed/components": "^7.0.1", | ||
"@fontsource/dosis": "^4.5.7", | ||
"@fontsource/inter": "^4.5.7", | ||
"@size-limit/preset-small-lib": "^4.6.2", | ||
"@storybook/addon-essentials": "^6.1.14", | ||
"@storybook/react": "^6.1.14", | ||
"@storybook/storybook-deployer": "^2.8.7", | ||
"@storybook/addon-essentials": "^6.4.22", | ||
"@storybook/react": "^6.4.22", | ||
"@storybook/storybook-deployer": "^2.8.11", | ||
"@testing-library/jest-dom": "^5.11.5", | ||
@@ -91,10 +114,15 @@ "@testing-library/react": "^11.1.0", | ||
"babel-loader": "^8.1.0", | ||
"commitizen": "^4.2.4", | ||
"cz-conventional-changelog": "^3.3.0", | ||
"eslint-config-prettier": "^6.14.0", | ||
"eslint-config-react-app": "^6.0.0", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"eslint-plugin-react-hooks": "^4.4.0", | ||
"eslint-plugin-security": "^1.4.0", | ||
"husky": "^4.3.0", | ||
"eslint-plugin-storybook": "^0.5.10", | ||
"husky": "^7.0.4", | ||
"jest-sonar-reporter": "^2.0.0", | ||
"plop": "^2.7.4", | ||
"prettier": "^2.1.2", | ||
"prettier-plugin-organize-imports": "^2.3.4", | ||
"pretty-quick": "^3.1.0", | ||
@@ -107,7 +135,9 @@ "react": "^17.0.1", | ||
"size-limit": "^4.6.2", | ||
"storybook-dark-mode": "^1.0.9", | ||
"swr": "^0.3.8", | ||
"tsdx": "^0.14.1", | ||
"tslib": "^2.0.3", | ||
"typescript": "^4.0.3" | ||
} | ||
"tslib": "^2.3.1", | ||
"typescript": "^4.6.3" | ||
}, | ||
"dependencies": {} | ||
} |
@@ -111,2 +111,2 @@ <h1 align="center">Committed Hooks</h1> | ||
[MIT](/LICENSE) - © Committed Software 2020 <https://committed.io> | ||
[MIT](/LICENSE) - © Committed Software 2020-2022 <https://committed.io> |
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
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
195431
44