hys-ui 0.5.0 → 0.6.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.
Files changed (66) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/components/HysDrawer/HysDrawer.vue.js +1 -1
  3. package/dist/components/HysDrawer/HysDrawer2.vue.js +2 -2
  4. package/dist/components/HysModal/HysModal.vue.js +2 -2
  5. package/dist/components/HysModal/HysModal2.vue.js +38 -38
  6. package/dist/components/HysSearch/HysSearch.vue.js +2 -2
  7. package/dist/components/HysSortableList/HysSortableList.vue.js +2 -2
  8. package/dist/components/HysSortableList/HysSortableList2.vue.js +498 -129
  9. package/dist/components/HysSortableList/SortableGhost/SortableGhost.vue.js +7 -0
  10. package/dist/components/HysSortableList/SortableGhost/SortableGhost2.vue.js +43 -0
  11. package/dist/components/HysSortableList/SortableGhost/useSortGhost.js +54 -0
  12. package/dist/components/HysSortableList/geometry.js +230 -0
  13. package/dist/components/HysSortableList/model.js +254 -0
  14. package/dist/components/HysSortableList/transactions.js +281 -0
  15. package/dist/components/HysSortableList/useSortDrag.js +270 -0
  16. package/dist/components/HysSortableList/useSortKeyboard.js +72 -0
  17. package/dist/components/HysSortableList/useSortWindow.js +144 -0
  18. package/dist/components/HysToast/HysToast.vue.js +3 -3
  19. package/dist/components/HysToast/HysToast2.vue.js +379 -107
  20. package/dist/components/HysToast/ToastViewport/ToastViewport.vue.js +7 -0
  21. package/dist/components/HysToast/ToastViewport/ToastViewport2.vue.js +211 -0
  22. package/dist/components/HysToast/ToastViewport/useToastStackDisclosure.js +71 -0
  23. package/dist/components/HysToast/toastPresentation.js +98 -0
  24. package/dist/components/HysToast/useToastActions.js +62 -0
  25. package/dist/components/HysToast/useToastSwipe.js +48 -0
  26. package/dist/components/HysToast/useToastTimer.js +90 -0
  27. package/dist/composables/popupReferenceBinding.js +41 -0
  28. package/dist/composables/toastEscape.js +18 -10
  29. package/dist/composables/toastQueue.js +276 -0
  30. package/dist/composables/toastQueueModel.js +86 -0
  31. package/dist/composables/toastTasks.js +58 -0
  32. package/dist/composables/useHysToast.js +117 -135
  33. package/dist/composables/usePopupSurface.js +190 -356
  34. package/dist/composables/usePopupSurfaceInteractions.js +172 -0
  35. package/dist/index.js +59 -57
  36. package/dist/style.css +1 -1
  37. package/dist/types/components/HysGantt/HysGantt.vue.d.ts +1 -1
  38. package/dist/types/components/HysModal/HysModal.vue.d.ts +1 -1
  39. package/dist/types/components/HysSortableList/HysSortableList.vue.d.ts +48 -25
  40. package/dist/types/components/HysSortableList/SortableGhost/SortableGhost.vue.d.ts +31 -0
  41. package/dist/types/components/HysSortableList/SortableGhost/useSortGhost.d.ts +23 -0
  42. package/dist/types/components/HysSortableList/geometry.d.ts +35 -0
  43. package/dist/types/components/HysSortableList/model.d.ts +61 -0
  44. package/dist/types/components/HysSortableList/sortableList.d.ts +151 -0
  45. package/dist/types/components/HysSortableList/transactions.d.ts +10 -0
  46. package/dist/types/components/HysSortableList/useSortDrag.d.ts +25 -0
  47. package/dist/types/components/HysSortableList/useSortKeyboard.d.ts +17 -0
  48. package/dist/types/components/HysSortableList/useSortWindow.d.ts +16 -0
  49. package/dist/types/components/HysToast/HysToast.vue.d.ts +44 -46
  50. package/dist/types/components/HysToast/ToastViewport/ToastViewport.vue.d.ts +25 -0
  51. package/dist/types/components/HysToast/ToastViewport/useToastStackDisclosure.d.ts +16 -0
  52. package/dist/types/components/HysToast/toastPresentation.d.ts +8 -0
  53. package/dist/types/components/HysToast/toastTypes.d.ts +212 -0
  54. package/dist/types/components/HysToast/useToastActions.d.ts +18 -0
  55. package/dist/types/components/HysToast/useToastSwipe.d.ts +11 -0
  56. package/dist/types/components/HysToast/useToastTimer.d.ts +22 -0
  57. package/dist/types/composables/popupReferenceBinding.d.ts +9 -0
  58. package/dist/types/composables/toastEscape.d.ts +1 -1
  59. package/dist/types/composables/toastQueue.d.ts +121 -0
  60. package/dist/types/composables/toastQueueModel.d.ts +116 -0
  61. package/dist/types/composables/toastTasks.d.ts +2 -0
  62. package/dist/types/composables/useHysToast.d.ts +4 -48
  63. package/dist/types/composables/usePopupSurface.d.ts +20 -20
  64. package/dist/types/composables/usePopupSurfaceInteractions.d.ts +33 -0
  65. package/dist/types/index.d.ts +3 -4
  66. package/package.json +1 -1
