@astryx-vue/core 0.9.1 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -1
- package/dist/AppShell/index.d.ts +1 -1
- package/dist/AvatarGroup/index.d.ts +1 -1
- package/dist/Banner/index.d.ts +1 -1
- package/dist/BottomSheet/index.d.ts +1 -1
- package/dist/Breadcrumbs/index.js +1 -1
- package/dist/{Breadcrumbs-CrqG4fGx.js → Breadcrumbs-Dxjz2Dxn.js} +1 -1
- package/dist/Button/index.d.ts +1 -1
- package/dist/ButtonGroup/index.d.ts +1 -1
- package/dist/Calendar/index.d.ts +1 -1
- package/dist/Card/index.d.ts +1 -1
- package/dist/Carousel/index.d.ts +1 -1
- package/dist/Chat/index.d.ts +1 -1
- package/dist/Chat/index.js +1 -1
- package/dist/{Chat-Bl_Wr2lK.js → Chat-Bz9KRyug.js} +1 -1
- package/dist/CheckboxInput/index.d.ts +1 -1
- package/dist/CheckboxList/index.d.ts +1 -1
- package/dist/ClickableCard/index.d.ts +1 -1
- package/dist/Code/index.d.ts +1 -1
- package/dist/Collapsible/index.d.ts +1 -1
- package/dist/CommandPalette/index.d.ts +1 -1
- package/dist/ContextMenu/index.d.ts +1 -1
- package/dist/ContextMenu/index.js +1 -1
- package/dist/{ContextMenu-DN_nTBgW.js → ContextMenu-6AnjpPJg.js} +119 -142
- package/dist/DateInput/index.d.ts +1 -1
- package/dist/DateRangeInput/index.d.ts +1 -1
- package/dist/DateTimeInput/index.d.ts +1 -1
- package/dist/Dialog/index.d.ts +1 -1
- package/dist/Drawer/index.d.ts +1 -1
- package/dist/DropdownMenu/index.js +2 -2
- package/dist/{DropdownMenu-B758ASzK.js → DropdownMenu-B9eUWp_X.js} +23 -41
- package/dist/{DropdownMenu-D_KdcZCL.js → DropdownMenu-DJK_xIUd.js} +3 -5
- package/dist/FileInput/index.d.ts +1 -1
- package/dist/HoverCard/index.d.ts +1 -1
- package/dist/HoverCard/index.js +1 -1
- package/dist/{HoverCard-CLcbBLBN.js → HoverCard-3S3axq-o.js} +2 -39
- package/dist/InfoTip/index.d.ts +1 -1
- package/dist/Link/index.d.ts +1 -1
- package/dist/List/index.d.ts +1 -1
- package/dist/MoreMenu/index.d.ts +1 -1
- package/dist/MoreMenu/index.js +1 -1
- package/dist/{MoreMenu-1lxF-JY5.js → MoreMenu-DaLb4bgr.js} +1 -24
- package/dist/MultiSelector/index.d.ts +1 -1
- package/dist/NavItem/index.d.ts +1 -1
- package/dist/NavMenu/index.js +1 -1
- package/dist/{NavMenu-C5BgRNpG.js → NavMenu-ChlWdHfi.js} +1 -1
- package/dist/NumberInput/index.d.ts +1 -1
- package/dist/OverflowList/index.d.ts +1 -1
- package/dist/Overlay/index.d.ts +1 -1
- package/dist/Pagination/index.d.ts +1 -1
- package/dist/Popover/index.d.ts +1 -1
- package/dist/PowerSearch/index.d.ts +1 -1
- package/dist/ProgressBar/index.d.ts +1 -1
- package/dist/Radio/index.d.ts +1 -1
- package/dist/RadioList/index.d.ts +1 -1
- package/dist/ScrollableArea/index.d.ts +1 -1
- package/dist/SelectableCard/index.d.ts +1 -1
- package/dist/Selector/index.d.ts +1 -1
- package/dist/SideNav/index.d.ts +1 -1
- package/dist/Switch/index.d.ts +1 -1
- package/dist/TabList/index.d.ts +1 -1
- package/dist/Table/index.d.ts +1 -1
- package/dist/TextArea/index.d.ts +1 -1
- package/dist/TextInput/index.d.ts +1 -1
- package/dist/TimeInput/index.d.ts +1 -1
- package/dist/Timestamp/index.d.ts +1 -1
- package/dist/Timestamp/index.js +1 -1
- package/dist/{Timestamp-B7H0KScU.js → Timestamp-DWnbOvnI.js} +1 -1
- package/dist/ToggleButton/index.d.ts +1 -1
- package/dist/Tokenizer/index.d.ts +1 -1
- 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/TreeList/index.js +1 -1
- package/dist/{TreeList-DeknLfbQ.js → TreeList-CRMLcaRx.js} +11 -5
- package/dist/composables/index.js +3 -2
- package/dist/{composables-CF4EnyHW.js → composables-JBLeessI.js} +1 -145
- package/dist/{index-Cun6cXGP.d.ts → index--tm6L1ot.d.ts} +1 -1
- package/dist/{index-O_KX_p13.d.ts → index-1dm_6bEx.d.ts} +4 -4
- package/dist/{index-TXcNH86P.d.ts → index-B1eCxBCY.d.ts} +1 -1
- package/dist/{index-CsxZ8Jr0.d.ts → index-B8K2sDmO.d.ts} +2 -2
- package/dist/{index-MEix_m1o.d.ts → index-BAC56Bhr.d.ts} +1 -1
- package/dist/{index-wY6dKz6c.d.ts → index-BEZ4ezJk.d.ts} +2 -2
- package/dist/{index-BxWCX2pJ.d.ts → index-BOCb89V9.d.ts} +1 -1
- package/dist/{index-DZKv1WNB.d.ts → index-BZchpRgm.d.ts} +2 -2
- package/dist/{index-CTjkJP4x.d.ts → index-Bgk1Rj2A.d.ts} +1 -1
- package/dist/{index-PsawGBwC.d.ts → index-Bn-v89Vt.d.ts} +3 -3
- package/dist/{index-BDZCJ9ri.d.ts → index-BuubzuE8.d.ts} +2 -2
- package/dist/{index-DTfA4uE3.d.ts → index-BzZC2Y7c.d.ts} +1 -1
- package/dist/{index-Bnj1hZmL.d.ts → index-CuDsVeop.d.ts} +1 -1
- package/dist/{index-5WZNQzWs.d.ts → index-DG7FmGCE.d.ts} +4 -4
- package/dist/{index-B449gOMC.d.ts → index-DMcf0QeR.d.ts} +1 -1
- package/dist/{index-CuTGi_CF.d.ts → index-DTQSrLdD.d.ts} +44 -44
- package/dist/{index-dWlCpnua.d.ts → index-Dlq0cFK-.d.ts} +3 -3
- package/dist/{index-B3yTdknp.d.ts → index-KcCNhdAw.d.ts} +1 -1
- package/dist/{index-C1C7wOAU.d.ts → index-PRGBAtll.d.ts} +4 -4
- package/dist/{index-CdvmnNMH.d.ts → index-YKCx03zD.d.ts} +1 -1
- package/dist/{index-Dg0JsBpI.d.ts → index-o00Upzjp.d.ts} +1 -1
- package/dist/{index-CLHJybQY.d.ts → index-ul1hNxih.d.ts} +1 -1
- package/dist/{index-Dy746dfn.d.ts → index-unAZVFGz.d.ts} +1 -1
- package/dist/index.d.ts +23 -23
- package/dist/index.js +13 -12
- package/dist/menuActivation-BqiaK6ot.js +27 -0
- package/dist/typeaheadMatch-Cl-oxKFt.js +78 -0
- package/dist/useTouchTrigger-GGd85Obb.js +146 -0
- package/dist/{useTypeahead-DXnNlISe.js → useTypeahead-DSMObTtg.js} +10 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -24,7 +24,7 @@ import { n as useAsyncSource, t as createStaticSource } from "./useAsyncSource-G
|
|
|
24
24
|
import { n as CHAT_MESSAGE_CLASS, r as useChatNewMessages, t as useChatStreamScroll } from "./useChatStreamScroll-oDfybEos.js";
|
|
25
25
|
import { t as useClipboard } from "./useClipboard-i4a_x_Io.js";
|
|
26
26
|
import { t as useCombobox } from "./useCombobox-CTo5C-gc.js";
|
|
27
|
-
import { a as
|
|
27
|
+
import { a as useIndicatorFocusRing, c as useImageMode, d as useEntryAnimation, f as useControllableState, i as useKeyboardHint, l as useGridRovingFocus, n as useStreamingText, o as imageModeFromPixels, p as useContainerReveal, r as useSnapPaging, s as perceptualLightness, t as snapToGraphemeBoundary, u as useGridFocus } from "./composables-JBLeessI.js";
|
|
28
28
|
import { n as resolveDateSurface, t as resolveDatePresentation } from "./useDatePresentation-C07PnOCw.js";
|
|
29
29
|
import { a as isRangeWithinSpan, c as resolveWeekStart, i as isDayOutsideSpan, l as spanDays, n as compareISODate, o as isSameRange, r as formatDateRange, s as orderRange, t as applyRangeClick } from "./useDateRange-CIXoE_8k.js";
|
|
30
30
|
import { n as useDevWarning, t as devWarn } from "./useDevWarning-B2fsk2B-.js";
|
|
@@ -54,7 +54,8 @@ import { t as useScrollableArea } from "./useScrollableArea-BE8b3qm7.js";
|
|
|
54
54
|
import { t as useScrollLock } from "./scrollLock-C3aT4-0z.js";
|
|
55
55
|
import { t as useScrollOverflow } from "./useScrollOverflow-DuMoGXmm.js";
|
|
56
56
|
import { a as parseISOTime, i as parseDisplayTime, n as formatISOTime, o as resolveTimeSurface, r as isTimeInRange, s as shiftTime, t as formatDisplayTime } from "./useTimeValue-BJd0xBhG.js";
|
|
57
|
-
import { t as
|
|
57
|
+
import { n as useTouchTrigger, t as isActionTrigger } from "./useTouchTrigger-GGd85Obb.js";
|
|
58
|
+
import { t as useTypeahead } from "./useTypeahead-DSMObTtg.js";
|
|
58
59
|
import { t as _sfc_main$69 } from "./Dialog-BtPktuiy.js";
|
|
59
60
|
import { t as useTooltip } from "./useTooltip-D8Tq7-yd.js";
|
|
60
61
|
import { t as _sfc_main$188 } from "./Tooltip-CGHpFMnc.js";
|
|
@@ -85,11 +86,11 @@ import { t as _sfc_main$12 } from "./BottomSheet-BECeWtEy.js";
|
|
|
85
86
|
import { i as useListContext, r as useItemDescriptionId, t as _sfc_main$97 } from "./Item-Cfv4ALls.js";
|
|
86
87
|
import { t as _sfc_main$43 } from "./CheckboxIndicator-fH4d-JE1.js";
|
|
87
88
|
import { a as _sfc_main$14, c as useDropdownMenuRadioGroup, d as useContextMenu, f as useContextMenuSize, i as _sfc_main$15, r as _sfc_main$16, s as useDropdownMenuContext } from "./useMenuDrillIn-uQtOSny6.js";
|
|
88
|
-
import {
|
|
89
|
+
import { a as _sfc_main$77, o as _sfc_main$76, s as _sfc_main$75, t as _sfc_main$74 } from "./DropdownMenu-B9eUWp_X.js";
|
|
89
90
|
import { t as _sfc_main$71 } from "./Divider-mOZ6vIQw.js";
|
|
90
91
|
import { t as dropdownMenuMessages } from "./dropdown-menu-BDu4gWwQ.js";
|
|
91
92
|
import { r as resolveNavRoot } from "./link-DuuA2eCL.js";
|
|
92
|
-
import { n as _sfc_main$13, t as _sfc_main$17 } from "./Breadcrumbs-
|
|
93
|
+
import { n as _sfc_main$13, t as _sfc_main$17 } from "./Breadcrumbs-Dxjz2Dxn.js";
|
|
93
94
|
import { n as _sfc_main$19 } from "./ButtonGroup-CosYAili.js";
|
|
94
95
|
import { t as calendarMessages } from "./calendar-Cs2vIPsV.js";
|
|
95
96
|
import { t as _sfc_main$20 } from "./Calendar-DwFAzDky.js";
|
|
@@ -100,8 +101,8 @@ import { t as carouselMessages } from "./carousel-BHUqW44m.js";
|
|
|
100
101
|
import { t as _sfc_main$22 } from "./Carousel-BOlQQSju.js";
|
|
101
102
|
import { t as _sfc_main$23 } from "./Center-B7FTd7Hw.js";
|
|
102
103
|
import { t as chatMessages } from "./chat-mh_siWVp.js";
|
|
103
|
-
import { n as useHoverCard, t as _sfc_main$89 } from "./HoverCard-
|
|
104
|
-
import { C as useChatLayoutContext, D as pastedTextLabel, E as PASTE_TOKEN_THRESHOLD, O as useChatPasteAsToken, S as useChatComposerContext, T as useChatMessageContext, _ as _sfc_main$25, a as _sfc_main$39, b as _sfc_main$26, c as _sfc_main$35, d as _sfc_main$32, f as _sfc_main$31, g as _sfc_main$27, h as _sfc_main$28, i as _sfc_main$40, l as _sfc_main$34, m as _sfc_main$30, n as useSpeechRecognition, o as _sfc_main$38, p as _sfc_main$29, r as _sfc_main$41, s as _sfc_main$37, t as useChatDictation, u as _sfc_main$33, v as _sfc_main$24, w as useChatListContext, x as useChatComposerTokens, y as _sfc_main$36 } from "./Chat-
|
|
104
|
+
import { n as useHoverCard, t as _sfc_main$89 } from "./HoverCard-3S3axq-o.js";
|
|
105
|
+
import { C as useChatLayoutContext, D as pastedTextLabel, E as PASTE_TOKEN_THRESHOLD, O as useChatPasteAsToken, S as useChatComposerContext, T as useChatMessageContext, _ as _sfc_main$25, a as _sfc_main$39, b as _sfc_main$26, c as _sfc_main$35, d as _sfc_main$32, f as _sfc_main$31, g as _sfc_main$27, h as _sfc_main$28, i as _sfc_main$40, l as _sfc_main$34, m as _sfc_main$30, n as useSpeechRecognition, o as _sfc_main$38, p as _sfc_main$29, r as _sfc_main$41, s as _sfc_main$37, t as useChatDictation, u as _sfc_main$33, v as _sfc_main$24, w as useChatListContext, x as useChatComposerTokens, y as _sfc_main$36 } from "./Chat-Bz9KRyug.js";
|
|
105
106
|
import { t as spinnerMessages } from "./spinner-DVia-eDf.js";
|
|
106
107
|
import { t as _sfc_main$154 } from "./Spinner-DEVPDsD0.js";
|
|
107
108
|
import "./CheckboxIndicator/index.js";
|
|
@@ -131,7 +132,7 @@ import { t as popoverMessages } from "./popover-DxCyd_Ua.js";
|
|
|
131
132
|
import { n as usePopover, t as _sfc_main$131 } from "./Popover-cnfHz2tm.js";
|
|
132
133
|
import { n as _sfc_main$60 } from "./ComplexSelector-DFKi6sKq.js";
|
|
133
134
|
import { t as contextMenuMessages } from "./context-menu-9i6CObx3.js";
|
|
134
|
-
import { a as _sfc_main$62, i as _sfc_main$63, n as _sfc_main$65, r as _sfc_main$64, t as _sfc_main$61 } from "./ContextMenu-
|
|
135
|
+
import { a as _sfc_main$62, i as _sfc_main$63, n as _sfc_main$65, r as _sfc_main$64, t as _sfc_main$61 } from "./ContextMenu-6AnjpPJg.js";
|
|
135
136
|
import { t as dateInputMessages } from "./date-input-Bj3KSuoJ.js";
|
|
136
137
|
import { t as formatInstant } from "./formatInstant-BDWUIxS7.js";
|
|
137
138
|
import { t as _sfc_main$66 } from "./DateInput-CI1_FFPZ.js";
|
|
@@ -172,7 +173,7 @@ import { t as _sfc_main$70 } from "./DialogHeader-cr9rFLYM.js";
|
|
|
172
173
|
import { t as useImperativeDialog } from "./Dialog-B_s-w66_.js";
|
|
173
174
|
import "./Divider/index.js";
|
|
174
175
|
import { n as _sfc_main$72, t as _sfc_main$73 } from "./Drawer-Ba-yG1rk.js";
|
|
175
|
-
import { t as _sfc_main$78 } from "./DropdownMenu-
|
|
176
|
+
import { t as _sfc_main$78 } from "./DropdownMenu-DJK_xIUd.js";
|
|
176
177
|
import { t as _sfc_main$79 } from "./EmptyState-v1cvHKav.js";
|
|
177
178
|
import { t as _sfc_main$93 } from "./InputClearButton-BiF7qGMR.js";
|
|
178
179
|
import "./Field/index.js";
|
|
@@ -201,14 +202,14 @@ import { a as visitMarkdownNodes, i as defineMarkdownPlugin, n as applyInlinePlu
|
|
|
201
202
|
import { n as uniqueSlug, t as slugify } from "./slug-D6ln5PTq.js";
|
|
202
203
|
import { n as _sfc_main$112, t as _sfc_main$113 } from "./MetadataList-n3YXiP4a.js";
|
|
203
204
|
import "./MobileNav/index.js";
|
|
204
|
-
import { t as _sfc_main$116 } from "./MoreMenu-
|
|
205
|
+
import { t as _sfc_main$116 } from "./MoreMenu-DaLb4bgr.js";
|
|
205
206
|
import { t as _sfc_main$185 } from "./Token-CtG_XE6z.js";
|
|
206
207
|
import { n as SELECT_ALL_VALUE, r as flattenOptions, t as _sfc_main$117 } from "./MultiSelector-Slqiulwd.js";
|
|
207
208
|
import "./MultiSelector/index.js";
|
|
208
209
|
import { t as _sfc_main$121 } from "./NavItem-thEKXyJA.js";
|
|
209
210
|
import { t as _sfc_main$122 } from "./NavItem-BZLN0U5a.js";
|
|
210
211
|
import { t as _sfc_main$118 } from "./NavDisclosure-DG4jls5z.js";
|
|
211
|
-
import { n as _sfc_main$119, t as _sfc_main$120 } from "./NavMenu-
|
|
212
|
+
import { n as _sfc_main$119, t as _sfc_main$120 } from "./NavMenu-ChlWdHfi.js";
|
|
212
213
|
import { n as _sfc_main$123, t as _sfc_main$124 } from "./NavMenuItem-DIMQohIa.js";
|
|
213
214
|
import { t as _sfc_main$125 } from "./NumberInput-Bsz7bmRp.js";
|
|
214
215
|
import "./NumberInput/index.js";
|
|
@@ -259,7 +260,7 @@ import { a as normalizeTokenName, d as DATA_TOKEN_DEFAULTS, n as useTheme, t as
|
|
|
259
260
|
import { t as _sfc_main$177 } from "./Thumbnail-CTkLFo-A.js";
|
|
260
261
|
import "./TimeInput/index.js";
|
|
261
262
|
import { n as getPresentation, t as _sfc_main$179 } from "./Timer-BD2gSoQ3.js";
|
|
262
|
-
import { n as formatTooltipLines, r as formatRelativeTime, t as _sfc_main$180 } from "./Timestamp-
|
|
263
|
+
import { n as formatTooltipLines, r as formatRelativeTime, t as _sfc_main$180 } from "./Timestamp-DWnbOvnI.js";
|
|
263
264
|
import { n as _sfc_main$182, r as _sfc_main$181, t as useToast } from "./Toast-aI9QMW-L.js";
|
|
264
265
|
import { n as _sfc_main$184, r as _sfc_main$183 } from "./ToggleButton-DI9I-LBH.js";
|
|
265
266
|
import { t as TOKEN_COLORS } from "./Token-BdRzlXzm.js";
|
|
@@ -267,7 +268,7 @@ import "./Tokenizer/index.js";
|
|
|
267
268
|
import "./Toolbar/index.js";
|
|
268
269
|
import "./Tooltip/index.js";
|
|
269
270
|
import { a as _sfc_main$191, i as _sfc_main$192, n as _sfc_main$194, o as _sfc_main$190, r as _sfc_main$193, s as _sfc_main$189, t as _sfc_main$195 } from "./TopNav-zpU9w-mH.js";
|
|
270
|
-
import { n as useTreeFocus, t as _sfc_main$196 } from "./TreeList-
|
|
271
|
+
import { n as useTreeFocus, t as _sfc_main$196 } from "./TreeList-CRMLcaRx.js";
|
|
271
272
|
import "./Typeahead/index.js";
|
|
272
273
|
import { A as plainDateCreate, B as plainDateIsEqual, C as DATE_FORMAT_WITH_WEEKDAY, D as getTimeZoneParts, E as getDaysInMonth, F as plainDateFromISO, G as plainDateSetFirstOfMonth, H as plainDateMax, I as plainDateFromInstant, J as plainDateToISO, K as plainDateSetStartOfWeek, L as plainDateGetWeekNumber, M as plainDateDiffDays, N as plainDateFormat, O as plainDateAddDays, P as plainDateFromDate, Q as chainEventHandlers, R as plainDateIsAfter, S as DATE_FORMAT_WEEKDAY_ONLY, T as formatSharedDate, U as plainDateMin, V as plainDateIsInRange, W as plainDateSetEndOfWeekExclusive, X as plainDateToday, Y as plainDateToInstant, Z as plainDateWeekFieldName, _ as DATE_FORMAT_MONTH_ONLY, a as formatDisplayTime12h, b as DATE_FORMAT_SHORT_WITH_WEEKDAY, d as getItemGroup, f as groupItems, g as DATE_FORMAT_LONG, h as parseDateInput, i as createISOTimeString, j as plainDateDayOfWeek, k as plainDateAddMonths, l as getInputARIA, m as isLocaleDayFirst, n as clampTime, o as formatDisplayTime24h, p as normalizeDayOfWeek, q as plainDateToDate, r as compareTime, s as parseTimeInput, t as adjustTime, u as joinAriaIDs, v as DATE_FORMAT_MONTH_YEAR, w as SHARED_DATE_FORMAT_OPTIONS, x as DATE_FORMAT_SHORT_WITH_YEAR, y as DATE_FORMAT_SHORT, z as plainDateIsBefore } from "./utils-BOmFijPc.js";
|
|
273
274
|
import "./VisuallyHidden/index.js";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//#region src/composables/internal/menuActivation.ts
|
|
2
|
+
/**
|
|
3
|
+
* Whether a click carries a modifier or a non-primary button. On a row that is
|
|
4
|
+
* a link the browser gives such a click a meaning of its own, which the row
|
|
5
|
+
* must leave alone.
|
|
6
|
+
*/
|
|
7
|
+
function isModifiedClick(event) {
|
|
8
|
+
return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || (event.button ?? 0) !== 0;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Activate a row from the keyboard: a synthesized click that carries the key's
|
|
12
|
+
* modifiers, so a modified Enter on a link row opens the way a modified click
|
|
13
|
+
* would. `detail` stays 0, the mark of a non-pointer activation.
|
|
14
|
+
*/
|
|
15
|
+
function activateMenuItem(row, key) {
|
|
16
|
+
row.dispatchEvent(new MouseEvent("click", {
|
|
17
|
+
altKey: key.altKey,
|
|
18
|
+
bubbles: true,
|
|
19
|
+
cancelable: true,
|
|
20
|
+
composed: true,
|
|
21
|
+
ctrlKey: key.ctrlKey,
|
|
22
|
+
metaKey: key.metaKey,
|
|
23
|
+
shiftKey: key.shiftKey
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { isModifiedClick as n, activateMenuItem as t };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
//#region src/utils/typeaheadMatch.ts
|
|
2
|
+
/**
|
|
3
|
+
* 对应原版 Astryx 的 `utils/typeaheadMatch`:所有「敲字母跳到某一项」的路径共用的比对规则。
|
|
4
|
+
*
|
|
5
|
+
* 跳转是导航不是排序,所以在任何语言下都按同一套规则折叠:
|
|
6
|
+
* 不分大小写;去掉规范分解后留下的组合附加符号(U+0300–U+036F);
|
|
7
|
+
* 六个带横线的拉丁字母和土耳其语的 ı 当作对应的普通字母。
|
|
8
|
+
* 敲进来的字母本身带这些符号时,优先找完全对得上的那一项,大小写按土耳其语配对(ı 配 I,İ 配 i)。
|
|
9
|
+
*/
|
|
10
|
+
const COMBINING_MARKS = /[\u0300-\u036F]/g;
|
|
11
|
+
const STROKED = {
|
|
12
|
+
đ: "d",
|
|
13
|
+
Đ: "d",
|
|
14
|
+
ł: "l",
|
|
15
|
+
Ł: "l",
|
|
16
|
+
ø: "o",
|
|
17
|
+
Ø: "o",
|
|
18
|
+
ħ: "h",
|
|
19
|
+
Ħ: "h",
|
|
20
|
+
ŧ: "t",
|
|
21
|
+
Ŧ: "t",
|
|
22
|
+
ƀ: "b",
|
|
23
|
+
Ƀ: "b",
|
|
24
|
+
ı: "i"
|
|
25
|
+
};
|
|
26
|
+
const STROKED_CHARS = /[đłøħŧƀı]/gi;
|
|
27
|
+
const MARKED_CHARS = /[đłøħŧƀıİ]/i;
|
|
28
|
+
/** 按跳转规则折叠一段文字:不分大小写、去掉组合附加符号、带横线的字母和 ı 变成普通字母。和语言无关。 */
|
|
29
|
+
function foldForTypeahead(text) {
|
|
30
|
+
return text.normalize("NFD").replace(COMBINING_MARKS, "").replace(STROKED_CHARS, (char) => STROKED[char] ?? char).normalize("NFC").toLowerCase();
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 再敲一个键之后的缓冲。所有路径都用它,缓冲的方式才一致。
|
|
34
|
+
* 第一个键是单独的组合附加符号时返回 null:它不是能跳过去的字母。
|
|
35
|
+
* 反复敲同一个字母(按折叠后比)是在匹配项之间循环,缓冲保持那一个字母,不往长里加。
|
|
36
|
+
*/
|
|
37
|
+
function nextTypeaheadBuffer(buffer, key) {
|
|
38
|
+
if (buffer.length === 0 && key !== " " && foldForTypeahead(key).length === 0) return null;
|
|
39
|
+
return buffer.length > 0 && [...buffer].every((char) => foldForTypeahead(char) === foldForTypeahead(key)) ? key : buffer + key;
|
|
40
|
+
}
|
|
41
|
+
/** 完全匹配用的大小写折叠,按土耳其语配对:I 配 ı,İ 配 i。先合成,单独敲的附加符号和合成好的标签一样算一个字母。 */
|
|
42
|
+
function exactFold(text) {
|
|
43
|
+
return text.normalize("NFC").replace(/I/g, "ı").replace(/İ/g, "i").toLowerCase();
|
|
44
|
+
}
|
|
45
|
+
/** 敲进来的字母带不带「值得优先完全匹配」的符号。 */
|
|
46
|
+
function hasMark(typed) {
|
|
47
|
+
return MARKED_CHARS.test(typed) || /[\u0300-\u036F]/.test(typed.normalize("NFD"));
|
|
48
|
+
}
|
|
49
|
+
/** `label` 是否以 `typed` 开头(按折叠后比)。`exact` 时还要求没折叠的字母也对得上。 */
|
|
50
|
+
function typeaheadPrefixMatch(label, typed, exact = false) {
|
|
51
|
+
const trimmed = label.trim();
|
|
52
|
+
if (exact) return exactFold(trimmed).startsWith(exactFold(typed));
|
|
53
|
+
const foldedTyped = foldForTypeahead(typed);
|
|
54
|
+
if (foldedTyped.length === 0) return false;
|
|
55
|
+
return foldForTypeahead(trimmed).startsWith(foldedTyped);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 按 `order` 的顺序找下一个标签对得上的项,返回下标,找不到返回 -1。
|
|
59
|
+
* 敲进来的字母带附加符号、带横线的字母、ı 或 İ 时,顺序里任何一处完全匹配都优先于折叠后的匹配。
|
|
60
|
+
*/
|
|
61
|
+
function findTypeaheadMatch(order, getLabel, typed) {
|
|
62
|
+
const passes = hasMark(typed) ? [true, false] : [false];
|
|
63
|
+
for (const exact of passes) for (const index of order) {
|
|
64
|
+
const label = getLabel(index);
|
|
65
|
+
if (label != null && typeaheadPrefixMatch(label, typed, exact)) return index;
|
|
66
|
+
}
|
|
67
|
+
return -1;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* 这一下是不是 Control 或 Command 快捷键,而不是敲出来的字。
|
|
71
|
+
* Windows 上的 AltGr 也会报 Control,同时带 AltGraph 修饰键;它敲出来的是字母(例如 ł)。
|
|
72
|
+
*/
|
|
73
|
+
function isShortcutChord(event) {
|
|
74
|
+
if (event.metaKey) return true;
|
|
75
|
+
return event.ctrlKey && event.getModifierState?.("AltGraph") !== true;
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
export { isShortcutChord as n, nextTypeaheadBuffer as r, findTypeaheadMatch as t };
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { r as trackInteractionModality, t as getInteractionModality } from "./interactionModality-ACpTMhak.js";
|
|
2
|
+
import { onScopeDispose, ref, toValue, watch } from "vue";
|
|
3
|
+
//#region src/composables/useTouchTrigger.ts
|
|
4
|
+
/**
|
|
5
|
+
* 「按下去」算作点击的指针类型。笔也在里面,但它只在落笔时算:
|
|
6
|
+
* 笔悬停在屏幕上方时是悬停,和鼠标一样。
|
|
7
|
+
*/
|
|
8
|
+
const TOUCH_POINTER_TYPES = /* @__PURE__ */ new Set(["touch", "pen"]);
|
|
9
|
+
/**
|
|
10
|
+
* 表示「激活它会做事」的 ARIA role。显式 role 优先于标签名:
|
|
11
|
+
* `<button role="presentation">` 只是布景,`<span role="button">` 才是真控件。
|
|
12
|
+
*/
|
|
13
|
+
const ACTION_ROLES = /* @__PURE__ */ new Set([
|
|
14
|
+
"button",
|
|
15
|
+
"checkbox",
|
|
16
|
+
"combobox",
|
|
17
|
+
"link",
|
|
18
|
+
"menuitem",
|
|
19
|
+
"menuitemcheckbox",
|
|
20
|
+
"menuitemradio",
|
|
21
|
+
"option",
|
|
22
|
+
"radio",
|
|
23
|
+
"searchbox",
|
|
24
|
+
"slider",
|
|
25
|
+
"spinbutton",
|
|
26
|
+
"switch",
|
|
27
|
+
"tab",
|
|
28
|
+
"textbox"
|
|
29
|
+
]);
|
|
30
|
+
/**
|
|
31
|
+
* 激活这个元素是不是「做了别的事」,而不是「显示浮层」。
|
|
32
|
+
*
|
|
33
|
+
* 比「可聚焦」窄是有意的:纯文字 Tooltip 的触发器带 `tabindex=0`,
|
|
34
|
+
* 键盘用户要能聚焦它读提示,但它本身没有动作。
|
|
35
|
+
*
|
|
36
|
+
* 返回 true 只决定「浮层不开」,那一下点击本身不会被吞掉:这里不调
|
|
37
|
+
* `preventDefault`,也不调 `stopPropagation`。
|
|
38
|
+
*/
|
|
39
|
+
function isActionTrigger(element) {
|
|
40
|
+
const role = element.getAttribute("role");
|
|
41
|
+
if (role != null && role !== "") return ACTION_ROLES.has(role);
|
|
42
|
+
switch (element.tagName) {
|
|
43
|
+
case "BUTTON":
|
|
44
|
+
case "INPUT":
|
|
45
|
+
case "LABEL":
|
|
46
|
+
case "SELECT":
|
|
47
|
+
case "SUMMARY":
|
|
48
|
+
case "TEXTAREA": return true;
|
|
49
|
+
case "A":
|
|
50
|
+
case "AREA": return element.hasAttribute("href");
|
|
51
|
+
default: return isEditable(element);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function isEditable(element) {
|
|
55
|
+
if (element.isContentEditable === true) return true;
|
|
56
|
+
const attribute = element.getAttribute("contenteditable");
|
|
57
|
+
return attribute != null && attribute !== "false";
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* 悬停类浮层(Tooltip、HoverCard)共用的触屏行为。
|
|
61
|
+
*
|
|
62
|
+
* 触屏上表达不了「悬停」:点一下会合成 `mouseenter`,不处理的悬停浮层要么
|
|
63
|
+
* 每次点都弹出来、又没有东西能关掉它,要么把用户点控件的这一下吃掉。
|
|
64
|
+
*/
|
|
65
|
+
function useTouchTrigger(options) {
|
|
66
|
+
trackInteractionModality();
|
|
67
|
+
const isTouchPointer = ref(false);
|
|
68
|
+
let isOpenNow = toValue(options.isOpen);
|
|
69
|
+
/**
|
|
70
|
+
* 这一层是不是被「点一下」打开的。只有点开的浮层才欠用户一次「点外面关闭」:
|
|
71
|
+
* 悬停打开的自己会随指针离开关掉,受控打开的不是我们该关的。
|
|
72
|
+
*/
|
|
73
|
+
let isTapOpen = false;
|
|
74
|
+
let outsideListener = null;
|
|
75
|
+
watch(() => toValue(options.isOpen), (open) => {
|
|
76
|
+
if (isOpenNow && !open) disarmOutsideDismiss();
|
|
77
|
+
isOpenNow = open;
|
|
78
|
+
}, { flush: "sync" });
|
|
79
|
+
function disarmOutsideDismiss() {
|
|
80
|
+
isTapOpen = false;
|
|
81
|
+
if (outsideListener == null) return;
|
|
82
|
+
document.removeEventListener("pointerdown", outsideListener, true);
|
|
83
|
+
outsideListener = null;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* 装「点外面关闭」。用捕获阶段,触发器自己 stopPropagation 也拦不住,
|
|
87
|
+
* 免得留一个关不掉的浮层。打开它的那一次按压在 document 捕获阶段已经走过了,
|
|
88
|
+
* 所以这个监听看不到它。
|
|
89
|
+
*/
|
|
90
|
+
function armOutsideDismiss() {
|
|
91
|
+
isTapOpen = true;
|
|
92
|
+
if (outsideListener != null) return;
|
|
93
|
+
outsideListener = (event) => {
|
|
94
|
+
const target = event.target;
|
|
95
|
+
if (target != null) {
|
|
96
|
+
if (options.triggerRef.value?.contains(target) === true) return;
|
|
97
|
+
if (document.getElementById(toValue(options.layerId))?.contains(target) === true) return;
|
|
98
|
+
}
|
|
99
|
+
disarmOutsideDismiss();
|
|
100
|
+
options.hide();
|
|
101
|
+
};
|
|
102
|
+
document.addEventListener("pointerdown", outsideListener, true);
|
|
103
|
+
}
|
|
104
|
+
onScopeDispose(disarmOutsideDismiss);
|
|
105
|
+
function isEnabledNow() {
|
|
106
|
+
return toValue(options.isEnabled) ?? true;
|
|
107
|
+
}
|
|
108
|
+
function isControlledNow() {
|
|
109
|
+
return toValue(options.isControlled) === true;
|
|
110
|
+
}
|
|
111
|
+
function isTouchInteraction() {
|
|
112
|
+
return isTouchPointer.value && getInteractionModality() === "pointer";
|
|
113
|
+
}
|
|
114
|
+
function handlePointerEnter(event) {
|
|
115
|
+
isTouchPointer.value = event.pointerType === "touch";
|
|
116
|
+
}
|
|
117
|
+
function handlePointerDown(event) {
|
|
118
|
+
const isTouch = TOUCH_POINTER_TYPES.has(event.pointerType);
|
|
119
|
+
isTouchPointer.value = isTouch;
|
|
120
|
+
if (!isTouch || isControlledNow()) return false;
|
|
121
|
+
const trigger = options.triggerRef.value;
|
|
122
|
+
const touchTrigger = toValue(options.touchTrigger);
|
|
123
|
+
if ((touchTrigger === "auto" ? trigger != null && isActionTrigger(trigger) ? "none" : "tap" : touchTrigger) === "none" || !isEnabledNow()) {
|
|
124
|
+
disarmOutsideDismiss();
|
|
125
|
+
options.hide();
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
if (isOpenNow || isTapOpen) {
|
|
129
|
+
disarmOutsideDismiss();
|
|
130
|
+
options.hide();
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
armOutsideDismiss();
|
|
134
|
+
options.show();
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
isTouchPointer,
|
|
139
|
+
isTouchInteraction,
|
|
140
|
+
handlePointerEnter,
|
|
141
|
+
handlePointerDown,
|
|
142
|
+
clearTapOpen: disarmOutsideDismiss
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
//#endregion
|
|
146
|
+
export { useTouchTrigger as n, isActionTrigger as t };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { a as isImeKeyEvent } from "./layerDepth-CNDh-IHb.js";
|
|
2
|
+
import { n as isShortcutChord, r as nextTypeaheadBuffer, t as findTypeaheadMatch } from "./typeaheadMatch-Cl-oxKFt.js";
|
|
2
3
|
import { onScopeDispose, ref } from "vue";
|
|
3
4
|
//#region src/composables/useTypeahead.ts
|
|
4
5
|
const DEFAULT_RESET_MS = 750;
|
|
@@ -26,12 +27,13 @@ function useTypeahead(options) {
|
|
|
26
27
|
timer = setTimeout(reset, resetMs);
|
|
27
28
|
}
|
|
28
29
|
function onKeyDown(event) {
|
|
29
|
-
const
|
|
30
|
-
|
|
30
|
+
const isTyping = !isShortcutChord(event) && !isImeKeyEvent(event);
|
|
31
|
+
const extendsQuery = event.key === " " && isTyping && buffer.value.length > 0;
|
|
32
|
+
if (!(event.key.length === 1 && isTyping && event.key !== " ") && !extendsQuery) return false;
|
|
33
|
+
const next = nextTypeaheadBuffer(buffer.value, event.key);
|
|
34
|
+
if (next == null) return false;
|
|
31
35
|
const labels = getItemLabels();
|
|
32
36
|
if (labels.length === 0) return false;
|
|
33
|
-
const char = event.key.toLowerCase();
|
|
34
|
-
const next = buffer.value.length > 0 && [...buffer.value].every((entry) => entry === char) ? char : buffer.value + char;
|
|
35
37
|
buffer.value = next;
|
|
36
38
|
scheduleReset();
|
|
37
39
|
const current = getCurrentIndex?.() ?? -1;
|
|
@@ -39,15 +41,13 @@ function useTypeahead(options) {
|
|
|
39
41
|
const hasCurrent = current >= 0;
|
|
40
42
|
const start = hasCurrent ? current : 0;
|
|
41
43
|
const offset = hasCurrent && next.length === 1 ? 1 : 0;
|
|
44
|
+
const order = [];
|
|
42
45
|
for (let i = 0; i < count; i++) {
|
|
43
46
|
const index = (start + offset + i + count) % count;
|
|
44
|
-
if (isDisabled?.(index))
|
|
45
|
-
const label = labels[index];
|
|
46
|
-
if (label != null && label.trim().toLowerCase().startsWith(next)) {
|
|
47
|
-
onMatch(index);
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
47
|
+
if (!isDisabled?.(index)) order.push(index);
|
|
50
48
|
}
|
|
49
|
+
const match = findTypeaheadMatch(order, (index) => labels[index], next);
|
|
50
|
+
if (match >= 0) onMatch(match);
|
|
51
51
|
return true;
|
|
52
52
|
}
|
|
53
53
|
onScopeDispose(reset);
|
package/package.json
CHANGED