wcz-test 6.5.4 → 6.7.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/client-utils.d.ts +281 -1733
- package/dist/client-utils.js +1 -6
- package/dist/client-utils.js.map +1 -1
- package/dist/index.d.ts +16 -2
- package/dist/index.js +58 -12
- package/dist/index.js.map +1 -1
- package/dist/server-utils.d.ts +3 -10
- package/dist/server-utils.js +2 -2
- package/dist/server-utils.js.map +1 -1
- package/package.json +5 -2
package/dist/client-utils.js
CHANGED
|
@@ -11,17 +11,12 @@ import "./chunk-5WRI5ZAA.js";
|
|
|
11
11
|
|
|
12
12
|
// src/client-utils.ts
|
|
13
13
|
import { t } from "i18next";
|
|
14
|
-
import {
|
|
15
|
-
import { initReactI18next, useTranslation } from "react-i18next";
|
|
16
|
-
import { default as default3 } from "i18next-browser-languagedetector";
|
|
14
|
+
import { useTranslation } from "react-i18next";
|
|
17
15
|
export {
|
|
18
|
-
default3 as LanguageDetector,
|
|
19
16
|
Platform,
|
|
20
17
|
WISTRON_PRIMARY_COLOR,
|
|
21
18
|
WISTRON_SECONDARY_COLOR,
|
|
22
19
|
authClient,
|
|
23
|
-
default2 as i18n,
|
|
24
|
-
initReactI18next,
|
|
25
20
|
t,
|
|
26
21
|
useTranslation
|
|
27
22
|
};
|
package/dist/client-utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client-utils.ts"],"sourcesContent":["export { Platform } from \"./lib/utils\";\r\nexport { WISTRON_PRIMARY_COLOR, WISTRON_SECONDARY_COLOR } from \"./hooks/ThemeHook\";\r\n\r\n// Internationalization\r\nexport { t } from \"i18next\";\r\nexport {
|
|
1
|
+
{"version":3,"sources":["../src/client-utils.ts"],"sourcesContent":["export { Platform } from \"./lib/utils\";\r\nexport { WISTRON_PRIMARY_COLOR, WISTRON_SECONDARY_COLOR } from \"./hooks/ThemeHook\";\r\n\r\n// Internationalization\r\nexport { t } from \"i18next\";\r\nexport { useTranslation } from \"react-i18next\";\r\n\r\n// Auth\r\nexport { authClient } from \"./lib/auth/auth-client\";\r\n\r\n"],"mappings":";;;;;;;;;;;;AAIA,SAAS,SAAS;AAClB,SAAS,sBAAsB;","names":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import * as _tanstack_start_client_core from '@tanstack/start-client-core';
|
|
2
|
+
import { CssVarsThemeOptions } from '@mui/material';
|
|
1
3
|
import { LinkOptions } from '@tanstack/react-router';
|
|
2
4
|
import { FC, ReactNode } from 'react';
|
|
3
|
-
import { CssVarsThemeOptions } from '@mui/material';
|
|
4
5
|
export { r as rootRouteHead } from './utils-ChipkRJ9.js';
|
|
6
|
+
import { Resource } from 'i18next';
|
|
7
|
+
import { Plugin } from 'vite';
|
|
5
8
|
import 'axios';
|
|
6
9
|
import 'uuidv7';
|
|
7
10
|
import '@t3-oss/env-core';
|
|
@@ -30,5 +33,16 @@ interface ProvidersProps {
|
|
|
30
33
|
children: ReactNode;
|
|
31
34
|
}
|
|
32
35
|
declare const LayoutProvider: FC<ProvidersProps>;
|
|
36
|
+
declare const setSSRLanguage: _tanstack_start_client_core.OptionalFetcher<undefined, undefined, Promise<void>>;
|
|
37
|
+
|
|
38
|
+
type RequireEn<T extends Resource> = T & {
|
|
39
|
+
en: T[keyof T];
|
|
40
|
+
};
|
|
41
|
+
interface ViteLayoutOptions<T extends Resource> {
|
|
42
|
+
i18n: {
|
|
43
|
+
resources: RequireEn<T>;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
declare function viteLayout<T extends Resource>({ i18n }: ViteLayoutOptions<T>): Plugin;
|
|
33
47
|
|
|
34
|
-
export { LayoutProvider, type Navigation };
|
|
48
|
+
export { LayoutProvider, type Navigation, setSSRLanguage, viteLayout };
|
package/dist/index.js
CHANGED
|
@@ -1641,9 +1641,16 @@ var AdapterDayjs = class {
|
|
|
1641
1641
|
};
|
|
1642
1642
|
|
|
1643
1643
|
// src/providers/LayoutProvider.tsx
|
|
1644
|
+
import { createServerFn } from "@tanstack/react-start";
|
|
1645
|
+
import { getCookie as getCookie2 } from "@tanstack/react-start/server";
|
|
1646
|
+
import dayjs2 from "dayjs";
|
|
1647
|
+
import "dayjs/locale/cs";
|
|
1648
|
+
import i18n from "i18next";
|
|
1649
|
+
import LanguageDetector from "i18next-browser-languagedetector";
|
|
1644
1650
|
import { useEffect as useEffect3, useEffectEvent } from "react";
|
|
1645
|
-
import {
|
|
1646
|
-
import
|
|
1651
|
+
import { initReactI18next } from "react-i18next";
|
|
1652
|
+
import { resources } from "virtual:layout";
|
|
1653
|
+
import z from "zod";
|
|
1647
1654
|
|
|
1648
1655
|
// src/providers/DialogsProvider.tsx
|
|
1649
1656
|
import { useId, useRef as useRef2, useState } from "react";
|
|
@@ -2104,12 +2111,12 @@ var ToolbarAccount = () => {
|
|
|
2104
2111
|
const [anchorElement, setAnchorElement] = useState4();
|
|
2105
2112
|
const [tab, setTab] = useState4("settings");
|
|
2106
2113
|
const open = Boolean(anchorElement);
|
|
2107
|
-
const { t, i18n } = useTranslation();
|
|
2114
|
+
const { t, i18n: i18n2 } = useTranslation();
|
|
2108
2115
|
const { mode, setMode } = useColorScheme();
|
|
2109
2116
|
const { data: session } = authClient.useSession();
|
|
2110
2117
|
const { alert } = useDialogs();
|
|
2111
|
-
const supportedLanguages = (Array.isArray(
|
|
2112
|
-
const languageDisplayNames = new Intl.DisplayNames([
|
|
2118
|
+
const supportedLanguages = (Array.isArray(i18n2.options.supportedLngs) ? i18n2.options.supportedLngs : []).filter((lng) => lng !== "cimode");
|
|
2119
|
+
const languageDisplayNames = new Intl.DisplayNames([i18n2.language], { type: "language" });
|
|
2113
2120
|
const colorModes = [
|
|
2114
2121
|
{ mode: "light", icon: LightMode, label: t("Layout.Light") },
|
|
2115
2122
|
{ mode: "dark", icon: DarkMode, label: t("Layout.Dark") },
|
|
@@ -2139,7 +2146,7 @@ var ToolbarAccount = () => {
|
|
|
2139
2146
|
] }),
|
|
2140
2147
|
/* @__PURE__ */ jsxs4(ListItemButton2, { onClick: changeTab("language"), sx: { py: 0.3 }, children: [
|
|
2141
2148
|
/* @__PURE__ */ jsx6(ListItemIcon2, { children: /* @__PURE__ */ jsx6(Translate, {}) }),
|
|
2142
|
-
/* @__PURE__ */ jsx6(ListItemText2, { primary: t("Layout.Language"), secondary: capitalize(languageDisplayNames.of(
|
|
2149
|
+
/* @__PURE__ */ jsx6(ListItemText2, { primary: t("Layout.Language"), secondary: capitalize(languageDisplayNames.of(i18n2.language)) }),
|
|
2143
2150
|
/* @__PURE__ */ jsx6(ChevronRight, {})
|
|
2144
2151
|
] })
|
|
2145
2152
|
] });
|
|
@@ -2170,10 +2177,10 @@ var ToolbarAccount = () => {
|
|
|
2170
2177
|
(languageCode) => /* @__PURE__ */ jsxs4(
|
|
2171
2178
|
ListItemButton2,
|
|
2172
2179
|
{
|
|
2173
|
-
onClick: () =>
|
|
2174
|
-
selected:
|
|
2180
|
+
onClick: () => i18n2.changeLanguage(languageCode).finally(() => closeMenu()),
|
|
2181
|
+
selected: i18n2.resolvedLanguage === languageCode,
|
|
2175
2182
|
children: [
|
|
2176
|
-
/* @__PURE__ */ jsx6(ListItemIcon2, { children:
|
|
2183
|
+
/* @__PURE__ */ jsx6(ListItemIcon2, { children: i18n2.resolvedLanguage === languageCode && /* @__PURE__ */ jsx6(Done, {}) }),
|
|
2177
2184
|
/* @__PURE__ */ jsx6(ListItemText2, { primary: capitalize(languageDisplayNames.of(languageCode)) })
|
|
2178
2185
|
]
|
|
2179
2186
|
},
|
|
@@ -2299,11 +2306,22 @@ var Layout = (props) => {
|
|
|
2299
2306
|
|
|
2300
2307
|
// src/providers/LayoutProvider.tsx
|
|
2301
2308
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
2309
|
+
var YEAR_IN_MINUTES = 60 * 24 * 365;
|
|
2310
|
+
i18n.use(LanguageDetector).use(initReactI18next).init({
|
|
2311
|
+
resources,
|
|
2312
|
+
fallbackLng: "en",
|
|
2313
|
+
supportedLngs: Object.keys(resources),
|
|
2314
|
+
detection: {
|
|
2315
|
+
caches: ["cookie"],
|
|
2316
|
+
cookieMinutes: YEAR_IN_MINUTES
|
|
2317
|
+
},
|
|
2318
|
+
interpolation: { escapeValue: false }
|
|
2319
|
+
});
|
|
2302
2320
|
var LayoutProvider = ({ navigation, theme, children }) => {
|
|
2303
|
-
const { i18n } = useTranslation2();
|
|
2304
2321
|
const createdTheme = useGetTheme(theme);
|
|
2305
2322
|
const languageChangedHandler = useEffectEvent(() => {
|
|
2306
2323
|
z.config(z.core.locales[i18n.language]());
|
|
2324
|
+
dayjs2.locale(i18n.language);
|
|
2307
2325
|
});
|
|
2308
2326
|
useEffect3(() => {
|
|
2309
2327
|
languageChangedHandler();
|
|
@@ -2312,11 +2330,39 @@ var LayoutProvider = ({ navigation, theme, children }) => {
|
|
|
2312
2330
|
i18n.off("languageChanged", languageChangedHandler);
|
|
2313
2331
|
};
|
|
2314
2332
|
}, []);
|
|
2315
|
-
return /* @__PURE__ */ jsx8(ThemeProvider, { theme: createdTheme, children: /* @__PURE__ */ jsx8(LocalizationProvider, { dateAdapter: AdapterDayjs, adapterLocale: i18n.
|
|
2333
|
+
return /* @__PURE__ */ jsx8(ThemeProvider, { theme: createdTheme, children: /* @__PURE__ */ jsx8(LocalizationProvider, { dateAdapter: AdapterDayjs, adapterLocale: i18n.language, children: /* @__PURE__ */ jsx8(DialogsProvider, { children: /* @__PURE__ */ jsx8(Layout, { navigation, children }) }) }, i18n.language) });
|
|
2316
2334
|
};
|
|
2335
|
+
var setSSRLanguage = createServerFn().handler(async () => {
|
|
2336
|
+
const language = getCookie2(i18n.services.languageDetector.options.lookupCookie) || "en";
|
|
2337
|
+
dayjs2.locale(language);
|
|
2338
|
+
z.config(z.core.locales[language]());
|
|
2339
|
+
await i18n.changeLanguage(language);
|
|
2340
|
+
});
|
|
2341
|
+
|
|
2342
|
+
// src/lib/vite-plugin.ts
|
|
2343
|
+
var VIRTUAL_ID = "virtual:layout";
|
|
2344
|
+
var RESOLVED_VIRTUAL_ID = "\0" + VIRTUAL_ID;
|
|
2345
|
+
function viteLayout({ i18n: i18n2 }) {
|
|
2346
|
+
return {
|
|
2347
|
+
name: "vite:layout",
|
|
2348
|
+
enforce: "pre",
|
|
2349
|
+
resolveId(id) {
|
|
2350
|
+
if (id === VIRTUAL_ID) return RESOLVED_VIRTUAL_ID;
|
|
2351
|
+
return null;
|
|
2352
|
+
},
|
|
2353
|
+
load(id) {
|
|
2354
|
+
if (id !== RESOLVED_VIRTUAL_ID) return null;
|
|
2355
|
+
return `
|
|
2356
|
+
export const resources = ${JSON.stringify(i18n2.resources)};
|
|
2357
|
+
`;
|
|
2358
|
+
}
|
|
2359
|
+
};
|
|
2360
|
+
}
|
|
2317
2361
|
export {
|
|
2318
2362
|
LayoutProvider,
|
|
2319
|
-
rootRouteHead
|
|
2363
|
+
rootRouteHead,
|
|
2364
|
+
setSSRLanguage,
|
|
2365
|
+
viteLayout
|
|
2320
2366
|
};
|
|
2321
2367
|
/*! Bundled license information:
|
|
2322
2368
|
|