vanilla-intlayer 8.7.14 → 8.9.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 (209) hide show
  1. package/dist/cjs/_virtual/_rolldown/runtime.cjs +29 -0
  2. package/dist/cjs/client/index.cjs +24 -1
  3. package/dist/cjs/client/installIntlayer.cjs +98 -1
  4. package/dist/cjs/client/installIntlayer.cjs.map +1 -0
  5. package/dist/cjs/client/useDictionary.cjs +59 -1
  6. package/dist/cjs/client/useDictionary.cjs.map +1 -0
  7. package/dist/cjs/client/useDictionaryDynamic.cjs +93 -1
  8. package/dist/cjs/client/useDictionaryDynamic.cjs.map +1 -0
  9. package/dist/cjs/client/useIntlayer.cjs +65 -1
  10. package/dist/cjs/client/useIntlayer.cjs.map +1 -0
  11. package/dist/cjs/client/useLocale.cjs +58 -1
  12. package/dist/cjs/client/useLocale.cjs.map +1 -0
  13. package/dist/cjs/client/useLocaleStorage.cjs +51 -1
  14. package/dist/cjs/client/useLocaleStorage.cjs.map +1 -0
  15. package/dist/cjs/client/useRewriteURL.cjs +46 -1
  16. package/dist/cjs/client/useRewriteURL.cjs.map +1 -0
  17. package/dist/cjs/editor/useEditor.cjs +49 -1
  18. package/dist/cjs/editor/useEditor.cjs.map +1 -0
  19. package/dist/cjs/format/index.cjs +20 -1
  20. package/dist/cjs/format/useCompact.cjs +17 -1
  21. package/dist/cjs/format/useCompact.cjs.map +1 -0
  22. package/dist/cjs/format/useCurrency.cjs +17 -1
  23. package/dist/cjs/format/useCurrency.cjs.map +1 -0
  24. package/dist/cjs/format/useDate.cjs +26 -1
  25. package/dist/cjs/format/useDate.cjs.map +1 -0
  26. package/dist/cjs/format/useIntl.cjs +44 -1
  27. package/dist/cjs/format/useIntl.cjs.map +1 -0
  28. package/dist/cjs/format/useList.cjs +17 -1
  29. package/dist/cjs/format/useList.cjs.map +1 -0
  30. package/dist/cjs/format/useNumber.cjs +20 -1
  31. package/dist/cjs/format/useNumber.cjs.map +1 -0
  32. package/dist/cjs/format/usePercentage.cjs +17 -1
  33. package/dist/cjs/format/usePercentage.cjs.map +1 -0
  34. package/dist/cjs/format/useRelativeTime.cjs +17 -1
  35. package/dist/cjs/format/useRelativeTime.cjs.map +1 -0
  36. package/dist/cjs/format/useUnit.cjs +17 -1
  37. package/dist/cjs/format/useUnit.cjs.map +1 -0
  38. package/dist/cjs/getDictionary.cjs +11 -1
  39. package/dist/cjs/getDictionary.cjs.map +1 -0
  40. package/dist/cjs/getIntlayer.cjs +11 -1
  41. package/dist/cjs/getIntlayer.cjs.map +1 -0
  42. package/dist/cjs/html/HTMLRenderer.cjs +22 -1
  43. package/dist/cjs/html/HTMLRenderer.cjs.map +1 -0
  44. package/dist/cjs/html/index.cjs +9 -1
  45. package/dist/cjs/html/installIntlayerHTML.cjs +91 -1
  46. package/dist/cjs/html/installIntlayerHTML.cjs.map +1 -0
  47. package/dist/cjs/html/types.cjs +0 -1
  48. package/dist/cjs/index.cjs +37 -1
  49. package/dist/cjs/markdown/MarkdownRenderer.cjs +41 -1
  50. package/dist/cjs/markdown/MarkdownRenderer.cjs.map +1 -0
  51. package/dist/cjs/markdown/compiler.cjs +37 -1
  52. package/dist/cjs/markdown/compiler.cjs.map +1 -0
  53. package/dist/cjs/markdown/index.cjs +11 -1
  54. package/dist/cjs/markdown/installIntlayerMarkdown.cjs +98 -1
  55. package/dist/cjs/markdown/installIntlayerMarkdown.cjs.map +1 -0
  56. package/dist/cjs/markdown/runtime.cjs +87 -1
  57. package/dist/cjs/markdown/runtime.cjs.map +1 -0
  58. package/dist/cjs/plugins.cjs +240 -1
  59. package/dist/cjs/plugins.cjs.map +1 -0
  60. package/dist/cjs/renderIntlayerNode.cjs +44 -1
  61. package/dist/cjs/renderIntlayerNode.cjs.map +1 -0
  62. package/dist/esm/client/index.mjs +9 -8
  63. package/dist/esm/client/installIntlayer.mjs +93 -2
  64. package/dist/esm/client/installIntlayer.mjs.map +1 -0
  65. package/dist/esm/client/useDictionary.mjs +55 -8
  66. package/dist/esm/client/useDictionary.mjs.map +1 -0
  67. package/dist/esm/client/useDictionaryDynamic.mjs +82 -28
  68. package/dist/esm/client/useDictionaryDynamic.mjs.map +1 -0
  69. package/dist/esm/client/useIntlayer.mjs +61 -8
  70. package/dist/esm/client/useIntlayer.mjs.map +1 -0
  71. package/dist/esm/client/useLocale.mjs +51 -17
  72. package/dist/esm/client/useLocale.mjs.map +1 -0
  73. package/dist/esm/client/useLocaleStorage.mjs +39 -13
  74. package/dist/esm/client/useLocaleStorage.mjs.map +1 -0
  75. package/dist/esm/client/useRewriteURL.mjs +40 -12
  76. package/dist/esm/client/useRewriteURL.mjs.map +1 -0
  77. package/dist/esm/editor/useEditor.mjs +47 -2
  78. package/dist/esm/editor/useEditor.mjs.map +1 -0
  79. package/dist/esm/format/index.mjs +11 -10
  80. package/dist/esm/format/useCompact.mjs +11 -8
  81. package/dist/esm/format/useCompact.mjs.map +1 -0
  82. package/dist/esm/format/useCurrency.mjs +11 -8
  83. package/dist/esm/format/useCurrency.mjs.map +1 -0
  84. package/dist/esm/format/useDate.mjs +18 -12
  85. package/dist/esm/format/useDate.mjs.map +1 -0
  86. package/dist/esm/format/useIntl.mjs +36 -8
  87. package/dist/esm/format/useIntl.mjs.map +1 -0
  88. package/dist/esm/format/useList.mjs +11 -8
  89. package/dist/esm/format/useList.mjs.map +1 -0
  90. package/dist/esm/format/useNumber.mjs +14 -8
  91. package/dist/esm/format/useNumber.mjs.map +1 -0
  92. package/dist/esm/format/usePercentage.mjs +11 -8
  93. package/dist/esm/format/usePercentage.mjs.map +1 -0
  94. package/dist/esm/format/useRelativeTime.mjs +11 -8
  95. package/dist/esm/format/useRelativeTime.mjs.map +1 -0
  96. package/dist/esm/format/useUnit.mjs +11 -8
  97. package/dist/esm/format/useUnit.mjs.map +1 -0
  98. package/dist/esm/getDictionary.mjs +7 -4
  99. package/dist/esm/getDictionary.mjs.map +1 -0
  100. package/dist/esm/getIntlayer.mjs +7 -4
  101. package/dist/esm/getIntlayer.mjs.map +1 -0
  102. package/dist/esm/html/HTMLRenderer.mjs +17 -5
  103. package/dist/esm/html/HTMLRenderer.mjs.map +1 -0
  104. package/dist/esm/html/index.mjs +4 -3
  105. package/dist/esm/html/installIntlayerHTML.mjs +81 -13
  106. package/dist/esm/html/installIntlayerHTML.mjs.map +1 -0
  107. package/dist/esm/index.mjs +13 -12
  108. package/dist/esm/markdown/MarkdownRenderer.mjs +36 -16
  109. package/dist/esm/markdown/MarkdownRenderer.mjs.map +1 -0
  110. package/dist/esm/markdown/compiler.mjs +28 -4
  111. package/dist/esm/markdown/compiler.mjs.map +1 -0
  112. package/dist/esm/markdown/index.mjs +5 -4
  113. package/dist/esm/markdown/installIntlayerMarkdown.mjs +86 -23
  114. package/dist/esm/markdown/installIntlayerMarkdown.mjs.map +1 -0
  115. package/dist/esm/markdown/runtime.mjs +60 -28
  116. package/dist/esm/markdown/runtime.mjs.map +1 -0
  117. package/dist/esm/plugins.mjs +187 -133
  118. package/dist/esm/plugins.mjs.map +1 -0
  119. package/dist/esm/renderIntlayerNode.mjs +32 -15
  120. package/dist/esm/renderIntlayerNode.mjs.map +1 -0
  121. package/dist/types/client/index.d.ts +8 -0
  122. package/dist/{client → types/client}/installIntlayer.d.ts +27 -20
  123. package/dist/types/client/installIntlayer.d.ts.map +1 -0
  124. package/dist/{client → types/client}/useDictionary.d.ts +22 -17
  125. package/dist/types/client/useDictionary.d.ts.map +1 -0
  126. package/dist/{client → types/client}/useDictionaryDynamic.d.ts +10 -5
  127. package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -0
  128. package/dist/{client → types/client}/useIntlayer.d.ts +9 -4
  129. package/dist/types/client/useIntlayer.d.ts.map +1 -0
  130. package/dist/{client → types/client}/useLocale.d.ts +14 -10
  131. package/dist/types/client/useLocale.d.ts.map +1 -0
  132. package/dist/types/client/useLocaleStorage.d.ts +37 -0
  133. package/dist/types/client/useLocaleStorage.d.ts.map +1 -0
  134. package/dist/{client → types/client}/useRewriteURL.d.ts +5 -1
  135. package/dist/types/client/useRewriteURL.d.ts.map +1 -0
  136. package/dist/{editor → types/editor}/useEditor.d.ts +5 -1
  137. package/dist/types/editor/useEditor.d.ts.map +1 -0
  138. package/dist/types/format/index.d.ts +10 -0
  139. package/dist/types/format/useCompact.d.ts +7 -0
  140. package/dist/types/format/useCompact.d.ts.map +1 -0
  141. package/dist/types/format/useCurrency.d.ts +7 -0
  142. package/dist/types/format/useCurrency.d.ts.map +1 -0
  143. package/dist/types/format/useDate.d.ts +10 -0
  144. package/dist/types/format/useDate.d.ts.map +1 -0
  145. package/dist/{format → types/format}/useIntl.d.ts +10 -5
  146. package/dist/types/format/useIntl.d.ts.map +1 -0
  147. package/dist/types/format/useList.d.ts +7 -0
  148. package/dist/types/format/useList.d.ts.map +1 -0
  149. package/dist/types/format/useNumber.d.ts +10 -0
  150. package/dist/types/format/useNumber.d.ts.map +1 -0
  151. package/dist/types/format/usePercentage.d.ts +7 -0
  152. package/dist/types/format/usePercentage.d.ts.map +1 -0
  153. package/dist/types/format/useRelativeTime.d.ts +7 -0
  154. package/dist/types/format/useRelativeTime.d.ts.map +1 -0
  155. package/dist/types/format/useUnit.d.ts +7 -0
  156. package/dist/types/format/useUnit.d.ts.map +1 -0
  157. package/dist/types/getDictionary.d.ts +9 -0
  158. package/dist/types/getDictionary.d.ts.map +1 -0
  159. package/dist/types/getIntlayer.d.ts +8 -0
  160. package/dist/types/getIntlayer.d.ts.map +1 -0
  161. package/dist/types/html/HTMLRenderer.d.ts +21 -0
  162. package/dist/types/html/HTMLRenderer.d.ts.map +1 -0
  163. package/dist/types/html/index.d.ts +4 -0
  164. package/dist/{html → types/html}/installIntlayerHTML.d.ts +18 -13
  165. package/dist/types/html/installIntlayerHTML.d.ts.map +1 -0
  166. package/dist/{html → types/html}/types.d.ts +12 -14
  167. package/dist/types/html/types.d.ts.map +1 -0
  168. package/dist/types/index.d.ts +20 -0
  169. package/dist/types/index.d.ts.map +1 -0
  170. package/dist/types/markdown/MarkdownRenderer.d.ts +32 -0
  171. package/dist/types/markdown/MarkdownRenderer.d.ts.map +1 -0
  172. package/dist/types/markdown/compiler.d.ts +23 -0
  173. package/dist/types/markdown/compiler.d.ts.map +1 -0
  174. package/dist/types/markdown/index.d.ts +4 -0
  175. package/dist/types/markdown/installIntlayerMarkdown.d.ts +71 -0
  176. package/dist/types/markdown/installIntlayerMarkdown.d.ts.map +1 -0
  177. package/dist/types/markdown/runtime.d.ts +16 -0
  178. package/dist/types/markdown/runtime.d.ts.map +1 -0
  179. package/dist/types/plugins.d.ts +80 -0
  180. package/dist/types/plugins.d.ts.map +1 -0
  181. package/dist/types/renderIntlayerNode.d.ts +31 -0
  182. package/dist/types/renderIntlayerNode.d.ts.map +1 -0
  183. package/package.json +10 -13
  184. package/dist/client/index.d.ts +0 -7
  185. package/dist/client/useLocaleStorage.d.ts +0 -31
  186. package/dist/format/index.d.ts +0 -9
  187. package/dist/format/useCompact.d.ts +0 -2
  188. package/dist/format/useCurrency.d.ts +0 -2
  189. package/dist/format/useDate.d.ts +0 -5
  190. package/dist/format/useList.d.ts +0 -2
  191. package/dist/format/useNumber.d.ts +0 -5
  192. package/dist/format/usePercentage.d.ts +0 -2
  193. package/dist/format/useRelativeTime.d.ts +0 -2
  194. package/dist/format/useUnit.d.ts +0 -2
  195. package/dist/getDictionary.d.ts +0 -4
  196. package/dist/getIntlayer.d.ts +0 -3
  197. package/dist/html/HTMLRenderer.d.ts +0 -14
  198. package/dist/html/index.d.ts +0 -3
  199. package/dist/index.d.ts +0 -11
  200. package/dist/installIntlayer-C99qMzFH.mjs +0 -47
  201. package/dist/installIntlayer-CxkE8IxM.js +0 -1
  202. package/dist/markdown/MarkdownRenderer.d.ts +0 -22
  203. package/dist/markdown/compiler.d.ts +0 -19
  204. package/dist/markdown/index.d.ts +0 -3
  205. package/dist/markdown/installIntlayerMarkdown.d.ts +0 -70
  206. package/dist/markdown/runtime.d.ts +0 -12
  207. package/dist/plugins-Bp8aaTny.js +0 -1
  208. package/dist/plugins.d.ts +0 -78
  209. package/dist/renderIntlayerNode.d.ts +0 -22
