artalk 2.7.2 → 2.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/LICENSE +21 -0
  2. package/dist/Artalk.cjs +2 -0
  3. package/dist/Artalk.cjs.map +1 -0
  4. package/dist/Artalk.iife.js +1 -1
  5. package/dist/Artalk.iife.js.map +1 -1
  6. package/dist/Artalk.js +1 -1
  7. package/dist/Artalk.js.map +1 -1
  8. package/dist/{Artalk.es.js → Artalk.mjs} +96 -76
  9. package/dist/Artalk.mjs.map +1 -0
  10. package/dist/ArtalkLite.cjs +2 -0
  11. package/dist/ArtalkLite.cjs.map +1 -0
  12. package/dist/ArtalkLite.iife.js +1 -1
  13. package/dist/ArtalkLite.iife.js.map +1 -1
  14. package/dist/ArtalkLite.js +1 -1
  15. package/dist/ArtalkLite.js.map +1 -1
  16. package/dist/{ArtalkLite.es.js → ArtalkLite.mjs} +96 -81
  17. package/dist/ArtalkLite.mjs.map +1 -0
  18. package/dist/i18n/jp.cjs +1 -0
  19. package/dist/i18n/jp.d.cts +3 -0
  20. package/dist/i18n/jp.d.ts +3 -0
  21. package/dist/i18n/jp.mjs +93 -0
  22. package/dist/i18n/zh-TW.cjs +1 -0
  23. package/dist/i18n/zh-TW.d.cts +3 -0
  24. package/dist/i18n/zh-TW.d.ts +3 -0
  25. package/dist/i18n/zh-TW.mjs +93 -0
  26. package/dist/main.d.cts +1476 -0
  27. package/dist/main.d.ts +1476 -0
  28. package/package.json +60 -28
  29. package/dist/Artalk.es.js.map +0 -1
  30. package/dist/ArtalkLite.es.js.map +0 -1
  31. package/dist/src/api/_base.d.ts +0 -17
  32. package/dist/src/api/_options.d.ts +0 -24
  33. package/dist/src/api/_request.d.ts +0 -12
  34. package/dist/src/api/admin.d.ts +0 -10
  35. package/dist/src/api/captcha.d.ts +0 -14
  36. package/dist/src/api/comment.d.ts +0 -29
  37. package/dist/src/api/index.d.ts +0 -29
  38. package/dist/src/api/page.d.ts +0 -22
  39. package/dist/src/api/site.d.ts +0 -17
  40. package/dist/src/api/system.d.ts +0 -33
  41. package/dist/src/api/upload.d.ts +0 -11
  42. package/dist/src/api/user.d.ts +0 -42
  43. package/dist/src/artalk.d.ts +0 -35
  44. package/dist/src/comment/actions.d.ts +0 -17
  45. package/dist/src/comment/comment.d.ts +0 -66
  46. package/dist/src/comment/height-limit.d.ts +0 -30
  47. package/dist/src/comment/index.d.ts +0 -2
  48. package/dist/src/comment/render.d.ts +0 -46
  49. package/dist/src/comment/renders/actions.d.ts +0 -5
  50. package/dist/src/comment/renders/avatar.d.ts +0 -5
  51. package/dist/src/comment/renders/content.d.ts +0 -5
  52. package/dist/src/comment/renders/header.d.ts +0 -5
  53. package/dist/src/comment/renders/index.d.ts +0 -2
  54. package/dist/src/comment/renders/pending.d.ts +0 -5
  55. package/dist/src/comment/renders/reply-at.d.ts +0 -5
  56. package/dist/src/comment/renders/reply-to.d.ts +0 -5
  57. package/dist/src/components/action-btn.d.ts +0 -50
  58. package/dist/src/components/checker/admin.d.ts +0 -3
  59. package/dist/src/components/checker/captcha-renders.d.ts +0 -5
  60. package/dist/src/components/checker/captcha.d.ts +0 -3
  61. package/dist/src/components/checker/index.d.ts +0 -53
  62. package/dist/src/components/dialog.d.ts +0 -16
  63. package/dist/src/components/error-dialog.d.ts +0 -8
  64. package/dist/src/components/pagination.d.ts +0 -31
  65. package/dist/src/components/read-more-btn.d.ts +0 -33
  66. package/dist/src/config.d.ts +0 -24
  67. package/dist/src/context.d.ts +0 -45
  68. package/dist/src/data.d.ts +0 -27
  69. package/dist/src/defaults.d.ts +0 -3
  70. package/dist/src/editor/editor.d.ts +0 -31
  71. package/dist/src/editor/state.d.ts +0 -20
  72. package/dist/src/editor/ui.d.ts +0 -25
  73. package/dist/src/i18n/en.d.ts +0 -73
  74. package/dist/src/i18n/external.d.ts +0 -74
  75. package/dist/src/i18n/index.d.ts +0 -236
  76. package/dist/src/i18n/jp.d.ts +0 -73
  77. package/dist/src/i18n/zh-CN.d.ts +0 -3
  78. package/dist/src/i18n/zh-TW.d.ts +0 -73
  79. package/dist/src/layer/index.d.ts +0 -4
  80. package/dist/src/layer/layer-manager.d.ts +0 -9
  81. package/dist/src/layer/layer.d.ts +0 -12
  82. package/dist/src/layer/scrollbar-helper.d.ts +0 -5
  83. package/dist/src/layer/sidebar-layer.d.ts +0 -20
  84. package/dist/src/layer/wrap.d.ts +0 -13
  85. package/dist/src/lib/component.d.ts +0 -7
  86. package/dist/src/lib/detect.d.ts +0 -10
  87. package/dist/src/lib/event-manager.d.ts +0 -28
  88. package/dist/src/lib/highlight.d.ts +0 -1
  89. package/dist/src/lib/marked-renderer.d.ts +0 -4
  90. package/dist/src/lib/marked.d.ts +0 -11
  91. package/dist/src/lib/sanitizer.d.ts +0 -1
  92. package/dist/src/lib/ui.d.ts +0 -24
  93. package/dist/src/lib/user.d.ts +0 -21
  94. package/dist/src/lib/utils.d.ts +0 -41
  95. package/dist/src/list/comment.d.ts +0 -3
  96. package/dist/src/list/layout.d.ts +0 -23
  97. package/dist/src/list/list.d.ts +0 -14
  98. package/dist/src/list/nest.d.ts +0 -10
  99. package/dist/src/list/page.d.ts +0 -2
  100. package/dist/src/list/paginator/index.d.ts +0 -25
  101. package/dist/src/list/paginator/read-more.d.ts +0 -18
  102. package/dist/src/list/paginator/up-down.d.ts +0 -14
  103. package/dist/src/main.d.ts +0 -7
  104. package/dist/src/plugins/admin-only-elem.d.ts +0 -2
  105. package/dist/src/plugins/conf-remoter.d.ts +0 -2
  106. package/dist/src/plugins/dark-mode.d.ts +0 -2
  107. package/dist/src/plugins/editor/_kit.d.ts +0 -33
  108. package/dist/src/plugins/editor/_plug.d.ts +0 -29
  109. package/dist/src/plugins/editor/_sample.d.ts +0 -5
  110. package/dist/src/plugins/editor/closable.d.ts +0 -7
  111. package/dist/src/plugins/editor/emoticons.d.ts +0 -30
  112. package/dist/src/plugins/editor/header-event.d.ts +0 -6
  113. package/dist/src/plugins/editor/header-link.d.ts +0 -6
  114. package/dist/src/plugins/editor/header-user.d.ts +0 -16
  115. package/dist/src/plugins/editor/index.d.ts +0 -6
  116. package/dist/src/plugins/editor/local-storage.d.ts +0 -6
  117. package/dist/src/plugins/editor/mover.d.ts +0 -6
  118. package/dist/src/plugins/editor/preview.d.ts +0 -7
  119. package/dist/src/plugins/editor/state-edit.d.ts +0 -11
  120. package/dist/src/plugins/editor/state-reply.d.ts +0 -8
  121. package/dist/src/plugins/editor/submit-add.d.ts +0 -18
  122. package/dist/src/plugins/editor/submit-btn.d.ts +0 -5
  123. package/dist/src/plugins/editor/submit.d.ts +0 -17
  124. package/dist/src/plugins/editor/textarea.d.ts +0 -8
  125. package/dist/src/plugins/editor/upload.d.ts +0 -9
  126. package/dist/src/plugins/editor-kit.d.ts +0 -42
  127. package/dist/src/plugins/index.d.ts +0 -2
  128. package/dist/src/plugins/list/copyright.d.ts +0 -2
  129. package/dist/src/plugins/list/count.d.ts +0 -2
  130. package/dist/src/plugins/list/dropdown.d.ts +0 -2
  131. package/dist/src/plugins/list/error-dialog.d.ts +0 -2
  132. package/dist/src/plugins/list/fetch.d.ts +0 -2
  133. package/dist/src/plugins/list/goto-first.d.ts +0 -3
  134. package/dist/src/plugins/list/goto.d.ts +0 -2
  135. package/dist/src/plugins/list/index.d.ts +0 -3
  136. package/dist/src/plugins/list/loading.d.ts +0 -2
  137. package/dist/src/plugins/list/no-comment.d.ts +0 -2
  138. package/dist/src/plugins/list/reach-bottom.d.ts +0 -2
  139. package/dist/src/plugins/list/sidebar-btn.d.ts +0 -2
  140. package/dist/src/plugins/list/time-ticking.d.ts +0 -3
  141. package/dist/src/plugins/list/unread-badge.d.ts +0 -2
  142. package/dist/src/plugins/list/unread.d.ts +0 -2
  143. package/dist/src/plugins/list/with-editor.d.ts +0 -2
  144. package/dist/src/plugins/markdown.d.ts +0 -2
  145. package/dist/src/plugins/stat.d.ts +0 -13
  146. package/dist/src/plugins/version-check.d.ts +0 -2
  147. package/dist/src/service.d.ts +0 -36
  148. package/dist/tests/e2e/comment-add.spec.d.ts +0 -1
  149. package/dist/types/config.d.ts +0 -110
  150. package/dist/types/context.d.ts +0 -62
  151. package/dist/types/data.d.ts +0 -194
  152. package/dist/types/editor.d.ts +0 -76
  153. package/dist/types/event.d.ts +0 -39
  154. package/dist/types/global.d.ts +0 -1
  155. package/dist/types/index.d.ts +0 -7
  156. package/dist/types/plugin.d.ts +0 -2
  157. package/dist/types/sidebar.d.ts +0 -3
