@qw-ui/core 0.3.0-next.9 → 0.3.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 +21 -37
- package/dist/action-sheet/action-sheet.d.ts +110 -0
- package/dist/action-sheet/index.d.ts +2 -0
- package/dist/action-sheet/index.js +2 -0
- package/dist/action-sheet-Cvcr1S_m.js +183 -0
- package/dist/action-sheet-Cvcr1S_m.js.map +1 -0
- package/dist/area-picker/area-picker.d.ts +113 -0
- package/dist/area-picker/index.d.ts +1 -0
- package/dist/area-picker/index.js +348 -0
- package/dist/area-picker/index.js.map +1 -0
- package/dist/aria-description-CimD2M_C.js +13 -0
- package/dist/aria-description-CimD2M_C.js.map +1 -0
- package/dist/aria-description.d.ts +2 -0
- package/dist/avatar/avatar-load.d.ts +76 -0
- package/dist/avatar/avatar.d.ts +22 -5
- package/dist/avatar/index.d.ts +1 -0
- package/dist/avatar/index.js +57 -18
- package/dist/avatar/index.js.map +1 -1
- package/dist/avatar-load-w9dq05oV.js +139 -0
- package/dist/avatar-load-w9dq05oV.js.map +1 -0
- package/dist/back-top/back-top.d.ts +77 -0
- package/dist/back-top/index.d.ts +1 -0
- package/dist/back-top/index.js +189 -0
- package/dist/back-top/index.js.map +1 -0
- package/dist/badge/badge.d.ts +85 -0
- package/dist/badge/index.d.ts +1 -0
- package/dist/badge/index.js +88 -0
- package/dist/badge/index.js.map +1 -0
- package/dist/button/button.d.ts +13 -0
- package/dist/button/index.js +3 -5
- package/dist/button/index.js.map +1 -1
- package/dist/calendar/calendar.d.ts +100 -0
- package/dist/calendar/index.d.ts +1 -0
- package/dist/calendar/index.js +2 -0
- package/dist/calendar-CmpK3stz.js +363 -0
- package/dist/calendar-CmpK3stz.js.map +1 -0
- package/dist/card/card.d.ts +68 -0
- package/dist/card/index.d.ts +2 -0
- package/dist/card/index.js +2 -0
- package/dist/card-DRtWa6Cr.js +107 -0
- package/dist/card-DRtWa6Cr.js.map +1 -0
- package/dist/cascader/cascader.d.ts +115 -0
- package/dist/cascader/index.d.ts +1 -0
- package/dist/cascader/index.js +2 -0
- package/dist/cascader-D-xMjs7P.js +333 -0
- package/dist/cascader-D-xMjs7P.js.map +1 -0
- package/dist/cell/cell.d.ts +41 -0
- package/dist/cell/index.d.ts +1 -0
- package/dist/cell/index.js +43 -0
- package/dist/cell/index.js.map +1 -0
- package/dist/check-list/check-list.d.ts +78 -0
- package/dist/check-list/index.d.ts +2 -0
- package/dist/check-list/index.js +2 -0
- package/dist/check-list-BvZHQt5w.js +60 -0
- package/dist/check-list-BvZHQt5w.js.map +1 -0
- package/dist/checkbox/checkbox.d.ts +59 -0
- package/dist/checkbox/index.d.ts +2 -0
- package/dist/checkbox/index.js +2 -0
- package/dist/checkbox-BlndJrz5.js +127 -0
- package/dist/checkbox-BlndJrz5.js.map +1 -0
- package/dist/checkbox-group/checkbox-group.d.ts +86 -0
- package/dist/checkbox-group/index.d.ts +3 -0
- package/dist/checkbox-group/index.js +2 -0
- package/dist/checkbox-group-gGfsTv-e.js +223 -0
- package/dist/checkbox-group-gGfsTv-e.js.map +1 -0
- package/dist/choice-group-C4c9m0qe.js +373 -0
- package/dist/choice-group-C4c9m0qe.js.map +1 -0
- package/dist/circle/circle.d.ts +97 -0
- package/dist/circle/index.d.ts +1 -0
- package/dist/circle/index.js +119 -0
- package/dist/circle/index.js.map +1 -0
- package/dist/collapse/collapse.d.ts +98 -0
- package/dist/collapse/index.d.ts +2 -0
- package/dist/collapse/index.js +2 -0
- package/dist/collapse-B969h7-H.js +226 -0
- package/dist/collapse-B969h7-H.js.map +1 -0
- package/dist/countdown/countdown.d.ts +114 -0
- package/dist/countdown/index.d.ts +1 -0
- package/dist/countdown/index.js +309 -0
- package/dist/countdown/index.js.map +1 -0
- package/dist/date-picker/date-picker.d.ts +168 -0
- package/dist/date-picker/index.d.ts +1 -0
- package/dist/date-picker/index.js +401 -0
- package/dist/date-picker/index.js.map +1 -0
- package/dist/descriptions/descriptions.d.ts +69 -0
- package/dist/descriptions/index.d.ts +1 -0
- package/dist/descriptions/index.js +86 -0
- package/dist/descriptions/index.js.map +1 -0
- package/dist/dialog/dialog.d.ts +61 -43
- package/dist/dialog/index.js +73 -19
- package/dist/dialog/index.js.map +1 -1
- package/dist/divider/divider.d.ts +18 -2
- package/dist/divider/index.js +20 -2
- package/dist/divider/index.js.map +1 -1
- package/dist/dropdown/dropdown.d.ts +172 -0
- package/dist/dropdown/index.d.ts +2 -0
- package/dist/dropdown/index.js +467 -0
- package/dist/dropdown/index.js.map +1 -0
- package/dist/ellipsis/ellipsis-layout.d.ts +34 -0
- package/dist/ellipsis/ellipsis.d.ts +88 -0
- package/dist/ellipsis/index.d.ts +2 -0
- package/dist/ellipsis/index.js +320 -0
- package/dist/ellipsis/index.js.map +1 -0
- package/dist/empty/empty-illustration.d.ts +3 -0
- package/dist/empty/empty.d.ts +43 -1
- package/dist/empty/index.js +2 -21
- package/dist/empty-CAgyvhUI.js +166 -0
- package/dist/empty-CAgyvhUI.js.map +1 -0
- package/dist/field/field.d.ts +95 -0
- package/dist/field/index.d.ts +2 -0
- package/dist/field/index.js +2 -0
- package/dist/field-DMHGIMZF.js +241 -0
- package/dist/field-DMHGIMZF.js.map +1 -0
- package/dist/floating-bubble/floating-bubble.d.ts +116 -0
- package/dist/floating-bubble/index.d.ts +1 -0
- package/dist/floating-bubble/index.js +333 -0
- package/dist/floating-bubble/index.js.map +1 -0
- package/dist/floating-panel/floating-panel.d.ts +80 -0
- package/dist/floating-panel/index.d.ts +2 -0
- package/dist/floating-panel/index.js +2 -0
- package/dist/floating-panel-Cbm5njBJ.js +363 -0
- package/dist/floating-panel-Cbm5njBJ.js.map +1 -0
- package/dist/footer/footer.d.ts +94 -0
- package/dist/footer/index.d.ts +1 -0
- package/dist/footer/index.js +154 -0
- package/dist/footer/index.js.map +1 -0
- package/dist/form/connect.d.ts +6 -0
- package/dist/form/form.d.ts +100 -0
- package/dist/form/ids.d.ts +14 -0
- package/dist/form/index.d.ts +13 -0
- package/dist/form/index.js +3 -0
- package/dist/form/methods.d.ts +5 -0
- package/dist/form/model.d.ts +24 -0
- package/dist/form/native.d.ts +25 -0
- package/dist/form/rules.d.ts +40 -0
- package/dist/form/ssr.d.ts +7 -0
- package/dist/form/types.d.ts +150 -0
- package/dist/form-BAGkIEMY.js +1354 -0
- package/dist/form-BAGkIEMY.js.map +1 -0
- package/dist/format-BDUY0C_c.js +89 -0
- package/dist/format-BDUY0C_c.js.map +1 -0
- package/dist/gesture-_SRHIvBm.js +30 -0
- package/dist/gesture-_SRHIvBm.js.map +1 -0
- package/dist/grid/grid-item.d.ts +22 -0
- package/dist/grid/grid.d.ts +42 -0
- package/dist/grid/index.d.ts +2 -0
- package/dist/grid/index.js +73 -0
- package/dist/grid/index.js.map +1 -0
- package/dist/icon/icon.d.ts +37 -1
- package/dist/icon/identity.d.ts +3 -0
- package/dist/icon/index.js +2 -20
- package/dist/icon-Cgdbnk1u.js +77 -0
- package/dist/icon-Cgdbnk1u.js.map +1 -0
- package/dist/image/image-load.d.ts +24 -0
- package/dist/image/image.d.ts +45 -8
- package/dist/image/index.d.ts +1 -0
- package/dist/image/index.js +116 -14
- package/dist/image/index.js.map +1 -1
- package/dist/image-preview/image-preview.d.ts +124 -0
- package/dist/image-preview/index.d.ts +1 -0
- package/dist/image-preview/index.js +450 -0
- package/dist/image-preview/index.js.map +1 -0
- package/dist/index-bar/index-bar.d.ts +121 -0
- package/dist/index-bar/index.d.ts +1 -0
- package/dist/index-bar/index.js +386 -0
- package/dist/index-bar/index.js.map +1 -0
- package/dist/index.d.ts +115 -10
- package/dist/index.js +151 -11
- package/dist/index.js.map +1 -0
- package/dist/infinite-scroll/index.d.ts +1 -0
- package/dist/infinite-scroll/index.js +248 -0
- package/dist/infinite-scroll/index.js.map +1 -0
- package/dist/infinite-scroll/infinite-scroll.d.ts +95 -0
- package/dist/input/index.js +181 -22
- package/dist/input/index.js.map +1 -1
- package/dist/input/input.d.ts +44 -1
- package/dist/layer-IpFrl5--.js +414 -0
- package/dist/layer-IpFrl5--.js.map +1 -0
- package/dist/layout-BRSqi4AQ.js +43 -0
- package/dist/layout-BRSqi4AQ.js.map +1 -0
- package/dist/layout.d.ts +13 -0
- package/dist/list/index.d.ts +2 -0
- package/dist/list/index.js +2 -0
- package/dist/list/list.d.ts +30 -0
- package/dist/list-6-iz-Irh.js +28 -0
- package/dist/list-6-iz-Irh.js.map +1 -0
- package/dist/loading/index.js +45 -2
- package/dist/loading/index.js.map +1 -1
- package/dist/loading/loading.d.ts +45 -2
- package/dist/modal-dialog-machine-CF9_z3Dm.js +487 -0
- package/dist/modal-dialog-machine-CF9_z3Dm.js.map +1 -0
- package/dist/modal-dialog-machine.d.ts +21 -0
- package/dist/modal-dismissable-lifetime.d.ts +21 -0
- package/dist/modal-registry.d.ts +24 -0
- package/dist/modal-render-hydration.d.ts +35 -0
- package/dist/modal-render-runtime.d.ts +19 -0
- package/dist/modal-render-scope.d.ts +63 -0
- package/dist/nav-bar/index.d.ts +1 -0
- package/dist/nav-bar/index.js +115 -0
- package/dist/nav-bar/index.js.map +1 -0
- package/dist/nav-bar/nav-bar.d.ts +76 -0
- package/dist/notice-bar/index.d.ts +2 -0
- package/dist/notice-bar/index.js +2 -0
- package/dist/notice-bar/notice-bar.d.ts +103 -0
- package/dist/notice-bar-DMpwLvRb.js +231 -0
- package/dist/notice-bar-DMpwLvRb.js.map +1 -0
- package/dist/notify/index.d.ts +1 -0
- package/dist/notify/index.js +251 -0
- package/dist/notify/index.js.map +1 -0
- package/dist/notify/notify.d.ts +123 -0
- package/dist/number-keyboard/index.d.ts +1 -0
- package/dist/number-keyboard/index.js +333 -0
- package/dist/number-keyboard/index.js.map +1 -0
- package/dist/number-keyboard/number-keyboard.d.ts +141 -0
- package/dist/overlay-panel/index.d.ts +2 -0
- package/dist/overlay-panel/index.js +2 -0
- package/dist/overlay-panel/overlay-panel.d.ts +20 -0
- package/dist/overlay-panel-Z_qdKeBj.js +26 -0
- package/dist/overlay-panel-Z_qdKeBj.js.map +1 -0
- package/dist/page-indicator/index.d.ts +1 -0
- package/dist/page-indicator/index.js +138 -0
- package/dist/page-indicator/index.js.map +1 -0
- package/dist/page-indicator/page-indicator.d.ts +93 -0
- package/dist/pagination/index.d.ts +1 -0
- package/dist/pagination/index.js +198 -0
- package/dist/pagination/index.js.map +1 -0
- package/dist/pagination/pagination.d.ts +125 -0
- package/dist/password-input/index.d.ts +1 -0
- package/dist/password-input/index.js +317 -0
- package/dist/password-input/index.js.map +1 -0
- package/dist/password-input/password-input.d.ts +144 -0
- package/dist/picker/index.d.ts +8 -0
- package/dist/picker/index.js +2 -0
- package/dist/picker/picker-machine.d.ts +80 -0
- package/dist/picker/picker.d.ts +121 -0
- package/dist/picker/platform.d.ts +84 -0
- package/dist/picker/selection-connect.d.ts +90 -0
- package/dist/picker/selection-model.d.ts +211 -0
- package/dist/picker-BykFntQN.js +1675 -0
- package/dist/picker-BykFntQN.js.map +1 -0
- package/dist/popover/index.d.ts +3 -0
- package/dist/popover/index.js +253 -0
- package/dist/popover/index.js.map +1 -0
- package/dist/popover/layer.d.ts +44 -0
- package/dist/popover/popover.d.ts +104 -0
- package/dist/popover/positioning.d.ts +132 -0
- package/dist/popup/index.d.ts +2 -0
- package/dist/popup/index.js +2 -0
- package/dist/popup/popup.d.ts +60 -0
- package/dist/popup-z5d8IYCt.js +576 -0
- package/dist/popup-z5d8IYCt.js.map +1 -0
- package/dist/portal-BHCNTWhg.js +78 -0
- package/dist/portal-BHCNTWhg.js.map +1 -0
- package/dist/portal.d.ts +61 -0
- package/dist/price/format.d.ts +19 -0
- package/dist/price/index.d.ts +1 -0
- package/dist/price/index.js +154 -0
- package/dist/price/index.js.map +1 -0
- package/dist/price/price.d.ts +88 -0
- package/dist/progress/index.d.ts +1 -0
- package/dist/progress/index.js +2 -0
- package/dist/progress/progress.d.ts +32 -0
- package/dist/progress-f3iYEfdA.js +37 -0
- package/dist/progress-f3iYEfdA.js.map +1 -0
- package/dist/pull-refresh/index.d.ts +1 -0
- package/dist/pull-refresh/index.js +414 -0
- package/dist/pull-refresh/index.js.map +1 -0
- package/dist/pull-refresh/pull-refresh.d.ts +118 -0
- package/dist/radio-group/index.d.ts +3 -0
- package/dist/radio-group/index.js +2 -0
- package/dist/radio-group/radio-group.d.ts +78 -0
- package/dist/radio-group-BOIMuqnS.js +230 -0
- package/dist/radio-group-BOIMuqnS.js.map +1 -0
- package/dist/rate/index.d.ts +1 -0
- package/dist/rate/index.js +2 -0
- package/dist/rate/rate-form.d.ts +28 -0
- package/dist/rate/rate.d.ts +144 -0
- package/dist/rate-5XsU2QkY.js +631 -0
- package/dist/rate-5XsU2QkY.js.map +1 -0
- package/dist/reorder/index.d.ts +1 -0
- package/dist/reorder/index.js +720 -0
- package/dist/reorder/index.js.map +1 -0
- package/dist/reorder/reorder.d.ts +190 -0
- package/dist/result/index.d.ts +1 -0
- package/dist/result/index.js +123 -0
- package/dist/result/index.js.map +1 -0
- package/dist/result/result.d.ts +88 -0
- package/dist/safe-area/index.d.ts +1 -0
- package/dist/safe-area/index.js +42 -0
- package/dist/safe-area/index.js.map +1 -0
- package/dist/safe-area/safe-area.d.ts +28 -0
- package/dist/search-bar/index.js +4 -2
- package/dist/search-bar/index.js.map +1 -1
- package/dist/search-bar/search-bar.d.ts +6 -0
- package/dist/segmented/index.d.ts +2 -0
- package/dist/segmented/index.js +2 -0
- package/dist/segmented/segmented.d.ts +127 -0
- package/dist/segmented-BaU38_L4.js +367 -0
- package/dist/segmented-BaU38_L4.js.map +1 -0
- package/dist/selection-form-BOM_odUk.js +88 -0
- package/dist/selection-form-BOM_odUk.js.map +1 -0
- package/dist/selection-form.d.ts +27 -0
- package/dist/selection-ivXqO1eu.js +55 -0
- package/dist/selection-ivXqO1eu.js.map +1 -0
- package/dist/selection.d.ts +29 -0
- package/dist/selector/choice-group.d.ts +114 -0
- package/dist/selector/index.d.ts +2 -0
- package/dist/selector/index.js +2 -0
- package/dist/selector/selector.d.ts +90 -0
- package/dist/selector-BU2MMJ4N.js +93 -0
- package/dist/selector-BU2MMJ4N.js.map +1 -0
- package/dist/share-sheet/index.d.ts +1 -0
- package/dist/share-sheet/index.js +138 -0
- package/dist/share-sheet/index.js.map +1 -0
- package/dist/share-sheet/share-sheet.d.ts +139 -0
- package/dist/side-nav/index.d.ts +1 -0
- package/dist/side-nav/index.js +99 -0
- package/dist/side-nav/index.js.map +1 -0
- package/dist/side-nav/side-nav.d.ts +94 -0
- package/dist/skeleton/index.js +51 -2
- package/dist/skeleton/index.js.map +1 -1
- package/dist/skeleton/skeleton.d.ts +34 -3
- package/dist/slider/index.d.ts +1 -0
- package/dist/slider/index.js +482 -0
- package/dist/slider/index.js.map +1 -0
- package/dist/slider/slider.d.ts +174 -0
- package/dist/space/index.d.ts +1 -0
- package/dist/space/index.js +52 -0
- package/dist/space/index.js.map +1 -0
- package/dist/space/space.d.ts +46 -0
- package/dist/statistic/index.d.ts +1 -0
- package/dist/statistic/index.js +152 -0
- package/dist/statistic/index.js.map +1 -0
- package/dist/statistic/statistic.d.ts +101 -0
- package/dist/stepper/index.d.ts +1 -0
- package/dist/stepper/index.js +172 -0
- package/dist/stepper/index.js.map +1 -0
- package/dist/stepper/stepper.d.ts +161 -0
- package/dist/steps/index.d.ts +1 -0
- package/dist/steps/index.js +72 -0
- package/dist/steps/index.js.map +1 -0
- package/dist/steps/steps.d.ts +67 -0
- package/dist/sticky/index.d.ts +1 -0
- package/dist/sticky/index.js +145 -0
- package/dist/sticky/index.js.map +1 -0
- package/dist/sticky/sticky.d.ts +70 -0
- package/dist/swipe-action/index.d.ts +1 -0
- package/dist/swipe-action/index.js +417 -0
- package/dist/swipe-action/index.js.map +1 -0
- package/dist/swipe-action/swipe-action.d.ts +148 -0
- package/dist/swiper/gesture.d.ts +32 -0
- package/dist/swiper/index.d.ts +1 -0
- package/dist/swiper/index.js +2 -0
- package/dist/swiper/swiper.d.ts +177 -0
- package/dist/swiper-BKivDkHp.js +550 -0
- package/dist/swiper-BKivDkHp.js.map +1 -0
- package/dist/switch/index.d.ts +1 -0
- package/dist/switch/index.js +168 -0
- package/dist/switch/index.js.map +1 -0
- package/dist/switch/switch.d.ts +142 -0
- package/dist/tabbar/index.d.ts +1 -0
- package/dist/tabbar/index.js +95 -0
- package/dist/tabbar/index.js.map +1 -0
- package/dist/tabbar/tabbar.d.ts +119 -0
- package/dist/tabs/index.js +22 -1
- package/dist/tabs/index.js.map +1 -1
- package/dist/tabs/tabs.d.ts +12 -8
- package/dist/tag/index.js +123 -2
- package/dist/tag/index.js.map +1 -1
- package/dist/tag/tag.d.ts +67 -1
- package/dist/textarea/index.d.ts +2 -0
- package/dist/textarea/index.js +2 -242
- package/dist/textarea/platform.d.ts +22 -0
- package/dist/textarea/textarea.d.ts +169 -46
- package/dist/textarea-qbnruDUG.js +775 -0
- package/dist/textarea-qbnruDUG.js.map +1 -0
- package/dist/time-picker/index.d.ts +1 -0
- package/dist/time-picker/index.js +228 -0
- package/dist/time-picker/index.js.map +1 -0
- package/dist/time-picker/time-picker.d.ts +83 -0
- package/dist/timeline/index.d.ts +1 -0
- package/dist/timeline/index.js +131 -0
- package/dist/timeline/index.js.map +1 -0
- package/dist/timeline/timeline.d.ts +79 -0
- package/dist/toast/index.js +47 -4
- package/dist/toast/index.js.map +1 -1
- package/dist/toast/toast.d.ts +26 -3
- package/dist/top-bar/index.js +16 -2
- package/dist/top-bar/index.js.map +1 -1
- package/dist/top-bar/top-bar.d.ts +13 -2
- package/dist/tree-select/index.d.ts +1 -0
- package/dist/tree-select/index.js +512 -0
- package/dist/tree-select/index.js.map +1 -0
- package/dist/tree-select/tree-select.d.ts +215 -0
- package/dist/typography/index.d.ts +1 -0
- package/dist/typography/index.js +82 -0
- package/dist/typography/index.js.map +1 -0
- package/dist/typography/typography.d.ts +54 -0
- package/dist/upload/index.d.ts +1 -0
- package/dist/upload/index.js +458 -0
- package/dist/upload/index.js.map +1 -0
- package/dist/upload/upload.d.ts +172 -0
- package/dist/virtual-list/index.d.ts +1 -0
- package/dist/virtual-list/index.js +445 -0
- package/dist/virtual-list/index.js.map +1 -0
- package/dist/virtual-list/virtual-list.d.ts +160 -0
- package/dist/visual-manifest.d.ts +27 -0
- package/dist/watermark/index.d.ts +1 -0
- package/dist/watermark/index.js +260 -0
- package/dist/watermark/index.js.map +1 -0
- package/dist/watermark/watermark.d.ts +106 -0
- package/package.json +417 -44
- package/dist/empty/index.js.map +0 -1
- package/dist/icon/index.js.map +0 -1
- package/dist/textarea/index.js.map +0 -1
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
import { c as clampSwiperIndex } from "../swiper-BKivDkHp.js";
|
|
2
|
+
import { createMachine } from "@zag-js/core";
|
|
3
|
+
//#region src/image-preview/image-preview.ts
|
|
4
|
+
const initial = () => ({
|
|
5
|
+
scale: 1,
|
|
6
|
+
x: 0,
|
|
7
|
+
y: 0
|
|
8
|
+
});
|
|
9
|
+
const finite = (value, fallback) => Number.isFinite(value) ? value : fallback;
|
|
10
|
+
function resolveImagePreviewMaxZoom(value = 3) {
|
|
11
|
+
return Math.max(1, Math.min(6, finite(value, 3)));
|
|
12
|
+
}
|
|
13
|
+
function resolveImagePreviewImages(images = []) {
|
|
14
|
+
if (images.length > 12) throw new RangeError("ImagePreview supports at most 12 images, matching native Swiper channels");
|
|
15
|
+
for (const image of images) if (typeof image.src !== "string" || !image.src.trim() || typeof image.alt !== "string" || !image.alt.trim()) throw new TypeError("ImagePreview images require nonempty src and alt");
|
|
16
|
+
return images;
|
|
17
|
+
}
|
|
18
|
+
function clampImagePreviewTransform(value, maxZoom, width = 0, height = 0) {
|
|
19
|
+
const scale = Math.max(1, Math.min(resolveImagePreviewMaxZoom(maxZoom), finite(value.scale, 1)));
|
|
20
|
+
const xBound = Math.max(0, width * (scale - 1) / 2), yBound = Math.max(0, height * (scale - 1) / 2);
|
|
21
|
+
return {
|
|
22
|
+
scale,
|
|
23
|
+
x: Math.max(-xBound, Math.min(xBound, finite(value.x, 0))),
|
|
24
|
+
y: Math.max(-yBound, Math.min(yBound, finite(value.y, 0)))
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function createImagePreviewProps(props = {}) {
|
|
28
|
+
return {
|
|
29
|
+
...props,
|
|
30
|
+
images: resolveImagePreviewImages(props.images),
|
|
31
|
+
maxZoom: resolveImagePreviewMaxZoom(props.maxZoom),
|
|
32
|
+
ariaLabel: props.ariaLabel?.trim() || "图片预览"
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const imagesOf = (service) => resolveImagePreviewImages(service.prop("images"));
|
|
36
|
+
const indexOf = (service) => clampSwiperIndex({ count: imagesOf(service).length }, service.context.get("index"));
|
|
37
|
+
const imageId = (id, index) => `${id}:image-resource:${index}`;
|
|
38
|
+
const resetGesture = (gesture) => {
|
|
39
|
+
gesture.points.clear();
|
|
40
|
+
gesture.distance = 0;
|
|
41
|
+
};
|
|
42
|
+
const imagePreviewMachine = createMachine({
|
|
43
|
+
props: ({ props }) => createImagePreviewProps(props),
|
|
44
|
+
initialState: () => "ready",
|
|
45
|
+
states: { ready: {} },
|
|
46
|
+
context: ({ prop, bindable }) => ({
|
|
47
|
+
open: bindable(() => ({
|
|
48
|
+
value: prop("open"),
|
|
49
|
+
defaultValue: prop("defaultOpen") ?? false,
|
|
50
|
+
onChange: (open) => prop("onOpenChange")?.(open)
|
|
51
|
+
})),
|
|
52
|
+
index: bindable(() => ({
|
|
53
|
+
value: prop("index"),
|
|
54
|
+
defaultValue: prop("defaultIndex") ?? 0,
|
|
55
|
+
onChange: (index) => prop("onIndexChange")?.({ index })
|
|
56
|
+
})),
|
|
57
|
+
transform: bindable(() => ({
|
|
58
|
+
defaultValue: initial(),
|
|
59
|
+
hash: JSON.stringify
|
|
60
|
+
})),
|
|
61
|
+
status: bindable(() => ({ defaultValue: "loading" })),
|
|
62
|
+
revision: bindable(() => ({ defaultValue: 0 }))
|
|
63
|
+
}),
|
|
64
|
+
refs: () => ({
|
|
65
|
+
gesture: {
|
|
66
|
+
points: /* @__PURE__ */ new Map(),
|
|
67
|
+
distance: 0,
|
|
68
|
+
scale: 1,
|
|
69
|
+
x: 0,
|
|
70
|
+
y: 0,
|
|
71
|
+
originX: 0,
|
|
72
|
+
originY: 0
|
|
73
|
+
},
|
|
74
|
+
syncResource: void 0
|
|
75
|
+
}),
|
|
76
|
+
effects: ["trackResources"],
|
|
77
|
+
watch({ track, prop, context, send }) {
|
|
78
|
+
track([
|
|
79
|
+
() => JSON.stringify(prop("images")),
|
|
80
|
+
() => context.get("index"),
|
|
81
|
+
() => context.get("open"),
|
|
82
|
+
() => prop("maxZoom")
|
|
83
|
+
], () => send({ type: "SYNC" }));
|
|
84
|
+
},
|
|
85
|
+
on: {
|
|
86
|
+
OPEN: { actions: ["open"] },
|
|
87
|
+
INDEX: { actions: ["index"] },
|
|
88
|
+
TRANSFORM: { actions: ["transform"] },
|
|
89
|
+
RESOURCE: { actions: ["resource"] },
|
|
90
|
+
RESET: { actions: ["reset"] },
|
|
91
|
+
RETRY: { actions: ["retry"] },
|
|
92
|
+
SYNC: { actions: ["sync"] }
|
|
93
|
+
},
|
|
94
|
+
implementations: {
|
|
95
|
+
actions: {
|
|
96
|
+
open({ event, context }) {
|
|
97
|
+
if (event.type === "OPEN") context.set("open", event.open);
|
|
98
|
+
},
|
|
99
|
+
index(params) {
|
|
100
|
+
if (params.event.type !== "INDEX" || !imagesOf(params).length) return;
|
|
101
|
+
params.context.set("index", clampSwiperIndex({ count: imagesOf(params).length }, params.event.index));
|
|
102
|
+
},
|
|
103
|
+
transform({ event, context, prop }) {
|
|
104
|
+
if (event.type === "TRANSFORM") context.set("transform", clampImagePreviewTransform(event.value, prop("maxZoom") ?? 3, event.width, event.height));
|
|
105
|
+
},
|
|
106
|
+
resource(params) {
|
|
107
|
+
const { event, context } = params;
|
|
108
|
+
if (event.type === "RESOURCE" && context.get("open") && event.src === imagesOf(params)[indexOf(params)]?.src && event.revision === context.get("revision")) context.set("status", event.status);
|
|
109
|
+
},
|
|
110
|
+
reset({ context, refs }) {
|
|
111
|
+
context.set("transform", initial());
|
|
112
|
+
resetGesture(refs.get("gesture"));
|
|
113
|
+
},
|
|
114
|
+
retry({ context, refs }) {
|
|
115
|
+
context.set("revision", context.get("revision") + 1);
|
|
116
|
+
context.set("status", "loading");
|
|
117
|
+
context.set("transform", initial());
|
|
118
|
+
resetGesture(refs.get("gesture"));
|
|
119
|
+
refs.get("syncResource")?.();
|
|
120
|
+
},
|
|
121
|
+
sync(params) {
|
|
122
|
+
const { context, refs } = params;
|
|
123
|
+
const index = indexOf(params);
|
|
124
|
+
if (params.prop("index") === void 0 && context.get("index") !== index) context.set("index", index);
|
|
125
|
+
context.set("transform", initial());
|
|
126
|
+
context.set("status", "loading");
|
|
127
|
+
context.set("revision", context.get("revision") + 1);
|
|
128
|
+
resetGesture(refs.get("gesture"));
|
|
129
|
+
refs.get("syncResource")?.();
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
effects: { trackResources(params) {
|
|
133
|
+
const { scope, context, send, refs } = params, doc = scope.getDoc(), win = doc?.defaultView;
|
|
134
|
+
if (!doc || !win?.MutationObserver) return;
|
|
135
|
+
let target = null, disposed = false;
|
|
136
|
+
const read = () => {
|
|
137
|
+
const index = indexOf(params), image = imagesOf(params)[index];
|
|
138
|
+
if (disposed || !context.get("open") || !target?.isConnected || !image || target.id !== imageId(scope.id, index) || target.getAttribute("src") !== image.src || target.getAttribute("data-revision") !== String(context.get("revision")) || !target.complete) return;
|
|
139
|
+
const status = Number.isFinite(target.naturalWidth) && target.naturalWidth > 0 ? "loaded" : "error";
|
|
140
|
+
if (context.get("status") !== status) send({
|
|
141
|
+
type: "RESOURCE",
|
|
142
|
+
src: image.src,
|
|
143
|
+
revision: context.get("revision"),
|
|
144
|
+
status
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
const check = () => {
|
|
148
|
+
const id = imageId(scope.id, indexOf(params));
|
|
149
|
+
const next = context.get("open") ? scope.getById(id) ?? doc.getElementById(id) : null;
|
|
150
|
+
if (next !== target) {
|
|
151
|
+
target?.removeEventListener("load", read);
|
|
152
|
+
target?.removeEventListener("error", read);
|
|
153
|
+
target = next;
|
|
154
|
+
target?.addEventListener("load", read);
|
|
155
|
+
target?.addEventListener("error", read);
|
|
156
|
+
}
|
|
157
|
+
read();
|
|
158
|
+
};
|
|
159
|
+
const observer = new win.MutationObserver(check), root = scope.getRootNode();
|
|
160
|
+
const sync = () => {
|
|
161
|
+
observer.disconnect();
|
|
162
|
+
if (context.get("open")) {
|
|
163
|
+
observer.observe(root, {
|
|
164
|
+
childList: true,
|
|
165
|
+
subtree: true
|
|
166
|
+
});
|
|
167
|
+
if (root !== doc) observer.observe(doc, {
|
|
168
|
+
childList: true,
|
|
169
|
+
subtree: true
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
check();
|
|
173
|
+
};
|
|
174
|
+
refs.set("syncResource", sync);
|
|
175
|
+
sync();
|
|
176
|
+
return () => {
|
|
177
|
+
disposed = true;
|
|
178
|
+
refs.set("syncResource", void 0);
|
|
179
|
+
observer.disconnect();
|
|
180
|
+
target?.removeEventListener("load", read);
|
|
181
|
+
target?.removeEventListener("error", read);
|
|
182
|
+
target = null;
|
|
183
|
+
};
|
|
184
|
+
} }
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
function connectImagePreview(service, normalize) {
|
|
188
|
+
const images = imagesOf(service), index = indexOf(service), open = service.context.get("open"), transform = service.context.get("transform"), status = service.context.get("status"), revision = service.context.get("revision"), max = service.prop("maxZoom") ?? 3;
|
|
189
|
+
const part = (name) => ({
|
|
190
|
+
"data-scope": "image-preview",
|
|
191
|
+
"data-part": name
|
|
192
|
+
});
|
|
193
|
+
const reset = () => service.send({ type: "RESET" });
|
|
194
|
+
const changeScale = (value) => service.send({
|
|
195
|
+
type: "TRANSFORM",
|
|
196
|
+
value: {
|
|
197
|
+
scale: value,
|
|
198
|
+
x: 0,
|
|
199
|
+
y: 0
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
const popupProps = {
|
|
203
|
+
id: `${service.scope.id}-popup`,
|
|
204
|
+
open,
|
|
205
|
+
placement: "bottom",
|
|
206
|
+
title: service.prop("title"),
|
|
207
|
+
ariaLabel: service.prop("ariaLabel"),
|
|
208
|
+
closeLabel: service.prop("closeLabel"),
|
|
209
|
+
closeOnMaskClick: service.prop("closeOnMaskClick"),
|
|
210
|
+
disableBodyScroll: service.prop("disableBodyScroll"),
|
|
211
|
+
safeArea: service.prop("safeArea"),
|
|
212
|
+
returnFocus: service.prop("returnFocus"),
|
|
213
|
+
onOpenChange: (next) => service.send({
|
|
214
|
+
type: "OPEN",
|
|
215
|
+
open: next
|
|
216
|
+
})
|
|
217
|
+
};
|
|
218
|
+
const swiperProps = {
|
|
219
|
+
id: `${service.scope.id}-swiper`,
|
|
220
|
+
count: images.length,
|
|
221
|
+
index,
|
|
222
|
+
loop: service.prop("loop"),
|
|
223
|
+
navigation: true,
|
|
224
|
+
indicator: false,
|
|
225
|
+
allowTouchMove: transform.scale === 1,
|
|
226
|
+
label: service.prop("ariaLabel"),
|
|
227
|
+
prevLabel: service.prop("prevLabel"),
|
|
228
|
+
nextLabel: service.prop("nextLabel"),
|
|
229
|
+
onIndexChange: (details) => service.send({
|
|
230
|
+
type: "INDEX",
|
|
231
|
+
index: details.index
|
|
232
|
+
})
|
|
233
|
+
};
|
|
234
|
+
const stageId = (imageIndex) => `${service.scope.id}:image:${imageIndex}`;
|
|
235
|
+
const statusText = status === "error" ? service.prop("errorText") || "图片加载失败" : status === "loading" ? service.prop("loadingText") || "加载中" : "";
|
|
236
|
+
const zoom = (direction) => changeScale(service.context.get("transform").scale + direction * .5);
|
|
237
|
+
const current = (imageIndex) => indexOf(service) === imageIndex && service.context.get("open");
|
|
238
|
+
return {
|
|
239
|
+
images,
|
|
240
|
+
index,
|
|
241
|
+
open,
|
|
242
|
+
status,
|
|
243
|
+
revision,
|
|
244
|
+
transform,
|
|
245
|
+
popupProps,
|
|
246
|
+
swiperProps,
|
|
247
|
+
statusText,
|
|
248
|
+
retryText: service.prop("retryText") || "重试",
|
|
249
|
+
counter: images.length ? `${index + 1} / ${images.length}` : "0 / 0",
|
|
250
|
+
reset,
|
|
251
|
+
setOpen: (next) => service.send({
|
|
252
|
+
type: "OPEN",
|
|
253
|
+
open: next
|
|
254
|
+
}),
|
|
255
|
+
setIndex: (next) => service.send({
|
|
256
|
+
type: "INDEX",
|
|
257
|
+
index: next
|
|
258
|
+
}),
|
|
259
|
+
getRootProps: () => normalize.element({
|
|
260
|
+
...part("root"),
|
|
261
|
+
lang: service.prop("lang"),
|
|
262
|
+
dir: service.prop("dir"),
|
|
263
|
+
"data-visual-target": "image-preview-root"
|
|
264
|
+
}),
|
|
265
|
+
getCounterProps: () => normalize.element({
|
|
266
|
+
...part("counter"),
|
|
267
|
+
role: "status",
|
|
268
|
+
"aria-live": "polite",
|
|
269
|
+
"aria-atomic": true
|
|
270
|
+
}),
|
|
271
|
+
getControlsProps: () => normalize.element({
|
|
272
|
+
...part("controls"),
|
|
273
|
+
role: "group",
|
|
274
|
+
"aria-label": "图片缩放"
|
|
275
|
+
}),
|
|
276
|
+
getZoomInProps: () => normalize.button({
|
|
277
|
+
...part("zoom-in"),
|
|
278
|
+
type: "button",
|
|
279
|
+
"aria-label": service.prop("zoomInLabel") || "放大",
|
|
280
|
+
disabled: !images.length || transform.scale >= max,
|
|
281
|
+
onClick: () => zoom(1)
|
|
282
|
+
}),
|
|
283
|
+
getZoomOutProps: () => normalize.button({
|
|
284
|
+
...part("zoom-out"),
|
|
285
|
+
type: "button",
|
|
286
|
+
"aria-label": service.prop("zoomOutLabel") || "缩小",
|
|
287
|
+
disabled: !images.length || transform.scale <= 1,
|
|
288
|
+
onClick: () => zoom(-1)
|
|
289
|
+
}),
|
|
290
|
+
getResetProps: () => normalize.button({
|
|
291
|
+
...part("reset"),
|
|
292
|
+
type: "button",
|
|
293
|
+
"aria-label": service.prop("resetLabel") || "复位",
|
|
294
|
+
disabled: !images.length || transform.scale === 1,
|
|
295
|
+
onClick: reset
|
|
296
|
+
}),
|
|
297
|
+
getStatusProps: () => normalize.element({
|
|
298
|
+
...part("status"),
|
|
299
|
+
role: status === "error" ? "alert" : "status",
|
|
300
|
+
hidden: status === "loaded" || !images.length
|
|
301
|
+
}),
|
|
302
|
+
getRetryProps: () => normalize.button({
|
|
303
|
+
...part("retry"),
|
|
304
|
+
type: "button",
|
|
305
|
+
hidden: status !== "error",
|
|
306
|
+
onClick: () => service.send({ type: "RETRY" })
|
|
307
|
+
}),
|
|
308
|
+
getImageProps(imageIndex) {
|
|
309
|
+
const image = images[imageIndex];
|
|
310
|
+
const active = imageIndex === index;
|
|
311
|
+
return normalize.element({
|
|
312
|
+
...part("image"),
|
|
313
|
+
id: imageId(service.scope.id, imageIndex),
|
|
314
|
+
src: image.src,
|
|
315
|
+
alt: image.alt,
|
|
316
|
+
draggable: false,
|
|
317
|
+
"data-revision": revision,
|
|
318
|
+
style: { transform: active ? `translate(${transform.x}px, ${transform.y}px) scale(${transform.scale})` : void 0 },
|
|
319
|
+
onLoad: () => {
|
|
320
|
+
if (active) service.send({
|
|
321
|
+
type: "RESOURCE",
|
|
322
|
+
src: image.src,
|
|
323
|
+
revision,
|
|
324
|
+
status: "loaded"
|
|
325
|
+
});
|
|
326
|
+
},
|
|
327
|
+
onError: () => {
|
|
328
|
+
if (active) service.send({
|
|
329
|
+
type: "RESOURCE",
|
|
330
|
+
src: image.src,
|
|
331
|
+
revision,
|
|
332
|
+
status: "error"
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
},
|
|
337
|
+
getStageProps(imageIndex) {
|
|
338
|
+
const active = imageIndex === index;
|
|
339
|
+
return normalize.element({
|
|
340
|
+
...part("stage"),
|
|
341
|
+
id: stageId(imageIndex),
|
|
342
|
+
role: "group",
|
|
343
|
+
tabIndex: active ? 0 : -1,
|
|
344
|
+
"aria-label": images[imageIndex]?.alt,
|
|
345
|
+
"data-zoomed": active && transform.scale > 1 ? "" : void 0,
|
|
346
|
+
"data-visual-target": active ? "image-preview-stage" : void 0,
|
|
347
|
+
onKeyDown(event) {
|
|
348
|
+
if (event.target !== event.currentTarget || !current(imageIndex)) return;
|
|
349
|
+
const key = event.key;
|
|
350
|
+
if (key === "+" || key === "=" || key === "-" || key === "0") {
|
|
351
|
+
event.preventDefault();
|
|
352
|
+
event.stopPropagation();
|
|
353
|
+
if (key === "0") reset();
|
|
354
|
+
else zoom(key === "-" ? -1 : 1);
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
onDoubleClick(event) {
|
|
358
|
+
if (!current(imageIndex)) return;
|
|
359
|
+
event.preventDefault();
|
|
360
|
+
event.stopPropagation();
|
|
361
|
+
changeScale(service.context.get("transform").scale > 1 ? 1 : Math.min(2, max));
|
|
362
|
+
},
|
|
363
|
+
onPointerDown(event) {
|
|
364
|
+
if (!current(imageIndex) || event.pointerType === "mouse" && event.button !== 0) return;
|
|
365
|
+
const gesture = service.refs.get("gesture"), value = service.context.get("transform");
|
|
366
|
+
gesture.points.set(event.pointerId, {
|
|
367
|
+
x: event.clientX,
|
|
368
|
+
y: event.clientY
|
|
369
|
+
});
|
|
370
|
+
if (gesture.points.size === 1) {
|
|
371
|
+
gesture.x = event.clientX;
|
|
372
|
+
gesture.y = event.clientY;
|
|
373
|
+
gesture.originX = value.x;
|
|
374
|
+
gesture.originY = value.y;
|
|
375
|
+
}
|
|
376
|
+
if (gesture.points.size === 2) {
|
|
377
|
+
const points = [...gesture.points.values()];
|
|
378
|
+
gesture.distance = Math.hypot(points[0].x - points[1].x, points[0].y - points[1].y);
|
|
379
|
+
gesture.scale = value.scale;
|
|
380
|
+
const viewport = event.currentTarget.closest("[data-scope=\"swiper\"][data-part=\"viewport\"]"), win = event.currentTarget.ownerDocument.defaultView;
|
|
381
|
+
const first = [...gesture.points.keys()][0];
|
|
382
|
+
if (viewport && win?.PointerEvent) viewport.dispatchEvent(new win.PointerEvent("pointercancel", {
|
|
383
|
+
bubbles: true,
|
|
384
|
+
pointerId: first
|
|
385
|
+
}));
|
|
386
|
+
}
|
|
387
|
+
if (value.scale > 1 || gesture.points.size > 1) {
|
|
388
|
+
event.stopPropagation();
|
|
389
|
+
try {
|
|
390
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
391
|
+
} catch {}
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
onPointerMove(event) {
|
|
395
|
+
const gesture = service.refs.get("gesture");
|
|
396
|
+
if (!current(imageIndex) || !gesture.points.has(event.pointerId)) return;
|
|
397
|
+
gesture.points.set(event.pointerId, {
|
|
398
|
+
x: event.clientX,
|
|
399
|
+
y: event.clientY
|
|
400
|
+
});
|
|
401
|
+
const value = service.context.get("transform"), rect = event.currentTarget.getBoundingClientRect();
|
|
402
|
+
if (gesture.points.size > 1) {
|
|
403
|
+
event.stopPropagation();
|
|
404
|
+
event.preventDefault();
|
|
405
|
+
const points = [...gesture.points.values()];
|
|
406
|
+
const distance = Math.hypot(points[0].x - points[1].x, points[0].y - points[1].y);
|
|
407
|
+
service.send({
|
|
408
|
+
type: "TRANSFORM",
|
|
409
|
+
value: {
|
|
410
|
+
scale: gesture.distance > 0 ? gesture.scale * distance / gesture.distance : value.scale,
|
|
411
|
+
x: 0,
|
|
412
|
+
y: 0
|
|
413
|
+
},
|
|
414
|
+
width: rect.width,
|
|
415
|
+
height: rect.height
|
|
416
|
+
});
|
|
417
|
+
} else if (value.scale > 1) {
|
|
418
|
+
event.stopPropagation();
|
|
419
|
+
event.preventDefault();
|
|
420
|
+
service.send({
|
|
421
|
+
type: "TRANSFORM",
|
|
422
|
+
value: {
|
|
423
|
+
...value,
|
|
424
|
+
x: gesture.originX + event.clientX - gesture.x,
|
|
425
|
+
y: gesture.originY + event.clientY - gesture.y
|
|
426
|
+
},
|
|
427
|
+
width: rect.width,
|
|
428
|
+
height: rect.height
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
},
|
|
432
|
+
onPointerUp(event) {
|
|
433
|
+
const gesture = service.refs.get("gesture");
|
|
434
|
+
if (gesture.points.size > 1 || service.context.get("transform").scale > 1) event.stopPropagation();
|
|
435
|
+
resetGesture(gesture);
|
|
436
|
+
},
|
|
437
|
+
onPointerCancel() {
|
|
438
|
+
resetGesture(service.refs.get("gesture"));
|
|
439
|
+
},
|
|
440
|
+
onLostPointerCapture() {
|
|
441
|
+
resetGesture(service.refs.get("gesture"));
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
//#endregion
|
|
448
|
+
export { clampImagePreviewTransform, connectImagePreview, createImagePreviewProps, imagePreviewMachine, resolveImagePreviewImages, resolveImagePreviewMaxZoom };
|
|
449
|
+
|
|
450
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/image-preview/image-preview.ts"],"sourcesContent":["import { createMachine, type Machine, type Service } from \"@zag-js/core\";\nimport type { NormalizeProps, PropTypes } from \"@zag-js/types\";\nimport type { QwPopupProps } from \"../popup/popup.js\";\nimport { clampSwiperIndex, type QwSwiperProps } from \"../swiper/swiper.js\";\n\nexport interface ImagePreviewImage { src: string; alt: string }\nexport interface ImagePreviewIndexDetails { index: number }\nexport interface QwImagePreviewProps extends Omit<QwPopupProps, \"placement\"> {\n /** Locale on the immediate Popup host; arbitrary outer ancestors are not copied into its portal. */\n lang?: string;\n dir?: string;\n /** Up to 12 images (the shared native Swiper channel domain); alt is always visible to assistive technology. */\n images?: readonly ImagePreviewImage[];\n index?: number;\n defaultIndex?: number;\n loop?: boolean;\n /** Finite upper zoom, clamped to 1–6; default 3. */\n maxZoom?: number;\n prevLabel?: string; nextLabel?: string; zoomInLabel?: string; zoomOutLabel?: string; resetLabel?: string;\n loadingText?: string; errorText?: string; retryText?: string;\n onIndexChange?: (details: ImagePreviewIndexDetails) => void;\n}\nexport interface PreviewTransform { scale: number; x: number; y: number }\ninterface PointerPoint { x: number; y: number }\ninterface Gesture { points: Map<number, PointerPoint>; distance: number; scale: number; x: number; y: number; originX: number; originY: number }\nexport interface QwImagePreviewSchema {\n props: QwImagePreviewProps;\n context: { open: boolean; index: number; transform: PreviewTransform; status: \"loading\" | \"loaded\" | \"error\"; revision: number };\n refs: { gesture: Gesture; syncResource: (() => void) | undefined };\n state: \"ready\";\n effect: \"trackResources\";\n action: \"open\" | \"index\" | \"transform\" | \"resource\" | \"reset\" | \"retry\" | \"sync\";\n event: { type: \"OPEN\"; open: boolean } | { type: \"INDEX\"; index: number } | { type: \"TRANSFORM\"; value: PreviewTransform; width?: number; height?: number } | { type: \"RESOURCE\"; src: string; revision: number; status: \"loaded\" | \"error\" } | { type: \"RESET\" } | { type: \"RETRY\" } | { type: \"SYNC\" };\n}\nexport type QwImagePreviewService = Service<QwImagePreviewSchema>;\nconst initial = (): PreviewTransform => ({ scale: 1, x: 0, y: 0 });\nconst finite = (value: number, fallback: number) => Number.isFinite(value) ? value : fallback;\nexport function resolveImagePreviewMaxZoom(value = 3): number { return Math.max(1, Math.min(6, finite(value, 3))); }\nexport function resolveImagePreviewImages(images: readonly ImagePreviewImage[] = []): readonly ImagePreviewImage[] {\n if (images.length > 12) throw new RangeError(\"ImagePreview supports at most 12 images, matching native Swiper channels\");\n for (const image of images) if (typeof image.src !== \"string\" || !image.src.trim() || typeof image.alt !== \"string\" || !image.alt.trim()) throw new TypeError(\"ImagePreview images require nonempty src and alt\");\n return images;\n}\nexport function clampImagePreviewTransform(value: PreviewTransform, maxZoom: number, width = 0, height = 0): PreviewTransform {\n const scale = Math.max(1, Math.min(resolveImagePreviewMaxZoom(maxZoom), finite(value.scale, 1)));\n const xBound = Math.max(0, width * (scale - 1) / 2), yBound = Math.max(0, height * (scale - 1) / 2);\n return { scale, x: Math.max(-xBound, Math.min(xBound, finite(value.x, 0))), y: Math.max(-yBound, Math.min(yBound, finite(value.y, 0))) };\n}\nexport function createImagePreviewProps(props: QwImagePreviewProps = {}): QwImagePreviewProps {\n return { ...props, images: resolveImagePreviewImages(props.images), maxZoom: resolveImagePreviewMaxZoom(props.maxZoom), ariaLabel: props.ariaLabel?.trim() || \"图片预览\" };\n}\nconst imagesOf = (service: Pick<QwImagePreviewService, \"prop\">) => resolveImagePreviewImages(service.prop(\"images\"));\nconst indexOf = (service: Pick<QwImagePreviewService, \"prop\" | \"context\">) => clampSwiperIndex({ count: imagesOf(service).length }, service.context.get(\"index\"));\nconst imageId = (id: string | undefined, index: number) => `${id}:image-resource:${index}`;\nconst resetGesture = (gesture: Gesture) => { gesture.points.clear(); gesture.distance = 0; };\nexport const imagePreviewMachine: Machine<QwImagePreviewSchema> = createMachine<QwImagePreviewSchema>({\n props: ({ props }) => createImagePreviewProps(props), initialState: () => \"ready\", states: { ready: {} },\n context: ({ prop, bindable }) => ({\n open: bindable(() => ({ value: prop(\"open\"), defaultValue: prop(\"defaultOpen\") ?? false, onChange: (open) => prop(\"onOpenChange\")?.(open) })),\n index: bindable(() => ({ value: prop(\"index\"), defaultValue: prop(\"defaultIndex\") ?? 0, onChange: (index) => prop(\"onIndexChange\")?.({ index }) })),\n transform: bindable(() => ({ defaultValue: initial(), hash: JSON.stringify })), status: bindable<\"loading\" | \"loaded\" | \"error\">(() => ({ defaultValue: \"loading\" })), revision: bindable(() => ({ defaultValue: 0 })),\n }),\n refs: () => ({ gesture: { points: new Map(), distance: 0, scale: 1, x: 0, y: 0, originX: 0, originY: 0 }, syncResource: undefined }),\n effects: [\"trackResources\"],\n watch({ track, prop, context, send }) {\n track([() => JSON.stringify(prop(\"images\")), () => context.get(\"index\"), () => context.get(\"open\"), () => prop(\"maxZoom\")], () => send({ type: \"SYNC\" }));\n },\n on: { OPEN: { actions: [\"open\"] }, INDEX: { actions: [\"index\"] }, TRANSFORM: { actions: [\"transform\"] }, RESOURCE: { actions: [\"resource\"] }, RESET: { actions: [\"reset\"] }, RETRY: { actions: [\"retry\"] }, SYNC: { actions: [\"sync\"] } },\n implementations: { actions: {\n open({ event, context }) { if (event.type === \"OPEN\") context.set(\"open\", event.open); },\n index(params) { if (params.event.type !== \"INDEX\" || !imagesOf(params).length) return; params.context.set(\"index\", clampSwiperIndex({ count: imagesOf(params).length }, params.event.index)); },\n transform({ event, context, prop }) { if (event.type === \"TRANSFORM\") context.set(\"transform\", clampImagePreviewTransform(event.value, prop(\"maxZoom\") ?? 3, event.width, event.height)); },\n resource(params) { const { event, context } = params; if (event.type === \"RESOURCE\" && context.get(\"open\") && event.src === imagesOf(params)[indexOf(params)]?.src && event.revision === context.get(\"revision\")) context.set(\"status\", event.status); },\n reset({ context, refs }) { context.set(\"transform\", initial()); resetGesture(refs.get(\"gesture\")); },\n retry({ context, refs }) { context.set(\"revision\", context.get(\"revision\") + 1); context.set(\"status\", \"loading\"); context.set(\"transform\", initial()); resetGesture(refs.get(\"gesture\")); refs.get(\"syncResource\")?.(); },\n sync(params) { const { context, refs } = params; const index = indexOf(params); if (params.prop(\"index\") === undefined && context.get(\"index\") !== index) context.set(\"index\", index); context.set(\"transform\", initial()); context.set(\"status\", \"loading\"); context.set(\"revision\", context.get(\"revision\") + 1); resetGesture(refs.get(\"gesture\")); refs.get(\"syncResource\")?.(); },\n }, effects: {\n trackResources(params) {\n const { scope, context, send, refs } = params, doc = scope.getDoc(), win = doc?.defaultView;\n if (!doc || !win?.MutationObserver) return;\n let target: HTMLImageElement | null = null, disposed = false;\n const read = () => {\n const index = indexOf(params), image = imagesOf(params)[index];\n if (disposed || !context.get(\"open\") || !target?.isConnected || !image || target.id !== imageId(scope.id, index) || target.getAttribute(\"src\") !== image.src || target.getAttribute(\"data-revision\") !== String(context.get(\"revision\")) || !target.complete) return;\n const status = Number.isFinite(target.naturalWidth) && target.naturalWidth > 0 ? \"loaded\" : \"error\";\n if (context.get(\"status\") !== status) send({ type: \"RESOURCE\", src: image.src, revision: context.get(\"revision\"), status });\n };\n const check = () => {\n const id = imageId(scope.id, indexOf(params));\n const next = context.get(\"open\") ? scope.getById<HTMLImageElement>(id) ?? doc.getElementById(id) as HTMLImageElement | null : null;\n if (next !== target) {\n target?.removeEventListener(\"load\", read); target?.removeEventListener(\"error\", read); target = next;\n target?.addEventListener(\"load\", read); target?.addEventListener(\"error\", read);\n }\n // Cached SSR resources may have completed before hydration installed event handlers.\n read();\n };\n const observer = new win.MutationObserver(check), root = scope.getRootNode();\n const sync = () => {\n observer.disconnect();\n if (context.get(\"open\")) {\n observer.observe(root, { childList: true, subtree: true });\n if (root !== doc) observer.observe(doc, { childList: true, subtree: true });\n }\n check();\n };\n refs.set(\"syncResource\", sync); sync();\n return () => { disposed = true; refs.set(\"syncResource\", undefined); observer.disconnect(); target?.removeEventListener(\"load\", read); target?.removeEventListener(\"error\", read); target = null; };\n },\n } },\n});\ninterface StagePointer { pointerId: number; pointerType?: string; button: number; clientX: number; clientY: number; currentTarget: HTMLElement; stopPropagation(): void; preventDefault(): void }\nexport function connectImagePreview<T extends PropTypes>(service: QwImagePreviewService, normalize: NormalizeProps<T>) {\n const images = imagesOf(service), index = indexOf(service), open = service.context.get(\"open\"), transform = service.context.get(\"transform\"), status = service.context.get(\"status\"), revision = service.context.get(\"revision\"), max = service.prop(\"maxZoom\") ?? 3;\n const part = (name: string) => ({ \"data-scope\": \"image-preview\", \"data-part\": name });\n const reset = () => service.send({ type: \"RESET\" });\n const changeScale = (value: number) => service.send({ type: \"TRANSFORM\", value: { scale: value, x: 0, y: 0 } });\n const popupProps: QwPopupProps = { id: `${service.scope.id}-popup`, open, placement: \"bottom\", title: service.prop(\"title\"), ariaLabel: service.prop(\"ariaLabel\"), closeLabel: service.prop(\"closeLabel\"), closeOnMaskClick: service.prop(\"closeOnMaskClick\"), disableBodyScroll: service.prop(\"disableBodyScroll\"), safeArea: service.prop(\"safeArea\"), returnFocus: service.prop(\"returnFocus\"), onOpenChange: (next) => service.send({ type: \"OPEN\", open: next }) };\n const swiperProps: QwSwiperProps = { id: `${service.scope.id}-swiper`, count: images.length, index, loop: service.prop(\"loop\"), navigation: true, indicator: false, allowTouchMove: transform.scale === 1, label: service.prop(\"ariaLabel\"), prevLabel: service.prop(\"prevLabel\"), nextLabel: service.prop(\"nextLabel\"), onIndexChange: (details) => service.send({ type: \"INDEX\", index: details.index }) };\n const stageId = (imageIndex: number) => `${service.scope.id}:image:${imageIndex}`;\n const statusText = status === \"error\" ? service.prop(\"errorText\") || \"图片加载失败\" : status === \"loading\" ? service.prop(\"loadingText\") || \"加载中\" : \"\";\n const zoom = (direction: -1 | 1) => changeScale(service.context.get(\"transform\").scale + direction * 0.5);\n const current = (imageIndex: number) => indexOf(service) === imageIndex && service.context.get(\"open\");\n return { images, index, open, status, revision, transform, popupProps, swiperProps, statusText, retryText: service.prop(\"retryText\") || \"重试\", counter: images.length ? `${index + 1} / ${images.length}` : \"0 / 0\", reset,\n setOpen: (next: boolean) => service.send({ type: \"OPEN\", open: next }), setIndex: (next: number) => service.send({ type: \"INDEX\", index: next }),\n getRootProps: () => normalize.element({ ...part(\"root\"), lang: service.prop(\"lang\"), dir: service.prop(\"dir\"), \"data-visual-target\": \"image-preview-root\" }),\n getCounterProps: () => normalize.element({ ...part(\"counter\"), role: \"status\", \"aria-live\": \"polite\", \"aria-atomic\": true }),\n getControlsProps: () => normalize.element({ ...part(\"controls\"), role: \"group\", \"aria-label\": \"图片缩放\" }),\n getZoomInProps: () => normalize.button({ ...part(\"zoom-in\"), type: \"button\", \"aria-label\": service.prop(\"zoomInLabel\") || \"放大\", disabled: !images.length || transform.scale >= max, onClick: () => zoom(1) }),\n getZoomOutProps: () => normalize.button({ ...part(\"zoom-out\"), type: \"button\", \"aria-label\": service.prop(\"zoomOutLabel\") || \"缩小\", disabled: !images.length || transform.scale <= 1, onClick: () => zoom(-1) }),\n getResetProps: () => normalize.button({ ...part(\"reset\"), type: \"button\", \"aria-label\": service.prop(\"resetLabel\") || \"复位\", disabled: !images.length || transform.scale === 1, onClick: reset }),\n getStatusProps: () => normalize.element({ ...part(\"status\"), role: status === \"error\" ? \"alert\" : \"status\", hidden: status === \"loaded\" || !images.length }),\n getRetryProps: () => normalize.button({ ...part(\"retry\"), type: \"button\", hidden: status !== \"error\", onClick: () => service.send({ type: \"RETRY\" }) }),\n getImageProps(imageIndex: number) {\n const image = images[imageIndex]!; const active = imageIndex === index;\n return normalize.element({ ...part(\"image\"), id: imageId(service.scope.id, imageIndex), src: image.src, alt: image.alt, draggable: false, \"data-revision\": revision, style: { transform: active ? `translate(${transform.x}px, ${transform.y}px) scale(${transform.scale})` : undefined },\n onLoad: () => { if (active) service.send({ type: \"RESOURCE\", src: image.src, revision, status: \"loaded\" }); }, onError: () => { if (active) service.send({ type: \"RESOURCE\", src: image.src, revision, status: \"error\" }); } });\n },\n getStageProps(imageIndex: number) {\n const active = imageIndex === index;\n return normalize.element({ ...part(\"stage\"), id: stageId(imageIndex), role: \"group\", tabIndex: active ? 0 : -1, \"aria-label\": images[imageIndex]?.alt, \"data-zoomed\": active && transform.scale > 1 ? \"\" : undefined, \"data-visual-target\": active ? \"image-preview-stage\" : undefined,\n onKeyDown(event: { key: string; target: unknown; currentTarget: unknown; preventDefault(): void; stopPropagation(): void }) { if (event.target !== event.currentTarget || !current(imageIndex)) return; const key = event.key; if (key === \"+\" || key === \"=\" || key === \"-\" || key === \"0\") { event.preventDefault(); event.stopPropagation(); if (key === \"0\") reset(); else zoom(key === \"-\" ? -1 : 1); } },\n onDoubleClick(event: { preventDefault(): void; stopPropagation(): void }) { if (!current(imageIndex)) return; event.preventDefault(); event.stopPropagation(); changeScale(service.context.get(\"transform\").scale > 1 ? 1 : Math.min(2, max)); },\n onPointerDown(event: StagePointer) {\n if (!current(imageIndex) || (event.pointerType === \"mouse\" && event.button !== 0)) return;\n const gesture = service.refs.get(\"gesture\"), value = service.context.get(\"transform\");\n gesture.points.set(event.pointerId, { x: event.clientX, y: event.clientY });\n if (gesture.points.size === 1) { gesture.x = event.clientX; gesture.y = event.clientY; gesture.originX = value.x; gesture.originY = value.y; }\n if (gesture.points.size === 2) {\n const points = [...gesture.points.values()]; gesture.distance = Math.hypot(points[0]!.x - points[1]!.x, points[0]!.y - points[1]!.y); gesture.scale = value.scale;\n // Cancel the already armed one-finger Swiper gesture before this becomes a pinch.\n const viewport = event.currentTarget.closest('[data-scope=\"swiper\"][data-part=\"viewport\"]'), win = event.currentTarget.ownerDocument.defaultView;\n const first = [...gesture.points.keys()][0]!;\n if (viewport && win?.PointerEvent) viewport.dispatchEvent(new win.PointerEvent(\"pointercancel\", { bubbles: true, pointerId: first }));\n }\n if (value.scale > 1 || gesture.points.size > 1) { event.stopPropagation(); try { event.currentTarget.setPointerCapture(event.pointerId); } catch { /* pointer already released */ } }\n },\n onPointerMove(event: StagePointer) {\n const gesture = service.refs.get(\"gesture\"); if (!current(imageIndex) || !gesture.points.has(event.pointerId)) return;\n gesture.points.set(event.pointerId, { x: event.clientX, y: event.clientY });\n const value = service.context.get(\"transform\"), rect = event.currentTarget.getBoundingClientRect();\n if (gesture.points.size > 1) { event.stopPropagation(); event.preventDefault(); const points = [...gesture.points.values()]; const distance = Math.hypot(points[0]!.x - points[1]!.x, points[0]!.y - points[1]!.y); service.send({ type: \"TRANSFORM\", value: { scale: gesture.distance > 0 ? gesture.scale * distance / gesture.distance : value.scale, x: 0, y: 0 }, width: rect.width, height: rect.height }); }\n else if (value.scale > 1) { event.stopPropagation(); event.preventDefault(); service.send({ type: \"TRANSFORM\", value: { ...value, x: gesture.originX + event.clientX - gesture.x, y: gesture.originY + event.clientY - gesture.y }, width: rect.width, height: rect.height }); }\n },\n onPointerUp(event: StagePointer) { const gesture = service.refs.get(\"gesture\"); if (gesture.points.size > 1 || service.context.get(\"transform\").scale > 1) event.stopPropagation(); resetGesture(gesture); },\n onPointerCancel() { resetGesture(service.refs.get(\"gesture\")); }, onLostPointerCapture() { resetGesture(service.refs.get(\"gesture\")); },\n });\n },\n };\n}\nexport type QwImagePreviewApi<T extends PropTypes = PropTypes> = ReturnType<typeof connectImageP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AO;QAAE,GAAG;QAAO,GAAG,QAAQ,UAAU,MAAM,UAAU,QAAQ;QAAG,GAAG,QAAQ,UAAU,MAAM,UAAU,QAAQ;OAAE;OAAG,OAAO,KAAK;OAAO,QAAQ,KAAK;MAAO,CAAC;KAAG;IACjR;IACA,YAAY,OAAqB;KAAE,MAAM,UAAU,QAAQ,KAAK,IAAI,SAAS;KAAG,IAAI,QAAQ,OAAO,OAAO,KAAK,QAAQ,QAAQ,IAAI,WAAW,CAAC,CAAC,QAAQ,GAAG,MAAM,gBAAgB;KAAG,aAAa,OAAO;IAAG;IAC3M,kBAAkB;KAAE,aAAa,QAAQ,KAAK,IAAI,SAAS,CAAC;IAAG;IAAG,uBAAuB;KAAE,aAAa,QAAQ,KAAK,IAAI,SAAS,CAAC;IAAG;GACxI,CAAC;EACH;CACF;AACF"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { type Machine, type Service } from "@zag-js/core";
|
|
2
|
+
import type { NormalizeProps, PropTypes } from "@zag-js/types";
|
|
3
|
+
/** Stable DOM parts shared by every adapter. */
|
|
4
|
+
export declare const INDEX_BAR_PARTS: readonly ["root", "index", "index-item", "indicator", "list", "group", "anchor", "group-content", "status"];
|
|
5
|
+
/** Caller data: Core owns key/title; content is a scalar fallback that adapters may replace with nodes/slots. */
|
|
6
|
+
export interface QwIndexBarGroup {
|
|
7
|
+
key: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
content?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface IndexBarChangeDetails {
|
|
12
|
+
key: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ResolvedIndexBarGroup {
|
|
15
|
+
key: string;
|
|
16
|
+
title: string;
|
|
17
|
+
content: string;
|
|
18
|
+
index: number;
|
|
19
|
+
}
|
|
20
|
+
export interface ResolvedIndexBarItem {
|
|
21
|
+
key: string;
|
|
22
|
+
title: string;
|
|
23
|
+
disabled: boolean;
|
|
24
|
+
group: number;
|
|
25
|
+
}
|
|
26
|
+
export interface QwIndexBarProps {
|
|
27
|
+
/** Page-unique instance identity; adapters generate one when omitted. */
|
|
28
|
+
id?: string;
|
|
29
|
+
/** Ordered groups. Empty/duplicate keys are dropped. */
|
|
30
|
+
groups?: readonly QwIndexBarGroup[];
|
|
31
|
+
/** Sidebar keys; defaults to the group keys. Keys without a group render disabled and are skipped. */
|
|
32
|
+
indexes?: readonly string[];
|
|
33
|
+
/** Element id of the scrolling container. Omitted/missing: nearest scrollable ancestor, then the viewport. */
|
|
34
|
+
target?: string;
|
|
35
|
+
/** Pixels reserved at the top of the container (for example a fixed NavBar); default 0. */
|
|
36
|
+
stickyOffset?: number;
|
|
37
|
+
/** Keep the current group's anchor title stuck at stickyOffset; default true. */
|
|
38
|
+
sticky?: boolean;
|
|
39
|
+
/** Accessible name of the index toolbar; default 索引. */
|
|
40
|
+
indexLabel?: string;
|
|
41
|
+
/** Accessible name template of an index item with {title}; default 跳转到 {title} 组. */
|
|
42
|
+
jumpLabel?: string;
|
|
43
|
+
/** The current group changed (scrolling or jumping). */
|
|
44
|
+
onChange?: (details: IndexBarChangeDetails) => void;
|
|
45
|
+
}
|
|
46
|
+
export interface ResolvedIndexBarState {
|
|
47
|
+
groups: ResolvedIndexBarGroup[];
|
|
48
|
+
items: ResolvedIndexBarItem[];
|
|
49
|
+
target: string | undefined;
|
|
50
|
+
stickyOffset: number;
|
|
51
|
+
sticky: boolean;
|
|
52
|
+
indexLabel: string;
|
|
53
|
+
jumpLabel: string;
|
|
54
|
+
}
|
|
55
|
+
export declare function resolveIndexBarState(props?: QwIndexBarProps): ResolvedIndexBarState;
|
|
56
|
+
/** The key under a pointer position, from item rects measured top-down. Disabled items are skipped. */
|
|
57
|
+
export declare function resolveIndexBarKeyAt(y: number, rects: readonly {
|
|
58
|
+
key: string;
|
|
59
|
+
top: number;
|
|
60
|
+
bottom: number;
|
|
61
|
+
}[]): string | null;
|
|
62
|
+
/** Current group: the last one whose top has reached the sticky offset; the first group before any is reached. */
|
|
63
|
+
export declare function resolveIndexBarActive(tops: readonly {
|
|
64
|
+
key: string;
|
|
65
|
+
top: number;
|
|
66
|
+
}[], offset: number): string | null;
|
|
67
|
+
export declare function createIndexBarProps(props?: QwIndexBarProps): QwIndexBarProps;
|
|
68
|
+
export interface QwIndexBarSchema {
|
|
69
|
+
props: QwIndexBarProps;
|
|
70
|
+
context: {
|
|
71
|
+
active: string | null;
|
|
72
|
+
focusKey: string | null;
|
|
73
|
+
indicator: string | null;
|
|
74
|
+
};
|
|
75
|
+
refs: {
|
|
76
|
+
suppressScroll: boolean;
|
|
77
|
+
sync: (() => void) | null;
|
|
78
|
+
};
|
|
79
|
+
state: "ready";
|
|
80
|
+
action: "syncActive" | "jump" | "dragEnd" | "focusItem" | "resync";
|
|
81
|
+
effect: "trackScroll";
|
|
82
|
+
event: {
|
|
83
|
+
type: "ACTIVE.SYNC";
|
|
84
|
+
key: string | null;
|
|
85
|
+
} | {
|
|
86
|
+
type: "JUMP";
|
|
87
|
+
key: string;
|
|
88
|
+
drag?: boolean;
|
|
89
|
+
} | {
|
|
90
|
+
type: "DRAG.END";
|
|
91
|
+
} | {
|
|
92
|
+
type: "FOCUS.MOVE";
|
|
93
|
+
key: string;
|
|
94
|
+
focus?: boolean;
|
|
95
|
+
} | {
|
|
96
|
+
type: "GROUPS.CHANGE";
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
export type QwIndexBarMachine = Machine<QwIndexBarSchema>;
|
|
100
|
+
export type QwIndexBarService = Service<QwIndexBarSchema>;
|
|
101
|
+
/** Core owns scroll tracking, jumping, drag measurement, roving focus and listener cleanup. */
|
|
102
|
+
export declare const indexBarMachine: QwIndexBarMachine;
|
|
103
|
+
export interface QwIndexBarApi<T extends PropTypes = PropTypes> {
|
|
104
|
+
groups: ResolvedIndexBarGroup[];
|
|
105
|
+
items: ResolvedIndexBarItem[];
|
|
106
|
+
active: string | null;
|
|
107
|
+
indicator: string | null;
|
|
108
|
+
statusText: string;
|
|
109
|
+
/** Scroll the container so the group's top meets stickyOffset. Unknown/disabled keys are ignored. */
|
|
110
|
+
scrollTo(key: string): void;
|
|
111
|
+
getRootProps(): T["element"];
|
|
112
|
+
getIndexProps(): T["element"];
|
|
113
|
+
getIndexItemProps(item: ResolvedIndexBarItem): T["button"];
|
|
114
|
+
getIndicatorProps(): T["element"];
|
|
115
|
+
getListProps(): T["element"];
|
|
116
|
+
getGroupProps(group: ResolvedIndexBarGroup): T["element"];
|
|
117
|
+
getAnchorProps(group: ResolvedIndexBarGroup): T["element"];
|
|
118
|
+
getGroupContentProps(group: ResolvedIndexBarGroup): T["element"];
|
|
119
|
+
getStatusProps(): T["element"];
|
|
120
|
+
}
|
|
121
|
+
export declare function connectIndexBar<T extends PropTypes>(service: QwIndexBarService, normalize: NormalizeProps<T>): QwIndexBarApi<T>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./index-bar.js";
|