@tishlang/tish-desktop-api 1.1.1 → 1.1.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/package.json +2 -2
- package/src/appApi.tish +15 -5
- package/src/desktopHost.tish +1 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tishlang/tish-desktop-api",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "Core UI bridge and app-api façade (invoke, listen, state.*) — no UI kit dependency",
|
|
5
5
|
"license": "PIF",
|
|
6
6
|
"type": "module",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@tishlang/tish-desktop-shared": "1.1.
|
|
43
|
+
"@tishlang/tish-desktop-shared": "1.1.4"
|
|
44
44
|
},
|
|
45
45
|
"keywords": [
|
|
46
46
|
"tish",
|
package/src/appApi.tish
CHANGED
|
@@ -6,7 +6,9 @@ import { EVT_STATE_CHANGED } from "@tishlang/tish-desktop-shared"
|
|
|
6
6
|
fn bridge() {
|
|
7
7
|
let g = globalThis
|
|
8
8
|
let b = g.__TISH_APP__
|
|
9
|
-
if (b === null || b === undefined)
|
|
9
|
+
if (b === null || b === undefined) {
|
|
10
|
+
b = g.__TISH_DESKTOP__
|
|
11
|
+
}
|
|
10
12
|
if (b === null || b === undefined) {
|
|
11
13
|
console.error("tish-app bridge not installed — import bridge.js or web-bridge.js first")
|
|
12
14
|
return null
|
|
@@ -16,7 +18,9 @@ fn bridge() {
|
|
|
16
18
|
|
|
17
19
|
export fn getCurrentWindowLabel() {
|
|
18
20
|
let b = bridge()
|
|
19
|
-
if (b === null)
|
|
21
|
+
if (b === null) {
|
|
22
|
+
return "main"
|
|
23
|
+
}
|
|
20
24
|
return b.getCurrentWindowLabel()
|
|
21
25
|
}
|
|
22
26
|
|
|
@@ -56,9 +60,15 @@ export fn statePatch(path, value) {
|
|
|
56
60
|
export fn useSharedState(path, onChange) {
|
|
57
61
|
return listen(EVT_STATE_CHANGED, (payload) => {
|
|
58
62
|
let p = payload.path
|
|
59
|
-
if (p === undefined)
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
if (p === undefined) {
|
|
64
|
+
p = payload.key
|
|
65
|
+
}
|
|
66
|
+
if (path !== null && path !== undefined && p !== path) {
|
|
67
|
+
return
|
|
68
|
+
}
|
|
69
|
+
if (onChange) {
|
|
70
|
+
onChange(payload.value, p, payload.revision, payload.source)
|
|
71
|
+
}
|
|
62
72
|
})
|
|
63
73
|
}
|
|
64
74
|
|
package/src/desktopHost.tish
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
// UI façade over window.__TISH_APP__ / __TISH_DESKTOP__ (injected by bridge.js).
|
|
2
2
|
// Re-exports app-api helpers for backward compatibility.
|
|
3
3
|
|
|
4
|
-
export {
|
|
5
|
-
getCurrentWindowLabel,
|
|
6
|
-
invoke,
|
|
7
|
-
listen,
|
|
8
|
-
emit,
|
|
9
|
-
stateGet,
|
|
10
|
-
stateSet,
|
|
11
|
-
statePatch,
|
|
12
|
-
useSharedState,
|
|
13
|
-
Platform,
|
|
14
|
-
PROTOCOL,
|
|
15
|
-
} from "./appApi.tish"
|
|
4
|
+
export { getCurrentWindowLabel, invoke, listen, emit, stateGet, stateSet, statePatch, useSharedState, Platform, PROTOCOL } from "./appApi.tish"
|