@majapisoftwares/ui 4.0.2
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/base.css +359 -0
- package/bootstrap/AppProps.d.ts +10 -0
- package/bootstrap/AppProps.js +1 -0
- package/bootstrap/index.d.ts +1 -0
- package/bootstrap/index.js +1 -0
- package/bootstrap/modeScript.d.ts +2 -0
- package/bootstrap/modeScript.js +35 -0
- package/bootstrap/nprogress.d.ts +1 -0
- package/bootstrap/nprogress.js +19 -0
- package/bootstrap/scrolledScript.d.ts +2 -0
- package/bootstrap/scrolledScript.js +27 -0
- package/bootstrap/setupFocusManager.d.ts +1 -0
- package/bootstrap/setupFocusManager.js +13 -0
- package/bootstrap/suppressConsoleLog.d.ts +1 -0
- package/bootstrap/suppressConsoleLog.js +8 -0
- package/components/Accordion/Accordion.d.ts +19 -0
- package/components/Accordion/Accordion.jsx +27 -0
- package/components/Accordion/index.d.ts +3 -0
- package/components/Accordion/index.jsx +3 -0
- package/components/Alert/Alert.d.ts +31 -0
- package/components/Alert/Alert.jsx +53 -0
- package/components/Alert/index.d.ts +3 -0
- package/components/Alert/index.jsx +3 -0
- package/components/Aurora/Aurora.d.ts +10 -0
- package/components/Aurora/Aurora.jsx +189 -0
- package/components/Aurora/index.d.ts +3 -0
- package/components/Aurora/index.jsx +3 -0
- package/components/Autocomplete/Autocomplete.d.ts +7 -0
- package/components/Autocomplete/Autocomplete.jsx +23 -0
- package/components/Autocomplete/UnstyledAutocomplete.d.ts +36 -0
- package/components/Autocomplete/UnstyledAutocomplete.jsx +73 -0
- package/components/Autocomplete/index.d.ts +5 -0
- package/components/Autocomplete/index.jsx +5 -0
- package/components/BackgroundEffects/BottomBlurryPoint.d.ts +3 -0
- package/components/BackgroundEffects/BottomBlurryPoint.jsx +14 -0
- package/components/BackgroundEffects/TopBlurryPoint.d.ts +3 -0
- package/components/BackgroundEffects/TopBlurryPoint.jsx +14 -0
- package/components/Badge/Badge.d.ts +42 -0
- package/components/Badge/Badge.jsx +50 -0
- package/components/Badge/index.d.ts +3 -0
- package/components/Badge/index.jsx +3 -0
- package/components/Breadcrumbs/Breadcrumbs.d.ts +11 -0
- package/components/Breadcrumbs/Breadcrumbs.jsx +42 -0
- package/components/Breadcrumbs/index.d.ts +3 -0
- package/components/Breadcrumbs/index.jsx +3 -0
- package/components/Button/Button.d.ts +111 -0
- package/components/Button/Button.jsx +129 -0
- package/components/Button/UnstyledButton.d.ts +10 -0
- package/components/Button/UnstyledButton.jsx +13 -0
- package/components/Button/index.d.ts +3 -0
- package/components/Button/index.jsx +3 -0
- package/components/Carousel/Carousel.d.ts +19 -0
- package/components/Carousel/Carousel.jsx +55 -0
- package/components/Carousel/index.d.ts +3 -0
- package/components/Carousel/index.jsx +3 -0
- package/components/Checkbox/Checkbox.d.ts +14 -0
- package/components/Checkbox/Checkbox.jsx +45 -0
- package/components/Checkbox/index.d.ts +3 -0
- package/components/Checkbox/index.js +3 -0
- package/components/Code/Code.d.ts +12 -0
- package/components/Code/Code.jsx +25 -0
- package/components/Code/Json.d.ts +5 -0
- package/components/Code/Json.jsx +7 -0
- package/components/Code/index.d.ts +4 -0
- package/components/Code/index.jsx +4 -0
- package/components/ConfirmationButton/ConfirmationButton.d.ts +17 -0
- package/components/ConfirmationButton/ConfirmationButton.jsx +13 -0
- package/components/ConfirmationButton/index.d.ts +3 -0
- package/components/ConfirmationButton/index.jsx +3 -0
- package/components/ContextMenu/ContextMenu.d.ts +28 -0
- package/components/ContextMenu/ContextMenu.jsx +70 -0
- package/components/ContextMenu/index.d.ts +3 -0
- package/components/ContextMenu/index.jsx +3 -0
- package/components/CopyButton/CopyButton.d.ts +7 -0
- package/components/CopyButton/CopyButton.jsx +29 -0
- package/components/CopyButton/index.d.ts +3 -0
- package/components/CopyButton/index.jsx +3 -0
- package/components/DateInput/DateInput.d.ts +6 -0
- package/components/DateInput/DateInput.jsx +19 -0
- package/components/DateInput/DateTimeInput.d.ts +3 -0
- package/components/DateInput/DateTimeInput.jsx +8 -0
- package/components/DateInput/index.d.ts +4 -0
- package/components/DateInput/index.jsx +4 -0
- package/components/DateInput/useRefValue.d.ts +5 -0
- package/components/DateInput/useRefValue.js +48 -0
- package/components/DatePicker/DatePicker.d.ts +19 -0
- package/components/DatePicker/DatePicker.jsx +55 -0
- package/components/DatePicker/index.d.ts +3 -0
- package/components/DatePicker/index.jsx +3 -0
- package/components/DateRangePicker/DateRangePicker.d.ts +16 -0
- package/components/DateRangePicker/DateRangePicker.jsx +56 -0
- package/components/DateRangePicker/index.d.ts +3 -0
- package/components/DateRangePicker/index.jsx +3 -0
- package/components/Dialog/Dialog.d.ts +25 -0
- package/components/Dialog/Dialog.jsx +35 -0
- package/components/Dialog/Dialogs.d.ts +1 -0
- package/components/Dialog/Dialogs.jsx +21 -0
- package/components/Dialog/dialogs.state.d.ts +21 -0
- package/components/Dialog/dialogs.state.js +40 -0
- package/components/Dialog/index.d.ts +6 -0
- package/components/Dialog/index.jsx +7 -0
- package/components/Drawer/Drawer.d.ts +15 -0
- package/components/Drawer/Drawer.jsx +72 -0
- package/components/Drawer/index.d.ts +3 -0
- package/components/Drawer/index.jsx +3 -0
- package/components/DropdownMenu/DropdownMenu.d.ts +33 -0
- package/components/DropdownMenu/DropdownMenu.jsx +74 -0
- package/components/DropdownMenu/index.d.ts +3 -0
- package/components/DropdownMenu/index.jsx +3 -0
- package/components/ErrorBoundary/ErrorBoundary.d.ts +18 -0
- package/components/ErrorBoundary/ErrorBoundary.jsx +32 -0
- package/components/ErrorBoundary/index.d.ts +3 -0
- package/components/ErrorBoundary/index.jsx +3 -0
- package/components/ErrorPage/Error404Page.d.ts +1 -0
- package/components/ErrorPage/Error404Page.jsx +4 -0
- package/components/ErrorPage/Error500Page.d.ts +1 -0
- package/components/ErrorPage/Error500Page.jsx +4 -0
- package/components/ErrorPage/ErrorPage.d.ts +11 -0
- package/components/ErrorPage/ErrorPage.jsx +23 -0
- package/components/FileInput/FileInput.d.ts +47 -0
- package/components/FileInput/FileInput.jsx +144 -0
- package/components/FileInput/PreviewFile.d.ts +13 -0
- package/components/FileInput/PreviewFile.jsx +55 -0
- package/components/FileInput/index.d.ts +3 -0
- package/components/FileInput/index.jsx +3 -0
- package/components/FileSelect/FileSelect.d.ts +31 -0
- package/components/FileSelect/FileSelect.jsx +143 -0
- package/components/FileSelect/index.d.ts +3 -0
- package/components/FileSelect/index.jsx +3 -0
- package/components/Footer/Footer.d.ts +19 -0
- package/components/Footer/Footer.jsx +30 -0
- package/components/Footer/index.d.ts +3 -0
- package/components/Footer/index.jsx +3 -0
- package/components/GridPattern/GridPattern.d.ts +2 -0
- package/components/GridPattern/GridPattern.jsx +12 -0
- package/components/GridPattern/index.d.ts +3 -0
- package/components/GridPattern/index.jsx +3 -0
- package/components/Group/Group.d.ts +5 -0
- package/components/Group/Group.jsx +6 -0
- package/components/Group/index.d.ts +3 -0
- package/components/Group/index.jsx +3 -0
- package/components/Header/Header.d.ts +5 -0
- package/components/Header/Header.jsx +19 -0
- package/components/Header/index.d.ts +3 -0
- package/components/Header/index.jsx +3 -0
- package/components/ImageInput/ImageInput.d.ts +4 -0
- package/components/ImageInput/ImageInput.jsx +8 -0
- package/components/ImageInput/index.d.ts +3 -0
- package/components/ImageInput/index.jsx +3 -0
- package/components/Input/Input.d.ts +14 -0
- package/components/Input/Input.jsx +57 -0
- package/components/Input/InputIcon.d.ts +9 -0
- package/components/Input/InputIcon.jsx +7 -0
- package/components/Input/MultiSelectInput.d.ts +13 -0
- package/components/Input/MultiSelectInput.jsx +28 -0
- package/components/Input/NumericInput.d.ts +6 -0
- package/components/Input/NumericInput.jsx +6 -0
- package/components/Input/PatternInput.d.ts +6 -0
- package/components/Input/PatternInput.jsx +6 -0
- package/components/Input/UnstyledInput.d.ts +22 -0
- package/components/Input/UnstyledInput.jsx +28 -0
- package/components/Input/index.d.ts +6 -0
- package/components/Input/index.jsx +6 -0
- package/components/Input2/InputWrapper.d.ts +11 -0
- package/components/Input2/InputWrapper.jsx +11 -0
- package/components/Link/Link.d.ts +3 -0
- package/components/Link/Link.jsx +9 -0
- package/components/Link/index.d.ts +3 -0
- package/components/Link/index.jsx +3 -0
- package/components/Loading/Loading.d.ts +3 -0
- package/components/Loading/Loading.jsx +13 -0
- package/components/Loading/index.d.ts +3 -0
- package/components/Loading/index.jsx +3 -0
- package/components/Magnet/Magnet.d.ts +13 -0
- package/components/Magnet/Magnet.jsx +50 -0
- package/components/Magnet/index.d.ts +3 -0
- package/components/Magnet/index.jsx +3 -0
- package/components/Markdown/Markdown.d.ts +8 -0
- package/components/Markdown/Markdown.jsx +13 -0
- package/components/Markdown/index.d.ts +3 -0
- package/components/Markdown/index.jsx +3 -0
- package/components/Menu/Menu.d.ts +28 -0
- package/components/Menu/Menu.jsx +54 -0
- package/components/Modal/Modal.d.ts +45 -0
- package/components/Modal/Modal.jsx +65 -0
- package/components/Modal/index.d.ts +4 -0
- package/components/Modal/index.jsx +4 -0
- package/components/Modal/useModalState.d.ts +6 -0
- package/components/Modal/useModalState.js +16 -0
- package/components/ModeToggle/ModeToggle.d.ts +9 -0
- package/components/ModeToggle/ModeToggle.jsx +12 -0
- package/components/ModeToggle/index.d.ts +4 -0
- package/components/ModeToggle/index.jsx +5 -0
- package/components/ModeToggle/useModeToggle.d.ts +1 -0
- package/components/ModeToggle/useModeToggle.js +21 -0
- package/components/MultiSelect/MultiSelect.d.ts +28 -0
- package/components/MultiSelect/MultiSelect.jsx +130 -0
- package/components/MultiSelect/index.d.ts +3 -0
- package/components/MultiSelect/index.jsx +3 -0
- package/components/MultiText/MultiText.d.ts +23 -0
- package/components/MultiText/MultiText.jsx +119 -0
- package/components/MultiText/index.d.ts +3 -0
- package/components/MultiText/index.jsx +3 -0
- package/components/NavigationDrawer/NavigationDrawer.d.ts +9 -0
- package/components/NavigationDrawer/NavigationDrawer.jsx +29 -0
- package/components/NavigationDrawer/NavigationItem.d.ts +13 -0
- package/components/NavigationDrawer/NavigationItem.jsx +24 -0
- package/components/NavigationDrawer/index.d.ts +6 -0
- package/components/NavigationDrawer/index.jsx +6 -0
- package/components/NavigationDrawer/navigationDrawer.state.d.ts +9 -0
- package/components/NavigationDrawer/navigationDrawer.state.js +19 -0
- package/components/NoSsr/NoSsr.d.ts +4 -0
- package/components/NoSsr/NoSsr.jsx +8 -0
- package/components/NoSsr/index.d.ts +3 -0
- package/components/NoSsr/index.jsx +3 -0
- package/components/Noise/Noise.d.ts +11 -0
- package/components/Noise/Noise.jsx +69 -0
- package/components/Noise/index.d.ts +3 -0
- package/components/Noise/index.jsx +3 -0
- package/components/Notifications/Notifications.d.ts +3 -0
- package/components/Notifications/Notifications.jsx +60 -0
- package/components/Notifications/index.d.ts +5 -0
- package/components/Notifications/index.jsx +6 -0
- package/components/Notifications/notifications.state.d.ts +24 -0
- package/components/Notifications/notifications.state.js +41 -0
- package/components/Orb/Orb.d.ts +8 -0
- package/components/Orb/Orb.jsx +258 -0
- package/components/Orb/index.d.ts +3 -0
- package/components/Orb/index.jsx +3 -0
- package/components/Pagination/Pagination.d.ts +13 -0
- package/components/Pagination/Pagination.jsx +64 -0
- package/components/Pagination/index.d.ts +3 -0
- package/components/Pagination/index.jsx +3 -0
- package/components/Particles/Particles.d.ts +18 -0
- package/components/Particles/Particles.jsx +205 -0
- package/components/Particles/index.d.ts +3 -0
- package/components/Particles/index.jsx +3 -0
- package/components/PictureCropInput/PictureCropInput.d.ts +17 -0
- package/components/PictureCropInput/PictureCropInput.jsx +153 -0
- package/components/PictureCropInput/canvasPreview.d.ts +2 -0
- package/components/PictureCropInput/canvasPreview.js +37 -0
- package/components/PictureCropInput/index.d.ts +3 -0
- package/components/PictureCropInput/index.js +3 -0
- package/components/Popover/Popover.d.ts +13 -0
- package/components/Popover/Popover.jsx +22 -0
- package/components/Popover/index.d.ts +3 -0
- package/components/Popover/index.jsx +3 -0
- package/components/Resizable/Resizable.d.ts +12 -0
- package/components/Resizable/Resizable.jsx +54 -0
- package/components/Resizable/index.d.ts +3 -0
- package/components/Resizable/index.jsx +3 -0
- package/components/ScrollArea/ScrollArea.d.ts +9 -0
- package/components/ScrollArea/ScrollArea.jsx +16 -0
- package/components/ScrollArea/index.d.ts +3 -0
- package/components/ScrollArea/index.jsx +3 -0
- package/components/Select/Select.d.ts +24 -0
- package/components/Select/Select.jsx +55 -0
- package/components/Select/index.d.ts +3 -0
- package/components/Select/index.jsx +3 -0
- package/components/Skeleton/Skeleton.d.ts +2 -0
- package/components/Skeleton/Skeleton.jsx +8 -0
- package/components/Skeleton/index.d.ts +3 -0
- package/components/Skeleton/index.jsx +3 -0
- package/components/Slider/Slider.d.ts +10 -0
- package/components/Slider/Slider.jsx +21 -0
- package/components/Slider/index.d.ts +3 -0
- package/components/Slider/index.jsx +3 -0
- package/components/Spotlight/Spotlight.d.ts +30 -0
- package/components/Spotlight/Spotlight.jsx +77 -0
- package/components/Spotlight/index.d.ts +3 -0
- package/components/Spotlight/index.jsx +3 -0
- package/components/SpotlightCard/SpotlightCard.d.ts +7 -0
- package/components/SpotlightCard/SpotlightCard.jsx +35 -0
- package/components/SpotlightCard/index.d.ts +3 -0
- package/components/SpotlightCard/index.jsx +3 -0
- package/components/Stack/Stack.d.ts +4 -0
- package/components/Stack/Stack.jsx +5 -0
- package/components/Stack/index.d.ts +3 -0
- package/components/Stack/index.jsx +3 -0
- package/components/StarBorder/StarBorder.d.ts +11 -0
- package/components/StarBorder/StarBorder.jsx +19 -0
- package/components/StarBorder/index.d.ts +3 -0
- package/components/StarBorder/index.jsx +3 -0
- package/components/Switch/Switch.d.ts +16 -0
- package/components/Switch/Switch.jsx +24 -0
- package/components/Switch/index.d.ts +3 -0
- package/components/Switch/index.jsx +3 -0
- package/components/Table/DataTable.d.ts +57 -0
- package/components/Table/DataTable.jsx +155 -0
- package/components/Table/Table.d.ts +27 -0
- package/components/Table/Table.jsx +31 -0
- package/components/Table/TableActionButton.d.ts +6 -0
- package/components/Table/TableActionButton.jsx +20 -0
- package/components/Table/TableBody.d.ts +6 -0
- package/components/Table/TableBody.jsx +10 -0
- package/components/Table/TableCell.d.ts +9 -0
- package/components/Table/TableCell.jsx +18 -0
- package/components/Table/TableFooter.d.ts +5 -0
- package/components/Table/TableFooter.jsx +5 -0
- package/components/Table/TableFooterWithPagination.d.ts +13 -0
- package/components/Table/TableFooterWithPagination.jsx +57 -0
- package/components/Table/TableHead.d.ts +5 -0
- package/components/Table/TableHead.jsx +9 -0
- package/components/Table/TableHeadContext.d.ts +4 -0
- package/components/Table/TableHeadContext.jsx +3 -0
- package/components/Table/TableHeader.d.ts +7 -0
- package/components/Table/TableHeader.jsx +15 -0
- package/components/Table/TableRow.d.ts +8 -0
- package/components/Table/TableRow.jsx +9 -0
- package/components/Table/index.d.ts +3 -0
- package/components/Table/index.jsx +3 -0
- package/components/Tabs/Tabs.d.ts +9 -0
- package/components/Tabs/Tabs.jsx +13 -0
- package/components/Tabs/index.d.ts +3 -0
- package/components/Tabs/index.jsx +3 -0
- package/components/TabsSwitcher/Tab.d.ts +15 -0
- package/components/TabsSwitcher/Tab.jsx +18 -0
- package/components/TabsSwitcher/TabsSwitcher.d.ts +22 -0
- package/components/TabsSwitcher/TabsSwitcher.jsx +31 -0
- package/components/TabsSwitcher/index.d.ts +4 -0
- package/components/TabsSwitcher/index.jsx +4 -0
- package/components/Text/Text.d.ts +24 -0
- package/components/Text/Text.jsx +28 -0
- package/components/Text/index.d.ts +3 -0
- package/components/Text/index.jsx +3 -0
- package/components/Textarea/Textarea.d.ts +5 -0
- package/components/Textarea/Textarea.jsx +6 -0
- package/components/Textarea/index.d.ts +3 -0
- package/components/Textarea/index.js +3 -0
- package/components/Threads/Threads.d.ts +9 -0
- package/components/Threads/Threads.jsx +203 -0
- package/components/Threads/index.d.ts +3 -0
- package/components/Threads/index.jsx +3 -0
- package/components/Tooltip/Tooltip.d.ts +11 -0
- package/components/Tooltip/Tooltip.jsx +21 -0
- package/components/Tooltip/index.d.ts +3 -0
- package/components/Tooltip/index.jsx +3 -0
- package/components/VisibilityActivatedButton/VisibilityActivatedButton.d.ts +7 -0
- package/components/VisibilityActivatedButton/VisibilityActivatedButton.jsx +18 -0
- package/components/VisibilityActivatedButton/index.d.ts +3 -0
- package/components/VisibilityActivatedButton/index.jsx +3 -0
- package/form.d.ts +82 -0
- package/form.js +113 -0
- package/form2.d.ts +15 -0
- package/form2.jsx +29 -0
- package/hooks/useBeforeUnload.d.ts +1 -0
- package/hooks/useBeforeUnload.js +17 -0
- package/hooks/useDebounceEffect.d.ts +2 -0
- package/hooks/useDebounceEffect.js +14 -0
- package/hooks/useDebouncedValue.d.ts +2 -0
- package/hooks/useDebouncedValue.js +14 -0
- package/hooks/useLagRadar.d.ts +1 -0
- package/hooks/useLagRadar.jsx +124 -0
- package/hooks/useMediaQuery.d.ts +1 -0
- package/hooks/useMediaQuery.js +37 -0
- package/hooks/useMutationWindowCloseProtection.d.ts +2 -0
- package/hooks/useMutationWindowCloseProtection.js +13 -0
- package/hooks/useScroll.d.ts +3 -0
- package/hooks/useScroll.js +47 -0
- package/hooks/useTranslation.d.ts +4 -0
- package/hooks/useTranslation.js +11 -0
- package/hooks/useWhyDidYouUpdate.d.ts +3 -0
- package/hooks/useWhyDidYouUpdate.js +44 -0
- package/imgur.d.ts +1 -0
- package/imgur.js +13 -0
- package/package.json +9 -0
- package/styles/DayPicker.classNames.d.ts +29 -0
- package/styles/DayPicker.classNames.js +30 -0
- package/styles/DayPicker.classNames.ts +81 -0
- package/styles/Dropdown.classNames.d.ts +6 -0
- package/styles/Dropdown.classNames.js +7 -0
- package/styles/Dropdown.classNames.ts +38 -0
- package/styles/Input.css +23 -0
- package/styles/Modal.classNames.d.ts +2 -0
- package/styles/Modal.classNames.js +3 -0
- package/styles/Modal.classNames.ts +15 -0
- package/styles/MultiText.css +40 -0
- package/styles/Pagination.css +19 -0
- package/styles/Tabs.css +23 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/types.d.ts +6 -0
- package/types.js +1 -0
- package/utils/UseState.d.ts +3 -0
- package/utils/UseState.js +1 -0
- package/utils/blobToText.d.ts +1 -0
- package/utils/blobToText.js +13 -0
- package/utils/capitalize.d.ts +1 -0
- package/utils/capitalize.js +6 -0
- package/utils/clsx.d.ts +2 -0
- package/utils/clsx.js +5 -0
- package/utils/copy2DToClipboard.d.ts +1 -0
- package/utils/copy2DToClipboard.js +44 -0
- package/utils/cpfCpnjUtils.d.ts +3 -0
- package/utils/cpfCpnjUtils.js +43 -0
- package/utils/createLocalStorageStateHydration.d.ts +1 -0
- package/utils/createLocalStorageStateHydration.js +18 -0
- package/utils/createStateHydration.d.ts +3 -0
- package/utils/createStateHydration.js +49 -0
- package/utils/csvBlobToJson.d.ts +2 -0
- package/utils/csvBlobToJson.js +60 -0
- package/utils/downloadArrayAsCSV.d.ts +1 -0
- package/utils/downloadArrayAsCSV.js +34 -0
- package/utils/emailRegExp.d.ts +2 -0
- package/utils/emailRegExp.js +3 -0
- package/utils/fakeArray.d.ts +1 -0
- package/utils/fakeArray.js +3 -0
- package/utils/filterBoolean.d.ts +1 -0
- package/utils/filterBoolean.js +3 -0
- package/utils/formatClock.d.ts +1 -0
- package/utils/formatClock.js +21 -0
- package/utils/formatTime.d.ts +2 -0
- package/utils/formatTime.js +40 -0
- package/utils/getInitials.d.ts +4 -0
- package/utils/getInitials.js +8 -0
- package/utils/isBrowser.d.ts +12 -0
- package/utils/isBrowser.js +26 -0
- package/utils/ms.d.ts +6 -0
- package/utils/ms.js +31 -0
- package/utils/preventDefault.d.ts +1 -0
- package/utils/preventDefault.js +3 -0
- package/utils/recursiveChildrenMap.d.ts +2 -0
- package/utils/recursiveChildrenMap.js +16 -0
- package/utils/setSelectionRange.d.ts +1 -0
- package/utils/setSelectionRange.js +55 -0
- package/utils/smoothScrollToHref.d.ts +2 -0
- package/utils/smoothScrollToHref.js +10 -0
- package/utils/stopPropagation.d.ts +2 -0
- package/utils/stopPropagation.js +3 -0
- package/utils/stripHtml.d.ts +1 -0
- package/utils/stripHtml.js +4 -0
- package/utils/stripLineBreak.d.ts +1 -0
- package/utils/stripLineBreak.js +4 -0
- package/utils/stripMarkdown.d.ts +1 -0
- package/utils/stripMarkdown.js +28 -0
- package/utils/xlsxBlobToJson.d.ts +2 -0
- package/utils/xlsxBlobToJson.js +59 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import Drawer from "../Drawer";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import navigationDrawerState from "./navigationDrawer.state";
|
|
4
|
+
import { useSnapshot } from "valtio";
|
|
5
|
+
import clsx from "../../utils/clsx";
|
|
6
|
+
export default function NavigationDrawer({ children, navigationChildren, position, title, noPadding, panelClassName, }) {
|
|
7
|
+
const { isOpen } = useSnapshot(navigationDrawerState);
|
|
8
|
+
const handleChangeOpen = useCallback((open) => {
|
|
9
|
+
if (window.innerWidth <= 1024) {
|
|
10
|
+
navigationDrawerState.setOpen(open);
|
|
11
|
+
}
|
|
12
|
+
}, []);
|
|
13
|
+
return (<>
|
|
14
|
+
<Drawer open={isOpen} onChangeOpen={handleChangeOpen} className="lg:hidden" position={position} title={title} noPadding={noPadding} panelClassName={panelClassName}>
|
|
15
|
+
{navigationChildren}
|
|
16
|
+
</Drawer>
|
|
17
|
+
<div className={clsx("fixed left-0 top-0 z-10 hidden h-full w-full max-w-xs flex-1 overflow-y-auto px-4 py-4 pt-20 lg:block", "bg-zinc-100/95 backdrop-blur-sm [@supports(backdrop-filter:blur(0))]:bg-zinc-100/75", "dark:bg-zinc-900/95 dark:[@supports(backdrop-filter:blur(0))]:bg-zinc-900/75", "transition-transform", {
|
|
18
|
+
"translate-x-0": isOpen,
|
|
19
|
+
"-translate-x-full": !isOpen,
|
|
20
|
+
}, panelClassName)}>
|
|
21
|
+
{navigationChildren}
|
|
22
|
+
</div>
|
|
23
|
+
<div className={clsx("flex min-h-screen flex-col ring-offset-zinc-100 transition-all duration-300", {
|
|
24
|
+
"lg:pl-80 lg:duration-150": isOpen,
|
|
25
|
+
})}>
|
|
26
|
+
{children}
|
|
27
|
+
</div>
|
|
28
|
+
</>);
|
|
29
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from "react";
|
|
2
|
+
export default function NavigationItem({ icon, children, href, exact, alternativeActiveHrefs, className, disabled, active, }: {
|
|
3
|
+
icon?: ReactElement<{
|
|
4
|
+
className?: string;
|
|
5
|
+
}>;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
href: string;
|
|
8
|
+
exact?: boolean;
|
|
9
|
+
alternativeActiveHrefs?: string[];
|
|
10
|
+
className?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
active?: boolean;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import clsx from "../../utils/clsx";
|
|
2
|
+
import { useRouter } from "next/router";
|
|
3
|
+
import { cloneElement } from "react";
|
|
4
|
+
import Button from "../Button";
|
|
5
|
+
import navigationDrawerState from "./navigationDrawer.state";
|
|
6
|
+
import useMediaQuery from "../../hooks/useMediaQuery";
|
|
7
|
+
export default function NavigationItem({ icon, children, href, exact, alternativeActiveHrefs, className, disabled, active, }) {
|
|
8
|
+
const router = useRouter();
|
|
9
|
+
active =
|
|
10
|
+
active === undefined
|
|
11
|
+
? exact
|
|
12
|
+
? router.pathname === href ||
|
|
13
|
+
alternativeActiveHrefs?.some((href) => router.pathname === href)
|
|
14
|
+
: router.pathname.includes(href) ||
|
|
15
|
+
alternativeActiveHrefs?.some((href) => router.pathname.includes(href))
|
|
16
|
+
: active;
|
|
17
|
+
const isMobile = useMediaQuery(`(max-width: 1024px)`);
|
|
18
|
+
return (<Button variant={active ? "light" : "text"} color={active ? "primary" : "default"} className={clsx("w-full justify-start border-transparent", className)} leading={icon &&
|
|
19
|
+
cloneElement(icon, {
|
|
20
|
+
className: clsx(icon.props?.className, "w-5! mr-3"),
|
|
21
|
+
})} href={href} onClick={isMobile ? navigationDrawerState.close : undefined} disabled={disabled}>
|
|
22
|
+
{children}
|
|
23
|
+
</Button>);
|
|
24
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import NavigationDrawer from "./NavigationDrawer";
|
|
2
|
+
export * from "./NavigationDrawer";
|
|
3
|
+
export default NavigationDrawer;
|
|
4
|
+
export { default as NavigationItem } from "./NavigationItem";
|
|
5
|
+
export { default as navigationDrawerState } from "./navigationDrawer.state";
|
|
6
|
+
export * from "./navigationDrawer.state";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import NavigationDrawer from "./NavigationDrawer";
|
|
2
|
+
export * from "./NavigationDrawer";
|
|
3
|
+
export default NavigationDrawer;
|
|
4
|
+
export { default as NavigationItem } from "./NavigationItem";
|
|
5
|
+
export { default as navigationDrawerState } from "./navigationDrawer.state";
|
|
6
|
+
export * from "./navigationDrawer.state";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const navigationDrawerState: {
|
|
2
|
+
isOpen: boolean;
|
|
3
|
+
open(): void;
|
|
4
|
+
close(): void;
|
|
5
|
+
setOpen(open: boolean): void;
|
|
6
|
+
toggle(): void;
|
|
7
|
+
};
|
|
8
|
+
export declare const hydrateNavigationDrawerState: (cookies?: object) => void;
|
|
9
|
+
export default navigationDrawerState;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { proxy } from "valtio";
|
|
2
|
+
import createStateHydration from "../../utils/createStateHydration";
|
|
3
|
+
const navigationDrawerState = proxy({
|
|
4
|
+
isOpen: false,
|
|
5
|
+
open() {
|
|
6
|
+
navigationDrawerState.isOpen = true;
|
|
7
|
+
},
|
|
8
|
+
close() {
|
|
9
|
+
navigationDrawerState.isOpen = false;
|
|
10
|
+
},
|
|
11
|
+
setOpen(open) {
|
|
12
|
+
navigationDrawerState.isOpen = open;
|
|
13
|
+
},
|
|
14
|
+
toggle() {
|
|
15
|
+
navigationDrawerState.isOpen = !navigationDrawerState.isOpen;
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
export const hydrateNavigationDrawerState = createStateHydration("navigationDrawerState", navigationDrawerState, ["isOpen"]);
|
|
19
|
+
export default navigationDrawerState;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface NoiseProps {
|
|
3
|
+
patternSize?: number;
|
|
4
|
+
patternScaleX?: number;
|
|
5
|
+
patternScaleY?: number;
|
|
6
|
+
patternRefreshInterval?: number;
|
|
7
|
+
patternAlpha?: number;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const Noise: React.FC<NoiseProps>;
|
|
11
|
+
export default Noise;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from "react";
|
|
2
|
+
import clsx from "../../utils/clsx";
|
|
3
|
+
const Noise = ({ patternSize = 250, patternScaleX = 1, patternScaleY = 1, patternRefreshInterval = 2, patternAlpha = 15, className, }) => {
|
|
4
|
+
const grainRef = useRef(null);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
const canvas = grainRef.current;
|
|
7
|
+
if (!canvas)
|
|
8
|
+
return;
|
|
9
|
+
const ctx = canvas.getContext("2d");
|
|
10
|
+
if (!ctx)
|
|
11
|
+
return;
|
|
12
|
+
let frame = 0;
|
|
13
|
+
const patternCanvas = document.createElement("canvas");
|
|
14
|
+
patternCanvas.width = patternSize;
|
|
15
|
+
patternCanvas.height = patternSize;
|
|
16
|
+
const patternCtx = patternCanvas.getContext("2d");
|
|
17
|
+
if (!patternCtx)
|
|
18
|
+
return;
|
|
19
|
+
const patternData = patternCtx.createImageData(patternSize, patternSize);
|
|
20
|
+
const patternPixelDataLength = patternSize * patternSize * 4;
|
|
21
|
+
const resize = () => {
|
|
22
|
+
if (!canvas)
|
|
23
|
+
return;
|
|
24
|
+
canvas.width = window.innerWidth * window.devicePixelRatio;
|
|
25
|
+
canvas.height = window.innerHeight * window.devicePixelRatio;
|
|
26
|
+
ctx.scale(patternScaleX, patternScaleY);
|
|
27
|
+
};
|
|
28
|
+
const updatePattern = () => {
|
|
29
|
+
for (let i = 0; i < patternPixelDataLength; i += 4) {
|
|
30
|
+
const value = Math.random() * 255;
|
|
31
|
+
patternData.data[i] = value;
|
|
32
|
+
patternData.data[i + 1] = value;
|
|
33
|
+
patternData.data[i + 2] = value;
|
|
34
|
+
patternData.data[i + 3] = patternAlpha;
|
|
35
|
+
}
|
|
36
|
+
patternCtx.putImageData(patternData, 0, 0);
|
|
37
|
+
};
|
|
38
|
+
const drawGrain = () => {
|
|
39
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
40
|
+
const pattern = ctx.createPattern(patternCanvas, "repeat");
|
|
41
|
+
if (pattern) {
|
|
42
|
+
ctx.fillStyle = pattern;
|
|
43
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const loop = () => {
|
|
47
|
+
if (frame % patternRefreshInterval === 0) {
|
|
48
|
+
updatePattern();
|
|
49
|
+
drawGrain();
|
|
50
|
+
}
|
|
51
|
+
frame++;
|
|
52
|
+
window.requestAnimationFrame(loop);
|
|
53
|
+
};
|
|
54
|
+
window.addEventListener("resize", resize);
|
|
55
|
+
resize();
|
|
56
|
+
loop();
|
|
57
|
+
return () => {
|
|
58
|
+
window.removeEventListener("resize", resize);
|
|
59
|
+
};
|
|
60
|
+
}, [
|
|
61
|
+
patternSize,
|
|
62
|
+
patternScaleX,
|
|
63
|
+
patternScaleY,
|
|
64
|
+
patternRefreshInterval,
|
|
65
|
+
patternAlpha,
|
|
66
|
+
]);
|
|
67
|
+
return (<canvas className={clsx("absolute top-0 left-0 h-screen w-screen", className)} ref={grainRef}/>);
|
|
68
|
+
};
|
|
69
|
+
export default Noise;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
2
|
+
import { useSnapshot } from "valtio";
|
|
3
|
+
import notificationsState from "./notifications.state";
|
|
4
|
+
import { CheckCircleIcon, ExclamationCircleIcon, } from "@heroicons/react/24/outline";
|
|
5
|
+
import { XMarkIcon } from "@heroicons/react/20/solid";
|
|
6
|
+
import Button from "../Button";
|
|
7
|
+
import { cloneElement, useEffect } from "react";
|
|
8
|
+
import clsx from "../../utils/clsx";
|
|
9
|
+
export default function Notifications({ notificationClassName, }) {
|
|
10
|
+
const { notifications, remove, setRendered } = useSnapshot(notificationsState);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
setRendered(true);
|
|
13
|
+
return () => {
|
|
14
|
+
setRendered(false);
|
|
15
|
+
};
|
|
16
|
+
}, [setRendered]);
|
|
17
|
+
return (<ul id="ui-notifications" className="pointer-events-none fixed inset-0 z-30 flex flex-col items-center justify-end gap-3 px-4 py-6 sm:items-end sm:justify-start sm:p-6">
|
|
18
|
+
<AnimatePresence initial={false}>
|
|
19
|
+
{notifications.map(({ _id, dismissable, title, message, icon, actions, style, className, }) => {
|
|
20
|
+
const iconChild = (typeof icon === "string"
|
|
21
|
+
? {
|
|
22
|
+
success: <CheckCircleIcon className="text-success-400!"/>,
|
|
23
|
+
error: (<ExclamationCircleIcon className="text-error-400!"/>),
|
|
24
|
+
}[icon]
|
|
25
|
+
: icon);
|
|
26
|
+
// noinspection SuspiciousTypeOfGuard
|
|
27
|
+
return (<motion.li key={_id} layout initial={{ opacity: 0, y: 50, scale: 0.3 }} animate={{ opacity: 1, y: 0, scale: 1 }} exit={{ opacity: 0, scale: 0.5, transition: { duration: 0.2 } }} className={clsx("pointer-events-auto w-full max-w-sm overflow-hidden rounded-lg bg-white shadow-lg ring-1 ring-black/5 dark:bg-zinc-800 dark:ring-white/10", notificationClassName, className)} style={style}>
|
|
28
|
+
<div className="p-4">
|
|
29
|
+
<div className="flex items-start">
|
|
30
|
+
{iconChild && (<div className="mr-2 shrink-0">
|
|
31
|
+
{cloneElement(iconChild, {
|
|
32
|
+
className: clsx("h-6 w-6 text-zinc-400 dark:text-zinc-600", iconChild.props?.className),
|
|
33
|
+
"aria-hidden": "true",
|
|
34
|
+
})}
|
|
35
|
+
</div>)}
|
|
36
|
+
<div className="ml-1 w-0 flex-1 pt-0.5">
|
|
37
|
+
<p className="text-sm font-medium text-zinc-900 dark:text-zinc-100">
|
|
38
|
+
{title || message}
|
|
39
|
+
</p>
|
|
40
|
+
{title && message && (<p className="mt-1 text-sm text-zinc-500 dark:text-zinc-400">
|
|
41
|
+
{message}
|
|
42
|
+
</p>)}
|
|
43
|
+
{actions && (<div className="-m-3 mt-0 flex">
|
|
44
|
+
{actions}
|
|
45
|
+
</div>)}
|
|
46
|
+
</div>
|
|
47
|
+
{dismissable && (<div className="ml-4 flex shrink-0">
|
|
48
|
+
<Button icon onClick={() => {
|
|
49
|
+
remove(_id);
|
|
50
|
+
}} className="h-5 w-5 p-0!" variant="text">
|
|
51
|
+
<XMarkIcon className="h-5 w-5 text-zinc-400" aria-label="Close"/>
|
|
52
|
+
</Button>
|
|
53
|
+
</div>)}
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</motion.li>);
|
|
57
|
+
})}
|
|
58
|
+
</AnimatePresence>
|
|
59
|
+
</ul>);
|
|
60
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { StringValue } from "ms";
|
|
2
|
+
import { CSSProperties, ReactElement, ReactNode } from "react";
|
|
3
|
+
type Notification = {
|
|
4
|
+
_id: string;
|
|
5
|
+
message: string | ReactElement;
|
|
6
|
+
title?: string;
|
|
7
|
+
timeout?: number | StringValue;
|
|
8
|
+
icon?: "success" | "error" | ReactElement;
|
|
9
|
+
dismissable?: boolean;
|
|
10
|
+
actions?: ReactNode;
|
|
11
|
+
suppress?: boolean;
|
|
12
|
+
style?: CSSProperties;
|
|
13
|
+
className?: string;
|
|
14
|
+
};
|
|
15
|
+
declare const notificationsState: {
|
|
16
|
+
rendered: boolean;
|
|
17
|
+
setRendered(rendered: boolean): void;
|
|
18
|
+
notifications: Notification[];
|
|
19
|
+
add({ _id, dismissable, timeout, ...notification }: Pick<Partial<Notification>, "_id"> & Omit<Notification, "_id">): void;
|
|
20
|
+
remove(_id: string): void;
|
|
21
|
+
};
|
|
22
|
+
export declare function showNotification(notification: string | (Pick<Partial<Notification>, "_id"> & Omit<Notification, "_id">)): void;
|
|
23
|
+
export declare function removeNotification(_id: string): void;
|
|
24
|
+
export default notificationsState;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { proxy, ref } from "valtio";
|
|
2
|
+
import isomorphicObjectId from "@majapisoftwares/next/utils/isomorphicObjectId";
|
|
3
|
+
import ms from "ms";
|
|
4
|
+
const notificationsState = proxy({
|
|
5
|
+
rendered: false,
|
|
6
|
+
setRendered(rendered) {
|
|
7
|
+
notificationsState.rendered = rendered;
|
|
8
|
+
},
|
|
9
|
+
notifications: [],
|
|
10
|
+
add({ _id = isomorphicObjectId().toString(), dismissable = true, timeout, ...notification }) {
|
|
11
|
+
if (!notificationsState.rendered) {
|
|
12
|
+
console.error("<Notifications /> is not rendered. The notification will be ignored.");
|
|
13
|
+
}
|
|
14
|
+
notificationsState.notifications.push(ref({
|
|
15
|
+
...notification,
|
|
16
|
+
dismissable,
|
|
17
|
+
_id,
|
|
18
|
+
}));
|
|
19
|
+
if (timeout) {
|
|
20
|
+
setTimeout(() => {
|
|
21
|
+
notificationsState.remove(_id);
|
|
22
|
+
}, typeof timeout !== "number" ? ms(timeout) : timeout);
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
remove(_id) {
|
|
26
|
+
notificationsState.notifications.splice(notificationsState.notifications.findIndex((n) => n._id === _id), 1);
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
export function showNotification(notification) {
|
|
30
|
+
const notificationObject = typeof notification === "string" ? { message: notification } : notification;
|
|
31
|
+
if (notificationObject.suppress &&
|
|
32
|
+
notificationsState.notifications.find((n) => n.message === notificationObject.message &&
|
|
33
|
+
n.title === notificationObject.title)) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
notificationsState.add(notificationObject);
|
|
37
|
+
}
|
|
38
|
+
export function removeNotification(_id) {
|
|
39
|
+
notificationsState.remove(_id);
|
|
40
|
+
}
|
|
41
|
+
export default notificationsState;
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
import { Mesh, Program, Renderer, Triangle, Vec3 } from "ogl";
|
|
3
|
+
export default function Orb({ hue = 0, hoverIntensity = 0.2, rotateOnHover = true, forceHoverState = false, }) {
|
|
4
|
+
const ctnDom = useRef(null);
|
|
5
|
+
const vert = /* glsl */ `
|
|
6
|
+
precision highp float;
|
|
7
|
+
attribute vec2 position;
|
|
8
|
+
attribute vec2 uv;
|
|
9
|
+
varying vec2 vUv;
|
|
10
|
+
void main() {
|
|
11
|
+
vUv = uv;
|
|
12
|
+
gl_Position = vec4(position, 0.0, 1.0);
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
15
|
+
const frag = /* glsl */ `
|
|
16
|
+
precision highp float;
|
|
17
|
+
|
|
18
|
+
uniform float iTime;
|
|
19
|
+
uniform vec3 iResolution;
|
|
20
|
+
uniform float hue;
|
|
21
|
+
uniform float hover;
|
|
22
|
+
uniform float rot;
|
|
23
|
+
uniform float hoverIntensity;
|
|
24
|
+
varying vec2 vUv;
|
|
25
|
+
|
|
26
|
+
vec3 rgb2yiq(vec3 c) {
|
|
27
|
+
float y = dot(c, vec3(0.299, 0.587, 0.114));
|
|
28
|
+
float i = dot(c, vec3(0.596, -0.274, -0.322));
|
|
29
|
+
float q = dot(c, vec3(0.211, -0.523, 0.312));
|
|
30
|
+
return vec3(y, i, q);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
vec3 yiq2rgb(vec3 c) {
|
|
34
|
+
float r = c.x + 0.956 * c.y + 0.621 * c.z;
|
|
35
|
+
float g = c.x - 0.272 * c.y - 0.647 * c.z;
|
|
36
|
+
float b = c.x - 1.106 * c.y + 1.703 * c.z;
|
|
37
|
+
return vec3(r, g, b);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
vec3 adjustHue(vec3 color, float hueDeg) {
|
|
41
|
+
float hueRad = hueDeg * 3.14159265 / 180.0;
|
|
42
|
+
vec3 yiq = rgb2yiq(color);
|
|
43
|
+
float cosA = cos(hueRad);
|
|
44
|
+
float sinA = sin(hueRad);
|
|
45
|
+
float i = yiq.y * cosA - yiq.z * sinA;
|
|
46
|
+
float q = yiq.y * sinA + yiq.z * cosA;
|
|
47
|
+
yiq.y = i;
|
|
48
|
+
yiq.z = q;
|
|
49
|
+
return yiq2rgb(yiq);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
vec3 hash33(vec3 p3) {
|
|
53
|
+
p3 = fract(p3 * vec3(0.1031, 0.11369, 0.13787));
|
|
54
|
+
p3 += dot(p3, p3.yxz + 19.19);
|
|
55
|
+
return -1.0 + 2.0 * fract(vec3(
|
|
56
|
+
p3.x + p3.y,
|
|
57
|
+
p3.x + p3.z,
|
|
58
|
+
p3.y + p3.z
|
|
59
|
+
) * p3.zyx);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
float snoise3(vec3 p) {
|
|
63
|
+
const float K1 = 0.333333333;
|
|
64
|
+
const float K2 = 0.166666667;
|
|
65
|
+
vec3 i = floor(p + (p.x + p.y + p.z) * K1);
|
|
66
|
+
vec3 d0 = p - (i - (i.x + i.y + i.z) * K2);
|
|
67
|
+
vec3 e = step(vec3(0.0), d0 - d0.yzx);
|
|
68
|
+
vec3 i1 = e * (1.0 - e.zxy);
|
|
69
|
+
vec3 i2 = 1.0 - e.zxy * (1.0 - e);
|
|
70
|
+
vec3 d1 = d0 - (i1 - K2);
|
|
71
|
+
vec3 d2 = d0 - (i2 - K1);
|
|
72
|
+
vec3 d3 = d0 - 0.5;
|
|
73
|
+
vec4 h = max(0.6 - vec4(
|
|
74
|
+
dot(d0, d0),
|
|
75
|
+
dot(d1, d1),
|
|
76
|
+
dot(d2, d2),
|
|
77
|
+
dot(d3, d3)
|
|
78
|
+
), 0.0);
|
|
79
|
+
vec4 n = h * h * h * h * vec4(
|
|
80
|
+
dot(d0, hash33(i)),
|
|
81
|
+
dot(d1, hash33(i + i1)),
|
|
82
|
+
dot(d2, hash33(i + i2)),
|
|
83
|
+
dot(d3, hash33(i + 1.0))
|
|
84
|
+
);
|
|
85
|
+
return dot(vec4(31.316), n);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
vec4 extractAlpha(vec3 colorIn) {
|
|
89
|
+
float a = max(max(colorIn.r, colorIn.g), colorIn.b);
|
|
90
|
+
return vec4(colorIn.rgb / (a + 1e-5), a);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const vec3 baseColor1 = vec3(0.611765, 0.262745, 0.996078);
|
|
94
|
+
const vec3 baseColor2 = vec3(0.298039, 0.760784, 0.913725);
|
|
95
|
+
const vec3 baseColor3 = vec3(0.062745, 0.078431, 0.600000);
|
|
96
|
+
const float innerRadius = 0.6;
|
|
97
|
+
const float noiseScale = 0.65;
|
|
98
|
+
|
|
99
|
+
float light1(float intensity, float attenuation, float dist) {
|
|
100
|
+
return intensity / (1.0 + dist * attenuation);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
float light2(float intensity, float attenuation, float dist) {
|
|
104
|
+
return intensity / (1.0 + dist * dist * attenuation);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
vec4 draw(vec2 uv) {
|
|
108
|
+
vec3 color1 = adjustHue(baseColor1, hue);
|
|
109
|
+
vec3 color2 = adjustHue(baseColor2, hue);
|
|
110
|
+
vec3 color3 = adjustHue(baseColor3, hue);
|
|
111
|
+
|
|
112
|
+
float ang = atan(uv.y, uv.x);
|
|
113
|
+
float len = length(uv);
|
|
114
|
+
float invLen = len > 0.0 ? 1.0 / len : 0.0;
|
|
115
|
+
|
|
116
|
+
float n0 = snoise3(vec3(uv * noiseScale, iTime * 0.5)) * 0.5 + 0.5;
|
|
117
|
+
float r0 = mix(mix(innerRadius, 1.0, 0.4), mix(innerRadius, 1.0, 0.6), n0);
|
|
118
|
+
float d0 = distance(uv, (r0 * invLen) * uv);
|
|
119
|
+
float v0 = light1(1.0, 10.0, d0);
|
|
120
|
+
v0 *= smoothstep(r0 * 1.05, r0, len);
|
|
121
|
+
float cl = cos(ang + iTime * 2.0) * 0.5 + 0.5;
|
|
122
|
+
|
|
123
|
+
float a = iTime * -1.0;
|
|
124
|
+
vec2 pos = vec2(cos(a), sin(a)) * r0;
|
|
125
|
+
float d = distance(uv, pos);
|
|
126
|
+
float v1 = light2(1.5, 5.0, d);
|
|
127
|
+
v1 *= light1(1.0, 50.0, d0);
|
|
128
|
+
|
|
129
|
+
float v2 = smoothstep(1.0, mix(innerRadius, 1.0, n0 * 0.5), len);
|
|
130
|
+
float v3 = smoothstep(innerRadius, mix(innerRadius, 1.0, 0.5), len);
|
|
131
|
+
|
|
132
|
+
vec3 col = mix(color1, color2, cl);
|
|
133
|
+
col = mix(color3, col, v0);
|
|
134
|
+
col = (col + v1) * v2 * v3;
|
|
135
|
+
col = clamp(col, 0.0, 1.0);
|
|
136
|
+
|
|
137
|
+
return extractAlpha(col);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
vec4 mainImage(vec2 fragCoord) {
|
|
141
|
+
vec2 center = iResolution.xy * 0.5;
|
|
142
|
+
float size = min(iResolution.x, iResolution.y);
|
|
143
|
+
vec2 uv = (fragCoord - center) / size * 2.0;
|
|
144
|
+
|
|
145
|
+
float angle = rot;
|
|
146
|
+
float s = sin(angle);
|
|
147
|
+
float c = cos(angle);
|
|
148
|
+
uv = vec2(c * uv.x - s * uv.y, s * uv.x + c * uv.y);
|
|
149
|
+
|
|
150
|
+
uv.x += hover * hoverIntensity * 0.1 * sin(uv.y * 10.0 + iTime);
|
|
151
|
+
uv.y += hover * hoverIntensity * 0.1 * sin(uv.x * 10.0 + iTime);
|
|
152
|
+
|
|
153
|
+
return draw(uv);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
void main() {
|
|
157
|
+
vec2 fragCoord = vUv * iResolution.xy;
|
|
158
|
+
vec4 col = mainImage(fragCoord);
|
|
159
|
+
gl_FragColor = vec4(col.rgb * col.a, col.a);
|
|
160
|
+
}
|
|
161
|
+
`;
|
|
162
|
+
useEffect(() => {
|
|
163
|
+
const container = ctnDom.current;
|
|
164
|
+
if (!container)
|
|
165
|
+
return;
|
|
166
|
+
const renderer = new Renderer({ alpha: true, premultipliedAlpha: false });
|
|
167
|
+
const gl = renderer.gl;
|
|
168
|
+
gl.clearColor(0, 0, 0, 0);
|
|
169
|
+
container.appendChild(gl.canvas);
|
|
170
|
+
const geometry = new Triangle(gl);
|
|
171
|
+
const program = new Program(gl, {
|
|
172
|
+
vertex: vert,
|
|
173
|
+
fragment: frag,
|
|
174
|
+
uniforms: {
|
|
175
|
+
iTime: { value: 0 },
|
|
176
|
+
iResolution: {
|
|
177
|
+
value: new Vec3(gl.canvas.width, gl.canvas.height, gl.canvas.width / gl.canvas.height),
|
|
178
|
+
},
|
|
179
|
+
hue: { value: hue },
|
|
180
|
+
hover: { value: 0 },
|
|
181
|
+
rot: { value: 0 },
|
|
182
|
+
hoverIntensity: { value: hoverIntensity },
|
|
183
|
+
},
|
|
184
|
+
});
|
|
185
|
+
const mesh = new Mesh(gl, { geometry, program });
|
|
186
|
+
function resize() {
|
|
187
|
+
if (!container)
|
|
188
|
+
return;
|
|
189
|
+
const dpr = window.devicePixelRatio || 1;
|
|
190
|
+
const width = container.clientWidth;
|
|
191
|
+
const height = container.clientHeight;
|
|
192
|
+
renderer.setSize(width * dpr, height * dpr);
|
|
193
|
+
gl.canvas.style.width = width + "px";
|
|
194
|
+
gl.canvas.style.height = height + "px";
|
|
195
|
+
program.uniforms.iResolution.value.set(gl.canvas.width, gl.canvas.height, gl.canvas.width / gl.canvas.height);
|
|
196
|
+
}
|
|
197
|
+
window.addEventListener("resize", resize);
|
|
198
|
+
resize();
|
|
199
|
+
let targetHover = 0;
|
|
200
|
+
let lastTime = 0;
|
|
201
|
+
let currentRot = 0;
|
|
202
|
+
const rotationSpeed = 0.3; // radians per second
|
|
203
|
+
const handleMouseMove = (e) => {
|
|
204
|
+
const rect = container.getBoundingClientRect();
|
|
205
|
+
const x = e.clientX - rect.left;
|
|
206
|
+
const y = e.clientY - rect.top;
|
|
207
|
+
const width = rect.width;
|
|
208
|
+
const height = rect.height;
|
|
209
|
+
const size = Math.min(width, height);
|
|
210
|
+
const centerX = width / 2;
|
|
211
|
+
const centerY = height / 2;
|
|
212
|
+
const uvX = ((x - centerX) / size) * 2.0;
|
|
213
|
+
const uvY = ((y - centerY) / size) * 2.0;
|
|
214
|
+
if (Math.sqrt(uvX * uvX + uvY * uvY) < 0.8) {
|
|
215
|
+
targetHover = 1;
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
targetHover = 0;
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
const handleMouseLeave = () => {
|
|
222
|
+
targetHover = 0;
|
|
223
|
+
};
|
|
224
|
+
if (hoverIntensity) {
|
|
225
|
+
container.addEventListener("mousemove", handleMouseMove);
|
|
226
|
+
container.addEventListener("mouseleave", handleMouseLeave);
|
|
227
|
+
}
|
|
228
|
+
let rafId;
|
|
229
|
+
const update = (t) => {
|
|
230
|
+
rafId = requestAnimationFrame(update);
|
|
231
|
+
const dt = (t - lastTime) * 0.001;
|
|
232
|
+
lastTime = t;
|
|
233
|
+
program.uniforms.iTime.value = t * 0.001;
|
|
234
|
+
program.uniforms.hue.value = hue;
|
|
235
|
+
program.uniforms.hoverIntensity.value = hoverIntensity;
|
|
236
|
+
const effectiveHover = forceHoverState ? 1 : targetHover;
|
|
237
|
+
program.uniforms.hover.value +=
|
|
238
|
+
(effectiveHover - program.uniforms.hover.value) * 0.1;
|
|
239
|
+
if (rotateOnHover && effectiveHover > 0.5) {
|
|
240
|
+
currentRot += dt * rotationSpeed;
|
|
241
|
+
}
|
|
242
|
+
program.uniforms.rot.value = currentRot;
|
|
243
|
+
renderer.render({ scene: mesh });
|
|
244
|
+
};
|
|
245
|
+
rafId = requestAnimationFrame(update);
|
|
246
|
+
return () => {
|
|
247
|
+
cancelAnimationFrame(rafId);
|
|
248
|
+
window.removeEventListener("resize", resize);
|
|
249
|
+
if (hoverIntensity) {
|
|
250
|
+
container.removeEventListener("mousemove", handleMouseMove);
|
|
251
|
+
container.removeEventListener("mouseleave", handleMouseLeave);
|
|
252
|
+
}
|
|
253
|
+
container.removeChild(gl.canvas);
|
|
254
|
+
gl.getExtension("WEBGL_lose_context")?.loseContext();
|
|
255
|
+
};
|
|
256
|
+
}, [hue, hoverIntensity, rotateOnHover, forceHoverState, vert, frag]);
|
|
257
|
+
return <div ref={ctnDom} className="h-full w-full"/>;
|
|
258
|
+
}
|