@jet-w/astro-blog 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-DAH2XP4W.js +154 -0
- package/dist/{chunk-TJTPX2WP.js → chunk-PG43JO4O.js} +1 -153
- package/dist/chunk-PZICDGJG.js +69 -0
- package/dist/chunk-Z3O3JK56.js +186 -0
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js +8 -6
- package/dist/{i18n-PgMCFBw0.d.ts → i18n-DYYPTq4o.d.ts} +1 -1
- package/dist/index.d.ts +10 -202
- package/dist/index.js +33 -223
- package/dist/integration.d.ts +2 -2
- package/dist/{sidebar-Da-W_4Lr.d.ts → sidebar-DNdiCKBw.d.ts} +1 -1
- package/dist/utils/i18n.d.ts +133 -0
- package/dist/utils/i18n.js +49 -0
- package/dist/utils/sidebar.d.ts +1 -1
- package/dist/utils/useI18n.d.ts +74 -0
- package/dist/utils/useI18n.js +15 -0
- package/package.json +9 -1
- package/templates/default/package.dev.json +31 -0
- package/templates/default/package.json +1 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
filterPostsByLocale,
|
|
3
|
+
formatDate,
|
|
4
|
+
formatDateShort,
|
|
5
|
+
getAlternateLinks,
|
|
6
|
+
getContentPathPrefix,
|
|
7
|
+
getLocaleByCode,
|
|
8
|
+
getLocaleConfig,
|
|
9
|
+
getLocaleFromPath,
|
|
10
|
+
getLocalePrefix,
|
|
11
|
+
getLocalizedPath,
|
|
12
|
+
getTextDirection,
|
|
13
|
+
isMultiLanguageEnabled,
|
|
14
|
+
isRTL,
|
|
15
|
+
removeLocalePrefix,
|
|
16
|
+
t
|
|
17
|
+
} from "../chunk-Z3O3JK56.js";
|
|
18
|
+
import "../chunk-DAH2XP4W.js";
|
|
19
|
+
import {
|
|
20
|
+
builtInTranslations,
|
|
21
|
+
defaultI18nConfig,
|
|
22
|
+
defineI18nConfig,
|
|
23
|
+
enTranslations,
|
|
24
|
+
getUITranslations,
|
|
25
|
+
zhCNTranslations
|
|
26
|
+
} from "../chunk-A2E2VSAQ.js";
|
|
27
|
+
export {
|
|
28
|
+
builtInTranslations,
|
|
29
|
+
defaultI18nConfig,
|
|
30
|
+
defineI18nConfig,
|
|
31
|
+
enTranslations,
|
|
32
|
+
filterPostsByLocale,
|
|
33
|
+
formatDate,
|
|
34
|
+
formatDateShort,
|
|
35
|
+
getAlternateLinks,
|
|
36
|
+
getContentPathPrefix,
|
|
37
|
+
getLocaleByCode,
|
|
38
|
+
getLocaleConfig,
|
|
39
|
+
getLocaleFromPath,
|
|
40
|
+
getLocalePrefix,
|
|
41
|
+
getLocalizedPath,
|
|
42
|
+
getTextDirection,
|
|
43
|
+
getUITranslations,
|
|
44
|
+
isMultiLanguageEnabled,
|
|
45
|
+
isRTL,
|
|
46
|
+
removeLocalePrefix,
|
|
47
|
+
t,
|
|
48
|
+
zhCNTranslations
|
|
49
|
+
};
|
package/dist/utils/sidebar.d.ts
CHANGED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ComputedRef } from 'vue';
|
|
2
|
+
import { U as UITranslations, I as I18nConfig } from '../i18n-DYYPTq4o.js';
|
|
3
|
+
export { L as Locale } from '../i18n-DYYPTq4o.js';
|
|
4
|
+
import '../types/index.js';
|
|
5
|
+
import '../sidebar-DNdiCKBw.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Vue Composable for i18n
|
|
9
|
+
*
|
|
10
|
+
* Provides i18n support for Vue components in the blog.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* i18n injection keys
|
|
15
|
+
*/
|
|
16
|
+
declare const I18N_LOCALE_KEY: unique symbol;
|
|
17
|
+
declare const I18N_CONFIG_KEY: unique symbol;
|
|
18
|
+
declare const I18N_TRANSLATIONS_KEY: unique symbol;
|
|
19
|
+
/**
|
|
20
|
+
* i18n context provided to Vue components
|
|
21
|
+
*/
|
|
22
|
+
interface I18nContext {
|
|
23
|
+
locale: string;
|
|
24
|
+
translations: UITranslations;
|
|
25
|
+
config?: I18nConfig;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Return type of useI18n composable
|
|
29
|
+
*/
|
|
30
|
+
interface UseI18nReturn {
|
|
31
|
+
/** Current locale code */
|
|
32
|
+
locale: ComputedRef<string>;
|
|
33
|
+
/** Translation function */
|
|
34
|
+
t: (key: keyof UITranslations) => string;
|
|
35
|
+
/** Format date according to locale */
|
|
36
|
+
formatDate: (date: Date | string, options?: Intl.DateTimeFormatOptions) => string;
|
|
37
|
+
/** Format date in short format */
|
|
38
|
+
formatDateShort: (date: Date | string) => string;
|
|
39
|
+
/** All translations for current locale */
|
|
40
|
+
translations: ComputedRef<UITranslations>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Vue composable for i18n support
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```vue
|
|
47
|
+
* <script setup>
|
|
48
|
+
* import { useI18n } from '@jet-w/astro-blog/utils/useI18n';
|
|
49
|
+
*
|
|
50
|
+
* const { t, formatDate, locale } = useI18n();
|
|
51
|
+
* </script>
|
|
52
|
+
*
|
|
53
|
+
* <template>
|
|
54
|
+
* <h1>{{ t('postList') }}</h1>
|
|
55
|
+
* <span>{{ formatDate(post.pubDate) }}</span>
|
|
56
|
+
* </template>
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
declare function useI18n(): UseI18nReturn;
|
|
60
|
+
/**
|
|
61
|
+
* Create i18n context for providing to Vue components
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```astro
|
|
65
|
+
* ---
|
|
66
|
+
* import { createI18nContext } from '@jet-w/astro-blog/utils/useI18n';
|
|
67
|
+
* const i18nContext = createI18nContext('en', i18nConfig);
|
|
68
|
+
* ---
|
|
69
|
+
* <Component client:load {...i18nContext} />
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
declare function createI18nContext(locale: string, config?: I18nConfig): I18nContext;
|
|
73
|
+
|
|
74
|
+
export { I18N_CONFIG_KEY, I18N_LOCALE_KEY, I18N_TRANSLATIONS_KEY, I18nConfig, type I18nContext, UITranslations, type UseI18nReturn, createI18nContext, useI18n };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
I18N_CONFIG_KEY,
|
|
3
|
+
I18N_LOCALE_KEY,
|
|
4
|
+
I18N_TRANSLATIONS_KEY,
|
|
5
|
+
createI18nContext,
|
|
6
|
+
useI18n
|
|
7
|
+
} from "../chunk-PZICDGJG.js";
|
|
8
|
+
import "../chunk-A2E2VSAQ.js";
|
|
9
|
+
export {
|
|
10
|
+
I18N_CONFIG_KEY,
|
|
11
|
+
I18N_LOCALE_KEY,
|
|
12
|
+
I18N_TRANSLATIONS_KEY,
|
|
13
|
+
createI18nContext,
|
|
14
|
+
useI18n
|
|
15
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jet-w/astro-blog",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "A modern Astro blog theme with Vue and Tailwind CSS support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -24,6 +24,14 @@
|
|
|
24
24
|
"./utils/sidebar": {
|
|
25
25
|
"types": "./dist/utils/sidebar.d.ts",
|
|
26
26
|
"import": "./dist/utils/sidebar.js"
|
|
27
|
+
},
|
|
28
|
+
"./utils/i18n": {
|
|
29
|
+
"types": "./dist/utils/i18n.d.ts",
|
|
30
|
+
"import": "./dist/utils/i18n.js"
|
|
31
|
+
},
|
|
32
|
+
"./utils/useI18n": {
|
|
33
|
+
"types": "./dist/utils/useI18n.d.ts",
|
|
34
|
+
"import": "./dist/utils/useI18n.js"
|
|
27
35
|
}
|
|
28
36
|
},
|
|
29
37
|
"files": [
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "my-astro-blog",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "astro dev",
|
|
7
|
+
"start": "astro dev",
|
|
8
|
+
"build": "astro build",
|
|
9
|
+
"preview": "astro preview",
|
|
10
|
+
"astro": "astro"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@astrojs/mdx": "^4.3.12",
|
|
14
|
+
"@astrojs/rss": "^4.0.14",
|
|
15
|
+
"@astrojs/tailwind": "^5.1.3",
|
|
16
|
+
"@astrojs/vue": "^5.0.6",
|
|
17
|
+
"@jet-w/astro-blog": "file:../../",
|
|
18
|
+
"@tailwindcss/typography": "^0.5.15",
|
|
19
|
+
"astro": "^5.14.1",
|
|
20
|
+
"echarts": "^6.0.0",
|
|
21
|
+
"fuse.js": "^7.0.0",
|
|
22
|
+
"mermaid": "^11.12.2",
|
|
23
|
+
"rehype-katex": "^7.0.1",
|
|
24
|
+
"rehype-raw": "^7.0.0",
|
|
25
|
+
"remark-directive": "^4.0.0",
|
|
26
|
+
"remark-math": "^6.0.0",
|
|
27
|
+
"tailwindcss": "^3.4.17",
|
|
28
|
+
"typescript": "^5.7.2",
|
|
29
|
+
"vue": "^3.5.13"
|
|
30
|
+
}
|
|
31
|
+
}
|