@qodalis/console-kit 0.0.0-stage → 1.0.0-beta.33

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 (60) hide show
  1. package/README.md +251 -2
  2. package/dist/components/Badge.d.ts +14 -0
  3. package/dist/components/ButtonGroup.d.ts +35 -0
  4. package/dist/components/ChipList.d.ts +53 -0
  5. package/dist/components/ConfirmDialog.d.ts +28 -0
  6. package/dist/components/DataTable.d.ts +29 -0
  7. package/dist/components/DropdownMenu.d.ts +32 -0
  8. package/dist/components/ErrorBoundary.d.ts +29 -0
  9. package/dist/components/Modal.d.ts +30 -0
  10. package/dist/components/MonoPanel.d.ts +9 -0
  11. package/dist/components/PageHeader.d.ts +7 -0
  12. package/dist/components/Pagination.d.ts +11 -0
  13. package/dist/components/Select.d.ts +54 -0
  14. package/dist/components/Skeleton.d.ts +66 -0
  15. package/dist/components/Spinner.d.ts +9 -0
  16. package/dist/components/StatCard.d.ts +9 -0
  17. package/dist/components/States.d.ts +33 -0
  18. package/dist/components/Tooltip.d.ts +24 -0
  19. package/dist/components/actionIcons.d.ts +6 -0
  20. package/dist/components/charts/ColumnChart.d.ts +37 -0
  21. package/dist/components/charts/LineChart.d.ts +28 -0
  22. package/dist/components/charts/chartParts.d.ts +31 -0
  23. package/dist/components/charts/chartUtils.d.ts +14 -0
  24. package/dist/components/componentText.d.ts +3 -0
  25. package/dist/components/drawerGestures.d.ts +15 -0
  26. package/dist/components/errorText.d.ts +31 -0
  27. package/dist/components/overlay.d.ts +51 -0
  28. package/dist/components/paging.d.ts +16 -0
  29. package/dist/components/sortRows.d.ts +10 -0
  30. package/dist/components/useConfirm.d.ts +18 -0
  31. package/dist/extension/ExtensionLink.d.ts +10 -0
  32. package/dist/extension/defineExtension.d.ts +96 -0
  33. package/dist/extension/serverPlugin.d.ts +18 -0
  34. package/dist/extension/serverPluginApi.d.ts +42 -0
  35. package/dist/extension/types.d.ts +247 -0
  36. package/dist/extension/useQueryParams.d.ts +5 -0
  37. package/dist/format.d.ts +4 -0
  38. package/dist/hooks/liveReload.d.ts +28 -0
  39. package/dist/hooks/useAsync.d.ts +10 -0
  40. package/dist/hooks/usePaging.d.ts +10 -0
  41. package/dist/hooks/useStoredState.d.ts +9 -0
  42. package/dist/i18n/locales.d.ts +60 -0
  43. package/dist/i18n/messages.d.ts +3 -0
  44. package/dist/i18n/text.d.ts +21 -0
  45. package/dist/i18n/translations.d.ts +32 -0
  46. package/dist/index.d.ts +64 -0
  47. package/dist/index.js +2735 -0
  48. package/dist/index.js.map +1 -0
  49. package/dist/styles.css +1 -0
  50. package/dist/tailwind-preset.js +35 -0
  51. package/dist/tailwind-preset.js.map +1 -0
  52. package/dist/testing.d.ts +35 -0
  53. package/dist/testing.js +70 -0
  54. package/dist/testing.js.map +1 -0
  55. package/dist/theme/tagColors.d.ts +27 -0
  56. package/dist/theme/tailwind-preset.d.ts +46 -0
  57. package/dist/theme/tokens.d.ts +33 -0
  58. package/dist/tokens-3WNFc3gU.js +82 -0
  59. package/dist/tokens-3WNFc3gU.js.map +1 -0
  60. package/package.json +59 -4
