@agile-plus/headless 0.1.2 → 0.2.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/README.md +24 -17
- package/dist/index.cjs +4163 -223
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +4258 -216
- package/dist/index.js.map +1 -1
- package/dist/types-BxsQI7P5.d.cts +93 -0
- package/dist/types-BxsQI7P5.d.ts +93 -0
- package/dist/types-zpeY0yvD.d.cts +73 -0
- package/dist/types-zpeY0yvD.d.ts +73 -0
- package/dist/useAccordion/index.cjs +149 -0
- package/dist/useAccordion/index.cjs.map +1 -0
- package/dist/useAccordion/index.d.cts +119 -0
- package/dist/useAccordion/index.d.ts +119 -0
- package/dist/useAccordion/index.js +128 -0
- package/dist/useAccordion/index.js.map +1 -0
- package/dist/useAvatar/index.cjs +135 -0
- package/dist/useAvatar/index.cjs.map +1 -0
- package/dist/useAvatar/index.d.cts +120 -0
- package/dist/useAvatar/index.d.ts +120 -0
- package/dist/useAvatar/index.js +106 -0
- package/dist/useAvatar/index.js.map +1 -0
- package/dist/useCheckbox/index.cjs +3 -1
- package/dist/useCheckbox/index.cjs.map +1 -1
- package/dist/useCheckbox/index.js +3 -1
- package/dist/useCheckbox/index.js.map +1 -1
- package/dist/useCollapsible/index.cjs +10 -0
- package/dist/useCollapsible/index.cjs.map +1 -1
- package/dist/useCollapsible/index.js +11 -1
- package/dist/useCollapsible/index.js.map +1 -1
- package/dist/useDatePicker/index.cjs +684 -0
- package/dist/useDatePicker/index.cjs.map +1 -0
- package/dist/useDatePicker/index.d.cts +191 -0
- package/dist/useDatePicker/index.d.ts +191 -0
- package/dist/useDatePicker/index.js +671 -0
- package/dist/useDatePicker/index.js.map +1 -0
- package/dist/useDateRangePicker/index.cjs +614 -0
- package/dist/useDateRangePicker/index.cjs.map +1 -0
- package/dist/useDateRangePicker/index.d.cts +159 -0
- package/dist/useDateRangePicker/index.d.ts +159 -0
- package/dist/useDateRangePicker/index.js +601 -0
- package/dist/useDateRangePicker/index.js.map +1 -0
- package/dist/useDialog/index.cjs.map +1 -1
- package/dist/useDialog/index.js.map +1 -1
- package/dist/useDropdownMenu/index.cjs +468 -0
- package/dist/useDropdownMenu/index.cjs.map +1 -0
- package/dist/useDropdownMenu/index.d.cts +73 -0
- package/dist/useDropdownMenu/index.d.ts +73 -0
- package/dist/useDropdownMenu/index.js +441 -0
- package/dist/useDropdownMenu/index.js.map +1 -0
- package/dist/useEllipsis/index.cjs +181 -0
- package/dist/useEllipsis/index.cjs.map +1 -0
- package/dist/useEllipsis/index.d.cts +67 -0
- package/dist/useEllipsis/index.d.ts +67 -0
- package/dist/useEllipsis/index.js +162 -0
- package/dist/useEllipsis/index.js.map +1 -0
- package/dist/useFloating/index.cjs +177 -0
- package/dist/useFloating/index.cjs.map +1 -0
- package/dist/useFloating/index.d.cts +21 -0
- package/dist/useFloating/index.d.ts +21 -0
- package/dist/useFloating/index.js +150 -0
- package/dist/useFloating/index.js.map +1 -0
- package/dist/useFormControl/index.cjs +5 -0
- package/dist/useFormControl/index.cjs.map +1 -1
- package/dist/useFormControl/index.js +5 -0
- package/dist/useFormControl/index.js.map +1 -1
- package/dist/useInput/index.cjs +192 -0
- package/dist/useInput/index.cjs.map +1 -0
- package/dist/useInput/index.d.cts +41 -0
- package/dist/useInput/index.d.ts +41 -0
- package/dist/useInput/index.js +165 -0
- package/dist/useInput/index.js.map +1 -0
- package/dist/useKeepMounted/index.cjs +44 -0
- package/dist/useKeepMounted/index.cjs.map +1 -0
- package/dist/useKeepMounted/index.d.cts +45 -0
- package/dist/useKeepMounted/index.d.ts +45 -0
- package/dist/useKeepMounted/index.js +17 -0
- package/dist/useKeepMounted/index.js.map +1 -0
- package/dist/useMenu/index.cjs +438 -0
- package/dist/useMenu/index.cjs.map +1 -0
- package/dist/useMenu/index.d.cts +134 -0
- package/dist/useMenu/index.d.ts +134 -0
- package/dist/useMenu/index.js +419 -0
- package/dist/useMenu/index.js.map +1 -0
- package/dist/usePagination/index.cjs +113 -0
- package/dist/usePagination/index.cjs.map +1 -0
- package/dist/usePagination/index.d.cts +139 -0
- package/dist/usePagination/index.d.ts +139 -0
- package/dist/usePagination/index.js +95 -0
- package/dist/usePagination/index.js.map +1 -0
- package/dist/usePopover/index.cjs +312 -0
- package/dist/usePopover/index.cjs.map +1 -0
- package/dist/usePopover/index.d.cts +71 -0
- package/dist/usePopover/index.d.ts +71 -0
- package/dist/usePopover/index.js +285 -0
- package/dist/usePopover/index.js.map +1 -0
- package/dist/useSelect/index.cjs +729 -0
- package/dist/useSelect/index.cjs.map +1 -0
- package/dist/useSelect/index.d.cts +193 -0
- package/dist/useSelect/index.d.ts +193 -0
- package/dist/useSelect/index.js +710 -0
- package/dist/useSelect/index.js.map +1 -0
- package/dist/useSplitter/index.cjs +558 -0
- package/dist/useSplitter/index.cjs.map +1 -0
- package/dist/useSplitter/index.d.cts +307 -0
- package/dist/useSplitter/index.d.ts +307 -0
- package/dist/useSplitter/index.js +541 -0
- package/dist/useSplitter/index.js.map +1 -0
- package/dist/useSwitch/index.cjs +4 -1
- package/dist/useSwitch/index.cjs.map +1 -1
- package/dist/useSwitch/index.js +4 -1
- package/dist/useSwitch/index.js.map +1 -1
- package/dist/useTable/index.cjs +308 -0
- package/dist/useTable/index.cjs.map +1 -0
- package/dist/useTable/index.d.cts +242 -0
- package/dist/useTable/index.d.ts +242 -0
- package/dist/useTable/index.js +301 -0
- package/dist/useTable/index.js.map +1 -0
- package/dist/useTabs/index.cjs +13 -4
- package/dist/useTabs/index.cjs.map +1 -1
- package/dist/useTabs/index.d.cts +5 -1
- package/dist/useTabs/index.d.ts +5 -1
- package/dist/useTabs/index.js +13 -4
- package/dist/useTabs/index.js.map +1 -1
- package/dist/useTextControl-Dcq0GFmg.d.cts +63 -0
- package/dist/useTextControl-Dcq0GFmg.d.ts +63 -0
- package/dist/useTextarea/index.cjs +186 -0
- package/dist/useTextarea/index.cjs.map +1 -0
- package/dist/useTextarea/index.d.cts +30 -0
- package/dist/useTextarea/index.d.ts +30 -0
- package/dist/useTextarea/index.js +159 -0
- package/dist/useTextarea/index.js.map +1 -0
- package/dist/useToast/index.cjs +27 -20
- package/dist/useToast/index.cjs.map +1 -1
- package/dist/useToast/index.js +27 -20
- package/dist/useToast/index.js.map +1 -1
- package/dist/useToastViewport/index.cjs +1 -3
- package/dist/useToastViewport/index.cjs.map +1 -1
- package/dist/useToastViewport/index.js +1 -3
- package/dist/useToastViewport/index.js.map +1 -1
- package/dist/useTooltip/index.cjs +357 -0
- package/dist/useTooltip/index.cjs.map +1 -0
- package/dist/useTooltip/index.d.cts +81 -0
- package/dist/useTooltip/index.d.ts +81 -0
- package/dist/useTooltip/index.js +338 -0
- package/dist/useTooltip/index.js.map +1 -0
- package/dist/useVirtualList/index.cjs +308 -0
- package/dist/useVirtualList/index.cjs.map +1 -0
- package/dist/useVirtualList/index.d.cts +31 -0
- package/dist/useVirtualList/index.d.ts +31 -0
- package/dist/useVirtualList/index.js +288 -0
- package/dist/useVirtualList/index.js.map +1 -0
- package/dist/useVirtualTree/index.cjs +520 -0
- package/dist/useVirtualTree/index.cjs.map +1 -0
- package/dist/useVirtualTree/index.d.cts +146 -0
- package/dist/useVirtualTree/index.d.ts +146 -0
- package/dist/useVirtualTree/index.js +511 -0
- package/dist/useVirtualTree/index.js.map +1 -0
- package/package.json +121 -2
- package/src/index.ts +38 -0
- package/src/useAccordion/index.ts +7 -0
- package/src/useAccordion/types.ts +118 -0
- package/src/useAccordion/useAccordion.ts +130 -0
- package/src/useAvatar/index.ts +14 -0
- package/src/useAvatar/types.ts +90 -0
- package/src/useAvatar/useAvatar.ts +39 -0
- package/src/useAvatar/useAvatarFallback.ts +62 -0
- package/src/useAvatar/useAvatarImage.ts +78 -0
- package/src/useCheckbox/useCheckbox.ts +4 -1
- package/src/useCollapsible/useCollapsible.ts +22 -1
- package/src/useDatePicker/index.ts +9 -0
- package/src/useDatePicker/types.ts +177 -0
- package/src/useDatePicker/useDatePicker.ts +688 -0
- package/src/useDateRangePicker/index.ts +8 -0
- package/src/useDateRangePicker/types.ts +146 -0
- package/src/useDateRangePicker/useDateRangePicker.ts +618 -0
- package/src/useDropdownMenu/index.ts +3 -0
- package/src/useDropdownMenu/types.ts +61 -0
- package/src/useDropdownMenu/useDropdownMenu.ts +322 -0
- package/src/useEllipsis/index.ts +3 -0
- package/src/useEllipsis/types.ts +51 -0
- package/src/useEllipsis/useEllipsis.ts +169 -0
- package/src/useFloating/index.ts +3 -0
- package/src/useFloating/types.ts +79 -0
- package/src/useFloating/useFloating.ts +199 -0
- package/src/useFormControl/useFormControl.ts +13 -0
- package/src/useInput/index.ts +3 -0
- package/src/useInput/types.ts +29 -0
- package/src/useInput/useInput.ts +40 -0
- package/src/useKeepMounted/index.ts +3 -0
- package/src/useKeepMounted/types.ts +29 -0
- package/src/useKeepMounted/useKeepMounted.ts +34 -0
- package/src/useMenu/index.ts +9 -0
- package/src/useMenu/types.ts +126 -0
- package/src/useMenu/useMenu.ts +504 -0
- package/src/usePagination/index.ts +3 -0
- package/src/usePagination/types.ts +137 -0
- package/src/usePagination/usePagination.ts +109 -0
- package/src/usePopover/index.ts +3 -0
- package/src/usePopover/types.ts +65 -0
- package/src/usePopover/usePopover.ts +157 -0
- package/src/useSelect/index.ts +9 -0
- package/src/useSelect/types.ts +184 -0
- package/src/useSelect/useSelect.ts +713 -0
- package/src/useSplitter/index.ts +10 -0
- package/src/useSplitter/types.ts +336 -0
- package/src/useSplitter/useSplitter.ts +648 -0
- package/src/useSplitter/useSplitterPanel.ts +106 -0
- package/src/useSwitch/useSwitch.ts +6 -1
- package/src/useTable/index.ts +3 -0
- package/src/useTable/types.ts +282 -0
- package/src/useTable/useTable.ts +407 -0
- package/src/useTabs/types.ts +5 -1
- package/src/useTabs/useTabs.ts +30 -6
- package/src/useTextarea/index.ts +3 -0
- package/src/useTextarea/types.ts +17 -0
- package/src/useTextarea/useTextarea.ts +34 -0
- package/src/useToast/useToast.ts +43 -26
- package/src/useToastViewport/useToastViewport.ts +10 -9
- package/src/useTooltip/index.ts +3 -0
- package/src/useTooltip/types.ts +72 -0
- package/src/useTooltip/useTooltip.ts +240 -0
- package/src/useVirtualList/index.ts +8 -0
- package/src/useVirtualList/types.ts +95 -0
- package/src/useVirtualList/useVirtualList.ts +478 -0
- package/src/useVirtualTree/index.ts +3 -0
- package/src/useVirtualTree/types.ts +179 -0
- package/src/useVirtualTree/useVirtualTree.ts +342 -0
- package/src/utils/useFocusTrap.ts +2 -0
- package/src/utils/useTextControl.ts +191 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { MaybeRefOrGetter, ComputedRef } from 'vue';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* useKeepMounted 的配置项。
|
|
5
|
+
*/
|
|
6
|
+
interface UseKeepMountedOptions {
|
|
7
|
+
/**
|
|
8
|
+
* 浮层的开合状态,一旦观测到 `true` 就记住这件事。
|
|
9
|
+
*
|
|
10
|
+
* 用 MaybeRefOrGetter 而不是裸 boolean,理由与 `usePresence` 的 `present` 相同:
|
|
11
|
+
* 封装层传进来的是响应式 props / ref,裸值会在展开时被固化成快照。
|
|
12
|
+
*/
|
|
13
|
+
open: MaybeRefOrGetter<boolean>;
|
|
14
|
+
/**
|
|
15
|
+
* 常驻策略开关,通常直接接组件的 `keepMounted` prop。
|
|
16
|
+
*
|
|
17
|
+
* 缺省视为开启:判定本身只在「已经打开过」之后才有输出,把默认值交给调用方更省样板。
|
|
18
|
+
*/
|
|
19
|
+
enabled?: MaybeRefOrGetter<boolean>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* useKeepMounted 的返回值。
|
|
23
|
+
*/
|
|
24
|
+
interface UseKeepMountedReturn {
|
|
25
|
+
/** 是否应当把内容继续留在 DOM 里,直接并进 `usePresence` 的 `present`。 */
|
|
26
|
+
keepMounted: ComputedRef<boolean>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* 「打开过一次之后常驻」的判定。
|
|
31
|
+
*
|
|
32
|
+
* 懒渲染省的是首次渲染的成本,代价是每次关闭都要销毁、每次打开都要重建 DOM 并重新测量,
|
|
33
|
+
* 浮层内部的滚动位置与临时状态也留不住。本 hook 把两种诉求合成一条规则:**打开之前不
|
|
34
|
+
* 渲染,打开过之后不销毁**,关闭时看得见与否交给组件自己的 `data-state`。
|
|
35
|
+
*
|
|
36
|
+
* 判定只认一个真源——浮层的开合状态。封装层若同时看 prop 和 `update:open` 事件,就会
|
|
37
|
+
* 得到两套缺一不可的分支(受控写法翻 prop 不派发事件,非受控的内部开合又不经过 prop),
|
|
38
|
+
* 所以这条 latch 只应该待在能直接读到开合状态的地方,由调用方调一次。
|
|
39
|
+
*
|
|
40
|
+
* @param options 开合状态与常驻策略。
|
|
41
|
+
* @returns 可直接并进 `usePresence` 的 `present` 的判定。
|
|
42
|
+
*/
|
|
43
|
+
declare function useKeepMounted(options: UseKeepMountedOptions): UseKeepMountedReturn;
|
|
44
|
+
|
|
45
|
+
export { type UseKeepMountedOptions, type UseKeepMountedReturn, useKeepMounted };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { MaybeRefOrGetter, ComputedRef } from 'vue';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* useKeepMounted 的配置项。
|
|
5
|
+
*/
|
|
6
|
+
interface UseKeepMountedOptions {
|
|
7
|
+
/**
|
|
8
|
+
* 浮层的开合状态,一旦观测到 `true` 就记住这件事。
|
|
9
|
+
*
|
|
10
|
+
* 用 MaybeRefOrGetter 而不是裸 boolean,理由与 `usePresence` 的 `present` 相同:
|
|
11
|
+
* 封装层传进来的是响应式 props / ref,裸值会在展开时被固化成快照。
|
|
12
|
+
*/
|
|
13
|
+
open: MaybeRefOrGetter<boolean>;
|
|
14
|
+
/**
|
|
15
|
+
* 常驻策略开关,通常直接接组件的 `keepMounted` prop。
|
|
16
|
+
*
|
|
17
|
+
* 缺省视为开启:判定本身只在「已经打开过」之后才有输出,把默认值交给调用方更省样板。
|
|
18
|
+
*/
|
|
19
|
+
enabled?: MaybeRefOrGetter<boolean>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* useKeepMounted 的返回值。
|
|
23
|
+
*/
|
|
24
|
+
interface UseKeepMountedReturn {
|
|
25
|
+
/** 是否应当把内容继续留在 DOM 里,直接并进 `usePresence` 的 `present`。 */
|
|
26
|
+
keepMounted: ComputedRef<boolean>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* 「打开过一次之后常驻」的判定。
|
|
31
|
+
*
|
|
32
|
+
* 懒渲染省的是首次渲染的成本,代价是每次关闭都要销毁、每次打开都要重建 DOM 并重新测量,
|
|
33
|
+
* 浮层内部的滚动位置与临时状态也留不住。本 hook 把两种诉求合成一条规则:**打开之前不
|
|
34
|
+
* 渲染,打开过之后不销毁**,关闭时看得见与否交给组件自己的 `data-state`。
|
|
35
|
+
*
|
|
36
|
+
* 判定只认一个真源——浮层的开合状态。封装层若同时看 prop 和 `update:open` 事件,就会
|
|
37
|
+
* 得到两套缺一不可的分支(受控写法翻 prop 不派发事件,非受控的内部开合又不经过 prop),
|
|
38
|
+
* 所以这条 latch 只应该待在能直接读到开合状态的地方,由调用方调一次。
|
|
39
|
+
*
|
|
40
|
+
* @param options 开合状态与常驻策略。
|
|
41
|
+
* @returns 可直接并进 `usePresence` 的 `present` 的判定。
|
|
42
|
+
*/
|
|
43
|
+
declare function useKeepMounted(options: UseKeepMountedOptions): UseKeepMountedReturn;
|
|
44
|
+
|
|
45
|
+
export { type UseKeepMountedOptions, type UseKeepMountedReturn, useKeepMounted };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/useKeepMounted/useKeepMounted.ts
|
|
2
|
+
import { computed, ref, toValue, watch } from "vue";
|
|
3
|
+
function useKeepMounted(options) {
|
|
4
|
+
const hasOpened = ref(toValue(options.open));
|
|
5
|
+
watch(
|
|
6
|
+
() => toValue(options.open),
|
|
7
|
+
(open) => {
|
|
8
|
+
if (open) hasOpened.value = true;
|
|
9
|
+
}
|
|
10
|
+
);
|
|
11
|
+
const keepMounted = computed(() => toValue(options.enabled) !== false && hasOpened.value);
|
|
12
|
+
return { keepMounted };
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
useKeepMounted
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/useKeepMounted/useKeepMounted.ts"],"sourcesContent":["import { computed, ref, toValue, watch } from 'vue';\n\nimport type { UseKeepMountedOptions, UseKeepMountedReturn } from './types';\n\n/**\n * 「打开过一次之后常驻」的判定。\n *\n * 懒渲染省的是首次渲染的成本,代价是每次关闭都要销毁、每次打开都要重建 DOM 并重新测量,\n * 浮层内部的滚动位置与临时状态也留不住。本 hook 把两种诉求合成一条规则:**打开之前不\n * 渲染,打开过之后不销毁**,关闭时看得见与否交给组件自己的 `data-state`。\n *\n * 判定只认一个真源——浮层的开合状态。封装层若同时看 prop 和 `update:open` 事件,就会\n * 得到两套缺一不可的分支(受控写法翻 prop 不派发事件,非受控的内部开合又不经过 prop),\n * 所以这条 latch 只应该待在能直接读到开合状态的地方,由调用方调一次。\n *\n * @param options 开合状态与常驻策略。\n * @returns 可直接并进 `usePresence` 的 `present` 的判定。\n */\nexport function useKeepMounted(options: UseKeepMountedOptions): UseKeepMountedReturn {\n // 初值直接读一次:defaultOpen / 受控 open=true 这种「生下来就是打开」的形态,\n // 等 watch 的首个变化才是多余的,读初值一步到位。\n const hasOpened = ref(toValue(options.open));\n\n watch(\n () => toValue(options.open),\n (open) => {\n if (open) hasOpened.value = true;\n }\n );\n\n const keepMounted = computed(() => toValue(options.enabled) !== false && hasOpened.value);\n\n return { keepMounted };\n}\n"],"mappings":";AAAA,SAAS,UAAU,KAAK,SAAS,aAAa;AAkBvC,SAAS,eAAe,SAAsD;AAGnF,QAAM,YAAY,IAAI,QAAQ,QAAQ,IAAI,CAAC;AAE3C;AAAA,IACE,MAAM,QAAQ,QAAQ,IAAI;AAAA,IAC1B,CAAC,SAAS;AACR,UAAI,KAAM,WAAU,QAAQ;AAAA,IAC9B;AAAA,EACF;AAEA,QAAM,cAAc,SAAS,MAAM,QAAQ,QAAQ,OAAO,MAAM,SAAS,UAAU,KAAK;AAExF,SAAO,EAAE,YAAY;AACvB;","names":[]}
|
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/useMenu/index.ts
|
|
21
|
+
var useMenu_exports = {};
|
|
22
|
+
__export(useMenu_exports, {
|
|
23
|
+
useMenu: () => useMenu
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(useMenu_exports);
|
|
26
|
+
|
|
27
|
+
// src/useMenu/useMenu.ts
|
|
28
|
+
var import_vue3 = require("vue");
|
|
29
|
+
var import_menu = require("@agile-plus/primitives/menu");
|
|
30
|
+
|
|
31
|
+
// src/utils/useCollection.ts
|
|
32
|
+
var import_vue = require("vue");
|
|
33
|
+
function useCollection(options) {
|
|
34
|
+
const entries = (0, import_vue.shallowRef)([]);
|
|
35
|
+
const items = (0, import_vue.computed)(() => entries.value);
|
|
36
|
+
function add(item) {
|
|
37
|
+
const key = options.key(item);
|
|
38
|
+
entries.value = [...entries.value.filter((existing) => options.key(existing) !== key), item];
|
|
39
|
+
return () => {
|
|
40
|
+
entries.value = entries.value.filter((existing) => existing !== item);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function remove(key) {
|
|
44
|
+
entries.value = entries.value.filter((existing) => options.key(existing) !== key);
|
|
45
|
+
}
|
|
46
|
+
function replace(item) {
|
|
47
|
+
const key = options.key(item);
|
|
48
|
+
entries.value = entries.value.map(
|
|
49
|
+
(existing) => options.key(existing) === key ? item : existing
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
return { items, add, remove, replace };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// src/utils/useControllable.ts
|
|
56
|
+
var import_vue2 = require("vue");
|
|
57
|
+
function useControllable(options) {
|
|
58
|
+
const controlled = (0, import_vue2.computed)(() => (0, import_vue2.toValue)(options.value));
|
|
59
|
+
const isControlled = (0, import_vue2.computed)(() => controlled.value !== void 0);
|
|
60
|
+
const internal = (0, import_vue2.shallowRef)(options.defaultValue);
|
|
61
|
+
const value = (0, import_vue2.computed)(() => {
|
|
62
|
+
const current = controlled.value;
|
|
63
|
+
return current === void 0 ? internal.value : current;
|
|
64
|
+
});
|
|
65
|
+
function set(next) {
|
|
66
|
+
if (!isControlled.value) internal.value = next;
|
|
67
|
+
options.onChange?.(next);
|
|
68
|
+
}
|
|
69
|
+
function replace(next) {
|
|
70
|
+
if (isControlled.value) return;
|
|
71
|
+
internal.value = next;
|
|
72
|
+
}
|
|
73
|
+
return { value, isControlled, set, replace };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// src/useMenu/useMenu.ts
|
|
77
|
+
var SUBMENU_CLOSE_DELAY = 120;
|
|
78
|
+
function sameKeys(left, right) {
|
|
79
|
+
return left.length === right.length && left.every((key, index) => String(key) === String(right[index]));
|
|
80
|
+
}
|
|
81
|
+
function useMenu(options = {}) {
|
|
82
|
+
const uid = (0, import_vue3.useId)();
|
|
83
|
+
const mode = (0, import_vue3.computed)(() => (0, import_vue3.toValue)(options.mode) ?? "vertical");
|
|
84
|
+
const inlineCollapsed = (0, import_vue3.computed)(() => (0, import_vue3.toValue)(options.inlineCollapsed) ?? false);
|
|
85
|
+
const isDisabled = (0, import_vue3.computed)(() => (0, import_vue3.toValue)(options.disabled) ?? false);
|
|
86
|
+
const multiple = (0, import_vue3.computed)(() => (0, import_vue3.toValue)(options.multiple) ?? false);
|
|
87
|
+
const selectable = (0, import_vue3.computed)(() => (0, import_vue3.toValue)(options.selectable) ?? true);
|
|
88
|
+
const accordion = (0, import_vue3.computed)(() => (0, import_vue3.toValue)(options.accordion) ?? false);
|
|
89
|
+
const isCollapsed = (0, import_vue3.computed)(() => mode.value === "inline" && inlineCollapsed.value);
|
|
90
|
+
const isInline = (0, import_vue3.computed)(() => mode.value === "inline" && !isCollapsed.value);
|
|
91
|
+
const container = (0, import_vue3.computed)(() => (0, import_vue3.toValue)(options.container) ?? "body");
|
|
92
|
+
const selectedState = useControllable({
|
|
93
|
+
value: () => {
|
|
94
|
+
const value = (0, import_vue3.toValue)(options.selectedKeys);
|
|
95
|
+
return value === void 0 ? void 0 : (0, import_menu.normalizeMenuKeys)(value);
|
|
96
|
+
},
|
|
97
|
+
defaultValue: (0, import_menu.normalizeMenuKeys)(options.defaultSelectedKeys ?? []),
|
|
98
|
+
onChange: (keys) => options.onSelectedKeysChange?.(keys)
|
|
99
|
+
});
|
|
100
|
+
const openState = useControllable({
|
|
101
|
+
value: () => {
|
|
102
|
+
const value = (0, import_vue3.toValue)(options.openKeys);
|
|
103
|
+
return value === void 0 ? void 0 : (0, import_menu.normalizeMenuKeys)(value);
|
|
104
|
+
},
|
|
105
|
+
defaultValue: (0, import_menu.normalizeMenuKeys)(options.defaultOpenKeys ?? []),
|
|
106
|
+
onChange: (keys) => {
|
|
107
|
+
options.onOpenKeysChange?.(keys);
|
|
108
|
+
options.onOpenChange?.(keys);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
const selectedKeys = selectedState.value;
|
|
112
|
+
const openKeys = openState.value;
|
|
113
|
+
const focusedId = (0, import_vue3.ref)(null);
|
|
114
|
+
const rootElement = (0, import_vue3.ref)(null);
|
|
115
|
+
const popupElements = /* @__PURE__ */ new Map();
|
|
116
|
+
const closeTimers = /* @__PURE__ */ new Map();
|
|
117
|
+
const collection = useCollection({ key: (entry) => entry.id.value });
|
|
118
|
+
const entries = collection.items;
|
|
119
|
+
function getEntryById(entryId) {
|
|
120
|
+
return entries.value.find((entry) => entry.id.value === entryId);
|
|
121
|
+
}
|
|
122
|
+
function getEntryByValue(value) {
|
|
123
|
+
return entries.value.find((entry) => String(entry.value.value) === String(value));
|
|
124
|
+
}
|
|
125
|
+
function isEntryDisabled(entry) {
|
|
126
|
+
return isDisabled.value || entry.disabled.value;
|
|
127
|
+
}
|
|
128
|
+
function isEntryVisible(entry) {
|
|
129
|
+
let parentValue = entry.parentValue.value;
|
|
130
|
+
const visited = /* @__PURE__ */ new Set();
|
|
131
|
+
while (parentValue !== null) {
|
|
132
|
+
const identity = String(parentValue);
|
|
133
|
+
if (visited.has(identity)) return false;
|
|
134
|
+
visited.add(identity);
|
|
135
|
+
const parent = getEntryByValue(parentValue);
|
|
136
|
+
if (!parent || isEntryDisabled(parent) || !(0, import_menu.menuKeysInclude)(openKeys.value, parent.value.value)) {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
parentValue = parent.parentValue.value;
|
|
140
|
+
}
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
function getLevelEntries(parentValue) {
|
|
144
|
+
return entries.value.filter(
|
|
145
|
+
(entry) => isEntryVisible(entry) && (entry.parentValue.value === null && parentValue === null || entry.parentValue.value !== null && parentValue !== null && String(entry.parentValue.value) === String(parentValue))
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
function getEnabledLevelEntries(parentValue) {
|
|
149
|
+
return getLevelEntries(parentValue).filter((entry) => !isEntryDisabled(entry));
|
|
150
|
+
}
|
|
151
|
+
function getTabStopId() {
|
|
152
|
+
const enabled = entries.value.filter(
|
|
153
|
+
(entry) => isEntryVisible(entry) && !isEntryDisabled(entry)
|
|
154
|
+
);
|
|
155
|
+
const focused = enabled.find((entry) => entry.id.value === focusedId.value);
|
|
156
|
+
const selected = enabled.find(
|
|
157
|
+
(entry) => entry.kind === "item" && (0, import_menu.menuKeysInclude)(selectedKeys.value, entry.value.value)
|
|
158
|
+
);
|
|
159
|
+
return (focused ?? selected ?? enabled[0])?.id.value ?? null;
|
|
160
|
+
}
|
|
161
|
+
function getItemId(entryId) {
|
|
162
|
+
return `menu-${uid}-item-${entryId}`;
|
|
163
|
+
}
|
|
164
|
+
function getSubContentId(entryId) {
|
|
165
|
+
return `menu-${uid}-sub-${entryId}`;
|
|
166
|
+
}
|
|
167
|
+
function isSelected(value) {
|
|
168
|
+
return selectable.value && (0, import_menu.menuKeysInclude)(selectedKeys.value, value);
|
|
169
|
+
}
|
|
170
|
+
function isSubOpen(value) {
|
|
171
|
+
return (0, import_menu.menuKeysInclude)(openKeys.value, value);
|
|
172
|
+
}
|
|
173
|
+
function getRootAttrs() {
|
|
174
|
+
return {
|
|
175
|
+
role: "menu",
|
|
176
|
+
"aria-orientation": mode.value === "horizontal" ? "horizontal" : "vertical",
|
|
177
|
+
"data-mode": mode.value,
|
|
178
|
+
"data-collapsed": isCollapsed.value ? "" : void 0
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
function getItemAttrs(entryId) {
|
|
182
|
+
const entry = getEntryById(entryId);
|
|
183
|
+
if (!entry) return {};
|
|
184
|
+
const disabled = isEntryDisabled(entry);
|
|
185
|
+
const selected = entry.kind === "item" && isSelected(entry.value.value);
|
|
186
|
+
const open = entry.kind === "sub" && isSubOpen(entry.value.value);
|
|
187
|
+
return {
|
|
188
|
+
id: getItemId(entryId),
|
|
189
|
+
role: "menuitem",
|
|
190
|
+
"aria-disabled": disabled || void 0,
|
|
191
|
+
"aria-current": selected ? "page" : void 0,
|
|
192
|
+
"aria-haspopup": entry.kind === "sub" ? "menu" : void 0,
|
|
193
|
+
"aria-expanded": entry.kind === "sub" ? open : void 0,
|
|
194
|
+
"aria-controls": entry.kind === "sub" ? getSubContentId(entryId) : void 0,
|
|
195
|
+
"data-value": String(entry.value.value),
|
|
196
|
+
"data-parent": entry.parentValue.value === null ? void 0 : String(entry.parentValue.value),
|
|
197
|
+
"data-state": entry.kind === "sub" ? open ? "open" : "closed" : selected ? "active" : "inactive",
|
|
198
|
+
"data-disabled": disabled ? "" : void 0,
|
|
199
|
+
tabindex: disabled ? -1 : getTabStopId() === entryId ? 0 : -1
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
function getSubContentAttrs(entryId) {
|
|
203
|
+
const entry = getEntryById(entryId);
|
|
204
|
+
const open = entry ? isSubOpen(entry.value.value) : false;
|
|
205
|
+
return {
|
|
206
|
+
id: getSubContentId(entryId),
|
|
207
|
+
role: "menu",
|
|
208
|
+
"aria-labelledby": getItemId(entryId),
|
|
209
|
+
"data-state": open ? "open" : "closed",
|
|
210
|
+
hidden: !open
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
function focusItem(entryId) {
|
|
214
|
+
const entry = getEntryById(entryId);
|
|
215
|
+
if (!entry || isEntryDisabled(entry) || !isEntryVisible(entry)) return;
|
|
216
|
+
focusedId.value = entryId;
|
|
217
|
+
entry.element.value?.focus({ preventScroll: true });
|
|
218
|
+
}
|
|
219
|
+
function onItemFocus(entryId) {
|
|
220
|
+
if (getEntryById(entryId)) focusedId.value = entryId;
|
|
221
|
+
}
|
|
222
|
+
function onItemPointerEnter(entryId) {
|
|
223
|
+
focusItem(entryId);
|
|
224
|
+
}
|
|
225
|
+
function selectItem(value) {
|
|
226
|
+
const entry = getEntryByValue(value);
|
|
227
|
+
if (!selectable.value || !entry || entry.kind !== "item" || isEntryDisabled(entry)) return;
|
|
228
|
+
const next = (0, import_menu.resolveMenuSelection)({
|
|
229
|
+
selectedKeys: selectedKeys.value,
|
|
230
|
+
key: entry.value.value,
|
|
231
|
+
multiple: multiple.value
|
|
232
|
+
});
|
|
233
|
+
if (!sameKeys(next, selectedKeys.value)) selectedState.set(next);
|
|
234
|
+
const info = {
|
|
235
|
+
key: entry.value.value,
|
|
236
|
+
keyPath: (0, import_menu.getMenuKeyPath)({
|
|
237
|
+
key: entry.value.value,
|
|
238
|
+
items: entries.value.map((item) => ({
|
|
239
|
+
key: item.value.value,
|
|
240
|
+
parentKey: item.parentValue.value
|
|
241
|
+
}))
|
|
242
|
+
}),
|
|
243
|
+
selectedKeys: next
|
|
244
|
+
};
|
|
245
|
+
options.onSelect?.(info);
|
|
246
|
+
}
|
|
247
|
+
function cancelSubClose(value) {
|
|
248
|
+
const identity = String(value);
|
|
249
|
+
const timer = closeTimers.get(identity);
|
|
250
|
+
if (timer === void 0) return;
|
|
251
|
+
clearTimeout(timer);
|
|
252
|
+
closeTimers.delete(identity);
|
|
253
|
+
}
|
|
254
|
+
function setSubOpen(value, open, focusFirst = false) {
|
|
255
|
+
const entry = getEntryByValue(value);
|
|
256
|
+
if (!entry || entry.kind !== "sub" || isEntryDisabled(entry)) return;
|
|
257
|
+
cancelSubClose(value);
|
|
258
|
+
const next = (0, import_menu.resolveMenuOpenKeys)({
|
|
259
|
+
openKeys: openKeys.value,
|
|
260
|
+
key: entry.value.value,
|
|
261
|
+
open,
|
|
262
|
+
parentKey: entry.parentValue.value,
|
|
263
|
+
accordion: accordion.value,
|
|
264
|
+
items: entries.value.filter((item) => item.kind === "sub").map((item) => ({ key: item.value.value, parentKey: item.parentValue.value }))
|
|
265
|
+
});
|
|
266
|
+
if (!sameKeys(next, openKeys.value)) openState.set(next);
|
|
267
|
+
if (open && focusFirst) {
|
|
268
|
+
void (0, import_vue3.nextTick)(() => {
|
|
269
|
+
const first = getEnabledLevelEntries(entry.value.value)[0];
|
|
270
|
+
if (first) focusItem(first.id.value);
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
function openSub(value) {
|
|
275
|
+
setSubOpen(value, true);
|
|
276
|
+
}
|
|
277
|
+
function closeSub(value) {
|
|
278
|
+
setSubOpen(value, false);
|
|
279
|
+
}
|
|
280
|
+
function toggleSub(value) {
|
|
281
|
+
setSubOpen(value, !isSubOpen(value), !isSubOpen(value));
|
|
282
|
+
}
|
|
283
|
+
function scheduleSubClose(value) {
|
|
284
|
+
cancelSubClose(value);
|
|
285
|
+
const identity = String(value);
|
|
286
|
+
const timer = setTimeout(() => {
|
|
287
|
+
closeTimers.delete(identity);
|
|
288
|
+
closeSub(value);
|
|
289
|
+
}, SUBMENU_CLOSE_DELAY);
|
|
290
|
+
closeTimers.set(identity, timer);
|
|
291
|
+
}
|
|
292
|
+
function closePopups() {
|
|
293
|
+
if (openKeys.value.length > 0) openState.set([]);
|
|
294
|
+
}
|
|
295
|
+
function moveFocus(entry, direction) {
|
|
296
|
+
const enabled = getEnabledLevelEntries(entry.parentValue.value);
|
|
297
|
+
const currentIndex = enabled.findIndex((item) => item.id.value === entry.id.value);
|
|
298
|
+
const targetIndex = (0, import_menu.getNextMenuIndex)({ currentIndex, length: enabled.length, direction });
|
|
299
|
+
const target = targetIndex === null ? void 0 : enabled[targetIndex];
|
|
300
|
+
if (target) focusItem(target.id.value);
|
|
301
|
+
}
|
|
302
|
+
function closeParentSub(entry) {
|
|
303
|
+
if (entry.parentValue.value === null) return;
|
|
304
|
+
const parent = getEntryByValue(entry.parentValue.value);
|
|
305
|
+
closeSub(entry.parentValue.value);
|
|
306
|
+
if (parent) focusItem(parent.id.value);
|
|
307
|
+
}
|
|
308
|
+
function openSubAndFocusFirst(entry) {
|
|
309
|
+
setSubOpen(entry.value.value, true, true);
|
|
310
|
+
}
|
|
311
|
+
function onItemKeydown(event, entryId) {
|
|
312
|
+
const entry = getEntryById(entryId);
|
|
313
|
+
if (!entry || isEntryDisabled(entry)) return;
|
|
314
|
+
if (event.shiftKey || event.ctrlKey || event.altKey || event.metaKey) return;
|
|
315
|
+
const key = event.key;
|
|
316
|
+
if (key === "Enter" || key === " ") {
|
|
317
|
+
event.preventDefault();
|
|
318
|
+
if (entry.kind === "sub") toggleSub(entry.value.value);
|
|
319
|
+
else selectItem(entry.value.value);
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
if (key === "Home" || key === "End") {
|
|
323
|
+
event.preventDefault();
|
|
324
|
+
moveFocus(entry, key === "Home" ? "first" : "last");
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
if (key === "Escape") {
|
|
328
|
+
event.preventDefault();
|
|
329
|
+
if (entry.kind === "sub" && isSubOpen(entry.value.value)) closeSub(entry.value.value);
|
|
330
|
+
else closeParentSub(entry);
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
if (mode.value === "horizontal" && entry.parentValue.value === null) {
|
|
334
|
+
if (key === "ArrowRight" || key === "ArrowLeft") {
|
|
335
|
+
event.preventDefault();
|
|
336
|
+
moveFocus(entry, key === "ArrowRight" ? "next" : "previous");
|
|
337
|
+
} else if (key === "ArrowDown" && entry.kind === "sub") {
|
|
338
|
+
event.preventDefault();
|
|
339
|
+
openSubAndFocusFirst(entry);
|
|
340
|
+
}
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
if (key === "ArrowRight" && entry.kind === "sub") {
|
|
344
|
+
event.preventDefault();
|
|
345
|
+
openSubAndFocusFirst(entry);
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
if (key === "ArrowLeft") {
|
|
349
|
+
event.preventDefault();
|
|
350
|
+
closeParentSub(entry);
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
if (key === "ArrowDown" || key === "ArrowUp") {
|
|
354
|
+
event.preventDefault();
|
|
355
|
+
moveFocus(entry, key === "ArrowDown" ? "next" : "previous");
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
if (key.length === 1) {
|
|
359
|
+
const match = (0, import_menu.findMenuTypeaheadMatch)({
|
|
360
|
+
entries: getEnabledLevelEntries(entry.parentValue.value).map((item) => ({
|
|
361
|
+
id: item.id.value,
|
|
362
|
+
textValue: item.textValue.value,
|
|
363
|
+
disabled: false
|
|
364
|
+
})),
|
|
365
|
+
search: key,
|
|
366
|
+
currentId: entryId
|
|
367
|
+
});
|
|
368
|
+
if (match !== null) {
|
|
369
|
+
event.preventDefault();
|
|
370
|
+
focusItem(match);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
function setRootElement(node) {
|
|
375
|
+
rootElement.value = node instanceof HTMLElement ? node : null;
|
|
376
|
+
}
|
|
377
|
+
function setPopupElement(entryId, node) {
|
|
378
|
+
if (node) popupElements.set(entryId, node);
|
|
379
|
+
else popupElements.delete(entryId);
|
|
380
|
+
}
|
|
381
|
+
const hasPopups = (0, import_vue3.computed)(() => !isInline.value && openKeys.value.length > 0);
|
|
382
|
+
function handleDocumentPointerDown(event) {
|
|
383
|
+
const target = event.target;
|
|
384
|
+
if (!(target instanceof Node)) return;
|
|
385
|
+
if (rootElement.value?.contains(target)) return;
|
|
386
|
+
for (const element of popupElements.values()) {
|
|
387
|
+
if (element.contains(target)) return;
|
|
388
|
+
}
|
|
389
|
+
closePopups();
|
|
390
|
+
}
|
|
391
|
+
(0, import_vue3.watch)([hasPopups, rootElement], ([open]) => {
|
|
392
|
+
if (typeof document === "undefined") return;
|
|
393
|
+
document.removeEventListener("pointerdown", handleDocumentPointerDown, true);
|
|
394
|
+
if (open) document.addEventListener("pointerdown", handleDocumentPointerDown, true);
|
|
395
|
+
});
|
|
396
|
+
(0, import_vue3.onScopeDispose)(() => {
|
|
397
|
+
if (typeof document !== "undefined") {
|
|
398
|
+
document.removeEventListener("pointerdown", handleDocumentPointerDown, true);
|
|
399
|
+
}
|
|
400
|
+
for (const timer of closeTimers.values()) clearTimeout(timer);
|
|
401
|
+
closeTimers.clear();
|
|
402
|
+
popupElements.clear();
|
|
403
|
+
});
|
|
404
|
+
return {
|
|
405
|
+
mode,
|
|
406
|
+
selectedKeys,
|
|
407
|
+
openKeys,
|
|
408
|
+
isDisabled,
|
|
409
|
+
isCollapsed,
|
|
410
|
+
isInline,
|
|
411
|
+
container,
|
|
412
|
+
focusedValue: (0, import_vue3.computed)(() => getEntryById(focusedId.value ?? "")?.value.value ?? null),
|
|
413
|
+
isSelected,
|
|
414
|
+
isSubOpen,
|
|
415
|
+
registerItem: collection.add,
|
|
416
|
+
setRootElement,
|
|
417
|
+
setPopupElement,
|
|
418
|
+
getRootAttrs,
|
|
419
|
+
getItemAttrs,
|
|
420
|
+
getSubContentAttrs,
|
|
421
|
+
selectItem,
|
|
422
|
+
toggleSub,
|
|
423
|
+
openSub,
|
|
424
|
+
closeSub,
|
|
425
|
+
scheduleSubClose,
|
|
426
|
+
cancelSubClose,
|
|
427
|
+
closePopups,
|
|
428
|
+
focusItem,
|
|
429
|
+
onItemFocus,
|
|
430
|
+
onItemPointerEnter,
|
|
431
|
+
onItemKeydown
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
435
|
+
0 && (module.exports = {
|
|
436
|
+
useMenu
|
|
437
|
+
});
|
|
438
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/useMenu/index.ts","../../src/useMenu/useMenu.ts","../../src/utils/useCollection.ts","../../src/utils/useControllable.ts"],"sourcesContent":["export type {\n MenuItemEntry,\n MenuItemKind,\n MenuSelectInfo,\n UseMenuOptions,\n UseMenuReturn,\n} from './types';\n\nexport { useMenu } from './useMenu';\n","import { computed, nextTick, onScopeDispose, ref, toValue, useId, watch } from 'vue';\n\nimport {\n findMenuTypeaheadMatch,\n getMenuKeyPath,\n getNextMenuIndex,\n menuKeysInclude,\n normalizeMenuKeys,\n resolveMenuOpenKeys,\n resolveMenuSelection,\n} from '@agile-plus/primitives/menu';\n\nimport { useCollection } from '../utils/useCollection';\nimport { useControllable } from '../utils/useControllable';\n\nimport type { MenuKey } from '@agile-plus/primitives/menu';\n\nimport type { MenuItemEntry, MenuSelectInfo, UseMenuOptions, UseMenuReturn } from './types';\n\nconst SUBMENU_CLOSE_DELAY = 120;\n\n/** 判断两个键数组是否按字符串身份完全一致。 */\nfunction sameKeys(left: MenuKey[], right: MenuKey[]): boolean {\n return (\n left.length === right.length && left.every((key, index) => String(key) === String(right[index]))\n );\n}\n\n/**\n * 导航菜单的 Vue 适配。\n *\n * Root 同时持有选中键与展开键,子组件只登记语义和元素引用。弹出子菜单的定位由各自\n * Content 使用 useFloating 完成,本层统一管理开合、外部点击与跨层焦点。\n *\n * @param options 菜单状态与行为配置。\n * @returns 响应式状态、登记表和交互处理器。\n */\nexport function useMenu(options: UseMenuOptions = {}): UseMenuReturn {\n const uid = useId();\n\n const mode = computed(() => toValue(options.mode) ?? 'vertical');\n const inlineCollapsed = computed(() => toValue(options.inlineCollapsed) ?? false);\n const isDisabled = computed(() => toValue(options.disabled) ?? false);\n const multiple = computed(() => toValue(options.multiple) ?? false);\n const selectable = computed(() => toValue(options.selectable) ?? true);\n const accordion = computed(() => toValue(options.accordion) ?? false);\n const isCollapsed = computed(() => mode.value === 'inline' && inlineCollapsed.value);\n const isInline = computed(() => mode.value === 'inline' && !isCollapsed.value);\n const container = computed(() => toValue(options.container) ?? 'body');\n\n const selectedState = useControllable<MenuKey[]>({\n value: () => {\n const value = toValue(options.selectedKeys);\n\n return value === undefined ? undefined : normalizeMenuKeys(value);\n },\n defaultValue: normalizeMenuKeys(options.defaultSelectedKeys ?? []),\n onChange: (keys) => options.onSelectedKeysChange?.(keys),\n });\n\n const openState = useControllable<MenuKey[]>({\n value: () => {\n const value = toValue(options.openKeys);\n\n return value === undefined ? undefined : normalizeMenuKeys(value);\n },\n defaultValue: normalizeMenuKeys(options.defaultOpenKeys ?? []),\n onChange: (keys) => {\n options.onOpenKeysChange?.(keys);\n options.onOpenChange?.(keys);\n },\n });\n\n const selectedKeys = selectedState.value;\n const openKeys = openState.value;\n const focusedId = ref<string | null>(null);\n const rootElement = ref<HTMLElement | null>(null);\n const popupElements = new Map<string, HTMLElement>();\n const closeTimers = new Map<string, ReturnType<typeof setTimeout>>();\n\n const collection = useCollection<MenuItemEntry>({ key: (entry) => entry.id.value });\n const entries = collection.items;\n\n function getEntryById(entryId: string): MenuItemEntry | undefined {\n return entries.value.find((entry) => entry.id.value === entryId);\n }\n\n function getEntryByValue(value: MenuKey): MenuItemEntry | undefined {\n return entries.value.find((entry) => String(entry.value.value) === String(value));\n }\n\n function isEntryDisabled(entry: MenuItemEntry): boolean {\n return isDisabled.value || entry.disabled.value;\n }\n\n function isEntryVisible(entry: MenuItemEntry): boolean {\n let parentValue = entry.parentValue.value;\n const visited = new Set<string>();\n\n while (parentValue !== null) {\n const identity = String(parentValue);\n\n if (visited.has(identity)) return false;\n\n visited.add(identity);\n\n const parent = getEntryByValue(parentValue);\n\n if (\n !parent ||\n isEntryDisabled(parent) ||\n !menuKeysInclude(openKeys.value, parent.value.value)\n ) {\n return false;\n }\n\n parentValue = parent.parentValue.value;\n }\n\n return true;\n }\n\n function getLevelEntries(parentValue: MenuKey | null): MenuItemEntry[] {\n return entries.value.filter(\n (entry) =>\n isEntryVisible(entry) &&\n ((entry.parentValue.value === null && parentValue === null) ||\n (entry.parentValue.value !== null &&\n parentValue !== null &&\n String(entry.parentValue.value) === String(parentValue)))\n );\n }\n\n function getEnabledLevelEntries(parentValue: MenuKey | null): MenuItemEntry[] {\n return getLevelEntries(parentValue).filter((entry) => !isEntryDisabled(entry));\n }\n\n function getTabStopId(): string | null {\n const enabled = entries.value.filter(\n (entry) => isEntryVisible(entry) && !isEntryDisabled(entry)\n );\n const focused = enabled.find((entry) => entry.id.value === focusedId.value);\n const selected = enabled.find(\n (entry) => entry.kind === 'item' && menuKeysInclude(selectedKeys.value, entry.value.value)\n );\n\n return (focused ?? selected ?? enabled[0])?.id.value ?? null;\n }\n\n function getItemId(entryId: string): string {\n return `menu-${uid}-item-${entryId}`;\n }\n\n function getSubContentId(entryId: string): string {\n return `menu-${uid}-sub-${entryId}`;\n }\n\n function isSelected(value: MenuKey): boolean {\n return selectable.value && menuKeysInclude(selectedKeys.value, value);\n }\n\n function isSubOpen(value: MenuKey): boolean {\n return menuKeysInclude(openKeys.value, value);\n }\n\n function getRootAttrs(): Record<string, unknown> {\n return {\n role: 'menu',\n 'aria-orientation': mode.value === 'horizontal' ? 'horizontal' : 'vertical',\n 'data-mode': mode.value,\n 'data-collapsed': isCollapsed.value ? '' : undefined,\n };\n }\n\n function getItemAttrs(entryId: string): Record<string, unknown> {\n const entry = getEntryById(entryId);\n\n if (!entry) return {};\n\n const disabled = isEntryDisabled(entry);\n const selected = entry.kind === 'item' && isSelected(entry.value.value);\n const open = entry.kind === 'sub' && isSubOpen(entry.value.value);\n\n return {\n id: getItemId(entryId),\n role: 'menuitem',\n 'aria-disabled': disabled || undefined,\n 'aria-current': selected ? 'page' : undefined,\n 'aria-haspopup': entry.kind === 'sub' ? 'menu' : undefined,\n 'aria-expanded': entry.kind === 'sub' ? open : undefined,\n 'aria-controls': entry.kind === 'sub' ? getSubContentId(entryId) : undefined,\n 'data-value': String(entry.value.value),\n 'data-parent': entry.parentValue.value === null ? undefined : String(entry.parentValue.value),\n 'data-state':\n entry.kind === 'sub' ? (open ? 'open' : 'closed') : selected ? 'active' : 'inactive',\n 'data-disabled': disabled ? '' : undefined,\n tabindex: disabled ? -1 : getTabStopId() === entryId ? 0 : -1,\n };\n }\n\n function getSubContentAttrs(entryId: string): Record<string, unknown> {\n const entry = getEntryById(entryId);\n const open = entry ? isSubOpen(entry.value.value) : false;\n\n return {\n id: getSubContentId(entryId),\n role: 'menu',\n 'aria-labelledby': getItemId(entryId),\n 'data-state': open ? 'open' : 'closed',\n hidden: !open,\n };\n }\n\n function focusItem(entryId: string): void {\n const entry = getEntryById(entryId);\n\n if (!entry || isEntryDisabled(entry) || !isEntryVisible(entry)) return;\n\n focusedId.value = entryId;\n entry.element.value?.focus({ preventScroll: true });\n }\n\n function onItemFocus(entryId: string): void {\n if (getEntryById(entryId)) focusedId.value = entryId;\n }\n\n function onItemPointerEnter(entryId: string): void {\n focusItem(entryId);\n }\n\n function selectItem(value: MenuKey): void {\n const entry = getEntryByValue(value);\n\n if (!selectable.value || !entry || entry.kind !== 'item' || isEntryDisabled(entry)) return;\n\n const next = resolveMenuSelection({\n selectedKeys: selectedKeys.value,\n key: entry.value.value,\n multiple: multiple.value,\n });\n\n if (!sameKeys(next, selectedKeys.value)) selectedState.set(next);\n\n const info: MenuSelectInfo = {\n key: entry.value.value,\n keyPath: getMenuKeyPath({\n key: entry.value.value,\n items: entries.value.map((item) => ({\n key: item.value.value,\n parentKey: item.parentValue.value,\n })),\n }),\n selectedKeys: next,\n };\n\n options.onSelect?.(info);\n }\n\n function cancelSubClose(value: MenuKey): void {\n const identity = String(value);\n const timer = closeTimers.get(identity);\n\n if (timer === undefined) return;\n\n clearTimeout(timer);\n closeTimers.delete(identity);\n }\n\n function setSubOpen(value: MenuKey, open: boolean, focusFirst = false): void {\n const entry = getEntryByValue(value);\n\n if (!entry || entry.kind !== 'sub' || isEntryDisabled(entry)) return;\n\n cancelSubClose(value);\n\n const next = resolveMenuOpenKeys({\n openKeys: openKeys.value,\n key: entry.value.value,\n open,\n parentKey: entry.parentValue.value,\n accordion: accordion.value,\n items: entries.value\n .filter((item) => item.kind === 'sub')\n .map((item) => ({ key: item.value.value, parentKey: item.parentValue.value })),\n });\n\n if (!sameKeys(next, openKeys.value)) openState.set(next);\n\n if (open && focusFirst) {\n void nextTick(() => {\n const first = getEnabledLevelEntries(entry.value.value)[0];\n\n if (first) focusItem(first.id.value);\n });\n }\n }\n\n function openSub(value: MenuKey): void {\n setSubOpen(value, true);\n }\n\n function closeSub(value: MenuKey): void {\n setSubOpen(value, false);\n }\n\n function toggleSub(value: MenuKey): void {\n setSubOpen(value, !isSubOpen(value), !isSubOpen(value));\n }\n\n function scheduleSubClose(value: MenuKey): void {\n cancelSubClose(value);\n\n const identity = String(value);\n const timer = setTimeout(() => {\n closeTimers.delete(identity);\n closeSub(value);\n }, SUBMENU_CLOSE_DELAY);\n\n closeTimers.set(identity, timer);\n }\n\n function closePopups(): void {\n if (openKeys.value.length > 0) openState.set([]);\n }\n\n function moveFocus(\n entry: MenuItemEntry,\n direction: 'next' | 'previous' | 'first' | 'last'\n ): void {\n const enabled = getEnabledLevelEntries(entry.parentValue.value);\n const currentIndex = enabled.findIndex((item) => item.id.value === entry.id.value);\n const targetIndex = getNextMenuIndex({ currentIndex, length: enabled.length, direction });\n const target = targetIndex === null ? undefined : enabled[targetIndex];\n\n if (target) focusItem(target.id.value);\n }\n\n function closeParentSub(entry: MenuItemEntry): void {\n if (entry.parentValue.value === null) return;\n\n const parent = getEntryByValue(entry.parentValue.value);\n\n closeSub(entry.parentValue.value);\n\n if (parent) focusItem(parent.id.value);\n }\n\n function openSubAndFocusFirst(entry: MenuItemEntry): void {\n setSubOpen(entry.value.value, true, true);\n }\n\n function onItemKeydown(event: KeyboardEvent, entryId: string): void {\n const entry = getEntryById(entryId);\n\n if (!entry || isEntryDisabled(entry)) return;\n if (event.shiftKey || event.ctrlKey || event.altKey || event.metaKey) return;\n\n const key = event.key;\n\n if (key === 'Enter' || key === ' ') {\n event.preventDefault();\n\n if (entry.kind === 'sub') toggleSub(entry.value.value);\n else selectItem(entry.value.value);\n\n return;\n }\n\n if (key === 'Home' || key === 'End') {\n event.preventDefault();\n moveFocus(entry, key === 'Home' ? 'first' : 'last');\n return;\n }\n\n if (key === 'Escape') {\n event.preventDefault();\n\n if (entry.kind === 'sub' && isSubOpen(entry.value.value)) closeSub(entry.value.value);\n else closeParentSub(entry);\n\n return;\n }\n\n if (mode.value === 'horizontal' && entry.parentValue.value === null) {\n if (key === 'ArrowRight' || key === 'ArrowLeft') {\n event.preventDefault();\n moveFocus(entry, key === 'ArrowRight' ? 'next' : 'previous');\n } else if (key === 'ArrowDown' && entry.kind === 'sub') {\n event.preventDefault();\n openSubAndFocusFirst(entry);\n }\n\n return;\n }\n\n if (key === 'ArrowRight' && entry.kind === 'sub') {\n event.preventDefault();\n openSubAndFocusFirst(entry);\n return;\n }\n\n if (key === 'ArrowLeft') {\n event.preventDefault();\n closeParentSub(entry);\n return;\n }\n\n if (key === 'ArrowDown' || key === 'ArrowUp') {\n event.preventDefault();\n moveFocus(entry, key === 'ArrowDown' ? 'next' : 'previous');\n return;\n }\n\n if (key.length === 1) {\n const match = findMenuTypeaheadMatch({\n entries: getEnabledLevelEntries(entry.parentValue.value).map((item) => ({\n id: item.id.value,\n textValue: item.textValue.value,\n disabled: false,\n })),\n search: key,\n currentId: entryId,\n });\n\n if (match !== null) {\n event.preventDefault();\n focusItem(match);\n }\n }\n }\n\n function setRootElement(node: unknown): void {\n rootElement.value = node instanceof HTMLElement ? node : null;\n }\n\n function setPopupElement(entryId: string, node: HTMLElement | null): void {\n if (node) popupElements.set(entryId, node);\n else popupElements.delete(entryId);\n }\n\n const hasPopups = computed(() => !isInline.value && openKeys.value.length > 0);\n\n function handleDocumentPointerDown(event: PointerEvent): void {\n const target = event.target;\n\n if (!(target instanceof Node)) return;\n if (rootElement.value?.contains(target)) return;\n\n for (const element of popupElements.values()) {\n if (element.contains(target)) return;\n }\n\n closePopups();\n }\n\n watch([hasPopups, rootElement], ([open]) => {\n if (typeof document === 'undefined') return;\n\n document.removeEventListener('pointerdown', handleDocumentPointerDown, true);\n\n if (open) document.addEventListener('pointerdown', handleDocumentPointerDown, true);\n });\n\n onScopeDispose(() => {\n if (typeof document !== 'undefined') {\n document.removeEventListener('pointerdown', handleDocumentPointerDown, true);\n }\n\n for (const timer of closeTimers.values()) clearTimeout(timer);\n\n closeTimers.clear();\n popupElements.clear();\n });\n\n return {\n mode,\n selectedKeys,\n openKeys,\n isDisabled,\n isCollapsed,\n isInline,\n container,\n focusedValue: computed(() => getEntryById(focusedId.value ?? '')?.value.value ?? null),\n isSelected,\n isSubOpen,\n registerItem: collection.add,\n setRootElement,\n setPopupElement,\n getRootAttrs,\n getItemAttrs,\n getSubContentAttrs,\n selectItem,\n toggleSub,\n openSub,\n closeSub,\n scheduleSubClose,\n cancelSubClose,\n closePopups,\n focusItem,\n onItemFocus,\n onItemPointerEnter,\n onItemKeydown,\n };\n}\n","import { computed, shallowRef } from 'vue';\n\nimport type { ComputedRef } from 'vue';\n\n/**\n * useCollection 的配置项。\n */\nexport interface UseCollectionOptions<T> {\n /**\n * 从条目取唯一键。\n *\n * 同键重复登记时覆盖旧条目而不是追加:热更新或项的 value 变化会让 setup/watch 再跑\n * 一次,追加会让同一个条目在遍历顺序里出现两遍。\n *\n * @param item 条目。\n * @returns 唯一键。\n */\n key: (item: T) => string;\n}\n\n/**\n * useCollection 的返回值。\n */\nexport interface UseCollectionReturn<T> {\n /** 按登记顺序排列的条目;消费方按自己的语义再过滤(可用项、活动项等) */\n items: ComputedRef<T[]>;\n\n /**\n * 登记一个条目。\n *\n * @param item 条目。\n * @returns 注销函数,只摘掉这个实例本身。\n */\n add(item: T): () => void;\n\n /**\n * 按键注销。\n *\n * @param key 条目键。\n */\n remove(key: string): void;\n\n /**\n * 原地替换同键条目。\n *\n * @param item 新条目,键必须与已登记的一致。\n */\n replace(item: T): void;\n}\n\n/**\n * 父级组件登记子项的共享集合。\n *\n * 「子组件挂载时把自己登记进父级、卸载时摘掉」在 RadioGroup、Toast、ToggleGroup 里\n * 各写了一遍,而且都踩过同一个坑:**条目里带 Ref 时不能用深响应**——`ref([])` 会拆掉\n * 嵌套 Ref,父级读到的 `entry.element` 变成元素而不是 Ref,键盘导航与焦点回还就会\n * 读到过期快照。这里用 shallowRef 把这个结论只解释一次。\n *\n * 顺序按登记顺序(即挂载顺序,模板里就是 DOM 顺序),需要别的顺序由调用方反转。\n *\n * @param options 取键方式。\n * @returns 条目集合与登记入口。\n */\nexport function useCollection<T>(options: UseCollectionOptions<T>): UseCollectionReturn<T> {\n const entries = shallowRef<T[]>([]);\n\n const items = computed(() => entries.value);\n\n function add(item: T): () => void {\n const key = options.key(item);\n\n entries.value = [...entries.value.filter((existing) => options.key(existing) !== key), item];\n\n return () => {\n entries.value = entries.value.filter((existing) => existing !== item);\n };\n }\n\n function remove(key: string): void {\n entries.value = entries.value.filter((existing) => options.key(existing) !== key);\n }\n\n function replace(item: T): void {\n const key = options.key(item);\n\n entries.value = entries.value.map((existing) =>\n options.key(existing) === key ? item : existing\n );\n }\n\n return { items, add, remove, replace };\n}\n","import { computed, shallowRef, toValue } from 'vue';\n\nimport type { ComputedRef, MaybeRefOrGetter } from 'vue';\n\n/**\n * 受控 / 非受控状态。\n *\n * 这是 Radix `useControllableState` 的对应物,也是本库所有带状态组件的真源判定入口。\n *\n * @template T 值类型。整体替换语义(数组也是换一个新数组而不是就地改),因此内部用\n * shallowRef:深响应会把值里嵌套的 Ref 拆包,而这个 hook 无法保证调用方传进来的形状。\n */\nexport interface UseControllableOptions<T> {\n /**\n * 受控值来源。\n *\n * **`undefined` 就是「未受控」的唯一判据**:封装层必须让 Boolean prop 缺省保持\n * undefined,被 cast 成 false 会让组件变成「受控且恒为该值」,非受控用法静默失效。\n */\n value?: MaybeRefOrGetter<T | undefined>;\n\n /** 非受控模式的初始值,必须由调用方给出(不提供隐式零值,避免各组件默认值漂移) */\n defaultValue: T;\n\n /**\n * 值变化回调。\n *\n * 受控模式下同样会触发,且此时它是新值唯一的落地路径;因此回调不能只在非受控分支调用。\n */\n onChange?: (value: T) => void;\n}\n\n/**\n * useControllable 的返回值。\n */\nexport interface UseControllableReturn<T> {\n /** 当前值:受控时跟随外部来源,否则是内部状态 */\n value: ComputedRef<T>;\n\n /** 是否处于受控模式 */\n isControlled: ComputedRef<boolean>;\n\n /**\n * 写入新值。\n *\n * 顺序固定为「先落地内部状态,再通知外部」:这样回调里同步读 `value` 得到的就是新值。\n * 受控模式下不写内部(写了就是越权改写调用方的状态),只通知。\n *\n * @param next 目标值。\n */\n set(next: T): void;\n\n /**\n * 只修正内部值,不通知外部。\n *\n * 留给「生命周期兜底修正」这类场景:子项被卸载时要把选中值清掉,但那不是用户操作,\n * 不该冒出一个 change 事件。除这种场合外都应该用 set。\n *\n * @param next 目标值;受控模式下无操作。\n */\n replace(next: T): void;\n}\n\n/**\n * 创建受控 / 非受控状态。\n *\n * @param options 受控来源、默认值与变化回调。\n * @returns 值、受控判定与两种写入方式。\n */\nexport function useControllable<T>(options: UseControllableOptions<T>): UseControllableReturn<T> {\n const controlled = computed(() => toValue(options.value));\n\n const isControlled = computed(() => controlled.value !== undefined);\n\n const internal = shallowRef<T>(options.defaultValue);\n\n const value = computed<T>(() => {\n const current = controlled.value;\n\n return current === undefined ? internal.value : current;\n });\n\n function set(next: T): void {\n if (!isControlled.value) internal.value = next;\n\n options.onChange?.(next);\n }\n\n function replace(next: T): void {\n if (isControlled.value) return;\n\n internal.value = next;\n }\n\n return { value, isControlled, set, replace };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,cAA+E;AAE/E,kBAQO;;;ACVP,iBAAqC;AA+D9B,SAAS,cAAiB,SAA0D;AACzF,QAAM,cAAU,uBAAgB,CAAC,CAAC;AAElC,QAAM,YAAQ,qBAAS,MAAM,QAAQ,KAAK;AAE1C,WAAS,IAAI,MAAqB;AAChC,UAAM,MAAM,QAAQ,IAAI,IAAI;AAE5B,YAAQ,QAAQ,CAAC,GAAG,QAAQ,MAAM,OAAO,CAAC,aAAa,QAAQ,IAAI,QAAQ,MAAM,GAAG,GAAG,IAAI;AAE3F,WAAO,MAAM;AACX,cAAQ,QAAQ,QAAQ,MAAM,OAAO,CAAC,aAAa,aAAa,IA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