@tauri-apps/plugin-window-state 2.0.0-alpha.3 → 2.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -0
- package/dist-js/index.cjs +40 -0
- package/dist-js/index.d.ts +2 -1
- package/dist-js/{index.mjs → index.js} +2 -8
- package/package.json +7 -11
- package/dist-js/index.min.js +0 -1970
package/README.md
CHANGED
|
@@ -100,6 +100,22 @@ restoreStateCurrent(StateFlags.ALL);
|
|
|
100
100
|
|
|
101
101
|
PRs accepted. Please make sure to read the Contributing Guide before making a pull request.
|
|
102
102
|
|
|
103
|
+
## Partners
|
|
104
|
+
|
|
105
|
+
<table>
|
|
106
|
+
<tbody>
|
|
107
|
+
<tr>
|
|
108
|
+
<td align="center" valign="middle">
|
|
109
|
+
<a href="https://crabnebula.dev" target="_blank">
|
|
110
|
+
<img src="https://github.com/tauri-apps/plugins-workspace/raw/v2/.github/sponsors/crabnebula.svg" alt="CrabNebula" width="283">
|
|
111
|
+
</a>
|
|
112
|
+
</td>
|
|
113
|
+
</tr>
|
|
114
|
+
</tbody>
|
|
115
|
+
</table>
|
|
116
|
+
|
|
117
|
+
For the complete list of sponsors please visit our [website](https://tauri.app#sponsors) and [Open Collective](https://opencollective.com/tauri).
|
|
118
|
+
|
|
103
119
|
## License
|
|
104
120
|
|
|
105
121
|
Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var primitives = require('@tauri-apps/api/primitives');
|
|
4
|
+
var window = require('@tauri-apps/api/window');
|
|
5
|
+
|
|
6
|
+
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
|
7
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
8
|
+
// SPDX-License-Identifier: MIT
|
|
9
|
+
exports.StateFlags = void 0;
|
|
10
|
+
(function (StateFlags) {
|
|
11
|
+
StateFlags[StateFlags["SIZE"] = 1] = "SIZE";
|
|
12
|
+
StateFlags[StateFlags["POSITION"] = 2] = "POSITION";
|
|
13
|
+
StateFlags[StateFlags["MAXIMIZED"] = 4] = "MAXIMIZED";
|
|
14
|
+
StateFlags[StateFlags["VISIBLE"] = 8] = "VISIBLE";
|
|
15
|
+
StateFlags[StateFlags["DECORATIONS"] = 16] = "DECORATIONS";
|
|
16
|
+
StateFlags[StateFlags["FULLSCREEN"] = 32] = "FULLSCREEN";
|
|
17
|
+
StateFlags[StateFlags["ALL"] = 63] = "ALL";
|
|
18
|
+
})(exports.StateFlags || (exports.StateFlags = {}));
|
|
19
|
+
/**
|
|
20
|
+
* Save the state of all open windows to disk.
|
|
21
|
+
*/
|
|
22
|
+
async function saveWindowState(flags) {
|
|
23
|
+
return primitives.invoke("plugin:window-state|save_window_state", { flags });
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Restore the state for the specified window from disk.
|
|
27
|
+
*/
|
|
28
|
+
async function restoreState(label, flags) {
|
|
29
|
+
return primitives.invoke("plugin:window-state|restore_state", { label, flags });
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Restore the state for the current window from disk.
|
|
33
|
+
*/
|
|
34
|
+
async function restoreStateCurrent(flags) {
|
|
35
|
+
return restoreState(window.getCurrent().label, flags);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
exports.restoreState = restoreState;
|
|
39
|
+
exports.restoreStateCurrent = restoreStateCurrent;
|
|
40
|
+
exports.saveWindowState = saveWindowState;
|
package/dist-js/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { WindowLabel } from "@tauri-apps/api/window";
|
|
1
2
|
export declare enum StateFlags {
|
|
2
3
|
SIZE = 1,
|
|
3
4
|
POSITION = 2,
|
|
@@ -14,7 +15,7 @@ declare function saveWindowState(flags: StateFlags): Promise<void>;
|
|
|
14
15
|
/**
|
|
15
16
|
* Restore the state for the specified window from disk.
|
|
16
17
|
*/
|
|
17
|
-
declare function restoreState(label:
|
|
18
|
+
declare function restoreState(label: WindowLabel, flags: StateFlags): Promise<void>;
|
|
18
19
|
/**
|
|
19
20
|
* Restore the state for the current window from disk.
|
|
20
21
|
*/
|
|
@@ -18,18 +18,13 @@ var StateFlags;
|
|
|
18
18
|
* Save the state of all open windows to disk.
|
|
19
19
|
*/
|
|
20
20
|
async function saveWindowState(flags) {
|
|
21
|
-
return invoke("plugin:window-state|save_window_state", {
|
|
22
|
-
flags,
|
|
23
|
-
});
|
|
21
|
+
return invoke("plugin:window-state|save_window_state", { flags });
|
|
24
22
|
}
|
|
25
23
|
/**
|
|
26
24
|
* Restore the state for the specified window from disk.
|
|
27
25
|
*/
|
|
28
26
|
async function restoreState(label, flags) {
|
|
29
|
-
return invoke("plugin:window-state|restore_state", {
|
|
30
|
-
label,
|
|
31
|
-
flags,
|
|
32
|
-
});
|
|
27
|
+
return invoke("plugin:window-state|restore_state", { label, flags });
|
|
33
28
|
}
|
|
34
29
|
/**
|
|
35
30
|
* Restore the state for the current window from disk.
|
|
@@ -39,4 +34,3 @@ async function restoreStateCurrent(flags) {
|
|
|
39
34
|
}
|
|
40
35
|
|
|
41
36
|
export { StateFlags, restoreState, restoreStateCurrent, saveWindowState };
|
|
42
|
-
//# sourceMappingURL=index.mjs.map
|
package/package.json
CHANGED
|
@@ -1,31 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tauri-apps/plugin-window-state",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.4",
|
|
4
4
|
"description": "Save window positions and sizes and restore them when the app is reopened.",
|
|
5
5
|
"license": "MIT or APACHE-2.0",
|
|
6
6
|
"authors": [
|
|
7
7
|
"Tauri Programme within The Commons Conservancy"
|
|
8
8
|
],
|
|
9
9
|
"type": "module",
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
10
|
+
"types": "./dist-js/index.d.ts",
|
|
11
|
+
"main": "./dist-js/index.cjs",
|
|
12
|
+
"module": "./dist-js/index.js",
|
|
13
13
|
"exports": {
|
|
14
|
-
"import": "./dist-js/index.mjs",
|
|
15
14
|
"types": "./dist-js/index.d.ts",
|
|
16
|
-
"
|
|
15
|
+
"import": "./dist-js/index.js",
|
|
16
|
+
"require": "./dist-js/index.cjs"
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
19
|
"dist-js",
|
|
20
|
-
"!dist-js/**/*.map",
|
|
21
20
|
"README.md",
|
|
22
21
|
"LICENSE"
|
|
23
22
|
],
|
|
24
|
-
"devDependencies": {
|
|
25
|
-
"tslib": "2.6.0"
|
|
26
|
-
},
|
|
27
23
|
"dependencies": {
|
|
28
|
-
"@tauri-apps/api": "2.0.0-alpha.
|
|
24
|
+
"@tauri-apps/api": "2.0.0-alpha.12"
|
|
29
25
|
},
|
|
30
26
|
"scripts": {
|
|
31
27
|
"build": "rollup -c"
|