fix: expose Viewport type (#6881)

Also includes drive-by when I subbed `@default` (not valid) to
`@defaultValue` (valid!) in a few places and exposed types from
`Coverage.ts` so they get exposed too.

Fixes 6876.
This commit is contained in:
Jack Franklin 2021-02-12 12:32:27 +00:00 committed by GitHub
parent 29c059427e
commit be7c22933c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 4 deletions

View File

@ -40,6 +40,7 @@ export * from './common/Accessibility.js';
export * from './common/Browser.js'; export * from './common/Browser.js';
export * from './node/BrowserFetcher.js'; export * from './node/BrowserFetcher.js';
export * from './node/Puppeteer.js'; export * from './node/Puppeteer.js';
export * from './common/Coverage.js';
export * from './common/Connection.js'; export * from './common/Connection.js';
export * from './common/ConsoleMessage.js'; export * from './common/ConsoleMessage.js';
export * from './common/Coverage.js'; export * from './common/Coverage.js';
@ -51,6 +52,7 @@ export * from './common/ExecutionContext.js';
export * from './common/EventEmitter.js'; export * from './common/EventEmitter.js';
export * from './common/FileChooser.js'; export * from './common/FileChooser.js';
export * from './common/FrameManager.js'; export * from './common/FrameManager.js';
export * from './common/PuppeteerViewport.js';
export * from './common/Input.js'; export * from './common/Input.js';
export * from './common/Page.js'; export * from './common/Page.js';
export * from './common/Product.js'; export * from './common/Product.js';

View File

@ -150,7 +150,7 @@ export interface ScreenshotClip {
*/ */
export interface ScreenshotOptions { export interface ScreenshotOptions {
/** /**
* @default 'png' * @defaultValue 'png'
*/ */
type?: 'png' | 'jpeg'; type?: 'png' | 'jpeg';
/** /**
@ -162,7 +162,7 @@ export interface ScreenshotOptions {
path?: string; path?: string;
/** /**
* When true, takes a screenshot of the full page. * When true, takes a screenshot of the full page.
* @default false * @defaultValue false
*/ */
fullPage?: boolean; fullPage?: boolean;
/** /**
@ -175,12 +175,12 @@ export interface ScreenshotOptions {
quality?: number; quality?: number;
/** /**
* Hides default white background and allows capturing screenshots with transparency. * Hides default white background and allows capturing screenshots with transparency.
* @default false * @defaultValue false
*/ */
omitBackground?: boolean; omitBackground?: boolean;
/** /**
* Encoding of the image. * Encoding of the image.
* @default 'binary' * @defaultValue 'binary'
*/ */
encoding?: 'base64' | 'binary'; encoding?: 'base64' | 'binary';
} }

View File

@ -13,11 +13,39 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/**
*
* Sets the viewport of the page.
* @public
*/
export interface Viewport { export interface Viewport {
/**
* The page width in pixels.
*/
width: number; width: number;
/**
* The page height in pixels.
*/
height: number; height: number;
/**
* Specify device scale factor.
* See {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio | devicePixelRatio} for more info.
* @defaultValue 1
*/
deviceScaleFactor?: number; deviceScaleFactor?: number;
/**
* Whether the `meta viewport` tag is taken into account.
* @defaultValue false
*/
isMobile?: boolean; isMobile?: boolean;
/**
* Specifies if the viewport is in landscape mode.
* @defaultValue false
*/
isLandscape?: boolean; isLandscape?: boolean;
/**
* Specify if the viewport supports touch events.
* @defaultValue false
*/
hasTouch?: boolean; hasTouch?: boolean;
} }