@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
@@ -6,7 +6,11 @@ import type { ThemeConfig } from '../client/types'
6
6
  process.env.VITE_EXTRA_EXTENSIONS = 'rss'
7
7
  globalThis.__VUE_PROD_DEVTOOLS__ = process.env.NODE_ENV === 'development'
8
8
 
9
- const env = loadEnv(process.env.NODE_ENV || 'development', process.cwd(), 'VITE_')
9
+ const env = loadEnv(
10
+ process.env.NODE_ENV || 'development',
11
+ process.cwd(),
12
+ 'VITE_'
13
+ )
10
14
 
11
15
  const siteURL = env.VITE_BASE_URL
12
16
 
@@ -27,7 +31,7 @@ const baseConfig = {
27
31
  themeConfig: {
28
32
  siteURL,
29
33
  googleAnalytics: {
30
- id: env.VITE_GA_ID,
34
+ id: env.VITE_GA_ID
31
35
  },
32
36
  search: {
33
37
  provider: 'local',
@@ -48,37 +52,39 @@ const baseConfig = {
48
52
  renderedHtml += html
49
53
  }
50
54
  return renderedHtml
51
- },
52
- },
53
- },
55
+ }
56
+ }
57
+ }
54
58
  },
55
59
  vite: {
56
60
  ssr: {
57
- noExternal: deps,
61
+ noExternal: deps
58
62
  },
59
63
  optimizeDeps: {
60
- exclude: deps,
64
+ exclude: deps
61
65
  },
62
66
  css: {
63
67
  preprocessorOptions: {
64
68
  scss: {
65
- api: 'modern-compiler',
66
- },
67
- },
68
- },
69
- },
69
+ api: 'modern-compiler'
70
+ }
71
+ }
72
+ }
73
+ }
70
74
  }
71
75
 
72
76
  /**
73
77
  * Helper function to define theme configuration with proper typing
74
78
  * Note: TailwindCSS plugin should be added in vite.config.ts, not here
75
79
  */
