@kapiuara/ui 0.0.0-stage → 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 +764 -2
- package/dist/components/data/KapiPagination.d.ts +36 -0
- package/dist/components/data/KapiPagination.js +102 -0
- package/dist/components/data/KapiTable.d.ts +245 -0
- package/dist/components/data/KapiTable.js +748 -0
- package/dist/components/data/KapiTableFilter.d.ts +48 -0
- package/dist/components/data/KapiTableFilter.js +81 -0
- package/dist/components/data/index.d.ts +10 -0
- package/dist/components/data/tableLogic.d.ts +197 -0
- package/dist/components/data/tableLogic.js +145 -0
- package/dist/components/data/tableResizeLogic.d.ts +28 -0
- package/dist/components/data/tableResizeLogic.js +20 -0
- package/dist/components/display/KapiAnnotation.d.ts +32 -0
- package/dist/components/display/KapiAnnotation.js +130 -0
- package/dist/components/display/KapiAvatar.d.ts +27 -0
- package/dist/components/display/KapiAvatar.js +43 -0
- package/dist/components/display/KapiAvatarGroup.d.ts +19 -0
- package/dist/components/display/KapiAvatarGroup.js +38 -0
- package/dist/components/display/KapiBadge.d.ts +21 -0
- package/dist/components/display/KapiBadge.js +28 -0
- package/dist/components/display/KapiComment.d.ts +27 -0
- package/dist/components/display/KapiComment.js +66 -0
- package/dist/components/display/KapiCommentComposer.d.ts +49 -0
- package/dist/components/display/KapiCommentComposer.js +76 -0
- package/dist/components/display/KapiDescriptionList.d.ts +19 -0
- package/dist/components/display/KapiDescriptionList.js +35 -0
- package/dist/components/display/KapiFileItem.d.ts +39 -0
- package/dist/components/display/KapiFileItem.js +74 -0
- package/dist/components/display/KapiFileViewer.d.ts +51 -0
- package/dist/components/display/KapiFileViewer.js +107 -0
- package/dist/components/display/KapiIconTile.d.ts +16 -0
- package/dist/components/display/KapiIconTile.js +29 -0
- package/dist/components/display/KapiStat.d.ts +24 -0
- package/dist/components/display/KapiStat.js +41 -0
- package/dist/components/display/KapiTag.d.ts +27 -0
- package/dist/components/display/KapiTag.js +44 -0
- package/dist/components/display/KapiTimeline.d.ts +15 -0
- package/dist/components/display/KapiTimeline.js +30 -0
- package/dist/components/display/annotationLogic.d.ts +26 -0
- package/dist/components/display/annotationLogic.js +17 -0
- package/dist/components/display/avatarGroupLogic.d.ts +14 -0
- package/dist/components/display/avatarGroupLogic.js +13 -0
- package/dist/components/display/avatarLogic.d.ts +5 -0
- package/dist/components/display/avatarLogic.js +9 -0
- package/dist/components/display/commentLogic.d.ts +18 -0
- package/dist/components/display/commentLogic.js +7 -0
- package/dist/components/display/fileItemLogic.d.ts +9 -0
- package/dist/components/display/fileItemLogic.js +12 -0
- package/dist/components/display/iconTileLogic.d.ts +13 -0
- package/dist/components/display/iconTileLogic.js +13 -0
- package/dist/components/display/index.d.ts +40 -0
- package/dist/components/display/statLogic.d.ts +10 -0
- package/dist/components/display/statLogic.js +10 -0
- package/dist/components/display/tagLogic.d.ts +11 -0
- package/dist/components/display/tagLogic.js +10 -0
- package/dist/components/display/timelineLogic.d.ts +5 -0
- package/dist/components/display/timelineLogic.js +4 -0
- package/dist/components/feedback/KapiAlert.d.ts +28 -0
- package/dist/components/feedback/KapiAlert.js +53 -0
- package/dist/components/feedback/KapiBulkBar.d.ts +30 -0
- package/dist/components/feedback/KapiBulkBar.js +34 -0
- package/dist/components/feedback/KapiCountdown.d.ts +26 -0
- package/dist/components/feedback/KapiCountdown.js +43 -0
- package/dist/components/feedback/KapiEmpty.d.ts +14 -0
- package/dist/components/feedback/KapiEmpty.js +31 -0
- package/dist/components/feedback/KapiFab.d.ts +34 -0
- package/dist/components/feedback/KapiFab.js +116 -0
- package/dist/components/feedback/KapiOfflineBanner.d.ts +25 -0
- package/dist/components/feedback/KapiOfflineBanner.js +40 -0
- package/dist/components/feedback/KapiProgress.d.ts +24 -0
- package/dist/components/feedback/KapiProgress.js +94 -0
- package/dist/components/feedback/KapiSkeleton.d.ts +12 -0
- package/dist/components/feedback/KapiSkeleton.js +16 -0
- package/dist/components/feedback/KapiToastContainer.d.ts +16 -0
- package/dist/components/feedback/KapiToastContainer.js +81 -0
- package/dist/components/feedback/KapiTour.d.ts +40 -0
- package/dist/components/feedback/KapiTour.js +157 -0
- package/dist/components/feedback/KapiUnsavedBar.d.ts +35 -0
- package/dist/components/feedback/KapiUnsavedBar.js +47 -0
- package/dist/components/feedback/bulkBarLogic.d.ts +2 -0
- package/dist/components/feedback/bulkBarLogic.js +7 -0
- package/dist/components/feedback/countdownLogic.d.ts +74 -0
- package/dist/components/feedback/countdownLogic.js +70 -0
- package/dist/components/feedback/fabLogic.d.ts +17 -0
- package/dist/components/feedback/fabLogic.js +10 -0
- package/dist/components/feedback/index.d.ts +33 -0
- package/dist/components/feedback/offlineBannerLogic.d.ts +10 -0
- package/dist/components/feedback/offlineBannerLogic.js +8 -0
- package/dist/components/feedback/progressLogic.d.ts +17 -0
- package/dist/components/feedback/progressLogic.js +16 -0
- package/dist/components/feedback/toastStore.d.ts +62 -0
- package/dist/components/feedback/toastStore.js +38 -0
- package/dist/components/feedback/tourLogic.d.ts +64 -0
- package/dist/components/feedback/tourLogic.js +31 -0
- package/dist/components/feedback/unsavedBarLogic.d.ts +2 -0
- package/dist/components/feedback/unsavedBarLogic.js +8 -0
- package/dist/components/inputs/KapiAutocomplete.d.ts +81 -0
- package/dist/components/inputs/KapiAutocomplete.js +205 -0
- package/dist/components/inputs/KapiButton.d.ts +23 -0
- package/dist/components/inputs/KapiButton.js +25 -0
- package/dist/components/inputs/KapiCalendar.d.ts +35 -0
- package/dist/components/inputs/KapiCalendar.js +60 -0
- package/dist/components/inputs/KapiCalendarGrid.d.ts +29 -0
- package/dist/components/inputs/KapiCalendarGrid.js +65 -0
- package/dist/components/inputs/KapiCheckCard.d.ts +28 -0
- package/dist/components/inputs/KapiCheckCard.js +41 -0
- package/dist/components/inputs/KapiCheckbox.d.ts +7 -0
- package/dist/components/inputs/KapiCheckbox.js +5 -0
- package/dist/components/inputs/KapiDatePicker.d.ts +46 -0
- package/dist/components/inputs/KapiDatePicker.js +189 -0
- package/dist/components/inputs/KapiDateRangePicker.d.ts +49 -0
- package/dist/components/inputs/KapiDateRangePicker.js +179 -0
- package/dist/components/inputs/KapiFacetedSearch.d.ts +45 -0
- package/dist/components/inputs/KapiFacetedSearch.js +188 -0
- package/dist/components/inputs/KapiField.d.ts +33 -0
- package/dist/components/inputs/KapiField.js +60 -0
- package/dist/components/inputs/KapiFileUpload.d.ts +58 -0
- package/dist/components/inputs/KapiFileUpload.js +134 -0
- package/dist/components/inputs/KapiIconButton.d.ts +13 -0
- package/dist/components/inputs/KapiIconButton.js +16 -0
- package/dist/components/inputs/KapiInput.d.ts +92 -0
- package/dist/components/inputs/KapiInput.js +123 -0
- package/dist/components/inputs/KapiInputGroup.d.ts +37 -0
- package/dist/components/inputs/KapiInputGroup.js +29 -0
- package/dist/components/inputs/KapiMaskedInput.d.ts +52 -0
- package/dist/components/inputs/KapiMaskedInput.js +78 -0
- package/dist/components/inputs/KapiNumberStepper.d.ts +44 -0
- package/dist/components/inputs/KapiNumberStepper.js +100 -0
- package/dist/components/inputs/KapiRadio.d.ts +7 -0
- package/dist/components/inputs/KapiRadio.js +5 -0
- package/dist/components/inputs/KapiRating.d.ts +55 -0
- package/dist/components/inputs/KapiRating.js +99 -0
- package/dist/components/inputs/KapiSegmented.d.ts +41 -0
- package/dist/components/inputs/KapiSegmented.js +83 -0
- package/dist/components/inputs/KapiSelect.d.ts +109 -0
- package/dist/components/inputs/KapiSelect.js +443 -0
- package/dist/components/inputs/KapiSlider.d.ts +42 -0
- package/dist/components/inputs/KapiSlider.js +70 -0
- package/dist/components/inputs/KapiSwitch.d.ts +13 -0
- package/dist/components/inputs/KapiSwitch.js +28 -0
- package/dist/components/inputs/KapiTagInput.d.ts +79 -0
- package/dist/components/inputs/KapiTagInput.js +115 -0
- package/dist/components/inputs/KapiTextarea.d.ts +32 -0
- package/dist/components/inputs/KapiTextarea.js +67 -0
- package/dist/components/inputs/asyncSelectLogic.d.ts +42 -0
- package/dist/components/inputs/asyncSelectLogic.js +46 -0
- package/dist/components/inputs/autocompleteLogic.d.ts +73 -0
- package/dist/components/inputs/autocompleteLogic.js +67 -0
- package/dist/components/inputs/checkControl.d.ts +20 -0
- package/dist/components/inputs/checkControl.js +31 -0
- package/dist/components/inputs/datePickerLogic.d.ts +92 -0
- package/dist/components/inputs/datePickerLogic.js +174 -0
- package/dist/components/inputs/dateRangeLogic.d.ts +31 -0
- package/dist/components/inputs/dateRangeLogic.js +44 -0
- package/dist/components/inputs/facetedSearchLogic.d.ts +69 -0
- package/dist/components/inputs/facetedSearchLogic.js +39 -0
- package/dist/components/inputs/fieldLogic.d.ts +67 -0
- package/dist/components/inputs/fieldLogic.js +35 -0
- package/dist/components/inputs/fileUploadLogic.d.ts +13 -0
- package/dist/components/inputs/fileUploadLogic.js +9 -0
- package/dist/components/inputs/index.d.ts +55 -0
- package/dist/components/inputs/inputGroupLogic.d.ts +22 -0
- package/dist/components/inputs/inputGroupLogic.js +9 -0
- package/dist/components/inputs/inputLogic.d.ts +25 -0
- package/dist/components/inputs/inputLogic.js +10 -0
- package/dist/components/inputs/maskLogic.d.ts +34 -0
- package/dist/components/inputs/maskLogic.js +57 -0
- package/dist/components/inputs/numberStepLogic.d.ts +14 -0
- package/dist/components/inputs/numberStepLogic.js +21 -0
- package/dist/components/inputs/ratingLogic.d.ts +9 -0
- package/dist/components/inputs/ratingLogic.js +22 -0
- package/dist/components/inputs/segmentedLogic.d.ts +6 -0
- package/dist/components/inputs/segmentedLogic.js +14 -0
- package/dist/components/inputs/selectLogic.d.ts +89 -0
- package/dist/components/inputs/selectLogic.js +82 -0
- package/dist/components/inputs/sliderLogic.d.ts +9 -0
- package/dist/components/inputs/sliderLogic.js +17 -0
- package/dist/components/inputs/tagInputLogic.d.ts +40 -0
- package/dist/components/inputs/tagInputLogic.js +40 -0
- package/dist/components/inputs/textareaLogic.d.ts +17 -0
- package/dist/components/inputs/textareaLogic.js +13 -0
- package/dist/components/inputs/useCalendarFocus.d.ts +13 -0
- package/dist/components/inputs/useCalendarFocus.js +25 -0
- package/dist/components/inputs/useDatePopSide.d.ts +15 -0
- package/dist/components/inputs/useDatePopSide.js +20 -0
- package/dist/components/labelsLogic.d.ts +6 -0
- package/dist/components/labelsLogic.js +11 -0
- package/dist/components/layout/KapiAccessCard.d.ts +40 -0
- package/dist/components/layout/KapiAccessCard.js +66 -0
- package/dist/components/layout/KapiAccountMenu.d.ts +61 -0
- package/dist/components/layout/KapiAccountMenu.js +212 -0
- package/dist/components/layout/KapiCard.d.ts +43 -0
- package/dist/components/layout/KapiCard.js +53 -0
- package/dist/components/layout/KapiCluster.d.ts +15 -0
- package/dist/components/layout/KapiCluster.js +21 -0
- package/dist/components/layout/KapiContextSlot.d.ts +45 -0
- package/dist/components/layout/KapiContextSlot.js +92 -0
- package/dist/components/layout/KapiDivider.d.ts +16 -0
- package/dist/components/layout/KapiDivider.js +41 -0
- package/dist/components/layout/KapiGrid.d.ts +19 -0
- package/dist/components/layout/KapiGrid.js +25 -0
- package/dist/components/layout/KapiNotificationBell.d.ts +75 -0
- package/dist/components/layout/KapiNotificationBell.js +196 -0
- package/dist/components/layout/KapiPageHeader.d.ts +28 -0
- package/dist/components/layout/KapiPageHeader.js +47 -0
- package/dist/components/layout/KapiPanelParts.d.ts +35 -0
- package/dist/components/layout/KapiPanelParts.js +63 -0
- package/dist/components/layout/KapiRail.d.ts +40 -0
- package/dist/components/layout/KapiRail.js +102 -0
- package/dist/components/layout/KapiScrollArea.d.ts +40 -0
- package/dist/components/layout/KapiScrollArea.js +49 -0
- package/dist/components/layout/KapiShell.d.ts +40 -0
- package/dist/components/layout/KapiShell.js +48 -0
- package/dist/components/layout/KapiStack.d.ts +11 -0
- package/dist/components/layout/KapiStack.js +19 -0
- package/dist/components/layout/accessCardLogic.d.ts +18 -0
- package/dist/components/layout/accessCardLogic.js +11 -0
- package/dist/components/layout/cardLogic.d.ts +9 -0
- package/dist/components/layout/cardLogic.js +11 -0
- package/dist/components/layout/index.d.ts +33 -0
- package/dist/components/layout/layoutPrimitives.d.ts +51 -0
- package/dist/components/layout/layoutPrimitives.js +58 -0
- package/dist/components/layout/notificationBellLogic.d.ts +20 -0
- package/dist/components/layout/notificationBellLogic.js +14 -0
- package/dist/components/layout/railLogic.d.ts +52 -0
- package/dist/components/layout/railLogic.js +16 -0
- package/dist/components/locale/KapiLocaleProvider.d.ts +29 -0
- package/dist/components/locale/KapiLocaleProvider.js +27 -0
- package/dist/components/locale/index.d.ts +5 -0
- package/dist/components/locale/labelRegistry.d.ts +110 -0
- package/dist/components/locale/linkLabels.d.ts +6 -0
- package/dist/components/locale/linkLabels.js +4 -0
- package/dist/components/navigation/CtxSlidingList.d.ts +11 -0
- package/dist/components/navigation/CtxSlidingList.js +24 -0
- package/dist/components/navigation/KapiAccordion.d.ts +24 -0
- package/dist/components/navigation/KapiAccordion.js +68 -0
- package/dist/components/navigation/KapiBreadcrumb.d.ts +23 -0
- package/dist/components/navigation/KapiBreadcrumb.js +32 -0
- package/dist/components/navigation/KapiCollapsiblePanel.d.ts +63 -0
- package/dist/components/navigation/KapiCollapsiblePanel.js +83 -0
- package/dist/components/navigation/KapiContextPanel.d.ts +117 -0
- package/dist/components/navigation/KapiContextPanel.js +265 -0
- package/dist/components/navigation/KapiFilterChips.d.ts +30 -0
- package/dist/components/navigation/KapiFilterChips.js +40 -0
- package/dist/components/navigation/KapiNavBadge.d.ts +26 -0
- package/dist/components/navigation/KapiNavBadge.js +33 -0
- package/dist/components/navigation/KapiPanelGroup.d.ts +69 -0
- package/dist/components/navigation/KapiPanelGroup.js +149 -0
- package/dist/components/navigation/KapiSteps.d.ts +43 -0
- package/dist/components/navigation/KapiSteps.js +63 -0
- package/dist/components/navigation/KapiTabs.d.ts +56 -0
- package/dist/components/navigation/KapiTabs.js +81 -0
- package/dist/components/navigation/KapiTree.d.ts +56 -0
- package/dist/components/navigation/KapiTree.js +157 -0
- package/dist/components/navigation/KapiWizard.d.ts +49 -0
- package/dist/components/navigation/KapiWizard.js +104 -0
- package/dist/components/navigation/MiniNavItem.d.ts +35 -0
- package/dist/components/navigation/MiniNavItem.js +57 -0
- package/dist/components/navigation/accordionLogic.d.ts +4 -0
- package/dist/components/navigation/accordionLogic.js +4 -0
- package/dist/components/navigation/activeItemLogic.d.ts +7 -0
- package/dist/components/navigation/activeItemLogic.js +4 -0
- package/dist/components/navigation/breadcrumbLogic.d.ts +8 -0
- package/dist/components/navigation/breadcrumbLogic.js +4 -0
- package/dist/components/navigation/contextPanelLogic.d.ts +27 -0
- package/dist/components/navigation/contextPanelLogic.js +11 -0
- package/dist/components/navigation/filterChipsLogic.d.ts +23 -0
- package/dist/components/navigation/filterChipsLogic.js +20 -0
- package/dist/components/navigation/index.d.ts +39 -0
- package/dist/components/navigation/navBadgeLogic.d.ts +26 -0
- package/dist/components/navigation/navBadgeLogic.js +16 -0
- package/dist/components/navigation/panelGroupLogic.d.ts +15 -0
- package/dist/components/navigation/panelGroupLogic.js +13 -0
- package/dist/components/navigation/panelMini.d.ts +13 -0
- package/dist/components/navigation/panelMini.js +9 -0
- package/dist/components/navigation/panelMiniLogic.d.ts +19 -0
- package/dist/components/navigation/panelMiniLogic.js +6 -0
- package/dist/components/navigation/stepsLogic.d.ts +25 -0
- package/dist/components/navigation/stepsLogic.js +10 -0
- package/dist/components/navigation/tabsLogic.d.ts +12 -0
- package/dist/components/navigation/tabsLogic.js +14 -0
- package/dist/components/navigation/treeLogic.d.ts +80 -0
- package/dist/components/navigation/treeLogic.js +91 -0
- package/dist/components/navigation/wizardLogic.d.ts +11 -0
- package/dist/components/navigation/wizardLogic.js +7 -0
- package/dist/components/overlays/KapiCanvasForm.d.ts +42 -0
- package/dist/components/overlays/KapiCanvasForm.js +60 -0
- package/dist/components/overlays/KapiCommandPalette.d.ts +58 -0
- package/dist/components/overlays/KapiCommandPalette.js +152 -0
- package/dist/components/overlays/KapiConfirm.d.ts +48 -0
- package/dist/components/overlays/KapiConfirm.js +94 -0
- package/dist/components/overlays/KapiContextMenu.d.ts +51 -0
- package/dist/components/overlays/KapiContextMenu.js +90 -0
- package/dist/components/overlays/KapiDialogHost.d.ts +23 -0
- package/dist/components/overlays/KapiDialogHost.js +129 -0
- package/dist/components/overlays/KapiDropdown.d.ts +30 -0
- package/dist/components/overlays/KapiDropdown.js +84 -0
- package/dist/components/overlays/KapiLoading.d.ts +14 -0
- package/dist/components/overlays/KapiLoading.js +43 -0
- package/dist/components/overlays/KapiMenuButton.d.ts +25 -0
- package/dist/components/overlays/KapiMenuButton.js +109 -0
- package/dist/components/overlays/KapiModal.d.ts +61 -0
- package/dist/components/overlays/KapiModal.js +106 -0
- package/dist/components/overlays/KapiOffcanvas.d.ts +96 -0
- package/dist/components/overlays/KapiOffcanvas.js +209 -0
- package/dist/components/overlays/KapiOffcanvasStack.d.ts +58 -0
- package/dist/components/overlays/KapiOffcanvasStack.js +84 -0
- package/dist/components/overlays/KapiPhotoView.d.ts +60 -0
- package/dist/components/overlays/KapiPhotoView.js +122 -0
- package/dist/components/overlays/KapiPopover.d.ts +46 -0
- package/dist/components/overlays/KapiPopover.js +68 -0
- package/dist/components/overlays/KapiShapeSheet.d.ts +34 -0
- package/dist/components/overlays/KapiShapeSheet.js +82 -0
- package/dist/components/overlays/KapiSplitModal.d.ts +41 -0
- package/dist/components/overlays/KapiSplitModal.js +125 -0
- package/dist/components/overlays/KapiTooltip.d.ts +38 -0
- package/dist/components/overlays/KapiTooltip.js +105 -0
- package/dist/components/overlays/canvasFormLogic.d.ts +18 -0
- package/dist/components/overlays/canvasFormLogic.js +16 -0
- package/dist/components/overlays/commandPaletteLogic.d.ts +29 -0
- package/dist/components/overlays/commandPaletteLogic.js +19 -0
- package/dist/components/overlays/dialogStore.d.ts +114 -0
- package/dist/components/overlays/dialogStore.js +76 -0
- package/dist/components/overlays/dialogUtils.d.ts +72 -0
- package/dist/components/overlays/dialogUtils.js +62 -0
- package/dist/components/overlays/exitPresenceLogic.d.ts +14 -0
- package/dist/components/overlays/exitPresenceLogic.js +5 -0
- package/dist/components/overlays/index.d.ts +38 -0
- package/dist/components/overlays/menuButtonLogic.d.ts +58 -0
- package/dist/components/overlays/menuButtonLogic.js +9 -0
- package/dist/components/overlays/menuKeyboardLogic.d.ts +25 -0
- package/dist/components/overlays/menuKeyboardLogic.js +30 -0
- package/dist/components/overlays/offcanvasCompanion.d.ts +16 -0
- package/dist/components/overlays/offcanvasCompanion.js +6 -0
- package/dist/components/overlays/offcanvasResize.d.ts +22 -0
- package/dist/components/overlays/offcanvasResize.js +10 -0
- package/dist/components/overlays/offcanvasSide.d.ts +30 -0
- package/dist/components/overlays/offcanvasSide.js +29 -0
- package/dist/components/overlays/offcanvasStack.d.ts +76 -0
- package/dist/components/overlays/offcanvasStack.js +72 -0
- package/dist/components/overlays/overlayPortal.d.ts +9 -0
- package/dist/components/overlays/overlayPortal.js +6 -0
- package/dist/components/overlays/popoverLogic.d.ts +94 -0
- package/dist/components/overlays/popoverLogic.js +47 -0
- package/dist/components/overlays/splitModalLayout.d.ts +8 -0
- package/dist/components/overlays/splitModalLayout.js +5 -0
- package/dist/components/overlays/useExitPresence.d.ts +14 -0
- package/dist/components/overlays/useExitPresence.js +34 -0
- package/dist/components/overlays/useNativeDialog.d.ts +30 -0
- package/dist/components/overlays/useNativeDialog.js +56 -0
- package/dist/components/rootProps.d.ts +17 -0
- package/dist/components/rootProps.js +4 -0
- package/dist/hooks/breakpointOpenLogic.d.ts +7 -0
- package/dist/hooks/breakpointOpenLogic.js +4 -0
- package/dist/hooks/dateFormat.d.ts +12 -0
- package/dist/hooks/dateFormat.js +15 -0
- package/dist/hooks/downloadLogic.d.ts +31 -0
- package/dist/hooks/downloadLogic.js +85 -0
- package/dist/hooks/focusLogic.d.ts +18 -0
- package/dist/hooks/focusLogic.js +17 -0
- package/dist/hooks/growOriginLogic.d.ts +22 -0
- package/dist/hooks/growOriginLogic.js +10 -0
- package/dist/hooks/hotkeyLogic.d.ts +22 -0
- package/dist/hooks/hotkeyLogic.js +32 -0
- package/dist/hooks/index.d.ts +49 -0
- package/dist/hooks/kapiRoot.d.ts +16 -0
- package/dist/hooks/kapiRoot.js +9 -0
- package/dist/hooks/onlineStatusLogic.d.ts +31 -0
- package/dist/hooks/onlineStatusLogic.js +28 -0
- package/dist/hooks/persistentStateLogic.d.ts +12 -0
- package/dist/hooks/persistentStateLogic.js +17 -0
- package/dist/hooks/rafThrottle.d.ts +33 -0
- package/dist/hooks/rafThrottle.js +33 -0
- package/dist/hooks/recentLogic.d.ts +9 -0
- package/dist/hooks/recentLogic.js +10 -0
- package/dist/hooks/reducedMotion.d.ts +13 -0
- package/dist/hooks/reducedMotion.js +5 -0
- package/dist/hooks/rightClick.d.ts +37 -0
- package/dist/hooks/rightClick.js +30 -0
- package/dist/hooks/scrollCollapseLogic.d.ts +12 -0
- package/dist/hooks/scrollCollapseLogic.js +4 -0
- package/dist/hooks/scrollEdgesLogic.d.ts +49 -0
- package/dist/hooks/scrollEdgesLogic.js +19 -0
- package/dist/hooks/slidingIndicatorLogic.d.ts +25 -0
- package/dist/hooks/slidingIndicatorLogic.js +15 -0
- package/dist/hooks/storageLogic.d.ts +15 -0
- package/dist/hooks/storageLogic.js +24 -0
- package/dist/hooks/unsavedGuardLogic.d.ts +17 -0
- package/dist/hooks/unsavedGuardLogic.js +17 -0
- package/dist/hooks/useDragScroll.d.ts +12 -0
- package/dist/hooks/useDragScroll.js +32 -0
- package/dist/hooks/useGlobalRightClick.d.ts +14 -0
- package/dist/hooks/useGlobalRightClick.js +35 -0
- package/dist/hooks/useGrowOrigin.d.ts +13 -0
- package/dist/hooks/useGrowOrigin.js +16 -0
- package/dist/hooks/useHotkey.d.ts +15 -0
- package/dist/hooks/useHotkey.js +31 -0
- package/dist/hooks/useKapiTheme.d.ts +69 -0
- package/dist/hooks/useKapiTheme.js +88 -0
- package/dist/hooks/useMediaQuery.d.ts +6 -0
- package/dist/hooks/useMediaQuery.js +13 -0
- package/dist/hooks/useObjectUrl.d.ts +6 -0
- package/dist/hooks/useObjectUrl.js +19 -0
- package/dist/hooks/useOnlineStatus.d.ts +7 -0
- package/dist/hooks/useOnlineStatus.js +7 -0
- package/dist/hooks/usePersistentState.d.ts +19 -0
- package/dist/hooks/usePersistentState.js +37 -0
- package/dist/hooks/usePlacement.d.ts +36 -0
- package/dist/hooks/usePlacement.js +84 -0
- package/dist/hooks/useRecent.d.ts +17 -0
- package/dist/hooks/useRecent.js +16 -0
- package/dist/hooks/useScrollCollapse.d.ts +10 -0
- package/dist/hooks/useScrollCollapse.js +27 -0
- package/dist/hooks/useScrollEdges.d.ts +32 -0
- package/dist/hooks/useScrollEdges.js +91 -0
- package/dist/hooks/useSlidingIndicator.d.ts +23 -0
- package/dist/hooks/useSlidingIndicator.js +51 -0
- package/dist/hooks/useUnsavedGuard.d.ts +70 -0
- package/dist/hooks/useUnsavedGuard.js +47 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +162 -0
- package/dist/kapi.css +2 -0
- package/dist/kapi.layered.css +4 -0
- package/package.json +86 -4
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Selector de elementos enfocables con Tab (sin `tabindex="-1"` ni deshabilitados). */
|
|
2
|
+
export declare const FOCUSABLE_SELECTOR: string;
|
|
3
|
+
/** Elementos enfocables con Tab dentro de `container`, en orden del DOM (ignora los de subárboles `inert`). */
|
|
4
|
+
export declare const focusableWithin: (container: Element | null) => HTMLElement[];
|
|
5
|
+
/**
|
|
6
|
+
* Índice a enfocar al apretar Tab dentro de una trampa de foco (con vuelta). `current` -1 = el foco
|
|
7
|
+
* está en el contenedor u otro lado: Tab va al primero y Shift+Tab al último. -1 si no hay enfocables.
|
|
8
|
+
*/
|
|
9
|
+
export declare const nextTrapIndex: (count: number, current: number, shift: boolean) => number;
|
|
10
|
+
/**
|
|
11
|
+
* Atrapa Tab dentro de `container`: mueve el foco al siguiente/anterior enfocable con vuelta. Sin
|
|
12
|
+
* enfocables, deja el foco en el contenedor. Devuelve `true` si manejó la tecla.
|
|
13
|
+
*/
|
|
14
|
+
export declare const trapTabKey: (e: {
|
|
15
|
+
key: string;
|
|
16
|
+
shiftKey: boolean;
|
|
17
|
+
preventDefault: () => void;
|
|
18
|
+
}, container: HTMLElement | null) => boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/hooks/focusLogic.ts
|
|
2
|
+
var e = [
|
|
3
|
+
"a[href]",
|
|
4
|
+
"button:not([disabled])",
|
|
5
|
+
"input:not([disabled]):not([type='hidden'])",
|
|
6
|
+
"select:not([disabled])",
|
|
7
|
+
"textarea:not([disabled])",
|
|
8
|
+
"[tabindex]:not([tabindex='-1'])",
|
|
9
|
+
"[contenteditable='true']"
|
|
10
|
+
].join(","), t = (t) => t ? Array.from(t.querySelectorAll(e)).filter((e) => !e.closest("[inert]") && e.tabIndex >= 0) : [], n = (e, t, n) => e === 0 ? -1 : t < 0 ? n ? e - 1 : 0 : n ? (t - 1 + e) % e : (t + 1) % e, r = (e, r) => {
|
|
11
|
+
if (e.key !== "Tab" || !r) return !1;
|
|
12
|
+
e.preventDefault();
|
|
13
|
+
let i = t(r), a = i.indexOf(document.activeElement), o = n(i.length, a, e.shiftKey);
|
|
14
|
+
return (o < 0 ? r : i[o])?.focus(), !0;
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { e as FOCUSABLE_SELECTOR, t as focusableWithin, n as nextTrapIndex, r as trapTabKey };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Coordenadas de viewport del centro del disparador. */
|
|
2
|
+
export type GrowOrigin = {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
};
|
|
6
|
+
export type GrowRect = {
|
|
7
|
+
left: number;
|
|
8
|
+
top: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
};
|
|
12
|
+
/** Centro de un rect (típicamente `getBoundingClientRect()` del botón disparador). */
|
|
13
|
+
export declare const rectCenter: (rect: GrowRect) => GrowOrigin;
|
|
14
|
+
/**
|
|
15
|
+
* Expresa el punto (viewport) en coordenadas LOCALES a la tarjeta, acotado a
|
|
16
|
+
* `[0, width] × [0, height]`: un disparador lejos de la tarjeta igual da un
|
|
17
|
+
* `transform-origin` razonable (el borde más cercano).
|
|
18
|
+
*/
|
|
19
|
+
export declare const originWithinCard: (point: GrowOrigin, cardRect: GrowRect) => {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/hooks/growOriginLogic.ts
|
|
2
|
+
var e = (e) => ({
|
|
3
|
+
x: e.left + e.width / 2,
|
|
4
|
+
y: e.top + e.height / 2
|
|
5
|
+
}), t = (e, t) => Math.min(Math.max(e, 0), Math.max(t, 0)), n = (e, n) => ({
|
|
6
|
+
x: t(e.x - n.left, n.width),
|
|
7
|
+
y: t(e.y - n.top, n.height)
|
|
8
|
+
});
|
|
9
|
+
//#endregion
|
|
10
|
+
export { n as originWithinCard, e as rectCenter };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Pure key-combo parsing/matching for `useHotkey`. */
|
|
2
|
+
export type HotkeyCombo = {
|
|
3
|
+
/** Ctrl on Windows/Linux, Cmd on macOS (either one satisfies it). */
|
|
4
|
+
mod: boolean;
|
|
5
|
+
ctrl: boolean;
|
|
6
|
+
meta: boolean;
|
|
7
|
+
alt: boolean;
|
|
8
|
+
shift: boolean;
|
|
9
|
+
/** Lowercased `KeyboardEvent.key`. */
|
|
10
|
+
key: string;
|
|
11
|
+
};
|
|
12
|
+
export type KeyEventLike = {
|
|
13
|
+
key: string;
|
|
14
|
+
ctrlKey: boolean;
|
|
15
|
+
metaKey: boolean;
|
|
16
|
+
altKey: boolean;
|
|
17
|
+
shiftKey: boolean;
|
|
18
|
+
};
|
|
19
|
+
/** Parse "mod+k", "ctrl+shift+p", "alt+/" ... Last token is the key. Returns null when invalid. */
|
|
20
|
+
export declare const parseHotkey: (combo: string) => HotkeyCombo | null;
|
|
21
|
+
/** Whether a keyboard event satisfies the combo (modifiers must match exactly). */
|
|
22
|
+
export declare const matchesHotkey: (event: KeyEventLike, combo: HotkeyCombo) => boolean;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/hooks/hotkeyLogic.ts
|
|
2
|
+
var e = {
|
|
3
|
+
esc: "escape",
|
|
4
|
+
space: " ",
|
|
5
|
+
spacebar: " ",
|
|
6
|
+
up: "arrowup",
|
|
7
|
+
down: "arrowdown",
|
|
8
|
+
left: "arrowleft",
|
|
9
|
+
right: "arrowright"
|
|
10
|
+
}, t = (t) => {
|
|
11
|
+
let n = t.toLowerCase().split("+").map((e) => e.trim());
|
|
12
|
+
n.length > 1 && n[n.length - 1] === "" && n[n.length - 2] === "" && n.splice(-2, 2, "+");
|
|
13
|
+
let r = n.pop();
|
|
14
|
+
if (!r) return null;
|
|
15
|
+
let i = {
|
|
16
|
+
mod: !1,
|
|
17
|
+
ctrl: !1,
|
|
18
|
+
meta: !1,
|
|
19
|
+
alt: !1,
|
|
20
|
+
shift: !1,
|
|
21
|
+
key: e[r] ?? r
|
|
22
|
+
};
|
|
23
|
+
for (let e of n) if (e === "mod") i.mod = !0;
|
|
24
|
+
else if (e === "ctrl" || e === "control") i.ctrl = !0;
|
|
25
|
+
else if (e === "meta" || e === "cmd" || e === "command") i.meta = !0;
|
|
26
|
+
else if (e === "alt" || e === "option") i.alt = !0;
|
|
27
|
+
else if (e === "shift") i.shift = !0;
|
|
28
|
+
else return null;
|
|
29
|
+
return i;
|
|
30
|
+
}, n = (e, t) => e.key.toLowerCase() !== t.key || e.altKey !== t.alt || e.shiftKey !== t.shift ? !1 : t.mod ? e.ctrlKey !== e.metaKey : e.ctrlKey === t.ctrl && e.metaKey === t.meta;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { n as matchesHotkey, t as parseHotkey };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export { useDragScroll } from "./useDragScroll";
|
|
2
|
+
export type { UseDragScrollOptions } from "./useDragScroll";
|
|
3
|
+
export { useGlobalRightClick } from "./useGlobalRightClick";
|
|
4
|
+
export type { UseGlobalRightClickOptions } from "./useGlobalRightClick";
|
|
5
|
+
export { FONTS, KapiThemeContext, DARK_SCHEME_QUERY, resolveTheme, themeStorageKeys, themeRootStyle, useKapiTheme, useKapiThemeState } from "./useKapiTheme";
|
|
6
|
+
export type { KapiFontKey, KapiMotion, KapiTheme, KapiThemePreference, KapiThemeState, KapiThemeStateOptions } from "./useKapiTheme";
|
|
7
|
+
export { DEFAULT_STORAGE_NAMESPACE, storageKey } from "./storageLogic";
|
|
8
|
+
export { clampMenuPosition } from "./rightClick";
|
|
9
|
+
export { useUnsavedGuard, unsavedGuardHandler, DEFAULT_UNSAVED_GUARD_LABELS } from "./useUnsavedGuard";
|
|
10
|
+
export type { BeforeUnloadLike, UnsavedGuard, UnsavedGuardDialogProps, UnsavedGuardLabels, UnsavedGuardOptions } from "./useUnsavedGuard";
|
|
11
|
+
export { KAPI_ROOT_SELECTOR, resolveKapiRoot, useKapiRoot } from "./kapiRoot";
|
|
12
|
+
export { REDUCED_MOTION_QUERY, prefersReducedMotion } from "./reducedMotion";
|
|
13
|
+
export { SHELL_MOBILE_QUERY, matchesQuery, useMediaQuery } from "./useMediaQuery";
|
|
14
|
+
export { useHotkey } from "./useHotkey";
|
|
15
|
+
export type { UseHotkeyOptions } from "./useHotkey";
|
|
16
|
+
export { usePersistentState } from "./usePersistentState";
|
|
17
|
+
export type { PersistentStateOptions } from "./usePersistentState";
|
|
18
|
+
export { serializeStored, parseStored } from "./persistentStateLogic";
|
|
19
|
+
export type { Stored } from "./persistentStateLogic";
|
|
20
|
+
export { useRecent } from "./useRecent";
|
|
21
|
+
export type { UseRecentOptions, UseRecentResult } from "./useRecent";
|
|
22
|
+
export { addRecentEntry, removeRecentEntry } from "./recentLogic";
|
|
23
|
+
export type { RecentEntry } from "./recentLogic";
|
|
24
|
+
export { useGrowOrigin } from "./useGrowOrigin";
|
|
25
|
+
export { rectCenter, originWithinCard } from "./growOriginLogic";
|
|
26
|
+
export type { GrowOrigin, GrowRect } from "./growOriginLogic";
|
|
27
|
+
export { useScrollCollapse } from "./useScrollCollapse";
|
|
28
|
+
export type { ScrollCollapseResult } from "./useScrollCollapse";
|
|
29
|
+
export { collapsedFromIntersection, normalizeRootMargin, DEFAULT_ROOT_MARGIN } from "./scrollCollapseLogic";
|
|
30
|
+
export type { ScrollCollapseOptions } from "./scrollCollapseLogic";
|
|
31
|
+
export { useSlidingIndicator } from "./useSlidingIndicator";
|
|
32
|
+
export type { UseSlidingIndicatorOptions, UseSlidingIndicatorResult } from "./useSlidingIndicator";
|
|
33
|
+
export { slidingIndicatorBox } from "./slidingIndicatorLogic";
|
|
34
|
+
export type { SlidingIndicatorBox } from "./slidingIndicatorLogic";
|
|
35
|
+
export { rafThrottle, onViewportChange } from "./rafThrottle";
|
|
36
|
+
export type { FrameScheduler, RafThrottled, ViewportChangeOptions, ViewportEventTarget } from "./rafThrottle";
|
|
37
|
+
export { usePlacement } from "./usePlacement";
|
|
38
|
+
export type { UsePlacementOptions, UsePlacementResult } from "./usePlacement";
|
|
39
|
+
export { useOnlineStatus } from "./useOnlineStatus";
|
|
40
|
+
export { createOnlineStore, readOnline, SERVER_ONLINE_STATUS } from "./onlineStatusLogic";
|
|
41
|
+
export type { OnlineEventTarget, OnlineStatus, OnlineStore, OnlineStoreOptions } from "./onlineStatusLogic";
|
|
42
|
+
export { useObjectUrl } from "./useObjectUrl";
|
|
43
|
+
export { downloadBlob, fileKind, fileNameFromContentDisposition, fileNameFromUrl, formatFileSize } from "./downloadLogic";
|
|
44
|
+
export type { KapiFileKind } from "./downloadLogic";
|
|
45
|
+
export { formatDate, formatRelativeTime, isoDateTime } from "./dateFormat";
|
|
46
|
+
export { useScrollEdges } from "./useScrollEdges";
|
|
47
|
+
export type { UseScrollEdgesOptions, UseScrollEdgesResult } from "./useScrollEdges";
|
|
48
|
+
export { DEFAULT_PAGE_FRACTION, DEFAULT_SCROLL_EDGE_TOLERANCE, maxScroll, pageSize, pageTarget, revealTarget, sameScrollEdges, scrollEdges } from "./scrollEdgesLogic";
|
|
49
|
+
export type { KapiScrollAxis, ScrollEdges, ScrollMetrics } from "./scrollEdgesLogic";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Selector de la raíz de tokens/tema del design system. */
|
|
2
|
+
export declare const KAPI_ROOT_SELECTOR = ".kapi";
|
|
3
|
+
/**
|
|
4
|
+
* Nodo donde montar overlays (menús, popovers) para que hereden los tokens del tema.
|
|
5
|
+
*
|
|
6
|
+
* Si `from` está dentro de un `<dialog open>` (modal nativo vía `showModal()`), se monta DENTRO
|
|
7
|
+
* de ese dialog: el modal vive en el top-layer y deja todo lo de afuera `inert`, así que un overlay
|
|
8
|
+
* portaleado a `.kapi` (hermano del dialog) quedaría pintado debajo y sin poder clickearse.
|
|
9
|
+
* El dialog igual está dentro de `.kapi`, por lo que hereda los tokens igual.
|
|
10
|
+
*
|
|
11
|
+
* Si no hay dialog, prefiere el `.kapi` ancestro de `from`; si no hay, el primero del
|
|
12
|
+
* documento; último recurso: `body`. `null` fuera del navegador (SSR).
|
|
13
|
+
*/
|
|
14
|
+
export declare const resolveKapiRoot: (from?: Element | null) => HTMLElement | null;
|
|
15
|
+
/** Destino de portal: se resuelve tras montar (seguro para SSR). */
|
|
16
|
+
export declare const useKapiRoot: () => HTMLElement | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect as e, useState as t } from "react";
|
|
3
|
+
//#region src/hooks/kapiRoot.ts
|
|
4
|
+
var n = ".kapi", r = (e) => typeof document > "u" ? null : e?.closest("dialog[open]") || (e?.closest(".kapi") ?? document.querySelector(".kapi") ?? document.body), i = () => {
|
|
5
|
+
let [n, i] = t(null);
|
|
6
|
+
return e(() => i(r()), []), n;
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { n as KAPI_ROOT_SELECTOR, r as resolveKapiRoot, i as useKapiRoot };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** Conectado o no, y cuándo cambió por última vez (`Date.now()`); `null` si no cambió desde la carga. */
|
|
2
|
+
export type OnlineStatus = {
|
|
3
|
+
online: boolean;
|
|
4
|
+
since: number | null;
|
|
5
|
+
};
|
|
6
|
+
/** Lo mínimo de `window` que usa el store (inyectable en tests). */
|
|
7
|
+
export type OnlineEventTarget = {
|
|
8
|
+
addEventListener: (type: string, fn: () => void) => void;
|
|
9
|
+
removeEventListener: (type: string, fn: () => void) => void;
|
|
10
|
+
};
|
|
11
|
+
export type OnlineStoreOptions = {
|
|
12
|
+
target?: OnlineEventTarget | null;
|
|
13
|
+
read?: () => boolean;
|
|
14
|
+
now?: () => number;
|
|
15
|
+
};
|
|
16
|
+
export type OnlineStore = {
|
|
17
|
+
subscribe: (onChange: () => void) => () => void;
|
|
18
|
+
getSnapshot: () => OnlineStatus;
|
|
19
|
+
};
|
|
20
|
+
/** Snapshot del servidor (SSR): se asume conectado. */
|
|
21
|
+
export declare const SERVER_ONLINE_STATUS: OnlineStatus;
|
|
22
|
+
/** `navigator.onLine`, o `true` si no hay navigator (SSR) o no expone el dato. */
|
|
23
|
+
export declare const readOnline: (nav?: {
|
|
24
|
+
onLine?: boolean;
|
|
25
|
+
} | undefined) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Store de conexión: escucha `online`/`offline` en `target` (default `window`). El snapshot se
|
|
28
|
+
* recalcula al leerlo y conserva la MISMA referencia mientras el valor no cambie (requisito de
|
|
29
|
+
* `useSyncExternalStore`); al cambiar, guarda el instante en `since`.
|
|
30
|
+
*/
|
|
31
|
+
export declare const createOnlineStore: ({ target, read, now }?: OnlineStoreOptions) => OnlineStore;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region src/hooks/onlineStatusLogic.ts
|
|
2
|
+
var e = Object.freeze({
|
|
3
|
+
online: !0,
|
|
4
|
+
since: null
|
|
5
|
+
}), t = (e = n()) => e?.onLine ?? !0;
|
|
6
|
+
function n() {
|
|
7
|
+
return typeof navigator > "u" ? void 0 : navigator;
|
|
8
|
+
}
|
|
9
|
+
var r = ({ target: e = typeof window > "u" ? null : window, read: n = () => t(), now: r = Date.now } = {}) => {
|
|
10
|
+
let i = {
|
|
11
|
+
online: n(),
|
|
12
|
+
since: null
|
|
13
|
+
};
|
|
14
|
+
return {
|
|
15
|
+
subscribe: (t) => e ? (e.addEventListener("online", t), e.addEventListener("offline", t), () => {
|
|
16
|
+
e.removeEventListener("online", t), e.removeEventListener("offline", t);
|
|
17
|
+
}) : () => {},
|
|
18
|
+
getSnapshot: () => {
|
|
19
|
+
let e = n();
|
|
20
|
+
return e !== i.online && (i = {
|
|
21
|
+
online: e,
|
|
22
|
+
since: r()
|
|
23
|
+
}), i;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
//#endregion
|
|
28
|
+
export { e as SERVER_ONLINE_STATUS, r as createOnlineStore, t as readOnline };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Forma guardada en storage: versión + dato. */
|
|
2
|
+
export type Stored<T> = {
|
|
3
|
+
v: number;
|
|
4
|
+
data: T;
|
|
5
|
+
};
|
|
6
|
+
/** Serializa el dato junto con su versión. */
|
|
7
|
+
export declare const serializeStored: <T>(data: T, version: number) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Lee un valor guardado. Devuelve `fallback` ante cualquier problema:
|
|
10
|
+
* sin dato, JSON inválido, forma incorrecta o versión distinta.
|
|
11
|
+
*/
|
|
12
|
+
export declare const parseStored: <T>(raw: string | null | undefined, version: number, fallback: T) => T;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/hooks/persistentStateLogic.ts
|
|
2
|
+
var e = (e, t) => JSON.stringify({
|
|
3
|
+
v: t,
|
|
4
|
+
data: e
|
|
5
|
+
}), t = (e, t, n) => {
|
|
6
|
+
if (e == null) return n;
|
|
7
|
+
try {
|
|
8
|
+
let r = JSON.parse(e);
|
|
9
|
+
if (typeof r != "object" || !r) return n;
|
|
10
|
+
let i = r;
|
|
11
|
+
return i.v !== t || !("data" in i) ? n : i.data;
|
|
12
|
+
} catch {
|
|
13
|
+
return n;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { t as parseStored, e as serializeStored };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** Planificador de frames inyectable (tests): `requestAnimationFrame` en el navegador. */
|
|
2
|
+
export type FrameScheduler = {
|
|
3
|
+
request: (cb: () => void) => number;
|
|
4
|
+
cancel: (id: number) => void;
|
|
5
|
+
};
|
|
6
|
+
/** Función throttleada a un frame: `cancel` descarta lo pendiente, `flush` lo corre ya. */
|
|
7
|
+
export type RafThrottled<A extends unknown[]> = ((...args: A) => void) & {
|
|
8
|
+
cancel: () => void;
|
|
9
|
+
flush: () => void;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Coalesce las llamadas a `fn` en UNA por frame, con los últimos argumentos. Pensado para trabajo
|
|
13
|
+
* disparado por scroll/resize/pointermove (lecturas de layout + escrituras de estilo o estado):
|
|
14
|
+
* muchos eventos por frame → un solo recálculo justo antes de pintar.
|
|
15
|
+
*/
|
|
16
|
+
export declare const rafThrottle: <A extends unknown[]>(fn: (...args: A) => void, scheduler?: FrameScheduler) => RafThrottled<A>;
|
|
17
|
+
/** Lo mínimo de `window` que usa `onViewportChange` (inyectable en tests). */
|
|
18
|
+
export type ViewportEventTarget = {
|
|
19
|
+
addEventListener: (type: string, fn: () => void, options: AddEventListenerOptions) => void;
|
|
20
|
+
removeEventListener: (type: string, fn: () => void, options: EventListenerOptions) => void;
|
|
21
|
+
};
|
|
22
|
+
export type ViewportChangeOptions = {
|
|
23
|
+
/** Default: `window`. */
|
|
24
|
+
target?: ViewportEventTarget;
|
|
25
|
+
scheduler?: FrameScheduler;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Corre `fn` a lo sumo una vez por frame ante cualquier scroll (fase de captura: también los
|
|
29
|
+
* scrollers anidados) o resize. Los listeners son pasivos (nunca llaman a preventDefault).
|
|
30
|
+
* Devuelve el cleanup: saca los listeners y cancela el frame pendiente. Pensado para reubicar
|
|
31
|
+
* overlays posicionados con coordenadas de viewport.
|
|
32
|
+
*/
|
|
33
|
+
export declare const onViewportChange: (fn: () => void, options?: ViewportChangeOptions) => (() => void);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region src/hooks/rafThrottle.ts
|
|
2
|
+
var e = () => typeof requestAnimationFrame == "function" ? {
|
|
3
|
+
request: (e) => requestAnimationFrame(e),
|
|
4
|
+
cancel: (e) => cancelAnimationFrame(e)
|
|
5
|
+
} : {
|
|
6
|
+
request: (e) => setTimeout(e, 16),
|
|
7
|
+
cancel: (e) => clearTimeout(e)
|
|
8
|
+
}, t = (t, n = e()) => {
|
|
9
|
+
let r = null, i = null, a = () => {
|
|
10
|
+
r = null;
|
|
11
|
+
let e = i;
|
|
12
|
+
i = null, e && t(...e);
|
|
13
|
+
}, o = ((...e) => {
|
|
14
|
+
i = e, r === null && (r = n.request(a));
|
|
15
|
+
});
|
|
16
|
+
return o.cancel = () => {
|
|
17
|
+
r !== null && n.cancel(r), r = null, i = null;
|
|
18
|
+
}, o.flush = () => {
|
|
19
|
+
r !== null && (n.cancel(r), a());
|
|
20
|
+
}, o;
|
|
21
|
+
}, n = (e, n = {}) => {
|
|
22
|
+
let r = n.target ?? (typeof window > "u" ? null : window);
|
|
23
|
+
if (!r) return () => {};
|
|
24
|
+
let i = t(e, n.scheduler), a = () => i();
|
|
25
|
+
return r.addEventListener("scroll", a, {
|
|
26
|
+
capture: !0,
|
|
27
|
+
passive: !0
|
|
28
|
+
}), r.addEventListener("resize", a, { passive: !0 }), () => {
|
|
29
|
+
r.removeEventListener("scroll", a, { capture: !0 }), r.removeEventListener("resize", a, {}), i.cancel();
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { n as onViewportChange, t as rafThrottle };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type RecentEntry = {
|
|
2
|
+
id: string;
|
|
3
|
+
label: string;
|
|
4
|
+
meta?: Record<string, unknown>;
|
|
5
|
+
at: number;
|
|
6
|
+
};
|
|
7
|
+
/** Agrega al frente, deduplica por id y recorta a `max` (descarta los más viejos). */
|
|
8
|
+
export declare const addRecentEntry: (list: RecentEntry[], entry: Omit<RecentEntry, "at">, max: number, now: number) => RecentEntry[];
|
|
9
|
+
export declare const removeRecentEntry: (list: RecentEntry[], id: string) => RecentEntry[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/hooks/recentLogic.ts
|
|
2
|
+
var e = (e, t, n, r) => {
|
|
3
|
+
let i = e.filter((e) => e.id !== t.id);
|
|
4
|
+
return [{
|
|
5
|
+
...t,
|
|
6
|
+
at: r
|
|
7
|
+
}, ...i].slice(0, Math.max(0, n));
|
|
8
|
+
}, t = (e, t) => e.filter((e) => e.id !== t);
|
|
9
|
+
//#endregion
|
|
10
|
+
export { e as addRecentEntry, t as removeRecentEntry };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Media query del SO para movimiento reducido. */
|
|
2
|
+
export declare const REDUCED_MOTION_QUERY = "(prefers-reduced-motion: reduce)";
|
|
3
|
+
type MatchMediaLike = (query: string) => {
|
|
4
|
+
matches: boolean;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* ¿Hay que reducir el movimiento? Única fuente de verdad en JS, espejo del gate de `kapi.css`:
|
|
8
|
+
* true si el SO pide `prefers-reduced-motion: reduce` O si el `.kapi` que contiene a
|
|
9
|
+
* `from` (o el primero del documento, sin `from`) tiene `data-motion="reduced"` (toggle in-app).
|
|
10
|
+
* `matchMedia` es inyectable para tests; `null` = no disponible (solo decide el toggle).
|
|
11
|
+
*/
|
|
12
|
+
export declare const prefersReducedMotion: (from?: Element | null, matchMedia?: MatchMediaLike | null) => boolean;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { KAPI_ROOT_SELECTOR as e } from "./kapiRoot.js";
|
|
2
|
+
//#region src/hooks/reducedMotion.ts
|
|
3
|
+
var t = "(prefers-reduced-motion: reduce)", n = () => typeof window < "u" && typeof window.matchMedia == "function" ? (e) => window.matchMedia(e) : null, r = (t, r = n()) => r?.("(prefers-reduced-motion: reduce)").matches ? !0 : typeof document > "u" ? !1 : (t ? t.closest(e) : document.querySelector(e))?.getAttribute("data-motion") === "reduced";
|
|
4
|
+
//#endregion
|
|
5
|
+
export { t as REDUCED_MOTION_QUERY, r as prefersReducedMotion };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Elementos sobre los que el click derecho NO inicia drag (son interactivos). */
|
|
2
|
+
export declare const INTERACTIVE_SELECTOR = "button, a, input, select, textarea, label, [role=button], [data-no-drag]";
|
|
3
|
+
/** Píxeles que hay que mover (|dx|+|dy|) para considerar que es un drag y no un click. */
|
|
4
|
+
export declare const DRAG_THRESHOLD = 4;
|
|
5
|
+
/** Ventana (ms) entre dos clicks derechos para contarlos como "doble". */
|
|
6
|
+
export declare const DOUBLE_CLICK_MS = 450;
|
|
7
|
+
export declare const exceedsDragThreshold: (dx: number, dy: number) => boolean;
|
|
8
|
+
export declare const isDoubleRightClick: (now: number, last: number) => boolean;
|
|
9
|
+
/** Opciones del motor para un menú anclado a un punto: sin vuelta, acotado en ambos ejes. */
|
|
10
|
+
export declare const POINT_MENU_PLACEMENT: {
|
|
11
|
+
readonly side: "bottom";
|
|
12
|
+
readonly align: "start";
|
|
13
|
+
readonly offset: 0;
|
|
14
|
+
readonly flip: false;
|
|
15
|
+
readonly shift: "both";
|
|
16
|
+
};
|
|
17
|
+
/** Clampea la posición de un menú flotante para que no se salga del viewport (wrapper de `placePopover`). */
|
|
18
|
+
export declare const clampMenuPosition: (x: number, y: number, size: {
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
}, viewport: {
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
}, margin?: number) => {
|
|
25
|
+
left: number;
|
|
26
|
+
top: number;
|
|
27
|
+
};
|
|
28
|
+
/** Primer ancestro (incluido el nodo) que realmente scrollea en X o en Y. */
|
|
29
|
+
export declare const findScrollableAncestor: (node: EventTarget | null) => HTMLElement | null;
|
|
30
|
+
export declare const isInteractiveTarget: (target: EventTarget | null) => boolean;
|
|
31
|
+
/**
|
|
32
|
+
* ¿Hay que suprimir el menú nativo de este `contextmenu`? En táctil, el long-press dispara
|
|
33
|
+
* `contextmenu` y el menú nativo (copiar, abrir enlace…) es lo único que hay: no se toca.
|
|
34
|
+
* Manda el `pointerType` del propio evento (Chrome lo emite como PointerEvent); si no viene,
|
|
35
|
+
* se usa el del último `pointerdown`.
|
|
36
|
+
*/
|
|
37
|
+
export declare const shouldInterceptContextMenu: (eventPointerType: string | undefined, lastPointerType: string | null) => boolean;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { placePopover as e } from "../components/overlays/popoverLogic.js";
|
|
2
|
+
//#region src/hooks/rightClick.ts
|
|
3
|
+
var t = "button, a, input, select, textarea, label, [role=button], [data-no-drag]", n = (e, t) => Math.abs(e) + Math.abs(t) > 4, r = (e, t) => t > 0 && e - t < 450, i = {
|
|
4
|
+
side: "bottom",
|
|
5
|
+
align: "start",
|
|
6
|
+
offset: 0,
|
|
7
|
+
flip: !1,
|
|
8
|
+
shift: "both"
|
|
9
|
+
}, a = (t, n, r, a, o = 8) => {
|
|
10
|
+
let { left: s, top: c } = e({
|
|
11
|
+
x: t,
|
|
12
|
+
y: n
|
|
13
|
+
}, r, a, {
|
|
14
|
+
...i,
|
|
15
|
+
margin: o
|
|
16
|
+
});
|
|
17
|
+
return {
|
|
18
|
+
left: s,
|
|
19
|
+
top: c
|
|
20
|
+
};
|
|
21
|
+
}, o = (e) => {
|
|
22
|
+
for (let t = e; t && t !== document.body; t = t.parentElement) {
|
|
23
|
+
if (!(t instanceof HTMLElement)) continue;
|
|
24
|
+
let e = getComputedStyle(t), n = /(auto|scroll)/.test(e.overflowY) && t.scrollHeight > t.clientHeight, r = /(auto|scroll)/.test(e.overflowX) && t.scrollWidth > t.clientWidth;
|
|
25
|
+
if (n || r) return t;
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}, s = (e) => e instanceof Element && e.closest("button, a, input, select, textarea, label, [role=button], [data-no-drag]") !== null, c = (e, t) => (e || t) !== "touch";
|
|
29
|
+
//#endregion
|
|
30
|
+
export { t as INTERACTIVE_SELECTOR, i as POINT_MENU_PLACEMENT, a as clampMenuPosition, n as exceedsDragThreshold, o as findScrollableAncestor, r as isDoubleRightClick, s as isInteractiveTarget, c as shouldInterceptContextMenu };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Lógica pura del header colapsable (el IntersectionObserver en sí no es testeable). */
|
|
2
|
+
export type ScrollCollapseOptions = {
|
|
3
|
+
/** Contenedor con scroll; `null`/omitido = viewport. */
|
|
4
|
+
root?: Element | null;
|
|
5
|
+
/** rootMargin del observer (ej. "0px 0px 0px 0px"). */
|
|
6
|
+
rootMargin?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const DEFAULT_ROOT_MARGIN = "0px";
|
|
9
|
+
/** El header está colapsado cuando el centinela ya no es visible. */
|
|
10
|
+
export declare const collapsedFromIntersection: (isIntersecting: boolean) => boolean;
|
|
11
|
+
/** Normaliza un rootMargin: vacío o solo espacios → valor por defecto. */
|
|
12
|
+
export declare const normalizeRootMargin: (rootMargin?: string) => string;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** Eje de scroll. */
|
|
2
|
+
export type KapiScrollAxis = "x" | "y";
|
|
3
|
+
/** Geometría de scroll de un eje (los valores del navegador: pueden ser fraccionarios). */
|
|
4
|
+
export type ScrollMetrics = {
|
|
5
|
+
/** `scrollLeft` / `scrollTop`. */
|
|
6
|
+
position: number;
|
|
7
|
+
/** `clientWidth` / `clientHeight`. */
|
|
8
|
+
clientSize: number;
|
|
9
|
+
/** `scrollWidth` / `scrollHeight`. */
|
|
10
|
+
scrollSize: number;
|
|
11
|
+
};
|
|
12
|
+
/** Qué bordes tienen más contenido fuera de vista. */
|
|
13
|
+
export type ScrollEdges = {
|
|
14
|
+
start: boolean;
|
|
15
|
+
end: boolean;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Tolerancia en px. Los navegadores devuelven `scrollLeft` fraccionario con zoom o densidad no
|
|
19
|
+
* entera, mientras `scrollWidth`/`clientWidth` van redondeados: comparar con `===` fallaría.
|
|
20
|
+
*/
|
|
21
|
+
export declare const DEFAULT_SCROLL_EDGE_TOLERANCE = 1;
|
|
22
|
+
/** Fracción del alto/ancho visible que avanza un "page" (el resto queda como solape de contexto). */
|
|
23
|
+
export declare const DEFAULT_PAGE_FRACTION = 0.85;
|
|
24
|
+
/** Máximo desplazamiento posible (nunca negativo). */
|
|
25
|
+
export declare const maxScroll: ({ clientSize, scrollSize }: Pick<ScrollMetrics, "clientSize" | "scrollSize">) => number;
|
|
26
|
+
/**
|
|
27
|
+
* ¿Hay más contenido antes (`start`) y/o después (`end`)? Sin desborde, ninguno. Un `position`
|
|
28
|
+
* fuera de rango (rebote elástico de iOS/macOS) cuenta como en el borde. Sólo LTR: en RTL el
|
|
29
|
+
* `scrollLeft` es negativo y su convención depende del navegador, así que no se interpreta acá.
|
|
30
|
+
*/
|
|
31
|
+
export declare const scrollEdges: (m: ScrollMetrics, tolerance?: number) => ScrollEdges;
|
|
32
|
+
/** Igualdad estructural de bordes (guarda para no re-renderizar con el mismo resultado). */
|
|
33
|
+
export declare const sameScrollEdges: (a: ScrollEdges, b: ScrollEdges) => boolean;
|
|
34
|
+
/** Cuánto avanza un "page" (px, al menos 1). */
|
|
35
|
+
export declare const pageSize: (clientSize: number, fraction?: number) => number;
|
|
36
|
+
/**
|
|
37
|
+
* Posición destino de un "page" hacia atrás (`-1`) o adelante (`1`), acotada a `[0, max]`.
|
|
38
|
+
*/
|
|
39
|
+
export declare const pageTarget: (m: ScrollMetrics, direction: -1 | 1, fraction?: number) => number;
|
|
40
|
+
/**
|
|
41
|
+
* Posición destino para dejar un ítem completamente visible con un margen, moviendo lo mínimo.
|
|
42
|
+
* `itemStart`/`itemEnd` son los bordes del ítem relativos al borde inicial de la zona visible
|
|
43
|
+
* (negativo = fuera por atrás; mayor a `clientSize` = fuera por adelante). Si ya está visible
|
|
44
|
+
* devuelve la posición actual; si es más grande que la zona visible, alinea su inicio.
|
|
45
|
+
*/
|
|
46
|
+
export declare const revealTarget: (m: ScrollMetrics, item: {
|
|
47
|
+
start: number;
|
|
48
|
+
end: number;
|
|
49
|
+
}, padding?: number) => number;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/hooks/scrollEdgesLogic.ts
|
|
2
|
+
var e = 1, t = .85, n = ({ clientSize: e, scrollSize: t }) => Math.max(0, t - e), r = (e, t = 1) => {
|
|
3
|
+
let r = n(e);
|
|
4
|
+
return r <= t ? {
|
|
5
|
+
start: !1,
|
|
6
|
+
end: !1
|
|
7
|
+
} : {
|
|
8
|
+
start: e.position > t,
|
|
9
|
+
end: e.position < r - t
|
|
10
|
+
};
|
|
11
|
+
}, i = (e, t) => e.start === t.start && e.end === t.end, a = (e, n = t) => Math.max(1, Math.round(e * n)), o = (e, r, i = t) => {
|
|
12
|
+
let o = e.position + r * a(e.clientSize, i);
|
|
13
|
+
return Math.min(n(e), Math.max(0, o));
|
|
14
|
+
}, s = (e, t, r = 0) => {
|
|
15
|
+
let i = n(e), a = 0;
|
|
16
|
+
return t.start < r ? a = t.start - r : t.end > e.clientSize - r && (a = Math.min(t.end - (e.clientSize - r), t.start - r)), Math.min(i, Math.max(0, e.position + a));
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { t as DEFAULT_PAGE_FRACTION, e as DEFAULT_SCROLL_EDGE_TOLERANCE, n as maxScroll, a as pageSize, o as pageTarget, s as revealTarget, i as sameScrollEdges, r as scrollEdges };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type SlidingIndicatorBox = {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
};
|
|
7
|
+
type BoxLike = {
|
|
8
|
+
left: number;
|
|
9
|
+
top: number;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Caja del indicador deslizante relativa al padding-box del contenedor (origen del `position:absolute`).
|
|
15
|
+
* Se calcula con rects de viewport + scroll + borde del contenedor, así sirve igual para layouts
|
|
16
|
+
* verticales, horizontales con scroll, y para ítems dentro de un wrapper intermedio.
|
|
17
|
+
*/
|
|
18
|
+
export declare const slidingIndicatorBox: (item: BoxLike, container: BoxLike, scroll?: {
|
|
19
|
+
left: number;
|
|
20
|
+
top: number;
|
|
21
|
+
}, border?: {
|
|
22
|
+
left: number;
|
|
23
|
+
top: number;
|
|
24
|
+
}) => SlidingIndicatorBox;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/hooks/slidingIndicatorLogic.ts
|
|
2
|
+
var e = (e, t, n = {
|
|
3
|
+
left: 0,
|
|
4
|
+
top: 0
|
|
5
|
+
}, r = {
|
|
6
|
+
left: 0,
|
|
7
|
+
top: 0
|
|
8
|
+
}) => ({
|
|
9
|
+
x: Math.round(e.left - t.left - r.left + n.left),
|
|
10
|
+
y: Math.round(e.top - t.top - r.top + n.top),
|
|
11
|
+
width: Math.round(e.width),
|
|
12
|
+
height: Math.round(e.height)
|
|
13
|
+
});
|
|
14
|
+
//#endregion
|
|
15
|
+
export { e as slidingIndicatorBox };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Namespace por defecto de las claves del design system. */
|
|
2
|
+
export declare const DEFAULT_STORAGE_NAMESPACE = "kapi";
|
|
3
|
+
/** Lo mínimo de `Storage` que se usa (inyectable para testear). */
|
|
4
|
+
export type StorageLike = Pick<Storage, "getItem" | "setItem" | "removeItem">;
|
|
5
|
+
/** `${namespace}:${name}`; sin namespace (o vacío) usa `kapi`. */
|
|
6
|
+
export declare const storageKey: (namespace: string | undefined, name: string) => string;
|
|
7
|
+
/** `localStorage` si existe y se puede acceder (SSR o modo privado estricto → `null`). */
|
|
8
|
+
export declare const defaultStorage: () => StorageLike | null;
|
|
9
|
+
/**
|
|
10
|
+
* Migra una clave vieja a la nueva: si hay valor legacy y la nueva está vacía, lo copia; en
|
|
11
|
+
* cualquier caso borra la legacy (la nueva manda). Nunca tira: el storage puede fallar.
|
|
12
|
+
*/
|
|
13
|
+
export declare const migrateLegacy: (storage: StorageLike | null, legacyKey: string, newKey: string) => void;
|
|
14
|
+
/** Lee `key` migrando antes `legacyKey` (si se pasa). `null` si no hay valor o falla el storage. */
|
|
15
|
+
export declare const readWithLegacy: (storage: StorageLike | null, key: string, legacyKey?: string) => string | null;
|