artalk 2.9.1 → 2.10.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.cjs +2 -11
- package/dist/Artalk.cjs.map +1 -1
- package/dist/Artalk.css +2 -1
- package/dist/Artalk.iife.js +2 -11
- package/dist/Artalk.iife.js.map +1 -1
- package/dist/Artalk.js +2 -11
- package/dist/Artalk.js.map +1 -1
- package/dist/Artalk.mjs +4 -9419
- package/dist/Artalk.mjs.map +1 -1
- package/dist/ArtalkLite.cjs +2 -11
- package/dist/ArtalkLite.cjs.map +1 -1
- package/dist/ArtalkLite.css +2 -1
- package/dist/ArtalkLite.d.cts +3343 -0
- package/dist/ArtalkLite.d.ts +3343 -0
- package/dist/ArtalkLite.iife.js +2 -11
- package/dist/ArtalkLite.iife.js.map +1 -1
- package/dist/ArtalkLite.js +2 -11
- package/dist/ArtalkLite.js.map +1 -1
- package/dist/ArtalkLite.mjs +4 -7354
- package/dist/ArtalkLite.mjs.map +1 -1
- package/dist/i18n/fr.cjs +1 -1
- package/dist/i18n/fr.js +1 -1
- package/dist/i18n/fr.mjs +1 -123
- package/dist/i18n/ja.cjs +1 -1
- package/dist/i18n/ja.js +1 -1
- package/dist/i18n/ja.mjs +1 -123
- package/dist/i18n/ko.cjs +1 -1
- package/dist/i18n/ko.js +1 -1
- package/dist/i18n/ko.mjs +1 -123
- package/dist/i18n/ru.cjs +1 -1
- package/dist/i18n/ru.js +1 -1
- package/dist/i18n/ru.mjs +1 -123
- package/dist/i18n/tr.cjs +1 -0
- package/dist/i18n/tr.d.cts +3 -0
- package/dist/i18n/tr.d.ts +3 -0
- package/dist/i18n/tr.js +1 -0
- package/dist/i18n/tr.mjs +1 -0
- package/dist/i18n/zh-TW.cjs +1 -1
- package/dist/i18n/zh-TW.js +1 -1
- package/dist/i18n/zh-TW.mjs +1 -115
- package/dist/main.d.cts +591 -423
- package/dist/main.d.ts +591 -423
- package/package.json +57 -47
package/dist/main.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ declare interface ActionBtnOptions {
|
|
|
52
52
|
confirmText?: string;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
declare class Api extends Api_2<void> {
|
|
55
|
+
export declare class Api extends Api_2<void> {
|
|
56
56
|
private _opts;
|
|
57
57
|
constructor(opts: ApiOptions);
|
|
58
58
|
/**
|
|
@@ -465,12 +465,13 @@ declare class Api_2<SecurityDataType extends unknown> extends HttpClient<Securit
|
|
|
465
465
|
};
|
|
466
466
|
notifies: {
|
|
467
467
|
/**
|
|
468
|
-
* @description Get
|
|
468
|
+
* @description Get unread notifications owned by the authenticated user or anonymous comment credential
|
|
469
469
|
*
|
|
470
470
|
* @tags Notify
|
|
471
471
|
* @name GetNotifies
|
|
472
472
|
* @summary Get Notifies
|
|
473
473
|
* @request GET:/notifies
|
|
474
|
+
* @secure
|
|
474
475
|
* @response `200` `HandlerResponseNotifyList` OK
|
|
475
476
|
* @response `400` `(HandlerMap & {
|
|
476
477
|
msg?: string,
|
|
@@ -490,17 +491,22 @@ declare class Api_2<SecurityDataType extends unknown> extends HttpClient<Securit
|
|
|
490
491
|
msg?: string;
|
|
491
492
|
}>>;
|
|
492
493
|
/**
|
|
493
|
-
* @description Mark
|
|
494
|
+
* @description Mark owned notifications as read using a login or anonymous comment credential
|
|
494
495
|
*
|
|
495
496
|
* @tags Notify
|
|
496
497
|
* @name MarkAllNotifyRead
|
|
497
498
|
* @summary Mark All Notifies as Read
|
|
498
499
|
* @request POST:/notifies/read
|
|
500
|
+
* @secure
|
|
499
501
|
* @response `200` `HandlerMap` OK
|
|
500
502
|
* @response `400` `(HandlerMap & {
|
|
501
503
|
msg?: string,
|
|
502
504
|
|
|
503
505
|
})` Bad Request
|
|
506
|
+
* @response `401` `(HandlerMap & {
|
|
507
|
+
msg?: string,
|
|
508
|
+
|
|
509
|
+
})` Unauthorized
|
|
504
510
|
* @response `500` `(HandlerMap & {
|
|
505
511
|
msg?: string,
|
|
506
512
|
|
|
@@ -550,6 +556,8 @@ declare class Api_2<SecurityDataType extends unknown> extends HttpClient<Securit
|
|
|
550
556
|
})` Forbidden
|
|
551
557
|
*/
|
|
552
558
|
getPages: (query?: {
|
|
559
|
+
/** Only include pages with comments (including pending comments) */
|
|
560
|
+
has_comments?: boolean;
|
|
553
561
|
/** The limit for pagination */
|
|
554
562
|
limit?: number;
|
|
555
563
|
/** The offset for pagination */
|
|
@@ -828,6 +836,44 @@ declare class Api_2<SecurityDataType extends unknown> extends HttpClient<Securit
|
|
|
828
836
|
msg?: string;
|
|
829
837
|
}>>;
|
|
830
838
|
};
|
|
839
|
+
sso: {
|
|
840
|
+
/**
|
|
841
|
+
* @description Validates a third-party OIDC access token by calling the issuer's /userinfo endpoint, requires a verified email claim, then mints an Artalk session JWT. Use when the surrounding application already runs OIDC and you want Artalk comments to inherit that session without showing Artalk's own login UI.
|
|
842
|
+
*
|
|
843
|
+
* @tags Auth
|
|
844
|
+
* @name AuthSsoExchange
|
|
845
|
+
* @summary Exchange an external IdP access token for an Artalk JWT
|
|
846
|
+
* @request POST:/sso/exchange
|
|
847
|
+
* @response `200` `HandlerResponseUserLogin` OK
|
|
848
|
+
* @response `400` `(HandlerMap & {
|
|
849
|
+
msg?: string,
|
|
850
|
+
|
|
851
|
+
})` Bad Request
|
|
852
|
+
* @response `401` `(HandlerMap & {
|
|
853
|
+
msg?: string,
|
|
854
|
+
|
|
855
|
+
})` Unauthorized
|
|
856
|
+
* @response `404` `(HandlerMap & {
|
|
857
|
+
msg?: string,
|
|
858
|
+
|
|
859
|
+
})` Not Found
|
|
860
|
+
* @response `500` `(HandlerMap & {
|
|
861
|
+
msg?: string,
|
|
862
|
+
|
|
863
|
+
})` Internal Server Error
|
|
864
|
+
* @response `502` `(HandlerMap & {
|
|
865
|
+
msg?: string,
|
|
866
|
+
|
|
867
|
+
})` Bad Gateway
|
|
868
|
+
* @response `503` `(HandlerMap & {
|
|
869
|
+
msg?: string,
|
|
870
|
+
|
|
871
|
+
})` Service Unavailable
|
|
872
|
+
*/
|
|
873
|
+
authSsoExchange: (body: HandlerParamsAuthSSOExchange, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUserLogin, HandlerMap & {
|
|
874
|
+
msg?: string;
|
|
875
|
+
}>>;
|
|
876
|
+
};
|
|
831
877
|
stats: {
|
|
832
878
|
/**
|
|
833
879
|
* @description Get the statistics of various data analysis
|
|
@@ -1186,12 +1232,40 @@ declare class Api_2<SecurityDataType extends unknown> extends HttpClient<Securit
|
|
|
1186
1232
|
msg?: string;
|
|
1187
1233
|
}>>;
|
|
1188
1234
|
/**
|
|
1189
|
-
* @description
|
|
1235
|
+
* @description Get vote status for a specific comment or page
|
|
1236
|
+
*
|
|
1237
|
+
* @tags Vote
|
|
1238
|
+
* @name GetVote
|
|
1239
|
+
* @summary Get Vote Status
|
|
1240
|
+
* @request GET:/votes/{target_name}/{target_id}
|
|
1241
|
+
* @response `200` `HandlerResponseVote` OK
|
|
1242
|
+
* @response `400` `(HandlerMap & {
|
|
1243
|
+
msg?: string,
|
|
1244
|
+
|
|
1245
|
+
})` Bad Request
|
|
1246
|
+
* @response `403` `(HandlerMap & {
|
|
1247
|
+
msg?: string,
|
|
1248
|
+
|
|
1249
|
+
})` Forbidden
|
|
1250
|
+
* @response `404` `(HandlerMap & {
|
|
1251
|
+
msg?: string,
|
|
1252
|
+
|
|
1253
|
+
})` Not Found
|
|
1254
|
+
* @response `500` `(HandlerMap & {
|
|
1255
|
+
msg?: string,
|
|
1256
|
+
|
|
1257
|
+
})` Internal Server Error
|
|
1258
|
+
*/
|
|
1259
|
+
getVote: (targetName: "comment" | "page", targetId: number, params?: RequestParams) => Promise<HttpResponse<HandlerResponseVote, HandlerMap & {
|
|
1260
|
+
msg?: string;
|
|
1261
|
+
}>>;
|
|
1262
|
+
/**
|
|
1263
|
+
* @description Create a new vote for a specific comment or page
|
|
1190
1264
|
*
|
|
1191
1265
|
* @tags Vote
|
|
1192
|
-
* @name
|
|
1193
|
-
* @summary Vote
|
|
1194
|
-
* @request POST:/votes/{
|
|
1266
|
+
* @name CreateVote
|
|
1267
|
+
* @summary Create Vote
|
|
1268
|
+
* @request POST:/votes/{target_name}/{target_id}/{choice}
|
|
1195
1269
|
* @response `200` `HandlerResponseVote` OK
|
|
1196
1270
|
* @response `403` `(HandlerMap & {
|
|
1197
1271
|
msg?: string,
|
|
@@ -1206,7 +1280,7 @@ declare class Api_2<SecurityDataType extends unknown> extends HttpClient<Securit
|
|
|
1206
1280
|
|
|
1207
1281
|
})` Internal Server Error
|
|
1208
1282
|
*/
|
|
1209
|
-
|
|
1283
|
+
createVote: (targetName: "comment" | "page", targetId: number, choice: "up" | "down", vote: HandlerParamsVoteCreate, params?: RequestParams) => Promise<HttpResponse<HandlerResponseVote, HandlerMap & {
|
|
1210
1284
|
msg?: string;
|
|
1211
1285
|
}>>;
|
|
1212
1286
|
};
|
|
@@ -1233,7 +1307,7 @@ declare interface ApiHandlerPayload {
|
|
|
1233
1307
|
need_auth_login: object;
|
|
1234
1308
|
}
|
|
1235
1309
|
|
|
1236
|
-
declare interface ApiHandlers {
|
|
1310
|
+
export declare interface ApiHandlers {
|
|
1237
1311
|
add: <T extends PayloadKey>(action: T, handler: (data: ApiHandlerPayload[T]) => Promise<void>) => void;
|
|
1238
1312
|
remove: (action: PayloadKey) => void;
|
|
1239
1313
|
get: () => ApiHandler[];
|
|
@@ -1245,6 +1319,7 @@ declare interface ApiOptions {
|
|
|
1245
1319
|
pageKey: string;
|
|
1246
1320
|
pageTitle: string;
|
|
1247
1321
|
timeout?: number;
|
|
1322
|
+
getGuestToken?: (create?: boolean) => string | undefined;
|
|
1248
1323
|
getApiToken?: () => string | undefined;
|
|
1249
1324
|
userInfo?: {
|
|
1250
1325
|
name: string;
|
|
@@ -1268,14 +1343,14 @@ export declare interface ApiVersionData {
|
|
|
1268
1343
|
* @see https://artalk.js.org
|
|
1269
1344
|
*/
|
|
1270
1345
|
declare class Artalk {
|
|
1271
|
-
ctx:
|
|
1272
|
-
constructor(conf:
|
|
1346
|
+
ctx: Context;
|
|
1347
|
+
constructor(conf: ConfigPartial);
|
|
1273
1348
|
/** Get the config of Artalk */
|
|
1274
|
-
getConf():
|
|
1349
|
+
getConf(): Config;
|
|
1275
1350
|
/** Get the root element of Artalk */
|
|
1276
1351
|
getEl(): HTMLElement;
|
|
1277
1352
|
/** Update config of Artalk */
|
|
1278
|
-
update(conf:
|
|
1353
|
+
update(conf: ConfigPartial): void;
|
|
1279
1354
|
/** Reload comment list of Artalk */
|
|
1280
1355
|
reload(): void;
|
|
1281
1356
|
/** Destroy instance of Artalk */
|
|
@@ -1289,135 +1364,32 @@ declare class Artalk {
|
|
|
1289
1364
|
/** Set dark mode */
|
|
1290
1365
|
setDarkMode(darkMode: boolean): void;
|
|
1291
1366
|
/** Init Artalk */
|
|
1292
|
-
static init(conf:
|
|
1367
|
+
static init(conf: ConfigPartial): Artalk;
|
|
1293
1368
|
/** Use plugin, the plugin will be used when Artalk.init */
|
|
1294
1369
|
static use<T = any>(plugin: ArtalkPlugin<T>, options?: T): void;
|
|
1295
1370
|
/** Load count widget */
|
|
1296
|
-
static loadCountWidget(c:
|
|
1371
|
+
static loadCountWidget(c: ConfigPartial): void;
|
|
1297
1372
|
/** @deprecated Please use `getEl()` instead */
|
|
1298
1373
|
get $root(): HTMLElement;
|
|
1299
1374
|
/** @description Please use `getConf()` instead */
|
|
1300
|
-
get conf():
|
|
1375
|
+
get conf(): Config;
|
|
1301
1376
|
}
|
|
1302
1377
|
export default Artalk;
|
|
1303
1378
|
|
|
1304
|
-
export declare
|
|
1305
|
-
/** 装载元素 */
|
|
1306
|
-
el: string | HTMLElement;
|
|
1307
|
-
/** 页面唯一标识(完整 URL) */
|
|
1308
|
-
pageKey: string;
|
|
1309
|
-
/** 页面标题 */
|
|
1310
|
-
pageTitle: string;
|
|
1311
|
-
/** 服务器地址 */
|
|
1312
|
-
server: string;
|
|
1313
|
-
/** 站点名 */
|
|
1314
|
-
site: string;
|
|
1315
|
-
/** 评论框占位字符 */
|
|
1316
|
-
placeholder: string;
|
|
1317
|
-
/** 评论为空时显示字符 */
|
|
1318
|
-
noComment: string;
|
|
1319
|
-
/** 发送按钮文字 */
|
|
1320
|
-
sendBtn: string;
|
|
1321
|
-
/** 评论框穿梭(显示在待回复评论后面) */
|
|
1322
|
-
editorTravel: boolean;
|
|
1323
|
-
/** 表情包 */
|
|
1324
|
-
emoticons: object | any[] | string | false;
|
|
1325
|
-
/** Gravatar 头像 */
|
|
1326
|
-
gravatar: {
|
|
1327
|
-
/** API 地址 */
|
|
1328
|
-
mirror: string;
|
|
1329
|
-
/** API 参数 */
|
|
1330
|
-
params: string;
|
|
1331
|
-
};
|
|
1332
|
-
/** 头像链接生成器 */
|
|
1333
|
-
avatarURLBuilder?: (comment: CommentData) => string;
|
|
1334
|
-
/** 分页配置 */
|
|
1335
|
-
pagination: {
|
|
1336
|
-
/** 每次请求获取数量 */
|
|
1337
|
-
pageSize: number;
|
|
1338
|
-
/** 阅读更多模式 */
|
|
1339
|
-
readMore: boolean;
|
|
1340
|
-
/** 滚动到底部自动加载 */
|
|
1341
|
-
autoLoad: boolean;
|
|
1342
|
-
};
|
|
1343
|
-
/** 内容限高 */
|
|
1344
|
-
heightLimit: {
|
|
1345
|
-
/** 评论内容限高 */
|
|
1346
|
-
content: number;
|
|
1347
|
-
/** 子评论区域限高 */
|
|
1348
|
-
children: number;
|
|
1349
|
-
/** 滚动限高 */
|
|
1350
|
-
scrollable: boolean;
|
|
1351
|
-
};
|
|
1352
|
-
/** 评论投票按钮 */
|
|
1353
|
-
vote: boolean;
|
|
1354
|
-
/** 评论投票反对按钮 */
|
|
1355
|
-
voteDown: boolean;
|
|
1356
|
-
/** 评论预览功能 */
|
|
1357
|
-
preview: boolean;
|
|
1358
|
-
/** 评论数绑定元素 Selector */
|
|
1359
|
-
countEl: string;
|
|
1360
|
-
/** PV 数绑定元素 Selector */
|
|
1361
|
-
pvEl: string;
|
|
1362
|
-
/** 统计组件 PageKey 属性名 */
|
|
1363
|
-
statPageKeyAttr: string;
|
|
1364
|
-
/** 夜间模式 */
|
|
1365
|
-
darkMode: boolean | 'auto';
|
|
1366
|
-
/** 请求超时(单位:秒) */
|
|
1367
|
-
reqTimeout: number;
|
|
1368
|
-
/** 平铺模式 */
|
|
1369
|
-
flatMode: boolean | 'auto';
|
|
1370
|
-
/** 嵌套模式 · 最大层数 */
|
|
1371
|
-
nestMax: number;
|
|
1372
|
-
/** 嵌套模式 · 排序方式 */
|
|
1373
|
-
nestSort: 'DATE_ASC' | 'DATE_DESC';
|
|
1374
|
-
/** 显示 UA 徽标 */
|
|
1375
|
-
uaBadge: boolean;
|
|
1376
|
-
/** 评论列表排序功能 (显示 Dropdown) */
|
|
1377
|
-
listSort: boolean;
|
|
1378
|
-
/** 图片上传功能 */
|
|
1379
|
-
imgUpload: boolean;
|
|
1380
|
-
/** 图片上传器 */
|
|
1381
|
-
imgUploader?: (file: File) => Promise<string>;
|
|
1382
|
-
/** Image lazy load */
|
|
1383
|
-
imgLazyLoad?: 'native' | 'data-src';
|
|
1384
|
-
/** 版本检测 */
|
|
1385
|
-
versionCheck: boolean;
|
|
1386
|
-
/** 引用后端配置 */
|
|
1387
|
-
useBackendConf: boolean;
|
|
1388
|
-
/** 语言本地化 */
|
|
1389
|
-
locale: I18n | string;
|
|
1390
|
-
/** 后端版本 (系统数据,用户不允许更改) */
|
|
1391
|
-
apiVersion?: string;
|
|
1392
|
-
/** Plugin script urls */
|
|
1393
|
-
pluginURLs?: string[];
|
|
1394
|
-
/** Replacer for marked */
|
|
1395
|
-
markedReplacers?: ((raw: string) => string)[];
|
|
1396
|
-
/** Marked options */
|
|
1397
|
-
markedOptions?: MarkedOptions;
|
|
1398
|
-
/** 列表请求参数修改器 */
|
|
1399
|
-
listFetchParamsModifier?: (params: any) => void;
|
|
1400
|
-
/**
|
|
1401
|
-
* Date formatter for custom date format
|
|
1402
|
-
* @param date - Date object
|
|
1403
|
-
* @returns Formatted date string
|
|
1404
|
-
*/
|
|
1405
|
-
dateFormatter?: (date: Date) => string;
|
|
1406
|
-
remoteConfModifier?: (conf: Partial<ArtalkConfig>) => void;
|
|
1407
|
-
listUnreadHighlight?: boolean;
|
|
1408
|
-
scrollRelativeTo?: () => HTMLElement;
|
|
1409
|
-
pvAdd?: boolean;
|
|
1410
|
-
beforeSubmit?: (editor: EditorApi, next: () => void) => void;
|
|
1411
|
-
}
|
|
1379
|
+
export declare type ArtalkConfig = Config;
|
|
1412
1380
|
|
|
1413
|
-
export declare type ArtalkPlugin<T = any> = (ctx:
|
|
1381
|
+
export declare type ArtalkPlugin<T = any> = (ctx: Context, options?: T) => void;
|
|
1414
1382
|
|
|
1415
1383
|
declare namespace ArtalkType {
|
|
1416
1384
|
export {
|
|
1417
1385
|
I18n,
|
|
1418
1386
|
I18nKeys,
|
|
1387
|
+
Api,
|
|
1388
|
+
ApiHandlers,
|
|
1389
|
+
Config,
|
|
1390
|
+
ConfigPartial,
|
|
1419
1391
|
ArtalkConfig,
|
|
1420
|
-
|
|
1392
|
+
ConfigManager,
|
|
1421
1393
|
CommentData,
|
|
1422
1394
|
ListData,
|
|
1423
1395
|
PageData,
|
|
@@ -1430,19 +1402,35 @@ declare namespace ArtalkType {
|
|
|
1430
1402
|
ApiVersionData,
|
|
1431
1403
|
ListFetchParams,
|
|
1432
1404
|
ListLastFetchData,
|
|
1405
|
+
DataManager,
|
|
1433
1406
|
DataManagerApi,
|
|
1434
1407
|
NotifyLevel,
|
|
1435
1408
|
UserInfoApiResponseData,
|
|
1436
1409
|
FetchError,
|
|
1410
|
+
Context,
|
|
1437
1411
|
ContextApi,
|
|
1412
|
+
LocalUser,
|
|
1413
|
+
UserManager,
|
|
1414
|
+
List,
|
|
1415
|
+
ListLayout,
|
|
1438
1416
|
EditorState,
|
|
1417
|
+
Editor,
|
|
1439
1418
|
EditorApi,
|
|
1419
|
+
EditorPluginManager,
|
|
1440
1420
|
ListErrorData,
|
|
1441
1421
|
ListFetchedArgs,
|
|
1442
1422
|
EventPayloadMap,
|
|
1423
|
+
EventHandler,
|
|
1424
|
+
Event_2 as Event,
|
|
1425
|
+
EventOptions,
|
|
1426
|
+
EventManager,
|
|
1443
1427
|
ArtalkPlugin,
|
|
1428
|
+
SidebarLayer,
|
|
1444
1429
|
SidebarShowPayload,
|
|
1445
|
-
Layer
|
|
1430
|
+
Layer,
|
|
1431
|
+
LayerManager,
|
|
1432
|
+
CheckerManager,
|
|
1433
|
+
Services
|
|
1446
1434
|
}
|
|
1447
1435
|
}
|
|
1448
1436
|
export { ArtalkType }
|
|
@@ -1475,30 +1463,26 @@ declare interface CheckerCtx {
|
|
|
1475
1463
|
set<K extends keyof CheckerStore>(key: K, val: CheckerStore[K]): void;
|
|
1476
1464
|
getOpts(): CheckerLauncherOptions;
|
|
1477
1465
|
getApi(): Api;
|
|
1478
|
-
getUser():
|
|
1466
|
+
getUser(): UserManager;
|
|
1479
1467
|
hideInteractInput(): void;
|
|
1480
1468
|
triggerSuccess(): void;
|
|
1481
1469
|
cancel(): void;
|
|
1482
1470
|
}
|
|
1483
1471
|
|
|
1484
|
-
/**
|
|
1485
|
-
* Checker 发射台
|
|
1486
|
-
*/
|
|
1487
|
-
declare class CheckerLauncher {
|
|
1488
|
-
private opts;
|
|
1489
|
-
constructor(opts: CheckerLauncherOptions);
|
|
1490
|
-
checkCaptcha: (payload: CheckerCaptchaPayload) => Promise<void>;
|
|
1491
|
-
checkAdmin: (payload: CheckerPayload) => Promise<void>;
|
|
1492
|
-
fire(checker: Checker, payload: CheckerPayload, postFire?: (c: CheckerCtx) => void): void;
|
|
1493
|
-
}
|
|
1494
|
-
|
|
1495
1472
|
declare interface CheckerLauncherOptions {
|
|
1496
|
-
getCtx: () => ContextApi;
|
|
1497
1473
|
getApi: () => Api;
|
|
1474
|
+
getLayers: () => LayerManager;
|
|
1475
|
+
getUser: () => UserManager;
|
|
1498
1476
|
getCaptchaIframeURL: () => string;
|
|
1499
1477
|
onReload: () => void;
|
|
1500
1478
|
}
|
|
1501
1479
|
|
|
1480
|
+
export declare interface CheckerManager {
|
|
1481
|
+
checkCaptcha: (payload: CheckerCaptchaPayload) => Promise<void>;
|
|
1482
|
+
checkAdmin: (payload: CheckerPayload) => Promise<void>;
|
|
1483
|
+
check: (checker: Checker, payload: CheckerPayload, beforeCheck?: (c: CheckerCtx) => void) => void;
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1502
1486
|
declare interface CheckerPayload {
|
|
1503
1487
|
onSuccess?: () => void;
|
|
1504
1488
|
onMount?: (dialogEl: HTMLElement) => void;
|
|
@@ -1518,7 +1502,7 @@ declare class CommentActions {
|
|
|
1518
1502
|
private getApi;
|
|
1519
1503
|
constructor(comment: CommentNode);
|
|
1520
1504
|
/** 投票操作 */
|
|
1521
|
-
vote(
|
|
1505
|
+
vote(choice: 'up' | 'down'): void;
|
|
1522
1506
|
/** 管理员 - 评论状态修改 */
|
|
1523
1507
|
adminEdit(type: 'collapsed' | 'pending' | 'pinned', btnElem: ActionBtn): void;
|
|
1524
1508
|
/** 管理员 - 评论删除 */
|
|
@@ -1645,14 +1629,6 @@ declare class CommentNode {
|
|
|
1645
1629
|
getOpts(): CommentOptions;
|
|
1646
1630
|
}
|
|
1647
1631
|
|
|
1648
|
-
declare type CommentNode_2 = {
|
|
1649
|
-
id: number;
|
|
1650
|
-
comment: CommentData;
|
|
1651
|
-
children: CommentNode_2[];
|
|
1652
|
-
parent?: CommentNode_2;
|
|
1653
|
-
level: number;
|
|
1654
|
-
};
|
|
1655
|
-
|
|
1656
1632
|
declare interface CommentOptions {
|
|
1657
1633
|
onAfterRender?: () => void;
|
|
1658
1634
|
onDelete?: (c: CommentNode) => void;
|
|
@@ -1663,14 +1639,14 @@ declare interface CommentOptions {
|
|
|
1663
1639
|
voteDown: boolean;
|
|
1664
1640
|
uaBadge: boolean;
|
|
1665
1641
|
nestMax: number;
|
|
1666
|
-
gravatar:
|
|
1667
|
-
heightLimit:
|
|
1668
|
-
avatarURLBuilder:
|
|
1669
|
-
scrollRelativeTo:
|
|
1670
|
-
dateFormatter:
|
|
1642
|
+
gravatar: Config['gravatar'];
|
|
1643
|
+
heightLimit: Config['heightLimit'];
|
|
1644
|
+
avatarURLBuilder: Config['avatarURLBuilder'];
|
|
1645
|
+
scrollRelativeTo: Config['scrollRelativeTo'];
|
|
1646
|
+
dateFormatter: Config['dateFormatter'];
|
|
1671
1647
|
getApi: () => Api;
|
|
1672
|
-
replyComment:
|
|
1673
|
-
editComment:
|
|
1648
|
+
replyComment: Context['replyComment'];
|
|
1649
|
+
editComment: Context['editComment'];
|
|
1674
1650
|
}
|
|
1675
1651
|
|
|
1676
1652
|
declare interface CommonApiVersionData {
|
|
@@ -1686,23 +1662,175 @@ declare interface CommonConfData {
|
|
|
1686
1662
|
|
|
1687
1663
|
declare interface CommonJSONResult {
|
|
1688
1664
|
/** Data */
|
|
1689
|
-
data
|
|
1665
|
+
data?: any;
|
|
1690
1666
|
/** Message */
|
|
1691
|
-
msg
|
|
1667
|
+
msg?: string;
|
|
1692
1668
|
}
|
|
1693
1669
|
|
|
1694
1670
|
declare type CommonMap = Record<string, any>;
|
|
1695
1671
|
|
|
1696
|
-
declare
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1672
|
+
export declare interface Config {
|
|
1673
|
+
/** Element selector or Element to mount the Artalk */
|
|
1674
|
+
el: string | HTMLElement;
|
|
1675
|
+
/** Unique page identifier */
|
|
1676
|
+
pageKey: string;
|
|
1677
|
+
/** Title of the page */
|
|
1678
|
+
pageTitle: string;
|
|
1679
|
+
/** Server address */
|
|
1680
|
+
server: string;
|
|
1681
|
+
/** Site name */
|
|
1682
|
+
site: string;
|
|
1683
|
+
/** Placeholder text for the comment input box */
|
|
1684
|
+
placeholder: string;
|
|
1685
|
+
/** Text to display when there are no comments */
|
|
1686
|
+
noComment: string;
|
|
1687
|
+
/** Text for the send button */
|
|
1688
|
+
sendBtn: string;
|
|
1689
|
+
/** Movable comment box (display below the comment to be replied) */
|
|
1690
|
+
editorTravel: boolean;
|
|
1691
|
+
/** Emoticons settings */
|
|
1692
|
+
emoticons: object | any[] | string | false;
|
|
1693
|
+
/** Gravatar avatar settings */
|
|
1694
|
+
gravatar: {
|
|
1695
|
+
/** API endpoint */
|
|
1696
|
+
mirror: string;
|
|
1697
|
+
/** API parameters */
|
|
1698
|
+
params: string;
|
|
1699
|
+
};
|
|
1700
|
+
/** Avatar URL generator function */
|
|
1701
|
+
avatarURLBuilder?: (comment: CommentData) => string;
|
|
1702
|
+
/** Pagination settings */
|
|
1703
|
+
pagination: {
|
|
1704
|
+
/** Number of comments to fetch per request */
|
|
1705
|
+
pageSize: number;
|
|
1706
|
+
/** "Read more" mode */
|
|
1707
|
+
readMore: boolean;
|
|
1708
|
+
/** Automatically load more comments when scrolled to the bottom */
|
|
1709
|
+
autoLoad: boolean;
|
|
1710
|
+
};
|
|
1711
|
+
/** Height limit configuration */
|
|
1712
|
+
heightLimit: {
|
|
1713
|
+
/** Maximum height for comment content */
|
|
1714
|
+
content: number;
|
|
1715
|
+
/** Maximum height for child comments */
|
|
1716
|
+
children: number;
|
|
1717
|
+
/** Whether the content is scrollable */
|
|
1718
|
+
scrollable: boolean;
|
|
1719
|
+
};
|
|
1720
|
+
/** Voting feature for comments */
|
|
1721
|
+
vote: boolean;
|
|
1722
|
+
/** Downvote button for comments */
|
|
1723
|
+
voteDown: boolean;
|
|
1724
|
+
/** Page Vote Widget */
|
|
1725
|
+
pageVote: {
|
|
1726
|
+
/** Up Vote Button Selector */
|
|
1727
|
+
upBtnEl: string;
|
|
1728
|
+
/** Down Vote Button Selector */
|
|
1729
|
+
downBtnEl: string;
|
|
1730
|
+
/** Up Vote Count Selector */
|
|
1731
|
+
upCountEl: string;
|
|
1732
|
+
/** Down Vote Count Selector */
|
|
1733
|
+
downCountEl: string;
|
|
1734
|
+
/** Active class name if the vote is already cast */
|
|
1735
|
+
activeClass: string;
|
|
1736
|
+
} | boolean;
|
|
1737
|
+
/** Preview feature for comments */
|
|
1738
|
+
preview: boolean;
|
|
1739
|
+
/** Selector for the element binding to the comment count */
|
|
1740
|
+
countEl: string;
|
|
1741
|
+
/** Selector for the element binding to the page views (PV) count */
|
|
1742
|
+
pvEl: string;
|
|
1743
|
+
/** Attribute name for the PageKey in statistics components */
|
|
1744
|
+
statPageKeyAttr: string;
|
|
1745
|
+
/** Dark mode settings */
|
|
1746
|
+
darkMode: boolean | 'auto';
|
|
1747
|
+
/** Request timeout (in seconds) */
|
|
1748
|
+
reqTimeout: number;
|
|
1749
|
+
/** Flat mode for comment display */
|
|
1750
|
+
flatMode: boolean | 'auto';
|
|
1751
|
+
/** Maximum number of levels for nested comments */
|
|
1752
|
+
nestMax: number;
|
|
1753
|
+
/** Sorting order for nested comments */
|
|
1754
|
+
nestSort: 'DATE_ASC' | 'DATE_DESC';
|
|
1755
|
+
/** Display UA badge (user agent badge) */
|
|
1756
|
+
uaBadge: boolean;
|
|
1757
|
+
/** Show sorting dropdown for comment list */
|
|
1758
|
+
listSort: boolean;
|
|
1759
|
+
/** Enable image upload feature */
|
|
1760
|
+
imgUpload: boolean;
|
|
1761
|
+
/** Image uploader function */
|
|
1762
|
+
imgUploader?: (file: File) => Promise<string>;
|
|
1763
|
+
/** Image lazy load mode */
|
|
1764
|
+
imgLazyLoad: false | 'native' | 'data-src';
|
|
1765
|
+
/** Enable version check */
|
|
1766
|
+
versionCheck: boolean;
|
|
1767
|
+
/**
|
|
1768
|
+
* Use remote configuration (from the backend server)
|
|
1769
|
+
*
|
|
1770
|
+
* @deprecated
|
|
1771
|
+
* The `useBackendConf` is always `true` and planned to be removed in the future.
|
|
1772
|
+
*
|
|
1773
|
+
* Please use `preferRemoteConf` to control the priority of the remote and local configuration.
|
|
1774
|
+
*
|
|
1775
|
+
* @default true
|
|
1776
|
+
*/
|
|
1777
|
+
useBackendConf: boolean;
|
|
1778
|
+
/**
|
|
1779
|
+
* Prefer to use the local configuration if available
|
|
1780
|
+
*
|
|
1781
|
+
* @note
|
|
1782
|
+
* If `true`, the local config will be used as a fallback (remote config first).
|
|
1783
|
+
*
|
|
1784
|
+
* If `false`, the local config will override the remote config (local config first).
|
|
1785
|
+
*
|
|
1786
|
+
* @default false
|
|
1787
|
+
*/
|
|
1788
|
+
preferRemoteConf: boolean;
|
|
1789
|
+
/** Localization settings */
|
|
1790
|
+
locale: I18n | string;
|
|
1791
|
+
/** Backend API version (system data, not allowed for user modification) */
|
|
1792
|
+
apiVersion: string;
|
|
1793
|
+
/** URLs for plugin scripts */
|
|
1794
|
+
pluginURLs?: string[];
|
|
1795
|
+
/** Replacers for the marked (Markdown parser) */
|
|
1796
|
+
markedReplacers?: ((raw: string) => string)[];
|
|
1797
|
+
/** Options for the marked (Markdown parser) */
|
|
1798
|
+
markedOptions?: MarkedOptions;
|
|
1799
|
+
/** Modifier for list fetch request parameters */
|
|
1800
|
+
listFetchParamsModifier?: (params: any) => void;
|
|
1801
|
+
/**
|
|
1802
|
+
* Custom date formatter
|
|
1803
|
+
* @param date - The Date object to format
|
|
1804
|
+
* @returns Formatted date string
|
|
1805
|
+
*/
|
|
1806
|
+
dateFormatter?: (date: Date) => string;
|
|
1807
|
+
/** List unread highlight (enable by default in artalk-sidebar) */
|
|
1808
|
+
listUnreadHighlight: boolean;
|
|
1809
|
+
/** The relative element for scrolling (useful if artalk is in a scrollable container) */
|
|
1810
|
+
scrollRelativeTo?: () => HTMLElement;
|
|
1811
|
+
/** Page view increment when comment list is loaded */
|
|
1812
|
+
pvAdd: boolean;
|
|
1813
|
+
/** Immediately fetch comments when Artalk instance is initialized */
|
|
1814
|
+
fetchCommentsOnInit: boolean;
|
|
1815
|
+
/** Callback before submitting a comment */
|
|
1816
|
+
beforeSubmit?: (editor: Editor, next: () => void) => void;
|
|
1702
1817
|
}
|
|
1703
1818
|
|
|
1819
|
+
export declare interface ConfigManager {
|
|
1820
|
+
watchConf: Context['watchConf'];
|
|
1821
|
+
get: () => Config;
|
|
1822
|
+
update: (conf: ConfigPartial) => void;
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1825
|
+
export declare type ConfigPartial = DeepPartial<Config>;
|
|
1826
|
+
|
|
1827
|
+
declare type Constructor<T, S = Services_2, D extends readonly (keyof S)[] = any> = (...args: {
|
|
1828
|
+
[K in keyof D]: D[K] extends keyof S ? S[D[K]] : never;
|
|
1829
|
+
}) => T;
|
|
1830
|
+
|
|
1704
1831
|
declare enum ContentType {
|
|
1705
1832
|
Json = "application/json",
|
|
1833
|
+
JsonApi = "application/vnd.api+json",
|
|
1706
1834
|
FormData = "multipart/form-data",
|
|
1707
1835
|
UrlEncoded = "application/x-www-form-urlencoded",
|
|
1708
1836
|
Text = "text/plain"
|
|
@@ -1711,32 +1839,74 @@ declare enum ContentType {
|
|
|
1711
1839
|
/**
|
|
1712
1840
|
* Artalk Context
|
|
1713
1841
|
*/
|
|
1714
|
-
export declare interface
|
|
1715
|
-
/**
|
|
1716
|
-
|
|
1717
|
-
/**
|
|
1718
|
-
|
|
1719
|
-
/**
|
|
1720
|
-
|
|
1721
|
-
/**
|
|
1722
|
-
|
|
1723
|
-
/**
|
|
1842
|
+
export declare interface Context extends EventManager<EventPayloadMap>, DependencyContainer<Services> {
|
|
1843
|
+
/** @deprecated Use `getData()` or `inject('data')` instead. */
|
|
1844
|
+
readonly data: Services['data'];
|
|
1845
|
+
/** @deprecated Use `getUser()` or `inject('user')` instead. */
|
|
1846
|
+
readonly user: Services['user'];
|
|
1847
|
+
/** @deprecated Use `inject('editor')` instead. */
|
|
1848
|
+
readonly editor: Services['editor'];
|
|
1849
|
+
/** @deprecated Use `inject('list')` instead. */
|
|
1850
|
+
readonly list: Services['list'];
|
|
1851
|
+
/** @deprecated Use `inject('layers')` instead. */
|
|
1852
|
+
readonly layerManager: Services['layers'];
|
|
1853
|
+
/** @deprecated Use `inject('checkers')` instead. */
|
|
1854
|
+
readonly checkerLauncher: Services['checkers'];
|
|
1855
|
+
/** @deprecated Use `inject('sidebar')` instead. */
|
|
1856
|
+
readonly sidebarLayer: Services['sidebar'];
|
|
1857
|
+
/** @deprecated Use `inject('editorPlugs')` instead. */
|
|
1858
|
+
readonly editorPlugs: Services['editorPlugs'];
|
|
1859
|
+
/**
|
|
1860
|
+
* The root element of Artalk
|
|
1861
|
+
*
|
|
1862
|
+
* @deprecated Use `getEl()` instead
|
|
1863
|
+
*/
|
|
1864
|
+
readonly $root: HTMLElement;
|
|
1865
|
+
/** Get the root element */
|
|
1866
|
+
getEl(): HTMLElement;
|
|
1867
|
+
/**
|
|
1868
|
+
* Inject a dependency object
|
|
1869
|
+
*
|
|
1870
|
+
* @deprecated Use `inject()` instead
|
|
1871
|
+
*/
|
|
1872
|
+
get<T extends keyof Services>(key: T): Services[T];
|
|
1873
|
+
/**
|
|
1874
|
+
* Get config object
|
|
1875
|
+
*
|
|
1876
|
+
* @deprecated Use `getConf()` and `updateConf()` instead
|
|
1877
|
+
*/
|
|
1878
|
+
readonly conf: Config;
|
|
1879
|
+
/** Get the config */
|
|
1880
|
+
getConf(): Config;
|
|
1881
|
+
/** Update the config */
|
|
1882
|
+
updateConf(conf: ConfigPartial): void;
|
|
1883
|
+
/** Watch the config */
|
|
1884
|
+
watchConf<T extends (keyof Config)[]>(keys: T, effect: (val: Pick<Config, T[number]>) => void): void;
|
|
1885
|
+
/** Get the marked instance */
|
|
1724
1886
|
getMarked(): Marked | undefined;
|
|
1725
|
-
/**
|
|
1887
|
+
/** Set dark mode */
|
|
1888
|
+
setDarkMode(darkMode: boolean | 'auto'): void;
|
|
1889
|
+
/** Translate i18n message */
|
|
1890
|
+
$t(key: keyof I18n, args?: {
|
|
1891
|
+
[key: string]: string;
|
|
1892
|
+
}): string;
|
|
1893
|
+
/** Get HTTP API client */
|
|
1726
1894
|
getApi(): Api;
|
|
1727
|
-
/** Get API handlers */
|
|
1895
|
+
/** Get HTTP API handlers */
|
|
1728
1896
|
getApiHandlers(): ApiHandlers;
|
|
1729
|
-
/**
|
|
1730
|
-
getData():
|
|
1731
|
-
/**
|
|
1732
|
-
|
|
1733
|
-
/**
|
|
1734
|
-
editComment(commentData: CommentData, $comment: HTMLElement): void;
|
|
1735
|
-
/** 获取评论数据 */
|
|
1897
|
+
/** Get Data Manager */
|
|
1898
|
+
getData(): DataManager;
|
|
1899
|
+
/** Get User Manager */
|
|
1900
|
+
getUser(): UserManager;
|
|
1901
|
+
/** Fetch comments */
|
|
1736
1902
|
fetch(params: Partial<ListFetchParams>): void;
|
|
1737
|
-
/**
|
|
1903
|
+
/** Reload comments */
|
|
1738
1904
|
reload(): void;
|
|
1739
|
-
/**
|
|
1905
|
+
/** Destroy */
|
|
1906
|
+
destroy(): void;
|
|
1907
|
+
/** Whether `destroy()` has been called */
|
|
1908
|
+
isDestroyed(): boolean;
|
|
1909
|
+
/** Goto the first comment of the list */
|
|
1740
1910
|
listGotoFirst(): void;
|
|
1741
1911
|
/** Get the comment data list */
|
|
1742
1912
|
getComments(): CommentData[];
|
|
@@ -1752,39 +1922,32 @@ export declare interface ContextApi extends EventManagerFuncs<EventPayloadMap> {
|
|
|
1752
1922
|
* @deprecated Use `getCommentNodes()` instead
|
|
1753
1923
|
*/
|
|
1754
1924
|
getCommentList(): CommentNode[];
|
|
1755
|
-
/**
|
|
1756
|
-
|
|
1757
|
-
/**
|
|
1758
|
-
|
|
1759
|
-
/**
|
|
1925
|
+
/** Reply to a comment */
|
|
1926
|
+
replyComment(commentData: CommentData, $comment: HTMLElement): void;
|
|
1927
|
+
/** Edit a comment */
|
|
1928
|
+
editComment(commentData: CommentData, $comment: HTMLElement): void;
|
|
1929
|
+
/** Show loading of the editor */
|
|
1760
1930
|
editorShowLoading(): void;
|
|
1761
|
-
/**
|
|
1931
|
+
/** Hide loading of the editor */
|
|
1762
1932
|
editorHideLoading(): void;
|
|
1763
|
-
/**
|
|
1933
|
+
/** Show notify of the editor */
|
|
1764
1934
|
editorShowNotify(msg: string, type: NotifyLevel): void;
|
|
1765
|
-
/**
|
|
1935
|
+
/** Reset the state of the editor */
|
|
1766
1936
|
editorResetState(): void;
|
|
1767
|
-
/**
|
|
1937
|
+
/** Show the sidebar */
|
|
1938
|
+
showSidebar(payload?: SidebarShowPayload): void;
|
|
1939
|
+
/** Hide the sidebar */
|
|
1940
|
+
hideSidebar(): void;
|
|
1941
|
+
/** Check captcha */
|
|
1768
1942
|
checkCaptcha(payload: CheckerCaptchaPayload): Promise<void>;
|
|
1769
|
-
/**
|
|
1943
|
+
/** Check admin */
|
|
1770
1944
|
checkAdmin(payload: CheckerPayload): Promise<void>;
|
|
1771
|
-
/** i18n 翻译 */
|
|
1772
|
-
$t(key: keyof I18n, args?: {
|
|
1773
|
-
[key: string]: string;
|
|
1774
|
-
}): string;
|
|
1775
|
-
/** 设置夜间模式 */
|
|
1776
|
-
setDarkMode(darkMode: boolean | 'auto'): void;
|
|
1777
|
-
/** 获取配置 */
|
|
1778
|
-
getConf(): ArtalkConfig;
|
|
1779
|
-
/** 获取挂载元素 */
|
|
1780
|
-
getEl(): HTMLElement;
|
|
1781
|
-
/** 更新配置 */
|
|
1782
|
-
updateConf(conf: Partial<ArtalkConfig>): void;
|
|
1783
|
-
/** 监听配置更新 */
|
|
1784
|
-
watchConf<T extends (keyof ArtalkConfig)[]>(keys: T, effect: (val: Pick<ArtalkConfig, T[number]>) => void): void;
|
|
1785
1945
|
}
|
|
1786
1946
|
|
|
1787
|
-
|
|
1947
|
+
/** @deprecated Use `Context` instead. */
|
|
1948
|
+
export declare type ContextApi = Context;
|
|
1949
|
+
|
|
1950
|
+
export declare interface DataManager {
|
|
1788
1951
|
getLoading(): boolean;
|
|
1789
1952
|
setLoading(val: boolean): void;
|
|
1790
1953
|
getListLastFetch(): ListLastFetchData | undefined;
|
|
@@ -1803,35 +1966,40 @@ export declare interface DataManagerApi {
|
|
|
1803
1966
|
updatePage(pageData: PageData): void;
|
|
1804
1967
|
}
|
|
1805
1968
|
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
getContentMarked(): string;
|
|
1821
|
-
setContent(val: string): void;
|
|
1822
|
-
insertContent(val: string): void;
|
|
1823
|
-
focus(): void;
|
|
1824
|
-
reset(): void;
|
|
1825
|
-
resetState(): void;
|
|
1826
|
-
setReply(comment: CommentData, $comment: HTMLElement): void;
|
|
1827
|
-
setEditComment(comment: CommentData, $comment: HTMLElement): void;
|
|
1828
|
-
showNotify(msg: string, type: any): void;
|
|
1829
|
-
showLoading(): void;
|
|
1830
|
-
hideLoading(): void;
|
|
1831
|
-
submit(): void;
|
|
1969
|
+
/** @deprecated Use `DataManager` instead. */
|
|
1970
|
+
export declare type DataManagerApi = DataManager;
|
|
1971
|
+
|
|
1972
|
+
declare type DeepPartial<T> = T extends (...args: any[]) => unknown ? T : T extends Element | Date | RegExp ? T : T extends readonly unknown[] ? {
|
|
1973
|
+
[K in keyof T]: DeepPartial<T[K]>;
|
|
1974
|
+
} : T extends object ? {
|
|
1975
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
1976
|
+
} : T;
|
|
1977
|
+
|
|
1978
|
+
export declare const Defaults: Readonly<RequiredExcept<Config, ExcludedKeys>>;
|
|
1979
|
+
|
|
1980
|
+
declare interface DependencyContainer<S = Services_2> {
|
|
1981
|
+
provide<K extends keyof S, T extends S[K] = any, D extends readonly (keyof S)[] = any>(key: K, impl: Constructor<T, S, D>, deps?: D, opts?: ProvideFuncOptions): void;
|
|
1982
|
+
inject<T = undefined, K extends keyof S = any>(key: K): T extends undefined ? S[K] : T;
|
|
1832
1983
|
}
|
|
1833
1984
|
|
|
1834
|
-
export declare interface
|
|
1985
|
+
export declare interface Editor {
|
|
1986
|
+
/**
|
|
1987
|
+
* Get the editor element
|
|
1988
|
+
*
|
|
1989
|
+
* @deprecated Use `getEl()` instead.
|
|
1990
|
+
*/
|
|
1991
|
+
readonly $el: HTMLElement;
|
|
1992
|
+
/**
|
|
1993
|
+
* Get editor options
|
|
1994
|
+
*/
|
|
1995
|
+
getOptions(): EditorOptions;
|
|
1996
|
+
/**
|
|
1997
|
+
* Get the editor element
|
|
1998
|
+
*/
|
|
1999
|
+
getEl(): HTMLElement;
|
|
2000
|
+
/**
|
|
2001
|
+
* Get the editor UI instance
|
|
2002
|
+
*/
|
|
1835
2003
|
getUI(): EditorUI;
|
|
1836
2004
|
/**
|
|
1837
2005
|
* Get the header input elements
|
|
@@ -1896,13 +2064,36 @@ export declare interface EditorApi extends Component {
|
|
|
1896
2064
|
/**
|
|
1897
2065
|
* Start replying a comment
|
|
1898
2066
|
*/
|
|
2067
|
+
setReplyComment(commentData: CommentData, $comment: HTMLElement, scroll?: boolean): void;
|
|
2068
|
+
/**
|
|
2069
|
+
* Start replying to a comment
|
|
2070
|
+
*
|
|
2071
|
+
* @deprecated Use `setReplyComment()` instead.
|
|
2072
|
+
*/
|
|
1899
2073
|
setReply(commentData: CommentData, $comment: HTMLElement, scroll?: boolean): void;
|
|
1900
2074
|
/**
|
|
1901
2075
|
* Start editing a comment
|
|
1902
2076
|
*/
|
|
1903
2077
|
setEditComment(commentData: CommentData, $comment: HTMLElement): void;
|
|
2078
|
+
/**
|
|
2079
|
+
* Get plugin manager
|
|
2080
|
+
*/
|
|
2081
|
+
getPlugins(): PluginManager | undefined;
|
|
2082
|
+
/**
|
|
2083
|
+
* Get plugin manager
|
|
2084
|
+
*
|
|
2085
|
+
* @deprecated Use `getPlugins()` instead.
|
|
2086
|
+
*/
|
|
2087
|
+
getPlugs(): PluginManager | undefined;
|
|
2088
|
+
/**
|
|
2089
|
+
* Set plugin manager
|
|
2090
|
+
*/
|
|
2091
|
+
setPlugins(plugins: PluginManager): void;
|
|
1904
2092
|
}
|
|
1905
2093
|
|
|
2094
|
+
/** @deprecated Use `Editor` instead. */
|
|
2095
|
+
export declare type EditorApi = Editor;
|
|
2096
|
+
|
|
1906
2097
|
declare interface EditorEventPayloadMap {
|
|
1907
2098
|
mounted: undefined;
|
|
1908
2099
|
unmounted: undefined;
|
|
@@ -1915,17 +2106,24 @@ declare interface EditorEventPayloadMap {
|
|
|
1915
2106
|
$input: HTMLInputElement;
|
|
1916
2107
|
};
|
|
1917
2108
|
'content-updated': string;
|
|
1918
|
-
'panel-show':
|
|
1919
|
-
'panel-hide':
|
|
2109
|
+
'panel-show': EditorPlugin;
|
|
2110
|
+
'panel-hide': EditorPlugin;
|
|
1920
2111
|
'panel-close': undefined;
|
|
1921
2112
|
'editor-close': undefined;
|
|
1922
2113
|
'editor-open': undefined;
|
|
2114
|
+
'editor-submit': undefined;
|
|
2115
|
+
'editor-submitted': undefined;
|
|
2116
|
+
}
|
|
2117
|
+
|
|
2118
|
+
declare interface EditorOptions {
|
|
2119
|
+
getEvents: () => EventManager;
|
|
2120
|
+
getConf: () => ConfigManager;
|
|
1923
2121
|
}
|
|
1924
2122
|
|
|
1925
2123
|
/**
|
|
1926
2124
|
* Editor 插件
|
|
1927
2125
|
*/
|
|
1928
|
-
declare class
|
|
2126
|
+
declare class EditorPlugin {
|
|
1929
2127
|
protected kit: PlugKit;
|
|
1930
2128
|
$btn?: HTMLElement;
|
|
1931
2129
|
$panel?: HTMLElement;
|
|
@@ -1947,6 +2145,17 @@ declare class EditorPlug {
|
|
|
1947
2145
|
useEditorStateEffect(stateName: EditorState, effectFn: (comment: CommentData) => () => void): void;
|
|
1948
2146
|
}
|
|
1949
2147
|
|
|
2148
|
+
export declare interface EditorPluginManager {
|
|
2149
|
+
getPlugins: () => EditorPlugin[];
|
|
2150
|
+
getEvents: () => EventManager<EditorEventPayloadMap>;
|
|
2151
|
+
getEditor: () => Editor;
|
|
2152
|
+
getOptions: () => PluginManagerOptions;
|
|
2153
|
+
get<T extends typeof EditorPlugin>(plug: T): InstanceType<T> | undefined;
|
|
2154
|
+
openPluginPanel: (plug: EditorPlugin) => void;
|
|
2155
|
+
closePluginPanel: () => void;
|
|
2156
|
+
getTransformedContent: (rawContent: string) => string;
|
|
2157
|
+
}
|
|
2158
|
+
|
|
1950
2159
|
export declare type EditorState = 'reply' | 'edit' | 'normal';
|
|
1951
2160
|
|
|
1952
2161
|
declare interface EditorUI extends Record<keyof typeof Sel, HTMLElement> {
|
|
@@ -2053,8 +2262,8 @@ declare const en: {
|
|
|
2053
2262
|
accountMergeConfirm: string;
|
|
2054
2263
|
dismiss: string;
|
|
2055
2264
|
merge: string;
|
|
2056
|
-
|
|
2057
|
-
|
|
2265
|
+
client: string;
|
|
2266
|
+
server: string;
|
|
2058
2267
|
loading: string;
|
|
2059
2268
|
loadFail: string;
|
|
2060
2269
|
editing: string;
|
|
@@ -2078,7 +2287,7 @@ declare interface EntityCookedComment {
|
|
|
2078
2287
|
date: string;
|
|
2079
2288
|
email_encrypted: string;
|
|
2080
2289
|
id: number;
|
|
2081
|
-
ip_region
|
|
2290
|
+
ip_region?: string;
|
|
2082
2291
|
is_allow_reply: boolean;
|
|
2083
2292
|
is_collapsed: boolean;
|
|
2084
2293
|
is_pending: boolean;
|
|
@@ -2153,31 +2362,37 @@ declare interface EntityCookedUserForAdmin {
|
|
|
2153
2362
|
receive_email: boolean;
|
|
2154
2363
|
}
|
|
2155
2364
|
|
|
2156
|
-
declare
|
|
2365
|
+
declare interface Event_2<T, K extends keyof T = keyof T> extends EventOptions {
|
|
2366
|
+
name: K;
|
|
2367
|
+
handler: EventHandler<T[K]>;
|
|
2368
|
+
}
|
|
2369
|
+
export { Event_2 as Event }
|
|
2370
|
+
|
|
2371
|
+
export declare type EventHandler<T> = (payload: T) => void;
|
|
2372
|
+
|
|
2373
|
+
export declare interface EventManager<T = EventPayloadMap> {
|
|
2374
|
+
on<K extends keyof T>(name: K, handler: EventHandler<T[K]>, opts?: EventOptions): void;
|
|
2375
|
+
off<K extends keyof T>(name: K, handler: EventHandler<T[K]>): void;
|
|
2376
|
+
trigger<K extends keyof T>(name: K, payload?: T[K]): void;
|
|
2377
|
+
}
|
|
2157
2378
|
|
|
2158
|
-
declare class
|
|
2379
|
+
declare class EventManager_2<T> implements EventManager<T> {
|
|
2159
2380
|
private events;
|
|
2160
2381
|
/**
|
|
2161
2382
|
* Add an event listener for a specific event name
|
|
2162
2383
|
*/
|
|
2163
|
-
on<K extends keyof
|
|
2384
|
+
on<K extends keyof T>(name: K, handler: EventHandler<T[K]>, opts?: EventOptions): void;
|
|
2164
2385
|
/**
|
|
2165
2386
|
* Remove an event listener for a specific event name and handler
|
|
2166
2387
|
*/
|
|
2167
|
-
off<K extends keyof
|
|
2388
|
+
off<K extends keyof T>(name: K, handler: EventHandler<T[K]>): void;
|
|
2168
2389
|
/**
|
|
2169
2390
|
* Trigger an event with an optional payload
|
|
2170
2391
|
*/
|
|
2171
|
-
trigger<K extends keyof
|
|
2392
|
+
trigger<K extends keyof T>(name: K, payload?: T[K]): void;
|
|
2172
2393
|
}
|
|
2173
2394
|
|
|
2174
|
-
declare interface
|
|
2175
|
-
on<K extends keyof PayloadMap>(name: K, handler: EventHandler<PayloadMap[K]>, opts?: EventOptions): void;
|
|
2176
|
-
off<K extends keyof PayloadMap>(name: K, handler: EventHandler<PayloadMap[K]>): void;
|
|
2177
|
-
trigger<K extends keyof PayloadMap>(name: K, payload?: PayloadMap[K]): void;
|
|
2178
|
-
}
|
|
2179
|
-
|
|
2180
|
-
declare interface EventOptions {
|
|
2395
|
+
export declare interface EventOptions {
|
|
2181
2396
|
once?: boolean;
|
|
2182
2397
|
}
|
|
2183
2398
|
|
|
@@ -2185,7 +2400,7 @@ declare interface EventOptions {
|
|
|
2185
2400
|
export declare interface EventPayloadMap {
|
|
2186
2401
|
created: undefined;
|
|
2187
2402
|
mounted: undefined;
|
|
2188
|
-
updated:
|
|
2403
|
+
updated: Config;
|
|
2189
2404
|
unmounted: undefined;
|
|
2190
2405
|
'list-fetch': Partial<ListFetchParams>;
|
|
2191
2406
|
'list-fetched': ListFetchedArgs;
|
|
@@ -2208,6 +2423,8 @@ export declare interface EventPayloadMap {
|
|
|
2208
2423
|
'sidebar-hide': undefined;
|
|
2209
2424
|
}
|
|
2210
2425
|
|
|
2426
|
+
declare type ExcludedKeys = FunctionKeys<Config>;
|
|
2427
|
+
|
|
2211
2428
|
export declare interface FetchError extends Error {
|
|
2212
2429
|
code: number;
|
|
2213
2430
|
message: string;
|
|
@@ -2233,8 +2450,17 @@ declare interface FullRequestParams extends Omit<RequestInit, 'body'> {
|
|
|
2233
2450
|
cancelToken?: CancelToken;
|
|
2234
2451
|
}
|
|
2235
2452
|
|
|
2453
|
+
declare type FunctionKeys<T> = Exclude<{
|
|
2454
|
+
[K in keyof T]: NonNullable<T[K]> extends (...args: any[]) => any ? K : never;
|
|
2455
|
+
}[keyof T], undefined>;
|
|
2456
|
+
|
|
2236
2457
|
declare type HandlerMap = Record<string, any>;
|
|
2237
2458
|
|
|
2459
|
+
declare interface HandlerParamsAuthSSOExchange {
|
|
2460
|
+
/** External IdP access token (e.g. an Auth0 access token) */
|
|
2461
|
+
token: string;
|
|
2462
|
+
}
|
|
2463
|
+
|
|
2238
2464
|
declare interface HandlerParamsCaptchaVerify {
|
|
2239
2465
|
/** The captcha value to check */
|
|
2240
2466
|
value: string;
|
|
@@ -2412,7 +2638,7 @@ declare interface HandlerParamsUserUpdate {
|
|
|
2412
2638
|
receive_email: boolean;
|
|
2413
2639
|
}
|
|
2414
2640
|
|
|
2415
|
-
declare interface
|
|
2641
|
+
declare interface HandlerParamsVoteCreate {
|
|
2416
2642
|
/** The user email */
|
|
2417
2643
|
email?: string;
|
|
2418
2644
|
/** The username */
|
|
@@ -2483,7 +2709,7 @@ declare interface HandlerResponseCommentCreate {
|
|
|
2483
2709
|
date: string;
|
|
2484
2710
|
email_encrypted: string;
|
|
2485
2711
|
id: number;
|
|
2486
|
-
ip_region
|
|
2712
|
+
ip_region?: string;
|
|
2487
2713
|
is_allow_reply: boolean;
|
|
2488
2714
|
is_collapsed: boolean;
|
|
2489
2715
|
is_pending: boolean;
|
|
@@ -2512,7 +2738,7 @@ declare interface HandlerResponseCommentGet {
|
|
|
2512
2738
|
declare interface HandlerResponseCommentList {
|
|
2513
2739
|
comments: EntityCookedComment[];
|
|
2514
2740
|
count: number;
|
|
2515
|
-
page
|
|
2741
|
+
page?: EntityCookedPage;
|
|
2516
2742
|
roots_count: number;
|
|
2517
2743
|
}
|
|
2518
2744
|
|
|
@@ -2524,7 +2750,7 @@ declare interface HandlerResponseCommentUpdate {
|
|
|
2524
2750
|
date: string;
|
|
2525
2751
|
email_encrypted: string;
|
|
2526
2752
|
id: number;
|
|
2527
|
-
ip_region
|
|
2753
|
+
ip_region?: string;
|
|
2528
2754
|
is_allow_reply: boolean;
|
|
2529
2755
|
is_collapsed: boolean;
|
|
2530
2756
|
is_pending: boolean;
|
|
@@ -2545,6 +2771,7 @@ declare interface HandlerResponseCommentUpdate {
|
|
|
2545
2771
|
|
|
2546
2772
|
declare interface HandlerResponseConfAuthProviders {
|
|
2547
2773
|
anonymous: boolean;
|
|
2774
|
+
callback_origin?: string;
|
|
2548
2775
|
providers: AuthAuthProviderInfo[];
|
|
2549
2776
|
}
|
|
2550
2777
|
|
|
@@ -2705,6 +2932,8 @@ declare interface HandlerResponseUserUpdate {
|
|
|
2705
2932
|
|
|
2706
2933
|
declare interface HandlerResponseVote {
|
|
2707
2934
|
down: number;
|
|
2935
|
+
is_down: boolean;
|
|
2936
|
+
is_up: boolean;
|
|
2708
2937
|
up: number;
|
|
2709
2938
|
}
|
|
2710
2939
|
|
|
@@ -2750,54 +2979,21 @@ export declare interface Layer {
|
|
|
2750
2979
|
getEl: () => HTMLElement;
|
|
2751
2980
|
}
|
|
2752
2981
|
|
|
2753
|
-
declare
|
|
2754
|
-
|
|
2755
|
-
private opts;
|
|
2756
|
-
private allowMaskClose;
|
|
2757
|
-
private onAfterHide?;
|
|
2758
|
-
constructor($el: HTMLElement, opts: LayerOptions);
|
|
2759
|
-
setOnAfterHide(func: () => void): void;
|
|
2760
|
-
setAllowMaskClose(allow: boolean): void;
|
|
2761
|
-
getAllowMaskClose(): boolean;
|
|
2762
|
-
getEl(): HTMLElement;
|
|
2763
|
-
show(): void;
|
|
2764
|
-
hide(): void;
|
|
2982
|
+
export declare interface LayerManager {
|
|
2983
|
+
create(name: string, el?: HTMLElement): Layer;
|
|
2765
2984
|
destroy(): void;
|
|
2766
|
-
}
|
|
2767
|
-
|
|
2768
|
-
declare class LayerManager {
|
|
2769
|
-
private wrap;
|
|
2770
|
-
constructor(ctx: ContextApi);
|
|
2771
2985
|
getEl(): HTMLElement;
|
|
2772
|
-
create(name: string, el?: HTMLElement): Layer_2;
|
|
2773
2986
|
}
|
|
2774
2987
|
|
|
2775
|
-
declare
|
|
2776
|
-
onShow: () => void;
|
|
2777
|
-
onHide: () => void;
|
|
2778
|
-
}
|
|
2988
|
+
declare type Lifecycle = 'transient' | 'singleton';
|
|
2779
2989
|
|
|
2780
|
-
declare interface
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
nestMax: number;
|
|
2785
|
-
flatMode: boolean;
|
|
2786
|
-
createCommentNode(comment: CommentData, replyComment?: CommentData): CommentNode;
|
|
2787
|
-
findCommentNode(id: number): CommentNode | undefined;
|
|
2788
|
-
}
|
|
2789
|
-
|
|
2790
|
-
declare class List extends Component {
|
|
2791
|
-
/** 列表评论集区域元素 */
|
|
2792
|
-
$commentsWrap: HTMLElement;
|
|
2793
|
-
getCommentsWrapEl(): HTMLElement;
|
|
2794
|
-
protected commentNodes: CommentNode[];
|
|
2795
|
-
getCommentNodes(): CommentNode[];
|
|
2796
|
-
constructor(ctx: ContextApi);
|
|
2797
|
-
getListLayout({ forceFlatMode }?: {
|
|
2990
|
+
export declare interface List {
|
|
2991
|
+
getEl: () => HTMLElement;
|
|
2992
|
+
getCommentsWrapEl: () => HTMLElement;
|
|
2993
|
+
getLayout: (arg: {
|
|
2798
2994
|
forceFlatMode?: boolean;
|
|
2799
|
-
})
|
|
2800
|
-
|
|
2995
|
+
}) => ListLayout;
|
|
2996
|
+
getCommentNodes: () => CommentNode[];
|
|
2801
2997
|
}
|
|
2802
2998
|
|
|
2803
2999
|
export declare interface ListData {
|
|
@@ -2836,20 +3032,9 @@ export declare interface ListLastFetchData {
|
|
|
2836
3032
|
data?: ListData;
|
|
2837
3033
|
}
|
|
2838
3034
|
|
|
2839
|
-
declare
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
private getStrategy;
|
|
2843
|
-
import(comments: CommentData[]): void;
|
|
2844
|
-
insert(comment: CommentData, replyComment?: CommentData): void;
|
|
2845
|
-
}
|
|
2846
|
-
|
|
2847
|
-
declare namespace ListNest {
|
|
2848
|
-
export {
|
|
2849
|
-
makeNestCommentNodeList,
|
|
2850
|
-
CommentNode_2 as CommentNode,
|
|
2851
|
-
SortByType
|
|
2852
|
-
}
|
|
3035
|
+
export declare interface ListLayout {
|
|
3036
|
+
import: (comments: CommentData[]) => void;
|
|
3037
|
+
insert: (comment: CommentData, replyComment?: CommentData) => void;
|
|
2853
3038
|
}
|
|
2854
3039
|
|
|
2855
3040
|
export declare const loadCountWidget: typeof Artalk.loadCountWidget;
|
|
@@ -2872,8 +3057,6 @@ export declare interface LocalUser {
|
|
|
2872
3057
|
is_admin: boolean;
|
|
2873
3058
|
}
|
|
2874
3059
|
|
|
2875
|
-
declare function makeNestCommentNodeList(srcData: CommentData[], sortBy?: SortByType, nestMax?: number): CommentNode_2[];
|
|
2876
|
-
|
|
2877
3060
|
export declare interface NotifyData {
|
|
2878
3061
|
/** 通知 ID */
|
|
2879
3062
|
id: number;
|
|
@@ -2912,57 +3095,77 @@ export declare interface PageData {
|
|
|
2912
3095
|
|
|
2913
3096
|
declare type PayloadKey = keyof ApiHandlerPayload;
|
|
2914
3097
|
|
|
3098
|
+
declare class PluginManager implements EditorPluginManager {
|
|
3099
|
+
opts: PluginManagerOptions;
|
|
3100
|
+
private plugins;
|
|
3101
|
+
private openedPlug;
|
|
3102
|
+
private events;
|
|
3103
|
+
constructor(opts: PluginManagerOptions);
|
|
3104
|
+
getPlugins(): EditorPlugin[];
|
|
3105
|
+
getEvents(): EventManager_2<EditorEventPayloadMap>;
|
|
3106
|
+
getEditor(): Editor;
|
|
3107
|
+
getOptions(): PluginManagerOptions;
|
|
3108
|
+
private clear;
|
|
3109
|
+
private loadPluginUI;
|
|
3110
|
+
/** Load the plug btn and plug panel on editor ui */
|
|
3111
|
+
private loadPluginItem;
|
|
3112
|
+
get<T extends typeof EditorPlugin>(plug: T): InstanceType<T> | undefined;
|
|
3113
|
+
/** Open the editor plug panel */
|
|
3114
|
+
openPluginPanel(plug: EditorPlugin): void;
|
|
3115
|
+
/** Close the editor plugin panel */
|
|
3116
|
+
closePluginPanel(): void;
|
|
3117
|
+
/** Get the content which is transformed by plugs */
|
|
3118
|
+
getTransformedContent(rawContent: string): string;
|
|
3119
|
+
}
|
|
3120
|
+
|
|
3121
|
+
declare interface PluginManagerOptions {
|
|
3122
|
+
getArtalkRootEl: () => HTMLElement;
|
|
3123
|
+
getEditor: () => Editor;
|
|
3124
|
+
getConf: () => ConfigManager;
|
|
3125
|
+
getUser: () => UserManager;
|
|
3126
|
+
getApi: () => Api;
|
|
3127
|
+
getData: () => DataManager;
|
|
3128
|
+
getCheckers: () => CheckerManager;
|
|
3129
|
+
onSubmitted: () => void;
|
|
3130
|
+
}
|
|
3131
|
+
|
|
2915
3132
|
/**
|
|
2916
3133
|
* PlugKit provides a set of methods to help you develop editor plug
|
|
2917
3134
|
*/
|
|
2918
3135
|
declare class PlugKit {
|
|
2919
|
-
private
|
|
2920
|
-
constructor(
|
|
3136
|
+
private plugins;
|
|
3137
|
+
constructor(plugins: PluginManager);
|
|
2921
3138
|
/** Use the editor */
|
|
2922
|
-
useEditor():
|
|
2923
|
-
/**
|
|
2924
|
-
* Use the context of global
|
|
2925
|
-
*
|
|
2926
|
-
* @deprecated The calls to this function should be reduced as much as possible
|
|
2927
|
-
*/
|
|
2928
|
-
useGlobalCtx(): ContextApi;
|
|
3139
|
+
useEditor(): Editor;
|
|
2929
3140
|
/** Use the config of Artalk */
|
|
2930
|
-
useConf():
|
|
3141
|
+
useConf(): Config;
|
|
2931
3142
|
/** Use the http api client */
|
|
2932
3143
|
useApi(): Api;
|
|
3144
|
+
/** Use the data manager */
|
|
3145
|
+
useData(): DataManager;
|
|
2933
3146
|
/** Use the user manager */
|
|
2934
|
-
useUser():
|
|
3147
|
+
useUser(): UserManager;
|
|
3148
|
+
/** Use the checkers */
|
|
3149
|
+
useCheckers(): CheckerManager;
|
|
2935
3150
|
/** Use the ui of editor */
|
|
2936
3151
|
useUI(): EditorUI;
|
|
2937
3152
|
/** Use the events in editor scope */
|
|
2938
|
-
useEvents():
|
|
3153
|
+
useEvents(): EventManager_2<EditorEventPayloadMap>;
|
|
2939
3154
|
/** Listen the event when plug is mounted */
|
|
2940
3155
|
useMounted(func: () => void): void;
|
|
2941
3156
|
/** Listen the event when plug is unmounted */
|
|
2942
3157
|
useUnmounted(func: () => void): void;
|
|
2943
3158
|
/** Use the deps of other plug */
|
|
2944
|
-
useDeps<T extends typeof
|
|
3159
|
+
useDeps<T extends typeof EditorPlugin>(plug: T): InstanceType<T> | undefined;
|
|
3160
|
+
/** Use the root element of artalk */
|
|
3161
|
+
useArtalkRootEl(): HTMLElement;
|
|
2945
3162
|
}
|
|
2946
3163
|
|
|
2947
|
-
declare
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
getPlugs(): EditorPlug[];
|
|
2953
|
-
getEvents(): EventManager<EditorEventPayloadMap>;
|
|
2954
|
-
private clear;
|
|
2955
|
-
constructor(editor: EditorApi);
|
|
2956
|
-
private loadPluginUI;
|
|
2957
|
-
/** Load the plug btn and plug panel on editor ui */
|
|
2958
|
-
private loadPluginItem;
|
|
2959
|
-
get<T extends typeof EditorPlug>(plug: T): InstanceType<T> | undefined;
|
|
2960
|
-
/** Open the editor plug panel */
|
|
2961
|
-
openPlugPanel(plug: EditorPlug): void;
|
|
2962
|
-
/** Close the editor plug panel */
|
|
2963
|
-
closePlugPanel(): void;
|
|
2964
|
-
/** Get the content which is transformed by plugs */
|
|
2965
|
-
getTransformedContent(rawContent: string): string;
|
|
3164
|
+
declare type PrimitiveKey = string | number | symbol;
|
|
3165
|
+
|
|
3166
|
+
declare interface ProvideFuncOptions {
|
|
3167
|
+
/** Lifecycle (default: 'singleton') */
|
|
3168
|
+
lifecycle?: Lifecycle;
|
|
2966
3169
|
}
|
|
2967
3170
|
|
|
2968
3171
|
declare type QueryParamsType = Record<string | number, any>;
|
|
@@ -3019,6 +3222,8 @@ declare class Render {
|
|
|
3019
3222
|
|
|
3020
3223
|
declare type RequestParams = Omit<FullRequestParams, 'body' | 'method' | 'query' | 'path'>;
|
|
3021
3224
|
|
|
3225
|
+
declare type RequiredExcept<T, K extends keyof T> = Required<Omit<T, K>> & Pick<T, K>;
|
|
3226
|
+
|
|
3022
3227
|
declare type ResponseFormat = keyof Omit<Body, 'body' | 'bodyUsed'>;
|
|
3023
3228
|
|
|
3024
3229
|
declare const Sel: {
|
|
@@ -3037,42 +3242,29 @@ declare const Sel: {
|
|
|
3037
3242
|
$plugPanelWrap: string;
|
|
3038
3243
|
};
|
|
3039
3244
|
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3245
|
+
export declare interface Services {
|
|
3246
|
+
config: ConfigManager;
|
|
3247
|
+
events: EventManager;
|
|
3248
|
+
data: DataManager;
|
|
3249
|
+
api: Api;
|
|
3250
|
+
apiHandlers: ApiHandlers;
|
|
3251
|
+
editor: Editor;
|
|
3252
|
+
editorPlugs: EditorPluginManager | undefined;
|
|
3253
|
+
list: List;
|
|
3254
|
+
sidebar: SidebarLayer;
|
|
3255
|
+
checkers: CheckerManager;
|
|
3256
|
+
layers: LayerManager;
|
|
3257
|
+
user: UserManager;
|
|
3258
|
+
}
|
|
3259
|
+
|
|
3260
|
+
declare type Services_2 = {
|
|
3261
|
+
[key: PrimitiveKey]: any;
|
|
3054
3262
|
};
|
|
3055
3263
|
|
|
3056
|
-
declare
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
$iframeWrap: HTMLElement;
|
|
3061
|
-
$iframe?: HTMLIFrameElement;
|
|
3062
|
-
constructor(ctx: ContextApi);
|
|
3063
|
-
/** Refresh iFrame when show */
|
|
3064
|
-
private refreshWhenShow;
|
|
3065
|
-
/** Animation timer */
|
|
3066
|
-
private animTimer?;
|
|
3067
|
-
/** 显示 */
|
|
3068
|
-
show(conf?: SidebarShowPayload): Promise<void>;
|
|
3069
|
-
/** 隐藏 */
|
|
3070
|
-
hide(): void;
|
|
3071
|
-
private authCheck;
|
|
3072
|
-
private initLayer;
|
|
3073
|
-
private createIframe;
|
|
3074
|
-
private getDarkMode;
|
|
3075
|
-
private iframeLoad;
|
|
3264
|
+
export declare interface SidebarLayer {
|
|
3265
|
+
onUserChanged: () => void;
|
|
3266
|
+
show: (conf?: SidebarShowPayload) => void;
|
|
3267
|
+
hide: () => void;
|
|
3076
3268
|
}
|
|
3077
3269
|
|
|
3078
3270
|
export declare interface SidebarShowPayload {
|
|
@@ -3092,45 +3284,8 @@ export declare interface SiteData {
|
|
|
3092
3284
|
first_url: string;
|
|
3093
3285
|
}
|
|
3094
3286
|
|
|
3095
|
-
declare type SortByType = 'DATE_DESC' | 'DATE_ASC' | 'SRC_INDEX' | 'VOTE_UP_DESC';
|
|
3096
|
-
|
|
3097
|
-
declare type TInjectedServices = {
|
|
3098
|
-
[K in keyof TServiceInjectors]: ReturnType<TServiceInjectors[K]>;
|
|
3099
|
-
};
|
|
3100
|
-
|
|
3101
|
-
declare type TKeysOnlyReturn<T extends TObjectWithFuncs, V> = {
|
|
3102
|
-
[K in keyof T]: ReturnType<T[K]> extends V ? K : never;
|
|
3103
|
-
}[keyof T];
|
|
3104
|
-
|
|
3105
|
-
declare type TObjectWithFuncs = {
|
|
3106
|
-
[k: string]: (...args: any) => any;
|
|
3107
|
-
};
|
|
3108
|
-
|
|
3109
|
-
declare type TOmitConditions = TKeysOnlyReturn<TServiceImps, void>;
|
|
3110
|
-
|
|
3111
|
-
declare type TServiceImps = typeof services;
|
|
3112
|
-
|
|
3113
|
-
declare type TServiceInjectors = Omit<TServiceImps, TOmitConditions>;
|
|
3114
|
-
|
|
3115
3287
|
export declare const use: typeof Artalk.use;
|
|
3116
3288
|
|
|
3117
|
-
declare class User {
|
|
3118
|
-
private opts;
|
|
3119
|
-
private data;
|
|
3120
|
-
constructor(opts: UserOpts);
|
|
3121
|
-
getData(): LocalUser;
|
|
3122
|
-
/** Update user data and save to localStorage */
|
|
3123
|
-
update(obj?: Partial<LocalUser>): void;
|
|
3124
|
-
/**
|
|
3125
|
-
* Logout
|
|
3126
|
-
*
|
|
3127
|
-
* @description Logout will clear login status, but not clear user data (name, email, link)
|
|
3128
|
-
*/
|
|
3129
|
-
logout(): void;
|
|
3130
|
-
/** Check if user has filled basic data */
|
|
3131
|
-
checkHasBasicUserInfo(): boolean;
|
|
3132
|
-
}
|
|
3133
|
-
|
|
3134
3289
|
export declare interface UserData {
|
|
3135
3290
|
/** 用户 ID */
|
|
3136
3291
|
id: number;
|
|
@@ -3168,8 +3323,21 @@ export declare interface UserInfoApiResponseData {
|
|
|
3168
3323
|
notifies_count: number;
|
|
3169
3324
|
}
|
|
3170
3325
|
|
|
3171
|
-
declare interface
|
|
3172
|
-
|
|
3326
|
+
export declare interface UserManager {
|
|
3327
|
+
getGuestToken?: (server: string, create?: boolean) => string | undefined;
|
|
3328
|
+
setGuestToken?: (server: string, token: string) => void;
|
|
3329
|
+
getData: () => LocalUser;
|
|
3330
|
+
update: (dta: Partial<LocalUser>) => void;
|
|
3331
|
+
logout: () => void;
|
|
3332
|
+
checkHasBasicUserInfo: () => boolean;
|
|
3173
3333
|
}
|
|
3174
3334
|
|
|
3175
3335
|
export { }
|
|
3336
|
+
|
|
3337
|
+
|
|
3338
|
+
|
|
3339
|
+
declare global {
|
|
3340
|
+
interface Window {
|
|
3341
|
+
ArtalkPlugins?: { [name: string]: ArtalkPlugin }
|
|
3342
|
+
}
|
|
3343
|
+
}
|