@fluenti/react 0.5.0 → 0.6.1

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 (102) hide show
  1. package/README.md +4 -0
  2. package/dist/Number-DfzWPfIE.js +142 -0
  3. package/dist/Number-DfzWPfIE.js.map +1 -0
  4. package/dist/Number-JCugssFE.cjs +2 -0
  5. package/dist/Number-JCugssFE.cjs.map +1 -0
  6. package/dist/components-entry.cjs +1 -1
  7. package/dist/components-entry.cjs.map +1 -1
  8. package/dist/components-entry.js +63 -84
  9. package/dist/components-entry.js.map +1 -1
  10. package/dist/icu-rich-BlDjwT5Z.cjs +2 -0
  11. package/dist/icu-rich-BlDjwT5Z.cjs.map +1 -0
  12. package/dist/{icu-rich-ChVWsA7C.js → icu-rich-C6B9ns4t.js} +7 -4
  13. package/dist/icu-rich-C6B9ns4t.js.map +1 -0
  14. package/dist/index.cjs +1 -1
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.js +77 -77
  17. package/dist/react/src/compile-time-t.d.ts.map +1 -0
  18. package/dist/react/src/components/DateTime.d.ts.map +1 -0
  19. package/dist/react/src/components/Number.d.ts.map +1 -0
  20. package/dist/react/src/components/Plural.d.ts.map +1 -0
  21. package/dist/react/src/components/Select.d.ts.map +1 -0
  22. package/dist/{components → react/src/components}/Trans.d.ts +1 -1
  23. package/dist/react/src/components/Trans.d.ts.map +1 -0
  24. package/dist/react/src/components/compiled.d.ts +46 -0
  25. package/dist/react/src/components/compiled.d.ts.map +1 -0
  26. package/dist/{components → react/src/components}/icu-rich.d.ts +1 -1
  27. package/dist/react/src/components/icu-rich.d.ts.map +1 -0
  28. package/dist/react/src/components/plain.d.ts +9 -0
  29. package/dist/react/src/components/plain.d.ts.map +1 -0
  30. package/dist/{components → react/src/components}/plural-core.d.ts +2 -2
  31. package/dist/react/src/components/plural-core.d.ts.map +1 -0
  32. package/dist/{components → react/src/components}/trans-core.d.ts +1 -1
  33. package/dist/react/src/components/trans-core.d.ts.map +1 -0
  34. package/dist/{components-entry.d.ts → react/src/components-entry.d.ts} +1 -1
  35. package/dist/react/src/components-entry.d.ts.map +1 -0
  36. package/dist/react/src/context.d.ts.map +1 -0
  37. package/dist/react/src/create-fluenti.d.ts.map +1 -0
  38. package/dist/react/src/global-registry.d.ts.map +1 -0
  39. package/dist/react/src/hooks/__useI18n.d.ts.map +1 -0
  40. package/dist/react/src/hooks/useI18n.d.ts.map +1 -0
  41. package/dist/{index.d.ts → react/src/index.d.ts} +7 -2
  42. package/dist/react/src/index.d.ts.map +1 -0
  43. package/dist/react/src/msg.d.ts.map +1 -0
  44. package/dist/react/src/provider.d.ts.map +1 -0
  45. package/dist/react/src/react-runtime.d.ts.map +1 -0
  46. package/dist/{server.d.ts → react/src/server.d.ts} +2 -2
  47. package/dist/react/src/server.d.ts.map +1 -0
  48. package/dist/{types.d.ts → react/src/types.d.ts} +1 -1
  49. package/dist/react/src/types.d.ts.map +1 -0
  50. package/dist/react/src/vite-plugin.d.ts.map +1 -0
  51. package/dist/server.cjs +1 -1
  52. package/dist/server.cjs.map +1 -1
  53. package/dist/server.js +2 -2
  54. package/dist/server.js.map +1 -1
  55. package/dist/vite-plugin.cjs +1 -1
  56. package/dist/vite-plugin.cjs.map +1 -1
  57. package/dist/vite-plugin.js +1 -1
  58. package/dist/vite-plugin.js.map +1 -1
  59. package/package.json +18 -18
  60. package/dist/compile-time-t.d.ts.map +0 -1
  61. package/dist/components/DateTime.d.ts.map +0 -1
  62. package/dist/components/Number.d.ts.map +0 -1
  63. package/dist/components/Plural.d.ts.map +0 -1
  64. package/dist/components/Select.d.ts.map +0 -1
  65. package/dist/components/Trans.d.ts.map +0 -1
  66. package/dist/components/icu-rich.d.ts.map +0 -1
  67. package/dist/components/plural-core.d.ts.map +0 -1
  68. package/dist/components/trans-core.d.ts.map +0 -1
  69. package/dist/components-entry.d.ts.map +0 -1
  70. package/dist/context-DVbvrSE8.cjs +0 -2
  71. package/dist/context-DVbvrSE8.cjs.map +0 -1
  72. package/dist/context-DVudCV1o.js +0 -7
  73. package/dist/context-DVudCV1o.js.map +0 -1
  74. package/dist/context.d.ts.map +0 -1
  75. package/dist/create-fluenti.d.ts.map +0 -1
  76. package/dist/global-registry.d.ts.map +0 -1
  77. package/dist/hooks/__useI18n.d.ts.map +0 -1
  78. package/dist/hooks/useI18n.d.ts.map +0 -1
  79. package/dist/icu-rich-ChVWsA7C.js.map +0 -1
  80. package/dist/icu-rich-CotMVC_x.cjs +0 -2
  81. package/dist/icu-rich-CotMVC_x.cjs.map +0 -1
  82. package/dist/index.d.ts.map +0 -1
  83. package/dist/msg.d.ts.map +0 -1
  84. package/dist/provider.d.ts.map +0 -1
  85. package/dist/react-runtime.d.ts.map +0 -1
  86. package/dist/server.d.ts.map +0 -1
  87. package/dist/types.d.ts.map +0 -1
  88. package/dist/vite-plugin.d.ts.map +0 -1
  89. /package/dist/{compile-time-t.d.ts → react/src/compile-time-t.d.ts} +0 -0
  90. /package/dist/{components → react/src/components}/DateTime.d.ts +0 -0
  91. /package/dist/{components → react/src/components}/Number.d.ts +0 -0
  92. /package/dist/{components → react/src/components}/Plural.d.ts +0 -0
  93. /package/dist/{components → react/src/components}/Select.d.ts +0 -0
  94. /package/dist/{context.d.ts → react/src/context.d.ts} +0 -0
  95. /package/dist/{create-fluenti.d.ts → react/src/create-fluenti.d.ts} +0 -0
  96. /package/dist/{global-registry.d.ts → react/src/global-registry.d.ts} +0 -0
  97. /package/dist/{hooks → react/src/hooks}/__useI18n.d.ts +0 -0
  98. /package/dist/{hooks → react/src/hooks}/useI18n.d.ts +0 -0
  99. /package/dist/{msg.d.ts → react/src/msg.d.ts} +0 -0
  100. /package/dist/{provider.d.ts → react/src/provider.d.ts} +0 -0
  101. /package/dist/{react-runtime.d.ts → react/src/react-runtime.d.ts} +0 -0
  102. /package/dist/{vite-plugin.d.ts → react/src/vite-plugin.d.ts} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { Children as e, Fragment as t, cloneElement as n, createElement as r, isValidElement as i } from "react";
2
- import { PLURAL_CATEGORIES as a, buildICUPluralMessage as o, buildICUSelectMessage as s, hashMessage as c, normalizeSelectForms as l, offsetIndices as u } from "@fluenti/core/internal";
2
+ import { PLURAL_CATEGORIES as a, buildICUPluralMessage as o, buildICUSelectMessage as s, hashMessage as c, normalizeSelectForms as l, offsetIndices as u } from "@fluenti/core/runtime";
3
3
  //#region src/components/trans-core.ts
4
4
  function d(n) {
5
5
  let r = [], a = "";
@@ -20,8 +20,11 @@ function d(n) {
20
20
  };
21
21
  }
