@edenapp/types 0.13.0 → 0.14.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @edenapp/types
2
2
 
3
+ ## 0.14.0
4
+
5
+ ### Minor Changes
6
+
7
+ - f878857: Replace host settings panel declarations and state overlays with complete validated resolved views, typed action envelopes, stable-ID reconciliation, resolved collection rows, and independently authorized same-owner nested panels. This intentionally replaces the pre-1.0 panel API without a compatibility adapter.
8
+
9
+ Allow trusted hosts to register panels without an additional grant, so public parent panels and children that inherit their ancestors' access rules use the same registration API.
10
+
11
+ Keep controls synchronized after rejected or unchanged actions, isolate radio selections between node instances, and discard dialog drafts and errors when fields disappear or change input kind.
12
+
13
+ Keep settings navigation and management views usable in narrow spaces by collapsing the sidebar to labeled icon actions and reflowing daemon and package details around their available panel width. Render resolved settings in grouped, responsive rows instead of leaving the new panel markup unstyled, and match select pickers to their controls with consistent Eden styling, centered values, and option heights.
14
+
3
15
  ## 0.13.0
4
16
 
5
17
  ### Minor Changes
@@ -1,11 +1,8 @@
1
1
  import type { UserProfile } from "./User";
2
2
 
3
- /** Text that can be localized by the Settings renderer. */
4
3
  export type SettingsPanelLocalizedText =
5
4
  | string
6
5
  | Readonly<Record<string, string>>;
7
-
8
- /** JSON-compatible values accepted by panel state and action inputs. */
9
6
  export type SettingsPanelValue =
10
7
  | string
11
8
  | number
@@ -13,25 +10,19 @@ export type SettingsPanelValue =
13
10
  | null
14
11
  | SettingsPanelValue[]
15
12
  | { [key: string]: SettingsPanelValue };
16
-
17
13
  export type SettingsPanelBadgeTone =
18
14
  | "neutral"
19
15
  | "info"
20
16
  | "success"
21
17
  | "warning"
22
18
  | "danger";
23
-
24
- /** Fully-qualified active-user grant required to discover a panel. */
25
19
  export type SettingsPanelGrant = string;
26
-
27
- /** Additional active-user grant required to invoke one panel action. */
28
20
  export type SettingsPanelActionGrant = string;
29
21
 
30
22
  export interface SettingsPanelBadge {
31
23
  label: SettingsPanelLocalizedText;
32
24
  tone?: SettingsPanelBadgeTone;
33
25
  }
