@i18n-micro/solid 1.0.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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 s00d
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # @i18n-micro/solid
2
+
3
+ SolidJS plugin for internationalization using the same core logic as Nuxt I18n Micro. Provides reactive translations, route-specific support, and full TypeScript support.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @i18n-micro/solid
9
+ # or
10
+ npm install @i18n-micro/solid
11
+ # or
12
+ yarn add @i18n-micro/solid
13
+ ```
14
+
15
+ ## Quick Start
16
+
17
+ ```typescript
18
+ import { render } from 'solid-js/web'
19
+ import { createI18n, I18nProvider, useI18n } from '@i18n-micro/solid'
20
+
21
+ const i18n = createI18n({
22
+ locale: 'en',
23
+ fallbackLocale: 'en',
24
+ messages: {
25
+ en: {
26
+ greeting: 'Hello, {name}!',
27
+ apples: 'no apples | one apple | {count} apples',
28
+ },
29
+ fr: {
30
+ greeting: 'Bonjour, {name}!',
31
+ apples: 'pas de pommes | une pomme | {count} pommes',
32
+ },
33
+ },
34
+ })
35
+
36
+ function App() {
37
+ return (
38
+ <I18nProvider i18n={i18n}>
39
+ <MyComponent />
40
+ </I18nProvider>
41
+ )
42
+ }
43
+
44
+ const root = document.getElementById('root')!
45
+ render(() => <App />, root)
46
+ ```
47
+
48
+ ### Usage in Components
49
+
50
+ ```tsx
51
+ import { useI18n } from '@i18n-micro/solid'
52
+
53
+ function MyComponent() {
54
+ const { t, tc, locale, setLocale } = useI18n()
55
+
56
+ return (
57
+ <div>
58
+ <p>{t('greeting', { name: 'World' })}</p>
59
+ <p>{tc('apples', 5)}</p>
60
+ <button onClick={() => setLocale('fr')}>FR</button>
61
+ </div>
62
+ )
63
+ }
64
+ ```
65
+
66
+ ## Resources
67
+
68
+ - **Repository**: [https://github.com/s00d/nuxt-i18n-micro](https://github.com/s00d/nuxt-i18n-micro)
69
+ - **Documentation**: [https://s00d.github.io/nuxt-i18n-micro/](https://s00d.github.io/nuxt-i18n-micro/)
70
+
71
+ ## License
72
+
73
+ MIT
package/dist/index.cjs ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("solid-js"),te=require("solid-js/store"),I=require("@i18n-micro/core"),r=require("solid-js/web"),re=require("@solidjs/router");class W extends I.BaseI18n{_locale;_setLocale;_fallbackLocale;_currentRoute;_setRoute;cacheStore;setCacheStore;listeners=new Set;constructor(e){const[t,a]=i.createSignal(e.locale),[n]=i.createSignal(e.fallbackLocale||e.locale),[p,m]=i.createSignal("general"),[u,s]=te.createStore({general:{},route:{}}),c={generalLocaleCache:{value:u.general},routeLocaleCache:{value:u.route},dynamicTranslationsCaches:{value:[]},serverTranslationCache:{value:{}}};if(super({cache:c,plural:e.plural,missingWarn:e.missingWarn,missingHandler:e.missingHandler}),this._locale=t,this._setLocale=a,this._fallbackLocale=n,this._currentRoute=p,this._setRoute=m,this.cacheStore=u,this.setCacheStore=s,e.messages)for(const[l,g]of Object.entries(e.messages))this.addTranslations(l,g)}getLocale(){return this._locale()}getFallbackLocale(){return this._fallbackLocale()}getRoute(){return this._currentRoute()}set locale(e){this._setLocale(e),this.notifyListeners()}get locale(){return this._locale()}get localeAccessor(){return this._locale}get fallbackLocale(){return this._fallbackLocale()}get currentRoute(){return this._currentRoute()}get routeAccessor(){return this._currentRoute}setRoute(e){this._setRoute(e),this.notifyListeners()}addTranslations(e,t,a=!0){a?this.setCacheStore("general",e,n=>({...n||{},...t})):this.setCacheStore("general",e,t),this.notifyListeners()}addRouteTranslations(e,t,a,n=!0){const p=`${e}:${t}`;n?this.setCacheStore("route",p,m=>({...m||{},...a})):this.setCacheStore("route",p,a),this.notifyListeners()}clearCache(){this.setCacheStore("general",{}),this.setCacheStore("route",{}),super.clearCache(),this.notifyListeners()}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notifyListeners(){this.listeners.forEach(e=>{e()})}}function ne(o){return new W(o)}const T=i.createContext(),j=i.createContext(),N=i.createContext(),E=i.createContext(),P=()=>{const o=i.useContext(T);if(!o)throw new Error("[i18n-micro] I18nContext not found. Make sure I18nProvider is used.");return o},O=()=>{const o=i.useContext(j);if(!o)throw new Error("[i18n-micro] I18nLocalesContext not found. Make sure I18nLocalesContext is provided.");return o},F=()=>{const o=i.useContext(N);if(!o)throw new Error("[i18n-micro] I18nDefaultLocaleContext not found. Make sure I18nDefaultLocaleContext is provided.");return o},_=()=>i.useContext(E),oe=o=>{const e=o.children;return r.createComponent(T.Provider,{get value(){return o.i18n},get children(){return[r.memo(()=>r.memo(()=>!!o.locales)()&&r.createComponent(j.Provider,{get value(){return o.locales},get children(){return[r.memo(()=>r.memo(()=>!!o.defaultLocale)()&&r.createComponent(N.Provider,{get value(){return o.defaultLocale},get children(){return[r.memo(()=>r.memo(()=>!!o.routingStrategy)()&&r.createComponent(E.Provider,{get value(){return o.routingStrategy},children:e})),r.memo(()=>!o.routingStrategy&&e)]}})),r.memo(()=>!o.defaultLocale&&e)]}})),r.memo(()=>!o.locales&&e)]}})};function ae(o){const e=P(),t=_(),a=O(),n=F(),p=o?.locales||a,m=o?.defaultLocale||n,u=(s,c)=>t?.resolvePath?t.resolvePath(s,c||e.getLocale()):s;return{instance:e,locale:i.createMemo(()=>e.localeAccessor()),getLocales:()=>p,defaultLocale:()=>m,getLocaleName:()=>p.find(c=>c.code===e.localeAccessor())?.displayName||null,localeRoute:u,localePath:(s,c)=>{const l=u(s,c);return typeof l=="string"?l:l.path||"/"},switchLocale:s=>{if(e.locale=s,t){const c=t.getCurrentPath(),l=u(c,s);t.push(typeof l=="string"?{path:l}:{path:l.path||"/"})}},t:e.t.bind(e),ts:e.ts.bind(e),tc:e.tc.bind(e),tn:e.tn.bind(e),td:e.td.bind(e),tdr:e.tdr.bind(e),has:e.has.bind(e),setRoute:e.setRoute.bind(e),getRoute:e.getRoute.bind(e),getLocale:()=>e.getLocale(),addTranslations:e.addTranslations.bind(e),addRouteTranslations:e.addRouteTranslations.bind(e),clearCache:e.clearCache.bind(e)}}const se=o=>{const e=P(),[t,a]=i.splitProps(o,["keypath","params","tag","plural","defaultValue","html","hideIfEmpty","customPluralRule","number","date","relativeDate"]),n=i.createMemo(()=>{const m=e.localeAccessor(),u=e.routeAccessor();if(t.number!==void 0){const c=Number(t.number),l=e.tn(c),g=e.t(t.keypath,{number:l,...t.params||{}},void 0,u);return typeof g=="string"?g:String(g)}if(t.date!==void 0){const c=e.td(t.date),l=e.t(t.keypath,{date:c,...t.params||{}},void 0,u);return typeof l=="string"?l:String(l)}if(t.relativeDate!==void 0){const c=e.tdr(t.relativeDate),l=e.t(t.keypath,{relativeDate:c,...t.params||{}},void 0,u);return typeof l=="string"?l:String(l)}if(t.plural!==void 0){const c=Number.parseInt(t.plural.toString());return t.customPluralRule?t.customPluralRule(t.keypath,c,t.params||{},m,(g,d,y)=>e.t(g,d,y,u))||"":e.tc(t.keypath,{count:c,...t.params||{}},t.defaultValue)}const s=(e.t(t.keypath,t.params,t.defaultValue,u)??"").toString();return t.hideIfEmpty&&!s.trim()?t.defaultValue||"":s});if(t.html)return r.createComponent(r.Dynamic,r.mergeProps({get component(){return t.tag||"span"}},a,{get innerHTML(){return n()}}));const p=n();return t.hideIfEmpty&&!p.trim()?t.defaultValue?r.createComponent(r.Dynamic,r.mergeProps({get component(){return t.tag||"span"}},a,{get children(){return t.defaultValue}})):null:r.createComponent(r.Dynamic,r.mergeProps({get component(){return t.tag||"span"}},a,{children:p}))};var ce=r.template('<a target=_blank rel="noopener noreferrer">'),le=r.template("<a>");const ie=o=>{const e=_(),t=P(),[a,n]=i.splitProps(o,["to","localeRoute","activeStyle","style","children"]),m=e?.getCurrentPathAccessor,u=i.createMemo(()=>{const d=t.localeAccessor();let y;if(a.localeRoute){const L=a.localeRoute(a.to,d);y=typeof L=="string"?L:L?.path||"/"}else if(e?.resolvePath){const L=e.resolvePath(a.to,d);y=typeof L=="string"?L:L?.path||"/"}else typeof a.to=="string"?y=a.to:y=a.to?.path||"/";return y}),s=i.createMemo(()=>typeof a.to=="string"?/^(?:https?:\/\/|\/\/|[a-zA-Z0-9-]+\.[a-zA-Z]{2,})|tel:|mailto:/.test(a.to):!1),c=i.createMemo(()=>{if(s())return!1;const d=m?m():e?e.getCurrentPath():typeof window<"u"?window.location.pathname:"/",y=u(),L=d==="/"?"/":d.replace(/\/$/,""),$=y==="/"?"/":y.replace(/\/$/,"");return L===$}),l=i.createMemo(()=>{const d=a.style||{},L=c()?a.activeStyle||{}:{};return{...typeof d=="object"?d:{},...typeof L=="object"?L:{}}}),g=e?.linkComponent;return s()?(()=>{var d=ce();return r.spread(d,r.mergeProps({get href(){return r.memo(()=>typeof a.to=="string")()?a.to:""},get style(){return l()}},n),!1,!0),r.insert(d,()=>a.children),d})():g?r.createComponent(g,r.mergeProps({get href(){return u()},get style(){return l()}},n,{get children(){return a.children}})):(()=>{var d=le();return r.spread(d,r.mergeProps({get href(){return u()},get style(){return l()}},n,{onClick:y=>{e&&!s()&&(y.preventDefault(),e.push({path:u()}))}}),!1,!0),r.insert(d,()=>a.children),d})()};var ue=r.template("<div class=i18n-switcher-wrapper><button type=button class=i18n-switcher-button aria-haspopup=true><span></span><span>▼"),de=r.template("<ul class=i18n-switcher-dropdown>"),he=r.template("<li><a>");const pe=o=>{const e=P(),t=_(),a=O(),[n,p]=i.splitProps(o,["locales","currentLocale","getLocaleName","switchLocale","localeRoute","customLabels","customWrapperStyle","customButtonStyle","customDropdownStyle","customItemStyle","customLinkStyle","customActiveLinkStyle","customDisabledLinkStyle","customIconStyle"]),[m,u]=i.createSignal(!1);let s;const c=i.createMemo(()=>n.locales||a||[]),l=i.createMemo(()=>n.currentLocale!==void 0?typeof n.currentLocale=="function"?n.currentLocale():n.currentLocale:e.localeAccessor()),g=i.createMemo(()=>n.getLocaleName?n.getLocaleName()||null:c().find(v=>v.code===e.localeAccessor())?.displayName||null),d=h=>{h&&(h.stopPropagation(),h.preventDefault()),u(!m())},y=h=>n.customLabels?.[h.code]||h.displayName||h.code,L=i.createMemo(()=>{const h=c().find(v=>v.code===l());return h?y(h):g()||l()}),$=async h=>{if(u(!1),n.switchLocale){n.switchLocale(h);return}if(e.locale=h,!t)return;const v=t,S=v.getCurrentPathAccessor?v.getCurrentPathAccessor():t.getCurrentPath(),x=n.localeRoute?(()=>{const f=n.localeRoute(S,h);return typeof f=="string"?f:f.path||"/"})():t?.resolvePath?(()=>{const f=t.resolvePath(S,h);return typeof f=="string"?f:f.path||"/"})():S;t.push({path:x})},H={position:"relative",display:"inline-block","vertical-align":"middle"},G={padding:"4px 12px","font-size":"16px",cursor:"pointer","background-color":"#fff",border:"1px solid #333",transition:"background-color 0.3s ease",display:"flex","align-items":"center","justify-content":"space-between"},Z={position:"absolute",top:"100%",left:"0","z-index":1e3,"background-color":"#fff",border:"1px solid #333","list-style":"none",padding:"0",margin:"4px 0 0 0","min-width":"150px","box-shadow":"0 2px 8px rgba(0,0,0,0.15)"},J={margin:"0",padding:"0"},K={display:"block",padding:"8px 12px",color:"#333","text-decoration":"none",transition:"background-color 0.3s ease",cursor:"pointer"},Q={"font-weight":"bold",color:"#007bff"},U={"margin-left":"8px",display:"inline-block",transition:"transform 0.3s ease"},X={transform:"rotate(180deg)"},V=h=>{if(!m())return;const v=h.target;if(!v||!s)return;const S=s.contains(v),x=v.closest(".i18n-switcher-button")!==null;!S&&!x&&u(!1)};return i.onMount(()=>{document.addEventListener("click",V)}),i.onCleanup(()=>{document.removeEventListener("click",V)}),(()=>{var h=ue(),v=h.firstChild,S=v.firstChild,x=S.nextSibling;return r.use(f=>{s=f},h),r.spread(h,r.mergeProps({get style(){return{...H,...n.customWrapperStyle}}},p),!1,!0),v.$$click=f=>{f.preventDefault(),f.stopPropagation(),d(f)},r.insert(S,L),r.insert(h,(()=>{var f=r.memo(()=>!!m());return()=>f()&&(()=>{var k=de();return r.insert(k,()=>c().map(C=>{const w=C.code===l(),q=t,A=q?.getCurrentPathAccessor?q.getCurrentPathAccessor():t?.getCurrentPath()||(typeof window<"u"?window.location.pathname:"/"),D=n.localeRoute?n.localeRoute(A,C.code):t?.resolvePath?t.resolvePath(A,C.code):A,B=typeof D=="string"?D:D?.path||"#";return(()=>{var M=he(),R=M.firstChild;return R.$$click=b=>{b.preventDefault(),b.stopPropagation(),$(C.code)},r.setAttribute(R,"href",typeof B=="string"?B:"#"),r.insert(R,()=>y(C)),r.effect(b=>{var Y={...J,...n.customItemStyle},z=`switcher-locale-${C.code}`,ee={...K,...w?Q:{},...n.customLinkStyle,...w?n.customActiveLinkStyle:{}};return b.e=r.style(M,Y,b.e),z!==b.t&&r.className(R,b.t=z),b.a=r.style(R,ee,b.a),b},{e:void 0,t:void 0,a:void 0}),M})()})),r.effect(C=>r.style(k,{...Z,...n.customDropdownStyle},C)),k})()})(),null),r.effect(f=>{var k={...G,...n.customButtonStyle},C=m(),w={...U,...m()?X:{},...n.customIconStyle};return f.e=r.style(v,k,f.e),C!==f.t&&r.setAttribute(v,"aria-expanded",f.t=C),f.a=r.style(x,w,f.a),f},{e:void 0,t:void 0,a:void 0}),h})()};r.delegateEvents(["click"]);var fe=r.template("<div>");const me=o=>{const e=P(),[t,a]=i.splitProps(o,["prefix","groupClass"]),n=(p,m)=>{const u=e.t(`${t.prefix}.${p}`,m,void 0,e.getRoute());return typeof u=="string"?u:String(u)};return(()=>{var p=fe();return r.spread(p,r.mergeProps({get class(){return["i18n-group",t.groupClass].filter(Boolean).join(" ")}},a),!1,!0),r.insert(p,(()=>{var m=r.memo(()=>typeof o.children=="function");return()=>m()?o.children({prefix:t.prefix,t:n}):o.children})()),p})()};function ge(o,e,t,a){const n=o.map(s=>s.code),[p,m]=i.createSignal(a.pathname);i.createEffect(()=>{m(a.pathname)});const u=(s,c)=>{const g=(typeof s=="string"?s:s.path||"/").split("/").filter(Boolean);g.length>0&&n.includes(g[0])&&g.shift();const d="/"+g.join("/");return c===e?d:`/${c}${d==="/"?"":d}`};return{getCurrentPath:()=>p(),getCurrentPathAccessor:p,push:s=>{t(s.path)},replace:s=>{t(s.path,{replace:!0})},resolvePath:(s,c)=>u(s,c),getRoute:()=>({fullPath:p(),query:{}}),linkComponent:(s=>{const{href:c,children:l,class:g,style:d,...y}=s;return r.createComponent(re.A,r.mergeProps({href:c,class:g,style:d},y,{children:l}))})}}Object.defineProperty(exports,"FormatService",{enumerable:!0,get:()=>I.FormatService});Object.defineProperty(exports,"defaultPlural",{enumerable:!0,get:()=>I.defaultPlural});Object.defineProperty(exports,"interpolate",{enumerable:!0,get:()=>I.interpolate});exports.I18nContext=T;exports.I18nDefaultLocaleContext=N;exports.I18nGroup=me;exports.I18nLink=ie;exports.I18nLocalesContext=j;exports.I18nProvider=oe;exports.I18nRouterContext=E;exports.I18nSwitcher=pe;exports.I18nT=se;exports.SolidI18n=W;exports.createI18n=ne;exports.createSolidRouterAdapter=ge;exports.useI18n=ae;exports.useI18nContext=P;exports.useI18nDefaultLocale=F;exports.useI18nLocales=O;exports.useI18nRouter=_;
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../src/i18n.ts","../src/injection.ts","../src/context.tsx","../src/use-i18n.ts","../src/components/I18nT.tsx","../src/components/I18nLink.tsx","../src/components/I18nSwitcher.tsx","../src/components/I18nGroup.tsx","../src/router/adapter.tsx"],"sourcesContent":["import { createSignal, type Accessor, type Setter } from 'solid-js'\nimport { createStore, type SetStoreFunction } from 'solid-js/store'\nimport { BaseI18n, type TranslationCache } from '@i18n-micro/core'\nimport type { Translations, PluralFunc } from '@i18n-micro/types'\n\nexport interface SolidI18nOptions {\n locale: string\n fallbackLocale?: string\n messages?: Record<string, Translations>\n plural?: PluralFunc\n missingWarn?: boolean\n missingHandler?: (locale: string, key: string, routeName: string) => void\n}\n\n/**\n * SolidJS I18n Adapter\n *\n * Provides a SolidJS-compatible i18n instance that uses the shared core logic.\n * Uses createSignal for locale/route reactivity and createStore for translation cache.\n */\nexport class SolidI18n extends BaseI18n {\n // Реактивные примитивы Solid\n private _locale: Accessor<string>\n private _setLocale: Setter<string>\n private _fallbackLocale: Accessor<string>\n private _currentRoute: Accessor<string>\n private _setRoute: Setter<string>\n\n // Store для кэша.\n // Мы используем createStore для глубокой реактивности, чтобы при подгрузке\n // частичных переводов (mergeTranslation) интерфейс обновлялся.\n public readonly cacheStore: {\n general: Record<string, Translations>\n route: Record<string, Translations>\n }\n\n private setCacheStore: SetStoreFunction<{\n general: Record<string, Translations>\n route: Record<string, Translations>\n }>\n\n // Слушатели для DevTools (аналог subscribe в React версии)\n private listeners = new Set<() => void>()\n\n constructor(options: SolidI18nOptions) {\n // 1. Инициализация реактивного хранилища\n // Создаем signals и store напрямую (без createRoot, так как это SolidJS, не Preact)\n const [locale, setLocale] = createSignal(options.locale)\n const [fallback] = createSignal(options.fallbackLocale || options.locale)\n const [route, setRoute] = createSignal('general')\n\n const [store, setStore] = createStore({\n general: {} as Record<string, Translations>,\n route: {} as Record<string, Translations>,\n })\n\n // 2. Адаптация для BaseI18n\n // BaseI18n ожидает RefLike объекты. В Solid Store работает как Proxy,\n // поэтому мы можем обернуть доступ к нему.\n const cacheAdapter: TranslationCache = {\n // Solid Store Proxy is compatible with reading objects\n generalLocaleCache: { value: store.general } as unknown as TranslationCache['generalLocaleCache'],\n routeLocaleCache: { value: store.route } as unknown as TranslationCache['routeLocaleCache'],\n dynamicTranslationsCaches: { value: [] },\n serverTranslationCache: { value: {} },\n }\n\n super({\n cache: cacheAdapter,\n plural: options.plural,\n missingWarn: options.missingWarn,\n missingHandler: options.missingHandler,\n })\n\n this._locale = locale\n this._setLocale = setLocale\n this._fallbackLocale = fallback\n this._currentRoute = route\n this._setRoute = setRoute\n\n this.cacheStore = store\n this.setCacheStore = setStore\n\n // Загрузка начальных сообщений\n if (options.messages) {\n for (const [lang, msgs] of Object.entries(options.messages)) {\n this.addTranslations(lang, msgs)\n }\n }\n }\n\n // --- Abstract Implementation ---\n\n public getLocale(): string {\n return this._locale()\n }\n\n public getFallbackLocale(): string {\n return this._fallbackLocale()\n }\n\n public getRoute(): string {\n return this._currentRoute()\n }\n\n // --- Setters ---\n\n public set locale(val: string) {\n this._setLocale(val)\n this.notifyListeners()\n }\n\n public get locale(): string {\n return this._locale()\n }\n\n // Публичный accessor для реактивности\n public get localeAccessor(): Accessor<string> {\n return this._locale\n }\n\n public get fallbackLocale(): string {\n return this._fallbackLocale()\n }\n\n public get currentRoute(): string {\n return this._currentRoute()\n }\n\n // Публичный accessor для реактивности\n public get routeAccessor(): Accessor<string> {\n return this._currentRoute\n }\n\n public setRoute(val: string): void {\n this._setRoute(val)\n this.notifyListeners()\n }\n\n // --- Overrides for Reactivity ---\n\n public addTranslations(locale: string, translations: Translations, merge = true): void {\n if (merge) {\n this.setCacheStore('general', locale, (prev: Translations | undefined) => ({\n ...(prev || {}),\n ...translations,\n }))\n }\n else {\n this.setCacheStore('general', locale, translations)\n }\n this.notifyListeners()\n }\n\n public addRouteTranslations(locale: string, routeName: string, translations: Translations, merge = true): void {\n const key = `${locale}:${routeName}`\n if (merge) {\n this.setCacheStore('route', key, (prev: Translations | undefined) => ({\n ...(prev || {}),\n ...translations,\n }))\n }\n else {\n this.setCacheStore('route', key, translations)\n }\n this.notifyListeners()\n }\n\n public override clearCache(): void {\n this.setCacheStore('general', {})\n this.setCacheStore('route', {})\n super.clearCache()\n this.notifyListeners()\n }\n\n public subscribe(cb: () => void): () => void {\n this.listeners.add(cb)\n return () => this.listeners.delete(cb)\n }\n\n private notifyListeners(): void {\n this.listeners.forEach((cb) => {\n cb()\n })\n }\n}\n\nexport function createI18n(options: SolidI18nOptions): SolidI18n {\n return new SolidI18n(options)\n}\n","import { createContext, useContext } from 'solid-js'\nimport type { SolidI18n } from './i18n'\nimport type { Locale } from '@i18n-micro/types'\nimport type { I18nRoutingStrategy } from './router/types'\n\n// Context keys (analogous to Vue's InjectionKey)\nexport const I18nContext = createContext<SolidI18n>()\nexport const I18nLocalesContext = createContext<Locale[]>()\nexport const I18nDefaultLocaleContext = createContext<string>()\nexport const I18nRouterContext = createContext<I18nRoutingStrategy | undefined>()\n\n// Helper hooks (analogous to Vue's inject)\nexport const useI18nContext = () => {\n const context = useContext(I18nContext)\n if (!context) {\n throw new Error('[i18n-micro] I18nContext not found. Make sure I18nProvider is used.')\n }\n return context\n}\n\nexport const useI18nLocales = () => {\n const context = useContext(I18nLocalesContext)\n if (!context) {\n throw new Error('[i18n-micro] I18nLocalesContext not found. Make sure I18nLocalesContext is provided.')\n }\n return context\n}\n\nexport const useI18nDefaultLocale = () => {\n const context = useContext(I18nDefaultLocaleContext)\n if (!context) {\n throw new Error('[i18n-micro] I18nDefaultLocaleContext not found. Make sure I18nDefaultLocaleContext is provided.')\n }\n return context\n}\n\nexport const useI18nRouter = () => {\n return useContext(I18nRouterContext)\n}\n","/* eslint-disable @typescript-eslint/ban-ts-comment */\n// @ts-nocheck\nimport type { ParentComponent, JSX } from 'solid-js'\nimport type { SolidI18n } from './i18n'\nimport type { Locale } from '@i18n-micro/types'\nimport { I18nContext, I18nLocalesContext, I18nDefaultLocaleContext, I18nRouterContext } from './injection'\nimport type { I18nRoutingStrategy } from './router/types'\n\nexport interface I18nProviderProps {\n i18n: SolidI18n\n locales?: Locale[]\n defaultLocale?: string\n routingStrategy?: I18nRoutingStrategy\n}\n\nexport const I18nProvider: ParentComponent<I18nProviderProps> = (props): JSX.Element => {\n const children = props.children as JSX.Element\n return (\n // @ts-expect-error - Provider components type conflict with Vue JSX\n <I18nContext.Provider value={props.i18n}>\n {props.locales && (\n // @ts-expect-error - Provider components type conflict with Vue JSX\n <I18nLocalesContext.Provider value={props.locales}>\n {props.defaultLocale && (\n // @ts-expect-error - Provider components type conflict with Vue JSX\n <I18nDefaultLocaleContext.Provider value={props.defaultLocale}>\n {props.routingStrategy && (\n // @ts-expect-error - Provider components type conflict with Vue JSX\n <I18nRouterContext.Provider value={props.routingStrategy}>\n {children}\n </I18nRouterContext.Provider>\n )}\n {!props.routingStrategy && children}\n </I18nDefaultLocaleContext.Provider>\n )}\n {!props.defaultLocale && children}\n </I18nLocalesContext.Provider>\n )}\n {!props.locales && children}\n </I18nContext.Provider>\n ) as unknown as JSX.Element\n}\n\n// Keep useI18nContext for backward compatibility\nexport { useI18nContext } from './injection'\n","import { createMemo } from 'solid-js'\nimport { useI18nContext, useI18nLocales, useI18nDefaultLocale, useI18nRouter } from './injection'\nimport type { Locale } from '@i18n-micro/types'\n\nexport interface UseI18nOptions {\n locales?: Locale[]\n defaultLocale?: string\n}\n\nexport function useI18n(options?: UseI18nOptions) {\n const i18n = useI18nContext()\n const router = useI18nRouter()\n const injectedLocales = useI18nLocales()\n const injectedDefaultLocale = useI18nDefaultLocale()\n\n const locales = options?.locales || injectedLocales\n const defaultLocale = options?.defaultLocale || injectedDefaultLocale\n\n const resolveLocalePath = (to: string | { path?: string }, localeCode?: string): string | { path?: string } => {\n if (!router?.resolvePath) {\n return to\n }\n return router.resolvePath(to, localeCode || i18n.getLocale())\n }\n\n return {\n // Direct access to instance\n instance: i18n,\n\n // Locale (reactive) - используем accessor для отслеживания изменений\n locale: createMemo(() => i18n.localeAccessor()),\n\n // Locale helpers\n getLocales: () => locales,\n defaultLocale: () => defaultLocale,\n getLocaleName: () => {\n // Используем accessor для реактивности\n const current = locales.find(l => l.code === i18n.localeAccessor())\n return current?.displayName || null\n },\n\n // Routing helpers\n localeRoute: resolveLocalePath,\n localePath: (to: string | { path?: string }, locale?: string): string => {\n const res = resolveLocalePath(to, locale)\n return typeof res === 'string' ? res : (res.path || '/')\n },\n switchLocale: (newLocale: string) => {\n i18n.locale = newLocale\n if (router) {\n const currentPath = router.getCurrentPath()\n const newPath = resolveLocalePath(currentPath, newLocale)\n router.push(typeof newPath === 'string' ? { path: newPath } : { path: newPath.path || '/' })\n }\n },\n\n // Translation methods (delegate to instance)\n t: i18n.t.bind(i18n),\n ts: i18n.ts.bind(i18n),\n tc: i18n.tc.bind(i18n),\n tn: i18n.tn.bind(i18n),\n td: i18n.td.bind(i18n),\n tdr: i18n.tdr.bind(i18n),\n has: i18n.has.bind(i18n),\n\n // Route management\n setRoute: i18n.setRoute.bind(i18n),\n getRoute: i18n.getRoute.bind(i18n),\n getLocale: () => i18n.getLocale(),\n\n // Translation management\n addTranslations: i18n.addTranslations.bind(i18n),\n addRouteTranslations: i18n.addRouteTranslations.bind(i18n),\n clearCache: i18n.clearCache.bind(i18n),\n }\n}\n","/* eslint-disable @typescript-eslint/ban-ts-comment */\n// @ts-nocheck\nimport { splitProps, createMemo, type Component, type JSX } from 'solid-js'\nimport { Dynamic } from 'solid-js/web'\nimport { useI18nContext } from '../injection'\nimport type { TranslationKey, PluralFunc } from '@i18n-micro/types'\n\ninterface I18nTProps extends JSX.HTMLAttributes<HTMLElement> {\n keypath: TranslationKey\n params?: Record<string, string | number | boolean>\n tag?: string\n plural?: number | string\n defaultValue?: string\n html?: boolean\n hideIfEmpty?: boolean\n customPluralRule?: PluralFunc\n number?: number | string\n date?: Date | string | number\n relativeDate?: Date | string | number\n}\n\nexport const I18nT: Component<I18nTProps> = (props): JSX.Element => {\n const i18n = useI18nContext()\n const [local, others] = splitProps(props, [\n 'keypath',\n 'params',\n 'tag',\n 'plural',\n 'defaultValue',\n 'html',\n 'hideIfEmpty',\n 'customPluralRule',\n 'number',\n 'date',\n 'relativeDate',\n ])\n\n // Используем createMemo для реактивности (отслеживает изменения локали и роута)\n // В Solid мемо автоматически отслеживает зависимости при использовании в JSX\n const translation = createMemo(() => {\n // Отслеживаем изменения локали и роута через accessors\n const locale = i18n.localeAccessor()\n const route = i18n.routeAccessor()\n\n // Handle number formatting\n if (local.number !== undefined) {\n const numberValue = Number(local.number)\n const formattedNumber = i18n.tn(numberValue)\n const result = i18n.t(local.keypath, { number: formattedNumber, ...(local.params || {}) }, undefined, route)\n return typeof result === 'string' ? result : String(result)\n }\n\n // Handle date formatting\n if (local.date !== undefined) {\n const formattedDate = i18n.td(local.date)\n const result = i18n.t(local.keypath, { date: formattedDate, ...(local.params || {}) }, undefined, route)\n return typeof result === 'string' ? result : String(result)\n }\n\n // Handle relative date formatting\n if (local.relativeDate !== undefined) {\n const formattedRelativeDate = i18n.tdr(local.relativeDate)\n const result = i18n.t(local.keypath, { relativeDate: formattedRelativeDate, ...(local.params || {}) }, undefined, route)\n return typeof result === 'string' ? result : String(result)\n }\n\n // Handle pluralization\n if (local.plural !== undefined) {\n const count = Number.parseInt(local.plural.toString())\n if (local.customPluralRule) {\n const translationResult = local.customPluralRule(\n local.keypath,\n count,\n local.params || {},\n locale,\n (k: TranslationKey, p?: Record<string, string | number | boolean>, dv?: string) => i18n.t(k, p, dv, route),\n )\n return translationResult || ''\n }\n else {\n return i18n.tc(local.keypath, { count, ...(local.params || {}) }, local.defaultValue)\n }\n }\n\n // Regular translation\n const translationResult = (i18n.t(local.keypath, local.params, local.defaultValue, route) ?? '').toString()\n\n if (local.hideIfEmpty && !translationResult.trim()) {\n return local.defaultValue || ''\n }\n\n return translationResult\n })\n\n // Если html=true, используем innerHTML и не рендерим children\n if (local.html) {\n return (\n // @ts-expect-error - Dynamic component type conflict with Vue JSX\n <Dynamic\n component={local.tag || 'span'}\n {...(others as unknown as Record<string, unknown>)}\n innerHTML={translation()}\n />\n ) as unknown as JSX.Element\n }\n\n // Если html=false, рендерим как текст (Solid автоматически экранирует HTML)\n const translationValue = translation()\n if (local.hideIfEmpty && !translationValue.trim()) {\n if (local.defaultValue) {\n return (\n <Dynamic\n component={local.tag || 'span'}\n {...(others as unknown as Record<string, unknown>)}\n >\n {local.defaultValue}\n </Dynamic>\n ) as unknown as JSX.Element\n }\n return null as unknown as JSX.Element\n }\n\n return (\n // @ts-expect-error - Dynamic component type conflict with Vue JSX\n <Dynamic\n component={local.tag || 'span'}\n {...(others as unknown as Record<string, unknown>)}\n >\n {translationValue}\n </Dynamic>\n ) as unknown as JSX.Element\n}\n","/* eslint-disable @typescript-eslint/ban-ts-comment */\n// @ts-nocheck\nimport { splitProps, createMemo, type Accessor, type Component, type JSX } from 'solid-js'\nimport { useI18nRouter, useI18nContext } from '../injection'\nimport type { I18nRoutingStrategy } from '../router/types'\n\ninterface I18nLinkProps extends JSX.AnchorHTMLAttributes<HTMLAnchorElement> {\n to: string | { path?: string }\n localeRoute?: (to: string | { path?: string }, locale?: string) => string | { path?: string }\n activeStyle?: JSX.CSSProperties\n}\n\nexport const I18nLink: Component<I18nLinkProps> = (props): JSX.Element => {\n const router = useI18nRouter()\n const i18n = useI18nContext()\n // Разделяем пропсы: явно выделяем style, чтобы объединить его с activeStyle\n const [local, others] = splitProps(props, ['to', 'localeRoute', 'activeStyle', 'style', 'children'])\n\n // 1. Получаем accessor для текущего пути из роутера\n const extendedRouter = router as I18nRoutingStrategy & { getCurrentPathAccessor?: Accessor<string> }\n const pathnameAccessor = extendedRouter?.getCurrentPathAccessor\n\n // 2. Вычисление целевого пути (href) - реактивно отслеживает изменения локали\n const targetPath = createMemo(() => {\n // Используем реактивный accessor для отслеживания изменений локали\n const currentLocale = i18n.localeAccessor()\n let result: string\n if (local.localeRoute) {\n const res = local.localeRoute(local.to, currentLocale)\n result = typeof res === 'string' ? res : res?.path || '/'\n }\n else if (router?.resolvePath) {\n const res = router.resolvePath(local.to, currentLocale)\n result = typeof res === 'string' ? res : (res?.path || '/')\n }\n else if (typeof local.to === 'string') {\n result = local.to\n }\n else {\n result = (local.to as { path?: string })?.path || '/'\n }\n return result\n })\n\n // 3. Проверка на внешнюю ссылку\n const isExternal = createMemo(() => {\n if (typeof local.to === 'string') {\n return /^(?:https?:\\/\\/|\\/\\/|[a-zA-Z0-9-]+\\.[a-zA-Z]{2,})|tel:|mailto:/.test(local.to)\n }\n return false\n })\n\n // 4. Вычисление активного состояния\n // Важно: вызываем pathnameAccessor() внутри createMemo для правильного отслеживания изменений\n const isActive = createMemo(() => {\n if (isExternal()) {\n return false\n }\n\n // Получаем текущий путь - вызываем accessor внутри createMemo для реактивности\n const current = pathnameAccessor\n ? pathnameAccessor() // Вызов accessor внутри createMemo отслеживает изменения\n : (router ? router.getCurrentPath() : (typeof window !== 'undefined' ? window.location.pathname : '/'))\n const target = targetPath()\n\n // Нормализация для сравнения (убираем слэш в конце, если это не корень)\n const normCurrent = current === '/' ? '/' : current.replace(/\\/$/, '')\n const normTarget = target === '/' ? '/' : target.replace(/\\/$/, '')\n\n return normCurrent === normTarget\n })\n\n // 5. Объединение стилей - используем isActive напрямую для реактивности\n const mergedStyle = createMemo(() => {\n const baseStyle = local.style || {}\n // Вызываем isActive() внутри createMemo для отслеживания изменений\n const active = isActive()\n const activeStyle = active ? (local.activeStyle || {}) : {}\n\n // SolidJS умеет работать с объектами стилей корректно при слиянии\n return {\n ...(typeof baseStyle === 'object' ? baseStyle : {}),\n ...(typeof activeStyle === 'object' ? activeStyle : {}),\n } as JSX.CSSProperties\n })\n\n // Используем linkComponent из роутера, если доступен\n const LinkComponent = router?.linkComponent\n\n if (isExternal()) {\n return (\n // @ts-expect-error - Type conflict with Vue JSX\n <a\n href={typeof local.to === 'string' ? local.to : ''}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n style={mergedStyle()}\n {...(others as unknown as JSX.AnchorHTMLAttributes<HTMLAnchorElement>)}\n >\n {local.children}\n </a>\n ) as unknown as JSX.Element\n }\n\n // Если есть linkComponent из роутера (например, A из @solidjs/router), используем его\n if (LinkComponent) {\n return (\n // @ts-expect-error - Type conflict with router component types\n <LinkComponent\n href={targetPath()}\n style={mergedStyle()}\n {...(others as unknown as Record<string, unknown>)}\n >\n {local.children}\n </LinkComponent>\n ) as unknown as JSX.Element\n }\n\n // Fallback на нативный <a> с onClick обработчиком\n return (\n // @ts-expect-error - Type conflict with Vue JSX\n <a\n href={targetPath()}\n style={mergedStyle()}\n {...(others as unknown as JSX.AnchorHTMLAttributes<HTMLAnchorElement>)}\n onClick={(e: MouseEvent) => {\n if (router && !isExternal()) {\n e.preventDefault()\n router.push({ path: targetPath() })\n }\n }}\n >\n {local.children}\n </a>\n ) as unknown as JSX.Element\n}\n","/* eslint-disable @typescript-eslint/ban-ts-comment */\n// @ts-nocheck\nimport { createSignal, onMount, onCleanup, splitProps, type Accessor, type Component, type JSX } from 'solid-js'\nimport { createMemo } from 'solid-js'\nimport type { Locale } from '@i18n-micro/types'\nimport { useI18nContext, useI18nLocales, useI18nRouter } from '../injection'\nimport type { I18nRoutingStrategy } from '../router/types'\n\ninterface I18nSwitcherProps extends JSX.HTMLAttributes<HTMLDivElement> {\n locales?: Locale[]\n currentLocale?: string | (() => string)\n getLocaleName?: () => string | null\n switchLocale?: (locale: string) => void\n localeRoute?: (to: string | { path?: string }, locale?: string) => string | { path?: string }\n customLabels?: Record<string, string>\n customWrapperStyle?: JSX.CSSProperties\n customButtonStyle?: JSX.CSSProperties\n customDropdownStyle?: JSX.CSSProperties\n customItemStyle?: JSX.CSSProperties\n customLinkStyle?: JSX.CSSProperties\n customActiveLinkStyle?: JSX.CSSProperties\n customDisabledLinkStyle?: JSX.CSSProperties\n customIconStyle?: JSX.CSSProperties\n}\n\nexport const I18nSwitcher: Component<I18nSwitcherProps> = (props): JSX.Element => {\n const i18n = useI18nContext()\n const router = useI18nRouter()\n const injectedLocales = useI18nLocales()\n\n const [local, others] = splitProps(props, [\n 'locales',\n 'currentLocale',\n 'getLocaleName',\n 'switchLocale',\n 'localeRoute',\n 'customLabels',\n 'customWrapperStyle',\n 'customButtonStyle',\n 'customDropdownStyle',\n 'customItemStyle',\n 'customLinkStyle',\n 'customActiveLinkStyle',\n 'customDisabledLinkStyle',\n 'customIconStyle',\n ])\n\n const [dropdownOpen, setDropdownOpen] = createSignal(false)\n let wrapperRef: HTMLDivElement | undefined\n\n const locales = createMemo(() => local.locales || injectedLocales || [])\n const currentLocale = createMemo(() => {\n if (local.currentLocale !== undefined) {\n return typeof local.currentLocale === 'function' ? local.currentLocale() : local.currentLocale\n }\n // Используем реактивный accessor для отслеживания изменений\n return i18n.localeAccessor()\n })\n const currentLocaleName = createMemo(() => {\n if (local.getLocaleName) {\n return local.getLocaleName() || null\n }\n // Используем реактивный accessor для отслеживания изменений\n const current = locales().find(l => l.code === i18n.localeAccessor())\n return current?.displayName || null\n })\n\n const toggleDropdown = (event?: Event) => {\n if (event) {\n event.stopPropagation()\n event.preventDefault()\n }\n setDropdownOpen(!dropdownOpen())\n }\n\n const localeLabel = (localeItem: Locale): string => {\n const current = local.customLabels?.[localeItem.code] || localeItem.displayName\n return current || localeItem.code\n }\n\n const currentLocaleLabel = createMemo(() => {\n const current = locales().find(l => l.code === currentLocale())\n return current ? localeLabel(current) : (currentLocaleName() || currentLocale())\n })\n\n const handleSwitchLocale = async (code: string) => {\n setDropdownOpen(false)\n\n if (local.switchLocale) {\n local.switchLocale(code)\n return\n }\n\n i18n.locale = code\n\n if (!router) {\n return\n }\n\n // Используем accessor напрямую, если доступен, иначе fallback на getCurrentPath()\n const extendedRouter = router as I18nRoutingStrategy & { getCurrentPathAccessor?: Accessor<string> }\n const currentPath = extendedRouter.getCurrentPathAccessor ? extendedRouter.getCurrentPathAccessor() : router.getCurrentPath()\n const newPath = local.localeRoute\n ? (() => {\n const res = local.localeRoute(currentPath, code)\n return typeof res === 'string' ? res : (res.path || '/')\n })()\n : (router?.resolvePath\n ? (() => {\n const res = router.resolvePath(currentPath, code)\n return typeof res === 'string' ? res : (res.path || '/')\n })()\n : currentPath)\n\n router.push({ path: newPath })\n }\n\n // Default Styles\n const wrapperStyle: JSX.CSSProperties = {\n 'position': 'relative',\n 'display': 'inline-block',\n 'vertical-align': 'middle',\n }\n\n const buttonStyle: JSX.CSSProperties = {\n 'padding': '4px 12px',\n 'font-size': '16px',\n 'cursor': 'pointer',\n 'background-color': '#fff',\n 'border': '1px solid #333',\n 'transition': 'background-color 0.3s ease',\n 'display': 'flex',\n 'align-items': 'center',\n 'justify-content': 'space-between',\n }\n\n const dropdownStyle: JSX.CSSProperties = {\n 'position': 'absolute',\n 'top': '100%',\n 'left': '0',\n 'z-index': 1000,\n 'background-color': '#fff',\n 'border': '1px solid #333',\n 'list-style': 'none',\n 'padding': '0',\n 'margin': '4px 0 0 0',\n 'min-width': '150px',\n 'box-shadow': '0 2px 8px rgba(0,0,0,0.15)',\n }\n\n const itemStyle: JSX.CSSProperties = {\n margin: '0',\n padding: '0',\n }\n\n const linkStyle: JSX.CSSProperties = {\n 'display': 'block',\n 'padding': '8px 12px',\n 'color': '#333',\n 'text-decoration': 'none',\n 'transition': 'background-color 0.3s ease',\n 'cursor': 'pointer',\n }\n\n const activeLinkStyle: JSX.CSSProperties = {\n 'font-weight': 'bold',\n 'color': '#007bff',\n }\n\n const iconStyle: JSX.CSSProperties = {\n 'margin-left': '8px',\n 'display': 'inline-block',\n 'transition': 'transform 0.3s ease',\n }\n\n const openIconStyle: JSX.CSSProperties = {\n transform: 'rotate(180deg)',\n }\n\n const handleClickOutside = (event: MouseEvent) => {\n if (!dropdownOpen()) return\n\n const target = event.target as HTMLElement\n if (!target || !wrapperRef) return\n\n const isClickInside = wrapperRef.contains(target)\n const isButtonClick = target.closest('.i18n-switcher-button') !== null\n\n if (!isClickInside && !isButtonClick) {\n setDropdownOpen(false)\n }\n }\n\n onMount(() => {\n document.addEventListener('click', handleClickOutside)\n })\n\n onCleanup(() => {\n document.removeEventListener('click', handleClickOutside)\n })\n\n return (\n <div\n // @ts-expect-error - ref type conflict with Vue JSX\n ref={(el: HTMLDivElement) => { wrapperRef = el }}\n class=\"i18n-switcher-wrapper\"\n style={{ ...wrapperStyle, ...local.customWrapperStyle }}\n {...(others as unknown as JSX.HTMLAttributes<HTMLDivElement>)}\n >\n <button\n type=\"button\"\n class=\"i18n-switcher-button\"\n style={{ ...buttonStyle, ...local.customButtonStyle }}\n onClick={(e) => {\n e.preventDefault()\n e.stopPropagation()\n toggleDropdown(e)\n }}\n aria-haspopup=\"true\"\n aria-expanded={dropdownOpen()}\n >\n <span>{currentLocaleLabel()}</span>\n <span\n style={{\n ...iconStyle,\n ...(dropdownOpen() ? openIconStyle : {}),\n ...local.customIconStyle,\n }}\n >\n ▼\n </span>\n </button>\n\n {dropdownOpen() && (\n <ul\n class=\"i18n-switcher-dropdown\"\n style={{ ...dropdownStyle, ...local.customDropdownStyle }}\n >\n {locales().map((localeItem) => {\n const isActive = localeItem.code === currentLocale()\n // Используем accessor для реактивного отслеживания пути\n const extendedRouter = router as I18nRoutingStrategy & { getCurrentPathAccessor?: Accessor<string> }\n const currentPath = extendedRouter?.getCurrentPathAccessor\n ? extendedRouter.getCurrentPathAccessor()\n : (router?.getCurrentPath() || (typeof window !== 'undefined' ? window.location.pathname : '/'))\n const result = local.localeRoute\n ? local.localeRoute(currentPath, localeItem.code)\n : (router?.resolvePath\n ? router.resolvePath(currentPath, localeItem.code)\n : currentPath)\n const routeTo = typeof result === 'string' ? result : (result?.path || '#')\n\n return (\n <li\n style={{ ...itemStyle, ...local.customItemStyle }}\n >\n <a\n class={`switcher-locale-${localeItem.code}`}\n href={typeof routeTo === 'string' ? routeTo : '#'}\n style={{\n ...linkStyle,\n ...(isActive ? activeLinkStyle : {}),\n ...local.customLinkStyle,\n ...(isActive ? local.customActiveLinkStyle : {}),\n }}\n onClick={(e) => {\n e.preventDefault()\n e.stopPropagation()\n handleSwitchLocale(localeItem.code)\n }}\n >\n {localeLabel(localeItem)}\n </a>\n </li>\n )\n })}\n </ul>\n )}\n </div>\n ) as unknown as JSX.Element\n}\n","/* eslint-disable @typescript-eslint/ban-ts-comment */\n// @ts-nocheck\nimport { splitProps, type Component, type JSX } from 'solid-js'\nimport { useI18nContext } from '../injection'\nimport type { TranslationKey } from '@i18n-micro/types'\n\ninterface I18nGroupProps extends JSX.HTMLAttributes<HTMLDivElement> {\n prefix: string\n groupClass?: string\n}\n\nexport const I18nGroup: Component<I18nGroupProps> = (props): JSX.Element => {\n const i18n = useI18nContext()\n const [local, others] = splitProps(props, ['prefix', 'groupClass'])\n\n const translate = (key: string, params?: Record<string, string | number | boolean>): string => {\n // Use type assertion for dynamic keys with prefix\n // The developer is responsible for ensuring the key exists\n const result = i18n.t(`${local.prefix}.${key}` as TranslationKey, params, undefined, i18n.getRoute())\n return typeof result === 'string' ? result : String(result)\n }\n\n return (\n // @ts-expect-error - Type conflict with Vue JSX in monorepo\n <div\n class={['i18n-group', local.groupClass].filter(Boolean).join(' ')}\n {...(others as unknown as JSX.HTMLAttributes<HTMLDivElement>)}\n >\n {typeof props.children === 'function'\n ? (props.children as (props: { prefix: string, t: (key: string, params?: Record<string, string | number | boolean>) => string }) => JSX.Element)({ prefix: local.prefix, t: translate })\n : props.children}\n </div>\n ) as unknown as JSX.Element\n}\n","/* eslint-disable @typescript-eslint/ban-ts-comment */\n// @ts-nocheck\nimport { createSignal, createEffect, type Accessor, type Component, type JSX } from 'solid-js'\nimport { A, type useNavigate, type Location } from '@solidjs/router'\nimport type { I18nRoutingStrategy } from './types'\nimport type { Locale } from '@i18n-micro/types'\n\ntype NavigateFunction = ReturnType<typeof useNavigate>\n\n/**\n * Factory for Solid Router adapter\n * Implements routing utilities for Solid Router\n * Uses @solidjs/router APIs for navigation and path resolution\n *\n * **IMPORTANT**: This function must be called inside a SolidJS component or reactive context\n * (e.g., inside a component function, not at module level). This is required because\n * `createSignal` and `createEffect` need to be within a reactive owner context.\n *\n * @example\n * ```tsx\n * const RouterRoot: Component = () => {\n * const navigate = useNavigate()\n * const location = useLocation()\n * const routingStrategy = createSolidRouterAdapter(\n * locales,\n * defaultLocale,\n * navigate,\n * location,\n * )\n * // ...\n * }\n * ```\n *\n * @param locales - Array of locale configurations\n * @param defaultLocale - Default locale code\n * @param navigate - Navigation function from @solidjs/router's useNavigate hook\n * @param location - Location object from @solidjs/router's useLocation hook\n * @returns I18nRoutingStrategy with reactive pathname accessor\n */\nexport function createSolidRouterAdapter(\n locales: Locale[],\n defaultLocale: string,\n navigate: NavigateFunction,\n location: Location,\n): I18nRoutingStrategy & { getCurrentPathAccessor: Accessor<string> } {\n const localeCodes = locales.map(loc => loc.code)\n\n // Create signal to track pathname changes\n // NOTE: This requires a reactive context (component/effect), so this function\n // must be called inside a component, not at module level\n const [pathname, setPathname] = createSignal(location.pathname)\n\n // Track location.pathname changes\n // NOTE: createEffect requires a reactive owner, so this function must be called\n // inside a component or runWithOwner context\n createEffect(() => {\n setPathname(location.pathname)\n })\n\n const resolvePath = (to: string | { path?: string }, locale: string): string | { path?: string } => {\n const path = typeof to === 'string' ? to : (to.path || '/')\n const pathSegments = path.split('/').filter(Boolean)\n\n if (pathSegments.length > 0 && localeCodes.includes(pathSegments[0])) {\n pathSegments.shift()\n }\n\n const cleanPath = '/' + pathSegments.join('/')\n return locale === defaultLocale ? cleanPath : `/${locale}${cleanPath === '/' ? '' : cleanPath}`\n }\n\n return {\n getCurrentPath: () => pathname(), // Returns current value for compatibility\n getCurrentPathAccessor: pathname, // Returns accessor for reactivity\n\n push: (target: { path: string }) => {\n // Use navigate from @solidjs/router\n navigate(target.path)\n },\n\n replace: (target: { path: string }) => {\n // Use navigate with replace option\n navigate(target.path, { replace: true })\n },\n\n resolvePath: (to: string | { path?: string }, locale: string) => resolvePath(to, locale),\n\n getRoute: () => ({\n fullPath: pathname(),\n query: {},\n }),\n\n // Use A component from @solidjs/router\n linkComponent: ((props: { href: string, children?: JSX.Element, class?: string, style?: JSX.CSSProperties, [key: string]: unknown }) => {\n const { href, children, class: className, style, ...restProps } = props\n return (\n <A\n href={href}\n class={className}\n style={style}\n {...restProps}\n >\n {children}\n </A>\n ) as unknown as JSX.Element\n }) as unknown as Component<{\n href: string\n children?: JSX.Element\n style?: JSX.CSSProperties\n class?: string\n [key: string]: unknown\n }>,\n }\n}\n"],"names":["SolidI18n","BaseI18n","options","locale","setLocale","createSignal","fallback","route","setRoute","store","setStore","createStore","cacheAdapter","lang","msgs","val","translations","merge","prev","routeName","key","cb","createI18n","I18nContext","createContext","I18nLocalesContext","I18nDefaultLocaleContext","I18nRouterContext","useI18nContext","context","useContext","useI18nLocales","useI18nDefaultLocale","useI18nRouter","I18nProvider","props","children","_$createComponent","Provider","value","i18n","_$memo","locales","defaultLocale","routingStrategy","useI18n","router","injectedLocales","injectedDefaultLocale","resolveLocalePath","to","localeCode","createMemo","l","res","newLocale","currentPath","newPath","I18nT","local","others","splitProps","translation","localeAccessor","routeAccessor","number","undefined","numberValue","Number","formattedNumber","tn","result","t","keypath","params","String","date","formattedDate","td","relativeDate","formattedRelativeDate","tdr","plural","count","parseInt","toString","customPluralRule","k","p","dv","tc","defaultValue","translationResult","hideIfEmpty","trim","html","Dynamic","_$mergeProps","component","tag","innerHTML","translationValue","I18nLink","pathnameAccessor","getCurrentPathAccessor","targetPath","currentLocale","localeRoute","path","resolvePath","isExternal","test","isActive","current","getCurrentPath","window","location","pathname","target","normCurrent","replace","normTarget","mergedStyle","baseStyle","style","activeStyle","LinkComponent","linkComponent","_el$","_tmpl$","_$spread","href","_$insert","_el$2","_tmpl$2","e","preventDefault","push","I18nSwitcher","dropdownOpen","setDropdownOpen","wrapperRef","currentLocaleName","getLocaleName","find","code","displayName","toggleDropdown","event","stopPropagation","localeLabel","localeItem","customLabels","currentLocaleLabel","handleSwitchLocale","switchLocale","extendedRouter","wrapperStyle","buttonStyle","dropdownStyle","itemStyle","margin","padding","linkStyle","activeLinkStyle","iconStyle","openIconStyle","transform","handleClickOutside","isClickInside","contains","isButtonClick","closest","onMount","document","addEventListener","onCleanup","removeEventListener","firstChild","_el$3","_el$4","nextSibling","_$use","el","customWrapperStyle","$$click","_c$","_el$5","map","routeTo","_el$6","_tmpl$3","_el$7","_$setAttribute","_$effect","_p$","_v$4","customItemStyle","_v$5","_v$6","customLinkStyle","customActiveLinkStyle","_$style","_$className","a","_$p","customDropdownStyle","_v$","customButtonStyle","_v$2","_v$3","customIconStyle","_$delegateEvents","I18nGroup","translate","prefix","getRoute","groupClass","filter","Boolean","join","createSolidRouterAdapter","navigate","localeCodes","loc","setPathname","createEffect","pathSegments","split","length","includes","shift","cleanPath","fullPath","query","class","className","restProps","A"],"mappings":"+NAoBO,MAAMA,UAAkBC,EAAAA,QAAS,CAE9B,QACA,WACA,gBACA,cACA,UAKQ,WAKR,cAMA,cAAgB,IAExB,YAAYC,EAA2B,CAGrC,KAAM,CAACC,EAAQC,CAAS,EAAIC,EAAAA,aAAaH,EAAQ,MAAM,EACjD,CAACI,CAAQ,EAAID,EAAAA,aAAaH,EAAQ,gBAAkBA,EAAQ,MAAM,EAClE,CAACK,EAAOC,CAAQ,EAAIH,EAAAA,aAAa,SAAS,EAE1C,CAACI,EAAOC,CAAQ,EAAIC,eAAY,CACpC,QAAS,CAAA,EACT,MAAO,CAAA,CAAC,CACT,EAKKC,EAAiC,CAErC,mBAAoB,CAAE,MAAOH,EAAM,OAAA,EACnC,iBAAkB,CAAE,MAAOA,EAAM,KAAA,EACjC,0BAA2B,CAAE,MAAO,EAAC,EACrC,uBAAwB,CAAE,MAAO,CAAA,CAAC,CAAE,EAoBtC,GAjBA,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/types';
4
+ import { Component } from 'solid-js';
5
+ import { Context } from 'solid-js';
6
+ import { defaultPlural } from '@i18n-micro/core';
7
+ import { FormatService } from '@i18n-micro/core';
8
+ import { Getter } from '@i18n-micro/types';
9
+ import { interpolate } from '@i18n-micro/core';
10
+ import { JSX } from 'solid-js';
11
+ import { Locale } from '@i18n-micro/types';
12
+ import { LocaleCode } from '@i18n-micro/types';
13
+ import { Location as Location_2 } from '@solidjs/router';
14
+ import { ModuleOptions } from '@i18n-micro/types';
15
+ import { Params } from '@i18n-micro/types';
16
+ import { ParentComponent } from 'solid-js';
17
+ import { PluralFunc } from '@i18n-micro/types';
18
+ import { TranslationKey } from '@i18n-micro/types';
19
+ import { Translations } from '@i18n-micro/types';
20
+ import { useNavigate } from '@solidjs/router';
21
+
22
+ export { CleanTranslation }
23
+
24
+ export declare function createI18n(options: SolidI18nOptions): SolidI18n;
25
+
26
+ /**
27
+ * Factory for Solid Router adapter
28
+ * Implements routing utilities for Solid Router
29
+ * Uses @solidjs/router APIs for navigation and path resolution
30
+ *
31
+ * **IMPORTANT**: This function must be called inside a SolidJS component or reactive context
32
+ * (e.g., inside a component function, not at module level). This is required because
33
+ * `createSignal` and `createEffect` need to be within a reactive owner context.
34
+ *
35
+ * @example
36
+ * ```tsx
37
+ * const RouterRoot: Component = () => {
38
+ * const navigate = useNavigate()
39
+ * const location = useLocation()
40
+ * const routingStrategy = createSolidRouterAdapter(
41
+ * locales,
42
+ * defaultLocale,
43
+ * navigate,
44
+ * location,
45
+ * )
46
+ * // ...
47
+ * }
48
+ * ```
49
+ *
50
+ * @param locales - Array of locale configurations
51
+ * @param defaultLocale - Default locale code
52
+ * @param navigate - Navigation function from @solidjs/router's useNavigate hook
53
+ * @param location - Location object from @solidjs/router's useLocation hook
54
+ * @returns I18nRoutingStrategy with reactive pathname accessor
55
+ */
56
+ export declare function createSolidRouterAdapter(locales: Locale[], defaultLocale: string, navigate: NavigateFunction, location: Location_2): I18nRoutingStrategy & {
57
+ getCurrentPathAccessor: Accessor<string>;
58
+ };
59
+
60
+ export { defaultPlural }
61
+
62
+ export { FormatService }
63
+
64
+ export { Getter }
65
+
66
+ export declare const I18nContext: Context<SolidI18n | undefined>;
67
+
68
+ export declare const I18nDefaultLocaleContext: Context<string | undefined>;
69
+
70
+ export declare const I18nGroup: Component<I18nGroupProps>;
71
+
72
+ declare interface I18nGroupProps extends JSX.HTMLAttributes<HTMLDivElement> {
73
+ prefix: string;
74
+ groupClass?: string;
75
+ }
76
+
77
+ export declare const I18nLink: Component<I18nLinkProps>;
78
+
79
+ declare interface I18nLinkProps extends JSX.AnchorHTMLAttributes<HTMLAnchorElement> {
80
+ to: string | {
81
+ path?: string;
82
+ };
83
+ localeRoute?: (to: string | {
84
+ path?: string;
85
+ }, locale?: string) => string | {
86
+ path?: string;
87
+ };
88
+ activeStyle?: JSX.CSSProperties;
89
+ }
90
+
91
+ export declare const I18nLocalesContext: Context<Locale[] | undefined>;
92
+
93
+ export declare const I18nProvider: ParentComponent<I18nProviderProps>;
94
+
95
+ export declare interface I18nProviderProps {
96
+ i18n: SolidI18n;
97
+ locales?: Locale[];
98
+ defaultLocale?: string;
99
+ routingStrategy?: I18nRoutingStrategy;
100
+ }
101
+
102
+ export declare const I18nRouterContext: Context<I18nRoutingStrategy | undefined>;
103
+
104
+ /**
105
+ * Routing strategy interface for i18n
106
+ * Implement this interface to integrate with any router library
107
+ * Matches Vue package interface for consistency
108
+ */
109
+ export declare interface I18nRoutingStrategy {
110
+ /**
111
+ * Returns current path (without locale prefix if needed, or full path)
112
+ * Used for determining active classes in links
113
+ * Note: For SolidJS, this should return the current value synchronously.
114
+ * For reactive updates, use `getCurrentPathAccessor` instead.
115
+ */
116
+ getCurrentPath: () => string;
117
+ /**
118
+ * (SolidJS-specific, highly recommended) Returns reactive accessor for current path
119
+ * This is REQUIRED for proper reactivity in SolidJS components.
120
+ * Without this, active link states and path-dependent UI won't update reactively.
121
+ *
122
+ * @example
123
+ * ```tsx
124
+ * const pathnameAccessor = router.getCurrentPathAccessor?.()
125
+ * // Use inside createMemo for reactivity:
126
+ * const currentPath = createMemo(() => pathnameAccessor?.() ?? router.getCurrentPath())
127
+ * ```
128
+ */
129
+ getCurrentPathAccessor?: () => Accessor<string>;
130
+ /**
131
+ * Component to use for rendering links (e.g., RouterLink)
132
+ */
133
+ linkComponent?: string | Component<{
134
+ href: string;
135
+ children?: JSX.Element;
136
+ style?: JSX.CSSProperties;
137
+ class?: string;
138
+ [key: string]: unknown;
139
+ }>;
140
+ /**
141
+ * Function to navigate to another route/locale
142
+ */
143
+ push: (target: {
144
+ path: string;
145
+ }) => void;
146
+ /**
147
+ * Function to replace current route
148
+ */
149
+ replace: (target: {
150
+ path: string;
151
+ }) => void;
152
+ /**
153
+ * Generate path for specific locale
154
+ */
155
+ resolvePath?: (to: string | {
156
+ path?: string;
157
+ }, locale: string) => string | {
158
+ path?: string;
159
+ };
160
+ /**
161
+ * (Optional) Get current route object for SEO/Meta tags
162
+ */
163
+ getRoute?: () => {
164
+ fullPath: string;
165
+ query: Record<string, unknown>;
166
+ };
167
+ }
168
+
169
+ export declare const I18nSwitcher: Component<I18nSwitcherProps>;
170
+
171
+ declare interface I18nSwitcherProps extends JSX.HTMLAttributes<HTMLDivElement> {
172
+ locales?: Locale[];
173
+ currentLocale?: string | (() => string);
174
+ getLocaleName?: () => string | null;
175
+ switchLocale?: (locale: string) => void;
176
+ localeRoute?: (to: string | {
177
+ path?: string;
178
+ }, locale?: string) => string | {
179
+ path?: string;
180
+ };
181
+ customLabels?: Record<string, string>;
182
+ customWrapperStyle?: JSX.CSSProperties;
183
+ customButtonStyle?: JSX.CSSProperties;
184
+ customDropdownStyle?: JSX.CSSProperties;
185
+ customItemStyle?: JSX.CSSProperties;
186
+ customLinkStyle?: JSX.CSSProperties;
187
+ customActiveLinkStyle?: JSX.CSSProperties;
188
+ customDisabledLinkStyle?: JSX.CSSProperties;
189
+ customIconStyle?: JSX.CSSProperties;
190
+ }
191
+
192
+ export declare const I18nT: Component<I18nTProps>;
193
+
194
+ declare interface I18nTProps extends JSX.HTMLAttributes<HTMLElement> {
195
+ keypath: TranslationKey;
196
+ params?: Record<string, string | number | boolean>;
197
+ tag?: string;
198
+ plural?: number | string;
199
+ defaultValue?: string;
200
+ html?: boolean;
201
+ hideIfEmpty?: boolean;
202
+ customPluralRule?: PluralFunc;
203
+ number?: number | string;
204
+ date?: Date | string | number;
205
+ relativeDate?: Date | string | number;
206
+ }
207
+
208
+ export { interpolate }
209
+
210
+ export { Locale }
211
+
212
+ export { LocaleCode }
213
+
214
+ export { ModuleOptions }
215
+
216
+ declare type NavigateFunction = ReturnType<typeof useNavigate>;
217
+
218
+ export { Params }
219
+
220
+ export { PluralFunc }
221
+
222
+ /**
223
+ * SolidJS I18n Adapter
224
+ *
225
+ * Provides a SolidJS-compatible i18n instance that uses the shared core logic.
226
+ * Uses createSignal for locale/route reactivity and createStore for translation cache.
227
+ */
228
+ export declare class SolidI18n extends BaseI18n {
229
+ private _locale;
230
+ private _setLocale;
231
+ private _fallbackLocale;
232
+ private _currentRoute;
233
+ private _setRoute;
234
+ readonly cacheStore: {
235
+ general: Record<string, Translations>;
236
+ route: Record<string, Translations>;
237
+ };
238
+ private setCacheStore;
239
+ private listeners;
240
+ constructor(options: SolidI18nOptions);
241
+ getLocale(): string;
242
+ getFallbackLocale(): string;
243
+ getRoute(): string;
244
+ set locale(val: string);
245
+ get locale(): string;
246
+ get localeAccessor(): Accessor<string>;
247
+ get fallbackLocale(): string;
248
+ get currentRoute(): string;
249
+ get routeAccessor(): Accessor<string>;
250
+ setRoute(val: string): void;
251
+ addTranslations(locale: string, translations: Translations, merge?: boolean): void;
252
+ addRouteTranslations(locale: string, routeName: string, translations: Translations, merge?: boolean): void;
253
+ clearCache(): void;
254
+ subscribe(cb: () => void): () => void;
255
+ private notifyListeners;
256
+ }
257
+
258
+ export declare interface SolidI18nOptions {
259
+ locale: string;
260
+ fallbackLocale?: string;
261
+ messages?: Record<string, Translations>;
262
+ plural?: PluralFunc;
263
+ missingWarn?: boolean;
264
+ missingHandler?: (locale: string, key: string, routeName: string) => void;
265
+ }
266
+
267
+ export { TranslationKey }
268
+
269
+ export { Translations }
270
+
271
+ export declare function useI18n(options?: UseI18nOptions): {
272
+ instance: SolidI18n;
273
+ locale: Accessor<string>;
274
+ getLocales: () => Locale[];
275
+ defaultLocale: () => string;
276
+ getLocaleName: () => string | null;
277
+ localeRoute: (to: string | {
278
+ path?: string;
279
+ }, localeCode?: string) => string | {
280
+ path?: string;
281
+ };
282
+ localePath: (to: string | {
283
+ path?: string;
284
+ }, locale?: string) => string;
285
+ switchLocale: (newLocale: string) => void;
286
+ t: (key: TranslationKey, params?: Params, defaultValue?: string | null, routeName?: string) => CleanTranslation;
287
+ ts: (key: TranslationKey, params?: Params, defaultValue?: string, routeName?: string) => string;
288
+ tc: (key: TranslationKey, count: number | Params, defaultValue?: string) => string;
289
+ tn: (value: number, options?: Intl.NumberFormatOptions) => string;
290
+ td: (value: Date | number | string, options?: Intl.DateTimeFormatOptions) => string;
291
+ tdr: (value: Date | number | string, options?: Intl.RelativeTimeFormatOptions) => string;
292
+ has: (key: TranslationKey, routeName?: string) => boolean;
293
+ setRoute: (val: string) => void;
294
+ getRoute: () => string;
295
+ getLocale: () => string;
296
+ addTranslations: (locale: string, translations: Translations, merge?: boolean) => void;
297
+ addRouteTranslations: (locale: string, routeName: string, translations: Translations, merge?: boolean) => void;
298
+ clearCache: () => void;
299
+ };
300
+
301
+ export declare const useI18nContext: () => SolidI18n;
302
+
303
+ export declare const useI18nDefaultLocale: () => string;
304
+
305
+ export declare const useI18nLocales: () => Locale[];
306
+
307
+ export declare interface UseI18nOptions {
308
+ locales?: Locale[];
309
+ defaultLocale?: string;
310
+ }
311
+
312
+ export declare const useI18nRouter: () => I18nRoutingStrategy | undefined;
313
+
314
+ export { }