diff --git a/.gitignore b/.gitignore index 1998e61..153c2df 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,5 @@ dist-ssr *.sln *.sw? .vscode -serve \ No newline at end of file +serve +miao-directory.exe \ No newline at end of file diff --git a/package.json b/package.json index f75c6a2..526581f 100644 --- a/package.json +++ b/package.json @@ -1,33 +1,48 @@ { - "name": "miao-directory-web", - "private": true, - "version": "0.0.0", - "type": "module", - "scripts": { - "dev": "vite", - "dev:host": "vite --host 0.0.0.0", - "build": "vue-tsc -b && vite build", - "preview": "vite preview" - }, - "dependencies": { - "@vicons/ionicons5": "^0.12.0", - "axios": "^1.7.3", - "lodash": "^4.17.21", - "naive-ui": "^2.39.0", - "pdfjs-dist": "^4.5.136", - "sass": "^1.77.8", - "vue": "^3.4.35", - "xgplayer": "^3.0.20", - "xgplayer-subtitles": "^3.0.20" - }, - "devDependencies": { - "@types/lodash": "^4.17.7", - "@types/node": "^22.1.0", - "@types/pdfjs-dist": "^2.10.378", - "@vitejs/plugin-vue": "^5.1.2", - "typescript": "^5.5.3", - "vite": "^5.4.0", - "vite-plugin-singlefile": "^2.0.2", - "vue-tsc": "^2.0.29" - } + "name": "miao-directory-web", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "dev:host": "vite --host 0.0.0.0", + "build": "vue-tsc -b && vite build", + "build:auto": "pnpm run build && rm -rf ./serve/web/* && cp -r ./dist/* ./serve/web/ && cd ./serve && go build && mv ./miao-directory.exe ../", + "preview": "vite preview" + }, + "dependencies": { + "@codemirror/lang-go": "^6.0.1", + "@codemirror/lang-html": "^6.4.9", + "@codemirror/lang-javascript": "^6.2.2", + "@codemirror/lang-json": "^6.0.1", + "@codemirror/lang-markdown": "^6.2.5", + "@codemirror/lang-python": "^6.1.6", + "@codemirror/lang-sass": "^6.0.2", + "@codemirror/lang-sql": "^6.7.1", + "@codemirror/lang-vue": "^0.1.3", + "@codemirror/lang-xml": "^6.1.0", + "@codemirror/lang-yaml": "^6.1.1", + "@uiw/codemirror-theme-vscode": "^4.23.0", + "@vicons/ionicons5": "^0.12.0", + "axios": "^1.7.3", + "codemirror": "^6.0.1", + "lodash": "^4.17.21", + "naive-ui": "^2.39.0", + "pdfjs-dist": "^4.5.136", + "sass": "^1.77.8", + "vue": "^3.4.35", + "vue-codemirror": "^6.1.1", + "xgplayer": "^3.0.20", + "xgplayer-subtitles": "^3.0.20" + }, + "devDependencies": { + "@types/lodash": "^4.17.7", + "@types/node": "^22.1.0", + "@types/pdfjs-dist": "^2.10.378", + "@vitejs/plugin-vue": "^5.1.2", + "typescript": "^5.5.3", + "vite": "^5.4.0", + "vite-plugin-singlefile": "^2.0.2", + "vue-tsc": "^2.0.29" + } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d356f13..a9deccf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,12 +8,51 @@ importers: .: dependencies: + '@codemirror/lang-go': + specifier: ^6.0.1 + version: 6.0.1(@codemirror/view@6.33.0) + '@codemirror/lang-html': + specifier: ^6.4.9 + version: 6.4.9 + '@codemirror/lang-javascript': + specifier: ^6.2.2 + version: 6.2.2 + '@codemirror/lang-json': + specifier: ^6.0.1 + version: 6.0.1 + '@codemirror/lang-markdown': + specifier: ^6.2.5 + version: 6.2.5 + '@codemirror/lang-python': + specifier: ^6.1.6 + version: 6.1.6(@codemirror/view@6.33.0) + '@codemirror/lang-sass': + specifier: ^6.0.2 + version: 6.0.2(@codemirror/view@6.33.0) + '@codemirror/lang-sql': + specifier: ^6.7.1 + version: 6.7.1(@codemirror/view@6.33.0) + '@codemirror/lang-vue': + specifier: ^0.1.3 + version: 0.1.3 + '@codemirror/lang-xml': + specifier: ^6.1.0 + version: 6.1.0 + '@codemirror/lang-yaml': + specifier: ^6.1.1 + version: 6.1.1(@codemirror/view@6.33.0) + '@uiw/codemirror-theme-vscode': + specifier: ^4.23.0 + version: 4.23.0(@codemirror/language@6.10.2)(@codemirror/state@6.4.1)(@codemirror/view@6.33.0) '@vicons/ionicons5': specifier: ^0.12.0 version: 0.12.0 axios: specifier: ^1.7.3 version: 1.7.3 + codemirror: + specifier: ^6.0.1 + version: 6.0.1(@lezer/common@1.2.1) lodash: specifier: ^4.17.21 version: 4.17.21 @@ -29,6 +68,9 @@ importers: vue: specifier: ^3.4.35 version: 3.4.37(typescript@5.5.4) + vue-codemirror: + specifier: ^6.1.1 + version: 6.1.1(codemirror@6.0.1(@lezer/common@1.2.1))(vue@3.4.37(typescript@5.5.4)) xgplayer: specifier: ^3.0.20 version: 3.0.20(core-js@3.38.1) @@ -84,6 +126,68 @@ packages: resolution: {integrity: sha512-YTnYtra7W9e6/oAZEHj0bJehPRUlLH9/fbpT5LfB0NhQXyALCRkRs3zH9v07IYhkgpqX6Z78FnuccZr/l4Fs4Q==} engines: {node: '>=6.9.0'} + '@codemirror/autocomplete@6.18.0': + resolution: {integrity: sha512-5DbOvBbY4qW5l57cjDsmmpDh3/TeK1vXfTHa+BUMrRzdWdcxKZ4U4V7vQaTtOpApNU4kLS4FQ6cINtLg245LXA==} + peerDependencies: + '@codemirror/language': ^6.0.0 + '@codemirror/state': ^6.0.0 + '@codemirror/view': ^6.0.0 + '@lezer/common': ^1.0.0 + + '@codemirror/commands@6.6.0': + resolution: {integrity: sha512-qnY+b7j1UNcTS31Eenuc/5YJB6gQOzkUoNmJQc0rznwqSRpeaWWpjkWy2C/MPTcePpsKJEM26hXrOXl1+nceXg==} + + '@codemirror/lang-css@6.2.1': + resolution: {integrity: sha512-/UNWDNV5Viwi/1lpr/dIXJNWiwDxpw13I4pTUAsNxZdg6E0mI2kTQb0P2iHczg1Tu+H4EBgJR+hYhKiHKko7qg==} + + '@codemirror/lang-go@6.0.1': + resolution: {integrity: sha512-7fNvbyNylvqCphW9HD6WFnRpcDjr+KXX/FgqXy5H5ZS0eC5edDljukm/yNgYkwTsgp2busdod50AOTIy6Jikfg==} + + '@codemirror/lang-html@6.4.9': + resolution: {integrity: sha512-aQv37pIMSlueybId/2PVSP6NPnmurFDVmZwzc7jszd2KAF8qd4VBbvNYPXWQq90WIARjsdVkPbw29pszmHws3Q==} + + '@codemirror/lang-javascript@6.2.2': + resolution: {integrity: sha512-VGQfY+FCc285AhWuwjYxQyUQcYurWlxdKYT4bqwr3Twnd5wP5WSeu52t4tvvuWmljT4EmgEgZCqSieokhtY8hg==} + + '@codemirror/lang-json@6.0.1': + resolution: {integrity: sha512-+T1flHdgpqDDlJZ2Lkil/rLiRy684WMLc74xUnjJH48GQdfJo/pudlTRreZmKwzP8/tGdKf83wlbAdOCzlJOGQ==} + + '@codemirror/lang-markdown@6.2.5': + resolution: {integrity: sha512-Hgke565YcO4fd9pe2uLYxnMufHO5rQwRr+AAhFq8ABuhkrjyX8R5p5s+hZUTdV60O0dMRjxKhBLxz8pu/MkUVA==} + + '@codemirror/lang-python@6.1.6': + resolution: {integrity: sha512-ai+01WfZhWqM92UqjnvorkxosZ2aq2u28kHvr+N3gu012XqY2CThD67JPMHnGceRfXPDBmn1HnyqowdpF57bNg==} + + '@codemirror/lang-sass@6.0.2': + resolution: {integrity: sha512-l/bdzIABvnTo1nzdY6U+kPAC51czYQcOErfzQ9zSm9D8GmNPD0WTW8st/CJwBTPLO8jlrbyvlSEcN20dc4iL0Q==} + + '@codemirror/lang-sql@6.7.1': + resolution: {integrity: sha512-flQa7zemrLKk0TIrOJnpeyH/b29BcVybtsTeZMgAo40O6kGbrnUSCgwI3TF5iJY3O9VXJKKCA+i0CBVvDfr88w==} + + '@codemirror/lang-vue@0.1.3': + resolution: {integrity: sha512-QSKdtYTDRhEHCfo5zOShzxCmqKJvgGrZwDQSdbvCRJ5pRLWBS7pD/8e/tH44aVQT6FKm0t6RVNoSUWHOI5vNug==} + + '@codemirror/lang-xml@6.1.0': + resolution: {integrity: sha512-3z0blhicHLfwi2UgkZYRPioSgVTo9PV5GP5ducFH6FaHy0IAJRg+ixj5gTR1gnT/glAIC8xv4w2VL1LoZfs+Jg==} + + '@codemirror/lang-yaml@6.1.1': + resolution: {integrity: sha512-HV2NzbK9bbVnjWxwObuZh5FuPCowx51mEfoFT9y3y+M37fA3+pbxx4I7uePuygFzDsAmCTwQSc/kXh/flab4uw==} + + '@codemirror/language@6.10.2': + resolution: {integrity: sha512-kgbTYTo0Au6dCSc/TFy7fK3fpJmgHDv1sG1KNQKJXVi+xBTEeBPY/M30YXiU6mMXeH+YIDLsbrT4ZwNRdtF+SA==} + + '@codemirror/lint@6.8.1': + resolution: {integrity: sha512-IZ0Y7S4/bpaunwggW2jYqwLuHj0QtESf5xcROewY6+lDNwZ/NzvR4t+vpYgg9m7V8UXLPYqG+lu3DF470E5Oxg==} + + '@codemirror/search@6.5.6': + resolution: {integrity: sha512-rpMgcsh7o0GuCDUXKPvww+muLA1pDJaFrpq/CCHtpQJYz8xopu4D1hPcKRoDD0YlF8gZaqTNIRa4VRBWyhyy7Q==} + + '@codemirror/state@6.4.1': + resolution: {integrity: sha512-QkEyUiLhsJoZkbumGZlswmAhA7CBU02Wrz7zvH4SrcifbsqwlXShVXg65f3v/ts57W3dqyamEriMhij1Z3Zz4A==} + + '@codemirror/view@6.33.0': + resolution: {integrity: sha512-AroaR3BvnjRW8fiZBalAaK+ZzB5usGgI014YKElYZvQdNH5ZIidHlO+cyf/2rWzyBFRkvG6VhiXeAEbC53P2YQ==} + '@css-render/plugin-bem@0.15.14': resolution: {integrity: sha512-QK513CJ7yEQxm/P3EwsI+d+ha8kSOcjGvD6SevM41neEMxdULE+18iuQK6tEChAWMOQNQPLG/Rw3Khb69r5neg==} peerDependencies: @@ -241,6 +345,45 @@ packages: '@juggle/resize-observer@3.4.0': resolution: {integrity: sha512-dfLbk+PwWvFzSxwk3n5ySL0hfBog779o8h68wK/7/APo/7cgyWp5jcXockbxdk5kFRkbeXWm4Fbi9FrdN381sA==} + '@lezer/common@1.2.1': + resolution: {integrity: sha512-yemX0ZD2xS/73llMZIK6KplkjIjf2EvAHcinDi/TfJ9hS25G0388+ClHt6/3but0oOxinTcQHJLDXh6w1crzFQ==} + + '@lezer/css@1.1.8': + resolution: {integrity: sha512-7JhxupKuMBaWQKjQoLtzhGj83DdnZY9MckEOG5+/iLKNK2ZJqKc6hf6uc0HjwCX7Qlok44jBNqZhHKDhEhZYLA==} + + '@lezer/go@1.0.0': + resolution: {integrity: sha512-co9JfT3QqX1YkrMmourYw2Z8meGC50Ko4d54QEcQbEYpvdUvN4yb0NBZdn/9ertgvjsySxHsKzH3lbm3vqJ4Jw==} + + '@lezer/highlight@1.2.1': + resolution: {integrity: sha512-Z5duk4RN/3zuVO7Jq0pGLJ3qynpxUVsh7IbUbGj88+uV2ApSAn6kWg2au3iJb+0Zi7kKtqffIESgNcRXWZWmSA==} + + '@lezer/html@1.3.10': + resolution: {integrity: sha512-dqpT8nISx/p9Do3AchvYGV3qYc4/rKr3IBZxlHmpIKam56P47RSHkSF5f13Vu9hebS1jM0HmtJIwLbWz1VIY6w==} + + '@lezer/javascript@1.4.17': + resolution: {integrity: sha512-bYW4ctpyGK+JMumDApeUzuIezX01H76R1foD6LcRX224FWfyYit/HYxiPGDjXXe/wQWASjCvVGoukTH68+0HIA==} + + '@lezer/json@1.0.2': + resolution: {integrity: sha512-xHT2P4S5eeCYECyKNPhr4cbEL9tc8w83SPwRC373o9uEdrvGKTZoJVAGxpOsZckMlEh9W23Pc72ew918RWQOBQ==} + + '@lezer/lr@1.4.2': + resolution: {integrity: sha512-pu0K1jCIdnQ12aWNaAVU5bzi7Bd1w54J3ECgANPmYLtQKP0HBj2cE/5coBD66MT10xbtIuUr7tg0Shbsvk0mDA==} + + '@lezer/markdown@1.3.0': + resolution: {integrity: sha512-ErbEQ15eowmJUyT095e9NJc3BI9yZ894fjSDtHftD0InkfUBGgnKSU6dvan9jqsZuNHg2+ag/1oyDRxNsENupQ==} + + '@lezer/python@1.1.14': + resolution: {integrity: sha512-ykDOb2Ti24n76PJsSa4ZoDF0zH12BSw1LGfQXCYJhJyOGiFTfGaX0Du66Ze72R+u/P35U+O6I9m8TFXov1JzsA==} + + '@lezer/sass@1.0.6': + resolution: {integrity: sha512-w/RCO2dIzZH1To8p+xjs8cE+yfgGus8NZ/dXeWl/QzHyr+TeBs71qiE70KPImEwvTsmEjoWh0A5SxMzKd5BWBQ==} + + '@lezer/xml@1.0.5': + resolution: {integrity: sha512-VFouqOzmUWfIg+tfmpcdV33ewtK+NSwd4ngSe1aG7HFb4BN0ExyY1b8msp+ndFrnlG4V4iC8yXacjFtrwERnaw==} + + '@lezer/yaml@1.0.3': + resolution: {integrity: sha512-GuBLekbw9jDBDhGur82nuwkxKQ+a3W5H0GfaAthDXcAu+XdpS43VlnxA9E9hllkpSP5ellRDKjLLj7Lu9Wr6xA==} + '@mapbox/node-pre-gyp@1.0.11': resolution: {integrity: sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==} hasBin: true @@ -353,6 +496,16 @@ packages: resolution: {integrity: sha512-TRdIPqdsvKmPla44kVy4jv5Nt5vjMfVjbIEke1CRULIrwKNRC4lIiZvNYDJvbUMNCFPNIUcOKhXTyMJrX18IMA==} deprecated: This is a stub types definition. pdfjs-dist provides its own type definitions, so you do not need this installed. + '@uiw/codemirror-theme-vscode@4.23.0': + resolution: {integrity: sha512-zl1FD7U1b58tqlF216jYv2okvVkTe+FP1ztqO/DF129bcH99QjszkakshyfxQEvvF4ys3zyzqZ7vU3VYBir8tg==} + + '@uiw/codemirror-themes@4.23.0': + resolution: {integrity: sha512-9fiji9xooZyBQozR1i6iTr56YP7j/Dr/VgsNWbqf5Szv+g+4WM1iZuiDGwNXmFMWX8gbkDzp6ASE21VCPSofWw==} + peerDependencies: + '@codemirror/language': '>=6.0.0' + '@codemirror/state': '>=6.0.0' + '@codemirror/view': '>=6.0.0' + '@vicons/ionicons5@0.12.0': resolution: {integrity: sha512-Iy1EUVRpX0WWxeu1VIReR1zsZLMc4fqpt223czR+Rpnrwu7pt46nbnC2ycO7ItI/uqDLJxnbcMC7FujKs9IfFA==} @@ -473,6 +626,9 @@ packages: resolution: {integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==} engines: {node: '>=10'} + codemirror@6.0.1: + resolution: {integrity: sha512-J8j+nZ+CdWmIeFIGXEFbFPtpiYacFMDR8GlHK3IyHQJMCaVRfGx9NT+Hxivv1ckLWPvNdZqndbr/7lVhrf/Svg==} + color-support@1.1.3: resolution: {integrity: sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==} hasBin: true @@ -493,6 +649,9 @@ packages: core-js@3.38.1: resolution: {integrity: sha512-OP35aUorbU3Zvlx7pjsFdu1rGNnD4pgw/CWoYzRY3t2EzoVT7shKHY1dlAy3f41cGIO7ZDPQimhGFTlEYkG/Hw==} + crelt@1.0.6: + resolution: {integrity: sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g==} + css-render@0.15.14: resolution: {integrity: sha512-9nF4PdUle+5ta4W5SyZdLCCmFd37uVimSjg1evcTqKJCyvCEEj12WKzOSBNak6r4im4J4iYXKH1OWpUV5LBYFg==} @@ -881,6 +1040,9 @@ packages: resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} engines: {node: '>=8'} + style-mod@4.1.2: + resolution: {integrity: sha512-wnD1HyVqpJUI2+eKZ+eo1UwghftP6yuFheBqqe+bWCotBjC2K1YnteJILRMs3SM4V/0dLEW1SC27MWP5y+mwmw==} + tar@6.2.1: resolution: {integrity: sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==} engines: {node: '>=10'} @@ -964,6 +1126,12 @@ packages: vscode-uri@3.0.8: resolution: {integrity: sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==} + vue-codemirror@6.1.1: + resolution: {integrity: sha512-rTAYo44owd282yVxKtJtnOi7ERAcXTeviwoPXjIc6K/IQYUsoDkzPvw/JDFtSP6T7Cz/2g3EHaEyeyaQCKoDMg==} + peerDependencies: + codemirror: 6.x + vue: 3.x + vue-tsc@2.0.29: resolution: {integrity: sha512-MHhsfyxO3mYShZCGYNziSbc63x7cQ5g9kvijV7dRe1TTXBRLxXyL0FnXWpUF1xII2mJ86mwYpYsUmMwkmerq7Q==} hasBin: true @@ -983,6 +1151,9 @@ packages: peerDependencies: vue: ^3.0.11 + w3c-keyname@2.2.8: + resolution: {integrity: sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==} + webidl-conversions@3.0.1: resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} @@ -1028,6 +1199,166 @@ snapshots: '@babel/helper-validator-identifier': 7.24.7 to-fast-properties: 2.0.0 + '@codemirror/autocomplete@6.18.0(@codemirror/language@6.10.2)(@codemirror/state@6.4.1)(@codemirror/view@6.33.0)(@lezer/common@1.2.1)': + dependencies: + '@codemirror/language': 6.10.2 + '@codemirror/state': 6.4.1 + '@codemirror/view': 6.33.0 + '@lezer/common': 1.2.1 + + '@codemirror/commands@6.6.0': + dependencies: + '@codemirror/language': 6.10.2 + '@codemirror/state': 6.4.1 + '@codemirror/view': 6.33.0 + '@lezer/common': 1.2.1 + + '@codemirror/lang-css@6.2.1(@codemirror/view@6.33.0)': + dependencies: + '@codemirror/autocomplete': 6.18.0(@codemirror/language@6.10.2)(@codemirror/state@6.4.1)(@codemirror/view@6.33.0)(@lezer/common@1.2.1) + '@codemirror/language': 6.10.2 + '@codemirror/state': 6.4.1 + '@lezer/common': 1.2.1 + '@lezer/css': 1.1.8 + transitivePeerDependencies: + - '@codemirror/view' + + '@codemirror/lang-go@6.0.1(@codemirror/view@6.33.0)': + dependencies: + '@codemirror/autocomplete': 6.18.0(@codemirror/language@6.10.2)(@codemirror/state@6.4.1)(@codemirror/view@6.33.0)(@lezer/common@1.2.1) + '@codemirror/language': 6.10.2 + '@codemirror/state': 6.4.1 + '@lezer/common': 1.2.1 + '@lezer/go': 1.0.0 + transitivePeerDependencies: + - '@codemirror/view' + + '@codemirror/lang-html@6.4.9': + dependencies: + '@codemirror/autocomplete': 6.18.0(@codemirror/language@6.10.2)(@codemirror/state@6.4.1)(@codemirror/view@6.33.0)(@lezer/common@1.2.1) + '@codemirror/lang-css': 6.2.1(@codemirror/view@6.33.0) + '@codemirror/lang-javascript': 6.2.2 + '@codemirror/language': 6.10.2 + '@codemirror/state': 6.4.1 + '@codemirror/view': 6.33.0 + '@lezer/common': 1.2.1 + '@lezer/css': 1.1.8 + '@lezer/html': 1.3.10 + + '@codemirror/lang-javascript@6.2.2': + dependencies: + '@codemirror/autocomplete': 6.18.0(@codemirror/language@6.10.2)(@codemirror/state@6.4.1)(@codemirror/view@6.33.0)(@lezer/common@1.2.1) + '@codemirror/language': 6.10.2 + '@codemirror/lint': 6.8.1 + '@codemirror/state': 6.4.1 + '@codemirror/view': 6.33.0 + '@lezer/common': 1.2.1 + '@lezer/javascript': 1.4.17 + + '@codemirror/lang-json@6.0.1': + dependencies: + '@codemirror/language': 6.10.2 + '@lezer/json': 1.0.2 + + '@codemirror/lang-markdown@6.2.5': + dependencies: + '@codemirror/autocomplete': 6.18.0(@codemirror/language@6.10.2)(@codemirror/state@6.4.1)(@codemirror/view@6.33.0)(@lezer/common@1.2.1) + '@codemirror/lang-html': 6.4.9 + '@codemirror/language': 6.10.2 + '@codemirror/state': 6.4.1 + '@codemirror/view': 6.33.0 + '@lezer/common': 1.2.1 + '@lezer/markdown': 1.3.0 + + '@codemirror/lang-python@6.1.6(@codemirror/view@6.33.0)': + dependencies: + '@codemirror/autocomplete': 6.18.0(@codemirror/language@6.10.2)(@codemirror/state@6.4.1)(@codemirror/view@6.33.0)(@lezer/common@1.2.1) + '@codemirror/language': 6.10.2 + '@codemirror/state': 6.4.1 + '@lezer/common': 1.2.1 + '@lezer/python': 1.1.14 + transitivePeerDependencies: + - '@codemirror/view' + + '@codemirror/lang-sass@6.0.2(@codemirror/view@6.33.0)': + dependencies: + '@codemirror/lang-css': 6.2.1(@codemirror/view@6.33.0) + '@codemirror/language': 6.10.2 + '@codemirror/state': 6.4.1 + '@lezer/common': 1.2.1 + '@lezer/sass': 1.0.6 + transitivePeerDependencies: + - '@codemirror/view' + + '@codemirror/lang-sql@6.7.1(@codemirror/view@6.33.0)': + dependencies: + '@codemirror/autocomplete': 6.18.0(@codemirror/language@6.10.2)(@codemirror/state@6.4.1)(@codemirror/view@6.33.0)(@lezer/common@1.2.1) + '@codemirror/language': 6.10.2 + '@codemirror/state': 6.4.1 + '@lezer/common': 1.2.1 + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + transitivePeerDependencies: + - '@codemirror/view' + + '@codemirror/lang-vue@0.1.3': + dependencies: + '@codemirror/lang-html': 6.4.9 + '@codemirror/lang-javascript': 6.2.2 + '@codemirror/language': 6.10.2 + '@lezer/common': 1.2.1 + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + + '@codemirror/lang-xml@6.1.0': + dependencies: + '@codemirror/autocomplete': 6.18.0(@codemirror/language@6.10.2)(@codemirror/state@6.4.1)(@codemirror/view@6.33.0)(@lezer/common@1.2.1) + '@codemirror/language': 6.10.2 + '@codemirror/state': 6.4.1 + '@codemirror/view': 6.33.0 + '@lezer/common': 1.2.1 + '@lezer/xml': 1.0.5 + + '@codemirror/lang-yaml@6.1.1(@codemirror/view@6.33.0)': + dependencies: + '@codemirror/autocomplete': 6.18.0(@codemirror/language@6.10.2)(@codemirror/state@6.4.1)(@codemirror/view@6.33.0)(@lezer/common@1.2.1) + '@codemirror/language': 6.10.2 + '@codemirror/state': 6.4.1 + '@lezer/common': 1.2.1 + '@lezer/highlight': 1.2.1 + '@lezer/yaml': 1.0.3 + transitivePeerDependencies: + - '@codemirror/view' + + '@codemirror/language@6.10.2': + dependencies: + '@codemirror/state': 6.4.1 + '@codemirror/view': 6.33.0 + '@lezer/common': 1.2.1 + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + style-mod: 4.1.2 + + '@codemirror/lint@6.8.1': + dependencies: + '@codemirror/state': 6.4.1 + '@codemirror/view': 6.33.0 + crelt: 1.0.6 + + '@codemirror/search@6.5.6': + dependencies: + '@codemirror/state': 6.4.1 + '@codemirror/view': 6.33.0 + crelt: 1.0.6 + + '@codemirror/state@6.4.1': {} + + '@codemirror/view@6.33.0': + dependencies: + '@codemirror/state': 6.4.1 + style-mod: 4.1.2 + w3c-keyname: 2.2.8 + '@css-render/plugin-bem@0.15.14(css-render@0.15.14)': dependencies: css-render: 0.15.14 @@ -1111,6 +1442,75 @@ snapshots: '@juggle/resize-observer@3.4.0': {} + '@lezer/common@1.2.1': {} + + '@lezer/css@1.1.8': + dependencies: + '@lezer/common': 1.2.1 + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + + '@lezer/go@1.0.0': + dependencies: + '@lezer/common': 1.2.1 + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + + '@lezer/highlight@1.2.1': + dependencies: + '@lezer/common': 1.2.1 + + '@lezer/html@1.3.10': + dependencies: + '@lezer/common': 1.2.1 + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + + '@lezer/javascript@1.4.17': + dependencies: + '@lezer/common': 1.2.1 + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + + '@lezer/json@1.0.2': + dependencies: + '@lezer/common': 1.2.1 + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + + '@lezer/lr@1.4.2': + dependencies: + '@lezer/common': 1.2.1 + + '@lezer/markdown@1.3.0': + dependencies: + '@lezer/common': 1.2.1 + '@lezer/highlight': 1.2.1 + + '@lezer/python@1.1.14': + dependencies: + '@lezer/common': 1.2.1 + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + + '@lezer/sass@1.0.6': + dependencies: + '@lezer/common': 1.2.1 + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + + '@lezer/xml@1.0.5': + dependencies: + '@lezer/common': 1.2.1 + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + + '@lezer/yaml@1.0.3': + dependencies: + '@lezer/common': 1.2.1 + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + '@mapbox/node-pre-gyp@1.0.11': dependencies: detect-libc: 2.0.3 @@ -1196,6 +1596,20 @@ snapshots: - encoding - supports-color + '@uiw/codemirror-theme-vscode@4.23.0(@codemirror/language@6.10.2)(@codemirror/state@6.4.1)(@codemirror/view@6.33.0)': + dependencies: + '@uiw/codemirror-themes': 4.23.0(@codemirror/language@6.10.2)(@codemirror/state@6.4.1)(@codemirror/view@6.33.0) + transitivePeerDependencies: + - '@codemirror/language' + - '@codemirror/state' + - '@codemirror/view' + + '@uiw/codemirror-themes@4.23.0(@codemirror/language@6.10.2)(@codemirror/state@6.4.1)(@codemirror/view@6.33.0)': + dependencies: + '@codemirror/language': 6.10.2 + '@codemirror/state': 6.4.1 + '@codemirror/view': 6.33.0 + '@vicons/ionicons5@0.12.0': {} '@vitejs/plugin-vue@5.1.2(vite@5.4.0(@types/node@22.1.0)(sass@1.77.8))(vue@3.4.37(typescript@5.5.4))': @@ -1369,6 +1783,18 @@ snapshots: chownr@2.0.0: optional: true + codemirror@6.0.1(@lezer/common@1.2.1): + dependencies: + '@codemirror/autocomplete': 6.18.0(@codemirror/language@6.10.2)(@codemirror/state@6.4.1)(@codemirror/view@6.33.0)(@lezer/common@1.2.1) + '@codemirror/commands': 6.6.0 + '@codemirror/language': 6.10.2 + '@codemirror/lint': 6.8.1 + '@codemirror/search': 6.5.6 + '@codemirror/state': 6.4.1 + '@codemirror/view': 6.33.0 + transitivePeerDependencies: + - '@lezer/common' + color-support@1.1.3: optional: true @@ -1386,6 +1812,8 @@ snapshots: core-js@3.38.1: {} + crelt@1.0.6: {} + css-render@0.15.14: dependencies: '@emotion/hash': 0.8.0 @@ -1833,6 +2261,8 @@ snapshots: ansi-regex: 5.0.1 optional: true + style-mod@4.1.2: {} + tar@6.2.1: dependencies: chownr: 2.0.0 @@ -1891,6 +2321,15 @@ snapshots: vscode-uri@3.0.8: {} + vue-codemirror@6.1.1(codemirror@6.0.1(@lezer/common@1.2.1))(vue@3.4.37(typescript@5.5.4)): + dependencies: + '@codemirror/commands': 6.6.0 + '@codemirror/language': 6.10.2 + '@codemirror/state': 6.4.1 + '@codemirror/view': 6.33.0 + codemirror: 6.0.1(@lezer/common@1.2.1) + vue: 3.4.37(typescript@5.5.4) + vue-tsc@2.0.29(typescript@5.5.4): dependencies: '@volar/typescript': 2.4.0-alpha.18 @@ -1919,6 +2358,8 @@ snapshots: vooks: 0.2.12(vue@3.4.37(typescript@5.5.4)) vue: 3.4.37(typescript@5.5.4) + w3c-keyname@2.2.8: {} + webidl-conversions@3.0.1: optional: true diff --git a/src/App.vue b/src/App.vue index fffe030..5c51614 100644 --- a/src/App.vue +++ b/src/App.vue @@ -327,7 +327,7 @@ $tag-width: 170px; display: flex; // flex-direction: column; height: calc(100% - $controller-height); - overflow-y: overlay; + overflow-y: hidden; overflow-x: overlay; .view-container-item { diff --git a/src/class/PluginCenter.ts b/src/class/PluginCenter.ts index f27c07d..f5f1505 100644 --- a/src/class/PluginCenter.ts +++ b/src/class/PluginCenter.ts @@ -1,5 +1,5 @@ -import useViretualPages from "@/hooks/useVirtualPages" -import VirtualDirectory, { VirtualFile } from "./VirtualDirectory" +import useVirtualPages from '@/hooks/useVirtualPages' +import VirtualDirectory, { VirtualFile } from './VirtualDirectory' type plugin = { // 用于显示的名字 @@ -18,43 +18,58 @@ export default class PluginCenter { [key: string]: plugin } - register(key: string, plugin: plugin){ + register(key: string, plugin: plugin) { this.pluginsMap[key] = plugin - console.log(this.pluginsMap) } /** * 便捷地注册一个组件为插件,触发时直接用新页面打开 */ - registerComponent(key: string,name: string, component: any, filter:(VDirectorys: VirtualDirectory[], VFiles: VirtualFile[]) => boolean): void { + registerComponent( + key: string, + name: string, + getComponent: () => Promise, + filter: ( + VDirectorys: VirtualDirectory[], + VFiles: VirtualFile[] + ) => boolean + ): void { + let _component: any + const views = useVirtualPages() this.register(key, { name, filter, - func: (VDirectorys: VirtualDirectory[], VFiles: VirtualFile[]) => { - if(filter(VDirectorys, VFiles) === false){ + func: async ( + VDirectorys: VirtualDirectory[], + VFiles: VirtualFile[] + ) => { + if (filter(VDirectorys, VFiles) === false) { return } - const views = useViretualPages() - views.push(component, VDirectorys, VFiles) + if (_component === undefined) _component = await getComponent() + views.push(_component, VDirectorys, VFiles) } }) } getUsablePlugin(VDirectorys: VirtualDirectory[], VFiles: VirtualFile[]) { const usableList = [] - for(let key of Object.keys(this.pluginsMap)) { - if(this.pluginsMap[key].filter(VDirectorys, VFiles)) { + for (let key of Object.keys(this.pluginsMap)) { + if (this.pluginsMap[key].filter(VDirectorys, VFiles)) { usableList.push(key) } } - return usableList.map(key=>({ + return usableList.map((key) => ({ key, ...this.pluginsMap[key] })) } - usePlugin(key: string, VDirectorys: VirtualDirectory[], VFiles: VirtualFile[]) { + usePlugin( + key: string, + VDirectorys: VirtualDirectory[], + VFiles: VirtualFile[] + ) { this.pluginsMap[key].func(VDirectorys, VFiles) } - -} \ No newline at end of file +} diff --git a/src/hooks/init.ts b/src/hooks/init.ts index 781a206..ac28ef5 100644 --- a/src/hooks/init.ts +++ b/src/hooks/init.ts @@ -1,15 +1,12 @@ import MiaoDirectory from '@/views/miaoDirectory.vue' import usePluginCenter from './usePluginCenter' -import MiaoVideoPlayer from '@/views/miaoVideoPlayer.vue' -import MiaoIframe from '@/views/miaoIframe.vue' -import MiaoPDF from '@/views/miaoPDF.vue' export default function init() { const pluginCenter = usePluginCenter() pluginCenter.registerComponent( 'miaoDirectory', '文件夹', - MiaoDirectory, + async () => MiaoDirectory, (vDirs, vFiles) => { if (vFiles.length) { return false @@ -20,7 +17,7 @@ export default function init() { pluginCenter.registerComponent( 'miaoVideoPlayer', '视频', - MiaoVideoPlayer, + async () => (await import('@/views/miaoVideoPlayer.vue')).default, (vDirs, vFiles) => { if (vDirs.length !== 0) { return false @@ -41,15 +38,21 @@ export default function init() { pluginCenter.registerComponent( 'miaoIframe', '框架', - MiaoIframe, - () => { - return false + async () => (await import('@/views/miaoIframe.vue')).default, + (vDirs, vFiles) => { + if (vDirs.length !== 0) { + return false + } + if (vFiles.length !== 1) { + return false + } + return vFiles[0].name.endsWith('html') } ) pluginCenter.registerComponent( 'miaoPDF', 'PDF浏览', - MiaoPDF, + async () => (await import('@/views/miaoPDF.vue')).default, (vDirs, vFiles) => { if (vDirs.length !== 0) { return false @@ -60,4 +63,39 @@ export default function init() { return vFiles[0].name.endsWith('pdf') } ) + pluginCenter.registerComponent( + 'miaoCodeMirror', + '代码编辑', + async () => (await import('@/views/miaoCodeMirror.vue')).default, + (vDirs, vFiles) => { + if (vDirs.length !== 0) { + return false + } + if (vFiles.length !== 1) { + return false + } + for (let end of [ + 'js', + 'ts', + 'jsx', + 'tsx', + 'py', + 'html', + 'css', + 'scss', + 'go', + 'json', + 'md', + 'yaml', + 'txt', + 'xml', + 'vue', + ]) { + if (vFiles[0].name.endsWith(end)) { + return true + } + } + return false + } + ) } diff --git a/src/hooks/useMiaoFetchApi.ts b/src/hooks/useMiaoFetchApi.ts index f1a5bd4..e336d22 100644 --- a/src/hooks/useMiaoFetchApi.ts +++ b/src/hooks/useMiaoFetchApi.ts @@ -67,9 +67,30 @@ const miaoFetchApi = { return response.data }, + /** + * 获取对应文件夹下的数据 + */ + async getFile( + vFile: VirtualFile, + option?: getOption + ): Promise { + // const { baseUrl, api } = Config + const url = vFile.url + const retry = option?.retry ?? 0 + const axiosOption = option?.axiosOption ?? {} + + const { miaoFetch } = useMiaoFetch({ + retry + }) + const response = await miaoFetch({ + url, ...axiosOption + }) + return response.data + }, + /** * 上传单个文件到对应文件夹, 后续要将data类型改成buffer以支持分片上传 - * 正常上传文件请使用uploadQueue + * 正常上传文件请使用uploadQueue */ upload(data: File, targetVDir: VirtualDirectory, option?: uploadOption) { const { baseUrl, api } = Config diff --git a/src/types/fetch.ts b/src/types/fetch.ts index 9fc1508..cfea9e2 100644 --- a/src/types/fetch.ts +++ b/src/types/fetch.ts @@ -1,8 +1,10 @@ +import { AxiosRequestConfig } from "axios"; import { directory, file } from "./type"; export type miaoFetchConfig = { - retry?: number; -}; + retry?: number + axiosOption?: AxiosRequestConfig +} export type getOption = {} & miaoFetchConfig; diff --git a/src/views/miaoCodeMirror.vue b/src/views/miaoCodeMirror.vue new file mode 100644 index 0000000..42888b5 --- /dev/null +++ b/src/views/miaoCodeMirror.vue @@ -0,0 +1,155 @@ + + + + + diff --git a/src/views/miaoPDF.vue b/src/views/miaoPDF.vue index 8c03d66..e592561 100644 --- a/src/views/miaoPDF.vue +++ b/src/views/miaoPDF.vue @@ -13,7 +13,7 @@ -
{{ loadingPercent === -1 ? '缓存中' : +
{{ loadingPercent === -1 ? '加载插件中' : `渲染进度:${canvasList.length}/${pdfPageCount}` }}
@@ -103,7 +103,7 @@ onMounted(async () => { .miao-container { width: 100%; height: 100%; - background-color: rgb(53, 53, 53); + background-color: rgb(201, 201, 201); overflow: hidden; display: flex; flex-direction: column; diff --git a/vite.config.ts b/vite.config.ts index f33024e..74e736e 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,11 +1,15 @@ import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import { resolve } from 'path' -import { viteSingleFile } from 'vite-plugin-singlefile' +// import { viteSingleFile } from 'vite-plugin-singlefile' // https://vitejs.dev/config/ export default defineConfig({ - plugins: [vue(), viteSingleFile()], + base: './', + plugins: [ + vue() + // viteSingleFile() + ], resolve: { alias: { '@': resolve(__dirname, 'src') @@ -59,11 +63,15 @@ export default defineConfig({ }, output: { // 配置输出为单文件 - inlineDynamicImports: true, - manualChunks: undefined, - entryFileNames: 'bundle.js', - format: 'iife', // 立即执行函数格式 - name: 'MyBundle' + // inlineDynamicImports: true, + manualChunks(id) { + if (id.includes('@codemirror')) { + return id.split('@')[1].replace('+', '-') + } + } + // entryFileNames: 'bundle.js', + // format: 'iife', // 立即执行函数格式 + // name: 'MyBundle' } } }