@@ -30,9 +30,21 @@
diff --git a/src/components/authorize-form/types.ts b/src/components/authorize-form/types.ts
new file mode 100644
index 0000000..fa5a569
--- /dev/null
+++ b/src/components/authorize-form/types.ts
@@ -0,0 +1,34 @@
+/** 带验证码的通用请求对象。 */
+export type CaptchaData
= {
+ captchaId: string;
+ captcha: string;
+ data: T;
+};
+
+/** 登录表单数据。 */
+export type LoginRequest = {
+ user: string;
+ password: string;
+};
+
+/** 注册表单数据。 */
+export type RegisterRequest = {
+ name: string;
+ password: string;
+ email?: string;
+};
+
+/** 验证码展示数据。 */
+export type CaptchaResult = {
+ id: string;
+ data: string;
+};
+
+/** 验证码请求函数。 */
+export type CaptchaRequest = (width: number, height: number) => Promise;
+
+/** 登录处理函数。 */
+export type LoginHandler = (request: CaptchaData) => Promise;
+
+/** 注册处理函数。 */
+export type RegisterHandler = (request: CaptchaData) => Promise;
diff --git a/src/components/code-editor/index.ts b/src/components/code-editor/index.ts
index 79a6b45..c63dcd5 100644
--- a/src/components/code-editor/index.ts
+++ b/src/components/code-editor/index.ts
@@ -1,5 +1,5 @@
import view from "./index.vue";
-import { Toolkit } from "timi-web";
+import { WebToolkit } from "timi-web";
import "./style.less";
export type CodeEditorScrollState = {
@@ -21,5 +21,5 @@ export type CodeEditorExpose = {
textareaRef?: HTMLTextAreaElement;
};
-export const CodeEditor = Toolkit.withInstall(view);
+export const CodeEditor = WebToolkit.withInstall(view);
export default CodeEditor;
diff --git a/src/components/index.ts b/src/components/index.ts
index 14d3a79..b523378 100644
--- a/src/components/index.ts
+++ b/src/components/index.ts
@@ -3,6 +3,7 @@ import AuthorizeForm from "~/components/authorize-form";
import RootLayout from "~/components/root-layout";
import UserProfile from "~/components/user-profile";
import UserProfilePopup from "~/components/user-profile/popup";
+import UserLevel from "~/components/user-level";
import CodeEditor from "~/components/code-editor";
import TiptapEditor from "~/components/tiptap-editor";
import TiptapView from "~/components/tiptap-view";
@@ -16,6 +17,7 @@ export default [
AuthorizeForm,
UserProfile,
UserProfilePopup,
+ UserLevel,
CodeEditor,
TiptapEditor,
TiptapView,
@@ -30,6 +32,7 @@ export {
AuthorizeForm,
UserProfile,
UserProfilePopup,
+ UserLevel,
CodeEditor,
TiptapEditor,
TiptapView,
@@ -54,3 +57,44 @@ export type {
export type {
NotifyEditorExpose
} from "./notify-editor";
+
+export type {
+ Article,
+ ArticleContentType,
+ Attachment,
+ UploadResult
+} from "./article-editor";
+
+export type {
+ NotifyContentType,
+ NotifyDetail
+} from "./notify-editor";
+
+export type {
+ CaptchaData,
+ CaptchaRequest,
+ CaptchaResult,
+ LoginHandler,
+ LoginRequest,
+ RegisterHandler,
+ RegisterRequest
+} from "./authorize-form/types";
+
+export {
+ ImageType
+} from "./user-profile";
+
+export type {
+ ImageTypeKey,
+ UserImageResolver,
+ UserProfileData,
+ UserView
+} from "./user-profile";
+
+export {
+ toUserLevel
+} from "./user-level";
+
+export type {
+ UserLevelInfo
+} from "./user-level";
diff --git a/src/components/notify-editor/content.ts b/src/components/notify-editor/content.ts
new file mode 100644
index 0000000..af5e4d3
--- /dev/null
+++ b/src/components/notify-editor/content.ts
@@ -0,0 +1,6 @@
+import type { NotifyContentType } from "./types";
+
+/** 将未知通知正文类型归一化为组件支持的类型。 */
+export function normalizeNotifyContentType(contentType?: string): NotifyContentType {
+ return contentType === "TEXT" ? "TEXT" : "TIP_TAP";
+}
diff --git a/src/components/notify-editor/index.ts b/src/components/notify-editor/index.ts
index 2a28533..17fd760 100644
--- a/src/components/notify-editor/index.ts
+++ b/src/components/notify-editor/index.ts
@@ -1,11 +1,13 @@
import view from "./index.vue";
-import { Toolkit } from "timi-web";
-import type { NotifyDetail } from "timi-web/editor";
+import { WebToolkit } from "timi-web";
+import type { NotifyDetail } from "./types";
+
+export type { NotifyContentType, NotifyDetail } from "./types";
export type NotifyEditorExpose = {
submit: () => Promise;
getPendingMediaCount: () => number;
};
-export const NotifyEditor = Toolkit.withInstall(view);
+export const NotifyEditor = WebToolkit.withInstall(view);
export default NotifyEditor;
diff --git a/src/components/notify-editor/index.vue b/src/components/notify-editor/index.vue
index da7d622..85c6fef 100644
--- a/src/components/notify-editor/index.vue
+++ b/src/components/notify-editor/index.vue
@@ -13,10 +13,11 @@
+
+
diff --git a/src/components/user-level/types.ts b/src/components/user-level/types.ts
new file mode 100644
index 0000000..afc99ce
--- /dev/null
+++ b/src/components/user-level/types.ts
@@ -0,0 +1,9 @@
+type UserLevelInfo = {
+ value: number;
+ percent: number;
+ nextLevelUp: number;
+};
+
+export type {
+ UserLevelInfo
+};
diff --git a/src/components/user-profile/index.ts b/src/components/user-profile/index.ts
index e3a10f0..75a0600 100644
--- a/src/components/user-profile/index.ts
+++ b/src/components/user-profile/index.ts
@@ -1,5 +1,14 @@
import view from "./index.vue";
-import { Toolkit } from "timi-web";
+import { WebToolkit } from "timi-web";
-export const UserProfile = Toolkit.withInstall(view);
+export const UserProfile = WebToolkit.withInstall(view);
export default UserProfile;
+
+export { ImageType } from "./types";
+
+export type {
+ ImageTypeKey,
+ UserImageResolver,
+ UserProfile as UserProfileData,
+ UserView
+} from "./types";
diff --git a/src/components/user-profile/index.vue b/src/components/user-profile/index.vue
index 59c6869..692bbc7 100644
--- a/src/components/user-profile/index.vue
+++ b/src/components/user-profile/index.vue
@@ -2,23 +2,23 @@