@v-c/menu 0.0.1 → 0.0.3

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.
Files changed (58) hide show
  1. package/dist/Divider.cjs +33 -36
  2. package/dist/Divider.js +28 -34
  3. package/dist/Icon.cjs +39 -38
  4. package/dist/Icon.js +36 -38
  5. package/dist/Menu.cjs +506 -575
  6. package/dist/Menu.d.ts +2 -0
  7. package/dist/Menu.js +495 -570
  8. package/dist/MenuItem.cjs +314 -344
  9. package/dist/MenuItem.js +303 -339
  10. package/dist/MenuItemGroup.cjs +98 -116
  11. package/dist/MenuItemGroup.js +91 -113
  12. package/dist/SubMenu/InlineSubMenuList.cjs +58 -82
  13. package/dist/SubMenu/InlineSubMenuList.js +54 -81
  14. package/dist/SubMenu/PopupTrigger.cjs +133 -167
  15. package/dist/SubMenu/PopupTrigger.d.ts +2 -2
  16. package/dist/SubMenu/PopupTrigger.js +126 -165
  17. package/dist/SubMenu/SubMenuList.cjs +18 -26
  18. package/dist/SubMenu/SubMenuList.js +14 -25
  19. package/dist/SubMenu/index.cjs +479 -526
  20. package/dist/SubMenu/index.js +469 -521
  21. package/dist/_virtual/rolldown_runtime.cjs +21 -0
  22. package/dist/context/IdContext.cjs +15 -23
  23. package/dist/context/IdContext.js +15 -27
  24. package/dist/context/MenuContext.cjs +183 -174
  25. package/dist/context/MenuContext.js +180 -177
  26. package/dist/context/PathContext.cjs +54 -79
  27. package/dist/context/PathContext.js +54 -90
  28. package/dist/context/PrivateContext.cjs +11 -17
  29. package/dist/context/PrivateContext.js +11 -20
  30. package/dist/hooks/useAccessibility.cjs +171 -191
  31. package/dist/hooks/useAccessibility.js +168 -193
  32. package/dist/hooks/useActive.cjs +25 -28
  33. package/dist/hooks/useActive.js +23 -28
  34. package/dist/hooks/useDirectionStyle.cjs +11 -17
  35. package/dist/hooks/useDirectionStyle.js +9 -17
  36. package/dist/hooks/useKeyRecords.cjs +70 -88
  37. package/dist/hooks/useKeyRecords.js +68 -89
  38. package/dist/hooks/useMemoCallback.cjs +9 -9
  39. package/dist/hooks/useMemoCallback.js +7 -9
  40. package/dist/index.cjs +21 -21
  41. package/dist/index.d.ts +2 -2
  42. package/dist/index.js +12 -20
  43. package/dist/interface.cjs +0 -1
  44. package/dist/interface.js +0 -1
  45. package/dist/placements.cjs +70 -70
  46. package/dist/placements.js +69 -72
  47. package/dist/utils/commonUtil.cjs +24 -26
  48. package/dist/utils/commonUtil.js +23 -26
  49. package/dist/utils/motionUtil.cjs +2 -9
  50. package/dist/utils/motionUtil.js +3 -10
  51. package/dist/utils/nodeUtil.cjs +49 -77
  52. package/dist/utils/nodeUtil.d.ts +4 -1
  53. package/dist/utils/nodeUtil.js +48 -77
  54. package/dist/utils/timeUtil.cjs +2 -3
  55. package/dist/utils/timeUtil.js +3 -4
  56. package/dist/utils/warnUtil.cjs +8 -14
  57. package/dist/utils/warnUtil.js +7 -14
  58. package/package.json +2 -2
