Socket
Socket
Sign inDemoInstall

@tauri-apps/api

Package Overview
Dependencies
Maintainers
5
Versions
75
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-alpha.11 to 2.0.0-alpha.12

internal/index.cjs

10

CHANGELOG.md
# Changelog
## \[2.0.0-alpha.12]
### New Features
- [`f93148ea`](https://www.github.com/tauri-apps/tauri/commit/f93148eac05a1428e038bd9351a8149b2464ff4c)([#7709](https://www.github.com/tauri-apps/tauri/pull/7709)) Add `tray` and `menu` modules to create and manage tray icons and menus from Javascript.
### Enhancements
- [`b7add750`](https://www.github.com/tauri-apps/tauri/commit/b7add750ef9f32d959de613ab35063ff240281c2)([#8204](https://www.github.com/tauri-apps/tauri/pull/8204)) Added `position` field to the `FileDropEvent` payload.
## \[2.0.0-alpha.11]

@@ -4,0 +14,0 @@

1

event.js

@@ -29,3 +29,2 @@ import { invoke, transformCallback } from './primitives.js';

TauriEvent["WINDOW_FILE_DROP_CANCELLED"] = "tauri://file-drop-cancelled";
TauriEvent["MENU"] = "tauri://menu";
})(TauriEvent || (TauriEvent = {}));

@@ -32,0 +31,0 @@ /**

@@ -13,1 +13,5 @@ import * as app from './app.js';

export { dpi };
import * as tray from './tray.js';
export { tray };
import * as menu from './menu.js';
export { menu };
{
"name": "@tauri-apps/api",
"version": "2.0.0-alpha.11",
"version": "2.0.0-alpha.12",
"description": "Tauri API definitions",

@@ -23,6 +23,6 @@ "funding": {

"scripts": {
"build": "yarn rollup --config rollup.config.ts --configPlugin typescript",
"build": "rollup -c --configPlugin typescript",
"npm-pack": "yarn build && cd ./dist && npm pack",
"npm-publish": "yarn build && cd ./dist && yarn publish --access public --loglevel silly --tag next",
"check": "tsc",
"ts:check": "tsc -noEmit",
"lint": "eslint --ext ts \"./src/**/*.ts\"",

@@ -36,2 +36,3 @@ "lint:fix": "eslint --fix --ext ts \"./src/**/*.ts\"",

"./app": {
"types": "./types/app.d.ts",
"import": "./app.js",

@@ -41,2 +42,3 @@ "require": "./app.cjs"

"./dpi": {
"types": "./types/dpi.d.ts",
"import": "./dpi.js",

@@ -46,2 +48,3 @@ "require": "./dpi.cjs"

"./event": {
"types": "./types/event.d.ts",
"import": "./event.js",

@@ -51,6 +54,13 @@ "require": "./event.cjs"

".": {
"types": "./types/index.d.ts",
"import": "./index.js",
"require": "./index.cjs"
},
"./menu": {
"types": "./types/menu.d.ts",
"import": "./menu.js",
"require": "./menu.cjs"
},
"./mocks": {
"types": "./types/mocks.d.ts",
"import": "./mocks.js",

@@ -60,2 +70,3 @@ "require": "./mocks.cjs"

"./path": {
"types": "./types/path.d.ts",
"import": "./path.js",

@@ -65,6 +76,13 @@ "require": "./path.cjs"

"./primitives": {
"types": "./types/primitives.d.ts",
"import": "./primitives.js",
"require": "./primitives.cjs"
},
"./tray": {
"types": "./types/tray.d.ts",
"import": "./tray.js",
"require": "./tray.cjs"
},
"./window": {
"types": "./types/window.d.ts",
"import": "./window.js",

@@ -71,0 +89,0 @@ "require": "./window.cjs"

@@ -510,3 +510,3 @@ import { invoke } from './primitives.js';

*/
async function tempDir(path) {
async function tempDir() {
return invoke('plugin:path|resolve_directory', {

@@ -513,0 +513,0 @@ directory: BaseDirectory.Temp

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

/**
* Listen to the window menu item click. The payload is the item id.
*
* @example
* ```typescript
* import { getCurrent } from "@tauri-apps/api/window";
* const unlisten = await getCurrent().onMenuClicked(({ payload: menuId }) => {
* console.log('Menu clicked: ' + menuId);
* });
*
* // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
* unlisten();
* ```
*
* @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 onMenuClicked(handler) {
return this.listen(TauriEvent.MENU, handler);
}
/**
* Listen to a file drop event.

@@ -1487,6 +1467,20 @@ * The listener is triggered when the user hovers the selected files on the window,

const unlistenFileDrop = await this.listen(TauriEvent.WINDOW_FILE_DROP, (event) => {
handler({ ...event, payload: { type: 'drop', paths: event.payload } });
handler({
...event,
payload: {
type: 'drop',
paths: event.payload.paths,
position: mapPhysicalPosition(event.payload.position)
}
});
});
const unlistenFileHover = await this.listen(TauriEvent.WINDOW_FILE_DROP_HOVER, (event) => {
handler({ ...event, payload: { type: 'hover', paths: event.payload } });
handler({
...event,
payload: {
type: 'hover',
paths: event.payload.paths,
position: mapPhysicalPosition(event.payload.position)
}
});
});

@@ -1493,0 +1487,0 @@ const unlistenCancel = await this.listen(TauriEvent.WINDOW_FILE_DROP_CANCELLED, (event) => {

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