mood-ui 0.1.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/LICENSE +21 -0
- package/README.OLD.md +5 -0
- package/README.md +84 -0
- package/dist/components/ModoProvider.vue.d.ts +61 -0
- package/dist/components/data-display/Card.vue.d.ts +26 -0
- package/dist/components/data-display/Typography.vue.d.ts +21 -0
- package/dist/components/data-display/avatar/Avatar.vue.d.ts +9 -0
- package/dist/components/data-display/avatar/AvatarGroup.vue.d.ts +7 -0
- package/dist/components/data-display/calendar/AgendaView.vue.d.ts +76 -0
- package/dist/components/data-display/calendar/Calendar.vue.d.ts +25 -0
- package/dist/components/data-display/calendar/CalendarEventTooltip.vue.d.ts +34 -0
- package/dist/components/data-display/calendar/CalendarHeader.vue.d.ts +67 -0
- package/dist/components/data-display/calendar/DayView.vue.d.ts +91 -0
- package/dist/components/data-display/calendar/MonthView.vue.d.ts +71 -0
- package/dist/components/data-display/calendar/Scheduler.vue.d.ts +102 -0
- package/dist/components/data-display/calendar/WeekView.vue.d.ts +101 -0
- package/dist/components/data-display/date-picker/DateRangePicker.vue.d.ts +18 -0
- package/dist/components/data-display/date-picker/DateTimePicker.vue.d.ts +17 -0
- package/dist/components/data-display/table/Table.vue.d.ts +75 -0
- package/dist/components/data-display/table/TableColumn.vue.d.ts +26 -0
- package/dist/components/data-display/table/TablePagination.vue.d.ts +14 -0
- package/dist/components/feedback/Badge.vue.d.ts +24 -0
- package/dist/components/feedback/Banner.vue.d.ts +28 -0
- package/dist/components/feedback/Chip.vue.d.ts +22 -0
- package/dist/components/feedback/ConfirmDialog.vue.d.ts +4 -0
- package/dist/components/feedback/Drawer.vue.d.ts +43 -0
- package/dist/components/feedback/EmptyState.vue.d.ts +19 -0
- package/dist/components/feedback/Loader.vue.d.ts +7 -0
- package/dist/components/feedback/Modal.vue.d.ts +44 -0
- package/dist/components/feedback/ProgressBar.vue.d.ts +10 -0
- package/dist/components/feedback/Skeleton.vue.d.ts +10 -0
- package/dist/components/feedback/Toast.vue.d.ts +19 -0
- package/dist/components/feedback/ToastContainer.vue.d.ts +11 -0
- package/dist/components/feedback/Tooltip.vue.d.ts +35 -0
- package/dist/components/forms/Button.vue.d.ts +24 -0
- package/dist/components/forms/ButtonGroup.vue.d.ts +16 -0
- package/dist/components/forms/Checkbox.vue.d.ts +22 -0
- package/dist/components/forms/Combobox.vue.d.ts +48 -0
- package/dist/components/forms/DateField.vue.d.ts +30 -0
- package/dist/components/forms/DateRangeField.vue.d.ts +32 -0
- package/dist/components/forms/DateTimeField.vue.d.ts +34 -0
- package/dist/components/forms/FileInput.vue.d.ts +33 -0
- package/dist/components/forms/FormField.vue.d.ts +30 -0
- package/dist/components/forms/Input.vue.d.ts +33 -0
- package/dist/components/forms/MultiSelect.vue.d.ts +51 -0
- package/dist/components/forms/NumberInput.vue.d.ts +35 -0
- package/dist/components/forms/PasswordInput.vue.d.ts +40 -0
- package/dist/components/forms/Radio.vue.d.ts +16 -0
- package/dist/components/forms/RadioGroup.vue.d.ts +27 -0
- package/dist/components/forms/RangeSlider.vue.d.ts +27 -0
- package/dist/components/forms/SearchInput.vue.d.ts +37 -0
- package/dist/components/forms/Select.vue.d.ts +46 -0
- package/dist/components/forms/Slider.vue.d.ts +26 -0
- package/dist/components/forms/Switch.vue.d.ts +22 -0
- package/dist/components/forms/Textarea.vue.d.ts +36 -0
- package/dist/components/layout/AppShell.vue.d.ts +124 -0
- package/dist/components/layout/Canvas.vue.d.ts +21 -0
- package/dist/components/layout/Container.vue.d.ts +21 -0
- package/dist/components/layout/Divider.vue.d.ts +21 -0
- package/dist/components/layout/HStack.vue.d.ts +14 -0
- package/dist/components/layout/PageHeader.vue.d.ts +34 -0
- package/dist/components/layout/PopoverPanel.vue.d.ts +29 -0
- package/dist/components/layout/Sidebar.vue.d.ts +39 -0
- package/dist/components/layout/SidebarRow.vue.d.ts +31 -0
- package/dist/components/layout/SidebarRowContent.vue.d.ts +27 -0
- package/dist/components/layout/Stack.vue.d.ts +24 -0
- package/dist/components/layout/Topbar.vue.d.ts +36 -0
- package/dist/components/layout/VStack.vue.d.ts +14 -0
- package/dist/components/navigation/Breadcrumbs.vue.d.ts +13 -0
- package/dist/components/navigation/DropdownMenu.vue.d.ts +36 -0
- package/dist/components/navigation/Pagination.vue.d.ts +18 -0
- package/dist/components/navigation/Tabs.vue.d.ts +37 -0
- package/dist/composables/eventColors.d.ts +13 -0
- package/dist/composables/useAutoScroll.d.ts +11 -0
- package/dist/composables/useCalendar.d.ts +44 -0
- package/dist/composables/useCalendarKeyboard.d.ts +17 -0
- package/dist/composables/useCalendarTheme.d.ts +22 -0
- package/dist/composables/useColorMode.d.ts +28 -0
- package/dist/composables/useConfirm.d.ts +146 -0
- package/dist/composables/useCurrentTimeLine.d.ts +5 -0
- package/dist/composables/useEventHover.d.ts +29 -0
- package/dist/composables/useField.d.ts +89 -0
- package/dist/composables/useModoConfig.d.ts +29 -0
- package/dist/composables/usePopover.d.ts +59 -0
- package/dist/composables/useTable.d.ts +29 -0
- package/dist/composables/useTableColumnsState.d.ts +52 -0
- package/dist/composables/useTableFilter.d.ts +39 -0
- package/dist/composables/useTableKeyboard.d.ts +38 -0
- package/dist/composables/useTablePagination.d.ts +44 -0
- package/dist/composables/useTableQuery.d.ts +90 -0
- package/dist/composables/useTableSelection.d.ts +40 -0
- package/dist/composables/useTableSort.d.ts +41 -0
- package/dist/composables/useTableTree.d.ts +55 -0
- package/dist/composables/useTableUrlSync.d.ts +66 -0
- package/dist/composables/useTableVirtual.d.ts +43 -0
- package/dist/composables/useTimeGrid.d.ts +22 -0
- package/dist/composables/useToast.d.ts +176 -0
- package/dist/config/ModoConfig.d.ts +32 -0
- package/dist/config/ModoLocale.d.ts +212 -0
- package/dist/config/colorPrimitives.d.ts +13 -0
- package/dist/config/createModoUI.d.ts +85 -0
- package/dist/config/palettes.d.ts +30 -0
- package/dist/index.d.ts +130 -0
- package/dist/interfaces/data-display/Card.interface.d.ts +8 -0
- package/dist/interfaces/data-display/Typography.interface.d.ts +12 -0
- package/dist/interfaces/data-display/avatar/Avatar.interface.d.ts +24 -0
- package/dist/interfaces/data-display/avatar/AvatarGroup.interface.d.ts +8 -0
- package/dist/interfaces/data-display/calendar/AgendaView.interface.d.ts +29 -0
- package/dist/interfaces/data-display/calendar/Calendar.interface.d.ts +16 -0
- package/dist/interfaces/data-display/calendar/DayView.interface.d.ts +43 -0
- package/dist/interfaces/data-display/calendar/MonthView.interface.d.ts +41 -0
- package/dist/interfaces/data-display/calendar/Scheduler.interface.d.ts +63 -0
- package/dist/interfaces/data-display/calendar/WeekView.interface.d.ts +65 -0
- package/dist/interfaces/data-display/date-picker/DateRangePicker.interface.d.ts +20 -0
- package/dist/interfaces/data-display/date-picker/DateTimePicker.interface.d.ts +16 -0
- package/dist/interfaces/data-display/table/Table.interface.d.ts +615 -0
- package/dist/interfaces/data-display/table/TableColumn.interface.d.ts +10 -0
- package/dist/interfaces/data-display/table/TablePagination.interface.d.ts +33 -0
- package/dist/interfaces/feedback/Badge.interface.d.ts +14 -0
- package/dist/interfaces/feedback/Banner.interface.d.ts +14 -0
- package/dist/interfaces/feedback/Chip.interface.d.ts +35 -0
- package/dist/interfaces/feedback/ConfirmDialog.interface.d.ts +49 -0
- package/dist/interfaces/feedback/Drawer.interface.d.ts +49 -0
- package/dist/interfaces/feedback/EmptyState.interface.d.ts +31 -0
- package/dist/interfaces/feedback/Loader.interface.d.ts +7 -0
- package/dist/interfaces/feedback/Modal.interface.d.ts +50 -0
- package/dist/interfaces/feedback/ProgressBar.interface.d.ts +31 -0
- package/dist/interfaces/feedback/Skeleton.interface.d.ts +123 -0
- package/dist/interfaces/feedback/Toast.interface.d.ts +86 -0
- package/dist/interfaces/feedback/Tooltip.interface.d.ts +38 -0
- package/dist/interfaces/forms/Button.interface.d.ts +26 -0
- package/dist/interfaces/forms/ButtonGroup.interface.d.ts +9 -0
- package/dist/interfaces/forms/Checkbox.interface.d.ts +32 -0
- package/dist/interfaces/forms/Combobox.interface.d.ts +57 -0
- package/dist/interfaces/forms/DateField.interface.d.ts +39 -0
- package/dist/interfaces/forms/DateRangeField.interface.d.ts +41 -0
- package/dist/interfaces/forms/DateTimeField.interface.d.ts +44 -0
- package/dist/interfaces/forms/FileInput.interface.d.ts +105 -0
- package/dist/interfaces/forms/FormField.interface.d.ts +55 -0
- package/dist/interfaces/forms/Input.interface.d.ts +68 -0
- package/dist/interfaces/forms/NumberInput.interface.d.ts +77 -0
- package/dist/interfaces/forms/PasswordInput.interface.d.ts +84 -0
- package/dist/interfaces/forms/Radio.interface.d.ts +54 -0
- package/dist/interfaces/forms/RadioGroup.context.d.ts +13 -0
- package/dist/interfaces/forms/RangeSlider.interface.d.ts +30 -0
- package/dist/interfaces/forms/SearchInput.interface.d.ts +59 -0
- package/dist/interfaces/forms/Select.interface.d.ts +145 -0
- package/dist/interfaces/forms/Slider.interface.d.ts +36 -0
- package/dist/interfaces/forms/Switch.interface.d.ts +30 -0
- package/dist/interfaces/forms/Textarea.interface.d.ts +64 -0
- package/dist/interfaces/layout/AppShell.interface.d.ts +56 -0
- package/dist/interfaces/layout/Canvas.interface.d.ts +39 -0
- package/dist/interfaces/layout/Container.interface.d.ts +8 -0
- package/dist/interfaces/layout/Divider.interface.d.ts +53 -0
- package/dist/interfaces/layout/PageHeader.interface.d.ts +23 -0
- package/dist/interfaces/layout/Sidebar.interface.d.ts +88 -0
- package/dist/interfaces/layout/Stack.interface.d.ts +42 -0
- package/dist/interfaces/layout/Topbar.interface.d.ts +28 -0
- package/dist/interfaces/navigation/Breadcrumbs.interface.d.ts +38 -0
- package/dist/interfaces/navigation/DropdownMenu.interface.d.ts +72 -0
- package/dist/interfaces/navigation/Pagination.interface.d.ts +37 -0
- package/dist/interfaces/navigation/Tabs.interface.d.ts +74 -0
- package/dist/mood-ui.cjs +4 -0
- package/dist/mood-ui.cjs.map +1 -0
- package/dist/mood-ui.css +2 -0
- package/dist/mood-ui.mjs +19832 -0
- package/dist/mood-ui.mjs.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ComputedRef } from 'vue';
|
|
2
|
+
import { TablePaginationState } from '../interfaces/data-display/table/Table.interface';
|
|
3
|
+
/**
|
|
4
|
+
* Pagination state machine for `<Table>` and the standalone
|
|
5
|
+
* `<TablePagination>` primitive.
|
|
6
|
+
*
|
|
7
|
+
* Concerns:
|
|
8
|
+
* - Bridges controlled (`v-model:pagination`) and uncontrolled modes.
|
|
9
|
+
* - Clamps `page` to the valid range whenever `total` or `pageSize` change
|
|
10
|
+
* so the table never renders an empty page after a filter narrows the
|
|
11
|
+
* dataset.
|
|
12
|
+
* - Provides `apply(rows)` so callers running in client mode can slice
|
|
13
|
+
* the array with one call. Server-side hosts ignore `apply` and just
|
|
14
|
+
* listen to `onUpdate`.
|
|
15
|
+
*/
|
|
16
|
+
export interface UseTablePaginationOptions {
|
|
17
|
+
/** Controlled state getter (returns parent's `v-model:pagination`). */
|
|
18
|
+
state?: () => TablePaginationState | undefined;
|
|
19
|
+
/** Emit when state changes. */
|
|
20
|
+
onUpdate?: (next: TablePaginationState) => void;
|
|
21
|
+
/** Initial state for uncontrolled mode. */
|
|
22
|
+
initial?: TablePaginationState;
|
|
23
|
+
/**
|
|
24
|
+
* Total row count after filter+sort. Required in client mode for
|
|
25
|
+
* range / pageCount math. In server mode the parent supplies the
|
|
26
|
+
* authoritative `total` on the state object instead.
|
|
27
|
+
*/
|
|
28
|
+
derivedTotal?: () => number;
|
|
29
|
+
/** When true, `apply()` is a no-op (server returns the page itself). */
|
|
30
|
+
serverSide?: () => boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface UseTablePaginationApi<TRow> {
|
|
33
|
+
pagination: ComputedRef<TablePaginationState>;
|
|
34
|
+
/** Effective row count used for `pageCount` / `range`. */
|
|
35
|
+
total: ComputedRef<number>;
|
|
36
|
+
/** Total page count, always at least 1. */
|
|
37
|
+
pageCount: ComputedRef<number>;
|
|
38
|
+
/** Range tuple `[from, to]`, both 1-based inclusive (0/0 when empty). */
|
|
39
|
+
range: ComputedRef<[number, number]>;
|
|
40
|
+
setPage: (next: number) => void;
|
|
41
|
+
setPageSize: (next: number) => void;
|
|
42
|
+
apply: (rows: TRow[]) => TRow[];
|
|
43
|
+
}
|
|
44
|
+
export declare function useTablePagination<TRow>(opts?: UseTablePaginationOptions): UseTablePaginationApi<TRow>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
import { TableFilterState, TablePaginationState, TableSortState } from '../interfaces/data-display/table/Table.interface';
|
|
3
|
+
/**
|
|
4
|
+
* Server-side query orchestrator for `<Table>`.
|
|
5
|
+
*
|
|
6
|
+
* Wraps the (otherwise manual) wiring of `serverSide=true`: when any of
|
|
7
|
+
* `sort`, `filter`, `globalSearch`, or `pagination` change, runs your
|
|
8
|
+
* `fetcher` and exposes the result reactively.
|
|
9
|
+
*
|
|
10
|
+
* Wires up:
|
|
11
|
+
* - `data` → bind to `<Table :data>`
|
|
12
|
+
* - `pagination` → bind to `<Table v-model:pagination>` (with `total`)
|
|
13
|
+
* - `sort` → bind to `<Table v-model:sort>`
|
|
14
|
+
* - `filter` → bind to `<Table v-model:filter>`
|
|
15
|
+
* - `globalSearchTerm` → bind to `<Table v-model:globalSearchTerm>`
|
|
16
|
+
* - `loading` / `error` / `refetch()` for UI affordances.
|
|
17
|
+
*
|
|
18
|
+
* Behavior:
|
|
19
|
+
* - **Debounce** filter + globalSearchTerm changes (default 300ms) so
|
|
20
|
+
* fast typing emits one request. Sort/page changes fire instantly.
|
|
21
|
+
* - **Cancellation**: each new request aborts the previous via
|
|
22
|
+
* `AbortController`; aborted responses are ignored.
|
|
23
|
+
* - **Page reset**: when sort, filter, or search changes, pagination
|
|
24
|
+
* resets to page 1 automatically (configurable).
|
|
25
|
+
* - **Initial fetch**: runs once on creation (configurable).
|
|
26
|
+
*
|
|
27
|
+
* Design notes:
|
|
28
|
+
* - `data` is a `shallowRef` to avoid Vue tracking deep mutations of
|
|
29
|
+
* server payloads (and to dodge the generic `UnwrapRefSimple` issue
|
|
30
|
+
* we hit elsewhere in this codebase).
|
|
31
|
+
* - The composable doesn't know about your transport (fetch / axios /
|
|
32
|
+
* gRPC). It only awaits a `fetcher` function and reads two fields
|
|
33
|
+
* from the result: `items` and `total`.
|
|
34
|
+
*/
|
|
35
|
+
export interface TableQueryParams {
|
|
36
|
+
page: number;
|
|
37
|
+
pageSize: number;
|
|
38
|
+
sort: TableSortState;
|
|
39
|
+
filter: TableFilterState;
|
|
40
|
+
globalSearchTerm: string;
|
|
41
|
+
/** Aborted by the composable when a newer request supersedes this one. */
|
|
42
|
+
signal: AbortSignal;
|
|
43
|
+
}
|
|
44
|
+
export interface TableQueryResult<TRow> {
|
|
45
|
+
items: TRow[];
|
|
46
|
+
total: number;
|
|
47
|
+
}
|
|
48
|
+
export interface UseTableQueryOptions<TRow> {
|
|
49
|
+
/** Async function that fetches one page from the backend. */
|
|
50
|
+
fetcher: (params: TableQueryParams) => Promise<TableQueryResult<TRow>>;
|
|
51
|
+
/** Initial sort. @default [] */
|
|
52
|
+
initialSort?: TableSortState;
|
|
53
|
+
/** Initial filter. @default {} */
|
|
54
|
+
initialFilter?: TableFilterState;
|
|
55
|
+
/** Initial global search term. @default '' */
|
|
56
|
+
initialSearch?: string;
|
|
57
|
+
/** Initial page (1-based). @default 1 */
|
|
58
|
+
initialPage?: number;
|
|
59
|
+
/** Initial page size. @default 10 */
|
|
60
|
+
initialPageSize?: number;
|
|
61
|
+
/** ms to debounce filter / globalSearchTerm changes. @default 300 */
|
|
62
|
+
debounceMs?: number;
|
|
63
|
+
/** Reset page to 1 when sort/filter/search change. @default true */
|
|
64
|
+
resetPageOnQueryChange?: boolean;
|
|
65
|
+
/** Run the first fetch immediately. @default true */
|
|
66
|
+
immediate?: boolean;
|
|
67
|
+
}
|
|
68
|
+
export interface UseTableQueryApi<TRow> {
|
|
69
|
+
/** Server payload for the current page. */
|
|
70
|
+
data: Ref<TRow[]>;
|
|
71
|
+
/** v-model:pagination — `total` is set from the latest fetch. */
|
|
72
|
+
pagination: Ref<TablePaginationState>;
|
|
73
|
+
/** v-model:sort. */
|
|
74
|
+
sort: Ref<TableSortState>;
|
|
75
|
+
/** v-model:filter. */
|
|
76
|
+
filter: Ref<TableFilterState>;
|
|
77
|
+
/** v-model:globalSearchTerm. */
|
|
78
|
+
globalSearchTerm: Ref<string>;
|
|
79
|
+
/** True while a fetch is in flight (after debounce). */
|
|
80
|
+
loading: Ref<boolean>;
|
|
81
|
+
/** Last error thrown by the fetcher (cleared on success). */
|
|
82
|
+
error: Ref<unknown>;
|
|
83
|
+
/** Number of fetches that have completed (success or error). */
|
|
84
|
+
fetchCount: ComputedRef<number>;
|
|
85
|
+
/** Force a refetch with the current params. */
|
|
86
|
+
refetch: () => Promise<void>;
|
|
87
|
+
/** Cancel any in-flight request without refetching. */
|
|
88
|
+
cancel: () => void;
|
|
89
|
+
}
|
|
90
|
+
export declare function useTableQuery<TRow>(opts: UseTableQueryOptions<TRow>): UseTableQueryApi<TRow>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ComputedRef } from 'vue';
|
|
2
|
+
import { TableSelection, TableSelectionMode } from '../interfaces/data-display/table/Table.interface';
|
|
3
|
+
/**
|
|
4
|
+
* Selection state machine for `<Table>`.
|
|
5
|
+
*
|
|
6
|
+
* Modes:
|
|
7
|
+
* - `'none'` — selection disabled. The header checkbox column is hidden.
|
|
8
|
+
* - `'single'` — only one row at a time. Clicking another row replaces.
|
|
9
|
+
* - `'multi'` — toggleable per row, plus shift+click range selection
|
|
10
|
+
* (anchored at the last interacted row).
|
|
11
|
+
*
|
|
12
|
+
* State can be controlled (`v-model:selected`) or uncontrolled (internal).
|
|
13
|
+
*
|
|
14
|
+
* Keys are derived through the same `rowKey` resolver used elsewhere so
|
|
15
|
+
* a row's identity stays stable across data shuffling/sorting/pagination.
|
|
16
|
+
*/
|
|
17
|
+
export interface UseTableSelectionOptions<TRow> {
|
|
18
|
+
mode: () => TableSelectionMode;
|
|
19
|
+
/** Visible rows (post-sort/post-filter). Required for shift+click ranges. */
|
|
20
|
+
rows: ComputedRef<TRow[]>;
|
|
21
|
+
rowKey?: () => string | ((row: TRow, index: number) => string | number) | undefined;
|
|
22
|
+
/** Controlled state. Pass `undefined` to use the internal ref. */
|
|
23
|
+
state?: () => TableSelection | undefined;
|
|
24
|
+
onUpdate?: (next: TableSelection) => void;
|
|
25
|
+
/** Disable selection per row (e.g. system accounts). */
|
|
26
|
+
isRowSelectable?: (row: TRow, index: number) => boolean;
|
|
27
|
+
}
|
|
28
|
+
export declare function useTableSelection<TRow>(opts: UseTableSelectionOptions<TRow>): {
|
|
29
|
+
selected: ComputedRef<TableSelection>;
|
|
30
|
+
selectedSet: ComputedRef<Set<string | number>>;
|
|
31
|
+
isSelected: (row: TRow, index: number) => boolean;
|
|
32
|
+
isSelectable: (row: TRow, index: number) => boolean;
|
|
33
|
+
toggle: (row: TRow, index: number, opts2?: {
|
|
34
|
+
additive?: boolean;
|
|
35
|
+
range?: boolean;
|
|
36
|
+
}) => void;
|
|
37
|
+
toggleAll: () => void;
|
|
38
|
+
headerState: ComputedRef<"none" | "indeterminate" | "all">;
|
|
39
|
+
clear: () => void;
|
|
40
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { watch, ComputedRef } from 'vue';
|
|
2
|
+
import { NormalizedTableColumn, TableSortDirection, TableSortState } from '../interfaces/data-display/table/Table.interface';
|
|
3
|
+
/**
|
|
4
|
+
* Sort state machine for `<Table>`.
|
|
5
|
+
*
|
|
6
|
+
* Behaviors:
|
|
7
|
+
* - **Single-column** (`multi=false`): clicking a sortable header replaces
|
|
8
|
+
* the entire sort with that column. The cycle is asc → desc → none
|
|
9
|
+
* when `clearable`; asc → desc → asc otherwise.
|
|
10
|
+
* - **Multi-column** (`multi=true`): plain click still replaces the sort,
|
|
11
|
+
* but **shift+click** appends/cycles the criterion at the end of the
|
|
12
|
+
* current sort array. Removing a criterion when its direction reaches
|
|
13
|
+
* `none` keeps the others intact and preserves their priority order.
|
|
14
|
+
*
|
|
15
|
+
* The sort can be **controlled** (consumer passes `state` + listens to
|
|
16
|
+
* `update:sort`) or **uncontrolled** (consumer omits `state`; the
|
|
17
|
+
* composable owns its own ref). Uncontrolled is the default.
|
|
18
|
+
*/
|
|
19
|
+
export interface UseTableSortOptions<TRow> {
|
|
20
|
+
columns: ComputedRef<NormalizedTableColumn<TRow>[]>;
|
|
21
|
+
/** Controlled state. Pass `undefined` to use the internal ref. */
|
|
22
|
+
state?: () => TableSortState | undefined;
|
|
23
|
+
/** Emit handler when controlled. Called whenever the state changes. */
|
|
24
|
+
onUpdate?: (next: TableSortState) => void;
|
|
25
|
+
/** Default value used when the state arrives as `undefined`. */
|
|
26
|
+
initial?: TableSortState;
|
|
27
|
+
/** Allow shift+click to add criteria. */
|
|
28
|
+
multi?: () => boolean;
|
|
29
|
+
/** When true, the cycle is asc → desc → none; otherwise asc ↔ desc. */
|
|
30
|
+
clearable?: () => boolean;
|
|
31
|
+
}
|
|
32
|
+
export declare function useTableSort<TRow>(opts: UseTableSortOptions<TRow>): {
|
|
33
|
+
sort: ComputedRef<TableSortState>;
|
|
34
|
+
toggle: (key: string, additive: boolean) => void;
|
|
35
|
+
clear: () => void;
|
|
36
|
+
directionFor: (key: string) => TableSortDirection | undefined;
|
|
37
|
+
priorityFor: (key: string) => number;
|
|
38
|
+
ariaSortFor: (column: NormalizedTableColumn<TRow>) => "ascending" | "descending" | "none" | undefined;
|
|
39
|
+
apply: (rows: TRow[]) => TRow[];
|
|
40
|
+
};
|
|
41
|
+
export { watch };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
export interface UseTableTreeOptions<TRow> {
|
|
3
|
+
/** Top-level rows (already filtered + sorted). */
|
|
4
|
+
rows: () => TRow[];
|
|
5
|
+
/** Field that holds the children array on each row. */
|
|
6
|
+
childrenKey: () => string;
|
|
7
|
+
/** Resolves a row → stable key (mirrors `<Table rowKey>`). */
|
|
8
|
+
rowKey: () => string | ((row: TRow, index: number) => string | number) | undefined;
|
|
9
|
+
/** Currently-expanded row keys (controlled). When omitted, internal state is used. */
|
|
10
|
+
expanded: () => (string | number)[] | undefined;
|
|
11
|
+
/** Emit a new expanded array (controlled). */
|
|
12
|
+
onUpdate: (next: (string | number)[]) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Lazy loader for a row's children. When set, rows that have no
|
|
15
|
+
* pre-loaded children but pass `hasChildrenHint` show the chevron;
|
|
16
|
+
* expansion triggers the loader and the result replaces `row[childrenKey]`.
|
|
17
|
+
*/
|
|
18
|
+
loadChildren?: (row: TRow, index: number) => Promise<TRow[]>;
|
|
19
|
+
/**
|
|
20
|
+
* Hint for "this row probably has children" used only when
|
|
21
|
+
* `loadChildren` is set and the children are not yet known. Default
|
|
22
|
+
* returns false (i.e. only show chevrons for already-loaded children).
|
|
23
|
+
*/
|
|
24
|
+
hasChildrenHint?: (row: TRow, index: number) => boolean;
|
|
25
|
+
}
|
|
26
|
+
/** One flattened entry returned by the composable. */
|
|
27
|
+
export interface FlatTreeRow<TRow> {
|
|
28
|
+
row: TRow;
|
|
29
|
+
/** Original index of the *top-level* row in the input array. For
|
|
30
|
+
* nested rows this is the index inside the parent's children array. */
|
|
31
|
+
index: number;
|
|
32
|
+
/** 0-based depth. Root rows are 0. */
|
|
33
|
+
depth: number;
|
|
34
|
+
/** True if the row has (or is hinted to have) children. */
|
|
35
|
+
hasChildren: boolean;
|
|
36
|
+
/** True when expanded. */
|
|
37
|
+
expanded: boolean;
|
|
38
|
+
/** True while a lazy load is in flight. */
|
|
39
|
+
isLoading: boolean;
|
|
40
|
+
/** Stable key — same as `resolveRowKey`. */
|
|
41
|
+
key: string | number;
|
|
42
|
+
/** Key of the parent row, or `null` for root rows. */
|
|
43
|
+
parentKey: string | number | null;
|
|
44
|
+
/** Position within siblings (1-based) for `aria-posinset`. */
|
|
45
|
+
posInSet: number;
|
|
46
|
+
/** Sibling count for `aria-setsize`. */
|
|
47
|
+
setSize: number;
|
|
48
|
+
}
|
|
49
|
+
export declare function useTableTree<TRow>(opts: UseTableTreeOptions<TRow>): {
|
|
50
|
+
flatRows: import('vue').ComputedRef<FlatTreeRow<TRow>[]>;
|
|
51
|
+
toggle: (row: TRow, index: number) => Promise<void>;
|
|
52
|
+
isExpanded: (row: TRow, index: number) => boolean;
|
|
53
|
+
rowHasChildren: (row: TRow, index: number) => boolean;
|
|
54
|
+
loadingKeys: Ref<Set<string | number>>;
|
|
55
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { TableFilterState, TablePaginationState, TableSortState } from '../interfaces/data-display/table/Table.interface';
|
|
3
|
+
/**
|
|
4
|
+
* Two-way sync between `<Table>` state and the URL querystring.
|
|
5
|
+
*
|
|
6
|
+
* Goal: shareable links / browser back-forward navigation that restore
|
|
7
|
+
* exactly the table the user was looking at.
|
|
8
|
+
*
|
|
9
|
+
* Defaults follow conventional shorthand:
|
|
10
|
+
* - `sort=name:asc,role:desc` → `[{key:'name',direction:'asc'}, …]`
|
|
11
|
+
* - `filter.email=foo` → `{ email: 'foo' }`
|
|
12
|
+
* - `q=foo` → globalSearchTerm
|
|
13
|
+
* - `page=2` → pagination.page
|
|
14
|
+
* - `pageSize=25` → pagination.pageSize
|
|
15
|
+
*
|
|
16
|
+
* The composable:
|
|
17
|
+
* - Reads the URL once on creation and hydrates the bound refs.
|
|
18
|
+
* - Watches the refs and updates the URL via `history.replaceState`
|
|
19
|
+
* (so the user's history isn't polluted by every keystroke).
|
|
20
|
+
* - Listens to `popstate` so back/forward buttons restore state.
|
|
21
|
+
*
|
|
22
|
+
* It is transport-agnostic: works with vanilla `window.location` by
|
|
23
|
+
* default, but you can swap the URL adapter for vue-router or any
|
|
24
|
+
* other history provider via `urlAdapter`.
|
|
25
|
+
*/
|
|
26
|
+
export type TableUrlAdapter = {
|
|
27
|
+
/** Returns the current URL search string (including the leading '?'). */
|
|
28
|
+
read: () => string;
|
|
29
|
+
/** Writes the new search string. Receives `?key=value&…` or '' to clear. */
|
|
30
|
+
write: (search: string) => void;
|
|
31
|
+
/** Subscribes to back/forward navigation. Returns cleanup. */
|
|
32
|
+
onChange: (cb: () => void) => () => void;
|
|
33
|
+
};
|
|
34
|
+
export interface UseTableUrlSyncOptions {
|
|
35
|
+
sort?: Ref<TableSortState>;
|
|
36
|
+
filter?: Ref<TableFilterState>;
|
|
37
|
+
pagination?: Ref<TablePaginationState>;
|
|
38
|
+
globalSearchTerm?: Ref<string>;
|
|
39
|
+
/**
|
|
40
|
+
* Optional prefix for every key. Useful when you have multiple
|
|
41
|
+
* independent tables on the same page (e.g. `users.` and `orders.`).
|
|
42
|
+
* @default ''
|
|
43
|
+
*/
|
|
44
|
+
prefix?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Override per-field key names. Defaults shown.
|
|
47
|
+
*/
|
|
48
|
+
keys?: {
|
|
49
|
+
sort?: string;
|
|
50
|
+
filterPrefix?: string;
|
|
51
|
+
page?: string;
|
|
52
|
+
pageSize?: string;
|
|
53
|
+
search?: string;
|
|
54
|
+
};
|
|
55
|
+
/** Custom URL adapter (for vue-router / SSR). */
|
|
56
|
+
urlAdapter?: TableUrlAdapter;
|
|
57
|
+
}
|
|
58
|
+
export interface UseTableUrlSyncApi {
|
|
59
|
+
/** Apply the current refs to the URL once (no waiting for changes). */
|
|
60
|
+
syncToUrl: () => void;
|
|
61
|
+
/** Re-read the URL and update bound refs. */
|
|
62
|
+
syncFromUrl: () => void;
|
|
63
|
+
/** Stop syncing (also called automatically on scope dispose). */
|
|
64
|
+
dispose: () => void;
|
|
65
|
+
}
|
|
66
|
+
export declare function useTableUrlSync(opts: UseTableUrlSyncOptions): UseTableUrlSyncApi;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Fixed-height row virtualization for `<Table>`.
|
|
4
|
+
*
|
|
5
|
+
* Strategy: a single scroll viewport (the table wrapper) reports its
|
|
6
|
+
* `scrollTop` and `clientHeight` via a ResizeObserver + scroll listener.
|
|
7
|
+
* From those numbers + a fixed `rowHeight` we compute the slice
|
|
8
|
+
* `[startIndex, endIndex)` of visible rows plus an overscan band so
|
|
9
|
+
* the user never sees a blank gap during fast scrolling.
|
|
10
|
+
*
|
|
11
|
+
* Why fixed height?
|
|
12
|
+
* - It's the only model that lets us compute scroll positions in O(1)
|
|
13
|
+
* without measuring the DOM. Variable heights need a measurement
|
|
14
|
+
* cache + binary search and break sticky <thead> alignment.
|
|
15
|
+
* - Phase 3c excludes `expandable` rows, which is the only case where
|
|
16
|
+
* real heights would diverge.
|
|
17
|
+
*
|
|
18
|
+
* The composable is DOM-aware: pass it the viewport ref (the element
|
|
19
|
+
* that actually scrolls). It returns reactive indices the template
|
|
20
|
+
* uses to slice the row array, plus `topSpacer` / `bottomSpacer`
|
|
21
|
+
* heights for the placeholder rows that preserve the scrollbar.
|
|
22
|
+
*/
|
|
23
|
+
export interface UseTableVirtualOptions {
|
|
24
|
+
/** Total row count (after filter/sort/paginate, in row order). */
|
|
25
|
+
total: () => number;
|
|
26
|
+
/** Fixed row height in pixels. */
|
|
27
|
+
rowHeight: () => number;
|
|
28
|
+
/** Extra rows rendered outside the viewport on each side. @default 5 */
|
|
29
|
+
overscan?: () => number;
|
|
30
|
+
/** Active flag — when false, the API yields the full range. */
|
|
31
|
+
enabled: () => boolean;
|
|
32
|
+
/** The scrolling DOM node. Provided by the parent via a template ref. */
|
|
33
|
+
viewport: Ref<HTMLElement | null>;
|
|
34
|
+
}
|
|
35
|
+
export interface UseTableVirtualApi {
|
|
36
|
+
startIndex: ComputedRef<number>;
|
|
37
|
+
endIndex: ComputedRef<number>;
|
|
38
|
+
topSpacer: ComputedRef<number>;
|
|
39
|
+
bottomSpacer: ComputedRef<number>;
|
|
40
|
+
/** True when virtualization is active AND there are enough rows for it to matter. */
|
|
41
|
+
isActive: ComputedRef<boolean>;
|
|
42
|
+
}
|
|
43
|
+
export declare function useTableVirtual(opts: UseTableVirtualOptions): UseTableVirtualApi;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface TimeGridInput {
|
|
2
|
+
hourStart: () => number;
|
|
3
|
+
hourEnd: () => number;
|
|
4
|
+
slotMinutes: () => number;
|
|
5
|
+
slotHeight: () => number;
|
|
6
|
+
format: () => '12h' | '24h';
|
|
7
|
+
}
|
|
8
|
+
export declare const MS_MIN = 60000;
|
|
9
|
+
export declare function useTimeGrid(input: TimeGridInput): {
|
|
10
|
+
slotsPerHour: import('vue').ComputedRef<number>;
|
|
11
|
+
windowHours: import('vue').ComputedRef<number>;
|
|
12
|
+
totalSlots: import('vue').ComputedRef<number>;
|
|
13
|
+
windowMinutes: import('vue').ComputedRef<number>;
|
|
14
|
+
totalPixels: import('vue').ComputedRef<number>;
|
|
15
|
+
hourLabels: import('vue').ComputedRef<{
|
|
16
|
+
offset: number;
|
|
17
|
+
hour: number;
|
|
18
|
+
label: string;
|
|
19
|
+
}[]>;
|
|
20
|
+
dayStartMs: (d: Date) => number;
|
|
21
|
+
dayEndMs: (d: Date) => number;
|
|
22
|
+
};
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { ToastInput } from '../interfaces/feedback/Toast.interface';
|
|
2
|
+
/**
|
|
3
|
+
* Push a new toast onto the queue. Returns the resolved id so callers
|
|
4
|
+
* can later `dismiss(id)` or `update(id, …)` the same toast.
|
|
5
|
+
*
|
|
6
|
+
* If `input.id` matches an existing toast, the existing entry is replaced
|
|
7
|
+
* in place (useful for live status updates: "Saving…" → "Saved").
|
|
8
|
+
*/
|
|
9
|
+
declare function push(input: ToastInput | string): string | number;
|
|
10
|
+
/** Dismiss a single toast by id. No-op if the id isn't in the queue. */
|
|
11
|
+
declare function dismiss(id: string | number): void;
|
|
12
|
+
/** Dismiss every toast in the queue. */
|
|
13
|
+
declare function dismissAll(): void;
|
|
14
|
+
/** Convenience wrappers — same shape as `push()` but pre-set `color`. */
|
|
15
|
+
declare function info(input: Omit<ToastInput, 'color'> | string): string | number;
|
|
16
|
+
declare function success(input: Omit<ToastInput, 'color'> | string): string | number;
|
|
17
|
+
declare function warning(input: Omit<ToastInput, 'color'> | string): string | number;
|
|
18
|
+
declare function danger(input: Omit<ToastInput, 'color'> | string): string | number;
|
|
19
|
+
/**
|
|
20
|
+
* Components that render the queue (i.e. `<ToastContainer>`) call this
|
|
21
|
+
* to obtain the reactive store. The queue is conceptually owned by the
|
|
22
|
+
* composable; the container is the only consumer that mutates it (via
|
|
23
|
+
* `dismiss(id)`), and it does so through the public API.
|
|
24
|
+
*/
|
|
25
|
+
export declare function useToastQueue(): {
|
|
26
|
+
queue: {
|
|
27
|
+
id: string | number;
|
|
28
|
+
title?: string | undefined;
|
|
29
|
+
description?: string | undefined;
|
|
30
|
+
color: import('..').ToastColor;
|
|
31
|
+
variant: import('..').ToastVariant;
|
|
32
|
+
icon?: import('vue').FunctionalComponent<any, {}, any, {}> | {
|
|
33
|
+
new (...args: any[]): any;
|
|
34
|
+
__isFragment?: never;
|
|
35
|
+
__isTeleport?: never;
|
|
36
|
+
__isSuspense?: never;
|
|
37
|
+
} | {
|
|
38
|
+
[x: string]: any;
|
|
39
|
+
setup?: ((this: void, props: import('@vue/shared').LooseRequired<any>, ctx: {
|
|
40
|
+
attrs: import('vue').Attrs;
|
|
41
|
+
slots: Readonly<{
|
|
42
|
+
[name: string]: import('vue').Slot<any> | undefined;
|
|
43
|
+
}>;
|
|
44
|
+
emit: ((event: unknown, ...args: any[]) => void) | ((event: string, ...args: any[]) => void);
|
|
45
|
+
expose: <Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed) => void;
|
|
46
|
+
}) => any) | undefined;
|
|
47
|
+
name?: string | undefined;
|
|
48
|
+
template?: string | object | undefined;
|
|
49
|
+
render?: Function | undefined;
|
|
50
|
+
components?: Record<string, import('vue').Component<any, any, any, import('vue').ComputedOptions, import('vue').MethodOptions, {}, any>> | undefined;
|
|
51
|
+
directives?: Record<string, import('vue').Directive<any, any, string, any>> | undefined;
|
|
52
|
+
inheritAttrs?: boolean | undefined;
|
|
53
|
+
emits?: any;
|
|
54
|
+
slots?: {} | undefined;
|
|
55
|
+
expose?: string[] | undefined;
|
|
56
|
+
serverPrefetch?: (() => void | Promise<any>) | undefined;
|
|
57
|
+
compilerOptions?: {
|
|
58
|
+
isCustomElement?: ((tag: string) => boolean) | undefined;
|
|
59
|
+
whitespace?: "preserve" | "condense" | undefined;
|
|
60
|
+
comments?: boolean | undefined;
|
|
61
|
+
delimiters?: [string, string] | undefined;
|
|
62
|
+
} | undefined;
|
|
63
|
+
call?: ((this: unknown, ...args: unknown[]) => never) | undefined;
|
|
64
|
+
__isFragment?: never | undefined;
|
|
65
|
+
__isTeleport?: never | undefined;
|
|
66
|
+
__isSuspense?: never | undefined;
|
|
67
|
+
__defaults?: {} | undefined;
|
|
68
|
+
compatConfig?: {
|
|
69
|
+
GLOBAL_MOUNT?: boolean | "suppress-warning" | undefined;
|
|
70
|
+
GLOBAL_MOUNT_CONTAINER?: boolean | "suppress-warning" | undefined;
|
|
71
|
+
GLOBAL_EXTEND?: boolean | "suppress-warning" | undefined;
|
|
72
|
+
GLOBAL_PROTOTYPE?: boolean | "suppress-warning" | undefined;
|
|
73
|
+
GLOBAL_SET?: boolean | "suppress-warning" | undefined;
|
|
74
|
+
GLOBAL_DELETE?: boolean | "suppress-warning" | undefined;
|
|
75
|
+
GLOBAL_OBSERVABLE?: boolean | "suppress-warning" | undefined;
|
|
76
|
+
GLOBAL_PRIVATE_UTIL?: boolean | "suppress-warning" | undefined;
|
|
77
|
+
CONFIG_SILENT?: boolean | "suppress-warning" | undefined;
|
|
78
|
+
CONFIG_DEVTOOLS?: boolean | "suppress-warning" | undefined;
|
|
79
|
+
CONFIG_KEY_CODES?: boolean | "suppress-warning" | undefined;
|
|
80
|
+
CONFIG_PRODUCTION_TIP?: boolean | "suppress-warning" | undefined;
|
|
81
|
+
CONFIG_IGNORED_ELEMENTS?: boolean | "suppress-warning" | undefined;
|
|
82
|
+
CONFIG_WHITESPACE?: boolean | "suppress-warning" | undefined;
|
|
83
|
+
CONFIG_OPTION_MERGE_STRATS?: boolean | "suppress-warning" | undefined;
|
|
84
|
+
INSTANCE_SET?: boolean | "suppress-warning" | undefined;
|
|
85
|
+
INSTANCE_DELETE?: boolean | "suppress-warning" | undefined;
|
|
86
|
+
INSTANCE_DESTROY?: boolean | "suppress-warning" | undefined;
|
|
87
|
+
INSTANCE_EVENT_EMITTER?: boolean | "suppress-warning" | undefined;
|
|
88
|
+
INSTANCE_EVENT_HOOKS?: boolean | "suppress-warning" | undefined;
|
|
89
|
+
INSTANCE_CHILDREN?: boolean | "suppress-warning" | undefined;
|
|
90
|
+
INSTANCE_LISTENERS?: boolean | "suppress-warning" | undefined;
|
|
91
|
+
INSTANCE_SCOPED_SLOTS?: boolean | "suppress-warning" | undefined;
|
|
92
|
+
INSTANCE_ATTRS_CLASS_STYLE?: boolean | "suppress-warning" | undefined;
|
|
93
|
+
OPTIONS_DATA_FN?: boolean | "suppress-warning" | undefined;
|
|
94
|
+
OPTIONS_DATA_MERGE?: boolean | "suppress-warning" | undefined;
|
|
95
|
+
OPTIONS_BEFORE_DESTROY?: boolean | "suppress-warning" | undefined;
|
|
96
|
+
OPTIONS_DESTROYED?: boolean | "suppress-warning" | undefined;
|
|
97
|
+
WATCH_ARRAY?: boolean | "suppress-warning" | undefined;
|
|
98
|
+
PROPS_DEFAULT_THIS?: boolean | "suppress-warning" | undefined;
|
|
99
|
+
V_ON_KEYCODE_MODIFIER?: boolean | "suppress-warning" | undefined;
|
|
100
|
+
CUSTOM_DIR?: boolean | "suppress-warning" | undefined;
|
|
101
|
+
ATTR_FALSE_VALUE?: boolean | "suppress-warning" | undefined;
|
|
102
|
+
ATTR_ENUMERATED_COERCION?: boolean | "suppress-warning" | undefined;
|
|
103
|
+
TRANSITION_CLASSES?: boolean | "suppress-warning" | undefined;
|
|
104
|
+
TRANSITION_GROUP_ROOT?: boolean | "suppress-warning" | undefined;
|
|
105
|
+
COMPONENT_ASYNC?: boolean | "suppress-warning" | undefined;
|
|
106
|
+
COMPONENT_FUNCTIONAL?: boolean | "suppress-warning" | undefined;
|
|
107
|
+
COMPONENT_V_MODEL?: boolean | "suppress-warning" | undefined;
|
|
108
|
+
RENDER_FUNCTION?: boolean | "suppress-warning" | undefined;
|
|
109
|
+
FILTERS?: boolean | "suppress-warning" | undefined;
|
|
110
|
+
PRIVATE_APIS?: boolean | "suppress-warning" | undefined;
|
|
111
|
+
MODE?: 2 | 3 | ((comp: import('vue').Component | null) => 2 | 3) | undefined;
|
|
112
|
+
} | undefined;
|
|
113
|
+
data?: ((this: any, vm: any) => any) | undefined;
|
|
114
|
+
computed?: import('vue').ComputedOptions | undefined;
|
|
115
|
+
methods?: import('vue').MethodOptions | undefined;
|
|
116
|
+
watch?: {
|
|
117
|
+
[x: string]: (string | import('vue').WatchCallback | ({
|
|
118
|
+
handler: import('vue').WatchCallback | string;
|
|
119
|
+
} & import('vue').WatchOptions<boolean>)) | (string | import('vue').WatchCallback | ({
|
|
120
|
+
handler: import('vue').WatchCallback | string;
|
|
121
|
+
} & import('vue').WatchOptions<boolean>))[];
|
|
122
|
+
} | undefined;
|
|
123
|
+
provide?: import('vue').ComponentProvideOptions | undefined;
|
|
124
|
+
inject?: {} | string[] | undefined;
|
|
125
|
+
filters?: Record<string, Function> | undefined;
|
|
126
|
+
mixins?: any[] | undefined;
|
|
127
|
+
extends?: any;
|
|
128
|
+
beforeCreate?: (() => any) | undefined;
|
|
129
|
+
created?: (() => any) | undefined;
|
|
130
|
+
beforeMount?: (() => any) | undefined;
|
|
131
|
+
mounted?: (() => any) | undefined;
|
|
132
|
+
beforeUpdate?: (() => any) | undefined;
|
|
133
|
+
updated?: (() => any) | undefined;
|
|
134
|
+
activated?: (() => any) | undefined;
|
|
135
|
+
deactivated?: (() => any) | undefined;
|
|
136
|
+
beforeDestroy?: (() => any) | undefined;
|
|
137
|
+
beforeUnmount?: (() => any) | undefined;
|
|
138
|
+
destroyed?: (() => any) | undefined;
|
|
139
|
+
unmounted?: (() => any) | undefined;
|
|
140
|
+
renderTracked?: ((e: import('vue').DebuggerEvent) => void) | undefined;
|
|
141
|
+
renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | undefined;
|
|
142
|
+
errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | undefined;
|
|
143
|
+
delimiters?: [string, string] | undefined;
|
|
144
|
+
__differentiator?: string | number | symbol | undefined;
|
|
145
|
+
__isBuiltIn?: boolean | undefined;
|
|
146
|
+
__file?: string | undefined;
|
|
147
|
+
__name?: string | undefined;
|
|
148
|
+
} | undefined;
|
|
149
|
+
hideIcon?: boolean | undefined;
|
|
150
|
+
action?: {
|
|
151
|
+
label: string;
|
|
152
|
+
onClick?: ((close: () => void) => void) | undefined;
|
|
153
|
+
keepOpen?: boolean | undefined;
|
|
154
|
+
} | undefined;
|
|
155
|
+
radius?: "none" | "small" | "medium" | "large" | "full" | undefined;
|
|
156
|
+
placement?: import('..').ToastPlacement | undefined;
|
|
157
|
+
pushedAt: number;
|
|
158
|
+
duration: number;
|
|
159
|
+
dismissable: boolean;
|
|
160
|
+
pauseOnHover: boolean;
|
|
161
|
+
}[];
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Public composable. Returns the imperative API. Stable identity — the
|
|
165
|
+
* returned object can safely be destructured at module scope.
|
|
166
|
+
*/
|
|
167
|
+
export declare function useToast(): {
|
|
168
|
+
push: typeof push;
|
|
169
|
+
dismiss: typeof dismiss;
|
|
170
|
+
dismissAll: typeof dismissAll;
|
|
171
|
+
info: typeof info;
|
|
172
|
+
success: typeof success;
|
|
173
|
+
warning: typeof warning;
|
|
174
|
+
danger: typeof danger;
|
|
175
|
+
};
|
|
176
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { InjectionKey, Ref } from 'vue';
|
|
2
|
+
import { ModoPalette } from './palettes';
|
|
3
|
+
export type ModoColor = 'default' | 'primary' | 'danger' | 'success' | 'warning';
|
|
4
|
+
export type ModoRadius = 'none' | 'small' | 'medium' | 'large' | 'full';
|
|
5
|
+
/**
|
|
6
|
+
* Global size scale. Components that share this scale (Button, Input,
|
|
7
|
+
* Select, Tabs…) inherit it from `ModoProvider`. Components with a
|
|
8
|
+
* larger scale (e.g. Avatar's `xs`/`xl`) keep their own values; this only
|
|
9
|
+
* cascades the canonical `small` | `medium` | `large` triplet.
|
|
10
|
+
*/
|
|
11
|
+
export type ModoSize = 'small' | 'medium' | 'large';
|
|
12
|
+
export type ModoTheme = 'light' | 'dark' | 'system';
|
|
13
|
+
/**
|
|
14
|
+
* Estilo del halo (ring persistente) en campos de formulario.
|
|
15
|
+
* - `tinted` — idle gris tenue → hover/focus tintado al color del campo.
|
|
16
|
+
* - `neutral` — idle + hover/focus siempre neutros (gris). Más discreto.
|
|
17
|
+
* - `off` — sin halo persistente; solo focus-visible ring para a11y.
|
|
18
|
+
*/
|
|
19
|
+
export type ModoHalo = 'tinted' | 'neutral' | 'off';
|
|
20
|
+
export interface ModoConfig {
|
|
21
|
+
color: ModoColor;
|
|
22
|
+
radius: ModoRadius;
|
|
23
|
+
size: ModoSize;
|
|
24
|
+
theme: ModoTheme;
|
|
25
|
+
halo: ModoHalo;
|
|
26
|
+
palettes: {
|
|
27
|
+
default: ModoPalette;
|
|
28
|
+
primary: ModoPalette;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export declare const MODO_CONFIG: InjectionKey<Ref<ModoConfig>>;
|
|
32
|
+
export declare const defaultModoConfig: ModoConfig;
|