@kahitsan/ksui 0.10.2 → 0.12.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/host-ui.d.ts DELETED
@@ -1,145 +0,0 @@
1
- // CANONICAL SDK type defs for the host UI kit (window.__KSERP_UI__, externalized
2
- // as "@kserp/host-ui"). This ships in @kahitsan/ksui and is the single
3
- // source of truth. Every plugin (ours, and any third-party with no kernel
4
- // source) gets it from the installed package via
5
- // `/// <reference types="@kahitsan/ksui/host-ui" />`; there are no more
6
- // per-plugin copies to drift. The host owns the runtime: its remote loader
7
- // (kserp src/lib/remote-loader.ts) populates the global from the host's kit
8
- // barrel (kserp src/lib/host-ui.tsx) before loading any remote. Keep this in sync
9
- // with that barrel. Every member here must be exported there, and vice versa.
10
- declare module "@kserp/host-ui" {
11
- import type { JSX, Accessor } from "solid-js";
12
-
13
- // --- Shared table types (mirror src/components/ui/DataTable/DataTable.tsx) ---
14
- export interface DataTableRow {
15
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
- [key: string]: any;
17
- }
18
- export interface DataTableColumn<T extends DataTableRow> {
19
- data: (keyof T & string) | null;
20
- title?: string;
21
- render?: (
22
- data: T[keyof T] | null,
23
- type: "display",
24
- row: T,
25
- meta: { row: number; col: number; search: string },
26
- ) => JSX.Element | string;
27
- orderable?: boolean;
28
- className?: string;
29
- }
30
- export interface FetchResult<T> {
31
- data: T[];
32
- total: number;
33
- }
34
- export interface FetchParams {
35
- page: number;
36
- limit: number;
37
- search: string;
38
- sortBy: string | null;
39
- sortDir: "asc" | "desc";
40
- dateFilter: string | null;
41
- dateFrom?: string | null;
42
- dateTo?: string | null;
43
- }
44
-
45
- export interface DataTableProps<T extends DataTableRow> {
46
- columns?: DataTableColumn<T>[];
47
- /**
48
- * Generic data fetcher. When provided, the table runs in server-side mode.
49
- * Optional: omit it and pass `data` for client-side mode.
50
- */
51
- fetchFn?: (params: FetchParams) => Promise<FetchResult<T>>;
52
- /** Static data (client-side mode). Ignored when `fetchFn` is set. */
53
- data?: T[];
54
- /**
55
- * Expose the table's refetch handle to the parent. The callback receives
56
- * `{ refetch, resetAndRefetch }`: `refetch()` re-fetches with the current
57
- * state; `resetAndRefetch()` resets pagination to page 1 (clearing loadMore
58
- * accumulators) before fetching.
59
- */
60
- onRefetch?: (api: { refetch: () => void; resetAndRefetch: () => void }) => void;
61
- // Remaining props are passed through; kept permissive so plugins can use the
62
- // full surface of the host component without re-declaring it here.
63
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
64
- [key: string]: any;
65
- }
66
- export function DataTable<T extends DataTableRow>(props: DataTableProps<T>): JSX.Element;
67
-
68
- // --- DatePicker ---
69
- export interface DateRangeValue {
70
- start: string | null;
71
- end: string | null;
72
- }
73
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
74
- export function DatePicker(props: any): JSX.Element;
75
-
76
- // --- Modal ---
77
- // The Modal is mounted/unmounted by the caller (wrap it in <Show when={open}>);
78
- // there is no `open` prop. onClose fires on Escape / backdrop / dismissal.
79
- export type ModalSize = "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "5xl" | "7xl";
80
- export type ModalTone = "default" | "danger";
81
- export interface ModalProps {
82
- onClose: () => void;
83
- dismissable?: boolean;
84
- variant?: "default" | "sheet";
85
- size?: ModalSize;
86
- tone?: ModalTone;
87
- ariaLabel?: string;
88
- children: JSX.Element;
89
- }
90
- export function Modal(props: ModalProps): JSX.Element;
91
-
92
- // --- SearchableSelect ---
93
- export interface SearchableOption {
94
- value: string;
95
- label: string;
96
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
97
- [key: string]: any;
98
- }
99
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
100
- export function SearchableSelect(props: any): JSX.Element;
101
-
102
- // --- Other components (permissive: full prop surface lives in the host) ---
103
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
104
- export const Button: (props: any) => JSX.Element;
105
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
106
- export const PageShell: (props: any) => JSX.Element;
107
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
108
- export const PageTitle: (props: any) => JSX.Element;
109
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
110
- export const PageShareButton: (props: any) => JSX.Element;
111
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
112
- export const Avatar: (props: any) => JSX.Element;
113
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
114
- export const PluginPageLoader: (props: any) => JSX.Element;
115
-
116
- // --- Confirm ---
117
- export function confirm(opts: {
118
- title?: string;
119
- message?: string;
120
- confirmLabel?: string;
121
- cancelLabel?: string;
122
- danger?: boolean;
123
- }): Promise<boolean>;
124
-
125
- // --- Host hooks (run on the host's Solid runtime + context providers) ---
126
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
127
- export function useActiveWorkspace(): any;
128
- export function useCan(code: string): Accessor<boolean>;
129
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
130
- export function usePermissions(): any;
131
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
132
- export function PermissionGate(props: any): JSX.Element;
133
-
134
- // --- Helpers ---
135
- export function highlightMatch(text: string, query: string, markClass?: string): JSX.Element;
136
- export function HighlightedText(props: {
137
- text: string;
138
- query: string;
139
- markClass?: string;
140
- }): JSX.Element;
141
- export function matchesQuery(text: string | null | undefined, query: string): boolean;
142
- export function matchesAny(query: string, ...fields: (string | null | undefined)[]): boolean;
143
- export function useFocusTrap(el: HTMLElement | undefined): () => void;
144
- export function autoFocusOnMount(el: HTMLElement | undefined): void;
145
- }