@owdproject/core 3.1.1 → 3.1.3
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/README.md +23 -57
- package/bin/owd.js +28 -0
- package/package.json +4 -1
- package/runtime/core/controllers/WindowController.ts +63 -34
- package/.editorconfig +0 -12
package/README.md
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
## Overview
|
|
10
10
|
|
|
11
|
-
Open Web Desktop (OWD) is a framework designed to provide a simple environment for building web-based desktop experiences. It's built with
|
|
11
|
+
Open Web Desktop (OWD) is a framework designed to provide a simple environment for building web-based desktop experiences. It's built with TypeScript on top of the Nuxt.js framework.
|
|
12
12
|
|
|
13
|
-
[Demo](https://atproto-os.pages.dev/) · [Documentation](https://owdproject.org/)
|
|
13
|
+
[Demo](https://atproto-os.pages.dev/) · [Community](https://discord.gg/zPNaN2HAaA) · [Documentation](https://owdproject.org/)
|
|
14
14
|
|
|
15
15
|
## Features
|
|
16
16
|
|
|
@@ -44,80 +44,46 @@ pnpm run generate
|
|
|
44
44
|
|
|
45
45
|
## Extend your desktop
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
Thanks to Tailwind and PrimeVue, you can create custom themes from scratch and ensure a consistent look across all apps. Each theme defines its own style, making your desktop both cohesive and uniquely yours.
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
[Applications](https://github.com/topics/owd-apps) · [Modules](https://github.com/topics/owd-modules) · [Themes](https://github.com/topics/owd-themes)
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
### 🧩 Install an application
|
|
52
|
+
|
|
53
|
+
You can discover new apps by searching for the [owd-apps](https://github.com/topics/owd-apps) tag on GitHub.
|
|
54
|
+
|
|
55
|
+
For example, to install the To-do app:
|
|
52
56
|
|
|
53
57
|
```bash
|
|
54
|
-
|
|
58
|
+
owd install-app @owdproject/app-todo
|
|
55
59
|
```
|
|
56
60
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
// desktop/owd.config.ts
|
|
61
|
-
export default defineDesktopConfig({
|
|
62
|
-
theme: "@owdproject/theme-win95",
|
|
63
|
-
apps: [
|
|
64
|
-
"@owdproject/app-about",
|
|
65
|
-
"@owdproject/app-todo", // define here the app you just installed
|
|
66
|
-
],
|
|
67
|
-
modules: []
|
|
68
|
-
})
|
|
69
|
-
```
|
|
61
|
+
This will install the package and automatically register it in your desktop configuration.
|
|
62
|
+
|
|
63
|
+
### 🧩 Install a module
|
|
70
64
|
|
|
71
|
-
|
|
65
|
+
You can discover new modules by searching for the [owd-modules](https://github.com/topics/owd-modules) tag on GitHub.
|
|
72
66
|
|
|
73
|
-
|
|
67
|
+
For example, to install the session persistence module:
|
|
74
68
|
|
|
75
69
|
```bash
|
|
76
|
-
|
|
70
|
+
owd install-module @owdproject/module-pinia-localforage
|
|
77
71
|
```
|
|
78
72
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
```typescript
|
|
82
|
-
// desktop/owd.config.ts
|
|
83
|
-
export default defineDesktopConfig({
|
|
84
|
-
theme: "@owdproject/theme-win95",
|
|
85
|
-
apps: [
|
|
86
|
-
"@owdproject/app-about",
|
|
87
|
-
"@owdproject/app-todo",
|
|
88
|
-
],
|
|
89
|
-
modules: [
|
|
90
|
-
"@owdproject/module-pinia-localforage", // define here the module you just installed
|
|
91
|
-
]
|
|
92
|
-
})
|
|
93
|
-
```
|
|
73
|
+
### 🖥️ Themes
|
|
94
74
|
|
|
95
|
-
|
|
96
|
-
|
|
75
|
+
Themes are full desktop environments that style all UI components independently using [PrimeVue](https://primevue.org/).
|
|
76
|
+
Each theme provides a unique look and feel while maintaining consistent functionality across all applications.
|
|
97
77
|
|
|
98
|
-
|
|
99
|
-
pnpm install @owdproject/theme-gnome
|
|
100
|
-
```
|
|
78
|
+
You can discover new themes by searching for the [owd-themes](https://github.com/topics/owd-themes) tag on GitHub.
|
|
101
79
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
```typescript
|
|
105
|
-
// desktop/owd.config.ts
|
|
106
|
-
export default defineDesktopConfig({
|
|
107
|
-
theme: "@owdproject/theme-gnome", // define here the theme you just installed
|
|
108
|
-
apps: [
|
|
109
|
-
"@owdproject/app-about",
|
|
110
|
-
"@owdproject/app-todo",
|
|
111
|
-
],
|
|
112
|
-
modules: [
|
|
113
|
-
"@owdproject/module-pinia-localforage"
|
|
114
|
-
]
|
|
115
|
-
})
|
|
80
|
+
```bash
|
|
81
|
+
owd install-theme @owdproject/theme-gnome
|
|
116
82
|
```
|
|
117
83
|
|
|
118
84
|
## Sponsors
|
|
119
85
|
|
|
120
|
-
|
|
86
|
+
Be the first to support this project and help us keep it growing! [Sponsor the project](https://github.com/sponsors/owdproject)
|
|
121
87
|
|
|
122
88
|
## License
|
|
123
89
|
|
package/bin/owd.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawn } from 'child_process';
|
|
4
|
+
|
|
5
|
+
const [, , cmd, pkgName, ...rest] = process.argv;
|
|
6
|
+
|
|
7
|
+
const commandMap = {
|
|
8
|
+
"install-app": "desktop:install-app",
|
|
9
|
+
"install-module": "desktop:install-module",
|
|
10
|
+
"install-theme": "desktop:install-theme",
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
if (!commandMap[cmd]) {
|
|
14
|
+
console.error(`Unknown command: ${cmd}`);
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (!pkgName) {
|
|
19
|
+
console.error("Missing package name (e.g., @owdproject/package)");
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const nxArgs = ["run", commandMap[cmd], `--name=${pkgName}`, ...rest];
|
|
24
|
+
|
|
25
|
+
const child = spawn("pnpm", ["nx", ...nxArgs], {
|
|
26
|
+
stdio: "inherit",
|
|
27
|
+
shell: true,
|
|
28
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owdproject/core",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.3",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"web",
|
|
6
6
|
"desktop",
|
|
@@ -24,6 +24,9 @@
|
|
|
24
24
|
},
|
|
25
25
|
"type": "module",
|
|
26
26
|
"types": "types/index.d.ts",
|
|
27
|
+
"bin": {
|
|
28
|
+
"owd": "./bin/owd.js"
|
|
29
|
+
},
|
|
27
30
|
"dependencies": {
|
|
28
31
|
"@nuxt/kit": "^3.17.2",
|
|
29
32
|
"@nuxt/fonts": "^0.11.3",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {useApplicationManager} from '../../composables/useApplicationManager'
|
|
2
|
-
import {useDesktopWindowStore} from '../../stores/storeDesktopWindow'
|
|
3
|
-
import {deepClone} from '../../utils/utilCommon'
|
|
4
|
-
import {markRaw} from '@vue/reactivity'
|
|
5
|
-
import {defineAsyncComponent} from
|
|
1
|
+
import { useApplicationManager } from '../../composables/useApplicationManager'
|
|
2
|
+
import { useDesktopWindowStore } from '../../stores/storeDesktopWindow'
|
|
3
|
+
import { deepClone } from '../../utils/utilCommon'
|
|
4
|
+
import { markRaw } from '@vue/reactivity'
|
|
5
|
+
import { defineAsyncComponent } from 'vue'
|
|
6
6
|
|
|
7
7
|
export class WindowController implements IWindowController {
|
|
8
8
|
public readonly application: IApplicationController
|
|
@@ -70,7 +70,7 @@ export class WindowController implements IWindowController {
|
|
|
70
70
|
// component
|
|
71
71
|
if (config.component) {
|
|
72
72
|
this.config.component = markRaw(
|
|
73
|
-
defineAsyncComponent(config.component)
|
|
73
|
+
defineAsyncComponent(config.component),
|
|
74
74
|
)
|
|
75
75
|
}
|
|
76
76
|
|
|
@@ -87,10 +87,14 @@ export class WindowController implements IWindowController {
|
|
|
87
87
|
// sizes
|
|
88
88
|
if (config.size?.width) this.config.size.width = config.size.width
|
|
89
89
|
if (config.size?.height) this.config.size.height = config.size.height
|
|
90
|
-
if (config.size?.minWidth)
|
|
91
|
-
|
|
92
|
-
if (config.size?.
|
|
93
|
-
|
|
90
|
+
if (config.size?.minWidth)
|
|
91
|
+
this.config.size.minWidth = config.size.minWidth
|
|
92
|
+
if (config.size?.minHeight)
|
|
93
|
+
this.config.size.minHeight = config.size.minHeight
|
|
94
|
+
if (config.size?.maxWidth)
|
|
95
|
+
this.config.size.maxWidth = config.size.maxWidth
|
|
96
|
+
if (config.size?.maxHeight)
|
|
97
|
+
this.config.size.maxHeight = config.size.maxHeight
|
|
94
98
|
|
|
95
99
|
// minimize
|
|
96
100
|
if (typeof config.minimizable !== 'undefined') {
|
|
@@ -137,7 +141,7 @@ export class WindowController implements IWindowController {
|
|
|
137
141
|
|
|
138
142
|
this.config.overridable = {
|
|
139
143
|
...DEFAULT_OVERRIDABLE,
|
|
140
|
-
...(config.overridable || {})
|
|
144
|
+
...(config.overridable || {}),
|
|
141
145
|
}
|
|
142
146
|
}
|
|
143
147
|
|
|
@@ -173,24 +177,24 @@ export class WindowController implements IWindowController {
|
|
|
173
177
|
|
|
174
178
|
// position
|
|
175
179
|
|
|
176
|
-
|
|
180
|
+
public setPosition(data: { x: number; y: number }) {
|
|
177
181
|
if (!this.state.position) {
|
|
178
|
-
this.state.position = { x: 0, y: 0}
|
|
182
|
+
this.state.position = { x: 0, y: 0 }
|
|
179
183
|
}
|
|
180
184
|
|
|
181
185
|
this.state.position.x = data.x
|
|
182
186
|
this.state.position.y = data.y
|
|
183
187
|
}
|
|
184
188
|
|
|
185
|
-
|
|
189
|
+
public setActive(value: boolean) {
|
|
186
190
|
this.state.active = value
|
|
187
191
|
}
|
|
188
192
|
|
|
189
|
-
|
|
193
|
+
public setFocus(value: boolean) {
|
|
190
194
|
this.state.focused = value
|
|
191
195
|
}
|
|
192
196
|
|
|
193
|
-
|
|
197
|
+
public focus() {
|
|
194
198
|
const applicationManager = useApplicationManager()
|
|
195
199
|
const desktopWindowStore = useDesktopWindowStore()
|
|
196
200
|
|
|
@@ -256,16 +260,34 @@ export class WindowController implements IWindowController {
|
|
|
256
260
|
const configSize = this.config.size || {}
|
|
257
261
|
|
|
258
262
|
return {
|
|
259
|
-
width:
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
263
|
+
width:
|
|
264
|
+
typeof stateSize.width !== 'undefined'
|
|
265
|
+
? stateSize.width
|
|
266
|
+
: configSize.width,
|
|
267
|
+
height:
|
|
268
|
+
typeof stateSize.height !== 'undefined'
|
|
269
|
+
? stateSize.height
|
|
270
|
+
: configSize.height,
|
|
271
|
+
minWidth:
|
|
272
|
+
typeof stateSize.minWidth !== 'undefined'
|
|
273
|
+
? stateSize.minWidth
|
|
274
|
+
: configSize.minWidth,
|
|
275
|
+
maxWidth:
|
|
276
|
+
typeof stateSize.maxWidth !== 'undefined'
|
|
277
|
+
? stateSize.maxWidth
|
|
278
|
+
: configSize.maxWidth,
|
|
279
|
+
minHeight:
|
|
280
|
+
typeof stateSize.minHeight !== 'undefined'
|
|
281
|
+
? stateSize.minHeight
|
|
282
|
+
: configSize.minHeight,
|
|
283
|
+
maxHeight:
|
|
284
|
+
typeof stateSize.maxHeight !== 'undefined'
|
|
285
|
+
? stateSize.maxHeight
|
|
286
|
+
: (configSize.maxHeight ?? 600),
|
|
265
287
|
}
|
|
266
288
|
}
|
|
267
289
|
|
|
268
|
-
|
|
290
|
+
public setSize(data: { width: number; height: number }) {
|
|
269
291
|
if (!this.state.size) {
|
|
270
292
|
this.state.size = { width: undefined, height: undefined }
|
|
271
293
|
}
|
|
@@ -284,7 +306,7 @@ export class WindowController implements IWindowController {
|
|
|
284
306
|
return !!this.config.minimizable
|
|
285
307
|
}
|
|
286
308
|
|
|
287
|
-
|
|
309
|
+
public minimize() {
|
|
288
310
|
if (!this.isMinimizable) {
|
|
289
311
|
return false
|
|
290
312
|
}
|
|
@@ -293,9 +315,14 @@ export class WindowController implements IWindowController {
|
|
|
293
315
|
return true
|
|
294
316
|
}
|
|
295
317
|
|
|
296
|
-
|
|
318
|
+
public unminimize() {
|
|
319
|
+
this.state.active = true
|
|
320
|
+
return true
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
public toggleMinimize() {
|
|
297
324
|
this.state.active = !this.state.active
|
|
298
|
-
this.
|
|
325
|
+
this.focus()
|
|
299
326
|
}
|
|
300
327
|
|
|
301
328
|
// maximize
|
|
@@ -316,7 +343,7 @@ export class WindowController implements IWindowController {
|
|
|
316
343
|
return !!this.config.maximized
|
|
317
344
|
}
|
|
318
345
|
|
|
319
|
-
|
|
346
|
+
public toggleMaximize() {
|
|
320
347
|
if (!this.isMaximizable) {
|
|
321
348
|
return false
|
|
322
349
|
}
|
|
@@ -325,7 +352,7 @@ export class WindowController implements IWindowController {
|
|
|
325
352
|
return true
|
|
326
353
|
}
|
|
327
354
|
|
|
328
|
-
|
|
355
|
+
public maximize() {
|
|
329
356
|
if (!this.isMaximizable) {
|
|
330
357
|
return false
|
|
331
358
|
}
|
|
@@ -334,7 +361,7 @@ export class WindowController implements IWindowController {
|
|
|
334
361
|
return true
|
|
335
362
|
}
|
|
336
363
|
|
|
337
|
-
|
|
364
|
+
public unmaximize() {
|
|
338
365
|
if (!this.isMaximizable) {
|
|
339
366
|
return false
|
|
340
367
|
}
|
|
@@ -353,7 +380,7 @@ export class WindowController implements IWindowController {
|
|
|
353
380
|
return !!this.config.destroyable
|
|
354
381
|
}
|
|
355
382
|
|
|
356
|
-
|
|
383
|
+
public destroy() {
|
|
357
384
|
if (!this.isDestroyable) {
|
|
358
385
|
return false
|
|
359
386
|
}
|
|
@@ -382,26 +409,28 @@ export class WindowController implements IWindowController {
|
|
|
382
409
|
}
|
|
383
410
|
|
|
384
411
|
// workspace
|
|
385
|
-
|
|
412
|
+
public setWorkspace(workspaceId: string) {
|
|
386
413
|
this.state.workspace = workspaceId
|
|
387
414
|
}
|
|
388
415
|
|
|
389
416
|
// override
|
|
390
417
|
|
|
391
|
-
setTitleOverride(value: undefined|string) {
|
|
418
|
+
public setTitleOverride(value: undefined | string) {
|
|
392
419
|
this.override.title = value
|
|
393
420
|
}
|
|
394
421
|
|
|
395
|
-
resetTitleOverride() {
|
|
422
|
+
public resetTitleOverride() {
|
|
396
423
|
this.override.title = undefined
|
|
397
424
|
}
|
|
398
425
|
|
|
426
|
+
// deprecated ?
|
|
399
427
|
get actions() {
|
|
400
428
|
return {
|
|
401
429
|
// position
|
|
402
430
|
setActive: this.setActive.bind(this),
|
|
403
431
|
setFocus: this.setFocus.bind(this),
|
|
404
|
-
bringToFront: this.
|
|
432
|
+
bringToFront: this.focus.bind(this),
|
|
433
|
+
focus: this.focus.bind(this),
|
|
405
434
|
setPosition: this.setPosition.bind(this),
|
|
406
435
|
|
|
407
436
|
// size
|