76
- export function defineWithDefaultThemeConfig(config: UserConfig<ThemeConfig> = {}): UserConfig<ThemeConfig> {
80
+ export function defineWithDefaultThemeConfig(
81
+ config: UserConfig<ThemeConfig> = {}
82
+ ): UserConfig<ThemeConfig> {
77
83
  // Rename 'footer' to 'themeFooter' to avoid conflict with VitePress built-in footer config
78
84
  if (config.themeConfig?.footer) {
79
85
  config.themeConfig = {
80
86
  ...config.themeConfig,
81
- themeFooter: config.themeConfig.footer,
87
+ themeFooter: config.themeConfig.footer
82
88
  }
83
89
  delete config.themeConfig.footer
84
90
  }
@@ -9,4 +9,5 @@ export const useSlug = (str: string) => {
9
9
  .replace(/^-+|-+$/g, '') // Remove leading or trailing dashes
10
10
  }
11
11
 
12
- export const useSlugFilter = (slug: string) => (str: string) => useSlug(str) === slug
12
+ export const useSlugFilter = (slug: string) => (str: string) =>
13
+ useSlug(str) === slug
package/src/vite-env.d.ts CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  declare module '*.vue' {
4
4
  import type { Component } from 'vue'
5
+
5
6
  const component: Component
6
7
  export default component
7
8
  }
@@ -1,76 +0,0 @@
1
- import { defineComponent as c, computed as d, openBlock as r, createElementBlock as l, createElementVNode as p, normalizeStyle as u, Fragment as f, renderList as g, createBlock as h, mergeProps as B } from "vue";
2
- const _ = {
3
- buymeacoffee: {
4
- donationBaseUrl: "https://buymeacoffee.com",
5
- donationButtonImage: "https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png",
6
- donationButtonStyle: {
7
- height: "60px !important",
8
- width: "217px !important"
9
- }
10
- },
11
- kofi: {
12
- donationBaseUrl: "https://ko-fi.com",
13
- donationButtonImage: "https://storage.ko-fi.com/cdn/brandasset/kofi_bg_tag_white.png",
14
- donationButtonStyle: {
15
- height: "60px !important"
16
- }
17
- },
18
- paypal: {
19
- donationBaseUrl: "https://paypal.me",
20
- donationButtonImage: "https://paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"
21
- }
22
- }, y = ["href"], b = ["src", "alt"], k = /* @__PURE__ */ c({
23
- __name: "DonationButton",
24
- props: {
25
- donationPlatform: {},
26
- donationId: {},
27
- donationBaseUrl: {},
28
- donationButtonImage: {},
29
- donationButtonStyle: {}
30
- },
31
- setup(t) {
32
- const i = t, o = d(() => new URL(i.donationId, i.donationBaseUrl).toString());
33
- return (s, e) => (r(), l("a", {
34
- href: o.value,
35
- target: "_blank"
36
- }, [
37
- p("img", {
38
- src: t.donationButtonImage,
39
- alt: t.donationPlatform,
40
- style: u(t.donationButtonStyle)
41
- }, null, 12, b)
42
- ], 8, y));
43
- }
44
- }), U = /* @__PURE__ */ c({
45
- __name: "Donation",
46
- props: {
47
- donation: {}
48
- },
49
- setup(t) {
50
- const o = t.donation, s = d(() => {
51
- const e = {};
52
- for (const n in o) {
53
- if (n === "custom")
54
- continue;
55
- const a = o[n];
56
- e[n] = {
57
- ..._[n],
58
- donationId: a
59
- };
60
- }
61
- return {
62
- ...e,
63
- ...o.custom
64
- };
65
- });
66
- return (e, n) => (r(!0), l(f, null, g(s.value, (a, m) => (r(), h(k, B({
67
- key: a?.name,
68
- ref_for: !0
69
- }, a, {
70
- "donation-platform": m
71
- }), null, 16, ["donation-platform"]))), 128));
72
- }
73
- });
74
- export {
75
- U as default
76
- };
@@ -1,29 +0,0 @@
1
- import { defineComponent as c, onMounted as r } from "vue";
2
- const g = /* @__PURE__ */ c({
3
- __name: "GoogleAnalytics",
4
- props: {
5
- googleAnalytics: {}
6
- },
7
- setup(o) {
8
- const e = o.googleAnalytics;
9
- let a = !1;
10
- function i() {
11
- if (!(window.dataLayer && window.gtag) && !a) {
12
- a = !0;
13
- const t = document.createElement("script");
14
- t.src = `https://www.googletagmanager.com/gtag/js?id=${e.id}`, t.async = !0, document.head.appendChild(t);
15
- const n = document.createElement("script");
16
- n.textContent = `
17
- window.dataLayer = window.dataLayer || [];
18
- function gtag(){dataLayer.push(arguments);}
19
- gtag('js', new Date());
20
- gtag('config', '${e.id}');
21
- `, document.head.appendChild(n);
22
- }
23
- }
24
- return e && r(i), (t, n) => null;
25
- }
26
- });
27
- export {
28
- g as default
29
- };
@@ -1,190 +0,0 @@
1
- import { defineComponent as h, computed as a, openBlock as l, createElementBlock as u, createBlock as b, unref as z, createCommentVNode as m, Fragment as w, createTextVNode as B, toDisplayString as y, normalizeClass as p, createElementVNode as v, renderList as U } from "vue";
2
- import { useData as L } from "vitepress";
3
- import { Icon as R } from "@iconify/vue";
4
- const _ = (s) => {
5
- if (!s)
6
- return "";
7
- const t = encodeURIComponent, r = Object.keys(s);
8
- return r.length < 1 ? "" : `?${r.filter((e) => s[e] !== void 0).map((e) => `${t(e)}=${t(s[e])}`).join("&")}`;
9
- }, P = ["href", "aria-label"], M = /* @__PURE__ */ h({
10
- __name: "SharingButton",
11
- props: {
12
- url: {},
13
- text: {},
14
- network: {},
15
- buttonSize: {},
16
- iconStyle: {},
17
- iconSize: { default: 32 },
18
- displayMode: { default: "icon" }
19
- },
20
- setup(s) {
21
- const t = s, r = a(() => {
22
- switch (t.network) {
23
- case "email":
24
- return {
25
- name: "E-mail",
26
- shareBaseURL: "mailto:",
27
- icon: "bi:envelope-fill",
28
- params: { subject: t.text, body: t.url },
29
- allowedParams: ["subject", "body"]
30
- };
31
- case "facebook":
32
- return {
33
- name: "Facebook",
34
- shareBaseURL: "https://facebook.com/sharer/sharer.php",
35
- icon: "bi:facebook",
36
- params: { u: t.url },
37
- allowedParams: ["u", "display", "redirect_uri"]
38
- };
39
- case "linkedin":
40
- return {
41
- name: "LinkedIn",
42
- shareBaseURL: "https://www.linkedin.com/sharing/share-offsite",
43
- icon: "bi:linkedin",
44
- params: { url: t.url },
45
- allowedParams: ["url"]
46
- };
47
- case "pinterest":
48
- return {
49
- name: "Pinterest",
50
- shareBaseURL: "https://pinterest.com/pin/create/button",
51
- icon: "bi:pinterest",
52
- params: { posttype: "link", title: t.text, url: t.url },
53
- allowedParams: ["posttype", "tags", "title", "content", "caption", "show-via", "canonicalUrl"]
54
- };
55
- case "reddit":
56
- return {
57
- name: "Reddit",
58
- shareBaseURL: "https://www.reddit.com/submit",
59
- icon: "bi:reddit",
60
- params: { title: t.text, url: t.url },
61
- allowedParams: ["title", "url"]
62
- };
63
- case "telegram":
64
- return {
65
- name: "Telegram",
66
- shareBaseURL: "https://telegram.me/share/url",
67
- icon: "bi:telegram",
68
- params: { text: t.text, url: t.url },
69
- allowedParams: ["text", "url"]
70
- };
71
- // case 'tumblr':
72
- // return {
73
- // name: 'Tumblr',
74
- // shareBaseURL: 'https://www.tumblr.com/widgets/share/tool',
75
- // icon: 'bi:tumblr',
76
- // params: { posttype: 'link', title: props.text, url: props.url },
77
- // allowedParams: ['posttype', 'tags', 'title', 'content', 'caption', 'show-via', 'canonicalUrl'],
78
- // }
79
- case "twitter":
80
- return {
81
- name: "Twitter",
82
- shareBaseURL: "https://twitter.com/intent/tweet",
83
- icon: "bi:twitter",
84
- params: { text: t.text, url: t.url },
85
- allowedParams: ["text", "url", "hashtag", "via"]
86
- };
87
- // case 'vk':
88
- // return {
89
- // name: 'VK',
90
- // shareBaseURL: 'https://vk.com/share.php',
91
- // icon: 'vk-icon',
92
- // params: { title: props.text, url: props.url },
93
- // allowedParams: ['title', 'url'],
94
- // }
95
- case "whatsapp":
96
- return {
97
- name: "WhatsApp",
98
- shareBaseURL: "whatsapp://send",
99
- icon: "bi:whatsapp",
100
- params: { text: t.url },
101
- allowedParams: ["text"]
102
- };
103
- default:
104
- return {};
105
- }
106
- }), n = a(() => r.value.name), e = a(() => r.value.icon), c = a(() => {
107
- const o = r.value.shareBaseURL, i = _(r.value.params);
108
- return `${o}${i}`;
109
- });
110
- return (o, i) => (l(), u("a", {
111
- href: c.value,
112
- target: "_blank",
113
- rel: "noopener",
114
- "aria-label": n.value,
115
- style: { "padding-left": "0.25rem", "padding-right": "0.25rem" }
116
- }, [
117
- ["icon", "both"].includes(t.displayMode) ? (l(), b(z(R), {
118
- key: 0,
119
- icon: e.value,
120
- width: s.iconSize,
121
- height: s.iconSize,
122
- class: "fill-current text-gray-700 dark:text-gray-200 hover:text-blue-500 dark:hover:text-blue-400"
123
- }, null, 8, ["icon", "width", "height"])) : m("", !0),
124
- ["text", "both"].includes(t.displayMode) ? (l(), u(w, { key: 1 }, [
125
- B(" " + y(n.value), 1)
126
- ], 64)) : m("", !0)
127
- ], 8, P));
128
- }
129
- }), E = /* @__PURE__ */ h({
130
- __name: "Sharing",
131
- props: {
132
- url: {},
133
- text: {}
134
- },
135
- setup(s) {
136
- const t = {
137
- wrapperCssClass: "pl-4 py-4",
138
- titleCssClass: "text-sm/[32px] font-semibold mb-2",
139
- buttonCssClass: "flex flex-wrap space-x-1",
140
- title: "Share",
141
- networks: ["email", "facebook", "twitter", "telegram", "reddit", "linkedin", "whatsapp", "pinterest", "tumblr", "vk"],
142
- buttonSize: 18,
143
- iconSize: 20,
144
- iconStyle: "solid",
145
- displayMode: "both"
146
- }, r = s, { theme: n } = L(), e = a(() => n.value.sharing || !1), c = a(
147
- () => e.value && typeof e.value.wrapperCssClass == "string" ? e.value.wrapperCssClass : t.wrapperCssClass
148
- ), o = a(
149
- () => e.value && typeof e.value.title == "string" ? e.value.title : t.title
150
- ), i = a(
151
- () => e.value && typeof e.value.titleCssClass == "string" ? e.value.titleCssClass : t.titleCssClass
152
- ), f = a(
153
- () => e.value && typeof e.value.buttonCssClass == "string" ? e.value.buttonCssClass : t.buttonCssClass
154
- ), C = a(
155
- () => e.value && Array.isArray(e.value.networks) ? e.value.networks : t.networks
156
- ), g = a(
157
- () => e.value && Number.isInteger(e.value.buttonSize) && e.value.buttonSize > 0 ? e.value.buttonSize : t.buttonSize
158
- ), k = a(
159
- () => e.value && Number.isInteger(e.value.iconSize) && e.value.iconSize > 0 ? e.value.iconSize : t.iconSize
160
- ), x = a(
161
- () => e.value && typeof e.value.iconStyle == "string" ? e.value.iconStyle : t.iconStyle
162
- ), S = a(
163
- () => e.value && typeof e.value.displayMode == "string" ? e.value.displayMode : t.displayMode
164
- );
165
- return (I, N) => (l(), u("div", {
166
- class: p(c.value)
167
- }, [
168
- v("p", {
169
- class: p(i.value)
170
- }, y(o.value), 3),
171
- v("div", {
172
- class: p(f.value)
173
- }, [
174
- (l(!0), u(w, null, U(C.value, (d) => (l(), b(M, {
175
- key: d,
176
- url: r.url,
177
- text: r.text,
178
- network: d,
179
- "button-size": g.value,
180
- "icon-size": k.value,
181
- "icon-style": x.value,
182
- "display-mode": S.value
183
- }, null, 8, ["url", "text", "network", "button-size", "icon-size", "icon-style", "display-mode"]))), 128))
184
- ], 2)
185
- ], 2));
186
- }
187
- });
188
- export {
189
- E as default
190
- };