@nickvisionapps/plugin-window-integration 0.1.0 → 0.1.2
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 +1 -1
- package/dist-js/index.cjs +3 -19
- package/dist-js/index.js +3 -19
- package/package.json +15 -4
- package/dist-js/index 3.cjs +0 -54
- package/dist-js/index 3.js +0 -45
- package/dist-js/index.d 3.ts +0 -17
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
JS/TS bindings for the [`tauri-plugin-window-integration`](https://github.com/NickvisionApps/tauri-plugin-window-integration) Tauri plugin.
|
|
4
4
|
|
|
5
|
-
Platform-specific functions (`getButtonLayout`, `getTitlebarIcons`, `updateVibrancy`, `updateSnapGeometry`, `clearSnapGeometry`)
|
|
5
|
+
Platform-specific functions (`getButtonLayout`, `getTitlebarIcons`, `updateVibrancy`, `updateSnapGeometry`, `clearSnapGeometry`) resolve to a harmless default (`null` or nothing) when called on a platform that doesn't support them — your app code never needs to branch on the platform itself.
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
8
|
import {
|
package/dist-js/index.cjs
CHANGED
|
@@ -1,50 +1,34 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var core = require('@tauri-apps/api/core');
|
|
4
|
-
var
|
|
5
|
-
var pluginOs = require('@tauri-apps/plugin-os');
|
|
4
|
+
var window = require('@tauri-apps/api/window');
|
|
6
5
|
|
|
7
6
|
async function clearSnapGeometry() {
|
|
8
|
-
if (pluginOs.platform() !== "windows") {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
7
|
await core.invoke("plugin:window-integration|clear_snap_geometry");
|
|
12
8
|
}
|
|
13
9
|
async function getAccentColor() {
|
|
14
10
|
return await core.invoke("plugin:window-integration|get_accent_color");
|
|
15
11
|
}
|
|
16
12
|
async function getButtonLayout() {
|
|
17
|
-
if (pluginOs.platform() !== "linux") {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
13
|
return await core.invoke("plugin:window-integration|get_button_layout");
|
|
21
14
|
}
|
|
22
15
|
async function getTitlebarIcons() {
|
|
23
|
-
if (pluginOs.platform() !== "linux") {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
16
|
return await core.invoke("plugin:window-integration|get_titlebar_icons");
|
|
27
17
|
}
|
|
28
18
|
async function onSnapHover(callback) {
|
|
29
|
-
return await
|
|
19
|
+
return await window.getCurrentWindow().listen("plugin:window-integration:snap-hover", (event) => {
|
|
30
20
|
callback(event.payload);
|
|
31
21
|
});
|
|
32
22
|
}
|
|
33
23
|
async function onSnapPress(callback) {
|
|
34
|
-
return await
|
|
24
|
+
return await window.getCurrentWindow().listen("plugin:window-integration:snap-press", (event) => {
|
|
35
25
|
callback(event.payload);
|
|
36
26
|
});
|
|
37
27
|
}
|
|
38
28
|
async function updateSnapGeometry(geometry) {
|
|
39
|
-
if (pluginOs.platform() !== "windows") {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
29
|
await core.invoke("plugin:window-integration|update_snap_geometry", { ...geometry });
|
|
43
30
|
}
|
|
44
31
|
async function updateVibrancy(dark) {
|
|
45
|
-
if (pluginOs.platform() !== "windows") {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
32
|
await core.invoke("plugin:window-integration|update_vibrancy", { dark });
|
|
49
33
|
}
|
|
50
34
|
|
package/dist-js/index.js
CHANGED
|
@@ -1,48 +1,32 @@
|
|
|
1
1
|
import { invoke } from '@tauri-apps/api/core';
|
|
2
|
-
import {
|
|
3
|
-
import { platform } from '@tauri-apps/plugin-os';
|
|
2
|
+
import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
4
3
|
|
|
5
4
|
async function clearSnapGeometry() {
|
|
6
|
-
if (platform() !== "windows") {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
5
|
await invoke("plugin:window-integration|clear_snap_geometry");
|
|
10
6
|
}
|
|
11
7
|
async function getAccentColor() {
|
|
12
8
|
return await invoke("plugin:window-integration|get_accent_color");
|
|
13
9
|
}
|
|
14
10
|
async function getButtonLayout() {
|
|
15
|
-
if (platform() !== "linux") {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
11
|
return await invoke("plugin:window-integration|get_button_layout");
|
|
19
12
|
}
|
|
20
13
|
async function getTitlebarIcons() {
|
|
21
|
-
if (platform() !== "linux") {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
14
|
return await invoke("plugin:window-integration|get_titlebar_icons");
|
|
25
15
|
}
|
|
26
16
|
async function onSnapHover(callback) {
|
|
27
|
-
return await listen("snap-hover", (event) => {
|
|
17
|
+
return await getCurrentWindow().listen("plugin:window-integration:snap-hover", (event) => {
|
|
28
18
|
callback(event.payload);
|
|
29
19
|
});
|
|
30
20
|
}
|
|
31
21
|
async function onSnapPress(callback) {
|
|
32
|
-
return await listen("snap-press", (event) => {
|
|
22
|
+
return await getCurrentWindow().listen("plugin:window-integration:snap-press", (event) => {
|
|
33
23
|
callback(event.payload);
|
|
34
24
|
});
|
|
35
25
|
}
|
|
36
26
|
async function updateSnapGeometry(geometry) {
|
|
37
|
-
if (platform() !== "windows") {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
27
|
await invoke("plugin:window-integration|update_snap_geometry", { ...geometry });
|
|
41
28
|
}
|
|
42
29
|
async function updateVibrancy(dark) {
|
|
43
|
-
if (platform() !== "windows") {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
30
|
await invoke("plugin:window-integration|update_vibrancy", { dark });
|
|
47
31
|
}
|
|
48
32
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nickvisionapps/plugin-window-integration",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "JS/TS bindings for the tauri-plugin-window-integration Tauri plugin.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -28,8 +28,7 @@
|
|
|
28
28
|
"LICENSE"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@tauri-apps/api": "^2"
|
|
32
|
-
"@tauri-apps/plugin-os": "^2"
|
|
31
|
+
"@tauri-apps/api": "^2"
|
|
33
32
|
},
|
|
34
33
|
"devDependencies": {
|
|
35
34
|
"@eslint/js": "^10.0.1",
|
|
@@ -42,5 +41,17 @@
|
|
|
42
41
|
"tslib": "^2.8.1",
|
|
43
42
|
"typescript": "^5.7.2",
|
|
44
43
|
"typescript-eslint": "^8.70.0"
|
|
45
|
-
}
|
|
44
|
+
},
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "git+https://github.com/NickvisionApps/tauri-plugin-window-integration.git",
|
|
48
|
+
"directory": "guest-js"
|
|
49
|
+
},
|
|
50
|
+
"author": "Nick Logozzo",
|
|
51
|
+
"keywords": [
|
|
52
|
+
"tauri-plugin",
|
|
53
|
+
"window",
|
|
54
|
+
"vibrancy",
|
|
55
|
+
"titlebar"
|
|
56
|
+
]
|
|
46
57
|
}
|
package/dist-js/index 3.cjs
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var core = require('@tauri-apps/api/core');
|
|
4
|
-
var event = require('@tauri-apps/api/event');
|
|
5
|
-
var pluginOs = require('@tauri-apps/plugin-os');
|
|
6
|
-
|
|
7
|
-
async function clearSnapGeometry() {
|
|
8
|
-
if (pluginOs.platform() !== "windows") {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
await core.invoke("plugin:window-integration|clear_snap_geometry");
|
|
12
|
-
}
|
|
13
|
-
async function getAccentColor() {
|
|
14
|
-
return await core.invoke("plugin:window-integration|get_accent_color");
|
|
15
|
-
}
|
|
16
|
-
async function getButtonLayout() {
|
|
17
|
-
if (pluginOs.platform() !== "linux") {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
return await core.invoke("plugin:window-integration|get_button_layout");
|
|
21
|
-
}
|
|
22
|
-
async function getTitlebarIcons() {
|
|
23
|
-
if (pluginOs.platform() !== "linux") {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
return await core.invoke("plugin:window-integration|get_titlebar_icons");
|
|
27
|
-
}
|
|
28
|
-
async function onSnapHover(callback) {
|
|
29
|
-
return await event.listen("snap-hover", (event) => callback(event.payload));
|
|
30
|
-
}
|
|
31
|
-
async function onSnapPress(callback) {
|
|
32
|
-
return await event.listen("snap-press", (event) => callback(event.payload));
|
|
33
|
-
}
|
|
34
|
-
async function updateSnapGeometry(geometry) {
|
|
35
|
-
if (pluginOs.platform() !== "windows") {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
await core.invoke("plugin:window-integration|update_snap_geometry", { ...geometry });
|
|
39
|
-
}
|
|
40
|
-
async function updateVibrancy(dark) {
|
|
41
|
-
if (pluginOs.platform() !== "windows") {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
await core.invoke("plugin:window-integration|update_vibrancy", { dark });
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
exports.clearSnapGeometry = clearSnapGeometry;
|
|
48
|
-
exports.getAccentColor = getAccentColor;
|
|
49
|
-
exports.getButtonLayout = getButtonLayout;
|
|
50
|
-
exports.getTitlebarIcons = getTitlebarIcons;
|
|
51
|
-
exports.onSnapHover = onSnapHover;
|
|
52
|
-
exports.onSnapPress = onSnapPress;
|
|
53
|
-
exports.updateSnapGeometry = updateSnapGeometry;
|
|
54
|
-
exports.updateVibrancy = updateVibrancy;
|
package/dist-js/index 3.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { invoke } from '@tauri-apps/api/core';
|
|
2
|
-
import { listen } from '@tauri-apps/api/event';
|
|
3
|
-
import { platform } from '@tauri-apps/plugin-os';
|
|
4
|
-
|
|
5
|
-
async function clearSnapGeometry() {
|
|
6
|
-
if (platform() !== "windows") {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
await invoke("plugin:window-integration|clear_snap_geometry");
|
|
10
|
-
}
|
|
11
|
-
async function getAccentColor() {
|
|
12
|
-
return await invoke("plugin:window-integration|get_accent_color");
|
|
13
|
-
}
|
|
14
|
-
async function getButtonLayout() {
|
|
15
|
-
if (platform() !== "linux") {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
return await invoke("plugin:window-integration|get_button_layout");
|
|
19
|
-
}
|
|
20
|
-
async function getTitlebarIcons() {
|
|
21
|
-
if (platform() !== "linux") {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
return await invoke("plugin:window-integration|get_titlebar_icons");
|
|
25
|
-
}
|
|
26
|
-
async function onSnapHover(callback) {
|
|
27
|
-
return await listen("snap-hover", (event) => callback(event.payload));
|
|
28
|
-
}
|
|
29
|
-
async function onSnapPress(callback) {
|
|
30
|
-
return await listen("snap-press", (event) => callback(event.payload));
|
|
31
|
-
}
|
|
32
|
-
async function updateSnapGeometry(geometry) {
|
|
33
|
-
if (platform() !== "windows") {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
await invoke("plugin:window-integration|update_snap_geometry", { ...geometry });
|
|
37
|
-
}
|
|
38
|
-
async function updateVibrancy(dark) {
|
|
39
|
-
if (platform() !== "windows") {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
await invoke("plugin:window-integration|update_vibrancy", { dark });
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export { clearSnapGeometry, getAccentColor, getButtonLayout, getTitlebarIcons, onSnapHover, onSnapPress, updateSnapGeometry, updateVibrancy };
|
package/dist-js/index.d 3.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type UnlistenFn } from "@tauri-apps/api/event";
|
|
2
|
-
export interface SnapGeometry {
|
|
3
|
-
x: number;
|
|
4
|
-
y: number;
|
|
5
|
-
width: number;
|
|
6
|
-
height: number;
|
|
7
|
-
titlebarHeight: number;
|
|
8
|
-
controlBandWidth: number;
|
|
9
|
-
}
|
|
10
|
-
export declare function clearSnapGeometry(): Promise<void>;
|
|
11
|
-
export declare function getAccentColor(): Promise<string | null>;
|
|
12
|
-
export declare function getButtonLayout(): Promise<string | null>;
|
|
13
|
-
export declare function getTitlebarIcons(): Promise<Record<string, string> | null>;
|
|
14
|
-
export declare function onSnapHover(callback: (hovering: boolean) => void): Promise<UnlistenFn>;
|
|
15
|
-
export declare function onSnapPress(callback: (pressing: boolean) => void): Promise<UnlistenFn>;
|
|
16
|
-
export declare function updateSnapGeometry(geometry: SnapGeometry): Promise<void>;
|
|
17
|
-
export declare function updateVibrancy(dark: boolean): Promise<void>;
|