@@ -1,17 +0,0 @@
1
- import { ApiOptions } from './_options';
2
- declare abstract class ApiBase {
3
- protected options: ApiOptions;
4
- constructor(options: ApiOptions);
5
- protected POST<T>(path: string, data?: {
6
- [key: string]: any;
7
- }): Promise<T>;
8
- protected Fetch(path: string, init: RequestInit, timeout?: number): Promise<any>;
9
- /**
10
- * Carry user info to request params
11
- *
12
- * @param params Request params
13
- * @returns Request params with user info
14
- */
15
- protected withUserInfo(params: any): any;
16
- }
17
- export default ApiBase;
@@ -1,24 +0,0 @@
1
- export interface ApiOptions {
2
- baseURL: string;
3
- siteName: string;
4
- pageKey: string;
5
- pageTitle: string;
6
- timeout?: number;
7
- apiToken?: string;
8
- userInfo?: {
9
- name: string;
10
- email: string;
11
- };
12
- onNeedCheckCaptcha?: (payload: {
13
- recall: () => void;
14
- reject: () => void;
15
- data: {
16
- imgData: string;
17
- iframe: string;
18
- };
19
- }) => void;
20
- onNeedCheckAdmin?: (payload: {
21
- recall: () => void;
22
- reject: () => void;
23
- }) => void;
24
- }
@@ -1,12 +0,0 @@
1
- import { ApiOptions } from './_options';
2
- /** 公共请求函数 */
3
- export declare function Fetch(opts: ApiOptions, input: RequestInfo, init: RequestInit, timeout?: number): Promise<any>;
4
- /** 公共 POST 请求 */
5
- export declare function POST<T>(opts: ApiOptions, url: string, data?: {
6
- [key: string]: any;
7
- }): Promise<T>;
8
- /** 公共 GET 请求 (无 GET 方式 API) */
9
- /** 对象转 FormData */
10
- export declare function ToFormData(object: {
11
- [key: string]: any;
12
- }): FormData;
@@ -1,10 +0,0 @@
1
- import ApiBase from './_base';
2
- /**
3
- * 管理员 API
4
- */
5
- export default class AdminApi extends ApiBase {
6
- /** 缓存清除 */
7
- cacheFlushAll(): Promise<unknown>;
8
- /** 缓存预热 */
9
- cacheWarmUp(): Promise<unknown>;
10
- }
@@ -1,14 +0,0 @@
1
- import ApiBase from './_base';
2
- /**
3
- * 验证码 API
4
- */
5
- export default class CaptchaApi extends ApiBase {
6
- /** 验证码 · 获取 */
7
- captchaGet(): Promise<string>;
8
- /** 验证码 · 检验 */
9
- captchaCheck(value: string): Promise<string>;
10
- /** 验证码 · 状态 */
11
- captchaStatus(): Promise<{
12
- is_pass: boolean;
13
- }>;
14
- }
@@ -1,29 +0,0 @@
1
- import type { CommentData, ListData } from '../../types';
2
- import ApiBase from './_base';
3
- /**
4
- * 评论 API
5
- */
6
- export default class CommentApi extends ApiBase {
7
- /** 评论 · 获取 */
8
- get(offset: number, pageSize: number, flatMode?: boolean, paramsEditor?: (params: any) => void): Promise<ListData>;
9
- /** 评论 · 创建 */
10
- add(comment: {
11
- nick: string;
12
- email: string;
13
- link: string;
14
- content: string;
15
- rid: number;
16
- page_key: string;
17
- page_title?: string;
18
- site_name?: string;
19
- }): Promise<CommentData>;
20
- /** 评论 · 修改 */
21
- commentEdit(data: Partial<CommentData>): Promise<CommentData>;
22
- /** 评论 · 删除 */
23
- commentDel(commentID: number, siteName?: string): Promise<unknown>;
24
- /** 投票 */
25
- vote(targetID: number, type: string): Promise<{
26
- up: number;
27
- down: number;
28
- }>;
29
- }
@@ -1,29 +0,0 @@
1
- import { ApiOptions } from './_options';
2
- import comment from './comment';
3
- import page from './page';
4
- import site from './site';
5
- import user from './user';
6
- import system from './system';
7
- import captcha from './captcha';
8
- import admin from './admin';
9
- import upload from './upload';
10
- declare const ApiComponents: {
11
- comment: typeof comment;
12
- page: typeof page;
13
- site: typeof site;
14
- user: typeof user;
15
- system: typeof system;
16
- captcha: typeof captcha;
17
- admin: typeof admin;
18
- upload: typeof upload;
19
- };
20
- declare class Api {
21
- constructor(opts: ApiOptions);
22
- }
23
- type TC = typeof ApiComponents;
24
- type AC = {
25
- [K in keyof TC]: InstanceType<TC[K]>;
26
- };
27
- interface Api extends AC {
28
- }
29
- export default Api;
@@ -1,22 +0,0 @@
1
- import type { PageData, CommentData } from '../../types';
2
- import ApiBase from './_base';
3
- /**
4
- * 页面 API
5
- */
6
- export default class PageApi extends ApiBase {
7
- /** 页面 · 获取 */
8
- pageGet(siteName?: string, offset?: number, limit?: number): Promise<{
9
- pages: PageData[];
10
- total: number;
11
- }>;
12
- /** 页面 · 修改 */
13
- pageEdit(data: PageData): Promise<PageData>;
14
- /** 页面 · 删除 */
15
- pageDel(pageKey: string, siteName?: string): Promise<unknown>;
16
- /** 页面 · 数据更新 */
17
- pageFetch(id?: number, siteName?: string, getStatus?: boolean): Promise<any>;
18
- /** PV */
19
- pv(): Promise<number>;
20
- /** 统计 */
21
- stat(type: 'latest_comments' | 'latest_pages' | 'pv_most_pages' | 'comment_most_pages' | 'page_pv' | 'site_pv' | 'page_comment' | 'site_comment', pageKeys?: string | string[], limit?: number): Promise<number | object | CommentData[] | PageData[]>;
22
- }
@@ -1,17 +0,0 @@
1
- import type { SiteData } from '../../types';
2
- import ApiBase from './_base';
3
- /**
4
- * 站点 API
5
- */
6
- export default class SiteApi extends ApiBase {
7
- /** 站点 · 获取 */
8
- siteGet(): Promise<SiteData[]>;
9
- /** 站点 · 创建 */
10
- siteAdd(name: string, urls: string): Promise<SiteData>;
11
- /** 站点 · 修改 */
12
- siteEdit(data: SiteData): Promise<SiteData>;
13
- /** 站点 · 删除 */
14
- siteDel(id: number, delContent?: boolean): Promise<unknown>;
15
- /** 导出 */
16
- export(): Promise<any>;
17
- }
@@ -1,33 +0,0 @@
1
- import type { ArtalkConfig } from '../../types';
2
- import ApiBase from './_base';
3
- interface ApiVersionInfo {
4
- app: string;
5
- version: string;
6
- commit_hash: string;
7
- }
8
- interface SystemConfResp {
9
- frontend_conf: Partial<ArtalkConfig>;
10
- version: ApiVersionInfo;
11
- }
12
- /**
13
- * 系统 API
14
- */
15
- export default class SystemApi extends ApiBase {
16
- /** 获取配置 */
17
- conf(): Promise<SystemConfResp>;
18
- /** 获取配置数据 */
19
- getSettings(): Promise<{
20
- custom: string;
21
- template: string;
22
- }>;
23
- /** 保存配置数据 */
24
- saveSettings(yamlStr: string): Promise<boolean>;
25
- /** 获取 API 版本信息 */
26
- version(): Promise<{
27
- app: string;
28
- version: string;
29
- commit_hash: string;
30
- fe_min_version: string;
31
- }>;
32
- }
33
- export {};
@@ -1,11 +0,0 @@
1
- import ApiBase from './_base';
2
- /**
3
- * 上传 API
4
- */
5
- export default class UploadApi extends ApiBase {
6
- /** 图片上传 */
7
- imgUpload(file: File): Promise<{
8
- img_file: string;
9
- img_url: string;
10
- }>;
11
- }
@@ -1,42 +0,0 @@
1
- import type { UserData, NotifyData, UserDataForAdmin } from '../../types';
2
- import ApiBase from './_base';
3
- /**
4
- * 用户 API
5
- */
6
- export default class UserApi extends ApiBase {
7
- /** 用户 · 登录 */
8
- login(name: string, email: string, password: string): Promise<{
9
- token: string;
10
- user: UserData;
11
- }>;
12
- /** 用户 · 获取 */
13
- userGet(name: string, email: string): {
14
- req: Promise<{
15
- user: UserData | null;
16
- is_login: boolean;
17
- unread: NotifyData[];
18
- unread_count: any;
19
- }>;
20
- abort: () => void;
21
- };
22
- /** 用户 · 登录状态 */
23
- loginStatus(): Promise<{
24
- is_login: boolean;
25
- is_admin: boolean;
26
- }>;
27
- /** 用户 · 注销 */
28
- logout(): Promise<unknown>;
29
- /** 已读标记 */
30
- markRead(commentID: number, notifyKey: string, readAll?: boolean): Promise<unknown>;
31
- /** 用户 · 列表 */
32
- userList(offset?: number, limit?: number, type?: 'all' | 'admin' | 'in_conf'): Promise<{
33
- users: UserDataForAdmin[];
34
- total: number;
35
- }>;
36
- /** 用户 · 新增 */
37
- userAdd(user: Partial<UserDataForAdmin>, password?: string): Promise<UserDataForAdmin>;
38
- /** 用户 · 修改 */
39
- userEdit(user: Partial<UserDataForAdmin>, password?: string): Promise<UserDataForAdmin>;
40
- /** 用户 · 删除 */
41
- userDel(userID: number): Promise<unknown>;
42
- }
@@ -1,35 +0,0 @@
1
- import type { ArtalkConfig, EventPayloadMap, ArtalkPlugin, ContextApi } from '../types';
2
- import type { EventHandler } from './lib/event-manager';
3
- /**
4
- * Artalk
5
- *
6
- * @see https://artalk.js.org
7
- */
8
- export default class Artalk {
9
- conf: ArtalkConfig;
10
- ctx: ContextApi;
11
- $root: HTMLElement;
12
- /** Plugins */
13
- protected plugins: ArtalkPlugin[];
14
- constructor(conf: Partial<ArtalkConfig>);
15
- /** Update config of Artalk */
16
- update(conf: Partial<ArtalkConfig>): this;
17
- /** Reload comment list of Artalk */
18
- reload(): void;
19
- /** Destroy instance of Artalk */
20
- destroy(): void;
21
- /** Add an event listener */
22
- on<K extends keyof EventPayloadMap>(name: K, handler: EventHandler<EventPayloadMap[K]>): void;
23
- /** Remove an event listener */
24
- off<K extends keyof EventPayloadMap>(name: K, handler: EventHandler<EventPayloadMap[K]>): void;
25
- /** Trigger an event */
26
- trigger<K extends keyof EventPayloadMap>(name: K, payload?: EventPayloadMap[K]): void;
27
- /** Set dark mode */
28
- setDarkMode(darkMode: boolean): void;
29
- /** Init Artalk */
30
- static init(conf: Partial<ArtalkConfig>): Artalk;
31
- /** Use plugin, the plugin will be used when Artalk.init */
32
- static use(plugin: ArtalkPlugin): void;
33
- /** Load count widget */
34
- static loadCountWidget(c: Partial<ArtalkConfig>): void;
35
- }
@@ -1,17 +0,0 @@
1
- import type Comment from './comment';
2
- import ActionBtn from '../components/action-btn';
3
- export default class CommentActions {
4
- private comment;
5
- private get ctx();
6
- private get data();
7
- private get cConf();
8
- constructor(comment: Comment);
9
- /** 投票操作 */
10
- vote(type: 'up' | 'down'): void;
11
- /** 管理员 - 评论状态修改 */
12
- adminEdit(type: 'collapsed' | 'pending' | 'pinned', btnElem: ActionBtn): void;
13
- /** 管理员 - 评论删除 */
14
- adminDelete(btnElem: ActionBtn): void;
15
- /** 快速跳转到该评论 */
16
- goToReplyComment(): void;
17
- }
@@ -1,66 +0,0 @@
1
- import type { CommentData, ContextApi } from '../../types';
2
- import Component from '../lib/component';
3
- import CommentUI from './render';
4
- import CommentActions from './actions';
5
- export interface CommentConf {
6
- isUnread?: boolean;
7
- openURL?: string;
8
- isFlatMode: boolean;
9
- replyTo?: CommentData;
10
- afterRender?: () => void;
11
- openEvt?: () => void;
12
- onReplyBtnClick?: Function;
13
- onDelete?: Function;
14
- }
15
- export default class Comment extends Component {
16
- private renderInstance;
17
- private actionInstance;
18
- private data;
19
- private cConf;
20
- private parent;
21
- private children;
22
- private nestCurt;
23
- private nestMax;
24
- constructor(ctx: ContextApi, data: CommentData, conf: CommentConf);
25
- /** 渲染 UI */
26
- render(): void;
27
- /** 获取评论操作实例对象 */
28
- getActions(): CommentActions;
29
- /** 获取评论渲染器实例对象 */
30
- getRender(): CommentUI;
31
- /** 获取评论数据 */
32
- getData(): CommentData;
33
- /** 设置数据 */
34
- setData(data: CommentData): void;
35
- /** 获取父评论 */
36
- getParent(): Comment | null;
37
- /** 获取所有子评论 */
38
- getChildren(): Comment[];
39
- /** 获取当前嵌套层数 */
40
- getNestCurt(): number;
41
- /** 判断是否为根评论 */
42
- getIsRoot(): boolean;
43
- /** 获取评论 ID */
44
- getID(): number;
45
- /** 置入子评论 */
46
- putChild(childC: Comment, insertMode?: 'append' | 'prepend'): void;
47
- /** 获取存放子评论的元素对象 */
48
- getChildrenEl(): HTMLElement;
49
- /** 获取所有父评论 */
50
- getParents(): Comment[];
51
- /** 获取评论元素对象 */
52
- getEl(): HTMLElement;
53
- /** 获取 Gravatar 头像 URL */
54
- getGravatarURL(): string;
55
- /** 获取评论 markdown 解析后的内容 */
56
- getContentMarked(): string;
57
- /** 获取格式化后的日期 */
58
- getDateFormatted(): any;
59
- /** 获取用户 UserAgent 信息 */
60
- getUserUA(): {
61
- browser: string;
62
- os: string;
63
- };
64
- /** 获取配置 */
65
- getConf(): CommentConf;
66
- }
@@ -1,30 +0,0 @@
1
- export interface IHeightLimitConf {
2
- /** Post expand btn click */
3
- postExpandBtnClick?: (e: MouseEvent) => void;
4
- /** Allow Scroll */
5
- scrollable?: boolean;
6
- }
7
- export interface IHeightLimitRule {
8
- /** Target element need to check */
9
- el: HTMLElement | null | undefined;
10
- /** Max height (unit: px) */
11
- max: number;
12
- /** Whether or not the element contains `<img />` */
13
- imgContains?: boolean;
14
- }
15
- export type THeightLimitRuleSet = IHeightLimitRule[];
16
- /** Check all elements below the max height limit */
17
- export declare function check(conf: IHeightLimitConf, rules: THeightLimitRuleSet): void;
18
- /** Apply height limit on an element and add expand btn */
19
- export declare function applyHeightLimit(obj: {
20
- el: HTMLElement;
21
- maxHeight: number;
22
- postBtnClick?: (e: MouseEvent) => void;
23
- }): void;
24
- /** Dispose height limit on an element and remove expand btn */
25
- export declare function disposeHeightLimit($el: HTMLElement): void;
26
- /** Apply scrollable height limit */
27
- export declare function applyScrollableHeightLimit(obj: {
28
- el: HTMLElement;
29
- maxHeight: number;
30
- }): void;
@@ -1,2 +0,0 @@
1
- import Comment from './comment';
2
- export default Comment;
@@ -1,46 +0,0 @@
1
- import type Comment from './comment';
2
- import ActionBtn from '../components/action-btn';
3
- export default class Render {
4
- comment: Comment;
5
- get ctx(): import("../../types").ContextApi;
6
- get data(): import("../../types").CommentData;
7
- get conf(): import("../../types").ArtalkConfig;
8
- get cConf(): import("./comment").CommentConf;
9
- $el: HTMLElement;
10
- $main: HTMLElement;
11
- $header: HTMLElement;
12
- $headerNick: HTMLElement;
13
- $headerBadgeWrap: HTMLElement;
14
- $body: HTMLElement;
15
- $content: HTMLElement;
16
- $childrenWrap: HTMLElement | null;
17
- $actions: HTMLElement;
18
- voteBtnUp?: ActionBtn;
19
- voteBtnDown?: ActionBtn;
20
- $replyTo?: HTMLElement;
21
- $replyAt?: HTMLElement;
22
- constructor(comment: Comment);
23
- render(): HTMLElement;
24
- /** 内容限高检测 */
25
- checkHeightLimit(): void;
26
- /** 子评论区域移除限高 */
27
- heightLimitRemoveForChildren(): void;
28
- /** 渐出动画 */
29
- playFadeAnim(): void;
30
- /** 渐出动画 · 评论内容区域 */
31
- playFadeAnimForBody(): void;
32
- /** 获取子评论 Wrap */
33
- getChildrenWrap(): HTMLElement | null;
34
- /** 初始化子评论区域 Wrap */
35
- renderChildrenWrap(): HTMLElement;
36
- /** 恢复原有的子评论区域 Wrap */
37
- recoveryChildrenWrap(): void;
38
- /** 设置已读 */
39
- setUnread(val: boolean): void;
40
- /** 设置为可点击的评论 */
41
- setOpenable(val: boolean): void;
42
- /** 设置点击评论打开置顶 URL */
43
- setOpenURL(url: string): void;
44
- /** 设置点击评论时的操作 */
45
- setOpenAction(action: () => void): void;
46
- }
@@ -1,5 +0,0 @@
1
- import type Render from '../render';
2
- /**
3
- * 评论操作按钮界面
4
- */
5
- export default function renderActions(r: Render): void;
@@ -1,5 +0,0 @@
1
- import type Render from '../render';
2
- /**
3
- * 评论头像界面
4
- */
5
- export default function renderAvatar(r: Render): void;
@@ -1,5 +0,0 @@
1
- import type Render from '../render';
2
- /**
3
- * 评论内容界面
4
- */
5
- export default function renderContent(r: Render): void;
@@ -1,5 +0,0 @@
1
- import type Render from '../render';
2
- /**
3
- * 评论头部界面
4
- */
5
- export default function renderHeader(r: Render): void;
@@ -1,2 +0,0 @@
1
- import type Render from '../render';
2
- export default function loadRenders(r: Render): void;
@@ -1,5 +0,0 @@
1
- import type Render from '../render';
2
- /**
3
- * 待审核状态界面
4
- */
5
- export default function renderPending(r: Render): void;
@@ -1,5 +0,0 @@
1
- import type Render from '../render';
2
- /**
3
- * 层级嵌套模式显示 AT 界面
4
- */
5
- export default function renderReplyAt(r: Render): void;
@@ -1,5 +0,0 @@
1
- import type Render from '../render';
2
- /**
3
- * 回复的对象界面
4
- */
5
- export default function renderReplyTo(r: Render): void;
@@ -1,50 +0,0 @@
1
- interface ActionBtnOptions {
2
- /** 按钮文字 (动态/静态) */
3
- text: (() => string) | string;
4
- /** 仅管理员可用 */
5
- adminOnly?: boolean;
6
- /** 确认操作 */
7
- confirm?: boolean;
8
- /** 确认时提示文字 */
9
- confirmText?: string;
10
- }
11
- /**
12
- * 通用操作按钮
13
- */
14
- export default class ActionBtn {
15
- private opts;
16
- $el: HTMLElement;
17
- isLoading: boolean;
18
- msgRecTimer?: number;
19
- msgRecTimerFunc?: Function;
20
- get isMessaging(): boolean;
21
- isConfirming: boolean;
22
- confirmRecTimer?: number;
23
- /** 构造函数 */
24
- constructor(opts: ActionBtnOptions | string | (() => string));
25
- /** 将按钮装载到指定元素 */
26
- appendTo(dom: HTMLElement): this;
27
- /** 获取按钮文字(动态/静态) */
28
- private getText;
29
- /** 设置点击事件 */
30
- setClick(func: Function): void;
31
- /** 文字刷新(动态/静态) */
32
- updateText(text?: (() => string) | string): void;
33
- /** 设置加载状态 */
34
- setLoading(value: boolean, loadingText?: string): void;
35
- /** 错误消息 */
36
- setError(text: string): void;
37
- /** 警告消息 */
38
- setWarn(text: string): void;
39
- /** 成功消息 */
40
- setSuccess(text: string): void;
41
- /** 设置消息 */
42
- setMsg(text: string, className?: string, duringTime?: number, after?: Function): void;
43
- /** 设置消息复原操作定时器 */
44
- private setMsgRecTimer;
45
- /** 立刻触发器复原定时器 */
46
- private fireMsgRecTimer;
47
- /** 仅清除 timer */
48
- private clearMsgRecTimer;
49
- }
50
- export {};
@@ -1,3 +0,0 @@
1
- import type { Checker } from '.';
2
- declare const AdminChecker: Checker;
3
- export default AdminChecker;
@@ -1,5 +0,0 @@
1
- import type { CheckerCtx } from '.';
2
- /** 图片验证码 */
3
- export declare function imgBody(checker: CheckerCtx): HTMLElement;
4
- /** iframe 形式的通用验证服务 */
5
- export declare function iframeBody(checker: CheckerCtx): HTMLElement;
@@ -1,3 +0,0 @@
1
- import type { Checker } from '.';
2
- declare const CaptchaChecker: Checker;
3
- export default CaptchaChecker;
@@ -1,53 +0,0 @@
1
- import type Api from '../../api';
2
- import type { ContextApi } from '../../../types';
3
- import type User from '../../lib/user';
4
- export interface CheckerCaptchaPayload extends CheckerPayload {
5
- imgData?: string;
6
- iframe?: string;
7
- }
8
- export interface CheckerPayload {
9
- onSuccess?: (inputVal: string, dialogEl?: HTMLElement) => void;
10
- onMount?: (dialogEl: HTMLElement) => void;
11
- onCancel?: () => void;
12
- }
13
- export interface CheckerLauncherOptions {
14
- getCtx: () => ContextApi;
15
- getApi: () => Api;
16
- getIframeURLBase: () => string;
17
- onReload: () => void;
18
- }
19
- /**
20
- * Checker 发射台
21
- */
22
- export default class CheckerLauncher {
23
- private opts;
24
- constructor(opts: CheckerLauncherOptions);
25
- checkCaptcha(payload: CheckerCaptchaPayload): void;
26
- checkAdmin(payload: CheckerPayload): void;
27
- fire(checker: Checker, payload: CheckerPayload, postFire?: (c: CheckerCtx) => void): void;
28
- private close;
29
- }
30
- export interface Checker {
31
- el?: HTMLElement;
32
- inputType?: 'password' | 'text';
33
- body: (checker: CheckerCtx) => HTMLElement;
34
- request: (checker: CheckerCtx, inputVal: string) => Promise<string>;
35
- onSuccess?: (checker: CheckerCtx, respData: string, inputVal: string, formEl: HTMLElement) => void;
36
- onError?: (checker: CheckerCtx, err: any, inputVal: string, formEl: HTMLElement) => void;
37
- }
38
- interface CheckerStore {
39
- val?: string;
40
- img_data?: string;
41
- iframe?: string;
42
- }
43
- export interface CheckerCtx {
44
- get<K extends keyof CheckerStore>(key: K): CheckerStore[K];
45
- set<K extends keyof CheckerStore>(key: K, val: CheckerStore[K]): void;
46
- getOpts(): CheckerLauncherOptions;
47
- getApi(): Api;
48
- getUser(): User;
49
- hideInteractInput(): void;
50
- triggerSuccess(): void;
51
- cancel(): void;
52
- }
53
- export {};