Skip to content

Commit

Permalink
chore: update auto import (#479)
Browse files Browse the repository at this point in the history
  • Loading branch information
YangFong authored Dec 19, 2024
1 parent e46f34e commit 828b92a
Show file tree
Hide file tree
Showing 20 changed files with 15 additions and 207 deletions.
23 changes: 0 additions & 23 deletions src/components/CodemirrorEditor/CssEditor.vue
Original file line number Diff line number Diff line change
@@ -1,29 +1,6 @@
<script setup lang="ts">
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from '@/components/ui/alert-dialog'
import { Button } from '@/components/ui/button'
import {
Dialog,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
} from '@/components/ui/dialog'
import { Input } from '@/components/ui/input'
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs'
import { useDisplayStore, useStore } from '@/stores'
import { Edit3, Plus, X } from 'lucide-vue-next'
import { ref } from 'vue'
import { toast } from 'vue-sonner'
const store = useStore()
const displayStore = useDisplayStore()
Expand Down
8 changes: 0 additions & 8 deletions src/components/CodemirrorEditor/EditorHeader/AboutDialog.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
<script setup lang="ts">
import {
Dialog,
DialogContent,
DialogFooter,
DialogHeader,
DialogTitle,
} from '@/components/ui/dialog'
const props = defineProps({
visible: {
type: Boolean,
Expand Down
6 changes: 0 additions & 6 deletions src/components/CodemirrorEditor/EditorHeader/EditDropdown.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
<script setup lang="ts">
import {
MenubarContent,
MenubarItem,
MenubarMenu,
MenubarTrigger,
} from '@/components/ui/menubar'
import { useDisplayStore } from '@/stores'
import { TableIcon, UploadCloudIcon } from 'lucide-vue-next'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script setup lang="ts">
import { useStore } from '@/stores'
import { Download, FileCode, Upload } from 'lucide-vue-next'
import { storeToRefs } from 'pinia'
const store = useStore()
Expand Down
4 changes: 0 additions & 4 deletions src/components/CodemirrorEditor/EditorHeader/HelpDropdown.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<script setup lang="ts">
import { ref } from 'vue'
import AboutDialog from './AboutDialog.vue'
const aboutDialogVisible = ref(false)
</script>

Expand Down
15 changes: 0 additions & 15 deletions src/components/CodemirrorEditor/EditorHeader/PostInfo.vue
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
<script setup lang="ts">
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert'
import {
Dialog,
DialogContent,
DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
} from '@/components/ui/dialog'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
import { Textarea } from '@/components/ui/textarea'
import { useStore } from '@/stores'
import { Info } from 'lucide-vue-next'
import { storeToRefs } from 'pinia'
import { ref } from 'vue'
const store = useStore()
const { output } = storeToRefs(store)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
<script setup lang="ts">
import {
HoverCard,
HoverCardContent,
HoverCardTrigger,
} from '@/components/ui/hover-card'
import { MenubarCheckboxItem } from '@/components/ui/menubar'
import {
codeBlockThemeOptions,
colorOptions,
Expand All @@ -14,10 +8,7 @@ import {
themeOptions,
} from '@/config'
import { useDisplayStore, useStore } from '@/stores'
import { storeToRefs } from 'pinia'
import { ref, useTemplateRef } from 'vue'
import PickColors, { type Format } from 'vue-pick-colors'
import StyleOptionMenu from './StyleOptionMenu.vue'
const store = useStore()
const { toggleShowCssEditor } = useDisplayStore()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<script setup lang="ts">
import type { IConfigOption } from '@/types'
import {
MenubarCheckboxItem,
MenubarSub,
MenubarSubContent,
MenubarSubTrigger,
} from '@/components/ui/menubar'
const props = defineProps<{
title: string
Expand Down
35 changes: 4 additions & 31 deletions src/components/CodemirrorEditor/EditorHeader/index.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
<script setup lang="ts">
import type { Format } from 'vue-pick-colors'
import { Button } from '@/components/ui/button'
import {
Menubar,
MenubarCheckboxItem,
MenubarContent,
MenubarMenu,
MenubarSeparator,
MenubarShortcut,
MenubarTrigger,
} from '@/components/ui/menubar'
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from '@/components/ui/select'
import { Toaster } from '@/components/ui/sonner'
import {
altSign,
Expand All @@ -34,16 +16,7 @@ import {
import { useDisplayStore, useStore } from '@/stores'
import { mergeCss, solveWeChatImage } from '@/utils'
import { Moon, PanelLeftClose, PanelLeftOpen, Settings, Sun } from 'lucide-vue-next'
import { storeToRefs } from 'pinia'
import { nextTick, ref, useTemplateRef } from 'vue'
import PickColors from 'vue-pick-colors'
import { toast } from 'vue-sonner'
import EditDropdown from './EditDropdown.vue'
import FileDropdown from './FileDropdown.vue'
import HelpDropdown from './HelpDropdown.vue'
import PostInfo from './PostInfo.vue'
import StyleDropdown from './StyleDropdown.vue'
const emit = defineEmits([`addFormat`, `formatContent`, `startCopy`, `endCopy`])
Expand Down Expand Up @@ -184,7 +157,7 @@ function customStyle() {
}, 50)
}
const pickColorsContainer = useTemplateRef<HTMLElement | undefined>('pickColorsContainer')
const pickColorsContainer = useTemplateRef<HTMLElement | undefined>(`pickColorsContainer`)
const format = ref<Format>(`rgb`)
const formatOptions = ref<Format[]>([`rgb`, `hex`, `hsl`, `hsv`])
</script>
Expand Down Expand Up @@ -290,13 +263,13 @@ const formatOptions = ref<Format[]>([`rgb`, `hex`, `hsl`, `hsv`])
<h2>自定义主题色</h2>
<div ref="pickColorsContainer">
<PickColors
v-if="pickColorsContainer"
v-model:value="primaryColor"
show-alpha
:format="format" :format-options="formatOptions"
show-alpha :format="format"
:format-options="formatOptions"
:theme="store.isDark ? 'dark' : 'light'"
:popup-container="pickColorsContainer"
@change="store.colorChanged"
v-if="pickColorsContainer"
/>
</div>
</div>
Expand Down
17 changes: 0 additions & 17 deletions src/components/CodemirrorEditor/InsertFormDialog.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
<script setup lang="ts">
import {
Dialog,
DialogContent,
DialogFooter,
DialogHeader,
DialogTitle,
} from '@/components/ui/dialog'
import { Label } from '@/components/ui/label'
import {
NumberField,
NumberFieldContent,
NumberFieldDecrement,
NumberFieldIncrement,
NumberFieldInput,
} from '@/components/ui/number-field'
import { useDisplayStore, useStore } from '@/stores'
import { createTable } from '@/utils'
import { ref, toRaw } from 'vue'
const store = useStore()
const displayStore = useDisplayStore()
Expand Down
29 changes: 0 additions & 29 deletions src/components/CodemirrorEditor/PostSlider.vue
Original file line number Diff line number Diff line change
@@ -1,35 +1,6 @@
<script setup lang="ts">
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from '@/components/ui/alert-dialog'
import { Button } from '@/components/ui/button'
import {
Dialog,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
} from '@/components/ui/dialog'
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu'
import { Input } from '@/components/ui/input'
import { useStore } from '@/stores'
import { Edit3, Ellipsis, Plus, Trash } from 'lucide-vue-next'
import { ref, watch } from 'vue'
import { toast } from 'vue-sonner'
const store = useStore()
Expand Down
17 changes: 0 additions & 17 deletions src/components/CodemirrorEditor/UploadImgDialog.vue
Original file line number Diff line number Diff line change
@@ -1,24 +1,7 @@
<script setup lang="ts">
import CustomUploadForm from '@/components/CustomUploadForm.vue'
import FormItem from '@/components/FormItem.vue'
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from '@/components/ui/select'
import { Switch } from '@/components/ui/switch'
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
import { useDisplayStore } from '@/stores'
import { checkImage } from '@/utils'
import { useFileDialog } from '@vueuse/core'
import { UploadCloud } from 'lucide-vue-next'
import { onBeforeMount, ref } from 'vue'
import { toast } from 'vue-sonner'
const emit = defineEmits([`uploadImage`])
Expand Down
3 changes: 0 additions & 3 deletions src/components/CustomUploadForm.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<script setup lang='ts'>
import { useStore } from '@/stores'
import { removeLeft } from '@/utils'
import { useLocalStorage } from '@vueuse/core'
import CodeMirror from 'codemirror'
import { markRaw, nextTick, onMounted, ref, useTemplateRef } from 'vue'
import { toast } from 'vue-sonner'
const store = useStore()
Expand Down
2 changes: 0 additions & 2 deletions src/components/FormItem.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script setup lang="ts">
import { Label } from '@/components/ui/label'
const props = defineProps<{
label?: string
required?: boolean
Expand Down
2 changes: 0 additions & 2 deletions src/components/RunLoading.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue'
const loading = ref(true)
onMounted(() => {
Expand Down
4 changes: 0 additions & 4 deletions src/stores/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@ import DEFAULT_CSS_CONTENT from '@/assets/example/theme-css.txt?raw'
import { altKey, codeBlockThemeOptions, colorOptions, fontFamilyOptions, fontSizeOptions, legendOptions, shiftKey, themeMap, themeOptions } from '@/config'
import { addPrefix, css2json, customCssWithTemplate, customizeTheme, downloadMD, exportHTML, formatDoc } from '@/utils'
import { initRenderer } from '@/utils/renderer'
import { useDark, useStorage, useToggle } from '@vueuse/core'

import CodeMirror from 'codemirror'
import { marked } from 'marked'
import { defineStore } from 'pinia'
import { computed, markRaw, onMounted, ref, toRaw, watch } from 'vue'
import { toast } from 'vue-sonner'

export const useStore = defineStore(`store`, () => {
// 是否开启深色模式
Expand Down
1 change: 1 addition & 0 deletions src/utils/toast/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { toast } from 'vue-sonner'
28 changes: 0 additions & 28 deletions src/views/CodemirrorEditor.vue
Original file line number Diff line number Diff line change
@@ -1,30 +1,5 @@
<script setup lang="ts">
import type { ComponentPublicInstance } from 'vue'
import CssEditor from '@/components/CodemirrorEditor/CssEditor.vue'
import EditorHeader from '@/components/CodemirrorEditor/EditorHeader/index.vue'
import InsertFormDialog from '@/components/CodemirrorEditor/InsertFormDialog.vue'
import PostSlider from '@/components/CodemirrorEditor/PostSlider.vue'
import UploadImgDialog from '@/components/CodemirrorEditor/UploadImgDialog.vue'
import RunLoading from '@/components/RunLoading.vue'
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from '@/components/ui/alert-dialog'
import {
ContextMenu,
ContextMenuContent,
ContextMenuItem,
ContextMenuSeparator,
ContextMenuShortcut,
ContextMenuTrigger,
} from '@/components/ui/context-menu'
import { altKey, altSign, ctrlKey, shiftKey, shiftSign } from '@/config'
import { useDisplayStore, useStore } from '@/stores'
import {
Expand All @@ -34,9 +9,6 @@ import {
} from '@/utils'
import fileApi from '@/utils/file'
import CodeMirror from 'codemirror'
import { storeToRefs } from 'pinia'
import { onMounted, ref, toRaw, watch } from 'vue'
import { toast } from 'vue-sonner'
const store = useStore()
const displayStore = useDisplayStore()
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@
"isolatedModules": true,
"skipLibCheck": true
},
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue", "components.d.ts", "auto-imports.d.ts"]
}
10 changes: 9 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,15 @@ export default defineConfig({
filename: `stats.html`,
}),
AutoImport({
resolvers: [],
imports: [
`vue`,
`pinia`,
`@vueuse/core`,
],
dirs: [
`./src/stores`,
`./src/utils/toast`,
],
}),
Components({
resolvers: [],
Expand Down

0 comments on commit 828b92a

Please sign in to comment.