From 257fafabae222b77ce6c308c318726da1bba9a88 Mon Sep 17 00:00:00 2001 From: Benjamin Aster Date: Mon, 22 Jul 2024 22:11:28 +0200 Subject: [PATCH] 0.4.6 --- README.md | 2 + index.d.ts | 2 + package.json | 2 +- w3c/mediacapture-region.d.ts | 23 ++++++++++ w3c/mediacapture-screen-share.d.ts | 73 ++++++++++++++++++++++++++++++ 5 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 w3c/mediacapture-region.d.ts create mode 100644 w3c/mediacapture-screen-share.d.ts diff --git a/README.md b/README.md index 6040be5..e095aff 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,8 @@ The type declarations in this repository include the following specifications (g - [DeviceOrientation Events](https://w3c.github.io/deviceorientation/) - [Image Resource](https://w3c.github.io/image-resource/) - [Long Tasks API](https://w3c.github.io/longtasks/) + - [Region Capture](https://w3c.github.io/mediacapture-region/) + - [Screen Capture](https://w3c.github.io/mediacapture-screen-share/) - [MediaStream Image Capture](https://w3c.github.io/mediacapture-image/) - [MediaStream Recording](https://w3c.github.io/mediacapture-record/) - [Permissions Registry](https://w3c.github.io/permissions-registry/) diff --git a/index.d.ts b/index.d.ts index 823f38e..cb16ee5 100644 --- a/index.d.ts +++ b/index.d.ts @@ -33,6 +33,8 @@ /// /// /// +/// +/// /// /// /// diff --git a/package.json b/package.json index 11b1559..d08f12f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "new-javascript", - "version": "0.4.5", + "version": "0.4.6", "description": "TypeScript type definitions for new JavaScript stuff that isn't yet in TypeScript's standard type definitions", "main": "./index.d.ts", "repository": { diff --git a/w3c/mediacapture-region.d.ts b/w3c/mediacapture-region.d.ts new file mode 100644 index 0000000..587ec6d --- /dev/null +++ b/w3c/mediacapture-region.d.ts @@ -0,0 +1,23 @@ + +// Region Capture +// Specification: https://w3c.github.io/mediacapture-region/ +// Repository: https://github.com/w3c/mediacapture-region + +interface CropTarget { } + +declare var CropTarget: { + prototype: CropTarget; + fromElement(element: Element): Promise; +}; + +interface BrowserCaptureMediaStreamTrack { + cropTo(cropTarget?: CropTarget): Promise; + clone(): BrowserCaptureMediaStreamTrack; +} + +declare var BrowserCaptureMediaStreamTrack: { + prototype: BrowserCaptureMediaStreamTrack; +}; + +// intentionally the wrong way round since per lib.dom.d.ts, MediaStream.prototype.getVideoTracks() always returns returns MediaStreamTrack[] +interface MediaStreamTrack extends BrowserCaptureMediaStreamTrack { } diff --git a/w3c/mediacapture-screen-share.d.ts b/w3c/mediacapture-screen-share.d.ts new file mode 100644 index 0000000..4b656f8 --- /dev/null +++ b/w3c/mediacapture-screen-share.d.ts @@ -0,0 +1,73 @@ + +// Screen Capture +// Specification: https://w3c.github.io/mediacapture-screen-share/ +// Repository: https://github.com/w3c/mediacapture-screen-share + +interface DisplayMediaStreamOptions { + controller?: CaptureController; + selfBrowserSurface?: SelfCapturePreferenceEnum; + systemAudio?: SystemAudioPreferenceEnum; + surfaceSwitching?: SurfaceSwitchingPreferenceEnum; + monitorTypeSurfaces?: MonitorTypeSurfacesEnum; +} + +interface MediaTrackSupportedConstraints { + logicalSurface?: boolean; + cursor?: boolean; + restrictOwnAudio?: boolean; + suppressLocalAudioPlayback?: boolean; +} + +interface MediaTrackConstraintSet { + logicalSurface?: ConstrainBoolean; + cursor?: ConstrainDOMString; + restrictOwnAudio?: ConstrainBoolean; + suppressLocalAudioPlayback?: ConstrainBoolean; +} + +interface MediaTrackSettings { + logicalSurface?: boolean; + cursor?: boolean; + restrictOwnAudio?: boolean; + suppressLocalAudioPlayback?: boolean; +} + +interface MediaTrackCapabilities { + logicalSurface?: boolean; + cursor?: string[], +} + +interface CaptureController { + setFocusBehavior(focusBehavior: CaptureStartFocusBehavior): void; +} + +type CaptureStartFocusBehavior = ( + | "focus-capturing-application" + | "focus-captured-surface" + | "no-focus-change" +); + +declare var CaptureController: { + prototype: CaptureController; + new(): CaptureController; +} + +type SelfCapturePreferenceEnum = ( + | "include" + | "exclude" +); + +type SystemAudioPreferenceEnum = ( + | "include" + | "exclude" +); + +type SurfaceSwitchingPreferenceEnum = ( + | "include" + | "exclude" +); + +type MonitorTypeSurfacesEnum = ( + | "include" + | "exclude" +);