@astryx-vue/core 0.16.4 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AlertDialog/index.js +1 -1
- package/dist/{AlertDialog-C8W-FjkH.js → AlertDialog-CNb0dkY9.js} +4 -4
- package/dist/AppShell/index.d.ts +1 -1
- package/dist/Avatar/index.js +1 -1
- package/dist/{Avatar-dMLeTLRs.js → Avatar-D85dSNpq.js} +1 -1
- package/dist/AvatarGroup/index.d.ts +1 -1
- package/dist/Banner/index.d.ts +1 -1
- package/dist/Banner/index.js +1 -1
- package/dist/{Banner-CJgIpZby.js → Banner-BXITu2pn.js} +1 -1
- package/dist/BottomSheet/index.d.ts +1 -1
- package/dist/Breadcrumbs/index.js +1 -1
- package/dist/{Breadcrumbs-oyT1pLaR.js → Breadcrumbs-DXzBkpkd.js} +1 -1
- package/dist/Button/index.d.ts +1 -1
- package/dist/Button/index.js +1 -1
- package/dist/{Button-OfqvSU1j.js → Button-BZtim0B-.js} +1 -2
- 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/Carousel/index.js +1 -1
- package/dist/{Carousel-DN_gn5t4.js → Carousel-BaCXqtKK.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-DzxOPova.js → Chat-Wq7e98zS.js} +3 -3
- package/dist/CheckboxInput/index.d.ts +1 -1
- package/dist/CheckboxInput/index.js +1 -1
- package/dist/{CheckboxInput-CWfobjQ1.js → CheckboxInput-3ONBl1AY.js} +1 -1
- package/dist/CheckboxList/index.d.ts +1 -1
- package/dist/CheckboxList/index.js +1 -1
- package/dist/{CheckboxList-CEFhwHbk.js → CheckboxList-CbRX5YDA.js} +3 -3
- package/dist/ClickableCard/index.d.ts +1 -1
- package/dist/Code/index.d.ts +1 -1
- package/dist/Code/index.js +1 -1
- package/dist/{CodeBlock-DFq81dwg.js → CodeBlock-CLVXVlB7.js} +2 -2
- package/dist/Collapsible/index.d.ts +1 -1
- package/dist/CommandPalette/index.d.ts +1 -1
- package/dist/CommandPalette/index.js +1 -1
- package/dist/{CommandPalette-urnqxaZR.js → CommandPalette-CECjNvGB.js} +2 -2
- package/dist/ComplexSelector/index.d.ts +1 -1
- package/dist/ComplexSelector/index.js +1 -1
- package/dist/{ComplexSelector-Bb9Tietz.js → ComplexSelector-Dmaag1wm.js} +7 -3
- package/dist/ContextMenu/index.d.ts +1 -1
- package/dist/DateInput/index.d.ts +1 -1
- package/dist/DateInput/index.js +1 -1
- package/dist/{DateInput-UGCRWpCu.js → DateInput-BitZfGEY.js} +2 -2
- package/dist/DateRangeInput/index.d.ts +1 -1
- package/dist/DateRangeInput/index.js +1 -1
- package/dist/{DateRangeInput-CbFNAXhb.js → DateRangeInput-kxXBsUTU.js} +3 -3
- package/dist/DateTimeInput/index.d.ts +1 -1
- package/dist/DateTimeInput/index.js +1 -1
- package/dist/{DateTimeInput-DsB9quGn.js → DateTimeInput-Cfkuec_h.js} +4 -4
- package/dist/Dialog/index.d.ts +1 -1
- package/dist/Dialog/index.js +3 -3
- package/dist/{Dialog-CvRMUDsx.js → Dialog-BQ5OBB1d.js} +1 -1
- package/dist/{Dialog-BoV6-sZg.js → Dialog-DgdbRn2l.js} +25 -6
- package/dist/{DialogHeader-Dz-7FLep.js → DialogHeader-D8234o9F.js} +7 -3
- package/dist/Drawer/index.d.ts +1 -1
- package/dist/Drawer/index.js +1 -1
- package/dist/{Drawer-EuUM3b5t.js → Drawer-Dqus7kUc.js} +2 -2
- package/dist/DropdownMenu/index.js +2 -2
- package/dist/{DropdownMenu-BvTeXvbu.js → DropdownMenu-BC_zB9le.js} +1 -1
- package/dist/{DropdownMenu-DF56Xz8n.js → DropdownMenu-LQsXd-_V.js} +1 -1
- package/dist/EmptyState/index.js +1 -1
- package/dist/{EmptyState-D2ENfW7V.js → EmptyState-Bw0kWfMi.js} +3 -3
- package/dist/Field/index.js +3 -3
- package/dist/{Field-BE1CuxSu.js → Field-BXkGR8H0.js} +1 -1
- package/dist/{FieldInfoTip-CSXfFcdR.js → FieldInfoTip-DzpUxMDh.js} +1 -1
- package/dist/{FieldLabel-CvPYOohI.js → FieldLabel-DI7Yqdhf.js} +1 -1
- package/dist/FileInput/index.d.ts +1 -1
- package/dist/FileInput/index.js +1 -1
- package/dist/{FileInput-dYwavUsk.js → FileInput-BNHjbyQY.js} +2 -2
- package/dist/Heading/index.d.ts +1 -1
- package/dist/Heading/index.js +1 -1
- package/dist/{Heading-CNOg6iq5.js → Heading-Oph-5DDq.js} +1 -1
- package/dist/HoverCard/index.d.ts +1 -1
- package/dist/HoverCard/index.js +1 -1
- package/dist/{HoverCard-DafCEtWH.js → HoverCard-DVPLeccv.js} +22 -10
- package/dist/IconButton/index.js +1 -1
- package/dist/{IconButton-Cn3iSGRd.js → IconButton-Du2XBBAX.js} +1 -1
- package/dist/Indicator/index.d.ts +2 -2
- package/dist/InfoTip/index.d.ts +1 -1
- package/dist/InfoTip/index.js +1 -1
- package/dist/{InfoTip-BnGk9nr_.js → InfoTip-Bjw1ithP.js} +1 -1
- package/dist/{InputClearButton-h4GQJMqr.js → InputClearButton-CED-zP2y.js} +1 -1
- package/dist/InputGroup/index.js +1 -1
- package/dist/{InputGroup-BX4cdWQW.js → InputGroup-D5PoL4cU.js} +1 -1
- package/dist/InternationalizationProvider/index.d.ts +1 -1
- package/dist/InternationalizationProvider/index.js +1 -1
- package/dist/{InternationalizationProvider-7rA65NO7.js → InternationalizationProvider-Dr5GE6f0.js} +1 -1
- package/dist/LayerProvider/index.d.ts +1 -1
- package/dist/Lightbox/index.js +1 -1
- package/dist/{Lightbox-3y6Gzumf.js → Lightbox-RN_f7zRw.js} +3 -2
- package/dist/Link/index.d.ts +1 -1
- package/dist/Link/index.js +1 -1
- package/dist/{Link-wft8544N.js → Link-CQ-Ztuo_.js} +1 -1
- package/dist/List/index.d.ts +1 -1
- package/dist/Markdown/index.js +1 -1
- package/dist/{Markdown-rtBS8dBv.js → Markdown-DnnWjJGX.js} +3 -3
- package/dist/MoreMenu/index.d.ts +1 -1
- package/dist/MoreMenu/index.js +1 -1
- package/dist/{MoreMenu-BfaD8buF.js → MoreMenu-i80Ey9vR.js} +2 -2
- package/dist/MultiSelector/index.d.ts +1 -1
- package/dist/MultiSelector/index.js +1 -1
- package/dist/{MultiSelector-BqsGkkNQ.js → MultiSelector-BK6nZweN.js} +28 -16
- package/dist/NavItem/index.d.ts +1 -1
- package/dist/NumberInput/index.d.ts +1 -1
- package/dist/NumberInput/index.js +1 -1
- package/dist/{NumberInput-CKXqM4cC.js → NumberInput-BPeesTRv.js} +3 -3
- package/dist/OverflowList/index.d.ts +1 -1
- package/dist/Pagination/index.d.ts +1 -1
- package/dist/Pagination/index.js +1 -1
- package/dist/{Pagination-BYbqhFXF.js → Pagination-DFQNX_Mb.js} +1 -1
- package/dist/Popover/index.d.ts +1 -1
- package/dist/Popover/index.js +1 -1
- package/dist/{Popover-BepO8m2B.js → Popover-CmAEizH-.js} +3 -3
- package/dist/PowerSearch/index.d.ts +1 -1
- package/dist/PowerSearch/index.js +1 -1
- package/dist/{PowerSearch-UclIfhPU.js → PowerSearch-BAOqpQag.js} +16 -16
- package/dist/ProgressBar/index.d.ts +1 -1
- package/dist/ProgressBar/index.js +1 -1
- package/dist/{ProgressBar-CHdyTMyH.js → ProgressBar-DgyPRxV0.js} +1 -1
- package/dist/Radio/index.d.ts +1 -1
- package/dist/Radio/index.js +1 -1
- package/dist/{RadioGroup-BvoO922B.js → RadioGroup-FhoQMqg5.js} +2 -2
- package/dist/RadioList/index.d.ts +1 -1
- package/dist/RadioList/index.js +1 -1
- package/dist/{RadioList-LmcRXW-R.js → RadioList-DK2uXQ5S.js} +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/Selector/index.js +1 -1
- package/dist/{Selector-CTzIfy5D.js → Selector-Bo7qkt1P.js} +158 -63
- package/dist/SideNav/index.d.ts +1 -1
- package/dist/SideNav/index.js +1 -1
- package/dist/{SideNav-BFDgU7Ul.js → SideNav-CcZLUd7G.js} +2 -2
- package/dist/Slider/index.js +1 -1
- package/dist/{Slider-JoQDr9bl.js → Slider-DIgb8ogt.js} +1 -1
- package/dist/StatusDot/index.js +1 -1
- package/dist/{StatusDot-DdR_DF-k.js → StatusDot-Cxm-uhTD.js} +1 -1
- package/dist/Switch/index.d.ts +1 -1
- package/dist/Switch/index.js +1 -1
- package/dist/{Switch-CijkvpAA.js → Switch-5toeiELX.js} +1 -1
- package/dist/TabList/index.d.ts +1 -1
- package/dist/Table/index.d.ts +1 -1
- package/dist/Table/index.js +1 -1
- package/dist/{Table-0D-DE9wZ.js → Table-CRKljXg4.js} +12 -12
- package/dist/Text/index.d.ts +1 -1
- package/dist/Text/index.js +1 -1
- package/dist/{Text-DKlvc1pK.js → Text-CiSw2pOi.js} +1 -1
- package/dist/TextArea/index.d.ts +1 -1
- package/dist/TextArea/index.js +1 -1
- package/dist/{TextArea-B2uVGYED.js → TextArea-B82oXF-m.js} +4 -4
- package/dist/TextInput/index.d.ts +1 -1
- package/dist/TextInput/index.js +1 -1
- package/dist/{TextInput-7_aLlg3G.js → TextInput-_SIiqVOY.js} +4 -4
- package/dist/Theme/index.d.ts +3 -3
- package/dist/Theme/index.js +1 -1
- package/dist/{Theme-8bDq2nud.js → Theme-iqi6AvU_.js} +363 -39
- package/dist/Thumbnail/index.js +1 -1
- package/dist/{Thumbnail-B1E4wEei.js → Thumbnail-BlueoqOH.js} +2 -2
- package/dist/{TimeField-EMXQhof_.js → TimeField-CBWgdA1Y.js} +1 -1
- package/dist/TimeInput/index.d.ts +1 -1
- package/dist/TimeInput/index.js +1 -1
- package/dist/{TimeInput-Cy1ikWWy.js → TimeInput-8ASOMV3B.js} +2 -2
- package/dist/Timer/index.js +1 -1
- package/dist/{Timer-DOs3NhSX.js → Timer-C8evnsTE.js} +1 -1
- package/dist/Timestamp/index.d.ts +1 -1
- package/dist/Timestamp/index.js +1 -1
- package/dist/{Timestamp-Dw5CyS_N.js → Timestamp-CgvZe6vH.js} +3 -3
- package/dist/Toast/index.d.ts +2 -2
- package/dist/Toast/index.js +1 -1
- package/dist/{Toast-DhWuBX-f.js → Toast-CzbqvHDN.js} +107 -34
- package/dist/ToggleButton/index.d.ts +1 -1
- package/dist/ToggleButton/index.js +1 -1
- package/dist/{ToggleButton-DcLaKPDT.js → ToggleButton-CO0XWWc0.js} +1 -1
- package/dist/Token/index.d.ts +1 -1
- package/dist/Tokenizer/index.d.ts +1 -1
- package/dist/Tokenizer/index.js +1 -1
- package/dist/{Tokenizer-DGW3Nurz.js → Tokenizer-CsFiYUJ_.js} +173 -105
- package/dist/Toolbar/index.d.ts +1 -1
- package/dist/Tooltip/index.js +2 -2
- package/dist/{Tooltip-vUyPDqhh.js → Tooltip-DQipgW1R.js} +1 -1
- package/dist/TopNav/index.d.ts +1 -1
- package/dist/Typeahead/index.d.ts +2 -1
- package/dist/Typeahead/index.js +2 -2
- package/dist/{Typeahead-BuVI6J9T.js → Typeahead--kEp21ut.js} +160 -72
- package/dist/{useKeyboardHighlight-CGCf1O57.js → assertOptions-CK_gJ0d3.js} +12 -1
- package/dist/composables/index.d.ts +3 -3
- package/dist/composables/index.js +7 -7
- package/dist/composables-BKHcPgN0.js +5730 -0
- package/dist/{index-BZ_lOqjE.d.ts → index-85RFPeV0.d.ts} +6 -6
- package/dist/{index-rzkX36wM.d.ts → index-9tZJgo0R.d.ts} +1 -1
- package/dist/{index-s0Ezq3U-.d.ts → index-B0iRA00v.d.ts} +5 -5
- package/dist/{index-B00KlO-P.d.ts → index-B95VIgRl.d.ts} +66 -66
- package/dist/{index-ZbNwGVkS.d.ts → index-BKnyTWPM.d.ts} +1 -1
- package/dist/{index-BTK7aStw.d.ts → index-BaK0mywG.d.ts} +1 -1
- package/dist/{index-Bfm6mF-r.d.ts → index-BfoazhEu.d.ts} +1 -1
- package/dist/{index-BOCb89V9.d.ts → index-BxWCX2pJ.d.ts} +1 -1
- package/dist/{index-CQ1bsxLC.d.ts → index-C1qJlC65.d.ts} +1 -1
- package/dist/{index-CL8JvxHW.d.ts → index-C1zwvxPH.d.ts} +2 -2
- package/dist/{index-Dc9_kBrU.d.ts → index-CH-xSiJz.d.ts} +10 -3
- package/dist/{index-YKCx03zD.d.ts → index-COgrQZIL.d.ts} +2 -2
- package/dist/{index-Bgk1Rj2A.d.ts → index-CTjkJP4x.d.ts} +1 -1
- package/dist/{index-FeZXsFO-.d.ts → index-CbA8rR_b.d.ts} +2 -2
- package/dist/{index-Bzi3A980.d.ts → index-ChqMaV6N.d.ts} +1 -1
- package/dist/{index-B0R5CLPF.d.ts → index-CsYDrQ9R.d.ts} +1 -1
- package/dist/{index-BhxqUt3y.d.ts → index-CuW4AQ7M.d.ts} +2 -2
- package/dist/{index-rnFsCdJ7.d.ts → index-Cy1rEWC-.d.ts} +1 -1
- package/dist/{index-BSlzqFzV.d.ts → index-CyMStZq4.d.ts} +5 -5
- package/dist/{index-C2cH8OLC.d.ts → index-D31bgBoy.d.ts} +1 -1
- package/dist/index-DGXCnzOL.d.ts +69 -0
- package/dist/{index-nNUT4Etk.d.ts → index-DK0Wdo9N.d.ts} +5 -5
- package/dist/{index--tm6L1ot.d.ts → index-DofC9Rll.d.ts} +2 -2
- package/dist/{index-Dy746dfn.d.ts → index-Qdbssopn.d.ts} +1 -1
- package/dist/{index-DE1genab.d.ts → index-QnlWyUxN.d.ts} +2 -2
- package/dist/{index-B1eCxBCY.d.ts → index-TXcNH86P.d.ts} +1 -1
- package/dist/{index-D7XRtUTY.d.ts → index-bk5kfP_c.d.ts} +5 -1
- package/dist/{index-C5e2rZML.d.ts → index-dWlCpnua.d.ts} +2 -2
- package/dist/{index-DS9SzqqJ.d.ts → index-lmd9LZKB.d.ts} +2 -2
- package/dist/{index-CtYlR9Cu.d.ts → index-rdwI-mcm.d.ts} +1 -1
- package/dist/{index-BXDqyk2_.d.ts → index-tuNsmJxw.d.ts} +169 -2
- package/dist/{index-BEZ4ezJk.d.ts → index-wY6dKz6c.d.ts} +2 -2
- package/dist/{index-C89cIh4E.d.ts → index-waTkqxTz.d.ts} +1 -1
- package/dist/index.d.ts +40 -39
- package/dist/index.js +75 -75
- package/dist/{layerFocusReturn-13azEIdn.js → layerFocusReturn-B8Hp14ZG.js} +1 -1
- package/dist/{loadCatalog-DFyDz_4e.d.ts → loadCatalog-BJwcyX8i.d.ts} +2 -0
- package/dist/{loadCatalog-C3MSknfx.js → loadCatalog-C1kms5sO.js} +5 -1
- package/dist/locale/index.d.ts +2 -2
- package/dist/locale/index.js +3 -3
- package/dist/{locale-OCGw4bi6.js → locale-CHhsd9Mq.js} +1 -1
- package/dist/tooltipFocusRules-D4cJ08fk.js +67 -0
- package/dist/{useLayer-CzyH9KXY.js → tooltipTriggerRules-PBxqztvn.js} +10 -1
- package/dist/{typeahead-RkZw0Ktn.js → typeahead-BgfLP7vR.js} +2 -0
- package/dist/{types-BRfVvZTH.d.ts → types-Bc_G8h4i.d.ts} +2 -0
- package/dist/{index-BzViSe8D.d.ts → types-C1ydeFiu.d.ts} +43 -65
- package/dist/{types-uWxXh1Jm.d.ts → types-fRasDCe4.d.ts} +47 -6
- package/dist/{useAsyncSource-Gk0VtE7_.js → useAsyncSource-7GTcK8ep.js} +31 -1
- package/dist/{useAsyncSource-aGzrvRkI.d.ts → useAsyncSource-DbG2FSuI.d.ts} +19 -2
- package/dist/{useCombobox-D374_pT8.js → useCombobox-DIR9yoEu.js} +150 -3
- package/dist/{useInputStatusIcon-CwCNWBnG.js → useInputStatusIcon-ne9V7ZQC.js} +1 -1
- package/dist/{useTooltip-frKBHzqr.js → useTooltip-C7gHRGEO.js} +9 -44
- package/dist/{useTruncationTooltip-DUkkZgmO.js → useTruncationTooltip-DwUQN7fD.js} +3 -3
- package/dist/{useTypeaheadAnnouncement-CSikDlpK.js → useTypeaheadMenuConfig--4f7jR6G.js} +264 -20
- package/package.json +1 -1
- package/styles/dialog-header.css +19 -4
- package/styles/dialog.css +4 -0
- package/styles/hover-card.css +6 -0
- package/styles/motion.css +10 -0
- package/styles/selector.css +10 -0
- package/styles/toast.css +19 -0
- package/styles/tooltip.css +6 -0
- package/dist/composables-CCsHfpCS.js +0 -1256
- package/dist/tooltipTriggerRules-9zkDe8_b.js +0 -10
- package/dist/useHoverLayerDismiss-CFGjvYi4.js +0 -27
- package/dist/{index-J6YRJ7Ul.d.ts → index-D8lv2BiD.d.ts} +1 -1
|
@@ -1,9 +1,43 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as SearchSource, o as SearchableItem } from "./useAsyncSource-DbG2FSuI.js";
|
|
2
2
|
import { t as FieldPartStylingProps } from "./fieldParts-LXpQMKE8.js";
|
|
3
3
|
import { t as InputStatusVariant } from "./useInputStatusIcon-B6m_t8cK.js";
|
|
4
|
-
import { HTMLAttributes, StyleValue } from "vue";
|
|
4
|
+
import { Component, HTMLAttributes, StyleValue } from "vue";
|
|
5
5
|
//#region src/Typeahead/types.d.ts
|
|
6
6
|
type TypeaheadSize = 'sm' | 'md' | 'lg';
|
|
7
|
+
/**
|
|
8
|
+
* 菜单里放什么。Astryx 管菜单这一层:位置、点外面关闭、Escape、焦点回收、和输入框的 ARIA 关联,
|
|
9
|
+
* 调用方只负责填内容。
|
|
10
|
+
*
|
|
11
|
+
* - `listbox`:结果列表,焦点留在输入框。`menu` 插槽可以在列表周围放信息(标题、提示);
|
|
12
|
+
* 要点的东西都应该做成列表里的一个结果,这样方向键才够得到。
|
|
13
|
+
* - `dialog`:会拿走焦点的内容,由 `label` 命名。只能通过 `open()` 打开:输入、聚焦、方向键都不会打开它。
|
|
14
|
+
* 从 `listbox` 换成 `dialog` 时,菜单挂在同一个锚点上保持打开。
|
|
15
|
+
*/
|
|
16
|
+
type TypeaheadMenuConfig = {
|
|
17
|
+
role: 'listbox';
|
|
18
|
+
} | {
|
|
19
|
+
role: 'dialog';
|
|
20
|
+
label: string;
|
|
21
|
+
};
|
|
22
|
+
/** `menu` 插槽(listbox 角色)拿到的东西。 */
|
|
23
|
+
interface TypeaheadListboxMenuSlotProps {
|
|
24
|
+
/** 结果列表。只渲染一次,方向键在它里面移动:`<component :is="listbox" />`。 */
|
|
25
|
+
listbox: Component;
|
|
26
|
+
/** 输入框里的查询。 */
|
|
27
|
+
query: string;
|
|
28
|
+
/** 搜索或聚焦清单正在加载。 */
|
|
29
|
+
isBusy: boolean;
|
|
30
|
+
/** 这次查询搜完了,没有结果。 */
|
|
31
|
+
isEmptySearch: boolean;
|
|
32
|
+
/** 关闭菜单。 */
|
|
33
|
+
close: () => void;
|
|
34
|
+
}
|
|
35
|
+
/** `menu` 插槽(dialog 角色)拿到的东西。 */
|
|
36
|
+
interface TypeaheadDialogMenuSlotProps {
|
|
37
|
+
query: string;
|
|
38
|
+
/** 关闭菜单,并把焦点还给打开它时的元素。 */
|
|
39
|
+
close: () => void;
|
|
40
|
+
}
|
|
7
41
|
type TypeaheadStatus = 'default' | 'success' | 'warning' | 'error';
|
|
8
42
|
interface BaseTypeaheadProps<T extends SearchableItem = SearchableItem> {
|
|
9
43
|
/** 当前选中的条目。空表示还没选。 */
|
|
@@ -70,6 +104,8 @@ interface BaseTypeaheadProps<T extends SearchableItem = SearchableItem> {
|
|
|
70
104
|
/** 加到输入外框上,不落到原生 input。 */
|
|
71
105
|
controlClass?: HTMLAttributes['class'];
|
|
72
106
|
controlStyle?: StyleValue;
|
|
107
|
+
/** 菜单里放什么,默认是结果列表。见 {@link TypeaheadMenuConfig}。 */
|
|
108
|
+
menu?: TypeaheadMenuConfig;
|
|
73
109
|
}
|
|
74
110
|
interface TypeaheadProps<T extends SearchableItem = SearchableItem> extends FieldPartStylingProps {
|
|
75
111
|
/** 当前选中的条目。空表示还没选。 */
|
|
@@ -127,6 +163,8 @@ interface TypeaheadProps<T extends SearchableItem = SearchableItem> extends Fiel
|
|
|
127
163
|
width?: number | string;
|
|
128
164
|
/** 输入框起始侧的图标。没有 icon 插槽时使用。 */
|
|
129
165
|
startIcon?: unknown;
|
|
166
|
+
/** 菜单里放什么,默认是结果列表。见 {@link TypeaheadMenuConfig}。 */
|
|
167
|
+
menu?: TypeaheadMenuConfig;
|
|
130
168
|
}
|
|
131
169
|
interface TypeaheadEmits<T extends SearchableItem = SearchableItem> {
|
|
132
170
|
'update:modelValue': [value: T | null];
|
|
@@ -160,68 +198,8 @@ interface TypeaheadSlots<T extends SearchableItem = SearchableItem> {
|
|
|
160
198
|
}) => unknown;
|
|
161
199
|
/** 自定义空状态。 */
|
|
162
200
|
empty?: () => unknown;
|
|
201
|
+
/** 菜单内容:listbox 角色在结果列表周围放信息,dialog 角色是菜单的全部内容。 */
|
|
202
|
+
menu?: (props: TypeaheadListboxMenuSlotProps & TypeaheadDialogMenuSlotProps) => unknown;
|
|
163
203
|
}
|
|
164
204
|
//#endregion
|
|
165
|
-
|
|
166
|
-
declare const __VLS_export$2: <T extends SearchableItem>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal$1<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
167
|
-
props: import("vue").PublicProps & __VLS_PrettifyLocal$1<BaseTypeaheadProps<T> & {
|
|
168
|
-
onChange?: ((value: T | null) => any) | undefined;
|
|
169
|
-
onSearch?: ((query: string) => any) | undefined;
|
|
170
|
-
onOpenChange?: ((isOpen: boolean) => any) | undefined;
|
|
171
|
-
"onUpdate:modelValue"?: ((value: T | null) => any) | undefined;
|
|
172
|
-
onChangeQuery?: ((query: string) => any) | undefined;
|
|
173
|
-
}> & (typeof globalThis extends {
|
|
174
|
-
__VLS_PROPS_FALLBACK: infer P;
|
|
175
|
-
} ? P : {});
|
|
176
|
-
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
177
|
-
focus: () => void | undefined;
|
|
178
|
-
blur: () => void | undefined;
|
|
179
|
-
}>) => void;
|
|
180
|
-
attrs: any;
|
|
181
|
-
slots: TypeaheadSlots<T>;
|
|
182
|
-
emit: ((evt: "change", value: T | null) => void) & ((evt: "search", query: string) => void) & ((evt: "openChange", isOpen: boolean) => void) & ((evt: "update:modelValue", value: T | null) => void) & ((evt: "changeQuery", query: string) => void);
|
|
183
|
-
}>) => import("vue").VNode & {
|
|
184
|
-
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
185
|
-
};
|
|
186
|
-
declare const _default$2: typeof __VLS_export$2;
|
|
187
|
-
type __VLS_PrettifyLocal$1<T> = (T extends any ? { [K in keyof T]: T[K]; } : { [K in keyof T as K]: T[K]; }) & {};
|
|
188
|
-
//#endregion
|
|
189
|
-
//#region src/Typeahead/Typeahead.vue.d.ts
|
|
190
|
-
declare const __VLS_export$1: <T extends SearchableItem>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
191
|
-
props: import("vue").PublicProps & __VLS_PrettifyLocal<TypeaheadProps<T> & {
|
|
192
|
-
onChange?: ((value: T | null) => any) | undefined;
|
|
193
|
-
onSearch?: ((query: string) => any) | undefined;
|
|
194
|
-
onOpenChange?: ((isOpen: boolean) => any) | undefined;
|
|
195
|
-
"onUpdate:modelValue"?: ((value: T | null) => any) | undefined;
|
|
196
|
-
onChangeQuery?: ((query: string) => any) | undefined;
|
|
197
|
-
}> & (typeof globalThis extends {
|
|
198
|
-
__VLS_PROPS_FALLBACK: infer P;
|
|
199
|
-
} ? P : {});
|
|
200
|
-
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
201
|
-
focus: () => void | undefined;
|
|
202
|
-
blur: () => void | undefined;
|
|
203
|
-
}>) => void;
|
|
204
|
-
attrs: any;
|
|
205
|
-
slots: TypeaheadSlots<T>;
|
|
206
|
-
emit: ((evt: "change", value: T | null) => void) & ((evt: "search", query: string) => void) & ((evt: "openChange", isOpen: boolean) => void) & ((evt: "update:modelValue", value: T | null) => void) & ((evt: "changeQuery", query: string) => void);
|
|
207
|
-
}>) => import("vue").VNode & {
|
|
208
|
-
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
209
|
-
};
|
|
210
|
-
declare const _default$1: typeof __VLS_export$1;
|
|
211
|
-
type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K]; } : { [K in keyof T as K]: T[K]; }) & {};
|
|
212
|
-
//#endregion
|
|
213
|
-
//#region src/Typeahead/TypeaheadItem.vue.d.ts
|
|
214
|
-
declare var __VLS_1: {};
|
|
215
|
-
type __VLS_Slots = {} & {
|
|
216
|
-
icon?: (props: typeof __VLS_1) => any;
|
|
217
|
-
};
|
|
218
|
-
declare const __VLS_base: import("vue").DefineComponent<TypeaheadItemProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TypeaheadItemProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
219
|
-
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
220
|
-
declare const _default: typeof __VLS_export;
|
|
221
|
-
type __VLS_WithSlots<T, S> = T & {
|
|
222
|
-
new (): {
|
|
223
|
-
$slots: S;
|
|
224
|
-
};
|
|
225
|
-
};
|
|
226
|
-
//#endregion
|
|
227
|
-
export { TypeaheadEmits as a, TypeaheadSize as c, BaseTypeaheadProps as i, TypeaheadSlots as l, _default$1 as n, TypeaheadItemProps as o, _default$2 as r, TypeaheadProps as s, _default as t, TypeaheadStatus as u };
|
|
205
|
+
export { TypeaheadListboxMenuSlotProps as a, TypeaheadSize as c, TypeaheadItemProps as i, TypeaheadSlots as l, TypeaheadDialogMenuSlotProps as n, TypeaheadMenuConfig as o, TypeaheadEmits as r, TypeaheadProps as s, BaseTypeaheadProps as t, TypeaheadStatus as u };
|
|
@@ -171,6 +171,41 @@ type TypeScaleTokens = Record<string, string>;
|
|
|
171
171
|
*/
|
|
172
172
|
declare function expandTypeScale(config: TypeScaleConfig): TypeScaleTokens;
|
|
173
173
|
//#endregion
|
|
174
|
+
//#region src/Theme/motionKnobs.d.ts
|
|
175
|
+
/**
|
|
176
|
+
* @file motionKnobs.ts
|
|
177
|
+
* @input A theme's motion knobs (`tempo`, `character`)
|
|
178
|
+
* @output Their types and `resolveKnobs`, which fills in the defaults and
|
|
179
|
+
* clamps `tempo`. `reducedMotion` is not a public knob: every theme
|
|
180
|
+
* resolves to `'system'`
|
|
181
|
+
* @position Theme utility with no imports: themeMotion.ts builds the motion
|
|
182
|
+
* tokens on it, and the motion foundation reads a theme's knobs through it.
|
|
183
|
+
* Pure; safe on the server.
|
|
184
|
+
*/
|
|
185
|
+
/** How lively a theme's motion feels. */
|
|
186
|
+
type MotionCharacter = 'crisp' | 'standard' | 'expressive';
|
|
187
|
+
/** The motion knobs a theme sets. */
|
|
188
|
+
interface ThemeMotionKnobs {
|
|
189
|
+
/**
|
|
190
|
+
* Scales every motion duration: 1 is the theme's own, 0.75 the quickest and
|
|
191
|
+
* 1.5 the slowest (values outside are clamped). Default 1.
|
|
192
|
+
*/
|
|
193
|
+
tempo?: number;
|
|
194
|
+
/**
|
|
195
|
+
* `'crisp'` decelerates without overshoot, `'standard'` is the default,
|
|
196
|
+
* `'expressive'` overshoots slightly on entrances and moves. Exits and
|
|
197
|
+
* fades never overshoot. Default `'standard'`.
|
|
198
|
+
*/
|
|
199
|
+
character?: MotionCharacter;
|
|
200
|
+
}
|
|
201
|
+
//#endregion
|
|
202
|
+
//#region src/Theme/themeMotion.d.ts
|
|
203
|
+
/**
|
|
204
|
+
* A theme's `motion`: the knobs, a `MotionScaleConfig`, or both. A
|
|
205
|
+
* `MotionScaleConfig`'s fields win over `tempo` for the durations they set.
|
|
206
|
+
*/
|
|
207
|
+
type ThemeMotionConfig = ThemeMotionKnobs | (MotionScaleConfig & ThemeMotionKnobs);
|
|
208
|
+
//#endregion
|
|
174
209
|
//#region src/Theme/adaptationTypes.d.ts
|
|
175
210
|
/** Fixed names for viewport-width tier start points. */
|
|
176
211
|
declare const WIDTH_BREAKPOINT_NAMES: readonly ["sm", "md", "lg", "xl", "2xl"];
|
|
@@ -208,8 +243,8 @@ interface ThemeAdaptationValue {
|
|
|
208
243
|
color?: Partial<ColorScaleConfig>;
|
|
209
244
|
/** Completed from the root theme's radius config. */
|
|
210
245
|
radius?: Partial<RadiusScaleConfig>;
|
|
211
|
-
/**
|
|
212
|
-
motion?: Partial<MotionScaleConfig
|
|
246
|
+
/** Scale fields or the `tempo` and `character` knobs, completed from the root theme's motion config. */
|
|
247
|
+
motion?: Partial<MotionScaleConfig> & ThemeMotionKnobs;
|
|
213
248
|
/** Shared token writes. */
|
|
214
249
|
tokens?: ThemeTokens;
|
|
215
250
|
/** New values for theme-local tokens the root theme already declares. */
|
|
@@ -243,7 +278,7 @@ interface ThemeGenerativeAxes {
|
|
|
243
278
|
typography?: TypographyConfig;
|
|
244
279
|
color?: ColorScaleConfig;
|
|
245
280
|
radius?: RadiusScaleConfig;
|
|
246
|
-
motion?:
|
|
281
|
+
motion?: ThemeMotionConfig;
|
|
247
282
|
}
|
|
248
283
|
/** One rule lowered to concrete writes, ready to compile. */
|
|
249
284
|
interface ResolvedThemeAdaptationRule {
|
|
@@ -357,8 +392,14 @@ interface DefineThemeInput<IconVariants extends readonly string[] | undefined =
|
|
|
357
392
|
typography?: TypographyConfig;
|
|
358
393
|
/** Radius steps from a base pixel size and a multiplier. */
|
|
359
394
|
radius?: RadiusScaleConfig;
|
|
360
|
-
/**
|
|
361
|
-
|
|
395
|
+
/**
|
|
396
|
+
* Motion. `tempo` scales every duration (0.75–1.5, default 1) and the
|
|
397
|
+
* touch springs; `character` picks the entrance and move curves
|
|
398
|
+
* (`'crisp'`, `'standard'`, `'expressive'`). A duration scale (`fast`,
|
|
399
|
+
* `medium`, `slow`, `ratio`) sets durations itself and wins over `tempo`
|
|
400
|
+
* for them.
|
|
401
|
+
*/
|
|
402
|
+
motion?: ThemeMotionConfig;
|
|
362
403
|
/**
|
|
363
404
|
* Component style overrides, scoped to this theme name.
|
|
364
405
|
* `Theme` injects the compiled sheet. `css` on the result is that sheet.
|
|
@@ -516,4 +557,4 @@ interface MediaThemeProps {
|
|
|
516
557
|
fallback?: 'dark' | 'light';
|
|
517
558
|
}
|
|
518
559
|
//#endregion
|
|
519
|
-
export {
|
|
560
|
+
export { RadiusScaleConfig as A, IndicatorMap as B, WidthBreakpointName as C, ThemeMotionKnobs as D, MotionCharacter as E, expandColorScale as F, IndicatorSize as G, IndicatorPosition as H, CoreIndicatorName as I, IndicatorState as K, IndicatorComponent as L, MotionScaleConfig as M, expandMotionScale as N, TypeScaleConfig as O, ColorScaleConfig as P, IndicatorFamily as R, WIDTH_BREAKPOINT_NAMES as S, ThemeMotionConfig as T, IndicatorProps as U, IndicatorName as V, IndicatorRegistry as W, ThemeAdaptationRule as _, StyleOverrides as a, ThemeAdaptationWidthCondition as b, ThemeMode as c, ThemeTokenValue as d, ThemeTokens as f, ThemeAdaptationCondition as g, DEFAULT_WIDTH_BREAKPOINTS as h, MediaThemeProps as i, expandRadiusScale as j, expandTypeScale as k, ThemeProps as l, TypographyRole as m, DefineThemeInput as n, ThemeDefinition as o, TypographyConfig as p, MediaThemeMode as r, ThemeIconVariant as s, ComponentStyleMap as t, ThemeSurfaceInput as u, ThemeAdaptationTypographyConfig as v, WidthBreakpoints as w, ThemeAdaptations as x, ThemeAdaptationValue as y, IndicatorFamilyMap as z };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as devWarn } from "./useDevWarning-B2fsk2B-.js";
|
|
1
2
|
import { onScopeDispose, ref, shallowRef, toValue, watch } from "vue";
|
|
2
3
|
//#region src/composables/useAsyncSource.ts
|
|
3
4
|
/**
|
|
@@ -25,6 +26,19 @@ function createStaticSource(items, options) {
|
|
|
25
26
|
function isPromise(value) {
|
|
26
27
|
return typeof value?.then === "function";
|
|
27
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* 同一个查询的后一份列表接在前一份已显示的行后面:已显示的行留在最前面、顺序不变,
|
|
31
|
+
* 新行只加在后面。后一份列表移动或去掉了已显示的行时按它给的显示,并在开发期警告。
|
|
32
|
+
*/
|
|
33
|
+
function appendAfterShown(shown, next) {
|
|
34
|
+
const nextById = new Map(next.map((item) => [item.id, item]));
|
|
35
|
+
if (!(shown.filter((item) => nextById.has(item.id)).length === shown.length && next.filter((item) => shown.some((row) => row.id === item.id)).every((item, index) => item.id === shown[index]?.id))) {
|
|
36
|
+
devWarn("SearchSource", "a later list for the same query moved or removed rows that were already shown, so it is shown as given. Keep the shown rows first and in order, and add new rows after them.");
|
|
37
|
+
return [...next];
|
|
38
|
+
}
|
|
39
|
+
const shownIds = new Set(shown.map((item) => item.id));
|
|
40
|
+
return [...shown.map((item) => nextById.get(item.id)), ...next.filter((item) => !shownIds.has(item.id))];
|
|
41
|
+
}
|
|
28
42
|
function isAbortError(error) {
|
|
29
43
|
return error instanceof Error && error.name === "AbortError";
|
|
30
44
|
}
|
|
@@ -36,6 +50,7 @@ function useAsyncSource(options) {
|
|
|
36
50
|
const items = shallowRef([]);
|
|
37
51
|
const status = ref("idle");
|
|
38
52
|
const error = shallowRef(null);
|
|
53
|
+
const searchedQuery = ref(null);
|
|
39
54
|
let requestId = 0;
|
|
40
55
|
let timer;
|
|
41
56
|
let controller;
|
|
@@ -54,18 +69,32 @@ function useAsyncSource(options) {
|
|
|
54
69
|
const ac = new AbortController();
|
|
55
70
|
controller = ac;
|
|
56
71
|
const query = options.query.value;
|
|
57
|
-
|
|
72
|
+
searchedQuery.value = query;
|
|
73
|
+
const isBootstrap = query.trim() === "" && source.bootstrap != null;
|
|
74
|
+
let shown = null;
|
|
75
|
+
let isSettled = false;
|
|
76
|
+
const pending = isBootstrap ? source.bootstrap(ac.signal) : source.search(query, ac.signal, { update: (list) => {
|
|
77
|
+
if (isSettled || captured !== requestId || ac.signal.aborted) return;
|
|
78
|
+
if (list.length === 0 && shown != null) return;
|
|
79
|
+
shown = shown == null ? [...list] : appendAfterShown(shown, list);
|
|
80
|
+
items.value = shown;
|
|
81
|
+
error.value = null;
|
|
82
|
+
} });
|
|
58
83
|
try {
|
|
59
84
|
let resolved;
|
|
60
85
|
if (isPromise(pending)) {
|
|
61
86
|
status.value = "loading";
|
|
62
87
|
resolved = await pending;
|
|
63
88
|
} else resolved = pending;
|
|
89
|
+
isSettled = true;
|
|
64
90
|
if (captured !== requestId || ac.signal.aborted) return;
|
|
91
|
+
if (!isBootstrap && shown != null && resolved.length > 0) resolved = appendAfterShown(shown, resolved);
|
|
92
|
+
else if (!isBootstrap && shown != null) resolved = shown;
|
|
65
93
|
items.value = resolved;
|
|
66
94
|
error.value = null;
|
|
67
95
|
status.value = resolved.length === 0 ? "empty" : "ready";
|
|
68
96
|
} catch (caught) {
|
|
97
|
+
isSettled = true;
|
|
69
98
|
if (captured !== requestId || ac.signal.aborted || isAbortError(caught)) return;
|
|
70
99
|
items.value = [];
|
|
71
100
|
error.value = caught;
|
|
@@ -101,6 +130,7 @@ function useAsyncSource(options) {
|
|
|
101
130
|
items,
|
|
102
131
|
status,
|
|
103
132
|
error,
|
|
133
|
+
searchedQuery,
|
|
104
134
|
reload: () => schedule(true),
|
|
105
135
|
cancel
|
|
106
136
|
};
|
|
@@ -13,12 +13,27 @@ interface SearchableItem<TAux = unknown> {
|
|
|
13
13
|
action?: OptionActionNode | null;
|
|
14
14
|
auxiliaryData?: TAux;
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* 一次搜索的上下文,作为 `search` 的第三个参数。
|
|
18
|
+
*/
|
|
19
|
+
interface SearchContext<T extends SearchableItem = SearchableItem> {
|
|
20
|
+
/**
|
|
21
|
+
* 在 `search()` 落定之前先显示一份列表,比如页面上已经有的匹配项,服务端的答案随后追加。
|
|
22
|
+
*
|
|
23
|
+
* 每份列表都是数据源当时的完整答案。同一个查询的第一份列表可以换掉已有的行;
|
|
24
|
+
* 之后的每一份(包括 `search()` 的返回值)把已经显示的行留在最前面、顺序不变,
|
|
25
|
+
* 新行只加在它们后面,所以高亮的行不会被挤走。空列表不动已显示的行。
|
|
26
|
+
* 查询已经不是当前查询、或 `search()` 已经落定之后的调用会被忽略。
|
|
27
|
+
*/
|
|
28
|
+
update: (items: T[]) => void;
|
|
29
|
+
}
|
|
16
30
|
/**
|
|
17
31
|
* 搜索数据源。同步数组和 Promise 都可以。
|
|
18
32
|
* 新一次搜索开始时会调用 `cancel`,并传入 AbortSignal,用来丢掉过期请求。
|
|
33
|
+
* 搜索菜单还会传入 `context`,数据源可以用它先显示已有的匹配项。
|
|
19
34
|
*/
|
|
20
35
|
interface SearchSource<T extends SearchableItem = SearchableItem> {
|
|
21
|
-
search: (query: string, signal?: AbortSignal) => Promise<T[]> | T[];
|
|
36
|
+
search: (query: string, signal?: AbortSignal, context?: SearchContext<T>) => Promise<T[]> | T[];
|
|
22
37
|
bootstrap?: (signal?: AbortSignal) => Promise<T[]> | T[];
|
|
23
38
|
cancel?: () => void;
|
|
24
39
|
}
|
|
@@ -44,6 +59,8 @@ interface AsyncSource<T extends SearchableItem = SearchableItem> {
|
|
|
44
59
|
items: ShallowRef<T[]>;
|
|
45
60
|
status: Ref<AsyncSourceStatus>;
|
|
46
61
|
error: ShallowRef<unknown>;
|
|
62
|
+
/** 当前的 items 和 status 是为哪个查询发出的请求得到的;请求还在防抖时它落后于 `query`。 */
|
|
63
|
+
searchedQuery: Ref<string | null>;
|
|
47
64
|
/** 忽略防抖,立刻再搜一次。 */
|
|
48
65
|
reload: () => void;
|
|
49
66
|
cancel: () => void;
|
|
@@ -54,4 +71,4 @@ interface AsyncSource<T extends SearchableItem = SearchableItem> {
|
|
|
54
71
|
*/
|
|
55
72
|
declare function useAsyncSource<T extends SearchableItem = SearchableItem>(options: UseAsyncSourceOptions<T>): AsyncSource<T>;
|
|
56
73
|
//#endregion
|
|
57
|
-
export {
|
|
74
|
+
export { SearchSource as a, createStaticSource as c, SearchContext as i, useAsyncSource as l, AsyncSourceStatus as n, SearchableItem as o, CreateStaticSourceOptions as r, UseAsyncSourceOptions as s, AsyncSource as t };
|
|
@@ -1,4 +1,100 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { p as isImeKeyEvent } from "./interactionModality-B5dR7nnb.js";
|
|
2
|
+
import { computed, nextTick, onScopeDispose, ref, useId, watch } from "vue";
|
|
3
|
+
//#region src/composables/internal/comboboxFieldProps.ts
|
|
4
|
+
function hasModifier(event) {
|
|
5
|
+
return event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* 调用方自己渲染输入框、列表和选项时,把组合框语义、按键和指针模型接上去的属性生成器。
|
|
9
|
+
* 焦点始终留在输入框里,高亮的选项由 `aria-activedescendant` 指出;输入框保留列表用不到的所有按键。
|
|
10
|
+
*/
|
|
11
|
+
function createComboboxFieldProps(host) {
|
|
12
|
+
const getItemId = (index) => `${host.listboxId}-option-${index}`;
|
|
13
|
+
/** 列表只在有选项时才渲染:打开了但一个选项也没有时显示的是调用方的空状态,它不是 listbox。 */
|
|
14
|
+
const isShown = () => host.isOpen.value && host.options.value.length > 0;
|
|
15
|
+
function enabledIndices() {
|
|
16
|
+
return host.options.value.flatMap((option, index) => option.disabled ? [] : [index]);
|
|
17
|
+
}
|
|
18
|
+
function onFieldKeyDown(event) {
|
|
19
|
+
if (!host.isEnabled.value || isImeKeyEvent(event) || hasModifier(event) && event.key !== "Escape") return;
|
|
20
|
+
const enabled = enabledIndices();
|
|
21
|
+
if (!host.isOpen.value) {
|
|
22
|
+
if (event.key === "ArrowDown" && host.options.value.length > 0) {
|
|
23
|
+
event.preventDefault();
|
|
24
|
+
host.open();
|
|
25
|
+
host.activeIndex.value = enabled[0] ?? -1;
|
|
26
|
+
}
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
switch (event.key) {
|
|
30
|
+
case "ArrowDown":
|
|
31
|
+
case "ArrowUp": {
|
|
32
|
+
event.preventDefault();
|
|
33
|
+
if (enabled.length === 0) break;
|
|
34
|
+
const position = enabled.indexOf(host.activeIndex.value);
|
|
35
|
+
const next = event.key === "ArrowDown" ? (position + 1) % enabled.length : position < 0 ? enabled.length - 1 : (position - 1 + enabled.length) % enabled.length;
|
|
36
|
+
host.activeIndex.value = enabled[next];
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
case "Enter": {
|
|
40
|
+
const option = host.activeIndex.value >= 0 ? host.options.value[host.activeIndex.value] : void 0;
|
|
41
|
+
if (option && !option.disabled) {
|
|
42
|
+
event.preventDefault();
|
|
43
|
+
host.select(option.value);
|
|
44
|
+
}
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
case "Escape":
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
host.close();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function getFieldProps(handlers = {}) {
|
|
53
|
+
const shown = isShown();
|
|
54
|
+
const active = host.activeIndex.value;
|
|
55
|
+
return {
|
|
56
|
+
"role": "combobox",
|
|
57
|
+
"aria-autocomplete": "list",
|
|
58
|
+
"aria-expanded": shown,
|
|
59
|
+
"aria-controls": shown ? host.listboxId : void 0,
|
|
60
|
+
"aria-activedescendant": shown && active >= 0 && active < host.options.value.length ? getItemId(active) : void 0,
|
|
61
|
+
"onKeydown": (event) => {
|
|
62
|
+
onFieldKeyDown(event);
|
|
63
|
+
if (!event.defaultPrevented) handlers.onKeydown?.(event);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function getListboxProps() {
|
|
68
|
+
return {
|
|
69
|
+
id: host.listboxId,
|
|
70
|
+
role: "listbox",
|
|
71
|
+
onMousedown: (event) => event.preventDefault()
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function getOptionProps(index) {
|
|
75
|
+
const option = host.options.value[index];
|
|
76
|
+
const isDisabled = option?.disabled === true;
|
|
77
|
+
return {
|
|
78
|
+
"id": getItemId(index),
|
|
79
|
+
"role": "option",
|
|
80
|
+
"aria-selected": index === host.activeIndex.value,
|
|
81
|
+
...isDisabled ? { "aria-disabled": true } : {},
|
|
82
|
+
"onMousemove": () => {
|
|
83
|
+
if (option && !isDisabled && index !== host.activeIndex.value) host.activeIndex.value = index;
|
|
84
|
+
},
|
|
85
|
+
"onClick": () => {
|
|
86
|
+
if (option && !isDisabled) host.select(option.value);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
getItemId,
|
|
92
|
+
getFieldProps,
|
|
93
|
+
getListboxProps,
|
|
94
|
+
getOptionProps
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
//#endregion
|
|
2
98
|
//#region src/composables/internal/typeaheadText.ts
|
|
3
99
|
/**
|
|
4
100
|
* 类型跳转(type-to-select)用的文字折叠:忽略大小写、组合符号(U+0300–U+036F)、
|
|
@@ -21,6 +117,15 @@ function foldTypeaheadText(text) {
|
|
|
21
117
|
function startsWithTypeahead(label, prefix) {
|
|
22
118
|
return foldTypeaheadText(label).startsWith(prefix);
|
|
23
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* 按键是不是 Control 或 Command 快捷键,而不是键入的字符。
|
|
122
|
+
* Windows 上 AltGr 也会报 Control,同时带 AltGraph 修饰;它给出的是用户键入的字母,比如 ł。
|
|
123
|
+
* 单独的 Alt 不算:macOS 的 Option 加字母会组出字符(Option+a 得到 å)。
|
|
124
|
+
*/
|
|
125
|
+
function isShortcutChord(event) {
|
|
126
|
+
if (event.metaKey) return true;
|
|
127
|
+
return event.ctrlKey && event.getModifierState?.("AltGraph") !== true;
|
|
128
|
+
}
|
|
24
129
|
//#endregion
|
|
25
130
|
//#region src/composables/useCombobox.ts
|
|
26
131
|
const TYPEAHEAD_RESET_MS = 750;
|
|
@@ -29,9 +134,11 @@ const TYPEAHEAD_RESET_MS = 750;
|
|
|
29
134
|
* 供 Selector、MultiSelector、Typeahead、CommandPalette 等组件复用。
|
|
30
135
|
*/
|
|
31
136
|
function useCombobox(options) {
|
|
32
|
-
const { options: optionsList, modelValue, isEnabled = ref(true), isSearchable = ref(false), onChange, onOpenChange } = options;
|
|
137
|
+
const { options: optionsList, modelValue, isEnabled = ref(true), isSearchable = ref(false), onChange, onOpenChange, listboxId = `astryx-combobox-${useId()}` } = options;
|
|
33
138
|
const isOpen = ref(false);
|
|
34
139
|
const activeIndex = ref(-1);
|
|
140
|
+
/** 查询变化带来的列表变化由查询自己处理高亮,不走「跟着选项走」。 */
|
|
141
|
+
let queryChanging = false;
|
|
35
142
|
const searchQuery = ref("");
|
|
36
143
|
let typeaheadBuffer = "";
|
|
37
144
|
let typeaheadTimer;
|
|
@@ -65,6 +172,7 @@ function useCombobox(options) {
|
|
|
65
172
|
else open();
|
|
66
173
|
}
|
|
67
174
|
function select(value) {
|
|
175
|
+
if (!isEnabled.value) return;
|
|
68
176
|
onChange(value);
|
|
69
177
|
close();
|
|
70
178
|
}
|
|
@@ -106,6 +214,11 @@ function useCombobox(options) {
|
|
|
106
214
|
}
|
|
107
215
|
function setSearchQuery(query) {
|
|
108
216
|
searchQuery.value = query;
|
|
217
|
+
queryChanging = true;
|
|
218
|
+
nextTick(() => {
|
|
219
|
+
queryChanging = false;
|
|
220
|
+
});
|
|
221
|
+
activeIndex.value = -1;
|
|
109
222
|
if (query && filteredOptions.value.length > 0) highlightFirst();
|
|
110
223
|
}
|
|
111
224
|
function jumpToMatch(char) {
|
|
@@ -177,7 +290,7 @@ function useCombobox(options) {
|
|
|
177
290
|
selectHighlighted();
|
|
178
291
|
}
|
|
179
292
|
break;
|
|
180
|
-
default: if (!isSearchInput && event.key.length === 1 && !event
|
|
293
|
+
default: if (!isSearchInput && event.key.length === 1 && !isShortcutChord(event)) {
|
|
181
294
|
event.preventDefault();
|
|
182
295
|
if (!isOpen.value) open();
|
|
183
296
|
jumpToMatch(event.key);
|
|
@@ -190,6 +303,30 @@ function useCombobox(options) {
|
|
|
190
303
|
if (index >= 0) activeIndex.value = index;
|
|
191
304
|
}
|
|
192
305
|
});
|
|
306
|
+
watch(filteredOptions, (next, previous) => {
|
|
307
|
+
if (queryChanging || !isOpen.value || activeIndex.value < 0 || next === previous) return;
|
|
308
|
+
const enabledIndexOf = (value) => value === void 0 ? -1 : next.findIndex((option) => option.value === value && !option.disabled);
|
|
309
|
+
const stayed = enabledIndexOf(previous[activeIndex.value]?.value);
|
|
310
|
+
if (stayed >= 0) {
|
|
311
|
+
activeIndex.value = stayed;
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
for (let after = activeIndex.value + 1; after < previous.length; after++) {
|
|
315
|
+
const found = enabledIndexOf(previous[after]?.value);
|
|
316
|
+
if (found >= 0) {
|
|
317
|
+
activeIndex.value = found;
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
for (let before = Math.min(activeIndex.value, previous.length) - 1; before >= 0; before--) {
|
|
322
|
+
const found = enabledIndexOf(previous[before]?.value);
|
|
323
|
+
if (found >= 0) {
|
|
324
|
+
activeIndex.value = found;
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
activeIndex.value = -1;
|
|
329
|
+
});
|
|
193
330
|
onScopeDispose(() => {
|
|
194
331
|
if (typeaheadTimer !== void 0) clearTimeout(typeaheadTimer);
|
|
195
332
|
});
|
|
@@ -198,6 +335,16 @@ function useCombobox(options) {
|
|
|
198
335
|
activeIndex,
|
|
199
336
|
searchQuery,
|
|
200
337
|
filteredOptions,
|
|
338
|
+
...createComboboxFieldProps({
|
|
339
|
+
listboxId,
|
|
340
|
+
isOpen,
|
|
341
|
+
isEnabled,
|
|
342
|
+
activeIndex,
|
|
343
|
+
options: filteredOptions,
|
|
344
|
+
open,
|
|
345
|
+
close,
|
|
346
|
+
select: (value) => select(value)
|
|
347
|
+
}),
|
|
201
348
|
open,
|
|
202
349
|
close,
|
|
203
350
|
toggle,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as _sfc_main } from "./FieldIcon-DMtfe1Ne.js";
|
|
2
|
-
import { t as _sfc_main$1 } from "./FieldInfoTip-
|
|
2
|
+
import { t as _sfc_main$1 } from "./FieldInfoTip-DzpUxMDh.js";
|
|
3
3
|
import { computed, toValue } from "vue";
|
|
4
4
|
//#region src/composables/useInputStatusIcon.ts
|
|
5
5
|
/**
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { s as registerLayerSurface } from "./useClickableContainer-Dtjg-nkm.js";
|
|
2
2
|
import { r as useResolvedLayerTeleport } from "./useLayerMountTarget-BmZyeKWE.js";
|
|
3
|
-
import { i as trackInteractionModality
|
|
4
|
-
import {
|
|
3
|
+
import { i as trackInteractionModality } from "./interactionModality-B5dR7nnb.js";
|
|
4
|
+
import { n as useLayer } from "./tooltipTriggerRules-PBxqztvn.js";
|
|
5
5
|
import { t as _sfc_main$1 } from "./LayerContentBoundary-CpqXMTyU.js";
|
|
6
|
-
import { t as matchesFocusVisible } from "./tooltipTriggerRules-9zkDe8_b.js";
|
|
7
6
|
import { t as useAnnounce } from "./announce-GU01Oix2.js";
|
|
8
|
-
import { i as isFocusable } from "./focus-x7mxEqjR.js";
|
|
9
7
|
import { t as useTouchTriggerInternal } from "./useTouchTriggerInternal-Bs7obOrb.js";
|
|
10
|
-
import {
|
|
8
|
+
import { n as opensOnFocus, r as useHoverLayerDismiss, t as createFocusGate } from "./tooltipFocusRules-D4cJ08fk.js";
|
|
11
9
|
import { Teleport, computed, createBlock, createCommentVNode, createElementVNode, createTextVNode, createVNode, defineComponent, inject, mergeProps, onMounted, onScopeDispose, openBlock, renderSlot, shallowRef, toDisplayString, toValue, unref, vShow, watch, withCtx, withDirectives } from "vue";
|
|
12
10
|
import "../styles/tooltip.css";
|
|
13
11
|
//#region src/Tooltip/TooltipSurface.vue
|
|
@@ -109,44 +107,6 @@ function renderedText(element) {
|
|
|
109
107
|
return parts.join("").replace(/\s+/g, " ").trim();
|
|
110
108
|
}
|
|
111
109
|
//#endregion
|
|
112
|
-
//#region src/Tooltip/tooltipFocusRules.ts
|
|
113
|
-
/**
|
|
114
|
-
* 这次焦点算不算触发器的焦点,焦点到达时才判断:
|
|
115
|
-
* - `always`:触发器自己或里面任何元素拿到焦点都算;
|
|
116
|
-
* - `auto`:触发器自己拿到焦点算;焦点落在里面时,触发器此刻能聚焦才算。
|
|
117
|
-
* 漫游 tabindex 的成员挂监听时可能是 `-1`,轮到它时已经是 Tab 停靠点了;
|
|
118
|
-
* 普通包裹层仍然不理会里面子元素的焦点;
|
|
119
|
-
* - `never`:都不算。
|
|
120
|
-
*/
|
|
121
|
-
function isFocusForTrigger(mode, trigger, target) {
|
|
122
|
-
if (mode === "never") return false;
|
|
123
|
-
if (mode === "always") return true;
|
|
124
|
-
return target === trigger || isFocusable(trigger);
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* 落在 `target` 上的焦点会不会打开气泡。只有 `:focus-visible` 的焦点会,轻点从来不会。
|
|
128
|
-
* 上一次输入是指针时,只有文本框会打开:浏览器给指针点进文本框的焦点也算 focus-visible,
|
|
129
|
-
* 而指针按下之后脚本挪过来的焦点,在别的元素上也可能被标成 focus-visible。
|
|
130
|
-
*/
|
|
131
|
-
function opensOnFocus(target, isTouch) {
|
|
132
|
-
if (isTouch || !matchesFocusVisible(target)) return false;
|
|
133
|
-
return isTextEntryControl(target) || getInteractionModality() !== "pointer";
|
|
134
|
-
}
|
|
135
|
-
function createFocusGate(mode) {
|
|
136
|
-
let counted = false;
|
|
137
|
-
return {
|
|
138
|
-
arrive(trigger, target) {
|
|
139
|
-
counted = trigger != null && isFocusForTrigger(mode(), trigger, target);
|
|
140
|
-
return counted;
|
|
141
|
-
},
|
|
142
|
-
leave(trigger, target) {
|
|
143
|
-
const wasCounted = counted || trigger != null && isFocusForTrigger(mode(), trigger, target);
|
|
144
|
-
counted = false;
|
|
145
|
-
return wasCounted;
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
//#endregion
|
|
150
110
|
//#region src/Tooltip/tooltipPresentInterest.ts
|
|
151
111
|
/** 仅库内部使用,不从 Tooltip 入口导出。 */
|
|
152
112
|
const tooltipPresentInterestKey = Symbol("astryx-tooltip-present-interest");
|
|
@@ -283,7 +243,12 @@ function useTooltip(options = {}) {
|
|
|
283
243
|
if (isHoldInThisTask) isHoldFromPress = true;
|
|
284
244
|
return;
|
|
285
245
|
}
|
|
286
|
-
if (touch.handlePointerDown(event)
|
|
246
|
+
if (touch.handlePointerDown(event)) {
|
|
247
|
+
clearTimeout(showTimer);
|
|
248
|
+
showTimer = void 0;
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
if (isControlled.value) return;
|
|
287
252
|
hideNow();
|
|
288
253
|
}
|
|
289
254
|
const focusGate = createFocusGate(focusTriggerMode);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as trackInteractionModality, t as getInteractionModality } from "./interactionModality-B5dR7nnb.js";
|
|
2
|
-
import { t as matchesFocusVisible } from "./tooltipTriggerRules-
|
|
3
|
-
import { n as tooltipPresentInterestKey } from "./useTooltip-
|
|
4
|
-
import { t as _sfc_main$1 } from "./Tooltip-
|
|
2
|
+
import { t as matchesFocusVisible } from "./tooltipTriggerRules-PBxqztvn.js";
|
|
3
|
+
import { n as tooltipPresentInterestKey } from "./useTooltip-C7gHRGEO.js";
|
|
4
|
+
import { t as _sfc_main$1 } from "./Tooltip-DQipgW1R.js";
|
|
5
5
|
import { n as useTruncation, t as truncatePlacement } from "./useTruncation-C4pdlaXa.js";
|
|
6
6
|
import { computed, createBlock, createCommentVNode, defineComponent, openBlock, provide, shallowRef } from "vue";
|
|
7
7
|
//#region src/Text/TruncationTooltip.vue
|