From 930c6ad87b7c4fcba12c788789a22f8d4377d120 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Tue, 3 Jan 2023 17:25:13 +0100 Subject: [PATCH 1/2] fix: improve vfs ui --- src/dev/vfs.ts | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/src/dev/vfs.ts b/src/dev/vfs.ts index db57384963..bc5a8d3432 100644 --- a/src/dev/vfs.ts +++ b/src/dev/vfs.ts @@ -16,16 +16,17 @@ export function createVFSHandler(nitro: Nitro) { : "hover:bg-gray-800 text-gray-200"; return `
  • ${key.replace( + )}" class="w-full text-sm px-2 py-1 border-b border-gray:10 ${linkClass}">${key.replace( nitro.options.rootDir, "" )}
  • `; }) .join("\n"); - const files = ` -
    -

    virtual files

    - + + const filesList = ` +
    +

    Virtual Files

    +
      ${items}
    `; @@ -49,8 +50,8 @@ export function createVFSHandler(nitro: Nitro) { throw createError({ message: "File not found", statusCode: 404 }); } else { file = ` -
    -

    Select a virtual file to inspect

    +
    +

    Select a virtual file to inspect

    `; } @@ -61,10 +62,19 @@ export function createVFSHandler(nitro: Nitro) { + - -
    - ${files} + +
    + ${filesList} ${file}
    @@ -77,7 +87,7 @@ const monacoUrl = `https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/${monaco const vsUrl = `${monacoUrl}/vs`; const editorTemplate = (options: Record) => ` -
    +
    `; From af2dc4a664f0fbcbeeecbc818c26d49e66d2dde3 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Tue, 3 Jan 2023 17:29:57 +0100 Subject: [PATCH 2/2] chore: format --- src/dev/vfs.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dev/vfs.ts b/src/dev/vfs.ts index bc5a8d3432..ef7b1a770d 100644 --- a/src/dev/vfs.ts +++ b/src/dev/vfs.ts @@ -100,7 +100,9 @@ const editorTemplate = (options: Record) => ` require(['vs/editor/editor.main'], function () { setTimeout(() => { - monaco.editor.create(document.getElementById('editor'), ${JSON.stringify(options)}) + monaco.editor.create(document.getElementById('editor'), ${JSON.stringify( + options + )}) }, 0) })