@owdproject/core 3.0.0-alpha.8 → 3.0.0-alpha.9
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 +1 -1
- package/index.ts +9 -8
- package/package.json +1 -1
- package/runtime/components/Core/Window/CoreWindow.vue +2 -2
- package/runtime/core/controllers/ApplicationController.ts +20 -14
- package/runtime/core/controllers/WindowController.ts +3 -3
- package/runtime/core/managers/ApplicationManager.ts +2 -2
- package/runtime/core/managers/DesktopManager.ts +1 -1
- package/runtime/core/managers/TerminalManager.ts +1 -1
- package/runtime/stores/storeApplicationMeta.ts +11 -0
- package/runtime/{composables/useApplicationState.ts → stores/storeApplicationWindows.ts} +2 -5
- /package/runtime/utils/{utilsApp.ts → utilApp.ts} +0 -0
- /package/runtime/utils/{utilsCommon.ts → utilCommon.ts} +0 -0
- /package/runtime/utils/{utilsDebug.ts → utilDebug.ts} +0 -0
- /package/runtime/utils/{utilsDesktop.ts → utilDesktop.ts} +0 -0
- /package/runtime/utils/{utilsTerminal.ts → utilTerminal.ts} +0 -0
- /package/runtime/utils/{utilsWindow.ts → utilWindow.ts} +0 -0
package/README.md
CHANGED
|
@@ -92,7 +92,7 @@ Then specify the path theme in `owd.config.ts`:
|
|
|
92
92
|
|
|
93
93
|
```typescript
|
|
94
94
|
// owd.config.ts
|
|
95
|
-
import {defineDesktopConfig} from "@owdproject/core/runtime/utils/
|
|
95
|
+
import {defineDesktopConfig} from "@owdproject/core/runtime/utils/utilDesktop"
|
|
96
96
|
|
|
97
97
|
export default defineDesktopConfig({
|
|
98
98
|
theme: '@owdproject/theme-gnome', // define here the theme you just installed
|
package/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {defineNuxtModule, createResolver, addComponentsDir, addImportsDir, installModule, addPlugin} from '@nuxt/kit'
|
|
2
|
-
import {deepMerge} from '@owdproject/core/runtime/utils/
|
|
2
|
+
import {deepMerge} from '@owdproject/core/runtime/utils/utilCommon'
|
|
3
3
|
import pkg from './package.json'
|
|
4
4
|
|
|
5
5
|
export default defineNuxtModule({
|
|
@@ -176,15 +176,16 @@ export default defineNuxtModule({
|
|
|
176
176
|
|
|
177
177
|
export * from './runtime/composables/useAppEntries'
|
|
178
178
|
export * from './runtime/composables/useApplicationManager'
|
|
179
|
-
export * from './runtime/composables/useApplicationState'
|
|
180
179
|
export * from './runtime/composables/useDesktopManager'
|
|
181
180
|
export * from './runtime/composables/useTerminalManager'
|
|
182
|
-
export * from './runtime/utils/
|
|
183
|
-
export * from './runtime/utils/
|
|
184
|
-
export * from './runtime/utils/
|
|
185
|
-
export * from './runtime/utils/
|
|
186
|
-
export * from './runtime/utils/
|
|
187
|
-
export * from './runtime/utils/
|
|
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'
|
|
188
189
|
export * from './runtime/stores/storeDesktop'
|
|
189
190
|
export * from './runtime/stores/storeDesktopVolume'
|
|
190
191
|
export * from './runtime/stores/storeDesktopWindow'
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import {ref,provide} from 'vue'
|
|
3
3
|
import {computed} from "@vue/reactivity"
|
|
4
|
-
import {useDesktopManager} from "
|
|
5
|
-
import {handleWindowControllerProps} from "
|
|
4
|
+
import {useDesktopManager} from "@owdproject/core/runtime/composables/useDesktopManager"
|
|
5
|
+
import {handleWindowControllerProps} from "@owdproject/core/runtime/utils/utilWindow"
|
|
6
6
|
|
|
7
7
|
const props = defineProps<{
|
|
8
8
|
window?: IWindowController
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {nanoid} from "nanoid";
|
|
2
2
|
import {WindowController} from "./WindowController";
|
|
3
3
|
import {useApplicationManager} from "../../composables/useApplicationManager"
|
|
4
|
-
import {
|
|
4
|
+
import {useApplicationWindowsStore} from "../../stores/storeApplicationWindows"
|
|
5
|
+
import {useApplicationMetaStore} from "../../stores/storeApplicationMeta"
|
|
5
6
|
import {useTerminalManager} from "../../composables/useTerminalManager"
|
|
6
7
|
import {useDesktopManager} from "../../composables/useDesktopManager"
|
|
7
|
-
import {debugLog, debugError} from "../../utils/
|
|
8
|
+
import {debugLog, debugError} from "../../utils/utilDebug"
|
|
8
9
|
import {useDesktopWorkspaceStore} from "../../stores/storeDesktopWorkspace"
|
|
9
10
|
import {reactive} from '@vue/reactivity'
|
|
10
11
|
|
|
@@ -31,7 +32,8 @@ export class ApplicationController implements IApplicationController {
|
|
|
31
32
|
|
|
32
33
|
this.id = id
|
|
33
34
|
this.config = config
|
|
34
|
-
this.
|
|
35
|
+
this.storeWindows = useApplicationWindowsStore(id)
|
|
36
|
+
this.storeMeta = useApplicationMetaStore(id)
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
public async initApplication(): Promise<void> {
|
|
@@ -67,12 +69,16 @@ export class ApplicationController implements IApplicationController {
|
|
|
67
69
|
|
|
68
70
|
// store
|
|
69
71
|
|
|
70
|
-
if (this.
|
|
71
|
-
await this.
|
|
72
|
+
if (this.storeWindows.$persistedState) {
|
|
73
|
+
await this.storeWindows.$persistedState.isReady()
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (this.storeMeta.$persistedState) {
|
|
77
|
+
await this.storeMeta.$persistedState.isReady()
|
|
72
78
|
}
|
|
73
79
|
|
|
74
80
|
// set default meta values
|
|
75
|
-
this.
|
|
81
|
+
// this.storeMeta.meta = this.config.meta ?? {}
|
|
76
82
|
|
|
77
83
|
// restore application state
|
|
78
84
|
await this.restoreApplication()
|
|
@@ -94,7 +100,7 @@ export class ApplicationController implements IApplicationController {
|
|
|
94
100
|
await this.config.onRestore(this)
|
|
95
101
|
}
|
|
96
102
|
|
|
97
|
-
if (!this.
|
|
103
|
+
if (!this.storeWindows.windows || Object.keys(this.storeWindows.windows).length === 0) {
|
|
98
104
|
return false
|
|
99
105
|
}
|
|
100
106
|
|
|
@@ -106,8 +112,8 @@ export class ApplicationController implements IApplicationController {
|
|
|
106
112
|
}
|
|
107
113
|
|
|
108
114
|
private restoreWindows() {
|
|
109
|
-
Object.keys(this.
|
|
110
|
-
const windowStore: WindowStoredState | undefined = this.
|
|
115
|
+
Object.keys(this.storeWindows.windows).map(windowId => {
|
|
116
|
+
const windowStore: WindowStoredState | undefined = this.storeWindows.windows[windowId]
|
|
111
117
|
|
|
112
118
|
if (windowStore) {
|
|
113
119
|
this.openWindow(windowStore.model, windowStore, {isRestoring: true})
|
|
@@ -138,7 +144,7 @@ export class ApplicationController implements IApplicationController {
|
|
|
138
144
|
? window.scrollY + windowConfig.position.y
|
|
139
145
|
: window.scrollY + centerY
|
|
140
146
|
|
|
141
|
-
this.
|
|
147
|
+
this.storeWindows.windows[windowId] = {
|
|
142
148
|
model,
|
|
143
149
|
state: {
|
|
144
150
|
id: windowId,
|
|
@@ -153,7 +159,7 @@ export class ApplicationController implements IApplicationController {
|
|
|
153
159
|
}
|
|
154
160
|
}
|
|
155
161
|
|
|
156
|
-
windowStoredState = this.
|
|
162
|
+
windowStoredState = this.storeWindows.windows[windowId]
|
|
157
163
|
|
|
158
164
|
} else {
|
|
159
165
|
|
|
@@ -186,7 +192,7 @@ export class ApplicationController implements IApplicationController {
|
|
|
186
192
|
}
|
|
187
193
|
|
|
188
194
|
public closeWindow(windowId: string) {
|
|
189
|
-
delete this.
|
|
195
|
+
delete this.storeWindows.windows[windowId];
|
|
190
196
|
this.windows.delete(windowId);
|
|
191
197
|
|
|
192
198
|
if (this.windows.size === 0) {
|
|
@@ -195,7 +201,7 @@ export class ApplicationController implements IApplicationController {
|
|
|
195
201
|
}
|
|
196
202
|
|
|
197
203
|
public closeAllWindows() {
|
|
198
|
-
this.
|
|
204
|
+
this.storeWindows.windows = {}
|
|
199
205
|
this.windows.clear()
|
|
200
206
|
}
|
|
201
207
|
|
|
@@ -210,7 +216,7 @@ export class ApplicationController implements IApplicationController {
|
|
|
210
216
|
// meta
|
|
211
217
|
|
|
212
218
|
get meta() {
|
|
213
|
-
return this.
|
|
219
|
+
return this.storeMeta.meta
|
|
214
220
|
}
|
|
215
221
|
|
|
216
222
|
getMeta(key: string) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {useApplicationManager} from '
|
|
2
|
-
import {useDesktopWindowStore} from '
|
|
3
|
-
import {deepClone} from '
|
|
1
|
+
import {useApplicationManager} from '@owdproject/core/runtime/composables/useApplicationManager'
|
|
2
|
+
import {useDesktopWindowStore} from '@owdproject/core/runtime/stores/storeDesktopWindow'
|
|
3
|
+
import {deepClone} from '@owdproject/core/runtime/utils/utilCommon'
|
|
4
4
|
import {markRaw} from '@vue/reactivity'
|
|
5
5
|
import {defineAsyncComponent} from "vue"
|
|
6
6
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type {Reactive} from "@vue/reactivity"
|
|
2
2
|
import {reactive, markRaw} from "@vue/reactivity"
|
|
3
3
|
import {ApplicationController} from "../controllers/ApplicationController";
|
|
4
|
-
import {normalizeApplicationConfig} from "../../utils/
|
|
5
|
-
import {debugLog} from "../../utils/
|
|
4
|
+
import {normalizeApplicationConfig} from "../../utils/utilApp"
|
|
5
|
+
import {debugLog} from "../../utils/utilDebug"
|
|
6
6
|
|
|
7
7
|
export class ApplicationManager implements IApplicationManager {
|
|
8
8
|
public apps = reactive(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {useApplicationManager} from "../../composables/useApplicationManager"
|
|
2
|
-
import {debugLog} from "../../utils/
|
|
2
|
+
import {debugLog} from "../../utils/utilDebug"
|
|
3
3
|
|
|
4
4
|
export class TerminalManager {
|
|
5
5
|
private commands: Map<string, TerminalCommand> = new Map()
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import {defineStore} from "pinia"
|
|
2
2
|
import {ref} from "@vue/reactivity"
|
|
3
3
|
|
|
4
|
-
export const
|
|
5
|
-
return defineStore(`owd/application/${appId}`, () => {
|
|
6
|
-
const meta: Ref<any> = ref({})
|
|
7
|
-
|
|
4
|
+
export const useApplicationWindowsStore = (appId: string) => {
|
|
5
|
+
return defineStore(`owd/application/${appId}/windows`, () => {
|
|
8
6
|
const windows: Ref<{[windowId: string]: WindowStoredState}> = ref({})
|
|
9
7
|
|
|
10
8
|
return {
|
|
11
9
|
windows,
|
|
12
|
-
meta,
|
|
13
10
|
}
|
|
14
11
|
}, {
|
|
15
12
|
persistedState: {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|