@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.
Files changed (56) hide show
  1. package/dist/app-frame/frame-injector.js +6 -6
  2. package/dist/app-frame/frame-injector.js.map +3 -3
  3. package/dist/apps/prebuilt/com.eden.context-menu/dist/assets/{index-DUrqfNSi.js → index-B-ks_-b3.js} +1 -1
  4. package/dist/apps/prebuilt/com.eden.context-menu/dist/index.html +1 -1
  5. package/dist/apps/prebuilt/com.eden.eveshell/dist/assets/{index-CEfffVHu.js → index-CokBDS24.js} +1 -1
  6. package/dist/apps/prebuilt/com.eden.eveshell/dist/index.html +1 -1
  7. package/dist/apps/prebuilt/com.eden.eveshell/manifest.json +9 -1
  8. package/dist/apps/prebuilt/com.eden.example.hello/backend/node_modules/@edenapp/types/AppManifest.d.ts +9 -3
  9. package/dist/apps/prebuilt/com.eden.example.hello/backend/node_modules/@edenapp/types/CHANGELOG.md +6 -0
  10. package/dist/apps/prebuilt/com.eden.example.hello/backend/node_modules/@edenapp/types/commands.generated.d.ts +61 -15
  11. package/dist/apps/prebuilt/com.eden.example.hello/backend/node_modules/@edenapp/types/global.d.ts +8 -3
  12. package/dist/apps/prebuilt/com.eden.example.hello/backend/node_modules/@edenapp/types/package.json +1 -1
  13. package/dist/apps/prebuilt/com.eden.example.hello/frontend/node_modules/@edenapp/types/AppManifest.d.ts +9 -3
  14. package/dist/apps/prebuilt/com.eden.example.hello/frontend/node_modules/@edenapp/types/CHANGELOG.md +6 -0
  15. package/dist/apps/prebuilt/com.eden.example.hello/frontend/node_modules/@edenapp/types/commands.generated.d.ts +61 -15
  16. package/dist/apps/prebuilt/com.eden.example.hello/frontend/node_modules/@edenapp/types/global.d.ts +8 -3
  17. package/dist/apps/prebuilt/com.eden.example.hello/frontend/node_modules/@edenapp/types/package.json +1 -1
  18. package/dist/apps/prebuilt/com.eden.login/dist/assets/{index-DyI95N2f.js → index-KswMPsHx.js} +1 -1
  19. package/dist/apps/prebuilt/com.eden.login/dist/index.html +1 -1
  20. package/dist/apps/prebuilt/com.eden.toaster/dist/assets/{index-C4cVyh7j.js → index-b5EUNXyn.js} +2 -2
  21. package/dist/apps/prebuilt/com.eden.toaster/dist/index.html +1 -1
  22. package/dist/generated/runtime.d.ts.map +1 -1
  23. package/dist/generated/runtime.js +6 -1
  24. package/dist/generated/runtime.js.map +1 -1
  25. package/dist/process-manager/ProcessHandler.d.ts +12 -0
  26. package/dist/process-manager/ProcessHandler.d.ts.map +1 -1
  27. package/dist/process-manager/ProcessHandler.js +24 -3
  28. package/dist/process-manager/ProcessHandler.js.map +1 -1
  29. package/dist/view-manager/ViewCreator.d.ts.map +1 -1
  30. package/dist/view-manager/ViewCreator.js +2 -1
  31. package/dist/view-manager/ViewCreator.js.map +1 -1
  32. package/dist/view-manager/ViewHandler.d.ts +67 -20
  33. package/dist/view-manager/ViewHandler.d.ts.map +1 -1
  34. package/dist/view-manager/ViewHandler.js +204 -122
  35. package/dist/view-manager/ViewHandler.js.map +1 -1
  36. package/package.json +4 -4
  37. package/dist/main.d.ts +0 -2
  38. package/dist/main.d.ts.map +0 -1
  39. package/dist/main.js +0 -15
  40. package/dist/main.js.map +0 -1
  41. package/dist/view-manager/DevToolsManager.d.ts +0 -29
  42. package/dist/view-manager/DevToolsManager.d.ts.map +0 -1
  43. package/dist/view-manager/DevToolsManager.js +0 -88
  44. package/dist/view-manager/DevToolsManager.js.map +0 -1
  45. package/dist/view-manager/LayoutCalculator.d.ts +0 -49
  46. package/dist/view-manager/LayoutCalculator.d.ts.map +0 -1
  47. package/dist/view-manager/LayoutCalculator.js +0 -94
  48. package/dist/view-manager/LayoutCalculator.js.map +0 -1
  49. package/dist/view-manager/TilingManager.d.ts +0 -61
  50. package/dist/view-manager/TilingManager.d.ts.map +0 -1
  51. package/dist/view-manager/TilingManager.js +0 -142
  52. package/dist/view-manager/TilingManager.js.map +0 -1
  53. package/dist/view-manager/ViewLifecycle.d.ts +0 -66
  54. package/dist/view-manager/ViewLifecycle.d.ts.map +0 -1
  55. package/dist/view-manager/ViewLifecycle.js +0 -142
  56. package/dist/view-manager/ViewLifecycle.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edenapp/sdk",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Eden Desktop Environment SDK - Build Electron-based desktop environments with modular app support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -28,8 +28,8 @@
