@astryx-vue/core 0.34.0 → 0.34.1
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/dist/AlertDialog/index.js +1 -1
- package/dist/{AlertDialog-CdrF01J0.js → AlertDialog-rndlABEe.js} +8 -8
- package/dist/AppShell/index.js +1 -1
- package/dist/{AppShell-4hWTPKSD.js → AppShell-eVrOpRqn.js} +5 -5
- package/dist/Avatar/index.js +1 -1
- package/dist/{Avatar-C6E6TYbe.js → Avatar-CpWBsTqf.js} +1 -1
- package/dist/AvatarGroup/index.d.ts +1 -1
- package/dist/AvatarGroup/index.js +1 -1
- package/dist/{AvatarGroup-CACtdvXz.js → AvatarGroup-BEBUEhxF.js} +1 -1
- package/dist/Banner/index.d.ts +1 -1
- package/dist/Banner/index.js +1 -1
- package/dist/{Banner-CAyN5-NO.js → Banner-CVBNGDsD.js} +1 -1
- package/dist/BottomSheet/index.d.ts +1 -1
- package/dist/BottomSheet/index.js +2 -2
- package/dist/{BottomSheet-BmmGemH5.js → BottomSheet-B3qXtKQj.js} +1 -1
- package/dist/{BottomSheet-DKEUVLe5.js → BottomSheet-C6vet4pm.js} +8 -4
- package/dist/Breadcrumbs/index.js +2 -2
- package/dist/{Breadcrumbs-BQnrbWXt.js → Breadcrumbs-B-w_yw-n.js} +1 -1
- package/dist/Button/index.d.ts +1 -1
- package/dist/Button/index.js +1 -1
- package/dist/{Button-CrZtv_4j.js → Button-DTdlisqJ.js} +4 -4
- package/dist/ButtonGroup/index.d.ts +1 -1
- package/dist/ButtonGroup/index.js +1 -1
- package/dist/{ButtonGroup-Jgx-IWPz.js → ButtonGroup-Bjzs-HAG.js} +2 -2
- package/dist/Calendar/index.d.ts +1 -1
- package/dist/Card/index.d.ts +1 -1
- package/dist/Carousel/index.d.ts +1 -1
- package/dist/Carousel/index.js +1 -1
- package/dist/{Carousel-BdhtUtf-.js → Carousel-DjySyeDR.js} +1 -1
- package/dist/Chat/index.d.ts +1 -1
- package/dist/Chat/index.js +1 -1
- package/dist/{Chat-DT712Yft.js → Chat-DQ6BGAvP.js} +5 -5
- package/dist/CheckboxInput/index.d.ts +1 -1
- package/dist/CheckboxInput/index.js +1 -1
- package/dist/{CheckboxInput-D8N6yvK5.js → CheckboxInput-DSW8yq92.js} +4 -4
- package/dist/CheckboxList/index.d.ts +1 -1
- package/dist/CheckboxList/index.js +1 -1
- package/dist/{CheckboxListItem--iUp9-KO.js → CheckboxListItem-B2E2O1AE.js} +5 -5
- package/dist/ClickableCard/index.d.ts +1 -1
- package/dist/ClickableCard/index.js +1 -1
- package/dist/{ClickableCard-B_upAn7L.js → ClickableCard-D4EGX9Dh.js} +1 -1
- package/dist/Code/index.js +1 -1
- package/dist/{CodeBlock-BkqcfoZ1.js → CodeBlock-D7ZJQV5Q.js} +1 -1
- package/dist/Collapsible/index.d.ts +1 -1
- package/dist/Collapsible/index.js +1 -1
- package/dist/{Collapsible-BKt7UCeF.js → Collapsible-C5xSG7oP.js} +3 -3
- package/dist/CommandPalette/index.d.ts +1 -1
- package/dist/CommandPalette/index.js +1 -1
- package/dist/{CommandPalette-CvOeE6i-.js → CommandPalette-BUNdrxrB.js} +2 -2
- package/dist/ComplexSelector/index.d.ts +1 -1
- package/dist/ComplexSelector/index.js +1 -1
- package/dist/{ComplexSelector-CVEfoN0k.js → ComplexSelector-m9wi7E0j.js} +2 -2
- package/dist/ContextMenu/index.d.ts +1 -1
- package/dist/ContextMenu/index.js +2 -2
- package/dist/{ContextMenu-ZqWtb5Si.js → ContextMenu-BEHfVIAq.js} +5 -5
- package/dist/DateInput/index.d.ts +1 -1
- package/dist/DateInput/index.js +1 -1
- package/dist/{DateInput-7FFzOvcu.js → DateInput-CHeetz7k.js} +5 -5
- package/dist/DateRangeInput/index.d.ts +1 -1
- package/dist/DateRangeInput/index.js +1 -1
- package/dist/{DateRangeInput-C0ICAvm7.js → DateRangeInput-D524C1wc.js} +3 -3
- package/dist/DateTimeInput/index.d.ts +1 -1
- package/dist/DateTimeInput/index.js +1 -1
- package/dist/{DateTimeInput-CaX09wfm.js → DateTimeInput-2gTBrcbr.js} +5 -5
- package/dist/Dialog/index.d.ts +1 -1
- package/dist/Dialog/index.js +3 -3
- package/dist/{Dialog-B1xC9xMC.js → Dialog-DS3xE1B7.js} +2 -2
- package/dist/{Dialog-BmdNX3NC.js → Dialog-nyLGClca.js} +1 -1
- package/dist/{DialogHeader-DLaiYrvF.js → DialogHeader-u_AaZpyZ.js} +2 -2
- package/dist/Drawer/index.d.ts +1 -1
- package/dist/Drawer/index.js +1 -1
- package/dist/{Drawer-BpuER-VT.js → Drawer-DqUdaZFh.js} +2 -2
- package/dist/DropdownMenu/index.js +2 -2
- package/dist/{DropdownMenu-K8JPIcSk.js → DropdownMenu-DlAON5Jf.js} +8 -8
- package/dist/EmptyState/index.js +1 -1
- package/dist/{EmptyState-BAP8BpDj.js → EmptyState-DU7uOI2G.js} +2 -2
- package/dist/Field/index.js +3 -3
- package/dist/{Field-CjC4qc2q.js → Field-YNS4XxpR.js} +1 -1
- package/dist/{FieldInfoTip-Cu4LNidQ.js → FieldInfoTip-DFlIBJlR.js} +1 -1
- package/dist/{FieldLabel-BFBAGrFY.js → FieldLabel-i0gos7hU.js} +1 -1
- package/dist/FileInput/index.d.ts +1 -1
- package/dist/FileInput/index.js +1 -1
- package/dist/{FileInput-DFsbOoe-.js → FileInput-DYVzAtvz.js} +3 -3
- package/dist/Heading/index.js +1 -1
- package/dist/{Heading-D94VFJtm.js → Heading-BZ0ydu2s.js} +1 -1
- package/dist/HoverCard/index.d.ts +1 -1
- package/dist/HoverCard/index.js +1 -1
- package/dist/{HoverCard-rwpyd6nt.js → HoverCard-BhHZE9q6.js} +4 -4
- package/dist/IconButton/index.js +1 -1
- package/dist/{IconButton-BPjZPGRy.js → IconButton-DXt8DtsN.js} +1 -1
- package/dist/InfoTip/index.d.ts +1 -1
- package/dist/InfoTip/index.js +1 -1
- package/dist/{InfoTip-DqDgJRtp.js → InfoTip--fZOD0ux.js} +2 -2
- package/dist/{InputClearButton-BZzOtoH7.js → InputClearButton-LF0iVTVF.js} +1 -1
- package/dist/InputGroup/index.js +1 -1
- package/dist/{InputGroup-BN6v-b9L.js → InputGroup-D4CPVzo0.js} +1 -1
- package/dist/{Item-BzjepDWA.js → Item-BKISM91o.js} +1 -1
- package/dist/{LayerContentBoundary-CTjEpdM4.js → LayerContentBoundary-D67fobWl.js} +1 -1
- package/dist/Layout/index.js +2 -2
- package/dist/{Layout-SJoCw8NC.js → Layout-BwSvAsLi.js} +1 -1
- package/dist/{LayoutPanel-DZN4RxX6.js → LayoutPanel-CmzJQpnL.js} +1 -1
- package/dist/Lightbox/index.js +1 -1
- package/dist/{Lightbox-K2cAUZRG.js → Lightbox-B32Yh8Uy.js} +1 -1
- package/dist/Link/index.d.ts +1 -1
- package/dist/Link/index.js +1 -1
- package/dist/{Link-v-K2lhCh.js → Link-DSXyw9MW.js} +2 -2
- package/dist/List/index.js +2 -2
- package/dist/{ListItem-BTcwwpFb.js → ListItem-D3iEhvU2.js} +4 -4
- package/dist/Markdown/index.d.ts +1 -1
- package/dist/Markdown/index.js +1 -1
- package/dist/{Markdown-B4WsMYzN.js → Markdown-BvWEX29v.js} +3 -3
- package/dist/MobileNav/index.js +1 -1
- package/dist/{MobileNavToggle-AgT6hzTg.js → MobileNavToggle-sC6GPVKQ.js} +2 -2
- package/dist/MoreMenu/index.d.ts +1 -1
- package/dist/MoreMenu/index.js +1 -1
- package/dist/{MoreMenu-BF9qhsxq.js → MoreMenu-CcavOuxV.js} +7 -7
- package/dist/MultiSelector/index.d.ts +1 -1
- package/dist/MultiSelector/index.js +1 -1
- package/dist/{MultiSelector-CDMoxGKV.js → MultiSelector-Diu5zHbP.js} +5 -5
- package/dist/{NavDisclosure-CSnUZY3k.js → NavDisclosure-BpYjtYo5.js} +1 -1
- package/dist/{NavHeadingSurface-C3fTf5--.js → NavHeadingSurface-CK9zMjFC.js} +1 -1
- package/dist/NavItem/index.js +1 -1
- package/dist/{NavItem-DUnSwKRl.js → NavItem-DlW8noR6.js} +1 -1
- package/dist/NavMenu/index.js +3 -3
- package/dist/{NavMenu-DAnQr1S5.js → NavMenu-J2kmtb1B.js} +2 -2
- package/dist/{NavMenuItem-CrTUxgBP.js → NavMenuItem-DItNRTDZ.js} +3 -3
- package/dist/NumberInput/index.d.ts +1 -1
- package/dist/NumberInput/index.js +1 -1
- package/dist/{NumberInput-DQ7FMUTd.js → NumberInput-vhm5TQon.js} +3 -3
- package/dist/Outline/index.js +1 -1
- package/dist/{Outline-CSHJqtg4.js → Outline-CVIDd0fN.js} +2 -66
- package/dist/OverflowList/index.d.ts +1 -1
- package/dist/OverflowList/index.js +1 -1
- package/dist/{OverflowList-CK6sgmY3.js → OverflowList-DjWWBOkx.js} +2 -2
- package/dist/Pagination/index.js +1 -1
- package/dist/{Pagination-B-337WLy.js → Pagination-DKsePQjC.js} +2 -2
- package/dist/{PanGestureRecognizer-yYMpXB93.js → PanGestureRecognizer-C7hNunjF.js} +1 -1
- package/dist/PickerWheel-Bf7xe6g6.js +1131 -0
- package/dist/Popover/index.d.ts +1 -1
- package/dist/Popover/index.js +1 -1
- package/dist/{Popover-DVrWAYg2.js → Popover-CKgepPJ6.js} +7 -7
- package/dist/PowerSearch/index.d.ts +1 -1
- package/dist/PowerSearch/index.js +1 -1
- package/dist/{PowerSearch-sWyeh9Az.js → PowerSearch-v_MRx2nn.js} +26 -26
- package/dist/{PressTracker-CjfG1d8n.js → PressTracker-DL75qEq_.js} +2 -2
- package/dist/ProgressBar/index.d.ts +1 -1
- package/dist/ProgressBar/index.js +1 -1
- package/dist/{ProgressBar-ChgsiVRR.js → ProgressBar-B2ds3imd.js} +1 -1
- package/dist/Radio/index.d.ts +1 -1
- package/dist/Radio/index.js +1 -1
- package/dist/{RadioGroup-BloTgj7H.js → RadioGroup-C-S-SnbH.js} +5 -5
- package/dist/RadioList/index.d.ts +1 -1
- package/dist/RadioList/index.js +1 -1
- package/dist/{RadioListItem-BERujpW8.js → RadioListItem-DzKVK4DZ.js} +1 -1
- package/dist/Resizable/index.d.ts +1 -1
- package/dist/Resizable/index.js +1 -1
- package/dist/{ResizeHandle-J9-dAMuo.js → ResizeHandle-CaZEB4Py.js} +1 -1
- package/dist/ScrollableArea/index.d.ts +1 -1
- package/dist/SegmentedControl/index.js +1 -1
- package/dist/{SegmentedControl-BzvLJL8T.js → SegmentedControl-Bp7dpEjn.js} +10 -10
- package/dist/SelectableCard/index.d.ts +1 -1
- package/dist/SelectableCard/index.js +1 -1
- package/dist/{SelectableCard-IAv2X4dq.js → SelectableCard-DPWaUCGZ.js} +1 -1
- package/dist/Selector/index.d.ts +1 -1
- package/dist/Selector/index.js +1 -1
- package/dist/{Selector-CsEWOfWV.js → Selector-CJmeuWhN.js} +3 -3
- package/dist/SideNav/index.d.ts +1 -1
- package/dist/SideNav/index.js +2 -2
- package/dist/{SideNav-CVAi462m.js → SideNav-D-AQqNPx.js} +9 -9
- package/dist/Slider/index.js +1 -1
- package/dist/{Slider-D0omHlRI.js → Slider-DU-Yl3fd.js} +9 -150
- package/dist/StatusDot/index.js +1 -1
- package/dist/{StatusDot-D7nVuPg7.js → StatusDot-Jw676Z_6.js} +1 -1
- package/dist/Stepper/index.js +1 -1
- package/dist/{Stepper-CetoMTog.js → Stepper-67SsxUne.js} +1 -1
- package/dist/Switch/index.d.ts +1 -1
- package/dist/Switch/index.js +1 -1
- package/dist/{Switch-DTwurKmh.js → Switch-C6qaebkX.js} +10 -10
- package/dist/TabList/index.d.ts +1 -1
- package/dist/TabList/index.js +1 -1
- package/dist/{TabList-BJTT4nm6.js → TabList-TbJ6y1gN.js} +3 -3
- package/dist/Table/index.d.ts +1 -1
- package/dist/Table/index.js +1 -1
- package/dist/{Table-CUqi9BXT.js → Table-CbMxkm2v.js} +12 -12
- package/dist/Text/index.js +1 -1
- package/dist/{Text-kwsIut3C.js → Text-bvai__ae.js} +1 -1
- package/dist/TextArea/index.d.ts +1 -1
- package/dist/TextArea/index.js +1 -1
- package/dist/{TextArea-BKwmXPGQ.js → TextArea-D6EtmxTk.js} +4 -4
- package/dist/TextInput/index.d.ts +1 -1
- package/dist/TextInput/index.js +1 -1
- package/dist/{TextInput-CRXs8cDs.js → TextInput-AngvgtdT.js} +4 -4
- package/dist/Thumbnail/index.js +1 -1
- package/dist/{Thumbnail-GUwgnwZb.js → Thumbnail-DExkxw8a.js} +3 -3
- package/dist/{TimeField-Bn_ziTCi.js → TimeField-BNGg25yA.js} +9 -4
- package/dist/TimeInput/index.d.ts +1 -1
- package/dist/TimeInput/index.js +1 -1
- package/dist/{TimeInput-BKkwmN1V.js → TimeInput-D8lwgHOR.js} +2 -2
- package/dist/Timer/index.d.ts +1 -1
- package/dist/Timer/index.js +1 -1
- package/dist/{Timer-B-9sSJWK.js → Timer-CO-JNJTI.js} +1 -1
- package/dist/Timestamp/index.d.ts +1 -1
- package/dist/Timestamp/index.js +1 -1
- package/dist/{Timestamp-Dlz2SvSe.js → Timestamp-CeSb1A8c.js} +3 -3
- package/dist/Toast/index.js +1 -1
- package/dist/{Toast-BSnsRCyB.js → Toast-B2Fq-JYA.js} +4 -107
- package/dist/ToggleButton/index.d.ts +1 -1
- package/dist/ToggleButton/index.js +1 -1
- package/dist/{ToggleButton-DE79lIQq.js → ToggleButton-Bn8yLHbh.js} +3 -3
- package/dist/Token/index.js +1 -1
- package/dist/{Token-BdClMOG9.js → Token-Dpxh42Mw.js} +1 -1
- package/dist/Tokenizer/index.d.ts +1 -1
- package/dist/Tokenizer/index.js +1 -1
- package/dist/{Tokenizer-BitI30VU.js → Tokenizer-B3EnI98V.js} +12 -12
- package/dist/Toolbar/index.d.ts +1 -1
- package/dist/Tooltip/index.d.ts +1 -1
- package/dist/Tooltip/index.js +2 -2
- package/dist/{Tooltip-DyGaJUbl.js → Tooltip-BdG9g6c6.js} +1 -1
- package/dist/TopNav/index.d.ts +1 -1
- package/dist/TopNav/index.js +1 -1
- package/dist/{TopNav-BUjEldSq.js → TopNav-D7mzM7pu.js} +5 -5
- package/dist/TreeList/index.js +1 -1
- package/dist/{TreeList-BVJ3V-xI.js → TreeList-BmeXFFqr.js} +4 -4
- package/dist/Typeahead/index.js +2 -2
- package/dist/{Typeahead-C54ao2ye.js → Typeahead-kLp9UG-Q.js} +5 -5
- package/dist/{accessibleName-19W3jhkD.js → accessibleName-Zr1_WoBg.js} +1 -1
- package/dist/{animator-ozeBZ_zC.js → animator-Bptiubcx.js} +1 -1
- package/dist/{boxHold-0ChMpiin.js → boxHold-Bh1fTcXx.js} +5 -5
- package/dist/{browserClickWait-DIj9tkLa.js → browserClickWait-CiUtuWNK.js} +2 -2
- package/dist/{clickGuard-CxqcfBCJ.js → clickGuard-Bd-jBj_G.js} +2 -2
- package/dist/composables/index.d.ts +1 -1
- package/dist/composables/index.js +10 -10
- package/dist/{composables-CF2weN-L.js → composables-B6ebqwHY.js} +7 -68
- package/dist/{context-C1MPE6J5.js → context-Dweha8vW.js} +1 -1
- package/dist/decay-TluwbMlP.js +64 -0
- package/dist/{sharedRealm-DBtNH73I.js → flatTree-BB4yPMNL.js} +1 -57
- package/dist/{geometry-BnZ6uDX_.js → geometry-0e0f5Mjv.js} +9 -8
- package/dist/haptics-DIfaJavG.js +146 -0
- package/dist/{holdEntranceInput-C8B_DYYs.js → holdEntranceInput-DWqsAYll.js} +1 -1
- package/dist/{index-DPhQZXYw.d.ts → index-B44fLswd.d.ts} +1 -1
- package/dist/{index-CArlEl1O.d.ts → index-BHoivOHG.d.ts} +75 -75
- package/dist/{index-DHUCHxn2.d.ts → index-BWWirRm3.d.ts} +1 -1
- package/dist/{index--kbwaSXW.d.ts → index-BWzEt0gT.d.ts} +2 -2
- package/dist/{index-uLDBzCDo.d.ts → index-BZx7HHxY.d.ts} +9 -9
- package/dist/{index-CTjkJP4x.d.ts → index-Bgk1Rj2A.d.ts} +1 -1
- package/dist/{index-BjqoHLMq.d.ts → index-C1e8LNx2.d.ts} +1 -1
- package/dist/{index-AgTJRqUY.d.ts → index-CQi9WGWE.d.ts} +2 -2
- package/dist/{index-JE1HrzdJ.d.ts → index-CUuUoX3h.d.ts} +3 -3
- package/dist/{index-Bwh8O-v8.d.ts → index-CZ29Xu_E.d.ts} +1 -1
- package/dist/{index-mK1ICsVg.d.ts → index-Cm36VS1A.d.ts} +2 -2
- package/dist/{index-DHsYyqMP.d.ts → index-CukA-J8A.d.ts} +9 -9
- package/dist/{index-BU1HdDER.d.ts → index-D8VViJw0.d.ts} +3 -1
- package/dist/{index-CdvmnNMH.d.ts → index-DEJlE6_N.d.ts} +2 -2
- package/dist/{index-QC9FDUDA.d.ts → index-DN5Ga_Zm.d.ts} +3 -3
- package/dist/{index-BtqvPjAf.d.ts → index-Dk50Zh3F.d.ts} +1 -1
- package/dist/{index-V6uruC4Z.d.ts → index-E4L3DiiH.d.ts} +1 -1
- package/dist/{index-BA8exXNP.d.ts → index-X4S7_dmq.d.ts} +1 -1
- package/dist/{index-CbA8rR_b.d.ts → index-a_FOKJMw.d.ts} +2 -2
- package/dist/{index-yQc-te9a.d.ts → index-ql9ApSTF.d.ts} +2 -2
- package/dist/index.d.ts +20 -20
- package/dist/index.js +101 -101
- package/dist/{inputHold-BJtjc9iI.js → inputHold-CvjeOOWT.js} +4 -4
- package/dist/{inputHoldState-BYi5FKZl.js → inputHoldState-Cg1r8Ib7.js} +2 -2
- package/dist/{inputStream-HXw2lZ-3.js → inputStream-DkMWPYac.js} +1 -1
- package/dist/{landing-BW6qLvC8.js → landing-CrVewjeb.js} +1 -1
- package/dist/{layerDepth-SGFJ5L6X.js → layerDepth-DRfWATFr.js} +1 -1
- package/dist/{lazyBottomSheet-Bg5E8lr3.js → lazyBottomSheet-DlHcPsAT.js} +1 -1
- package/dist/{presentation-twEOzzJq.js → presentation-Cl58tYA6.js} +2 -1
- package/dist/{pressGesture-B3Efxs_z.js → pressGesture-CfBgXWRM.js} +13 -0
- package/dist/pressSlot-B6TvGkSO.js +222 -0
- package/dist/reducedMotion-D8-U7XFT.js +121 -0
- package/dist/{reportChange-DwOfucSf.js → reportChange-CUo2YNPB.js} +2 -2
- package/dist/{resizableChannel-BnwrR5tr.js → resizableChannel-CaaqGvXj.js} +3 -3
- package/dist/scrollView-DcPpdCrj.js +128 -0
- package/dist/{selectionLock-BrUpRS0E.js → selectionLock-BM8XEZQD.js} +2 -1
- package/dist/sharedRealm-BYHklCVM.js +57 -0
- package/dist/{stillPointerGate-BvCX7ddI.js → stillPointerGate-BU1CKW7m.js} +1 -1
- package/dist/{tooltipFocusRules-CxIlSnHw.js → tooltipFocusRules-GGASOH_U.js} +2 -2
- package/dist/{tooltipTriggerRules-CHNpQ6RL.js → tooltipTriggerRules-DIaGdkD_.js} +1 -1
- package/dist/{touchHold-CjNjGH7O.js → touchHold-CciGr8hU.js} +1 -1
- package/dist/{useActionGroupTracking-D0IwimcQ.js → useActionGroupTracking-DjIdPbfL.js} +4 -3
- package/dist/{useAnimatedLayout-CRAuCwTZ.js → useAnimatedLayout-Dq-cttfe.js} +1 -1
- package/dist/{useChatStreamScroll-DcNKcNTj.js → useChatStreamScroll-DEp17Yq9.js} +1 -1
- package/dist/{useDismiss-6SGAlkB_.js → useDismiss-CegXF2Zo.js} +1 -1
- package/dist/useGestureRecognizer-DDd-6Km-.js +106 -0
- package/dist/{useInputStatusIcon-C2AkJiAT.js → useInputStatusIcon-m6l4qBmA.js} +1 -1
- package/dist/{useMenuEntranceHold-C-kHicUN.js → useMenuEntranceHold-C4LOzKIS.js} +1 -1
- package/dist/{useMenuPress-B5h9PBx_.js → useMenuPress-BDPqPten.js} +4 -4
- package/dist/usePressFeedback-D2mWzgoJ.js +380 -0
- package/dist/{useResizable-I0APFcMz.js → useResizable-Bwv-j_9N.js} +2 -2
- package/dist/{useTooltip-owvVSn_m.js → useTooltip-DCp4sTM1.js} +4 -4
- package/dist/{useTouchHitArea-MvzPCmJg.js → useTouchHitArea-DL9D10Rq.js} +2 -2
- package/dist/{useTouchTriggerInternal-5ExaYYSy.js → useTouchTriggerInternal-C_mowlpv.js} +1 -1
- package/dist/{useTruncationTooltip-DHI6q_EV.js → useTruncationTooltip-Du80jGdE.js} +3 -3
- package/dist/{useTypeaheadMenuConfig-COiZ4isy.js → useTypeaheadMenuConfig-B14t0HGE.js} +1 -1
- package/package.json +1 -1
- package/styles/date-input.css +69 -0
- package/dist/PickerWheel-DNX3yrUd.js +0 -82
- package/dist/pressFeedback-B3cqaMGl.js +0 -470
- package/dist/usePressFeedback-iyoKakPX.js +0 -49
|
@@ -0,0 +1,1131 @@
|
|
|
1
|
+
import { a as registerMotionTable, d as toSpring } from "./roles-DWH31Bn3.js";
|
|
2
|
+
import { c as solveSpring } from "./linearEasing-VHwy6xl_.js";
|
|
3
|
+
import { l as registerScrollTable, u as scroll } from "./gestures-yKyyMqeQ.js";
|
|
4
|
+
import { t as useMediaQuery } from "./useMediaQuery-BzXGT1Aw.js";
|
|
5
|
+
import { c as motionNow } from "./cssValues-Cr6PhYTx.js";
|
|
6
|
+
import { n as createMotionEngine } from "./animator-Bptiubcx.js";
|
|
7
|
+
import { t as resolveMotion } from "./resolveMotion-DftkGFw6.js";
|
|
8
|
+
import { t as solveDecay } from "./decay-TluwbMlP.js";
|
|
9
|
+
import { o as springs } from "./springs-DjAn_oV5.js";
|
|
10
|
+
import { a as scrollTypeOf } from "./geometry-0e0f5Mjv.js";
|
|
11
|
+
import { t as PanGestureRecognizer } from "./PanGestureRecognizer-C7hNunjF.js";
|
|
12
|
+
import { n as lockSelection } from "./selectionLock-BM8XEZQD.js";
|
|
13
|
+
import { n as projectDistance } from "./projection-qPcLQcwK.js";
|
|
14
|
+
import { r as rubberBandInverse, t as rubberBand } from "./rubberBand-DDd5ElTe.js";
|
|
15
|
+
import { n as playHaptic, r as TapGestureRecognizer, t as canVibrate } from "./haptics-DIfaJavG.js";
|
|
16
|
+
import { t as useGestureRecognizer } from "./useGestureRecognizer-DDd-6Km-.js";
|
|
17
|
+
import { n as reducedMotionFade, t as playReducedMotionDip } from "./reducedMotion-D8-U7XFT.js";
|
|
18
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, normalizeStyle, onScopeDispose, openBlock, ref, renderList, shallowRef, toDisplayString, toValue, unref, useId, useTemplateRef, watch } from "vue";
|
|
19
|
+
//#region src/DateInput/wheelLoop.ts
|
|
20
|
+
/**
|
|
21
|
+
* @file wheelLoop.ts
|
|
22
|
+
* @input Nothing; pure functions over a looping wheel's positions
|
|
23
|
+
* @output mod, nearestLoopCopy, lapPosition, restingLoopStep, loopedStep,
|
|
24
|
+
* restingSpan and coveringSpan: how a wheel whose rows repeat without end
|
|
25
|
+
* names, reaches and draws its rows
|
|
26
|
+
* @position Internal; read by useTouchWheel.ts for UIDatePicker's looping
|
|
27
|
+
* minute wheel
|
|
28
|
+
*
|
|
29
|
+
* A looping wheel's position is any integer. The row it shows is that integer
|
|
30
|
+
* folded into the rows (`mod`), so positions one lap apart show the same row.
|
|
31
|
+
*/
|
|
32
|
+
/** `value` folded into 0 … count − 1. */
|
|
33
|
+
function mod(value, count) {
|
|
34
|
+
return (value % count + count) % count;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The copy of row `index` nearest position `from`, in a loop of `count` rows.
|
|
38
|
+
* Two copies can be equally near: with two rows, or half an even count away.
|
|
39
|
+
* Then it is `index` itself when that is one of them, so a step to `from + 1`
|
|
40
|
+
* always goes forward.
|
|
41
|
+
*/
|
|
42
|
+
function nearestLoopCopy(index, from, count) {
|
|
43
|
+
if (Math.abs(index - from) * 2 <= count) return index;
|
|
44
|
+
return Math.round(from + ((mod(index, count) - mod(from, count) + count + count / 2) % count - count / 2));
|
|
45
|
+
}
|
|
46
|
+
/** The position of row `row` in the lap that holds `position`: the copy between the same two seams. */
|
|
47
|
+
function lapPosition(row, position, count) {
|
|
48
|
+
if (count === 0) return row;
|
|
49
|
+
return row + Math.floor(position / count) * count;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* How many rows, signed, a looping wheel resting at `position` travels to the
|
|
53
|
+
* nearest enabled row: 0 when that row is enabled. A tie goes toward `toward`,
|
|
54
|
+
* the committed row's position. The search stops half a turn away, so a rest
|
|
55
|
+
* never turns the long way round. With no enabled row that near, the wheel
|
|
56
|
+
* travels to `toward`.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* // Months, looping, with only January and February enabled: a rest on
|
|
61
|
+
* // December (position 11) turns one row on to January.
|
|
62
|
+
* restingLoopStep(p => p % 12 < 2, 11, 1, 12) // 1
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
function restingLoopStep(isEnabledAt, position, toward, count) {
|
|
66
|
+
if (isEnabledAt(position)) return 0;
|
|
67
|
+
for (let distance = 1; distance <= count / 2; distance++) {
|
|
68
|
+
const isBelowEnabled = isEnabledAt(position - distance);
|
|
69
|
+
const isAboveEnabled = isEnabledAt(position + distance);
|
|
70
|
+
if (isBelowEnabled && isAboveEnabled) return toward < position ? -distance : distance;
|
|
71
|
+
if (isBelowEnabled) return -distance;
|
|
72
|
+
if (isAboveEnabled) return distance;
|
|
73
|
+
}
|
|
74
|
+
return toward - position;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* How many rows, signed, a key moves a looping wheel of `count` rows from
|
|
78
|
+
* position `from` by `delta` rows, in list order. Whole laps fall off `delta`,
|
|
79
|
+
* so a key never turns a whole lap. The key takes the next enabled row from
|
|
80
|
+
* its target in its own direction, across the seam, at most half a turn from
|
|
81
|
+
* `from`. Failing that, it takes the enabled row nearest its target on the way
|
|
82
|
+
* back. Null when it finds no other row, so it commits nothing.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* // Minutes 00-59, looping: ArrowDown on :59 moves one row on, to :00.
|
|
87
|
+
* loopedStep(() => true, 59, 1, 60) // 1
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
function loopedStep(isEnabledAt, from, delta, count) {
|
|
91
|
+
const step = Math.sign(delta);
|
|
92
|
+
const rows = count < 2 ? 0 : Math.abs(delta) % count;
|
|
93
|
+
if (rows === 0) return null;
|
|
94
|
+
const target = from + step * rows;
|
|
95
|
+
const reach = Math.max(rows, Math.floor(count / 2));
|
|
96
|
+
for (let position = target; Math.abs(position - from) <= reach; position += step) if (isEnabledAt(position)) return position - from;
|
|
97
|
+
for (let position = target - step; position !== from; position -= step) if (isEnabledAt(position)) return position - from;
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
/** A looping wheel's span at rest: its own rows, and copies past each end. */
|
|
101
|
+
function restingSpan(count) {
|
|
102
|
+
return {
|
|
103
|
+
from: -10,
|
|
104
|
+
to: count - 1 + 10
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/** `span` grown to cover positions `a` to `b` and the band's surroundings; the same span when it already does. */
|
|
108
|
+
function coveringSpan(span, a, b) {
|
|
109
|
+
const from = Math.min(span.from, Math.min(a, b) - 10);
|
|
110
|
+
const to = Math.max(span.to, Math.max(a, b) + 10);
|
|
111
|
+
return from === span.from && to === span.to ? span : {
|
|
112
|
+
from,
|
|
113
|
+
to
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
const STEPS = {
|
|
117
|
+
ArrowUp: -1,
|
|
118
|
+
ArrowDown: 1,
|
|
119
|
+
PageUp: -10,
|
|
120
|
+
PageDown: 10
|
|
121
|
+
};
|
|
122
|
+
/** What `key` asks of a wheel, or null for a key it leaves alone. */
|
|
123
|
+
function wheelKeyOf(key) {
|
|
124
|
+
const step = STEPS[key];
|
|
125
|
+
if (step != null) return { step };
|
|
126
|
+
if (key === "Home") return { end: "first" };
|
|
127
|
+
if (key === "End") return { end: "last" };
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The row `key` moves to from row `from`. Keys walk the enabled rows only: an
|
|
132
|
+
* Arrow moves one, a Page key ten, Home and End go to the first and last. A
|
|
133
|
+
* key stops at the end instead of wrapping round. Null when the key goes
|
|
134
|
+
* nowhere new, or no row is enabled.
|
|
135
|
+
*/
|
|
136
|
+
function steppedRow(options, from, key) {
|
|
137
|
+
if ("end" in key) return endRow(options, key.end, from);
|
|
138
|
+
const enabled = [];
|
|
139
|
+
options.forEach((option, index) => {
|
|
140
|
+
if (!option.disabled) enabled.push(index);
|
|
141
|
+
});
|
|
142
|
+
if (enabled.length === 0) return null;
|
|
143
|
+
const last = enabled.length - 1;
|
|
144
|
+
const current = enabled.indexOf(from);
|
|
145
|
+
const row = enabled[current < 0 ? key.step > 0 ? 0 : last : Math.min(Math.max(current + key.step, 0), last)] ?? null;
|
|
146
|
+
return row === from ? null : row;
|
|
147
|
+
}
|
|
148
|
+
/** The first or the last enabled row: where Home or End moves a wheel. Null when it is `from`, or no row is enabled. */
|
|
149
|
+
function endRow(options, end, from) {
|
|
150
|
+
let row = -1;
|
|
151
|
+
options.forEach((option, index) => {
|
|
152
|
+
if (!option.disabled && (row < 0 || end === "last")) row = index;
|
|
153
|
+
});
|
|
154
|
+
return row < 0 || row === from ? null : row;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* The enabled row nearest `index`, for a wheel that came to rest there. On a
|
|
158
|
+
* tie it goes toward `towardIndex` (the committed row). With no enabled row
|
|
159
|
+
* it is `towardIndex`.
|
|
160
|
+
*/
|
|
161
|
+
function nearestEnabledIndex(options, index, towardIndex) {
|
|
162
|
+
const isEnabled = (i) => i >= 0 && i < options.length && !options[i].disabled;
|
|
163
|
+
if (isEnabled(index)) return index;
|
|
164
|
+
for (let distance = 1; distance < options.length; distance++) {
|
|
165
|
+
const below = isEnabled(index - distance);
|
|
166
|
+
const above = isEnabled(index + distance);
|
|
167
|
+
if (below && above) return towardIndex < index ? index - distance : index + distance;
|
|
168
|
+
if (below) return index - distance;
|
|
169
|
+
if (above) return index + distance;
|
|
170
|
+
}
|
|
171
|
+
return towardIndex;
|
|
172
|
+
}
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/motion/uikit/picker.ts
|
|
175
|
+
/**
|
|
176
|
+
* @file picker.ts
|
|
177
|
+
* @input Nothing; data only
|
|
178
|
+
* @output `picker`, UIPickerView's measured constants, and
|
|
179
|
+
* `registerPickerTable`, which makes the tap spin's duration a motion role
|
|
180
|
+
* @position The picker domain of the UIKit table (motion/uikit); read by
|
|
181
|
+
* DateInput's wheelPhysics.ts, wheelStrip.ts and PickerWheel.tsx
|
|
182
|
+
*
|
|
183
|
+
* Lengths are pt at UIKit's scale, times ms and velocities pt/ms. Every leaf
|
|
184
|
+
* carries one `@source`, as uikit.test.ts enforces.
|
|
185
|
+
*/
|
|
186
|
+
const picker = {
|
|
187
|
+
geometry: {
|
|
188
|
+
/**
|
|
189
|
+
* Row pitch: rows sit at k × 32 pt in each column's table.
|
|
190
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
191
|
+
* iPhone 17 Pro, UIPickerView table offsets and cell frames, Oct 23 2026
|
|
192
|
+
*/
|
|
193
|
+
rowHeight: 32,
|
|
194
|
+
/**
|
|
195
|
+
* The picker's height (its intrinsic content size).
|
|
196
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
197
|
+
* iPhone 17 Pro, UIPickerView frame, Oct 23 2026
|
|
198
|
+
*/
|
|
199
|
+
height: 216,
|
|
200
|
+
/**
|
|
201
|
+
* d of the rubber band past the first or last row. The column's table view
|
|
202
|
+
* is 291 pt tall in a 216 pt picker. With c = 0.55, scroll.rubberBand's
|
|
203
|
+
* formula puts 10, 50 and 110 pt of finger travel past the end at 5.4, 25.1
|
|
204
|
+
* and 50.1 pt. The measured values are 5.3, 25 and 50.
|
|
205
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
206
|
+
* iPhone 17 Pro, UIPickerTableView frame and offsets during drags
|
|
207
|
+
* 20, 60 and 120 pt past the last row, Oct 23 2026
|
|
208
|
+
*/
|
|
209
|
+
rubberBandDimension: 291
|
|
210
|
+
},
|
|
211
|
+
release: {
|
|
212
|
+
/**
|
|
213
|
+
* The speed at which a coast ends. The scroll view projects the target at
|
|
214
|
+
* offset + (v − this) × r ÷ (1 − r), with r = scroll.decelerationRate
|
|
215
|
+
* .normal. That gives 461.33, 502.67 and 266.67 pt for v = 0.9334, 1.0162
|
|
216
|
+
* and 0.5436, all three to 0.3 pt. The coast onto the row it snaps to keeps
|
|
217
|
+
* the release velocity. It re-solves the rate so that the speed reaches
|
|
218
|
+
* this exactly at that row, where it stops. Two coasts fit it to 0.4 and
|
|
219
|
+
* 0.3 pt RMS, ending within 30 ms of the measured end.
|
|
220
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
221
|
+
* iPhone 17 Pro, scrollViewWillEndDragging targets and per-frame
|
|
222
|
+
* offsets to rest, Oct 23 2026
|
|
223
|
+
*/
|
|
224
|
+
stopSpeed: .0089,
|
|
225
|
+
/**
|
|
226
|
+
* Below this release speed (pt/ms, a scroll view's release velocity), a
|
|
227
|
+
* release inside the rows carries no velocity. The wheel then snaps to the
|
|
228
|
+
* nearest row instead of coasting. Past the first or last row the velocity
|
|
229
|
+
* is kept, however small (0.0816 kept). A pause before the lift does not
|
|
230
|
+
* zero it: the velocity changes only when the finger moves.
|
|
231
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
232
|
+
* iPhone 17 Pro, steady 100 pt drags mid-list lifted while moving: zeroed
|
|
233
|
+
* at 100 to 250 pt/s both ways, passed from 260 pt/s (0.2577 the
|
|
234
|
+
* smallest velocity handed on); a 300 pt/s drag held still 300 ms
|
|
235
|
+
* still coasted, Oct 23 2026
|
|
236
|
+
*/
|
|
237
|
+
minimumSpeed: .25
|
|
238
|
+
},
|
|
239
|
+
/**
|
|
240
|
+
* A release without velocity, or a coast already on a row, eases onto the
|
|
241
|
+
* nearest row exponentially. Each millisecond it covers this fraction of the
|
|
242
|
+
* distance left: e^(−0.011 t), done in about 0.3 s. Snaps of 4, 6 and 8 pt
|
|
243
|
+
* fit 0.0099, 0.0107 and 0.0123.
|
|
244
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
245
|
+
* iPhone 17 Pro, per-frame offsets after three slow releases between
|
|
246
|
+
* rows, Oct 23 2026
|
|
247
|
+
*/
|
|
248
|
+
snapRate: .011,
|
|
249
|
+
tapSpin: {
|
|
250
|
+
/**
|
|
251
|
+
* A tap on a row turns the wheel onto it in this long (setContentOffset
|
|
252
|
+
* animated), on Core Animation's ease-in-ease-out (timing.curves.move). The
|
|
253
|
+
* row is selected on arrival. A tap on the band's row does nothing.
|
|
254
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
255
|
+
* iPhone 17 Pro, per-frame offsets after a tap two rows below the band
|
|
256
|
+
* (6.8, 25.1, 50.2, 75.4, 93.7 % at 50 ms steps, arriving at 300 ms;
|
|
257
|
+
* the same with Reduce Motion and Prefer Cross-Fade on), Oct 23 2026
|
|
258
|
+
*/
|
|
259
|
+
durationMs: 300 },
|
|
260
|
+
selectionTick: {
|
|
261
|
+
/**
|
|
262
|
+
* One selection haptic per row whose centre reaches the band's centre,
|
|
263
|
+
* at most one per this interval. Not during a tap's spin.
|
|
264
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
265
|
+
* iPhone 17 Pro, selectionChangedAtLocation: and the feedback
|
|
266
|
+
* generator's minimum interval (0.040 s) logged during drags and
|
|
267
|
+
* coasts, Oct 23 2026
|
|
268
|
+
*/
|
|
269
|
+
minimumIntervalMs: 40 }
|
|
270
|
+
};
|
|
271
|
+
/**
|
|
272
|
+
* Registers the tap spin's duration as an internal motion role,
|
|
273
|
+
* `picker.tapSpin.durationMs`. Every other value stays an internal measured
|
|
274
|
+
* constant. The tap spin is the measured reference: the wheel's turns play
|
|
275
|
+
* `springs.settle`, and its bounce at an end is `scroll.bounce`. A page that
|
|
276
|
+
* plays no picker motion ships no picker registry. The module registers its
|
|
277
|
+
* own table at import (one idempotent in-memory write, no DOM).
|
|
278
|
+
*/
|
|
279
|
+
function registerPickerTable() {
|
|
280
|
+
registerMotionTable("picker", picker, { roles: ["tapSpin.durationMs"] });
|
|
281
|
+
}
|
|
282
|
+
registerPickerTable();
|
|
283
|
+
//#endregion
|
|
284
|
+
//#region src/DateInput/wheelPhysics.ts
|
|
285
|
+
/** UIKit's row height in pt: the unit the picker constants are measured in. */
|
|
286
|
+
const UIKIT_ROW_HEIGHT = picker.geometry.rowHeight;
|
|
287
|
+
/** Below half a device pixel at 3×, a motion is on its row. */
|
|
288
|
+
const AT_REST_PT = 1 / 6;
|
|
289
|
+
/** The constants' scale for a wheel whose rows are `rowHeight` px tall. */
|
|
290
|
+
function scaleFor(rowHeight) {
|
|
291
|
+
return rowHeight / UIKIT_ROW_HEIGHT;
|
|
292
|
+
}
|
|
293
|
+
/** The offsets of the first and last rows: unbounded when looping. */
|
|
294
|
+
function offsetBounds({ rowHeight, rowCount, looping }) {
|
|
295
|
+
if (looping) return {
|
|
296
|
+
min: -Infinity,
|
|
297
|
+
max: Infinity
|
|
298
|
+
};
|
|
299
|
+
return {
|
|
300
|
+
min: 0,
|
|
301
|
+
max: Math.max(0, rowCount - 1) * rowHeight
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
/** UIKit's rubber band dimension for the picker's table, at the wheel's pitch. */
|
|
305
|
+
function bandDimension(layout) {
|
|
306
|
+
return picker.geometry.rubberBandDimension * scaleFor(layout.rowHeight);
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* The offset a drag shows for the finger's `offset`: past the first or last
|
|
310
|
+
* row it is rubber-banded, as a UIPickerView's table is.
|
|
311
|
+
*/
|
|
312
|
+
function dragOffset(offset, layout) {
|
|
313
|
+
const { min, max } = offsetBounds(layout);
|
|
314
|
+
if (offset < min) return min + rubberBand(offset - min, bandDimension(layout));
|
|
315
|
+
if (offset > max) return max + rubberBand(offset - max, bandDimension(layout));
|
|
316
|
+
return offset;
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* The finger's offset for a shown one. Past an end, it is the travel that the
|
|
320
|
+
* rubber band shows as `shown`, so a drag that starts in a bounce continues
|
|
321
|
+
* without a jump.
|
|
322
|
+
*/
|
|
323
|
+
function fingerOffset(shown, layout) {
|
|
324
|
+
const { min, max } = offsetBounds(layout);
|
|
325
|
+
if (shown < min) return min + rubberBandInverse(shown - min, bandDimension(layout));
|
|
326
|
+
if (shown > max) return max + rubberBandInverse(shown - max, bandDimension(layout));
|
|
327
|
+
return shown;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* The position of the row nearest `offset`, clamped to the rows. When looping
|
|
331
|
+
* it is any integer, and the row it shows is that integer folded into the
|
|
332
|
+
* rows (`mod` in wheelLoop.ts).
|
|
333
|
+
*/
|
|
334
|
+
function nearestIndex(offset, layout) {
|
|
335
|
+
const index = Math.round(offset / layout.rowHeight);
|
|
336
|
+
if (layout.looping) return index;
|
|
337
|
+
return Math.min(Math.max(index, 0), Math.max(0, layout.rowCount - 1));
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* The position of the row under a point `dy` px below the band's centre. It is
|
|
341
|
+
* null past either end of a list that does not loop.
|
|
342
|
+
*/
|
|
343
|
+
function rowAtPoint(dy, offset, layout) {
|
|
344
|
+
const position = Math.round((offset + dy) / layout.rowHeight);
|
|
345
|
+
if (!layout.looping && (position < 0 || position >= layout.rowCount)) return null;
|
|
346
|
+
return position;
|
|
347
|
+
}
|
|
348
|
+
/** The wheel at rest on `offset`: a curve that does not move. */
|
|
349
|
+
function restCurve(offset) {
|
|
350
|
+
return {
|
|
351
|
+
duration: 0,
|
|
352
|
+
to: offset,
|
|
353
|
+
value: () => offset,
|
|
354
|
+
velocity: () => 0
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Ease from `from` onto `to` as UIKit does after a release without velocity.
|
|
359
|
+
* The distance left falls as e^(−k t), and the ease ends within half a device
|
|
360
|
+
* pixel.
|
|
361
|
+
*/
|
|
362
|
+
function snapCurve(from, to, scale = 1) {
|
|
363
|
+
const distance = from - to;
|
|
364
|
+
const rate = picker.snapRate * 1e3;
|
|
365
|
+
const epsilon = AT_REST_PT * scale;
|
|
366
|
+
if (Math.abs(distance) <= epsilon) return restCurve(to);
|
|
367
|
+
const duration = Math.log(Math.abs(distance) / epsilon) / rate;
|
|
368
|
+
return {
|
|
369
|
+
duration,
|
|
370
|
+
to,
|
|
371
|
+
value: (t) => t >= duration ? to : to + distance * Math.exp(-rate * t),
|
|
372
|
+
velocity: (t) => t >= duration ? 0 : -rate * distance * Math.exp(-rate * t)
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* A coast from `from` at `velocity` that keeps the velocity and ends on `to` at
|
|
377
|
+
* the stop speed. The rate is re-solved, so the speed falls from |velocity| to
|
|
378
|
+
* the stop speed over exactly `to − from`.
|
|
379
|
+
*/
|
|
380
|
+
function coastCurve(from, velocity, to, scale = 1) {
|
|
381
|
+
const stopSpeed = picker.release.stopSpeed * 1e3 * scale;
|
|
382
|
+
const distance = to - from;
|
|
383
|
+
const speed = Math.abs(velocity);
|
|
384
|
+
if (distance === 0 || Math.sign(distance) !== Math.sign(velocity) || speed <= stopSpeed) return snapCurve(from, to, scale);
|
|
385
|
+
const direction = Math.sign(distance);
|
|
386
|
+
const lambda = (speed - stopSpeed) / Math.abs(distance);
|
|
387
|
+
const duration = Math.log(speed / stopSpeed) / lambda;
|
|
388
|
+
return {
|
|
389
|
+
duration,
|
|
390
|
+
to,
|
|
391
|
+
value: (t) => t >= duration ? to : from + direction * speed * -Math.expm1(-lambda * t) / lambda,
|
|
392
|
+
velocity: (t) => t >= duration ? 0 : direction * speed * Math.exp(-lambda * t)
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* A spring, from `from` with `velocity`, onto `to`. A return past an end plays
|
|
397
|
+
* `scroll.bounce`, and a turn from a tap, a key or the program plays
|
|
398
|
+
* `springs.settle`.
|
|
399
|
+
*/
|
|
400
|
+
function bounceCurve(from, velocity, to, scale = 1, bounce = scroll.bounce) {
|
|
401
|
+
const spring = solveSpring(toSpring(bounce), {
|
|
402
|
+
from,
|
|
403
|
+
to,
|
|
404
|
+
velocity
|
|
405
|
+
});
|
|
406
|
+
const duration = Math.min(30, spring.settleTime(AT_REST_PT * scale));
|
|
407
|
+
return {
|
|
408
|
+
duration,
|
|
409
|
+
to,
|
|
410
|
+
value: (t) => t >= duration ? to : spring.value(t),
|
|
411
|
+
velocity: (t) => t >= duration ? 0 : spring.velocity(t)
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* A coast that runs into an end: the normal decay until the offset reaches
|
|
416
|
+
* `edge`, then the bounce spring with the velocity it has there.
|
|
417
|
+
*/
|
|
418
|
+
function edgeCurve(from, velocity, edge, scale = 1, bounceSpring = scroll.bounce) {
|
|
419
|
+
const decay = solveDecay({
|
|
420
|
+
from,
|
|
421
|
+
velocity
|
|
422
|
+
});
|
|
423
|
+
const hit = decay.timeToReach(edge);
|
|
424
|
+
if (hit == null) return bounceCurve(from, velocity, edge, scale, bounceSpring);
|
|
425
|
+
const bounce = bounceCurve(edge, decay.velocity(hit), edge, scale, bounceSpring);
|
|
426
|
+
const duration = Math.min(30, hit + bounce.duration);
|
|
427
|
+
return {
|
|
428
|
+
duration,
|
|
429
|
+
to: edge,
|
|
430
|
+
value: (t) => t >= duration ? edge : t < hit ? decay.value(t) : bounce.value(t - hit),
|
|
431
|
+
velocity: (t) => t >= duration ? 0 : t < hit ? decay.velocity(t) : bounce.velocity(t - hit)
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Where the scroll view projects a release: the coast's rest point at the
|
|
436
|
+
* normal rate, short of the stop speed.
|
|
437
|
+
*/
|
|
438
|
+
function projectRelease(offset, velocity, scale = 1) {
|
|
439
|
+
const stopSpeed = picker.release.stopSpeed * 1e3 * scale;
|
|
440
|
+
const speed = Math.abs(velocity);
|
|
441
|
+
if (speed <= stopSpeed) return offset;
|
|
442
|
+
return offset + Math.sign(velocity) * projectDistance(speed - stopSpeed);
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* What the wheel does when the finger lifts at `offset` with `velocity`
|
|
446
|
+
* (px/s, positive when the rows move up). `bounce` is `scroll.bounce` as the
|
|
447
|
+
* wheel resolves it. The plan follows UIKit, as measured:
|
|
448
|
+
*
|
|
449
|
+
* - Inside the rows, a release slower than `release.minimumSpeed` carries no
|
|
450
|
+
* velocity. Past an end, the velocity is kept.
|
|
451
|
+
* - The scroll view projects the coast, and the picker snaps that to the
|
|
452
|
+
* nearest row. The coast keeps the release velocity and stops exactly on
|
|
453
|
+
* that row.
|
|
454
|
+
* - A projection past an end decays at the normal rate into the end, and the
|
|
455
|
+
* bounce takes its velocity there.
|
|
456
|
+
* - A release without velocity eases onto the nearest row at `snapRate`.
|
|
457
|
+
* - A release past an end returns on the bounce spring.
|
|
458
|
+
*
|
|
459
|
+
* @example
|
|
460
|
+
* ```ts
|
|
461
|
+
* planRelease(963.67, 933.4, { rowHeight: 32, rowCount: 60 }).index // 45
|
|
462
|
+
* ```
|
|
463
|
+
*/
|
|
464
|
+
function planRelease(offset, velocity, layout, bounce = scroll.bounce) {
|
|
465
|
+
const scale = scaleFor(layout.rowHeight);
|
|
466
|
+
const { min, max } = offsetBounds(layout);
|
|
467
|
+
if (offset < min || offset > max) {
|
|
468
|
+
const edge = offset < min ? min : max;
|
|
469
|
+
return {
|
|
470
|
+
kind: "return",
|
|
471
|
+
index: nearestIndex(edge, layout),
|
|
472
|
+
curve: bounceCurve(offset, velocity, edge, scale, bounce)
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
const minimumSpeed = picker.release.minimumSpeed * 1e3 * scale;
|
|
476
|
+
const speed = Math.abs(velocity) < minimumSpeed ? 0 : velocity;
|
|
477
|
+
const projected = projectRelease(offset, speed, scale);
|
|
478
|
+
if (projected < min || projected > max) {
|
|
479
|
+
const edge = projected < min ? min : max;
|
|
480
|
+
return {
|
|
481
|
+
kind: "edge",
|
|
482
|
+
index: nearestIndex(edge, layout),
|
|
483
|
+
curve: edgeCurve(offset, speed, edge, scale, bounce)
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
const index = nearestIndex(projected, layout);
|
|
487
|
+
const target = index * layout.rowHeight;
|
|
488
|
+
if (speed === 0) return {
|
|
489
|
+
kind: "snap",
|
|
490
|
+
index,
|
|
491
|
+
curve: snapCurve(offset, target, scale)
|
|
492
|
+
};
|
|
493
|
+
const curve = coastCurve(offset, speed, target, scale);
|
|
494
|
+
return {
|
|
495
|
+
kind: curve.duration > 0 ? "coast" : "snap",
|
|
496
|
+
index,
|
|
497
|
+
curve
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Whether moving from offset `from` to `to` brings a row's centre onto the
|
|
502
|
+
* band's: a multiple of `rowHeight` in (from, to] moving up, or in [to, from)
|
|
503
|
+
* moving down.
|
|
504
|
+
*/
|
|
505
|
+
function reachesRow(from, to, rowHeight) {
|
|
506
|
+
if (to > from) return Math.floor(to / rowHeight) > Math.floor(from / rowHeight);
|
|
507
|
+
if (to < from) return Math.ceil(to / rowHeight) < Math.ceil(from / rowHeight);
|
|
508
|
+
return false;
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* The times (seconds, ascending) at which a row's centre reaches the band's
|
|
512
|
+
* centre during `curve`, thinned so that two are never closer than the
|
|
513
|
+
* selection tick's minimum interval. Leaving the row the wheel starts on is
|
|
514
|
+
* not a tick; reaching the next one is.
|
|
515
|
+
*/
|
|
516
|
+
function tickTimes(curve, rowHeight, step = 1 / 240) {
|
|
517
|
+
const interval = picker.selectionTick.minimumIntervalMs / 1e3;
|
|
518
|
+
const until = curve.duration;
|
|
519
|
+
const times = [];
|
|
520
|
+
let previous = curve.value(0);
|
|
521
|
+
let lastTick = -Infinity;
|
|
522
|
+
for (let t = step; t < until + step; t += step) {
|
|
523
|
+
const time = Math.min(t, until);
|
|
524
|
+
const value = curve.value(time);
|
|
525
|
+
if (reachesRow(previous, value, rowHeight) && time - lastTick >= interval) {
|
|
526
|
+
times.push(time);
|
|
527
|
+
lastTick = time;
|
|
528
|
+
}
|
|
529
|
+
previous = value;
|
|
530
|
+
if (time === until) break;
|
|
531
|
+
}
|
|
532
|
+
return times;
|
|
533
|
+
}
|
|
534
|
+
//#endregion
|
|
535
|
+
//#region src/DateInput/wheelStrip.ts
|
|
536
|
+
/**
|
|
537
|
+
* Creates a wheel's strip on a fresh animator.
|
|
538
|
+
*
|
|
539
|
+
* A release's coast and its bounce at an end are momentum (`decay`), so they
|
|
540
|
+
* keep their motion under Reduce Motion. Every other curve is a transition:
|
|
541
|
+
* under Reduce Motion it lands under the shared dip (`playReducedMotionDip`)
|
|
542
|
+
* after a touch or on a coarse pointer, and at once otherwise.
|
|
543
|
+
*
|
|
544
|
+
* @example
|
|
545
|
+
* ```ts
|
|
546
|
+
* const strip = createWheelStrip({ rowHeight: 28, rowCount: 60 })
|
|
547
|
+
* strip.attach(element)
|
|
548
|
+
* strip.play(planRelease(strip.offset(), 900, layout).curve, { ticks: true, momentum: true })
|
|
549
|
+
* ```
|
|
550
|
+
*/
|
|
551
|
+
function createWheelStrip(initialLayout) {
|
|
552
|
+
const animator = createMotionEngine(null);
|
|
553
|
+
let layout = initialLayout;
|
|
554
|
+
let running = null;
|
|
555
|
+
let nearestListener = null;
|
|
556
|
+
let lastNearest = null;
|
|
557
|
+
let lastTick = -Infinity;
|
|
558
|
+
/** Last offset a drag frame showed, for its ticks. */
|
|
559
|
+
let dragPrevious = null;
|
|
560
|
+
const shown = (time) => -animator.get("y", time) || 0;
|
|
561
|
+
function reportNearest(offset) {
|
|
562
|
+
const position = nearestIndex(offset, layout);
|
|
563
|
+
if (position === lastNearest) return;
|
|
564
|
+
lastNearest = position;
|
|
565
|
+
nearestListener?.(position);
|
|
566
|
+
}
|
|
567
|
+
function tick(time) {
|
|
568
|
+
if (time - lastTick < picker.selectionTick.minimumIntervalMs) return;
|
|
569
|
+
lastTick = time;
|
|
570
|
+
playHaptic("selection");
|
|
571
|
+
}
|
|
572
|
+
function clear(motion) {
|
|
573
|
+
for (const timer of motion.timers) clearTimeout(timer);
|
|
574
|
+
motion.timers.length = 0;
|
|
575
|
+
motion.dip?.cancel();
|
|
576
|
+
motion.dip = null;
|
|
577
|
+
if (running === motion) running = null;
|
|
578
|
+
}
|
|
579
|
+
function finish(motion) {
|
|
580
|
+
if (running !== motion) return;
|
|
581
|
+
clear(motion);
|
|
582
|
+
animator.set({ y: -motion.curve.to });
|
|
583
|
+
reportNearest(motion.curve.to);
|
|
584
|
+
motion.onEnd?.("arrived", motion.curve.to);
|
|
585
|
+
}
|
|
586
|
+
/** The motion's ticks and its end, timed from `origin` (when it started on screen). */
|
|
587
|
+
function schedule(motion, origin, ticks) {
|
|
588
|
+
for (const timer of motion.timers) clearTimeout(timer);
|
|
589
|
+
motion.timers.length = 0;
|
|
590
|
+
const elapsed = motionNow() - origin;
|
|
591
|
+
if (ticks) for (const t of tickTimes(motion.curve, layout.rowHeight)) motion.timers.push(setTimeout(() => {
|
|
592
|
+
if (running === motion) tick(motionNow());
|
|
593
|
+
}, Math.max(0, t * 1e3 - elapsed)));
|
|
594
|
+
motion.timers.push(setTimeout(finish, Math.max(0, motion.curve.duration * 1e3 - elapsed), motion));
|
|
595
|
+
}
|
|
596
|
+
function stop(time) {
|
|
597
|
+
const motion = running;
|
|
598
|
+
if (motion == null) return shown();
|
|
599
|
+
const offset = shown(time);
|
|
600
|
+
clear(motion);
|
|
601
|
+
animator.set({ y: -offset });
|
|
602
|
+
reportNearest(offset);
|
|
603
|
+
motion.onEnd?.("stopped", offset);
|
|
604
|
+
return offset;
|
|
605
|
+
}
|
|
606
|
+
function land(to, onEnd) {
|
|
607
|
+
animator.set({ y: -to });
|
|
608
|
+
reportNearest(to);
|
|
609
|
+
onEnd?.("arrived", to);
|
|
610
|
+
}
|
|
611
|
+
return {
|
|
612
|
+
attach(strip) {
|
|
613
|
+
animator.attach(strip);
|
|
614
|
+
},
|
|
615
|
+
setLayout(next) {
|
|
616
|
+
layout = next;
|
|
617
|
+
},
|
|
618
|
+
onNearestChange(listener) {
|
|
619
|
+
nearestListener = listener;
|
|
620
|
+
lastNearest = null;
|
|
621
|
+
},
|
|
622
|
+
isMoving: () => running != null,
|
|
623
|
+
movingKind: () => running?.kind ?? null,
|
|
624
|
+
offset: shown,
|
|
625
|
+
target: () => running?.curve.to ?? shown(),
|
|
626
|
+
setOffset(offset, { ticks = false } = {}) {
|
|
627
|
+
if (running != null) stop();
|
|
628
|
+
if (ticks && dragPrevious != null && canVibrate() && reachesRow(dragPrevious, offset, layout.rowHeight)) tick(motionNow());
|
|
629
|
+
dragPrevious = offset;
|
|
630
|
+
animator.set({ y: -offset }, { promote: ticks });
|
|
631
|
+
reportNearest(offset);
|
|
632
|
+
},
|
|
633
|
+
resetDrag() {
|
|
634
|
+
dragPrevious = null;
|
|
635
|
+
},
|
|
636
|
+
stop,
|
|
637
|
+
play(curve, { kind = "turn", ticks = false, onEnd, touchRelease = false, momentum = false } = {}) {
|
|
638
|
+
stop();
|
|
639
|
+
dragPrevious = null;
|
|
640
|
+
const element = animator.element;
|
|
641
|
+
const fade = momentum ? null : reducedMotionFade(element, { touchRelease });
|
|
642
|
+
if (fade != null && (fade.duration <= 0 || element == null)) {
|
|
643
|
+
land(curve.to, onEnd);
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
if (fade == null && !(curve.duration > 0)) {
|
|
647
|
+
land(curve.to, onEnd);
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
const motion = {
|
|
651
|
+
curve,
|
|
652
|
+
kind,
|
|
653
|
+
onEnd,
|
|
654
|
+
timers: [],
|
|
655
|
+
dip: null
|
|
656
|
+
};
|
|
657
|
+
running = motion;
|
|
658
|
+
if (fade != null && element != null) {
|
|
659
|
+
motion.dip = playReducedMotionDip(element, fade, () => {
|
|
660
|
+
if (running !== motion) return;
|
|
661
|
+
animator.set({ y: -curve.to });
|
|
662
|
+
reportNearest(curve.to);
|
|
663
|
+
motion.timers.push(setTimeout(finish, fade.duration / 2, motion));
|
|
664
|
+
});
|
|
665
|
+
return;
|
|
666
|
+
}
|
|
667
|
+
const motionCurve = {
|
|
668
|
+
duration: curve.duration,
|
|
669
|
+
at: (t) => -curve.value(t),
|
|
670
|
+
velocity: (t) => -curve.velocity(t)
|
|
671
|
+
};
|
|
672
|
+
const handle = momentum ? animator.decay({ y: motionCurve }, { touchRelease }) : animator.play({ y: motionCurve }, { touchRelease });
|
|
673
|
+
const withTicks = ticks && canVibrate();
|
|
674
|
+
schedule(motion, motionNow(), withTicks);
|
|
675
|
+
handle.started.then((start) => {
|
|
676
|
+
if (running === motion) schedule(motion, start, withTicks);
|
|
677
|
+
});
|
|
678
|
+
},
|
|
679
|
+
forgetNearest() {
|
|
680
|
+
lastNearest = null;
|
|
681
|
+
},
|
|
682
|
+
dispose() {
|
|
683
|
+
stop();
|
|
684
|
+
animator.dispose();
|
|
685
|
+
}
|
|
686
|
+
};
|
|
687
|
+
}
|
|
688
|
+
//#endregion
|
|
689
|
+
//#region src/DateInput/useTouchWheel.ts
|
|
690
|
+
const SCALE = scaleFor(28);
|
|
691
|
+
/** A turn a tap, a key or the program starts: the settle spring, as the wheel resolves it. */
|
|
692
|
+
function turnCurve(column, from, to) {
|
|
693
|
+
return bounceCurve(from, 0, to, SCALE, resolveMotion(column, springs.settle));
|
|
694
|
+
}
|
|
695
|
+
const isEnabled = (option) => option != null && !option.disabled;
|
|
696
|
+
function useTouchWheel({ column, strip, options, value, looping, onChange }) {
|
|
697
|
+
const rows = computed(() => toValue(options));
|
|
698
|
+
const loops = computed(() => toValue(looping) === true && rows.value.length > 1);
|
|
699
|
+
const layout = computed(() => ({
|
|
700
|
+
rowHeight: 28,
|
|
701
|
+
rowCount: rows.value.length,
|
|
702
|
+
looping: loops.value
|
|
703
|
+
}));
|
|
704
|
+
const selectedIndex = computed(() => Math.max(0, rows.value.findIndex((option) => option.value === toValue(value))));
|
|
705
|
+
const motion = createWheelStrip(layout.value);
|
|
706
|
+
const marked = ref(selectedIndex.value);
|
|
707
|
+
/** The finger's offset at the pan's start, before any rubber band; null without a drag. */
|
|
708
|
+
let dragStart = null;
|
|
709
|
+
/** A finger landed on a moving wheel and stopped it. */
|
|
710
|
+
let caught = false;
|
|
711
|
+
/** Where the committed row sits on the strip: on a loop, the copy the wheel rests on. */
|
|
712
|
+
let committed = selectedIndex.value;
|
|
713
|
+
/** The positions a looping wheel draws rows at; null for a wheel with ends. */
|
|
714
|
+
const span = shallowRef(null);
|
|
715
|
+
watch([loops, () => rows.value.length], ([on, count]) => {
|
|
716
|
+
span.value = on ? restingSpan(count) : null;
|
|
717
|
+
}, { immediate: true });
|
|
718
|
+
const copies = computed(() => {
|
|
719
|
+
const drawn = span.value;
|
|
720
|
+
const count = rows.value.length;
|
|
721
|
+
const list = [];
|
|
722
|
+
if (drawn == null) return list;
|
|
723
|
+
for (let position = drawn.from; position <= drawn.to; position++) if (position < 0 || position >= count) list.push({
|
|
724
|
+
position,
|
|
725
|
+
option: rows.value[mod(position, count)]
|
|
726
|
+
});
|
|
727
|
+
return list;
|
|
728
|
+
});
|
|
729
|
+
/** The option a position shows: on a loop, a copy shows the row it copies. */
|
|
730
|
+
function optionAt(position) {
|
|
731
|
+
const count = rows.value.length;
|
|
732
|
+
return loops.value && count > 0 ? rows.value[mod(position, count)] : rows.value[position];
|
|
733
|
+
}
|
|
734
|
+
/** The position of row `row` nearest `offset`: on a loop, the copy nearest it. */
|
|
735
|
+
function nearestPosition(row, offset) {
|
|
736
|
+
return loops.value ? nearestLoopCopy(row, offset / 28, rows.value.length) : row;
|
|
737
|
+
}
|
|
738
|
+
/** On a loop, the drawn span grows to cover positions `a` to `b` and the band's surroundings. */
|
|
739
|
+
function cover(a, b) {
|
|
740
|
+
if (span.value != null) span.value = coveringSpan(span.value, a, b);
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* At rest on a copy, the offset moves onto the wheel's own row, where the
|
|
744
|
+
* strip shows the same rows, and the drawn span shrinks back. Returns the
|
|
745
|
+
* offset there.
|
|
746
|
+
*/
|
|
747
|
+
function settle(offset) {
|
|
748
|
+
const count = rows.value.length;
|
|
749
|
+
if (!loops.value) return offset;
|
|
750
|
+
const position = nearestIndex(offset, layout.value);
|
|
751
|
+
const shift = position - mod(position, count);
|
|
752
|
+
if (shift !== 0) {
|
|
753
|
+
motion.setOffset(offset - shift * 28);
|
|
754
|
+
committed -= shift;
|
|
755
|
+
}
|
|
756
|
+
span.value = restingSpan(count);
|
|
757
|
+
return offset - shift * 28;
|
|
758
|
+
}
|
|
759
|
+
function shownOffset() {
|
|
760
|
+
return motion.isMoving() ? motion.stop() : motion.offset();
|
|
761
|
+
}
|
|
762
|
+
motion.onNearestChange((position) => {
|
|
763
|
+
marked.value = position;
|
|
764
|
+
});
|
|
765
|
+
watch(layout, (next) => motion.setLayout(next));
|
|
766
|
+
watch(strip, (element) => motion.attach(element), {
|
|
767
|
+
immediate: true,
|
|
768
|
+
flush: "sync"
|
|
769
|
+
});
|
|
770
|
+
function move(curve, playOptions = {}) {
|
|
771
|
+
marked.value = null;
|
|
772
|
+
motion.forgetNearest();
|
|
773
|
+
motion.play(curve, playOptions);
|
|
774
|
+
}
|
|
775
|
+
function commit(option) {
|
|
776
|
+
if (option != null && !option.disabled && option.value !== toValue(value)) onChange(option.value);
|
|
777
|
+
}
|
|
778
|
+
/** Signed rows from a rest at `position` to the row the rest rule names: 0 to commit where it is. */
|
|
779
|
+
function restStep(position) {
|
|
780
|
+
const count = rows.value.length;
|
|
781
|
+
if (loops.value) {
|
|
782
|
+
const committedCopy = nearestLoopCopy(committed, position, count);
|
|
783
|
+
return position === committedCopy ? 0 : restingLoopStep((at) => isEnabled(optionAt(at)), position, committedCopy, count);
|
|
784
|
+
}
|
|
785
|
+
const committedRow = rows.value.findIndex((option) => option.value === toValue(value));
|
|
786
|
+
return position === committedRow ? 0 : nearestEnabledIndex(rows.value, position, Math.max(0, committedRow)) - position;
|
|
787
|
+
}
|
|
788
|
+
function arrive(offset) {
|
|
789
|
+
const position = nearestIndex(offset, layout.value);
|
|
790
|
+
const step = restStep(position);
|
|
791
|
+
if (step !== 0) {
|
|
792
|
+
cover(position, position + step);
|
|
793
|
+
move(turnCurve(column.value, offset, (position + step) * 28), {
|
|
794
|
+
kind: "release",
|
|
795
|
+
onEnd: onArrive
|
|
796
|
+
});
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
const option = optionAt(position);
|
|
800
|
+
committed = nearestIndex(settle(offset), layout.value);
|
|
801
|
+
commit(option);
|
|
802
|
+
}
|
|
803
|
+
function onArrive(outcome, offset) {
|
|
804
|
+
if (outcome === "arrived") arrive(offset);
|
|
805
|
+
}
|
|
806
|
+
function release(velocity) {
|
|
807
|
+
registerScrollTable();
|
|
808
|
+
const offset = motion.offset();
|
|
809
|
+
const plan = planRelease(offset, velocity, layout.value, resolveMotion(column.value, scroll.bounce));
|
|
810
|
+
cover(nearestIndex(offset, layout.value), plan.index);
|
|
811
|
+
move(plan.curve, {
|
|
812
|
+
kind: "release",
|
|
813
|
+
ticks: true,
|
|
814
|
+
onEnd: onArrive,
|
|
815
|
+
touchRelease: true,
|
|
816
|
+
momentum: plan.kind === "coast" || plan.kind === "edge"
|
|
817
|
+
});
|
|
818
|
+
}
|
|
819
|
+
function turnTo(position) {
|
|
820
|
+
const offset = shownOffset();
|
|
821
|
+
const count = rows.value.length;
|
|
822
|
+
const option = optionAt(position);
|
|
823
|
+
const shift = loops.value ? position - mod(position, count) : 0;
|
|
824
|
+
const from = offset - shift * 28;
|
|
825
|
+
const to = position - shift;
|
|
826
|
+
if (shift !== 0) motion.setOffset(from);
|
|
827
|
+
committed = to;
|
|
828
|
+
cover(nearestIndex(from, layout.value), to);
|
|
829
|
+
move(turnCurve(column.value, from, to * 28));
|
|
830
|
+
commit(option);
|
|
831
|
+
}
|
|
832
|
+
/** Where `key` turns the wheel from the position it is heading to, or null to stay. */
|
|
833
|
+
function keyTarget(key, heading) {
|
|
834
|
+
if (!loops.value) return steppedRow(rows.value, heading, key);
|
|
835
|
+
if ("end" in key) {
|
|
836
|
+
const row = endRow(rows.value, key.end);
|
|
837
|
+
return row == null ? null : lapPosition(row, committed, rows.value.length);
|
|
838
|
+
}
|
|
839
|
+
const travel = loopedStep((at) => isEnabled(optionAt(at)), heading, key.step, rows.value.length);
|
|
840
|
+
return travel == null ? null : heading + travel;
|
|
841
|
+
}
|
|
842
|
+
function onKey(key) {
|
|
843
|
+
const position = keyTarget(key, nearestIndex(motion.target(), layout.value));
|
|
844
|
+
if (position != null) turnTo(position);
|
|
845
|
+
}
|
|
846
|
+
function activateRow(index) {
|
|
847
|
+
const position = loops.value ? lapPosition(index, committed, rows.value.length) : index;
|
|
848
|
+
if (isEnabled(optionAt(position))) turnTo(position);
|
|
849
|
+
}
|
|
850
|
+
let isParked = false;
|
|
851
|
+
watch([selectedIndex, strip], ([index, element]) => {
|
|
852
|
+
if (element == null || dragStart != null || motion.movingKind() === "release") return;
|
|
853
|
+
if (!isParked) {
|
|
854
|
+
isParked = true;
|
|
855
|
+
committed = index;
|
|
856
|
+
motion.setOffset(index * 28);
|
|
857
|
+
return;
|
|
858
|
+
}
|
|
859
|
+
const heading = nearestPosition(index, motion.target());
|
|
860
|
+
if (Math.abs(motion.target() - heading * 28) <= .01) {
|
|
861
|
+
committed = heading;
|
|
862
|
+
return;
|
|
863
|
+
}
|
|
864
|
+
const shown = shownOffset();
|
|
865
|
+
const position = nearestPosition(index, shown);
|
|
866
|
+
committed = position;
|
|
867
|
+
cover(nearestIndex(shown, layout.value), position);
|
|
868
|
+
move(turnCurve(column.value, shown, position * 28), { onEnd: (outcome, end) => {
|
|
869
|
+
if (outcome === "arrived") settle(end);
|
|
870
|
+
} });
|
|
871
|
+
}, {
|
|
872
|
+
immediate: true,
|
|
873
|
+
flush: "post"
|
|
874
|
+
});
|
|
875
|
+
const removeTransition = useGestureRecognizer(column, () => new PanGestureRecognizer({
|
|
876
|
+
name: "wheel-pan",
|
|
877
|
+
direction: "vertical",
|
|
878
|
+
allowedScrollTypes: ["continuous"],
|
|
879
|
+
selectionLock: lockSelection,
|
|
880
|
+
shouldReceiveTouch: (_pan, touch) => {
|
|
881
|
+
caught = motion.isMoving();
|
|
882
|
+
if (caught) motion.stop(touch.time);
|
|
883
|
+
return true;
|
|
884
|
+
}
|
|
885
|
+
}), (recognizer) => {
|
|
886
|
+
switch (recognizer.state) {
|
|
887
|
+
case "began":
|
|
888
|
+
dragStart = fingerOffset(shownOffset(), layout.value);
|
|
889
|
+
motion.resetDrag();
|
|
890
|
+
motion.setOffset(dragOffset(dragStart - recognizer.translation().y, layout.value), { ticks: true });
|
|
891
|
+
break;
|
|
892
|
+
case "changed": {
|
|
893
|
+
if (dragStart == null) break;
|
|
894
|
+
const offset = dragOffset(dragStart - recognizer.translation().y, layout.value);
|
|
895
|
+
const position = nearestIndex(offset, layout.value);
|
|
896
|
+
cover(position, position);
|
|
897
|
+
motion.setOffset(offset, { ticks: true });
|
|
898
|
+
break;
|
|
899
|
+
}
|
|
900
|
+
case "ended": {
|
|
901
|
+
const wasDragging = dragStart != null;
|
|
902
|
+
dragStart = null;
|
|
903
|
+
release(wasDragging ? -recognizer.scrollVelocity().y : 0);
|
|
904
|
+
break;
|
|
905
|
+
}
|
|
906
|
+
case "cancelled":
|
|
907
|
+
dragStart = null;
|
|
908
|
+
release(0);
|
|
909
|
+
}
|
|
910
|
+
}).addTransitionListener((_pan, _from, to) => {
|
|
911
|
+
if (to === "failed" && caught && !motion.isMoving()) release(0);
|
|
912
|
+
});
|
|
913
|
+
useGestureRecognizer(column, () => new TapGestureRecognizer({ name: "wheel-tap" }), (recognizer) => {
|
|
914
|
+
const element = column.value;
|
|
915
|
+
if (recognizer.state !== "ended" || caught || element == null) return;
|
|
916
|
+
const box = element.getBoundingClientRect();
|
|
917
|
+
const offset = motion.offset();
|
|
918
|
+
const target = rowAtPoint(recognizer.location().y - (box.top + box.height / 2), offset, layout.value);
|
|
919
|
+
if (target == null || target === nearestIndex(offset, layout.value)) return;
|
|
920
|
+
cover(nearestIndex(offset, layout.value), target);
|
|
921
|
+
move(turnCurve(element, offset, target * 28), { onEnd: onArrive });
|
|
922
|
+
});
|
|
923
|
+
function onWheel(event) {
|
|
924
|
+
if (event.defaultPrevented || event.ctrlKey || event.shiftKey || event.deltaY === 0 || Math.abs(event.deltaX) > Math.abs(event.deltaY) || scrollTypeOf(event) !== "discrete") return;
|
|
925
|
+
event.preventDefault();
|
|
926
|
+
onKey({ step: Math.sign(event.deltaY) });
|
|
927
|
+
}
|
|
928
|
+
watch(column, (element, _previous, onCleanup) => {
|
|
929
|
+
if (element == null) return;
|
|
930
|
+
element.addEventListener("wheel", onWheel, { passive: false });
|
|
931
|
+
onCleanup(() => element.removeEventListener("wheel", onWheel));
|
|
932
|
+
}, {
|
|
933
|
+
immediate: true,
|
|
934
|
+
flush: "post"
|
|
935
|
+
});
|
|
936
|
+
onScopeDispose(() => {
|
|
937
|
+
removeTransition();
|
|
938
|
+
motion.onNearestChange(null);
|
|
939
|
+
motion.dispose();
|
|
940
|
+
});
|
|
941
|
+
return {
|
|
942
|
+
marked,
|
|
943
|
+
copies,
|
|
944
|
+
selectedIndex,
|
|
945
|
+
onKey,
|
|
946
|
+
activateRow
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
//#endregion
|
|
950
|
+
//#region src/DateInput/TouchPickerWheel.vue
|
|
951
|
+
const _hoisted_1$1 = ["aria-label", "aria-activedescendant"];
|
|
952
|
+
const _hoisted_2$1 = { class: "astryx-picker-wheel-fade" };
|
|
953
|
+
const _hoisted_3 = [
|
|
954
|
+
"id",
|
|
955
|
+
"aria-selected",
|
|
956
|
+
"aria-disabled",
|
|
957
|
+
"data-marked",
|
|
958
|
+
"data-disabled",
|
|
959
|
+
"onClick"
|
|
960
|
+
];
|
|
961
|
+
const _hoisted_4 = {
|
|
962
|
+
key: 0,
|
|
963
|
+
"aria-hidden": "true"
|
|
964
|
+
};
|
|
965
|
+
const _hoisted_5 = ["data-marked", "data-disabled"];
|
|
966
|
+
const _sfc_main$1 = /*@__PURE__*/ defineComponent({
|
|
967
|
+
__name: "TouchPickerWheel",
|
|
968
|
+
props: {
|
|
969
|
+
label: {},
|
|
970
|
+
options: {},
|
|
971
|
+
modelValue: {},
|
|
972
|
+
looping: { type: Boolean }
|
|
973
|
+
},
|
|
974
|
+
emits: ["update:modelValue"],
|
|
975
|
+
setup(__props, { emit: __emit }) {
|
|
976
|
+
/**
|
|
977
|
+
* One UIPickerView column: the picker wheel under a coarse primary pointer.
|
|
978
|
+
* A finger drags the rows, a flick coasts onto the row UIKit's projection
|
|
979
|
+
* picks, a drag past either end rubber-bands, and a tap, a key or a value set
|
|
980
|
+
* from outside turns the wheel on the settle spring. The rows lie flat at a
|
|
981
|
+
* 28 px pitch and fade toward the column's edges. A looping wheel repeats its
|
|
982
|
+
* rows without end; the copies are hidden from assistive technology, which
|
|
983
|
+
* meets each row once.
|
|
984
|
+
*/
|
|
985
|
+
const props = __props;
|
|
986
|
+
const emit = __emit;
|
|
987
|
+
const id = useId();
|
|
988
|
+
const column = useTemplateRef("column");
|
|
989
|
+
const strip = useTemplateRef("strip");
|
|
990
|
+
const wheel = useTouchWheel({
|
|
991
|
+
column,
|
|
992
|
+
strip,
|
|
993
|
+
options: () => props.options,
|
|
994
|
+
value: () => props.modelValue,
|
|
995
|
+
looping: () => props.looping,
|
|
996
|
+
onChange: (value) => emit("update:modelValue", value)
|
|
997
|
+
});
|
|
998
|
+
const { marked, copies, selectedIndex } = wheel;
|
|
999
|
+
function onKeydown(event) {
|
|
1000
|
+
const key = wheelKeyOf(event.key);
|
|
1001
|
+
if (key == null) return;
|
|
1002
|
+
event.preventDefault();
|
|
1003
|
+
wheel.onKey(key);
|
|
1004
|
+
}
|
|
1005
|
+
return (_ctx, _cache) => {
|
|
1006
|
+
return openBlock(), createElementBlock("div", {
|
|
1007
|
+
ref_key: "column",
|
|
1008
|
+
ref: column,
|
|
1009
|
+
class: "astryx-picker-wheel-touch",
|
|
1010
|
+
role: "listbox",
|
|
1011
|
+
tabindex: "0",
|
|
1012
|
+
"data-astryx-owns-pan": "",
|
|
1013
|
+
"aria-label": __props.label,
|
|
1014
|
+
"aria-activedescendant": __props.options[unref(selectedIndex)] ? `${unref(id)}-${unref(selectedIndex)}` : void 0,
|
|
1015
|
+
onKeydown
|
|
1016
|
+
}, [createElementVNode("div", _hoisted_2$1, [_cache[0] || (_cache[0] = createElementVNode("div", {
|
|
1017
|
+
class: "astryx-picker-wheel-band",
|
|
1018
|
+
"aria-hidden": "true"
|
|
1019
|
+
}, null, -1)), createElementVNode("div", {
|
|
1020
|
+
ref_key: "strip",
|
|
1021
|
+
ref: strip,
|
|
1022
|
+
class: "astryx-picker-wheel-strip"
|
|
1023
|
+
}, [
|
|
1024
|
+
createCommentVNode(" eslint-disable-next-line vue-a11y/click-events-have-key-events, vue-a11y/interactive-supports-focus -- 选项不进 Tab 序,焦点留在滚轮上,方向键由滚轮处理;点击来自读屏或鼠标,手指的轻点由点按手势接管。 "),
|
|
1025
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option, index) => {
|
|
1026
|
+
return openBlock(), createElementBlock("div", {
|
|
1027
|
+
id: `${unref(id)}-${index}`,
|
|
1028
|
+
key: option.value,
|
|
1029
|
+
class: "astryx-picker-wheel-row",
|
|
1030
|
+
role: "option",
|
|
1031
|
+
"aria-selected": option.value === __props.modelValue,
|
|
1032
|
+
"aria-disabled": option.disabled || void 0,
|
|
1033
|
+
"data-marked": index === unref(marked) || void 0,
|
|
1034
|
+
"data-disabled": option.disabled || void 0,
|
|
1035
|
+
style: normalizeStyle({ insetBlockStart: `${index * unref(28)}px` }),
|
|
1036
|
+
onClick: ($event) => unref(wheel).activateRow(index)
|
|
1037
|
+
}, toDisplayString(option.label), 13, _hoisted_3);
|
|
1038
|
+
}), 128)),
|
|
1039
|
+
unref(copies).length > 0 ? (openBlock(), createElementBlock("div", _hoisted_4, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(copies), (copy) => {
|
|
1040
|
+
return openBlock(), createElementBlock("div", {
|
|
1041
|
+
key: copy.position,
|
|
1042
|
+
class: "astryx-picker-wheel-row",
|
|
1043
|
+
"data-marked": copy.position === unref(marked) || void 0,
|
|
1044
|
+
"data-disabled": copy.option.disabled || void 0,
|
|
1045
|
+
style: normalizeStyle({ insetBlockStart: `${copy.position * unref(28)}px` })
|
|
1046
|
+
}, toDisplayString(copy.option.label), 13, _hoisted_5);
|
|
1047
|
+
}), 128))])) : createCommentVNode("v-if", true)
|
|
1048
|
+
], 512)])], 40, _hoisted_1$1);
|
|
1049
|
+
};
|
|
1050
|
+
}
|
|
1051
|
+
});
|
|
1052
|
+
//#endregion
|
|
1053
|
+
//#region src/DateInput/PickerWheel.vue
|
|
1054
|
+
const _hoisted_1 = ["aria-label", "aria-activedescendant"];
|
|
1055
|
+
const _hoisted_2 = [
|
|
1056
|
+
"id",
|
|
1057
|
+
"aria-selected",
|
|
1058
|
+
"aria-disabled",
|
|
1059
|
+
"disabled",
|
|
1060
|
+
"onClick"
|
|
1061
|
+
];
|
|
1062
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
1063
|
+
__name: "PickerWheel",
|
|
1064
|
+
props: {
|
|
1065
|
+
label: {},
|
|
1066
|
+
options: {},
|
|
1067
|
+
modelValue: {},
|
|
1068
|
+
looping: { type: Boolean }
|
|
1069
|
+
},
|
|
1070
|
+
emits: ["update:modelValue"],
|
|
1071
|
+
setup(__props, { emit: __emit }) {
|
|
1072
|
+
const props = __props;
|
|
1073
|
+
const emit = __emit;
|
|
1074
|
+
/** 主指针是手指时换成 UIPickerView 的滚轮;鼠标下保留可滚动的列。 */
|
|
1075
|
+
const coarse = useMediaQuery("(pointer: coarse)");
|
|
1076
|
+
function choose(value, disabled) {
|
|
1077
|
+
if (!disabled) emit("update:modelValue", value);
|
|
1078
|
+
}
|
|
1079
|
+
/**
|
|
1080
|
+
* 滚轮是 listbox:方向键走一行,Page 键走十行,Home / End 到头。
|
|
1081
|
+
* 只在可选的行之间走,走到头就停在头上,不绕回另一头。
|
|
1082
|
+
*/
|
|
1083
|
+
function onKeydown(event) {
|
|
1084
|
+
const key = wheelKeyOf(event.key);
|
|
1085
|
+
if (key == null) return;
|
|
1086
|
+
event.preventDefault();
|
|
1087
|
+
const from = props.options.findIndex((option) => option.value === props.modelValue);
|
|
1088
|
+
const row = steppedRow(props.options, from, key);
|
|
1089
|
+
const option = row == null ? void 0 : props.options[row];
|
|
1090
|
+
if (option && option.value !== props.modelValue) emit("update:modelValue", option.value);
|
|
1091
|
+
}
|
|
1092
|
+
return (_ctx, _cache) => {
|
|
1093
|
+
return unref(coarse) ? (openBlock(), createBlock(_sfc_main$1, {
|
|
1094
|
+
key: 0,
|
|
1095
|
+
label: __props.label,
|
|
1096
|
+
options: __props.options,
|
|
1097
|
+
"model-value": __props.modelValue,
|
|
1098
|
+
looping: __props.looping,
|
|
1099
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event))
|
|
1100
|
+
}, null, 8, [
|
|
1101
|
+
"label",
|
|
1102
|
+
"options",
|
|
1103
|
+
"model-value",
|
|
1104
|
+
"looping"
|
|
1105
|
+
])) : (openBlock(), createElementBlock("div", {
|
|
1106
|
+
key: 1,
|
|
1107
|
+
class: "astryx-picker-wheel",
|
|
1108
|
+
role: "listbox",
|
|
1109
|
+
tabindex: "0",
|
|
1110
|
+
"aria-label": __props.label,
|
|
1111
|
+
"aria-activedescendant": __props.modelValue ? `${__props.label}-${__props.modelValue}` : void 0,
|
|
1112
|
+
onKeydown
|
|
1113
|
+
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option) => {
|
|
1114
|
+
return openBlock(), createElementBlock("button", {
|
|
1115
|
+
id: `${__props.label}-${option.value}`,
|
|
1116
|
+
key: option.value,
|
|
1117
|
+
type: "button",
|
|
1118
|
+
class: "astryx-picker-wheel-option",
|
|
1119
|
+
role: "option",
|
|
1120
|
+
"aria-selected": option.value === __props.modelValue,
|
|
1121
|
+
"aria-disabled": option.disabled || void 0,
|
|
1122
|
+
disabled: option.disabled,
|
|
1123
|
+
tabindex: "-1",
|
|
1124
|
+
onClick: ($event) => choose(option.value, option.disabled)
|
|
1125
|
+
}, toDisplayString(option.label), 9, _hoisted_2);
|
|
1126
|
+
}), 128))], 40, _hoisted_1));
|
|
1127
|
+
};
|
|
1128
|
+
}
|
|
1129
|
+
});
|
|
1130
|
+
//#endregion
|
|
1131
|
+
export { _sfc_main as t };
|