@owdproject/core 3.3.1 → 4.0.0-alpha.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 +91 -59
- package/dist/dom/index.d.mts +65 -0
- package/dist/dom/index.d.ts +65 -0
- package/dist/dom/index.mjs +224 -0
- package/dist/events/index.d.mts +70 -0
- package/dist/events/index.d.ts +70 -0
- package/dist/events/index.mjs +3 -0
- package/dist/index.d.mts +73 -0
- package/dist/index.d.ts +73 -0
- package/dist/index.mjs +115 -0
- package/dist/layout/index.d.mts +41 -0
- package/dist/layout/index.d.ts +41 -0
- package/dist/layout/index.mjs +64 -0
- package/dist/machines/index.d.mts +31 -0
- package/dist/machines/index.d.ts +31 -0
- package/dist/machines/index.mjs +2 -0
- package/dist/managers/index.d.mts +117 -0
- package/dist/managers/index.d.ts +117 -0
- package/dist/managers/index.mjs +6 -0
- package/dist/session/index.d.mts +57 -0
- package/dist/session/index.d.ts +57 -0
- package/dist/session/index.mjs +65 -0
- package/dist/shared/core.B0B0KfVK.mjs +865 -0
- package/dist/shared/core.B1XxB289.mjs +239 -0
- package/dist/shared/core.B3mp7ztE.mjs +237 -0
- package/dist/shared/core.BOvFdEVQ.d.ts +114 -0
- package/dist/shared/core.CsDFgGnX.mjs +40 -0
- package/dist/shared/core.Di1eFcr_.d.mts +114 -0
- package/dist/shared/core.Pd_Ogt4g.mjs +101 -0
- package/dist/shared/core.b3Xldzyu.mjs +29 -0
- package/dist/types/index.d.mts +266 -0
- package/dist/types/index.d.ts +266 -0
- package/dist/types/index.mjs +1 -0
- package/package.json +60 -87
- package/bin/cli.js +0 -395
- package/bin/desktop.js +0 -5
- package/bin/lib/catalog.js +0 -293
- package/bin/lib/config.js +0 -109
- package/bin/lib/desktopConfig.js +0 -56
- package/bin/lib/generateTemplate.js +0 -389
- package/bin/lib/install.js +0 -408
- package/bin/lib/migrateModulePlayground.config.mjs +0 -164
- package/bin/lib/migrateModulePlayground.mjs +0 -313
- package/bin/lib/npmVersions.js +0 -124
- package/bin/lib/playgroundContext.js +0 -188
- package/bin/lib/scaffold.js +0 -197
- package/bin/lib/status.js +0 -289
- package/bin/lib/validateModule.js +0 -697
- package/bin/lib/workspace.js +0 -182
- package/bin/owd.js +0 -5
- package/bin/tui.js +0 -1379
- package/dist/module.d.mts +0 -13
- package/dist/module.json +0 -9
- package/dist/module.mjs +0 -268
- package/dist/types.d.mts +0 -7
- package/index.ts +0 -5
- package/module.ts +0 -223
- package/runtime/components/Desktop/Application/DesktopApplicationRender.vue +0 -20
- package/runtime/components/Desktop/Application/DesktopApplicationWindowsRender.vue +0 -38
- package/runtime/components/Desktop/Background/DesktopBackground.vue +0 -16
- package/runtime/components/Desktop/Core/DesktopCore.vue +0 -90
- package/runtime/components/Desktop/Time/DesktopTime.vue +0 -56
- package/runtime/components/Desktop/Window/DesktopWindow.vue +0 -204
- package/runtime/components/Desktop/Window/DesktopWindowContent.vue +0 -28
- package/runtime/components/Desktop/Window/DesktopWindowNav.vue +0 -66
- package/runtime/composables/useApplicationEntries.ts +0 -51
- package/runtime/composables/useApplicationManager.ts +0 -285
- package/runtime/composables/useDesktopManager.ts +0 -49
- package/runtime/composables/useTerminalManager.ts +0 -66
- package/runtime/composables/useWorkspaceManager.ts +0 -41
- package/runtime/internal/controllers/ApplicationController.ts +0 -345
- package/runtime/internal/controllers/WindowController.ts +0 -462
- package/runtime/plugins/02.desktop-register-desktop-apps.client.ts +0 -17
- package/runtime/plugins/resize.client.ts +0 -6
- package/runtime/stores/storeApplicationMeta.ts +0 -59
- package/runtime/stores/storeApplicationWindows.ts +0 -20
- package/runtime/stores/storeDesktop.ts +0 -111
- package/runtime/stores/storeDesktopDefaultApps.ts +0 -53
- package/runtime/stores/storeDesktopVolume.ts +0 -18
- package/runtime/stores/storeDesktopWindow.ts +0 -20
- package/runtime/stores/storeDesktopWorkspace.ts +0 -75
- package/runtime/utils/captureElementToCanvas.ts +0 -21
- package/runtime/utils/explorerEntryPath.ts +0 -10
- package/runtime/utils/resolveDesktopConfigPath.ts +0 -52
- package/runtime/utils/splitDesktopUserConfig.ts +0 -85
- package/runtime/utils/utilApp.ts +0 -37
- package/runtime/utils/utilCommon.ts +0 -26
- package/runtime/utils/utilDebug.ts +0 -30
- package/runtime/utils/utilDesktop.ts +0 -35
- package/runtime/utils/utilTerminal.ts +0 -6
- package/runtime/utils/utilWindow.ts +0 -15
- package/runtime/utils/validateDesktopUserConfig.ts +0 -44
- package/types/index.d.ts +0 -420
|
@@ -1,462 +0,0 @@
|
|
|
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
|
-
|
|
7
|
-
export class WindowController implements IWindowController {
|
|
8
|
-
public readonly application: IApplicationController
|
|
9
|
-
|
|
10
|
-
public readonly instanced: boolean = true
|
|
11
|
-
public readonly model: string
|
|
12
|
-
|
|
13
|
-
public config: WindowConfig = {
|
|
14
|
-
title: '',
|
|
15
|
-
category: '',
|
|
16
|
-
|
|
17
|
-
component: undefined,
|
|
18
|
-
|
|
19
|
-
// position
|
|
20
|
-
position: {
|
|
21
|
-
x: 0,
|
|
22
|
-
y: 0,
|
|
23
|
-
z: 0,
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
// sizes
|
|
27
|
-
size: {
|
|
28
|
-
width: undefined,
|
|
29
|
-
height: undefined,
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
// minimize
|
|
33
|
-
minimizable: true,
|
|
34
|
-
|
|
35
|
-
// maximize
|
|
36
|
-
maximized: false,
|
|
37
|
-
maximizable: false,
|
|
38
|
-
|
|
39
|
-
// destroy
|
|
40
|
-
destroyable: true,
|
|
41
|
-
|
|
42
|
-
// draggable
|
|
43
|
-
draggable: true,
|
|
44
|
-
|
|
45
|
-
// resizable
|
|
46
|
-
resizable: true,
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
public override: WindowOverride = {}
|
|
50
|
-
|
|
51
|
-
private storedState: WindowStoredState
|
|
52
|
-
|
|
53
|
-
constructor(
|
|
54
|
-
application: IApplicationController,
|
|
55
|
-
model: string,
|
|
56
|
-
windowConfig: WindowConfig,
|
|
57
|
-
windowStoredState: WindowStoredState,
|
|
58
|
-
) {
|
|
59
|
-
this.application = application
|
|
60
|
-
this.model = model
|
|
61
|
-
|
|
62
|
-
this.storedState = windowStoredState
|
|
63
|
-
|
|
64
|
-
this.setConfig(windowConfig)
|
|
65
|
-
|
|
66
|
-
this.restoreState()
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
private setConfig(config: WindowConfig) {
|
|
70
|
-
// component
|
|
71
|
-
if (config.component) {
|
|
72
|
-
this.config.component = markRaw(defineAsyncComponent(config.component))
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// title
|
|
76
|
-
if (config.title) this.config.title = config.title
|
|
77
|
-
if (config.icon) this.config.icon = config.icon
|
|
78
|
-
|
|
79
|
-
// position
|
|
80
|
-
if (!this.config.position) this.config.position = { x: 0, y: 0, z: 0 }
|
|
81
|
-
if (config.position?.x) this.config.position.x = config.position.x
|
|
82
|
-
if (config.position?.y) this.config.position.y = config.position.y
|
|
83
|
-
if (config.position?.z) this.config.position.z = config.position.z
|
|
84
|
-
|
|
85
|
-
// sizes
|
|
86
|
-
if (config.size?.width) this.config.size.width = config.size.width
|
|
87
|
-
if (config.size?.height) this.config.size.height = config.size.height
|
|
88
|
-
if (config.size?.minWidth) this.config.size.minWidth = config.size.minWidth
|
|
89
|
-
if (config.size?.minHeight)
|
|
90
|
-
this.config.size.minHeight = config.size.minHeight
|
|
91
|
-
if (config.size?.maxWidth) this.config.size.maxWidth = config.size.maxWidth
|
|
92
|
-
if (config.size?.maxHeight)
|
|
93
|
-
this.config.size.maxHeight = config.size.maxHeight
|
|
94
|
-
|
|
95
|
-
// minimize
|
|
96
|
-
if (typeof config.minimizable !== 'undefined') {
|
|
97
|
-
this.config.minimizable = config.minimizable
|
|
98
|
-
}
|
|
99
|
-
if (typeof config.maximizable !== 'undefined') {
|
|
100
|
-
this.config.maximizable = config.maximizable
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// maximize
|
|
104
|
-
if (typeof config.maximized !== 'undefined') {
|
|
105
|
-
this.config.maximized = config.maximized
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// draggable
|
|
109
|
-
if (typeof config.draggable !== 'undefined') {
|
|
110
|
-
this.config.draggable = config.draggable
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// resizable
|
|
114
|
-
if (typeof config.resizable !== 'undefined') {
|
|
115
|
-
this.config.resizable = config.resizable
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// destroy
|
|
119
|
-
if (typeof config.destroyable !== 'undefined') {
|
|
120
|
-
this.config.destroyable = config.destroyable
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const DEFAULT_OVERRIDABLE = {
|
|
124
|
-
draggable: true,
|
|
125
|
-
resizable: false,
|
|
126
|
-
position: false,
|
|
127
|
-
size: false,
|
|
128
|
-
maximized: false,
|
|
129
|
-
destroyable: false,
|
|
130
|
-
minimizable: false,
|
|
131
|
-
maximizable: false,
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
DEFAULT_OVERRIDABLE.position = DEFAULT_OVERRIDABLE.draggable
|
|
135
|
-
DEFAULT_OVERRIDABLE.size = DEFAULT_OVERRIDABLE.resizable
|
|
136
|
-
DEFAULT_OVERRIDABLE.maximized = DEFAULT_OVERRIDABLE.maximizable
|
|
137
|
-
|
|
138
|
-
this.config.overridable = {
|
|
139
|
-
...DEFAULT_OVERRIDABLE,
|
|
140
|
-
...(config.overridable || {}),
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// state
|
|
145
|
-
|
|
146
|
-
get state() {
|
|
147
|
-
return this.storedState.state
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
private restoreState() {
|
|
151
|
-
const overridable = this.config.overridable || {}
|
|
152
|
-
|
|
153
|
-
for (const key in overridable) {
|
|
154
|
-
if (overridable[key as keyof typeof overridable]) {
|
|
155
|
-
const stateKey = key as keyof WindowState
|
|
156
|
-
|
|
157
|
-
if (typeof this.state[stateKey] === 'undefined') {
|
|
158
|
-
if (typeof this.config[stateKey] === 'object') {
|
|
159
|
-
this.state[stateKey] = deepClone(this.config[stateKey])
|
|
160
|
-
} else {
|
|
161
|
-
this.state[stateKey] = !!this.config[stateKey]
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
private setState(state: WindowState) {
|
|
169
|
-
this.storedState.state = state
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// meta
|
|
173
|
-
|
|
174
|
-
get meta() {
|
|
175
|
-
return this.storedState.meta
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
// position
|
|
179
|
-
|
|
180
|
-
public setPosition(data: { x: number; y: number }) {
|
|
181
|
-
if (!this.state.position) {
|
|
182
|
-
this.state.position = { x: 0, y: 0 }
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
this.state.position.x = data.x
|
|
186
|
-
this.state.position.y = data.y
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
public setActive(value: boolean) {
|
|
190
|
-
this.state.active = value
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
public setFocus(value: boolean) {
|
|
194
|
-
this.state.focused = value
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
public focus() {
|
|
198
|
-
const applicationManager = useApplicationManager()
|
|
199
|
-
const desktopWindowStore = useDesktopWindowStore()
|
|
200
|
-
|
|
201
|
-
if (!this.state.position) {
|
|
202
|
-
this.state.position = { x: 0, y: 0, z: 0 }
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
for (const window of applicationManager.windowsOpened.value.values()) {
|
|
206
|
-
if (window !== this) {
|
|
207
|
-
window.setFocus(false)
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
this.setFocus(true)
|
|
212
|
-
this.state.position.z = desktopWindowStore.incrementPositionZ()
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// common
|
|
216
|
-
|
|
217
|
-
get title(): string {
|
|
218
|
-
if (typeof this.override.title !== 'undefined') {
|
|
219
|
-
return this.override.title
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
if (this.config.title) {
|
|
223
|
-
return this.config.title
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
return this.application.config.title
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
get icon() {
|
|
230
|
-
if (typeof this.override.icon !== 'undefined') {
|
|
231
|
-
return this.override.icon
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
if (this.config.icon) {
|
|
235
|
-
return this.config.icon
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
return this.application.config.icon
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
// position
|
|
242
|
-
|
|
243
|
-
get position() {
|
|
244
|
-
if (typeof this.state.position === 'undefined') {
|
|
245
|
-
return this.config.position
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
return this.state.position
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
// sizes
|
|
252
|
-
|
|
253
|
-
get size() {
|
|
254
|
-
const stateSize = this.state.size || {}
|
|
255
|
-
const configSize = this.config.size || {}
|
|
256
|
-
|
|
257
|
-
return {
|
|
258
|
-
width:
|
|
259
|
-
typeof stateSize.width !== 'undefined'
|
|
260
|
-
? stateSize.width
|
|
261
|
-
: configSize.width,
|
|
262
|
-
height:
|
|
263
|
-
typeof stateSize.height !== 'undefined'
|
|
264
|
-
? stateSize.height
|
|
265
|
-
: configSize.height,
|
|
266
|
-
minWidth:
|
|
267
|
-
typeof stateSize.minWidth !== 'undefined'
|
|
268
|
-
? stateSize.minWidth
|
|
269
|
-
: configSize.minWidth,
|
|
270
|
-
maxWidth:
|
|
271
|
-
typeof stateSize.maxWidth !== 'undefined'
|
|
272
|
-
? stateSize.maxWidth
|
|
273
|
-
: configSize.maxWidth,
|
|
274
|
-
minHeight:
|
|
275
|
-
typeof stateSize.minHeight !== 'undefined'
|
|
276
|
-
? stateSize.minHeight
|
|
277
|
-
: configSize.minHeight,
|
|
278
|
-
maxHeight:
|
|
279
|
-
typeof stateSize.maxHeight !== 'undefined'
|
|
280
|
-
? stateSize.maxHeight
|
|
281
|
-
: configSize.maxHeight,
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
public setSize(data: { width: number; height: number }) {
|
|
286
|
-
if (!this.state.size) {
|
|
287
|
-
this.state.size = { width: undefined, height: undefined }
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
this.state.size.width = data.width
|
|
291
|
-
this.state.size.height = data.height
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
// minimize
|
|
295
|
-
|
|
296
|
-
get isMinimizable() {
|
|
297
|
-
if (this.config.overridable?.minimizable) {
|
|
298
|
-
return !!this.state.minimizable
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
return !!this.config.minimizable
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
public minimize() {
|
|
305
|
-
if (!this.isMinimizable) {
|
|
306
|
-
return false
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
this.state.active = false
|
|
310
|
-
return true
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
public unminimize() {
|
|
314
|
-
this.state.active = true
|
|
315
|
-
return true
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
public toggleMinimize() {
|
|
319
|
-
this.state.active = !this.state.active
|
|
320
|
-
this.focus()
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
// maximize
|
|
324
|
-
|
|
325
|
-
get isMaximizable() {
|
|
326
|
-
if (typeof this.state.maximizable === 'undefined') {
|
|
327
|
-
return !!this.config.maximizable
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
return this.state.maximizable
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
get isMaximized() {
|
|
334
|
-
if (this.config.overridable?.maximized) {
|
|
335
|
-
return !!this.state.maximized
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
return !!this.config.maximized
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
public toggleMaximize() {
|
|
342
|
-
if (!this.isMaximizable) {
|
|
343
|
-
return false
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
this.state.maximized = !this.state.maximized
|
|
347
|
-
return true
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
public maximize() {
|
|
351
|
-
if (!this.isMaximizable) {
|
|
352
|
-
return false
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
this.state.maximized = true
|
|
356
|
-
return true
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
public unmaximize() {
|
|
360
|
-
if (!this.isMaximizable) {
|
|
361
|
-
return false
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
this.state.maximized = false
|
|
365
|
-
return true
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
// destroy
|
|
369
|
-
|
|
370
|
-
get isDestroyable() {
|
|
371
|
-
if (this.config.overridable?.destroyable) {
|
|
372
|
-
return !!this.state.destroyable
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
return !!this.config.destroyable
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
public destroy() {
|
|
379
|
-
if (!this.isDestroyable) {
|
|
380
|
-
return false
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
this.application.closeWindow(this.state.id)
|
|
384
|
-
|
|
385
|
-
return true
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
// draggable
|
|
389
|
-
get isDraggable() {
|
|
390
|
-
if (this.config.overridable?.draggable) {
|
|
391
|
-
return !!this.state.draggable
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
return !!this.config.draggable
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
// resizable
|
|
398
|
-
get isResizable() {
|
|
399
|
-
if (this.config.overridable?.resizable) {
|
|
400
|
-
return !!this.state.resizable
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
return !!this.config.resizable
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
// workspace
|
|
407
|
-
public setWorkspace(workspaceId: string) {
|
|
408
|
-
this.state.workspace = workspaceId
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
// override
|
|
412
|
-
|
|
413
|
-
public setTitleOverride(value: undefined | string) {
|
|
414
|
-
this.override.title = value
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
public resetTitleOverride() {
|
|
418
|
-
this.override.title = undefined
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
// menu
|
|
422
|
-
|
|
423
|
-
public menu: any[] = []
|
|
424
|
-
|
|
425
|
-
public setMenu(menu: any[]) {
|
|
426
|
-
this.menu = menu
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
// deprecated ?
|
|
430
|
-
get actions() {
|
|
431
|
-
return {
|
|
432
|
-
// position
|
|
433
|
-
setActive: this.setActive.bind(this),
|
|
434
|
-
setFocus: this.setFocus.bind(this),
|
|
435
|
-
bringToFront: this.focus.bind(this),
|
|
436
|
-
focus: this.focus.bind(this),
|
|
437
|
-
setPosition: this.setPosition.bind(this),
|
|
438
|
-
|
|
439
|
-
// size
|
|
440
|
-
setSize: this.setSize.bind(this),
|
|
441
|
-
|
|
442
|
-
// minimize
|
|
443
|
-
minimize: this.minimize.bind(this),
|
|
444
|
-
toggleMinimize: this.toggleMinimize.bind(this),
|
|
445
|
-
|
|
446
|
-
// maximize
|
|
447
|
-
toggleMaximize: this.toggleMaximize.bind(this),
|
|
448
|
-
maximize: this.maximize.bind(this),
|
|
449
|
-
unmaximize: this.unmaximize.bind(this),
|
|
450
|
-
|
|
451
|
-
// destroy
|
|
452
|
-
destroy: this.destroy.bind(this),
|
|
453
|
-
|
|
454
|
-
// workspace
|
|
455
|
-
setWorkspace: this.setWorkspace.bind(this),
|
|
456
|
-
|
|
457
|
-
// override
|
|
458
|
-
setTitleOverride: this.setTitleOverride.bind(this),
|
|
459
|
-
resetTitleOverride: this.resetTitleOverride.bind(this),
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { setActivePinia } from 'pinia'
|
|
2
|
-
import { defineNuxtPlugin } from 'nuxt/app'
|
|
3
|
-
import { flushPendingDesktopApps } from '../utils/utilDesktop'
|
|
4
|
-
|
|
5
|
-
export default defineNuxtPlugin({
|
|
6
|
-
name: 'desktop-register-desktop-apps',
|
|
7
|
-
dependsOn: ['pinia'],
|
|
8
|
-
enforce: 'post',
|
|
9
|
-
setup(nuxtApp) {
|
|
10
|
-
nuxtApp.hook('app:created', async () => {
|
|
11
|
-
if (nuxtApp.$pinia) {
|
|
12
|
-
setActivePinia(nuxtApp.$pinia)
|
|
13
|
-
}
|
|
14
|
-
await flushPendingDesktopApps()
|
|
15
|
-
})
|
|
16
|
-
},
|
|
17
|
-
})
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { defineStore } from 'pinia'
|
|
2
|
-
import { ref } from 'vue'
|
|
3
|
-
|
|
4
|
-
const metaStoreRegistry = new Map<string, ReturnType<typeof defineStore>>()
|
|
5
|
-
/** Store ids created by the generic fallback (only `meta`), replaceable when an app registers real state. */
|
|
6
|
-
const fallbackMetaStoreIds = new Set<string>()
|
|
7
|
-
|
|
8
|
-
type MetaStoreSetup = (() => Record<string, unknown>) | Record<string, unknown>
|
|
9
|
-
|
|
10
|
-
function resolveSetup(states: MetaStoreSetup) {
|
|
11
|
-
return typeof states === 'function' ? states : () => states
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Per-app Pinia meta store factory. The first registration for an app id wins so
|
|
16
|
-
* app modules should call this from their store module (imported in the app plugin
|
|
17
|
-
* before `defineDesktopApp`).
|
|
18
|
-
*/
|
|
19
|
-
export const useApplicationMetaStore = (
|
|
20
|
-
appId: string,
|
|
21
|
-
states?: MetaStoreSetup,
|
|
22
|
-
) => {
|
|
23
|
-
const id = `owd/application/${appId}/meta`
|
|
24
|
-
|
|
25
|
-
if (
|
|
26
|
-
states !== undefined &&
|
|
27
|
-
(!metaStoreRegistry.has(id) || fallbackMetaStoreIds.has(id))
|
|
28
|
-
) {
|
|
29
|
-
fallbackMetaStoreIds.delete(id)
|
|
30
|
-
metaStoreRegistry.set(
|
|
31
|
-
id,
|
|
32
|
-
defineStore(id, resolveSetup(states), {
|
|
33
|
-
persistedState: {
|
|
34
|
-
persist: true,
|
|
35
|
-
},
|
|
36
|
-
}),
|
|
37
|
-
)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (!metaStoreRegistry.has(id)) {
|
|
41
|
-
fallbackMetaStoreIds.add(id)
|
|
42
|
-
metaStoreRegistry.set(
|
|
43
|
-
id,
|
|
44
|
-
defineStore(
|
|
45
|
-
id,
|
|
46
|
-
() => ({
|
|
47
|
-
meta: ref<Record<string, unknown>>({}),
|
|
48
|
-
}),
|
|
49
|
-
{
|
|
50
|
-
persistedState: {
|
|
51
|
-
persist: true,
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
),
|
|
55
|
-
)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return metaStoreRegistry.get(id)!
|
|
59
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { defineStore } from 'pinia'
|
|
2
|
-
import { ref } from 'vue'
|
|
3
|
-
|
|
4
|
-
export const useApplicationWindowsStore = (appId: string) => {
|
|
5
|
-
return defineStore(
|
|
6
|
-
`owd/application/${appId}/windows`,
|
|
7
|
-
() => {
|
|
8
|
-
const windows: Ref<{ [windowId: string]: WindowStoredState }> = ref({})
|
|
9
|
-
|
|
10
|
-
return {
|
|
11
|
-
windows,
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
persistedState: {
|
|
16
|
-
persist: true,
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
)()
|
|
20
|
-
}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { defineStore } from 'pinia'
|
|
2
|
-
import { ref } from 'vue'
|
|
3
|
-
|
|
4
|
-
export type DesktopWindowSurface = 'acrylic' | 'solid'
|
|
5
|
-
|
|
6
|
-
export type DesktopAppearance = 'dark' | 'light'
|
|
7
|
-
|
|
8
|
-
export type DesktopPersonalization = {
|
|
9
|
-
windowSurface: DesktopWindowSurface
|
|
10
|
-
/** Used when windowSurface is solid (CSS color string). */
|
|
11
|
-
windowTint: string
|
|
12
|
-
appearance: DesktopAppearance
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const defaultDesktopPersonalization: DesktopPersonalization = {
|
|
16
|
-
windowSurface: 'acrylic',
|
|
17
|
-
windowTint: '#2d2d30',
|
|
18
|
-
appearance: 'dark',
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function mergePersonalization(
|
|
22
|
-
raw: Partial<DesktopPersonalization> | undefined | null,
|
|
23
|
-
): DesktopPersonalization {
|
|
24
|
-
const windowSurface =
|
|
25
|
-
raw?.windowSurface === 'solid' || raw?.windowSurface === 'acrylic'
|
|
26
|
-
? raw.windowSurface
|
|
27
|
-
: defaultDesktopPersonalization.windowSurface
|
|
28
|
-
const appearance =
|
|
29
|
-
raw?.appearance === 'light' || raw?.appearance === 'dark'
|
|
30
|
-
? raw.appearance
|
|
31
|
-
: defaultDesktopPersonalization.appearance
|
|
32
|
-
const tint =
|
|
33
|
-
typeof raw?.windowTint === 'string' && raw.windowTint.trim()
|
|
34
|
-
? raw.windowTint.trim()
|
|
35
|
-
: defaultDesktopPersonalization.windowTint
|
|
36
|
-
return { windowSurface, windowTint: tint, appearance }
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export const useDesktopStore = defineStore(
|
|
40
|
-
'owd/desktop',
|
|
41
|
-
() => {
|
|
42
|
-
const state = ref<{
|
|
43
|
-
workspace: {
|
|
44
|
-
overview: boolean
|
|
45
|
-
active: string
|
|
46
|
-
list: string[]
|
|
47
|
-
}
|
|
48
|
-
volume: {
|
|
49
|
-
master: number
|
|
50
|
-
}
|
|
51
|
-
window: {
|
|
52
|
-
positionZ: number
|
|
53
|
-
}
|
|
54
|
-
defaultApps: Record<string, { applicationId: string; entry: string }>
|
|
55
|
-
personalization: DesktopPersonalization
|
|
56
|
-
}>({
|
|
57
|
-
workspace: {
|
|
58
|
-
overview: false,
|
|
59
|
-
active: '',
|
|
60
|
-
list: [],
|
|
61
|
-
},
|
|
62
|
-
volume: {
|
|
63
|
-
master: 100,
|
|
64
|
-
},
|
|
65
|
-
window: {
|
|
66
|
-
positionZ: 0,
|
|
67
|
-
},
|
|
68
|
-
defaultApps: {},
|
|
69
|
-
personalization: { ...defaultDesktopPersonalization },
|
|
70
|
-
})
|
|
71
|
-
|
|
72
|
-
function setWindowSurface(value: DesktopWindowSurface) {
|
|
73
|
-
const base = mergePersonalization(state.value.personalization)
|
|
74
|
-
state.value.personalization = mergePersonalization({
|
|
75
|
-
...base,
|
|
76
|
-
windowSurface: value,
|
|
77
|
-
})
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function setWindowTint(value: string) {
|
|
81
|
-
const v = value.trim()
|
|
82
|
-
if (!v) return
|
|
83
|
-
const base = mergePersonalization(state.value.personalization)
|
|
84
|
-
state.value.personalization = mergePersonalization({
|
|
85
|
-
...base,
|
|
86
|
-
windowTint: v,
|
|
87
|
-
})
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function setAppearance(value: DesktopAppearance) {
|
|
91
|
-
const base = mergePersonalization(state.value.personalization)
|
|
92
|
-
state.value.personalization = mergePersonalization({
|
|
93
|
-
...base,
|
|
94
|
-
appearance: value,
|
|
95
|
-
})
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return {
|
|
99
|
-
state,
|
|
100
|
-
setWindowSurface,
|
|
101
|
-
setWindowTint,
|
|
102
|
-
setAppearance,
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
// @ts-expect-error
|
|
107
|
-
persistedState: {
|
|
108
|
-
persist: true,
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
)
|