preact-intlayer 9.0.0-canary.8 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. package/dist/cjs/IntlayerNode.cjs +1 -2
  2. package/dist/cjs/IntlayerNode.cjs.map +1 -1
  3. package/dist/cjs/UI/ContentSelector.cjs +0 -1
  4. package/dist/cjs/UI/ContentSelector.cjs.map +1 -1
  5. package/dist/cjs/analytics/AnalyticsProvider.cjs +17 -0
  6. package/dist/cjs/analytics/AnalyticsProvider.cjs.map +1 -0
  7. package/dist/cjs/analytics/exposureSink.cjs +27 -0
  8. package/dist/cjs/analytics/exposureSink.cjs.map +1 -0
  9. package/dist/cjs/analytics/index.cjs +10 -0
  10. package/dist/cjs/analytics/useAnalytics.cjs +52 -0
  11. package/dist/cjs/analytics/useAnalytics.cjs.map +1 -0
  12. package/dist/cjs/analytics/useConversion.cjs +30 -0
  13. package/dist/cjs/analytics/useConversion.cjs.map +1 -0
  14. package/dist/cjs/analytics/useExperiment.cjs +63 -0
  15. package/dist/cjs/analytics/useExperiment.cjs.map +1 -0
  16. package/dist/cjs/client/IntlayerProvider.cjs +6 -2
  17. package/dist/cjs/client/IntlayerProvider.cjs.map +1 -1
  18. package/dist/cjs/client/index.cjs +1 -1
  19. package/dist/cjs/client/t.cjs +0 -1
  20. package/dist/cjs/client/t.cjs.map +1 -1
  21. package/dist/cjs/client/useContent.cjs.map +1 -1
  22. package/dist/cjs/client/useDictionary.cjs +0 -1
  23. package/dist/cjs/client/useDictionary.cjs.map +1 -1
  24. package/dist/cjs/client/useDictionaryAsync.cjs +0 -1
  25. package/dist/cjs/client/useDictionaryAsync.cjs.map +1 -1
  26. package/dist/cjs/client/useDictionaryDynamic.cjs +1 -2
  27. package/dist/cjs/client/useDictionaryDynamic.cjs.map +1 -1
  28. package/dist/cjs/client/useIntlayer.cjs +0 -1
  29. package/dist/cjs/client/useIntlayer.cjs.map +1 -1
  30. package/dist/cjs/client/useLoadDynamic.cjs.map +1 -1
  31. package/dist/cjs/client/useLocale.cjs +0 -1
  32. package/dist/cjs/client/useLocale.cjs.map +1 -1
  33. package/dist/cjs/client/useLocaleBase.cjs +0 -1
  34. package/dist/cjs/client/useLocaleBase.cjs.map +1 -1
  35. package/dist/cjs/client/useLocaleStorage.cjs +0 -1
  36. package/dist/cjs/client/useLocaleStorage.cjs.map +1 -1
  37. package/dist/cjs/client/usePathname.cjs +0 -1
  38. package/dist/cjs/client/usePathname.cjs.map +1 -1
  39. package/dist/cjs/client/useTraduction.cjs +0 -1
  40. package/dist/cjs/client/useTraduction.cjs.map +1 -1
  41. package/dist/cjs/editor/ContentSelector.cjs +0 -1
  42. package/dist/cjs/editor/ContentSelector.cjs.map +1 -1
  43. package/dist/cjs/editor/EditorProvider.cjs.map +1 -1
  44. package/dist/cjs/editor/useEditor.cjs +0 -1
  45. package/dist/cjs/editor/useEditor.cjs.map +1 -1
  46. package/dist/cjs/format/useCompact.cjs +0 -1
  47. package/dist/cjs/format/useCompact.cjs.map +1 -1
  48. package/dist/cjs/format/useCurrency.cjs +0 -1
  49. package/dist/cjs/format/useCurrency.cjs.map +1 -1
  50. package/dist/cjs/format/useDate.cjs +0 -1
  51. package/dist/cjs/format/useDate.cjs.map +1 -1
  52. package/dist/cjs/format/useIntl.cjs +0 -1
  53. package/dist/cjs/format/useIntl.cjs.map +1 -1
  54. package/dist/cjs/format/useList.cjs +0 -1
  55. package/dist/cjs/format/useList.cjs.map +1 -1
  56. package/dist/cjs/format/useNumber.cjs +0 -1
  57. package/dist/cjs/format/useNumber.cjs.map +1 -1
  58. package/dist/cjs/format/usePercentage.cjs +0 -1
  59. package/dist/cjs/format/usePercentage.cjs.map +1 -1
  60. package/dist/cjs/format/useRelativeTime.cjs +0 -1
  61. package/dist/cjs/format/useRelativeTime.cjs.map +1 -1
  62. package/dist/cjs/format/useUnit.cjs +0 -1
  63. package/dist/cjs/format/useUnit.cjs.map +1 -1
  64. package/dist/cjs/getDictionary.cjs +0 -1
  65. package/dist/cjs/getDictionary.cjs.map +1 -1
  66. package/dist/cjs/getIntlayer.cjs +0 -1
  67. package/dist/cjs/getIntlayer.cjs.map +1 -1
  68. package/dist/cjs/html/HTMLProvider.cjs +0 -1
  69. package/dist/cjs/html/HTMLProvider.cjs.map +1 -1
  70. package/dist/cjs/html/HTMLRenderer.cjs +0 -1
  71. package/dist/cjs/html/HTMLRenderer.cjs.map +1 -1
  72. package/dist/cjs/index.cjs +9 -1
  73. package/dist/cjs/markdown/MarkdownProvider.cjs +0 -1
  74. package/dist/cjs/markdown/MarkdownProvider.cjs.map +1 -1
  75. package/dist/cjs/markdown/MarkdownRenderer.cjs +0 -1
  76. package/dist/cjs/markdown/MarkdownRenderer.cjs.map +1 -1
  77. package/dist/cjs/markdown/MarkdownRendererPlugin.cjs +0 -1
  78. package/dist/cjs/markdown/MarkdownRendererPlugin.cjs.map +1 -1
  79. package/dist/cjs/markdown/compiler.cjs +0 -1
  80. package/dist/cjs/markdown/compiler.cjs.map +1 -1
  81. package/dist/cjs/markdown/runtime.cjs +0 -1
  82. package/dist/cjs/markdown/runtime.cjs.map +1 -1
  83. package/dist/cjs/plugins.cjs +46 -36
  84. package/dist/cjs/plugins.cjs.map +1 -1
  85. package/dist/cjs/preactElement/renderPreactElement.cjs +0 -1
  86. package/dist/cjs/preactElement/renderPreactElement.cjs.map +1 -1
  87. package/dist/esm/IntlayerNode.mjs +1 -1
  88. package/dist/esm/IntlayerNode.mjs.map +1 -1
  89. package/dist/esm/UI/ContentSelector.mjs.map +1 -1
  90. package/dist/esm/analytics/AnalyticsProvider.mjs +16 -0
  91. package/dist/esm/analytics/AnalyticsProvider.mjs.map +1 -0
  92. package/dist/esm/analytics/exposureSink.mjs +24 -0
  93. package/dist/esm/analytics/exposureSink.mjs.map +1 -0
  94. package/dist/esm/analytics/index.mjs +6 -0
  95. package/dist/esm/analytics/useAnalytics.mjs +51 -0
  96. package/dist/esm/analytics/useAnalytics.mjs.map +1 -0
  97. package/dist/esm/analytics/useConversion.mjs +29 -0
  98. package/dist/esm/analytics/useConversion.mjs.map +1 -0
  99. package/dist/esm/analytics/useExperiment.mjs +62 -0
  100. package/dist/esm/analytics/useExperiment.mjs.map +1 -0
  101. package/dist/esm/client/IntlayerProvider.mjs +6 -1
  102. package/dist/esm/client/IntlayerProvider.mjs.map +1 -1
  103. package/dist/esm/client/index.mjs +1 -1
  104. package/dist/esm/client/t.mjs.map +1 -1
  105. package/dist/esm/client/useContent.mjs.map +1 -1
  106. package/dist/esm/client/useDictionary.mjs.map +1 -1
  107. package/dist/esm/client/useDictionaryAsync.mjs.map +1 -1
  108. package/dist/esm/client/useDictionaryDynamic.mjs +1 -1
  109. package/dist/esm/client/useDictionaryDynamic.mjs.map +1 -1
  110. package/dist/esm/client/useIntlayer.mjs.map +1 -1
  111. package/dist/esm/client/useLoadDynamic.mjs.map +1 -1
  112. package/dist/esm/client/useLocale.mjs.map +1 -1
  113. package/dist/esm/client/useLocaleBase.mjs.map +1 -1
  114. package/dist/esm/client/useLocaleStorage.mjs.map +1 -1
  115. package/dist/esm/client/usePathname.mjs.map +1 -1
  116. package/dist/esm/client/useTraduction.mjs.map +1 -1
  117. package/dist/esm/editor/ContentSelector.mjs.map +1 -1
  118. package/dist/esm/editor/EditorProvider.mjs.map +1 -1
  119. package/dist/esm/editor/useEditor.mjs.map +1 -1
  120. package/dist/esm/format/useCompact.mjs.map +1 -1
  121. package/dist/esm/format/useCurrency.mjs.map +1 -1
  122. package/dist/esm/format/useDate.mjs.map +1 -1
  123. package/dist/esm/format/useIntl.mjs.map +1 -1
  124. package/dist/esm/format/useList.mjs.map +1 -1
  125. package/dist/esm/format/useNumber.mjs.map +1 -1
  126. package/dist/esm/format/usePercentage.mjs.map +1 -1
  127. package/dist/esm/format/useRelativeTime.mjs.map +1 -1
  128. package/dist/esm/format/useUnit.mjs.map +1 -1
  129. package/dist/esm/getDictionary.mjs.map +1 -1
  130. package/dist/esm/getIntlayer.mjs.map +1 -1
  131. package/dist/esm/html/HTMLProvider.mjs.map +1 -1
  132. package/dist/esm/html/HTMLRenderer.mjs.map +1 -1
  133. package/dist/esm/index.mjs +6 -2
  134. package/dist/esm/markdown/MarkdownProvider.mjs.map +1 -1
  135. package/dist/esm/markdown/MarkdownRenderer.mjs.map +1 -1
  136. package/dist/esm/markdown/MarkdownRendererPlugin.mjs.map +1 -1
  137. package/dist/esm/markdown/compiler.mjs.map +1 -1
  138. package/dist/esm/markdown/runtime.mjs.map +1 -1
  139. package/dist/esm/plugins.mjs +47 -37
  140. package/dist/esm/plugins.mjs.map +1 -1
  141. package/dist/esm/preactElement/renderPreactElement.mjs.map +1 -1
  142. package/dist/types/IntlayerNode.d.ts +1 -6
  143. package/dist/types/IntlayerNode.d.ts.map +1 -1
  144. package/dist/types/UI/ContentSelector.d.ts +0 -1
  145. package/dist/types/UI/ContentSelector.d.ts.map +1 -1
  146. package/dist/types/analytics/AnalyticsProvider.d.ts +12 -0
  147. package/dist/types/analytics/AnalyticsProvider.d.ts.map +1 -0
  148. package/dist/types/analytics/exposureSink.d.ts +32 -0
  149. package/dist/types/analytics/exposureSink.d.ts.map +1 -0
  150. package/dist/types/analytics/index.d.ts +5 -0
  151. package/dist/types/analytics/useAnalytics.d.ts +15 -0
  152. package/dist/types/analytics/useAnalytics.d.ts.map +1 -0
  153. package/dist/types/analytics/useConversion.d.ts +31 -0
  154. package/dist/types/analytics/useConversion.d.ts.map +1 -0
  155. package/dist/types/analytics/useExperiment.d.ts +41 -0
  156. package/dist/types/analytics/useExperiment.d.ts.map +1 -0
  157. package/dist/types/client/IntlayerProvider.d.ts +1 -3
  158. package/dist/types/client/IntlayerProvider.d.ts.map +1 -1
  159. package/dist/types/client/t.d.ts +0 -1
  160. package/dist/types/client/t.d.ts.map +1 -1
  161. package/dist/types/client/useContent.d.ts +3 -4
  162. package/dist/types/client/useContent.d.ts.map +1 -1
  163. package/dist/types/client/useDictionary.d.ts +2 -5
  164. package/dist/types/client/useDictionary.d.ts.map +1 -1
  165. package/dist/types/client/useDictionaryAsync.d.ts +0 -1
  166. package/dist/types/client/useDictionaryAsync.d.ts.map +1 -1
  167. package/dist/types/client/useDictionaryDynamic.d.ts +0 -1
  168. package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -1
  169. package/dist/types/client/useIntlayer.d.ts +2 -5
  170. package/dist/types/client/useIntlayer.d.ts.map +1 -1
  171. package/dist/types/client/useLoadDynamic.d.ts.map +1 -1
  172. package/dist/types/client/useLocale.d.ts +1 -5
  173. package/dist/types/client/useLocale.d.ts.map +1 -1
  174. package/dist/types/client/useLocaleBase.d.ts +2 -4
  175. package/dist/types/client/useLocaleBase.d.ts.map +1 -1
  176. package/dist/types/client/useLocaleStorage.d.ts +5 -10
  177. package/dist/types/client/useLocaleStorage.d.ts.map +1 -1
  178. package/dist/types/client/usePathname.d.ts.map +1 -1
  179. package/dist/types/client/useTraduction.d.ts +0 -1
  180. package/dist/types/client/useTraduction.d.ts.map +1 -1
  181. package/dist/types/editor/ContentSelector.d.ts +0 -1
  182. package/dist/types/editor/ContentSelector.d.ts.map +1 -1
  183. package/dist/types/editor/EditorProvider.d.ts +0 -1
  184. package/dist/types/editor/EditorProvider.d.ts.map +1 -1
  185. package/dist/types/editor/useEditor.d.ts.map +1 -1
  186. package/dist/types/format/useCompact.d.ts +1 -3
  187. package/dist/types/format/useCompact.d.ts.map +1 -1
  188. package/dist/types/format/useCurrency.d.ts +1 -3
  189. package/dist/types/format/useCurrency.d.ts.map +1 -1
  190. package/dist/types/format/useDate.d.ts +0 -1
  191. package/dist/types/format/useDate.d.ts.map +1 -1
  192. package/dist/types/format/useIntl.d.ts +0 -1
  193. package/dist/types/format/useIntl.d.ts.map +1 -1
  194. package/dist/types/format/useList.d.ts +4 -6
  195. package/dist/types/format/useList.d.ts.map +1 -1
  196. package/dist/types/format/useNumber.d.ts +1 -3
  197. package/dist/types/format/useNumber.d.ts.map +1 -1
  198. package/dist/types/format/usePercentage.d.ts +1 -3
  199. package/dist/types/format/usePercentage.d.ts.map +1 -1
  200. package/dist/types/format/useRelativeTime.d.ts +1 -3
  201. package/dist/types/format/useRelativeTime.d.ts.map +1 -1
  202. package/dist/types/format/useUnit.d.ts +1 -3
  203. package/dist/types/format/useUnit.d.ts.map +1 -1
  204. package/dist/types/getDictionary.d.ts +0 -1
  205. package/dist/types/getDictionary.d.ts.map +1 -1
  206. package/dist/types/getIntlayer.d.ts +0 -1
  207. package/dist/types/getIntlayer.d.ts.map +1 -1
  208. package/dist/types/html/HTMLProvider.d.ts +0 -1
  209. package/dist/types/html/HTMLProvider.d.ts.map +1 -1
  210. package/dist/types/html/HTMLRenderer.d.ts +3 -8
  211. package/dist/types/html/HTMLRenderer.d.ts.map +1 -1
  212. package/dist/types/html/types.d.ts +7 -8
  213. package/dist/types/html/types.d.ts.map +1 -1
  214. package/dist/types/index.d.ts +7 -2
  215. package/dist/types/index.d.ts.map +1 -1
  216. package/dist/types/markdown/MarkdownProvider.d.ts +0 -1
  217. package/dist/types/markdown/MarkdownProvider.d.ts.map +1 -1
  218. package/dist/types/markdown/MarkdownRenderer.d.ts +2 -17
  219. package/dist/types/markdown/MarkdownRenderer.d.ts.map +1 -1
  220. package/dist/types/markdown/MarkdownRendererPlugin.d.ts +0 -1
  221. package/dist/types/markdown/MarkdownRendererPlugin.d.ts.map +1 -1
  222. package/dist/types/markdown/compiler.d.ts +0 -1
  223. package/dist/types/markdown/compiler.d.ts.map +1 -1
  224. package/dist/types/markdown/runtime.d.ts +0 -1
  225. package/dist/types/markdown/runtime.d.ts.map +1 -1
  226. package/dist/types/plugins.d.ts +1 -2
  227. package/dist/types/plugins.d.ts.map +1 -1
  228. package/dist/types/preactElement/renderPreactElement.d.ts +0 -1
  229. package/dist/types/preactElement/renderPreactElement.d.ts.map +1 -1
  230. package/package.json +15 -11
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  let preact_hooks = require("preact/hooks");
4
3
  let _intlayer_core_localization = require("@intlayer/core/localization");
