@nuxt/devtools 0.7.6 → 0.8.1
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/dist/chunks/module-main.mjs +185 -6171
- package/dist/chunks/vscode.mjs +4 -5
- package/dist/client/200.html +37 -2
- package/dist/client/404.html +37 -2
- package/dist/client/__blank/index.html +37 -2
- package/dist/client/_nuxt/{Badge.f2e9b29c.js → Badge.2520e67e.js} +1 -1
- package/dist/client/_nuxt/{CodeDiff.vue.9b0b0885.js → CodeDiff.vue.978c6a6f.js} +2 -2
- package/dist/client/_nuxt/{ComposableItem.vue.3f961e9e.js → ComposableItem.vue.2d866a7f.js} +1 -1
- package/dist/client/_nuxt/{DataSchemaButton.vue.a6df5cb8.js → DataSchemaButton.vue.900aabf0.js} +1 -1
- package/dist/client/_nuxt/{DataSchemaDrawer.be265d1e.js → DataSchemaDrawer.01ce7a66.js} +100 -100
- package/dist/client/_nuxt/{DrawerRight.vue.92472251.js → DrawerRight.vue.5715b906.js} +1 -1
- package/dist/client/_nuxt/{DurationDisplay.vue.ebef3eee.js → DurationDisplay.vue.700f989f.js} +1 -1
- package/dist/client/_nuxt/FilepathItem.vue.6f5b0e95.js +1 -0
- package/dist/client/_nuxt/{HelpFab.vue.4d768974.js → HelpFab.vue.8daa9789.js} +1 -1
- package/dist/client/_nuxt/{LaunchPage.vue.c2e514b2.js → LaunchPage.vue.7c46fca6.js} +1 -1
- package/dist/client/_nuxt/{NCheckbox.vue.78fd8d82.js → NCheckbox.vue.e0da702b.js} +1 -1
- package/dist/client/_nuxt/{NCodeBlock.vue.c7ed33b1.js → NCodeBlock.vue.070d4546.js} +1 -1
- package/dist/client/_nuxt/{NDropdown.vue.c7f63cd6.js → NDropdown.vue.13a95889.js} +1 -1
- package/dist/client/_nuxt/{NIconTitle.vue.2f7c2128.js → NIconTitle.vue.1a740209.js} +1 -1
- package/dist/client/_nuxt/{NLink.vue.3fcc5a37.js → NLink.vue.4d6f9b4a.js} +1 -1
- package/dist/client/_nuxt/{NMarkdown.vue.e4405095.js → NMarkdown.vue.ac2cc78f.js} +1 -1
- package/dist/client/_nuxt/{NSectionBlock.9c411590.js → NSectionBlock.9ba1ed51.js} +1 -1
- package/dist/client/_nuxt/NSelect.vue.50512422.js +1 -0
- package/dist/client/_nuxt/NSelectTabs.vue.f9f19824.js +1 -0
- package/dist/client/_nuxt/{NSwitch.vue.defcd586.js → NSwitch.vue.687752dc.js} +1 -1
- package/dist/client/_nuxt/{NTip.vue.04791b31.js → NTip.vue.e10afe8f.js} +1 -1
- package/dist/client/_nuxt/{Navbar.vue.3fbf7ca0.js → Navbar.vue.6532550c.js} +1 -1
- package/dist/client/_nuxt/{StateEditor.vue.01c203b9.js → StateEditor.vue.f97aa771.js} +1 -1
- package/dist/client/_nuxt/{__blank.3dddd973.js → __blank.5a331261.js} +1 -1
- package/dist/client/_nuxt/{analyze-build.3db956f4.js → analyze-build.72962dac.js} +1 -1
- package/dist/client/_nuxt/assets.44d4e864.js +16 -0
- package/dist/client/_nuxt/{client.d5aff798.js → client.20a78c8d.js} +1 -1
- package/dist/client/_nuxt/{components.e360f866.js → components.19031b9b.js} +32 -32
- package/dist/client/_nuxt/css.5abce139.js +501 -0
- package/dist/client/_nuxt/{custom-_name_.95236ea5.js → custom-_name_.72163621.js} +1 -1
- package/dist/client/_nuxt/{default.8f859e18.js → default.7fafc9ad.js} +1 -1
- package/dist/client/_nuxt/diff.22e0b108.js +1 -0
- package/dist/client/_nuxt/entry.a2a7b315.css +1 -0
- package/dist/client/_nuxt/entry.ecba488a.js +27 -0
- package/dist/client/_nuxt/error-404.6a1d031f.js +1 -0
- package/dist/client/_nuxt/error-404.82ac0ec5.css +1 -0
- package/dist/client/_nuxt/{error-500.3f0ba72e.js → error-500.6ecf4027.js} +1 -1
- package/dist/client/_nuxt/error-500.ff959f66.css +1 -0
- package/dist/client/_nuxt/{full.778b4958.js → full.70864884.js} +1 -1
- package/dist/client/_nuxt/{hooks.22b55b1c.js → hooks.8f58bab5.js} +1 -1
- package/dist/client/_nuxt/html.66e44e78.js +74 -0
- package/dist/client/_nuxt/imports.e2b0659c.js +1 -0
- package/dist/client/_nuxt/{index.622264a3.js → index.0580e715.js} +1 -1
- package/dist/client/_nuxt/{index.76729ecb.js → index.a42dc69d.js} +1 -1
- package/dist/client/_nuxt/javascript.ddb4c460.js +699 -0
- package/dist/client/_nuxt/json-editor-vue.daaf9bf6.js +130 -0
- package/dist/client/_nuxt/json.709f1c4d.js +25 -0
- package/dist/client/_nuxt/{middleware.f7a35d95.js → middleware.74529e65.js} +1 -1
- package/dist/client/_nuxt/{modules.15421639.js → modules.33fc5088.js} +2 -2
- package/dist/client/_nuxt/{none.3d88124b.js → none.8eb9bb52.js} +1 -1
- package/dist/client/_nuxt/onig.0c57a370.js +1 -0
- package/dist/client/_nuxt/{open-graph.73aa4a70.js → open-graph.17155ec0.js} +2 -2
- package/dist/client/_nuxt/overview.d7fae067.js +1 -0
- package/dist/client/_nuxt/{pages.7e22d9e3.js → pages.547750e8.js} +1 -1
- package/dist/client/_nuxt/{payload.cc8ba563.js → payload.8e277da6.js} +1 -1
- package/dist/client/_nuxt/{plugins.b4d83e48.js → plugins.555a2eb4.js} +1 -1
- package/dist/client/_nuxt/runtime-configs.949fefd1.js +1 -0
- package/dist/client/_nuxt/server-routes.e6b60f13.js +9 -0
- package/dist/client/_nuxt/settings.8eec4b34.js +1 -0
- package/dist/client/_nuxt/shellscript.3d8bff4d.js +4 -0
- package/dist/client/_nuxt/{state-components.c65acb0d.js → state-components.58a8ab6e.js} +1 -1
- package/dist/client/_nuxt/{state-modules.e0b57d1b.js → state-modules.b446bb25.js} +1 -1
- package/dist/client/_nuxt/{storage-options.f095012b.js → storage-options.bdca1e26.js} +1 -1
- package/dist/client/_nuxt/{storage.81e195cf.js → storage.2e03df22.js} +1 -1
- package/dist/client/_nuxt/{terminals.57b44373.js → terminals.d42a6ee5.js} +1 -1
- package/dist/client/_nuxt/timeline.bac8e997.js +57 -0
- package/dist/client/_nuxt/typescript.3ef79501.js +666 -0
- package/dist/client/_nuxt/unocss-runtime.dc09e3b2.js +2 -0
- package/dist/client/_nuxt/{virtual-files.02aedd29.js → virtual-files.56c1d2cb.js} +1 -1
- package/dist/client/_nuxt/vitesse-dark.ab479e3d.js +1 -0
- package/dist/client/_nuxt/vitesse-light.696edcfd.js +1 -0
- package/dist/client/_nuxt/vue-html.b80b464f.js +1 -0
- package/dist/client/_nuxt/vue.5b4e1de3.js +1844 -0
- package/dist/client/_nuxt/yaml.b29e536f.js +200 -0
- package/dist/client/index.html +37 -2
- package/dist/client/modules/analyze-build/index.html +37 -2
- package/dist/client/modules/assets/index.html +37 -2
- package/dist/client/modules/components/index.html +37 -2
- package/dist/client/modules/hooks/index.html +37 -2
- package/dist/client/modules/imports/index.html +37 -2
- package/dist/client/modules/middleware/index.html +37 -2
- package/dist/client/modules/modules/index.html +37 -2
- package/dist/client/modules/open-graph/index.html +37 -2
- package/dist/client/modules/overview/index.html +37 -2
- package/dist/client/modules/pages/index.html +37 -2
- package/dist/client/modules/payload/index.html +37 -2
- package/dist/client/modules/plugins/index.html +37 -2
- package/dist/client/modules/runtime-configs/index.html +37 -2
- package/dist/client/modules/server-routes/index.html +37 -2
- package/dist/client/modules/storage/index.html +37 -2
- package/dist/client/modules/terminals/index.html +37 -2
- package/dist/client/modules/timeline/index.html +37 -2
- package/dist/client/modules/virtual-files/index.html +37 -2
- package/dist/client/settings/index.html +37 -2
- package/dist/{global-ea55645c.d.ts → global-2a48a9e5.d.ts} +5 -1
- package/dist/module.d.ts +1 -1
- package/dist/module.json +1 -1
- package/dist/runtime/plugins/view/FrameBox.vue +1 -1
- package/dist/runtime/plugins/view/Main.vue +8 -3
- package/dist/runtime/plugins/view/client.mjs +72 -45
- package/dist/runtime/use-nuxt-devtools.d.ts +8 -0
- package/dist/runtime/use-nuxt-devtools.mjs +23 -0
- package/dist/types.d.ts +1 -1
- package/package.json +35 -37
- package/dist/client/_nuxt/FilepathItem.vue.a967b383.js +0 -1
- package/dist/client/_nuxt/NSelect.vue.7a8edc85.js +0 -1
- package/dist/client/_nuxt/assets.634c950e.js +0 -16
- package/dist/client/_nuxt/entry.2ee3a83f.css +0 -1
- package/dist/client/_nuxt/entry.b81bf245.js +0 -21
- package/dist/client/_nuxt/error-404.50ed5273.js +0 -1
- package/dist/client/_nuxt/error-404.91003ceb.css +0 -1
- package/dist/client/_nuxt/error-500.7e02f53c.css +0 -1
- package/dist/client/_nuxt/imports.2a0fb129.js +0 -1
- package/dist/client/_nuxt/json-editor-vue.58ea58a4.js +0 -137
- package/dist/client/_nuxt/overview.0aabd2ca.js +0 -1
- package/dist/client/_nuxt/runtime-configs.15955414.js +0 -1
- package/dist/client/_nuxt/server-routes.10f98ec2.js +0 -9
- package/dist/client/_nuxt/settings.b2b35d44.js +0 -1
- package/dist/client/_nuxt/timeline.e3f428d4.js +0 -57
- package/dist/client/_nuxt/unocss-runtime.2f2f07ae.js +0 -2
|
@@ -18,52 +18,72 @@ export async function setupDevToolsClient({
|
|
|
18
18
|
const timeline = initTimelineMetrics();
|
|
19
19
|
const client = shallowReactive({
|
|
20
20
|
nuxt: markRaw(nuxt),
|
|
21
|
-
appConfig: useAppConfig(),
|
|
22
21
|
hooks: createHooks(),
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
popupWindow.value
|
|
43
|
-
} catch (e) {
|
|
22
|
+
inspector: getInspectorInstance(),
|
|
23
|
+
getIframe,
|
|
24
|
+
syncClient,
|
|
25
|
+
devtools: {
|
|
26
|
+
toggle() {
|
|
27
|
+
if (state.value.open)
|
|
28
|
+
client.devtools.close();
|
|
29
|
+
else
|
|
30
|
+
client.devtools.open();
|
|
31
|
+
},
|
|
32
|
+
close() {
|
|
33
|
+
if (!state.value.open)
|
|
34
|
+
return;
|
|
35
|
+
state.value.open = false;
|
|
36
|
+
if (popupWindow.value) {
|
|
37
|
+
try {
|
|
38
|
+
popupWindow.value.close();
|
|
39
|
+
} catch (e) {
|
|
40
|
+
}
|
|
41
|
+
popupWindow.value = null;
|
|
44
42
|
}
|
|
45
|
-
|
|
43
|
+
},
|
|
44
|
+
open() {
|
|
45
|
+
if (state.value.open)
|
|
46
|
+
return;
|
|
47
|
+
state.value.open = true;
|
|
48
|
+
return nextTick(() => {
|
|
49
|
+
client.syncClient();
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
async navigate(path) {
|
|
53
|
+
if (!state.value.open)
|
|
54
|
+
await client.devtools.open();
|
|
55
|
+
await client.hooks.callHook("host:action:navigate", path);
|
|
56
|
+
},
|
|
57
|
+
async reload() {
|
|
58
|
+
await client.hooks.callHook("host:action:reload");
|
|
46
59
|
}
|
|
47
60
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
61
|
+
app: {
|
|
62
|
+
appConfig: useAppConfig(),
|
|
63
|
+
reload() {
|
|
64
|
+
location.reload();
|
|
65
|
+
},
|
|
66
|
+
navigate(path, hard = false) {
|
|
67
|
+
if (hard)
|
|
68
|
+
location.href = path;
|
|
69
|
+
else
|
|
70
|
+
router.push(path);
|
|
71
|
+
},
|
|
72
|
+
colorMode,
|
|
73
|
+
frameState: state
|
|
55
74
|
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
75
|
+
metrics: {
|
|
76
|
+
clientPlugins: () => window.__NUXT_DEVTOOLS_PLUGINS_METRIC__,
|
|
77
|
+
clientHooks: () => Object.values(clientHooks),
|
|
78
|
+
clientTimeline: () => timeline,
|
|
79
|
+
loading: () => timeMetric
|
|
80
|
+
}
|
|
61
81
|
});
|
|
82
|
+
window.__NUXT_DEVTOOLS_HOST__ = client;
|
|
62
83
|
let iframe;
|
|
63
|
-
function
|
|
84
|
+
function syncClient() {
|
|
64
85
|
if (!client.inspector)
|
|
65
86
|
client.inspector = getInspectorInstance();
|
|
66
|
-
client.clientPluginMetrics = window.__NUXT_DEVTOOLS_PLUGINS_METRIC__;
|
|
67
87
|
try {
|
|
68
88
|
iframe?.contentWindow?.__NUXT_DEVTOOLS_VIEW__?.setClient(client);
|
|
69
89
|
} catch (e) {
|
|
@@ -79,8 +99,13 @@ export async function setupDevToolsClient({
|
|
|
79
99
|
iframe.id = "nuxt-devtools-iframe";
|
|
80
100
|
iframe.src = initialUrl;
|
|
81
101
|
iframe.onload = async () => {
|
|
82
|
-
|
|
83
|
-
|
|
102
|
+
try {
|
|
103
|
+
await waitForClientInjection();
|
|
104
|
+
client.syncClient();
|
|
105
|
+
} catch (e) {
|
|
106
|
+
console.error("Nuxt DevTools client injection failed");
|
|
107
|
+
console.error(e);
|
|
108
|
+
}
|
|
84
109
|
};
|
|
85
110
|
} catch (e) {
|
|
86
111
|
console.error(e);
|
|
@@ -89,10 +114,12 @@ export async function setupDevToolsClient({
|
|
|
89
114
|
return iframe;
|
|
90
115
|
}
|
|
91
116
|
function waitForClientInjection(retry = 10, timeout = 200) {
|
|
117
|
+
let lastError;
|
|
92
118
|
const test = () => {
|
|
93
119
|
try {
|
|
94
120
|
return !!iframe?.contentWindow?.__NUXT_DEVTOOLS_VIEW__;
|
|
95
121
|
} catch (e) {
|
|
122
|
+
lastError = e;
|
|
96
123
|
}
|
|
97
124
|
return false;
|
|
98
125
|
};
|
|
@@ -105,7 +132,7 @@ export async function setupDevToolsClient({
|
|
|
105
132
|
resolve();
|
|
106
133
|
} else if (retry-- <= 0) {
|
|
107
134
|
clearInterval(interval);
|
|
108
|
-
reject(
|
|
135
|
+
reject(lastError);
|
|
109
136
|
}
|
|
110
137
|
}, timeout);
|
|
111
138
|
});
|
|
@@ -153,7 +180,7 @@ export async function setupDevToolsClient({
|
|
|
153
180
|
clientRef.value = client;
|
|
154
181
|
const documentPictureInPicture = window.documentPictureInPicture;
|
|
155
182
|
if (documentPictureInPicture?.requestWindow) {
|
|
156
|
-
client.popup = async () => {
|
|
183
|
+
client.devtools.popup = async () => {
|
|
157
184
|
const iframe2 = getIframe();
|
|
158
185
|
if (!iframe2)
|
|
159
186
|
return;
|
|
@@ -189,14 +216,14 @@ export async function setupDevToolsClient({
|
|
|
189
216
|
});
|
|
190
217
|
};
|
|
191
218
|
}
|
|
192
|
-
client.
|
|
219
|
+
client.syncClient();
|
|
193
220
|
const holder = document.createElement("div");
|
|
194
221
|
holder.id = "nuxt-devtools-container";
|
|
195
222
|
holder.setAttribute("data-v-inspector-ignore", "true");
|
|
196
223
|
document.body.appendChild(holder);
|
|
197
224
|
addEventListener("keydown", (e) => {
|
|
198
225
|
if (e.code === "KeyD" && e.altKey && e.shiftKey)
|
|
199
|
-
client.toggle();
|
|
226
|
+
client.devtools.toggle();
|
|
200
227
|
});
|
|
201
228
|
const app = createApp({
|
|
202
229
|
render: () => h(Main, { client }),
|
|
@@ -284,8 +311,8 @@ function setupReactivity(client, router, timeMetric) {
|
|
|
284
311
|
}, 100, { trailing: true });
|
|
285
312
|
watch(() => [
|
|
286
313
|
client.nuxt.payload,
|
|
287
|
-
client.colorMode.value,
|
|
288
|
-
client.
|
|
314
|
+
client.app.colorMode.value,
|
|
315
|
+
client.metrics.loading(),
|
|
289
316
|
timeMetric
|
|
290
317
|
], () => {
|
|
291
318
|
refreshReactivity();
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import type { NuxtDevtoolsHostClient } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Get Nuxt DevTools client for host app
|
|
5
|
+
*
|
|
6
|
+
* Returns undefined if not in development mode or the devtools is not enabled
|
|
7
|
+
*/
|
|
8
|
+
export declare function useNuxtDevTools(): Ref<NuxtDevtoolsHostClient | undefined>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { shallowRef } from "vue";
|
|
2
|
+
export function useNuxtDevTools() {
|
|
3
|
+
const r = shallowRef();
|
|
4
|
+
if (!process.dev)
|
|
5
|
+
return r;
|
|
6
|
+
if (process.server)
|
|
7
|
+
return r;
|
|
8
|
+
if (window.__NUXT_DEVTOOLS_HOST__) {
|
|
9
|
+
r.value = window.__NUXT_DEVTOOLS_HOST__;
|
|
10
|
+
} else {
|
|
11
|
+
Object.defineProperty(window, "__NUXT_DEVTOOLS_HOST__", {
|
|
12
|
+
set(value) {
|
|
13
|
+
r.value = value;
|
|
14
|
+
},
|
|
15
|
+
get() {
|
|
16
|
+
return r.value;
|
|
17
|
+
},
|
|
18
|
+
enumerable: false,
|
|
19
|
+
configurable: true
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return r;
|
|
23
|
+
}
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/devtools",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "nuxt/devtools",
|
|
7
7
|
"exports": {
|
|
@@ -11,8 +11,7 @@
|
|
|
11
11
|
"require": "./module.cjs"
|
|
12
12
|
},
|
|
13
13
|
"./types": {
|
|
14
|
-
"types": "./dist/types.d.ts"
|
|
15
|
-
"import": "./dist/types.mjs"
|
|
14
|
+
"types": "./dist/types.d.ts"
|
|
16
15
|
},
|
|
17
16
|
"./*": "./*"
|
|
18
17
|
},
|
|
@@ -30,88 +29,87 @@
|
|
|
30
29
|
"vite": "*"
|
|
31
30
|
},
|
|
32
31
|
"dependencies": {
|
|
33
|
-
"@
|
|
34
|
-
"
|
|
32
|
+
"@antfu/utils": "^0.7.6",
|
|
33
|
+
"@nuxt/kit": "^3.7.0",
|
|
34
|
+
"birpc": "^0.2.13",
|
|
35
35
|
"boxen": "^7.1.1",
|
|
36
36
|
"consola": "^3.2.3",
|
|
37
|
-
"error-stack-parser-es": "^0.1.
|
|
37
|
+
"error-stack-parser-es": "^0.1.1",
|
|
38
38
|
"execa": "^7.2.0",
|
|
39
|
-
"fast-folder-size": "^2.
|
|
39
|
+
"fast-folder-size": "^2.2.0",
|
|
40
40
|
"fast-glob": "^3.3.1",
|
|
41
|
-
"
|
|
41
|
+
"flatted": "^3.2.7",
|
|
42
|
+
"get-port-please": "^3.0.2",
|
|
42
43
|
"global-dirs": "^3.0.1",
|
|
43
|
-
"h3": "^1.
|
|
44
|
+
"h3": "^1.8.1",
|
|
44
45
|
"hookable": "^5.5.3",
|
|
45
46
|
"image-meta": "^0.1.1",
|
|
46
47
|
"is-installed-globally": "^0.4.0",
|
|
47
48
|
"launch-editor": "^2.6.0",
|
|
48
49
|
"local-pkg": "^0.4.3",
|
|
49
50
|
"magicast": "^0.2.10",
|
|
50
|
-
"nypm": "^0.
|
|
51
|
-
"
|
|
51
|
+
"nypm": "^0.3.1",
|
|
52
|
+
"ofetch": "^1.3.3",
|
|
53
|
+
"ohash": "^1.1.3",
|
|
54
|
+
"pacote": "^17.0.3",
|
|
52
55
|
"pathe": "^1.1.1",
|
|
53
56
|
"perfect-debounce": "^1.0.0",
|
|
54
57
|
"picocolors": "^1.0.0",
|
|
55
58
|
"pkg-types": "^1.0.3",
|
|
56
59
|
"rc9": "^2.1.1",
|
|
57
60
|
"semver": "^7.5.4",
|
|
61
|
+
"simple-git": "^3.19.1",
|
|
58
62
|
"sirv": "^2.0.3",
|
|
59
|
-
"unimport": "^3.
|
|
60
|
-
"vite-plugin-inspect": "^0.7.
|
|
63
|
+
"unimport": "^3.2.0",
|
|
64
|
+
"vite-plugin-inspect": "^0.7.38",
|
|
61
65
|
"vite-plugin-vue-inspector": "^3.6.0",
|
|
62
66
|
"wait-on": "^7.0.1",
|
|
63
67
|
"which": "^3.0.1",
|
|
64
68
|
"ws": "^8.13.0",
|
|
65
|
-
"@nuxt/devtools-kit": "0.
|
|
66
|
-
"@nuxt/devtools-wizard": "0.
|
|
69
|
+
"@nuxt/devtools-kit": "0.8.1",
|
|
70
|
+
"@nuxt/devtools-wizard": "0.8.1"
|
|
67
71
|
},
|
|
68
72
|
"devDependencies": {
|
|
69
|
-
"@antfu/utils": "^0.7.5",
|
|
70
73
|
"@iconify-json/bxl": "^1.1.7",
|
|
71
|
-
"@iconify-json/carbon": "^1.1.
|
|
74
|
+
"@iconify-json/carbon": "^1.1.20",
|
|
72
75
|
"@iconify-json/logos": "^1.1.34",
|
|
73
76
|
"@iconify-json/ri": "^1.1.12",
|
|
74
|
-
"@iconify-json/simple-icons": "^1.1.
|
|
75
|
-
"@iconify-json/tabler": "^1.1.
|
|
77
|
+
"@iconify-json/simple-icons": "^1.1.68",
|
|
78
|
+
"@iconify-json/tabler": "^1.1.89",
|
|
76
79
|
"@nuxt/content": "^2.7.2",
|
|
77
80
|
"@nuxtjs/color-mode": "^3.3.0",
|
|
78
|
-
"@parcel/watcher": "^2.
|
|
81
|
+
"@parcel/watcher": "^2.3.0",
|
|
79
82
|
"@types/markdown-it-link-attributes": "^3.0.1",
|
|
80
83
|
"@types/ua-parser-js": "^0.7.36",
|
|
81
|
-
"@unocss/nuxt": "^0.
|
|
82
|
-
"@unocss/preset-icons": "^0.
|
|
83
|
-
"@unocss/preset-uno": "^0.
|
|
84
|
-
"@unocss/runtime": "^0.
|
|
85
|
-
"@vueuse/nuxt": "^10.
|
|
84
|
+
"@unocss/nuxt": "^0.55.3",
|
|
85
|
+
"@unocss/preset-icons": "^0.55.3",
|
|
86
|
+
"@unocss/preset-uno": "^0.55.3",
|
|
87
|
+
"@unocss/runtime": "^0.55.3",
|
|
88
|
+
"@vueuse/nuxt": "^10.4.1",
|
|
86
89
|
"esno": "^0.17.0",
|
|
87
|
-
"flatted": "^3.2.7",
|
|
88
90
|
"floating-vue": "2.0.0-beta.24",
|
|
89
91
|
"fuse.js": "^6.6.2",
|
|
90
92
|
"json-editor-vue": "^0.10.6",
|
|
91
93
|
"markdown-it": "^13.0.1",
|
|
92
94
|
"markdown-it-link-attributes": "^4.0.1",
|
|
93
95
|
"nanoid": "^4.0.2",
|
|
94
|
-
"nuxt": "^3.
|
|
96
|
+
"nuxt": "^3.7.0",
|
|
95
97
|
"nuxt-vitest": "^0.10.2",
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"quicktype-core": "^23.0.64",
|
|
99
|
-
"shiki": "^0.14.3",
|
|
100
|
-
"shiki-es": "^0.14.0",
|
|
101
|
-
"simple-git": "^3.19.1",
|
|
98
|
+
"quicktype-core": "^23.0.71",
|
|
99
|
+
"shikiji": "^0.6.3",
|
|
102
100
|
"splitpanes": "^3.1.5",
|
|
103
101
|
"theme-vitesse": "^0.7.2",
|
|
104
102
|
"ua-parser-js": "^1.0.35",
|
|
105
|
-
"unocss": "^0.
|
|
106
|
-
"vanilla-jsoneditor": "^0.
|
|
103
|
+
"unocss": "^0.55.3",
|
|
104
|
+
"vanilla-jsoneditor": "^0.18.2",
|
|
107
105
|
"vis-data": "^7.1.6",
|
|
108
106
|
"vis-network": "^9.1.6",
|
|
109
|
-
"vite-plugin-vue-markdown": "^0.23.
|
|
107
|
+
"vite-plugin-vue-markdown": "^0.23.8",
|
|
110
108
|
"vue-tsc": "^1.8.8",
|
|
111
109
|
"vue-virtual-scroller": "2.0.0-beta.8",
|
|
112
110
|
"xterm": "^5.2.1",
|
|
113
111
|
"xterm-addon-fit": "^0.7.0",
|
|
114
|
-
"@nuxt/devtools": "0.
|
|
112
|
+
"@nuxt/devtools": "0.8.1"
|
|
115
113
|
},
|
|
116
114
|
"scripts": {
|
|
117
115
|
"build": "pnpm dev:prepare && pnpm build:module && pnpm build:client && esno scripts/prepare.ts",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as u,a6 as f,a7 as c,a as k,b4 as v,o as t,h as y,j as B,m as s,F as p,v as d,t as n,f as a,k as C,p as N,E as b,ap as g}from"./entry.b81bf245.js";const E={key:0,op50:""},F=u({__name:"FilepathItem",props:{filepath:{},lineBreak:{type:Boolean},subpath:{type:Boolean},override:{}},setup(m){const r=m,h=f(),l=c(),o=k(()=>r.filepath&&l.value?v(r.filepath,l.value.rootDir):{path:r.filepath||""});return(e,i)=>(t(),y(g(e.filepath?"button":"span"),{class:b([e.filepath?"hover:underline":"",e.lineBreak?"":"ws-nowrap of-hidden truncate"]),"font-mono":"",title:e.override||e.filepath,onClick:i[0]||(i[0]=w=>e.filepath&&a(h)(e.filepath))},{default:B(()=>[e.override?(t(),s(p,{key:0},[d(n(e.override),1)],64)):a(o).moduleName?(t(),s(p,{key:1},[C("span",null,n(a(o).moduleName),1),e.subpath?(t(),s("span",E,n(a(o).path.slice(a(o).moduleName.length)),1)):N("",!0)],64)):(t(),s(p,{key:2},[d(n(a(o).path),1)],64))]),_:1},8,["class","title"]))}});export{F as _};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as u,a4 as p,m as l,a5 as t,H as f,bC as m,f as b,k as h,t as _,p as n,l as v,o as s,h as k,a0 as V}from"./entry.b81bf245.js";const y={class:"n-text-input flex flex items-center border n-border-base rounded px-2 py-1 focus-within:n-focus-base focus-within:border-context n-bg-base"},B=["disabled"],w={key:0,value:"",disabled:"",hidden:""},g=u({__name:"NSelect",props:{modelValue:{default:void 0},placeholder:{default:""},icon:{default:""},disabled:{type:Boolean,default:!1}},setup(d,{emit:i}){const o=p(d,"modelValue",i,{passive:!0});return(e,a)=>{const r=V;return s(),l("div",y,[t(e.$slots,"icon",{},()=>[e.icon?(s(),k(r,{key:0,icon:e.icon,class:"mr-0.4em text-1.1em op50"},null,8,["icon"])):n("",!0)]),f(h("select",{"onUpdate:modelValue":a[0]||(a[0]=c=>v(o)?o.value=c:null),disabled:e.disabled,class:"w-full flex-auto n-bg-base !outline-none"},[e.placeholder?(s(),l("option",w,_(e.placeholder),1)):n("",!0),t(e.$slots,"default")],8,B),[[m,b(o)]])])}}});export{g as _};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import{d as X,r as N,W as q,o as s,m as p,i as u,f as t,k as e,v as k,F as L,n as G,h as F,j as x,p as S,E as H,X as U,Y as me,Z as fe,J as Z,K as J,_ as te,a0 as oe,U as se,C as ae,a as A,a1 as ve,a2 as he,a3 as le,t as V,a4 as ie,a5 as _e,l as R,a6 as ge,b as ne,a7 as xe,e as we,a8 as be,a9 as re,H as W,aa as ye,ab as $e,V as ke,ac as Ce,ad as Pe,ae as Ae}from"./entry.b81bf245.js";import{_ as De}from"./Navbar.vue.3fbf7ca0.js";import{_ as Ve}from"./NSectionBlock.9c411590.js";import{_ as Ne}from"./FilepathItem.vue.a967b383.js";import{_ as Fe,u as Ie}from"./storage-options.f095012b.js";import{_ as Se}from"./DrawerRight.vue.92472251.js";import{D as Te}from"./constants.4e5eba24.js";import"./NIconTitle.vue.2f7c2128.js";import"./NCodeBlock.vue.c7ed33b1.js";import"./client.d5aff798.js";const je={key:0,"h-full":"","w-full":"",flex:"","items-center":"","justify-center":""},Ee={for:"drop-zone-input","text-3xl":""},Ue={key:1,relative:"","h-full":"","w-full":"",grid:"~ rows-[max-content_1fr_max-content]"},Be=e("div",{px6:"",py6:""},[e("h1",{"text-2xl":""}," Upload "),e("p",{"text-sm":"",op50:""}," Drag and drop files to upload ")],-1),Le={grid:"~ cols-minmax-8rem","overflow-auto":"",p6:""},ze={flex:"","items-center":"","justify-center":"","of-hidden":"",rounded:"","rounded-t-lg":"","bg-active":"","object-cover":"",class:"aspect-1/1",border:"~ base"},Me=["src"],Oe={flex:"~ gap1","items-center":""},Re={flex:"~ gap-2","items-center":"","justify-center":"",p8:""},Ke=X({__name:"DropZone",props:{folder:{type:String,required:!0}},setup(T){const l=T,d=N(!1),n=N(),m=N([]),v=["image","video"];function D(i){n.value=i.target,d.value=!0}function c(i){i.target===n.value&&(d.value=!1)}function C(i){i.preventDefault()}function K(i){i.preventDefault(),B(i.dataTransfer.files)}function B(i){const g=Array.from(i||[]);if(g.length){const _=[],P=m.value.map(f=>f.name);for(const f of g)if(P.includes(f.name)){let r=1;const[y,a]=f.name.split(".");for(;P.includes(`${y} (${r}).${a}`);)r++;const o=`${y}-${r}.${a}`,M=new Blob([f],{type:f.type}),O=new File([M],o,{lastModified:Date.now()});_.push(O),P.push(o)}else f.type===""?U({message:"Folders are not supported yet",icon:"carbon:face-dissatisfied",classes:"text-orange"}):v.some(r=>f.type.includes(r))?_.push(f):U({message:`"${f.type}" file type is not allowed`,icon:"carbon:face-dissatisfied",classes:"text-orange"});m.value=[...m.value,..._]}}async function w(){if(me.value||fe.value)return;const i=[];for(const g of m.value){const _=new FileReader;_.readAsDataURL(g);const f=(await new Promise(r=>{_.onload=()=>r(_.result)})).split(";base64,").pop();i.push({path:g.name,encoding:"base64",content:f})}await Z.writeStaticAssets(await J(),[...i],l.folder).then(()=>{j(),U({message:"Files uploaded successfully!",icon:"i-carbon:checkmark"})}).catch(g=>{console.error(g),j(),U({message:`Error uploading files: ${g}`,icon:"i-carbon-warning",classes:"text-red"})}),d.value=!1}function h(i){m.value?.splice(i,1)}function b(i){return URL.createObjectURL(i)}function z(i,g){const[_,P]=i.name.split("."),f=g.replace(/\.\w+$/,""),r=`${f}.${P}`;return f.length===0?(alert("File name must be at least 1 characters long"),_):(Object.defineProperty(i,"name",{value:r,writable:!1}),m.value.splice(m.value.indexOf(i),1,i),i)}function I(){m.value=[]}function j(){d.value=!1,I()}return q("dragenter",D),q("dragleave",c),q("dragover",C),q("drop",K),(i,g)=>{const _=te,P=oe,f=se,r=ae;return s(),p("div",{fixed:"","bottom-0":"","left-13":"","right-0":"","top-0":"","z-10":"","backdrop-blur-20":"","transition-all":"",class:H(t(d)?"opacity-100 visible":"opacity-0 invisible")},[u(_,{icon:"carbon-close",absolute:"","right-5":"","top-5":"","z-20":"","text-xl":"",onClick:j}),t(m)?.length?(s(),p("div",Ue,[Be,e("div",Le,[(s(!0),p(L,null,G(t(m),(y,a)=>(s(),p("div",{key:y.name,flex:"~ col gap-2",relative:"","h-50":"","w-40":"","items-center":""},[e("div",ze,[e("img",{"h-full":"","w-full":"","rounded-t-lg":"","object-cover":"",src:b(y)},null,8,Me)]),e("div",Oe,[u(f,{n:"xs","flex-auto":"","model-value":y.name,"onUpdate:modelValue":o=>z(y,o.target.value)},null,8,["model-value","onUpdate:modelValue"]),u(_,{icon:"carbon-delete","flex-none":"",title:"Remove file",onClick:o=>h(a)},null,8,["onClick"])])]))),128))]),e("div",Re,[t(m).length?(s(),F(r,{key:0,n:"red",onClick:I},{default:x(()=>[u(P,{icon:"carbon-clean"}),k(" Clear ")]),_:1})):S("",!0),u(r,{disabled:!t(m).length,n:"primary solid",onClick:w},{default:x(()=>[u(P,{icon:"carbon-cloud-upload"}),k(" Upload ")]),_:1},8,["disabled"])])])):(s(),p("div",je,[e("label",Ee,[u(P,{icon:"carbon-cloud-upload","mr-2":""}),k(" Drop files here or click to select ")]),e("input",{id:"drop-zone-input",type:"file",multiple:"",hidden:"",onChange:g[0]||(g[0]=y=>B(y.target.files))},null,32)]))],2)}}}),Xe=X({__name:"AssetFontPreview",props:{asset:{}},setup(T){const l=T,d=A(()=>`devtools-assets-${ve(l.asset)}`);return he(A(()=>`
|
|
2
|
-
@font-face {
|
|
3
|
-
font-family: '${d.value}';
|
|
4
|
-
src: url('${l.asset.publicPath}');
|
|
5
|
-
}
|
|
6
|
-
`)),(n,m)=>(s(),p("div",{"of-hidden":"",style:le({fontFamily:`'${t(d)}'`})}," Aa Bb Cc Dd Ee Ff Gg Hh Ii Jj Kk Ll Mm Nn Oo Pp Qq Rr Ss Tt Uu Vv Ww Xx Yy Zz ",4))}}),Ze={flex:"","items-center":"","justify-center":"","of-hidden":"","bg-active":"","object-cover":"",p1:""},Ge=["src"],We={key:2,"i-carbon-document":"","text-3xl":"",op20:""},qe={key:3,"w-full":"","self-start":"",p4:""},He=["textContent"],Je={key:4},Ye=["src","autoplay","controls"],Qe={key:5,"i-carbon-help":"","text-3xl":"",op20:""},ce=X({__name:"AssetPreview",props:{asset:{},textContent:{},detail:{type:Boolean}},setup(T){return(l,d)=>{const n=Xe;return s(),p("div",Ze,[l.asset.type==="image"?(s(),p("img",{key:0,src:l.asset.publicPath},null,8,Ge)):l.asset.type==="font"?(s(),F(n,{key:l.asset.publicPath,asset:l.asset,"self-stretch":"",p2:"","text-2xl":""},null,8,["asset"])):l.asset.type==="text"&&!l.textContent?(s(),p("div",We)):l.asset.type==="text"&&l.textContent?(s(),p("div",qe,[e("pre",{"max-h-10rem":"","of-hidden":"","text-xs":"","font-mono":"",textContent:V(l.textContent)},null,8,He)])):l.asset.type==="video"?(s(),p("div",Je,[e("video",{src:l.asset.publicPath,autoplay:l.detail,controls:l.detail},null,8,Ye)])):(s(),p("div",Qe))])}}}),et={flex:"~ col gap-1",hover:"bg-active","items-center":"","of-hidden":"",rounded:"",p2:""},tt={"w-full":"","of-hidden":"",truncate:"","ws-nowrap":"","text-center":"","text-xs":""},nt=X({__name:"AssetGridItem",props:{asset:{},folder:{}},setup(T){const l=T,d=A(()=>l.folder&&l.asset.path.startsWith(l.folder)?l.asset.path.slice(l.folder.length):l.asset.path);return(n,m)=>{const v=ce;return s(),p("button",et,[u(v,{"h-30":"","w-30":"",rounded:"",border:"~ base",asset:n.asset},null,8,["asset"]),e("div",tt,V(t(d)),1)])}}}),ue=X({__name:"AssetListItem",props:{item:{},index:{default:0},modelValue:{}},setup(T,{emit:l}){const d=T,n=ie(d,"modelValue",l,{passive:!0}),m=A(()=>d.item?.children?.length),v=N(!0),D=A(()=>m.value?"i-carbon-folder":d.item.type==="image"?"i-carbon-image":d.item.type==="video"?"i-carbon-video":d.item.type==="audio"?"i-carbon-volume-up":d.item.type==="font"?"i-carbon-text-small-caps":d.item.type==="text"?"i-carbon-document":d.item.type==="json"?"i-carbon-json":"i-carbon-document-blank");return(c,C)=>{const K=oe,B=ue;return s(),p("div",null,[e("button",{flex:"~ gap-2","w-full":"","items-center":"",hover:"bg-active",px4:"",py1:"",style:le({paddingLeft:`calc(1rem + ${c.index*1.5}em)`}),class:H({"bg-active":!t(m)&&t(n)?.filePath===c.item?.filePath}),border:"b base",onClick:C[0]||(C[0]=w=>t(m)?v.value=!t(v):n.value=c.item)},[e("div",{class:H(t(D))},null,2),e("span",{class:H({"flex items-center":t(m)}),"flex-auto":"","text-start":"","text-sm":"","font-mono":""},V(c.item.path),3),t(m)?(s(),F(K,{key:0,icon:"carbon:chevron-right","transform-rotate":t(v)?90:0,transition:""},null,8,["transform-rotate"])):S("",!0)],6),t(v)?_e(c.$slots,"default",{key:0},()=>[(s(!0),p(L,null,G(c.item?.children,w=>(s(),F(B,{key:w.filepath,modelValue:t(n),"onUpdate:modelValue":C[1]||(C[1]=h=>R(n)?n.value=h:null),item:w,index:c.index+1},null,8,["modelValue","item","index"]))),128))]):S("",!0)])}}}),ot={flex:"~ col gap-4","min-h-full":"","w-full":"","of-hidden":"",p4:""},st=e("div",{flex:"~ gap2","mb--2":"","items-center":"",op50:""},[e("div",{"x-divider":""}),e("div",{"flex-none":""}," Preview "),e("div",{"x-divider":""})],-1),at={flex:"~","items-center":"","justify-center":""},lt=e("div",{flex:"~ gap2","mb--2":"","items-center":"",op50:""},[e("div",{"x-divider":""}),e("div",{"flex-none":""}," Details "),e("div",{"x-divider":""})],-1),it={"max-w-full":"","w-full":"","table-fixed":""},rt=e("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Filepath ",-1),ct={flex:"~ gap-1","w-full":"","items-center":""},ut=e("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Public Path ",-1),dt={flex:"~ gap-1","w-full":"","items-center":"","of-hidden":""},pt={"flex-auto":"","of-hidden":"",truncate:"","ws-pre":"","font-mono":""},mt=e("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Type ",-1),ft={capitalize:""},vt=e("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Image Size ",-1),ht={key:0},_t=e("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Aspect Ratio ",-1),gt=e("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," File size ",-1),xt=e("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Last modified ",-1),wt={op70:""},bt=e("div",{flex:"~ gap2","mb--2":"","items-center":"",op50:""},[e("div",{"x-divider":""}),e("div",{"flex-none":""}," Actions "),e("div",{"x-divider":""})],-1),yt={flex:"~ gap2 wrap"},$t=e("div",{"flex-auto":""},null,-1),kt={flex:"~ col gap-4","min-h-full":"","w-full":"","of-hidden":"",p8:""},Ct=e("span",null," Are you sure you want to delete this asset? ",-1),Pt={flex:"~ gap2 wrap justify-center"},At={flex:"~ col gap-4","min-h-full":"","w-full":"","of-hidden":"",p8:""},Dt={flex:"~ gap2 wrap justify-center"},Vt={flex:"~ col gap-4","min-h-full":"","w-full":"","of-hidden":"",p4:""},Nt=["onKeydown"],Ft={flex:"","justify-end":"","gap-4":""},It=X({__name:"AssetDetails",props:{modelValue:{}},setup(T,{emit:l}){const n=ie(T,"modelValue",l,{passive:!0}),m=ge(),v=ne(()=>{if(n.value.type==="image")return Z.getImageMeta(n.value.filePath)}),D=N(!1),c=N(),C=N(0),K=ne(async()=>{if(n.value.type!=="text")return;C.value;const a=await Z.getTextAssetContent(n.value.filePath);return c.value=a,a});async function B(){if(K.value!==c.value)try{await Z.writeStaticAssets(await J(),[{path:n.value.path,content:c.value,override:!0}],""),D.value=!1,C.value++,U({message:"Updated",icon:"i-carbon-checkmark",classes:"text-green"})}catch{U({message:"Something went wrong!",icon:"i-carbon-warning",classes:"text-red"})}}const w=xe(),h=A(()=>(w.value?._installedModules||[]).some(o=>o.meta?.name==="@nuxt/image"||o.meta?.name==="@nuxt/image-edge")),b=A(()=>{const a=[];if(n.value.type==="image"){const o=v.value?.width?`
|
|
7
|
-
width="${v.value.width}"
|
|
8
|
-
height="${v.value.height}" `:" ";return a.push({lang:"vue-html",code:`<img${o}
|
|
9
|
-
src="${n.value.publicPath}"
|
|
10
|
-
/>`,name:"Plain Image"}),h.value&&a.push({lang:"vue-html",code:`<NuxtImage${o}
|
|
11
|
-
src="${n.value.publicPath}"
|
|
12
|
-
/>`,name:"Nuxt Image",docs:"https://image.nuxtjs.org/components/nuxt-img"},{lang:"vue-html",code:`<NuxtPicture${o}
|
|
13
|
-
src="${n.value.publicPath}"
|
|
14
|
-
/>`,name:"Nuxt Picture",docs:"https://image.nuxtjs.org/components/nuxt-picture"}),a}return a.push({lang:"html",code:`<a download href="${n.value.publicPath}">
|
|
15
|
-
Download ${n.value.path.split("/").slice(-1)[0]}
|
|
16
|
-
</a>`,name:"Download link"}),a}),z=we(),I=be(()=>n.value.mtime),j=A(()=>{const a=n.value.size;return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(2)} KB`:`${(a/1024/1024).toFixed(2)} MB`}),i=A(()=>{if(!v.value?.width||!v.value?.height)return"";const a=(M,O)=>O?a(O,M%O):M,o=a(v.value.width,v.value.height);return o>3?`${v.value.width/o}:${v.value.height/o}`:""}),g=A(()=>["image","text","video","font"].includes(n.value.type)),_=N(!1);async function P(){try{await Z.deleteStaticAsset(await J(),n.value.filePath),n.value=void 0,_.value=!1,U({message:"Asset deleted",icon:"i-carbon-checkmark",classes:"text-green"})}catch{U({message:"Something went wrong!",icon:"i-carbon-warning",classes:"text-red"})}}const f=N(!1),r=N("");async function y(){const a=n.value.filePath.split("/"),o=a.slice(-1)[0].split(".").slice(0,-1).join(".");if(!r.value||r.value===o)return U({message:"Please enter a new name",icon:"i-carbon-warning",classes:"text-orange"});try{const M=a.slice(-1)[0].split(".").slice(-1)[0],O=`${a.slice(0,-1).join("/")}/${r.value}.${M}`;await Z.renameStaticAsset(await J(),n.value.filePath,O),n.value=void 0,f.value=!1,U({message:"Asset renamed",icon:"i-carbon-checkmark",classes:"text-green"})}catch{U({message:"Something went wrong!",icon:"i-carbon-warning",classes:"text-red"})}}return(a,o)=>{const M=ce,O=Ne,Y=te,E=ae,de=Fe,Q=ke,pe=se,ee=re("tooltip");return s(),p(L,null,[e("div",ot,[t(g)?(s(),p(L,{key:0},[st,e("div",at,[u(M,{detail:"","max-h-80":"","min-h-20":"","min-w-20":"","w-auto":"",rounded:"",border:"~ base",asset:t(n),"text-content":t(K)},null,8,["asset","text-content"])])],64)):S("",!0),lt,e("table",it,[e("tbody",null,[e("tr",null,[rt,e("td",null,[e("div",ct,[u(O,{filepath:t(n).filePath,"text-left":""},null,8,["filepath"]),W(u(Y,{"flex-none":"",title:"Open in Editor",icon:"carbon-launch",onClick:o[0]||(o[0]=$=>t(m)(t(n).filePath))},null,512),[[ee,"Open in Editor"]])])])]),e("tr",null,[ut,e("td",null,[e("div",dt,[e("div",pt,V(t(n).publicPath),1),W(u(Y,{"flex-none":"",title:"Copy public path",icon:"carbon-copy",onClick:o[1]||(o[1]=$=>t(z)(t(n).publicPath))},null,512),[[ee,"Copy public path"]]),W(u(Y,{"flex-none":"",to:t(n).publicPath,icon:"carbon-launch",target:"_blank",title:"Open in browser"},null,8,["to"]),[[ee,"Open in browser"]])])])]),e("tr",null,[mt,e("td",ft,V(t(n).type),1)]),t(v)?.width?(s(),p(L,{key:0},[e("tr",null,[vt,e("td",null,V(t(v).width)+" x "+V(t(v).height),1)]),t(i)?(s(),p("tr",ht,[_t,e("td",null,V(t(i)),1)])):S("",!0)],64)):S("",!0),e("tr",null,[gt,e("td",null,V(t(j)),1)]),e("tr",null,[xt,e("td",null,[k(V(new Date(t(n).mtime).toLocaleString())+" ",1),e("span",wt,"("+V(t(I))+")",1)])])])]),bt,e("div",yt,[u(E,{to:t(n).publicPath,download:"",target:"_blank",icon:"carbon-download",n:"green"},{default:x(()=>[k(" Download ")]),_:1},8,["to"]),t(n).type==="text"?(s(),F(E,{key:0,icon:"carbon-edit",n:"cyan",onClick:o[2]||(o[2]=$=>D.value=!t(D))},{default:x(()=>[k(" Edit ")]),_:1})):S("",!0),u(E,{icon:"carbon-text-annotation-toggle",n:"blue",onClick:o[3]||(o[3]=$=>f.value=!t(f))},{default:x(()=>[k(" Rename ")]),_:1}),u(E,{icon:"carbon-delete",n:"red",onClick:o[4]||(o[4]=$=>_.value=!t(_))},{default:x(()=>[k(" Delete ")]),_:1}),t(n).type==="image"?(s(),F(E,{key:1,disabled:"",icon:"carbon-image-service"},{default:x(()=>[k(" Optimize image (Coming soon) ")]),_:1})):S("",!0)]),$t,t(b).length?(s(),F(de,{key:1,border:"t base","mx--4":"","mb--4":"","code-snippets":t(b)},null,8,["code-snippets"])):S("",!0)]),u(Q,{modelValue:t(_),"onUpdate:modelValue":o[6]||(o[6]=$=>R(_)?_.value=$:null)},{default:x(()=>[e("div",kt,[Ct,e("div",Pt,[u(E,{icon:"carbon-close",onClick:o[5]||(o[5]=$=>_.value=!1)},{default:x(()=>[k(" Cancel ")]),_:1}),u(E,{icon:"carbon-delete",n:"red",onClick:P},{default:x(()=>[k(" Delete ")]),_:1})])])]),_:1},8,["modelValue"]),u(Q,{modelValue:t(f),"onUpdate:modelValue":o[9]||(o[9]=$=>R(f)?f.value=$:null)},{default:x(()=>[e("div",At,[u(pe,{modelValue:t(r),"onUpdate:modelValue":o[7]||(o[7]=$=>R(r)?r.value=$:null),placeholder:"New name",n:"blue"},null,8,["modelValue"]),e("div",Dt,[u(E,{icon:"carbon-close",onClick:o[8]||(o[8]=$=>f.value=!1)},{default:x(()=>[k(" Cancel ")]),_:1}),u(E,{icon:"carbon-text-annotation-toggle",n:"blue",onClick:y},{default:x(()=>[k(" Rename ")]),_:1})])])]),_:1},8,["modelValue"]),t(n).type==="text"?(s(),F(Q,{key:0,modelValue:t(D),"onUpdate:modelValue":o[12]||(o[12]=$=>R(D)?D.value=$:null)},{default:x(()=>[e("div",Vt,[W(e("textarea",{"onUpdate:modelValue":o[10]||(o[10]=$=>R(c)?c.value=$:null),placeholder:"Item value...",class:"h-lg w-xl of-auto rounded-lg p-4 text-sm font-mono outline-none",onKeydown:ye(B,["enter"])},null,40,Nt),[[$e,t(c)]]),e("div",Ft,[u(E,{icon:"carbon-close",onClick:o[11]||(o[11]=$=>D.value=!1)},{default:x(()=>[k(" Cancel ")]),_:1}),u(E,{icon:"carbon:save",n:"primary",onClick:B},{default:x(()=>[k(" save ")]),_:1})])])]),_:1},8,["modelValue"])):S("",!0)],64)}}}),St={"h-full":"","of-auto":""},Tt={"flex-none":"",flex:"~ gap2 items-center"},jt={op50:""},Et={key:0},Ut={"mt--4":"",px2:"",grid:"~ cols-minmax-8rem"},Bt={key:1,p2:"",grid:"~ cols-minmax-8rem"},Lt={key:1},Ht=X({__name:"assets",setup(T){const l=Ce(),d=N(""),n=A(()=>new Pe(l.value||[],{keys:["path"]})),m=A(()=>d.value?n.value.search(d.value).map(h=>h.item):l.value||[]),v=A(()=>{const w={};for(const h of m.value){const b=`${h.path.split("/").slice(0,-1).join("/")}/`;w[b]||(w[b]=[]),w[b].push(h)}return Object.entries(w).sort(([h],[b])=>h.localeCompare(b))}),D=A(()=>{const w={path:"public",children:[]},h=(b,z,I)=>{const[j,...i]=z;let g=b.children.find(_=>_.path===j);g||(g={...I,path:j,children:[]},b.children.push(g)),i.length>1?h(g,i,I):i.length===1&&g.children.push({...I,path:i[0]})};return m.value.forEach(b=>{const z=b.path.split("/").filter(I=>I!=="");h(w,z,b)}),w.children}),c=N(),{view:C}=Ie("assets");function K(){C.value=C.value==="list"?"grid":"list"}Ae("Escape",()=>{c.value=void 0});const B=N();return(w,h)=>{const b=te,z=De,I=Ke,j=nt,i=Ve,g=ue,_=It,P=Se,f=re("tooltip");return s(),p("div",St,[u(z,{ref_key:"navbar",ref:B,search:t(d),"onUpdate:search":h[0]||(h[0]=r=>R(d)?d.value=r:null),pb2:""},{actions:x(()=>[e("div",Tt,[W(u(b,{"text-lg":"",icon:t(C)==="grid"?"i-carbon-list":"i-carbon-grid",title:"Toggle view",onClick:K},null,8,["icon"]),[[f,"Toggle View",void 0,{"bottom-end":!0}]])])]),default:x(()=>[e("div",jt,[t(d)?(s(),p("span",Et,V(t(m).length)+" matched · ",1)):S("",!0),e("span",null,V(t(l)?.length)+" assets in total",1)])]),_:1},8,["search"]),u(I,{folder:"/"}),t(C)==="grid"?(s(),p(L,{key:0},[t(v).length>1?(s(!0),p(L,{key:0},G(t(v),([r,y])=>(s(),F(i,{key:r,text:r,description:`${y.length} items`,open:y.length<=("DETAILS_MAX_ITEMS"in w?w.DETAILS_MAX_ITEMS:t(Te)),padding:!1},{default:x(()=>[e("div",Ut,[(s(!0),p(L,null,G(y,a=>(s(),F(j,{key:a.path,asset:a,folder:r,onClick:o=>c.value=a},null,8,["asset","folder","onClick"]))),128))])]),_:2},1032,["text","description","open"]))),128)):(s(),p("div",Bt,[(s(!0),p(L,null,G(t(m),r=>(s(),F(j,{key:r.path,asset:r,onClick:y=>c.value=r},null,8,["asset","onClick"]))),128))]))],64)):(s(),p("div",Lt,[(s(!0),p(L,null,G(t(D),(r,y)=>(s(),F(g,{key:y,modelValue:t(c),"onUpdate:modelValue":h[1]||(h[1]=a=>R(c)?c.value=a:null),item:r},null,8,["modelValue","item"]))),128))])),u(P,{"model-value":!!t(c),"auto-close":"","w-120":"",navbar:t(B),onClose:h[3]||(h[3]=r=>c.value=void 0)},{default:x(()=>[t(c)?(s(),F(_,{key:0,modelValue:t(c),"onUpdate:modelValue":h[2]||(h[2]=r=>R(c)?c.value=r:null)},null,8,["modelValue"])):S("",!0)]),_:1},8,["model-value","navbar"])])}}});export{Ht as default};
|