infinity-forge 4.4.2 → 4.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
+ export * from './use-timer/index.js';
1
2
  export * from './use-window.js';
2
3
  export * from './use-scroll.js';
3
4
  export * from './permitions/index.js';
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./use-timer/index.js"), exports);
17
18
  __exportStar(require("./use-window.js"), exports);
18
19
  __exportStar(require("./use-scroll.js"), exports);
19
20
  __exportStar(require("./permitions/index.js"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/hooks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B;AAC5B,+CAA4B;AAC5B,+CAA4B;AAC5B,mDAAgC;AAChC,6DAA0C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/hooks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA2B;AAC3B,+CAA4B;AAC5B,+CAA4B;AAC5B,+CAA4B;AAC5B,mDAAgC;AAChC,6DAA0C"}
@@ -0,0 +1,2 @@
1
+ export * from './use-timer.js';
2
+ export * from './interfaces.js';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./use-timer.js"), exports);
18
+ __exportStar(require("./interfaces.js"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ui/hooks/use-timer/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA2B;AAC3B,+CAA4B"}
@@ -0,0 +1,22 @@
1
+ import { Dispatch, SetStateAction } from "react";
2
+ export type UseTimerProps = {
3
+ time?: Date;
4
+ continuous?: boolean;
5
+ onPause?: (time: number) => void;
6
+ onFinish?: (time: number) => void;
7
+ };
8
+ export type UseTimerResponse = {
9
+ timerState: {
10
+ isPaused: boolean;
11
+ isFinished: boolean;
12
+ elapsedTime: number;
13
+ timeContinuous: number;
14
+ };
15
+ setTimerState: Dispatch<SetStateAction<{
16
+ isPaused: boolean;
17
+ isFinished: boolean;
18
+ elapsedTime: number;
19
+ timeContinuous: number;
20
+ }>>;
21
+ differenceBetwenContinuoustimerAndElapsedTime: number;
22
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/ui/hooks/use-timer/interfaces.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ import { UseTimerProps } from './interfaces.js';
3
+ export declare function useTimer({ time, onPause, onFinish, continuous }: UseTimerProps): {
4
+ timerState: {
5
+ isPaused: boolean;
6
+ isFinished: boolean;
7
+ elapsedTime: number;
8
+ timeContinuous: number;
9
+ };
10
+ setTimerState: import("react").Dispatch<import("react").SetStateAction<{
11
+ isPaused: boolean;
12
+ isFinished: boolean;
13
+ elapsedTime: number;
14
+ timeContinuous: number;
15
+ }>>;
16
+ differenceBetwenContinuoustimerAndElapsedTime: number;
17
+ };
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.useTimer = void 0;
18
+ var react_1 = require("react");
19
+ var moment_1 = __importDefault(require("moment"));
20
+ function useTimer(_a) {
21
+ var time = _a.time, onPause = _a.onPause, onFinish = _a.onFinish, _b = _a.continuous, continuous = _b === void 0 ? false : _b;
22
+ var _c = (0, react_1.useState)({
23
+ isPaused: false,
24
+ isFinished: false,
25
+ elapsedTime: 0,
26
+ timeContinuous: 0,
27
+ }), timerState = _c[0], setTimerState = _c[1];
28
+ (0, react_1.useEffect)(function () {
29
+ if (timerState.isPaused) {
30
+ onPause === null || onPause === void 0 ? void 0 : onPause(timerState.elapsedTime);
31
+ }
32
+ var interval = setInterval(function () {
33
+ if ((time && (0, moment_1.default)(time).isSame((0, moment_1.default)(timerState.elapsedTime))) || timerState.isFinished) {
34
+ return onFinish === null || onFinish === void 0 ? void 0 : onFinish(timerState.elapsedTime);
35
+ }
36
+ if (!timerState.isPaused) {
37
+ setTimerState(function (prev) { return (__assign(__assign({}, prev), { elapsedTime: prev.elapsedTime + 1000 })); });
38
+ }
39
+ if (continuous) {
40
+ setTimerState(function (prev) { return (__assign(__assign({}, prev), { timeContinuous: prev.timeContinuous + 1000 })); });
41
+ }
42
+ }, 1000);
43
+ return function () {
44
+ clearInterval(interval);
45
+ };
46
+ }, [timerState.isPaused, timerState.isFinished, timerState.elapsedTime]);
47
+ var differenceBetwenContinuoustimerAndElapsedTime = timerState.timeContinuous - timerState.elapsedTime;
48
+ return {
49
+ timerState: timerState,
50
+ setTimerState: setTimerState,
51
+ differenceBetwenContinuoustimerAndElapsedTime: differenceBetwenContinuoustimerAndElapsedTime,
52
+ };
53
+ }
54
+ exports.useTimer = useTimer;
55
+ //# sourceMappingURL=use-timer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-timer.js","sourceRoot":"","sources":["../../../../src/ui/hooks/use-timer/use-timer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+BAA2C;AAE3C,kDAA2B;AAI3B,SAAgB,QAAQ,CAAC,EAA8D;QAA5D,IAAI,UAAA,EAAE,OAAO,aAAA,EAAE,QAAQ,cAAA,EAAE,kBAAkB,EAAlB,UAAU,mBAAG,KAAK,KAAA;IAC9D,IAAA,KAA8B,IAAA,gBAAQ,EAAC;QAC3C,QAAQ,EAAE,KAAK;QACf,UAAU,EAAE,KAAK;QACjB,WAAW,EAAE,CAAC;QACd,cAAc,EAAE,CAAC;KAClB,CAAC,EALK,UAAU,QAAA,EAAE,aAAa,QAK9B,CAAA;IAEF,IAAA,iBAAS,EAAC;QACR,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC;YACxB,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,UAAU,CAAC,WAAW,CAAC,CAAA;QACnC,CAAC;QAED,IAAM,QAAQ,GAAG,WAAW,CAAC;YAC3B,IAAI,CAAC,IAAI,IAAI,IAAA,gBAAM,EAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAA,gBAAM,EAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,UAAU,EAAE,CAAC;gBAC3F,OAAO,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,UAAU,CAAC,WAAW,CAAC,CAAA;YAC3C,CAAC;YAED,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;gBACzB,aAAa,CAAC,UAAC,IAAI,IAAK,OAAA,uBACnB,IAAI,KACP,WAAW,EAAE,IAAI,CAAC,WAAW,GAAG,IAAI,IACpC,EAHsB,CAGtB,CAAC,CAAA;YACL,CAAC;YAED,IAAI,UAAU,EAAE,CAAC;gBACf,aAAa,CAAC,UAAC,IAAI,IAAK,OAAA,uBACnB,IAAI,KACP,cAAc,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,IAC1C,EAHsB,CAGtB,CAAC,CAAA;YACL,CAAC;QACH,CAAC,EAAE,IAAI,CAAC,CAAA;QAER,OAAO;YACL,aAAa,CAAC,QAAQ,CAAC,CAAA;QACzB,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,UAAU,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,CAAA;IAExE,IAAM,6CAA6C,GAAG,UAAU,CAAC,cAAc,GAAG,UAAU,CAAC,WAAW,CAAA;IAExG,OAAO;QACL,UAAU,YAAA;QACV,aAAa,eAAA;QACb,6CAA6C,+CAAA;KAC9C,CAAA;AACH,CAAC;AA7CD,4BA6CC"}
@@ -1,3 +1,3 @@
1
1
  export type TransformValueToMomentFormatOptions = 'DD/MM/YYYY HH:mm' | 'DD/MM/YYYY' | "Data";
2
2
  export declare function verifyDateStringIsValid(date: string): boolean;
3
- export declare function transformValueToMomentFormat(value: string | string[], format: TransformValueToMomentFormatOptions): string | string[] | Date;
3
+ export declare function transformValueToMomentFormat(value: string | string[], format: TransformValueToMomentFormatOptions): string | Date | string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "infinity-forge",
3
- "version": "4.4.2",
3
+ "version": "4.4.4",
4
4
  "description": "codie Library",
5
5
  "main": "./dist/index",
6
6
  "module": "./dist/index",