uidex 0.4.0 → 0.5.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 (42) hide show
  1. package/dist/cli/cli.cjs +996 -73
  2. package/dist/cli/cli.cjs.map +1 -1
  3. package/dist/cloud/index.cjs +375 -72
  4. package/dist/cloud/index.cjs.map +1 -1
  5. package/dist/cloud/index.d.cts +82 -0
  6. package/dist/cloud/index.d.ts +82 -0
  7. package/dist/cloud/index.js +376 -71
  8. package/dist/cloud/index.js.map +1 -1
  9. package/dist/headless/index.cjs +620 -469
  10. package/dist/headless/index.cjs.map +1 -1
  11. package/dist/headless/index.d.cts +77 -75
  12. package/dist/headless/index.d.ts +77 -75
  13. package/dist/headless/index.js +624 -469
  14. package/dist/headless/index.js.map +1 -1
  15. package/dist/index.cjs +4255 -2884
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +275 -234
  18. package/dist/index.d.ts +275 -234
  19. package/dist/index.js +4277 -2890
  20. package/dist/index.js.map +1 -1
  21. package/dist/playwright/index.cjs +4 -4
  22. package/dist/playwright/index.cjs.map +1 -1
  23. package/dist/playwright/index.js +3 -3
  24. package/dist/playwright/index.js.map +1 -1
  25. package/dist/playwright/reporter.cjs +3 -3
  26. package/dist/playwright/reporter.cjs.map +1 -1
  27. package/dist/playwright/reporter.js +3 -3
  28. package/dist/playwright/reporter.js.map +1 -1
  29. package/dist/react/index.cjs +4298 -2908
  30. package/dist/react/index.cjs.map +1 -1
  31. package/dist/react/index.d.cts +206 -200
  32. package/dist/react/index.d.ts +206 -200
  33. package/dist/react/index.js +4334 -2924
  34. package/dist/react/index.js.map +1 -1
  35. package/dist/scan/index.cjs +91 -40
  36. package/dist/scan/index.cjs.map +1 -1
  37. package/dist/scan/index.d.cts +26 -0
  38. package/dist/scan/index.d.ts +26 -0
  39. package/dist/scan/index.js +90 -39
  40. package/dist/scan/index.js.map +1 -1
  41. package/package.json +23 -22
  42. package/templates/claude/api.md +110 -0
@@ -67,6 +67,26 @@ type EntityByKind<K extends EntityKind> = Extract<Entity, {
67
67
  kind: K;
68
68
  }>;
69
69
 
