@capxul/sdk-react 0.2.0-alpha.4 → 0.2.0-alpha.5

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.
@@ -1,753 +0,0 @@
1
- import React$1, { ReactNode } from 'react';
2
- import { CapxulConfig } from '@capxul/sdk';
3
- import { QueryClient } from '@tanstack/react-query';
4
- import { ARIARole } from 'aria-query';
5
-
6
- /**
7
- * `CapxulTestProvider` — test-only React provider that mounts a
8
- * pre-assembled `@capxul/sdk` client built from the full
9
- * server-augmented `CapxulConfig` (the shape with `data`, `signer`,
10
- * `signing`, etc.).
11
- *
12
- * This is the counterpart to the public `CapxulProvider`, which only
13
- * accepts the secret-safe `BrowserCapxulConfig` discriminated union.
14
- * Tests, the e2e harness, and proof harnesses need to inject already-
15
- * authenticated Convex clients and signers, so the public provider's
16
- * type would reject their config — that's by design.
17
- *
18
- * The test provider does NOT build an `HttpTransport`. The full
19
- * `CapxulConfig` already encodes auth + data wiring, so there is no
20
- * lazy bootstrap to run. `useCapxulStatus()` falls through to its
21
- * synthetic `{ status: "ready" }` snapshot when called inside this
22
- * provider's subtree.
23
- *
24
- * Exported via the `@capxul/sdk-react/proof` subpath. NEVER import
25
- * from app code.
26
- */
27
-
28
- type CapxulTestProviderProps = {
29
- /**
30
- * Full server-augmented Capxul config. Tests pass already-built
31
- * Convex clients (`data`), signers (`signer`), and chain wiring
32
- * (`signing`).
33
- */
34
- readonly config: CapxulConfig;
35
- /**
36
- * Optional TanStack Query `QueryClient`. Defaults to a fresh
37
- * instance scoped to this provider with a 30s `staleTime`.
38
- */
39
- readonly queryClient?: QueryClient;
40
- readonly children: ReactNode;
41
- };
42
- declare function CapxulTestProvider({ config, queryClient, children, }: CapxulTestProviderProps): ReactNode;
43
-
44
- /**
45
- * WARNING: This entrypoint is only available starting with `react-dom@18.0.0-rc.1`
46
- */
47
-
48
-
49
-
50
- declare const REACT_FORM_STATE_SIGIL: unique symbol;
51
- interface ReactFormState {
52
- [REACT_FORM_STATE_SIGIL]: never;
53
- }
54
-
55
- interface HydrationOptions {
56
- formState?: ReactFormState | null;
57
- /**
58
- * Prefix for `useId`.
59
- */
60
- identifierPrefix?: string;
61
- onUncaughtError?:
62
- | ((error: unknown, errorInfo: { componentStack?: string | undefined }) => void)
63
- | undefined;
64
- onRecoverableError?: (error: unknown, errorInfo: ErrorInfo) => void;
65
- onCaughtError?:
66
- | ((
67
- error: unknown,
68
- errorInfo: {
69
- componentStack?: string | undefined;
70
- errorBoundary?: React$1.Component<unknown> | undefined;
71
- },
72
- ) => void)
73
- | undefined;
74
- }
75
-
76
- interface RootOptions {
77
- /**
78
- * Prefix for `useId`.
79
- */
80
- identifierPrefix?: string;
81
- onUncaughtError?:
82
- | ((error: unknown, errorInfo: { componentStack?: string | undefined }) => void)
83
- | undefined;
84
- onRecoverableError?: (error: unknown, errorInfo: ErrorInfo) => void;
85
- onCaughtError?:
86
- | ((
87
- error: unknown,
88
- errorInfo: {
89
- componentStack?: string | undefined;
90
- errorBoundary?: React$1.Component<unknown> | undefined;
91
- },
92
- ) => void)
93
- | undefined;
94
- }
95
-
96
- interface ErrorInfo {
97
- componentStack?: string;
98
- }
99
-
100
- interface Root {
101
- render(children: React$1.ReactNode): void;
102
- unmount(): void;
103
- }
104
-
105
- /**
106
- * Different release channels declare additional types of ReactNode this particular release channel accepts.
107
- * App or library types should never augment this interface.
108
- */
109
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
110
- interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_CREATE_ROOT_CONTAINERS {}
111
-
112
- type Container =
113
- | Element
114
- | DocumentFragment
115
- | Document
116
- | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_CREATE_ROOT_CONTAINERS[
117
- keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_CREATE_ROOT_CONTAINERS
118
- ];
119
-
120
- /**
121
- * createRoot lets you create a root to display React components inside a browser DOM node.
122
- *
123
- * @see {@link https://react.dev/reference/react-dom/client/createRoot API Reference for `createRoot`}
124
- */
125
- declare function createRoot(container: Container, options?: RootOptions): Root;
126
-
127
- /**
128
- * Same as `createRoot()`, but is used to hydrate a container whose HTML contents were rendered by ReactDOMServer.
129
- *
130
- * React will attempt to attach event listeners to the existing markup.
131
- *
132
- * **Example Usage**
133
- *
134
- * ```jsx
135
- * hydrateRoot(document.querySelector('#root'), <App />)
136
- * ```
137
- *
138
- * @see https://react.dev/reference/react-dom/client/hydrateRoot
139
- */
140
- declare function hydrateRoot(
141
- container: Element | Document,
142
- initialChildren: React$1.ReactNode,
143
- options?: HydrationOptions,
144
- ): Root;
145
-
146
- type ReactDOMClient_Container = Container;
147
- type ReactDOMClient_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_CREATE_ROOT_CONTAINERS = DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_CREATE_ROOT_CONTAINERS;
148
- type ReactDOMClient_ErrorInfo = ErrorInfo;
149
- type ReactDOMClient_HydrationOptions = HydrationOptions;
150
- type ReactDOMClient_ReactFormState = ReactFormState;
151
- type ReactDOMClient_Root = Root;
152
- type ReactDOMClient_RootOptions = RootOptions;
153
- declare const ReactDOMClient_createRoot: typeof createRoot;
154
- declare const ReactDOMClient_hydrateRoot: typeof hydrateRoot;
155
- declare namespace ReactDOMClient {
156
- export { type ReactDOMClient_Container as Container, type ReactDOMClient_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_CREATE_ROOT_CONTAINERS as DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_CREATE_ROOT_CONTAINERS, type ReactDOMClient_ErrorInfo as ErrorInfo, type ReactDOMClient_HydrationOptions as HydrationOptions, type ReactDOMClient_ReactFormState as ReactFormState, type ReactDOMClient_Root as Root, type ReactDOMClient_RootOptions as RootOptions, ReactDOMClient_createRoot as createRoot, ReactDOMClient_hydrateRoot as hydrateRoot };
157
- }
158
-
159
- type MatcherFunction = (
160
- content: string,
161
- element: Element | null,
162
- ) => boolean
163
- type Matcher = MatcherFunction | RegExp | number | string
164
-
165
- // Get autocomplete for ARIARole union types, while still supporting another string
166
- // Ref: https://github.com/microsoft/TypeScript/issues/29729#issuecomment-567871939
167
- type ByRoleMatcher = ARIARole | (string & {})
168
-
169
- type NormalizerFn = (text: string) => string
170
-
171
- interface MatcherOptions {
172
- exact?: boolean
173
- /** Use normalizer with getDefaultNormalizer instead */
174
- trim?: boolean
175
- /** Use normalizer with getDefaultNormalizer instead */
176
- collapseWhitespace?: boolean
177
- normalizer?: NormalizerFn
178
- /** suppress suggestions for a specific query */
179
- suggest?: boolean
180
- }
181
-
182
- interface waitForOptions {
183
- container?: HTMLElement
184
- timeout?: number
185
- interval?: number
186
- onTimeout?: (error: Error) => Error
187
- mutationObserverOptions?: MutationObserverInit
188
- }
189
-
190
- interface SelectorMatcherOptions extends MatcherOptions {
191
- selector?: string
192
- ignore?: boolean | string
193
- }
194
-
195
- type QueryByBoundAttribute<T extends HTMLElement = HTMLElement> = (
196
- container: HTMLElement,
197
- id: Matcher,
198
- options?: MatcherOptions,
199
- ) => T | null
200
-
201
- type AllByBoundAttribute<T extends HTMLElement = HTMLElement> = (
202
- container: HTMLElement,
203
- id: Matcher,
204
- options?: MatcherOptions,
205
- ) => T[]
206
-
207
- type FindAllByBoundAttribute<T extends HTMLElement = HTMLElement> = (
208
- container: HTMLElement,
209
- id: Matcher,
210
- options?: MatcherOptions,
211
- waitForElementOptions?: waitForOptions,
212
- ) => Promise<T[]>
213
-
214
- type GetByBoundAttribute<T extends HTMLElement = HTMLElement> = (
215
- container: HTMLElement,
216
- id: Matcher,
217
- options?: MatcherOptions,
218
- ) => T
219
-
220
- type FindByBoundAttribute<T extends HTMLElement = HTMLElement> = (
221
- container: HTMLElement,
222
- id: Matcher,
223
- options?: MatcherOptions,
224
- waitForElementOptions?: waitForOptions,
225
- ) => Promise<T>
226
-
227
- type QueryByText<T extends HTMLElement = HTMLElement> = (
228
- container: HTMLElement,
229
- id: Matcher,
230
- options?: SelectorMatcherOptions,
231
- ) => T | null
232
-
233
- type AllByText<T extends HTMLElement = HTMLElement> = (
234
- container: HTMLElement,
235
- id: Matcher,
236
- options?: SelectorMatcherOptions,
237
- ) => T[]
238
-
239
- type FindAllByText<T extends HTMLElement = HTMLElement> = (
240
- container: HTMLElement,
241
- id: Matcher,
242
- options?: SelectorMatcherOptions,
243
- waitForElementOptions?: waitForOptions,
244
- ) => Promise<T[]>
245
-
246
- type GetByText<T extends HTMLElement = HTMLElement> = (
247
- container: HTMLElement,
248
- id: Matcher,
249
- options?: SelectorMatcherOptions,
250
- ) => T
251
-
252
- type FindByText<T extends HTMLElement = HTMLElement> = (
253
- container: HTMLElement,
254
- id: Matcher,
255
- options?: SelectorMatcherOptions,
256
- waitForElementOptions?: waitForOptions,
257
- ) => Promise<T>
258
-
259
- interface ByRoleOptions {
260
- /** suppress suggestions for a specific query */
261
- suggest?: boolean
262
- /**
263
- * If true includes elements in the query set that are usually excluded from
264
- * the accessibility tree. `role="none"` or `role="presentation"` are included
265
- * in either case.
266
- */
267
- hidden?: boolean
268
- /**
269
- * If true only includes elements in the query set that are marked as
270
- * selected in the accessibility tree, i.e., `aria-selected="true"`
271
- */
272
- selected?: boolean
273
- /**
274
- * If true only includes elements in the query set that are marked as
275
- * busy in the accessibility tree, i.e., `aria-busy="true"`
276
- */
277
- busy?: boolean
278
- /**
279
- * If true only includes elements in the query set that are marked as
280
- * checked in the accessibility tree, i.e., `aria-checked="true"`
281
- */
282
- checked?: boolean
283
- /**
284
- * If true only includes elements in the query set that are marked as
285
- * pressed in the accessibility tree, i.e., `aria-pressed="true"`
286
- */
287
- pressed?: boolean
288
- /**
289
- * Filters elements by their `aria-current` state. `true` and `false` match `aria-current="true"` and `aria-current="false"` (as well as a missing `aria-current` attribute) respectively.
290
- */
291
- current?: boolean | string
292
- /**
293
- * If true only includes elements in the query set that are marked as
294
- * expanded in the accessibility tree, i.e., `aria-expanded="true"`
295
- */
296
- expanded?: boolean
297
- /**
298
- * Includes elements with the `"heading"` role matching the indicated level,
299
- * either by the semantic HTML heading elements `<h1>-<h6>` or matching
300
- * the `aria-level` attribute.
301
- */
302
- level?: number
303
- value?: {
304
- now?: number
305
- min?: number
306
- max?: number
307
- text?: Matcher
308
- }
309
- /**
310
- * Includes every role used in the `role` attribute
311
- * For example *ByRole('progressbar', {queryFallbacks: true})` will find <div role="meter progressbar">`.
312
- */
313
- queryFallbacks?: boolean
314
- /**
315
- * Only considers elements with the specified accessible name.
316
- */
317
- name?:
318
- | RegExp
319
- | string
320
- | ((accessibleName: string, element: Element) => boolean)
321
- /**
322
- * Only considers elements with the specified accessible description.
323
- */
324
- description?:
325
- | RegExp
326
- | string
327
- | ((accessibleDescription: string, element: Element) => boolean)
328
- }
329
-
330
- type AllByRole<T extends HTMLElement = HTMLElement> = (
331
- container: HTMLElement,
332
- role: ByRoleMatcher,
333
- options?: ByRoleOptions,
334
- ) => T[]
335
-
336
- type GetByRole<T extends HTMLElement = HTMLElement> = (
337
- container: HTMLElement,
338
- role: ByRoleMatcher,
339
- options?: ByRoleOptions,
340
- ) => T
341
-
342
- type QueryByRole<T extends HTMLElement = HTMLElement> = (
343
- container: HTMLElement,
344
- role: ByRoleMatcher,
345
- options?: ByRoleOptions,
346
- ) => T | null
347
-
348
- type FindByRole<T extends HTMLElement = HTMLElement> = (
349
- container: HTMLElement,
350
- role: ByRoleMatcher,
351
- options?: ByRoleOptions,
352
- waitForElementOptions?: waitForOptions,
353
- ) => Promise<T>
354
-
355
- type FindAllByRole<T extends HTMLElement = HTMLElement> = (
356
- container: HTMLElement,
357
- role: ByRoleMatcher,
358
- options?: ByRoleOptions,
359
- waitForElementOptions?: waitForOptions,
360
- ) => Promise<T[]>
361
-
362
- declare function getByLabelText<T extends HTMLElement = HTMLElement>(
363
- ...args: Parameters<GetByText<T>>
364
- ): ReturnType<GetByText<T>>
365
- declare function getAllByLabelText<T extends HTMLElement = HTMLElement>(
366
- ...args: Parameters<AllByText<T>>
367
- ): ReturnType<AllByText<T>>
368
- declare function queryByLabelText<T extends HTMLElement = HTMLElement>(
369
- ...args: Parameters<QueryByText<T>>
370
- ): ReturnType<QueryByText<T>>
371
- declare function queryAllByLabelText<T extends HTMLElement = HTMLElement>(
372
- ...args: Parameters<AllByText<T>>
373
- ): ReturnType<AllByText<T>>
374
- declare function findByLabelText<T extends HTMLElement = HTMLElement>(
375
- ...args: Parameters<FindByText<T>>
376
- ): ReturnType<FindByText<T>>
377
- declare function findAllByLabelText<T extends HTMLElement = HTMLElement>(
378
- ...args: Parameters<FindAllByText<T>>
379
- ): ReturnType<FindAllByText<T>>
380
- declare function getByPlaceholderText<T extends HTMLElement = HTMLElement>(
381
- ...args: Parameters<GetByBoundAttribute<T>>
382
- ): ReturnType<GetByBoundAttribute<T>>
383
- declare function getAllByPlaceholderText<T extends HTMLElement = HTMLElement>(
384
- ...args: Parameters<AllByBoundAttribute<T>>
385
- ): ReturnType<AllByBoundAttribute<T>>
386
- declare function queryByPlaceholderText<T extends HTMLElement = HTMLElement>(
387
- ...args: Parameters<QueryByBoundAttribute<T>>
388
- ): ReturnType<QueryByBoundAttribute<T>>
389
- declare function queryAllByPlaceholderText<T extends HTMLElement = HTMLElement>(
390
- ...args: Parameters<AllByBoundAttribute<T>>
391
- ): ReturnType<AllByBoundAttribute<T>>
392
- declare function findByPlaceholderText<T extends HTMLElement = HTMLElement>(
393
- ...args: Parameters<FindByBoundAttribute<T>>
394
- ): ReturnType<FindByBoundAttribute<T>>
395
- declare function findAllByPlaceholderText<T extends HTMLElement = HTMLElement>(
396
- ...args: Parameters<FindAllByBoundAttribute<T>>
397
- ): ReturnType<FindAllByBoundAttribute<T>>
398
- declare function getByText<T extends HTMLElement = HTMLElement>(
399
- ...args: Parameters<GetByText<T>>
400
- ): ReturnType<GetByText<T>>
401
- declare function getAllByText<T extends HTMLElement = HTMLElement>(
402
- ...args: Parameters<AllByText<T>>
403
- ): ReturnType<AllByText<T>>
404
- declare function queryByText<T extends HTMLElement = HTMLElement>(
405
- ...args: Parameters<QueryByText<T>>
406
- ): ReturnType<QueryByText<T>>
407
- declare function queryAllByText<T extends HTMLElement = HTMLElement>(
408
- ...args: Parameters<AllByText<T>>
409
- ): ReturnType<AllByText<T>>
410
- declare function findByText<T extends HTMLElement = HTMLElement>(
411
- ...args: Parameters<FindByText<T>>
412
- ): ReturnType<FindByText<T>>
413
- declare function findAllByText<T extends HTMLElement = HTMLElement>(
414
- ...args: Parameters<FindAllByText<T>>
415
- ): ReturnType<FindAllByText<T>>
416
- declare function getByAltText<T extends HTMLElement = HTMLElement>(
417
- ...args: Parameters<GetByBoundAttribute<T>>
418
- ): ReturnType<GetByBoundAttribute<T>>
419
- declare function getAllByAltText<T extends HTMLElement = HTMLElement>(
420
- ...args: Parameters<AllByBoundAttribute<T>>
421
- ): ReturnType<AllByBoundAttribute<T>>
422
- declare function queryByAltText<T extends HTMLElement = HTMLElement>(
423
- ...args: Parameters<QueryByBoundAttribute<T>>
424
- ): ReturnType<QueryByBoundAttribute<T>>
425
- declare function queryAllByAltText<T extends HTMLElement = HTMLElement>(
426
- ...args: Parameters<AllByBoundAttribute<T>>
427
- ): ReturnType<AllByBoundAttribute<T>>
428
- declare function findByAltText<T extends HTMLElement = HTMLElement>(
429
- ...args: Parameters<FindByBoundAttribute<T>>
430
- ): ReturnType<FindByBoundAttribute<T>>
431
- declare function findAllByAltText<T extends HTMLElement = HTMLElement>(
432
- ...args: Parameters<FindAllByBoundAttribute<T>>
433
- ): ReturnType<FindAllByBoundAttribute<T>>
434
- declare function getByTitle<T extends HTMLElement = HTMLElement>(
435
- ...args: Parameters<GetByBoundAttribute<T>>
436
- ): ReturnType<GetByBoundAttribute<T>>
437
- declare function getAllByTitle<T extends HTMLElement = HTMLElement>(
438
- ...args: Parameters<AllByBoundAttribute<T>>
439
- ): ReturnType<AllByBoundAttribute<T>>
440
- declare function queryByTitle<T extends HTMLElement = HTMLElement>(
441
- ...args: Parameters<QueryByBoundAttribute<T>>
442
- ): ReturnType<QueryByBoundAttribute<T>>
443
- declare function queryAllByTitle<T extends HTMLElement = HTMLElement>(
444
- ...args: Parameters<AllByBoundAttribute<T>>
445
- ): ReturnType<AllByBoundAttribute<T>>
446
- declare function findByTitle<T extends HTMLElement = HTMLElement>(
447
- ...args: Parameters<FindByBoundAttribute<T>>
448
- ): ReturnType<FindByBoundAttribute<T>>
449
- declare function findAllByTitle<T extends HTMLElement = HTMLElement>(
450
- ...args: Parameters<FindAllByBoundAttribute<T>>
451
- ): ReturnType<FindAllByBoundAttribute<T>>
452
- declare function getByDisplayValue<T extends HTMLElement = HTMLElement>(
453
- ...args: Parameters<GetByBoundAttribute<T>>
454
- ): ReturnType<GetByBoundAttribute<T>>
455
- declare function getAllByDisplayValue<T extends HTMLElement = HTMLElement>(
456
- ...args: Parameters<AllByBoundAttribute<T>>
457
- ): ReturnType<AllByBoundAttribute<T>>
458
- declare function queryByDisplayValue<T extends HTMLElement = HTMLElement>(
459
- ...args: Parameters<QueryByBoundAttribute<T>>
460
- ): ReturnType<QueryByBoundAttribute<T>>
461
- declare function queryAllByDisplayValue<T extends HTMLElement = HTMLElement>(
462
- ...args: Parameters<AllByBoundAttribute<T>>
463
- ): ReturnType<AllByBoundAttribute<T>>
464
- declare function findByDisplayValue<T extends HTMLElement = HTMLElement>(
465
- ...args: Parameters<FindByBoundAttribute<T>>
466
- ): ReturnType<FindByBoundAttribute<T>>
467
- declare function findAllByDisplayValue<T extends HTMLElement = HTMLElement>(
468
- ...args: Parameters<FindAllByBoundAttribute<T>>
469
- ): ReturnType<FindAllByBoundAttribute<T>>
470
- declare function getByRole<T extends HTMLElement = HTMLElement>(
471
- ...args: Parameters<GetByRole<T>>
472
- ): ReturnType<GetByRole<T>>
473
- declare function getAllByRole<T extends HTMLElement = HTMLElement>(
474
- ...args: Parameters<AllByRole<T>>
475
- ): ReturnType<AllByRole<T>>
476
- declare function queryByRole<T extends HTMLElement = HTMLElement>(
477
- ...args: Parameters<QueryByRole<T>>
478
- ): ReturnType<QueryByRole<T>>
479
- declare function queryAllByRole<T extends HTMLElement = HTMLElement>(
480
- ...args: Parameters<AllByRole<T>>
481
- ): ReturnType<AllByRole<T>>
482
- declare function findByRole<T extends HTMLElement = HTMLElement>(
483
- ...args: Parameters<FindByRole<T>>
484
- ): ReturnType<FindByRole<T>>
485
- declare function findAllByRole<T extends HTMLElement = HTMLElement>(
486
- ...args: Parameters<FindAllByRole<T>>
487
- ): ReturnType<FindAllByRole<T>>
488
- declare function getByTestId<T extends HTMLElement = HTMLElement>(
489
- ...args: Parameters<GetByBoundAttribute<T>>
490
- ): ReturnType<GetByBoundAttribute<T>>
491
- declare function getAllByTestId<T extends HTMLElement = HTMLElement>(
492
- ...args: Parameters<AllByBoundAttribute<T>>
493
- ): ReturnType<AllByBoundAttribute<T>>
494
- declare function queryByTestId<T extends HTMLElement = HTMLElement>(
495
- ...args: Parameters<QueryByBoundAttribute<T>>
496
- ): ReturnType<QueryByBoundAttribute<T>>
497
- declare function queryAllByTestId<T extends HTMLElement = HTMLElement>(
498
- ...args: Parameters<AllByBoundAttribute<T>>
499
- ): ReturnType<AllByBoundAttribute<T>>
500
- declare function findByTestId<T extends HTMLElement = HTMLElement>(
501
- ...args: Parameters<FindByBoundAttribute<T>>
502
- ): ReturnType<FindByBoundAttribute<T>>
503
- declare function findAllByTestId<T extends HTMLElement = HTMLElement>(
504
- ...args: Parameters<FindAllByBoundAttribute<T>>
505
- ): ReturnType<FindAllByBoundAttribute<T>>
506
-
507
- type queries_AllByBoundAttribute<T extends HTMLElement = HTMLElement> = AllByBoundAttribute<T>;
508
- type queries_AllByRole<T extends HTMLElement = HTMLElement> = AllByRole<T>;
509
- type queries_AllByText<T extends HTMLElement = HTMLElement> = AllByText<T>;
510
- type queries_ByRoleOptions = ByRoleOptions;
511
- type queries_FindAllByBoundAttribute<T extends HTMLElement = HTMLElement> = FindAllByBoundAttribute<T>;
512
- type queries_FindAllByRole<T extends HTMLElement = HTMLElement> = FindAllByRole<T>;
513
- type queries_FindAllByText<T extends HTMLElement = HTMLElement> = FindAllByText<T>;
514
- type queries_FindByBoundAttribute<T extends HTMLElement = HTMLElement> = FindByBoundAttribute<T>;
515
- type queries_FindByRole<T extends HTMLElement = HTMLElement> = FindByRole<T>;
516
- type queries_FindByText<T extends HTMLElement = HTMLElement> = FindByText<T>;
517
- type queries_GetByBoundAttribute<T extends HTMLElement = HTMLElement> = GetByBoundAttribute<T>;
518
- type queries_GetByRole<T extends HTMLElement = HTMLElement> = GetByRole<T>;
519
- type queries_GetByText<T extends HTMLElement = HTMLElement> = GetByText<T>;
520
- type queries_QueryByBoundAttribute<T extends HTMLElement = HTMLElement> = QueryByBoundAttribute<T>;
521
- type queries_QueryByRole<T extends HTMLElement = HTMLElement> = QueryByRole<T>;
522
- type queries_QueryByText<T extends HTMLElement = HTMLElement> = QueryByText<T>;
523
- declare const queries_findAllByAltText: typeof findAllByAltText;
524
- declare const queries_findAllByDisplayValue: typeof findAllByDisplayValue;
525
- declare const queries_findAllByLabelText: typeof findAllByLabelText;
526
- declare const queries_findAllByPlaceholderText: typeof findAllByPlaceholderText;
527
- declare const queries_findAllByRole: typeof findAllByRole;
528
- declare const queries_findAllByTestId: typeof findAllByTestId;
529
- declare const queries_findAllByText: typeof findAllByText;
530
- declare const queries_findAllByTitle: typeof findAllByTitle;
531
- declare const queries_findByAltText: typeof findByAltText;
532
- declare const queries_findByDisplayValue: typeof findByDisplayValue;
533
- declare const queries_findByLabelText: typeof findByLabelText;
534
- declare const queries_findByPlaceholderText: typeof findByPlaceholderText;
535
- declare const queries_findByRole: typeof findByRole;
536
- declare const queries_findByTestId: typeof findByTestId;
537
- declare const queries_findByText: typeof findByText;
538
- declare const queries_findByTitle: typeof findByTitle;
539
- declare const queries_getAllByAltText: typeof getAllByAltText;
540
- declare const queries_getAllByDisplayValue: typeof getAllByDisplayValue;
541
- declare const queries_getAllByLabelText: typeof getAllByLabelText;
542
- declare const queries_getAllByPlaceholderText: typeof getAllByPlaceholderText;
543
- declare const queries_getAllByRole: typeof getAllByRole;
544
- declare const queries_getAllByTestId: typeof getAllByTestId;
545
- declare const queries_getAllByText: typeof getAllByText;
546
- declare const queries_getAllByTitle: typeof getAllByTitle;
547
- declare const queries_getByAltText: typeof getByAltText;
548
- declare const queries_getByDisplayValue: typeof getByDisplayValue;
549
- declare const queries_getByLabelText: typeof getByLabelText;
550
- declare const queries_getByPlaceholderText: typeof getByPlaceholderText;
551
- declare const queries_getByRole: typeof getByRole;
552
- declare const queries_getByTestId: typeof getByTestId;
553
- declare const queries_getByText: typeof getByText;
554
- declare const queries_getByTitle: typeof getByTitle;
555
- declare const queries_queryAllByAltText: typeof queryAllByAltText;
556
- declare const queries_queryAllByDisplayValue: typeof queryAllByDisplayValue;
557
- declare const queries_queryAllByLabelText: typeof queryAllByLabelText;
558
- declare const queries_queryAllByPlaceholderText: typeof queryAllByPlaceholderText;
559
- declare const queries_queryAllByRole: typeof queryAllByRole;
560
- declare const queries_queryAllByTestId: typeof queryAllByTestId;
561
- declare const queries_queryAllByText: typeof queryAllByText;
562
- declare const queries_queryAllByTitle: typeof queryAllByTitle;
563
- declare const queries_queryByAltText: typeof queryByAltText;
564
- declare const queries_queryByDisplayValue: typeof queryByDisplayValue;
565
- declare const queries_queryByLabelText: typeof queryByLabelText;
566
- declare const queries_queryByPlaceholderText: typeof queryByPlaceholderText;
567
- declare const queries_queryByRole: typeof queryByRole;
568
- declare const queries_queryByTestId: typeof queryByTestId;
569
- declare const queries_queryByText: typeof queryByText;
570
- declare const queries_queryByTitle: typeof queryByTitle;
571
- declare namespace queries {
572
- export { type queries_AllByBoundAttribute as AllByBoundAttribute, type queries_AllByRole as AllByRole, type queries_AllByText as AllByText, type queries_ByRoleOptions as ByRoleOptions, type queries_FindAllByBoundAttribute as FindAllByBoundAttribute, type queries_FindAllByRole as FindAllByRole, type queries_FindAllByText as FindAllByText, type queries_FindByBoundAttribute as FindByBoundAttribute, type queries_FindByRole as FindByRole, type queries_FindByText as FindByText, type queries_GetByBoundAttribute as GetByBoundAttribute, type queries_GetByRole as GetByRole, type queries_GetByText as GetByText, type queries_QueryByBoundAttribute as QueryByBoundAttribute, type queries_QueryByRole as QueryByRole, type queries_QueryByText as QueryByText, queries_findAllByAltText as findAllByAltText, queries_findAllByDisplayValue as findAllByDisplayValue, queries_findAllByLabelText as findAllByLabelText, queries_findAllByPlaceholderText as findAllByPlaceholderText, queries_findAllByRole as findAllByRole, queries_findAllByTestId as findAllByTestId, queries_findAllByText as findAllByText, queries_findAllByTitle as findAllByTitle, queries_findByAltText as findByAltText, queries_findByDisplayValue as findByDisplayValue, queries_findByLabelText as findByLabelText, queries_findByPlaceholderText as findByPlaceholderText, queries_findByRole as findByRole, queries_findByTestId as findByTestId, queries_findByText as findByText, queries_findByTitle as findByTitle, queries_getAllByAltText as getAllByAltText, queries_getAllByDisplayValue as getAllByDisplayValue, queries_getAllByLabelText as getAllByLabelText, queries_getAllByPlaceholderText as getAllByPlaceholderText, queries_getAllByRole as getAllByRole, queries_getAllByTestId as getAllByTestId, queries_getAllByText as getAllByText, queries_getAllByTitle as getAllByTitle, queries_getByAltText as getByAltText, queries_getByDisplayValue as getByDisplayValue, queries_getByLabelText as getByLabelText, queries_getByPlaceholderText as getByPlaceholderText, queries_getByRole as getByRole, queries_getByTestId as getByTestId, queries_getByText as getByText, queries_getByTitle as getByTitle, queries_queryAllByAltText as queryAllByAltText, queries_queryAllByDisplayValue as queryAllByDisplayValue, queries_queryAllByLabelText as queryAllByLabelText, queries_queryAllByPlaceholderText as queryAllByPlaceholderText, queries_queryAllByRole as queryAllByRole, queries_queryAllByTestId as queryAllByTestId, queries_queryAllByText as queryAllByText, queries_queryAllByTitle as queryAllByTitle, queries_queryByAltText as queryByAltText, queries_queryByDisplayValue as queryByDisplayValue, queries_queryByLabelText as queryByLabelText, queries_queryByPlaceholderText as queryByPlaceholderText, queries_queryByRole as queryByRole, queries_queryByTestId as queryByTestId, queries_queryByText as queryByText, queries_queryByTitle as queryByTitle };
573
- }
574
-
575
- type Query = (
576
- container: HTMLElement,
577
- ...args: any[]
578
- ) =>
579
- | Error
580
- | HTMLElement
581
- | HTMLElement[]
582
- | Promise<HTMLElement[]>
583
- | Promise<HTMLElement>
584
- | null
585
-
586
- interface Queries {
587
- [T: string]: Query
588
- }
589
-
590
- // TypeScript Version: 3.8
591
-
592
-
593
- /** @deprecated */
594
- type BaseRenderOptions<
595
- Q extends Queries,
596
- Container extends RendererableContainer | HydrateableContainer,
597
- BaseElement extends RendererableContainer | HydrateableContainer,
598
- > = RenderOptions<Q, Container, BaseElement>
599
-
600
- type RendererableContainer = Container
601
- type HydrateableContainer = Parameters<typeof ReactDOMClient['hydrateRoot']>[0]
602
-
603
- interface RenderOptions<
604
- Q extends Queries = typeof queries,
605
- Container extends RendererableContainer | HydrateableContainer = HTMLElement,
606
- BaseElement extends RendererableContainer | HydrateableContainer = Container,
607
- > {
608
- /**
609
- * By default, React Testing Library will create a div and append that div to the document.body. Your React component will be rendered in the created div. If you provide your own HTMLElement container via this option,
610
- * it will not be appended to the document.body automatically.
611
- *
612
- * For example: If you are unit testing a `<tbody>` element, it cannot be a child of a div. In this case, you can
613
- * specify a table as the render container.
614
- *
615
- * @see https://testing-library.com/docs/react-testing-library/api/#container
616
- */
617
- container?: Container | undefined
618
- /**
619
- * Defaults to the container if the container is specified. Otherwise `document.body` is used for the default. This is used as
620
- * the base element for the queries as well as what is printed when you use `debug()`.
621
- *
622
- * @see https://testing-library.com/docs/react-testing-library/api/#baseelement
623
- */
624
- baseElement?: BaseElement | undefined
625
- /**
626
- * If `hydrate` is set to `true`, then it will render with `ReactDOM.hydrate`. This may be useful if you are using server-side
627
- * rendering and use ReactDOM.hydrate to mount your components.
628
- *
629
- * @see https://testing-library.com/docs/react-testing-library/api/#hydrate)
630
- */
631
- hydrate?: boolean | undefined
632
- /**
633
- * Only works if used with React 18.
634
- * Set to `true` if you want to force synchronous `ReactDOM.render`.
635
- * Otherwise `render` will default to concurrent React if available.
636
- */
637
- legacyRoot?: boolean | undefined
638
- /**
639
- * Only supported in React 19.
640
- * Callback called when React catches an error in an Error Boundary.
641
- * Called with the error caught by the Error Boundary, and an `errorInfo` object containing the `componentStack`.
642
- *
643
- * @see {@link https://react.dev/reference/react-dom/client/createRoot#parameters createRoot#options}
644
- */
645
- onCaughtError?: RootOptions extends {
646
- onCaughtError?: infer OnCaughtError
647
- }
648
- ? OnCaughtError
649
- : never
650
- /**
651
- * Callback called when React automatically recovers from errors.
652
- * Called with an error React throws, and an `errorInfo` object containing the `componentStack`.
653
- * Some recoverable errors may include the original error cause as `error.cause`.
654
- *
655
- * @see {@link https://react.dev/reference/react-dom/client/createRoot#parameters createRoot#options}
656
- */
657
- onRecoverableError?: RootOptions['onRecoverableError']
658
- /**
659
- * Not supported at the moment
660
- */
661
- onUncaughtError?: never
662
- /**
663
- * Queries to bind. Overrides the default set from DOM Testing Library unless merged.
664
- *
665
- * @see https://testing-library.com/docs/react-testing-library/api/#queries
666
- */
667
- queries?: Q | undefined
668
- /**
669
- * Pass a React Component as the wrapper option to have it rendered around the inner element. This is most useful for creating
670
- * reusable custom render functions for common data providers. See setup for examples.
671
- *
672
- * @see https://testing-library.com/docs/react-testing-library/api/#wrapper
673
- */
674
- wrapper?: React.JSXElementConstructor<{children: React.ReactNode}> | undefined
675
- /**
676
- * When enabled, <StrictMode> is rendered around the inner element.
677
- * If defined, overrides the value of `reactStrictMode` set in `configure`.
678
- */
679
- reactStrictMode?: boolean
680
- }
681
-
682
- interface RenderHookResult<Result, Props> {
683
- /**
684
- * Triggers a re-render. The props will be passed to your renderHook callback.
685
- */
686
- rerender: (props?: Props) => void
687
- /**
688
- * This is a stable reference to the latest value returned by your renderHook
689
- * callback
690
- */
691
- result: {
692
- /**
693
- * The value returned by your renderHook callback
694
- */
695
- current: Result
696
- }
697
- /**
698
- * Unmounts the test component. This is useful for when you need to test
699
- * any cleanup your useEffects have.
700
- */
701
- unmount: () => void
702
- }
703
-
704
- interface RenderHookOptions<
705
- Props,
706
- Q extends Queries = typeof queries,
707
- Container extends RendererableContainer | HydrateableContainer = HTMLElement,
708
- BaseElement extends RendererableContainer | HydrateableContainer = Container,
709
- > extends BaseRenderOptions<Q, Container, BaseElement> {
710
- /**
711
- * The argument passed to the renderHook callback. Can be useful if you plan
712
- * to use the rerender utility to change the values passed to your hook.
713
- */
714
- initialProps?: Props | undefined
715
- }
716
-
717
- /**
718
- * `renderHookWithCapxul` (live-client variant) — a thin wrapper around
719
- * `@testing-library/react`'s `renderHook` that mounts
720
- * `CapxulTestProvider` so a hook callback executes against a *real*
721
- * `@capxul/sdk` client built from the supplied server-augmented
722
- * `CapxulConfig`.
723
- *
724
- * Distinction from the `ops/proof/react-headless.tsx` variant:
725
- * - `ops/proof/...` mounts a mocked `CapxulClient` for hook contract proofs.
726
- * - This module mounts a live client built by `createCapxulClient` inside
727
- * `CapxulTestProvider`, intended for E2E harness scenarios that exercise
728
- * the real SDK against a real Convex/BetterAuth/signer stack.
729
- *
730
- * Type signatures use only the public `@capxul/sdk` and the
731
- * `@capxul/sdk-react/proof` surfaces — no internal imports.
732
- */
733
-
734
- type RenderHookWithCapxulOptions<Props> = {
735
- /** Live SDK config — `{ data, auth, signer, chain }` shape. */
736
- readonly config: CapxulConfig;
737
- /** Optional passthrough to `@testing-library/react`'s `renderHook`. */
738
- readonly renderHookOptions?: Omit<RenderHookOptions<Props>, "wrapper">;
739
- };
740
- /**
741
- * Render `callback` as a React hook inside a `CapxulTestProvider`
742
- * configured by `options.config`. Returns the standard
743
- * `@testing-library/react` `RenderHookResult` ({ result, rerender,
744
- * unmount, ... }).
745
- *
746
- * NOTE: This is the live-client variant. It assumes a JSDOM (or similar
747
- * DOM-capable) test environment. The harness intentionally does not
748
- * provide a mocked client here — for mocked-client proofs use the
749
- * `ops/proof/react-headless` variant.
750
- */
751
- declare function renderHookWithCapxul<Result, Props = unknown>(callback: (props: Props) => Result, options: RenderHookWithCapxulOptions<Props>): RenderHookResult<Result, Props>;
752
-
753
- export { CapxulTestProvider, type CapxulTestProviderProps, type RenderHookWithCapxulOptions, renderHookWithCapxul };