@majapisoftwares/ui 4.3.17 → 6.0.0
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/AGENTS.md +27 -0
- package/README.md +79 -0
- package/THIRD_PARTY_NOTICES.md +39 -0
- package/components.json +25 -0
- package/docs/MIGRATION-0.2.md +20 -0
- package/docs/MIGRATION-6.0.md +33 -0
- package/docs/NEXT-STARTER-VALIDATION.md +14 -0
- package/docs/STANDARDS.md +41 -0
- package/docs/VALIDATION.md +11 -0
- package/docs/VERSIONING.md +28 -0
- package/package.json +78 -2
- package/scripts/check-standards.mjs +41 -0
- package/src/components/ui/accordion.tsx +82 -0
- package/src/components/ui/alert-dialog.tsx +187 -0
- package/src/components/ui/alert.tsx +77 -0
- package/src/components/ui/avatar.tsx +108 -0
- package/src/components/ui/badge.tsx +55 -0
- package/src/components/ui/breadcrumb.tsx +125 -0
- package/src/components/ui/button-group.tsx +89 -0
- package/src/components/ui/button.tsx +59 -0
- package/src/components/ui/card.tsx +101 -0
- package/src/components/ui/checkbox.tsx +27 -0
- package/src/components/ui/collapsible.tsx +21 -0
- package/src/components/ui/context-menu.tsx +271 -0
- package/src/components/ui/dialog.tsx +161 -0
- package/src/components/ui/dropdown-menu.tsx +271 -0
- package/src/components/ui/empty.tsx +105 -0
- package/src/components/ui/field.tsx +238 -0
- package/src/components/ui/hover-card.tsx +50 -0
- package/src/components/ui/input-group.tsx +155 -0
- package/src/components/ui/input.tsx +21 -0
- package/src/components/ui/kbd.tsx +28 -0
- package/src/components/ui/label.tsx +19 -0
- package/src/components/ui/orb.css +1002 -0
- package/src/components/ui/orb.tsx +752 -0
- package/src/components/ui/popover.tsx +89 -0
- package/src/components/ui/progress.tsx +82 -0
- package/src/components/ui/radio-group.tsx +37 -0
- package/src/components/ui/scroll-area.tsx +54 -0
- package/src/components/ui/select.tsx +204 -0
- package/src/components/ui/separator.tsx +24 -0
- package/src/components/ui/sheet.tsx +139 -0
- package/src/components/ui/sidebar.tsx +1035 -0
- package/src/components/ui/skeleton.tsx +15 -0
- package/src/components/ui/slider.tsx +53 -0
- package/src/components/ui/sonner.tsx +44 -0
- package/src/components/ui/spinner.tsx +32 -0
- package/src/components/ui/switch.tsx +31 -0
- package/src/components/ui/table.tsx +121 -0
- package/src/components/ui/tabs.tsx +81 -0
- package/src/components/ui/textarea.tsx +19 -0
- package/src/components/ui/toggle-group.tsx +89 -0
- package/src/components/ui/toggle.tsx +44 -0
- package/src/components/ui/tooltip.tsx +65 -0
- package/src/hooks/use-mobile.ts +20 -0
- package/src/lib/i18n.tsx +109 -0
- package/src/lib/utils.ts +1 -0
- package/src/patterns/app-shell.tsx +175 -0
- package/src/patterns/data-table.tsx +2486 -0
- package/src/patterns/details-sheet.tsx +53 -0
- package/src/patterns/filter-tabs.tsx +53 -0
- package/src/patterns/majapi-logo.tsx +32 -0
- package/src/patterns/page-header.tsx +62 -0
- package/src/patterns/preferences.tsx +172 -0
- package/src/patterns/status-badge.tsx +24 -0
- package/src/styles.css +165 -0
- package/src/templates/admin-dashboard.tsx +44 -0
- package/src/templates/auth-layout.tsx +30 -0
- package/src/templates/login-form.tsx +129 -0
- package/src/templates/signup-form.tsx +177 -0
- package/base.css +0 -360
- package/bootstrap/AppProps.d.ts +0 -9
- package/bootstrap/AppProps.js +0 -1
- package/bootstrap/index.d.ts +0 -1
- package/bootstrap/index.js +0 -1
- package/bootstrap/modeScript.d.ts +0 -2
- package/bootstrap/modeScript.js +0 -35
- package/bootstrap/nprogress.d.ts +0 -1
- package/bootstrap/nprogress.js +0 -19
- package/bootstrap/scrolledScript.d.ts +0 -2
- package/bootstrap/scrolledScript.js +0 -27
- package/bootstrap/setupFocusManager.d.ts +0 -1
- package/bootstrap/setupFocusManager.js +0 -13
- package/bootstrap/suppressConsoleLog.d.ts +0 -1
- package/bootstrap/suppressConsoleLog.js +0 -8
- package/components/Accordion/Accordion.d.ts +0 -16
- package/components/Accordion/Accordion.jsx +0 -27
- package/components/Accordion/index.d.ts +0 -3
- package/components/Accordion/index.jsx +0 -3
- package/components/Alert/Alert.d.ts +0 -31
- package/components/Alert/Alert.jsx +0 -53
- package/components/Alert/index.d.ts +0 -3
- package/components/Alert/index.jsx +0 -3
- package/components/AntiClickjacking/AntiClickjacking.d.ts +0 -1
- package/components/AntiClickjacking/AntiClickjacking.jsx +0 -17
- package/components/AntiClickjacking/index.d.ts +0 -2
- package/components/AntiClickjacking/index.jsx +0 -2
- package/components/Aurora/Aurora.d.ts +0 -10
- package/components/Aurora/Aurora.jsx +0 -189
- package/components/Aurora/index.d.ts +0 -3
- package/components/Aurora/index.jsx +0 -3
- package/components/Autocomplete/Autocomplete.d.ts +0 -7
- package/components/Autocomplete/Autocomplete.jsx +0 -23
- package/components/Autocomplete/UnstyledAutocomplete.d.ts +0 -36
- package/components/Autocomplete/UnstyledAutocomplete.jsx +0 -72
- package/components/Autocomplete/index.d.ts +0 -5
- package/components/Autocomplete/index.jsx +0 -5
- package/components/BackgroundEffects/BottomBlurryPoint.d.ts +0 -3
- package/components/BackgroundEffects/BottomBlurryPoint.jsx +0 -14
- package/components/BackgroundEffects/TopBlurryPoint.d.ts +0 -3
- package/components/BackgroundEffects/TopBlurryPoint.jsx +0 -14
- package/components/Badge/Badge.d.ts +0 -42
- package/components/Badge/Badge.jsx +0 -51
- package/components/Badge/index.d.ts +0 -3
- package/components/Badge/index.jsx +0 -3
- package/components/Breadcrumbs/Breadcrumbs.d.ts +0 -20
- package/components/Breadcrumbs/Breadcrumbs.jsx +0 -42
- package/components/Breadcrumbs/index.d.ts +0 -3
- package/components/Breadcrumbs/index.jsx +0 -3
- package/components/Button/Button.d.ts +0 -111
- package/components/Button/Button.jsx +0 -129
- package/components/Button/UnstyledButton.d.ts +0 -10
- package/components/Button/UnstyledButton.jsx +0 -13
- package/components/Button/index.d.ts +0 -3
- package/components/Button/index.jsx +0 -3
- package/components/Carousel/Carousel.d.ts +0 -19
- package/components/Carousel/Carousel.jsx +0 -55
- package/components/Carousel/index.d.ts +0 -3
- package/components/Carousel/index.jsx +0 -3
- package/components/Checkbox/Checkbox.d.ts +0 -14
- package/components/Checkbox/Checkbox.jsx +0 -45
- package/components/Checkbox/index.d.ts +0 -3
- package/components/Checkbox/index.js +0 -3
- package/components/Code/Code.d.ts +0 -12
- package/components/Code/Code.jsx +0 -25
- package/components/Code/Json.d.ts +0 -5
- package/components/Code/Json.jsx +0 -7
- package/components/Code/index.d.ts +0 -4
- package/components/Code/index.jsx +0 -4
- package/components/ConfirmationButton/ConfirmationButton.d.ts +0 -17
- package/components/ConfirmationButton/ConfirmationButton.jsx +0 -13
- package/components/ConfirmationButton/index.d.ts +0 -3
- package/components/ConfirmationButton/index.jsx +0 -3
- package/components/ContextMenu/ContextMenu.d.ts +0 -28
- package/components/ContextMenu/ContextMenu.jsx +0 -70
- package/components/ContextMenu/index.d.ts +0 -3
- package/components/ContextMenu/index.jsx +0 -3
- package/components/CopyButton/CopyButton.d.ts +0 -7
- package/components/CopyButton/CopyButton.jsx +0 -29
- package/components/CopyButton/index.d.ts +0 -3
- package/components/CopyButton/index.jsx +0 -3
- package/components/DateInput/DateInput.d.ts +0 -6
- package/components/DateInput/DateInput.jsx +0 -19
- package/components/DateInput/DateTimeInput.d.ts +0 -3
- package/components/DateInput/DateTimeInput.jsx +0 -8
- package/components/DateInput/index.d.ts +0 -4
- package/components/DateInput/index.jsx +0 -4
- package/components/DateInput/useRefValue.d.ts +0 -5
- package/components/DateInput/useRefValue.js +0 -48
- package/components/DatePicker/DatePicker.d.ts +0 -19
- package/components/DatePicker/DatePicker.jsx +0 -55
- package/components/DatePicker/index.d.ts +0 -3
- package/components/DatePicker/index.jsx +0 -3
- package/components/DateRangePicker/DateRangePicker.d.ts +0 -16
- package/components/DateRangePicker/DateRangePicker.jsx +0 -56
- package/components/DateRangePicker/index.d.ts +0 -3
- package/components/DateRangePicker/index.jsx +0 -3
- package/components/Dialog/Dialog.d.ts +0 -25
- package/components/Dialog/Dialog.jsx +0 -35
- package/components/Dialog/Dialogs.d.ts +0 -1
- package/components/Dialog/Dialogs.jsx +0 -21
- package/components/Dialog/dialogs.state.d.ts +0 -21
- package/components/Dialog/dialogs.state.js +0 -40
- package/components/Dialog/index.d.ts +0 -6
- package/components/Dialog/index.jsx +0 -7
- package/components/Drawer/Drawer.d.ts +0 -15
- package/components/Drawer/Drawer.jsx +0 -72
- package/components/Drawer/index.d.ts +0 -3
- package/components/Drawer/index.jsx +0 -3
- package/components/DropdownMenu/DropdownMenu.d.ts +0 -33
- package/components/DropdownMenu/DropdownMenu.jsx +0 -74
- package/components/DropdownMenu/index.d.ts +0 -3
- package/components/DropdownMenu/index.jsx +0 -3
- package/components/ErrorBoundary/ErrorBoundary.d.ts +0 -18
- package/components/ErrorBoundary/ErrorBoundary.jsx +0 -32
- package/components/ErrorBoundary/index.d.ts +0 -3
- package/components/ErrorBoundary/index.jsx +0 -3
- package/components/ErrorPage/Error404Page.d.ts +0 -1
- package/components/ErrorPage/Error404Page.jsx +0 -4
- package/components/ErrorPage/Error500Page.d.ts +0 -1
- package/components/ErrorPage/Error500Page.jsx +0 -4
- package/components/ErrorPage/ErrorPage.d.ts +0 -11
- package/components/ErrorPage/ErrorPage.jsx +0 -23
- package/components/FileInput/FileInput.d.ts +0 -53
- package/components/FileInput/FileInput.jsx +0 -141
- package/components/FileInput/PreviewFile.d.ts +0 -18
- package/components/FileInput/PreviewFile.jsx +0 -54
- package/components/FileInput/index.d.ts +0 -3
- package/components/FileInput/index.jsx +0 -3
- package/components/FileInput/isImage.d.ts +0 -1
- package/components/FileInput/isImage.js +0 -10
- package/components/FileInput/isVideo.d.ts +0 -1
- package/components/FileInput/isVideo.js +0 -10
- package/components/FileSelect/FileSelect.d.ts +0 -31
- package/components/FileSelect/FileSelect.jsx +0 -146
- package/components/FileSelect/index.d.ts +0 -3
- package/components/FileSelect/index.jsx +0 -3
- package/components/Footer/Footer.d.ts +0 -19
- package/components/Footer/Footer.jsx +0 -30
- package/components/Footer/index.d.ts +0 -3
- package/components/Footer/index.jsx +0 -3
- package/components/GridPattern/GridPattern.d.ts +0 -2
- package/components/GridPattern/GridPattern.jsx +0 -12
- package/components/GridPattern/index.d.ts +0 -3
- package/components/GridPattern/index.jsx +0 -3
- package/components/Group/Group.d.ts +0 -5
- package/components/Group/Group.jsx +0 -6
- package/components/Group/index.d.ts +0 -3
- package/components/Group/index.jsx +0 -3
- package/components/Header/Header.d.ts +0 -5
- package/components/Header/Header.jsx +0 -19
- package/components/Header/index.d.ts +0 -3
- package/components/Header/index.jsx +0 -3
- package/components/ImageInput/ImageInput.d.ts +0 -4
- package/components/ImageInput/ImageInput.jsx +0 -8
- package/components/ImageInput/index.d.ts +0 -3
- package/components/ImageInput/index.jsx +0 -3
- package/components/Input/Input.d.ts +0 -14
- package/components/Input/Input.jsx +0 -57
- package/components/Input/InputIcon.d.ts +0 -9
- package/components/Input/InputIcon.jsx +0 -7
- package/components/Input/MultiSelectInput.d.ts +0 -16
- package/components/Input/MultiSelectInput.jsx +0 -48
- package/components/Input/NumericInput.d.ts +0 -6
- package/components/Input/NumericInput.jsx +0 -6
- package/components/Input/PatternInput.d.ts +0 -6
- package/components/Input/PatternInput.jsx +0 -6
- package/components/Input/SelectInput.d.ts +0 -12
- package/components/Input/SelectInput.jsx +0 -25
- package/components/Input/UnstyledInput.d.ts +0 -22
- package/components/Input/UnstyledInput.jsx +0 -28
- package/components/Input/index.d.ts +0 -6
- package/components/Input/index.jsx +0 -6
- package/components/Input/useInputRefValue.d.ts +0 -11
- package/components/Input/useInputRefValue.jsx +0 -51
- package/components/Input2/InputWrapper.d.ts +0 -11
- package/components/Input2/InputWrapper.jsx +0 -11
- package/components/Link/Link.d.ts +0 -3
- package/components/Link/Link.jsx +0 -9
- package/components/Link/index.d.ts +0 -3
- package/components/Link/index.jsx +0 -3
- package/components/Loading/Loading.d.ts +0 -5
- package/components/Loading/Loading.jsx +0 -15
- package/components/Loading/index.d.ts +0 -3
- package/components/Loading/index.jsx +0 -3
- package/components/Magnet/Magnet.d.ts +0 -13
- package/components/Magnet/Magnet.jsx +0 -50
- package/components/Magnet/index.d.ts +0 -3
- package/components/Magnet/index.jsx +0 -3
- package/components/Markdown/Markdown.d.ts +0 -8
- package/components/Markdown/Markdown.jsx +0 -11
- package/components/Markdown/index.d.ts +0 -3
- package/components/Markdown/index.jsx +0 -3
- package/components/Menu/Menu.d.ts +0 -28
- package/components/Menu/Menu.jsx +0 -54
- package/components/Modal/Modal.d.ts +0 -45
- package/components/Modal/Modal.jsx +0 -65
- package/components/Modal/index.d.ts +0 -4
- package/components/Modal/index.jsx +0 -4
- package/components/Modal/useModalState.d.ts +0 -6
- package/components/Modal/useModalState.js +0 -16
- package/components/ModeToggle/ModeToggle.d.ts +0 -9
- package/components/ModeToggle/ModeToggle.jsx +0 -12
- package/components/ModeToggle/index.d.ts +0 -4
- package/components/ModeToggle/index.jsx +0 -5
- package/components/ModeToggle/useModeToggle.d.ts +0 -1
- package/components/ModeToggle/useModeToggle.js +0 -21
- package/components/MultiSelect/MultiSelect.d.ts +0 -28
- package/components/MultiSelect/MultiSelect.jsx +0 -116
- package/components/MultiSelect/MultiSelectInput.d.ts +0 -12
- package/components/MultiSelect/MultiSelectInput.jsx +0 -27
- package/components/MultiSelect/index.d.ts +0 -5
- package/components/MultiSelect/index.jsx +0 -5
- package/components/MultiText/MultiText.d.ts +0 -23
- package/components/MultiText/MultiText.jsx +0 -118
- package/components/MultiText/index.d.ts +0 -3
- package/components/MultiText/index.jsx +0 -3
- package/components/NavigationDrawer/NavigationDrawer.d.ts +0 -9
- package/components/NavigationDrawer/NavigationDrawer.jsx +0 -29
- package/components/NavigationDrawer/NavigationItem.d.ts +0 -13
- package/components/NavigationDrawer/NavigationItem.jsx +0 -24
- package/components/NavigationDrawer/index.d.ts +0 -6
- package/components/NavigationDrawer/index.jsx +0 -6
- package/components/NavigationDrawer/navigationDrawer.state.d.ts +0 -9
- package/components/NavigationDrawer/navigationDrawer.state.js +0 -19
- package/components/NoSsr/NoSsr.d.ts +0 -4
- package/components/NoSsr/NoSsr.jsx +0 -8
- package/components/NoSsr/index.d.ts +0 -3
- package/components/NoSsr/index.jsx +0 -3
- package/components/Noise/Noise.d.ts +0 -11
- package/components/Noise/Noise.jsx +0 -69
- package/components/Noise/index.d.ts +0 -3
- package/components/Noise/index.jsx +0 -3
- package/components/Notifications/Notifications.d.ts +0 -3
- package/components/Notifications/Notifications.jsx +0 -60
- package/components/Notifications/index.d.ts +0 -5
- package/components/Notifications/index.jsx +0 -6
- package/components/Notifications/notifications.state.d.ts +0 -24
- package/components/Notifications/notifications.state.js +0 -41
- package/components/Orb/Orb.d.ts +0 -8
- package/components/Orb/Orb.jsx +0 -258
- package/components/Orb/index.d.ts +0 -3
- package/components/Orb/index.jsx +0 -3
- package/components/Pagination/Pagination.d.ts +0 -13
- package/components/Pagination/Pagination.jsx +0 -64
- package/components/Pagination/index.d.ts +0 -3
- package/components/Pagination/index.jsx +0 -3
- package/components/Particles/Particles.d.ts +0 -18
- package/components/Particles/Particles.jsx +0 -205
- package/components/Particles/index.d.ts +0 -3
- package/components/Particles/index.jsx +0 -3
- package/components/PictureCropInput/PictureCropInput.d.ts +0 -20
- package/components/PictureCropInput/PictureCropInput.jsx +0 -174
- package/components/PictureCropInput/canvasPreview.d.ts +0 -2
- package/components/PictureCropInput/canvasPreview.js +0 -37
- package/components/PictureCropInput/index.d.ts +0 -3
- package/components/PictureCropInput/index.js +0 -3
- package/components/Popover/Popover.d.ts +0 -13
- package/components/Popover/Popover.jsx +0 -22
- package/components/Popover/index.d.ts +0 -3
- package/components/Popover/index.jsx +0 -3
- package/components/Resizable/Resizable.d.ts +0 -12
- package/components/Resizable/Resizable.jsx +0 -54
- package/components/Resizable/index.d.ts +0 -3
- package/components/Resizable/index.jsx +0 -3
- package/components/ScrollArea/ScrollArea.d.ts +0 -9
- package/components/ScrollArea/ScrollArea.jsx +0 -16
- package/components/ScrollArea/index.d.ts +0 -3
- package/components/ScrollArea/index.jsx +0 -3
- package/components/Select/Select.d.ts +0 -25
- package/components/Select/Select.jsx +0 -55
- package/components/Select/index.d.ts +0 -3
- package/components/Select/index.jsx +0 -3
- package/components/Skeleton/Skeleton.d.ts +0 -2
- package/components/Skeleton/Skeleton.jsx +0 -8
- package/components/Skeleton/index.d.ts +0 -3
- package/components/Skeleton/index.jsx +0 -3
- package/components/Slider/Slider.d.ts +0 -10
- package/components/Slider/Slider.jsx +0 -21
- package/components/Slider/index.d.ts +0 -3
- package/components/Slider/index.jsx +0 -3
- package/components/Spotlight/Spotlight.d.ts +0 -30
- package/components/Spotlight/Spotlight.jsx +0 -86
- package/components/Spotlight/index.d.ts +0 -3
- package/components/Spotlight/index.jsx +0 -3
- package/components/SpotlightCard/SpotlightCard.d.ts +0 -7
- package/components/SpotlightCard/SpotlightCard.jsx +0 -35
- package/components/SpotlightCard/index.d.ts +0 -3
- package/components/SpotlightCard/index.jsx +0 -3
- package/components/Stack/Stack.d.ts +0 -4
- package/components/Stack/Stack.jsx +0 -5
- package/components/Stack/index.d.ts +0 -3
- package/components/Stack/index.jsx +0 -3
- package/components/StarBorder/StarBorder.d.ts +0 -10
- package/components/StarBorder/StarBorder.jsx +0 -19
- package/components/StarBorder/index.d.ts +0 -3
- package/components/StarBorder/index.jsx +0 -3
- package/components/Switch/Switch.d.ts +0 -16
- package/components/Switch/Switch.jsx +0 -24
- package/components/Switch/index.d.ts +0 -3
- package/components/Switch/index.jsx +0 -3
- package/components/Table/DataTable.d.ts +0 -57
- package/components/Table/DataTable.jsx +0 -155
- package/components/Table/Table.d.ts +0 -27
- package/components/Table/Table.jsx +0 -31
- package/components/Table/TableActionButton.d.ts +0 -6
- package/components/Table/TableActionButton.jsx +0 -20
- package/components/Table/TableBody.d.ts +0 -6
- package/components/Table/TableBody.jsx +0 -10
- package/components/Table/TableCell.d.ts +0 -9
- package/components/Table/TableCell.jsx +0 -18
- package/components/Table/TableFooter.d.ts +0 -5
- package/components/Table/TableFooter.jsx +0 -5
- package/components/Table/TableFooterWithPagination.d.ts +0 -13
- package/components/Table/TableFooterWithPagination.jsx +0 -57
- package/components/Table/TableHead.d.ts +0 -5
- package/components/Table/TableHead.jsx +0 -9
- package/components/Table/TableHeadContext.d.ts +0 -4
- package/components/Table/TableHeadContext.jsx +0 -3
- package/components/Table/TableHeader.d.ts +0 -7
- package/components/Table/TableHeader.jsx +0 -15
- package/components/Table/TableRow.d.ts +0 -8
- package/components/Table/TableRow.jsx +0 -9
- package/components/Table/index.d.ts +0 -3
- package/components/Table/index.jsx +0 -3
- package/components/Tabs/Tabs.d.ts +0 -9
- package/components/Tabs/Tabs.jsx +0 -13
- package/components/Tabs/index.d.ts +0 -3
- package/components/Tabs/index.jsx +0 -3
- package/components/TabsSwitcher/Tab.d.ts +0 -15
- package/components/TabsSwitcher/Tab.jsx +0 -18
- package/components/TabsSwitcher/TabsSwitcher.d.ts +0 -22
- package/components/TabsSwitcher/TabsSwitcher.jsx +0 -31
- package/components/TabsSwitcher/index.d.ts +0 -4
- package/components/TabsSwitcher/index.jsx +0 -4
- package/components/Text/Text.d.ts +0 -24
- package/components/Text/Text.jsx +0 -29
- package/components/Text/index.d.ts +0 -3
- package/components/Text/index.jsx +0 -3
- package/components/Textarea/Textarea.d.ts +0 -5
- package/components/Textarea/Textarea.jsx +0 -6
- package/components/Textarea/index.d.ts +0 -3
- package/components/Textarea/index.js +0 -3
- package/components/Threads/Threads.d.ts +0 -9
- package/components/Threads/Threads.jsx +0 -203
- package/components/Threads/index.d.ts +0 -3
- package/components/Threads/index.jsx +0 -3
- package/components/Tooltip/Tooltip.d.ts +0 -11
- package/components/Tooltip/Tooltip.jsx +0 -21
- package/components/Tooltip/index.d.ts +0 -3
- package/components/Tooltip/index.jsx +0 -3
- package/components/VisibilityActivatedButton/VisibilityActivatedButton.d.ts +0 -7
- package/components/VisibilityActivatedButton/VisibilityActivatedButton.jsx +0 -18
- package/components/VisibilityActivatedButton/index.d.ts +0 -3
- package/components/VisibilityActivatedButton/index.jsx +0 -3
- package/form.d.ts +0 -82
- package/form.js +0 -113
- package/form2.d.ts +0 -15
- package/form2.jsx +0 -30
- package/hooks/useBeforeUnload.d.ts +0 -1
- package/hooks/useBeforeUnload.js +0 -17
- package/hooks/useDebounceEffect.d.ts +0 -2
- package/hooks/useDebounceEffect.js +0 -14
- package/hooks/useDebouncedValue.d.ts +0 -2
- package/hooks/useDebouncedValue.js +0 -14
- package/hooks/useLagRadar.d.ts +0 -1
- package/hooks/useLagRadar.jsx +0 -124
- package/hooks/useMediaQuery.d.ts +0 -1
- package/hooks/useMediaQuery.js +0 -37
- package/hooks/useMutationWindowCloseProtection.d.ts +0 -2
- package/hooks/useMutationWindowCloseProtection.js +0 -13
- package/hooks/useScroll.d.ts +0 -3
- package/hooks/useScroll.js +0 -47
- package/hooks/useTranslation.d.ts +0 -4
- package/hooks/useTranslation.js +0 -11
- package/hooks/useWhyDidYouUpdate.d.ts +0 -3
- package/hooks/useWhyDidYouUpdate.js +0 -44
- package/imgur.d.ts +0 -1
- package/imgur.js +0 -13
- package/styles/DayPicker.classNames.d.ts +0 -29
- package/styles/DayPicker.classNames.js +0 -30
- package/styles/DayPicker.classNames.ts +0 -81
- package/styles/Dropdown.classNames.d.ts +0 -6
- package/styles/Dropdown.classNames.js +0 -7
- package/styles/Dropdown.classNames.ts +0 -38
- package/styles/Input.css +0 -23
- package/styles/Modal.classNames.d.ts +0 -2
- package/styles/Modal.classNames.js +0 -3
- package/styles/Modal.classNames.ts +0 -15
- package/styles/MultiText.css +0 -40
- package/styles/Pagination.css +0 -19
- package/styles/Tabs.css +0 -23
- package/tsconfig.tsbuildinfo +0 -1
- package/types.d.ts +0 -6
- package/types.js +0 -1
- package/utils/UseState.d.ts +0 -2
- package/utils/UseState.js +0 -1
- package/utils/blobToText.d.ts +0 -1
- package/utils/blobToText.js +0 -13
- package/utils/capitalize.d.ts +0 -1
- package/utils/capitalize.js +0 -6
- package/utils/clsx.d.ts +0 -2
- package/utils/clsx.js +0 -5
- package/utils/copy2DToClipboard.d.ts +0 -1
- package/utils/copy2DToClipboard.js +0 -44
- package/utils/cpfCpnjUtils.d.ts +0 -3
- package/utils/cpfCpnjUtils.js +0 -43
- package/utils/createLocalStorageStateHydration.d.ts +0 -1
- package/utils/createLocalStorageStateHydration.js +0 -18
- package/utils/createStateHydration.d.ts +0 -3
- package/utils/createStateHydration.js +0 -49
- package/utils/csvBlobToJson.d.ts +0 -2
- package/utils/csvBlobToJson.js +0 -59
- package/utils/downloadArrayAsCSV.d.ts +0 -1
- package/utils/downloadArrayAsCSV.js +0 -34
- package/utils/emailRegExp.d.ts +0 -2
- package/utils/emailRegExp.js +0 -2
- package/utils/fakeArray.d.ts +0 -1
- package/utils/fakeArray.js +0 -3
- package/utils/filterBoolean.d.ts +0 -1
- package/utils/filterBoolean.js +0 -3
- package/utils/formatClock.d.ts +0 -1
- package/utils/formatClock.js +0 -21
- package/utils/getInitials.d.ts +0 -4
- package/utils/getInitials.js +0 -22
- package/utils/isBrowser.d.ts +0 -12
- package/utils/isBrowser.js +0 -26
- package/utils/ms.d.ts +0 -6
- package/utils/ms.js +0 -31
- package/utils/preventDefault.d.ts +0 -2
- package/utils/preventDefault.js +0 -3
- package/utils/recursiveChildrenMap.d.ts +0 -2
- package/utils/recursiveChildrenMap.js +0 -16
- package/utils/setSelectionRange.d.ts +0 -1
- package/utils/setSelectionRange.js +0 -55
- package/utils/smoothScrollToHref.d.ts +0 -2
- package/utils/smoothScrollToHref.js +0 -14
- package/utils/stopPropagation.d.ts +0 -2
- package/utils/stopPropagation.js +0 -3
- package/utils/stripHtml.d.ts +0 -1
- package/utils/stripHtml.js +0 -4
- package/utils/stripLineBreak.d.ts +0 -1
- package/utils/stripLineBreak.js +0 -4
- package/utils/stripMarkdown.d.ts +0 -1
- package/utils/stripMarkdown.js +0 -28
- package/utils/xlsxBlobToJson.d.ts +0 -2
- package/utils/xlsxBlobToJson.js +0 -62
|
@@ -0,0 +1,752 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// Adapted from AICSS Orbs (MIT, https://github.com/kvnkld/aicss); kept close to
|
|
4
|
+
// upstream, so its unused helpers stay.
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
6
|
+
|
|
7
|
+
import type { CSSProperties } from "react";
|
|
8
|
+
import { defineMessages, useUiMessages } from "../../lib/i18n";
|
|
9
|
+
|
|
10
|
+
/** The stage the geometry is tuned on; --orb-k scales it to `size`. */
|
|
11
|
+
const STAGE = 28;
|
|
12
|
+
|
|
13
|
+
/** Default rendered size - 20×20 indicator box. */
|
|
14
|
+
const SIZE = 20;
|
|
15
|
+
|
|
16
|
+
export type LatticeVariant = "S1" | "S2" | "S3" | "S4" | "S5";
|
|
17
|
+
export type LensVariant = "B1" | "B2" | "B3" | "B4" | "B5";
|
|
18
|
+
export type RingVariant = "C1" | "C2" | "C3" | "C4" | "C5";
|
|
19
|
+
export type HelixVariant = "G1" | "G2" | "G3" | "G4" | "G5";
|
|
20
|
+
export type MorphVariant = "M1" | "M2" | "M3" | "M4" | "M5";
|
|
21
|
+
export type OrbVariant =
|
|
22
|
+
LatticeVariant | LensVariant | RingVariant | HelixVariant | MorphVariant;
|
|
23
|
+
|
|
24
|
+
export const LATTICE_VARIANTS: LatticeVariant[] = [
|
|
25
|
+
"S1",
|
|
26
|
+
"S2",
|
|
27
|
+
"S3",
|
|
28
|
+
"S4",
|
|
29
|
+
"S5",
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
export const LENS_VARIANTS: LensVariant[] = ["B1", "B2", "B3", "B4", "B5"];
|
|
33
|
+
|
|
34
|
+
export const RING_VARIANTS: RingVariant[] = ["C1", "C2", "C3", "C4", "C5"];
|
|
35
|
+
|
|
36
|
+
export const HELIX_VARIANTS: HelixVariant[] = ["G1", "G2", "G3", "G4", "G5"];
|
|
37
|
+
|
|
38
|
+
export const MORPH_VARIANTS: MorphVariant[] = ["M1", "M2", "M3", "M4", "M5"];
|
|
39
|
+
|
|
40
|
+
export const ORB_TASKS: Record<OrbVariant, string> = {
|
|
41
|
+
S1: "Thinking",
|
|
42
|
+
S2: "Processing",
|
|
43
|
+
S3: "Working",
|
|
44
|
+
S4: "Searching",
|
|
45
|
+
S5: "Finalizing",
|
|
46
|
+
B1: "Thinking",
|
|
47
|
+
B2: "Searching",
|
|
48
|
+
B3: "Generating",
|
|
49
|
+
B4: "Solving",
|
|
50
|
+
B5: "Routing",
|
|
51
|
+
C1: "Loading",
|
|
52
|
+
C2: "Listening",
|
|
53
|
+
C3: "Streaming",
|
|
54
|
+
C4: "Analyzing",
|
|
55
|
+
C5: "Compiling",
|
|
56
|
+
G1: "Processing",
|
|
57
|
+
G2: "Sequencing",
|
|
58
|
+
G3: "Uploading",
|
|
59
|
+
G4: "Syncing",
|
|
60
|
+
G5: "Idling",
|
|
61
|
+
M1: "Shaping",
|
|
62
|
+
M2: "Expanding",
|
|
63
|
+
M3: "Unfolding",
|
|
64
|
+
M4: "Transforming",
|
|
65
|
+
M5: "Dispersing",
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/** Translated task names per variant (`ORB_TASKS` is the English upstream list). */
|
|
69
|
+
export const ORB_TASK_LABELS = defineMessages<Record<OrbVariant, string>>({
|
|
70
|
+
en: ORB_TASKS,
|
|
71
|
+
"pt-BR": {
|
|
72
|
+
S1: "Pensando",
|
|
73
|
+
S2: "Processando",
|
|
74
|
+
S3: "Trabalhando",
|
|
75
|
+
S4: "Buscando",
|
|
76
|
+
S5: "Finalizando",
|
|
77
|
+
B1: "Pensando",
|
|
78
|
+
B2: "Buscando",
|
|
79
|
+
B3: "Gerando",
|
|
80
|
+
B4: "Resolvendo",
|
|
81
|
+
B5: "Roteando",
|
|
82
|
+
C1: "Carregando",
|
|
83
|
+
C2: "Ouvindo",
|
|
84
|
+
C3: "Transmitindo",
|
|
85
|
+
C4: "Analisando",
|
|
86
|
+
C5: "Compilando",
|
|
87
|
+
G1: "Processando",
|
|
88
|
+
G2: "Sequenciando",
|
|
89
|
+
G3: "Enviando",
|
|
90
|
+
G4: "Sincronizando",
|
|
91
|
+
G5: "Ocioso",
|
|
92
|
+
M1: "Moldando",
|
|
93
|
+
M2: "Expandindo",
|
|
94
|
+
M3: "Desdobrando",
|
|
95
|
+
M4: "Transformando",
|
|
96
|
+
M5: "Dispersando",
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
function isLattice(v: OrbVariant): v is LatticeVariant {
|
|
101
|
+
return (LATTICE_VARIANTS as OrbVariant[]).includes(v);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function isRing(v: OrbVariant): v is RingVariant {
|
|
105
|
+
return (RING_VARIANTS as OrbVariant[]).includes(v);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function isHelix(v: OrbVariant): v is HelixVariant {
|
|
109
|
+
return (HELIX_VARIANTS as OrbVariant[]).includes(v);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function isMorph(v: OrbVariant): v is MorphVariant {
|
|
113
|
+
return (MORPH_VARIANTS as OrbVariant[]).includes(v);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const N = 3; // lattice is N×N
|
|
117
|
+
const PITCH = 6; // centre-to-centre spacing in stage px; the dot size is CSS
|
|
118
|
+
const MID = (N - 1) / 2;
|
|
119
|
+
|
|
120
|
+
/** Clockwise walk of the lattice perimeter - the track `orbit` runs on. */
|
|
121
|
+
const RING: [number, number][] = (() => {
|
|
122
|
+
const ring: [number, number][] = [];
|
|
123
|
+
for (let x = 0; x < N; x++) ring.push([x, 0]);
|
|
124
|
+
for (let y = 1; y < N; y++) ring.push([N - 1, y]);
|
|
125
|
+
for (let x = N - 2; x >= 0; x--) ring.push([x, N - 1]);
|
|
126
|
+
for (let y = N - 2; y >= 1; y--) ring.push([0, y]);
|
|
127
|
+
return ring;
|
|
128
|
+
})();
|
|
129
|
+
|
|
130
|
+
const RING_INDEX = new Map(RING.map(([x, y], i) => [x + "," + y, i]));
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Per-cell `animation-delay` in ms. Negative values seed a cell partway
|
|
134
|
+
* into its cycle, which is what turns 8 identical animations into one
|
|
135
|
+
* comet travelling the ring.
|
|
136
|
+
*/
|
|
137
|
+
function cellDelay(v: LatticeVariant, x: number, y: number): number {
|
|
138
|
+
const dx = x - MID;
|
|
139
|
+
const dy = y - MID;
|
|
140
|
+
const ring = Math.max(Math.abs(dx), Math.abs(dy));
|
|
141
|
+
switch (v) {
|
|
142
|
+
// Radiates from the centre on a round wavefront. Centre leads a beat
|
|
143
|
+
// early so the next swell doesn't sit behind the outer fade.
|
|
144
|
+
case "S1":
|
|
145
|
+
return Math.hypot(dx, dy) * 700 - (dx === 0 && dy === 0 ? 180 : 0);
|
|
146
|
+
// A broad band crosses the grid on the diagonal. The spread is close to
|
|
147
|
+
// the wave duration, which both widens the band and makes the sweep
|
|
148
|
+
// continuous - the far corner restarts as the near one does.
|
|
149
|
+
case "S2":
|
|
150
|
+
return ((x + y) / (2 * (N - 1))) * 1500;
|
|
151
|
+
// One head with a decaying tail, running the perimeter clockwise.
|
|
152
|
+
case "S3": {
|
|
153
|
+
const i = RING_INDEX.get(x + "," + y);
|
|
154
|
+
if (i === undefined) return 0;
|
|
155
|
+
return -(((RING.length - i) % RING.length) / RING.length) * 1700;
|
|
156
|
+
}
|
|
157
|
+
// A soft column travels left to right.
|
|
158
|
+
case "S4":
|
|
159
|
+
return (x / (N - 1)) * 1100;
|
|
160
|
+
// Like S3 but scrambled order - the pulse jumps pseudo-randomly.
|
|
161
|
+
case "S5": {
|
|
162
|
+
const i = RING_INDEX.get(x + "," + y);
|
|
163
|
+
if (i === undefined) return 0;
|
|
164
|
+
const scrambled = (i * 3) % RING.length;
|
|
165
|
+
return -(scrambled / RING.length) * 1700;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* `settle` gathers each cell from a position rotated one way around the
|
|
172
|
+
* centre and releases it to the mirror rotation, so the cycle keeps swirling
|
|
173
|
+
* the same way instead of rewinding to where it came from.
|
|
174
|
+
*/
|
|
175
|
+
const SWIRL = 1.05; // radians of rotation at each end, ~60°
|
|
176
|
+
const SPREAD = 1.6; // outward push, on top of the rotation
|
|
177
|
+
|
|
178
|
+
/** Offset from a cell's own grid slot to its swirled position, in stage px. */
|
|
179
|
+
function swirl(x: number, y: number, angle: number): [number, number] {
|
|
180
|
+
const dx = x - MID;
|
|
181
|
+
const dy = y - MID;
|
|
182
|
+
const cos = Math.cos(angle);
|
|
183
|
+
const sin = Math.sin(angle);
|
|
184
|
+
return [
|
|
185
|
+
((dx * cos - dy * sin) * SPREAD - dx) * PITCH,
|
|
186
|
+
((dx * sin + dy * cos) * SPREAD - dy) * PITCH,
|
|
187
|
+
];
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
interface Cell {
|
|
191
|
+
key: string;
|
|
192
|
+
left: number;
|
|
193
|
+
top: number;
|
|
194
|
+
delay: number;
|
|
195
|
+
/** Where `settle` gathers this cell from, and releases it to. */
|
|
196
|
+
ax: number;
|
|
197
|
+
ay: number;
|
|
198
|
+
bx: number;
|
|
199
|
+
by: number;
|
|
200
|
+
/** Sits out the choreography (interior cells during `orbit`). */
|
|
201
|
+
still: boolean;
|
|
202
|
+
/** Centre cell - the static frame under reduced motion. */
|
|
203
|
+
mid: boolean;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** The 9 lattice cells, with position, phase and swirl vectors. */
|
|
207
|
+
function latticeCells(v: LatticeVariant): Cell[] {
|
|
208
|
+
const cells: Cell[] = [];
|
|
209
|
+
for (let y = 0; y < N; y++) {
|
|
210
|
+
for (let x = 0; x < N; x++) {
|
|
211
|
+
const [ax, ay] = swirl(x, y, -SWIRL);
|
|
212
|
+
const [bx, by] = swirl(x, y, SWIRL);
|
|
213
|
+
cells.push({
|
|
214
|
+
key: x + "," + y,
|
|
215
|
+
left: x * PITCH,
|
|
216
|
+
top: y * PITCH,
|
|
217
|
+
delay: cellDelay(v, x, y),
|
|
218
|
+
ax,
|
|
219
|
+
ay,
|
|
220
|
+
bx,
|
|
221
|
+
by,
|
|
222
|
+
still: (v === "S3" || v === "S5") && !RING_INDEX.has(x + "," + y),
|
|
223
|
+
mid: x === MID && y === MID,
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return cells;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const RING_N = 8;
|
|
231
|
+
const RING_R = 8;
|
|
232
|
+
|
|
233
|
+
interface RingDot {
|
|
234
|
+
key: number;
|
|
235
|
+
rx: number;
|
|
236
|
+
ry: number;
|
|
237
|
+
delay: number;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function ringDuration(v: RingVariant): number {
|
|
241
|
+
switch (v) {
|
|
242
|
+
case "C1":
|
|
243
|
+
return 1600;
|
|
244
|
+
case "C2":
|
|
245
|
+
return 2000;
|
|
246
|
+
case "C3":
|
|
247
|
+
return 1800;
|
|
248
|
+
case "C4":
|
|
249
|
+
return 1600;
|
|
250
|
+
case "C5":
|
|
251
|
+
return 2200;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
function ringDelay(v: RingVariant, i: number): number {
|
|
256
|
+
const dur = ringDuration(v);
|
|
257
|
+
switch (v) {
|
|
258
|
+
case "C1":
|
|
259
|
+
return -((RING_N - 1 - i) / RING_N) * dur;
|
|
260
|
+
case "C2":
|
|
261
|
+
case "C3":
|
|
262
|
+
return -((RING_N - 1 - i) / RING_N) * dur;
|
|
263
|
+
case "C4":
|
|
264
|
+
return i % 2 === 0 ? 0 : -(dur / 2);
|
|
265
|
+
case "C5": {
|
|
266
|
+
const scrambled = (i * 3) % RING_N;
|
|
267
|
+
return -(scrambled / RING_N) * dur;
|
|
268
|
+
}
|
|
269
|
+
default:
|
|
270
|
+
return -(i / RING_N) * dur;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function ringDots(v: RingVariant): RingDot[] {
|
|
275
|
+
const dots: RingDot[] = [];
|
|
276
|
+
for (let i = 0; i < RING_N; i++) {
|
|
277
|
+
const angle = (i / RING_N) * Math.PI * 2 - Math.PI / 2;
|
|
278
|
+
dots.push({
|
|
279
|
+
key: i,
|
|
280
|
+
rx: Math.cos(angle) * RING_R,
|
|
281
|
+
ry: Math.sin(angle) * RING_R,
|
|
282
|
+
delay: ringDelay(v, i),
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
return dots;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const GLOBE_R = 8.5;
|
|
289
|
+
const GLOBE_TILT = (14 * Math.PI) / 180;
|
|
290
|
+
const GLOBE_STEPS = 8;
|
|
291
|
+
|
|
292
|
+
const GLOBE_RINGS: { lat: number; count: number }[] = [
|
|
293
|
+
{ lat: 52, count: 8 },
|
|
294
|
+
{ lat: 26, count: 8 },
|
|
295
|
+
{ lat: 0, count: 8 },
|
|
296
|
+
{ lat: -26, count: 8 },
|
|
297
|
+
{ lat: -52, count: 8 },
|
|
298
|
+
];
|
|
299
|
+
|
|
300
|
+
interface GlobeDot {
|
|
301
|
+
key: number;
|
|
302
|
+
style: Record<string, string>;
|
|
303
|
+
css: string;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function projectGlobe(x: number, y: number, z: number, spin: number) {
|
|
307
|
+
const cs = Math.cos(spin);
|
|
308
|
+
const ss = Math.sin(spin);
|
|
309
|
+
const x1 = x * cs - z * ss;
|
|
310
|
+
const z1 = x * ss + z * cs;
|
|
311
|
+
const y1 = y;
|
|
312
|
+
const ct = Math.cos(GLOBE_TILT);
|
|
313
|
+
const st = Math.sin(GLOBE_TILT);
|
|
314
|
+
return {
|
|
315
|
+
x: x1,
|
|
316
|
+
y: y1 * ct - z1 * st,
|
|
317
|
+
z: y1 * st + z1 * ct,
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function globeOpacity(z: number) {
|
|
322
|
+
const t = Math.max(0, Math.min(1, (z / GLOBE_R + 0.15) / 1.15));
|
|
323
|
+
return 0.12 + 0.88 * t * t;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
type RingMove = { ring: number; angle: number };
|
|
327
|
+
const RING_HALF = Math.PI;
|
|
328
|
+
const RING_ARC = 3;
|
|
329
|
+
|
|
330
|
+
function ringDir(ring: number) {
|
|
331
|
+
return ring % 2 === 0 ? -1 : 1;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
const G3_MOVES: RingMove[] = (() => {
|
|
335
|
+
const moves: RingMove[] = [];
|
|
336
|
+
for (let pass = 0; pass < 2; pass++) {
|
|
337
|
+
for (let r = 0; r < GLOBE_RINGS.length; r++) {
|
|
338
|
+
moves.push({ ring: r, angle: ringDir(r) * RING_HALF });
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
return moves;
|
|
342
|
+
})();
|
|
343
|
+
|
|
344
|
+
const G4_MOVES: RingMove[] = [2, 1, 3, 0, 4, 2, 1, 3, 0, 4].map((ring) => ({
|
|
345
|
+
ring,
|
|
346
|
+
angle: ringDir(ring) * RING_HALF,
|
|
347
|
+
}));
|
|
348
|
+
|
|
349
|
+
function ringTurnPoses(
|
|
350
|
+
x0: number,
|
|
351
|
+
y0: number,
|
|
352
|
+
z0: number,
|
|
353
|
+
ringIndex: number,
|
|
354
|
+
moves: RingMove[],
|
|
355
|
+
): [number, number, number][] {
|
|
356
|
+
let x = x0;
|
|
357
|
+
let y = y0;
|
|
358
|
+
let z = z0;
|
|
359
|
+
const poses: [number, number, number][] = [[x, y, z]];
|
|
360
|
+
for (let m = 0; m < moves.length; m++) {
|
|
361
|
+
const move = moves[m];
|
|
362
|
+
const xS = x;
|
|
363
|
+
const yS = y;
|
|
364
|
+
const zS = z;
|
|
365
|
+
for (let s = 1; s <= RING_ARC; s++) {
|
|
366
|
+
if (ringIndex === move.ring) {
|
|
367
|
+
const a = move.angle * (s / RING_ARC);
|
|
368
|
+
const c = Math.cos(a);
|
|
369
|
+
const sn = Math.sin(a);
|
|
370
|
+
x = xS * c - zS * sn;
|
|
371
|
+
y = yS;
|
|
372
|
+
z = xS * sn + zS * c;
|
|
373
|
+
}
|
|
374
|
+
poses.push([x, y, z]);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
return poses;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
const G5_SLOW = 0.4;
|
|
381
|
+
const G5_BURST = (Math.PI * 2 - G5_SLOW * 4) / 4;
|
|
382
|
+
const G5_POSES: { s: number; spin: number }[] = (() => {
|
|
383
|
+
const poses: { s: number; spin: number }[] = [{ s: 1.0, spin: 0 }];
|
|
384
|
+
let spin = 0;
|
|
385
|
+
const steps: { s: number; kind: "slow" | "burst" }[] = [
|
|
386
|
+
{ s: 1.0, kind: "slow" },
|
|
387
|
+
{ s: 0.9, kind: "burst" },
|
|
388
|
+
{ s: 0.9, kind: "slow" },
|
|
389
|
+
{ s: 0.8, kind: "burst" },
|
|
390
|
+
{ s: 0.8, kind: "slow" },
|
|
391
|
+
{ s: 0.9, kind: "burst" },
|
|
392
|
+
{ s: 0.9, kind: "slow" },
|
|
393
|
+
{ s: 1.0, kind: "burst" },
|
|
394
|
+
];
|
|
395
|
+
for (const step of steps) {
|
|
396
|
+
spin += step.kind === "slow" ? G5_SLOW : G5_BURST;
|
|
397
|
+
poses.push({ s: step.s, spin });
|
|
398
|
+
}
|
|
399
|
+
return poses;
|
|
400
|
+
})();
|
|
401
|
+
|
|
402
|
+
function globeKeyframeStyle(
|
|
403
|
+
x0: number,
|
|
404
|
+
y0: number,
|
|
405
|
+
z0: number,
|
|
406
|
+
variant: HelixVariant,
|
|
407
|
+
ringIndex: number,
|
|
408
|
+
j = 0,
|
|
409
|
+
): Record<string, string> {
|
|
410
|
+
const style: Record<string, string> = {};
|
|
411
|
+
|
|
412
|
+
if (variant === "G5") {
|
|
413
|
+
for (let k = 0; k < G5_POSES.length; k++) {
|
|
414
|
+
const sc = G5_POSES[k].s;
|
|
415
|
+
const spin = G5_POSES[k].spin;
|
|
416
|
+
const p = projectGlobe(x0 * sc, y0 * sc, z0 * sc, spin);
|
|
417
|
+
style["--g" + k + "x"] = p.x.toFixed(2) + "px";
|
|
418
|
+
style["--g" + k + "y"] = (-p.y).toFixed(2) + "px";
|
|
419
|
+
style["--g" + k + "o"] = globeOpacity(p.z).toFixed(3);
|
|
420
|
+
}
|
|
421
|
+
return style;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
if (variant === "G3" || variant === "G4") {
|
|
425
|
+
const poses = ringTurnPoses(
|
|
426
|
+
x0,
|
|
427
|
+
y0,
|
|
428
|
+
z0,
|
|
429
|
+
ringIndex,
|
|
430
|
+
variant === "G3" ? G3_MOVES : G4_MOVES,
|
|
431
|
+
);
|
|
432
|
+
for (let k = 0; k < poses.length; k++) {
|
|
433
|
+
const pos = poses[k];
|
|
434
|
+
const p = projectGlobe(pos[0], pos[1], pos[2], 0);
|
|
435
|
+
style["--g" + k + "x"] = p.x.toFixed(2) + "px";
|
|
436
|
+
style["--g" + k + "y"] = (-p.y).toFixed(2) + "px";
|
|
437
|
+
style["--g" + k + "o"] = globeOpacity(p.z).toFixed(3);
|
|
438
|
+
}
|
|
439
|
+
return style;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
const dir = variant === "G2" && ringIndex % 2 === 1 ? -1 : 1;
|
|
443
|
+
|
|
444
|
+
for (let k = 0; k < GLOBE_STEPS; k++) {
|
|
445
|
+
const phase = k / GLOBE_STEPS;
|
|
446
|
+
const spin = dir * phase * Math.PI * 2;
|
|
447
|
+
const p = projectGlobe(x0, y0, z0, spin);
|
|
448
|
+
style["--g" + k + "x"] = p.x.toFixed(2) + "px";
|
|
449
|
+
style["--g" + k + "y"] = (-p.y).toFixed(2) + "px";
|
|
450
|
+
style["--g" + k + "o"] = globeOpacity(p.z).toFixed(3);
|
|
451
|
+
}
|
|
452
|
+
return style;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
function globeDots(v: HelixVariant): GlobeDot[] {
|
|
456
|
+
const dots: GlobeDot[] = [];
|
|
457
|
+
let idx = 0;
|
|
458
|
+
for (let ringIndex = 0; ringIndex < GLOBE_RINGS.length; ringIndex++) {
|
|
459
|
+
const ring = GLOBE_RINGS[ringIndex];
|
|
460
|
+
const latRad = (ring.lat * Math.PI) / 180;
|
|
461
|
+
const y0 = Math.sin(latRad) * GLOBE_R;
|
|
462
|
+
const ringR = Math.cos(latRad) * GLOBE_R;
|
|
463
|
+
for (let j = 0; j < ring.count; j++) {
|
|
464
|
+
const lon = (j / ring.count) * Math.PI * 2;
|
|
465
|
+
const style = globeKeyframeStyle(
|
|
466
|
+
Math.cos(lon) * ringR,
|
|
467
|
+
y0,
|
|
468
|
+
Math.sin(lon) * ringR,
|
|
469
|
+
v,
|
|
470
|
+
ringIndex,
|
|
471
|
+
j,
|
|
472
|
+
);
|
|
473
|
+
dots.push({
|
|
474
|
+
key: idx,
|
|
475
|
+
style,
|
|
476
|
+
css: Object.keys(style)
|
|
477
|
+
.map((k) => k + ":" + style[k])
|
|
478
|
+
.join(";"),
|
|
479
|
+
});
|
|
480
|
+
idx++;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
return dots;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
const MORPH_N = 8;
|
|
487
|
+
const MORPH_R = 7;
|
|
488
|
+
|
|
489
|
+
type ShapeFn = (i: number) => [number, number];
|
|
490
|
+
|
|
491
|
+
const shapeCircle: ShapeFn = (i) => {
|
|
492
|
+
const a = (i / MORPH_N) * Math.PI * 2 - Math.PI / 2;
|
|
493
|
+
return [Math.cos(a) * MORPH_R, Math.sin(a) * MORPH_R];
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
const shapeOctagon: ShapeFn = (i) => {
|
|
497
|
+
const a = (i / MORPH_N) * Math.PI * 2 - Math.PI / 2;
|
|
498
|
+
const r = MORPH_R * 0.92;
|
|
499
|
+
const sector = Math.round(a / (Math.PI / 4)) * (Math.PI / 4);
|
|
500
|
+
return [Math.cos(sector) * r, Math.sin(sector) * r];
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
const shapeSquare: ShapeFn = (i) => {
|
|
504
|
+
const h = MORPH_R * 0.85;
|
|
505
|
+
const corners: [number, number][] = [
|
|
506
|
+
[-h, -h],
|
|
507
|
+
[h, -h],
|
|
508
|
+
[h, h],
|
|
509
|
+
[-h, h],
|
|
510
|
+
];
|
|
511
|
+
const t = ((i / MORPH_N) * 4 + 0.5) % 4;
|
|
512
|
+
const side = Math.floor(t) % 4;
|
|
513
|
+
const frac = t - Math.floor(t);
|
|
514
|
+
const from = corners[side];
|
|
515
|
+
const to = corners[(side + 1) % 4];
|
|
516
|
+
return [
|
|
517
|
+
from[0] + (to[0] - from[0]) * frac,
|
|
518
|
+
from[1] + (to[1] - from[1]) * frac,
|
|
519
|
+
];
|
|
520
|
+
};
|
|
521
|
+
|
|
522
|
+
const shapeCircleAt =
|
|
523
|
+
(turn: number): ShapeFn =>
|
|
524
|
+
(i) => {
|
|
525
|
+
const a = (i / MORPH_N) * Math.PI * 2 - Math.PI / 2 + turn;
|
|
526
|
+
return [Math.cos(a) * MORPH_R, Math.sin(a) * MORPH_R];
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
const SCATTER_TRAIL = 0.12;
|
|
530
|
+
|
|
531
|
+
const shapeScatterA: ShapeFn = (i) => {
|
|
532
|
+
const a = (i / MORPH_N) * Math.PI * 2 - Math.PI / 2;
|
|
533
|
+
return [-Math.cos(a) * MORPH_R, Math.sin(a) * MORPH_R];
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
const shapeScatterB: ShapeFn = shapeCircle;
|
|
537
|
+
const shapeScatterC: ShapeFn = shapeScatterA;
|
|
538
|
+
|
|
539
|
+
const shapeDiamond: ShapeFn = (i) => {
|
|
540
|
+
const corners: [number, number][] = [
|
|
541
|
+
[0, -MORPH_R],
|
|
542
|
+
[MORPH_R, 0],
|
|
543
|
+
[0, MORPH_R],
|
|
544
|
+
[-MORPH_R, 0],
|
|
545
|
+
];
|
|
546
|
+
const t = (i / MORPH_N) * 4;
|
|
547
|
+
const side = Math.floor(t) % 4;
|
|
548
|
+
const frac = t - Math.floor(t);
|
|
549
|
+
const from = corners[side];
|
|
550
|
+
const to = corners[(side + 1) % 4];
|
|
551
|
+
return [
|
|
552
|
+
from[0] + (to[0] - from[0]) * frac,
|
|
553
|
+
from[1] + (to[1] - from[1]) * frac,
|
|
554
|
+
];
|
|
555
|
+
};
|
|
556
|
+
|
|
557
|
+
const shapeCenter: ShapeFn = (i) => {
|
|
558
|
+
const a = (i / MORPH_N) * Math.PI * 2 - Math.PI / 2;
|
|
559
|
+
return [Math.cos(a) * 1.5, Math.sin(a) * 1.5];
|
|
560
|
+
};
|
|
561
|
+
|
|
562
|
+
function morphShapes(v: MorphVariant): [ShapeFn, ShapeFn, ShapeFn, ShapeFn] {
|
|
563
|
+
switch (v) {
|
|
564
|
+
case "M1":
|
|
565
|
+
return [shapeCircle, shapeSquare, shapeDiamond, shapeSquare];
|
|
566
|
+
case "M2":
|
|
567
|
+
return [shapeCenter, shapeCircle, shapeCenter, shapeCircle];
|
|
568
|
+
case "M3":
|
|
569
|
+
return [
|
|
570
|
+
shapeCircleAt(0),
|
|
571
|
+
shapeCircleAt(Math.PI / 2),
|
|
572
|
+
shapeCircleAt(Math.PI),
|
|
573
|
+
shapeCircleAt(Math.PI * 1.5),
|
|
574
|
+
];
|
|
575
|
+
case "M4":
|
|
576
|
+
return [shapeCircle, shapeDiamond, shapeCircle, shapeDiamond];
|
|
577
|
+
case "M5":
|
|
578
|
+
return [shapeCircle, shapeScatterA, shapeScatterB, shapeScatterC];
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
interface MorphDot {
|
|
583
|
+
key: number;
|
|
584
|
+
m1: string;
|
|
585
|
+
m2: string;
|
|
586
|
+
m3: string;
|
|
587
|
+
m4: string;
|
|
588
|
+
delay?: string;
|
|
589
|
+
depth?: string;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
function morphDots(v: MorphVariant): MorphDot[] {
|
|
593
|
+
const [s1, s2, s3, s4] = morphShapes(v);
|
|
594
|
+
const dots: MorphDot[] = [];
|
|
595
|
+
for (let i = 0; i < MORPH_N; i++) {
|
|
596
|
+
const [x1, y1] = s1(i);
|
|
597
|
+
const [x2, y2] = s2(i);
|
|
598
|
+
const [x3, y3] = s3(i);
|
|
599
|
+
const [x4, y4] = s4(i);
|
|
600
|
+
dots.push({
|
|
601
|
+
key: i,
|
|
602
|
+
m1: x1.toFixed(1) + "px, " + y1.toFixed(1) + "px",
|
|
603
|
+
m2: x2.toFixed(1) + "px, " + y2.toFixed(1) + "px",
|
|
604
|
+
m3: x3.toFixed(1) + "px, " + y3.toFixed(1) + "px",
|
|
605
|
+
m4: x4.toFixed(1) + "px, " + y4.toFixed(1) + "px",
|
|
606
|
+
delay: v === "M5" ? -i * 10 + "ms" : undefined,
|
|
607
|
+
depth:
|
|
608
|
+
v === "M5"
|
|
609
|
+
? Math.abs(
|
|
610
|
+
Math.cos((i / MORPH_N) * Math.PI * 2 - Math.PI / 2),
|
|
611
|
+
).toFixed(2)
|
|
612
|
+
: undefined,
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
return dots;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
export interface OrbProps {
|
|
619
|
+
variant?: OrbVariant;
|
|
620
|
+
/** Rendered edge length in px. The 28px geometry scales to fit. */
|
|
621
|
+
size?: number;
|
|
622
|
+
/** Accessible label, and the status text when `pill` is set. */
|
|
623
|
+
label?: string;
|
|
624
|
+
/** Wraps the orb and its label in a status pill. */
|
|
625
|
+
pill?: boolean;
|
|
626
|
+
className?: string;
|
|
627
|
+
style?: CSSProperties;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
export function Orb({
|
|
631
|
+
variant = "S1",
|
|
632
|
+
size = SIZE,
|
|
633
|
+
label,
|
|
634
|
+
pill,
|
|
635
|
+
className,
|
|
636
|
+
style,
|
|
637
|
+
}: OrbProps) {
|
|
638
|
+
const messages = useUiMessages();
|
|
639
|
+
const text = label ?? `${messages.loading}…`;
|
|
640
|
+
return (
|
|
641
|
+
<span
|
|
642
|
+
className={"orb-root" + (className ? " " + className : "")}
|
|
643
|
+
data-pill={pill ? "" : undefined}
|
|
644
|
+
style={style}
|
|
645
|
+
>
|
|
646
|
+
<span
|
|
647
|
+
className={"orb-glyph"}
|
|
648
|
+
// In pill form the visible label already carries the meaning, so
|
|
649
|
+
// the glyph steps out of the accessibility tree.
|
|
650
|
+
role={pill ? undefined : "img"}
|
|
651
|
+
aria-label={pill ? undefined : text}
|
|
652
|
+
aria-hidden={pill ? true : undefined}
|
|
653
|
+
style={
|
|
654
|
+
{
|
|
655
|
+
width: size,
|
|
656
|
+
height: size,
|
|
657
|
+
"--orb-k": size / STAGE,
|
|
658
|
+
} as CSSProperties
|
|
659
|
+
}
|
|
660
|
+
>
|
|
661
|
+
{isLattice(variant) ? (
|
|
662
|
+
<span className={"orb-lattice"} data-variant={variant}>
|
|
663
|
+
{latticeCells(variant).map((c) => (
|
|
664
|
+
<span
|
|
665
|
+
key={c.key}
|
|
666
|
+
className={"orb-cell"}
|
|
667
|
+
data-still={c.still ? "" : undefined}
|
|
668
|
+
data-mid={c.mid ? "" : undefined}
|
|
669
|
+
style={
|
|
670
|
+
{
|
|
671
|
+
left: c.left,
|
|
672
|
+
top: c.top,
|
|
673
|
+
animationDelay: c.delay + "ms",
|
|
674
|
+
"--orb-ax": c.ax + "px",
|
|
675
|
+
"--orb-ay": c.ay + "px",
|
|
676
|
+
"--orb-bx": c.bx + "px",
|
|
677
|
+
"--orb-by": c.by + "px",
|
|
678
|
+
} as CSSProperties
|
|
679
|
+
}
|
|
680
|
+
/>
|
|
681
|
+
))}
|
|
682
|
+
</span>
|
|
683
|
+
) : isRing(variant) ? (
|
|
684
|
+
<span className={"orb-ring"} data-variant={variant}>
|
|
685
|
+
{ringDots(variant).map((d) => (
|
|
686
|
+
<span
|
|
687
|
+
key={d.key}
|
|
688
|
+
className={"orb-ring-dot"}
|
|
689
|
+
style={
|
|
690
|
+
{
|
|
691
|
+
"--orb-rx": d.rx + "px",
|
|
692
|
+
"--orb-ry": d.ry + "px",
|
|
693
|
+
animationDelay: d.delay + "ms",
|
|
694
|
+
} as CSSProperties
|
|
695
|
+
}
|
|
696
|
+
/>
|
|
697
|
+
))}
|
|
698
|
+
</span>
|
|
699
|
+
) : isHelix(variant) ? (
|
|
700
|
+
<span className={"orb-helix"} data-variant={variant}>
|
|
701
|
+
{globeDots(variant).map((d) => (
|
|
702
|
+
<span
|
|
703
|
+
key={d.key}
|
|
704
|
+
className={"orb-helix-dot"}
|
|
705
|
+
style={d.style as CSSProperties}
|
|
706
|
+
/>
|
|
707
|
+
))}
|
|
708
|
+
</span>
|
|
709
|
+
) : isMorph(variant) ? (
|
|
710
|
+
<span className={"orb-morph"} data-variant={variant}>
|
|
711
|
+
{morphDots(variant).map((d) => (
|
|
712
|
+
<span
|
|
713
|
+
key={d.key}
|
|
714
|
+
className={"orb-morph-dot"}
|
|
715
|
+
style={
|
|
716
|
+
{
|
|
717
|
+
"--m-1": d.m1,
|
|
718
|
+
"--m-2": d.m2,
|
|
719
|
+
"--m-3": d.m3,
|
|
720
|
+
"--m-4": d.m4,
|
|
721
|
+
"--m-depth": d.depth,
|
|
722
|
+
animationDelay: d.delay,
|
|
723
|
+
} as CSSProperties
|
|
724
|
+
}
|
|
725
|
+
/>
|
|
726
|
+
))}
|
|
727
|
+
</span>
|
|
728
|
+
) : (
|
|
729
|
+
<span className={"orb-lens"} data-variant={variant}>
|
|
730
|
+
<span className={"orb-shape" + " " + "orb-shape-a"} />
|
|
731
|
+
<span className={"orb-shape" + " " + "orb-shape-b"} />
|
|
732
|
+
<span className={"orb-shape" + " " + "orb-shape-c"} />
|
|
733
|
+
{/* focus is the one variant that needs a fourth circle: its cast
|
|
734
|
+
sits on the corners of a square, and three corners do not
|
|
735
|
+
make a square. */}
|
|
736
|
+
{variant === "B1" && (
|
|
737
|
+
<span className={"orb-shape" + " " + "orb-shape-d"} />
|
|
738
|
+
)}
|
|
739
|
+
</span>
|
|
740
|
+
)}
|
|
741
|
+
</span>
|
|
742
|
+
{pill && <span className={"orb-pill-label"}>{text}</span>}
|
|
743
|
+
</span>
|
|
744
|
+
);
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
/* Usage:
|
|
748
|
+
<Orb variant="S4" />
|
|
749
|
+
<Orb variant="B4" size={40} />
|
|
750
|
+
<Orb variant="C3" />
|
|
751
|
+
<Orb variant="B2" label="Searching the web…" pill />
|
|
752
|
+
*/
|