@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 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/utilsDesktop"
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/utilsCommon'
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/utilsApp'
183
- export * from './runtime/utils/utilsCommon'
184
- export * from './runtime/utils/utilsDebug'
185
- export * from './runtime/utils/utilsDesktop'
186
- export * from './runtime/utils/utilsTerminal'
187
- export * from './runtime/utils/utilsWindow'
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@owdproject/core",
3
- "version": "3.0.0-alpha.8",
3
+ "version": "3.0.0-alpha.9",
4
4
  "description": "Open Web Desktop core",
5
5
  "keywords": [
6
6
  "web",
@@ -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 "../../../composables/useDesktopManager"
5
- import {handleWindowControllerProps} from "../../../utils/utilsWindow"
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 {useApplicationState} from "../../composables/useApplicationState"
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/utilsDebug"
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.store = useApplicationState(id)
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.store.$persistedState) {
71
- await this.store.$persistedState.isReady()
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.store.meta = this.config.meta ?? {}
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.store.windows || Object.keys(this.store.windows).length === 0) {
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.store.windows).map(windowId => {
110
- const windowStore: WindowStoredState | undefined = this.store.windows[windowId]
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.store.windows[windowId] = {
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.store.windows[windowId]
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.store.windows[windowId];
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.store.windows = {}
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.store.meta
219
+ return this.storeMeta.meta
214
220
  }
215
221
 
216
222
  getMeta(key: string) {
@@ -1,6 +1,6 @@
1
- import {useApplicationManager} from '../../composables/useApplicationManager'
2
- import {useDesktopWindowStore} from '../../stores/storeDesktopWindow'
3
- import {deepClone} from '../../utils/utilsCommon'
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/utilsApp"
5
- import {debugLog} from "../../utils/utilsDebug"
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,4 +1,4 @@
1
- import {deepMerge} from "../../utils/utilsCommon"
1
+ import {deepMerge} from "@owdproject/core/runtime/utils/utilCommon"
2
2
 
3
3
  export class DesktopManager {
4
4
  public config: DesktopConfig = {} as DesktopConfig
@@ -1,5 +1,5 @@
1
1
  import {useApplicationManager} from "../../composables/useApplicationManager"
2
- import {debugLog} from "../../utils/utilsDebug"
2
+ import {debugLog} from "../../utils/utilDebug"
3
3
 
4
4
  export class TerminalManager {
5
5
  private commands: Map<string, TerminalCommand> = new Map()
@@ -0,0 +1,11 @@
1
+ import {defineStore} from "pinia"
2
+
3
+ export const useApplicationMetaStore = (appId: string, states: any = {}) => {
4
+ return defineStore(`owd/application/${appId}/meta`, () => {
5
+ return states
6
+ }, {
7
+ persistedState: {
8
+ persist: true
9
+ },
10
+ })
11
+ }
@@ -1,15 +1,12 @@
1
1
  import {defineStore} from "pinia"
2
2
  import {ref} from "@vue/reactivity"
3
3
 
4
- export const useApplicationState = (appId: string) => {
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