@@ -1 +1,49 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../../installIntlayer-CxkE8IxM.js`);exports.useEditor=e.a;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ const require_client_installIntlayer = require('../client/installIntlayer.cjs');
4
+ let _intlayer_editor_isEnabled = require("@intlayer/editor/isEnabled");
5
+
6
+ //#region src/editor/useEditor.ts
7
+ /**
8
+ * Initialises the Intlayer visual editor client.
9
+ *
10
+ * Does nothing when `INTLAYER_EDITOR_ENABLED` is `"false"` or the editor
11
+ * package reports that it is disabled.
12
+ *
13
+ * Call this once at application startup.
14
+ *
15
+ * @returns A cleanup function that stops the editor.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * import { installIntlayer, useEditor } from 'vanilla-intlayer';
20
+ *
21
+ * installIntlayer('en');
22
+ * const stopEditor = useEditor();
23
+ * ```
24
+ */
25
+ const useEditor = () => {
26
+ if (process.env["INTLAYER_EDITOR_ENABLED"] === "false" || !_intlayer_editor_isEnabled.isEnabled) return () => {};
27
+ let unsubscribeLocale = null;
28
+ let stopped = false;
29
+ import("@intlayer/editor").then(({ initEditorClient }) => {
30
+ if (stopped) return;
31
+ const manager = initEditorClient();
32
+ const client = require_client_installIntlayer.getIntlayerClient();
33
+ manager.currentLocale.set(client.locale);
34
+ unsubscribeLocale = client.subscribe((newLocale) => {
35
+ manager.currentLocale.set(newLocale);
36
+ });
37
+ });
38
+ return () => {
39
+ stopped = true;
40
+ unsubscribeLocale?.();
41
+ import("@intlayer/editor").then(({ stopEditorClient }) => {
42
+ stopEditorClient();
43
+ });
44
+ };
45
+ };
46
+
47
+ //#endregion
48
+ exports.useEditor = useEditor;
49
+ //# sourceMappingURL=useEditor.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useEditor.cjs","names":["isEnabled","getIntlayerClient"],"sources":["../../../src/editor/useEditor.ts"],"sourcesContent":["import type { EditorStateManager } from '@intlayer/editor';\nimport { isEnabled } from '@intlayer/editor/isEnabled';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport { getIntlayerClient } from '../client/installIntlayer';\n\n/**\n * Initialises the Intlayer visual editor client.\n *\n * Does nothing when `INTLAYER_EDITOR_ENABLED` is `\"false\"` or the editor\n * package reports that it is disabled.\n *\n * Call this once at application startup.\n *\n * @returns A cleanup function that stops the editor.\n *\n * @example\n * ```ts\n * import { installIntlayer, useEditor } from 'vanilla-intlayer';\n *\n * installIntlayer('en');\n * const stopEditor = useEditor();\n * ```\n */\n\nexport const useEditor = (): (() => void) => {\n if (process.env['INTLAYER_EDITOR_ENABLED'] === 'false' || !isEnabled)\n return () => {};\n\n let unsubscribeLocale: (() => void) | null = null;\n let stopped = false;\n\n import('@intlayer/editor').then(({ initEditorClient }) => {\n if (stopped) return;\n const manager: EditorStateManager = initEditorClient();\n const client = getIntlayerClient();\n\n manager.currentLocale.set(client.locale as Locale);\n\n unsubscribeLocale = client.subscribe((newLocale) => {\n manager.currentLocale.set(newLocale as Locale);\n });\n });\n\n return () => {\n stopped = true;\n unsubscribeLocale?.();\n import('@intlayer/editor').then(({ stopEditorClient }) => {\n stopEditorClient();\n });\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAa,kBAAgC;AAC3C,KAAI,QAAQ,IAAI,+BAA+B,WAAW,CAACA,qCACzD,cAAa;CAEf,IAAI,oBAAyC;CAC7C,IAAI,UAAU;AAEd,QAAO,oBAAoB,MAAM,EAAE,uBAAuB;AACxD,MAAI,QAAS;EACb,MAAM,UAA8B,kBAAkB;EACtD,MAAM,SAASC,kDAAmB;AAElC,UAAQ,cAAc,IAAI,OAAO,OAAiB;AAElD,sBAAoB,OAAO,WAAW,cAAc;AAClD,WAAQ,cAAc,IAAI,UAAoB;IAC9C;GACF;AAEF,cAAa;AACX,YAAU;AACV,uBAAqB;AACrB,SAAO,oBAAoB,MAAM,EAAE,uBAAuB;AACxD,qBAAkB;IAClB"}
@@ -1 +1,20 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./useUnit.cjs`),t=require(`./useDate.cjs`),n=require(`./useNumber.cjs`),r=require(`./useRelativeTime.cjs`),i=require(`./useCompact.cjs`),a=require(`./useIntl.cjs`),o=require(`./useList.cjs`),s=require(`./usePercentage.cjs`),c=require(`./useCurrency.cjs`);exports.useCompact=i.useCompact,exports.useCurrency=c.useCurrency,exports.useDate=t.useDate,exports.useIntl=a.useIntl,exports.useList=o.useList,exports.useNumber=n.useNumber,exports.usePercentage=s.usePercentage,exports.useRelativeTime=r.useRelativeTime,exports.useUnit=e.useUnit;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_format_useUnit = require('./useUnit.cjs');
3
+ const require_format_useDate = require('./useDate.cjs');
4
+ const require_format_useNumber = require('./useNumber.cjs');
5
+ const require_format_useRelativeTime = require('./useRelativeTime.cjs');
6
+ const require_format_useCompact = require('./useCompact.cjs');
7
+ const require_format_useIntl = require('./useIntl.cjs');
8
+ const require_format_useList = require('./useList.cjs');
9
+ const require_format_usePercentage = require('./usePercentage.cjs');
10
+ const require_format_useCurrency = require('./useCurrency.cjs');
11
+
12
+ exports.useCompact = require_format_useCompact.useCompact;
13
+ exports.useCurrency = require_format_useCurrency.useCurrency;
14
+ exports.useDate = require_format_useDate.useDate;
15
+ exports.useIntl = require_format_useIntl.useIntl;
16
+ exports.useList = require_format_useList.useList;
17
+ exports.useNumber = require_format_useNumber.useNumber;
18
+ exports.usePercentage = require_format_usePercentage.usePercentage;
19
+ exports.useRelativeTime = require_format_useRelativeTime.useRelativeTime;
20
+ exports.useUnit = require_format_useUnit.useUnit;
@@ -1 +1,17 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../plugins-Bp8aaTny.js`);const e=require(`../../installIntlayer-CxkE8IxM.js`);let t=require(`@intlayer/core/formatters`);var n=()=>{let n=e.r();return(...e)=>(0,t.compact)(e[0],{...e[1],locale:e[1]?.locale??n.locale})};exports.useCompact=n;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ const require_client_installIntlayer = require('../client/installIntlayer.cjs');
4
+ let _intlayer_core_formatters = require("@intlayer/core/formatters");
5
+
6
+ //#region src/format/useCompact.ts
7
+ const useCompact = () => {
8
+ const client = require_client_installIntlayer.getIntlayerClient();
9
+ return (...args) => (0, _intlayer_core_formatters.compact)(args[0], {
10
+ ...args[1],
11
+ locale: args[1]?.locale ?? client.locale
12
+ });
13
+ };
14
+
15
+ //#endregion
16
+ exports.useCompact = useCompact;
17
+ //# sourceMappingURL=useCompact.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCompact.cjs","names":["getIntlayerClient"],"sources":["../../../src/format/useCompact.ts"],"sourcesContent":["import { compact } from '@intlayer/core/formatters';\nimport { getIntlayerClient } from '../client/installIntlayer';\n\nexport const useCompact = () => {\n const client = getIntlayerClient();\n\n return (...args: Parameters<typeof compact>) =>\n compact(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? client.locale,\n });\n};\n"],"mappings":";;;;;;AAGA,MAAa,mBAAmB;CAC9B,MAAM,SAASA,kDAAmB;AAElC,SAAQ,GAAG,gDACD,KAAK,IAAI;EACf,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU,OAAO;EACnC,CAAC"}
@@ -1 +1,17 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../plugins-Bp8aaTny.js`);const e=require(`../../installIntlayer-CxkE8IxM.js`);let t=require(`@intlayer/core/formatters`);var n=()=>{let n=e.r();return(...e)=>(0,t.currency)(e[0],{...e[1],locale:e[1]?.locale??n.locale})};exports.useCurrency=n;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ const require_client_installIntlayer = require('../client/installIntlayer.cjs');
4
+ let _intlayer_core_formatters = require("@intlayer/core/formatters");
5
+
6
+ //#region src/format/useCurrency.ts
7
+ const useCurrency = () => {
8
+ const client = require_client_installIntlayer.getIntlayerClient();
9
+ return (...args) => (0, _intlayer_core_formatters.currency)(args[0], {
10
+ ...args[1],
11
+ locale: args[1]?.locale ?? client.locale
12
+ });
13
+ };
14
+
15
+ //#endregion
16
+ exports.useCurrency = useCurrency;
17
+ //# sourceMappingURL=useCurrency.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCurrency.cjs","names":["getIntlayerClient"],"sources":["../../../src/format/useCurrency.ts"],"sourcesContent":["import { currency } from '@intlayer/core/formatters';\nimport { getIntlayerClient } from '../client/installIntlayer';\n\nexport const useCurrency = () => {\n const client = getIntlayerClient();\n\n return (...args: Parameters<typeof currency>) =>\n currency(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? client.locale,\n });\n};\n"],"mappings":";;;;;;AAGA,MAAa,oBAAoB;CAC/B,MAAM,SAASA,kDAAmB;AAElC,SAAQ,GAAG,iDACA,KAAK,IAAI;EAChB,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU,OAAO;EACnC,CAAC"}
@@ -1 +1,26 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../plugins-Bp8aaTny.js`);const e=require(`../../installIntlayer-CxkE8IxM.js`);let t=require(`@intlayer/core/formatters`);var n=()=>{let n=e.r();return(...e)=>{let r=typeof e[1]==`string`?{...t.presets[e[1]],locale:n.locale}:{...e[1],locale:e[1]?.locale??n.locale};return(0,t.date)(e[0],r)}};exports.useDate=n;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ const require_client_installIntlayer = require('../client/installIntlayer.cjs');
4
+ let _intlayer_core_formatters = require("@intlayer/core/formatters");
5
+
6
+ //#region src/format/useDate.ts
7
+ /**
8
+ * Vanilla JS hook that provides a localized date/time formatter.
9
+ */
10
+ const useDate = () => {
11
+ const client = require_client_installIntlayer.getIntlayerClient();
12
+ return (...args) => {
13
+ const options = typeof args[1] === "string" ? {
14
+ ..._intlayer_core_formatters.presets[args[1]],
15
+ locale: client.locale
16
+ } : {
17
+ ...args[1],
18
+ locale: args[1]?.locale ?? client.locale
19
+ };
20
+ return (0, _intlayer_core_formatters.date)(args[0], options);
21
+ };
22
+ };
23
+
24
+ //#endregion
25
+ exports.useDate = useDate;
26
+ //# sourceMappingURL=useDate.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDate.cjs","names":["getIntlayerClient","presets"],"sources":["../../../src/format/useDate.ts"],"sourcesContent":["import { date, presets } from '@intlayer/core/formatters';\nimport { getIntlayerClient } from '../client/installIntlayer';\n\n/**\n * Vanilla JS hook that provides a localized date/time formatter.\n */\nexport const useDate = () => {\n const client = getIntlayerClient();\n\n return (...args: Parameters<typeof date>) => {\n const options =\n typeof args[1] === 'string'\n ? { ...presets[args[1]], locale: client.locale }\n : { ...args[1], locale: args[1]?.locale ?? client.locale };\n\n return date(args[0], options as Parameters<typeof date>[1]);\n };\n};\n"],"mappings":";;;;;;;;;AAMA,MAAa,gBAAgB;CAC3B,MAAM,SAASA,kDAAmB;AAElC,SAAQ,GAAG,SAAkC;EAC3C,MAAM,UACJ,OAAO,KAAK,OAAO,WACf;GAAE,GAAGC,kCAAQ,KAAK;GAAK,QAAQ,OAAO;GAAQ,GAC9C;GAAE,GAAG,KAAK;GAAI,QAAQ,KAAK,IAAI,UAAU,OAAO;GAAQ;AAE9D,6CAAY,KAAK,IAAI,QAAsC"}
@@ -1 +1,44 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../plugins-Bp8aaTny.js`);const e=require(`../../installIntlayer-CxkE8IxM.js`);let t=require(`@intlayer/core/utils`);var n=n=>{let r=e.r();return{intl:(0,t.bindIntl)(n??r.locale),subscribe:e=>r.subscribe(r=>{e((0,t.bindIntl)(n??r))})}};exports.useIntl=n;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ const require_client_installIntlayer = require('../client/installIntlayer.cjs');
4
+ let _intlayer_core_utils = require("@intlayer/core/utils");
5
+
6
+ //#region src/format/useIntl.ts
7
+ /**
8
+ * Get a locale-bound `Intl` object and subscribe to locale changes.
9
+ *
10
+ * The returned `intl` property acts like the native `Intl` namespace but
11
+ * automatically uses the current application locale, so you do not need to
12
+ * pass the locale manually to `NumberFormat`, `DateTimeFormat`, etc.
13
+ *
14
+ * @param locale - Optional locale override.
15
+ * @returns An object with `intl: WrappedIntl` and a `subscribe` function.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * import { installIntlayer, useIntl } from 'vanilla-intlayer';
20
+ *
21
+ * installIntlayer('en');
22
+ *
23
+ * const { intl, subscribe } = useIntl();
24
+ *
25
+ * console.log(new intl.NumberFormat({ style: 'currency', currency: 'USD' }).format(9.99));
26
+ *
27
+ * const unsubscribe = subscribe((newIntl) => {
28
+ * console.log(new newIntl.NumberFormat({ style: 'currency', currency: 'USD' }).format(9.99));
29
+ * });
30
+ * ```
31
+ */
32
+ const useIntl = (locale) => {
33
+ const client = require_client_installIntlayer.getIntlayerClient();
34
+ return {
35
+ intl: (0, _intlayer_core_utils.bindIntl)(locale ?? client.locale),
36
+ subscribe: (callback) => client.subscribe((newLocale) => {
37
+ callback((0, _intlayer_core_utils.bindIntl)(locale ?? newLocale));
38
+ })
39
+ };
40
+ };
41
+
42
+ //#endregion
43
+ exports.useIntl = useIntl;
44
+ //# sourceMappingURL=useIntl.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIntl.cjs","names":["getIntlayerClient"],"sources":["../../../src/format/useIntl.ts"],"sourcesContent":["import { bindIntl, type WrappedIntl } from '@intlayer/core/utils';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport { getIntlayerClient } from '../client/installIntlayer';\n\n/**\n * Get a locale-bound `Intl` object and subscribe to locale changes.\n *\n * The returned `intl` property acts like the native `Intl` namespace but\n * automatically uses the current application locale, so you do not need to\n * pass the locale manually to `NumberFormat`, `DateTimeFormat`, etc.\n *\n * @param locale - Optional locale override.\n * @returns An object with `intl: WrappedIntl` and a `subscribe` function.\n *\n * @example\n * ```ts\n * import { installIntlayer, useIntl } from 'vanilla-intlayer';\n *\n * installIntlayer('en');\n *\n * const { intl, subscribe } = useIntl();\n *\n * console.log(new intl.NumberFormat({ style: 'currency', currency: 'USD' }).format(9.99));\n *\n * const unsubscribe = subscribe((newIntl) => {\n * console.log(new newIntl.NumberFormat({ style: 'currency', currency: 'USD' }).format(9.99));\n * });\n * ```\n */\nexport const useIntl = (\n locale?: LocalesValues\n): {\n intl: WrappedIntl;\n subscribe: (callback: (intl: WrappedIntl) => void) => () => void;\n} => {\n const client = getIntlayerClient();\n const intl = bindIntl(locale ?? client.locale);\n\n return {\n intl,\n subscribe: (callback) =>\n client.subscribe((newLocale) => {\n callback(bindIntl(locale ?? newLocale));\n }),\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAa,WACX,WAIG;CACH,MAAM,SAASA,kDAAmB;AAGlC,QAAO;EACL,yCAHoB,UAAU,OAAO,OAGjC;EACJ,YAAY,aACV,OAAO,WAAW,cAAc;AAC9B,+CAAkB,UAAU,UAAU,CAAC;IACvC;EACL"}
@@ -1 +1,17 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../plugins-Bp8aaTny.js`);const e=require(`../../installIntlayer-CxkE8IxM.js`);let t=require(`@intlayer/core/formatters`);var n=()=>{let n=e.r();return(...e)=>(0,t.list)(e[0],{...e[1],locale:e[1]?.locale??n.locale})};exports.useList=n;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ const require_client_installIntlayer = require('../client/installIntlayer.cjs');
4
+ let _intlayer_core_formatters = require("@intlayer/core/formatters");
5
+
6
+ //#region src/format/useList.ts
7
+ const useList = () => {
8
+ const client = require_client_installIntlayer.getIntlayerClient();
9
+ return (...args) => (0, _intlayer_core_formatters.list)(args[0], {
10
+ ...args[1],
11
+ locale: args[1]?.locale ?? client.locale
12
+ });
13
+ };
14
+
15
+ //#endregion
16
+ exports.useList = useList;
17
+ //# sourceMappingURL=useList.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useList.cjs","names":["getIntlayerClient"],"sources":["../../../src/format/useList.ts"],"sourcesContent":["import { list } from '@intlayer/core/formatters';\nimport { getIntlayerClient } from '../client/installIntlayer';\n\nexport const useList = () => {\n const client = getIntlayerClient();\n\n return (...args: Parameters<typeof list>) =>\n list(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? client.locale,\n });\n};\n"],"mappings":";;;;;;AAGA,MAAa,gBAAgB;CAC3B,MAAM,SAASA,kDAAmB;AAElC,SAAQ,GAAG,6CACJ,KAAK,IAAI;EACZ,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU,OAAO;EACnC,CAAC"}
@@ -1 +1,20 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../plugins-Bp8aaTny.js`);const e=require(`../../installIntlayer-CxkE8IxM.js`);let t=require(`@intlayer/core/formatters`);var n=()=>{let n=e.r();return(...e)=>(0,t.number)(e[0],{...e[1],locale:e[1]?.locale??n.locale})};exports.useNumber=n;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ const require_client_installIntlayer = require('../client/installIntlayer.cjs');
4
+ let _intlayer_core_formatters = require("@intlayer/core/formatters");
5
+
6
+ //#region src/format/useNumber.ts
7
+ /**
8
+ * Vanilla JS hook that provides a localized number formatter.
9
+ */
10
+ const useNumber = () => {
11
+ const client = require_client_installIntlayer.getIntlayerClient();
12
+ return (...args) => (0, _intlayer_core_formatters.number)(args[0], {
13
+ ...args[1],
14
+ locale: args[1]?.locale ?? client.locale
15
+ });
16
+ };
17
+
18
+ //#endregion
19
+ exports.useNumber = useNumber;
20
+ //# sourceMappingURL=useNumber.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useNumber.cjs","names":["getIntlayerClient"],"sources":["../../../src/format/useNumber.ts"],"sourcesContent":["import { number } from '@intlayer/core/formatters';\nimport { getIntlayerClient } from '../client/installIntlayer';\n\n/**\n * Vanilla JS hook that provides a localized number formatter.\n */\nexport const useNumber = () => {\n const client = getIntlayerClient();\n\n return (...args: Parameters<typeof number>) =>\n number(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? client.locale,\n });\n};\n"],"mappings":";;;;;;;;;AAMA,MAAa,kBAAkB;CAC7B,MAAM,SAASA,kDAAmB;AAElC,SAAQ,GAAG,+CACF,KAAK,IAAI;EACd,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU,OAAO;EACnC,CAAC"}
@@ -1 +1,17 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../plugins-Bp8aaTny.js`);const e=require(`../../installIntlayer-CxkE8IxM.js`);let t=require(`@intlayer/core/formatters`);var n=()=>{let n=e.r();return(...e)=>(0,t.percentage)(e[0],{...e[1],locale:e[1]?.locale??n.locale})};exports.usePercentage=n;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ const require_client_installIntlayer = require('../client/installIntlayer.cjs');
4
+ let _intlayer_core_formatters = require("@intlayer/core/formatters");
5
+
6
+ //#region src/format/usePercentage.ts
7
+ const usePercentage = () => {
8
+ const client = require_client_installIntlayer.getIntlayerClient();
9
+ return (...args) => (0, _intlayer_core_formatters.percentage)(args[0], {
10
+ ...args[1],
11
+ locale: args[1]?.locale ?? client.locale
12
+ });
13
+ };
14
+
15
+ //#endregion
16
+ exports.usePercentage = usePercentage;
17
+ //# sourceMappingURL=usePercentage.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePercentage.cjs","names":["getIntlayerClient"],"sources":["../../../src/format/usePercentage.ts"],"sourcesContent":["import { percentage } from '@intlayer/core/formatters';\nimport { getIntlayerClient } from '../client/installIntlayer';\n\nexport const usePercentage = () => {\n const client = getIntlayerClient();\n\n return (...args: Parameters<typeof percentage>) =>\n percentage(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? client.locale,\n });\n};\n"],"mappings":";;;;;;AAGA,MAAa,sBAAsB;CACjC,MAAM,SAASA,kDAAmB;AAElC,SAAQ,GAAG,mDACE,KAAK,IAAI;EAClB,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU,OAAO;EACnC,CAAC"}
@@ -1 +1,17 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../plugins-Bp8aaTny.js`);const e=require(`../../installIntlayer-CxkE8IxM.js`);let t=require(`@intlayer/core/formatters`);var n=()=>{let n=e.r();return(...e)=>(0,t.relativeTime)(e[0],e[1],{...e[2],locale:e[2]?.locale??n.locale})};exports.useRelativeTime=n;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ const require_client_installIntlayer = require('../client/installIntlayer.cjs');
4
+ let _intlayer_core_formatters = require("@intlayer/core/formatters");
5
+
6
+ //#region src/format/useRelativeTime.ts
7
+ const useRelativeTime = () => {
8
+ const client = require_client_installIntlayer.getIntlayerClient();
9
+ return (...args) => (0, _intlayer_core_formatters.relativeTime)(args[0], args[1], {
10
+ ...args[2],
11
+ locale: args[2]?.locale ?? client.locale
12
+ });
13
+ };
14
+
15
+ //#endregion
16
+ exports.useRelativeTime = useRelativeTime;
17
+ //# sourceMappingURL=useRelativeTime.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRelativeTime.cjs","names":["getIntlayerClient"],"sources":["../../../src/format/useRelativeTime.ts"],"sourcesContent":["import { relativeTime } from '@intlayer/core/formatters';\nimport { getIntlayerClient } from '../client/installIntlayer';\n\nexport const useRelativeTime = () => {\n const client = getIntlayerClient();\n\n return (...args: Parameters<typeof relativeTime>) =>\n relativeTime(args[0], args[1], {\n ...args[2],\n locale: args[2]?.locale ?? client.locale,\n });\n};\n"],"mappings":";;;;;;AAGA,MAAa,wBAAwB;CACnC,MAAM,SAASA,kDAAmB;AAElC,SAAQ,GAAG,qDACI,KAAK,IAAI,KAAK,IAAI;EAC7B,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU,OAAO;EACnC,CAAC"}
@@ -1 +1,17 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../plugins-Bp8aaTny.js`);const e=require(`../../installIntlayer-CxkE8IxM.js`);let t=require(`@intlayer/core/formatters`);var n=()=>{let n=e.r();return(...e)=>(0,t.units)(e[0],{...e[1],locale:e[1]?.locale??n.locale})};exports.useUnit=n;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ const require_client_installIntlayer = require('../client/installIntlayer.cjs');
4
+ let _intlayer_core_formatters = require("@intlayer/core/formatters");
5
+
6
+ //#region src/format/useUnit.ts
7
+ const useUnit = () => {
8
+ const client = require_client_installIntlayer.getIntlayerClient();
9
+ return (...args) => (0, _intlayer_core_formatters.units)(args[0], {
10
+ ...args[1],
11
+ locale: args[1]?.locale ?? client.locale
12
+ });
13
+ };
14
+
15
+ //#endregion
16
+ exports.useUnit = useUnit;
17
+ //# sourceMappingURL=useUnit.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUnit.cjs","names":["getIntlayerClient"],"sources":["../../../src/format/useUnit.ts"],"sourcesContent":["import { units } from '@intlayer/core/formatters';\nimport { getIntlayerClient } from '../client/installIntlayer';\n\nexport const useUnit = () => {\n const client = getIntlayerClient();\n\n return (...args: Parameters<typeof units>) =>\n units(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? client.locale,\n });\n};\n"],"mappings":";;;;;;AAGA,MAAa,gBAAgB;CAC3B,MAAM,SAASA,kDAAmB;AAElC,SAAQ,GAAG,8CACH,KAAK,IAAI;EACb,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU,OAAO;EACnC,CAAC"}
@@ -1 +1,11 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../plugins-Bp8aaTny.js`);let t=require(`@intlayer/core/interpreter`);var n=(n,r)=>(0,t.getDictionary)(n,r,e.t(r));exports.getDictionary=n;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
+ const require_plugins = require('./plugins.cjs');
4
+ let _intlayer_core_interpreter = require("@intlayer/core/interpreter");
5
+
6
+ //#region src/getDictionary.ts
7
+ const getDictionary = (dictionary, locale) => (0, _intlayer_core_interpreter.getDictionary)(dictionary, locale, require_plugins.getPlugins(locale));
8
+
9
+ //#endregion
10
+ exports.getDictionary = getDictionary;
11
+ //# sourceMappingURL=getDictionary.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDictionary.cjs","names":["getPlugins"],"sources":["../../src/getDictionary.ts"],"sourcesContent":["import { getDictionary as getDictionaryCore } from '@intlayer/core/interpreter';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { type DeepTransformContent, getPlugins } from './plugins';\n\nexport const getDictionary = <\n T extends Dictionary,\n L extends LocalesValues = DeclaredLocales,\n>(\n dictionary: T,\n locale?: L\n): DeepTransformContent<T['content'], L> =>\n getDictionaryCore(dictionary, locale, getPlugins(locale)) as any;\n"],"mappings":";;;;;;AAQA,MAAa,iBAIX,YACA,yDAEkB,YAAY,QAAQA,2BAAW,OAAO,CAAC"}
@@ -1 +1,11 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../plugins-Bp8aaTny.js`);let t=require(`@intlayer/core/interpreter`);var n=(n,r)=>(0,t.getIntlayer)(n,r,e.t(r));exports.getIntlayer=n;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
+ const require_plugins = require('./plugins.cjs');
4
+ let _intlayer_core_interpreter = require("@intlayer/core/interpreter");
5
+
6
+ //#region src/getIntlayer.ts
7
+ const getIntlayer = (key, locale) => (0, _intlayer_core_interpreter.getIntlayer)(key, locale, require_plugins.getPlugins(locale));
8
+
9
+ //#endregion
10
+ exports.getIntlayer = getIntlayer;
11
+ //# sourceMappingURL=getIntlayer.cjs.map
@@ -0,0 +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 DictionaryRegistryContent,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { type DeepTransformContent, getPlugins } from './plugins';\n\nexport const getIntlayer = <\n T extends DictionaryKeys,\n L extends LocalesValues = DeclaredLocales,\n>(\n key: T,\n locale?: L\n): DeepTransformContent<DictionaryRegistryContent<T>, L> =>\n getIntlayerCore(key, locale, getPlugins(locale)) as any;\n"],"mappings":";;;;;;AASA,MAAa,eAIX,KACA,uDAEgB,KAAK,QAAQA,2BAAW,OAAO,CAAC"}
@@ -1 +1,22 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./installIntlayerHTML.cjs`);var t=(e,t={})=>e,n=({components:t}={})=>{let n=e.useHTML();return e=>n.renderHTML(e,{components:t})};exports.renderHTML=t,exports.useHTMLRenderer=n;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_html_installIntlayerHTML = require('./installIntlayerHTML.cjs');
3
+
4
+ //#region src/html/HTMLRenderer.ts
5
+ /**
6
+ * Renders an HTML string directly, without a global provider.
7
+ * Returns the raw string unchanged.
8
+ */
9
+ const renderHTML = (content, _props = {}) => content;
10
+ /**
11
+ * Returns a render function that uses the global provider's configuration
12
+ * (installed via `installIntlayerHTML`), falling back to identity.
13
+ */
14
+ const useHTMLRenderer = ({ components } = {}) => {
15
+ const context = require_html_installIntlayerHTML.useHTML();
16
+ return (content) => context.renderHTML(content, { components });
17
+ };
18
+
19
+ //#endregion
20
+ exports.renderHTML = renderHTML;
21
+ exports.useHTMLRenderer = useHTMLRenderer;
22
+ //# sourceMappingURL=HTMLRenderer.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HTMLRenderer.cjs","names":["useHTML"],"sources":["../../../src/html/HTMLRenderer.ts"],"sourcesContent":["import { type RenderHTMLOptions, useHTML } from './installIntlayerHTML';\nimport type { HTMLComponents } from './types';\n\nexport type RenderHTMLProps = {\n components?: HTMLComponents<'permissive', {}>;\n};\n\n/**\n * Renders an HTML string directly, without a global provider.\n * Returns the raw string unchanged.\n */\nexport const renderHTML = (\n content: string,\n _props: RenderHTMLProps = {}\n): string => content;\n\n/**\n * Returns a render function that uses the global provider's configuration\n * (installed via `installIntlayerHTML`), falling back to identity.\n */\nexport const useHTMLRenderer = ({\n components,\n}: RenderHTMLProps = {}): ((content: string) => string) => {\n const context = useHTML();\n\n return (content: string) =>\n context.renderHTML(content, { components } as RenderHTMLOptions);\n};\n"],"mappings":";;;;;;;;AAWA,MAAa,cACX,SACA,SAA0B,EAAE,KACjB;;;;;AAMb,MAAa,mBAAmB,EAC9B,eACmB,EAAE,KAAoC;CACzD,MAAM,UAAUA,0CAAS;AAEzB,SAAQ,YACN,QAAQ,WAAW,SAAS,EAAE,YAAY,CAAsB"}
@@ -1 +1,9 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./installIntlayerHTML.cjs`),t=require(`./HTMLRenderer.cjs`);exports.installIntlayerHTML=e.installIntlayerHTML,exports.installIntlayerHTMLDynamic=e.installIntlayerHTMLDynamic,exports.renderHTML=t.renderHTML,exports.useHTML=e.useHTML,exports.useHTMLRenderer=t.useHTMLRenderer;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_html_installIntlayerHTML = require('./installIntlayerHTML.cjs');
3
+ const require_html_HTMLRenderer = require('./HTMLRenderer.cjs');
4
+
5
+ exports.installIntlayerHTML = require_html_installIntlayerHTML.installIntlayerHTML;
6
+ exports.installIntlayerHTMLDynamic = require_html_installIntlayerHTML.installIntlayerHTMLDynamic;
7
+ exports.renderHTML = require_html_HTMLRenderer.renderHTML;
8
+ exports.useHTML = require_html_installIntlayerHTML.useHTML;
9
+ exports.useHTMLRenderer = require_html_HTMLRenderer.useHTMLRenderer;
@@ -1 +1,91 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=null,t=t=>e||(e={renderHTML:t},e),n=e=>{let n;if(typeof e==`function`)n=e;else{let{components:t,renderHTML:r}=e??{};n=r||((e,n)=>{let r=n&&typeof n==`object`&&`components`in n?n.components:n,i={...t??{},...r??{}};return Object.keys(i).length,e})}return t(n)},r=()=>e||{renderHTML:e=>e},i=async t=>e||n(await t());exports.createIntlayerHTMLClient=t,exports.installIntlayerHTML=n,exports.installIntlayerHTMLDynamic=i,exports.useHTML=r;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ //#region src/html/installIntlayerHTML.ts
4
+ /**
5
+ * Singleton instance
6
+ */
7
+ let instance = null;
8
+ /**
9
+ * Create and return a single IntlayerHTMLProvider instance.
10
+ */
11
+ const createIntlayerHTMLClient = (renderHTML) => {
12
+ if (instance) return instance;
13
+ instance = { renderHTML };
14
+ return instance;
15
+ };
16
+ /**
17
+ * Install the Intlayer HTML provider for your vanilla JS application.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * import { installIntlayerHTML } from 'vanilla-intlayer';
22
+ *
23
+ * installIntlayerHTML({
24
+ * components: {
25
+ * a: ({ href, children }) => `<a class="styled-link" href="${href}">${children}</a>`,
26
+ * },
27
+ * });
28
+ * ```
29
+ */
30
+ const installIntlayerHTML = (pluginOptions) => {
31
+ let renderHTML;
32
+ if (typeof pluginOptions === "function") renderHTML = pluginOptions;
33
+ else {
34
+ const { components, renderHTML: customRender } = pluginOptions ?? {};
35
+ if (customRender) renderHTML = customRender;
36
+ else renderHTML = (rawHTML, overrides) => {
37
+ const overrideComponents = overrides && typeof overrides === "object" && "components" in overrides ? overrides.components : overrides;
38
+ const mergedComponents = {
39
+ ...components ?? {},
40
+ ...overrideComponents ?? {}
41
+ };
42
+ if (!Object.keys(mergedComponents).length) return rawHTML;
43
+ return rawHTML;
44
+ };
45
+ }
46
+ return createIntlayerHTMLClient(renderHTML);
47
+ };
48
+ /**
49
+ * Access the installed IntlayerHTMLProvider.
50
+ * Returns a fallback renderer that outputs the raw HTML string if no
51
+ * provider has been installed.
52
+ */
53
+ const useHTML = () => {
54
+ if (instance) return instance;
55
+ return { renderHTML: (rawHTML) => rawHTML };
56
+ };
57
+ /**
58
+ * Asynchronously install an HTML renderer whose implementation is loaded
59
+ * via a dynamic `import()`.
60
+ *
61
+ * Use this to keep a heavy HTML sanitiser / component renderer out of the
62
+ * initial bundle — the loader is only called the first time this function
63
+ * is executed.
64
+ *
65
+ * The returned promise resolves once the provider is ready. Any calls to
66
+ * `useHTML()` before the promise resolves will use the fallback (identity)
67
+ * renderer.
68
+ *
69
+ * @param loader - A zero-argument async function that resolves to either a
70
+ * `RenderHTMLFunction` or an `IntlayerHTMLPluginOptions` object.
71
+ *
72
+ * @example
73
+ * ```ts
74
+ * // Load a custom HTML sanitiser only when needed
75
+ * await installIntlayerHTMLDynamic(async () => {
76
+ * const DOMPurify = await import('dompurify');
77
+ * return (html) => DOMPurify.sanitize(html);
78
+ * });
79
+ * ```
80
+ */
81
+ const installIntlayerHTMLDynamic = async (loader) => {
82
+ if (instance) return instance;
83
+ return installIntlayerHTML(await loader());
84
+ };
85
+
86
+ //#endregion
87
+ exports.createIntlayerHTMLClient = createIntlayerHTMLClient;
88
+ exports.installIntlayerHTML = installIntlayerHTML;
89
+ exports.installIntlayerHTMLDynamic = installIntlayerHTMLDynamic;
90
+ exports.useHTML = useHTML;
91
+ //# sourceMappingURL=installIntlayerHTML.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installIntlayerHTML.cjs","names":[],"sources":["../../../src/html/installIntlayerHTML.ts"],"sourcesContent":["import type { HTMLComponents } from './types';\n\nexport type RenderHTMLOptions = {\n components?: HTMLComponents<'permissive', {}>;\n};\n\nexport type RenderHTMLFunction = (\n html: string,\n overrides?: HTMLComponents<'permissive', {}> | RenderHTMLOptions\n) => string;\n\n/**\n * Singleton instance\n */\nlet instance: IntlayerHTMLProvider | null = null;\n\nexport type IntlayerHTMLProvider = {\n renderHTML: RenderHTMLFunction;\n};\n\nexport type IntlayerHTMLPluginOptions = {\n components?: HTMLComponents<'permissive', {}>;\n renderHTML?: RenderHTMLFunction;\n};\n\n/**\n * Create and return a single IntlayerHTMLProvider instance.\n */\nexport const createIntlayerHTMLClient = (\n renderHTML: RenderHTMLFunction\n): IntlayerHTMLProvider => {\n if (instance) return instance;\n instance = { renderHTML };\n return instance;\n};\n\n/**\n * Install the Intlayer HTML provider for your vanilla JS application.\n *\n * @example\n * ```ts\n * import { installIntlayerHTML } from 'vanilla-intlayer';\n *\n * installIntlayerHTML({\n * components: {\n * a: ({ href, children }) => `<a class=\"styled-link\" href=\"${href}\">${children}</a>`,\n * },\n * });\n * ```\n */\nexport const installIntlayerHTML = (\n pluginOptions?: IntlayerHTMLPluginOptions | RenderHTMLFunction\n): IntlayerHTMLProvider => {\n let renderHTML: RenderHTMLFunction;\n\n if (typeof pluginOptions === 'function') {\n renderHTML = pluginOptions;\n } else {\n const { components, renderHTML: customRender } = pluginOptions ?? {};\n\n if (customRender) {\n renderHTML = customRender;\n } else {\n renderHTML = (rawHTML, overrides) => {\n const isOptionsObject =\n overrides &&\n typeof overrides === 'object' &&\n 'components' in overrides;\n\n const overrideComponents = isOptionsObject\n ? (overrides as RenderHTMLOptions).components\n : (overrides as HTMLComponents<'permissive', {}>);\n\n const mergedComponents = {\n ...(components ?? {}),\n ...(overrideComponents ?? {}),\n };\n\n if (!Object.keys(mergedComponents).length) return rawHTML;\n\n // Apply component overrides as simple string replacements.\n // For full component replacement support, provide a custom renderHTML.\n return rawHTML;\n };\n }\n }\n\n return createIntlayerHTMLClient(renderHTML);\n};\n\n/**\n * Access the installed IntlayerHTMLProvider.\n * Returns a fallback renderer that outputs the raw HTML string if no\n * provider has been installed.\n */\nexport const useHTML = (): IntlayerHTMLProvider => {\n if (instance) return instance;\n return { renderHTML: (rawHTML) => rawHTML };\n};\n\n/**\n * Asynchronously install an HTML renderer whose implementation is loaded\n * via a dynamic `import()`.\n *\n * Use this to keep a heavy HTML sanitiser / component renderer out of the\n * initial bundle — the loader is only called the first time this function\n * is executed.\n *\n * The returned promise resolves once the provider is ready. Any calls to\n * `useHTML()` before the promise resolves will use the fallback (identity)\n * renderer.\n *\n * @param loader - A zero-argument async function that resolves to either a\n * `RenderHTMLFunction` or an `IntlayerHTMLPluginOptions` object.\n *\n * @example\n * ```ts\n * // Load a custom HTML sanitiser only when needed\n * await installIntlayerHTMLDynamic(async () => {\n * const DOMPurify = await import('dompurify');\n * return (html) => DOMPurify.sanitize(html);\n * });\n * ```\n */\nexport const installIntlayerHTMLDynamic = async (\n loader: () => Promise<IntlayerHTMLPluginOptions | RenderHTMLFunction>\n): Promise<IntlayerHTMLProvider> => {\n if (instance) return instance;\n const pluginOptions = await loader();\n return installIntlayerHTML(pluginOptions);\n};\n"],"mappings":";;;;;;AAcA,IAAI,WAAwC;;;;AAc5C,MAAa,4BACX,eACyB;AACzB,KAAI,SAAU,QAAO;AACrB,YAAW,EAAE,YAAY;AACzB,QAAO;;;;;;;;;;;;;;;;AAiBT,MAAa,uBACX,kBACyB;CACzB,IAAI;AAEJ,KAAI,OAAO,kBAAkB,WAC3B,cAAa;MACR;EACL,MAAM,EAAE,YAAY,YAAY,iBAAiB,iBAAiB,EAAE;AAEpE,MAAI,aACF,cAAa;MAEb,eAAc,SAAS,cAAc;GAMnC,MAAM,qBAJJ,aACA,OAAO,cAAc,YACrB,gBAAgB,YAGb,UAAgC,aAChC;GAEL,MAAM,mBAAmB;IACvB,GAAI,cAAc,EAAE;IACpB,GAAI,sBAAsB,EAAE;IAC7B;AAED,OAAI,CAAC,OAAO,KAAK,iBAAiB,CAAC,OAAQ,QAAO;AAIlD,UAAO;;;AAKb,QAAO,yBAAyB,WAAW;;;;;;;AAQ7C,MAAa,gBAAsC;AACjD,KAAI,SAAU,QAAO;AACrB,QAAO,EAAE,aAAa,YAAY,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;AA2B7C,MAAa,6BAA6B,OACxC,WACkC;AAClC,KAAI,SAAU,QAAO;AAErB,QAAO,oBAAoB,MADC,QAAQ,CACK"}
@@ -1 +0,0 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});
@@ -1 +1,37 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../plugins-Bp8aaTny.js`),t=require(`./getIntlayer.cjs`),n=require(`./getDictionary.cjs`),r=require(`../installIntlayer-CxkE8IxM.js`),i=require(`./client/useDictionary.cjs`),a=require(`./client/useDictionaryDynamic.cjs`),o=require(`./client/useIntlayer.cjs`),s=require(`./client/useLocaleStorage.cjs`),c=require(`./client/useLocale.cjs`),l=require(`./client/useRewriteURL.cjs`);require(`./client/index.cjs`),exports.IntlayerClient=r.t,exports.createIntlayerClient=r.n,exports.getDictionary=n.getDictionary,exports.getIntlayer=t.getIntlayer,exports.getIntlayerClient=r.r,exports.getPlugins=e.t,exports.htmlPlugin=e.n,exports.insertionPlugin=e.r,exports.installIntlayer=r.i,exports.intlayerNodePlugins=e.i,exports.localeCookie=s.localeCookie,exports.localeInStorage=s.localeInStorage,exports.markdownPlugin=e.a,exports.markdownStringPlugin=e.o,exports.setLocaleCookie=s.setLocaleCookie,exports.setLocaleInStorage=s.setLocaleInStorage,exports.useDictionary=i.useDictionary,exports.useDictionaryDynamic=a.useDictionaryDynamic,exports.useEditor=r.a,exports.useIntlayer=o.useIntlayer,exports.useLocale=c.useLocale,exports.useLocaleCookie=s.useLocaleCookie,exports.useLocaleStorage=s.useLocaleStorage,exports.useRewriteURL=l.useRewriteURL;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_plugins = require('./plugins.cjs');
3
+ const require_getIntlayer = require('./getIntlayer.cjs');
4
+ const require_getDictionary = require('./getDictionary.cjs');
5
+ const require_editor_useEditor = require('./editor/useEditor.cjs');
6
+ const require_client_installIntlayer = require('./client/installIntlayer.cjs');
7
+ const require_client_useDictionary = require('./client/useDictionary.cjs');
8
+ const require_client_useDictionaryDynamic = require('./client/useDictionaryDynamic.cjs');
9
+ const require_client_useIntlayer = require('./client/useIntlayer.cjs');
10
+ const require_client_useLocaleStorage = require('./client/useLocaleStorage.cjs');
11
+ const require_client_useLocale = require('./client/useLocale.cjs');
12
+ const require_client_useRewriteURL = require('./client/useRewriteURL.cjs');
13
+
14
+ exports.IntlayerClient = require_client_installIntlayer.IntlayerClient;
15
+ exports.createIntlayerClient = require_client_installIntlayer.createIntlayerClient;
16
+ exports.getDictionary = require_getDictionary.getDictionary;
17
+ exports.getIntlayer = require_getIntlayer.getIntlayer;
18
+ exports.getIntlayerClient = require_client_installIntlayer.getIntlayerClient;
19
+ exports.getPlugins = require_plugins.getPlugins;
20
+ exports.htmlPlugin = require_plugins.htmlPlugin;
21
+ exports.insertionPlugin = require_plugins.insertionPlugin;
22
+ exports.installIntlayer = require_client_installIntlayer.installIntlayer;
23
+ exports.intlayerNodePlugins = require_plugins.intlayerNodePlugins;
24
+ exports.localeCookie = require_client_useLocaleStorage.localeCookie;
25
+ exports.localeInStorage = require_client_useLocaleStorage.localeInStorage;
26
+ exports.markdownPlugin = require_plugins.markdownPlugin;
27
+ exports.markdownStringPlugin = require_plugins.markdownStringPlugin;
28
+ exports.setLocaleCookie = require_client_useLocaleStorage.setLocaleCookie;
29
+ exports.setLocaleInStorage = require_client_useLocaleStorage.setLocaleInStorage;
30
+ exports.useDictionary = require_client_useDictionary.useDictionary;
31
+ exports.useDictionaryDynamic = require_client_useDictionaryDynamic.useDictionaryDynamic;
32
+ exports.useEditor = require_editor_useEditor.useEditor;
33
+ exports.useIntlayer = require_client_useIntlayer.useIntlayer;
34
+ exports.useLocale = require_client_useLocale.useLocale;
35
+ exports.useLocaleCookie = require_client_useLocaleStorage.useLocaleCookie;
36
+ exports.useLocaleStorage = require_client_useLocaleStorage.useLocaleStorage;
37
+ exports.useRewriteURL = require_client_useRewriteURL.useRewriteURL;
@@ -1 +1,41 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./compiler.cjs`),t=require(`./installIntlayerMarkdown.cjs`);var n=(t,{forceBlock:n,forceInline:r,preserveFrontmatter:i,tagfilter:a}={})=>e.compileMarkdown(t,{forceBlock:n,forceInline:r,preserveFrontmatter:i,tagfilter:a}),r=(e={})=>{let n=t.useMarkdown();return t=>n.renderMarkdown(t,{forceBlock:e.forceBlock,forceInline:e.forceInline,preserveFrontmatter:e.preserveFrontmatter,tagfilter:e.tagfilter},e.components,e.wrapper)};exports.renderMarkdown=n,exports.useMarkdownRenderer=r;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_markdown_compiler = require('./compiler.cjs');
3
+ const require_markdown_installIntlayerMarkdown = require('./installIntlayerMarkdown.cjs');
4
+
5
+ //#region src/markdown/MarkdownRenderer.ts
6
+ /**
7
+ * Renders markdown to an HTML string without using the global provider.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import { renderMarkdown } from 'vanilla-intlayer/markdown';
12
+ *
13
+ * document.querySelector('#content').innerHTML = renderMarkdown('# Hello **World**');
14
+ * ```
15
+ */
16
+ const renderMarkdown = (content, { forceBlock, forceInline, preserveFrontmatter, tagfilter } = {}) => {
17
+ return require_markdown_compiler.compileMarkdown(content, {
18
+ forceBlock,
19
+ forceInline,
20
+ preserveFrontmatter,
21
+ tagfilter
22
+ });
23
+ };
24
+ /**
25
+ * Returns a render function that uses the global provider's configuration
26
+ * (installed via `installIntlayerMarkdown`), falling back to `compileMarkdown`.
27
+ */
28
+ const useMarkdownRenderer = (props = {}) => {
29
+ const provider = require_markdown_installIntlayerMarkdown.useMarkdown();
30
+ return (content) => provider.renderMarkdown(content, {
31
+ forceBlock: props.forceBlock,
32
+ forceInline: props.forceInline,
33
+ preserveFrontmatter: props.preserveFrontmatter,
34
+ tagfilter: props.tagfilter
35
+ }, props.components, props.wrapper);
36
+ };
37
+
38
+ //#endregion
39
+ exports.renderMarkdown = renderMarkdown;
40
+ exports.useMarkdownRenderer = useMarkdownRenderer;
41
+ //# sourceMappingURL=MarkdownRenderer.cjs.map