28
28
  "keyv": "^5.1.0",
29
29
  "reflect-metadata": "^0.2.2",
30
30
  "tsyringe": "^4.10.0",
31
- "@edenapp/types": "0.5.1",
32
- "@edenapp/genesis": "0.5.1"
31
+ "@edenapp/types": "0.5.2",
32
+ "@edenapp/genesis": "0.5.2"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/jest": "^29.5.14",
@@ -42,7 +42,7 @@
42
42
  "ts-morph": "^27.0.2",
43
43
  "ts-node": "^10.9.2",
44
44
  "typescript": "^5.3.0",
45
- "@edenapp/scripts": "0.5.1"
45
+ "@edenapp/scripts": "0.5.2"
46
46
  },
47
47
  "scripts": {
48
48
  "build": "pnpm run tokens:build && pnpm run css:build && pnpm run codegen && pnpm run build:main && pnpm run bundle:app-frame && pnpm run bundle:app-runtime && pnpm run build:apps && pnpm run copy-assets",
package/dist/main.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=main.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":""}
package/dist/main.js DELETED
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const Eden_1 = require("./Eden");
4
- // Create and start the Eden app
5
- new Eden_1.Eden({
6
- development: process.env.NODE_ENV === "development",
7
- tiling: {
8
- mode: "horizontal", // Options: "none", "horizontal", "vertical", "grid"
9
- gap: 8, // Gap between tiles in pixels
10
- padding: 8, // Padding around workspace in pixels
11
- },
12
- userDirectory: ".",
13
- autostart: ["com.eden.eveshell", "com.eden.toaster"],
14
- });
15
- //# sourceMappingURL=main.js.map
package/dist/main.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;AAAA,iCAA8B;AAE9B,gCAAgC;AAChC,IAAI,WAAI,CAAC;IACP,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa;IACnD,MAAM,EAAE;QACN,IAAI,EAAE,YAAY,EAAE,oDAAoD;QACxE,GAAG,EAAE,CAAC,EAAE,8BAA8B;QACtC,OAAO,EAAE,CAAC,EAAE,qCAAqC;KAClD;IACD,aAAa,EAAE,GAAG;IAClB,SAAS,EAAE,CAAC,mBAAmB,EAAE,kBAAkB,CAAC;CACrD,CAAC,CAAC"}
@@ -1,29 +0,0 @@
1
- import { WebContentsView } from "electron";
2
- /**
3
- * DevToolsManager
4
- *
5
- * Manages DevTools for WebContentsViews, including:
6
- * - Keyboard shortcut registration (Ctrl+Shift+D)
7
- * - Automatic cleanup when views are destroyed
8
- */
9
- export declare class DevToolsManager {
10
- private viewsWithDevTools;
11
- /**
12
- * Register DevTools shortcut (Ctrl+Shift+D) on a WebContentsView
13
- * Works on both X11 and Wayland
14
- */
15
- registerShortcut(view: WebContentsView): void;
16
- /**
17
- * Close DevTools for a view when it's being destroyed
18
- */
19
- closeDevToolsForView(view: WebContentsView): void;
20
- /**
21
- * Get the set of webContents IDs that have DevTools open
22
- */
23
- getViewsWithDevTools(): Set<number>;
24
- /**
25
- * Clear all tracked DevTools
26
- */
27
- clear(): void;
28
- }
29
- //# sourceMappingURL=DevToolsManager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DevToolsManager.d.ts","sourceRoot":"","sources":["../../src/view-manager/DevToolsManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG3C;;;;;;GAMG;AACH,qBAEa,eAAe;IAC1B,OAAO,CAAC,iBAAiB,CAA0B;IAEnD;;;OAGG;IACH,gBAAgB,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI;IA8B7C;;OAEG;IACH,oBAAoB,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI;IAqBjD;;OAEG;IACH,oBAAoB,IAAI,GAAG,CAAC,MAAM,CAAC;IAInC;;OAEG;IACH,KAAK,IAAI,IAAI;CAGd"}
@@ -1,88 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.DevToolsManager = void 0;
10
- const tsyringe_1 = require("tsyringe");
11
- /**
12
- * DevToolsManager
13
- *
14
- * Manages DevTools for WebContentsViews, including:
15
- * - Keyboard shortcut registration (Ctrl+Shift+D)
16
- * - Automatic cleanup when views are destroyed
17
- */
18
- let DevToolsManager = class DevToolsManager {
19
- viewsWithDevTools = new Set();
20
- /**
21
- * Register DevTools shortcut (Ctrl+Shift+D) on a WebContentsView
22
- * Works on both X11 and Wayland
23
- */
24
- registerShortcut(view) {
25
- view.webContents.on("before-input-event", (event, input) => {
26
- // Check for Ctrl+Shift+D (or Cmd+Shift+D on macOS)
27
- if (input.type === "keyDown" &&
28
- input.key.toLowerCase() === "d" &&
29
- input.shift &&
30
- (input.control || input.meta) &&
31
- !input.alt) {
32
- event.preventDefault();
33
- try {
34
- const webContentsId = view.webContents.id;
35
- if (view.webContents.isDevToolsOpened()) {
36
- view.webContents.closeDevTools();
37
- this.viewsWithDevTools.delete(webContentsId);
38
- console.log("Closed DevTools for view");
39
- }
40
- else {
41
- view.webContents.openDevTools();
42
- this.viewsWithDevTools.add(webContentsId);
43
- console.log("Opened DevTools for view");
44
- }
45
- }
46
- catch (err) {
47
- console.error("Failed to toggle DevTools:", err);
48
- }
49
- }
50
- });
51
- }
52
- /**
53
- * Close DevTools for a view when it's being destroyed
54
- */
55
- closeDevToolsForView(view) {
56
- try {
57
- const webContentsId = view.webContents.id;
58
- if (!view.webContents.isDestroyed() &&
59
- view.webContents.isDevToolsOpened()) {
60
- view.webContents.closeDevTools();
61
- console.log(`Closed DevTools for view (webContents ID: ${webContentsId})`);
62
- }
63
- this.viewsWithDevTools.delete(webContentsId);
64
- }
65
- catch (err) {
66
- // Ignore errors during cleanup
67
- console.debug("Error closing DevTools during cleanup:", err);
68
- }
69
- }
70
- /**
71
- * Get the set of webContents IDs that have DevTools open
72
- */
73
- getViewsWithDevTools() {
74
- return new Set(this.viewsWithDevTools);
75
- }
76
- /**
77
- * Clear all tracked DevTools
78
- */
79
- clear() {
80
- this.viewsWithDevTools.clear();
81
- }
82
- };
83
- exports.DevToolsManager = DevToolsManager;
84
- exports.DevToolsManager = DevToolsManager = __decorate([
85
- (0, tsyringe_1.singleton)(),
86
- (0, tsyringe_1.injectable)()
87
- ], DevToolsManager);
88
- //# sourceMappingURL=DevToolsManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DevToolsManager.js","sourceRoot":"","sources":["../../src/view-manager/DevToolsManager.ts"],"names":[],"mappings":";;;;;;;;;AACA,uCAAiD;AAEjD;;;;;;GAMG;AAGI,IAAM,eAAe,GAArB,MAAM,eAAe;IAClB,iBAAiB,GAAgB,IAAI,GAAG,EAAE,CAAC;IAEnD;;;OAGG;IACH,gBAAgB,CAAC,IAAqB;QACpC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,oBAAo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BACD,IAAI,CAAC,WAAW,CAAC,aAAa,EAAE,CAAC;gBACjC,OAAO,CAAC,GAAG,CACT,6CAA6C,aAAa,GAAG,CAC9D,CAAC;YACJ,CAAC;YAED,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAC/C,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,+BAA+B;YAC/B,OAAO,CAAC,KAAK,CAAC,wCAAwC,EAAE,GAAG,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;IAED;;OAEG;IACH,oBAAoB;QAClB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;IACjC,CAAC;CACF,CAAA;AA1EY,0CAAe;0BAAf,eAAe;IAF3B,IAAA,oBAAS,GAAE;IACX,IAAA,qBAAU,GAAE;GACA,eAAe,CA0E3B"}
@@ -1,49 +0,0 @@
1
- import { Rectangle as Bounds } from "electron";
2
- import { TilingConfig } from "@edenapp/types";
3
- /**
4
- * Grid dimensions for a layout
5
- */
6
- interface GridDimensions {
7
- rows: number;
8
- columns: number;
9
- }
10
- /**
11
- * Layout calculation parameters
12
- */
13
- interface LayoutParams {
14
- workspace: Bounds;
15
- tileIndex: number;
16
- visibleCount: number;
17
- config: TilingConfig;
18
- }
19
- /**
20
- * LayoutCalculator
21
- *
22
- * Generic utility for calculating tile bounds in various layout modes.
23
- * Provides a pluggable system for different tiling strategies.
24
- */
25
- export declare class LayoutCalculator {
26
- /**
27
- * Calculate bounds for a tile at a given index
28
- */
29
- static calculateTileBounds(params: LayoutParams): Bounds;
30
- /**
31
- * Apply padding to bounds
32
- */
33
- private static applyPadding;
34
- /**
35
- * Determine grid dimensions based on tiling mode
36
- */
37
- private static getGridDimensions;
38
- /**
39
- * Calculate bounds for a specific cell in a grid
40
- */
41
- private static calculateGridCell;
42
- /**
43
- * Calculate optimal grid dimensions for a given number of items
44
- * Useful for auto-layout modes
45
- */
46
- static calculateOptimalGrid(itemCount: number): GridDimensions;
47
- }
48
- export {};
49
- //# sourceMappingURL=LayoutCalculator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LayoutCalculator.d.ts","sourceRoot":"","sources":["../../src/view-manager/LayoutCalculator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAc,MAAM,gBAAgB,CAAC;AAE1D;;GAEG;AACH,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,UAAU,YAAY;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,YAAY,CAAC;CACtB;AAED;;;;;GAKG;AACH,qBAAa,gBAAgB;IAC3B;;OAEG;IACH,MAAM,CAAC,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM;IAmBxD;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,YAAY;IAS3B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAwBhC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAqBhC;;;OAGG;IACH,MAAM,CAAC,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc;CAa/D"}
@@ -1,94 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LayoutCalculator = void 0;
4
- /**
5
- * LayoutCalculator
6
- *
7
- * Generic utility for calculating tile bounds in various layout modes.
8
- * Provides a pluggable system for different tiling strategies.
9
- */
10
- class LayoutCalculator {
11
- /**
12
- * Calculate bounds for a tile at a given index
13
- */
14
- static calculateTileBounds(params) {
15
- const { workspace, tileIndex, visibleCount, config } = params;
16
- const { mode, gap = 0, padding = 0, columns = 2, rows = 2 } = config;
17
- // Apply padding to workspace
18
- const available = this.applyPadding(workspace, padding);
19
- // No tiling or no visible items
20
- if (mode === "none" || visibleCount === 0) {
21
- return available;
22
- }
23
- // Calculate grid dimensions based on mode
24
- const grid = this.getGridDimensions(mode, visibleCount, rows, columns);
25
- // Calculate tile bounds in grid
26
- return this.calculateGridCell(available, tileIndex, grid, gap);
27
- }
28
- /**
29
- * Apply padding to bounds
30
- */
31
- static applyPadding(bounds, padding) {
32
- return {
33
- x: bounds.x + padding,
34
- y: bounds.y + padding,
35
- width: bounds.width - padding * 2,
36
- height: bounds.height - padding * 2,
37
- };
38
- }
39
- /**
40
- * Determine grid dimensions based on tiling mode
41
- */
42
- static getGridDimensions(mode, visibleCount, configRows, configColumns) {
43
- switch (mode) {
44
- case "horizontal":
45
- // Horizontal = 1 row × N columns
46
- return { rows: 1, columns: visibleCount };
47
- case "vertical":
48
- // Vertical = N rows × 1 column
49
- return { rows: visibleCount, columns: 1 };
50
- case "grid":
51
- // Use configured dimensions
52
- return { rows: configRows, columns: configColumns };
53
- default:
54
- return { rows: 1, columns: 1 };
55
- }
56
- }
57
- /**
58
- * Calculate bounds for a specific cell in a grid
59
- */
60
- static calculateGridCell(available, index, grid, gap) {
61
- const col = index % grid.columns;
62
- const row = Math.floor(index / grid.columns);
63
- const tileWidth = (available.width - gap * (grid.columns - 1)) / grid.columns;
64
- const tileHeight = (available.height - gap * (grid.rows - 1)) / grid.rows;
65
- return {
66
- x: available.x + col * (tileWidth + gap),
67
- y: available.y + row * (tileHeight + gap),
68
- width: tileWidth,
69
- height: tileHeight,
70
- };
71
- }
72
- /**
73
- * Calculate optimal grid dimensions for a given number of items
74
- * Useful for auto-layout modes
75
- */
76
- static calculateOptimalGrid(itemCount) {
77
- if (itemCount <= 0)
78
- return { rows: 1, columns: 1 };
79
- if (itemCount === 1)
80
- return { rows: 1, columns: 1 };
81
- if (itemCount === 2)
82
- return { rows: 1, columns: 2 };
83
- if (itemCount === 3)
84
- return { rows: 1, columns: 3 };
85
- if (itemCount === 4)
86
- return { rows: 2, columns: 2 };
87
- // For larger counts, try to make it roughly square
88
- const columns = Math.ceil(Math.sqrt(itemCount));
89
- const rows = Math.ceil(itemCount / columns);
90
- return { rows, columns };
91
- }
92
- }
93
- exports.LayoutCalculator = LayoutCalculator;
94
- //# sourceMappingURL=LayoutCalculator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LayoutCalculator.js","sourceRoot":"","sources":["../../src/view-manager/LayoutCalculator.ts"],"names":[],"mappings":";;;AAqBA;;;;;GAKG;AACH,MAAa,gBAAgB;IAC3B;;OAEG;IACH,MAAM,CAAC,mBAAmB,CAAC,MAAoB;QAC7C,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;QAC9D,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,EAAE,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC;QAErE,6BAA6B;QAC7B,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAExD,gCAAgC;QAChC,IAAI,IAAI,KAAK,MAAM,IAAI,YAAY,KAAK,CAAC,EAAE,CAAC;YAC1C,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,0CAA0C;QAC1C,MAAM,IAAI,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAEvE,gCAAgC;QAChC,OAAO,IAAI,CAAC,iBAAiB,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;IACjE,CAAC;IAED;;OAEG;IACK,MAAM,CAAC,YAAY,CAAC,MAAc,EAAE,OAAe;QACzD,OAAO;YACL,C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edenapp/types";
3
- import { ViewInfo, ViewMode } from "./types";
4
- /**
5
- * TilingManager
6
- *
7
- * Handles tiling calculations and view positioning for tiled window mode.
8
- * Extracted from ViewManager for better separation of concerns.
9
- */
10
- export declare class TilingManager {
11
- private config;
12
- private workspaceBounds;
13
- constructor(config?: TilingConfig, workspaceBounds?: Bounds);
14
- /**
15
- * Update the workspace bounds used for tile calculations
16
- */
17
- setWorkspaceBounds(bounds: Bounds): void;
18
- /**
19
- * Get current workspace bounds
20
- */
21
- getWorkspaceBounds(): Bounds;
22
- /**
23
- * Update tiling configuration
24
- */
25
- setConfig(config: TilingConfig): void;
26
- /**
27
- * Get current tiling configuration
28
- */
29
- getConfig(): TilingConfig;
30
- /**
31
- * Check if tiling is enabled
32
- */
33
- isEnabled(): boolean;
34
- /**
35
- * Calculate bounds for a tile based on tiling configuration
36
- * @param tileIndex - Index of the tile to calculate
37
- * @param visibleCount - Total number of visible tiled views
38
- */
39
- calculateTileBounds(tileIndex: number, visibleCount: number): Bounds;
40
- /**
41
- * Get the next available tile index from a collection of views
42
- * @param views - Iterable of view information
43
- */
44
- getNextTileIndex(views: Iterable<ViewInfo>): number;
45
- /**
46
- * Get count of visible tiled views
47
- * @param views - Iterable of view information
48
- */
49
- getVisibleTiledCount(views: Iterable<ViewInfo>): number;
50
- /**
51
- * Recalculate bounds for all tiled views
52
- * Returns updated views with new bounds applied
53
- * @param views - Map of viewId to ViewInfo
54
- */
55
- recalculateTiledViews(views: Map<number, ViewInfo>): void;
56
- /**
57
- * Determine view mode based on manifest window config and tiling state
58
- */
59
- determineViewMode(windowMode?: "floating" | "tiled" | "both"): ViewMode;
60
- }
61
- //# sourceMappingURL=TilingManager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TilingManager.d.ts","sourceRoot":"","sources":["../../src/view-manager/TilingManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAI7C;;;;;GAKG;AACH,qBAEa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,eAAe,CAAS;gBAG9B,MAAM,GAAE,YAAmD,EAC3D,eAAe,GAAE,MAAgD;IAMnE;;OAEG;IACH,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAIxC;;OAEG;IACH,kBAAkB,IAAI,MAAM;IAI5B;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;IAIrC;;OAEG;IACH,SAAS,IAAI,YAAY;IAIzB;;OAEG;IACH,SAAS,IAAI,OAAO;IAIpB;;;;OAIG;IACH,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM;IASpE;;;OAGG;IACH,gBAAgB,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,MAAM;IAWnD;;;OAGG;IACH,oBAAoB,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,MAAM;IAKvD;;;;OAIG;IACH,qBAAqB,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,IAAI;IAsBzD;;OAEG;IACH,iBAAiB,CAAC,UAAU,CAAC,EAAE,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ;CAmBxE"}
@@ -1,142 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.TilingManager = void 0;
13
- const LayoutCalculator_1 = require("./LayoutCalculator");
14
- const tsyringe_1 = require("tsyringe");
15
- /**
16
- * TilingManager
17
- *
18
- * Handles tiling calculations and view positioning for tiled window mode.
19
- * Extracted from ViewManager for better separation of concerns.
20
- */
21
- let TilingManager = class TilingManager {
22
- config;
23
- workspaceBounds;
24
- constructor(config = { mode: "none", gap: 0, padding: 0 }, workspaceBounds = { x: 0, y: 0, width: 800, height: 600 }) {
25
- this.config = config;
26
- this.workspaceBounds = workspaceBounds;
27
- }
28
- /**
29
- * Update the workspace bounds used for tile calculations
30
- */
31
- setWorkspaceBounds(bounds) {
32
- this.workspaceBounds = bounds;
33
- }
34
- /**
35
- * Get current workspace bounds
36
- */
37
- getWorkspaceBounds() {
38
- return this.workspaceBounds;
39
- }
40
- /**
41
- * Update tiling configuration
42
- */
43
- setConfig(config) {
44
- this.config = config;
45
- }
46
- /**
47
- * Get current tiling configuration
48
- */
49
- getConfig() {
50
- return this.config;
51
- }
52
- /**
53
- * Check if tiling is enabled
54
- */
55
- isEnabled() {
56
- return this.config.mode !== "none";
57
- }
58
- /**
59
- * Calculate bounds for a tile based on tiling configuration
60
- * @param tileIndex - Index of the tile to calculate
61
- * @param visibleCount - Total number of visible tiled views
62
- */
63
- calculateTileBounds(tileIndex, visibleCount) {
64
- return LayoutCalculator_1.LayoutCalculator.calculateTileBounds({
65
- workspace: this.workspaceBounds,
66
- tileIndex,
67
- visibleCount,
68
- config: this.config,
69
- });
70
- }
71
- /**
72
- * Get the next available tile index from a collection of views
73
- * @param views - Iterable of view information
74
- */
75
- getNextTileIndex(views) {
76
- const indices = Array.from(views)
77
- .filter((v) => v.visible && v.mode === "tiled" && v.tileIndex !== undefined)
78
- .map((v) => v.tileIndex);
79
- if (indices.length === 0)
80
- return 0;
81
- return Math.max(...indices) + 1;
82
- }
83
- /**
84
- * Get count of visible tiled views
85
- * @param views - Iterable of view information
86
- */
87
- getVisibleTiledCount(views) {
88
- return Array.from(views).filter((v) => v.visible && v.mode === "tiled")
89
- .length;
90
- }
91
- /**
92
- * Recalculate bounds for all tiled views
93
- * Returns updated views with new bounds applied
94
- * @param views - Map of viewId to ViewInfo
95
- */
96
- recalculateTiledViews(views) {
97
- if (!this.isEnabled())
98
- return;
99
- // Get visible tiled views sorted by tile index
100
- const visibleViews = Array.from(views.entries())
101
- .filter(([_, info]) => info.visible && info.mode === "tiled")
102
- .sort((a, b) => (a[1].tileIndex || 0) - (b[1].tileIndex || 0));
103
- const visibleCount = visibleViews.length;
104
- visibleViews.forEach(([viewId, info], index) => {
105
- const bounds = this.calculateTileBounds(index, visibleCount);
106
- info.tileIndex = index;
107
- info.bounds = bounds;
108
- // Only set bounds if view is not destroyed
109
- if (!info.view.webContents.isDestroyed()) {
110
- info.view.setBounds(bounds);
111
- }
112
- });
113
- }
114
- /**
115
- * Determine view mode based on manifest window config and tiling state
116
- */
117
- determineViewMode(windowMode) {
118
- // If no window config mode specified
119
- if (!windowMode) {
120
- return this.isEnabled() ? "tiled" : "floating";
121
- }
122
- // Check what the app supports
123
- switch (windowMode) {
124
- case "floating":
125
- return "floating";
126
- case "tiled":
127
- return "tiled";
128
- case "both":
129
- // If app supports both, prefer tiled if tiling is enabled
130
- return this.isEnabled() ? "tiled" : "floating";
131
- default:
132
- return this.isEnabled() ? "tiled" : "floating";
133
- }
134
- }
135
- };
136
- exports.TilingManager = TilingManager;
137
- exports.TilingManager = TilingManager = __decorate([
138
- (0, tsyringe_1.singleton)(),
139
- (0, tsyringe_1.injectable)(),
140
- __metadata("design:paramtypes", [Object, Object])
141
- ], TilingManager);
142
- //# sourceMappingURL=TilingManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TilingManager.js","sourceRoot":"","sources":["../../src/view-manager/TilingManager.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,yDAAsD;AACtD,uCAAiD;AAEjD;;;;;GAKG;AAGI,IAAM,aAAa,GAAnB,MAAM,aAAa;IAChB,MAAM,CAAe;IACrB,eAAe,CAAS;IAEhC,YACE,SAAuB,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAC3D,kBAA0B,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE;QAEjE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,kBAAkB,CAAC,MAAc;QAC/B,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,kBAAkB;QAChB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,MAAoB;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACH,mBAAmB,CAAC,SAAiB,EAAE,YAAoB;QACzD,OAAO,mCAAgB,CAAC,mBAAmB,CAAC;YAC1C,SAAS,EAAE,IAAI,CAAC,eAAe;YAC/B,SAAS;YACT,YAAY;YACZ,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,gBAAgB,CAAC,KAAyB;QACxC,MAAM,OAAO,GAA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AAO,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE;YAC7C,MAAM,MAAM,GAAG,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;YAC7D,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;YACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YAErB,2CAA2C;YAC3C,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,EAAE,CAAC;gBACzC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,iBAAiB,CAAC,UAA0C;QAC1D,qCAAqC;QACrC,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC;QACjD,CAAC;QAED,8BAA8B;QAC9B,QAAQ,UAAU,EAAE,CAAC;YACnB,KAAK,UAAU;gBACb,OAAO,UAAU,CAAC;YACpB,KAAK,OAAO;gBACV,OAAO,OAAO,CAAC;YACjB,KAAK,MAAM;gBACT,0DAA0D;gBAC1D,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC;YACjD;gBACE,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC;QACnD,CAAC;IACH,CAAC;CACF,CAAA;AAtIY,sCAAa;wBAAb,aAAa;IAFzB,IAAA,oBAAS,GAAE;IACX,IAAA,qBAAU,GAAE;;GACA,aAAa,CAsIzB"}
@@ -1,66 +0,0 @@
1
- import { BrowserWindow, WebContentsView } from "electron";
2
- import { ViewInfo } from "./types";
3
- /**
4
- * ViewGuard
5
- *
6
- * Utility class for validating view state before operations.
7
- * Provides defensive checks to prevent crashes from destroyed views.
8
- */
9
- export declare class ViewGuard {
10
- /**
11
- * Check if a WebContentsView exists and is valid
12
- */
13
- static isValid(view?: WebContentsView): view is WebContentsView;
14
- /**
15
- * Check if a WebContentsView's webContents is still alive (not destroyed)
16
- */
17
- static isAlive(view?: WebContentsView): boolean;
18
- /**
19
- * Check if a BrowserWindow exists and is not destroyed
20
- */
21
- static isWindowAlive(window?: BrowserWindow | null): window is BrowserWindow;
22
- /**
23
- * Get a view from the map with validation
24
- * Throws an error if view is not found or destroyed
25
- */
26
- static requireView(viewId: number, views: Map<number, ViewInfo>): ViewInfo;
27
- /**
28
- * Get a view by app ID from the map, returning the first matching view
29
- * Throws an error if view is not found or destroyed
30
- */
31
- static requireViewByAppId(appId: string, views: Map<number, ViewInfo>): {
32
- viewId: number;
33
- viewInfo: ViewInfo;
34
- };
35
- }
36
- /**
37
- * Options for creating a WebContentsView
38
- */
39
- export interface ViewCreationOptions {
40
- preloadScript: string;
41
- transparent?: boolean;
42
- backgroundThrottling?: boolean;
43
- additionalArguments?: string[];
44
- }
45
- /**
46
- * ViewLifecycle
47
- *
48
- * Handles creation and destruction of WebContentsViews.
49
- * Provides safe lifecycle management with proper cleanup.
50
- */
51
- export declare class ViewLifecycle {
52
- /**
53
- * Create a new WebContentsView with standard options
54
- */
55
- static createView(options: ViewCreationOptions): WebContentsView;
56
- /**
57
- * Safely destroy a view and remove it from the main window
58
- */
59
- static destroyView(viewInfo: ViewInfo, mainWindow: BrowserWindow | null): void;
60
- /**
61
- * Remove all destroyed views from a view map
62
- * Returns the number of views cleaned up
63
- */
64
- static cleanupDestroyedViews(views: Map<number, ViewInfo>): number;
65
- }
66
- //# sourceMappingURL=ViewLifecycle.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ViewLifecycle.d.ts","sourceRoot":"","sources":["../../src/view-manager/ViewLifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,E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