5
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"usePathname.cjs","names":[],"sources":["../../../src/client/usePathname.ts"],"sourcesContent":["import { getPathWithoutLocale } from '@intlayer/core/localization';\nimport { useEffect, useMemo, useState } from 'preact/hooks';\n\n/**\n * Preact hook that returns the current pathname with the locale segment removed.\n *\n * Reacts to browser back/forward navigation via the `popstate` event.\n * Falls back to an empty string during server-side rendering.\n *\n * @returns The current pathname without the locale prefix.\n *\n * @example\n * ```tsx\n * import { usePathname } from 'preact-intlayer';\n *\n * const NavItem = ({ href }: { href: string }) => {\n * const pathname = usePathname();\n * return <a class={pathname === href ? 'active' : ''}>{href}</a>;\n * };\n * ```\n */\nexport const usePathname = (): string => {\n const [rawPathname, setRawPathname] = useState<string>(\n typeof window !== 'undefined' ? window.location.pathname : ''\n );\n\n useEffect(() => {\n const handleLocationChange = (): void => {\n setRawPathname(window.location.pathname);\n };\n\n window.addEventListener('popstate', handleLocationChange);\n return () => window.removeEventListener('popstate', handleLocationChange);\n }, []);\n\n return useMemo(() => getPathWithoutLocale(rawPathname), [rawPathname]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,oBAA4B;CACvC,MAAM,CAAC,aAAa,6CAClB,OAAO,WAAW,cAAc,OAAO,SAAS,WAAW,GAC5D;AAED,mCAAgB;EACd,MAAM,6BAAmC;AACvC,kBAAe,OAAO,SAAS,SAAS;;AAG1C,SAAO,iBAAiB,YAAY,qBAAqB;AACzD,eAAa,OAAO,oBAAoB,YAAY,qBAAqB;IACxE,EAAE,CAAC;AAEN,8FAA0C,YAAY,EAAE,CAAC,YAAY,CAAC"}
1
+ {"version":3,"file":"usePathname.cjs","names":[],"sources":["../../../src/client/usePathname.ts"],"sourcesContent":["import { getPathWithoutLocale } from '@intlayer/core/localization';\nimport { useEffect, useMemo, useState } from 'preact/hooks';\n\n/**\n * Preact hook that returns the current pathname with the locale segment removed.\n *\n * Reacts to browser back/forward navigation via the `popstate` event.\n * Falls back to an empty string during server-side rendering.\n *\n * @returns The current pathname without the locale prefix.\n *\n * @example\n * ```tsx\n * import { usePathname } from 'preact-intlayer';\n *\n * const NavItem = ({ href }: { href: string }) => {\n * const pathname = usePathname();\n * return <a class={pathname === href ? 'active' : ''}>{href}</a>;\n * };\n * ```\n */\nexport const usePathname = (): string => {\n const [rawPathname, setRawPathname] = useState<string>(\n typeof window !== 'undefined' ? window.location.pathname : ''\n );\n\n useEffect(() => {\n const handleLocationChange = (): void => {\n setRawPathname(window.location.pathname);\n };\n\n window.addEventListener('popstate', handleLocationChange);\n return () => window.removeEventListener('popstate', handleLocationChange);\n }, []);\n\n return useMemo(() => getPathWithoutLocale(rawPathname), [rawPathname]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,oBAA4B;CACvC,MAAM,CAAC,aAAa,6CAClB,OAAO,WAAW,cAAc,OAAO,SAAS,WAAW,EAC7D;CAEA,kCAAgB;EACd,MAAM,6BAAmC;GACvC,eAAe,OAAO,SAAS,QAAQ;EACzC;EAEA,OAAO,iBAAiB,YAAY,oBAAoB;EACxD,aAAa,OAAO,oBAAoB,YAAY,oBAAoB;CAC1E,GAAG,CAAC,CAAC;CAEL,6FAA0C,WAAW,GAAG,CAAC,WAAW,CAAC;AACvE"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_client_IntlayerProvider = require('./IntlayerProvider.cjs');
4
3
  let _intlayer_core_interpreter = require("@intlayer/core/interpreter");
5
4
  let preact_hooks = require("preact/hooks");
@@ -1 +1 @@
1
- {"version":3,"file":"useTraduction.cjs","names":["IntlayerClientContext"],"sources":["../../../src/client/useTraduction.ts"],"sourcesContent":["import { getTranslation } from '@intlayer/core/interpreter';\nimport type { StrictModeLocaleMap } from '@intlayer/types/module_augmentation';\nimport { useContext, useMemo } from 'preact/hooks';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\n/**\n * On the client side, Hook that picking one dictionary by its id and return the content.\n *\n * If not locale found, it will return the content related to the default locale.\n *\n * Return either the content editor, or the content itself depending on the configuration.\n *\n * Usage:\n *\n * ```tsx\n * const content = useTranslation<string>({\n * en: 'Hello',\n * fr: 'Bonjour',\n * }, 'fr');\n * // 'Bonjour'\n * ```\n *\n * Using TypeScript:\n * - this function will require each locale to be defined if defined in the project configuration.\n * - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.\n */\nexport const useTranslation = <Content = string>(\n languageContent: StrictModeLocaleMap<Content>\n): Content => {\n const { locale } = useContext(IntlayerClientContext) ?? {};\n\n return useMemo(\n () => getTranslation(languageContent, locale),\n [languageContent, locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAa,kBACX,oBACY;CACZ,MAAM,EAAE,wCAAsBA,sDAAsB,IAAI,EAAE;AAE1D,uFACuB,iBAAiB,OAAO,EAC7C,CAAC,iBAAiB,OAAO,CAC1B"}
1
+ {"version":3,"file":"useTraduction.cjs","names":["IntlayerClientContext"],"sources":["../../../src/client/useTraduction.ts"],"sourcesContent":["import { getTranslation } from '@intlayer/core/interpreter';\nimport type { StrictModeLocaleMap } from '@intlayer/types/module_augmentation';\nimport { useContext, useMemo } from 'preact/hooks';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\n/**\n * On the client side, Hook that picking one dictionary by its id and return the content.\n *\n * If not locale found, it will return the content related to the default locale.\n *\n * Return either the content editor, or the content itself depending on the configuration.\n *\n * Usage:\n *\n * ```tsx\n * const content = useTranslation<string>({\n * en: 'Hello',\n * fr: 'Bonjour',\n * }, 'fr');\n * // 'Bonjour'\n * ```\n *\n * Using TypeScript:\n * - this function will require each locale to be defined if defined in the project configuration.\n * - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.\n */\nexport const useTranslation = <Content = string>(\n languageContent: StrictModeLocaleMap<Content>\n): Content => {\n const { locale } = useContext(IntlayerClientContext) ?? {};\n\n return useMemo(\n () => getTranslation(languageContent, locale),\n [languageContent, locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAa,kBACX,oBACY;CACZ,MAAM,EAAE,wCAAsBA,qDAAqB,KAAK,CAAC;CAEzD,sFACuB,iBAAiB,MAAM,GAC5C,CAAC,iBAAiB,MAAM,CAC1B;AACF"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  let _intlayer_editor_isEnabled = require("@intlayer/editor/isEnabled");
4
3
  let preact_hooks = require("preact/hooks");
5
4
  let preact_jsx_runtime = require("preact/jsx-runtime");
@@ -1 +1 @@
1
- {"version":3,"file":"ContentSelector.cjs","names":["isEnabled"],"sources":["../../../src/editor/ContentSelector.tsx"],"sourcesContent":["import type { NodeProps } from '@intlayer/core/interpreter';\nimport { isEnabled } from '@intlayer/editor/isEnabled';\nimport type { FunctionalComponent, HTMLAttributes } from 'preact';\nimport { useEffect } from 'preact/hooks';\n\n// JSX declaration for the Lit web component in Preact\ndeclare module 'preact' {\n namespace JSX {\n interface IntrinsicElements {\n 'intlayer-content-selector-wrapper': HTMLAttributes<HTMLElement> & {\n 'key-path'?: string;\n 'dictionary-key'?: string;\n };\n }\n }\n}\n\nexport type ContentSelectorWrapperProps = NodeProps &\n Omit<HTMLAttributes<HTMLDivElement>, 'children'>;\n\nexport const ContentSelector: FunctionalComponent<\n ContentSelectorWrapperProps\n> = ({ children, dictionaryKey, keyPath }) => {\n useEffect(() => {\n if (\n process.env.INTLAYER_EDITOR_ENABLED === 'false' ||\n !isEnabled ||\n typeof window === 'undefined'\n )\n return;\n import('@intlayer/editor').then(({ defineIntlayerElements }) => {\n defineIntlayerElements();\n });\n }, [isEnabled]);\n\n if (process.env.INTLAYER_EDITOR_ENABLED === 'false' || !isEnabled) {\n return children;\n }\n\n return (\n <intlayer-content-selector-wrapper\n key-path={JSON.stringify(keyPath)}\n dictionary-key={dictionaryKey}\n >\n {children}\n </intlayer-content-selector-wrapper>\n );\n};\n"],"mappings":";;;;;;;AAoBA,MAAa,mBAER,EAAE,UAAU,eAAe,cAAc;AAC5C,mCAAgB;AACd,MACE,QAAQ,IAAI,4BAA4B,WACxC,CAACA,wCACD,OAAO,WAAW,YAElB;AACF,SAAO,oBAAoB,MAAM,EAAE,6BAA6B;AAC9D,2BAAwB;IACxB;IACD,CAACA,qCAAU,CAAC;AAEf,KAAI,QAAQ,IAAI,4BAA4B,WAAW,CAACA,qCACtD,QAAO;AAGT,QACE,4CAAC,qCAAD;EACE,YAAU,KAAK,UAAU,QAAQ;EACjC,kBAAgB;EAEf;EACiC"}
1
+ {"version":3,"file":"ContentSelector.cjs","names":["isEnabled"],"sources":["../../../src/editor/ContentSelector.tsx"],"sourcesContent":["import type { NodeProps } from '@intlayer/core/interpreter';\nimport { isEnabled } from '@intlayer/editor/isEnabled';\nimport type { FunctionalComponent, HTMLAttributes } from 'preact';\nimport { useEffect } from 'preact/hooks';\n\n// JSX declaration for the Lit web component in Preact\ndeclare module 'preact' {\n namespace JSX {\n interface IntrinsicElements {\n 'intlayer-content-selector-wrapper': HTMLAttributes<HTMLElement> & {\n 'key-path'?: string;\n 'dictionary-key'?: string;\n };\n }\n }\n}\n\nexport type ContentSelectorWrapperProps = NodeProps &\n Omit<HTMLAttributes<HTMLDivElement>, 'children'>;\n\nexport const ContentSelector: FunctionalComponent<\n ContentSelectorWrapperProps\n> = ({ children, dictionaryKey, keyPath }) => {\n useEffect(() => {\n if (\n process.env.INTLAYER_EDITOR_ENABLED === 'false' ||\n !isEnabled ||\n typeof window === 'undefined'\n )\n return;\n import('@intlayer/editor').then(({ defineIntlayerElements }) => {\n defineIntlayerElements();\n });\n }, [isEnabled]);\n\n if (process.env.INTLAYER_EDITOR_ENABLED === 'false' || !isEnabled) {\n return children;\n }\n\n return (\n <intlayer-content-selector-wrapper\n key-path={JSON.stringify(keyPath)}\n dictionary-key={dictionaryKey}\n >\n {children}\n </intlayer-content-selector-wrapper>\n );\n};\n"],"mappings":";;;;;;AAoBA,MAAa,mBAER,EAAE,UAAU,eAAe,cAAc;CAC5C,kCAAgB;EACd,IACE,QAAQ,IAAI,4BAA4B,WACxC,CAACA,wCACD,OAAO,WAAW,aAElB;EACF,OAAO,mBAAmB,CAAC,MAAM,EAAE,6BAA6B;GAC9D,uBAAuB;EACzB,CAAC;CACH,GAAG,CAACA,oCAAS,CAAC;CAEd,IAAI,QAAQ,IAAI,4BAA4B,WAAW,CAACA,sCACtD,OAAO;CAGT,OACE,4CAAC,qCAAD;EACE,YAAU,KAAK,UAAU,OAAO;EAChC,kBAAgB;EAEf;CACgC;AAEvC"}
@@ -1 +1 @@
1
- {"version":3,"file":"EditorProvider.cjs","names":[],"sources":["../../../src/editor/EditorProvider.tsx"],"sourcesContent":["import type { ComponentChild, FunctionComponent } from 'preact';\nimport { useEditor } from './useEditor';\n\nexport const EditorProvider: FunctionComponent<{\n children?: ComponentChild;\n}> = ({ children }) => {\n useEditor();\n\n return children;\n};\n"],"mappings":";;;;AAGA,MAAa,kBAEP,EAAE,eAAe;AACrB,qCAAW;AAEX,QAAO"}
1
+ {"version":3,"file":"EditorProvider.cjs","names":[],"sources":["../../../src/editor/EditorProvider.tsx"],"sourcesContent":["import type { ComponentChild, FunctionComponent } from 'preact';\nimport { useEditor } from './useEditor';\n\nexport const EditorProvider: FunctionComponent<{\n children?: ComponentChild;\n}> = ({ children }) => {\n useEditor();\n\n return children;\n};\n"],"mappings":";;;;AAGA,MAAa,kBAEP,EAAE,eAAe;CACrB,mCAAU;CAEV,OAAO;AACT"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_client_IntlayerProvider = require('../client/IntlayerProvider.cjs');
4
3
  let _intlayer_editor_isEnabled = require("@intlayer/editor/isEnabled");
5
4
  let preact_hooks = require("preact/hooks");
@@ -1 +1 @@
1
- {"version":3,"file":"useEditor.cjs","names":["IntlayerClientContext","isEnabled"],"sources":["../../../src/editor/useEditor.tsx"],"sourcesContent":["import type { EditorStateManager } from '@intlayer/editor';\nimport { isEnabled } from '@intlayer/editor/isEnabled';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport { useContext, useEffect, useRef } from 'preact/hooks';\nimport { IntlayerClientContext } from '../client/IntlayerProvider';\n\n/**\n * Initialises the Intlayer editor client singleton when the editor is enabled.\n * Syncs the current locale from the Intlayer context into the editor manager so\n * the editor always knows which locale the app is displaying.\n */\nexport const useEditor = () => {\n const { locale } = useContext(IntlayerClientContext) ?? {};\n const managerRef = useRef<EditorStateManager | null>(null);\n\n useEffect(() => {\n if (process.env.INTLAYER_EDITOR_ENABLED === 'false' || !isEnabled) return;\n\n import('@intlayer/editor').then(({ initEditorClient }) => {\n const manager = initEditorClient();\n managerRef.current = manager;\n\n if (locale) manager.currentLocale.set(locale as Locale);\n });\n\n return () => {\n managerRef.current = null;\n import('@intlayer/editor').then(({ stopEditorClient }) => {\n stopEditorClient();\n });\n };\n }, []);\n\n useEffect(() => {\n if (\n process.env.INTLAYER_EDITOR_ENABLED === 'false' ||\n !locale ||\n !managerRef.current\n )\n return;\n\n managerRef.current.currentLocale.set(locale as Locale);\n }, [locale]);\n};\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,kBAAkB;CAC7B,MAAM,EAAE,wCAAsBA,sDAAsB,IAAI,EAAE;CAC1D,MAAM,sCAA+C,KAAK;AAE1D,mCAAgB;AACd,MAAI,QAAQ,IAAI,4BAA4B,WAAW,CAACC,qCAAW;AAEnE,SAAO,oBAAoB,MAAM,EAAE,uBAAuB;GACxD,MAAM,UAAU,kBAAkB;AAClC,cAAW,UAAU;AAErB,OAAI,OAAQ,SAAQ,cAAc,IAAI,OAAiB;IACvD;AAEF,eAAa;AACX,cAAW,UAAU;AACrB,UAAO,oBAAoB,MAAM,EAAE,uBAAuB;AACxD,sBAAkB;KAClB;;IAEH,EAAE,CAAC;AAEN,mCAAgB;AACd,MACE,QAAQ,IAAI,4BAA4B,WACxC,CAAC,UACD,CAAC,WAAW,QAEZ;AAEF,aAAW,QAAQ,cAAc,IAAI,OAAiB;IACrD,CAAC,OAAO,CAAC"}
1
+ {"version":3,"file":"useEditor.cjs","names":["IntlayerClientContext","isEnabled"],"sources":["../../../src/editor/useEditor.tsx"],"sourcesContent":["import type { EditorStateManager } from '@intlayer/editor';\nimport { isEnabled } from '@intlayer/editor/isEnabled';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport { useContext, useEffect, useRef } from 'preact/hooks';\nimport { IntlayerClientContext } from '../client/IntlayerProvider';\n\n/**\n * Initialises the Intlayer editor client singleton when the editor is enabled.\n * Syncs the current locale from the Intlayer context into the editor manager so\n * the editor always knows which locale the app is displaying.\n */\nexport const useEditor = () => {\n const { locale } = useContext(IntlayerClientContext) ?? {};\n const managerRef = useRef<EditorStateManager | null>(null);\n\n useEffect(() => {\n if (process.env.INTLAYER_EDITOR_ENABLED === 'false' || !isEnabled) return;\n\n import('@intlayer/editor').then(({ initEditorClient }) => {\n const manager = initEditorClient();\n managerRef.current = manager;\n\n if (locale) manager.currentLocale.set(locale as Locale);\n });\n\n return () => {\n managerRef.current = null;\n import('@intlayer/editor').then(({ stopEditorClient }) => {\n stopEditorClient();\n });\n };\n }, []);\n\n useEffect(() => {\n if (\n process.env.INTLAYER_EDITOR_ENABLED === 'false' ||\n !locale ||\n !managerRef.current\n )\n return;\n\n managerRef.current.currentLocale.set(locale as Locale);\n }, [locale]);\n};\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,kBAAkB;CAC7B,MAAM,EAAE,wCAAsBA,qDAAqB,KAAK,CAAC;CACzD,MAAM,sCAA+C,IAAI;CAEzD,kCAAgB;EACd,IAAI,QAAQ,IAAI,4BAA4B,WAAW,CAACC,sCAAW;EAEnE,OAAO,mBAAmB,CAAC,MAAM,EAAE,uBAAuB;GACxD,MAAM,UAAU,iBAAiB;GACjC,WAAW,UAAU;GAErB,IAAI,QAAQ,QAAQ,cAAc,IAAI,MAAgB;EACxD,CAAC;EAED,aAAa;GACX,WAAW,UAAU;GACrB,OAAO,mBAAmB,CAAC,MAAM,EAAE,uBAAuB;IACxD,iBAAiB;GACnB,CAAC;EACH;CACF,GAAG,CAAC,CAAC;CAEL,kCAAgB;EACd,IACE,QAAQ,IAAI,4BAA4B,WACxC,CAAC,UACD,CAAC,WAAW,SAEZ;EAEF,WAAW,QAAQ,cAAc,IAAI,MAAgB;CACvD,GAAG,CAAC,MAAM,CAAC;AACb"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_client_IntlayerProvider = require('../client/IntlayerProvider.cjs');
4
3
  let preact_hooks = require("preact/hooks");
5
4
  let _intlayer_core_formatters = require("@intlayer/core/formatters");
@@ -1 +1 @@
1
- {"version":3,"file":"useCompact.cjs","names":["IntlayerClientContext"],"sources":["../../../src/format/useCompact.ts"],"sourcesContent":["import { compact } from '@intlayer/core/formatters';\nimport { useCallback, useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../client/IntlayerProvider';\n\n/**\n * React client hook that provides a compact number formatter\n * bound to the current application locale.\n *\n * @example\n * ```tsx\n * const formatCompact = useCompact();\n * formatCompact(1500); // \"1.5K\"\n * ```\n */\nexport const useCompact = () => {\n const { locale } = useContext(IntlayerClientContext) ?? {};\n\n return useCallback(\n (...args: Parameters<typeof compact>) =>\n compact(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAcA,MAAa,mBAAmB;CAC9B,MAAM,EAAE,wCAAsBA,sDAAsB,IAAI,EAAE;AAE1D,uCACG,GAAG,gDACM,KAAK,IAAI;EACf,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
1
+ {"version":3,"file":"useCompact.cjs","names":["IntlayerClientContext"],"sources":["../../../src/format/useCompact.ts"],"sourcesContent":["import { compact } from '@intlayer/core/formatters';\nimport { useCallback, useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../client/IntlayerProvider';\n\n/**\n * React client hook that provides a compact number formatter\n * bound to the current application locale.\n *\n * @example\n * ```tsx\n * const formatCompact = useCompact();\n * formatCompact(1500); // \"1.5K\"\n * ```\n */\nexport const useCompact = () => {\n const { locale } = useContext(IntlayerClientContext) ?? {};\n\n return useCallback(\n (...args: Parameters<typeof compact>) =>\n compact(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAcA,MAAa,mBAAmB;CAC9B,MAAM,EAAE,wCAAsBA,qDAAqB,KAAK,CAAC;CAEzD,sCACG,GAAG,gDACM,KAAK,IAAI;EACf,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC,GACH,CAAC,MAAM,CACT;AACF"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_client_IntlayerProvider = require('../client/IntlayerProvider.cjs');
4
3
  let preact_hooks = require("preact/hooks");
5
4
  let _intlayer_core_formatters = require("@intlayer/core/formatters");
@@ -1 +1 @@
1
- {"version":3,"file":"useCurrency.cjs","names":["IntlayerClientContext"],"sources":["../../../src/format/useCurrency.ts"],"sourcesContent":["import { currency } from '@intlayer/core/formatters';\nimport { useCallback, useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../client/IntlayerProvider';\n\n/**\n * React client hook that provides a currency formatter\n * bound to the current application locale.\n *\n * @returns {(value: string | number, options?: CurrencyProps) => string}\n * A function to format numbers into localized currency strings.\n *\n * @example\n * ```tsx\n * const formatCurrency = useCurrency();\n *\n * formatCurrency(1500, { currency: \"USD\" });\n * // \"$1,500.00\"\n *\n * formatCurrency(1500, { currency: \"EUR\", locale: \"de-DE\" });\n * // \"1.500,00 €\"\n *\n * formatCurrency(9876543.21, {\n * currency: \"JPY\",\n * fractionDigits: 0,\n * });\n * // \"¥9,876,543\"\n * ```\n */\nexport const useCurrency = () => {\n const { locale } = useContext(IntlayerClientContext) ?? {};\n\n return useCallback(\n (...args: Parameters<typeof currency>) =>\n currency(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAa,oBAAoB;CAC/B,MAAM,EAAE,wCAAsBA,sDAAsB,IAAI,EAAE;AAE1D,uCACG,GAAG,iDACO,KAAK,IAAI;EAChB,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
1
+ {"version":3,"file":"useCurrency.cjs","names":["IntlayerClientContext"],"sources":["../../../src/format/useCurrency.ts"],"sourcesContent":["import { currency } from '@intlayer/core/formatters';\nimport { useCallback, useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../client/IntlayerProvider';\n\n/**\n * React client hook that provides a currency formatter\n * bound to the current application locale.\n *\n * @returns {(value: string | number, options?: CurrencyProps) => string}\n * A function to format numbers into localized currency strings.\n *\n * @example\n * ```tsx\n * const formatCurrency = useCurrency();\n *\n * formatCurrency(1500, { currency: \"USD\" });\n * // \"$1,500.00\"\n *\n * formatCurrency(1500, { currency: \"EUR\", locale: \"de-DE\" });\n * // \"1.500,00 €\"\n *\n * formatCurrency(9876543.21, {\n * currency: \"JPY\",\n * fractionDigits: 0,\n * });\n * // \"¥9,876,543\"\n * ```\n */\nexport const useCurrency = () => {\n const { locale } = useContext(IntlayerClientContext) ?? {};\n\n return useCallback(\n (...args: Parameters<typeof currency>) =>\n currency(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAa,oBAAoB;CAC/B,MAAM,EAAE,wCAAsBA,qDAAqB,KAAK,CAAC;CAEzD,sCACG,GAAG,iDACO,KAAK,IAAI;EAChB,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC,GACH,CAAC,MAAM,CACT;AACF"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_client_IntlayerProvider = require('../client/IntlayerProvider.cjs');
4
3
  let preact_hooks = require("preact/hooks");
5
4
  let _intlayer_core_formatters = require("@intlayer/core/formatters");
@@ -1 +1 @@
1
- {"version":3,"file":"useDate.cjs","names":["IntlayerClientContext"],"sources":["../../../src/format/useDate.ts"],"sourcesContent":["import { date } from '@intlayer/core/formatters';\nimport { useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../client/IntlayerProvider';\n\n/**\n * React client hook that provides a localized date/time formatter\n * bound to the current application locale.\n *\n * @returns {(date: Date | string | number, options?: DateProps) => string}\n * A function to format dates or timestamps into localized date/time strings.\n *\n * @example\n * ```tsx\n * const formatDate = useDate();\n *\n * formatDate(new Date(\"2025-01-01\"));\n * // \"Jan 1, 2025\"\n *\n * formatDate(\"2025-01-01T15:30:00Z\", {\n * dateStyle: \"full\",\n * timeStyle: \"short\",\n * });\n * // \"Wednesday, January 1, 2025 at 3:30 PM\"\n *\n * formatDate(1735689600000, { locale: \"fr-FR\", dateStyle: \"long\" });\n * // \"1 janvier 2025\"\n * ```\n *\n * @see createDate\n */\nexport const useDate = () => {\n const { locale } = useContext(IntlayerClientContext) ?? {};\n\n return (...args: Parameters<typeof date>) =>\n date(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAa,gBAAgB;CAC3B,MAAM,EAAE,wCAAsBA,sDAAsB,IAAI,EAAE;AAE1D,SAAQ,GAAG,6CACJ,KAAK,IAAI;EACZ,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC"}
1
+ {"version":3,"file":"useDate.cjs","names":["IntlayerClientContext"],"sources":["../../../src/format/useDate.ts"],"sourcesContent":["import { date } from '@intlayer/core/formatters';\nimport { useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../client/IntlayerProvider';\n\n/**\n * React client hook that provides a localized date/time formatter\n * bound to the current application locale.\n *\n * @returns {(date: Date | string | number, options?: DateProps) => string}\n * A function to format dates or timestamps into localized date/time strings.\n *\n * @example\n * ```tsx\n * const formatDate = useDate();\n *\n * formatDate(new Date(\"2025-01-01\"));\n * // \"Jan 1, 2025\"\n *\n * formatDate(\"2025-01-01T15:30:00Z\", {\n * dateStyle: \"full\",\n * timeStyle: \"short\",\n * });\n * // \"Wednesday, January 1, 2025 at 3:30 PM\"\n *\n * formatDate(1735689600000, { locale: \"fr-FR\", dateStyle: \"long\" });\n * // \"1 janvier 2025\"\n * ```\n *\n * @see createDate\n */\nexport const useDate = () => {\n const { locale } = useContext(IntlayerClientContext) ?? {};\n\n return (...args: Parameters<typeof date>) =>\n date(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAa,gBAAgB;CAC3B,MAAM,EAAE,wCAAsBA,qDAAqB,KAAK,CAAC;CAEzD,QAAQ,GAAG,6CACJ,KAAK,IAAI;EACZ,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_client_IntlayerProvider = require('../client/IntlayerProvider.cjs');
4
3
  let preact_hooks = require("preact/hooks");
5
4
  let _intlayer_core_formatters = require("@intlayer/core/formatters");
@@ -1 +1 @@
1
- {"version":3,"file":"useIntl.cjs","names":["IntlayerClientContext"],"sources":["../../../src/format/useIntl.ts"],"sourcesContent":["import { bindIntl, type WrappedIntl } from '@intlayer/core/formatters';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport { useContext, useMemo } from 'preact/hooks';\nimport { IntlayerClientContext } from '../client/IntlayerProvider';\n\n/**\n * Preact client hook that provides a locale-bound `Intl` object.\n *\n * It acts exactly like the native `Intl` object, but acts as a proxy to:\n * 1. Inject the current locale automatically if none is provided.\n * 2. Use the performance-optimized `CachedIntl` under the hood.\n *\n * @example\n * ```tsx\n * const intl = useIntl(); // uses context locale\n *\n * // Standard API, but no need to pass locale as the first argument\n * const formatted = new intl.NumberFormat({\n * style: 'currency',\n * currency: 'USD'\n * }).format(123.45);\n * ```\n */\nexport const useIntl = (locale?: LocalesValues) => {\n const { locale: contextLocale } = useContext(IntlayerClientContext) ?? {};\n const currentLocale = locale ?? contextLocale;\n\n return useMemo<WrappedIntl>(() => bindIntl(currentLocale), [currentLocale]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAa,WAAW,WAA2B;CACjD,MAAM,EAAE,QAAQ,+CAA6BA,sDAAsB,IAAI,EAAE;CACzE,MAAM,gBAAgB,UAAU;AAEhC,gFAA2C,cAAc,EAAE,CAAC,cAAc,CAAC"}
1
+ {"version":3,"file":"useIntl.cjs","names":["IntlayerClientContext"],"sources":["../../../src/format/useIntl.ts"],"sourcesContent":["import { bindIntl, type WrappedIntl } from '@intlayer/core/formatters';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport { useContext, useMemo } from 'preact/hooks';\nimport { IntlayerClientContext } from '../client/IntlayerProvider';\n\n/**\n * Preact client hook that provides a locale-bound `Intl` object.\n *\n * It acts exactly like the native `Intl` object, but acts as a proxy to:\n * 1. Inject the current locale automatically if none is provided.\n * 2. Use the performance-optimized `CachedIntl` under the hood.\n *\n * @example\n * ```tsx\n * const intl = useIntl(); // uses context locale\n *\n * // Standard API, but no need to pass locale as the first argument\n * const formatted = new intl.NumberFormat({\n * style: 'currency',\n * currency: 'USD'\n * }).format(123.45);\n * ```\n */\nexport const useIntl = (locale?: LocalesValues) => {\n const { locale: contextLocale } = useContext(IntlayerClientContext) ?? {};\n const currentLocale = locale ?? contextLocale;\n\n return useMemo<WrappedIntl>(() => bindIntl(currentLocale), [currentLocale]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAa,WAAW,WAA2B;CACjD,MAAM,EAAE,QAAQ,+CAA6BA,qDAAqB,KAAK,CAAC;CACxE,MAAM,gBAAgB,UAAU;CAEhC,+EAA2C,aAAa,GAAG,CAAC,aAAa,CAAC;AAC5E"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_client_IntlayerProvider = require('../client/IntlayerProvider.cjs');
4
3
  let preact_hooks = require("preact/hooks");
5
4
  let _intlayer_core_formatters = require("@intlayer/core/formatters");
@@ -1 +1 @@
1
- {"version":3,"file":"useList.cjs","names":["IntlayerClientContext"],"sources":["../../../src/format/useList.ts"],"sourcesContent":["import { list } from '@intlayer/core/formatters';\nimport { useCallback, useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../client/IntlayerProvider';\n\n/**\n * React client hook that provides a list formatter\n * bound to the current application locale.\n *\n * @returns {(values: (string | number)[], options?: ListProps) => string}\n * A function to format arrays into localized list strings.\n *\n * @example\n * ```tsx\n * const formatList = useList();\n *\n * formatList(['apple', 'banana', 'orange']);\n * // \"apple, banana, and orange\"\n *\n * formatList(['red', 'green', 'blue'], { type: 'disjunction' });\n * // \"red, green, or blue\"\n *\n * formatList([1, 2, 3], { type: 'unit', locale: 'de-DE' });\n * // \"1, 2 und 3\"\n * ```\n */\nexport const useList = () => {\n const { locale } = useContext(IntlayerClientContext) ?? {};\n\n return useCallback(\n (...args: Parameters<typeof list>) =>\n list(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAa,gBAAgB;CAC3B,MAAM,EAAE,wCAAsBA,sDAAsB,IAAI,EAAE;AAE1D,uCACG,GAAG,6CACG,KAAK,IAAI;EACZ,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
1
+ {"version":3,"file":"useList.cjs","names":["IntlayerClientContext"],"sources":["../../../src/format/useList.ts"],"sourcesContent":["import { list } from '@intlayer/core/formatters';\nimport { useCallback, useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../client/IntlayerProvider';\n\n/**\n * React client hook that provides a list formatter\n * bound to the current application locale.\n *\n * @returns {(values: (string | number)[], options?: ListProps) => string}\n * A function to format arrays into localized list strings.\n *\n * @example\n * ```tsx\n * const formatList = useList();\n *\n * formatList(['apple', 'banana', 'orange']);\n * // \"apple, banana, and orange\"\n *\n * formatList(['red', 'green', 'blue'], { type: 'disjunction' });\n * // \"red, green, or blue\"\n *\n * formatList([1, 2, 3], { type: 'unit', locale: 'de-DE' });\n * // \"1, 2 und 3\"\n * ```\n */\nexport const useList = () => {\n const { locale } = useContext(IntlayerClientContext) ?? {};\n\n return useCallback(\n (...args: Parameters<typeof list>) =>\n list(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAa,gBAAgB;CAC3B,MAAM,EAAE,wCAAsBA,qDAAqB,KAAK,CAAC;CAEzD,sCACG,GAAG,6CACG,KAAK,IAAI;EACZ,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC,GACH,CAAC,MAAM,CACT;AACF"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_client_IntlayerProvider = require('../client/IntlayerProvider.cjs');
4
3
  let preact_hooks = require("preact/hooks");
5
4
  let _intlayer_core_formatters = require("@intlayer/core/formatters");
@@ -1 +1 @@
1
- {"version":3,"file":"useNumber.cjs","names":["IntlayerClientContext"],"sources":["../../../src/format/useNumber.ts"],"sourcesContent":["import { number } from '@intlayer/core/formatters';\nimport { useCallback, useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../client/IntlayerProvider';\n\n/**\n * React client hook that provides a localized number formatter.\n *\n * Uses the current locale from {@link useLocaleBase} and returns\n * a function that can be used to format numbers consistently\n * according to the user's locale.\n *\n * @example\n * ```tsx\n * const formatNumber = useNumber();\n *\n * formatNumber(12345);\n * // e.g. \"12,345\" (en-US)\n * // e.g. \"12 345\" (fr-FR)\n *\n * formatNumber(0.75, { style: \"percent\" });\n * // e.g. \"75%\"\n * ```\n *\n * @returns {(value: string | number, options?: import(\"../createNumber\").NumberProps) => string}\n * A number formatting function bound to the active locale.\n */\nexport const useNumber = () => {\n const { locale } = useContext(IntlayerClientContext) ?? {};\n\n return useCallback(\n (...args: Parameters<typeof number>) =>\n number(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAa,kBAAkB;CAC7B,MAAM,EAAE,wCAAsBA,sDAAsB,IAAI,EAAE;AAE1D,uCACG,GAAG,+CACK,KAAK,IAAI;EACd,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
1
+ {"version":3,"file":"useNumber.cjs","names":["IntlayerClientContext"],"sources":["../../../src/format/useNumber.ts"],"sourcesContent":["import { number } from '@intlayer/core/formatters';\nimport { useCallback, useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../client/IntlayerProvider';\n\n/**\n * React client hook that provides a localized number formatter.\n *\n * Uses the current locale from {@link useLocaleBase} and returns\n * a function that can be used to format numbers consistently\n * according to the user's locale.\n *\n * @example\n * ```tsx\n * const formatNumber = useNumber();\n *\n * formatNumber(12345);\n * // e.g. \"12,345\" (en-US)\n * // e.g. \"12 345\" (fr-FR)\n *\n * formatNumber(0.75, { style: \"percent\" });\n * // e.g. \"75%\"\n * ```\n *\n * @returns {(value: string | number, options?: import(\"../createNumber\").NumberProps) => string}\n * A number formatting function bound to the active locale.\n */\nexport const useNumber = () => {\n const { locale } = useContext(IntlayerClientContext) ?? {};\n\n return useCallback(\n (...args: Parameters<typeof number>) =>\n number(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAa,kBAAkB;CAC7B,MAAM,EAAE,wCAAsBA,qDAAqB,KAAK,CAAC;CAEzD,sCACG,GAAG,+CACK,KAAK,IAAI;EACd,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC,GACH,CAAC,MAAM,CACT;AACF"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_client_IntlayerProvider = require('../client/IntlayerProvider.cjs');
4
3
  let preact_hooks = require("preact/hooks");
5
4
  let _intlayer_core_formatters = require("@intlayer/core/formatters");
@@ -1 +1 @@
1
- {"version":3,"file":"usePercentage.cjs","names":["IntlayerClientContext"],"sources":["../../../src/format/usePercentage.ts"],"sourcesContent":["import { percentage } from '@intlayer/core/formatters';\nimport { useCallback, useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../client/IntlayerProvider';\n\n/**\n * React hook to provide a percentage formatter function\n * based on the current application locale.\n *\n * This hook retrieves the active locale using {@link useLocaleBase}\n * and memoizes a `createPercentage` instance for that locale.\n *\n * @example\n * ```tsx\n * const formatPercentage = usePercentage();\n *\n * const result = formatPercentage(0.875, { maximumFractionDigits: 1 });\n * // \"87.5%\" (depending on locale)\n * ```\n *\n * @returns {(value: string | number, options?: Omit<PercentageOptions, \"value\">) => string}\n * A function that formats numbers or numeric strings into localized percentages.\n */\nexport const usePercentage = () => {\n const { locale } = useContext(IntlayerClientContext) ?? {};\n\n return useCallback(\n (...args: Parameters<typeof percentage>) =>\n percentage(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAa,sBAAsB;CACjC,MAAM,EAAE,wCAAsBA,sDAAsB,IAAI,EAAE;AAE1D,uCACG,GAAG,mDACS,KAAK,IAAI;EAClB,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
1
+ {"version":3,"file":"usePercentage.cjs","names":["IntlayerClientContext"],"sources":["../../../src/format/usePercentage.ts"],"sourcesContent":["import { percentage } from '@intlayer/core/formatters';\nimport { useCallback, useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../client/IntlayerProvider';\n\n/**\n * React hook to provide a percentage formatter function\n * based on the current application locale.\n *\n * This hook retrieves the active locale using {@link useLocaleBase}\n * and memoizes a `createPercentage` instance for that locale.\n *\n * @example\n * ```tsx\n * const formatPercentage = usePercentage();\n *\n * const result = formatPercentage(0.875, { maximumFractionDigits: 1 });\n * // \"87.5%\" (depending on locale)\n * ```\n *\n * @returns {(value: string | number, options?: Omit<PercentageOptions, \"value\">) => string}\n * A function that formats numbers or numeric strings into localized percentages.\n */\nexport const usePercentage = () => {\n const { locale } = useContext(IntlayerClientContext) ?? {};\n\n return useCallback(\n (...args: Parameters<typeof percentage>) =>\n percentage(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAa,sBAAsB;CACjC,MAAM,EAAE,wCAAsBA,qDAAqB,KAAK,CAAC;CAEzD,sCACG,GAAG,mDACS,KAAK,IAAI;EAClB,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC,GACH,CAAC,MAAM,CACT;AACF"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_client_IntlayerProvider = require('../client/IntlayerProvider.cjs');
4
3
  let preact_hooks = require("preact/hooks");
5
4
  let _intlayer_core_formatters = require("@intlayer/core/formatters");
@@ -1 +1 @@
1
- {"version":3,"file":"useRelativeTime.cjs","names":["IntlayerClientContext"],"sources":["../../../src/format/useRelativeTime.ts"],"sourcesContent":["import { relativeTime } from '@intlayer/core/formatters';\nimport { useCallback, useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../client/IntlayerProvider';\n\n/**\n * Client-side React hook for accessing a localized relative time formatter.\n *\n * This hook:\n * - Reads the current locale from {@link useLocaleBase}.\n * - Creates a new relative time formatter with {@link createRelativeTime}.\n * - Returns a function that can format time differences into localized strings.\n *\n * Example:\n * ```tsx\n * const relativeTime = useRelativeTime();\n * const formatted = relativeTime(new Date(\"2024-08-01\"), new Date());\n * // e.g., \"2 weeks ago\"\n * ```\n *\n * @returns {ReturnType<typeof createRelativeTime>} A relative time formatting function\n * bound to the current client locale.\n */\nexport const useRelativeTime = () => {\n const { locale } = useContext(IntlayerClientContext) ?? {};\n\n return useCallback(\n (...args: Parameters<typeof relativeTime>) =>\n relativeTime(args[0], args[1], {\n ...args[2],\n locale: args[2]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAa,wBAAwB;CACnC,MAAM,EAAE,wCAAsBA,sDAAsB,IAAI,EAAE;AAE1D,uCACG,GAAG,qDACW,KAAK,IAAI,KAAK,IAAI;EAC7B,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
1
+ {"version":3,"file":"useRelativeTime.cjs","names":["IntlayerClientContext"],"sources":["../../../src/format/useRelativeTime.ts"],"sourcesContent":["import { relativeTime } from '@intlayer/core/formatters';\nimport { useCallback, useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../client/IntlayerProvider';\n\n/**\n * Client-side React hook for accessing a localized relative time formatter.\n *\n * This hook:\n * - Reads the current locale from {@link useLocaleBase}.\n * - Creates a new relative time formatter with {@link createRelativeTime}.\n * - Returns a function that can format time differences into localized strings.\n *\n * Example:\n * ```tsx\n * const relativeTime = useRelativeTime();\n * const formatted = relativeTime(new Date(\"2024-08-01\"), new Date());\n * // e.g., \"2 weeks ago\"\n * ```\n *\n * @returns {ReturnType<typeof createRelativeTime>} A relative time formatting function\n * bound to the current client locale.\n */\nexport const useRelativeTime = () => {\n const { locale } = useContext(IntlayerClientContext) ?? {};\n\n return useCallback(\n (...args: Parameters<typeof relativeTime>) =>\n relativeTime(args[0], args[1], {\n ...args[2],\n locale: args[2]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAa,wBAAwB;CACnC,MAAM,EAAE,wCAAsBA,qDAAqB,KAAK,CAAC;CAEzD,sCACG,GAAG,qDACW,KAAK,IAAI,KAAK,IAAI;EAC7B,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC,GACH,CAAC,MAAM,CACT;AACF"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_client_IntlayerProvider = require('../client/IntlayerProvider.cjs');
4
3
  let preact_hooks = require("preact/hooks");
5
4
  let _intlayer_core_formatters = require("@intlayer/core/formatters");
@@ -1 +1 @@
1
- {"version":3,"file":"useUnit.cjs","names":["IntlayerClientContext"],"sources":["../../../src/format/useUnit.ts"],"sourcesContent":["import { units } from '@intlayer/core/formatters';\nimport { useCallback, useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../client/IntlayerProvider';\n\n/**\n * React hook that provides a unit formatting function\n * based on the current locale from {@link useLocaleBase}.\n *\n * This hook wraps {@link createUnit} to return a formatter\n * that can convert values into human-readable localized units\n * (e.g., \"10 km\", \"5 lbs\").\n *\n * @example\n * ```tsx\n * const formatUnit = useUnit();\n * const distance = formatUnit(10, { unit: \"kilometer\" });\n * // \"10 km\" (depending on locale)\n * ```\n *\n * @returns {Function} A unit formatting function that accepts a value and optional formatting options.\n */\nexport const useUnit = () => {\n const { locale } = useContext(IntlayerClientContext) ?? {};\n\n return useCallback(\n (...args: Parameters<typeof units>) =>\n units(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,gBAAgB;CAC3B,MAAM,EAAE,wCAAsBA,sDAAsB,IAAI,EAAE;AAE1D,uCACG,GAAG,8CACI,KAAK,IAAI;EACb,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
1
+ {"version":3,"file":"useUnit.cjs","names":["IntlayerClientContext"],"sources":["../../../src/format/useUnit.ts"],"sourcesContent":["import { units } from '@intlayer/core/formatters';\nimport { useCallback, useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../client/IntlayerProvider';\n\n/**\n * React hook that provides a unit formatting function\n * based on the current locale from {@link useLocaleBase}.\n *\n * This hook wraps {@link createUnit} to return a formatter\n * that can convert values into human-readable localized units\n * (e.g., \"10 km\", \"5 lbs\").\n *\n * @example\n * ```tsx\n * const formatUnit = useUnit();\n * const distance = formatUnit(10, { unit: \"kilometer\" });\n * // \"10 km\" (depending on locale)\n * ```\n *\n * @returns {Function} A unit formatting function that accepts a value and optional formatting options.\n */\nexport const useUnit = () => {\n const { locale } = useContext(IntlayerClientContext) ?? {};\n\n return useCallback(\n (...args: Parameters<typeof units>) =>\n units(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,gBAAgB;CAC3B,MAAM,EAAE,wCAAsBA,qDAAqB,KAAK,CAAC;CAEzD,sCACG,GAAG,8CACI,KAAK,IAAI;EACb,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC,GACH,CAAC,MAAM,CACT;AACF"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
2
  const require_plugins = require('./plugins.cjs');
4
3
  let _intlayer_core_interpreter = require("@intlayer/core/interpreter");
5
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"getDictionary.cjs","names":["getPlugins"],"sources":["../../src/getDictionary.ts"],"sourcesContent":["import { getDictionary as getDictionaryCore } from '@intlayer/core/interpreter';\nimport type {\n Dictionary,\n DictionarySelectorForGroup,\n QualifiedDictionaryGroup,\n ResolveQualifiedDictionaryContent,\n} from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n ExtractSelectorLocale,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { type DeepTransformContent, getPlugins } from './plugins';\n\n/**\n * Transforms a dictionary (or qualified dictionary group) and returns its\n * content for the given locale or selector (`{ item }`, `{ variant }`,\n * optionally combined with `locale`).\n */\nexport const getDictionary = <\n const T extends Dictionary | QualifiedDictionaryGroup,\n const A extends\n | LocalesValues\n | DictionarySelectorForGroup<T> = DeclaredLocales,\n>(\n dictionary: T,\n localeOrSelector?: A\n): DeepTransformContent<\n ResolveQualifiedDictionaryContent<T, A>,\n ExtractSelectorLocale<A>\n> => {\n const locale = (\n typeof localeOrSelector === 'object' && localeOrSelector !== null\n ? localeOrSelector.locale\n : localeOrSelector\n ) as LocalesValues | undefined;\n\n return getDictionaryCore(\n dictionary,\n localeOrSelector,\n getPlugins(locale)\n ) as any;\n};\n"],"mappings":";;;;;;;;;;;AAmBA,MAAa,iBAMX,YACA,qBAIG;AAOH,sDACE,YACA,kBACAA,2BARA,OAAO,qBAAqB,YAAY,qBAAqB,OACzD,iBAAiB,SACjB,iBAMc,CACnB"}
1
+ {"version":3,"file":"getDictionary.cjs","names":["getPlugins"],"sources":["../../src/getDictionary.ts"],"sourcesContent":["import { getDictionary as getDictionaryCore } from '@intlayer/core/interpreter';\nimport type {\n Dictionary,\n DictionarySelectorForGroup,\n QualifiedDictionaryGroup,\n ResolveQualifiedDictionaryContent,\n} from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n ExtractSelectorLocale,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { type DeepTransformContent, getPlugins } from './plugins';\n\n/**\n * Transforms a dictionary (or qualified dictionary group) and returns its\n * content for the given locale or selector (`{ item }`, `{ variant }`,\n * optionally combined with `locale`).\n */\nexport const getDictionary = <\n const T extends Dictionary | QualifiedDictionaryGroup,\n const A extends\n | LocalesValues\n | DictionarySelectorForGroup<T> = DeclaredLocales,\n>(\n dictionary: T,\n localeOrSelector?: A\n): DeepTransformContent<\n ResolveQualifiedDictionaryContent<T, A>,\n ExtractSelectorLocale<A>\n> => {\n const locale = (\n typeof localeOrSelector === 'object' && localeOrSelector !== null\n ? localeOrSelector.locale\n : localeOrSelector\n ) as LocalesValues | undefined;\n\n return getDictionaryCore(\n dictionary,\n localeOrSelector,\n getPlugins(locale)\n ) as any;\n};\n"],"mappings":";;;;;;;;;;AAmBA,MAAa,iBAMX,YACA,qBAIG;CAOH,qDACE,YACA,kBACAA,2BARA,OAAO,qBAAqB,YAAY,qBAAqB,OACzD,iBAAiB,SACjB,gBAMa,CACnB;AACF"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
2
  const require_plugins = require('./plugins.cjs');
4
3
  let _intlayer_core_interpreter = require("@intlayer/core/interpreter");
5
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"getIntlayer.cjs","names":["getPlugins"],"sources":["../../src/getIntlayer.ts"],"sourcesContent":["import { getIntlayer as getIntlayerCore } from '@intlayer/core/interpreter';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionaryRegistryResult,\n DictionarySelectorForKey,\n ExtractSelectorLocale,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { type DeepTransformContent, getPlugins } from './plugins';\n\n/**\n * Picks one dictionary by its key and returns its content for the given\n * locale or selector (`{ item }`, `{ variant }`,\n * optionally combined with `locale`).\n */\nexport const getIntlayer = <\n const T extends DictionaryKeys,\n const A extends LocalesValues | DictionarySelectorForKey<T> = DeclaredLocales,\n>(\n key: T,\n localeOrSelector?: A\n): DeepTransformContent<\n DictionaryRegistryResult<T, A>,\n ExtractSelectorLocale<A>\n> => {\n const locale = (\n typeof localeOrSelector === 'object' && localeOrSelector !== null\n ? localeOrSelector.locale\n : localeOrSelector\n ) as LocalesValues | undefined;\n\n return getIntlayerCore(key, localeOrSelector, getPlugins(locale)) as any;\n};\n"],"mappings":";;;;;;;;;;;AAgBA,MAAa,eAIX,KACA,qBAIG;AAOH,oDAAuB,KAAK,kBAAkBA,2BAL5C,OAAO,qBAAqB,YAAY,qBAAqB,OACzD,iBAAiB,SACjB,iBAG0D,CAAC"}
1
+ {"version":3,"file":"getIntlayer.cjs","names":["getPlugins"],"sources":["../../src/getIntlayer.ts"],"sourcesContent":["import { getIntlayer as getIntlayerCore } from '@intlayer/core/interpreter';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionaryRegistryResult,\n DictionarySelectorForKey,\n ExtractSelectorLocale,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { type DeepTransformContent, getPlugins } from './plugins';\n\n/**\n * Picks one dictionary by its key and returns its content for the given\n * locale or selector (`{ item }`, `{ variant }`,\n * optionally combined with `locale`).\n */\nexport const getIntlayer = <\n const T extends DictionaryKeys,\n const A extends LocalesValues | DictionarySelectorForKey<T> = DeclaredLocales,\n>(\n key: T,\n localeOrSelector?: A\n): DeepTransformContent<\n DictionaryRegistryResult<T, A>,\n ExtractSelectorLocale<A>\n> => {\n const locale = (\n typeof localeOrSelector === 'object' && localeOrSelector !== null\n ? localeOrSelector.locale\n : localeOrSelector\n ) as LocalesValues | undefined;\n\n return getIntlayerCore(key, localeOrSelector, getPlugins(locale)) as any;\n};\n"],"mappings":";;;;;;;;;;AAgBA,MAAa,eAIX,KACA,qBAIG;CAOH,mDAAuB,KAAK,kBAAkBA,2BAL5C,OAAO,qBAAqB,YAAY,qBAAqB,OACzD,iBAAiB,SACjB,gBAGyD,CAAC;AAClE"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  let preact = require("preact");
4
3
  let preact_hooks = require("preact/hooks");
5
4
  let preact_jsx_runtime = require("preact/jsx-runtime");
@@ -1 +1 @@
1
- {"version":3,"file":"HTMLProvider.cjs","names":[],"sources":["../../../src/html/HTMLProvider.tsx"],"sourcesContent":["import {\n createContext,\n type FunctionalComponent,\n type RenderableProps,\n} from 'preact';\nimport { useContext } from 'preact/hooks';\nimport type { HTMLComponents } from './types';\n\ntype HTMLContextValue = {\n components?: HTMLComponents<'permissive', {}>;\n};\n\ntype HTMLProviderProps = RenderableProps<{\n /**\n * Component overrides for HTML tags.\n */\n components?: HTMLComponents<'permissive', {}>;\n}>;\n\nconst HTMLContext = createContext<HTMLContextValue | undefined>(undefined);\n\nexport const useHTMLContext = () => useContext(HTMLContext);\n\nexport const HTMLProvider: FunctionalComponent<HTMLProviderProps> = ({\n children,\n components,\n}) => (\n <HTMLContext.Provider value={{ components }}>{children}</HTMLContext.Provider>\n);\n"],"mappings":";;;;;;;AAmBA,MAAM,wCAA0D,OAAU;AAE1E,MAAa,oDAAkC,YAAY;AAE3D,MAAa,gBAAwD,EACnE,UACA,iBAEA,4CAAC,YAAY,UAAb;CAAsB,OAAO,EAAE,YAAY;CAAG;CAAgC"}
1
+ {"version":3,"file":"HTMLProvider.cjs","names":[],"sources":["../../../src/html/HTMLProvider.tsx"],"sourcesContent":["import {\n createContext,\n type FunctionalComponent,\n type RenderableProps,\n} from 'preact';\nimport { useContext } from 'preact/hooks';\nimport type { HTMLComponents } from './types';\n\ntype HTMLContextValue = {\n components?: HTMLComponents<'permissive', {}>;\n};\n\ntype HTMLProviderProps = RenderableProps<{\n /**\n * Component overrides for HTML tags.\n */\n components?: HTMLComponents<'permissive', {}>;\n}>;\n\nconst HTMLContext = createContext<HTMLContextValue | undefined>(undefined);\n\nexport const useHTMLContext = () => useContext(HTMLContext);\n\nexport const HTMLProvider: FunctionalComponent<HTMLProviderProps> = ({\n children,\n components,\n}) => (\n <HTMLContext.Provider value={{ components }}>{children}</HTMLContext.Provider>\n);\n"],"mappings":";;;;;;AAmBA,MAAM,wCAA0D,MAAS;AAEzE,MAAa,oDAAkC,WAAW;AAE1D,MAAa,gBAAwD,EACnE,UACA,iBAEA,4CAAC,YAAY,UAAb;CAAsB,OAAO,EAAE,WAAW;CAAI;AAA+B"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_html_HTMLProvider = require('./HTMLProvider.cjs');
4
3
  let _intlayer_core_interpreter = require("@intlayer/core/interpreter");
5
4
  let preact = require("preact");
@@ -1 +1 @@
1
- {"version":3,"file":"HTMLRenderer.cjs","names":["Fragment","VOID_HTML_ELEMENTS","useHTMLContext"],"sources":["../../../src/html/HTMLRenderer.tsx"],"sourcesContent":["import { getHTML } from '@intlayer/core/interpreter';\nimport { VOID_HTML_ELEMENTS } from '@intlayer/core/transpiler';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport { Fragment, type FunctionComponent, h, type JSX } from 'preact';\nimport { useHTMLContext } from './HTMLProvider';\nimport type { HTMLComponents } from './types';\n\nexport type RenderHTMLProps = {\n /**\n * Component overrides for HTML tags.\n * Allows you to customize how specific HTML elements are rendered.\n */\n components?: HTMLComponents<'permissive', {}>;\n};\n\n/**\n * Renders HTML-like content to JSX with the provided components.\n *\n * This function does not use context from HTMLProvider. Use `useHTMLRenderer`\n * hook if you want to leverage provider context.\n */\nexport const renderHTML = (\n content: string,\n { components = {} }: RenderHTMLProps = {}\n): JSX.Element => {\n // Wrap explicit user components to ensure they are rendered via Preact's h\n const userComponents = Object.fromEntries(\n Object.entries(components)\n .filter(([, Component]) => Component)\n .map(([key, Component]) => [\n key,\n (props: any) => h(Component as any, props),\n ])\n );\n\n // Proxy handles standard HTML tags lazily without a hardcoded list\n const wrappedComponents = new Proxy(userComponents, {\n get(target, prop) {\n if (typeof prop === 'string' && prop in target) {\n return target[prop];\n }\n // Fallback: Lazily generate a wrapper for standard lowercase HTML tags\n if (typeof prop === 'string' && /^[a-z][a-z0-9]*$/.test(prop)) {\n if (VOID_HTML_ELEMENTS.has(prop)) {\n // Void elements cannot have children — strip them to avoid render error\n return ({ children: _children, ...rest }: any) => h(prop, rest);\n }\n return (props: any) => h(prop, props);\n }\n return undefined;\n },\n });\n\n // Cast wrappedComponents to any to satisfy getHTML's dictionary typing\n return h(Fragment, null, getHTML(content, wrappedComponents as any));\n};\n\n/**\n * Hook that returns a function to render HTML content.\n *\n * This hook considers the configuration from the `HTMLProvider` context if available,\n * falling back to the provided components.\n */\nexport const useHTMLRenderer = ({ components }: RenderHTMLProps = {}) => {\n const context = useHTMLContext();\n\n return (content: string) => {\n return renderHTML(content, {\n components: {\n ...context?.components,\n ...components,\n },\n });\n };\n};\n\nexport type HTMLRendererProps = RenderHTMLProps & {\n /**\n * The HTML content to render as a string.\n */\n children?: string;\n /**\n * Alias for children, used by the plugin.\n */\n html?: string;\n /**\n * Alias for components, used by the plugin.\n */\n components?: HTMLComponents<'permissive', {}>;\n dictionaryKey?: string;\n keyPath?: KeyPath[];\n};\n\n/**\n * Preact component that renders HTML-like content to JSX.\n */\nexport const HTMLRenderer: FunctionComponent<HTMLRendererProps> = ({\n children = '',\n html,\n components,\n}) => {\n const render = useHTMLRenderer({ components });\n const content = children || html || '';\n\n return render(content);\n};\n"],"mappings":";;;;;;;;;;;;;;AAqBA,MAAa,cACX,SACA,EAAE,aAAa,EAAE,KAAsB,EAAE,KACzB;CAEhB,MAAM,iBAAiB,OAAO,YAC5B,OAAO,QAAQ,WAAW,CACvB,QAAQ,GAAG,eAAe,UAAU,CACpC,KAAK,CAAC,KAAK,eAAe,CACzB,MACC,wBAAiB,WAAkB,MAAM,CAC3C,CAAC,CACL;AAqBD,sBAASA,iBAAU,8CAAc,SAAS,IAlBZ,MAAM,gBAAgB,EAClD,IAAI,QAAQ,MAAM;AAChB,MAAI,OAAO,SAAS,YAAY,QAAQ,OACtC,QAAO,OAAO;AAGhB,MAAI,OAAO,SAAS,YAAY,mBAAmB,KAAK,KAAK,EAAE;AAC7D,OAAIC,6CAAmB,IAAI,KAAK,CAE9B,SAAQ,EAAE,UAAU,WAAW,GAAG,yBAAkB,MAAM,KAAK;AAEjE,WAAQ,wBAAiB,MAAM,MAAM;;IAI1C,CAG0D,CAAQ,CAAC;;;;;;;;AAStE,MAAa,mBAAmB,EAAE,eAAgC,EAAE,KAAK;CACvE,MAAM,UAAUC,0CAAgB;AAEhC,SAAQ,YAAoB;AAC1B,SAAO,WAAW,SAAS,EACzB,YAAY;GACV,GAAG,SAAS;GACZ,GAAG;GACJ,EACF,CAAC;;;;;;AAwBN,MAAa,gBAAsD,EACjE,WAAW,IACX,MACA,iBACI;AAIJ,QAHe,gBAAgB,EAAE,YAAY,CAGhC,CAFG,YAAY,QAAQ,GAEd"}
1
+ {"version":3,"file":"HTMLRenderer.cjs","names":["Fragment","VOID_HTML_ELEMENTS","useHTMLContext"],"sources":["../../../src/html/HTMLRenderer.tsx"],"sourcesContent":["import { getHTML } from '@intlayer/core/interpreter';\nimport { VOID_HTML_ELEMENTS } from '@intlayer/core/transpiler';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport { Fragment, type FunctionComponent, h, type JSX } from 'preact';\nimport { useHTMLContext } from './HTMLProvider';\nimport type { HTMLComponents } from './types';\n\nexport type RenderHTMLProps = {\n /**\n * Component overrides for HTML tags.\n * Allows you to customize how specific HTML elements are rendered.\n */\n components?: HTMLComponents<'permissive', {}>;\n};\n\n/**\n * Renders HTML-like content to JSX with the provided components.\n *\n * This function does not use context from HTMLProvider. Use `useHTMLRenderer`\n * hook if you want to leverage provider context.\n */\nexport const renderHTML = (\n content: string,\n { components = {} }: RenderHTMLProps = {}\n): JSX.Element => {\n // Wrap explicit user components to ensure they are rendered via Preact's h\n const userComponents = Object.fromEntries(\n Object.entries(components)\n .filter(([, Component]) => Component)\n .map(([key, Component]) => [\n key,\n (props: any) => h(Component as any, props),\n ])\n );\n\n // Proxy handles standard HTML tags lazily without a hardcoded list\n const wrappedComponents = new Proxy(userComponents, {\n get(target, prop) {\n if (typeof prop === 'string' && prop in target) {\n return target[prop];\n }\n // Fallback: Lazily generate a wrapper for standard lowercase HTML tags\n if (typeof prop === 'string' && /^[a-z][a-z0-9]*$/.test(prop)) {\n if (VOID_HTML_ELEMENTS.has(prop)) {\n // Void elements cannot have children — strip them to avoid render error\n return ({ children: _children, ...rest }: any) => h(prop, rest);\n }\n return (props: any) => h(prop, props);\n }\n return undefined;\n },\n });\n\n // Cast wrappedComponents to any to satisfy getHTML's dictionary typing\n return h(Fragment, null, getHTML(content, wrappedComponents as any));\n};\n\n/**\n * Hook that returns a function to render HTML content.\n *\n * This hook considers the configuration from the `HTMLProvider` context if available,\n * falling back to the provided components.\n */\nexport const useHTMLRenderer = ({ components }: RenderHTMLProps = {}) => {\n const context = useHTMLContext();\n\n return (content: string) => {\n return renderHTML(content, {\n components: {\n ...context?.components,\n ...components,\n },\n });\n };\n};\n\nexport type HTMLRendererProps = RenderHTMLProps & {\n /**\n * The HTML content to render as a string.\n */\n children?: string;\n /**\n * Alias for children, used by the plugin.\n */\n html?: string;\n /**\n * Alias for components, used by the plugin.\n */\n components?: HTMLComponents<'permissive', {}>;\n dictionaryKey?: string;\n keyPath?: KeyPath[];\n};\n\n/**\n * Preact component that renders HTML-like content to JSX.\n */\nexport const HTMLRenderer: FunctionComponent<HTMLRendererProps> = ({\n children = '',\n html,\n components,\n}) => {\n const render = useHTMLRenderer({ components });\n const content = children || html || '';\n\n return render(content);\n};\n"],"mappings":";;;;;;;;;;;;;AAqBA,MAAa,cACX,SACA,EAAE,aAAa,CAAC,MAAuB,CAAC,MACxB;CAEhB,MAAM,iBAAiB,OAAO,YAC5B,OAAO,QAAQ,UAAU,CAAC,CACvB,QAAQ,GAAG,eAAe,SAAS,CAAC,CACpC,KAAK,CAAC,KAAK,eAAe,CACzB,MACC,wBAAiB,WAAkB,KAAK,CAC3C,CAAC,CACL;CAqBA,qBAASA,iBAAU,8CAAc,SAAS,IAlBZ,MAAM,gBAAgB,EAClD,IAAI,QAAQ,MAAM;EAChB,IAAI,OAAO,SAAS,YAAY,QAAQ,QACtC,OAAO,OAAO;EAGhB,IAAI,OAAO,SAAS,YAAY,mBAAmB,KAAK,IAAI,GAAG;GAC7D,IAAIC,6CAAmB,IAAI,IAAI,GAE7B,QAAQ,EAAE,UAAU,WAAW,GAAG,yBAAkB,MAAM,IAAI;GAEhE,QAAQ,wBAAiB,MAAM,KAAK;EACtC;CAEF,EACF,CAG0D,CAAQ,CAAC;AACrE;;;;;;;AAQA,MAAa,mBAAmB,EAAE,eAAgC,CAAC,MAAM;CACvE,MAAM,UAAUC,yCAAe;CAE/B,QAAQ,YAAoB;EAC1B,OAAO,WAAW,SAAS,EACzB,YAAY;GACV,GAAG,SAAS;GACZ,GAAG;EACL,EACF,CAAC;CACH;AACF;;;;AAsBA,MAAa,gBAAsD,EACjE,WAAW,IACX,MACA,iBACI;CAIJ,OAHe,gBAAgB,EAAE,WAAW,CAGhC,CAAC,CAFG,YAAY,QAAQ,EAEf;AACvB"}
@@ -1,17 +1,22 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_client_useLoadDynamic = require('./client/useLoadDynamic.cjs');
3
2
  const require_getIntlayer = require('./getIntlayer.cjs');
4
3
  const require_getDictionary = require('./getDictionary.cjs');
5
4
  const require_client_useLocaleStorage = require('./client/useLocaleStorage.cjs');
6
5
  const require_client_IntlayerProvider = require('./client/IntlayerProvider.cjs');
6
+ const require_analytics_useAnalytics = require('./analytics/useAnalytics.cjs');
7
+ const require_analytics_AnalyticsProvider = require('./analytics/AnalyticsProvider.cjs');
8
+ const require_analytics_useConversion = require('./analytics/useConversion.cjs');
9
+ const require_analytics_useExperiment = require('./analytics/useExperiment.cjs');
7
10
  const require_client_t = require('./client/t.cjs');
8
11
  const require_client_useDictionary = require('./client/useDictionary.cjs');
9
12
  const require_client_useDictionaryAsync = require('./client/useDictionaryAsync.cjs');
13
+ const require_client_useLoadDynamic = require('./client/useLoadDynamic.cjs');
10
14
  const require_client_useDictionaryDynamic = require('./client/useDictionaryDynamic.cjs');
11
15
  const require_client_useIntlayer = require('./client/useIntlayer.cjs');
12
16
  const require_client_useLocale = require('./client/useLocale.cjs');
13
17
  const require_client_useLocaleBase = require('./client/useLocaleBase.cjs');
14
18
 
19
+ exports.AnalyticsProvider = require_analytics_AnalyticsProvider.AnalyticsProvider;
15
20
  exports.IntlayerClientContext = require_client_IntlayerProvider.IntlayerClientContext;
16
21
  exports.IntlayerProvider = require_client_IntlayerProvider.IntlayerProvider;
17
22
  exports.IntlayerProviderContent = require_client_IntlayerProvider.IntlayerProviderContent;
@@ -21,9 +26,12 @@ exports.localeCookie = require_client_useLocaleStorage.localeCookie;
21
26
  exports.setLocaleCookie = require_client_useLocaleStorage.setLocaleCookie;
22
27
  exports.setLocaleInStorage = require_client_useLocaleStorage.setLocaleInStorage;
23
28
  exports.t = require_client_t.t;
29
+ exports.useAnalytics = require_analytics_useAnalytics.useAnalytics;
30
+ exports.useConversion = require_analytics_useConversion.useConversion;
24
31
  exports.useDictionary = require_client_useDictionary.useDictionary;
25
32
  exports.useDictionaryAsync = require_client_useDictionaryAsync.useDictionaryAsync;
26
33
  exports.useDictionaryDynamic = require_client_useDictionaryDynamic.useDictionaryDynamic;
34
+ exports.useExperiment = require_analytics_useExperiment.useExperiment;
27
35
  exports.useIntlayer = require_client_useIntlayer.useIntlayer;
28
36
  exports.useIntlayerContext = require_client_IntlayerProvider.useIntlayerContext;
29
37
  exports.useLoadDynamic = require_client_useLoadDynamic.useLoadDynamic;
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_markdown_compiler = require('./compiler.cjs');
4
3
  let preact = require("preact");
5
4
  let preact_hooks = require("preact/hooks");
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownProvider.cjs","names":["compileMarkdown"],"sources":["../../../src/markdown/MarkdownProvider.tsx"],"sourcesContent":["import {\n type ComponentChildren,\n type ComponentType,\n createContext,\n type FunctionComponent,\n type JSX,\n} from 'preact';\nimport { useContext } from 'preact/hooks';\nimport type { HTMLComponents } from '../html/types';\nimport { compileMarkdown, type ParsedMarkdown } from './compiler';\n\ntype PropsWithChildren<P = {}> = P & { children?: ComponentChildren };\n\n/**\n * Refined options for the MarkdownProvider.\n */\nexport type MarkdownProviderOptions = {\n /**\n * Forces the compiler to always output content with a block-level wrapper.\n */\n forceBlock?: boolean;\n /**\n * Forces the compiler to always output content with an inline wrapper.\n */\n forceInline?: boolean;\n /**\n * Whether to preserve frontmatter in the markdown content.\n */\n preserveFrontmatter?: boolean;\n /**\n * Whether to use the GitHub Tag Filter.\n */\n tagfilter?: boolean;\n};\n\ntype RenderMarkdownOptions = MarkdownProviderOptions & {\n components?: HTMLComponents<'permissive', {}>;\n wrapper?: ComponentType<any> | keyof JSX.IntrinsicElements;\n forceWrapper?: boolean;\n};\n\ntype MarkdownContextValue = {\n components?: HTMLComponents<'permissive', {}>;\n renderMarkdown: (\n markdown: string | ParsedMarkdown,\n options?: MarkdownProviderOptions,\n components?: HTMLComponents<'permissive', {}>,\n wrapper?: ComponentType<any> | keyof JSX.IntrinsicElements\n ) => ComponentChildren | Promise<ComponentChildren>;\n};\n\ntype MarkdownProviderProps = PropsWithChildren<\n MarkdownProviderOptions & {\n /**\n * Component overrides for HTML tags.\n */\n components?: HTMLComponents<'permissive', {}>;\n /**\n * Wrapper element or component to be used when there are multiple children.\n */\n wrapper?: ComponentType<any> | keyof JSX.IntrinsicElements;\n /**\n * Custom render function for markdown.\n * If provided, it will overwrite all rules and default rendering.\n */\n renderMarkdown?: (\n markdown: string | ParsedMarkdown,\n options?: MarkdownProviderOptions,\n components?: HTMLComponents<'permissive', {}>,\n wrapper?: ComponentType<any> | keyof JSX.IntrinsicElements\n ) => ComponentChildren | Promise<ComponentChildren>;\n }\n>;\n\nconst MarkdownContext = createContext<MarkdownContextValue | undefined>(\n undefined\n);\n\nexport const useMarkdownContext = () => useContext(MarkdownContext);\n\nconst mergeOptions = (\n baseComponents: HTMLComponents<'permissive', {}> | undefined,\n baseOptions: Omit<RenderMarkdownOptions, 'components'>,\n options: MarkdownProviderOptions = {},\n components: HTMLComponents<'permissive', {}> = {},\n wrapper?: ComponentType<any> | keyof JSX.IntrinsicElements\n): RenderMarkdownOptions => {\n return {\n ...baseOptions,\n ...options,\n forceBlock: options.forceBlock ?? baseOptions.forceBlock,\n forceInline: options.forceInline ?? baseOptions.forceInline,\n preserveFrontmatter:\n options.preserveFrontmatter ?? baseOptions.preserveFrontmatter,\n tagfilter: options.tagfilter ?? baseOptions.tagfilter,\n wrapper: wrapper || baseOptions.wrapper,\n forceWrapper: !!(wrapper || baseOptions.wrapper),\n components: { ...baseComponents, ...components },\n };\n};\n\nexport const MarkdownProvider: FunctionComponent<MarkdownProviderProps> = ({\n children,\n components,\n wrapper,\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n renderMarkdown: customRenderFn,\n}) => {\n const baseOptions: Omit<RenderMarkdownOptions, 'components'> = {\n forceBlock,\n forceInline,\n wrapper,\n forceWrapper: !!wrapper,\n preserveFrontmatter,\n tagfilter,\n };\n\n // Standard internal renderer\n const defaultRenderMarkdown = (\n markdown: string | ParsedMarkdown,\n options?: MarkdownProviderOptions,\n componentsOverride?: HTMLComponents<'permissive', {}>,\n wrapperOverride?: ComponentType<any> | keyof JSX.IntrinsicElements\n ): ComponentChildren => {\n const mergedOptions = mergeOptions(\n components,\n baseOptions,\n options,\n componentsOverride ?? {},\n wrapperOverride\n );\n return compileMarkdown(markdown, mergedOptions) as ComponentChildren;\n };\n\n // Wrapper for user-provided custom renderer\n // Note: We wrap in a clean Provider to prevent infinite recursion\n const customRenderMarkdownWrapper = (\n markdown: string | ParsedMarkdown,\n options?: MarkdownProviderOptions,\n componentsOverride?: HTMLComponents<'permissive', {}>,\n wrapperOverride?: ComponentType<any> | keyof JSX.IntrinsicElements\n ): ComponentChildren => (\n <MarkdownContext.Provider value={undefined}>\n {customRenderFn?.(markdown, options, componentsOverride, wrapperOverride)}\n </MarkdownContext.Provider>\n );\n\n return (\n <MarkdownContext.Provider\n value={{\n components,\n renderMarkdown: customRenderFn\n ? customRenderMarkdownWrapper\n : defaultRenderMarkdown,\n }}\n >\n {children}\n </MarkdownContext.Provider>\n );\n};\n"],"mappings":";;;;;;;;AA0EA,MAAM,4CACJ,OACD;AAED,MAAa,wDAAsC,gBAAgB;AAEnE,MAAM,gBACJ,gBACA,aACA,UAAmC,EAAE,EACrC,aAA+C,EAAE,EACjD,YAC0B;AAC1B,QAAO;EACL,GAAG;EACH,GAAG;EACH,YAAY,QAAQ,cAAc,YAAY;EAC9C,aAAa,QAAQ,eAAe,YAAY;EAChD,qBACE,QAAQ,uBAAuB,YAAY;EAC7C,WAAW,QAAQ,aAAa,YAAY;EAC5C,SAAS,WAAW,YAAY;EAChC,cAAc,CAAC,EAAE,WAAW,YAAY;EACxC,YAAY;GAAE,GAAG;GAAgB,GAAG;GAAY;EACjD;;AAGH,MAAa,oBAA8D,EACzE,UACA,YACA,SACA,YACA,aACA,qBACA,WACA,gBAAgB,qBACZ;CACJ,MAAM,cAAyD;EAC7D;EACA;EACA;EACA,cAAc,CAAC,CAAC;EAChB;EACA;EACD;CAGD,MAAM,yBACJ,UACA,SACA,oBACA,oBACsB;AAQtB,SAAOA,0CAAgB,UAPD,aACpB,YACA,aACA,SACA,sBAAsB,EAAE,EACxB,gBAE4C,CAAC;;CAKjD,MAAM,+BACJ,UACA,SACA,oBACA,oBAEA,4CAAC,gBAAgB,UAAjB;EAA0B,OAAO;YAC9B,iBAAiB,UAAU,SAAS,oBAAoB,gBAAgB;EAChD;AAG7B,QACE,4CAAC,gBAAgB,UAAjB;EACE,OAAO;GACL;GACA,gBAAgB,iBACZ,8BACA;GACL;EAEA;EACwB"}
1
+ {"version":3,"file":"MarkdownProvider.cjs","names":["compileMarkdown"],"sources":["../../../src/markdown/MarkdownProvider.tsx"],"sourcesContent":["import {\n type ComponentChildren,\n type ComponentType,\n createContext,\n type FunctionComponent,\n type JSX,\n} from 'preact';\nimport { useContext } from 'preact/hooks';\nimport type { HTMLComponents } from '../html/types';\nimport { compileMarkdown, type ParsedMarkdown } from './compiler';\n\ntype PropsWithChildren<P = {}> = P & { children?: ComponentChildren };\n\n/**\n * Refined options for the MarkdownProvider.\n */\nexport type MarkdownProviderOptions = {\n /**\n * Forces the compiler to always output content with a block-level wrapper.\n */\n forceBlock?: boolean;\n /**\n * Forces the compiler to always output content with an inline wrapper.\n */\n forceInline?: boolean;\n /**\n * Whether to preserve frontmatter in the markdown content.\n */\n preserveFrontmatter?: boolean;\n /**\n * Whether to use the GitHub Tag Filter.\n */\n tagfilter?: boolean;\n};\n\ntype RenderMarkdownOptions = MarkdownProviderOptions & {\n components?: HTMLComponents<'permissive', {}>;\n wrapper?: ComponentType<any> | keyof JSX.IntrinsicElements;\n forceWrapper?: boolean;\n};\n\ntype MarkdownContextValue = {\n components?: HTMLComponents<'permissive', {}>;\n renderMarkdown: (\n markdown: string | ParsedMarkdown,\n options?: MarkdownProviderOptions,\n components?: HTMLComponents<'permissive', {}>,\n wrapper?: ComponentType<any> | keyof JSX.IntrinsicElements\n ) => ComponentChildren | Promise<ComponentChildren>;\n};\n\ntype MarkdownProviderProps = PropsWithChildren<\n MarkdownProviderOptions & {\n /**\n * Component overrides for HTML tags.\n */\n components?: HTMLComponents<'permissive', {}>;\n /**\n * Wrapper element or component to be used when there are multiple children.\n */\n wrapper?: ComponentType<any> | keyof JSX.IntrinsicElements;\n /**\n * Custom render function for markdown.\n * If provided, it will overwrite all rules and default rendering.\n */\n renderMarkdown?: (\n markdown: string | ParsedMarkdown,\n options?: MarkdownProviderOptions,\n components?: HTMLComponents<'permissive', {}>,\n wrapper?: ComponentType<any> | keyof JSX.IntrinsicElements\n ) => ComponentChildren | Promise<ComponentChildren>;\n }\n>;\n\nconst MarkdownContext = createContext<MarkdownContextValue | undefined>(\n undefined\n);\n\nexport const useMarkdownContext = () => useContext(MarkdownContext);\n\nconst mergeOptions = (\n baseComponents: HTMLComponents<'permissive', {}> | undefined,\n baseOptions: Omit<RenderMarkdownOptions, 'components'>,\n options: MarkdownProviderOptions = {},\n components: HTMLComponents<'permissive', {}> = {},\n wrapper?: ComponentType<any> | keyof JSX.IntrinsicElements\n): RenderMarkdownOptions => {\n return {\n ...baseOptions,\n ...options,\n forceBlock: options.forceBlock ?? baseOptions.forceBlock,\n forceInline: options.forceInline ?? baseOptions.forceInline,\n preserveFrontmatter:\n options.preserveFrontmatter ?? baseOptions.preserveFrontmatter,\n tagfilter: options.tagfilter ?? baseOptions.tagfilter,\n wrapper: wrapper || baseOptions.wrapper,\n forceWrapper: !!(wrapper || baseOptions.wrapper),\n components: { ...baseComponents, ...components },\n };\n};\n\nexport const MarkdownProvider: FunctionComponent<MarkdownProviderProps> = ({\n children,\n components,\n wrapper,\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n renderMarkdown: customRenderFn,\n}) => {\n const baseOptions: Omit<RenderMarkdownOptions, 'components'> = {\n forceBlock,\n forceInline,\n wrapper,\n forceWrapper: !!wrapper,\n preserveFrontmatter,\n tagfilter,\n };\n\n // Standard internal renderer\n const defaultRenderMarkdown = (\n markdown: string | ParsedMarkdown,\n options?: MarkdownProviderOptions,\n componentsOverride?: HTMLComponents<'permissive', {}>,\n wrapperOverride?: ComponentType<any> | keyof JSX.IntrinsicElements\n ): ComponentChildren => {\n const mergedOptions = mergeOptions(\n components,\n baseOptions,\n options,\n componentsOverride ?? {},\n wrapperOverride\n );\n return compileMarkdown(markdown, mergedOptions) as ComponentChildren;\n };\n\n // Wrapper for user-provided custom renderer\n // Note: We wrap in a clean Provider to prevent infinite recursion\n const customRenderMarkdownWrapper = (\n markdown: string | ParsedMarkdown,\n options?: MarkdownProviderOptions,\n componentsOverride?: HTMLComponents<'permissive', {}>,\n wrapperOverride?: ComponentType<any> | keyof JSX.IntrinsicElements\n ): ComponentChildren => (\n <MarkdownContext.Provider value={undefined}>\n {customRenderFn?.(markdown, options, componentsOverride, wrapperOverride)}\n </MarkdownContext.Provider>\n );\n\n return (\n <MarkdownContext.Provider\n value={{\n components,\n renderMarkdown: customRenderFn\n ? customRenderMarkdownWrapper\n : defaultRenderMarkdown,\n }}\n >\n {children}\n </MarkdownContext.Provider>\n );\n};\n"],"mappings":";;;;;;;AA0EA,MAAM,4CACJ,MACF;AAEA,MAAa,wDAAsC,eAAe;AAElE,MAAM,gBACJ,gBACA,aACA,UAAmC,CAAC,GACpC,aAA+C,CAAC,GAChD,YAC0B;CAC1B,OAAO;EACL,GAAG;EACH,GAAG;EACH,YAAY,QAAQ,cAAc,YAAY;EAC9C,aAAa,QAAQ,eAAe,YAAY;EAChD,qBACE,QAAQ,uBAAuB,YAAY;EAC7C,WAAW,QAAQ,aAAa,YAAY;EAC5C,SAAS,WAAW,YAAY;EAChC,cAAc,CAAC,EAAE,WAAW,YAAY;EACxC,YAAY;GAAE,GAAG;GAAgB,GAAG;EAAW;CACjD;AACF;AAEA,MAAa,oBAA8D,EACzE,UACA,YACA,SACA,YACA,aACA,qBACA,WACA,gBAAgB,qBACZ;CACJ,MAAM,cAAyD;EAC7D;EACA;EACA;EACA,cAAc,CAAC,CAAC;EAChB;EACA;CACF;CAGA,MAAM,yBACJ,UACA,SACA,oBACA,oBACsB;EAQtB,OAAOA,0CAAgB,UAPD,aACpB,YACA,aACA,SACA,sBAAsB,CAAC,GACvB,eAE2C,CAAC;CAChD;CAIA,MAAM,+BACJ,UACA,SACA,oBACA,oBAEA,4CAAC,gBAAgB,UAAjB;EAA0B,OAAO;YAC9B,iBAAiB,UAAU,SAAS,oBAAoB,eAAe;CAChD;CAG5B,OACE,4CAAC,gBAAgB,UAAjB;EACE,OAAO;GACL;GACA,gBAAgB,iBACZ,8BACA;EACN;EAEC;CACuB;AAE9B"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_markdown_compiler = require('./compiler.cjs');
4
3
  const require_markdown_MarkdownProvider = require('./MarkdownProvider.cjs');
5
4
  let preact_jsx_runtime = require("preact/jsx-runtime");
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownRenderer.cjs","names":["compileMarkdown","useMarkdownContext"],"sources":["../../../src/markdown/MarkdownRenderer.tsx"],"sourcesContent":["import type {\n ComponentChildren,\n ComponentType,\n FunctionComponent,\n JSX,\n} from 'preact';\nimport type { HTMLComponents } from '../html/types';\nimport {\n compileMarkdown,\n type MarkdownCompilerOptions,\n type ParsedMarkdown,\n} from './compiler';\nimport {\n type MarkdownProviderOptions,\n useMarkdownContext,\n} from './MarkdownProvider';\n\nexport type RenderMarkdownProps = MarkdownProviderOptions & {\n /**\n * Component overrides for HTML tags.\n * Only used if not wrapped in a MarkdownProvider.\n */\n components?: HTMLComponents<'permissive', {}>;\n /**\n * Wrapper element or component to be used when there are multiple children.\n * Only used if not wrapped in a MarkdownProvider.\n */\n wrapper?: ComponentType<any> | keyof JSX.IntrinsicElements;\n};\n\nexport const renderMarkdown = (\n content: string | ParsedMarkdown,\n {\n components,\n wrapper,\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n }: RenderMarkdownProps = {}\n): JSX.Element => {\n // Map public options to internal processor options\n const internalOptions: MarkdownCompilerOptions = {\n components,\n forceBlock,\n forceInline,\n wrapper: wrapper as any,\n forceWrapper: !!wrapper,\n preserveFrontmatter,\n tagfilter,\n };\n\n return compileMarkdown(content, internalOptions) as JSX.Element;\n};\n\nexport const useMarkdownRenderer = ({\n components,\n wrapper,\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n}: RenderMarkdownProps = {}) => {\n const context = useMarkdownContext();\n\n return (content: string | ParsedMarkdown) => {\n if (context) {\n return context.renderMarkdown(\n content,\n {\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n },\n components,\n wrapper\n );\n }\n\n return renderMarkdown(content, {\n components,\n wrapper,\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n });\n };\n};\n\nexport type MarkdownRendererProps = RenderMarkdownProps & {\n /**\n * The markdown content to render.\n */\n children: string | ParsedMarkdown;\n /**\n * Custom render function for markdown.\n * If provided, it will overwrite context and default rendering.\n */\n renderMarkdown?: (\n markdown: string | ParsedMarkdown,\n options?: {\n components?: HTMLComponents<'permissive', {}>;\n wrapper?: ComponentType<any> | keyof JSX.IntrinsicElements;\n forceBlock?: boolean;\n forceInline?: boolean;\n preserveFrontmatter?: boolean;\n tagfilter?: boolean;\n }\n ) => ComponentChildren | Promise<ComponentChildren>;\n};\n\n/**\n * Preact component that renders markdown to JSX.\n *\n * It uses the renderMarkdown function from the MarkdownProvider context if available.\n * Otherwise, it falls back to the default compiler with provided components and options.\n */\nexport const MarkdownRenderer: FunctionComponent<MarkdownRendererProps> = ({\n children = '',\n components,\n wrapper,\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n renderMarkdown: customRenderMarkdown,\n}) => {\n const context = useMarkdownContext();\n\n if (customRenderMarkdown) {\n return (\n <>\n {customRenderMarkdown(children, {\n components,\n wrapper,\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n })}\n </>\n );\n }\n\n if (context) {\n return (\n <>\n {context.renderMarkdown(\n children,\n {\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n },\n components,\n wrapper\n )}\n </>\n );\n }\n\n return renderMarkdown(children, {\n components,\n wrapper,\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n });\n};\n"],"mappings":";;;;;;;AA8BA,MAAa,kBACX,SACA,EACE,YACA,SACA,YACA,aACA,qBACA,cACuB,EAAE,KACX;AAYhB,QAAOA,0CAAgB,SAAS;EAT9B;EACA;EACA;EACS;EACT,cAAc,CAAC,CAAC;EAChB;EACA;EAG6C,CAAC;;AAGlD,MAAa,uBAAuB,EAClC,YACA,SACA,YACA,aACA,qBACA,cACuB,EAAE,KAAK;CAC9B,MAAM,UAAUC,sDAAoB;AAEpC,SAAQ,YAAqC;AAC3C,MAAI,QACF,QAAO,QAAQ,eACb,SACA;GACE;GACA;GACA;GACA;GACD,EACD,YACA,QACD;AAGH,SAAO,eAAe,SAAS;GAC7B;GACA;GACA;GACA;GACA;GACA;GACD,CAAC;;;;;;;;;AAgCN,MAAa,oBAA8D,EACzE,WAAW,IACX,YACA,SACA,YACA,aACA,qBACA,WACA,gBAAgB,2BACZ;CACJ,MAAM,UAAUA,sDAAoB;AAEpC,KAAI,qBACF,QACE,qFACG,qBAAqB,UAAU;EAC9B;EACA;EACA;EACA;EACA;EACA;EACD,CAAC,EACD;AAIP,KAAI,QACF,QACE,qFACG,QAAQ,eACP,UACA;EACE;EACA;EACA;EACA;EACD,EACD,YACA,QACD,EACA;AAIP,QAAO,eAAe,UAAU;EAC9B;EACA;EACA;EACA;EACA;EACA;EACD,CAAC"}
1
+ {"version":3,"file":"MarkdownRenderer.cjs","names":["compileMarkdown","useMarkdownContext"],"sources":["../../../src/markdown/MarkdownRenderer.tsx"],"sourcesContent":["import type {\n ComponentChildren,\n ComponentType,\n FunctionComponent,\n JSX,\n} from 'preact';\nimport type { HTMLComponents } from '../html/types';\nimport {\n compileMarkdown,\n type MarkdownCompilerOptions,\n type ParsedMarkdown,\n} from './compiler';\nimport {\n type MarkdownProviderOptions,\n useMarkdownContext,\n} from './MarkdownProvider';\n\nexport type RenderMarkdownProps = MarkdownProviderOptions & {\n /**\n * Component overrides for HTML tags.\n * Only used if not wrapped in a MarkdownProvider.\n */\n components?: HTMLComponents<'permissive', {}>;\n /**\n * Wrapper element or component to be used when there are multiple children.\n * Only used if not wrapped in a MarkdownProvider.\n */\n wrapper?: ComponentType<any> | keyof JSX.IntrinsicElements;\n};\n\nexport const renderMarkdown = (\n content: string | ParsedMarkdown,\n {\n components,\n wrapper,\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n }: RenderMarkdownProps = {}\n): JSX.Element => {\n // Map public options to internal processor options\n const internalOptions: MarkdownCompilerOptions = {\n components,\n forceBlock,\n forceInline,\n wrapper: wrapper as any,\n forceWrapper: !!wrapper,\n preserveFrontmatter,\n tagfilter,\n };\n\n return compileMarkdown(content, internalOptions) as JSX.Element;\n};\n\nexport const useMarkdownRenderer = ({\n components,\n wrapper,\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n}: RenderMarkdownProps = {}) => {\n const context = useMarkdownContext();\n\n return (content: string | ParsedMarkdown) => {\n if (context) {\n return context.renderMarkdown(\n content,\n {\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n },\n components,\n wrapper\n );\n }\n\n return renderMarkdown(content, {\n components,\n wrapper,\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n });\n };\n};\n\nexport type MarkdownRendererProps = RenderMarkdownProps & {\n /**\n * The markdown content to render.\n */\n children: string | ParsedMarkdown;\n /**\n * Custom render function for markdown.\n * If provided, it will overwrite context and default rendering.\n */\n renderMarkdown?: (\n markdown: string | ParsedMarkdown,\n options?: {\n components?: HTMLComponents<'permissive', {}>;\n wrapper?: ComponentType<any> | keyof JSX.IntrinsicElements;\n forceBlock?: boolean;\n forceInline?: boolean;\n preserveFrontmatter?: boolean;\n tagfilter?: boolean;\n }\n ) => ComponentChildren | Promise<ComponentChildren>;\n};\n\n/**\n * Preact component that renders markdown to JSX.\n *\n * It uses the renderMarkdown function from the MarkdownProvider context if available.\n * Otherwise, it falls back to the default compiler with provided components and options.\n */\nexport const MarkdownRenderer: FunctionComponent<MarkdownRendererProps> = ({\n children = '',\n components,\n wrapper,\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n renderMarkdown: customRenderMarkdown,\n}) => {\n const context = useMarkdownContext();\n\n if (customRenderMarkdown) {\n return (\n <>\n {customRenderMarkdown(children, {\n components,\n wrapper,\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n })}\n </>\n );\n }\n\n if (context) {\n return (\n <>\n {context.renderMarkdown(\n children,\n {\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n },\n components,\n wrapper\n )}\n </>\n );\n }\n\n return renderMarkdown(children, {\n components,\n wrapper,\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n });\n};\n"],"mappings":";;;;;;AA8BA,MAAa,kBACX,SACA,EACE,YACA,SACA,YACA,aACA,qBACA,cACuB,CAAC,MACV;CAYhB,OAAOA,0CAAgB,SAAS;EAT9B;EACA;EACA;EACS;EACT,cAAc,CAAC,CAAC;EAChB;EACA;CAG4C,CAAC;AACjD;AAEA,MAAa,uBAAuB,EAClC,YACA,SACA,YACA,aACA,qBACA,cACuB,CAAC,MAAM;CAC9B,MAAM,UAAUC,qDAAmB;CAEnC,QAAQ,YAAqC;EAC3C,IAAI,SACF,OAAO,QAAQ,eACb,SACA;GACE;GACA;GACA;GACA;EACF,GACA,YACA,OACF;EAGF,OAAO,eAAe,SAAS;GAC7B;GACA;GACA;GACA;GACA;GACA;EACF,CAAC;CACH;AACF;;;;;;;AA8BA,MAAa,oBAA8D,EACzE,WAAW,IACX,YACA,SACA,YACA,aACA,qBACA,WACA,gBAAgB,2BACZ;CACJ,MAAM,UAAUA,qDAAmB;CAEnC,IAAI,sBACF,OACE,qFACG,qBAAqB,UAAU;EAC9B;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,EACD;CAIN,IAAI,SACF,OACE,qFACG,QAAQ,eACP,UACA;EACE;EACA;EACA;EACA;CACF,GACA,YACA,OACF,EACA;CAIN,OAAO,eAAe,UAAU;EAC9B;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;AACH"}
@@ -1,7 +1,6 @@
1
1
  'use client';
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
5
4
  const require_client_useLocale = require('../client/useLocale.cjs');
6
5
  const require_markdown_MarkdownProvider = require('./MarkdownProvider.cjs');
7
6
  let _intlayer_core_markdown = require("@intlayer/core/markdown");
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownRendererPlugin.cjs","names":["useMarkdownContext","useLocale"],"sources":["../../../src/markdown/MarkdownRendererPlugin.tsx"],"sourcesContent":["'use client';\n\nimport { getContentNodeByKeyPath } from '@intlayer/core/dictionaryManipulator';\nimport { getMarkdownMetadata } from '@intlayer/core/markdown';\nimport type { ContentNode } from '@intlayer/types/dictionary';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport type { ComponentChildren, FunctionComponent } from 'preact';\nimport { useLocale } from '../client/useLocale';\nimport type { HTMLComponents } from '../html/types';\nimport {\n type MarkdownProviderOptions,\n useMarkdownContext,\n} from './MarkdownProvider';\n\ntype MarkdownRendererPluginProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n locale?: LocalesValues;\n children: string;\n options?: MarkdownProviderOptions;\n components?: HTMLComponents<'permissive', {}>;\n};\n\nexport const MarkdownRendererPlugin: FunctionComponent<\n MarkdownRendererPluginProps\n> = (props): ComponentChildren => {\n const { children, options, components } = props;\n const context = useMarkdownContext();\n const renderMarkdown = context?.renderMarkdown ?? ((md) => md);\n\n return renderMarkdown(children, options, {\n ...(context?.components ?? {}),\n ...(components ?? {}),\n }) as ComponentChildren;\n};\n\ntype MarkdownMetadataRendererProps = MarkdownRendererPluginProps & {\n metadataKeyPath: KeyPath[];\n};\n\nexport const MarkdownMetadataRenderer: FunctionComponent<\n MarkdownMetadataRendererProps\n> = ({ children, metadataKeyPath }): ComponentChildren => {\n const { locale: currentLocale } = useLocale();\n\n const metadata = getMarkdownMetadata(children);\n\n const metadataEl = getContentNodeByKeyPath(\n metadata as ContentNode,\n metadataKeyPath,\n currentLocale as any\n );\n\n return metadataEl as ComponentChildren;\n};\n"],"mappings":";;;;;;;;;;AAwBA,MAAa,0BAER,UAA6B;CAChC,MAAM,EAAE,UAAU,SAAS,eAAe;CAC1C,MAAM,UAAUA,sDAAoB;AAGpC,SAFuB,SAAS,oBAAoB,OAAO,KAErC,UAAU,SAAS;EACvC,GAAI,SAAS,cAAc,EAAE;EAC7B,GAAI,cAAc,EAAE;EACrB,CAAC;;AAOJ,MAAa,4BAER,EAAE,UAAU,sBAAyC;CACxD,MAAM,EAAE,QAAQ,kBAAkBC,oCAAW;AAU7C,2HARqC,SAG3B,EACR,iBACA,cAGe"}
1
+ {"version":3,"file":"MarkdownRendererPlugin.cjs","names":["useMarkdownContext","useLocale"],"sources":["../../../src/markdown/MarkdownRendererPlugin.tsx"],"sourcesContent":["'use client';\n\nimport { getContentNodeByKeyPath } from '@intlayer/core/dictionaryManipulator';\nimport { getMarkdownMetadata } from '@intlayer/core/markdown';\nimport type { ContentNode } from '@intlayer/types/dictionary';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport type { ComponentChildren, FunctionComponent } from 'preact';\nimport { useLocale } from '../client/useLocale';\nimport type { HTMLComponents } from '../html/types';\nimport {\n type MarkdownProviderOptions,\n useMarkdownContext,\n} from './MarkdownProvider';\n\ntype MarkdownRendererPluginProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n locale?: LocalesValues;\n children: string;\n options?: MarkdownProviderOptions;\n components?: HTMLComponents<'permissive', {}>;\n};\n\nexport const MarkdownRendererPlugin: FunctionComponent<\n MarkdownRendererPluginProps\n> = (props): ComponentChildren => {\n const { children, options, components } = props;\n const context = useMarkdownContext();\n const renderMarkdown = context?.renderMarkdown ?? ((md) => md);\n\n return renderMarkdown(children, options, {\n ...(context?.components ?? {}),\n ...(components ?? {}),\n }) as ComponentChildren;\n};\n\ntype MarkdownMetadataRendererProps = MarkdownRendererPluginProps & {\n metadataKeyPath: KeyPath[];\n};\n\nexport const MarkdownMetadataRenderer: FunctionComponent<\n MarkdownMetadataRendererProps\n> = ({ children, metadataKeyPath }): ComponentChildren => {\n const { locale: currentLocale } = useLocale();\n\n const metadata = getMarkdownMetadata(children);\n\n const metadataEl = getContentNodeByKeyPath(\n metadata as ContentNode,\n metadataKeyPath,\n currentLocale as any\n );\n\n return metadataEl as ComponentChildren;\n};\n"],"mappings":";;;;;;;;;AAwBA,MAAa,0BAER,UAA6B;CAChC,MAAM,EAAE,UAAU,SAAS,eAAe;CAC1C,MAAM,UAAUA,qDAAmB;CAGnC,QAFuB,SAAS,oBAAoB,OAAO,IAEtC,CAAC,UAAU,SAAS;EACvC,GAAI,SAAS,cAAc,CAAC;EAC5B,GAAI,cAAc,CAAC;CACrB,CAAC;AACH;AAMA,MAAa,4BAER,EAAE,UAAU,sBAAyC;CACxD,MAAM,EAAE,QAAQ,kBAAkBC,mCAAU;CAU5C,0HARqC,QAG5B,GACP,iBACA,aAGc;AAClB"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_markdown_runtime = require('./runtime.cjs');
4
3
  let _intlayer_core_markdown = require("@intlayer/core/markdown");
5
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"compiler.cjs","names":["preactRuntime"],"sources":["../../../src/markdown/compiler.ts"],"sourcesContent":["/**\n * Preact adapter for the framework-agnostic markdown processor.\n */\n\nimport {\n type CompileOptions,\n compileWithOptions,\n parseMarkdown as coreParseMarkdown,\n renderMarkdownAst as coreRenderMarkdownAst,\n type MarkdownContext,\n type ParsedMarkdown,\n} from '@intlayer/core/markdown';\nimport { preactRuntime } from './runtime';\n\n/**\n * Options accepted by `compileMarkdown` and `parseMarkdown` to customise\n * rendering behaviour (custom components, sanitizer, slugify, rule hooks, …).\n */\nexport type MarkdownCompilerOptions = CompileOptions;\n\n/**\n * Intermediate AST produced by `parseMarkdown`.\n * Pass this to `compileMarkdown` to skip re-parsing when the same content is\n * rendered multiple times.\n */\nexport type { ParsedMarkdown };\n\n/**\n * **Step 1 of 2 — parse only.**\n * Converts a raw markdown string into a `ParsedMarkdown` AST without rendering\n * any Preact elements. Use this when you need to:\n * - Cache the parsed result and render it several times with different options.\n * - Inspect or transform the AST before rendering.\n * - Defer the render step to a later point.\n *\n * @param markdown - The markdown source string.\n * @param options - Options that affect parsing (sanitizer, slugify, …).\n * @returns A `ParsedMarkdown` AST ready to be passed to `compileMarkdown`.\n *\n * @example\n * ```tsx\n * const ast = parseMarkdown('# Hello **world**');\n * const element = compileMarkdown(ast, { forceBlock: true });\n * ```\n */\nexport const parseMarkdown = (\n markdown: string = '',\n options: MarkdownCompilerOptions = {}\n): ParsedMarkdown => {\n const {\n components,\n namedCodesToUnicode,\n sanitizer,\n slugify,\n ...compilerOptions\n } = options;\n\n const ctx: MarkdownContext<any> = {\n runtime: preactRuntime,\n components,\n namedCodesToUnicode,\n sanitizer: sanitizer as any,\n slugify,\n };\n\n return coreParseMarkdown(markdown, ctx, compilerOptions);\n};\n\n/**\n * **Steps 1 + 2 — parse and render in one shot.**\n * Accepts a raw markdown string or a pre-parsed `ParsedMarkdown` AST and\n * returns a Preact element. Use `parseMarkdown` first when you need to reuse\n * the same AST with different options.\n *\n * @param input - Markdown string or pre-parsed AST.\n * @param options - Rendering options (custom components, sanitizer, slugify, …).\n * @returns A Preact element representing the rendered markdown.\n *\n * @example\n * ```tsx\n * const element = compileMarkdown('# Hello **world**', { forceBlock: true });\n * ```\n */\nexport const compileMarkdown = (\n input: string | ParsedMarkdown = '',\n options: MarkdownCompilerOptions = {}\n) => {\n if (typeof input === 'string') {\n return compileWithOptions(input, preactRuntime, options);\n }\n\n const {\n components,\n namedCodesToUnicode,\n sanitizer,\n slugify,\n ...compilerOptions\n } = options;\n\n const ctx: MarkdownContext<any> = {\n runtime: preactRuntime,\n components,\n namedCodesToUnicode,\n sanitizer: sanitizer as any,\n slugify,\n };\n\n return coreRenderMarkdownAst(input, ctx, compilerOptions);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAa,iBACX,WAAmB,IACnB,UAAmC,EAAE,KAClB;CACnB,MAAM,EACJ,YACA,qBACA,WACA,SACA,GAAG,oBACD;AAUJ,mDAAyB,UAAU;EAPjC,SAASA;EACT;EACA;EACW;EACX;EAGoC,EAAE,gBAAgB;;;;;;;;;;;;;;;;;AAkB1D,MAAa,mBACX,QAAiC,IACjC,UAAmC,EAAE,KAClC;AACH,KAAI,OAAO,UAAU,SACnB,wDAA0B,OAAOA,kCAAe,QAAQ;CAG1D,MAAM,EACJ,YACA,qBACA,WACA,SACA,GAAG,oBACD;AAUJ,uDAA6B,OAAO;EAPlC,SAASA;EACT;EACA;EACW;EACX;EAGqC,EAAE,gBAAgB"}
1
+ {"version":3,"file":"compiler.cjs","names":["preactRuntime"],"sources":["../../../src/markdown/compiler.ts"],"sourcesContent":["/**\n * Preact adapter for the framework-agnostic markdown processor.\n */\n\nimport {\n type CompileOptions,\n compileWithOptions,\n parseMarkdown as coreParseMarkdown,\n renderMarkdownAst as coreRenderMarkdownAst,\n type MarkdownContext,\n type ParsedMarkdown,\n} from '@intlayer/core/markdown';\nimport { preactRuntime } from './runtime';\n\n/**\n * Options accepted by `compileMarkdown` and `parseMarkdown` to customise\n * rendering behaviour (custom components, sanitizer, slugify, rule hooks, …).\n */\nexport type MarkdownCompilerOptions = CompileOptions;\n\n/**\n * Intermediate AST produced by `parseMarkdown`.\n * Pass this to `compileMarkdown` to skip re-parsing when the same content is\n * rendered multiple times.\n */\nexport type { ParsedMarkdown };\n\n/**\n * **Step 1 of 2 — parse only.**\n * Converts a raw markdown string into a `ParsedMarkdown` AST without rendering\n * any Preact elements. Use this when you need to:\n * - Cache the parsed result and render it several times with different options.\n * - Inspect or transform the AST before rendering.\n * - Defer the render step to a later point.\n *\n * @param markdown - The markdown source string.\n * @param options - Options that affect parsing (sanitizer, slugify, …).\n * @returns A `ParsedMarkdown` AST ready to be passed to `compileMarkdown`.\n *\n * @example\n * ```tsx\n * const ast = parseMarkdown('# Hello **world**');\n * const element = compileMarkdown(ast, { forceBlock: true });\n * ```\n */\nexport const parseMarkdown = (\n markdown: string = '',\n options: MarkdownCompilerOptions = {}\n): ParsedMarkdown => {\n const {\n components,\n namedCodesToUnicode,\n sanitizer,\n slugify,\n ...compilerOptions\n } = options;\n\n const ctx: MarkdownContext<any> = {\n runtime: preactRuntime,\n components,\n namedCodesToUnicode,\n sanitizer: sanitizer as any,\n slugify,\n };\n\n return coreParseMarkdown(markdown, ctx, compilerOptions);\n};\n\n/**\n * **Steps 1 + 2 — parse and render in one shot.**\n * Accepts a raw markdown string or a pre-parsed `ParsedMarkdown` AST and\n * returns a Preact element. Use `parseMarkdown` first when you need to reuse\n * the same AST with different options.\n *\n * @param input - Markdown string or pre-parsed AST.\n * @param options - Rendering options (custom components, sanitizer, slugify, …).\n * @returns A Preact element representing the rendered markdown.\n *\n * @example\n * ```tsx\n * const element = compileMarkdown('# Hello **world**', { forceBlock: true });\n * ```\n */\nexport const compileMarkdown = (\n input: string | ParsedMarkdown = '',\n options: MarkdownCompilerOptions = {}\n) => {\n if (typeof input === 'string') {\n return compileWithOptions(input, preactRuntime, options);\n }\n\n const {\n components,\n namedCodesToUnicode,\n sanitizer,\n slugify,\n ...compilerOptions\n } = options;\n\n const ctx: MarkdownContext<any> = {\n runtime: preactRuntime,\n components,\n namedCodesToUnicode,\n sanitizer: sanitizer as any,\n slugify,\n };\n\n return coreRenderMarkdownAst(input, ctx, compilerOptions);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAa,iBACX,WAAmB,IACnB,UAAmC,CAAC,MACjB;CACnB,MAAM,EACJ,YACA,qBACA,WACA,SACA,GAAG,oBACD;CAUJ,kDAAyB,UAAU;EAPjC,SAASA;EACT;EACA;EACW;EACX;CAGmC,GAAG,eAAe;AACzD;;;;;;;;;;;;;;;;AAiBA,MAAa,mBACX,QAAiC,IACjC,UAAmC,CAAC,MACjC;CACH,IAAI,OAAO,UAAU,UACnB,uDAA0B,OAAOA,kCAAe,OAAO;CAGzD,MAAM,EACJ,YACA,qBACA,WACA,SACA,GAAG,oBACD;CAUJ,sDAA6B,OAAO;EAPlC,SAASA;EACT;EACA;EACW;EACX;CAGoC,GAAG,eAAe;AAC1D"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  let preact = require("preact");
4
3
 
5
4
  //#region src/markdown/runtime.ts
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.cjs","names":[],"sources":["../../../src/markdown/runtime.ts"],"sourcesContent":["/**\n * Preact-specific MarkdownRuntime implementation.\n */\n\nimport type { HTMLTag, MarkdownRuntime } from '@intlayer/core/markdown';\nimport {\n type Component,\n cloneElement,\n createElement,\n Fragment,\n type VNode,\n} from 'preact';\n\n/**\n * Preact-specific runtime for the markdown processor.\n */\nexport const preactRuntime: MarkdownRuntime = {\n createElement: (\n type: string | Component,\n props: Record<string, any> | null,\n ...children: any[]\n ): any => createElement(type as any, props, ...children),\n\n cloneElement: (\n element: unknown,\n props: Record<string, any>,\n ...children: any[]\n ): any => cloneElement(element as VNode, props, ...children),\n\n Fragment,\n\n normalizeProps: (\n _tag: HTMLTag,\n props: Record<string, any>\n ): Record<string, any> => props,\n};\n\nexport default preactRuntime;\n"],"mappings":";;;;;;;;AAgBA,MAAa,gBAAiC;CAC5C,gBACE,MACA,OACA,GAAG,uCACmB,MAAa,OAAO,GAAG,SAAS;CAExD,eACE,SACA,OACA,GAAG,sCACkB,SAAkB,OAAO,GAAG,SAAS;CAE5D;CAEA,iBACE,MACA,UACwB;CAC3B"}
1
+ {"version":3,"file":"runtime.cjs","names":[],"sources":["../../../src/markdown/runtime.ts"],"sourcesContent":["/**\n * Preact-specific MarkdownRuntime implementation.\n */\n\nimport type { HTMLTag, MarkdownRuntime } from '@intlayer/core/markdown';\nimport {\n type Component,\n cloneElement,\n createElement,\n Fragment,\n type VNode,\n} from 'preact';\n\n/**\n * Preact-specific runtime for the markdown processor.\n */\nexport const preactRuntime: MarkdownRuntime = {\n createElement: (\n type: string | Component,\n props: Record<string, any> | null,\n ...children: any[]\n ): any => createElement(type as any, props, ...children),\n\n cloneElement: (\n element: unknown,\n props: Record<string, any>,\n ...children: any[]\n ): any => cloneElement(element as VNode, props, ...children),\n\n Fragment,\n\n normalizeProps: (\n _tag: HTMLTag,\n props: Record<string, any>\n ): Record<string, any> => props,\n};\n\nexport default preactRuntime;\n"],"mappings":";;;;;;;AAgBA,MAAa,gBAAiC;CAC5C,gBACE,MACA,OACA,GAAG,uCACmB,MAAa,OAAO,GAAG,QAAQ;CAEvD,eACE,SACA,OACA,GAAG,sCACkB,SAAkB,OAAO,GAAG,QAAQ;CAE3D;CAEA,iBACE,MACA,UACwB;AAC5B"}