valaxy 0.3.10 → 0.5.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 (147) hide show
  1. package/README.md +4 -0
  2. package/{src/client → client}/App.vue +0 -0
  3. package/{src/client → client}/components/AppLink.vue +0 -0
  4. package/{src/client → client}/components/PostCard.vue +37 -23
  5. package/{src/client → client}/components/PostList.vue +0 -0
  6. package/{src/client → client}/components/README.md +0 -0
  7. package/{src/client → client}/components/ValaxyBg.vue +1 -1
  8. package/{src/client → client}/components/ValaxyCopyright.vue +0 -0
  9. package/{src/client → client}/components/ValaxyFooter.vue +2 -2
  10. package/{src/client → client}/components/ValaxyHamburger.vue +0 -0
  11. package/{src/client → client}/components/ValaxyMd.vue +1 -5
  12. package/{src/client → client}/components/ValaxyOverlay.vue +0 -0
  13. package/{src/client → client}/components/ValaxyPagination.vue +0 -0
  14. package/{src/client → client}/components/ValaxyRightSidebar.vue +0 -0
  15. package/{src/client → client}/components/ValaxySidebar.vue +0 -0
  16. package/{src/client → client}/components/ValaxyToc.vue +0 -0
  17. package/{src/client → client}/composables/category.ts +0 -0
  18. package/{src/client → client}/composables/comments/index.ts +0 -0
  19. package/{src/client → client}/composables/comments/twikoo.ts +0 -0
  20. package/{src/client → client}/composables/comments/waline.ts +0 -0
  21. package/{src/client → client}/composables/common.ts +0 -0
  22. package/{src/client → client}/composables/dark.ts +0 -0
  23. package/{src/client/composables/search → client/composables/features}/index.ts +0 -0
  24. package/{src/client → client}/composables/helper.ts +0 -0
  25. package/{src/client → client}/composables/index.ts +1 -1
  26. package/{src/client → client}/composables/layout.ts +0 -0
  27. package/{src/client → client}/composables/post.ts +0 -0
  28. package/client/composables/search/index.ts +0 -0
  29. package/{src/client → client}/composables/sidebar.ts +10 -8
  30. package/{src/client → client}/composables/tag.ts +0 -0
  31. package/{src/client → client}/composables/widgets/aplayer.ts +0 -0
  32. package/{src/client → client}/composables/widgets/backToTop.ts +0 -0
  33. package/{src/client → client}/composables/widgets/codepen.ts +0 -0
  34. package/{src/client → client}/composables/widgets/index.ts +0 -0
  35. package/{src/client → client}/config.ts +2 -1
  36. package/{src/client → client}/index.html +0 -0
  37. package/{src/client → client}/index.ts +0 -0
  38. package/{src/client → client}/layouts/404.vue +0 -0
  39. package/{src/client → client}/layouts/README.md +0 -0
  40. package/{src/client → client}/locales/README.md +0 -0
  41. package/{src/client → client}/locales/en.yml +1 -0
  42. package/{src/client → client}/locales/zh-CN.yml +4 -3
  43. package/{src/client → client}/main.ts +5 -1
  44. package/{src/client → client}/modules/README.md +0 -0
  45. package/{src/client → client}/modules/nprogress.ts +0 -0
  46. package/{src/client → client}/modules/pinia.ts +0 -0
  47. package/{src/client → client}/modules/valaxy.ts +1 -1
  48. package/{src/client → client}/pages/README.md +0 -0
  49. package/{src/client → client}/pages/[...all].vue +0 -0
  50. package/{src/client → client}/pages/hi/[name].vue +0 -0
  51. package/{src/client → client}/pages/index.vue +0 -0
  52. package/{src/client → client}/pages/page/[page].vue +0 -0
  53. package/{src/client → client}/shims.d.ts +1 -0
  54. package/{src/client → client}/stores/app.ts +0 -0
  55. package/{src/client → client}/stores/user.ts +0 -0
  56. package/{src/client → client}/styles/common/button.scss +0 -0
  57. package/{src/client → client}/styles/common/code.scss +0 -0
  58. package/{src/client → client}/styles/common/custom-blocks.scss +0 -0
  59. package/{src/client → client}/styles/common/hamburger.scss +0 -0
  60. package/{src/client → client}/styles/common/markdown.scss +5 -1
  61. package/client/styles/common/scrollbar.scss +28 -0
  62. package/{src/client → client}/styles/common/sidebar.scss +0 -0
  63. package/{src/client → client}/styles/common/transition.scss +0 -0
  64. package/{src/client → client}/styles/css-vars.scss +0 -0
  65. package/{src/client → client}/styles/global/helper.scss +0 -0
  66. package/{src/client → client}/styles/global/i18n.scss +0 -0
  67. package/{src/client → client}/styles/global/index.scss +0 -0
  68. package/{src/client → client}/styles/global/nprogress.scss +0 -0
  69. package/{src/client → client}/styles/global/reset.scss +0 -0
  70. package/{src/client → client}/styles/index.scss +0 -0
  71. package/{src/client → client}/styles/mixins/config.scss +0 -0
  72. package/{src/client → client}/styles/mixins/index.scss +0 -0
  73. package/{src/client → client}/styles/mixins/size.scss +0 -0
  74. package/{src/client → client}/styles/mixins/variable.scss +0 -0
  75. package/{src/client → client}/styles/palette.scss +0 -0
  76. package/client/styles/third/katex.scss +3 -0
  77. package/{src/client → client}/styles/vars.scss +0 -0
  78. package/{src/client → client}/styles/widgets/banner.scss +0 -0
  79. package/{src/client → client}/types.ts +0 -0
  80. package/{src/client → client}/utils/helper.ts +0 -0
  81. package/{src/client → client}/utils/index.ts +0 -0
  82. package/{src/client → client}/utils/time.ts +0 -0
  83. package/dist/chunk-EAN2KU6W.mjs +1 -0
  84. package/dist/chunk-RSQONJW3.mjs +86 -0
  85. package/dist/chunk-U5OMNIOK.js +1 -0
  86. package/dist/chunk-XQIGHIAX.js +86 -0
  87. package/dist/client/index.d.ts +188 -0
  88. package/dist/client/index.js +1 -0
  89. package/dist/client/index.mjs +1 -0
  90. package/dist/{config-de04677b.d.ts → config-7bd43d41.d.ts} +24 -12
  91. package/dist/node/cli.js +10 -10
  92. package/dist/node/cli.mjs +10 -10
  93. package/dist/node/index.d.ts +2 -2
  94. package/dist/node/index.js +1 -1
  95. package/dist/node/index.mjs +1 -1
  96. package/dist/posts-32f55e33.d.ts +117 -0
  97. package/dist/types/index.d.ts +8 -0
  98. package/dist/types/index.js +1 -0
  99. package/dist/types/index.mjs +0 -0
  100. package/index.d.ts +3 -0
  101. package/{src/node → node}/build.ts +0 -0
  102. package/{src/node → node}/cli.ts +3 -2
  103. package/node/config.ts +170 -0
  104. package/{src/node → node}/index.ts +0 -0
  105. package/{src/node → node}/markdown/check.ts +0 -0
  106. package/{src/node → node}/markdown/highlight.ts +0 -0
  107. package/{src/node → node}/markdown/index.ts +0 -0
  108. package/{src/node → node}/markdown/markdown-it/container.ts +0 -0
  109. package/{src/node → node}/markdown/markdown-it/headings.ts +0 -0
  110. package/{src/node → node}/markdown/markdown-it/highlightLines.ts +0 -0
  111. package/{src/node → node}/markdown/markdown-it/katex.ts +0 -0
  112. package/{src/node → node}/markdown/markdown-it/parseHeader.ts +0 -0
  113. package/{src/node → node}/markdown/slugify.ts +0 -0
  114. package/{src/node → node}/options.ts +2 -2
  115. package/{src/node → node}/plugins/extendConfig.ts +3 -1
  116. package/{src/node → node}/plugins/index.ts +10 -3
  117. package/{src/node → node}/plugins/markdown.ts +3 -6
  118. package/{src/node → node}/plugins/preset.ts +0 -30
  119. package/{src/node → node}/plugins/unocss.ts +0 -0
  120. package/{src/node → node}/plugins/valaxy.ts +0 -0
  121. package/{src/node → node}/rss.ts +0 -0
  122. package/{src/node → node}/server.ts +6 -4
  123. package/{src/node → node}/shims.d.ts +0 -0
  124. package/{src/node → node}/utils/cli.ts +1 -1
  125. package/node/utils/index.ts +48 -0
  126. package/node/utils/net.ts +20 -0
  127. package/{src/node → node}/vite.ts +5 -1
  128. package/package.json +21 -16
  129. package/tsup.config.ts +4 -3
  130. package/{src/types → types}/config.ts +27 -107
  131. package/{src/types → types}/index.ts +0 -0
  132. package/{src/types → types}/posts.ts +5 -0
  133. package/dist/chunk-6QPICP7C.mjs +0 -1
  134. package/dist/chunk-PICIUZML.js +0 -83
  135. package/dist/chunk-S2VGPR56.mjs +0 -83
  136. package/dist/chunk-ZP4HS4GX.js +0 -1
  137. package/dist/index.d.ts +0 -407
  138. package/dist/index.js +0 -1
  139. package/dist/index.mjs +0 -1
  140. package/src/client/composables/features/index.ts +0 -1
  141. package/src/client/composables/features/katex.ts +0 -15
  142. package/src/client/composables/search/algolia.ts +0 -115
  143. package/src/client/modules/pwa.ts +0 -12
  144. package/src/client/styles/common/scrollbar.scss +0 -34
  145. package/src/index.ts +0 -2
  146. package/src/node/config.ts +0 -52
  147. package/src/node/utils/index.ts +0 -26
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var c=Object.create;var a=Object.defineProperty,m=Object.defineProperties,p=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyDescriptors,d=Object.getOwnPropertyNames,r=Object.getOwnPropertySymbols,y=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable;var s=(e,n,i)=>n in e?a(e,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[n]=i,h= exports.a =(e,n)=>{for(var i in n||(n={}))l.call(n,i)&&s(e,i,n[i]);if(r)for(var i of r(n))f.call(n,i)&&s(e,i,n[i]);return e},b= exports.b =(e,n)=>m(e,u(n));var k=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(n,i)=>(typeof require!="undefined"?require:n)[i]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var v=(e,n)=>()=>(e&&(n=e(e=0)),n);var x=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),w= exports.f =(e,n)=>{for(var i in n)a(e,i,{get:n[i],enumerable:!0})},g=(e,n,i,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of d(n))!l.call(e,t)&&t!==i&&a(e,t,{get:()=>n[t],enumerable:!(o=p(n,t))||o.enumerable});return e};var C=(e,n,i)=>(i=e!=null?c(y(e)):{},g(n||!e||!e.__esModule?a(i,"default",{value:e,enumerable:!0}):i,e)),V= exports.h =e=>g(a({},"__esModule",{value:!0}),e);var Y={url:"",lang:"en",title:"Valaxy Blog",description:"A blog generated by Valaxy.",subtitle:"Next Generation Static Blog Framework.",author:{avatar:"https://cdn.jsdelivr.net/gh/YunYouJun/yun/images/meme/yun-good-with-bg.jpg",email:"me@yunyoujun.cn",link:"https://www.yunyoujun.cn",name:"YunYouJun",status:{emoji:"\u{1F60A}",message:"All at sea."}},favicon:"favicon.svg",feed:{name:"",favicon:"favicon.svg"},social:[],license:{enabled:!0,language:"",type:"by-nc-sa"},sponsor:{enable:!0,title:"\u6211\u5F88\u53EF\u7231\uFF0C\u8BF7\u7ED9\u6211\u94B1",methods:[{name:"\u652F\u4ED8\u5B9D",url:"https://cdn.jsdelivr.net/gh/YunYouJun/cdn/img/donate/alipay-qrcode.jpg",color:"#00A3EE",icon:"i-ri-alipay-line"},{name:"QQ \u652F\u4ED8",url:"https://cdn.jsdelivr.net/gh/YunYouJun/cdn/img/donate/qqpay-qrcode.png",color:"#12B7F5",icon:"i-ri-qq-line"},{name:"\u5FAE\u4FE1\u652F\u4ED8",url:"https://cdn.jsdelivr.net/gh/YunYouJun/cdn/img/donate/wechatpay-qrcode.jpg",color:"#2DC100",icon:"i-ri-wechat-pay-line"}]},search:{algolia:{enable:!1,appId:"",apiKey:"",indexName:"",chunkSize:5e3}},comment:{waline:{enable:!1,serverURL:""},twikoo:{enable:!1,envId:"https://twikoo.vercel.app"}},theme:"yun",themeConfig:{pkg:{name:"",version:""}},unocss:{},markdown:{excerpt:"<!-- more -->"},markdownIt:{toc:{includeLevel:[1,2,3,4],listType:"ol"},katex:{}}};exports.a = h; exports.b = b; exports.c = k; exports.d = v; exports.e = x; exports.f = w; exports.g = C; exports.h = V; exports.i = Y;
package/dist/index.d.ts DELETED
@@ -1,407 +0,0 @@
1
- import * as vue from 'vue';
2
- import { InjectionKey, ComputedRef, Ref, StyleValue } from 'vue';
3
- import { V as ValaxyConfig, a as ValaxyThemeConfig } from './config-de04677b.js';
4
- export { S as SocialLink, U as UserConfig, V as ValaxyConfig, a as ValaxyThemeConfig, d as defaultValaxyConfig } from './config-de04677b.js';
5
- import 'type-fest';
6
- import 'unocss/vite';
7
- import 'markdown-it';
8
- import 'markdown-it-anchor';
9
- import 'katex';
10
- import 'vite-plugin-md';
11
-
12
- interface Post extends Record<string, any> {
13
- /**
14
- * Path of post
15
- * route.path
16
- * @description 路径
17
- */
18
- path?: string;
19
- /**
20
- * Title
21
- * @description 文章标题
22
- */
23
- title?: string;
24
- date?: string | number | Date;
25
- /**
26
- * Updated Time
27
- */
28
- updated?: string | number | Date;
29
- lang?: string;
30
- /**
31
- * TODO
32
- * Read Time
33
- * @description 阅读时长
34
- */
35
- duration?: string;
36
- /**
37
- * post card type, can be bilibili/yuque/...
38
- */
39
- type?: string;
40
- /**
41
- * override url, and jump directly
42
- */
43
- url?: string;
44
- /**
45
- * @description 摘要
46
- */
47
- excerpt?: string;
48
- /**
49
- * Display sponsor info
50
- * @description 是否开启赞助
51
- */
52
- sponsor?: boolean;
53
- /**
54
- * Copyright
55
- * @description 是否显示文章底部版权信息
56
- */
57
- copyright?: boolean;
58
- /**
59
- * Category
60
- * @description 分类,若为数组,则按顺序代表多层文件夹
61
- */
62
- categories?: string | string[];
63
- /**
64
- * Tags
65
- * @description 标签,可以有多个
66
- */
67
- tags?: string[];
68
- /**
69
- * display prev next
70
- * @description 是否显示前一篇、后一篇导航
71
- */
72
- nav?: boolean;
73
- /**
74
- * icon before title
75
- */
76
- icon?: string;
77
- /**
78
- * title color
79
- */
80
- color?: string;
81
- /**
82
- * display comment
83
- */
84
- comment?: boolean;
85
- /**
86
- * post is end
87
- * @description 是否完结,将在末尾添加衬线字体 Q.E.D.
88
- */
89
- end?: boolean;
90
- /**
91
- * use aplayer
92
- */
93
- aplayer?: boolean;
94
- /**
95
- * use katex
96
- */
97
- katex?: boolean;
98
- /**
99
- * use codepen
100
- */
101
- codepen?: boolean;
102
- /**
103
- * 置顶
104
- */
105
- top?: number;
106
- /**
107
- * display toc
108
- * @description 是否显示目录
109
- */
110
- toc?: boolean;
111
- /**
112
- * is draft
113
- * @description 是否为草稿
114
- */
115
- draft?: boolean;
116
- /**
117
- * enable markdown-body class
118
- * @description 是否启用默认的 markdown 样式
119
- */
120
- markdown: boolean;
121
- }
122
-
123
- /**
124
- * Theme Config
125
- */
126
- interface ThemeConfig {
127
- safelist: string[];
128
- colors: {
129
- /**
130
- * primary color
131
- * @default '#0078E7'
132
- */
133
- primary: string;
134
- };
135
- /**
136
- * 首页标语
137
- */
138
- banner: {
139
- enable: boolean;
140
- /**
141
- * 标题
142
- */
143
- title: string;
144
- };
145
- bg_image: {
146
- enable: boolean;
147
- url: string;
148
- dark?: string;
149
- opacity?: number;
150
- };
151
- /**
152
- * say something
153
- * https://say.elpsy.cn
154
- */
155
- say: {
156
- enable: boolean;
157
- api: string;
158
- hitokoto: {
159
- enable: boolean;
160
- api: string;
161
- };
162
- };
163
- pages: {
164
- name: string;
165
- url: string;
166
- icon: string;
167
- color: string;
168
- }[];
169
- /**
170
- * footer
171
- */
172
- footer: {
173
- /**
174
- * 建站于
175
- */
176
- since: number;
177
- /**
178
- * Icon between year and copyright info.
179
- */
180
- icon: {
181
- /**
182
- * icon name, i-xxx
183
- */
184
- name: string;
185
- animated: boolean;
186
- color: string;
187
- url: string;
188
- title: string;
189
- };
190
- /**
191
- * Powered by valaxy & valaxy-theme-${name}, default is yun
192
- */
193
- powered: boolean;
194
- /**
195
- * Chinese Users | 中国用户
196
- * 备案 ICP
197
- * 国内用户需要在网站页脚展示备案 ICP 号
198
- * https://beian.miit.gov.cn/
199
- */
200
- beian: {
201
- enable: boolean;
202
- /**
203
- * 苏ICP备xxxxxxxx号
204
- */
205
- icp: string;
206
- };
207
- };
208
- /**
209
- * post card types
210
- */
211
- types: Record<string, {
212
- color: string;
213
- icon: string;
214
- }>;
215
- /**
216
- * 菜单栏
217
- */
218
- menu: {
219
- custom: {
220
- title: string;
221
- url: string;
222
- icon: string;
223
- };
224
- };
225
- }
226
-
227
- declare const valaxyConfigSymbol: InjectionKey<ComputedRef<ValaxyConfig<ThemeConfig>>>;
228
- declare const valaxyConfigRef: vue.ShallowRef<ValaxyConfig<ValaxyThemeConfig>>;
229
- declare function initConfig(): ComputedRef<ValaxyConfig<ValaxyThemeConfig>>;
230
- declare function useConfig(): ComputedRef<ValaxyConfig<ThemeConfig>>;
231
- /**
232
- * getThemeConfig
233
- * @returns
234
- */
235
- declare function useThemeConfig(): ComputedRef<ThemeConfig & {
236
- pkg: {
237
- [key: string]: any;
238
- name: string;
239
- version: string;
240
- homepage?: string | undefined;
241
- };
242
- }>;
243
-
244
- interface BaseCategory {
245
- total: number;
246
- }
247
- interface ParentCategory extends BaseCategory {
248
- children: Categories;
249
- }
250
- interface PostCategory extends BaseCategory {
251
- posts: Post[];
252
- }
253
- declare type Category = ParentCategory | PostCategory;
254
- declare type Categories = Map<string, Category>;
255
- declare const isParentCategory: (category: any) => category is ParentCategory;
256
- /**
257
- * get categories from posts
258
- * @returns
259
- */
260
- declare function useCategory(category?: string, posts?: Post[]): ParentCategory;
261
-
262
- declare const usePostTitle: (post: Ref<Post>) => vue.ComputedRef<any>;
263
- /**
264
- * get post list
265
- * todo: use vue provide/inject to global
266
- * @param params
267
- * @returns
268
- */
269
- declare function usePostList(params?: {
270
- type?: string;
271
- }): vue.ComputedRef<Post[]>;
272
- /**
273
- * get all page
274
- * @returns
275
- */
276
- declare function usePageList(): vue.ComputedRef<any[]>;
277
- /**
278
- * get prev and next post
279
- * @param path
280
- * @returns
281
- */
282
- declare function usePrevNext(path?: string): vue.ComputedRef<Post | null>[];
283
- /**
284
- * get type card property
285
- * todo: test reactive
286
- */
287
- declare function usePostProperty(type?: string): {
288
- color: string;
289
- icon: string;
290
- styles: {};
291
- } | {
292
- color: string;
293
- icon: string;
294
- styles: vue.ComputedRef<StyleValue>;
295
- };
296
-
297
- declare type Tags = Map<string, {
298
- count: number;
299
- }>;
300
- /**
301
- * get utils about tags
302
- */
303
- declare function useTags(options?: {
304
- /**
305
- * Primary Color
306
- */
307
- primary: string;
308
- }): {
309
- tags: Tags;
310
- getTagStyle: (count: number) => {
311
- '--yun-tag-color': string;
312
- fontSize: string;
313
- };
314
- };
315
- /**
316
- * get tag map
317
- * @returns
318
- */
319
- declare function useTag(): Tags;
320
-
321
- declare function useFrontmatter(): vue.ComputedRef<Post>;
322
- /**
323
- * get full url
324
- */
325
- declare function useFullUrl(): vue.ComputedRef<string>;
326
-
327
- /**
328
- * use katex css cdn
329
- */
330
- declare function useKatex(): void;
331
-
332
- /**
333
- * trigger show invisible element
334
- * @param target
335
- * @returns
336
- */
337
- declare function useInvisibleElement(target: Ref<HTMLElement>): {
338
- show: () => void;
339
- };
340
-
341
- declare const isDark: vue.WritableComputedRef<boolean>;
342
- declare const toggleDark: (value?: boolean | undefined) => boolean;
343
-
344
- declare function useLayout(layout: string): vue.ComputedRef<boolean>;
345
-
346
- /**
347
- * use MetingJS and Aplayer
348
- * https://github.com/MoePlayer/APlayer
349
- * https://github.com/metowolf/MetingJS
350
- */
351
- declare function useAplayer(): void;
352
-
353
- /**
354
- * You can use href="#" to back to top
355
- * @description 你可以使用它来编写自己的 backToTop
356
- */
357
- declare function useBackToTop(options?: {
358
- /**
359
- * show backToTop button, when height > offset
360
- */
361
- offset: number;
362
- }): {
363
- percentage: vue.Ref<number>;
364
- show: vue.Ref<boolean>;
365
- } | {
366
- percentage: vue.ComputedRef<number>;
367
- show: vue.ComputedRef<boolean>;
368
- };
369
-
370
- declare function useCodePen(): void;
371
-
372
- declare function useActiveSidebarLinks(container: Ref<HTMLElement>, marker: Ref<HTMLElement>): void;
373
-
374
- declare function useTwikoo(options?: {}): void;
375
-
376
- declare function useWaline(options?: {}): any;
377
-
378
- /**
379
- * 生成介于 min 与 max 之间的随机数
380
- * @returns
381
- */
382
- declare function random(min: number, max: number): number;
383
- /**
384
- * wrap node
385
- * @param className
386
- */
387
- declare function wrap(el: HTMLElement, className: string): void;
388
- /**
389
- * 包裹表格,添加 class 以控制 table 样式
390
- */
391
- declare const wrapTable: (container?: HTMLElement | Document) => void;
392
-
393
- /**
394
- * use dayjs format date
395
- * @param date
396
- * @param template
397
- * @returns
398
- */
399
- declare function formatDate(date: string | number | Date, template?: string): string;
400
- /**
401
- * sort posts by date
402
- * @param posts
403
- * @param desc
404
- */
405
- declare function sortByDate(posts: Post[], desc?: boolean): Post[];
406
-
407
- export { BaseCategory, Categories, Category, ParentCategory, Post, PostCategory, Tags, formatDate, initConfig, isDark, isParentCategory, random, sortByDate, toggleDark, useActiveSidebarLinks, useAplayer, useBackToTop, useCategory, useCodePen, useConfig, useFrontmatter, useFullUrl, useInvisibleElement, useKatex, useLayout, usePageList, usePostList, usePostProperty, usePostTitle, usePrevNext, useTag, useTags, useThemeConfig, useTwikoo, useWaline, valaxyConfigRef, valaxyConfigSymbol, wrap, wrapTable };
package/dist/index.js DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkZP4HS4GXjs = require('./chunk-ZP4HS4GX.js');var _config = require('@valaxyjs/config'); var _config2 = _interopRequireDefault(_config);var _vue = require('vue');function C(t){let e=JSON.parse(t);return import.meta.env.DEV?_vue.readonly.call(void 0, e):e}var U=Symbol("valaxy:config"),T= exports.valaxyConfigRef =_vue.shallowRef.call(void 0, C(_config2.default));import.meta.hot&&import.meta.hot.accept("/@valaxyjs/config",t=>{T.value=C(t.default)});function Ct(){return _vue.computed.call(void 0, ()=>T.value)}function g(){let t=_vue.inject.call(void 0, U);if(!t)throw new Error("[Valaxy] config not properly injected in qpp");return t}function P(){let t=g();return _vue.computed.call(void 0, ()=>t.value.themeConfig)}var _vuerouter = require('vue-router');var _vuei18n = require('vue-i18n');function Pt(t,e){return Math.random()*(e-t)+t}function q(t,e){let o=document.createElement("div");o.className=e,t.parentNode.insertBefore(o,t),t.parentNode.removeChild(t),o.appendChild(t)}var bt=(t=document)=>{t.querySelectorAll("table").forEach(e=>{let o=document.createElement("div");o.className="table-container",q(e,"table-container")})};var _dayjs = require('dayjs'); var _dayjs2 = _interopRequireDefault(_dayjs);function Et(t,e="YYYY-MM-DD"){return _dayjs2.default.call(void 0, t).format(e)}function y(t,e=!0){return t.sort((o,n)=>{let s=+new Date(o.date||""),r=+new Date(n.date||"");return e?r-s:s-r})}var Ut=t=>{let{locale:e}=_vuei18n.useI18n.call(void 0, );return _vue.computed.call(void 0, ()=>{let o=e.value==="zh-CN"?"zh":e.value;return t.value[`title_${o}`]||t.value.title})};function h(t={}){let e=_vuerouter.useRouter.call(void 0, );return _vue.computed.call(void 0, ()=>{let o=e.getRoutes().filter(r=>r.path.startsWith("/posts")&&r.meta.frontmatter&&r.meta.frontmatter.date).filter(r=>!r.path.endsWith(".html")).filter(r=>!t.type||r.meta.frontmatter.type===t.type).map(r=>Object.assign({path:r.path,excerpt:r.meta.excerpt},r.meta.frontmatter)),n=y(o.filter(r=>r.top)).sort((r,l)=>l.top-r.top),s=y(o.filter(r=>!r.top));return n.concat(s)})}function qt(){let t=_vuerouter.useRouter.call(void 0, );return _vue.computed.call(void 0, ()=>t.getRoutes().map(o=>Object.assign({path:o.path,excerpt:o.meta.excerpt},o.meta.frontmatter)))}function Bt(t){let e=_vuerouter.useRoute.call(void 0, ),o=_vue.computed.call(void 0, ()=>t||e.path),n=h(),s=_vue.computed.call(void 0, ()=>{let i=-1;return n.value.find((a,c)=>a.path===o.value?(i=c,!0):!1),i}),r=_vue.computed.call(void 0, ()=>s.value-1>=0?n.value[s.value-1]:null),l=_vue.computed.call(void 0, ()=>s.value+1<n.value.length?n.value[s.value+1]:null);return[r,l]}function zt(t){if(!t)return{color:"",icon:"",styles:{}};let e=P();t in e.value.types||(t="link");let o=e.value.types[t].color,n=e.value.types[t].icon,s=_vue.computed.call(void 0, ()=>({"--card-c-primary":t&&o}));return{color:o,icon:n,styles:s}}var Yt=t=>t.children;function $t(t,e=[]){var s;e.length||(e=_vue.unref.call(void 0, h()));let o={total:e.length,children:new Map([["Uncategorized",{total:0,posts:[]}]])},n=o.children.get("Uncategorized");if(e.forEach(r=>{if(r.categories)if(Array.isArray(r.categories)){let l=r.categories.length,i=o;r.categories.forEach((a,c)=>{var m,d,f;if(c===l-1)if(i.children.has(a)){let u=i.children.get(a);u.posts&&(u.total+=1,u.posts.push(r))}else(m=i.children)==null||m.set(a,{total:1,posts:[r]});else if((d=i.children)!=null&&d.has(a)){let u=i.children.get(a);u.total+=1,i=u}else{let u={total:1,children:new Map};(f=i.children)==null||f.set(a,u),i=u}})}else{let l=r.categories;if(o.children.has(l)){let i=o.children.get(l);i.total+=1,i.posts.push(r)}else o.children.set(l,{total:1,posts:[r]})}else n.total+=1,n.posts.push(r)}),n.total===0&&((s=o.children)==null||s.delete("Uncategorized")),t){let r=o.children.get(t);return r?{total:r==null?void 0:r.total,children:new Map([[t,r]])}:(console.warn(`Do not have category: ${t}`),o)}else return o}var _tinycolor = require('@ctrl/tinycolor');function Jt(t={primary:"#0078E7"}){let e=W(),o=new (0, _tinycolor.TinyColor)("#999999"),n=new (0, _tinycolor.TinyColor)(t.primary);return{tags:e,getTagStyle:r=>{let l=Array.from(e).map(([d,f])=>f.count),i=Math.max(...l),a=Math.min(...l),c=i-a,m=(r-a)/c;return{"--yun-tag-color":o.mix(n,m*100).toString(),fontSize:`${m*36+12}px`}}}}function W(){let t=h(),e=new Map;return t.value.forEach(o=>{if(o.tags){let n;typeof o.tags=="string"?n=[o.tags]:n=o.tags,n.forEach(s=>{if(e.has(s)){let r=e.get(s);e.set(s,_chunkZP4HS4GXjs.b.call(void 0, _chunkZP4HS4GXjs.a.call(void 0, {},r),{count:r.count+1}))}else e.set(s,{count:1})})}}),e}var _core = require('@vueuse/core');function ee(){let t=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>t.meta.frontmatter)}function oe(){let t=g(),e=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>((t.value.url.endsWith("/")?t.value.url.slice(0,-1):t.value.url)||_core.isClient&&window.location.origin)+e.path)}var _head = require('@vueuse/head');function se(){_head.useHead.call(void 0, {link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css"}]})}function me(t){let e=_vue.ref.call(void 0, !1),{top:o}=_core.useElementBounding.call(void 0, t);return _core.useIntersectionObserver.call(void 0, t,([{isIntersecting:s}])=>{e.value=s}),{show:()=>{e.value||window.scrollTo(0,o.value)}}}var Q=_core.useDark.call(void 0, ),de= exports.toggleDark =_core.useToggle.call(void 0, Q);function xe(t){let e=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>e.meta.layout===t)}function Te(){_head.useHead.call(void 0, {link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css"}]}),_core.useScriptTag.call(void 0, "https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js",()=>{_core.useScriptTag.call(void 0, "https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js")})}function Le(t={offset:100}){if(!_core.isClient)return{percentage:_vue.ref.call(void 0, 0),show:_vue.ref.call(void 0, !1)};let{y:e}=_core.useWindowScroll.call(void 0, ),o=_vue.computed.call(void 0, ()=>e.value/(document.body.scrollHeight-window.innerHeight)),n=_vue.computed.call(void 0, ()=>e.value>t.offset);return{percentage:o,show:n}}function Ae(){_head.useHead.call(void 0, {script:[{src:"https://static.codepen.io/assets/embed/ei.js",async:!0}]})}function Ve(t,e){let o=at(n,200);function n(){let i=[].slice.call(document.querySelectorAll(".va-toc a.toc-link-item")),a=[].slice.call(document.querySelectorAll("main .header-anchor")).filter(c=>i.some(m=>m.hash===c.hash));for(let c=0;c<a.length;c++){let m=a[c],d=a[c+1],[f,u]=it(c,m,d);if(f){history.replaceState(null,document.title,u||" "),r(u);return}}}let s=null;function r(i){l(s);let a=s=i==null?null:t.value.querySelector(`.va-toc a[href="${i}"]`);a?(a.classList.add("active"),e.value.style.opacity="1",e.value.style.top=`${a.offsetTop+2}px`):(e.value.style.opacity="0",e.value.style.top="54px")}function l(i){i&&i.classList.remove("active")}_vue.onMounted.call(void 0, ()=>{requestAnimationFrame(n),window.addEventListener("scroll",o)}),_vue.onUnmounted.call(void 0, ()=>{window.removeEventListener("scroll",o)})}function H(t){return t.parentElement.offsetTop-50}function it(t,e,o){let n=window.scrollY;return t===0&&n===0?[!0,null]:n<H(e)?[!1,null]:!o||n<H(o)?[!0,decodeURIComponent(e.hash)]:[!1,null]}function at(t,e){let o,n=!1;return()=>{o&&clearTimeout(o),n?o=setTimeout(t,e):(t(),n=!0,setTimeout(()=>{n=!1},e))}}function Ie(t={}){let e=_vuerouter.useRoute.call(void 0, ),{locale:o}=_vuei18n.useI18n.call(void 0, );function n(s={}){if(!_core.isClient)return;let r={el:".comment #tcomment",lang:o.value,path:e.path},l=Object.assign(r,s);return window.twikoo.init(l)}_core.useScriptTag.call(void 0, "//cdn.jsdelivr.net/npm/twikoo@1.5.1/dist/twikoo.all.min.js",()=>{n(t)})}function _e(t={}){_head.useHead.call(void 0, {link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/@waline/client/dist/waline.css"}]});let e=_vuerouter.useRoute.call(void 0, ),{locale:o}=_vuei18n.useI18n.call(void 0, ),n;function s(r={}){if(!_core.isClient)return;let l={el:".comment #waline",lang:o.value,dark:"html.dark",emoji:["https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/bilibili","https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/qq","https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/weibo"],path:e.path},i=Object.assign(l,r);return window.Waline.init(i)}return _core.useScriptTag.call(void 0, "//cdn.jsdelivr.net/npm/@waline/client/dist/waline.js",()=>{n=s(t)}),_vue.watch.call(void 0, ()=>e.path,r=>{!n||n.update({path:r})}),_vue.watch.call(void 0, o,r=>{!n||n.update({lang:r})}),_vue.onUnmounted.call(void 0, ()=>{!n||n.destroy()}),n}exports.defaultValaxyConfig = _chunkZP4HS4GXjs.i; exports.formatDate = Et; exports.initConfig = Ct; exports.isDark = Q; exports.isParentCategory = Yt; exports.random = Pt; exports.sortByDate = y; exports.toggleDark = de; exports.useActiveSidebarLinks = Ve; exports.useAplayer = Te; exports.useBackToTop = Le; exports.useCategory = $t; exports.useCodePen = Ae; exports.useConfig = g; exports.useFrontmatter = ee; exports.useFullUrl = oe; exports.useInvisibleElement = me; exports.useKatex = se; exports.useLayout = xe; exports.usePageList = qt; exports.usePostList = h; exports.usePostProperty = zt; exports.usePostTitle = Ut; exports.usePrevNext = Bt; exports.useTag = W; exports.useTags = Jt; exports.useThemeConfig = P; exports.useTwikoo = Ie; exports.useWaline = _e; exports.valaxyConfigRef = T; exports.valaxyConfigSymbol = U; exports.wrap = q; exports.wrapTable = bt;
package/dist/index.mjs DELETED
@@ -1 +0,0 @@
1
- import{a as x,b as v,i as xt}from"./chunk-6QPICP7C.mjs";import S from"@valaxyjs/config";import{computed as w,inject as D,readonly as O,shallowRef as V}from"vue";function C(t){let e=JSON.parse(t);return import.meta.env.DEV?O(e):e}var U=Symbol("valaxy:config"),T=V(C(S));import.meta.hot&&import.meta.hot.accept("/@valaxyjs/config",t=>{T.value=C(t.default)});function Ct(){return w(()=>T.value)}function g(){let t=D(U);if(!t)throw new Error("[Valaxy] config not properly injected in qpp");return t}function P(){let t=g();return w(()=>t.value.themeConfig)}import{unref as N}from"vue";import{computed as p}from"vue";import{useRoute as z,useRouter as b}from"vue-router";import{useI18n as I}from"vue-i18n";function Pt(t,e){return Math.random()*(e-t)+t}function q(t,e){let o=document.createElement("div");o.className=e,t.parentNode.insertBefore(o,t),t.parentNode.removeChild(t),o.appendChild(t)}var bt=(t=document)=>{t.querySelectorAll("table").forEach(e=>{let o=document.createElement("div");o.className="table-container",q(e,"table-container")})};import B from"dayjs";function Et(t,e="YYYY-MM-DD"){return B(t).format(e)}function y(t,e=!0){return t.sort((o,n)=>{let s=+new Date(o.date||""),r=+new Date(n.date||"");return e?r-s:s-r})}var Ut=t=>{let{locale:e}=I();return p(()=>{let o=e.value==="zh-CN"?"zh":e.value;return t.value[`title_${o}`]||t.value.title})};function h(t={}){let e=b();return p(()=>{let o=e.getRoutes().filter(r=>r.path.startsWith("/posts")&&r.meta.frontmatter&&r.meta.frontmatter.date).filter(r=>!r.path.endsWith(".html")).filter(r=>!t.type||r.meta.frontmatter.type===t.type).map(r=>Object.assign({path:r.path,excerpt:r.meta.excerpt},r.meta.frontmatter)),n=y(o.filter(r=>r.top)).sort((r,l)=>l.top-r.top),s=y(o.filter(r=>!r.top));return n.concat(s)})}function qt(){let t=b();return p(()=>t.getRoutes().map(o=>Object.assign({path:o.path,excerpt:o.meta.excerpt},o.meta.frontmatter)))}function Bt(t){let e=z(),o=p(()=>t||e.path),n=h(),s=p(()=>{let i=-1;return n.value.find((a,c)=>a.path===o.value?(i=c,!0):!1),i}),r=p(()=>s.value-1>=0?n.value[s.value-1]:null),l=p(()=>s.value+1<n.value.length?n.value[s.value+1]:null);return[r,l]}function zt(t){if(!t)return{color:"",icon:"",styles:{}};let e=P();t in e.value.types||(t="link");let o=e.value.types[t].color,n=e.value.types[t].icon,s=p(()=>({"--card-c-primary":t&&o}));return{color:o,icon:n,styles:s}}var Yt=t=>t.children;function $t(t,e=[]){var s;e.length||(e=N(h()));let o={total:e.length,children:new Map([["Uncategorized",{total:0,posts:[]}]])},n=o.children.get("Uncategorized");if(e.forEach(r=>{if(r.categories)if(Array.isArray(r.categories)){let l=r.categories.length,i=o;r.categories.forEach((a,c)=>{var m,d,f;if(c===l-1)if(i.children.has(a)){let u=i.children.get(a);u.posts&&(u.total+=1,u.posts.push(r))}else(m=i.children)==null||m.set(a,{total:1,posts:[r]});else if((d=i.children)!=null&&d.has(a)){let u=i.children.get(a);u.total+=1,i=u}else{let u={total:1,children:new Map};(f=i.children)==null||f.set(a,u),i=u}})}else{let l=r.categories;if(o.children.has(l)){let i=o.children.get(l);i.total+=1,i.posts.push(r)}else o.children.set(l,{total:1,posts:[r]})}else n.total+=1,n.posts.push(r)}),n.total===0&&((s=o.children)==null||s.delete("Uncategorized")),t){let r=o.children.get(t);return r?{total:r==null?void 0:r.total,children:new Map([[t,r]])}:(console.warn(`Do not have category: ${t}`),o)}else return o}import{TinyColor as j}from"@ctrl/tinycolor";function Jt(t={primary:"#0078E7"}){let e=W(),o=new j("#999999"),n=new j(t.primary);return{tags:e,getTagStyle:r=>{let l=Array.from(e).map(([d,f])=>f.count),i=Math.max(...l),a=Math.min(...l),c=i-a,m=(r-a)/c;return{"--yun-tag-color":o.mix(n,m*100).toString(),fontSize:`${m*36+12}px`}}}}function W(){let t=h(),e=new Map;return t.value.forEach(o=>{if(o.tags){let n;typeof o.tags=="string"?n=[o.tags]:n=o.tags,n.forEach(s=>{if(e.has(s)){let r=e.get(s);e.set(s,v(x({},r),{count:r.count+1}))}else e.set(s,{count:1})})}}),e}import{useRoute as L}from"vue-router";import{computed as E}from"vue";import{isClient as Y}from"@vueuse/core";function ee(){let t=L();return E(()=>t.meta.frontmatter)}function oe(){let t=g(),e=L();return E(()=>((t.value.url.endsWith("/")?t.value.url.slice(0,-1):t.value.url)||Y&&window.location.origin)+e.path)}import{useHead as $}from"@vueuse/head";function se(){$({link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css"}]})}import{useElementBounding as F,useIntersectionObserver as K}from"@vueuse/core";import{ref as _}from"vue";function me(t){let e=_(!1),{top:o}=F(t);return K(t,([{isIntersecting:s}])=>{e.value=s}),{show:()=>{e.value||window.scrollTo(0,o.value)}}}import{useDark as J,useToggle as G}from"@vueuse/core";var Q=J(),de=G(Q);import{computed as X}from"vue";import{useRoute as Z}from"vue-router";function xe(t){let e=Z();return X(()=>e.meta.layout===t)}import{useScriptTag as M}from"@vueuse/core";import{useHead as tt}from"@vueuse/head";function Te(){tt({link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css"}]}),M("https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js",()=>{M("https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js")})}import{isClient as et,useWindowScroll as ot}from"@vueuse/core";import{computed as A,ref as k}from"vue";function Le(t={offset:100}){if(!et)return{percentage:k(0),show:k(!1)};let{y:e}=ot(),o=A(()=>e.value/(document.body.scrollHeight-window.innerHeight)),n=A(()=>e.value>t.offset);return{percentage:o,show:n}}import{useHead as rt}from"@vueuse/head";function Ae(){rt({script:[{src:"https://static.codepen.io/assets/embed/ei.js",async:!0}]})}import{onMounted as nt,onUnmounted as st}from"vue";function Ve(t,e){let o=at(n,200);function n(){let i=[].slice.call(document.querySelectorAll(".va-toc a.toc-link-item")),a=[].slice.call(document.querySelectorAll("main .header-anchor")).filter(c=>i.some(m=>m.hash===c.hash));for(let c=0;c<a.length;c++){let m=a[c],d=a[c+1],[f,u]=it(c,m,d);if(f){history.replaceState(null,document.title,u||" "),r(u);return}}}let s=null;function r(i){l(s);let a=s=i==null?null:t.value.querySelector(`.va-toc a[href="${i}"]`);a?(a.classList.add("active"),e.value.style.opacity="1",e.value.style.top=`${a.offsetTop+2}px`):(e.value.style.opacity="0",e.value.style.top="54px")}function l(i){i&&i.classList.remove("active")}nt(()=>{requestAnimationFrame(n),window.addEventListener("scroll",o)}),st(()=>{window.removeEventListener("scroll",o)})}function H(t){return t.parentElement.offsetTop-50}function it(t,e,o){let n=window.scrollY;return t===0&&n===0?[!0,null]:n<H(e)?[!1,null]:!o||n<H(o)?[!0,decodeURIComponent(e.hash)]:[!1,null]}function at(t,e){let o,n=!1;return()=>{o&&clearTimeout(o),n?o=setTimeout(t,e):(t(),n=!0,setTimeout(()=>{n=!1},e))}}import{isClient as lt,useScriptTag as ct}from"@vueuse/core";import{useI18n as ut}from"vue-i18n";import{useRoute as mt}from"vue-router";function Ie(t={}){let e=mt(),{locale:o}=ut();function n(s={}){if(!lt)return;let r={el:".comment #tcomment",lang:o.value,path:e.path},l=Object.assign(r,s);return window.twikoo.init(l)}ct("//cdn.jsdelivr.net/npm/twikoo@1.5.1/dist/twikoo.all.min.js",()=>{n(t)})}import{isClient as pt,useScriptTag as ft}from"@vueuse/core";import{useHead as dt}from"@vueuse/head";import{onUnmounted as ht,watch as R}from"vue";import{useI18n as gt}from"vue-i18n";import{useRoute as yt}from"vue-router";function _e(t={}){dt({link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/@waline/client/dist/waline.css"}]});let e=yt(),{locale:o}=gt(),n;function s(r={}){if(!pt)return;let l={el:".comment #waline",lang:o.value,dark:"html.dark",emoji:["https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/bilibili","https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/qq","https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/weibo"],path:e.path},i=Object.assign(l,r);return window.Waline.init(i)}return ft("//cdn.jsdelivr.net/npm/@waline/client/dist/waline.js",()=>{n=s(t)}),R(()=>e.path,r=>{!n||n.update({path:r})}),R(o,r=>{!n||n.update({lang:r})}),ht(()=>{!n||n.destroy()}),n}export{xt as defaultValaxyConfig,Et as formatDate,Ct as initConfig,Q as isDark,Yt as isParentCategory,Pt as random,y as sortByDate,de as toggleDark,Ve as useActiveSidebarLinks,Te as useAplayer,Le as useBackToTop,$t as useCategory,Ae as useCodePen,g as useConfig,ee as useFrontmatter,oe as useFullUrl,me as useInvisibleElement,se as useKatex,xe as useLayout,qt as usePageList,h as usePostList,zt as usePostProperty,Ut as usePostTitle,Bt as usePrevNext,W as useTag,Jt as useTags,P as useThemeConfig,Ie as useTwikoo,_e as useWaline,T as valaxyConfigRef,U as valaxyConfigSymbol,q as wrap,bt as wrapTable};
@@ -1 +0,0 @@
1
- export * from './katex'
@@ -1,15 +0,0 @@
1
- import { useHead } from '@vueuse/head'
2
-
3
- /**
4
- * use katex css cdn
5
- */
6
- export function useKatex() {
7
- useHead({
8
- link: [
9
- {
10
- rel: 'stylesheet',
11
- href: 'https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css',
12
- },
13
- ],
14
- })
15
- }
@@ -1,115 +0,0 @@
1
- import { isClient, useScriptTag } from '@vueuse/core'
2
- import { useI18n } from 'vue-i18n'
3
- import { useRoute } from 'vue-router'
4
-
5
- const algoliasearchUrl = 'https://cdn.jsdelivr.net/npm/algoliasearch@4/dist/algoliasearch-lite.umd.js'
6
- const instantsearchUrl = 'https://cdn.jsdelivr.net/npm/instantsearch.js@4/dist/instantsearch.production.min.js'
7
-
8
- export function useAlgoliaSearch(config: {
9
- appId: string
10
- apiKey: string
11
- indexName: string
12
- hits: {
13
- per_page: number
14
- }
15
- }) {
16
- if (!isClient)
17
- return
18
-
19
- const route = useRoute()
20
- const { t } = useI18n()
21
-
22
- useScriptTag(algoliasearchUrl, () => {
23
- useScriptTag(instantsearchUrl, () => {
24
- const algoliaSettings = config
25
- const { indexName, appId, apiKey } = algoliaSettings
26
-
27
- const search = window.instantsearch({
28
- indexName,
29
- searchClient: window.algoliasearch(appId, apiKey),
30
- searchFunction: (helper: { search: () => void }) => {
31
- const searchInput = document.querySelector('.search-input') as HTMLInputElement
32
- if (searchInput.value)
33
- helper.search()
34
- },
35
- })
36
-
37
- // Registering Widgets
38
- search.addWidgets([
39
- window.instantsearch.widgets.configure({
40
- hitsPerPage: algoliaSettings.hits.per_page || 8,
41
- }),
42
-
43
- window.instantsearch.widgets.searchBox({
44
- container: '.search-input-container',
45
- placeholder: t('search.placeholder'),
46
- // Hide default icons of algolia search
47
- showReset: false,
48
- showSubmit: false,
49
- showLoadingIndicator: false,
50
- cssClasses: {
51
- input: 'search-input',
52
- },
53
- }),
54
-
55
- window.instantsearch.widgets.stats({
56
- container: '#algolia-stats',
57
- templates: {
58
- text: (data: any) => {
59
- const stats = t('search.hits_time', {
60
- hits: data.nbHits,
61
- time: data.processingTimeMS,
62
- })
63
- return `<span>${stats}</span>
64
- <a href="https://www.algolia.com/" target="_blank" class="algolia-powered">
65
- <img src="https://simpleicons.org/icons/algolia.svg" alt="Algolia">
66
- </a>
67
- `
68
- },
69
- },
70
- }),
71
-
72
- window.instantsearch.widgets.hits({
73
- container: '#algolia-hits',
74
- templates: {
75
- item: (data: any) => {
76
- const link = data.permalink ? data.permalink : route.path
77
- return `<a href="${link}" class="algolia-hit-item-link">
78
- ${data._highlightResult.title.value}
79
- <small>${data._highlightResult.slug.value}</small>
80
- </a>`
81
- },
82
- empty: (data: any) => {
83
- return `<div id="algolia-hits-empty">${t('search.empty', data.query)}</div>`
84
- },
85
- },
86
- cssClasses: {
87
- item: 'algolia-hit-item',
88
- },
89
- }),
90
-
91
- window.instantsearch.widgets.pagination({
92
- container: '#algolia-pagination',
93
- scrollTo: false,
94
- showFirst: false,
95
- showLast: false,
96
- templates: {
97
- first: '<div i-ri-arrow-left-line></div>',
98
- last: '<div i-ri-arrow-right-line></div>',
99
- previous: '<div i-ri-arrow-left-s-line></div>',
100
- next: '<div i-ri-arrow-right-s-line></div>',
101
- },
102
- cssClasses: {
103
- root: 'pagination',
104
- item: 'page-number',
105
- link: 'page-number',
106
- selectedItem: 'active',
107
- disabledItem: 'disabled-item',
108
- },
109
- }),
110
- ])
111
-
112
- search.start()
113
- })
114
- })
115
- }
@@ -1,12 +0,0 @@
1
- import type { UserModule } from '~/types'
2
-
3
- // https://github.com/antfu/vite-plugin-pwa#automatic-reload-when-new-content-available
4
- export const install: UserModule = ({ isClient, router }) => {
5
- if (!isClient)
6
- return
7
-
8
- router.isReady().then(async () => {
9
- const { registerSW } = await import('virtual:pwa-register')
10
- registerSW({ immediate: true })
11
- })
12
- }
@@ -1,34 +0,0 @@
1
- @use '~/styles/mixins' as *;
2
-
3
- .no-scroll {
4
- position: fixed;
5
- overflow-y: scroll;
6
- width: 100%;
7
- }
8
-
9
- ::-webkit-scrollbar {
10
- width: 8px;
11
- height: 8px;
12
- }
13
-
14
- ::-webkit-scrollbar-track {
15
- border-radius: 2px;
16
- background-color: rgba(255, 255, 255, 0.1);
17
- }
18
-
19
- ::-webkit-scrollbar-thumb {
20
- border-radius: 2px;
21
- background-color: rgba(get-css-var('c', 'primary', 'rgb'), 0.3);
22
-
23
- &:window-inactive {
24
- background-color: rgba(get-css-var('c', 'primary', 'rgb'), 0.3);
25
- }
26
-
27
- &:hover {
28
- background-color: rgba(get-css-var('c', 'primary', 'rgb'), 0.7);
29
- }
30
-
31
- &:active {
32
- background-color: rgba(get-css-var('c', 'primary', 'rgb'), 0.9);
33
- }
34
- }
package/src/index.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './client'
2
- export * from './types'