@waline/client 3.13.0 → 3.14.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/comment.d.ts +44 -36
- package/dist/comment.js +1 -2
- package/dist/component.d.ts +38 -106
- package/dist/component.js +13 -14
- package/dist/full.d.ts +1382 -0
- package/dist/full.js +109 -0
- package/dist/pageview.d.ts +53 -44
- package/dist/pageview.js +1 -2
- package/dist/slim.d.ts +723 -692
- package/dist/slim.js +13 -14
- package/dist/waline.css +1 -1
- package/dist/waline.css.map +1 -1
- package/package.json +18 -24
- package/dist/comment.js.map +0 -1
- package/dist/component.js.map +0 -1
- package/dist/pageview.js.map +0 -1
- package/dist/slim.js.map +0 -1
- package/dist/waline.d.ts +0 -741
- package/dist/waline.js +0 -89
- package/dist/waline.js.map +0 -1
- package/dist/waline.umd.js +0 -89
- package/dist/waline.umd.js.map +0 -1
package/dist/pageview.d.ts
CHANGED
|
@@ -1,48 +1,57 @@
|
|
|
1
|
+
//#region src/version.d.ts
|
|
1
2
|
declare const version: string;
|
|
2
|
-
|
|
3
|
+
//#endregion
|
|
4
|
+
//#region src/typings/options.d.ts
|
|
5
|
+
// oxlint-disable-next-line typescript/explicit-module-boundary-types, typescript/no-explicit-any
|
|
3
6
|
type WalineAbort = (reason?: any) => void;
|
|
4
|
-
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/pageview.d.ts
|
|
5
9
|
interface WalinePageviewCountOptions {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Waline 服务端地址
|
|
12
|
+
*
|
|
13
|
+
* Waline server url
|
|
14
|
+
*/
|
|
15
|
+
serverURL: string;
|
|
16
|
+
/**
|
|
17
|
+
* 浏览量 CSS 选择器
|
|
18
|
+
*
|
|
19
|
+
* Pageview CSS selector
|
|
20
|
+
*
|
|
21
|
+
* @default '.waline-pageview-count'
|
|
22
|
+
*/
|
|
23
|
+
selector?: string;
|
|
24
|
+
/**
|
|
25
|
+
* 需要更新和获取的路径
|
|
26
|
+
*
|
|
27
|
+
* Path to be fetched and updated
|
|
28
|
+
*
|
|
29
|
+
* @default window.location.pathname
|
|
30
|
+
*/
|
|
31
|
+
path?: string;
|
|
32
|
+
/**
|
|
33
|
+
* 是否在查询时更新 path 的浏览量
|
|
34
|
+
*
|
|
35
|
+
* Whether update pageviews when fetching path result
|
|
36
|
+
*
|
|
37
|
+
* @default true
|
|
38
|
+
*/
|
|
39
|
+
update?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* 错误提示消息所使用的语言
|
|
42
|
+
*
|
|
43
|
+
* Language of error message
|
|
44
|
+
*
|
|
45
|
+
* @default navigator.language
|
|
46
|
+
*/
|
|
47
|
+
lang?: string;
|
|
44
48
|
}
|
|
45
|
-
declare const pageviewCount: ({
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
declare const pageviewCount: ({
|
|
50
|
+
serverURL,
|
|
51
|
+
path,
|
|
52
|
+
selector,
|
|
53
|
+
update,
|
|
54
|
+
lang
|
|
55
|
+
}: WalinePageviewCountOptions) => WalineAbort;
|
|
56
|
+
//#endregion
|
|
57
|
+
export { type WalineAbort, WalinePageviewCountOptions, pageviewCount, version };
|
package/dist/pageview.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=pageview.js.map
|
|
1
|
+
import{getPageview as e,updatePageview as t}from"@waline/api";const n=`3.14.0`,r=(e=``)=>e.replace(/\/$/u,``),i=e=>/^(https?:)?\/\//u.test(e),a=e=>{let t=r(e);return i(t)?t:`https://${t}`},o=e=>{e.name!==`AbortError`&&console.error(e.message)},s=e=>{let{path:t}=e.dataset;return t?.length?t:null},c=(e,t)=>{t.forEach((t,n)=>{let r=e[n].time;typeof r==`number`&&(t.textContent=r.toString())})},l=({serverURL:n,path:r=window.location.pathname,selector:i=`.waline-pageview-count`,update:l=!0,lang:u=navigator.language})=>{let d=new AbortController,f=[...document.querySelectorAll(i)],p=e=>{let t=s(e);return t!=null&&r!==t},m=t=>e({serverURL:a(n),paths:t.map(e=>s(e)??r),lang:u,signal:d.signal}).then(e=>{c(e,t)}).catch(o);if(l){let e=f.filter(e=>!p(e)),i=f.filter(e=>p(e));t({serverURL:a(n),path:r,lang:u}).then(t=>{c(t,e)}),i.length>0&&m(i)}else m(f);return d.abort.bind(d)};export{l as pageviewCount,n as version};
|