init
This commit is contained in:
commit
42ef2f9674
468 files changed
+645161
No files matched your search
+85
@@ -0,0 +1,85 @@
|
||||
import { Resource, invoke } from './core.js';
|
||||
|
||||
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
/** An RGBA Image in row-major order from top to bottom. */
|
||||
class Image extends Resource {
|
||||
/**
|
||||
* Creates an Image from a resource ID. For internal use only.
|
||||
*
|
||||
* @ignore
|
||||
*/
|
||||
constructor(rid) {
|
||||
super(rid);
|
||||
}
|
||||
/** Creates a new Image using RGBA data, in row-major order from top to bottom, and with specified width and height. */
|
||||
static async new(rgba, width, height) {
|
||||
return invoke('plugin:image|new', {
|
||||
rgba: transformImage(rgba),
|
||||
width,
|
||||
height
|
||||
}).then((rid) => new Image(rid));
|
||||
}
|
||||
/**
|
||||
* Creates a new image using the provided bytes by inferring the file format.
|
||||
* If the format is known, prefer [@link Image.fromPngBytes] or [@link Image.fromIcoBytes].
|
||||
*
|
||||
* Only `ico` and `png` are supported (based on activated feature flag).
|
||||
*
|
||||
* Note that you need the `image-ico` or `image-png` Cargo features to use this API.
|
||||
* To enable it, change your Cargo.toml file:
|
||||
* ```toml
|
||||
* [dependencies]
|
||||
* tauri = { version = "...", features = ["...", "image-png"] }
|
||||
* ```
|
||||
*/
|
||||
static async fromBytes(bytes) {
|
||||
return invoke('plugin:image|from_bytes', {
|
||||
bytes: transformImage(bytes)
|
||||
}).then((rid) => new Image(rid));
|
||||
}
|
||||
/**
|
||||
* Creates a new image using the provided path.
|
||||
*
|
||||
* Only `ico` and `png` are supported (based on activated feature flag).
|
||||
*
|
||||
* Note that you need the `image-ico` or `image-png` Cargo features to use this API.
|
||||
* To enable it, change your Cargo.toml file:
|
||||
* ```toml
|
||||
* [dependencies]
|
||||
* tauri = { version = "...", features = ["...", "image-png"] }
|
||||
* ```
|
||||
*/
|
||||
static async fromPath(path) {
|
||||
return invoke('plugin:image|from_path', { path }).then((rid) => new Image(rid));
|
||||
}
|
||||
/** Returns the RGBA data for this image, in row-major order from top to bottom. */
|
||||
async rgba() {
|
||||
return invoke('plugin:image|rgba', {
|
||||
rid: this.rid
|
||||
}).then((buffer) => new Uint8Array(buffer));
|
||||
}
|
||||
/** Returns the size of this image. */
|
||||
async size() {
|
||||
return invoke('plugin:image|size', { rid: this.rid });
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Transforms image from various types into a type acceptable by Rust.
|
||||
*
|
||||
* See [tauri::image::JsImage](https://docs.rs/tauri/2/tauri/image/enum.JsImage.html) for more information.
|
||||
* Note the API signature is not stable and might change.
|
||||
*/
|
||||
function transformImage(image) {
|
||||
const ret = image == null
|
||||
? null
|
||||
: typeof image === 'string'
|
||||
? image
|
||||
: image instanceof Image
|
||||
? image.rid
|
||||
: image;
|
||||
return ret;
|
||||
}
|
||||
|
||||
export { Image, transformImage };
|
||||
+160
@@ -0,0 +1,160 @@
|
||||
import { MenuItemBase } from './base';
|
||||
import { type MenuItemOptions } from '../menu';
|
||||
import { MenuIcon } from '../image';
|
||||
/**
|
||||
* A native Icon to be used for the menu item
|
||||
*
|
||||
* #### Platform-specific:
|
||||
*
|
||||
* - **Windows / Linux**: Unsupported.
|
||||
*/
|
||||
export declare enum NativeIcon {
|
||||
/** An add item template image. */
|
||||
Add = "Add",
|
||||
/** Advanced preferences toolbar icon for the preferences window. */
|
||||
Advanced = "Advanced",
|
||||
/** A Bluetooth template image. */
|
||||
Bluetooth = "Bluetooth",
|
||||
/** Bookmarks image suitable for a template. */
|
||||
Bookmarks = "Bookmarks",
|
||||
/** A caution image. */
|
||||
Caution = "Caution",
|
||||
/** A color panel toolbar icon. */
|
||||
ColorPanel = "ColorPanel",
|
||||
/** A column view mode template image. */
|
||||
ColumnView = "ColumnView",
|
||||
/** A computer icon. */
|
||||
Computer = "Computer",
|
||||
/** An enter full-screen mode template image. */
|
||||
EnterFullScreen = "EnterFullScreen",
|
||||
/** Permissions for all users. */
|
||||
Everyone = "Everyone",
|
||||
/** An exit full-screen mode template image. */
|
||||
ExitFullScreen = "ExitFullScreen",
|
||||
/** A cover flow view mode template image. */
|
||||
FlowView = "FlowView",
|
||||
/** A folder image. */
|
||||
Folder = "Folder",
|
||||
/** A burnable folder icon. */
|
||||
FolderBurnable = "FolderBurnable",
|
||||
/** A smart folder icon. */
|
||||
FolderSmart = "FolderSmart",
|
||||
/** A link template image. */
|
||||
FollowLinkFreestanding = "FollowLinkFreestanding",
|
||||
/** A font panel toolbar icon. */
|
||||
FontPanel = "FontPanel",
|
||||
/** A `go back` template image. */
|
||||
GoLeft = "GoLeft",
|
||||
/** A `go forward` template image. */
|
||||
GoRight = "GoRight",
|
||||
/** Home image suitable for a template. */
|
||||
Home = "Home",
|
||||
/** An iChat Theater template image. */
|
||||
IChatTheater = "IChatTheater",
|
||||
/** An icon view mode template image. */
|
||||
IconView = "IconView",
|
||||
/** An information toolbar icon. */
|
||||
Info = "Info",
|
||||
/** A template image used to denote invalid data. */
|
||||
InvalidDataFreestanding = "InvalidDataFreestanding",
|
||||
/** A generic left-facing triangle template image. */
|
||||
LeftFacingTriangle = "LeftFacingTriangle",
|
||||
/** A list view mode template image. */
|
||||
ListView = "ListView",
|
||||
/** A locked padlock template image. */
|
||||
LockLocked = "LockLocked",
|
||||
/** An unlocked padlock template image. */
|
||||
LockUnlocked = "LockUnlocked",
|
||||
/** A horizontal dash, for use in menus. */
|
||||
MenuMixedState = "MenuMixedState",
|
||||
/** A check mark template image, for use in menus. */
|
||||
MenuOnState = "MenuOnState",
|
||||
/** A MobileMe icon. */
|
||||
MobileMe = "MobileMe",
|
||||
/** A drag image for multiple items. */
|
||||
MultipleDocuments = "MultipleDocuments",
|
||||
/** A network icon. */
|
||||
Network = "Network",
|
||||
/** A path button template image. */
|
||||
Path = "Path",
|
||||
/** General preferences toolbar icon for the preferences window. */
|
||||
PreferencesGeneral = "PreferencesGeneral",
|
||||
/** A Quick Look template image. */
|
||||
QuickLook = "QuickLook",
|
||||
/** A refresh template image. */
|
||||
RefreshFreestanding = "RefreshFreestanding",
|
||||
/** A refresh template image. */
|
||||
Refresh = "Refresh",
|
||||
/** A remove item template image. */
|
||||
Remove = "Remove",
|
||||
/** A reveal contents template image. */
|
||||
RevealFreestanding = "RevealFreestanding",
|
||||
/** A generic right-facing triangle template image. */
|
||||
RightFacingTriangle = "RightFacingTriangle",
|
||||
/** A share view template image. */
|
||||
Share = "Share",
|
||||
/** A slideshow template image. */
|
||||
Slideshow = "Slideshow",
|
||||
/** A badge for a `smart` item. */
|
||||
SmartBadge = "SmartBadge",
|
||||
/** Small green indicator, similar to iChat's available image. */
|
||||
StatusAvailable = "StatusAvailable",
|
||||
/** Small clear indicator. */
|
||||
StatusNone = "StatusNone",
|
||||
/** Small yellow indicator, similar to iChat's idle image. */
|
||||
StatusPartiallyAvailable = "StatusPartiallyAvailable",
|
||||
/** Small red indicator, similar to iChat's unavailable image. */
|
||||
StatusUnavailable = "StatusUnavailable",
|
||||
/** A stop progress template image. */
|
||||
StopProgressFreestanding = "StopProgressFreestanding",
|
||||
/** A stop progress button template image. */
|
||||
StopProgress = "StopProgress",
|
||||
/** An image of the empty trash can. */
|
||||
TrashEmpty = "TrashEmpty",
|
||||
/** An image of the full trash can. */
|
||||
TrashFull = "TrashFull",
|
||||
/** Permissions for a single user. */
|
||||
User = "User",
|
||||
/** User account toolbar icon for the preferences window. */
|
||||
UserAccounts = "UserAccounts",
|
||||
/** Permissions for a group of users. */
|
||||
UserGroup = "UserGroup",
|
||||
/** Permissions for guests. */
|
||||
UserGuest = "UserGuest"
|
||||
}
|
||||
/** Options for creating a new icon menu item. */
|
||||
export interface IconMenuItemOptions extends MenuItemOptions {
|
||||
/**
|
||||
* Icon to be used for the new icon menu item.
|
||||
*
|
||||
* Note that you may need the `image-ico` or `image-png` Cargo features to use this API.
|
||||
* To enable it, change your Cargo.toml file:
|
||||
* ```toml
|
||||
* [dependencies]
|
||||
* tauri = { version = "...", features = ["...", "image-png"] }
|
||||
* ```
|
||||
*/
|
||||
icon?: MenuIcon;
|
||||
}
|
||||
/**
|
||||
* An icon menu item inside a {@linkcode Menu} or {@linkcode Submenu}
|
||||
* and usually contains an icon and a text.
|
||||
*/
|
||||
export declare class IconMenuItem extends MenuItemBase {
|
||||
/** @ignore */
|
||||
protected constructor(rid: number, id: string);
|
||||
/** Create a new icon menu item. */
|
||||
static new(opts: IconMenuItemOptions): Promise<IconMenuItem>;
|
||||
/** Returns the text of this icon menu item. */
|
||||
text(): Promise<string>;
|
||||
/** Sets the text for this icon menu item. */
|
||||
setText(text: string): Promise<void>;
|
||||
/** Returns whether this icon menu item is enabled or not. */
|
||||
isEnabled(): Promise<boolean>;
|
||||
/** Sets whether this icon menu item is enabled or not. */
|
||||
setEnabled(enabled: boolean): Promise<void>;
|
||||
/** Sets the accelerator for this icon menu item. */
|
||||
setAccelerator(accelerator: string | null): Promise<void>;
|
||||
/** Sets an icon for this icon menu item */
|
||||
setIcon(icon: MenuIcon | null): Promise<void>;
|
||||
}
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
{
|
||||
"name": "typescript",
|
||||
"author": "Microsoft Corp.",
|
||||
"homepage": "https://www.typescriptlang.org/",
|
||||
"version": "5.9.3",
|
||||
"license": "Apache-2.0",
|
||||
"description": "TypeScript is a language for application scale JavaScript development",
|
||||
"keywords": [
|
||||
"TypeScript",
|
||||
"Microsoft",
|
||||
"compiler",
|
||||
"language",
|
||||
"javascript"
|
||||
],
|
||||
"bugs": {
|
||||
"url": "https://github.com/microsoft/TypeScript/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/microsoft/TypeScript.git"
|
||||
},
|
||||
"main": "./lib/typescript.js",
|
||||
"typings": "./lib/typescript.d.ts",
|
||||
"bin": {
|
||||
"tsc": "./bin/tsc",
|
||||
"tsserver": "./bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17"
|
||||
},
|
||||
"files": [
|
||||
"bin",
|
||||
"lib",
|
||||
"!lib/enu",
|
||||
"LICENSE.txt",
|
||||
"README.md",
|
||||
"SECURITY.md",
|
||||
"ThirdPartyNoticeText.txt",
|
||||
"!**/.gitattributes"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@dprint/formatter": "^0.4.1",
|
||||
"@dprint/typescript": "0.93.4",
|
||||
"@esfx/canceltoken": "^1.0.0",
|
||||
"@eslint/js": "^9.20.0",
|
||||
"@octokit/rest": "^21.1.1",
|
||||
"@types/chai": "^4.3.20",
|
||||
"@types/diff": "^7.0.1",
|
||||
"@types/minimist": "^1.2.5",
|
||||
"@types/mocha": "^10.0.10",
|
||||
"@types/ms": "^0.7.34",
|
||||
"@types/node": "latest",
|
||||
"@types/source-map-support": "^0.5.10",
|
||||
"@types/which": "^3.0.4",
|
||||
"@typescript-eslint/rule-tester": "^8.24.1",
|
||||
"@typescript-eslint/type-utils": "^8.24.1",
|
||||
"@typescript-eslint/utils": "^8.24.1",
|
||||
"azure-devops-node-api": "^14.1.0",
|
||||
"c8": "^10.1.3",
|
||||
"chai": "^4.5.0",
|
||||
"chokidar": "^4.0.3",
|
||||
"diff": "^7.0.0",
|
||||
"dprint": "^0.49.0",
|
||||
"esbuild": "^0.25.0",
|
||||
"eslint": "^9.20.1",
|
||||
"eslint-formatter-autolinkable-stylish": "^1.4.0",
|
||||
"eslint-plugin-regexp": "^2.7.0",
|
||||
"fast-xml-parser": "^4.5.2",
|
||||
"glob": "^10.4.5",
|
||||
"globals": "^15.15.0",
|
||||
"hereby": "^1.10.0",
|
||||
"jsonc-parser": "^3.3.1",
|
||||
"knip": "^5.44.4",
|
||||
"minimist": "^1.2.8",
|
||||
"mocha": "^10.8.2",
|
||||
"mocha-fivemat-progress-reporter": "^0.1.0",
|
||||
"monocart-coverage-reports": "^2.12.1",
|
||||
"ms": "^2.1.3",
|
||||
"picocolors": "^1.1.1",
|
||||
"playwright": "^1.50.1",
|
||||
"source-map-support": "^0.5.21",
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.7.3",
|
||||
"typescript-eslint": "^8.24.1",
|
||||
"which": "^3.0.1"
|
||||
},
|
||||
"overrides": {
|
||||
"typescript@*": "$typescript"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "hereby runtests-parallel --light=false",
|
||||
"test:eslint-rules": "hereby run-eslint-rules-tests",
|
||||
"build": "npm run build:compiler && npm run build:tests",
|
||||
"build:compiler": "hereby local",
|
||||
"build:tests": "hereby tests",
|
||||
"build:tests:notypecheck": "hereby tests --no-typecheck",
|
||||
"clean": "hereby clean",
|
||||
"gulp": "hereby",
|
||||
"lint": "hereby lint",
|
||||
"knip": "hereby knip",
|
||||
"format": "dprint fmt",
|
||||
"setup-hooks": "node scripts/link-hooks.mjs"
|
||||
},
|
||||
"browser": {
|
||||
"fs": false,
|
||||
"os": false,
|
||||
"path": false,
|
||||
"crypto": false,
|
||||
"buffer": false,
|
||||
"source-map-support": false,
|
||||
"inspector": false,
|
||||
"perf_hooks": false
|
||||
},
|
||||
"packageManager": "npm@8.19.4",
|
||||
"volta": {
|
||||
"node": "20.1.0",
|
||||
"npm": "8.19.4"
|
||||
},
|
||||
"gitHead": "c63de15a992d37f0d6cec03ac7631872838602cb"
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2017 Andrey Sitnik <andrey@sitnik.ru>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
Reference in new issue
Block a user