@astryx-vue/core 0.41.1 → 0.42.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-DxrO48Kg.js → AlertDialog-Cld8wc2u.js} +3 -3
- package/dist/AvatarGroup/index.d.ts +1 -1
- package/dist/AvatarGroup/index.js +1 -1
- package/dist/{AvatarGroup-BZ5iG7M-.js → AvatarGroup-CU1zqtTi.js} +1 -1
- package/dist/Banner/index.d.ts +1 -1
- package/dist/Banner/index.js +1 -1
- package/dist/{Banner-0YtnbBU6.js → Banner-5KOS4fe8.js} +1 -1
- package/dist/BottomSheet/index.d.ts +1 -1
- package/dist/Breadcrumbs/index.d.ts +2 -2
- package/dist/Breadcrumbs/index.js +2 -2
- package/dist/{Breadcrumbs-9KMHiyXr.js → Breadcrumbs-aups8a9Y.js} +1 -1
- package/dist/Button/index.d.ts +1 -1
- package/dist/Button/index.js +1 -1
- package/dist/{Button-ClyetTf6.js → Button-tVILPfaj.js} +2 -2
- package/dist/ButtonGroup/index.d.ts +1 -1
- package/dist/ButtonGroup/index.js +1 -1
- package/dist/{ButtonGroup-tk0H2O8q.js → ButtonGroup-D7p8oEry.js} +2 -2
- package/dist/Calendar/index.d.ts +1 -1
- package/dist/Calendar/index.js +2 -2
- package/dist/{Calendar-CfhOlgQJ.js → Calendar-Brz2iDeZ.js} +1 -1
- package/dist/{Calendar-DbAQvHgy.js → Calendar-C1E1ZiaS.js} +1 -1
- package/dist/Carousel/index.d.ts +1 -1
- package/dist/Carousel/index.js +1 -1
- package/dist/{Carousel-utfvjW5p.js → Carousel-DlHeba5J.js} +1 -1
- package/dist/Center/index.d.ts +1 -1
- package/dist/Chat/index.d.ts +1 -1
- package/dist/Chat/index.js +1 -1
- package/dist/{Chat-DL583Xle.js → Chat-B54dCjhV.js} +3 -3
- package/dist/CheckboxInput/index.d.ts +1 -1
- package/dist/CheckboxInput/index.js +1 -1
- package/dist/{CheckboxInput-BQH87pfn.js → CheckboxInput-BhKf3JOh.js} +4 -4
- package/dist/CheckboxList/index.d.ts +1 -1
- package/dist/CheckboxList/index.js +1 -1
- package/dist/{CheckboxListItem-BL7gDglY.js → CheckboxListItem-BhLPvY5v.js} +4 -4
- package/dist/ClickableCard/index.d.ts +1 -1
- package/dist/ClickableCard/index.js +1 -1
- package/dist/{ClickableCard-CdByvXDr.js → ClickableCard-DyBa2X4I.js} +1 -1
- package/dist/Code/index.js +2 -2
- package/dist/{Code-KvqZ1ZES.js → Code-BtJV5J-h.js} +1 -1
- package/dist/{CodeBlock-e2rlXQWO.js → CodeBlock-D1i3lEK3.js} +1 -1
- package/dist/Collapsible/index.js +1 -1
- package/dist/{Collapsible-CTc7irlw.js → Collapsible-CXbcOn80.js} +1 -1
- package/dist/CommandPalette/index.js +1 -1
- package/dist/{CommandPalette-PBYSDIpx.js → CommandPalette-DyjB9xE_.js} +1 -1
- package/dist/ComplexSelector/index.js +1 -1
- package/dist/{ComplexSelector-CPg5jcdL.js → ComplexSelector-MRuOupEd.js} +2 -2
- package/dist/ContextMenu/index.d.ts +2 -2
- package/dist/ContextMenu/index.js +2 -2
- package/dist/{ContextMenu-DcZEviKv.js → ContextMenu-Bb8ALZmI.js} +1 -1
- package/dist/DateInput/index.d.ts +1 -1
- package/dist/DateInput/index.js +1 -1
- package/dist/{DateInput-C4qtEFDW.js → DateInput-DNWMgvU1.js} +579 -78
- package/dist/DateRangeInput/index.d.ts +1 -1
- package/dist/DateRangeInput/index.js +1 -1
- package/dist/{DateRangeInput-CGqCQAlT.js → DateRangeInput-B8ZWK6sm.js} +4 -4
- package/dist/DateTimeInput/index.d.ts +1 -1
- package/dist/DateTimeInput/index.js +1 -1
- package/dist/{DateTimeInput-CAirxttc.js → DateTimeInput--BzV0yww.js} +4 -4
- package/dist/Dialog/index.d.ts +1 -1
- package/dist/Dialog/index.js +1 -1
- package/dist/{DialogHeader-BS8mjD8z.js → DialogHeader-B4cnOihd.js} +1 -1
- package/dist/Drawer/index.d.ts +1 -1
- package/dist/Drawer/index.js +1 -1
- package/dist/{Drawer-Cq1Y_1iJ.js → Drawer-dk9etcN3.js} +1 -1
- package/dist/DropdownMenu/index.d.ts +2 -2
- package/dist/DropdownMenu/index.js +2 -2
- package/dist/{DropdownMenu-CSn1OQ2D.js → DropdownMenu-DUGWNcnG.js} +3 -3
- package/dist/{DropdownMenuRadioItem.vue-BFCbIBfb.d.ts → DropdownMenuRadioItem.vue-BrcSzOfA.d.ts} +1 -1
- package/dist/Field/index.js +3 -3
- package/dist/{Field-BzGwGqwa.js → Field-B_GThk2X.js} +1 -1
- package/dist/{FieldInfoTip-DqsdZxo0.js → FieldInfoTip-jhm02XZs.js} +1 -1
- package/dist/{FieldLabel-DdMLaCP_.js → FieldLabel-C0XDwWCd.js} +1 -1
- package/dist/FileInput/index.js +1 -1
- package/dist/{FileInput-B_BXknEU.js → FileInput-CbXrw3RO.js} +3 -3
- package/dist/{geometry-ae8bOxQ5.js → GestureHost-DXCQkur5.js} +1 -28
- package/dist/HoverCard/index.d.ts +1 -1
- package/dist/IconButton/index.js +1 -1
- package/dist/{IconButton-kj1M_L7a.js → IconButton-CU1kvO7X.js} +1 -1
- package/dist/InfoTip/index.d.ts +1 -1
- package/dist/InfoTip/index.js +1 -1
- package/dist/{InfoTip-DJIb8b29.js → InfoTip-BwxUx7Hk.js} +1 -1
- package/dist/{InputClearButton-wd0VoZja.js → InputClearButton-CN8J7JOl.js} +1 -1
- package/dist/InputGroup/index.d.ts +1 -1
- package/dist/InputGroup/index.js +1 -1
- package/dist/{InputGroup-DGiF9Xaz.js → InputGroup-Ca-SOzyp.js} +1 -1
- package/dist/InternationalizationProvider/index.d.ts +1 -1
- package/dist/InternationalizationProvider/index.js +2 -1
- package/dist/{InternationalizationProvider-C37KH-mM.js → InternationalizationProvider-CfP0uroW.js} +5 -61
- package/dist/Item-D8Ads8bS.js +1476 -0
- package/dist/Lightbox/index.js +1 -1
- package/dist/{Lightbox-Fu6RCX0k.js → Lightbox-CkxNUYwN.js} +7 -6
- package/dist/Link/index.d.ts +1 -1
- package/dist/Link/index.js +1 -1
- package/dist/{Link-zPVCNAM6.js → Link-B5CJso43.js} +1 -1
- package/dist/List/index.d.ts +3 -2
- package/dist/List/index.js +4 -4
- package/dist/{List-D4w6clf-.js → List-KQNWaT-8.js} +2 -2
- package/dist/{ListItem-uvJaYGOJ.js → ListItem-C4BtWXV4.js} +8 -3
- package/dist/Markdown/index.d.ts +1 -1
- package/dist/Markdown/index.js +1 -1
- package/dist/{Markdown-BiXz75mz.js → Markdown-BFV7g8oa.js} +118 -59
- package/dist/MoreMenu/index.d.ts +1 -1
- package/dist/MoreMenu/index.js +1 -1
- package/dist/{MoreMenu-CgT9SajI.js → MoreMenu-D0HoYZU0.js} +2 -2
- package/dist/MultiSelector/index.d.ts +1 -1
- package/dist/MultiSelector/index.js +1 -1
- package/dist/{MultiSelector-CaL3UDIc.js → MultiSelector-BLESAk-K.js} +3 -3
- package/dist/NavItem/index.d.ts +1 -1
- package/dist/NavItem/index.js +1 -1
- package/dist/{NavItem-D_1ecPv_.js → NavItem-BR639emm.js} +1 -1
- package/dist/NavMenu/index.js +1 -1
- package/dist/{NavMenuItem-DqBCA1VP.js → NavMenuItem-C9e62bSc.js} +1 -1
- package/dist/NumberInput/index.d.ts +1 -1
- package/dist/NumberInput/index.js +1 -1
- package/dist/{NumberInput-0lTA5weY.js → NumberInput-C7cRBlQm.js} +3 -3
- package/dist/Outline/index.js +1 -1
- package/dist/{Outline-BoxN40Bd.js → Outline-BcZMmO9Y.js} +1 -1
- package/dist/OverflowList/index.d.ts +1 -1
- package/dist/OverflowList/index.js +1 -1
- package/dist/{OverflowList-7oui4oT5.js → OverflowList-cjl0AaEP.js} +1 -1
- package/dist/Pagination/index.d.ts +1 -1
- package/dist/Pagination/index.js +1 -1
- package/dist/{Pagination-BrkX0lga.js → Pagination-BnA277o8.js} +2 -2
- package/dist/{PanGestureRecognizer-BFSO5U4N.js → PanGestureRecognizer-KxZE-pUT.js} +2 -1
- package/dist/{PickerWheel-CWT7l-9Q.js → PickerWheel-YgYMcbJF.js} +4 -4
- package/dist/Popover/index.d.ts +1 -1
- package/dist/Popover/index.js +1 -1
- package/dist/{Popover-BZ4VWDtv.js → Popover-DfO-mkcm.js} +1 -1
- package/dist/PowerSearch/index.d.ts +1 -1
- package/dist/PowerSearch/index.js +1 -1
- package/dist/{PowerSearch-BSoQJbHK.js → PowerSearch-BjAYndzP.js} +20 -20
- package/dist/{PressTracker-DDRxFc0Y.js → PressTracker-C8_fTdjp.js} +1 -1
- package/dist/ProgressBar/index.d.ts +1 -1
- package/dist/Radio/index.d.ts +1 -1
- package/dist/Radio/index.js +1 -1
- package/dist/{RadioGroup-CrRm7H51.js → RadioGroup-CVOlUPbf.js} +4 -4
- package/dist/RadioList/index.d.ts +1 -1
- package/dist/RadioList/index.js +1 -1
- package/dist/{RadioListItem-iPD3y2Eo.js → RadioListItem-5y613Xrt.js} +1 -1
- package/dist/ScrollableArea/index.d.ts +1 -1
- package/dist/SegmentedControl/index.js +1 -1
- package/dist/{SegmentedControl-D8A_jaFC.js → SegmentedControl-D32lkJFq.js} +6 -6
- package/dist/SelectableCard/index.d.ts +1 -1
- package/dist/SelectableCard/index.js +1 -1
- package/dist/{SelectableCard-DIruuGBa.js → SelectableCard-C2hl7HBW.js} +1 -1
- package/dist/Selector/index.d.ts +1 -1
- package/dist/Selector/index.js +1 -1
- package/dist/{Selector-CFdM10Uc.js → Selector-Dw_0e0zY.js} +1 -1
- package/dist/SideNav/index.d.ts +1 -1
- package/dist/SideNav/index.js +1 -1
- package/dist/{SideNav-Cl1H-baW.js → SideNav-dsff7R2R.js} +2 -2
- package/dist/Slider/index.js +1 -1
- package/dist/{Slider-Bd3wpFo7.js → Slider-CUgeJ1z4.js} +6 -6
- package/dist/Stack/index.d.ts +1 -1
- package/dist/Stepper/index.js +1 -1
- package/dist/{Stepper-CZU_Zvi5.js → Stepper-BYZasZK7.js} +1 -1
- package/dist/Swipe/index.d.ts +3 -0
- package/dist/Swipe/index.js +2 -0
- package/dist/Switch/index.d.ts +1 -1
- package/dist/Switch/index.js +1 -1
- package/dist/{Switch-BpkKyz98.js → Switch-BtcR2oin.js} +6 -6
- package/dist/TabList/index.js +1 -1
- package/dist/{TabList-DZ2i0QIt.js → TabList-O34fxJlZ.js} +1 -1
- package/dist/Table/index.d.ts +1 -1
- package/dist/Table/index.js +1 -1
- package/dist/{Table-fSipO9Ju.js → Table-BrvIqSdi.js} +11 -11
- package/dist/{TapGestureRecognizer-DCiP88h8.js → TapGestureRecognizer-o0LVjFFm.js} +3 -2
- package/dist/TextArea/index.d.ts +1 -1
- package/dist/TextArea/index.js +1 -1
- package/dist/{TextArea-D5aDDlgr.js → TextArea-TO_A1D_W.js} +4 -4
- package/dist/TextInput/index.d.ts +1 -1
- package/dist/TextInput/index.js +1 -1
- package/dist/{TextInput-CVRWRtoL.js → TextInput-jIBboBDS.js} +4 -4
- package/dist/Thumbnail/index.js +1 -1
- package/dist/{Thumbnail-zFN5p6dk.js → Thumbnail-CRltyNsq.js} +2 -2
- package/dist/{TimeField-B49DgkyR.js → TimeField-DBKAGPKU.js} +2 -2
- package/dist/TimeInput/index.d.ts +1 -1
- package/dist/TimeInput/index.js +1 -1
- package/dist/{TimeInput-BoFij92p.js → TimeInput-CEUlNlhY.js} +2 -2
- package/dist/Timestamp/index.d.ts +1 -1
- package/dist/Timestamp/index.js +1 -1
- package/dist/{Timestamp-DunFvQYG.js → Timestamp-s4Nksy5i.js} +1 -1
- package/dist/Toast/index.js +1 -1
- package/dist/{Toast-BnIq3gzw.js → Toast-BsW7tvzK.js} +3 -3
- package/dist/ToggleButton/index.d.ts +1 -1
- package/dist/ToggleButton/index.js +1 -1
- package/dist/{ToggleButton-CLgj6yLQ.js → ToggleButton-DZgHhJd7.js} +3 -3
- package/dist/Token/index.d.ts +1 -1
- package/dist/Token/index.js +1 -1
- package/dist/{Token-BPjnWrHl.js → Token-B6mV8hyk.js} +1 -1
- package/dist/Tokenizer/index.d.ts +1 -1
- package/dist/Tokenizer/index.js +1 -1
- package/dist/{Tokenizer-CMv-Bi0y.js → Tokenizer-BvCiuyhk.js} +5 -5
- package/dist/Toolbar/index.d.ts +1 -1
- package/dist/Tooltip/index.d.ts +1 -1
- package/dist/TopNav/index.d.ts +1 -1
- package/dist/TopNav/index.js +1 -1
- package/dist/{TopNav-DUkn4CMv.js → TopNav-xKD14HTR.js} +2 -2
- package/dist/TreeList/index.js +1 -1
- package/dist/{TreeList-o5MrA7rz.js → TreeList-BOr0GpJC.js} +1 -1
- package/dist/Typeahead/index.js +1 -1
- package/dist/{Typeahead-DXlsxjkQ.js → Typeahead-C18-lx2P.js} +3 -3
- package/dist/{accessibleName-9UI6HUaA.js → accessibleName-Br2Ex6ub.js} +1 -1
- package/dist/{boxHold-DfsWCZLh.js → boxHold-BCbXt9_d.js} +1 -1
- package/dist/{chat-BUFYB3bA.js → chat-DPxoTm_S.js} +2 -0
- package/dist/composables/index.js +5 -4
- package/dist/{composables-Dzpv7G2Z.js → composables-BTTLiP-q.js} +6 -476
- package/dist/context-BNCjTOCB.js +60 -0
- package/dist/createSwipe-DXObfkyb.js +77 -0
- package/dist/geometry-BDCUnbgh.js +28 -0
- package/dist/{index-ZKBj_1nu.d.ts → index-3LdpzxQZ.d.ts} +2 -2
- package/dist/{index-DYabo8TI.d.ts → index-B44fLswd.d.ts} +2 -2
- package/dist/{index-C2dLjYoW.d.ts → index-B8XkUCzI.d.ts} +1 -1
- package/dist/{index-0RIgvtdm.d.ts → index-CArP_6wv.d.ts} +1 -1
- package/dist/{index-CbA8rR_b.d.ts → index-CBOv5j3c.d.ts} +1 -1
- package/dist/{index-COgrQZIL.d.ts → index-CdvmnNMH.d.ts} +1 -1
- package/dist/{index-uWIhWgDN.d.ts → index-ChHpLHhd.d.ts} +48 -47
- package/dist/{index-BB9acgK8.d.ts → index-D7ShT2c-.d.ts} +2 -2
- package/dist/{index-BItxjc3w.d.ts → index-DOqxWQJp.d.ts} +1 -1
- package/dist/index-DPsvfn2V.d.ts +25 -0
- package/dist/{index-DofC9Rll.d.ts → index-Dk50Zh3F.d.ts} +2 -2
- package/dist/{index-BDJQW9cW.d.ts → index-DwUUuRyC.d.ts} +54 -1
- package/dist/{index-CJT9kM7e.d.ts → index-HzXA230A.d.ts} +2 -2
- package/dist/{index-DgNCHxvu.d.ts → index-J83fLEyo.d.ts} +2 -2
- package/dist/{index-CuW4AQ7M.d.ts → index-MOtVbTwK.d.ts} +2 -2
- package/dist/{index-YP5WRwXH.d.ts → index-MiZ3p4b6.d.ts} +6 -6
- package/dist/{index-COqeB2ug.d.ts → index-Nln6FiRr.d.ts} +1 -1
- package/dist/{index-4_uuTfaY.d.ts → index-VWHtgjGh.d.ts} +1 -1
- package/dist/{index-LYiWcVDD.d.ts → index-WqOwd8r8.d.ts} +3 -3
- package/dist/{index-BKnyTWPM.d.ts → index-ZbNwGVkS.d.ts} +1 -1
- package/dist/{index-CCa_dvoF.d.ts → index-m-fFGq2e.d.ts} +2 -2
- package/dist/{index-BenG-F5d.d.ts → index-maTGrWjF.d.ts} +1 -1
- package/dist/{index-BFPb14Xj.d.ts → index-zjungCKE.d.ts} +6 -6
- package/dist/index.d.ts +29 -27
- package/dist/index.js +87 -83
- package/dist/itemSlots-DA-FyuMF.js +539 -0
- package/dist/{loadCatalog-DfwwR4ox.d.ts → loadCatalog-Cm394Q3F.d.ts} +2 -0
- package/dist/{loadCatalog-Dvlsgn71.js → loadCatalog-DXx3soG1.js} +2 -1
- package/dist/locale/index.d.ts +2 -2
- package/dist/locale/index.js +3 -3
- package/dist/{locale-BgXR3tSm.js → locale-5NXEHp0U.js} +1 -1
- package/dist/{pressSlot-5Bp-B175.js → pressSlot-31XyOhUS.js} +20 -2
- package/dist/scrollAnchoring-CNplZXRt.js +60 -0
- package/dist/{snapPagingCatcher-RkUaZdWD.js → snapPagingCatcher-BA7qwhj3.js} +3 -2
- package/dist/swipeHost-B2OlVVZt.d.ts +73 -0
- package/dist/{types-D9mwL8sz.d.ts → types-wKC-Ws-M.d.ts} +29 -10
- package/dist/{useActionGroupTracking-Cujjrmt3.js → useActionGroupTracking-CioHSqgG.js} +2 -2
- package/dist/{useCalendarGrid-0WvxbeFC.js → useCalendarGrid-BpBA8UZa.js} +1 -1
- package/dist/{useChatStreamScroll-BQpGHGAr.js → useChatStreamScroll-CGHtw12w.js} +1 -59
- package/dist/{useGestureRecognizer-CtfxP4uw.js → useGestureRecognizer-BSy0RhLT.js} +1 -1
- package/dist/{useInputStatusIcon-2sRn-Nbf.js → useInputStatusIcon-D0xNp9jO.js} +1 -1
- package/dist/{usePressFeedback-Ber7MRiI.js → usePressFeedback-D4oohqP5.js} +1 -1
- package/dist/{useTouchHitArea-B6g7fhfF.js → useTouchHitArea-rwyNMxFb.js} +1 -1
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js +3 -2
- package/dist/utils-DkwunocO.js +348 -0
- package/package.json +5 -1
- package/styles/date-input.css +36 -0
- package/styles/list.css +125 -69
- package/styles/markdown.css +17 -0
- package/dist/Item-DC1v56yE.js +0 -723
- package/dist/itemSlots-BxUu7hje.js +0 -54
- package/dist/utils-BW62BpDR.js +0 -135
- package/dist/{index-D8lv2BiD.d.ts → index-J6YRJ7Ul.d.ts} +1 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { a as subscribeInput } from "./inputStream-DmPkJ1aU.js";
|
|
2
|
-
import { n as useTouchHitArea } from "./useTouchHitArea-
|
|
2
|
+
import { n as useTouchHitArea } from "./useTouchHitArea-rwyNMxFb.js";
|
|
3
3
|
import { f as toSpring, u as durationBounceOf } from "./roles-D6hLs7Rg.js";
|
|
4
|
-
import { c as solveSpring } from "./linearEasing-CDsqxyiS.js";
|
|
5
4
|
import { d as scroll, r as UIKIT_GESTURES } from "./gestures-D_ih8YYG.js";
|
|
6
5
|
import { r as useResolvedLayerTeleport } from "./useLayerMountTarget-zwZQglr2.js";
|
|
7
6
|
import { o as pushLayer } from "./layerDepth-D576XVps.js";
|
|
@@ -13,16 +12,15 @@ import { n as isDevBuild } from "./devBuild-G249YcdZ.js";
|
|
|
13
12
|
import { t as devWarn } from "./useDevWarning-B2fsk2B-.js";
|
|
14
13
|
import { t as resolveMotion } from "./resolveMotion-BHR1cz0Q.js";
|
|
15
14
|
import { n as solveDecay } from "./decay-CUtQFEXK.js";
|
|
16
|
-
import { a as coast, i as LongPressGestureRecognizer, n as paging, t as SettleCatcher } from "./snapPagingCatcher-
|
|
15
|
+
import { a as coast, i as LongPressGestureRecognizer, n as paging, t as SettleCatcher } from "./snapPagingCatcher-BA7qwhj3.js";
|
|
17
16
|
import { o as registerSpringsTable, s as springs } from "./springs-B5hVbZta.js";
|
|
18
|
-
import {
|
|
19
|
-
import { t as PanGestureRecognizer } from "./PanGestureRecognizer-
|
|
17
|
+
import { t as getGestureHost } from "./GestureHost-DXCQkur5.js";
|
|
18
|
+
import { t as PanGestureRecognizer } from "./PanGestureRecognizer-KxZE-pUT.js";
|
|
20
19
|
import { i as locksSelectionFor, n as lockSelection } from "./selectionLock-BM8XEZQD.js";
|
|
21
20
|
import { t as VelocityTracker } from "./VelocityTracker-D5wT6A0d.js";
|
|
22
|
-
import {
|
|
21
|
+
import { f as createPanGesture, l as useListContext, r as useItemLabelId, u as createSnapDrag } from "./itemSlots-DA-FyuMF.js";
|
|
23
22
|
import { o as useComponentMessages } from "./context-B8IEFCDR.js";
|
|
24
23
|
import { n as listMessages, t as keyboardHintMessages } from "./keyboard-hint-DZrL82bU.js";
|
|
25
|
-
import { l as useListContext, r as useItemLabelId } from "./itemSlots-BxUu7hje.js";
|
|
26
24
|
import { t as useAnnounce } from "./announce-GU01Oix2.js";
|
|
27
25
|
import { t as _sfc_main$5 } from "./Kbd-CbD993ig.js";
|
|
28
26
|
import { n as paintedBackground, t as inertClone } from "./inertClone-BUK-k6-n.js";
|
|
@@ -210,474 +208,6 @@ function createAnimator(element) {
|
|
|
210
208
|
return animator;
|
|
211
209
|
}
|
|
212
210
|
//#endregion
|
|
213
|
-
//#region src/gestures/createPanGesture.ts
|
|
214
|
-
const ZERO = {
|
|
215
|
-
x: 0,
|
|
216
|
-
y: 0
|
|
217
|
-
};
|
|
218
|
-
/** Report drags on `element` as values, with the recognizer's options. */
|
|
219
|
-
function createPan(element, options) {
|
|
220
|
-
const { axis, onPan } = options;
|
|
221
|
-
const recognizer = new PanGestureRecognizer({
|
|
222
|
-
name: "pan",
|
|
223
|
-
...options.recognizer,
|
|
224
|
-
direction: axis === "x" ? "horizontal" : axis === "y" ? "vertical" : "any"
|
|
225
|
-
});
|
|
226
|
-
const along = (point) => axis === "x" ? {
|
|
227
|
-
x: point.x,
|
|
228
|
-
y: 0
|
|
229
|
-
} : axis === "y" ? {
|
|
230
|
-
x: 0,
|
|
231
|
-
y: point.y
|
|
232
|
-
} : {
|
|
233
|
-
x: point.x,
|
|
234
|
-
y: point.y
|
|
235
|
-
};
|
|
236
|
-
let input = "touch";
|
|
237
|
-
recognizer.addListener(() => {
|
|
238
|
-
const state = recognizer.state;
|
|
239
|
-
if (state !== "began" && state !== "changed" && state !== "ended" && state !== "cancelled") return;
|
|
240
|
-
if (state === "began") {
|
|
241
|
-
const touch = recognizer.trackedTouches[0];
|
|
242
|
-
input = touch == null ? "touch" : touch.scrollType != null ? "scroll" : touch.pointerType;
|
|
243
|
-
}
|
|
244
|
-
onPan({
|
|
245
|
-
state,
|
|
246
|
-
translation: along(recognizer.translation()),
|
|
247
|
-
totalTranslation: along(recognizer.totalTranslation()),
|
|
248
|
-
velocity: state === "cancelled" ? { ...ZERO } : along(recognizer.velocity()),
|
|
249
|
-
input
|
|
250
|
-
});
|
|
251
|
-
});
|
|
252
|
-
let detach = getGestureHost(element.ownerDocument).attach(element, recognizer);
|
|
253
|
-
return { destroy() {
|
|
254
|
-
const current = detach;
|
|
255
|
-
detach = null;
|
|
256
|
-
current?.();
|
|
257
|
-
} };
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Report drags on `element` as values. The drag claims its touch at UIKit's
|
|
261
|
-
* 10 pt, as `UIPanGestureRecognizer` does, so a tap stays a tap. The pan sets
|
|
262
|
-
* the element's `touch-action` for the axis.
|
|
263
|
-
* @example
|
|
264
|
-
* ```ts
|
|
265
|
-
* const pan = createPanGesture(card, {
|
|
266
|
-
* axis: 'x',
|
|
267
|
-
* onPan: ({ state, translation }) => {
|
|
268
|
-
* card.style.translate = state === 'changed' ? `${translation.x}px` : ''
|
|
269
|
-
* },
|
|
270
|
-
* })
|
|
271
|
-
* // Later:
|
|
272
|
-
* pan.destroy()
|
|
273
|
-
* ```
|
|
274
|
-
*/
|
|
275
|
-
function createPanGesture(element, options) {
|
|
276
|
-
const { axis, onPan } = options;
|
|
277
|
-
return createPan(element, {
|
|
278
|
-
axis,
|
|
279
|
-
onPan: ({ state, translation, velocity }) => {
|
|
280
|
-
onPan({
|
|
281
|
-
state,
|
|
282
|
-
translation,
|
|
283
|
-
velocity
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
//#endregion
|
|
289
|
-
//#region src/dragToSnapPoints/compositorSettle.ts
|
|
290
|
-
/** Keyframes per second: twice a 60 Hz display's frame rate. */
|
|
291
|
-
const SAMPLE_HZ = 120;
|
|
292
|
-
/** The longest a settle plays (ms). */
|
|
293
|
-
const MAX_MS = 3e3;
|
|
294
|
-
/** The keyframe times (ms): a fixed grid, plus each time the curve crosses a bend. */
|
|
295
|
-
function keyframeTimes(valueAt, durationMs, bends) {
|
|
296
|
-
const steps = Math.ceil(durationMs / 1e3 * SAMPLE_HZ);
|
|
297
|
-
const grid = [];
|
|
298
|
-
for (let step = 0; step <= steps; step += 1) grid.push(Math.min(durationMs, step / SAMPLE_HZ * 1e3));
|
|
299
|
-
const times = [...grid];
|
|
300
|
-
for (const bend of bends) for (let index = 0; index < grid.length - 1; index += 1) {
|
|
301
|
-
let low = grid[index];
|
|
302
|
-
let high = grid[index + 1];
|
|
303
|
-
if ((valueAt(low) - bend) * (valueAt(high) - bend) >= 0) continue;
|
|
304
|
-
for (let iteration = 0; iteration < 24; iteration += 1) {
|
|
305
|
-
const middle = (low + high) / 2;
|
|
306
|
-
if ((valueAt(low) - bend) * (valueAt(middle) - bend) <= 0) high = middle;
|
|
307
|
-
else low = middle;
|
|
308
|
-
}
|
|
309
|
-
times.push((low + high) / 2);
|
|
310
|
-
}
|
|
311
|
-
return times.sort((a, b) => a - b);
|
|
312
|
-
}
|
|
313
|
-
/**
|
|
314
|
-
* Plays `curve` on `parts` from now. `onPass` runs on the first frame the
|
|
315
|
-
* value is past its offset in its direction, and `onFinish` on the first
|
|
316
|
-
* frame after the curve ends. A part with no Web Animations (a test DOM)
|
|
317
|
-
* shows the end pose at once, and the callbacks keep the curve's times.
|
|
318
|
-
*/
|
|
319
|
-
function playCompositorSettle({ curve, parts, requestFrame, onPass, onFinish }) {
|
|
320
|
-
const durationMs = Math.min(MAX_MS, Math.max(0, curve.settleTime(SETTLE_THRESHOLD.x) * 1e3));
|
|
321
|
-
const started = motionNow();
|
|
322
|
-
let stopped = false;
|
|
323
|
-
let passed = onPass == null;
|
|
324
|
-
const valueAt = (ms) => curve.value(ms / 1e3);
|
|
325
|
-
const times = keyframeTimes(valueAt, durationMs, new Set(parts.flatMap((part) => part.bends ?? [])));
|
|
326
|
-
const values = times.map((ms, index) => index === times.length - 1 ? curve.to : valueAt(ms));
|
|
327
|
-
const offsets = times.map((ms) => durationMs === 0 ? 1 : ms / durationMs);
|
|
328
|
-
const animations = durationMs === 0 ? [] : parts.filter((part) => typeof part.element.animate === "function").map((part) => {
|
|
329
|
-
const end = part.offset(curve.to);
|
|
330
|
-
const animation = part.element.animate(values.map((value, index) => ({
|
|
331
|
-
offset: offsets[index],
|
|
332
|
-
translate: `${part.offset(value) - end}px 0px`
|
|
333
|
-
})), {
|
|
334
|
-
duration: durationMs,
|
|
335
|
-
easing: "linear",
|
|
336
|
-
fill: "backwards"
|
|
337
|
-
});
|
|
338
|
-
animation.startTime = started;
|
|
339
|
-
return animation;
|
|
340
|
-
});
|
|
341
|
-
const elapsedSeconds = () => Math.min(durationMs, Math.max(0, motionNow() - started)) / 1e3;
|
|
342
|
-
const presented = () => curve.value(elapsedSeconds());
|
|
343
|
-
const cancelAll = () => {
|
|
344
|
-
for (const animation of animations) animation.cancel();
|
|
345
|
-
};
|
|
346
|
-
const stop = () => {
|
|
347
|
-
const value = presented();
|
|
348
|
-
stopped = true;
|
|
349
|
-
cancelAll();
|
|
350
|
-
return value;
|
|
351
|
-
};
|
|
352
|
-
const frame = () => {
|
|
353
|
-
if (stopped) return;
|
|
354
|
-
const seconds = elapsedSeconds();
|
|
355
|
-
if (!passed && onPass != null) {
|
|
356
|
-
if ((curve.value(seconds) - onPass.offset) * onPass.direction >= 0) {
|
|
357
|
-
passed = true;
|
|
358
|
-
onPass.call();
|
|
359
|
-
if (stopped) return;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
if (seconds * 1e3 >= durationMs) {
|
|
363
|
-
stopped = true;
|
|
364
|
-
cancelAll();
|
|
365
|
-
onFinish();
|
|
366
|
-
return;
|
|
367
|
-
}
|
|
368
|
-
requestFrame(frame);
|
|
369
|
-
};
|
|
370
|
-
requestFrame(frame);
|
|
371
|
-
return {
|
|
372
|
-
presented,
|
|
373
|
-
velocity: () => curve.velocity(elapsedSeconds()),
|
|
374
|
-
stop
|
|
375
|
-
};
|
|
376
|
-
}
|
|
377
|
-
//#endregion
|
|
378
|
-
//#region src/dragToSnapPoints/createSnapDrag.ts
|
|
379
|
-
/** The document timeline's clock, which the animator runs on. */
|
|
380
|
-
const now = () => performance.now();
|
|
381
|
-
/** Runs `callback` in the next animation frame (a timer without one). */
|
|
382
|
-
function requestFrame(callback) {
|
|
383
|
-
if (typeof requestAnimationFrame === "function") requestAnimationFrame(() => callback());
|
|
384
|
-
else setTimeout(callback, 16);
|
|
385
|
-
}
|
|
386
|
-
/**
|
|
387
|
-
* Where `element` is drawn now, read from the inline value an animator left
|
|
388
|
-
* on it. A drag destroyed and created again leaves it where it stopped. An
|
|
389
|
-
* axis it does not set reads 0.
|
|
390
|
-
*/
|
|
391
|
-
function drawnAt(element, customProperty) {
|
|
392
|
-
if (customProperty != null) {
|
|
393
|
-
const value = Number.parseFloat(element.style.getPropertyValue(customProperty));
|
|
394
|
-
return {
|
|
395
|
-
x: Number.isFinite(value) ? value : 0,
|
|
396
|
-
y: 0
|
|
397
|
-
};
|
|
398
|
-
}
|
|
399
|
-
const [x = 0, y = 0] = element.style.getPropertyValue("translate").trim().split(/\s+/).map((part) => Number.parseFloat(part)).map((value) => Number.isFinite(value) ? value : 0);
|
|
400
|
-
return {
|
|
401
|
-
x,
|
|
402
|
-
y
|
|
403
|
-
};
|
|
404
|
-
}
|
|
405
|
-
/** Drops a point that is not a finite number, with a dev warning. */
|
|
406
|
-
function sortedSnapPoints(snapPoints) {
|
|
407
|
-
const usable = snapPoints.filter((point) => Number.isFinite(point));
|
|
408
|
-
if (usable.length < snapPoints.length) devWarn("createDragToSnapPoints", "snapPoints must be numbers; the others are ignored.");
|
|
409
|
-
return usable.sort((a, b) => a - b);
|
|
410
|
-
}
|
|
411
|
-
/** Lets a drag move `element` along `axis` and settles it on its snap points. */
|
|
412
|
-
function createSnapDrag(element, options) {
|
|
413
|
-
const { axis, onSettle, model } = options;
|
|
414
|
-
if (options.customProperty != null && axis !== "x") devWarn("createSnapDrag", "customProperty draws the x axis only, so this y drag draws nothing.");
|
|
415
|
-
const flickThreshold = options.flickThreshold ?? 1008;
|
|
416
|
-
let points = sortedSnapPoints(options.snapPoints);
|
|
417
|
-
const drawn = drawnAt(element, options.customProperty?.name);
|
|
418
|
-
const animator = createMotionEngine(element, {
|
|
419
|
-
initial: drawn,
|
|
420
|
-
...options.customProperty != null ? { customProperty: options.customProperty } : {}
|
|
421
|
-
});
|
|
422
|
-
let targetIndex = points.length === 0 ? 0 : resolveSnapPoint({
|
|
423
|
-
points,
|
|
424
|
-
position: drawn[axis],
|
|
425
|
-
velocity: 0,
|
|
426
|
-
flickThreshold
|
|
427
|
-
}).index;
|
|
428
|
-
let turn = 0;
|
|
429
|
-
let drag = null;
|
|
430
|
-
let destroyed = false;
|
|
431
|
-
let inFlight = null;
|
|
432
|
-
let compositor = null;
|
|
433
|
-
let finishCompositor = null;
|
|
434
|
-
const position = () => compositor?.presented() ?? animator.get(axis);
|
|
435
|
-
/** Stops a compositor settle where it is on screen, and draws it there. */
|
|
436
|
-
const holdCompositor = () => {
|
|
437
|
-
if (compositor == null) return;
|
|
438
|
-
const value = compositor.stop();
|
|
439
|
-
compositor = null;
|
|
440
|
-
finishCompositor = null;
|
|
441
|
-
animator.set({ [axis]: value }, { promote: false });
|
|
442
|
-
};
|
|
443
|
-
const settle = (target, settleOptions) => {
|
|
444
|
-
registerSpringsTable();
|
|
445
|
-
targetIndex = target;
|
|
446
|
-
const mine = ++turn;
|
|
447
|
-
const flight = {
|
|
448
|
-
turn: mine,
|
|
449
|
-
options: settleOptions,
|
|
450
|
-
passed: false
|
|
451
|
-
};
|
|
452
|
-
inFlight = flight;
|
|
453
|
-
const { velocity } = settleOptions;
|
|
454
|
-
const spring = settleOptions.spring ?? springs.settle;
|
|
455
|
-
const touchRelease = settleOptions.touchRelease === true;
|
|
456
|
-
const { compositorParts } = options;
|
|
457
|
-
if (compositorParts != null && animator.reducedMotion({ touchRelease }) === "off") {
|
|
458
|
-
const startVelocity = velocity != null && velocity !== 0 ? velocity : compositor?.velocity() ?? animator.getVelocity(axis);
|
|
459
|
-
const from = position();
|
|
460
|
-
holdCompositor();
|
|
461
|
-
const to = points[target];
|
|
462
|
-
const curve = solveSpring(toSpring(resolveMotion(element, spring)), {
|
|
463
|
-
from,
|
|
464
|
-
to,
|
|
465
|
-
velocity: startVelocity
|
|
466
|
-
});
|
|
467
|
-
const { onPass } = settleOptions;
|
|
468
|
-
const play = () => {
|
|
469
|
-
if (destroyed || mine !== turn) return;
|
|
470
|
-
animator.stop();
|
|
471
|
-
animator.set({ [axis]: to }, { promote: false });
|
|
472
|
-
const finish = () => {
|
|
473
|
-
compositor = null;
|
|
474
|
-
finishCompositor = null;
|
|
475
|
-
if (inFlight === flight) inFlight = null;
|
|
476
|
-
if (mine === turn && !destroyed) onSettle(targetIndex);
|
|
477
|
-
};
|
|
478
|
-
compositor = playCompositorSettle({
|
|
479
|
-
curve,
|
|
480
|
-
parts: compositorParts(),
|
|
481
|
-
requestFrame,
|
|
482
|
-
...onPass != null ? { onPass: {
|
|
483
|
-
...onPass,
|
|
484
|
-
call: () => {
|
|
485
|
-
flight.passed = true;
|
|
486
|
-
onPass.call();
|
|
487
|
-
}
|
|
488
|
-
} } : {},
|
|
489
|
-
onFinish: finish
|
|
490
|
-
});
|
|
491
|
-
finishCompositor = finish;
|
|
492
|
-
};
|
|
493
|
-
if (settleOptions.start === "next-frame") requestFrame(play);
|
|
494
|
-
else play();
|
|
495
|
-
return null;
|
|
496
|
-
}
|
|
497
|
-
holdCompositor();
|
|
498
|
-
const handle = animator.animate({ [axis]: points[target] }, {
|
|
499
|
-
spring,
|
|
500
|
-
...velocity != null && velocity !== 0 ? { velocity: { [axis]: velocity } } : {}
|
|
501
|
-
}, {
|
|
502
|
-
touchRelease,
|
|
503
|
-
...settleOptions.start != null ? { start: settleOptions.start } : {}
|
|
504
|
-
});
|
|
505
|
-
let finished = false;
|
|
506
|
-
handle.finished.then((arrived) => {
|
|
507
|
-
finished = true;
|
|
508
|
-
if (inFlight === flight) inFlight = null;
|
|
509
|
-
if (arrived && mine === turn && !destroyed) onSettle(targetIndex);
|
|
510
|
-
});
|
|
511
|
-
const { onPass } = settleOptions;
|
|
512
|
-
if (onPass != null && typeof requestAnimationFrame === "function") {
|
|
513
|
-
const { direction } = onPass;
|
|
514
|
-
const check = (time) => {
|
|
515
|
-
if (destroyed || mine !== turn) return;
|
|
516
|
-
if ((animator.get(axis, time) - onPass.offset) * direction >= 0) {
|
|
517
|
-
flight.passed = true;
|
|
518
|
-
onPass.call();
|
|
519
|
-
return;
|
|
520
|
-
}
|
|
521
|
-
if (!finished) requestAnimationFrame(check);
|
|
522
|
-
};
|
|
523
|
-
requestAnimationFrame(check);
|
|
524
|
-
}
|
|
525
|
-
return handle;
|
|
526
|
-
};
|
|
527
|
-
/** Lands a model's landing (null: the element stays as it is). */
|
|
528
|
-
const land = (landing, touchRelease) => {
|
|
529
|
-
if (landing != null) settle(landing.index, {
|
|
530
|
-
velocity: landing.velocity,
|
|
531
|
-
spring: landing.spring,
|
|
532
|
-
touchRelease
|
|
533
|
-
});
|
|
534
|
-
};
|
|
535
|
-
const pan = createPan(element, {
|
|
536
|
-
axis,
|
|
537
|
-
recognizer: options.pan,
|
|
538
|
-
onPan: ({ state, translation, totalTranslation, velocity, input }) => {
|
|
539
|
-
if (destroyed || points.length === 0) return;
|
|
540
|
-
const moved = {
|
|
541
|
-
translation: translation[axis],
|
|
542
|
-
total: totalTranslation[axis],
|
|
543
|
-
input
|
|
544
|
-
};
|
|
545
|
-
if (state === "began") {
|
|
546
|
-
drag = {
|
|
547
|
-
start: position(),
|
|
548
|
-
startIndex: targetIndex,
|
|
549
|
-
input,
|
|
550
|
-
caught: false
|
|
551
|
-
};
|
|
552
|
-
if (model?.begin?.({
|
|
553
|
-
start: drag.start,
|
|
554
|
-
...moved
|
|
555
|
-
}) === false) {
|
|
556
|
-
drag = null;
|
|
557
|
-
return;
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
if (drag == null) return;
|
|
561
|
-
const reading = {
|
|
562
|
-
start: drag.start,
|
|
563
|
-
...moved,
|
|
564
|
-
input: drag.input
|
|
565
|
-
};
|
|
566
|
-
if (state === "began" || state === "changed") {
|
|
567
|
-
const target = model?.move != null ? model.move(reading) : { offset: drag.start + moved.translation };
|
|
568
|
-
if (target == null) return;
|
|
569
|
-
if (!drag.caught) {
|
|
570
|
-
drag.caught = true;
|
|
571
|
-
turn += 1;
|
|
572
|
-
holdCompositor();
|
|
573
|
-
}
|
|
574
|
-
if (target.spring == null) animator.set({ [axis]: target.offset });
|
|
575
|
-
else {
|
|
576
|
-
registerSpringsTable();
|
|
577
|
-
animator.animate({ [axis]: target.offset }, { spring: target.spring }, { at: now() });
|
|
578
|
-
}
|
|
579
|
-
return;
|
|
580
|
-
}
|
|
581
|
-
const { startIndex, start } = drag;
|
|
582
|
-
drag = null;
|
|
583
|
-
const touchRelease = reading.input === "touch";
|
|
584
|
-
if (state === "cancelled") {
|
|
585
|
-
if (model?.cancel != null) land(model.cancel(reading), touchRelease);
|
|
586
|
-
else settle(startIndex, {
|
|
587
|
-
velocity: 0,
|
|
588
|
-
touchRelease
|
|
589
|
-
});
|
|
590
|
-
return;
|
|
591
|
-
}
|
|
592
|
-
const release = velocity[axis];
|
|
593
|
-
if (model?.release != null) {
|
|
594
|
-
land(model.release({
|
|
595
|
-
...reading,
|
|
596
|
-
velocity: release
|
|
597
|
-
}), touchRelease);
|
|
598
|
-
return;
|
|
599
|
-
}
|
|
600
|
-
const { index: target } = resolveSnapPoint({
|
|
601
|
-
points,
|
|
602
|
-
position: position(),
|
|
603
|
-
velocity: release,
|
|
604
|
-
flickThreshold,
|
|
605
|
-
start
|
|
606
|
-
});
|
|
607
|
-
settle(target, {
|
|
608
|
-
velocity: release,
|
|
609
|
-
touchRelease
|
|
610
|
-
});
|
|
611
|
-
}
|
|
612
|
-
});
|
|
613
|
-
return {
|
|
614
|
-
settleTo(target, settleOptions = {}) {
|
|
615
|
-
if (destroyed) return null;
|
|
616
|
-
if (!Number.isInteger(target) || target < 0 || target >= points.length) {
|
|
617
|
-
devWarn("createDragToSnapPoints", `settleTo(${target}) is outside the ${points.length} snap points, so it does nothing.`);
|
|
618
|
-
return null;
|
|
619
|
-
}
|
|
620
|
-
drag = null;
|
|
621
|
-
return settle(target, {
|
|
622
|
-
velocity: 0,
|
|
623
|
-
...settleOptions
|
|
624
|
-
});
|
|
625
|
-
},
|
|
626
|
-
setSnapPoints(snapPoints) {
|
|
627
|
-
if (destroyed) return;
|
|
628
|
-
const flight = (drag == null || !drag.caught) && inFlight?.turn === turn ? inFlight : null;
|
|
629
|
-
const heading = flight == null ? null : points[targetIndex];
|
|
630
|
-
const startPoint = drag == null ? null : points[drag.startIndex];
|
|
631
|
-
points = sortedSnapPoints(snapPoints);
|
|
632
|
-
if (points.length === 0) {
|
|
633
|
-
turn += 1;
|
|
634
|
-
drag = null;
|
|
635
|
-
holdCompositor();
|
|
636
|
-
animator.stop();
|
|
637
|
-
targetIndex = 0;
|
|
638
|
-
return;
|
|
639
|
-
}
|
|
640
|
-
const nearest = (at) => resolveSnapPoint({
|
|
641
|
-
points,
|
|
642
|
-
position: at,
|
|
643
|
-
velocity: 0,
|
|
644
|
-
flickThreshold
|
|
645
|
-
}).index;
|
|
646
|
-
if (flight != null && heading != null) {
|
|
647
|
-
const { onPass, ...rest } = flight.options;
|
|
648
|
-
settle(nearest(heading), {
|
|
649
|
-
...rest,
|
|
650
|
-
...flight.passed ? {} : { onPass },
|
|
651
|
-
velocity: 0
|
|
652
|
-
});
|
|
653
|
-
if (drag != null) drag.startIndex = nearest(startPoint ?? drag.start);
|
|
654
|
-
return;
|
|
655
|
-
}
|
|
656
|
-
targetIndex = nearest(startPoint ?? position());
|
|
657
|
-
if (drag != null) drag.startIndex = targetIndex;
|
|
658
|
-
},
|
|
659
|
-
snapPoints() {
|
|
660
|
-
return points;
|
|
661
|
-
},
|
|
662
|
-
animator,
|
|
663
|
-
position,
|
|
664
|
-
finishSettle() {
|
|
665
|
-
const finish = finishCompositor;
|
|
666
|
-
if (compositor == null || finish == null) return;
|
|
667
|
-
compositor.stop();
|
|
668
|
-
finish();
|
|
669
|
-
},
|
|
670
|
-
destroy() {
|
|
671
|
-
if (destroyed) return;
|
|
672
|
-
destroyed = true;
|
|
673
|
-
pan.destroy();
|
|
674
|
-
holdCompositor();
|
|
675
|
-
animator.stop();
|
|
676
|
-
animator.dispose();
|
|
677
|
-
}
|
|
678
|
-
};
|
|
679
|
-
}
|
|
680
|
-
//#endregion
|
|
681
211
|
//#region src/dragToSnapPoints/createDragToSnapPoints.ts
|
|
682
212
|
/**
|
|
683
213
|
* @file createDragToSnapPoints.ts
|
|
@@ -4386,4 +3916,4 @@ function useTouchTrigger(options) {
|
|
|
4386
3916
|
};
|
|
4387
3917
|
}
|
|
4388
3918
|
//#endregion
|
|
4389
|
-
export { createAnimator as
|
|
3919
|
+
export { createAnimator as S, useControllableState as _, useReorderable as a, createReorderable as b, useKeyboardHint as c, perceptualLightness as d, useImageMode as f, useDragToSnapPoints as g, useEntryAnimation as h, useSnapPaging as i, useIndicatorFocusRing as l, useGridFocus as m, snapToGraphemeBoundary as n, usePanGesture as o, useGridRovingFocus as p, useStreamingText as r, useLinkify as s, useTouchTrigger as t, imageModeFromPixels as u, useContainerReveal as v, createDragToSnapPoints as x, useAnimator as y };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { a as useAstryxLocale } from "./context-B8IEFCDR.js";
|
|
2
|
+
import { computed, inject } from "vue";
|
|
3
|
+
//#region src/InternationalizationProvider/direction.ts
|
|
4
|
+
/**
|
|
5
|
+
* 从右往左书写的语言。运行时拿不到 `Intl.Locale#getTextInfo` 时用它兜底,
|
|
6
|
+
* 例如较老的浏览器和部分测试环境。
|
|
7
|
+
*/
|
|
8
|
+
const RTL_LANGUAGES = /* @__PURE__ */ new Set([
|
|
9
|
+
"ar",
|
|
10
|
+
"arc",
|
|
11
|
+
"ckb",
|
|
12
|
+
"dv",
|
|
13
|
+
"fa",
|
|
14
|
+
"he",
|
|
15
|
+
"iw",
|
|
16
|
+
"ji",
|
|
17
|
+
"ks",
|
|
18
|
+
"ku",
|
|
19
|
+
"ps",
|
|
20
|
+
"sd",
|
|
21
|
+
"ug",
|
|
22
|
+
"ur",
|
|
23
|
+
"yi"
|
|
24
|
+
]);
|
|
25
|
+
/**
|
|
26
|
+
* 由语言标签推导书写方向。`ar-SA`、`he` 这类语言得到 `rtl`,其余得到 `ltr`。
|
|
27
|
+
* 解析不了的标签按 `ltr` 处理。
|
|
28
|
+
*/
|
|
29
|
+
function getLocaleDirection(locale) {
|
|
30
|
+
const tag = locale.trim();
|
|
31
|
+
if (tag === "") return "ltr";
|
|
32
|
+
let parsed;
|
|
33
|
+
try {
|
|
34
|
+
parsed = new Intl.Locale(tag);
|
|
35
|
+
} catch {
|
|
36
|
+
return "ltr";
|
|
37
|
+
}
|
|
38
|
+
const readTextInfo = parsed.getTextInfo;
|
|
39
|
+
if (typeof readTextInfo === "function") {
|
|
40
|
+
const direction = readTextInfo.call(parsed).direction;
|
|
41
|
+
if (direction === "rtl" || direction === "ltr") return direction;
|
|
42
|
+
}
|
|
43
|
+
return RTL_LANGUAGES.has(parsed.language.toLowerCase()) ? "rtl" : "ltr";
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/InternationalizationProvider/context.ts
|
|
47
|
+
/** 最近的 `InternationalizationProvider` 定下的书写方向。 */
|
|
48
|
+
const astryxDirectionKey = Symbol("astryx-direction");
|
|
49
|
+
/**
|
|
50
|
+
* 子树当前的书写方向。有 provider 时用它的 `dir`,否则按最近的 locale 推导。
|
|
51
|
+
* 它只描述 Astryx 组件读数用的方向;DOM 的 `dir` 属性要自己设。
|
|
52
|
+
*/
|
|
53
|
+
function useLocaleDirection() {
|
|
54
|
+
const provided = inject(astryxDirectionKey, null);
|
|
55
|
+
if (provided != null) return provided;
|
|
56
|
+
const locale = useAstryxLocale();
|
|
57
|
+
return computed(() => getLocaleDirection(locale.value));
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
export { useLocaleDirection as n, getLocaleDirection as r, astryxDirectionKey as t };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { t as devWarn } from "./useDevWarning-B2fsk2B-.js";
|
|
2
|
+
//#region src/Swipe/swipeHost.ts
|
|
3
|
+
const HOST = Symbol.for("@astryx-vue/core/swipe/host");
|
|
4
|
+
/** 为一个 host 造 Swipe 值(createSwipe.ts)。 */
|
|
5
|
+
function makeSwipe(host) {
|
|
6
|
+
return Object.freeze(Object.defineProperty({}, HOST, { value: host }));
|
|
7
|
+
}
|
|
8
|
+
/** Swipe 值的 host;不是 makeSwipe 造的值返回 null。 */
|
|
9
|
+
function swipeHostOf(swipe) {
|
|
10
|
+
if (swipe == null || typeof swipe !== "object") return null;
|
|
11
|
+
return swipe[HOST] ?? null;
|
|
12
|
+
}
|
|
13
|
+
/** `ListItem` 交给 `Item` 的 Swipe 值:同样的操作和规则,配上这一行的 key。 */
|
|
14
|
+
function swipeWithItemKey(swipe, itemKey) {
|
|
15
|
+
const host = swipeHostOf(swipe);
|
|
16
|
+
if (host == null || itemKey == null) return swipe;
|
|
17
|
+
return makeSwipe({
|
|
18
|
+
...host,
|
|
19
|
+
itemKey
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/Swipe/createSwipe.ts
|
|
24
|
+
/**
|
|
25
|
+
* 内容模型允许可交互后代的 role,面板里的按钮才能放进行里。
|
|
26
|
+
* 没有 role 的行也算;`option`、`menuitem*` 等不算。
|
|
27
|
+
*/
|
|
28
|
+
const SWIPE_ROLES = /* @__PURE__ */ new Set(["listitem"]);
|
|
29
|
+
/**
|
|
30
|
+
* 横滑是否服务一行:行的 role 允许可交互后代(面板的按钮就是这种后代)。
|
|
31
|
+
* 禁用的行、作为内部控件放大点击区的行不服务。
|
|
32
|
+
*/
|
|
33
|
+
function serves({ role, isDisabled, isDelegate }) {
|
|
34
|
+
return !isDisabled && !isDelegate && (role == null || SWIPE_ROLES.has(role));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* 一组操作和收场方式对应的 host:createSwipe 和行上已弃用的 `swipeActions` 共用它,
|
|
38
|
+
* 所以两条路的规则和手感一致。
|
|
39
|
+
*/
|
|
40
|
+
function createSwipeHost(leading, trailing, behavior) {
|
|
41
|
+
const hasEntries = leading.length > 0 || trailing.length > 0;
|
|
42
|
+
return {
|
|
43
|
+
leading,
|
|
44
|
+
trailing,
|
|
45
|
+
behavior,
|
|
46
|
+
serves: (facts) => hasEntries && serves(facts)
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* 造一行的横滑操作:横向拖动在每一侧露出的动词(声明成数据),以及横滑怎么收场。
|
|
51
|
+
* 把结果作为 `swipe` 传给 `Item` 或 `ListItem`。它是普通函数而不是组合式函数,纯且便宜:
|
|
52
|
+
* 可以在模块顶层、组件外、服务端调用,导入和调用都不碰 DOM。每个操作的 `onActivate`
|
|
53
|
+
* 收到操作的 `id` 和行的 `itemKey`,所以模块顶层一份定义就能服务所有行;处理函数要用
|
|
54
|
+
* 组件状态时放进 `computed`。横滑不自带任何文案:它露出的每个名字都是调用方的 `label`。
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* const mailSwipe = createSwipe({
|
|
59
|
+
* trailing: [
|
|
60
|
+
* { id: 'archive', label: '归档', onActivate: ({ itemKey }) => archive(itemKey) },
|
|
61
|
+
* { id: 'delete', label: '删除', onActivate: ({ itemKey }) => remove(itemKey), variant: 'destructive', hasRemoval: true },
|
|
62
|
+
* ],
|
|
63
|
+
* })
|
|
64
|
+
* ```
|
|
65
|
+
* ```vue
|
|
66
|
+
* <ListItem label="收件箱" :item-key="message.id" :swipe="mailSwipe" />
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
function createSwipe(options) {
|
|
70
|
+
const leading = Object.freeze([...options.leading ?? []]);
|
|
71
|
+
const trailing = Object.freeze([...options.trailing ?? []]);
|
|
72
|
+
const behavior = options.swipeBehavior ?? "reveal";
|
|
73
|
+
if (behavior === "commit" && (leading.length > 1 || trailing.length > 1)) devWarn("createSwipe", "`swipeBehavior: 'commit'` fires no entry on a side with two or more entries. Give a committing side one entry, or use `swipeBehavior: 'reveal'`.");
|
|
74
|
+
return makeSwipe(createSwipeHost(leading, trailing, behavior));
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
export { swipeWithItemKey as i, createSwipeHost as n, swipeHostOf as r, createSwipe as t };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region src/gestures/geometry.ts
|
|
2
|
+
function centroid(touches, excluding) {
|
|
3
|
+
let x = 0;
|
|
4
|
+
let y = 0;
|
|
5
|
+
let count = 0;
|
|
6
|
+
for (const touch of touches) {
|
|
7
|
+
if (excluding?.has(touch.id)) continue;
|
|
8
|
+
x += touch.x;
|
|
9
|
+
y += touch.y;
|
|
10
|
+
count += 1;
|
|
11
|
+
}
|
|
12
|
+
return count === 0 ? {
|
|
13
|
+
x: 0,
|
|
14
|
+
y: 0
|
|
15
|
+
} : {
|
|
16
|
+
x: x / count,
|
|
17
|
+
y: y / count
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function distance(a, b) {
|
|
21
|
+
return Math.hypot(a.x - b.x, a.y - b.y);
|
|
22
|
+
}
|
|
23
|
+
/** How far a touch is from where it landed. */
|
|
24
|
+
function travel(touch) {
|
|
25
|
+
return Math.hypot(touch.x - touch.startX, touch.y - touch.startY);
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { distance as n, travel as r, centroid as t };
|
|
@@ -28,9 +28,9 @@ declare const __VLS_base: import("vue").DefineComponent<NavItemProps, {}, {}, {}
|
|
|
28
28
|
onClick?: ((event: MouseEvent) => any) | undefined;
|
|
29
29
|
}>, {
|
|
30
30
|
block: boolean;
|
|
31
|
-
size: NavItemSize;
|
|
32
|
-
isDisabled: boolean;
|
|
33
31
|
isIconOnly: boolean;
|
|
32
|
+
isDisabled: boolean;
|
|
33
|
+
size: NavItemSize;
|
|
34
34
|
isSelected: boolean;
|
|
35
35
|
isFocusableWhenDisabled: boolean;
|
|
36
36
|
plain: boolean;
|