uidex 0.6.0 → 0.8.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/README.md +3 -3
- package/dist/cli/cli.cjs +2502 -2253
- package/dist/cli/cli.cjs.map +1 -1
- package/dist/headless/index.cjs +86 -703
- package/dist/headless/index.cjs.map +1 -1
- package/dist/headless/index.d.cts +46 -22
- package/dist/headless/index.d.ts +46 -22
- package/dist/headless/index.js +86 -707
- package/dist/headless/index.js.map +1 -1
- package/dist/index.cjs +712 -4149
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +82 -366
- package/dist/index.d.ts +82 -366
- package/dist/index.js +708 -4156
- package/dist/index.js.map +1 -1
- package/dist/playwright/index.cjs +175 -0
- package/dist/playwright/index.cjs.map +1 -1
- package/dist/playwright/index.d.cts +2 -0
- package/dist/playwright/index.d.ts +2 -0
- package/dist/playwright/index.js +167 -0
- package/dist/playwright/index.js.map +1 -1
- package/dist/playwright/states-reporter.cjs +123 -0
- package/dist/playwright/states-reporter.cjs.map +1 -0
- package/dist/playwright/states-reporter.d.cts +46 -0
- package/dist/playwright/states-reporter.d.ts +46 -0
- package/dist/playwright/states-reporter.js +88 -0
- package/dist/playwright/states-reporter.js.map +1 -0
- package/dist/playwright/states.cjs +118 -0
- package/dist/playwright/states.cjs.map +1 -0
- package/dist/playwright/states.d.cts +120 -0
- package/dist/playwright/states.d.ts +120 -0
- package/dist/playwright/states.js +88 -0
- package/dist/playwright/states.js.map +1 -0
- package/dist/react/index.cjs +750 -4113
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +78 -278
- package/dist/react/index.d.ts +78 -278
- package/dist/react/index.js +748 -4135
- package/dist/react/index.js.map +1 -1
- package/dist/scan/index.cjs +2694 -1541
- package/dist/scan/index.cjs.map +1 -1
- package/dist/scan/index.d.cts +482 -19
- package/dist/scan/index.d.ts +482 -19
- package/dist/scan/index.js +2682 -1540
- package/dist/scan/index.js.map +1 -1
- package/package.json +14 -17
- package/templates/claude/SKILL.md +71 -0
- package/templates/claude/references/audit.md +43 -0
- package/templates/claude/{rules.md → references/conventions.md} +25 -28
- package/dist/cloud/index.cjs +0 -472
- package/dist/cloud/index.cjs.map +0 -1
- package/dist/cloud/index.d.cts +0 -82
- package/dist/cloud/index.d.ts +0 -82
- package/dist/cloud/index.js +0 -445
- package/dist/cloud/index.js.map +0 -1
- package/templates/claude/audit.md +0 -43
- /package/templates/claude/{api.md → references/api.md} +0 -0
package/dist/react/index.d.cts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode, ComponentType, ReactElement } from 'react';
|
|
3
3
|
import { StoreApi } from 'zustand/vanilla';
|
|
4
|
-
import { ReportPayload, ReportResult, IngestConfig, ReportListResponse, PinRecord, ArchiveReason } from '@uidex/api-client';
|
|
5
4
|
import { TemplateResult } from 'lit-html';
|
|
6
5
|
|
|
7
6
|
declare const ENTITY_KINDS: readonly ["route", "page", "feature", "widget", "region", "element", "primitive", "flow"];
|
|
@@ -16,6 +15,32 @@ interface EntityRef {
|
|
|
16
15
|
kind: EntityKind;
|
|
17
16
|
id: string;
|
|
18
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* The four kinds every captured route is expected to render — the state-matrix
|
|
20
|
+
* axis. A capture that only shoots the happy path leaves most of the value on
|
|
21
|
+
* the table, so a missing core kind must be captured, waived (the page CANNOT
|
|
22
|
+
* render it), or acknowledged in the MISSING_KINDS baseline.
|
|
23
|
+
*/
|
|
24
|
+
declare const CORE_STATE_KINDS: readonly ["loading", "empty", "populated", "error"];
|
|
25
|
+
type CoreStateKind = (typeof CORE_STATE_KINDS)[number];
|
|
26
|
+
/** `variant` is any state outside the matrix (a dialog, wizard step, multi-currency…). */
|
|
27
|
+
type StateKind = CoreStateKind | "variant";
|
|
28
|
+
/**
|
|
29
|
+
* A declared render state of an entity — the "story"-like unit: a named
|
|
30
|
+
* condition the page/feature/widget can render in (loading / empty / error /
|
|
31
|
+
* multi-currency / …). Enumerated on the entity (not derived from syntax), it
|
|
32
|
+
* is the contract the visual-states capture must satisfy and the anchor for
|
|
33
|
+
* per-state acceptance criteria. Fixtures + capture mechanics stay in the spec;
|
|
34
|
+
* the registry holds only the name (+ optional kind / per-state acceptance).
|
|
35
|
+
*/
|
|
36
|
+
interface StateDecl {
|
|
37
|
+
name: string;
|
|
38
|
+
/** Canonical kind for the state-matrix axis (defaults to `variant`). */
|
|
39
|
+
kind?: StateKind;
|
|
40
|
+
/** Acceptance criteria that only this state can evidence. */
|
|
41
|
+
acceptance?: string[];
|
|
42
|
+
description?: string;
|
|
43
|
+
}
|
|
19
44
|
interface Metadata {
|
|
20
45
|
name?: string;
|
|
21
46
|
description?: string;
|
|
@@ -25,6 +50,21 @@ interface Metadata {
|
|
|
25
50
|
flows?: readonly string[];
|
|
26
51
|
features?: string[];
|
|
27
52
|
widgets?: string[];
|
|
53
|
+
/** Declared render states (see StateDecl); the capture-completeness gate. */
|
|
54
|
+
states?: StateDecl[];
|
|
55
|
+
/**
|
|
56
|
+
* `false` opts this page/feature/widget out of visual-states capture forever
|
|
57
|
+
* (a redirect, a static notice, an internal target). The page-coverage gate
|
|
58
|
+
* treats an opted-out route as accounted-for. Reason belongs in `description`.
|
|
59
|
+
*/
|
|
60
|
+
capture?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Per-core-kind waivers: a core kind this page's route legitimately CANNOT
|
|
63
|
+
* render (a create form has no `empty`), mapped to a substantive reason. The
|
|
64
|
+
* state-matrix gate treats a waived kind as accounted-for. A waiver is a
|
|
65
|
+
* permanent design statement — unlike MISSING_KINDS backlog, which is debt.
|
|
66
|
+
*/
|
|
67
|
+
waivers?: Partial<Record<CoreStateKind, string>>;
|
|
28
68
|
}
|
|
29
69
|
interface EntityWithMetaBase {
|
|
30
70
|
id: string;
|
|
@@ -102,16 +142,10 @@ interface Registry {
|
|
|
102
142
|
setReports(kind: EntityKind, id: string, reports: readonly ReportRecord[]): void;
|
|
103
143
|
getReports(kind: EntityKind, id: string): readonly ReportRecord[];
|
|
104
144
|
listReportKeys(): readonly string[];
|
|
105
|
-
|
|
145
|
+
closeReport?: (reportId: string, status?: string) => void | Promise<void>;
|
|
106
146
|
onReportsChange(cb: () => void): () => void;
|
|
107
147
|
}
|
|
108
148
|
|
|
109
|
-
interface UserIdentity {
|
|
110
|
-
id: string;
|
|
111
|
-
name?: string;
|
|
112
|
-
avatar?: string;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
149
|
type ThemePreference = "light" | "dark" | "auto";
|
|
116
150
|
type ResolvedTheme = "light" | "dark";
|
|
117
151
|
interface ViewStackEntry {
|
|
@@ -119,20 +153,13 @@ interface ViewStackEntry {
|
|
|
119
153
|
ref: EntityRef | null;
|
|
120
154
|
}
|
|
121
155
|
interface SessionSnapshot {
|
|
122
|
-
hover: EntityRef | null;
|
|
123
|
-
selection: EntityRef | null;
|
|
124
156
|
stack: ViewStackEntry[];
|
|
125
157
|
/** Sticky overlay highlight. Set by "Highlight Element" actions; cleared on Esc. */
|
|
126
158
|
pinnedHighlight: EntityRef | null;
|
|
127
|
-
|
|
159
|
+
/** Mirrored from the mode store; the surface mode the session is currently in. */
|
|
160
|
+
mode: SurfaceMode;
|
|
128
161
|
theme: ThemePreference;
|
|
129
162
|
resolvedTheme: ResolvedTheme;
|
|
130
|
-
ingestActive: boolean;
|
|
131
|
-
/**
|
|
132
|
-
* Identity for the local user. Set once at session creation; gates realtime
|
|
133
|
-
* features (cursor labels, presence) and auto-populates report attribution.
|
|
134
|
-
*/
|
|
135
|
-
user: UserIdentity | null;
|
|
136
163
|
}
|
|
137
164
|
type SessionState = SessionSnapshot;
|
|
138
165
|
|
|
@@ -142,7 +169,6 @@ interface NavigationState {
|
|
|
142
169
|
interface NavigationActions {
|
|
143
170
|
push(entry: ViewStackEntry): void;
|
|
144
171
|
pop(): void;
|
|
145
|
-
replace(entry: ViewStackEntry): void;
|
|
146
172
|
clear(): void;
|
|
147
173
|
reset(stack: ViewStackEntry[]): void;
|
|
148
174
|
}
|
|
@@ -153,7 +179,6 @@ type NavigationStore = StoreApi<NavigationState> & {
|
|
|
153
179
|
type SurfaceMode = "idle" | "inspecting" | "palette" | "viewing";
|
|
154
180
|
interface ModeSnapshot {
|
|
155
181
|
mode: SurfaceMode;
|
|
156
|
-
inspectorActive: boolean;
|
|
157
182
|
}
|
|
158
183
|
interface ModeTransitions {
|
|
159
184
|
openPalette(): void;
|
|
@@ -179,110 +204,10 @@ type SessionStore = StoreApi<SessionState> & {
|
|
|
179
204
|
readonly nav: NavigationStore;
|
|
180
205
|
readonly mode: ModeStore;
|
|
181
206
|
readonly highlight: HighlightActions;
|
|
182
|
-
select(ref: EntityRef | null): void;
|
|
183
207
|
setTheme(theme: ThemePreference, resolved?: ResolvedTheme): void;
|
|
184
|
-
setIngest(active: boolean): void;
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
type ConsoleLevel = "warn" | "error";
|
|
188
|
-
interface ConsoleEntry {
|
|
189
|
-
level: ConsoleLevel;
|
|
190
|
-
message: string;
|
|
191
|
-
timestamp: string;
|
|
192
|
-
}
|
|
193
|
-
interface ConsoleCaptureOptions {
|
|
194
|
-
limit?: number;
|
|
195
|
-
target?: Console;
|
|
196
|
-
now?: () => Date;
|
|
197
|
-
}
|
|
198
|
-
interface ConsoleCapture {
|
|
199
|
-
start(): void;
|
|
200
|
-
stop(): void;
|
|
201
|
-
readonly isActive: boolean;
|
|
202
|
-
entries(): readonly ConsoleEntry[];
|
|
203
|
-
clear(): void;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
interface NetworkEntry {
|
|
207
|
-
method: string;
|
|
208
|
-
url: string;
|
|
209
|
-
status: number;
|
|
210
|
-
timestamp: string;
|
|
211
|
-
error?: string;
|
|
212
|
-
}
|
|
213
|
-
interface NetworkCaptureOptions {
|
|
214
|
-
limit?: number;
|
|
215
|
-
target?: {
|
|
216
|
-
fetch?: typeof fetch;
|
|
217
|
-
};
|
|
218
|
-
now?: () => Date;
|
|
219
|
-
}
|
|
220
|
-
interface NetworkCapture {
|
|
221
|
-
start(): void;
|
|
222
|
-
stop(): void;
|
|
223
|
-
readonly isActive: boolean;
|
|
224
|
-
entries(): readonly NetworkEntry[];
|
|
225
|
-
clear(): void;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
type RealtimePresenceUser = {
|
|
229
|
-
userId: string;
|
|
230
|
-
name: string;
|
|
231
|
-
avatar: string | null;
|
|
232
208
|
};
|
|
233
|
-
type RealtimeChannelState = "connecting" | "connected" | "disconnected";
|
|
234
|
-
interface RealtimeConnectOpts {
|
|
235
|
-
user: UserIdentity;
|
|
236
|
-
route: string;
|
|
237
|
-
}
|
|
238
|
-
interface RealtimeChannel {
|
|
239
|
-
readonly state: RealtimeChannelState;
|
|
240
|
-
connect(): void;
|
|
241
|
-
disconnect(): void;
|
|
242
|
-
joinRoute(route: string): void;
|
|
243
|
-
onPresence(cb: (users: RealtimePresenceUser[]) => void): () => void;
|
|
244
|
-
onPin(cb: (pin: PinRecord) => void): () => void;
|
|
245
|
-
}
|
|
246
|
-
interface CloudAdapter<TPayload = ReportPayload, TResult = ReportResult, TIntegrations = {
|
|
247
|
-
getConfig(): Promise<IngestConfig>;
|
|
248
|
-
getCachedConfig(): IngestConfig | null;
|
|
249
|
-
}> {
|
|
250
|
-
readonly reports: {
|
|
251
|
-
submit(payload: TPayload): Promise<TResult>;
|
|
252
|
-
list?(opts?: {
|
|
253
|
-
page?: number;
|
|
254
|
-
limit?: number;
|
|
255
|
-
}): Promise<ReportListResponse>;
|
|
256
|
-
};
|
|
257
|
-
readonly integrations: TIntegrations;
|
|
258
|
-
readonly realtime: {
|
|
259
|
-
connect(opts: RealtimeConnectOpts): RealtimeChannel;
|
|
260
|
-
};
|
|
261
|
-
readonly pins: {
|
|
262
|
-
list(params: {
|
|
263
|
-
route?: string;
|
|
264
|
-
entities?: string;
|
|
265
|
-
}): Promise<PinRecord[]>;
|
|
266
|
-
archive(reportId: string, reason?: ArchiveReason): Promise<void>;
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
209
|
|
|
270
|
-
|
|
271
|
-
captureConsole?: boolean;
|
|
272
|
-
captureNetwork?: boolean;
|
|
273
|
-
consoleLimit?: number;
|
|
274
|
-
networkLimit?: number;
|
|
275
|
-
consoleTarget?: ConsoleCaptureOptions["target"];
|
|
276
|
-
networkTarget?: NetworkCaptureOptions["target"];
|
|
277
|
-
now?: () => Date;
|
|
278
|
-
}
|
|
279
|
-
interface Ingest {
|
|
280
|
-
start(): void;
|
|
281
|
-
stop(): void;
|
|
282
|
-
readonly isActive: boolean;
|
|
283
|
-
readonly console: ConsoleCapture | null;
|
|
284
|
-
readonly network: NetworkCapture | null;
|
|
285
|
-
}
|
|
210
|
+
type Corner = "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
286
211
|
|
|
287
212
|
interface OverlayShowOptions {
|
|
288
213
|
label?: string;
|
|
@@ -294,8 +219,6 @@ interface OverlayShowOptions {
|
|
|
294
219
|
backdrop?: boolean;
|
|
295
220
|
}
|
|
296
221
|
|
|
297
|
-
type Corner = "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
298
|
-
|
|
299
222
|
interface RouteMatch {
|
|
300
223
|
view: View;
|
|
301
224
|
priority: number;
|
|
@@ -314,7 +237,7 @@ interface Router {
|
|
|
314
237
|
isFavorite(ref: EntityRef): boolean;
|
|
315
238
|
}
|
|
316
239
|
|
|
317
|
-
type ViewSurface = ListSurface | DetailSurface
|
|
240
|
+
type ViewSurface = ListSurface | DetailSurface;
|
|
318
241
|
interface ListSurface {
|
|
319
242
|
kind: "list";
|
|
320
243
|
id: string;
|
|
@@ -441,9 +364,16 @@ type DetailSection = {
|
|
|
441
364
|
id: "routes";
|
|
442
365
|
paths: readonly string[];
|
|
443
366
|
filterable?: boolean;
|
|
444
|
-
}
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* `url` renders immediately; `load` fetches lazily (cloud pins travel
|
|
370
|
+
* without their screenshot) and the section stays hidden until — and
|
|
371
|
+
* unless — the promise resolves with a data URL.
|
|
372
|
+
*/
|
|
373
|
+
| {
|
|
445
374
|
id: "screenshot";
|
|
446
|
-
url
|
|
375
|
+
url?: string;
|
|
376
|
+
load?: () => Promise<string | null>;
|
|
447
377
|
} | {
|
|
448
378
|
id: "metadata";
|
|
449
379
|
entries: readonly MetadataEntry[];
|
|
@@ -452,102 +382,6 @@ interface MetadataEntry {
|
|
|
452
382
|
label: string;
|
|
453
383
|
value: string;
|
|
454
384
|
}
|
|
455
|
-
interface FormSurface {
|
|
456
|
-
kind: "form";
|
|
457
|
-
id: string;
|
|
458
|
-
fields: readonly FormField[];
|
|
459
|
-
submit: FormSubmit;
|
|
460
|
-
initial?: Record<string, FormValue>;
|
|
461
|
-
/**
|
|
462
|
-
* Optional Standard Schema (Zod v4, Valibot, ArkType, etc.) run against the
|
|
463
|
-
* collected form values before `submit.onSubmit`. On failure, issues are
|
|
464
|
-
* routed to the matching `<FieldError>` and submission is skipped.
|
|
465
|
-
*/
|
|
466
|
-
schema?: StandardSchemaV1<Record<string, unknown>>;
|
|
467
|
-
/**
|
|
468
|
-
* Promise resolving to a base64 screenshot data URL. When provided, the
|
|
469
|
-
* form renderer shows a thumbnail preview above the fields.
|
|
470
|
-
*/
|
|
471
|
-
screenshotPreview?: Promise<string | null>;
|
|
472
|
-
}
|
|
473
|
-
/**
|
|
474
|
-
* Minimal StandardSchemaV1 surface — kept inline so the SDK doesn't need a
|
|
475
|
-
* type-level dep on any specific validator package.
|
|
476
|
-
*/
|
|
477
|
-
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
478
|
-
readonly "~standard": {
|
|
479
|
-
readonly version: 1;
|
|
480
|
-
readonly vendor: string;
|
|
481
|
-
readonly validate: (value: unknown) => StandardSchemaResult<Output> | Promise<StandardSchemaResult<Output>>;
|
|
482
|
-
readonly types?: {
|
|
483
|
-
readonly input: Input;
|
|
484
|
-
readonly output: Output;
|
|
485
|
-
};
|
|
486
|
-
};
|
|
487
|
-
}
|
|
488
|
-
type StandardSchemaResult<Output> = {
|
|
489
|
-
readonly value: Output;
|
|
490
|
-
readonly issues?: undefined;
|
|
491
|
-
} | {
|
|
492
|
-
readonly issues: ReadonlyArray<StandardSchemaIssue>;
|
|
493
|
-
};
|
|
494
|
-
interface StandardSchemaIssue {
|
|
495
|
-
readonly message: string;
|
|
496
|
-
readonly path?: ReadonlyArray<PropertyKey | {
|
|
497
|
-
readonly key: PropertyKey;
|
|
498
|
-
}>;
|
|
499
|
-
}
|
|
500
|
-
interface FormSubmit {
|
|
501
|
-
label: string;
|
|
502
|
-
onSubmit: (values: Record<string, FormValue>) => FormSubmitResult | void | Promise<FormSubmitResult | void>;
|
|
503
|
-
}
|
|
504
|
-
type FormSubmitResult = {
|
|
505
|
-
status: "success";
|
|
506
|
-
message?: string;
|
|
507
|
-
link?: {
|
|
508
|
-
url: string;
|
|
509
|
-
label?: string;
|
|
510
|
-
};
|
|
511
|
-
resetFields?: readonly string[];
|
|
512
|
-
} | {
|
|
513
|
-
status: "error";
|
|
514
|
-
message: string;
|
|
515
|
-
/** Per-field error messages keyed by field `name`. */
|
|
516
|
-
fieldErrors?: Record<string, string>;
|
|
517
|
-
};
|
|
518
|
-
type FormValue = string | boolean;
|
|
519
|
-
interface FormFieldBase {
|
|
520
|
-
name: string;
|
|
521
|
-
label: string;
|
|
522
|
-
}
|
|
523
|
-
type FormField = (FormFieldBase & {
|
|
524
|
-
kind: "select";
|
|
525
|
-
options: readonly {
|
|
526
|
-
value: string;
|
|
527
|
-
label: string;
|
|
528
|
-
}[];
|
|
529
|
-
required?: boolean;
|
|
530
|
-
value?: string;
|
|
531
|
-
}) | (FormFieldBase & {
|
|
532
|
-
kind: "text";
|
|
533
|
-
placeholder?: string;
|
|
534
|
-
required?: boolean;
|
|
535
|
-
value?: string;
|
|
536
|
-
}) | (FormFieldBase & {
|
|
537
|
-
kind: "email";
|
|
538
|
-
placeholder?: string;
|
|
539
|
-
required?: boolean;
|
|
540
|
-
value?: string;
|
|
541
|
-
}) | (FormFieldBase & {
|
|
542
|
-
kind: "textarea";
|
|
543
|
-
placeholder?: string;
|
|
544
|
-
required?: boolean;
|
|
545
|
-
rows?: number;
|
|
546
|
-
value?: string;
|
|
547
|
-
}) | (FormFieldBase & {
|
|
548
|
-
kind: "checkbox";
|
|
549
|
-
value?: boolean;
|
|
550
|
-
});
|
|
551
385
|
|
|
552
386
|
interface ViewPalette {
|
|
553
387
|
label: string;
|
|
@@ -571,13 +405,6 @@ interface HighlightController {
|
|
|
571
405
|
interface ViewContext {
|
|
572
406
|
ref: EntityRef | null;
|
|
573
407
|
registry: Registry;
|
|
574
|
-
cloud: CloudAdapter<unknown, unknown, unknown> | null;
|
|
575
|
-
/**
|
|
576
|
-
* Local user identity from `createUidex`'s `user` option, or `null` when
|
|
577
|
-
* unconfigured. Views that auto-populate attribution (e.g. report
|
|
578
|
-
* `reporterName`) read this here instead of touching the session store.
|
|
579
|
-
*/
|
|
580
|
-
user: UserIdentity | null;
|
|
581
408
|
views: Router;
|
|
582
409
|
/** Push a view onto the stack. Unregistered ids are a no-op. */
|
|
583
410
|
push: (target: ViewPushTarget) => void;
|
|
@@ -593,11 +420,6 @@ interface ViewContext {
|
|
|
593
420
|
highlight: HighlightController;
|
|
594
421
|
/** Snapshot of the current view stack (top-most last). */
|
|
595
422
|
getStack: () => readonly ViewStackEntry[];
|
|
596
|
-
pushEscapeLayer(handler: EscapeHandler): Cleanup;
|
|
597
|
-
/** Called after a report submission succeeds, to refresh pins etc. */
|
|
598
|
-
onAfterSubmit?: () => void;
|
|
599
|
-
/** Return the current route pattern. Falls back to `location.pathname`. */
|
|
600
|
-
getRoute?: () => string;
|
|
601
423
|
}
|
|
602
424
|
interface ShellHint {
|
|
603
425
|
key: string;
|
|
@@ -642,8 +464,9 @@ interface View {
|
|
|
642
464
|
* when the declared target has been removed from the host.
|
|
643
465
|
*/
|
|
644
466
|
focusTarget?: (root: HTMLElement, ctx: ViewContext) => HTMLElement | null;
|
|
645
|
-
|
|
646
|
-
|
|
467
|
+
/** Required unless `render` is provided. */
|
|
468
|
+
surface?: (ctx: ViewContext) => ViewSurface;
|
|
469
|
+
/** Direct render for integration adapters (React, etc.). Takes precedence over `surface` when both are present. */
|
|
647
470
|
render?: (ctx: ViewContext, root: HTMLElement) => Cleanup | void;
|
|
648
471
|
parent?: (ref: EntityRef | null) => ViewStackEntry | null;
|
|
649
472
|
}
|
|
@@ -656,7 +479,6 @@ interface PaletteShortcut {
|
|
|
656
479
|
/** Require Shift. Default: false. */
|
|
657
480
|
shift?: boolean;
|
|
658
481
|
}
|
|
659
|
-
type EscapeHandler = () => boolean;
|
|
660
482
|
|
|
661
483
|
interface CreateUidexOptions {
|
|
662
484
|
theme?: ThemePreference;
|
|
@@ -665,38 +487,13 @@ interface CreateUidexOptions {
|
|
|
665
487
|
initialCorner?: Corner;
|
|
666
488
|
/** Shown as a label at the start of the menu bar. */
|
|
667
489
|
appTitle?: string;
|
|
668
|
-
cloud?: CloudAdapter | null;
|
|
669
490
|
dev?: boolean;
|
|
670
491
|
/** Register bundled default views. Defaults to `true`. */
|
|
671
492
|
defaultViews?: boolean;
|
|
672
493
|
/** Additional views to register (after defaults). */
|
|
673
494
|
views?: readonly View[];
|
|
674
|
-
/**
|
|
675
|
-
* Override ingest behaviour. When `cloud` is non-null, ingest auto-enables
|
|
676
|
-
* (both console and network capture). Pass `null` to disable entirely, or
|
|
677
|
-
* an options object to override either channel.
|
|
678
|
-
*/
|
|
679
|
-
ingest?: IngestOptions | null;
|
|
680
495
|
/** Keyboard shortcut for the command palette. Defaults to Cmd+K / Ctrl+K. */
|
|
681
496
|
shortcut?: PaletteShortcut;
|
|
682
|
-
/**
|
|
683
|
-
* Identity for the local user. Required to opt into realtime collaborative
|
|
684
|
-
* features (peer cursors, presence). When omitted, realtime stays
|
|
685
|
-
* disconnected and report attribution falls back to whatever the user
|
|
686
|
-
* types in the report form.
|
|
687
|
-
*/
|
|
688
|
-
user?: UserIdentity;
|
|
689
|
-
/** Git context for pin filtering. Typically mirrors `cloud({ git })`. */
|
|
690
|
-
git?: {
|
|
691
|
-
branch?: string;
|
|
692
|
-
commit?: string;
|
|
693
|
-
};
|
|
694
|
-
/**
|
|
695
|
-
* Return the current route pattern (e.g. `/users/:id`). Used for
|
|
696
|
-
* route-based pin matching and report attribution. When omitted, the SDK
|
|
697
|
-
* falls back to `location.pathname`.
|
|
698
|
-
*/
|
|
699
|
-
getRoute?: () => string;
|
|
700
497
|
}
|
|
701
498
|
interface Uidex {
|
|
702
499
|
mount(target?: Element): void;
|
|
@@ -704,24 +501,19 @@ interface Uidex {
|
|
|
704
501
|
readonly registry: Registry;
|
|
705
502
|
readonly session: SessionStore;
|
|
706
503
|
readonly views: Router;
|
|
707
|
-
readonly cloud: CloudAdapter | null;
|
|
708
|
-
readonly ingest: Ingest | null;
|
|
709
504
|
readonly shadowRoot: ShadowRoot | null;
|
|
710
505
|
}
|
|
711
506
|
|
|
712
507
|
interface UidexProviderProps {
|
|
713
508
|
/**
|
|
714
509
|
* Pre-built uidex instance (e.g. the `uidex` export from `uidex.gen.ts`).
|
|
715
|
-
* When provided, `
|
|
510
|
+
* When provided, `config` is ignored.
|
|
716
511
|
*/
|
|
717
512
|
instance?: Uidex;
|
|
718
|
-
|
|
719
|
-
cloud?: CloudAdapter | null;
|
|
720
|
-
user?: UserIdentity;
|
|
721
|
-
config?: Omit<CreateUidexOptions, "cloud" | "user">;
|
|
513
|
+
config?: CreateUidexOptions;
|
|
722
514
|
children?: ReactNode;
|
|
723
515
|
}
|
|
724
|
-
declare function UidexProvider({ instance: externalInstance,
|
|
516
|
+
declare function UidexProvider({ instance: externalInstance, config, children, }: UidexProviderProps): react_jsx_runtime.JSX.Element;
|
|
725
517
|
|
|
726
518
|
declare class UidexContextError extends Error {
|
|
727
519
|
constructor(hookName: string);
|
|
@@ -752,16 +544,24 @@ interface KindChipProps {
|
|
|
752
544
|
declare function KindChip({ kind, label, withKindName, className, }: KindChipProps): ReactElement;
|
|
753
545
|
|
|
754
546
|
interface UidexDevtoolsProps {
|
|
547
|
+
/**
|
|
548
|
+
* Populates the entity registry (typically `loadRegistry` from `uidex.gen.ts`).
|
|
549
|
+
* Must be idempotent: it is called once per created instance, and under React
|
|
550
|
+
* StrictMode the effect runs setup→cleanup→setup, so it may be invoked against
|
|
551
|
+
* a short-lived instance that is discarded before mount.
|
|
552
|
+
*/
|
|
755
553
|
loadRegistry: (target: Registry) => Registry;
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
554
|
+
/**
|
|
555
|
+
* Optional deferred hydration — populate the registry with data that need not
|
|
556
|
+
* be present at mount (typically the thin element/region source locations from
|
|
557
|
+
* `uidex.gen.locs.ts`, dynamic-imported so they land in a separate chunk). Run
|
|
558
|
+
* on an idle callback after mount, so the initial devtools chunk stays small
|
|
559
|
+
* and the copy-source-path metadata streams in shortly after. Idempotent, like
|
|
560
|
+
* `loadRegistry`.
|
|
561
|
+
*/
|
|
562
|
+
loadDeferred?: (target: Registry) => void | Promise<void>;
|
|
563
|
+
config?: CreateUidexOptions;
|
|
764
564
|
}
|
|
765
|
-
declare function UidexDevtools({ loadRegistry,
|
|
565
|
+
declare function UidexDevtools({ loadRegistry, loadDeferred, config, }: UidexDevtoolsProps): react_jsx_runtime.JSX.Element | null;
|
|
766
566
|
|
|
767
567
|
export { KindChip, type KindChipProps, type ReactViewDef, UidexContextError, UidexDevtools, type UidexDevtoolsProps, UidexMount, type UidexMountProps, UidexProvider, type UidexProviderProps, createReactView, useUidex };
|