init
This commit is contained in:
commit
42ef2f9674
468 files changed
+645161
No files matched your search
+33
@@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
|
||||
var base = require('./base.cjs');
|
||||
var core = require('../core.cjs');
|
||||
|
||||
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
/** A predefined (native) menu item which has a predefined behavior by the OS or by tauri. */
|
||||
class PredefinedMenuItem extends base.MenuItemBase {
|
||||
/** @ignore */
|
||||
constructor(rid, id) {
|
||||
super(rid, id, 'Predefined');
|
||||
}
|
||||
/** Create a new predefined menu item. */
|
||||
static async new(opts) {
|
||||
return base.newMenu('Predefined', opts).then(([rid, id]) => new PredefinedMenuItem(rid, id));
|
||||
}
|
||||
/** Returns the text of this predefined menu item. */
|
||||
async text() {
|
||||
return core.invoke('plugin:menu|text', { rid: this.rid, kind: this.kind });
|
||||
}
|
||||
/** Sets the text for this predefined menu item. */
|
||||
async setText(text) {
|
||||
return core.invoke('plugin:menu|set_text', {
|
||||
rid: this.rid,
|
||||
kind: this.kind,
|
||||
text
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
exports.PredefinedMenuItem = PredefinedMenuItem;
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
import "./logger.js";
|
||||
import { a as resolveBaseUrl, c as sortUserPlugins, i as loadConfigFromFile, n as getDefaultEnvironmentOptions, o as resolveConfig, r as isResolvedConfig, s as resolveDevEnvironmentOptions, t as defineConfig } from "./config.js";
|
||||
|
||||
export { resolveConfig };
|
||||
+340
@@ -0,0 +1,340 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
/////////////////////////////
|
||||
/// Worker Iterable APIs
|
||||
/////////////////////////////
|
||||
|
||||
interface CSSNumericArray {
|
||||
[Symbol.iterator](): ArrayIterator<CSSNumericValue>;
|
||||
entries(): ArrayIterator<[number, CSSNumericValue]>;
|
||||
keys(): ArrayIterator<number>;
|
||||
values(): ArrayIterator<CSSNumericValue>;
|
||||
}
|
||||
|
||||
interface CSSTransformValue {
|
||||
[Symbol.iterator](): ArrayIterator<CSSTransformComponent>;
|
||||
entries(): ArrayIterator<[number, CSSTransformComponent]>;
|
||||
keys(): ArrayIterator<number>;
|
||||
values(): ArrayIterator<CSSTransformComponent>;
|
||||
}
|
||||
|
||||
interface CSSUnparsedValue {
|
||||
[Symbol.iterator](): ArrayIterator<CSSUnparsedSegment>;
|
||||
entries(): ArrayIterator<[number, CSSUnparsedSegment]>;
|
||||
keys(): ArrayIterator<number>;
|
||||
values(): ArrayIterator<CSSUnparsedSegment>;
|
||||
}
|
||||
|
||||
interface Cache {
|
||||
/**
|
||||
* The **`addAll()`** method of the Cache interface takes an array of URLs, retrieves them, and adds the resulting response objects to the given cache.
|
||||
*
|
||||
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Cache/addAll)
|
||||
*/
|
||||
addAll(requests: Iterable<RequestInfo>): Promise<void>;
|
||||
}
|
||||
|
||||
interface CanvasPath {
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/roundRect) */
|
||||
roundRect(x: number, y: number, w: number, h: number, radii?: number | DOMPointInit | Iterable<number | DOMPointInit>): void;
|
||||
}
|
||||
|
||||
interface CanvasPathDrawingStyles {
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/setLineDash) */
|
||||
setLineDash(segments: Iterable<number>): void;
|
||||
}
|
||||
|
||||
interface CookieStoreManager {
|
||||
/**
|
||||
* The **`subscribe()`** method of the CookieStoreManager interface subscribes a ServiceWorkerRegistration to cookie change events.
|
||||
*
|
||||
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CookieStoreManager/subscribe)
|
||||
*/
|
||||
subscribe(subscriptions: Iterable<CookieStoreGetOptions>): Promise<void>;
|
||||
/**
|
||||
* The **`unsubscribe()`** method of the CookieStoreManager interface stops the ServiceWorkerRegistration from receiving previously subscribed events.
|
||||
*
|
||||
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CookieStoreManager/unsubscribe)
|
||||
*/
|
||||
unsubscribe(subscriptions: Iterable<CookieStoreGetOptions>): Promise<void>;
|
||||
}
|
||||
|
||||
interface DOMStringList {
|
||||
[Symbol.iterator](): ArrayIterator<string>;
|
||||
}
|
||||
|
||||
interface FileList {
|
||||
[Symbol.iterator](): ArrayIterator<File>;
|
||||
}
|
||||
|
||||
interface FontFaceSet extends Set<FontFace> {
|
||||
}
|
||||
|
||||
interface FormDataIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {
|
||||
[Symbol.iterator](): FormDataIterator<T>;
|
||||
}
|
||||
|
||||
interface FormData {
|
||||
[Symbol.iterator](): FormDataIterator<[string, FormDataEntryValue]>;
|
||||
/** Returns an array of key, value pairs for every entry in the list. */
|
||||
entries(): FormDataIterator<[string, FormDataEntryValue]>;
|
||||
/** Returns a list of keys in the list. */
|
||||
keys(): FormDataIterator<string>;
|
||||
/** Returns a list of values in the list. */
|
||||
values(): FormDataIterator<FormDataEntryValue>;
|
||||
}
|
||||
|
||||
interface HeadersIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {
|
||||
[Symbol.iterator](): HeadersIterator<T>;
|
||||
}
|
||||
|
||||
interface Headers {
|
||||
[Symbol.iterator](): HeadersIterator<[string, string]>;
|
||||
/** Returns an iterator allowing to go through all key/value pairs contained in this object. */
|
||||
entries(): HeadersIterator<[string, string]>;
|
||||
/** Returns an iterator allowing to go through all keys of the key/value pairs contained in this object. */
|
||||
keys(): HeadersIterator<string>;
|
||||
/** Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */
|
||||
values(): HeadersIterator<string>;
|
||||
}
|
||||
|
||||
interface IDBDatabase {
|
||||
/**
|
||||
* The **`transaction`** method of the IDBDatabase interface immediately returns a transaction object (IDBTransaction) containing the IDBTransaction.objectStore method, which you can use to access your object store.
|
||||
*
|
||||
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/transaction)
|
||||
*/
|
||||
transaction(storeNames: string | Iterable<string>, mode?: IDBTransactionMode, options?: IDBTransactionOptions): IDBTransaction;
|
||||
}
|
||||
|
||||
interface IDBObjectStore {
|
||||
/**
|
||||
* The **`createIndex()`** method of the field/column defining a new data point for each database record to contain.
|
||||
*
|
||||
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBObjectStore/createIndex)
|
||||
*/
|
||||
createIndex(name: string, keyPath: string | Iterable<string>, options?: IDBIndexParameters): IDBIndex;
|
||||
}
|
||||
|
||||
interface ImageTrackList {
|
||||
[Symbol.iterator](): ArrayIterator<ImageTrack>;
|
||||
}
|
||||
|
||||
interface MessageEvent<T = any> {
|
||||
/** @deprecated */
|
||||
initMessageEvent(type: string, bubbles?: boolean, cancelable?: boolean, data?: any, origin?: string, lastEventId?: string, source?: MessageEventSource | null, ports?: Iterable<MessagePort>): void;
|
||||
}
|
||||
|
||||
interface StylePropertyMapReadOnlyIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {
|
||||
[Symbol.iterator](): StylePropertyMapReadOnlyIterator<T>;
|
||||
}
|
||||
|
||||
interface StylePropertyMapReadOnly {
|
||||
[Symbol.iterator](): StylePropertyMapReadOnlyIterator<[string, Iterable<CSSStyleValue>]>;
|
||||
entries(): StylePropertyMapReadOnlyIterator<[string, Iterable<CSSStyleValue>]>;
|
||||
keys(): StylePropertyMapReadOnlyIterator<string>;
|
||||
values(): StylePropertyMapReadOnlyIterator<Iterable<CSSStyleValue>>;
|
||||
}
|
||||
|
||||
interface SubtleCrypto {
|
||||
/**
|
||||
* The **`deriveKey()`** method of the SubtleCrypto interface can be used to derive a secret key from a master key.
|
||||
*
|
||||
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey)
|
||||
*/
|
||||
deriveKey(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: AlgorithmIdentifier | AesDerivedKeyParams | HmacImportParams | HkdfParams | Pbkdf2Params, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKey>;
|
||||
/**
|
||||
* The **`generateKey()`** method of the SubtleCrypto interface is used to generate a new key (for symmetric algorithms) or key pair (for public-key algorithms).
|
||||
*
|
||||
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey)
|
||||
*/
|
||||
generateKey(algorithm: "Ed25519" | { name: "Ed25519" }, extractable: boolean, keyUsages: ReadonlyArray<"sign" | "verify">): Promise<CryptoKeyPair>;
|
||||
generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKeyPair>;
|
||||
generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKey>;
|
||||
generateKey(algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKeyPair | CryptoKey>;
|
||||
/**
|
||||
* The **`importKey()`** method of the SubtleCrypto interface imports a key: that is, it takes as input a key in an external, portable format and gives you a CryptoKey object that you can use in the Web Crypto API.
|
||||
*
|
||||
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey)
|
||||
*/
|
||||
importKey(format: "jwk", keyData: JsonWebKey, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKey>;
|
||||
importKey(format: Exclude<KeyFormat, "jwk">, keyData: BufferSource, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKey>;
|
||||
/**
|
||||
* The **`unwrapKey()`** method of the SubtleCrypto interface 'unwraps' a key.
|
||||
*
|
||||
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey)
|
||||
*/
|
||||
unwrapKey(format: KeyFormat, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, unwrappedKeyAlgorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKey>;
|
||||
}
|
||||
|
||||
interface URLSearchParamsIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {
|
||||
[Symbol.iterator](): URLSearchParamsIterator<T>;
|
||||
}
|
||||
|
||||
interface URLSearchParams {
|
||||
[Symbol.iterator](): URLSearchParamsIterator<[string, string]>;
|
||||
/** Returns an array of key, value pairs for every entry in the search params. */
|
||||
entries(): URLSearchParamsIterator<[string, string]>;
|
||||
/** Returns a list of keys in the search params. */
|
||||
keys(): URLSearchParamsIterator<string>;
|
||||
/** Returns a list of values in the search params. */
|
||||
values(): URLSearchParamsIterator<string>;
|
||||
}
|
||||
|
||||
interface WEBGL_draw_buffers {
|
||||
/**
|
||||
* The **`WEBGL_draw_buffers.drawBuffersWEBGL()`** method is part of the WebGL API and allows you to define the draw buffers to which all fragment colors are written.
|
||||
*
|
||||
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WEBGL_draw_buffers/drawBuffersWEBGL)
|
||||
*/
|
||||
drawBuffersWEBGL(buffers: Iterable<GLenum>): void;
|
||||
}
|
||||
|
||||
interface WEBGL_multi_draw {
|
||||
/**
|
||||
* The **`WEBGL_multi_draw.multiDrawArraysInstancedWEBGL()`** method of the WebGL API renders multiple primitives from array data.
|
||||
*
|
||||
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)
|
||||
*/
|
||||
multiDrawArraysInstancedWEBGL(mode: GLenum, firstsList: Int32Array<ArrayBufferLike> | Iterable<GLint>, firstsOffset: number, countsList: Int32Array<ArrayBufferLike> | Iterable<GLsizei>, countsOffset: number, instanceCountsList: Int32Array<ArrayBufferLike> | Iterable<GLsizei>, instanceCountsOffset: number, drawcount: GLsizei): void;
|
||||
/**
|
||||
* The **`WEBGL_multi_draw.multiDrawArraysWEBGL()`** method of the WebGL API renders multiple primitives from array data.
|
||||
*
|
||||
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WEBGL_multi_draw/multiDrawArraysWEBGL)
|
||||
*/
|
||||
multiDrawArraysWEBGL(mode: GLenum, firstsList: Int32Array<ArrayBufferLike> | Iterable<GLint>, firstsOffset: number, countsList: Int32Array<ArrayBufferLike> | Iterable<GLsizei>, countsOffset: number, drawcount: GLsizei): void;
|
||||
/**
|
||||
* The **`WEBGL_multi_draw.multiDrawElementsInstancedWEBGL()`** method of the WebGL API renders multiple primitives from array data.
|
||||
*
|
||||
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)
|
||||
*/
|
||||
multiDrawElementsInstancedWEBGL(mode: GLenum, countsList: Int32Array<ArrayBufferLike> | Iterable<GLsizei>, countsOffset: number, type: GLenum, offsetsList: Int32Array<ArrayBufferLike> | Iterable<GLsizei>, offsetsOffset: number, instanceCountsList: Int32Array<ArrayBufferLike> | Iterable<GLsizei>, instanceCountsOffset: number, drawcount: GLsizei): void;
|
||||
/**
|
||||
* The **`WEBGL_multi_draw.multiDrawElementsWEBGL()`** method of the WebGL API renders multiple primitives from array data.
|
||||
*
|
||||
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WEBGL_multi_draw/multiDrawElementsWEBGL)
|
||||
*/
|
||||
multiDrawElementsWEBGL(mode: GLenum, countsList: Int32Array<ArrayBufferLike> | Iterable<GLsizei>, countsOffset: number, type: GLenum, offsetsList: Int32Array<ArrayBufferLike> | Iterable<GLsizei>, offsetsOffset: number, drawcount: GLsizei): void;
|
||||
}
|
||||
|
||||
interface WebGL2RenderingContextBase {
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/clearBuffer) */
|
||||
clearBufferfv(buffer: GLenum, drawbuffer: GLint, values: Iterable<GLfloat>, srcOffset?: number): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/clearBuffer) */
|
||||
clearBufferiv(buffer: GLenum, drawbuffer: GLint, values: Iterable<GLint>, srcOffset?: number): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/clearBuffer) */
|
||||
clearBufferuiv(buffer: GLenum, drawbuffer: GLint, values: Iterable<GLuint>, srcOffset?: number): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/drawBuffers) */
|
||||
drawBuffers(buffers: Iterable<GLenum>): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/getActiveUniforms) */
|
||||
getActiveUniforms(program: WebGLProgram, uniformIndices: Iterable<GLuint>, pname: GLenum): any;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/getUniformIndices) */
|
||||
getUniformIndices(program: WebGLProgram, uniformNames: Iterable<string>): GLuint[] | null;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/invalidateFramebuffer) */
|
||||
invalidateFramebuffer(target: GLenum, attachments: Iterable<GLenum>): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/invalidateSubFramebuffer) */
|
||||
invalidateSubFramebuffer(target: GLenum, attachments: Iterable<GLenum>, x: GLint, y: GLint, width: GLsizei, height: GLsizei): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/transformFeedbackVaryings) */
|
||||
transformFeedbackVaryings(program: WebGLProgram, varyings: Iterable<string>, bufferMode: GLenum): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/uniform) */
|
||||
uniform1uiv(location: WebGLUniformLocation | null, data: Iterable<GLuint>, srcOffset?: number, srcLength?: GLuint): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/uniform) */
|
||||
uniform2uiv(location: WebGLUniformLocation | null, data: Iterable<GLuint>, srcOffset?: number, srcLength?: GLuint): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/uniform) */
|
||||
uniform3uiv(location: WebGLUniformLocation | null, data: Iterable<GLuint>, srcOffset?: number, srcLength?: GLuint): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/uniform) */
|
||||
uniform4uiv(location: WebGLUniformLocation | null, data: Iterable<GLuint>, srcOffset?: number, srcLength?: GLuint): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/uniformMatrix) */
|
||||
uniformMatrix2x3fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable<GLfloat>, srcOffset?: number, srcLength?: GLuint): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/uniformMatrix) */
|
||||
uniformMatrix2x4fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable<GLfloat>, srcOffset?: number, srcLength?: GLuint): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/uniformMatrix) */
|
||||
uniformMatrix3x2fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable<GLfloat>, srcOffset?: number, srcLength?: GLuint): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/uniformMatrix) */
|
||||
uniformMatrix3x4fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable<GLfloat>, srcOffset?: number, srcLength?: GLuint): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/uniformMatrix) */
|
||||
uniformMatrix4x2fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable<GLfloat>, srcOffset?: number, srcLength?: GLuint): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/uniformMatrix) */
|
||||
uniformMatrix4x3fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable<GLfloat>, srcOffset?: number, srcLength?: GLuint): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/vertexAttribI) */
|
||||
vertexAttribI4iv(index: GLuint, values: Iterable<GLint>): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/vertexAttribI) */
|
||||
vertexAttribI4uiv(index: GLuint, values: Iterable<GLuint>): void;
|
||||
}
|
||||
|
||||
interface WebGL2RenderingContextOverloads {
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
|
||||
uniform1fv(location: WebGLUniformLocation | null, data: Iterable<GLfloat>, srcOffset?: number, srcLength?: GLuint): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
|
||||
uniform1iv(location: WebGLUniformLocation | null, data: Iterable<GLint>, srcOffset?: number, srcLength?: GLuint): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
|
||||
uniform2fv(location: WebGLUniformLocation | null, data: Iterable<GLfloat>, srcOffset?: number, srcLength?: GLuint): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
|
||||
uniform2iv(location: WebGLUniformLocation | null, data: Iterable<GLint>, srcOffset?: number, srcLength?: GLuint): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
|
||||
uniform3fv(location: WebGLUniformLocation | null, data: Iterable<GLfloat>, srcOffset?: number, srcLength?: GLuint): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
|
||||
uniform3iv(location: WebGLUniformLocation | null, data: Iterable<GLint>, srcOffset?: number, srcLength?: GLuint): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
|
||||
uniform4fv(location: WebGLUniformLocation | null, data: Iterable<GLfloat>, srcOffset?: number, srcLength?: GLuint): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
|
||||
uniform4iv(location: WebGLUniformLocation | null, data: Iterable<GLint>, srcOffset?: number, srcLength?: GLuint): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/uniformMatrix) */
|
||||
uniformMatrix2fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable<GLfloat>, srcOffset?: number, srcLength?: GLuint): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniformMatrix) */
|
||||
uniformMatrix3fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable<GLfloat>, srcOffset?: number, srcLength?: GLuint): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniformMatrix) */
|
||||
uniformMatrix4fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable<GLfloat>, srcOffset?: number, srcLength?: GLuint): void;
|
||||
}
|
||||
|
||||
interface WebGLRenderingContextBase {
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/vertexAttrib) */
|
||||
vertexAttrib1fv(index: GLuint, values: Iterable<GLfloat>): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/vertexAttrib) */
|
||||
vertexAttrib2fv(index: GLuint, values: Iterable<GLfloat>): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/vertexAttrib) */
|
||||
vertexAttrib3fv(index: GLuint, values: Iterable<GLfloat>): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/vertexAttrib) */
|
||||
vertexAttrib4fv(index: GLuint, values: Iterable<GLfloat>): void;
|
||||
}
|
||||
|
||||
interface WebGLRenderingContextOverloads {
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
|
||||
uniform1fv(location: WebGLUniformLocation | null, v: Iterable<GLfloat>): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
|
||||
uniform1iv(location: WebGLUniformLocation | null, v: Iterable<GLint>): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
|
||||
uniform2fv(location: WebGLUniformLocation | null, v: Iterable<GLfloat>): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
|
||||
uniform2iv(location: WebGLUniformLocation | null, v: Iterable<GLint>): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
|
||||
uniform3fv(location: WebGLUniformLocation | null, v: Iterable<GLfloat>): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
|
||||
uniform3iv(location: WebGLUniformLocation | null, v: Iterable<GLint>): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
|
||||
uniform4fv(location: WebGLUniformLocation | null, v: Iterable<GLfloat>): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
|
||||
uniform4iv(location: WebGLUniformLocation | null, v: Iterable<GLint>): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniformMatrix) */
|
||||
uniformMatrix2fv(location: WebGLUniformLocation | null, transpose: GLboolean, value: Iterable<GLfloat>): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniformMatrix) */
|
||||
uniformMatrix3fv(location: WebGLUniformLocation | null, transpose: GLboolean, value: Iterable<GLfloat>): void;
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniformMatrix) */
|
||||
uniformMatrix4fv(location: WebGLUniformLocation | null, transpose: GLboolean, value: Iterable<GLfloat>): void;
|
||||
}
|
||||
+211
@@ -0,0 +1,211 @@
|
||||
'use strict';
|
||||
|
||||
var webview = require('./webview.cjs');
|
||||
var window = require('./window.cjs');
|
||||
var event = require('./event.cjs');
|
||||
var core = require('./core.cjs');
|
||||
|
||||
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
/**
|
||||
* Get an instance of `Webview` for the current webview window.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
function getCurrentWebviewWindow() {
|
||||
const webview$1 = webview.getCurrentWebview();
|
||||
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
||||
return new WebviewWindow(webview$1.label, { skip: true });
|
||||
}
|
||||
/**
|
||||
* Gets a list of instances of `Webview` for all available webview windows.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
async function getAllWebviewWindows() {
|
||||
return core.invoke('plugin:window|get_all_windows').then((windows) => windows.map((w) => new WebviewWindow(w, {
|
||||
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
||||
skip: true
|
||||
})));
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
|
||||
class WebviewWindow {
|
||||
/**
|
||||
* Creates a new {@link Window} hosting a {@link Webview}.
|
||||
* @example
|
||||
* ```typescript
|
||||
* import { WebviewWindow } from '@tauri-apps/api/webviewWindow'
|
||||
* const webview = new WebviewWindow('my-label', {
|
||||
* url: 'https://github.com/tauri-apps/tauri'
|
||||
* });
|
||||
* webview.once('tauri://created', function () {
|
||||
* // webview successfully created
|
||||
* });
|
||||
* webview.once('tauri://error', function (e) {
|
||||
* // an error happened creating the webview
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @param label The unique webview label. Must be alphanumeric: `a-zA-Z-/:_`.
|
||||
* @returns The {@link WebviewWindow} instance to communicate with the window and webview.
|
||||
*/
|
||||
constructor(label, options = {}) {
|
||||
var _a;
|
||||
this.label = label;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
this.listeners = Object.create(null);
|
||||
// @ts-expect-error `skip` is not a public API so it is not defined in WebviewOptions
|
||||
if (!(options === null || options === void 0 ? void 0 : options.skip)) {
|
||||
core.invoke('plugin:webview|create_webview_window', {
|
||||
options: {
|
||||
...options,
|
||||
parent: typeof options.parent === 'string'
|
||||
? options.parent
|
||||
: (_a = options.parent) === null || _a === void 0 ? void 0 : _a.label,
|
||||
label
|
||||
}
|
||||
})
|
||||
.then(async () => this.emit('tauri://created'))
|
||||
.catch(async (e) => this.emit('tauri://error', e));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Gets the Webview for the webview associated with the given label.
|
||||
* @example
|
||||
* ```typescript
|
||||
* import { WebviewWindow } from '@tauri-apps/api/webviewWindow';
|
||||
* const mainWebview = WebviewWindow.getByLabel('main');
|
||||
* ```
|
||||
*
|
||||
* @param label The webview label.
|
||||
* @returns The Webview instance to communicate with the webview or null if the webview doesn't exist.
|
||||
*/
|
||||
static async getByLabel(label) {
|
||||
var _a;
|
||||
const webview = (_a = (await getAllWebviewWindows()).find((w) => w.label === label)) !== null && _a !== void 0 ? _a : null;
|
||||
if (webview) {
|
||||
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
||||
return new WebviewWindow(webview.label, { skip: true });
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Get an instance of `Webview` for the current webview.
|
||||
*/
|
||||
static getCurrent() {
|
||||
return getCurrentWebviewWindow();
|
||||
}
|
||||
/**
|
||||
* Gets a list of instances of `Webview` for all available webviews.
|
||||
*/
|
||||
static async getAll() {
|
||||
return getAllWebviewWindows();
|
||||
}
|
||||
/**
|
||||
* Listen to an emitted event on this webview window.
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* import { WebviewWindow } from '@tauri-apps/api/webviewWindow';
|
||||
* const unlisten = await WebviewWindow.getCurrent().listen<string>('state-changed', (event) => {
|
||||
* console.log(`Got error: ${payload}`);
|
||||
* });
|
||||
*
|
||||
* // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
|
||||
* unlisten();
|
||||
* ```
|
||||
*
|
||||
* @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.
|
||||
* @param handler Event handler.
|
||||
* @returns A promise resolving to a function to unlisten to the event.
|
||||
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
|
||||
*/
|
||||
async listen(event$1, handler) {
|
||||
if (this._handleTauriEvent(event$1, handler)) {
|
||||
return () => {
|
||||
// eslint-disable-next-line security/detect-object-injection
|
||||
const listeners = this.listeners[event$1];
|
||||
listeners.splice(listeners.indexOf(handler), 1);
|
||||
};
|
||||
}
|
||||
return event.listen(event$1, handler, {
|
||||
target: { kind: 'WebviewWindow', label: this.label }
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Listen to an emitted event on this webview window only once.
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* import { WebviewWindow } from '@tauri-apps/api/webviewWindow';
|
||||
* const unlisten = await WebviewWindow.getCurrent().once<null>('initialized', (event) => {
|
||||
* console.log(`Webview initialized!`);
|
||||
* });
|
||||
*
|
||||
* // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
|
||||
* unlisten();
|
||||
* ```
|
||||
*
|
||||
* @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.
|
||||
* @param handler Event handler.
|
||||
* @returns A promise resolving to a function to unlisten to the event.
|
||||
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
|
||||
*/
|
||||
async once(event$1, handler) {
|
||||
if (this._handleTauriEvent(event$1, handler)) {
|
||||
return () => {
|
||||
// eslint-disable-next-line security/detect-object-injection
|
||||
const listeners = this.listeners[event$1];
|
||||
listeners.splice(listeners.indexOf(handler), 1);
|
||||
};
|
||||
}
|
||||
return event.once(event$1, handler, {
|
||||
target: { kind: 'WebviewWindow', label: this.label }
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Set the window and webview background color.
|
||||
*
|
||||
* #### Platform-specific:
|
||||
*
|
||||
* - **Android / iOS:** Unsupported for the window layer.
|
||||
* - **macOS / iOS**: Not implemented for the webview layer.
|
||||
* - **Windows**:
|
||||
* - alpha channel is ignored for the window layer.
|
||||
* - On Windows 7, alpha channel is ignored for the webview layer.
|
||||
* - On Windows 8 and newer, if alpha channel is not `0`, it will be ignored.
|
||||
*
|
||||
* @returns A promise indicating the success or failure of the operation.
|
||||
*
|
||||
* @since 2.1.0
|
||||
*/
|
||||
async setBackgroundColor(color) {
|
||||
return core.invoke('plugin:window|set_background_color', { color }).then(() => {
|
||||
return core.invoke('plugin:webview|set_webview_background_color', { color });
|
||||
});
|
||||
}
|
||||
}
|
||||
// Order matters, we use window APIs by default
|
||||
applyMixins(WebviewWindow, [window.Window, webview.Webview]);
|
||||
/** Extends a base class by other specified classes, without overriding existing properties */
|
||||
function applyMixins(baseClass, extendedClasses) {
|
||||
(Array.isArray(extendedClasses)
|
||||
? extendedClasses
|
||||
: [extendedClasses]).forEach((extendedClass) => {
|
||||
Object.getOwnPropertyNames(extendedClass.prototype).forEach((name) => {
|
||||
var _a;
|
||||
if (typeof baseClass.prototype === 'object'
|
||||
&& baseClass.prototype
|
||||
&& name in baseClass.prototype)
|
||||
return;
|
||||
Object.defineProperty(baseClass.prototype, name,
|
||||
// eslint-disable-next-line
|
||||
(_a = Object.getOwnPropertyDescriptor(extendedClass.prototype, name)) !== null && _a !== void 0 ? _a : Object.create(null));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
exports.WebviewWindow = WebviewWindow;
|
||||
exports.getAllWebviewWindows = getAllWebviewWindows;
|
||||
exports.getCurrentWebviewWindow = getCurrentWebviewWindow;
|
||||
Reference in new issue
Block a user