@owdproject/core 4.0.0-alpha.3 → 4.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/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as WorkspaceManager, b as WindowManager, a as ApplicationManager } from './shared/core.
|
|
2
|
-
export { A as ApplicationInstance, W as WindowInstance } from './shared/core.
|
|
1
|
+
import { c as WorkspaceManager, b as WindowManager, a as ApplicationManager } from './shared/core.d_A3q1kZ.mjs';
|
|
2
|
+
export { A as ApplicationInstance, W as WindowInstance } from './shared/core.d_A3q1kZ.mjs';
|
|
3
3
|
import { c as createDesktopHooks, C as CoreIPCBus } from './shared/core.Pd_Ogt4g.mjs';
|
|
4
4
|
export { g as globalDesktopHooks, a as globalIPCBus } from './shared/core.Pd_Ogt4g.mjs';
|
|
5
5
|
import { D as DesktopCommands, a as DesktopKeybindings } from './shared/core.B1XxB289.mjs';
|
|
@@ -79,6 +79,7 @@ declare class ApplicationInstance {
|
|
|
79
79
|
get isSuspended(): boolean;
|
|
80
80
|
hasPermission(permission: ApplicationPermission): boolean;
|
|
81
81
|
private ensureProcessStarted;
|
|
82
|
+
private reuseSingletonWindow;
|
|
82
83
|
launch(entryKey?: string, argument?: string): Promise<boolean>;
|
|
83
84
|
openWindow(model: string, meta?: Record<string, any>, initialState?: Partial<WindowState>): Promise<WindowInstance | undefined>;
|
|
84
85
|
closeWindow(windowId: string): Promise<boolean>;
|
package/dist/managers/index.d.ts
CHANGED
|
@@ -79,6 +79,7 @@ declare class ApplicationInstance {
|
|
|
79
79
|
get isSuspended(): boolean;
|
|
80
80
|
hasPermission(permission: ApplicationPermission): boolean;
|
|
81
81
|
private ensureProcessStarted;
|
|
82
|
+
private reuseSingletonWindow;
|
|
82
83
|
launch(entryKey?: string, argument?: string): Promise<boolean>;
|
|
83
84
|
openWindow(model: string, meta?: Record<string, any>, initialState?: Partial<WindowState>): Promise<WindowInstance | undefined>;
|
|
84
85
|
closeWindow(windowId: string): Promise<boolean>;
|
package/dist/managers/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as ApplicationInstance, a as ApplicationManager, W as WindowInstance, b as WindowManager, c as WorkspaceManager } from '../shared/core.
|
|
1
|
+
export { A as ApplicationInstance, a as ApplicationManager, W as WindowInstance, b as WindowManager, c as WorkspaceManager } from '../shared/core.d_A3q1kZ.mjs';
|
|
2
2
|
import 'xstate';
|
|
3
3
|
import '../shared/core.B3mp7ztE.mjs';
|
|
4
4
|
import '../shared/core.CsDFgGnX.mjs';
|
|
@@ -627,6 +627,15 @@ class ApplicationInstance {
|
|
|
627
627
|
this._startedAt = Date.now();
|
|
628
628
|
}
|
|
629
629
|
}
|
|
630
|
+
reuseSingletonWindow() {
|
|
631
|
+
if (!this.config.singleton || this._windowIds.size === 0) return void 0;
|
|
632
|
+
const existingId = Array.from(this._windowIds)[0];
|
|
633
|
+
const existingWindow = this.windowManager.get(existingId);
|
|
634
|
+
if (!existingWindow) return void 0;
|
|
635
|
+
existingWindow.unminimize();
|
|
636
|
+
this.windowManager.focusWindow(existingWindow.id);
|
|
637
|
+
return existingWindow;
|
|
638
|
+
}
|
|
630
639
|
async launch(entryKey, argument) {
|
|
631
640
|
const entries = this.config.entries ?? {};
|
|
632
641
|
const resolvedKey = entryKey ?? Object.keys(entries)[0];
|
|
@@ -666,15 +675,8 @@ class ApplicationInstance {
|
|
|
666
675
|
category: this.config.category,
|
|
667
676
|
size: { width: 640, height: 480 }
|
|
668
677
|
};
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
const existingWin = this.windowManager.get(existingId);
|
|
672
|
-
if (existingWin) {
|
|
673
|
-
existingWin.unminimize();
|
|
674
|
-
this.windowManager.focusWindow(existingWin.id);
|
|
675
|
-
return existingWin;
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
+
const existingWindow = this.reuseSingletonWindow();
|
|
679
|
+
if (existingWindow) return existingWindow;
|
|
678
680
|
const openCtx = {
|
|
679
681
|
app: this,
|
|
680
682
|
model,
|
|
@@ -684,6 +686,8 @@ class ApplicationInstance {
|
|
|
684
686
|
};
|
|
685
687
|
await this.hooks.callHook("window:before-open", openCtx);
|
|
686
688
|
if (openCtx.cancel) return void 0;
|
|
689
|
+
const concurrentWindow = this.reuseSingletonWindow();
|
|
690
|
+
if (concurrentWindow) return concurrentWindow;
|
|
687
691
|
this.ensureProcessStarted();
|
|
688
692
|
const winId = `${this.id}-${model}-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
|
|
689
693
|
const workspace = initialState?.workspace ?? this.workspaceManager?.activeWorkspace ?? "workspace-1";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owdproject/core",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.4",
|
|
4
4
|
"description": "Headless desktop engine for the web: windows, applications, workspaces, commands, hooks, IPC, and pointer math",
|
|
5
5
|
"homepage": "https://github.com/owdproject/core#readme",
|
|
6
6
|
"repository": {
|