uidex 0.2.1 → 0.3.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.
Files changed (61) hide show
  1. package/README.md +263 -263
  2. package/dist/cli/cli.cjs +3243 -0
  3. package/dist/cli/cli.cjs.map +1 -0
  4. package/dist/cloud/index.cjs +149 -0
  5. package/dist/cloud/index.cjs.map +1 -0
  6. package/dist/cloud/index.d.cts +108 -0
  7. package/dist/cloud/index.d.ts +108 -0
  8. package/dist/cloud/index.js +120 -0
  9. package/dist/cloud/index.js.map +1 -0
  10. package/dist/headless/index.cjs +3580 -0
  11. package/dist/headless/index.cjs.map +1 -0
  12. package/dist/headless/index.d.cts +214 -0
  13. package/dist/headless/index.d.ts +214 -0
  14. package/dist/headless/index.js +3562 -0
  15. package/dist/headless/index.js.map +1 -0
  16. package/dist/index.cjs +7977 -3301
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +898 -108
  19. package/dist/index.d.ts +898 -108
  20. package/dist/index.js +7934 -3270
  21. package/dist/index.js.map +1 -1
  22. package/dist/playwright/index.cjs +164 -24
  23. package/dist/playwright/index.cjs.map +1 -1
  24. package/dist/playwright/index.d.cts +32 -55
  25. package/dist/playwright/index.d.ts +32 -55
  26. package/dist/playwright/index.js +148 -21
  27. package/dist/playwright/index.js.map +1 -1
  28. package/dist/playwright/reporter.cjs +62 -28
  29. package/dist/playwright/reporter.cjs.map +1 -1
  30. package/dist/playwright/reporter.d.cts +24 -12
  31. package/dist/playwright/reporter.d.ts +24 -12
  32. package/dist/playwright/reporter.js +62 -28
  33. package/dist/playwright/reporter.js.map +1 -1
  34. package/dist/react/index.cjs +7970 -3267
  35. package/dist/react/index.cjs.map +1 -1
  36. package/dist/react/index.d.cts +670 -108
  37. package/dist/react/index.d.ts +670 -108
  38. package/dist/react/index.js +8016 -3274
  39. package/dist/react/index.js.map +1 -1
  40. package/dist/scan/index.cjs +3281 -0
  41. package/dist/scan/index.cjs.map +1 -0
  42. package/dist/scan/index.d.cts +373 -0
  43. package/dist/scan/index.d.ts +373 -0
  44. package/dist/scan/index.js +3224 -0
  45. package/dist/scan/index.js.map +1 -0
  46. package/package.json +74 -56
  47. package/templates/claude/audit.md +37 -0
  48. package/templates/claude/rules.md +212 -0
  49. package/claude/audit-command.md +0 -16
  50. package/claude/rules.md +0 -88
  51. package/dist/core/index.cjs +0 -3490
  52. package/dist/core/index.cjs.map +0 -1
  53. package/dist/core/index.d.cts +0 -441
  54. package/dist/core/index.d.ts +0 -441
  55. package/dist/core/index.global.js +0 -3469
  56. package/dist/core/index.global.js.map +0 -1
  57. package/dist/core/index.js +0 -3444
  58. package/dist/core/index.js.map +0 -1
  59. package/dist/core/style.css +0 -971
  60. package/dist/scripts/cli.cjs +0 -1168
  61. package/uidex.schema.json +0 -93
@@ -1,65 +1,222 @@
1
- type BorderStyle = 'solid' | 'dashed' | 'dotted';
2
- type LabelPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
3
- type ButtonPosition = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
4
- interface UidexDefaults {
5
- color?: string;
6
- borderStyle?: BorderStyle;
7
- borderWidth?: number;
8
- showLabel?: boolean;
9
- labelPosition?: LabelPosition;
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode, ComponentType, ReactElement } from 'react';
3
+ import { StoreApi } from 'zustand/vanilla';
4
+
5
+ declare const ENTITY_KINDS: readonly ["route", "page", "feature", "widget", "region", "element", "primitive", "flow"];
6
+ type EntityKind = (typeof ENTITY_KINDS)[number];
7
+ type Scope = string;
8
+ interface Location {
9
+ file: string;
10
+ line?: number;
11
+ column?: number;
10
12
  }
