@intlayer/design-system 5.7.6-canary.0 → 5.7.7
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/README.md +3 -0
- package/dist/.vite/manifest.json +8 -0
- package/dist/Form-CriPBaZk.js.map +1 -1
- package/dist/Form-DJrUK3mm.cjs.map +1 -1
- package/dist/better-auth.8zoxzg-F-BEBqzpjz.cjs.map +1 -1
- package/dist/better-auth.8zoxzg-F-D8e0X4ys.js.map +1 -1
- package/dist/components/Accordion/Accordion.cjs.map +1 -1
- package/dist/components/Accordion/Accordion.mjs.map +1 -1
- package/dist/components/Avatar/index.cjs.map +1 -1
- package/dist/components/Avatar/index.mjs.map +1 -1
- package/dist/components/Badge/index.cjs.map +1 -1
- package/dist/components/Badge/index.mjs.map +1 -1
- package/dist/components/Breadcrumb/breadcrumb.content.cjs.map +1 -1
- package/dist/components/Breadcrumb/breadcrumb.content.mjs.map +1 -1
- package/dist/components/Breadcrumb/index.cjs.map +1 -1
- package/dist/components/Breadcrumb/index.mjs.map +1 -1
- package/dist/components/Button/Button.cjs.map +1 -1
- package/dist/components/Button/Button.mjs.map +1 -1
- package/dist/components/ClickOutsideDiv/index.cjs.map +1 -1
- package/dist/components/ClickOutsideDiv/index.mjs.map +1 -1
- package/dist/components/Command/index.cjs.map +1 -1
- package/dist/components/Command/index.mjs.map +1 -1
- package/dist/components/Container/index.cjs.map +1 -1
- package/dist/components/Container/index.mjs.map +1 -1
- package/dist/components/ContentEditor/ContentEditor.cjs.map +1 -1
- package/dist/components/ContentEditor/ContentEditor.mjs.map +1 -1
- package/dist/components/ContentEditor/ContentEditorInput.cjs.map +1 -1
- package/dist/components/ContentEditor/ContentEditorInput.mjs.map +1 -1
- package/dist/components/ContentEditor/ContentEditorTextArea.cjs.map +1 -1
- package/dist/components/ContentEditor/ContentEditorTextArea.mjs.map +1 -1
- package/dist/components/ContentSelector/ContentSelector.cjs.map +1 -1
- package/dist/components/CopyButton/index.cjs.map +1 -1
- package/dist/components/CopyButton/index.mjs.map +1 -1
- package/dist/components/CopyToClipboard/index.cjs.map +1 -1
- package/dist/components/CopyToClipboard/index.mjs.map +1 -1
- package/dist/components/DictionaryEditor/DictionaryEditor.cjs.map +1 -1
- package/dist/components/DictionaryEditor/DictionaryEditor.mjs.map +1 -1
- package/dist/components/DictionaryEditor/ItemLayout.cjs.map +1 -1
- package/dist/components/DictionaryEditor/ItemLayout.mjs.map +1 -1
- package/dist/components/DictionaryEditor/NodeWrapper/FileWrapper.cjs.map +1 -1
- package/dist/components/DictionaryEditor/NodeWrapper/FileWrapper.mjs.map +1 -1
- package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.cjs.map +1 -1
- package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EnumKeyInput.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EnumKeyInput.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/JSONEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/JSONEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/KeyPathBreadcrumb.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/KeyPathBreadcrumb.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/structureView.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/structureView.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/dictionaryFieldEditor.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/dictionaryFieldEditor.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/getIsEditableSection.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/getIsEditableSection.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/nodeTypeSelector.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/nodeTypeSelector.content.mjs.map +1 -1
- package/dist/components/DropDown/index.cjs.map +1 -1
- package/dist/components/DropDown/index.mjs.map +1 -1
- package/dist/components/EditableField/EditableFieldInput.cjs.map +1 -1
- package/dist/components/EditableField/EditableFieldInput.mjs.map +1 -1
- package/dist/components/EditableField/EditableFieldLayout.cjs.map +1 -1
- package/dist/components/EditableField/EditableFieldLayout.mjs.map +1 -1
- package/dist/components/EditableField/EditableFieldTextArea.cjs.map +1 -1
- package/dist/components/EditableField/EditableFieldTextArea.mjs.map +1 -1
- package/dist/components/Flags/Flag.cjs.map +1 -1
- package/dist/components/Flags/Flag.mjs.map +1 -1
- package/dist/components/Footer/index.cjs +1 -1
- package/dist/components/Footer/index.cjs.map +1 -1
- package/dist/components/Footer/index.mjs +1 -1
- package/dist/components/Footer/index.mjs.map +1 -1
- package/dist/components/Form/FormBase.cjs.map +1 -1
- package/dist/components/Form/FormBase.mjs.map +1 -1
- package/dist/components/Form/FormControl.cjs.map +1 -1
- package/dist/components/Form/FormControl.mjs.map +1 -1
- package/dist/components/Form/FormDescription.cjs.map +1 -1
- package/dist/components/Form/FormDescription.mjs.map +1 -1
- package/dist/components/Form/FormField.cjs.map +1 -1
- package/dist/components/Form/FormField.mjs.map +1 -1
- package/dist/components/Form/FormItem.cjs.map +1 -1
- package/dist/components/Form/FormItem.mjs.map +1 -1
- package/dist/components/Form/FormLabel.cjs.map +1 -1
- package/dist/components/Form/FormLabel.mjs.map +1 -1
- package/dist/components/Form/FormMessage.cjs.map +1 -1
- package/dist/components/Form/FormMessage.mjs.map +1 -1
- package/dist/components/Form/elements/FormElementWrapper.cjs.map +1 -1
- package/dist/components/Form/elements/FormElementWrapper.mjs.map +1 -1
- package/dist/components/Form/layout/FormLabelLayout.cjs.map +1 -1
- package/dist/components/Form/layout/FormLabelLayout.mjs.map +1 -1
- package/dist/components/Form/layout/RequiredStar.cjs.map +1 -1
- package/dist/components/Form/layout/RequiredStar.mjs.map +1 -1
- package/dist/components/Headers/SectionScroller.cjs.map +1 -1
- package/dist/components/Headers/SectionScroller.mjs.map +1 -1
- package/dist/components/Headers/index.cjs.map +1 -1
- package/dist/components/Headers/index.mjs.map +1 -1
- package/dist/components/HeightResizer/index.cjs.map +1 -1
- package/dist/components/HeightResizer/index.mjs.map +1 -1
- package/dist/components/IDE/Code.cjs.map +1 -1
- package/dist/components/IDE/Code.mjs.map +1 -1
- package/dist/components/IDE/CodeBlockClient.cjs.map +1 -1
- package/dist/components/IDE/CodeBlockClient.mjs.map +1 -1
- package/dist/components/IDE/CodeBlockServer.cjs.map +1 -1
- package/dist/components/IDE/CodeBlockServer.mjs.map +1 -1
- package/dist/components/IDE/CodeConditionalRenderer.cjs.map +1 -1
- package/dist/components/IDE/CodeConditionalRenderer.mjs.map +1 -1
- package/dist/components/IDE/CodeContext.cjs.map +1 -1
- package/dist/components/IDE/CodeContext.mjs.map +1 -1
- package/dist/components/IDE/CodeFormatSelector.cjs.map +1 -1
- package/dist/components/IDE/CodeFormatSelector.mjs.map +1 -1
- package/dist/components/IDE/ContentDeclarationFormatSelector.cjs.map +1 -1
- package/dist/components/IDE/ContentDeclarationFormatSelector.mjs.map +1 -1
- package/dist/components/IDE/CopyButton.content.cjs.map +1 -1
- package/dist/components/IDE/CopyButton.content.mjs.map +1 -1
- package/dist/components/IDE/CopyCode.cjs.map +1 -1
- package/dist/components/IDE/CopyCode.mjs.map +1 -1
- package/dist/components/IDE/FileList.cjs.map +1 -1
- package/dist/components/IDE/FileList.mjs.map +1 -1
- package/dist/components/IDE/FileTree.cjs.map +1 -1
- package/dist/components/IDE/FileTree.mjs.map +1 -1
- package/dist/components/IDE/IDE.cjs.map +1 -1
- package/dist/components/IDE/IDE.mjs.map +1 -1
- package/dist/components/IDE/MarkDownRender.cjs.map +1 -1
- package/dist/components/IDE/MarkDownRender.mjs.map +1 -1
- package/dist/components/IDE/MonacoCode.cjs.map +1 -1
- package/dist/components/IDE/MonacoCode.mjs.map +1 -1
- package/dist/components/IDE/PackageManagerSelector.cjs.map +1 -1
- package/dist/components/IDE/PackageManagerSelector.mjs.map +1 -1
- package/dist/components/IDE/code.content.cjs.map +1 -1
- package/dist/components/IDE/code.content.mjs.map +1 -1
- package/dist/components/IDE/copyCode.content.cjs.map +1 -1
- package/dist/components/IDE/copyCode.content.mjs.map +1 -1
- package/dist/components/IDE/createFileTree.cjs.map +1 -1
- package/dist/components/IDE/createFileTree.mjs.map +1 -1
- package/dist/components/InformationTag/index.cjs.map +1 -1
- package/dist/components/InformationTag/index.mjs.map +1 -1
- package/dist/components/Input/Checkbox.cjs.map +1 -1
- package/dist/components/Input/Checkbox.mjs.map +1 -1
- package/dist/components/Input/Input.cjs.map +1 -1
- package/dist/components/Input/Input.mjs.map +1 -1
- package/dist/components/Input/InputPassword.cjs.map +1 -1
- package/dist/components/Input/InputPassword.mjs.map +1 -1
- package/dist/components/KeyboardScreenAdapter/index.cjs.map +1 -1
- package/dist/components/KeyboardScreenAdapter/index.mjs.map +1 -1
- package/dist/components/Label/index.cjs.map +1 -1
- package/dist/components/Link/Link.cjs.map +1 -1
- package/dist/components/Link/Link.mjs.map +1 -1
- package/dist/components/Loader/index.cjs.map +1 -1
- package/dist/components/Loader/index.content.cjs.map +1 -1
- package/dist/components/Loader/index.content.mjs.map +1 -1
- package/dist/components/Loader/index.mjs.map +1 -1
- package/dist/components/Loader/spinner.cjs.map +1 -1
- package/dist/components/Loader/spinner.mjs.map +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.cjs.map +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs.map +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.cjs.map +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs.map +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.cjs.map +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.mjs.map +1 -1
- package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.cjs.map +1 -1
- package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.mjs.map +1 -1
- package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.cjs.map +1 -1
- package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.mjs.map +1 -1
- package/dist/components/Logo/Logo.cjs.map +1 -1
- package/dist/components/Logo/Logo.mjs.map +1 -1
- package/dist/components/Logo/LogoTextOnly.cjs.map +1 -1
- package/dist/components/Logo/LogoTextOnly.mjs.map +1 -1
- package/dist/components/Logo/LogoWithText.cjs.map +1 -1
- package/dist/components/Logo/LogoWithText.mjs.map +1 -1
- package/dist/components/Logo/LogoWithTextBelow.cjs.map +1 -1
- package/dist/components/Logo/LogoWithTextBelow.mjs.map +1 -1
- package/dist/components/MarkDownRender/index.cjs.map +1 -1
- package/dist/components/MarkDownRender/index.mjs.map +1 -1
- package/dist/components/MaxHeightSmoother/index.cjs.map +1 -1
- package/dist/components/MaxHeightSmoother/index.mjs.map +1 -1
- package/dist/components/MaxWidthSmoother/index.cjs.map +1 -1
- package/dist/components/MaxWidthSmoother/index.mjs.map +1 -1
- package/dist/components/Modal/Modal.cjs.map +1 -1
- package/dist/components/Modal/Modal.mjs.map +1 -1
- package/dist/components/Navbar/Burger.cjs.map +1 -1
- package/dist/components/Navbar/Burger.mjs.map +1 -1
- package/dist/components/Navbar/DesktopNavbar.cjs.map +1 -1
- package/dist/components/Navbar/DesktopNavbar.mjs.map +1 -1
- package/dist/components/Navbar/MobileNavbar.cjs.map +1 -1
- package/dist/components/Navbar/MobileNavbar.mjs.map +1 -1
- package/dist/components/Navbar/index.cjs.map +1 -1
- package/dist/components/Navbar/index.mjs.map +1 -1
- package/dist/components/Navbar/useNavigation.cjs.map +1 -1
- package/dist/components/Navbar/useNavigation.mjs.map +1 -1
- package/dist/components/Pattern/DotPattern.cjs.map +1 -1
- package/dist/components/Pattern/DotPattern.mjs.map +1 -1
- package/dist/components/Pattern/GridPattern.cjs.map +1 -1
- package/dist/components/Pattern/GridPattern.mjs.map +1 -1
- package/dist/components/Pattern/SpotLight.cjs.map +1 -1
- package/dist/components/Pattern/SpotLight.mjs.map +1 -1
- package/dist/components/Popover/index.cjs.map +1 -1
- package/dist/components/Popover/index.mjs.map +1 -1
- package/dist/components/PressableSpan/PressableSpan.cjs.map +1 -1
- package/dist/components/PressableSpan/PressableSpan.mjs.map +1 -1
- package/dist/components/RightDrawer/RightDrawer.cjs.map +1 -1
- package/dist/components/RightDrawer/RightDrawer.mjs.map +1 -1
- package/dist/components/RightDrawer/isElementAtTopAndNotCovered.cjs.map +1 -1
- package/dist/components/RightDrawer/isElementAtTopAndNotCovered.mjs.map +1 -1
- package/dist/components/RightDrawer/useRightDrawerStore.cjs.map +1 -1
- package/dist/components/RightDrawer/useRightDrawerStore.mjs.map +1 -1
- package/dist/components/Select/Multiselect.cjs.map +1 -1
- package/dist/components/Select/Multiselect.mjs.map +1 -1
- package/dist/components/Select/Select.cjs.map +1 -1
- package/dist/components/Select/Select.mjs.map +1 -1
- package/dist/components/SocialNetworks/DiscordLogo.cjs +23 -0
- package/dist/components/SocialNetworks/DiscordLogo.cjs.map +1 -0
- package/dist/components/SocialNetworks/DiscordLogo.d.ts +3 -0
- package/dist/components/SocialNetworks/DiscordLogo.d.ts.map +1 -0
- package/dist/components/SocialNetworks/DiscordLogo.mjs +23 -0
- package/dist/components/SocialNetworks/DiscordLogo.mjs.map +1 -0
- package/dist/components/SocialNetworks/FacebookLogo.cjs.map +1 -1
- package/dist/components/SocialNetworks/FacebookLogo.mjs.map +1 -1
- package/dist/components/SocialNetworks/InstagramLogo.cjs.map +1 -1
- package/dist/components/SocialNetworks/InstagramLogo.mjs.map +1 -1
- package/dist/components/SocialNetworks/LinkedInLogo.cjs.map +1 -1
- package/dist/components/SocialNetworks/LinkedInLogo.mjs.map +1 -1
- package/dist/components/SocialNetworks/ProductHuntLogo.cjs.map +1 -1
- package/dist/components/SocialNetworks/ProductHuntLogo.mjs.map +1 -1
- package/dist/components/SocialNetworks/TiktokLogo.cjs.map +1 -1
- package/dist/components/SocialNetworks/TiktokLogo.mjs.map +1 -1
- package/dist/components/SocialNetworks/XLogo.cjs.map +1 -1
- package/dist/components/SocialNetworks/XLogo.mjs.map +1 -1
- package/dist/components/SocialNetworks/YoutubeLogo.cjs.map +1 -1
- package/dist/components/SocialNetworks/YoutubeLogo.mjs.map +1 -1
- package/dist/components/SocialNetworks/index.cjs +7 -0
- package/dist/components/SocialNetworks/index.cjs.map +1 -1
- package/dist/components/SocialNetworks/index.d.ts +1 -0
- package/dist/components/SocialNetworks/index.d.ts.map +1 -1
- package/dist/components/SocialNetworks/index.mjs +7 -0
- package/dist/components/SocialNetworks/index.mjs.map +1 -1
- package/dist/components/SwitchSelector/index.cjs.map +1 -1
- package/dist/components/SwitchSelector/index.mjs.map +1 -1
- package/dist/components/TabSelector/TabSelector.cjs.map +1 -1
- package/dist/components/TabSelector/TabSelector.mjs.map +1 -1
- package/dist/components/Tag/index.cjs.map +1 -1
- package/dist/components/Tag/index.mjs.map +1 -1
- package/dist/components/TextArea/AutoSizeTextArea.cjs.map +1 -1
- package/dist/components/TextArea/AutoSizeTextArea.mjs.map +1 -1
- package/dist/components/TextArea/AutocompleteTextArea.cjs.map +1 -1
- package/dist/components/TextArea/AutocompleteTextArea.mjs.map +1 -1
- package/dist/components/TextArea/TextArea.cjs.map +1 -1
- package/dist/components/TextArea/TextArea.mjs.map +1 -1
- package/dist/components/ThemeSwitcherDropDown/DesktopThemeSwitcher.cjs.map +1 -1
- package/dist/components/ThemeSwitcherDropDown/DesktopThemeSwitcher.mjs.map +1 -1
- package/dist/components/ThemeSwitcherDropDown/MobileThemeSwitcher.cjs.map +1 -1
- package/dist/components/ThemeSwitcherDropDown/MobileThemeSwitcher.mjs.map +1 -1
- package/dist/components/ThemeSwitcherDropDown/types.cjs.map +1 -1
- package/dist/components/ThemeSwitcherDropDown/types.mjs.map +1 -1
- package/dist/components/Toaster/Toast.cjs.map +1 -1
- package/dist/components/Toaster/Toast.mjs.map +1 -1
- package/dist/components/Toaster/Toaster.cjs.map +1 -1
- package/dist/components/Toaster/Toaster.mjs.map +1 -1
- package/dist/components/Toaster/useToast.cjs.map +1 -1
- package/dist/components/Toaster/useToast.mjs.map +1 -1
- package/dist/components/WithResizer/index.cjs.map +1 -1
- package/dist/components/WithResizer/index.mjs.map +1 -1
- package/dist/components/index.cjs +2 -0
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.mjs +2 -0
- package/dist/components/index.mjs.map +1 -1
- package/dist/hooks/auth.cjs.map +1 -1
- package/dist/hooks/auth.mjs.map +1 -1
- package/dist/hooks/intlayerAPIHooks.cjs.map +1 -1
- package/dist/hooks/intlayerAPIHooks.mjs.map +1 -1
- package/dist/hooks/useAsync/useAsync.cjs.map +1 -1
- package/dist/hooks/useAsync/useAsync.mjs.map +1 -1
- package/dist/hooks/useAsync/useAsyncStateStore.cjs.map +1 -1
- package/dist/hooks/useAsync/useAsyncStateStore.mjs.map +1 -1
- package/dist/hooks/useAsync/useAsyncWrapper.cjs.map +1 -1
- package/dist/hooks/useAsync/useAsyncWrapper.mjs.map +1 -1
- package/dist/hooks/useAuth/useAuth.cjs.map +1 -1
- package/dist/hooks/useAuth/useAuth.mjs.map +1 -1
- package/dist/hooks/useAuth/useOAuth2.cjs.map +1 -1
- package/dist/hooks/useAuth/useOAuth2.mjs.map +1 -1
- package/dist/hooks/useAuth/useSession.cjs.map +1 -1
- package/dist/hooks/useAuth/useSession.mjs.map +1 -1
- package/dist/hooks/useDevice.cjs.map +1 -1
- package/dist/hooks/useDevice.mjs.map +1 -1
- package/dist/hooks/useGetAllDictionaries.cjs.map +1 -1
- package/dist/hooks/useGetAllDictionaries.mjs.map +1 -1
- package/dist/hooks/useGetElementOrWindow.cjs.map +1 -1
- package/dist/hooks/useGetElementOrWindow.mjs.map +1 -1
- package/dist/hooks/useIntlayerAPI.cjs.map +1 -1
- package/dist/hooks/useIntlayerAPI.mjs.map +1 -1
- package/dist/hooks/useIsDarkMode.cjs.map +1 -1
- package/dist/hooks/useIsDarkMode.mjs.map +1 -1
- package/dist/hooks/useIsMounted.cjs.map +1 -1
- package/dist/hooks/useIsMounted.mjs.map +1 -1
- package/dist/hooks/useItemSelector.cjs.map +1 -1
- package/dist/hooks/useItemSelector.mjs.map +1 -1
- package/dist/hooks/useKeyboardDetector.cjs.map +1 -1
- package/dist/hooks/useKeyboardDetector.mjs.map +1 -1
- package/dist/hooks/usePersistedStore.cjs.map +1 -1
- package/dist/hooks/usePersistedStore.mjs.map +1 -1
- package/dist/hooks/useScreenWidth.cjs.map +1 -1
- package/dist/hooks/useScreenWidth.mjs.map +1 -1
- package/dist/hooks/useScrollBlockage/useScrollBlockageStore.cjs.map +1 -1
- package/dist/hooks/useScrollBlockage/useScrollBlockageStore.mjs.map +1 -1
- package/dist/hooks/useScrollDetection.cjs.map +1 -1
- package/dist/hooks/useScrollDetection.mjs.map +1 -1
- package/dist/hooks/useUser/index.cjs.map +1 -1
- package/dist/hooks/useUser/index.mjs.map +1 -1
- package/dist/index-BCuMWKyy.js.map +1 -1
- package/dist/index-BYzBot7l.cjs.map +1 -1
- package/dist/index-DW4Wnns5.cjs.map +1 -1
- package/dist/index-aPP3MzPT.js.map +1 -1
- package/dist/parse-BJVwmz92.cjs.map +1 -1
- package/dist/parse-pnJgclyf.js.map +1 -1
- package/dist/schemas-BIuxHDyZ.js.map +1 -1
- package/dist/schemas-Q6C7ZNs3.cjs.map +1 -1
- package/dist/tailwind.config.cjs.map +1 -1
- package/dist/tailwind.config.mjs.map +1 -1
- package/dist/utils/camelCase.cjs.map +1 -1
- package/dist/utils/camelCase.mjs.map +1 -1
- package/dist/utils/capitalize.cjs.map +1 -1
- package/dist/utils/capitalize.mjs.map +1 -1
- package/dist/utils/object.cjs.map +1 -1
- package/dist/utils/object.mjs.map +1 -1
- package/dist/zod-D4WapgbL.js.map +1 -1
- package/dist/zod-K7y5gPX4.cjs.map +1 -1
- package/package.json +16 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAsyncStateStore.mjs","sources":["../../../src/hooks/useAsync/useAsyncStateStore.tsx"],"sourcesContent":["'use client';\n\nimport {\n type PropsWithChildren,\n createContext,\n useContext,\n useReducer,\n} from 'react';\n\n/**\n * Represents the states for a given key in the asynchronous state management.\n * This includes flags for loading, fetched, invalidation, and success/error status.\n * It also keeps track of the fetched datetime, retry counts, the data itself, and whether queries are enabled.\n */\ntype States<T> = {\n isLoading: boolean;\n isFetched: boolean;\n isInvalidated: boolean;\n fetchedDateTime: null | Date;\n error: string | null;\n isSuccess: boolean;\n data: T | null;\n errorCount: number;\n isEnabled: boolean;\n};\n\n/**\n * Holds a mapping from a key (string) to its associated state.\n */\ntype StateSlice<T> = {\n [key: string]: States<T>;\n};\n\n/**\n * Describes all the possible actions that can be dispatched to the reducer.\n * These actions allow setting or updating states for specific keys or multiple keys at once,\n * handling errors, and resetting states.\n */\ntype Actions<T> =\n | { type: 'SET_QUERY_STATE'; key: string; value: Partial<States<T>> }\n | { type: 'MAKE_QUERY_IN_ERROR'; key: string; error: string }\n | { type: 'SET_QUERIES_STATE'; keys: string[]; value: Partial<States<T>> }\n | { type: 'RESET_KEY_STATE'; keys: string[] }\n | { type: 'RESET_STATE'; excludeKeys: string[] };\n\n/**\n * The shape of the entire asynchronous state, holding all states in a single object.\n */\ntype AsyncState<T> = {\n states: StateSlice<T>;\n};\n\n/**\n * Creates a default state object with initial values. This is useful when a key\n * has not been initialized yet or when resetting a state back to defaults.\n */\nconst createDefaultStates = <T,>(): States<T> => ({\n isFetched: false,\n fetchedDateTime: null,\n isLoading: false,\n isInvalidated: false,\n error: null,\n isSuccess: false,\n data: null,\n errorCount: 0,\n isEnabled: true,\n});\n\n/**\n * Given a list of selector keys and a list of keys that may contain arguments,\n * this function returns all keys that match the selectors. Matching is determined\n * by comparing the initial part (split by \"/\") of the key.\n *\n * For example:\n * selectorsKeys = [\"user\", \"posts\"]\n * keysWithArgs = [\"user/123\", \"posts/active\", \"comments/42\"]\n * Result = [\"user/123\", \"posts/active\"]\n */\nconst getMatchKeys = (\n selectorsKeys: string[],\n keysWithArgs: string[]\n): string[] =>\n keysWithArgs.filter((key) => selectorsKeys.includes(key.split('/')[0]));\n\n/**\n * The reducer function handling all state transitions. It takes the current state and an action,\n * and returns a new state based on the type of the action.\n *\n * Actions include:\n * - SET_QUERY_STATE: Update a single key with partial new state.\n * - MAKE_QUERY_IN_ERROR: Mark a single key as errored and update related flags.\n * - SET_QUERIES_STATE: Update multiple keys at once with partial new state.\n * - RESET_KEY_STATE: Reset certain keys to their default states.\n * - RESET_STATE: Reset all keys to their default states except those excluded.\n */\nconst reducer = <T,>(\n state: AsyncState<T>,\n action: Actions<T>\n): AsyncState<T> => {\n switch (action.type) {\n case 'SET_QUERY_STATE': {\n const { key, value } = action;\n return {\n ...state,\n states: {\n ...state.states,\n [key]: {\n // Merge existing state for the key or default state if not present\n ...(state.states[key] ?? createDefaultStates<T>()),\n ...value,\n },\n },\n };\n }\n case 'MAKE_QUERY_IN_ERROR': {\n const { key, error } = action;\n return {\n ...state,\n states: {\n ...state.states,\n [key]: {\n // Merge existing state or default if not found\n ...(state.states[key] ?? createDefaultStates<T>()),\n // Explicitly set error and related flags\n error,\n isFetched: true,\n isSuccess: false,\n errorCount: (state.states[key]?.errorCount ?? 0) + 1,\n isLoading: false,\n isInvalidated: false,\n },\n },\n };\n }\n case 'SET_QUERIES_STATE': {\n const { keys, value } = action;\n const keyArray = [keys].flat();\n\n // Find all keys that match the given selectors\n const allKeys = Object.keys(state.states);\n const matchedKeys = getMatchKeys(keyArray, allKeys);\n if (matchedKeys.length === 0) return state;\n\n // Update multiple keys in a single action\n const updatedStates = structuredClone(state.states);\n matchedKeys.forEach((key) => {\n updatedStates[key] = {\n ...(state.states[key] ?? createDefaultStates<T>()),\n ...value,\n };\n });\n\n return {\n ...state,\n states: updatedStates,\n };\n }\n case 'RESET_KEY_STATE': {\n const { keys } = action;\n const keyArray = [keys].flat();\n if (keyArray.length === 0) return state;\n\n // Find all keys that match the given selectors\n const allKeys = Object.keys(state.states);\n const matchedKeys = getMatchKeys(keyArray, allKeys);\n if (matchedKeys.length === 0) return state;\n\n // Reset the matched keys back to default states\n const resetStates = { ...state.states };\n matchedKeys.forEach((key) => {\n resetStates[key] = createDefaultStates<T>();\n });\n\n return {\n ...state,\n states: resetStates,\n };\n }\n case 'RESET_STATE': {\n const excludeArray = [action.excludeKeys].flat();\n const allKeys = Object.keys(state.states);\n\n const matchedKeys = getMatchKeys(excludeArray, allKeys);\n\n // Reset all states except those that match the exclude keys\n const newStates: StateSlice<T> = {};\n allKeys.forEach((key) => {\n newStates[key] = matchedKeys.includes(key)\n ? state.states[key]\n : createDefaultStates<T>();\n });\n\n return {\n ...state,\n states: newStates,\n };\n }\n default:\n return state;\n }\n};\n\n/**\n * The context type that will be provided to consumers.\n * It exposes a set of functions for interacting with the asynchronous state:\n * - getStates: Retrieve the current state for a given key.\n * - setQueryState: Partially update a single key's state.\n * - setQueriesState: Partially update multiple keys' states.\n * - makeQueryInError: Set a particular key into an error state.\n * - resetKeyState: Reset certain keys to their default states.\n * - resetState: Reset all keys to their default states except a set of excluded ones.\n */\ntype AsyncStateContextType<T> = {\n getStates: (key: string) => States<T>;\n setQueryState: (key: string, value: Partial<States<T>>) => void;\n setQueriesState: (keys: string[], value: Partial<States<T>>) => void;\n makeQueryInError: (key: string, error: string) => void;\n resetKeyState: (keys: string[]) => void;\n resetState: (excludedKeys: string[]) => void;\n};\n\n/**\n * Creates a React context for asynchronous state management.\n * This context will be provided by the AsyncStateProvider and consumed by hooks like useAsyncState.\n */\nconst AsyncStateContext = createContext<AsyncStateContextType<unknown> | null>(\n null\n);\n\n/**\n * A provider component that wraps its children and provides the asynchronous\n * state context. It uses the reducer to manage states and dispatch actions\n * based on consumer interactions.\n *\n * @param children The React children elements that should have access to this context.\n */\nexport const AsyncStateProvider = ({ children }: PropsWithChildren<{}>) => {\n // Initialize the reducer with an empty state object\n const [asyncState, dispatch] = useReducer(reducer, { states: {} });\n\n /**\n * Retrieve the state associated with a given key. If no state exists for that key,\n * return a default state.\n *\n * @param key The key for which to retrieve the state.\n */\n const getStates = (key: string) =>\n asyncState.states[key] ?? createDefaultStates<unknown>();\n\n /**\n * Partially update the state for a given key.\n *\n * @param key The key to update.\n * @param value A partial state object to merge with the existing state.\n */\n const setQueryState = (key: string, value: Partial<States<unknown>>) => {\n dispatch({ type: 'SET_QUERY_STATE', key, value });\n };\n\n /**\n * Partially update the state for multiple keys at once.\n *\n * @param keys An array of keys to update.\n * @param value A partial state object to merge with each key's existing state.\n */\n const setQueriesState = (keys: string[], value: Partial<States<unknown>>) => {\n dispatch({ type: 'SET_QUERIES_STATE', keys, value });\n };\n\n /**\n * Mark a given query as having encountered an error.\n *\n * @param key The key associated with the query.\n * @param error The error message to set.\n */\n const makeQueryInError = (key: string, error: string) => {\n dispatch({ type: 'MAKE_QUERY_IN_ERROR', key, error });\n };\n\n /**\n * Reset certain keys back to their default states.\n *\n * @param keys The keys to reset.\n */\n const resetKeyState = (keys: string[]) => {\n dispatch({ type: 'RESET_KEY_STATE', keys });\n };\n\n /**\n * Reset the entire state back to defaults, except for keys that match the excluded ones.\n *\n * @param excludedKeys Keys that should not be reset.\n */\n const resetState = (excludedKeys: string[]) => {\n dispatch({ type: 'RESET_STATE', excludeKeys: excludedKeys });\n };\n\n return (\n <AsyncStateContext.Provider\n value={{\n getStates,\n setQueryState,\n setQueriesState,\n makeQueryInError,\n resetKeyState,\n resetState,\n }}\n >\n {children}\n </AsyncStateContext.Provider>\n );\n};\n\n/**\n * A custom hook for accessing the asynchronous state context. It throws an error if used\n * outside of a provider.\n *\n * @returns The asynchronous state context value.\n */\nexport const useAsyncState = () => {\n const context = useContext(AsyncStateContext);\n if (!context) {\n throw new Error('useAsyncState must be used within an AsyncStateProvider');\n }\n return context;\n};\n"],"names":[],"mappings":";;;AAwDA,MAAM,sBAAsB,OAAsB;AAAA,EAChD,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,WA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AAE,QAAQ,CAAA,GAAI;AAQjE,QAAM,YAAY,CAAC,QACjB,WAAW,OAAO,GAAG,KAAK,oBAA6B;AAQnD,QAAA,gBAAgB,CAAC,KAAa,UAAoC;AACtE,aAAS,EAAE,MAAM,mBAAmB,KAAK,OAAO;AAAA,EAClD;AAQM,QAAA,kBAAkB,CAAC,MAAgB,UAAoC;AAC3E,aAAS,EAAE,MAAM,qBAAqB,MAAM,OAAO;AAAA,EACrD;AAQM,QAAA,mBAAmB,CAAC,KAAa,UAAkB;AACvD,aAAS,EAAE,MAAM,uBAAuB,KAAK,OAAO;AAAA,EACtD;AAOM,QAAA,gBAAgB,CAAC,SAAmB;AACxC,aAAS,EAAE,MAAM,mBAAmB,KAAA,CAAM;AAAA,EAC5C;AAOM,QAAA,aAAa,CAAC,iBAA2B;AAC7C,aAAS,EAAE,MAAM,eAAe,aAAa,cAAc;AAAA,EAC7D;AAGE,SAAA;AAAA,IAAC,kBAAkB;AAAA,IAAlB;AAAA,MACC,OAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MAEC;AAAA,IAAA;AAAA,EACH;AAEJ;AAQO,MAAM,gBAAgB,MAAM;AAC3B,QAAA,UAAU,WAAW,iBAAiB;AAC5C,MAAI,CAAC,SAAS;AACN,UAAA,IAAI,MAAM,yDAAyD;AAAA,EAAA;AAEpE,SAAA;AACT;"}
|
|
1
|
+
{"version":3,"file":"useAsyncStateStore.mjs","sources":["../../../src/hooks/useAsync/useAsyncStateStore.tsx"],"sourcesContent":["'use client';\n\nimport {\n type PropsWithChildren,\n createContext,\n useContext,\n useReducer,\n} from 'react';\n\n/**\n * Represents the states for a given key in the asynchronous state management.\n * This includes flags for loading, fetched, invalidation, and success/error status.\n * It also keeps track of the fetched datetime, retry counts, the data itself, and whether queries are enabled.\n */\ntype States<T> = {\n isLoading: boolean;\n isFetched: boolean;\n isInvalidated: boolean;\n fetchedDateTime: null | Date;\n error: string | null;\n isSuccess: boolean;\n data: T | null;\n errorCount: number;\n isEnabled: boolean;\n};\n\n/**\n * Holds a mapping from a key (string) to its associated state.\n */\ntype StateSlice<T> = {\n [key: string]: States<T>;\n};\n\n/**\n * Describes all the possible actions that can be dispatched to the reducer.\n * These actions allow setting or updating states for specific keys or multiple keys at once,\n * handling errors, and resetting states.\n */\ntype Actions<T> =\n | { type: 'SET_QUERY_STATE'; key: string; value: Partial<States<T>> }\n | { type: 'MAKE_QUERY_IN_ERROR'; key: string; error: string }\n | { type: 'SET_QUERIES_STATE'; keys: string[]; value: Partial<States<T>> }\n | { type: 'RESET_KEY_STATE'; keys: string[] }\n | { type: 'RESET_STATE'; excludeKeys: string[] };\n\n/**\n * The shape of the entire asynchronous state, holding all states in a single object.\n */\ntype AsyncState<T> = {\n states: StateSlice<T>;\n};\n\n/**\n * Creates a default state object with initial values. This is useful when a key\n * has not been initialized yet or when resetting a state back to defaults.\n */\nconst createDefaultStates = <T,>(): States<T> => ({\n isFetched: false,\n fetchedDateTime: null,\n isLoading: false,\n isInvalidated: false,\n error: null,\n isSuccess: false,\n data: null,\n errorCount: 0,\n isEnabled: true,\n});\n\n/**\n * Given a list of selector keys and a list of keys that may contain arguments,\n * this function returns all keys that match the selectors. Matching is determined\n * by comparing the initial part (split by \"/\") of the key.\n *\n * For example:\n * selectorsKeys = [\"user\", \"posts\"]\n * keysWithArgs = [\"user/123\", \"posts/active\", \"comments/42\"]\n * Result = [\"user/123\", \"posts/active\"]\n */\nconst getMatchKeys = (\n selectorsKeys: string[],\n keysWithArgs: string[]\n): string[] =>\n keysWithArgs.filter((key) => selectorsKeys.includes(key.split('/')[0]));\n\n/**\n * The reducer function handling all state transitions. It takes the current state and an action,\n * and returns a new state based on the type of the action.\n *\n * Actions include:\n * - SET_QUERY_STATE: Update a single key with partial new state.\n * - MAKE_QUERY_IN_ERROR: Mark a single key as errored and update related flags.\n * - SET_QUERIES_STATE: Update multiple keys at once with partial new state.\n * - RESET_KEY_STATE: Reset certain keys to their default states.\n * - RESET_STATE: Reset all keys to their default states except those excluded.\n */\nconst reducer = <T,>(\n state: AsyncState<T>,\n action: Actions<T>\n): AsyncState<T> => {\n switch (action.type) {\n case 'SET_QUERY_STATE': {\n const { key, value } = action;\n return {\n ...state,\n states: {\n ...state.states,\n [key]: {\n // Merge existing state for the key or default state if not present\n ...(state.states[key] ?? createDefaultStates<T>()),\n ...value,\n },\n },\n };\n }\n case 'MAKE_QUERY_IN_ERROR': {\n const { key, error } = action;\n return {\n ...state,\n states: {\n ...state.states,\n [key]: {\n // Merge existing state or default if not found\n ...(state.states[key] ?? createDefaultStates<T>()),\n // Explicitly set error and related flags\n error,\n isFetched: true,\n isSuccess: false,\n errorCount: (state.states[key]?.errorCount ?? 0) + 1,\n isLoading: false,\n isInvalidated: false,\n },\n },\n };\n }\n case 'SET_QUERIES_STATE': {\n const { keys, value } = action;\n const keyArray = [keys].flat();\n\n // Find all keys that match the given selectors\n const allKeys = Object.keys(state.states);\n const matchedKeys = getMatchKeys(keyArray, allKeys);\n if (matchedKeys.length === 0) return state;\n\n // Update multiple keys in a single action\n const updatedStates = structuredClone(state.states);\n matchedKeys.forEach((key) => {\n updatedStates[key] = {\n ...(state.states[key] ?? createDefaultStates<T>()),\n ...value,\n };\n });\n\n return {\n ...state,\n states: updatedStates,\n };\n }\n case 'RESET_KEY_STATE': {\n const { keys } = action;\n const keyArray = [keys].flat();\n if (keyArray.length === 0) return state;\n\n // Find all keys that match the given selectors\n const allKeys = Object.keys(state.states);\n const matchedKeys = getMatchKeys(keyArray, allKeys);\n if (matchedKeys.length === 0) return state;\n\n // Reset the matched keys back to default states\n const resetStates = { ...state.states };\n matchedKeys.forEach((key) => {\n resetStates[key] = createDefaultStates<T>();\n });\n\n return {\n ...state,\n states: resetStates,\n };\n }\n case 'RESET_STATE': {\n const excludeArray = [action.excludeKeys].flat();\n const allKeys = Object.keys(state.states);\n\n const matchedKeys = getMatchKeys(excludeArray, allKeys);\n\n // Reset all states except those that match the exclude keys\n const newStates: StateSlice<T> = {};\n allKeys.forEach((key) => {\n newStates[key] = matchedKeys.includes(key)\n ? state.states[key]\n : createDefaultStates<T>();\n });\n\n return {\n ...state,\n states: newStates,\n };\n }\n default:\n return state;\n }\n};\n\n/**\n * The context type that will be provided to consumers.\n * It exposes a set of functions for interacting with the asynchronous state:\n * - getStates: Retrieve the current state for a given key.\n * - setQueryState: Partially update a single key's state.\n * - setQueriesState: Partially update multiple keys' states.\n * - makeQueryInError: Set a particular key into an error state.\n * - resetKeyState: Reset certain keys to their default states.\n * - resetState: Reset all keys to their default states except a set of excluded ones.\n */\ntype AsyncStateContextType<T> = {\n getStates: (key: string) => States<T>;\n setQueryState: (key: string, value: Partial<States<T>>) => void;\n setQueriesState: (keys: string[], value: Partial<States<T>>) => void;\n makeQueryInError: (key: string, error: string) => void;\n resetKeyState: (keys: string[]) => void;\n resetState: (excludedKeys: string[]) => void;\n};\n\n/**\n * Creates a React context for asynchronous state management.\n * This context will be provided by the AsyncStateProvider and consumed by hooks like useAsyncState.\n */\nconst AsyncStateContext = createContext<AsyncStateContextType<unknown> | null>(\n null\n);\n\n/**\n * A provider component that wraps its children and provides the asynchronous\n * state context. It uses the reducer to manage states and dispatch actions\n * based on consumer interactions.\n *\n * @param children The React children elements that should have access to this context.\n */\nexport const AsyncStateProvider = ({ children }: PropsWithChildren<{}>) => {\n // Initialize the reducer with an empty state object\n const [asyncState, dispatch] = useReducer(reducer, { states: {} });\n\n /**\n * Retrieve the state associated with a given key. If no state exists for that key,\n * return a default state.\n *\n * @param key The key for which to retrieve the state.\n */\n const getStates = (key: string) =>\n asyncState.states[key] ?? createDefaultStates<unknown>();\n\n /**\n * Partially update the state for a given key.\n *\n * @param key The key to update.\n * @param value A partial state object to merge with the existing state.\n */\n const setQueryState = (key: string, value: Partial<States<unknown>>) => {\n dispatch({ type: 'SET_QUERY_STATE', key, value });\n };\n\n /**\n * Partially update the state for multiple keys at once.\n *\n * @param keys An array of keys to update.\n * @param value A partial state object to merge with each key's existing state.\n */\n const setQueriesState = (keys: string[], value: Partial<States<unknown>>) => {\n dispatch({ type: 'SET_QUERIES_STATE', keys, value });\n };\n\n /**\n * Mark a given query as having encountered an error.\n *\n * @param key The key associated with the query.\n * @param error The error message to set.\n */\n const makeQueryInError = (key: string, error: string) => {\n dispatch({ type: 'MAKE_QUERY_IN_ERROR', key, error });\n };\n\n /**\n * Reset certain keys back to their default states.\n *\n * @param keys The keys to reset.\n */\n const resetKeyState = (keys: string[]) => {\n dispatch({ type: 'RESET_KEY_STATE', keys });\n };\n\n /**\n * Reset the entire state back to defaults, except for keys that match the excluded ones.\n *\n * @param excludedKeys Keys that should not be reset.\n */\n const resetState = (excludedKeys: string[]) => {\n dispatch({ type: 'RESET_STATE', excludeKeys: excludedKeys });\n };\n\n return (\n <AsyncStateContext.Provider\n value={{\n getStates,\n setQueryState,\n setQueriesState,\n makeQueryInError,\n resetKeyState,\n resetState,\n }}\n >\n {children}\n </AsyncStateContext.Provider>\n );\n};\n\n/**\n * A custom hook for accessing the asynchronous state context. It throws an error if used\n * outside of a provider.\n *\n * @returns The asynchronous state context value.\n */\nexport const useAsyncState = () => {\n const context = useContext(AsyncStateContext);\n if (!context) {\n throw new Error('useAsyncState must be used within an AsyncStateProvider');\n }\n return context;\n};\n"],"names":[],"mappings":";;;AAwDA,MAAM,sBAAsB,OAAsB;AAAA,EAChD,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,eAAe;AAAA,EACf,OAAO;AAAA,EACP,WAAW;AAAA,EACX,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,WAAW;AACb;AAYA,MAAM,eAAe,CACnB,eACA,iBAEA,aAAa,OAAO,CAAC,QAAQ,cAAc,SAAS,IAAI,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC;AAaxE,MAAM,UAAU,CACd,OACA,WACkB;AAClB,UAAQ,OAAO,MAAA;AAAA,IACb,KAAK,mBAAmB;AACtB,YAA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AS,EAAE,MAAM,uBAAuB,KAAK,OAAO;AAAA,EACtD;AAOA,QAAM,gBAAgB,CAAC,SAAmB;AACxC,aAAS,EAAE,MAAM,mBAAmB,KAAA,CAAM;AAAA,EAC5C;AAOA,QAAM,aAAa,CAAC,iBAA2B;AAC7C,aAAS,EAAE,MAAM,eAAe,aAAa,cAAc;AAAA,EAC7D;AAEA,SACE;AAAA,IAAC,kBAAkB;AAAA,IAAlB;AAAA,MACC,OAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,MAGD;AAAA,IAAA;AAAA,EAAA;AAGP;AAQO,MAAM,gBAAgB,MAAM;AACjC,QAAM,UAAU,WAAW,iBAAiB;AAC5C,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,yDAAyD;AAAA,EAC3E;AACA,SAAO;AACT;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAsyncWrapper.cjs","sources":["../../../src/hooks/useAsync/useAsyncWrapper.ts"],"sourcesContent":["'use client';\n\nimport {\n type UseAsyncOptions,\n type UseAsyncResult,\n useAsync,\n} from './useAsync';\n\n/**\n * This hook allow the declaration of a custom hook that wraps an async function.\n * It provides a simpler way to make your useAsync hook more readable and maintainable.\n *\n * @example\n * // Example of using useAsync to manage fetching user data from an API.\n * const fetchUserData = async (userId) => {\n * const response = await fetch(`/api/users/${userId}`);\n * if (!response.ok) throw new Error('Failed to fetch');\n * return await response.json();\n * };\n *\n * // Define a custom hook that wraps the fetchUserData function\n * const useUserDetails = useAsyncWrapper('userDetails', fetchUserData);\n *\n * // Use the custom hook to fetch user data\n * const UserDetails = ({ userId }) => {\n * const {\n * isLoading,\n * data,\n * error,\n * revalidate,\n * } = useUserDetails(userId);\n *\n * if (isLoading) return <div>Loading...</div>;\n * if (error) return <div>Error: {error}</div>;\n * return (\n * <div>\n * <h1>{data.name}</h1>\n * <button onClick={() => revalidate()}>Refresh</button>\n * </div>\n * );\n * };\n */\nexport const useAsyncWrapper =\n <U extends string, T extends (...args: any[]) => Promise<any>>(\n key: U,\n asyncFunction: T,\n options?: UseAsyncOptions<T>\n ): ((...args: Parameters<T>) => UseAsyncResult<U, T>) =>\n (...args: Parameters<T>) =>\n useAsync(key, asyncFunction, {\n ...options,\n args,\n });\n"],"names":["useAsync"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"useAsyncWrapper.cjs","sources":["../../../src/hooks/useAsync/useAsyncWrapper.ts"],"sourcesContent":["'use client';\n\nimport {\n type UseAsyncOptions,\n type UseAsyncResult,\n useAsync,\n} from './useAsync';\n\n/**\n * This hook allow the declaration of a custom hook that wraps an async function.\n * It provides a simpler way to make your useAsync hook more readable and maintainable.\n *\n * @example\n * // Example of using useAsync to manage fetching user data from an API.\n * const fetchUserData = async (userId) => {\n * const response = await fetch(`/api/users/${userId}`);\n * if (!response.ok) throw new Error('Failed to fetch');\n * return await response.json();\n * };\n *\n * // Define a custom hook that wraps the fetchUserData function\n * const useUserDetails = useAsyncWrapper('userDetails', fetchUserData);\n *\n * // Use the custom hook to fetch user data\n * const UserDetails = ({ userId }) => {\n * const {\n * isLoading,\n * data,\n * error,\n * revalidate,\n * } = useUserDetails(userId);\n *\n * if (isLoading) return <div>Loading...</div>;\n * if (error) return <div>Error: {error}</div>;\n * return (\n * <div>\n * <h1>{data.name}</h1>\n * <button onClick={() => revalidate()}>Refresh</button>\n * </div>\n * );\n * };\n */\nexport const useAsyncWrapper =\n <U extends string, T extends (...args: any[]) => Promise<any>>(\n key: U,\n asyncFunction: T,\n options?: UseAsyncOptions<T>\n ): ((...args: Parameters<T>) => UseAsyncResult<U, T>) =>\n (...args: Parameters<T>) =>\n useAsync(key, asyncFunction, {\n ...options,\n args,\n });\n"],"names":["useAsync"],"mappings":";;;;AA0CO,MAAM,kBACX,CACE,KACA,eACA,YAEF,IAAI,SACFA,wBAAAA,SAAS,KAAK,eAAe;AAAA,EAC3B,GAAG;AAAA,EACH;AACF,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAsyncWrapper.mjs","sources":["../../../src/hooks/useAsync/useAsyncWrapper.ts"],"sourcesContent":["'use client';\n\nimport {\n type UseAsyncOptions,\n type UseAsyncResult,\n useAsync,\n} from './useAsync';\n\n/**\n * This hook allow the declaration of a custom hook that wraps an async function.\n * It provides a simpler way to make your useAsync hook more readable and maintainable.\n *\n * @example\n * // Example of using useAsync to manage fetching user data from an API.\n * const fetchUserData = async (userId) => {\n * const response = await fetch(`/api/users/${userId}`);\n * if (!response.ok) throw new Error('Failed to fetch');\n * return await response.json();\n * };\n *\n * // Define a custom hook that wraps the fetchUserData function\n * const useUserDetails = useAsyncWrapper('userDetails', fetchUserData);\n *\n * // Use the custom hook to fetch user data\n * const UserDetails = ({ userId }) => {\n * const {\n * isLoading,\n * data,\n * error,\n * revalidate,\n * } = useUserDetails(userId);\n *\n * if (isLoading) return <div>Loading...</div>;\n * if (error) return <div>Error: {error}</div>;\n * return (\n * <div>\n * <h1>{data.name}</h1>\n * <button onClick={() => revalidate()}>Refresh</button>\n * </div>\n * );\n * };\n */\nexport const useAsyncWrapper =\n <U extends string, T extends (...args: any[]) => Promise<any>>(\n key: U,\n asyncFunction: T,\n options?: UseAsyncOptions<T>\n ): ((...args: Parameters<T>) => UseAsyncResult<U, T>) =>\n (...args: Parameters<T>) =>\n useAsync(key, asyncFunction, {\n ...options,\n args,\n });\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useAsyncWrapper.mjs","sources":["../../../src/hooks/useAsync/useAsyncWrapper.ts"],"sourcesContent":["'use client';\n\nimport {\n type UseAsyncOptions,\n type UseAsyncResult,\n useAsync,\n} from './useAsync';\n\n/**\n * This hook allow the declaration of a custom hook that wraps an async function.\n * It provides a simpler way to make your useAsync hook more readable and maintainable.\n *\n * @example\n * // Example of using useAsync to manage fetching user data from an API.\n * const fetchUserData = async (userId) => {\n * const response = await fetch(`/api/users/${userId}`);\n * if (!response.ok) throw new Error('Failed to fetch');\n * return await response.json();\n * };\n *\n * // Define a custom hook that wraps the fetchUserData function\n * const useUserDetails = useAsyncWrapper('userDetails', fetchUserData);\n *\n * // Use the custom hook to fetch user data\n * const UserDetails = ({ userId }) => {\n * const {\n * isLoading,\n * data,\n * error,\n * revalidate,\n * } = useUserDetails(userId);\n *\n * if (isLoading) return <div>Loading...</div>;\n * if (error) return <div>Error: {error}</div>;\n * return (\n * <div>\n * <h1>{data.name}</h1>\n * <button onClick={() => revalidate()}>Refresh</button>\n * </div>\n * );\n * };\n */\nexport const useAsyncWrapper =\n <U extends string, T extends (...args: any[]) => Promise<any>>(\n key: U,\n asyncFunction: T,\n options?: UseAsyncOptions<T>\n ): ((...args: Parameters<T>) => UseAsyncResult<U, T>) =>\n (...args: Parameters<T>) =>\n useAsync(key, asyncFunction, {\n ...options,\n args,\n });\n"],"names":[],"mappings":";;AA0CO,MAAM,kBACX,CACE,KACA,eACA,YAEF,IAAI,SACF,SAAS,KAAK,eAAe;AAAA,EAC3B,GAAG;AAAA,EACH;AACF,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAuth.cjs","sources":["../../../src/hooks/useAuth/useAuth.ts"],"sourcesContent":["'use client';\n\nimport type { OAuth2Token, SessionAPI } from '@intlayer/backend';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { useOAuth2 } from './useOAuth2';\nimport { useSession } from './useSession';\n\ntype SessionContextProps = {\n session: SessionAPI | null | undefined;\n setSession: (session: SessionAPI | null) => void;\n fetchSession: () => Promise<SessionAPI | null | undefined>;\n revalidateSession: () => Promise<SessionAPI | null | undefined>;\n isAuthenticated: boolean;\n oAuth2AccessToken: OAuth2Token | null | undefined;\n};\n\nexport const useAuth = ({\n session: sessionProp,\n intlayerConfiguration,\n}: {\n session?: SessionAPI | null;\n intlayerConfiguration?: IntlayerConfig;\n} = {}): SessionContextProps => {\n const { session, fetchSession, revalidateSession, setSession } = useSession(\n sessionProp,\n intlayerConfiguration\n );\n const { oAuth2AccessToken } = useOAuth2(intlayerConfiguration);\n\n return {\n session,\n fetchSession,\n setSession,\n revalidateSession,\n oAuth2AccessToken,\n isAuthenticated: Boolean(session?.user || oAuth2AccessToken),\n };\n};\n"],"names":["useSession","useOAuth2"],"mappings":";;;;;AAgBO,MAAM,UAAU,CAAC;AAAA,EACtB,SAAS;AAAA,EACT;AACF,IAGI,OAA4B;AAC9B,QAAM,EAAE,SAAS,cAAc,mBAAmB,
|
|
1
|
+
{"version":3,"file":"useAuth.cjs","sources":["../../../src/hooks/useAuth/useAuth.ts"],"sourcesContent":["'use client';\n\nimport type { OAuth2Token, SessionAPI } from '@intlayer/backend';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { useOAuth2 } from './useOAuth2';\nimport { useSession } from './useSession';\n\ntype SessionContextProps = {\n session: SessionAPI | null | undefined;\n setSession: (session: SessionAPI | null) => void;\n fetchSession: () => Promise<SessionAPI | null | undefined>;\n revalidateSession: () => Promise<SessionAPI | null | undefined>;\n isAuthenticated: boolean;\n oAuth2AccessToken: OAuth2Token | null | undefined;\n};\n\nexport const useAuth = ({\n session: sessionProp,\n intlayerConfiguration,\n}: {\n session?: SessionAPI | null;\n intlayerConfiguration?: IntlayerConfig;\n} = {}): SessionContextProps => {\n const { session, fetchSession, revalidateSession, setSession } = useSession(\n sessionProp,\n intlayerConfiguration\n );\n const { oAuth2AccessToken } = useOAuth2(intlayerConfiguration);\n\n return {\n session,\n fetchSession,\n setSession,\n revalidateSession,\n oAuth2AccessToken,\n isAuthenticated: Boolean(session?.user || oAuth2AccessToken),\n };\n};\n"],"names":["useSession","useOAuth2"],"mappings":";;;;;AAgBO,MAAM,UAAU,CAAC;AAAA,EACtB,SAAS;AAAA,EACT;AACF,IAGI,OAA4B;AAC9B,QAAM,EAAE,SAAS,cAAc,mBAAmB,eAAeA,yBAAAA;AAAAA,IAC/D;AAAA,IACA;AAAA,EAAA;AAEF,QAAM,EAAE,kBAAA,IAAsBC,wBAAAA,UAAU,qBAAqB;AAE7D,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,iBAAiB,QAAQ,SAAS,QAAQ,iBAAiB;AAAA,EAAA;AAE/D;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAuth.mjs","sources":["../../../src/hooks/useAuth/useAuth.ts"],"sourcesContent":["'use client';\n\nimport type { OAuth2Token, SessionAPI } from '@intlayer/backend';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { useOAuth2 } from './useOAuth2';\nimport { useSession } from './useSession';\n\ntype SessionContextProps = {\n session: SessionAPI | null | undefined;\n setSession: (session: SessionAPI | null) => void;\n fetchSession: () => Promise<SessionAPI | null | undefined>;\n revalidateSession: () => Promise<SessionAPI | null | undefined>;\n isAuthenticated: boolean;\n oAuth2AccessToken: OAuth2Token | null | undefined;\n};\n\nexport const useAuth = ({\n session: sessionProp,\n intlayerConfiguration,\n}: {\n session?: SessionAPI | null;\n intlayerConfiguration?: IntlayerConfig;\n} = {}): SessionContextProps => {\n const { session, fetchSession, revalidateSession, setSession } = useSession(\n sessionProp,\n intlayerConfiguration\n );\n const { oAuth2AccessToken } = useOAuth2(intlayerConfiguration);\n\n return {\n session,\n fetchSession,\n setSession,\n revalidateSession,\n oAuth2AccessToken,\n isAuthenticated: Boolean(session?.user || oAuth2AccessToken),\n };\n};\n"],"names":[],"mappings":";;;AAgBO,MAAM,UAAU,CAAC;AAAA,EACtB,SAAS;AAAA,EACT;AACF,IAGI,OAA4B;AAC9B,QAAM,EAAE,SAAS,cAAc,mBAAmB,
|
|
1
|
+
{"version":3,"file":"useAuth.mjs","sources":["../../../src/hooks/useAuth/useAuth.ts"],"sourcesContent":["'use client';\n\nimport type { OAuth2Token, SessionAPI } from '@intlayer/backend';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { useOAuth2 } from './useOAuth2';\nimport { useSession } from './useSession';\n\ntype SessionContextProps = {\n session: SessionAPI | null | undefined;\n setSession: (session: SessionAPI | null) => void;\n fetchSession: () => Promise<SessionAPI | null | undefined>;\n revalidateSession: () => Promise<SessionAPI | null | undefined>;\n isAuthenticated: boolean;\n oAuth2AccessToken: OAuth2Token | null | undefined;\n};\n\nexport const useAuth = ({\n session: sessionProp,\n intlayerConfiguration,\n}: {\n session?: SessionAPI | null;\n intlayerConfiguration?: IntlayerConfig;\n} = {}): SessionContextProps => {\n const { session, fetchSession, revalidateSession, setSession } = useSession(\n sessionProp,\n intlayerConfiguration\n );\n const { oAuth2AccessToken } = useOAuth2(intlayerConfiguration);\n\n return {\n session,\n fetchSession,\n setSession,\n revalidateSession,\n oAuth2AccessToken,\n isAuthenticated: Boolean(session?.user || oAuth2AccessToken),\n };\n};\n"],"names":[],"mappings":";;;AAgBO,MAAM,UAAU,CAAC;AAAA,EACtB,SAAS;AAAA,EACT;AACF,IAGI,OAA4B;AAC9B,QAAM,EAAE,SAAS,cAAc,mBAAmB,eAAe;AAAA,IAC/D;AAAA,IACA;AAAA,EAAA;AAEF,QAAM,EAAE,kBAAA,IAAsB,UAAU,qBAAqB;AAE7D,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,iBAAiB,QAAQ,SAAS,QAAQ,iBAAiB;AAAA,EAAA;AAE/D;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOAuth2.cjs","sources":["../../../src/hooks/useAuth/useOAuth2.ts"],"sourcesContent":["'use client';\n\nimport { getOAuthAPI } from '@intlayer/api';\nimport defaultConfiguration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { useAsync } from '../useAsync/useAsync';\n\nexport const useOAuth2 = (intlayerConfiguration?: IntlayerConfig) => {\n const configuration = useConfiguration();\n const config = intlayerConfiguration ?? configuration ?? defaultConfiguration;\n const intlayerAPI = getOAuthAPI(config);\n\n const { data } = useAsync(\n 'getOAuth2AccessToken',\n intlayerAPI.getOAuth2AccessToken,\n {\n cache: true,\n autoFetch: true,\n enable: !!(config.editor.clientId && config.editor.clientSecret),\n }\n );\n\n const oAuth2AccessToken = data?.data;\n\n return {\n oAuth2AccessToken,\n };\n};\n"],"names":["configuration","useConfiguration","defaultConfiguration","getOAuthAPI","useAsync"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"useOAuth2.cjs","sources":["../../../src/hooks/useAuth/useOAuth2.ts"],"sourcesContent":["'use client';\n\nimport { getOAuthAPI } from '@intlayer/api';\nimport defaultConfiguration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { useAsync } from '../useAsync/useAsync';\n\nexport const useOAuth2 = (intlayerConfiguration?: IntlayerConfig) => {\n const configuration = useConfiguration();\n const config = intlayerConfiguration ?? configuration ?? defaultConfiguration;\n const intlayerAPI = getOAuthAPI(config);\n\n const { data } = useAsync(\n 'getOAuth2AccessToken',\n intlayerAPI.getOAuth2AccessToken,\n {\n cache: true,\n autoFetch: true,\n enable: !!(config.editor.clientId && config.editor.clientSecret),\n }\n );\n\n const oAuth2AccessToken = data?.data;\n\n return {\n oAuth2AccessToken,\n };\n};\n"],"names":["configuration","useConfiguration","defaultConfiguration","getOAuthAPI","useAsync"],"mappings":";;;;;;;AAQO,MAAM,YAAY,CAAC,0BAA2C;AACnE,QAAMA,kBAAgBC,YAAAA,iBAAA;AACtB,QAAM,SAAS,yBAAyBD,mBAAiBE;AACzD,QAAM,cAAcC,IAAAA,YAAY,MAAM;AAEtC,QAAM,EAAE,SAASC,wBAAAA;AAAAA,IACf;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,MACE,OAAO;AAAA,MACP,WAAW;AAAA,MACX,QAAQ,CAAC,EAAE,OAAO,OAAO,YAAY,OAAO,OAAO;AAAA,IAAA;AAAA,EACrD;AAGF,QAAM,oBAAoB,MAAM;AAEhC,SAAO;AAAA,IACL;AAAA,EAAA;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOAuth2.mjs","sources":["../../../src/hooks/useAuth/useOAuth2.ts"],"sourcesContent":["'use client';\n\nimport { getOAuthAPI } from '@intlayer/api';\nimport defaultConfiguration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { useAsync } from '../useAsync/useAsync';\n\nexport const useOAuth2 = (intlayerConfiguration?: IntlayerConfig) => {\n const configuration = useConfiguration();\n const config = intlayerConfiguration ?? configuration ?? defaultConfiguration;\n const intlayerAPI = getOAuthAPI(config);\n\n const { data } = useAsync(\n 'getOAuth2AccessToken',\n intlayerAPI.getOAuth2AccessToken,\n {\n cache: true,\n autoFetch: true,\n enable: !!(config.editor.clientId && config.editor.clientSecret),\n }\n );\n\n const oAuth2AccessToken = data?.data;\n\n return {\n oAuth2AccessToken,\n };\n};\n"],"names":["configuration","defaultConfiguration"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"useOAuth2.mjs","sources":["../../../src/hooks/useAuth/useOAuth2.ts"],"sourcesContent":["'use client';\n\nimport { getOAuthAPI } from '@intlayer/api';\nimport defaultConfiguration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { useAsync } from '../useAsync/useAsync';\n\nexport const useOAuth2 = (intlayerConfiguration?: IntlayerConfig) => {\n const configuration = useConfiguration();\n const config = intlayerConfiguration ?? configuration ?? defaultConfiguration;\n const intlayerAPI = getOAuthAPI(config);\n\n const { data } = useAsync(\n 'getOAuth2AccessToken',\n intlayerAPI.getOAuth2AccessToken,\n {\n cache: true,\n autoFetch: true,\n enable: !!(config.editor.clientId && config.editor.clientSecret),\n }\n );\n\n const oAuth2AccessToken = data?.data;\n\n return {\n oAuth2AccessToken,\n };\n};\n"],"names":["configuration","defaultConfiguration"],"mappings":";;;;;AAQO,MAAM,YAAY,CAAC,0BAA2C;AACnE,QAAMA,kBAAgB,iBAAA;AACtB,QAAM,SAAS,yBAAyBA,mBAAiBC;AACzD,QAAM,cAAc,YAAY,MAAM;AAEtC,QAAM,EAAE,SAAS;AAAA,IACf;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,MACE,OAAO;AAAA,MACP,WAAW;AAAA,MACX,QAAQ,CAAC,EAAE,OAAO,OAAO,YAAY,OAAO,OAAO;AAAA,IAAA;AAAA,EACrD;AAGF,QAAM,oBAAoB,MAAM;AAEhC,SAAO;AAAA,IACL;AAAA,EAAA;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSession.cjs","sources":["../../../src/hooks/useAuth/useSession.ts"],"sourcesContent":["'use client';\n\nimport type { SessionAPI } from '@intlayer/backend';\nimport defaultConfiguration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { getAuthAPI } from '../auth';\nimport { useAsync } from '../useAsync';\n\nexport const useSession = (\n sessionProp?: SessionAPI | null,\n intlayerConfiguration?: IntlayerConfig\n) => {\n const configuration = useConfiguration();\n const config = intlayerConfiguration ?? configuration ?? defaultConfiguration;\n\n const {\n getSession,\n revalidate,\n data,\n setData: setSession,\n isFetched,\n } = useAsync(\n 'getSession',\n async () => {\n const intlayerAPI = getAuthAPI(config);\n const result = await intlayerAPI.getSession();\n return result.data as unknown as SessionAPI;\n },\n {\n cache: true,\n store: true,\n autoFetch: true,\n enable: !sessionProp,\n invalidateQueries: [\n 'getOrganizations',\n 'getProjects',\n 'getUsers',\n 'getDictionaries',\n ],\n }\n );\n\n const session = data ?? (isFetched ? null : undefined);\n\n return {\n session,\n fetchSession: getSession,\n revalidateSession: revalidate,\n setSession,\n };\n};\n"],"names":["configuration","useConfiguration","defaultConfiguration","useAsync","getAuthAPI"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"useSession.cjs","sources":["../../../src/hooks/useAuth/useSession.ts"],"sourcesContent":["'use client';\n\nimport type { SessionAPI } from '@intlayer/backend';\nimport defaultConfiguration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { getAuthAPI } from '../auth';\nimport { useAsync } from '../useAsync';\n\nexport const useSession = (\n sessionProp?: SessionAPI | null,\n intlayerConfiguration?: IntlayerConfig\n) => {\n const configuration = useConfiguration();\n const config = intlayerConfiguration ?? configuration ?? defaultConfiguration;\n\n const {\n getSession,\n revalidate,\n data,\n setData: setSession,\n isFetched,\n } = useAsync(\n 'getSession',\n async () => {\n const intlayerAPI = getAuthAPI(config);\n const result = await intlayerAPI.getSession();\n return result.data as unknown as SessionAPI;\n },\n {\n cache: true,\n store: true,\n autoFetch: true,\n enable: !sessionProp,\n invalidateQueries: [\n 'getOrganizations',\n 'getProjects',\n 'getUsers',\n 'getDictionaries',\n ],\n }\n );\n\n const session = data ?? (isFetched ? null : undefined);\n\n return {\n session,\n fetchSession: getSession,\n revalidateSession: revalidate,\n setSession,\n };\n};\n"],"names":["configuration","useConfiguration","defaultConfiguration","useAsync","getAuthAPI"],"mappings":";;;;;;;;AASO,MAAM,aAAa,CACxB,aACA,0BACG;AACH,QAAMA,kBAAgBC,YAAAA,iBAAA;AACtB,QAAM,SAAS,yBAAyBD,mBAAiBE;AAEzD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT;AAAA,EAAA,IACEC,wBAAAA;AAAAA,IACF;AAAA,IACA,YAAY;AACV,YAAM,cAAcC,WAAAA,WAAW,MAAM;AACrC,YAAM,SAAS,MAAM,YAAY,WAAA;AACjC,aAAO,OAAO;AAAA,IAChB;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,OAAO;AAAA,MACP,WAAW;AAAA,MACX,QAAQ,CAAC;AAAA,MACT,mBAAmB;AAAA,QACjB;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,IACF;AAAA,EACF;AAGF,QAAM,UAAU,SAAS,YAAY,OAAO;AAE5C,SAAO;AAAA,IACL;AAAA,IACA,cAAc;AAAA,IACd,mBAAmB;AAAA,IACnB;AAAA,EAAA;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSession.mjs","sources":["../../../src/hooks/useAuth/useSession.ts"],"sourcesContent":["'use client';\n\nimport type { SessionAPI } from '@intlayer/backend';\nimport defaultConfiguration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { getAuthAPI } from '../auth';\nimport { useAsync } from '../useAsync';\n\nexport const useSession = (\n sessionProp?: SessionAPI | null,\n intlayerConfiguration?: IntlayerConfig\n) => {\n const configuration = useConfiguration();\n const config = intlayerConfiguration ?? configuration ?? defaultConfiguration;\n\n const {\n getSession,\n revalidate,\n data,\n setData: setSession,\n isFetched,\n } = useAsync(\n 'getSession',\n async () => {\n const intlayerAPI = getAuthAPI(config);\n const result = await intlayerAPI.getSession();\n return result.data as unknown as SessionAPI;\n },\n {\n cache: true,\n store: true,\n autoFetch: true,\n enable: !sessionProp,\n invalidateQueries: [\n 'getOrganizations',\n 'getProjects',\n 'getUsers',\n 'getDictionaries',\n ],\n }\n );\n\n const session = data ?? (isFetched ? null : undefined);\n\n return {\n session,\n fetchSession: getSession,\n revalidateSession: revalidate,\n setSession,\n };\n};\n"],"names":["configuration","defaultConfiguration"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"useSession.mjs","sources":["../../../src/hooks/useAuth/useSession.ts"],"sourcesContent":["'use client';\n\nimport type { SessionAPI } from '@intlayer/backend';\nimport defaultConfiguration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { getAuthAPI } from '../auth';\nimport { useAsync } from '../useAsync';\n\nexport const useSession = (\n sessionProp?: SessionAPI | null,\n intlayerConfiguration?: IntlayerConfig\n) => {\n const configuration = useConfiguration();\n const config = intlayerConfiguration ?? configuration ?? defaultConfiguration;\n\n const {\n getSession,\n revalidate,\n data,\n setData: setSession,\n isFetched,\n } = useAsync(\n 'getSession',\n async () => {\n const intlayerAPI = getAuthAPI(config);\n const result = await intlayerAPI.getSession();\n return result.data as unknown as SessionAPI;\n },\n {\n cache: true,\n store: true,\n autoFetch: true,\n enable: !sessionProp,\n invalidateQueries: [\n 'getOrganizations',\n 'getProjects',\n 'getUsers',\n 'getDictionaries',\n ],\n }\n );\n\n const session = data ?? (isFetched ? null : undefined);\n\n return {\n session,\n fetchSession: getSession,\n revalidateSession: revalidate,\n setSession,\n };\n};\n"],"names":["configuration","defaultConfiguration"],"mappings":";;;;;;AASO,MAAM,aAAa,CACxB,aACA,0BACG;AACH,QAAMA,kBAAgB,iBAAA;AACtB,QAAM,SAAS,yBAAyBA,mBAAiBC;AAEzD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT;AAAA,EAAA,IACE;AAAA,IACF;AAAA,IACA,YAAY;AACV,YAAM,cAAc,WAAW,MAAM;AACrC,YAAM,SAAS,MAAM,YAAY,WAAA;AACjC,aAAO,OAAO;AAAA,IAChB;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,OAAO;AAAA,MACP,WAAW;AAAA,MACX,QAAQ,CAAC;AAAA,MACT,mBAAmB;AAAA,QACjB;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,IACF;AAAA,EACF;AAGF,QAAM,UAAU,SAAS,YAAY,OAAO;AAE5C,SAAO;AAAA,IACL;AAAA,IACA,cAAc;AAAA,IACd,mBAAmB;AAAA,IACnB;AAAA,EAAA;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDevice.cjs","sources":["../../src/hooks/useDevice.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\nexport type SizeType = 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\nexport const getBreakpointFromSize = (breakpoint: SizeType | number) => {\n switch (breakpoint) {\n case 'sm':\n return 640;\n case 'md':\n return 768;\n case 'lg':\n return 1024;\n case 'xl':\n return 1280;\n case '2xl':\n return 1536;\n default:\n return breakpoint;\n }\n};\n\nexport const checkIsMobileUserAgent = (): boolean | undefined => {\n if (typeof window === 'undefined') return;\n\n const userAgent = window.navigator?.userAgent;\n\n if (typeof userAgent === 'undefined') return;\n\n return /android|bb\\d+|meego|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(?:hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(?:ob|in)i|palm(?: os)?|phone|p(?:ixi|re)\\/|plucker|pocket|psp|series(?:4|6)0|symbian|treo|up\\.(?:browser|link)|vodafone|wap|windows ce|windows phone|xda|xiino|zte-/i.test(\n userAgent\n );\n};\n\nexport const checkIsIphoneOrSafariDevice = (): boolean | undefined => {\n if (typeof window === 'undefined') return;\n\n const userAgent = window.navigator?.userAgent;\n\n /* 1 . is it Safari? (Chrome & co. also contain “Safari/…”, so exclude them) */\n const isSafari =\n /Safari\\/\\d/i.test(userAgent) && // has “Safari/xxx”\n !/Chrome|CriOS|FxiOS|Edg|OPR/i.test(userAgent); // …but not the other browsers\n\n /* 2. is it an Apple device? (macOS or iOS/iPadOS) */\n const isAppleDevice = /Macintosh|iP(?:hone|ad|od)/.test(userAgent);\n\n return isSafari && isAppleDevice; // true for mac-Safari & iOS-Safari\n};\n\nexport const checkIsMobileScreen = (\n breakpoint: number\n): boolean | undefined => {\n if (typeof window === 'undefined') return;\n\n return (window?.innerWidth ?? 0) <= breakpoint;\n};\n\ntype UseDeviceState = {\n isMobileScreen: boolean | undefined;\n isMobileUserAgent: boolean | undefined;\n isMobile: boolean | undefined;\n};\n\nexport const calculateIsMobile = (breakpoint: SizeType | number = 'md') => {\n const breakpointValue = getBreakpointFromSize(breakpoint);\n\n const isMobileUserAgent = checkIsMobileUserAgent();\n const isMobileScreen = checkIsMobileScreen(breakpointValue);\n const isMobile = isMobileScreen ?? isMobileUserAgent;\n\n return {\n isMobileScreen, // Is the screen width within a mobile breakpoint.\n isMobileUserAgent, // Is the user agent indicative of a mobile device.\n isMobile, // Combines both checks to determine if the device is mobile.\n };\n};\n\nexport const useDevice = (breakpoint: SizeType | number = 'md') => {\n const [result, setResult] = useState<UseDeviceState>(\n calculateIsMobile(breakpoint)\n );\n\n useEffect(() => {\n const handleResize = () => {\n setResult(calculateIsMobile(breakpoint));\n };\n\n window.addEventListener('resize', handleResize, { passive: true });\n\n // Cleanup listener on unmount\n return () => window.removeEventListener('resize', handleResize);\n }, [breakpoint]); // Empty dependency array ensures this effect runs only once on mount\n\n return result;\n};\n"],"names":["useState","useEffect"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"useDevice.cjs","sources":["../../src/hooks/useDevice.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\nexport type SizeType = 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\nexport const getBreakpointFromSize = (breakpoint: SizeType | number) => {\n switch (breakpoint) {\n case 'sm':\n return 640;\n case 'md':\n return 768;\n case 'lg':\n return 1024;\n case 'xl':\n return 1280;\n case '2xl':\n return 1536;\n default:\n return breakpoint;\n }\n};\n\nexport const checkIsMobileUserAgent = (): boolean | undefined => {\n if (typeof window === 'undefined') return;\n\n const userAgent = window.navigator?.userAgent;\n\n if (typeof userAgent === 'undefined') return;\n\n return /android|bb\\d+|meego|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(?:hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(?:ob|in)i|palm(?: os)?|phone|p(?:ixi|re)\\/|plucker|pocket|psp|series(?:4|6)0|symbian|treo|up\\.(?:browser|link)|vodafone|wap|windows ce|windows phone|xda|xiino|zte-/i.test(\n userAgent\n );\n};\n\nexport const checkIsIphoneOrSafariDevice = (): boolean | undefined => {\n if (typeof window === 'undefined') return;\n\n const userAgent = window.navigator?.userAgent;\n\n /* 1 . is it Safari? (Chrome & co. also contain “Safari/…”, so exclude them) */\n const isSafari =\n /Safari\\/\\d/i.test(userAgent) && // has “Safari/xxx”\n !/Chrome|CriOS|FxiOS|Edg|OPR/i.test(userAgent); // …but not the other browsers\n\n /* 2. is it an Apple device? (macOS or iOS/iPadOS) */\n const isAppleDevice = /Macintosh|iP(?:hone|ad|od)/.test(userAgent);\n\n return isSafari && isAppleDevice; // true for mac-Safari & iOS-Safari\n};\n\nexport const checkIsMobileScreen = (\n breakpoint: number\n): boolean | undefined => {\n if (typeof window === 'undefined') return;\n\n return (window?.innerWidth ?? 0) <= breakpoint;\n};\n\ntype UseDeviceState = {\n isMobileScreen: boolean | undefined;\n isMobileUserAgent: boolean | undefined;\n isMobile: boolean | undefined;\n};\n\nexport const calculateIsMobile = (breakpoint: SizeType | number = 'md') => {\n const breakpointValue = getBreakpointFromSize(breakpoint);\n\n const isMobileUserAgent = checkIsMobileUserAgent();\n const isMobileScreen = checkIsMobileScreen(breakpointValue);\n const isMobile = isMobileScreen ?? isMobileUserAgent;\n\n return {\n isMobileScreen, // Is the screen width within a mobile breakpoint.\n isMobileUserAgent, // Is the user agent indicative of a mobile device.\n isMobile, // Combines both checks to determine if the device is mobile.\n };\n};\n\nexport const useDevice = (breakpoint: SizeType | number = 'md') => {\n const [result, setResult] = useState<UseDeviceState>(\n calculateIsMobile(breakpoint)\n );\n\n useEffect(() => {\n const handleResize = () => {\n setResult(calculateIsMobile(breakpoint));\n };\n\n window.addEventListener('resize', handleResize, { passive: true });\n\n // Cleanup listener on unmount\n return () => window.removeEventListener('resize', handleResize);\n }, [breakpoint]); // Empty dependency array ensures this effect runs only once on mount\n\n return result;\n};\n"],"names":["useState","useEffect"],"mappings":";;;;AAMO,MAAM,w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AE,SAAS,MAAM;AAGjE,WAAO,MAAM,OAAO,oBAAoB,UAAU,YAAY;AAAA,EAChE,GAAG,CAAC,UAAU,CAAC;AAEf,SAAO;AACT;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDevice.mjs","sources":["../../src/hooks/useDevice.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\nexport type SizeType = 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\nexport const getBreakpointFromSize = (breakpoint: SizeType | number) => {\n switch (breakpoint) {\n case 'sm':\n return 640;\n case 'md':\n return 768;\n case 'lg':\n return 1024;\n case 'xl':\n return 1280;\n case '2xl':\n return 1536;\n default:\n return breakpoint;\n }\n};\n\nexport const checkIsMobileUserAgent = (): boolean | undefined => {\n if (typeof window === 'undefined') return;\n\n const userAgent = window.navigator?.userAgent;\n\n if (typeof userAgent === 'undefined') return;\n\n return /android|bb\\d+|meego|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(?:hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(?:ob|in)i|palm(?: os)?|phone|p(?:ixi|re)\\/|plucker|pocket|psp|series(?:4|6)0|symbian|treo|up\\.(?:browser|link)|vodafone|wap|windows ce|windows phone|xda|xiino|zte-/i.test(\n userAgent\n );\n};\n\nexport const checkIsIphoneOrSafariDevice = (): boolean | undefined => {\n if (typeof window === 'undefined') return;\n\n const userAgent = window.navigator?.userAgent;\n\n /* 1 . is it Safari? (Chrome & co. also contain “Safari/…”, so exclude them) */\n const isSafari =\n /Safari\\/\\d/i.test(userAgent) && // has “Safari/xxx”\n !/Chrome|CriOS|FxiOS|Edg|OPR/i.test(userAgent); // …but not the other browsers\n\n /* 2. is it an Apple device? (macOS or iOS/iPadOS) */\n const isAppleDevice = /Macintosh|iP(?:hone|ad|od)/.test(userAgent);\n\n return isSafari && isAppleDevice; // true for mac-Safari & iOS-Safari\n};\n\nexport const checkIsMobileScreen = (\n breakpoint: number\n): boolean | undefined => {\n if (typeof window === 'undefined') return;\n\n return (window?.innerWidth ?? 0) <= breakpoint;\n};\n\ntype UseDeviceState = {\n isMobileScreen: boolean | undefined;\n isMobileUserAgent: boolean | undefined;\n isMobile: boolean | undefined;\n};\n\nexport const calculateIsMobile = (breakpoint: SizeType | number = 'md') => {\n const breakpointValue = getBreakpointFromSize(breakpoint);\n\n const isMobileUserAgent = checkIsMobileUserAgent();\n const isMobileScreen = checkIsMobileScreen(breakpointValue);\n const isMobile = isMobileScreen ?? isMobileUserAgent;\n\n return {\n isMobileScreen, // Is the screen width within a mobile breakpoint.\n isMobileUserAgent, // Is the user agent indicative of a mobile device.\n isMobile, // Combines both checks to determine if the device is mobile.\n };\n};\n\nexport const useDevice = (breakpoint: SizeType | number = 'md') => {\n const [result, setResult] = useState<UseDeviceState>(\n calculateIsMobile(breakpoint)\n );\n\n useEffect(() => {\n const handleResize = () => {\n setResult(calculateIsMobile(breakpoint));\n };\n\n window.addEventListener('resize', handleResize, { passive: true });\n\n // Cleanup listener on unmount\n return () => window.removeEventListener('resize', handleResize);\n }, [breakpoint]); // Empty dependency array ensures this effect runs only once on mount\n\n return result;\n};\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useDevice.mjs","sources":["../../src/hooks/useDevice.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\nexport type SizeType = 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\nexport const getBreakpointFromSize = (breakpoint: SizeType | number) => {\n switch (breakpoint) {\n case 'sm':\n return 640;\n case 'md':\n return 768;\n case 'lg':\n return 1024;\n case 'xl':\n return 1280;\n case '2xl':\n return 1536;\n default:\n return breakpoint;\n }\n};\n\nexport const checkIsMobileUserAgent = (): boolean | undefined => {\n if (typeof window === 'undefined') return;\n\n const userAgent = window.navigator?.userAgent;\n\n if (typeof userAgent === 'undefined') return;\n\n return /android|bb\\d+|meego|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(?:hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(?:ob|in)i|palm(?: os)?|phone|p(?:ixi|re)\\/|plucker|pocket|psp|series(?:4|6)0|symbian|treo|up\\.(?:browser|link)|vodafone|wap|windows ce|windows phone|xda|xiino|zte-/i.test(\n userAgent\n );\n};\n\nexport const checkIsIphoneOrSafariDevice = (): boolean | undefined => {\n if (typeof window === 'undefined') return;\n\n const userAgent = window.navigator?.userAgent;\n\n /* 1 . is it Safari? (Chrome & co. also contain “Safari/…”, so exclude them) */\n const isSafari =\n /Safari\\/\\d/i.test(userAgent) && // has “Safari/xxx”\n !/Chrome|CriOS|FxiOS|Edg|OPR/i.test(userAgent); // …but not the other browsers\n\n /* 2. is it an Apple device? (macOS or iOS/iPadOS) */\n const isAppleDevice = /Macintosh|iP(?:hone|ad|od)/.test(userAgent);\n\n return isSafari && isAppleDevice; // true for mac-Safari & iOS-Safari\n};\n\nexport const checkIsMobileScreen = (\n breakpoint: number\n): boolean | undefined => {\n if (typeof window === 'undefined') return;\n\n return (window?.innerWidth ?? 0) <= breakpoint;\n};\n\ntype UseDeviceState = {\n isMobileScreen: boolean | undefined;\n isMobileUserAgent: boolean | undefined;\n isMobile: boolean | undefined;\n};\n\nexport const calculateIsMobile = (breakpoint: SizeType | number = 'md') => {\n const breakpointValue = getBreakpointFromSize(breakpoint);\n\n const isMobileUserAgent = checkIsMobileUserAgent();\n const isMobileScreen = checkIsMobileScreen(breakpointValue);\n const isMobile = isMobileScreen ?? isMobileUserAgent;\n\n return {\n isMobileScreen, // Is the screen width within a mobile breakpoint.\n isMobileUserAgent, // Is the user agent indicative of a mobile device.\n isMobile, // Combines both checks to determine if the device is mobile.\n };\n};\n\nexport const useDevice = (breakpoint: SizeType | number = 'md') => {\n const [result, setResult] = useState<UseDeviceState>(\n calculateIsMobile(breakpoint)\n );\n\n useEffect(() => {\n const handleResize = () => {\n setResult(calculateIsMobile(breakpoint));\n };\n\n window.addEventListener('resize', handleResize, { passive: true });\n\n // Cleanup listener on unmount\n return () => window.removeEventListener('resize', handleResize);\n }, [breakpoint]); // Empty dependency array ensures this effect runs only once on mount\n\n return result;\n};\n"],"names":[],"mappings":";;AAMO,MAAM,wBAAwB,CAAC,eAAkC;AACtE,UAAQ,YAAA;AAAA,IACN,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EAAA;AAEb;AAEO,MAAM,yBAAyB,MAA2B;AAC/D,MAAI,OAAO,WAAW,YAAa;AAEnC,QAAM,YAAY,OAAO,WAAW;AAEpC,MAAI,OAAO,cAAc,YAAa;AAEtC,SAAO,mVAAmV;AAAA,IACxV;AAAA,EAAA;AAEJ;AAEO,MAAM,8BAA8B,MAA2B;AACpE,MAAI,OAAO,WAAW,YAAa;AAEnC,QAAM,YAAY,OAAO,WAAW;AAGpC,QAAM,WACJ,cAAc,KAAK,SAAS;AAAA,EAC5B,CAAC,8BAA8B,KAAK,SAAS;AAG/C,QAAM,gBAAgB,6BAA6B,KAAK,SAAS;AAEjE,SAAO,YAAY;AACrB;AAEO,MAAM,sBAAsB,CACjC,eACwB;AACxB,MAAI,OAAO,WAAW,YAAa;AAEnC,UAAQ,QAAQ,cAAc,MAAM;AACtC;AAQO,MAAM,oBAAoB,CAAC,aAAgC,SAAS;AACzE,QAAM,kBAAkB,sBAAsB,UAAU;AAExD,QAAM,oBAAoB,uBAAA;AAC1B,QAAM,iBAAiB,oBAAoB,eAAe;AAC1D,QAAM,WAAW,kBAAkB;AAEnC,SAAO;AAAA,IACL;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,EAAA;AAEJ;AAEO,MAAM,YAAY,CAAC,aAAgC,SAAS;AACjE,QAAM,CAAC,QAAQ,SAAS,IAAI;AAAA,IAC1B,kBAAkB,UAAU;AAAA,EAAA;AAG9B,YAAU,MAAM;AACd,UAAM,eAAe,MAAM;AACzB,gBAAU,kBAAkB,UAAU,CAAC;AAAA,IACzC;AAEA,WAAO,iBAAiB,UAAU,cAAc,EAAE,SAAS,MAAM;AAGjE,WAAO,MAAM,OAAO,oBAAoB,UAAU,YAAY;AAAA,EAChE,GAAG,CAAC,UAAU,CAAC;AAEf,SAAO;AACT;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetAllDictionaries.cjs","sources":["../../src/hooks/useGetAllDictionaries.tsx"],"sourcesContent":["'use client';\n\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\nimport type { Dictionary } from '@intlayer/core';\nimport { useDictionariesRecord } from '@intlayer/editor-react';\nimport merge from 'deepmerge';\nimport { useMemo } from 'react';\nimport { useGetDictionaries } from './intlayerAPIHooks';\n\ntype Args = Parameters<typeof useGetDictionaries>;\n\nexport const useGetAllDictionaries = (...props: Args) => {\n const { localeDictionaries } = useDictionariesRecord();\n const { data: onlineDictionariesAPI, isWaitingData } = useGetDictionaries(\n ...props\n );\n\n const onlineDictionaries: Record<string, Dictionary> = useMemo(\n () =>\n (onlineDictionariesAPI?.data ?? []).reduce(\n (acc, dictionary) => {\n acc[dictionary.key] = dictionary;\n return acc;\n },\n {} as Record<string, Dictionary>\n ),\n [onlineDictionariesAPI]\n );\n\n const allDictionaries: Record<string, Dictionary> = useMemo(\n () => merge(onlineDictionaries ?? {}, localeDictionaries),\n [onlineDictionaries, localeDictionaries]\n );\n\n return {\n online: onlineDictionaries,\n locale: localeDictionaries,\n all: allDictionaries,\n isLoading: isWaitingData,\n };\n};\n"],"names":["useDictionariesRecord","useGetDictionaries","useMemo"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"useGetAllDictionaries.cjs","sources":["../../src/hooks/useGetAllDictionaries.tsx"],"sourcesContent":["'use client';\n\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\nimport type { Dictionary } from '@intlayer/core';\nimport { useDictionariesRecord } from '@intlayer/editor-react';\nimport merge from 'deepmerge';\nimport { useMemo } from 'react';\nimport { useGetDictionaries } from './intlayerAPIHooks';\n\ntype Args = Parameters<typeof useGetDictionaries>;\n\nexport const useGetAllDictionaries = (...props: Args) => {\n const { localeDictionaries } = useDictionariesRecord();\n const { data: onlineDictionariesAPI, isWaitingData } = useGetDictionaries(\n ...props\n );\n\n const onlineDictionaries: Record<string, Dictionary> = useMemo(\n () =>\n (onlineDictionariesAPI?.data ?? []).reduce(\n (acc, dictionary) => {\n acc[dictionary.key] = dictionary;\n return acc;\n },\n {} as Record<string, Dictionary>\n ),\n [onlineDictionariesAPI]\n );\n\n const allDictionaries: Record<string, Dictionary> = useMemo(\n () => merge(onlineDictionaries ?? {}, localeDictionaries),\n [onlineDictionaries, localeDictionaries]\n );\n\n return {\n online: onlineDictionaries,\n locale: localeDictionaries,\n all: allDictionaries,\n isLoading: isWaitingData,\n };\n};\n"],"names":["useDictionariesRecord","useGetDictionaries","useMemo"],"mappings":";;;;;;;AAeO,MAAM,wBAAwB,IAAI,UAAgB;AACvD,QAAM,EAAE,mBAAA,IAAuBA,kCAAA;AAC/B,QAAM,EAAE,MAAM,uBAAuB,cAAA,IAAkBC,uBAAAA;AAAAA,IACrD,GAAG;AAAA,EAAA;AAGL,QAAM,qBAAiDC,aAAAA;AAAAA,IACrD,OACG,uBAAuB,QAAQ,CAAA,GAAI;AAAA,MAClC,CAAC,KAAK,eAAe;AACnB,YAAI,WAAW,GAAG,IAAI;AACtB,eAAO;AAAA,MACT;AAAA,MACA,CAAA;AAAA,IAAC;AAAA,IAEL,CAAC,qBAAqB;AAAA,EAAA;AAGxB,QAAM,kBAA8CA,aAAAA;AAAAA,IAClD,MAAM,MAAM,sBAAsB,CAAA,GAAI,kBAAkB;AAAA,IACxD,CAAC,oBAAoB,kBAAkB;AAAA,EAAA;AAGzC,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,KAAK;AAAA,IACL,WAAW;AAAA,EAAA;AAEf;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetAllDictionaries.mjs","sources":["../../src/hooks/useGetAllDictionaries.tsx"],"sourcesContent":["'use client';\n\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\nimport type { Dictionary } from '@intlayer/core';\nimport { useDictionariesRecord } from '@intlayer/editor-react';\nimport merge from 'deepmerge';\nimport { useMemo } from 'react';\nimport { useGetDictionaries } from './intlayerAPIHooks';\n\ntype Args = Parameters<typeof useGetDictionaries>;\n\nexport const useGetAllDictionaries = (...props: Args) => {\n const { localeDictionaries } = useDictionariesRecord();\n const { data: onlineDictionariesAPI, isWaitingData } = useGetDictionaries(\n ...props\n );\n\n const onlineDictionaries: Record<string, Dictionary> = useMemo(\n () =>\n (onlineDictionariesAPI?.data ?? []).reduce(\n (acc, dictionary) => {\n acc[dictionary.key] = dictionary;\n return acc;\n },\n {} as Record<string, Dictionary>\n ),\n [onlineDictionariesAPI]\n );\n\n const allDictionaries: Record<string, Dictionary> = useMemo(\n () => merge(onlineDictionaries ?? {}, localeDictionaries),\n [onlineDictionaries, localeDictionaries]\n );\n\n return {\n online: onlineDictionaries,\n locale: localeDictionaries,\n all: allDictionaries,\n isLoading: isWaitingData,\n };\n};\n"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"useGetAllDictionaries.mjs","sources":["../../src/hooks/useGetAllDictionaries.tsx"],"sourcesContent":["'use client';\n\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\nimport type { Dictionary } from '@intlayer/core';\nimport { useDictionariesRecord } from '@intlayer/editor-react';\nimport merge from 'deepmerge';\nimport { useMemo } from 'react';\nimport { useGetDictionaries } from './intlayerAPIHooks';\n\ntype Args = Parameters<typeof useGetDictionaries>;\n\nexport const useGetAllDictionaries = (...props: Args) => {\n const { localeDictionaries } = useDictionariesRecord();\n const { data: onlineDictionariesAPI, isWaitingData } = useGetDictionaries(\n ...props\n );\n\n const onlineDictionaries: Record<string, Dictionary> = useMemo(\n () =>\n (onlineDictionariesAPI?.data ?? []).reduce(\n (acc, dictionary) => {\n acc[dictionary.key] = dictionary;\n return acc;\n },\n {} as Record<string, Dictionary>\n ),\n [onlineDictionariesAPI]\n );\n\n const allDictionaries: Record<string, Dictionary> = useMemo(\n () => merge(onlineDictionaries ?? {}, localeDictionaries),\n [onlineDictionaries, localeDictionaries]\n );\n\n return {\n online: onlineDictionaries,\n locale: localeDictionaries,\n all: allDictionaries,\n isLoading: isWaitingData,\n };\n};\n"],"names":[],"mappings":";;;;;AAeO,MAAM,wBAAwB,IAAI,UAAgB;AACvD,QAAM,EAAE,mBAAA,IAAuB,sBAAA;AAC/B,QAAM,EAAE,MAAM,uBAAuB,cAAA,IAAkB;AAAA,IACrD,GAAG;AAAA,EAAA;AAGL,QAAM,qBAAiD;AAAA,IACrD,OACG,uBAAuB,QAAQ,CAAA,GAAI;AAAA,MAClC,CAAC,KAAK,eAAe;AACnB,YAAI,WAAW,GAAG,IAAI;AACtB,eAAO;AAAA,MACT;AAAA,MACA,CAAA;AAAA,IAAC;AAAA,IAEL,CAAC,qBAAqB;AAAA,EAAA;AAGxB,QAAM,kBAA8C;AAAA,IAClD,MAAM,MAAM,sBAAsB,CAAA,GAAI,kBAAkB;AAAA,IACxD,CAAC,oBAAoB,kBAAkB;AAAA,EAAA;AAGzC,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,KAAK;AAAA,IACL,WAAW;AAAA,EAAA;AAEf;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetElementOrWindow.cjs","sources":["../../src/hooks/useGetElementOrWindow.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\nexport const useGetElementOrWindow = (container?: HTMLElement) => {\n const [containerElement, setContainerElement] = useState<\n HTMLElement | undefined\n >(container);\n\n // This useEffect avoids the error of not finding the container\n useEffect(() => {\n setContainerElement(container ?? window.document.body);\n }, [container]);\n\n return containerElement;\n};\n"],"names":["useState","useEffect"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"useGetElementOrWindow.cjs","sources":["../../src/hooks/useGetElementOrWindow.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\nexport const useGetElementOrWindow = (container?: HTMLElement) => {\n const [containerElement, setContainerElement] = useState<\n HTMLElement | undefined\n >(container);\n\n // This useEffect avoids the error of not finding the container\n useEffect(() => {\n setContainerElement(container ?? window.document.body);\n }, [container]);\n\n return containerElement;\n};\n"],"names":["useState","useEffect"],"mappings":";;;;AAIO,MAAM,wBAAwB,CAAC,cAA4B;AAChE,QAAM,CAAC,kBAAkB,mBAAmB,IAAIA,aAAAA,SAE9C,SAAS;AAGXC,eAAAA,UAAU,MAAM;AACd,wBAAoB,aAAa,OAAO,SAAS,IAAI;AAAA,EACvD,GAAG,CAAC,SAAS,CAAC;AAEd,SAAO;AACT;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetElementOrWindow.mjs","sources":["../../src/hooks/useGetElementOrWindow.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\nexport const useGetElementOrWindow = (container?: HTMLElement) => {\n const [containerElement, setContainerElement] = useState<\n HTMLElement | undefined\n >(container);\n\n // This useEffect avoids the error of not finding the container\n useEffect(() => {\n setContainerElement(container ?? window.document.body);\n }, [container]);\n\n return containerElement;\n};\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useGetElementOrWindow.mjs","sources":["../../src/hooks/useGetElementOrWindow.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\nexport const useGetElementOrWindow = (container?: HTMLElement) => {\n const [containerElement, setContainerElement] = useState<\n HTMLElement | undefined\n >(container);\n\n // This useEffect avoids the error of not finding the container\n useEffect(() => {\n setContainerElement(container ?? window.document.body);\n }, [container]);\n\n return containerElement;\n};\n"],"names":[],"mappings":";;AAIO,MAAM,wBAAwB,CAAC,cAA4B;AAChE,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAE9C,SAAS;AAGX,YAAU,MAAM;AACd,wBAAoB,aAAa,OAAO,SAAS,IAAI;AAAA,EACvD,GAAG,CAAC,SAAS,CAAC;AAEd,SAAO;AACT;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIntlayerAPI.cjs","sources":["../../src/hooks/useIntlayerAPI.ts"],"sourcesContent":["import {\n getIntlayerAPI,\n type FetcherOptions,\n type IntlayerAPI,\n} from '@intlayer/api';\nimport { type IntlayerConfig } from '@intlayer/config/client';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { getAuthAPI, type AuthAPI } from './auth';\nimport { useAuth } from './useAuth';\n\ntype UseIntlayerAuthProps = {\n options?: FetcherOptions;\n intlayerConfiguration?: IntlayerConfig;\n};\n\nexport const useIntlayerOAuth = (props?: UseIntlayerAuthProps): IntlayerAPI => {\n const configuration = useConfiguration();\n const { oAuth2AccessToken } = useAuth();\n\n return getIntlayerAPI(\n {\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken}`,\n },\n }),\n ...(props?.options ?? {}),\n },\n props?.intlayerConfiguration ?? configuration\n );\n};\n\nexport const useIntlayerAuth = (props?: UseIntlayerAuthProps): AuthAPI => {\n const configuration = useConfiguration();\n\n return getAuthAPI(props?.intlayerConfiguration ?? configuration);\n};\n"],"names":["useConfiguration","useAuth","getIntlayerAPI","getAuthAPI"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useIntlayerAPI.cjs","sources":["../../src/hooks/useIntlayerAPI.ts"],"sourcesContent":["import {\n getIntlayerAPI,\n type FetcherOptions,\n type IntlayerAPI,\n} from '@intlayer/api';\nimport { type IntlayerConfig } from '@intlayer/config/client';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { getAuthAPI, type AuthAPI } from './auth';\nimport { useAuth } from './useAuth';\n\ntype UseIntlayerAuthProps = {\n options?: FetcherOptions;\n intlayerConfiguration?: IntlayerConfig;\n};\n\nexport const useIntlayerOAuth = (props?: UseIntlayerAuthProps): IntlayerAPI => {\n const configuration = useConfiguration();\n const { oAuth2AccessToken } = useAuth();\n\n return getIntlayerAPI(\n {\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken}`,\n },\n }),\n ...(props?.options ?? {}),\n },\n props?.intlayerConfiguration ?? configuration\n );\n};\n\nexport const useIntlayerAuth = (props?: UseIntlayerAuthProps): AuthAPI => {\n const configuration = useConfiguration();\n\n return getAuthAPI(props?.intlayerConfiguration ?? configuration);\n};\n"],"names":["useConfiguration","useAuth","getIntlayerAPI","getAuthAPI"],"mappings":";;;;;;;;;AAeO,MAAM,mBAAmB,CAAC,UAA8C;AAC7E,QAAM,gBAAgBA,YAAAA,iBAAA;AACtB,QAAM,EAAE,kBAAA,IAAsBC,8BAAA;AAE9B,SAAOC,IAAAA;AAAAA,IACL;AAAA,MACE,GAAI,qBAAqB;AAAA,QACvB,SAAS;AAAA,UACP,eAAe,UAAU,iBAAiB;AAAA,QAAA;AAAA,MAC5C;AAAA,MAEF,GAAI,OAAO,WAAW,CAAA;AAAA,IAAC;AAAA,IAEzB,OAAO,yBAAyB;AAAA,EAAA;AAEpC;AAEO,MAAM,kBAAkB,CAAC,UAA0C;AACxE,QAAM,gBAAgBF,YAAAA,iBAAA;AAEtB,SAAOG,sBAAW,OAAO,yBAAyB,aAAa;AACjE;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIntlayerAPI.mjs","sources":["../../src/hooks/useIntlayerAPI.ts"],"sourcesContent":["import {\n getIntlayerAPI,\n type FetcherOptions,\n type IntlayerAPI,\n} from '@intlayer/api';\nimport { type IntlayerConfig } from '@intlayer/config/client';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { getAuthAPI, type AuthAPI } from './auth';\nimport { useAuth } from './useAuth';\n\ntype UseIntlayerAuthProps = {\n options?: FetcherOptions;\n intlayerConfiguration?: IntlayerConfig;\n};\n\nexport const useIntlayerOAuth = (props?: UseIntlayerAuthProps): IntlayerAPI => {\n const configuration = useConfiguration();\n const { oAuth2AccessToken } = useAuth();\n\n return getIntlayerAPI(\n {\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken}`,\n },\n }),\n ...(props?.options ?? {}),\n },\n props?.intlayerConfiguration ?? configuration\n );\n};\n\nexport const useIntlayerAuth = (props?: UseIntlayerAuthProps): AuthAPI => {\n const configuration = useConfiguration();\n\n return getAuthAPI(props?.intlayerConfiguration ?? configuration);\n};\n"],"names":[],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"useIntlayerAPI.mjs","sources":["../../src/hooks/useIntlayerAPI.ts"],"sourcesContent":["import {\n getIntlayerAPI,\n type FetcherOptions,\n type IntlayerAPI,\n} from '@intlayer/api';\nimport { type IntlayerConfig } from '@intlayer/config/client';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { getAuthAPI, type AuthAPI } from './auth';\nimport { useAuth } from './useAuth';\n\ntype UseIntlayerAuthProps = {\n options?: FetcherOptions;\n intlayerConfiguration?: IntlayerConfig;\n};\n\nexport const useIntlayerOAuth = (props?: UseIntlayerAuthProps): IntlayerAPI => {\n const configuration = useConfiguration();\n const { oAuth2AccessToken } = useAuth();\n\n return getIntlayerAPI(\n {\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken}`,\n },\n }),\n ...(props?.options ?? {}),\n },\n props?.intlayerConfiguration ?? configuration\n );\n};\n\nexport const useIntlayerAuth = (props?: UseIntlayerAuthProps): AuthAPI => {\n const configuration = useConfiguration();\n\n return getAuthAPI(props?.intlayerConfiguration ?? configuration);\n};\n"],"names":[],"mappings":";;;;;;;AAeO,MAAM,mBAAmB,CAAC,UAA8C;AAC7E,QAAM,gBAAgB,iBAAA;AACtB,QAAM,EAAE,kBAAA,IAAsB,QAAA;AAE9B,SAAO;AAAA,IACL;AAAA,MACE,GAAI,qBAAqB;AAAA,QACvB,SAAS;AAAA,UACP,eAAe,UAAU,iBAAiB;AAAA,QAAA;AAAA,MAC5C;AAAA,MAEF,GAAI,OAAO,WAAW,CAAA;AAAA,IAAC;AAAA,IAEzB,OAAO,yBAAyB;AAAA,EAAA;AAEpC;AAEO,MAAM,kBAAkB,CAAC,UAA0C;AACxE,QAAM,gBAAgB,iBAAA;AAEtB,SAAO,WAAW,OAAO,yBAAyB,aAAa;AACjE;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsDarkMode.cjs","sources":["../../src/hooks/useIsDarkMode.ts"],"sourcesContent":["'use client';\n\nimport { useState, useEffect } from 'react';\n\nexport const useIsDarkMode = () => {\n const [isDarkMode, setIsDarkMode] = useState(false);\n\n useEffect(() => {\n const htmlElement = document.querySelector('html');\n const isDarkMode = htmlElement?.getAttribute('data-theme') === 'dark';\n setIsDarkMode(isDarkMode);\n }, []);\n\n return isDarkMode;\n};\n"],"names":["useState","useEffect","isDarkMode"],"mappings":";;;;AAIO,MAAM,gBAAgB,MAAM;AACjC,QAAM,CAAC,YAAY,aAAa,IAAIA,aAAAA,SAAS,KAAK;AAElDC,eAAAA,UAAU,MAAM;
|
|
1
|
+
{"version":3,"file":"useIsDarkMode.cjs","sources":["../../src/hooks/useIsDarkMode.ts"],"sourcesContent":["'use client';\n\nimport { useState, useEffect } from 'react';\n\nexport const useIsDarkMode = () => {\n const [isDarkMode, setIsDarkMode] = useState(false);\n\n useEffect(() => {\n const htmlElement = document.querySelector('html');\n const isDarkMode = htmlElement?.getAttribute('data-theme') === 'dark';\n setIsDarkMode(isDarkMode);\n }, []);\n\n return isDarkMode;\n};\n"],"names":["useState","useEffect","isDarkMode"],"mappings":";;;;AAIO,MAAM,gBAAgB,MAAM;AACjC,QAAM,CAAC,YAAY,aAAa,IAAIA,aAAAA,SAAS,KAAK;AAElDC,eAAAA,UAAU,MAAM;AACd,UAAM,cAAc,SAAS,cAAc,MAAM;AACjD,UAAMC,cAAa,aAAa,aAAa,YAAY,MAAM;AAC/D,kBAAcA,WAAU;AAAA,EAC1B,GAAG,CAAA,CAAE;AAEL,SAAO;AACT;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsDarkMode.mjs","sources":["../../src/hooks/useIsDarkMode.ts"],"sourcesContent":["'use client';\n\nimport { useState, useEffect } from 'react';\n\nexport const useIsDarkMode = () => {\n const [isDarkMode, setIsDarkMode] = useState(false);\n\n useEffect(() => {\n const htmlElement = document.querySelector('html');\n const isDarkMode = htmlElement?.getAttribute('data-theme') === 'dark';\n setIsDarkMode(isDarkMode);\n }, []);\n\n return isDarkMode;\n};\n"],"names":["isDarkMode"],"mappings":";;AAIO,MAAM,gBAAgB,MAAM;AACjC,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAElD,YAAU,MAAM;
|
|
1
|
+
{"version":3,"file":"useIsDarkMode.mjs","sources":["../../src/hooks/useIsDarkMode.ts"],"sourcesContent":["'use client';\n\nimport { useState, useEffect } from 'react';\n\nexport const useIsDarkMode = () => {\n const [isDarkMode, setIsDarkMode] = useState(false);\n\n useEffect(() => {\n const htmlElement = document.querySelector('html');\n const isDarkMode = htmlElement?.getAttribute('data-theme') === 'dark';\n setIsDarkMode(isDarkMode);\n }, []);\n\n return isDarkMode;\n};\n"],"names":["isDarkMode"],"mappings":";;AAIO,MAAM,gBAAgB,MAAM;AACjC,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAElD,YAAU,MAAM;AACd,UAAM,cAAc,SAAS,cAAc,MAAM;AACjD,UAAMA,cAAa,aAAa,aAAa,YAAY,MAAM;AAC/D,kBAAcA,WAAU;AAAA,EAC1B,GAAG,CAAA,CAAE;AAEL,SAAO;AACT;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsMounted.cjs","sources":["../../src/hooks/useIsMounted.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\nexport const useIsMounted = () => {\n const [isMounted, setIsMounted] = useState(false);\n\n useEffect(() => {\n setIsMounted(true);\n }, []);\n\n return isMounted;\n};\n"],"names":["useState","useEffect"],"mappings":";;;;AAIO,MAAM,eAAe,MAAM;AAChC,QAAM,CAAC,WAAW,YAAY,IAAIA,aAAAA,SAAS,KAAK;AAEhDC,eAAAA,UAAU,MAAM;AACd,iBAAa,IAAI;AAAA,EACnB,GAAG,
|
|
1
|
+
{"version":3,"file":"useIsMounted.cjs","sources":["../../src/hooks/useIsMounted.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\nexport const useIsMounted = () => {\n const [isMounted, setIsMounted] = useState(false);\n\n useEffect(() => {\n setIsMounted(true);\n }, []);\n\n return isMounted;\n};\n"],"names":["useState","useEffect"],"mappings":";;;;AAIO,MAAM,eAAe,MAAM;AAChC,QAAM,CAAC,WAAW,YAAY,IAAIA,aAAAA,SAAS,KAAK;AAEhDC,eAAAA,UAAU,MAAM;AACd,iBAAa,IAAI;AAAA,EACnB,GAAG,CAAA,CAAE;AAEL,SAAO;AACT;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsMounted.mjs","sources":["../../src/hooks/useIsMounted.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\nexport const useIsMounted = () => {\n const [isMounted, setIsMounted] = useState(false);\n\n useEffect(() => {\n setIsMounted(true);\n }, []);\n\n return isMounted;\n};\n"],"names":[],"mappings":";;AAIO,MAAM,eAAe,MAAM;AAChC,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAEhD,YAAU,MAAM;AACd,iBAAa,IAAI;AAAA,EACnB,GAAG,
|
|
1
|
+
{"version":3,"file":"useIsMounted.mjs","sources":["../../src/hooks/useIsMounted.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\nexport const useIsMounted = () => {\n const [isMounted, setIsMounted] = useState(false);\n\n useEffect(() => {\n setIsMounted(true);\n }, []);\n\n return isMounted;\n};\n"],"names":[],"mappings":";;AAIO,MAAM,eAAe,MAAM;AAChC,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAEhD,YAAU,MAAM;AACd,iBAAa,IAAI;AAAA,EACnB,GAAG,CAAA,CAAE;AAEL,SAAO;AACT;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useItemSelector.cjs","sources":["../../src/hooks/useItemSelector.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState, type MutableRefObject } from 'react';\n\ntype StyleState = {\n left: number;\n width: number;\n opacity: number;\n};\n\nconst selectorDefault = (option: HTMLElement) =>\n option?.getAttribute('aria-selected') === 'true';\n\nexport const useItemSelector = (\n optionsRefs: MutableRefObject<HTMLElement[]>,\n selector: (option: HTMLElement, index: number) => boolean = selectorDefault,\n isHoverable = false\n) => {\n const [choiceIndicatorPosition, setChoiceIndicatorPosition] =\n useState<StyleState | null>(null);\n\n const [hoveredItem, setHoveredItem] = useState<HTMLElement | null>(null);\n\n const itemsLength = optionsRefs.current.length;\n\n useEffect(() => {\n const calculatePosition = () => {\n let targetElement: HTMLElement | null = null;\n\n if (hoveredItem) {\n targetElement = hoveredItem;\n } else {\n targetElement = optionsRefs.current.find(selector) ?? null;\n }\n\n if (!targetElement) {\n setChoiceIndicatorPosition((prev) => ({\n left: 0,\n width: 0,\n ...prev,\n opacity: 0,\n }));\n return;\n }\n\n const left = targetElement.offsetLeft;\n const width = targetElement.offsetWidth;\n\n setChoiceIndicatorPosition({\n left,\n width,\n opacity: 1,\n });\n };\n\n calculatePosition();\n\n // Event listeners for window events\n window.addEventListener('resize', calculatePosition);\n window.addEventListener('DOMContentLoaded', calculatePosition);\n\n // MutationObserver to watch for 'aria-selected' changes\n const mutationObservers: MutationObserver[] = [];\n\n optionsRefs.current.forEach((option) => {\n if (option) {\n const observer = new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (\n mutation.type === 'attributes' &&\n mutation.attributeName === 'aria-selected'\n ) {\n calculatePosition();\n break;\n }\n }\n });\n\n observer.observe(option, {\n attributes: true,\n attributeFilter: ['aria-selected'],\n });\n\n mutationObservers.push(observer);\n }\n });\n\n // ResizeObserver to watch for size changes\n const resizeObservers: ResizeObserver[] = [];\n\n const observeSize = (element: HTMLElement) => {\n if (!element) return;\n const resizeObserver = new ResizeObserver(() => {\n calculatePosition();\n });\n resizeObserver.observe(element);\n resizeObservers.push(resizeObserver);\n };\n\n // Observe the selected item\n const selectedItem = optionsRefs.current.find(selector) ?? null;\n\n if (selectedItem) {\n observeSize(selectedItem);\n }\n\n // Observe the hovered item\n if (hoveredItem) {\n observeSize(hoveredItem);\n }\n\n // Add hover event listeners\n const handleMouseEnter = (event: Event) => {\n setHoveredItem(event.currentTarget as HTMLElement);\n };\n\n const handleMouseLeave = () => {\n setHoveredItem(null);\n };\n\n if (isHoverable) {\n optionsRefs.current.forEach((option) => {\n option?.addEventListener('mouseenter', handleMouseEnter, {\n passive: true,\n });\n option?.addEventListener('mouseleave', handleMouseLeave, {\n passive: true,\n });\n });\n }\n\n return () => {\n // Cleanup window event listeners\n window.removeEventListener('resize', calculatePosition);\n window.removeEventListener('DOMContentLoaded', calculatePosition);\n\n // Disconnect MutationObservers\n mutationObservers.forEach((observer) => observer.disconnect());\n\n // Disconnect ResizeObservers\n resizeObservers.forEach((observer) => observer.disconnect());\n\n // Remove hover event listeners\n optionsRefs.current.forEach((option) => {\n option?.removeEventListener('mouseenter', handleMouseEnter);\n option?.removeEventListener('mouseleave', handleMouseLeave);\n });\n };\n }, [optionsRefs, selector, hoveredItem, itemsLength]);\n\n return { choiceIndicatorPosition };\n};\n"],"names":["useState","useEffect"],"mappings":";;;;AAUA,MAAM,kBAAkB,CAAC,WACvB,QAAQ,aAAa,eAAe,MAAM;AAErC,MAAM,kBAAkB,CAC7B,aACA,WAA4D,iBAC5D,cAAc,UACX;AACH,QAAM,CAAC,yBAAyB,0BAA0B,IACxDA,aAAAA,SAA4B,IAAI;AAElC,QAAM,CAAC,aAAa,cAAc,IAAIA,aAAAA,SAA6B,IAAI;
|
|
1
|
+
{"version":3,"file":"useItemSelector.cjs","sources":["../../src/hooks/useItemSelector.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState, type MutableRefObject } from 'react';\n\ntype StyleState = {\n left: number;\n width: number;\n opacity: number;\n};\n\nconst selectorDefault = (option: HTMLElement) =>\n option?.getAttribute('aria-selected') === 'true';\n\nexport const useItemSelector = (\n optionsRefs: MutableRefObject<HTMLElement[]>,\n selector: (option: HTMLElement, index: number) => boolean = selectorDefault,\n isHoverable = false\n) => {\n const [choiceIndicatorPosition, setChoiceIndicatorPosition] =\n useState<StyleState | null>(null);\n\n const [hoveredItem, setHoveredItem] = useState<HTMLElement | null>(null);\n\n const itemsLength = optionsRefs.current.length;\n\n useEffect(() => {\n const calculatePosition = () => {\n let targetElement: HTMLElement | null = null;\n\n if (hoveredItem) {\n targetElement = hoveredItem;\n } else {\n targetElement = optionsRefs.current.find(selector) ?? null;\n }\n\n if (!targetElement) {\n setChoiceIndicatorPosition((prev) => ({\n left: 0,\n width: 0,\n ...prev,\n opacity: 0,\n }));\n return;\n }\n\n const left = targetElement.offsetLeft;\n const width = targetElement.offsetWidth;\n\n setChoiceIndicatorPosition({\n left,\n width,\n opacity: 1,\n });\n };\n\n calculatePosition();\n\n // Event listeners for window events\n window.addEventListener('resize', calculatePosition);\n window.addEventListener('DOMContentLoaded', calculatePosition);\n\n // MutationObserver to watch for 'aria-selected' changes\n const mutationObservers: MutationObserver[] = [];\n\n optionsRefs.current.forEach((option) => {\n if (option) {\n const observer = new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (\n mutation.type === 'attributes' &&\n mutation.attributeName === 'aria-selected'\n ) {\n calculatePosition();\n break;\n }\n }\n });\n\n observer.observe(option, {\n attributes: true,\n attributeFilter: ['aria-selected'],\n });\n\n mutationObservers.push(observer);\n }\n });\n\n // ResizeObserver to watch for size changes\n const resizeObservers: ResizeObserver[] = [];\n\n const observeSize = (element: HTMLElement) => {\n if (!element) return;\n const resizeObserver = new ResizeObserver(() => {\n calculatePosition();\n });\n resizeObserver.observe(element);\n resizeObservers.push(resizeObserver);\n };\n\n // Observe the selected item\n const selectedItem = optionsRefs.current.find(selector) ?? null;\n\n if (selectedItem) {\n observeSize(selectedItem);\n }\n\n // Observe the hovered item\n if (hoveredItem) {\n observeSize(hoveredItem);\n }\n\n // Add hover event listeners\n const handleMouseEnter = (event: Event) => {\n setHoveredItem(event.currentTarget as HTMLElement);\n };\n\n const handleMouseLeave = () => {\n setHoveredItem(null);\n };\n\n if (isHoverable) {\n optionsRefs.current.forEach((option) => {\n option?.addEventListener('mouseenter', handleMouseEnter, {\n passive: true,\n });\n option?.addEventListener('mouseleave', handleMouseLeave, {\n passive: true,\n });\n });\n }\n\n return () => {\n // Cleanup window event listeners\n window.removeEventListener('resize', calculatePosition);\n window.removeEventListener('DOMContentLoaded', calculatePosition);\n\n // Disconnect MutationObservers\n mutationObservers.forEach((observer) => observer.disconnect());\n\n // Disconnect ResizeObservers\n resizeObservers.forEach((observer) => observer.disconnect());\n\n // Remove hover event listeners\n optionsRefs.current.forEach((option) => {\n option?.removeEventListener('mouseenter', handleMouseEnter);\n option?.removeEventListener('mouseleave', handleMouseLeave);\n });\n };\n }, [optionsRefs, selector, hoveredItem, itemsLength]);\n\n return { choiceInd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3,"file":"useItemSelector.mjs","sources":["../../src/hooks/useItemSelector.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState, type MutableRefObject } from 'react';\n\ntype StyleState = {\n left: number;\n width: number;\n opacity: number;\n};\n\nconst selectorDefault = (option: HTMLElement) =>\n option?.getAttribute('aria-selected') === 'true';\n\nexport const useItemSelector = (\n optionsRefs: MutableRefObject<HTMLElement[]>,\n selector: (option: HTMLElement, index: number) => boolean = selectorDefault,\n isHoverable = false\n) => {\n const [choiceIndicatorPosition, setChoiceIndicatorPosition] =\n useState<StyleState | null>(null);\n\n const [hoveredItem, setHoveredItem] = useState<HTMLElement | null>(null);\n\n const itemsLength = optionsRefs.current.length;\n\n useEffect(() => {\n const calculatePosition = () => {\n let targetElement: HTMLElement | null = null;\n\n if (hoveredItem) {\n targetElement = hoveredItem;\n } else {\n targetElement = optionsRefs.current.find(selector) ?? null;\n }\n\n if (!targetElement) {\n setChoiceIndicatorPosition((prev) => ({\n left: 0,\n width: 0,\n ...prev,\n opacity: 0,\n }));\n return;\n }\n\n const left = targetElement.offsetLeft;\n const width = targetElement.offsetWidth;\n\n setChoiceIndicatorPosition({\n left,\n width,\n opacity: 1,\n });\n };\n\n calculatePosition();\n\n // Event listeners for window events\n window.addEventListener('resize', calculatePosition);\n window.addEventListener('DOMContentLoaded', calculatePosition);\n\n // MutationObserver to watch for 'aria-selected' changes\n const mutationObservers: MutationObserver[] = [];\n\n optionsRefs.current.forEach((option) => {\n if (option) {\n const observer = new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (\n mutation.type === 'attributes' &&\n mutation.attributeName === 'aria-selected'\n ) {\n calculatePosition();\n break;\n }\n }\n });\n\n observer.observe(option, {\n attributes: true,\n attributeFilter: ['aria-selected'],\n });\n\n mutationObservers.push(observer);\n }\n });\n\n // ResizeObserver to watch for size changes\n const resizeObservers: ResizeObserver[] = [];\n\n const observeSize = (element: HTMLElement) => {\n if (!element) return;\n const resizeObserver = new ResizeObserver(() => {\n calculatePosition();\n });\n resizeObserver.observe(element);\n resizeObservers.push(resizeObserver);\n };\n\n // Observe the selected item\n const selectedItem = optionsRefs.current.find(selector) ?? null;\n\n if (selectedItem) {\n observeSize(selectedItem);\n }\n\n // Observe the hovered item\n if (hoveredItem) {\n observeSize(hoveredItem);\n }\n\n // Add hover event listeners\n const handleMouseEnter = (event: Event) => {\n setHoveredItem(event.currentTarget as HTMLElement);\n };\n\n const handleMouseLeave = () => {\n setHoveredItem(null);\n };\n\n if (isHoverable) {\n optionsRefs.current.forEach((option) => {\n option?.addEventListener('mouseenter', handleMouseEnter, {\n passive: true,\n });\n option?.addEventListener('mouseleave', handleMouseLeave, {\n passive: true,\n });\n });\n }\n\n return () => {\n // Cleanup window event listeners\n window.removeEventListener('resize', calculatePosition);\n window.removeEventListener('DOMContentLoaded', calculatePosition);\n\n // Disconnect MutationObservers\n mutationObservers.forEach((observer) => observer.disconnect());\n\n // Disconnect ResizeObservers\n resizeObservers.forEach((observer) => observer.disconnect());\n\n // Remove hover event listeners\n optionsRefs.current.forEach((option) => {\n option?.removeEventListener('mouseenter', handleMouseEnter);\n option?.removeEventListener('mouseleave', handleMouseLeave);\n });\n };\n }, [optionsRefs, selector, hoveredItem, itemsLength]);\n\n return { choiceIndicatorPosition };\n};\n"],"names":[],"mappings":";;AAUA,MAAM,kBAAkB,CAAC,WACvB,QAAQ,aAAa,eAAe,MAAM;AAErC,MAAM,kBAAkB,CAC7B,aACA,WAA4D,iBAC5D,cAAc,UACX;AACH,QAAM,CAAC,yBAAyB,0BAA0B,IACxD,SAA4B,IAAI;AAElC,QAAM,CAAC,aAAa,cAAc,IAAI,SAA6B,IAAI;
|
|
1
|
+
{"version":3,"file":"useItemSelector.mjs","sources":["../../src/hooks/useItemSelector.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState, type MutableRefObject } from 'react';\n\ntype StyleState = {\n left: number;\n width: number;\n opacity: number;\n};\n\nconst selectorDefault = (option: HTMLElement) =>\n option?.getAttribute('aria-selected') === 'true';\n\nexport const useItemSelector = (\n optionsRefs: MutableRefObject<HTMLElement[]>,\n selector: (option: HTMLElement, index: number) => boolean = selectorDefault,\n isHoverable = false\n) => {\n const [choiceIndicatorPosition, setChoiceIndicatorPosition] =\n useState<StyleState | null>(null);\n\n const [hoveredItem, setHoveredItem] = useState<HTMLElement | null>(null);\n\n const itemsLength = optionsRefs.current.length;\n\n useEffect(() => {\n const calculatePosition = () => {\n let targetElement: HTMLElement | null = null;\n\n if (hoveredItem) {\n targetElement = hoveredItem;\n } else {\n targetElement = optionsRefs.current.find(selector) ?? null;\n }\n\n if (!targetElement) {\n setChoiceIndicatorPosition((prev) => ({\n left: 0,\n width: 0,\n ...prev,\n opacity: 0,\n }));\n return;\n }\n\n const left = targetElement.offsetLeft;\n const width = targetElement.offsetWidth;\n\n setChoiceIndicatorPosition({\n left,\n width,\n opacity: 1,\n });\n };\n\n calculatePosition();\n\n // Event listeners for window events\n window.addEventListener('resize', calculatePosition);\n window.addEventListener('DOMContentLoaded', calculatePosition);\n\n // MutationObserver to watch for 'aria-selected' changes\n const mutationObservers: MutationObserver[] = [];\n\n optionsRefs.current.forEach((option) => {\n if (option) {\n const observer = new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (\n mutation.type === 'attributes' &&\n mutation.attributeName === 'aria-selected'\n ) {\n calculatePosition();\n break;\n }\n }\n });\n\n observer.observe(option, {\n attributes: true,\n attributeFilter: ['aria-selected'],\n });\n\n mutationObservers.push(observer);\n }\n });\n\n // ResizeObserver to watch for size changes\n const resizeObservers: ResizeObserver[] = [];\n\n const observeSize = (element: HTMLElement) => {\n if (!element) return;\n const resizeObserver = new ResizeObserver(() => {\n calculatePosition();\n });\n resizeObserver.observe(element);\n resizeObservers.push(resizeObserver);\n };\n\n // Observe the selected item\n const selectedItem = optionsRefs.current.find(selector) ?? null;\n\n if (selectedItem) {\n observeSize(selectedItem);\n }\n\n // Observe the hovered item\n if (hoveredItem) {\n observeSize(hoveredItem);\n }\n\n // Add hover event listeners\n const handleMouseEnter = (event: Event) => {\n setHoveredItem(event.currentTarget as HTMLElement);\n };\n\n const handleMouseLeave = () => {\n setHoveredItem(null);\n };\n\n if (isHoverable) {\n optionsRefs.current.forEach((option) => {\n option?.addEventListener('mouseenter', handleMouseEnter, {\n passive: true,\n });\n option?.addEventListener('mouseleave', handleMouseLeave, {\n passive: true,\n });\n });\n }\n\n return () => {\n // Cleanup window event listeners\n window.removeEventListener('resize', calculatePosition);\n window.removeEventListener('DOMContentLoaded', calculatePosition);\n\n // Disconnect MutationObservers\n mutationObservers.forEach((observer) => observer.disconnect());\n\n // Disconnect ResizeObservers\n resizeObservers.forEach((observer) => observer.disconnect());\n\n // Remove hover event listeners\n optionsRefs.current.forEach((option) => {\n option?.removeEventListener('mouseenter', handleMouseEnter);\n option?.removeEventListener('mouseleave', handleMouseLeave);\n });\n };\n }, [optionsRefs, selector, hoveredItem, itemsLength]);\n\n return { choiceIndicatorPosition };\n};\n"],"names":[],"mappings":";;AAUA,MAAM,kBAAkB,CAAC,WACvB,QAAQ,aAAa,eAAe,MAAM;AAErC,MAAM,kBAAkB,CAC7B,aACA,WAA4D,iBAC5D,cAAc,UACX;AACH,QAAM,CAAC,yBAAyB,0BAA0B,IACxD,SAA4B,IAAI;AAElC,QAAM,CAAC,aAAa,cAAc,IAAI,SAA6B,IAAI;AAEvE,QAAM,cAAc,YAAY,QAAQ;AAExC,YAAU,MAAM;AACd,UAAM,oBAAoB,MAAM;AAC9B,UAAI,gBAAoC;AAExC,UAAI,aAAa;AACf,wBAAgB;AAAA,MAClB,OAAO;AACL,wBAAgB,YAAY,QAAQ,KAAK,QAAQ,KAAK;AAAA,MACxD;AAEA,UAAI,CAAC,eAAe;AAClB,mCAA2B,CAAC,UAAU;AAAA,UACpC,MAAM;AAAA,UACN,OAAO;AAAA,UACP,GAAG;AAAA,UACH,SAAS;AAAA,QAAA,EACT;AACF;AAAA,MACF;AAEA,YAAM,OAAO,cAAc;AAC3B,YAAM,QAAQ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,iBAAiB,cAAc,kBAAkB;AAAA,UACvD,SAAS;AAAA,QAAA,CACV;AAAA,MACH,CAAC;AAAA,IACH;AAEA,WAAO,MAAM;AAEX,aAAO,oBAAoB,UAAU,iBAAiB;AACtD,aAAO,oBAAoB,oBAAoB,iBAAiB;AAGhE,wBAAkB,QAAQ,CAAC,aAAa,SAAS,YAAY;AAG7D,sBAAgB,QAAQ,CAAC,aAAa,SAAS,YAAY;AAG3D,kBAAY,QAAQ,QAAQ,CAAC,WAAW;AACtC,gBAAQ,oBAAoB,cAAc,gBAAgB;AAC1D,gBAAQ,oBAAoB,cAAc,gBAAgB;AAAA,MAC5D,CAAC;AAAA,IACH;AAAA,EACF,GAAG,CAAC,aAAa,UAAU,aAAa,WAAW,CAAC;AAEpD,SAAO,EAAE,wBAAA;AACX;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useKeyboardDetector.cjs","sources":["../../src/hooks/useKeyboardDetector.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\nexport const useKeyboardDetector = () => {\n const [windowHeight, setWindowHeight] = useState<number | null>(null);\n\n useEffect(() => {\n const updateHeight = () => {\n const isKeyboardOpen = Boolean(\n window.visualViewport?.height &&\n window.visualViewport.height < window.innerHeight - 100\n );\n\n if (isKeyboardOpen && window.visualViewport) {\n setWindowHeight(window.visualViewport.height);\n } else {\n setWindowHeight(null);\n }\n };\n\n // Listen for changes in visualViewport height\n window.visualViewport?.addEventListener('resize', updateHeight, {\n passive: true,\n });\n updateHeight(); // Set initial height\n\n return () => {\n window.visualViewport?.removeEventListener('resize', updateHeight);\n };\n }, []);\n\n return { windowHeight, isKeyboardOpen: windowHeight !== null };\n};\n"],"names":["useState","useEffect"],"mappings":";;;;AAIO,MAAM,sBAAsB,MAAM;AACvC,QAAM,CAAC,cAAc,eAAe,IAAIA,aAAAA,SAAwB,IAAI;AAEpEC,eAAAA,UAAU,MAAM;AACd,UAAM,eAAe,MAAM;AACzB,YAAM,iBAAiB;AAAA,QACrB,OAAO,gBAAgB,UACrB,OAAO,eAAe,SAAS,OAAO,cAAc;AAAA,
|
|
1
|
+
{"version":3,"file":"useKeyboardDetector.cjs","sources":["../../src/hooks/useKeyboardDetector.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\nexport const useKeyboardDetector = () => {\n const [windowHeight, setWindowHeight] = useState<number | null>(null);\n\n useEffect(() => {\n const updateHeight = () => {\n const isKeyboardOpen = Boolean(\n window.visualViewport?.height &&\n window.visualViewport.height < window.innerHeight - 100\n );\n\n if (isKeyboardOpen && window.visualViewport) {\n setWindowHeight(window.visualViewport.height);\n } else {\n setWindowHeight(null);\n }\n };\n\n // Listen for changes in visualViewport height\n window.visualViewport?.addEventListener('resize', updateHeight, {\n passive: true,\n });\n updateHeight(); // Set initial height\n\n return () => {\n window.visualViewport?.removeEventListener('resize', updateHeight);\n };\n }, []);\n\n return { windowHeight, isKeyboardOpen: windowHeight !== null };\n};\n"],"names":["useState","useEffect"],"mappings":";;;;AAIO,MAAM,sBAAsB,MAAM;AACvC,QAAM,CAAC,cAAc,eAAe,IAAIA,aAAAA,SAAwB,IAAI;AAEpEC,eAAAA,UAAU,MAAM;AACd,UAAM,eAAe,MAAM;AACzB,YAAM,iBAAiB;AAAA,QACrB,OAAO,gBAAgB,UACrB,OAAO,eAAe,SAAS,OAAO,cAAc;AAAA,MAAA;AAGxD,UAAI,kBAAkB,OAAO,gBAAgB;AAC3C,wBAAgB,OAAO,eAAe,MAAM;AAAA,MAC9C,OAAO;AACL,wBAAgB,IAAI;AAAA,MACtB;AAAA,IACF;AAGA,WAAO,gBAAgB,iBAAiB,UAAU,cAAc;AAAA,MAC9D,SAAS;AAAA,IAAA,CACV;AACD,iBAAA;AAEA,WAAO,MAAM;AACX,aAAO,gBAAgB,oBAAoB,UAAU,YAAY;AAAA,IACnE;AAAA,EACF,GAAG,CAAA,CAAE;AAEL,SAAO,EAAE,cAAc,gBAAgB,iBAAiB,KAAA;AAC1D;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useKeyboardDetector.mjs","sources":["../../src/hooks/useKeyboardDetector.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\nexport const useKeyboardDetector = () => {\n const [windowHeight, setWindowHeight] = useState<number | null>(null);\n\n useEffect(() => {\n const updateHeight = () => {\n const isKeyboardOpen = Boolean(\n window.visualViewport?.height &&\n window.visualViewport.height < window.innerHeight - 100\n );\n\n if (isKeyboardOpen && window.visualViewport) {\n setWindowHeight(window.visualViewport.height);\n } else {\n setWindowHeight(null);\n }\n };\n\n // Listen for changes in visualViewport height\n window.visualViewport?.addEventListener('resize', updateHeight, {\n passive: true,\n });\n updateHeight(); // Set initial height\n\n return () => {\n window.visualViewport?.removeEventListener('resize', updateHeight);\n };\n }, []);\n\n return { windowHeight, isKeyboardOpen: windowHeight !== null };\n};\n"],"names":[],"mappings":";;AAIO,MAAM,sBAAsB,MAAM;AACvC,QAAM,CAAC,cAAc,eAAe,IAAI,SAAwB,IAAI;AAEpE,YAAU,MAAM;AACd,UAAM,eAAe,MAAM;AACzB,YAAM,iBAAiB;AAAA,QACrB,OAAO,gBAAgB,UACrB,OAAO,eAAe,SAAS,OAAO,cAAc;AAAA,
|
|
1
|
+
{"version":3,"file":"useKeyboardDetector.mjs","sources":["../../src/hooks/useKeyboardDetector.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\nexport const useKeyboardDetector = () => {\n const [windowHeight, setWindowHeight] = useState<number | null>(null);\n\n useEffect(() => {\n const updateHeight = () => {\n const isKeyboardOpen = Boolean(\n window.visualViewport?.height &&\n window.visualViewport.height < window.innerHeight - 100\n );\n\n if (isKeyboardOpen && window.visualViewport) {\n setWindowHeight(window.visualViewport.height);\n } else {\n setWindowHeight(null);\n }\n };\n\n // Listen for changes in visualViewport height\n window.visualViewport?.addEventListener('resize', updateHeight, {\n passive: true,\n });\n updateHeight(); // Set initial height\n\n return () => {\n window.visualViewport?.removeEventListener('resize', updateHeight);\n };\n }, []);\n\n return { windowHeight, isKeyboardOpen: windowHeight !== null };\n};\n"],"names":[],"mappings":";;AAIO,MAAM,sBAAsB,MAAM;AACvC,QAAM,CAAC,cAAc,eAAe,IAAI,SAAwB,IAAI;AAEpE,YAAU,MAAM;AACd,UAAM,eAAe,MAAM;AACzB,YAAM,iBAAiB;AAAA,QACrB,OAAO,gBAAgB,UACrB,OAAO,eAAe,SAAS,OAAO,cAAc;AAAA,MAAA;AAGxD,UAAI,kBAAkB,OAAO,gBAAgB;AAC3C,wBAAgB,OAAO,eAAe,MAAM;AAAA,MAC9C,OAAO;AACL,wBAAgB,IAAI;AAAA,MACtB;AAAA,IACF;AAGA,WAAO,gBAAgB,iBAAiB,UAAU,cAAc;AAAA,MAC9D,SAAS;AAAA,IAAA,CACV;AACD,iBAAA;AAEA,WAAO,MAAM;AACX,aAAO,gBAAgB,oBAAoB,UAAU,YAAY;AAAA,IACnE;AAAA,EACF,GAAG,CAAA,CAAE;AAEL,SAAO,EAAE,cAAc,gBAAgB,iBAAiB,KAAA;AAC1D;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePersistedStore.cjs","sources":["../../src/hooks/usePersistedStore.ts"],"sourcesContent":["'use client';\n\nimport {\n useCallback,\n useEffect,\n useMemo,\n useState,\n type Dispatch,\n type SetStateAction,\n} from 'react';\n\nexport const usePersistedStore = <S>(\n key: string,\n initialState?: S | (() => S)\n): [S, Dispatch<SetStateAction<S>>, () => void] => {\n const [state, setState] = useState<S>(() => {\n // If you have an initial value on the client, send a message out immediately\n if (initialState !== undefined) {\n const result: S =\n typeof initialState === 'function'\n ? (initialState as () => S)()\n : initialState;\n\n if (typeof window === 'undefined') return result;\n\n const persistedState = localStorage?.getItem(key);\n\n if (persistedState) {\n try {\n return JSON.parse(persistedState);\n } catch (e) {\n console.error(e);\n }\n }\n\n return result;\n }\n\n return undefined as S;\n });\n\n useEffect(() => {\n const persistedState = localStorage?.getItem(key);\n\n if (persistedState && state === undefined) {\n try {\n setState(JSON.parse(persistedState));\n } catch (e) {\n console.error(e);\n }\n } else if (initialState !== undefined && state === undefined) {\n setState(initialState);\n }\n }, [key, state]);\n\n /**\n * Allows setting state either directly or via a functional update.\n * If passed a function, we merge/update based on the previous state.\n */\n const setStateWrapper: typeof setState = useCallback(\n (valueOrUpdater: SetStateAction<S>) => {\n setState((prev) => {\n const newValue: S =\n typeof valueOrUpdater === 'function'\n ? (valueOrUpdater as (prevVal: S) => S)(prev)\n : valueOrUpdater;\n\n localStorage?.setItem(key, JSON.stringify(newValue));\n\n return newValue;\n });\n },\n [key, setState]\n );\n\n const loadState = useCallback(() => {\n const savedState = localStorage?.getItem(key);\n if (savedState) {\n setState(JSON.parse(savedState));\n }\n }, [key, setState]);\n\n return useMemo(\n () => [state, setStateWrapper, loadState],\n [state, setStateWrapper, loadState]\n );\n};\n"],"names":["useState","useEffect","useCallback","useMemo"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"usePersistedStore.cjs","sources":["../../src/hooks/usePersistedStore.ts"],"sourcesContent":["'use client';\n\nimport {\n useCallback,\n useEffect,\n useMemo,\n useState,\n type Dispatch,\n type SetStateAction,\n} from 'react';\n\nexport const usePersistedStore = <S>(\n key: string,\n initialState?: S | (() => S)\n): [S, Dispatch<SetStateAction<S>>, () => void] => {\n const [state, setState] = useState<S>(() => {\n // If you have an initial value on the client, send a message out immediately\n if (initialState !== undefined) {\n const result: S =\n typeof initialState === 'function'\n ? (initialState as () => S)()\n : initialState;\n\n if (typeof window === 'undefined') return result;\n\n const persistedState = localStorage?.getItem(key);\n\n if (persistedState) {\n try {\n return JSON.parse(persistedState);\n } catch (e) {\n console.error(e);\n }\n }\n\n return result;\n }\n\n return undefined as S;\n });\n\n useEffect(() => {\n const persistedState = localStorage?.getItem(key);\n\n if (persistedState && state === undefined) {\n try {\n setState(JSON.parse(persistedState));\n } catch (e) {\n console.error(e);\n }\n } else if (initialState !== undefined && state === undefined) {\n setState(initialState);\n }\n }, [key, state]);\n\n /**\n * Allows setting state either directly or via a functional update.\n * If passed a function, we merge/update based on the previous state.\n */\n const setStateWrapper: typeof setState = useCallback(\n (valueOrUpdater: SetStateAction<S>) => {\n setState((prev) => {\n const newValue: S =\n typeof valueOrUpdater === 'function'\n ? (valueOrUpdater as (prevVal: S) => S)(prev)\n : valueOrUpdater;\n\n localStorage?.setItem(key, JSON.stringify(newValue));\n\n return newValue;\n });\n },\n [key, setState]\n );\n\n const loadState = useCallback(() => {\n const savedState = localStorage?.getItem(key);\n if (savedState) {\n setState(JSON.parse(savedState));\n }\n }, [key, setState]);\n\n return useMemo(\n () => [state, setStateWrapper, loadState],\n [state, setStateWrapper, loadState]\n );\n};\n"],"names":["useState","useEffect","useCallback","useMemo"],"mappings":";;;;AAWO,MAAM,oBAAoB,CAC/B,KACA,iBACiD;AACjD,QAAM,CAAC,OAAO,QAAQ,IAAIA,aAAAA,SAAY,MAAM;AAE1C,QAAI,iBAAiB,QAAW;AAC9B,YAAM,SACJ,OAAO,iBAAiB,aACnB,iBACD;AAEN,UAAI,OAAO,WAAW,YAAa,QAAO;AAE1C,YAAM,iBAAiB,cAAc,QAAQ,GAAG;AAEhD,UAAI,gBAAgB;AAClB,YAAI;AACF,iBAAO,KAAK,MAAM,cAAc;AAAA,QAClC,SAAS,GAAG;AACV,kBAAQ,MAAM,CAAC;AAAA,QACjB;AAAA,MACF;AAEA,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,CAAC;AAEDC,eAAAA,UAAU,MAAM;AACd,UAAM,iBAAiB,cAAc,QAAQ,GAAG;AAEhD,QAAI,kBAAkB,UAAU,QAAW;AACzC,UAAI;AACF,iBAAS,KAAK,MAAM,cAAc,CAAC;AAAA,MACrC,SAAS,GAAG;AACV,gBAAQ,MAAM,CAAC;AAAA,MACjB;AAAA,IACF,WAAW,iBAAiB,UAAa,UAAU,QAAW;AAC5D,eAAS,YAAY;AAAA,IACvB;AAAA,EACF,GAAG,CAAC,KAAK,KAAK,CAAC;AAMf,QAAM,kBAAmCC,aAAAA;AAAAA,IACvC,CAAC,mBAAsC;AACrC,eAAS,CAAC,SAAS;AACjB,cAAM,WACJ,OAAO,mBAAmB,aACrB,eAAqC,IAAI,IAC1C;AAEN,sBAAc,QAAQ,KAAK,KAAK,UAAU,QAAQ,CAAC;AAEnD,eAAO;AAAA,MACT,CAAC;AAAA,IACH;AAAA,IACA,CAAC,KAAK,QAAQ;AAAA,EAAA;AAGhB,QAAM,YAAYA,aAAAA,YAAY,MAAM;AAClC,UAAM,aAAa,cAAc,QAAQ,GAAG;AAC5C,QAAI,YAAY;AACd,eAAS,KAAK,MAAM,UAAU,CAAC;AAAA,IACjC;AAAA,EACF,GAAG,CAAC,KAAK,QAAQ,CAAC;AAElB,SAAOC,aAAAA;AAAAA,IACL,MAAM,CAAC,OAAO,iBAAiB,SAAS;AAAA,IACxC,CAAC,OAAO,iBAAiB,SAAS;AAAA,EAAA;AAEtC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePersistedStore.mjs","sources":["../../src/hooks/usePersistedStore.ts"],"sourcesContent":["'use client';\n\nimport {\n useCallback,\n useEffect,\n useMemo,\n useState,\n type Dispatch,\n type SetStateAction,\n} from 'react';\n\nexport const usePersistedStore = <S>(\n key: string,\n initialState?: S | (() => S)\n): [S, Dispatch<SetStateAction<S>>, () => void] => {\n const [state, setState] = useState<S>(() => {\n // If you have an initial value on the client, send a message out immediately\n if (initialState !== undefined) {\n const result: S =\n typeof initialState === 'function'\n ? (initialState as () => S)()\n : initialState;\n\n if (typeof window === 'undefined') return result;\n\n const persistedState = localStorage?.getItem(key);\n\n if (persistedState) {\n try {\n return JSON.parse(persistedState);\n } catch (e) {\n console.error(e);\n }\n }\n\n return result;\n }\n\n return undefined as S;\n });\n\n useEffect(() => {\n const persistedState = localStorage?.getItem(key);\n\n if (persistedState && state === undefined) {\n try {\n setState(JSON.parse(persistedState));\n } catch (e) {\n console.error(e);\n }\n } else if (initialState !== undefined && state === undefined) {\n setState(initialState);\n }\n }, [key, state]);\n\n /**\n * Allows setting state either directly or via a functional update.\n * If passed a function, we merge/update based on the previous state.\n */\n const setStateWrapper: typeof setState = useCallback(\n (valueOrUpdater: SetStateAction<S>) => {\n setState((prev) => {\n const newValue: S =\n typeof valueOrUpdater === 'function'\n ? (valueOrUpdater as (prevVal: S) => S)(prev)\n : valueOrUpdater;\n\n localStorage?.setItem(key, JSON.stringify(newValue));\n\n return newValue;\n });\n },\n [key, setState]\n );\n\n const loadState = useCallback(() => {\n const savedState = localStorage?.getItem(key);\n if (savedState) {\n setState(JSON.parse(savedState));\n }\n }, [key, setState]);\n\n return useMemo(\n () => [state, setStateWrapper, loadState],\n [state, setStateWrapper, loadState]\n );\n};\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"usePersistedStore.mjs","sources":["../../src/hooks/usePersistedStore.ts"],"sourcesContent":["'use client';\n\nimport {\n useCallback,\n useEffect,\n useMemo,\n useState,\n type Dispatch,\n type SetStateAction,\n} from 'react';\n\nexport const usePersistedStore = <S>(\n key: string,\n initialState?: S | (() => S)\n): [S, Dispatch<SetStateAction<S>>, () => void] => {\n const [state, setState] = useState<S>(() => {\n // If you have an initial value on the client, send a message out immediately\n if (initialState !== undefined) {\n const result: S =\n typeof initialState === 'function'\n ? (initialState as () => S)()\n : initialState;\n\n if (typeof window === 'undefined') return result;\n\n const persistedState = localStorage?.getItem(key);\n\n if (persistedState) {\n try {\n return JSON.parse(persistedState);\n } catch (e) {\n console.error(e);\n }\n }\n\n return result;\n }\n\n return undefined as S;\n });\n\n useEffect(() => {\n const persistedState = localStorage?.getItem(key);\n\n if (persistedState && state === undefined) {\n try {\n setState(JSON.parse(persistedState));\n } catch (e) {\n console.error(e);\n }\n } else if (initialState !== undefined && state === undefined) {\n setState(initialState);\n }\n }, [key, state]);\n\n /**\n * Allows setting state either directly or via a functional update.\n * If passed a function, we merge/update based on the previous state.\n */\n const setStateWrapper: typeof setState = useCallback(\n (valueOrUpdater: SetStateAction<S>) => {\n setState((prev) => {\n const newValue: S =\n typeof valueOrUpdater === 'function'\n ? (valueOrUpdater as (prevVal: S) => S)(prev)\n : valueOrUpdater;\n\n localStorage?.setItem(key, JSON.stringify(newValue));\n\n return newValue;\n });\n },\n [key, setState]\n );\n\n const loadState = useCallback(() => {\n const savedState = localStorage?.getItem(key);\n if (savedState) {\n setState(JSON.parse(savedState));\n }\n }, [key, setState]);\n\n return useMemo(\n () => [state, setStateWrapper, loadState],\n [state, setStateWrapper, loadState]\n );\n};\n"],"names":[],"mappings":";;AAWO,MAAM,oBAAoB,CAC/B,KACA,iBACiD;AACjD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAY,MAAM;AAE1C,QAAI,iBAAiB,QAAW;AAC9B,YAAM,SACJ,OAAO,iBAAiB,aACnB,iBACD;AAEN,UAAI,OAAO,WAAW,YAAa,QAAO;AAE1C,YAAM,iBAAiB,cAAc,QAAQ,GAAG;AAEhD,UAAI,gBAAgB;AAClB,YAAI;AACF,iBAAO,KAAK,MAAM,cAAc;AAAA,QAClC,SAAS,GAAG;AACV,kBAAQ,MAAM,CAAC;AAAA,QACjB;AAAA,MACF;AAEA,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,CAAC;AAED,YAAU,MAAM;AACd,UAAM,iBAAiB,cAAc,QAAQ,GAAG;AAEhD,QAAI,kBAAkB,UAAU,QAAW;AACzC,UAAI;AACF,iBAAS,KAAK,MAAM,cAAc,CAAC;AAAA,MACrC,SAAS,GAAG;AACV,gBAAQ,MAAM,CAAC;AAAA,MACjB;AAAA,IACF,WAAW,iBAAiB,UAAa,UAAU,QAAW;AAC5D,eAAS,YAAY;AAAA,IACvB;AAAA,EACF,GAAG,CAAC,KAAK,KAAK,CAAC;AAMf,QAAM,kBAAmC;AAAA,IACvC,CAAC,mBAAsC;AACrC,eAAS,CAAC,SAAS;AACjB,cAAM,WACJ,OAAO,mBAAmB,aACrB,eAAqC,IAAI,IAC1C;AAEN,sBAAc,QAAQ,KAAK,KAAK,UAAU,QAAQ,CAAC;AAEnD,eAAO;AAAA,MACT,CAAC;AAAA,IACH;AAAA,IACA,CAAC,KAAK,QAAQ;AAAA,EAAA;AAGhB,QAAM,YAAY,YAAY,MAAM;AAClC,UAAM,aAAa,cAAc,QAAQ,GAAG;AAC5C,QAAI,YAAY;AACd,eAAS,KAAK,MAAM,UAAU,CAAC;AAAA,IACjC;AAAA,EACF,GAAG,CAAC,KAAK,QAAQ,CAAC;AAElB,SAAO;AAAA,IACL,MAAM,CAAC,OAAO,iBAAiB,SAAS;AAAA,IACxC,CAAC,OAAO,iBAAiB,SAAS;AAAA,EAAA;AAEtC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScreenWidth.cjs","sources":["../../src/hooks/useScreenWidth.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\nexport const useScreenWidth = () => {\n const [screenWith, setScreenWith] = useState(0);\n\n useEffect(() => {\n const handleResize = () => {\n setScreenWith(window.innerWidth);\n };\n\n handleResize();\n\n window.addEventListener('resize', handleResize, { passive: true });\n\n return () => window.removeEventListener('resize', handleResize);\n }, []);\n\n return { screenWith };\n};\n"],"names":["useState","useEffect"],"mappings":";;;;AAIO,MAAM,iBAAiB,MAAM;AAClC,QAAM,CAAC,YAAY,aAAa,IAAIA,aAAAA,SAAS,CAAC;AAE9CC,eAAAA,UAAU,MAAM;AACd,UAAM,eAAe,MAAM;AACzB,oBAAc,OAAO,UAAU;AAAA,IACjC;
|
|
1
|
+
{"version":3,"file":"useScreenWidth.cjs","sources":["../../src/hooks/useScreenWidth.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\nexport const useScreenWidth = () => {\n const [screenWith, setScreenWith] = useState(0);\n\n useEffect(() => {\n const handleResize = () => {\n setScreenWith(window.innerWidth);\n };\n\n handleResize();\n\n window.addEventListener('resize', handleResize, { passive: true });\n\n return () => window.removeEventListener('resize', handleResize);\n }, []);\n\n return { screenWith };\n};\n"],"names":["useState","useEffect"],"mappings":";;;;AAIO,MAAM,iBAAiB,MAAM;AAClC,QAAM,CAAC,YAAY,aAAa,IAAIA,aAAAA,SAAS,CAAC;AAE9CC,eAAAA,UAAU,MAAM;AACd,UAAM,eAAe,MAAM;AACzB,oBAAc,OAAO,UAAU;AAAA,IACjC;AAEA,iBAAA;AAEA,WAAO,iBAAiB,UAAU,cAAc,EAAE,SAAS,MAAM;AAEjE,WAAO,MAAM,OAAO,oBAAoB,UAAU,YAAY;AAAA,EAChE,GAAG,CAAA,CAAE;AAEL,SAAO,EAAE,WAAA;AACX;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScreenWidth.mjs","sources":["../../src/hooks/useScreenWidth.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\nexport const useScreenWidth = () => {\n const [screenWith, setScreenWith] = useState(0);\n\n useEffect(() => {\n const handleResize = () => {\n setScreenWith(window.innerWidth);\n };\n\n handleResize();\n\n window.addEventListener('resize', handleResize, { passive: true });\n\n return () => window.removeEventListener('resize', handleResize);\n }, []);\n\n return { screenWith };\n};\n"],"names":[],"mappings":";;AAIO,MAAM,iBAAiB,MAAM;AAClC,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,CAAC;AAE9C,YAAU,MAAM;AACd,UAAM,eAAe,MAAM;AACzB,oBAAc,OAAO,UAAU;AAAA,IACjC;
|
|
1
|
+
{"version":3,"file":"useScreenWidth.mjs","sources":["../../src/hooks/useScreenWidth.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\nexport const useScreenWidth = () => {\n const [screenWith, setScreenWith] = useState(0);\n\n useEffect(() => {\n const handleResize = () => {\n setScreenWith(window.innerWidth);\n };\n\n handleResize();\n\n window.addEventListener('resize', handleResize, { passive: true });\n\n return () => window.removeEventListener('resize', handleResize);\n }, []);\n\n return { screenWith };\n};\n"],"names":[],"mappings":";;AAIO,MAAM,iBAAiB,MAAM;AAClC,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,CAAC;AAE9C,YAAU,MAAM;AACd,UAAM,eAAe,MAAM;AACzB,oBAAc,OAAO,UAAU;AAAA,IACjC;AAEA,iBAAA;AAEA,WAAO,iBAAiB,UAAU,cAAc,EAAE,SAAS,MAAM;AAEjE,WAAO,MAAM,OAAO,oBAAoB,UAAU,YAAY;AAAA,EAChE,GAAG,CAAA,CAAE;AAEL,SAAO,EAAE,WAAA;AACX;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScrollBlockageStore.cjs","sources":["../../../src/hooks/useScrollBlockage/useScrollBlockageStore.ts"],"sourcesContent":["import { create } from 'zustand';\n\ntype Blocker = {\n element: Element;\n blockers: string[];\n};\n\ntype ScrollBlockageStore = {\n scrollBlockers: Blocker[];\n addBlockage: (blockerName: string, element: HTMLElement) => void;\n removeBlockage: (blockerName: string, element: HTMLElement) => void;\n isElementScrollBlocked: (element: HTMLElement) => boolean;\n};\n\nexport const useScrollBlockageStore = create<ScrollBlockageStore>(\n (set, get) => ({\n scrollBlockers: [],\n\n addBlockage: (blockerName: string, element: HTMLElement) =>\n set((state) => {\n const scrollBlockers = state.scrollBlockers;\n const blockersElement = scrollBlockers.find(\n (blocker) => blocker.element === element\n );\n\n if (blockersElement) {\n const isBlockerNameExist =\n blockersElement.blockers.includes(blockerName);\n\n const newBlockers = isBlockerNameExist\n ? blockersElement.blockers\n : [...blockersElement.blockers, blockerName];\n\n return {\n scrollBlockers: scrollBlockers.map((blocker) =>\n blocker.element === element\n ? { ...blocker, blockers: newBlockers }\n : blocker\n ),\n };\n }\n\n element.style.overflowY = 'hidden';\n element.style.overflowX = 'hidden';\n return {\n scrollBlockers: [\n ...scrollBlockers,\n { element, blockers: [blockerName] },\n ],\n };\n }),\n\n removeBlockage: (blockerName: string, element: HTMLElement) =>\n set((state) => {\n const scrollBlockers = state.scrollBlockers;\n const blocker = scrollBlockers.find(\n (blocker) => blocker.element === element\n );\n\n if (blocker) {\n // if there are more than one blocker, remove the blockerName from the list\n if (blocker.blockers.length > 1) {\n return {\n scrollBlockers: scrollBlockers.map((blocker) =>\n blocker.element === element\n ? {\n ...blocker,\n blockers: blocker.blockers.filter(\n (b) => b !== blockerName\n ),\n }\n : blocker\n ),\n };\n }\n\n // if there is only one blocker, remove the full blocker element\n element.style.overflowY = 'auto';\n return {\n scrollBlockers: scrollBlockers.filter(\n (blocker) => blocker.element !== element\n ),\n };\n }\n\n return {\n scrollBlockers,\n };\n }),\n\n isElementScrollBlocked: (element: HTMLElement) =>\n get().scrollBlockers.some((blocker) => blocker.element === element),\n })\n);\n"],"names":["create","blocker"],"mappings":";;;AAcO,MAAM,yBAAyBA,
|
|
1
|
+
{"version":3,"file":"useScrollBlockageStore.cjs","sources":["../../../src/hooks/useScrollBlockage/useScrollBlockageStore.ts"],"sourcesContent":["import { create } from 'zustand';\n\ntype Blocker = {\n element: Element;\n blockers: string[];\n};\n\ntype ScrollBlockageStore = {\n scrollBlockers: Blocker[];\n addBlockage: (blockerName: string, element: HTMLElement) => void;\n removeBlockage: (blockerName: string, element: HTMLElement) => void;\n isElementScrollBlocked: (element: HTMLElement) => boolean;\n};\n\nexport const useScrollBlockageStore = create<ScrollBlockageStore>(\n (set, get) => ({\n scrollBlockers: [],\n\n addBlockage: (blockerName: string, element: HTMLElement) =>\n set((state) => {\n const scrollBlockers = state.scrollBlockers;\n const blockersElement = scrollBlockers.find(\n (blocker) => blocker.element === element\n );\n\n if (blockersElement) {\n const isBlockerNameExist =\n blockersElement.blockers.includes(blockerName);\n\n const newBlockers = isBlockerNameExist\n ? blockersElement.blockers\n : [...blockersElement.blockers, blockerName];\n\n return {\n scrollBlockers: scrollBlockers.map((blocker) =>\n blocker.element === element\n ? { ...blocker, blockers: newBlockers }\n : blocker\n ),\n };\n }\n\n element.style.overflowY = 'hidden';\n element.style.overflowX = 'hidden';\n return {\n scrollBlockers: [\n ...scrollBlockers,\n { element, blockers: [blockerName] },\n ],\n };\n }),\n\n removeBlockage: (blockerName: string, element: HTMLElement) =>\n set((state) => {\n const scrollBlockers = state.scrollBlockers;\n const blocker = scrollBlockers.find(\n (blocker) => blocker.element === element\n );\n\n if (blocker) {\n // if there are more than one blocker, remove the blockerName from the list\n if (blocker.blockers.length > 1) {\n return {\n scrollBlockers: scrollBlockers.map((blocker) =>\n blocker.element === element\n ? {\n ...blocker,\n blockers: blocker.blockers.filter(\n (b) => b !== blockerName\n ),\n }\n : blocker\n ),\n };\n }\n\n // if there is only one blocker, remove the full blocker element\n element.style.overflowY = 'auto';\n return {\n scrollBlockers: scrollBlockers.filter(\n (blocker) => blocker.element !== element\n ),\n };\n }\n\n return {\n scrollBlockers,\n };\n }),\n\n isElementScrollBlocked: (element: HTMLElement) =>\n get().scrollBlockers.some((blocker) => blocker.element === element),\n })\n);\n"],"names":["create","blocker"],"mappings":";;;AAcO,MAAM,yBAAyBA,QAAAA;AAAAA,EACpC,CAAC,KAAK,SAAS;AAAA,IACb,gBAAgB,CAAA;AAAA,IAEhB,aAAa,CAAC,aAAqB,YACjC,IAAI,CAAC,UAAU;AACb,YAAM,iBAAiB,MAAM;AAC7B,YAAM,kBAAkB,eAAe;AAAA,QACrC,CAAC,YAAY,QAAQ,YAAY;AAAA,MAAA;AAGnC,UAAI,iBAAiB;AACnB,cAAM,qBACJ,gBAAgB,SAAS,SAAS,WAAW;AAE/C,cAAM,cAAc,qBAChB,gBAAgB,WAChB,CAAC,GAAG,gBAAgB,UAAU,WAAW;AAE7C,eAAO;AAAA,UACL,gBAAgB,eAAe;AAAA,YAAI,CAAC,YAClC,QAAQ,YAAY,UAChB,EAAE,GAAG,SAAS,UAAU,gBACxB;AAAA,UAAA;AAAA,QACN;AAAA,MAEJ;AAEA,cAAQ,MAAM,YAAY;AAC1B,cAAQ,MAAM,YAAY;AAC1B,aAAO;AAAA,QACL,gBAAgB;AAAA,UACd,GAAG;AAAA,UACH,EAAE,SAAS,UAAU,CAAC,WAAW,EAAA;AAAA,QAAE;AAAA,MACrC;AAAA,IAEJ,CAAC;AAAA,IAEH,gBAAgB,CAAC,aAAqB,YACpC,IAAI,CAAC,UAAU;AACb,YAAM,iBAAiB,MAAM;AAC7B,YAAM,UAAU,eAAe;AAAA,QAC7B,CAACC,aAAYA,SAAQ,YAAY;AAAA,MAAA;AAGnC,UAAI,SAAS;AAEX,YAAI,QAAQ,SAAS,SAAS,GAAG;AAC/B,iBAAO;AAAA,YACL,gBAAgB,eAAe;AAAA,cAAI,CAACA,aAClCA,SAAQ,YAAY,UAChB;AAAA,gBACE,GAAGA;AAAAA,gBACH,UAAUA,SAAQ,SAAS;AAAA,kBACzB,CAAC,MAAM,MAAM;AAAA,gBAAA;AAAA,cACf,IAEFA;AAAAA,YAAA;AAAA,UACN;AAAA,QAEJ;AAGA,gBAAQ,MAAM,YAAY;AAC1B,eAAO;AAAA,UACL,gBAAgB,eAAe;AAAA,YAC7B,CAACA,aAAYA,SAAQ,YAAY;AAAA,UAAA;AAAA,QACnC;AAAA,MAEJ;AAEA,aAAO;AAAA,QACL;AAAA,MAAA;AAAA,IAEJ,CAAC;AAAA,IAEH,wBAAwB,CAAC,YACvB,MAAM,eAAe,KAAK,CAAC,YAAY,QAAQ,YAAY,OAAO;AAAA,EAAA;AAExE;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScrollBlockageStore.mjs","sources":["../../../src/hooks/useScrollBlockage/useScrollBlockageStore.ts"],"sourcesContent":["import { create } from 'zustand';\n\ntype Blocker = {\n element: Element;\n blockers: string[];\n};\n\ntype ScrollBlockageStore = {\n scrollBlockers: Blocker[];\n addBlockage: (blockerName: string, element: HTMLElement) => void;\n removeBlockage: (blockerName: string, element: HTMLElement) => void;\n isElementScrollBlocked: (element: HTMLElement) => boolean;\n};\n\nexport const useScrollBlockageStore = create<ScrollBlockageStore>(\n (set, get) => ({\n scrollBlockers: [],\n\n addBlockage: (blockerName: string, element: HTMLElement) =>\n set((state) => {\n const scrollBlockers = state.scrollBlockers;\n const blockersElement = scrollBlockers.find(\n (blocker) => blocker.element === element\n );\n\n if (blockersElement) {\n const isBlockerNameExist =\n blockersElement.blockers.includes(blockerName);\n\n const newBlockers = isBlockerNameExist\n ? blockersElement.blockers\n : [...blockersElement.blockers, blockerName];\n\n return {\n scrollBlockers: scrollBlockers.map((blocker) =>\n blocker.element === element\n ? { ...blocker, blockers: newBlockers }\n : blocker\n ),\n };\n }\n\n element.style.overflowY = 'hidden';\n element.style.overflowX = 'hidden';\n return {\n scrollBlockers: [\n ...scrollBlockers,\n { element, blockers: [blockerName] },\n ],\n };\n }),\n\n removeBlockage: (blockerName: string, element: HTMLElement) =>\n set((state) => {\n const scrollBlockers = state.scrollBlockers;\n const blocker = scrollBlockers.find(\n (blocker) => blocker.element === element\n );\n\n if (blocker) {\n // if there are more than one blocker, remove the blockerName from the list\n if (blocker.blockers.length > 1) {\n return {\n scrollBlockers: scrollBlockers.map((blocker) =>\n blocker.element === element\n ? {\n ...blocker,\n blockers: blocker.blockers.filter(\n (b) => b !== blockerName\n ),\n }\n : blocker\n ),\n };\n }\n\n // if there is only one blocker, remove the full blocker element\n element.style.overflowY = 'auto';\n return {\n scrollBlockers: scrollBlockers.filter(\n (blocker) => blocker.element !== element\n ),\n };\n }\n\n return {\n scrollBlockers,\n };\n }),\n\n isElementScrollBlocked: (element: HTMLElement) =>\n get().scrollBlockers.some((blocker) => blocker.element === element),\n })\n);\n"],"names":["blocker"],"mappings":";AAcO,MAAM,yBAAyB;AAAA,EACpC,CAAC,KAAK,SAAS;AAAA,IACb,gBAAgB,
|
|
1
|
+
{"version":3,"file":"useScrollBlockageStore.mjs","sources":["../../../src/hooks/useScrollBlockage/useScrollBlockageStore.ts"],"sourcesContent":["import { create } from 'zustand';\n\ntype Blocker = {\n element: Element;\n blockers: string[];\n};\n\ntype ScrollBlockageStore = {\n scrollBlockers: Blocker[];\n addBlockage: (blockerName: string, element: HTMLElement) => void;\n removeBlockage: (blockerName: string, element: HTMLElement) => void;\n isElementScrollBlocked: (element: HTMLElement) => boolean;\n};\n\nexport const useScrollBlockageStore = create<ScrollBlockageStore>(\n (set, get) => ({\n scrollBlockers: [],\n\n addBlockage: (blockerName: string, element: HTMLElement) =>\n set((state) => {\n const scrollBlockers = state.scrollBlockers;\n const blockersElement = scrollBlockers.find(\n (blocker) => blocker.element === element\n );\n\n if (blockersElement) {\n const isBlockerNameExist =\n blockersElement.blockers.includes(blockerName);\n\n const newBlockers = isBlockerNameExist\n ? blockersElement.blockers\n : [...blockersElement.blockers, blockerName];\n\n return {\n scrollBlockers: scrollBlockers.map((blocker) =>\n blocker.element === element\n ? { ...blocker, blockers: newBlockers }\n : blocker\n ),\n };\n }\n\n element.style.overflowY = 'hidden';\n element.style.overflowX = 'hidden';\n return {\n scrollBlockers: [\n ...scrollBlockers,\n { element, blockers: [blockerName] },\n ],\n };\n }),\n\n removeBlockage: (blockerName: string, element: HTMLElement) =>\n set((state) => {\n const scrollBlockers = state.scrollBlockers;\n const blocker = scrollBlockers.find(\n (blocker) => blocker.element === element\n );\n\n if (blocker) {\n // if there are more than one blocker, remove the blockerName from the list\n if (blocker.blockers.length > 1) {\n return {\n scrollBlockers: scrollBlockers.map((blocker) =>\n blocker.element === element\n ? {\n ...blocker,\n blockers: blocker.blockers.filter(\n (b) => b !== blockerName\n ),\n }\n : blocker\n ),\n };\n }\n\n // if there is only one blocker, remove the full blocker element\n element.style.overflowY = 'auto';\n return {\n scrollBlockers: scrollBlockers.filter(\n (blocker) => blocker.element !== element\n ),\n };\n }\n\n return {\n scrollBlockers,\n };\n }),\n\n isElementScrollBlocked: (element: HTMLElement) =>\n get().scrollBlockers.some((blocker) => blocker.element === element),\n })\n);\n"],"names":["blocker"],"mappings":";AAcO,MAAM,yBAAyB;AAAA,EACpC,CAAC,KAAK,SAAS;AAAA,IACb,gBAAgB,CAAA;AAAA,IAEhB,aAAa,CAAC,aAAqB,YACjC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