twd-js 1.5.2 → 1.6.1
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 +1 -0
- package/dist/bundled.es.js +708 -620
- package/dist/index.cjs.js +58 -41
- package/dist/index.d.ts +31 -1
- package/dist/index.es.js +5104 -4882
- package/dist/mock-sw.js +1 -1
- package/dist/runner.cjs.js +1 -1
- package/dist/runner.d.ts +10 -2
- package/dist/runner.es.js +139 -107
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -437,6 +437,32 @@ declare interface TWDAPI {
|
|
|
437
437
|
* ```
|
|
438
438
|
*/
|
|
439
439
|
notExists: (selector: string) => Promise<void>;
|
|
440
|
+
/**
|
|
441
|
+
* Simulates a viewport size by constraining body dimensions, overriding
|
|
442
|
+
* `window.innerWidth`/`window.innerHeight` and `window.matchMedia()`, and
|
|
443
|
+
* rewriting CSS `@media` rules to match the simulated dimensions.
|
|
444
|
+
* Call with no arguments to reset to the original viewport.
|
|
445
|
+
*
|
|
446
|
+
* @param width Viewport width in pixels
|
|
447
|
+
* @param height Viewport height in pixels (optional — omit to leave height unconstrained)
|
|
448
|
+
*
|
|
449
|
+
* @example
|
|
450
|
+
* ```ts
|
|
451
|
+
* twd.viewport(375, 667); // mobile
|
|
452
|
+
* twd.viewport(768); // tablet width, height unconstrained
|
|
453
|
+
* twd.viewport(); // reset
|
|
454
|
+
* ```
|
|
455
|
+
*/
|
|
456
|
+
viewport: (width?: number, height?: number) => void;
|
|
457
|
+
/**
|
|
458
|
+
* Resets the viewport to its original size (undoes a previous `twd.viewport()` call).
|
|
459
|
+
*
|
|
460
|
+
* @example
|
|
461
|
+
* ```ts
|
|
462
|
+
* twd.resetViewport();
|
|
463
|
+
* ```
|
|
464
|
+
*/
|
|
465
|
+
resetViewport: () => void;
|
|
440
466
|
}
|
|
441
467
|
|
|
442
468
|
/**
|
|
@@ -470,7 +496,7 @@ declare interface TWDElemAPI {
|
|
|
470
496
|
should: ShouldFn;
|
|
471
497
|
}
|
|
472
498
|
|
|
473
|
-
export declare const TWDSidebar: ({ open, position }: TWDSidebarProps) => JSX.Element;
|
|
499
|
+
export declare const TWDSidebar: ({ open, position, search }: TWDSidebarProps) => JSX.Element;
|
|
474
500
|
|
|
475
501
|
declare interface TWDSidebarProps {
|
|
476
502
|
/**
|
|
@@ -485,6 +511,10 @@ declare interface TWDSidebarProps {
|
|
|
485
511
|
* @default "left"
|
|
486
512
|
*/
|
|
487
513
|
position?: "left" | "right";
|
|
514
|
+
/**
|
|
515
|
+
* Whether to show the search/filter input
|
|
516
|
+
*/
|
|
517
|
+
search?: boolean;
|
|
488
518
|
}
|
|
489
519
|
|
|
490
520
|
/**
|