Socket
Socket
Sign inDemoInstall

@tauri-apps/api

Package Overview
Dependencies
Maintainers
5
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tauri-apps/api - npm Package Compare versions

Comparing version 2.0.0-beta.8 to 2.0.0-beta.9

3

core.d.ts

@@ -131,3 +131,4 @@ /**

}
declare function isTauri(): unknown;
export type { InvokeArgs, InvokeOptions };
export { transformCallback, Channel, PluginListener, addPluginListener, invoke, convertFileSrc };
export { transformCallback, Channel, PluginListener, addPluginListener, invoke, convertFileSrc, isTauri };

@@ -58,2 +58,3 @@ import { __classPrivateFieldGet, __classPrivateFieldSet } from './external/tslib/tslib.es6.js';

}
__classPrivateFieldSet(this, _Channel_nextMessageId, nextId, "f");
}

@@ -194,3 +195,6 @@ }

_Resource_rid = new WeakMap();
function isTauri() {
return 'isTauri' in window && window.isTauri;
}
export { Channel, PluginListener, Resource, addPluginListener, convertFileSrc, invoke, transformCallback };
export { Channel, PluginListener, Resource, addPluginListener, convertFileSrc, invoke, isTauri, transformCallback };

@@ -69,5 +69,6 @@ import { invoke, transformCallback } from './core.js';

async function listen(event, handler, options) {
const target = typeof options?.target === 'string'
var _a;
const target = typeof (options === null || options === void 0 ? void 0 : options.target) === 'string'
? { kind: 'AnyLabel', label: options.target }
: options?.target ?? { kind: 'Any' };
: (_a = options === null || options === void 0 ? void 0 : options.target) !== null && _a !== void 0 ? _a : { kind: 'Any' };
return invoke('plugin:event|listen', {

@@ -74,0 +75,0 @@ event,

@@ -10,4 +10,5 @@ import { __classPrivateFieldGet, __classPrivateFieldSet } from '../external/tslib/tslib.es6.js';

function injectChannel(i) {
var _a;
if ('items' in i) {
i.items = i.items?.map((item) => 'rid' in item ? item : injectChannel(item));
i.items = (_a = i.items) === null || _a === void 0 ? void 0 : _a.map((item) => 'rid' in item ? item : injectChannel(item));
}

@@ -32,6 +33,7 @@ else if ('action' in i && i.action) {

items = opts.items.map((i) => {
var _a;
if ('rid' in i) {
return [i.rid, i.kind];
}
if ('item' in i && typeof i.item === 'object' && i.item.About?.icon) {
if ('item' in i && typeof i.item === 'object' && ((_a = i.item.About) === null || _a === void 0 ? void 0 : _a.icon)) {
i.item.About.icon = transformImage(i.item.About.icon);

@@ -38,0 +40,0 @@ }

@@ -131,2 +131,3 @@ import { MenuItem } from './menuItem.js';

async popup(at, window) {
var _a;
let atValue = null;

@@ -143,3 +144,3 @@ if (at) {

kind: this.kind,
window: window?.label ?? null,
window: (_a = window === null || window === void 0 ? void 0 : window.label) !== null && _a !== void 0 ? _a : null,
at: atValue

@@ -168,5 +169,6 @@ });

async setAsWindowMenu(window) {
var _a;
return invoke('plugin:menu|set_as_window_menu', {
rid: this.rid,
window: window?.label ?? null
window: (_a = window === null || window === void 0 ? void 0 : window.label) !== null && _a !== void 0 ? _a : null
}).then((r) => (r ? new Menu(r[0], r[1]) : null));

@@ -173,0 +175,0 @@ }

@@ -149,2 +149,3 @@ import { MenuItem } from './menuItem.js';

async popup(at, window) {
var _a;
let atValue = null;

@@ -161,3 +162,3 @@ if (at) {

kind: this.kind,
window: window?.label ?? null,
window: (_a = window === null || window === void 0 ? void 0 : window.label) !== null && _a !== void 0 ? _a : null,
at: atValue

@@ -164,0 +165,0 @@ });

@@ -5,3 +5,4 @@ // Copyright 2019-2024 Tauri Programme within The Commons Conservancy

function mockInternals() {
window.__TAURI_INTERNALS__ = window.__TAURI_INTERNALS__ ?? {};
var _a;
window.__TAURI_INTERNALS__ = (_a = window.__TAURI_INTERNALS__) !== null && _a !== void 0 ? _a : {};
}

@@ -193,12 +194,13 @@ /**

function clearMocks() {
var _a, _b, _c;
if (typeof window.__TAURI_INTERNALS__ !== 'object') {
return;
}
if (window.__TAURI_INTERNALS__?.convertFileSrc)
if ((_a = window.__TAURI_INTERNALS__) === null || _a === void 0 ? void 0 : _a.convertFileSrc)
// @ts-expect-error "The operand of a 'delete' operator must be optional' does not matter in this case
delete window.__TAURI_INTERNALS__.convertFileSrc;
if (window.__TAURI_INTERNALS__?.invoke)
if ((_b = window.__TAURI_INTERNALS__) === null || _b === void 0 ? void 0 : _b.invoke)
// @ts-expect-error "The operand of a 'delete' operator must be optional' does not matter in this case
delete window.__TAURI_INTERNALS__.invoke;
if (window.__TAURI_INTERNALS__?.metadata)
if ((_c = window.__TAURI_INTERNALS__) === null || _c === void 0 ? void 0 : _c.metadata)
// @ts-expect-error "The operand of a 'delete' operator must be optional' does not matter in this case

@@ -205,0 +207,0 @@ delete window.__TAURI_INTERNALS__.metadata;

{
"name": "@tauri-apps/api",
"version": "2.0.0-beta.8",
"version": "2.0.0-beta.9",
"description": "Tauri API definitions",

@@ -24,10 +24,13 @@ "funding": {

"module": "./index.js",
"types": "./index.d.ts",
"exports": {
".": {
"import": "./index.js",
"require": "./index.cjs"
"require": "./index.cjs",
"types": "./index.d.ts"
},
"./*": {
"import": "./*.js",
"require": "./*.cjs"
"require": "./*.cjs",
"types": "./*.d.ts"
},

@@ -34,0 +37,0 @@ "./package.json": "./package.json"

@@ -52,11 +52,11 @@ import { Resource, invoke, Channel } from './core.js';

static async new(options) {
if (options?.menu) {
if (options === null || options === void 0 ? void 0 : options.menu) {
// @ts-expect-error we only need the rid and kind
options.menu = [options.menu.rid, options.menu.kind];
}
if (options?.icon) {
if (options === null || options === void 0 ? void 0 : options.icon) {
options.icon = transformImage(options.icon);
}
const handler = new Channel();
if (options?.action) {
if (options === null || options === void 0 ? void 0 : options.action) {
handler.onmessage = options.action;

@@ -66,3 +66,3 @@ delete options.action;

return invoke('plugin:tray|new', {
options: options ?? {},
options: options !== null && options !== void 0 ? options : {},
handler

@@ -69,0 +69,0 @@ }).then(([rid, id]) => new TrayIcon(rid, id));

@@ -116,3 +116,3 @@ import { PhysicalPosition, PhysicalSize } from './dpi.js';

// @ts-expect-error `skip` is not a public API so it is not defined in WebviewOptions
if (!options?.skip) {
if (!(options === null || options === void 0 ? void 0 : options.skip)) {
invoke('plugin:webview|create_webview', {

@@ -139,3 +139,4 @@ windowLabel: window.label,

static getByLabel(label) {
return getAll().find((w) => w.label === label) ?? null;
var _a;
return (_a = getAll().find((w) => w.label === label)) !== null && _a !== void 0 ? _a : null;
}

@@ -142,0 +143,0 @@ /**

@@ -54,2 +54,3 @@ import { getCurrent as getCurrent$1, Webview } from './webview.js';

constructor(label, options = {}) {
var _a;
this.label = label;

@@ -59,3 +60,3 @@ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment

// @ts-expect-error `skip` is not a public API so it is not defined in WebviewOptions
if (!options?.skip) {
if (!(options === null || options === void 0 ? void 0 : options.skip)) {
invoke('plugin:webview|create_webview_window', {

@@ -66,3 +67,3 @@ options: {

? options.parent
: options.parent?.label,
: (_a = options.parent) === null || _a === void 0 ? void 0 : _a.label,
label

@@ -87,3 +88,4 @@ }

static getByLabel(label) {
const webview = getAll().find((w) => w.label === label) ?? null;
var _a;
const webview = (_a = getAll().find((w) => w.label === label)) !== null && _a !== void 0 ? _a : null;
if (webview) {

@@ -179,2 +181,3 @@ // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor

Object.getOwnPropertyNames(extendedClass.prototype).forEach((name) => {
var _a;
if (typeof baseClass.prototype === 'object' &&

@@ -186,4 +189,3 @@ baseClass.prototype &&

// eslint-disable-next-line
Object.getOwnPropertyDescriptor(extendedClass.prototype, name) ??
Object.create(null));
(_a = Object.getOwnPropertyDescriptor(extendedClass.prototype, name)) !== null && _a !== void 0 ? _a : Object.create(null));
});

@@ -190,0 +192,0 @@ });

@@ -151,2 +151,3 @@ import { PhysicalPosition, PhysicalSize } from './dpi.js';

constructor(label, options = {}) {
var _a;
this.label = label;

@@ -156,3 +157,3 @@ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment

// @ts-expect-error `skip` is not a public API so it is not defined in WindowOptions
if (!options?.skip) {
if (!(options === null || options === void 0 ? void 0 : options.skip)) {
invoke('plugin:window|create', {

@@ -163,3 +164,3 @@ options: {

? options.parent
: options.parent?.label,
: (_a = options.parent) === null || _a === void 0 ? void 0 : _a.label,
label

@@ -184,3 +185,4 @@ }

static getByLabel(label) {
return getAll().find((w) => w.label === label) ?? null;
var _a;
return (_a = getAll().find((w) => w.label === label)) !== null && _a !== void 0 ? _a : null;
}

@@ -187,0 +189,0 @@ /**

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc