@qw-ui/core 0.3.0-next.8 → 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,414 @@
|
|
|
1
|
+
import { trackDismissableElement } from "@zag-js/dismissable";
|
|
2
|
+
//#region src/popover/positioning.ts
|
|
3
|
+
/**
|
|
4
|
+
* Core-owned anchored positioning shared by Popover and Dropdown.
|
|
5
|
+
*
|
|
6
|
+
* `computeFloatingPosition` is a pure function (rects in → coordinates / placement / arrow out).
|
|
7
|
+
* `measureFloatingLayout` / `trackFloatingLayout` are the only DOM binding: they read rects and
|
|
8
|
+
* CSS-provided insets, never write the DOM, and hand a rounded layout to the machine. Adapters
|
|
9
|
+
* render it through `getFloatingPositionerStyle`, so SSR, hydration and every stack share one path.
|
|
10
|
+
*/
|
|
11
|
+
/** Physical sides of the anchor. */
|
|
12
|
+
const FLOATING_SIDES = [
|
|
13
|
+
"top",
|
|
14
|
+
"right",
|
|
15
|
+
"bottom",
|
|
16
|
+
"left"
|
|
17
|
+
];
|
|
18
|
+
/** Cross-axis alignments. start/end follow the inline direction on top/bottom (mirrored in RTL) and the block direction on left/right. */
|
|
19
|
+
const FLOATING_ALIGNS = [
|
|
20
|
+
"center",
|
|
21
|
+
"start",
|
|
22
|
+
"end"
|
|
23
|
+
];
|
|
24
|
+
const FLOATING_PLACEMENTS = [
|
|
25
|
+
"top",
|
|
26
|
+
"top-start",
|
|
27
|
+
"top-end",
|
|
28
|
+
"right",
|
|
29
|
+
"right-start",
|
|
30
|
+
"right-end",
|
|
31
|
+
"bottom",
|
|
32
|
+
"bottom-start",
|
|
33
|
+
"bottom-end",
|
|
34
|
+
"left",
|
|
35
|
+
"left-start",
|
|
36
|
+
"left-end"
|
|
37
|
+
];
|
|
38
|
+
/** Default main-axis gap between the anchor edge and the floating box, in CSS px. */
|
|
39
|
+
const FLOATING_DEFAULT_OFFSET = 8;
|
|
40
|
+
const OPPOSITE = {
|
|
41
|
+
top: "bottom",
|
|
42
|
+
bottom: "top",
|
|
43
|
+
left: "right",
|
|
44
|
+
right: "left"
|
|
45
|
+
};
|
|
46
|
+
const finite = (value, fallback = 0) => typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
47
|
+
const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
48
|
+
const rectOf = (rect) => ({
|
|
49
|
+
x: finite(rect?.x),
|
|
50
|
+
y: finite(rect?.y),
|
|
51
|
+
width: Math.max(0, finite(rect?.width)),
|
|
52
|
+
height: Math.max(0, finite(rect?.height))
|
|
53
|
+
});
|
|
54
|
+
/** Unknown values fall back (default bottom). */
|
|
55
|
+
function resolveFloatingPlacement(value, fallback = "bottom") {
|
|
56
|
+
return FLOATING_PLACEMENTS.includes(value) ? value : fallback;
|
|
57
|
+
}
|
|
58
|
+
function splitFloatingPlacement(placement) {
|
|
59
|
+
const [side, align] = placement.split("-");
|
|
60
|
+
return {
|
|
61
|
+
side,
|
|
62
|
+
align: align ?? "center"
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function joinFloatingPlacement(side, align) {
|
|
66
|
+
return align === "center" ? side : `${side}-${align}`;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Place the floating box next to the anchor: flip to the opposite side when the preferred side lacks
|
|
70
|
+
* space and the opposite has more, align on the cross axis (start/end mirrored on top/bottom in RTL),
|
|
71
|
+
* shift into the boundary while staying attached to the anchor, and point the arrow at the anchor center.
|
|
72
|
+
*/
|
|
73
|
+
function computeFloatingPosition(input) {
|
|
74
|
+
const anchor = rectOf(input.anchor), boundary = rectOf(input.boundary);
|
|
75
|
+
const width = Math.max(0, finite(input.floating?.width)), height = Math.max(0, finite(input.floating?.height));
|
|
76
|
+
const offset = finite(input.offset, 8);
|
|
77
|
+
const preferred = splitFloatingPlacement(resolveFloatingPlacement(input.placement, input.fallback));
|
|
78
|
+
const space = {
|
|
79
|
+
top: anchor.y - offset - boundary.y,
|
|
80
|
+
bottom: boundary.y + boundary.height - anchor.y - anchor.height - offset,
|
|
81
|
+
left: anchor.x - offset - boundary.x,
|
|
82
|
+
right: boundary.x + boundary.width - anchor.x - anchor.width - offset
|
|
83
|
+
};
|
|
84
|
+
const need = (side) => side === "top" || side === "bottom" ? height : width;
|
|
85
|
+
const opposite = OPPOSITE[preferred.side];
|
|
86
|
+
const flipped = space[preferred.side] < need(preferred.side) && space[opposite] > space[preferred.side];
|
|
87
|
+
const side = flipped ? opposite : preferred.side, align = preferred.align;
|
|
88
|
+
const vertical = side === "top" || side === "bottom";
|
|
89
|
+
const size = vertical ? width : height;
|
|
90
|
+
const anchorStart = vertical ? anchor.x : anchor.y, anchorSize = vertical ? anchor.width : anchor.height;
|
|
91
|
+
const boundaryStart = vertical ? boundary.x : boundary.y, boundarySize = vertical ? boundary.width : boundary.height;
|
|
92
|
+
const physical = vertical && input.rtl ? align === "start" ? "end" : align === "end" ? "start" : align : align;
|
|
93
|
+
let cross = physical === "start" ? anchorStart : physical === "end" ? anchorStart + anchorSize - size : anchorStart + (anchorSize - size) / 2;
|
|
94
|
+
cross = Math.max(boundaryStart, Math.min(cross, boundaryStart + boundarySize - size));
|
|
95
|
+
const arrowSize = input.arrow ? Math.max(0, finite(input.arrow.size)) : 0, arrowPadding = input.arrow ? Math.max(0, finite(input.arrow.padding)) : 0;
|
|
96
|
+
const reach = input.arrow ? arrowPadding + arrowSize / 2 : 0;
|
|
97
|
+
cross = clamp(cross, anchorStart - size + reach, anchorStart + anchorSize - reach);
|
|
98
|
+
let arrow = null;
|
|
99
|
+
if (input.arrow) {
|
|
100
|
+
const max = size - arrowPadding - arrowSize;
|
|
101
|
+
arrow = max < arrowPadding ? (size - arrowSize) / 2 : clamp(anchorStart + anchorSize / 2 - cross - arrowSize / 2, arrowPadding, max);
|
|
102
|
+
}
|
|
103
|
+
const main = side === "bottom" ? anchor.y + anchor.height + offset : side === "top" ? anchor.y - offset - height : side === "right" ? anchor.x + anchor.width + offset : anchor.x - offset - width;
|
|
104
|
+
return {
|
|
105
|
+
x: vertical ? cross : main,
|
|
106
|
+
y: vertical ? main : cross,
|
|
107
|
+
placement: joinFloatingPlacement(side, align),
|
|
108
|
+
side,
|
|
109
|
+
align,
|
|
110
|
+
flipped,
|
|
111
|
+
arrow,
|
|
112
|
+
availableWidth: Math.max(0, vertical ? boundary.width : space[side]),
|
|
113
|
+
availableHeight: Math.max(0, vertical ? space[side] : boundary.height)
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
const LAYOUT_KEYS = [
|
|
117
|
+
"x",
|
|
118
|
+
"y",
|
|
119
|
+
"placement",
|
|
120
|
+
"side",
|
|
121
|
+
"align",
|
|
122
|
+
"arrow",
|
|
123
|
+
"availableWidth",
|
|
124
|
+
"availableHeight",
|
|
125
|
+
"anchorWidth",
|
|
126
|
+
"anchorHeight"
|
|
127
|
+
];
|
|
128
|
+
function sameFloatingLayout(a, b) {
|
|
129
|
+
if (a === b) return true;
|
|
130
|
+
if (!a || !b) return false;
|
|
131
|
+
return LAYOUT_KEYS.every((key) => a[key] === b[key]);
|
|
132
|
+
}
|
|
133
|
+
/** Private custom properties written inline on the positioner; component CSS consumes them. */
|
|
134
|
+
const FLOATING_STYLE_VARS = {
|
|
135
|
+
x: "--qw-floating-x",
|
|
136
|
+
y: "--qw-floating-y",
|
|
137
|
+
arrow: "--qw-floating-arrow",
|
|
138
|
+
availableWidth: "--qw-floating-available-width",
|
|
139
|
+
availableHeight: "--qw-floating-available-height",
|
|
140
|
+
anchorWidth: "--qw-floating-anchor-width"
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Inline positioner style. Before the first measurement (SSR, hydration, the first client frame) the
|
|
144
|
+
* layer is laid out at the containing-block origin but `visibility: hidden`; afterwards it is translated
|
|
145
|
+
* (layout at the origin keeps its shrink-to-fit width independent of the position).
|
|
146
|
+
*/
|
|
147
|
+
function getFloatingPositionerStyle(layout) {
|
|
148
|
+
const base = {
|
|
149
|
+
position: "fixed",
|
|
150
|
+
left: "0px",
|
|
151
|
+
top: "0px"
|
|
152
|
+
};
|
|
153
|
+
if (!layout) return {
|
|
154
|
+
...base,
|
|
155
|
+
visibility: "hidden"
|
|
156
|
+
};
|
|
157
|
+
const style = {
|
|
158
|
+
...base,
|
|
159
|
+
transform: `translate3d(var(${FLOATING_STYLE_VARS.x}), var(${FLOATING_STYLE_VARS.y}), 0)`,
|
|
160
|
+
[FLOATING_STYLE_VARS.x]: `${layout.x}px`,
|
|
161
|
+
[FLOATING_STYLE_VARS.y]: `${layout.y}px`,
|
|
162
|
+
[FLOATING_STYLE_VARS.availableWidth]: `${layout.availableWidth}px`,
|
|
163
|
+
[FLOATING_STYLE_VARS.availableHeight]: `${layout.availableHeight}px`,
|
|
164
|
+
[FLOATING_STYLE_VARS.anchorWidth]: `${layout.anchorWidth}px`
|
|
165
|
+
};
|
|
166
|
+
if (layout.arrow !== null) style[FLOATING_STYLE_VARS.arrow] = `${layout.arrow}px`;
|
|
167
|
+
return style;
|
|
168
|
+
}
|
|
169
|
+
const px = (value) => {
|
|
170
|
+
const number = Number.parseFloat(value ?? "");
|
|
171
|
+
return Number.isFinite(number) ? number : 0;
|
|
172
|
+
};
|
|
173
|
+
const round = (value) => Math.round(value * 100) / 100;
|
|
174
|
+
/**
|
|
175
|
+
* One measurement. The boundary is the visual viewport (layout viewport without visualViewport) minus the
|
|
176
|
+
* positioner's CSS scroll-margin (gap + safe area, so env() stays in the style layer). The arrow padding is
|
|
177
|
+
* the content's corner radius. A transformed/filtered ancestor offsets fixed boxes: the difference between
|
|
178
|
+
* where the box is and the translate that was applied is subtracted.
|
|
179
|
+
*/
|
|
180
|
+
function measureFloatingLayout(options) {
|
|
181
|
+
const anchor = options.anchor(), positioner = options.positioner();
|
|
182
|
+
const doc = positioner?.ownerDocument, win = doc?.defaultView;
|
|
183
|
+
if (!anchor || !positioner || !doc || !win || !anchor.isConnected || !positioner.isConnected) return null;
|
|
184
|
+
const root = doc.documentElement, visual = win.visualViewport, style = win.getComputedStyle(positioner);
|
|
185
|
+
const view = visual ? {
|
|
186
|
+
x: visual.offsetLeft,
|
|
187
|
+
y: visual.offsetTop,
|
|
188
|
+
width: visual.width,
|
|
189
|
+
height: visual.height
|
|
190
|
+
} : {
|
|
191
|
+
x: 0,
|
|
192
|
+
y: 0,
|
|
193
|
+
width: root.clientWidth || win.innerWidth,
|
|
194
|
+
height: root.clientHeight || win.innerHeight
|
|
195
|
+
};
|
|
196
|
+
const top = px(style.scrollMarginTop), right = px(style.scrollMarginRight), bottom = px(style.scrollMarginBottom), left = px(style.scrollMarginLeft);
|
|
197
|
+
const boundary = {
|
|
198
|
+
x: view.x + left,
|
|
199
|
+
y: view.y + top,
|
|
200
|
+
width: Math.max(0, view.width - left - right),
|
|
201
|
+
height: Math.max(0, view.height - top - bottom)
|
|
202
|
+
};
|
|
203
|
+
const rect = anchor.getBoundingClientRect(), content = options.content(), arrow = options.arrow();
|
|
204
|
+
const direction = win.getComputedStyle(anchor).direction || anchor.closest("[dir]")?.getAttribute("dir");
|
|
205
|
+
const position = computeFloatingPosition({
|
|
206
|
+
anchor: {
|
|
207
|
+
x: rect.left,
|
|
208
|
+
y: rect.top,
|
|
209
|
+
width: rect.width,
|
|
210
|
+
height: rect.height
|
|
211
|
+
},
|
|
212
|
+
floating: {
|
|
213
|
+
width: positioner.offsetWidth,
|
|
214
|
+
height: positioner.offsetHeight
|
|
215
|
+
},
|
|
216
|
+
boundary,
|
|
217
|
+
placement: options.placement(),
|
|
218
|
+
fallback: options.fallback,
|
|
219
|
+
offset: options.offset(),
|
|
220
|
+
rtl: direction === "rtl",
|
|
221
|
+
arrow: arrow ? {
|
|
222
|
+
size: arrow.offsetWidth,
|
|
223
|
+
padding: content ? px(win.getComputedStyle(content).borderTopLeftRadius) : 0
|
|
224
|
+
} : null
|
|
225
|
+
});
|
|
226
|
+
const box = positioner.getBoundingClientRect();
|
|
227
|
+
const originX = box.left - px(positioner.style.getPropertyValue(FLOATING_STYLE_VARS.x));
|
|
228
|
+
const originY = box.top - px(positioner.style.getPropertyValue(FLOATING_STYLE_VARS.y));
|
|
229
|
+
return {
|
|
230
|
+
x: round(position.x - originX),
|
|
231
|
+
y: round(position.y - originY),
|
|
232
|
+
placement: position.placement,
|
|
233
|
+
side: position.side,
|
|
234
|
+
align: position.align,
|
|
235
|
+
arrow: position.arrow === null ? null : round(position.arrow),
|
|
236
|
+
availableWidth: round(position.availableWidth),
|
|
237
|
+
availableHeight: round(position.availableHeight),
|
|
238
|
+
anchorWidth: round(rect.width),
|
|
239
|
+
anchorHeight: round(rect.height)
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Track while open: one rAF-coalesced measurement per scroll (any scroller, captured), window or visual
|
|
244
|
+
* viewport resize, and anchor/positioner ResizeObserver change. The returned cleanup removes every listener,
|
|
245
|
+
* disconnects the observer and cancels the pending frame.
|
|
246
|
+
*/
|
|
247
|
+
function trackFloatingLayout(doc, options) {
|
|
248
|
+
const win = doc.defaultView;
|
|
249
|
+
if (!win) return () => {};
|
|
250
|
+
let frame = 0, waited = 0, disposed = false, observer = null, observed = [];
|
|
251
|
+
const schedule = () => {
|
|
252
|
+
if (!disposed && !frame) frame = win.requestAnimationFrame(update);
|
|
253
|
+
};
|
|
254
|
+
const observe = (targets) => {
|
|
255
|
+
if (targets.length === observed.length && targets.every((target, index) => target === observed[index])) return;
|
|
256
|
+
observer?.disconnect();
|
|
257
|
+
observed = targets;
|
|
258
|
+
const Observer = win.ResizeObserver;
|
|
259
|
+
observer = Observer ? new Observer(schedule) : null;
|
|
260
|
+
for (const target of targets) observer?.observe(target);
|
|
261
|
+
};
|
|
262
|
+
function update() {
|
|
263
|
+
frame = 0;
|
|
264
|
+
if (disposed) return;
|
|
265
|
+
const layout = measureFloatingLayout(options);
|
|
266
|
+
if (!layout) {
|
|
267
|
+
if (waited++ < 60) schedule();
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
observe([options.anchor(), options.positioner()].filter((node) => !!node));
|
|
271
|
+
options.onLayout(layout);
|
|
272
|
+
}
|
|
273
|
+
const visual = win.visualViewport;
|
|
274
|
+
win.addEventListener("resize", schedule);
|
|
275
|
+
doc.addEventListener("scroll", schedule, {
|
|
276
|
+
capture: true,
|
|
277
|
+
passive: true
|
|
278
|
+
});
|
|
279
|
+
visual?.addEventListener("resize", schedule);
|
|
280
|
+
visual?.addEventListener("scroll", schedule);
|
|
281
|
+
schedule();
|
|
282
|
+
return () => {
|
|
283
|
+
disposed = true;
|
|
284
|
+
if (frame) win.cancelAnimationFrame(frame);
|
|
285
|
+
observer?.disconnect();
|
|
286
|
+
observer = null;
|
|
287
|
+
observed = [];
|
|
288
|
+
win.removeEventListener("resize", schedule);
|
|
289
|
+
doc.removeEventListener("scroll", schedule, { capture: true });
|
|
290
|
+
visual?.removeEventListener("resize", schedule);
|
|
291
|
+
visual?.removeEventListener("scroll", schedule);
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
//#endregion
|
|
295
|
+
//#region src/popover/layer.ts
|
|
296
|
+
/**
|
|
297
|
+
* Wait for the content node (a microtask, then up to FLOATING_WAIT_FRAMES frames), then join the layer
|
|
298
|
+
* stack: only the topmost layer handles Escape, outside pointer/focus excludes the trigger and nested layers,
|
|
299
|
+
* and nothing outside is blocked. Cleanup leaves the stack or cancels the wait.
|
|
300
|
+
*/
|
|
301
|
+
function trackFloatingDismiss(doc, options) {
|
|
302
|
+
const win = doc.defaultView;
|
|
303
|
+
let release, frame = 0, waited = 0, disposed = false;
|
|
304
|
+
let readyTimer;
|
|
305
|
+
let request = {
|
|
306
|
+
reason: "outside",
|
|
307
|
+
focusable: false
|
|
308
|
+
};
|
|
309
|
+
const start = () => {
|
|
310
|
+
frame = 0;
|
|
311
|
+
if (disposed || release) return;
|
|
312
|
+
const content = options.content();
|
|
313
|
+
if (!content) {
|
|
314
|
+
if (win && waited++ < 60) frame = win.requestAnimationFrame(start);
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
release = trackDismissableElement(content, {
|
|
318
|
+
type: options.type,
|
|
319
|
+
pointerBlocking: false,
|
|
320
|
+
defer: false,
|
|
321
|
+
warnOnMissingNode: false,
|
|
322
|
+
exclude: () => options.trigger(),
|
|
323
|
+
onEscapeKeyDown(event) {
|
|
324
|
+
request = {
|
|
325
|
+
reason: "escape",
|
|
326
|
+
focusable: false
|
|
327
|
+
};
|
|
328
|
+
if (!options.closeOnEscape()) event.preventDefault();
|
|
329
|
+
},
|
|
330
|
+
onPointerDownOutside(event) {
|
|
331
|
+
request = {
|
|
332
|
+
reason: "outside",
|
|
333
|
+
focusable: event.detail?.focusable === true
|
|
334
|
+
};
|
|
335
|
+
if (!options.closeOnOutside()) event.preventDefault();
|
|
336
|
+
},
|
|
337
|
+
onFocusOutside(event) {
|
|
338
|
+
request = {
|
|
339
|
+
reason: "focus-outside",
|
|
340
|
+
focusable: true
|
|
341
|
+
};
|
|
342
|
+
if (!options.closeOnFocusOutside()) event.preventDefault();
|
|
343
|
+
},
|
|
344
|
+
onDismiss() {
|
|
345
|
+
options.onDismiss(request);
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
readyTimer = setTimeout(() => {
|
|
349
|
+
if (!disposed) options.onReady?.();
|
|
350
|
+
}, 0);
|
|
351
|
+
};
|
|
352
|
+
queueMicrotask(start);
|
|
353
|
+
return () => {
|
|
354
|
+
disposed = true;
|
|
355
|
+
if (frame) win?.cancelAnimationFrame(frame);
|
|
356
|
+
if (readyTimer !== void 0) clearTimeout(readyTimer);
|
|
357
|
+
release?.();
|
|
358
|
+
release = void 0;
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Focus return when a layer closes, called while its content is still in the DOM:
|
|
363
|
+
* - tab / focus-outside: focus already moved on; nothing happens.
|
|
364
|
+
* - outside: unless the outside target was focusable, focus that was inside the layer (or on the trigger)
|
|
365
|
+
* returns to the trigger after the pointer settles, if it ended on <body>.
|
|
366
|
+
* - everything else (escape, select, trigger, api): focus inside the layer, on <body> or nowhere returns to
|
|
367
|
+
* the trigger at once; focus the user moved elsewhere on the page stays put.
|
|
368
|
+
*/
|
|
369
|
+
function restoreFloatingFocus(doc, trigger, content, request) {
|
|
370
|
+
if (!trigger || !trigger.isConnected || request.reason === "tab" || request.reason === "focus-outside") return;
|
|
371
|
+
const active = doc.activeElement;
|
|
372
|
+
const inside = !!active && !!content && content.contains(active);
|
|
373
|
+
const focus = () => {
|
|
374
|
+
if (trigger.isConnected) trigger.focus({ preventScroll: true });
|
|
375
|
+
};
|
|
376
|
+
if (request.reason === "outside") {
|
|
377
|
+
if (request.focusable || !(inside || active === trigger)) return;
|
|
378
|
+
const win = doc.defaultView;
|
|
379
|
+
const settle = () => {
|
|
380
|
+
const now = doc.activeElement;
|
|
381
|
+
if (!now || now === doc.body) focus();
|
|
382
|
+
};
|
|
383
|
+
if (win) win.requestAnimationFrame(settle);
|
|
384
|
+
else settle();
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
if (inside || !active || active === doc.body) focus();
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Focus a node once it can take focus: the layer is `visibility: hidden` until the first layout reaches
|
|
391
|
+
* the DOM, so try on the next frames until it succeeds (bounded). Returns a cancel function.
|
|
392
|
+
*/
|
|
393
|
+
function focusWhenReady(doc, target, attempts = 6) {
|
|
394
|
+
const win = doc.defaultView;
|
|
395
|
+
let frame = 0, left = attempts, cancelled = false;
|
|
396
|
+
const tryFocus = () => {
|
|
397
|
+
frame = 0;
|
|
398
|
+
if (cancelled) return;
|
|
399
|
+
const node = target();
|
|
400
|
+
node?.focus({ preventScroll: true });
|
|
401
|
+
if (node && doc.activeElement === node || --left <= 0 || !win) return;
|
|
402
|
+
frame = win.requestAnimationFrame(tryFocus);
|
|
403
|
+
};
|
|
404
|
+
if (win) frame = win.requestAnimationFrame(tryFocus);
|
|
405
|
+
else tryFocus();
|
|
406
|
+
return () => {
|
|
407
|
+
cancelled = true;
|
|
408
|
+
if (frame) win?.cancelAnimationFrame(frame);
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
//#endregion
|
|
412
|
+
export { FLOATING_DEFAULT_OFFSET as a, computeFloatingPosition as c, resolveFloatingPlacement as d, sameFloatingLayout as f, FLOATING_ALIGNS as i, getFloatingPositionerStyle as l, trackFloatingLayout as m, restoreFloatingFocus as n, FLOATING_PLACEMENTS as o, splitFloatingPlacement as p, trackFloatingDismiss as r, FLOATING_SIDES as s, focusWhenReady as t, joinFloatingPlacement as u };
|
|
413
|
+
|
|
414
|
+
//# sourceMappingURL=layer-IpFrl5--.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layer-IpFrl5--.js","names":[],"sources":["../src/popover/positioning.ts","../src/popover/layer.ts"],"sourcesContent":["/**\n * Core-owned anchored positioning shared by Popover and Dropdown.\n *\n * `computeFloatingPosition` is a pure function (rects in → coordinates / placement / arrow out).\n * `measureFloatingLayout` / `trackFloatingLayout` are the only DOM binding: they read rects and\n * CSS-provided insets, never write the DOM, and hand a rounded layout to the machine. Adapters\n * render it through `getFloatingPositionerStyle`, so SSR, hydration and every stack share one path.\n */\n\n/** Physical sides of the anchor. */\nexport const FLOATING_SIDES = [\"top\", \"right\", \"bottom\", \"left\"] as const;\n/** Cross-axis alignments. start/end follow the inline direction on top/bottom (mirrored in RTL) and the block direction on left/right. */\nexport const FLOATING_ALIGNS = [\"center\", \"start\", \"end\"] as const;\nexport const FLOATING_PLACEMENTS = [\n \"top\", \"top-start\", \"top-end\", \"right\", \"right-start\", \"right-end\",\n \"bottom\", \"bottom-start\", \"bottom-end\", \"left\", \"left-start\", \"left-end\",\n] as const;\nexport type FloatingSide = (typeof FLOATING_SIDES)[number];\nexport type FloatingAlign = (typeof FLOATING_ALIGNS)[number];\nexport type FloatingPlacement = (typeof FLOATING_PLACEMENTS)[number];\n/** Default main-axis gap between the anchor edge and the floating box, in CSS px. */\nexport const FLOATING_DEFAULT_OFFSET = 8;\n\nexport interface FloatingRect { x: number; y: number; width: number; height: number }\nexport interface FloatingPositionInput {\n /** Anchor border box in viewport coordinates (getBoundingClientRect). */\n anchor: FloatingRect;\n /** Floating border-box size. */\n floating: { width: number; height: number };\n /** Usable area in viewport coordinates (viewport minus padding and safe areas). */\n boundary: FloatingRect;\n /** Preferred placement; unknown values use `fallback`. */\n placement?: unknown;\n /** Placement used for unknown values; defaults to bottom. */\n fallback?: FloatingPlacement;\n /** Main-axis gap in CSS px; non-finite values use 8. */\n offset?: number;\n /** Arrow square size and the minimum distance from the floating corners; omit or null without an arrow. */\n arrow?: { size: number; padding?: number } | null;\n /** Mirror start/end on the inline axis (top/bottom sides). */\n rtl?: boolean;\n}\nexport interface FloatingPosition {\n /** Floating top-left corner in viewport coordinates. */\n x: number;\n y: number;\n /** Resolved placement after flipping; align stays logical. */\n placement: FloatingPlacement;\n side: FloatingSide;\n align: FloatingAlign;\n /** The preferred side lacked space and the opposite side had more. */\n flipped: boolean;\n /** Arrow start on the cross axis relative to the floating box (from its left edge on top/bottom, its top edge on left/right); null without an arrow. */\n arrow: number | null;\n /** Space on the resolved side (main axis) and the boundary extent (cross axis), never negative. */\n availableWidth: number;\n availableHeight: number;\n}\n\nconst OPPOSITE: Record<FloatingSide, FloatingSide> = { top: \"bottom\", bottom: \"top\", left: \"right\", right: \"left\" };\nconst finite = (value: unknown, fallback = 0): number => typeof value === \"number\" && Number.isFinite(value) ? value : fallback;\nconst clamp = (value: number, min: number, max: number): number => Math.min(Math.max(value, min), max);\nconst rectOf = (rect: FloatingRect): FloatingRect => ({ x: finite(rect?.x), y: finite(rect?.y), width: Math.max(0, finite(rect?.width)), height: Math.max(0, finite(rect?.height)) });\n\n/** Unknown values fall back (default bottom). */\nexport function resolveFloatingPlacement(value: unknown, fallback: FloatingPlacement = \"bottom\"): FloatingPlacement {\n return (FLOATING_PLACEMENTS as readonly unknown[]).includes(value) ? value as FloatingPlacement : fallback;\n}\nexport function splitFloatingPlacement(placement: FloatingPlacement): { side: FloatingSide; align: FloatingAlign } {\n const [side, align] = placement.split(\"-\") as [FloatingSide, \"start\" | \"end\" | undefined];\n return { side, align: align ?? \"center\" };\n}\nexport function joinFloatingPlacement(side: FloatingSide, align: FloatingAlign): FloatingPlacement {\n return (align === \"center\" ? side : `${side}-${align}`) as FloatingPlacement;\n}\n\n/**\n * Place the floating box next to the anchor: flip to the opposite side when the preferred side lacks\n * space and the opposite has more, align on the cross axis (start/end mirrored on top/bottom in RTL),\n * shift into the boundary while staying attached to the anchor, and point the arrow at the anchor center.\n */\nexport function computeFloatingPosition(input: FloatingPositionInput): FloatingPosition {\n const anchor = rectOf(input.anchor), boundary = rectOf(input.boundary);\n const width = Math.max(0, finite(input.floating?.width)), height = Math.max(0, finite(input.floating?.height));\n const offset = finite(input.offset, FLOATING_DEFAULT_OFFSET);\n const preferred = splitFloatingPlacement(resolveFloatingPlacement(input.placement, input.fallback));\n const space: Record<FloatingSide, number> = {\n top: anchor.y - offset - boundary.y,\n bottom: boundary.y + boundary.height - anchor.y - anchor.height - offset,\n left: anchor.x - offset - boundary.x,\n right: boundary.x + boundary.width - anchor.x - anchor.width - offset,\n };\n const need = (side: FloatingSide) => side === \"top\" || side === \"bottom\" ? height : width;\n const opposite = OPPOSITE[preferred.side];\n const flipped = space[preferred.side] < need(preferred.side) && space[opposite] > space[preferred.side];\n const side = flipped ? opposite : preferred.side, align = preferred.align;\n const vertical = side === \"top\" || side === \"bottom\";\n const size = vertical ? width : height;\n const anchorStart = vertical ? anchor.x : anchor.y, anchorSize = vertical ? anchor.width : anchor.height;\n const boundaryStart = vertical ? boundary.x : boundary.y, boundarySize = vertical ? boundary.width : boundary.height;\n const physical = vertical && input.rtl ? (align === \"start\" ? \"end\" : align === \"end\" ? \"start\" : align) : align;\n let cross = physical === \"start\" ? anchorStart : physical === \"end\" ? anchorStart + anchorSize - size : anchorStart + (anchorSize - size) / 2;\n // Shift into the boundary (a box larger than the boundary keeps its start edge visible)…\n cross = Math.max(boundaryStart, Math.min(cross, boundaryStart + boundarySize - size));\n // …but never detach from the anchor: the arrow (or at least an edge) must still reach it.\n const arrowSize = input.arrow ? Math.max(0, finite(input.arrow.size)) : 0, arrowPadding = input.arrow ? Math.max(0, finite(input.arrow.padding)) : 0;\n const reach = input.arrow ? arrowPadding + arrowSize / 2 : 0;\n cross = clamp(cross, anchorStart - size + reach, anchorStart + anchorSize - reach);\n let arrow: number | null = null;\n if (input.arrow) {\n const max = size - arrowPadding - arrowSize;\n arrow = max < arrowPadding ? (size - arrowSize) / 2 : clamp(anchorStart + anchorSize / 2 - cross - arrowSize / 2, arrowPadding, max);\n }\n const main = side === \"bottom\" ? anchor.y + anchor.height + offset\n : side === \"top\" ? anchor.y - offset - height\n : side === \"right\" ? anchor.x + anchor.width + offset\n : anchor.x - offset - width;\n return {\n x: vertical ? cross : main, y: vertical ? main : cross,\n placement: joinFloatingPlacement(side, align), side, align, flipped, arrow,\n availableWidth: Math.max(0, vertical ? boundary.width : space[side]),\n availableHeight: Math.max(0, vertical ? space[side] : boundary.height),\n };\n}\n\n/** Layout written by adapters from Core context: rounded, containing-block compensated, plus the anchor size. */\nexport interface FloatingLayout {\n x: number;\n y: number;\n placement: FloatingPlacement;\n side: FloatingSide;\n align: FloatingAlign;\n arrow: number | null;\n availableWidth: number;\n availableHeight: number;\n anchorWidth: number;\n anchorHeight: number;\n}\nconst LAYOUT_KEYS = [\"x\", \"y\", \"placement\", \"side\", \"align\", \"arrow\", \"availableWidth\", \"availableHeight\", \"anchorWidth\", \"anchorHeight\"] as const;\nexport function sameFloatingLayout(a: FloatingLayout | null | undefined, b: FloatingLayout | null | undefined): boolean {\n if (a === b) return true;\n if (!a || !b) return false;\n return LAYOUT_KEYS.every((key) => a[key] === b[key]);\n}\n\n/** Private custom properties written inline on the positioner; component CSS consumes them. */\nexport const FLOATING_STYLE_VARS = {\n x: \"--qw-floating-x\", y: \"--qw-floating-y\", arrow: \"--qw-floating-arrow\",\n availableWidth: \"--qw-floating-available-width\", availableHeight: \"--qw-floating-available-height\", anchorWidth: \"--qw-floating-anchor-width\",\n} as const;\n\n/**\n * Inline positioner style. Before the first measurement (SSR, hydration, the first client frame) the\n * layer is laid out at the containing-block origin but `visibility: hidden`; afterwards it is translated\n * (layout at the origin keeps its shrink-to-fit width independent of the position).\n */\nexport function getFloatingPositionerStyle(layout: FloatingLayout | null): Record<string, string> {\n const base = { position: \"fixed\", left: \"0px\", top: \"0px\" };\n if (!layout) return { ...base, visibility: \"hidden\" };\n const style: Record<string, string> = {\n ...base,\n transform: `translate3d(var(${FLOATING_STYLE_VARS.x}), var(${FLOATING_STYLE_VARS.y}), 0)`,\n [FLOATING_STYLE_VARS.x]: `${layout.x}px`,\n [FLOATING_STYLE_VARS.y]: `${layout.y}px`,\n [FLOATING_STYLE_VARS.availableWidth]: `${layout.availableWidth}px`,\n [FLOATING_STYLE_VARS.availableHeight]: `${layout.availableHeight}px`,\n [FLOATING_STYLE_VARS.anchorWidth]: `${layout.anchorWidth}px`,\n };\n if (layout.arrow !== null) style[FLOATING_STYLE_VARS.arrow] = `${layout.arrow}px`;\n return style;\n}\n\nexport interface FloatingTrackOptions {\n /** Elements are looked up on every update: layers mount after the effect starts and may be replaced. */\n anchor(): HTMLElement | null;\n positioner(): HTMLElement | null;\n content(): HTMLElement | null;\n arrow(): HTMLElement | null;\n placement(): unknown;\n offset(): number | undefined;\n fallback: FloatingPlacement;\n onLayout(layout: FloatingLayout): void;\n}\n\nconst px = (value: string | null | undefined): number => { const number = Number.parseFloat(value ?? \"\"); return Number.isFinite(number) ? number : 0; };\nconst round = (value: number): number => Math.round(value * 100) / 100;\n\n/**\n * One measurement. The boundary is the visual viewport (layout viewport without visualViewport) minus the\n * positioner's CSS scroll-margin (gap + safe area, so env() stays in the style layer). The arrow padding is\n * the content's corner radius. A transformed/filtered ancestor offsets fixed boxes: the difference between\n * where the box is and the translate that was applied is subtracted.\n */\nexport function measureFloatingLayout(options: FloatingTrackOptions): FloatingLayout | null {\n const anchor = options.anchor(), positioner = options.positioner();\n const doc = positioner?.ownerDocument, win = doc?.defaultView;\n if (!anchor || !positioner || !doc || !win || !anchor.isConnected || !positioner.isConnected) return null;\n const root = doc.documentElement, visual = win.visualViewport, style = win.getComputedStyle(positioner);\n const view = visual\n ? { x: visual.offsetLeft, y: visual.offsetTop, width: visual.width, height: visual.height }\n : { x: 0, y: 0, width: root.clientWidth || win.innerWidth, height: root.clientHeight || win.innerHeight };\n const top = px(style.scrollMarginTop), right = px(style.scrollMarginRight), bottom = px(style.scrollMarginBottom), left = px(style.scrollMarginLeft);\n const boundary = { x: view.x + left, y: view.y + top, width: Math.max(0, view.width - left - right), height: Math.max(0, view.height - top - bottom) };\n const rect = anchor.getBoundingClientRect(), content = options.content(), arrow = options.arrow();\n const direction = win.getComputedStyle(anchor).direction || anchor.closest(\"[dir]\")?.getAttribute(\"dir\");\n const position = computeFloatingPosition({\n anchor: { x: rect.left, y: rect.top, width: rect.width, height: rect.height },\n floating: { width: positioner.offsetWidth, height: positioner.offsetHeight },\n boundary, placement: options.placement(), fallback: options.fallback, offset: options.offset(), rtl: direction === \"rtl\",\n arrow: arrow ? { size: arrow.offsetWidth, padding: content ? px(win.getComputedStyle(content).borderTopLeftRadius) : 0 } : null,\n });\n const box = positioner.getBoundingClientRect();\n const originX = box.left - px(positioner.style.getPropertyValue(FLOATING_STYLE_VARS.x));\n const originY = box.top - px(positioner.style.getPropertyValue(FLOATING_STYLE_VARS.y));\n return {\n x: round(position.x - originX), y: round(position.y - originY), placement: position.placement, side: position.side, align: position.align,\n arrow: position.arrow === null ? null : round(position.arrow), availableWidth: round(position.availableWidth), availableHeight: round(position.availableHeight),\n anchorWidth: round(rect.width), anchorHeight: round(rect.height),\n };\n}\n\n/** Frames to wait for the layer nodes to mount before giving up (about one second). */\nexport const FLOATING_WAIT_FRAMES = 60;\n\n/**\n * Track while open: one rAF-coalesced measurement per scroll (any scroller, captured), window or visual\n * viewport resize, and anchor/positioner ResizeObserver change. The returned cleanup removes every listener,\n * disconnects the observer and cancels the pending frame.\n */\nexport function trackFloatingLayout(doc: Document, options: FloatingTrackOptions): () => void {\n const win = doc.defaultView;\n if (!win) return () => {};\n let frame = 0, waited = 0, disposed = false, observer: ResizeObserver | null = null, observed: Element[] = [];\n const schedule = () => { if (!disposed && !frame) frame = win.requestAnimationFrame(update); };\n const observe = (targets: Element[]) => {\n if (targets.length === observed.length && targets.every((target, index) => target === observed[index])) return;\n observer?.disconnect(); observed = targets;\n const Observer = win.ResizeObserver;\n observer = Observer ? new Observer(schedule) : null;\n for (const target of targets) observer?.observe(target);\n };\n function update() {\n frame = 0;\n if (disposed) return;\n const layout = measureFloatingLayout(options);\n if (!layout) { if (waited++ < FLOATING_WAIT_FRAMES) schedule(); return; }\n observe([options.anchor(), options.positioner()].filter((node): node is HTMLElement => !!node));\n options.onLayout(layout);\n }\n const visual = win.visualViewport;\n win.addEventListener(\"resize\", schedule);\n doc.addEventListener(\"scroll\", schedule, { capture: true, passive: true });\n visual?.addEventListener(\"resize\", schedule);\n visual?.addEventListener(\"scroll\", schedule);\n schedule();\n return () => {\n disposed = true;\n if (frame) win.cancelAnimationFrame(frame);\n observer?.disconnect(); observer = null; observed = [];\n win.removeEventListener(\"resize\", schedule);\n doc.removeEventListener(\"scroll\", schedule, { capture: true });\n visual?.removeEventListener(\"resize\", schedule);\n visual?.removeEventListener(\"scroll\", schedule);\n };\n}\n","import { trackDismissableElement } from \"@zag-js/dismissable\";\nimport { FLOATING_WAIT_FRAMES } from \"./positioning.js\";\n\n/**\n * Non-modal layer lifetime shared by Popover and Dropdown: dismissal through Zag's existing layer stack\n * (no pointer blocking, no new modal owner) and the focus return policy. Every DOM read happens inside\n * the returned effects, never at import.\n */\n\n/** Why a layer asked to open or close. trigger: its trigger toggled; keyboard: a trigger key; api: the owner or setOpen. */\nexport type FloatingCloseReason = \"trigger\" | \"keyboard\" | \"escape\" | \"outside\" | \"focus-outside\" | \"tab\" | \"select\" | \"api\";\nexport type FloatingDismissReason = Extract<FloatingCloseReason, \"escape\" | \"outside\" | \"focus-outside\">;\n/** A pending close request: the reason and whether an outside interaction landed on a focusable node. */\nexport interface FloatingCloseRequest { reason: FloatingCloseReason; focusable: boolean }\n\nexport interface FloatingDismissOptions {\n type: \"popover\" | \"menu\";\n content(): HTMLElement | null;\n trigger(): HTMLElement | null;\n closeOnEscape(): boolean;\n closeOnOutside(): boolean;\n closeOnFocusOutside(): boolean;\n onDismiss(request: FloatingCloseRequest): void;\n /** Called after the existing layer has installed its deferred pointer listener. */\n onReady?(): void;\n}\n\n/**\n * Wait for the content node (a microtask, then up to FLOATING_WAIT_FRAMES frames), then join the layer\n * stack: only the topmost layer handles Escape, outside pointer/focus excludes the trigger and nested layers,\n * and nothing outside is blocked. Cleanup leaves the stack or cancels the wait.\n */\nexport function trackFloatingDismiss(doc: Document, options: FloatingDismissOptions): () => void {\n const win = doc.defaultView;\n let release: (() => void) | undefined, frame = 0, waited = 0, disposed = false;\n let readyTimer: ReturnType<typeof setTimeout> | undefined;\n let request: FloatingCloseRequest = { reason: \"outside\", focusable: false };\n const start = () => {\n frame = 0;\n if (disposed || release) return;\n const content = options.content();\n if (!content) { if (win && waited++ < FLOATING_WAIT_FRAMES) frame = win.requestAnimationFrame(start); return; }\n release = trackDismissableElement(content, {\n type: options.type, pointerBlocking: false, defer: false, warnOnMissingNode: false,\n exclude: () => options.trigger(),\n onEscapeKeyDown(event) {\n request = { reason: \"escape\", focusable: false };\n if (!options.closeOnEscape()) event.preventDefault();\n },\n onPointerDownOutside(event) {\n request = { reason: \"outside\", focusable: event.detail?.focusable === true };\n if (!options.closeOnOutside()) event.preventDefault();\n },\n onFocusOutside(event) {\n request = { reason: \"focus-outside\", focusable: true };\n if (!options.closeOnFocusOutside()) event.preventDefault();\n },\n onDismiss() { options.onDismiss(request); },\n });\n // Zag installs outside-pointer capture in its own zero-delay task even with defer:false.\n // Publish readiness in the following task, after that registration, never by elapsed guessing.\n readyTimer = setTimeout(() => { if (!disposed) options.onReady?.(); }, 0);\n };\n queueMicrotask(start);\n return () => {\n disposed = true;\n if (frame) win?.cancelAnimationFrame(frame);\n if (readyTimer !== undefined) clearTimeout(readyTimer);\n release?.();\n release = undefined;\n };\n}\n\n/**\n * Focus return when a layer closes, called while its content is still in the DOM:\n * - tab / focus-outside: focus already moved on; nothing happens.\n * - outside: unless the outside target was focusable, focus that was inside the layer (or on the trigger)\n * returns to the trigger after the pointer settles, if it ended on <body>.\n * - everything else (escape, select, trigger, api): focus inside the layer, on <body> or nowhere returns to\n * the trigger at once; focus the user moved elsewhere on the page stays put.\n */\nexport function restoreFloatingFocus(doc: Document, trigger: HTMLElement | null, content: HTMLElement | null, request: FloatingCloseRequest): void {\n if (!trigger || !trigger.isConnected || request.reason === \"tab\" || request.reason === \"focus-outside\") return;\n const active = doc.activeElement;\n const inside = !!active && !!content && content.contains(active);\n const focus = () => { if (trigger.isConnected) trigger.focus({ preventScroll: true }); };\n if (request.reason === \"outside\") {\n if (request.focusable || !(inside || active === trigger)) return;\n const win = doc.defaultView;\n const settle = () => { const now = doc.activeElement; if (!now || now === doc.body) focus(); };\n if (win) win.requestAnimationFrame(settle); else settle();\n return;\n }\n if (inside || !active || active === doc.body) focus();\n}\n\n/**\n * Focus a node once it can take focus: the layer is `visibility: hidden` until the first layout reaches\n * the DOM, so try on the next frames until it succeeds (bounded). Returns a cancel function.\n */\nexport function focusWhenReady(doc: Document, target: () => HTMLElement | null, attempts = 6): () => void {\n const win = doc.defaultView;\n let frame = 0, left = attempts, cancelled = false;\n const tryFocus = () => {\n frame = 0;\n if (cancelled) return;\n const node = target();\n node?.focus({ preventScroll: true });\n if ((node && doc.activeElement === node) || --left <= 0 || !win) return;\n frame = win.requestAnimationFrame(tryFocus);\n };\n if (win) frame = win.requestAnimationFrame(tryFocus); else tryFocus();\n return () => { cancelled = true; if (frame) win?.cancelAnimationFrame(frame); };\n}\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,iBAAiB;CAAC;CAAO;CAAS;CAAU;AAAM;;AAE/D,MAAa,kBAAkB;CAAC;CAAU;CAAS;AAAK;AACxD,MAAa,sBAAsB;CACjC;CAAO;CAAa;CAAW;CAAS;CAAe;CACvD;CAAU;CAAgB;CAAc;CAAQ;CAAc;AAChE;;AAKA,MAAa,0BAA0B;AAsCvC,MAAM,WAA+C;CAAE,KAAK;CAAU,QAAQ;CAAO,MAAM;CAAS,OAAO;AAAO;AAClH,MAAM,UAAU,OAAgB,WAAW,MAAc,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,IAAI,QAAQ;AACvH,MAAM,SAAS,OAAe,KAAa,QAAwB,KAAK,IAAI,KAAK,IAAI,OAAO,GAAG,GAAG,GAAG;AACrG,MAAM,UAAU,UAAsC;CAAE,GAAG,OAAO,MAAM,CAAC;CAAG,GAAG,OAAO,MAAM,CAAC;CAAG,OAAO,KAAK,IAAI,GAAG,OAAO,MAAM,KAAK,CAAC;CAAG,QAAQ,KAAK,IAAI,GAAG,OAAO,MAAM,MAAM,CAAC;AAAE;;AAGnL,SAAgB,yBAAyB,OAAgB,WAA8B,UAA6B;CAClH,OAAQ,oBAA2C,SAAS,KAAK,IAAI,QAA6B;AACpG;AACA,SAAgB,uBAAuB,WAA4E;CACjH,MAAM,CAAC,MAAM,SAAS,UAAU,MAAM,GAAG;CACzC,OAAO;EAAE;EAAM,OAAO,SAAS;CAAS;AAC1C;AACA,SAAgB,sBAAsB,MAAoB,OAAyC;CACjG,OAAQ,UAAU,WAAW,OAAO,GAAG,KAAK,GAAG;AACjD;;;;;;AAOA,SAAgB,wBAAwB,OAAgD;CACtF,MA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K,QAAQ,IAAI,sBAAsB,QAAQ;MAAQ,SAAS;CACpE,aAAa;EAAE,YAAY;EAAM,IAAI,OAAO,KAAK,qBAAqB,KAAK;CAAG;AAChF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
//#region src/layout.ts
|
|
2
|
+
/** Layout-only values shared by passive mobile containers. */
|
|
3
|
+
const LAYOUT_GAP_PRESETS = [
|
|
4
|
+
"none",
|
|
5
|
+
"sm",
|
|
6
|
+
"md",
|
|
7
|
+
"lg"
|
|
8
|
+
];
|
|
9
|
+
const presets = {
|
|
10
|
+
none: "0px",
|
|
11
|
+
sm: "var(--qw-sem-size-layout-gap-sm)",
|
|
12
|
+
md: "var(--qw-sem-size-layout-gap-md)",
|
|
13
|
+
lg: "var(--qw-sem-size-layout-gap-lg)"
|
|
14
|
+
};
|
|
15
|
+
function gapAtom(value) {
|
|
16
|
+
if (typeof value === "number") return Number.isFinite(value) && value >= 0 ? `${value}px` : void 0;
|
|
17
|
+
if (typeof value === "string" && value.trim()) return presets[value] ?? value;
|
|
18
|
+
}
|
|
19
|
+
function resolveLayoutGap(value) {
|
|
20
|
+
if (Array.isArray(value)) {
|
|
21
|
+
const row = gapAtom(value[0]), column = gapAtom(value[1]);
|
|
22
|
+
return value.length === 2 && row !== void 0 && column !== void 0 ? [row, column] : [presets.sm, presets.sm];
|
|
23
|
+
}
|
|
24
|
+
const resolved = gapAtom(value) ?? presets.sm;
|
|
25
|
+
return [resolved, resolved];
|
|
26
|
+
}
|
|
27
|
+
function resolveLayoutCount(value, fallback) {
|
|
28
|
+
return Number.isSafeInteger(value) && value > 0 ? value : fallback;
|
|
29
|
+
}
|
|
30
|
+
function resolveLayoutMinimum(value) {
|
|
31
|
+
if (typeof value === "number") return Number.isFinite(value) && value > 0 ? `${value}px` : void 0;
|
|
32
|
+
return typeof value === "string" && value.trim() ? value : void 0;
|
|
33
|
+
}
|
|
34
|
+
function getLayoutGroupProps(label) {
|
|
35
|
+
return typeof label === "string" && label.trim() ? {
|
|
36
|
+
role: "group",
|
|
37
|
+
"aria-label": label.trim()
|
|
38
|
+
} : {};
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { resolveLayoutMinimum as a, resolveLayoutGap as i, getLayoutGroupProps as n, resolveLayoutCount as r, LAYOUT_GAP_PRESETS as t };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=layout-BRSqi4AQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout-BRSqi4AQ.js","names":[],"sources":["../src/layout.ts"],"sourcesContent":["/** Layout-only values shared by passive mobile containers. */\nexport const LAYOUT_GAP_PRESETS = [\"none\", \"sm\", \"md\", \"lg\"] as const;\nexport type LayoutGapAtom = number | string;\nexport type LayoutGap = LayoutGapAtom | readonly [LayoutGapAtom, LayoutGapAtom];\nexport type LayoutStyle = Readonly<Record<string, string>>;\nconst presets: Record<(typeof LAYOUT_GAP_PRESETS)[number], string> = { none: \"0px\", sm: \"var(--qw-sem-size-layout-gap-sm)\", md: \"var(--qw-sem-size-layout-gap-md)\", lg: \"var(--qw-sem-size-layout-gap-lg)\" };\nfunction gapAtom(value: unknown): string | undefined {\n if (typeof value === \"number\") return Number.isFinite(value) && value >= 0 ? `${value}px` : undefined;\n if (typeof value === \"string\" && value.trim()) return presets[value as (typeof LAYOUT_GAP_PRESETS)[number]] ?? value;\n return undefined;\n}\nexport function resolveLayoutGap(value?: LayoutGap): readonly [string, string] {\n if (Array.isArray(value)) {\n const row = gapAtom(value[0]), column = gapAtom(value[1]);\n return value.length === 2 && row !== undefined && column !== undefined ? [row, column] : [presets.sm, presets.sm];\n }\n const resolved = gapAtom(value) ?? presets.sm;\n return [resolved, resolved];\n}\nexport function resolveLayoutCount(value: number | undefined, fallback: number): number { return Number.isSafeInteger(value) && value! > 0 ? value! : fallback; }\nexport function resolveLayoutMinimum(value?: number | string): string | undefined {\n if (typeof value === \"number\") return Number.isFinite(value) && value > 0 ? `${value}px` : undefined;\n return typeof value === \"string\" && value.trim() ? value : undefined;\n}\nexport interface LayoutGroupProps { role?: \"group\"; \"aria-label\"?: string }\nexport function getLayoutGroupProps(label?: string | null): LayoutGroupProps {\n return typeof label === \"string\" && label.trim() ? { role: \"group\", \"aria-label\": label.trim() } : {};\n}\n"],"mappings":";;AACA,MAAa,qBAAqB;CAAC;CAAQ;CAAM;CAAM;AAAI;AAI3D,MAAM,UAA+D;CAAE,MAAM;CAAO,IAAI;CAAoC,IAAI;CAAoC,IAAI;AAAmC;AAC3M,SAAS,QAAQ,OAAoC;CACnD,IAAI,OAAO,UAAU,UAAU,OAAO,OAAO,SAAS,KAAK,KAAK,SAAS,IAAI,GAAG,MAAM,MAAM,KAAA;CAC5F,IAAI,OAAO,UAAU,YAAY,MAAM,KAAK,GAAG,OAAO,QAAQ,UAAiD;AAEjH;AACA,SAAgB,iBAAiB,OAA8C;CAC7E,IAAI,MAAM,QAAQ,KAAK,GAAG;EACxB,MAAM,MAAM,QAAQ,MAAM,EAAE,GAAG,SAAS,QAAQ,MAAM,EAAE;EACxD,OAAO,MAAM,WAAW,KAAK,QAAQ,KAAA,KAAa,WAAW,KAAA,IAAY,CAAC,KAAK,MAAM,IAAI,CAAC,QAAQ,IAAI,QAAQ,EAAE;CAClH;CACA,MAAM,WAAW,QAAQ,KAAK,KAAK,QAAQ;CAC3C,OAAO,CAAC,UAAU,QAAQ;AAC5B;AACA,SAAgB,mBAAmB,OAA2B,UAA0B;CAAE,OAAO,OAAO,cAAc,KAAK,KAAK,QAAS,IAAI,QAAS;AAAU;AAChK,SAAgB,qBAAqB,OAA6C;CAChF,IAAI,OAAO,UAAU,UAAU,OAAO,OAAO,SAAS,KAAK,KAAK,QAAQ,IAAI,GAAG,MAAM,MAAM,KAAA;CAC3F,OAAO,OAAO,UAAU,YAAY,MAAM,KAAK,IAAI,QAAQ,KAAA;AAC7D;AAEA,SAAgB,oBAAoB,OAAyC;CAC3E,OAAO,OAAO,UAAU,YAAY,MAAM,KAAK,IAAI;EAAE,MAAM;EAAS,cAAc,MAAM,KAAK;CAAE,IAAI,CAAC;AACtG"}
|
package/dist/layout.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Layout-only values shared by passive mobile containers. */
|
|
2
|
+
export declare const LAYOUT_GAP_PRESETS: readonly ["none", "sm", "md", "lg"];
|
|
3
|
+
export type LayoutGapAtom = number | string;
|
|
4
|
+
export type LayoutGap = LayoutGapAtom | readonly [LayoutGapAtom, LayoutGapAtom];
|
|
5
|
+
export type LayoutStyle = Readonly<Record<string, string>>;
|
|
6
|
+
export declare function resolveLayoutGap(value?: LayoutGap): readonly [string, string];
|
|
7
|
+
export declare function resolveLayoutCount(value: number | undefined, fallback: number): number;
|
|
8
|
+
export declare function resolveLayoutMinimum(value?: number | string): string | undefined;
|
|
9
|
+
export interface LayoutGroupProps {
|
|
10
|
+
role?: "group";
|
|
11
|
+
"aria-label"?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function getLayoutGroupProps(label?: string | null): LayoutGroupProps;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Native grouped content; row interaction remains owned by existing controls. */
|
|
2
|
+
export declare const LIST_ITEM_TAG: "li";
|
|
3
|
+
export interface QwListProps {
|
|
4
|
+
/** Native ordered list instead of unordered. Default false. */
|
|
5
|
+
ordered?: boolean;
|
|
6
|
+
/** Inline inset and rounded group surface. Default false. */
|
|
7
|
+
inset?: boolean;
|
|
8
|
+
/** Separators between direct items, excluding the last. Default true. */
|
|
9
|
+
dividers?: boolean;
|
|
10
|
+
/** Optional accessible group name. Blank values are omitted. */
|
|
11
|
+
label?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ResolvedListState {
|
|
14
|
+
tag: "ul" | "ol";
|
|
15
|
+
ordered: boolean;
|
|
16
|
+
inset: boolean;
|
|
17
|
+
dividers: boolean;
|
|
18
|
+
label?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ListRootProps {
|
|
21
|
+
role: "list";
|
|
22
|
+
"data-scope": "list";
|
|
23
|
+
"data-part": "root";
|
|
24
|
+
"data-ordered"?: "true";
|
|
25
|
+
"data-inset"?: "true";
|
|
26
|
+
"data-dividers"?: "true";
|
|
27
|
+
"aria-label"?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare function resolveListState(props?: QwListProps): ResolvedListState;
|
|
30
|
+
export declare function getListRootProps(state: ResolvedListState): ListRootProps;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region src/list/list.ts
|
|
2
|
+
/** Native grouped content; row interaction remains owned by existing controls. */
|
|
3
|
+
const LIST_ITEM_TAG = "li";
|
|
4
|
+
function resolveListState(props = {}) {
|
|
5
|
+
const ordered = props.ordered ?? false;
|
|
6
|
+
return {
|
|
7
|
+
tag: ordered ? "ol" : "ul",
|
|
8
|
+
ordered,
|
|
9
|
+
inset: props.inset ?? false,
|
|
10
|
+
dividers: props.dividers ?? true,
|
|
11
|
+
label: props.label?.trim() || void 0
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function getListRootProps(state) {
|
|
15
|
+
return {
|
|
16
|
+
role: "list",
|
|
17
|
+
"data-scope": "list",
|
|
18
|
+
"data-part": "root",
|
|
19
|
+
...state.ordered ? { "data-ordered": "true" } : {},
|
|
20
|
+
...state.inset ? { "data-inset": "true" } : {},
|
|
21
|
+
...state.dividers ? { "data-dividers": "true" } : {},
|
|
22
|
+
...state.label ? { "aria-label": state.label } : {}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { getListRootProps as n, resolveListState as r, LIST_ITEM_TAG as t };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=list-6-iz-Irh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-6-iz-Irh.js","names":[],"sources":["../src/list/list.ts"],"sourcesContent":["/** Native grouped content; row interaction remains owned by existing controls. */\nexport const LIST_ITEM_TAG = \"li\" as const;\nexport interface QwListProps {\n /** Native ordered list instead of unordered. Default false. */\n ordered?: boolean;\n /** Inline inset and rounded group surface. Default false. */\n inset?: boolean;\n /** Separators between direct items, excluding the last. Default true. */\n dividers?: boolean;\n /** Optional accessible group name. Blank values are omitted. */\n label?: string;\n}\nexport interface ResolvedListState {\n tag: \"ul\" | \"ol\";\n ordered: boolean;\n inset: boolean;\n dividers: boolean;\n label?: string;\n}\nexport interface ListRootProps {\n role: \"list\";\n \"data-scope\": \"list\";\n \"data-part\": \"root\";\n \"data-ordered\"?: \"true\";\n \"data-inset\"?: \"true\";\n \"data-dividers\"?: \"true\";\n \"aria-label\"?: string;\n}\nexport function resolveListState(props: QwListProps = {}): ResolvedListState {\n const ordered = props.ordered ?? false;\n return { tag: ordered ? \"ol\" : \"ul\", ordered, inset: props.inset ?? false, dividers: props.dividers ?? true, label: props.label?.trim() || undefined };\n}\nexport function getListRootProps(state: ResolvedListState): ListRootProps {\n return { role: \"list\", \"data-scope\": \"list\", \"data-part\": \"root\",\n ...(state.ordered ? { \"data-ordered\": \"true\" as const } : {}),\n ...(state.inset ? { \"data-inset\": \"true\" as const } : {}),\n ...(state.dividers ? { \"data-dividers\": \"true\" as const } : {}),\n ...(state.label ? { \"aria-label\": state.label } : {}),\n };\n}\n"],"mappings":";;AACA,MAAa,gBAAgB;AA2B7B,SAAgB,iBAAiB,QAAqB,CAAC,GAAsB;CAC3E,MAAM,UAAU,MAAM,WAAW;CACjC,OAAO;EAAE,KAAK,UAAU,OAAO;EAAM;EAAS,OAAO,MAAM,SAAS;EAAO,UAAU,MAAM,YAAY;EAAM,OAAO,MAAM,OAAO,KAAK,KAAK,KAAA;CAAU;AACvJ;AACA,SAAgB,iBAAiB,OAAyC;CACxE,OAAO;EAAE,MAAM;EAAQ,cAAc;EAAQ,aAAa;EACxD,GAAI,MAAM,UAAU,EAAE,gBAAgB,OAAgB,IAAI,CAAC;EAC3D,GAAI,MAAM,QAAQ,EAAE,cAAc,OAAgB,IAAI,CAAC;EACvD,GAAI,MAAM,WAAW,EAAE,iBAAiB,OAAgB,IAAI,CAAC;EAC7D,GAAI,MAAM,QAAQ,EAAE,cAAc,MAAM,MAAM,IAAI,CAAC;CACrD;AACF"}
|