@onepercentio/one-ui 0.8.3 → 0.8.5-beta.1
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.
- package/cypress/support/commands.ts +12 -1
- package/cypress/support/component-index.html +5 -3
- package/dist/components/AnimatedEntrance/AnimatedEntrance.d.ts +1 -1
- package/dist/components/AnimatedEntrance/AnimatedEntrance.js +23 -10
- package/dist/components/AnimatedEntrance/AnimatedEntrance.js.map +1 -1
- package/dist/components/AnimatedEntrance/AnimatedEntrance.stories.js.map +1 -1
- package/dist/components/CheckBox/CheckBox.stories.js +1 -1
- package/dist/components/CheckBox/CheckBox.stories.js.map +1 -1
- package/dist/components/Countdown/Countdown.stories.js +1 -1
- package/dist/components/Countdown/Countdown.stories.js.map +1 -1
- package/dist/components/InstantCounter/InstantCounter.stories.js +1 -1
- package/dist/components/InstantCounter/InstantCounter.stories.js.map +1 -1
- package/dist/components/OrderableList/OrderableList.d.ts +11 -0
- package/dist/components/OrderableList/OrderableList.js +196 -0
- package/dist/components/OrderableList/OrderableList.js.map +1 -0
- package/dist/components/OrderableList/OrderableList.module.scss +27 -0
- package/dist/components/OrderableList/OrderableList.stories.d.ts +14 -0
- package/dist/components/OrderableList/OrderableList.stories.js +77 -0
- package/dist/components/OrderableList/OrderableList.stories.js.map +1 -0
- package/dist/components/OrderableList/index.d.ts +1 -0
- package/dist/components/OrderableList/index.js +9 -0
- package/dist/components/OrderableList/index.js.map +1 -0
- package/dist/components/Text/Text.d.ts +2 -2
- package/dist/components/Text/Text.js +4 -4
- package/dist/components/Text/Text.js.map +1 -1
- package/dist/components/Text/Text.stories.d.ts +1 -1
- package/dist/components/Text/Text.stories.js +2 -2
- package/dist/components/Text/Text.stories.js.map +1 -1
- package/dist/context/AsyncProcessQueue.d.ts +71 -0
- package/dist/context/AsyncProcessQueue.development.d.ts +8 -0
- package/dist/context/AsyncProcessQueue.development.js +42 -0
- package/dist/context/AsyncProcessQueue.development.js.map +1 -0
- package/dist/context/AsyncProcessQueue.js +190 -0
- package/dist/context/AsyncProcessQueue.js.map +1 -0
- package/dist/context/__mocks__/OneUIProvider.d.ts +1 -1
- package/dist/hooks/usePagination.js +10 -7
- package/dist/hooks/usePagination.js.map +1 -1
- package/dist/hooks/useShortIntl.js.map +1 -1
- package/{src → dist}/types.d.ts +32 -44
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -0
- package/package.json +6 -6
|
@@ -31,11 +31,11 @@ const react_1 = __importDefault(require("react"));
|
|
|
31
31
|
const storybookUtils_1 = require("../../storybookUtils");
|
|
32
32
|
const Text_1 = __importStar(require("./Text"));
|
|
33
33
|
exports.default = {
|
|
34
|
-
component: Text_1.
|
|
34
|
+
component: Text_1.Text,
|
|
35
35
|
title: "Variantes de texto",
|
|
36
36
|
};
|
|
37
37
|
const TodasVariacoes = () => {
|
|
38
|
-
const variantes = (0, storybookUtils_1.extractAllPossibilitiesFromEnumProp)(Text_1.
|
|
38
|
+
const variantes = (0, storybookUtils_1.extractAllPossibilitiesFromEnumProp)(Text_1.Text, "type");
|
|
39
39
|
return variantes.map((a) => (react_1.default.createElement(storybookUtils_1.SideBySideContainer, { exampleName: a },
|
|
40
40
|
react_1.default.createElement(Text_1.default, { type: a }, "Texto do exemplo"))));
|
|
41
41
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.stories.js","sourceRoot":"","sources":["../../../src/components/Text/Text.stories.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,yDAG8B;AAC9B,+
|
|
1
|
+
{"version":3,"file":"Text.stories.js","sourceRoot":"","sources":["../../../src/components/Text/Text.stories.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,yDAG8B;AAC9B,+CAA2C;AAE3C,kBAAe;IACb,SAAS,EAAE,WAAQ;IACnB,KAAK,EAAE,oBAAoB;CAC5B,CAAC;AAEK,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,MAAM,SAAS,GAAG,IAAA,oDAAmC,EAAC,WAAQ,EAAE,MAAM,CAAC,CAAC;IAExE,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAC1B,8BAAC,oCAAmB,IAAC,WAAW,EAAE,CAAC;QACjC,8BAAC,cAAC,IAAC,IAAI,EAAE,CAAQ,uBAAsB,CACnB,CACvB,CAAC,CAAC;AACL,CAAC,CAAC;AARW,QAAA,cAAc,kBAQzB"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React, { PropsWithChildren, ReactElement, RefObject } from "react";
|
|
2
|
+
export declare enum AsyncQueueErrors {
|
|
3
|
+
RECOVERY_IS_NOT_BEING_CALLED = "A recovery is not set for this call. If the user reloads the page, this process will not return to the async list"
|
|
4
|
+
}
|
|
5
|
+
declare type ReactElementWithState = ReactElement & {
|
|
6
|
+
status: "loading" | "succeded" | "failed";
|
|
7
|
+
};
|
|
8
|
+
declare type ContextShape = {
|
|
9
|
+
targetElRef: RefObject<HTMLDivElement>;
|
|
10
|
+
pendingTransactions: ReturnType<typeof useCounter>;
|
|
11
|
+
UIs: ReactElementWithState[];
|
|
12
|
+
setUIs: (updater: (previous: ReactElementWithState[]) => ReactElementWithState[]) => void;
|
|
13
|
+
watchPromise: <T extends keyof OnepercentUtility.AsyncQueue.UIModels>(promise: Promise<any>, retryFunc: () => Promise<any>, uiType: T, ...uiArgs: OnepercentUtility.AsyncQueue.UIModels[T]) => void;
|
|
14
|
+
recoveries: {
|
|
15
|
+
[k in keyof OnepercentUtility.AsyncQueue.RecoveryTypes]: {
|
|
16
|
+
write: (...args: OnepercentUtility.AsyncQueue.RecoveryTypes[k]) => void;
|
|
17
|
+
clear: (...args: OnepercentUtility.AsyncQueue.RecoveryTypes[k]) => void;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
declare function useCounter(): {
|
|
22
|
+
count: number;
|
|
23
|
+
setCounter: React.Dispatch<React.SetStateAction<number>>;
|
|
24
|
+
increment: () => void;
|
|
25
|
+
decrement: () => void;
|
|
26
|
+
reset: () => void;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* This propagates the utilitary functions
|
|
30
|
+
*/
|
|
31
|
+
export declare function AsyncProcessQueueProvider<R extends OnepercentUtility.AsyncQueue.RecoveryTypes = OnepercentUtility.AsyncQueue.RecoveryTypes, T extends keyof OnepercentUtility.AsyncQueue.UIModels = keyof OnepercentUtility.AsyncQueue.UIModels>({ children, recoveries, uiFactory, }: PropsWithChildren<{
|
|
32
|
+
recoveries: {
|
|
33
|
+
[k in keyof R]: {
|
|
34
|
+
write: (...args: R[k]) => void;
|
|
35
|
+
clear: (...args: R[k]) => void;
|
|
36
|
+
recover: () => [
|
|
37
|
+
promiseToWaitFor: Promise<any>,
|
|
38
|
+
promiseRetryFunction: () => Promise<any>,
|
|
39
|
+
uiType: T,
|
|
40
|
+
...uiArgs: OnepercentUtility.AsyncQueue.UIModels[T]
|
|
41
|
+
][];
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
uiFactory: (type: keyof OnepercentUtility.AsyncQueue.UIModels) => UIStateFactory;
|
|
45
|
+
}>): JSX.Element;
|
|
46
|
+
export declare function useAsyncProcessQueueContext(): ContextShape;
|
|
47
|
+
declare type AsyncProcessStatuses = "loading" | "succeded" | "failed";
|
|
48
|
+
export interface UIStateFactory {
|
|
49
|
+
(status: AsyncProcessStatuses, error?: Error, dismiss?: () => void, retry?: () => void): ReactElement;
|
|
50
|
+
}
|
|
51
|
+
/** This exposes the recovery registration functions available for abtract types of calls */
|
|
52
|
+
export declare function useRecoveries<R extends OnepercentUtility.AsyncQueue.RecoveryTypes = OnepercentUtility.AsyncQueue.RecoveryTypes>(): {
|
|
53
|
+
[K in keyof R]: {
|
|
54
|
+
write(...args: R[K]): void;
|
|
55
|
+
clear(...args: R[K]): void;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
declare type Params<U extends keyof OnepercentUtility.AsyncQueue.UIModels = keyof OnepercentUtility.AsyncQueue.UIModels> = [U, ...OnepercentUtility.AsyncQueue.UIModels[U]];
|
|
59
|
+
/**
|
|
60
|
+
* This function wraps other async functions and decides when the ongoing promise should be put on the queue or not
|
|
61
|
+
*/
|
|
62
|
+
export declare function useAsyncProcessQueue<T extends {
|
|
63
|
+
[k: string]: (...args: any[]) => Promise<any>;
|
|
64
|
+
}>(functionsToQueue: T, UIParamsFactory: <F extends keyof T>(functionName: F) => Params): T & {
|
|
65
|
+
elToTransitionToQueue: RefObject<HTMLDivElement>;
|
|
66
|
+
/**
|
|
67
|
+
* Function that wraps the current running actions and animates to the target queue element
|
|
68
|
+
*/
|
|
69
|
+
wrapQueue: () => void;
|
|
70
|
+
};
|
|
71
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Binds to the promise and checks if a restore has been registered when finishing
|
|
3
|
+
* @param promise
|
|
4
|
+
*/
|
|
5
|
+
export declare function securePromise<T>(promise: Promise<T>): Promise<T>;
|
|
6
|
+
/** This registers that a registration has been made an this will be recoverable */
|
|
7
|
+
export declare function countRegistration(): void;
|
|
8
|
+
export declare function resetRegistrationCounter(): void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file has been created to optimize module bundling and ignore development utility
|
|
3
|
+
// when on production by unused imports
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.resetRegistrationCounter = exports.countRegistration = exports.securePromise = void 0;
|
|
6
|
+
const AsyncProcessQueue_1 = require("./AsyncProcessQueue");
|
|
7
|
+
/** This count how many registrations have been made */
|
|
8
|
+
let amountOfRestorationThatShouldBeNeeded = 0;
|
|
9
|
+
/**
|
|
10
|
+
* Binds to the promise and checks if a restore has been registered when finishing
|
|
11
|
+
* @param promise
|
|
12
|
+
*/
|
|
13
|
+
function securePromise(promise) {
|
|
14
|
+
function validate() {
|
|
15
|
+
if (amountOfRestorationThatShouldBeNeeded === 0) {
|
|
16
|
+
throw new Error(AsyncProcessQueue_1.AsyncQueueErrors.RECOVERY_IS_NOT_BEING_CALLED);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return promise
|
|
20
|
+
.then((e) => {
|
|
21
|
+
validate();
|
|
22
|
+
return e;
|
|
23
|
+
})
|
|
24
|
+
.catch((e) => {
|
|
25
|
+
validate();
|
|
26
|
+
return Promise.reject(e);
|
|
27
|
+
})
|
|
28
|
+
.finally(() => amountOfRestorationThatShouldBeNeeded > 0
|
|
29
|
+
? amountOfRestorationThatShouldBeNeeded--
|
|
30
|
+
: 0);
|
|
31
|
+
}
|
|
32
|
+
exports.securePromise = securePromise;
|
|
33
|
+
/** This registers that a registration has been made an this will be recoverable */
|
|
34
|
+
function countRegistration() {
|
|
35
|
+
amountOfRestorationThatShouldBeNeeded++;
|
|
36
|
+
}
|
|
37
|
+
exports.countRegistration = countRegistration;
|
|
38
|
+
function resetRegistrationCounter() {
|
|
39
|
+
amountOfRestorationThatShouldBeNeeded = 0;
|
|
40
|
+
}
|
|
41
|
+
exports.resetRegistrationCounter = resetRegistrationCounter;
|
|
42
|
+
//# sourceMappingURL=AsyncProcessQueue.development.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AsyncProcessQueue.development.js","sourceRoot":"","sources":["../../src/context/AsyncProcessQueue.development.tsx"],"names":[],"mappings":";AAAA,wFAAwF;AACxF,uCAAuC;;;AAEvC,2DAAuD;AAEvD,uDAAuD;AACvD,IAAI,qCAAqC,GAAG,CAAC,CAAC;AAE9C;;;GAGG;AACH,SAAgB,aAAa,CAAI,OAAmB;IAClD,SAAS,QAAQ;QACf,IAAI,qCAAqC,KAAK,CAAC,EAAE;YAC/C,MAAM,IAAI,KAAK,CAAC,oCAAgB,CAAC,4BAA4B,CAAC,CAAC;SAChE;IACH,CAAC;IACD,OAAO,OAAO;SACX,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;QACV,QAAQ,EAAE,CAAC;QACX,OAAO,CAAC,CAAC;IACX,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;QACX,QAAQ,EAAE,CAAC;QACX,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC,CAAC;SACD,OAAO,CAAC,GAAG,EAAE,CACZ,qCAAqC,GAAG,CAAC;QACvC,CAAC,CAAC,qCAAqC,EAAE;QACzC,CAAC,CAAC,CAAC,CACN,CAAC;AACN,CAAC;AApBD,sCAoBC;AAED,mFAAmF;AACnF,SAAgB,iBAAiB;IAC/B,qCAAqC,EAAE,CAAC;AAC1C,CAAC;AAFD,8CAEC;AAED,SAAgB,wBAAwB;IACtC,qCAAqC,GAAG,CAAC,CAAC;AAC5C,CAAC;AAFD,4DAEC"}
|
|
@@ -0,0 +1,190 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.useAsyncProcessQueue = exports.useRecoveries = exports.useAsyncProcessQueueContext = exports.AsyncProcessQueueProvider = exports.AsyncQueueErrors = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const AsyncProcessQueue_development_1 = require("./AsyncProcessQueue.development");
|
|
29
|
+
var AsyncQueueErrors;
|
|
30
|
+
(function (AsyncQueueErrors) {
|
|
31
|
+
AsyncQueueErrors["RECOVERY_IS_NOT_BEING_CALLED"] = "A recovery is not set for this call. If the user reloads the page, this process will not return to the async list";
|
|
32
|
+
})(AsyncQueueErrors = exports.AsyncQueueErrors || (exports.AsyncQueueErrors = {}));
|
|
33
|
+
const Context = (0, react_1.createContext)(null);
|
|
34
|
+
function useCounter() {
|
|
35
|
+
const [count, setCounter] = (0, react_1.useState)(0);
|
|
36
|
+
return {
|
|
37
|
+
count,
|
|
38
|
+
setCounter,
|
|
39
|
+
increment: () => setCounter((prev) => prev + 1),
|
|
40
|
+
decrement: () => setCounter((prev) => prev - 1),
|
|
41
|
+
reset: () => setCounter(0),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* This propagates the utilitary functions
|
|
46
|
+
*/
|
|
47
|
+
function AsyncProcessQueueProvider({ children, recoveries, uiFactory, }) {
|
|
48
|
+
const targetRef = (0, react_1.useRef)(null);
|
|
49
|
+
const pendingCounter = useCounter();
|
|
50
|
+
const [UIs, setUIs] = (0, react_1.useState)([]);
|
|
51
|
+
if (process.env.NODE_ENV === "development")
|
|
52
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
53
|
+
if (!targetRef.current)
|
|
54
|
+
throw new Error(`The target for the async elements to transition to is not defined, please review your UI hierarchy`);
|
|
55
|
+
}, []);
|
|
56
|
+
const _recoveries = process.env.NODE_ENV === "development"
|
|
57
|
+
? Object.entries(recoveries).reduce((r, [k, v]) => (Object.assign(Object.assign({}, r), { [k]: Object.assign(Object.assign({}, v), { write: (...args) => {
|
|
58
|
+
(0, AsyncProcessQueue_development_1.countRegistration)();
|
|
59
|
+
return v.write(...args);
|
|
60
|
+
} }) })), {})
|
|
61
|
+
: recoveries;
|
|
62
|
+
const watchPromise = (0, react_1.useCallback)((promise, retry, uiType, ...uiParams) => {
|
|
63
|
+
const Factory = uiFactory(uiType);
|
|
64
|
+
const LoadingUIInstance = Object.assign(Object.assign({}, Factory("loading")), { status: "loading" });
|
|
65
|
+
if (process.env.NODE_ENV === "development" && !LoadingUIInstance.key)
|
|
66
|
+
throw new Error(`The UI generate for the async process should have a key`);
|
|
67
|
+
setUIs((prev) => [
|
|
68
|
+
...prev.filter((a) => a.key !== LoadingUIInstance.key),
|
|
69
|
+
LoadingUIInstance,
|
|
70
|
+
]);
|
|
71
|
+
promise.then((result) => {
|
|
72
|
+
// Write success UI
|
|
73
|
+
setUIs((prev) => prev.map((a) => a === LoadingUIInstance
|
|
74
|
+
? Object.assign(Object.assign({}, Factory("succeded")), { status: "succeded" }) : a));
|
|
75
|
+
return result;
|
|
76
|
+
});
|
|
77
|
+
promise.catch((error) => {
|
|
78
|
+
const UIInstance = Factory("failed", error, () => setUIs((prev) => prev.filter((ui) => ui !== UIInstance)), () => watchPromise(retry(), retry, uiType, ...uiParams));
|
|
79
|
+
// Write success UI
|
|
80
|
+
setUIs((prev) => prev.map((a) => a === LoadingUIInstance ? Object.assign(Object.assign({}, UIInstance), { status: "failed" }) : a));
|
|
81
|
+
throw error;
|
|
82
|
+
});
|
|
83
|
+
return promise;
|
|
84
|
+
}, []);
|
|
85
|
+
(0, react_1.useEffect)(() => {
|
|
86
|
+
for (let recovery in recoveries) {
|
|
87
|
+
const recoveredProcesses = recoveries[recovery].recover();
|
|
88
|
+
for (let [promise, ...recoveredProcess] of recoveredProcesses) {
|
|
89
|
+
watchPromise(promise.catch(() => { }), ...recoveredProcess);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}, []);
|
|
93
|
+
return (react_1.default.createElement(Context.Provider, { value: {
|
|
94
|
+
targetElRef: targetRef,
|
|
95
|
+
pendingTransactions: pendingCounter,
|
|
96
|
+
watchPromise,
|
|
97
|
+
setUIs,
|
|
98
|
+
UIs,
|
|
99
|
+
recoveries: _recoveries,
|
|
100
|
+
} }, children));
|
|
101
|
+
}
|
|
102
|
+
exports.AsyncProcessQueueProvider = AsyncProcessQueueProvider;
|
|
103
|
+
function useAsyncProcessQueueContext() {
|
|
104
|
+
return (0, react_1.useContext)(Context);
|
|
105
|
+
}
|
|
106
|
+
exports.useAsyncProcessQueueContext = useAsyncProcessQueueContext;
|
|
107
|
+
function calculateCenter(el) {
|
|
108
|
+
const boundsOnViewport = el.getBoundingClientRect();
|
|
109
|
+
return {
|
|
110
|
+
x: boundsOnViewport.x + boundsOnViewport.width / 2,
|
|
111
|
+
y: boundsOnViewport.y + boundsOnViewport.height / 2,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/** This exposes the recovery registration functions available for abtract types of calls */
|
|
115
|
+
function useRecoveries() {
|
|
116
|
+
return useAsyncProcessQueueContext().recoveries;
|
|
117
|
+
}
|
|
118
|
+
exports.useRecoveries = useRecoveries;
|
|
119
|
+
/**
|
|
120
|
+
* This function wraps other async functions and decides when the ongoing promise should be put on the queue or not
|
|
121
|
+
*/
|
|
122
|
+
function useAsyncProcessQueue(functionsToQueue, UIParamsFactory) {
|
|
123
|
+
const loadingRef = (0, react_1.useRef)(null);
|
|
124
|
+
const wrapped = (0, react_1.useRef)(false);
|
|
125
|
+
const elToTransitionToQueue = (0, react_1.useRef)(null);
|
|
126
|
+
const { targetElRef: targetEl, watchPromise } = (0, react_1.useContext)(Context);
|
|
127
|
+
const initialCenter = (0, react_1.useRef)();
|
|
128
|
+
(0, react_1.useEffect)(() => {
|
|
129
|
+
initialCenter.current = {
|
|
130
|
+
center: calculateCenter(targetEl.current),
|
|
131
|
+
dimensions: [
|
|
132
|
+
targetEl.current.clientWidth,
|
|
133
|
+
targetEl.current.clientHeight,
|
|
134
|
+
],
|
|
135
|
+
};
|
|
136
|
+
}, []);
|
|
137
|
+
const wrapQueue = (0, react_1.useCallback)(() => {
|
|
138
|
+
if (wrapped.current || !loadingRef.current)
|
|
139
|
+
return;
|
|
140
|
+
const wrapUI = loadingRef.current;
|
|
141
|
+
wrapped.current = true;
|
|
142
|
+
const clone = elToTransitionToQueue.current.cloneNode(true);
|
|
143
|
+
const currPositionOnViewport = elToTransitionToQueue.current.getBoundingClientRect();
|
|
144
|
+
const currPosCenter = calculateCenter(elToTransitionToQueue.current);
|
|
145
|
+
const targetCenter = targetEl.current
|
|
146
|
+
? calculateCenter(targetEl.current)
|
|
147
|
+
: initialCenter.current.center;
|
|
148
|
+
clone.style.position = "fixed";
|
|
149
|
+
clone.style.top = `${currPositionOnViewport.top}px`;
|
|
150
|
+
clone.style.left = `${currPositionOnViewport.left}px`;
|
|
151
|
+
clone.style.width = `${currPositionOnViewport.width}px`;
|
|
152
|
+
clone.style.height = `${currPositionOnViewport.height}px`;
|
|
153
|
+
clone.style.transition = `transform 250ms ease-out, opacity 250ms ease-in`;
|
|
154
|
+
clone.style.opacity = "1";
|
|
155
|
+
clone.ontransitionend = ({ target, currentTarget }) => {
|
|
156
|
+
if (target === currentTarget)
|
|
157
|
+
wrapUI();
|
|
158
|
+
};
|
|
159
|
+
const targetHeight = Math.min(targetEl.current
|
|
160
|
+
? targetEl.current.clientHeight
|
|
161
|
+
: initialCenter.current.dimensions[1], elToTransitionToQueue.current.clientHeight);
|
|
162
|
+
const targetWidth = Math.min(targetHeight, targetEl.current
|
|
163
|
+
? targetEl.current.clientWidth
|
|
164
|
+
: initialCenter.current.dimensions[0], elToTransitionToQueue.current.clientWidth);
|
|
165
|
+
const targetScaleX = targetWidth / elToTransitionToQueue.current.clientWidth;
|
|
166
|
+
const targetScaleY = targetHeight / elToTransitionToQueue.current.clientHeight;
|
|
167
|
+
document.body.appendChild(clone);
|
|
168
|
+
setTimeout(() => {
|
|
169
|
+
clone.style.opacity = "0";
|
|
170
|
+
clone.style.transform = `translateX(${targetCenter.x - currPosCenter.x}px) translateY(${targetCenter.y - currPosCenter.y}px) scaleX(${targetScaleX}) scaleY(${targetScaleY})`;
|
|
171
|
+
clone.addEventListener("transitionend", ({ target, currentTarget }) => {
|
|
172
|
+
if (target === currentTarget)
|
|
173
|
+
clone.remove();
|
|
174
|
+
});
|
|
175
|
+
}, 100);
|
|
176
|
+
}, []);
|
|
177
|
+
return Object.entries(functionsToQueue).reduce((r, [k, v]) => {
|
|
178
|
+
const _process = (...args) => {
|
|
179
|
+
let promise = v(...args);
|
|
180
|
+
loadingRef.current = () => watchPromise(promise, () => v(...args), ...UIParamsFactory(k));
|
|
181
|
+
promise.finally(() => (loadingRef.current = null));
|
|
182
|
+
if (process.env.NODE_ENV === "development")
|
|
183
|
+
promise = (0, AsyncProcessQueue_development_1.securePromise)(promise);
|
|
184
|
+
return promise;
|
|
185
|
+
};
|
|
186
|
+
return Object.assign(Object.assign({}, r), { [k]: _process });
|
|
187
|
+
}, { elToTransitionToQueue, wrapQueue });
|
|
188
|
+
}
|
|
189
|
+
exports.useAsyncProcessQueue = useAsyncProcessQueue;
|
|
190
|
+
//# sourceMappingURL=AsyncProcessQueue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AsyncProcessQueue.js","sourceRoot":"","sources":["../../src/context/AsyncProcessQueue.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAWe;AACf,mFAGyC;AAEzC,IAAY,gBAEX;AAFD,WAAY,gBAAgB;IAC1B,sKAAkJ,CAAA;AACpJ,CAAC,EAFW,gBAAgB,GAAhB,wB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AC,CAAC,MAAM,CAC5C,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE;QACZ,MAAM,QAAQ,GAAG,CAAC,GAAG,IAAW,EAAE,EAAE;YAClC,IAAI,OAAO,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;YACzB,UAAU,CAAC,OAAO,GAAG,GAAG,EAAE,CACxB,YAAY,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;YACjE,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC;YACnD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa;gBACxC,OAAO,GAAG,IAAA,6CAAa,EAAC,OAAO,CAAC,CAAC;YACnC,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC;QACF,uCACK,CAAC,KACJ,CAAC,CAAC,CAAC,EAAE,QAAQ,IACb;IACJ,CAAC,EACD,EAAE,qBAAqB,EAAE,SAAS,EAMjC,CACF,CAAC;AACJ,CAAC;AAhHD,oDAgHC"}
|
|
@@ -4,10 +4,10 @@ export declare function useOneUIContext(): {
|
|
|
4
4
|
text?: {
|
|
5
5
|
className?: {
|
|
6
6
|
link?: string | undefined;
|
|
7
|
+
description?: string | undefined;
|
|
7
8
|
caption?: string | undefined;
|
|
8
9
|
title?: string | undefined;
|
|
9
10
|
content?: string | undefined;
|
|
10
|
-
description?: string | undefined;
|
|
11
11
|
error?: string | undefined;
|
|
12
12
|
highlightTitle?: string | undefined;
|
|
13
13
|
highlight?: string | undefined;
|
|
@@ -30,12 +30,10 @@ const throttle_1 = __importDefault(require("lodash/throttle"));
|
|
|
30
30
|
function usePagination(request, paginationId = () => "default") {
|
|
31
31
|
const paginationDataRef = (0, react_1.useRef)({});
|
|
32
32
|
const { current: paginationData } = paginationDataRef;
|
|
33
|
-
const currentPageRef = (0, react_1.useRef)({});
|
|
34
|
-
const { current: currentPage } = currentPageRef;
|
|
35
33
|
const [items, setItems] = (0, react_1.useState)();
|
|
36
34
|
const _a = (0, useAsyncControl_1.default)(), { process } = _a, control = __rest(_a, ["process"]);
|
|
37
35
|
function updateItems(cb) {
|
|
38
|
-
setItems(prev => [prev[0], cb()]);
|
|
36
|
+
setItems(prev => [prev[0], cb(), prev[2]]);
|
|
39
37
|
}
|
|
40
38
|
const _requestPage = (0, react_1.useCallback)(function (page, ...args) {
|
|
41
39
|
var _a;
|
|
@@ -44,17 +42,22 @@ function usePagination(request, paginationId = () => "default") {
|
|
|
44
42
|
return;
|
|
45
43
|
process(() => __awaiter(this, void 0, void 0, function* () {
|
|
46
44
|
const result = yield request(page, (items === null || items === void 0 ? void 0 : items[0]) === id ? items === null || items === void 0 ? void 0 : items[1] : undefined, ...args);
|
|
47
|
-
currentPage[id] = page;
|
|
48
45
|
paginationData[id] = {
|
|
49
46
|
finished: result.finished,
|
|
50
47
|
totalItems: result.totalItems,
|
|
51
48
|
};
|
|
52
|
-
setItems(
|
|
49
|
+
setItems((prev) => {
|
|
50
|
+
if (page === 0)
|
|
51
|
+
return [id, result.items, page];
|
|
52
|
+
else if (!prev || id === prev[0])
|
|
53
|
+
return [id, result.items, page];
|
|
54
|
+
return prev;
|
|
55
|
+
});
|
|
53
56
|
}));
|
|
54
57
|
}, [items, request]);
|
|
55
58
|
return {
|
|
56
59
|
updateItems,
|
|
57
|
-
getNextPage: (...args) => _requestPage((
|
|
60
|
+
getNextPage: (...args) => _requestPage(((items === null || items === void 0 ? void 0 : items[2]) || 0) + 1, ...args),
|
|
58
61
|
getPage: _requestPage,
|
|
59
62
|
totalItems: (...args) => { var _a; return (_a = paginationData[paginationId(...args)]) === null || _a === void 0 ? void 0 : _a.totalItems; },
|
|
60
63
|
loading: control.loading,
|
|
@@ -98,6 +101,7 @@ exports.useContainerPagination = useContainerPagination;
|
|
|
98
101
|
* This function receives an amount of local instances and paginates it
|
|
99
102
|
*/
|
|
100
103
|
function useLocalPagination(items, pageSize) {
|
|
104
|
+
const instanceID = (0, react_1.useMemo)(() => Date.now(), [items]);
|
|
101
105
|
const cb = (0, react_1.useCallback)((page, currItems = []) => {
|
|
102
106
|
const from = pageSize * page;
|
|
103
107
|
const newArray = [...currItems, ...items.slice(from, from + pageSize)];
|
|
@@ -107,7 +111,6 @@ function useLocalPagination(items, pageSize) {
|
|
|
107
111
|
items: newArray
|
|
108
112
|
});
|
|
109
113
|
}, [pageSize, items]);
|
|
110
|
-
const instanceID = (0, react_1.useMemo)(() => Date.now(), [items]);
|
|
111
114
|
const pagination = usePagination(cb, () => `${instanceID}`);
|
|
112
115
|
return pagination;
|
|
113
116
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePagination.js","sourceRoot":"","sources":["../../src/hooks/usePagination.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"usePagination.js","sourceRoot":"","sources":["../../src/hooks/usePagination.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAA2F;AAC3F,wEAAgD;AAChD,+DAAuC;AAQvC,SAAwB,aAAa,CACnC,OAA6E,EAC7E,eAAuC,GAAG,EAAE,CAAC,SAAS;IAEtD,MAAM,iBAAiB,GAAG,IAAA,cAAM,EAO7B,EAAE,CAAC,CAAC;IACP,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,iBAAiB,CAAC;IAEtD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,GAAyD,CAAC;IAC5F,MAAM,KAA0B,IAAA,yBAAe,GAAE,EAA3C,EAAE,OAAO,OAAkC,EAA7B,OAAO,cAArB,WAAuB,CAAoB,CAAC;IAElD,SAAS,WAAW,CAAC,EAA8C;QACjE,QAAQ,CAAC,IAAI,CAAC,E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AE,OAAO,CAAC,CAAC;YACnE,MAAM,QAAQ,GAAG,SAAS;iBACvB,KAAK,CAAC,WAAW,CAAC;iBAClB,aAAa,CACZ,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,qBAAqB,KAAI,SAAS,CAAC,aAAa,EAAG,EAC5D,CAAC,CACF;iBACA,QAAQ,EAAE;iBACV,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACrB,OAAO,GAAG,OAAO,GAAG,QAAQ,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,gBAAgB,GAAG,QAAQ,EAAE,CAAC,CAAC,CAAC,EACxE,EAAE,CAAC;QACP,CAAC,IACD;AACJ,CAAC;AAhDD,+BAgDC;AAUD,SAAgB,eAAe,CAC7B,OAAU,EACV,OAAU;IAEV,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CACnC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,iCACV,CAAC,KACJ,CAAC,GAAG,OAAO,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,IACtB,EACF,EAA4C,CAC7C,CAAC;AACJ,CAAC;AAXD,0CAWC"}
|
package/{src → dist}/types.d.ts
RENAMED
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
type EnumerateInternal<A extends Array<unknown>, N extends number> = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export type
|
|
8
|
-
|
|
9
|
-
export type CommonErrorCodes = "UNEXPECTED_ERROR";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export type BasicContext<T extends object> = {
|
|
14
|
-
set: <P extends keyof T>(p: P, value: T[typeof p]) => void;
|
|
1
|
+
/// <reference path="../index.d.ts" />
|
|
2
|
+
declare type PrependNextNum<A extends Array<unknown>> = A['length'] extends infer T ? ((t: T, ...a: A) => void) extends ((...x: infer X) => void) ? X : never : never;
|
|
3
|
+
declare type EnumerateInternal<A extends Array<unknown>, N extends number> = {
|
|
4
|
+
0: A;
|
|
5
|
+
1: EnumerateInternal<PrependNextNum<A>, N>;
|
|
6
|
+
}[N extends A['length'] ? 0 : 1];
|
|
7
|
+
export declare type Enumerate<N extends number> = EnumerateInternal<[], N> extends (infer E)[] ? E : never;
|
|
8
|
+
export declare type Range<FROM extends number, TO extends number> = Exclude<Enumerate<TO>, Enumerate<FROM>>;
|
|
9
|
+
export declare type CommonErrorCodes = "UNEXPECTED_ERROR";
|
|
10
|
+
export declare type BasicContext<T extends object> = {
|
|
11
|
+
set: <P extends keyof T>(p: P, value: T[typeof p]) => void;
|
|
15
12
|
} & T;
|
|
16
|
-
|
|
17
13
|
/**
|
|
18
14
|
* This is usefull for omitting props from union
|
|
19
15
|
* Check whz contestation model to see an example
|
|
@@ -23,63 +19,55 @@ export type BasicContext<T extends object> = {
|
|
|
23
19
|
*
|
|
24
20
|
* This typing solves that
|
|
25
21
|
*/
|
|
26
|
-
export type DistributiveOmit<T, K extends keyof any> = T extends any
|
|
27
|
-
? Omit<T, K>
|
|
28
|
-
: never;
|
|
29
|
-
|
|
22
|
+
export declare type DistributiveOmit<T, K extends keyof any> = T extends any ? Omit<T, K> : never;
|
|
30
23
|
declare global {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
24
|
+
interface Window {
|
|
25
|
+
ethereum: any;
|
|
26
|
+
PRERENDER: boolean;
|
|
27
|
+
Cypress: any;
|
|
28
|
+
}
|
|
36
29
|
}
|
|
37
|
-
type NestedValue = unknown;
|
|
38
|
-
type FieldValues = unknown;
|
|
39
|
-
|
|
30
|
+
declare type NestedValue = unknown;
|
|
31
|
+
declare type FieldValues = unknown;
|
|
40
32
|
export declare type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
|
41
33
|
export declare type EmptyObject = {
|
|
42
|
-
|
|
34
|
+
[K in string | number]: never;
|
|
43
35
|
};
|
|
44
36
|
export declare type NonUndefined<T> = T extends undefined ? never : T;
|
|
45
37
|
export declare type LiteralUnion<T extends U, U extends Primitive> = T | (U & {
|
|
46
|
-
|
|
38
|
+
_?: never;
|
|
47
39
|
});
|
|
48
40
|
export declare type DeepPartial<T> = T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
|
49
|
-
|
|
41
|
+
[key in keyof T]: T[key];
|
|
50
42
|
} ? {
|
|
51
43
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
52
|
-
|
|
44
|
+
} : T;
|
|
53
45
|
export declare type IsAny<T> = boolean extends (T extends never ? true : false) ? true : false;
|
|
54
46
|
export declare type DeepMap<T, TValue> = {
|
|
55
|
-
|
|
47
|
+
[K in keyof T]?: IsAny<T[K]> extends true ? any : NonNullable<T[K]> extends NestedValue | Date | FileList | File ? TValue : NonUndefined<T[K]> extends object | null ? DeepMap<T[K], TValue> : NonUndefined<T[K]> extends Array<infer U> ? IsAny<U> extends true ? Array<any> : U extends NestedValue | Date | FileList ? Array<TValue> : U extends object ? Array<DeepMap<U, TValue>> : Array<TValue> : TValue;
|
|
56
48
|
};
|
|
57
49
|
export declare type IsFlatObject<T extends object> = Extract<Exclude<T[keyof T], NestedValue | Date | FileList>, any[] | object> extends never ? true : false;
|
|
58
50
|
declare type IsTuple<T extends ReadonlyArray<any>> = number extends T['length'] ? false : true;
|
|
59
51
|
declare type TupleKey<T extends ReadonlyArray<any>> = Exclude<keyof T, keyof any[]>;
|
|
60
52
|
declare type ArrayKey = number;
|
|
61
53
|
declare type PathImpl<K extends string | number, V> = V extends Primitive ? `${K}` : `${K}.${Path<V>}`;
|
|
62
|
-
export declare type Path<T> = T extends ReadonlyArray<infer V>
|
|
63
|
-
?
|
|
64
|
-
IsTuple<T> extends true
|
|
65
|
-
? {
|
|
54
|
+
export declare type Path<T> = T extends ReadonlyArray<infer V> ? IsTuple<T> extends true ? {
|
|
66
55
|
[K in TupleKey<T>]-?: PathImpl<K & string, T[K]>;
|
|
67
|
-
|
|
68
|
-
: PathImpl<ArrayKey, V>
|
|
69
|
-
: {
|
|
56
|
+
}[TupleKey<T>] : PathImpl<ArrayKey, V> : {
|
|
70
57
|
[K in keyof T]-?: PathImpl<K & string, T[K]>;
|
|
71
|
-
|
|
58
|
+
}[keyof T];
|
|
72
59
|
export declare type FieldPath<TFieldValues extends FieldValues> = Path<TFieldValues>;
|
|
73
60
|
declare type ArrayPathImpl<K extends string | number, V> = V extends Primitive ? never : V extends ReadonlyArray<infer U> ? U extends Primitive ? never : `${K}` | `${K}.${ArrayPath<V>}` : `${K}.${ArrayPath<V>}`;
|
|
74
61
|
export declare type ArrayPath<T> = T extends ReadonlyArray<infer V> ? IsTuple<T> extends true ? {
|
|
75
|
-
|
|
62
|
+
[K in TupleKey<T>]-?: ArrayPathImpl<K & string, T[K]>;
|
|
76
63
|
}[TupleKey<T>] : ArrayPathImpl<ArrayKey, V> : {
|
|
77
|
-
|
|
64
|
+
[K in keyof T]-?: ArrayPathImpl<K & string, T[K]>;
|
|
78
65
|
}[keyof T];
|
|
79
66
|
export declare type FieldArrayPath<TFieldValues extends FieldValues> = ArrayPath<TFieldValues>;
|
|
80
67
|
export declare type PathValue<T, P extends Path<T> | ArrayPath<T>> = P extends `${infer K}.${infer R}` ? K extends keyof T ? R extends Path<T[K]> ? PathValue<T[K], R> : never : K extends `${ArrayKey}` ? T extends ReadonlyArray<infer V> ? PathValue<V, R & Path<V>> : never : never : P extends keyof T ? T[P] : P extends `${ArrayKey}` ? T extends ReadonlyArray<infer V> ? V : never : never;
|
|
81
68
|
export declare type FieldPathValue<TFieldValues extends FieldValues, TFieldPath extends FieldPath<TFieldValues>> = PathValue<TFieldValues, TFieldPath>;
|
|
82
69
|
export declare type FieldArrayPathValue<TFieldValues extends FieldValues, TFieldArrayPath extends FieldArrayPath<TFieldValues>> = PathValue<TFieldValues, TFieldArrayPath>;
|
|
83
70
|
export declare type FieldPathValues<TFieldValues extends FieldValues, TPath extends FieldPath<TFieldValues>[] | readonly FieldPath<TFieldValues>[]> = {} & {
|
|
84
|
-
|
|
85
|
-
};
|
|
71
|
+
[K in keyof TPath]: FieldPathValue<TFieldValues, TPath[K] & FieldPath<TFieldValues>>;
|
|
72
|
+
};
|
|
73
|
+
export {};
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,qCAAqC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onepercentio/one-ui",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.5-beta.1",
|
|
4
4
|
"description": "A set of reusable components created through the development of Onepercent projects",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"repository": "git@github.com:onepercentio/one-ui.git",
|
|
15
15
|
"author": "Murilo Oliveira de Araujo <muritavo@outlook.com>",
|
|
16
16
|
"license": "MIT",
|
|
17
|
-
"types": "
|
|
17
|
+
"types": "index.d.ts",
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@babel/core": "^7.16.0",
|
|
20
20
|
"@cypress/react": "^5.12.5",
|
|
@@ -92,14 +92,14 @@
|
|
|
92
92
|
"build-storybook": "build-storybook",
|
|
93
93
|
"prebuild": "cd src",
|
|
94
94
|
"copy-css": "cpy --cwd=\"src\" \"**/*.{scss,svg}\" \"../dist\" --parents",
|
|
95
|
-
"build": "tsc && npm run copy-css",
|
|
95
|
+
"build": "tsc && npm run copy-css && yarn dts-generator --project ./ --out index.d.ts --prefix @onepercentio/one-ui/dist --exclude **/*.stories.* --exclude **/index.* --exclude **/*.test.*",
|
|
96
96
|
"postbuild": "cd ..",
|
|
97
97
|
"dev": "tsc --watch",
|
|
98
98
|
"test:watch": "jest --watchAll --coverage",
|
|
99
99
|
"deploy:storybook": "yarn build-storybook && firebase deploy --only hosting",
|
|
100
|
-
"test:e2e:watch": "cypress open --component --port 6005 --browser
|
|
100
|
+
"test:e2e:watch": "cypress open --component --port 6005 --browser chrome",
|
|
101
101
|
"test:e2e": "cypress run --component --port 6015 --browser chrome",
|
|
102
|
-
"
|
|
102
|
+
"prepack": "yarn build"
|
|
103
103
|
},
|
|
104
104
|
"browserslist": {
|
|
105
105
|
"production": [
|
|
@@ -117,4 +117,4 @@
|
|
|
117
117
|
"chroma-js": "^2.4.2",
|
|
118
118
|
"use-wallet": "0.13.5"
|
|
119
119
|
}
|
|
120
|
-
}
|
|
120
|
+
}
|