@onepercentio/one-ui 0.29.2 → 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.
- package/dist/components/Switch/Switch.d.ts +1 -1
- package/dist/components/Switch/Switch.js +1 -1
- package/dist/hooks/useHero.js +3 -2
- package/dist-ts/components/Switch/Switch.d.ts +1 -1
- package/dist-ts/hooks/useHero.js +5 -4
- package/dist-ts/hooks/useHero.js.map +1 -1
- package/package.json +5 -1
- package/src/assets/img/svg/checkbox.svg +0 -3
- package/src/assets/styles/index.scss +0 -2
- package/src/assets/styles/mixins.scss +0 -12
- package/src/assets/styles/variables.scss +0 -49
- package/src/components/AdaptiveButton/AdaptiveButton.module.scss +0 -7
- package/src/components/AdaptiveButton/AdaptiveButton.tsx +0 -26
- package/src/components/AdaptiveButton/index.tsx +0 -2
- package/src/components/AdaptiveContainer/AdaptiveContainer.module.scss +0 -53
- package/src/components/AdaptiveContainer/AdaptiveContainer.tsx +0 -200
- package/src/components/AdaptiveContainer/index.tsx +0 -2
- package/src/components/AdaptiveDialog/AdaptiveDialog.module.scss +0 -147
- package/src/components/AdaptiveDialog/AdaptiveDialog.tsx +0 -97
- package/src/components/AdaptiveDialog/index.tsx +0 -2
- package/src/components/AdaptiveSidebar/AdaptiveSidebar.module.scss +0 -49
- package/src/components/AdaptiveSidebar/AdaptiveSidebar.sample.tsx +0 -10
- package/src/components/AdaptiveSidebar/AdaptiveSidebar.tsx +0 -123
- package/src/components/AdaptiveSidebar/index.tsx +0 -2
- package/src/components/AnchoredTooltip/AnchoredTooltip.module.scss +0 -64
- package/src/components/AnchoredTooltip/AnchoredTooltip.tsx +0 -250
- package/src/components/AnchoredTooltip/index.tsx +0 -2
- package/src/components/AnimatedEntrance/AnimatedEntrance.module.scss +0 -108
- package/src/components/AnimatedEntrance/AnimatedEntrance.tsx +0 -227
- package/src/components/AnimatedEntrance/index.tsx +0 -2
- package/src/components/AsyncWrapper/AsyncWrapper.tsx +0 -38
- package/src/components/AsyncWrapper/index.tsx +0 -2
- package/src/components/Avatar/Avatar.module.scss +0 -22
- package/src/components/Avatar/Avatar.tsx +0 -31
- package/src/components/Avatar/index.tsx +0 -2
- package/src/components/BucketFill/BucketFill.module.scss +0 -36
- package/src/components/BucketFill/BucketFill.tsx +0 -65
- package/src/components/BucketFill/index.tsx +0 -2
- package/src/components/Button/Button.module.scss +0 -45
- package/src/components/Button/Button.tsx +0 -40
- package/src/components/Button/index.tsx +0 -2
- package/src/components/Card/Card.module.scss +0 -12
- package/src/components/Card/Card.tsx +0 -9
- package/src/components/Card/index.tsx +0 -2
- package/src/components/Chart/Chart.e2e.ts +0 -4
- package/src/components/Chart/Chart.logic.tsx +0 -8
- package/src/components/Chart/Chart.module.scss +0 -58
- package/src/components/Chart/Chart.tsx +0 -2
- package/src/components/Chart/Chart.types.ts +0 -35
- package/src/components/Chart/Chart.view.tsx +0 -241
- package/src/components/Chart/index.tsx +0 -2
- package/src/components/CheckBox/CheckBox.module.scss +0 -36
- package/src/components/CheckBox/CheckBox.tsx +0 -63
- package/src/components/CheckBox/index.tsx +0 -2
- package/src/components/CodeInput/CodeInput.module.scss +0 -5
- package/src/components/CodeInput/CodeInput.tsx +0 -84
- package/src/components/CodeInput/index.tsx +0 -2
- package/src/components/Collapsable/Collapsable.module.scss +0 -42
- package/src/components/Collapsable/Collapsable.tsx +0 -253
- package/src/components/Collapsable/index.tsx +0 -2
- package/src/components/Countdown/Countdown.tsx +0 -130
- package/src/components/Countdown/index.tsx +0 -2
- package/src/components/CurrencyInput/CurrencyInput.hook.ts +0 -37
- package/src/components/CurrencyInput/CurrencyInput.tsx +0 -25
- package/src/components/CurrencyInput/index.tsx +0 -2
- package/src/components/Divider/Divider.module.scss +0 -7
- package/src/components/Divider/Divider.tsx +0 -13
- package/src/components/Divider/index.tsx +0 -2
- package/src/components/EmailInput/EmailInput.module.scss +0 -0
- package/src/components/EmailInput/EmailInput.tsx +0 -51
- package/src/components/EmailInput/index.tsx +0 -2
- package/src/components/FadeIn/FadeIn.module.scss +0 -9
- package/src/components/FadeIn/FadeIn.tsx +0 -77
- package/src/components/FadeIn/index.tsx +0 -2
- package/src/components/FileInput/FileInput.module.scss +0 -6
- package/src/components/FileInput/FileInput.tsx +0 -75
- package/src/components/FileInput/View/BigFactory/BigFactory.module.scss +0 -20
- package/src/components/FileInput/View/BigFactory/BigFactory.tsx +0 -48
- package/src/components/FileInput/View/BigFactory/index.tsx +0 -2
- package/src/components/FileInput/View/Compact/Compact.module.scss +0 -68
- package/src/components/FileInput/View/Compact/Compact.tsx +0 -151
- package/src/components/FileInput/View/Compact/index.tsx +0 -2
- package/src/components/FileInput/View/View.types.ts +0 -12
- package/src/components/FileInput/index.tsx +0 -2
- package/src/components/FlowController/FlowController.module.scss +0 -47
- package/src/components/FlowController/FlowController.tsx +0 -93
- package/src/components/FlowController/index.tsx +0 -2
- package/src/components/Form/Form.tsx +0 -243
- package/src/components/Form/index.ts +0 -2
- package/src/components/Form/v2/Form.hook.ts +0 -341
- package/src/components/Form/v2/Form.module.scss +0 -0
- package/src/components/Form/v2/Form.tsx +0 -78
- package/src/components/Form/v2/Form.types.ts +0 -118
- package/src/components/Form/v2/FormField/Extensions/DateField/DateField.module.scss +0 -0
- package/src/components/Form/v2/FormField/Extensions/DateField/DateField.tsx +0 -73
- package/src/components/Form/v2/FormField/Extensions/DateField/index.tsx +0 -2
- package/src/components/Form/v2/FormField/Extensions/PhoneField/PhoneField.module.scss +0 -0
- package/src/components/Form/v2/FormField/Extensions/PhoneField/PhoneField.tsx +0 -91
- package/src/components/Form/v2/FormField/Extensions/PhoneField/index.tsx +0 -2
- package/src/components/Form/v2/FormField/FormField.module.scss +0 -0
- package/src/components/Form/v2/FormField/FormField.tsx +0 -378
- package/src/components/Form/v2/FormField/FormField.types.ts +0 -129
- package/src/components/Form/v2/FormField/index.tsx +0 -2
- package/src/components/Form/v2/index.tsx +0 -2
- package/src/components/Freeze/Freeze.tsx +0 -9
- package/src/components/Freeze/index.tsx +0 -2
- package/src/components/HSForms/HSForms.tsx +0 -57
- package/src/components/HSForms/index.tsx +0 -2
- package/src/components/Header/Header.module.scss +0 -119
- package/src/components/Header/Header.tsx +0 -138
- package/src/components/Header/index.tsx +0 -2
- package/src/components/HeaderCloseBtn/HeaderCloseBtn.module.scss +0 -44
- package/src/components/HeaderCloseBtn/HeaderCloseBtn.tsx +0 -28
- package/src/components/HeaderCloseBtn/index.tsx +0 -2
- package/src/components/InfinityScroll/InfinityScroll.module.scss +0 -30
- package/src/components/InfinityScroll/InfinityScroll.tsx +0 -187
- package/src/components/InfinityScroll/index.tsx +0 -2
- package/src/components/Input/Input.module.scss +0 -71
- package/src/components/Input/Input.tsx +0 -134
- package/src/components/Input/index.tsx +0 -2
- package/src/components/InstantCounter/InstantCounter.tsx +0 -77
- package/src/components/InstantCounter/index.tsx +0 -2
- package/src/components/LavaLamp/LavaLamp.data.tsx +0 -114
- package/src/components/LavaLamp/LavaLamp.module.scss +0 -26
- package/src/components/LavaLamp/LavaLamp.tsx +0 -131
- package/src/components/LavaLamp/index.tsx +0 -2
- package/src/components/LavaLamp/v2/LavaLamp.module.scss +0 -23
- package/src/components/LavaLamp/v2/LavaLamp.tsx +0 -197
- package/src/components/LinkToId/LinkToId.module.scss +0 -4
- package/src/components/LinkToId/LinkToId.tsx +0 -51
- package/src/components/LinkToId/index.tsx +0 -2
- package/src/components/Loader/Loader.module.scss +0 -40
- package/src/components/Loader/Loader.tsx +0 -18
- package/src/components/Loader/index.tsx +0 -2
- package/src/components/LoaderDotsIndicator/LoaderDotsIndicator.tsx +0 -34
- package/src/components/LoaderDotsIndicator/index.tsx +0 -2
- package/src/components/LoopableVideo/LoopableVideo.tsx +0 -37
- package/src/components/LoopableVideo/index.tsx +0 -2
- package/src/components/MainGrid/MainGrid.module.scss +0 -28
- package/src/components/MainGrid/MainGrid.tsx +0 -68
- package/src/components/MainGrid/index.tsx +0 -2
- package/src/components/MutableHamburgerButton/MutableHamburgerButton.module.scss +0 -220
- package/src/components/MutableHamburgerButton/MutableHamburgerButton.tsx +0 -38
- package/src/components/MutableHamburgerButton/index.tsx +0 -2
- package/src/components/Notification/Notification.module.scss +0 -25
- package/src/components/Notification/Notification.tsx +0 -13
- package/src/components/Notification/index.tsx +0 -2
- package/src/components/OrderableList/OrderableList.module.scss +0 -98
- package/src/components/OrderableList/OrderableList.tsx +0 -564
- package/src/components/OrderableList/index.tsx +0 -2
- package/src/components/PaginationIndicator/PaginationIndicator.tsx +0 -365
- package/src/components/PaginationIndicator/index.tsx +0 -2
- package/src/components/Parallax/Parallax.module.scss +0 -28
- package/src/components/Parallax/Parallax.tsx +0 -225
- package/src/components/Parallax/index.tsx +0 -2
- package/src/components/Parallax/math/helpers.ts +0 -289
- package/src/components/PasswordInput/PasswordInput.module.scss +0 -17
- package/src/components/PasswordInput/PasswordInput.tsx +0 -154
- package/src/components/PasswordInput/index.tsx +0 -2
- package/src/components/PingPongText/PingPongText.module.scss +0 -4
- package/src/components/PingPongText/PingPongText.tsx +0 -83
- package/src/components/PingPongText/index.tsx +0 -2
- package/src/components/PixelatedScan/PixelatedScan.module.scss +0 -86
- package/src/components/PixelatedScan/PixelatedScan.tsx +0 -175
- package/src/components/PixelatedScan/index.tsx +0 -2
- package/src/components/Portal/Portal.module.scss +0 -3
- package/src/components/Portal/Portal.tsx +0 -68
- package/src/components/Portal/index.tsx +0 -2
- package/src/components/ProgressBar/ProgressBar.module.scss +0 -44
- package/src/components/ProgressBar/ProgressBar.tsx +0 -124
- package/src/components/ProgressBar/index.tsx +0 -2
- package/src/components/ProgressTexts/ProgressTexts.module.scss +0 -37
- package/src/components/ProgressTexts/ProgressTexts.tsx +0 -85
- package/src/components/ProgressTexts/index.tsx +0 -2
- package/src/components/Radio/Radio.module.scss +0 -36
- package/src/components/Radio/Radio.tsx +0 -53
- package/src/components/Radio/index.tsx +0 -2
- package/src/components/SectionContainer/SectionContainer.module.scss +0 -30
- package/src/components/SectionContainer/SectionContainer.tsx +0 -49
- package/src/components/SectionContainer/index.tsx +0 -2
- package/src/components/Select/Select.module.scss +0 -58
- package/src/components/Select/Select.tsx +0 -192
- package/src/components/Select/index.tsx +0 -2
- package/src/components/Skeleton/Skeleton.module.scss +0 -21
- package/src/components/Skeleton/Skeleton.tsx +0 -29
- package/src/components/Skeleton/index.tsx +0 -2
- package/src/components/Spacing/Spacing.module.scss +0 -13
- package/src/components/Spacing/Spacing.tsx +0 -24
- package/src/components/Spacing/index.tsx +0 -2
- package/src/components/StaticScroller/StaticScroller.module.scss +0 -14
- package/src/components/StaticScroller/StaticScroller.tsx +0 -83
- package/src/components/StaticScroller/index.tsx +0 -2
- package/src/components/Switch/Switch.module.scss +0 -43
- package/src/components/Switch/Switch.tsx +0 -41
- package/src/components/Switch/index.tsx +0 -2
- package/src/components/Table/Table.module.scss +0 -76
- package/src/components/Table/Table.tsx +0 -152
- package/src/components/Table/index.tsx +0 -2
- package/src/components/Tabs/Tabs.module.scss +0 -40
- package/src/components/Tabs/Tabs.tsx +0 -104
- package/src/components/Tabs/index.tsx +0 -2
- package/src/components/Text/Text.module.scss +0 -81
- package/src/components/Text/Text.tsx +0 -42
- package/src/components/Text/index.tsx +0 -2
- package/src/components/Transition/MasksFactory/DiagonalReveal.tsx +0 -47
- package/src/components/Transition/MasksFactory/DiagonalSquareToBalls.tsx +0 -78
- package/src/components/Transition/MasksFactory/PhysicsSquares.tsx +0 -106
- package/src/components/Transition/MasksFactory/SquareToBalls.tsx +0 -66
- package/src/components/Transition/MasksFactory/utils.ts +0 -35
- package/src/components/Transition/Transition.module.scss +0 -211
- package/src/components/Transition/Transition.tsx +0 -495
- package/src/components/Transition/index.tsx +0 -2
- package/src/components/UncontrolledTransition/UncontrolledTransition.ai.md +0 -9
- package/src/components/UncontrolledTransition/UncontrolledTransition.sample.tsx +0 -34
- package/src/components/UncontrolledTransition/UncontrolledTransition.tsx +0 -143
- package/src/components/UncontrolledTransition/index.tsx +0 -2
- package/src/components/WalletConnectionWrapper/WalletConnectionWrapper.tsx +0 -212
- package/src/components/WalletConnectionWrapper/index.tsx +0 -2
- package/src/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.module.scss +0 -5
- package/src/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.tsx +0 -52
- package/src/components/utilitary/ScrollAndFocusLock/index.tsx +0 -2
- package/src/context/AsyncProcess.tsx +0 -107
- package/src/context/ContextAsyncControl.tsx +0 -89
- package/src/context/CustomBrowserRouter.tsx +0 -55
- package/src/context/OneUIProvider.tsx +0 -308
- package/src/hooks/logs/useDependencyChangeDetection.ts +0 -25
- package/src/hooks/logs/useIsMounting.ts +0 -7
- package/src/hooks/persistence/useLocalStorage.ts +0 -45
- package/src/hooks/shims/ObjectWatchShim.ts +0 -56
- package/src/hooks/ui/useAdaptiveImage.tsx +0 -36
- package/src/hooks/ui/useAlternating.tsx +0 -22
- package/src/hooks/ui/useBreakpoint.tsx +0 -21
- package/src/hooks/ui/useCustomScrollbar.module.scss +0 -20
- package/src/hooks/ui/useCustomScrollbar.tsx +0 -22
- package/src/hooks/ui/useEffectIf.ts +0 -11
- package/src/hooks/ui/useMouseHover.tsx +0 -26
- package/src/hooks/ui/usePaginationControls.module.scss +0 -16
- package/src/hooks/ui/usePaginationControls.tsx +0 -176
- package/src/hooks/ui/useSnapToViewport.module.scss +0 -6
- package/src/hooks/ui/useSnapToViewport.ts +0 -28
- package/src/hooks/ui/useTilt.tsx +0 -219
- package/src/hooks/ui/useZoomable.module.scss +0 -34
- package/src/hooks/ui/useZoomable.tsx +0 -144
- package/src/hooks/useAsyncControl.ai.md +0 -25
- package/src/hooks/useAsyncControl.ts +0 -101
- package/src/hooks/useContainedRepositioning.ts +0 -110
- package/src/hooks/useCustomHistory.ts +0 -14
- package/src/hooks/useElementFit.ts +0 -82
- package/src/hooks/useFirestoreWatch.ts +0 -54
- package/src/hooks/useForm.ts +0 -49
- package/src/hooks/useFreeze.ts +0 -12
- package/src/hooks/useHero.module.scss +0 -41
- package/src/hooks/useHero.ts +0 -512
- package/src/hooks/useIntersection.ts +0 -32
- package/src/hooks/useMergeRefs.ts +0 -29
- package/src/hooks/useObserve.ts +0 -24
- package/src/hooks/usePagination.ts +0 -228
- package/src/hooks/usePooledOperation.ts +0 -54
- package/src/hooks/usePooling.ts +0 -46
- package/src/hooks/useRebound.ts +0 -23
- package/src/hooks/useShortIntl.ai.md +0 -5
- package/src/hooks/useShortIntl.ts +0 -97
- package/src/hooks/utility/useAsyncMemo.ts +0 -43
- package/src/hooks/utility/useDepChange.ts +0 -11
- package/src/hooks/utility/useEvents.ts +0 -33
- package/src/hooks/utility/useImmediate.ts +0 -8
- package/src/hooks/utility/useManualInit.ts +0 -24
- package/src/hooks/utility/useModule.ts +0 -15
- package/src/hooks/utility/useQuery.ts +0 -15
- package/src/hooks/utility/useUniqueEffect.ts +0 -22
- package/src/index.preprocess.ts +0 -82
- package/src/index.ts +0 -229
- package/src/models/DebugLogger.ts +0 -7
- package/src/models/GenericContract.ts +0 -169
- package/src/models/Orbs.ts +0 -97
- package/src/reac-app-env.d.ts +0 -6
- package/src/storybook/assets/video/txt-reversed.mp4 +0 -0
- package/src/storybookUtils/index.tsx +0 -53
- package/src/test.tsx +0 -0
- package/src/type-utils.ts +0 -49
- package/src/types.ts +0 -199
- package/src/utility.d.ts +0 -70
- package/src/utils/blockchain.ts +0 -43
- package/src/utils/e2e.ts +0 -55
- package/src/utils/flatten.ts +0 -17
- package/src/utils/formatters.ts +0 -36
- package/src/utils/html.utils.ts +0 -3
- package/src/utils/ownEvent.ts +0 -8
- package/src/utils/test.ts +0 -20
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
createContext,
|
|
3
|
-
ElementRef,
|
|
4
|
-
useContext,
|
|
5
|
-
useMemo,
|
|
6
|
-
useRef,
|
|
7
|
-
} from "react";
|
|
8
|
-
import { useOneUIContext } from "../../context/OneUIProvider";
|
|
9
|
-
import Button from "../Button";
|
|
10
|
-
import Spacing from "../Spacing";
|
|
11
|
-
import UncontrolledTransition from "../UncontrolledTransition";
|
|
12
|
-
import Styles from "./Table.module.scss";
|
|
13
|
-
|
|
14
|
-
export type TableProps<I extends any> = {
|
|
15
|
-
className?: string;
|
|
16
|
-
heading: {
|
|
17
|
-
[K in keyof I]?: string;
|
|
18
|
-
};
|
|
19
|
-
order: (keyof I)[];
|
|
20
|
-
items: (I & { className?: string })[];
|
|
21
|
-
paginable?: {
|
|
22
|
-
currentPage: number;
|
|
23
|
-
totalItems: number;
|
|
24
|
-
togglePage: (page: number) => void;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* A simple table layout
|
|
30
|
-
**/
|
|
31
|
-
export default function Table<I extends any>({
|
|
32
|
-
paginable,
|
|
33
|
-
heading,
|
|
34
|
-
order,
|
|
35
|
-
items,
|
|
36
|
-
className = "",
|
|
37
|
-
}: TableProps<I>) {
|
|
38
|
-
const transitionRef =
|
|
39
|
-
useRef<ElementRef<typeof UncontrolledTransition> | HTMLDivElement>(null);
|
|
40
|
-
const {
|
|
41
|
-
controls: {
|
|
42
|
-
NextPage = ({ disabled }) => (
|
|
43
|
-
<Button disabled={disabled} variant="filled">
|
|
44
|
-
{">"}
|
|
45
|
-
</Button>
|
|
46
|
-
),
|
|
47
|
-
PrevPage = ({ disabled }) => (
|
|
48
|
-
<Button disabled={disabled} variant="filled">
|
|
49
|
-
{"<"}
|
|
50
|
-
</Button>
|
|
51
|
-
),
|
|
52
|
-
},
|
|
53
|
-
} = useOneUIContext().component.table;
|
|
54
|
-
|
|
55
|
-
const { items: itemsToShow, pages } = useMemo(() => {
|
|
56
|
-
if (paginable) {
|
|
57
|
-
const numPages = Math.ceil(paginable.totalItems / 5);
|
|
58
|
-
|
|
59
|
-
return {
|
|
60
|
-
items: items.slice(
|
|
61
|
-
(paginable.currentPage - 1) * 5,
|
|
62
|
-
(paginable.currentPage - 1) * 5 + 5
|
|
63
|
-
),
|
|
64
|
-
pages: numPages,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
return {
|
|
68
|
-
items: items,
|
|
69
|
-
};
|
|
70
|
-
}, [items, paginable?.currentPage, paginable?.totalItems]);
|
|
71
|
-
|
|
72
|
-
const Wrapper = paginable ? UncontrolledTransition : "div";
|
|
73
|
-
|
|
74
|
-
return (
|
|
75
|
-
<>
|
|
76
|
-
<TableContext.Provider
|
|
77
|
-
value={{
|
|
78
|
-
itemsToShow,
|
|
79
|
-
keys: order,
|
|
80
|
-
heading,
|
|
81
|
-
}}
|
|
82
|
-
>
|
|
83
|
-
<Wrapper
|
|
84
|
-
className={Styles.transitionContainer}
|
|
85
|
-
ref={transitionRef as any}
|
|
86
|
-
>
|
|
87
|
-
<TableComp key={paginable?.currentPage} className={className} />
|
|
88
|
-
</Wrapper>
|
|
89
|
-
</TableContext.Provider>
|
|
90
|
-
{paginable && paginable.totalItems > 5 ? (
|
|
91
|
-
<>
|
|
92
|
-
<Spacing size="small" />
|
|
93
|
-
<div className={Styles.footer} data-testid="controls">
|
|
94
|
-
<span
|
|
95
|
-
className={Styles.iterable}
|
|
96
|
-
onClick={() => {
|
|
97
|
-
if (!(transitionRef.current instanceof HTMLDivElement))
|
|
98
|
-
transitionRef.current!.setOrientation("backward");
|
|
99
|
-
paginable.togglePage(paginable.currentPage - 1);
|
|
100
|
-
}}
|
|
101
|
-
>
|
|
102
|
-
<PrevPage disabled={paginable.currentPage === 1} />
|
|
103
|
-
</span>
|
|
104
|
-
<span
|
|
105
|
-
className={Styles.paging}
|
|
106
|
-
>{`${paginable.currentPage}/${pages}`}</span>
|
|
107
|
-
<span
|
|
108
|
-
className={Styles.iterable}
|
|
109
|
-
onClick={() => {
|
|
110
|
-
if (!(transitionRef.current instanceof HTMLDivElement))
|
|
111
|
-
transitionRef.current!.setOrientation("forward");
|
|
112
|
-
paginable.togglePage(paginable.currentPage + 1);
|
|
113
|
-
}}
|
|
114
|
-
>
|
|
115
|
-
<NextPage disabled={paginable.currentPage === pages} />
|
|
116
|
-
</span>
|
|
117
|
-
</div>
|
|
118
|
-
</>
|
|
119
|
-
) : null}
|
|
120
|
-
</>
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
const TableContext = createContext<{
|
|
125
|
-
itemsToShow: any[];
|
|
126
|
-
keys: any[];
|
|
127
|
-
heading: { [k: string]: string | undefined };
|
|
128
|
-
}>(null as any);
|
|
129
|
-
|
|
130
|
-
function TableComp({ className }: { className: string }) {
|
|
131
|
-
const { itemsToShow, keys, heading } = useContext(TableContext);
|
|
132
|
-
return (
|
|
133
|
-
<table className={`${Styles.container} ${className}`}>
|
|
134
|
-
<thead>
|
|
135
|
-
<tr>
|
|
136
|
-
{keys.map((key) => (
|
|
137
|
-
<th key={String(key)}>{heading[key]}</th>
|
|
138
|
-
))}
|
|
139
|
-
</tr>
|
|
140
|
-
</thead>
|
|
141
|
-
<tbody>
|
|
142
|
-
{itemsToShow.map((i, index) => (
|
|
143
|
-
<tr key={String(index)} className={i.className}>
|
|
144
|
-
{keys.map((key) => (
|
|
145
|
-
<td key={String(key)}>{i[key]}</td>
|
|
146
|
-
))}
|
|
147
|
-
</tr>
|
|
148
|
-
))}
|
|
149
|
-
</tbody>
|
|
150
|
-
</table>
|
|
151
|
-
);
|
|
152
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
@import "../../assets/styles/index.scss";
|
|
2
|
-
|
|
3
|
-
.container {
|
|
4
|
-
overflow-x: auto;
|
|
5
|
-
display: flex;
|
|
6
|
-
position: relative;
|
|
7
|
-
align-items: flex-start;
|
|
8
|
-
> div {
|
|
9
|
-
cursor: pointer;
|
|
10
|
-
&.selected {
|
|
11
|
-
font-weight: bold;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
&.FULL {
|
|
15
|
-
overflow: visible;
|
|
16
|
-
> div {
|
|
17
|
-
transition: color 250ms linear;
|
|
18
|
-
padding: 0.4em 1em;
|
|
19
|
-
z-index: 1;
|
|
20
|
-
margin: 0px;
|
|
21
|
-
|
|
22
|
-
&.selected {
|
|
23
|
-
color: var(--tab-selected-color);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
.guide {
|
|
27
|
-
box-shadow: $elevation;
|
|
28
|
-
border-radius: 1em / 50%;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.guide {
|
|
34
|
-
height: 0.1em;
|
|
35
|
-
background-color: var(--tab-guide-color, $digitalBlue);
|
|
36
|
-
position: absolute;
|
|
37
|
-
&.enableTransition {
|
|
38
|
-
transition: left $fast, width $fast, top $fast, height $fast;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import React, { ReactElement, useEffect, useRef } from "react";
|
|
2
|
-
import Styles from "./Tabs.module.scss";
|
|
3
|
-
|
|
4
|
-
export enum TabType {
|
|
5
|
-
/** A div that encovers the tab */
|
|
6
|
-
FULL,
|
|
7
|
-
/** An underline */
|
|
8
|
-
UNDERLINE,
|
|
9
|
-
/** A class is assigned to the selected tab */
|
|
10
|
-
CLASS,
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Show tabs for toggling between options
|
|
15
|
-
**/
|
|
16
|
-
export default function Tabs<O extends string | number>(
|
|
17
|
-
props: {
|
|
18
|
-
options: Readonly<
|
|
19
|
-
{
|
|
20
|
-
id: O;
|
|
21
|
-
label: string | ReactElement;
|
|
22
|
-
}[]
|
|
23
|
-
>;
|
|
24
|
-
selected?: O;
|
|
25
|
-
onSelect: (option: O) => void;
|
|
26
|
-
itemClassName?: string;
|
|
27
|
-
className?: string;
|
|
28
|
-
} & (
|
|
29
|
-
| {
|
|
30
|
-
type?: Exclude<TabType, TabType.CLASS>;
|
|
31
|
-
}
|
|
32
|
-
| {
|
|
33
|
-
type?: Extract<TabType, TabType.CLASS>;
|
|
34
|
-
selectedClass: string;
|
|
35
|
-
}
|
|
36
|
-
)
|
|
37
|
-
) {
|
|
38
|
-
const {
|
|
39
|
-
options,
|
|
40
|
-
selected,
|
|
41
|
-
onSelect,
|
|
42
|
-
itemClassName = "",
|
|
43
|
-
className = "",
|
|
44
|
-
type = TabType.UNDERLINE,
|
|
45
|
-
} = props;
|
|
46
|
-
const selectedRef = useRef<HTMLParagraphElement>(null);
|
|
47
|
-
const guideRef = useRef<HTMLDivElement>(null);
|
|
48
|
-
useEffect(() => {
|
|
49
|
-
if (props.type === TabType.CLASS) return;
|
|
50
|
-
const guideStyle = guideRef.current!.style;
|
|
51
|
-
const currEl = selectedRef.current;
|
|
52
|
-
guideStyle["opacity"] = currEl ? "1" : guideStyle["opacity"];
|
|
53
|
-
guideStyle["width"] = currEl ? currEl.clientWidth + "px" : "0px";
|
|
54
|
-
guideStyle["left"] = currEl
|
|
55
|
-
? currEl.offsetLeft + "px"
|
|
56
|
-
: guideStyle["left"] || "initial";
|
|
57
|
-
if (type === TabType.FULL) {
|
|
58
|
-
guideStyle["height"] = currEl ? currEl.clientHeight + "px" : "";
|
|
59
|
-
guideStyle["top"] = currEl
|
|
60
|
-
? currEl.offsetTop + "px"
|
|
61
|
-
: guideStyle["top"] || "initial";
|
|
62
|
-
} else {
|
|
63
|
-
guideStyle["top"] = currEl
|
|
64
|
-
? currEl.offsetTop + currEl.clientHeight + "px"
|
|
65
|
-
: guideStyle["top"] || "initial";
|
|
66
|
-
}
|
|
67
|
-
}, [selected]);
|
|
68
|
-
|
|
69
|
-
useEffect(() => {
|
|
70
|
-
if (props.type === TabType.CLASS) return;
|
|
71
|
-
guideRef.current!.classList.add(Styles.enableTransition);
|
|
72
|
-
}, []);
|
|
73
|
-
const tabNativeCls = TabType[type] in Styles ? Styles[TabType[type]] : "";
|
|
74
|
-
return (
|
|
75
|
-
<>
|
|
76
|
-
<div className={`${Styles.container} ${className} ${tabNativeCls}`}>
|
|
77
|
-
{options.map((o) => (
|
|
78
|
-
<div
|
|
79
|
-
ref={selected === o.id ? selectedRef : undefined}
|
|
80
|
-
onClick={() => onSelect(o.id)}
|
|
81
|
-
className={`${
|
|
82
|
-
selected === o.id ? Styles.selected : ""
|
|
83
|
-
} ${itemClassName} ${
|
|
84
|
-
props.type === TabType.CLASS && selected === o.id
|
|
85
|
-
? props.selectedClass
|
|
86
|
-
: ""
|
|
87
|
-
}`}
|
|
88
|
-
key={o.id}
|
|
89
|
-
data-testid="tab-option"
|
|
90
|
-
>
|
|
91
|
-
{o.label}
|
|
92
|
-
</div>
|
|
93
|
-
))}
|
|
94
|
-
{TabType.CLASS !== props.type && (
|
|
95
|
-
<div
|
|
96
|
-
ref={guideRef}
|
|
97
|
-
className={Styles.guide}
|
|
98
|
-
data-testid="tab-guide"
|
|
99
|
-
/>
|
|
100
|
-
)}
|
|
101
|
-
</div>
|
|
102
|
-
</>
|
|
103
|
-
);
|
|
104
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
@import "../../assets/styles/index.scss";
|
|
2
|
-
|
|
3
|
-
.title {
|
|
4
|
-
font-weight: 300;
|
|
5
|
-
font-size: 22px;
|
|
6
|
-
line-height: 33px;
|
|
7
|
-
}
|
|
8
|
-
.boldTitle {
|
|
9
|
-
font-family: $secondaryFontFamily;
|
|
10
|
-
font-size: 24px;
|
|
11
|
-
font-weight: bolder;
|
|
12
|
-
line-height: 26px;
|
|
13
|
-
}
|
|
14
|
-
.boldTitleBig {
|
|
15
|
-
font-family: $secondaryFontFamily;
|
|
16
|
-
font-size: 28px;
|
|
17
|
-
font-weight: bolder;
|
|
18
|
-
line-height: 33.8px;
|
|
19
|
-
}
|
|
20
|
-
.content {
|
|
21
|
-
font-size: 16px;
|
|
22
|
-
line-height: 24px;
|
|
23
|
-
font-family: $mainFontFamily;
|
|
24
|
-
}
|
|
25
|
-
.icon.description {
|
|
26
|
-
font-size: 14px;
|
|
27
|
-
line-height: 21px;
|
|
28
|
-
color: $darkestGray;
|
|
29
|
-
}
|
|
30
|
-
.text.error,
|
|
31
|
-
.text.caption {
|
|
32
|
-
font-size: 12px;
|
|
33
|
-
line-height: 18px;
|
|
34
|
-
}
|
|
35
|
-
.text.error {
|
|
36
|
-
color: $warningRed;
|
|
37
|
-
}
|
|
38
|
-
.text {
|
|
39
|
-
margin: 0px;
|
|
40
|
-
font-family: $mainFontFamily;
|
|
41
|
-
white-space: pre-wrap;
|
|
42
|
-
color: $textDefaultColor;
|
|
43
|
-
}
|
|
44
|
-
.highlightTitle {
|
|
45
|
-
font-family: $secondaryFontFamily;
|
|
46
|
-
font-size: 24px;
|
|
47
|
-
font-weight: bolder;
|
|
48
|
-
line-height: 29px;
|
|
49
|
-
color: $sunsetPink;
|
|
50
|
-
}
|
|
51
|
-
.subtitle {
|
|
52
|
-
font-family: $secondaryFontFamily;
|
|
53
|
-
font-size: 20px;
|
|
54
|
-
font-weight: 800;
|
|
55
|
-
line-height: 22px;
|
|
56
|
-
color: var(--text-default-color, $gray);
|
|
57
|
-
}
|
|
58
|
-
.link {
|
|
59
|
-
font-family: $mainFontFamily;
|
|
60
|
-
font-size: 12px;
|
|
61
|
-
font-weight: 400;
|
|
62
|
-
line-height: 18px;
|
|
63
|
-
}
|
|
64
|
-
.iteractible {
|
|
65
|
-
cursor: pointer;
|
|
66
|
-
&:hover {
|
|
67
|
-
text-decoration: underline;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.highlight {
|
|
72
|
-
font-family: $secondaryFontFamily;
|
|
73
|
-
font-size: 14px;
|
|
74
|
-
font-weight: 500;
|
|
75
|
-
line-height: 20px;
|
|
76
|
-
color: $sunsetPink;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.text[color="primary"] {
|
|
80
|
-
color: var(--digital-blue);
|
|
81
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import React, { ComponentProps, ForwardedRef, forwardRef } from "react";
|
|
2
|
-
import { useOneUIConfig } from "../../context/OneUIProvider";
|
|
3
|
-
import Styles from "./Text.module.scss";
|
|
4
|
-
|
|
5
|
-
export function _Text(
|
|
6
|
-
{
|
|
7
|
-
type,
|
|
8
|
-
children,
|
|
9
|
-
className = "",
|
|
10
|
-
...otherProps
|
|
11
|
-
}: React.PropsWithChildren<
|
|
12
|
-
{
|
|
13
|
-
className?: string;
|
|
14
|
-
type: OnepercentUtility.UIElements.TextVariants;
|
|
15
|
-
color?: OnepercentUtility.UIElements.TextColors;
|
|
16
|
-
} & Omit<React.HTMLAttributes<HTMLParagraphElement>, "color">
|
|
17
|
-
>,
|
|
18
|
-
_ref?: ForwardedRef<HTMLParagraphElement>
|
|
19
|
-
) {
|
|
20
|
-
const classNameType = useOneUIConfig("component.text.className", {});
|
|
21
|
-
const tagByType = useOneUIConfig("component.text.htmlTag", {});
|
|
22
|
-
|
|
23
|
-
const TagType = tagByType[type] || "p";
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<TagType
|
|
27
|
-
ref={_ref}
|
|
28
|
-
className={`${Styles.text} ${
|
|
29
|
-
classNameType[type] || Styles[type]
|
|
30
|
-
} ${className} ${otherProps.onClick ? Styles.iteractible : ""}`}
|
|
31
|
-
{...otherProps}
|
|
32
|
-
>
|
|
33
|
-
{children}
|
|
34
|
-
</TagType>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* A component to hold all text variantions
|
|
40
|
-
**/
|
|
41
|
-
const Text = forwardRef(_Text);
|
|
42
|
-
export default Text;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { renderToString } from "react-dom/server";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { getTime } from "./utils";
|
|
4
|
-
|
|
5
|
-
export default function DiagonalReveal(el: HTMLDivElement) {
|
|
6
|
-
const height = el.clientHeight;
|
|
7
|
-
const width = el.clientWidth;
|
|
8
|
-
const time = getTime(el);
|
|
9
|
-
const filterId = `f-${Date.now().toString()}`;
|
|
10
|
-
const resultSvg = renderToString(
|
|
11
|
-
<svg xmlns="http://www.w3.org/2000/svg" id={Date.now().toString()}>
|
|
12
|
-
<defs>
|
|
13
|
-
<filter id={filterId} x="0" y="0">
|
|
14
|
-
<feGaussianBlur in="SourceGraphic" stdDeviation="15" />
|
|
15
|
-
</filter>
|
|
16
|
-
</defs>
|
|
17
|
-
<rect
|
|
18
|
-
x="-25"
|
|
19
|
-
y="-25"
|
|
20
|
-
width={`${width * 1.5}px`}
|
|
21
|
-
fill="white"
|
|
22
|
-
height={`${height * 1.1}px`}
|
|
23
|
-
filter={`url(#${filterId})`}
|
|
24
|
-
>
|
|
25
|
-
<animateTransform
|
|
26
|
-
attributeName="transform"
|
|
27
|
-
attributeType="XML"
|
|
28
|
-
type="rotate"
|
|
29
|
-
values="0 0 0; 25 0 0; 32 0 0;"
|
|
30
|
-
dur={`${time}ms`}
|
|
31
|
-
/>
|
|
32
|
-
<animateTransform
|
|
33
|
-
additive="sum"
|
|
34
|
-
attributeName="transform"
|
|
35
|
-
attributeType="XML"
|
|
36
|
-
type="translate"
|
|
37
|
-
values={`0 0; 0 ${height * 0.2}; 0 ${height};`}
|
|
38
|
-
dur={`${time}ms`}
|
|
39
|
-
/>
|
|
40
|
-
</rect>
|
|
41
|
-
</svg>
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
return `url('data:image/svg+xml;charset=utf8,${encodeURIComponent(
|
|
45
|
-
resultSvg
|
|
46
|
-
)}')`;
|
|
47
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { renderToString } from "react-dom/server";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import buildGrid, { getTime } from "./utils";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Creates an svg that transitions from a square grid to rounded corners and them shrinks the balls to reveal the content
|
|
7
|
-
* @param amountOfVerticalSquares The amount of squares vertically to be shown
|
|
8
|
-
*/
|
|
9
|
-
export default function DiagonalSquareToBalls(
|
|
10
|
-
amountOfVerticalSquares: number = 10
|
|
11
|
-
) {
|
|
12
|
-
return function (el: HTMLDivElement) {
|
|
13
|
-
const height = el.clientHeight;
|
|
14
|
-
const width = el.clientWidth;
|
|
15
|
-
const _ballsize = height / amountOfVerticalSquares;
|
|
16
|
-
const maximumBalls = width / _ballsize;
|
|
17
|
-
const amountOfBalls = Math.floor(maximumBalls);
|
|
18
|
-
|
|
19
|
-
const _time = getTime(el);
|
|
20
|
-
const rndTime = () => _time * 0.25 + _time * 0.75 * 1;
|
|
21
|
-
|
|
22
|
-
const resultSvg = renderToString(
|
|
23
|
-
<svg xmlns="http://www.w3.org/2000/svg" id={Date.now().toString()}>
|
|
24
|
-
{buildGrid(amountOfVerticalSquares, amountOfBalls, _ballsize).map(
|
|
25
|
-
({ ballSize: _ballsize, x: _x, y: _y, column, row }) => {
|
|
26
|
-
const ratio =
|
|
27
|
-
(column / amountOfBalls) * (row / amountOfVerticalSquares);
|
|
28
|
-
const fourthTime = rndTime() * 0.25;
|
|
29
|
-
const time = fourthTime + ratio * (fourthTime * 3);
|
|
30
|
-
const padding = 1 * _ballsize;
|
|
31
|
-
const ballsize = _ballsize - padding;
|
|
32
|
-
|
|
33
|
-
const x = _x + padding / 2;
|
|
34
|
-
const y = _y + padding / 2;
|
|
35
|
-
return (
|
|
36
|
-
<rect fill="white" rx={`${ballsize}px`}>
|
|
37
|
-
<animate
|
|
38
|
-
attributeName="rx"
|
|
39
|
-
attributeType="XML"
|
|
40
|
-
values={`${0}px;${0}px;${_ballsize}px`}
|
|
41
|
-
dur={`${time / 2}ms`}
|
|
42
|
-
/>
|
|
43
|
-
<animate
|
|
44
|
-
attributeName="x"
|
|
45
|
-
attributeType="XML"
|
|
46
|
-
values={`${_x}px;${x}px;${x + ballsize / 2}px`}
|
|
47
|
-
dur={`${time}ms`}
|
|
48
|
-
/>
|
|
49
|
-
<animate
|
|
50
|
-
attributeName="y"
|
|
51
|
-
attributeType="XML"
|
|
52
|
-
values={`${_y}px;${y}px;${y + ballsize / 2}px`}
|
|
53
|
-
dur={`${time}ms`}
|
|
54
|
-
/>
|
|
55
|
-
<animate
|
|
56
|
-
attributeName="width"
|
|
57
|
-
attributeType="XML"
|
|
58
|
-
values={`${_ballsize}px;${ballsize}px;${0}px`}
|
|
59
|
-
dur={`${time}ms`}
|
|
60
|
-
/>
|
|
61
|
-
<animate
|
|
62
|
-
attributeName="height"
|
|
63
|
-
attributeType="XML"
|
|
64
|
-
values={`${_ballsize}px;${ballsize}px;${0}px`}
|
|
65
|
-
dur={`${time}ms`}
|
|
66
|
-
/>
|
|
67
|
-
</rect>
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
)}
|
|
71
|
-
</svg>
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
return `url('data:image/svg+xml;charset=utf8,${encodeURIComponent(
|
|
75
|
-
resultSvg
|
|
76
|
-
)}')`;
|
|
77
|
-
};
|
|
78
|
-
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import Matter from "matter-js";
|
|
2
|
-
import buildGrid from "./utils";
|
|
3
|
-
/**
|
|
4
|
-
* DO NOT DARE TO USE THIS IF YOU HAVE A MINIMAL RESPECT FOR PERFORMANCE
|
|
5
|
-
*
|
|
6
|
-
* Creates an svg that transitions from a square grid to rounded corners and them shrinks the balls to reveal the content
|
|
7
|
-
* @param amountOfVerticalSquares The amount of squares vertically to be shown
|
|
8
|
-
*/
|
|
9
|
-
export default function PhysicsSquares(amountOfVerticalSquares: number = 10) {
|
|
10
|
-
return function (el: HTMLDivElement) {
|
|
11
|
-
const height = el.clientHeight;
|
|
12
|
-
const width = el.clientWidth;
|
|
13
|
-
const _ballsize = height / amountOfVerticalSquares;
|
|
14
|
-
const maximumBalls = width / _ballsize;
|
|
15
|
-
const amountOfBalls = Math.floor(maximumBalls);
|
|
16
|
-
const gridData = buildGrid(
|
|
17
|
-
amountOfVerticalSquares,
|
|
18
|
-
amountOfBalls,
|
|
19
|
-
_ballsize
|
|
20
|
-
);
|
|
21
|
-
const _time = getComputedStyle(el).getPropertyValue(
|
|
22
|
-
"--animation-speed-transition"
|
|
23
|
-
);
|
|
24
|
-
const time = _time.endsWith("ms")
|
|
25
|
-
? Number(_time.replace("ms", ""))
|
|
26
|
-
: Number(_time.replace("s", "")) * 1000;
|
|
27
|
-
const canvas = document.createElement("canvas");
|
|
28
|
-
canvas.width = el.clientWidth / 10;
|
|
29
|
-
canvas.height = el.clientHeight / 10;
|
|
30
|
-
// module aliases
|
|
31
|
-
var Engine = Matter.Engine,
|
|
32
|
-
Render = Matter.Render,
|
|
33
|
-
Runner = Matter.Runner,
|
|
34
|
-
Bodies = Matter.Bodies,
|
|
35
|
-
Composite = Matter.Composite;
|
|
36
|
-
|
|
37
|
-
// create an engine
|
|
38
|
-
var engine = Engine.create();
|
|
39
|
-
|
|
40
|
-
// create a renderer
|
|
41
|
-
var render = Render.create({
|
|
42
|
-
engine: engine,
|
|
43
|
-
options: {
|
|
44
|
-
wireframes: false,
|
|
45
|
-
background: "black",
|
|
46
|
-
height: el.clientHeight,
|
|
47
|
-
width: el.clientWidth,
|
|
48
|
-
},
|
|
49
|
-
canvas: canvas,
|
|
50
|
-
bounds: {
|
|
51
|
-
min: {
|
|
52
|
-
x: 0,
|
|
53
|
-
y: 0,
|
|
54
|
-
},
|
|
55
|
-
max: {
|
|
56
|
-
x: el.clientWidth,
|
|
57
|
-
y: el.clientHeight,
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
var ground = Bodies.rectangle(0, el.clientHeight, el.clientWidth * 2, 10, {
|
|
62
|
-
render: {
|
|
63
|
-
fillStyle: "black",
|
|
64
|
-
},
|
|
65
|
-
angle: 0.1,
|
|
66
|
-
isStatic: true,
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
const gridBodies = gridData.map((a) =>
|
|
70
|
-
Bodies.circle(
|
|
71
|
-
a.x + a.ballSize / 2 + (Math.random() * a.ballSize) / 2,
|
|
72
|
-
a.y + a.ballSize / 2 + (Math.random() * a.ballSize) / 2,
|
|
73
|
-
a.ballSize / 4 + (Math.random() * a.ballSize) / 4,
|
|
74
|
-
{
|
|
75
|
-
density: 0.1,
|
|
76
|
-
render: {
|
|
77
|
-
fillStyle: "black",
|
|
78
|
-
},
|
|
79
|
-
}
|
|
80
|
-
)
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
// add all of the bodies to the world
|
|
84
|
-
Composite.add(engine.world, [...gridBodies, ground]);
|
|
85
|
-
|
|
86
|
-
// run the renderer
|
|
87
|
-
Render.run(render);
|
|
88
|
-
|
|
89
|
-
// create runner
|
|
90
|
-
var runner = Runner.create();
|
|
91
|
-
|
|
92
|
-
// run the engine
|
|
93
|
-
Runner.run(runner, engine);
|
|
94
|
-
|
|
95
|
-
const i = setInterval(() => {
|
|
96
|
-
(
|
|
97
|
-
el.firstElementChild! as HTMLDivElement
|
|
98
|
-
).style.webkitMaskImage = `url('${canvas!.toDataURL("base64")}')`;
|
|
99
|
-
}, 1000 / 60);
|
|
100
|
-
setTimeout(() => {
|
|
101
|
-
clearInterval(i);
|
|
102
|
-
Runner.stop(runner);
|
|
103
|
-
}, time);
|
|
104
|
-
return ``;
|
|
105
|
-
};
|
|
106
|
-
}
|