@@ -0,0 +1,247 @@
1
+ /** An extension as the server lists it (`GET /api/v1/qcli/dashboard/extensions`, see docs/extensions.md). */
2
+ export interface ConsoleExtensionInfo {
3
+ id: string;
4
+ title: string;
5
+ titles?: Record<string, string>;
6
+ icon?: string;
7
+ /** Sidebar section (`overview`, `operations`, `data`, `access`, `system`), or `account`: the account menu. */
8
+ group?: string;
9
+ order?: number;
10
+ permission?: string;
11
+ entry: string;
12
+ styles?: string[];
13
+ version?: string;
14
+ /**
15
+ * Slots the module fills besides its page: `overview` (cards and attention items on the Console's Overview),
16
+ * `palette` (entries in the command palette).
17
+ */
18
+ widgets?: string[];
19
+ /**
20
+ * Where the module searches, below its page, ending where the text goes (e.g. `/?q=`): the command palette offers
21
+ * "Search <title> for …".
22
+ */
23
+ search?: string;
24
+ /**
25
+ * `marketplace`: installed at runtime from the marketplace (its settings are the `dashboard-plugins` config
26
+ * provider's section with the extension's id); absent for the server's built-in extensions.
27
+ */
28
+ source?: string;
29
+ /** The npm package of a marketplace extension (`@acme/dashboard-kanban`); its settings are read with it. */
30
+ package?: string;
31
+ }
32
+ /** The types a marketplace plugin's setting may have (no `secret`: a plugin running in the browser cannot keep one). */
33
+ export type ConsolePluginConfigType = 'string' | 'number' | 'boolean' | 'string[]' | 'enum' | 'json' | 'duration' | 'url';
34
+ /** A setting's value as JSON gives it. */
35
+ export type ConsolePluginConfigValue = string | number | boolean | string[] | null | unknown[] | {
36
+ [key: string]: unknown;
37
+ };
38
+ /**
39
+ * A setting a marketplace plugin declares in its package.json (`qodalis.config.entries`), with the config providers'
40
+ * entry model: the server makes it an entry of the `dashboard-plugins` provider's section for the plugin.
41
+ */
42
+ export interface ConsolePluginConfigEntry {
43
+ /** `^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$`. */
44
+ key: string;
45
+ label?: string;
46
+ description?: string;
47
+ type: ConsolePluginConfigType;
48
+ /** Must satisfy its own validation. */
49
+ default: ConsolePluginConfigValue;
50
+ validation?: {
51
+ /** Numbers: the smallest value; strings: the shortest length; lists: the fewest items; durations: milliseconds. */
52
+ min?: number;
53
+ max?: number;
54
+ pattern?: string;
55
+ /** `enum`: the choices; `string`, `string[]`: the allowed values. */
56
+ options?: string[];
57
+ required?: boolean;
58
+ };
59
+ }
60
+ /** `qodalis.config` of a Console plugin's package.json: at most 50 entries, 32 KB of JSON. */
61
+ export interface ConsolePluginConfig {
62
+ entries: ConsolePluginConfigEntry[];
63
+ }
64
+ /** A marketplace plugin's settings as it reads them: its stored values over the defaults, by key. */
65
+ export type ConsoleExtensionConfig = Record<string, ConsolePluginConfigValue>;
66
+ export type ConsoleTheme = 'light' | 'dark';
67
+ /** What the Console gives an extension when it mounts it (context API version 1). */
68
+ export interface ConsoleExtensionContext {
69
+ /** The extension's own registration. */
70
+ extension: ConsoleExtensionInfo;
71
+ /** The server's API base, e.g. `https://host` or `https://host/prefix` (no trailing slash). */
72
+ apiBase: string;
73
+ /**
74
+ * fetch against the server: a path (`/api/v1/qcli/...`) is resolved against `apiBase`, with the
75
+ * Console's credentials and JSON headers; a 401 signs the user out as the Console's own requests do, unless
76
+ * `quiet` (an optional request the user may not be allowed: its 401 is just an answer).
77
+ */
78
+ fetch(path: string, init?: RequestInit & {
79
+ quiet?: boolean;
80
+ }): Promise<Response>;
81
+ user: {
82
+ id: string;
83
+ name: string;
84
+ email?: string;
85
+ };
86
+ permissions: string[];
87
+ /** Wildcard-aware, the same matcher the Console uses. */
88
+ hasPermission(permission: string): boolean;
89
+ theme: ConsoleTheme;
90
+ onThemeChange(listener: (theme: ConsoleTheme) => void): () => void;
91
+ language: string;
92
+ onLanguageChange(listener: (language: string) => void): () => void;
93
+ /** The extension's own routing below `/x/<id>`: e.g. `/` or `/plugins/abc?tab=log`. */
94
+ path: string;
95
+ navigate(path: string, options?: {
96
+ replace?: boolean;
97
+ }): void;
98
+ onPathChange(listener: (path: string) => void): () => void;
99
+ /**
100
+ * Server events (`/ws/v1/qcli/events`, the Console's own socket): `pattern` is a type (`databases:migration-run`), a
101
+ * prefix (`job:*`) or `*`. The event is the message as the server sent it (`{ type, ... }`). Returns the
102
+ * unsubscribe function.
103
+ */
104
+ /**
105
+ * A marketplace plugin's settings (`qodalis.config` of its package.json): the stored values over the defaults,
106
+ * read before the plugin mounts. `undefined` for built-in extensions, and on Consoles before settings. When the
107
+ * Console could not read them, `{}`: use your own defaults (`config.refreshSeconds ?? 30`).
108
+ */
109
+ config?: ConsoleExtensionConfig;
110
+ /**
111
+ * Calls `listener` with the new settings each time someone changes them (Config page, `config set`), live. Returns
112
+ * the unsubscribe function. Absent on Consoles before settings; never called for built-in extensions.
113
+ */
114
+ onConfigChange?(listener: (config: ConsoleExtensionConfig) => void): () => void;
115
+ onServerEvent(pattern: string, listener: (event: Record<string, unknown>) => void): () => void;
116
+ notify(message: string, kind?: 'success' | 'error' | 'info'): void;
117
+ confirm(options: {
118
+ title: string;
119
+ message?: string;
120
+ confirmText?: string;
121
+ danger?: boolean;
122
+ }): Promise<boolean>;
123
+ /** The Console's version (e.g. `1.0.0-beta.33`). */
124
+ consoleVersion: string;
125
+ /** @deprecated Use `consoleVersion` (same value; kept because bundles built against the old kit read it). */
126
+ dashboardVersion: string;
127
+ apiVersion: 1;
128
+ }
129
+ /** Renders into `element` with the Console's context; returns a cleanup function, or nothing. */
130
+ export type ConsoleMount = (element: HTMLElement, context: ConsoleExtensionContext) => void | (() => void) | Promise<void | (() => void)>;
131
+ /**
132
+ * Where an Overview card goes: `stat` in the row of figures at the top (a `StatCard`), `half` beside another half
133
+ * card, `full` across the page.
134
+ */
135
+ export type OverviewCardSize = 'stat' | 'half' | 'full';
136
+ /** A card a module adds to the Console's Overview. Its context's `navigate` opens the module's page. */
137
+ export interface OverviewCard {
138
+ /** Unique within the module. */
139
+ id: string;
140
+ size: OverviewCardSize;
141
+ mount: ConsoleMount;
142
+ }
143
+ /** Something on the Overview's "Needs attention" list (a failing job, a database with problems). */
144
+ export interface AttentionItem {
145
+ /** Unique within the module. */
146
+ id: string;
147
+ level: 'error' | 'warning';
148
+ title: string;
149
+ detail?: string;
150
+ /** When it happened (ISO): newest first in the list. */
151
+ time?: string;
152
+ /** Below the module's page (`/x/<id><path>`), opened on click. */
153
+ path?: string;
154
+ }
155
+ /** What a module shows on the Overview (registered with `widgets: ["overview"]`). */
156
+ export interface ConsoleOverview {
157
+ cards?: OverviewCard[];
158
+ /** The module's items for "Needs attention"; asked when the Overview opens and again every minute. */
159
+ attention?(context: ConsoleExtensionContext): Promise<AttentionItem[]>;
160
+ }
161
+ /** An entry a module adds to the command palette (Ctrl+K), listed under its title. */
162
+ export interface PaletteEntry {
163
+ /** Unique within the module. */
164
+ id: string;
165
+ label: string;
166
+ /** Shown after the label, also searched (an id, a group). */
167
+ hint?: string;
168
+ icon?: string;
169
+ /** Below the module's page (`/x/<id><path>`). */
170
+ path: string;
171
+ }
172
+ /** An entry of the Console's Config page, as a config editor sees it (the server's config provider entry). */
173
+ export interface ConfigEditorEntry {
174
+ key: string;
175
+ label: string;
176
+ description: string;
177
+ /** `string`, `number`, `boolean`, `string[]`, `enum`, `secret`, `json`, `duration` or `url`. */
178
+ type: string;
179
+ /** The editor hint the entry asked for (`cron`, `origins`, ...). */
180
+ editor?: string;
181
+ default: unknown;
182
+ validation?: {
183
+ min?: number;
184
+ max?: number;
185
+ pattern?: string;
186
+ options?: string[];
187
+ required?: boolean;
188
+ };
189
+ }
190
+ /** What a config editor renders: the entry, the value being edited, and where to report a new one. */
191
+ export interface ConfigEditorProps {
192
+ entry: ConfigEditorEntry;
193
+ /** The value being edited (the saved value until the user changes it). */
194
+ value: unknown;
195
+ /** Reports the new value; the page validates it with the entry's rules and shows it in the diff before saving. */
196
+ onChange(value: unknown): void;
197
+ /** Read-only entry, or the page is saving. */
198
+ disabled: boolean;
199
+ /** The page's message for the current value (a validation or server error), if any. */
200
+ error?: string;
201
+ }
202
+ /** A mounted config editor: `update` gets new props on every change, `unmount` removes it. */
203
+ export interface ConfigEditorHandle {
204
+ update(props: ConfigEditorProps): void;
205
+ unmount?(): void;
206
+ }
207
+ /**
208
+ * Renders an input for config entries with one `editor` hint into `element` (Config page, a module registered with
209
+ * `widgets: ["config"]`).
210
+ */
211
+ export type ConfigEditorMount = (element: HTMLElement, props: ConfigEditorProps, context: ConsoleExtensionContext) => ConfigEditorHandle | void;
212
+ /** The module an extension's entry exports (default export, or a named `extension`). */
213
+ export interface ConsoleExtension {
214
+ /** Renders the page into `element`; returns a cleanup function, or nothing. */
215
+ mount: ConsoleMount;
216
+ /** Cards and attention items for the Console's Overview (registered with `widgets: ["overview"]`). */
217
+ overview?: ConsoleOverview;
218
+ /** Entries for the command palette, asked each time it opens (registered with `widgets: ["palette"]`). */
219
+ palette?(context: ConsoleExtensionContext): Promise<PaletteEntry[]>;
220
+ /**
221
+ * Inputs for the Config page by `editor` hint (`{ cron: mountCronEditor }`), used for every entry with that hint
222
+ * (registered with `widgets: ["config"]`).
223
+ */
224
+ configEditors?: Record<string, ConfigEditorMount>;
225
+ }
226
+ /** @deprecated Use {@link ConsoleExtensionInfo}. */
227
+ export type DashboardExtensionInfo = ConsoleExtensionInfo;
228
+ /** @deprecated Use {@link ConsolePluginConfigType}. */
229
+ export type DashboardPluginConfigType = ConsolePluginConfigType;
230
+ /** @deprecated Use {@link ConsolePluginConfigValue}. */
231
+ export type DashboardPluginConfigValue = ConsolePluginConfigValue;
232
+ /** @deprecated Use {@link ConsolePluginConfigEntry}. */
233
+ export type DashboardPluginConfigEntry = ConsolePluginConfigEntry;
234
+ /** @deprecated Use {@link ConsolePluginConfig}. */
235
+ export type DashboardPluginConfig = ConsolePluginConfig;
236
+ /** @deprecated Use {@link ConsoleExtensionConfig}. */
237
+ export type DashboardExtensionConfig = ConsoleExtensionConfig;
238
+ /** @deprecated Use {@link ConsoleTheme}. */
239
+ export type DashboardTheme = ConsoleTheme;
240
+ /** @deprecated Use {@link ConsoleExtensionContext}. */
241
+ export type DashboardExtensionContext = ConsoleExtensionContext;
242
+ /** @deprecated Use {@link ConsoleMount}. */
243
+ export type DashboardMount = ConsoleMount;
244
+ /** @deprecated Use {@link ConsoleOverview}. */
245
+ export type DashboardOverview = ConsoleOverview;
246
+ /** @deprecated Use {@link ConsoleExtension}. */
247
+ export type DashboardExtension = ConsoleExtension;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * The query of the page's own path (`/?event=login&range=24h`) and a setter that replaces it, like react-router's
3
+ * `useSearchParams` but on the Console's context: the URL keeps the filters, so a link or a reload shows the same list.
4
+ */
5
+ export declare function useQueryParams(): [URLSearchParams, (update: (prev: URLSearchParams) => URLSearchParams) => void];
@@ -0,0 +1,4 @@
1
+ /** 1536 -> `1.5 KB` (binary units, as servers and databases report sizes), with the reader's number format. */
2
+ export declare function formatBytes(bytes: number, formatNumber?: (value: number, options?: Intl.NumberFormatOptions) => string): string;
3
+ /** A duration in short form: `850ms`, `4.2s`, `12s`, `3m 5s`, `2h 14m`; `—` when unknown. */
4
+ export declare function shortDuration(ms: number | null | undefined): string;
@@ -0,0 +1,28 @@
1
+ export type ServerEvent = Record<string, unknown>;
2
+ /** Several events together cause one reload. */
3
+ export declare const LIVE_RELOAD_DELAY = 1500;
4
+ /**
5
+ * For a job's own state (status, the runs going now): a run of a few hundred milliseconds must still show as running,
6
+ * which a 1.5 s wait would miss. Bursts still make one reload.
7
+ */
8
+ export declare const JOB_STATE_RELOAD_DELAY = 250;
9
+ /** Server event patterns: `*` matches every type, `ns:*` every type starting with `ns:`, anything else one type. */
10
+ export declare function matchesEventPattern(type: string, pattern: string): boolean;
11
+ export interface LiveReloadOptions {
12
+ /** Only events it accepts cause a reload. */
13
+ filter?: (event: ServerEvent) => boolean;
14
+ /**
15
+ * While true, events are only remembered (e.g. a form is open, or the user paged away from the newest entries);
16
+ * the reload runs once it turns false.
17
+ */
18
+ paused?: boolean;
19
+ delay?: number;
20
+ }
21
+ /** Subscribes `listener` to server events matching `pattern`; returns the unsubscribe function. */
22
+ export type ServerEventSubscribe = (pattern: string, listener: (event: ServerEvent) => void) => () => void;
23
+ /**
24
+ * Calls `reload` shortly after server events of the given types (`job:*`, `fs:changed`, …) from `subscribe`: a burst
25
+ * of events causes one reload, `delay` ms after the last of them. `reload` and `filter` may change on every render.
26
+ * Inside an extension, `useLiveReload` does this with the Console's events.
27
+ */
28
+ export declare function useLiveReloadFrom(subscribe: ServerEventSubscribe, patterns: string | readonly string[], reload: () => void, options?: LiveReloadOptions): void;
@@ -0,0 +1,10 @@
1
+ export interface AsyncResult<T> {
2
+ data: T | null;
3
+ loading: boolean;
4
+ error: string | null;
5
+ refetch: () => void;
6
+ /** Fetches again without showing the loading state: the current data stays until the new data replaces it. */
7
+ refresh: () => void;
8
+ }
9
+ /** Runs `fetcher` now and whenever `deps` change: its data, loading and error, with `refetch` and a quiet `refresh`. */
10
+ export declare function useAsync<T>(fetcher: () => Promise<T>, deps?: unknown[]): AsyncResult<T>;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * A list's page (0-based) and page size. The size is remembered per viewer under `storageKey`; the page goes back
3
+ * to the first whenever `resetKey` changes (new filters, a new range).
4
+ */
5
+ export declare function usePaging(storageKey: string, resetKey: string): {
6
+ page: number;
7
+ setPage: import("react").Dispatch<import("react").SetStateAction<number>>;
8
+ pageSize: number;
9
+ setPageSize: (size: number) => void;
10
+ };
@@ -0,0 +1,9 @@
1
+ /** The stored value of `key`, or null when there is none or storage is unavailable (private mode, blocked). */
2
+ export declare function readStored(key: string): string | null;
3
+ /** Stores the value; does nothing when storage is unavailable. */
4
+ export declare function writeStored(key: string, value: string): void;
5
+ /**
6
+ * State remembered per viewer in localStorage: `parse` turns the stored text into a value (null: ignore it and use
7
+ * `fallback`), `String(value)` is what is stored.
8
+ */
9
+ export declare function useStoredState<T extends string | number | boolean>(key: string, parse: (stored: string) => T | null, fallback: () => T): readonly [T, (next: T) => void];
@@ -0,0 +1,60 @@
1
+ /** Supported UI languages (same set as the CLI). `en` is the source language. */
2
+ export declare const LOCALES: readonly [{
3
+ readonly code: "en";
4
+ readonly name: "English";
5
+ }, {
6
+ readonly code: "es";
7
+ readonly name: "Español";
8
+ }, {
9
+ readonly code: "fr";
10
+ readonly name: "Français";
11
+ }, {
12
+ readonly code: "de";
13
+ readonly name: "Deutsch";
14
+ }, {
15
+ readonly code: "pt";
16
+ readonly name: "Português";
17
+ }, {
18
+ readonly code: "it";
19
+ readonly name: "Italiano";
20
+ }, {
21
+ readonly code: "ja";
22
+ readonly name: "日本語";
23
+ }, {
24
+ readonly code: "ko";
25
+ readonly name: "한국어";
26
+ }, {
27
+ readonly code: "zh";
28
+ readonly name: "中文";
29
+ }, {
30
+ readonly code: "ru";
31
+ readonly name: "Русский";
32
+ }, {
33
+ readonly code: "ro";
34
+ readonly name: "Română";
35
+ }];
36
+ export type Locale = (typeof LOCALES)[number]['code'];
37
+ /** CLDR plural categories used as key suffixes: `key_one`, `key_few`, … */
38
+ export type PluralSuffix = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';
39
+ /** Every plural form of keys that are plural in English (`items_one` → `items_few`, `items_many`, …). */
40
+ type PluralForms<K extends string> = K extends `${infer Base}_${PluralSuffix}` ? `${Base}_${PluralSuffix}` : never;
41
+ /** `items_one` / `items_other` → `items` (what callers pass to `t` together with `count`). */
42
+ export type StripPlural<K> = K extends `${infer Base}_${PluralSuffix}` ? Base : K;
43
+ /**
44
+ * Messages of one area for every locale. English is complete and defines the keys; other
45
+ * locales may omit keys (English is used) and may add plural forms English doesn't need
46
+ * (e.g. Russian `_few` / `_many`).
47
+ */
48
+ export type NamespaceMessages<K extends string = string> = {
49
+ en: Record<K, string>;
50
+ } & {
51
+ [L in Exclude<Locale, 'en'>]?: Partial<Record<K | PluralForms<K>, string>>;
52
+ };
53
+ /** Helper so a namespace file is checked against its English keys (inferred from `en` only). */
54
+ export declare function defineMessages<K extends string>(messages: {
55
+ en: Record<K, string>;
56
+ } & {
57
+ [L in Exclude<Locale, 'en'>]?: Partial<Record<NoInfer<K> | PluralForms<NoInfer<K>>, string>>;
58
+ }): NamespaceMessages<K>;
59
+ export declare function isLocale(value: unknown): value is Locale;
60
+ export {};
@@ -0,0 +1,3 @@
1
+ /** Built-in texts of the kit's components (and the Console's `components.*` namespace), in the 10 Console languages. */
2
+ declare const _default: import("./locales").NamespaceMessages<"serverPluginMissing" | "serverPluginMissingHint" | "serverPluginOpen" | "serverPluginFromCode" | "paletteSearchIn" | "autoScrollOn" | "autoScrollOff" | "breadcrumb" | "root" | "paletteOpen" | "paletteTitle" | "palettePlaceholder" | "paletteEmpty" | "palettePages" | "paletteSearchGroup" | "paletteSearchLogs" | "paletteMove" | "paletteOpenItem" | "paletteClose" | "pagination" | "rowsPerPage" | "pageRange" | "previousPage" | "nextPage" | "pageOf" | "selectSearch" | "selectNoMatches" | "selectClear" | "selectMore" | "dialogClose" | "confirmOk" | "confirmCancel" | "confirmBusy" | "moreActions" | "rowActions" | "noData" | "sortBy" | "table" | "pageFailed" | "retry" | "loading" | "loadFailed" | "noAccess" | "noAccessPermission" | "noAccessHint" | "missingPermission" | "sectionFailed" | "thisSection" | "panel" | "chipListMore" | "chipListShowAll" | "chipListTitle" | "chipListSearch" | "chipListMatches">;
3
+ export default _default;
@@ -0,0 +1,21 @@
1
+ import { type ReactNode } from 'react';
2
+ import kitMessages from './messages';
3
+ import { type Locale } from './locales';
4
+ export type KitTextKey = keyof typeof kitMessages.en;
5
+ export type KitTextParams = Record<string, string | number>;
6
+ /**
7
+ * The language of the kit's components (their built-in texts and number formats). The Console
8
+ * passes its own; an extension gets it from its context (`defineExtension` does this). Without a
9
+ * provider the components speak English. An unknown language falls back to English.
10
+ */
11
+ export declare function KitProvider({ locale, children }: {
12
+ locale: string;
13
+ children: ReactNode;
14
+ }): import("react/jsx-runtime").JSX.Element;
15
+ /** The kit's current language. */
16
+ export declare function useKitLocale(): Locale;
17
+ /** The kit's built-in texts and number format in the current language. */
18
+ export declare function useKitText(): {
19
+ t: (key: KitTextKey, params?: KitTextParams) => string;
20
+ formatNumber: (value: number) => string;
21
+ };
@@ -0,0 +1,32 @@
1
+ import type { NamespaceMessages, StripPlural } from './locales';
2
+ /** Every `namespace.key` of a plugin's messages; plural keys without their suffix (`items_one` → `ns.items`). */
3
+ export type TranslationKey<N extends Record<string, NamespaceMessages>> = {
4
+ [K in keyof N]: `${K & string}.${StripPlural<keyof N[K]['en'] & string>}`;
5
+ }[keyof N];
6
+ export type TranslationParams = Record<string, string | number>;
7
+ export interface Translations<K extends string> {
8
+ /** The Console's language (`en`, `de`, …). */
9
+ locale: string;
10
+ /**
11
+ * `namespace.key` in the Console's language, else English, else the key. `{name}` placeholders come from
12
+ * `params`; with a numeric `count`, `key_one` / `key_few` / `key_many` / `key_other` follow the language's
13
+ * plural rules.
14
+ */
15
+ t: (key: K, params?: TranslationParams) => string;
16
+ formatDate: (value: string | number | Date, options?: Intl.DateTimeFormatOptions) => string;
17
+ formatNumber: (value: number, options?: Intl.NumberFormatOptions) => string;
18
+ /** "5 minutes ago" / "in 30 seconds". */
19
+ formatRelative: (value: string | number | Date) => string;
20
+ }
21
+ /**
22
+ * A plugin's own texts, in the Console's language: each plugin ships its messages (one `defineMessages` per
23
+ * namespace) and translates them with this, like the Console does its own.
24
+ *
25
+ * ```ts
26
+ * const messages = { billing: defineMessages({ en: { title: 'Billing' }, de: { title: 'Abrechnung' } }) };
27
+ * const { t } = useTranslations(messages); // t('billing.title')
28
+ * ```
29
+ */
30
+ export declare function useTranslations<N extends Record<string, NamespaceMessages>>(messages: N): Translations<TranslationKey<N>>;
31
+ /** {@link useTranslations} outside React. */
32
+ export declare function createTranslations<N extends Record<string, NamespaceMessages>>(messages: N, locale: string): Translations<TranslationKey<N>>;
@@ -0,0 +1,64 @@
1
+ export { useQueryParams } from './extension/useQueryParams';
2
+ export { ExtensionLink, useExtensionHref } from './extension/ExtensionLink';
3
+ export { MissingServerPlugin, RequireServerPlugin } from './extension/serverPlugin';
4
+ export { isMissingApi, serverPluginMarketplaceHref, watchMissingApi } from './extension/serverPluginApi';
5
+ export type { ServerPluginPackages, ServerPluginRequirement } from './extension/serverPluginApi';
6
+ export { formatBytes, shortDuration } from './format';
7
+ export { tagStyle, tagColorDeclarations } from './theme/tagColors';
8
+ export { defineExtension, mountConfigEditor, useConsole, useDashboard, useApi, useServerEvents, useLiveReload, useExtensionConfig, createApi, ApiError } from './extension/defineExtension';
9
+ export type { ApiCallOptions, ExtensionApi, ExtensionOptions, OverviewCardComponent } from './extension/defineExtension';
10
+ export type { AttentionItem, ConfigEditorEntry, ConfigEditorHandle, ConfigEditorMount, ConfigEditorProps, ConsoleExtension, ConsoleExtensionConfig, ConsoleExtensionContext, ConsoleExtensionInfo, ConsoleMount, ConsoleOverview, ConsolePluginConfig, ConsolePluginConfigEntry, ConsolePluginConfigType, ConsolePluginConfigValue, ConsoleTheme, OverviewCard, OverviewCardSize, PaletteEntry, DashboardExtension, DashboardExtensionConfig, DashboardExtensionContext, DashboardExtensionInfo, DashboardMount, DashboardOverview, DashboardPluginConfig, DashboardPluginConfigEntry, DashboardPluginConfigType, DashboardPluginConfigValue, DashboardTheme, } from './extension/types';
11
+ export { KitProvider, useKitLocale, useKitText } from './i18n/text';
12
+ export type { KitTextKey, KitTextParams } from './i18n/text';
13
+ export { default as kitMessages } from './i18n/messages';
14
+ export { LOCALES, isLocale, defineMessages } from './i18n/locales';
15
+ export { useTranslations, createTranslations } from './i18n/translations';
16
+ export type { TranslationKey, TranslationParams, Translations } from './i18n/translations';
17
+ export type { Locale, NamespaceMessages, PluralSuffix, StripPlural } from './i18n/locales';
18
+ export * from './theme/tokens';
19
+ export { default as Badge } from './components/Badge';
20
+ export { default as ButtonGroup } from './components/ButtonGroup';
21
+ export type { ButtonGroupItem, ButtonGroupLabels, ButtonGroupTone } from './components/ButtonGroup';
22
+ export { default as ChipList, CHIP_CLASS } from './components/ChipList';
23
+ export type { ChipListItem, ChipListLinkProps, ChipListProps } from './components/ChipList';
24
+ export { default as ConfirmDialog } from './components/ConfirmDialog';
25
+ export type { ConfirmDialogProps } from './components/ConfirmDialog';
26
+ export { useConfirm } from './components/useConfirm';
27
+ export type { ConfirmOptions } from './components/useConfirm';
28
+ export { default as DataTable } from './components/DataTable';
29
+ export { sortRows } from './components/sortRows';
30
+ export type { SortState, SortValue } from './components/sortRows';
31
+ export { PAGE_SIZES, DEFAULT_PAGE_SIZE, parsePageSize, pageCount, clampPage, pageRange, pageSlice } from './components/paging';
32
+ export { default as Pagination } from './components/Pagination';
33
+ export { default as DropdownMenu, MENU_SEPARATOR } from './components/DropdownMenu';
34
+ export type { DropdownMenuItem } from './components/DropdownMenu';
35
+ export { default as ErrorBoundary } from './components/ErrorBoundary';
36
+ export { default as Modal } from './components/Modal';
37
+ export type { ModalProps, ModalSize } from './components/Modal';
38
+ export { default as MonoPanel } from './components/MonoPanel';
39
+ export { default as PageHeader } from './components/PageHeader';
40
+ export { Select, MultiSelect } from './components/Select';
41
+ export type { SelectOption, SelectProps, MultiSelectProps, SelectSize, SelectWidth } from './components/Select';
42
+ export { default as StatCard } from './components/StatCard';
43
+ export { default as Spinner } from './components/Spinner';
44
+ export { Skeleton, SkeletonGroup, SkeletonText, SkeletonStatCards, SkeletonStatCard, SkeletonTable, SkeletonChartCard, SkeletonList, SkeletonPage, } from './components/Skeleton';
45
+ export { EmptyState, ErrorState, NoAccessState } from './components/States';
46
+ export { accessDenied, errorText, htmlErrorText, httpStatusText, isHtml, responseErrorText, HTTP_REASON_PHRASES } from './components/errorText';
47
+ export { default as Tooltip } from './components/Tooltip';
48
+ export { DetailsIcon, LogsIcon, RunAgainIcon, DeleteIcon, DownloadIcon, RevokeIcon } from './components/actionIcons';
49
+ export { EXTENSION_SCOPE, overlayRoot, scopeOverlays, usePopoverPosition, useDismiss, useBodyScrollLock, useTypeahead, nextEnabled, firstEnabled, lastEnabled, isTypeaheadKey, } from './components/overlay';
50
+ export type { PopoverPosition } from './components/overlay';
51
+ export { focusableIn, trapFocusTarget, SWIPE_CLOSE_DISTANCE, isSwipeLeft } from './components/drawerGestures';
52
+ export { default as LineChart } from './components/charts/LineChart';
53
+ export type { LineSeries } from './components/charts/LineChart';
54
+ export { default as ColumnChart } from './components/charts/ColumnChart';
55
+ export type { Column, ColumnSegment } from './components/charts/ColumnChart';
56
+ export { ChartCard, ChartLegend, ChartTooltip } from './components/charts/chartParts';
57
+ export type { LegendItem, TooltipRow } from './components/charts/chartParts';
58
+ export { niceScale, spreadTicks, useElementWidth } from './components/charts/chartUtils';
59
+ export { useStoredState, readStored, writeStored } from './hooks/useStoredState';
60
+ export { usePaging } from './hooks/usePaging';
61
+ export { useAsync } from './hooks/useAsync';
62
+ export type { AsyncResult } from './hooks/useAsync';
63
+ export { useLiveReloadFrom, matchesEventPattern, LIVE_RELOAD_DELAY, JOB_STATE_RELOAD_DELAY } from './hooks/liveReload';
64
+ export type { ServerEvent, ServerEventSubscribe, LiveReloadOptions } from './hooks/liveReload';