@owdproject/core 3.0.0-alpha.9 → 3.1.0
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/.editorconfig +12 -0
- package/README.md +20 -1
- package/eslint.config.mjs +30 -0
- package/module.ts +176 -0
- package/package.json +21 -19
- package/runtime/components/Core/Desktop/CoreDesktop.vue +1 -1
- package/runtime/core/controllers/WindowController.ts +4 -4
- package/runtime/core/managers/DesktopManager.ts +2 -2
- package/runtime/stores/storeApplicationWindows.ts +1 -1
- package/runtime/stores/storeDesktop.ts +3 -3
- package/runtime/stores/storeDesktopVolume.ts +3 -3
- package/runtime/stores/storeDesktopWindow.ts +3 -3
- package/runtime/stores/storeDesktopWorkspace.ts +3 -3
- package/runtime/utils/utilApp.ts +5 -6
- package/runtime/utils/utilCommon.ts +2 -2
- package/test/basic.test.ts +15 -0
- package/test/fixtures/basic/app.vue +6 -0
- package/test/fixtures/basic/nuxt.config.ts +7 -0
- package/test/fixtures/basic/package.json +5 -0
- package/tsconfig.app.json +31 -0
- package/tsconfig.json +11 -2
- package/tsconfig.spec.json +37 -0
- package/types/{owd.d.ts → index.d.ts} +11 -1
- package/vitest.config.ts +24 -0
- package/index.ts +0 -192
package/.editorconfig
ADDED
package/README.md
CHANGED
|
@@ -6,6 +6,11 @@
|
|
|
6
6
|
A framework for building web-based desktop experiences.
|
|
7
7
|
</h3>
|
|
8
8
|
|
|
9
|
+
[![npm version][npm-version-src]][npm-version-href]
|
|
10
|
+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
11
|
+
[![License][license-src]][license-href]
|
|
12
|
+
[![Nuxt][nuxt-src]][nuxt-href]
|
|
13
|
+
|
|
9
14
|
## Overview
|
|
10
15
|
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.
|
|
11
16
|
|
|
@@ -145,4 +150,18 @@ Open Web Desktop is a vast project. The code has been totally rewritten and is n
|
|
|
145
150
|
|
|
146
151
|
## License
|
|
147
152
|
|
|
148
|
-
Open Web Desktop is released under the [GNU General Public License v3](LICENSE).
|
|
153
|
+
Open Web Desktop is released under the [GNU General Public License v3](LICENSE).
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
<!-- Badges -->
|
|
157
|
+
[npm-version-src]: https://img.shields.io/npm/v/my-module/latest.svg?style=flat&colorA=020420&colorB=00DC82
|
|
158
|
+
[npm-version-href]: https://npmjs.com/package/my-module
|
|
159
|
+
|
|
160
|
+
[npm-downloads-src]: https://img.shields.io/npm/dm/my-module.svg?style=flat&colorA=020420&colorB=00DC82
|
|
161
|
+
[npm-downloads-href]: https://npm.chart.dev/my-module
|
|
162
|
+
|
|
163
|
+
[license-src]: https://img.shields.io/npm/l/my-module.svg?style=flat&colorA=020420&colorB=00DC82
|
|
164
|
+
[license-href]: https://npmjs.com/package/my-module
|
|
165
|
+
|
|
166
|
+
[nuxt-src]: https://img.shields.io/badge/Nuxt-020420?logo=nuxt.js
|
|
167
|
+
[nuxt-href]: https://nuxt.com
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { FlatCompat } from '@eslint/eslintrc';
|
|
2
|
+
import { dirname } from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import js from '@eslint/js';
|
|
5
|
+
import baseConfig from '../../eslint.config.mjs';
|
|
6
|
+
const compat = new FlatCompat({
|
|
7
|
+
baseDirectory: dirname(fileURLToPath(import.meta.url)),
|
|
8
|
+
recommendedConfig: js.configs.recommended,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export default [
|
|
12
|
+
...baseConfig,
|
|
13
|
+
{
|
|
14
|
+
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx', '**/*.vue'],
|
|
15
|
+
// Override or add rules here
|
|
16
|
+
rules: {},
|
|
17
|
+
},
|
|
18
|
+
//...compat.extends('@nuxt/eslint-config'),
|
|
19
|
+
{
|
|
20
|
+
files: ['**/*.vue'],
|
|
21
|
+
languageOptions: {
|
|
22
|
+
parserOptions: {
|
|
23
|
+
parser: await import('@typescript-eslint/parser'),
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
ignores: ['.nuxt/**', '.output/**', 'node_modules'],
|
|
29
|
+
},
|
|
30
|
+
];
|
package/module.ts
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import {defineNuxtModule, createResolver, addComponentsDir, addImportsDir, installModule, addPlugin} from '@nuxt/kit'
|
|
2
|
+
import {deepMerge} from './runtime/utils/utilCommon'
|
|
3
|
+
import pkg from './package.json'
|
|
4
|
+
|
|
5
|
+
export default defineNuxtModule({
|
|
6
|
+
meta: {
|
|
7
|
+
name: 'owd-core',
|
|
8
|
+
},
|
|
9
|
+
async setup(_options, _nuxt) {
|
|
10
|
+
const {resolve} = createResolver(import.meta.url)
|
|
11
|
+
|
|
12
|
+
// set core version to runtime config
|
|
13
|
+
|
|
14
|
+
const desktopConfig = (await import(_nuxt.options.rootDir + '/owd.config.ts')).default
|
|
15
|
+
|
|
16
|
+
// set core version to runtime config
|
|
17
|
+
|
|
18
|
+
_nuxt.options.runtimeConfig.public.coreVersion = pkg.version
|
|
19
|
+
|
|
20
|
+
{
|
|
21
|
+
|
|
22
|
+
// install open web desktop theme
|
|
23
|
+
|
|
24
|
+
if (desktopConfig.theme) {
|
|
25
|
+
await installModule(desktopConfig.theme)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// install open web desktop modules
|
|
29
|
+
|
|
30
|
+
if (desktopConfig.modules) {
|
|
31
|
+
for (const modulePath of desktopConfig.modules) {
|
|
32
|
+
await installModule(modulePath)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// install open web desktop apps
|
|
37
|
+
|
|
38
|
+
if (desktopConfig.apps) {
|
|
39
|
+
for (const appPath of desktopConfig.apps) {
|
|
40
|
+
await installModule(appPath)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// assign open web desktop config to runtime config
|
|
45
|
+
_nuxt.options.runtimeConfig.public.desktop = deepMerge(
|
|
46
|
+
_nuxt.options.runtimeConfig.public.desktop,
|
|
47
|
+
desktopConfig
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
{
|
|
53
|
+
|
|
54
|
+
// install primevue
|
|
55
|
+
|
|
56
|
+
_nuxt.options.primevue = _nuxt.options.primevue || {};
|
|
57
|
+
_nuxt.options.primevue.options = _nuxt.options.primevue.options || {};
|
|
58
|
+
_nuxt.options.primevue.options.theme = _nuxt.options.primevue.options.theme || {};
|
|
59
|
+
|
|
60
|
+
await installModule("@primevue/nuxt-module")
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
{
|
|
65
|
+
|
|
66
|
+
// install tailwind
|
|
67
|
+
|
|
68
|
+
const tailwindPaths = _nuxt.options.runtimeConfig.app.owd?.tailwindPaths || []
|
|
69
|
+
tailwindPaths.push('./runtime/components/**/*.{vue,mjs,ts}') // Aggiungi sempre questo al core
|
|
70
|
+
|
|
71
|
+
_nuxt.options.tailwindcss = _nuxt.options.tailwindcss || {}
|
|
72
|
+
_nuxt.options.tailwindcss.config = _nuxt.options.tailwindcss.config || {}
|
|
73
|
+
// @ts-ignore
|
|
74
|
+
_nuxt.options.tailwindcss.config.content = tailwindPaths
|
|
75
|
+
|
|
76
|
+
await installModule('@nuxtjs/tailwindcss', {
|
|
77
|
+
viewer: false,
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
{
|
|
83
|
+
|
|
84
|
+
// install pinia
|
|
85
|
+
|
|
86
|
+
await installModule("@pinia/nuxt")
|
|
87
|
+
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
{
|
|
91
|
+
|
|
92
|
+
// install @nuxt/fonts
|
|
93
|
+
|
|
94
|
+
await installModule("@nuxt/fonts")
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
{
|
|
99
|
+
|
|
100
|
+
// install @nuxt/icon
|
|
101
|
+
|
|
102
|
+
await installModule("@nuxt/icon", {
|
|
103
|
+
clientBundle: {
|
|
104
|
+
scan: true,
|
|
105
|
+
sizeLimitKb: 256,
|
|
106
|
+
},
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
{
|
|
112
|
+
|
|
113
|
+
// install @vueuse/nuxt
|
|
114
|
+
|
|
115
|
+
await installModule("@vueuse/nuxt")
|
|
116
|
+
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
{
|
|
120
|
+
|
|
121
|
+
// install @nuxtjs/i18n
|
|
122
|
+
|
|
123
|
+
await installModule("@nuxtjs/i18n")
|
|
124
|
+
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
{
|
|
128
|
+
|
|
129
|
+
// configure scss for vite
|
|
130
|
+
|
|
131
|
+
_nuxt.hook('vite:extendConfig', (viteConfig) => {
|
|
132
|
+
viteConfig.css = viteConfig.css || {}
|
|
133
|
+
viteConfig.css.preprocessorOptions = viteConfig.css.preprocessorOptions || {}
|
|
134
|
+
viteConfig.css.preprocessorOptions.scss = {
|
|
135
|
+
api: 'modern-compiler',
|
|
136
|
+
}
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
{
|
|
142
|
+
|
|
143
|
+
// add css
|
|
144
|
+
|
|
145
|
+
_nuxt.options.css.push('sanitize.css')
|
|
146
|
+
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
{
|
|
150
|
+
|
|
151
|
+
// add components
|
|
152
|
+
|
|
153
|
+
addComponentsDir({
|
|
154
|
+
path: resolve("./runtime/components"),
|
|
155
|
+
prefix: "",
|
|
156
|
+
global: true,
|
|
157
|
+
})
|
|
158
|
+
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
{
|
|
162
|
+
|
|
163
|
+
// install plugins
|
|
164
|
+
|
|
165
|
+
addPlugin(resolve('./runtime/plugins/resize.client.ts'))
|
|
166
|
+
|
|
167
|
+
// add other files
|
|
168
|
+
|
|
169
|
+
addImportsDir(resolve('./runtime/composables'))
|
|
170
|
+
addImportsDir(resolve('./runtime/core'))
|
|
171
|
+
addImportsDir(resolve('./runtime/stores'))
|
|
172
|
+
addImportsDir(resolve('./runtime/utils'))
|
|
173
|
+
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
})
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owdproject/core",
|
|
3
|
-
"version": "3.
|
|
4
|
-
"description": "Open Web Desktop core",
|
|
3
|
+
"version": "3.1.0",
|
|
5
4
|
"keywords": [
|
|
6
5
|
"web",
|
|
7
6
|
"desktop",
|
|
@@ -20,28 +19,31 @@
|
|
|
20
19
|
},
|
|
21
20
|
"license": "GPL-3.0-or-later",
|
|
22
21
|
"author": {
|
|
23
|
-
"name": "
|
|
24
|
-
"url": "https://github.com/
|
|
22
|
+
"name": "Open Web Desktop Team",
|
|
23
|
+
"url": "https://github.com/owdproject"
|
|
25
24
|
},
|
|
25
|
+
"type": "module",
|
|
26
|
+
"types": "types/index.d.ts",
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"@nuxt/
|
|
28
|
-
"@nuxt/
|
|
29
|
-
"@
|
|
30
|
-
"@nuxtjs/
|
|
31
|
-
"@
|
|
32
|
-
"@
|
|
33
|
-
"@
|
|
34
|
-
"@primevue/
|
|
35
|
-
"@
|
|
36
|
-
"@vueuse/
|
|
37
|
-
"@vueuse/
|
|
38
|
-
"
|
|
28
|
+
"@nuxt/kit": "^3.17.2",
|
|
29
|
+
"@nuxt/fonts": "^0.11.3",
|
|
30
|
+
"@nuxt/icon": "^1.12.0",
|
|
31
|
+
"@nuxtjs/i18n": "^9.5.4",
|
|
32
|
+
"@nuxtjs/tailwindcss": "^6.14.0",
|
|
33
|
+
"@pinia/nuxt": "^0.11.0",
|
|
34
|
+
"@primeuix/themes": "^1.1.1",
|
|
35
|
+
"@primevue/forms": "^4.3.4",
|
|
36
|
+
"@primevue/nuxt-module": "^4.3.4",
|
|
37
|
+
"@vueuse/components": "^13.1.0",
|
|
38
|
+
"@vueuse/core": "^13.1.0",
|
|
39
|
+
"@vueuse/nuxt": "^13.1.0",
|
|
40
|
+
"memfs": "^4.17.1",
|
|
39
41
|
"mitt": "^3.0.1",
|
|
40
42
|
"nanoid": "^5.1.5",
|
|
41
|
-
"nuxt": "^3.
|
|
42
|
-
"pinia": "^3.0.
|
|
43
|
+
"nuxt": "^3.17.2",
|
|
44
|
+
"pinia": "^3.0.2",
|
|
43
45
|
"sanitize.css": "^13.0.0",
|
|
44
|
-
"sass": "^1.
|
|
46
|
+
"sass": "^1.88.0",
|
|
45
47
|
"vue-resizable": "^2.1.7"
|
|
46
48
|
},
|
|
47
49
|
"resolutions": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {useApplicationManager} from '
|
|
2
|
-
import {useDesktopWindowStore} from '
|
|
3
|
-
import {deepClone} from '
|
|
1
|
+
import {useApplicationManager} from '../../composables/useApplicationManager'
|
|
2
|
+
import {useDesktopWindowStore} from '../../stores/storeDesktopWindow'
|
|
3
|
+
import {deepClone} from '../../utils/utilCommon'
|
|
4
4
|
import {markRaw} from '@vue/reactivity'
|
|
5
5
|
import {defineAsyncComponent} from "vue"
|
|
6
6
|
|
|
@@ -422,4 +422,4 @@ export class WindowController implements IWindowController {
|
|
|
422
422
|
resetTitleOverride: this.resetTitleOverride.bind(this),
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
|
-
}
|
|
425
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {deepMerge} from "
|
|
1
|
+
import {deepMerge} from "../../utils/utilCommon"
|
|
2
2
|
|
|
3
3
|
export class DesktopManager {
|
|
4
4
|
public config: DesktopConfig = {} as DesktopConfig
|
|
@@ -34,4 +34,4 @@ export class DesktopManager {
|
|
|
34
34
|
this.defaultApps = {...this.config.defaultApps}
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
}
|
|
37
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {defineStore} from "pinia"
|
|
2
|
-
import {ref} from "
|
|
2
|
+
import {ref} from "vue"
|
|
3
3
|
|
|
4
4
|
export const useDesktopStore = defineStore('owd/desktop', () => {
|
|
5
5
|
const state = ref<{
|
|
@@ -24,7 +24,7 @@ export const useDesktopStore = defineStore('owd/desktop', () => {
|
|
|
24
24
|
master: 100,
|
|
25
25
|
},
|
|
26
26
|
window: {
|
|
27
|
-
positionZ:
|
|
27
|
+
positionZ: 0
|
|
28
28
|
}
|
|
29
29
|
})
|
|
30
30
|
|
|
@@ -36,4 +36,4 @@ export const useDesktopStore = defineStore('owd/desktop', () => {
|
|
|
36
36
|
persistedState: {
|
|
37
37
|
persist: true
|
|
38
38
|
},
|
|
39
|
-
})
|
|
39
|
+
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {defineStore} from "pinia"
|
|
2
|
-
import {computed} from "
|
|
3
|
-
import {useDesktopStore} from "
|
|
2
|
+
import {computed} from "vue"
|
|
3
|
+
import {useDesktopStore} from "./storeDesktop"
|
|
4
4
|
|
|
5
5
|
export const useDesktopVolumeStore = defineStore('owd/desktop/volume', () => {
|
|
6
6
|
const desktopStore = useDesktopStore()
|
|
@@ -15,4 +15,4 @@ export const useDesktopVolumeStore = defineStore('owd/desktop/volume', () => {
|
|
|
15
15
|
master,
|
|
16
16
|
setMasterVolume
|
|
17
17
|
}
|
|
18
|
-
})
|
|
18
|
+
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {defineStore} from "pinia"
|
|
2
|
-
import {computed} from "
|
|
3
|
-
import {useDesktopStore} from "
|
|
2
|
+
import {computed} from "vue"
|
|
3
|
+
import {useDesktopStore} from "./storeDesktop"
|
|
4
4
|
|
|
5
5
|
export const useDesktopWindowStore = defineStore('owd/desktop/window', () => {
|
|
6
6
|
const desktopStore = useDesktopStore()
|
|
@@ -17,4 +17,4 @@ export const useDesktopWindowStore = defineStore('owd/desktop/window', () => {
|
|
|
17
17
|
positionZ,
|
|
18
18
|
incrementPositionZ
|
|
19
19
|
}
|
|
20
|
-
})
|
|
20
|
+
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {defineStore} from "pinia"
|
|
2
|
-
import {computed} from "
|
|
2
|
+
import {computed} from "vue"
|
|
3
|
+
import {useDesktopStore} from "./storeDesktop"
|
|
3
4
|
import {nanoid} from "nanoid";
|
|
4
|
-
import {useDesktopStore} from "../stores/storeDesktop"
|
|
5
5
|
|
|
6
6
|
export const useDesktopWorkspaceStore = defineStore('owd/desktop/workspace', () => {
|
|
7
7
|
const desktopStore = useDesktopStore()
|
|
@@ -56,4 +56,4 @@ export const useDesktopWorkspaceStore = defineStore('owd/desktop/workspace', ()
|
|
|
56
56
|
setOverview,
|
|
57
57
|
setWorkspace,
|
|
58
58
|
}
|
|
59
|
-
})
|
|
59
|
+
})
|
package/runtime/utils/utilApp.ts
CHANGED
|
@@ -23,11 +23,10 @@ export function normalizeApplicationConfig(config: ApplicationConfig): Applicati
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export function registerTailwindPath(nuxt: Nuxt, path: string) {
|
|
26
|
-
nuxt.options.runtimeConfig = nuxt.options.runtimeConfig || {}
|
|
27
|
-
nuxt.options.runtimeConfig.owd = nuxt.options.runtimeConfig.owd ||
|
|
28
|
-
nuxt.options.runtimeConfig.owd.tailwindPaths = nuxt.options.runtimeConfig.owd.tailwindPaths || []
|
|
26
|
+
nuxt.options.runtimeConfig.app.owd = nuxt.options.runtimeConfig.app.owd || {}
|
|
27
|
+
nuxt.options.runtimeConfig.app.owd.tailwindPaths = nuxt.options.runtimeConfig.app.owd.tailwindPaths || []
|
|
29
28
|
|
|
30
|
-
if (!nuxt.options.runtimeConfig.owd.tailwindPaths.includes(path)) {
|
|
31
|
-
nuxt.options.runtimeConfig.owd.tailwindPaths.push(path)
|
|
29
|
+
if (!nuxt.options.runtimeConfig.app.owd.tailwindPaths.includes(path)) {
|
|
30
|
+
nuxt.options.runtimeConfig.app.owd.tailwindPaths.push(path)
|
|
32
31
|
}
|
|
33
|
-
}
|
|
32
|
+
}
|
|
@@ -2,7 +2,7 @@ export function deepClone<T>(obj: T): T {
|
|
|
2
2
|
return JSON.parse(JSON.stringify(obj))
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
export function deepEqual(obj1, obj2) {
|
|
5
|
+
export function deepEqual(obj1: any, obj2: any) {
|
|
6
6
|
const keys1 = Object.keys(obj1);
|
|
7
7
|
const keys2 = Object.keys(obj2);
|
|
8
8
|
if (keys1.length !== keys2.length) {
|
|
@@ -55,4 +55,4 @@ export function deepMerge<T>(target: T, source: Partial<T>): T {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
return source as T
|
|
58
|
-
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url'
|
|
2
|
+
import { describe, it, expect } from 'vitest'
|
|
3
|
+
import { setup, $fetch } from '@nuxt/test-utils/e2e'
|
|
4
|
+
|
|
5
|
+
describe('ssr', async () => {
|
|
6
|
+
await setup({
|
|
7
|
+
rootDir: fileURLToPath(new URL('./fixtures/basic', import.meta.url)),
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
it('renders the index page', async () => {
|
|
11
|
+
// Get response to a server-rendered page with `$fetch`.
|
|
12
|
+
const html = await $fetch('/')
|
|
13
|
+
expect(html).toContain('<div>basic</div>')
|
|
14
|
+
})
|
|
15
|
+
})
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "dist",
|
|
5
|
+
"rootDir": "src",
|
|
6
|
+
"jsx": "preserve",
|
|
7
|
+
"jsxImportSource": "vue",
|
|
8
|
+
"resolveJsonModule": true,
|
|
9
|
+
"tsBuildInfoFile": "dist/tsconfig.app.tsbuildinfo"
|
|
10
|
+
},
|
|
11
|
+
"include": [".nuxt/nuxt.d.ts", "runtime/**/*", "types/index.d.ts"],
|
|
12
|
+
"exclude": [
|
|
13
|
+
"out-tsc",
|
|
14
|
+
"dist",
|
|
15
|
+
"vite.config.ts",
|
|
16
|
+
"vite.config.mts",
|
|
17
|
+
"vitest.config.ts",
|
|
18
|
+
"vitest.config.mts",
|
|
19
|
+
"runtime/**/*.test.ts",
|
|
20
|
+
"runtime/**/*.spec.ts",
|
|
21
|
+
"runtime/**/*.test.tsx",
|
|
22
|
+
"runtime/**/*.spec.tsx",
|
|
23
|
+
"runtime/**/*.test.js",
|
|
24
|
+
"runtime/**/*.spec.js",
|
|
25
|
+
"runtime/**/*.test.jsx",
|
|
26
|
+
"runtime/**/*.spec.jsx",
|
|
27
|
+
"eslint.config.js",
|
|
28
|
+
"eslint.config.cjs",
|
|
29
|
+
"eslint.config.mjs"
|
|
30
|
+
]
|
|
31
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "./out-tsc/vitest",
|
|
5
|
+
"types": [
|
|
6
|
+
"vitest/globals",
|
|
7
|
+
"vitest/importMeta",
|
|
8
|
+
"vite/client",
|
|
9
|
+
"node",
|
|
10
|
+
"vitest"
|
|
11
|
+
],
|
|
12
|
+
"jsx": "preserve",
|
|
13
|
+
"jsxImportSource": "vue",
|
|
14
|
+
"resolveJsonModule": true
|
|
15
|
+
},
|
|
16
|
+
"include": [
|
|
17
|
+
".nuxt/nuxt.d.ts",
|
|
18
|
+
"vite.config.ts",
|
|
19
|
+
"vite.config.mts",
|
|
20
|
+
"vitest.config.ts",
|
|
21
|
+
"vitest.config.mts",
|
|
22
|
+
"runtime/**/*.test.ts",
|
|
23
|
+
"runtime/**/*.spec.ts",
|
|
24
|
+
"runtime/**/*.test.tsx",
|
|
25
|
+
"runtime/**/*.spec.tsx",
|
|
26
|
+
"runtime/**/*.test.js",
|
|
27
|
+
"runtime/**/*.spec.js",
|
|
28
|
+
"runtime/**/*.test.jsx",
|
|
29
|
+
"runtime/**/*.spec.jsx",
|
|
30
|
+
"runtime/**/*.d.ts"
|
|
31
|
+
],
|
|
32
|
+
"references": [
|
|
33
|
+
{
|
|
34
|
+
"path": "./tsconfig.app.json"
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
declare module 'nuxt/schema' {
|
|
2
|
+
interface PublicRuntimeConfig {
|
|
3
|
+
owd: {
|
|
4
|
+
tailwindPaths: []
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
1
9
|
interface IApplicationManager {
|
|
2
10
|
apps: Map<string, IApplicationController>
|
|
3
11
|
|
|
@@ -333,4 +341,6 @@ interface DefaultAppsConfig {
|
|
|
333
341
|
interface DefaultAppConfig {
|
|
334
342
|
application: IApplicationController
|
|
335
343
|
entry: ApplicationEntry
|
|
336
|
-
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export {}
|
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types='vitest' />
|
|
2
|
+
import { defineConfig } from 'vite';
|
|
3
|
+
import vue from '@vitejs/plugin-vue';
|
|
4
|
+
|
|
5
|
+
export default defineConfig(() => ({
|
|
6
|
+
root: __dirname,
|
|
7
|
+
cacheDir: '../../node_modules/.vite/packages/core',
|
|
8
|
+
plugins: [vue()],
|
|
9
|
+
// Uncomment this if you are using workers.
|
|
10
|
+
// worker: {
|
|
11
|
+
// plugins: [ nxViteTsPaths() ],
|
|
12
|
+
// },
|
|
13
|
+
test: {
|
|
14
|
+
watch: false,
|
|
15
|
+
globals: true,
|
|
16
|
+
environment: 'jsdom',
|
|
17
|
+
include: ['{src,tests}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
18
|
+
reporters: ['default'],
|
|
19
|
+
coverage: {
|
|
20
|
+
reportsDirectory: './test-output/vitest/coverage',
|
|
21
|
+
provider: 'v8' as const,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
}));
|
package/index.ts
DELETED
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import {defineNuxtModule, createResolver, addComponentsDir, addImportsDir, installModule, addPlugin} from '@nuxt/kit'
|
|
2
|
-
import {deepMerge} from '@owdproject/core/runtime/utils/utilCommon'
|
|
3
|
-
import pkg from './package.json'
|
|
4
|
-
|
|
5
|
-
export default defineNuxtModule({
|
|
6
|
-
meta: {
|
|
7
|
-
name: 'owd-core',
|
|
8
|
-
priority: 9999,
|
|
9
|
-
},
|
|
10
|
-
async setup(options, nuxt) {
|
|
11
|
-
const {resolve} = createResolver(import.meta.url)
|
|
12
|
-
|
|
13
|
-
const desktopConfig = (await import(nuxt.options.rootDir + '/owd.config.ts')).default
|
|
14
|
-
|
|
15
|
-
// set core version to runtime config
|
|
16
|
-
|
|
17
|
-
nuxt.options.runtimeConfig.public.coreVersion = pkg.version
|
|
18
|
-
|
|
19
|
-
{
|
|
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
|
-
|
|
35
|
-
// install open web desktop apps
|
|
36
|
-
|
|
37
|
-
if (desktopConfig.apps) {
|
|
38
|
-
for (const appPath of desktopConfig.apps) {
|
|
39
|
-
await installModule(appPath)
|
|
40
|
-
}
|
|
41
|
-
}
|
|
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
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
{
|
|
52
|
-
|
|
53
|
-
// install primevue
|
|
54
|
-
|
|
55
|
-
nuxt.options.primevue = nuxt.options.primevue || {};
|
|
56
|
-
nuxt.options.primevue.options = nuxt.options.primevue.options || {};
|
|
57
|
-
nuxt.options.primevue.options.theme = nuxt.options.primevue.options.theme || {};
|
|
58
|
-
|
|
59
|
-
await installModule("@primevue/nuxt-module")
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
{
|
|
64
|
-
|
|
65
|
-
// install tailwind
|
|
66
|
-
|
|
67
|
-
const tailwindPaths = nuxt.options.runtimeConfig?.owd?.tailwindPaths || []
|
|
68
|
-
tailwindPaths.push('./runtime/components/**/*.{vue,mjs,ts}') // Aggiungi sempre questo al core
|
|
69
|
-
|
|
70
|
-
nuxt.options.tailwindcss = nuxt.options.tailwindcss || {}
|
|
71
|
-
nuxt.options.tailwindcss.config = nuxt.options.tailwindcss.config || {}
|
|
72
|
-
// @ts-ignore
|
|
73
|
-
nuxt.options.tailwindcss.config.content = tailwindPaths
|
|
74
|
-
|
|
75
|
-
await installModule('@nuxtjs/tailwindcss', {
|
|
76
|
-
viewer: false,
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
{
|
|
82
|
-
|
|
83
|
-
// install pinia
|
|
84
|
-
|
|
85
|
-
await installModule("@pinia/nuxt")
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
{
|
|
90
|
-
|
|
91
|
-
// install @nuxt/fonts
|
|
92
|
-
|
|
93
|
-
await installModule("@nuxt/fonts")
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
{
|
|
98
|
-
|
|
99
|
-
// install @nuxt/icon
|
|
100
|
-
|
|
101
|
-
await installModule("@nuxt/icon", {
|
|
102
|
-
clientBundle: {
|
|
103
|
-
scan: true,
|
|
104
|
-
sizeLimitKb: 256,
|
|
105
|
-
},
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
{
|
|
111
|
-
|
|
112
|
-
// install @vueuse/nuxt
|
|
113
|
-
|
|
114
|
-
await installModule("@vueuse/nuxt")
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
{
|
|
119
|
-
|
|
120
|
-
// install @nuxtjs/i18n
|
|
121
|
-
|
|
122
|
-
await installModule("@nuxtjs/i18n")
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
{
|
|
127
|
-
|
|
128
|
-
// configure scss for vite
|
|
129
|
-
|
|
130
|
-
nuxt.hook('vite:extendConfig', (viteConfig) => {
|
|
131
|
-
viteConfig.css = viteConfig.css || {}
|
|
132
|
-
viteConfig.css.preprocessorOptions = viteConfig.css.preprocessorOptions || {}
|
|
133
|
-
viteConfig.css.preprocessorOptions.scss = {
|
|
134
|
-
api: 'modern-compiler',
|
|
135
|
-
}
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
{
|
|
141
|
-
|
|
142
|
-
// add css
|
|
143
|
-
|
|
144
|
-
nuxt.options.css.push('sanitize.css')
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
{
|
|
149
|
-
|
|
150
|
-
// add components
|
|
151
|
-
|
|
152
|
-
addComponentsDir({
|
|
153
|
-
path: resolve("./runtime/components"),
|
|
154
|
-
prefix: "",
|
|
155
|
-
global: true,
|
|
156
|
-
})
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
{
|
|
161
|
-
|
|
162
|
-
// install plugins
|
|
163
|
-
|
|
164
|
-
addPlugin(resolve('./runtime/plugins/resize.client.ts'))
|
|
165
|
-
|
|
166
|
-
// add other files
|
|
167
|
-
|
|
168
|
-
addImportsDir(resolve('./runtime/composables'))
|
|
169
|
-
addImportsDir(resolve('./runtime/core'))
|
|
170
|
-
addImportsDir(resolve('./runtime/stores'))
|
|
171
|
-
addImportsDir(resolve('./runtime/utils'))
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
})
|
|
176
|
-
|
|
177
|
-
export * from './runtime/composables/useAppEntries'
|
|
178
|
-
export * from './runtime/composables/useApplicationManager'
|
|
179
|
-
export * from './runtime/composables/useDesktopManager'
|
|
180
|
-
export * from './runtime/composables/useTerminalManager'
|
|
181
|
-
export * from './runtime/utils/utilApp'
|
|
182
|
-
export * from './runtime/utils/utilCommon'
|
|
183
|
-
export * from './runtime/utils/utilDebug'
|
|
184
|
-
export * from './runtime/utils/utilDesktop'
|
|
185
|
-
export * from './runtime/utils/utilTerminal'
|
|
186
|
-
export * from './runtime/utils/utilWindow'
|
|
187
|
-
export * from './runtime/stores/storeApplicationMeta'
|
|
188
|
-
export * from './runtime/stores/storeApplicationWindows'
|
|
189
|
-
export * from './runtime/stores/storeDesktop'
|
|
190
|
-
export * from './runtime/stores/storeDesktopVolume'
|
|
191
|
-
export * from './runtime/stores/storeDesktopWindow'
|
|
192
|
-
export * from './runtime/stores/storeDesktopWorkspace'
|