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

@tanem/react-nprogress

Package Overview
Dependencies
Maintainers
1
Versions
212
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tanem/react-nprogress - npm Package Compare versions

Comparing version 5.0.15 to 5.0.16

76

dist/react-nprogress.cjs.development.js

@@ -44,14 +44,10 @@ 'use strict';

var pending = [];
var next = function next() {
isRunning = true;
var cb = pending.shift();
if (cb) {
return cb(next);
}
isRunning = false;
};
var clear = function clear() {

@@ -61,6 +57,4 @@ isRunning = false;

};
var enqueue = function enqueue(cb) {
pending.push(cb);
if (!isRunning && pending.length === 1) {

@@ -70,3 +64,2 @@ next();

};
return {

@@ -80,3 +73,2 @@ clear: clear,

var handle;
var cancel = function cancel() {

@@ -87,11 +79,8 @@ if (handle) {

};
var schedule = function schedule(callback, delay) {
var deltaTime;
var start;
var frame = function frame(time) {
start = start || time;
deltaTime = time - start;
if (deltaTime > delay) {

@@ -101,9 +90,6 @@ callback();

}
handle = window.requestAnimationFrame(frame);
};
handle = window.requestAnimationFrame(frame);
};
return {

@@ -117,3 +103,2 @@ cancel: cancel,

var amount = 0;
if (progress >= 0 && progress < 0.2) {

@@ -128,3 +113,2 @@ amount = 0.1;

}
return clamp(progress + amount, 0, 0.994);

@@ -142,7 +126,5 @@ };

};
var useUpdate = function useUpdate() {
var _useState = React.useState(0),
setState = _useState[1];
setState = _useState[1];
return React.useCallback(function () {

@@ -152,5 +134,3 @@ return setState(incrementParameter);

};
var useGetSetState = function useGetSetState(
/* istanbul ignore next */
var useGetSetState = function useGetSetState( /* istanbul ignore next */
initialState) {

@@ -160,3 +140,2 @@ if (initialState === void 0) {

}
var update = useUpdate();

@@ -171,5 +150,5 @@ var state = React.useRef(_extends__default["default"]({}, initialState));

}
Object.assign(state.current, patch);
update(); // eslint-disable-next-line react-hooks/exhaustive-deps
update();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

@@ -180,6 +159,4 @@ return [get, set];

// Hat-tip:
var useFirstMountState = function useFirstMountState() {
var isFirst = React.useRef(true);
if (isFirst.current) {

@@ -189,6 +166,4 @@ isFirst.current = false;

}
return isFirst.current;
};
var useUpdateEffect = function useUpdateEffect(effect, deps) {

@@ -199,4 +174,4 @@ var isFirstMount = useFirstMountState();

return effect();
} // eslint-disable-next-line react-hooks/exhaustive-deps
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, deps);

@@ -206,7 +181,5 @@ };

/* istanbul ignore next */
var noop = function noop() {
return undefined;
};
var initialState = {

@@ -219,15 +192,13 @@ isFinished: true,

var _ref = _temp === void 0 ? {} : _temp,
_ref$animationDuratio = _ref.animationDuration,
animationDuration = _ref$animationDuratio === void 0 ? 200 : _ref$animationDuratio,
_ref$incrementDuratio = _ref.incrementDuration,
incrementDuration = _ref$incrementDuratio === void 0 ? 800 : _ref$incrementDuratio,
_ref$isAnimating = _ref.isAnimating,
isAnimating = _ref$isAnimating === void 0 ? false : _ref$isAnimating,
_ref$minimum = _ref.minimum,
minimum = _ref$minimum === void 0 ? 0.08 : _ref$minimum;
_ref$animationDuratio = _ref.animationDuration,
animationDuration = _ref$animationDuratio === void 0 ? 200 : _ref$animationDuratio,
_ref$incrementDuratio = _ref.incrementDuration,
incrementDuration = _ref$incrementDuratio === void 0 ? 800 : _ref$incrementDuratio,
_ref$isAnimating = _ref.isAnimating,
isAnimating = _ref$isAnimating === void 0 ? false : _ref$isAnimating,
_ref$minimum = _ref.minimum,
minimum = _ref$minimum === void 0 ? 0.08 : _ref$minimum;
var _useGetSetState = useGetSetState(initialState),
get = _useGetSetState[0],
setState = _useGetSetState[1];
get = _useGetSetState[0],
setState = _useGetSetState[1];
var queue = React.useRef(null);

@@ -241,3 +212,2 @@ var timeout = React.useRef(null);

var _timeout$current, _queue$current;
(_timeout$current = timeout.current) == null ? void 0 : _timeout$current.cancel();

@@ -248,8 +218,5 @@ (_queue$current = queue.current) == null ? void 0 : _queue$current.clear();

var _queue$current4;
n = clamp(n, minimum, 1);
if (n === 1) {
var _queue$current2, _queue$current3;
cleanup();

@@ -261,3 +228,2 @@ (_queue$current2 = queue.current) == null ? void 0 : _queue$current2.enqueue(function (next) {

var _timeout$current2;
return (_timeout$current2 = timeout.current) == null ? void 0 : _timeout$current2.schedule(next, animationDuration);

@@ -275,3 +241,2 @@ }

}
(_queue$current4 = queue.current) == null ? void 0 : _queue$current4.enqueue(function (next) {

@@ -283,3 +248,2 @@ setState({

var _timeout$current3;
return (_timeout$current3 = timeout.current) == null ? void 0 : _timeout$current3.schedule(next, animationDuration);

@@ -296,7 +260,5 @@ }

var _queue$current5;
trickle();
(_queue$current5 = queue.current) == null ? void 0 : _queue$current5.enqueue(function (next) {
var _timeout$current4;
(_timeout$current4 = timeout.current) == null ? void 0 : _timeout$current4.schedule(function () {

@@ -308,3 +270,2 @@ work();

};
work();

@@ -321,3 +282,2 @@ }, [incrementDuration, queue, timeout, trickle]);

}
return cleanup;

@@ -347,4 +307,3 @@ });

var children = _ref.children,
restProps = _objectWithoutPropertiesLoose__default["default"](_ref, _excluded);
restProps = _objectWithoutPropertiesLoose__default["default"](_ref, _excluded);
var renderProps = useNProgress(restProps);

@@ -359,3 +318,2 @@ return children(renderProps);

};
hoistNonReactStatics__default["default"](WithNProgress, BaseComponent);

@@ -362,0 +320,0 @@ return WithNProgress;

@@ -16,14 +16,10 @@ import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/objectWithoutPropertiesLoose';

var pending = [];
var next = function next() {
isRunning = true;
var cb = pending.shift();
if (cb) {
return cb(next);
}
isRunning = false;
};
var clear = function clear() {

@@ -33,6 +29,4 @@ isRunning = false;

};
var enqueue = function enqueue(cb) {
pending.push(cb);
if (!isRunning && pending.length === 1) {

@@ -42,3 +36,2 @@ next();

};
return {

@@ -52,3 +45,2 @@ clear: clear,

var handle;
var cancel = function cancel() {

@@ -59,11 +51,8 @@ if (handle) {

};
var schedule = function schedule(callback, delay) {
var deltaTime;
var start;
var frame = function frame(time) {
start = start || time;
deltaTime = time - start;
if (deltaTime > delay) {

@@ -73,9 +62,6 @@ callback();

}
handle = window.requestAnimationFrame(frame);
};
handle = window.requestAnimationFrame(frame);
};
return {

@@ -89,3 +75,2 @@ cancel: cancel,

var amount = 0;
if (progress >= 0 && progress < 0.2) {

@@ -100,3 +85,2 @@ amount = 0.1;

}
return clamp(progress + amount, 0, 0.994);

@@ -114,7 +98,5 @@ };

};
var useUpdate = function useUpdate() {
var _useState = useState(0),
setState = _useState[1];
setState = _useState[1];
return useCallback(function () {

@@ -124,5 +106,3 @@ return setState(incrementParameter);

};
var useGetSetState = function useGetSetState(
/* istanbul ignore next */
var useGetSetState = function useGetSetState( /* istanbul ignore next */
initialState) {

@@ -132,3 +112,2 @@ if (initialState === void 0) {

}
var update = useUpdate();

@@ -143,5 +122,5 @@ var state = useRef(_extends({}, initialState));

}
Object.assign(state.current, patch);
update(); // eslint-disable-next-line react-hooks/exhaustive-deps
update();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

@@ -152,6 +131,4 @@ return [get, set];

// Hat-tip:
var useFirstMountState = function useFirstMountState() {
var isFirst = useRef(true);
if (isFirst.current) {

@@ -161,6 +138,4 @@ isFirst.current = false;

}
return isFirst.current;
};
var useUpdateEffect = function useUpdateEffect(effect, deps) {

@@ -171,4 +146,4 @@ var isFirstMount = useFirstMountState();

return effect();
} // eslint-disable-next-line react-hooks/exhaustive-deps
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, deps);

@@ -178,7 +153,5 @@ };

/* istanbul ignore next */
var noop = function noop() {
return undefined;
};
var initialState = {

@@ -191,15 +164,13 @@ isFinished: true,

var _ref = _temp === void 0 ? {} : _temp,
_ref$animationDuratio = _ref.animationDuration,
animationDuration = _ref$animationDuratio === void 0 ? 200 : _ref$animationDuratio,
_ref$incrementDuratio = _ref.incrementDuration,
incrementDuration = _ref$incrementDuratio === void 0 ? 800 : _ref$incrementDuratio,
_ref$isAnimating = _ref.isAnimating,
isAnimating = _ref$isAnimating === void 0 ? false : _ref$isAnimating,
_ref$minimum = _ref.minimum,
minimum = _ref$minimum === void 0 ? 0.08 : _ref$minimum;
_ref$animationDuratio = _ref.animationDuration,
animationDuration = _ref$animationDuratio === void 0 ? 200 : _ref$animationDuratio,
_ref$incrementDuratio = _ref.incrementDuration,
incrementDuration = _ref$incrementDuratio === void 0 ? 800 : _ref$incrementDuratio,
_ref$isAnimating = _ref.isAnimating,
isAnimating = _ref$isAnimating === void 0 ? false : _ref$isAnimating,
_ref$minimum = _ref.minimum,
minimum = _ref$minimum === void 0 ? 0.08 : _ref$minimum;
var _useGetSetState = useGetSetState(initialState),
get = _useGetSetState[0],
setState = _useGetSetState[1];
get = _useGetSetState[0],
setState = _useGetSetState[1];
var queue = useRef(null);

@@ -213,3 +184,2 @@ var timeout = useRef(null);

var _timeout$current, _queue$current;
(_timeout$current = timeout.current) == null ? void 0 : _timeout$current.cancel();

@@ -220,8 +190,5 @@ (_queue$current = queue.current) == null ? void 0 : _queue$current.clear();

var _queue$current4;
n = clamp(n, minimum, 1);
if (n === 1) {
var _queue$current2, _queue$current3;
cleanup();

@@ -233,3 +200,2 @@ (_queue$current2 = queue.current) == null ? void 0 : _queue$current2.enqueue(function (next) {

var _timeout$current2;
return (_timeout$current2 = timeout.current) == null ? void 0 : _timeout$current2.schedule(next, animationDuration);

@@ -247,3 +213,2 @@ }

}
(_queue$current4 = queue.current) == null ? void 0 : _queue$current4.enqueue(function (next) {

@@ -255,3 +220,2 @@ setState({

var _timeout$current3;
return (_timeout$current3 = timeout.current) == null ? void 0 : _timeout$current3.schedule(next, animationDuration);

@@ -268,7 +232,5 @@ }

var _queue$current5;
trickle();
(_queue$current5 = queue.current) == null ? void 0 : _queue$current5.enqueue(function (next) {
var _timeout$current4;
(_timeout$current4 = timeout.current) == null ? void 0 : _timeout$current4.schedule(function () {

@@ -280,3 +242,2 @@ work();

};
work();

@@ -293,3 +254,2 @@ }, [incrementDuration, queue, timeout, trickle]);

}
return cleanup;

@@ -319,4 +279,3 @@ });

var children = _ref.children,
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
var renderProps = useNProgress(restProps);

@@ -331,3 +290,2 @@ return children(renderProps);

};
hoistNonReactStatics(WithNProgress, BaseComponent);

@@ -334,0 +292,0 @@ return WithNProgress;

@@ -32,3 +32,2 @@ (function (global, factory) {

var key, i;
for (i = 0; i < sourceKeys.length; i++) {

@@ -39,3 +38,2 @@ key = sourceKeys[i];

}
return target;

@@ -48,3 +46,2 @@ }

var source = arguments[i];
for (var key in source) {

@@ -56,3 +53,2 @@ if (Object.prototype.hasOwnProperty.call(source, key)) {

}
return target;

@@ -72,14 +68,10 @@ };

var pending = [];
var next = function next() {
isRunning = true;
var cb = pending.shift();
if (cb) {
return cb(next);
}
isRunning = false;
};
var clear = function clear() {

@@ -89,6 +81,4 @@ isRunning = false;

};
var enqueue = function enqueue(cb) {
pending.push(cb);
if (!isRunning && pending.length === 1) {

@@ -98,3 +88,2 @@ next();

};
return {

@@ -108,3 +97,2 @@ clear: clear,

var handle;
var cancel = function cancel() {

@@ -115,11 +103,8 @@ if (handle) {

};
var schedule = function schedule(callback, delay) {
var deltaTime;
var start;
var frame = function frame(time) {
start = start || time;
deltaTime = time - start;
if (deltaTime > delay) {

@@ -129,9 +114,6 @@ callback();

}
handle = window.requestAnimationFrame(frame);
};
handle = window.requestAnimationFrame(frame);
};
return {

@@ -145,3 +127,2 @@ cancel: cancel,

var amount = 0;
if (progress >= 0 && progress < 0.2) {

@@ -156,3 +137,2 @@ amount = 0.1;

}
return clamp(progress + amount, 0, 0.994);

@@ -170,7 +150,5 @@ };

};
var useUpdate = function useUpdate() {
var _useState = React.useState(0),
setState = _useState[1];
setState = _useState[1];
return React.useCallback(function () {

@@ -180,5 +158,3 @@ return setState(incrementParameter);

};
var useGetSetState = function useGetSetState(
/* istanbul ignore next */
var useGetSetState = function useGetSetState( /* istanbul ignore next */
initialState) {

@@ -188,3 +164,2 @@ if (initialState === void 0) {

}
var update = useUpdate();

@@ -199,5 +174,5 @@ var state = React.useRef(_extends({}, initialState));

}
Object.assign(state.current, patch);
update(); // eslint-disable-next-line react-hooks/exhaustive-deps
update();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

@@ -208,6 +183,4 @@ return [get, set];

// Hat-tip:
var useFirstMountState = function useFirstMountState() {
var isFirst = React.useRef(true);
if (isFirst.current) {

@@ -217,6 +190,4 @@ isFirst.current = false;

}
return isFirst.current;
};
var useUpdateEffect = function useUpdateEffect(effect, deps) {

@@ -227,4 +198,4 @@ var isFirstMount = useFirstMountState();

return effect();
} // eslint-disable-next-line react-hooks/exhaustive-deps
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, deps);

@@ -234,7 +205,5 @@ };

/* istanbul ignore next */
var noop = function noop() {
return undefined;
};
var initialState = {

@@ -247,15 +216,13 @@ isFinished: true,

var _ref = _temp === void 0 ? {} : _temp,
_ref$animationDuratio = _ref.animationDuration,
animationDuration = _ref$animationDuratio === void 0 ? 200 : _ref$animationDuratio,
_ref$incrementDuratio = _ref.incrementDuration,
incrementDuration = _ref$incrementDuratio === void 0 ? 800 : _ref$incrementDuratio,
_ref$isAnimating = _ref.isAnimating,
isAnimating = _ref$isAnimating === void 0 ? false : _ref$isAnimating,
_ref$minimum = _ref.minimum,
minimum = _ref$minimum === void 0 ? 0.08 : _ref$minimum;
_ref$animationDuratio = _ref.animationDuration,
animationDuration = _ref$animationDuratio === void 0 ? 200 : _ref$animationDuratio,
_ref$incrementDuratio = _ref.incrementDuration,
incrementDuration = _ref$incrementDuratio === void 0 ? 800 : _ref$incrementDuratio,
_ref$isAnimating = _ref.isAnimating,
isAnimating = _ref$isAnimating === void 0 ? false : _ref$isAnimating,
_ref$minimum = _ref.minimum,
minimum = _ref$minimum === void 0 ? 0.08 : _ref$minimum;
var _useGetSetState = useGetSetState(initialState),
get = _useGetSetState[0],
setState = _useGetSetState[1];
get = _useGetSetState[0],
setState = _useGetSetState[1];
var queue = React.useRef(null);

@@ -269,3 +236,2 @@ var timeout = React.useRef(null);

var _timeout$current, _queue$current;
(_timeout$current = timeout.current) == null ? void 0 : _timeout$current.cancel();

@@ -276,8 +242,5 @@ (_queue$current = queue.current) == null ? void 0 : _queue$current.clear();

var _queue$current4;
n = clamp(n, minimum, 1);
if (n === 1) {
var _queue$current2, _queue$current3;
cleanup();

@@ -289,3 +252,2 @@ (_queue$current2 = queue.current) == null ? void 0 : _queue$current2.enqueue(function (next) {

var _timeout$current2;
return (_timeout$current2 = timeout.current) == null ? void 0 : _timeout$current2.schedule(next, animationDuration);

@@ -303,3 +265,2 @@ }

}
(_queue$current4 = queue.current) == null ? void 0 : _queue$current4.enqueue(function (next) {

@@ -311,3 +272,2 @@ setState({

var _timeout$current3;
return (_timeout$current3 = timeout.current) == null ? void 0 : _timeout$current3.schedule(next, animationDuration);

@@ -324,7 +284,5 @@ }

var _queue$current5;
trickle();
(_queue$current5 = queue.current) == null ? void 0 : _queue$current5.enqueue(function (next) {
var _timeout$current4;
(_timeout$current4 = timeout.current) == null ? void 0 : _timeout$current4.schedule(function () {

@@ -336,3 +294,2 @@ work();

};
work();

@@ -349,3 +306,2 @@ }, [incrementDuration, queue, timeout, trickle]);

}
return cleanup;

@@ -375,4 +331,3 @@ });

var children = _ref.children,
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
var renderProps = useNProgress(restProps);

@@ -687,3 +642,2 @@ return children(renderProps);

};
hoistNonReactStatics_cjs(WithNProgress, BaseComponent);

@@ -690,0 +644,0 @@ return WithNProgress;

{
"name": "@tanem/react-nprogress",
"version": "5.0.15",
"version": "5.0.16",
"description": "A React primitive for building slim progress bars.",

@@ -69,31 +69,31 @@ "main": "dist/index.js",

"dependencies": {
"@babel/runtime": "^7.19.0",
"@babel/runtime": "^7.19.4",
"hoist-non-react-statics": "^3.3.2"
},
"devDependencies": {
"@babel/core": "7.19.3",
"@babel/plugin-transform-runtime": "7.19.1",
"@babel/preset-env": "7.19.3",
"@babel/core": "7.19.6",
"@babel/plugin-transform-runtime": "7.19.6",
"@babel/preset-env": "7.19.4",
"@babel/preset-react": "7.18.6",
"@babel/preset-typescript": "7.18.6",
"@rollup/plugin-babel": "5.3.1",
"@rollup/plugin-commonjs": "22.0.2",
"@rollup/plugin-node-resolve": "14.1.0",
"@rollup/plugin-replace": "4.0.0",
"@rollup/plugin-babel": "6.0.2",
"@rollup/plugin-commonjs": "23.0.2",
"@rollup/plugin-node-resolve": "15.0.1",
"@rollup/plugin-replace": "5.0.1",
"@testing-library/react": "13.4.0",
"@types/hoist-non-react-statics": "3.3.1",
"@types/jest": "29.1.1",
"@types/jest": "29.2.0",
"@types/mock-raf": "1.0.3",
"@types/react": "18.0.21",
"@types/react-dom": "18.0.6",
"@typescript-eslint/eslint-plugin": "5.39.0",
"@typescript-eslint/parser": "5.39.0",
"@types/react": "18.0.23",
"@types/react-dom": "18.0.7",
"@typescript-eslint/eslint-plugin": "5.41.0",
"@typescript-eslint/parser": "5.41.0",
"babel-core": "6.26.3",
"eslint": "8.24.0",
"eslint": "8.26.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-react": "7.31.8",
"eslint-plugin-react": "7.31.10",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-simple-import-sort": "8.0.0",
"jest": "29.1.2",
"jest-environment-jsdom": "29.1.2",
"jest": "29.2.2",
"jest-environment-jsdom": "29.2.2",
"mock-raf": "1.0.1",

@@ -105,3 +105,3 @@ "npm-run-all": "4.1.5",

"react-test-renderer": "18.2.0",
"regenerator-runtime": "0.13.9",
"regenerator-runtime": "0.13.10",
"rollup": "2.79.1",

@@ -111,3 +111,3 @@ "rollup-plugin-sourcemaps": "0.6.3",

"shx": "0.3.4",
"tanem-scripts": "6.0.60",
"tanem-scripts": "6.0.61",
"ts-jest": "29.0.3",

@@ -114,0 +114,0 @@ "typescript": "4.8.4"

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc