@windrun-huaiin/lib 6.2.1 → 7.1.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.
- package/dist/common-app-config.d.ts +6 -6
- package/dist/common-app-config.d.ts.map +1 -0
- package/dist/common-app-config.js +123 -143
- package/dist/common-app-config.mjs +123 -143
- package/dist/index.d.ts +4 -5
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -263
- package/dist/index.mjs +3 -254
- package/dist/llm-utils.d.ts +2 -3
- package/dist/llm-utils.d.ts.map +1 -0
- package/dist/llm-utils.js +39 -59
- package/dist/llm-utils.mjs +39 -53
- package/dist/node_modules/.pnpm/@rollup_plugin-typescript@12.1.4_rollup@4.46.2_tslib@2.8.1_typescript@5.9.2/node_modules/tslib/tslib.es6.js +35 -0
- package/dist/node_modules/.pnpm/@rollup_plugin-typescript@12.1.4_rollup@4.46.2_tslib@2.8.1_typescript@5.9.2/node_modules/tslib/tslib.es6.mjs +33 -0
- package/dist/utils.d.ts +6 -8
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +42 -34
- package/dist/utils.mjs +42 -34
- package/package.json +6 -7
- package/dist/common-app-config.d.mts +0 -127
- package/dist/common-app-config.js.map +0 -1
- package/dist/common-app-config.mjs.map +0 -1
- package/dist/index.d.mts +0 -5
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/llm-utils.d.mts +0 -3
- package/dist/llm-utils.js.map +0 -1
- package/dist/llm-utils.mjs.map +0 -1
- package/dist/utils.d.mts +0 -8
- package/dist/utils.js.map +0 -1
- package/dist/utils.mjs.map +0 -1
|
@@ -16,8 +16,8 @@ declare const ALL_LOCALE_LABELS: {
|
|
|
16
16
|
readonly th: "ไทย";
|
|
17
17
|
readonly vi: "Tiếng Việt";
|
|
18
18
|
};
|
|
19
|
-
type SupportedLocale = keyof typeof ALL_LOCALE_LABELS;
|
|
20
|
-
declare function createCommonAppConfig(options?: {
|
|
19
|
+
export type SupportedLocale = keyof typeof ALL_LOCALE_LABELS;
|
|
20
|
+
export declare function createCommonAppConfig(options?: {
|
|
21
21
|
locales?: string[];
|
|
22
22
|
defaultLocale?: string;
|
|
23
23
|
}): {
|
|
@@ -89,7 +89,7 @@ declare function createCommonAppConfig(options?: {
|
|
|
89
89
|
legal: string;
|
|
90
90
|
};
|
|
91
91
|
};
|
|
92
|
-
declare function createI18nHelpers(i18nConfig: ReturnType<typeof createCommonAppConfig>['i18n']): {
|
|
92
|
+
export declare function createI18nHelpers(i18nConfig: ReturnType<typeof createCommonAppConfig>['i18n']): {
|
|
93
93
|
isSupportedLocale: (locale: string) => locale is (typeof i18nConfig.locales)[number];
|
|
94
94
|
getValidLocale: (locale: string) => (typeof i18nConfig.locales)[number];
|
|
95
95
|
generatedLocales: {
|
|
@@ -97,7 +97,7 @@ declare function createI18nHelpers(i18nConfig: ReturnType<typeof createCommonApp
|
|
|
97
97
|
locale: string;
|
|
98
98
|
}[];
|
|
99
99
|
};
|
|
100
|
-
declare const LOCALE_PRESETS: {
|
|
100
|
+
export declare const LOCALE_PRESETS: {
|
|
101
101
|
EN_ONLY: {
|
|
102
102
|
locales: string[];
|
|
103
103
|
defaultLocale: string;
|
|
@@ -123,5 +123,5 @@ declare const LOCALE_PRESETS: {
|
|
|
123
123
|
defaultLocale: string;
|
|
124
124
|
};
|
|
125
125
|
};
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
export {};
|
|
127
|
+
//# sourceMappingURL=common-app-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common-app-config.d.ts","sourceRoot":"","sources":["../src/common-app-config.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;CAiBb,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,iBAAiB,CAAC;AAa7D,wBAAgB,qBAAqB,CAAC,OAAO,CAAC,EAAE;IAE9C,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;;;;;;;;;;;;;;;;;;;;;;;;;iBAqByB,SAAS,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgE1C;AAGD,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC;gCACzD,MAAM,KAAG,MAAM,IAAI,CAAA,OAAO,UAAU,CAAC,OAAO,EAAC,MAAM,CAAC;6BAIvD,MAAM,KAAG,CAAA,OAAO,UAAU,CAAC,OAAO,EAAC,MAAM,CAAC;;;;;EAc3E;AAGD,eAAO,MAAM,cAAc;;iBAEK,MAAM,EAAE;uBAAyB,MAAM;;;iBAGnC,MAAM,EAAE;uBAAyB,MAAM;;;iBAG5B,MAAM,EAAE;uBAAyB,MAAM;;;iBAG/B,MAAM,EAAE;uBAAyB,MAAM;;;iBAGT,MAAM,EAAE;uBAAyB,MAAM;;;iBAGnG,MAAM,EAAE;uBAAyB,MAAM;;CAC/D,CAAC"}
|
|
@@ -1,157 +1,137 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
|
-
|
|
23
|
-
// src/common-app-config.ts
|
|
24
|
-
var ALL_LOCALE_LABELS = {
|
|
25
|
-
en: "English",
|
|
26
|
-
zh: "\u7B80\u4F53\u4E2D\u6587",
|
|
27
|
-
ja: "\u65E5\u672C\u8A9E",
|
|
28
|
-
ko: "\uD55C\uAD6D\uC5B4",
|
|
29
|
-
fr: "Fran\xE7ais",
|
|
30
|
-
de: "Deutsch",
|
|
31
|
-
es: "Espa\xF1ol",
|
|
32
|
-
it: "Italiano",
|
|
33
|
-
pt: "Portugu\xEAs",
|
|
34
|
-
tr: "T\xFCrk\xE7e",
|
|
35
|
-
pl: "Polski",
|
|
36
|
-
ru: "\u0420\u0443\u0441\u0441\u043A\u0438\u0439",
|
|
37
|
-
ar: "\u0627\u0644\u0639\u0631\u0628\u064A\u0629",
|
|
38
|
-
hi: "\u0939\u093F\u0928\u094D\u0926\u0940",
|
|
39
|
-
th: "\u0E44\u0E17\u0E22",
|
|
40
|
-
vi: "Ti\u1EBFng Vi\u1EC7t"
|
|
3
|
+
// Supported languages and their labels
|
|
4
|
+
const ALL_LOCALE_LABELS = {
|
|
5
|
+
en: "English",
|
|
6
|
+
zh: "简体中文",
|
|
7
|
+
ja: "日本語",
|
|
8
|
+
ko: "한국어",
|
|
9
|
+
fr: "Français",
|
|
10
|
+
de: "Deutsch",
|
|
11
|
+
es: "Español",
|
|
12
|
+
it: "Italiano",
|
|
13
|
+
pt: "Português",
|
|
14
|
+
tr: "Türkçe",
|
|
15
|
+
pl: "Polski",
|
|
16
|
+
ru: "Русский",
|
|
17
|
+
ar: "العربية",
|
|
18
|
+
hi: "हिन्दी",
|
|
19
|
+
th: "ไทย",
|
|
20
|
+
vi: "Tiếng Việt",
|
|
41
21
|
};
|
|
22
|
+
// Helper function to get language configuration from environment variables
|
|
42
23
|
function getLocaleLabels(locales) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
])
|
|
48
|
-
);
|
|
24
|
+
return Object.fromEntries(locales.map(locale => [
|
|
25
|
+
locale,
|
|
26
|
+
ALL_LOCALE_LABELS[locale] || locale
|
|
27
|
+
]));
|
|
49
28
|
}
|
|
29
|
+
// Common application configuration creation function
|
|
50
30
|
function createCommonAppConfig(options) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
31
|
+
var _a, _b, _c, _d, _e;
|
|
32
|
+
// Priority: manual configuration > environment variables > default values
|
|
33
|
+
const locales = (_c = (_a = options === null || options === void 0 ? void 0 : options.locales) !== null && _a !== void 0 ? _a : (_b = process.env.NEXT_PUBLIC_I18N_LOCALES) === null || _b === void 0 ? void 0 : _b.split(',').map(s => s.trim())) !== null && _c !== void 0 ? _c : ['en', 'zh'];
|
|
34
|
+
const defaultLocale = (_e = (_d = options === null || options === void 0 ? void 0 : options.defaultLocale) !== null && _d !== void 0 ? _d : process.env.NEXT_PUBLIC_I18N_DEFAULT_LOCALE) !== null && _e !== void 0 ? _e : 'en';
|
|
35
|
+
const storagePrefix = process.env.NEXT_PUBLIC_I18N_STORAGE_PREFIX || 'WINDRUN-HUAIIN';
|
|
36
|
+
const config = {
|
|
37
|
+
// Basic configuration
|
|
38
|
+
baseUrl: process.env.NEXT_PUBLIC_BASE_URL || '',
|
|
39
|
+
githubBaseUrl: process.env.NEXT_PUBLIC_GITHUB_BASE_URL || '',
|
|
40
|
+
github: process.env.NEXT_PUBLIC_GITHUB || '',
|
|
41
|
+
githubInfoToken: process.env.NEXT_PUBLIC_FUMA_GITHUB_TOKEN || '',
|
|
42
|
+
// Internationalization configuration
|
|
43
|
+
i18n: {
|
|
44
|
+
locales: locales,
|
|
45
|
+
defaultLocale,
|
|
46
|
+
localeLabels: getLocaleLabels(locales),
|
|
47
|
+
detector: {
|
|
48
|
+
storageKey: process.env.NEXT_PUBLIC_I18N_STORAGE_KEY || 'language-preference-status',
|
|
49
|
+
autoCloseTimeout: parseInt(process.env.NEXT_PUBLIC_I18N_AUTO_CLOSE_TIMEOUT || '10000'),
|
|
50
|
+
expirationDays: parseInt(process.env.NEXT_PUBLIC_I18N_EXPIRATION_DAYS || '30'),
|
|
51
|
+
storagePrefix
|
|
52
|
+
},
|
|
53
|
+
messageRoot: process.env.NEXT_PUBLIC_I18N_MESSAGE_ROOT || 'messages',
|
|
54
|
+
},
|
|
55
|
+
// Style configuration
|
|
56
|
+
style: {
|
|
57
|
+
icon: {
|
|
58
|
+
uniformColor: process.env.NEXT_PUBLIC_STYLE_ICON_COLOR || "text-purple-500"
|
|
59
|
+
},
|
|
60
|
+
showBanner: process.env.NEXT_PUBLIC_STYLE_SHOW_BANNER === 'true',
|
|
61
|
+
clerkAuthInModal: process.env.NEXT_PUBLIC_STYLE_CLERK_AUTH_IN_MODAL === 'true',
|
|
62
|
+
clerkPageBanner: process.env.NEXT_PUBLIC_STYLE_CLERK_PAGE_BANNER === 'true',
|
|
63
|
+
watermark: {
|
|
64
|
+
enabled: process.env.NEXT_PUBLIC_STYLE_WATERMARK_ENABLED === 'true',
|
|
65
|
+
text: process.env.NEXT_PUBLIC_STYLE_WATERMARK_TEXT || "巽川·怀因"
|
|
66
|
+
},
|
|
67
|
+
cdnBaseUrl: process.env.NEXT_PUBLIC_STYLE_CDN_BASE_URL || "https://r2.d8ger.com",
|
|
68
|
+
cdnProxyUrl: process.env.NEXT_PUBLIC_STYLE_CDN_PROXY_URL || "https://r2-explorer-template.zcy777et.workers.dev/proxy",
|
|
69
|
+
placeHolder: {
|
|
70
|
+
image: process.env.NEXT_PUBLIC_STYLE_PLACEHOLDER_IMAGE || "/default.webp"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
// Clerk configuration
|
|
74
|
+
clerk: {
|
|
75
|
+
signInUrl: process.env.NEXT_PUBLIC_CLERK_SIGN_IN_URL || "/sign-in",
|
|
76
|
+
fallbackSignInUrl: process.env.NEXT_PUBLIC_CLERK_SIGN_IN_FALLBACK_REDIRECT_URL || "/",
|
|
77
|
+
signUpUrl: process.env.NEXT_PUBLIC_CLERK_SIGN_UP_URL || "/sign-up",
|
|
78
|
+
fallbackSignUpUrl: process.env.NEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URL || "/",
|
|
79
|
+
waitlistUrl: process.env.NEXT_PUBLIC_CLERK_WAITLIST_URL || "/waitlist",
|
|
80
|
+
debug: process.env.CLERK_DEBUG === 'true',
|
|
81
|
+
},
|
|
82
|
+
// MDX source file directory configuration
|
|
83
|
+
mdxSourceDir: {
|
|
84
|
+
docs: process.env.NEXT_PUBLIC_MDX_DOCS_DIR || "src/mdx/docs",
|
|
85
|
+
blog: process.env.NEXT_PUBLIC_MDX_BLOG_DIR || "src/mdx/blog",
|
|
86
|
+
legal: process.env.NEXT_PUBLIC_MDX_LEGAL_DIR || "src/mdx/legal"
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
// Convenient constants - avoid deep nested access
|
|
90
|
+
const shortcuts = {
|
|
91
|
+
iconColor: config.style.icon.uniformColor,
|
|
92
|
+
watermark: config.style.watermark,
|
|
93
|
+
showBanner: config.style.showBanner,
|
|
94
|
+
clerkPageBanner: config.style.clerkPageBanner,
|
|
95
|
+
clerkAuthInModal: config.style.clerkAuthInModal,
|
|
96
|
+
placeHolderImage: config.style.placeHolder.image,
|
|
97
|
+
clerk: config.clerk,
|
|
98
|
+
};
|
|
99
|
+
return Object.assign(Object.assign({}, config), { shortcuts });
|
|
120
100
|
}
|
|
101
|
+
// Create internationalization helper functions
|
|
121
102
|
function createI18nHelpers(i18nConfig) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
103
|
+
function isSupportedLocale(locale) {
|
|
104
|
+
return i18nConfig.locales.includes(locale);
|
|
105
|
+
}
|
|
106
|
+
function getValidLocale(locale) {
|
|
107
|
+
return isSupportedLocale(locale) ? locale : i18nConfig.defaultLocale;
|
|
108
|
+
}
|
|
109
|
+
const generatedLocales = i18nConfig.locales.map((loc) => ({
|
|
110
|
+
name: i18nConfig.localeLabels[loc] || loc,
|
|
111
|
+
locale: loc,
|
|
112
|
+
}));
|
|
113
|
+
return {
|
|
114
|
+
isSupportedLocale,
|
|
115
|
+
getValidLocale,
|
|
116
|
+
generatedLocales
|
|
117
|
+
};
|
|
137
118
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
119
|
+
// Convenient configuration presets
|
|
120
|
+
const LOCALE_PRESETS = {
|
|
121
|
+
// Only support English
|
|
122
|
+
EN_ONLY: { locales: ['en'], defaultLocale: 'en' },
|
|
123
|
+
// English and Chinese
|
|
124
|
+
EN_ZH: { locales: ['en', 'zh'], defaultLocale: 'en' },
|
|
125
|
+
// Main Asian languages
|
|
126
|
+
ASIA: { locales: ['en', 'zh', 'ja', 'ko'], defaultLocale: 'en' },
|
|
127
|
+
// Main European languages
|
|
128
|
+
EUROPE: { locales: ['en', 'fr', 'de', 'es', 'it'], defaultLocale: 'en' },
|
|
129
|
+
// Globalization
|
|
130
|
+
GLOBAL: { locales: ['en', 'zh', 'ja', 'ko', 'fr', 'de', 'es', 'it', 'pt', 'ru'], defaultLocale: 'en' },
|
|
131
|
+
// No internationalization (only default language)
|
|
132
|
+
NONE: { locales: [], defaultLocale: 'en' }
|
|
151
133
|
};
|
|
152
134
|
|
|
153
135
|
exports.LOCALE_PRESETS = LOCALE_PRESETS;
|
|
154
136
|
exports.createCommonAppConfig = createCommonAppConfig;
|
|
155
137
|
exports.createI18nHelpers = createI18nHelpers;
|
|
156
|
-
//# sourceMappingURL=common-app-config.js.map
|
|
157
|
-
//# sourceMappingURL=common-app-config.js.map
|
|
@@ -1,153 +1,133 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
|
|
21
|
-
// src/common-app-config.ts
|
|
22
|
-
var ALL_LOCALE_LABELS = {
|
|
23
|
-
en: "English",
|
|
24
|
-
zh: "\u7B80\u4F53\u4E2D\u6587",
|
|
25
|
-
ja: "\u65E5\u672C\u8A9E",
|
|
26
|
-
ko: "\uD55C\uAD6D\uC5B4",
|
|
27
|
-
fr: "Fran\xE7ais",
|
|
28
|
-
de: "Deutsch",
|
|
29
|
-
es: "Espa\xF1ol",
|
|
30
|
-
it: "Italiano",
|
|
31
|
-
pt: "Portugu\xEAs",
|
|
32
|
-
tr: "T\xFCrk\xE7e",
|
|
33
|
-
pl: "Polski",
|
|
34
|
-
ru: "\u0420\u0443\u0441\u0441\u043A\u0438\u0439",
|
|
35
|
-
ar: "\u0627\u0644\u0639\u0631\u0628\u064A\u0629",
|
|
36
|
-
hi: "\u0939\u093F\u0928\u094D\u0926\u0940",
|
|
37
|
-
th: "\u0E44\u0E17\u0E22",
|
|
38
|
-
vi: "Ti\u1EBFng Vi\u1EC7t"
|
|
1
|
+
// Supported languages and their labels
|
|
2
|
+
const ALL_LOCALE_LABELS = {
|
|
3
|
+
en: "English",
|
|
4
|
+
zh: "简体中文",
|
|
5
|
+
ja: "日本語",
|
|
6
|
+
ko: "한국어",
|
|
7
|
+
fr: "Français",
|
|
8
|
+
de: "Deutsch",
|
|
9
|
+
es: "Español",
|
|
10
|
+
it: "Italiano",
|
|
11
|
+
pt: "Português",
|
|
12
|
+
tr: "Türkçe",
|
|
13
|
+
pl: "Polski",
|
|
14
|
+
ru: "Русский",
|
|
15
|
+
ar: "العربية",
|
|
16
|
+
hi: "हिन्दी",
|
|
17
|
+
th: "ไทย",
|
|
18
|
+
vi: "Tiếng Việt",
|
|
39
19
|
};
|
|
20
|
+
// Helper function to get language configuration from environment variables
|
|
40
21
|
function getLocaleLabels(locales) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
])
|
|
46
|
-
);
|
|
22
|
+
return Object.fromEntries(locales.map(locale => [
|
|
23
|
+
locale,
|
|
24
|
+
ALL_LOCALE_LABELS[locale] || locale
|
|
25
|
+
]));
|
|
47
26
|
}
|
|
27
|
+
// Common application configuration creation function
|
|
48
28
|
function createCommonAppConfig(options) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
29
|
+
var _a, _b, _c, _d, _e;
|
|
30
|
+
// Priority: manual configuration > environment variables > default values
|
|
31
|
+
const locales = (_c = (_a = options === null || options === void 0 ? void 0 : options.locales) !== null && _a !== void 0 ? _a : (_b = process.env.NEXT_PUBLIC_I18N_LOCALES) === null || _b === void 0 ? void 0 : _b.split(',').map(s => s.trim())) !== null && _c !== void 0 ? _c : ['en', 'zh'];
|
|
32
|
+
const defaultLocale = (_e = (_d = options === null || options === void 0 ? void 0 : options.defaultLocale) !== null && _d !== void 0 ? _d : process.env.NEXT_PUBLIC_I18N_DEFAULT_LOCALE) !== null && _e !== void 0 ? _e : 'en';
|
|
33
|
+
const storagePrefix = process.env.NEXT_PUBLIC_I18N_STORAGE_PREFIX || 'WINDRUN-HUAIIN';
|
|
34
|
+
const config = {
|
|
35
|
+
// Basic configuration
|
|
36
|
+
baseUrl: process.env.NEXT_PUBLIC_BASE_URL || '',
|
|
37
|
+
githubBaseUrl: process.env.NEXT_PUBLIC_GITHUB_BASE_URL || '',
|
|
38
|
+
github: process.env.NEXT_PUBLIC_GITHUB || '',
|
|
39
|
+
githubInfoToken: process.env.NEXT_PUBLIC_FUMA_GITHUB_TOKEN || '',
|
|
40
|
+
// Internationalization configuration
|
|
41
|
+
i18n: {
|
|
42
|
+
locales: locales,
|
|
43
|
+
defaultLocale,
|
|
44
|
+
localeLabels: getLocaleLabels(locales),
|
|
45
|
+
detector: {
|
|
46
|
+
storageKey: process.env.NEXT_PUBLIC_I18N_STORAGE_KEY || 'language-preference-status',
|
|
47
|
+
autoCloseTimeout: parseInt(process.env.NEXT_PUBLIC_I18N_AUTO_CLOSE_TIMEOUT || '10000'),
|
|
48
|
+
expirationDays: parseInt(process.env.NEXT_PUBLIC_I18N_EXPIRATION_DAYS || '30'),
|
|
49
|
+
storagePrefix
|
|
50
|
+
},
|
|
51
|
+
messageRoot: process.env.NEXT_PUBLIC_I18N_MESSAGE_ROOT || 'messages',
|
|
52
|
+
},
|
|
53
|
+
// Style configuration
|
|
54
|
+
style: {
|
|
55
|
+
icon: {
|
|
56
|
+
uniformColor: process.env.NEXT_PUBLIC_STYLE_ICON_COLOR || "text-purple-500"
|
|
57
|
+
},
|
|
58
|
+
showBanner: process.env.NEXT_PUBLIC_STYLE_SHOW_BANNER === 'true',
|
|
59
|
+
clerkAuthInModal: process.env.NEXT_PUBLIC_STYLE_CLERK_AUTH_IN_MODAL === 'true',
|
|
60
|
+
clerkPageBanner: process.env.NEXT_PUBLIC_STYLE_CLERK_PAGE_BANNER === 'true',
|
|
61
|
+
watermark: {
|
|
62
|
+
enabled: process.env.NEXT_PUBLIC_STYLE_WATERMARK_ENABLED === 'true',
|
|
63
|
+
text: process.env.NEXT_PUBLIC_STYLE_WATERMARK_TEXT || "巽川·怀因"
|
|
64
|
+
},
|
|
65
|
+
cdnBaseUrl: process.env.NEXT_PUBLIC_STYLE_CDN_BASE_URL || "https://r2.d8ger.com",
|
|
66
|
+
cdnProxyUrl: process.env.NEXT_PUBLIC_STYLE_CDN_PROXY_URL || "https://r2-explorer-template.zcy777et.workers.dev/proxy",
|
|
67
|
+
placeHolder: {
|
|
68
|
+
image: process.env.NEXT_PUBLIC_STYLE_PLACEHOLDER_IMAGE || "/default.webp"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
// Clerk configuration
|
|
72
|
+
clerk: {
|
|
73
|
+
signInUrl: process.env.NEXT_PUBLIC_CLERK_SIGN_IN_URL || "/sign-in",
|
|
74
|
+
fallbackSignInUrl: process.env.NEXT_PUBLIC_CLERK_SIGN_IN_FALLBACK_REDIRECT_URL || "/",
|
|
75
|
+
signUpUrl: process.env.NEXT_PUBLIC_CLERK_SIGN_UP_URL || "/sign-up",
|
|
76
|
+
fallbackSignUpUrl: process.env.NEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URL || "/",
|
|
77
|
+
waitlistUrl: process.env.NEXT_PUBLIC_CLERK_WAITLIST_URL || "/waitlist",
|
|
78
|
+
debug: process.env.CLERK_DEBUG === 'true',
|
|
79
|
+
},
|
|
80
|
+
// MDX source file directory configuration
|
|
81
|
+
mdxSourceDir: {
|
|
82
|
+
docs: process.env.NEXT_PUBLIC_MDX_DOCS_DIR || "src/mdx/docs",
|
|
83
|
+
blog: process.env.NEXT_PUBLIC_MDX_BLOG_DIR || "src/mdx/blog",
|
|
84
|
+
legal: process.env.NEXT_PUBLIC_MDX_LEGAL_DIR || "src/mdx/legal"
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
// Convenient constants - avoid deep nested access
|
|
88
|
+
const shortcuts = {
|
|
89
|
+
iconColor: config.style.icon.uniformColor,
|
|
90
|
+
watermark: config.style.watermark,
|
|
91
|
+
showBanner: config.style.showBanner,
|
|
92
|
+
clerkPageBanner: config.style.clerkPageBanner,
|
|
93
|
+
clerkAuthInModal: config.style.clerkAuthInModal,
|
|
94
|
+
placeHolderImage: config.style.placeHolder.image,
|
|
95
|
+
clerk: config.clerk,
|
|
96
|
+
};
|
|
97
|
+
return Object.assign(Object.assign({}, config), { shortcuts });
|
|
118
98
|
}
|
|
99
|
+
// Create internationalization helper functions
|
|
119
100
|
function createI18nHelpers(i18nConfig) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
101
|
+
function isSupportedLocale(locale) {
|
|
102
|
+
return i18nConfig.locales.includes(locale);
|
|
103
|
+
}
|
|
104
|
+
function getValidLocale(locale) {
|
|
105
|
+
return isSupportedLocale(locale) ? locale : i18nConfig.defaultLocale;
|
|
106
|
+
}
|
|
107
|
+
const generatedLocales = i18nConfig.locales.map((loc) => ({
|
|
108
|
+
name: i18nConfig.localeLabels[loc] || loc,
|
|
109
|
+
locale: loc,
|
|
110
|
+
}));
|
|
111
|
+
return {
|
|
112
|
+
isSupportedLocale,
|
|
113
|
+
getValidLocale,
|
|
114
|
+
generatedLocales
|
|
115
|
+
};
|
|
135
116
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
117
|
+
// Convenient configuration presets
|
|
118
|
+
const LOCALE_PRESETS = {
|
|
119
|
+
// Only support English
|
|
120
|
+
EN_ONLY: { locales: ['en'], defaultLocale: 'en' },
|
|
121
|
+
// English and Chinese
|
|
122
|
+
EN_ZH: { locales: ['en', 'zh'], defaultLocale: 'en' },
|
|
123
|
+
// Main Asian languages
|
|
124
|
+
ASIA: { locales: ['en', 'zh', 'ja', 'ko'], defaultLocale: 'en' },
|
|
125
|
+
// Main European languages
|
|
126
|
+
EUROPE: { locales: ['en', 'fr', 'de', 'es', 'it'], defaultLocale: 'en' },
|
|
127
|
+
// Globalization
|
|
128
|
+
GLOBAL: { locales: ['en', 'zh', 'ja', 'ko', 'fr', 'de', 'es', 'it', 'pt', 'ru'], defaultLocale: 'en' },
|
|
129
|
+
// No internationalization (only default language)
|
|
130
|
+
NONE: { locales: [], defaultLocale: 'en' }
|
|
149
131
|
};
|
|
150
132
|
|
|
151
133
|
export { LOCALE_PRESETS, createCommonAppConfig, createI18nHelpers };
|
|
152
|
-
//# sourceMappingURL=common-app-config.mjs.map
|
|
153
|
-
//# sourceMappingURL=common-app-config.mjs.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
import 'clsx';
|
|
1
|
+
export * from './utils';
|
|
2
|
+
export * from './llm-utils';
|
|
3
|
+
export * from './common-app-config';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAC;AAGxB,cAAc,aAAa,CAAC;AAG5B,cAAc,qBAAqB,CAAC"}
|