twd-js 1.7.2 → 1.7.3

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 (59) hide show
  1. package/README.md +26 -4
  2. package/dist/asserts/index.d.ts +2 -0
  3. package/dist/bundled.d.ts +1 -1
  4. package/dist/bundled.es.js +8 -4
  5. package/dist/cli.js +11 -11
  6. package/dist/commands/mockBridge.d.ts +117 -0
  7. package/dist/commands/url.d.ts +33 -0
  8. package/dist/commands/viewport.d.ts +2 -0
  9. package/dist/commands/visit.d.ts +1 -0
  10. package/dist/constants/version.d.ts +1 -0
  11. package/dist/global.d.ts +20 -0
  12. package/dist/index.cjs.js +26 -26
  13. package/dist/index.d.ts +8 -664
  14. package/dist/index.es.js +540 -525
  15. package/dist/initializers/initSidebar.d.ts +29 -0
  16. package/dist/initializers/initTests.d.ts +36 -0
  17. package/dist/mock-sw.js +1 -1
  18. package/dist/plugin/removeMockServiceWorker.d.ts +18 -0
  19. package/dist/plugin/twdHmr.d.ts +45 -0
  20. package/dist/proxies/domMessage.d.ts +1 -0
  21. package/dist/proxies/eventsMessage.d.ts +1 -0
  22. package/dist/proxies/screenDom.d.ts +45 -0
  23. package/dist/proxies/userEvent.d.ts +4 -0
  24. package/dist/runner-ci.d.ts +12 -28
  25. package/dist/runner.d.ts +52 -63
  26. package/dist/twd-types.d.ts +120 -0
  27. package/dist/twd.d.ts +291 -0
  28. package/dist/ui/ClosedSidebar.d.ts +6 -0
  29. package/dist/ui/Icons/BaseIcon.d.ts +7 -0
  30. package/dist/ui/Icons/ChevronDown.d.ts +2 -0
  31. package/dist/ui/Icons/ChevronRight.d.ts +2 -0
  32. package/dist/ui/Icons/Loader.d.ts +2 -0
  33. package/dist/ui/Icons/MockRequestIcon.d.ts +2 -0
  34. package/dist/ui/Icons/Play.d.ts +2 -0
  35. package/dist/ui/LogItem.d.ts +6 -0
  36. package/dist/ui/MockRulesButton.d.ts +1 -0
  37. package/dist/ui/MockedComponent.d.ts +6 -0
  38. package/dist/ui/SearchInput.d.ts +6 -0
  39. package/dist/ui/SkipOnlyName.d.ts +8 -0
  40. package/dist/ui/TWDSidebar.d.ts +20 -0
  41. package/dist/ui/TestList.d.ts +8 -0
  42. package/dist/ui/TestListItem.d.ts +19 -0
  43. package/dist/ui/componentMocks.d.ts +3 -0
  44. package/dist/ui/hooks/useLayout.d.ts +6 -0
  45. package/dist/ui/index.d.ts +1 -0
  46. package/dist/ui/utils/buildTreeFromHandlers.d.ts +16 -0
  47. package/dist/ui/utils/chaiErrorFormat.d.ts +22 -0
  48. package/dist/ui/utils/filterTree.d.ts +2 -0
  49. package/dist/ui/utils/formatLogs.d.ts +30 -0
  50. package/dist/ui/utils/screenReaderMessages.d.ts +9 -0
  51. package/dist/ui/utils/styles.d.ts +7 -0
  52. package/dist/ui/utils/theme.d.ts +74 -0
  53. package/dist/ui.d.ts +2 -10
  54. package/dist/utils/assertionMessage.d.ts +1 -0
  55. package/dist/utils/log.d.ts +1 -0
  56. package/dist/utils/wait.d.ts +3 -0
  57. package/dist/utils/waitFor.d.ts +2 -0
  58. package/dist/vite-plugin.d.ts +2 -67
  59. package/package.json +31 -7
