mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-04-27 11:56:05 +02:00
chore: adjust prettier config, .gitignore and use taplo to format toml files (#1728)
* chore: adjust prettier config, .gitignore and use taplo to format toml files This brings the plugins-workspace repository to the same code style of the main tauri repo * format toml * ignore examples gen dir * add .vscode/extensions.json * remove packageManager field * fmt * fix audit * taplo ignore permissions autogenerated files * remove create dummy dist * fix prettier workflow * install fmt in prettier workflow --------- Co-authored-by: Lucas Nogueira <lucas@tauri.app>
This commit is contained in:
@@ -1 +0,0 @@
|
||||
node_modules
|
||||
@@ -10,11 +10,11 @@ repository = { workspace = true }
|
||||
links = "tauri-plugin-window-state"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
rustc-args = [ "--cfg", "docsrs" ]
|
||||
rustdoc-args = [ "--cfg", "docsrs" ]
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-plugin = { workspace = true, features = [ "build" ] }
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
|
||||
[dependencies]
|
||||
serde = { workspace = true }
|
||||
|
||||
@@ -71,9 +71,9 @@ app.save_window_state(StateFlags::all()); // will save the state of all open win
|
||||
or through Javascript
|
||||
|
||||
```javascript
|
||||
import { saveWindowState, StateFlags } from "@tauri-apps/plugin-window-state";
|
||||
import { saveWindowState, StateFlags } from '@tauri-apps/plugin-window-state'
|
||||
|
||||
saveWindowState(StateFlags.ALL);
|
||||
saveWindowState(StateFlags.ALL)
|
||||
```
|
||||
|
||||
To manually restore a windows state from disk you can call the `restore_state()` method exposed by the `WindowExt` trait:
|
||||
@@ -90,10 +90,10 @@ or through Javascript
|
||||
```javascript
|
||||
import {
|
||||
restoreStateCurrent,
|
||||
StateFlags,
|
||||
} from "@tauri-apps/plugin-window-state";
|
||||
StateFlags
|
||||
} from '@tauri-apps/plugin-window-state'
|
||||
|
||||
restoreStateCurrent(StateFlags.ALL);
|
||||
restoreStateCurrent(StateFlags.ALL)
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
@@ -20,4 +20,4 @@ We prefer to receive reports in English.
|
||||
|
||||
Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new).
|
||||
|
||||
Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app).
|
||||
Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app).
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { type WindowLabel, getCurrentWindow } from "@tauri-apps/api/window";
|
||||
import { invoke } from '@tauri-apps/api/core'
|
||||
import { type WindowLabel, getCurrentWindow } from '@tauri-apps/api/window'
|
||||
|
||||
export enum StateFlags {
|
||||
SIZE = 1 << 0,
|
||||
@@ -12,14 +12,14 @@ export enum StateFlags {
|
||||
VISIBLE = 1 << 3,
|
||||
DECORATIONS = 1 << 4,
|
||||
FULLSCREEN = 1 << 5,
|
||||
ALL = SIZE | POSITION | MAXIMIZED | VISIBLE | DECORATIONS | FULLSCREEN,
|
||||
ALL = SIZE | POSITION | MAXIMIZED | VISIBLE | DECORATIONS | FULLSCREEN
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the state of all open windows to disk.
|
||||
*/
|
||||
async function saveWindowState(flags: StateFlags): Promise<void> {
|
||||
await invoke("plugin:window-state|save_window_state", { flags });
|
||||
await invoke('plugin:window-state|save_window_state', { flags })
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -27,22 +27,22 @@ async function saveWindowState(flags: StateFlags): Promise<void> {
|
||||
*/
|
||||
async function restoreState(
|
||||
label: WindowLabel,
|
||||
flags: StateFlags,
|
||||
flags: StateFlags
|
||||
): Promise<void> {
|
||||
await invoke("plugin:window-state|restore_state", { label, flags });
|
||||
await invoke('plugin:window-state|restore_state', { label, flags })
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the state for the current window from disk.
|
||||
*/
|
||||
async function restoreStateCurrent(flags: StateFlags): Promise<void> {
|
||||
await restoreState(getCurrentWindow().label, flags);
|
||||
await restoreState(getCurrentWindow().label, flags)
|
||||
}
|
||||
/**
|
||||
* Get the name of the file used to store window state.
|
||||
*/
|
||||
async function filename(): Promise<string> {
|
||||
return await invoke("plugin:window-state|filename");
|
||||
return await invoke('plugin:window-state|filename')
|
||||
}
|
||||
|
||||
export { restoreState, restoreStateCurrent, saveWindowState, filename };
|
||||
export { restoreState, restoreStateCurrent, saveWindowState, filename }
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import { createConfig } from "../../shared/rollup.config.js";
|
||||
import { createConfig } from '../../shared/rollup.config.js'
|
||||
|
||||
export default createConfig();
|
||||
export default createConfig()
|
||||
|
||||
Reference in New Issue
Block a user