Project Init

This commit is contained in:
Muluhabt
2026-05-29 15:23:46 +03:00
commit 2fbc557aac
67387 changed files with 6063341 additions and 0 deletions

View File

@@ -0,0 +1,72 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAnimateManager = createAnimateManager;
/**
* Represents a single item in the ReactSmoothQueue.
* The item can be:
* - A number representing a delay in milliseconds.
* - An object representing a style change
* - A StartAnimationFunction that starts eased transition and calls different render
* because of course in Recharts we have to have three ways to do everything
* - An arbitrary function to be executed
*/
function createAnimateManager(timeoutController) {
var currStyle;
var handleChange = () => null;
var shouldStop = false;
var cancelTimeout = null;
var setStyle = _style => {
if (shouldStop) {
return;
}
if (Array.isArray(_style)) {
if (!_style.length) {
return;
}
var styles = _style;
var [curr, ...restStyles] = styles;
if (typeof curr === 'number') {
cancelTimeout = timeoutController.setTimeout(setStyle.bind(null, restStyles), curr);
return;
}
setStyle(curr);
cancelTimeout = timeoutController.setTimeout(setStyle.bind(null, restStyles));
return;
}
if (typeof _style === 'string') {
currStyle = _style;
handleChange(currStyle);
}
if (typeof _style === 'object') {
currStyle = _style;
handleChange(currStyle);
}
if (typeof _style === 'function') {
_style();
}
};
return {
stop: () => {
shouldStop = true;
},
start: style => {
shouldStop = false;
if (cancelTimeout) {
cancelTimeout();
cancelTimeout = null;
}
setStyle(style);
},
subscribe: _handleChange => {
handleChange = _handleChange;
return () => {
handleChange = () => null;
};
},
getTimeoutController: () => timeoutController
};
}

View File

@@ -0,0 +1,93 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.CSSTransitionAnimate = CSSTransitionAnimate;
var _react = require("react");
var _DataUtils = require("../util/DataUtils");
var _resolveDefaultProps = require("../util/resolveDefaultProps");
var _useAnimationManager = require("./useAnimationManager");
var _util = require("./util");
var _Global = require("../util/Global");
var _usePrefersReducedMotion = require("../util/usePrefersReducedMotion");
var defaultProps = {
begin: 0,
duration: 1000,
easing: 'ease',
isActive: true,
canBegin: true,
onAnimationEnd: () => {},
onAnimationStart: () => {}
};
function CSSTransitionAnimate(outsideProps) {
var props = (0, _resolveDefaultProps.resolveDefaultProps)(outsideProps, defaultProps);
var {
animationId,
from,
to,
attributeName,
isActive: isActiveProp,
canBegin,
duration,
easing,
begin,
onAnimationEnd,
onAnimationStart: onAnimationStartFromProps,
children
} = props;
var prefersReducedMotion = (0, _usePrefersReducedMotion.usePrefersReducedMotion)();
var isActive = isActiveProp === 'auto' ? !_Global.Global.isSsr && !prefersReducedMotion : isActiveProp;
var animationManager = (0, _useAnimationManager.useAnimationManager)(animationId + attributeName, props.animationManager);
var [style, setStyle] = (0, _react.useState)(() => {
if (!isActive) {
return to;
}
return from;
});
var initialized = (0, _react.useRef)(false);
var onAnimationStart = (0, _react.useCallback)(() => {
setStyle(from);
onAnimationStartFromProps();
}, [from, onAnimationStartFromProps]);
(0, _react.useEffect)(() => {
if (!isActive || !canBegin) {
return _DataUtils.noop;
}
initialized.current = true;
var unsubscribe = animationManager.subscribe(setStyle);
animationManager.start([onAnimationStart, begin, to, duration, onAnimationEnd]);
return () => {
animationManager.stop();
if (unsubscribe) {
unsubscribe();
}
onAnimationEnd();
};
}, [isActive, canBegin, duration, easing, begin, onAnimationStart, onAnimationEnd, animationManager, to, from]);
if (!isActive) {
/*
* With isActive=false, the component always renders with the final style, immediately,
* and ignores all other props.
* Also there is no transition applied.
*/
return children({
[attributeName]: to
});
}
if (!canBegin) {
return children({
[attributeName]: from
});
}
if (initialized.current) {
var transition = (0, _util.getTransitionVal)([attributeName], duration, easing);
return children({
transition,
[attributeName]: style
});
}
return children({
[attributeName]: from
});
}

View File

