@fluenti/solid 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +5 -5
  2. package/dist/context.d.ts +15 -24
  3. package/dist/context.d.ts.map +1 -1
  4. package/dist/hooks/__useI18n.d.ts +2 -2
  5. package/dist/hooks/__useI18n.d.ts.map +1 -1
  6. package/dist/index.cjs +1 -1
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.d.ts +6 -6
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +129 -167
  11. package/dist/index.js.map +1 -1
  12. package/dist/plural.d.ts +3 -3
  13. package/dist/plural.d.ts.map +1 -1
  14. package/dist/provider.d.ts +3 -3
  15. package/dist/provider.d.ts.map +1 -1
  16. package/dist/rich-dom.d.ts +0 -6
  17. package/dist/rich-dom.d.ts.map +1 -1
  18. package/dist/select.d.ts +3 -3
  19. package/dist/select.d.ts.map +1 -1
  20. package/dist/server.cjs +2 -0
  21. package/dist/server.cjs.map +1 -0
  22. package/dist/server.d.ts +33 -17
  23. package/dist/server.d.ts.map +1 -1
  24. package/dist/server.js +54 -0
  25. package/dist/server.js.map +1 -0
  26. package/dist/solid-runtime.d.ts.map +1 -1
  27. package/dist/trans.d.ts +3 -3
  28. package/dist/trans.d.ts.map +1 -1
  29. package/dist/types.d.ts +8 -8
  30. package/dist/types.d.ts.map +1 -1
  31. package/dist/use-i18n.d.ts +4 -8
  32. package/dist/use-i18n.d.ts.map +1 -1
  33. package/dist/vite-plugin.cjs +2 -113
  34. package/dist/vite-plugin.cjs.map +1 -1
  35. package/dist/vite-plugin.js +14 -123
  36. package/dist/vite-plugin.js.map +1 -1
  37. package/llms-full.txt +186 -0
  38. package/llms-migration.txt +176 -0
  39. package/llms.txt +64 -0
  40. package/package.json +17 -5
  41. package/src/context.ts +56 -77
  42. package/src/hooks/__useI18n.ts +2 -2
  43. package/src/index.ts +6 -6
  44. package/src/plural.tsx +9 -38
  45. package/src/provider.tsx +5 -5
  46. package/src/rich-dom.tsx +25 -47
  47. package/src/select.tsx +11 -8
  48. package/src/server.ts +94 -49
  49. package/src/solid-runtime.ts +15 -134
  50. package/src/trans.tsx +7 -4
  51. package/src/types.ts +9 -8
  52. package/src/use-i18n.ts +5 -16
  53. package/src/vite-plugin.ts +1 -1
package/README.md CHANGED
@@ -105,7 +105,7 @@ t('abc123', { count }) // hash-based lookup, no ICU parsing at runtime
105
105
 
106
106
  ### `useI18n()`
107
107
 
108
- Returns the reactive i18n context. Works inside any component that is a descendant of `<I18nProvider>`, or after a top-level `createI18n()` call.
108
+ Returns the reactive i18n context. Works inside any component that is a descendant of `<I18nProvider>`, or after a top-level `createFluenti()` call.
109
109
 
110
110
  ```tsx
111
111
  const { t, d, n, format, locale, setLocale, isLoading } = useI18n()
@@ -125,14 +125,14 @@ const { t, d, n, format, locale, setLocale, isLoading } = useI18n()
125
125
  | `isLoading` | `Accessor<boolean>` | Whether a locale chunk is currently being loaded |
126
126
  | `loadedLocales` | `Accessor<Set<string>>` | Set of locales whose messages have been loaded |
127
127
 
128
- ### `createI18n(config)`
128
+ ### `createFluenti(config)`
129
129
 
130
130
  Module-level singleton alternative to `<I18nProvider>`. Call once at startup; `useI18n()` will find it automatically.
131
131
 
132
132
  ```tsx
133
- import { createI18n } from '@fluenti/solid'
133
+ import { createFluenti } from '@fluenti/solid'
134
134
 
