diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index dab877b8a..e90728f25 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -183,6 +183,10 @@ interface ClientQueryOptions { type?: ClientTypes; } +interface ClipboardEventInit extends EventInit { + clipboardData?: DataTransfer | null; +} + interface CloseEventInit extends EventInit { code?: number; reason?: string; @@ -3260,9 +3264,19 @@ declare var ClientRectList: { new(): ClientRectList; }; +interface Clipboard extends EventTarget { + readText(): Promise; + writeText(data: string): Promise; +} + +declare var Clipboard: { + prototype: Clipboard; + new(): Clipboard; +}; + /** The ClipboardEvent interface represents events providing information related to modification of the clipboard, that is cut, copy, and paste events. */ interface ClipboardEvent extends Event { - readonly clipboardData: DataTransfer; + readonly clipboardData: DataTransfer | null; } declare var ClipboardEvent: { @@ -3270,11 +3284,6 @@ declare var ClipboardEvent: { new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent; }; -interface ClipboardEventInit extends EventInit { - data?: string; - dataType?: string; -} - /** A CloseEvent is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute. */ interface CloseEvent extends Event { readonly code: number; @@ -10494,6 +10503,7 @@ declare var NavigationPreloadManager: { interface Navigator extends NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, MSNavigatorDoNotTrack, MSFileSaver, NavigatorBeacon, NavigatorConcurrentHardware, NavigatorUserMedia, NavigatorLanguage, NavigatorStorage, NavigatorAutomationInformation { readonly activeVRDisplays: ReadonlyArray; readonly authentication: WebAuthentication; + readonly clipboard: Clipboard; readonly cookieEnabled: boolean; readonly doNotTrack: string | null; gamepadInputEmulation: GamepadInputEmulationType; diff --git a/inputfiles/addedTypes.json b/inputfiles/addedTypes.json index cc160ba68..6c0acb98d 100644 --- a/inputfiles/addedTypes.json +++ b/inputfiles/addedTypes.json @@ -832,26 +832,6 @@ } } }, - "ClipboardEventInit": { - "exposed": "Window", - "name": "ClipboardEventInit", - "extends": "EventInit", - "properties": { - "property": { - "data": { - "name": "data", - "override-type": "string", - "required": 0 - }, - "dataType": { - "name": "dataType", - "override-type": "string", - "required": 0 - } - } - }, - "no-interface-object": "1" - }, "IDBArrayKey": { "name": "IDBArrayKey", "extends": "Array", diff --git a/inputfiles/idl/Clipboard.widl b/inputfiles/idl/Clipboard.widl new file mode 100644 index 000000000..4679483f8 --- /dev/null +++ b/inputfiles/idl/Clipboard.widl @@ -0,0 +1,23 @@ +dictionary ClipboardEventInit : EventInit { + DataTransfer? clipboardData = null; +}; + +[Constructor(DOMString type, optional ClipboardEventInit eventInitDict), Exposed=Window] +interface ClipboardEvent : Event { + readonly attribute DataTransfer? clipboardData; +}; + +partial interface Navigator { + [SecureContext, SameObject] readonly attribute Clipboard clipboard; +}; + +[SecureContext, Exposed=Window] interface Clipboard : EventTarget { + Promise read(); + Promise readText(); + Promise write(DataTransfer data); + Promise writeText(DOMString data); +}; + +dictionary ClipboardPermissionDescriptor : PermissionDescriptor { + boolean allowWithoutGesture = false; +}; diff --git a/inputfiles/idlSources.json b/inputfiles/idlSources.json index e0986acfd..20c2c91ac 100644 --- a/inputfiles/idlSources.json +++ b/inputfiles/idlSources.json @@ -1,4 +1,8 @@ [ + { + "url": "https://www.w3.org/TR/clipboard-apis/", + "title": "Clipboard" + }, { "url": "https://compat.spec.whatwg.org/", "title": "Compatibility", diff --git a/inputfiles/overridingTypes.json b/inputfiles/overridingTypes.json index 280937348..1014ecbd6 100644 --- a/inputfiles/overridingTypes.json +++ b/inputfiles/overridingTypes.json @@ -1342,14 +1342,6 @@ } } }, - "ClipboardEvent": { - "name": "ClipboardEvent", - "constructor": { - "override-signatures": [ - "new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent" - ] - } - }, "Storage": { "name": "Storage", "methods": { diff --git a/inputfiles/removedTypes.json b/inputfiles/removedTypes.json index 02f20ec35..d5b0b0680 100644 --- a/inputfiles/removedTypes.json +++ b/inputfiles/removedTypes.json @@ -41,6 +41,14 @@ }, "interfaces": { "interface": { + "Clipboard": { + "methods": { + "method": { + "read": null, + "write": null + } + } + }, "Console": { "methods": { "method": {