uidex 0.3.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 (44) hide show
  1. package/dist/cli/cli.cjs +1116 -112
  2. package/dist/cli/cli.cjs.map +1 -1
  3. package/dist/cloud/index.cjs +395 -72
  4. package/dist/cloud/index.cjs.map +1 -1
  5. package/dist/cloud/index.d.cts +60 -86
  6. package/dist/cloud/index.d.ts +60 -86
  7. package/dist/cloud/index.js +396 -71
  8. package/dist/cloud/index.js.map +1 -1
  9. package/dist/headless/index.cjs +1505 -791
  10. package/dist/headless/index.cjs.map +1 -1
  11. package/dist/headless/index.d.cts +83 -75
  12. package/dist/headless/index.d.ts +83 -75
  13. package/dist/headless/index.js +1514 -791
  14. package/dist/headless/index.js.map +1 -1
  15. package/dist/index.cjs +6281 -3190
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +337 -229
  18. package/dist/index.d.ts +337 -229
  19. package/dist/index.js +6362 -3231
  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 +6291 -3206
  30. package/dist/react/index.cjs.map +1 -1
  31. package/dist/react/index.d.cts +239 -186
  32. package/dist/react/index.d.ts +239 -186
  33. package/dist/react/index.js +6338 -3208
  34. package/dist/react/index.js.map +1 -1
  35. package/dist/scan/index.cjs +212 -82
  36. package/dist/scan/index.cjs.map +1 -1
  37. package/dist/scan/index.d.cts +31 -0
  38. package/dist/scan/index.d.ts +31 -0
  39. package/dist/scan/index.js +211 -81
  40. package/dist/scan/index.js.map +1 -1
  41. package/package.json +10 -8
  42. package/templates/claude/api.md +110 -0
  43. package/templates/claude/audit.md +8 -2
  44. package/templates/claude/rules.md +15 -0
@@ -33,11 +33,16 @@ interface Route {
33
33
  path: string;
34
34
  page: string;
35
35
  }
36
+ interface FlowStep {
37
+ entityId: string;
38
+ action?: string;
39
+ }
36
40
  interface Flow {
37
41
  kind: "flow";
38
42
  id: string;
39
43
  loc: Location;
40
44
  touches: string[];
45
+ steps: FlowStep[];
41
46
  }