@@ -0,0 +1,71 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.JavascriptAnimate = JavascriptAnimate;
var _react = require("react");
var _DataUtils = require("../util/DataUtils");
var _resolveDefaultProps = require("../util/resolveDefaultProps");
var _configUpdate = _interopRequireDefault(require("./configUpdate"));
var _easing = require("./easing");
var _useAnimationManager = require("./useAnimationManager");
var _Global = require("../util/Global");
var _usePrefersReducedMotion = require("../util/usePrefersReducedMotion");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
var defaultJavascriptAnimateProps = {
begin: 0,
duration: 1000,
easing: 'ease',
isActive: true,
canBegin: true,
onAnimationEnd: () => {},
onAnimationStart: () => {}
};
var from = {
t: 0
};
var to = {
t: 1
};
function JavascriptAnimate(outsideProps) {
var props = (0, _resolveDefaultProps.resolveDefaultProps)(outsideProps, defaultJavascriptAnimateProps);
var {
isActive: isActiveProp,
canBegin,
duration,
easing,
begin,
onAnimationEnd,
onAnimationStart,
children
} = props;
var prefersReducedMotion = (0, _usePrefersReducedMotion.usePrefersReducedMotion)();
var isActive = isActiveProp === 'auto' ? !_Global.Global.isSsr && !prefersReducedMotion : isActiveProp;
var animationManager = (0, _useAnimationManager.useAnimationManager)(props.animationId, props.animationManager);
var [style, setStyle] = (0, _react.useState)(isActive ? from : to);
var stopJSAnimation = (0, _react.useRef)(null);
(0, _react.useEffect)(() => {
if (!isActive) {
setStyle(to);
}
}, [isActive]);
(0, _react.useEffect)(() => {
if (!isActive || !canBegin) {
return _DataUtils.noop;
}
var startAnimation = (0, _configUpdate.default)(from, to, (0, _easing.configEasing)(easing), duration, setStyle, animationManager.getTimeoutController());
var onAnimationActive = () => {
stopJSAnimation.current = startAnimation();
};
animationManager.start([onAnimationStart, begin, onAnimationActive, duration, onAnimationEnd]);
return () => {
animationManager.stop();
if (stopJSAnimation.current) {
stopJSAnimation.current();
}
onAnimationEnd();
};
}, [isActive, canBegin, duration, easing, begin, onAnimationStart, onAnimationEnd, animationManager]);
return children(style.t);
}

143
node_modules/recharts/lib/animation/configUpdate.js generated vendored Normal file
View File

@@ -0,0 +1,143 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.alpha = void 0;
var _util = require("./util");
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var alpha = (begin, end, k) => begin + (end - begin) * k;
exports.alpha = alpha;
var needContinue = _ref => {
var {
from,
to
} = _ref;
return from !== to;
};
/*
* @description: cal new from value and velocity in each stepper
* @return: { [styleProperty]: { from, to, velocity } }
*/
var calStepperVals = (easing, preVals, steps) => {
var nextStepVals = (0, _util.mapObject)((key, val) => {
if (needContinue(val)) {
var [newX, newV] = easing(val.from, val.to, val.velocity);
return _objectSpread(_objectSpread({}, val), {}, {
from: newX,
velocity: newV
});
}
return val;
}, preVals);
if (steps < 1) {
return (0, _util.mapObject)((key, val) => {
if (needContinue(val) && nextStepVals[key] != null) {
return _objectSpread(_objectSpread({}, val), {}, {
velocity: alpha(val.velocity, nextStepVals[key].velocity, steps),
from: alpha(val.from, nextStepVals[key].from, steps)
});
}
return val;
}, preVals);
}
return calStepperVals(easing, nextStepVals, steps - 1);
};
function createStepperUpdate(from, to, easing, interKeys, render, timeoutController) {
var preTime;
var stepperStyle = interKeys.reduce((res, key) => _objectSpread(_objectSpread({}, res), {}, {
[key]: {
from: from[key],
velocity: 0,
to: to[key]
}
}), {});
var getCurrStyle = () => (0, _util.mapObject)((key, val) => val.from, stepperStyle);
var shouldStopAnimation = () => !Object.values(stepperStyle).filter(needContinue).length;
var stopAnimation = null;
var stepperUpdate = now => {
if (!preTime) {
preTime = now;
}
var deltaTime = now - preTime;
var steps = deltaTime / easing.dt;
stepperStyle = calStepperVals(easing, stepperStyle, steps);
// get union set and add compatible prefix
render(_objectSpread(_objectSpread(_objectSpread({}, from), to), getCurrStyle()));
preTime = now;
if (!shouldStopAnimation()) {
stopAnimation = timeoutController.setTimeout(stepperUpdate);
}
};
// return start animation method
return () => {
stopAnimation = timeoutController.setTimeout(stepperUpdate);
// return stop animation method
return () => {
var _stopAnimation;
(_stopAnimation = stopAnimation) === null || _stopAnimation === void 0 || _stopAnimation();
};
};
}
function createTimingUpdate(from, to, easing, duration, interKeys, render, timeoutController) {
var stopAnimation = null;
var timingStyle = interKeys.reduce((res, key) => {
var fromElement = from[key];
var toElement = to[key];
if (fromElement == null || toElement == null) {
return res;
}
return _objectSpread(_objectSpread({}, res), {}, {
[key]: [fromElement, toElement]
});
}, {});
var beginTime;
var timingUpdate = now => {
if (!beginTime) {
beginTime = now;
}
var t = (now - beginTime) / duration;
var currStyle = (0, _util.mapObject)((key, val) => alpha(...val, easing(t)), timingStyle);
// get union set and add compatible prefix
render(_objectSpread(_objectSpread(_objectSpread({}, from), to), currStyle));
if (t < 1) {
stopAnimation = timeoutController.setTimeout(timingUpdate);
} else {
var finalStyle = (0, _util.mapObject)((key, val) => alpha(...val, easing(1)), timingStyle);
render(_objectSpread(_objectSpread(_objectSpread({}, from), to), finalStyle));
}
};
// return start animation method
return () => {
stopAnimation = timeoutController.setTimeout(timingUpdate);
// return stop animation method
return () => {
var _stopAnimation2;
(_stopAnimation2 = stopAnimation) === null || _stopAnimation2 === void 0 || _stopAnimation2();
};
};
}
// configure update function
// eslint-disable-next-line import/no-default-export
var _default = (from, to, easing, duration, render, timeoutController) => {
var interKeys = (0, _util.getIntersectionKeys)(from, to);
if (easing == null) {
// no animation, just set to final state
return () => {
render(_objectSpread(_objectSpread({}, from), to));
return () => {};
};
}
return easing.isStepper === true ? createStepperUpdate(from, to, easing, interKeys, render, timeoutController) : createTimingUpdate(from, to, easing, duration, interKeys, render, timeoutController);
};
exports.default = _default;

