@onepercentio/one-ui 0.29.4 → 0.29.5

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.
Files changed (286) hide show
  1. package/dist/components/Switch/Switch.d.ts +1 -1
  2. package/dist/components/Switch/Switch.js +1 -1
  3. package/dist-ts/components/Switch/Switch.d.ts +1 -1
  4. package/package.json +1 -1
  5. package/src/assets/img/svg/checkbox.svg +0 -3
  6. package/src/assets/styles/index.scss +0 -2
  7. package/src/assets/styles/mixins.scss +0 -12
  8. package/src/assets/styles/variables.scss +0 -49
  9. package/src/components/AdaptiveButton/AdaptiveButton.module.scss +0 -7
  10. package/src/components/AdaptiveButton/AdaptiveButton.tsx +0 -26
  11. package/src/components/AdaptiveButton/index.tsx +0 -2
  12. package/src/components/AdaptiveContainer/AdaptiveContainer.module.scss +0 -53
  13. package/src/components/AdaptiveContainer/AdaptiveContainer.tsx +0 -200
  14. package/src/components/AdaptiveContainer/index.tsx +0 -2
  15. package/src/components/AdaptiveDialog/AdaptiveDialog.module.scss +0 -147
  16. package/src/components/AdaptiveDialog/AdaptiveDialog.tsx +0 -97
  17. package/src/components/AdaptiveDialog/index.tsx +0 -2
  18. package/src/components/AdaptiveSidebar/AdaptiveSidebar.module.scss +0 -49
  19. package/src/components/AdaptiveSidebar/AdaptiveSidebar.sample.tsx +0 -10
  20. package/src/components/AdaptiveSidebar/AdaptiveSidebar.tsx +0 -123
  21. package/src/components/AdaptiveSidebar/index.tsx +0 -2
  22. package/src/components/AnchoredTooltip/AnchoredTooltip.module.scss +0 -64
  23. package/src/components/AnchoredTooltip/AnchoredTooltip.tsx +0 -250
  24. package/src/components/AnchoredTooltip/index.tsx +0 -2
  25. package/src/components/AnimatedEntrance/AnimatedEntrance.module.scss +0 -108
  26. package/src/components/AnimatedEntrance/AnimatedEntrance.tsx +0 -227
  27. package/src/components/AnimatedEntrance/index.tsx +0 -2
  28. package/src/components/AsyncWrapper/AsyncWrapper.tsx +0 -38
  29. package/src/components/AsyncWrapper/index.tsx +0 -2
  30. package/src/components/Avatar/Avatar.module.scss +0 -22
  31. package/src/components/Avatar/Avatar.tsx +0 -31
  32. package/src/components/Avatar/index.tsx +0 -2
  33. package/src/components/BucketFill/BucketFill.module.scss +0 -36
  34. package/src/components/BucketFill/BucketFill.tsx +0 -65
  35. package/src/components/BucketFill/index.tsx +0 -2
  36. package/src/components/Button/Button.module.scss +0 -45
  37. package/src/components/Button/Button.tsx +0 -40
  38. package/src/components/Button/index.tsx +0 -2
  39. package/src/components/Card/Card.module.scss +0 -12
  40. package/src/components/Card/Card.tsx +0 -9
  41. package/src/components/Card/index.tsx +0 -2
  42. package/src/components/Chart/Chart.e2e.ts +0 -4
  43. package/src/components/Chart/Chart.logic.tsx +0 -8
  44. package/src/components/Chart/Chart.module.scss +0 -58
  45. package/src/components/Chart/Chart.tsx +0 -2
  46. package/src/components/Chart/Chart.types.ts +0 -35
  47. package/src/components/Chart/Chart.view.tsx +0 -241
  48. package/src/components/Chart/index.tsx +0 -2
  49. package/src/components/CheckBox/CheckBox.module.scss +0 -36
  50. package/src/components/CheckBox/CheckBox.tsx +0 -63
  51. package/src/components/CheckBox/index.tsx +0 -2
  52. package/src/components/CodeInput/CodeInput.module.scss +0 -5
  53. package/src/components/CodeInput/CodeInput.tsx +0 -84
  54. package/src/components/CodeInput/index.tsx +0 -2
  55. package/src/components/Collapsable/Collapsable.module.scss +0 -42
  56. package/src/components/Collapsable/Collapsable.tsx +0 -253
  57. package/src/components/Collapsable/index.tsx +0 -2
  58. package/src/components/Countdown/Countdown.tsx +0 -130
  59. package/src/components/Countdown/index.tsx +0 -2
  60. package/src/components/CurrencyInput/CurrencyInput.hook.ts +0 -37
  61. package/src/components/CurrencyInput/CurrencyInput.tsx +0 -25
  62. package/src/components/CurrencyInput/index.tsx +0 -2
  63. package/src/components/Divider/Divider.module.scss +0 -7
  64. package/src/components/Divider/Divider.tsx +0 -13
  65. package/src/components/Divider/index.tsx +0 -2
  66. package/src/components/EmailInput/EmailInput.module.scss +0 -0
  67. package/src/components/EmailInput/EmailInput.tsx +0 -51
  68. package/src/components/EmailInput/index.tsx +0 -2
  69. package/src/components/FadeIn/FadeIn.module.scss +0 -9
  70. package/src/components/FadeIn/FadeIn.tsx +0 -77
  71. package/src/components/FadeIn/index.tsx +0 -2
  72. package/src/components/FileInput/FileInput.module.scss +0 -6
  73. package/src/components/FileInput/FileInput.tsx +0 -75
  74. package/src/components/FileInput/View/BigFactory/BigFactory.module.scss +0 -20
  75. package/src/components/FileInput/View/BigFactory/BigFactory.tsx +0 -48
  76. package/src/components/FileInput/View/BigFactory/index.tsx +0 -2
  77. package/src/components/FileInput/View/Compact/Compact.module.scss +0 -68
  78. package/src/components/FileInput/View/Compact/Compact.tsx +0 -151
  79. package/src/components/FileInput/View/Compact/index.tsx +0 -2
  80. package/src/components/FileInput/View/View.types.ts +0 -12
  81. package/src/components/FileInput/index.tsx +0 -2
  82. package/src/components/FlowController/FlowController.module.scss +0 -47
  83. package/src/components/FlowController/FlowController.tsx +0 -93
  84. package/src/components/FlowController/index.tsx +0 -2
  85. package/src/components/Form/Form.tsx +0 -243
  86. package/src/components/Form/index.ts +0 -2
  87. package/src/components/Form/v2/Form.hook.ts +0 -341
  88. package/src/components/Form/v2/Form.module.scss +0 -0
  89. package/src/components/Form/v2/Form.tsx +0 -78
  90. package/src/components/Form/v2/Form.types.ts +0 -118
  91. package/src/components/Form/v2/FormField/Extensions/DateField/DateField.module.scss +0 -0
  92. package/src/components/Form/v2/FormField/Extensions/DateField/DateField.tsx +0 -73
  93. package/src/components/Form/v2/FormField/Extensions/DateField/index.tsx +0 -2
  94. package/src/components/Form/v2/FormField/Extensions/PhoneField/PhoneField.module.scss +0 -0
  95. package/src/components/Form/v2/FormField/Extensions/PhoneField/PhoneField.tsx +0 -91
  96. package/src/components/Form/v2/FormField/Extensions/PhoneField/index.tsx +0 -2
  97. package/src/components/Form/v2/FormField/FormField.module.scss +0 -0
  98. package/src/components/Form/v2/FormField/FormField.tsx +0 -378
  99. package/src/components/Form/v2/FormField/FormField.types.ts +0 -129
  100. package/src/components/Form/v2/FormField/index.tsx +0 -2
  101. package/src/components/Form/v2/index.tsx +0 -2
  102. package/src/components/Freeze/Freeze.tsx +0 -9
  103. package/src/components/Freeze/index.tsx +0 -2
  104. package/src/components/HSForms/HSForms.tsx +0 -57
  105. package/src/components/HSForms/index.tsx +0 -2
  106. package/src/components/Header/Header.module.scss +0 -119
  107. package/src/components/Header/Header.tsx +0 -138
  108. package/src/components/Header/index.tsx +0 -2
  109. package/src/components/HeaderCloseBtn/HeaderCloseBtn.module.scss +0 -44
  110. package/src/components/HeaderCloseBtn/HeaderCloseBtn.tsx +0 -28
  111. package/src/components/HeaderCloseBtn/index.tsx +0 -2
  112. package/src/components/InfinityScroll/InfinityScroll.module.scss +0 -30
  113. package/src/components/InfinityScroll/InfinityScroll.tsx +0 -187
  114. package/src/components/InfinityScroll/index.tsx +0 -2
  115. package/src/components/Input/Input.module.scss +0 -71
  116. package/src/components/Input/Input.tsx +0 -134
  117. package/src/components/Input/index.tsx +0 -2
  118. package/src/components/InstantCounter/InstantCounter.tsx +0 -77
  119. package/src/components/InstantCounter/index.tsx +0 -2
  120. package/src/components/LavaLamp/LavaLamp.data.tsx +0 -114
  121. package/src/components/LavaLamp/LavaLamp.module.scss +0 -26
  122. package/src/components/LavaLamp/LavaLamp.tsx +0 -131
  123. package/src/components/LavaLamp/index.tsx +0 -2
  124. package/src/components/LavaLamp/v2/LavaLamp.module.scss +0 -23
  125. package/src/components/LavaLamp/v2/LavaLamp.tsx +0 -197
  126. package/src/components/LinkToId/LinkToId.module.scss +0 -4
  127. package/src/components/LinkToId/LinkToId.tsx +0 -51
  128. package/src/components/LinkToId/index.tsx +0 -2
  129. package/src/components/Loader/Loader.module.scss +0 -40
  130. package/src/components/Loader/Loader.tsx +0 -18
  131. package/src/components/Loader/index.tsx +0 -2
  132. package/src/components/LoaderDotsIndicator/LoaderDotsIndicator.tsx +0 -34
  133. package/src/components/LoaderDotsIndicator/index.tsx +0 -2
  134. package/src/components/LoopableVideo/LoopableVideo.tsx +0 -37
  135. package/src/components/LoopableVideo/index.tsx +0 -2
  136. package/src/components/MainGrid/MainGrid.module.scss +0 -28
  137. package/src/components/MainGrid/MainGrid.tsx +0 -68
  138. package/src/components/MainGrid/index.tsx +0 -2
  139. package/src/components/MutableHamburgerButton/MutableHamburgerButton.module.scss +0 -220
  140. package/src/components/MutableHamburgerButton/MutableHamburgerButton.tsx +0 -38
  141. package/src/components/MutableHamburgerButton/index.tsx +0 -2
  142. package/src/components/Notification/Notification.module.scss +0 -25
  143. package/src/components/Notification/Notification.tsx +0 -13
  144. package/src/components/Notification/index.tsx +0 -2
  145. package/src/components/OrderableList/OrderableList.module.scss +0 -98
  146. package/src/components/OrderableList/OrderableList.tsx +0 -564
  147. package/src/components/OrderableList/index.tsx +0 -2
  148. package/src/components/PaginationIndicator/PaginationIndicator.tsx +0 -365
  149. package/src/components/PaginationIndicator/index.tsx +0 -2
  150. package/src/components/Parallax/Parallax.module.scss +0 -28
  151. package/src/components/Parallax/Parallax.tsx +0 -225
  152. package/src/components/Parallax/index.tsx +0 -2
  153. package/src/components/Parallax/math/helpers.ts +0 -289
  154. package/src/components/PasswordInput/PasswordInput.module.scss +0 -17
  155. package/src/components/PasswordInput/PasswordInput.tsx +0 -154
  156. package/src/components/PasswordInput/index.tsx +0 -2
  157. package/src/components/PingPongText/PingPongText.module.scss +0 -4
  158. package/src/components/PingPongText/PingPongText.tsx +0 -83
  159. package/src/components/PingPongText/index.tsx +0 -2
  160. package/src/components/PixelatedScan/PixelatedScan.module.scss +0 -86
  161. package/src/components/PixelatedScan/PixelatedScan.tsx +0 -175
  162. package/src/components/PixelatedScan/index.tsx +0 -2
  163. package/src/components/Portal/Portal.module.scss +0 -3
  164. package/src/components/Portal/Portal.tsx +0 -68
  165. package/src/components/Portal/index.tsx +0 -2
  166. package/src/components/ProgressBar/ProgressBar.module.scss +0 -44
  167. package/src/components/ProgressBar/ProgressBar.tsx +0 -124
  168. package/src/components/ProgressBar/index.tsx +0 -2
  169. package/src/components/ProgressTexts/ProgressTexts.module.scss +0 -37
  170. package/src/components/ProgressTexts/ProgressTexts.tsx +0 -85
  171. package/src/components/ProgressTexts/index.tsx +0 -2
  172. package/src/components/Radio/Radio.module.scss +0 -36
  173. package/src/components/Radio/Radio.tsx +0 -53
  174. package/src/components/Radio/index.tsx +0 -2
  175. package/src/components/SectionContainer/SectionContainer.module.scss +0 -30
  176. package/src/components/SectionContainer/SectionContainer.tsx +0 -49
  177. package/src/components/SectionContainer/index.tsx +0 -2
  178. package/src/components/Select/Select.module.scss +0 -58
  179. package/src/components/Select/Select.tsx +0 -192
  180. package/src/components/Select/index.tsx +0 -2
  181. package/src/components/Skeleton/Skeleton.module.scss +0 -21
  182. package/src/components/Skeleton/Skeleton.tsx +0 -29
  183. package/src/components/Skeleton/index.tsx +0 -2
  184. package/src/components/Spacing/Spacing.module.scss +0 -13
  185. package/src/components/Spacing/Spacing.tsx +0 -24
  186. package/src/components/Spacing/index.tsx +0 -2
  187. package/src/components/StaticScroller/StaticScroller.module.scss +0 -14
  188. package/src/components/StaticScroller/StaticScroller.tsx +0 -83
  189. package/src/components/StaticScroller/index.tsx +0 -2
  190. package/src/components/Switch/Switch.module.scss +0 -43
  191. package/src/components/Switch/Switch.tsx +0 -41
  192. package/src/components/Switch/index.tsx +0 -2
  193. package/src/components/Table/Table.module.scss +0 -76
  194. package/src/components/Table/Table.tsx +0 -152
  195. package/src/components/Table/index.tsx +0 -2
  196. package/src/components/Tabs/Tabs.module.scss +0 -40
  197. package/src/components/Tabs/Tabs.tsx +0 -104
  198. package/src/components/Tabs/index.tsx +0 -2
  199. package/src/components/Text/Text.module.scss +0 -81
  200. package/src/components/Text/Text.tsx +0 -42
  201. package/src/components/Text/index.tsx +0 -2
  202. package/src/components/Transition/MasksFactory/DiagonalReveal.tsx +0 -47
  203. package/src/components/Transition/MasksFactory/DiagonalSquareToBalls.tsx +0 -78
  204. package/src/components/Transition/MasksFactory/PhysicsSquares.tsx +0 -106
  205. package/src/components/Transition/MasksFactory/SquareToBalls.tsx +0 -66
  206. package/src/components/Transition/MasksFactory/utils.ts +0 -35
  207. package/src/components/Transition/Transition.module.scss +0 -211
  208. package/src/components/Transition/Transition.tsx +0 -495
  209. package/src/components/Transition/index.tsx +0 -2
  210. package/src/components/UncontrolledTransition/UncontrolledTransition.ai.md +0 -9
  211. package/src/components/UncontrolledTransition/UncontrolledTransition.sample.tsx +0 -34
  212. package/src/components/UncontrolledTransition/UncontrolledTransition.tsx +0 -143
  213. package/src/components/UncontrolledTransition/index.tsx +0 -2
  214. package/src/components/WalletConnectionWrapper/WalletConnectionWrapper.tsx +0 -212
  215. package/src/components/WalletConnectionWrapper/index.tsx +0 -2
  216. package/src/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.module.scss +0 -5
  217. package/src/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.tsx +0 -52
  218. package/src/components/utilitary/ScrollAndFocusLock/index.tsx +0 -2
  219. package/src/context/AsyncProcess.tsx +0 -107
  220. package/src/context/ContextAsyncControl.tsx +0 -89
  221. package/src/context/CustomBrowserRouter.tsx +0 -55
  222. package/src/context/OneUIProvider.tsx +0 -308
  223. package/src/hooks/logs/useDependencyChangeDetection.ts +0 -25
  224. package/src/hooks/logs/useIsMounting.ts +0 -7
  225. package/src/hooks/persistence/useLocalStorage.ts +0 -45
  226. package/src/hooks/shims/ObjectWatchShim.ts +0 -56
  227. package/src/hooks/ui/useAdaptiveImage.tsx +0 -36
  228. package/src/hooks/ui/useAlternating.tsx +0 -22
  229. package/src/hooks/ui/useBreakpoint.tsx +0 -21
  230. package/src/hooks/ui/useCustomScrollbar.module.scss +0 -20
  231. package/src/hooks/ui/useCustomScrollbar.tsx +0 -22
  232. package/src/hooks/ui/useEffectIf.ts +0 -11
  233. package/src/hooks/ui/useMouseHover.tsx +0 -26
  234. package/src/hooks/ui/usePaginationControls.module.scss +0 -16
  235. package/src/hooks/ui/usePaginationControls.tsx +0 -176
  236. package/src/hooks/ui/useSnapToViewport.module.scss +0 -6
  237. package/src/hooks/ui/useSnapToViewport.ts +0 -28
  238. package/src/hooks/ui/useTilt.tsx +0 -219
  239. package/src/hooks/ui/useZoomable.module.scss +0 -34
  240. package/src/hooks/ui/useZoomable.tsx +0 -144
  241. package/src/hooks/useAsyncControl.ai.md +0 -25
  242. package/src/hooks/useAsyncControl.ts +0 -101
  243. package/src/hooks/useContainedRepositioning.ts +0 -110
  244. package/src/hooks/useCustomHistory.ts +0 -14
  245. package/src/hooks/useElementFit.ts +0 -82
  246. package/src/hooks/useFirestoreWatch.ts +0 -54
  247. package/src/hooks/useForm.ts +0 -49
  248. package/src/hooks/useFreeze.ts +0 -12
  249. package/src/hooks/useHero.module.scss +0 -41
  250. package/src/hooks/useHero.ts +0 -514
  251. package/src/hooks/useIntersection.ts +0 -32
  252. package/src/hooks/useMergeRefs.ts +0 -29
  253. package/src/hooks/useObserve.ts +0 -24
  254. package/src/hooks/usePagination.ts +0 -228
  255. package/src/hooks/usePooledOperation.ts +0 -54
  256. package/src/hooks/usePooling.ts +0 -46
  257. package/src/hooks/useRebound.ts +0 -23
  258. package/src/hooks/useShortIntl.ai.md +0 -5
  259. package/src/hooks/useShortIntl.ts +0 -97
  260. package/src/hooks/utility/useAsyncMemo.ts +0 -43
  261. package/src/hooks/utility/useDepChange.ts +0 -11
  262. package/src/hooks/utility/useEvents.ts +0 -33
  263. package/src/hooks/utility/useImmediate.ts +0 -8
  264. package/src/hooks/utility/useManualInit.ts +0 -24
  265. package/src/hooks/utility/useModule.ts +0 -15
  266. package/src/hooks/utility/useQuery.ts +0 -15
  267. package/src/hooks/utility/useUniqueEffect.ts +0 -22
  268. package/src/index.preprocess.ts +0 -82
  269. package/src/index.ts +0 -229
  270. package/src/models/DebugLogger.ts +0 -7
  271. package/src/models/GenericContract.ts +0 -169
  272. package/src/models/Orbs.ts +0 -97
  273. package/src/reac-app-env.d.ts +0 -6
  274. package/src/storybook/assets/video/txt-reversed.mp4 +0 -0
  275. package/src/storybookUtils/index.tsx +0 -53
  276. package/src/test.tsx +0 -0
  277. package/src/type-utils.ts +0 -49
  278. package/src/types.ts +0 -199
  279. package/src/utility.d.ts +0 -70
  280. package/src/utils/blockchain.ts +0 -43
  281. package/src/utils/e2e.ts +0 -55
  282. package/src/utils/flatten.ts +0 -17
  283. package/src/utils/formatters.ts +0 -36
  284. package/src/utils/html.utils.ts +0 -3
  285. package/src/utils/ownEvent.ts +0 -8
  286. package/src/utils/test.ts +0 -20
