@kine-design/core 0.0.1-beta.2 → 0.0.1-beta.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 (94) hide show
  1. package/components/base/affix/index.ts +4 -2
  2. package/components/base/affix/useAffix.ts +2 -2
  3. package/components/base/anchor/index.ts +4 -2
  4. package/components/base/anchor/useAnchor.ts +2 -2
  5. package/components/base/avatar/index.ts +5 -4
  6. package/components/base/backTop/index.ts +4 -2
  7. package/components/base/backTop/useBackTop.ts +1 -1
  8. package/components/base/button/button.css +1 -1
  9. package/components/base/button/index.ts +5 -4
  10. package/components/base/button/useButton.ts +3 -3
  11. package/components/base/carousel/useCarousel.ts +3 -5
  12. package/components/base/checkbox/index.ts +6 -5
  13. package/components/base/checkbox/useCheckbox.ts +1 -1
  14. package/components/base/collapse/index.ts +4 -2
  15. package/components/base/collapse/useCollapse.ts +1 -1
  16. package/components/base/dropdown/index.ts +4 -2
  17. package/components/base/dropdown/useDropdown.ts +1 -1
  18. package/components/base/input/index.ts +4 -3
  19. package/components/base/input/useInput.ts +1 -1
  20. package/components/base/inputNumber/index.ts +4 -2
  21. package/components/base/inputNumber/useInputNumber.ts +1 -1
  22. package/components/base/li/index.ts +3 -1
  23. package/components/base/list/index.ts +4 -2
  24. package/components/base/list/useList.ts +1 -1
  25. package/components/base/popover/index.ts +4 -2
  26. package/components/base/popover/usePopover.ts +8 -4
  27. package/components/base/progress/index.ts +4 -2
  28. package/components/base/progress/useProgress.ts +1 -1
  29. package/components/base/radio/index.ts +1 -1
  30. package/components/base/rate/index.ts +4 -2
  31. package/components/base/rate/useRate.ts +1 -1
  32. package/components/base/slider/index.ts +4 -2
  33. package/components/base/slider/useSlider.ts +1 -1
  34. package/components/base/switch/index.ts +5 -3
  35. package/components/base/switch/useSwitch.tsx +1 -1
  36. package/components/base/tabs/index.ts +2 -2
  37. package/components/base/tabs/useTabs.ts +1 -1
  38. package/components/base/tag/index.ts +3 -1
  39. package/components/base/tooltip/index.ts +2 -2
  40. package/components/base/tooltip/useTooltip.ts +1 -1
  41. package/components/message/drawer/index.ts +1 -1
  42. package/components/message/popover/MPopover.tsx +3 -3
  43. package/components/message/popover/index.ts +2 -2
  44. package/components/message/popover/usePopover.ts +7 -3
  45. package/components/template/menu/index.ts +0 -1
  46. package/components/template/menu/useMenu.ts +1 -1
  47. package/components/template/pagination/index.ts +2 -1
  48. package/components/template/virtualList/index.ts +0 -1
  49. package/compositions/virtualList/useContainerObserver.ts +8 -1
  50. package/dist/components/base/affix/index.d.ts +2 -1
  51. package/dist/components/base/affix/useAffix.d.ts +1 -1
  52. package/dist/components/base/anchor/index.d.ts +2 -1
  53. package/dist/components/base/anchor/useAnchor.d.ts +1 -1
  54. package/dist/components/base/avatar/index.d.ts +1 -0
  55. package/dist/components/base/backTop/index.d.ts +2 -1
  56. package/dist/components/base/backTop/useBackTop.d.ts +1 -1
  57. package/dist/components/base/button/index.d.ts +3 -30
  58. package/dist/components/base/button/useButton.d.ts +2 -8
  59. package/dist/components/base/checkbox/index.d.ts +2 -1
  60. package/dist/components/base/checkbox/useCheckbox.d.ts +1 -1
  61. package/dist/components/base/collapse/index.d.ts +2 -1
  62. package/dist/components/base/collapse/useCollapse.d.ts +1 -1
  63. package/dist/components/base/dropdown/index.d.ts +2 -1
  64. package/dist/components/base/dropdown/useDropdown.d.ts +1 -1
  65. package/dist/components/base/input/index.d.ts +2 -1
  66. package/dist/components/base/input/useInput.d.ts +1 -1
  67. package/dist/components/base/inputNumber/index.d.ts +2 -1
  68. package/dist/components/base/inputNumber/useInputNumber.d.ts +1 -1
  69. package/dist/components/base/li/index.d.ts +1 -0
  70. package/dist/components/base/list/index.d.ts +2 -1
  71. package/dist/components/base/list/useList.d.ts +1 -1
  72. package/dist/components/base/popover/index.d.ts +2 -1
  73. package/dist/components/base/popover/usePopover.d.ts +1 -1
  74. package/dist/components/base/progress/index.d.ts +2 -1
  75. package/dist/components/base/progress/useProgress.d.ts +1 -1
  76. package/dist/components/base/rate/index.d.ts +2 -1
  77. package/dist/components/base/rate/useRate.d.ts +1 -1
  78. package/dist/components/base/slider/index.d.ts +2 -1
  79. package/dist/components/base/slider/useSlider.d.ts +1 -1
  80. package/dist/components/base/switch/index.d.ts +2 -1
  81. package/dist/components/base/switch/useSwitch.d.ts +1 -1
  82. package/dist/components/base/tabs/index.d.ts +1 -1
  83. package/dist/components/base/tabs/useTabs.d.ts +1 -1
  84. package/dist/components/base/tag/index.d.ts +1 -0
  85. package/dist/components/base/tooltip/index.d.ts +1 -1
  86. package/dist/components/base/tooltip/useTooltip.d.ts +1 -1
  87. package/dist/components/message/drawer/index.d.ts +2 -2
  88. package/dist/components/message/popover/index.d.ts +1 -1
  89. package/dist/components/template/menu/index.d.ts +0 -1
  90. package/dist/components/template/menu/useMenu.d.ts +1 -1
  91. package/dist/components/template/pagination/index.d.ts +2 -1
  92. package/dist/components/template/virtualList/index.d.ts +0 -1
  93. package/dist/core.js +43 -33
  94. package/package.json +1 -1
