artalk 2.9.0 → 2.10.0
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 -9412
- 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 +3329 -0
- package/dist/ArtalkLite.d.ts +3329 -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 -7351
- 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 +575 -421
- package/dist/main.d.ts +575 -421
- package/package.json +48 -48
package/dist/main.d.cts
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
|
/**
|
|
@@ -828,6 +828,44 @@ declare class Api_2<SecurityDataType extends unknown> extends HttpClient<Securit
|
|
|
828
828
|
msg?: string;
|
|
829
829
|
}>>;
|
|
830
830
|
};
|
|
831
|
+
sso: {
|
|
832
|
+
/**
|
|
833
|
+
* @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.
|
|
834
|
+
*
|
|
835
|
+
* @tags Auth
|
|
836
|
+
* @name AuthSsoExchange
|
|
837
|
+
* @summary Exchange an external IdP access token for an Artalk JWT
|
|
838
|
+
* @request POST:/sso/exchange
|
|
839
|
+
* @response `200` `HandlerResponseUserLogin` OK
|
|
840
|
+
* @response `400` `(HandlerMap & {
|
|
841
|
+
msg?: string,
|
|
842
|
+
|
|
843
|
+
})` Bad Request
|
|
844
|
+
* @response `401` `(HandlerMap & {
|
|
845
|
+
msg?: string,
|
|
846
|
+
|
|
847
|
+
})` Unauthorized
|
|
848
|
+
* @response `404` `(HandlerMap & {
|
|
849
|
+
msg?: string,
|
|
850
|
+
|
|
851
|
+
})` Not Found
|
|
852
|
+
* @response `500` `(HandlerMap & {
|
|
853
|
+
msg?: string,
|
|
854
|
+
|
|
855
|
+
})` Internal Server Error
|
|
856
|
+
* @response `502` `(HandlerMap & {
|
|
857
|
+
msg?: string,
|
|
858
|
+
|
|
859
|
+
})` Bad Gateway
|
|
860
|
+
* @response `503` `(HandlerMap & {
|
|
861
|
+
msg?: string,
|
|
862
|
+
|
|
863
|
+
})` Service Unavailable
|
|
864
|
+
*/
|
|
865
|
+
authSsoExchange: (body: HandlerParamsAuthSSOExchange, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUserLogin, HandlerMap & {
|
|
866
|
+
msg?: string;
|
|
867
|
+
}>>;
|
|
868
|
+
};
|
|
831
869
|
stats: {
|
|
832
870
|
/**
|
|
833
871
|
* @description Get the statistics of various data analysis
|
|
@@ -1186,12 +1224,40 @@ declare class Api_2<SecurityDataType extends unknown> extends HttpClient<Securit
|
|
|
1186
1224
|
msg?: string;
|
|
1187
1225
|
}>>;
|
|
1188
1226
|
/**
|
|
1189
|
-
* @description
|
|
1227
|
+
* @description Get vote status for a specific comment or page
|
|
1228
|
+
*
|
|
1229
|
+
* @tags Vote
|
|
1230
|
+
* @name GetVote
|
|
1231
|
+
* @summary Get Vote Status
|
|
1232
|
+
* @request GET:/votes/{target_name}/{target_id}
|
|
1233
|
+
* @response `200` `HandlerResponseVote` OK
|
|
1234
|
+
* @response `400` `(HandlerMap & {
|
|
1235
|
+
msg?: string,
|
|
1236
|
+
|
|
1237
|
+
})` Bad Request
|
|
1238
|
+
* @response `403` `(HandlerMap & {
|
|
1239
|
+
msg?: string,
|
|
1240
|
+
|
|
1241
|
+
})` Forbidden
|
|
1242
|
+
* @response `404` `(HandlerMap & {
|
|
1243
|
+
msg?: string,
|
|
1244
|
+
|
|
1245
|
+
})` Not Found
|
|
1246
|
+
* @response `500` `(HandlerMap & {
|
|
1247
|
+
msg?: string,
|
|
1248
|
+
|
|
1249
|
+
})` Internal Server Error
|
|
1250
|
+
*/
|
|
1251
|
+
getVote: (targetName: "comment" | "page", targetId: number, params?: RequestParams) => Promise<HttpResponse<HandlerResponseVote, HandlerMap & {
|
|
1252
|
+
msg?: string;
|
|
1253
|
+
}>>;
|
|
1254
|
+
/**
|
|
1255
|
+
* @description Create a new vote for a specific comment or page
|
|
1190
1256
|
*
|
|
1191
1257
|
* @tags Vote
|
|
1192
|
-
* @name
|
|
1193
|
-
* @summary Vote
|
|
1194
|
-
* @request POST:/votes/{
|
|
1258
|
+
* @name CreateVote
|
|
1259
|
+
* @summary Create Vote
|
|
1260
|
+
* @request POST:/votes/{target_name}/{target_id}/{choice}
|
|
1195
1261
|
* @response `200` `HandlerResponseVote` OK
|
|
1196
1262
|
* @response `403` `(HandlerMap & {
|
|
1197
1263
|
msg?: string,
|
|
@@ -1206,7 +1272,7 @@ declare class Api_2<SecurityDataType extends unknown> extends HttpClient<Securit
|
|
|
1206
1272
|
|
|
1207
1273
|
})` Internal Server Error
|
|
1208
1274
|
*/
|
|
1209
|
-
|
|
1275
|
+
createVote: (targetName: "comment" | "page", targetId: number, choice: "up" | "down", vote: HandlerParamsVoteCreate, params?: RequestParams) => Promise<HttpResponse<HandlerResponseVote, HandlerMap & {
|
|
1210
1276
|
msg?: string;
|
|
1211
1277
|
}>>;
|
|
1212
1278
|
};
|
|
@@ -1233,7 +1299,7 @@ declare interface ApiHandlerPayload {
|
|
|
1233
1299
|
need_auth_login: object;
|
|
1234
1300
|
}
|
|
1235
1301
|
|
|
1236
|
-
declare interface ApiHandlers {
|
|
1302
|
+
export declare interface ApiHandlers {
|
|
1237
1303
|
add: <T extends PayloadKey>(action: T, handler: (data: ApiHandlerPayload[T]) => Promise<void>) => void;
|
|
1238
1304
|
remove: (action: PayloadKey) => void;
|
|
1239
1305
|
get: () => ApiHandler[];
|
|
@@ -1268,14 +1334,14 @@ export declare interface ApiVersionData {
|
|
|
1268
1334
|
* @see https://artalk.js.org
|
|
1269
1335
|
*/
|
|
1270
1336
|
declare class Artalk {
|
|
1271
|
-
ctx:
|
|
1272
|
-
constructor(conf:
|
|
1337
|
+
ctx: Context;
|
|
1338
|
+
constructor(conf: ConfigPartial);
|
|
1273
1339
|
/** Get the config of Artalk */
|
|
1274
|
-
getConf():
|
|
1340
|
+
getConf(): Config;
|
|
1275
1341
|
/** Get the root element of Artalk */
|
|
1276
1342
|
getEl(): HTMLElement;
|
|
1277
1343
|
/** Update config of Artalk */
|
|
1278
|
-
update(conf:
|
|
1344
|
+
update(conf: ConfigPartial): void;
|
|
1279
1345
|
/** Reload comment list of Artalk */
|
|
1280
1346
|
reload(): void;
|
|
1281
1347
|
/** Destroy instance of Artalk */
|
|
@@ -1289,135 +1355,32 @@ declare class Artalk {
|
|
|
1289
1355
|
/** Set dark mode */
|
|
1290
1356
|
setDarkMode(darkMode: boolean): void;
|
|
1291
1357
|
/** Init Artalk */
|
|
1292
|
-
static init(conf:
|
|
1358
|
+
static init(conf: ConfigPartial): Artalk;
|
|
1293
1359
|
/** Use plugin, the plugin will be used when Artalk.init */
|
|
1294
1360
|
static use<T = any>(plugin: ArtalkPlugin<T>, options?: T): void;
|
|
1295
1361
|
/** Load count widget */
|
|
1296
|
-
static loadCountWidget(c:
|
|
1362
|
+
static loadCountWidget(c: ConfigPartial): void;
|
|
1297
1363
|
/** @deprecated Please use `getEl()` instead */
|
|
1298
1364
|
get $root(): HTMLElement;
|
|
1299
1365
|
/** @description Please use `getConf()` instead */
|
|
1300
|
-
get conf():
|
|
1366
|
+
get conf(): Config;
|
|
1301
1367
|
}
|
|
1302
1368
|
export default Artalk;
|
|
1303
1369
|
|
|
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
|
-
}
|
|
1370
|
+
export declare type ArtalkConfig = Config;
|
|
1412
1371
|
|
|
1413
|
-
export declare type ArtalkPlugin<T = any> = (ctx:
|
|
1372
|
+
export declare type ArtalkPlugin<T = any> = (ctx: Context, options?: T) => void;
|
|
1414
1373
|
|
|
1415
1374
|
declare namespace ArtalkType {
|
|
1416
1375
|
export {
|
|
1417
1376
|
I18n,
|
|
1418
1377
|
I18nKeys,
|
|
1378
|
+
Api,
|
|
1379
|
+
ApiHandlers,
|
|
1380
|
+
Config,
|
|
1381
|
+
ConfigPartial,
|
|
1419
1382
|
ArtalkConfig,
|
|
1420
|
-
|
|
1383
|
+
ConfigManager,
|
|
1421
1384
|
CommentData,
|
|
1422
1385
|
ListData,
|
|
1423
1386
|
PageData,
|
|
@@ -1430,19 +1393,35 @@ declare namespace ArtalkType {
|
|
|
1430
1393
|
ApiVersionData,
|
|
1431
1394
|
ListFetchParams,
|
|
1432
1395
|
ListLastFetchData,
|
|
1396
|
+
DataManager,
|
|
1433
1397
|
DataManagerApi,
|
|
1434
1398
|
NotifyLevel,
|
|
1435
1399
|
UserInfoApiResponseData,
|
|
1436
1400
|
FetchError,
|
|
1401
|
+
Context,
|
|
1437
1402
|
ContextApi,
|
|
1403
|
+
LocalUser,
|
|
1404
|
+
UserManager,
|
|
1405
|
+
List,
|
|
1406
|
+
ListLayout,
|
|
1438
1407
|
EditorState,
|
|
1408
|
+
Editor,
|
|
1439
1409
|
EditorApi,
|
|
1410
|
+
EditorPluginManager,
|
|
1440
1411
|
ListErrorData,
|
|
1441
1412
|
ListFetchedArgs,
|
|
1442
1413
|
EventPayloadMap,
|
|
1414
|
+
EventHandler,
|
|
1415
|
+
Event_2 as Event,
|
|
1416
|
+
EventOptions,
|
|
1417
|
+
EventManager,
|
|
1443
1418
|
ArtalkPlugin,
|
|
1419
|
+
SidebarLayer,
|
|
1444
1420
|
SidebarShowPayload,
|
|
1445
|
-
Layer
|
|
1421
|
+
Layer,
|
|
1422
|
+
LayerManager,
|
|
1423
|
+
CheckerManager,
|
|
1424
|
+
Services
|
|
1446
1425
|
}
|
|
1447
1426
|
}
|
|
1448
1427
|
export { ArtalkType }
|
|
@@ -1475,30 +1454,26 @@ declare interface CheckerCtx {
|
|
|
1475
1454
|
set<K extends keyof CheckerStore>(key: K, val: CheckerStore[K]): void;
|
|
1476
1455
|
getOpts(): CheckerLauncherOptions;
|
|
1477
1456
|
getApi(): Api;
|
|
1478
|
-
getUser():
|
|
1457
|
+
getUser(): UserManager;
|
|
1479
1458
|
hideInteractInput(): void;
|
|
1480
1459
|
triggerSuccess(): void;
|
|
1481
1460
|
cancel(): void;
|
|
1482
1461
|
}
|
|
1483
1462
|
|
|
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
1463
|
declare interface CheckerLauncherOptions {
|
|
1496
|
-
getCtx: () => ContextApi;
|
|
1497
1464
|
getApi: () => Api;
|
|
1465
|
+
getLayers: () => LayerManager;
|
|
1466
|
+
getUser: () => UserManager;
|
|
1498
1467
|
getCaptchaIframeURL: () => string;
|
|
1499
1468
|
onReload: () => void;
|
|
1500
1469
|
}
|
|
1501
1470
|
|
|
1471
|
+
export declare interface CheckerManager {
|
|
1472
|
+
checkCaptcha: (payload: CheckerCaptchaPayload) => Promise<void>;
|
|
1473
|
+
checkAdmin: (payload: CheckerPayload) => Promise<void>;
|
|
1474
|
+
check: (checker: Checker, payload: CheckerPayload, beforeCheck?: (c: CheckerCtx) => void) => void;
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1502
1477
|
declare interface CheckerPayload {
|
|
1503
1478
|
onSuccess?: () => void;
|
|
1504
1479
|
onMount?: (dialogEl: HTMLElement) => void;
|
|
@@ -1518,7 +1493,7 @@ declare class CommentActions {
|
|
|
1518
1493
|
private getApi;
|
|
1519
1494
|
constructor(comment: CommentNode);
|
|
1520
1495
|
/** 投票操作 */
|
|
1521
|
-
vote(
|
|
1496
|
+
vote(choice: 'up' | 'down'): void;
|
|
1522
1497
|
/** 管理员 - 评论状态修改 */
|
|
1523
1498
|
adminEdit(type: 'collapsed' | 'pending' | 'pinned', btnElem: ActionBtn): void;
|
|
1524
1499
|
/** 管理员 - 评论删除 */
|
|
@@ -1645,14 +1620,6 @@ declare class CommentNode {
|
|
|
1645
1620
|
getOpts(): CommentOptions;
|
|
1646
1621
|
}
|
|
1647
1622
|
|
|
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
1623
|
declare interface CommentOptions {
|
|
1657
1624
|
onAfterRender?: () => void;
|
|
1658
1625
|
onDelete?: (c: CommentNode) => void;
|
|
@@ -1663,14 +1630,14 @@ declare interface CommentOptions {
|
|
|
1663
1630
|
voteDown: boolean;
|
|
1664
1631
|
uaBadge: boolean;
|
|
1665
1632
|
nestMax: number;
|
|
1666
|
-
gravatar:
|
|
1667
|
-
heightLimit:
|
|
1668
|
-
avatarURLBuilder:
|
|
1669
|
-
scrollRelativeTo:
|
|
1670
|
-
dateFormatter:
|
|
1633
|
+
gravatar: Config['gravatar'];
|
|
1634
|
+
heightLimit: Config['heightLimit'];
|
|
1635
|
+
avatarURLBuilder: Config['avatarURLBuilder'];
|
|
1636
|
+
scrollRelativeTo: Config['scrollRelativeTo'];
|
|
1637
|
+
dateFormatter: Config['dateFormatter'];
|
|
1671
1638
|
getApi: () => Api;
|
|
1672
|
-
replyComment:
|
|
1673
|
-
editComment:
|
|
1639
|
+
replyComment: Context['replyComment'];
|
|
1640
|
+
editComment: Context['editComment'];
|
|
1674
1641
|
}
|
|
1675
1642
|
|
|
1676
1643
|
declare interface CommonApiVersionData {
|
|
@@ -1686,23 +1653,175 @@ declare interface CommonConfData {
|
|
|
1686
1653
|
|
|
1687
1654
|
declare interface CommonJSONResult {
|
|
1688
1655
|
/** Data */
|
|
1689
|
-
data
|
|
1656
|
+
data?: any;
|
|
1690
1657
|
/** Message */
|
|
1691
|
-
msg
|
|
1658
|
+
msg?: string;
|
|
1692
1659
|
}
|
|
1693
1660
|
|
|
1694
1661
|
declare type CommonMap = Record<string, any>;
|
|
1695
1662
|
|
|
1696
|
-
declare
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1663
|
+
export declare interface Config {
|
|
1664
|
+
/** Element selector or Element to mount the Artalk */
|
|
1665
|
+
el: string | HTMLElement;
|
|
1666
|
+
/** Unique page identifier */
|
|
1667
|
+
pageKey: string;
|
|
1668
|
+
/** Title of the page */
|
|
1669
|
+
pageTitle: string;
|
|
1670
|
+
/** Server address */
|
|
1671
|
+
server: string;
|
|
1672
|
+
/** Site name */
|
|
1673
|
+
site: string;
|
|
1674
|
+
/** Placeholder text for the comment input box */
|
|
1675
|
+
placeholder: string;
|
|
1676
|
+
/** Text to display when there are no comments */
|
|
1677
|
+
noComment: string;
|
|
1678
|
+
/** Text for the send button */
|
|
1679
|
+
sendBtn: string;
|
|
1680
|
+
/** Movable comment box (display below the comment to be replied) */
|
|
1681
|
+
editorTravel: boolean;
|
|
1682
|
+
/** Emoticons settings */
|
|
1683
|
+
emoticons: object | any[] | string | false;
|
|
1684
|
+
/** Gravatar avatar settings */
|
|
1685
|
+
gravatar: {
|
|
1686
|
+
/** API endpoint */
|
|
1687
|
+
mirror: string;
|
|
1688
|
+
/** API parameters */
|
|
1689
|
+
params: string;
|
|
1690
|
+
};
|
|
1691
|
+
/** Avatar URL generator function */
|
|
1692
|
+
avatarURLBuilder?: (comment: CommentData) => string;
|
|
1693
|
+
/** Pagination settings */
|
|
1694
|
+
pagination: {
|
|
1695
|
+
/** Number of comments to fetch per request */
|
|
1696
|
+
pageSize: number;
|
|
1697
|
+
/** "Read more" mode */
|
|
1698
|
+
readMore: boolean;
|
|
1699
|
+
/** Automatically load more comments when scrolled to the bottom */
|
|
1700
|
+
autoLoad: boolean;
|
|
1701
|
+
};
|
|
1702
|
+
/** Height limit configuration */
|
|
1703
|
+
heightLimit: {
|
|
1704
|
+
/** Maximum height for comment content */
|
|
1705
|
+
content: number;
|
|
1706
|
+
/** Maximum height for child comments */
|
|
1707
|
+
children: number;
|
|
1708
|
+
/** Whether the content is scrollable */
|
|
1709
|
+
scrollable: boolean;
|
|
1710
|
+
};
|
|
1711
|
+
/** Voting feature for comments */
|
|
1712
|
+
vote: boolean;
|
|
1713
|
+
/** Downvote button for comments */
|
|
1714
|
+
voteDown: boolean;
|
|
1715
|
+
/** Page Vote Widget */
|
|
1716
|
+
pageVote: {
|
|
1717
|
+
/** Up Vote Button Selector */
|
|
1718
|
+
upBtnEl: string;
|
|
1719
|
+
/** Down Vote Button Selector */
|
|
1720
|
+
downBtnEl: string;
|
|
1721
|
+
/** Up Vote Count Selector */
|
|
1722
|
+
upCountEl: string;
|
|
1723
|
+
/** Down Vote Count Selector */
|
|
1724
|
+
downCountEl: string;
|
|
1725
|
+
/** Active class name if the vote is already cast */
|
|
1726
|
+
activeClass: string;
|
|
1727
|
+
} | boolean;
|
|
1728
|
+
/** Preview feature for comments */
|
|
1729
|
+
preview: boolean;
|
|
1730
|
+
/** Selector for the element binding to the comment count */
|
|
1731
|
+
countEl: string;
|
|
1732
|
+
/** Selector for the element binding to the page views (PV) count */
|
|
1733
|
+
pvEl: string;
|
|
1734
|
+
/** Attribute name for the PageKey in statistics components */
|
|
1735
|
+
statPageKeyAttr: string;
|
|
1736
|
+
/** Dark mode settings */
|
|
1737
|
+
darkMode: boolean | 'auto';
|
|
1738
|
+
/** Request timeout (in seconds) */
|
|
1739
|
+
reqTimeout: number;
|
|
1740
|
+
/** Flat mode for comment display */
|
|
1741
|
+
flatMode: boolean | 'auto';
|
|
1742
|
+
/** Maximum number of levels for nested comments */
|
|
1743
|
+
nestMax: number;
|
|
1744
|
+
/** Sorting order for nested comments */
|
|
1745
|
+
nestSort: 'DATE_ASC' | 'DATE_DESC';
|
|
1746
|
+
/** Display UA badge (user agent badge) */
|
|
1747
|
+
uaBadge: boolean;
|
|
1748
|
+
/** Show sorting dropdown for comment list */
|
|
1749
|
+
listSort: boolean;
|
|
1750
|
+
/** Enable image upload feature */
|
|
1751
|
+
imgUpload: boolean;
|
|
1752
|
+
/** Image uploader function */
|
|
1753
|
+
imgUploader?: (file: File) => Promise<string>;
|
|
1754
|
+
/** Image lazy load mode */
|
|
1755
|
+
imgLazyLoad: false | 'native' | 'data-src';
|
|
1756
|
+
/** Enable version check */
|
|
1757
|
+
versionCheck: boolean;
|
|
1758
|
+
/**
|
|
1759
|
+
* Use remote configuration (from the backend server)
|
|
1760
|
+
*
|
|
1761
|
+
* @deprecated
|
|
1762
|
+
* The `useBackendConf` is always `true` and planned to be removed in the future.
|
|
1763
|
+
*
|
|
1764
|
+
* Please use `preferRemoteConf` to control the priority of the remote and local configuration.
|
|
1765
|
+
*
|
|
1766
|
+
* @default true
|
|
1767
|
+
*/
|
|
1768
|
+
useBackendConf: boolean;
|
|
1769
|
+
/**
|
|
1770
|
+
* Prefer to use the local configuration if available
|
|
1771
|
+
*
|
|
1772
|
+
* @note
|
|
1773
|
+
* If `true`, the local config will be used as a fallback (remote config first).
|
|
1774
|
+
*
|
|
1775
|
+
* If `false`, the local config will override the remote config (local config first).
|
|
1776
|
+
*
|
|
1777
|
+
* @default false
|
|
1778
|
+
*/
|
|
1779
|
+
preferRemoteConf: boolean;
|
|
1780
|
+
/** Localization settings */
|
|
1781
|
+
locale: I18n | string;
|
|
1782
|
+
/** Backend API version (system data, not allowed for user modification) */
|
|
1783
|
+
apiVersion: string;
|
|
1784
|
+
/** URLs for plugin scripts */
|
|
1785
|
+
pluginURLs?: string[];
|
|
1786
|
+
/** Replacers for the marked (Markdown parser) */
|
|
1787
|
+
markedReplacers?: ((raw: string) => string)[];
|
|
1788
|
+
/** Options for the marked (Markdown parser) */
|
|
1789
|
+
markedOptions?: MarkedOptions;
|
|
1790
|
+
/** Modifier for list fetch request parameters */
|
|
1791
|
+
listFetchParamsModifier?: (params: any) => void;
|
|
1792
|
+
/**
|
|
1793
|
+
* Custom date formatter
|
|
1794
|
+
* @param date - The Date object to format
|
|
1795
|
+
* @returns Formatted date string
|
|
1796
|
+
*/
|
|
1797
|
+
dateFormatter?: (date: Date) => string;
|
|
1798
|
+
/** List unread highlight (enable by default in artalk-sidebar) */
|
|
1799
|
+
listUnreadHighlight: boolean;
|
|
1800
|
+
/** The relative element for scrolling (useful if artalk is in a scrollable container) */
|
|
1801
|
+
scrollRelativeTo?: () => HTMLElement;
|
|
1802
|
+
/** Page view increment when comment list is loaded */
|
|
1803
|
+
pvAdd: boolean;
|
|
1804
|
+
/** Immediately fetch comments when Artalk instance is initialized */
|
|
1805
|
+
fetchCommentsOnInit: boolean;
|
|
1806
|
+
/** Callback before submitting a comment */
|
|
1807
|
+
beforeSubmit?: (editor: Editor, next: () => void) => void;
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
export declare interface ConfigManager {
|
|
1811
|
+
watchConf: Context['watchConf'];
|
|
1812
|
+
get: () => Config;
|
|
1813
|
+
update: (conf: ConfigPartial) => void;
|
|
1702
1814
|
}
|
|
1703
1815
|
|
|
1816
|
+
export declare type ConfigPartial = DeepPartial<Config>;
|
|
1817
|
+
|
|
1818
|
+
declare type Constructor<T, S = Services_2, D extends readonly (keyof S)[] = any> = (...args: {
|
|
1819
|
+
[K in keyof D]: D[K] extends keyof S ? S[D[K]] : never;
|
|
1820
|
+
}) => T;
|
|
1821
|
+
|
|
1704
1822
|
declare enum ContentType {
|
|
1705
1823
|
Json = "application/json",
|
|
1824
|
+
JsonApi = "application/vnd.api+json",
|
|
1706
1825
|
FormData = "multipart/form-data",
|
|
1707
1826
|
UrlEncoded = "application/x-www-form-urlencoded",
|
|
1708
1827
|
Text = "text/plain"
|
|
@@ -1711,32 +1830,72 @@ declare enum ContentType {
|
|
|
1711
1830
|
/**
|
|
1712
1831
|
* Artalk Context
|
|
1713
1832
|
*/
|
|
1714
|
-
export declare interface
|
|
1715
|
-
/**
|
|
1716
|
-
|
|
1717
|
-
/**
|
|
1718
|
-
|
|
1719
|
-
/**
|
|
1720
|
-
|
|
1721
|
-
/**
|
|
1722
|
-
|
|
1723
|
-
/**
|
|
1833
|
+
export declare interface Context extends EventManager<EventPayloadMap>, DependencyContainer<Services> {
|
|
1834
|
+
/** @deprecated Use `getData()` or `inject('data')` instead. */
|
|
1835
|
+
readonly data: Services['data'];
|
|
1836
|
+
/** @deprecated Use `getUser()` or `inject('user')` instead. */
|
|
1837
|
+
readonly user: Services['user'];
|
|
1838
|
+
/** @deprecated Use `inject('editor')` instead. */
|
|
1839
|
+
readonly editor: Services['editor'];
|
|
1840
|
+
/** @deprecated Use `inject('list')` instead. */
|
|
1841
|
+
readonly list: Services['list'];
|
|
1842
|
+
/** @deprecated Use `inject('layers')` instead. */
|
|
1843
|
+
readonly layerManager: Services['layers'];
|
|
1844
|
+
/** @deprecated Use `inject('checkers')` instead. */
|
|
1845
|
+
readonly checkerLauncher: Services['checkers'];
|
|
1846
|
+
/** @deprecated Use `inject('sidebar')` instead. */
|
|
1847
|
+
readonly sidebarLayer: Services['sidebar'];
|
|
1848
|
+
/** @deprecated Use `inject('editorPlugs')` instead. */
|
|
1849
|
+
readonly editorPlugs: Services['editorPlugs'];
|
|
1850
|
+
/**
|
|
1851
|
+
* The root element of Artalk
|
|
1852
|
+
*
|
|
1853
|
+
* @deprecated Use `getEl()` instead
|
|
1854
|
+
*/
|
|
1855
|
+
readonly $root: HTMLElement;
|
|
1856
|
+
/** Get the root element */
|
|
1857
|
+
getEl(): HTMLElement;
|
|
1858
|
+
/**
|
|
1859
|
+
* Inject a dependency object
|
|
1860
|
+
*
|
|
1861
|
+
* @deprecated Use `inject()` instead
|
|
1862
|
+
*/
|
|
1863
|
+
get<T extends keyof Services>(key: T): Services[T];
|
|
1864
|
+
/**
|
|
1865
|
+
* Get config object
|
|
1866
|
+
*
|
|
1867
|
+
* @deprecated Use `getConf()` and `updateConf()` instead
|
|
1868
|
+
*/
|
|
1869
|
+
readonly conf: Config;
|
|
1870
|
+
/** Get the config */
|
|
1871
|
+
getConf(): Config;
|
|
1872
|
+
/** Update the config */
|
|
1873
|
+
updateConf(conf: ConfigPartial): void;
|
|
1874
|
+
/** Watch the config */
|
|
1875
|
+
watchConf<T extends (keyof Config)[]>(keys: T, effect: (val: Pick<Config, T[number]>) => void): void;
|
|
1876
|
+
/** Get the marked instance */
|
|
1724
1877
|
getMarked(): Marked | undefined;
|
|
1725
|
-
/**
|
|
1878
|
+
/** Set dark mode */
|
|
1879
|
+
setDarkMode(darkMode: boolean | 'auto'): void;
|
|
1880
|
+
/** Translate i18n message */
|
|
1881
|
+
$t(key: keyof I18n, args?: {
|
|
1882
|
+
[key: string]: string;
|
|
1883
|
+
}): string;
|
|
1884
|
+
/** Get HTTP API client */
|
|
1726
1885
|
getApi(): Api;
|
|
1727
|
-
/** Get API handlers */
|
|
1886
|
+
/** Get HTTP API handlers */
|
|
1728
1887
|
getApiHandlers(): ApiHandlers;
|
|
1729
|
-
/**
|
|
1730
|
-
getData():
|
|
1731
|
-
/**
|
|
1732
|
-
|
|
1733
|
-
/**
|
|
1734
|
-
editComment(commentData: CommentData, $comment: HTMLElement): void;
|
|
1735
|
-
/** 获取评论数据 */
|
|
1888
|
+
/** Get Data Manager */
|
|
1889
|
+
getData(): DataManager;
|
|
1890
|
+
/** Get User Manager */
|
|
1891
|
+
getUser(): UserManager;
|
|
1892
|
+
/** Fetch comments */
|
|
1736
1893
|
fetch(params: Partial<ListFetchParams>): void;
|
|
1737
|
-
/**
|
|
1894
|
+
/** Reload comments */
|
|
1738
1895
|
reload(): void;
|
|
1739
|
-
/**
|
|
1896
|
+
/** Destroy */
|
|
1897
|
+
destroy(): void;
|
|
1898
|
+
/** Goto the first comment of the list */
|
|
1740
1899
|
listGotoFirst(): void;
|
|
1741
1900
|
/** Get the comment data list */
|
|
1742
1901
|
getComments(): CommentData[];
|
|
@@ -1752,39 +1911,32 @@ export declare interface ContextApi extends EventManagerFuncs<EventPayloadMap> {
|
|
|
1752
1911
|
* @deprecated Use `getCommentNodes()` instead
|
|
1753
1912
|
*/
|
|
1754
1913
|
getCommentList(): CommentNode[];
|
|
1755
|
-
/**
|
|
1756
|
-
|
|
1757
|
-
/**
|
|
1758
|
-
|
|
1759
|
-
/**
|
|
1914
|
+
/** Reply to a comment */
|
|
1915
|
+
replyComment(commentData: CommentData, $comment: HTMLElement): void;
|
|
1916
|
+
/** Edit a comment */
|
|
1917
|
+
editComment(commentData: CommentData, $comment: HTMLElement): void;
|
|
1918
|
+
/** Show loading of the editor */
|
|
1760
1919
|
editorShowLoading(): void;
|
|
1761
|
-
/**
|
|
1920
|
+
/** Hide loading of the editor */
|
|
1762
1921
|
editorHideLoading(): void;
|
|
1763
|
-
/**
|
|
1922
|
+
/** Show notify of the editor */
|
|
1764
1923
|
editorShowNotify(msg: string, type: NotifyLevel): void;
|
|
1765
|
-
/**
|
|
1924
|
+
/** Reset the state of the editor */
|
|
1766
1925
|
editorResetState(): void;
|
|
1767
|
-
/**
|
|
1926
|
+
/** Show the sidebar */
|
|
1927
|
+
showSidebar(payload?: SidebarShowPayload): void;
|
|
1928
|
+
/** Hide the sidebar */
|
|
1929
|
+
hideSidebar(): void;
|
|
1930
|
+
/** Check captcha */
|
|
1768
1931
|
checkCaptcha(payload: CheckerCaptchaPayload): Promise<void>;
|
|
1769
|
-
/**
|
|
1932
|
+
/** Check admin */
|
|
1770
1933
|
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
1934
|
}
|
|
1786
1935
|
|
|
1787
|
-
|
|
1936
|
+
/** @deprecated Use `Context` instead. */
|
|
1937
|
+
export declare type ContextApi = Context;
|
|
1938
|
+
|
|
1939
|
+
export declare interface DataManager {
|
|
1788
1940
|
getLoading(): boolean;
|
|
1789
1941
|
setLoading(val: boolean): void;
|
|
1790
1942
|
getListLastFetch(): ListLastFetchData | undefined;
|
|
@@ -1803,35 +1955,40 @@ export declare interface DataManagerApi {
|
|
|
1803
1955
|
updatePage(pageData: PageData): void;
|
|
1804
1956
|
}
|
|
1805
1957
|
|
|
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;
|
|
1958
|
+
/** @deprecated Use `DataManager` instead. */
|
|
1959
|
+
export declare type DataManagerApi = DataManager;
|
|
1960
|
+
|
|
1961
|
+
declare type DeepPartial<T> = T extends (...args: any[]) => unknown ? T : T extends Element | Date | RegExp ? T : T extends readonly unknown[] ? {
|
|
1962
|
+
[K in keyof T]: DeepPartial<T[K]>;
|
|
1963
|
+
} : T extends object ? {
|
|
1964
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
1965
|
+
} : T;
|
|
1966
|
+
|
|
1967
|
+
export declare const Defaults: Readonly<RequiredExcept<Config, ExcludedKeys>>;
|
|
1968
|
+
|
|
1969
|
+
declare interface DependencyContainer<S = Services_2> {
|
|
1970
|
+
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;
|
|
1971
|
+
inject<T = undefined, K extends keyof S = any>(key: K): T extends undefined ? S[K] : T;
|
|
1832
1972
|
}
|
|
1833
1973
|
|
|
1834
|
-
export declare interface
|
|
1974
|
+
export declare interface Editor {
|
|
1975
|
+
/**
|
|
1976
|
+
* Get the editor element
|
|
1977
|
+
*
|
|
1978
|
+
* @deprecated Use `getEl()` instead.
|
|
1979
|
+
*/
|
|
1980
|
+
readonly $el: HTMLElement;
|
|
1981
|
+
/**
|
|
1982
|
+
* Get editor options
|
|
1983
|
+
*/
|
|
1984
|
+
getOptions(): EditorOptions;
|
|
1985
|
+
/**
|
|
1986
|
+
* Get the editor element
|
|
1987
|
+
*/
|
|
1988
|
+
getEl(): HTMLElement;
|
|
1989
|
+
/**
|
|
1990
|
+
* Get the editor UI instance
|
|
1991
|
+
*/
|
|
1835
1992
|
getUI(): EditorUI;
|
|
1836
1993
|
/**
|
|
1837
1994
|
* Get the header input elements
|
|
@@ -1896,13 +2053,36 @@ export declare interface EditorApi extends Component {
|
|
|
1896
2053
|
/**
|
|
1897
2054
|
* Start replying a comment
|
|
1898
2055
|
*/
|
|
2056
|
+
setReplyComment(commentData: CommentData, $comment: HTMLElement, scroll?: boolean): void;
|
|
2057
|
+
/**
|
|
2058
|
+
* Start replying to a comment
|
|
2059
|
+
*
|
|
2060
|
+
* @deprecated Use `setReplyComment()` instead.
|
|
2061
|
+
*/
|
|
1899
2062
|
setReply(commentData: CommentData, $comment: HTMLElement, scroll?: boolean): void;
|
|
1900
2063
|
/**
|
|
1901
2064
|
* Start editing a comment
|
|
1902
2065
|
*/
|
|
1903
2066
|
setEditComment(commentData: CommentData, $comment: HTMLElement): void;
|
|
2067
|
+
/**
|
|
2068
|
+
* Get plugin manager
|
|
2069
|
+
*/
|
|
2070
|
+
getPlugins(): PluginManager | undefined;
|
|
2071
|
+
/**
|
|
2072
|
+
* Get plugin manager
|
|
2073
|
+
*
|
|
2074
|
+
* @deprecated Use `getPlugins()` instead.
|
|
2075
|
+
*/
|
|
2076
|
+
getPlugs(): PluginManager | undefined;
|
|
2077
|
+
/**
|
|
2078
|
+
* Set plugin manager
|
|
2079
|
+
*/
|
|
2080
|
+
setPlugins(plugins: PluginManager): void;
|
|
1904
2081
|
}
|
|
1905
2082
|
|
|
2083
|
+
/** @deprecated Use `Editor` instead. */
|
|
2084
|
+
export declare type EditorApi = Editor;
|
|
2085
|
+
|
|
1906
2086
|
declare interface EditorEventPayloadMap {
|
|
1907
2087
|
mounted: undefined;
|
|
1908
2088
|
unmounted: undefined;
|
|
@@ -1915,17 +2095,24 @@ declare interface EditorEventPayloadMap {
|
|
|
1915
2095
|
$input: HTMLInputElement;
|
|
1916
2096
|
};
|
|
1917
2097
|
'content-updated': string;
|
|
1918
|
-
'panel-show':
|
|
1919
|
-
'panel-hide':
|
|
2098
|
+
'panel-show': EditorPlugin;
|
|
2099
|
+
'panel-hide': EditorPlugin;
|
|
1920
2100
|
'panel-close': undefined;
|
|
1921
2101
|
'editor-close': undefined;
|
|
1922
2102
|
'editor-open': undefined;
|
|
2103
|
+
'editor-submit': undefined;
|
|
2104
|
+
'editor-submitted': undefined;
|
|
2105
|
+
}
|
|
2106
|
+
|
|
2107
|
+
declare interface EditorOptions {
|
|
2108
|
+
getEvents: () => EventManager;
|
|
2109
|
+
getConf: () => ConfigManager;
|
|
1923
2110
|
}
|
|
1924
2111
|
|
|
1925
2112
|
/**
|
|
1926
2113
|
* Editor 插件
|
|
1927
2114
|
*/
|
|
1928
|
-
declare class
|
|
2115
|
+
declare class EditorPlugin {
|
|
1929
2116
|
protected kit: PlugKit;
|
|
1930
2117
|
$btn?: HTMLElement;
|
|
1931
2118
|
$panel?: HTMLElement;
|
|
@@ -1947,6 +2134,17 @@ declare class EditorPlug {
|
|
|
1947
2134
|
useEditorStateEffect(stateName: EditorState, effectFn: (comment: CommentData) => () => void): void;
|
|
1948
2135
|
}
|
|
1949
2136
|
|
|
2137
|
+
export declare interface EditorPluginManager {
|
|
2138
|
+
getPlugins: () => EditorPlugin[];
|
|
2139
|
+
getEvents: () => EventManager<EditorEventPayloadMap>;
|
|
2140
|
+
getEditor: () => Editor;
|
|
2141
|
+
getOptions: () => PluginManagerOptions;
|
|
2142
|
+
get<T extends typeof EditorPlugin>(plug: T): InstanceType<T> | undefined;
|
|
2143
|
+
openPluginPanel: (plug: EditorPlugin) => void;
|
|
2144
|
+
closePluginPanel: () => void;
|
|
2145
|
+
getTransformedContent: (rawContent: string) => string;
|
|
2146
|
+
}
|
|
2147
|
+
|
|
1950
2148
|
export declare type EditorState = 'reply' | 'edit' | 'normal';
|
|
1951
2149
|
|
|
1952
2150
|
declare interface EditorUI extends Record<keyof typeof Sel, HTMLElement> {
|
|
@@ -2053,8 +2251,8 @@ declare const en: {
|
|
|
2053
2251
|
accountMergeConfirm: string;
|
|
2054
2252
|
dismiss: string;
|
|
2055
2253
|
merge: string;
|
|
2056
|
-
|
|
2057
|
-
|
|
2254
|
+
client: string;
|
|
2255
|
+
server: string;
|
|
2058
2256
|
loading: string;
|
|
2059
2257
|
loadFail: string;
|
|
2060
2258
|
editing: string;
|
|
@@ -2078,7 +2276,7 @@ declare interface EntityCookedComment {
|
|
|
2078
2276
|
date: string;
|
|
2079
2277
|
email_encrypted: string;
|
|
2080
2278
|
id: number;
|
|
2081
|
-
ip_region
|
|
2279
|
+
ip_region?: string;
|
|
2082
2280
|
is_allow_reply: boolean;
|
|
2083
2281
|
is_collapsed: boolean;
|
|
2084
2282
|
is_pending: boolean;
|
|
@@ -2153,31 +2351,37 @@ declare interface EntityCookedUserForAdmin {
|
|
|
2153
2351
|
receive_email: boolean;
|
|
2154
2352
|
}
|
|
2155
2353
|
|
|
2156
|
-
declare
|
|
2354
|
+
declare interface Event_2<T, K extends keyof T = keyof T> extends EventOptions {
|
|
2355
|
+
name: K;
|
|
2356
|
+
handler: EventHandler<T[K]>;
|
|
2357
|
+
}
|
|
2358
|
+
export { Event_2 as Event }
|
|
2359
|
+
|
|
2360
|
+
export declare type EventHandler<T> = (payload: T) => void;
|
|
2157
2361
|
|
|
2158
|
-
declare
|
|
2362
|
+
export declare interface EventManager<T = EventPayloadMap> {
|
|
2363
|
+
on<K extends keyof T>(name: K, handler: EventHandler<T[K]>, opts?: EventOptions): void;
|
|
2364
|
+
off<K extends keyof T>(name: K, handler: EventHandler<T[K]>): void;
|
|
2365
|
+
trigger<K extends keyof T>(name: K, payload?: T[K]): void;
|
|
2366
|
+
}
|
|
2367
|
+
|
|
2368
|
+
declare class EventManager_2<T> implements EventManager<T> {
|
|
2159
2369
|
private events;
|
|
2160
2370
|
/**
|
|
2161
2371
|
* Add an event listener for a specific event name
|
|
2162
2372
|
*/
|
|
2163
|
-
on<K extends keyof
|
|
2373
|
+
on<K extends keyof T>(name: K, handler: EventHandler<T[K]>, opts?: EventOptions): void;
|
|
2164
2374
|
/**
|
|
2165
2375
|
* Remove an event listener for a specific event name and handler
|
|
2166
2376
|
*/
|
|
2167
|
-
off<K extends keyof
|
|
2377
|
+
off<K extends keyof T>(name: K, handler: EventHandler<T[K]>): void;
|
|
2168
2378
|
/**
|
|
2169
2379
|
* Trigger an event with an optional payload
|
|
2170
2380
|
*/
|
|
2171
|
-
trigger<K extends keyof
|
|
2172
|
-
}
|
|
2173
|
-
|
|
2174
|
-
declare interface EventManagerFuncs<PayloadMap> {
|
|
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;
|
|
2381
|
+
trigger<K extends keyof T>(name: K, payload?: T[K]): void;
|
|
2178
2382
|
}
|
|
2179
2383
|
|
|
2180
|
-
declare interface EventOptions {
|
|
2384
|
+
export declare interface EventOptions {
|
|
2181
2385
|
once?: boolean;
|
|
2182
2386
|
}
|
|
2183
2387
|
|
|
@@ -2185,7 +2389,7 @@ declare interface EventOptions {
|
|
|
2185
2389
|
export declare interface EventPayloadMap {
|
|
2186
2390
|
created: undefined;
|
|
2187
2391
|
mounted: undefined;
|
|
2188
|
-
updated:
|
|
2392
|
+
updated: Config;
|
|
2189
2393
|
unmounted: undefined;
|
|
2190
2394
|
'list-fetch': Partial<ListFetchParams>;
|
|
2191
2395
|
'list-fetched': ListFetchedArgs;
|
|
@@ -2208,6 +2412,8 @@ export declare interface EventPayloadMap {
|
|
|
2208
2412
|
'sidebar-hide': undefined;
|
|
2209
2413
|
}
|
|
2210
2414
|
|
|
2415
|
+
declare type ExcludedKeys = FunctionKeys<Config>;
|
|
2416
|
+
|
|
2211
2417
|
export declare interface FetchError extends Error {
|
|
2212
2418
|
code: number;
|
|
2213
2419
|
message: string;
|
|
@@ -2233,8 +2439,17 @@ declare interface FullRequestParams extends Omit<RequestInit, 'body'> {
|
|
|
2233
2439
|
cancelToken?: CancelToken;
|
|
2234
2440
|
}
|
|
2235
2441
|
|
|
2442
|
+
declare type FunctionKeys<T> = Exclude<{
|
|
2443
|
+
[K in keyof T]: NonNullable<T[K]> extends (...args: any[]) => any ? K : never;
|
|
2444
|
+
}[keyof T], undefined>;
|
|
2445
|
+
|
|
2236
2446
|
declare type HandlerMap = Record<string, any>;
|
|
2237
2447
|
|
|
2448
|
+
declare interface HandlerParamsAuthSSOExchange {
|
|
2449
|
+
/** External IdP access token (e.g. an Auth0 access token) */
|
|
2450
|
+
token: string;
|
|
2451
|
+
}
|
|
2452
|
+
|
|
2238
2453
|
declare interface HandlerParamsCaptchaVerify {
|
|
2239
2454
|
/** The captcha value to check */
|
|
2240
2455
|
value: string;
|
|
@@ -2412,7 +2627,7 @@ declare interface HandlerParamsUserUpdate {
|
|
|
2412
2627
|
receive_email: boolean;
|
|
2413
2628
|
}
|
|
2414
2629
|
|
|
2415
|
-
declare interface
|
|
2630
|
+
declare interface HandlerParamsVoteCreate {
|
|
2416
2631
|
/** The user email */
|
|
2417
2632
|
email?: string;
|
|
2418
2633
|
/** The username */
|
|
@@ -2483,7 +2698,7 @@ declare interface HandlerResponseCommentCreate {
|
|
|
2483
2698
|
date: string;
|
|
2484
2699
|
email_encrypted: string;
|
|
2485
2700
|
id: number;
|
|
2486
|
-
ip_region
|
|
2701
|
+
ip_region?: string;
|
|
2487
2702
|
is_allow_reply: boolean;
|
|
2488
2703
|
is_collapsed: boolean;
|
|
2489
2704
|
is_pending: boolean;
|
|
@@ -2512,7 +2727,7 @@ declare interface HandlerResponseCommentGet {
|
|
|
2512
2727
|
declare interface HandlerResponseCommentList {
|
|
2513
2728
|
comments: EntityCookedComment[];
|
|
2514
2729
|
count: number;
|
|
2515
|
-
page
|
|
2730
|
+
page?: EntityCookedPage;
|
|
2516
2731
|
roots_count: number;
|
|
2517
2732
|
}
|
|
2518
2733
|
|
|
@@ -2524,7 +2739,7 @@ declare interface HandlerResponseCommentUpdate {
|
|
|
2524
2739
|
date: string;
|
|
2525
2740
|
email_encrypted: string;
|
|
2526
2741
|
id: number;
|
|
2527
|
-
ip_region
|
|
2742
|
+
ip_region?: string;
|
|
2528
2743
|
is_allow_reply: boolean;
|
|
2529
2744
|
is_collapsed: boolean;
|
|
2530
2745
|
is_pending: boolean;
|
|
@@ -2705,6 +2920,8 @@ declare interface HandlerResponseUserUpdate {
|
|
|
2705
2920
|
|
|
2706
2921
|
declare interface HandlerResponseVote {
|
|
2707
2922
|
down: number;
|
|
2923
|
+
is_down: boolean;
|
|
2924
|
+
is_up: boolean;
|
|
2708
2925
|
up: number;
|
|
2709
2926
|
}
|
|
2710
2927
|
|
|
@@ -2750,54 +2967,21 @@ export declare interface Layer {
|
|
|
2750
2967
|
getEl: () => HTMLElement;
|
|
2751
2968
|
}
|
|
2752
2969
|
|
|
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;
|
|
2970
|
+
export declare interface LayerManager {
|
|
2971
|
+
create(name: string, el?: HTMLElement): Layer;
|
|
2765
2972
|
destroy(): void;
|
|
2766
|
-
}
|
|
2767
|
-
|
|
2768
|
-
declare class LayerManager {
|
|
2769
|
-
private wrap;
|
|
2770
|
-
constructor(ctx: ContextApi);
|
|
2771
2973
|
getEl(): HTMLElement;
|
|
2772
|
-
create(name: string, el?: HTMLElement): Layer_2;
|
|
2773
2974
|
}
|
|
2774
2975
|
|
|
2775
|
-
declare
|
|
2776
|
-
onShow: () => void;
|
|
2777
|
-
onHide: () => void;
|
|
2778
|
-
}
|
|
2976
|
+
declare type Lifecycle = 'transient' | 'singleton';
|
|
2779
2977
|
|
|
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 }?: {
|
|
2978
|
+
export declare interface List {
|
|
2979
|
+
getEl: () => HTMLElement;
|
|
2980
|
+
getCommentsWrapEl: () => HTMLElement;
|
|
2981
|
+
getLayout: (arg: {
|
|
2798
2982
|
forceFlatMode?: boolean;
|
|
2799
|
-
})
|
|
2800
|
-
|
|
2983
|
+
}) => ListLayout;
|
|
2984
|
+
getCommentNodes: () => CommentNode[];
|
|
2801
2985
|
}
|
|
2802
2986
|
|
|
2803
2987
|
export declare interface ListData {
|
|
@@ -2836,20 +3020,9 @@ export declare interface ListLastFetchData {
|
|
|
2836
3020
|
data?: ListData;
|
|
2837
3021
|
}
|
|
2838
3022
|
|
|
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
|
-
}
|
|
3023
|
+
export declare interface ListLayout {
|
|
3024
|
+
import: (comments: CommentData[]) => void;
|
|
3025
|
+
insert: (comment: CommentData, replyComment?: CommentData) => void;
|
|
2853
3026
|
}
|
|
2854
3027
|
|
|
2855
3028
|
export declare const loadCountWidget: typeof Artalk.loadCountWidget;
|
|
@@ -2872,8 +3045,6 @@ export declare interface LocalUser {
|
|
|
2872
3045
|
is_admin: boolean;
|
|
2873
3046
|
}
|
|
2874
3047
|
|
|
2875
|
-
declare function makeNestCommentNodeList(srcData: CommentData[], sortBy?: SortByType, nestMax?: number): CommentNode_2[];
|
|
2876
|
-
|
|
2877
3048
|
export declare interface NotifyData {
|
|
2878
3049
|
/** 通知 ID */
|
|
2879
3050
|
id: number;
|
|
@@ -2912,57 +3083,77 @@ export declare interface PageData {
|
|
|
2912
3083
|
|
|
2913
3084
|
declare type PayloadKey = keyof ApiHandlerPayload;
|
|
2914
3085
|
|
|
3086
|
+
declare class PluginManager implements EditorPluginManager {
|
|
3087
|
+
opts: PluginManagerOptions;
|
|
3088
|
+
private plugins;
|
|
3089
|
+
private openedPlug;
|
|
3090
|
+
private events;
|
|
3091
|
+
constructor(opts: PluginManagerOptions);
|
|
3092
|
+
getPlugins(): EditorPlugin[];
|
|
3093
|
+
getEvents(): EventManager_2<EditorEventPayloadMap>;
|
|
3094
|
+
getEditor(): Editor;
|
|
3095
|
+
getOptions(): PluginManagerOptions;
|
|
3096
|
+
private clear;
|
|
3097
|
+
private loadPluginUI;
|
|
3098
|
+
/** Load the plug btn and plug panel on editor ui */
|
|
3099
|
+
private loadPluginItem;
|
|
3100
|
+
get<T extends typeof EditorPlugin>(plug: T): InstanceType<T> | undefined;
|
|
3101
|
+
/** Open the editor plug panel */
|
|
3102
|
+
openPluginPanel(plug: EditorPlugin): void;
|
|
3103
|
+
/** Close the editor plugin panel */
|
|
3104
|
+
closePluginPanel(): void;
|
|
3105
|
+
/** Get the content which is transformed by plugs */
|
|
3106
|
+
getTransformedContent(rawContent: string): string;
|
|
3107
|
+
}
|
|
3108
|
+
|
|
3109
|
+
declare interface PluginManagerOptions {
|
|
3110
|
+
getArtalkRootEl: () => HTMLElement;
|
|
3111
|
+
getEditor: () => Editor;
|
|
3112
|
+
getConf: () => ConfigManager;
|
|
3113
|
+
getUser: () => UserManager;
|
|
3114
|
+
getApi: () => Api;
|
|
3115
|
+
getData: () => DataManager;
|
|
3116
|
+
getCheckers: () => CheckerManager;
|
|
3117
|
+
onSubmitted: () => void;
|
|
3118
|
+
}
|
|
3119
|
+
|
|
2915
3120
|
/**
|
|
2916
3121
|
* PlugKit provides a set of methods to help you develop editor plug
|
|
2917
3122
|
*/
|
|
2918
3123
|
declare class PlugKit {
|
|
2919
|
-
private
|
|
2920
|
-
constructor(
|
|
3124
|
+
private plugins;
|
|
3125
|
+
constructor(plugins: PluginManager);
|
|
2921
3126
|
/** 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;
|
|
3127
|
+
useEditor(): Editor;
|
|
2929
3128
|
/** Use the config of Artalk */
|
|
2930
|
-
useConf():
|
|
3129
|
+
useConf(): Config;
|
|
2931
3130
|
/** Use the http api client */
|
|
2932
3131
|
useApi(): Api;
|
|
3132
|
+
/** Use the data manager */
|
|
3133
|
+
useData(): DataManager;
|
|
2933
3134
|
/** Use the user manager */
|
|
2934
|
-
useUser():
|
|
3135
|
+
useUser(): UserManager;
|
|
3136
|
+
/** Use the checkers */
|
|
3137
|
+
useCheckers(): CheckerManager;
|
|
2935
3138
|
/** Use the ui of editor */
|
|
2936
3139
|
useUI(): EditorUI;
|
|
2937
3140
|
/** Use the events in editor scope */
|
|
2938
|
-
useEvents():
|
|
3141
|
+
useEvents(): EventManager_2<EditorEventPayloadMap>;
|
|
2939
3142
|
/** Listen the event when plug is mounted */
|
|
2940
3143
|
useMounted(func: () => void): void;
|
|
2941
3144
|
/** Listen the event when plug is unmounted */
|
|
2942
3145
|
useUnmounted(func: () => void): void;
|
|
2943
3146
|
/** Use the deps of other plug */
|
|
2944
|
-
useDeps<T extends typeof
|
|
3147
|
+
useDeps<T extends typeof EditorPlugin>(plug: T): InstanceType<T> | undefined;
|
|
3148
|
+
/** Use the root element of artalk */
|
|
3149
|
+
useArtalkRootEl(): HTMLElement;
|
|
2945
3150
|
}
|
|
2946
3151
|
|
|
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;
|
|
3152
|
+
declare type PrimitiveKey = string | number | symbol;
|
|
3153
|
+
|
|
3154
|
+
declare interface ProvideFuncOptions {
|
|
3155
|
+
/** Lifecycle (default: 'singleton') */
|
|
3156
|
+
lifecycle?: Lifecycle;
|
|
2966
3157
|
}
|
|
2967
3158
|
|
|
2968
3159
|
declare type QueryParamsType = Record<string | number, any>;
|
|
@@ -3019,6 +3210,8 @@ declare class Render {
|
|
|
3019
3210
|
|
|
3020
3211
|
declare type RequestParams = Omit<FullRequestParams, 'body' | 'method' | 'query' | 'path'>;
|
|
3021
3212
|
|
|
3213
|
+
declare type RequiredExcept<T, K extends keyof T> = Required<Omit<T, K>> & Pick<T, K>;
|
|
3214
|
+
|
|
3022
3215
|
declare type ResponseFormat = keyof Omit<Body, 'body' | 'bodyUsed'>;
|
|
3023
3216
|
|
|
3024
3217
|
declare const Sel: {
|
|
@@ -3037,42 +3230,29 @@ declare const Sel: {
|
|
|
3037
3230
|
$plugPanelWrap: string;
|
|
3038
3231
|
};
|
|
3039
3232
|
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3233
|
+
export declare interface Services {
|
|
3234
|
+
config: ConfigManager;
|
|
3235
|
+
events: EventManager;
|
|
3236
|
+
data: DataManager;
|
|
3237
|
+
api: Api;
|
|
3238
|
+
apiHandlers: ApiHandlers;
|
|
3239
|
+
editor: Editor;
|
|
3240
|
+
editorPlugs: EditorPluginManager | undefined;
|
|
3241
|
+
list: List;
|
|
3242
|
+
sidebar: SidebarLayer;
|
|
3243
|
+
checkers: CheckerManager;
|
|
3244
|
+
layers: LayerManager;
|
|
3245
|
+
user: UserManager;
|
|
3246
|
+
}
|
|
3247
|
+
|
|
3248
|
+
declare type Services_2 = {
|
|
3249
|
+
[key: PrimitiveKey]: any;
|
|
3054
3250
|
};
|
|
3055
3251
|
|
|
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;
|
|
3252
|
+
export declare interface SidebarLayer {
|
|
3253
|
+
onUserChanged: () => void;
|
|
3254
|
+
show: (conf?: SidebarShowPayload) => void;
|
|
3255
|
+
hide: () => void;
|
|
3076
3256
|
}
|
|
3077
3257
|
|
|
3078
3258
|
export declare interface SidebarShowPayload {
|
|
@@ -3092,45 +3272,8 @@ export declare interface SiteData {
|
|
|
3092
3272
|
first_url: string;
|
|
3093
3273
|
}
|
|
3094
3274
|
|
|
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
3275
|
export declare const use: typeof Artalk.use;
|
|
3116
3276
|
|
|
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
3277
|
export declare interface UserData {
|
|
3135
3278
|
/** 用户 ID */
|
|
3136
3279
|
id: number;
|
|
@@ -3168,8 +3311,19 @@ export declare interface UserInfoApiResponseData {
|
|
|
3168
3311
|
notifies_count: number;
|
|
3169
3312
|
}
|
|
3170
3313
|
|
|
3171
|
-
declare interface
|
|
3172
|
-
|
|
3314
|
+
export declare interface UserManager {
|
|
3315
|
+
getData: () => LocalUser;
|
|
3316
|
+
update: (dta: Partial<LocalUser>) => void;
|
|
3317
|
+
logout: () => void;
|
|
3318
|
+
checkHasBasicUserInfo: () => boolean;
|
|
3173
3319
|
}
|
|
3174
3320
|
|
|
3175
3321
|
export { }
|
|
3322
|
+
|
|
3323
|
+
|
|
3324
|
+
|
|
3325
|
+
declare global {
|
|
3326
|
+
interface Window {
|
|
3327
|
+
ArtalkPlugins?: { [name: string]: ArtalkPlugin }
|
|
3328
|
+
}
|
|
3329
|
+
}
|