@elizaos/capacitor-desktop 1.0.0

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.
@@ -0,0 +1,269 @@
1
+ 'use strict';
2
+
3
+ var core = require('@capacitor/core');
4
+
5
+ const loadWeb = () => Promise.resolve().then(function () { return web; }).then((m) => new m.DesktopWeb());
6
+ const Desktop = core.registerPlugin("Desktop", {
7
+ web: loadWeb,
8
+ });
9
+
10
+ class DesktopWeb extends core.WebPlugin {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.pluginListeners = [];
14
+ }
15
+ // System Tray - Not available in browser
16
+ async createTray(_options) {
17
+ }
18
+ async updateTray(_options) {
19
+ }
20
+ async destroyTray() {
21
+ }
22
+ async setTrayMenu(_options) {
23
+ }
24
+ // Global Shortcuts - Not available in browser
25
+ async registerShortcut(_options) {
26
+ return { success: false };
27
+ }
28
+ async unregisterShortcut(_options) {
29
+ }
30
+ async unregisterAllShortcuts() {
31
+ }
32
+ async isShortcutRegistered(_options) {
33
+ return { registered: false };
34
+ }
35
+ // Auto Launch - Not available in browser
36
+ async setAutoLaunch(_options) {
37
+ }
38
+ async getAutoLaunchStatus() {
39
+ return { enabled: false, openAsHidden: false };
40
+ }
41
+ // Window Management - Limited in browser
42
+ async setWindowOptions(_options) {
43
+ }
44
+ async getWindowBounds() {
45
+ return {
46
+ x: window.screenX,
47
+ y: window.screenY,
48
+ width: window.outerWidth,
49
+ height: window.outerHeight,
50
+ };
51
+ }
52
+ async setWindowBounds(_options) {
53
+ }
54
+ async minimizeWindow() {
55
+ }
56
+ async maximizeWindow() {
57
+ }
58
+ async unmaximizeWindow() {
59
+ }
60
+ async closeWindow() {
61
+ window.close();
62
+ }
63
+ async showWindow() {
64
+ window.focus();
65
+ }
66
+ async hideWindow() {
67
+ }
68
+ async focusWindow() {
69
+ window.focus();
70
+ }
71
+ async isWindowMaximized() {
72
+ return { maximized: false };
73
+ }
74
+ async isWindowMinimized() {
75
+ return { minimized: document.hidden };
76
+ }
77
+ async isWindowVisible() {
78
+ return { visible: !document.hidden };
79
+ }
80
+ async isWindowFocused() {
81
+ return { focused: document.hasFocus() };
82
+ }
83
+ async setAlwaysOnTop(_options) {
84
+ }
85
+ async setFullscreen(options) {
86
+ options.flag
87
+ ? document.documentElement.requestFullscreen()
88
+ : document.exitFullscreen();
89
+ }
90
+ async setOpacity(_options) {
91
+ }
92
+ // Notifications - Using Web Notification API
93
+ async showNotification(options) {
94
+ const id = `notification_${Date.now()}`;
95
+ if (!("Notification" in window)) {
96
+ return {
97
+ id,
98
+ shown: false,
99
+ error: "Notification API not available in this browser",
100
+ };
101
+ }
102
+ if (Notification.permission === "denied") {
103
+ return { id, shown: false, error: "Notification permission denied" };
104
+ }
105
+ if (Notification.permission !== "granted") {
106
+ const permission = await Notification.requestPermission();
107
+ if (permission !== "granted") {
108
+ return {
109
+ id,
110
+ shown: false,
111
+ error: "Notification permission not granted",
112
+ };
113
+ }
114
+ }
115
+ const notification = new Notification(options.title, {
116
+ body: options.body,
117
+ icon: options.icon,
118
+ silent: options.silent,
119
+ });
120
+ notification.onclick = () => this.notifyListeners("notificationClick", {});
121
+ return { id, shown: true };
122
+ }
123
+ async closeNotification(_options) {
124
+ // Web Notification API doesn't provide a way to close notifications by ID.
125
+ // Notifications auto-close or the user dismisses them.
126
+ }
127
+ // Power Monitor
128
+ async getPowerState() {
129
+ const getBattery = navigator.getBattery;
130
+ if (getBattery) {
131
+ try {
132
+ const battery = await getBattery.call(navigator);
133
+ return {
134
+ onBattery: !battery.charging,
135
+ batteryLevel: battery.level * 100,
136
+ isCharging: battery.charging,
137
+ idleState: "active", // Idle detection not available on web
138
+ idleTime: 0,
139
+ };
140
+ }
141
+ catch (err) {
142
+ console.debug("[Desktop] Battery API access failed:", err);
143
+ }
144
+ }
145
+ return {
146
+ onBattery: false, // Unknown, defaulting to false
147
+ idleState: "unknown",
148
+ idleTime: 0,
149
+ };
150
+ }
151
+ // App
152
+ async quit() {
153
+ window.close();
154
+ }
155
+ async relaunch() {
156
+ window.location.reload();
157
+ }
158
+ async getVersion() {
159
+ // On web platform, version info is limited. Return actual browser info where available.
160
+ // Note: "version" and "name" would need to come from app config - returning "unknown" to indicate unavailability
161
+ return {
162
+ version: "unknown", // App version not available on web - would need to be injected at build time
163
+ name: "unknown", // App name not available on web - would need to be injected at build time
164
+ runtime: "N/A", // Not running in the desktop runtime
165
+ chrome: navigator.userAgent.match(/Chrome\/([0-9.]+)/)?.[1] ?? "unknown",
166
+ node: "N/A", // Not running in Node
167
+ };
168
+ }
169
+ async isPackaged() {
170
+ return { packaged: false };
171
+ }
172
+ async getPath(_options) {
173
+ throw new Error("File system paths are not available in browser environment");
174
+ }
175
+ // Clipboard
176
+ async writeToClipboard(options) {
177
+ if (options.text) {
178
+ await navigator.clipboard.writeText(options.text);
179
+ return;
180
+ }
181
+ if (options.html) {
182
+ await navigator.clipboard.write([
183
+ new ClipboardItem({
184
+ "text/html": new Blob([options.html], { type: "text/html" }),
185
+ }),
186
+ ]);
187
+ }
188
+ }
189
+ async readFromClipboard() {
190
+ return { text: await navigator.clipboard.readText(), hasImage: false };
191
+ }
192
+ async clearClipboard() {
193
+ await navigator.clipboard.writeText("");
194
+ }
195
+ // Shell
196
+ async openExternal(options) {
197
+ window.open(options.url, "_blank");
198
+ }
199
+ async showItemInFolder(_options) {
200
+ }
201
+ async beep() {
202
+ const ctx = new AudioContext();
203
+ const osc = ctx.createOscillator();
204
+ const gain = ctx.createGain();
205
+ osc.connect(gain).connect(ctx.destination);
206
+ osc.frequency.value = 800;
207
+ osc.type = "sine";
208
+ gain.gain.setValueAtTime(0.3, ctx.currentTime);
209
+ gain.gain.exponentialRampToValueAtTime(0.01, ctx.currentTime + 0.1);
210
+ osc.start(ctx.currentTime);
211
+ osc.stop(ctx.currentTime + 0.1);
212
+ }
213
+ // Events
214
+ async addListener(eventName, listenerFunc) {
215
+ const entry = { eventName, callback: listenerFunc };
216
+ // Create and track window event listeners to avoid memory leaks
217
+ if (eventName === "windowFocus") {
218
+ entry.windowListener = () => listenerFunc(undefined);
219
+ window.addEventListener("focus", entry.windowListener);
220
+ }
221
+ else if (eventName === "windowBlur") {
222
+ entry.windowListener = () => listenerFunc(undefined);
223
+ window.addEventListener("blur", entry.windowListener);
224
+ }
225
+ this.pluginListeners.push(entry);
226
+ return {
227
+ remove: async () => {
228
+ const i = this.pluginListeners.indexOf(entry);
229
+ if (i >= 0) {
230
+ // Remove window event listener if it exists
231
+ if (entry.windowListener) {
232
+ if (entry.eventName === "windowFocus")
233
+ window.removeEventListener("focus", entry.windowListener);
234
+ else if (entry.eventName === "windowBlur")
235
+ window.removeEventListener("blur", entry.windowListener);
236
+ }
237
+ this.pluginListeners.splice(i, 1);
238
+ }
239
+ },
240
+ };
241
+ }
242
+ async removeAllListeners() {
243
+ // Clean up all window event listeners before clearing
244
+ for (const entry of this.pluginListeners) {
245
+ if (entry.windowListener) {
246
+ if (entry.eventName === "windowFocus")
247
+ window.removeEventListener("focus", entry.windowListener);
248
+ else if (entry.eventName === "windowBlur")
249
+ window.removeEventListener("blur", entry.windowListener);
250
+ }
251
+ }
252
+ this.pluginListeners = [];
253
+ }
254
+ notifyListeners(eventName, data) {
255
+ this.pluginListeners
256
+ .filter((l) => l.eventName === eventName)
257
+ .forEach((l) => {
258
+ l.callback(data);
259
+ });
260
+ }
261
+ }
262
+
263
+ var web = /*#__PURE__*/Object.freeze({
264
+ __proto__: null,
265
+ DesktopWeb: DesktopWeb
266
+ });
267
+
268
+ exports.Desktop = Desktop;
269
+ //# sourceMappingURL=plugin.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nexport * from \"./definitions\";\nconst loadWeb = () => import(\"./web\").then((m) => new m.DesktopWeb());\nexport const Desktop = registerPlugin(\"Desktop\", {\n web: loadWeb,\n});\n","import { WebPlugin } from \"@capacitor/core\";\n// No-op for features unavailable on web; callers should check return values.\nconst webUnavailable = (_feature) => { };\nexport class DesktopWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.pluginListeners = [];\n }\n // System Tray - Not available in browser\n async createTray(_options) {\n webUnavailable(\"System tray\");\n }\n async updateTray(_options) {\n webUnavailable(\"System tray\");\n }\n async destroyTray() {\n webUnavailable(\"System tray\");\n }\n async setTrayMenu(_options) {\n webUnavailable(\"System tray\");\n }\n // Global Shortcuts - Not available in browser\n async registerShortcut(_options) {\n webUnavailable(\"Global shortcuts\");\n return { success: false };\n }\n async unregisterShortcut(_options) {\n webUnavailable(\"Global shortcuts\");\n }\n async unregisterAllShortcuts() {\n webUnavailable(\"Global shortcuts\");\n }\n async isShortcutRegistered(_options) {\n return { registered: false };\n }\n // Auto Launch - Not available in browser\n async setAutoLaunch(_options) {\n webUnavailable(\"Auto launch\");\n }\n async getAutoLaunchStatus() {\n return { enabled: false, openAsHidden: false };\n }\n // Window Management - Limited in browser\n async setWindowOptions(_options) {\n webUnavailable(\"Window options\");\n }\n async getWindowBounds() {\n return {\n x: window.screenX,\n y: window.screenY,\n width: window.outerWidth,\n height: window.outerHeight,\n };\n }\n async setWindowBounds(_options) {\n webUnavailable(\"Setting window bounds\");\n }\n async minimizeWindow() {\n webUnavailable(\"Window minimize\");\n }\n async maximizeWindow() {\n webUnavailable(\"Window maximize\");\n }\n async unmaximizeWindow() {\n webUnavailable(\"Window unmaximize\");\n }\n async closeWindow() {\n window.close();\n }\n async showWindow() {\n window.focus();\n }\n async hideWindow() {\n webUnavailable(\"Window hide\");\n }\n async focusWindow() {\n window.focus();\n }\n async isWindowMaximized() {\n return { maximized: false };\n }\n async isWindowMinimized() {\n return { minimized: document.hidden };\n }\n async isWindowVisible() {\n return { visible: !document.hidden };\n }\n async isWindowFocused() {\n return { focused: document.hasFocus() };\n }\n async setAlwaysOnTop(_options) {\n webUnavailable(\"Always on top\");\n }\n async setFullscreen(options) {\n options.flag\n ? document.documentElement.requestFullscreen()\n : document.exitFullscreen();\n }\n async setOpacity(_options) {\n webUnavailable(\"Window opacity\");\n }\n // Notifications - Using Web Notification API\n async showNotification(options) {\n const id = `notification_${Date.now()}`;\n if (!(\"Notification\" in window)) {\n return {\n id,\n shown: false,\n error: \"Notification API not available in this browser\",\n };\n }\n if (Notification.permission === \"denied\") {\n return { id, shown: false, error: \"Notification permission denied\" };\n }\n if (Notification.permission !== \"granted\") {\n const permission = await Notification.requestPermission();\n if (permission !== \"granted\") {\n return {\n id,\n shown: false,\n error: \"Notification permission not granted\",\n };\n }\n }\n const notification = new Notification(options.title, {\n body: options.body,\n icon: options.icon,\n silent: options.silent,\n });\n notification.onclick = () => this.notifyListeners(\"notificationClick\", {});\n return { id, shown: true };\n }\n async closeNotification(_options) {\n // Web Notification API doesn't provide a way to close notifications by ID.\n // Notifications auto-close or the user dismisses them.\n }\n // Power Monitor\n async getPowerState() {\n const getBattery = navigator.getBattery;\n if (getBattery) {\n try {\n const battery = await getBattery.call(navigator);\n return {\n onBattery: !battery.charging,\n batteryLevel: battery.level * 100,\n isCharging: battery.charging,\n idleState: \"active\", // Idle detection not available on web\n idleTime: 0,\n };\n }\n catch (err) {\n console.debug(\"[Desktop] Battery API access failed:\", err);\n }\n }\n return {\n onBattery: false, // Unknown, defaulting to false\n idleState: \"unknown\",\n idleTime: 0,\n };\n }\n // App\n async quit() {\n window.close();\n }\n async relaunch() {\n window.location.reload();\n }\n async getVersion() {\n // On web platform, version info is limited. Return actual browser info where available.\n // Note: \"version\" and \"name\" would need to come from app config - returning \"unknown\" to indicate unavailability\n return {\n version: \"unknown\", // App version not available on web - would need to be injected at build time\n name: \"unknown\", // App name not available on web - would need to be injected at build time\n runtime: \"N/A\", // Not running in the desktop runtime\n chrome: navigator.userAgent.match(/Chrome\\/([0-9.]+)/)?.[1] ?? \"unknown\",\n node: \"N/A\", // Not running in Node\n };\n }\n async isPackaged() {\n return { packaged: false };\n }\n async getPath(_options) {\n throw new Error(\"File system paths are not available in browser environment\");\n }\n // Clipboard\n async writeToClipboard(options) {\n if (options.text) {\n await navigator.clipboard.writeText(options.text);\n return;\n }\n if (options.html) {\n await navigator.clipboard.write([\n new ClipboardItem({\n \"text/html\": new Blob([options.html], { type: \"text/html\" }),\n }),\n ]);\n }\n }\n async readFromClipboard() {\n return { text: await navigator.clipboard.readText(), hasImage: false };\n }\n async clearClipboard() {\n await navigator.clipboard.writeText(\"\");\n }\n // Shell\n async openExternal(options) {\n window.open(options.url, \"_blank\");\n }\n async showItemInFolder(_options) {\n webUnavailable(\"Show in folder\");\n }\n async beep() {\n const ctx = new AudioContext();\n const osc = ctx.createOscillator();\n const gain = ctx.createGain();\n osc.connect(gain).connect(ctx.destination);\n osc.frequency.value = 800;\n osc.type = \"sine\";\n gain.gain.setValueAtTime(0.3, ctx.currentTime);\n gain.gain.exponentialRampToValueAtTime(0.01, ctx.currentTime + 0.1);\n osc.start(ctx.currentTime);\n osc.stop(ctx.currentTime + 0.1);\n }\n // Events\n async addListener(eventName, listenerFunc) {\n const entry = { eventName, callback: listenerFunc };\n // Create and track window event listeners to avoid memory leaks\n if (eventName === \"windowFocus\") {\n entry.windowListener = () => listenerFunc(undefined);\n window.addEventListener(\"focus\", entry.windowListener);\n }\n else if (eventName === \"windowBlur\") {\n entry.windowListener = () => listenerFunc(undefined);\n window.addEventListener(\"blur\", entry.windowListener);\n }\n this.pluginListeners.push(entry);\n return {\n remove: async () => {\n const i = this.pluginListeners.indexOf(entry);\n if (i >= 0) {\n // Remove window event listener if it exists\n if (entry.windowListener) {\n if (entry.eventName === \"windowFocus\")\n window.removeEventListener(\"focus\", entry.windowListener);\n else if (entry.eventName === \"windowBlur\")\n window.removeEventListener(\"blur\", entry.windowListener);\n }\n this.pluginListeners.splice(i, 1);\n }\n },\n };\n }\n async removeAllListeners() {\n // Clean up all window event listeners before clearing\n for (const entry of this.pluginListeners) {\n if (entry.windowListener) {\n if (entry.eventName === \"windowFocus\")\n window.removeEventListener(\"focus\", entry.windowListener);\n else if (entry.eventName === \"windowBlur\")\n window.removeEventListener(\"blur\", entry.windowListener);\n }\n }\n this.pluginListeners = [];\n }\n notifyListeners(eventName, data) {\n this.pluginListeners\n .filter((l) => l.eventName === eventName)\n .forEach((l) => {\n l.callback(data);\n });\n }\n}\n"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AAEA,MAAM,OAAO,GAAG,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;AACzD,MAAC,OAAO,GAAGA,mBAAc,CAAC,SAAS,EAAE;AACjD,IAAI,GAAG,EAAE,OAAO;AAChB,CAAC;;ACFM,MAAM,UAAU,SAASC,cAAS,CAAC;AAC1C,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC;AAC3B,QAAQ,IAAI,CAAC,eAAe,GAAG,EAAE;AACjC,IAAI;AACJ;AACA,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;AAE/B,IAAI;AACJ,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;AAE/B,IAAI;AACJ,IAAI,MAAM,WAAW,GAAG;AAExB,IAAI;AACJ,IAAI,MAAM,WAAW,CAAC,QAAQ,EAAE;AAEhC,IAAI;AACJ;AACA,IAAI,MAAM,gBAAgB,CAAC,QAAQ,EAAE;AAErC,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;AACjC,IAAI;AACJ,IAAI,MAAM,kBAAkB,CAAC,QAAQ,EAAE;AAEvC,IAAI;AACJ,IAAI,MAAM,sBAAsB,GAAG;AAEnC,IAAI;AACJ,IAAI,MAAM,oBAAoB,CAAC,QAAQ,EAAE;AACzC,QAAQ,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE;AACpC,IAAI;AACJ;AACA,IAAI,MAAM,aAAa,CAAC,QAAQ,EAAE;AAElC,IAAI;AACJ,IAAI,MAAM,mBAAmB,GAAG;AAChC,QAAQ,OAAO,EAAE,O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AqB,IAAI,KAAK,CAAC,SAAS,KAAK,YAAY;AACzD,oBAAoB,MAAM,CAAC,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC;AAC5E,YAAY;AACZ,QAAQ;AACR,QAAQ,IAAI,CAAC,eAAe,GAAG,EAAE;AACjC,IAAI;AACJ,IAAI,eAAe,CAAC,SAAS,EAAE,IAAI,EAAE;AACrC,QAAQ,IAAI,CAAC;AACb,aAAa,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,KAAK,SAAS;AACpD,aAAa,OAAO,CAAC,CAAC,CAAC,KAAK;AAC5B,YAAY,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;AAC5B,QAAQ,CAAC,CAAC;AACV,IAAI;AACJ;;;;;;;;;"}
package/dist/plugin.js ADDED
@@ -0,0 +1,272 @@
1
+ var capacitorDesktop = (function (exports, core) {
2
+ 'use strict';
3
+
4
+ const loadWeb = () => Promise.resolve().then(function () { return web; }).then((m) => new m.DesktopWeb());
5
+ const Desktop = core.registerPlugin("Desktop", {
6
+ web: loadWeb,
7
+ });
8
+
9
+ class DesktopWeb extends core.WebPlugin {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.pluginListeners = [];
13
+ }
14
+ // System Tray - Not available in browser
15
+ async createTray(_options) {
16
+ }
17
+ async updateTray(_options) {
18
+ }
19
+ async destroyTray() {
20
+ }
21
+ async setTrayMenu(_options) {
22
+ }
23
+ // Global Shortcuts - Not available in browser
24
+ async registerShortcut(_options) {
25
+ return { success: false };
26
+ }
27
+ async unregisterShortcut(_options) {
28
+ }
29
+ async unregisterAllShortcuts() {
30
+ }
31
+ async isShortcutRegistered(_options) {
32
+ return { registered: false };
33
+ }
34
+ // Auto Launch - Not available in browser
35
+ async setAutoLaunch(_options) {
36
+ }
37
+ async getAutoLaunchStatus() {
38
+ return { enabled: false, openAsHidden: false };
39
+ }
40
+ // Window Management - Limited in browser
41
+ async setWindowOptions(_options) {
42
+ }
43
+ async getWindowBounds() {
44
+ return {
45
+ x: window.screenX,
46
+ y: window.screenY,
47
+ width: window.outerWidth,
48
+ height: window.outerHeight,
49
+ };
50
+ }
51
+ async setWindowBounds(_options) {
52
+ }
53
+ async minimizeWindow() {
54
+ }
55
+ async maximizeWindow() {
56
+ }
57
+ async unmaximizeWindow() {
58
+ }
59
+ async closeWindow() {
60
+ window.close();
61
+ }
62
+ async showWindow() {
63
+ window.focus();
64
+ }
65
+ async hideWindow() {
66
+ }
67
+ async focusWindow() {
68
+ window.focus();
69
+ }
70
+ async isWindowMaximized() {
71
+ return { maximized: false };
72
+ }
73
+ async isWindowMinimized() {
74
+ return { minimized: document.hidden };
75
+ }
76
+ async isWindowVisible() {
77
+ return { visible: !document.hidden };
78
+ }
79
+ async isWindowFocused() {
80
+ return { focused: document.hasFocus() };
81
+ }
82
+ async setAlwaysOnTop(_options) {
83
+ }
84
+ async setFullscreen(options) {
85
+ options.flag
86
+ ? document.documentElement.requestFullscreen()
87
+ : document.exitFullscreen();
88
+ }
89
+ async setOpacity(_options) {
90
+ }
91
+ // Notifications - Using Web Notification API
92
+ async showNotification(options) {
93
+ const id = `notification_${Date.now()}`;
94
+ if (!("Notification" in window)) {
95
+ return {
96
+ id,
97
+ shown: false,
98
+ error: "Notification API not available in this browser",
99
+ };
100
+ }
101
+ if (Notification.permission === "denied") {
102
+ return { id, shown: false, error: "Notification permission denied" };
103
+ }
104
+ if (Notification.permission !== "granted") {
105
+ const permission = await Notification.requestPermission();
106
+ if (permission !== "granted") {
107
+ return {
108
+ id,
109
+ shown: false,
110
+ error: "Notification permission not granted",
111
+ };
112
+ }
113
+ }
114
+ const notification = new Notification(options.title, {
115
+ body: options.body,
116
+ icon: options.icon,
117
+ silent: options.silent,
118
+ });
119
+ notification.onclick = () => this.notifyListeners("notificationClick", {});
120
+ return { id, shown: true };
121
+ }
122
+ async closeNotification(_options) {
123
+ // Web Notification API doesn't provide a way to close notifications by ID.
124
+ // Notifications auto-close or the user dismisses them.
125
+ }
126
+ // Power Monitor
127
+ async getPowerState() {
128
+ const getBattery = navigator.getBattery;
129
+ if (getBattery) {
130
+ try {
131
+ const battery = await getBattery.call(navigator);
132
+ return {
133
+ onBattery: !battery.charging,
134
+ batteryLevel: battery.level * 100,
135
+ isCharging: battery.charging,
136
+ idleState: "active", // Idle detection not available on web
137
+ idleTime: 0,
138
+ };
139
+ }
140
+ catch (err) {
141
+ console.debug("[Desktop] Battery API access failed:", err);
142
+ }
143
+ }
144
+ return {
145
+ onBattery: false, // Unknown, defaulting to false
146
+ idleState: "unknown",
147
+ idleTime: 0,
148
+ };
149
+ }
150
+ // App
151
+ async quit() {
152
+ window.close();
153
+ }
154
+ async relaunch() {
155
+ window.location.reload();
156
+ }
157
+ async getVersion() {
158
+ // On web platform, version info is limited. Return actual browser info where available.
159
+ // Note: "version" and "name" would need to come from app config - returning "unknown" to indicate unavailability
160
+ return {
161
+ version: "unknown", // App version not available on web - would need to be injected at build time
162
+ name: "unknown", // App name not available on web - would need to be injected at build time
163
+ runtime: "N/A", // Not running in the desktop runtime
164
+ chrome: navigator.userAgent.match(/Chrome\/([0-9.]+)/)?.[1] ?? "unknown",
165
+ node: "N/A", // Not running in Node
166
+ };
167
+ }
168
+ async isPackaged() {
169
+ return { packaged: false };
170
+ }
171
+ async getPath(_options) {
172
+ throw new Error("File system paths are not available in browser environment");
173
+ }
174
+ // Clipboard
175
+ async writeToClipboard(options) {
176
+ if (options.text) {
177
+ await navigator.clipboard.writeText(options.text);
178
+ return;
179
+ }
180
+ if (options.html) {
181
+ await navigator.clipboard.write([
182
+ new ClipboardItem({
183
+ "text/html": new Blob([options.html], { type: "text/html" }),
184
+ }),
185
+ ]);
186
+ }
187
+ }
188
+ async readFromClipboard() {
189
+ return { text: await navigator.clipboard.readText(), hasImage: false };
190
+ }
191
+ async clearClipboard() {
192
+ await navigator.clipboard.writeText("");
193
+ }
194
+ // Shell
195
+ async openExternal(options) {
196
+ window.open(options.url, "_blank");
197
+ }
198
+ async showItemInFolder(_options) {
199
+ }
200
+ async beep() {
201
+ const ctx = new AudioContext();
202
+ const osc = ctx.createOscillator();
203
+ const gain = ctx.createGain();
204
+ osc.connect(gain).connect(ctx.destination);
205
+ osc.frequency.value = 800;
206
+ osc.type = "sine";
207
+ gain.gain.setValueAtTime(0.3, ctx.currentTime);
208
+ gain.gain.exponentialRampToValueAtTime(0.01, ctx.currentTime + 0.1);
209
+ osc.start(ctx.currentTime);
210
+ osc.stop(ctx.currentTime + 0.1);
211
+ }
212
+ // Events
213
+ async addListener(eventName, listenerFunc) {
214
+ const entry = { eventName, callback: listenerFunc };
215
+ // Create and track window event listeners to avoid memory leaks
216
+ if (eventName === "windowFocus") {
217
+ entry.windowListener = () => listenerFunc(undefined);
218
+ window.addEventListener("focus", entry.windowListener);
219
+ }
220
+ else if (eventName === "windowBlur") {
221
+ entry.windowListener = () => listenerFunc(undefined);
222
+ window.addEventListener("blur", entry.windowListener);
223
+ }
224
+ this.pluginListeners.push(entry);
225
+ return {
226
+ remove: async () => {
227
+ const i = this.pluginListeners.indexOf(entry);
228
+ if (i >= 0) {
229
+ // Remove window event listener if it exists
230
+ if (entry.windowListener) {
231
+ if (entry.eventName === "windowFocus")
232
+ window.removeEventListener("focus", entry.windowListener);
233
+ else if (entry.eventName === "windowBlur")
234
+ window.removeEventListener("blur", entry.windowListener);
235
+ }
236
+ this.pluginListeners.splice(i, 1);
237
+ }
238
+ },
239
+ };
240
+ }
241
+ async removeAllListeners() {
242
+ // Clean up all window event listeners before clearing
243
+ for (const entry of this.pluginListeners) {
244
+ if (entry.windowListener) {
245
+ if (entry.eventName === "windowFocus")
246
+ window.removeEventListener("focus", entry.windowListener);
247
+ else if (entry.eventName === "windowBlur")
248
+ window.removeEventListener("blur", entry.windowListener);
249
+ }
250
+ }
251
+ this.pluginListeners = [];
252
+ }
253
+ notifyListeners(eventName, data) {
254
+ this.pluginListeners
255
+ .filter((l) => l.eventName === eventName)
256
+ .forEach((l) => {
257
+ l.callback(data);
258
+ });
259
+ }
260
+ }
261
+
262
+ var web = /*#__PURE__*/Object.freeze({
263
+ __proto__: null,
264
+ DesktopWeb: DesktopWeb
265
+ });
266
+
267
+ exports.Desktop = Desktop;
268
+
269
+ return exports;
270
+
271
+ })({}, capacitorExports);
272
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nexport * from \"./definitions\";\nconst loadWeb = () => import(\"./web\").then((m) => new m.DesktopWeb());\nexport const Desktop = registerPlugin(\"Desktop\", {\n web: loadWeb,\n});\n","import { WebPlugin } from \"@capacitor/core\";\n// No-op for features unavailable on web; callers should check return values.\nconst webUnavailable = (_feature) => { };\nexport class DesktopWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.pluginListeners = [];\n }\n // System Tray - Not available in browser\n async createTray(_options) {\n webUnavailable(\"System tray\");\n }\n async updateTray(_options) {\n webUnavailable(\"System tray\");\n }\n async destroyTray() {\n webUnavailable(\"System tray\");\n }\n async setTrayMenu(_options) {\n webUnavailable(\"System tray\");\n }\n // Global Shortcuts - Not available in browser\n async registerShortcut(_options) {\n webUnavailable(\"Global shortcuts\");\n return { success: false };\n }\n async unregisterShortcut(_options) {\n webUnavailable(\"Global shortcuts\");\n }\n async unregisterAllShortcuts() {\n webUnavailable(\"Global shortcuts\");\n }\n async isShortcutRegistered(_options) {\n return { registered: false };\n }\n // Auto Launch - Not available in browser\n async setAutoLaunch(_options) {\n webUnavailable(\"Auto launch\");\n }\n async getAutoLaunchStatus() {\n return { enabled: false, openAsHidden: false };\n }\n // Window Management - Limited in browser\n async setWindowOptions(_options) {\n webUnavailable(\"Window options\");\n }\n async getWindowBounds() {\n return {\n x: window.screenX,\n y: window.screenY,\n width: window.outerWidth,\n height: window.outerHeight,\n };\n }\n async setWindowBounds(_options) {\n webUnavailable(\"Setting window bounds\");\n }\n async minimizeWindow() {\n webUnavailable(\"Window minimize\");\n }\n async maximizeWindow() {\n webUnavailable(\"Window maximize\");\n }\n async unmaximizeWindow() {\n webUnavailable(\"Window unmaximize\");\n }\n async closeWindow() {\n window.close();\n }\n async showWindow() {\n window.focus();\n }\n async hideWindow() {\n webUnavailable(\"Window hide\");\n }\n async focusWindow() {\n window.focus();\n }\n async isWindowMaximized() {\n return { maximized: false };\n }\n async isWindowMinimized() {\n return { minimized: document.hidden };\n }\n async isWindowVisible() {\n return { visible: !document.hidden };\n }\n async isWindowFocused() {\n return { focused: document.hasFocus() };\n }\n async setAlwaysOnTop(_options) {\n webUnavailable(\"Always on top\");\n }\n async setFullscreen(options) {\n options.flag\n ? document.documentElement.requestFullscreen()\n : document.exitFullscreen();\n }\n async setOpacity(_options) {\n webUnavailable(\"Window opacity\");\n }\n // Notifications - Using Web Notification API\n async showNotification(options) {\n const id = `notification_${Date.now()}`;\n if (!(\"Notification\" in window)) {\n return {\n id,\n shown: false,\n error: \"Notification API not available in this browser\",\n };\n }\n if (Notification.permission === \"denied\") {\n return { id, shown: false, error: \"Notification permission denied\" };\n }\n if (Notification.permission !== \"granted\") {\n const permission = await Notification.requestPermission();\n if (permission !== \"granted\") {\n return {\n id,\n shown: false,\n error: \"Notification permission not granted\",\n };\n }\n }\n const notification = new Notification(options.title, {\n body: options.body,\n icon: options.icon,\n silent: options.silent,\n });\n notification.onclick = () => this.notifyListeners(\"notificationClick\", {});\n return { id, shown: true };\n }\n async closeNotification(_options) {\n // Web Notification API doesn't provide a way to close notifications by ID.\n // Notifications auto-close or the user dismisses them.\n }\n // Power Monitor\n async getPowerState() {\n const getBattery = navigator.getBattery;\n if (getBattery) {\n try {\n const battery = await getBattery.call(navigator);\n return {\n onBattery: !battery.charging,\n batteryLevel: battery.level * 100,\n isCharging: battery.charging,\n idleState: \"active\", // Idle detection not available on web\n idleTime: 0,\n };\n }\n catch (err) {\n console.debug(\"[Desktop] Battery API access failed:\", err);\n }\n }\n return {\n onBattery: false, // Unknown, defaulting to false\n idleState: \"unknown\",\n idleTime: 0,\n };\n }\n // App\n async quit() {\n window.close();\n }\n async relaunch() {\n window.location.reload();\n }\n async getVersion() {\n // On web platform, version info is limited. Return actual browser info where available.\n // Note: \"version\" and \"name\" would need to come from app config - returning \"unknown\" to indicate unavailability\n return {\n version: \"unknown\", // App version not available on web - would need to be injected at build time\n name: \"unknown\", // App name not available on web - would need to be injected at build time\n runtime: \"N/A\", // Not running in the desktop runtime\n chrome: navigator.userAgent.match(/Chrome\\/([0-9.]+)/)?.[1] ?? \"unknown\",\n node: \"N/A\", // Not running in Node\n };\n }\n async isPackaged() {\n return { packaged: false };\n }\n async getPath(_options) {\n throw new Error(\"File system paths are not available in browser environment\");\n }\n // Clipboard\n async writeToClipboard(options) {\n if (options.text) {\n await navigator.clipboard.writeText(options.text);\n return;\n }\n if (options.html) {\n await navigator.clipboard.write([\n new ClipboardItem({\n \"text/html\": new Blob([options.html], { type: \"text/html\" }),\n }),\n ]);\n }\n }\n async readFromClipboard() {\n return { text: await navigator.clipboard.readText(), hasImage: false };\n }\n async clearClipboard() {\n await navigator.clipboard.writeText(\"\");\n }\n // Shell\n async openExternal(options) {\n window.open(options.url, \"_blank\");\n }\n async showItemInFolder(_options) {\n webUnavailable(\"Show in folder\");\n }\n async beep() {\n const ctx = new AudioContext();\n const osc = ctx.createOscillator();\n const gain = ctx.createGain();\n osc.connect(gain).connect(ctx.destination);\n osc.frequency.value = 800;\n osc.type = \"sine\";\n gain.gain.setValueAtTime(0.3, ctx.currentTime);\n gain.gain.exponentialRampToValueAtTime(0.01, ctx.currentTime + 0.1);\n osc.start(ctx.currentTime);\n osc.stop(ctx.currentTime + 0.1);\n }\n // Events\n async addListener(eventName, listenerFunc) {\n const entry = { eventName, callback: listenerFunc };\n // Create and track window event listeners to avoid memory leaks\n if (eventName === \"windowFocus\") {\n entry.windowListener = () => listenerFunc(undefined);\n window.addEventListener(\"focus\", entry.windowListener);\n }\n else if (eventName === \"windowBlur\") {\n entry.windowListener = () => listenerFunc(undefined);\n window.addEventListener(\"blur\", entry.windowListener);\n }\n this.pluginListeners.push(entry);\n return {\n remove: async () => {\n const i = this.pluginListeners.indexOf(entry);\n if (i >= 0) {\n // Remove window event listener if it exists\n if (entry.windowListener) {\n if (entry.eventName === \"windowFocus\")\n window.removeEventListener(\"focus\", entry.windowListener);\n else if (entry.eventName === \"windowBlur\")\n window.removeEventListener(\"blur\", entry.windowListener);\n }\n this.pluginListeners.splice(i, 1);\n }\n },\n };\n }\n async removeAllListeners() {\n // Clean up all window event listeners before clearing\n for (const entry of this.pluginListeners) {\n if (entry.windowListener) {\n if (entry.eventName === \"windowFocus\")\n window.removeEventListener(\"focus\", entry.windowListener);\n else if (entry.eventName === \"windowBlur\")\n window.removeEventListener(\"blur\", entry.windowListener);\n }\n }\n this.pluginListeners = [];\n }\n notifyListeners(eventName, data) {\n this.pluginListeners\n .filter((l) => l.eventName === eventName)\n .forEach((l) => {\n l.callback(data);\n });\n }\n}\n"],"names":["registerPlugin","WebPlugin"],"mappings":";;;IAEA,MAAM,OAAO,GAAG,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;AACzD,UAAC,OAAO,GAAGA,mBAAc,CAAC,SAAS,EAAE;IACjD,IAAI,GAAG,EAAE,OAAO;IAChB,CAAC;;ICFM,MAAM,UAAU,SAASC,cAAS,CAAC;IAC1C,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC;IAC3B,QAAQ,IAAI,CAAC,eAAe,GAAG,EAAE;IACjC,IAAI;IACJ;IACA,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;IAE/B,IAAI;IACJ,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;IAE/B,IAAI;IACJ,IAAI,MAAM,WAAW,GAAG;IAExB,IAAI;IACJ,IAAI,MAAM,WAAW,CAAC,QAAQ,EAAE;IAEhC,IAAI;IACJ;IACA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