Skip to content

Commit 1bd4980

Browse files
committed
Add Clipboard Interfaces to idlSources
1 parent af6833f commit 1bd4980

File tree

6 files changed

+51
-34
lines changed

6 files changed

+51
-34
lines changed

baselines/dom.generated.d.ts

+16-6
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ interface ClientQueryOptions {
183183
type?: ClientTypes;
184184
}
185185

186+
interface ClipboardEventInit extends EventInit {
187+
clipboardData?: DataTransfer | null;
188+
}
189+
186190
interface CloseEventInit extends EventInit {
187191
code?: number;
188192
reason?: string;
@@ -3217,20 +3221,25 @@ declare var ClientRectList: {
32173221
new(): ClientRectList;
32183222
};
32193223

3224+
interface Clipboard extends EventTarget {
3225+
readText(): Promise<string>;
3226+
writeText(data: string): Promise<void>;
3227+
}
3228+
3229+
declare var Clipboard: {
3230+
prototype: Clipboard;
3231+
new(): Clipboard;
3232+
};
3233+
32203234
interface ClipboardEvent extends Event {
3221-
readonly clipboardData: DataTransfer;
3235+
readonly clipboardData: DataTransfer | null;
32223236
}
32233237

32243238
declare var ClipboardEvent: {
32253239
prototype: ClipboardEvent;
32263240
new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent;
32273241
};
32283242

3229-
interface ClipboardEventInit extends EventInit {
3230-
data?: string;
3231-
dataType?: string;
3232-
}
3233-
32343243
interface CloseEvent extends Event {
32353244
readonly code: number;
32363245
readonly reason: string;
@@ -10283,6 +10292,7 @@ declare var NavigationPreloadManager: {
1028310292
interface Navigator extends NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, MSNavigatorDoNotTrack, MSFileSaver, NavigatorBeacon, NavigatorConcurrentHardware, NavigatorUserMedia, NavigatorLanguage, NavigatorStorage, NavigatorAutomationInformation {
1028410293
readonly activeVRDisplays: ReadonlyArray<VRDisplay>;
1028510294
readonly authentication: WebAuthentication;
10295+
readonly clipboard: Clipboard;
1028610296
readonly cookieEnabled: boolean;
1028710297
readonly doNotTrack: string | null;
1028810298
gamepadInputEmulation: GamepadInputEmulationType;

inputfiles/addedTypes.json

-20
Original file line numberDiff line numberDiff line change
@@ -780,26 +780,6 @@
780780
}
781781
}
782782
},
783-
"ClipboardEventInit": {
784-
"exposed": "Window",
785-
"name": "ClipboardEventInit",
786-
"extends": "EventInit",
787-
"properties": {
788-
"property": {
789-
"data": {
790-
"name": "data",
791-
"override-type": "string",
792-
"required": 0
793-
},
794-
"dataType": {
795-
"name": "dataType",
796-
"override-type": "string",
797-
"required": 0
798-
}
799-
}
800-
},
801-
"no-interface-object": "1"
802-
},
803783
"IDBArrayKey": {
804784
"name": "IDBArrayKey",
805785
"extends": "Array<IDBValidKey>",

inputfiles/idl/Clipboard.widl

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
dictionary ClipboardEventInit : EventInit {
2+
DataTransfer? clipboardData = null;
3+
};
4+
5+
[Constructor(DOMString type, optional ClipboardEventInit eventInitDict), Exposed=Window]
6+
interface ClipboardEvent : Event {
7+
readonly attribute DataTransfer? clipboardData;
8+
};
9+
10+
partial interface Navigator {
11+
[SecureContext, SameObject] readonly attribute Clipboard clipboard;
12+
};
13+
14+
[SecureContext, Exposed=Window] interface Clipboard : EventTarget {
15+
Promise<DataTransfer> read();
16+
Promise<DOMString> readText();
17+
Promise<void> write(DataTransfer data);
18+
Promise<void> writeText(DOMString data);
19+
};
20+
21+
dictionary ClipboardPermissionDescriptor : PermissionDescriptor {
22+
boolean allowWithoutGesture = false;
23+
};

inputfiles/idlSources.json

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
[
2+
{
3+
"url": "https://www.w3.org/TR/clipboard-apis/",
4+
"title": "Clipboard"
5+
},
26
{
37
"url": "https://compat.spec.whatwg.org/",
48
"title": "Compatibility",

inputfiles/overridingTypes.json

-8
Original file line numberDiff line numberDiff line change
@@ -1328,14 +1328,6 @@
13281328
}
13291329
}
13301330
},
1331-
"ClipboardEvent": {
1332-
"name": "ClipboardEvent",
1333-
"constructor": {
1334-
"override-signatures": [
1335-
"new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent"
1336-
]
1337-
}
1338-
},
13391331
"Storage": {
13401332
"name": "Storage",
13411333
"methods": {

inputfiles/removedTypes.json

+8
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@
4141
},
4242
"interfaces": {
4343
"interface": {
44+
"Clipboard": {
45+
"methods": {
46+
"method": {
47+
"read": null,
48+
"write": null
49+
}
50+
}
51+
},
4452
"Console": {
4553
"methods": {
4654
"method": {

0 commit comments

Comments
 (0)