update
This commit is contained in:
@@ -1 +1,2 @@
|
|||||||
semi=false
|
semi=false
|
||||||
|
plugins=["prettier-plugin-organize-imports"]
|
||||||
851
package-lock.json
generated
851
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
14
package.json
14
package.json
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "code-next",
|
"name": "code-next",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.0.0",
|
"version": "1.1.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "vite",
|
"start": "vite",
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@codemirror/lang-cpp": "^6.0.2",
|
"@codemirror/lang-cpp": "^6.0.2",
|
||||||
"@codemirror/lang-python": "^6.1.6",
|
"@codemirror/lang-python": "^6.1.6",
|
||||||
"@vueuse/core": "^10.10.1",
|
"@vueuse/core": "^10.11.0",
|
||||||
"axios": "^1.7.2",
|
"axios": "^1.7.2",
|
||||||
"client-zip": "^1.6.4",
|
"client-zip": "^1.6.4",
|
||||||
"codemirror": "^6.0.1",
|
"codemirror": "^6.0.1",
|
||||||
@@ -21,17 +21,19 @@
|
|||||||
"naive-ui": "^2.38.2",
|
"naive-ui": "^2.38.2",
|
||||||
"normalize.css": "^8.0.1",
|
"normalize.css": "^8.0.1",
|
||||||
"query-string": "^9.0.0",
|
"query-string": "^9.0.0",
|
||||||
"vue": "^3.4.27",
|
"vue": "^3.4.30",
|
||||||
"vue-codemirror": "^6.1.1"
|
"vue-codemirror": "^6.1.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@iconify/vue": "^4.1.2",
|
||||||
"@types/file-saver": "^2.0.7",
|
"@types/file-saver": "^2.0.7",
|
||||||
"@vitejs/plugin-legacy": "^5.4.1",
|
"@vitejs/plugin-legacy": "^5.4.1",
|
||||||
"@vitejs/plugin-vue": "^5.0.5",
|
"@vitejs/plugin-vue": "^5.0.5",
|
||||||
"prettier": "^3.3.2",
|
"prettier": "^3.3.2",
|
||||||
|
"prettier-plugin-organize-imports": "^3.2.4",
|
||||||
"terser": "^5.31.1",
|
"terser": "^5.31.1",
|
||||||
"typescript": "^5.4.5",
|
"typescript": "^5.5.2",
|
||||||
"vite": "^5.2.13",
|
"vite": "^5.3.1",
|
||||||
"vue-tsc": "^2.0.21"
|
"vue-tsc": "^2.0.22"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios"
|
import axios from "axios"
|
||||||
import { Code, Submission } from "./types"
|
|
||||||
import { deadResults, languageToId } from "./templates"
|
import { deadResults, languageToId } from "./templates"
|
||||||
|
import { Code, Submission } from "./types"
|
||||||
|
|
||||||
function getChromeVersion() {
|
function getChromeVersion() {
|
||||||
var raw = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)
|
var raw = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)
|
||||||
|
|||||||
@@ -9,10 +9,12 @@ import { EditorView } from "@codemirror/view"
|
|||||||
import { LANGUAGE } from "../types"
|
import { LANGUAGE } from "../types"
|
||||||
import { oneDark } from "../themes/oneDark"
|
import { oneDark } from "../themes/oneDark"
|
||||||
import { smoothy } from "../themes/smoothy"
|
import { smoothy } from "../themes/smoothy"
|
||||||
|
import { Icon } from "@iconify/vue"
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
modelValue: string
|
modelValue: string
|
||||||
label?: string
|
label?: string
|
||||||
|
icon?: string
|
||||||
language?: LANGUAGE
|
language?: LANGUAGE
|
||||||
fontSize?: number
|
fontSize?: number
|
||||||
readonly?: boolean
|
readonly?: boolean
|
||||||
@@ -20,6 +22,7 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
label: "",
|
||||||
language: "python",
|
language: "python",
|
||||||
fontSize: 24,
|
fontSize: 24,
|
||||||
readonly: false,
|
readonly: false,
|
||||||
@@ -69,6 +72,7 @@ function onReady(payload: {
|
|||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<n-flex align="center" class="header" v-if="props.label">
|
<n-flex align="center" class="header" v-if="props.label">
|
||||||
|
<Icon v-if="icon" :icon="icon" :width="24" :height="24"></Icon>
|
||||||
<span class="title">{{ label }}</span>
|
<span class="title">{{ label }}</span>
|
||||||
<slot name="actions"></slot>
|
<slot name="actions"></slot>
|
||||||
</n-flex>
|
</n-flex>
|
||||||
|
|||||||
@@ -19,4 +19,4 @@ const languages: SelectOption[] = [
|
|||||||
.select {
|
.select {
|
||||||
width: 100px;
|
width: 100px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { computed, reactive } from "vue"
|
import { computed, reactive } from "vue"
|
||||||
import { output, status } from "./code"
|
|
||||||
import { Status } from "../types"
|
import { Status } from "../types"
|
||||||
|
import { output, status } from "./code"
|
||||||
|
|
||||||
export const analyse = reactive({
|
export const analyse = reactive({
|
||||||
line: -1,
|
line: -1,
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { reactive, ref, watch } from "vue"
|
|
||||||
import { Code, LANGUAGE, Cache, Status } from "../types"
|
|
||||||
import { sources } from "../templates"
|
|
||||||
import { submit } from "../api"
|
|
||||||
import { useStorage } from "@vueuse/core"
|
import { useStorage } from "@vueuse/core"
|
||||||
import { isMobile } from "./breakpoints"
|
|
||||||
import { atou, utoa } from "../utils"
|
|
||||||
import copyTextToClipboard from "copy-text-to-clipboard"
|
import copyTextToClipboard from "copy-text-to-clipboard"
|
||||||
import queryString from "query-string"
|
import queryString from "query-string"
|
||||||
|
import { reactive, ref, watch } from "vue"
|
||||||
|
import { submit } from "../api"
|
||||||
|
import { sources } from "../templates"
|
||||||
|
import { Cache, Code, LANGUAGE, Status } from "../types"
|
||||||
|
import { atou, utoa } from "../utils"
|
||||||
|
import { isMobile } from "./breakpoints"
|
||||||
|
|
||||||
const defaultLanguage = "python"
|
const defaultLanguage = "python"
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import { downloadZip } from "client-zip"
|
||||||
|
import saveAs from "file-saver"
|
||||||
import { ref } from "vue"
|
import { ref } from "vue"
|
||||||
import { submit } from "../api"
|
import { submit } from "../api"
|
||||||
import { code } from "./code"
|
import { code } from "./code"
|
||||||
import { downloadZip } from "client-zip"
|
|
||||||
import saveAs from "file-saver"
|
|
||||||
|
|
||||||
export const files = ref(
|
export const files = ref(
|
||||||
Array.from({ length: 5 }).map(() => ({ in: "", out: "", error: false })),
|
Array.from({ length: 5 }).map(() => ({ in: "", out: "", error: false })),
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ function copy() {
|
|||||||
<template #1>
|
<template #1>
|
||||||
<CodeEditor
|
<CodeEditor
|
||||||
label="代码区"
|
label="代码区"
|
||||||
|
icon="streamline-emojis:lemon"
|
||||||
:font-size="size"
|
:font-size="size"
|
||||||
v-model="code.value"
|
v-model="code.value"
|
||||||
:language="code.language"
|
:language="code.language"
|
||||||
@@ -48,7 +49,12 @@ function copy() {
|
|||||||
:max="3 / 5"
|
:max="3 / 5"
|
||||||
>
|
>
|
||||||
<template #1>
|
<template #1>
|
||||||
<CodeEditor label="输入框" :font-size="size" v-model="input">
|
<CodeEditor
|
||||||
|
icon="streamline-emojis:four-leaf-clover"
|
||||||
|
label="输入框"
|
||||||
|
:font-size="size"
|
||||||
|
v-model="input"
|
||||||
|
>
|
||||||
<template #actions>
|
<template #actions>
|
||||||
<n-button
|
<n-button
|
||||||
quaternary
|
quaternary
|
||||||
@@ -63,6 +69,7 @@ function copy() {
|
|||||||
</template>
|
</template>
|
||||||
<template #2>
|
<template #2>
|
||||||
<CodeEditor
|
<CodeEditor
|
||||||
|
icon="streamline-emojis:hibiscus"
|
||||||
label="输出框"
|
label="输出框"
|
||||||
v-model="output"
|
v-model="output"
|
||||||
readonly
|
readonly
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { size, run, loading, share } from "../composables/code"
|
|||||||
import ThemeButton from "../components/ThemeButton.vue"
|
import ThemeButton from "../components/ThemeButton.vue"
|
||||||
import SelectLanguage from "../components/SelectLanguage.vue"
|
import SelectLanguage from "../components/SelectLanguage.vue"
|
||||||
import { useMessage } from "naive-ui"
|
import { useMessage } from "naive-ui"
|
||||||
|
import { Icon } from "@iconify/vue"
|
||||||
|
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
|
|
||||||
@@ -15,7 +16,10 @@ function handleShare() {
|
|||||||
<template>
|
<template>
|
||||||
<n-layout-header bordered class="header">
|
<n-layout-header bordered class="header">
|
||||||
<n-flex justify="space-between" align="center">
|
<n-flex justify="space-between" align="center">
|
||||||
<div class="title">徐越的自测猫</div>
|
<n-flex align="center">
|
||||||
|
<Icon icon="streamline-emojis:cat" :width="30" :height="30"></Icon>
|
||||||
|
<div class="title">徐越的自测猫</div>
|
||||||
|
</n-flex>
|
||||||
<n-flex>
|
<n-flex>
|
||||||
<n-button @click="handleShare">分享</n-button>
|
<n-button @click="handleShare">分享</n-button>
|
||||||
<ThemeButton />
|
<ThemeButton />
|
||||||
|
|||||||
24
src/main.ts
24
src/main.ts
@@ -1,27 +1,27 @@
|
|||||||
import { createApp } from "vue"
|
|
||||||
import {
|
import {
|
||||||
create,
|
|
||||||
NButton,
|
NButton,
|
||||||
NConfigProvider,
|
NConfigProvider,
|
||||||
|
NDropdown,
|
||||||
|
NFlex,
|
||||||
|
NIcon,
|
||||||
NInput,
|
NInput,
|
||||||
|
NInputNumber,
|
||||||
NLayout,
|
NLayout,
|
||||||
NLayoutContent,
|
NLayoutContent,
|
||||||
NLayoutHeader,
|
NLayoutHeader,
|
||||||
|
NMessageProvider,
|
||||||
|
NModal,
|
||||||
|
NPopover,
|
||||||
NSelect,
|
NSelect,
|
||||||
NSplit,
|
NSplit,
|
||||||
NFlex,
|
|
||||||
NIcon,
|
|
||||||
NMessageProvider,
|
|
||||||
NInputNumber,
|
|
||||||
NPopover,
|
|
||||||
NTag,
|
|
||||||
NModal,
|
|
||||||
NTabs,
|
|
||||||
NTabPane,
|
NTabPane,
|
||||||
NDropdown,
|
NTabs,
|
||||||
|
NTag,
|
||||||
|
create,
|
||||||
} from "naive-ui"
|
} from "naive-ui"
|
||||||
import App from "./App.vue"
|
|
||||||
import "normalize.css"
|
import "normalize.css"
|
||||||
|
import { createApp } from "vue"
|
||||||
|
import App from "./App.vue"
|
||||||
|
|
||||||
const naive = create({
|
const naive = create({
|
||||||
components: [
|
components: [
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { EditorView } from "@codemirror/view"
|
|
||||||
import { Extension } from "@codemirror/state"
|
|
||||||
import {
|
import {
|
||||||
HighlightStyle,
|
HighlightStyle,
|
||||||
TagStyle,
|
TagStyle,
|
||||||
syntaxHighlighting,
|
syntaxHighlighting,
|
||||||
} from "@codemirror/language"
|
} from "@codemirror/language"
|
||||||
|
import { Extension } from "@codemirror/state"
|
||||||
|
import { EditorView } from "@codemirror/view"
|
||||||
|
|
||||||
interface Options {
|
interface Options {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { EditorView } from "@codemirror/view"
|
|
||||||
import { Extension } from "@codemirror/state"
|
|
||||||
import { HighlightStyle, syntaxHighlighting } from "@codemirror/language"
|
import { HighlightStyle, syntaxHighlighting } from "@codemirror/language"
|
||||||
|
import { Extension } from "@codemirror/state"
|
||||||
|
import { EditorView } from "@codemirror/view"
|
||||||
import { tags as t } from "@lezer/highlight"
|
import { tags as t } from "@lezer/highlight"
|
||||||
|
|
||||||
// Using https://github.com/one-dark/vscode-one-dark-theme/ as reference for the colors
|
// Using https://github.com/one-dark/vscode-one-dark-theme/ as reference for the colors
|
||||||
|
|||||||
Reference in New Issue
Block a user