@@ -15,5 +15,4 @@ export const MenuCore = {
15
15
  };
16
16
 
17
17
  export { DEFAULT_MENU_CONFIG };
18
- export { useMenu } from './useMenu';
19
18
  export type { MenuProps, MenuData, MenuNodeData, MenuConfig } from './props';
@@ -50,7 +50,7 @@ function buildNodes(
50
50
  });
51
51
  }
52
52
 
53
- export function useMenu(props: MenuProps, emit?: (event: string, ...args: unknown[]) => void) {
53
+ export function useMenu(props: MenuProps, emit?: (...args: any[]) => void) {
54
54
  const config: MenuConfig = { ...DEFAULT_CONFIG, ...props.config };
55
55
  const nodeMap = new Map<string | number, MenuNodeData>();
56
56
  const nodesRef: ShallowRef<MenuNodeData[]> = shallowRef([]);
@@ -15,4 +15,5 @@ export const PaginationCore = {
15
15
  };
16
16
 
17
17
  export type { PaginationProps } from './props';
18
- export { usePagination, type Pager } from './usePagination';
18
+ export { usePagination } from './usePagination';
19
+ export type { Pager } from './usePagination';
@@ -15,4 +15,3 @@ export const VirtualListCore = {
15
15
  };
16
16
 
17
17
  export type { VirtualListProps } from './props';
18
- export { useVirtualList } from './useVirtualList';
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * 管理 IntersectionObserver 的创建、observe/unobserve,配合 ResizeObserver 处理容器尺寸变化
10
10
  */
11
- import { Ref } from 'vue';
11
+ import { onBeforeUnmount, Ref } from 'vue';
12
12
  import { useResizeObserver } from '../common/useResizeObserver';
13
13
 
14
14
  export default function useContainerObserver(options: {
@@ -78,5 +78,12 @@ export default function useContainerObserver(options: {
78
78
  }
79
79
  });
80
80
 
81
+ onBeforeUnmount(() => {
82
+ if (ob) {
83
+ ob.disconnect();
84
+ ob = undefined;
85
+ }
86
+ });
87
+
81
88
  return { reObserve };
82
89
  }
@@ -1,5 +1,6 @@
1
- import { default as useAffix } from './useAffix';
1
+ import { useAffix } from './useAffix';
2
2
  export declare const AffixCore: {
3
3
  props: import('../../types/props').MCOPO<import('./props').AffixProps>;
4
4
  useAffix: typeof useAffix;
5
5
  };
6
+ export type { AffixProps } from './props';
@@ -1,5 +1,5 @@
1
1
  import { AffixProps } from './props';
2
- export default function useAffix(props: Required<AffixProps>, emit: (event: string, ...args: unknown[]) => void): {
2
+ export declare function useAffix(props: Required<AffixProps>, emit: (...args: any[]) => void): {
3
3
  wrapperRef: import('vue').Ref<HTMLElement | null, HTMLElement | null>;
4
4
  wrapRef: import('vue').Ref<HTMLElement | null, HTMLElement | null>;
5
5
  affixed: import('vue').Ref<boolean, boolean>;
@@ -1,6 +1,7 @@
1
- import { default as useAnchor } from './useAnchor';
1
+ import { useAnchor } from './useAnchor';
2
2
  export declare const AnchorCore: {
3
3
  props: import('../../types/props').MCOPO<import('./props').AnchorProps>;
4
4
  anchorLinkProps: import('../../types/props').MCOPO<import('./props').AnchorLinkProps>;
5
5
  useAnchor: typeof useAnchor;
6
6
  };
7
+ export type { AnchorProps, AnchorLinkProps } from './props';
@@ -1,5 +1,5 @@
1
1
  import { AnchorProps } from './props';
2
- export default function useAnchor(props: Required<AnchorProps>, emit: (event: string, ...args: unknown[]) => void): {
2
+ export declare function useAnchor(props: Required<AnchorProps>, emit: (...args: any[]) => void): {
3
3
  currentLink: import('vue').Ref<string, string>;
4
4
  registerLink: (href: string) => void;
5
5
  unregisterLink: (href: string) => void;
@@ -1,3 +1,4 @@
1
1
  export declare const AvatarCore: {
2
2
  props: import('../../types/props').MCOPO<import('./props').AvatarProps>;
3
3
  };
4
+ export type { AvatarProps } from './props';
@@ -1,5 +1,6 @@
1
- import { default as useBackTop } from './useBackTop';
1
+ import { useBackTop } from './useBackTop';
2
2
  export declare const BackTopCore: {
3
3
  props: import('../../types/props').MCOPO<import('./props').BackTopProps>;
4
4
  useBackTop: typeof useBackTop;
5
5
  };
6
+ export type { BackTopProps } from './props';
@@ -1,5 +1,5 @@
1
1
  import { BackTopProps } from './props';
2
- export default function useBackTop(props: Required<BackTopProps>): {
2
+ export declare function useBackTop(props: Required<BackTopProps>): {
3
3
  visible: import('vue').Ref<boolean, boolean>;
4
4
  scrollToTop: () => void;
5
5
  };
@@ -1,33 +1,6 @@
1
+ import { useButton } from './useButton';
1
2
  export declare const ButtonCore: {
2
3
  props: import('../../types/props').MCOPO<import('./props').ButtonProps>;
3
- useButton: (props: import('./props').ButtonProps, ctx: {
4
- attrs: import('vue').Attrs;
5
- slots: Readonly<{
6
- [name: string]: import('vue').Slot<any> | undefined;
7
- }>;
8
- emit: (event: string, ...args: any[]) => void;
9
- expose: <Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed) => void;
10
- }) => {
11
- domType: string;
12
- slot: string | import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
13
- [key: string]: any;
14
- }>[] | undefined;
15
- domProps: {
16
- class: (string | {
17
- 'm-button-disabled': boolean | undefined;
18
- 'm-button-loading'?: undefined;
19
- 'm-button-plain'?: undefined;
20
- } | {
21
- 'm-button-loading': boolean | undefined;
22
- 'm-button-disabled'?: undefined;
23
- 'm-button-plain'?: undefined;
24
- } | {
25
- 'm-button-plain': boolean | undefined;
26
- 'm-button-disabled'?: undefined;
27
- 'm-button-loading'?: undefined;
28
- })[];
29
- disabled: boolean | undefined;
30
- };
31
- isDisabled: boolean | undefined;
32
- };
4
+ useButton: typeof useButton;
33
5
  };
6
+ export type { ButtonProps } from './props';
@@ -1,12 +1,6 @@
1
+ import { SetupContext } from 'vue';
1
2
  import { ButtonProps } from './props';
2
- export declare const useButton: (props: ButtonProps, ctx: {
3
- attrs: import('vue').Attrs;
4
- slots: Readonly<{
5
- [name: string]: import('vue').Slot<any> | undefined;
6
- }>;
7
- emit: (event: string, ...args: any[]) => void;
8
- expose: <Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed) => void;
9
- }) => {
3
+ export declare function useButton(props: ButtonProps, { slots }: SetupContext): {
10
4
  domType: string;
11
5
  slot: string | import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
12
6
  [key: string]: any;
@@ -1,5 +1,6 @@
1
- import { default as useCheckbox } from './useCheckbox';
1
+ import { useCheckbox } from './useCheckbox';
2
2
  export declare const CheckboxCore: {
3
3
  props: import('../../types/props').MCOPO<import('./props').CheckboxProps>;
4
4
  useCheckbox: typeof useCheckbox;
5
5
  };
6
+ export type { CheckboxProps } from './props';
@@ -1,5 +1,5 @@
1
1
  import { CheckboxProps } from './props';
2
- export default function useCheckbox<Props extends Required<CheckboxProps>>(props: Props, ctx: any): {
2
+ export declare function useCheckbox<Props extends Required<CheckboxProps>>(props: Props, ctx: any): {
3
3
  checkboxClass: (string | {
4
4
  'm-disabled': boolean;
5
5
  'm-indeterminate': boolean;
@@ -1,6 +1,7 @@
1
- import { default as useCollapse } from './useCollapse.ts';
1
+ import { useCollapse } from './useCollapse';
2
2
  export declare const CollapseCore: {
3
3
  props: import('../../types/props').MCOPO<import('./props').CollapseProps>;
4
4
  itemProps: import('../../types/props').MCOPO<import('./props').CollapseItemProps>;
5
5
  useCollapse: typeof useCollapse;
6
6
  };
7
+ export type { CollapseProps, CollapseItemProps } from './props';
@@ -1,5 +1,5 @@
1
1
  import { CollapseProps } from './props';
2
- export default function useCollapse(props: Required<CollapseProps>, ctx: any): {
2
+ export declare function useCollapse(props: Required<CollapseProps>, ctx: any): {
3
3
  activeNames: import('vue').ComputedRef<(string | number)[]>;
4
4
  isActive: (name: string | number) => boolean;
5
5
  toggle: (name: string | number, disabled: boolean) => void;
@@ -1,6 +1,7 @@
1
- import { default as useDropdown } from './useDropdown.ts';
1
+ import { useDropdown } from './useDropdown';
2
2
  export declare const DropdownCore: {
3
3
  props: import('../../types/props').MCOPO<import('./props').DropdownProps>;
4
4
  itemProps: import('../../types/props').MCOPO<import('./props').DropdownItemProps>;
5
5
  useDropdown: typeof useDropdown;
6
6
  };
7
+ export type { DropdownProps, DropdownItemProps } from './props';
@@ -1,5 +1,5 @@
1
1
  import { DropdownItemProps, DropdownProps } from './props';
2
- export default function useDropdown(props: Required<DropdownProps>, ctx: any): {
2
+ export declare function useDropdown(props: Required<DropdownProps>, ctx: any): {
3
3
  visible: import('vue').Ref<boolean, boolean>;
4
4
  triggerRef: import('vue').Ref<HTMLElement | undefined, HTMLElement | undefined>;
5
5
  menuRef: import('vue').Ref<HTMLElement | undefined, HTMLElement | undefined>;
@@ -1,5 +1,6 @@
1
- import { default as useInput } from './useInput';
1
+ import { useInput } from './useInput';
2
2
  export declare const InputCore: {
3
3
  props: import('../../types/props').MCOPO<import('./props').InputProps>;
4
4
  useInput: typeof useInput;
5
5
  };
6
+ export type { InputProps } from './props';
@@ -1,5 +1,5 @@
1
1
  import { HTMLElementEvent } from '../../types/template';
2
- export default function useInput<Props extends Record<string, any>>(props: Props, ctx: any): {
2
+ export declare function useInput<Props extends Record<string, any>>(props: Props, ctx: any): {
3
3
  baseProps: {
4
4
  autofocus: any;
5
5
  value: any;
@@ -1,5 +1,6 @@
1
- import { default as useInputNumber } from './useInputNumber.ts';
1
+ import { useInputNumber } from './useInputNumber';
2
2
  export declare const InputNumberCore: {
3
3
  props: import('../../types/props').MCOPO<import('./props').InputNumberProps>;
4
4
  useInputNumber: typeof useInputNumber;
5
5
  };
6
+ export type { InputNumberProps } from './props';
@@ -1,7 +1,7 @@
1
1
  import { InputNumberProps } from './props';
2
2
  import { HTMLElementEvent } from '../../types/template';
3
3
  export type InputNumber = string | number | null;
4
- export default function useInputNumber(props: Required<InputNumberProps>, ctx: any): {
4
+ export declare function useInputNumber(props: Required<InputNumberProps>, ctx: any): {
5
5
  currentValue: import('vue').Ref<string | number, string | number>;
6
6
  handleInputChange: (e: HTMLElementEvent<HTMLInputElement>) => void;
7
7
  handleInputBlur: () => void;
@@ -1,3 +1,4 @@
1
1
  export declare const LiCore: {
2
2
  props: import('../../types/props').MCOPO<import('./props').LiProps>;
3
3
  };
4
+ export type { LiProps } from './props';
@@ -1,5 +1,6 @@
1
- import { default as useList } from './useList';
1
+ import { useList } from './useList';
2
2
  export declare const ListCore: {
3
3
  props: import('../../types/props').MCOPO<import('./props').ListProps>;
4
4
  useList: typeof useList;
5
5
  };
6
+ export type { ListProps } from './props';
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * 江湖的业务千篇一律,复杂的代码好几百行。
8
8
  */
9
- export default function useList<T>(): {
9
+ export declare function useList<T>(): {
10
10
  baseRender: (item: unknown) => string;
11
11
  dataValidate: (data: T[] | undefined) => boolean;
12
12
  };
@@ -1,5 +1,6 @@
1
- import { default as usePopover } from './usePopover.ts';
1
+ import { usePopover } from './usePopover';
2
2
  export declare const PopoverCore: {
3
3
  props: import('../../types/props').MCOPO<import('./props').PopoverProps>;
4
4
  usePopover: typeof usePopover;
5
5
  };
6
+ export type { PopoverProps } from './props';
@@ -32,7 +32,7 @@ export declare class PopoverImpl {
32
32
  toggle(): Promise<void>;
33
33
  destroy(): void;
34
34
  }
35
- export default function usePopover(props: Required<PopoverProps>, ctx: any): {
35
+ export declare function usePopover(props: Required<PopoverProps>, ctx: any): {
36
36
  popoverEnter: () => void;
37
37
  popoverLeave: () => void;
38
38
  popoverRef: Ref<HTMLElement | undefined, HTMLElement | undefined>;
@@ -1,5 +1,6 @@
1
- import { default as useProgress } from './useProgress';
1
+ import { useProgress } from './useProgress';
2
2
  export declare const ProgressCore: {
3
3
  props: import('../../types/props').MCOPO<import('./props').ProgressProps>;
4
4
  useProgress: typeof useProgress;
5
5
  };
6
+ export type { ProgressProps, ProgressStatus } from './props';
@@ -1,4 +1,4 @@
1
1
  import { ProgressProps } from './props';
2
- export default function useProgress(props: Required<ProgressProps>): {
2
+ export declare function useProgress(props: Required<ProgressProps>): {
3
3
  percentage: import('vue').ComputedRef<string | number>;
4
4
  };
@@ -1,5 +1,6 @@
1
- import { default as useRate } from './useRate';
1
+ import { useRate } from './useRate';
2
2
  export declare const RateCore: {
3
3
  props: import('../../types/props').MCOPO<import('./props').RateProps>;
4
4
  useRate: typeof useRate;
5
5
  };
6
+ export type { RateProps } from './props';
@@ -1,5 +1,5 @@
1
1
  import { RateProps } from './props';
2
- export default function useRate(props: Required<RateProps>, emit: (event: string, ...args: unknown[]) => void): {
2
+ export declare function useRate(props: Required<RateProps>, emit: (...args: any[]) => void): {
3
3
  hoverValue: import('vue').Ref<number | null, number | null>;
4
4
  getStarState: (index: number) => "full" | "half" | "empty";
5
5
  onMouseEnter: (e: MouseEvent, index: number) => void;
@@ -1,5 +1,6 @@
1
- import { default as useSlider } from './useSlider.ts';
1
+ import { useSlider } from './useSlider';
2
2
  export declare const SliderCore: {
3
3
  props: import('../../types/props').MCOPO<import('./props').SliderProps>;
4
4
  useSlider: typeof useSlider;
5
5
  };
6
+ export type { SliderProps } from './props';
@@ -1,5 +1,5 @@
1
1
  import { SliderProps } from './props';
2
- export default function useSlider(props: Required<SliderProps>, ctx: any): {
2
+ export declare function useSlider(props: Required<SliderProps>, ctx: any): {
3
3
  btnRef: import('vue').Ref<HTMLElement | null | undefined, HTMLElement | null | undefined>;
4
4
  sliderRef: import('vue').Ref<HTMLElement | null, HTMLElement | null>;
5
5
  perRef: import('vue').Ref<number, number>;
@@ -1,7 +1,8 @@
1
- import { default as useSwitch } from './useSwitch.tsx';
1
+ import { useSwitch } from './useSwitch';
2
2
  export declare const SwitchCore: {
3
3
  props: import('../../types/props').MCOPO<import('./props').SwitchProps>;
4
4
  switchIsBoolean: (value: import('./props').SwitchProps["modelValue"]) => value is boolean;
5
5
  getIsActive: (value: import('./props').SwitchProps["modelValue"], activeValue: import('./props').SwitchProps["activeValue"]) => boolean;
6
6
  useSwitch: typeof useSwitch;
7
7
  };
8
+ export type { SwitchProps } from './props';
@@ -1,7 +1,7 @@
1
1
  import { SwitchProps } from './props';
2
2
  export declare const switchIsBoolean: (value: SwitchProps["modelValue"]) => value is boolean;
3
3
  export declare const getIsActive: (value: SwitchProps["modelValue"], activeValue: SwitchProps["activeValue"]) => boolean;
4
- export default function useSwitch<Props extends Record<string, any>>(props: Props, ctx: any): {
4
+ export declare function useSwitch<Props extends Record<string, any>>(props: Props, ctx: any): {
5
5
  getInfo: (key: keyof Pick<SwitchProps, "activeInfo" | "inactiveInfo">) => any;
6
6
  changeSwitch: () => void;
7
7
  switchClass: import('vue').ComputedRef<(string | {
@@ -1,4 +1,4 @@
1
- import { default as useTabs } from './useTabs.ts';
1
+ import { useTabs } from './useTabs';
2
2
  export declare const TabsCore: {
3
3
  props: import('../../types/props').MCOPO<import('./props').TabsProps>;
4
4
  tabPaneProps: import('../../types/props').MCOPO<import('./props').TabPaneProps>;
@@ -1,4 +1,4 @@
1
- export default function useTabs<Props extends Record<string, unknown>>(props: Props, ctx: any): {
1
+ export declare function useTabs<Props extends Record<string, unknown>>(props: Props, ctx: any): {
2
2
  activeTab: import('vue').ComputedRef<string | number>;
3
3
  isActive: (name: string | number) => boolean;
4
4
  switchTab: (name: string | number, disabled?: boolean) => void;
@@ -1,3 +1,4 @@
1
1
  export declare const TagCore: {
2
2
  props: import('../../types/props').MCOPO<import('./props').TagProps>;
3
3
  };
4
+ export type { TagProps } from './props';
@@ -1,4 +1,4 @@
1
- import { default as useTooltip } from './useTooltip.ts';
1
+ import { useTooltip } from './useTooltip';
2
2
  export declare const TooltipCore: {
3
3
  props: import('../../types/props').MCOPO<import('./props').TooltipProps>;
4
4
  useTooltip: typeof useTooltip;
@@ -5,7 +5,7 @@ export type TooltipStyle = {
5
5
  top: string;
6
6
  zIndex: string;
7
7
  };
8
- export default function useTooltip(props: Required<TooltipProps>): {
8
+ export declare function useTooltip(props: Required<TooltipProps>): {
9
9
  visible: import('vue').Ref<boolean, boolean>;
10
10
  tooltipStyle: import('vue').Ref<Record<string, never> | {
11
11
  position: string;
@@ -1,4 +1,4 @@
1
1
  export declare const DrawerCore: {
2
- props: import('../../types/props').MCOPO<import('./props.d.ts').DrawerProps>;
2
+ props: import('../../types/props').MCOPO<import('./props').DrawerProps>;
3
3
  };
4
- export type { DrawerProps } from './props.d.ts';
4
+ export type { DrawerProps } from './props';
@@ -1,4 +1,4 @@
1
- import { usePopover } from './usePopover.ts';
1
+ import { usePopover } from './usePopover';
2
2
  export declare const MessagePopoverCore: {
3
3
  props: import('../../types/props').MCOPO<import('./props').PopoverProps>;
4
4
  usePopover: typeof usePopover;
@@ -5,5 +5,4 @@ export declare const MenuCore: {
5
5
  useMenu: typeof useMenu;
6
6
  };
7
7
  export { DEFAULT_MENU_CONFIG };
8
- export { useMenu } from './useMenu';
9
8
  export type { MenuProps, MenuData, MenuNodeData, MenuConfig } from './props';
@@ -1,6 +1,6 @@
1
1
  import { ShallowRef } from 'vue';
2
2
  import { MenuData, MenuNodeData, MenuConfig, MenuProps } from './props';
3
- export declare function useMenu(props: MenuProps, emit?: (event: string, ...args: unknown[]) => void): {
3
+ export declare function useMenu(props: MenuProps, emit?: (...args: any[]) => void): {
4
4
  nodesRef: ShallowRef<MenuNodeData[]>;
5
5
  nodeMap: Map<string | number, MenuNodeData>;
6
6
  initNodes: (data?: MenuData[]) => void;
@@ -4,4 +4,5 @@ export declare const PaginationCore: {
4
4
  usePagination: typeof usePagination;
5
5
  };
6
6
  export type { PaginationProps } from './props';
7
- export { usePagination, type Pager } from './usePagination';
7
+ export { usePagination } from './usePagination';
8
+ export type { Pager } from './usePagination';
@@ -4,4 +4,3 @@ export declare const VirtualListCore: {
4
4
  useVirtualList: typeof useVirtualList;
5
5
  };
6
6
  export type { VirtualListProps } from './props';
7
- export { useVirtualList } from './useVirtualList';
package/dist/core.js CHANGED
@@ -1,4 +1,4 @@
1
- import { computed, createVNode, inject, nextTick, onBeforeMount, onBeforeUnmount, onMounted, onUnmounted, provide, ref, shallowRef, toRef, triggerRef, watch } from "vue";
1
+ import { computed, createVNode, inject, nextTick, onBeforeUnmount, onMounted, onUnmounted, provide, ref, shallowRef, toRef, triggerRef, watch } from "vue";
2
2
  import * as _interactjsModule from "interactjs";
3
3
  import { arrow, autoUpdate, computePosition } from "@floating-ui/dom";
4
4
  import dayjs from "dayjs";
@@ -153,10 +153,28 @@ var props$48 = {
153
153
  }
154
154
  };
155
155
  //#endregion
156
- //#region runtime/defineHook.ts
157
- var defineHook = (hook) => {
158
- return hook;
159
- };
156
+ //#region components/base/button/useButton.ts
157
+ function useButton(props, { slots }) {
158
+ const domType = props.link ? "a" : "button";
159
+ const slot = slots.default?.() ?? props.text;
160
+ const isDisabled = props.disabled || props.loading;
161
+ return {
162
+ domType,
163
+ slot,
164
+ domProps: {
165
+ class: [
166
+ "m-button",
167
+ { "m-button-disabled": isDisabled },
168
+ { "m-button-loading": props.loading },
169
+ { "m-button-plain": props.plain },
170
+ `m-button-${props.type ?? "default"}`,
171
+ `m-button-${props.size ?? "medium"}`
172
+ ],
173
+ disabled: isDisabled
174
+ },
175
+ isDisabled
176
+ };
177
+ }
160
178
  //#endregion
161
179
  //#region components/base/button/index.ts
162
180
  /**
@@ -169,27 +187,7 @@ var defineHook = (hook) => {
169
187
  */
170
188
  var ButtonCore = {
171
189
  props: props$48,
172
- useButton: defineHook((props, { slots }) => {
173
- const domType = props.link ? "a" : "button";
174
- const slot = slots.default?.() ?? props.text;
175
- const isDisabled = props.disabled || props.loading;
176
- return {
177
- domType,
178
- slot,
179
- domProps: {
180
- class: [
181
- "m-button",
182
- { "m-button-disabled": isDisabled },
183
- { "m-button-loading": props.loading },
184
- { "m-button-plain": props.plain },
185
- `m-button-${props.type ?? "default"}`,
186
- `m-button-${props.size ?? "medium"}`
187
- ],
188
- disabled: isDisabled
189
- },
190
- isDisabled
191
- };
192
- })
190
+ useButton
193
191
  };
194
192
  //#endregion
195
193
  //#region components/base/select/api.ts
@@ -1692,7 +1690,12 @@ var PopoverImpl$1 = class {
1692
1690
  if (this.visible) this.hide();
1693
1691
  else await this.show();
1694
1692
  }
1695
- destroy() {}
1693
+ destroy() {
1694
+ this.popperInstance?.clear?.();
1695
+ this.visible = false;
1696
+ this.onShow = void 0;
1697
+ this.onHide = void 0;
1698
+ }
1696
1699
  };
1697
1700
  function usePopover$1(props, ctx) {
1698
1701
  const style = ref();
@@ -1742,11 +1745,12 @@ function usePopover$1(props, ctx) {
1742
1745
  }
1743
1746
  });
1744
1747
  });
1745
- onBeforeMount(() => {
1748
+ onBeforeUnmount(() => {
1746
1749
  if (clickAwayInstance) {
1747
1750
  const { onBeforeDestroy } = clickAwayInstance;
1748
1751
  onBeforeDestroy();
1749
1752
  }
1753
+ instance?.destroy();
1750
1754
  });
1751
1755
  return {
1752
1756
  popoverEnter,
@@ -3875,7 +3879,12 @@ var PopoverImpl = class {
3875
3879
  if (this.visible) this.hide();
3876
3880
  else await this.show();
3877
3881
  }
3878
- destroy() {}
3882
+ destroy() {
3883
+ this.popperInstance?.clear?.();
3884
+ this.visible = false;
3885
+ this.onShow = void 0;
3886
+ this.onHide = void 0;
3887
+ }
3879
3888
  };
3880
3889
  function usePopover(options, lifecycle) {
3881
3890
  const style = ref();
@@ -3927,11 +3936,12 @@ function usePopover(options, lifecycle) {
3927
3936
  }
3928
3937
  });
3929
3938
  });
3930
- onBeforeMount(() => {
3939
+ onBeforeUnmount(() => {
3931
3940
  if (clickAwayInstance) {
3932
3941
  const { onBeforeDestroy } = clickAwayInstance;
3933
3942
  onBeforeDestroy();
3934
3943
  }
3944
+ instance?.destroy();
3935
3945
  });
3936
3946
  const getContent = (props, getContentSlot, useTeleport, _instance = instance) => {
3937
3947
  const contentTeleportWrapper = () => {
@@ -5027,14 +5037,14 @@ var props$9 = {
5027
5037
  */
5028
5038
  function useCarousel(props, emit, count) {
5029
5039
  const activeIndex = ref(props.modelValue ?? props.initialIndex);
5030
- const trackIndex = ref(0);
5040
+ const initialActive = props.modelValue ?? props.initialIndex;
5041
+ const trackIndex = ref(props.loop ? initialActive + 1 : initialActive);
5031
5042
  const disableTransition = ref(false);
5032
5043
  let timer = null;
5033
5044
  const hasClones = () => props.loop && count() > 1;
5034
5045
  const syncTrackIndex = () => {
5035
5046
  trackIndex.value = hasClones() ? activeIndex.value + 1 : activeIndex.value;
5036
5047
  };
5037
- syncTrackIndex();
5038
5048
  watch(() => props.modelValue, (val) => {
5039
5049
  if (val != null && val !== activeIndex.value) {
5040
5050
  activeIndex.value = val;
@@ -6218,4 +6228,4 @@ var AnchorCore = {
6218
6228
  useAnchor
6219
6229
  };
6220
6230
  //#endregion
6221
- export { AffixCore, AlertCore, AnchorCore, AutoCompleteCore, AvatarCore, BASE_MONTH_NAME, BASE_WEEK_NAME, BackTopCore, BadgeCore, BorderCore, BreadcrumbCore, ButtonCore, CardCore, CarouselCore, CascaderCore, CheckboxCore, CollapseCore, ConfirmCore, DEFAULT_MENU_CONFIG, DEFAULT_TREE_CONFIG, DarkModeCore, DatePickerCore, DescriptionsCore, DialogCore, DividerCore, DrawerCore, DropdownCore, EmptyCore, FormCore, GridCore, ImageCore, InputCore, InputNumberCore, LiCore, ListCore, LoadingCore, MenuCore, MessageCore, MessagePopoverCore, NotificationCore, PaginationCore, PopoverCore, ProgressCore, RadioCore, RateCore, ResultCore, SelectCore, SkeletonCore, SliderCore, SpaceCore, StepsCore, SwitchCore, TableColumnCore, TableCore, TabsCore, TagCore, TimelineCore, TooltipCore, TransferCore, Tree, TreeCore, VirtualListCore, createRadioId, fixKey, generateTimeColumn, getNewModelValue, initChecked, toDayjs, treeNodeProps, props as treeProps, useDatePicker, useMenu, useMessageQueue, useNotificationQueue, usePagination, useTable, useTree, useVirtualList };
6231
+ export { AffixCore, AlertCore, AnchorCore, AutoCompleteCore, AvatarCore, BASE_MONTH_NAME, BASE_WEEK_NAME, BackTopCore, BadgeCore, BorderCore, BreadcrumbCore, ButtonCore, CardCore, CarouselCore, CascaderCore, CheckboxCore, CollapseCore, ConfirmCore, DEFAULT_MENU_CONFIG, DEFAULT_TREE_CONFIG, DarkModeCore, DatePickerCore, DescriptionsCore, DialogCore, DividerCore, DrawerCore, DropdownCore, EmptyCore, FormCore, GridCore, ImageCore, InputCore, InputNumberCore, LiCore, ListCore, LoadingCore, MenuCore, MessageCore, MessagePopoverCore, NotificationCore, PaginationCore, PopoverCore, ProgressCore, RadioCore, RateCore, ResultCore, SelectCore, SkeletonCore, SliderCore, SpaceCore, StepsCore, SwitchCore, TableColumnCore, TableCore, TabsCore, TagCore, TimelineCore, TooltipCore, TransferCore, Tree, TreeCore, VirtualListCore, createRadioId, fixKey, generateTimeColumn, getNewModelValue, initChecked, toDayjs, treeNodeProps, props as treeProps, useDatePicker, useMessageQueue, useNotificationQueue, usePagination, useTable, useTree };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kine-design/core",
3
- "version": "0.0.1-beta.2",
3
+ "version": "0.0.1-beta.3",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/core.js",