@edenapp/sdk 0.5.1 → 0.5.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/dist/app-frame/frame-injector.js +6 -6
- package/dist/app-frame/frame-injector.js.map +3 -3
- package/dist/apps/prebuilt/com.eden.context-menu/dist/assets/{index-DUrqfNSi.js → index-B-ks_-b3.js} +1 -1
- package/dist/apps/prebuilt/com.eden.context-menu/dist/index.html +1 -1
- package/dist/apps/prebuilt/com.eden.eveshell/dist/assets/{index-CEfffVHu.js → index-CokBDS24.js} +1 -1
- package/dist/apps/prebuilt/com.eden.eveshell/dist/index.html +1 -1
- package/dist/apps/prebuilt/com.eden.eveshell/manifest.json +9 -1
- package/dist/apps/prebuilt/com.eden.example.hello/backend/node_modules/@edenapp/types/AppManifest.d.ts +9 -3
- package/dist/apps/prebuilt/com.eden.example.hello/backend/node_modules/@edenapp/types/CHANGELOG.md +6 -0
- package/dist/apps/prebuilt/com.eden.example.hello/backend/node_modules/@edenapp/types/commands.generated.d.ts +61 -15
- package/dist/apps/prebuilt/com.eden.example.hello/backend/node_modules/@edenapp/types/global.d.ts +8 -3
- package/dist/apps/prebuilt/com.eden.example.hello/backend/node_modules/@edenapp/types/package.json +1 -1
- package/dist/apps/prebuilt/com.eden.example.hello/frontend/node_modules/@edenapp/types/AppManifest.d.ts +9 -3
- package/dist/apps/prebuilt/com.eden.example.hello/frontend/node_modules/@edenapp/types/CHANGELOG.md +6 -0
- package/dist/apps/prebuilt/com.eden.example.hello/frontend/node_modules/@edenapp/types/commands.generated.d.ts +61 -15
- package/dist/apps/prebuilt/com.eden.example.hello/frontend/node_modules/@edenapp/types/global.d.ts +8 -3
- package/dist/apps/prebuilt/com.eden.example.hello/frontend/node_modules/@edenapp/types/package.json +1 -1
- package/dist/apps/prebuilt/com.eden.login/dist/assets/{index-DyI95N2f.js → index-KswMPsHx.js} +1 -1
- package/dist/apps/prebuilt/com.eden.login/dist/index.html +1 -1
- package/dist/apps/prebuilt/com.eden.toaster/dist/assets/{index-C4cVyh7j.js → index-b5EUNXyn.js} +2 -2
- package/dist/apps/prebuilt/com.eden.toaster/dist/index.html +1 -1
- package/dist/generated/runtime.d.ts.map +1 -1
- package/dist/generated/runtime.js +6 -1
- package/dist/generated/runtime.js.map +1 -1
- package/dist/process-manager/ProcessHandler.d.ts +12 -0
- package/dist/process-manager/ProcessHandler.d.ts.map +1 -1
- package/dist/process-manager/ProcessHandler.js +24 -3
- package/dist/process-manager/ProcessHandler.js.map +1 -1
- package/dist/view-manager/ViewCreator.d.ts.map +1 -1
- package/dist/view-manager/ViewCreator.js +2 -1
- package/dist/view-manager/ViewCreator.js.map +1 -1
- package/dist/view-manager/ViewHandler.d.ts +67 -20
- package/dist/view-manager/ViewHandler.d.ts.map +1 -1
- package/dist/view-manager/ViewHandler.js +204 -122
- package/dist/view-manager/ViewHandler.js.map +1 -1
- package/package.json +4 -4
- package/dist/main.d.ts +0 -2
- package/dist/main.d.ts.map +0 -1
- package/dist/main.js +0 -15
- package/dist/main.js.map +0 -1
- package/dist/view-manager/DevToolsManager.d.ts +0 -29
- package/dist/view-manager/DevToolsManager.d.ts.map +0 -1
- package/dist/view-manager/DevToolsManager.js +0 -88
- package/dist/view-manager/DevToolsManager.js.map +0 -1
- package/dist/view-manager/LayoutCalculator.d.ts +0 -49
- package/dist/view-manager/LayoutCalculator.d.ts.map +0 -1
- package/dist/view-manager/LayoutCalculator.js +0 -94
- package/dist/view-manager/LayoutCalculator.js.map +0 -1
- package/dist/view-manager/TilingManager.d.ts +0 -61
- package/dist/view-manager/TilingManager.d.ts.map +0 -1
- package/dist/view-manager/TilingManager.js +0 -142
- package/dist/view-manager/TilingManager.js.map +0 -1
- package/dist/view-manager/ViewLifecycle.d.ts +0 -66
- package/dist/view-manager/ViewLifecycle.d.ts.map +0 -1
- package/dist/view-manager/ViewLifecycle.js +0 -142
- package/dist/view-manager/ViewLifecycle.js.map +0 -1
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ViewLifecycle = exports.ViewGuard = void 0;
|
|
4
|
-
const electron_1 = require("electron");
|
|
5
|
-
/**
|
|
6
|
-
* ViewGuard
|
|
7
|
-
*
|
|
8
|
-
* Utility class for validating view state before operations.
|
|
9
|
-
* Provides defensive checks to prevent crashes from destroyed views.
|
|
10
|
-
*/
|
|
11
|
-
class ViewGuard {
|
|
12
|
-
/**
|
|
13
|
-
* Check if a WebContentsView exists and is valid
|
|
14
|
-
*/
|
|
15
|
-
static isValid(view) {
|
|
16
|
-
return view !== undefined && view !== null;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Check if a WebContentsView's webContents is still alive (not destroyed)
|
|
20
|
-
*/
|
|
21
|
-
static isAlive(view) {
|
|
22
|
-
if (!ViewGuard.isValid(view))
|
|
23
|
-
return false;
|
|
24
|
-
try {
|
|
25
|
-
return !view.webContents.isDestroyed();
|
|
26
|
-
}
|
|
27
|
-
catch {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Check if a BrowserWindow exists and is not destroyed
|
|
33
|
-
*/
|
|
34
|
-
static isWindowAlive(window) {
|
|
35
|
-
return window !== undefined && window !== null && !window.isDestroyed();
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Get a view from the map with validation
|
|
39
|
-
* Throws an error if view is not found or destroyed
|
|
40
|
-
*/
|
|
41
|
-
static requireView(viewId, views) {
|
|
42
|
-
const viewInfo = views.get(viewId);
|
|
43
|
-
if (!viewInfo) {
|
|
44
|
-
throw new Error(`View ${viewId} not found`);
|
|
45
|
-
}
|
|
46
|
-
if (!ViewGuard.isAlive(viewInfo.view)) {
|
|
47
|
-
throw new Error(`View ${viewId} is destroyed`);
|
|
48
|
-
}
|
|
49
|
-
return viewInfo;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Get a view by app ID from the map, returning the first matching view
|
|
53
|
-
* Throws an error if view is not found or destroyed
|
|
54
|
-
*/
|
|
55
|
-
static requireViewByAppId(appId, views) {
|
|
56
|
-
for (const [viewId, info] of views.entries()) {
|
|
57
|
-
if (info.appId === appId) {
|
|
58
|
-
if (!ViewGuard.isAlive(info.view)) {
|
|
59
|
-
throw new Error(`View for app ${appId} is destroyed`);
|
|
60
|
-
}
|
|
61
|
-
return { viewId, viewInfo: info };
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
throw new Error(`No view found for app ${appId}`);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
exports.ViewGuard = ViewGuard;
|
|
68
|
-
/**
|
|
69
|
-
* ViewLifecycle
|
|
70
|
-
*
|
|
71
|
-
* Handles creation and destruction of WebContentsViews.
|
|
72
|
-
* Provides safe lifecycle management with proper cleanup.
|
|
73
|
-
*/
|
|
74
|
-
class ViewLifecycle {
|
|
75
|
-
/**
|
|
76
|
-
* Create a new WebContentsView with standard options
|
|
77
|
-
*/
|
|
78
|
-
static createView(options) {
|
|
79
|
-
const { preloadScript, transparent = true, backgroundThrottling = false, additionalArguments = [], } = options;
|
|
80
|
-
return new electron_1.WebContentsView({
|
|
81
|
-
webPreferences: {
|
|
82
|
-
nodeIntegration: false,
|
|
83
|
-
contextIsolation: true,
|
|
84
|
-
sandbox: false,
|
|
85
|
-
preload: preloadScript,
|
|
86
|
-
transparent,
|
|
87
|
-
backgroundThrottling,
|
|
88
|
-
scrollBounce: false,
|
|
89
|
-
spellcheck: false,
|
|
90
|
-
additionalArguments,
|
|
91
|
-
},
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Safely destroy a view and remove it from the main window
|
|
96
|
-
*/
|
|
97
|
-
static destroyView(viewInfo, mainWindow) {
|
|
98
|
-
try {
|
|
99
|
-
// Check if view is already destroyed
|
|
100
|
-
if (!ViewGuard.isAlive(viewInfo.view)) {
|
|
101
|
-
// View already destroyed, nothing to do
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
// Remove from main window if window still exists
|
|
105
|
-
if (ViewGuard.isWindowAlive(mainWindow)) {
|
|
106
|
-
try {
|
|
107
|
-
mainWindow.contentView.removeChildView(viewInfo.view);
|
|
108
|
-
}
|
|
109
|
-
catch (error) {
|
|
110
|
-
// Ignore errors during removal - view might already be removed
|
|
111
|
-
console.warn("[ViewLifecycle] Ignoring error during view removal:", error);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
catch (error) {
|
|
116
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
117
|
-
console.error("[ViewLifecycle] Failed to destroy view:", errorMessage);
|
|
118
|
-
throw new Error(`Failed to destroy view: ${errorMessage}`);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Remove all destroyed views from a view map
|
|
123
|
-
* Returns the number of views cleaned up
|
|
124
|
-
*/
|
|
125
|
-
static cleanupDestroyedViews(views) {
|
|
126
|
-
const destroyedIds = [];
|
|
127
|
-
for (const [viewId, info] of views.entries()) {
|
|
128
|
-
if (!ViewGuard.isAlive(info.view)) {
|
|
129
|
-
destroyedIds.push(viewId);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
for (const id of destroyedIds) {
|
|
133
|
-
views.delete(id);
|
|
134
|
-
}
|
|
135
|
-
if (destroyedIds.length > 0) {
|
|
136
|
-
console.log(`[ViewLifecycle] Cleaned up ${destroyedIds.length} destroyed views`);
|
|
137
|
-
}
|
|
138
|
-
return destroyedIds.length;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
exports.ViewLifecycle = ViewLifecycle;
|
|
142
|
-
//# sourceMappingURL=ViewLifecycle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ViewLifecycle.js","sourceRoot":"","sources":["../../src/view-manager/ViewLifecycle.ts"],"names":[],"mappings":";;;AAAA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