@owdproject/core 3.0.0-alpha.7 → 3.0.0-alpha.8

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 CHANGED
@@ -56,52 +56,48 @@ export default defineDesktopConfig({
56
56
 
57
57
  ## Themes
58
58
  Themes allow you to customize the look and feel of your Open Web Desktop instance.
59
+ You can explore available themes, ranging from popular OS designs to fully custom creations, at [topics/owd-themes](https://github.com/topics/owd-themes).
59
60
 
60
61
  ### Install a new theme
61
- You can install a new theme by defining it as a Nuxt.js layer in `nuxt.config.ts`.
62
+ You can install a new theme by defining it in the `owd.config.ts` configuration.
62
63
  Themes can be loaded from a local path or directly from a GitHub repository.
63
64
 
64
- **1. Using a local theme:**
65
+ #### Using a local theme
65
66
 
66
- Clone it first in a folder of your project like `./desktop/theme/theme-win95`.
67
+ Clone it first in a folder of your project like `./desktop/theme/theme-gnome`.
67
68
 
68
69
  ```bash
69
- git clone git@github.com:owdproject/theme-win95.git ./desktop/theme/theme-win95
70
+ git clone git@github.com:owdproject/theme-gnome.git ./desktop/theme/theme-gnome
70
71
  ```
71
72
 
72
- Then specify the path theme in the `nuxt.config.ts` configuration:
73
+ Then specify the path theme in `owd.config.ts`:
73
74
 
74
75
  ```typescript
75
- // nuxt.config.ts
76
- export default defineNuxtConfig({
77
- modules: [
78
- "@owdproject/core",
79
- ],
80
-
81
- extends: [
82
- "./desktop/theme/theme-win95"
83
- ],
84
-
76
+ // owd.config.ts
77
+ export default defineDesktopConfig({
78
+ theme: './dev/themes/theme-gnome', // define here the theme you just cloned
79
+ apps: [
85
80
  ...
86
81
  ```
87
82
 
88
- **2. Using a theme from GitHub:**
83
+ #### Using a theme package
84
+
85
+ Use npm to install the theme package as a dependency of your Open Web Desktop client:
86
+
87
+ ```bash
88
+ npm install @owdproject/theme-gnome
89
+ ```
89
90
 
90
- To use a theme directly specifying a GitHub repository, use this format: `github:<username>/<repository>`:
91
+ Then specify the path theme in `owd.config.ts`:
91
92
 
92
93
  ```typescript
93
- // nuxt.config.ts
94
- export default defineNuxtConfig({
95
- modules: [
96
- "@owdproject/core",
97
- ],
98
-
99
- extends: [
100
- "github:owdproject/theme-gnome",
101
- { install: true }
102
- ],
103
-
104
- ...
94
+ // owd.config.ts
95
+ import {defineDesktopConfig} from "@owdproject/core/runtime/utils/utilsDesktop"
96
+
97
+ export default defineDesktopConfig({
98
+ theme: '@owdproject/theme-gnome', // define here the theme you just installed
99
+ apps: [
100
+ ...
105
101
  ```
106
102
 
107
103
  ## Contributing
@@ -143,10 +139,10 @@ npm run dev
143
139
  This will launch Open Web Desktop in development mode, allowing you to test your changes and see them reflected in real-time.
144
140
  The dev server will be available at http://localhost:3000.
145
141
 
146
- ## Getting Involved
142
+ ## Sponsoring
147
143
 
148
144
  Open Web Desktop is a vast project. The code has been totally rewritten and is now actively being developed, but your support is what makes it all possible. If you're enjoying it and want to see more, consider donating. Your contribution helps keep the project alive and awesome.
149
145
 
150
- ### License
146
+ ## License
151
147
 
152
148
  Open Web Desktop is released under the [GNU General Public License v3](LICENSE).
package/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import {defineNuxtModule, createResolver, addComponentsDir, addImportsDir, installModule, addPlugin} from '@nuxt/kit'
2
- import {useDesktopManager} from './runtime/composables/useDesktopManager'
2
+ import {deepMerge} from '@owdproject/core/runtime/utils/utilsCommon'
3
3
  import pkg from './package.json'
4
4
 
5
5
  export default defineNuxtModule({
@@ -9,24 +9,43 @@ export default defineNuxtModule({
9
9
  },
10
10
  async setup(options, nuxt) {
11
11
  const {resolve} = createResolver(import.meta.url)
12
- const desktopManager = useDesktopManager()
13
12
 
14
- await import(nuxt.options.rootDir + '/owd.config.ts')
13
+ const desktopConfig = (await import(nuxt.options.rootDir + '/owd.config.ts')).default
15
14
 
16
- // set core version to runtime variables
15
+ // set core version to runtime config
17
16
 
18
17
  nuxt.options.runtimeConfig.public.coreVersion = pkg.version
19
18
 
20
19
  {
21
20
 
21
+ // install open web desktop theme
22
+
23
+ if (desktopConfig.theme) {
24
+ await installModule(desktopConfig.theme)
25
+ }
26
+
27
+ // install open web desktop modules
28
+
29
+ if (desktopConfig.modules) {
30
+ for (const modulePath of desktopConfig.modules) {
31
+ await installModule(modulePath)
32
+ }
33
+ }
34
+
22
35
  // install open web desktop apps
23
36
 
24
- if (desktopManager.config.apps) {
25
- for (const appPath of desktopManager.config.apps) {
37
+ if (desktopConfig.apps) {
38
+ for (const appPath of desktopConfig.apps) {
26
39
  await installModule(appPath)
27
40
  }
28
41
  }
29
42
 
43
+ // assign open web desktop config to runtime config
44
+ nuxt.options.runtimeConfig.public.desktop = deepMerge(
45
+ nuxt.options.runtimeConfig.public.desktop,
46
+ desktopConfig
47
+ )
48
+
30
49
  }
31
50
 
32
51
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owdproject/core",
3
- "version": "3.0.0-alpha.7",
3
+ "version": "3.0.0-alpha.8",
4
4
  "description": "Open Web Desktop core",
5
5
  "keywords": [
6
6
  "web",
@@ -43,5 +43,8 @@
43
43
  "sanitize.css": "^13.0.0",
44
44
  "sass": "^1.86.0",
45
45
  "vue-resizable": "^2.1.7"
46
+ },
47
+ "resolutions": {
48
+ "vite": "^6.3.2"
46
49
  }
47
50
  }
@@ -1,5 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import {onMounted, onUnmounted} from "vue"
3
+ import {useRuntimeConfig} from "nuxt/app"
3
4
  import {computed, toRaw} from "@vue/reactivity"
4
5
  import {useDesktopManager} from "../../../composables/useDesktopManager"
5
6
  import {useApplicationManager} from "../../../composables/useApplicationManager"
@@ -10,16 +11,21 @@ const props = withDefaults(defineProps<{
10
11
  windows?: DesktopWindowsConfig
11
12
  systemBar?: DesktopSystemBarConfig
12
13
  dockBar?: DesktopDockBarConfig
14
+ workspaces?: DesktopWorkspacesConfig
13
15
  }>(), {
14
16
  windows: {
15
17
  position: 'fixed',
16
18
  },
17
19
  systemBar: {},
18
20
  dockBar: {},
21
+ workspaces: {},
19
22
  })
20
23
 
24
+ // todo move to owd initialization
25
+
21
26
  const desktopManager = useDesktopManager()
22
27
  const applicationManager = useApplicationManager()
28
+ const runtimeConfig = useRuntimeConfig()
23
29
 
24
30
  // create firsts workspaces if not available
25
31
  const desktopStore = useDesktopStore()
@@ -33,11 +39,14 @@ if (desktopStore.$persistedState) {
33
39
  desktopWorkspaceStore.setupWorkspaces()
34
40
  }
35
41
 
42
+ desktopManager.setConfig(runtimeConfig.public.desktop)
43
+
36
44
  // override desktop configurations
37
45
  desktopManager.setConfig({
38
46
  windows: toRaw(props.windows),
39
- systemBar: toRaw( props.systemBar),
47
+ systemBar: toRaw(props.systemBar),
40
48
  dockBar: toRaw(props.dockBar),
49
+ workspaces: toRaw(props.workspaces),
41
50
  })
42
51
 
43
52
  // desktop resize
@@ -2,6 +2,7 @@ import {deepMerge} from "../../utils/utilsCommon"
2
2
 
3
3
  export class DesktopManager {
4
4
  public config: DesktopConfig = {} as DesktopConfig
5
+
5
6
  private defaultApps: DefaultAppsConfig = {}
6
7
 
7
8
  constructor() {
@@ -30,7 +31,7 @@ export class DesktopManager {
30
31
 
31
32
  private loadDefaultAppsFromConfig() {
32
33
  if (this.config.defaultApps) {
33
- this.defaultApps = { ...this.config.defaultApps }
34
+ this.defaultApps = {...this.config.defaultApps}
34
35
  }
35
36
  }
36
37
  }
@@ -7,7 +7,5 @@ export function defineDesktopApp(config: ApplicationConfig) {
7
7
  }
8
8
 
9
9
  export function defineDesktopConfig(config: DesktopConfig) {
10
- const desktopManager = useDesktopManager()
11
- desktopManager.setConfig(config)
12
- return true
10
+ return config
13
11
  }
package/types/owd.d.ts CHANGED
@@ -276,13 +276,17 @@ interface IDesktopManager {
276
276
  }
277
277
 
278
278
  interface DesktopConfig {
279
- name?: string
280
- compatibility?: string
279
+ theme?: string
280
+ modules?: string[]
281
281
  apps?: string[]
282
+
283
+ name?: string
282
284
  defaultApps?: DefaultAppsConfig
283
285
  features?: string[]
286
+
284
287
  systemBar?: DesktopSystemBarConfig
285
288
  dockBar?: DesktopDockBarConfig
289
+ workspaces?: DesktopWorkspacesConfig
286
290
  }
287
291
 
288
292
  interface DesktopWindowsConfig {
@@ -300,6 +304,10 @@ interface DesktopSystemBarConfig {
300
304
  startButton?: boolean
301
305
  }
302
306
 
307
+ interface DesktopWorkspacesConfig {
308
+ enabled?: boolean
309
+ }
310
+
303
311
  // TERMINAL
304
312
 
305
313
  type TerminalCommand = {
package/types/index.d.ts DELETED
@@ -1,9 +0,0 @@
1
- declare module 'nuxt/schema' {
2
- interface AppConfig {
3
- owd: {
4
- apps: string[]
5
- }
6
- }
7
- }
8
-
9
- export {}