Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add the web-bluetooth #66

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "specs/permissions"]
path = specs/permissions
url = https://github.com/w3c/permissions.git
[submodule "specs/web-bluetooth"]
path = specs/web-bluetooth
url = https://github.com/WebBluetoothCG/web-bluetooth.git
138 changes: 134 additions & 4 deletions out/gen/main.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export declare const enum ErrorCode {
InvalidArgument = 'invalid argument',
InvalidSelector = 'invalid selector',
InvalidSessionId = 'invalid session id',
InvalidWebExtension = 'invalid web extension',
MoveTargetOutOfBounds = 'move target out of bounds',
NoSuchAlert = 'no such alert',
NoSuchElement = 'no such element',
Expand All @@ -68,6 +69,7 @@ export declare const enum ErrorCode {
NoSuchScript = 'no such script',
NoSuchStoragePartition = 'no such storage partition',
NoSuchUserContext = 'no such user context',
NoSuchWebExtension = 'no such web extension',
SessionNotCreated = 'session not created',
UnableToCaptureScreen = 'unable to capture screen',
UnableToCloseBrowser = 'unable to close browser',
Expand Down Expand Up @@ -235,11 +237,28 @@ export declare namespace Session {
export type BrowserCommand =
| Browser.Close
| Browser.CreateUserContext
| Browser.GetClientWindows
| Browser.GetUserContexts
| Browser.RemoveUserContext;
| Browser.RemoveUserContext
| Browser.SetClientWindowState
| Record<string, never>;
export type BrowserResult =
| Browser.CreateUserContextResult
| Browser.GetUserContextsResult;
export declare namespace Browser {
type ClientWindow = string;
}
export declare namespace Browser {
type ClientWindowInfo = {
active: boolean;
clientWindow: Browser.ClientWindow;
height: JsUint;
state: 'fullscreen' | 'maximized' | 'minimized' | 'normal';
width: JsUint;
x: JsInt;
y: JsInt;
};
}
export declare namespace Browser {
type UserContext = string;
}
Expand All @@ -263,6 +282,17 @@ export declare namespace Browser {
export declare namespace Browser {
type CreateUserContextResult = Browser.UserContextInfo;
}
export declare namespace Browser {
type GetClientWindows = {
method: 'browser.getClientWindows';
params: EmptyParams;
};
}
export declare namespace Browser {
type GetClientWindowsResult = {
clientWindows: [...Browser.ClientWindowInfo[]];
};
}
export declare namespace Browser {
type GetUserContexts = {
method: 'browser.getUserContexts';
Expand All @@ -285,6 +315,33 @@ export declare namespace Browser {
userContext: Browser.UserContext;
};
}
export declare namespace Browser {
type SetClientWindowState = {
method: 'browser.setClientWindowState';
params: Browser.SetClientWindowStateParameters;
};
}
export declare namespace Browser {
type SetClientWindowStateParameters =
| ({
clientWindow: Browser.ClientWindow;
} & Browser.ClientWindowNamedState)
| Browser.ClientWindowRectState;
}
export declare namespace Browser {
type ClientWindowNamedState = {
state: 'fullscreen' | 'maximized' | 'minimized';
};
}
export declare namespace Browser {
type ClientWindowRectState = {
state: 'normal';
width?: JsUint;
height?: JsUint;
x?: JsInt;
y?: JsInt;
};
}
export type BrowsingContextCommand =
| BrowsingContext.Activate
| BrowsingContext.CaptureScreenshot
Expand All @@ -304,6 +361,7 @@ export type BrowsingContextEvent =
| BrowsingContext.DomContentLoaded
| BrowsingContext.DownloadWillBegin
| BrowsingContext.FragmentNavigated
| BrowsingContext.HistoryUpdated
| BrowsingContext.Load
| BrowsingContext.NavigationAborted
| BrowsingContext.NavigationFailed
Expand All @@ -327,6 +385,7 @@ export declare namespace BrowsingContext {
export declare namespace BrowsingContext {
type Info = {
children: BrowsingContext.InfoList | null;
clientWindow: Browser.ClientWindow;
context: BrowsingContext.BrowsingContext;
originalOpener: BrowsingContext.BrowsingContext | null;
url: string;
Expand Down Expand Up @@ -729,6 +788,18 @@ export declare namespace BrowsingContext {
params: BrowsingContext.NavigationInfo;
};
}
export declare namespace BrowsingContext {
type HistoryUpdated = {
method: 'browsingContext.historyUpdated';
params: BrowsingContext.HistoryUpdatedParameters;
};
}
export declare namespace BrowsingContext {
type HistoryUpdatedParameters = {
context: BrowsingContext.BrowsingContext;
url: string;
};
}
export declare namespace BrowsingContext {
type DomContentLoaded = {
method: 'browsingContext.domContentLoaded';
Expand Down Expand Up @@ -894,11 +965,11 @@ export declare namespace Network {
}
export declare namespace Network {
type Initiator = {
type: 'parser' | 'script' | 'preflight' | 'other';
columnNumber?: JsUint;
lineNumber?: JsUint;
stackTrace?: Script.StackTrace;
request?: Network.Request;
stackTrace?: Script.StackTrace;
type?: 'parser' | 'script' | 'preflight' | 'other';
};
}
export declare namespace Network {
Expand All @@ -916,6 +987,8 @@ export declare namespace Network {
cookies: [...Network.Cookie[]];
headersSize: JsUint;
bodySize: JsUint | null;
destination: string;
initiatorType: string | null;
timings: Network.FetchTimingInfo;
};
}
Expand Down Expand Up @@ -1121,7 +1194,7 @@ export declare namespace Network {
}
export declare namespace Network {
type BeforeRequestSentParameters = Network.BaseParameters & {
initiator: Network.Initiator;
initiator?: Network.Initiator;
};
}
export declare namespace Network {
Expand Down Expand Up @@ -2185,3 +2258,60 @@ export declare namespace Input {
files: [...string[]];
};
}
export type WebExtensionsCommand = WebExtension.Install &
WebExtension.Uninstall;
export type WebExtensionsResult = WebExtension.InstallResult;
export declare namespace WebExtension {
type Extension = string;
}
export declare namespace WebExtension {
type InstallParameters = {
extensionData: WebExtension.ExtensionData;
};
}
export declare namespace WebExtension {
type Install = {
method: 'webExtension.install';
params: WebExtension.InstallParameters;
};
}
export declare namespace WebExtension {
type ExtensionData =
| WebExtension.ExtensionArchivePath
| WebExtension.ExtensionBase64Encoded
| WebExtension.ExtensionPath;
}
export declare namespace WebExtension {
type ExtensionPath = {
type: 'path';
path: string;
};
}
export declare namespace WebExtension {
type ExtensionArchivePath = {
type: 'archivePath';
path: string;
};
}
export declare namespace WebExtension {
type ExtensionBase64Encoded = {
type: 'base64';
value: string;
};
}
export declare namespace WebExtension {
type InstallResult = {
extension: WebExtension.Extension;
};
}
export declare namespace WebExtension {
type Uninstall = {
method: 'webExtension.uninstall';
params: WebExtension.UninstallParameters;
};
}
export declare namespace WebExtension {
type UninstallParameters = {
extension: WebExtension.Extension;
};
}
114 changes: 114 additions & 0 deletions out/gen/web-bluetooth.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
export declare namespace Bluetooth {
type BluetoothServiceUuid = string;
}
export declare namespace Bluetooth {
type BluetoothManufacturerData = {
key: number;
data: string;
};
}
export declare namespace Bluetooth {
type RequestDevice = string;
}
export declare namespace Bluetooth {
type RequestDeviceInfo = {
id: Bluetooth.RequestDevice;
name: string | null;
};
}
export declare namespace Bluetooth {
type RequestDevicePrompt = string;
}
export declare namespace Bluetooth {
type ScanRecord = {
name?: string;
uuids?: [...Bluetooth.BluetoothServiceUuid[]];
appearance?: number;
manufacturerData?: [...Bluetooth.BluetoothManufacturerData[]];
};
}
export declare namespace Bluetooth {
type HandleRequestDevicePrompt = {
method: 'bluetooth.handleRequestDevicePrompt';
params: Bluetooth.HandleRequestDevicePromptParameters;
};
}
export declare namespace Bluetooth {
type HandleRequestDevicePromptParameters = {
context: string;
prompt: Bluetooth.RequestDevicePrompt;
} & (
| Bluetooth.HandleRequestDevicePromptAcceptParameters
| Bluetooth.HandleRequestDevicePromptCancelParameters
);
}
export declare namespace Bluetooth {
type HandleRequestDevicePromptAcceptParameters = {
accept: true;
device: Bluetooth.RequestDevice;
};
}
export declare namespace Bluetooth {
type HandleRequestDevicePromptCancelParameters = {
accept: false;
};
}
export declare namespace Bluetooth {
type SimulateAdapter = {
method: 'bluetooth.simulateAdapter';
params: Bluetooth.SimulateAdapterParameters;
};
}
export declare namespace Bluetooth {
type SimulateAdapterParameters = {
context: string;
state: 'absent' | 'powered-off' | 'powered-on';
};
}
export declare namespace Bluetooth {
type SimulatePreconnectedPeripheral = {
method: 'bluetooth.simulatePreconnectedPeripheral';
params: Bluetooth.SimulatePreconnectedPeripheralParameters;
};
}
export declare namespace Bluetooth {
type SimulatePreconnectedPeripheralParameters = {
context: string;
address: string;
name: string;
manufacturerData: [...Bluetooth.BluetoothManufacturerData[]];
knownServiceUuids: [...Bluetooth.BluetoothServiceUuid[]];
};
}
export declare namespace Bluetooth {
type SimulateAdvertisement = {
method: 'bluetooth.simulateAdvertisement';
params: Bluetooth.SimulateAdvertisementParameters;
};
}
export declare namespace Bluetooth {
type SimulateAdvertisementParameters = {
context: string;
scanEntry: Bluetooth.SimulateAdvertisementScanEntryParameters;
};
}
export declare namespace Bluetooth {
type SimulateAdvertisementScanEntryParameters = {
deviceAddress: string;
rssi: number;
scanRecord: Bluetooth.ScanRecord;
};
}
export declare namespace Bluetooth {
type RequestDevicePromptUpdated = {
method: 'bluetooth.requestDevicePromptUpdated';
params: Bluetooth.RequestDevicePromptUpdatedParameters;
};
}
export declare namespace Bluetooth {
type RequestDevicePromptUpdatedParameters = {
context: string;
prompt: Bluetooth.RequestDevicePrompt;
devices: [...Bluetooth.RequestDeviceInfo[]];
};
}
2 changes: 2 additions & 0 deletions out/gen/web-bluetooth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
'use strict';
Object.defineProperty(exports, '__esModule', {value: true});
Loading