-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
640 additions
and
364 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<script setup lang="ts"> | ||
import { ref } from "vue"; | ||
import { useElementSize } from "@vueuse/core"; | ||
import MonacoEditor from "./Monaco.vue"; | ||
defineProps(["language"]); | ||
const editorContainer = ref(null); | ||
const { width, height } = useElementSize(editorContainer); | ||
</script> | ||
|
||
<template> | ||
<div class="w-1/2 h-full py-2"> | ||
<MonacoEditor | ||
ref="editorContainer" | ||
:language="language" | ||
:width="width" | ||
:height="height" | ||
/> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<script setup lang="ts"> | ||
import Code from "./Code.vue"; | ||
import Output from "./Output.vue"; | ||
defineProps(["syntaxState"]); | ||
</script> | ||
|
||
<template> | ||
<Code :language="syntaxState.language" /> | ||
<div class="w-px h-full border-b bg-[#e2e2e3] dark:bg-[#2e2e32]" /> | ||
<div class="w-1/2 h-full"> | ||
<Output /> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<script lang="ts"> | ||
import { | ||
type PropType, | ||
defineComponent, | ||
onBeforeUnmount, | ||
onMounted, | ||
ref, | ||
} from "vue"; | ||
import { useDark } from "@vueuse/core"; | ||
import * as monaco from "monaco-editor"; | ||
import "src/composable/useEditorWorker"; | ||
export default defineComponent({ | ||
name: "MonacoEditor", | ||
props: { | ||
width: { | ||
type: [String, Number], | ||
default: "100%", | ||
}, | ||
height: { | ||
type: [String, Number], | ||
default: "100%", | ||
}, | ||
original: String, | ||
value: String, | ||
language: { type: String }, | ||
theme: { type: String }, | ||
options: { | ||
type: Object as PropType<monaco.editor.IStandaloneEditorConstructionOptions>, | ||
default: () => ({}), | ||
}, | ||
}, | ||
emits: ["editorWillMount", "editorDidMount", "change", "update:modelValue"], | ||
setup(props, { emit }) { | ||
const container: any = ref(null); | ||
let instance: monaco.editor.IStandaloneCodeEditor | any = null; | ||
const isDark = useDark({ | ||
onChanged(isDark) { | ||
if (!instance) return; | ||
monaco.editor.setTheme(isDark ? "vs-dark" : "vs"); | ||
}, | ||
}); | ||
const initMonaco = () => { | ||
const editorProps = { | ||
minimap: { enabled: false }, | ||
fontSize: 14, | ||
scrollBeyondLastLine: true, | ||
fontFamily: `ui-monospace, Menlo, Monaco, "Cascadia Code", "Cascadia Mono", "Segoe UI Mono", "Roboto Mono", "Oxygen Mono", "Ubuntu Monospace", "Source Code Pro","Fira Mono", "Droid Sans Mono", "Courier New", monospace`, | ||
locale: "en", | ||
...props, | ||
theme: props.theme || (isDark.value ? "vs-dark" : "vs"), | ||
}; | ||
instance = monaco.editor.create(container.value, editorProps); | ||
instance.onDidChangeModelContent(() => { | ||
const value = instance.getValue(); | ||
emit("update:modelValue", value); | ||
}); | ||
}; | ||
onMounted(() => { | ||
initMonaco(); | ||
}); | ||
onBeforeUnmount(() => { | ||
if (instance) { | ||
instance.dispose(); | ||
} | ||
}); | ||
return { | ||
container, | ||
}; | ||
}, | ||
}); | ||
</script> | ||
|
||
<template> | ||
<div class="w-full h-full" ref="container" /> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<script setup lang="ts"> | ||
import { Label } from "src/ui/label"; | ||
import { RadioGroup, RadioGroupItem } from "src/ui/radio-group"; | ||
const radios = [ | ||
{ value: "ast", label: "Ast" }, | ||
{ value: "codegen", label: "Codegen" }, | ||
{ value: "ir", label: "IR" }, | ||
{ value: "prettier", label: "Prettier" }, | ||
{ value: "format", label: "Format(Prettier)" }, | ||
{ value: "scope", label: "Scope" }, | ||
{ value: "symbol", label: "Symbol" }, | ||
]; | ||
</script> | ||
|
||
<template> | ||
<div | ||
class="flex relative items-center px-2 py-3 before:content-[''] before:absolute before:bottom-0 before:left-0 before:w-full before:h-px before:bg-no-repeat before:bg-[#e2e2e3] dark:before:bg-[#2e2e32]" | ||
> | ||
<RadioGroup class="flex" default-value="ast"> | ||
<div v-for="radio in radios"> | ||
<RadioGroupItem | ||
:id="radio.value" | ||
:value="radio.value" | ||
class="peer w-0 h-0 border-0" | ||
style="clip: rect(0, 0, 0, 0)" | ||
/> | ||
<Label | ||
:for="radio.value" | ||
class="px-3 py-2 bg-white dark:bg-[#2e2e32] border-2 rounded-md text-sm hover:border-[#3451b2] dark:hover:border-[#a8b1ff] peer-data-[state=checked]:bg-[#3451b2] dark:peer-data-[state=checked]:bg-[#a8b1ff] peer-data-[state=checked]:border-[#3451b2] dark:peer-data-[state=checked]:border-[#a8b1ff] peer-data-[state=checked]:text-white" | ||
> | ||
{{ radio.label }} | ||
</Label> | ||
</div> | ||
</RadioGroup> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,22 @@ | ||
<script setup lang="ts"> | ||
import Checkbox from "../ui/Checkbox.vue"; | ||
const props = defineProps(["syntaxState"]); | ||
const emit = defineEmits(["update:syntaxState"]); | ||
function checkedLint(checked: boolean) { | ||
props.syntaxState.linted = checked; | ||
} | ||
</script> | ||
|
||
<template> | ||
<div class="pt-3"> | ||
<p class="text-lg text-[#3c3c43] dark:text-[#fffff5]/[.86]">Lint</p> | ||
<Checkbox id="lint-enable" title="Lint Enabled" /> | ||
<p class="text-lg text-[#3c3c43] dark:text-[#fffff5]/[.86]">Lint Options</p> | ||
<Checkbox | ||
id="lint-enable" | ||
title="Lint Enabled" | ||
:checked="syntaxState.linted" | ||
:onChange="checkedLint" | ||
/> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
<script setup lang="ts"> | ||
import { type SyntaxOptions } from "src/composable/useSyntaxOptions"; | ||
import Logo from "../Logo/Logo.vue"; | ||
import Lint from "./Lint.vue"; | ||
import Syntax from "./Syntax.vue"; | ||
defineProps<{ syntaxState: SyntaxOptions }>(); | ||
</script> | ||
|
||
<template> | ||
<div | ||
class="hidden pc:block w-52 h-screen px-8 box-content bg-[#f6f6f7] dark:bg-[#161618]" | ||
> | ||
<Logo /> | ||
<Syntax /> | ||
<Lint /> | ||
<Syntax :syntaxState="syntaxState" /> | ||
<Lint :syntaxState="syntaxState" /> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.