artalk 2.6.4 → 2.7.1
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.
- package/dist/Artalk.css +1 -1
- package/dist/Artalk.es.js +7756 -7432
- package/dist/Artalk.es.js.map +1 -0
- package/dist/Artalk.iife.js +2 -1
- package/dist/Artalk.iife.js.map +1 -0
- package/dist/Artalk.js +2 -1
- package/dist/Artalk.js.map +1 -0
- package/dist/ArtalkLite.css +1 -1
- package/dist/ArtalkLite.es.js +5576 -5252
- package/dist/ArtalkLite.es.js.map +1 -0
- package/dist/ArtalkLite.iife.js +2 -1
- package/dist/ArtalkLite.iife.js.map +1 -0
- package/dist/ArtalkLite.js +2 -1
- package/dist/ArtalkLite.js.map +1 -0
- package/dist/i18n/jp.js +1 -1
- package/dist/i18n/zh-TW.js +1 -1
- package/dist/src/api/{api-base.d.ts → _base.d.ts} +3 -7
- package/dist/src/api/_options.d.ts +19 -0
- package/dist/src/api/{request.d.ts → _request.d.ts} +3 -3
- package/dist/src/api/admin.d.ts +1 -1
- package/dist/src/api/captcha.d.ts +1 -1
- package/dist/src/api/comment.d.ts +2 -2
- package/dist/src/api/index.d.ts +2 -4
- package/dist/src/api/page.d.ts +3 -3
- package/dist/src/api/site.d.ts +2 -2
- package/dist/src/api/system.d.ts +13 -3
- package/dist/src/api/upload.d.ts +1 -1
- package/dist/src/api/user.d.ts +2 -2
- package/dist/src/artalk.d.ts +12 -37
- package/dist/src/comment/actions.d.ts +1 -1
- package/dist/src/comment/comment.d.ts +3 -4
- package/dist/src/comment/render.d.ts +21 -3
- package/dist/src/comment/renders/actions.d.ts +2 -2
- package/dist/src/comment/renders/avatar.d.ts +2 -2
- package/dist/src/comment/renders/content.d.ts +2 -2
- package/dist/src/comment/renders/header.d.ts +2 -2
- package/dist/src/comment/renders/index.d.ts +2 -2
- package/dist/src/comment/renders/pending.d.ts +2 -2
- package/dist/src/comment/renders/reply-at.d.ts +2 -2
- package/dist/src/comment/renders/reply-to.d.ts +2 -2
- package/dist/src/components/action-btn.d.ts +3 -5
- package/dist/src/{lib → components}/checker/admin.d.ts +1 -1
- package/dist/src/{lib → components}/checker/captcha-renders.d.ts +1 -1
- package/dist/src/{lib → components}/checker/captcha.d.ts +1 -1
- package/dist/src/{lib → components}/checker/index.d.ts +10 -7
- package/dist/src/components/dark-mode.d.ts +2 -0
- package/dist/src/components/dialog.d.ts +1 -3
- package/dist/src/components/error-dialog.d.ts +8 -0
- package/dist/src/components/pagination.d.ts +4 -3
- package/dist/src/components/read-more-btn.d.ts +3 -3
- package/dist/src/config.d.ts +24 -8
- package/dist/src/context.d.ts +16 -35
- package/dist/src/data.d.ts +27 -0
- package/dist/src/defaults.d.ts +1 -1
- package/dist/src/editor/editor.d.ts +14 -61
- package/dist/src/editor/state.d.ts +20 -0
- package/dist/src/i18n/en.d.ts +3 -0
- package/dist/src/i18n/external.d.ts +3 -0
- package/dist/src/i18n/index.d.ts +9 -0
- package/dist/src/i18n/jp.d.ts +3 -0
- package/dist/src/i18n/zh-CN.d.ts +1 -1
- package/dist/src/i18n/zh-TW.d.ts +3 -0
- package/dist/src/layer/index.d.ts +4 -3
- package/dist/src/layer/layer-manager.d.ts +9 -0
- package/dist/src/layer/layer.d.ts +8 -28
- package/dist/src/layer/scrollbar-helper.d.ts +5 -0
- package/dist/src/layer/sidebar-layer.d.ts +6 -6
- package/dist/src/layer/wrap.d.ts +13 -0
- package/dist/src/lib/component.d.ts +3 -8
- package/dist/src/lib/event-manager.d.ts +28 -0
- package/dist/src/lib/highlight.d.ts +1 -0
- package/dist/src/lib/marked-renderer.d.ts +4 -0
- package/dist/src/lib/marked.d.ts +4 -2
- package/dist/src/lib/sanitizer.d.ts +1 -0
- package/dist/src/lib/ui.d.ts +3 -2
- package/dist/src/lib/user.d.ts +8 -5
- package/dist/src/lib/utils.d.ts +11 -5
- package/dist/src/list/comment.d.ts +3 -0
- package/dist/src/list/layout.d.ts +23 -0
- package/dist/src/list/list.d.ts +13 -25
- package/dist/src/list/{list-nest.d.ts → nest.d.ts} +1 -1
- package/dist/src/list/page.d.ts +2 -0
- package/dist/src/list/paginator/index.d.ts +22 -7
- package/dist/src/list/paginator/read-more.d.ts +18 -0
- package/dist/src/list/paginator/up-down.d.ts +14 -0
- package/dist/src/main.d.ts +5 -0
- package/dist/src/plugins/admin-only-elem.d.ts +2 -0
- package/dist/src/plugins/conf-remoter.d.ts +2 -0
- package/dist/src/plugins/dark-mode.d.ts +2 -0
- package/dist/src/plugins/editor/_kit.d.ts +27 -0
- package/dist/src/plugins/editor/_plug.d.ts +29 -0
- package/dist/src/plugins/editor/_sample.d.ts +5 -0
- package/dist/src/plugins/editor/closable.d.ts +7 -0
- package/dist/src/{editor/plugs/emoticons-plug.d.ts → plugins/editor/emoticons.d.ts} +10 -16
- package/dist/src/plugins/editor/header-event.d.ts +6 -0
- package/dist/src/plugins/editor/header-link.d.ts +6 -0
- package/dist/src/plugins/editor/header-user.d.ts +16 -0
- package/dist/src/plugins/editor/index.d.ts +6 -0
- package/dist/src/plugins/editor/local-storage.d.ts +6 -0
- package/dist/src/plugins/editor/mover.d.ts +6 -0
- package/dist/src/plugins/editor/preview.d.ts +7 -0
- package/dist/src/plugins/editor/state-edit.d.ts +11 -0
- package/dist/src/plugins/editor/state-reply.d.ts +8 -0
- package/dist/src/plugins/editor/submit-add.d.ts +18 -0
- package/dist/src/plugins/editor/submit-btn.d.ts +5 -0
- package/dist/src/plugins/editor/submit.d.ts +17 -0
- package/dist/src/plugins/editor/textarea.d.ts +8 -0
- package/dist/src/plugins/editor/upload.d.ts +9 -0
- package/dist/src/plugins/editor-kit.d.ts +42 -0
- package/dist/src/plugins/index.d.ts +2 -0
- package/dist/src/plugins/list/copyright.d.ts +2 -0
- package/dist/src/plugins/list/count.d.ts +2 -0
- package/dist/src/plugins/list/dropdown.d.ts +2 -0
- package/dist/src/plugins/list/error-dialog.d.ts +2 -0
- package/dist/src/plugins/list/fetch.d.ts +2 -0
- package/dist/src/plugins/list/goto-first.d.ts +3 -0
- package/dist/src/plugins/list/goto.d.ts +2 -0
- package/dist/src/plugins/list/index.d.ts +3 -0
- package/dist/src/plugins/list/loading.d.ts +2 -0
- package/dist/src/plugins/list/no-comment.d.ts +2 -0
- package/dist/src/plugins/list/reach-bottom.d.ts +2 -0
- package/dist/src/plugins/list/sidebar-btn.d.ts +2 -0
- package/dist/src/plugins/list/time-ticking.d.ts +3 -0
- package/dist/src/plugins/list/unread-badge.d.ts +2 -0
- package/dist/src/plugins/list/unread.d.ts +2 -0
- package/dist/src/plugins/list/with-editor.d.ts +2 -0
- package/dist/src/plugins/markdown.d.ts +2 -0
- package/dist/src/plugins/stat.d.ts +13 -0
- package/dist/src/plugins/version-check.d.ts +2 -0
- package/dist/src/service.d.ts +19 -23
- package/dist/tests/e2e/comment-add.spec.d.ts +1 -0
- package/dist/types/config.d.ts +110 -0
- package/dist/types/context.d.ts +56 -136
- package/dist/types/data.d.ts +194 -0
- package/dist/types/editor.d.ts +76 -0
- package/dist/types/event.d.ts +36 -25
- package/dist/types/index.d.ts +7 -0
- package/dist/types/plugin.d.ts +2 -0
- package/dist/types/sidebar.d.ts +3 -0
- package/package.json +5 -2
- package/src/api/_base.ts +18 -0
- package/src/api/_options.ts +25 -0
- package/src/api/{request.ts → _request.ts} +19 -18
- package/src/api/admin.ts +1 -1
- package/src/api/captcha.ts +1 -1
- package/src/api/comment.ts +4 -4
- package/src/api/index.ts +3 -12
- package/src/api/page.ts +5 -5
- package/src/api/site.ts +2 -2
- package/src/api/system.ts +19 -7
- package/src/api/upload.ts +3 -3
- package/src/api/user.ts +3 -3
- package/src/artalk.ts +47 -99
- package/src/comment/actions.ts +1 -4
- package/src/comment/comment.ts +9 -6
- package/src/comment/render.ts +27 -5
- package/src/comment/renders/actions.ts +45 -45
- package/src/comment/renders/avatar.ts +7 -7
- package/src/comment/renders/content.ts +18 -18
- package/src/comment/renders/header.ts +13 -13
- package/src/comment/renders/index.ts +3 -3
- package/src/comment/renders/pending.ts +5 -5
- package/src/comment/renders/reply-at.ts +8 -8
- package/src/comment/renders/reply-to.ts +13 -13
- package/src/components/action-btn.ts +11 -13
- package/src/{lib → components}/checker/admin.ts +6 -6
- package/src/{lib → components}/checker/captcha-renders.ts +7 -6
- package/src/{lib → components}/checker/captcha.ts +1 -1
- package/src/{lib → components}/checker/index.ts +21 -26
- package/src/components/dark-mode.ts +30 -0
- package/src/components/dialog.ts +4 -9
- package/src/components/error-dialog.ts +35 -0
- package/src/components/pagination.ts +10 -6
- package/src/components/read-more-btn.ts +7 -7
- package/src/config.ts +60 -6
- package/src/context.ts +39 -144
- package/src/data.ts +110 -0
- package/src/defaults.ts +1 -1
- package/src/editor/editor.ts +39 -152
- package/src/editor/state.ts +52 -0
- package/src/i18n/en.ts +3 -0
- package/src/i18n/jp.ts +3 -0
- package/src/i18n/zh-CN.ts +4 -1
- package/src/i18n/zh-TW.ts +3 -0
- package/src/layer/index.ts +4 -4
- package/src/layer/layer-manager.ts +32 -0
- package/src/layer/layer.ts +20 -144
- package/src/layer/scrollbar-helper.ts +24 -0
- package/src/layer/sidebar-layer.ts +74 -64
- package/src/layer/wrap.ts +77 -0
- package/src/lib/component.ts +4 -11
- package/src/lib/detect.ts +1 -1
- package/src/lib/event-manager.ts +47 -0
- package/src/lib/highlight.ts +5 -0
- package/src/lib/marked-renderer.ts +32 -0
- package/src/lib/marked.ts +43 -104
- package/src/lib/sanitizer.ts +57 -0
- package/src/lib/ui.ts +22 -15
- package/src/lib/user.ts +21 -16
- package/src/lib/utils.ts +29 -18
- package/src/list/comment.ts +20 -0
- package/src/list/layout.ts +120 -0
- package/src/list/list.html +3 -1
- package/src/list/list.ts +56 -200
- package/src/list/{list-nest.ts → nest.ts} +1 -1
- package/src/list/page.ts +97 -0
- package/src/list/paginator/index.ts +20 -8
- package/src/list/paginator/read-more.ts +67 -0
- package/src/list/paginator/up-down.ts +51 -0
- package/src/main.ts +11 -0
- package/src/plugins/admin-only-elem.ts +40 -0
- package/src/plugins/conf-remoter.ts +54 -0
- package/src/plugins/dark-mode.ts +12 -0
- package/src/plugins/editor/_kit.ts +57 -0
- package/src/plugins/editor/_plug.ts +60 -0
- package/src/plugins/editor/_sample.ts +8 -0
- package/src/plugins/editor/closable.ts +44 -0
- package/src/{editor/plugs/emoticons-plug.ts → plugins/editor/emoticons.ts} +51 -52
- package/src/plugins/editor/header-event.ts +35 -0
- package/src/plugins/editor/header-link.ts +31 -0
- package/src/plugins/editor/header-user.ts +98 -0
- package/src/plugins/editor/index.ts +40 -0
- package/src/plugins/editor/local-storage.ts +36 -0
- package/src/plugins/editor/mover.ts +29 -0
- package/src/plugins/editor/preview.ts +41 -0
- package/src/plugins/editor/state-edit.ts +116 -0
- package/src/plugins/editor/state-reply.ts +91 -0
- package/src/plugins/editor/submit-add.ts +33 -0
- package/src/plugins/editor/submit-btn.ts +25 -0
- package/src/plugins/editor/submit.ts +73 -0
- package/src/plugins/editor/textarea.ts +55 -0
- package/src/plugins/editor/upload.ts +145 -0
- package/src/plugins/editor-kit.ts +161 -0
- package/src/plugins/index.ts +16 -0
- package/src/plugins/list/copyright.ts +16 -0
- package/src/plugins/list/count.ts +31 -0
- package/src/plugins/list/dropdown.ts +95 -0
- package/src/plugins/list/error-dialog.ts +22 -0
- package/src/plugins/list/fetch.ts +64 -0
- package/src/plugins/list/goto-first.ts +23 -0
- package/src/plugins/list/goto.ts +72 -0
- package/src/plugins/list/index.ts +25 -0
- package/src/plugins/list/loading.ts +17 -0
- package/src/plugins/list/no-comment.ts +25 -0
- package/src/plugins/list/reach-bottom.ts +46 -0
- package/src/plugins/list/sidebar-btn.ts +39 -0
- package/src/plugins/list/time-ticking.ts +22 -0
- package/src/plugins/list/unread-badge.ts +26 -0
- package/src/plugins/list/unread.ts +38 -0
- package/src/plugins/list/with-editor.ts +59 -0
- package/src/plugins/markdown.ts +10 -0
- package/src/plugins/stat.ts +82 -0
- package/src/plugins/version-check.ts +36 -0
- package/src/service.ts +34 -61
- package/src/style/comment.scss +5 -7
- package/src/style/editor.scss +5 -0
- package/src/style/list.scss +1 -1
- package/types/{artalk-config.d.ts → config.ts} +16 -2
- package/types/context.ts +84 -0
- package/types/{artalk-data.d.ts → data.ts} +41 -0
- package/types/editor.ts +95 -0
- package/types/event.ts +40 -0
- package/types/index.ts +7 -0
- package/types/plugin.ts +3 -0
- package/types/sidebar.ts +3 -0
- package/dist/src/comment/render-ctx.d.ts +0 -23
- package/dist/src/editor/edit-mode.d.ts +0 -9
- package/dist/src/editor/funcs.d.ts +0 -2
- package/dist/src/editor/index.d.ts +0 -2
- package/dist/src/editor/mover.d.ts +0 -8
- package/dist/src/editor/plug-manager.d.ts +0 -17
- package/dist/src/editor/plugs/editor-plug.d.ts +0 -38
- package/dist/src/editor/plugs/header-input-plug.d.ts +0 -13
- package/dist/src/editor/plugs/preview-plug.d.ts +0 -10
- package/dist/src/editor/plugs/upload-plug.d.ts +0 -10
- package/dist/src/editor/reply.d.ts +0 -9
- package/dist/src/editor/submit.d.ts +0 -16
- package/dist/src/lib/dark-mode.d.ts +0 -4
- package/dist/src/lib/stat.d.ts +0 -15
- package/dist/src/list/index.d.ts +0 -2
- package/dist/src/list/list-lite.d.ts +0 -77
- package/dist/src/list/list-ui.d.ts +0 -16
- package/dist/src/list/paginator/adaptors/index.d.ts +0 -12
- package/dist/src/list/paginator/adaptors/pagination.d.ts +0 -9
- package/dist/src/list/paginator/adaptors/read-more.d.ts +0 -10
- package/dist/src/list/paginator/holder.d.ts +0 -16
- package/dist/types/artalk-config.d.ts +0 -139
- package/dist/types/artalk-data.d.ts +0 -230
- package/dist/types/plug.d.ts +0 -4
- package/src/api/api-base.ts +0 -27
- package/src/comment/render-ctx.ts +0 -30
- package/src/editor/edit-mode.ts +0 -105
- package/src/editor/funcs.ts +0 -150
- package/src/editor/index.ts +0 -3
- package/src/editor/mover.ts +0 -43
- package/src/editor/plug-manager.ts +0 -172
- package/src/editor/plugs/editor-plug.ts +0 -69
- package/src/editor/plugs/header-input-plug.ts +0 -79
- package/src/editor/plugs/preview-plug.ts +0 -44
- package/src/editor/plugs/upload-plug.ts +0 -122
- package/src/editor/reply.ts +0 -62
- package/src/editor/submit.ts +0 -99
- package/src/lib/dark-mode.ts +0 -48
- package/src/lib/stat.ts +0 -71
- package/src/list/index.ts +0 -3
- package/src/list/list-lite.ts +0 -424
- package/src/list/list-ui.ts +0 -137
- package/src/list/paginator/adaptors/index.ts +0 -21
- package/src/list/paginator/adaptors/pagination.ts +0 -42
- package/src/list/paginator/adaptors/read-more.ts +0 -56
- package/src/list/paginator/holder.ts +0 -56
- package/types/context.d.ts +0 -142
- package/types/event.d.ts +0 -28
- package/types/plug.d.ts +0 -4
- /package/src/{editor/plugs/emoticons-plug.scss → plugins/editor/emoticons.scss} +0 -0
- /package/src/{editor/plugs/preview-plug.scss → plugins/editor/preview.scss} +0 -0
package/dist/i18n/jp.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).jp=n()}(this,(function(){"use strict";const e="ArtalkI18n";var n,o,t;return n="jp",o={placeholder:"コメントを残す",noComment:"コメントなし",send:"送信",save:"保存",nick:"ニックネーム",email:"メール",link:"ウェブサイト",emoticon:"絵文字",preview:"プレビュー",image:"画像",uploadFail:"アップロードに失敗しました",commentFail:"コメントに失敗しました",restoredMsg:"コンテンツが復元されました",onlyAdminCanReply:"管理者のみが返信できます",uploadLoginMsg:"アップロードするには、名前とメールアドレスを入力してください",counter:"{count} コメント",sortLatest:"最新のもの",sortOldest:"最も古い",sortBest:"ベスト",sortAuthor:"著者",openComment:"コメントを開く",closeComment:"コメントを閉じる",listLoadFailMsg:"コメントの読み込みに失敗しました",listRetry:"クリックで再試行",loadMore:"もっと読み込む",admin:"管理者",reply:"返信",voteUp:"アップ",voteDown:"ダウン",voteFail:"投票に失敗しました",readMore:"続きを読む",actionConfirm:"確認",collapse:"折りたたむ",collapsed:"折りたたまれた",collapsedMsg:"このコメントは折りたたまれました",expand:"展開",approved:"承認されました",pending:"保留中",pendingMsg:"保留中、コメント投稿者にのみ表示されます",edit:"編集",editCancel:"編集をキャンセル",delete:"削除",deleteConfirm:"確認",pin:"ピン",unpin:"ピン外し",seconds:"秒前",minutes:"分前",hours:"時間前",days:"数日前",now:"たった今",adminCheck:"管理者パスワードを入力してください:",captchaCheck:"続けるにはCAPTCHAを入力してください:",confirm:"確認",cancel:"取消",msgCenter:"メッセージ",ctrlCenter:"コンソール",frontend:"フロントエンド",backend:"バックエンド",loading:"読み込み中",loadFail:"読み込みに失敗しました",editing:"編集中",editFail:"編集に失敗しました",deleting:"削除中",deleteFail:"削除に失敗しました",reqGot:"リクエストを取得しました",reqAborted:"リクエストがタイムアウトしたか、予期せず終了した",updateMsg:"フルな体験をするためには、Artalk {name} をアップデートしてください",currentVersion:"現在のバージョン",ignore:"無視する"},t=["jp-JP"],window[e]||(window[e]={}),window[e][n]=o,t&&t.forEach((n=>{window[e][n]=o})),o}));
|
package/dist/i18n/zh-TW.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self)["zh-TW"]=n()}(this,(function(){"use strict";const e="ArtalkI18n";var n,o,t;return n="zh-TW",o={placeholder:"鍵入內容...",noComment:"「此時無聲勝有聲」",send:"發送評論",save:"保存評論",nick:"昵稱",email:"郵箱",link:"網址",emoticon:"表情",preview:"預覽",image:"圖片",uploadFail:"上傳失敗",commentFail:"評論失敗",restoredMsg:"內容已自動恢復",onlyAdminCanReply:"僅管理員可評論",uploadLoginMsg:"填入你的名字郵箱才能上傳哦",counter:"{count} 條評論",sortLatest:"最新",sortOldest:"最早",sortBest:"最熱",sortAuthor:"作者",openComment:"打開評論",closeComment:"關閉評論",listLoadFailMsg:"無法獲取評論列表數據",listRetry:"點擊重新獲取",loadMore:"加載更多",admin:"管理員",reply:"回覆",voteUp:"贊同",voteDown:"反對",voteFail:"投票失敗",readMore:"閱讀更多",actionConfirm:"確認操作",collapse:"摺疊",collapsed:"已摺疊",collapsedMsg:"該評論已被系統或管理員摺疊",expand:"展開",approved:"已審",pending:"待審",pendingMsg:"審核中,僅本人可見。",edit:"編輯",editCancel:"取消編輯",delete:"刪除",deleteConfirm:"確認刪除",pin:"置頂",unpin:"取消置頂",seconds:"秒前",minutes:"分鐘前",hours:"小時前",days:"天前",now:"剛剛",adminCheck:"鍵入密碼來驗證管理員身份:",captchaCheck:"鍵入驗證碼繼續:",confirm:"確認",cancel:"取消",msgCenter:"通知中心",ctrlCenter:"控制中心",frontend:"前端",backend:"後端",loading:"加載中",loadFail:"加載失敗",editing:"修改中",editFail:"修改失敗",deleting:"刪除中",deleteFail:"刪除失敗",reqGot:"請求響應",reqAborted:"請求超時或意外終止",updateMsg:"請更新 Artalk {name} 以獲得完整體驗",currentVersion:"當前版本",ignore:"忽略"},window[e]||(window[e]={}),window[e][n]=o,t&&t.forEach((n=>{window[e][n]=o})),o}));
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Api from '.';
|
|
1
|
+
import { ApiOptions } from './_options';
|
|
3
2
|
declare abstract class ApiBase {
|
|
4
|
-
protected
|
|
5
|
-
|
|
6
|
-
constructor(api: Api, ctx: Context);
|
|
3
|
+
protected options: ApiOptions;
|
|
4
|
+
constructor(options: ApiOptions);
|
|
7
5
|
protected POST<T>(path: string, data?: {
|
|
8
6
|
[key: string]: any;
|
|
9
7
|
}): Promise<T>;
|
|
10
8
|
protected Fetch(path: string, init: RequestInit, timeout?: number): Promise<any>;
|
|
11
9
|
}
|
|
12
|
-
interface ApiBase {
|
|
13
|
-
}
|
|
14
10
|
export default ApiBase;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface ApiOptions {
|
|
2
|
+
baseURL: string;
|
|
3
|
+
siteName: string;
|
|
4
|
+
pageKey: string;
|
|
5
|
+
pageTitle: string;
|
|
6
|
+
timeout?: number;
|
|
7
|
+
onNeedCheckCaptcha?: (payload: {
|
|
8
|
+
recall: () => void;
|
|
9
|
+
reject: () => void;
|
|
10
|
+
data: {
|
|
11
|
+
imgData: string;
|
|
12
|
+
iframe: string;
|
|
13
|
+
};
|
|
14
|
+
}) => void;
|
|
15
|
+
onNeedCheckAdmin?: (payload: {
|
|
16
|
+
recall: () => void;
|
|
17
|
+
reject: () => void;
|
|
18
|
+
}) => void;
|
|
19
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ApiOptions } from './_options';
|
|
2
2
|
/** 公共请求函数 */
|
|
3
|
-
export declare function Fetch(
|
|
3
|
+
export declare function Fetch(opts: ApiOptions, input: RequestInfo, init: RequestInit, timeout?: number): Promise<any>;
|
|
4
4
|
/** 公共 POST 请求 */
|
|
5
|
-
export declare function POST<T>(
|
|
5
|
+
export declare function POST<T>(opts: ApiOptions, url: string, data?: {
|
|
6
6
|
[key: string]: any;
|
|
7
7
|
}): Promise<T>;
|
|
8
8
|
/** 公共 GET 请求 (无 GET 方式 API) */
|
package/dist/src/api/admin.d.ts
CHANGED
package/dist/src/api/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ApiOptions } from './_options';
|
|
2
2
|
import comment from './comment';
|
|
3
3
|
import page from './page';
|
|
4
4
|
import site from './site';
|
|
@@ -18,9 +18,7 @@ declare const ApiComponents: {
|
|
|
18
18
|
upload: typeof upload;
|
|
19
19
|
};
|
|
20
20
|
declare class Api {
|
|
21
|
-
|
|
22
|
-
get baseURL(): string;
|
|
23
|
-
constructor(ctx: Context);
|
|
21
|
+
constructor(opts: ApiOptions);
|
|
24
22
|
}
|
|
25
23
|
type TC = typeof ApiComponents;
|
|
26
24
|
type AC = {
|
package/dist/src/api/page.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PageData, CommentData } from '../../types
|
|
2
|
-
import ApiBase from './
|
|
1
|
+
import type { PageData, CommentData } from '../../types';
|
|
2
|
+
import ApiBase from './_base';
|
|
3
3
|
/**
|
|
4
4
|
* 页面 API
|
|
5
5
|
*/
|
|
@@ -18,5 +18,5 @@ export default class PageApi extends ApiBase {
|
|
|
18
18
|
/** PV */
|
|
19
19
|
pv(): Promise<number>;
|
|
20
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 |
|
|
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
22
|
}
|
package/dist/src/api/site.d.ts
CHANGED
package/dist/src/api/system.d.ts
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
|
-
import ArtalkConfig from '../../types
|
|
2
|
-
import ApiBase from './
|
|
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
|
+
}
|
|
3
12
|
/**
|
|
4
13
|
* 系统 API
|
|
5
14
|
*/
|
|
6
15
|
export default class SystemApi extends ApiBase {
|
|
7
16
|
/** 获取配置 */
|
|
8
|
-
conf(): Promise<
|
|
17
|
+
conf(): Promise<SystemConfResp>;
|
|
9
18
|
/** 获取配置数据 */
|
|
10
19
|
getSettings(): Promise<{
|
|
11
20
|
custom: string;
|
|
@@ -21,3 +30,4 @@ export default class SystemApi extends ApiBase {
|
|
|
21
30
|
fe_min_version: string;
|
|
22
31
|
}>;
|
|
23
32
|
}
|
|
33
|
+
export {};
|
package/dist/src/api/upload.d.ts
CHANGED
package/dist/src/api/user.d.ts
CHANGED
package/dist/src/artalk.d.ts
CHANGED
|
@@ -1,60 +1,35 @@
|
|
|
1
|
-
import type ArtalkConfig from '../types
|
|
2
|
-
import type {
|
|
3
|
-
import type ArtalkPlug from '../types/plug';
|
|
4
|
-
import type Context from '../types/context';
|
|
5
|
-
import ListLite from './list/list-lite';
|
|
1
|
+
import type { ArtalkConfig, EventPayloadMap, ArtalkPlugin, ContextApi } from '../types';
|
|
2
|
+
import type { EventHandler } from './lib/event-manager';
|
|
6
3
|
/**
|
|
7
4
|
* Artalk
|
|
8
5
|
*
|
|
9
6
|
* @see https://artalk.js.org
|
|
10
7
|
*/
|
|
11
8
|
export default class Artalk {
|
|
12
|
-
private static instance?;
|
|
13
|
-
static ListLite: typeof ListLite;
|
|
14
|
-
static readonly defaults: ArtalkConfig;
|
|
15
9
|
conf: ArtalkConfig;
|
|
16
|
-
ctx:
|
|
10
|
+
ctx: ContextApi;
|
|
17
11
|
$root: HTMLElement;
|
|
18
12
|
/** Plugins */
|
|
19
|
-
protected
|
|
20
|
-
static DisabledComponents: string[];
|
|
13
|
+
protected plugins: ArtalkPlugin[];
|
|
21
14
|
constructor(conf: Partial<ArtalkConfig>);
|
|
22
|
-
/** Init Artalk */
|
|
23
|
-
static init(conf: Partial<ArtalkConfig>): Artalk;
|
|
24
|
-
/** Use Plugin (plugin will be called in instance `use` func) */
|
|
25
|
-
use(plugin: ArtalkPlug): void;
|
|
26
15
|
/** Update config of Artalk */
|
|
27
|
-
update(conf: Partial<ArtalkConfig>):
|
|
16
|
+
update(conf: Partial<ArtalkConfig>): this;
|
|
28
17
|
/** Reload comment list of Artalk */
|
|
29
18
|
reload(): void;
|
|
30
19
|
/** Destroy instance of Artalk */
|
|
31
20
|
destroy(): void;
|
|
32
21
|
/** Add an event listener */
|
|
33
|
-
on<K extends keyof EventPayloadMap>(name: K, handler:
|
|
22
|
+
on<K extends keyof EventPayloadMap>(name: K, handler: EventHandler<EventPayloadMap[K]>): void;
|
|
34
23
|
/** Remove an event listener */
|
|
35
|
-
off<K extends keyof EventPayloadMap>(name: K, handler:
|
|
24
|
+
off<K extends keyof EventPayloadMap>(name: K, handler: EventHandler<EventPayloadMap[K]>): void;
|
|
36
25
|
/** Trigger an event */
|
|
37
26
|
trigger<K extends keyof EventPayloadMap>(name: K, payload?: EventPayloadMap[K]): void;
|
|
38
27
|
/** Set dark mode */
|
|
39
28
|
setDarkMode(darkMode: boolean): void;
|
|
40
|
-
/**
|
|
41
|
-
static
|
|
42
|
-
/**
|
|
43
|
-
static
|
|
44
|
-
/** Reload comment list of Artalk */
|
|
45
|
-
static reload(): void;
|
|
46
|
-
/** Destroy instance of Artalk */
|
|
47
|
-
static destroy(): void;
|
|
48
|
-
/** Add an event listener */
|
|
49
|
-
static on<K extends keyof EventPayloadMap>(name: K, handler: Handler<EventPayloadMap[K]>): void;
|
|
50
|
-
/** Remove an event listener */
|
|
51
|
-
static off<K extends keyof EventPayloadMap>(name: K, handler: Handler<EventPayloadMap[K]>): void;
|
|
52
|
-
/** Trigger an event */
|
|
53
|
-
static trigger<K extends keyof EventPayloadMap>(name: K, payload?: EventPayloadMap[K]): void;
|
|
54
|
-
/** Set dark mode */
|
|
55
|
-
static 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;
|
|
56
33
|
/** Load count widget */
|
|
57
|
-
static loadCountWidget(
|
|
58
|
-
/** @deprecated Please use `loadCountWidget` instead */
|
|
59
|
-
static LoadCountWidget(conf: Partial<ArtalkConfig>): void;
|
|
34
|
+
static loadCountWidget(c: Partial<ArtalkConfig>): void;
|
|
60
35
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { CommentData } from '../../types
|
|
2
|
-
import Context from '../../types/context';
|
|
1
|
+
import type { CommentData, ContextApi } from '../../types';
|
|
3
2
|
import Component from '../lib/component';
|
|
4
3
|
import CommentUI from './render';
|
|
5
4
|
import CommentActions from './actions';
|
|
@@ -22,7 +21,7 @@ export default class Comment extends Component {
|
|
|
22
21
|
private children;
|
|
23
22
|
private nestCurt;
|
|
24
23
|
private nestMax;
|
|
25
|
-
constructor(ctx:
|
|
24
|
+
constructor(ctx: ContextApi, data: CommentData, conf: CommentConf);
|
|
26
25
|
/** 渲染 UI */
|
|
27
26
|
render(): void;
|
|
28
27
|
/** 获取评论操作实例对象 */
|
|
@@ -56,7 +55,7 @@ export default class Comment extends Component {
|
|
|
56
55
|
/** 获取评论 markdown 解析后的内容 */
|
|
57
56
|
getContentMarked(): string;
|
|
58
57
|
/** 获取格式化后的日期 */
|
|
59
|
-
getDateFormatted():
|
|
58
|
+
getDateFormatted(): any;
|
|
60
59
|
/** 获取用户 UserAgent 信息 */
|
|
61
60
|
getUserUA(): {
|
|
62
61
|
browser: string;
|
|
@@ -1,6 +1,24 @@
|
|
|
1
|
-
import Comment from './comment';
|
|
2
|
-
import
|
|
3
|
-
export default class
|
|
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;
|
|
4
22
|
constructor(comment: Comment);
|
|
5
23
|
render(): HTMLElement;
|
|
6
24
|
/** 内容限高检测 */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default function loadRenders(
|
|
1
|
+
import type Render from '../render';
|
|
2
|
+
export default function loadRenders(r: Render): void;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
interface ActionBtnConf {
|
|
1
|
+
interface ActionBtnOptions {
|
|
3
2
|
/** 按钮文字 (动态/静态) */
|
|
4
3
|
text: (() => string) | string;
|
|
5
4
|
/** 仅管理员可用 */
|
|
@@ -13,8 +12,7 @@ interface ActionBtnConf {
|
|
|
13
12
|
* 通用操作按钮
|
|
14
13
|
*/
|
|
15
14
|
export default class ActionBtn {
|
|
16
|
-
private
|
|
17
|
-
private conf;
|
|
15
|
+
private opts;
|
|
18
16
|
$el: HTMLElement;
|
|
19
17
|
isLoading: boolean;
|
|
20
18
|
msgRecTimer?: number;
|
|
@@ -23,7 +21,7 @@ export default class ActionBtn {
|
|
|
23
21
|
isConfirming: boolean;
|
|
24
22
|
confirmRecTimer?: number;
|
|
25
23
|
/** 构造函数 */
|
|
26
|
-
constructor(
|
|
24
|
+
constructor(opts: ActionBtnOptions | string | (() => string));
|
|
27
25
|
/** 将按钮装载到指定元素 */
|
|
28
26
|
appendTo(dom: HTMLElement): this;
|
|
29
27
|
/** 获取按钮文字(动态/静态) */
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import Context from '../../../types/context';
|
|
2
|
-
import Layer from '../../layer';
|
|
3
1
|
import type Api from '../../api';
|
|
2
|
+
import type { ContextApi } from '../../../types';
|
|
4
3
|
export interface CheckerCaptchaPayload extends CheckerPayload {
|
|
5
4
|
imgData?: string;
|
|
6
5
|
iframe?: string;
|
|
@@ -10,13 +9,18 @@ export interface CheckerPayload {
|
|
|
10
9
|
onMount?: (dialogEl: HTMLElement) => void;
|
|
11
10
|
onCancel?: () => void;
|
|
12
11
|
}
|
|
12
|
+
export interface CheckerLauncherOptions {
|
|
13
|
+
getCtx: () => ContextApi;
|
|
14
|
+
getApi: () => Api;
|
|
15
|
+
getIframeURLBase: () => string;
|
|
16
|
+
onReload: () => void;
|
|
17
|
+
}
|
|
13
18
|
/**
|
|
14
19
|
* Checker 发射台
|
|
15
20
|
*/
|
|
16
21
|
export default class CheckerLauncher {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
constructor(ctx: Context);
|
|
22
|
+
private opts;
|
|
23
|
+
constructor(opts: CheckerLauncherOptions);
|
|
20
24
|
checkCaptcha(payload: CheckerCaptchaPayload): void;
|
|
21
25
|
checkAdmin(payload: CheckerPayload): void;
|
|
22
26
|
fire(checker: Checker, payload: CheckerPayload, postFire?: (c: CheckerCtx) => void): void;
|
|
@@ -38,9 +42,8 @@ interface CheckerStore {
|
|
|
38
42
|
export interface CheckerCtx {
|
|
39
43
|
get<K extends keyof CheckerStore>(key: K): CheckerStore[K];
|
|
40
44
|
set<K extends keyof CheckerStore>(key: K, val: CheckerStore[K]): void;
|
|
41
|
-
|
|
45
|
+
getOpts(): CheckerLauncherOptions;
|
|
42
46
|
getApi(): Api;
|
|
43
|
-
getLayer(): Layer;
|
|
44
47
|
hideInteractInput(): void;
|
|
45
48
|
triggerSuccess(): void;
|
|
46
49
|
cancel(): void;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import Context from '../../types/context';
|
|
2
1
|
type BtnClickHandler = (btnEl: HTMLElement, dialog: Dialog) => boolean | void;
|
|
3
2
|
/**
|
|
4
3
|
* 对话框
|
|
5
4
|
*/
|
|
6
5
|
export default class Dialog {
|
|
7
|
-
ctx: Context;
|
|
8
6
|
$el: HTMLElement;
|
|
9
7
|
$content: HTMLElement;
|
|
10
8
|
$actions: HTMLElement;
|
|
11
|
-
constructor(
|
|
9
|
+
constructor(contentEl: HTMLElement);
|
|
12
10
|
/** 按钮 · 确定 */
|
|
13
11
|
setYes(handler: BtnClickHandler): this;
|
|
14
12
|
/** 按钮 · 取消 */
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface PaginationOptions {
|
|
2
2
|
/** 每页条数 */
|
|
3
3
|
pageSize: number;
|
|
4
4
|
/** 回调函数 */
|
|
5
5
|
onChange: (offset: number) => void;
|
|
6
6
|
}
|
|
7
7
|
export default class Pagination {
|
|
8
|
-
private
|
|
8
|
+
private opts;
|
|
9
9
|
total: number;
|
|
10
10
|
$el: HTMLElement;
|
|
11
11
|
$input: HTMLInputElement;
|
|
@@ -16,12 +16,13 @@ export default class Pagination {
|
|
|
16
16
|
get pageSize(): number;
|
|
17
17
|
get offset(): number;
|
|
18
18
|
get maxPage(): number;
|
|
19
|
-
constructor(total: number,
|
|
19
|
+
constructor(total: number, opts: PaginationOptions);
|
|
20
20
|
update(offset: number, total: number): void;
|
|
21
21
|
setInput(page: number): void;
|
|
22
22
|
input(now?: boolean): void;
|
|
23
23
|
prev(): void;
|
|
24
24
|
next(): void;
|
|
25
|
+
getHasMore(): boolean;
|
|
25
26
|
change(page: number): void;
|
|
26
27
|
checkDisabled(): void;
|
|
27
28
|
keydown(e: KeyboardEvent): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface ReadMoreBtnOptions {
|
|
2
2
|
/** 回调函数 */
|
|
3
3
|
onClick: (offset: number) => void;
|
|
4
4
|
pageSize: number;
|
|
@@ -8,7 +8,7 @@ export interface ReadMoreBtnConf {
|
|
|
8
8
|
* 阅读更多按钮
|
|
9
9
|
*/
|
|
10
10
|
export default class ReadMoreBtn {
|
|
11
|
-
|
|
11
|
+
opts: ReadMoreBtnOptions;
|
|
12
12
|
$el: HTMLElement;
|
|
13
13
|
private $loading;
|
|
14
14
|
private $text;
|
|
@@ -17,7 +17,7 @@ export default class ReadMoreBtn {
|
|
|
17
17
|
private origText;
|
|
18
18
|
/** 是否有更多内容 */
|
|
19
19
|
get hasMore(): boolean;
|
|
20
|
-
constructor(
|
|
20
|
+
constructor(opts: ReadMoreBtnOptions);
|
|
21
21
|
click(): void;
|
|
22
22
|
/** 显示 */
|
|
23
23
|
show(): void;
|
package/dist/src/config.d.ts
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
|
-
import type ArtalkConfig from '../types
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import type { ArtalkConfig, ContextApi } from '../types';
|
|
2
|
+
import type { ApiOptions } from './api/_options';
|
|
3
|
+
/**
|
|
4
|
+
* Merges the user custom config with the default config
|
|
5
|
+
*
|
|
6
|
+
* @param customConf - The custom config object which is provided by the user
|
|
7
|
+
* @returns The config for Artalk instance creation
|
|
8
|
+
*/
|
|
9
|
+
export declare function handelCustomConf(customConf: Partial<ArtalkConfig>): ArtalkConfig;
|
|
10
|
+
/**
|
|
11
|
+
* Handle the config which is provided by the server
|
|
12
|
+
*
|
|
13
|
+
* @param conf - The Server response config for control the frontend of Artalk remotely
|
|
14
|
+
* @returns The config for Artalk instance creation
|
|
15
|
+
*/
|
|
16
|
+
export declare function handleConfFormServer(conf: Partial<ArtalkConfig>): Partial<ArtalkConfig>;
|
|
17
|
+
/**
|
|
18
|
+
* Convert Artalk Config to ApiOptions for Api client
|
|
19
|
+
*
|
|
20
|
+
* @param conf - Artalk config
|
|
21
|
+
* @param ctx - If `ctx` not provided, `checkAdmin` and `checkCaptcha` will be disabled
|
|
22
|
+
* @returns ApiOptions for Api client instance creation
|
|
23
|
+
*/
|
|
24
|
+
export declare function convertApiOptions(conf: Partial<ArtalkConfig>, ctx?: ContextApi): ApiOptions;
|