Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev' into prevent-window-overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Legend-Master committed Nov 12, 2024
2 parents d492e9c + c3b1fce commit 16f4895
Show file tree
Hide file tree
Showing 15 changed files with 79 additions and 58 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/tauri-cli/config.schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://schema.tauri.app/config/2.1.0",
"$id": "https://schema.tauri.app/config/2.1.1",
"title": "Config",
"description": "The Tauri configuration object.\n It is read from a file where you can define your frontend assets,\n configure the bundler and define a tray icon.\n\n The configuration file is generated by the\n [`tauri init`](https://v2.tauri.app/reference/cli/#init) command that lives in\n your Tauri application source directory (src-tauri).\n\n Once generated, you may modify it at will to customize your Tauri application.\n\n ## File Formats\n\n By default, the configuration is defined as a JSON file named `tauri.conf.json`.\n\n Tauri also supports JSON5 and TOML files via the `config-json5` and `config-toml` Cargo features, respectively.\n The JSON5 file name must be either `tauri.conf.json` or `tauri.conf.json5`.\n The TOML file name is `Tauri.toml`.\n\n ## Platform-Specific Configuration\n\n In addition to the default configuration file, Tauri can\n read a platform-specific configuration from `tauri.linux.conf.json`,\n `tauri.windows.conf.json`, `tauri.macos.conf.json`, `tauri.android.conf.json` and `tauri.ios.conf.json`\n (or `Tauri.linux.toml`, `Tauri.windows.toml`, `Tauri.macos.toml`, `Tauri.android.toml` and `Tauri.ios.toml` if the `Tauri.toml` format is used),\n which gets merged with the main configuration object.\n\n ## Configuration Structure\n\n The configuration is composed of the following objects:\n\n - [`app`](#appconfig): The Tauri configuration\n - [`build`](#buildconfig): The build configuration\n - [`bundle`](#bundleconfig): The bundle configurations\n - [`plugins`](#pluginconfig): The plugins configuration\n\n Example tauri.config.json file:\n\n ```json\n {\n \"productName\": \"tauri-app\",\n \"version\": \"0.1.0\",\n \"build\": {\n \"beforeBuildCommand\": \"\",\n \"beforeDevCommand\": \"\",\n \"devUrl\": \"../dist\",\n \"frontendDist\": \"../dist\"\n },\n \"app\": {\n \"security\": {\n \"csp\": null\n },\n \"windows\": [\n {\n \"fullscreen\": false,\n \"height\": 600,\n \"resizable\": true,\n \"title\": \"Tauri App\",\n \"width\": 800\n }\n ]\n },\n \"bundle\": {},\n \"plugins\": {}\n }\n ```",
"type": "object",
Expand Down
2 changes: 1 addition & 1 deletion crates/tauri-cli/metadata-v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "2.1.0",
"node": ">= 10.0.0"
},
"tauri": "2.1.0",
"tauri": "2.1.1",
"tauri-build": "2.0.2",
"tauri-plugin": "2.0.2"
}
2 changes: 1 addition & 1 deletion crates/tauri-schema-generator/schemas/config.schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://schema.tauri.app/config/2.1.0",
"$id": "https://schema.tauri.app/config/2.1.1",
"title": "Config",
"description": "The Tauri configuration object.\n It is read from a file where you can define your frontend assets,\n configure the bundler and define a tray icon.\n\n The configuration file is generated by the\n [`tauri init`](https://v2.tauri.app/reference/cli/#init) command that lives in\n your Tauri application source directory (src-tauri).\n\n Once generated, you may modify it at will to customize your Tauri application.\n\n ## File Formats\n\n By default, the configuration is defined as a JSON file named `tauri.conf.json`.\n\n Tauri also supports JSON5 and TOML files via the `config-json5` and `config-toml` Cargo features, respectively.\n The JSON5 file name must be either `tauri.conf.json` or `tauri.conf.json5`.\n The TOML file name is `Tauri.toml`.\n\n ## Platform-Specific Configuration\n\n In addition to the default configuration file, Tauri can\n read a platform-specific configuration from `tauri.linux.conf.json`,\n `tauri.windows.conf.json`, `tauri.macos.conf.json`, `tauri.android.conf.json` and `tauri.ios.conf.json`\n (or `Tauri.linux.toml`, `Tauri.windows.toml`, `Tauri.macos.toml`, `Tauri.android.toml` and `Tauri.ios.toml` if the `Tauri.toml` format is used),\n which gets merged with the main configuration object.\n\n ## Configuration Structure\n\n The configuration is composed of the following objects:\n\n - [`app`](#appconfig): The Tauri configuration\n - [`build`](#buildconfig): The build configuration\n - [`bundle`](#bundleconfig): The bundle configurations\n - [`plugins`](#pluginconfig): The plugins configuration\n\n Example tauri.config.json file:\n\n ```json\n {\n \"productName\": \"tauri-app\",\n \"version\": \"0.1.0\",\n \"build\": {\n \"beforeBuildCommand\": \"\",\n \"beforeDevCommand\": \"\",\n \"devUrl\": \"../dist\",\n \"frontendDist\": \"../dist\"\n },\n \"app\": {\n \"security\": {\n \"csp\": null\n },\n \"windows\": [\n {\n \"fullscreen\": false,\n \"height\": 600,\n \"resizable\": true,\n \"title\": \"Tauri App\",\n \"width\": 800\n }\n ]\n },\n \"bundle\": {},\n \"plugins\": {}\n }\n ```",
"type": "object",
Expand Down
6 changes: 6 additions & 0 deletions crates/tauri/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## \[2.1.1]

