@sakoa/ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +171 -0
- package/dist/App.d.ts +2 -0
- package/dist/cli/index.js +9243 -0
- package/dist/components/DemoSection.d.ts +30 -0
- package/dist/components/SApiKeyboard.d.ts +22 -0
- package/dist/components/SApiSection.d.ts +21 -0
- package/dist/components/SApiTable.d.ts +46 -0
- package/dist/components/STableOfContents.d.ts +2 -0
- package/dist/components/ui/SAlert.d.ts +76 -0
- package/dist/components/ui/SBadge.d.ts +56 -0
- package/dist/components/ui/SButton.d.ts +67 -0
- package/dist/components/ui/SCheckbox.d.ts +64 -0
- package/dist/components/ui/SChip.d.ts +43 -0
- package/dist/components/ui/SDatePicker.d.ts +77 -0
- package/dist/components/ui/SGlassButton.d.ts +70 -0
- package/dist/components/ui/SIcon.d.ts +29 -0
- package/dist/components/ui/SInput.d.ts +129 -0
- package/dist/components/ui/SKbd.d.ts +24 -0
- package/dist/components/ui/SKbdShortcut.d.ts +14 -0
- package/dist/components/ui/SSelect.d.ts +148 -0
- package/dist/components/ui/SSkeleton.d.ts +37 -0
- package/dist/components/ui/SSwitch.d.ts +61 -0
- package/dist/components/ui/STooltip.d.ts +82 -0
- package/dist/components/ui/accordion/SAccordionContent.d.ts +23 -0
- package/dist/components/ui/accordion/SAccordionItem.d.ts +70 -0
- package/dist/components/ui/accordion/SAccordionTrigger.d.ts +37 -0
- package/dist/components/ui/accordion/index.d.ts +4 -0
- package/dist/components/ui/avatar/SAvatar.d.ts +36 -0
- package/dist/components/ui/avatar/SAvatarFallback.d.ts +26 -0
- package/dist/components/ui/avatar/SAvatarGroup.d.ts +30 -0
- package/dist/components/ui/avatar/SAvatarImage.d.ts +23 -0
- package/dist/components/ui/avatar/index.d.ts +4 -0
- package/dist/components/ui/breadcrumb/SBreadcrumb.d.ts +22 -0
- package/dist/components/ui/breadcrumb/SBreadcrumbEllipsis.d.ts +17 -0
- package/dist/components/ui/breadcrumb/SBreadcrumbItem.d.ts +17 -0
- package/dist/components/ui/breadcrumb/SBreadcrumbLink.d.ts +26 -0
- package/dist/components/ui/breadcrumb/SBreadcrumbList.d.ts +17 -0
- package/dist/components/ui/breadcrumb/SBreadcrumbPage.d.ts +17 -0
- package/dist/components/ui/breadcrumb/SBreadcrumbSeparator.d.ts +17 -0
- package/dist/components/ui/breadcrumb/index.d.ts +7 -0
- package/dist/components/ui/card/SCard.d.ts +103 -0
- package/dist/components/ui/card/SCardActions.d.ts +44 -0
- package/dist/components/ui/card/SCardContent.d.ts +35 -0
- package/dist/components/ui/card/SCardFooter.d.ts +38 -0
- package/dist/components/ui/card/SCardHeader.d.ts +53 -0
- package/dist/components/ui/card/SCardMedia.d.ts +83 -0
- package/dist/components/ui/card/SGlassCard.d.ts +103 -0
- package/dist/components/ui/card/SMorphingCardContent.d.ts +18 -0
- package/dist/components/ui/card/index.d.ts +24 -0
- package/dist/components/ui/carousel/SCarousel.d.ts +166 -0
- package/dist/components/ui/carousel/index.d.ts +2 -0
- package/dist/components/ui/color-picker/SColorPickerAlphaSlider.d.ts +4 -0
- package/dist/components/ui/color-picker/SColorPickerCopy.d.ts +19 -0
- package/dist/components/ui/color-picker/SColorPickerEyeDropper.d.ts +17 -0
- package/dist/components/ui/color-picker/SColorPickerHueSlider.d.ts +4 -0
- package/dist/components/ui/color-picker/SColorPickerInputs.d.ts +2 -0
- package/dist/components/ui/color-picker/SColorPickerPresets.d.ts +9 -0
- package/dist/components/ui/color-picker/SColorPickerPreview.d.ts +2 -0
- package/dist/components/ui/color-picker/SColorPickerRecent.d.ts +7 -0
- package/dist/components/ui/color-picker/SColorPickerSpectrum.d.ts +4 -0
- package/dist/components/ui/color-picker/index.d.ts +11 -0
- package/dist/components/ui/drawer/index.d.ts +11 -0
- package/dist/components/ui/dropdown/SDropdownDivider.d.ts +8 -0
- package/dist/components/ui/dropdown/SDropdownGroup.d.ts +25 -0
- package/dist/components/ui/dropdown/SDropdownItem.d.ts +56 -0
- package/dist/components/ui/dropdown/index.d.ts +4 -0
- package/dist/components/ui/form/SForm.d.ts +38 -0
- package/dist/components/ui/form/SFormField.d.ts +31 -0
- package/dist/components/ui/form/index.d.ts +5 -0
- package/dist/components/ui/modal/index.d.ts +19 -0
- package/dist/components/ui/option/SOption.d.ts +32 -0
- package/dist/components/ui/option/SOptionGroup.d.ts +28 -0
- package/dist/components/ui/option/index.d.ts +2 -0
- package/dist/components/ui/otp/SOTP.d.ts +122 -0
- package/dist/components/ui/otp/SOTPGroup.d.ts +23 -0
- package/dist/components/ui/otp/SOTPSeparator.d.ts +17 -0
- package/dist/components/ui/otp/SOTPSlot.d.ts +49 -0
- package/dist/components/ui/otp/index.d.ts +7 -0
- package/dist/components/ui/otp/types.d.ts +26 -0
- package/dist/components/ui/otp/useOTPContext.d.ts +42 -0
- package/dist/components/ui/pagination/SPagination.d.ts +151 -0
- package/dist/components/ui/pagination/index.d.ts +2 -0
- package/dist/components/ui/progress/SProgress.d.ts +62 -0
- package/dist/components/ui/progress/SProgressRange.d.ts +91 -0
- package/dist/components/ui/progress/index.d.ts +4 -0
- package/dist/components/ui/radio/SRadio.d.ts +58 -0
- package/dist/components/ui/radio/SRadioGroup.d.ts +52 -0
- package/dist/components/ui/radio/index.d.ts +2 -0
- package/dist/components/ui/stepper/SStepper.d.ts +83 -0
- package/dist/components/ui/stepper/SStepperContent.d.ts +24 -0
- package/dist/components/ui/stepper/SStepperDescription.d.ts +20 -0
- package/dist/components/ui/stepper/SStepperIndicator.d.ts +37 -0
- package/dist/components/ui/stepper/SStepperItem.d.ts +37 -0
- package/dist/components/ui/stepper/SStepperSeparator.d.ts +5 -0
- package/dist/components/ui/stepper/SStepperTitle.d.ts +20 -0
- package/dist/components/ui/stepper/SStepperTrigger.d.ts +22 -0
- package/dist/components/ui/stepper/index.d.ts +11 -0
- package/dist/components/ui/table/STableBody.d.ts +27 -0
- package/dist/components/ui/table/STableCell.d.ts +55 -0
- package/dist/components/ui/table/STableColumn.d.ts +87 -0
- package/dist/components/ui/table/STableEmpty.d.ts +54 -0
- package/dist/components/ui/table/STableHeader.d.ts +25 -0
- package/dist/components/ui/table/STableRow.d.ts +38 -0
- package/dist/components/ui/table/STableSkeleton.d.ts +29 -0
- package/dist/components/ui/table/index.d.ts +98 -0
- package/dist/components/ui/table/useDataTable.d.ts +80 -0
- package/dist/components/ui/tabs/STabPane.d.ts +31 -0
- package/dist/components/ui/tabs/STabsContent.d.ts +21 -0
- package/dist/components/ui/tabs/STabsIndicator.d.ts +9 -0
- package/dist/components/ui/tabs/STabsTrigger.d.ts +28 -0
- package/dist/components/ui/tabs/index.d.ts +6 -0
- package/dist/components/ui/toast/SToast.d.ts +49 -0
- package/dist/components/ui/toast/SToastContainer.d.ts +21 -0
- package/dist/components/ui/toast/index.d.ts +2 -0
- package/dist/composables/useAsync.d.ts +134 -0
- package/dist/composables/useClickOutside.d.ts +69 -0
- package/dist/composables/useClipboard.d.ts +46 -0
- package/dist/composables/useDebounce.d.ts +150 -0
- package/dist/composables/useDialog.d.ts +118 -0
- package/dist/composables/useForm.d.ts +204 -0
- package/dist/composables/useHotkey.d.ts +128 -0
- package/dist/composables/useIntersectionObserver.d.ts +156 -0
- package/dist/composables/useLocalStorage.d.ts +120 -0
- package/dist/composables/useMediaQuery.d.ts +115 -0
- package/dist/composables/useTheme.d.ts +8 -0
- package/dist/composables/useToast.d.ts +1619 -0
- package/dist/index.d.ts +71 -0
- package/dist/layouts/UILayout.d.ts +2 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/main.d.ts +0 -0
- package/dist/router.d.ts +2 -0
- package/dist/saka-ui.css +1 -0
- package/dist/saka-ui.js +18513 -0
- package/dist/saka-ui.umd.cjs +38 -0
- package/dist/views/docs/CustomizationView.d.ts +2 -0
- package/dist/views/docs/FormValidationView.d.ts +2 -0
- package/dist/views/docs/StylingGuideView.d.ts +2 -0
- package/dist/views/docs/UseAsyncView.d.ts +2 -0
- package/dist/views/docs/UseClickOutsideView.d.ts +124 -0
- package/dist/views/docs/UseClipboardView.d.ts +4 -0
- package/dist/views/docs/UseDebounceView.d.ts +2 -0
- package/dist/views/docs/UseHotkeyView.d.ts +205 -0
- package/dist/views/docs/UseIntersectionObserverView.d.ts +5 -0
- package/dist/views/docs/UseLocalStorageView.d.ts +2 -0
- package/dist/views/docs/UseMediaQueryView.d.ts +2 -0
- package/dist/views/docs/UseThemeView.d.ts +2 -0
- package/dist/views/examples/AuthFormView.d.ts +2 -0
- package/dist/views/examples/CreditCardFormView.d.ts +6 -0
- package/dist/views/examples/FormFieldExampleView.d.ts +2 -0
- package/dist/views/examples/ProjectFormView.d.ts +2 -0
- package/dist/views/ui/AccordionView.d.ts +2 -0
- package/dist/views/ui/AlertView.d.ts +2 -0
- package/dist/views/ui/AvatarView.d.ts +2 -0
- package/dist/views/ui/BadgeView.d.ts +2 -0
- package/dist/views/ui/BreadcrumbView.d.ts +2 -0
- package/dist/views/ui/ButtonView.d.ts +2 -0
- package/dist/views/ui/CardView.d.ts +2 -0
- package/dist/views/ui/CarouselView.d.ts +274 -0
- package/dist/views/ui/CheckboxView.d.ts +2 -0
- package/dist/views/ui/ChipView.d.ts +2 -0
- package/dist/views/ui/ColorPickerView.d.ts +2 -0
- package/dist/views/ui/DatePickerView.d.ts +2 -0
- package/dist/views/ui/DialogView.d.ts +2 -0
- package/dist/views/ui/DrawerView.d.ts +2 -0
- package/dist/views/ui/DropdownView.d.ts +2 -0
- package/dist/views/ui/GlassButtonView.d.ts +2 -0
- package/dist/views/ui/GlassCardView.d.ts +2 -0
- package/dist/views/ui/HomeView.d.ts +2 -0
- package/dist/views/ui/IconsView.d.ts +2 -0
- package/dist/views/ui/InputView.d.ts +2 -0
- package/dist/views/ui/KbdView.d.ts +2 -0
- package/dist/views/ui/ModalView.d.ts +2 -0
- package/dist/views/ui/MorphingCardView.d.ts +2 -0
- package/dist/views/ui/MorphingModalView.d.ts +2 -0
- package/dist/views/ui/OTPView.d.ts +206 -0
- package/dist/views/ui/PaginationView.d.ts +2 -0
- package/dist/views/ui/ProgressView.d.ts +2 -0
- package/dist/views/ui/RadioView.d.ts +2 -0
- package/dist/views/ui/SelectView.d.ts +2 -0
- package/dist/views/ui/SkeletonView.d.ts +2 -0
- package/dist/views/ui/StepperView.d.ts +2 -0
- package/dist/views/ui/SwitchView.d.ts +2 -0
- package/dist/views/ui/TableView.d.ts +2 -0
- package/dist/views/ui/TabsView.d.ts +2 -0
- package/dist/views/ui/ToastView.d.ts +2 -0
- package/dist/views/ui/TooltipView.d.ts +2 -0
- package/dist/vite.svg +1 -0
- package/package.json +64 -0
- package/registry/components/accordion.json +19 -0
- package/registry/components/alert.json +17 -0
- package/registry/components/avatar.json +18 -0
- package/registry/components/badge.json +14 -0
- package/registry/components/breadcrumb.json +24 -0
- package/registry/components/button.json +17 -0
- package/registry/components/card.json +23 -0
- package/registry/components/carousel.json +19 -0
- package/registry/components/checkbox.json +17 -0
- package/registry/components/chip.json +17 -0
- package/registry/components/color-picker.json +24 -0
- package/registry/components/date-picker.json +17 -0
- package/registry/components/drawer.json +26 -0
- package/registry/components/dropdown.json +21 -0
- package/registry/components/form.json +16 -0
- package/registry/components/glass-button.json +17 -0
- package/registry/components/icon.json +17 -0
- package/registry/components/input.json +17 -0
- package/registry/components/kbd.json +16 -0
- package/registry/components/modal.json +32 -0
- package/registry/components/option.json +16 -0
- package/registry/components/otp.json +23 -0
- package/registry/components/pagination.json +18 -0
- package/registry/components/progress.json +16 -0
- package/registry/components/radio.json +19 -0
- package/registry/components/select.json +17 -0
- package/registry/components/skeleton.json +14 -0
- package/registry/components/switch.json +17 -0
- package/registry/components/table.json +26 -0
- package/registry/components/tabs.json +19 -0
- package/registry/components/toast.json +19 -0
- package/registry/components/tooltip.json +14 -0
- package/registry/index.json +4 -0
- package/registry/source/components/ui/SAlert.vue +388 -0
- package/registry/source/components/ui/SBadge.vue +243 -0
- package/registry/source/components/ui/SButton.vue +387 -0
- package/registry/source/components/ui/SCheckbox.vue +310 -0
- package/registry/source/components/ui/SChip.vue +130 -0
- package/registry/source/components/ui/SDatePicker.vue +1290 -0
- package/registry/source/components/ui/SGlassButton.vue +547 -0
- package/registry/source/components/ui/SIcon.vue +78 -0
- package/registry/source/components/ui/SInput.vue +1054 -0
- package/registry/source/components/ui/SKbd.vue +96 -0
- package/registry/source/components/ui/SKbdShortcut.vue +36 -0
- package/registry/source/components/ui/SSelect.vue +1290 -0
- package/registry/source/components/ui/SSkeleton.vue +185 -0
- package/registry/source/components/ui/SSwitch.vue +275 -0
- package/registry/source/components/ui/STooltip.vue +491 -0
- package/registry/source/components/ui/accordion/SAccordion.vue +248 -0
- package/registry/source/components/ui/accordion/SAccordionItem.vue +353 -0
- package/registry/source/components/ui/accordion/index.ts +5 -0
- package/registry/source/components/ui/avatar/SAvatar.vue +169 -0
- package/registry/source/components/ui/avatar/SAvatarFallback.vue +66 -0
- package/registry/source/components/ui/avatar/SAvatarGroup.vue +69 -0
- package/registry/source/components/ui/avatar/SAvatarImage.vue +92 -0
- package/registry/source/components/ui/avatar/index.ts +5 -0
- package/registry/source/components/ui/breadcrumb/SBreadcrumb.vue +23 -0
- package/registry/source/components/ui/breadcrumb/SBreadcrumbEllipsis.vue +17 -0
- package/registry/source/components/ui/breadcrumb/SBreadcrumbItem.vue +14 -0
- package/registry/source/components/ui/breadcrumb/SBreadcrumbLink.vue +46 -0
- package/registry/source/components/ui/breadcrumb/SBreadcrumbList.vue +17 -0
- package/registry/source/components/ui/breadcrumb/SBreadcrumbPage.vue +15 -0
- package/registry/source/components/ui/breadcrumb/SBreadcrumbSeparator.vue +18 -0
- package/registry/source/components/ui/breadcrumb/index.ts +7 -0
- package/registry/source/components/ui/card/SCard.vue +517 -0
- package/registry/source/components/ui/card/SCardActions.vue +129 -0
- package/registry/source/components/ui/card/SCardContent.vue +117 -0
- package/registry/source/components/ui/card/SCardFooter.vue +103 -0
- package/registry/source/components/ui/card/SCardHeader.vue +163 -0
- package/registry/source/components/ui/card/SCardMedia.vue +312 -0
- package/registry/source/components/ui/card/index.ts +34 -0
- package/registry/source/components/ui/carousel/SCarousel.vue +1069 -0
- package/registry/source/components/ui/carousel/SCarouselSlide.vue +107 -0
- package/registry/source/components/ui/carousel/index.ts +3 -0
- package/registry/source/components/ui/color-picker/SColorPicker.vue +772 -0
- package/registry/source/components/ui/color-picker/SColorPickerAlphaSlider.vue +158 -0
- package/registry/source/components/ui/color-picker/SColorPickerCopy.vue +76 -0
- package/registry/source/components/ui/color-picker/SColorPickerEyeDropper.vue +68 -0
- package/registry/source/components/ui/color-picker/SColorPickerHueSlider.vue +138 -0
- package/registry/source/components/ui/color-picker/SColorPickerInputs.vue +227 -0
- package/registry/source/components/ui/color-picker/SColorPickerPresets.vue +87 -0
- package/registry/source/components/ui/color-picker/SColorPickerPreview.vue +46 -0
- package/registry/source/components/ui/color-picker/SColorPickerRecent.vue +74 -0
- package/registry/source/components/ui/color-picker/SColorPickerSpectrum.vue +149 -0
- package/registry/source/components/ui/color-picker/index.ts +11 -0
- package/registry/source/components/ui/drawer/SDrawer.vue +797 -0
- package/registry/source/components/ui/drawer/SDrawerClose.vue +64 -0
- package/registry/source/components/ui/drawer/SDrawerContent.vue +81 -0
- package/registry/source/components/ui/drawer/SDrawerDescription.vue +40 -0
- package/registry/source/components/ui/drawer/SDrawerFooter.vue +97 -0
- package/registry/source/components/ui/drawer/SDrawerHandle.vue +79 -0
- package/registry/source/components/ui/drawer/SDrawerHeader.vue +117 -0
- package/registry/source/components/ui/drawer/SDrawerTitle.vue +40 -0
- package/registry/source/components/ui/drawer/SDrawerTrigger.vue +51 -0
- package/registry/source/components/ui/drawer/index.ts +20 -0
- package/registry/source/components/ui/dropdown/SDropdown.vue +843 -0
- package/registry/source/components/ui/dropdown/SDropdownDivider.vue +23 -0
- package/registry/source/components/ui/dropdown/SDropdownGroup.vue +53 -0
- package/registry/source/components/ui/dropdown/SDropdownItem.vue +179 -0
- package/registry/source/components/ui/dropdown/index.ts +5 -0
- package/registry/source/components/ui/form/SForm.vue +84 -0
- package/registry/source/components/ui/form/SFormField.vue +78 -0
- package/registry/source/components/ui/form/index.ts +8 -0
- package/registry/source/components/ui/modal/SModal.vue +648 -0
- package/registry/source/components/ui/modal/SModalClose.vue +49 -0
- package/registry/source/components/ui/modal/SModalContent.vue +74 -0
- package/registry/source/components/ui/modal/SModalDescription.vue +39 -0
- package/registry/source/components/ui/modal/SModalFooter.vue +84 -0
- package/registry/source/components/ui/modal/SModalHeader.vue +107 -0
- package/registry/source/components/ui/modal/SModalTitle.vue +39 -0
- package/registry/source/components/ui/modal/SModalTrigger.vue +61 -0
- package/registry/source/components/ui/modal/SMorphingModal.vue +429 -0
- package/registry/source/components/ui/modal/SMorphingModalClose.vue +42 -0
- package/registry/source/components/ui/modal/SMorphingModalDescription.vue +49 -0
- package/registry/source/components/ui/modal/SMorphingModalImage.vue +44 -0
- package/registry/source/components/ui/modal/SMorphingModalSubtitle.vue +29 -0
- package/registry/source/components/ui/modal/SMorphingModalTitle.vue +34 -0
- package/registry/source/components/ui/modal/SMorphingModalTrigger.vue +95 -0
- package/registry/source/components/ui/modal/index.ts +32 -0
- package/registry/source/components/ui/option/SOption.vue +180 -0
- package/registry/source/components/ui/option/SOptionGroup.vue +77 -0
- package/registry/source/components/ui/option/index.ts +3 -0
- package/registry/source/components/ui/otp/SOTP.vue +843 -0
- package/registry/source/components/ui/otp/SOTPGroup.vue +29 -0
- package/registry/source/components/ui/otp/SOTPSeparator.vue +15 -0
- package/registry/source/components/ui/otp/SOTPSlot.vue +462 -0
- package/registry/source/components/ui/otp/index.ts +7 -0
- package/registry/source/components/ui/otp/types.ts +27 -0
- package/registry/source/components/ui/otp/useOTPContext.ts +62 -0
- package/registry/source/components/ui/pagination/SPagination.vue +923 -0
- package/registry/source/components/ui/pagination/index.ts +8 -0
- package/registry/source/components/ui/progress/SProgress.vue +635 -0
- package/registry/source/components/ui/progress/SProgressRange.vue +715 -0
- package/registry/source/components/ui/progress/index.ts +4 -0
- package/registry/source/components/ui/radio/SRadio.vue +407 -0
- package/registry/source/components/ui/radio/SRadioGroup.vue +200 -0
- package/registry/source/components/ui/radio/index.ts +3 -0
- package/registry/source/components/ui/table/SDataTable.vue +828 -0
- package/registry/source/components/ui/table/STableBody.vue +70 -0
- package/registry/source/components/ui/table/STableCell.vue +147 -0
- package/registry/source/components/ui/table/STableColumn.vue +120 -0
- package/registry/source/components/ui/table/STableEmpty.vue +159 -0
- package/registry/source/components/ui/table/STableHeader.vue +132 -0
- package/registry/source/components/ui/table/STableRow.vue +106 -0
- package/registry/source/components/ui/table/STableSkeleton.vue +208 -0
- package/registry/source/components/ui/table/index.ts +126 -0
- package/registry/source/components/ui/table/useDataTable.ts +519 -0
- package/registry/source/components/ui/tabs/STabPane.vue +130 -0
- package/registry/source/components/ui/tabs/STabs.vue +467 -0
- package/registry/source/components/ui/tabs/index.ts +7 -0
- package/registry/source/components/ui/toast/SToast.vue +261 -0
- package/registry/source/components/ui/toast/SToastContainer.vue +209 -0
- package/registry/source/components/ui/toast/index.ts +2 -0
- package/registry/source/composables/useForm.ts +960 -0
- package/registry/source/composables/useTheme.ts +86 -0
- package/registry/source/composables/useToast.ts +440 -0
- package/registry/source/lib/utils.ts +6 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { Ref, MaybeRef, DeepReadonly } from 'vue';
|
|
2
|
+
export interface IntersectionObserverOptions {
|
|
3
|
+
/** The element that is used as the viewport. Defaults to the browser viewport. */
|
|
4
|
+
root?: MaybeRef<HTMLElement | null>;
|
|
5
|
+
/** Margin around the root. Can be values similar to CSS margin. */
|
|
6
|
+
rootMargin?: string;
|
|
7
|
+
/** A single number or array of thresholds (0.0 to 1.0) */
|
|
8
|
+
threshold?: number | number[];
|
|
9
|
+
/** Whether to start observing immediately */
|
|
10
|
+
immediate?: boolean;
|
|
11
|
+
/** Callback when intersection changes */
|
|
12
|
+
onChange?: (entries: IntersectionObserverEntry[]) => void;
|
|
13
|
+
}
|
|
14
|
+
export interface UseIntersectionObserverReturn {
|
|
15
|
+
/** Whether the element is currently visible */
|
|
16
|
+
isVisible: DeepReadonly<Ref<boolean>>;
|
|
17
|
+
/** The current intersection entry */
|
|
18
|
+
entry: DeepReadonly<Ref<IntersectionObserverEntry | null>>;
|
|
19
|
+
/** The intersection ratio (0.0 to 1.0) */
|
|
20
|
+
ratio: DeepReadonly<Ref<number>>;
|
|
21
|
+
/** Stop observing */
|
|
22
|
+
stop: () => void;
|
|
23
|
+
/** Start observing */
|
|
24
|
+
start: () => void;
|
|
25
|
+
/** Whether the observer is currently active */
|
|
26
|
+
isActive: Ref<boolean>;
|
|
27
|
+
}
|
|
28
|
+
export interface UseIntersectionObserverMultipleReturn {
|
|
29
|
+
/** Map of element to visibility state */
|
|
30
|
+
entries: DeepReadonly<Ref<Map<Element, IntersectionObserverEntry>>>;
|
|
31
|
+
/** Stop observing all elements */
|
|
32
|
+
stop: () => void;
|
|
33
|
+
/** Start observing all elements */
|
|
34
|
+
start: () => void;
|
|
35
|
+
/** Whether the observer is currently active */
|
|
36
|
+
isActive: Ref<boolean>;
|
|
37
|
+
/** Check if a specific element is visible */
|
|
38
|
+
isElementVisible: (element: Element) => boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Observe an element's intersection with its parent or the viewport.
|
|
42
|
+
* Useful for lazy loading, infinite scroll, and scroll animations.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* // Basic usage with template ref
|
|
46
|
+
* const targetRef = ref<HTMLElement>()
|
|
47
|
+
* const { isVisible } = useIntersectionObserver(targetRef)
|
|
48
|
+
*
|
|
49
|
+
* // In template:
|
|
50
|
+
* <div ref="targetRef">
|
|
51
|
+
* <img v-if="isVisible" :src="imageSrc" />
|
|
52
|
+
* </div>
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* // With threshold
|
|
56
|
+
* const { isVisible, ratio } = useIntersectionObserver(targetRef, {
|
|
57
|
+
* threshold: 0.5 // Trigger when 50% visible
|
|
58
|
+
* })
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* // With root margin for early triggering
|
|
62
|
+
* const { isVisible } = useIntersectionObserver(targetRef, {
|
|
63
|
+
* rootMargin: '100px' // Trigger 100px before entering viewport
|
|
64
|
+
* })
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* // With callback
|
|
68
|
+
* const { isVisible } = useIntersectionObserver(targetRef, {
|
|
69
|
+
* onChange: (entries) => {
|
|
70
|
+
* entries.forEach(entry => {
|
|
71
|
+
* console.log('Visibility changed:', entry.isIntersecting)
|
|
72
|
+
* })
|
|
73
|
+
* }
|
|
74
|
+
* })
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* // Manual control
|
|
78
|
+
* const { isVisible, stop, start } = useIntersectionObserver(targetRef, {
|
|
79
|
+
* immediate: false
|
|
80
|
+
* })
|
|
81
|
+
*
|
|
82
|
+
* // Start observing later
|
|
83
|
+
* onMounted(() => {
|
|
84
|
+
* start()
|
|
85
|
+
* })
|
|
86
|
+
*
|
|
87
|
+
* // Stop observing
|
|
88
|
+
* onBeforeUnmount(() => {
|
|
89
|
+
* stop()
|
|
90
|
+
* })
|
|
91
|
+
*/
|
|
92
|
+
export declare function useIntersectionObserver(target: MaybeRef<HTMLElement | null | undefined>, options?: IntersectionObserverOptions): UseIntersectionObserverReturn;
|
|
93
|
+
/**
|
|
94
|
+
* Observe multiple elements at once.
|
|
95
|
+
* More efficient than creating multiple observers.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* const elements = ref<HTMLElement[]>([])
|
|
99
|
+
* const { entries, isElementVisible } = useIntersectionObserverMultiple(elements)
|
|
100
|
+
*
|
|
101
|
+
* // Check specific element
|
|
102
|
+
* const isFirstVisible = computed(() => {
|
|
103
|
+
* return elements.value[0] ? isElementVisible(elements.value[0]) : false
|
|
104
|
+
* })
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* // Lazy load images
|
|
108
|
+
* const imageRefs = ref<HTMLImageElement[]>([])
|
|
109
|
+
*
|
|
110
|
+
* const { entries } = useIntersectionObserverMultiple(imageRefs, {
|
|
111
|
+
* rootMargin: '50px',
|
|
112
|
+
* onChange: (entries) => {
|
|
113
|
+
* entries.forEach(entry => {
|
|
114
|
+
* if (entry.isIntersecting) {
|
|
115
|
+
* const img = entry.target as HTMLImageElement
|
|
116
|
+
* img.src = img.dataset.src || ''
|
|
117
|
+
* }
|
|
118
|
+
* })
|
|
119
|
+
* }
|
|
120
|
+
* })
|
|
121
|
+
*/
|
|
122
|
+
export declare function useIntersectionObserverMultiple(targets: MaybeRef<(HTMLElement | null | undefined)[]>, options?: IntersectionObserverOptions): UseIntersectionObserverMultipleReturn;
|
|
123
|
+
/**
|
|
124
|
+
* Simple visibility check - triggers once when element becomes visible.
|
|
125
|
+
* Useful for one-time animations or analytics tracking.
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* const targetRef = ref<HTMLElement>()
|
|
129
|
+
* const hasBeenSeen = useElementVisibility(targetRef)
|
|
130
|
+
*
|
|
131
|
+
* watch(hasBeenSeen, (visible) => {
|
|
132
|
+
* if (visible) {
|
|
133
|
+
* trackImpression()
|
|
134
|
+
* }
|
|
135
|
+
* })
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* // With threshold
|
|
139
|
+
* const isHalfVisible = useElementVisibility(targetRef, { threshold: 0.5 })
|
|
140
|
+
*/
|
|
141
|
+
export declare function useElementVisibility(target: MaybeRef<HTMLElement | null | undefined>, options?: Pick<IntersectionObserverOptions, 'root' | 'rootMargin' | 'threshold'>): DeepReadonly<Ref<boolean>>;
|
|
142
|
+
/**
|
|
143
|
+
* Track when an element has been seen at least once.
|
|
144
|
+
* The value stays true once the element becomes visible.
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* const targetRef = ref<HTMLElement>()
|
|
148
|
+
* const hasBeenSeen = useElementHasBeenSeen(targetRef)
|
|
149
|
+
*
|
|
150
|
+
* // Trigger animation once
|
|
151
|
+
* <div ref="targetRef" :class="{ 'animate-in': hasBeenSeen }">
|
|
152
|
+
* Content
|
|
153
|
+
* </div>
|
|
154
|
+
*/
|
|
155
|
+
export declare function useElementHasBeenSeen(target: MaybeRef<HTMLElement | null | undefined>, options?: Pick<IntersectionObserverOptions, 'root' | 'rootMargin' | 'threshold'>): DeepReadonly<Ref<boolean>>;
|
|
156
|
+
export default useIntersectionObserver;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
export interface Serializer<T> {
|
|
3
|
+
/** Deserialize value from string */
|
|
4
|
+
read: (value: string) => T;
|
|
5
|
+
/** Serialize value to string */
|
|
6
|
+
write: (value: T) => string;
|
|
7
|
+
}
|
|
8
|
+
export interface StorageOptions<T> {
|
|
9
|
+
/** Custom serializer for the value */
|
|
10
|
+
serializer?: Serializer<T>;
|
|
11
|
+
/** Whether to sync across tabs (localStorage only) */
|
|
12
|
+
syncTabs?: boolean;
|
|
13
|
+
/** Callback when an error occurs */
|
|
14
|
+
onError?: (error: Error) => void;
|
|
15
|
+
/** Whether to write the default value if the key doesn't exist */
|
|
16
|
+
writeDefaults?: boolean;
|
|
17
|
+
/** Whether to listen for storage changes */
|
|
18
|
+
listenToStorageChanges?: boolean;
|
|
19
|
+
/** Merge function for deep objects */
|
|
20
|
+
mergeDefaults?: boolean | ((storageValue: T, defaults: T) => T);
|
|
21
|
+
}
|
|
22
|
+
export interface UseStorageReturn<T> {
|
|
23
|
+
/** The reactive storage value */
|
|
24
|
+
value: Ref<T>;
|
|
25
|
+
/** Remove the value from storage */
|
|
26
|
+
remove: () => void;
|
|
27
|
+
/** Check if the key exists in storage */
|
|
28
|
+
exists: () => boolean;
|
|
29
|
+
/** Force refresh the value from storage */
|
|
30
|
+
refresh: () => void;
|
|
31
|
+
}
|
|
32
|
+
export declare const jsonSerializer: Serializer<any>;
|
|
33
|
+
export declare const stringSerializer: Serializer<string>;
|
|
34
|
+
export declare const numberSerializer: Serializer<number>;
|
|
35
|
+
export declare const booleanSerializer: Serializer<boolean>;
|
|
36
|
+
/**
|
|
37
|
+
* Reactive localStorage with cross-tab synchronization.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* // Basic usage
|
|
41
|
+
* const { value: user } = useLocalStorage('user', { name: 'Guest' })
|
|
42
|
+
*
|
|
43
|
+
* // Update value
|
|
44
|
+
* user.value.name = 'John'
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* // With custom serializer
|
|
48
|
+
* const { value } = useLocalStorage('date', new Date(), {
|
|
49
|
+
* serializer: {
|
|
50
|
+
* read: (v) => new Date(v),
|
|
51
|
+
* write: (v) => v.toISOString()
|
|
52
|
+
* }
|
|
53
|
+
* })
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* // String value
|
|
57
|
+
* const { value: token } = useLocalStorage('token', '')
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* // With error handling
|
|
61
|
+
* const { value, remove, exists } = useLocalStorage('settings', {}, {
|
|
62
|
+
* onError: (error) => console.error('Storage error:', error)
|
|
63
|
+
* })
|
|
64
|
+
*
|
|
65
|
+
* // Check if exists
|
|
66
|
+
* if (exists()) {
|
|
67
|
+
* console.log('Settings found')
|
|
68
|
+
* }
|
|
69
|
+
*
|
|
70
|
+
* // Remove from storage
|
|
71
|
+
* remove()
|
|
72
|
+
*/
|
|
73
|
+
export declare function useLocalStorage<T>(key: string, defaultValue: T, options?: StorageOptions<T>): UseStorageReturn<T>;
|
|
74
|
+
/**
|
|
75
|
+
* Reactive sessionStorage with the same API as useLocalStorage.
|
|
76
|
+
* Note: sessionStorage does not sync across tabs.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* // Basic usage
|
|
80
|
+
* const { value: session } = useSessionStorage('session', { id: null })
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* // Form state that persists during the session
|
|
84
|
+
* const { value: formData } = useSessionStorage('checkout-form', {
|
|
85
|
+
* step: 1,
|
|
86
|
+
* items: []
|
|
87
|
+
* })
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* // Temporary authentication state
|
|
91
|
+
* const { value: auth, remove } = useSessionStorage('temp-auth', {
|
|
92
|
+
* token: null,
|
|
93
|
+
* expires: null
|
|
94
|
+
* })
|
|
95
|
+
*
|
|
96
|
+
* // Clear on logout
|
|
97
|
+
* function logout() {
|
|
98
|
+
* remove()
|
|
99
|
+
* }
|
|
100
|
+
*/
|
|
101
|
+
export declare function useSessionStorage<T>(key: string, defaultValue: T, options?: Omit<StorageOptions<T>, 'syncTabs'>): UseStorageReturn<T>;
|
|
102
|
+
/**
|
|
103
|
+
* Create a storage composable for a custom storage implementation.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* // Custom storage implementation
|
|
107
|
+
* const memoryStorage: Storage = {
|
|
108
|
+
* data: new Map(),
|
|
109
|
+
* getItem(key) { return this.data.get(key) ?? null },
|
|
110
|
+
* setItem(key, value) { this.data.set(key, value) },
|
|
111
|
+
* removeItem(key) { this.data.delete(key) },
|
|
112
|
+
* clear() { this.data.clear() },
|
|
113
|
+
* get length() { return this.data.size },
|
|
114
|
+
* key(index) { return Array.from(this.data.keys())[index] ?? null }
|
|
115
|
+
* }
|
|
116
|
+
*
|
|
117
|
+
* const { value } = createStorage('key', 'default', memoryStorage)
|
|
118
|
+
*/
|
|
119
|
+
export declare function createStorage<T>(key: string, defaultValue: T, storage: Storage | null, options?: StorageOptions<T>): UseStorageReturn<T>;
|
|
120
|
+
export default useLocalStorage;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { Ref, DeepReadonly } from 'vue';
|
|
2
|
+
export type MediaQueryInput = string | Record<string, string>;
|
|
3
|
+
export interface UseMediaQueryReturn {
|
|
4
|
+
/** Whether the media query matches */
|
|
5
|
+
matches: DeepReadonly<Ref<boolean>>;
|
|
6
|
+
/** The original query string */
|
|
7
|
+
query: string;
|
|
8
|
+
}
|
|
9
|
+
export type UseMediaQueryObjectReturn<T extends Record<string, string>> = {
|
|
10
|
+
[K in keyof T]: DeepReadonly<Ref<boolean>>;
|
|
11
|
+
};
|
|
12
|
+
export declare const breakpoints: {
|
|
13
|
+
/** Extra small devices (phones, 480px and below) */
|
|
14
|
+
readonly xs: "(max-width: 480px)";
|
|
15
|
+
/** Small devices (phones, 640px and below) */
|
|
16
|
+
readonly sm: "(max-width: 640px)";
|
|
17
|
+
/** Medium devices (tablets, 768px and below) */
|
|
18
|
+
readonly md: "(max-width: 768px)";
|
|
19
|
+
/** Large devices (desktops, 1024px and below) */
|
|
20
|
+
readonly lg: "(max-width: 1024px)";
|
|
21
|
+
/** Extra large devices (large desktops, 1280px and below) */
|
|
22
|
+
readonly xl: "(max-width: 1280px)";
|
|
23
|
+
/** 2x Extra large devices (1536px and below) */
|
|
24
|
+
readonly '2xl': "(max-width: 1536px)";
|
|
25
|
+
/** Mobile and up */
|
|
26
|
+
readonly 'sm-up': "(min-width: 640px)";
|
|
27
|
+
/** Tablet and up */
|
|
28
|
+
readonly 'md-up': "(min-width: 768px)";
|
|
29
|
+
/** Desktop and up */
|
|
30
|
+
readonly 'lg-up': "(min-width: 1024px)";
|
|
31
|
+
/** Large desktop and up */
|
|
32
|
+
readonly 'xl-up': "(min-width: 1280px)";
|
|
33
|
+
/** Prefers dark mode */
|
|
34
|
+
readonly dark: "(prefers-color-scheme: dark)";
|
|
35
|
+
/** Prefers light mode */
|
|
36
|
+
readonly light: "(prefers-color-scheme: light)";
|
|
37
|
+
/** Prefers reduced motion */
|
|
38
|
+
readonly reducedMotion: "(prefers-reduced-motion: reduce)";
|
|
39
|
+
/** Portrait orientation */
|
|
40
|
+
readonly portrait: "(orientation: portrait)";
|
|
41
|
+
/** Landscape orientation */
|
|
42
|
+
readonly landscape: "(orientation: landscape)";
|
|
43
|
+
/** Touch device (primary input is touch) */
|
|
44
|
+
readonly touch: "(hover: none) and (pointer: coarse)";
|
|
45
|
+
/** Mouse/pointer device */
|
|
46
|
+
readonly mouse: "(hover: hover) and (pointer: fine)";
|
|
47
|
+
/** High resolution display */
|
|
48
|
+
readonly retina: "(-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi)";
|
|
49
|
+
};
|
|
50
|
+
export type BreakpointKey = keyof typeof breakpoints;
|
|
51
|
+
/**
|
|
52
|
+
* Reactive media query composable
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* // Single query
|
|
56
|
+
* const isMobile = useMediaQuery('(max-width: 768px)')
|
|
57
|
+
*
|
|
58
|
+
* if (isMobile.value) {
|
|
59
|
+
* // Mobile layout
|
|
60
|
+
* }
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* // Using predefined breakpoints
|
|
64
|
+
* import { useMediaQuery, breakpoints } from 'saka-ui'
|
|
65
|
+
*
|
|
66
|
+
* const isDark = useMediaQuery(breakpoints.dark)
|
|
67
|
+
* const isMobile = useMediaQuery(breakpoints.md)
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* // Multiple queries
|
|
71
|
+
* const { isMobile, isTablet, isDesktop } = useMediaQueries({
|
|
72
|
+
* isMobile: '(max-width: 767px)',
|
|
73
|
+
* isTablet: '(min-width: 768px) and (max-width: 1023px)',
|
|
74
|
+
* isDesktop: '(min-width: 1024px)'
|
|
75
|
+
* })
|
|
76
|
+
*/
|
|
77
|
+
export declare function useMediaQuery(query: string): DeepReadonly<Ref<boolean>>;
|
|
78
|
+
/**
|
|
79
|
+
* Multiple media queries at once
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* const { isMobile, isTablet, isDesktop } = useMediaQueries({
|
|
83
|
+
* isMobile: '(max-width: 767px)',
|
|
84
|
+
* isTablet: '(min-width: 768px) and (max-width: 1023px)',
|
|
85
|
+
* isDesktop: '(min-width: 1024px)'
|
|
86
|
+
* })
|
|
87
|
+
*/
|
|
88
|
+
export declare function useMediaQueries<T extends Record<string, string>>(queries: T): UseMediaQueryObjectReturn<T>;
|
|
89
|
+
/**
|
|
90
|
+
* Common responsive breakpoint helpers
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* const { isMobile, isTablet, isDesktop } = useBreakpoints()
|
|
94
|
+
*
|
|
95
|
+
* // In template
|
|
96
|
+
* <MobileNav v-if="isMobile" />
|
|
97
|
+
* <DesktopNav v-else />
|
|
98
|
+
*/
|
|
99
|
+
export declare function useBreakpoints(): UseMediaQueryObjectReturn<{
|
|
100
|
+
isMobile: string;
|
|
101
|
+
isTablet: string;
|
|
102
|
+
isDesktop: string;
|
|
103
|
+
isTouch: string;
|
|
104
|
+
isDark: string;
|
|
105
|
+
prefersReducedMotion: string;
|
|
106
|
+
}>;
|
|
107
|
+
/**
|
|
108
|
+
* Check a predefined breakpoint
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* const isMobile = useBreakpoint('md')
|
|
112
|
+
* const isDark = useBreakpoint('dark')
|
|
113
|
+
*/
|
|
114
|
+
export declare function useBreakpoint(key: BreakpointKey): DeepReadonly<Ref<boolean>>;
|
|
115
|
+
export default useMediaQuery;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type Theme = 'light' | 'dark' | 'system';
|
|
2
|
+
export declare function applyTheme(t: Theme): void;
|
|
3
|
+
export declare function useTheme(): {
|
|
4
|
+
theme: import('vue').Ref<Theme, Theme>;
|
|
5
|
+
toggleTheme: () => void;
|
|
6
|
+
setTheme: (t: Theme) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare function initTheme(): void;
|