elowen-plugin-ui-kit 0.6.0 → 0.7.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/index.d.ts +79 -4
- package/index.js +1 -1
- package/package.json +1 -1
- package/theme.css +4 -0
package/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type { ComponentType } from 'react';
|
|
|
10
10
|
/** See index.js — bump on incompatible changes to `ElowenUiRuntime`. Deliberately a LITERAL type:
|
|
11
11
|
* the web app re-declares the value and annotates it with `typeof PLUGIN_UI_API_VERSION`, so a kit
|
|
12
12
|
* bump that forgets the host fails the web typecheck instead of drifting silently. */
|
|
13
|
-
export declare const PLUGIN_UI_API_VERSION:
|
|
13
|
+
export declare const PLUGIN_UI_API_VERSION: 12;
|
|
14
14
|
|
|
15
15
|
/** Public props of `ElowenUiRuntime.components.Slider`. */
|
|
16
16
|
export interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange' | 'min' | 'max' | 'step' | 'type'> {
|
|
@@ -29,6 +29,76 @@ export interface DirectoryPickerProps {
|
|
|
29
29
|
onClose: () => void;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
export interface PluginConfigField {
|
|
33
|
+
key: string;
|
|
34
|
+
label: string;
|
|
35
|
+
type:
|
|
36
|
+
| 'string' | 'secret' | 'boolean' | 'number' | 'textarea' | 'rolePolicies' | 'model' | 'provider'
|
|
37
|
+
| 'section' | 'enum' | 'multiSelect' | 'code' | 'prompt' | 'json' | 'embeddingModel' | 'mcpServers'
|
|
38
|
+
| 'destination' | 'projects' | 'plugins' | 'tools' | 'models' | 'timezone' | 'tokenList';
|
|
39
|
+
hint?: string;
|
|
40
|
+
required?: boolean;
|
|
41
|
+
min?: number;
|
|
42
|
+
max?: number;
|
|
43
|
+
step?: number;
|
|
44
|
+
placeholder?: string;
|
|
45
|
+
display?: { control?: 'input' | 'slider'; unit?: string; divisor?: number };
|
|
46
|
+
browse?: 'directory';
|
|
47
|
+
default?: string | number | boolean | string[];
|
|
48
|
+
providerType?: string;
|
|
49
|
+
options?: { value: string; label: string }[];
|
|
50
|
+
language?: string;
|
|
51
|
+
help?: string;
|
|
52
|
+
risk?: 'low' | 'medium' | 'high';
|
|
53
|
+
advanced?: boolean;
|
|
54
|
+
fullWidth?: boolean;
|
|
55
|
+
visibleWhen?: { key: string; equals: string | number | boolean };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export type SaveStatus = 'idle' | 'saving' | 'saved' | 'pending' | 'error';
|
|
59
|
+
|
|
60
|
+
export interface AutoSaveStatusProps {
|
|
61
|
+
status: SaveStatus;
|
|
62
|
+
onRetry?: () => void | Promise<void>;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface UseAutoSaveStatusOptions {
|
|
66
|
+
ready?: boolean;
|
|
67
|
+
savable?: boolean;
|
|
68
|
+
delay?: number;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface UseAutoSaveStatusResult {
|
|
72
|
+
status: SaveStatus;
|
|
73
|
+
retry: () => Promise<void>;
|
|
74
|
+
flush: () => Promise<SaveStatus>;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export type UseAutoSaveStatus = (
|
|
78
|
+
deps: readonly unknown[],
|
|
79
|
+
save: () => unknown | Promise<unknown>,
|
|
80
|
+
options?: UseAutoSaveStatusOptions,
|
|
81
|
+
) => UseAutoSaveStatusResult;
|
|
82
|
+
|
|
83
|
+
export type PluginConfigErrorKind = 'validation' | 'conflict' | 'transport';
|
|
84
|
+
|
|
85
|
+
export interface PluginConfigDraft {
|
|
86
|
+
values: Record<string, unknown>;
|
|
87
|
+
setValue: (key: string, value: unknown) => void;
|
|
88
|
+
commitValue: (key: string, value: unknown) => Promise<{ pending: boolean }>;
|
|
89
|
+
status: SaveStatus;
|
|
90
|
+
errorKind: PluginConfigErrorKind | null;
|
|
91
|
+
retry: () => Promise<void>;
|
|
92
|
+
flush: () => Promise<SaveStatus>;
|
|
93
|
+
ready: boolean;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export type UsePluginConfigDraft = (
|
|
97
|
+
name: string,
|
|
98
|
+
detail: { config: Record<string, unknown>; configSchema: readonly PluginConfigField[]; revision?: number },
|
|
99
|
+
options?: { save?: (value: { name: string; values: Record<string, unknown>; expectedRevision?: number }) => Promise<unknown> },
|
|
100
|
+
) => PluginConfigDraft;
|
|
101
|
+
|
|
32
102
|
export type ConfirmDialogButtonVariant = 'default' | 'accent' | 'ghost' | 'danger' | 'ghost-danger' | 'outline' | 'outline-danger';
|
|
33
103
|
|
|
34
104
|
/** Public props of the API 11 async-safe `ElowenUiRuntime.components.ConfirmDialog`. */
|
|
@@ -97,7 +167,7 @@ export interface PluginPageProps {
|
|
|
97
167
|
* inside a group header can ignore it; a section declaring `layout: 'orbital'` cannot — the orbital
|
|
98
168
|
* group is a field of pods with no header to hold one, so this channel is the only place its user
|
|
99
169
|
* ever learns that a save failed. */
|
|
100
|
-
onSaveState?: (status:
|
|
170
|
+
onSaveState?: (status: SaveStatus, retry?: () => void | Promise<void>) => void;
|
|
101
171
|
}
|
|
102
172
|
|
|
103
173
|
/** Props for a contextual Project panel. It is never a standalone route: the selected Project and panel
|
|
@@ -157,11 +227,16 @@ export interface ElowenUiRuntime {
|
|
|
157
227
|
react: typeof React;
|
|
158
228
|
reactDom: typeof ReactDom;
|
|
159
229
|
jsxRuntime: typeof JsxRuntime;
|
|
160
|
-
components: Record<string, ComponentType<never
|
|
230
|
+
components: Record<string, ComponentType<never>> & {
|
|
231
|
+
AutoSaveStatus: ComponentType<AutoSaveStatusProps>;
|
|
232
|
+
};
|
|
161
233
|
/** Curated React hooks (i18n, toasts, the app's react-query data hooks). Safe across the boundary:
|
|
162
234
|
* the bundle runs on the HOST's React instance, so the rules of hooks hold. A bundle narrows each
|
|
163
235
|
* entry to the signature it expects; an absent name means the host predates the bundle. */
|
|
164
|
-
hooks: Record<string, unknown
|
|
236
|
+
hooks: Record<string, unknown> & {
|
|
237
|
+
useAutoSaveStatus: UseAutoSaveStatus;
|
|
238
|
+
usePluginConfigDraft: UsePluginConfigDraft;
|
|
239
|
+
};
|
|
165
240
|
/** Curated pure helpers (formatting, session/task mapping, error shaping) shared with bundles. */
|
|
166
241
|
utils: Record<string, unknown>;
|
|
167
242
|
api: (path: string, init?: RequestInit) => Promise<unknown>;
|
package/index.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* `window.ElowenUiRuntime` stamped with this number; a bundle whose `requiresApiVersion` is NEWER
|
|
3
3
|
* renders a placeholder instead of executing against a contract it was not built for. Bump on
|
|
4
4
|
* incompatible changes to the `ElowenUiRuntime` surface (see index.d.ts). */
|
|
5
|
-
export const PLUGIN_UI_API_VERSION =
|
|
5
|
+
export const PLUGIN_UI_API_VERSION = 12;
|
package/package.json
CHANGED
package/theme.css
CHANGED
|
@@ -67,6 +67,10 @@
|
|
|
67
67
|
three states, and borrowing `primary` or `chart-*` for them would say something they do not mean. */
|
|
68
68
|
--color-success: #32c986;
|
|
69
69
|
--color-success-foreground: var(--color-primary-foreground);
|
|
70
|
+
/* Toasts are outcome banners, not tiny status marks. GitHub's Primer success green gives them the
|
|
71
|
+
saturated diff/merge signal Filip expects while keeping white body text above AA contrast. */
|
|
72
|
+
--color-toast-success: #1f883d;
|
|
73
|
+
--color-toast-success-foreground: #ffffff;
|
|
70
74
|
--color-warning: #edae49;
|
|
71
75
|
--color-info: #62a8ea;
|
|
72
76
|
|