@ansidev-oss/vitepress-theme-ansidev 1.0.12 → 1.2.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.
Files changed (86) hide show
  1. package/dist/client/Donation-BBPb8v5p.js +66 -0
  2. package/dist/client/GoogleAnalytics-34XEM7eO.js +25 -0
  3. package/dist/client/Sharing-CpagX9oy.js +185 -0
  4. package/dist/client/Swetrix-GKEyGNrV.js +647 -0
  5. package/dist/client/components/PostDate.test.d.ts +1 -0
  6. package/dist/client/composables/index.d.ts +1 -0
  7. package/dist/client/composables/lang.d.ts +27 -0
  8. package/dist/client/composables/lang.test.d.ts +1 -0
  9. package/dist/client/index.js +3769 -9
  10. package/dist/client/medium-zoom-DPl0T7qn.js +266 -0
  11. package/dist/client/record-Cgv_fXDH.js +2739 -0
  12. package/dist/client/styles.css +2 -1
  13. package/dist/client/types/index.d.ts +8 -0
  14. package/dist/node/composables.d.mts +16 -17
  15. package/dist/node/composables.mjs +39 -15
  16. package/dist/node/config.d.mts +2 -17
  17. package/dist/node/config.mjs +9 -6
  18. package/package.json +27 -21
  19. package/src/client/components/DonationWidget.vue +9 -3
  20. package/src/client/components/Footer.vue +11 -4
  21. package/src/client/components/Link.vue +11 -5
  22. package/src/client/components/LocaleSwitcher.vue +5 -5
  23. package/src/client/components/PostDate.test.ts +82 -0
  24. package/src/client/components/PostDate.vue +32 -13
  25. package/src/client/components/PostItem.vue +17 -7
  26. package/src/client/components/PostList.vue +7 -4
  27. package/src/client/components/ProjectCard.vue +42 -14
  28. package/src/client/components/ProjectList.vue +12 -5
  29. package/src/client/components/RouterLink.vue +3 -3
  30. package/src/client/components/SharingWidget.vue +3 -1
  31. package/src/client/components/StatusBadge.vue +10 -10
  32. package/src/client/components/TermBadge.vue +11 -7
  33. package/src/client/components/TermLink.vue +4 -4
  34. package/src/client/composables/date.ts +1 -1
  35. package/src/client/composables/index.ts +1 -0
  36. package/src/client/composables/lang.test.ts +56 -0
  37. package/src/client/composables/lang.ts +65 -0
  38. package/src/client/composables/locale.ts +4 -1
  39. package/src/client/composables/project.ts +3 -3
  40. package/src/client/composables/rank.ts +5 -2
  41. package/src/client/index.ts +5 -0
  42. package/src/client/layouts/Layout.vue +2 -2
  43. package/src/client/pages/ArchivesPage.vue +10 -5
  44. package/src/client/pages/CategoriesPage.vue +13 -5
  45. package/src/client/pages/HomePage.vue +3 -3
  46. package/src/client/pages/Page.vue +13 -11
  47. package/src/client/pages/PostsPage.vue +4 -4
  48. package/src/client/pages/ProjectsPage.vue +10 -7
  49. package/src/client/pages/TagsPage.vue +10 -4
  50. package/src/client/plugins/donation/components/Donation.vue +5 -3
  51. package/src/client/plugins/donation/components/DonationButton.vue +3 -1
  52. package/src/client/plugins/donation/index.ts +11 -8
  53. package/src/client/plugins/i18n/index.ts +2 -2
  54. package/src/client/plugins/sharing/components/Sharing.vue +39 -15
  55. package/src/client/plugins/sharing/components/SharingButton.vue +34 -14
  56. package/src/client/plugins/sharing/index.ts +6 -2
  57. package/src/client/styles/base.css +30 -0
  58. package/src/client/styles/blog.css +376 -0
  59. package/src/client/styles/index.css +2 -30
  60. package/src/client/types/index.ts +8 -0
  61. package/src/node/composables/excerpt.test.ts +88 -0
  62. package/src/node/composables/excerpt.ts +57 -0
  63. package/src/node/composables/index.ts +1 -0
  64. package/src/node/composables/markdown.ts +8 -2
  65. package/src/node/composables/route.ts +15 -7
  66. package/src/node/composables/slug.ts +12 -4
  67. package/src/node/config.ts +20 -14
  68. package/src/shared/composables/useSlug.ts +2 -1
  69. package/src/vite-env.d.ts +1 -0
  70. package/dist/client/Donation-D9Xn0MPt.js +0 -76
  71. package/dist/client/GoogleAnalytics-Dp3EGn1x.js +0 -29
  72. package/dist/client/Sharing-ZrU7YF-x.js +0 -190
  73. package/dist/client/Swetrix-CM1mbD6X.js +0 -450
  74. package/dist/client/VPAlgoliaSearchBox-C18GEhLm.js +0 -126
  75. package/dist/client/VPCarbonAds-DwoamMao.js +0 -31
  76. package/dist/client/VPLocalSearchBox-DyteUinQ.js +0 -4086
  77. package/dist/client/index-BtT3qA6T.js +0 -12663
  78. package/dist/client/index-CCR5sUM8.js +0 -10688
  79. package/dist/client/index-CkmxezC0.js +0 -7616
  80. package/dist/client/index-DuYWs0vj.js +0 -265
  81. package/dist/node/composables/index.d.ts +0 -3
  82. package/dist/node/composables/markdown.d.ts +0 -2
  83. package/dist/node/composables/route.d.ts +0 -15
  84. package/dist/node/composables/slug.d.ts +0 -7
  85. package/dist/node/composables/types.d.ts +0 -7
  86. package/dist/node/config.d.ts +0 -45
