twd-js 1.5.2 → 1.6.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.es.js +288 -293
- package/dist/index.cjs.js +56 -39
- package/dist/index.d.ts +26 -0
- package/dist/index.es.js +3990 -3830
- package/dist/mock-sw.js +1 -1
- 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
|
/**
|