Skip to content
Merged
45 changes: 45 additions & 0 deletions types/chrome/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14860,6 +14860,18 @@ declare namespace chrome {
*/
export type ExecutionWorld = "MAIN" | "USER_SCRIPT";

/** @since Chrome 135 */
export interface InjectionResult {
/** The document associated with the injection. */
documentId: string;
/** The error, if any. `error` and `result` are mutually exclusive. */
error?: string;
/** The frame associated with the injection. */
frameId: number;
/** The result of the script execution. */
result: any;
}

export interface WorldProperties {
/** Specifies the world csp. The default is the `ISOLATED` world csp. */
csp?: string;
Expand All @@ -14876,6 +14888,18 @@ declare namespace chrome {
ids?: string[];
}

/** @since Chrome 135 */
export interface InjectionTarget {
/** Whether the script should inject into all frames within the tab. Defaults to false. This must not be true if `frameIds` is specified. */
allFrames?: boolean;
/** The IDs of specific documentIds to inject into. This must not be set if `frameIds` is set. */
documentIds?: string[];
/** The IDs of specific frames to inject into. */
frameIds?: number[];
/** The ID of the tab into which to inject. */
tabId: number;
}

export interface RegisteredUserScript {
/** If true, it will inject into all frames, even if the frame is not the top-most frame in the tab. Each frame is checked independently for URL requirements; it will not inject into child frames if the URL requirements are not met. Defaults to false, meaning that only the top frame is matched. */
allFrames?: boolean;
Expand All @@ -14902,6 +14926,20 @@ declare namespace chrome {
worldId?: string;
}

/** @since Chrome 135 */
export interface UserScriptInjection {
/** Whether the injection should be triggered in the target as soon as possible. Note that this is not a guarantee that injection will occur prior to page load, as the page may have already loaded by the time the script reaches the target. */
injectImmediately?: boolean;
/** The list of ScriptSource objects defining sources of scripts to be injected into the target. */
js: ScriptSource[];
/** Details specifying the target into which to inject the script. */
target: InjectionTarget;
/** The JavaScript "world" to run the script in. The default is `USER_SCRIPT`. */
world?: ExecutionWorld;
/** Specifies the user script world ID to execute in. If omitted, the script will execute in the default user script world. Only valid if `world` is omitted or is `USER_SCRIPT`. Values with leading underscores (`_`) are reserved. */
worldId?: string;
}

/**
* Properties for a script source.
*/
Expand Down Expand Up @@ -14954,6 +14992,13 @@ declare namespace chrome {
export function getWorldConfigurations(): Promise<WorldProperties[]>;
export function getWorldConfigurations(callback: (worlds: WorldProperties[]) => void): void;

/**
* Injects a script into a target context. By default, the script will be run at `document_idle`, or immediately if the page has already loaded. If the `injectImmediately` property is set, the script will inject without waiting, even if the page has not finished loading. If the script evaluates to a promise, the browser will wait for the promise to settle and return the resulting value.
* @since Chrome 135
*/
export function execute(injection: UserScriptInjection): Promise<InjectionResult[]>;
export function execute(injection: UserScriptInjection, callback: (result: InjectionResult[]) => void): void;

/**
* Registers one or more user scripts for this extension.
*
Expand Down
34 changes: 30 additions & 4 deletions types/chrome/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4404,6 +4404,12 @@ function testUserScripts() {
chrome.userScripts.getScripts(userScriptFilter); // $ExpectType Promise<RegisteredUserScript[]>
chrome.userScripts.getScripts(userScriptFilter, (scripts: chrome.userScripts.RegisteredUserScript[]) => void 0); // $ExpectType void

const badScripts = [
{
id: "badScriptId",
matches: ["*://example.com/*"],
},
];
const scripts = [
{
id: "scriptId1",
Expand All @@ -4416,13 +4422,26 @@ function testUserScripts() {
matches: ["*://example.org/*"],
},
];

const badScripts = [
const jsInjections: chrome.userScripts.ScriptSource[] = [
{
id: "badScriptId",
matches: ["*://example.com/*"],
file: "./the/script.js",
},
{
code: "console.log(\"Wow the script works!\");",
},
];
const injectionTarget: chrome.userScripts.InjectionTarget = {
tabId: 46,
allFrames: true,
};

const badExeOptions = {};
const exeOptions: chrome.userScripts.UserScriptInjection = {
injectImmediately: true,
js: jsInjections,
target: injectionTarget,
worldId: "USER_SCRIPT",
};

chrome.userScripts.getWorldConfigurations(); // $ExpectType Promise<WorldProperties[]>
chrome.userScripts.getWorldConfigurations(([world]) => { // $ExpectType void
Expand All @@ -4433,6 +4452,13 @@ function testUserScripts() {
// @ts-expect-error
chrome.userScripts.getWorldConfigurations(() => {}).then(() => {});

// @ts-expect-error
chrome.userScripts.execute(badExeOptions);
chrome.userScripts.execute(exeOptions); // $ExpectType Promise<InjectionResult[]>
chrome.userScripts.execute(exeOptions, (result) => { // $ExpectType void
result; // $ExpectType InjectionResult[]
});

chrome.userScripts.register(scripts); // $ExpectType Promise<void>
chrome.userScripts.register(scripts, () => void 0); // $ExpectType void
// @ts-expect-error Missing required property 'js'.
Expand Down
4 changes: 0 additions & 4 deletions types/connect-mongodb-session/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
{
"name": "Nattapong Sirilappanich",
"githubUsername": "NattapongSiri"
},
{
"name": "Ravi van Rooijen",
"githubUsername": "HoldYourWaffle"
}
]
}
2 changes: 2 additions & 0 deletions types/invity-api/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,8 @@ export interface SellProviderInfo {
flow?: SellFiatFlowType | undefined;
isRefundAddressRequired?: boolean | undefined;
pendingTimeout?: number | undefined; // Time until a SUBMITTED transaction automatically changes to PENDING. Null means it does not change.
/** Should be used when it's necessary to have the exact amount match between the trade and the transaction */
lockSendAmount?: boolean;
}

export interface SellListResponse {
Expand Down
17 changes: 17 additions & 0 deletions types/invity-api/invity-api-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
ExchangeTrade,
InfoResponse,
SellFiatTrade,
SellProviderInfo,
WatchSellTradeResponse,
} from "invity-api";

Expand Down Expand Up @@ -92,3 +93,19 @@ const exchangeProviderInfo: ExchangeProviderInfo = {
kycPolicyType: "KYC-norefund",
isRefundRequired: false,
};

const sellProviderInfo: SellProviderInfo = {
name: "example",
companyName: "Example",
logo: "example-icon.jpg",
type: "Fiat",
isActive: true,
tradedCoins: ["bitcoin", "ethereum"] as CryptoId[],
tradedFiatCurrencies: ["USD"],
supportedCountries: ["US"],
statusUrl: "https://example.com/txs/{{orderId}}",
supportUrl: " https://support.example.com",
flow: "PAYMENT_GATE",
isRefundAddressRequired: false,
lockSendAmount: false,
};
2 changes: 1 addition & 1 deletion types/koa-generic-session/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ declare namespace koaSession {
}

declare module "koa" {
interface Context {
interface ExtendableContext {
sessionId: string;
session: koaSession.Session | null;
sessionSave: boolean | null;
Expand Down
5 changes: 4 additions & 1 deletion types/koa-generic-session/koa-generic-session-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ declare module "koa-generic-session" {
}
}

app.use((context: Koa.Context) => {
app.use(context => {
if (!context.session) {
return;
}
Expand All @@ -67,8 +67,11 @@ app.use((context: Koa.Context) => {
}

context.regenerateSession();
context.sessionSave; // $ExpectType boolean | null
context.sessionSave = true;
context.session; // $ExpectType Session
context.session.cookie;
context.session.foo; // $ExpectType "bar"
context.session.foo = "bar";
context.session = null;
});
Expand Down
12 changes: 12 additions & 0 deletions types/novnc__novnc/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ declare module "@novnc/novnc/lib/rfb" {
* value of `capabilities`.
*/
capabilities: CustomEvent<{ capabilities: NoVncClient["capabilities"] }>;

/**
* The `clippingviewport` event is fired whenever `clippingViewport` changes between true and false.
* The `detail` property is a `boolean` with the new value of `clippingViewport`.
*/
clippingviewport: CustomEvent<NoVncClient["clippingViewport"]>;
}

type NoVncEventType = keyof NoVncEvents;
Expand Down Expand Up @@ -218,6 +224,12 @@ declare module "@novnc/novnc/lib/rfb" {
power: boolean;
};

/**
* Is a `boolean` indicating if the remote session is currently being clipped to its container.
* Only relevant if `clipViewport` is enabled.
*/
readonly clippingViewport: boolean;

/**
* Disconnect from the server.
*/
Expand Down
1 change: 1 addition & 0 deletions types/novnc__novnc/novnc__novnc-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const rfb = new RFB(window.document.body, "wss://example.local", {
rfb.viewOnly; // $ExpectType boolean
rfb.focusOnClick; // $ExpectType boolean
rfb.clipViewport; // $ExpectType boolean
rfb.clippingViewport; // $ExpectType boolean
rfb.dragViewport; // $ExpectType boolean
rfb.scaleViewport; // $ExpectType boolean
rfb.resizeSession; // $ExpectType boolean
Expand Down
2 changes: 1 addition & 1 deletion types/novnc__novnc/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@types/novnc__novnc",
"version": "1.5.9999",
"version": "1.6.9999",
"projects": [
"https://github.com/novnc/noVNC"
],
Expand Down
5 changes: 5 additions & 0 deletions types/react-native-web/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type {
ComponentClass,
ComponentType,
createElement,
CSSProperties,
FocusEventHandler,
FunctionComponent,
Expand Down Expand Up @@ -1258,6 +1259,10 @@ export function useWindowDimensions(): {
width: number;
};

// unstable APIs

export const unstable_createElement: typeof createElement;

export {};

declare module "react-native" {
Expand Down
5 changes: 5 additions & 0 deletions types/react-native-web/react-native-web-tests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ import {
TouchableNativeFeedback,
TouchableOpacity,
TouchableWithoutFeedback,
// unstable APIs
unstable_createElement,
// hooks
useColorScheme,
useLocaleContext,
Expand Down Expand Up @@ -382,6 +384,9 @@ const colorScheme = useColorScheme();
const localeContext = useLocaleContext();
const windowDimensions = useWindowDimensions();

// Unstable APIs
const videoElement = unstable_createElement("video", { src: "a_url", controls: true, muted: "arst" });

const node = 0;
UIManager.blur(node);
UIManager.focus(node);
Expand Down
13 changes: 13 additions & 0 deletions types/three/examples/jsm/helpers/RapierHelper.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import * as RAPIER from "@dimforge/rapier3d-compat";
import { LineSegments } from "three";

declare class RapierHelper extends LineSegments {
world: RAPIER.World;

constructor(world: RAPIER.World);

update(): void;
dispose(): void;
}

export { RapierHelper };
4 changes: 4 additions & 0 deletions types/three/examples/jsm/loaders/LottieLoader.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { CanvasTexture, Loader, LoadingManager } from "three";

export class LottieLoader extends Loader<CanvasTexture> {
/**
* @deprecated The loader has been deprecated and will be removed with r186. Use lottie-web instead and create your
* animated texture manually.
*/
constructor(manager?: LoadingManager);

load(
Expand Down
2 changes: 1 addition & 1 deletion types/three/examples/jsm/misc/MD2CharacterComplex.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class MD2CharacterComplex {
maxReverseSpeed: number;
frontAcceleration: number;
backAcceleration: number;
frontDecceleration: number;
frontDeceleration: number;
angularSpeed: number;
root: Object3D;
meshBody: Mesh | null;
Expand Down
12 changes: 12 additions & 0 deletions types/three/examples/jsm/physics/RapierPhysics.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
import * as RAPIER from "@dimforge/rapier3d-compat";
import { Mesh, Object3D } from "three";

type Vector = { x: number; y: number; z: number };

export interface RapierPhysicsObject {
RAPIER: typeof RAPIER;
world: RAPIER.World;
addScene: (scene: Object3D) => void;
addMesh: (mesh: Mesh, mass?: number, restitution?: number) => void;
setMeshPosition: (mesh: Mesh, position: Vector, index?: number) => void;
setMeshVelocity: (mesh: Mesh, velocity: Vector, index?: number) => void;
addHeightfield: (
mesh: Mesh,
width: number,
depth: number,
heights: Float32Array,
scale: Vector,
) => RAPIER.RigidBody;
}

export function RapierPhysics(): Promise<RapierPhysicsObject>;

export type RAPIER = typeof RAPIER;
4 changes: 2 additions & 2 deletions types/three/examples/jsm/postprocessing/BokehPass.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { Camera, Color, MeshDepthMaterial, Scene, ShaderMaterial, WebGLRenderTar

import { FullScreenQuad, Pass } from "./Pass.js";

export interface BokehPassParamters {
export interface BokehPassParameters {
focus?: number;
aspect?: number;
aperture?: number;
maxblur?: number;
}

export class BokehPass extends Pass {
constructor(scene: Scene, camera: Camera, params: BokehPassParamters);
constructor(scene: Scene, camera: Camera, params: BokehPassParameters);
scene: Scene;
camera: Camera;
renderTargetColor: WebGLRenderTarget;
Expand Down
14 changes: 14 additions & 0 deletions types/three/examples/jsm/tsl/shadows/TileShadowNode.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Light, ShadowBaseNode } from "three/webgpu";

export interface TileShadeNodeConfig {
tilesX?: number | undefined;
tilesY?: number | undefined;
resolution?: { width: number; height: number };
debug?: boolean | undefined;
}

declare class TileShadowNode extends ShadowBaseNode {
constructor(light: Light, options?: TileShadeNodeConfig);
}

export { TileShadowNode };
14 changes: 14 additions & 0 deletions types/three/examples/jsm/tsl/shadows/TileShadowNodeHelper.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Group } from "three/webgpu";
import { TileShadowNode } from "./TileShadowNode.js";

declare class TileShadowNodeHelper extends Group {
constructor(tileShadowNode: TileShadowNode);

init(): void;

update(): void;

dispose(): void;
}

export { TileShadowNodeHelper };
Loading