135
- const i18n = createI18n({
135
+ const i18n = createFluenti({
136
136
  locale: 'en',
137
137
  fallbackLocale: 'en',
138
138
  messages: { en, ja },
@@ -144,7 +144,7 @@ const i18n = createI18n({
144
144
  })
145
145
  ```
146
146
 
147
- The config accepts all `FluentConfigExtended` options from `@fluenti/core`, including `transform`, `onLocaleChange`, and `formatters`. See the [core README](https://github.com/usefluenti/fluenti/tree/main/packages/core#advanced-configuration) for details.
147
+ The config accepts all `FluentiRuntimeConfigFull` options from `@fluenti/core`, including `transform`, `onLocaleChange`, and `formatters`. See the [core README](https://github.com/usefluenti/fluenti/tree/main/packages/core#advanced-configuration) for details.
148
148
 
149
149
  ### Components
150
150
 
package/dist/context.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { Accessor } from 'solid-js';
2
- import { FluentConfig, Locale, Messages, CompiledMessage, MessageDescriptor, DateFormatOptions, NumberFormatOptions } from '@fluenti/core';
2
+ import { FluentiCoreConfig, Locale, LocalizedString, Messages, CompiledMessage, MessageDescriptor, DateFormatOptions, NumberFormatOptions, DiagnosticsConfig } from '@fluenti/core';
3
3
  /** Chunk loader for lazy locale loading */
4
4
  export type ChunkLoader = (locale: string) => Promise<Record<string, CompiledMessage> | {
5
5
  default: Record<string, CompiledMessage>;
6
6
  }>;
7
7
  /** Extended config with lazy locale loading support */
8
- export interface I18nConfig extends FluentConfig {
8
+ export interface FluentiConfig extends FluentiCoreConfig {
9
9
  /** Async chunk loader for lazy locale loading */
10
10
  chunkLoader?: ChunkLoader;
11
11
  /** Enable lazy locale loading through chunkLoader */
@@ -16,33 +16,39 @@ export interface I18nConfig extends FluentConfig {
16
16
  dateFormats?: DateFormatOptions;
17
17
  /** Named number format styles */
18
18
  numberFormats?: NumberFormatOptions;
19
+ /** Runtime diagnostics configuration */
20
+ diagnostics?: DiagnosticsConfig;
19
21
  }
20
22
  /** Reactive i18n context holding locale signal and translation utilities */
21
- export interface I18nContext {
23
+ export interface FluentiContext {
22
24
  /** Reactive accessor for the current locale */
23
25
  locale(): Locale;
24
26
  /** Set the active locale (async when lazy locale loading is enabled) */
25
27
  setLocale(locale: Locale): Promise<void>;
26
28
  /** Translate a message by id with optional interpolation values */
27
- t(id: string | MessageDescriptor, values?: Record<string, unknown>): string;
29
+ t(id: string | MessageDescriptor, values?: Record<string, unknown>): LocalizedString;
28
30
  /** Tagged template form: t`Hello ${name}` */
29
- t(strings: TemplateStringsArray, ...exprs: unknown[]): string;
31
+ t(strings: TemplateStringsArray, ...exprs: unknown[]): LocalizedString;
30
32
  /** Merge additional messages into a locale catalog at runtime */
31
33
  loadMessages(locale: Locale, messages: Messages): void;
32
34
  /** Return all locale codes that have loaded messages */
33
35
  getLocales(): Locale[];
34
36
  /** Format a date value for the current locale */
35
- d(value: Date | number, style?: string): string;
37
+ d(value: Date | number, style?: string): LocalizedString;
36
38
  /** Format a number value for the current locale */
37
- n(value: number, style?: string): string;
39
+ n(value: number, style?: string): LocalizedString;
38
40
  /** Format an ICU message string directly (no catalog lookup) */
39
- format(message: string, values?: Record<string, unknown>): string;
41
+ format(message: string, values?: Record<string, unknown>): LocalizedString;
40
42
  /** Whether a locale chunk is currently being loaded */
41
43
  isLoading: Accessor<boolean>;
42
44
  /** Set of locales whose messages have been loaded */
43
45
  loadedLocales: Accessor<Set<string>>;
44
46
  /** Preload a locale in the background without switching to it */
45
47
  preloadLocale(locale: string): void;
48
+ /** Check if a translation key exists for the given or current locale */
49
+ te(key: string, loc?: string): boolean;
50
+ /** Get the raw compiled message for a key without interpolation */
51
+ tm(key: string, loc?: string): CompiledMessage | undefined;
46
52
  }
47
53
  /**
48
54
  * Create a reactive i18n context backed by Solid signals.
@@ -50,20 +56,5 @@ export interface I18nContext {
50
56
  * The returned `t()` reads the internal `locale()` signal, so any
51
57
  * Solid computation that calls `t()` will re-run when the locale changes.
52
58
  */
53
- export declare function createI18nContext(config: FluentConfig | I18nConfig): I18nContext;
54
- /**
55
- * Initialize the global i18n singleton.
56
- *
57
- * Call once at app startup (e.g. in your entry file) before any `useI18n()`.
58
- * Signals are created inside a `createRoot` so they outlive any component scope.
59
- *
60
- * Returns the context for convenience, but `useI18n()` will also find it.
61
- */
62
- export declare function createI18n(config: FluentConfig | I18nConfig): I18nContext;
63
- /** @internal — used by useI18n and I18nProvider */
64
- export declare function getGlobalI18nContext(): I18nContext | undefined;
65
- /** @internal — used by I18nProvider to set context without createRoot wrapper */
66
- export declare function setGlobalI18nContext(ctx: I18nContext): void;
67
- /** @internal — reset the global singleton (for testing only) */
68
- export declare function resetGlobalI18nContext(): void;
59
+ export declare function createFluentiContext(config: FluentiCoreConfig | FluentiConfig): FluentiContext;
69
60
  //# sourceMappingURL=context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAA;AAElE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAE/I,2CAA2C;AAC3C,MAAM,MAAM,WAAW,GAAG,CACxB,MAAM,EAAE,MAAM,KACX,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;CAAE,CAAC,CAAA;AAwB5F,uDAAuD;AACvD,MAAM,WAAW,UAAW,SAAQ,YAAY;IAC9C,iDAAiD;IACjD,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,qDAAqD;IACrD,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,sCAAsC;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;IACxC,+BAA+B;IAC/B,WAAW,CAAC,EAAE,iBAAiB,CAAA;IAC/B,iCAAiC;IACjC,aAAa,CAAC,EAAE,mBAAmB,CAAA;CACpC;AAED,4EAA4E;AAC5E,MAAM,WAAW,WAAW;IAC1B,+CAA+C;IAC/C,MAAM,IAAI,MAAM,CAAA;IAChB,wEAAwE;IACxE,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACxC,mEAAmE;IACnE,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,iBAAiB,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAA;IAC3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AO,EAAE,oBAAoB,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,GAAG,eAAe,CAAA;IACtE,iEAAiE;IACjE,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAA;IACtD,wDAAwD;IACxD,UAAU,IAAI,MAAM,EAAE,CAAA;IACtB,iDAAiD;IACjD,CAAC,CAAC,KAAK,EAAE,IAAI,GAAG,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,eAAe,CAAA;IACxD,mDAAmD;IACnD,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,eAAe,CAAA;IACjD,gEAAgE;IAChE,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,eAAe,CAAA;IAC1E,uDAAuD;IACvD,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;IAC5B,qDAAqD;IACrD,aAAa,EAAE,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IACpC,iEAAiE;IACjE,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC,wEAAwE;IACxE,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACtC,mEAAmE;IACnE,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAAA;CAC3D;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,GAAG,aAAa,GAAG,cAAc,CAsO9F"}
@@ -1,4 +1,4 @@
1
- import { I18nContext } from '../types';
1
+ import { FluentiContext } from '../types';
2
2
  /**
3
3
  * Internal hook used by the Vite plugin's compiled output.
4
4
  * Returns the i18n context for direct t() calls.
@@ -8,5 +8,5 @@ import { I18nContext } from '../types';
8
8
  *
9
9
  * @internal
10
10
  */
11
- export declare function __useI18n(): I18nContext;
11
+ export declare function __useI18n(): FluentiContext;
12
12
  //# sourceMappingURL=__useI18n.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"__useI18n.d.ts","sourceRoot":"","sources":["../../src/hooks/__useI18n.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE3C;;;;;;;;GAQG;AACH,wBAAgB,SAAS,IAAI,WAAW,CAEvC"}
1
+ {"version":3,"file":"__useI18n.d.ts","sourceRoot":"","sources":["../../src/hooks/__useI18n.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE9C;;;;;;;;GAQG;AACH,wBAAgB,SAAS,IAAI,cAAc,CAE1C"}
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`solid-js`),t=require(`@fluenti/core`),n=require(`solid-js/web`);var r=Symbol.for(`fluenti.runtime.solid`);function i(){let e=globalThis[r];return typeof e==`object`&&e?e:null}function a(e){return typeof e==`object`&&e&&`default`in e?e.default:e}function o(n){let[r,o]=(0,e.createSignal)(n.locale),[s,c]=(0,e.createSignal)(!1),l=new Set([n.locale]),[u,d]=(0,e.createSignal)(new Set(l)),f={...n.messages},p=n,m=p.lazyLocaleLoading??n.splitting??!1;function h(e,n,r){let i=f[n];if(!i)return;let a=i[e];if(a!==void 0)return typeof a==`function`?a(r):typeof a==`string`&&r?(0,t.interpolate)(a,r,n):String(a)}function g(e,t,r){let i=[t],a=new Set(i);n.fallbackLocale&&!a.has(n.fallbackLocale)&&(i.push(n.fallbackLocale),a.add(n.fallbackLocale));let o=p.fallbackChain?.[t]??p.fallbackChain?.[`*`];if(o)for(let e of o)a.has(e)||(i.push(e),a.add(e));for(let t of i){let n=h(e,t,r);if(n!==void 0)return n}}function _(e,t){if(!n.missing)return;let r=n.missing(t,e);if(r!==void 0)return r}function v(e,n,r){let i=g(e,n,r);if(i!==void 0)return i;let a=_(e,n);return a===void 0?e.includes(`{`)?(0,t.interpolate)(e,r,n):e:a}function y(e,...n){if(Array.isArray(e)&&`raw`in e)return y((0,t.buildICUMessage)(e,n),Object.fromEntries(n.map((e,t)=>[String(t),e])));let i=e,a=n[0],o=r();if(typeof i==`object`&&i){let e=(0,t.resolveDescriptorId)(i);if(e){let t=g(e,o,a);if(t!==void 0)return t;let n=_(e,o);if(n!==void 0)return n}return i.message===void 0?e??``:(0,t.interpolate)(i.message,a,o)}return v(i,o,a)}return{locale:r,setLocale:async e=>{if(!m||!p.chunkLoader){o(e);return}let t=i();if(l.has(e)){t?.__switchLocale&&await t.__switchLocale(e),o(e);return}c(!0);try{let n=a(await p.chunkLoader(e));f[e]={...f[e],...n},l.add(e),d(new Set(l)),t?.__switchLocale&&await t.__switchLocale(e),o(e)}finally{c(!1)}},t:y,loadMessages:(e,t)=>{f[e]={...f[e],...t},l.add(e),d(new Set(l))},getLocales:()=>Object.keys(f),d:(e,n)=>(0,t.formatDate)(e,r(),n,p.dateFormats),n:(e,n)=>(0,t.formatNumber)(e,r(),n,p.numberFormats),format:(e,n)=>(0,t.interpolate)(e,n,r()),isLoading:s,loadedLocales:u,preloadLocale:e=>{if(!m||l.has(e)||!p.chunkLoader)return;let t=i();p.chunkLoader(e).then(async n=>{let r=a(n);f[e]={...f[e],...r},l.add(e),d(new Set(l)),t?.__preloadLocale&&await t.__preloadLocale(e)}).catch(t=>{console.warn(`[fluenti] preload failed:`,e,t)})}}}var s;function c(t){let n=(0,e.createRoot)(()=>o(t));return typeof window<`u`?s=n:console.warn(`[fluenti] createI18n() detected SSR environment. Use <I18nProvider> for per-request isolation in SSR.`),n}function l(){return s}var u=(0,e.createContext)(),d=e=>{let t=o(e);return(0,n.createComponent)(u.Provider,{value:t,get children(){return e.children}})};function f(){let t=(0,e.useContext)(u);if(t)return t;let n=l();if(n)return n;throw Error(`useI18n requires either createI18n() to be called at startup, or the component to be inside an <I18nProvider>.`)}var p=((...e)=>{throw Error("[fluenti] `t` imported from '@fluenti/solid' is a compile-time API. Use it only with the Fluenti build transform inside a component or custom hook. For runtime lookups, use useI18n().t(...).")});function m(e){return typeof Node<`u`&&e instanceof Node}function h(e){return typeof e==`function`&&!e.length?e():e}function g(e,t){return t===0?e:e.replace(/<(\d+)(\/?>)/g,(e,n,r)=>`<${Number(n)+t}${r}`).replace(/<\/(\d+)>/g,(e,n)=>`</${Number(n)+t}>`)}function _(e){let t=[],n=``;function r(e){let i=h(e);if(i==null||typeof i==`boolean`)return;if(Array.isArray(i)){for(let e of i)r(e);return}if(typeof i==`string`||typeof i==`number`){n+=String(i);return}if(!m(i))return;if(i.nodeType===Node.TEXT_NODE){n+=i.textContent??``;return}if(i.nodeType===Node.DOCUMENT_FRAGMENT_NODE){r(Array.from(i.childNodes));return}let a=t.length,o=_(Array.from(i.childNodes));t.push(i.cloneNode(!1)),t.push(...o.components),n+=`<${a}>${g(o.message,a+1)}</${a}>`}return r(e),{message:n,components:t}}function v(e,t){let n=h(t);if(!(n==null||typeof n==`boolean`)){if(Array.isArray(n)){for(let t of n)v(e,t);return}if(typeof n==`string`||typeof n==`number`){e.appendChild(document.createTextNode(String(n)));return}m(n)&&e.appendChild(n)}}function y(e,t){let n=/<(\d+)>([\s\S]*?)<\/\1>/g,r=[],i=0,a;for(n.lastIndex=0,a=n.exec(e);a!==null;){a.index>i&&r.push(e.slice(i,a.index));let o=t[Number(a[1])],s=y(a[2],t);if(o){let e=o.cloneNode(!1);v(e,s),r.push(e)}else r.push(a[2]);i=n.lastIndex,a=n.exec(e)}return i<e.length&&r.push(e.slice(i)),r.length<=1?r[0]??``:r}function b(e,t){let n={},r=[];for(let i of e){let e=t[i];if(e===void 0)continue;let a=_(e);n[i]=g(a.message,r.length),r.push(...a.components)}for(let[i,a]of Object.entries(t)){if(e.includes(i)||a===void 0)continue;let t=_(a);n[i]=g(t.message,r.length),r.push(...t.components)}return{messages:n,components:r}}function x(e){return`{value, select, ${Object.entries(e).map(([e,t])=>`${e} {${t}}`).join(` `)}}`}function S(e){let t={},n={},r=0;for(let[i,a]of Object.entries(e)){if(i===`other`){t.other=a;continue}let e=/^[A-Za-z0-9_]+$/.test(i)?i:`case_${r++}`;t[e]=a,n[i]=e}return t.other===void 0&&(t.other=``),{forms:t,valueMap:n}}function C(e){let t=[],n=0;for(;n<e.length;){let r=e.indexOf(`<`,n);if(r===-1){t.push({type:`text`,value:e.slice(n)});break}r>n&&t.push({type:`text`,value:e.slice(n,r)});let i=e.slice(r).match(/^<(\w+)\s*\/>/);if(i){t.push({type:`tag`,name:i[1],children:[]}),n=r+i[0].length;continue}let a=e.slice(r).match(/^<(\w+)>/);if(!a){t.push({type:`text`,value:`<`}),n=r+1;continue}let o=a[1],s=r+a[0].length,c=w(e,o,s);if(c===-1){t.push({type:`text`,value:e.slice(r,s)}),n=s;continue}let l=e.slice(s,c),u=`</${o}>`;t.push({type:`tag`,name:o,children:C(l)}),n=c+u.length}return t}function w(e,t,n){let r=`<${t}>`,i=`</${t}>`,a=1,o=n;for(;o<e.length&&a>0;){let t=e.indexOf(r,o),n=e.indexOf(i,o);if(n===-1)return-1;if(t!==-1&&t<n)a++,o=t+r.length;else{if(a--,a===0)return n;o=n+i.length}}return-1}function T(e,t){let r=e.map(e=>{if(e.type===`text`)return e.value;let r=t[e.name];return r?(0,n.createComponent)(n.Dynamic,{component:r,children:e.children.length>0?T(e.children,t):void 0}):T(e.children,t)});return r.length===1?r[0]:r}var E=t=>{let{t:r}=f(),i=(0,e.children)(()=>t.children),a=(0,e.createMemo)(()=>{let e=t.__message??t.message;return typeof e==`function`?e():e}),o=(0,e.createMemo)(()=>t.__components??t.components);return(()=>{let e=a(),s=o();if(e!==void 0&&s)return T(C(r({...t.id===void 0?{}:{id:t.id},message:e,...t.context===void 0?{}:{context:t.context},...t.comment===void 0?{}:{comment:t.comment}})),s);let c=i.toArray();if(c.length===0)return null;let l=_(c),u=r({...t.id===void 0?{}:{id:t.id},message:l.message,...t.context===void 0?{}:{context:t.context},...t.comment===void 0?{}:{comment:t.comment}}),d=l.components.length>0?y(u,l.components):u;return Array.isArray(d)&&d.length>1?(0,n.createComponent)(n.Dynamic,{get component(){return t.tag??`span`},children:d}):d})},D=[`zero`,`one`,`two`,`few`,`many`,`other`];function O(e,t){let n=[];for(let t of D){let r=e[t];if(r!==void 0){let e=t===`zero`?`=0`:t;n.push(`${e} {${r}}`)}}return`{count, plural, ${t?`offset:${t} `:``}${n.join(` `)}}`}var k=e=>{let{t:r}=f();function i(e){return typeof e==`function`?e():e}return(()=>{let a={};for(let t of D){let n=i(e[t]);n!==void 0&&(a[t]=n)}let{messages:o,components:s}=b(D,a),c=O({...o.zero!==void 0&&{zero:o.zero},...o.one!==void 0&&{one:o.one},...o.two!==void 0&&{two:o.two},...o.few!==void 0&&{few:o.few},...o.many!==void 0&&{many:o.many},other:o.other??``},e.offset),l=r({id:e.id??(e.context===void 0?c:(0,t.hashMessage)(c,e.context)),message:c,...e.context===void 0?{}:{context:e.context},...e.comment===void 0?{}:{comment:e.comment}},{count:e.value});return(0,n.createComponent)(n.Dynamic,{get component(){return e.tag??`span`},get children(){return(0,n.memo)(()=>s.length>0)()?y(l,s):l}})})},A=e=>{let{t:r}=f(),i=()=>e.tag??`span`,a=()=>{let n=e.options===void 0?{...Object.fromEntries(Object.entries(e).filter(([e])=>![`value`,`id`,`context`,`comment`,`options`,`other`,`tag`].includes(e))),other:e.other}:{...e.options,other:e.other},i=[...Object.keys(n).filter(e=>e!==`other`),`other`],{messages:a,components:o}=b(i,n),s=S(Object.fromEntries([...i].map(e=>[e,a[e]??``]))),c=r({id:e.id??(e.context===void 0?x(s.forms):(0,t.hashMessage)(x(s.forms),e.context)),message:x(s.forms),...e.context===void 0?{}:{context:e.context},...e.comment===void 0?{}:{comment:e.comment}},{value:s.valueMap[e.value]??`other`});return o.length>0?y(c,o):c};return(0,n.createComponent)(n.Dynamic,{get component(){return i()},get children(){return a()}})};function j(e){let{d:t}=f();return(0,n.memo)(()=>t(e.value,e.style))}function M(e){let{n:t}=f();return(0,n.memo)(()=>t(e.value,e.style))}exports.DateTime=j,exports.I18nCtx=u,exports.I18nProvider=d,exports.NumberFormat=M,exports.Plural=k,exports.Select=A,exports.Trans=E,exports.createI18n=c,exports.createI18nContext=o,Object.defineProperty(exports,`msg`,{enumerable:!0,get:function(){return t.msg}}),exports.t=p,exports.useI18n=f;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`solid-js`),t=require(`@fluenti/core`),n=require(`@fluenti/core/internal`),r=require(`solid-js/web`);var i=Symbol.for(`fluenti.runtime.solid.v1`);function a(){let e=globalThis[i];return typeof e==`object`&&e?e:null}function o(e){return typeof e==`object`&&e&&`default`in e?e.default:e}function s(r){let[i,s]=(0,e.createSignal)(r.locale),[c,l]=(0,e.createSignal)(!1),u=new Set([r.locale]),[d,f]=(0,e.createSignal)(new Set(u)),p={...r.messages},m=r,h=m.diagnostics?(0,t.createDiagnostics)(m.diagnostics):void 0,g=m.lazyLocaleLoading??r.splitting??!1;function _(e,t,r){let i=p[t];if(!i)return;let a=i[e];if(a!==void 0)return typeof a==`function`?a(r):typeof a==`string`&&r?(0,n.interpolate)(a,r,t):String(a)}function v(e,t,n){let i=[t],a=new Set(i);r.fallbackLocale&&!a.has(r.fallbackLocale)&&(i.push(r.fallbackLocale),a.add(r.fallbackLocale));let o=m.fallbackChain?.[t]??m.fallbackChain?.[`*`];if(o)for(let e of o)a.has(e)||(i.push(e),a.add(e));for(let r of i){let i=_(e,r,n);if(i!==void 0)return r!==t&&h?.fallbackUsed(t,r,e),i}}function y(e,t){if(!r.missing)return;let n=r.missing(t,e);if(n!==void 0)return n}function b(e,t,r){let i=v(e,t,r);if(i!==void 0)return i;h?.missingKey(t,e);let a=y(e,t);return a===void 0?e.includes(`{`)?(0,n.interpolate)(e,r,t):e:a}function x(e,...t){if(Array.isArray(e)&&`raw`in e)return x((0,n.buildICUMessage)(e,t),Object.fromEntries(t.map((e,t)=>[String(t),e])));let r=e,a=t[0],o=i();if(typeof r==`object`&&r){let e=(0,n.resolveDescriptorId)(r);if(e){let t=v(e,o,a);if(t!==void 0)return t;let n=y(e,o);if(n!==void 0)return n}return r.message===void 0?e??``:(0,n.interpolate)(r.message,a,o)}return b(r,o,a)}return{locale:i,setLocale:async e=>{if(!g||!m.chunkLoader){s(e);return}let t=a();if(u.has(e)){t?.__switchLocale&&await t.__switchLocale(e),s(e);return}l(!0);try{let n=o(await m.chunkLoader(e));p[e]={...p[e],...n},u.add(e),f(new Set(u)),t?.__switchLocale&&await t.__switchLocale(e),s(e)}finally{l(!1)}},t:x,loadMessages:(e,t)=>{p[e]={...p[e],...t},u.add(e),f(new Set(u))},getLocales:()=>Object.keys(p),d:(e,n)=>(0,t.formatDate)(e,i(),n,m.dateFormats),n:(e,n)=>(0,t.formatNumber)(e,i(),n,m.numberFormats),format:(e,t)=>(0,n.interpolate)(e,t,i()),isLoading:c,loadedLocales:d,preloadLocale:e=>{if(!g||u.has(e)||!m.chunkLoader)return;let t=a();m.chunkLoader(e).then(async n=>{let r=o(n);p[e]={...p[e],...r},u.add(e),f(new Set(u)),t?.__preloadLocale&&await t.__preloadLocale(e)}).catch(t=>{console.warn(`[fluenti] preload failed:`,e,t)})},te:(e,t)=>{let n=p[t??i()];return n!==void 0&&e in n},tm:(e,t)=>{let n=p[t??i()];return n?n[e]:void 0}}}var c=(0,e.createContext)(),l=e=>{let t=s(e);return(0,r.createComponent)(c.Provider,{value:t,get children(){return e.children}})};function u(){let t=(0,e.useContext)(c);if(t)return t;throw Error(`useI18n() must be used inside an <I18nProvider>.`)}var d=((...e)=>{throw Error("[fluenti] `t` imported from '@fluenti/solid' is a compile-time API. Use it only with the Fluenti build transform inside a component or custom hook. For runtime lookups, use useI18n().t(...).")});function f(e){return typeof Node<`u`&&e instanceof Node}function p(e){return typeof e==`function`&&!e.length?e():e}function m(e){let t=[],r=``;function i(e){let a=p(e);if(a==null||typeof a==`boolean`)return;if(Array.isArray(a)){for(let e of a)i(e);return}if(typeof a==`string`||typeof a==`number`){r+=String(a);return}if(!f(a))return;if(a.nodeType===Node.TEXT_NODE){r+=a.textContent??``;return}if(a.nodeType===Node.DOCUMENT_FRAGMENT_NODE){i(Array.from(a.childNodes));return}let o=t.length,s=m(Array.from(a.childNodes));t.push(a.cloneNode(!1)),t.push(...s.components),s.message===``&&s.components.length===0?r+=`<${o}/>`:r+=`<${o}>${(0,n.offsetIndices)(s.message,o+1)}</${o}>`}return i(e),{message:r,components:t}}function h(e,t){let n=p(t);if(!(n==null||typeof n==`boolean`)){if(Array.isArray(n)){for(let t of n)h(e,t);return}if(typeof n==`string`||typeof n==`number`){e.appendChild(document.createTextNode(String(n)));return}f(n)&&e.appendChild(n)}}function g(e,t){let n=/<(\d+)(?:\/>|(>)([\s\S]*?)<\/\1>)/g,r=[],i=0,a;for(n.lastIndex=0,a=n.exec(e);a!==null;){a.index>i&&r.push(e.slice(i,a.index));let o=Number(a[1]),s=a[2]===void 0,c=t[o];if(s)c&&r.push(c.cloneNode(!1));else{let e=g(a[2]===void 0?``:a[3],t);if(c){let t=c.cloneNode(!1);h(t,e),r.push(t)}else r.push(a[3]??``)}i=n.lastIndex,a=n.exec(e)}return i<e.length&&r.push(e.slice(i)),r.length<=1?r[0]??``:r}function _(e,t){let r={},i=[];for(let a of e){let e=t[a];if(e===void 0)continue;let o=m(e);r[a]=(0,n.offsetIndices)(o.message,i.length),i.push(...o.components)}for(let[a,o]of Object.entries(t)){if(e.includes(a)||o===void 0)continue;let t=m(o);r[a]=(0,n.offsetIndices)(t.message,i.length),i.push(...t.components)}return{messages:r,components:i}}function v(e){let t=[],n=0;for(;n<e.length;){let r=e.indexOf(`<`,n);if(r===-1){t.push({type:`text`,value:e.slice(n)});break}r>n&&t.push({type:`text`,value:e.slice(n,r)});let i=e.slice(r).match(/^<(\w+)\s*\/>/);if(i){t.push({type:`tag`,name:i[1],children:[]}),n=r+i[0].length;continue}let a=e.slice(r).match(/^<(\w+)>/);if(!a){t.push({type:`text`,value:`<`}),n=r+1;continue}let o=a[1],s=r+a[0].length,c=y(e,o,s);if(c===-1){t.push({type:`text`,value:e.slice(r,s)}),n=s;continue}let l=e.slice(s,c),u=`</${o}>`;t.push({type:`tag`,name:o,children:v(l)}),n=c+u.length}return t}function y(e,t,n){let r=`<${t}>`,i=`</${t}>`,a=1,o=n;for(;o<e.length&&a>0;){let t=e.indexOf(r,o),n=e.indexOf(i,o);if(n===-1)return-1;if(t!==-1&&t<n)a++,o=t+r.length;else{if(a--,a===0)return n;o=n+i.length}}return-1}function b(e,t){let n=e.map(e=>{if(e.type===`text`)return e.value;let n=t[e.name];return n?(0,r.createComponent)(r.Dynamic,{component:n,children:e.children.length>0?b(e.children,t):void 0}):b(e.children,t)});return n.length===1?n[0]:n}var x=t=>{let{t:n}=u(),i=(0,e.children)(()=>t.children),a=(0,e.createMemo)(()=>{let e=t.__message??t.message;return typeof e==`function`?e():e}),o=(0,e.createMemo)(()=>t.__components??t.components);return(()=>{let e=a(),s=o();if(e!==void 0&&s)return b(v(n({...t.id===void 0?{}:{id:t.id},message:e,...t.context===void 0?{}:{context:t.context},...t.comment===void 0?{}:{comment:t.comment}})),s);let c=i.toArray();if(c.length===0)return null;let l=m(c),u=n({...t.id===void 0?{}:{id:t.id},message:l.message,...t.context===void 0?{}:{context:t.context},...t.comment===void 0?{}:{comment:t.comment}}),d=l.components.length>0?g(u,l.components):u;return Array.isArray(d)&&d.length>1&&t.tag?(0,r.createComponent)(r.Dynamic,{get component(){return t.tag},children:d}):d})},S=e=>{let{t}=u();function i(e){return typeof e==`function`?e():e}return(()=>{let a={};for(let t of n.PLURAL_CATEGORIES){let n=i(e[t]);n!==void 0&&(a[t]=n)}let{messages:o,components:s}=_(n.PLURAL_CATEGORIES,a),c=(0,n.buildICUPluralMessage)({...o.zero!==void 0&&{zero:o.zero},...o.one!==void 0&&{one:o.one},...o.two!==void 0&&{two:o.two},...o.few!==void 0&&{few:o.few},...o.many!==void 0&&{many:o.many},other:o.other??``},e.offset),l=t({id:e.id??(e.context===void 0?c:(0,n.hashMessage)(c,e.context)),message:c,...e.context===void 0?{}:{context:e.context},...e.comment===void 0?{}:{comment:e.comment}},{count:e.value}),u=s.length>0?g(l,s):l;return e.tag?(0,r.createComponent)(r.Dynamic,{get component(){return e.tag},children:u}):u})},C=e=>{let{t}=u(),i=()=>{let r=e.options===void 0?{...Object.fromEntries(Object.entries(e).filter(([e])=>![`value`,`id`,`context`,`comment`,`options`,`other`,`tag`].includes(e))),other:e.other}:{...e.options,other:e.other},i=[...Object.keys(r).filter(e=>e!==`other`),`other`],{messages:a,components:o}=_(i,r),s=(0,n.normalizeSelectForms)(Object.fromEntries([...i].map(e=>[e,a[e]??``]))),c=t({id:e.id??(e.context===void 0?(0,n.buildICUSelectMessage)(s.forms):(0,n.hashMessage)((0,n.buildICUSelectMessage)(s.forms),e.context)),message:(0,n.buildICUSelectMessage)(s.forms),...e.context===void 0?{}:{context:e.context},...e.comment===void 0?{}:{comment:e.comment}},{value:s.valueMap[e.value]??`other`});return o.length>0?g(c,o):c};return(()=>e.tag?(0,r.createComponent)(r.Dynamic,{get component(){return e.tag},get children(){return i()}}):(0,r.memo)(i))};function w(e){let{d:t}=u();return(0,r.memo)(()=>t(e.value,e.style))}function T(e){let{n:t}=u();return(0,r.memo)(()=>t(e.value,e.style))}exports.DateTime=w,exports.I18nProvider=l,exports.NumberFormat=T,exports.Plural=S,exports.Select=C,exports.Trans=x,exports.createFluentiContext=s,Object.defineProperty(exports,`msg`,{enumerable:!0,get:function(){return t.msg}}),exports.t=d,exports.useI18n=u;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["createContext","ParentComponent","createI18nContext","I18nConfig","I18nContext","I18nCtx","I18nProvider","props","ctx","_$createComponent","Provider","value","children","JSX","isNodeLike","value","Node","resolveValue","length","offsetIndices","message","offset","replace","_match","index","suffix","Number","extractMessage","components","visit","node","resolved","undefined","Array","isArray","child","String","nodeType","TEXT_NODE","textContent","DOCUMENT_FRAGMENT_NODE","from","childNodes","idx","inner","push","Element","cloneNode","appendChild","parent","entry","document","createTextNode","reconstruct","translated","tagRe","result","lastIndex","match","RegExpExecArray","exec","slice","template","clone","serializeRichForms","keys","T","forms","Partial","Record","messages","key","extracted","Object","entries","includes","buildICUSelectMessage","map","text","join","normalizeSelectForms","valueMap","normalized","safeKey","test","Dynamic","children","resolveChildren","createMemo","Component","JSX","useI18n","extractMessage","extractDomMessage","reconstruct","reconstructDomMessage","RichComponent","Element","TransProps","id","context","comment","tag","message","components","Record","__message","__components","TextToken","type","value","TagToken","name","Token","parseTokens","input","tokens","pos","length","openIdx","indexOf","push","slice","selfCloseMatch","match","openMatch","tagName","contentStart","innerEnd","findClosingTag","innerContent","closingTag","startPos","openTag","closeTag","depth","nextOpen","nextClose","renderTokens","elements","map","token","Comp","undefined","_$createComponent","component","Trans","props","t","resolvedChildren","raw","msg","comps","translated","toArray","extracted","result","Array","isArray","Dynamic","Component","JSX","hashMessage","useI18n","reconstruct","serializeRichForms","PLURAL_CATEGORIES","const","PluralCategory","buildICUPluralMessage","forms","Partial","Record","other","offset","parts","cat","text","undefined","key","push","offsetPrefix","join","PluralProps","value","id","context","comment","zero","Element","one","two","few","many","tag","Plural","props","t","resolveProp","val","resolvedValues","resolved","messages","components","icuMessage","translated","message","count","_$createComponent","component","children","_$memo","length","Component","JSX","Dynamic","hashMessage","useI18n","buildICUSelectMessage","normalizeSelectForms","reconstruct","serializeRichForms","SelectProps","value","id","context","comment","other","Element","options","Record","tag","key","SelectComp","props","t","resolvedTag","content","forms","undefined","Object","fromEntries","entries","filter","includes","orderedKeys","keys","const","messages","components","normalized","map","translated","message","valueMap","length","_$createComponent","component","children","useI18n","DateTimeProps","value","Date","style","DateTime","props","d","_$memo","useI18n","NumberProps","value","style","NumberFormat","props","n","_$memo"],"sources":["../src/context.ts","../src/provider.tsx","../src/use-i18n.ts","../src/compile-time-t.ts","../src/rich-dom.tsx","../src/trans.tsx","../src/plural.tsx","../src/select.tsx","../src/components/DateTime.tsx","../src/components/NumberFormat.tsx"],"sourcesContent":["import { createSignal, createRoot, type Accessor } from 'solid-js'\nimport { formatDate, formatNumber, interpolate as coreInterpolate, buildICUMessage, resolveDescriptorId } from '@fluenti/core'\nimport type { FluentConfig, Locale, Messages, CompiledMessage, MessageDescriptor, DateFormatOptions, NumberFormatOptions } from '@fluenti/core'\n\n/** Chunk loader for lazy locale loading */\nexport type ChunkLoader = (\n locale: string,\n) => Promise<Record<string, CompiledMessage> | { default: Record<string, CompiledMessage> }>\n\ninterface SplitRuntimeModule {\n __switchLocale?: (locale: string) => Promise<void>\n __preloadLocale?: (locale: string) => Promise<void>\n}\n\nconst SPLIT_RUNTIME_KEY = Symbol.for('fluenti.runtime.solid')\n\nfunction getSplitRuntimeModule(): SplitRuntimeModule | null {\n const runtime = (globalThis as Record<PropertyKey, unknown>)[SPLIT_RUNTIME_KEY]\n return typeof runtime === 'object' && runtime !== null\n ? runtime as SplitRuntimeModule\n : null\n}\n\nfunction resolveChunkMessages(\n loaded: Record<string, CompiledMessage> | { default: Record<string, CompiledMessage> },\n): Record<string, CompiledMessage> {\n return typeof loaded === 'object' && loaded !== null && 'default' in loaded\n ? (loaded as { default: Record<string, CompiledMessage> }).default\n : loaded\n}\n\n/** Extended config with lazy locale loading support */\nexport interface I18nConfig extends FluentConfig {\n /** Async chunk loader for lazy locale loading */\n chunkLoader?: ChunkLoader\n /** Enable lazy locale loading through chunkLoader */\n lazyLocaleLoading?: boolean\n /** Locale-specific fallback chains */\n fallbackChain?: Record<string, Locale[]>\n /** Named date format styles */\n dateFormats?: DateFormatOptions\n /** Named number format styles */\n numberFormats?: NumberFormatOptions\n}\n\n/** Reactive i18n context holding locale signal and translation utilities */\nexport interface I18nContext {\n /** Reactive accessor for the current locale */\n locale(): Locale\n /** Set the active locale (async when lazy locale loading is enabled) */\n setLocale(locale: Locale): Promise<void>\n /** Translate a message by id with optional interpolation values */\n t(id: string | MessageDescriptor, values?: Record<string, unknown>): string\n /** Tagged template form: t`Hello ${name}` */\n t(strings: TemplateStringsArray, ...exprs: unknown[]): string\n /** Merge additional messages into a locale catalog at runtime */\n loadMessages(locale: Locale, messages: Messages): void\n /** Return all locale codes that have loaded messages */\n getLocales(): Locale[]\n /** Format a date value for the current locale */\n d(value: Date | number, style?: string): string\n /** Format a number value for the current locale */\n n(value: number, style?: string): string\n /** Format an ICU message string directly (no catalog lookup) */\n format(message: string, values?: Record<string, unknown>): string\n /** Whether a locale chunk is currently being loaded */\n isLoading: Accessor<boolean>\n /** Set of locales whose messages have been loaded */\n loadedLocales: Accessor<Set<string>>\n /** Preload a locale in the background without switching to it */\n preloadLocale(locale: string): void\n}\n\n/**\n * Create a reactive i18n context backed by Solid signals.\n *\n * The returned `t()` reads the internal `locale()` signal, so any\n * Solid computation that calls `t()` will re-run when the locale changes.\n */\nexport function createI18nContext(config: FluentConfig | I18nConfig): I18nContext {\n const [locale, setLocaleSignal] = createSignal<Locale>(config.locale)\n const [isLoading, setIsLoading] = createSignal(false)\n const loadedLocalesSet = new Set<string>([config.locale])\n const [loadedLocales, setLoadedLocales] = createSignal(new Set(loadedLocalesSet))\n const messages: Record<string, Messages> = { ...config.messages }\n const i18nConfig = config as I18nConfig\n const lazyLocaleLoading = i18nConfig.lazyLocaleLoading\n ?? (config as I18nConfig & { splitting?: boolean }).splitting\n ?? false\n\n function lookupCatalog(\n id: string,\n loc: Locale,\n values?: Record<string, unknown>,\n ): string | undefined {\n const catalog = messages[loc]\n if (!catalog) {\n return undefined\n }\n\n const msg = catalog[id]\n if (msg === undefined) {\n return undefined\n }\n\n if (typeof msg === 'function') {\n return msg(values)\n }\n\n if (typeof msg === 'string' && values) {\n return coreInterpolate(msg, values, loc)\n }\n\n return String(msg)\n }\n\n function lookupWithFallbacks(\n id: string,\n loc: Locale,\n values?: Record<string, unknown>,\n ): string | undefined {\n const localesToTry: Locale[] = [loc]\n const seen = new Set(localesToTry)\n\n if (config.fallbackLocale && !seen.has(config.fallbackLocale)) {\n localesToTry.push(config.fallbackLocale)\n seen.add(config.fallbackLocale)\n }\n\n const chainLocales = i18nConfig.fallbackChain?.[loc] ?? i18nConfig.fallbackChain?.['*']\n if (chainLocales) {\n for (const chainLocale of chainLocales) {\n if (!seen.has(chainLocale)) {\n localesToTry.push(chainLocale)\n seen.add(chainLocale)\n }\n }\n }\n\n for (const targetLocale of localesToTry) {\n const result = lookupCatalog(id, targetLocale, values)\n if (result !== undefined) {\n return result\n }\n }\n\n return undefined\n }\n\n function resolveMissing(\n id: string,\n loc: Locale,\n ): string | undefined {\n if (!config.missing) {\n return undefined\n }\n\n const result = config.missing(loc, id)\n if (result !== undefined) {\n return result\n }\n return undefined\n }\n\n function resolveMessage(\n id: string,\n loc: Locale,\n values?: Record<string, unknown>,\n ): string {\n const catalogResult = lookupWithFallbacks(id, loc, values)\n if (catalogResult !== undefined) {\n return catalogResult\n }\n\n const missingResult = resolveMissing(id, loc)\n if (missingResult !== undefined) {\n return missingResult\n }\n\n if (id.includes('{')) {\n return coreInterpolate(id, values, loc)\n }\n\n return id\n }\n\n function t(strings: TemplateStringsArray, ...exprs: unknown[]): string\n function t(id: string | MessageDescriptor, values?: Record<string, unknown>): string\n function t(idOrStrings: string | MessageDescriptor | TemplateStringsArray, ...rest: unknown[]): string {\n // Tagged template form: t`Hello ${name}`\n if (Array.isArray(idOrStrings) && 'raw' in idOrStrings) {\n const strings = idOrStrings as TemplateStringsArray\n const icu = buildICUMessage(strings, rest)\n const values = Object.fromEntries(rest.map((v, i) => [String(i), v]))\n return t(icu, values)\n }\n\n const id = idOrStrings as string | MessageDescriptor\n const values = rest[0] as Record<string, unknown> | undefined\n const currentLocale = locale() // reactive dependency\n if (typeof id === 'object' && id !== null) {\n const messageId = resolveDescriptorId(id)\n if (messageId) {\n const catalogResult = lookupWithFallbacks(messageId, currentLocale, values)\n if (catalogResult !== undefined) {\n return catalogResult\n }\n\n const missingResult = resolveMissing(messageId, currentLocale)\n if (missingResult !== undefined) {\n return missingResult\n }\n }\n\n if (id.message !== undefined) {\n return coreInterpolate(id.message, values, currentLocale)\n }\n\n return messageId ?? ''\n }\n\n return resolveMessage(id, currentLocale, values)\n }\n\n const loadMessages = (loc: Locale, msgs: Messages): void => {\n // Intentional mutation: messages record is locally scoped to this context closure\n messages[loc] = { ...messages[loc], ...msgs }\n loadedLocalesSet.add(loc)\n setLoadedLocales(new Set(loadedLocalesSet))\n }\n\n const setLocale = async (newLocale: Locale): Promise<void> => {\n if (!lazyLocaleLoading || !i18nConfig.chunkLoader) {\n setLocaleSignal(newLocale)\n return\n }\n\n const splitRuntime = getSplitRuntimeModule()\n\n if (loadedLocalesSet.has(newLocale)) {\n if (splitRuntime?.__switchLocale) {\n await splitRuntime.__switchLocale(newLocale)\n }\n setLocaleSignal(newLocale)\n return\n }\n\n setIsLoading(true)\n try {\n const loaded = resolveChunkMessages(await i18nConfig.chunkLoader(newLocale))\n // Intentional mutation: messages record is locally scoped to this context closure\n messages[newLocale] = { ...messages[newLocale], ...loaded }\n loadedLocalesSet.add(newLocale)\n setLoadedLocales(new Set(loadedLocalesSet))\n if (splitRuntime?.__switchLocale) {\n await splitRuntime.__switchLocale(newLocale)\n }\n setLocaleSignal(newLocale)\n } finally {\n setIsLoading(false)\n }\n }\n\n const preloadLocale = (loc: string): void => {\n if (!lazyLocaleLoading || loadedLocalesSet.has(loc) || !i18nConfig.chunkLoader) return\n const splitRuntime = getSplitRuntimeModule()\n i18nConfig.chunkLoader(loc).then(async (loaded) => {\n const resolved = resolveChunkMessages(loaded)\n // Intentional mutation: messages record is locally scoped to this context closure\n messages[loc] = { ...messages[loc], ...resolved }\n loadedLocalesSet.add(loc)\n setLoadedLocales(new Set(loadedLocalesSet))\n if (splitRuntime?.__preloadLocale) {\n await splitRuntime.__preloadLocale(loc)\n }\n }).catch((e: unknown) => {\n console.warn('[fluenti] preload failed:', loc, e)\n })\n }\n\n const getLocales = (): Locale[] => Object.keys(messages)\n\n const d = (value: Date | number, style?: string): string =>\n formatDate(value, locale(), style, i18nConfig.dateFormats)\n\n const n = (value: number, style?: string): string =>\n formatNumber(value, locale(), style, i18nConfig.numberFormats)\n\n const format = (message: string, values?: Record<string, unknown>): string => {\n return coreInterpolate(message, values, locale())\n }\n\n return { locale, setLocale, t, loadMessages, getLocales, d, n, format, isLoading, loadedLocales, preloadLocale }\n}\n\n// ─── Module-level singleton ─────────────────────────────────────────────────\n\nlet globalCtx: I18nContext | undefined\n\n/**\n * Initialize the global i18n singleton.\n *\n * Call once at app startup (e.g. in your entry file) before any `useI18n()`.\n * Signals are created inside a `createRoot` so they outlive any component scope.\n *\n * Returns the context for convenience, but `useI18n()` will also find it.\n */\nexport function createI18n(config: FluentConfig | I18nConfig): I18nContext {\n const ctx = createRoot(() => createI18nContext(config))\n\n // Only set global singleton in browser (client-side).\n // In SSR, each request should use <I18nProvider> for per-request isolation.\n if (typeof window !== 'undefined') {\n globalCtx = ctx\n } else {\n console.warn(\n '[fluenti] createI18n() detected SSR environment. ' +\n 'Use <I18nProvider> for per-request isolation in SSR.',\n )\n }\n\n return ctx\n}\n\n/** @internal — used by useI18n and I18nProvider */\nexport function getGlobalI18nContext(): I18nContext | undefined {\n return globalCtx\n}\n\n/** @internal — used by I18nProvider to set context without createRoot wrapper */\nexport function setGlobalI18nContext(ctx: I18nContext): void {\n globalCtx = ctx\n}\n\n/** @internal — reset the global singleton (for testing only) */\nexport function resetGlobalI18nContext(): void {\n globalCtx = undefined\n}\n","import { createContext } from 'solid-js'\nimport type { ParentComponent } from 'solid-js'\nimport { createI18nContext } from './context'\nimport type { I18nConfig, I18nContext } from './context'\n\n/** Solid context object for i18n — used internally by useI18n() */\nexport const I18nCtx = createContext<I18nContext>()\n\n/**\n * Provide i18n context to the component tree.\n *\n */\nexport const I18nProvider: ParentComponent<I18nConfig> = (props) => {\n const ctx = createI18nContext(props)\n return <I18nCtx.Provider value={ctx}>{props.children}</I18nCtx.Provider>\n}\n","import { useContext } from 'solid-js'\nimport { I18nCtx } from './provider'\nimport { getGlobalI18nContext } from './context'\nimport type { I18nContext } from './context'\n\n/**\n * Access the i18n context.\n *\n * Resolution order:\n * 1. Nearest `<I18nProvider>` in the component tree\n * 2. Module-level singleton created by `createI18n()`\n *\n * Throws if neither is available.\n */\nexport function useI18n(): I18nContext {\n const ctx = useContext(I18nCtx)\n if (ctx) {\n return ctx\n }\n\n const global = getGlobalI18nContext()\n if (global) {\n return global\n }\n\n throw new Error(\n 'useI18n requires either createI18n() to be called at startup, ' +\n 'or the component to be inside an <I18nProvider>.',\n )\n}\n","import type { CompileTimeT } from '@fluenti/core'\n\nexport const t: CompileTimeT = ((..._args: unknown[]) => {\n throw new Error(\n \"[fluenti] `t` imported from '@fluenti/solid' is a compile-time API. \" +\n 'Use it only with the Fluenti build transform inside a component or custom hook. ' +\n 'For runtime lookups, use useI18n().t(...).',\n )\n}) as CompileTimeT\n","import type { JSX } from 'solid-js'\n\nfunction isNodeLike(value: unknown): value is Node {\n return typeof Node !== 'undefined' && value instanceof Node\n}\n\nfunction resolveValue(value: unknown): unknown {\n if (typeof value === 'function' && !(value as { length?: number }).length) {\n return (value as () => unknown)()\n }\n return value\n}\n\nexport function offsetIndices(message: string, offset: number): string {\n if (offset === 0) return message\n return message\n .replace(/<(\\d+)(\\/?>)/g, (_match, index: string, suffix: string) => `<${Number(index) + offset}${suffix}`)\n .replace(/<\\/(\\d+)>/g, (_match, index: string) => `</${Number(index) + offset}>`)\n}\n\nexport function extractMessage(value: unknown): {\n message: string\n components: Node[]\n} {\n const components: Node[] = []\n let message = ''\n\n function visit(node: unknown): void {\n const resolved = resolveValue(node)\n if (resolved === null || resolved === undefined || typeof resolved === 'boolean') return\n if (Array.isArray(resolved)) {\n for (const child of resolved) visit(child)\n return\n }\n if (typeof resolved === 'string' || typeof resolved === 'number') {\n message += String(resolved)\n return\n }\n if (!isNodeLike(resolved)) return\n if (resolved.nodeType === Node.TEXT_NODE) {\n message += resolved.textContent ?? ''\n return\n }\n if (resolved.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n visit(Array.from(resolved.childNodes))\n return\n }\n\n const idx = components.length\n const inner = extractMessage(Array.from(resolved.childNodes))\n components.push((resolved as Element).cloneNode(false))\n components.push(...inner.components)\n message += `<${idx}>${offsetIndices(inner.message, idx + 1)}</${idx}>`\n }\n\n visit(value)\n return { message, components }\n}\n\nfunction appendChild(parent: Node, child: unknown): void {\n const resolved = resolveValue(child)\n if (resolved === null || resolved === undefined || typeof resolved === 'boolean') return\n if (Array.isArray(resolved)) {\n for (const entry of resolved) appendChild(parent, entry)\n return\n }\n if (typeof resolved === 'string' || typeof resolved === 'number') {\n parent.appendChild(document.createTextNode(String(resolved)))\n return\n }\n if (isNodeLike(resolved)) {\n parent.appendChild(resolved)\n }\n}\n\nexport function reconstruct(\n translated: string,\n components: Node[],\n): JSX.Element {\n const tagRe = /<(\\d+)>([\\s\\S]*?)<\\/\\1>/g\n const result: unknown[] = []\n let lastIndex = 0\n let match: RegExpExecArray | null\n\n tagRe.lastIndex = 0\n match = tagRe.exec(translated)\n while (match !== null) {\n if (match.index > lastIndex) {\n result.push(translated.slice(lastIndex, match.index))\n }\n\n const idx = Number(match[1])\n const template = components[idx]\n const inner = reconstruct(match[2]!, components)\n if (template) {\n const clone = template.cloneNode(false)\n appendChild(clone, inner)\n result.push(clone)\n } else {\n result.push(match[2]!)\n }\n\n lastIndex = tagRe.lastIndex\n match = tagRe.exec(translated)\n }\n\n if (lastIndex < translated.length) {\n result.push(translated.slice(lastIndex))\n }\n\n return (result.length <= 1 ? result[0] ?? '' : result) as JSX.Element\n}\n\nexport function serializeRichForms<T extends string>(\n keys: readonly T[],\n forms: Partial<Record<T, unknown>> & Record<string, unknown>,\n): {\n messages: Record<string, string>\n components: Node[]\n} {\n const messages: Record<string, string> = {}\n const components: Node[] = []\n\n for (const key of keys) {\n const value = forms[key]\n if (value === undefined) continue\n const extracted = extractMessage(value)\n messages[key] = offsetIndices(extracted.message, components.length)\n components.push(...extracted.components)\n }\n\n for (const [key, value] of Object.entries(forms)) {\n if (keys.includes(key as T) || value === undefined) continue\n const extracted = extractMessage(value)\n messages[key] = offsetIndices(extracted.message, components.length)\n components.push(...extracted.components)\n }\n\n return { messages, components }\n}\n\nexport function buildICUSelectMessage(forms: Record<string, string>): string {\n return `{value, select, ${Object.entries(forms).map(([key, text]) => `${key} {${text}}`).join(' ')}}`\n}\n\nexport function normalizeSelectForms(forms: Record<string, string>): {\n forms: Record<string, string>\n valueMap: Record<string, string>\n} {\n const normalized: Record<string, string> = {}\n const valueMap: Record<string, string> = {}\n let index = 0\n\n for (const [key, text] of Object.entries(forms)) {\n if (key === 'other') {\n normalized['other'] = text\n continue\n }\n\n const safeKey = /^[A-Za-z0-9_]+$/.test(key) ? key : `case_${index++}`\n normalized[safeKey] = text\n valueMap[key] = safeKey\n }\n\n if (normalized['other'] === undefined) {\n normalized['other'] = ''\n }\n\n return { forms: normalized, valueMap }\n}\n","import { Dynamic } from 'solid-js/web'\nimport { children as resolveChildren, createMemo } from 'solid-js'\nimport type { Component, JSX } from 'solid-js'\nimport { useI18n } from './use-i18n'\nimport { extractMessage as extractDomMessage, reconstruct as reconstructDomMessage } from './rich-dom'\n\n/** A Solid component that accepts children */\nexport type RichComponent = Component<{ children?: JSX.Element }>\n\n/** Props for the `<Trans>` component */\nexport interface TransProps {\n /** Override auto-generated hash ID */\n id?: string\n /** Message context used for identity and translator disambiguation */\n context?: string\n /** Translator-facing note preserved in extraction catalogs */\n comment?: string\n /** Wrapper element tag name (default: `'span'`) — used in children-only mode */\n tag?: string\n /** Children — the content to translate (legacy API) */\n children?: JSX.Element\n /** Translated message string with XML-like tags (e.g. `<bold>text</bold>`) */\n message?: string\n /** Map of tag names to Solid components */\n components?: Record<string, RichComponent>\n /** @internal Pre-computed message from build plugin */\n __message?: string\n /** @internal Pre-computed component map from build plugin */\n __components?: Record<string, RichComponent>\n}\n\n/**\n * A token from parsing the message string.\n * Either a plain text segment or a tag with inner content.\n */\ninterface TextToken {\n readonly type: 'text'\n readonly value: string\n}\n\ninterface TagToken {\n readonly type: 'tag'\n readonly name: string\n readonly children: readonly Token[]\n}\n\ntype Token = TextToken | TagToken\n\n/**\n * Parse a message string containing XML-like tags into a token tree.\n *\n * Supports:\n * - Named tags: `<bold>content</bold>`\n * - Self-closing tags: `<br/>`\n * - Nested tags: `<bold>hello <italic>world</italic></bold>`\n */\nfunction parseTokens(input: string): readonly Token[] {\n const tokens: Token[] = []\n let pos = 0\n\n while (pos < input.length) {\n const openIdx = input.indexOf('<', pos)\n\n if (openIdx === -1) {\n // No more tags — rest is plain text\n tokens.push({ type: 'text', value: input.slice(pos) })\n break\n }\n\n // Push any text before this tag\n if (openIdx > pos) {\n tokens.push({ type: 'text', value: input.slice(pos, openIdx) })\n }\n\n // Check for self-closing tag: <tagName/>\n const selfCloseMatch = input.slice(openIdx).match(/^<(\\w+)\\s*\\/>/)\n if (selfCloseMatch) {\n tokens.push({ type: 'tag', name: selfCloseMatch[1]!, children: [] })\n pos = openIdx + selfCloseMatch[0].length\n continue\n }\n\n // Check for opening tag: <tagName>\n const openMatch = input.slice(openIdx).match(/^<(\\w+)>/)\n if (!openMatch) {\n // Not a valid tag — treat '<' as text\n tokens.push({ type: 'text', value: '<' })\n pos = openIdx + 1\n continue\n }\n\n const tagName = openMatch[1]!\n const contentStart = openIdx + openMatch[0].length\n\n // Find the matching closing tag, respecting nesting\n const innerEnd = findClosingTag(input, tagName, contentStart)\n if (innerEnd === -1) {\n // No closing tag found — treat as plain text\n tokens.push({ type: 'text', value: input.slice(openIdx, contentStart) })\n pos = contentStart\n continue\n }\n\n const innerContent = input.slice(contentStart, innerEnd)\n const closingTag = `</${tagName}>`\n tokens.push({\n type: 'tag',\n name: tagName,\n children: parseTokens(innerContent),\n })\n pos = innerEnd + closingTag.length\n }\n\n return tokens\n}\n\n/**\n * Find the position of the matching closing tag, accounting for nesting\n * of the same tag name.\n *\n * Returns the index of the start of the closing tag, or -1 if not found.\n */\nfunction findClosingTag(input: string, tagName: string, startPos: number): number {\n const openTag = `<${tagName}>`\n const closeTag = `</${tagName}>`\n let depth = 1\n let pos = startPos\n\n while (pos < input.length && depth > 0) {\n const nextOpen = input.indexOf(openTag, pos)\n const nextClose = input.indexOf(closeTag, pos)\n\n if (nextClose === -1) return -1\n\n if (nextOpen !== -1 && nextOpen < nextClose) {\n depth++\n pos = nextOpen + openTag.length\n } else {\n depth--\n if (depth === 0) return nextClose\n pos = nextClose + closeTag.length\n }\n }\n\n return -1\n}\n\n/**\n * Render a token tree into Solid JSX elements using the components map.\n */\nfunction renderTokens(\n tokens: readonly Token[],\n components: Record<string, RichComponent>,\n): JSX.Element {\n const elements = tokens.map((token): JSX.Element => {\n if (token.type === 'text') {\n return token.value as unknown as JSX.Element\n }\n\n const Comp = components[token.name]\n if (!Comp) {\n // Unknown component — render inner content as plain text\n return renderTokens(token.children, components)\n }\n\n const innerContent = token.children.length > 0\n ? renderTokens(token.children, components)\n : undefined\n\n return (<Dynamic component={Comp}>{innerContent}</Dynamic>) as JSX.Element\n })\n\n if (elements.length === 1) return elements[0]!\n return (<>{elements}</>) as JSX.Element\n}\n\n/**\n * Render translated content with inline components.\n *\n * Supports two APIs:\n *\n * 1. **message + components** (recommended for rich text):\n * ```tsx\n * <Trans\n * message={t`Welcome to <bold>Fluenti</bold>!`}\n * components={{ bold: (props) => <strong>{props.children}</strong> }}\n * />\n * ```\n *\n * 2. **children** (legacy / simple passthrough):\n * ```tsx\n * <Trans>Click <a href=\"/next\">here</a> to continue</Trans>\n * ```\n */\nexport const Trans: Component<TransProps> = (props) => {\n const { t } = useI18n()\n const resolvedChildren = resolveChildren(() => props.children)\n // message + components API (including build-time __message/__components)\n // Note: the vite-plugin tagged-template transform wraps Solid expressions in\n // createMemo(), so props.message may be a memo accessor (function) instead of\n // a string. We unwrap it here to handle both cases.\n const message = createMemo(() => {\n const raw = props.__message ?? props.message\n return typeof raw === 'function' ? (raw as () => string)() : raw\n })\n const components = createMemo(() => props.__components ?? props.components)\n\n return (() => {\n const msg = message()\n const comps = components()\n\n if (msg !== undefined && comps) {\n const translated = t({\n ...(props.id !== undefined ? { id: props.id } : {}),\n message: msg,\n ...(props.context !== undefined ? { context: props.context } : {}),\n ...(props.comment !== undefined ? { comment: props.comment } : {}),\n })\n const tokens = parseTokens(translated)\n return renderTokens(tokens, comps)\n }\n\n // Fallback: children-only API with runtime extraction/reconstruction\n const children = resolvedChildren.toArray()\n if (children.length === 0) return null\n const extracted = extractDomMessage(children)\n const translated = t({\n ...(props.id !== undefined ? { id: props.id } : {}),\n message: extracted.message,\n ...(props.context !== undefined ? { context: props.context } : {}),\n ...(props.comment !== undefined ? { comment: props.comment } : {}),\n })\n const result = extracted.components.length > 0\n ? reconstructDomMessage(translated, extracted.components)\n : translated\n\n if (Array.isArray(result) && result.length > 1) {\n return (<Dynamic component={props.tag ?? 'span'}>{result}</Dynamic>) as JSX.Element\n }\n\n return result as JSX.Element\n }) as unknown as JSX.Element\n}\n","import { Dynamic } from 'solid-js/web'\nimport type { Component, JSX } from 'solid-js'\nimport { hashMessage } from '@fluenti/core'\nimport { useI18n } from './use-i18n'\nimport { reconstruct, serializeRichForms } from './rich-dom'\n\n/** Plural category names in a stable order for ICU message building. */\nconst PLURAL_CATEGORIES = ['zero', 'one', 'two', 'few', 'many', 'other'] as const\n\ntype PluralCategory = (typeof PLURAL_CATEGORIES)[number]\n\n/**\n * Build an ICU plural message string from individual category props.\n *\n * Given `{ zero: \"No items\", one: \"# item\", other: \"# items\" }`,\n * produces `\"{count, plural, =0 {No items} one {# item} other {# items}}\"`.\n *\n * @internal\n */\nfunction buildICUPluralMessage(\n forms: Partial<Record<PluralCategory, string>> & { other: string },\n offset?: number,\n): string {\n const parts: string[] = []\n for (const cat of PLURAL_CATEGORIES) {\n const text = forms[cat]\n if (text !== undefined) {\n // Map the `zero` prop to ICU `=0` exact match. In ICU MessageFormat,\n // `zero` is a CLDR plural category that only activates in languages\n // with a grammatical zero form (e.g. Arabic). The `=0` exact match\n // works universally for the common \"show this when count is 0\" intent.\n const key = cat === 'zero' ? '=0' : cat\n parts.push(`${key} {${text}}`)\n }\n }\n const offsetPrefix = offset ? `offset:${offset} ` : ''\n return `{count, plural, ${offsetPrefix}${parts.join(' ')}}`\n}\n\n/** Props for the `<Plural>` component */\nexport interface PluralProps {\n /** The numeric value to pluralise */\n value: number\n /** Override the auto-generated synthetic ICU message id */\n id?: string\n /** Message context used for identity and translator disambiguation */\n context?: string\n /** Translator-facing note preserved in extraction catalogs */\n comment?: string\n /** Offset from value before selecting form */\n offset?: number\n /** Message for the \"zero\" plural category */\n zero?: string | JSX.Element\n /** Message for the \"one\" plural category */\n one?: string | JSX.Element\n /** Message for the \"two\" plural category */\n two?: string | JSX.Element\n /** Message for the \"few\" plural category */\n few?: string | JSX.Element\n /** Message for the \"many\" plural category */\n many?: string | JSX.Element\n /** Fallback message when no category-specific prop matches */\n other: string | JSX.Element\n /** Wrapper element tag name (default: `'span'`) */\n tag?: string\n}\n\n/**\n * `<Plural>` component — shorthand for ICU plural patterns.\n *\n * Plural form props (`zero`, `one`, `two`, `few`, `many`, `other`) are treated\n * as source-language messages. The component builds an ICU plural message,\n * looks it up via `t()` in the catalog, and interpolates the translated result.\n *\n * When no catalog translation exists, the component falls back to interpolating\n * the source-language ICU message directly via core's `interpolate`.\n *\n * Rich text is supported via JSX element props:\n * ```tsx\n * <Plural\n * value={count()}\n * zero={<>No <strong>items</strong> left</>}\n * one={<><em>1</em> item remaining</>}\n * other={<><strong>{count()}</strong> items remaining</>}\n * />\n * ```\n *\n * String props still work (backward compatible):\n * ```tsx\n * <Plural value={count()} zero=\"No items\" one=\"# item\" other=\"# items\" />\n * ```\n */\nexport const Plural: Component<PluralProps> = (props) => {\n const { t } = useI18n()\n\n /** Resolve a category prop value — handles string, accessor function, and JSX */\n function resolveProp(val: string | JSX.Element | undefined): string | JSX.Element | undefined {\n if (typeof val === 'function') return (val as () => string | JSX.Element)()\n return val\n }\n\n return (() => {\n // Resolve all category values (handles Solid accessors from createMemo)\n const resolvedValues: Partial<Record<PluralCategory, string | JSX.Element>> = {}\n for (const cat of PLURAL_CATEGORIES) {\n const resolved = resolveProp(props[cat])\n if (resolved !== undefined) {\n resolvedValues[cat] = resolved\n }\n }\n const { messages, components } = serializeRichForms(PLURAL_CATEGORIES, resolvedValues)\n const icuMessage = buildICUPluralMessage(\n {\n ...(messages['zero'] !== undefined && { zero: messages['zero'] }),\n ...(messages['one'] !== undefined && { one: messages['one'] }),\n ...(messages['two'] !== undefined && { two: messages['two'] }),\n ...(messages['few'] !== undefined && { few: messages['few'] }),\n ...(messages['many'] !== undefined && { many: messages['many'] }),\n other: messages['other'] ?? '',\n },\n props.offset,\n )\n\n const translated = t(\n {\n id: props.id ?? (props.context === undefined ? icuMessage : hashMessage(icuMessage, props.context)),\n message: icuMessage,\n ...(props.context !== undefined ? { context: props.context } : {}),\n ...(props.comment !== undefined ? { comment: props.comment } : {}),\n },\n { count: props.value },\n )\n\n return (<Dynamic component={props.tag ?? 'span'}>{components.length > 0 ? reconstruct(translated, components) : translated}</Dynamic>) as JSX.Element\n }) as unknown as JSX.Element\n}\n","import type { Component, JSX } from 'solid-js'\nimport { Dynamic } from 'solid-js/web'\nimport { hashMessage } from '@fluenti/core'\nimport { useI18n } from './use-i18n'\nimport { buildICUSelectMessage, normalizeSelectForms, reconstruct, serializeRichForms } from './rich-dom'\n\n/** Props for the `<Select>` component */\nexport interface SelectProps {\n /** The value to match against prop keys */\n value: string\n /** Override the auto-generated synthetic ICU message id */\n id?: string\n /** Message context used for identity and translator disambiguation */\n context?: string\n /** Translator-facing note preserved in extraction catalogs */\n comment?: string\n /** Fallback message when no key matches */\n other: string | JSX.Element\n /**\n * Named options map. Keys are match values, values are display strings or JSX.\n * Takes precedence over dynamic attrs when both are provided.\n *\n * @example `{ male: 'He', female: 'She' }`\n */\n options?: Record<string, string | JSX.Element>\n /** Wrapper element tag name (default: `span`) */\n tag?: string\n /** Additional key/message pairs for matching (attrs fallback) */\n [key: string]: unknown\n}\n\n/**\n * Render a message selected by matching `value` against prop keys.\n *\n * Options can be provided via the type-safe `options` prop (recommended)\n * or as direct attrs (convenience). When both are present, `options` takes\n * precedence.\n *\n * Rich text is supported via JSX element values in the `options` prop or\n * as direct JSX element props:\n * ```tsx\n * <Select\n * value={gender()}\n * options={{\n * male: <><strong>He</strong> liked this</>,\n * female: <><strong>She</strong> liked this</>,\n * }}\n * other={<><em>They</em> liked this</>}\n * />\n * ```\n *\n * Falls back to the `other` prop when no key matches.\n */\nexport const SelectComp: Component<SelectProps> = (props) => {\n const { t } = useI18n()\n\n const resolvedTag = () => props.tag ?? 'span'\n\n const content = () => {\n const forms: Record<string, unknown> = props.options !== undefined\n ? { ...props.options, other: props.other }\n : {\n ...Object.fromEntries(\n Object.entries(props).filter(([key]) => !['value', 'id', 'context', 'comment', 'options', 'other', 'tag'].includes(key)),\n ),\n other: props.other,\n }\n\n const orderedKeys = [...Object.keys(forms).filter(key => key !== 'other'), 'other'] as const\n const { messages, components } = serializeRichForms(orderedKeys, forms)\n const normalized = normalizeSelectForms(\n Object.fromEntries([...orderedKeys].map((key) => [key, messages[key] ?? ''])),\n )\n const translated = t(\n {\n id: props.id ?? (props.context === undefined\n ? buildICUSelectMessage(normalized.forms)\n : hashMessage(buildICUSelectMessage(normalized.forms), props.context)),\n message: buildICUSelectMessage(normalized.forms),\n ...(props.context !== undefined ? { context: props.context } : {}),\n ...(props.comment !== undefined ? { comment: props.comment } : {}),\n },\n { value: normalized.valueMap[props.value] ?? 'other' },\n )\n\n return components.length > 0 ? reconstruct(translated, components) : translated\n }\n\n return (<Dynamic component={resolvedTag()}>{content()}</Dynamic>) as JSX.Element\n}\n","import { useI18n } from '../use-i18n'\n\nexport interface DateTimeProps {\n /** Date value to format */\n value: Date | number\n /** Named format style */\n style?: string\n}\n\n/**\n * `<DateTime>` — date formatting component using Intl APIs.\n *\n * @example\n * ```tsx\n * <DateTime value={new Date()} style=\"long\" />\n * ```\n */\nexport function DateTime(props: DateTimeProps) {\n const { d } = useI18n()\n return <>{d(props.value, props.style)}</>\n}\n","import { useI18n } from '../use-i18n'\n\nexport interface NumberProps {\n /** Number value to format */\n value: number\n /** Named format style */\n style?: string\n}\n\n/**\n * `<NumberFormat>` — number formatting component using Intl APIs.\n *\n * @example\n * ```tsx\n * <NumberFormat value={1234.56} style=\"currency\" />\n * ```\n */\nexport function NumberFormat(props: NumberProps) {\n const { n } = useI18n()\n return <>{n(props.value, props.style)}</>\n}\n"],"mappings":"kJAcA,IAAM,EAAoB,OAAO,IAAI,wBAAwB,CAE7D,SAAS,GAAmD,CAC1D,IAAM,EAAW,WAA4C,GAC7D,OAAO,OAAO,GAAY,UAAY,EAClC,EACA,KAGN,SAAS,EACP,EACiC,CACjC,OAAO,OAAO,GAAW,UAAY,GAAmB,YAAa,EAChE,EAAwD,QACzD,EAmDN,SAAgB,EAAkB,EAAgD,CAChF,GAAM,CAAC,EAAQ,IAAA,EAAA,EAAA,cAAwC,EAAO,OAAO,CAC/D,CAAC,EAAW,IAAA,EAAA,EAAA,cAA6B,GAAM,CAC/C,EAAmB,IAAI,IAAY,CAAC,EAAO,OAAO,CAAC,CACnD,CAAC,EAAe,IAAA,EAAA,EAAA,cAAiC,IAAI,IAAI,EAAiB,CAAC,CAC3E,EAAqC,CAAE,GAAG,EAAO,SAAU,CAC3D,EAAa,EACb,EAAoB,EAAW,mBAC/B,EAAgD,WACjD,GAEL,SAAS,EACP,EACA,EACA,EACoB,CACpB,IAAM,EAAU,EAAS,GACzB,GAAI,CAAC,EACH,OAGF,IAAM,EAAM,EAAQ,GAChB,OAAQ,IAAA,GAYZ,OARI,OAAO,GAAQ,WACV,EAAI,EAAO,CAGhB,OAAO,GAAQ,UAAY,GAC7B,EAAA,EAAA,aAAuB,EAAK,E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AyC,EAAE,CAA/B,CAAEb,QAASQ,EAAMR,QAAS,CAC7D,CACD,CAAEH,MAAO2B,EAAWI,SAASpB,EAAMX,QAAU,QAC/C,CAAC,CAED,OAAO0B,EAAWM,OAAS,EAAInC,EAAYgC,EAAYH,EAAW,CAAGG,GAGvE,OAAA,EAAA,EAAA,iBAASrC,EAAAA,QAAO,CAAA,IAAC0C,WAAS,CAAA,OAAErB,GAAa,EAAA,IAAAsB,UAAA,CAAA,OAAGrB,GAAS,EAAA,CAAA,ECvEvD,SAAgB2B,EAASC,EAAsB,CAC7C,GAAM,CAAEC,KAAMP,GAAS,CACvB,OAAA,EAAA,EAAA,UAAUO,EAAED,EAAMJ,MAAOI,EAAMF,MAAM,CAAA,CCFvC,SAAgBS,EAAaC,EAAoB,CAC/C,GAAM,CAAEC,KAAMN,GAAS,CACvB,OAAA,EAAA,EAAA,UAAUM,EAAED,EAAMH,MAAOG,EAAMF,MAAM,CAAA"}
1
+ {"version":3,"file":"index.cjs","names":["createContext","ParentComponent","createFluentiContext","FluentiConfig","FluentiContext","I18nCtx","I18nProvider","props","ctx","_$createComponent","Provider","value","children","JSX","isNodeLike","value","Node","resolveValue","length","offsetIndices","extractMessage","message","components","visit","node","resolved","undefined","Array","isArray","child","String","nodeType","TEXT_NODE","textContent","DOCUMENT_FRAGMENT_NODE","from","childNodes","idx","inner","push","Element","cloneNode","appendChild","parent","entry","document","createTextNode","reconstruct","translated","combinedRe","result","lastIndex","match","RegExpExecArray","exec","index","slice","Number","isSelfClosing","template","clone","serializeRichForms","keys","T","forms","Partial","Record","messages","key","extracted","Object","entries","includes","Dynamic","children","resolveChildren","createMemo","Component","JSX","useI18n","extractMessage","extractDomMessage","reconstruct","reconstructDomMessage","RichComponent","Element","FluentiTransProps","id","context","comment","tag","message","components","Record","__message","__components","TextToken","type","value","TagToken","name","Token","parseTokens","input","tokens","pos","length","openIdx","indexOf","push","slice","selfCloseMatch","match","openMatch","tagName","contentStart","innerEnd","findClosingTag","innerContent","closingTag","startPos","openTag","closeTag","depth","nextOpen","nextClose","renderTokens","elements","map","token","Comp","undefined","_$createComponent","component","Trans","props","t","resolvedChildren","raw","msg","comps","translated","toArray","extracted","result","Array","isArray","Dynamic","Component","JSX","hashMessage","buildICUPluralMessage","PLURAL_CATEGORIES","PluralCategory","useI18n","reconstruct","serializeRichForms","FluentiPluralProps","value","id","context","comment","offset","zero","Element","one","two","few","many","other","tag","Plural","props","t","resolveProp","val","resolvedValues","Partial","Record","cat","resolved","undefined","messages","components","icuMessage","translated","message","count","result","length","_$createComponent","component","children","Component","JSX","Dynamic","hashMessage","buildICUSelectMessage","normalizeSelectForms","useI18n","reconstruct","serializeRichForms","FluentiSelectProps","value","id","context","comment","other","Element","options","Record","tag","key","SelectComp","props","t","content","forms","undefined","Object","fromEntries","entries","filter","includes","orderedKeys","keys","const","messages","components","normalized","map","translated","message","valueMap","length","_$createComponent","component","children","_$memo","useI18n","DateTimeProps","value","Date","style","DateTime","props","d","_$memo","useI18n","NumberProps","value","style","NumberFormat","props","n","_$memo"],"sources":["../src/context.ts","../src/provider.tsx","../src/use-i18n.ts","../src/compile-time-t.ts","../src/rich-dom.tsx","../src/trans.tsx","../src/plural.tsx","../src/select.tsx","../src/components/DateTime.tsx","../src/components/NumberFormat.tsx"],"sourcesContent":["import { createSignal, type Accessor } from 'solid-js'\nimport { createDiagnostics, formatDate, formatNumber } from '@fluenti/core'\nimport type { FluentiCoreConfig, Locale, LocalizedString, Messages, CompiledMessage, MessageDescriptor, DateFormatOptions, NumberFormatOptions, DiagnosticsConfig } from '@fluenti/core'\nimport { interpolate as coreInterpolate, buildICUMessage, resolveDescriptorId } from '@fluenti/core/internal'\n\n/** Chunk loader for lazy locale loading */\nexport type ChunkLoader = (\n locale: string,\n) => Promise<Record<string, CompiledMessage> | { default: Record<string, CompiledMessage> }>\n\ninterface SplitRuntimeModule {\n __switchLocale?: (locale: string) => Promise<void>\n __preloadLocale?: (locale: string) => Promise<void>\n}\n\nconst SPLIT_RUNTIME_KEY = Symbol.for('fluenti.runtime.solid.v1')\n\nfunction getSplitRuntimeModule(): SplitRuntimeModule | null {\n const runtime = (globalThis as Record<PropertyKey, unknown>)[SPLIT_RUNTIME_KEY]\n return typeof runtime === 'object' && runtime !== null\n ? runtime as SplitRuntimeModule\n : null\n}\n\nfunction resolveChunkMessages(\n loaded: Record<string, CompiledMessage> | { default: Record<string, CompiledMessage> },\n): Record<string, CompiledMessage> {\n return typeof loaded === 'object' && loaded !== null && 'default' in loaded\n ? (loaded as { default: Record<string, CompiledMessage> }).default\n : loaded\n}\n\n/** Extended config with lazy locale loading support */\nexport interface FluentiConfig extends FluentiCoreConfig {\n /** Async chunk loader for lazy locale loading */\n chunkLoader?: ChunkLoader\n /** Enable lazy locale loading through chunkLoader */\n lazyLocaleLoading?: boolean\n /** Locale-specific fallback chains */\n fallbackChain?: Record<string, Locale[]>\n /** Named date format styles */\n dateFormats?: DateFormatOptions\n /** Named number format styles */\n numberFormats?: NumberFormatOptions\n /** Runtime diagnostics configuration */\n diagnostics?: DiagnosticsConfig\n}\n\n/** Reactive i18n context holding locale signal and translation utilities */\nexport interface FluentiContext {\n /** Reactive accessor for the current locale */\n locale(): Locale\n /** Set the active locale (async when lazy locale loading is enabled) */\n setLocale(locale: Locale): Promise<void>\n /** Translate a message by id with optional interpolation values */\n t(id: string | MessageDescriptor, values?: Record<string, unknown>): LocalizedString\n /** Tagged template form: t`Hello ${name}` */\n t(strings: TemplateStringsArray, ...exprs: unknown[]): LocalizedString\n /** Merge additional messages into a locale catalog at runtime */\n loadMessages(locale: Locale, messages: Messages): void\n /** Return all locale codes that have loaded messages */\n getLocales(): Locale[]\n /** Format a date value for the current locale */\n d(value: Date | number, style?: string): LocalizedString\n /** Format a number value for the current locale */\n n(value: number, style?: string): LocalizedString\n /** Format an ICU message string directly (no catalog lookup) */\n format(message: string, values?: Record<string, unknown>): LocalizedString\n /** Whether a locale chunk is currently being loaded */\n isLoading: Accessor<boolean>\n /** Set of locales whose messages have been loaded */\n loadedLocales: Accessor<Set<string>>\n /** Preload a locale in the background without switching to it */\n preloadLocale(locale: string): void\n /** Check if a translation key exists for the given or current locale */\n te(key: string, loc?: string): boolean\n /** Get the raw compiled message for a key without interpolation */\n tm(key: string, loc?: string): CompiledMessage | undefined\n}\n\n/**\n * Create a reactive i18n context backed by Solid signals.\n *\n * The returned `t()` reads the internal `locale()` signal, so any\n * Solid computation that calls `t()` will re-run when the locale changes.\n */\nexport function createFluentiContext(config: FluentiCoreConfig | FluentiConfig): FluentiContext {\n const [locale, setLocaleSignal] = createSignal<Locale>(config.locale)\n const [isLoading, setIsLoading] = createSignal(false)\n const loadedLocalesSet = new Set<string>([config.locale])\n const [loadedLocales, setLoadedLocales] = createSignal(new Set(loadedLocalesSet))\n const messages: Record<string, Messages> = { ...config.messages }\n const i18nConfig = config as FluentiConfig\n const diagnostics = i18nConfig.diagnostics ? createDiagnostics(i18nConfig.diagnostics) : undefined\n const lazyLocaleLoading = i18nConfig.lazyLocaleLoading\n ?? (config as FluentiConfig & { splitting?: boolean }).splitting\n ?? false\n\n function lookupCatalog(\n id: string,\n loc: Locale,\n values?: Record<string, unknown>,\n ): LocalizedString | undefined {\n const catalog = messages[loc]\n if (!catalog) {\n return undefined\n }\n\n const msg = catalog[id]\n if (msg === undefined) {\n return undefined\n }\n\n if (typeof msg === 'function') {\n return msg(values) as LocalizedString\n }\n\n if (typeof msg === 'string' && values) {\n return coreInterpolate(msg, values, loc) as LocalizedString\n }\n\n return String(msg) as LocalizedString\n }\n\n function lookupWithFallbacks(\n id: string,\n loc: Locale,\n values?: Record<string, unknown>,\n ): LocalizedString | undefined {\n const localesToTry: Locale[] = [loc]\n const seen = new Set(localesToTry)\n\n if (config.fallbackLocale && !seen.has(config.fallbackLocale)) {\n localesToTry.push(config.fallbackLocale)\n seen.add(config.fallbackLocale)\n }\n\n const chainLocales = i18nConfig.fallbackChain?.[loc] ?? i18nConfig.fallbackChain?.['*']\n if (chainLocales) {\n for (const chainLocale of chainLocales) {\n if (!seen.has(chainLocale)) {\n localesToTry.push(chainLocale)\n seen.add(chainLocale)\n }\n }\n }\n\n for (const targetLocale of localesToTry) {\n const result = lookupCatalog(id, targetLocale, values)\n if (result !== undefined) {\n if (targetLocale !== loc) {\n diagnostics?.fallbackUsed(loc, targetLocale, id)\n }\n return result\n }\n }\n\n return undefined\n }\n\n function resolveMissing(\n id: string,\n loc: Locale,\n ): LocalizedString | undefined {\n if (!config.missing) {\n return undefined\n }\n\n const result = config.missing(loc, id)\n if (result !== undefined) {\n return result as LocalizedString\n }\n return undefined\n }\n\n function resolveMessage(\n id: string,\n loc: Locale,\n values?: Record<string, unknown>,\n ): LocalizedString {\n const catalogResult = lookupWithFallbacks(id, loc, values)\n if (catalogResult !== undefined) {\n return catalogResult\n }\n\n diagnostics?.missingKey(loc, id)\n\n const missingResult = resolveMissing(id, loc)\n if (missingResult !== undefined) {\n return missingResult\n }\n\n if (id.includes('{')) {\n return coreInterpolate(id, values, loc) as LocalizedString\n }\n\n return id as LocalizedString\n }\n\n function t(strings: TemplateStringsArray, ...exprs: unknown[]): LocalizedString\n function t(id: string | MessageDescriptor, values?: Record<string, unknown>): LocalizedString\n function t(idOrStrings: string | MessageDescriptor | TemplateStringsArray, ...rest: unknown[]): LocalizedString {\n // Tagged template form: t`Hello ${name}`\n if (Array.isArray(idOrStrings) && 'raw' in idOrStrings) {\n const strings = idOrStrings as TemplateStringsArray\n const icu = buildICUMessage(strings, rest)\n const values = Object.fromEntries(rest.map((v, i) => [String(i), v]))\n return t(icu, values)\n }\n\n const id = idOrStrings as string | MessageDescriptor\n const values = rest[0] as Record<string, unknown> | undefined\n const currentLocale = locale() // reactive dependency\n if (typeof id === 'object' && id !== null) {\n const messageId = resolveDescriptorId(id)\n if (messageId) {\n const catalogResult = lookupWithFallbacks(messageId, currentLocale, values)\n if (catalogResult !== undefined) {\n return catalogResult\n }\n\n const missingResult = resolveMissing(messageId, currentLocale)\n if (missingResult !== undefined) {\n return missingResult\n }\n }\n\n if (id.message !== undefined) {\n return coreInterpolate(id.message, values, currentLocale) as LocalizedString\n }\n\n return (messageId ?? '') as LocalizedString\n }\n\n return resolveMessage(id, currentLocale, values)\n }\n\n const loadMessages = (loc: Locale, msgs: Messages): void => {\n // Intentional mutation: messages record is locally scoped to this context closure\n messages[loc] = { ...messages[loc], ...msgs }\n loadedLocalesSet.add(loc)\n setLoadedLocales(new Set(loadedLocalesSet))\n }\n\n const setLocale = async (newLocale: Locale): Promise<void> => {\n if (!lazyLocaleLoading || !i18nConfig.chunkLoader) {\n setLocaleSignal(newLocale)\n return\n }\n\n const splitRuntime = getSplitRuntimeModule()\n\n if (loadedLocalesSet.has(newLocale)) {\n if (splitRuntime?.__switchLocale) {\n await splitRuntime.__switchLocale(newLocale)\n }\n setLocaleSignal(newLocale)\n return\n }\n\n setIsLoading(true)\n try {\n const loaded = resolveChunkMessages(await i18nConfig.chunkLoader(newLocale))\n // Intentional mutation: messages record is locally scoped to this context closure\n messages[newLocale] = { ...messages[newLocale], ...loaded }\n loadedLocalesSet.add(newLocale)\n setLoadedLocales(new Set(loadedLocalesSet))\n if (splitRuntime?.__switchLocale) {\n await splitRuntime.__switchLocale(newLocale)\n }\n setLocaleSignal(newLocale)\n } finally {\n setIsLoading(false)\n }\n }\n\n const preloadLocale = (loc: string): void => {\n if (!lazyLocaleLoading || loadedLocalesSet.has(loc) || !i18nConfig.chunkLoader) return\n const splitRuntime = getSplitRuntimeModule()\n i18nConfig.chunkLoader(loc).then(async (loaded) => {\n const resolved = resolveChunkMessages(loaded)\n // Intentional mutation: messages record is locally scoped to this context closure\n messages[loc] = { ...messages[loc], ...resolved }\n loadedLocalesSet.add(loc)\n setLoadedLocales(new Set(loadedLocalesSet))\n if (splitRuntime?.__preloadLocale) {\n await splitRuntime.__preloadLocale(loc)\n }\n }).catch((e: unknown) => {\n console.warn('[fluenti] preload failed:', loc, e)\n })\n }\n\n const getLocales = (): Locale[] => Object.keys(messages)\n\n const d = (value: Date | number, style?: string): LocalizedString =>\n formatDate(value, locale(), style, i18nConfig.dateFormats) as LocalizedString\n\n const n = (value: number, style?: string): LocalizedString =>\n formatNumber(value, locale(), style, i18nConfig.numberFormats) as LocalizedString\n\n const format = (message: string, values?: Record<string, unknown>): LocalizedString => {\n return coreInterpolate(message, values, locale()) as LocalizedString\n }\n\n const te = (key: string, loc?: string): boolean => {\n const msgs = messages[loc ?? locale()]\n return msgs !== undefined && key in msgs\n }\n\n const tm = (key: string, loc?: string): CompiledMessage | undefined => {\n const msgs = messages[loc ?? locale()]\n return msgs ? msgs[key] : undefined\n }\n\n return { locale, setLocale, t, loadMessages, getLocales, d, n, format, isLoading, loadedLocales, preloadLocale, te, tm }\n}\n","import { createContext } from 'solid-js'\nimport type { ParentComponent } from 'solid-js'\nimport { createFluentiContext } from './context'\nimport type { FluentiConfig, FluentiContext } from './context'\n\n/** Solid context object for i18n — used internally by useI18n() */\nexport const I18nCtx = createContext<FluentiContext>()\n\n/**\n * Provide i18n context to the component tree.\n *\n */\nexport const I18nProvider: ParentComponent<FluentiConfig> = (props) => {\n const ctx = createFluentiContext(props)\n return <I18nCtx.Provider value={ctx}>{props.children}</I18nCtx.Provider>\n}\n","import { useContext } from 'solid-js'\nimport { I18nCtx } from './provider'\nimport type { FluentiContext } from './context'\n\n/**\n * Access the i18n context from the nearest `<I18nProvider>`.\n *\n * Throws if no provider is found in the component tree.\n */\nexport function useI18n(): FluentiContext {\n const ctx = useContext(I18nCtx)\n if (ctx) {\n return ctx\n }\n\n throw new Error(\n 'useI18n() must be used inside an <I18nProvider>.',\n )\n}\n","import type { CompileTimeT } from '@fluenti/core'\n\nexport const t: CompileTimeT = ((..._args: unknown[]) => {\n throw new Error(\n \"[fluenti] `t` imported from '@fluenti/solid' is a compile-time API. \" +\n 'Use it only with the Fluenti build transform inside a component or custom hook. ' +\n 'For runtime lookups, use useI18n().t(...).',\n )\n}) as CompileTimeT\n","import type { JSX } from 'solid-js'\n\nfunction isNodeLike(value: unknown): value is Node {\n return typeof Node !== 'undefined' && value instanceof Node\n}\n\nfunction resolveValue(value: unknown): unknown {\n if (typeof value === 'function' && !(value as { length?: number }).length) {\n return (value as () => unknown)()\n }\n return value\n}\n\nimport { offsetIndices } from '@fluenti/core/internal'\n\nexport function extractMessage(value: unknown): {\n message: string\n components: Node[]\n} {\n const components: Node[] = []\n let message = ''\n\n function visit(node: unknown): void {\n const resolved = resolveValue(node)\n if (resolved === null || resolved === undefined || typeof resolved === 'boolean') return\n if (Array.isArray(resolved)) {\n for (const child of resolved) visit(child)\n return\n }\n if (typeof resolved === 'string' || typeof resolved === 'number') {\n message += String(resolved)\n return\n }\n if (!isNodeLike(resolved)) return\n if (resolved.nodeType === Node.TEXT_NODE) {\n message += resolved.textContent ?? ''\n return\n }\n if (resolved.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n visit(Array.from(resolved.childNodes))\n return\n }\n\n const idx = components.length\n const inner = extractMessage(Array.from(resolved.childNodes))\n components.push((resolved as Element).cloneNode(false))\n components.push(...inner.components)\n if (inner.message === '' && inner.components.length === 0) {\n message += `<${idx}/>`\n } else {\n message += `<${idx}>${offsetIndices(inner.message, idx + 1)}</${idx}>`\n }\n }\n\n visit(value)\n return { message, components }\n}\n\nfunction appendChild(parent: Node, child: unknown): void {\n const resolved = resolveValue(child)\n if (resolved === null || resolved === undefined || typeof resolved === 'boolean') return\n if (Array.isArray(resolved)) {\n for (const entry of resolved) appendChild(parent, entry)\n return\n }\n if (typeof resolved === 'string' || typeof resolved === 'number') {\n parent.appendChild(document.createTextNode(String(resolved)))\n return\n }\n if (isNodeLike(resolved)) {\n parent.appendChild(resolved)\n }\n}\n\nexport function reconstruct(\n translated: string,\n components: Node[],\n): JSX.Element {\n const combinedRe = /<(\\d+)(?:\\/>|(>)([\\s\\S]*?)<\\/\\1>)/g\n const result: unknown[] = []\n let lastIndex = 0\n let match: RegExpExecArray | null\n\n combinedRe.lastIndex = 0\n match = combinedRe.exec(translated)\n while (match !== null) {\n if (match.index > lastIndex) {\n result.push(translated.slice(lastIndex, match.index))\n }\n\n const idx = Number(match[1])\n const isSelfClosing = match[2] === undefined\n const template = components[idx]\n\n if (isSelfClosing) {\n if (template) {\n result.push(template.cloneNode(false))\n }\n } else {\n const inner = reconstruct(match[2] !== undefined ? match[3]! : '', components)\n if (template) {\n const clone = template.cloneNode(false)\n appendChild(clone, inner)\n result.push(clone)\n } else {\n result.push(match[3] ?? '')\n }\n }\n\n lastIndex = combinedRe.lastIndex\n match = combinedRe.exec(translated)\n }\n\n if (lastIndex < translated.length) {\n result.push(translated.slice(lastIndex))\n }\n\n return (result.length <= 1 ? result[0] ?? '' : result) as JSX.Element\n}\n\nexport function serializeRichForms<T extends string>(\n keys: readonly T[],\n forms: Partial<Record<T, unknown>> & Record<string, unknown>,\n): {\n messages: Record<string, string>\n components: Node[]\n} {\n const messages: Record<string, string> = {}\n const components: Node[] = []\n\n for (const key of keys) {\n const value = forms[key]\n if (value === undefined) continue\n const extracted = extractMessage(value)\n messages[key] = offsetIndices(extracted.message, components.length)\n components.push(...extracted.components)\n }\n\n for (const [key, value] of Object.entries(forms)) {\n if (keys.includes(key as T) || value === undefined) continue\n const extracted = extractMessage(value)\n messages[key] = offsetIndices(extracted.message, components.length)\n components.push(...extracted.components)\n }\n\n return { messages, components }\n}\n\n","import { Dynamic } from 'solid-js/web'\nimport { children as resolveChildren, createMemo } from 'solid-js'\nimport type { Component, JSX } from 'solid-js'\nimport { useI18n } from './use-i18n'\nimport { extractMessage as extractDomMessage, reconstruct as reconstructDomMessage } from './rich-dom'\n\n/** A Solid component that accepts children */\nexport type RichComponent = Component<{ children?: JSX.Element }>\n\n/** Props for the `<Trans>` component */\nexport interface FluentiTransProps {\n /** Override auto-generated hash ID */\n id?: string\n /** Message context used for identity and translator disambiguation */\n context?: string\n /** Translator-facing note preserved in extraction catalogs */\n comment?: string\n /** Wrapper element tag name. Defaults to no wrapper (Fragment). */\n tag?: string\n /** Children — the content to translate (legacy API) */\n children?: JSX.Element\n /** Translated message string with XML-like tags (e.g. `<bold>text</bold>`) */\n message?: string\n /** Map of tag names to Solid components */\n components?: Record<string, RichComponent>\n /** @internal Pre-computed message from build plugin */\n __message?: string\n /** @internal Pre-computed component map from build plugin */\n __components?: Record<string, RichComponent>\n}\n\n/**\n * A token from parsing the message string.\n * Either a plain text segment or a tag with inner content.\n */\ninterface TextToken {\n readonly type: 'text'\n readonly value: string\n}\n\ninterface TagToken {\n readonly type: 'tag'\n readonly name: string\n readonly children: readonly Token[]\n}\n\ntype Token = TextToken | TagToken\n\n/**\n * Parse a message string containing XML-like tags into a token tree.\n *\n * Supports:\n * - Named tags: `<bold>content</bold>`\n * - Self-closing tags: `<br/>`\n * - Nested tags: `<bold>hello <italic>world</italic></bold>`\n */\nfunction parseTokens(input: string): readonly Token[] {\n const tokens: Token[] = []\n let pos = 0\n\n while (pos < input.length) {\n const openIdx = input.indexOf('<', pos)\n\n if (openIdx === -1) {\n // No more tags — rest is plain text\n tokens.push({ type: 'text', value: input.slice(pos) })\n break\n }\n\n // Push any text before this tag\n if (openIdx > pos) {\n tokens.push({ type: 'text', value: input.slice(pos, openIdx) })\n }\n\n // Check for self-closing tag: <tagName/>\n const selfCloseMatch = input.slice(openIdx).match(/^<(\\w+)\\s*\\/>/)\n if (selfCloseMatch) {\n tokens.push({ type: 'tag', name: selfCloseMatch[1]!, children: [] })\n pos = openIdx + selfCloseMatch[0].length\n continue\n }\n\n // Check for opening tag: <tagName>\n const openMatch = input.slice(openIdx).match(/^<(\\w+)>/)\n if (!openMatch) {\n // Not a valid tag — treat '<' as text\n tokens.push({ type: 'text', value: '<' })\n pos = openIdx + 1\n continue\n }\n\n const tagName = openMatch[1]!\n const contentStart = openIdx + openMatch[0].length\n\n // Find the matching closing tag, respecting nesting\n const innerEnd = findClosingTag(input, tagName, contentStart)\n if (innerEnd === -1) {\n // No closing tag found — treat as plain text\n tokens.push({ type: 'text', value: input.slice(openIdx, contentStart) })\n pos = contentStart\n continue\n }\n\n const innerContent = input.slice(contentStart, innerEnd)\n const closingTag = `</${tagName}>`\n tokens.push({\n type: 'tag',\n name: tagName,\n children: parseTokens(innerContent),\n })\n pos = innerEnd + closingTag.length\n }\n\n return tokens\n}\n\n/**\n * Find the position of the matching closing tag, accounting for nesting\n * of the same tag name.\n *\n * Returns the index of the start of the closing tag, or -1 if not found.\n */\nfunction findClosingTag(input: string, tagName: string, startPos: number): number {\n const openTag = `<${tagName}>`\n const closeTag = `</${tagName}>`\n let depth = 1\n let pos = startPos\n\n while (pos < input.length && depth > 0) {\n const nextOpen = input.indexOf(openTag, pos)\n const nextClose = input.indexOf(closeTag, pos)\n\n if (nextClose === -1) return -1\n\n if (nextOpen !== -1 && nextOpen < nextClose) {\n depth++\n pos = nextOpen + openTag.length\n } else {\n depth--\n if (depth === 0) return nextClose\n pos = nextClose + closeTag.length\n }\n }\n\n return -1\n}\n\n/**\n * Render a token tree into Solid JSX elements using the components map.\n */\nfunction renderTokens(\n tokens: readonly Token[],\n components: Record<string, RichComponent>,\n): JSX.Element {\n const elements = tokens.map((token): JSX.Element => {\n if (token.type === 'text') {\n return token.value as unknown as JSX.Element\n }\n\n const Comp = components[token.name]\n if (!Comp) {\n // Unknown component — render inner content as plain text\n return renderTokens(token.children, components)\n }\n\n const innerContent = token.children.length > 0\n ? renderTokens(token.children, components)\n : undefined\n\n return (<Dynamic component={Comp}>{innerContent}</Dynamic>) as JSX.Element\n })\n\n if (elements.length === 1) return elements[0]!\n return (<>{elements}</>) as JSX.Element\n}\n\n/**\n * Render translated content with inline components.\n *\n * Supports two APIs:\n *\n * 1. **message + components** (recommended for rich text):\n * ```tsx\n * <Trans\n * message={t`Welcome to <bold>Fluenti</bold>!`}\n * components={{ bold: (props) => <strong>{props.children}</strong> }}\n * />\n * ```\n *\n * 2. **children** (legacy / simple passthrough):\n * ```tsx\n * <Trans>Click <a href=\"/next\">here</a> to continue</Trans>\n * ```\n */\nexport const Trans: Component<FluentiTransProps> = (props) => {\n const { t } = useI18n()\n const resolvedChildren = resolveChildren(() => props.children)\n // message + components API (including build-time __message/__components)\n // Note: the vite-plugin tagged-template transform wraps Solid expressions in\n // createMemo(), so props.message may be a memo accessor (function) instead of\n // a string. We unwrap it here to handle both cases.\n const message = createMemo(() => {\n const raw = props.__message ?? props.message\n return typeof raw === 'function' ? (raw as () => string)() : raw\n })\n const components = createMemo(() => props.__components ?? props.components)\n\n return (() => {\n const msg = message()\n const comps = components()\n\n if (msg !== undefined && comps) {\n const translated = t({\n ...(props.id !== undefined ? { id: props.id } : {}),\n message: msg,\n ...(props.context !== undefined ? { context: props.context } : {}),\n ...(props.comment !== undefined ? { comment: props.comment } : {}),\n })\n const tokens = parseTokens(translated)\n return renderTokens(tokens, comps)\n }\n\n // Fallback: children-only API with runtime extraction/reconstruction\n const children = resolvedChildren.toArray()\n if (children.length === 0) return null\n const extracted = extractDomMessage(children)\n const translated = t({\n ...(props.id !== undefined ? { id: props.id } : {}),\n message: extracted.message,\n ...(props.context !== undefined ? { context: props.context } : {}),\n ...(props.comment !== undefined ? { comment: props.comment } : {}),\n })\n const result = extracted.components.length > 0\n ? reconstructDomMessage(translated, extracted.components)\n : translated\n\n if (Array.isArray(result) && result.length > 1) {\n if (props.tag) {\n return (<Dynamic component={props.tag}>{result}</Dynamic>) as JSX.Element\n }\n return (<>{result}</>) as JSX.Element\n }\n\n return result as JSX.Element\n }) as unknown as JSX.Element\n}\n","import { Dynamic } from 'solid-js/web'\nimport type { Component, JSX } from 'solid-js'\nimport { hashMessage, buildICUPluralMessage, PLURAL_CATEGORIES, type PluralCategory } from '@fluenti/core/internal'\nimport { useI18n } from './use-i18n'\nimport { reconstruct, serializeRichForms } from './rich-dom'\n\n/** Props for the `<Plural>` component */\nexport interface FluentiPluralProps {\n /** The numeric value to pluralise */\n value: number\n /** Override the auto-generated synthetic ICU message id */\n id?: string\n /** Message context used for identity and translator disambiguation */\n context?: string\n /** Translator-facing note preserved in extraction catalogs */\n comment?: string\n /** Offset from value before selecting form */\n offset?: number\n /** Message for the \"zero\" plural category */\n zero?: string | JSX.Element\n /** Message for the \"one\" plural category */\n one?: string | JSX.Element\n /** Message for the \"two\" plural category */\n two?: string | JSX.Element\n /** Message for the \"few\" plural category */\n few?: string | JSX.Element\n /** Message for the \"many\" plural category */\n many?: string | JSX.Element\n /** Fallback message when no category-specific prop matches */\n other: string | JSX.Element\n /** Wrapper element tag name. Defaults to no wrapper (Fragment). */\n tag?: string\n}\n\n/**\n * `<Plural>` component — shorthand for ICU plural patterns.\n *\n * Plural form props (`zero`, `one`, `two`, `few`, `many`, `other`) are treated\n * as source-language messages. The component builds an ICU plural message,\n * looks it up via `t()` in the catalog, and interpolates the translated result.\n *\n * When no catalog translation exists, the component falls back to interpolating\n * the source-language ICU message directly via core's `interpolate`.\n *\n * Rich text is supported via JSX element props:\n * ```tsx\n * <Plural\n * value={count()}\n * zero={<>No <strong>items</strong> left</>}\n * one={<><em>1</em> item remaining</>}\n * other={<><strong>{count()}</strong> items remaining</>}\n * />\n * ```\n *\n * String props still work (backward compatible):\n * ```tsx\n * <Plural value={count()} zero=\"No items\" one=\"# item\" other=\"# items\" />\n * ```\n */\nexport const Plural: Component<FluentiPluralProps> = (props) => {\n const { t } = useI18n()\n\n /** Resolve a category prop value — handles string, accessor function, and JSX */\n function resolveProp(val: string | JSX.Element | undefined): string | JSX.Element | undefined {\n if (typeof val === 'function') return (val as () => string | JSX.Element)()\n return val\n }\n\n return (() => {\n // Resolve all category values (handles Solid accessors from createMemo)\n const resolvedValues: Partial<Record<PluralCategory, string | JSX.Element>> = {}\n for (const cat of PLURAL_CATEGORIES) {\n const resolved = resolveProp(props[cat])\n if (resolved !== undefined) {\n resolvedValues[cat] = resolved\n }\n }\n const { messages, components } = serializeRichForms(PLURAL_CATEGORIES, resolvedValues)\n const icuMessage = buildICUPluralMessage(\n {\n ...(messages['zero'] !== undefined && { zero: messages['zero'] }),\n ...(messages['one'] !== undefined && { one: messages['one'] }),\n ...(messages['two'] !== undefined && { two: messages['two'] }),\n ...(messages['few'] !== undefined && { few: messages['few'] }),\n ...(messages['many'] !== undefined && { many: messages['many'] }),\n other: messages['other'] ?? '',\n },\n props.offset,\n )\n\n const translated = t(\n {\n id: props.id ?? (props.context === undefined ? icuMessage : hashMessage(icuMessage, props.context)),\n message: icuMessage,\n ...(props.context !== undefined ? { context: props.context } : {}),\n ...(props.comment !== undefined ? { comment: props.comment } : {}),\n },\n { count: props.value },\n )\n\n const result = components.length > 0 ? reconstruct(translated, components) : translated\n if (props.tag) {\n return (<Dynamic component={props.tag}>{result}</Dynamic>) as JSX.Element\n }\n return (<>{result}</>) as JSX.Element\n }) as unknown as JSX.Element\n}\n","import type { Component, JSX } from 'solid-js'\nimport { Dynamic } from 'solid-js/web'\nimport { hashMessage, buildICUSelectMessage, normalizeSelectForms } from '@fluenti/core/internal'\nimport { useI18n } from './use-i18n'\nimport { reconstruct, serializeRichForms } from './rich-dom'\n\n/** Props for the `<Select>` component */\nexport interface FluentiSelectProps {\n /** The value to match against prop keys */\n value: string\n /** Override the auto-generated synthetic ICU message id */\n id?: string\n /** Message context used for identity and translator disambiguation */\n context?: string\n /** Translator-facing note preserved in extraction catalogs */\n comment?: string\n /** Fallback message when no key matches */\n other: string | JSX.Element\n /**\n * Named options map. Keys are match values, values are display strings or JSX.\n * Takes precedence over dynamic attrs when both are provided.\n *\n * @example `{ male: 'He', female: 'She' }`\n */\n options?: Record<string, string | JSX.Element>\n /** Wrapper element tag name. Defaults to no wrapper (Fragment). */\n tag?: string\n /** Additional key/message pairs for matching (attrs fallback) */\n [key: string]: unknown\n}\n\n/**\n * Render a message selected by matching `value` against prop keys.\n *\n * Options can be provided via the type-safe `options` prop (recommended)\n * or as direct attrs (convenience). When both are present, `options` takes\n * precedence.\n *\n * Rich text is supported via JSX element values in the `options` prop or\n * as direct JSX element props:\n * ```tsx\n * <Select\n * value={gender()}\n * options={{\n * male: <><strong>He</strong> liked this</>,\n * female: <><strong>She</strong> liked this</>,\n * }}\n * other={<><em>They</em> liked this</>}\n * />\n * ```\n *\n * Falls back to the `other` prop when no key matches.\n */\nexport const SelectComp: Component<FluentiSelectProps> = (props) => {\n const { t } = useI18n()\n\n const content = () => {\n const forms: Record<string, unknown> = props.options !== undefined\n ? { ...props.options, other: props.other }\n : {\n ...Object.fromEntries(\n Object.entries(props).filter(([key]) => !['value', 'id', 'context', 'comment', 'options', 'other', 'tag'].includes(key)),\n ),\n other: props.other,\n }\n\n const orderedKeys = [...Object.keys(forms).filter(key => key !== 'other'), 'other'] as const\n const { messages, components } = serializeRichForms(orderedKeys, forms)\n const normalized = normalizeSelectForms(\n Object.fromEntries([...orderedKeys].map((key) => [key, messages[key] ?? ''])),\n )\n const translated = t(\n {\n id: props.id ?? (props.context === undefined\n ? buildICUSelectMessage(normalized.forms)\n : hashMessage(buildICUSelectMessage(normalized.forms), props.context)),\n message: buildICUSelectMessage(normalized.forms),\n ...(props.context !== undefined ? { context: props.context } : {}),\n ...(props.comment !== undefined ? { comment: props.comment } : {}),\n },\n { value: normalized.valueMap[props.value] ?? 'other' },\n )\n\n return components.length > 0 ? reconstruct(translated, components) : translated\n }\n\n return (() => {\n if (props.tag) {\n return (<Dynamic component={props.tag}>{content()}</Dynamic>) as JSX.Element\n }\n return (<>{content()}</>) as JSX.Element\n }) as unknown as JSX.Element\n}\n","import { useI18n } from '../use-i18n'\n\nexport interface DateTimeProps {\n /** Date value to format */\n value: Date | number\n /** Named format style */\n style?: string\n}\n\n/**\n * `<DateTime>` — date formatting component using Intl APIs.\n *\n * @example\n * ```tsx\n * <DateTime value={new Date()} style=\"long\" />\n * ```\n */\nexport function DateTime(props: DateTimeProps) {\n const { d } = useI18n()\n return <>{d(props.value, props.style)}</>\n}\n","import { useI18n } from '../use-i18n'\n\nexport interface NumberProps {\n /** Number value to format */\n value: number\n /** Named format style */\n style?: string\n}\n\n/**\n * `<NumberFormat>` — number formatting component using Intl APIs.\n *\n * @example\n * ```tsx\n * <NumberFormat value={1234.56} style=\"currency\" />\n * ```\n */\nexport function NumberFormat(props: NumberProps) {\n const { n } = useI18n()\n return <>{n(props.value, props.style)}</>\n}\n"],"mappings":"sLAeA,IAAM,EAAoB,OAAO,IAAI,2BAA2B,CAEhE,SAAS,GAAmD,CAC1D,IAAM,EAAW,WAA4C,GAC7D,OAAO,OAAO,GAAY,UAAY,EAClC,EACA,KAGN,SAAS,EACP,EACiC,CACjC,OAAO,OAAO,GAAW,UAAY,GAAmB,YAAa,EAChE,EAAwD,QACzD,EAyDN,SAAgB,EAAqB,EAA2D,CAC9F,GAAM,CAAC,EAAQ,IAAA,EAAA,EAAA,cAAwC,EAAO,OAAO,CAC/D,CAAC,EAAW,IAAA,EAAA,EAAA,cAA6B,GAAM,CAC/C,EAAmB,IAAI,IAAY,CAAC,EAAO,OAAO,CAAC,CACnD,CAAC,EAAe,IAAA,EAAA,EAAA,cAAiC,IAAI,IAAI,EAAiB,CAAC,CAC3E,EAAqC,CAAE,GAAG,EAAO,SAAU,CAC3D,EAAa,EACb,EAAc,EAAW,aAAA,EAAA,EAAA,mBAAgC,EAAW,YAAY,CAAG,IAAA,GACnF,EAAoB,EAAW,mBAC/B,EAAmD,WACpD,GAEL,SAAS,EACP,EACA,EACA,EAC6B,CAC7B,IAAM,EAAU,EAAS,GACzB,GAAI,CAAC,EACH,OAGF,IAAM,EAAM,EAAQ,GAChB,OAAQ,IAAA,GAYZ,OARI,OAAO,GAAQ,WACV,EAAI,EAAO,CAGhB,OAAO,GAAQ,UAAY,GAC7B,EAAA,EAAA,aAAuB,EAAK,EAAQ,EAAI,CAGnC,OAAO,EAAI,CAGpB,SAAS,EACP,EACA,EACA,EAC6B,CAC7B,IAAM,EAAyB,CAAC,EAAI,CAC9B,EAAO,IAAI,IAAI,EAAa,CAE9B,EAAO,gBAAkB,CAAC,EAAK,IAAI,EAAO,eAAe,GAC3D,EAAa,KAAK,EAAO,eAAe,CACxC,EAAK,IAAI,EAAO,eAAe,EAGjC,IAAM,EAAe,EAAW,gB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A+BH,EAAWZ,MAAM,CAChD,GAAIH,EAAMT,UAAYa,IAAAA,GAAyC,EAAE,CAA/B,CAAEb,QAASS,EAAMT,QAAS,CAC5D,GAAIS,EAAMR,UAAYY,IAAAA,GAAyC,EAAE,CAA/B,CAAEZ,QAASQ,EAAMR,QAAS,CAC7D,CACD,CAAEH,MAAO0B,EAAWI,SAASnB,EAAMX,QAAU,QAC/C,CAAC,CAED,OAAOyB,EAAWM,OAAS,EAAIlC,EAAY+B,EAAYH,EAAW,CAAGG,GAGvE,WACMjB,EAAMH,KACR,EAAA,EAAA,iBAAShB,EAAAA,QAAO,CAAA,IAACyC,WAAS,CAAA,OAAEtB,EAAMH,KAAG,IAAA0B,UAAA,CAAA,OAAGrB,GAAS,EAAA,CAAA,EAEnD,EAAA,EAAA,MAAWA,EAAO,GCzEtB,SAAgB4B,EAASC,EAAsB,CAC7C,GAAM,CAAEC,KAAMP,GAAS,CACvB,OAAA,EAAA,EAAA,UAAUO,EAAED,EAAMJ,MAAOI,EAAMF,MAAM,CAAA,CCFvC,SAAgBS,EAAaC,EAAoB,CAC/C,GAAM,CAAEC,KAAMN,GAAS,CACvB,OAAA,EAAA,EAAA,UAAUM,EAAED,EAAMH,MAAOG,EAAMF,MAAM,CAAA"}
package/dist/index.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- export { createI18nContext, createI18n } from './context';
2
- export type { I18nContext, I18nConfig } from './context';
3
- export { I18nProvider, I18nCtx } from './provider';
1
+ export { createFluentiContext } from './context';
2
+ export type { FluentiContext, FluentiConfig } from './context';
3
+ export { I18nProvider } from './provider';
4
4
  export { useI18n } from './use-i18n';
5
5
  export { t } from './compile-time-t';
6
6
  export { Trans } from './trans';
7
- export type { TransProps } from './trans';
7
+ export type { FluentiTransProps } from './trans';
8
8
  export { Plural } from './plural';
9
- export type { PluralProps } from './plural';
9
+ export type { FluentiPluralProps } from './plural';
10
10
  export { SelectComp as Select } from './select';
11
- export type { SelectProps } from './select';
11
+ export type { FluentiSelectProps } from './select';
12
12
  export { msg } from './msg';
13
13
  export { DateTime } from './components/DateTime';
14
14
  export { NumberFormat } from './components/NumberFormat';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AACzD,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,kBAAkB,CAAA;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,UAAU,IAAI,MAAM,EAAE,MAAM,UAAU,CAAA;AAC/C,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAChD,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,kBAAkB,CAAA;AAC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