42
47
  interface Page extends EntityWithMetaBase {
43
48
  kind: "page";
@@ -62,6 +67,26 @@ type EntityByKind<K extends EntityKind> = Extract<Entity, {
62
67
  kind: K;
63
68
  }>;
64
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
+ }
65
90
  interface Registry {
66
91
  add(entity: Entity): void;
67
92
  get<K extends EntityKind>(kind: K, id: string): EntityByKind<K> | undefined;
@@ -69,6 +94,17 @@ interface Registry {
69
94
  query(predicate: (entity: Entity) => boolean): Entity[];
70
95
  byScope(scope: Scope): Entity[];
71
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;
72
108
  }
73
109
 
74
110
  type ThemePreference = "light" | "dark" | "auto";
@@ -87,89 +123,60 @@ interface SessionSnapshot {
87
123
  theme: ThemePreference;
88
124
  resolvedTheme: ResolvedTheme;
89
125
  ingestActive: boolean;
90
- }
91
- interface SessionActions {
92
- hover(ref: EntityRef | null): void;
93
- select(ref: EntityRef | null): void;
94
126
  /**
95
- * Append a view onto the view stack. Pure: never resolves defaults.
127
+ * Identity for the local user. Set once at session creation; gates realtime
128
+ * features (cursor labels, presence) and auto-populates report attribution.
96
129
  */
97
- pushStack(entry: ViewStackEntry): void;
98
- /**
99
- * Remove the top entry from the view stack. No-op when the stack is empty.
100
- */
101
- popStack(): void;
102
- /**
103
- * Empty the view stack.
104
- */
105
- clearStack(): void;
106
- /**
107
- * Open a view by id. If `ref` is omitted, the current `selection` is captured;
108
- * pass `null` explicitly to open the view with no ref context. Thin wrapper
109
- * around `pushStack`.
110
- */
111
- openView(id: string, ref?: EntityRef | null): void;
112
- /**
113
- * Clear the entire view stack. Thin wrapper around `clearStack`.
114
- */
115
- closeView(): void;
116
- setInspectorActive(active: boolean): void;
117
- toggleInspector(): void;
118
- /** Pin the overlay to `ref` until `clearPinnedHighlight` is called. */
119
- pinHighlight(ref: EntityRef): void;
120
- clearPinnedHighlight(): void;
121
- setTheme(theme: ThemePreference, resolved?: ResolvedTheme): void;
122
- setIngest(active: boolean): void;
130
+ user: UserIdentity | null;
131
+ }
132
+ type SessionState = SessionSnapshot;
133
+
134
+ interface NavigationState {
135
+ stack: ViewStackEntry[];
123
136
  }
124
- interface SessionState extends SessionSnapshot {
125
- actions: SessionActions;
137
+ interface NavigationActions {
138
+ push(entry: ViewStackEntry): void;
139
+ pop(): void;
140
+ replace(entry: ViewStackEntry): void;
141
+ clear(): void;
142
+ reset(stack: ViewStackEntry[]): void;
126
143
  }
144
+ type NavigationStore = StoreApi<NavigationState> & {
145
+ nav: NavigationActions;
146
+ };
127
147
 
128
- type SurfaceEvent = {
129
- type: "TOGGLE_INSPECTOR";
130
- } | {
131
- type: "OPEN_PALETTE";
132
- } | {
133
- type: "PUSH_VIEW";
134
- entry: ViewStackEntry;
135
- } | {
136
- type: "POP_VIEW";
137
- } | {
138
- type: "CLOSE";
139
- } | {
140
- type: "ESC";
141
- } | {
142
- type: "CMD_K";
143
- } | {
144
- type: "SELECT";
145
- ref: EntityRef | null;
146
- entry: ViewStackEntry;
147
- } | {
148
- type: "SET_SELECTION";
149
- ref: EntityRef | null;
150
- } | {
151
- type: "HOVER";
152
- ref: EntityRef;
153
- element: HTMLElement | null;
154
- color?: string | null;
155
- } | {
156
- type: "UNHOVER";
157
- } | {
158
- type: "PIN";
159
- ref?: EntityRef;
160
- } | {
161
- type: "UNPIN";
162
- } | {
163
- type: "SET_THEME";
164
- theme: ThemePreference;
165
- resolvedTheme: ResolvedTheme;
166
- } | {
167
- type: "SET_INGEST";
168
- 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;
169
165
  };
170
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
+ }
171
173
  type SessionStore = StoreApi<SessionState> & {
172
- 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;
173
180
  };
174
181
 
175
182
  interface OverlayShowOptions {
@@ -179,6 +186,7 @@ interface OverlayShowOptions {
179
186
  borderStyle?: string;
180
187
  borderWidth?: number;
181
188
  fillOpacity?: number;
189
+ backdrop?: boolean;
182
190
  }
183
191
 
184
192
  type Corner = "top-left" | "top-right" | "bottom-left" | "bottom-right";
@@ -33,11 +33,16 @@ interface Route {
33
33
  path: string;
34
34
  page: string;
35
35
  }
36
+ interface FlowStep {
37
+ entityId: string;
38
+ action?: string;
39
+ }
36
40
  interface Flow {
37
41
  kind: "flow";
38
42
  id: string;
39
43
  loc: Location;
40
44
  touches: string[];
45
+ steps: FlowStep[];
41
46
  }
42
47
  interface Page extends EntityWithMetaBase {
43
48
  kind: "page";
@@ -62,6 +67,26 @@ type EntityByKind<K extends EntityKind> = Extract<Entity, {
62
67
  kind: K;
63
68
  }>;
64
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
+ }
65
90
  interface Registry {
66
91
  add(entity: Entity): void;
67
92
  get<K extends EntityKind>(kind: K, id: string): EntityByKind<K> | undefined;
@@ -69,6 +94,17 @@ interface Registry {
69
94
  query(predicate: (entity: Entity) => boolean): Entity[];
70
95
  byScope(scope: Scope): Entity[];
71
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;
72
108
  }
73
109
 
74
110
  type ThemePreference = "light" | "dark" | "auto";
@@ -87,89 +123,60 @@ interface SessionSnapshot {
87
123
  theme: ThemePreference;
88
124
  resolvedTheme: ResolvedTheme;
89
125
  ingestActive: boolean;
90
- }
91
- interface SessionActions {
92
- hover(ref: EntityRef | null): void;
93
- select(ref: EntityRef | null): void;
94
126
  /**
95
- * Append a view onto the view stack. Pure: never resolves defaults.
127
+ * Identity for the local user. Set once at session creation; gates realtime
128
+ * features (cursor labels, presence) and auto-populates report attribution.
96
129
  */
97
- pushStack(entry: ViewStackEntry): void;
98
- /**
99
- * Remove the top entry from the view stack. No-op when the stack is empty.
100
- */
101
- popStack(): void;
102
- /**
103
- * Empty the view stack.
104
- */
105
- clearStack(): void;
106
- /**
107
- * Open a view by id. If `ref` is omitted, the current `selection` is captured;
108
- * pass `null` explicitly to open the view with no ref context. Thin wrapper
109
- * around `pushStack`.
110
- */
111
- openView(id: string, ref?: EntityRef | null): void;
112
- /**
113
- * Clear the entire view stack. Thin wrapper around `clearStack`.
114
- */
115
- closeView(): void;
116
- setInspectorActive(active: boolean): void;
117
- toggleInspector(): void;
118
- /** Pin the overlay to `ref` until `clearPinnedHighlight` is called. */
119
- pinHighlight(ref: EntityRef): void;
120
- clearPinnedHighlight(): void;
121
- setTheme(theme: ThemePreference, resolved?: ResolvedTheme): void;
122
- setIngest(active: boolean): void;
130
+ user: UserIdentity | null;
131
+ }
132
+ type SessionState = SessionSnapshot;
133
+
134
+ interface NavigationState {
135
+ stack: ViewStackEntry[];
123
136
  }
124
- interface SessionState extends SessionSnapshot {
125
- actions: SessionActions;
137
+ interface NavigationActions {
138
+ push(entry: ViewStackEntry): void;
139
+ pop(): void;
140
+ replace(entry: ViewStackEntry): void;
141
+ clear(): void;
142
+ reset(stack: ViewStackEntry[]): void;
126
143
  }
144
+ type NavigationStore = StoreApi<NavigationState> & {
145
+ nav: NavigationActions;
146
+ };
127
147
 
128
- type SurfaceEvent = {
129
- type: "TOGGLE_INSPECTOR";
130
- } | {
131
- type: "OPEN_PALETTE";
132
- } | {
133
- type: "PUSH_VIEW";
134
- entry: ViewStackEntry;
135
- } | {
136
- type: "POP_VIEW";
137
- } | {
138
- type: "CLOSE";
139
- } | {
140
- type: "ESC";
141
- } | {
142
- type: "CMD_K";
143
- } | {
144
- type: "SELECT";
145
- ref: EntityRef | null;
146
- entry: ViewStackEntry;
147
- } | {
148
- type: "SET_SELECTION";
149
- ref: EntityRef | null;
150
- } | {
151
- type: "HOVER";
152
- ref: EntityRef;
153
- element: HTMLElement | null;
154
- color?: string | null;
155
- } | {
156
- type: "UNHOVER";
157
- } | {
158
- type: "PIN";
159
- ref?: EntityRef;
160
- } | {
161
- type: "UNPIN";
162
- } | {
163
- type: "SET_THEME";
164
- theme: ThemePreference;
165
- resolvedTheme: ResolvedTheme;
166
- } | {
167
- type: "SET_INGEST";
168
- 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;
169
165
  };
170
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
+ }
171
173
  type SessionStore = StoreApi<SessionState> & {
172
- 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;
173
180
  };
174
181
 
175
182
  interface OverlayShowOptions {
@@ -179,6 +186,7 @@ interface OverlayShowOptions {
179
186
  borderStyle?: string;
180
187
  borderWidth?: number;
181
188
  fillOpacity?: number;
189
+ backdrop?: boolean;
182
190
  }
183
191
 
184
192
  type Corner = "top-left" | "top-right" | "bottom-left" | "bottom-right";