@henrikvilhelmberglund/vite-plugin-monkey 4.0.4

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.
@@ -0,0 +1,802 @@
1
+ type WebRequestRule = {
2
+ selector: string | {
3
+ include?: string | string[];
4
+ match?: string | string[];
5
+ exclude?: string | string[];
6
+ };
7
+ action: 'cancel' | {
8
+ cancel?: boolean;
9
+ redirect?: string | {
10
+ from: string;
11
+ to: string;
12
+ };
13
+ };
14
+ };
15
+
16
+ type TamperScriptMeta = {
17
+ name_i18n: Record<string, string>;
18
+ description_i18n: Record<string, string>;
19
+ antifeatures: Record<string, Record<string, string>>;
20
+ blockers: unknown[];
21
+ 'run-at': string;
22
+ options: object;
23
+ icon64?: string;
24
+ sync: {
25
+ imported: number;
26
+ };
27
+ webRequest?: string[];
28
+ requires: {
29
+ textContent: string;
30
+ }[];
31
+ };
32
+ type TamperInfo = {
33
+ downloadMode: 'native' | 'browser' | 'disabled';
34
+ isIncognito: boolean;
35
+ isFirstPartyIsolation?: boolean;
36
+ scriptSource: string;
37
+ };
38
+ /**
39
+ * @see https://developer.chrome.com/docs/extensions/reference/cookies/#type-Cookie
40
+ */
41
+ type ChromeCookie = {
42
+ domain?: string;
43
+ expirationDate?: number;
44
+ httpOnly?: boolean;
45
+ name?: string;
46
+ path?: string;
47
+ sameSite?: 'no_restriction' | 'lax' | 'strict' | 'unspecified';
48
+ secure?: boolean;
49
+ storeId?: string;
50
+ url?: string;
51
+ value?: string;
52
+ };
53
+ type CbCookie = {
54
+ domain: string;
55
+ hostOnly: boolean;
56
+ httpOnly: boolean;
57
+ name: string;
58
+ path: string;
59
+ sameSite: string;
60
+ secure: boolean;
61
+ session: boolean;
62
+ value: string;
63
+ };
64
+ type CookieDetails = {
65
+ list: {
66
+ url?: string;
67
+ domain?: string;
68
+ name?: string;
69
+ path?: string;
70
+ };
71
+ set: ChromeCookie;
72
+ delete: {
73
+ name?: string;
74
+ url?: string;
75
+ };
76
+ };
77
+ type CookieCallBack = {
78
+ list: (cookies: CbCookie[], error: unknown) => void;
79
+ set: (error: unknown) => void;
80
+ delete: (error: unknown) => void;
81
+ };
82
+ type CookieResult = {
83
+ list: Promise<CbCookie[]>;
84
+ set: (error: unknown) => Promise<void>;
85
+ delete: (error: unknown) => Promise<void>;
86
+ };
87
+ type GmCookieFc = {
88
+ list: (details: CookieDetails['list'], callback?: CookieCallBack['list']) => CookieResult['list'];
89
+ set: (details: CookieDetails['set'], callback?: CookieCallBack['set']) => CookieResult['set'];
90
+ delete: (details: CookieDetails['delete'], callback?: CookieCallBack['delete']) => CookieResult['delete'];
91
+ };
92
+ type WebRequestListener = (info: 'cancel' | 'redirect', message: 'ok' | 'error', details: {
93
+ rule: WebRequestRule;
94
+ url: string;
95
+ redirect_url: string;
96
+ description: string;
97
+ }) => void;
98
+
99
+ type ViolentInfo = {
100
+ uuid: string;
101
+ injectInto: string;
102
+ platform: ViolentPlatform;
103
+ };
104
+ type ViolentPlatform = {
105
+ arch: 'arm' | 'mips' | 'mips64' | 'x86-32' | 'x86-64';
106
+ browserName: string;
107
+ browserVersion: string;
108
+ os: 'android' | 'cros' | 'linux' | 'mac' | 'openbsd' | 'win';
109
+ };
110
+ type ViolentScriptMeta = {
111
+ excludeMatches: string[];
112
+ runAt: string;
113
+ homepageURL?: string;
114
+ license: string;
115
+ require: string[];
116
+ };
117
+
118
+ type CommonScriptMeta = {
119
+ namespace: string;
120
+ name: string;
121
+ author?: string;
122
+ description?: string;
123
+ icon?: string;
124
+ excludes: string[];
125
+ includes: string[];
126
+ matches: string[];
127
+ resources: {
128
+ name: string;
129
+ url: string;
130
+ content: string;
131
+ meta: string;
132
+ }[];
133
+ runAt: string;
134
+ version: string;
135
+ noframes: boolean;
136
+ unwrap: boolean;
137
+ homepage: string;
138
+ };
139
+ type ScriptMeta = CommonScriptMeta & TamperScriptMeta & ViolentScriptMeta;
140
+ type CommonInfo = {
141
+ version: string;
142
+ scriptHandler: string;
143
+ scriptMetaStr: string;
144
+ scriptSource: string;
145
+ scriptUpdateURL?: string;
146
+ scriptWillUpdate: boolean;
147
+ script: ScriptMeta;
148
+ };
149
+ /**
150
+ * GM_info Type
151
+ */
152
+ type GmScriptInfo = CommonInfo & TamperInfo & ViolentInfo;
153
+ type HTMLElementTagName = keyof HTMLElementTagNameMap;
154
+ type GmAddElementFc = {
155
+ <K extends HTMLElementTagName>(tagName: K, attributes?: Partial<HTMLElementTagNameMap[K]>): HTMLElementTagNameMap[K];
156
+ (tagName: string, attributes?: Partial<HTMLElement>): HTMLElement;
157
+ <K extends HTMLElementTagName>(parentNode: Node | Element | ShadowRoot, tagName: K, attributes?: Partial<HTMLElementTagNameMap[K]>): HTMLElementTagNameMap[K];
158
+ (parentNode: Node | Element | ShadowRoot, tagName: string, attributes?: Partial<HTMLElement>): HTMLElement;
159
+ };
160
+ type GmOpenInTabDetails = {
161
+ active?: boolean;
162
+ insert?: boolean;
163
+ /**
164
+ * @available tampermonkey
165
+ */
166
+ setParent?: boolean;
167
+ /**
168
+ * @available tampermonkey
169
+ */
170
+ incognito?: boolean;
171
+ /**
172
+ * @available violentmonkey
173
+ */
174
+ container?: 0 | 1 | 2;
175
+ /**
176
+ * @available violentmonkey
177
+ */
178
+ pinned?: boolean;
179
+ };
180
+ type GmOpenHandle = {
181
+ onclose?: () => void;
182
+ closed: boolean;
183
+ close: () => void;
184
+ };
185
+ type GmOpenInTabFc = {
186
+ (url: string, details?: GmOpenInTabDetails): GmOpenHandle;
187
+ (url: string, openInBackground?: boolean): GmOpenHandle;
188
+ };
189
+ type GmNotificationDetails = {
190
+ text: string;
191
+ title?: string;
192
+ image?: string;
193
+ /**
194
+ * @available tampermonkey
195
+ */
196
+ highlight?: boolean;
197
+ /**
198
+ * @available tampermonkey
199
+ */
200
+ silent?: boolean;
201
+ /**
202
+ * @available tampermonkey
203
+ */
204
+ timeout?: number;
205
+ ondone?: () => void;
206
+ onclick?: () => void;
207
+ };
208
+ /**
209
+ * @available violentmonkey
210
+ */
211
+ type GmNotificationControl = {
212
+ /**
213
+ * @available violentmonkey
214
+ */
215
+ remove: () => Promise<void>;
216
+ };
217
+ type GmNotificationFc = {
218
+ (text: string, title?: string, image?: string, onclick?: () => void): GmNotificationControl;
219
+ (details: GmNotificationDetails, ondone?: () => void): GmNotificationControl;
220
+ };
221
+ type GmDownloadErrorEvent = {
222
+ /**
223
+ * Error reason
224
+ * - `not_enabled` - the download feature isn't enabled by the user
225
+ * - `not_whitelisted` - the requested file extension is not
226
+ * whitelisted
227
+ * - `not_permitted` - the user enabled the download feature, but did
228
+ * not give the downloads permission
229
+ * - `not_supported` - the download feature isn't supported by the
230
+ * browser/version
231
+ * - `not_succeeded` - the download wasn't started or failed, the
232
+ * details attribute may provide more information
233
+ */
234
+ error: 'not_enabled' | 'not_whitelisted' | 'not_permitted' | 'not_supported' | 'not_succeeded';
235
+ details?: string;
236
+ };
237
+ type GmRequestEventListener<Event> = (this: Event, event: Event) => void;
238
+ type GmProgressEventBase = {
239
+ done: number;
240
+ lengthComputable: boolean;
241
+ loaded: number;
242
+ position: number;
243
+ total: number;
244
+ totalSize: number;
245
+ };
246
+ type GmDownloadProgressEvent = GmProgressEventBase & {
247
+ readonly finalUrl: string;
248
+ };
249
+ type GmDownloadRequest = {
250
+ /**
251
+ * URL from where the data should be downloaded
252
+ */
253
+ url: string;
254
+ /**
255
+ * Filename - for security reasons the file extension needs to be
256
+ * whitelisted at Tampermonkey options page
257
+ */
258
+ name: string;
259
+ headers?: Record<string, string>;
260
+ /**
261
+ * Show 'Save As' dialog
262
+ */
263
+ saveAs?: boolean;
264
+ timeout?: number;
265
+ onerror?: GmRequestEventListener<GmDownloadErrorEvent>;
266
+ ontimeout?(): void;
267
+ onload?(): void;
268
+ onprogress?: GmRequestEventListener<GmDownloadProgressEvent>;
269
+ };
270
+ type GmResponseTypeMap = {
271
+ text: string;
272
+ json: any;
273
+ arraybuffer: ArrayBuffer;
274
+ blob: Blob;
275
+ document: Document;
276
+ stream: ReadableStream<Uint8Array>;
277
+ };
278
+ type GmResponseType = keyof GmResponseTypeMap;
279
+ type GmAbortHandle<TReturn = void> = {
280
+ abort(): TReturn;
281
+ };
282
+ type GmResponseEventBase<TResponseType extends GmResponseType> = {
283
+ responseHeaders: string;
284
+ /**
285
+ * 0 = XMLHttpRequest.UNSENT
286
+ *
287
+ * 1 = XMLHttpRequest.OPENED
288
+ *
289
+ * 2 = XMLHttpRequest.HEADERS_RECEIVED
290
+ *
291
+ * 3 = XMLHttpRequest.HEADERS_RECEIVED
292
+ *
293
+ * 4 = XMLHttpRequest.DONE
294
+ */
295
+ readyState: 0 | 1 | 2 | 3 | 4;
296
+ response: GmResponseTypeMap[TResponseType];
297
+ responseText: string;
298
+ responseXML: Document | null;
299
+ status: number;
300
+ statusText: string;
301
+ };
302
+ type GmErrorEvent<TResponseType extends GmResponseType> = GmResponseEventBase<TResponseType> & {
303
+ error: string;
304
+ };
305
+ type GmResponseEvent<TContext, TResponseType extends GmResponseType> = GmResponseEventBase<TResponseType> & {
306
+ finalUrl: string;
307
+ context: TContext;
308
+ };
309
+ type ProgressResponse<TContext, TResponseType extends GmResponseType> = GmResponseEvent<TContext, TResponseType> & GmProgressEventBase;
310
+ type GmXhrRequest<TContext, TResponseType extends GmResponseType> = {
311
+ method?: string;
312
+ url: string;
313
+ headers?: Record<string, string>;
314
+ data?: string | URLSearchParams | FormData | ArrayBuffer | Blob | DataView | ReadableStream;
315
+ /**
316
+ * @available tampermonkey
317
+ */
318
+ redirect?: `follow` | `error` | `manual`;
319
+ /**
320
+ * @available tampermonkey
321
+ */
322
+ cookie?: string;
323
+ binary?: boolean;
324
+ /**
325
+ * @available tampermonkey
326
+ */
327
+ nocache?: boolean;
328
+ /**
329
+ * @available tampermonkey
330
+ */
331
+ revalidate?: boolean;
332
+ timeout?: number;
333
+ /**
334
+ * Property which will be added to the response event object
335
+ */
336
+ context?: TContext;
337
+ /**
338
+ * @tampermonkey text, json, arraybuffer, blob, document, stream
339
+ * @violentmonkey text, json, arraybuffer, blob, document
340
+ * @default
341
+ * 'text'
342
+ */
343
+ responseType?: TResponseType;
344
+ overrideMimeType?: string;
345
+ anonymous?: boolean;
346
+ /**
347
+ * @available tampermonkey
348
+ */
349
+ fetch?: boolean;
350
+ user?: string;
351
+ password?: string;
352
+ onabort?: () => void;
353
+ onerror?: GmRequestEventListener<GmErrorEvent<TResponseType>>;
354
+ /**
355
+ * @available violentmonkey
356
+ */
357
+ onloadend?: GmRequestEventListener<GmResponseEvent<TContext, TResponseType>>;
358
+ onloadstart?: GmRequestEventListener<GmResponseEvent<TContext, TResponseType>>;
359
+ onprogress?: GmRequestEventListener<ProgressResponse<TContext, TResponseType>>;
360
+ onreadystatechange?: GmRequestEventListener<GmResponseEvent<TContext, TResponseType>>;
361
+ ontimeout?: () => void;
362
+ onload?: GmRequestEventListener<GmResponseEvent<TContext, TResponseType>>;
363
+ };
364
+ type GmXhr = {
365
+ <TContext, TResponseType extends GmResponseType = 'text'>(details: GmXhrRequest<TContext, TResponseType>): GmAbortHandle;
366
+ /**
367
+ * @available tampermonkey
368
+ * @see [tampermonkey#1278](https://github.com/Tampermonkey/tampermonkey/issues/1278#issuecomment-884363078)
369
+ */
370
+ RESPONSE_TYPE_STREAM?: 'stream';
371
+ };
372
+ type MonkeyWindow = typeof window & {
373
+ unsafeWindow: typeof window;
374
+ /**
375
+ * @see https://www.tampermonkey.net/documentation.php#api:window.close
376
+ * @see https://violentmonkey.github.io/api/metadata-block/#grant
377
+ */
378
+ close: () => void;
379
+ /**
380
+ * @see https://www.tampermonkey.net/documentation.php#api:window.focus
381
+ * @see https://violentmonkey.github.io/api/metadata-block/#grant
382
+ */
383
+ focus: () => void;
384
+ /**
385
+ * @see https://www.tampermonkey.net/documentation.php#api:window.onurlchange
386
+ * @available tampermonkey
387
+ */
388
+ onurlchange?: null;
389
+ /**
390
+ * @see https://www.tampermonkey.net/documentation.php#api:window.onurlchange
391
+ * @available tampermonkey
392
+ */
393
+ addEventListener: (type: 'urlchange', cb: (data: {
394
+ url: string;
395
+ }) => void) => void;
396
+ /**
397
+ * @see https://www.tampermonkey.net/documentation.php#api:window.onurlchange
398
+ * @available tampermonkey
399
+ */
400
+ removeEventListener: (type: 'urlchange', cb: (...args: unknown[]) => unknown) => void;
401
+ GM: {
402
+ addStyle: MonkeyWindow['GM_addStyle'];
403
+ addElement: MonkeyWindow['GM_addElement'];
404
+ /**
405
+ * @see https://wiki.greasespot.net/GM.registerMenuCommand
406
+ */
407
+ registerMenuCommand: MonkeyWindow['GM_registerMenuCommand'];
408
+ /**
409
+ * @see https://wiki.greasespot.net/GM.info
410
+ */
411
+ info: MonkeyWindow['GM_info'];
412
+ /**
413
+ * @available tampermonkey
414
+ */
415
+ cookie: MonkeyWindow['GM_cookie'];
416
+ /**
417
+ * @see https://wiki.greasespot.net/GM.notification
418
+ */
419
+ notification: MonkeyWindow['GM_notification'];
420
+ /**
421
+ * @see https://wiki.greasespot.net/GM.openInTab
422
+ */
423
+ openInTab: MonkeyWindow['GM_openInTab'];
424
+ /**
425
+ * @see https://wiki.greasespot.net/GM.setClipboard
426
+ */
427
+ setClipboard: MonkeyWindow['GM_setClipboard'];
428
+ /**
429
+ * @see https://wiki.greasespot.net/GM.xmlHttpRequest
430
+ */
431
+ xmlHttpRequest: MonkeyWindow['GM_xmlhttpRequest'];
432
+ /**
433
+ * @see https://wiki.greasespot.net/GM.deleteValue
434
+ */
435
+ deleteValue: (key: string) => Promise<void>;
436
+ /**
437
+ * @see https://wiki.greasespot.net/GM.getResourceUrl
438
+ */
439
+ getResourceURL: (name: string, isBlobUrl?: boolean) => Promise<string>;
440
+ /**
441
+ * @see https://wiki.greasespot.net/GM.getValue
442
+ */
443
+ getValue: <T = unknown>(key: string, defaultValue: T) => Promise<T>;
444
+ /**
445
+ * @see https://wiki.greasespot.net/GM.listValues
446
+ */
447
+ listValues: () => Promise<string[]>;
448
+ /**
449
+ * @see https://wiki.greasespot.net/GM.setValue
450
+ */
451
+ setValue: (key: string, value: unknown) => Promise<void>;
452
+ };
453
+ /**
454
+ * @see https://www.tampermonkey.net/documentation.php#GM_addElement
455
+ * @see https://violentmonkey.github.io/api/gm/#gm_addelement
456
+ */
457
+ GM_addElement: GmAddElementFc;
458
+ /**
459
+ * @see https://www.tampermonkey.net/documentation.php#GM_addStyle
460
+ * @see https://violentmonkey.github.io/api/gm/#gm_addstyle
461
+ */
462
+ GM_addStyle: (css: string) => HTMLStyleElement;
463
+ /**
464
+ * @see https://www.tampermonkey.net/documentation.php#GM_addValueChangeListener
465
+ * @see https://violentmonkey.github.io/api/gm/#gm_addvaluechangelistener
466
+ */
467
+ GM_addValueChangeListener: <T = unknown>(name: string, callback: (name: string, oldValue?: T, newValue?: T, remote?: boolean) => void) => string;
468
+ /**
469
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_cookie.list
470
+ * @see https://www.tampermonkey.net/documentation.php##api:GM_cookie.set
471
+ * @see https://www.tampermonkey.net/documentation.php##api:GM_cookie.delete
472
+ * @available tampermonkey
473
+ */
474
+ GM_cookie: GmCookieFc;
475
+ /**
476
+ * @see https://www.tampermonkey.net/documentation.php#GM_deleteValue
477
+ * @see https://violentmonkey.github.io/api/gm/#gm_deletevalue
478
+ */
479
+ GM_deleteValue: (name: string) => void;
480
+ /**
481
+ * @see https://www.tampermonkey.net/documentation.php#GM_getResourceText
482
+ * @see https://violentmonkey.github.io/api/gm/#gm_getresourcetext
483
+ */
484
+ GM_getResourceText: (name: string) => string;
485
+ /**
486
+ * @see https://www.tampermonkey.net/documentation.php#GM_getResourceURL
487
+ * @see https://violentmonkey.github.io/api/gm/#gm_getresourceurl
488
+ */
489
+ GM_getResourceURL: (name: string, isBlobUrl?: boolean) => string;
490
+ /**
491
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_getValue
492
+ * @see https://violentmonkey.github.io/api/gm/#gm_getvalue
493
+ */
494
+ GM_getValue: <T = unknown>(key: string, defaultValue?: T) => T;
495
+ /**
496
+ * @see https://www.tampermonkey.net/documentation.php#GM_getTab
497
+ * @available tampermonkey
498
+ */
499
+ GM_getTab: <T = any>(callback: (tab: T) => void) => void;
500
+ /**
501
+ * @see https://www.tampermonkey.net/documentation.php#GM_getTabs
502
+ * @available tampermonkey
503
+ */
504
+ GM_getTabs: <T = any>(callback: (tabsMap: {
505
+ [tabId: number]: T;
506
+ }) => void) => void;
507
+ /**
508
+ * @see https://www.tampermonkey.net/documentation.php#GM_info
509
+ * @see https://violentmonkey.github.io/api/gm/#gm_info
510
+ */
511
+ GM_info: GmScriptInfo;
512
+ /**
513
+ * @see https://www.tampermonkey.net/documentation.php#GM_listValues
514
+ * @see https://violentmonkey.github.io/api/gm/#gm_listvalues
515
+ */
516
+ GM_listValues: () => string[];
517
+ /**
518
+ * @see https://www.tampermonkey.net/documentation.php#GM_log
519
+ * @available tampermonkey
520
+ */
521
+ GM_log: (...data: any[]) => void;
522
+ /**
523
+ * @see https://www.tampermonkey.net/documentation.php#GM_notification
524
+ * @see https://violentmonkey.github.io/api/gm/#gm_notification
525
+ */
526
+ GM_notification: GmNotificationFc;
527
+ /**
528
+ * @see https://www.tampermonkey.net/documentation.php#GM_openInTab
529
+ * @see https://violentmonkey.github.io/api/gm/#gm_openintab
530
+ */
531
+ GM_openInTab: GmOpenInTabFc;
532
+ /**
533
+ * @see https://www.tampermonkey.net/documentation.php#GM_registerMenuCommand
534
+ * @see https://violentmonkey.github.io/api/gm/#gm_registermenucommand
535
+ */
536
+ GM_registerMenuCommand: <T extends MouseEvent | KeyboardEvent>(caption: string, onClick: (event: T) => void, accessKey?: string) => string;
537
+ /**
538
+ * @see https://www.tampermonkey.net/documentation.php#GM_removeValueChangeListener
539
+ * @see https://violentmonkey.github.io/api/gm/#gm_removevaluechangelistener
540
+ */
541
+ GM_removeValueChangeListener: (listenerId: string) => void;
542
+ /**
543
+ * @see https://www.tampermonkey.net/documentation.php#GM_saveTab
544
+ * @available tampermonkey
545
+ */
546
+ GM_saveTab: (tab: unknown) => void;
547
+ /**
548
+ * @see https://www.tampermonkey.net/documentation.php#GM_setClipboard
549
+ * @see https://violentmonkey.github.io/api/gm/#gm_setclipboard
550
+ */
551
+ GM_setClipboard: (data: string, type: string) => void;
552
+ /**
553
+ * @see https://www.tampermonkey.net/documentation.php#GM_setValue
554
+ * @see https://violentmonkey.github.io/api/gm/#gm_setvalue
555
+ */
556
+ GM_setValue: (key: string, value: unknown) => void;
557
+ /**
558
+ * @see https://www.tampermonkey.net/documentation.php#GM_unregisterMenuCommand
559
+ * @see https://violentmonkey.github.io/api/gm/#gm_unregistermenucommand
560
+ */
561
+ GM_unregisterMenuCommand: (caption: string) => void;
562
+ /**
563
+ * @see https://www.tampermonkey.net/documentation.php#GM_xmlhttpRequest
564
+ * @see https://violentmonkey.github.io/api/gm/#gm_xmlhttprequest
565
+ */
566
+ GM_xmlhttpRequest: GmXhr;
567
+ /**
568
+ * @see https://www.tampermonkey.net/documentation.php#GM_download
569
+ * @see https://violentmonkey.github.io/api/gm/#gm_download
570
+ */
571
+ GM_download: {
572
+ (options: GmDownloadRequest): GmAbortHandle<boolean>;
573
+ (url: string, name?: string): GmAbortHandle<boolean>;
574
+ };
575
+ /**
576
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_webRequest
577
+ */
578
+ GM_webRequest: (rules: WebRequestRule[], listener: WebRequestListener) => void;
579
+ };
580
+
581
+ declare const monkeyWindow: MonkeyWindow;
582
+
583
+ declare const GM: {
584
+ addStyle: (css: string) => HTMLStyleElement;
585
+ addElement: {
586
+ <K extends keyof HTMLElementTagNameMap>(tagName: K, attributes?: Partial<HTMLElementTagNameMap[K]> | undefined): HTMLElementTagNameMap[K];
587
+ (tagName: string, attributes?: Partial<HTMLElement> | undefined): HTMLElement;
588
+ <K_1 extends keyof HTMLElementTagNameMap>(parentNode: Node | Element | ShadowRoot, tagName: K_1, attributes?: Partial<HTMLElementTagNameMap[K_1]> | undefined): HTMLElementTagNameMap[K_1];
589
+ (parentNode: Node | Element | ShadowRoot, tagName: string, attributes?: Partial<HTMLElement> | undefined): HTMLElement;
590
+ };
591
+ registerMenuCommand: <T extends MouseEvent | KeyboardEvent>(caption: string, onClick: (event: T) => void, accessKey?: string | undefined) => string;
592
+ info: GmScriptInfo;
593
+ cookie: GmCookieFc;
594
+ notification: {
595
+ (text: string, title?: string | undefined, image?: string | undefined, onclick?: (() => void) | undefined): {
596
+ remove: () => Promise<void>;
597
+ };
598
+ (details: GmNotificationDetails, ondone?: (() => void) | undefined): {
599
+ remove: () => Promise<void>;
600
+ };
601
+ };
602
+ openInTab: {
603
+ (url: string, details?: GmOpenInTabDetails | undefined): {
604
+ onclose?: (() => void) | undefined;
605
+ closed: boolean;
606
+ close: () => void;
607
+ };
608
+ (url: string, openInBackground?: boolean | undefined): {
609
+ onclose?: (() => void) | undefined;
610
+ closed: boolean;
611
+ close: () => void;
612
+ };
613
+ };
614
+ setClipboard: (data: string, type: string) => void;
615
+ xmlHttpRequest: {
616
+ <TContext, TResponseType extends keyof {
617
+ text: string;
618
+ json: any;
619
+ arraybuffer: ArrayBuffer;
620
+ blob: Blob;
621
+ document: Document;
622
+ stream: ReadableStream<Uint8Array>;
623
+ } = "text">(details: GmXhrRequest<TContext, TResponseType>): {
624
+ abort(): void;
625
+ };
626
+ RESPONSE_TYPE_STREAM?: "stream" | undefined;
627
+ };
628
+ deleteValue: (key: string) => Promise<void>;
629
+ getResourceURL: (name: string, isBlobUrl?: boolean | undefined) => Promise<string>;
630
+ getValue: <T = unknown>(key: string, defaultValue: T) => Promise<T>;
631
+ listValues: () => Promise<string[]>;
632
+ setValue: (key: string, value: unknown) => Promise<void>;
633
+ };
634
+ declare const unsafeWindow: Window & typeof globalThis;
635
+ /**
636
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_info
637
+ * @see https://violentmonkey.github.io/api/gm/#gm_info
638
+ */
639
+ declare const GM_info: GmScriptInfo;
640
+ /**
641
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_cookie.list
642
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_cookie.set
643
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_cookie.delete
644
+ * @available tampermonkey
645
+ */
646
+ declare const GM_cookie: GmCookieFc;
647
+ /**
648
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_setValue
649
+ * @see https://violentmonkey.github.io/api/gm/#gm_setvalue
650
+ */
651
+ declare const GM_setValue: (key: string, value: unknown) => void;
652
+ /**
653
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_deleteValue
654
+ * @see https://violentmonkey.github.io/api/gm/#gm_deletevalue
655
+ */
656
+ declare const GM_deleteValue: (name: string) => void;
657
+ /**
658
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_listValues
659
+ * @see https://violentmonkey.github.io/api/gm/#gm_listvalues
660
+ */
661
+ declare const GM_listValues: () => string[];
662
+ /**
663
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_addValueChangeListener
664
+ * @see https://violentmonkey.github.io/api/gm/#gm_addvaluechangelistener
665
+ */
666
+ declare const GM_addValueChangeListener: <T = unknown>(name: string, callback: (name: string, oldValue?: T | undefined, newValue?: T | undefined, remote?: boolean | undefined) => void) => string;
667
+ /**
668
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_removeValueChangeListener
669
+ * @see https://violentmonkey.github.io/api/gm/#gm_removevaluechangelistener
670
+ */
671
+ declare const GM_removeValueChangeListener: (listenerId: string) => void;
672
+ /**
673
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_getResourceText
674
+ * @see https://violentmonkey.github.io/api/gm/#gm_getresourcetext
675
+ */
676
+ declare const GM_getResourceText: (name: string) => string;
677
+ /**
678
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_getResourceURL
679
+ * @see https://violentmonkey.github.io/api/gm/#gm_getresourceurl
680
+ */
681
+ declare const GM_getResourceURL: (name: string, isBlobUrl?: boolean | undefined) => string;
682
+ /**
683
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_addElement
684
+ * @see https://violentmonkey.github.io/api/gm/#gm_addelement
685
+ */
686
+ declare const GM_addElement: {
687
+ <K extends keyof HTMLElementTagNameMap>(tagName: K, attributes?: Partial<HTMLElementTagNameMap[K]> | undefined): HTMLElementTagNameMap[K];
688
+ (tagName: string, attributes?: Partial<HTMLElement> | undefined): HTMLElement;
689
+ <K_1 extends keyof HTMLElementTagNameMap>(parentNode: Node | Element | ShadowRoot, tagName: K_1, attributes?: Partial<HTMLElementTagNameMap[K_1]> | undefined): HTMLElementTagNameMap[K_1];
690
+ (parentNode: Node | Element | ShadowRoot, tagName: string, attributes?: Partial<HTMLElement> | undefined): HTMLElement;
691
+ };
692
+ /**
693
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_addStyle
694
+ * @see https://violentmonkey.github.io/api/gm/#gm_addstyle
695
+ */
696
+ declare const GM_addStyle: (css: string) => HTMLStyleElement;
697
+ /**
698
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_openInTab
699
+ * @see https://violentmonkey.github.io/api/gm/#gm_openintab
700
+ */
701
+ declare const GM_openInTab: {
702
+ (url: string, details?: GmOpenInTabDetails | undefined): {
703
+ onclose?: (() => void) | undefined;
704
+ closed: boolean;
705
+ close: () => void;
706
+ };
707
+ (url: string, openInBackground?: boolean | undefined): {
708
+ onclose?: (() => void) | undefined;
709
+ closed: boolean;
710
+ close: () => void;
711
+ };
712
+ };
713
+ /**
714
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_registerMenuCommand
715
+ * @see https://violentmonkey.github.io/api/gm/#gm_registermenucommand
716
+ */
717
+ declare const GM_registerMenuCommand: <T extends MouseEvent | KeyboardEvent>(caption: string, onClick: (event: T) => void, accessKey?: string | undefined) => string;
718
+ /**
719
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_unregisterMenuCommand
720
+ * @see https://violentmonkey.github.io/api/gm/#gm_unregistermenucommand
721
+ */
722
+ declare const GM_unregisterMenuCommand: (caption: string) => void;
723
+ /**
724
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_notification
725
+ * @see https://violentmonkey.github.io/api/gm/#gm_notification
726
+ */
727
+ declare const GM_notification: {
728
+ (text: string, title?: string | undefined, image?: string | undefined, onclick?: (() => void) | undefined): {
729
+ remove: () => Promise<void>;
730
+ };
731
+ (details: GmNotificationDetails, ondone?: (() => void) | undefined): {
732
+ remove: () => Promise<void>;
733
+ };
734
+ };
735
+ /**
736
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_xmlhttpRequest
737
+ * @see https://violentmonkey.github.io/api/gm/#gm_xmlhttprequest
738
+ */
739
+ declare const GM_xmlhttpRequest: {
740
+ <TContext, TResponseType extends keyof {
741
+ text: string;
742
+ json: any;
743
+ arraybuffer: ArrayBuffer;
744
+ blob: Blob;
745
+ document: Document;
746
+ stream: ReadableStream<Uint8Array>;
747
+ } = "text">(details: GmXhrRequest<TContext, TResponseType>): {
748
+ abort(): void;
749
+ };
750
+ RESPONSE_TYPE_STREAM?: "stream" | undefined;
751
+ };
752
+ /**
753
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_setClipboard
754
+ * @see https://violentmonkey.github.io/api/gm/#gm_setclipboard
755
+ */
756
+ declare const GM_setClipboard: (data: string, type: string) => void;
757
+ /**
758
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_download
759
+ * @see https://violentmonkey.github.io/api/gm/#gm_download
760
+ */
761
+ declare const GM_download: {
762
+ (options: GmDownloadRequest): {
763
+ abort(): boolean;
764
+ };
765
+ (url: string, name?: string | undefined): {
766
+ abort(): boolean;
767
+ };
768
+ };
769
+ /**
770
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_log
771
+ * @available tampermonkey
772
+ */
773
+ declare const GM_log: (...data: any[]) => void;
774
+ /**
775
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_getTab
776
+ * @available tampermonkey
777
+ */
778
+ declare const GM_getTab: <T = any>(callback: (tab: T) => void) => void;
779
+ /**
780
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_saveTab
781
+ * @available tampermonkey
782
+ */
783
+ declare const GM_saveTab: (tab: unknown) => void;
784
+ /**
785
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_getTabs
786
+ * @available tampermonkey
787
+ */
788
+ declare const GM_getTabs: <T = any>(callback: (tabsMap: {
789
+ [tabId: number]: T;
790
+ }) => void) => void;
791
+ /**
792
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_getValue
793
+ * @see https://violentmonkey.github.io/api/gm/#gm_getvalue
794
+ */
795
+ declare const GM_getValue: <T = unknown>(key: string, defaultValue?: T | undefined) => T;
796
+ /**
797
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_webRequest
798
+ * @available tampermonkey
799
+ */
800
+ declare const GM_webRequest: (rules: WebRequestRule[], listener: WebRequestListener) => void;
801
+
802
+ export { GM, GM_addElement, GM_addStyle, GM_addValueChangeListener, GM_cookie, GM_deleteValue, GM_download, GM_getResourceText, GM_getResourceURL, GM_getTab, GM_getTabs, GM_getValue, GM_info, GM_listValues, GM_log, GM_notification, GM_openInTab, GM_registerMenuCommand, GM_removeValueChangeListener, GM_saveTab, GM_setClipboard, GM_setValue, GM_unregisterMenuCommand, GM_webRequest, GM_xmlhttpRequest, type GmDownloadRequest, type GmNotificationDetails, type GmOpenInTabDetails, type GmScriptInfo, type GmXhrRequest, type MonkeyWindow, monkeyWindow, unsafeWindow };