package/dist/index.d.ts CHANGED
@@ -1,664 +1,8 @@
1
- import { configure } from '@testing-library/dom';
2
- import { default as default_2 } from '@testing-library/user-event';
3
- import { expect } from 'chai';
4
- import { JSX } from 'react/jsx-runtime';
5
- import { screen as screen_2 } from '@testing-library/dom';
6
-
7
- /**
8
- * All assertion names, including negated ones.
9
- */
10
- declare type AnyAssertion = Negatable_2<AssertionName>;
11
-
12
- /**
13
- * All assertion names, including negated ones.
14
- */
15
- declare type AnyURLAssertion = Negatable<URLAssertionName>;
16
-
17
- /**
18
- * Maps assertion name to its argument tuple.
19
- */
20
- declare type ArgsFor<A extends AnyAssertion> = A extends `not.${infer Base extends AssertionName}` ? AssertionArgs[Base] : A extends AssertionName ? AssertionArgs[A] : never;
21
-
22
- /**
23
- * Argument types for each assertion.
24
- */
25
- declare type AssertionArgs = {
26
- "have.text": [expected: string];
27
- "contain.text": [expected: string];
28
- "be.empty": [];
29
- "have.attr": [attr: string, value: string];
30
- "have.value": [value: string];
31
- "be.disabled": [];
32
- "be.enabled": [];
33
- "be.checked": [];
34
- "be.selected": [];
35
- "be.focused": [];
36
- "be.visible": [];
37
- "have.class": [className: string];
38
- };
39
-
40
- /**
41
- * Types and interfaces for the TWD testing library.
42
- *
43
- * @module twd-types
44
- */
45
- /**
46
- * All supported assertion names for the `should` function.
47
- *
48
- * @example
49
- * api.should("have.text", "Hello");
50
- * api.should("be.empty");
51
- */
52
- declare type AssertionName = "have.text" | "contain.text" | "be.empty" | "have.attr" | "have.value" | "be.disabled" | "be.enabled" | "be.checked" | "be.selected" | "be.focused" | "be.visible" | "have.class";
53
-
54
- export declare const configureScreenDom: typeof configure;
55
-
56
- export declare const defaultTheme: TWDTheme;
57
-
58
- export { expect }
59
-
60
- /**
61
- * Initialize Vite test loading.
62
- * @param testModules - The test modules to load.
63
- * @param component - The React component to render the sidebar.
64
- * @param createRoot - Function to create a React root.
65
- * @param theme - Optional theme customization
66
- * @example
67
- * ```ts
68
- * if (import.meta.env.DEV) {
69
- * const testModules = import.meta.glob("./example.twd.test.ts");
70
- * const { initTests, TWDSidebar } = await import('twd-js');
71
- * await initTests(testModules, <TWDSidebar open={true} position="left" />, createRoot, {
72
- * primary: '#ff0000',
73
- * background: '#ffffff'
74
- * });
75
- * }
76
- * ```
77
- */
78
- export declare const initTests: (testModules: TestModule, Component: React.ReactNode, createRoot: (el: HTMLElement) => {
79
- render: (el: React.ReactNode) => void;
80
- }, theme?: Partial<TWDTheme>) => Promise<void>;
81
-
82
- /**
83
- * Injects theme CSS variables into the document
84
- * This should be called once when the sidebar is initialized
85
- */
86
- export declare function injectTheme(theme?: Partial<TWDTheme>): void;
87
-
88
- /**
89
- * Negatable assertion names (e.g., 'not.have.text').
90
- */
91
- declare type Negatable<T extends string> = T | `not.${T}`;
92
-
93
- /**
94
- * Negatable assertion names (e.g., 'not.have.text').
95
- */
96
- declare type Negatable_2<T extends string> = T | `not.${T}`;
97
-
98
- declare interface Options {
99
- /** HTTP method to match (e.g. `"GET"`, `"POST"`). */
100
- method: string;
101
- /** URL string or RegExp to match against the request URL. */
102
- url: string | RegExp;
103
- /** The mocked response body returned to the client. */
104
- response: unknown;
105
- /** HTTP status code for the mocked response (default: `200`). */
106
- status?: number;
107
- /** Headers to include in the mocked response. */
108
- responseHeaders?: Record<string, string>;
109
- /** Whether the `url` field should be treated as a regex pattern. */
110
- urlRegex?: boolean;
111
- /** Delay in milliseconds before returning the mocked response. */
112
- delay?: number;
113
- }
114
-
115
- declare type Rule = {
116
- /** HTTP method to match (e.g. `"GET"`, `"POST"`). */
117
- method: string;
118
- /** URL string or RegExp to match against the request URL. */
119
- url: string | RegExp;
120
- /** The mocked response body returned to the client. */
121
- response: unknown;
122
- /** Unique identifier for this mock rule, used with `waitForRequest`. */
123
- alias: string;
124
- /** Whether this rule has been matched by an actual request. Set automatically by the service worker. */
125
- executed?: boolean;
126
- /**
127
- * The parsed request body sent by the client.
128
- * For JSON requests this is the parsed object, for form data an object of key/value pairs, for text a string.
129
- * Access fields directly: `rule.request.email`, **not** `rule.request.body.email`.
130
- */
131
- request?: any;
132
- /** HTTP status code for the mocked response (default: `200`). */
133
- status?: number;
134
- /** Headers to include in the mocked response. */
135
- responseHeaders?: Record<string, string>;
136
- /** Whether the `url` field should be treated as a regex pattern. */
137
- urlRegex?: boolean;
138
- /** Delay in milliseconds before returning the mocked response. */
139
- delay?: number;
140
- /** Number of times this rule has been matched. Updated automatically by the service worker. */
141
- hitCount?: number;
142
- };
143
-
144
- declare type ScreenDom = typeof screen_2;
145
-
146
- /**
147
- * screenDom - Scoped queries that exclude the TWD sidebar
148
- *
149
- * Searches only within the main app container (typically #root).
150
- * Use this for most queries to avoid matching elements in the sidebar.
151
- *
152
- * Note: This will NOT find portal-rendered elements (modals, dialogs) that are
153
- * rendered outside the root container. For portals, use `screenDomGlobal` instead.
154
- */
155
- export declare const screenDom: ScreenDom;
156
-
157
- /**
158
- * screenDomGlobal - Global queries that search the entire document.body
159
- *
160
- * Searches all elements in document.body, including portal-rendered elements
161
- * (modals, dialogs, tooltips, etc.).
162
- *
163
- * ⚠️ WARNING: This may also match elements inside the TWD sidebar if your selectors
164
- * are not specific enough. Use more specific queries (e.g., getByRole with name)
165
- * to avoid matching sidebar elements.
166
- *
167
- * Use this when:
168
- * - Querying portal-rendered elements (modals, dialogs)
169
- * - You need to search outside the root container
170
- *
171
- * Example:
172
- * ```ts
173
- * // For a modal rendered via portal
174
- * const modal = screenDomGlobal.getByRole('dialog', { name: 'Confirm' });
175
- * ```
176
- */
177
- export declare const screenDomGlobal: ScreenDom;
178
-
179
- /**
180
- * Overloads for the `should` function, for best IntelliSense.
181
- *
182
- * @example
183
- * twd.should("have.text", "Hello");
184
- * twd.should("be.empty");
185
- * twd.should("have.class", "active");
186
- */
187
- declare type ShouldFn = {
188
- (name: "have.text", expected: string): TWDElemAPI;
189
- (name: "not.have.text", expected: string): TWDElemAPI;
190
- (name: "contain.text", expected: string): TWDElemAPI;
191
- (name: "not.contain.text", expected: string): TWDElemAPI;
192
- (name: "be.empty"): TWDElemAPI;
193
- (name: "not.be.empty"): TWDElemAPI;
194
- (name: "have.attr", attr: string, value: string): TWDElemAPI;
195
- (name: "not.have.attr", attr: string, value: string): TWDElemAPI;
196
- (name: "have.value", value: string): TWDElemAPI;
197
- (name: "not.have.value", value: string): TWDElemAPI;
198
- (name: "be.disabled"): TWDElemAPI;
199
- (name: "not.be.disabled"): TWDElemAPI;
200
- (name: "be.enabled"): TWDElemAPI;
201
- (name: "not.be.enabled"): TWDElemAPI;
202
- (name: "be.checked"): TWDElemAPI;
203
- (name: "not.be.checked"): TWDElemAPI;
204
- (name: "be.selected"): TWDElemAPI;
205
- (name: "not.be.selected"): TWDElemAPI;
206
- (name: "be.focused"): TWDElemAPI;
207
- (name: "not.be.focused"): TWDElemAPI;
208
- (name: "be.visible"): TWDElemAPI;
209
- (name: "not.be.visible"): TWDElemAPI;
210
- (name: "have.class", className: string): TWDElemAPI;
211
- (name: "not.have.class", className: string): TWDElemAPI;
212
- };
213
-
214
- /**
215
- * A record of test module paths to their loader functions.
216
- * Each function returns a promise that resolves when the module is loaded.
217
- * This is typically used with Vite's `import.meta.glob` to dynamically import test modules.
218
- * @example
219
- * ```ts
220
- * const testModules = {
221
- * './test1.twd.test.ts': () => import('./test1.twd.test.ts'),
222
- * './test2.twd.test.ts': () => import('./test2.twd.test.ts'),
223
- * };
224
- * ```
225
- */
226
- declare type TestModule = Record<string, () => Promise<unknown>>;
227
-
228
- /**
229
- * Mini Cypress-style helpers for DOM testing.
230
- * @namespace twd
231
- */
232
- export declare const twd: TWDAPI;
233
-
234
- declare interface TWDAPI {
235
- /**
236
- * Finds an element by selector and returns the TWD API for it.
237
- * @param selector CSS selector
238
- * @returns {Promise<TWDElemAPI>} The TWD API for the element
239
- *
240
- * @example
241
- * ```ts
242
- * const btn = await twd.get("button");
243
- *
244
- * ```
245
- *
246
- */
247
- get: (selector: string) => Promise<TWDElemAPI>;
248
- /**
249
- * Sets the value of an input element and dispatches an input event. We recommend using this only for range, color, time inputs.
250
- * @param el The input element
251
- * @param value The value to set
252
- *
253
- * @example
254
- * ```ts
255
- * const input = await twd.get("input[type='time']");
256
- * twd.setInputValue(input.el, "13:30");
257
- *
258
- * ```
259
- */
260
- setInputValue: (el: Element, value: string) => void;
261
- /**
262
- * Finds multiple elements by selector and returns an array of TWD APIs for them.
263
- * @param selector CSS selector
264
- * @returns {Promise<TWDElemAPI[]>} Array of TWD APIs for the elements
265
- *
266
- * @example
267
- * ```ts
268
- * const items = await twd.getAll(".item");
269
- * items.at(0).should("be.visible");
270
- * items.at(1).should("contain.text", "Hello");
271
- * expect(items).to.have.length(3);
272
- * ```
273
- */
274
- getAll: (selector: string) => Promise<TWDElemAPI[]>;
275
- /**
276
- * Simulates visiting a URL (SPA navigation).
277
- * @param url The URL to visit
278
- * @param [reload] Whether to force a reload even if already on the URL (optional)
279
- *
280
- * @example
281
- * ```ts
282
- * twd.visit("/contact");
283
- * // visit with reload
284
- * twd.visit("/contact", true);
285
- * ```
286
- */
287
- visit: (url: string, reload?: boolean) => Promise<void>;
288
- /**
289
- * Mock a network request.
290
- *
291
- * @param alias Identifier for the mock rule. Useful for `waitForRequest()`.
292
- * @param options Options to configure the mock:
293
- * - `method`: HTTP method ("GET", "POST", …)
294
- * - `url`: URL string or RegExp to match
295
- * - `response`: Body of the mocked response
296
- * - `status`: (optional) HTTP status code (default: 200)
297
- * - `responseHeaders`: (optional) Response headers
298
- * - `delay`: (optional) Delay in ms before returning the response
299
- *
300
- * @example
301
- * ```ts
302
- * mockRequest("getUser", {
303
- * method: "GET",
304
- * url: /\/api\/user\/\d+/,
305
- * response: { id: 1, name: "Kevin" },
306
- * status: 200,
307
- * responseHeaders: { "x-mock": "true" }
308
- * });
309
- * ```
310
- */
311
- mockRequest: (alias: string, options: Options) => Promise<void>;
312
- /**
313
- * Wait for a mocked request to be made.
314
- * @param alias The alias of the mock rule to wait for
315
- * @param retries The number of retries to make
316
- * @param retryDelay The delay between retries
317
- * @return The matched rule (with body if applicable)
318
- *
319
- * @example
320
- * ```ts
321
- * const rule = await twd.waitForRequest("aliasId");
322
- * console.log(rule.body);
323
- * const rule = await twd.waitForRequest("aliasId", 5, 100);
324
- * console.log(rule.body);
325
- *
326
- * ```
327
- */
328
- waitForRequest: (alias: string, retries?: number, retryDelay?: number) => Promise<Rule>;
329
- /**
330
- * wait for a list of mocked requests to be made.
331
- * @param aliases The aliases of the mock rules to wait for
332
- * @returns The matched rules (with body if applicable)
333
- * @example
334
- * ```ts
335
- * const rules = await waitForRequests(["getUser", "postComment"]);
336
- * ```
337
- */
338
- waitForRequests: (aliases: string[]) => Promise<Rule[]>;
339
- /**
340
- * URL-related assertions.
341
- *
342
- * @example
343
- * ```ts
344
- * twd.url().should("eq", "http://localhost:3000/contact");
345
- * twd.url().should("contain.url", "/contact");
346
- *
347
- * ```
348
- */
349
- url: () => URLCommandAPI;
350
- /**
351
- * Initializes request mocking (registers the service worker).
352
- * @param [path] service worker absolute path (optional)
353
- *
354
- * @example
355
- * ```ts
356
- * await twd.initRequestMocking();
357
- * // init with custom service worker path
358
- * await twd.initRequestMocking('/test-path/mock-sw.js');
359
- * ```
360
- */
361
- initRequestMocking: (path?: string) => Promise<void>;
362
- /**
363
- * Clears all request mock rules.
364
- *
365
- * @example
366
- * ```ts
367
- * twd.clearRequestMockRules();
368
- *
369
- * ```
370
- */
371
- clearRequestMockRules: () => void;
372
- /**
373
- * Gets all current request mock rules.
374
- *
375
- * @example
376
- * ```ts
377
- * const rules = twd.getRequestMockRules();
378
- * console.log(rules);
379
- * ```
380
- */
381
- getRequestMockRules: () => Rule[];
382
- /**
383
- * Gets the number of times a specific mock rule was hit.
384
- * @param alias The alias of the mock rule
385
- * @returns The number of times the rule was matched
386
- *
387
- * @example
388
- * ```ts
389
- * const count = twd.getRequestCount("getUser");
390
- * expect(count).to.equal(2);
391
- * ```
392
- */
393
- getRequestCount: (alias: string) => number;
394
- /**
395
- * Gets a snapshot of all mock rule hit counts.
396
- * @returns An object mapping rule aliases to their hit counts
397
- *
398
- * @example
399
- * ```ts
400
- * const counts = twd.getRequestCounts();
401
- * expect(counts).to.deep.equal({ getUser: 2, listPosts: 1 });
402
- * ```
403
- */
404
- getRequestCounts: () => Record<string, number>;
405
- /**
406
- * Waits for a specified time.
407
- * @param time Time in milliseconds to wait
408
- * @returns A promise that resolves after the specified time
409
- * @example
410
- * ```ts
411
- * await twd.wait(500); // wait for 500ms
412
- * ```
413
- */
414
- wait: (time: number) => Promise<void>;
415
- /**
416
- * Retries a callback until it stops throwing or the timeout expires.
417
- * Use this instead of `twd.wait(ms)` to wait for conditions rather than fixed delays.
418
- *
419
- * @param callback Function to retry — can be sync or async. Should throw if the condition is not yet met.
420
- * @param options Optional timeout, interval, and message settings
421
- * @returns A promise that resolves with the callback's return value when it succeeds
422
- *
423
- * @example
424
- * ```ts
425
- * // Wait for an analytics event and return it
426
- * const event = await twd.waitFor(() => {
427
- * const ev = findEvent("purchase");
428
- * expect(ev).to.exist;
429
- * return ev;
430
- * }, { message: "purchase event to fire" });
431
- *
432
- * // Wait for an element (single expression)
433
- * const heading = await twd.waitFor(() => screenDom.getByRole("heading", { name: /checkout/i }));
434
- *
435
- * // Fire-and-forget (void) — still works as before
436
- * await twd.waitFor(() => {
437
- * expect(submitButton.disabled).to.be.false;
438
- * });
439
- * ```
440
- */
441
- waitFor: <T>(callback: () => T | Promise<T>, options?: WaitForOptions) => Promise<T>;
442
- /**
443
- * Asserts something about the element.
444
- * @param el The element to assert on
445
- * @param name The name of the assertion.
446
- * @param args Arguments for the assertion.
447
- * @returns The same API for chaining.
448
- * @example
449
- * ```ts
450
- * const button = await twd.get("button");
451
- * const text = screenDom.getByText("Hello");
452
- * twd.should(button.el, "have.text", "Hello");
453
- * twd.should(text, "be.empty");
454
- * twd.should(button.el, "have.class", "active");
455
- * ```
456
- */
457
- should: (el: Element, name: AnyAssertion, ...args: ArgsFor<AnyAssertion>) => void;
458
- /**
459
- * Mock a component.
460
- * @param name The name of the component to mock
461
- * @param component The component to mock
462
- * @returns The mocked component
463
- * @example
464
- * ```ts
465
- * twd.mockComponent("Button", Button);
466
- * ```
467
- */
468
- mockComponent: (name: string, component: React.ComponentType<any>) => void;
469
- /**
470
- * Clears all component mocks.
471
- *
472
- * @example
473
- * ```ts
474
- * twd.clearComponentMocks();
475
- * ```
476
- */
477
- clearComponentMocks: () => void;
478
- /**
479
- * Asserts that an element does not exist in the DOM.
480
- * @param selector CSS selector of the element to check
481
- * @returns A promise that resolves if the element does not exist, or rejects if it does
482
- *
483
- * @example
484
- * ```ts
485
- * await twd.notExists(".non-existent");
486
- * ```
487
- */
488
- notExists: (selector: string) => Promise<void>;
489
- /**
490
- * Simulates a viewport size by constraining body dimensions, overriding
491
- * `window.innerWidth`/`window.innerHeight` and `window.matchMedia()`, and
492
- * rewriting CSS `@media` rules to match the simulated dimensions.
493
- * Call with no arguments to reset to the original viewport.
494
- *
495
- * @param width Viewport width in pixels
496
- * @param height Viewport height in pixels (optional — omit to leave height unconstrained)
497
- *
498
- * @example
499
- * ```ts
500
- * twd.viewport(375, 667); // mobile
501
- * twd.viewport(768); // tablet width, height unconstrained
502
- * twd.viewport(); // reset
503
- * ```
504
- */
505
- viewport: (width?: number, height?: number) => void;
506
- /**
507
- * Resets the viewport to its original size (undoes a previous `twd.viewport()` call).
508
- *
509
- * @example
510
- * ```ts
511
- * twd.resetViewport();
512
- * ```
513
- */
514
- resetViewport: () => void;
515
- }
516
-
517
- /**
518
- * The main API returned by `twd.get()`.
519
- *
520
- * @example
521
- * ```ts
522
- * const btn = await twd.get("button");
523
- * btn.should("have.text", "Clicked").click();
524
- *
525
- * ```
526
- *
527
- */
528
- declare interface TWDElemAPI {
529
- /** The underlying DOM element. */
530
- el: Element;
531
- /**
532
- * Asserts something about the element.
533
- * @param name The name of the assertion.
534
- * @param args Arguments for the assertion.
535
- * @returns The same API for chaining.
536
- *
537
- * @example
538
- * ```ts
539
- * const btn = await twd.get("button");
540
- * btn.should("have.text", "Click me").should("not.be.disabled");
541
- *
542
- * ```
543
- *
544
- */
545
- should: ShouldFn;
546
- }
547
-
548
- export declare const TWDSidebar: ({ open, position, search }: TWDSidebarProps) => JSX.Element;
549
-
550
- declare interface TWDSidebarProps {
551
- /**
552
- * Whether the sidebar is open by default
553
- */
554
- open: boolean;
555
- /**
556
- * Sidebar position
557
- * - left: Sidebar on the left side (default)
558
- * - right: Sidebar on the right side
559
- *
560
- * @default "left"
561
- */
562
- position?: "left" | "right";
563
- /**
564
- * Whether to show the search/filter input
565
- */
566
- search?: boolean;
567
- }
568
-
569
- /**
570
- * TWD Theme Configuration
571
- *
572
- * This file defines CSS variables that can be customized by users
573
- * to personalize their TWD UI experience.
574
- *
575
- * Users can override these variables by setting them in their CSS:
576
- *
577
- * ```css
578
- * :root {
579
- * --twd-primary: #2563eb;
580
- * --twd-background: #1e293b;
581
- * ... other variables
582
- * }
583
- *
584
- */
585
- export declare interface TWDTheme {
586
- primary: string;
587
- background: string;
588
- backgroundSecondary: string;
589
- border: string;
590
- borderLight: string;
591
- text: string;
592
- textSecondary: string;
593
- textMuted: string;
594
- describeBg: string;
595
- describeText: string;
596
- describeBorder: string;
597
- success: string;
598
- successBg: string;
599
- error: string;
600
- errorBg: string;
601
- warning: string;
602
- warningBg: string;
603
- skip: string;
604
- skipBg: string;
605
- buttonPrimary: string;
606
- buttonPrimaryText: string;
607
- buttonSecondary: string;
608
- buttonSecondaryText: string;
609
- buttonBorder: string;
610
- spacingXs: string;
611
- spacingSm: string;
612
- spacingMd: string;
613
- spacingLg: string;
614
- spacingXl: string;
615
- fontSizeXs: string;
616
- fontSizeSm: string;
617
- fontSizeMd: string;
618
- fontSizeLg: string;
619
- fontWeightNormal: string;
620
- fontWeightMedium: string;
621
- fontWeightBold: string;
622
- sidebarWidth: string;
623
- borderRadius: string;
624
- borderRadiusLg: string;
625
- shadow: string;
626
- shadowSm: string;
627
- zIndexSidebar: string;
628
- zIndexSticky: string;
629
- animationDuration: string;
630
- iconColor: string;
631
- iconColorSecondary: string;
632
- }
633
-
634
- /**
635
- * All supported assertion names for the `should` function in url command
636
- *
637
- * @example
638
- * twd.url().should("contain.url", "/new-page");
639
- * twd.url().should("eq", "http://localhost:3000/new-page");
640
- */
641
- declare type URLAssertionName = "eq" | "contain.url";
642
-
643
- declare type URLCommandAPI = {
644
- location: Location;
645
- should: (name: AnyURLAssertion, value: string, retries?: number) => Promise<string>;
646
- };
647
-
648
- declare type UserEvent = typeof default_2;
649
-
650
- export declare const userEvent: UserEvent;
651
-
652
- /**
653
- * Options for `twd.waitFor()`.
654
- */
655
- declare interface WaitForOptions {
656
- /** Max time to wait in ms. Default: 2000 */
657
- timeout?: number;
658
- /** Poll interval in ms. Default: 50 */
659
- interval?: number;
660
- /** Context message included in timeout errors */
661
- message?: string;
662
- }
663
-
664
- export { }
1
+ export { twd } from './twd';
2
+ export { TWDSidebar } from './ui/TWDSidebar';
3
+ export { initTests } from './initializers/initTests';
4
+ export { expect } from 'chai';
5
+ export { userEvent } from './proxies/userEvent';
6
+ export { screenDom, screenDomGlobal, configureScreenDom } from './proxies/screenDom';
7
+ export type { TWDTheme } from './ui/utils/theme';
8
+ export { defaultTheme, injectTheme } from './ui/utils/theme';