22
22
  function f(e, i) {
23
- let a = /<(\d+)(?:\/>|(>)([\s\S]*?)<\/\1>)/g, o = [], s = 0, c = 0, l;
24
- for (a.lastIndex = 0, l = a.exec(e); l !== null;) {
23
+ let a = /<(\d+)(?:\/>|(>)([\s\S]*?)<\/\1>)/g;
24
+ if (!e.includes("<")) return e;
25
+ let o = [], s = 0, c = 0, l;
26
+ if (a.lastIndex = 0, l = a.exec(e), l === null) return e;
27
+ for (; l !== null;) {
25
28
  l.index > s && o.push(e.slice(s, l.index));
26
29
  let t = Number(l[1]), r = l[2] === void 0, u = l[3] ?? "";
27
30
  if (!Number.isInteger(t) || t < 0 || t >= i.length) {
@@ -75,4 +78,4 @@ function h(e, t, n, r) {
75
78
  //#endregion
76
79
  export { m as a, c, h as i, f as l, s as n, a as o, l as r, d as s, o as t };
77
80
 
78
- //# sourceMappingURL=icu-rich-ChVWsA7C.js.map
81
+ //# sourceMappingURL=icu-rich-C6B9ns4t.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icu-rich-C6B9ns4t.js","names":[],"sources":["../src/components/trans-core.ts","../src/components/icu-rich.tsx"],"sourcesContent":["import {\n Children,\n isValidElement,\n cloneElement,\n createElement,\n Fragment,\n type ReactNode,\n type ReactElement,\n} from 'react'\nimport { hashMessage, offsetIndices } from '@fluenti/core/runtime'\n\nexport { hashMessage }\n\n/**\n * Extract a message string and component list from React children.\n *\n * Converts:\n * <Trans>Hello <b>{name}</b>, welcome!</Trans>\n * Into:\n * message: \"Hello <0>{name}</0>, welcome!\"\n * components: [<b>{name}</b>]\n *\n * @internal\n */\nexport function extractMessage(children: ReactNode): {\n message: string\n components: ReactElement[]\n} {\n const components: ReactElement[] = []\n let message = ''\n\n Children.forEach(children, (child) => {\n if (typeof child === 'string' || typeof child === 'number') {\n message += String(child)\n } else if (isValidElement(child)) {\n if (child.type === Fragment) {\n const inner = extractMessage((child.props as { children?: ReactNode }).children)\n message += offsetIndices(inner.message, components.length)\n components.push(...inner.components)\n return\n }\n\n const idx = components.length\n const inner = extractMessage((child.props as { children?: ReactNode }).children)\n components.push(child)\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\n return { message, components }\n}\n\n/**\n * Reconstruct a translated message string back into React elements.\n *\n * Parses \"<0>content</0>\" tags and replaces them with cloned components.\n *\n * @internal\n */\nexport function reconstruct(\n translated: string,\n components: ReactElement[],\n): ReactNode {\n const COMBINED_RE = /<(\\d+)(?:\\/>|(>)([\\s\\S]*?)<\\/\\1>)/g\n if (!translated.includes('<')) {\n return translated\n }\n\n const result: ReactNode[] = []\n let lastIndex = 0\n let keyCounter = 0\n let match: RegExpExecArray | null\n\n COMBINED_RE.lastIndex = 0\n match = COMBINED_RE.exec(translated)\n if (match === null) {\n return translated\n }\n\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 innerText = match[3] ?? ''\n\n if (!Number.isInteger(idx) || idx < 0 || idx >= components.length) {\n if (innerText) result.push(innerText)\n lastIndex = COMBINED_RE.lastIndex\n match = COMBINED_RE.exec(translated)\n continue\n }\n\n const component = components[idx]\n\n if (component) {\n // Use keyCounter (not idx) so duplicate component indices get unique keys\n const key = `trans-${keyCounter++}`\n if (isSelfClosing) {\n result.push(cloneElement(component, { key }))\n } else {\n const innerContent = reconstruct(innerText, components)\n result.push(cloneElement(component, { key }, innerContent))\n }\n } else {\n // Only push non-empty text to avoid inserting blank DOM nodes\n if (innerText) result.push(innerText)\n }\n\n lastIndex = COMBINED_RE.lastIndex\n match = COMBINED_RE.exec(translated)\n }\n\n if (lastIndex < translated.length) {\n result.push(translated.slice(lastIndex))\n }\n\n return result.length === 1 ? result[0]! : createElement(Fragment, null, ...result)\n}\n","import type { MessageDescriptor } from '@fluenti/core'\nimport {\n buildICUPluralMessage,\n buildICUSelectMessage,\n normalizeSelectForms,\n offsetIndices,\n} from '@fluenti/core/runtime'\nimport type { ReactElement, ReactNode } from 'react'\nimport { extractMessage, reconstruct } from './trans-core'\n\nexport { buildICUPluralMessage, buildICUSelectMessage, normalizeSelectForms }\n\nexport interface RichMessagePart {\n message: string\n components: ReactElement[]\n}\n\nexport function serializeRichNode(node: ReactNode): RichMessagePart {\n const extracted = extractMessage(node)\n return {\n message: extracted.message,\n components: extracted.components,\n }\n}\n\nexport function serializeRichForms<T extends string>(\n keys: readonly T[],\n forms: Partial<Record<T, ReactNode>> & Record<string, ReactNode | undefined>,\n): {\n messages: Partial<Record<T, string>> & Record<string, string>\n components: ReactElement[]\n} {\n const components: ReactElement[] = []\n const messages: Record<string, string> = {}\n\n for (const key of keys) {\n const value = forms[key]\n if (value === undefined) continue\n const extracted = serializeRichNode(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 = serializeRichNode(value)\n messages[key] = offsetIndices(extracted.message, components.length)\n components.push(...extracted.components)\n }\n\n return { messages: messages as Partial<Record<T, string>> & Record<string, string>, components }\n}\n\nexport function renderRichTranslation(\n descriptor: MessageDescriptor,\n values: Record<string, unknown> | undefined,\n translate: (descriptor: MessageDescriptor, values?: Record<string, unknown>) => string,\n components: ReactElement[],\n): ReactNode {\n const translated = translate(descriptor, values)\n return components.length > 0 ? reconstruct(translated, components) : translated\n}\n"],"mappings":";;;AAwBA,SAAgB,EAAe,GAG7B;CACA,IAAM,IAA6B,EAAE,EACjC,IAAU;AAyBd,QAvBA,EAAS,QAAQ,IAAW,MAAU;AACpC,MAAI,OAAO,KAAU,YAAY,OAAO,KAAU,SAChD,MAAW,OAAO,EAAM;WACf,EAAe,EAAM,EAAE;AAChC,OAAI,EAAM,SAAS,GAAU;IAC3B,IAAM,IAAQ,EAAgB,EAAM,MAAmC,SAAS;AAEhF,IADA,KAAW,EAAc,EAAM,SAAS,EAAW,OAAO,EAC1D,EAAW,KAAK,GAAG,EAAM,WAAW;AACpC;;GAGF,IAAM,IAAM,EAAW,QACjB,IAAQ,EAAgB,EAAM,MAAmC,SAAS;AAGhF,GAFA,EAAW,KAAK,EAAM,EACtB,EAAW,KAAK,GAAG,EAAM,WAAW,EAChC,EAAM,YAAY,MAAM,EAAM,WAAW,WAAW,IACtD,KAAW,IAAI,EAAI,MAEnB,KAAW,IAAI,EAAI,GAAG,EAAc,EAAM,SAAS,IAAM,EAAE,CAAC,IAAI,EAAI;;GAGxE,EAEK;EAAE;EAAS;EAAY;;AAUhC,SAAgB,EACd,GACA,GACW;CACX,IAAM,IAAc;AACpB,KAAI,CAAC,EAAW,SAAS,IAAI,CAC3B,QAAO;CAGT,IAAM,IAAsB,EAAE,EAC1B,IAAY,GACZ,IAAa,GACb;AAIJ,KAFA,EAAY,YAAY,GACxB,IAAQ,EAAY,KAAK,EAAW,EAChC,MAAU,KACZ,QAAO;AAGT,QAAO,MAAU,OAAM;AACrB,EAAI,EAAM,QAAQ,KAChB,EAAO,KAAK,EAAW,MAAM,GAAW,EAAM,MAAM,CAAC;EAGvD,IAAM,IAAM,OAAO,EAAM,GAAG,EACtB,IAAgB,EAAM,OAAO,KAAA,GAC7B,IAAY,EAAM,MAAM;AAE9B,MAAI,CAAC,OAAO,UAAU,EAAI,IAAI,IAAM,KAAK,KAAO,E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AY;;AAGlG,SAAgB,EACd,GACA,GACA,GACA,GACW;CACX,IAAM,IAAa,EAAU,GAAY,EAAO;AAChD,QAAO,EAAW,SAAS,IAAI,EAAY,GAAY,EAAW,GAAG"}
package/dist/index.cjs CHANGED
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./context-DVbvrSE8.cjs`);let t=require(`react`),n=require(`@fluenti/core`),r=require(`react/jsx-runtime`);function i(e){let t={};for(let[n,r]of Object.entries(e))t[n]=typeof r==`object`&&r&&`default`in r?r.default:r;return t}function a(e){let{locale:r,messages:a,loadMessages:o,fallbackLocale:s,fallbackChain:c,dateFormats:l,numberFormats:u,missing:d,diagnostics:f,interpolate:p}=e,[m,h]=(0,t.useState)(r),[g,_]=(0,t.useState)(!1),[v,y]=(0,t.useState)(a?i(a):{}),[b,x]=(0,t.useState)(a?Object.keys(a):[]),S=(0,t.useRef)(v);S.current=v;let C=(0,t.useRef)(0),w=Symbol.for(`fluenti.runtime.react.v1`);function T(){let e=globalThis[w];return typeof e==`object`&&e?e:null}let E=(0,t.useMemo)(()=>{let e={locale:m,messages:v};return s!==void 0&&(e.fallbackLocale=s),c!==void 0&&(e.fallbackChain=c),l!==void 0&&(e.dateFormats=l),u!==void 0&&(e.numberFormats=u),d!==void 0&&(e.missing=d),f!==void 0&&(e.diagnostics=f),p!==void 0&&(e.interpolate=p),e.devWarnings=e.devWarnings??(typeof process<`u`&&process.env.NODE_ENV===`development`),(0,n.createFluentiCore)(e)},[m,v,s,c,l,u,d,f,p]);(0,t.useEffect)(()=>{r!==m&&D(r)},[r]);let D=(0,t.useCallback)(async e=>{let t=++C.current,n=o?T():null;if(S.current[e]&&!o){h(e);return}if(S.current[e]){try{n?.__switchLocale&&await n.__switchLocale(e)}catch(t){console.warn(`[fluenti] split runtime switch failed for locale "${e}"`,t)}h(e);return}if(!o){console.warn(`[fluenti] No messages for locale "${e}" and no loadMessages function provided`);return}_(!0);try{let r=await o(e);if(t!==C.current)return;let i=typeof r==`object`&&r&&`default`in r?r.default:r;try{n?.__switchLocale&&await n.__switchLocale(e)}catch(t){console.warn(`[fluenti] split runtime switch failed for locale "${e}"`,t)}if(t!==C.current)return;y(t=>({...t,[e]:i})),x(t=>[...new Set([...t,e])]),h(e)}catch(n){t===C.current&&console.error(`[fluenti] Failed to load locale "${e}"`,n)}finally{t===C.current&&_(!1)}},[o]),O=(0,t.useCallback)(async e=>{if(!(S.current[e]||!o))try{let t=await o(e),n=typeof t==`object`&&t&&`default`in t?t.default:t;y(t=>({...t,[e]:n})),x(t=>[...new Set([...t,e])]);let r=T();r?.__preloadLocale&&await r.__preloadLocale(e)}catch{}},[o]),k=(0,t.useCallback)((e,t)=>{let n=v[t??m];return n!==void 0&&e in n},[v,m]),A=(0,t.useCallback)((e,t)=>{let n=v[t??m];if(n)return n[e]},[v,m]);return(0,t.useMemo)(()=>({t:E.t.bind(E),d:E.d.bind(E),n:E.n.bind(E),locale:m,setLocale:D,isLoading:g,preloadLocale:O,te:k,tm:A,i18n:E,format:E.format.bind(E),loadMessages:E.loadMessages.bind(E),getLocales:E.getLocales.bind(E),loadedLocales:b}),[E,m,D,g,O,k,A,b])}function o(e){globalThis.__fluenti_i18n=e}function s({instance:n,children:i}){let a=(0,t.useMemo)(()=>({t:n.t,d:n.d,n:n.n,format:n.format,loadMessages:n.loadMessages,getLocales:n.getLocales,locale:n.locale,setLocale:n.setLocale,isLoading:n.isLoading,loadedLocales:n.loadedLocales,preloadLocale:n.preloadLocale,te:n.te,tm:n.tm,i18n:n.i18n}),[n]);return(0,r.jsx)(e.t.Provider,{value:a,children:i})}function c(e){return e.instance?(0,r.jsx)(s,{instance:e.instance,children:e.children}):(0,r.jsx)(l,{...e})}function l({locale:e,fallbackLocale:n,messages:i,loadMessages:c,fallbackChain:l,dateFormats:u,numberFormats:d,missing:f,diagnostics:p,interpolate:m,children:h}){let g=a({locale:e??`en`,messages:i,loadMessages:c,fallbackLocale:n,fallbackChain:l,dateFormats:u,numberFormats:d,missing:f,diagnostics:p,interpolate:m});return(0,t.useEffect)(()=>{o(g.i18n)},[g.i18n]),(0,r.jsx)(s,{instance:g,children:h})}function u(){let n=(0,t.useContext)(e.t);if(!n)throw Error(`[fluenti] useI18n() must be used within an <I18nProvider>. Wrap your app with <I18nProvider> to provide i18n context.`);return n}function d(){return u().locale}var f=((...e)=>{throw Error("[fluenti] `t` imported from '@fluenti/react' 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(...).")});exports.I18nContext=e.t,exports.I18nProvider=c,exports.createFluenti=a,Object.defineProperty(exports,`msg`,{enumerable:!0,get:function(){return n.msg}}),exports.t=f,exports.useI18n=u,exports.useLocale=d;
2
+ "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./Number-JCugssFE.cjs`);let t=require(`react`),n=require(`@fluenti/core`),r=require(`react/jsx-runtime`);function i(e){let t={};for(let[n,r]of Object.entries(e))t[n]=typeof r==`object`&&r&&`default`in r?r.default:r;return t}function a(e){let{locale:r,messages:a,loadMessages:o,fallbackLocale:s,fallbackChain:c,dateFormats:l,numberFormats:u,missing:d,diagnostics:f,interpolate:p}=e,[m,h]=(0,t.useState)(r),[g,_]=(0,t.useState)(!1),[v,y]=(0,t.useState)(a?i(a):{}),[b,x]=(0,t.useState)(a?Object.keys(a):[]),S=(0,t.useRef)(v);S.current=v;let C=(0,t.useRef)(0),w=Symbol.for(`fluenti.runtime.react.v1`);function T(){let e=globalThis[w];return typeof e==`object`&&e?e:null}let E=(0,t.useMemo)(()=>{let e={locale:m,messages:v};return s!==void 0&&(e.fallbackLocale=s),c!==void 0&&(e.fallbackChain=c),l!==void 0&&(e.dateFormats=l),u!==void 0&&(e.numberFormats=u),d!==void 0&&(e.missing=d),f!==void 0&&(e.diagnostics=f),p!==void 0&&(e.interpolate=p),e.devWarnings=e.devWarnings??(typeof process<`u`&&process.env.NODE_ENV===`development`),(0,n.createFluentiCore)(e)},[m,v,s,c,l,u,d,f,p]);(0,t.useEffect)(()=>{r!==m&&D(r)},[r]);let D=(0,t.useCallback)(async e=>{let t=++C.current,n=o?T():null;if(S.current[e]&&!o){h(e);return}if(S.current[e]){try{n?.__switchLocale&&await n.__switchLocale(e)}catch(t){console.warn(`[fluenti] split runtime switch failed for locale "${e}"`,t)}h(e);return}if(!o){console.warn(`[fluenti] No messages for locale "${e}" and no loadMessages function provided`);return}_(!0);try{let r=await o(e);if(t!==C.current)return;let i=typeof r==`object`&&r&&`default`in r?r.default:r;try{n?.__switchLocale&&await n.__switchLocale(e)}catch(t){console.warn(`[fluenti] split runtime switch failed for locale "${e}"`,t)}if(t!==C.current)return;y(t=>({...t,[e]:i})),x(t=>[...new Set([...t,e])]),h(e)}catch(n){t===C.current&&console.error(`[fluenti] Failed to load locale "${e}"`,n)}finally{t===C.current&&_(!1)}},[o]),O=(0,t.useCallback)(async e=>{if(!(S.current[e]||!o))try{let t=await o(e),n=typeof t==`object`&&t&&`default`in t?t.default:t;y(t=>({...t,[e]:n})),x(t=>[...new Set([...t,e])]);let r=T();r?.__preloadLocale&&await r.__preloadLocale(e)}catch{}},[o]),k=(0,t.useCallback)((e,t)=>{let n=v[t??m];return n!==void 0&&e in n},[v,m]),A=(0,t.useCallback)((e,t)=>{let n=v[t??m];if(n)return n[e]},[v,m]);return(0,t.useMemo)(()=>({t:E.t.bind(E),d:E.d.bind(E),n:E.n.bind(E),locale:m,setLocale:D,isLoading:g,preloadLocale:O,te:k,tm:A,i18n:E,format:E.format.bind(E),loadMessages:E.loadMessages.bind(E),getLocales:E.getLocales.bind(E),loadedLocales:b}),[E,m,D,g,O,k,A,b])}function o(e){globalThis.__fluenti_i18n=e}function s({instance:n,children:i}){let a=(0,t.useMemo)(()=>({t:n.t,d:n.d,n:n.n,format:n.format,loadMessages:n.loadMessages,getLocales:n.getLocales,locale:n.locale,setLocale:n.setLocale,isLoading:n.isLoading,loadedLocales:n.loadedLocales,preloadLocale:n.preloadLocale,te:n.te,tm:n.tm,i18n:n.i18n}),[n]);return(0,r.jsx)(e.s.Provider,{value:a,children:i})}function c(e){return e.instance?(0,r.jsx)(s,{instance:e.instance,children:e.children}):(0,r.jsx)(l,{...e})}function l({locale:e,fallbackLocale:n,messages:i,loadMessages:c,fallbackChain:l,dateFormats:u,numberFormats:d,missing:f,diagnostics:p,interpolate:m,children:h}){let g=a({locale:e??`en`,messages:i,loadMessages:c,fallbackLocale:n,fallbackChain:l,dateFormats:u,numberFormats:d,missing:f,diagnostics:p,interpolate:m});return(0,t.useEffect)(()=>{o(g.i18n)},[g.i18n]),(0,r.jsx)(s,{instance:g,children:h})}function u(){let n=(0,t.useContext)(e.s);if(!n)throw Error(`[fluenti] useI18n() must be used within an <I18nProvider>. Wrap your app with <I18nProvider> to provide i18n context.`);return n}function d(){return u().locale}var f=((...e)=>{throw Error("[fluenti] `t` imported from '@fluenti/react' 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(...).")});exports.DateTime=e.n,exports.I18nContext=e.s,exports.I18nProvider=c,exports.NumberFormat=e.t,exports.Plural=e.i,exports.Select=e.r,exports.Trans=e.o,exports.createFluenti=a,Object.defineProperty(exports,`msg`,{enumerable:!0,get:function(){return n.msg}}),exports.t=f,exports.useI18n=u,exports.useLocale=d;
3
3
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../src/create-fluenti.ts","../src/global-registry.ts","../src/provider.tsx","../src/hooks/useI18n.ts","../src/compile-time-t.ts"],"sourcesContent":["import { useState, useCallback, useEffect, useMemo, useRef } from 'react'\nimport { createFluentiCore } from '@fluenti/core'\nimport type {\n FluentiCoreInstanceFull as FluentInstanceExtended,\n CompiledMessage,\n Locale,\n Messages,\n AllMessages,\n DateFormatOptions,\n NumberFormatOptions,\n LocalizedString,\n MessageDescriptor,\n} from '@fluenti/core'\n\n/**\n * Configuration for `createFluenti()`.\n */\nexport interface FluentiConfig {\n /** Active locale code */\n locale: string\n /** Static message catalogs keyed by locale */\n messages?: AllMessages | undefined\n /** Async loader for lazy-loading locale messages */\n loadMessages?: ((locale: string) => Promise<Messages | { default: Messages }>) | undefined\n /** Fallback locale when a translation is missing */\n fallbackLocale?: string | undefined\n /** Custom fallback chains per locale */\n fallbackChain?: Record<string, string[]> | undefined\n /** Date format styles */\n dateFormats?: DateFormatOptions | undefined\n /** Number format styles */\n numberFormats?: NumberFormatOptions | undefined\n /** Missing message handler */\n missing?: ((locale: Locale, id: string) => string | undefined) | undefined\n /** Runtime diagnostics (pre-created instance or config) */\n diagnostics?: unknown | undefined\n /** Custom interpolation function for full ICU support at runtime */\n interpolate?: ((message: string, values: Record<string, unknown> | undefined, locale: string, formatters?: Record<string, unknown>) => string) | undefined\n}\n\n/**\n * The object returned by `createFluenti()`.\n *\n * Contains all i18n state and methods. Pass to `<I18nProvider instance={...}>`\n * or use directly in tests/non-React contexts.\n */\nexport interface FluentiInstance {\n /** Translate a message by id with optional interpolation values */\n t: {\n (id: string | MessageDescriptor, values?: Record<string, unknown>): LocalizedString\n (strings: TemplateStringsArray, ...exprs: unknown[]): LocalizedString\n }\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 /** Current locale */\n locale: string\n /** Change the active locale (async when lazy loading) */\n setLocale: (locale: string) => Promise<void>\n /** Whether a locale is currently being loaded */\n isLoading: boolean\n /** Preload a locale in the background without switching to it */\n preloadLocale: (locale: string) => Promise<void>\n /** Check whether a translation key exists for the given or current locale */\n te: (key: string, locale?: string) => boolean\n /** Get the raw compiled message for a key without interpolation */\n tm: (key: string, locale?: string) => CompiledMessage | undefined\n /** The underlying Fluent instance (escape hatch for advanced use) */\n i18n: FluentInstanceExtended\n /** Format an ICU message string directly (no catalog lookup) */\n format: (message: string, values?: Record<string, unknown>) => LocalizedString\n /** Merge additional messages into a locale catalog at runtime */\n loadMessages: (locale: string, messages: Messages) => void\n /** Return all locale codes that have loaded messages */\n getLocales: () => string[]\n /** Set of locales whose messages have been loaded */\n loadedLocales: string[]\n}\n\nfunction unwrapMessages(allMessages: Record<string, unknown>): Record<string, Messages> {\n const result: Record<string, Messages> = {}\n for (const [locale, msgs] of Object.entries(allMessages)) {\n result[locale] = typeof msgs === 'object' && msgs !== null && 'default' in msgs\n ? (msgs as { default: Messages }).default\n : msgs as Messages\n }\n return result\n}\n\n/**\n * Create a standalone Fluenti i18n instance.\n *\n * This is a React hook that manages locale state, message loading, and\n * provides all i18n methods. The returned instance can be passed to\n * `<I18nProvider instance={...}>` to share it with the component tree.\n *\n * @example\n * ```tsx\n * function App() {\n * const i18n = createFluenti({\n * locale: 'en',\n * messages: { en: enMessages, fr: frMessages },\n * })\n * return (\n * <I18nProvider instance={i18n}>\n * <MyApp />\n * </I18nProvider>\n * )\n * }\n * ```\n */\nexport function createFluenti(config: FluentiConfig): FluentiInstance {\n const {\n locale: initialLocale,\n messages: initialMessages,\n loadMessages: loadMessagesFn,\n fallbackLocale,\n fallbackChain,\n dateFormats,\n numberFormats,\n missing,\n diagnostics,\n interpolate,\n } = config\n\n const [currentLocale, setCurrentLocale] = useState(initialLocale)\n const [isLoading, setIsLoading] = useState(false)\n const [loadedMessages, setLoadedMessages] = useState<Record<string, Messages>>(\n initialMessages ? unwrapMessages(initialMessages) : {},\n )\n const [loadedLocales, setLoadedLocales] = useState<string[]>(\n initialMessages ? Object.keys(initialMessages) : [],\n )\n\n const loadedMessagesRef = useRef(loadedMessages)\n loadedMessagesRef.current = loadedMessages\n\n const localeRequestRef = useRef(0)\n\n // Split runtime integration (for Vite plugin code splitting)\n const SPLIT_RUNTIME_KEY = Symbol.for('fluenti.runtime.react.v1')\n function getSplitRuntime(): { __switchLocale?: (l: string) => Promise<void>; __preloadLocale?: (l: string) => Promise<void> } | null {\n const rt = (globalThis as Record<PropertyKey, unknown>)[SPLIT_RUNTIME_KEY]\n return typeof rt === 'object' && rt !== null ? rt as any : null\n }\n\n const i18n = useMemo(() => {\n const cfg: Parameters<typeof createFluentiCore>[0] = {\n locale: currentLocale,\n messages: loadedMessages,\n }\n if (fallbackLocale !== undefined) cfg.fallbackLocale = fallbackLocale\n if (fallbackChain !== undefined) cfg.fallbackChain = fallbackChain\n if (dateFormats !== undefined) cfg.dateFormats = dateFormats\n if (numberFormats !== undefined) cfg.numberFormats = numberFormats\n if (missing !== undefined) cfg.missing = missing\n if (diagnostics !== undefined) cfg.diagnostics = diagnostics as Parameters<typeof createFluentiCore>[0]['diagnostics']\n if (interpolate !== undefined) cfg.interpolate = interpolate\n cfg.devWarnings = cfg.devWarnings ?? (typeof process !== 'undefined' && process.env?.['NODE_ENV'] === 'development')\n return createFluentiCore(cfg)\n }, [currentLocale, loadedMessages, fallbackLocale, fallbackChain, dateFormats, numberFormats, missing, diagnostics, interpolate])\n\n // Sync external locale changes\n useEffect(() => {\n if (initialLocale !== currentLocale) {\n void handleSetLocale(initialLocale)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [initialLocale])\n\n const handleSetLocale = useCallback(\n async (newLocale: string) => {\n const requestId = ++localeRequestRef.current\n\n const splitRuntime = loadMessagesFn ? getSplitRuntime() : null\n\n if (loadedMessagesRef.current[newLocale] && !loadMessagesFn) {\n setCurrentLocale(newLocale)\n return\n }\n\n if (loadedMessagesRef.current[newLocale]) {\n try {\n if (splitRuntime?.__switchLocale) {\n await splitRuntime.__switchLocale(newLocale)\n }\n } catch (e) {\n console.warn(`[fluenti] split runtime switch failed for locale \"${newLocale}\"`, e)\n }\n setCurrentLocale(newLocale)\n return\n }\n\n if (!loadMessagesFn) {\n console.warn(\n `[fluenti] No messages for locale \"${newLocale}\" and no loadMessages function provided`,\n )\n return\n }\n\n setIsLoading(true)\n try {\n const msgs = await loadMessagesFn(newLocale)\n if (requestId !== localeRequestRef.current) return\n\n const resolved: Messages =\n typeof msgs === 'object' && msgs !== null && 'default' in msgs\n ? (msgs as { default: Messages }).default\n : (msgs as Messages)\n try {\n if (splitRuntime?.__switchLocale) {\n await splitRuntime.__switchLocale(newLocale)\n }\n } catch (e) {\n console.warn(`[fluenti] split runtime switch failed for locale \"${newLocale}\"`, e)\n }\n if (requestId !== localeRequestRef.current) return\n setLoadedMessages((prev) => ({ ...prev, [newLocale]: resolved }))\n setLoadedLocales((prev) => [...new Set([...prev, newLocale])])\n setCurrentLocale(newLocale)\n } catch (err) {\n if (requestId === localeRequestRef.current) {\n console.error(`[fluenti] Failed to load locale \"${newLocale}\"`, err)\n }\n } finally {\n if (requestId === localeRequestRef.current) {\n setIsLoading(false)\n }\n }\n },\n [loadMessagesFn],\n )\n\n const preloadLocale = useCallback(\n async (loc: string) => {\n if (loadedMessagesRef.current[loc] || !loadMessagesFn) return\n try {\n const msgs = await loadMessagesFn(loc)\n const resolved: Messages =\n typeof msgs === 'object' && msgs !== null && 'default' in msgs\n ? (msgs as { default: Messages }).default\n : (msgs as Messages)\n setLoadedMessages((prev) => ({ ...prev, [loc]: resolved }))\n setLoadedLocales((prev) => [...new Set([...prev, loc])])\n const splitRuntime = getSplitRuntime()\n if (splitRuntime?.__preloadLocale) {\n await splitRuntime.__preloadLocale(loc)\n }\n } catch {\n // Silent fail for preload\n }\n },\n [loadMessagesFn],\n )\n\n const te = useCallback(\n (key: string, loc?: string): boolean => {\n const msgs = loadedMessages[loc ?? currentLocale]\n return msgs !== undefined && key in msgs\n },\n [loadedMessages, currentLocale],\n )\n\n const tm = useCallback(\n (key: string, loc?: string): Messages[string] | undefined => {\n const msgs = loadedMessages[loc ?? currentLocale]\n if (!msgs) return undefined\n return msgs[key]\n },\n [loadedMessages, currentLocale],\n )\n\n return useMemo(\n () => ({\n t: i18n.t.bind(i18n),\n d: i18n.d.bind(i18n),\n n: i18n.n.bind(i18n),\n locale: currentLocale,\n setLocale: handleSetLocale,\n isLoading,\n preloadLocale,\n te,\n tm,\n i18n,\n format: i18n.format.bind(i18n),\n loadMessages: i18n.loadMessages.bind(i18n),\n getLocales: i18n.getLocales.bind(i18n),\n loadedLocales,\n }),\n [i18n, currentLocale, handleSetLocale, isLoading, preloadLocale, te, tm, loadedLocales],\n )\n}\n","import type { FluentiCoreInstanceFull } from '@fluenti/core'\n\n/**\n * Global i18n instance registry.\n *\n * Used by `@fluenti/next` webpack loader and `@fluenti/vite-plugin` to access\n * the i18n instance from module-level code via a Proxy. The instance is set by\n * `<I18nProvider>` on mount.\n */\n\ndeclare global {\n // eslint-disable-next-line no-var\n var __fluenti_i18n: FluentiCoreInstanceFull | undefined\n}\n\n/** Get the global i18n instance (set by `<I18nProvider>`). */\nexport function getGlobalI18n(): FluentiCoreInstanceFull | undefined {\n return globalThis.__fluenti_i18n\n}\n\n/** Set the global i18n instance. Called by `<I18nProvider>` on mount. */\nexport function setGlobalI18n(instance: FluentiCoreInstanceFull): void {\n globalThis.__fluenti_i18n = instance\n}\n\n/** Clear the global i18n instance. Primarily for testing. */\nexport function clearGlobalI18n(): void {\n globalThis.__fluenti_i18n = undefined\n}\n","import { useEffect, useMemo } from 'react'\nimport { I18nContext } from './context'\nimport type { FluentiProviderProps, FluentiContext } from './types'\nimport type { FluentiInstance } from './create-fluenti'\nimport { createFluenti } from './create-fluenti'\nimport { setGlobalI18n } from './global-registry'\n\n/**\n * Internal provider that uses a pre-created `FluentiInstance`.\n */\nfunction InstanceProvider({ instance, children }: { instance: FluentiInstance; children: React.ReactNode }) {\n const ctx: FluentiContext = useMemo(\n () => ({\n t: instance.t,\n d: instance.d,\n n: instance.n,\n format: instance.format,\n loadMessages: instance.loadMessages,\n getLocales: instance.getLocales,\n locale: instance.locale,\n setLocale: instance.setLocale,\n isLoading: instance.isLoading,\n loadedLocales: instance.loadedLocales,\n preloadLocale: instance.preloadLocale,\n te: instance.te,\n tm: instance.tm,\n // Internal: used by __useI18n hook and compiled components — not part of public API\n i18n: instance.i18n,\n }) as FluentiContext,\n [instance],\n )\n\n return <I18nContext.Provider value={ctx}>{children}</I18nContext.Provider>\n}\n\n/**\n * Provides the Fluenti i18n context to the React component tree.\n *\n * Accepts either a `locale` + `messages` pair for inline configuration,\n * or a pre-created `instance` from `createFluenti()`.\n *\n * @example\n * ```tsx\n * import { I18nProvider, useI18n } from '@fluenti/react'\n * import messages from './locales/compiled/en.js'\n *\n * function App() {\n * return (\n * <I18nProvider locale=\"en\" messages={{ en: messages }}>\n * <Content />\n * </I18nProvider>\n * )\n * }\n *\n * function Content() {\n * const { t } = useI18n()\n * return <h1>{t`Welcome to our app`}</h1>\n * }\n * ```\n *\n * @example Using a pre-created instance\n * ```tsx\n * import { I18nProvider, createFluenti } from '@fluenti/react'\n * import messages from './locales/compiled/en.js'\n *\n * const i18n = createFluenti({ locale: 'en', messages: { en: messages } })\n *\n * function App() {\n * return (\n * <I18nProvider instance={i18n}>\n * <Content />\n * </I18nProvider>\n * )\n * }\n * ```\n */\nexport function I18nProvider(props: FluentiProviderProps) {\n if (props.instance) {\n return <InstanceProvider instance={props.instance}>{props.children}</InstanceProvider>\n }\n\n return <InlineProvider {...props} />\n}\n\n/**\n * Inline provider that delegates to `createFluenti()` for state management.\n */\nfunction InlineProvider({\n locale,\n fallbackLocale,\n messages,\n loadMessages,\n fallbackChain,\n dateFormats,\n numberFormats,\n missing,\n diagnostics,\n interpolate,\n children,\n}: FluentiProviderProps) {\n const instance = createFluenti({\n locale: locale ?? 'en',\n messages,\n loadMessages,\n fallbackLocale,\n fallbackChain,\n dateFormats,\n numberFormats,\n missing,\n diagnostics,\n interpolate,\n })\n\n // Set global i18n instance for webpack loader / vite plugin access\n useEffect(() => {\n setGlobalI18n(instance.i18n)\n }, [instance.i18n])\n\n return <InstanceProvider instance={instance}>{children}</InstanceProvider>\n}\n","import { useContext } from 'react'\nimport { I18nContext } from '../context'\nimport type { FluentiContext } from '../types'\n\n/**\n * Primary hook for accessing i18n functions.\n *\n * Returns locale, setLocale, isLoading, loadedLocales, preloadLocale,\n * and the underlying i18n instance with t(), d(), n() methods.\n *\n * @throws If used outside of `<I18nProvider>`\n */\nexport function useI18n(): FluentiContext {\n const ctx = useContext(I18nContext)\n if (!ctx) {\n throw new Error(\n '[fluenti] useI18n() must be used within an <I18nProvider>. ' +\n 'Wrap your app with <I18nProvider> to provide i18n context.',\n )\n }\n return ctx\n}\n\n/**\n * Shorthand hook that returns only the current locale string.\n *\n * @example\n * ```tsx\n * const locale = useLocale() // 'en'\n * ```\n */\nexport function useLocale(): string {\n return useI18n().locale\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/react' 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"],"mappings":"2MAgFA,SAAS,EAAe,EAAgE,CACtF,IAAM,EAAmC,EAAE,CAC3C,IAAK,GAAM,CAAC,EAAQ,KAAS,OAAO,QAAQ,EAAY,CACtD,EAAO,GAAU,OAAO,GAAS,UAAY,GAAiB,YAAa,EACtE,EAA+B,QAChC,EAEN,OAAO,EAyBT,SAAgB,EAAc,EAAwC,CACpE,GAAM,CACJ,OAAQ,EACR,SAAU,EACV,aAAc,EACd,iBACA,gBACA,cACA,gBACA,UACA,cACA,eACE,EAEE,CAAC,EAAe,IAAA,EAAA,EAAA,UAA6B,EAAc,CAC3D,CAAC,EAAW,IAAA,EAAA,EAAA,UAAyB,GAAM,CAC3C,CAAC,EAAgB,IAAA,EAAA,EAAA,UACrB,EAAkB,EAAe,EAAgB,CAAG,EAAE,CACvD,CACK,CAAC,EAAe,IAAA,EAAA,EAAA,UACpB,EAAkB,OAAO,KAAK,EAAgB,CAAG,EAAE,CACpD,CAEK,GAAA,EAAA,EAAA,QAA2B,EAAe,CAChD,EAAkB,QAAU,EAE5B,IAAM,GAAA,EAAA,EAAA,QAA0B,EAAE,CAG5B,EAAoB,OAAO,IAAI,2BAA2B,CAChE,SAAS,GAA4H,CACnI,IAA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,KAAK,EAC3B,CAAC,EAAS,KAAK,CAAC,EAEZ,EAAA,EAAA,KAAC,EAAD,CAA4B,WAAW,WAA4B,CAAA,CC1G5E,SAAgB,GAA0B,CACxC,IAAM,GAAA,EAAA,EAAA,YAAiB,EAAA,EAAY,CACnC,GAAI,CAAC,EACH,MAAU,MACR,wHAED,CAEH,OAAO,EAWT,SAAgB,GAAoB,CAClC,OAAO,GAAS,CAAC,OC9BnB,IAAa,IAAoB,GAAG,IAAqB,CACvD,MAAU,MACR,iMAGD"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../src/create-fluenti.ts","../src/global-registry.ts","../src/provider.tsx","../src/hooks/useI18n.ts","../src/compile-time-t.ts"],"sourcesContent":["import { useState, useCallback, useEffect, useMemo, useRef } from 'react'\nimport { createFluentiCore } from '@fluenti/core'\nimport type {\n FluentiCoreInstanceFull as FluentInstanceExtended,\n CompiledMessage,\n Locale,\n Messages,\n AllMessages,\n DateFormatOptions,\n NumberFormatOptions,\n LocalizedString,\n MessageDescriptor,\n} from '@fluenti/core'\n\n/**\n * Configuration for `createFluenti()`.\n */\nexport interface FluentiConfig {\n /** Active locale code */\n locale: string\n /** Static message catalogs keyed by locale */\n messages?: AllMessages | undefined\n /** Async loader for lazy-loading locale messages */\n loadMessages?: ((locale: string) => Promise<Messages | { default: Messages }>) | undefined\n /** Fallback locale when a translation is missing */\n fallbackLocale?: string | undefined\n /** Custom fallback chains per locale */\n fallbackChain?: Record<string, string[]> | undefined\n /** Date format styles */\n dateFormats?: DateFormatOptions | undefined\n /** Number format styles */\n numberFormats?: NumberFormatOptions | undefined\n /** Missing message handler */\n missing?: ((locale: Locale, id: string) => string | undefined) | undefined\n /** Runtime diagnostics (pre-created instance or config) */\n diagnostics?: unknown | undefined\n /** Custom interpolation function for full ICU support at runtime */\n interpolate?: ((message: string, values: Record<string, unknown> | undefined, locale: string, formatters?: Record<string, unknown>) => string) | undefined\n}\n\n/**\n * The object returned by `createFluenti()`.\n *\n * Contains all i18n state and methods. Pass to `<I18nProvider instance={...}>`\n * or use directly in tests/non-React contexts.\n */\nexport interface FluentiInstance {\n /** Translate a message by id with optional interpolation values */\n t: {\n (id: string | MessageDescriptor, values?: Record<string, unknown>): LocalizedString\n (strings: TemplateStringsArray, ...exprs: unknown[]): LocalizedString\n }\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 /** Current locale */\n locale: string\n /** Change the active locale (async when lazy loading) */\n setLocale: (locale: string) => Promise<void>\n /** Whether a locale is currently being loaded */\n isLoading: boolean\n /** Preload a locale in the background without switching to it */\n preloadLocale: (locale: string) => Promise<void>\n /** Check whether a translation key exists for the given or current locale */\n te: (key: string, locale?: string) => boolean\n /** Get the raw compiled message for a key without interpolation */\n tm: (key: string, locale?: string) => CompiledMessage | undefined\n /** The underlying Fluent instance (escape hatch for advanced use) */\n i18n: FluentInstanceExtended\n /** Format an ICU message string directly (no catalog lookup) */\n format: (message: string, values?: Record<string, unknown>) => LocalizedString\n /** Merge additional messages into a locale catalog at runtime */\n loadMessages: (locale: string, messages: Messages) => void\n /** Return all locale codes that have loaded messages */\n getLocales: () => string[]\n /** Set of locales whose messages have been loaded */\n loadedLocales: string[]\n}\n\nfunction unwrapMessages(allMessages: Record<string, unknown>): Record<string, Messages> {\n const result: Record<string, Messages> = {}\n for (const [locale, msgs] of Object.entries(allMessages)) {\n result[locale] = typeof msgs === 'object' && msgs !== null && 'default' in msgs\n ? (msgs as { default: Messages }).default\n : msgs as Messages\n }\n return result\n}\n\n/**\n * Create a standalone Fluenti i18n instance.\n *\n * This is a React hook that manages locale state, message loading, and\n * provides all i18n methods. The returned instance can be passed to\n * `<I18nProvider instance={...}>` to share it with the component tree.\n *\n * @example\n * ```tsx\n * function App() {\n * const i18n = createFluenti({\n * locale: 'en',\n * messages: { en: enMessages, fr: frMessages },\n * })\n * return (\n * <I18nProvider instance={i18n}>\n * <MyApp />\n * </I18nProvider>\n * )\n * }\n * ```\n */\nexport function createFluenti(config: FluentiConfig): FluentiInstance {\n const {\n locale: initialLocale,\n messages: initialMessages,\n loadMessages: loadMessagesFn,\n fallbackLocale,\n fallbackChain,\n dateFormats,\n numberFormats,\n missing,\n diagnostics,\n interpolate,\n } = config\n\n const [currentLocale, setCurrentLocale] = useState(initialLocale)\n const [isLoading, setIsLoading] = useState(false)\n const [loadedMessages, setLoadedMessages] = useState<Record<string, Messages>>(\n initialMessages ? unwrapMessages(initialMessages) : {},\n )\n const [loadedLocales, setLoadedLocales] = useState<string[]>(\n initialMessages ? Object.keys(initialMessages) : [],\n )\n\n const loadedMessagesRef = useRef(loadedMessages)\n loadedMessagesRef.current = loadedMessages\n\n const localeRequestRef = useRef(0)\n\n // Split runtime integration (for Vite plugin code splitting)\n const SPLIT_RUNTIME_KEY = Symbol.for('fluenti.runtime.react.v1')\n function getSplitRuntime(): { __switchLocale?: (l: string) => Promise<void>; __preloadLocale?: (l: string) => Promise<void> } | null {\n const rt = (globalThis as Record<PropertyKey, unknown>)[SPLIT_RUNTIME_KEY]\n return typeof rt === 'object' && rt !== null ? rt as any : null\n }\n\n const i18n = useMemo(() => {\n const cfg: Parameters<typeof createFluentiCore>[0] = {\n locale: currentLocale,\n messages: loadedMessages,\n }\n if (fallbackLocale !== undefined) cfg.fallbackLocale = fallbackLocale\n if (fallbackChain !== undefined) cfg.fallbackChain = fallbackChain\n if (dateFormats !== undefined) cfg.dateFormats = dateFormats\n if (numberFormats !== undefined) cfg.numberFormats = numberFormats\n if (missing !== undefined) cfg.missing = missing\n if (diagnostics !== undefined) cfg.diagnostics = diagnostics as Parameters<typeof createFluentiCore>[0]['diagnostics']\n if (interpolate !== undefined) cfg.interpolate = interpolate\n cfg.devWarnings = cfg.devWarnings ?? (typeof process !== 'undefined' && process.env?.['NODE_ENV'] === 'development')\n return createFluentiCore(cfg)\n }, [currentLocale, loadedMessages, fallbackLocale, fallbackChain, dateFormats, numberFormats, missing, diagnostics, interpolate])\n\n // Sync external locale changes\n useEffect(() => {\n if (initialLocale !== currentLocale) {\n void handleSetLocale(initialLocale)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [initialLocale])\n\n const handleSetLocale = useCallback(\n async (newLocale: string) => {\n const requestId = ++localeRequestRef.current\n\n const splitRuntime = loadMessagesFn ? getSplitRuntime() : null\n\n if (loadedMessagesRef.current[newLocale] && !loadMessagesFn) {\n setCurrentLocale(newLocale)\n return\n }\n\n if (loadedMessagesRef.current[newLocale]) {\n try {\n if (splitRuntime?.__switchLocale) {\n await splitRuntime.__switchLocale(newLocale)\n }\n } catch (e) {\n console.warn(`[fluenti] split runtime switch failed for locale \"${newLocale}\"`, e)\n }\n setCurrentLocale(newLocale)\n return\n }\n\n if (!loadMessagesFn) {\n console.warn(\n `[fluenti] No messages for locale \"${newLocale}\" and no loadMessages function provided`,\n )\n return\n }\n\n setIsLoading(true)\n try {\n const msgs = await loadMessagesFn(newLocale)\n if (requestId !== localeRequestRef.current) return\n\n const resolved: Messages =\n typeof msgs === 'object' && msgs !== null && 'default' in msgs\n ? (msgs as { default: Messages }).default\n : (msgs as Messages)\n try {\n if (splitRuntime?.__switchLocale) {\n await splitRuntime.__switchLocale(newLocale)\n }\n } catch (e) {\n console.warn(`[fluenti] split runtime switch failed for locale \"${newLocale}\"`, e)\n }\n if (requestId !== localeRequestRef.current) return\n setLoadedMessages((prev) => ({ ...prev, [newLocale]: resolved }))\n setLoadedLocales((prev) => [...new Set([...prev, newLocale])])\n setCurrentLocale(newLocale)\n } catch (err) {\n if (requestId === localeRequestRef.current) {\n console.error(`[fluenti] Failed to load locale \"${newLocale}\"`, err)\n }\n } finally {\n if (requestId === localeRequestRef.current) {\n setIsLoading(false)\n }\n }\n },\n [loadMessagesFn],\n )\n\n const preloadLocale = useCallback(\n async (loc: string) => {\n if (loadedMessagesRef.current[loc] || !loadMessagesFn) return\n try {\n const msgs = await loadMessagesFn(loc)\n const resolved: Messages =\n typeof msgs === 'object' && msgs !== null && 'default' in msgs\n ? (msgs as { default: Messages }).default\n : (msgs as Messages)\n setLoadedMessages((prev) => ({ ...prev, [loc]: resolved }))\n setLoadedLocales((prev) => [...new Set([...prev, loc])])\n const splitRuntime = getSplitRuntime()\n if (splitRuntime?.__preloadLocale) {\n await splitRuntime.__preloadLocale(loc)\n }\n } catch {\n // Silent fail for preload\n }\n },\n [loadMessagesFn],\n )\n\n const te = useCallback(\n (key: string, loc?: string): boolean => {\n const msgs = loadedMessages[loc ?? currentLocale]\n return msgs !== undefined && key in msgs\n },\n [loadedMessages, currentLocale],\n )\n\n const tm = useCallback(\n (key: string, loc?: string): Messages[string] | undefined => {\n const msgs = loadedMessages[loc ?? currentLocale]\n if (!msgs) return undefined\n return msgs[key]\n },\n [loadedMessages, currentLocale],\n )\n\n return useMemo(\n () => ({\n t: i18n.t.bind(i18n),\n d: i18n.d.bind(i18n),\n n: i18n.n.bind(i18n),\n locale: currentLocale,\n setLocale: handleSetLocale,\n isLoading,\n preloadLocale,\n te,\n tm,\n i18n,\n format: i18n.format.bind(i18n),\n loadMessages: i18n.loadMessages.bind(i18n),\n getLocales: i18n.getLocales.bind(i18n),\n loadedLocales,\n }),\n [i18n, currentLocale, handleSetLocale, isLoading, preloadLocale, te, tm, loadedLocales],\n )\n}\n","import type { FluentiCoreInstanceFull } from '@fluenti/core'\n\n/**\n * Global i18n instance registry.\n *\n * Used by `@fluenti/next` webpack loader and `@fluenti/vite-plugin` to access\n * the i18n instance from module-level code via a Proxy. The instance is set by\n * `<I18nProvider>` on mount.\n */\n\ndeclare global {\n // eslint-disable-next-line no-var\n var __fluenti_i18n: FluentiCoreInstanceFull | undefined\n}\n\n/** Get the global i18n instance (set by `<I18nProvider>`). */\nexport function getGlobalI18n(): FluentiCoreInstanceFull | undefined {\n return globalThis.__fluenti_i18n\n}\n\n/** Set the global i18n instance. Called by `<I18nProvider>` on mount. */\nexport function setGlobalI18n(instance: FluentiCoreInstanceFull): void {\n globalThis.__fluenti_i18n = instance\n}\n\n/** Clear the global i18n instance. Primarily for testing. */\nexport function clearGlobalI18n(): void {\n globalThis.__fluenti_i18n = undefined\n}\n","import { useEffect, useMemo } from 'react'\nimport { I18nContext } from './context'\nimport type { FluentiProviderProps, FluentiContext } from './types'\nimport type { FluentiInstance } from './create-fluenti'\nimport { createFluenti } from './create-fluenti'\nimport { setGlobalI18n } from './global-registry'\n\n/**\n * Internal provider that uses a pre-created `FluentiInstance`.\n */\nfunction InstanceProvider({ instance, children }: { instance: FluentiInstance; children: React.ReactNode }) {\n const ctx: FluentiContext = useMemo(\n () => ({\n t: instance.t,\n d: instance.d,\n n: instance.n,\n format: instance.format,\n loadMessages: instance.loadMessages,\n getLocales: instance.getLocales,\n locale: instance.locale,\n setLocale: instance.setLocale,\n isLoading: instance.isLoading,\n loadedLocales: instance.loadedLocales,\n preloadLocale: instance.preloadLocale,\n te: instance.te,\n tm: instance.tm,\n // Internal: used by __useI18n hook and compiled components — not part of public API\n i18n: instance.i18n,\n }) as FluentiContext,\n [instance],\n )\n\n return <I18nContext.Provider value={ctx}>{children}</I18nContext.Provider>\n}\n\n/**\n * Provides the Fluenti i18n context to the React component tree.\n *\n * Accepts either a `locale` + `messages` pair for inline configuration,\n * or a pre-created `instance` from `createFluenti()`.\n *\n * @example\n * ```tsx\n * import { I18nProvider, useI18n } from '@fluenti/react'\n * import messages from './locales/compiled/en.js'\n *\n * function App() {\n * return (\n * <I18nProvider locale=\"en\" messages={{ en: messages }}>\n * <Content />\n * </I18nProvider>\n * )\n * }\n *\n * function Content() {\n * const { t } = useI18n()\n * return <h1>{t`Welcome to our app`}</h1>\n * }\n * ```\n *\n * @example Using a pre-created instance\n * ```tsx\n * import { I18nProvider, createFluenti } from '@fluenti/react'\n * import messages from './locales/compiled/en.js'\n *\n * const i18n = createFluenti({ locale: 'en', messages: { en: messages } })\n *\n * function App() {\n * return (\n * <I18nProvider instance={i18n}>\n * <Content />\n * </I18nProvider>\n * )\n * }\n * ```\n */\nexport function I18nProvider(props: FluentiProviderProps) {\n if (props.instance) {\n return <InstanceProvider instance={props.instance}>{props.children}</InstanceProvider>\n }\n\n return <InlineProvider {...props} />\n}\n\n/**\n * Inline provider that delegates to `createFluenti()` for state management.\n */\nfunction InlineProvider({\n locale,\n fallbackLocale,\n messages,\n loadMessages,\n fallbackChain,\n dateFormats,\n numberFormats,\n missing,\n diagnostics,\n interpolate,\n children,\n}: FluentiProviderProps) {\n const instance = createFluenti({\n locale: locale ?? 'en',\n messages,\n loadMessages,\n fallbackLocale,\n fallbackChain,\n dateFormats,\n numberFormats,\n missing,\n diagnostics,\n interpolate,\n })\n\n // Set global i18n instance for webpack loader / vite plugin access\n useEffect(() => {\n setGlobalI18n(instance.i18n)\n }, [instance.i18n])\n\n return <InstanceProvider instance={instance}>{children}</InstanceProvider>\n}\n","import { useContext } from 'react'\nimport { I18nContext } from '../context'\nimport type { FluentiContext } from '../types'\n\n/**\n * Primary hook for accessing i18n functions.\n *\n * Returns locale, setLocale, isLoading, loadedLocales, preloadLocale,\n * and the underlying i18n instance with t(), d(), n() methods.\n *\n * @throws If used outside of `<I18nProvider>`\n */\nexport function useI18n(): FluentiContext {\n const ctx = useContext(I18nContext)\n if (!ctx) {\n throw new Error(\n '[fluenti] useI18n() must be used within an <I18nProvider>. ' +\n 'Wrap your app with <I18nProvider> to provide i18n context.',\n )\n }\n return ctx\n}\n\n/**\n * Shorthand hook that returns only the current locale string.\n *\n * @example\n * ```tsx\n * const locale = useLocale() // 'en'\n * ```\n */\nexport function useLocale(): string {\n return useI18n().locale\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/react' 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"],"mappings":"0MAgFA,SAAS,EAAe,EAAgE,CACtF,IAAM,EAAmC,EAAE,CA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AS,aACvB,WAAY,EAAS,WACrB,OAAQ,EAAS,OACjB,UAAW,EAAS,UACpB,UAAW,EAAS,UACpB,cAAe,EAAS,cACxB,cAAe,EAAS,cACxB,GAAI,EAAS,GACb,GAAI,EAAS,GAEb,KAAM,EAAS,KAChB,EACD,CAAC,EAAS,CACX,CAED,OAAO,EAAA,EAAA,KAAC,EAAA,EAAY,SAAb,CAAsB,MAAO,EAAM,WAAgC,CAAA,CA4C5E,SAAgB,EAAa,EAA6B,CAKxD,OAJI,EAAM,UACD,EAAA,EAAA,KAAC,EAAD,CAAkB,SAAU,EAAM,kBAAW,EAAM,SAA4B,CAAA,EAGjF,EAAA,EAAA,KAAC,EAAD,CAAgB,GAAI,EAAS,CAAA,CAMtC,SAAS,EAAe,CACtB,SACA,iBACA,WACA,eACA,gBACA,cACA,gBACA,UACA,cACA,cACA,YACuB,CACvB,IAAM,EAAW,EAAc,CAC7B,OAAQ,GAAU,KAClB,WACA,eACA,iBACA,gBACA,cACA,gBACA,UACA,cACA,cACD,CAAC,CAOF,OAJA,EAAA,EAAA,eAAgB,CACd,EAAc,EAAS,KAAK,EAC3B,CAAC,EAAS,KAAK,CAAC,EAEZ,EAAA,EAAA,KAAC,EAAD,CAA4B,WAAW,WAA4B,CAAA,CC1G5E,SAAgB,GAA0B,CACxC,IAAM,GAAA,EAAA,EAAA,YAAiB,EAAA,EAAY,CACnC,GAAI,CAAC,EACH,MAAU,MACR,wHAED,CAEH,OAAO,EAWT,SAAgB,GAAoB,CAClC,OAAO,GAAS,CAAC,OC9BnB,IAAa,IAAoB,GAAG,IAAqB,CACvD,MAAU,MACR,iMAGD"}
package/dist/index.js CHANGED
@@ -1,46 +1,46 @@
1
1
  "use client";
2
2
  "use client";
3
- import { t as e } from "./context-DVudCV1o.js";
4
- import { useCallback as t, useContext as n, useEffect as r, useMemo as i, useRef as a, useState as o } from "react";
5
- import { createFluentiCore as s, msg as c } from "@fluenti/core";
6
- import { jsx as l } from "react/jsx-runtime";
3
+ import { i as e, n as t, o as n, r, s as i, t as a } from "./Number-DfzWPfIE.js";
4
+ import { useCallback as o, useContext as s, useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
5
+ import { createFluentiCore as f, msg as p } from "@fluenti/core";
6
+ import { jsx as m } from "react/jsx-runtime";
7
7
  //#region src/create-fluenti.ts
8
- function u(e) {
8
+ function h(e) {
9
9
  let t = {};
10
10
  for (let [n, r] of Object.entries(e)) t[n] = typeof r == "object" && r && "default" in r ? r.default : r;
11
11
  return t;
12
12
  }
13
- function d(e) {
14
- let { locale: n, messages: c, loadMessages: l, fallbackLocale: d, fallbackChain: f, dateFormats: p, numberFormats: m, missing: h, diagnostics: g, interpolate: _ } = e, [v, y] = o(n), [b, x] = o(!1), [S, C] = o(c ? u(c) : {}), [w, T] = o(c ? Object.keys(c) : []), E = a(S);
13
+ function g(e) {
14
+ let { locale: t, messages: n, loadMessages: r, fallbackLocale: i, fallbackChain: a, dateFormats: s, numberFormats: p, missing: m, diagnostics: g, interpolate: _ } = e, [v, y] = d(t), [b, x] = d(!1), [S, C] = d(n ? h(n) : {}), [w, T] = d(n ? Object.keys(n) : []), E = u(S);
15
15
  E.current = S;
16
- let D = a(0), O = Symbol.for("fluenti.runtime.react.v1");
16
+ let D = u(0), O = Symbol.for("fluenti.runtime.react.v1");
17
17
  function k() {
18
18
  let e = globalThis[O];
19
19
  return typeof e == "object" && e ? e : null;
20
20
  }
21
- let A = i(() => {
21
+ let A = l(() => {
22
22
  let e = {
23
23
  locale: v,
24
24
  messages: S
25
25
  };
26
- return d !== void 0 && (e.fallbackLocale = d), f !== void 0 && (e.fallbackChain = f), p !== void 0 && (e.dateFormats = p), m !== void 0 && (e.numberFormats = m), h !== void 0 && (e.missing = h), g !== void 0 && (e.diagnostics = g), _ !== void 0 && (e.interpolate = _), e.devWarnings = e.devWarnings ?? (typeof process < "u" && process.env.NODE_ENV === "development"), s(e);
26
+ return i !== void 0 && (e.fallbackLocale = i), a !== void 0 && (e.fallbackChain = a), s !== void 0 && (e.dateFormats = s), p !== void 0 && (e.numberFormats = p), m !== void 0 && (e.missing = m), g !== void 0 && (e.diagnostics = g), _ !== void 0 && (e.interpolate = _), e.devWarnings = e.devWarnings ?? (typeof process < "u" && process.env.NODE_ENV === "development"), f(e);
27
27
  }, [
28
28
  v,
29
29
  S,
30
- d,
31
- f,
30
+ i,
31
+ a,
32
+ s,
32
33
  p,
33
34
  m,
34
- h,
35
35
  g,
36
36
  _
37
37
  ]);
38
- r(() => {
39
- n !== v && j(n);
40
- }, [n]);
41
- let j = t(async (e) => {
42
- let t = ++D.current, n = l ? k() : null;
43
- if (E.current[e] && !l) {
38
+ c(() => {
39
+ t !== v && j(t);
40
+ }, [t]);
41
+ let j = o(async (e) => {
42
+ let t = ++D.current, n = r ? k() : null;
43
+ if (E.current[e] && !r) {
44
44
  y(e);
45
45
  return;
46
46
  }
@@ -53,15 +53,15 @@ function d(e) {
53
53
  y(e);
54
54
  return;
55
55
  }
56
- if (!l) {
56
+ if (!r) {
57
57
  console.warn(`[fluenti] No messages for locale "${e}" and no loadMessages function provided`);
58
58
  return;
59
59
  }
60
60
  x(!0);
61
61
  try {
62
- let r = await l(e);
62
+ let i = await r(e);
63
63
  if (t !== D.current) return;
64
- let i = typeof r == "object" && r && "default" in r ? r.default : r;
64
+ let a = typeof i == "object" && i && "default" in i ? i.default : i;
65
65
  try {
66
66
  n?.__switchLocale && await n.__switchLocale(e);
67
67
  } catch (t) {
@@ -70,31 +70,31 @@ function d(e) {
70
70
  if (t !== D.current) return;
71
71
  C((t) => ({
72
72
  ...t,
73
- [e]: i
73
+ [e]: a
74
74
  })), T((t) => [...new Set([...t, e])]), y(e);
75
75
  } catch (n) {
76
76
  t === D.current && console.error(`[fluenti] Failed to load locale "${e}"`, n);
77
77
  } finally {
78
78
  t === D.current && x(!1);
79
79
  }
80
- }, [l]), M = t(async (e) => {
81
- if (!(E.current[e] || !l)) try {
82
- let t = await l(e), n = typeof t == "object" && t && "default" in t ? t.default : t;
80
+ }, [r]), M = o(async (e) => {
81
+ if (!(E.current[e] || !r)) try {
82
+ let t = await r(e), n = typeof t == "object" && t && "default" in t ? t.default : t;
83
83
  C((t) => ({
84
84
  ...t,
85
85
  [e]: n
86
86
  })), T((t) => [...new Set([...t, e])]);
87
- let r = k();
88
- r?.__preloadLocale && await r.__preloadLocale(e);
87
+ let i = k();
88
+ i?.__preloadLocale && await i.__preloadLocale(e);
89
89
  } catch {}
90
- }, [l]), N = t((e, t) => {
90
+ }, [r]), N = o((e, t) => {
91
91
  let n = S[t ?? v];
92
92
  return n !== void 0 && e in n;
93
- }, [S, v]), P = t((e, t) => {
93
+ }, [S, v]), P = o((e, t) => {
94
94
  let n = S[t ?? v];
95
95
  if (n) return n[e];
96
96
  }, [S, v]);
97
- return i(() => ({
97
+ return l(() => ({
98
98
  t: A.t.bind(A),
99
99
  d: A.d.bind(A),
100
100
  n: A.n.bind(A),
@@ -122,75 +122,75 @@ function d(e) {
122
122
  }
123
123
  //#endregion
124
124
  //#region src/global-registry.ts
125
- function f(e) {
125
+ function _(e) {
126
126
  globalThis.__fluenti_i18n = e;
127
127
  }
128
128
  //#endregion
129
129
  //#region src/provider.tsx
130
- function p({ instance: t, children: n }) {
131
- let r = i(() => ({
132
- t: t.t,
133
- d: t.d,
134
- n: t.n,
135
- format: t.format,
136
- loadMessages: t.loadMessages,
137
- getLocales: t.getLocales,
138
- locale: t.locale,
139
- setLocale: t.setLocale,
140
- isLoading: t.isLoading,
141
- loadedLocales: t.loadedLocales,
142
- preloadLocale: t.preloadLocale,
143
- te: t.te,
144
- tm: t.tm,
145
- i18n: t.i18n
146
- }), [t]);
147
- return /* @__PURE__ */ l(e.Provider, {
148
- value: r,
149
- children: n
130
+ function v({ instance: e, children: t }) {
131
+ let n = l(() => ({
132
+ t: e.t,
133
+ d: e.d,
134
+ n: e.n,
135
+ format: e.format,
136
+ loadMessages: e.loadMessages,
137
+ getLocales: e.getLocales,
138
+ locale: e.locale,
139
+ setLocale: e.setLocale,
140
+ isLoading: e.isLoading,
141
+ loadedLocales: e.loadedLocales,
142
+ preloadLocale: e.preloadLocale,
143
+ te: e.te,
144
+ tm: e.tm,
145
+ i18n: e.i18n
146
+ }), [e]);
147
+ return /* @__PURE__ */ m(i.Provider, {
148
+ value: n,
149
+ children: t
150
150
  });
151
151
  }
152
- function m(e) {
153
- return e.instance ? /* @__PURE__ */ l(p, {
152
+ function y(e) {
153
+ return e.instance ? /* @__PURE__ */ m(v, {
154
154
  instance: e.instance,
155
155
  children: e.children
156
- }) : /* @__PURE__ */ l(h, { ...e });
156
+ }) : /* @__PURE__ */ m(b, { ...e });
157
157
  }
158
- function h({ locale: e, fallbackLocale: t, messages: n, loadMessages: i, fallbackChain: a, dateFormats: o, numberFormats: s, missing: c, diagnostics: u, interpolate: m, children: h }) {
159
- let g = d({
158
+ function b({ locale: e, fallbackLocale: t, messages: n, loadMessages: r, fallbackChain: i, dateFormats: a, numberFormats: o, missing: s, diagnostics: l, interpolate: u, children: d }) {
159
+ let f = g({
160
160
  locale: e ?? "en",
161
161
  messages: n,
162
- loadMessages: i,
162
+ loadMessages: r,
163
163
  fallbackLocale: t,
164
- fallbackChain: a,
165
- dateFormats: o,
166
- numberFormats: s,
167
- missing: c,
168
- diagnostics: u,
169
- interpolate: m
164
+ fallbackChain: i,
165
+ dateFormats: a,
166
+ numberFormats: o,
167
+ missing: s,
168
+ diagnostics: l,
169
+ interpolate: u
170
170
  });
171
- return r(() => {
172
- f(g.i18n);
173
- }, [g.i18n]), /* @__PURE__ */ l(p, {
174
- instance: g,
175
- children: h
171
+ return c(() => {
172
+ _(f.i18n);
173
+ }, [f.i18n]), /* @__PURE__ */ m(v, {
174
+ instance: f,
175
+ children: d
176
176
  });
177
177
  }
178
178
  //#endregion
179
179
  //#region src/hooks/useI18n.ts
180
- function g() {
181
- let t = n(e);
182
- if (!t) throw Error("[fluenti] useI18n() must be used within an <I18nProvider>. Wrap your app with <I18nProvider> to provide i18n context.");
183
- return t;
180
+ function x() {
181
+ let e = s(i);
182
+ if (!e) throw Error("[fluenti] useI18n() must be used within an <I18nProvider>. Wrap your app with <I18nProvider> to provide i18n context.");
183
+ return e;
184
184
  }
185
- function _() {
186
- return g().locale;
185
+ function S() {
186
+ return x().locale;
187
187
  }
188
188
  //#endregion
189
189
  //#region src/compile-time-t.ts
190
- var v = ((...e) => {
190
+ var C = ((...e) => {
191
191
  throw Error("[fluenti] `t` imported from '@fluenti/react' 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(...).");
192
192
  });
193
193
  //#endregion
194
- export { e as I18nContext, m as I18nProvider, d as createFluenti, c as msg, v as t, g as useI18n, _ as useLocale };
194
+ export { t as DateTime, i as I18nContext, y as I18nProvider, a as NumberFormat, e as Plural, r as Select, n as Trans, g as createFluenti, p as msg, C as t, x as useI18n, S as useLocale };
195
195
 
196
196
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile-time-t.d.ts","sourceRoot":"","sources":["../../../src/compile-time-t.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD,eAAO,MAAM,CAAC,EAAE,YAME,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DateTime.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime.tsx"],"names":[],"mappings":"AAGA,MAAM,WAAW,oBAAoB;IACnC,2BAA2B;IAC3B,KAAK,EAAE,IAAI,GAAG,MAAM,CAAA;IACpB,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,4DAMnB,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Number.d.ts","sourceRoot":"","sources":["../../../../src/components/Number.tsx"],"names":[],"mappings":"AAGA,MAAM,WAAW,iBAAiB;IAChC,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,+BAA+B;AAC/B,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAA;AAExD;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,yDAMvB,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Plural.d.ts","sourceRoot":"","sources":["../../../../src/components/Plural.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAMxD,MAAM,WAAW,kBAAkB;IACjC,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,2DAA2D;IAC3D,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,8DAA8D;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,2CAA2C;IAC3C,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,6CAA6C;IAC7C,GAAG,CAAC,EAAE,SAAS,CAAA;IACf,+BAA+B;IAC/B,GAAG,CAAC,EAAE,SAAS,CAAA;IACf,wCAAwC;IACxC,GAAG,CAAC,EAAE,SAAS,CAAA;IACf,gBAAgB;IAChB,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,0BAA0B;IAC1B,KAAK,EAAE,SAAS,CAAA;IAChB,8CAA8C;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,0DA4DjB,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../../src/components/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAKvE,MAAM,WAAW,kBAAkB;IACjC,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,2DAA2D;IAC3D,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,8DAA8D;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,mBAAmB;IACnB,KAAK,EAAE,SAAS,CAAA;IAChB,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IACnC,wFAAwF;IACxF,GAAG,CAAC,EAAE,MAAM,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAA;IACvC,uDAAuD;IACvD,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,iBAAiB,GAAG,SAAS,CAAA;CACrG;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,MAAM,0DAwDjB,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import { ReactElement, ReactNode } from 'react';
2
2
  export interface FluentiTransProps {
3
3
  /** Source text with embedded components */
4
- children: ReactNode;
4
+ children?: ReactNode;
5
5
  /** Override auto-generated hash ID */
6
6
  id?: string;
7
7
  /** Message context used for identity and translator disambiguation */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Trans.d.ts","sourceRoot":"","sources":["../../../../src/components/Trans.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AAId,MAAM,WAAW,iBAAiB;IAChC,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,sCAAsC;IACtC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,wFAAwF;IACxF,GAAG,CAAC,EAAE,MAAM,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAA;IACvC,4BAA4B;IAC5B,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,SAAS,KAAK,SAAS,CAAA;IAC9C,0DAA0D;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,2DAA2D;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,8DAA8D;IAC9D,YAAY,CAAC,EAAE,YAAY,EAAE,CAAA;CAC9B;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,yDAyDhB,CAAA"}
@@ -0,0 +1,46 @@
1
+ export interface FluentiCompiledTransProps {
2
+ message: string;
3
+ id?: string;
4
+ context?: string;
5
+ comment?: string;
6
+ tag?: keyof React.JSX.IntrinsicElements;
7
+ render?: (translation: React.ReactNode) => React.ReactNode;
8
+ }
9
+ export interface FluentiCompiledPluralProps {
10
+ value: number;
11
+ message: string;
12
+ id?: string;
13
+ context?: string;
14
+ comment?: string;
15
+ }
16
+ export interface FluentiCompiledSelectProps {
17
+ value: string;
18
+ message: string;
19
+ valueMap?: Record<string, string>;
20
+ id?: string;
21
+ context?: string;
22
+ comment?: string;
23
+ tag?: keyof React.JSX.IntrinsicElements;
24
+ }
25
+ export interface FluentiCompiledRichTransProps extends FluentiCompiledTransProps {
26
+ components: React.ReactElement[];
27
+ }
28
+ export interface FluentiCompiledRichPluralProps extends FluentiCompiledPluralProps {
29
+ components: React.ReactElement[];
30
+ }
31
+ export interface FluentiCompiledRichSelectProps extends FluentiCompiledSelectProps {
32
+ components: React.ReactElement[];
33
+ }
34
+ /** @internal Build-plugin fast path for plain-text `<Trans>` usage. */
35
+ export declare const __FluentiCompiledTrans: import('react').NamedExoticComponent<FluentiCompiledTransProps>;
36
+ /** @internal Build-plugin fast path for rich-text `<Trans>` usage. */
37
+ export declare const __FluentiCompiledRichTrans: import('react').NamedExoticComponent<FluentiCompiledRichTransProps>;
38
+ /** @internal Build-plugin fast path for plain-text `<Plural>` usage. */
39
+ export declare const __FluentiCompiledPlural: import('react').NamedExoticComponent<FluentiCompiledPluralProps>;
40
+ /** @internal Build-plugin fast path for plain-text `<Select>` usage. */
41
+ export declare const __FluentiCompiledSelect: import('react').NamedExoticComponent<FluentiCompiledSelectProps>;
42
+ /** @internal Build-plugin fast path for rich-text `<Plural>` usage. */
43
+ export declare const __FluentiCompiledRichPlural: import('react').NamedExoticComponent<FluentiCompiledRichPluralProps>;
44
+ /** @internal Build-plugin fast path for rich-text `<Select>` usage. */
45
+ export declare const __FluentiCompiledRichSelect: import('react').NamedExoticComponent<FluentiCompiledRichSelectProps>;
46
+ //# sourceMappingURL=compiled.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compiled.d.ts","sourceRoot":"","sources":["../../../../src/components/compiled.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,MAAM,CAAA;IACf,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,GAAG,CAAC,EAAE,MAAM,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAA;IACvC,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,KAAK,CAAC,SAAS,KAAK,KAAK,CAAC,SAAS,CAAA;CAC3D;AAED,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,GAAG,CAAC,EAAE,MAAM,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAA;CACxC;AAED,MAAM,WAAW,6BAA8B,SAAQ,yBAAyB;IAC9E,UAAU,EAAE,KAAK,CAAC,YAAY,EAAE,CAAA;CACjC;AAED,MAAM,WAAW,8BAA+B,SAAQ,0BAA0B;IAChF,UAAU,EAAE,KAAK,CAAC,YAAY,EAAE,CAAA;CACjC;AAED,MAAM,WAAW,8BAA+B,SAAQ,0BAA0B;IAChF,UAAU,EAAE,KAAK,CAAC,YAAY,EAAE,CAAA;CACjC;AAaD,uEAAuE;AACvE,eAAO,MAAM,sBAAsB,iEAuBjC,CAAA;AAEF,sEAAsE;AACtE,eAAO,MAAM,0BAA0B,qEA4BrC,CAAA;AAEF,wEAAwE;AACxE,eAAO,MAAM,uBAAuB,kEAuBlC,CAAA;AAEF,wEAAwE;AACxE,eAAO,MAAM,uBAAuB,kEAyBlC,CAAA;AAEF,uEAAuE;AACvE,eAAO,MAAM,2BAA2B,sEAqBtC,CAAA;AAEF,uEAAuE;AACvE,eAAO,MAAM,2BAA2B,sEA6BtC,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { MessageDescriptor } from '@fluenti/core';
2
- import { buildICUPluralMessage, buildICUSelectMessage, normalizeSelectForms } from '@fluenti/core/internal';
2
+ import { buildICUPluralMessage, buildICUSelectMessage, normalizeSelectForms } from '@fluenti/core/runtime';
3
3
  import { ReactElement, ReactNode } from 'react';
4
4
  export { buildICUPluralMessage, buildICUSelectMessage, normalizeSelectForms };
5
5
  export interface RichMessagePart {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icu-rich.d.ts","sourceRoot":"","sources":["../../../../src/components/icu-rich.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EAErB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGpD,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,CAAA;AAE7E,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,YAAY,EAAE,CAAA;CAC3B;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,eAAe,CAMlE;AAED,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,EACjD,IAAI,EAAE,SAAS,CAAC,EAAE,EAClB,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC,GAC3E;IACD,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC7D,UAAU,EAAE,YAAY,EAAE,CAAA;CAC3B,CAoBA;AAED,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,iBAAiB,EAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC3C,SAAS,EAAE,CAAC,UAAU,EAAE,iBAAiB,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,EACtF,UAAU,EAAE,YAAY,EAAE,GACzB,SAAS,CAGX"}
@@ -0,0 +1,9 @@
1
+ import { PluralCategory } from '@fluenti/core/runtime';
2
+ import { ReactNode } from 'react';
3
+ export declare function resolveCompiledMessageId(id: string | undefined, message: string, context: string | undefined): string;
4
+ export declare function buildPlainPluralMessage(forms: Record<PluralCategory, ReactNode | undefined>, offset?: number): string | undefined;
5
+ export declare function buildPlainSelectMessage(forms: Record<string, ReactNode | undefined>): {
6
+ message: string;
7
+ valueMap: Record<string, string>;
8
+ } | undefined;
9
+ //# sourceMappingURL=plain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plain.d.ts","sourceRoot":"","sources":["../../../../src/components/plain.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,wBAAgB,wBAAwB,CACtC,EAAE,EAAE,MAAM,GAAG,SAAS,EACtB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,MAAM,CAER;AAMD,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,MAAM,CAAC,cAAc,EAAE,SAAS,GAAG,SAAS,CAAC,EACpD,MAAM,CAAC,EAAE,MAAM,GACd,MAAM,GAAG,SAAS,CAYpB;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC,GAC3C;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG,SAAS,CAgBnE"}
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
- import { PluralCategory } from '@fluenti/core/internal';
3
- export { PLURAL_CATEGORIES, type PluralCategory } from '@fluenti/core/internal';
2
+ import { PluralCategory } from '@fluenti/core/runtime';
3
+ export { PLURAL_CATEGORIES, type PluralCategory } from '@fluenti/core/runtime';
4
4
  /**
5
5
  * Resolve which plural category to use.
6
6
  * Checks for exact =0 match first, then falls back to CLDR rules.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plural-core.d.ts","sourceRoot":"","sources":["../../../../src/components/plural-core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAE3D,OAAO,EAAE,iBAAiB,EAAE,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAE9E;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,cAAc,CAKhB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,CAKzE"}
@@ -1,5 +1,5 @@
1
1
  import { ReactNode, ReactElement } from 'react';
2
- import { hashMessage } from '@fluenti/core/internal';
2
+ import { hashMessage } from '@fluenti/core/runtime';
3
3
  export { hashMessage };
4
4
  /**
5
5
  * Extract a message string and component list from React children.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trans-core.d.ts","sourceRoot":"","sources":["../../../../src/components/trans-core.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,SAAS,EACd,KAAK,YAAY,EAClB,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,WAAW,EAAiB,MAAM,uBAAuB,CAAA;AAElE,OAAO,EAAE,WAAW,EAAE,CAAA;AAEtB;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,SAAS,GAAG;IACnD,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,YAAY,EAAE,CAAA;CAC3B,CA4BA;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,YAAY,EAAE,GACzB,SAAS,CA0DX"}
@@ -8,5 +8,5 @@ export { DateTime } from './components/DateTime';
8
8
  export type { FluentiDateTimeProps } from './components/DateTime';
9
9
  export { NumberFormat } from './components/Number';
10
10
  export type { NumberFormatProps, FluentiNumberFormatProps } from './components/Number';
11
- export { interpolate } from '@fluenti/core/internal';
11
+ export { __FluentiCompiledTrans, __FluentiCompiledRichTrans, __FluentiCompiledPlural, __FluentiCompiledSelect, __FluentiCompiledRichPlural, __FluentiCompiledRichSelect, } from './components/compiled';
12
12
  //# sourceMappingURL=components-entry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components-entry.d.ts","sourceRoot":"","sources":["../../../src/components-entry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,YAAY,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,YAAY,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AACtF,OAAO,EACL,sBAAsB,EACtB,0BAA0B,EAC1B,uBAAuB,EACvB,uBAAuB,EACvB,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,uBAAuB,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C,eAAO,MAAM,WAAW,gDAA6D,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-fluenti.d.ts","sourceRoot":"","sources":["../../../src/create-fluenti.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,uBAAuB,IAAI,sBAAsB,EACjD,eAAe,EACf,MAAM,EACN,QAAQ,EACR,WAAW,EACX,iBAAiB,EACjB,mBA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MAAM,MAAM,EAAE,CAAA;IAC1B,qDAAqD;IACrD,aAAa,EAAE,MAAM,EAAE,CAAA;CACxB;AAYD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,eAAe,CAoLpE"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"global-registry.d.ts","sourceRoot":"","sources":["../../../src/global-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAE5D;;;;;;GAMG;AAEH,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,cAAc,EAAE,uBAAuB,GAAG,SAAS,CAAA;CACxD;AAED,8DAA8D;AAC9D,wBAAgB,aAAa,IAAI,uBAAuB,GAAG,SAAS,CAEnE;AAED,yEAAyE;AACzE,wBAAgB,aAAa,CAAC,QAAQ,EAAE,uBAAuB,GAAG,IAAI,CAErE;AAED,6DAA6D;AAC7D,wBAAgB,eAAe,IAAI,IAAI,CAEtC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"__useI18n.d.ts","sourceRoot":"","sources":["../../../../src/hooks/__useI18n.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAE5D;;;;;;;;GAQG;AACH,wBAAgB,SAAS,IAAI,uBAAuB,CAUnD"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useI18n.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useI18n.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE9C;;;;;;;GAOG;AACH,wBAAgB,OAAO,IAAI,cAAc,CASxC;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAElC"}