@@ -1,77 +1,74 @@
1
- const autoAdjustOverflow = {
2
- adjustX: 1,
3
- adjustY: 1
1
+ var autoAdjustOverflow = {
2
+ adjustX: 1,
3
+ adjustY: 1
4
4
  };
5
5
  const placements = {
6
- topLeft: {
7
- points: ["bl", "tl"],
8
- overflow: autoAdjustOverflow
9
- },
10
- topRight: {
11
- points: ["br", "tr"],
12
- overflow: autoAdjustOverflow
13
- },
14
- bottomLeft: {
15
- points: ["tl", "bl"],
16
- overflow: autoAdjustOverflow
17
- },
18
- bottomRight: {
19
- points: ["tr", "br"],
20
- overflow: autoAdjustOverflow
21
- },
22
- leftTop: {
23
- points: ["tr", "tl"],
24
- overflow: autoAdjustOverflow
25
- },
26
- leftBottom: {
27
- points: ["br", "bl"],
28
- overflow: autoAdjustOverflow
29
- },
30
- rightTop: {
31
- points: ["tl", "tr"],
32
- overflow: autoAdjustOverflow
33
- },
34
- rightBottom: {
35
- points: ["bl", "br"],
36
- overflow: autoAdjustOverflow
37
- }
6
+ topLeft: {
7
+ points: ["bl", "tl"],
8
+ overflow: autoAdjustOverflow
9
+ },
10
+ topRight: {
11
+ points: ["br", "tr"],
12
+ overflow: autoAdjustOverflow
13
+ },
14
+ bottomLeft: {
15
+ points: ["tl", "bl"],
16
+ overflow: autoAdjustOverflow
17
+ },
18
+ bottomRight: {
19
+ points: ["tr", "br"],
20
+ overflow: autoAdjustOverflow
21
+ },
22
+ leftTop: {
23
+ points: ["tr", "tl"],
24
+ overflow: autoAdjustOverflow
25
+ },
26
+ leftBottom: {
27
+ points: ["br", "bl"],
28
+ overflow: autoAdjustOverflow
29
+ },
30
+ rightTop: {
31
+ points: ["tl", "tr"],
32
+ overflow: autoAdjustOverflow
33
+ },
34
+ rightBottom: {
35
+ points: ["bl", "br"],
36
+ overflow: autoAdjustOverflow
37
+ }
38
38
  };
39
39
  const placementsRtl = {
40
- topLeft: {
41
- points: ["bl", "tl"],
42
- overflow: autoAdjustOverflow
43
- },
44
- topRight: {
45
- points: ["br", "tr"],
46
- overflow: autoAdjustOverflow
47
- },
48
- bottomLeft: {
49
- points: ["tl", "bl"],
50
- overflow: autoAdjustOverflow
51
- },
52
- bottomRight: {
53
- points: ["tr", "br"],
54
- overflow: autoAdjustOverflow
55
- },
56
- rightTop: {
57
- points: ["tr", "tl"],
58
- overflow: autoAdjustOverflow
59
- },
60
- rightBottom: {
61
- points: ["br", "bl"],
62
- overflow: autoAdjustOverflow
63
- },
64
- leftTop: {
65
- points: ["tl", "tr"],
66
- overflow: autoAdjustOverflow
67
- },
68
- leftBottom: {
69
- points: ["bl", "br"],
70
- overflow: autoAdjustOverflow
71
- }
72
- };
73
- export {
74
- placements as default,
75
- placements,
76
- placementsRtl
40
+ topLeft: {
41
+ points: ["bl", "tl"],
42
+ overflow: autoAdjustOverflow
43
+ },
44
+ topRight: {
45
+ points: ["br", "tr"],
46
+ overflow: autoAdjustOverflow
47
+ },
48
+ bottomLeft: {
49
+ points: ["tl", "bl"],
50
+ overflow: autoAdjustOverflow
51
+ },
52
+ bottomRight: {
53
+ points: ["tr", "br"],
54
+ overflow: autoAdjustOverflow
55
+ },
56
+ rightTop: {
57
+ points: ["tr", "tl"],
58
+ overflow: autoAdjustOverflow
59
+ },
60
+ rightBottom: {
61
+ points: ["br", "bl"],
62
+ overflow: autoAdjustOverflow
63
+ },
64
+ leftTop: {
65
+ points: ["tl", "tr"],
66
+ overflow: autoAdjustOverflow
67
+ },
68
+ leftBottom: {
69
+ points: ["bl", "br"],
70
+ overflow: autoAdjustOverflow
71
+ }
77
72
  };
73
+ var placements_default = placements;
74
+ export { placements_default as default, placements, placementsRtl };
@@ -1,29 +1,27 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const toArray = require("@v-c/util/dist/Children/toArray");
4
- const vue = require("vue");
1
+ const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
2
+ let vue = require("vue");
3
+ let __v_c_util_dist_Children_toArray = require("@v-c/util/dist/Children/toArray");
5
4
  function parseChildren(children, keyPath) {
6
- return toArray.toArray(children).map((child, index) => {
7
- if (vue.isVNode(child)) {
8
- const key = child.key;
9
- let eventKey = child.props?.eventKey ?? key;
10
- const emptyKey = eventKey === null || eventKey === void 0;
11
- if (emptyKey) {
12
- eventKey = `tmp_key-${[...keyPath, index].join("-")}`;
13
- }
14
- const cloneProps = { key: eventKey, eventKey };
15
- if (process.env.NODE_ENV !== "production" && emptyKey) {
16
- cloneProps.warnKey = true;
17
- }
18
- return {
19
- ...child,
20
- props: {
21
- ...child.props,
22
- ...cloneProps
23
- }
24
- };
25
- }
26
- return child;
27
- });
5
+ return (0, __v_c_util_dist_Children_toArray.toArray)(children).map((child, index) => {
6
+ if ((0, vue.isVNode)(child)) {
7
+ const key = child.key;
8
+ let eventKey = child.props?.eventKey ?? key;
9
+ const emptyKey = eventKey === null || eventKey === void 0;
10
+ if (emptyKey) eventKey = `tmp_key-${[...keyPath, index].join("-")}`;
11
+ const cloneProps = {
12
+ key: eventKey,
13
+ eventKey
14
+ };
15
+ if (process.env.NODE_ENV !== "production" && emptyKey) cloneProps.warnKey = true;
16
+ return {
17
+ ...child,
18
+ props: {
19
+ ...child.props,
20
+ ...cloneProps
21
+ }
22
+ };
23
+ }
24
+ return child;
25
+ });
28
26
  }
29
27
  exports.parseChildren = parseChildren;
@@ -1,29 +1,26 @@
1
- import { toArray } from "@v-c/util/dist/Children/toArray";
2
1
  import { isVNode } from "vue";
2
+ import { toArray } from "@v-c/util/dist/Children/toArray";
3
3
  function parseChildren(children, keyPath) {
4
- return toArray(children).map((child, index) => {
5
- if (isVNode(child)) {
6
- const key = child.key;
7
- let eventKey = child.props?.eventKey ?? key;
8
- const emptyKey = eventKey === null || eventKey === void 0;
9
- if (emptyKey) {
10
- eventKey = `tmp_key-${[...keyPath, index].join("-")}`;
11
- }
12
- const cloneProps = { key: eventKey, eventKey };
13
- if (process.env.NODE_ENV !== "production" && emptyKey) {
14
- cloneProps.warnKey = true;
15
- }
16
- return {
17
- ...child,
18
- props: {
19
- ...child.props,
20
- ...cloneProps
21
- }
22
- };
23
- }
24
- return child;
25
- });
4
+ return toArray(children).map((child, index) => {
5
+ if (isVNode(child)) {
6
+ const key = child.key;
7
+ let eventKey = child.props?.eventKey ?? key;
8
+ const emptyKey = eventKey === null || eventKey === void 0;
9
+ if (emptyKey) eventKey = `tmp_key-${[...keyPath, index].join("-")}`;
10
+ const cloneProps = {
11
+ key: eventKey,
12
+ eventKey
13
+ };
14
+ if (process.env.NODE_ENV !== "production" && emptyKey) cloneProps.warnKey = true;
15
+ return {
16
+ ...child,
17
+ props: {
18
+ ...child.props,
19
+ ...cloneProps
20
+ }
21
+ };
22
+ }
23
+ return child;
24
+ });
26
25
  }
27
- export {
28
- parseChildren
29
- };
26
+ export { parseChildren };
@@ -1,12 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
1
  function getMotion(mode, motion, defaultMotions) {
4
- if (motion) {
5
- return motion;
6
- }
7
- if (defaultMotions) {
8
- return defaultMotions?.[mode] || defaultMotions?.other;
9
- }
10
- return void 0;
2
+ if (motion) return motion;
3
+ if (defaultMotions) return defaultMotions?.[mode] || defaultMotions?.other;
11
4
  }
12
5
  exports.getMotion = getMotion;
@@ -1,12 +1,5 @@
1
1
  function getMotion(mode, motion, defaultMotions) {
2
- if (motion) {
3
- return motion;
4
- }
5
- if (defaultMotions) {
6
- return defaultMotions?.[mode] || defaultMotions?.other;
7
- }
8
- return void 0;
2
+ if (motion) return motion;
3
+ if (defaultMotions) return defaultMotions?.[mode] || defaultMotions?.other;
9
4
  }
10
- export {
11
- getMotion
12
- };
5
+ export { getMotion };
@@ -1,82 +1,54 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const vue = require("vue");
4
- const Divider = require("../Divider.cjs");
5
- const MenuItem = require("../MenuItem.cjs");
6
- const MenuItemGroup = require("../MenuItemGroup.cjs");
7
- const index = require("../SubMenu/index.cjs");
8
- const commonUtil = require("./commonUtil.cjs");
1
+ const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
2
+ const require_Divider = require("../Divider.cjs");
3
+ const require_MenuItem = require("../MenuItem.cjs");
4
+ const require_commonUtil = require("./commonUtil.cjs");
5
+ const require_index = require("../SubMenu/index.cjs");
6
+ const require_MenuItemGroup = require("../MenuItemGroup.cjs");
7
+ let vue = require("vue");
8
+ let __v_c_util_dist_props_util = require("@v-c/util/dist/props-util");
9
9
  function _isSlot(s) {
10
- return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
10
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
11
11
  }
12
- function convertItemsToNodes(list, components, prefixCls) {
13
- const {
14
- item: MergedMenuItem,
15
- group: MergedMenuItemGroup,
16
- submenu: MergedSubMenu,
17
- divider: MergedDivider
18
- } = components;
19
- return (list || []).map((opt, index2) => {
20
- if (opt && typeof opt === "object") {
21
- const {
22
- label,
23
- children,
24
- key,
25
- type,
26
- extra,
27
- ...restProps
28
- } = opt;
29
- const mergedKey = key ?? `tmp-${index2}`;
30
- if (children || type === "group") {
31
- let _slot2;
32
- if (type === "group") {
33
- let _slot;
34
- return vue.createVNode(MergedMenuItemGroup, vue.mergeProps({
35
- "key": mergedKey
36
- }, restProps, {
37
- "title": label
38
- }), _isSlot(_slot = convertItemsToNodes(children, components, prefixCls)) ? _slot : {
39
- default: () => [_slot]
40
- });
41
- }
42
- return vue.createVNode(MergedSubMenu, vue.mergeProps({
43
- "key": mergedKey
44
- }, restProps, {
45
- "title": label
46
- }), _isSlot(_slot2 = convertItemsToNodes(children, components, prefixCls)) ? _slot2 : {
47
- default: () => [_slot2]
48
- });
49
- }
50
- if (type === "divider") {
51
- return vue.createVNode(MergedDivider, vue.mergeProps({
52
- "key": mergedKey
53
- }, restProps), null);
54
- }
55
- return vue.createVNode(MergedMenuItem, vue.mergeProps({
56
- "key": mergedKey
57
- }, restProps, {
58
- "extra": extra
59
- }), {
60
- default: () => [label, (!!extra || extra === 0) && vue.createVNode("span", {
61
- "class": `${prefixCls}-item-extra`
62
- }, [extra])]
63
- });
64
- }
65
- return null;
66
- }).filter((opt) => opt);
12
+ function convertItemsToNodes(list, components, prefixCls, slots) {
13
+ const { item: MergedMenuItem, group: MergedMenuItemGroup, submenu: MergedSubMenu, divider: MergedDivider } = components;
14
+ return (list || []).map((opt, index) => {
15
+ if (opt && typeof opt === "object") {
16
+ const { children, key, type,...restProps } = opt;
17
+ const mergedKey = key ?? `tmp-${index}`;
18
+ let label;
19
+ let extra;
20
+ const _labelRender = slots?.labelRender ? slots.labelRender(opt) : null;
21
+ const _extraRender = slots?.extraRender ? slots.extraRender(opt) : null;
22
+ const labelArr = (0, __v_c_util_dist_props_util.filterEmpty)(Array.isArray(_labelRender) ? _labelRender : [_labelRender]);
23
+ const extraArr = (0, __v_c_util_dist_props_util.filterEmpty)(Array.isArray(_extraRender) ? _extraRender : [_extraRender]);
24
+ if (labelArr.length) label = labelArr?.[0];
25
+ if (extraArr.length) extra = extraArr?.[0];
26
+ if (!label) label = opt.label;
27
+ if (!extra) extra = opt.extra;
28
+ if (children || type === "group") {
29
+ let _slot2;
30
+ if (type === "group") {
31
+ let _slot;
32
+ return (0, vue.createVNode)(MergedMenuItemGroup, (0, vue.mergeProps)({ "key": mergedKey }, restProps, { "title": label }), _isSlot(_slot = convertItemsToNodes(children, components, prefixCls)) ? _slot : { default: () => [_slot] });
33
+ }
34
+ return (0, vue.createVNode)(MergedSubMenu, (0, vue.mergeProps)({ "key": mergedKey }, restProps, { "title": label }), _isSlot(_slot2 = convertItemsToNodes(children, components, prefixCls)) ? _slot2 : { default: () => [_slot2] });
35
+ }
36
+ if (type === "divider") return (0, vue.createVNode)(MergedDivider, (0, vue.mergeProps)({ "key": mergedKey }, restProps), null);
37
+ return (0, vue.createVNode)(MergedMenuItem, (0, vue.mergeProps)({ "key": mergedKey }, restProps, { "extra": extra }), { default: () => [label, (!!extra || extra === 0) && (0, vue.createVNode)("span", { "class": `${prefixCls}-item-extra` }, [extra])] });
38
+ }
39
+ return null;
40
+ }).filter((opt) => opt);
67
41
  }
68
- function parseItems(children, items, keyPath, components, prefixCls) {
69
- let childNodes = children;
70
- const mergedComponents = {
71
- divider: Divider.default,
72
- item: MenuItem.default,
73
- group: MenuItemGroup.default,
74
- submenu: index.default,
75
- ...components
76
- };
77
- if (items) {
78
- childNodes = convertItemsToNodes(items, mergedComponents, prefixCls);
79
- }
80
- return commonUtil.parseChildren(childNodes, keyPath);
42
+ function parseItems(children, items, keyPath, components, prefixCls, slots) {
43
+ let childNodes = children;
44
+ const mergedComponents = {
45
+ divider: require_Divider.default,
46
+ item: require_MenuItem.default,
47
+ group: require_MenuItemGroup.default,
48
+ submenu: require_index.default,
49
+ ...components
50
+ };
51
+ if (items) childNodes = convertItemsToNodes(items, mergedComponents, prefixCls, slots);
52
+ return require_commonUtil.parseChildren(childNodes, keyPath);
81
53
  }
82
54
  exports.parseItems = parseItems;
@@ -1,3 +1,6 @@
1
1
  import { VueNode } from '@v-c/util/dist/type';
2
2
  import { Components, ItemType } from '../interface';
3
- export declare function parseItems(children: VueNode | undefined, items: ItemType[] | undefined, keyPath: string[], components: Components, prefixCls?: string): any[];
3
+ export declare function parseItems(children: VueNode | undefined, items: ItemType[] | undefined, keyPath: string[], components: Components, prefixCls?: string, slots?: {
4
+ labelRender?: (item: ItemType) => any;
5
+ extraRender?: (item: ItemType) => any;
6
+ }): any[];
@@ -1,82 +1,53 @@
1
- import { createVNode, mergeProps, isVNode } from "vue";
2
- import Divider from "../Divider.js";
3
- import MenuItem from "../MenuItem.js";
4
- import MenuItemGroup from "../MenuItemGroup.js";
5
- import SubMenu from "../SubMenu/index.js";
1
+ import Divider_default from "../Divider.js";
2
+ import MenuItem_default from "../MenuItem.js";
6
3
  import { parseChildren } from "./commonUtil.js";
4
+ import SubMenu_default from "../SubMenu/index.js";
5
+ import MenuItemGroup_default from "../MenuItemGroup.js";
6
+ import { createVNode, isVNode, mergeProps } from "vue";
7
+ import { filterEmpty } from "@v-c/util/dist/props-util";
7
8
  function _isSlot(s) {
8
- return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
9
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
9
10
  }
10
- function convertItemsToNodes(list, components, prefixCls) {
11
- const {
12
- item: MergedMenuItem,
13
- group: MergedMenuItemGroup,
14
- submenu: MergedSubMenu,
15
- divider: MergedDivider
16
- } = components;
17
- return (list || []).map((opt, index) => {
18
- if (opt && typeof opt === "object") {
19
- const {
20
- label,
21
- children,
22
- key,
23
- type,
24
- extra,
25
- ...restProps
26
- } = opt;
27
- const mergedKey = key ?? `tmp-${index}`;
28
- if (children || type === "group") {
29
- let _slot2;
30
- if (type === "group") {
31
- let _slot;
32
- return createVNode(MergedMenuItemGroup, mergeProps({
33
- "key": mergedKey
34
- }, restProps, {
35
- "title": label
36
- }), _isSlot(_slot = convertItemsToNodes(children, components, prefixCls)) ? _slot : {
37
- default: () => [_slot]
38
- });
39
- }
40
- return createVNode(MergedSubMenu, mergeProps({
41
- "key": mergedKey
42
- }, restProps, {
43
- "title": label
44
- }), _isSlot(_slot2 = convertItemsToNodes(children, components, prefixCls)) ? _slot2 : {
45
- default: () => [_slot2]
46
- });
47
- }
48
- if (type === "divider") {
49
- return createVNode(MergedDivider, mergeProps({
50
- "key": mergedKey
51
- }, restProps), null);
52
- }
53
- return createVNode(MergedMenuItem, mergeProps({
54
- "key": mergedKey
55
- }, restProps, {
56
- "extra": extra
57
- }), {
58
- default: () => [label, (!!extra || extra === 0) && createVNode("span", {
59
- "class": `${prefixCls}-item-extra`
60
- }, [extra])]
61
- });
62
- }
63
- return null;
64
- }).filter((opt) => opt);
11
+ function convertItemsToNodes(list, components, prefixCls, slots) {
12
+ const { item: MergedMenuItem, group: MergedMenuItemGroup, submenu: MergedSubMenu, divider: MergedDivider } = components;
13
+ return (list || []).map((opt, index) => {
14
+ if (opt && typeof opt === "object") {
15
+ const { children, key, type,...restProps } = opt;
16
+ const mergedKey = key ?? `tmp-${index}`;
17
+ let label;
18
+ let extra;
19
+ const _labelRender = slots?.labelRender ? slots.labelRender(opt) : null;
20
+ const _extraRender = slots?.extraRender ? slots.extraRender(opt) : null;
21
+ const labelArr = filterEmpty(Array.isArray(_labelRender) ? _labelRender : [_labelRender]);
22
+ const extraArr = filterEmpty(Array.isArray(_extraRender) ? _extraRender : [_extraRender]);
23
+ if (labelArr.length) label = labelArr?.[0];
24
+ if (extraArr.length) extra = extraArr?.[0];
25
+ if (!label) label = opt.label;
26
+ if (!extra) extra = opt.extra;
27
+ if (children || type === "group") {
28
+ let _slot2;
29
+ if (type === "group") {
30
+ let _slot;
31
+ return createVNode(MergedMenuItemGroup, mergeProps({ "key": mergedKey }, restProps, { "title": label }), _isSlot(_slot = convertItemsToNodes(children, components, prefixCls)) ? _slot : { default: () => [_slot] });
32
+ }
33
+ return createVNode(MergedSubMenu, mergeProps({ "key": mergedKey }, restProps, { "title": label }), _isSlot(_slot2 = convertItemsToNodes(children, components, prefixCls)) ? _slot2 : { default: () => [_slot2] });
34
+ }
35
+ if (type === "divider") return createVNode(MergedDivider, mergeProps({ "key": mergedKey }, restProps), null);
36
+ return createVNode(MergedMenuItem, mergeProps({ "key": mergedKey }, restProps, { "extra": extra }), { default: () => [label, (!!extra || extra === 0) && createVNode("span", { "class": `${prefixCls}-item-extra` }, [extra])] });
37
+ }
38
+ return null;
39
+ }).filter((opt) => opt);
65
40
  }
66
- function parseItems(children, items, keyPath, components, prefixCls) {
67
- let childNodes = children;
68
- const mergedComponents = {
69
- divider: Divider,
70
- item: MenuItem,
71
- group: MenuItemGroup,
72
- submenu: SubMenu,
73
- ...components
74
- };
75
- if (items) {
76
- childNodes = convertItemsToNodes(items, mergedComponents, prefixCls);
77
- }
78
- return parseChildren(childNodes, keyPath);
41
+ function parseItems(children, items, keyPath, components, prefixCls, slots) {
42
+ let childNodes = children;
43
+ const mergedComponents = {
44
+ divider: Divider_default,
45
+ item: MenuItem_default,
46
+ group: MenuItemGroup_default,
47
+ submenu: SubMenu_default,
48
+ ...components
49
+ };
50
+ if (items) childNodes = convertItemsToNodes(items, mergedComponents, prefixCls, slots);
51
+ return parseChildren(childNodes, keyPath);
79
52
  }
80
- export {
81
- parseItems
82
- };
53
+ export { parseItems };
@@ -1,6 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
1
  function nextSlice(callback) {
4
- Promise.resolve().then(callback);
2
+ /* istanbul ignore next */
3
+ Promise.resolve().then(callback);
5
4
  }
6
5
  exports.nextSlice = nextSlice;
@@ -1,6 +1,5 @@
1
1
  function nextSlice(callback) {
2
- Promise.resolve().then(callback);
2
+ /* istanbul ignore next */
3
+ Promise.resolve().then(callback);
3
4
  }
4
- export {
5
- nextSlice
6
- };
5
+ export { nextSlice };
@@ -1,16 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const util = require("@v-c/util");
4
- function warnItemProp({ item, ...restInfo }) {
5
- Object.defineProperty(restInfo, "item", {
6
- get: () => {
7
- util.warning(
8
- false,
9
- "`info.item` is deprecated since we will move to function component that not provides React Node instance in future."
10
- );
11
- return item;
12
- }
13
- });
14
- return restInfo;
1
+ const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
2
+ let __v_c_util = require("@v-c/util");
3
+ function warnItemProp({ item,...restInfo }) {
4
+ Object.defineProperty(restInfo, "item", { get: () => {
5
+ (0, __v_c_util.warning)(false, "`info.item` is deprecated since we will move to function component that not provides React Node instance in future.");
6
+ return item;
7
+ } });
8
+ return restInfo;
15
9
  }
16
10
  exports.warnItemProp = warnItemProp;
@@ -1,16 +1,9 @@
1
1
  import { warning } from "@v-c/util";
2
- function warnItemProp({ item, ...restInfo }) {
3
- Object.defineProperty(restInfo, "item", {
4
- get: () => {
5
- warning(
6
- false,
7
- "`info.item` is deprecated since we will move to function component that not provides React Node instance in future."
8
- );
9
- return item;
10
- }
11
- });
12
- return restInfo;
2
+ function warnItemProp({ item,...restInfo }) {
3
+ Object.defineProperty(restInfo, "item", { get: () => {
4
+ warning(false, "`info.item` is deprecated since we will move to function component that not provides React Node instance in future.");
5
+ return item;
6
+ } });
7
+ return restInfo;
13
8
  }
14
- export {
15
- warnItemProp
16
- };
9
+ export { warnItemProp };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@v-c/menu",
3
3
  "type": "module",
4
- "version": "0.0.1",
4
+ "version": "0.0.3",
5
5
  "description": "menu ui component for vue",
6
6
  "exports": {
7
7
  ".": {
@@ -24,8 +24,8 @@
24
24
  "vue": "^3.0.0"
25
25
  },
26
26
  "dependencies": {
27
- "@v-c/trigger": "0.0.13",
28
27
  "@v-c/overflow": "0.0.1",
28
+ "@v-c/trigger": "0.0.13",
29
29
  "@v-c/util": "0.0.13"
30
30
  },
31
31
  "scripts": {