34
-
35
26
  export interface SettingsPanelValidation {
36
27
  required?: boolean;
37
28
  minLength?: number;
@@ -41,98 +32,12 @@ export interface SettingsPanelValidation {
41
32
  max?: number;
42
33
  step?: number;
43
34
  }
44
-
45
35
  export interface SettingsPanelOption {
46
36
  value: string;
47
37
  label: SettingsPanelLocalizedText;
48
38
  description?: SettingsPanelLocalizedText;
49
39
  }
50
40
 
51
- export type SettingsPanelInputType =
52
- | "text"
53
- | "password"
54
- | "number"
55
- | "checkbox"
56
- | "radio"
57
- | "select"
58
- | "textarea"
59
- | "color"
60
- | "range";
61
-
62
- export interface SettingsPanelFormField {
63
- id: string;
64
- label: SettingsPanelLocalizedText;
65
- description?: SettingsPanelLocalizedText;
66
- input: SettingsPanelInputType;
67
- placeholder?: SettingsPanelLocalizedText;
68
- options?: SettingsPanelOption[];
69
- validation?: SettingsPanelValidation;
70
- autocomplete?: string;
71
- }
72
-
73
- export interface SettingsPanelControlBase {
74
- id: string;
75
- label: SettingsPanelLocalizedText;
76
- description?: SettingsPanelLocalizedText;
77
- }
78
-
79
- export interface SettingsPanelStatusRow extends SettingsPanelControlBase {
80
- kind: "status";
81
- stateKey: string;
82
- }
83
-
84
- export interface SettingsPanelToggle extends SettingsPanelControlBase {
85
- kind: "toggle";
86
- stateKey: string;
87
- actionId: string;
88
- }
89
-
90
- export interface SettingsPanelButton extends SettingsPanelControlBase {
91
- kind: "button";
92
- actionId: string;
93
- tone?: SettingsPanelBadgeTone;
94
- confirmation?: SettingsPanelLocalizedText;
95
- }
96
-
97
- export interface SettingsPanelInput extends SettingsPanelControlBase {
98
- kind: "input";
99
- stateKey: string;
100
- actionId: string;
101
- input: SettingsPanelInputType;
102
- placeholder?: SettingsPanelLocalizedText;
103
- options?: SettingsPanelOption[];
104
- validation?: SettingsPanelValidation;
105
- }
106
-
107
- export interface SettingsPanelDialogContent {
108
- title: SettingsPanelLocalizedText;
109
- description?: SettingsPanelLocalizedText;
110
- fields: SettingsPanelFormField[];
111
- submitLabel: SettingsPanelLocalizedText;
112
- cancelLabel: SettingsPanelLocalizedText;
113
- }
114
-
115
- export interface SettingsPanelDialog extends SettingsPanelControlBase {
116
- kind: "dialog";
117
- actionId: string;
118
- buttonLabel: SettingsPanelLocalizedText;
119
- dialog: SettingsPanelDialogContent;
120
- }
121
-
122
- export type SettingsPanelControl =
123
- | SettingsPanelStatusRow
124
- | SettingsPanelToggle
125
- | SettingsPanelButton
126
- | SettingsPanelInput
127
- | SettingsPanelDialog;
128
-
129
- export interface SettingsPanelSection {
130
- id: string;
131
- title?: SettingsPanelLocalizedText;
132
- description?: SettingsPanelLocalizedText;
133
- controls: SettingsPanelControl[];
134
- }
135
-
136
41
  export type SettingsPanelActionInputSchema =
137
42
  | {
138
43
  type: "string";
@@ -155,51 +60,197 @@ export type SettingsPanelActionInputSchema =
155
60
  required?: boolean;
156
61
  items?: SettingsPanelActionInputSchema;
157
62
  }
158
- | {
159
- type: "object";
160
- required?: boolean;
161
- properties?: Record<string, SettingsPanelActionInputSchema>;
162
- additionalProperties?: boolean;
163
- }
63
+ | SettingsPanelObjectInputSchema
164
64
  | { type: "any"; required?: boolean };
165
65
 
66
+ export interface SettingsPanelObjectInputSchema {
67
+ type: "object";
68
+ required?: boolean;
69
+ properties?: Record<string, SettingsPanelActionInputSchema>;
70
+ additionalProperties?: boolean;
71
+ }
72
+
166
73
  export interface SettingsPanelActionDefinition {
167
74
  id: string;
168
75
  label?: SettingsPanelLocalizedText;
169
76
  description?: SettingsPanelLocalizedText;
170
- /** An additional active-user grant required for this action. */
171
77
  grant?: SettingsPanelActionGrant;
172
- input?: SettingsPanelActionInputSchema;
78
+ params?: SettingsPanelObjectInputSchema;
79
+ value?: SettingsPanelActionInputSchema;
80
+ fields?: SettingsPanelObjectInputSchema;
173
81
  }
174
82
 
175
- /**
176
- * Serializable panel declaration. Callbacks belong in the separate provider.
177
- *
178
- * IDs beginning with `eden.` and `app.` are reserved by Eden.
179
- */
83
+ /** Serializable metadata that remains stable for a registration's lifetime. */
180
84
  export interface SettingsPanelDefinition {
181
85
  id: string;
86
+ parentId?: string;
182
87
  title: SettingsPanelLocalizedText;
183
88
  description?: SettingsPanelLocalizedText;
184
89
  icon?: string;
185
- /** Active-user grant required before the panel can be discovered or loaded. */
186
- grant: SettingsPanelGrant;
187
- sections: SettingsPanelSection[];
90
+ /** Omit to add no grant requirement beyond the parent panel, if any. */
91
+ grant?: SettingsPanelGrant;
188
92
  actions?: SettingsPanelActionDefinition[];
189
93
  }
190
94
 
191
- export interface SettingsPanelControlState {
95
+ export interface SettingsPanelActionBinding {
96
+ actionId: string;
97
+ /** Public, client-visible parameters. Handlers must reauthorize resources. */
98
+ params?: Record<string, SettingsPanelValue>;
99
+ }
100
+
101
+ export interface SettingsPanelActionInvocation {
102
+ params?: Record<string, SettingsPanelValue>;
192
103
  value?: SettingsPanelValue;
104
+ fields?: Record<string, SettingsPanelValue>;
105
+ }
106
+
107
+ interface SettingsPanelNodeBase {
108
+ id: string;
109
+ label: SettingsPanelLocalizedText;
110
+ description?: SettingsPanelLocalizedText;
111
+ }
112
+ interface SettingsPanelInteractiveNode extends SettingsPanelNodeBase {
113
+ action: SettingsPanelActionBinding;
114
+ disabled?: boolean;
115
+ }
116
+
117
+ export interface SettingsPanelStatusNode extends SettingsPanelNodeBase {
118
+ kind: "status";
119
+ value?: SettingsPanelLocalizedText;
120
+ detail?: SettingsPanelLocalizedText;
121
+ badge?: SettingsPanelBadge;
122
+ }
123
+ export interface SettingsPanelToggleNode extends SettingsPanelInteractiveNode {
124
+ kind: "toggle";
125
+ value: boolean;
126
+ }
127
+ export interface SettingsPanelButtonNode extends SettingsPanelInteractiveNode {
128
+ kind: "button";
129
+ tone?: SettingsPanelBadgeTone;
130
+ confirmation?: SettingsPanelLocalizedText;
131
+ }
132
+
133
+ interface SettingsPanelInputNodeBase extends SettingsPanelInteractiveNode {
134
+ kind: "input";
135
+ placeholder?: SettingsPanelLocalizedText;
136
+ validation?: SettingsPanelValidation;
137
+ }
138
+ export interface SettingsPanelStringInputNode
139
+ extends SettingsPanelInputNodeBase {
140
+ input: "text" | "textarea" | "color";
141
+ value: string;
142
+ }
143
+ export interface SettingsPanelChoiceInputNode
144
+ extends SettingsPanelInputNodeBase {
145
+ input: "select" | "radio";
146
+ value: string;
147
+ options: SettingsPanelOption[];
148
+ }
149
+ export interface SettingsPanelNumberInputNode
150
+ extends SettingsPanelInputNodeBase {
151
+ input: "number" | "range";
152
+ value: number;
153
+ }
154
+ export interface SettingsPanelCheckboxInputNode
155
+ extends SettingsPanelInputNodeBase {
156
+ input: "checkbox";
157
+ value: boolean;
158
+ }
159
+ export type SettingsPanelInputNode =
160
+ | SettingsPanelStringInputNode
161
+ | SettingsPanelChoiceInputNode
162
+ | SettingsPanelNumberInputNode
163
+ | SettingsPanelCheckboxInputNode;
164
+
165
+ interface SettingsPanelDialogFieldBase {
166
+ id: string;
167
+ label: SettingsPanelLocalizedText;
168
+ description?: SettingsPanelLocalizedText;
169
+ placeholder?: SettingsPanelLocalizedText;
170
+ validation?: SettingsPanelValidation;
171
+ autocomplete?: string;
172
+ }
173
+ export interface SettingsPanelStringDialogField
174
+ extends SettingsPanelDialogFieldBase {
175
+ input: "text" | "textarea" | "color";
176
+ value?: string;
177
+ }
178
+ export interface SettingsPanelChoiceDialogField
179
+ extends SettingsPanelDialogFieldBase {
180
+ input: "select" | "radio";
181
+ value?: string;
182
+ options: SettingsPanelOption[];
183
+ }
184
+ export interface SettingsPanelNumberDialogField
185
+ extends SettingsPanelDialogFieldBase {
186
+ input: "number" | "range";
187
+ value?: number;
188
+ }
189
+ export interface SettingsPanelCheckboxDialogField
190
+ extends SettingsPanelDialogFieldBase {
191
+ input: "checkbox";
192
+ value?: boolean;
193
+ }
194
+ export interface SettingsPanelPasswordDialogField
195
+ extends SettingsPanelDialogFieldBase {
196
+ input: "password";
197
+ value?: never;
198
+ }
199
+ export type SettingsPanelDialogField =
200
+ | SettingsPanelStringDialogField
201
+ | SettingsPanelChoiceDialogField
202
+ | SettingsPanelNumberDialogField
203
+ | SettingsPanelCheckboxDialogField
204
+ | SettingsPanelPasswordDialogField;
205
+
206
+ export interface SettingsPanelDialogContent {
207
+ title: SettingsPanelLocalizedText;
208
+ description?: SettingsPanelLocalizedText;
209
+ fields: SettingsPanelDialogField[];
210
+ submitLabel: SettingsPanelLocalizedText;
211
+ cancelLabel: SettingsPanelLocalizedText;
212
+ }
213
+ export interface SettingsPanelDialogNode extends SettingsPanelInteractiveNode {
214
+ kind: "dialog";
215
+ buttonLabel: SettingsPanelLocalizedText;
216
+ dialog: SettingsPanelDialogContent;
217
+ }
218
+ export type SettingsPanelRowNode =
219
+ | SettingsPanelStatusNode
220
+ | SettingsPanelButtonNode
221
+ | SettingsPanelToggleNode
222
+ | SettingsPanelDialogNode;
223
+
224
+ export interface SettingsPanelCollectionItem {
225
+ id: string;
226
+ title: SettingsPanelLocalizedText;
227
+ description?: SettingsPanelLocalizedText;
193
228
  detail?: SettingsPanelLocalizedText;
194
229
  badge?: SettingsPanelBadge;
195
230
  disabled?: boolean;
196
- hidden?: boolean;
231
+ nodes: SettingsPanelRowNode[];
197
232
  }
233
+ export interface SettingsPanelCollectionNode extends SettingsPanelNodeBase {
234
+ kind: "collection";
235
+ emptyLabel?: SettingsPanelLocalizedText;
236
+ items: SettingsPanelCollectionItem[];
237
+ }
238
+ export type SettingsPanelNode =
239
+ | SettingsPanelStatusNode
240
+ | SettingsPanelToggleNode
241
+ | SettingsPanelButtonNode
242
+ | SettingsPanelInputNode
243
+ | SettingsPanelDialogNode
244
+ | SettingsPanelCollectionNode;
198
245
 
199
- export interface SettingsPanelState {
200
- controls?: Record<string, SettingsPanelControlState>;
201
- /** Renderer-specific, JSON-compatible state for Eden-owned custom views. */
202
- data?: SettingsPanelValue;
246
+ export interface SettingsPanelSection {
247
+ id: string;
248
+ title?: SettingsPanelLocalizedText;
249
+ description?: SettingsPanelLocalizedText;
250
+ nodes: SettingsPanelNode[];
251
+ }
252
+ export interface SettingsPanelView {
253
+ sections: SettingsPanelSection[];
203
254
  }
204
255
 
205
256
  export interface SettingsPanelProviderContext {
@@ -207,54 +258,71 @@ export interface SettingsPanelProviderContext {
207
258
  sessionId: string;
208
259
  user: UserProfile;
209
260
  }
210
-
211
261
  export type SettingsPanelLoader = (
212
262
  context: SettingsPanelProviderContext,
213
- ) => SettingsPanelState | Promise<SettingsPanelState>;
214
-
263
+ ) => SettingsPanelView | Promise<SettingsPanelView>;
215
264
  export type SettingsPanelActionHandler = (
216
- input: SettingsPanelValue | undefined,
265
+ invocation: SettingsPanelActionInvocation,
217
266
  context: SettingsPanelProviderContext,
218
267
  ) => void | Promise<void>;
219
-
220
- /** Trusted main-process callbacks for a registered panel. */
221
268
  export interface SettingsPanelProvider {
222
269
  load: SettingsPanelLoader;
223
270
  actions?: Record<string, SettingsPanelActionHandler>;
224
271
  }
225
272
 
226
273
  export interface SettingsPanelRegistrationOptions {
227
- /** Whether the panel is initially included in the Settings catalog. */
228
274
  visible?: boolean;
229
275
  }
230
-
231
276
  export interface SettingsPanelRegistration {
232
277
  readonly panelId: string;
278
+ /** Reload the selected panel's complete resolved snapshot. */
279
+ invalidate(): void;
233
280
  setVisible(visible: boolean): void;
234
281
  unregister(): void;
235
282
  }
236
283
 
237
284
  export type SettingsPanelSource = "eden" | "application" | "host";
238
-
239
285
  export interface SettingsPanelSummary {
240
286
  id: string;
287
+ parentId?: string;
241
288
  title: SettingsPanelLocalizedText;
242
289
  description?: SettingsPanelLocalizedText;
243
290
  icon?: string;
244
291
  source: SettingsPanelSource;
245
292
  }
246
-
247
293
  export interface SettingsPanelActionAuthorization {
248
294
  id: string;
249
295
  authorized: boolean;
250
296
  }
251
-
252
- export interface SettingsPanelDeclaration extends SettingsPanelSummary {
253
- sections: SettingsPanelSection[];
297
+ interface SettingsPanelSnapshotBase extends SettingsPanelSummary {
254
298
  actions: SettingsPanelActionAuthorization[];
255
- /** Eden-owned renderer ID. Third-party registrations always use `generic`. */
256
- renderer: "generic" | "appearance" | "apps" | "daemons";
257
299
  }
300
+ export interface SettingsPanelGenericSnapshot
301
+ extends SettingsPanelSnapshotBase {
302
+ renderer: "generic";
303
+ view: SettingsPanelView;
304
+ }
305
+ export interface SettingsPanelAppearanceSnapshot
306
+ extends SettingsPanelSnapshotBase {
307
+ renderer: "appearance";
308
+ data?: SettingsPanelValue;
309
+ }
310
+ export interface SettingsPanelAppsSnapshot extends SettingsPanelSnapshotBase {
311
+ renderer: "apps";
312
+ data?: SettingsPanelValue;
313
+ }
314
+ export interface SettingsPanelDaemonsSnapshot
315
+ extends SettingsPanelSnapshotBase {
316
+ renderer: "daemons";
317
+ data?: SettingsPanelValue;
318
+ }
319
+ export type SettingsPanelCustomSnapshot =
320
+ | SettingsPanelAppearanceSnapshot
321
+ | SettingsPanelAppsSnapshot
322
+ | SettingsPanelDaemonsSnapshot;
323
+ export type SettingsPanelSnapshot =
324
+ | SettingsPanelGenericSnapshot
325
+ | SettingsPanelCustomSnapshot;
258
326
 
259
327
  export interface SettingsPanelError {
260
328
  code:
@@ -267,13 +335,10 @@ export interface SettingsPanelError {
267
335
  message: string;
268
336
  fields?: Record<string, string>;
269
337
  }
270
-
271
338
  export interface SettingsPanelResponse {
272
- panel?: SettingsPanelDeclaration;
273
- state?: SettingsPanelState;
339
+ panel?: SettingsPanelSnapshot;
274
340
  error?: SettingsPanelError;
275
341
  }
276
-
277
342
  export interface SettingsPanelActionResponse {
278
343
  success: boolean;
279
344
  error?: SettingsPanelError;
@@ -860,7 +860,7 @@ export interface SettingsCommands {
860
860
  response: { panels: import("./index").SettingsPanelSummary[] };
861
861
  };
862
862
  /**
863
- * Load one authorized panel declaration and its current state.
863
+ * Load one complete authorized panel snapshot.
864
864
  */
865
865
  "settings/panel": {
866
866
  args: { panelId: string };
@@ -873,7 +873,7 @@ export interface SettingsCommands {
873
873
  args: {
874
874
  panelId: string;
875
875
  actionId: string;
876
- input?: import("./index").SettingsPanelValue };
876
+ invocation?: import("./index").SettingsPanelActionInvocation };
877
877
  response: import("./index").SettingsPanelActionResponse;
878
878
  };
879
879
  }
@@ -107,6 +107,8 @@ export interface SettingsEvents {
107
107
  "settings/changed": { appId: string; key: string; value: string };
108
108
  "settings/panels-changed": {
109
109
  reason: "catalog" | "grants" | "session" | "state" | "visibility";
110
+ /** Limits a state refresh to one panel when supplied. */
111
+ panelId?: string;
110
112
  };
111
113
  }
112
114
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edenapp/types",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "TypeScript type definitions for the Eden platform",
5
5
  "types": "index.d.ts",
6
6
  "author": "Dariusz Majnert",