View File

@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createDefaultAnimationManager = createDefaultAnimationManager;
var _AnimationManager = require("./AnimationManager");
var _timeoutController = require("./timeoutController");
function createDefaultAnimationManager() {
return (0, _AnimationManager.createAnimateManager)(new _timeoutController.RequestAnimationFrameTimeoutController());
}

142
node_modules/recharts/lib/animation/easing.js generated vendored Normal file
View File

@@ -0,0 +1,142 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.configSpring = exports.configEasing = exports.configBezier = exports.ACCURACY = void 0;
var ACCURACY = exports.ACCURACY = 1e-4;
var cubicBezierFactor = (c1, c2) => [0, 3 * c1, 3 * c2 - 6 * c1, 3 * c1 - 3 * c2 + 1];
var evaluatePolynomial = (params, t) => params.map((param, i) => param * t ** i).reduce((pre, curr) => pre + curr);
var cubicBezier = (c1, c2) => t => {
var params = cubicBezierFactor(c1, c2);
return evaluatePolynomial(params, t);
};
var derivativeCubicBezier = (c1, c2) => t => {
var params = cubicBezierFactor(c1, c2);
var newParams = [...params.map((param, i) => param * i).slice(1), 0];
return evaluatePolynomial(newParams, t);
};
var parseCubicBezier = easing => {
var _easingParts$;
var easingParts = easing.split('(');
if (easingParts.length !== 2 || easingParts[0] !== 'cubic-bezier') {
return null;
}
var numbers = (_easingParts$ = easingParts[1]) === null || _easingParts$ === void 0 || (_easingParts$ = _easingParts$.split(')')[0]) === null || _easingParts$ === void 0 ? void 0 : _easingParts$.split(',');
if (numbers == null || numbers.length !== 4) {
return null;
}
var coords = numbers.map(x => parseFloat(x));
return [coords[0], coords[1], coords[2], coords[3]];
};
var getBezierCoordinates = function getBezierCoordinates() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
if (args.length === 1) {
switch (args[0]) {
case 'linear':
return [0.0, 0.0, 1.0, 1.0];
case 'ease':
return [0.25, 0.1, 0.25, 1.0];
case 'ease-in':
return [0.42, 0.0, 1.0, 1.0];
case 'ease-out':
return [0.42, 0.0, 0.58, 1.0];
case 'ease-in-out':
return [0.0, 0.0, 0.58, 1.0];
default:
{
var easing = parseCubicBezier(args[0]);
if (easing) {
return easing;
}
}
}
}
if (args.length === 4) {
return args;
}
// Fallback for invalid inputs. The previous implementation was buggy and would lead to NaN.
// Returning linear easing is a safe default.
return [0.0, 0.0, 1.0, 1.0];
};
var createBezierEasing = (x1, y1, x2, y2) => {
var curveX = cubicBezier(x1, x2);
var curveY = cubicBezier(y1, y2);
var derCurveX = derivativeCubicBezier(x1, x2);
var rangeValue = value => {
if (value > 1) {
return 1;
}
if (value < 0) {
return 0;
}
return value;
};
var bezier = _t => {
var t = _t > 1 ? 1 : _t;
var x = t;
for (var i = 0; i < 8; ++i) {
var evalT = curveX(x) - t;
var derVal = derCurveX(x);
if (Math.abs(evalT - t) < ACCURACY || derVal < ACCURACY) {
return curveY(x);
}
x = rangeValue(x - evalT / derVal);
}
return curveY(x);
};
bezier.isStepper = false;
return bezier;
};
// calculate cubic-bezier using Newton's method
var configBezier = exports.configBezier = function configBezier() {
return createBezierEasing(...getBezierCoordinates(...arguments));
};
var configSpring = exports.configSpring = function configSpring() {
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var {
stiff = 100,
damping = 8,
dt = 17
} = config;
var stepper = (currX, destX, currV) => {
var FSpring = -(currX - destX) * stiff;
var FDamping = currV * damping;
var newV = currV + (FSpring - FDamping) * dt / 1000;
var newX = currV * dt / 1000 + currX;
if (Math.abs(newX - destX) < ACCURACY && Math.abs(newV) < ACCURACY) {
return [destX, 0];
}
return [newX, newV];
};
stepper.isStepper = true;
stepper.dt = dt;
return stepper;
};
var configEasing = easing => {
if (typeof easing === 'string') {
switch (easing) {
case 'ease':
case 'ease-in-out':
case 'ease-out':
case 'ease-in':
case 'linear':
return configBezier(easing);
case 'spring':
return configSpring();
default:
if (easing.split('(')[0] === 'cubic-bezier') {
return configBezier(easing);
}
}
}
if (typeof easing === 'function') {
return easing;
}
return null;
};
exports.configEasing = configEasing;