@@ -1,289 +0,0 @@
1
- export type Matrix3D = [
2
- [number, number, number, number],
3
- [number, number, number, number],
4
- [number, number, number, number],
5
- [number, number, number, number]
6
- ];
7
- export type OperationData =
8
- | {
9
- type: "rotateX" | "rotateY" | "rotateZ";
10
- angle: number;
11
- }
12
- | {
13
- type: "translate";
14
- x: number;
15
- y: number;
16
- z: number;
17
- }
18
- | {
19
- type: "scale";
20
- factorX: number;
21
- factorY: number;
22
- factorZ: number;
23
- }
24
- | {
25
- type: "perspective";
26
- fieldOfViewInRadians: number;
27
- aspect: number;
28
- near: number;
29
- far: number;
30
- }
31
- | {
32
- type: "matrix";
33
- matrix: Matrix3D;
34
- };
35
- export function IDENTITY_MATRIX() {
36
- return [
37
- [1, 0, 0, 0], // cos, -sin, ?
38
- [0, 1, 0, 0], // sin, cos, ?
39
- [0, 0, 1, 0], // TranslationX, TranslationY, ?
40
- [0, 0, 0, 1],
41
- ] as Matrix3D;
42
- }
43
- export function generateMatrixFromOperations(
44
- ...operations: OperationData[]
45
- ): Matrix3D {
46
- let resultingMatrix: Matrix3D | undefined = undefined;
47
- for (let operation of operations) {
48
- const matrix =
49
- operation.type === "matrix" ? operation.matrix : IDENTITY_MATRIX();
50
- switch (operation.type) {
51
- case "perspective":
52
- const f = Math.tan(
53
- Math.PI * 0.5 - 0.5 * operation.fieldOfViewInRadians
54
- );
55
- const rangeInv = 1.0 / (operation.near - operation.far);
56
-
57
- matrix[0][0] = f / operation.aspect;
58
- matrix[1][1] = f;
59
- matrix[2][2] = (operation.near + operation.far) * rangeInv;
60
- matrix[2][3] = -1;
61
- matrix[3][2] = operation.near * operation.far * rangeInv * 2;
62
- matrix[3][3] = 0;
63
- break;
64
- case "translate":
65
- matrix[3][0] = operation.x;
66
- matrix[3][1] = operation.y;
67
- matrix[3][2] = operation.z;
68
- break;
69
- case "rotateX":
70
- case "rotateY":
71
- case "rotateZ":
72
- const angleToRadians = (operation.angle * Math.PI) / 180;
73
- const sinAngle = Math.sin(angleToRadians);
74
- const cosAngle = Math.cos(angleToRadians);
75
- switch (operation.type) {
76
- case "rotateZ":
77
- matrix[0][0] = cosAngle;
78
- matrix[1][1] = cosAngle;
79
- matrix[1][0] = -sinAngle;
80
- matrix[0][1] = sinAngle;
81
- break;
82
- case "rotateY":
83
- matrix[0][0] = cosAngle;
84
- matrix[2][2] = cosAngle;
85
- matrix[0][2] = -sinAngle;
86
- matrix[2][0] = sinAngle;
87
- break;
88
- case "rotateX":
89
- matrix[1][1] = cosAngle;
90
- matrix[2][2] = cosAngle;
91
- matrix[2][1] = -sinAngle;
92
- matrix[1][2] = sinAngle;
93
- break;
94
- }
95
- break;
96
- case "scale":
97
- matrix[0][0] = operation.factorX;
98
- matrix[1][1] = operation.factorY;
99
- matrix[2][2] = operation.factorZ;
100
- break;
101
- }
102
- if (resultingMatrix) {
103
- resultingMatrix = multiplyMatrixes(resultingMatrix, matrix) as Matrix3D;
104
- } else {
105
- resultingMatrix = matrix;
106
- }
107
- }
108
-
109
- return resultingMatrix || IDENTITY_MATRIX();
110
- }
111
-
112
- type NumberMatrix = readonly (readonly number[])[];
113
- export function multiplyMatrixes<X extends NumberMatrix>(
114
- matrix1: X,
115
- matrix2: NumberMatrix & { length: X[number]["length"] }
116
- ) {
117
- const resultingMatrix: number[][] = [];
118
- if (
119
- process.env.NODE_ENV === "development" &&
120
- matrix2.length !== matrix1[0].length
121
- ) {
122
- throw new Error(`For the multiplication of matrixes to work you need to provide the matrix1 containing the amount of columns as the same amount of rows from matrix 2.
123
- You provided ${matrix1[0].length} columns and ${matrix2.length} rows`);
124
- }
125
- for (let i0 in matrix1) {
126
- for (let i in matrix2[0]) {
127
- let dimensionResult = 0;
128
- for (let i2 in matrix1[0]) {
129
- dimensionResult += matrix1[i0][i2] * matrix2[i2][i];
130
- }
131
- if (!resultingMatrix[i0]) resultingMatrix[i0] = [];
132
- resultingMatrix[i0][i] = dimensionResult;
133
- }
134
- }
135
- return resultingMatrix;
136
- }
137
-
138
- export function invertMatrix(matrix: Matrix3D) {
139
- const m = flattenMatrix(matrix);
140
- let det: number = 0;
141
- const inv = [];
142
-
143
- inv[0] =
144
- m[5] * m[10] * m[15] -
145
- m[5] * m[11] * m[14] -
146
- m[9] * m[6] * m[15] +
147
- m[9] * m[7] * m[14] +
148
- m[13] * m[6] * m[11] -
149
- m[13] * m[7] * m[10];
150
-
151
- inv[4] =
152
- -m[4] * m[10] * m[15] +
153
- m[4] * m[11] * m[14] +
154
- m[8] * m[6] * m[15] -
155
- m[8] * m[7] * m[14] -
156
- m[12] * m[6] * m[11] +
157
- m[12] * m[7] * m[10];
158
-
159
- inv[8] =
160
- m[4] * m[9] * m[15] -
161
- m[4] * m[11] * m[13] -
162
- m[8] * m[5] * m[15] +
163
- m[8] * m[7] * m[13] +
164
- m[12] * m[5] * m[11] -
165
- m[12] * m[7] * m[9];
166
-
167
- inv[12] =
168
- -m[4] * m[9] * m[14] +
169
- m[4] * m[10] * m[13] +
170
- m[8] * m[5] * m[14] -
171
- m[8] * m[6] * m[13] -
172
- m[12] * m[5] * m[10] +
173
- m[12] * m[6] * m[9];
174
-
175
- inv[1] =
176
- -m[1] * m[10] * m[15] +
177
- m[1] * m[11] * m[14] +
178
- m[9] * m[2] * m[15] -
179
- m[9] * m[3] * m[14] -
180
- m[13] * m[2] * m[11] +
181
- m[13] * m[3] * m[10];
182
-
183
- inv[5] =
184
- m[0] * m[10] * m[15] -
185
- m[0] * m[11] * m[14] -
186
- m[8] * m[2] * m[15] +
187
- m[8] * m[3] * m[14] +
188
- m[12] * m[2] * m[11] -
189
- m[12] * m[3] * m[10];
190
-
191
- inv[9] =
192
- -m[0] * m[9] * m[15] +
193
- m[0] * m[11] * m[13] +
194
- m[8] * m[1] * m[15] -
195
- m[8] * m[3] * m[13] -
196
- m[12] * m[1] * m[11] +
197
- m[12] * m[3] * m[9];
198
-
199
- inv[13] =
200
- m[0] * m[9] * m[14] -
201
- m[0] * m[10] * m[13] -
202
- m[8] * m[1] * m[14] +
203
- m[8] * m[2] * m[13] +
204
- m[12] * m[1] * m[10] -
205
- m[12] * m[2] * m[9];
206
-
207
- inv[2] =
208
- m[1] * m[6] * m[15] -
209
- m[1] * m[7] * m[14] -
210
- m[5] * m[2] * m[15] +
211
- m[5] * m[3] * m[14] +
212
- m[13] * m[2] * m[7] -
213
- m[13] * m[3] * m[6];
214
-
215
- inv[6] =
216
- -m[0] * m[6] * m[15] +
217
- m[0] * m[7] * m[14] +
218
- m[4] * m[2] * m[15] -
219
- m[4] * m[3] * m[14] -
220
- m[12] * m[2] * m[7] +
221
- m[12] * m[3] * m[6];
222
-
223
- inv[10] =
224
- m[0] * m[5] * m[15] -
225
- m[0] * m[7] * m[13] -
226
- m[4] * m[1] * m[15] +
227
- m[4] * m[3] * m[13] +
228
- m[12] * m[1] * m[7] -
229
- m[12] * m[3] * m[5];
230
-
231
- inv[14] =
232
- -m[0] * m[5] * m[14] +
233
- m[0] * m[6] * m[13] +
234
- m[4] * m[1] * m[14] -
235
- m[4] * m[2] * m[13] -
236
- m[12] * m[1] * m[6] +
237
- m[12] * m[2] * m[5];
238
-
239
- inv[3] =
240
- -m[1] * m[6] * m[11] +
241
- m[1] * m[7] * m[10] +
242
- m[5] * m[2] * m[11] -
243
- m[5] * m[3] * m[10] -
244
- m[9] * m[2] * m[7] +
245
- m[9] * m[3] * m[6];
246
-
247
- inv[7] =
248
- m[0] * m[6] * m[11] -
249
- m[0] * m[7] * m[10] -
250
- m[4] * m[2] * m[11] +
251
- m[4] * m[3] * m[10] +
252
- m[8] * m[2] * m[7] -
253
- m[8] * m[3] * m[6];
254
-
255
- inv[11] =
256
- -m[0] * m[5] * m[11] +
257
- m[0] * m[7] * m[9] +
258
- m[4] * m[1] * m[11] -
259
- m[4] * m[3] * m[9] -
260
- m[8] * m[1] * m[7] +
261
- m[8] * m[3] * m[5];
262
-
263
- inv[15] =
264
- m[0] * m[5] * m[10] -
265
- m[0] * m[6] * m[9] -
266
- m[4] * m[1] * m[10] +
267
- m[4] * m[2] * m[9] +
268
- m[8] * m[1] * m[6] -
269
- m[8] * m[2] * m[5];
270
-
271
- det = m[0] * inv[0] + m[1] * inv[4] + m[2] * inv[8] + m[3] * inv[12];
272
-
273
- if (det === 0)
274
- throw new Error(
275
- "Determinator is equal to 0. This matrix cannot be inverted"
276
- );
277
-
278
- det = 1.0 / det;
279
-
280
- return inv.reduce((r, val, i) => {
281
- const row = Math.floor(i / 4);
282
- if (!r[row]) r[row] = [];
283
- r[row][i % 4] = val * det;
284
- return r;
285
- }, [] as number[][]) as Matrix3D;
286
- }
287
- export function flattenMatrix(matrix: number[][]) {
288
- return matrix.reduce((f, dimension) => [...f, ...dimension], [] as number[]);
289
- }
@@ -1,17 +0,0 @@
1
- .inputContainer {
2
- &.creation {
3
- padding-bottom: 54px;
4
- }
5
- position: relative;
6
-
7
- .rules {
8
- position: absolute;
9
- bottom: 0px;
10
- }
11
-
12
- &.icon > :first-child > :last-child {
13
- top: initial;
14
- align-self: center;
15
- margin-top: -18px;
16
- }
17
- }
@@ -1,154 +0,0 @@
1
- import React, {
2
- ChangeEvent,
3
- ForwardedRef,
4
- forwardRef,
5
- useImperativeHandle,
6
- useState,
7
- } from "react";
8
- import { useOneUIConfig } from "../../context/OneUIProvider";
9
- import Input from "../Input";
10
- import Text from "../Text";
11
- import Styles from "./PasswordInput.module.scss";
12
-
13
- export type AVAILABLE_PASSWORD_VALIDATION_RULES = "size" | "duplication";
14
-
15
- const BASE_VALIDATION = [
16
- { code: "size", validate: (pass: string) => pass.length >= 8 },
17
- ] as const;
18
- const RULES = [
19
- {
20
- code: "duplication",
21
- validate: (pass: string) => {
22
- for (let i = 0; i < pass.length; i++) {
23
- const charCode = pass.charCodeAt(i);
24
- const [firstNext, secondNext] = [
25
- pass.charCodeAt(i + 1) || 0,
26
- pass.charCodeAt(i + 2) || 0,
27
- ];
28
-
29
- if (firstNext - charCode === 1 && secondNext - firstNext === 1) {
30
- return false;
31
- }
32
- }
33
- return true;
34
- },
35
- },
36
- ...BASE_VALIDATION,
37
- ] as const;
38
-
39
- function _PasswordInput(
40
- props: ({
41
- value: string;
42
- error?: string;
43
- } & (
44
- | {
45
- mode: "input";
46
- onChange: (password: string) => void;
47
- }
48
- | {
49
- mode: "creation";
50
- onChange: (password: string, isValid: boolean) => void;
51
- messages: {
52
- invalidRules: { [r in AVAILABLE_PASSWORD_VALIDATION_RULES]: string };
53
- rulesTitle: string;
54
- };
55
- }
56
- | {
57
- mode: "comparision";
58
- otherPassword: string;
59
- onChange: (password: string, isEqual: boolean) => void;
60
- messages: {
61
- passwordsAreDifferent: string;
62
- };
63
- }
64
- )) &
65
- Omit<React.ComponentProps<typeof Input>, "value" | "onChange" | "ref">,
66
- ref: ForwardedRef<{ validatePassword: (pass: string) => boolean }>
67
- ) {
68
- const [isPasswordVisibile, setIPV] = useState(false);
69
- const { passwordHidden, passwordVisible } = useOneUIConfig(
70
- "component.passwordInput.iconSrc"
71
- );
72
- function _validatePassword(password: string) {
73
- switch (props.mode) {
74
- case "creation":
75
- return RULES.reduce(
76
- (isValid, R) => isValid && R.validate(password),
77
- true as boolean
78
- );
79
- case "comparision":
80
- return password === props.otherPassword;
81
- case "input":
82
- return BASE_VALIDATION.reduce(
83
- (isValid, R) => isValid && R.validate(password),
84
- true as boolean
85
- );
86
- }
87
- }
88
-
89
- useImperativeHandle(ref, () => ({
90
- validatePassword: (pass) => _validatePassword(pass),
91
- }));
92
-
93
- function _onChange(e: ChangeEvent<HTMLInputElement>) {
94
- const password = e.target.value;
95
- switch (props.mode) {
96
- case "comparision":
97
- case "creation":
98
- props.onChange(password, _validatePassword(password));
99
- break;
100
- case "input":
101
- props.onChange(password);
102
- break;
103
- }
104
- }
105
-
106
- return (
107
- <div
108
- className={`${Styles.inputContainer} ${Styles[props.mode]} ${
109
- Styles.icon
110
- }`}
111
- >
112
- <Input
113
- value={props.value}
114
- onChange={_onChange}
115
- type={!isPasswordVisibile ? "password" : ""}
116
- icon={{
117
- src: isPasswordVisibile ? passwordHidden : passwordVisible,
118
- onMouseLeave: () => setIPV(false),
119
- onMouseDown: () => setIPV(true),
120
- onMouseUp: () => setIPV(false),
121
- onTouchMove: () => setIPV(false),
122
- onTouchStart: () => setIPV(true),
123
- onTouchEnd: () => setIPV(false),
124
- }}
125
- error={
126
- props.mode === "comparision" && !_validatePassword(props.value)
127
- ? props.messages.passwordsAreDifferent
128
- : props.error
129
- }
130
- disabled={props.disabled}
131
- placeholder={props.placeholder}
132
- />
133
- {props.mode === "creation" && (
134
- <div className={Styles.rules} data-testid="password-rules">
135
- <Text type="caption">{props.messages.rulesTitle}</Text>
136
- {RULES.map((R) => (
137
- <Text
138
- key={R.code}
139
- type={R.validate(props.value) ? "caption" : "error"}
140
- >
141
- - {props.messages.invalidRules[R.code]}
142
- </Text>
143
- ))}
144
- </div>
145
- )}
146
- </div>
147
- );
148
- }
149
-
150
- /**
151
- * A Input based wrapper to handle inputing of password
152
- **/
153
- const PasswordInput = forwardRef(_PasswordInput);
154
- export default PasswordInput;
@@ -1,2 +0,0 @@
1
- export { default } from "./PasswordInput";
2
- export * from "./PasswordInput";
@@ -1,4 +0,0 @@
1
- .pingPong {
2
- width: 100%;
3
- overflow: hidden;
4
- }
@@ -1,83 +0,0 @@
1
- import React, {
2
- ComponentProps,
3
- PropsWithChildren,
4
- useEffect,
5
- useRef,
6
- } from "react";
7
- import Text from "../Text/Text";
8
- import Styles from "./PingPongText.module.scss";
9
- import useMouseHover from "../../hooks/ui/useMouseHover";
10
-
11
- const HOW_MUCH_PIXELS_TO_SCROLL_PER_SECOND = 50;
12
- const RIGHT_TEXT_MULTIPLIER = 5;
13
-
14
- /**
15
- * A component that keeps an overflow piece of text visible by continously scrolling it back and forward
16
- **/
17
- export default function PingPongText({
18
- ...props
19
- }: ComponentProps<typeof Text>) {
20
- const textRef = useRef<HTMLParagraphElement>(null);
21
- const { uiEvents, hovering } = useMouseHover();
22
-
23
- useEffect(() => {
24
- if (!hovering) {
25
- let scrollingInterval: NodeJS.Timeout;
26
- let scrollStartTimeout: NodeJS.Timeout;
27
- scrollStartTimeout = setTimeout(() => {
28
- const textEl = textRef.current;
29
- if (!textEl) return;
30
- const overflowWidth = textEl.scrollWidth;
31
- const viewWidth = textEl.clientWidth;
32
- const secondsPerFrame = 1000 / 60;
33
- const howMuchToMove =
34
- (secondsPerFrame * HOW_MUCH_PIXELS_TO_SCROLL_PER_SECOND) / 1000;
35
-
36
- if (overflowWidth > viewWidth) {
37
- scrollingInterval = scrollText();
38
- function scrollText(direction: "l" | "r" = "r") {
39
- return setInterval(() => {
40
- const reachedEnd =
41
- direction === "r"
42
- ? textEl!.scrollLeft >= overflowWidth - viewWidth
43
- : textEl!.scrollLeft === 0;
44
- if (reachedEnd) {
45
- clearInterval(scrollingInterval);
46
- scrollStartTimeout = setTimeout(
47
- () => {
48
- scrollingInterval = scrollText(
49
- direction === "r" ? "l" : "r"
50
- );
51
- },
52
- direction === "r" ? 2000 : 1000
53
- );
54
- } else {
55
- if (direction === "r")
56
- textEl!.scrollTo(textEl!.scrollLeft + howMuchToMove, 0);
57
- else {
58
- textEl!.scrollTo(
59
- textEl!.scrollLeft - howMuchToMove * RIGHT_TEXT_MULTIPLIER,
60
- 0
61
- );
62
- }
63
- }
64
- }, secondsPerFrame);
65
- }
66
- }
67
- }, 1000);
68
- return () => {
69
- clearTimeout(scrollStartTimeout);
70
- clearInterval(scrollingInterval);
71
- };
72
- }
73
- }, [hovering]);
74
-
75
- return (
76
- <Text
77
- ref={textRef}
78
- {...(uiEvents as any)}
79
- {...props}
80
- className={`${Styles.pingPong} ${props.className || ""}`}
81
- />
82
- );
83
- }
@@ -1,2 +0,0 @@
1
- export { default } from "./PingPongText";
2
- export * from "./PingPongText";
@@ -1,86 +0,0 @@
1
- @import "../../assets/styles/index.scss";
2
-
3
- $animationDurationMs: 2000;
4
-
5
- @value animationDuration #{$animationDurationMs};
6
-
7
- $animationDuration: #{$animationDurationMs}ms;
8
-
9
- .guide {
10
- width: 100%;
11
- position: absolute;
12
- animation-duration: $animationDuration;
13
- display: flex;
14
- flex-direction: column;
15
- justify-content: flex-end;
16
- animation-fill-mode: forwards;
17
- animation-timing-function: linear;
18
- min-height: 10px;
19
- top: 0;
20
- &::after {
21
- content: " ";
22
- width: 100%;
23
- height: 10px;
24
- background: $pixelatedGuideBackground;
25
- }
26
- }
27
-
28
- .grid {
29
- position: absolute;
30
- top: 0px;
31
- right: 0px;
32
- left: 0px;
33
- bottom: 0px;
34
- overflow: hidden;
35
- > * {
36
- display: flex;
37
- opacity: 0;
38
- &.guide {
39
- opacity: 1;
40
- }
41
- }
42
- &.inverse {
43
- transform: rotateX(180deg);
44
- }
45
- }
46
-
47
- .gridItem {
48
- background-color: var(--pixel-color);
49
- }
50
-
51
- .gridAnimate {
52
- animation-duration: #{$animationDurationMs}ms;
53
- }
54
-
55
- .iterate {
56
- .guide {
57
- animation-name: upAndDown;
58
- }
59
- .gridAnimate {
60
- animation-name: onAndOff;
61
- will-change: opacity;
62
- }
63
- }
64
-
65
- @keyframes onAndOff {
66
- 0% {
67
- opacity: 0;
68
- }
69
-
70
- 10% {
71
- opacity: 1;
72
- }
73
-
74
- 100% {
75
- opacity: 0;
76
- }
77
- }
78
-
79
- @keyframes upAndDown {
80
- 0% {
81
- height: 0%;
82
- }
83
- 100% {
84
- height: 100%;
85
- }
86
- }