@onepercentio/one-ui 0.8.1 → 0.8.3
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/dist/hooks/usePagination.d.ts +1 -0
- package/dist/hooks/usePagination.js +2 -2
- package/dist/hooks/usePagination.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/AdaptiveButton/AdaptiveButton.module.scss +0 -51
- package/dist/components/Background/Background.d.ts +0 -7
- package/dist/components/Background/Background.js +0 -58
- package/dist/components/Background/Background.js.map +0 -1
- package/dist/components/Background/Background.module.scss +0 -106
- package/dist/components/Background/Background.stories.d.ts +0 -7
- package/dist/components/Background/Background.stories.js +0 -30
- package/dist/components/Background/Background.stories.js.map +0 -1
- package/dist/components/Background/ground-tile.svg +0 -9
- package/dist/components/Background/index.d.ts +0 -1
- package/dist/components/Background/index.js +0 -9
- package/dist/components/Background/index.js.map +0 -1
- package/dist/components/Transition/TransitionContainer/TransitionContainer.d.ts +0 -4
- package/dist/components/Transition/TransitionContainer/TransitionContainer.js +0 -14
- package/dist/components/Transition/TransitionContainer/TransitionContainer.js.map +0 -1
- package/dist/components/Transition/TransitionContainer/index.d.ts +0 -1
- package/dist/components/Transition/TransitionContainer/index.js +0 -9
- package/dist/components/Transition/TransitionContainer/index.js.map +0 -1
- package/dist/context/AsyncProcessQueue.d.ts +0 -37
- package/dist/context/AsyncProcessQueue.js +0 -160
- package/dist/context/AsyncProcessQueue.js.map +0 -1
- package/dist/context/OneUIProvider.test.d.ts +0 -1
- package/dist/context/OneUIProvider.test.js +0 -45
- package/dist/context/OneUIProvider.test.js.map +0 -1
- package/dist/types.d.ts +0 -85
|
@@ -40,7 +40,7 @@ function usePagination(request, paginationId = () => "default") {
|
|
|
40
40
|
const _requestPage = (0, react_1.useCallback)(function (page, ...args) {
|
|
41
41
|
var _a;
|
|
42
42
|
const id = paginationId(...args);
|
|
43
|
-
if ((
|
|
43
|
+
if ((_a = paginationData[id]) === null || _a === void 0 ? void 0 : _a.finished)
|
|
44
44
|
return;
|
|
45
45
|
process(() => __awaiter(this, void 0, void 0, function* () {
|
|
46
46
|
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);
|
|
@@ -51,7 +51,7 @@ function usePagination(request, paginationId = () => "default") {
|
|
|
51
51
|
};
|
|
52
52
|
setItems([id, result.items]);
|
|
53
53
|
}));
|
|
54
|
-
}, [items, request
|
|
54
|
+
}, [items, request]);
|
|
55
55
|
return {
|
|
56
56
|
updateItems,
|
|
57
57
|
getNextPage: (...args) => _requestPage((currentPage[paginationId(...args)] || 0) + 1, ...args),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePagination.js","sourceRoot":"","sources":["../../src/hooks/usePagination.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAA0E;AAC1E,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,GAAG,IAAA,cAAM,EAA0B,EAAE,CAAC,CAAC;IAC3D,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,cAAc,CAAC;IAEhD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,GAAe,CAAC;IAClD,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,EAAE,CAAC,CAAC,IAAK,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,C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AG,SAAS,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAA;QACtE,OAAO,OAAO,CAAC,OAAO,CAAC;YACrB,QAAQ,EAAE,QAAQ,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM;YAC1C,UAAU,EAAE,KAAK,CAAC,MAAM;YACxB,KAAK,EAAE,QAAQ;SAChB,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAA;IACrB,MAAM,UAAU,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IACtD,MAAM,UAAU,GAAG,aAAa,CAAU,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,UAAU,EAAE,CAAC,CAAC;IAErE,OAAO,UAAU,CAAA;AACnB,CAAC;AAdD,gDAcC"}
|
package/package.json
CHANGED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
.resetSection {
|
|
2
|
-
min-height: 0px;
|
|
3
|
-
transition: width 400ms;
|
|
4
|
-
transition-timing-function: linear;
|
|
5
|
-
overflow: hidden;
|
|
6
|
-
> * {
|
|
7
|
-
min-width: auto !important;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.resetButton {
|
|
12
|
-
min-width: 0px !important;
|
|
13
|
-
white-space: nowrap;
|
|
14
|
-
display: flex;
|
|
15
|
-
align-items: center;
|
|
16
|
-
text-align: center;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@keyframes fadeInDelayed {
|
|
20
|
-
0% {
|
|
21
|
-
opacity: 0;
|
|
22
|
-
}
|
|
23
|
-
50% {
|
|
24
|
-
opacity: 0.1;
|
|
25
|
-
}
|
|
26
|
-
100% {
|
|
27
|
-
opacity: 1;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
@keyframes fadeOutDelayed {
|
|
31
|
-
0% {
|
|
32
|
-
opacity: 1;
|
|
33
|
-
}
|
|
34
|
-
50% {
|
|
35
|
-
opacity: 0.1;
|
|
36
|
-
}
|
|
37
|
-
100% {
|
|
38
|
-
opacity: 0;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.fadeInDelayed {
|
|
43
|
-
animation-name: fadeInDelayed;
|
|
44
|
-
animation-duration: 500ms !important;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.fadeOutAbsolute {
|
|
48
|
-
position: absolute;
|
|
49
|
-
animation-name: fadeOutDelayed;
|
|
50
|
-
animation-duration: 500ms !important;
|
|
51
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const react_1 = __importStar(require("react"));
|
|
30
|
-
const Background_module_scss_1 = __importDefault(require("./Background.module.scss"));
|
|
31
|
-
const throttle_1 = __importDefault(require("lodash/throttle"));
|
|
32
|
-
/**
|
|
33
|
-
* An animated background that represents a 3d environment and places the user into a cenario
|
|
34
|
-
**/
|
|
35
|
-
function Background({ pointTo = "north", color, }) {
|
|
36
|
-
const base = (0, react_1.useRef)(null);
|
|
37
|
-
(0, react_1.useEffect)(() => {
|
|
38
|
-
const func = (0, throttle_1.default)((e) => {
|
|
39
|
-
const razao = document.body.clientWidth / document.body.clientHeight;
|
|
40
|
-
const baseX = 1;
|
|
41
|
-
const baseY = baseX * razao;
|
|
42
|
-
const percentX = (e.x * 100) / document.body.clientWidth / 100;
|
|
43
|
-
const percentY = (e.y * 100) / document.body.clientHeight / 100;
|
|
44
|
-
const perspectiveOffsetX = baseX * percentX - baseX / 2;
|
|
45
|
-
const perspectiveOffsetY = baseY * percentY - baseY / 2;
|
|
46
|
-
base.current.style.perspectiveOrigin = `${50 - perspectiveOffsetX}% ${40 - perspectiveOffsetY}%`;
|
|
47
|
-
}, 1000 / 15);
|
|
48
|
-
window.addEventListener("mousemove", func);
|
|
49
|
-
return () => {
|
|
50
|
-
window.removeEventListener("mousemove", func);
|
|
51
|
-
};
|
|
52
|
-
}, []);
|
|
53
|
-
return (react_1.default.createElement("div", { ref: base, style: { "--halo": color }, className: `${Background_module_scss_1.default.background} ${Background_module_scss_1.default[pointTo]}` },
|
|
54
|
-
react_1.default.createElement("div", { className: Background_module_scss_1.default.ground }),
|
|
55
|
-
react_1.default.createElement("div", { className: Background_module_scss_1.default.overlay })));
|
|
56
|
-
}
|
|
57
|
-
exports.default = Background;
|
|
58
|
-
//# sourceMappingURL=Background.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Background.js","sourceRoot":"","sources":["../../../src/components/Background/Background.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiD;AACjD,sFAA8C;AAC9C,+DAAuC;AAEvC;;IAEI;AACJ,SAAwB,UAAU,CAAC,EACjC,OAAO,GAAG,OAAO,EACjB,KAAK,GAIN;IACC,MAAM,IAAI,GAAG,IAAA,cAAM,EAAiB,IAAI,CAAC,CAAC;IAC1C,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,IAAI,GAAG,IAAA,kBAAQ,EAAC,CAAC,CAAa,EAAE,EAAE;YACtC,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC;YACrE,MAAM,KAAK,GAAG,CAAC,CAAC;YAChB,MAAM,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;YAC5B,MAAM,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,WAAW,GAAG,GAAG,CAAC;YAC/D,MAAM,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,YAAY,GAAG,GAAG,CAAC;YAChE,MAAM,kBAAkB,GAAG,KAAK,GAAG,QAAQ,GAAG,KAAK,GAAG,CAAC,CAAC;YACxD,MAAM,kBAAkB,GAAG,KAAK,GAAG,QAAQ,GAAG,KAAK,GAAG,CAAC,CAAC;YACxD,IAAI,CAAC,OAAQ,CAAC,KAAK,CAAC,iBAAiB,GAAG,GAAG,EAAE,GAAG,kBAAkB,KAChE,EAAE,GAAG,kBACP,GAAG,CAAC;QACN,CAAC,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QACd,MAAM,CAAC,gBAAgB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAC3C,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,mBAAmB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAChD,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,CACL,uCACE,GAAG,EAAE,IAAI,EACT,KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAS,EACjC,SAAS,EAAE,GAAG,gCAAM,CAAC,UAAU,IAAI,gCAAM,CAAC,OAAO,CAAC,EAAE;QAEpD,uCAAK,SAAS,EAAE,gCAAM,CAAC,MAAM,GAAI;QACjC,uCAAK,SAAS,EAAE,gCAAM,CAAC,OAAO,GAAI,CAC9B,CACP,CAAC;AACJ,CAAC;AApCD,6BAoCC"}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
$renderResolutionWidth: 50vw;
|
|
2
|
-
$renderResolutionHeight: 50vh;
|
|
3
|
-
$blockSize: $renderResolutionWidth * 0.1;
|
|
4
|
-
|
|
5
|
-
* {
|
|
6
|
-
-webkit-font-smoothing: subpixel-antialiased;
|
|
7
|
-
outline: 1px solid transparent;
|
|
8
|
-
--primary-color: blue;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.overlay {
|
|
12
|
-
position: absolute;
|
|
13
|
-
height: $renderResolutionHeight / 10;
|
|
14
|
-
width: $renderResolutionWidth / 10;
|
|
15
|
-
transform: scale(10);
|
|
16
|
-
background: radial-gradient(
|
|
17
|
-
circle at 50% -100%,
|
|
18
|
-
rgba(33, 0, 59, 0.5),
|
|
19
|
-
rgba(33, 0, 59, 0.5) 40%,
|
|
20
|
-
rgba(66, 35, 91, 0.5) 65%,
|
|
21
|
-
#0000 80%
|
|
22
|
-
);
|
|
23
|
-
background-repeat: no-repeat;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.background {
|
|
27
|
-
overflow: hidden;
|
|
28
|
-
image-rendering: 10px 10px;
|
|
29
|
-
background-color: black;
|
|
30
|
-
image-rendering: optimizeSpeed;
|
|
31
|
-
background-repeat: no-repeat;
|
|
32
|
-
background-size: $renderResolutionWidth $renderResolutionHeight * 0.5;
|
|
33
|
-
width: $renderResolutionWidth;
|
|
34
|
-
height: $renderResolutionHeight;
|
|
35
|
-
perspective: $renderResolutionWidth * 0.9;
|
|
36
|
-
perspective-origin: 50% 40%;
|
|
37
|
-
position: absolute;
|
|
38
|
-
display: flex;
|
|
39
|
-
justify-content: center;
|
|
40
|
-
align-items: center;
|
|
41
|
-
z-index: -1;
|
|
42
|
-
transition: perspective-origin;
|
|
43
|
-
transition-duration: var(--animation-speed-transition);
|
|
44
|
-
top: 50vh - $renderResolutionHeight / 2;
|
|
45
|
-
left: 50vw - $renderResolutionWidth / 2;
|
|
46
|
-
transform: scale(100vw / $renderResolutionWidth);
|
|
47
|
-
|
|
48
|
-
& .ground {
|
|
49
|
-
transform: rotateX(90deg) translateY(50%) translateZ(-75px) rotateZ(0deg);
|
|
50
|
-
}
|
|
51
|
-
&.north .ground {
|
|
52
|
-
transform: rotateX(90deg) translateY(50%) translateZ(-75px) rotateZ(0deg)
|
|
53
|
-
rotateZ(0deg);
|
|
54
|
-
}
|
|
55
|
-
&.south .ground {
|
|
56
|
-
transform: rotateX(90deg) translateY(50%) translateZ(-75px) rotateZ(0deg)
|
|
57
|
-
rotateZ(180deg);
|
|
58
|
-
}
|
|
59
|
-
&.east .ground {
|
|
60
|
-
transform: rotateX(90deg) translateY(50%) translateZ(-75px) rotateZ(0deg)
|
|
61
|
-
rotateZ(90deg);
|
|
62
|
-
}
|
|
63
|
-
&.west .ground {
|
|
64
|
-
transform: rotateX(90deg) translateY(50%) translateZ(-75px) rotateZ(0deg)
|
|
65
|
-
rotateZ(270deg);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
$tileSize: $renderResolutionHeight * 0.075 * 1.5;
|
|
70
|
-
.ground {
|
|
71
|
-
width: $renderResolutionWidth * 3 * (100vw / $renderResolutionWidth);
|
|
72
|
-
height: $renderResolutionWidth * 3 * (100vw / $renderResolutionWidth);
|
|
73
|
-
transition: transform var(--animation-speed-transition) var(--animation-timing-transition);
|
|
74
|
-
&::before {
|
|
75
|
-
backface-visibility: hidden;
|
|
76
|
-
content: "";
|
|
77
|
-
position: absolute;
|
|
78
|
-
width: $renderResolutionWidth * 3 * (100vw / $renderResolutionWidth);
|
|
79
|
-
height: $renderResolutionWidth * 3 * (100vw / $renderResolutionWidth);
|
|
80
|
-
border-radius: 50%;
|
|
81
|
-
background: url(./ground-tile.svg);
|
|
82
|
-
background-size: $tileSize $tileSize;
|
|
83
|
-
background-position: -18px 30px;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
position: absolute;
|
|
87
|
-
display: flex;
|
|
88
|
-
align-items: center;
|
|
89
|
-
justify-content: center;
|
|
90
|
-
|
|
91
|
-
&::after {
|
|
92
|
-
content: "";
|
|
93
|
-
width: $renderResolutionWidth * 3;
|
|
94
|
-
height: $renderResolutionWidth * 3;
|
|
95
|
-
transform: scale(4);
|
|
96
|
-
background: radial-gradient(
|
|
97
|
-
transparent 20%,
|
|
98
|
-
rgba(33, 0, 59, 1) 40%,
|
|
99
|
-
rgba(33, 0, 59, 0.6) 59%,
|
|
100
|
-
#0009 70%
|
|
101
|
-
);
|
|
102
|
-
// background-color: red;
|
|
103
|
-
border-radius: 50%;
|
|
104
|
-
position: absolute;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.InitialImplementation = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const OneUIProvider_1 = __importDefault(require("../../context/OneUIProvider"));
|
|
9
|
-
const Loader_1 = __importDefault(require("../Loader"));
|
|
10
|
-
const Background_1 = __importDefault(require("./Background"));
|
|
11
|
-
exports.default = {
|
|
12
|
-
component: Background_1.default,
|
|
13
|
-
title: "Sky",
|
|
14
|
-
};
|
|
15
|
-
const InitialImplementation = (args) => (react_1.default.createElement(OneUIProvider_1.default, { config: {
|
|
16
|
-
component: {
|
|
17
|
-
asyncWrapper: {
|
|
18
|
-
LoadingComponent: () => react_1.default.createElement(Loader_1.default, null),
|
|
19
|
-
messages: {
|
|
20
|
-
error: {
|
|
21
|
-
title: "Exemplo de error",
|
|
22
|
-
retryBtn: "Tentar novamente",
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
} },
|
|
28
|
-
react_1.default.createElement(Background_1.default, Object.assign({}, args))));
|
|
29
|
-
exports.InitialImplementation = InitialImplementation;
|
|
30
|
-
//# sourceMappingURL=Background.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Background.stories.js","sourceRoot":"","sources":["../../../src/components/Background/Background.stories.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,gFAAwD;AACxD,uDAA+B;AAC/B,8DAAwC;AAExC,kBAAe;IACb,SAAS,EAAE,oBAAY;IACvB,KAAK,EAAE,KAAK;CACb,CAAC;AAEK,MAAM,qBAAqB,GAAG,CAAC,IAAS,EAAE,EAAE,CAAC,CAClD,8BAAC,uBAAa,IACZ,MAAM,EAAE;QACN,SAAS,EAAE;YACT,YAAY,EAAE;gBACZ,gBAAgB,EAAE,GAAG,EAAE,CAAC,8BAAC,gBAAM,OAAG;gBAClC,QAAQ,EAAE;oBACR,KAAK,EAAE;wBACL,KAAK,EAAE,kBAAkB;wBACzB,QAAQ,EAAE,kBAAkB;qBAC7B;iBACF;aACF;SACF;KACF;IAED,8BAAC,oBAAY,oBAAK,IAAI,EAAI,CACZ,CACjB,CAAC;AAlBW,QAAA,qBAAqB,yBAkBhC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<svg viewBox="0 0 400 400" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="none">
|
|
2
|
-
|
|
3
|
-
<defs>
|
|
4
|
-
<filter id="blur">
|
|
5
|
-
<feGaussianBlur stdDeviation="1" />
|
|
6
|
-
</filter>
|
|
7
|
-
</defs>
|
|
8
|
-
<rect width="400" height="400" stroke-width="6" stroke="#d0b9fc" fill="#0000" />
|
|
9
|
-
</svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './Background';
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var Background_1 = require("./Background");
|
|
8
|
-
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(Background_1).default; } });
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Background/index.tsx"],"names":[],"mappings":";;;;;;AAAA,2CAAuC;AAA9B,sHAAA,OAAO,OAAA"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = __importDefault(require("react"));
|
|
7
|
-
/**
|
|
8
|
-
* This holds the logic for switching transition modes inside the content container
|
|
9
|
-
**/
|
|
10
|
-
function TransitionContainer() {
|
|
11
|
-
return react_1.default.createElement(react_1.default.Fragment, null, "TransitionContainer");
|
|
12
|
-
}
|
|
13
|
-
exports.default = TransitionContainer;
|
|
14
|
-
//# sourceMappingURL=TransitionContainer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TransitionContainer.js","sourceRoot":"","sources":["../../../../src/components/Transition/TransitionContainer/TransitionContainer.tsx"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAI1B;;IAEI;AACJ,SAAwB,mBAAmB;IAEvC,OAAO,oFAAwB,CAAC;AACpC,CAAC;AAHD,sCAGC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './TransitionContainer';
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var TransitionContainer_1 = require("./TransitionContainer");
|
|
8
|
-
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(TransitionContainer_1).default; } });
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Transition/TransitionContainer/index.tsx"],"names":[],"mappings":";;;;;;AAAA,6DAAgD;AAAvC,+HAAA,OAAO,OAAA"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import React, { PropsWithChildren, ReactElement, RefObject } from "react";
|
|
2
|
-
declare type ReactElementWithState = ReactElement & {
|
|
3
|
-
status: "loading" | "succeded" | "failed";
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* This propagates the utilitary functions
|
|
7
|
-
*/
|
|
8
|
-
export declare function AsyncProcessQueueProvider({ children }: PropsWithChildren<{}>): JSX.Element;
|
|
9
|
-
export declare function useAsyncProcessQueueContext(): {
|
|
10
|
-
targetElRef: React.RefObject<HTMLElement>;
|
|
11
|
-
pendingTransactions: {
|
|
12
|
-
count: number;
|
|
13
|
-
setCounter: React.Dispatch<React.SetStateAction<number>>;
|
|
14
|
-
increment: () => void;
|
|
15
|
-
decrement: () => void;
|
|
16
|
-
reset: () => void;
|
|
17
|
-
};
|
|
18
|
-
UIs: ReactElementWithState[];
|
|
19
|
-
setUIs: (func: (prev: ReactElementWithState[]) => ReactElementWithState[]) => void;
|
|
20
|
-
};
|
|
21
|
-
declare type AsyncProcessStatuses = "loading" | "succeded" | "failed";
|
|
22
|
-
export interface UIStateFactory {
|
|
23
|
-
(status: AsyncProcessStatuses, error?: Error, dismiss?: () => void, retry?: () => void): ReactElement;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* This function wraps other async functions and decides when the ongoing promise should be put on the queue or not
|
|
27
|
-
*/
|
|
28
|
-
export declare function useAsyncProcessQueue<T extends {
|
|
29
|
-
[k: string]: (...args: any[]) => Promise<any>;
|
|
30
|
-
}>(functionsToQueue: T, UIFactory: (functionName: keyof T) => UIStateFactory): T & {
|
|
31
|
-
elToTransitionToQueue: RefObject<HTMLElement>;
|
|
32
|
-
/**
|
|
33
|
-
* Function that wraps the current running actions and animates to the target queue element
|
|
34
|
-
*/
|
|
35
|
-
wrapQueue: () => void;
|
|
36
|
-
};
|
|
37
|
-
export {};
|
|
@@ -1,160 +0,0 @@
|
|
|
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.useAsyncProcessQueueContext = exports.AsyncProcessQueueProvider = void 0;
|
|
27
|
-
const react_1 = __importStar(require("react"));
|
|
28
|
-
const Context = (0, react_1.createContext)(null);
|
|
29
|
-
function useCounter() {
|
|
30
|
-
const [count, setCounter] = (0, react_1.useState)(0);
|
|
31
|
-
return {
|
|
32
|
-
count,
|
|
33
|
-
setCounter,
|
|
34
|
-
increment: () => setCounter((prev) => prev + 1),
|
|
35
|
-
decrement: () => setCounter((prev) => prev - 1),
|
|
36
|
-
reset: () => setCounter(0),
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* This propagates the utilitary functions
|
|
41
|
-
*/
|
|
42
|
-
function AsyncProcessQueueProvider({ children }) {
|
|
43
|
-
const targetRef = (0, react_1.useRef)(null);
|
|
44
|
-
const pendingCounter = useCounter();
|
|
45
|
-
const [UIs, setUIs] = (0, react_1.useState)([]);
|
|
46
|
-
return (react_1.default.createElement(Context.Provider, { value: {
|
|
47
|
-
targetElRef: targetRef,
|
|
48
|
-
pendingTransactions: pendingCounter,
|
|
49
|
-
setUIs,
|
|
50
|
-
UIs,
|
|
51
|
-
} }, children));
|
|
52
|
-
}
|
|
53
|
-
exports.AsyncProcessQueueProvider = AsyncProcessQueueProvider;
|
|
54
|
-
function useAsyncProcessQueueContext() {
|
|
55
|
-
return (0, react_1.useContext)(Context);
|
|
56
|
-
}
|
|
57
|
-
exports.useAsyncProcessQueueContext = useAsyncProcessQueueContext;
|
|
58
|
-
function calculateCenter(el) {
|
|
59
|
-
const boundsOnViewport = el.getBoundingClientRect();
|
|
60
|
-
return {
|
|
61
|
-
x: boundsOnViewport.x + boundsOnViewport.width / 2,
|
|
62
|
-
y: boundsOnViewport.y + boundsOnViewport.height / 2,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* This function wraps other async functions and decides when the ongoing promise should be put on the queue or not
|
|
67
|
-
*/
|
|
68
|
-
function useAsyncProcessQueue(functionsToQueue, UIFactory) {
|
|
69
|
-
const loadingRef = (0, react_1.useRef)(null);
|
|
70
|
-
const wrapped = (0, react_1.useRef)(false);
|
|
71
|
-
const elToTransitionToQueue = (0, react_1.useRef)(null);
|
|
72
|
-
const { targetElRef: targetEl, setUIs } = (0, react_1.useContext)(Context);
|
|
73
|
-
const initialCenter = (0, react_1.useRef)();
|
|
74
|
-
(0, react_1.useEffect)(() => {
|
|
75
|
-
initialCenter.current = {
|
|
76
|
-
center: calculateCenter(targetEl.current),
|
|
77
|
-
dimensions: [
|
|
78
|
-
targetEl.current.clientWidth,
|
|
79
|
-
targetEl.current.clientHeight,
|
|
80
|
-
],
|
|
81
|
-
};
|
|
82
|
-
}, []);
|
|
83
|
-
const wrapQueue = (0, react_1.useCallback)(() => {
|
|
84
|
-
if (wrapped.current || !loadingRef.current)
|
|
85
|
-
return;
|
|
86
|
-
const wrapUI = loadingRef.current;
|
|
87
|
-
wrapped.current = true;
|
|
88
|
-
const clone = elToTransitionToQueue.current.cloneNode(true);
|
|
89
|
-
const currPositionOnViewport = elToTransitionToQueue.current.getBoundingClientRect();
|
|
90
|
-
const currPosCenter = calculateCenter(elToTransitionToQueue.current);
|
|
91
|
-
const targetCenter = targetEl.current
|
|
92
|
-
? calculateCenter(targetEl.current)
|
|
93
|
-
: initialCenter.current.center;
|
|
94
|
-
clone.style.position = "fixed";
|
|
95
|
-
clone.style.top = `${currPositionOnViewport.top}px`;
|
|
96
|
-
clone.style.left = `${currPositionOnViewport.left}px`;
|
|
97
|
-
clone.style.width = `${currPositionOnViewport.width}px`;
|
|
98
|
-
clone.style.height = `${currPositionOnViewport.height}px`;
|
|
99
|
-
clone.style.transition = `transform 250ms ease-out, opacity 250ms ease-in`;
|
|
100
|
-
clone.style.opacity = "1";
|
|
101
|
-
clone.ontransitionend = ({ target, currentTarget }) => {
|
|
102
|
-
if (target === currentTarget)
|
|
103
|
-
wrapUI();
|
|
104
|
-
};
|
|
105
|
-
const targetHeight = Math.min(targetEl.current
|
|
106
|
-
? targetEl.current.clientHeight
|
|
107
|
-
: initialCenter.current.dimensions[1], elToTransitionToQueue.current.clientHeight);
|
|
108
|
-
const targetWidth = Math.min(targetHeight, targetEl.current
|
|
109
|
-
? targetEl.current.clientWidth
|
|
110
|
-
: initialCenter.current.dimensions[0], elToTransitionToQueue.current.clientWidth);
|
|
111
|
-
const targetScaleX = targetWidth / elToTransitionToQueue.current.clientWidth;
|
|
112
|
-
const targetScaleY = targetHeight / elToTransitionToQueue.current.clientHeight;
|
|
113
|
-
document.body.appendChild(clone);
|
|
114
|
-
setTimeout(() => {
|
|
115
|
-
clone.style.opacity = "0";
|
|
116
|
-
clone.style.transform = `translateX(${targetCenter.x - currPosCenter.x}px) translateY(${targetCenter.y - currPosCenter.y}px) scaleX(${targetScaleX}) scaleY(${targetScaleY})`;
|
|
117
|
-
clone.addEventListener("transitionend", ({ target, currentTarget }) => {
|
|
118
|
-
if (target === currentTarget)
|
|
119
|
-
clone.remove();
|
|
120
|
-
});
|
|
121
|
-
}, 100);
|
|
122
|
-
}, []);
|
|
123
|
-
return Object.entries(functionsToQueue).reduce((r, [k, v]) => {
|
|
124
|
-
const process = (...args) => {
|
|
125
|
-
const promise = v(...args);
|
|
126
|
-
loadingRef.current = function () {
|
|
127
|
-
// Write the loading UI
|
|
128
|
-
const LoadingUIInstance = Object.assign(Object.assign({}, UIFactory(k)("loading")), { status: "loading" });
|
|
129
|
-
setUIs((prev) => [
|
|
130
|
-
...prev.filter((a) => a.key !== LoadingUIInstance.key),
|
|
131
|
-
LoadingUIInstance,
|
|
132
|
-
]);
|
|
133
|
-
promise.then((result) => {
|
|
134
|
-
const UIInstance = UIFactory(k)("succeded");
|
|
135
|
-
// Write success UI
|
|
136
|
-
setUIs((prev) => prev.map((a) => a === LoadingUIInstance
|
|
137
|
-
? Object.assign(Object.assign({}, UIInstance), { status: "succeded" }) : a));
|
|
138
|
-
return result;
|
|
139
|
-
});
|
|
140
|
-
promise.catch((error) => {
|
|
141
|
-
const UIInstance = UIFactory(k)("failed", error, () => setUIs((prev) => prev.filter((ui) => ui !== UIInstance)), () => {
|
|
142
|
-
process(...args);
|
|
143
|
-
loadingRef.current();
|
|
144
|
-
});
|
|
145
|
-
// Write success UI
|
|
146
|
-
setUIs((prev) => prev.map((a) => a === LoadingUIInstance
|
|
147
|
-
? Object.assign(Object.assign({}, UIInstance), { status: "failed" }) : a));
|
|
148
|
-
throw error;
|
|
149
|
-
});
|
|
150
|
-
return promise;
|
|
151
|
-
};
|
|
152
|
-
promise.finally(() => {
|
|
153
|
-
loadingRef.current = null;
|
|
154
|
-
});
|
|
155
|
-
};
|
|
156
|
-
return Object.assign(Object.assign({}, r), { [k]: process });
|
|
157
|
-
}, { elToTransitionToQueue, wrapQueue });
|
|
158
|
-
}
|
|
159
|
-
exports.useAsyncProcessQueue = useAsyncProcessQueue;
|
|
160
|
-
//# sourceMappingURL=AsyncProcessQueue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AsyncProcessQueue.js","sourceRoot":"","sources":["../../src/context/AsyncProcessQueue.tsx"],"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F,MAAM,KAAK,CAAC;gBACd,CAAC,CAAC,CAAC;gBACH,OAAO,OAAO,CAAC;YACjB,CAAC,CAAC;YACF,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE;gBACnB,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC;YAC5B,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QACF,uCACK,CAAC,KACJ,CAAC,CAAC,CAAC,EAAE,OAAO,IACZ;IACJ,CAAC,EACD,EAAE,qBAAqB,EAAE,SAAS,EAMjC,CACF,CAAC;AACJ,CAAC;AA/JD,oDA+JC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const OneUIProvider_1 = require("./OneUIProvider");
|
|
4
|
-
const loggingSpy = jest.spyOn(console, "error");
|
|
5
|
-
loggingSpy.mockImplementation(() => { });
|
|
6
|
-
describe("The proxy that protects variable access", () => {
|
|
7
|
-
it("Should work when there is no object (the provider is not added yet)", () => {
|
|
8
|
-
(0, OneUIProvider_1.ProtectVariableAccess)();
|
|
9
|
-
});
|
|
10
|
-
it("Should work when there is a concatenation", () => {
|
|
11
|
-
const val = (0, OneUIProvider_1.ProtectVariableAccess)(() => { });
|
|
12
|
-
expect("" + val).toBeDefined();
|
|
13
|
-
});
|
|
14
|
-
it("Should work when there is an or", () => {
|
|
15
|
-
const val = (0, OneUIProvider_1.ProtectVariableAccess)(() => { });
|
|
16
|
-
expect(val || "expectedResult").toEqual("expectedResult");
|
|
17
|
-
});
|
|
18
|
-
it("Should log expected value", () => {
|
|
19
|
-
const a = (0, OneUIProvider_1.ProtectVariableAccess)({ some: { prop: "string" } });
|
|
20
|
-
// expect("Result: " + a).toEqual("Result: [object Object]");
|
|
21
|
-
expect("Result: " + a.some.prop).toEqual("Result: string");
|
|
22
|
-
});
|
|
23
|
-
it("Should display the path to the file when it doesn't exists", () => {
|
|
24
|
-
const protectedObject = (0, OneUIProvider_1.ProtectVariableAccess)({});
|
|
25
|
-
protectedObject.undefinedProperty;
|
|
26
|
-
expect(loggingSpy).toHaveBeenCalledWith(expect.stringContaining("undefinedProperty"));
|
|
27
|
-
jest.clearAllMocks();
|
|
28
|
-
const protectedObjectWithSecondLevelDependency = (0, OneUIProvider_1.ProtectVariableAccess)({
|
|
29
|
-
undefinedProperty: {},
|
|
30
|
-
});
|
|
31
|
-
protectedObjectWithSecondLevelDependency.undefinedProperty
|
|
32
|
-
.thisShouldNotCrash;
|
|
33
|
-
expect(loggingSpy).toHaveBeenCalledWith(expect.stringContaining("undefinedProperty.thisShouldNotCrash"));
|
|
34
|
-
jest.clearAllMocks();
|
|
35
|
-
const protectedObjectWithThirddLevelDependency = (0, OneUIProvider_1.ProtectVariableAccess)({
|
|
36
|
-
undefinedProperty: {
|
|
37
|
-
thisShouldNotCrash: {},
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
protectedObjectWithThirddLevelDependency.undefinedProperty
|
|
41
|
-
.thisShouldNotCrash.andThisShouldFollowAllThePath;
|
|
42
|
-
expect(loggingSpy).toHaveBeenCalledWith(expect.stringContaining("undefinedProperty.thisShouldNotCrash.andThisShouldFollowAllThePath"));
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
//# sourceMappingURL=OneUIProvider.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OneUIProvider.test.js","sourceRoot":"","sources":["../../src/context/OneUIProvider.test.ts"],"names":[],"mappings":";;AAAA,mDAAwD;AAExD,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAEhD,UAAU,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;AAExC,QAAQ,CAAC,yCAAyC,EAAE,GAAG,EAAE;IACvD,EAAE,CAAC,qEAAqE,EAAE,GAAG,EAAE;QAC7E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M,CAAC,UAAU,CAAC,CAAC,oBAAoB,CACrC,MAAM,CAAC,gBAAgB,CAAC,sCAAsC,CAAC,CAChE,CAAC;QAEF,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,MAAM,wCAAwC,GAAG,IAAA,qCAAqB,EAAC;YACrE,iBAAiB,EAAE;gBACjB,kBAAkB,EAAE,EAAE;aACvB;SACF,CAAC,CAAC;QACH,wCAAwC,CAAC,iBAAiB;aACvD,kBAAkB,CAAC,6BAA6B,CAAC;QACpD,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,CACrC,MAAM,CAAC,gBAAgB,CACrB,oEAAoE,CACrE,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/types.d.ts
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
type PrependNextNum<A extends Array<unknown>> = A['length'] extends infer T ? ((t: T, ...a: A) => void) extends ((...x: infer X) => void) ? X : never : never;
|
|
2
|
-
|
|
3
|
-
type EnumerateInternal<A extends Array<unknown>, N extends number> = { 0: A, 1: EnumerateInternal<PrependNextNum<A>, N> }[N extends A['length'] ? 0 : 1];
|
|
4
|
-
|
|
5
|
-
export type Enumerate<N extends number> = EnumerateInternal<[], N> extends (infer E)[] ? E : never;
|
|
6
|
-
|
|
7
|
-
export type Range<FROM extends number, TO extends number> = Exclude<Enumerate<TO>, Enumerate<FROM>>;
|
|
8
|
-
|
|
9
|
-
export type CommonErrorCodes = "UNEXPECTED_ERROR";
|
|
10
|
-
|
|
11
|
-
type Decompose<O extends object> = O;
|
|
12
|
-
|
|
13
|
-
export type BasicContext<T extends object> = {
|
|
14
|
-
set: <P extends keyof T>(p: P, value: T[typeof p]) => void;
|
|
15
|
-
} & T;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* This is usefull for omitting props from union
|
|
19
|
-
* Check whz contestation model to see an example
|
|
20
|
-
*
|
|
21
|
-
* If different models with different properties use the native Omit<O>
|
|
22
|
-
* Their differences are also omitted generating a single model
|
|
23
|
-
*
|
|
24
|
-
* This typing solves that
|
|
25
|
-
*/
|
|
26
|
-
export type DistributiveOmit<T, K extends keyof any> = T extends any
|
|
27
|
-
? Omit<T, K>
|
|
28
|
-
: never;
|
|
29
|
-
|
|
30
|
-
declare global {
|
|
31
|
-
interface Window {
|
|
32
|
-
ethereum: any;
|
|
33
|
-
PRERENDER: boolean;
|
|
34
|
-
Cypress: any;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
type NestedValue = unknown;
|
|
38
|
-
type FieldValues = unknown;
|
|
39
|
-
|
|
40
|
-
export declare type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
|
41
|
-
export declare type EmptyObject = {
|
|
42
|
-
[K in string | number]: never;
|
|
43
|
-
};
|
|
44
|
-
export declare type NonUndefined<T> = T extends undefined ? never : T;
|
|
45
|
-
export declare type LiteralUnion<T extends U, U extends Primitive> = T | (U & {
|
|
46
|
-
_?: never;
|
|
47
|
-
});
|
|
48
|
-
export declare type DeepPartial<T> = T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
|
49
|
-
[key in keyof T]: T[key];
|
|
50
|
-
} ? {
|
|
51
|
-
[K in keyof T]?: DeepPartial<T[K]>;
|
|
52
|
-
} : T;
|
|
53
|
-
export declare type IsAny<T> = boolean extends (T extends never ? true : false) ? true : false;
|
|
54
|
-
export declare type DeepMap<T, TValue> = {
|
|
55
|
-
[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
|
-
};
|
|
57
|
-
export declare type IsFlatObject<T extends object> = Extract<Exclude<T[keyof T], NestedValue | Date | FileList>, any[] | object> extends never ? true : false;
|
|
58
|
-
declare type IsTuple<T extends ReadonlyArray<any>> = number extends T['length'] ? false : true;
|
|
59
|
-
declare type TupleKey<T extends ReadonlyArray<any>> = Exclude<keyof T, keyof any[]>;
|
|
60
|
-
declare type ArrayKey = number;
|
|
61
|
-
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
|
-
? {
|
|
66
|
-
[K in TupleKey<T>]-?: PathImpl<K & string, T[K]>;
|
|
67
|
-
}[TupleKey<T>]
|
|
68
|
-
: PathImpl<ArrayKey, V>
|
|
69
|
-
: {
|
|
70
|
-
[K in keyof T]-?: PathImpl<K & string, T[K]>;
|
|
71
|
-
}[keyof T];
|
|
72
|
-
export declare type FieldPath<TFieldValues extends FieldValues> = Path<TFieldValues>;
|
|
73
|
-
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
|
-
export declare type ArrayPath<T> = T extends ReadonlyArray<infer V> ? IsTuple<T> extends true ? {
|
|
75
|
-
[K in TupleKey<T>]-?: ArrayPathImpl<K & string, T[K]>;
|
|
76
|
-
}[TupleKey<T>] : ArrayPathImpl<ArrayKey, V> : {
|
|
77
|
-
[K in keyof T]-?: ArrayPathImpl<K & string, T[K]>;
|
|
78
|
-
}[keyof T];
|
|
79
|
-
export declare type FieldArrayPath<TFieldValues extends FieldValues> = ArrayPath<TFieldValues>;
|
|
80
|
-
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
|
-
export declare type FieldPathValue<TFieldValues extends FieldValues, TFieldPath extends FieldPath<TFieldValues>> = PathValue<TFieldValues, TFieldPath>;
|
|
82
|
-
export declare type FieldArrayPathValue<TFieldValues extends FieldValues, TFieldArrayPath extends FieldArrayPath<TFieldValues>> = PathValue<TFieldValues, TFieldArrayPath>;
|
|
83
|
-
export declare type FieldPathValues<TFieldValues extends FieldValues, TPath extends FieldPath<TFieldValues>[] | readonly FieldPath<TFieldValues>[]> = {} & {
|
|
84
|
-
[K in keyof TPath]: FieldPathValue<TFieldValues, TPath[K] & FieldPath<TFieldValues>>;
|
|
85
|
-
};
|