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/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
  /**