@@ -1,265 +0,0 @@
1
- var E = Object.assign || function(m) {
2
- for (var t = 1; t < arguments.length; t++) {
3
- var a = arguments[t];
4
- for (var u in a)
5
- Object.prototype.hasOwnProperty.call(a, u) && (m[u] = a[u]);
6
- }
7
- return m;
8
- }, x = function(t) {
9
- return t.tagName === "IMG";
10
- }, de = function(t) {
11
- return NodeList.prototype.isPrototypeOf(t);
12
- }, A = function(t) {
13
- return t && t.nodeType === 1;
14
- }, U = function(t) {
15
- var a = t.currentSrc || t.src;
16
- return a.substr(-4).toLowerCase() === ".svg";
17
- }, W = function(t) {
18
- try {
19
- return Array.isArray(t) ? t.filter(x) : de(t) ? [].slice.call(t).filter(x) : A(t) ? [t].filter(x) : typeof t == "string" ? [].slice.call(document.querySelectorAll(t)).filter(x) : [];
20
- } catch {
21
- throw new TypeError(`The provided selector is invalid.
22
- Expects a CSS selector, a Node element, a NodeList or an array.
23
- See: https://github.com/francoischalifour/medium-zoom`);
24
- }
25
- }, me = function(t) {
26
- var a = document.createElement("div");
27
- return a.classList.add("medium-zoom-overlay"), a.style.background = t, a;
28
- }, le = function(t) {
29
- var a = t.getBoundingClientRect(), u = a.top, g = a.left, N = a.width, I = a.height, h = t.cloneNode(), j = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0, C = window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0;
30
- return h.removeAttribute("id"), h.style.position = "absolute", h.style.top = u + j + "px", h.style.left = g + C + "px", h.style.width = N + "px", h.style.height = I + "px", h.style.transform = "", h;
31
- }, L = function(t, a) {
32
- var u = E({
33
- bubbles: !1,
34
- cancelable: !1,
35
- detail: void 0
36
- }, a);
37
- if (typeof window.CustomEvent == "function")
38
- return new CustomEvent(t, u);
39
- var g = document.createEvent("CustomEvent");
40
- return g.initCustomEvent(t, u.bubbles, u.cancelable, u.detail), g;
41
- }, ue = function m(t) {
42
- var a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, u = window.Promise || function(o) {
43
- function n() {
44
- }
45
- o(n, n);
46
- }, g = function(o) {
47
- var n = o.target;
48
- if (n === S) {
49
- z();
50
- return;
51
- }
52
- v.indexOf(n) !== -1 && Z({ target: n });
53
- }, N = function() {
54
- if (!(b || !e.original)) {
55
- var o = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
56
- Math.abs(B - o) > i.scrollOffset && setTimeout(z, 150);
57
- }
58
- }, I = function(o) {
59
- var n = o.key || o.keyCode;
60
- (n === "Escape" || n === "Esc" || n === 27) && z();
61
- }, h = function() {
62
- var o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, n = o;
63
- if (o.background && (S.style.background = o.background), o.container && o.container instanceof Object && (n.container = E({}, i.container, o.container)), o.template) {
64
- var d = A(o.template) ? o.template : document.querySelector(o.template);
65
- n.template = d;
66
- }
67
- return i = E({}, i, n), v.forEach(function(l) {
68
- l.dispatchEvent(L("medium-zoom:update", {
69
- detail: { zoom: c }
70
- }));
71
- }), c;
72
- }, j = function() {
73
- var o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
74
- return m(E({}, i, o));
75
- }, C = function() {
76
- for (var o = arguments.length, n = Array(o), d = 0; d < o; d++)
77
- n[d] = arguments[d];
78
- var l = n.reduce(function(r, f) {
79
- return [].concat(r, W(f));
80
- }, []);
81
- return l.filter(function(r) {
82
- return v.indexOf(r) === -1;
83
- }).forEach(function(r) {
84
- v.push(r), r.classList.add("medium-zoom-image");
85
- }), O.forEach(function(r) {
86
- var f = r.type, p = r.listener, w = r.options;
87
- l.forEach(function(y) {
88
- y.addEventListener(f, p, w);
89
- });
90
- }), c;
91
- }, _ = function() {
92
- for (var o = arguments.length, n = Array(o), d = 0; d < o; d++)
93
- n[d] = arguments[d];
94
- e.zoomed && z();
95
- var l = n.length > 0 ? n.reduce(function(r, f) {
96
- return [].concat(r, W(f));
97
- }, []) : v;
98
- return l.forEach(function(r) {
99
- r.classList.remove("medium-zoom-image"), r.dispatchEvent(L("medium-zoom:detach", {
100
- detail: { zoom: c }
101
- }));
102
- }), v = v.filter(function(r) {
103
- return l.indexOf(r) === -1;
104
- }), c;
105
- }, F = function(o, n) {
106
- var d = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
107
- return v.forEach(function(l) {
108
- l.addEventListener("medium-zoom:" + o, n, d);
109
- }), O.push({ type: "medium-zoom:" + o, listener: n, options: d }), c;
110
- }, X = function(o, n) {
111
- var d = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
112
- return v.forEach(function(l) {
113
- l.removeEventListener("medium-zoom:" + o, n, d);
114
- }), O = O.filter(function(l) {
115
- return !(l.type === "medium-zoom:" + o && l.listener.toString() === n.toString());
116
- }), c;
117
- }, Y = function() {
118
- var o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, n = o.target, d = function() {
119
- var r = {
120
- width: document.documentElement.clientWidth,
121
- height: document.documentElement.clientHeight,
122
- left: 0,
123
- top: 0,
124
- right: 0,
125
- bottom: 0
126
- }, f = void 0, p = void 0;
127
- if (i.container)
128
- if (i.container instanceof Object)
129
- r = E({}, r, i.container), f = r.width - r.left - r.right - i.margin * 2, p = r.height - r.top - r.bottom - i.margin * 2;
130
- else {
131
- var w = A(i.container) ? i.container : document.querySelector(i.container), y = w.getBoundingClientRect(), k = y.width, J = y.height, Q = y.left, V = y.top;
132
- r = E({}, r, {
133
- width: k,
134
- height: J,
135
- left: Q,
136
- top: V
137
- });
138
- }
139
- f = f || r.width - i.margin * 2, p = p || r.height - i.margin * 2;
140
- var H = e.zoomedHd || e.original, $ = U(H) ? f : H.naturalWidth || f, ee = U(H) ? p : H.naturalHeight || p, T = H.getBoundingClientRect(), te = T.top, oe = T.left, M = T.width, P = T.height, ne = Math.min(Math.max(M, $), f) / M, re = Math.min(Math.max(P, ee), p) / P, q = Math.min(ne, re), ie = (-oe + (f - M) / 2 + i.margin + r.left) / q, ae = (-te + (p - P) / 2 + i.margin + r.top) / q, R = "scale(" + q + ") translate3d(" + ie + "px, " + ae + "px, 0)";
141
- e.zoomed.style.transform = R, e.zoomedHd && (e.zoomedHd.style.transform = R);
142
- };
143
- return new u(function(l) {
144
- if (n && v.indexOf(n) === -1) {
145
- l(c);
146
- return;
147
- }
148
- var r = function k() {
149
- b = !1, e.zoomed.removeEventListener("transitionend", k), e.original.dispatchEvent(L("medium-zoom:opened", {
150
- detail: { zoom: c }
151
- })), l(c);
152
- };
153
- if (e.zoomed) {
154
- l(c);
155
- return;
156
- }
157
- if (n)
158
- e.original = n;
159
- else if (v.length > 0) {
160
- var f = v;
161
- e.original = f[0];
162
- } else {
163
- l(c);
164
- return;
165
- }
166
- if (e.original.dispatchEvent(L("medium-zoom:open", {
167
- detail: { zoom: c }
168
- })), B = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0, b = !0, e.zoomed = le(e.original), document.body.appendChild(S), i.template) {
169
- var p = A(i.template) ? i.template : document.querySelector(i.template);
170
- e.template = document.createElement("div"), e.template.appendChild(p.content.cloneNode(!0)), document.body.appendChild(e.template);
171
- }
172
- if (e.original.parentElement && e.original.parentElement.tagName === "PICTURE" && e.original.currentSrc && (e.zoomed.src = e.original.currentSrc), document.body.appendChild(e.zoomed), window.requestAnimationFrame(function() {
173
- document.body.classList.add("medium-zoom--opened");
174
- }), e.original.classList.add("medium-zoom-image--hidden"), e.zoomed.classList.add("medium-zoom-image--opened"), e.zoomed.addEventListener("click", z), e.zoomed.addEventListener("transitionend", r), e.original.getAttribute("data-zoom-src")) {
175
- e.zoomedHd = e.zoomed.cloneNode(), e.zoomedHd.removeAttribute("srcset"), e.zoomedHd.removeAttribute("sizes"), e.zoomedHd.removeAttribute("loading"), e.zoomedHd.src = e.zoomed.getAttribute("data-zoom-src"), e.zoomedHd.onerror = function() {
176
- clearInterval(w), console.warn("Unable to reach the zoom image target " + e.zoomedHd.src), e.zoomedHd = null, d();
177
- };
178
- var w = setInterval(function() {
179
- e.zoomedHd.complete && (clearInterval(w), e.zoomedHd.classList.add("medium-zoom-image--opened"), e.zoomedHd.addEventListener("click", z), document.body.appendChild(e.zoomedHd), d());
180
- }, 10);
181
- } else if (e.original.hasAttribute("srcset")) {
182
- e.zoomedHd = e.zoomed.cloneNode(), e.zoomedHd.removeAttribute("sizes"), e.zoomedHd.removeAttribute("loading");
183
- var y = e.zoomedHd.addEventListener("load", function() {
184
- e.zoomedHd.removeEventListener("load", y), e.zoomedHd.classList.add("medium-zoom-image--opened"), e.zoomedHd.addEventListener("click", z), document.body.appendChild(e.zoomedHd), d();
185
- });
186
- } else
187
- d();
188
- });
189
- }, z = function() {
190
- return new u(function(o) {
191
- if (b || !e.original) {
192
- o(c);
193
- return;
194
- }
195
- var n = function d() {
196
- e.original.classList.remove("medium-zoom-image--hidden"), document.body.removeChild(e.zoomed), e.zoomedHd && document.body.removeChild(e.zoomedHd), document.body.removeChild(S), e.zoomed.classList.remove("medium-zoom-image--opened"), e.template && document.body.removeChild(e.template), b = !1, e.zoomed.removeEventListener("transitionend", d), e.original.dispatchEvent(L("medium-zoom:closed", {
197
- detail: { zoom: c }
198
- })), e.original = null, e.zoomed = null, e.zoomedHd = null, e.template = null, o(c);
199
- };
200
- b = !0, document.body.classList.remove("medium-zoom--opened"), e.zoomed.style.transform = "", e.zoomedHd && (e.zoomedHd.style.transform = ""), e.template && (e.template.style.transition = "opacity 150ms", e.template.style.opacity = 0), e.original.dispatchEvent(L("medium-zoom:close", {
201
- detail: { zoom: c }
202
- })), e.zoomed.addEventListener("transitionend", n);
203
- });
204
- }, Z = function() {
205
- var o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, n = o.target;
206
- return e.original ? z() : Y({ target: n });
207
- }, K = function() {
208
- return i;
209
- }, D = function() {
210
- return v;
211
- }, G = function() {
212
- return e.original;
213
- }, v = [], O = [], b = !1, B = 0, i = a, e = {
214
- original: null,
215
- zoomed: null,
216
- zoomedHd: null,
217
- template: null
218
- // If the selector is omitted, it's replaced by the options
219
- };
220
- Object.prototype.toString.call(t) === "[object Object]" ? i = t : (t || typeof t == "string") && C(t), i = E({
221
- margin: 0,
222
- background: "#fff",
223
- scrollOffset: 40,
224
- container: null,
225
- template: null
226
- }, i);
227
- var S = me(i.background);
228
- document.addEventListener("click", g), document.addEventListener("keyup", I), document.addEventListener("scroll", N), window.addEventListener("resize", z);
229
- var c = {
230
- open: Y,
231
- close: z,
232
- toggle: Z,
233
- update: h,
234
- clone: j,
235
- attach: C,
236
- detach: _,
237
- on: F,
238
- off: X,
239
- getOptions: K,
240
- getImages: D,
241
- getZoomedImage: G
242
- };
243
- return c;
244
- };
245
- function ce(m, t) {
246
- t === void 0 && (t = {});
247
- var a = t.insertAt;
248
- if (!(typeof document > "u")) {
249
- var u = document.head || document.getElementsByTagName("head")[0], g = document.createElement("style");
250
- g.type = "text/css", a === "top" && u.firstChild ? u.insertBefore(g, u.firstChild) : u.appendChild(g), g.styleSheet ? g.styleSheet.cssText = m : g.appendChild(document.createTextNode(m));
251
- }
252
- }
253
- var se = ".medium-zoom-overlay{position:fixed;top:0;right:0;bottom:0;left:0;opacity:0;transition:opacity .3s;will-change:opacity}.medium-zoom--opened .medium-zoom-overlay{cursor:pointer;cursor:zoom-out;opacity:1}.medium-zoom-image{cursor:pointer;cursor:zoom-in;transition:transform .3s cubic-bezier(.2,0,.2,1)!important}.medium-zoom-image--hidden{visibility:hidden}.medium-zoom-image--opened{position:relative;cursor:pointer;cursor:zoom-out;will-change:transform}";
254
- ce(se);
255
- const fe = (m) => {
256
- if (!m.selector)
257
- return;
258
- const t = ue(m.zoomOptions);
259
- t.refresh = (a = m.selector) => {
260
- t.detach(), t.attach(a);
261
- }, setTimeout(() => t.refresh(m.selector), m.delay || 1e3);
262
- };
263
- export {
264
- fe as useMediumZoom
265
- };
@@ -1,3 +0,0 @@
1
- export * from './markdown';
2
- export * from './route';
3
- export * from './slug';
@@ -1,2 +0,0 @@
1
- import type { Frontmatter, Pattern } from './types';
2
- export declare const useMarkdownFrontmatter: (pattern: Pattern, excerptSeparator?: string) => Array<Frontmatter>;
@@ -1,15 +0,0 @@
1
- import type { Pattern } from './types';
2
- export declare const useMarkdownFrontmatterRoute: (pattern: Pattern, frontmatterKey: string, excerptSeparator?: string) => {
3
- paths(): {
4
- params: {
5
- slug: string;
6
- };
7
- }[];
8
- };
9
- export declare const useArchiveRoute: (pattern: Pattern, excerptSeparator?: string) => {
10
- paths(): {
11
- params: {
12
- slug: string;
13
- };
14
- }[];
15
- };
@@ -1,7 +0,0 @@
1
- import type { Pattern, StringOrFrontmatterToString } from './types';
2
- export declare const useSlugFromMarkdownFrontMatter: (pattern: Pattern, frontmatterKeyOrMappingFn: StringOrFrontmatterToString, excerptSeparator?: string) => {
3
- params: {
4
- slug: string;
5
- };
6
- }[];
7
- export { useSlug, useSlugFilter } from '../../shared/composables';
@@ -1,7 +0,0 @@
1
- export type Pattern = string | string[];
2
- export type Frontmatter = Record<string, unknown> & {
3
- date?: string;
4
- excerpt?: string;
5
- };
6
- export type FrontmatterToString = (frontmatter: Frontmatter) => string;
7
- export type StringOrFrontmatterToString = string | FrontmatterToString;
@@ -1,45 +0,0 @@
1
- import type { UserConfig } from 'vitepress';
2
- import type { ThemeConfig } from '../client/types';
3
- /**
4
- * @type {import('vitepress').UserConfig}
5
- */
6
- declare const baseConfig: {
7
- themeConfig: {
8
- siteURL: string;
9
- googleAnalytics: {
10
- id: string;
11
- };
12
- search: {
13
- provider: string;
14
- options: {
15
- /**
16
- * @param {string} src
17
- * @param {import('vitepress').MarkdownEnv} env
18
- * @param {import('markdown-it')} md
19
- */
20
- _render(src: any, env: any, md: any): Promise<string>;
21
- };
22
- };
23
- };
24
- vite: {
25
- ssr: {
26
- noExternal: string[];
27
- };
28
- optimizeDeps: {
29
- exclude: string[];
30
- };
31
- css: {
32
- preprocessorOptions: {
33
- scss: {
34
- api: string;
35
- };
36
- };
37
- };
38
- };
39
- };
40
- /**
41
- * Helper function to define theme configuration with proper typing
42
- * Note: TailwindCSS plugin should be added in vite.config.ts, not here
43
- */
44
- export declare function defineWithDefaultThemeConfig(config?: UserConfig<ThemeConfig>): UserConfig<ThemeConfig>;
45
- export default baseConfig;