twd-js 1.3.4 → 1.4.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/dist/bundled.d.ts +5 -0
- package/dist/bundled.es.js +603 -433
- package/dist/bundled.umd.js +7 -2
- package/dist/index.cjs.js +44 -39
- package/dist/index.d.ts +76 -2
- package/dist/index.es.js +3945 -3782
- package/dist/mock-sw.js +1 -1
- package/package.json +6 -4
package/dist/index.d.ts
CHANGED
|
@@ -53,6 +53,8 @@ declare type AssertionName = "have.text" | "contain.text" | "be.empty" | "have.a
|
|
|
53
53
|
|
|
54
54
|
export declare const configureScreenDom: typeof configure;
|
|
55
55
|
|
|
56
|
+
export declare const defaultTheme: TWDTheme;
|
|
57
|
+
|
|
56
58
|
export { expect }
|
|
57
59
|
|
|
58
60
|
/**
|
|
@@ -60,18 +62,28 @@ export { expect }
|
|
|
60
62
|
* @param testModules - The test modules to load.
|
|
61
63
|
* @param component - The React component to render the sidebar.
|
|
62
64
|
* @param createRoot - Function to create a React root.
|
|
65
|
+
* @param theme - Optional theme customization
|
|
63
66
|
* @example
|
|
64
67
|
* ```ts
|
|
65
68
|
* if (import.meta.env.DEV) {
|
|
66
69
|
* const testModules = import.meta.glob("./example.twd.test.ts");
|
|
67
70
|
* const { initTests, TWDSidebar } = await import('twd-js');
|
|
68
|
-
* await initTests(testModules, <TWDSidebar open={true} position="left" />, createRoot
|
|
71
|
+
* await initTests(testModules, <TWDSidebar open={true} position="left" />, createRoot, {
|
|
72
|
+
* primary: '#ff0000',
|
|
73
|
+
* background: '#ffffff'
|
|
74
|
+
* });
|
|
69
75
|
* }
|
|
70
76
|
* ```
|
|
71
77
|
*/
|
|
72
78
|
export declare const initTests: (testModules: TestModule, Component: React.ReactNode, createRoot: (el: HTMLElement) => {
|
|
73
79
|
render: (el: React.ReactNode) => void;
|
|
74
|
-
}) => Promise<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;
|
|
75
87
|
|
|
76
88
|
/**
|
|
77
89
|
* Negatable assertion names (e.g., 'not.have.text').
|
|
@@ -448,6 +460,68 @@ declare interface TWDSidebarProps {
|
|
|
448
460
|
position?: "left" | "right";
|
|
449
461
|
}
|
|
450
462
|
|
|
463
|
+
/**
|
|
464
|
+
* TWD Theme Configuration
|
|
465
|
+
*
|
|
466
|
+
* This file defines CSS variables that can be customized by users
|
|
467
|
+
* to personalize their TWD UI experience.
|
|
468
|
+
*
|
|
469
|
+
* Users can override these variables by setting them in their CSS:
|
|
470
|
+
*
|
|
471
|
+
* ```css
|
|
472
|
+
* :root {
|
|
473
|
+
* --twd-primary: #3b82f6;
|
|
474
|
+
* --twd-background: #1e293b;
|
|
475
|
+
* ... other variables
|
|
476
|
+
* }
|
|
477
|
+
*
|
|
478
|
+
*/
|
|
479
|
+
export declare interface TWDTheme {
|
|
480
|
+
primary: string;
|
|
481
|
+
background: string;
|
|
482
|
+
backgroundSecondary: string;
|
|
483
|
+
border: string;
|
|
484
|
+
borderLight: string;
|
|
485
|
+
text: string;
|
|
486
|
+
textSecondary: string;
|
|
487
|
+
textMuted: string;
|
|
488
|
+
success: string;
|
|
489
|
+
successBg: string;
|
|
490
|
+
error: string;
|
|
491
|
+
errorBg: string;
|
|
492
|
+
warning: string;
|
|
493
|
+
warningBg: string;
|
|
494
|
+
skip: string;
|
|
495
|
+
skipBg: string;
|
|
496
|
+
buttonPrimary: string;
|
|
497
|
+
buttonPrimaryText: string;
|
|
498
|
+
buttonSecondary: string;
|
|
499
|
+
buttonSecondaryText: string;
|
|
500
|
+
buttonBorder: string;
|
|
501
|
+
spacingXs: string;
|
|
502
|
+
spacingSm: string;
|
|
503
|
+
spacingMd: string;
|
|
504
|
+
spacingLg: string;
|
|
505
|
+
spacingXl: string;
|
|
506
|
+
fontSizeXs: string;
|
|
507
|
+
fontSizeSm: string;
|
|
508
|
+
fontSizeMd: string;
|
|
509
|
+
fontSizeLg: string;
|
|
510
|
+
fontWeightNormal: string;
|
|
511
|
+
fontWeightMedium: string;
|
|
512
|
+
fontWeightBold: string;
|
|
513
|
+
sidebarWidth: string;
|
|
514
|
+
borderRadius: string;
|
|
515
|
+
borderRadiusLg: string;
|
|
516
|
+
shadow: string;
|
|
517
|
+
shadowSm: string;
|
|
518
|
+
zIndexSidebar: string;
|
|
519
|
+
zIndexSticky: string;
|
|
520
|
+
animationDuration: string;
|
|
521
|
+
iconColor: string;
|
|
522
|
+
iconColorSecondary: string;
|
|
523
|
+
}
|
|
524
|
+
|
|
451
525
|
/**
|
|
452
526
|
* All supported assertion names for the `should` function in url command
|
|
453
527
|
*
|