Skip to content

Commit ea160bc

Browse files
committed
chore: wip
chore: wip
1 parent dae823e commit ea160bc

File tree

7 files changed

+1210
-117
lines changed

7 files changed

+1210
-117
lines changed

bun.lock

Lines changed: 336 additions & 117 deletions
Large diffs are not rendered by default.

storage/framework/core/desktop/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@
5555
"@stacksjs/server": "workspace:*",
5656
"@tauri-apps/api": "^1.6.0",
5757
"@tauri-apps/cli": "^1.6.3",
58+
"@types/d3": "^7.4.3",
59+
"d3": "^7.9.0",
60+
"monaco-editor": "^0.52.2",
5861
"unified-network": "^0.6.4",
5962
"vue": "^3.5.13"
6063
}

storage/framework/defaults/components/Dashboard/Sidebar.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ const sectionContent = {
118118
app: {
119119
items: [
120120
{ to: '/deployments', icon: 'i-hugeicons-rocket', text: 'Deployments' },
121+
{ to: '/cloud', icon: 'i-hugeicons-cloud', text: 'Cloud' },
121122
{ to: '/requests', icon: 'i-hugeicons-api', text: 'Requests' },
122123
{ to: '/realtime', icon: 'i-hugeicons-link-03', text: 'Realtime' },
123124
{ to: '/actions', icon: 'i-hugeicons-function-of-x', text: 'Actions' },
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<script setup lang="ts">
2+
import { ref, onMounted, onBeforeUnmount, watch } from 'vue'
3+
import * as monaco from 'monaco-editor'
4+
5+
const props = defineProps<{
6+
modelValue: string
7+
language?: string
8+
theme?: string
9+
options?: monaco.editor.IStandaloneEditorConstructionOptions
10+
}>()
11+
12+
const emit = defineEmits<{
13+
(e: 'update:modelValue', value: string): void
14+
}>()
15+
16+
const editorContainer = ref<HTMLElement>()
17+
let editor: monaco.editor.IStandaloneCodeEditor | null = null
18+
19+
onMounted(() => {
20+
if (!editorContainer.value) return
21+
22+
editor = monaco.editor.create(editorContainer.value, {
23+
value: props.modelValue,
24+
language: props.language || 'typescript',
25+
theme: props.theme || 'vs-dark',
26+
automaticLayout: true,
27+
minimap: { enabled: false },
28+
...props.options,
29+
})
30+
31+
editor.onDidChangeModelContent(() => {
32+
emit('update:modelValue', editor?.getValue() || '')
33+
})
34+
})
35+
36+
onBeforeUnmount(() => {
37+
if (editor) {
38+
editor.dispose()
39+
}
40+
})
41+
42+
watch(() => props.modelValue, (newValue) => {
43+
if (editor && newValue !== editor.getValue()) {
44+
editor.setValue(newValue)
45+
}
46+
})
47+
48+
watch(() => props.language, (newValue) => {
49+
if (editor) {
50+
monaco.editor.setModelLanguage(editor.getModel()!, newValue || 'typescript')
51+
}
52+
})
53+
54+
watch(() => props.theme, (newValue) => {
55+
if (editor) {
56+
monaco.editor.setTheme(newValue || 'vs-dark')
57+
}
58+
})
59+
60+
watch(() => props.options, (newValue) => {
61+
if (editor) {
62+
editor.updateOptions(newValue || {})
63+
}
64+
}, { deep: true })
65+
</script>
66+
67+
<template>
68+
<div ref="editorContainer" class="w-full h-full" />
69+
</template>

0 commit comments

Comments
 (0)