@@ -106,6 +106,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
106
106
  virtual: boolean;
107
107
  overscan: number;
108
108
  editable: boolean;
109
+ history: boolean;
109
110
  labelWidth: number;
110
111
  rowHeight: number;
111
112
  labelResizable: boolean;
@@ -114,7 +115,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
114
115
  fitContainer: boolean;
115
116
  dependencyEditable: boolean;
116
117
  showDependencies: boolean;
117
- history: boolean;
118
118
  historyLimit: number;
119
119
  historyKeyboard: boolean;
120
120
  showHistoryControls: boolean;
@@ -92,6 +92,7 @@ declare const __VLS_base: import("vue").DefineComponent<HysModalProps, {
92
92
  cancelText: string;
93
93
  fullscreen: boolean;
94
94
  closeOnEscape: boolean;
95
+ dragThreshold: number;
95
96
  initialFocus: import("../../index.js").HysModalInitialFocus;
96
97
  closeOnMask: boolean;
97
98
  showClose: boolean;
@@ -113,7 +114,6 @@ declare const __VLS_base: import("vue").DefineComponent<HysModalProps, {
113
114
  centered: boolean;
114
115
  dragHandlePosition: "left" | "right" | "center" | "both";
115
116
  dragMode: "preview" | "live";
116
- dragThreshold: number;
117
117
  dragEffect: import("../../index.js").HysModalDragEffect;
118
118
  keepHandleVisible: boolean;
119
119
  resetPositionOnClose: boolean;
@@ -1,29 +1,52 @@
1
- type Item = {
2
- id: string;
3
- label: string;
4
- };
5
- type __VLS_Props = {
6
- modelValue: Item[];
7
- disabled?: boolean;
8
- };
9
- declare const __VLS_template: () => {
10
- __VLS_Slots: {
11
- item?: (props: {
12
- item: Item;
13
- }) => any;
1
+ import { type VNodeChild } from "vue";
2
+ import type { HysSortChange, HysSortDrag, HysSortFeedback, HysSortItem, HysSortKey, HysSortMoveOptions, HysSortPreview, HysSortRow, HysSortableListProps } from "./sortableList";
3
+ declare const __VLS_export: <T extends object = HysSortItem>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<(Omit<HysSortableListProps<T>, "showHandle"> & {
5
+ showHandle?: boolean;
6
+ }) & {
7
+ onChange?: ((change: HysSortChange<T>) => any) | undefined;
8
+ "onUpdate:modelValue"?: ((value: T[]) => any) | undefined;
9
+ onStart?: ((drag: HysSortDrag<T>) => any) | undefined;
10
+ onCancel?: ((feedback: HysSortFeedback<T>) => any) | undefined;
11
+ onInvalid?: ((feedback: HysSortFeedback<T>) => any) | undefined;
12
+ "onUpdate:selectedKeys"?: ((keys: HysSortKey[]) => any) | undefined;
13
+ onConflict?: ((feedback: HysSortFeedback<T>) => any) | undefined;
14
+ onPreview?: ((preview: HysSortPreview<T> | null) => any) | undefined;
15
+ "onSave-error"?: ((feedback: HysSortFeedback<T>) => any) | undefined;
16
+ }> & (typeof globalThis extends {
17
+ __VLS_PROPS_FALLBACK: infer P;
18
+ } ? P : {});
19
+ expose: (exposed: import("vue").ShallowUnwrapRef<{
20
+ move: (keys: HysSortKey | readonly HysSortKey[], options: HysSortMoveOptions) => Promise<boolean>;
21
+ select: (keys: readonly HysSortKey[]) => void;
22
+ scrollTo: (key: HysSortKey) => Promise<boolean>;
23
+ focus: (key: HysSortKey) => Promise<boolean>;
24
+ undo: () => Promise<boolean>;
25
+ redo: () => Promise<boolean>;
26
+ reset: () => Promise<boolean>;
27
+ cancel: () => void;
28
+ }>) => void;
29
+ attrs: any;
30
+ slots: {
31
+ item?: (row: HysSortRow<T>) => VNodeChild;
32
+ handle?: (row: HysSortRow<T>) => VNodeChild;
33
+ preview?: (context: {
34
+ drag: HysSortDrag<T>;
35
+ allowed: boolean;
36
+ }) => VNodeChild;
37
+ placeholder?: (row: HysSortRow<T>) => VNodeChild;
38
+ empty?: () => VNodeChild;
39
+ header?: () => VNodeChild;
40
+ cells?: (row: HysSortRow<T>) => VNodeChild;
14
41
  };
42
+ emit: ((evt: "change", change: HysSortChange<T>) => void) & ((evt: "update:modelValue", value: T[]) => void) & ((evt: "start", drag: HysSortDrag<T>) => void) & ((evt: "cancel", feedback: HysSortFeedback<T>) => void) & ((evt: "invalid", feedback: HysSortFeedback<T>) => void) & ((evt: "update:selectedKeys", keys: HysSortKey[]) => void) & ((evt: "conflict", feedback: HysSortFeedback<T>) => void) & ((evt: "preview", preview: HysSortPreview<T> | null) => void) & ((evt: "save-error", feedback: HysSortFeedback<T>) => void);
43
+ }>) => import("vue").VNode & {
44
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
15
45
  };
16
- type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
17
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
18
- "update:modelValue": (value: Item[]) => any;
19
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
20
- "onUpdate:modelValue"?: ((value: Item[]) => any) | undefined;
21
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
22
- declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
23
46
  declare const _default: typeof __VLS_export;
24
47
  export default _default;
25
- type __VLS_WithSlots<T, S> = T & {
26
- new (): {
27
- $slots: S;
28
- };
29
- };
48
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
49
+ [K in keyof T]: T[K];
50
+ } : {
51
+ [K in keyof T as K]: T[K];
52
+ }) & {};
@@ -0,0 +1,31 @@
1
+ import type { StyleValue } from "vue";
2
+ import type { SortGhost } from "./useSortGhost";
3
+ declare const __VLS_export: <T extends object>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<{
5
+ track: SortGhost<T>;
6
+ appearance: Record<string, string>;
7
+ motion: boolean;
8
+ ghostClass?: string;
9
+ ghostStyle?: StyleValue;
10
+ }> & (typeof globalThis extends {
11
+ __VLS_PROPS_FALLBACK: infer P;
12
+ } ? P : {});
13
+ expose: (exposed: {}) => void;
14
+ attrs: any;
15
+ slots: {
16
+ default?: (props: {
17
+ drag: import("../sortableList").HysSortDrag<T>;
18
+ allowed: boolean;
19
+ }) => any;
20
+ };
21
+ emit: {};
22
+ }>) => import("vue").VNode & {
23
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
24
+ };
25
+ declare const _default: typeof __VLS_export;
26
+ export default _default;
27
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
28
+ [K in keyof T]: T[K];
29
+ } : {
30
+ [K in keyof T as K]: T[K];
31
+ }) & {};
@@ -0,0 +1,23 @@
1
+ import { type Ref } from "vue";
2
+ import type { SortPoint } from "../geometry";
3
+ import type { HysSortDrag } from "../sortableList";
4
+ export interface SortGhost<T extends object> {
5
+ drag: HysSortDrag<T>;
6
+ position: Ref<SortPoint>;
7
+ returning: Ref<boolean>;
8
+ landing: Ref<{
9
+ duration: number;
10
+ easing: string;
11
+ } | null>;
12
+ allowed: Ref<boolean>;
13
+ width: number;
14
+ }
15
+ export declare function useSortGhost<T extends object>(animate: () => boolean, timing: () => {
16
+ duration: number;
17
+ easing: string;
18
+ }): {
19
+ ghost: import("vue").ShallowRef<SortGhost<T> | null, SortGhost<T> | null>;
20
+ show: (drag: HysSortDrag<T>, row: HTMLElement, point: SortPoint) => void;
21
+ clear: (rebound: boolean, row?: HTMLElement) => void;
22
+ release: (commit: (onLanding?: (row?: HTMLElement) => void) => Promise<boolean>, sourceRow: () => HTMLElement | undefined) => Promise<boolean>;
23
+ };
@@ -0,0 +1,35 @@
1
+ import { type SortCandidate, type SortPort, type SortProposal } from "./model";
2
+ import type { HysSortDrag, HysSortFeedback, HysSortableListProps, HysSortKey, HysSortPosition, HysSortScroll } from "./sortableList";
3
+ export interface SortPoint {
4
+ x: number;
5
+ y: number;
6
+ }
7
+ export declare function wholeRowDrag(props: Pick<HysSortableListProps, "handle" | "showHandle">): boolean;
8
+ export declare function hitsSelectableText(element: Element, x: number, y: number): boolean;
9
+ export declare function dropMarkerFor<T extends object>(port: SortPort<T>, candidate: SortCandidate<T>, drag: HysSortDrag<T>, result?: SortProposal<T> | HysSortFeedback<T>): {
10
+ key?: HysSortKey;
11
+ position: HysSortPosition;
12
+ };
13
+ export interface SortHit<T extends object> {
14
+ element: Element | null;
15
+ rowKey?: string;
16
+ candidate?: SortCandidate<T>;
17
+ nearCenter?: boolean;
18
+ nearEdge?: boolean;
19
+ }
20
+ export declare function withinDragBounds<T extends object>(port: SortPort<T>, point: SortPoint, origin: SortPoint): {
21
+ point: {
22
+ x: number;
23
+ y: number;
24
+ };
25
+ inside: boolean;
26
+ };
27
+ export declare function gridColumns(element: HTMLElement | undefined): number;
28
+ export declare function findSortHit<T extends object>(source: SortPort<T>, point: SortPoint): SortHit<T>;
29
+ export declare function keepSortCandidate<T extends object>(source: SortPort<T>, current: SortCandidate<T> | undefined, hit?: SortHit<T>): boolean | undefined;
30
+ export declare function candidateAt<T extends object>(source: SortPort<T>, port: SortPort<T>, index: number): SortCandidate<T>;
31
+ export declare function relativeCandidate<T extends object>(port: SortPort<T>, key: HysSortKey, step: number): SortCandidate<T> | undefined;
32
+ export declare function keyStep<T extends object>(port: SortPort<T>, key: string): number;
33
+ export declare function sameCandidate<T extends object>(a?: SortCandidate<T>, b?: SortCandidate<T>): boolean;
34
+ export declare const tokenOf: (key: HysSortKey) => string;
35
+ export declare function autoScrollSort(element: Element | null, point: SortPoint, option: boolean | HysSortScroll | undefined): boolean;
@@ -0,0 +1,61 @@
1
+ import type { HysSortChange, HysSortDrag, HysSortFeedback, HysSortFixed, HysSortGroup, HysSortKey, HysSortOperation, HysSortPosition, HysSortPreview, HysSortProposal, HysSortReason, HysSortSource, HysSortableListProps } from "./sortableList";
2
+ export interface SortIndex<T extends object> {
3
+ keys: Map<HysSortKey, number>;
4
+ fixed: {
5
+ key: HysSortKey;
6
+ index: number;
7
+ placement: HysSortFixed;
8
+ }[];
9
+ items: readonly T[];
10
+ valid: boolean;
11
+ }
12
+ export interface SortPort<T extends object> {
13
+ id: () => string;
14
+ props: HysSortableListProps<T>;
15
+ root: () => HTMLElement | undefined;
16
+ surface: () => HTMLElement | undefined;
17
+ data: () => SortIndex<T>;
18
+ key: (item: T) => HysSortKey;
19
+ label: (item: T) => string;
20
+ row: (key: HysSortKey) => HTMLElement | undefined;
21
+ apply: (items: T[]) => void;
22
+ focus: (key: HysSortKey) => Promise<boolean>;
23
+ scroll: (key: HysSortKey) => Promise<boolean>;
24
+ lock: (busy: boolean) => void;
25
+ start: (drag: HysSortDrag<T>) => void;
26
+ preview: (preview: HysSortPreview<T> | null) => void;
27
+ change: (change: HysSortChange<T>) => void;
28
+ reject: (feedback: HysSortFeedback<T>) => void;
29
+ announce: (message: string) => void;
30
+ }
31
+ export interface SortCandidate<T extends object> {
32
+ port: SortPort<T>;
33
+ index: number;
34
+ position: HysSortPosition;
35
+ anchor?: HysSortKey;
36
+ operation?: HysSortOperation;
37
+ }
38
+ export interface SortProposal<T extends object> {
39
+ source: SortPort<T>;
40
+ target: SortPort<T>;
41
+ proposal: HysSortProposal<T>;
42
+ changes: {
43
+ port: SortPort<T>;
44
+ previous: readonly T[];
45
+ next: T[];
46
+ }[];
47
+ }
48
+ export declare function registerSortPort<T extends object>(element: HTMLElement, port: SortPort<T>): () => void;
49
+ export declare const sortPorts: <T extends object>() => SortPort<T>[];
50
+ export declare function portAt<T extends object>(element: Element | null): SortPort<T> | undefined;
51
+ export declare const groupOf: <T extends object>(port: SortPort<T>) => HysSortGroup<T> | undefined;
52
+ export declare function linkedPorts<T extends object>(port: SortPort<T>): SortPort<T>[];
53
+ export declare const keyToken: (key: HysSortKey) => string;
54
+ export declare const layoutOf: (props: Pick<HysSortableListProps, "layout" | "listTag">) => import("./sortableList").HysSortLayout;
55
+ export declare function buildSortIndex<T extends object>(items: readonly T[], keyOf: (item: T) => HysSortKey, fixed: HysSortableListProps<T>["fixed"]): SortIndex<T>;
56
+ export declare function feedback<T extends object>(reason: HysSortReason, proposal?: HysSortProposal<T>, message?: string, error?: unknown): HysSortFeedback<T>;
57
+ export declare function dragIssue<T extends object>(port: SortPort<T>, item: T, index: number): HysSortFeedback<T> | undefined;
58
+ export declare function makeDrag<T extends object>(port: SortPort<T>, keys: readonly HysSortKey[], source: HysSortSource): HysSortDrag<T> | HysSortFeedback<T>;
59
+ export declare function preserved<T extends object>(port: SortPort<T>, next: readonly T[]): boolean;
60
+ export declare const sameItems: <T>(left: readonly T[], right: readonly T[]) => boolean;
61
+ export declare function proposeSort<T extends object>(source: SortPort<T>, drag: HysSortDrag<T>, candidate: SortCandidate<T>, commit?: boolean): SortProposal<T> | HysSortFeedback<T>;
@@ -0,0 +1,151 @@
1
+ import type { StyleValue } from "vue";
2
+ export type HysSortKey = string | number;
3
+ export interface HysSortItem {
4
+ id: HysSortKey;
5
+ label: string;
6
+ }
7
+ export type HysSortLayout = "vertical" | "horizontal" | "grid";
8
+ export type HysSortMode = "insert" | "swap";
9
+ export type HysSortOperation = "move" | "copy" | "clone";
10
+ export type HysSortPosition = "before" | "after" | "inside";
11
+ export type HysSortSource = "pointer" | "keyboard" | "button" | "api";
12
+ export type HysSortFixed = boolean | "top" | "bottom";
13
+ export type HysSortDecision = boolean | string | void;
14
+ export type HysSortReason = "cancelled" | "outside" | "disabled" | "keys" | "group" | "capacity" | "fixed" | "cycle" | "noop" | "rule" | "conflict" | "save";
15
+ export interface HysSortListInfo<T extends object> {
16
+ id: string;
17
+ group?: string;
18
+ items: readonly T[];
19
+ }
20
+ export interface HysSortDrag<T extends object> {
21
+ source: HysSortSource;
22
+ from: HysSortListInfo<T>;
23
+ items: readonly T[];
24
+ keys: readonly HysSortKey[];
25
+ indices: readonly number[];
26
+ }
27
+ export interface HysSortProposal<T extends object> extends HysSortDrag<T> {
28
+ to: HysSortListInfo<T>;
29
+ /** 原列表中的插入边界,0 表示首位,length 表示末尾。交换模式下为目标项索引。 */
30
+ index: number;
31
+ position: HysSortPosition;
32
+ targetItem?: T;
33
+ operation: HysSortOperation;
34
+ mode: HysSortMode;
35
+ }
36
+ export interface HysSortListChange<T extends object> {
37
+ id: string;
38
+ previous: readonly T[];
39
+ next: readonly T[];
40
+ }
41
+ export interface HysSortPreview<T extends object> {
42
+ proposal: HysSortProposal<T>;
43
+ lists: readonly HysSortListChange<T>[];
44
+ }
45
+ export interface HysSortChange<T extends object> {
46
+ action: "sort" | "undo" | "redo" | "reset" | "rollback";
47
+ proposal?: HysSortProposal<T>;
48
+ lists: readonly HysSortListChange<T>[];
49
+ }
50
+ export interface HysSortFeedback<T extends object> {
51
+ reason: HysSortReason;
52
+ message: string;
53
+ proposal?: HysSortProposal<T>;
54
+ error?: unknown;
55
+ }
56
+ export interface HysSortGroup<T extends object> {
57
+ name: string;
58
+ pull?: boolean | HysSortOperation | ((proposal: HysSortProposal<T>) => boolean | HysSortOperation);
59
+ put?: boolean | readonly string[] | ((proposal: HysSortProposal<T>) => HysSortDecision);
60
+ }
61
+ export interface HysSortScroll {
62
+ threshold?: number;
63
+ speed?: number;
64
+ axis?: "x" | "y" | "both";
65
+ window?: boolean;
66
+ }
67
+ export interface HysSortVirtual {
68
+ height?: number | string;
69
+ estimateSize?: number;
70
+ overscan?: number;
71
+ /** 网格每一行的列数。设置为函数可根据容器宽度调整。 */
72
+ columns?: number | ((width: number) => number);
73
+ }
74
+ export interface HysSortRow<T extends object> {
75
+ item: T;
76
+ key: HysSortKey;
77
+ index: number;
78
+ selected: boolean;
79
+ dragging: boolean;
80
+ disabled: boolean;
81
+ fixed: HysSortFixed;
82
+ toggle: (event?: MouseEvent) => void;
83
+ move: (offset: number) => Promise<boolean>;
84
+ }
85
+ export interface HysSortableListProps<T extends object = HysSortItem> {
86
+ /** 受控列表。每项必须有唯一、稳定的键。 */
87
+ modelValue?: readonly T[];
88
+ /** 非受控初始数据,也可通过 reset 恢复挂载时的顺序。 */
89
+ defaultItems?: readonly T[];
90
+ itemKey?: keyof T | ((item: T) => HysSortKey);
91
+ itemLabel?: keyof T | ((item: T) => string);
92
+ listId?: string;
93
+ ariaLabel?: string;
94
+ layout?: HysSortLayout;
95
+ mode?: HysSortMode;
96
+ disabled?: boolean;
97
+ itemDisabled?: readonly HysSortKey[] | ((item: T, index: number) => boolean);
98
+ fixed?: readonly HysSortKey[] | ((item: T, index: number) => HysSortFixed | undefined);
99
+ handle?: boolean | string;
100
+ showHandle?: boolean;
101
+ showButtons?: boolean;
102
+ keyboard?: boolean;
103
+ dragDelay?: number;
104
+ touchDelay?: number;
105
+ dragThreshold?: number;
106
+ axis?: "x" | "y" | "both";
107
+ bounds?: "list" | "viewport" | HTMLElement | (() => HTMLElement | null | undefined);
108
+ snap?: boolean;
109
+ livePreview?: boolean;
110
+ group?: string | HysSortGroup<T>;
111
+ maxItems?: number;
112
+ selectable?: boolean;
113
+ selectedKeys?: readonly HysSortKey[];
114
+ defaultSelectedKeys?: readonly HysSortKey[];
115
+ /** copy 浅拷贝、clone 深拷贝。自定义时应返回有新键的项目。 */
116
+ clone?: (item: T, proposal: HysSortProposal<T>) => T;
117
+ canDrag?: (item: T, index: number) => HysSortDecision;
118
+ canDrop?: (proposal: HysSortProposal<T>) => HysSortDecision;
119
+ resolveIndex?: (proposal: HysSortProposal<T>) => number;
120
+ beforeDrop?: (proposal: HysSortProposal<T>, signal: AbortSignal) => HysSortDecision | Promise<HysSortDecision>;
121
+ save?: (change: HysSortChange<T>, signal: AbortSignal) => void | boolean | Promise<void | boolean>;
122
+ history?: boolean | number;
123
+ storageKey?: string;
124
+ autoScroll?: boolean | HysSortScroll;
125
+ virtual?: boolean | HysSortVirtual;
126
+ listTag?: "div" | "ul" | "ol" | "table";
127
+ tableColumns?: number;
128
+ motion?: boolean;
129
+ animationDuration?: number;
130
+ animationEasing?: string;
131
+ moveClass?: string;
132
+ ghostClass?: string;
133
+ ghostStyle?: StyleValue;
134
+ }
135
+ export interface HysSortMoveOptions {
136
+ /** 目标 listId;省略时在当前列表内移动。 */
137
+ to?: string;
138
+ /** 使用目标当前模型的插入边界;交换模式下为项目索引。 */
139
+ index: number;
140
+ operation?: HysSortOperation;
141
+ }
142
+ export interface HysSortableListInstance {
143
+ move: (keys: HysSortKey | readonly HysSortKey[], options: HysSortMoveOptions) => Promise<boolean>;
144
+ undo: () => Promise<boolean>;
145
+ redo: () => Promise<boolean>;
146
+ reset: () => Promise<boolean>;
147
+ cancel: () => void;
148
+ select: (keys: readonly HysSortKey[]) => void;
149
+ scrollTo: (key: HysSortKey) => Promise<boolean>;
150
+ focus: (key: HysSortKey) => Promise<boolean>;
151
+ }
@@ -0,0 +1,10 @@
1
+ import { type SortCandidate, type SortPort } from "./model";
2
+ import type { HysSortDrag, HysSortKey } from "./sortableList";
3
+ export declare const busySort: (port: object) => boolean;
4
+ export declare const abortSort: (port: object) => void | undefined;
5
+ export declare function discardSortHistory<T extends object>(port: SortPort<T>): void;
6
+ export declare function restoreStoredSort<T extends object>(port: SortPort<T>): void;
7
+ export declare function commitSort<T extends object>(source: SortPort<T>, drag: HysSortDrag<T>, candidate: SortCandidate<T>, onLanding?: (row?: HTMLElement) => void): Promise<boolean>;
8
+ export declare function navigateHistory<T extends object>(port: SortPort<T>, action: "undo" | "redo"): Promise<boolean>;
9
+ export declare function resetSort<T extends object>(port: SortPort<T>, initial: readonly T[]): Promise<boolean>;
10
+ export declare function keysArray(keys: HysSortKey | readonly HysSortKey[]): readonly HysSortKey[];
@@ -0,0 +1,25 @@
1
+ import { type SortCandidate, type SortPort, type SortProposal } from "./model";
2
+ import type { HysSortDrag, HysSortFeedback, HysSortKey, HysSortReason, HysSortSource } from "./sortableList";
3
+ interface ActiveSort<T extends object> {
4
+ source: SortPort<T>;
5
+ drag: HysSortDrag<T>;
6
+ candidate?: SortCandidate<T>;
7
+ result?: SortProposal<T> | HysSortFeedback<T>;
8
+ }
9
+ export declare function useSortDrag<T extends object>(port: SortPort<T>, pickedKeys: (key: HysSortKey) => readonly HysSortKey[], animate: () => boolean): {
10
+ own: import("vue").ComputedRef<ActiveSort<T> | null>;
11
+ over: import("vue").ComputedRef<ActiveSort<T> | null>;
12
+ ghost: import("vue").ShallowRef<import("./SortableGhost/useSortGhost").SortGhost<T> | null, import("./SortableGhost/useSortGhost").SortGhost<T> | null>;
13
+ anchorForDisplay: import("vue").ComputedRef<{
14
+ key?: HysSortKey;
15
+ position: import("./sortableList").HysSortPosition;
16
+ } | undefined>;
17
+ pointerDown: (event: PointerEvent, key: HysSortKey, rowDisabled: boolean) => void;
18
+ keyboard: (event: KeyboardEvent, key: HysSortKey, rowDisabled: boolean) => void;
19
+ move: (keys: readonly HysSortKey[], candidate: SortCandidate<T>, source: HysSortSource) => Promise<boolean>;
20
+ relative: (key: HysSortKey, step: number, source: HysSortSource) => Promise<boolean>;
21
+ cancel: (reason?: HysSortReason, rebound?: boolean) => void;
22
+ detach: () => void;
23
+ dataChanged: () => void;
24
+ };
25
+ export {};
@@ -0,0 +1,17 @@
1
+ import { type SortCandidate, type SortPort, type SortProposal } from "./model";
2
+ import type { HysSortDrag, HysSortFeedback, HysSortKey } from "./sortableList";
3
+ export declare const sortInteractive = "button,input,select,textarea,a[href],label,[contenteditable=true],[role=button],[data-sort-ignore]";
4
+ export declare function keyboardPreviewLabel<T extends object>(source: SortPort<T>, item: T, result?: SortProposal<T> | HysSortFeedback<T>): string;
5
+ interface KeyboardSort<T extends object> {
6
+ current: () => {
7
+ drag: HysSortDrag<T>;
8
+ candidate?: SortCandidate<T>;
9
+ } | null;
10
+ begin: (key: HysSortKey) => void;
11
+ update: (candidate: SortCandidate<T>) => void;
12
+ finish: () => Promise<boolean>;
13
+ cancel: () => void;
14
+ relative: (key: HysSortKey, step: number) => Promise<boolean>;
15
+ }
16
+ export declare function useSortKeyboard<T extends object>(port: SortPort<T>, actions: KeyboardSort<T>): (event: KeyboardEvent, key: HysSortKey, rowDisabled: boolean) => void;
17
+ export {};
@@ -0,0 +1,16 @@
1
+ import { type Ref } from "vue";
2
+ import type { HysSortableListProps, HysSortKey } from "./sortableList";
3
+ export declare function useSortWindow<T extends object>(props: HysSortableListProps<T>, items: Ref<readonly T[]>, viewport: Ref<HTMLElement | null>, surface: Ref<HTMLElement | null>, keyOf: (item: T) => HysSortKey): {
4
+ visibleItems: import("vue").ComputedRef<T[]>;
5
+ range: import("vue").ComputedRef<{
6
+ start: number;
7
+ end: number;
8
+ before: number;
9
+ after: number;
10
+ }>;
11
+ horizontal: import("vue").ComputedRef<boolean>;
12
+ length: import("vue").ComputedRef<string | undefined>;
13
+ columns: import("vue").ComputedRef<number>;
14
+ reveal: (index: number) => Promise<void>;
15
+ syncPosition: () => void;
16
+ };
@@ -1,61 +1,59 @@
1
- export type HysToastType = 'success' | 'error' | 'info' | 'warning' | 'loading';
2
- export type HysToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' | 'center' | 'top' | 'bottom';
3
- type __VLS_Props = {
4
- message?: string;
5
- type?: HysToastType;
6
- duration?: number;
7
- closable?: boolean;
8
- position?: HysToastPosition;
9
- offset?: number;
10
- zIndex?: number;
11
- showIcon?: boolean;
12
- pauseOnHover?: boolean;
13
- closeOnEscape?: boolean;
14
- repeat?: number;
15
- plain?: boolean;
16
- teleport?: boolean;
17
- appendTo?: string | HTMLElement;
1
+ import type { HysToastActionContext, HysToastActionEvent, HysToastCloseContext, HysToastCloseReason, HysToastContext, HysToastPatch, HysToastProps } from "./toastTypes";
2
+ export type { HysToastPosition, HysToastType } from "./toastTypes";
3
+ type __VLS_Slots = {
4
+ default?: (context: HysToastActionContext) => unknown;
5
+ icon?: (context: HysToastActionContext) => unknown;
6
+ header?: (context: HysToastActionContext) => unknown;
7
+ footer?: (context: HysToastActionContext) => unknown;
8
+ action?: (context: HysToastActionContext) => unknown;
18
9
  };
19
- declare function pause(): void;
20
- declare function resume(): void;
21
- declare function restart(): void;
22
- declare function close(): void;
23
- declare const __VLS_template: () => {
24
- __VLS_Slots: {
25
- icon?: (props: {}) => any;
26
- } & {
27
- default?: (props: {}) => any;
28
- } & {
29
- action?: (props: {
30
- close: typeof close;
31
- }) => any;
32
- };
33
- };
34
- type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
35
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
10
+ declare function close(reason?: HysToastCloseReason, event?: Event, force?: boolean): Promise<boolean>;
11
+ declare const __VLS_base: import("vue").DefineComponent<HysToastProps, {
36
12
  close: typeof close;
37
- pause: typeof pause;
38
- resume: typeof resume;
39
- restart: typeof restart;
13
+ pause: () => void;
14
+ resume: () => void;
15
+ restart: () => void;
16
+ extend: (milliseconds: number) => void;
40
17
  element: import("vue").Ref<HTMLElement | undefined, HTMLElement | undefined>;
18
+ snapshotClock: () => import("./useToastTimer").ToastClock;
19
+ restoreClock: (clock: import("./useToastTimer").ToastClock) => void;
41
20
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
42
- close: () => any;
43
- afterClose: () => any;
44
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
45
- onClose?: (() => any) | undefined;
46
- onAfterClose?: (() => any) | undefined;
21
+ click: (event: MouseEvent, context: HysToastContext) => any;
22
+ close: (context: HysToastCloseContext) => any;
23
+ afterClose: (context: HysToastCloseContext) => any;
24
+ action: (event: HysToastActionEvent) => any;
25
+ show: (context: HysToastContext) => any;
26
+ update: (patch: HysToastPatch) => any;
27
+ "update:open": (open: boolean) => any;
28
+ afterShow: (context: HysToastContext) => any;
29
+ stateChange: (state: "visible" | "closing" | "closed", context: HysToastContext) => any;
30
+ }, string, import("vue").PublicProps, Readonly<HysToastProps> & Readonly<{
31
+ onClick?: ((event: MouseEvent, context: HysToastContext) => any) | undefined;
32
+ onClose?: ((context: HysToastCloseContext) => any) | undefined;
33
+ onAfterClose?: ((context: HysToastCloseContext) => any) | undefined;
34
+ onAction?: ((event: HysToastActionEvent) => any) | undefined;
35
+ onShow?: ((context: HysToastContext) => any) | undefined;
36
+ onUpdate?: ((patch: HysToastPatch) => any) | undefined;
37
+ "onUpdate:open"?: ((open: boolean) => any) | undefined;
38
+ onAfterShow?: ((context: HysToastContext) => any) | undefined;
39
+ onStateChange?: ((state: "visible" | "closing" | "closed", context: HysToastContext) => any) | undefined;
47
40
  }>, {
48
41
  repeat: number;
49
- type: HysToastType;
42
+ type: import("./toastTypes").HysToastType;
50
43
  offset: number;
44
+ duration: number;
51
45
  closable: boolean;
52
46
  showIcon: boolean;
53
- position: HysToastPosition;
47
+ position: import("./toastTypes").HysToastPosition;
48
+ open: boolean;
54
49
  message: string;
55
50
  zIndex: number;
56
- appendTo: string | HTMLElement;
57
- pauseOnHover: boolean;
51
+ appendTo: string | HTMLElement | ShadowRoot;
58
52
  teleport: boolean;
53
+ pauseOnHover: boolean;
54
+ pauseOnBlur: boolean;
55
+ interactive: boolean;
56
+ actionLayout: "footer" | "inline";
59
57
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
60
58
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
61
59
  declare const _default: typeof __VLS_export;
@@ -0,0 +1,25 @@
1
+ import { type PropType, type VNode } from "vue";
2
+ import type { createToastQueue } from "../../../composables/toastQueue";
3
+ declare const _default: typeof __VLS_export;
4
+ export default _default;
5
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
6
+ queue: {
7
+ type: PropType<ReturnType<typeof createToastQueue>>;
8
+ required: true;
9
+ };
10
+ skin: {
11
+ type: PropType<() => Record<string, string>>;
12
+ required: true;
13
+ };
14
+ }>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
15
+ [key: string]: any;
16
+ }>[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
17
+ queue: {
18
+ type: PropType<ReturnType<typeof createToastQueue>>;
19
+ required: true;
20
+ };
21
+ skin: {
22
+ type: PropType<() => Record<string, string>>;
23
+ required: true;
24
+ };
25
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,16 @@
1
+ interface Disclosure {
2
+ pinned: boolean;
3
+ preview: boolean;
4
+ focused: boolean;
5
+ suppressHover: boolean;
6
+ }
7
+ export declare function useToastStackDisclosure(): {
8
+ stacks: import("vue").Reactive<Map<string, Disclosure>>;
9
+ enter: (key: string, event: PointerEvent) => void;
10
+ leave: (key: string) => void;
11
+ toggle: (key: string) => void;
12
+ focusIn: (key: string) => void;
13
+ focusOut: (key: string, event: FocusEvent) => void;
14
+ retain: (keys: Iterable<string>) => void;
15
+ };
16
+ export {};