uidex 0.2.4 → 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 (67) hide show
  1. package/README.md +253 -353
  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 +6902 -9801
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +901 -146
  19. package/dist/index.d.ts +901 -146
  20. package/dist/index.js +6896 -9805
  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 +30 -53
  25. package/dist/playwright/index.d.ts +30 -53
  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 +6936 -9808
  35. package/dist/react/index.cjs.map +1 -1
  36. package/dist/react/index.d.cts +673 -146
  37. package/dist/react/index.d.ts +673 -146
  38. package/dist/react/index.js +6980 -9811
  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 +71 -65
  47. package/templates/claude/audit.md +37 -0
  48. package/templates/claude/rules.md +212 -0
  49. package/claude/audit-command.md +0 -46
  50. package/claude/rules.md +0 -167
  51. package/dist/api/index.cjs +0 -254
  52. package/dist/api/index.cjs.map +0 -1
  53. package/dist/api/index.d.cts +0 -236
  54. package/dist/api/index.d.ts +0 -236
  55. package/dist/api/index.js +0 -226
  56. package/dist/api/index.js.map +0 -1
  57. package/dist/core/index.cjs +0 -11045
  58. package/dist/core/index.cjs.map +0 -1
  59. package/dist/core/index.d.cts +0 -424
  60. package/dist/core/index.d.ts +0 -424
  61. package/dist/core/index.global.js +0 -66516
  62. package/dist/core/index.global.js.map +0 -1
  63. package/dist/core/index.js +0 -10995
  64. package/dist/core/index.js.map +0 -1
  65. package/dist/core/style.css +0 -1529
  66. package/dist/scripts/cli.cjs +0 -3904
  67. package/uidex.schema.json +0 -93
@@ -0,0 +1,214 @@
1
+ import { StoreApi } from 'zustand/vanilla';
2
+
3
+ declare const ENTITY_KINDS: readonly ["route", "page", "feature", "widget", "region", "element", "primitive", "flow"];
4
+ type EntityKind = (typeof ENTITY_KINDS)[number];
5
+ type Scope = string;
6
+ interface Location {
7
+ file: string;
8
+ line?: number;
9
+ column?: number;
10
+ }
11
+ interface EntityRef {
12
+ kind: EntityKind;
13
+ id: string;
14
+ }
15
+ interface Metadata {
16
+ name?: string;
17
+ description?: string;
18
+ acceptance?: string[];
19
+ notes?: string;
20
+ composes?: EntityRef[];
21
+ flows?: readonly string[];
22
+ features?: string[];
23
+ widgets?: string[];
24
+ }
25
+ interface EntityWithMetaBase {
26
+ id: string;
27
+ loc?: Location;
28
+ scopes?: Scope[];
29
+ meta?: Metadata;
30
+ }
31
+ interface Route {
32
+ kind: "route";
33
+ path: string;
34
+ page: string;
35
+ }
36
+ interface Flow {
37
+ kind: "flow";
38
+ id: string;
39
+ loc: Location;
40
+ touches: string[];
41
+ }
42
+ interface Page extends EntityWithMetaBase {
43
+ kind: "page";
44
+ }
45
+ interface Feature extends EntityWithMetaBase {
46
+ kind: "feature";
47
+ }
48
+ interface Widget extends EntityWithMetaBase {
49
+ kind: "widget";
50
+ }
51
+ interface Region extends EntityWithMetaBase {
52
+ kind: "region";
53
+ }
54
+ interface Element$1 extends EntityWithMetaBase {
55
+ kind: "element";
56
+ }
57
+ interface Primitive extends EntityWithMetaBase {
58
+ kind: "primitive";
59
+ }
60
+ type Entity = Route | Page | Feature | Widget | Region | Element$1 | Primitive | Flow;
61
+ type EntityByKind<K extends EntityKind> = Extract<Entity, {
62
+ kind: K;
63
+ }>;
64
+
65
+ interface Registry {
66
+ add(entity: Entity): void;
67
+ get<K extends EntityKind>(kind: K, id: string): EntityByKind<K> | undefined;
68
+ list<K extends EntityKind>(kind: K): ReadonlyArray<EntityByKind<K>>;
69
+ query(predicate: (entity: Entity) => boolean): Entity[];
70
+ byScope(scope: Scope): Entity[];
71
+ touchedBy(flowId: string): Entity[];
72
+ }
73
+
74
+ type ThemePreference = "light" | "dark" | "auto";
75
+ type ResolvedTheme = "light" | "dark";
76
+ interface ViewStackEntry {
77
+ id: string;
78
+ ref: EntityRef | null;
79
+ }
80
+ interface SessionSnapshot {
81
+ hover: EntityRef | null;
82
+ selection: EntityRef | null;
83
+ stack: ViewStackEntry[];
84
+ /** Sticky overlay highlight. Set by "Highlight Element" actions; cleared on Esc. */
85
+ pinnedHighlight: EntityRef | null;
86
+ inspectorActive: boolean;
87
+ theme: ThemePreference;
88
+ resolvedTheme: ResolvedTheme;
89
+ ingestActive: boolean;
90
+ }
91
+ interface SessionActions {
92
+ hover(ref: EntityRef | null): void;
93
+ select(ref: EntityRef | null): void;
94
+ /**
95
+ * Append a view onto the view stack. Pure: never resolves defaults.
96
+ */
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;
123
+ }
124
+ interface SessionState extends SessionSnapshot {
125
+ actions: SessionActions;
126
+ }
127
+
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;
169
+ };
170
+
171
+ type SessionStore = StoreApi<SessionState> & {
172
+ send(event: SurfaceEvent): void;
173
+ };
174
+
175
+ interface OverlayShowOptions {
176
+ label?: string;
177
+ color?: string;
178
+ padding?: number;
179
+ borderStyle?: string;
180
+ borderWidth?: number;
181
+ fillOpacity?: number;
182
+ }
183
+
184
+ type Corner = "top-left" | "top-right" | "bottom-left" | "bottom-right";
185
+
186
+ interface CreateHeadlessOptions {
187
+ theme?: ThemePreference;
188
+ resolvedTheme?: ResolvedTheme;
189
+ stylesheets?: string[];
190
+ initialCorner?: Corner;
191
+ appTitle?: string;
192
+ }
193
+ interface HeadlessOverlay {
194
+ show(target: Element, opts?: OverlayShowOptions): void;
195
+ hide(): void;
196
+ readonly isVisible: boolean;
197
+ }
198
+ interface HeadlessInspector {
199
+ start(): void;
200
+ stop(): void;
201
+ readonly isActive: boolean;
202
+ }
203
+ interface Headless {
204
+ mount(target?: Element): void;
205
+ unmount(): void;
206
+ readonly registry: Registry;
207
+ readonly session: SessionStore;
208
+ readonly overlay: HeadlessOverlay;
209
+ readonly inspector: HeadlessInspector;
210
+ readonly shadowRoot: ShadowRoot | null;
211
+ }
212
+ declare function createHeadless(options?: CreateHeadlessOptions): Headless;
213
+
214
+ export { type CreateHeadlessOptions, type Headless, type HeadlessInspector, type HeadlessOverlay, createHeadless };