@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
package/dist/Item-DC1v56yE.js
DELETED
|
@@ -1,723 +0,0 @@
|
|
|
1
|
-
import { a as isInLayerSurface, o as isLayerSurface } from "./useClickableContainer-Dtjg-nkm.js";
|
|
2
|
-
import { t as usePressFeedback } from "./usePressFeedback-Ber7MRiI.js";
|
|
3
|
-
import { n as readLayerScoped } from "./scopedProvide-C-Df7c15.js";
|
|
4
|
-
import { n as isSafeUrl } from "./safeUrl-CsvfcZ9m.js";
|
|
5
|
-
import { n as useLinkComponent } from "./context-C_peZbXf.js";
|
|
6
|
-
import { t as isCoarsePointer } from "./coarsePointer-BWNSUIY8.js";
|
|
7
|
-
import { a as itemDescriptionContextKey, i as useItemSlotsFromWrapper, o as itemListRowKey } from "./itemSlots-BxUu7hje.js";
|
|
8
|
-
import { t as useInteractiveRole } from "./useInteractiveRole-Cn0Nd5GX.js";
|
|
9
|
-
import { t as useFocusAcrossSwap } from "./focusAcrossSwap-Casww_IY.js";
|
|
10
|
-
import { n as disabledInteractionProps, t as consumeWhileDisabled } from "./disabledInteraction-Bqoyhoss.js";
|
|
11
|
-
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, h, mergeProps, normalizeClass, normalizeStyle, onBeforeUnmount, openBlock, provide, ref, renderList, renderSlot, resolveDynamicComponent, toDisplayString, toRaw, toValue, unref, useAttrs, useId, useSlots, useTemplateRef, watch, watchEffect, withCtx, withModifiers } from "vue";
|
|
12
|
-
import "../styles/list.css";
|
|
13
|
-
//#region src/List/ItemSwipePanel.vue
|
|
14
|
-
const _hoisted_1$1 = ["data-side", "inert"];
|
|
15
|
-
const _hoisted_2$1 = [
|
|
16
|
-
"data-variant",
|
|
17
|
-
"aria-disabled",
|
|
18
|
-
"onClick",
|
|
19
|
-
"onKeydown"
|
|
20
|
-
];
|
|
21
|
-
const _sfc_main$1 = /*@__PURE__*/ defineComponent({
|
|
22
|
-
name: "AstryxItemSwipePanel",
|
|
23
|
-
__name: "ItemSwipePanel",
|
|
24
|
-
props: {
|
|
25
|
-
side: {},
|
|
26
|
-
actions: {},
|
|
27
|
-
phase: {}
|
|
28
|
-
},
|
|
29
|
-
emits: ["activate"],
|
|
30
|
-
setup(__props, { emit: __emit }) {
|
|
31
|
-
const emit = __emit;
|
|
32
|
-
return (_ctx, _cache) => {
|
|
33
|
-
return openBlock(), createElementBlock("div", {
|
|
34
|
-
class: "astryx-item__swipe-panel",
|
|
35
|
-
"data-side": __props.side,
|
|
36
|
-
inert: __props.phase === "resting" ? void 0 : true
|
|
37
|
-
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.actions, (action) => {
|
|
38
|
-
return openBlock(), createElementBlock("button", {
|
|
39
|
-
key: action.id ?? action.label,
|
|
40
|
-
type: "button",
|
|
41
|
-
class: "astryx-item__swipe-action",
|
|
42
|
-
"data-variant": action.variant ?? "neutral",
|
|
43
|
-
"aria-disabled": action.isDisabled || void 0,
|
|
44
|
-
onClick: withModifiers(($event) => emit("activate", action), ["stop"]),
|
|
45
|
-
onKeydown: ($event) => unref(consumeWhileDisabled)($event, action.isDisabled === true)
|
|
46
|
-
}, [action.icon ? (openBlock(), createBlock(resolveDynamicComponent(action.icon), {
|
|
47
|
-
key: 0,
|
|
48
|
-
"aria-hidden": "true"
|
|
49
|
-
})) : createCommentVNode("v-if", true), createElementVNode("span", null, toDisplayString(action.label), 1)], 40, _hoisted_2$1);
|
|
50
|
-
}), 128))], 8, _hoisted_1$1);
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
//#endregion
|
|
55
|
-
//#region src/List/useDelegatedControl.ts
|
|
56
|
-
/**
|
|
57
|
-
* 转发点击的行写在被转发控件上的属性。控件就是行自己的动作,按它照样是按这一行,
|
|
58
|
-
* 所以带上按压标记;行选中时写 `aria-current`(控件自己有标记就不动)。
|
|
59
|
-
* 清理时只撤掉行自己写的值。
|
|
60
|
-
*/
|
|
61
|
-
function useDelegatedControl(options) {
|
|
62
|
-
watchEffect((onCleanup) => {
|
|
63
|
-
const control = options.control();
|
|
64
|
-
if (control == null) return;
|
|
65
|
-
for (const [name, value] of Object.entries(options.pressAttributes)) control.setAttribute(name, value);
|
|
66
|
-
onCleanup(() => {
|
|
67
|
-
for (const name of Object.keys(options.pressAttributes)) control.removeAttribute(name);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
watchEffect((onCleanup) => {
|
|
71
|
-
const control = options.control();
|
|
72
|
-
const value = options.current();
|
|
73
|
-
if (control == null || value === void 0 || control.hasAttribute("aria-current")) return;
|
|
74
|
-
const written = String(value);
|
|
75
|
-
control.setAttribute("aria-current", written);
|
|
76
|
-
onCleanup(() => {
|
|
77
|
-
if (control.getAttribute("aria-current") === written) control.removeAttribute("aria-current");
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
//#endregion
|
|
82
|
-
//#region src/List/useItemSwipe.ts
|
|
83
|
-
const AXIS_LOCK_PX = 10;
|
|
84
|
-
const REST_FRACTION = .5;
|
|
85
|
-
const COMMIT_PAST_PX = 48;
|
|
86
|
-
const COMMIT_FRACTION = .5;
|
|
87
|
-
/** `reveal` 下松手速度到这个值(px/ms)、拖过 FLING_MIN_PX,行就停在打开的位置。 */
|
|
88
|
-
const FLING_VELOCITY = .6;
|
|
89
|
-
const FLING_MIN_PX = 44;
|
|
90
|
-
const OVERSHOOT_PX = 24;
|
|
91
|
-
const SETTLE_MS = 200;
|
|
92
|
-
/**
|
|
93
|
-
* 触摸横滑露出行内操作。鼠标不开始拖动;竖着拖留给外面的滚动。
|
|
94
|
-
* `reveal` 松手过半个面板或甩一下,行停在打开的位置;手指自己拖过触发点才触发最外侧。
|
|
95
|
-
* `commit` 松手越过触发点就滑出并触发最外侧,没有停住的状态。
|
|
96
|
-
* 只靠速度永远不触发操作。一侧有两个及以上操作时,只有从已经停在打开位置的行开始的拖动才会触发。
|
|
97
|
-
*/
|
|
98
|
-
function useItemSwipe(options) {
|
|
99
|
-
const phase = ref("idle");
|
|
100
|
-
let pointerId = null;
|
|
101
|
-
let originX = 0;
|
|
102
|
-
let originY = 0;
|
|
103
|
-
let claimed = null;
|
|
104
|
-
let direction = 1;
|
|
105
|
-
let lastX = 0;
|
|
106
|
-
let lastTime = 0;
|
|
107
|
-
let velocity = 0;
|
|
108
|
-
let suppressClick = false;
|
|
109
|
-
/** 手指落下时行是否停在打开的位置。 */
|
|
110
|
-
let fromRest = false;
|
|
111
|
-
let settleTimer;
|
|
112
|
-
function write(travel, duration) {
|
|
113
|
-
const root = options.root.value;
|
|
114
|
-
if (!root) return;
|
|
115
|
-
root.style.setProperty("--_item-swipe-dir", String(direction));
|
|
116
|
-
root.style.setProperty("--_item-swipe-travel", String(travel));
|
|
117
|
-
root.style.setProperty("--_item-swipe-duration", duration);
|
|
118
|
-
}
|
|
119
|
-
function panelWidth(side) {
|
|
120
|
-
return (options.root.value?.querySelector(`[data-side="${side}"]`))?.offsetWidth || 72;
|
|
121
|
-
}
|
|
122
|
-
function clearSettle() {
|
|
123
|
-
if (settleTimer != null) clearTimeout(settleTimer);
|
|
124
|
-
settleTimer = void 0;
|
|
125
|
-
}
|
|
126
|
-
function springTo(travel, next) {
|
|
127
|
-
clearSettle();
|
|
128
|
-
phase.value = "settling";
|
|
129
|
-
write(travel, `${SETTLE_MS}ms`);
|
|
130
|
-
settleTimer = setTimeout(() => {
|
|
131
|
-
phase.value = next;
|
|
132
|
-
if (next === "idle") write(0, "0s");
|
|
133
|
-
}, SETTLE_MS);
|
|
134
|
-
}
|
|
135
|
-
function stopTracking() {
|
|
136
|
-
pointerId = null;
|
|
137
|
-
claimed = null;
|
|
138
|
-
if (typeof document !== "undefined") {
|
|
139
|
-
document.removeEventListener("pointerdown", onPinchWatch, true);
|
|
140
|
-
document.removeEventListener("pointermove", onPointerMove);
|
|
141
|
-
document.removeEventListener("pointerup", onPointerUp);
|
|
142
|
-
document.removeEventListener("pointercancel", onPointerCancel);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
/** 方向还没定时,页面上任何位置落下第二根手指都是双指缩放:行放手,什么都不取消。 */
|
|
146
|
-
function onPinchWatch(event) {
|
|
147
|
-
if (event.pointerType === "touch" && event.pointerId !== pointerId && claimed == null) stopTracking();
|
|
148
|
-
}
|
|
149
|
-
function onPointerMove(event) {
|
|
150
|
-
if (event.pointerId !== pointerId) return;
|
|
151
|
-
const dx = event.clientX - originX;
|
|
152
|
-
const dy = event.clientY - originY;
|
|
153
|
-
if (claimed == null) {
|
|
154
|
-
if (Math.abs(dx) < AXIS_LOCK_PX && Math.abs(dy) < AXIS_LOCK_PX) return;
|
|
155
|
-
if (Math.abs(dy) > Math.abs(dx)) {
|
|
156
|
-
stopTracking();
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
claimed = true;
|
|
160
|
-
document.removeEventListener("pointerdown", onPinchWatch, true);
|
|
161
|
-
phase.value = "dragging";
|
|
162
|
-
write(0, "0s");
|
|
163
|
-
}
|
|
164
|
-
event.preventDefault();
|
|
165
|
-
const now = event.timeStamp;
|
|
166
|
-
if (lastTime > 0) velocity = (event.clientX - lastX) / Math.max(1, now - lastTime);
|
|
167
|
-
lastX = event.clientX;
|
|
168
|
-
lastTime = now;
|
|
169
|
-
let logical = dx * direction;
|
|
170
|
-
if (logical > 0 && options.leading.value.length === 0) logical = 0;
|
|
171
|
-
if (logical < 0 && options.trailing.value.length === 0) logical = 0;
|
|
172
|
-
const limit = panelWidth(logical >= 0 ? "leading" : "trailing");
|
|
173
|
-
const distance = Math.abs(logical);
|
|
174
|
-
const resisted = distance > limit ? limit + (distance - limit) * .35 : distance;
|
|
175
|
-
write(Math.sign(logical || 1) * resisted, "0s");
|
|
176
|
-
}
|
|
177
|
-
function currentTravel() {
|
|
178
|
-
const raw = options.root.value?.style.getPropertyValue("--_item-swipe-travel");
|
|
179
|
-
return Number(raw) || 0;
|
|
180
|
-
}
|
|
181
|
-
function actionsFor(side) {
|
|
182
|
-
return side === "leading" ? options.leading.value : options.trailing.value;
|
|
183
|
-
}
|
|
184
|
-
function finish(event) {
|
|
185
|
-
if (event.pointerId !== pointerId) return;
|
|
186
|
-
const travel = currentTravel();
|
|
187
|
-
const didDrag = claimed === true;
|
|
188
|
-
stopTracking();
|
|
189
|
-
if (!didDrag) return;
|
|
190
|
-
suppressClick = true;
|
|
191
|
-
setTimeout(() => {
|
|
192
|
-
suppressClick = false;
|
|
193
|
-
}, 400);
|
|
194
|
-
const side = travel >= 0 ? "leading" : "trailing";
|
|
195
|
-
const actions = actionsFor(side);
|
|
196
|
-
const outermost = actions[actions.length - 1];
|
|
197
|
-
const distance = Math.abs(travel);
|
|
198
|
-
const width = panelWidth(side);
|
|
199
|
-
const rowWidth = options.root.value?.offsetWidth ?? width;
|
|
200
|
-
const logicalVelocity = velocity * direction;
|
|
201
|
-
const flung = Math.sign(logicalVelocity) === Math.sign(travel) && Math.abs(logicalVelocity) > FLING_VELOCITY && distance > FLING_MIN_PX;
|
|
202
|
-
const commitAt = Math.max(width + COMMIT_PAST_PX, rowWidth * COMMIT_FRACTION);
|
|
203
|
-
if ((actions.length < 2 || fromRest) && distance >= commitAt && outermost && !outermost.isDisabled) {
|
|
204
|
-
outermost.onActivate();
|
|
205
|
-
springTo(Math.sign(travel || 1) * (rowWidth + OVERSHOOT_PX), outermost.hasRemoval ? "held" : "idle");
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
if (options.behavior.value === "commit") {
|
|
209
|
-
springTo(0, "idle");
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
if (flung || distance >= width * REST_FRACTION) springTo(Math.sign(travel || 1) * width, "resting");
|
|
213
|
-
else springTo(0, "idle");
|
|
214
|
-
}
|
|
215
|
-
function onPointerUp(event) {
|
|
216
|
-
finish(event);
|
|
217
|
-
}
|
|
218
|
-
function onPointerCancel(event) {
|
|
219
|
-
if (event.pointerId !== pointerId) return;
|
|
220
|
-
stopTracking();
|
|
221
|
-
springTo(0, "idle");
|
|
222
|
-
}
|
|
223
|
-
function onDocumentPointerDown(event) {
|
|
224
|
-
const root = options.root.value;
|
|
225
|
-
const target = event.target;
|
|
226
|
-
if (root == null || target instanceof Node && root.contains(target)) return;
|
|
227
|
-
springTo(0, "idle");
|
|
228
|
-
}
|
|
229
|
-
watch(phase, (next) => {
|
|
230
|
-
if (typeof document === "undefined") return;
|
|
231
|
-
if (next === "resting") document.addEventListener("pointerdown", onDocumentPointerDown, true);
|
|
232
|
-
else document.removeEventListener("pointerdown", onDocumentPointerDown, true);
|
|
233
|
-
});
|
|
234
|
-
function onPointerDown(event) {
|
|
235
|
-
if (!options.enabled.value || event.pointerType !== "touch" || pointerId != null || phase.value === "held") return;
|
|
236
|
-
const target = event.target;
|
|
237
|
-
if (target instanceof Element && target.closest("button, a, input, textarea, select")) return;
|
|
238
|
-
fromRest = phase.value === "resting";
|
|
239
|
-
pointerId = event.pointerId;
|
|
240
|
-
originX = event.clientX;
|
|
241
|
-
originY = event.clientY;
|
|
242
|
-
lastX = event.clientX;
|
|
243
|
-
lastTime = event.timeStamp;
|
|
244
|
-
velocity = 0;
|
|
245
|
-
claimed = null;
|
|
246
|
-
direction = getComputedStyle(options.root.value ?? document.documentElement).direction === "rtl" ? -1 : 1;
|
|
247
|
-
document.addEventListener("pointerdown", onPinchWatch, true);
|
|
248
|
-
document.addEventListener("pointermove", onPointerMove);
|
|
249
|
-
document.addEventListener("pointerup", onPointerUp);
|
|
250
|
-
document.addEventListener("pointercancel", onPointerCancel);
|
|
251
|
-
}
|
|
252
|
-
function onClickCapture(event) {
|
|
253
|
-
if (!suppressClick) return;
|
|
254
|
-
const target = event.target;
|
|
255
|
-
if (target instanceof Element && target.closest(".astryx-item__swipe-action")) return;
|
|
256
|
-
event.preventDefault();
|
|
257
|
-
event.stopPropagation();
|
|
258
|
-
}
|
|
259
|
-
function onKeyDown(event) {
|
|
260
|
-
if (event.key === "Escape" && (phase.value === "resting" || phase.value === "dragging")) springTo(0, "idle");
|
|
261
|
-
}
|
|
262
|
-
function activate(action) {
|
|
263
|
-
if (action.isDisabled) return;
|
|
264
|
-
action.onActivate();
|
|
265
|
-
if (action.hasRemoval) {
|
|
266
|
-
const rowWidth = options.root.value?.offsetWidth ?? 0;
|
|
267
|
-
const travel = currentTravel();
|
|
268
|
-
springTo(Math.sign(travel || 1) * (rowWidth + OVERSHOOT_PX), "held");
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
springTo(0, "idle");
|
|
272
|
-
}
|
|
273
|
-
onBeforeUnmount(() => {
|
|
274
|
-
stopTracking();
|
|
275
|
-
clearSettle();
|
|
276
|
-
if (typeof document !== "undefined") document.removeEventListener("pointerdown", onDocumentPointerDown, true);
|
|
277
|
-
});
|
|
278
|
-
return {
|
|
279
|
-
phase,
|
|
280
|
-
onPointerDown,
|
|
281
|
-
onClickCapture,
|
|
282
|
-
onKeyDown,
|
|
283
|
-
activate
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
//#endregion
|
|
287
|
-
//#region src/List/Item.vue
|
|
288
|
-
const _hoisted_1 = {
|
|
289
|
-
key: 0,
|
|
290
|
-
class: "astryx-item__start"
|
|
291
|
-
};
|
|
292
|
-
const _hoisted_2 = ["id"];
|
|
293
|
-
const _hoisted_3 = {
|
|
294
|
-
key: 1,
|
|
295
|
-
class: "astryx-item__end"
|
|
296
|
-
};
|
|
297
|
-
const NATIVE_CONTROL_SELECTOR = "button, a, input, select, textarea";
|
|
298
|
-
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
299
|
-
name: "AstryxItem",
|
|
300
|
-
inheritAttrs: false,
|
|
301
|
-
__name: "Item",
|
|
302
|
-
props: {
|
|
303
|
-
as: { default: "div" },
|
|
304
|
-
layout: { default: "stacked" },
|
|
305
|
-
labelLines: {},
|
|
306
|
-
descriptionLines: {},
|
|
307
|
-
isHighlighted: {
|
|
308
|
-
type: Boolean,
|
|
309
|
-
default: false
|
|
310
|
-
},
|
|
311
|
-
align: { default: "center" },
|
|
312
|
-
label: {},
|
|
313
|
-
description: {},
|
|
314
|
-
density: { default: "balanced" },
|
|
315
|
-
onClick: {},
|
|
316
|
-
interactiveRef: {},
|
|
317
|
-
href: {},
|
|
318
|
-
target: {},
|
|
319
|
-
rel: {},
|
|
320
|
-
isDisabled: {
|
|
321
|
-
type: Boolean,
|
|
322
|
-
default: false
|
|
323
|
-
},
|
|
324
|
-
isSelected: {
|
|
325
|
-
type: Boolean,
|
|
326
|
-
default: false
|
|
327
|
-
},
|
|
328
|
-
itemKey: {},
|
|
329
|
-
swipeActions: {},
|
|
330
|
-
swipeBehavior: {}
|
|
331
|
-
},
|
|
332
|
-
setup(__props, { expose: __expose }) {
|
|
333
|
-
const props = __props;
|
|
334
|
-
const linkComponent = useLinkComponent();
|
|
335
|
-
const ARIA_SELECTED_ROLES = /* @__PURE__ */ new Set([
|
|
336
|
-
"option",
|
|
337
|
-
"tab",
|
|
338
|
-
"row",
|
|
339
|
-
"gridcell",
|
|
340
|
-
"columnheader",
|
|
341
|
-
"rowheader",
|
|
342
|
-
"treeitem"
|
|
343
|
-
]);
|
|
344
|
-
const INTERACTIVE_SELECTOR = [
|
|
345
|
-
"button",
|
|
346
|
-
"a",
|
|
347
|
-
"input",
|
|
348
|
-
"select",
|
|
349
|
-
"textarea",
|
|
350
|
-
"[role=\"button\"]",
|
|
351
|
-
"[role=\"link\"]",
|
|
352
|
-
"[role=\"checkbox\"]",
|
|
353
|
-
"[role=\"radio\"]",
|
|
354
|
-
"[role=\"switch\"]",
|
|
355
|
-
"[role=\"tab\"]",
|
|
356
|
-
"[role=\"menuitem\"]",
|
|
357
|
-
"[role=\"option\"]",
|
|
358
|
-
"[role=\"combobox\"]",
|
|
359
|
-
"[role=\"listbox\"]",
|
|
360
|
-
"[role=\"slider\"]",
|
|
361
|
-
"[role=\"spinbutton\"]"
|
|
362
|
-
].join(",");
|
|
363
|
-
const CONTROLLED_ATTRS = /* @__PURE__ */ new Set([
|
|
364
|
-
"class",
|
|
365
|
-
"style",
|
|
366
|
-
"role",
|
|
367
|
-
"aria-current",
|
|
368
|
-
"aria-disabled",
|
|
369
|
-
"aria-selected"
|
|
370
|
-
]);
|
|
371
|
-
const attrs = useAttrs();
|
|
372
|
-
const slots = useSlots();
|
|
373
|
-
const root = useTemplateRef("root");
|
|
374
|
-
function isRenderable(value) {
|
|
375
|
-
return value != null && value !== "";
|
|
376
|
-
}
|
|
377
|
-
function isInteractiveElement(element) {
|
|
378
|
-
return element.matches(INTERACTIVE_SELECTOR) && !element.matches("[aria-readonly=\"true\"]");
|
|
379
|
-
}
|
|
380
|
-
function toElement(value) {
|
|
381
|
-
if (value == null) return null;
|
|
382
|
-
if (value instanceof HTMLElement) return value;
|
|
383
|
-
return value.$el instanceof HTMLElement ? value.$el : null;
|
|
384
|
-
}
|
|
385
|
-
const element = computed(() => toElement(root.value));
|
|
386
|
-
const descriptionIdBase = `astryx-item-description-${useId()}`;
|
|
387
|
-
const hasDescription = computed(() => slots.description != null || isRenderable(props.description));
|
|
388
|
-
const hasLabel = computed(() => slots.label != null || isRenderable(props.label));
|
|
389
|
-
const { trailing, shownLabelId } = useItemSlotsFromWrapper(`astryx-item-label-${useId()}`, hasLabel);
|
|
390
|
-
const listRow = readLayerScoped(itemListRowKey);
|
|
391
|
-
const isListRow = listRow != null;
|
|
392
|
-
provide(itemListRowKey, null);
|
|
393
|
-
provide(itemDescriptionContextKey, computed(() => hasDescription.value ? descriptionIdBase : null));
|
|
394
|
-
const role = computed(() => attrs.role);
|
|
395
|
-
const hasParentRole = computed(() => role.value != null);
|
|
396
|
-
const allowsAriaSelected = computed(() => role.value != null && ARIA_SELECTED_ROLES.has(role.value));
|
|
397
|
-
const ariaCurrent = computed(() => attrs["aria-current"] ?? (props.isSelected && !allowsAriaSelected.value ? true : void 0));
|
|
398
|
-
const isDelegate = computed(() => props.interactiveRef != null);
|
|
399
|
-
/** `javascript:` 这类地址不交给浏览器,行也就不是链接。 */
|
|
400
|
-
const safeHref = computed(() => {
|
|
401
|
-
const href = props.href;
|
|
402
|
-
return href != null && href !== "" && isSafeUrl(href) ? href : void 0;
|
|
403
|
-
});
|
|
404
|
-
const isInteractive = computed(() => props.onClick != null || safeHref.value != null || isDelegate.value);
|
|
405
|
-
/** 链接内容用的根组件:`as` 写了组件就用它,否则用 LinkProvider 给的默认值。 */
|
|
406
|
-
/**
|
|
407
|
-
* 读屏器在拿到焦点的元素上念「当前」标记。可点的行里那是行自己的按钮、链接,
|
|
408
|
-
* 或它转发点击的控件;根元素自己拿焦点的行(带父级角色)把标记留在根上。
|
|
409
|
-
*/
|
|
410
|
-
const currentOnFocusTarget = computed(() => !hasParentRole.value && (isDelegate.value || safeHref.value != null || props.onClick != null));
|
|
411
|
-
/** 控件上不写 `false`。 */
|
|
412
|
-
const controlCurrent = computed(() => {
|
|
413
|
-
const value = ariaCurrent.value;
|
|
414
|
-
return value === false || value === "false" ? void 0 : value;
|
|
415
|
-
});
|
|
416
|
-
const customLink = computed(() => typeof props.as === "string" ? linkComponent.value : props.as);
|
|
417
|
-
const isLinkContent = computed(() => safeHref.value != null && customLink.value != null);
|
|
418
|
-
const { pressActionProps } = usePressFeedback({
|
|
419
|
-
hasOverlay: false,
|
|
420
|
-
isContainer: true
|
|
421
|
-
});
|
|
422
|
-
const pressable = computed(() => isInteractive.value && !props.isDisabled);
|
|
423
|
-
/**
|
|
424
|
-
* 行自己有动作(点击、链接、或把点击转给嵌套控件)时,它是可按容器:
|
|
425
|
-
* 手指按在行里别的控件上,那一下不执行行的动作,行就不亮。带父级角色的行(选项、菜单项)整行就是动作。
|
|
426
|
-
*/
|
|
427
|
-
const isPressContainer = computed(() => pressable.value && (isDelegate.value || !hasParentRole.value));
|
|
428
|
-
const resolvedTarget = computed(() => props.target);
|
|
429
|
-
const resolvedRel = computed(() => {
|
|
430
|
-
const tokens = new Set((props.rel ?? "").split(/\s+/).filter(Boolean));
|
|
431
|
-
if (resolvedTarget.value === "_blank") {
|
|
432
|
-
tokens.add("noopener");
|
|
433
|
-
tokens.add("noreferrer");
|
|
434
|
-
}
|
|
435
|
-
return tokens.size > 0 ? [...tokens].join(" ") : void 0;
|
|
436
|
-
});
|
|
437
|
-
const isInline = computed(() => props.layout === "inline" && hasDescription.value);
|
|
438
|
-
function clampClass(lines) {
|
|
439
|
-
if (lines === 1) return "astryx-item__ellipsis";
|
|
440
|
-
return lines > 1 ? "astryx-item__clamp" : void 0;
|
|
441
|
-
}
|
|
442
|
-
function clampStyle(lines) {
|
|
443
|
-
return lines > 1 ? { "--astryx-item-clamp-lines": String(lines) } : void 0;
|
|
444
|
-
}
|
|
445
|
-
const labelClamp = computed(() => props.labelLines ?? (typeof props.label === "string" ? 1 : 0));
|
|
446
|
-
const descriptionClamp = computed(() => {
|
|
447
|
-
if (props.descriptionLines != null) return props.descriptionLines;
|
|
448
|
-
return typeof props.description === "string" || isInline.value ? 1 : 0;
|
|
449
|
-
});
|
|
450
|
-
const labelClasses = computed(() => clampClass(labelClamp.value));
|
|
451
|
-
const labelStyle = computed(() => clampStyle(labelClamp.value));
|
|
452
|
-
const descriptionClasses = computed(() => clampClass(descriptionClamp.value));
|
|
453
|
-
const descriptionStyle = computed(() => clampStyle(descriptionClamp.value));
|
|
454
|
-
useFocusAcrossSwap(() => element.value, ".astryx-item__content", () => props.isDisabled);
|
|
455
|
-
const contentRole = useInteractiveRole({
|
|
456
|
-
href: () => hasParentRole.value || isDelegate.value ? void 0 : safeHref.value,
|
|
457
|
-
hasOnClick: () => !hasParentRole.value && !isDelegate.value && props.onClick != null
|
|
458
|
-
});
|
|
459
|
-
const contentTag = computed(() => {
|
|
460
|
-
if (contentRole.role.value === "link") return isLinkContent.value && !props.isDisabled ? toRaw(customLink.value) : "a";
|
|
461
|
-
return contentRole.role.value === "button" ? "button" : "span";
|
|
462
|
-
});
|
|
463
|
-
function handleContentClick(event) {
|
|
464
|
-
props.onClick?.(event);
|
|
465
|
-
}
|
|
466
|
-
const baseContentAttrs = computed(() => {
|
|
467
|
-
const href = safeHref.value;
|
|
468
|
-
if (href != null && !hasParentRole.value && !isDelegate.value) {
|
|
469
|
-
if (props.isDisabled) return {
|
|
470
|
-
"role": "link",
|
|
471
|
-
"aria-disabled": true,
|
|
472
|
-
"tabindex": 0,
|
|
473
|
-
...pressActionProps
|
|
474
|
-
};
|
|
475
|
-
return {
|
|
476
|
-
href,
|
|
477
|
-
to: isLinkContent.value ? href : void 0,
|
|
478
|
-
rel: resolvedRel.value,
|
|
479
|
-
target: resolvedTarget.value,
|
|
480
|
-
...pressActionProps
|
|
481
|
-
};
|
|
482
|
-
}
|
|
483
|
-
if (contentTag.value === "button") {
|
|
484
|
-
if (props.isDisabled) return {
|
|
485
|
-
"type": "button",
|
|
486
|
-
"aria-disabled": true,
|
|
487
|
-
...disabledInteractionProps(),
|
|
488
|
-
...pressActionProps
|
|
489
|
-
};
|
|
490
|
-
return {
|
|
491
|
-
type: "button",
|
|
492
|
-
onClick: handleContentClick,
|
|
493
|
-
...pressActionProps
|
|
494
|
-
};
|
|
495
|
-
}
|
|
496
|
-
return {};
|
|
497
|
-
});
|
|
498
|
-
const contentAttrs = computed(() => {
|
|
499
|
-
const current = currentOnFocusTarget.value && !isDelegate.value ? { "aria-current": controlCurrent.value } : {};
|
|
500
|
-
return {
|
|
501
|
-
...baseContentAttrs.value,
|
|
502
|
-
...current
|
|
503
|
-
};
|
|
504
|
-
});
|
|
505
|
-
function hasTextSelection(node) {
|
|
506
|
-
const selection = node.ownerDocument.getSelection?.();
|
|
507
|
-
return selection != null && !selection.isCollapsed && selection.anchorNode != null && node.contains(selection.anchorNode);
|
|
508
|
-
}
|
|
509
|
-
function hasInteractiveAncestor(target, container) {
|
|
510
|
-
let current = target;
|
|
511
|
-
while (current != null && current !== container && current !== container.ownerDocument.body) {
|
|
512
|
-
if (isInteractiveElement(current) || isLayerSurface(current)) return true;
|
|
513
|
-
current = current.parentElement;
|
|
514
|
-
}
|
|
515
|
-
return false;
|
|
516
|
-
}
|
|
517
|
-
/** 点按落在行的内边距或粗指针的热区上时,转给行里的链接(带着修饰键,Cmd/Ctrl 点击照样新开标签页)。 */
|
|
518
|
-
function followRowLink(event) {
|
|
519
|
-
const row = event.currentTarget;
|
|
520
|
-
const anchor = row.querySelector("a.astryx-item__content, .astryx-item__content[role=\"link\"]");
|
|
521
|
-
if (anchor == null || event.target !== row || event.detail === 0) return;
|
|
522
|
-
const box = row.getBoundingClientRect();
|
|
523
|
-
if (!(event.clientX < box.left || event.clientX > box.right || event.clientY < box.top || event.clientY > box.bottom) && !isCoarsePointer(row.ownerDocument.defaultView)) return;
|
|
524
|
-
anchor.dispatchEvent(new MouseEvent("click", {
|
|
525
|
-
altKey: event.altKey,
|
|
526
|
-
bubbles: true,
|
|
527
|
-
button: event.button,
|
|
528
|
-
cancelable: true,
|
|
529
|
-
ctrlKey: event.ctrlKey,
|
|
530
|
-
metaKey: event.metaKey,
|
|
531
|
-
shiftKey: event.shiftKey
|
|
532
|
-
}));
|
|
533
|
-
}
|
|
534
|
-
function handleContainerClick(event) {
|
|
535
|
-
if (props.isDisabled) return;
|
|
536
|
-
const target = event.target;
|
|
537
|
-
if (isListRow && props.onClick == null && safeHref.value != null) {
|
|
538
|
-
followRowLink(event);
|
|
539
|
-
return;
|
|
540
|
-
}
|
|
541
|
-
if (target instanceof HTMLElement && target.closest(NATIVE_CONTROL_SELECTOR) != null) return;
|
|
542
|
-
if (target instanceof Element && isInLayerSurface(target, event.currentTarget)) return;
|
|
543
|
-
props.onClick?.(event);
|
|
544
|
-
}
|
|
545
|
-
function handleDelegatedClick(event) {
|
|
546
|
-
if (props.isDisabled) return;
|
|
547
|
-
const container = element.value;
|
|
548
|
-
const target = event.target;
|
|
549
|
-
if (container == null || !(target instanceof HTMLElement)) return;
|
|
550
|
-
if (hasTextSelection(container)) return;
|
|
551
|
-
if (target !== event.currentTarget && hasInteractiveAncestor(target, container)) return;
|
|
552
|
-
const control = toValue(props.interactiveRef);
|
|
553
|
-
if (control == null) return;
|
|
554
|
-
control.dispatchEvent(new MouseEvent("click", {
|
|
555
|
-
altKey: event.altKey,
|
|
556
|
-
bubbles: event.bubbles,
|
|
557
|
-
button: event.button,
|
|
558
|
-
cancelable: event.cancelable,
|
|
559
|
-
ctrlKey: event.ctrlKey,
|
|
560
|
-
metaKey: event.metaKey,
|
|
561
|
-
shiftKey: event.shiftKey
|
|
562
|
-
}));
|
|
563
|
-
event.stopPropagation();
|
|
564
|
-
}
|
|
565
|
-
useDelegatedControl({
|
|
566
|
-
control: () => isDelegate.value ? toValue(props.interactiveRef) : null,
|
|
567
|
-
current: () => currentOnFocusTarget.value ? controlCurrent.value : void 0,
|
|
568
|
-
pressAttributes: pressActionProps
|
|
569
|
-
});
|
|
570
|
-
const SWIPE_BLOCKED_ROLES = /* @__PURE__ */ new Set([
|
|
571
|
-
"option",
|
|
572
|
-
"menuitem",
|
|
573
|
-
"menuitemcheckbox",
|
|
574
|
-
"menuitemradio"
|
|
575
|
-
]);
|
|
576
|
-
const swipeBehavior = computed(() => props.swipeBehavior ?? "reveal");
|
|
577
|
-
const leadingActions = computed(() => {
|
|
578
|
-
const actions = props.swipeActions?.leading ?? [];
|
|
579
|
-
return swipeBehavior.value === "commit" ? actions.slice(-1) : actions;
|
|
580
|
-
});
|
|
581
|
-
const trailingActions = computed(() => {
|
|
582
|
-
const actions = props.swipeActions?.trailing ?? [];
|
|
583
|
-
return swipeBehavior.value === "commit" ? actions.slice(-1) : actions;
|
|
584
|
-
});
|
|
585
|
-
const swipeEnabled = computed(() => {
|
|
586
|
-
if (props.isDisabled || isDelegate.value) return false;
|
|
587
|
-
if (role.value != null && SWIPE_BLOCKED_ROLES.has(role.value)) return false;
|
|
588
|
-
return leadingActions.value.length + trailingActions.value.length > 0;
|
|
589
|
-
});
|
|
590
|
-
const swipe = useItemSwipe({
|
|
591
|
-
root: element,
|
|
592
|
-
enabled: swipeEnabled,
|
|
593
|
-
behavior: swipeBehavior,
|
|
594
|
-
leading: leadingActions,
|
|
595
|
-
trailing: trailingActions
|
|
596
|
-
});
|
|
597
|
-
/** 横滑的行把内容放进一块会跟手平移的表面里。 */
|
|
598
|
-
const Surface = (_, { slots: inner }) => swipeEnabled.value ? h("div", { class: "astryx-item__surface" }, inner.default?.()) : inner.default?.();
|
|
599
|
-
/** 有序列表的行把标记之外的内容收进同一格,列表据此让所有行共用一列标记。 */
|
|
600
|
-
const MarkerCell = (_, { slots: inner }) => listRow?.isNumbered.value === true && slots.marker != null ? h("span", { class: "astryx-item__marker-content" }, inner.default?.()) : inner.default?.();
|
|
601
|
-
const rootClick = computed(() => {
|
|
602
|
-
if (isDelegate.value) return handleDelegatedClick;
|
|
603
|
-
if (hasParentRole.value) return props.onClick;
|
|
604
|
-
return isInteractive.value ? handleContainerClick : void 0;
|
|
605
|
-
});
|
|
606
|
-
const rootClass = computed(() => [
|
|
607
|
-
"astryx-item",
|
|
608
|
-
swipeEnabled.value && "astryx-item--swipe",
|
|
609
|
-
isDelegate.value && "astryx-item--delegate",
|
|
610
|
-
attrs.class
|
|
611
|
-
]);
|
|
612
|
-
const forwardedAttrs = computed(() => Object.fromEntries(Object.entries(attrs).filter(([key]) => !CONTROLLED_ATTRS.has(key))));
|
|
613
|
-
function focus(options) {
|
|
614
|
-
(element.value?.querySelector("a[href], button:not([disabled])"))?.focus(options);
|
|
615
|
-
}
|
|
616
|
-
function blur() {
|
|
617
|
-
const active = element.value?.ownerDocument.activeElement;
|
|
618
|
-
if (active instanceof HTMLElement && element.value?.contains(active)) active.blur();
|
|
619
|
-
}
|
|
620
|
-
__expose({
|
|
621
|
-
element,
|
|
622
|
-
focus,
|
|
623
|
-
blur
|
|
624
|
-
});
|
|
625
|
-
return (_ctx, _cache) => {
|
|
626
|
-
return openBlock(), createBlock(resolveDynamicComponent(__props.as), mergeProps({
|
|
627
|
-
ref_key: "root",
|
|
628
|
-
ref: root
|
|
629
|
-
}, forwardedAttrs.value, {
|
|
630
|
-
"aria-current": currentOnFocusTarget.value ? void 0 : ariaCurrent.value,
|
|
631
|
-
"aria-disabled": __props.isDisabled || void 0,
|
|
632
|
-
"aria-selected": allowsAriaSelected.value && __props.isSelected ? true : void 0,
|
|
633
|
-
class: rootClass.value,
|
|
634
|
-
"data-align": __props.align,
|
|
635
|
-
"data-density": __props.density,
|
|
636
|
-
"data-disabled": __props.isDisabled || void 0,
|
|
637
|
-
"data-highlighted": __props.isHighlighted || void 0,
|
|
638
|
-
"data-inert": __props.isDisabled && !hasParentRole.value ? true : void 0,
|
|
639
|
-
"data-interactive": isInteractive.value || void 0,
|
|
640
|
-
"data-selected": __props.isSelected || void 0,
|
|
641
|
-
"data-astryx-pressable": pressable.value ? "" : void 0,
|
|
642
|
-
"data-astryx-press-container": isPressContainer.value ? "" : void 0,
|
|
643
|
-
"data-swipe": swipeEnabled.value ? unref(swipe).phase.value : void 0,
|
|
644
|
-
role: role.value,
|
|
645
|
-
style: unref(attrs).style,
|
|
646
|
-
onPointerdown: unref(swipe).onPointerDown,
|
|
647
|
-
onClickCapture: unref(swipe).onClickCapture,
|
|
648
|
-
onKeydown: unref(swipe).onKeyDown,
|
|
649
|
-
onClick: rootClick.value
|
|
650
|
-
}), {
|
|
651
|
-
default: withCtx(() => [swipeEnabled.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [leadingActions.value.length ? (openBlock(), createBlock(_sfc_main$1, {
|
|
652
|
-
key: 0,
|
|
653
|
-
side: "leading",
|
|
654
|
-
actions: leadingActions.value,
|
|
655
|
-
phase: unref(swipe).phase.value,
|
|
656
|
-
onActivate: unref(swipe).activate
|
|
657
|
-
}, null, 8, [
|
|
658
|
-
"actions",
|
|
659
|
-
"phase",
|
|
660
|
-
"onActivate"
|
|
661
|
-
])) : createCommentVNode("v-if", true), trailingActions.value.length ? (openBlock(), createBlock(_sfc_main$1, {
|
|
662
|
-
key: 1,
|
|
663
|
-
side: "trailing",
|
|
664
|
-
actions: trailingActions.value,
|
|
665
|
-
phase: unref(swipe).phase.value,
|
|
666
|
-
onActivate: unref(swipe).activate
|
|
667
|
-
}, null, 8, [
|
|
668
|
-
"actions",
|
|
669
|
-
"phase",
|
|
670
|
-
"onActivate"
|
|
671
|
-
])) : createCommentVNode("v-if", true)], 64)) : createCommentVNode("v-if", true), createVNode(Surface, null, {
|
|
672
|
-
default: withCtx(() => [renderSlot(_ctx.$slots, "marker"), createVNode(MarkerCell, null, {
|
|
673
|
-
default: withCtx(() => [
|
|
674
|
-
_ctx.$slots.startContent ? (openBlock(), createElementBlock("span", _hoisted_1, [renderSlot(_ctx.$slots, "startContent")])) : createCommentVNode("v-if", true),
|
|
675
|
-
(openBlock(), createBlock(resolveDynamicComponent(contentTag.value), mergeProps(contentAttrs.value, { class: ["astryx-item__content", { "astryx-item__content--inline": isInline.value }] }), {
|
|
676
|
-
default: withCtx(() => [hasLabel.value ? (openBlock(), createElementBlock("span", {
|
|
677
|
-
key: 0,
|
|
678
|
-
id: unref(shownLabelId) ?? void 0,
|
|
679
|
-
class: normalizeClass(["astryx-item__label", labelClasses.value]),
|
|
680
|
-
style: normalizeStyle(labelStyle.value)
|
|
681
|
-
}, [renderSlot(_ctx.$slots, "label", {}, () => [createTextVNode(toDisplayString(__props.label), 1)])], 14, _hoisted_2)) : createCommentVNode("v-if", true), hasDescription.value ? (openBlock(), createElementBlock("span", {
|
|
682
|
-
key: 1,
|
|
683
|
-
id: descriptionIdBase,
|
|
684
|
-
class: normalizeClass(["astryx-item__description", descriptionClasses.value]),
|
|
685
|
-
style: normalizeStyle(descriptionStyle.value)
|
|
686
|
-
}, [renderSlot(_ctx.$slots, "description", {}, () => [createTextVNode(toDisplayString(__props.description), 1)])], 6)) : createCommentVNode("v-if", true)]),
|
|
687
|
-
_: 3
|
|
688
|
-
}, 16, ["class"])),
|
|
689
|
-
_ctx.$slots.endContent ? (openBlock(), createElementBlock("span", _hoisted_3, [renderSlot(_ctx.$slots, "endContent")])) : createCommentVNode("v-if", true),
|
|
690
|
-
unref(trailing) ? (openBlock(), createBlock(resolveDynamicComponent(unref(trailing)), { key: 2 })) : createCommentVNode("v-if", true)
|
|
691
|
-
]),
|
|
692
|
-
_: 3
|
|
693
|
-
})]),
|
|
694
|
-
_: 3
|
|
695
|
-
})]),
|
|
696
|
-
_: 3
|
|
697
|
-
}, 16, [
|
|
698
|
-
"aria-current",
|
|
699
|
-
"aria-disabled",
|
|
700
|
-
"aria-selected",
|
|
701
|
-
"class",
|
|
702
|
-
"data-align",
|
|
703
|
-
"data-density",
|
|
704
|
-
"data-disabled",
|
|
705
|
-
"data-highlighted",
|
|
706
|
-
"data-inert",
|
|
707
|
-
"data-interactive",
|
|
708
|
-
"data-selected",
|
|
709
|
-
"data-astryx-pressable",
|
|
710
|
-
"data-astryx-press-container",
|
|
711
|
-
"data-swipe",
|
|
712
|
-
"role",
|
|
713
|
-
"style",
|
|
714
|
-
"onPointerdown",
|
|
715
|
-
"onClickCapture",
|
|
716
|
-
"onKeydown",
|
|
717
|
-
"onClick"
|
|
718
|
-
]);
|
|
719
|
-
};
|
|
720
|
-
}
|
|
721
|
-
});
|
|
722
|
-
//#endregion
|
|
723
|
-
export { _sfc_main as t };
|