### Bug Fixes

- [`e8a50f6d7`](https://www.github.com/tauri-apps/tauri/commit/e8a50f6d760fad4529e7abb400302a1b487f11dd) ([#11645](https://www.github.com/tauri-apps/tauri/pull/11645)) Fix integer values of `BasDirectory.Home` and `BaseDirectory.Font` regression which broke path APIs in JS.

## \[2.1.0]

### New Features
Expand Down
2 changes: 1 addition & 1 deletion crates/tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tauri"
version = "2.1.0"
version = "2.1.1"
description = "Make tiny, secure apps for all desktop platforms with Tauri"
exclude = ["/test", "/.scripts", "CHANGELOG.md", "/target"]
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion crates/tauri/scripts/bundle.global.js

Large diffs are not rendered by default.

47 changes: 23 additions & 24 deletions crates/tauri/src/path/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,61 +85,60 @@ pub enum BaseDirectory {
/// The Audio directory.
Audio = 1,
/// The Cache directory.
Cache,
Cache = 2,
/// The Config directory.
Config,
Config = 3,
/// The Data directory.
Data,
Data = 4,
/// The LocalData directory.
LocalData,
LocalData = 5,
/// The Document directory.
Document,
Document = 6,
/// The Download directory.
Download,
Download = 7,
/// The Picture directory.
Picture,
Picture = 8,
/// The Public directory.
Public,
Public = 9,
/// The Video directory.
Video,
Video = 10,
/// The Resource directory.
Resource,
Resource = 11,
/// A temporary directory. Resolves to [`std::env::temp_dir`].
Temp,
Temp = 12,
/// The default app config directory.
/// Resolves to [`BaseDirectory::Config`]`/{bundle_identifier}`.
AppConfig,
AppConfig = 13,
/// The default app data directory.
/// Resolves to [`BaseDirectory::Data`]`/{bundle_identifier}`.
AppData,
AppData = 14,
/// The default app local data directory.
/// Resolves to [`BaseDirectory::LocalData`]`/{bundle_identifier}`.
AppLocalData,
AppLocalData = 15,
/// The default app cache directory.
/// Resolves to [`BaseDirectory::Cache`]`/{bundle_identifier}`.
AppCache,
AppCache = 16,
/// The default app log directory.
/// Resolves to [`BaseDirectory::Home`]`/Library/Logs/{bundle_identifier}` on macOS
/// and [`BaseDirectory::Config`]`/{bundle_identifier}/logs` on linux and Windows.
AppLog,
/// The Home directory.
Home,

AppLog = 17,
/// The Desktop directory.
#[cfg(not(target_os = "android"))]
Desktop,
Desktop = 18,
/// The Executable directory.
#[cfg(not(target_os = "android"))]
Executable,
Executable = 19,
/// The Font directory.
#[cfg(not(target_os = "android"))]
Font,
Font = 20,
/// The Home directory.
Home = 21,
/// The Runtime directory.
#[cfg(not(target_os = "android"))]
Runtime,
Runtime = 22,
/// The Template directory.
#[cfg(not(target_os = "android"))]
Template,
Template = 23,
}

impl BaseDirectory {
Expand Down
7 changes: 7 additions & 0 deletions packages/api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## \[2.1.1]

### Bug Fixes

- [`7f81f0523`](https://www.github.com/tauri-apps/tauri/commit/7f81f052365675721312aafba297a7b67fb872d2) Fix regression in `toLogical` and `toPhysical` for position types in `dpi` module returning incorrect `y` value.
- [`e8a50f6d7`](https://www.github.com/tauri-apps/tauri/commit/e8a50f6d760fad4529e7abb400302a1b487f11dd) ([#11645](https://www.github.com/tauri-apps/tauri/pull/11645)) Fix integer values of `BasDirectory.Home` and `BaseDirectory.Font` regression which broke path APIs in JS.

## \[2.1.0]

### New Features
Expand Down
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tauri-apps/api",
"version": "2.1.0",
"version": "2.1.1",
"description": "Tauri API definitions",
"funding": {
"type": "opencollective",
Expand Down
4 changes: 2 additions & 2 deletions packages/api/src/dpi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ class LogicalPosition {
* @since 2.0.0
*/
toPhysical(scaleFactor: number): PhysicalPosition {
return new PhysicalPosition(this.x * scaleFactor, this.x * scaleFactor)
return new PhysicalPosition(this.x * scaleFactor, this.y * scaleFactor)
}

[SERIALIZE_TO_IPC_FN]() {
Expand Down Expand Up @@ -309,7 +309,7 @@ class PhysicalPosition {
* @since 2.0.0
*/
toLogical(scaleFactor: number): LogicalPosition {
return new LogicalPosition(this.x / scaleFactor, this.x / scaleFactor)
return new LogicalPosition(this.x / scaleFactor, this.y / scaleFactor)
}

[SERIALIZE_TO_IPC_FN]() {
Expand Down
10 changes: 10 additions & 0 deletions packages/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@
* ```typescript
* import { event, window, path } from '@tauri-apps/api'
* ```
*
* ### Vanilla JS API
*
* The above import syntax is for JavaScript/TypeScript with a bundler. If you're using vanilla JavaScript, you can use the global `window.__TAURI__` object instead. It requires `app.withGlobalTauri` configuration option enabled.
*
* @example
* ```js
* const { event, window: tauriWindow, path } = window.__TAURI__;
* ```
*
* @module
*/

Expand Down
45 changes: 22 additions & 23 deletions packages/api/src/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,28 @@ import { invoke } from './core'
*/
enum BaseDirectory {
Audio = 1,
Cache,
Config,
Data,
LocalData,
Document,
Download,
Picture,
Public,
Video,
Resource,
Temp,
AppConfig,
AppData,
AppLocalData,
AppCache,
AppLog,

Desktop,
Executable,
Font,
Home,
Runtime,
Template
Cache = 2,
Config = 3,
Data = 4,
LocalData = 5,
Document = 6,
Download = 7,
Picture = 8,
Public = 9,
Video = 10,
Resource = 11,
Temp = 12,
AppConfig = 13,
AppData = 14,
AppLocalData = 15,
AppCache = 16,
AppLog = 17,
Desktop = 18,
Executable = 19,
Font = 20,
Home = 21,
Runtime = 22,
Template = 23
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/webview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ class Webview {
* import { getCurrentWebview } from "@tauri-apps/api/webview";
* const unlisten = await getCurrentWebview().onDragDropEvent((event) => {
* if (event.payload.type === 'over') {
* console.log('User hovering', event.payload.paths);
* console.log('User hovering', event.payload.position);
* } else if (event.payload.type === 'drop') {
* console.log('User dropped', event.payload.paths);
* } else {
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1771,7 +1771,7 @@ class Window {
* import { getCurrentWindow } from "@tauri-apps/api/webview";
* const unlisten = await getCurrentWindow().onDragDropEvent((event) => {
* if (event.payload.type === 'over') {
* console.log('User hovering', event.payload.paths);
* console.log('User hovering', event.payload.position);
* } else if (event.payload.type === 'drop') {
* console.log('User dropped', event.payload.paths);
* } else {
Expand Down

0 comments on commit 16f4895

Please sign in to comment.