11
- interface UidexConfig {
12
- defaults?: UidexDefaults;
13
- colors?: Record<string, string>;
13
+ interface EntityRef {
14
+ kind: EntityKind;
15
+ id: string;
14
16
  }
15
- interface UidexLocation {
16
- filePath: string;
17
- line: number;
18
- doc?: string;
17
+ interface Metadata {
18
+ name?: string;
19
+ description?: string;
20
+ acceptance?: string[];
21
+ notes?: string;
22
+ composes?: EntityRef[];
23
+ flows?: readonly string[];
24
+ features?: string[];
25
+ widgets?: string[];
19
26
  }
20
- type UidexMap = Record<string, UidexLocation[]>;
21
- interface UidexPage {
22
- dir: string;
23
- content: string;
24
- componentIds: string[];
27
+ interface EntityWithMetaBase {
28
+ id: string;
29
+ loc?: Location;
30
+ scopes?: Scope[];
31
+ meta?: Metadata;
25
32
  }
26
- interface UidexFeature {
27
- dir: string;
28
- content: string;
29
- componentIds: string[];
33
+ interface Route {
34
+ kind: "route";
35
+ path: string;
36
+ page: string;
30
37
  }
31
- interface KeyboardShortcut {
32
- key: string;
33
- ctrlKey?: boolean;
34
- shiftKey?: boolean;
35
- altKey?: boolean;
36
- metaKey?: boolean;
38
+ interface Flow {
39
+ kind: "flow";
40
+ id: string;
41
+ loc: Location;
42
+ touches: string[];
37
43
  }
38
- interface IngestConfig {
39
- endpoint: string;
40
- apiKey: string;
41
- environment?: string;
42
- appVersion?: string;
43
- reporter?: {
44
- email?: string;
45
- name?: string;
46
- };
47
- metadata?: Record<string, string>;
48
- captureConsole?: boolean;
49
- captureNetwork?: boolean;
44
+ interface Page extends EntityWithMetaBase {
45
+ kind: "page";
46
+ }
47
+ interface Feature extends EntityWithMetaBase {
48
+ kind: "feature";
49
+ }
50
+ interface Widget extends EntityWithMetaBase {
51
+ kind: "widget";
52
+ }
53
+ interface Region extends EntityWithMetaBase {
54
+ kind: "region";
55
+ }
56
+ interface Element$1 extends EntityWithMetaBase {
57
+ kind: "element";
50
58
  }
51
- type FeedbackResult = {
52
- ok: true;
59
+ interface Primitive extends EntityWithMetaBase {
60
+ kind: "primitive";
61
+ }
62
+ type Entity = Route | Page | Feature | Widget | Region | Element$1 | Primitive | Flow;
63
+ type EntityByKind<K extends EntityKind> = Extract<Entity, {
64
+ kind: K;
65
+ }>;
66
+
67
+ interface Registry {
68
+ add(entity: Entity): void;
69
+ get<K extends EntityKind>(kind: K, id: string): EntityByKind<K> | undefined;
70
+ list<K extends EntityKind>(kind: K): ReadonlyArray<EntityByKind<K>>;
71
+ query(predicate: (entity: Entity) => boolean): Entity[];
72
+ byScope(scope: Scope): Entity[];
73
+ touchedBy(flowId: string): Entity[];
74
+ }
75
+
76
+ type ThemePreference = "light" | "dark" | "auto";
77
+ type ResolvedTheme = "light" | "dark";
78
+ interface ViewStackEntry {
53
79
  id: string;
54
- sequenceNumber: number;
80
+ ref: EntityRef | null;
81
+ }
82
+ interface SessionSnapshot {
83
+ hover: EntityRef | null;
84
+ selection: EntityRef | null;
85
+ stack: ViewStackEntry[];
86
+ /** Sticky overlay highlight. Set by "Highlight Element" actions; cleared on Esc. */
87
+ pinnedHighlight: EntityRef | null;
88
+ inspectorActive: boolean;
89
+ theme: ThemePreference;
90
+ resolvedTheme: ResolvedTheme;
91
+ ingestActive: boolean;
92
+ }
93
+ interface SessionActions {
94
+ hover(ref: EntityRef | null): void;
95
+ select(ref: EntityRef | null): void;
96
+ /**
97
+ * Append a view onto the view stack. Pure: never resolves defaults.
98
+ */
99
+ pushStack(entry: ViewStackEntry): void;
100
+ /**
101
+ * Remove the top entry from the view stack. No-op when the stack is empty.
102
+ */
103
+ popStack(): void;
104
+ /**
105
+ * Empty the view stack.
106
+ */
107
+ clearStack(): void;
108
+ /**
109
+ * Open a view by id. If `ref` is omitted, the current `selection` is captured;
110
+ * pass `null` explicitly to open the view with no ref context. Thin wrapper
111
+ * around `pushStack`.
112
+ */
113
+ openView(id: string, ref?: EntityRef | null): void;
114
+ /**
115
+ * Clear the entire view stack. Thin wrapper around `clearStack`.
116
+ */
117
+ closeView(): void;
118
+ setInspectorActive(active: boolean): void;
119
+ toggleInspector(): void;
120
+ /** Pin the overlay to `ref` until `clearPinnedHighlight` is called. */
121
+ pinHighlight(ref: EntityRef): void;
122
+ clearPinnedHighlight(): void;
123
+ setTheme(theme: ThemePreference, resolved?: ResolvedTheme): void;
124
+ setIngest(active: boolean): void;
125
+ }
126
+ interface SessionState extends SessionSnapshot {
127
+ actions: SessionActions;
128
+ }
129
+
130
+ type SurfaceEvent = {
131
+ type: "TOGGLE_INSPECTOR";
132
+ } | {
133
+ type: "OPEN_PALETTE";
134
+ } | {
135
+ type: "PUSH_VIEW";
136
+ entry: ViewStackEntry;
137
+ } | {
138
+ type: "POP_VIEW";
139
+ } | {
140
+ type: "CLOSE";
141
+ } | {
142
+ type: "ESC";
143
+ } | {
144
+ type: "CMD_K";
145
+ } | {
146
+ type: "SELECT";
147
+ ref: EntityRef | null;
148
+ entry: ViewStackEntry;
149
+ } | {
150
+ type: "SET_SELECTION";
151
+ ref: EntityRef | null;
152
+ } | {
153
+ type: "HOVER";
154
+ ref: EntityRef;
155
+ element: HTMLElement | null;
156
+ color?: string | null;
157
+ } | {
158
+ type: "UNHOVER";
55
159
  } | {
56
- ok: false;
57
- error: string;
160
+ type: "PIN";
161
+ ref?: EntityRef;
162
+ } | {
163
+ type: "UNPIN";
164
+ } | {
165
+ type: "SET_THEME";
166
+ theme: ThemePreference;
167
+ resolvedTheme: ResolvedTheme;
168
+ } | {
169
+ type: "SET_INGEST";
170
+ active: boolean;
171
+ };
172
+
173
+ type SessionStore = StoreApi<SessionState> & {
174
+ send(event: SurfaceEvent): void;
58
175
  };
59
- type FeedbackType = 'bug' | 'feature' | 'improvement' | 'question';
60
- type FeedbackSeverity = 'low' | 'medium' | 'high' | 'critical';
176
+
177
+ type ConsoleLevel = "warn" | "error";
178
+ interface ConsoleEntry {
179
+ level: ConsoleLevel;
180
+ message: string;
181
+ timestamp: string;
182
+ }
183
+ interface ConsoleCaptureOptions {
184
+ limit?: number;
185
+ target?: Console;
186
+ now?: () => Date;
187
+ }
188
+ interface ConsoleCapture {
189
+ start(): void;
190
+ stop(): void;
191
+ readonly isActive: boolean;
192
+ entries(): readonly ConsoleEntry[];
193
+ clear(): void;
194
+ }
195
+
196
+ interface NetworkEntry {
197
+ method: string;
198
+ url: string;
199
+ status: number;
200
+ timestamp: string;
201
+ error?: string;
202
+ }
203
+ interface NetworkCaptureOptions {
204
+ limit?: number;
205
+ target?: {
206
+ fetch?: typeof fetch;
207
+ };
208
+ now?: () => Date;
209
+ }
210
+ interface NetworkCapture {
211
+ start(): void;
212
+ stop(): void;
213
+ readonly isActive: boolean;
214
+ entries(): readonly NetworkEntry[];
215
+ clear(): void;
216
+ }
217
+
61
218
  interface ConsoleLogEntry {
62
- level: 'warn' | 'error';
219
+ level: "log" | "warn" | "error" | "info";
63
220
  message: string;
64
221
  timestamp: string;
65
222
  }
@@ -67,83 +224,488 @@ interface NetworkErrorEntry {
67
224
  url: string;
68
225
  method: string;
69
226
  status: number | null;
70
- statusText: string;
227
+ statusText: string | null;
71
228
  timestamp: string;
72
229
  }
73
- interface FeedbackReport {
74
- type: FeedbackType;
75
- severity: FeedbackSeverity;
230
+ interface Viewport {
231
+ width: number;
232
+ height: number;
233
+ }
234
+ interface SourceRef {
235
+ filePath: string;
236
+ line: number;
237
+ }
238
+ interface FeedbackSuggestedTarget {
239
+ integrationId: string;
240
+ targetConfig: Record<string, unknown>;
241
+ }
242
+ interface FeedbackPayload {
243
+ type: "bug" | "feature" | "improvement" | "question";
244
+ severity: "low" | "medium" | "high" | "critical";
76
245
  title?: string;
77
246
  description: string;
78
247
  componentId: string;
79
- element: string | null;
80
- sources: {
81
- filePath: string;
82
- line: number;
83
- }[];
248
+ element?: string | null;
249
+ sources?: SourceRef[];
84
250
  url: string;
85
251
  path: string;
86
- route: string | null;
87
- timestamp: string;
88
- pageTitle: string;
89
- locale: string;
90
- sessionId: string;
91
- viewport: {
92
- width: number;
93
- height: number;
94
- };
95
- screen: {
96
- width: number;
97
- height: number;
98
- };
99
- userAgent: string;
100
- screenshot?: string;
252
+ route?: string | null;
253
+ pageTitle?: string;
254
+ sessionId?: string;
101
255
  reporterEmail?: string;
102
256
  reporterName?: string;
257
+ timestamp: string;
258
+ viewport: Viewport;
259
+ screen: Viewport;
260
+ userAgent: string;
261
+ locale?: string;
103
262
  environment?: string;
104
263
  appVersion?: string;
105
- metadata?: Record<string, string>;
106
264
  consoleLogs?: ConsoleLogEntry[];
107
265
  networkErrors?: NetworkErrorEntry[];
266
+ metadata?: Record<string, string>;
267
+ screenshot?: string;
268
+ suggestedTarget?: FeedbackSuggestedTarget;
269
+ }
270
+ interface FeedbackExternalLink {
271
+ ok: boolean;
272
+ url?: string;
273
+ key?: string;
274
+ error?: string;
275
+ }
276
+ interface FeedbackResult {
277
+ id: string;
278
+ sequenceNumber: number;
279
+ externalLink?: FeedbackExternalLink;
280
+ }
281
+ interface IngestConfigEpic {
282
+ key: string;
283
+ summary: string;
284
+ status: string;
285
+ }
286
+ interface IngestConfig {
287
+ hasJira: boolean;
288
+ integrationId?: string;
289
+ epics?: IngestConfigEpic[];
290
+ }
291
+ /**
292
+ * Generic so third-party adapters (e.g. `uidex-cloud`) can plug in their own
293
+ * payload/result/integration shapes. SDK-bundled `cloud()` returns the
294
+ * defaulted form. `ViewContext.cloud` uses the fully-open variant; consumers
295
+ * that need the SDK shape narrow with `as CloudAdapter`.
296
+ */
297
+ interface CloudAdapter<TPayload = FeedbackPayload, TResult = FeedbackResult, TIntegrations = {
298
+ getConfig(): Promise<IngestConfig>;
299
+ }> {
300
+ readonly feedback: {
301
+ submit(payload: TPayload): Promise<TResult>;
302
+ };
303
+ readonly integrations: TIntegrations;
108
304
  }
109
305
 
110
- interface UidexDevtoolsProps {
111
- components?: UidexMap;
112
- config?: UidexConfig;
113
- buttonPosition?: ButtonPosition;
114
- disabled?: boolean;
115
- onSelect?: (id: string) => void;
116
- /** Keyboard shortcut to toggle inspect mode. Default: Shift+Cmd+U. Set to false to disable. */
117
- inspectShortcut?: KeyboardShortcut | false;
118
- /** Ingest configuration for submitting feedback to a server. */
119
- ingest?: IngestConfig;
120
- /** Called after feedback submission with the report and result. */
121
- onSubmit?: (report: FeedbackReport, result: FeedbackResult) => void;
306
+ interface IngestOptions {
307
+ captureConsole?: boolean;
308
+ captureNetwork?: boolean;
309
+ consoleLimit?: number;
310
+ networkLimit?: number;
311
+ consoleTarget?: ConsoleCaptureOptions["target"];
312
+ networkTarget?: NetworkCaptureOptions["target"];
313
+ now?: () => Date;
314
+ }
315
+ interface Ingest {
316
+ start(): void;
317
+ stop(): void;
318
+ readonly isActive: boolean;
319
+ readonly console: ConsoleCapture | null;
320
+ readonly network: NetworkCapture | null;
122
321
  }
123
- declare function UidexDevtools({ components, config, buttonPosition, disabled, onSelect, inspectShortcut, ingest, onSubmit, }: UidexDevtoolsProps): null;
124
322
 
125
- interface UidexOverlayProps {
126
- target: HTMLElement | null;
323
+ interface OverlayShowOptions {
324
+ label?: string;
127
325
  color?: string;
128
- borderStyle?: BorderStyle;
326
+ padding?: number;
327
+ borderStyle?: string;
129
328
  borderWidth?: number;
130
- label?: string;
131
- showLabel?: boolean;
132
- labelPosition?: LabelPosition;
133
- colors?: Record<string, string>;
329
+ fillOpacity?: number;
330
+ }
331
+
332
+ type Corner = "top-left" | "top-right" | "bottom-left" | "bottom-right";
333
+
334
+ type ViewSurface = ListSurface | DetailSurface | FormSurface | CustomSurface;
335
+ interface ListSurface {
336
+ kind: "list";
337
+ id: string;
338
+ items: readonly ListItem[];
339
+ onSelect?(item: ListItem): void;
340
+ emptyLabel?: string;
341
+ defaultHighlight?: string;
342
+ filter?(item: ListItem, query: string): boolean;
343
+ }
344
+ interface ListItem {
345
+ value: string;
346
+ label: string;
347
+ subtitle?: string;
348
+ group?: string;
349
+ shortcut?: string;
350
+ /**
351
+ * When highlighted, the shell calls `ctx.highlight.show(preview)`.
352
+ * Cleared on unhighlight or view unmount.
353
+ */
354
+ preview?: EntityRef;
355
+ /** Renders a kind chip on the left. `entity.kind` drives icon + color. */
356
+ entityChip?: {
357
+ entity: Entity;
358
+ node?: Element | null;
359
+ };
360
+ /**
361
+ * Optional leading-icon factory used for non-entity rows (e.g. a palette
362
+ * "Feedback" command). Called per-render so the returned Node is fresh.
363
+ * The shell wraps whatever is returned in a rounded-square tile.
364
+ */
365
+ leading?: () => Node;
366
+ /** Raw data attribute tag appended to the row (for test/e2e hooks). */
367
+ tag?: string;
368
+ }
369
+ interface DetailSurface {
370
+ kind: "detail";
371
+ entityKind: EntityKind;
372
+ /** Registry lookup failed — renders the "not found" placeholder. */
373
+ notFound?: EntityRef;
374
+ /** Entity display name, rendered as the heading. */
375
+ title?: string;
376
+ subtitle?: DetailSubtitle;
377
+ actions?: readonly DetailAction[];
378
+ sections?: readonly DetailSection[];
379
+ }
380
+ interface DetailSubtitle {
381
+ rawId: string;
382
+ extra?: string;
383
+ }
384
+ interface DetailActionBase {
385
+ id: string;
386
+ label: string;
387
+ icon?: DetailActionIcon;
388
+ ariaLabel?: string;
389
+ hint?: string;
390
+ intent?: ShellActionIntent;
391
+ }
392
+ type DetailAction = (DetailActionBase & {
393
+ copy: string;
394
+ }) | (DetailActionBase & {
395
+ scrollTo: string;
396
+ }) | (DetailActionBase & {
397
+ push: {
398
+ id: string;
399
+ ref?: EntityRef | null;
400
+ };
401
+ }) | (DetailActionBase & {
402
+ navigate: EntityRef;
403
+ }) | (DetailActionBase & {
404
+ highlight: EntityRef;
405
+ }) | (DetailActionBase & {
406
+ run: (ctx: DetailActionRunContext) => void | Promise<void>;
407
+ });
408
+ type DetailActionIcon = "copy" | "message-circle" | "chevron-down" | "target";
409
+ interface DetailActionRunContext {
410
+ setLabel(next: string, durationMs?: number): void;
411
+ }
412
+ type DetailSection = {
413
+ id: "description";
414
+ text: string;
415
+ } | {
416
+ id: "acceptance";
417
+ items: readonly string[];
418
+ } | {
419
+ id: "scopes";
420
+ scopes: readonly string[];
421
+ } | {
422
+ id: "composes";
423
+ label: string;
424
+ entities: readonly Entity[];
425
+ filterable?: boolean;
426
+ } | {
427
+ id: "used-by";
428
+ label: string;
429
+ entities: readonly Entity[];
430
+ filterable?: boolean;
431
+ } | {
432
+ id: "flows";
433
+ flows: readonly Flow[];
434
+ filterable?: boolean;
435
+ } | {
436
+ id: "touches";
437
+ entities: readonly Entity[];
438
+ unresolved: readonly string[];
439
+ filterable?: boolean;
440
+ } | {
441
+ id: "routes";
442
+ paths: readonly string[];
443
+ filterable?: boolean;
444
+ };
445
+ interface FormSurface {
446
+ kind: "form";
447
+ id: string;
448
+ fields: readonly FormField[];
449
+ submit: FormSubmit;
450
+ initial?: Record<string, FormValue>;
451
+ /**
452
+ * Optional Standard Schema (Zod v4, Valibot, ArkType, etc.) run against the
453
+ * collected form values before `submit.onSubmit`. On failure, issues are
454
+ * routed to the matching `<FieldError>` and submission is skipped.
455
+ */
456
+ schema?: StandardSchemaV1<Record<string, unknown>>;
457
+ }
458
+ /**
459
+ * Minimal StandardSchemaV1 surface — kept inline so the SDK doesn't need a
460
+ * type-level dep on any specific validator package.
461
+ */
462
+ interface StandardSchemaV1<Input = unknown, Output = Input> {
463
+ readonly "~standard": {
464
+ readonly version: 1;
465
+ readonly vendor: string;
466
+ readonly validate: (value: unknown) => StandardSchemaResult<Output> | Promise<StandardSchemaResult<Output>>;
467
+ readonly types?: {
468
+ readonly input: Input;
469
+ readonly output: Output;
470
+ };
471
+ };
472
+ }
473
+ type StandardSchemaResult<Output> = {
474
+ readonly value: Output;
475
+ readonly issues?: undefined;
476
+ } | {
477
+ readonly issues: ReadonlyArray<StandardSchemaIssue>;
478
+ };
479
+ interface StandardSchemaIssue {
480
+ readonly message: string;
481
+ readonly path?: ReadonlyArray<PropertyKey | {
482
+ readonly key: PropertyKey;
483
+ }>;
484
+ }
485
+ interface FormSubmit {
486
+ label: string;
487
+ onSubmit: (values: Record<string, FormValue>) => FormSubmitResult | void | Promise<FormSubmitResult | void>;
488
+ }
489
+ type FormSubmitResult = {
490
+ status: "success";
491
+ message?: string;
492
+ link?: {
493
+ url: string;
494
+ label?: string;
495
+ };
496
+ resetFields?: readonly string[];
497
+ } | {
498
+ status: "error";
499
+ message: string;
500
+ /** Per-field error messages keyed by field `name`. */
501
+ fieldErrors?: Record<string, string>;
502
+ };
503
+ type FormValue = string | boolean;
504
+ interface FormFieldBase {
505
+ name: string;
506
+ label: string;
507
+ }
508
+ type FormField = (FormFieldBase & {
509
+ kind: "select";
510
+ options: readonly {
511
+ value: string;
512
+ label: string;
513
+ }[];
514
+ required?: boolean;
515
+ value?: string;
516
+ }) | (FormFieldBase & {
517
+ kind: "text";
518
+ placeholder?: string;
519
+ required?: boolean;
520
+ value?: string;
521
+ }) | (FormFieldBase & {
522
+ kind: "email";
523
+ placeholder?: string;
524
+ required?: boolean;
525
+ value?: string;
526
+ }) | (FormFieldBase & {
527
+ kind: "textarea";
528
+ placeholder?: string;
529
+ required?: boolean;
530
+ rows?: number;
531
+ value?: string;
532
+ }) | (FormFieldBase & {
533
+ kind: "checkbox";
534
+ value?: boolean;
535
+ });
536
+ interface CustomSurface {
537
+ kind: "custom";
538
+ render: (ctx: ViewContext, root: HTMLElement) => Cleanup | void;
539
+ }
540
+
541
+ interface ViewPalette {
542
+ label: string;
543
+ group?: string;
544
+ /**
545
+ * Leading-icon factory rendered as a rounded-square tile on the palette
546
+ * row. Called fresh per render (so a returned SVG isn't reparented).
547
+ */
548
+ icon?: () => Node;
549
+ shortcut?: string;
550
+ }
551
+ interface ViewDirectory {
552
+ list(): readonly View[];
553
+ }
554
+ interface ViewPushTarget {
555
+ id: string;
556
+ ref?: EntityRef | null;
557
+ }
558
+ interface HighlightController {
559
+ show(ref: EntityRef, opts?: OverlayShowOptions): void;
560
+ hide(): void;
561
+ }
562
+ interface ViewContext {
563
+ ref: EntityRef | null;
564
+ registry: Registry;
565
+ cloud: CloudAdapter<unknown, unknown, unknown> | null;
566
+ sdkCloud: CloudAdapter;
567
+ views: ViewDirectory;
568
+ /** Push a view onto the stack. Unregistered ids are a no-op. */
569
+ push: (target: ViewPushTarget) => void;
570
+ /** Pop the top view off the stack. No-op when the stack is empty. */
571
+ pop: () => void;
572
+ /** Clear the entire view stack. */
573
+ close: () => void;
574
+ /** Resolve the first view matching `ref` and push it onto the stack. */
575
+ navigate: (ref: EntityRef) => void;
576
+ /** Pin the overlay to `ref` until the user presses Esc. */
577
+ pinHighlight: (ref: EntityRef) => void;
578
+ /** Shell-owned search input. The shell dispatches its value into the active surface. */
579
+ searchInput: HTMLInputElement;
580
+ /** Drives the Surface's singleton overlay from inside a custom surface. */
581
+ highlight: HighlightController;
582
+ /** Snapshot of the current view stack (top-most last). */
583
+ getStack: () => readonly ViewStackEntry[];
584
+ }
585
+ interface ShellHint {
586
+ key: string;
587
+ label: string;
588
+ }
589
+ type ShellActionIntent = {
590
+ kind: "push";
591
+ viewId: string;
592
+ refKind?: EntityKind;
593
+ } | {
594
+ kind: "pop";
595
+ } | {
596
+ kind: "close";
597
+ } | {
598
+ kind: "navigate";
599
+ refKind?: EntityKind;
600
+ } | {
601
+ kind: "external";
602
+ describe: string;
603
+ };
604
+ interface ShellAction {
605
+ id: string;
606
+ label: string;
607
+ shortcut?: string;
608
+ perform: () => void | Promise<void>;
609
+ intent?: ShellActionIntent;
610
+ }
611
+ type Cleanup = () => void;
612
+ interface View {
613
+ id: string;
614
+ matches?: (ref: EntityRef) => boolean;
615
+ palette?: ViewPalette;
616
+ title?: string | ((ctx: ViewContext) => string);
617
+ /** Show the shell search input when this view is on top. Default: true. */
618
+ searchable?: boolean;
619
+ hints?: ShellHint[] | ((ctx: ViewContext) => ShellHint[]);
620
+ actions?: (ctx: ViewContext) => ShellAction[];
621
+ /**
622
+ * Element focused when this view becomes the top of the stack. The shell
623
+ * falls back to the first focusable element in the host when omitted, or
624
+ * when the declared target has been removed from the host.
625
+ */
626
+ focusTarget?: (root: HTMLElement, ctx: ViewContext) => HTMLElement | null;
627
+ surface: (ctx: ViewContext) => ViewSurface;
628
+ }
629
+
630
+ interface ViewRegistrar {
631
+ register(view: View): void;
632
+ unregister(id: string): void;
633
+ list(): readonly View[];
634
+ get(id: string): View | undefined;
635
+ findMatch(ref: EntityRef): View | null;
636
+ navigate(ref: EntityRef): void;
637
+ }
638
+
639
+ interface CreateUidexOptions {
640
+ theme?: ThemePreference;
641
+ resolvedTheme?: ResolvedTheme;
642
+ stylesheets?: string[];
643
+ initialCorner?: Corner;
644
+ /** Shown as a label at the start of the menu bar. */
645
+ appTitle?: string;
646
+ cloud?: CloudAdapter | null;
647
+ dev?: boolean;
648
+ /** Register bundled default views. Defaults to `true`. */
649
+ defaultViews?: boolean;
650
+ /** Additional views to register (after defaults). */
651
+ views?: readonly View[];
652
+ /**
653
+ * Override ingest behaviour. When `cloud` is non-null, ingest auto-enables
654
+ * (both console and network capture). Pass `null` to disable entirely, or
655
+ * an options object to override either channel.
656
+ */
657
+ ingest?: IngestOptions | null;
658
+ }
659
+ interface Uidex {
660
+ mount(target?: Element): void;
661
+ unmount(): void;
662
+ readonly registry: Registry;
663
+ readonly session: SessionStore;
664
+ readonly views: ViewRegistrar;
665
+ readonly cloud: CloudAdapter | null;
666
+ readonly ingest: Ingest | null;
667
+ readonly shadowRoot: ShadowRoot | null;
134
668
  }
135
- declare function UidexOverlay({ target, color, borderStyle, borderWidth, label, showLabel, labelPosition, colors, }: UidexOverlayProps): null;
136
669
 
137
- declare function registerComponents(components: UidexMap): void;
138
- declare function getComponents(): UidexMap | null;
139
- declare function registerPages(pages: UidexPage[]): void;
140
- declare function getPages(): UidexPage[] | null;
141
- declare function registerFeatures(features: UidexFeature[]): void;
142
- declare function getFeatures(): UidexFeature[] | null;
670
+ interface UidexProviderProps {
671
+ /**
672
+ * Pre-built uidex instance (e.g. the `uidex` export from `uidex.gen.ts`).
673
+ * When provided, `projectKey`, `cloud`, and `config` are ignored.
674
+ */
675
+ instance?: Uidex;
676
+ projectKey?: string;
677
+ cloud?: CloudAdapter | null;
678
+ config?: Omit<CreateUidexOptions, "cloud">;
679
+ children?: ReactNode;
680
+ }
681
+ declare function UidexProvider({ instance: externalInstance, projectKey, cloud, config, children, }: UidexProviderProps): react_jsx_runtime.JSX.Element;
682
+
683
+ declare class UidexContextError extends Error {
684
+ constructor(hookName: string);
685
+ }
686
+ declare function useUidex(): Uidex;
687
+
688
+ interface UidexMountProps {
689
+ className?: string;
690
+ }
691
+ declare function UidexMount({ className }: UidexMountProps): react_jsx_runtime.JSX.Element;
143
692
 
144
- declare function classNames(...classes: (string | undefined | null | false)[]): string;
145
- declare function getContrastColor(hexColor: string): string;
146
- declare function hexToRgba(hex: string, alpha: number): string;
147
- declare function resolveColor(color: string | undefined, colorMap?: Record<string, string>): string | undefined;
693
+ interface ReactViewDef {
694
+ id: string;
695
+ matches?: (ref: EntityRef) => boolean;
696
+ palette?: ViewPalette;
697
+ component: ComponentType<{
698
+ ctx: ViewContext;
699
+ }>;
700
+ }
701
+ declare function createReactView(def: ReactViewDef): View;
702
+
703
+ interface KindChipProps {
704
+ kind: EntityKind;
705
+ label?: string;
706
+ withKindName?: boolean;
707
+ className?: string;
708
+ }
709
+ declare function KindChip({ kind, label, withKindName, className, }: KindChipProps): ReactElement;
148
710
 
149
- export { type BorderStyle, type ButtonPosition, type FeedbackReport, type FeedbackResult, type FeedbackSeverity, type FeedbackType, type IngestConfig, type KeyboardShortcut, type LabelPosition, type UidexConfig, type UidexDefaults, UidexDevtools, type UidexDevtoolsProps, type UidexFeature, type UidexLocation, type UidexMap, UidexOverlay, type UidexOverlayProps, type UidexPage, classNames, getComponents, getContrastColor, getFeatures, getPages, hexToRgba, registerComponents, registerFeatures, registerPages, resolveColor };
711
+ export { KindChip, type KindChipProps, type ReactViewDef, UidexContextError, UidexMount, type UidexMountProps, UidexProvider, type UidexProviderProps, createReactView, useUidex };