View File

@@ -0,0 +1,38 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.RequestAnimationFrameTimeoutController = void 0;
/**
* Callback type for the timeout function.
* Receives current time in milliseconds as an argument.
*/
/**
* A function that, when called, cancels the timeout.
*/
class RequestAnimationFrameTimeoutController {
setTimeout(callback) {
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var startTime = performance.now();
var requestId = null;
var executeCallback = now => {
if (now - startTime >= delay) {
callback(now);
// tests fail without the extra if, even when five lines below it's not needed
// TODO finish transition to the mocked timeout controller and then remove this condition
} else if (typeof requestAnimationFrame === 'function') {
requestId = requestAnimationFrame(executeCallback);
}
};
requestId = requestAnimationFrame(executeCallback);
return () => {
if (requestId != null) {
cancelAnimationFrame(requestId);
}
};
}
}
exports.RequestAnimationFrameTimeoutController = RequestAnimationFrameTimeoutController;

View File

@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.AnimationManagerContext = void 0;
exports.useAnimationManager = useAnimationManager;
var _react = require("react");
var _createDefaultAnimationManager = require("./createDefaultAnimationManager");
var AnimationManagerContext = exports.AnimationManagerContext = /*#__PURE__*/(0, _react.createContext)(_createDefaultAnimationManager.createDefaultAnimationManager);
function useAnimationManager(animationId, animationManagerFromProps) {
var contextAnimationManager = (0, _react.useContext)(AnimationManagerContext);
return (0, _react.useMemo)(() => animationManagerFromProps !== null && animationManagerFromProps !== void 0 ? animationManagerFromProps : contextAnimationManager(animationId), [animationId, animationManagerFromProps, contextAnimationManager]);
}

39
node_modules/recharts/lib/animation/util.js generated vendored Normal file
View File

@@ -0,0 +1,39 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.mapObject = exports.getTransitionVal = exports.getIntersectionKeys = exports.getDashCase = void 0;
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
/*
* @description: convert camel case to dash case
* string => string
*/
var getDashCase = name => name.replace(/([A-Z])/g, v => "-".concat(v.toLowerCase()));
exports.getDashCase = getDashCase;
var getTransitionVal = (props, duration, easing) => props.map(prop => "".concat(getDashCase(prop), " ").concat(duration, "ms ").concat(easing)).join(',');
/**
* Finds the intersection of keys between two objects
* @param {object} preObj previous object
* @param {object} nextObj next object
* @returns an array of keys that exist in both objects
*/
exports.getTransitionVal = getTransitionVal;
var getIntersectionKeys = (preObj, nextObj) => [Object.keys(preObj), Object.keys(nextObj)].reduce((a, b) => a.filter(c => b.includes(c)));
/**
* Maps an object to another object
* @param {function} fn function to map
* @param {object} obj object to map
* @returns mapped object
*/
exports.getIntersectionKeys = getIntersectionKeys;
var mapObject = (fn, obj) => Object.keys(obj).reduce((res, key) => _objectSpread(_objectSpread({}, res), {}, {
[key]: fn(key, obj[key])
}), {});
exports.mapObject = mapObject;