70
+ interface ReportRecord {
71
+ id: string;
72
+ entity?: string;
73
+ reporter?: {
74
+ id?: string;
75
+ email?: string;
76
+ name?: string;
77
+ };
78
+ title?: string;
79
+ body: string;
80
+ type: string;
81
+ severity: string;
82
+ status: string;
83
+ labels?: string[];
84
+ url: string;
85
+ route?: string;
86
+ pageTitle?: string;
87
+ screenshot?: string;
88
+ createdAt: string;
89
+ }
70
90
  interface Registry {
71
91
  add(entity: Entity): void;
72
92
  get<K extends EntityKind>(kind: K, id: string): EntityByKind<K> | undefined;
@@ -74,6 +94,17 @@ interface Registry {
74
94
  query(predicate: (entity: Entity) => boolean): Entity[];
75
95
  byScope(scope: Scope): Entity[];
76
96
  touchedBy(flowId: string): Entity[];
97
+ setReports(kind: EntityKind, id: string, reports: readonly ReportRecord[]): void;
98
+ getReports(kind: EntityKind, id: string): readonly ReportRecord[];
99
+ listReportKeys(): readonly string[];
100
+ archiveReport?: (reportId: string, reason?: string) => void | Promise<void>;
101
+ onReportsChange(cb: () => void): () => void;
102
+ }
103
+
104
+ interface UserIdentity {
105
+ id: string;
106
+ name?: string;
107
+ avatar?: string;
77
108
  }
78
109
 
79
110
  type ThemePreference = "light" | "dark" | "auto";
@@ -92,89 +123,60 @@ interface SessionSnapshot {
92
123
  theme: ThemePreference;
93
124
  resolvedTheme: ResolvedTheme;
94
125
  ingestActive: boolean;
95
- }
96
- interface SessionActions {
97
- hover(ref: EntityRef | null): void;
98
- select(ref: EntityRef | null): void;
99
- /**
100
- * Append a view onto the view stack. Pure: never resolves defaults.
101
- */
102
- pushStack(entry: ViewStackEntry): void;
103
- /**
104
- * Remove the top entry from the view stack. No-op when the stack is empty.
105
- */
106
- popStack(): void;
107
- /**
108
- * Empty the view stack.
109
- */
110
- clearStack(): void;
111
126
  /**
112
- * Open a view by id. If `ref` is omitted, the current `selection` is captured;
113
- * pass `null` explicitly to open the view with no ref context. Thin wrapper
114
- * around `pushStack`.
127
+ * Identity for the local user. Set once at session creation; gates realtime
128
+ * features (cursor labels, presence) and auto-populates report attribution.
115
129
  */
116
- openView(id: string, ref?: EntityRef | null): void;
117
- /**
118
- * Clear the entire view stack. Thin wrapper around `clearStack`.
119
- */
120
- closeView(): void;
121
- setInspectorActive(active: boolean): void;
122
- toggleInspector(): void;
123
- /** Pin the overlay to `ref` until `clearPinnedHighlight` is called. */
124
- pinHighlight(ref: EntityRef): void;
125
- clearPinnedHighlight(): void;
126
- setTheme(theme: ThemePreference, resolved?: ResolvedTheme): void;
127
- setIngest(active: boolean): void;
130
+ user: UserIdentity | null;
128
131
  }
129
- interface SessionState extends SessionSnapshot {
130
- actions: SessionActions;
132
+ type SessionState = SessionSnapshot;
133
+
134
+ interface NavigationState {
135
+ stack: ViewStackEntry[];
131
136
  }
137
+ interface NavigationActions {
138
+ push(entry: ViewStackEntry): void;
139
+ pop(): void;
140
+ replace(entry: ViewStackEntry): void;
141
+ clear(): void;
142
+ reset(stack: ViewStackEntry[]): void;
143
+ }
144
+ type NavigationStore = StoreApi<NavigationState> & {
145
+ nav: NavigationActions;
146
+ };
132
147
 
133
- type SurfaceEvent = {
134
- type: "TOGGLE_INSPECTOR";
135
- } | {
136
- type: "OPEN_PALETTE";
137
- } | {
138
- type: "PUSH_VIEW";
139
- entry: ViewStackEntry;
140
- } | {
141
- type: "POP_VIEW";
142
- } | {
143
- type: "CLOSE";
144
- } | {
145
- type: "ESC";
146
- } | {
147
- type: "CMD_K";
148
- } | {
149
- type: "SELECT";
150
- ref: EntityRef | null;
151
- entry: ViewStackEntry;
152
- } | {
153
- type: "SET_SELECTION";
154
- ref: EntityRef | null;
155
- } | {
156
- type: "HOVER";
157
- ref: EntityRef;
158
- element: HTMLElement | null;
159
- color?: string | null;
160
- } | {
161
- type: "UNHOVER";
162
- } | {
163
- type: "PIN";
164
- ref?: EntityRef;
165
- } | {
166
- type: "UNPIN";
167
- } | {
168
- type: "SET_THEME";
169
- theme: ThemePreference;
170
- resolvedTheme: ResolvedTheme;
171
- } | {
172
- type: "SET_INGEST";
173
- active: boolean;
148
+ type SurfaceMode = "idle" | "inspecting" | "palette" | "viewing";
149
+ interface ModeSnapshot {
150
+ mode: SurfaceMode;
151
+ inspectorActive: boolean;
152
+ }
153
+ interface ModeTransitions {
154
+ openPalette(): void;
155
+ openInspector(): void;
156
+ closeInspector(): void;
157
+ toggleInspector(): void;
158
+ enterViewing(initialStack: ViewStackEntry[]): void;
159
+ dismiss(): void;
160
+ popOrTransition(): void;
161
+ pushView(entry: ViewStackEntry): void;
162
+ }
163
+ type ModeStore = StoreApi<ModeSnapshot> & {
164
+ transition: ModeTransitions;
174
165
  };
175
166
 
167
+ interface HighlightActions {
168
+ hover(ref: EntityRef, element?: HTMLElement | null, color?: string | null): void;
169
+ unhover(): void;
170
+ pin(ref?: EntityRef): void;
171
+ unpin(): void;
172
+ }
176
173
  type SessionStore = StoreApi<SessionState> & {
177
- send(event: SurfaceEvent): void;
174
+ readonly nav: NavigationStore;
175
+ readonly mode: ModeStore;
176
+ readonly highlight: HighlightActions;
177
+ select(ref: EntityRef | null): void;
178
+ setTheme(theme: ThemePreference, resolved?: ResolvedTheme): void;
179
+ setIngest(active: boolean): void;
178
180
  };
179
181
 
180
182
  interface OverlayShowOptions {
@@ -67,6 +67,26 @@ type EntityByKind<K extends EntityKind> = Extract<Entity, {
67
67
  kind: K;
68
68
  }>;
69
69
 
70
+ interface ReportRecord {
71
+ id: string;
72
+ entity?: string;
73
+ reporter?: {
74
+ id?: string;
75
+ email?: string;
76
+ name?: string;
77
+ };
78
+ title?: string;
79
+ body: string;
80
+ type: string;
81
+ severity: string;
82
+ status: string;
83
+ labels?: string[];
84
+ url: string;
85
+ route?: string;
86
+ pageTitle?: string;
87
+ screenshot?: string;
88
+ createdAt: string;
89
+ }
70
90
  interface Registry {
71
91
  add(entity: Entity): void;
72
92
  get<K extends EntityKind>(kind: K, id: string): EntityByKind<K> | undefined;
@@ -74,6 +94,17 @@ interface Registry {
74
94
  query(predicate: (entity: Entity) => boolean): Entity[];
75
95
  byScope(scope: Scope): Entity[];
76
96
  touchedBy(flowId: string): Entity[];
97
+ setReports(kind: EntityKind, id: string, reports: readonly ReportRecord[]): void;
98
+ getReports(kind: EntityKind, id: string): readonly ReportRecord[];
99
+ listReportKeys(): readonly string[];
100
+ archiveReport?: (reportId: string, reason?: string) => void | Promise<void>;
101
+ onReportsChange(cb: () => void): () => void;
102
+ }
103
+
104
+ interface UserIdentity {
105
+ id: string;
106
+ name?: string;
107
+ avatar?: string;
77
108
  }
78
109
 
79
110
  type ThemePreference = "light" | "dark" | "auto";
@@ -92,89 +123,60 @@ interface SessionSnapshot {
92
123
  theme: ThemePreference;
93
124
  resolvedTheme: ResolvedTheme;
94
125
  ingestActive: boolean;
95
- }
96
- interface SessionActions {
97
- hover(ref: EntityRef | null): void;
98
- select(ref: EntityRef | null): void;
99
- /**
100
- * Append a view onto the view stack. Pure: never resolves defaults.
101
- */
102
- pushStack(entry: ViewStackEntry): void;
103
- /**
104
- * Remove the top entry from the view stack. No-op when the stack is empty.
105
- */
106
- popStack(): void;
107
- /**
108
- * Empty the view stack.
109
- */
110
- clearStack(): void;
111
126
  /**
112
- * Open a view by id. If `ref` is omitted, the current `selection` is captured;
113
- * pass `null` explicitly to open the view with no ref context. Thin wrapper
114
- * around `pushStack`.
127
+ * Identity for the local user. Set once at session creation; gates realtime
128
+ * features (cursor labels, presence) and auto-populates report attribution.
115
129
  */
116
- openView(id: string, ref?: EntityRef | null): void;
117
- /**
118
- * Clear the entire view stack. Thin wrapper around `clearStack`.
119
- */
120
- closeView(): void;
121
- setInspectorActive(active: boolean): void;
122
- toggleInspector(): void;
123
- /** Pin the overlay to `ref` until `clearPinnedHighlight` is called. */
124
- pinHighlight(ref: EntityRef): void;
125
- clearPinnedHighlight(): void;
126
- setTheme(theme: ThemePreference, resolved?: ResolvedTheme): void;
127
- setIngest(active: boolean): void;
130
+ user: UserIdentity | null;
128
131
  }
129
- interface SessionState extends SessionSnapshot {
130
- actions: SessionActions;
132
+ type SessionState = SessionSnapshot;
133
+
134
+ interface NavigationState {
135
+ stack: ViewStackEntry[];
131
136
  }
137
+ interface NavigationActions {
138
+ push(entry: ViewStackEntry): void;
139
+ pop(): void;
140
+ replace(entry: ViewStackEntry): void;
141
+ clear(): void;
142
+ reset(stack: ViewStackEntry[]): void;
143
+ }
144
+ type NavigationStore = StoreApi<NavigationState> & {
145
+ nav: NavigationActions;
146
+ };
132
147
 
133
- type SurfaceEvent = {
134
- type: "TOGGLE_INSPECTOR";
135
- } | {
136
- type: "OPEN_PALETTE";
137
- } | {
138
- type: "PUSH_VIEW";
139
- entry: ViewStackEntry;
140
- } | {
141
- type: "POP_VIEW";
142
- } | {
143
- type: "CLOSE";
144
- } | {
145
- type: "ESC";
146
- } | {
147
- type: "CMD_K";
148
- } | {
149
- type: "SELECT";
150
- ref: EntityRef | null;
151
- entry: ViewStackEntry;
152
- } | {
153
- type: "SET_SELECTION";
154
- ref: EntityRef | null;
155
- } | {
156
- type: "HOVER";
157
- ref: EntityRef;
158
- element: HTMLElement | null;
159
- color?: string | null;
160
- } | {
161
- type: "UNHOVER";
162
- } | {
163
- type: "PIN";
164
- ref?: EntityRef;
165
- } | {
166
- type: "UNPIN";
167
- } | {
168
- type: "SET_THEME";
169
- theme: ThemePreference;
170
- resolvedTheme: ResolvedTheme;
171
- } | {
172
- type: "SET_INGEST";
173
- active: boolean;
148
+ type SurfaceMode = "idle" | "inspecting" | "palette" | "viewing";
149
+ interface ModeSnapshot {
150
+ mode: SurfaceMode;
151
+ inspectorActive: boolean;
152
+ }
153
+ interface ModeTransitions {
154
+ openPalette(): void;
155
+ openInspector(): void;
156
+ closeInspector(): void;
157
+ toggleInspector(): void;
158
+ enterViewing(initialStack: ViewStackEntry[]): void;
159
+ dismiss(): void;
160
+ popOrTransition(): void;
161
+ pushView(entry: ViewStackEntry): void;
162
+ }
163
+ type ModeStore = StoreApi<ModeSnapshot> & {
164
+ transition: ModeTransitions;
174
165
  };
175
166
 
167
+ interface HighlightActions {
168
+ hover(ref: EntityRef, element?: HTMLElement | null, color?: string | null): void;
169
+ unhover(): void;
170
+ pin(ref?: EntityRef): void;
171
+ unpin(): void;
172
+ }
176
173
  type SessionStore = StoreApi<SessionState> & {
177
- send(event: SurfaceEvent): void;
174
+ readonly nav: NavigationStore;
175
+ readonly mode: ModeStore;
176
+ readonly highlight: HighlightActions;
177
+ select(ref: EntityRef | null): void;
178
+ setTheme(theme: ThemePreference, resolved?: ResolvedTheme): void;
179
+ setIngest(active: boolean): void;
178
180
  };
179
181
 
180
182
  interface OverlayShowOptions {