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