dsh-builtin-browser 0.1.6 → 0.1.7

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,82 @@
1
+ /**
2
+ * Ambient declaration for the `electron` module used by the self-hosted
3
+ * browser host (`host-main.ts`). The electron package is an optional peer
4
+ * dependency (present in desktop-shell environments), so it is not in
5
+ * devDependencies; this shim keeps typechecking self-contained.
6
+ * @module dsh-browser/types/electron-shim
7
+ */
8
+
9
+ declare module 'electron' {
10
+ export interface WebContentsDebugger {
11
+ attach(version: string): void
12
+ detach(): void
13
+ sendCommand(method: string, params?: Record<string, unknown>): Promise<unknown>
14
+ }
15
+ export interface DownloadItem {
16
+ setSavePath(path: string): void
17
+ }
18
+ export interface Cookie {
19
+ domain: string
20
+ path: string
21
+ secure: boolean
22
+ httpOnly: boolean
23
+ name: string
24
+ value: string
25
+ expirationDate?: number
26
+ }
27
+ export interface CookieSetter {
28
+ url: string
29
+ name: string
30
+ value: string
31
+ domain?: string
32
+ path?: string
33
+ secure?: boolean
34
+ httpOnly?: boolean
35
+ expirationDate?: number
36
+ }
37
+ export interface Session {
38
+ once(event: 'will-download', listener: (event: Event, item: DownloadItem) => void): void
39
+ readonly cookies: {
40
+ get(filter: Record<string, unknown>): Promise<Cookie[]>
41
+ set(details: CookieSetter): Promise<void>
42
+ }
43
+ }
44
+ export interface WebContents {
45
+ readonly id: number
46
+ readonly debugger: WebContentsDebugger
47
+ readonly session: Session
48
+ close(): void
49
+ downloadURL(url: string): void
50
+ }
51
+ export interface WebContentsView {
52
+ readonly webContents: WebContents
53
+ setBounds(bounds: { x: number; y: number; width: number; height: number }): void
54
+ setVisible(visible: boolean): void
55
+ getVisible(): boolean
56
+ getBounds(): { x: number; y: number; width: number; height: number }
57
+ }
58
+ export interface BrowserWindow {
59
+ readonly contentView: {
60
+ addChildView(view: WebContentsView): void
61
+ removeChildView(view: WebContentsView): void
62
+ readonly children: WebContentsView[]
63
+ }
64
+ getContentSize(): [number, number]
65
+ on(event: 'closed', listener: () => void): this
66
+ on(event: 'resize', listener: () => void): this
67
+ off(event: 'closed', listener: () => void): this
68
+ off(event: 'resize', listener: () => void): this
69
+ }
70
+ export const app: {
71
+ whenReady(): Promise<void>
72
+ exit(code?: number): void
73
+ }
74
+ export interface BrowserWindowConstructor {
75
+ new(options?: Record<string, unknown>): BrowserWindow
76
+ }
77
+ export interface WebContentsViewConstructor {
78
+ new(options?: Record<string, unknown>): WebContentsView
79
+ }
80
+ export const BrowserWindow: BrowserWindowConstructor
81
+ export const WebContentsView: WebContentsViewConstructor
82
+ }