fix import path
This commit is contained in:
17
.gitignore
vendored
17
.gitignore
vendored
@@ -1,3 +1,11 @@
|
||||
/.npmrc
|
||||
/.eslintrc-auto-import.json
|
||||
/components.d.ts
|
||||
/examples/auto-imports.d.ts
|
||||
/CLAUDE.md
|
||||
/AGENTS.md
|
||||
/.claude
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
@@ -22,12 +30,3 @@ dist-ssr
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
/.eslintrc-auto-import.json
|
||||
/components.d.ts
|
||||
/examples/auto-imports.d.ts
|
||||
|
||||
/CLAUDE.md
|
||||
/AGENTS.md
|
||||
/.claude
|
||||
|
||||
|
||||
@@ -1,21 +1,18 @@
|
||||
<template>
|
||||
<div class="root">
|
||||
<h2 v-popup="`提示`">test popup</h2>
|
||||
<icon name="ZIP" :scale="2" disabled />
|
||||
<markdown-editor class="editor" v-model:data="data" :minRows="12" :max-rows="24" />
|
||||
<copyright />
|
||||
</div>
|
||||
<popup />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { Icon, Popup } from "timi-web";
|
||||
import MarkdownEditor from "~/components/markdown-editor/index.vue";
|
||||
|
||||
const data = ref("");
|
||||
|
||||
import { Copyright } from "timi-web";
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.root {
|
||||
width: 80%;
|
||||
|
||||
.sp {
|
||||
height: 520px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import { createApp } from "vue";
|
||||
import Root from "./Root.vue";
|
||||
import TimiWebUI, { axios, VPopup } from "timi-web"; // 本地开发
|
||||
|
||||
axios.defaults.baseURL = "http://localhost:8091";
|
||||
import { VPopup } from "timi-web"; // 本地开发
|
||||
|
||||
const app = createApp(Root);
|
||||
app.use(TimiWebUI);
|
||||
app.directive("popup", VPopup);
|
||||
app.mount("#root");
|
||||
|
||||
@@ -11,7 +11,11 @@
|
||||
"dev": "vite",
|
||||
"dev:doc": "pnpm run -C docs dev",
|
||||
"build": "vue-tsc --noEmit && vite build",
|
||||
"build:doc": "pnpm run -C docs build"
|
||||
"build:doc": "pnpm run -C docs build",
|
||||
"pub": "pnpm run build && npm publish --registry=https://nexus.imyeyu.com/repository/npm-timi/"
|
||||
},
|
||||
"publishConfig": {
|
||||
"registry": "https://nexus.imyeyu.com/repository/npm-timi/"
|
||||
},
|
||||
"files": [
|
||||
"dist/**",
|
||||
@@ -32,7 +36,7 @@
|
||||
"node": ">=16.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "1.12.0",
|
||||
"axios": "1.13.5",
|
||||
"less": "4.5.1",
|
||||
"marked": "^17.0.1",
|
||||
"marked-gfm-heading-id": "^4.1.3",
|
||||
|
||||
43
pnpm-lock.yaml
generated
43
pnpm-lock.yaml
generated
@@ -9,8 +9,8 @@ importers:
|
||||
.:
|
||||
dependencies:
|
||||
axios:
|
||||
specifier: 1.12.0
|
||||
version: 1.12.0
|
||||
specifier: 1.13.5
|
||||
version: 1.13.5
|
||||
less:
|
||||
specifier: 4.5.1
|
||||
version: 4.5.1
|
||||
@@ -539,66 +539,79 @@ packages:
|
||||
resolution: {integrity: sha512-Rn3n+FUk2J5VWx+ywrG/HGPTD9jXNbicRtTM11e/uorplArnXZYsVifnPPqNNP5BsO3roI4n8332ukpY/zN7rQ==}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-arm-musleabihf@4.55.1':
|
||||
resolution: {integrity: sha512-grPNWydeKtc1aEdrJDWk4opD7nFtQbMmV7769hiAaYyUKCT1faPRm2av8CX1YJsZ4TLAZcg9gTR1KvEzoLjXkg==}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@rollup/rollup-linux-arm64-gnu@4.55.1':
|
||||
resolution: {integrity: sha512-a59mwd1k6x8tXKcUxSyISiquLwB5pX+fJW9TkWU46lCqD/GRDe9uDN31jrMmVP3feI3mhAdvcCClhV8V5MhJFQ==}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-arm64-musl@4.55.1':
|
||||
resolution: {integrity: sha512-puS1MEgWX5GsHSoiAsF0TYrpomdvkaXm0CofIMG5uVkP6IBV+ZO9xhC5YEN49nsgYo1DuuMquF9+7EDBVYu4uA==}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@rollup/rollup-linux-loong64-gnu@4.55.1':
|
||||
resolution: {integrity: sha512-r3Wv40in+lTsULSb6nnoudVbARdOwb2u5fpeoOAZjFLznp6tDU8kd+GTHmJoqZ9lt6/Sys33KdIHUaQihFcu7g==}
|
||||
cpu: [loong64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-loong64-musl@4.55.1':
|
||||
resolution: {integrity: sha512-MR8c0+UxAlB22Fq4R+aQSPBayvYa3+9DrwG/i1TKQXFYEaoW3B5b/rkSRIypcZDdWjWnpcvxbNaAJDcSbJU3Lw==}
|
||||
cpu: [loong64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@rollup/rollup-linux-ppc64-gnu@4.55.1':
|
||||
resolution: {integrity: sha512-3KhoECe1BRlSYpMTeVrD4sh2Pw2xgt4jzNSZIIPLFEsnQn9gAnZagW9+VqDqAHgm1Xc77LzJOo2LdigS5qZ+gw==}
|
||||
cpu: [ppc64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-ppc64-musl@4.55.1':
|
||||
resolution: {integrity: sha512-ziR1OuZx0vdYZZ30vueNZTg73alF59DicYrPViG0NEgDVN8/Jl87zkAPu4u6VjZST2llgEUjaiNl9JM6HH1Vdw==}
|
||||
cpu: [ppc64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@rollup/rollup-linux-riscv64-gnu@4.55.1':
|
||||
resolution: {integrity: sha512-uW0Y12ih2XJRERZ4jAfKamTyIHVMPQnTZcQjme2HMVDAHY4amf5u414OqNYC+x+LzRdRcnIG1YodLrrtA8xsxw==}
|
||||
cpu: [riscv64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-riscv64-musl@4.55.1':
|
||||
resolution: {integrity: sha512-u9yZ0jUkOED1BFrqu3BwMQoixvGHGZ+JhJNkNKY/hyoEgOwlqKb62qu+7UjbPSHYjiVy8kKJHvXKv5coH4wDeg==}
|
||||
cpu: [riscv64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@rollup/rollup-linux-s390x-gnu@4.55.1':
|
||||
resolution: {integrity: sha512-/0PenBCmqM4ZUd0190j7J0UsQ/1nsi735iPRakO8iPciE7BQ495Y6msPzaOmvx0/pn+eJVVlZrNrSh4WSYLxNg==}
|
||||
cpu: [s390x]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-x64-gnu@4.55.1':
|
||||
resolution: {integrity: sha512-a8G4wiQxQG2BAvo+gU6XrReRRqj+pLS2NGXKm8io19goR+K8lw269eTrPkSdDTALwMmJp4th2Uh0D8J9bEV1vg==}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-x64-musl@4.55.1':
|
||||
resolution: {integrity: sha512-bD+zjpFrMpP/hqkfEcnjXWHMw5BIghGisOKPj+2NaNDuVT+8Ds4mPf3XcPHuat1tz89WRL+1wbcxKY3WSbiT7w==}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@rollup/rollup-openbsd-x64@4.55.1':
|
||||
resolution: {integrity: sha512-eLXw0dOiqE4QmvikfQ6yjgkg/xDM+MdU9YJuP4ySTibXU0oAvnEWXt7UDJmD4UkYialMfOGFPJnIHSe/kdzPxg==}
|
||||
@@ -888,8 +901,8 @@ packages:
|
||||
asynckit@0.4.0:
|
||||
resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==}
|
||||
|
||||
axios@1.12.0:
|
||||
resolution: {integrity: sha512-oXTDccv8PcfjZmPGlWsPSwtOJCZ/b6W5jAMCNcfwJbCzDckwG0jrYJFaWH1yvivfCXjVzV/SPDEhMB3Q+DSurg==}
|
||||
axios@1.13.5:
|
||||
resolution: {integrity: sha512-cz4ur7Vb0xS4/KUN0tPWe44eqxrIu31me+fbang3ijiNscE129POzipJJA6zniq2C/Z6sJCjMimjS8Lc/GAs8Q==}
|
||||
|
||||
babel-plugin-prismjs@2.1.0:
|
||||
resolution: {integrity: sha512-ehzSKYfeAz4U78zi/sfwsjDPlq0LvDKxNefcZTJ/iKBu+plsHsLqZhUeGf1+82LAcA35UZGbU6ksEx2Utphc/g==}
|
||||
@@ -1218,8 +1231,8 @@ packages:
|
||||
flatted@3.3.1:
|
||||
resolution: {integrity: sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==}
|
||||
|
||||
follow-redirects@1.15.6:
|
||||
resolution: {integrity: sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==}
|
||||
follow-redirects@1.15.11:
|
||||
resolution: {integrity: sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==}
|
||||
engines: {node: '>=4.0'}
|
||||
peerDependencies:
|
||||
debug: '*'
|
||||
@@ -2711,10 +2724,6 @@ snapshots:
|
||||
|
||||
'@vue/shared@3.5.26': {}
|
||||
|
||||
acorn-jsx@5.3.2(acorn@8.14.1):
|
||||
dependencies:
|
||||
acorn: 8.14.1
|
||||
|
||||
acorn-jsx@5.3.2(acorn@8.15.0):
|
||||
dependencies:
|
||||
acorn: 8.15.0
|
||||
@@ -2772,9 +2781,9 @@ snapshots:
|
||||
|
||||
asynckit@0.4.0: {}
|
||||
|
||||
axios@1.12.0:
|
||||
axios@1.13.5:
|
||||
dependencies:
|
||||
follow-redirects: 1.15.6
|
||||
follow-redirects: 1.15.11
|
||||
form-data: 4.0.5
|
||||
proxy-from-env: 1.1.0
|
||||
transitivePeerDependencies:
|
||||
@@ -3047,8 +3056,8 @@ snapshots:
|
||||
|
||||
espree@9.6.1:
|
||||
dependencies:
|
||||
acorn: 8.14.1
|
||||
acorn-jsx: 5.3.2(acorn@8.14.1)
|
||||
acorn: 8.15.0
|
||||
acorn-jsx: 5.3.2(acorn@8.15.0)
|
||||
eslint-visitor-keys: 3.4.3
|
||||
|
||||
esquery@1.5.0:
|
||||
@@ -3101,7 +3110,7 @@ snapshots:
|
||||
|
||||
flatted@3.3.1: {}
|
||||
|
||||
follow-redirects@1.15.6: {}
|
||||
follow-redirects@1.15.11: {}
|
||||
|
||||
form-data@4.0.5:
|
||||
dependencies:
|
||||
@@ -3753,14 +3762,14 @@ snapshots:
|
||||
|
||||
vue-eslint-parser@9.4.3(eslint@9.39.2):
|
||||
dependencies:
|
||||
debug: 4.4.0
|
||||
debug: 4.4.3
|
||||
eslint: 9.39.2
|
||||
eslint-scope: 7.2.2
|
||||
eslint-visitor-keys: 3.4.3
|
||||
espree: 9.6.1
|
||||
esquery: 1.5.0
|
||||
lodash: 4.17.21
|
||||
semver: 7.7.1
|
||||
semver: 7.7.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { ArticleView, axios } from "timi-web";
|
||||
import { ArticleView } from "../types";
|
||||
import { axios } from "./BaseAPI";
|
||||
|
||||
/**
|
||||
* 获取文章
|
||||
|
||||
16
src/api/BaseAPI.ts
Normal file
16
src/api/BaseAPI.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import Network from "../utils/Network";
|
||||
|
||||
let serviceAxios: any | null = null;
|
||||
|
||||
function getServiceAxios(): any {
|
||||
if (serviceAxios === null) {
|
||||
serviceAxios = Network.axios;
|
||||
}
|
||||
return serviceAxios;
|
||||
}
|
||||
|
||||
export const axios = new Proxy({} as any, {
|
||||
get(_target: any, prop: string | symbol, receiver: any): any {
|
||||
return Reflect.get(getServiceAxios(), prop, receiver);
|
||||
}
|
||||
});
|
||||
@@ -1,4 +1,5 @@
|
||||
import { axios, CaptchaData, Comment, CommentReply, Page, PageResult } from "~/index";
|
||||
import { CaptchaData, Comment, CommentReply, Page, PageResult } from "../types";
|
||||
import { axios } from "./BaseAPI";
|
||||
|
||||
const BASE_URI = "/comment";
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { axios, SettingKey, TemplateBizType, Toolkit } from "~/index";
|
||||
import { TemplateBizType } from "../types";
|
||||
import Toolkit from "../utils/Toolkit";
|
||||
import { axios } from "./BaseAPI";
|
||||
|
||||
const getCaptchaAPI = () => axios.defaults.baseURL + "/captcha";
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { axios, Developer } from "~/index";
|
||||
import { Developer } from "../types";
|
||||
import { axios } from "./BaseAPI";
|
||||
|
||||
const BASE_URI = "/git/developer";
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import {
|
||||
Attachment,
|
||||
axios,
|
||||
CaptchaData,
|
||||
CommonAPI,
|
||||
LoginRequest,
|
||||
LoginResponse,
|
||||
RegisterRequest,
|
||||
UserAttachType,
|
||||
UserProfileView,
|
||||
UserView
|
||||
} from "~/index";
|
||||
} from "../types";
|
||||
import { axios } from "./BaseAPI";
|
||||
import CommonAPI from "./CommonAPI";
|
||||
|
||||
const BASE_URI = "/user";
|
||||
|
||||
|
||||
5
src/api/index.ts
Normal file
5
src/api/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export * from "./ArticleAPI";
|
||||
export * from "./CommentAPI";
|
||||
export * from "./CommonAPI";
|
||||
export * from "./DeveloperAPI"
|
||||
export * from "./UserAPI";
|
||||
@@ -1,18 +1,18 @@
|
||||
@import url(~/assets/style/variable);
|
||||
@import url(./variable);
|
||||
|
||||
*::-webkit-scrollbar {
|
||||
.custom-scroll-bar *::-webkit-scrollbar {
|
||||
width: 10px !important;
|
||||
height: 10px !important;
|
||||
cursor: var(--tui-cur-default);
|
||||
background: #CFD2E0;
|
||||
}
|
||||
|
||||
*::-webkit-scrollbar-corner {
|
||||
.custom-scroll-bar *::-webkit-scrollbar-corner {
|
||||
background: #CFD2E0;
|
||||
cursor: var(--tui-cur-default);
|
||||
}
|
||||
|
||||
*::-webkit-scrollbar-thumb {
|
||||
.custom-scroll-bar *::-webkit-scrollbar-thumb {
|
||||
cursor: var(--tui-cur-default);
|
||||
background: #525870;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import view from "./index.vue";
|
||||
import Toolkit from "~/utils/Toolkit";
|
||||
import Toolkit from "../../../utils/Toolkit";
|
||||
|
||||
export const BEFlowerFall = Toolkit.withInstall(view);
|
||||
export default BEFlowerFall;
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import Toolkit from "~/utils/Toolkit";
|
||||
import Resizer from "~/utils/Resizer";
|
||||
import Resizer from "../../../utils/Resizer";
|
||||
import Toolkit from "../../../utils/Toolkit";
|
||||
|
||||
defineOptions({
|
||||
name: "BEFlowerFall"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import view from "./index.vue";
|
||||
import Toolkit from "~/utils/Toolkit";
|
||||
import Toolkit from "../../utils/Toolkit";
|
||||
|
||||
export const Captcha = Toolkit.withInstall(view);
|
||||
export default Captcha;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import Toolkit from "~/utils/Toolkit";
|
||||
import Toolkit from "../../utils/Toolkit";
|
||||
|
||||
defineOptions({
|
||||
name: "Captcha"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import view from "./index.vue";
|
||||
import Toolkit from "~/utils/Toolkit";
|
||||
import Toolkit from "../../utils/Toolkit";
|
||||
|
||||
export const Copyright = Toolkit.withInstall(view);
|
||||
export default Copyright;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import view from "./index.vue";
|
||||
import Toolkit from "~/utils/Toolkit";
|
||||
import Toolkit from "../../utils/Toolkit";
|
||||
|
||||
export const EmptyTips = Toolkit.withInstall(view);
|
||||
export default EmptyTips;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import view from "./index.vue";
|
||||
import Toolkit from "~/utils/Toolkit";
|
||||
import Toolkit from "../../utils/Toolkit";
|
||||
|
||||
export const Icon = Toolkit.withInstall(view);
|
||||
export default Icon;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import IconMapper from "~/utils/IconMapper";
|
||||
import IconMapper from "../../utils/IconMapper";
|
||||
|
||||
defineOptions({
|
||||
name: "Icon"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import view from "./index.vue";
|
||||
import Toolkit from "~/utils/Toolkit";
|
||||
import Toolkit from "../../utils/Toolkit";
|
||||
|
||||
export const Loading = Toolkit.withInstall(view);
|
||||
export default Loading;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { Toolkit } from "~/index";
|
||||
import Toolkit from "../../utils/Toolkit";
|
||||
defineOptions({
|
||||
name: "Loading"
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import view from "./index.vue";
|
||||
import Toolkit from "~/utils/Toolkit";
|
||||
import Toolkit from "../../utils/Toolkit";
|
||||
|
||||
export const MarkdownEditor = Toolkit.withInstall(view);
|
||||
export default MarkdownEditor;
|
||||
|
||||
@@ -38,7 +38,8 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { Icon, MarkdownView } from "~/index";
|
||||
import { Icon } from "../icon";
|
||||
import { MarkdownView } from "../markdown-view";
|
||||
import calcHeight from "./CalcTextareaHeight";
|
||||
|
||||
defineOptions({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import view from "./index.vue";
|
||||
import Toolkit from "~/utils/Toolkit";
|
||||
import Toolkit from "../../utils/Toolkit";
|
||||
import "./style.less";
|
||||
|
||||
export const MarkdownView = Toolkit.withInstall(view);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import Prism from "prismjs";
|
||||
import Markdown from "~/utils/Markdown";
|
||||
import Markdown from "../../utils/Markdown";
|
||||
|
||||
defineOptions({
|
||||
name: "MarkdownView"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import url(~/assets/style/variable);
|
||||
@import url("../../assets/style/variable");
|
||||
|
||||
.tui-markdown-view {
|
||||
font-size: 14px;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import view from "./index.vue";
|
||||
import Toolkit from "~/utils/Toolkit";
|
||||
import Toolkit from "../../utils/Toolkit";
|
||||
|
||||
export const Popup = Toolkit.withInstall(view);
|
||||
export default Popup;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import view from "./index.vue";
|
||||
import Toolkit from "~/utils/Toolkit";
|
||||
import Toolkit from "../../utils/Toolkit";
|
||||
|
||||
export const UserLevel = Toolkit.withInstall(view);
|
||||
export default UserLevel;
|
||||
|
||||
83
src/index.ts
83
src/index.ts
@@ -2,54 +2,17 @@ import type { App } from "vue";
|
||||
|
||||
import components from "./components";
|
||||
|
||||
import Network from "./utils/Network";
|
||||
import UserAPI from "./api/UserAPI";
|
||||
import CommonAPI from "./api/CommonAPI";
|
||||
import ArticleAPI from "./api/ArticleAPI";
|
||||
import CommentAPI from "./api/CommentAPI";
|
||||
import DeveloperAPI from "./api/DeveloperAPI";
|
||||
|
||||
import Time from "./utils/Time";
|
||||
import IOSize from "./utils/IOSize";
|
||||
import Events from "./utils/Events";
|
||||
import Cooker from "./utils/Cooker";
|
||||
import Toolkit from "./utils/Toolkit";
|
||||
import Resizer from "./utils/Resizer";
|
||||
import Storage from "./utils/Storage";
|
||||
import Prismjs from "./utils/Prismjs";
|
||||
import Markdown from "./utils/Markdown";
|
||||
import Scroller from "./utils/Scroller";
|
||||
import IconMapper from "./utils/IconMapper";
|
||||
import SettingMapper from "./utils/SettingMapper";
|
||||
|
||||
import VPopup from "./utils/directives/Popup";
|
||||
import VDraggable from "./utils/directives/Draggable";
|
||||
|
||||
import { userStore } from "./store/user";
|
||||
import { deviceStore } from "./store/device";
|
||||
|
||||
|
||||
import "./assets/style/variable.less";
|
||||
import "./assets/style/timi-web.less";
|
||||
import { Network } from "./utils";
|
||||
|
||||
export * from "./api";
|
||||
export * from "./components";
|
||||
export * from "./store";
|
||||
export * from "./types";
|
||||
export * from "./utils";
|
||||
|
||||
export * from "./types/Model";
|
||||
export * from "./types/Article";
|
||||
export * from "./types/User";
|
||||
export * from "./types/Comment";
|
||||
export * from "./types/Setting";
|
||||
export * from "./types/Template";
|
||||
export * from "./types/Developer";
|
||||
export * from "./types/Attachment";
|
||||
|
||||
export * from "./utils/Prismjs";
|
||||
|
||||
export * from "./utils/directives/Popup";
|
||||
|
||||
export type { ScrollListener } from "./utils/Scroller";
|
||||
export type { DraggableConfig } from "./utils/directives/Draggable";
|
||||
export type { PopupConfig } from "./utils/directives/Popup";
|
||||
export const axios = Network.axios;
|
||||
|
||||
const install = function (app: App) {
|
||||
components.forEach(component => {
|
||||
@@ -57,40 +20,6 @@ const install = function (app: App) {
|
||||
});
|
||||
};
|
||||
|
||||
const axios = Network.axios;
|
||||
const setGlobalErrorCallback = Network.setGlobalErrorCallback;
|
||||
|
||||
export default {
|
||||
install
|
||||
};
|
||||
|
||||
export {
|
||||
axios,
|
||||
Network,
|
||||
setGlobalErrorCallback,
|
||||
|
||||
UserAPI,
|
||||
CommonAPI,
|
||||
ArticleAPI,
|
||||
CommentAPI,
|
||||
DeveloperAPI,
|
||||
|
||||
userStore,
|
||||
deviceStore,
|
||||
|
||||
Time,
|
||||
Events,
|
||||
IOSize,
|
||||
Cooker,
|
||||
Toolkit,
|
||||
Resizer,
|
||||
Storage,
|
||||
Prismjs,
|
||||
Markdown,
|
||||
Scroller,
|
||||
IconMapper,
|
||||
SettingMapper,
|
||||
|
||||
VPopup,
|
||||
VDraggable
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Resizer } from "~/index";
|
||||
import Resizer from "../utils/Resizer";
|
||||
|
||||
// true 为手机
|
||||
const isPhone = ref(false);
|
||||
|
||||
2
src/store/index.ts
Normal file
2
src/store/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./device";
|
||||
export * from "./user";
|
||||
@@ -1,4 +1,6 @@
|
||||
import { LoginResponse, LoginToken, LoginUser, Storage, UserAPI, UserToken } from "timi-web";
|
||||
import { LoginResponse, LoginToken, LoginUser, UserToken } from "../types";
|
||||
import Storage from "../utils/Storage";
|
||||
import UserAPI from "../api/UserAPI";
|
||||
|
||||
const loginUser = reactive<LoginUser>({
|
||||
token: undefined,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { AttachmentView, Model } from "timi-web";
|
||||
import type { AttachmentView } from "./Attachment";
|
||||
import type { Model } from "./Model";
|
||||
|
||||
// 文章
|
||||
export type Article<E extends ArticleMusicExtendData | ArticleSoftwareExtendData> = {
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
import type { Plugin } from "vue";
|
||||
|
||||
export * from "./Model";
|
||||
export * from "./Article";
|
||||
export * from "./Setting";
|
||||
export * from "./Attachment";
|
||||
export * from "./Model";
|
||||
export * from "./User";
|
||||
export * from "./Template";
|
||||
export * from "./Comment";
|
||||
export * from "./Developer";
|
||||
|
||||
/**
|
||||
* 安装方法
|
||||
*/
|
||||
@@ -8,7 +18,7 @@ export type InstallRecord<T> = T & Plugin;
|
||||
/**
|
||||
* 默认插槽参数
|
||||
*/
|
||||
export type DefaultSlotProp = (props: {}) => unknown
|
||||
export type DefaultSlotProp = (props: object) => unknown
|
||||
|
||||
/**
|
||||
* 默认插槽类型
|
||||
@@ -4,7 +4,7 @@ import { markedHighlight } from "marked-highlight";
|
||||
import { mangle } from "marked-mangle";
|
||||
import Prism from "prismjs";
|
||||
import "prismjs/themes/prism.css";
|
||||
import { Toolkit } from "~/index";
|
||||
import SettingMapper from "./SettingMapper";
|
||||
|
||||
export default class Markdown {
|
||||
|
||||
@@ -99,7 +99,7 @@ export default class Markdown {
|
||||
}
|
||||
// 内部资源链接
|
||||
if (href.indexOf("@") !== -1) {
|
||||
href = Toolkit.toResURL(href);
|
||||
href = SettingMapper.toResURL(href);
|
||||
}
|
||||
{
|
||||
// 处理嵌套 markdown,这可能不是最优解
|
||||
@@ -159,7 +159,7 @@ export default class Markdown {
|
||||
if (extendTag) {
|
||||
href = href.substring(1);
|
||||
}
|
||||
href = Toolkit.toResURL(href);
|
||||
href = SettingMapper.toResURL(href);
|
||||
}
|
||||
|
||||
const clazzStr = clazz.join(" ");
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import axios, { InternalAxiosRequestConfig } from "axios";
|
||||
import { Response } from "~/types/Model";
|
||||
import { Cooker, Time, userStore } from "~/index";
|
||||
import Cooker from "./Cooker";
|
||||
import type { Response } from "../types/Model";
|
||||
import Time from "./Time";
|
||||
import { userStore } from "../store/user";
|
||||
|
||||
type ErrorCallback = (response: Response<any>) => void;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { SettingKey } from "~/types/Setting";
|
||||
import { readonly, Ref, ref } from "vue";
|
||||
import CommonAPI from "~/api/CommonAPI";
|
||||
import { RunEnv, Toolkit } from "timi-web";
|
||||
import { RunEnv, SettingKey } from "../types";
|
||||
import Toolkit from "./Toolkit";
|
||||
import CommonAPI from "../api/CommonAPI";
|
||||
|
||||
export default class SettingMapper {
|
||||
|
||||
@@ -100,4 +100,22 @@ export default class SettingMapper {
|
||||
}
|
||||
return SettingMapper.instance = new SettingMapper();
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析资源 URL 协议前缀
|
||||
*
|
||||
* @param val 原始值,如 `res@/path/to/file`
|
||||
* @returns 完整 URL
|
||||
*/
|
||||
public static toResURL(val: string): string {
|
||||
const at = val.indexOf("@");
|
||||
const start = val.substring(0, at);
|
||||
const path = val.substring(at + 1);
|
||||
switch (start) {
|
||||
case "res": return SettingMapper.getDomainLink(SettingKey.DOMAIN_RESOURCE) + path;
|
||||
case "dl": return SettingMapper.getDomainLink(SettingKey.DOMAIN_DOWNLOAD) + path;
|
||||
case "attach": return CommonAPI.getAttachmentReadAPI(path);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import type { App } from "vue";
|
||||
import type { InstallRecord } from "~/types";
|
||||
import { UserLevelType } from "~/types/User";
|
||||
import { CommonAPI, SettingKey, SettingMapper } from "~/index";
|
||||
import { InstallRecord, UserLevelType } from "../types";
|
||||
|
||||
export default class Toolkit {
|
||||
|
||||
@@ -340,18 +338,6 @@ export default class Toolkit {
|
||||
return form;
|
||||
}
|
||||
|
||||
public static toResURL(val: string): string {
|
||||
const at = val.indexOf("@");
|
||||
const start = val.substring(0, at);
|
||||
const path = val.substring(at + 1);
|
||||
switch (start) {
|
||||
case "res": return SettingMapper.getDomainLink(SettingKey.DOMAIN_RESOURCE) + path;
|
||||
case "dl": return SettingMapper.getDomainLink(SettingKey.DOMAIN_DOWNLOAD) + path;
|
||||
case "attach": return CommonAPI.getAttachmentReadAPI(path);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
public static format(template: string, variables: { [key: string]: any }): string {
|
||||
return template.replace(/\$\{(\w+)}/g, (_, key) => variables[key]);
|
||||
}
|
||||
|
||||
22
src/utils/index.ts
Normal file
22
src/utils/index.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
export { default as Cooker } from "./Cooker";
|
||||
export { default as Events } from "./Events";
|
||||
export { default as IOSize } from "./IOSize";
|
||||
export { default as Markdown } from "./Markdown";
|
||||
export { default as Network } from "./Network";
|
||||
export { default as Prismjs } from "./Prismjs";
|
||||
export { default as Resizer } from "./Resizer";
|
||||
export { default as Scroller } from "./Scroller";
|
||||
export { default as Storage } from "./Storage";
|
||||
export { default as Time } from "./Time";
|
||||
export { default as Toolkit } from "./Toolkit";
|
||||
export { default as IconMapper } from "./IconMapper";
|
||||
export { default as SettingMapper } from "./SettingMapper";
|
||||
|
||||
export { default as VDraggable } from "./directives/Draggable";
|
||||
export { default as VPopup } from "./directives/Popup";
|
||||
|
||||
export * from "./MethodLocker";
|
||||
export * from "./Network";
|
||||
export * from "./Prismjs";
|
||||
export * from "./directives/Draggable";
|
||||
export * from "./directives/Popup";
|
||||
@@ -17,9 +17,6 @@
|
||||
"DOM.Iterable"
|
||||
],
|
||||
"paths": {
|
||||
"~/*": [
|
||||
"./src/*"
|
||||
],
|
||||
"@/*": [
|
||||
"./examples/*"
|
||||
],
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Node"
|
||||
"moduleResolution": "bundler"
|
||||
},
|
||||
"include": [
|
||||
"vite.config.ts"
|
||||
|
||||
@@ -12,14 +12,6 @@ const alias: Alias[] = [
|
||||
find: "@",
|
||||
replacement: resolve(__dirname, "./examples")
|
||||
},
|
||||
{
|
||||
find: "~",
|
||||
replacement: resolve(__dirname, "./src")
|
||||
},
|
||||
{
|
||||
find: "*",
|
||||
replacement: resolve("")
|
||||
},
|
||||
{
|
||||
find: /^timi-web(\/(es|lib))?$/,
|
||||
replacement: resolve(__dirname, "./src/index.ts")
|
||||
@@ -52,14 +44,6 @@ export default defineConfig({
|
||||
}
|
||||
},
|
||||
minify: "terser",
|
||||
terserOptions: {
|
||||
compress: {
|
||||
// eslint-disable-next-line camelcase
|
||||
drop_console: false,
|
||||
// eslint-disable-next-line camelcase
|
||||
drop_debugger: false
|
||||
}
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
vue({
|
||||
|
||||
Reference in New Issue
Block a user