artalk 2.7.0 → 2.7.2
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/README.md +1 -1
- package/dist/Artalk.css +1 -1
- package/dist/Artalk.es.js +209 -188
- 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 +209 -188
- 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/_base.d.ts +7 -0
- package/dist/src/api/_options.d.ts +5 -0
- package/dist/src/artalk.d.ts +0 -2
- package/dist/src/components/checker/index.d.ts +2 -0
- package/dist/src/i18n/en.d.ts +4 -0
- package/dist/src/i18n/external.d.ts +4 -0
- package/dist/src/i18n/index.d.ts +12 -0
- package/dist/src/i18n/jp.d.ts +4 -0
- package/dist/src/i18n/zh-TW.d.ts +4 -0
- package/dist/src/lib/user.d.ts +8 -6
- package/dist/src/main.d.ts +3 -0
- package/dist/src/plugins/editor/_kit.d.ts +7 -1
- package/dist/src/service.d.ts +2 -8
- package/dist/types/event.d.ts +1 -1
- package/package.json +43 -17
- package/dist/src/components/dark-mode.d.ts +0 -2
- package/src/api/_base.ts +0 -18
- package/src/api/_options.ts +0 -25
- package/src/api/_request.ts +0 -104
- package/src/api/admin.ts +0 -18
- package/src/api/captcha.ts +0 -24
- package/src/api/comment.ts +0 -84
- package/src/api/index.ts +0 -29
- package/src/api/page.ts +0 -83
- package/src/api/site.ts +0 -51
- package/src/api/system.ts +0 -49
- package/src/api/upload.ts +0 -28
- package/src/api/user.ts +0 -132
- package/src/artalk.ts +0 -119
- package/src/comment/actions.ts +0 -83
- package/src/comment/comment.html +0 -18
- package/src/comment/comment.ts +0 -192
- package/src/comment/height-limit.ts +0 -100
- package/src/comment/index.ts +0 -3
- package/src/comment/render.ts +0 -150
- package/src/comment/renders/actions.ts +0 -114
- package/src/comment/renders/avatar.ts +0 -22
- package/src/comment/renders/content.ts +0 -39
- package/src/comment/renders/header.ts +0 -84
- package/src/comment/renders/index.ts +0 -19
- package/src/comment/renders/pending.ts +0 -12
- package/src/comment/renders/reply-at.ts +0 -16
- package/src/comment/renders/reply-to.ts +0 -24
- package/src/components/action-btn.ts +0 -170
- package/src/components/checker/admin.ts +0 -37
- package/src/components/checker/captcha-renders.ts +0 -69
- package/src/components/checker/captcha.ts +0 -26
- package/src/components/checker/index.ts +0 -192
- package/src/components/dark-mode.ts +0 -30
- package/src/components/dialog.ts +0 -62
- package/src/components/error-dialog.ts +0 -35
- package/src/components/pagination.ts +0 -153
- package/src/components/read-more-btn.ts +0 -92
- package/src/config.ts +0 -119
- package/src/context.ts +0 -146
- package/src/data.ts +0 -110
- package/src/defaults.ts +0 -61
- package/src/editor/editor.html +0 -18
- package/src/editor/editor.ts +0 -114
- package/src/editor/state.ts +0 -52
- package/src/editor/ui.ts +0 -36
- package/src/i18n/en.ts +0 -81
- package/src/i18n/external.ts +0 -10
- package/src/i18n/index.ts +0 -67
- package/src/i18n/jp.ts +0 -83
- package/src/i18n/zh-CN.ts +0 -85
- package/src/i18n/zh-TW.ts +0 -83
- package/src/layer/index.ts +0 -4
- package/src/layer/layer-manager.ts +0 -32
- package/src/layer/layer.ts +0 -39
- package/src/layer/scrollbar-helper.ts +0 -24
- package/src/layer/sidebar-layer.html +0 -8
- package/src/layer/sidebar-layer.ts +0 -155
- package/src/layer/wrap.ts +0 -77
- package/src/lib/component.ts +0 -12
- package/src/lib/detect.ts +0 -222
- package/src/lib/event-manager.ts +0 -47
- package/src/lib/highlight.ts +0 -5
- package/src/lib/marked-renderer.ts +0 -32
- package/src/lib/marked.ts +0 -72
- package/src/lib/sanitizer.ts +0 -57
- package/src/lib/ui.ts +0 -193
- package/src/lib/user.ts +0 -55
- package/src/lib/utils.ts +0 -236
- package/src/list/comment.ts +0 -20
- package/src/list/layout.ts +0 -120
- package/src/list/list.html +0 -20
- package/src/list/list.ts +0 -79
- package/src/list/nest.ts +0 -66
- package/src/list/page.ts +0 -97
- package/src/list/paginator/index.ts +0 -25
- package/src/list/paginator/read-more.ts +0 -67
- package/src/list/paginator/up-down.ts +0 -51
- package/src/main.ts +0 -5
- package/src/plugins/admin-only-elem.ts +0 -40
- package/src/plugins/conf-remoter.ts +0 -54
- package/src/plugins/dark-mode.ts +0 -12
- package/src/plugins/editor/_kit.ts +0 -57
- package/src/plugins/editor/_plug.ts +0 -60
- package/src/plugins/editor/_sample.ts +0 -8
- package/src/plugins/editor/closable.ts +0 -44
- package/src/plugins/editor/emoticons.scss +0 -72
- package/src/plugins/editor/emoticons.ts +0 -293
- package/src/plugins/editor/header-event.ts +0 -35
- package/src/plugins/editor/header-link.ts +0 -31
- package/src/plugins/editor/header-user.ts +0 -98
- package/src/plugins/editor/index.ts +0 -40
- package/src/plugins/editor/local-storage.ts +0 -36
- package/src/plugins/editor/mover.ts +0 -29
- package/src/plugins/editor/preview.scss +0 -7
- package/src/plugins/editor/preview.ts +0 -41
- package/src/plugins/editor/state-edit.ts +0 -116
- package/src/plugins/editor/state-reply.ts +0 -91
- package/src/plugins/editor/submit-add.ts +0 -33
- package/src/plugins/editor/submit-btn.ts +0 -25
- package/src/plugins/editor/submit.ts +0 -73
- package/src/plugins/editor/textarea.ts +0 -55
- package/src/plugins/editor/upload.ts +0 -145
- package/src/plugins/editor-kit.ts +0 -161
- package/src/plugins/index.ts +0 -16
- package/src/plugins/list/copyright.ts +0 -16
- package/src/plugins/list/count.ts +0 -31
- package/src/plugins/list/dropdown.ts +0 -95
- package/src/plugins/list/error-dialog.ts +0 -22
- package/src/plugins/list/fetch.ts +0 -64
- package/src/plugins/list/goto-first.ts +0 -23
- package/src/plugins/list/goto.ts +0 -72
- package/src/plugins/list/index.ts +0 -25
- package/src/plugins/list/loading.ts +0 -17
- package/src/plugins/list/no-comment.ts +0 -25
- package/src/plugins/list/reach-bottom.ts +0 -46
- package/src/plugins/list/sidebar-btn.ts +0 -39
- package/src/plugins/list/time-ticking.ts +0 -22
- package/src/plugins/list/unread-badge.ts +0 -26
- package/src/plugins/list/unread.ts +0 -38
- package/src/plugins/list/with-editor.ts +0 -59
- package/src/plugins/markdown.ts +0 -10
- package/src/plugins/stat.ts +0 -79
- package/src/plugins/version-check.ts +0 -37
- package/src/service.ts +0 -91
- package/src/style/_color.scss +0 -41
- package/src/style/_extend.scss +0 -20
- package/src/style/_variables.scss +0 -3
- package/src/style/comment.scss +0 -360
- package/src/style/editor.scss +0 -194
- package/src/style/list.scss +0 -212
- package/src/style/main.scss +0 -486
- package/src/style/pagination.scss +0 -58
- package/src/style/sidebar-layer.scss +0 -92
- package/types/config.ts +0 -153
- package/types/context.ts +0 -84
- package/types/data.ts +0 -271
- package/types/editor.ts +0 -95
- package/types/event.ts +0 -40
- package/types/global.d.ts +0 -1
- package/types/index.ts +0 -7
- package/types/plugin.ts +0 -3
- package/types/sidebar.ts +0 -3
package/types/editor.ts
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import type { CommentData, NotifyLevel } from '.'
|
|
2
|
-
import type Component from '../src/lib/component'
|
|
3
|
-
import type { EditorUI } from '../src/editor/ui'
|
|
4
|
-
|
|
5
|
-
export type EditorState = 'reply' | 'edit' | 'normal'
|
|
6
|
-
|
|
7
|
-
export interface EditorApi extends Component {
|
|
8
|
-
getUI(): EditorUI
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Get the header input elements
|
|
12
|
-
*/
|
|
13
|
-
getHeaderInputEls(): Record<string, HTMLInputElement>
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Set content
|
|
17
|
-
*/
|
|
18
|
-
setContent(val: string): void
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Insert content
|
|
22
|
-
*/
|
|
23
|
-
insertContent(val: string): void
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Get the final content
|
|
27
|
-
*
|
|
28
|
-
* This function returns the raw content or the content transformed through a plugin hook.
|
|
29
|
-
*/
|
|
30
|
-
getContentFinal(): string
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Get the raw content which is inputed by user
|
|
34
|
-
*/
|
|
35
|
-
getContentRaw(): string
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Get the HTML format content which is rendered by marked (a markdown parser)
|
|
39
|
-
*/
|
|
40
|
-
getContentMarked(): string
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Get editor current state
|
|
44
|
-
*/
|
|
45
|
-
getState(): EditorState
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Focus editor
|
|
49
|
-
*/
|
|
50
|
-
focus(): void
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Reset editor
|
|
54
|
-
*/
|
|
55
|
-
reset(): void
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Reset editor UI
|
|
59
|
-
*
|
|
60
|
-
* call it will move editor to the initial position
|
|
61
|
-
*/
|
|
62
|
-
resetState(): void
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Submit comment
|
|
66
|
-
*/
|
|
67
|
-
submit(): void
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Show notification message
|
|
71
|
-
*/
|
|
72
|
-
showNotify(msg: string, type: NotifyLevel): void
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Show loading on editor
|
|
76
|
-
*/
|
|
77
|
-
showLoading(): void
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Hide loading on editor
|
|
81
|
-
*/
|
|
82
|
-
hideLoading(): void
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Start replaying a comment
|
|
86
|
-
*/
|
|
87
|
-
setReply(commentData: CommentData, $comment: HTMLElement, scroll?: boolean): void
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Start editing a comment
|
|
91
|
-
*/
|
|
92
|
-
setEditComment(commentData: CommentData, $comment: HTMLElement): void
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export default EditorApi
|
package/types/event.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type Comment from '~/src/comment'
|
|
2
|
-
import { CommentData, ListData, ListFetchParams, NotifyData, PageData } from './data'
|
|
3
|
-
import { ArtalkConfig, LocalUser } from './config'
|
|
4
|
-
|
|
5
|
-
interface ErrorData { msg: string, data?: any }
|
|
6
|
-
interface ListFetchedArgs { params: Partial<ListFetchParams>, data?: ListData, error?: ErrorData }
|
|
7
|
-
|
|
8
|
-
/** EventName to EventPayload Type */
|
|
9
|
-
export interface EventPayloadMap {
|
|
10
|
-
'inited': undefined // Artalk 初始化后
|
|
11
|
-
'destroy': undefined // Artalk 销毁时
|
|
12
|
-
'list-fetch': Partial<ListFetchParams> // 评论列表请求时
|
|
13
|
-
'list-fetched': ListFetchedArgs // 评论列表请求后
|
|
14
|
-
'list-load': CommentData[] // 评论装载前
|
|
15
|
-
|
|
16
|
-
// TODO merge 'list-loaded' and 'list-error', for purpose of `once` 'list-loaded' and simplify
|
|
17
|
-
// example need bind 'list-loaded' and 'list-error' to same handler
|
|
18
|
-
// consider name it to 'list-fetched': { data: CommentData[], error?: { msg: string, data?: any } }
|
|
19
|
-
// and remove `list-load`
|
|
20
|
-
'list-loaded': CommentData[] // 评论装载后
|
|
21
|
-
'list-error': ErrorData // 评论加载错误时
|
|
22
|
-
|
|
23
|
-
'list-goto-first': undefined // 评论列表归位时
|
|
24
|
-
'list-reach-bottom': undefined // 评论列表滚动到底部时
|
|
25
|
-
|
|
26
|
-
'comment-inserted': CommentData // 评论插入后
|
|
27
|
-
'comment-updated': CommentData // 评论更新后
|
|
28
|
-
'comment-deleted': CommentData // 评论删除后
|
|
29
|
-
'comment-rendered': Comment // 评论节点渲染后
|
|
30
|
-
'unreads-updated': NotifyData[] // 未读消息变更时
|
|
31
|
-
'list-goto': number // 评论跳转时
|
|
32
|
-
'page-loaded': PageData // 页面数据更新后
|
|
33
|
-
'editor-submit': undefined // 编辑器提交时
|
|
34
|
-
'editor-submitted': undefined // 编辑器提交后
|
|
35
|
-
'user-changed': LocalUser // 本地用户数据变更时
|
|
36
|
-
'conf-loaded': ArtalkConfig // Artalk 配置变更时
|
|
37
|
-
'dark-mode-changed': boolean // 深色模式变更时
|
|
38
|
-
'sidebar-show': undefined // 侧边栏显示
|
|
39
|
-
'sidebar-hide': undefined // 侧边栏隐藏
|
|
40
|
-
}
|
package/types/global.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
declare const ARTALK_LITE: boolean
|
package/types/index.ts
DELETED
package/types/plugin.ts
DELETED
package/types/sidebar.ts
DELETED