@owdproject/nuxt-kit-nuxt-ui 0.0.0-stage → 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/dist/module.d.mts +14 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +90 -0
- package/dist/runtime/components/dialogs/NuxtUIAlertModal.d.vue.ts +8 -0
- package/dist/runtime/components/dialogs/NuxtUIAlertModal.vue +40 -0
- package/dist/runtime/components/dialogs/NuxtUIAlertModal.vue.d.ts +8 -0
- package/dist/runtime/components/dialogs/NuxtUIConfirmModal.d.vue.ts +12 -0
- package/dist/runtime/components/dialogs/NuxtUIConfirmModal.vue +47 -0
- package/dist/runtime/components/dialogs/NuxtUIConfirmModal.vue.d.ts +12 -0
- package/dist/runtime/components/explorer/AddressBar.d.vue.ts +17 -0
- package/dist/runtime/components/explorer/AddressBar.vue +39 -0
- package/dist/runtime/components/explorer/AddressBar.vue.d.ts +17 -0
- package/dist/runtime/components/explorer/Chrome.d.vue.ts +13 -0
- package/dist/runtime/components/explorer/Chrome.vue +5 -0
- package/dist/runtime/components/explorer/Chrome.vue.d.ts +13 -0
- package/dist/runtime/components/explorer/DefaultToolbar.d.vue.ts +31 -0
- package/dist/runtime/components/explorer/DefaultToolbar.vue +92 -0
- package/dist/runtime/components/explorer/DefaultToolbar.vue.d.ts +31 -0
- package/dist/runtime/components/explorer/FileContextMenu.d.vue.ts +18 -0
- package/dist/runtime/components/explorer/FileContextMenu.vue +90 -0
- package/dist/runtime/components/explorer/FileContextMenu.vue.d.ts +18 -0
- package/dist/runtime/components/explorer/FileEntry.d.vue.ts +109 -0
- package/dist/runtime/components/explorer/FileEntry.vue +263 -0
- package/dist/runtime/components/explorer/FileEntry.vue.d.ts +109 -0
- package/dist/runtime/components/explorer/FileIcon.d.vue.ts +29 -0
- package/dist/runtime/components/explorer/FileIcon.vue +41 -0
- package/dist/runtime/components/explorer/FileIcon.vue.d.ts +29 -0
- package/dist/runtime/components/explorer/FilePane.d.vue.ts +13 -0
- package/dist/runtime/components/explorer/FilePane.vue +5 -0
- package/dist/runtime/components/explorer/FilePane.vue.d.ts +13 -0
- package/dist/runtime/components/explorer/Frame.d.vue.ts +75 -0
- package/dist/runtime/components/explorer/Frame.vue +73 -0
- package/dist/runtime/components/explorer/Frame.vue.d.ts +75 -0
- package/dist/runtime/components/explorer/Nav.d.vue.ts +17 -0
- package/dist/runtime/components/explorer/Nav.vue +83 -0
- package/dist/runtime/components/explorer/Nav.vue.d.ts +17 -0
- package/dist/runtime/components/explorer/SelectableArea.d.vue.ts +33 -0
- package/dist/runtime/components/explorer/SelectableArea.vue +83 -0
- package/dist/runtime/components/explorer/SelectableArea.vue.d.ts +33 -0
- package/dist/runtime/components/explorer/Workspace.d.vue.ts +24 -0
- package/dist/runtime/components/explorer/Workspace.vue +116 -0
- package/dist/runtime/components/explorer/Workspace.vue.d.ts +24 -0
- package/dist/runtime/dialogs/createDesktopDialogs.d.ts +2 -0
- package/dist/runtime/dialogs/createDesktopDialogs.js +47 -0
- package/dist/runtime/plugins/01.desktop-nuxt-ui-dialogs.client.d.ts +2 -0
- package/dist/runtime/plugins/01.desktop-nuxt-ui-dialogs.client.js +13 -0
- package/dist/types.d.mts +9 -0
- package/package.json +78 -4
- package/src/kit/registerTailwindPath.ts +44 -0
- package/src/runtime/components/dialogs/NuxtUIAlertModal.vue +42 -0
- package/src/runtime/components/dialogs/NuxtUIConfirmModal.vue +49 -0
- package/src/runtime/components/explorer/AddressBar.vue +44 -0
- package/src/runtime/components/explorer/Chrome.vue +5 -0
- package/src/runtime/components/explorer/DefaultToolbar.vue +92 -0
- package/src/runtime/components/explorer/FileContextMenu.vue +99 -0
- package/src/runtime/components/explorer/FileEntry.vue +286 -0
- package/src/runtime/components/explorer/FileIcon.vue +43 -0
- package/src/runtime/components/explorer/FilePane.vue +5 -0
- package/src/runtime/components/explorer/Frame.vue +106 -0
- package/src/runtime/components/explorer/Nav.vue +87 -0
- package/src/runtime/components/explorer/SelectableArea.vue +93 -0
- package/src/runtime/components/explorer/Workspace.vue +119 -0
- package/src/runtime/dialogs/createDesktopDialogs.ts +56 -0
- package/src/runtime/plugins/01.desktop-nuxt-ui-dialogs.client.ts +14 -0
- package/README.md +0 -3
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useExplorerWindow } from '@owdproject/nuxt-module-fs/runtime/composables/useExplorerWindow'
|
|
3
|
+
import { useI18n } from 'vue-i18n'
|
|
4
|
+
import { explorerEntryAbsolutePath } from '@owdproject/nuxt-module-fs/runtime/utils/utilExplorerEntryPath'
|
|
5
|
+
import { computed } from 'vue'
|
|
6
|
+
import Frame from './Frame.vue'
|
|
7
|
+
import Chrome from './Chrome.vue'
|
|
8
|
+
import FilePane from './FilePane.vue'
|
|
9
|
+
import AddressBar from './AddressBar.vue'
|
|
10
|
+
import DefaultToolbar from './presets/DefaultToolbar.vue'
|
|
11
|
+
|
|
12
|
+
const props = defineProps<{
|
|
13
|
+
config?: Record<string, any>
|
|
14
|
+
window: Record<string, any>
|
|
15
|
+
frameClass?: string
|
|
16
|
+
}>()
|
|
17
|
+
|
|
18
|
+
const { t } = useI18n()
|
|
19
|
+
const fsExplorer = useExplorerWindow(props.window as any, t)
|
|
20
|
+
props.window.fsExplorer = fsExplorer
|
|
21
|
+
void fsExplorer.initialize()
|
|
22
|
+
|
|
23
|
+
function mapMenuItems(items: any[]) {
|
|
24
|
+
if (!items) return []
|
|
25
|
+
return [
|
|
26
|
+
items.map(subItem => ({
|
|
27
|
+
label: subItem.label,
|
|
28
|
+
icon: subItem.icon,
|
|
29
|
+
click: () => {
|
|
30
|
+
if (typeof subItem.command === 'function') {
|
|
31
|
+
subItem.command()
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}))
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<template>
|
|
40
|
+
<Frame
|
|
41
|
+
:window="window"
|
|
42
|
+
:frame-class="frameClass"
|
|
43
|
+
>
|
|
44
|
+
<template v-if="$slots.nav" v-slot:nav>
|
|
45
|
+
<slot name="nav" />
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<Chrome>
|
|
49
|
+
<!-- Menu bar row -->
|
|
50
|
+
<div v-if="window.menu && window.menu.length > 0" class="flex items-center space-x-1 px-2 py-1 bg-gray-50 dark:bg-gray-900 border-b border-gray-200 dark:border-gray-800 flex-shrink-0">
|
|
51
|
+
<UDropdown
|
|
52
|
+
v-for="menu of window.menu"
|
|
53
|
+
:key="menu.label"
|
|
54
|
+
:items="mapMenuItems(menu.items)"
|
|
55
|
+
:popper="{ placement: 'bottom-start' }"
|
|
56
|
+
>
|
|
57
|
+
<UButton
|
|
58
|
+
color="gray"
|
|
59
|
+
variant="ghost"
|
|
60
|
+
size="xs"
|
|
61
|
+
class="text-xs font-medium py-1 px-2"
|
|
62
|
+
>
|
|
63
|
+
{{ menu.label }}
|
|
64
|
+
</UButton>
|
|
65
|
+
</UDropdown>
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
<slot name="toolbar">
|
|
69
|
+
<DefaultToolbar
|
|
70
|
+
:arrows-disabled="fsExplorer.fsDirectoryNavigation.history.value.length <= 1"
|
|
71
|
+
@back="fsExplorer.directoryBack"
|
|
72
|
+
@forward="fsExplorer.directoryForward"
|
|
73
|
+
@up="fsExplorer.directoryUp"
|
|
74
|
+
@cut="fsExplorer.cutSelectedFiles"
|
|
75
|
+
@copy="fsExplorer.copySelectedFiles"
|
|
76
|
+
@paste="() => fsExplorer.fsController?.pasteClipboardFiles()"
|
|
77
|
+
@delete="() => fsExplorer.fsController?.deleteSelectedFiles()"
|
|
78
|
+
@properties="fsExplorer.fileProperties"
|
|
79
|
+
/>
|
|
80
|
+
</slot>
|
|
81
|
+
|
|
82
|
+
<slot name="address">
|
|
83
|
+
<AddressBar
|
|
84
|
+
:address="fsExplorer.basePath.value ?? ''"
|
|
85
|
+
@update:model-value="(value) => {
|
|
86
|
+
fsExplorer.basePath.value = value
|
|
87
|
+
}"
|
|
88
|
+
/>
|
|
89
|
+
</slot>
|
|
90
|
+
|
|
91
|
+
<slot name="file-pane">
|
|
92
|
+
<FilePane>
|
|
93
|
+
<DesktopExplorerSelectableArea
|
|
94
|
+
v-if="!String(window.meta.path ?? '').startsWith('http')"
|
|
95
|
+
:fs-explorer="fsExplorer"
|
|
96
|
+
>
|
|
97
|
+
<DesktopExplorerFileEntry
|
|
98
|
+
v-for="fileName of fsExplorer.fsEntries.value"
|
|
99
|
+
:key="fileName"
|
|
100
|
+
:data-filename="fileName"
|
|
101
|
+
:basePath="fsExplorer.basePath.value"
|
|
102
|
+
:fileName="fileName"
|
|
103
|
+
:layout="fsExplorer.layout.value"
|
|
104
|
+
:selected="fsExplorer.selectedFiles.value.includes(explorerEntryAbsolutePath(fsExplorer.basePath.value, fileName))"
|
|
105
|
+
:cutted="fsExplorer.fsClipboard.clipboardFiles.value.includes(explorerEntryAbsolutePath(fsExplorer.basePath.value, fileName)) && fsExplorer.fsClipboard.clipboardType.value === 'cut'"
|
|
106
|
+
:window="window"
|
|
107
|
+
/>
|
|
108
|
+
</DesktopExplorerSelectableArea>
|
|
109
|
+
<iframe
|
|
110
|
+
v-else
|
|
111
|
+
class="w-full h-full border-0"
|
|
112
|
+
:src="window.meta.path ?? ''"
|
|
113
|
+
:style="{ pointerEvents: window?.state?.focused ? 'auto' : 'none' }"
|
|
114
|
+
/>
|
|
115
|
+
</FilePane>
|
|
116
|
+
</slot>
|
|
117
|
+
</Chrome>
|
|
118
|
+
</Frame>
|
|
119
|
+
</template>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useModal } from '#imports'
|
|
2
|
+
import NuxtUIConfirmModal from '../components/dialogs/NuxtUIConfirmModal.vue'
|
|
3
|
+
import NuxtUIAlertModal from '../components/dialogs/NuxtUIAlertModal.vue'
|
|
4
|
+
import type {
|
|
5
|
+
DesktopConfirmDialogOptions,
|
|
6
|
+
DesktopDialogProvider,
|
|
7
|
+
} from '@owdproject/nuxt/runtime/dialogs/desktopDialogProvider'
|
|
8
|
+
|
|
9
|
+
export function createDesktopDialogs(): DesktopDialogProvider {
|
|
10
|
+
return {
|
|
11
|
+
confirm(opts: DesktopConfirmDialogOptions): Promise<boolean> {
|
|
12
|
+
return new Promise((resolve) => {
|
|
13
|
+
const modal = useModal()
|
|
14
|
+
const toTrash = opts.extras?.toTrash
|
|
15
|
+
|
|
16
|
+
modal.open(NuxtUIConfirmModal, {
|
|
17
|
+
title: opts.title ?? 'Confirm',
|
|
18
|
+
message: typeof opts.message === 'string' ? opts.message : opts.message?.message ?? '',
|
|
19
|
+
acceptLabel: opts.acceptLabel ?? 'OK',
|
|
20
|
+
rejectLabel: opts.rejectLabel ?? 'Cancel',
|
|
21
|
+
toTrash: !!toTrash,
|
|
22
|
+
onSuccess: () => {
|
|
23
|
+
modal.close()
|
|
24
|
+
resolve(true)
|
|
25
|
+
},
|
|
26
|
+
onCancel: () => {
|
|
27
|
+
modal.close()
|
|
28
|
+
resolve(false)
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
},
|
|
33
|
+
alert(message: string, options?: { title?: string }): Promise<void> {
|
|
34
|
+
return new Promise((resolve) => {
|
|
35
|
+
const modal = useModal()
|
|
36
|
+
modal.open(NuxtUIAlertModal, {
|
|
37
|
+
title: options?.title ?? 'Alert',
|
|
38
|
+
message,
|
|
39
|
+
onSuccess: () => {
|
|
40
|
+
modal.close()
|
|
41
|
+
resolve()
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
})
|
|
45
|
+
},
|
|
46
|
+
prompt(message: string, defaultValue = '') {
|
|
47
|
+
if (import.meta.server) return Promise.resolve(null)
|
|
48
|
+
const g = globalThis as typeof globalThis & {
|
|
49
|
+
prompt?: (m?: string, d?: string) => string | null
|
|
50
|
+
}
|
|
51
|
+
const v =
|
|
52
|
+
typeof g.prompt === 'function' ? g.prompt(message, defaultValue) : null
|
|
53
|
+
return Promise.resolve(v === null ? null : v)
|
|
54
|
+
},
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineNuxtPlugin } from 'nuxt/app'
|
|
2
|
+
import { DESKTOP_DIALOG_PROVIDER_KEY } from '@owdproject/nuxt/runtime/constants/desktopShellKeys'
|
|
3
|
+
import { createDesktopDialogs } from '../dialogs/createDesktopDialogs'
|
|
4
|
+
|
|
5
|
+
export default defineNuxtPlugin({
|
|
6
|
+
name: 'owd-kit-nuxt-ui-dialogs',
|
|
7
|
+
enforce: 'pre',
|
|
8
|
+
setup(nuxtApp) {
|
|
9
|
+
nuxtApp.vueApp.provide(
|
|
10
|
+
DESKTOP_DIALOG_PROVIDER_KEY,
|
|
11
|
+
createDesktopDialogs(),
|
|
12
|
+
)
|
|
13
|
+
},
|
|
14
|
+
})
|
package/README.md
DELETED