next-intlayer 9.3.3 → 9.4.0-canary.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 (151) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/index.cjs +6 -0
  3. package/dist/cjs/index.cjs.map +1 -1
  4. package/dist/cjs/rsc/index.cjs +96 -0
  5. package/dist/cjs/server/IntlayerProvider.cjs +54 -0
  6. package/dist/cjs/server/IntlayerProvider.cjs.map +1 -0
  7. package/dist/cjs/server/IntlayerServerProvider.cjs +17 -0
  8. package/dist/cjs/server/IntlayerServerProvider.cjs.map +1 -0
  9. package/dist/cjs/server/ambientLocale.cjs +64 -0
  10. package/dist/cjs/server/ambientLocale.cjs.map +1 -0
  11. package/dist/cjs/server/format/index.cjs +17 -7
  12. package/dist/cjs/server/format/useCompact.cjs +26 -0
  13. package/dist/cjs/server/format/useCompact.cjs.map +1 -0
  14. package/dist/cjs/server/format/useCurrency.cjs +26 -0
  15. package/dist/cjs/server/format/useCurrency.cjs.map +1 -0
  16. package/dist/cjs/server/format/useDate.cjs +33 -0
  17. package/dist/cjs/server/format/useDate.cjs.map +1 -0
  18. package/dist/cjs/server/format/useList.cjs +26 -0
  19. package/dist/cjs/server/format/useList.cjs.map +1 -0
  20. package/dist/cjs/server/format/useNumber.cjs +26 -0
  21. package/dist/cjs/server/format/useNumber.cjs.map +1 -0
  22. package/dist/cjs/server/format/usePercentage.cjs +26 -0
  23. package/dist/cjs/server/format/usePercentage.cjs.map +1 -0
  24. package/dist/cjs/server/format/useRelativeTime.cjs +26 -0
  25. package/dist/cjs/server/format/useRelativeTime.cjs.map +1 -0
  26. package/dist/cjs/server/format/useUnit.cjs +26 -0
  27. package/dist/cjs/server/format/useUnit.cjs.map +1 -0
  28. package/dist/cjs/server/index.cjs +27 -43
  29. package/dist/cjs/server/prepareSwcOptimization.cjs.map +1 -1
  30. package/dist/cjs/server/suspendingReader.cjs +45 -0
  31. package/dist/cjs/server/suspendingReader.cjs.map +1 -0
  32. package/dist/cjs/server/t.cjs +16 -0
  33. package/dist/cjs/server/t.cjs.map +1 -0
  34. package/dist/cjs/server/useDictionary.cjs +5 -4
  35. package/dist/cjs/server/useDictionary.cjs.map +1 -1
  36. package/dist/cjs/server/useDictionaryAsync.cjs +5 -7
  37. package/dist/cjs/server/useDictionaryAsync.cjs.map +1 -1
  38. package/dist/cjs/server/useDictionaryDynamic.cjs +5 -4
  39. package/dist/cjs/server/useDictionaryDynamic.cjs.map +1 -1
  40. package/dist/cjs/server/useI18n.cjs +17 -0
  41. package/dist/cjs/server/useI18n.cjs.map +1 -0
  42. package/dist/cjs/server/useIntl.cjs +16 -0
  43. package/dist/cjs/server/useIntl.cjs.map +1 -0
  44. package/dist/cjs/server/useIntlayer.cjs +5 -20
  45. package/dist/cjs/server/useIntlayer.cjs.map +1 -1
  46. package/dist/cjs/server/useLocale.cjs +26 -0
  47. package/dist/cjs/server/useLocale.cjs.map +1 -0
  48. package/dist/cjs/server/withIntlayer.cjs +1 -2
  49. package/dist/cjs/server/withIntlayer.cjs.map +1 -1
  50. package/dist/esm/index.mjs +2 -2
  51. package/dist/esm/index.mjs.map +1 -1
  52. package/dist/esm/rsc/index.mjs +18 -0
  53. package/dist/esm/server/IntlayerProvider.mjs +53 -0
  54. package/dist/esm/server/IntlayerProvider.mjs.map +1 -0
  55. package/dist/esm/server/IntlayerServerProvider.mjs +16 -0
  56. package/dist/esm/server/IntlayerServerProvider.mjs.map +1 -0
  57. package/dist/esm/server/ambientLocale.mjs +61 -0
  58. package/dist/esm/server/ambientLocale.mjs.map +1 -0
  59. package/dist/esm/server/format/index.mjs +10 -1
  60. package/dist/esm/server/format/useCompact.mjs +25 -0
  61. package/dist/esm/server/format/useCompact.mjs.map +1 -0
  62. package/dist/esm/server/format/useCurrency.mjs +25 -0
  63. package/dist/esm/server/format/useCurrency.mjs.map +1 -0
  64. package/dist/esm/server/format/useDate.mjs +32 -0
  65. package/dist/esm/server/format/useDate.mjs.map +1 -0
  66. package/dist/esm/server/format/useList.mjs +25 -0
  67. package/dist/esm/server/format/useList.mjs.map +1 -0
  68. package/dist/esm/server/format/useNumber.mjs +25 -0
  69. package/dist/esm/server/format/useNumber.mjs.map +1 -0
  70. package/dist/esm/server/format/usePercentage.mjs +25 -0
  71. package/dist/esm/server/format/usePercentage.mjs.map +1 -0
  72. package/dist/esm/server/format/useRelativeTime.mjs +25 -0
  73. package/dist/esm/server/format/useRelativeTime.mjs.map +1 -0
  74. package/dist/esm/server/format/useUnit.mjs +25 -0
  75. package/dist/esm/server/format/useUnit.mjs.map +1 -0
  76. package/dist/esm/server/index.mjs +12 -2
  77. package/dist/esm/server/prepareSwcOptimization.mjs +1 -1
  78. package/dist/esm/server/prepareSwcOptimization.mjs.map +1 -1
  79. package/dist/esm/server/suspendingReader.mjs +42 -0
  80. package/dist/esm/server/suspendingReader.mjs.map +1 -0
  81. package/dist/esm/server/t.mjs +15 -0
  82. package/dist/esm/server/t.mjs.map +1 -0
  83. package/dist/esm/server/useDictionary.mjs +5 -4
  84. package/dist/esm/server/useDictionary.mjs.map +1 -1
  85. package/dist/esm/server/useDictionaryAsync.mjs +5 -7
  86. package/dist/esm/server/useDictionaryAsync.mjs.map +1 -1
  87. package/dist/esm/server/useDictionaryDynamic.mjs +5 -4
  88. package/dist/esm/server/useDictionaryDynamic.mjs.map +1 -1
  89. package/dist/esm/server/useI18n.mjs +16 -0
  90. package/dist/esm/server/useI18n.mjs.map +1 -0
  91. package/dist/esm/server/useIntl.mjs +15 -0
  92. package/dist/esm/server/useIntl.mjs.map +1 -0
  93. package/dist/esm/server/useIntlayer.mjs +6 -18
  94. package/dist/esm/server/useIntlayer.mjs.map +1 -1
  95. package/dist/esm/server/useLocale.mjs +25 -0
  96. package/dist/esm/server/useLocale.mjs.map +1 -0
  97. package/dist/esm/server/withIntlayer.mjs +2 -3
  98. package/dist/esm/server/withIntlayer.mjs.map +1 -1
  99. package/dist/types/@intlayer/babel/dist/types/babel-plugin-intlayer-purge.d.ts +2 -2
  100. package/dist/types/@intlayer/babel/dist/types/babel-plugin-intlayer-usage-analyzer.d.ts +2 -2
  101. package/dist/types/@intlayer/babel/dist/types/extractContent/contentWriter.d.ts +2 -2
  102. package/dist/types/@intlayer/babel/dist/types/getOptimizePluginOptions.d.ts +2 -2
  103. package/dist/types/@intlayer/babel/dist/types/getPurgePluginOptions.d.ts +2 -2
  104. package/dist/types/index.d.ts +2 -2
  105. package/dist/types/index.d.ts.map +1 -1
  106. package/dist/types/rsc/index.d.ts +19 -0
  107. package/dist/types/server/IntlayerProvider.d.ts +43 -0
  108. package/dist/types/server/IntlayerProvider.d.ts.map +1 -0
  109. package/dist/types/server/IntlayerServerProvider.d.ts +13 -0
  110. package/dist/types/server/IntlayerServerProvider.d.ts.map +1 -0
  111. package/dist/types/server/ambientLocale.d.ts +34 -0
  112. package/dist/types/server/ambientLocale.d.ts.map +1 -0
  113. package/dist/types/server/format/index.d.ts +9 -1
  114. package/dist/types/server/format/useCompact.d.ts +16 -0
  115. package/dist/types/server/format/useCompact.d.ts.map +1 -0
  116. package/dist/types/server/format/useCurrency.d.ts +16 -0
  117. package/dist/types/server/format/useCurrency.d.ts.map +1 -0
  118. package/dist/types/server/format/useDate.d.ts +20 -0
  119. package/dist/types/server/format/useDate.d.ts.map +1 -0
  120. package/dist/types/server/format/useList.d.ts +16 -0
  121. package/dist/types/server/format/useList.d.ts.map +1 -0
  122. package/dist/types/server/format/useNumber.d.ts +16 -0
  123. package/dist/types/server/format/useNumber.d.ts.map +1 -0
  124. package/dist/types/server/format/usePercentage.d.ts +16 -0
  125. package/dist/types/server/format/usePercentage.d.ts.map +1 -0
  126. package/dist/types/server/format/useRelativeTime.d.ts +16 -0
  127. package/dist/types/server/format/useRelativeTime.d.ts.map +1 -0
  128. package/dist/types/server/format/useUnit.d.ts +16 -0
  129. package/dist/types/server/format/useUnit.d.ts.map +1 -0
  130. package/dist/types/server/index.d.ts +12 -2
  131. package/dist/types/server/prepareSwcOptimization.d.ts +1 -1
  132. package/dist/types/server/prepareSwcOptimization.d.ts.map +1 -1
  133. package/dist/types/server/suspendingReader.d.ts +22 -0
  134. package/dist/types/server/suspendingReader.d.ts.map +1 -0
  135. package/dist/types/server/t.d.ts +13 -0
  136. package/dist/types/server/t.d.ts.map +1 -0
  137. package/dist/types/server/useDictionary.d.ts +2 -1
  138. package/dist/types/server/useDictionary.d.ts.map +1 -1
  139. package/dist/types/server/useDictionaryAsync.d.ts +5 -4
  140. package/dist/types/server/useDictionaryAsync.d.ts.map +1 -1
  141. package/dist/types/server/useDictionaryDynamic.d.ts +3 -2
  142. package/dist/types/server/useDictionaryDynamic.d.ts.map +1 -1
  143. package/dist/types/server/useI18n.d.ts +14 -0
  144. package/dist/types/server/useI18n.d.ts.map +1 -0
  145. package/dist/types/server/useIntl.d.ts +13 -0
  146. package/dist/types/server/useIntl.d.ts.map +1 -0
  147. package/dist/types/server/useIntlayer.d.ts +4 -5
  148. package/dist/types/server/useIntlayer.d.ts.map +1 -1
  149. package/dist/types/server/useLocale.d.ts +20 -0
  150. package/dist/types/server/useLocale.d.ts.map +1 -0
  151. package/package.json +13 -8
package/README.md CHANGED
@@ -327,4 +327,4 @@ Contribute on [GitHub](https://github.com/aymericzip/intlayer), [GitLab](https:/
327
327
 
328
328
  If you like Intlayer, give us a ⭐ on GitHub. It helps others discover the project! [See why GitHub Stars matter](https://github.com/aymericzip/intlayer/blob/main/CONTRIBUTING.md#why-github-stars-matter-).
329
329
 
330
- [![Star History Chart](https://api.star-history.com/svg?repos=aymericzip/intlayer&type=Date)](https://star-history.com/#aymericzip/intlayer&Date)
330
+ [![Star History Chart](https://star-history.dera.page/svg?repos=aymericzip/intlayer&type=Date)](https://star-history.dera.page/#aymericzip/intlayer&Date)
@@ -37,6 +37,12 @@ Object.defineProperty(exports, 'IntlayerClientContext', {
37
37
  }
38
38
  });
39
39
  exports.IntlayerClientProvider = require_client_IntlayerClientProvider.IntlayerClientProvider;
40
+ Object.defineProperty(exports, 'IntlayerProvider', {
41
+ enumerable: true,
42
+ get: function () {
43
+ return react_intlayer.IntlayerProvider;
44
+ }
45
+ });
40
46
  exports.MarkdownProvider = MarkdownProvider;
41
47
  exports.MarkdownRenderer = MarkdownRenderer;
42
48
  exports.generateStaticParams = require_generateStaticParams.generateStaticParams;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["_MarkdownProvider","_useMarkdownContext","_renderMarkdown","_useMarkdownRenderer","_MarkdownRenderer"],"sources":["../../src/index.ts"],"sourcesContent":["export {\n getDictionary,\n getIntlayer,\n IntlayerClientContext,\n type IntlayerNode,\n localeCookie,\n localeInStorage,\n setLocaleCookie,\n setLocaleInStorage,\n t,\n useDictionary,\n useDictionaryAsync,\n useDictionaryDynamic,\n useI18n,\n useIntl,\n useIntlayer,\n useLoadDynamic,\n useLocaleCookie,\n useLocaleStorage,\n} from 'react-intlayer';\nexport * from './client/index';\nexport { generateStaticParams } from './generateStaticParams';\nexport type {\n LocalParams,\n LocalPromiseParams,\n Next14LayoutIntlayer,\n Next14PageIntlayer,\n Next15LayoutIntlayer,\n Next15PageIntlayer,\n NextLayoutIntlayer,\n NextPageIntlayer,\n} from './types/index';\n\nimport type {\n MarkdownProviderOptions as _MarkdownProviderOptions,\n MarkdownRendererProps as _MarkdownRendererProps,\n RenderMarkdownProps as _RenderMarkdownProps,\n} from './markdown';\nimport {\n MarkdownProvider as _MarkdownProvider,\n MarkdownRenderer as _MarkdownRenderer,\n renderMarkdown as _renderMarkdown,\n useMarkdownContext as _useMarkdownContext,\n useMarkdownRenderer as _useMarkdownRenderer,\n} from './markdown';\n\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport const MarkdownProvider = _MarkdownProvider;\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport const useMarkdownContext = _useMarkdownContext;\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport type MarkdownProviderOptions = _MarkdownProviderOptions;\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport const renderMarkdown = _renderMarkdown;\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport const useMarkdownRenderer = _useMarkdownRenderer;\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport const MarkdownRenderer = _MarkdownRenderer;\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport type RenderMarkdownProps = _RenderMarkdownProps;\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport type MarkdownRendererProps = _MarkdownRendererProps;\n"],"mappings":";;;;;;;;;;;;;AAiDA,MAAa,2DAAmBA;;;;AAIhC,MAAa,6DAAqBC;;;;AAQlC,MAAa,yDAAiBC;;;;AAI9B,MAAa,8DAAsBC;;;;AAInC,MAAa,2DAAmBC"}
1
+ {"version":3,"file":"index.cjs","names":["_MarkdownProvider","_useMarkdownContext","_renderMarkdown","_useMarkdownRenderer","_MarkdownRenderer"],"sources":["../../src/index.ts"],"sourcesContent":["export {\n getDictionary,\n getIntlayer,\n IntlayerClientContext,\n type IntlayerNode,\n IntlayerProvider,\n type IntlayerProviderProps,\n localeCookie,\n localeInStorage,\n setLocaleCookie,\n setLocaleInStorage,\n t,\n useDictionary,\n useDictionaryAsync,\n useDictionaryDynamic,\n useI18n,\n useIntl,\n useIntlayer,\n useLoadDynamic,\n useLocaleCookie,\n useLocaleStorage,\n} from 'react-intlayer';\nexport * from './client/index';\nexport { generateStaticParams } from './generateStaticParams';\nexport type {\n LocalParams,\n LocalPromiseParams,\n Next14LayoutIntlayer,\n Next14PageIntlayer,\n Next15LayoutIntlayer,\n Next15PageIntlayer,\n NextLayoutIntlayer,\n NextPageIntlayer,\n} from './types/index';\n\nimport type {\n MarkdownProviderOptions as _MarkdownProviderOptions,\n MarkdownRendererProps as _MarkdownRendererProps,\n RenderMarkdownProps as _RenderMarkdownProps,\n} from './markdown';\nimport {\n MarkdownProvider as _MarkdownProvider,\n MarkdownRenderer as _MarkdownRenderer,\n renderMarkdown as _renderMarkdown,\n useMarkdownContext as _useMarkdownContext,\n useMarkdownRenderer as _useMarkdownRenderer,\n} from './markdown';\n\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport const MarkdownProvider = _MarkdownProvider;\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport const useMarkdownContext = _useMarkdownContext;\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport type MarkdownProviderOptions = _MarkdownProviderOptions;\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport const renderMarkdown = _renderMarkdown;\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport const useMarkdownRenderer = _useMarkdownRenderer;\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport const MarkdownRenderer = _MarkdownRenderer;\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport type RenderMarkdownProps = _RenderMarkdownProps;\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport type MarkdownRendererProps = _MarkdownRendererProps;\n"],"mappings":";;;;;;;;;;;;;AAmDA,MAAa,2DAAmBA;;;;AAIhC,MAAa,6DAAqBC;;;;AAQlC,MAAa,yDAAiBC;;;;AAI9B,MAAa,8DAAsBC;;;;AAInC,MAAa,2DAAmBC"}
@@ -0,0 +1,96 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_client_IntlayerClientProvider = require('../client/IntlayerClientProvider.cjs');
3
+ const require_client_usePathname = require('../client/usePathname.cjs');
4
+ const require_client_useLocalePageRouter = require('../client/useLocalePageRouter.cjs');
5
+ const require_generateStaticParams = require('../generateStaticParams.cjs');
6
+ const require_server_IntlayerProvider = require('../server/IntlayerProvider.cjs');
7
+ const require_server_t = require('../server/t.cjs');
8
+ const require_server_useDictionary = require('../server/useDictionary.cjs');
9
+ const require_server_useDictionaryAsync = require('../server/useDictionaryAsync.cjs');
10
+ const require_server_useDictionaryDynamic = require('../server/useDictionaryDynamic.cjs');
11
+ const require_server_useI18n = require('../server/useI18n.cjs');
12
+ const require_server_useIntl = require('../server/useIntl.cjs');
13
+ const require_server_useIntlayer = require('../server/useIntlayer.cjs');
14
+ const require_server_useLocale = require('../server/useLocale.cjs');
15
+ let react_intlayer = require("react-intlayer");
16
+ let react_intlayer_server = require("react-intlayer/server");
17
+
18
+ Object.defineProperty(exports, 'IntlayerClientContext', {
19
+ enumerable: true,
20
+ get: function () {
21
+ return react_intlayer.IntlayerClientContext;
22
+ }
23
+ });
24
+ exports.IntlayerClientProvider = require_client_IntlayerClientProvider.IntlayerClientProvider;
25
+ exports.IntlayerProvider = require_server_IntlayerProvider.IntlayerProvider;
26
+ exports.generateStaticParams = require_generateStaticParams.generateStaticParams;
27
+ Object.defineProperty(exports, 'getDictionary', {
28
+ enumerable: true,
29
+ get: function () {
30
+ return react_intlayer.getDictionary;
31
+ }
32
+ });
33
+ Object.defineProperty(exports, 'getIntlayer', {
34
+ enumerable: true,
35
+ get: function () {
36
+ return react_intlayer.getIntlayer;
37
+ }
38
+ });
39
+ Object.defineProperty(exports, 'localeCookie', {
40
+ enumerable: true,
41
+ get: function () {
42
+ return react_intlayer.localeCookie;
43
+ }
44
+ });
45
+ Object.defineProperty(exports, 'localeInStorage', {
46
+ enumerable: true,
47
+ get: function () {
48
+ return react_intlayer.localeInStorage;
49
+ }
50
+ });
51
+ Object.defineProperty(exports, 'setLocaleCookie', {
52
+ enumerable: true,
53
+ get: function () {
54
+ return react_intlayer.setLocaleCookie;
55
+ }
56
+ });
57
+ Object.defineProperty(exports, 'setLocaleInStorage', {
58
+ enumerable: true,
59
+ get: function () {
60
+ return react_intlayer.setLocaleInStorage;
61
+ }
62
+ });
63
+ exports.t = require_server_t.t;
64
+ exports.useDictionary = require_server_useDictionary.useDictionary;
65
+ exports.useDictionaryAsync = require_server_useDictionaryAsync.useDictionaryAsync;
66
+ exports.useDictionaryDynamic = require_server_useDictionaryDynamic.useDictionaryDynamic;
67
+ exports.useI18n = require_server_useI18n.useI18n;
68
+ exports.useIntl = require_server_useIntl.useIntl;
69
+ exports.useIntlayer = require_server_useIntlayer.useIntlayer;
70
+ Object.defineProperty(exports, 'useLoadDynamic', {
71
+ enumerable: true,
72
+ get: function () {
73
+ return react_intlayer_server.useLoadDynamic;
74
+ }
75
+ });
76
+ exports.useLocale = require_server_useLocale.useLocale;
77
+ Object.defineProperty(exports, 'useLocaleCookie', {
78
+ enumerable: true,
79
+ get: function () {
80
+ return react_intlayer.useLocaleCookie;
81
+ }
82
+ });
83
+ exports.useLocalePageRouter = require_client_useLocalePageRouter.useLocalePageRouter;
84
+ Object.defineProperty(exports, 'useLocaleStorage', {
85
+ enumerable: true,
86
+ get: function () {
87
+ return react_intlayer.useLocaleStorage;
88
+ }
89
+ });
90
+ exports.usePathname = require_client_usePathname.usePathname;
91
+ Object.defineProperty(exports, 'useRewriteURL', {
92
+ enumerable: true,
93
+ get: function () {
94
+ return react_intlayer.useRewriteURL;
95
+ }
96
+ });
@@ -0,0 +1,54 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_client_IntlayerClientProvider = require('../client/IntlayerClientProvider.cjs');
3
+ let react_jsx_runtime = require("react/jsx-runtime");
4
+ let react_intlayer_server = require("react-intlayer/server");
5
+
6
+ //#region src/server/IntlayerProvider.tsx
7
+ /**
8
+ * Unified Intlayer provider for the Next.js App Router.
9
+ *
10
+ * Server component that seeds the request-scoped server context (locale and
11
+ * ambient variant) read by the server hooks, and mounts the client provider so
12
+ * client components receive the same values — one provider for both halves.
13
+ *
14
+ * Mount it once, in the locale layout:
15
+ *
16
+ * ```tsx
17
+ * import { IntlayerProvider } from 'next-intlayer/server';
18
+ *
19
+ * const LocaleLayout: NextLayoutIntlayer = async ({ children, params }) => {
20
+ * const { locale } = await params;
21
+ *
22
+ * return (
23
+ * <IntlayerProvider locale={locale}>
24
+ * <html lang={locale}>
25
+ * <body>{children}</body>
26
+ * </html>
27
+ * </IntlayerProvider>
28
+ * );
29
+ * };
30
+ * ```
31
+ *
32
+ * The server context is request-scoped, not tree-scoped: on client-side
33
+ * navigations that only re-render the page segment, the layout — and with it
34
+ * this provider — does not re-run. The server hooks then fall back to the
35
+ * locale carried by the request (the `x-intlayer-locale` header set by the
36
+ * intlayer proxy, then the locale cookie), so content stays correct without a
37
+ * per-page provider. The ambient `variant` has no request-carried fallback:
38
+ * seed it per request with `setVariant` when server components read it outside
39
+ * a full render of this provider.
40
+ */
41
+ const IntlayerProvider = ({ children, locale, variant, ...clientProps }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_intlayer_server.IntlayerServerProvider, {
42
+ locale,
43
+ variant,
44
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_client_IntlayerClientProvider.IntlayerClientProvider, {
45
+ locale,
46
+ variant,
47
+ ...clientProps,
48
+ children
49
+ })
50
+ });
51
+
52
+ //#endregion
53
+ exports.IntlayerProvider = IntlayerProvider;
54
+ //# sourceMappingURL=IntlayerProvider.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IntlayerProvider.cjs","names":["IntlayerServerProvider","IntlayerClientProvider"],"sources":["../../../src/server/IntlayerProvider.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport {\n IntlayerServerProvider,\n type IntlayerServerProviderProps,\n} from 'react-intlayer/server';\nimport {\n IntlayerClientProvider,\n type IntlayerClientProviderProps,\n} from '../client/IntlayerClientProvider';\n\nexport type IntlayerProviderProps = IntlayerClientProviderProps &\n IntlayerServerProviderProps;\n\n/**\n * Unified Intlayer provider for the Next.js App Router.\n *\n * Server component that seeds the request-scoped server context (locale and\n * ambient variant) read by the server hooks, and mounts the client provider so\n * client components receive the same values — one provider for both halves.\n *\n * Mount it once, in the locale layout:\n *\n * ```tsx\n * import { IntlayerProvider } from 'next-intlayer/server';\n *\n * const LocaleLayout: NextLayoutIntlayer = async ({ children, params }) => {\n * const { locale } = await params;\n *\n * return (\n * <IntlayerProvider locale={locale}>\n * <html lang={locale}>\n * <body>{children}</body>\n * </html>\n * </IntlayerProvider>\n * );\n * };\n * ```\n *\n * The server context is request-scoped, not tree-scoped: on client-side\n * navigations that only re-render the page segment, the layout — and with it\n * this provider — does not re-run. The server hooks then fall back to the\n * locale carried by the request (the `x-intlayer-locale` header set by the\n * intlayer proxy, then the locale cookie), so content stays correct without a\n * per-page provider. The ambient `variant` has no request-carried fallback:\n * seed it per request with `setVariant` when server components read it outside\n * a full render of this provider.\n */\nexport const IntlayerProvider: FC<IntlayerProviderProps> = ({\n children,\n locale,\n variant,\n ...clientProps\n}) => (\n <IntlayerServerProvider locale={locale} variant={variant}>\n <IntlayerClientProvider locale={locale} variant={variant} {...clientProps}>\n {children}\n </IntlayerClientProvider>\n </IntlayerServerProvider>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,MAAa,oBAA+C,EAC1D,UACA,QACA,SACA,GAAG,kBAEH,2CAACA,8CAAD;CAAgC;CAAiB;WAC/C,2CAACC,8DAAD;EAAgC;EAAiB;EAAS,GAAI;EAC3D;CACqB;AACF"}
@@ -0,0 +1,17 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ let react_intlayer_server = require("react-intlayer/server");
3
+
4
+ //#region src/server/IntlayerServerProvider.ts
5
+ /**
6
+ * @deprecated Mount `IntlayerProvider` from `next-intlayer/server` once in the
7
+ * locale layout instead — it seeds both the server context and the client
8
+ * provider, and the server hooks fall back to the locale carried by the
9
+ * request when the layout is skipped on client-side navigations. For a page
10
+ * that must seed the locale itself (statically rendered routes on
11
+ * Next.js < 16), use the imperative `setLocale` instead of wrapping the tree.
12
+ */
13
+ const IntlayerServerProvider = react_intlayer_server.IntlayerServerProvider;
14
+
15
+ //#endregion
16
+ exports.IntlayerServerProvider = IntlayerServerProvider;
17
+ //# sourceMappingURL=IntlayerServerProvider.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IntlayerServerProvider.cjs","names":["IntlayerServerProviderBase"],"sources":["../../../src/server/IntlayerServerProvider.ts"],"sourcesContent":["import { IntlayerServerProvider as IntlayerServerProviderBase } from 'react-intlayer/server';\n\n/**\n * @deprecated Mount `IntlayerProvider` from `next-intlayer/server` once in the\n * locale layout instead — it seeds both the server context and the client\n * provider, and the server hooks fall back to the locale carried by the\n * request when the layout is skipped on client-side navigations. For a page\n * that must seed the locale itself (statically rendered routes on\n * Next.js < 16), use the imperative `setLocale` instead of wrapping the tree.\n */\nexport const IntlayerServerProvider = IntlayerServerProviderBase;\n"],"mappings":";;;;;;;;;;;;AAUA,MAAa,yBAAyBA"}
@@ -0,0 +1,64 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_server_getLocale = require('./getLocale.cjs');
3
+ const require_server_suspendingReader = require('./suspendingReader.cjs');
4
+ let react_intlayer_server = require("react-intlayer/server");
5
+
6
+ //#region src/server/ambientLocale.ts
7
+ /**
8
+ * Whether the call site already carries a locale — either a plain locale
9
+ * argument or a selector object with an explicit `locale` field.
10
+ */
11
+ const hasExplicitLocale = (localeOrSelector) => typeof localeOrSelector === "string" || typeof localeOrSelector === "object" && localeOrSelector !== null && Boolean(localeOrSelector.locale);
12
+ /**
13
+ * Whether the request-derived locale is worth reading at all.
14
+ *
15
+ * The base hooks in `react-intlayer/server` already prefer, in order, the
16
+ * locale passed at the call site and the request-scoped server context seeded
17
+ * by `IntlayerProvider`; they only fall back to the third argument these
18
+ * helpers produce. Reading request storage means calling `headers()` /
19
+ * `cookies()`, which opts the route into dynamic rendering — so it must stay
20
+ * behind both of those, and never run when either already answers.
21
+ */
22
+ const needsRequestLocale = (localeOrSelector) => !hasExplicitLocale(localeOrSelector) && !(0, react_intlayer_server.getServerContext)(react_intlayer_server.IntlayerServer);
23
+ /**
24
+ * Reads the locale carried by the request: the `x-intlayer-locale` header set
25
+ * by the intlayer proxy, then the locale cookie, then `accept-language`.
26
+ *
27
+ * Errors are not swallowed — during prerendering Next.js relies on the throw
28
+ * from `headers()` to mark the route dynamic.
29
+ */
30
+ const readStoredLocale = require_server_suspendingReader.createSuspendingReader(require_server_getLocale.getLocale);
31
+ /**
32
+ * Fallback locale for the synchronous server hooks, so a page does not need a
33
+ * provider of its own. Not a React hook despite suspending — it holds no
34
+ * positional state, which is what lets it run conditionally (see
35
+ * {@link createSuspendingReader}): on a client-side navigation that re-renders only the
36
+ * page segment, the layout — and with it `IntlayerProvider` — does not re-run,
37
+ * and the locale carried by the request takes over.
38
+ *
39
+ * Suspends until the request storage resolves. Returns `undefined` when the
40
+ * call site or the server context already carries the locale.
41
+ */
42
+ const resolveFallbackLocale = (localeOrSelector) => needsRequestLocale(localeOrSelector) ? readStoredLocale() : void 0;
43
+ /**
44
+ * Asynchronous twin of {@link resolveFallbackLocale}, for the hooks that are
45
+ * already async and can await the request storage instead of suspending on it.
46
+ */
47
+ const getFallbackLocale = async (localeOrSelector) => needsRequestLocale(localeOrSelector) ? await require_server_getLocale.getLocale() : void 0;
48
+ /**
49
+ * Full ambient locale for the server APIs that take a plain locale argument
50
+ * (or none at all): call site → server context → locale carried by the
51
+ * request.
52
+ *
53
+ * {@link resolveFallbackLocale} only yields the last rung, because the base hooks
54
+ * in `react-intlayer/server` consult the first two themselves. The APIs
55
+ * reimplemented here have no such fallback slot, so they need the resolved
56
+ * value.
57
+ */
58
+ const resolveAmbientLocale = (locale) => locale ?? (0, react_intlayer_server.getServerContext)(react_intlayer_server.IntlayerServer) ?? resolveFallbackLocale(locale);
59
+
60
+ //#endregion
61
+ exports.getFallbackLocale = getFallbackLocale;
62
+ exports.resolveAmbientLocale = resolveAmbientLocale;
63
+ exports.resolveFallbackLocale = resolveFallbackLocale;
64
+ //# sourceMappingURL=ambientLocale.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ambientLocale.cjs","names":["getServerContext","IntlayerServer","createSuspendingReader","getLocale"],"sources":["../../../src/server/ambientLocale.ts"],"sourcesContent":["import type { Locale } from '@intlayer/types/allLocales';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport { getServerContext, IntlayerServer } from 'react-intlayer/server';\nimport { getLocale } from './getLocale';\nimport { createSuspendingReader } from './suspendingReader';\n\n/**\n * Whether the call site already carries a locale — either a plain locale\n * argument or a selector object with an explicit `locale` field.\n */\nconst hasExplicitLocale = (localeOrSelector?: unknown): boolean =>\n typeof localeOrSelector === 'string' ||\n (typeof localeOrSelector === 'object' &&\n localeOrSelector !== null &&\n Boolean((localeOrSelector as { locale?: unknown }).locale));\n\n/**\n * Whether the request-derived locale is worth reading at all.\n *\n * The base hooks in `react-intlayer/server` already prefer, in order, the\n * locale passed at the call site and the request-scoped server context seeded\n * by `IntlayerProvider`; they only fall back to the third argument these\n * helpers produce. Reading request storage means calling `headers()` /\n * `cookies()`, which opts the route into dynamic rendering — so it must stay\n * behind both of those, and never run when either already answers.\n */\nconst needsRequestLocale = (localeOrSelector?: unknown): boolean =>\n !hasExplicitLocale(localeOrSelector) && !getServerContext(IntlayerServer);\n\n/**\n * Reads the locale carried by the request: the `x-intlayer-locale` header set\n * by the intlayer proxy, then the locale cookie, then `accept-language`.\n *\n * Errors are not swallowed — during prerendering Next.js relies on the throw\n * from `headers()` to mark the route dynamic.\n */\nconst readStoredLocale = createSuspendingReader<Locale>(getLocale);\n\n/**\n * Fallback locale for the synchronous server hooks, so a page does not need a\n * provider of its own. Not a React hook despite suspending — it holds no\n * positional state, which is what lets it run conditionally (see\n * {@link createSuspendingReader}): on a client-side navigation that re-renders only the\n * page segment, the layout — and with it `IntlayerProvider` — does not re-run,\n * and the locale carried by the request takes over.\n *\n * Suspends until the request storage resolves. Returns `undefined` when the\n * call site or the server context already carries the locale.\n */\nexport const resolveFallbackLocale = (\n localeOrSelector?: unknown\n): Locale | undefined =>\n needsRequestLocale(localeOrSelector) ? readStoredLocale() : undefined;\n\n/**\n * Asynchronous twin of {@link resolveFallbackLocale}, for the hooks that are\n * already async and can await the request storage instead of suspending on it.\n */\nexport const getFallbackLocale = async (\n localeOrSelector?: unknown\n): Promise<Locale | undefined> =>\n needsRequestLocale(localeOrSelector) ? await getLocale() : undefined;\n\n/**\n * Full ambient locale for the server APIs that take a plain locale argument\n * (or none at all): call site → server context → locale carried by the\n * request.\n *\n * {@link resolveFallbackLocale} only yields the last rung, because the base hooks\n * in `react-intlayer/server` consult the first two themselves. The APIs\n * reimplemented here have no such fallback slot, so they need the resolved\n * value.\n */\nexport const resolveAmbientLocale = (\n locale?: LocalesValues\n): LocalesValues | undefined =>\n locale ??\n getServerContext<LocalesValues>(IntlayerServer) ??\n resolveFallbackLocale(locale);\n"],"mappings":";;;;;;;;;;AAUA,MAAM,qBAAqB,qBACzB,OAAO,qBAAqB,YAC3B,OAAO,qBAAqB,YAC3B,qBAAqB,QACrB,QAAS,iBAA0C,MAAM;;;;;;;;;;;AAY7D,MAAM,sBAAsB,qBAC1B,CAAC,kBAAkB,gBAAgB,KAAK,KAACA,wCAAiBC,oCAAc;;;;;;;;AAS1E,MAAM,mBAAmBC,uDAA+BC,kCAAS;;;;;;;;;;;;AAajE,MAAa,yBACX,qBAEA,mBAAmB,gBAAgB,IAAI,iBAAiB,IAAI;;;;;AAM9D,MAAa,oBAAoB,OAC/B,qBAEA,mBAAmB,gBAAgB,IAAI,MAAMA,mCAAU,IAAI;;;;;;;;;;;AAY7D,MAAa,wBACX,WAEA,cACAH,wCAAgCC,oCAAc,KAC9C,sBAAsB,MAAM"}
@@ -1,8 +1,18 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_server_format_useUnit = require('./useUnit.cjs');
3
+ const require_server_format_useDate = require('./useDate.cjs');
4
+ const require_server_format_useNumber = require('./useNumber.cjs');
5
+ const require_server_format_useRelativeTime = require('./useRelativeTime.cjs');
6
+ const require_server_format_useCompact = require('./useCompact.cjs');
7
+ const require_server_format_useList = require('./useList.cjs');
8
+ const require_server_format_usePercentage = require('./usePercentage.cjs');
9
+ const require_server_format_useCurrency = require('./useCurrency.cjs');
1
10
 
2
- var react_intlayer_server_format = require("react-intlayer/server/format");
3
- Object.keys(react_intlayer_server_format).forEach(function (k) {
4
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
5
- enumerable: true,
6
- get: function () { return react_intlayer_server_format[k]; }
7
- });
8
- });
11
+ exports.useCompact = require_server_format_useCompact.useCompact;
12
+ exports.useCurrency = require_server_format_useCurrency.useCurrency;
13
+ exports.useDate = require_server_format_useDate.useDate;
14
+ exports.useList = require_server_format_useList.useList;
15
+ exports.useNumber = require_server_format_useNumber.useNumber;
16
+ exports.usePercentage = require_server_format_usePercentage.usePercentage;
17
+ exports.useRelativeTime = require_server_format_useRelativeTime.useRelativeTime;
18
+ exports.useUnit = require_server_format_useUnit.useUnit;
@@ -0,0 +1,26 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_server_ambientLocale = require('../ambientLocale.cjs');
3
+ let _intlayer_core_formatters = require("@intlayer/core/formatters");
4
+
5
+ //#region src/server/format/useCompact.ts
6
+ /**
7
+ * On the server side, hook returning a `compact` formatter bound to the ambient
8
+ * locale: the server context, falling back to the locale carried by the
9
+ * request. A per-call `locale` option still wins.
10
+ *
11
+ * Reimplemented rather than re-exported from `react-intlayer/server/format`:
12
+ * that one takes no locale argument, so there is no way to hand it the ambient
13
+ * locale — it would read the server context alone and format with the default
14
+ * locale on any render the provider did not reach.
15
+ */
16
+ const useCompact = () => {
17
+ const locale = require_server_ambientLocale.resolveAmbientLocale();
18
+ return (...args) => (0, _intlayer_core_formatters.compact)(args[0], {
19
+ ...args[1],
20
+ locale: args[1]?.locale ?? locale
21
+ });
22
+ };
23
+
24
+ //#endregion
25
+ exports.useCompact = useCompact;
26
+ //# sourceMappingURL=useCompact.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCompact.cjs","names":["resolveAmbientLocale","compact"],"sources":["../../../../src/server/format/useCompact.ts"],"sourcesContent":["import { compact } from '@intlayer/core/formatters';\nimport { resolveAmbientLocale } from '../ambientLocale';\n\n/**\n * On the server side, hook returning a `compact` formatter bound to the ambient\n * locale: the server context, falling back to the locale carried by the\n * request. A per-call `locale` option still wins.\n *\n * Reimplemented rather than re-exported from `react-intlayer/server/format`:\n * that one takes no locale argument, so there is no way to hand it the ambient\n * locale — it would read the server context alone and format with the default\n * locale on any render the provider did not reach.\n */\nexport const useCompact = () => {\n const locale = resolveAmbientLocale();\n\n return (...args: Parameters<typeof compact>) =>\n compact(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;AAaA,MAAa,mBAAmB;CAC9B,MAAM,SAASA,kDAAqB;CAEpC,QAAQ,GAAG,aACTC,mCAAQ,KAAK,IAAI;EACf,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
@@ -0,0 +1,26 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_server_ambientLocale = require('../ambientLocale.cjs');
3
+ let _intlayer_core_formatters = require("@intlayer/core/formatters");
4
+
5
+ //#region src/server/format/useCurrency.ts
6
+ /**
7
+ * On the server side, hook returning a `currency` formatter bound to the ambient
8
+ * locale: the server context, falling back to the locale carried by the
9
+ * request. A per-call `locale` option still wins.
10
+ *
11
+ * Reimplemented rather than re-exported from `react-intlayer/server/format`:
12
+ * that one takes no locale argument, so there is no way to hand it the ambient
13
+ * locale — it would read the server context alone and format with the default
14
+ * locale on any render the provider did not reach.
15
+ */
16
+ const useCurrency = () => {
17
+ const locale = require_server_ambientLocale.resolveAmbientLocale();
18
+ return (...args) => (0, _intlayer_core_formatters.currency)(args[0], {
19
+ ...args[1],
20
+ locale: args[1]?.locale ?? locale
21
+ });
22
+ };
23
+
24
+ //#endregion
25
+ exports.useCurrency = useCurrency;
26
+ //# sourceMappingURL=useCurrency.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCurrency.cjs","names":["resolveAmbientLocale","currency"],"sources":["../../../../src/server/format/useCurrency.ts"],"sourcesContent":["import { currency } from '@intlayer/core/formatters';\nimport { resolveAmbientLocale } from '../ambientLocale';\n\n/**\n * On the server side, hook returning a `currency` formatter bound to the ambient\n * locale: the server context, falling back to the locale carried by the\n * request. A per-call `locale` option still wins.\n *\n * Reimplemented rather than re-exported from `react-intlayer/server/format`:\n * that one takes no locale argument, so there is no way to hand it the ambient\n * locale — it would read the server context alone and format with the default\n * locale on any render the provider did not reach.\n */\nexport const useCurrency = () => {\n const locale = resolveAmbientLocale();\n\n return (...args: Parameters<typeof currency>) =>\n currency(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;AAaA,MAAa,oBAAoB;CAC/B,MAAM,SAASA,kDAAqB;CAEpC,QAAQ,GAAG,aACTC,oCAAS,KAAK,IAAI;EAChB,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
@@ -0,0 +1,33 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_server_ambientLocale = require('../ambientLocale.cjs');
3
+ let _intlayer_core_formatters = require("@intlayer/core/formatters");
4
+
5
+ //#region src/server/format/useDate.ts
6
+ /**
7
+ * On the server side, hook returning a `date` formatter bound to the ambient
8
+ * locale: the server context, falling back to the locale carried by the
9
+ * request. A per-call `locale` option still wins.
10
+ *
11
+ * Reimplemented rather than re-exported from `react-intlayer/server/format`:
12
+ * that one takes no locale argument, so there is no way to hand it the ambient
13
+ * locale — it would read the server context alone and format with the default
14
+ * locale on any render the provider did not reach.
15
+ *
16
+ * The options argument is either a preset name or an options object, so the
17
+ * preset is resolved before the locale is merged in — spreading the string
18
+ * itself would scatter its characters and drop the preset.
19
+ */
20
+ const useDate = () => {
21
+ const locale = require_server_ambientLocale.resolveAmbientLocale();
22
+ return (...args) => (0, _intlayer_core_formatters.date)(args[0], typeof args[1] === "string" ? {
23
+ ..._intlayer_core_formatters.presets[args[1]],
24
+ locale
25
+ } : {
26
+ ...args[1],
27
+ locale: args[1]?.locale ?? locale
28
+ });
29
+ };
30
+
31
+ //#endregion
32
+ exports.useDate = useDate;
33
+ //# sourceMappingURL=useDate.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDate.cjs","names":["resolveAmbientLocale","date","presets"],"sources":["../../../../src/server/format/useDate.ts"],"sourcesContent":["import { date, presets } from '@intlayer/core/formatters';\nimport { resolveAmbientLocale } from '../ambientLocale';\n\n/**\n * On the server side, hook returning a `date` formatter bound to the ambient\n * locale: the server context, falling back to the locale carried by the\n * request. A per-call `locale` option still wins.\n *\n * Reimplemented rather than re-exported from `react-intlayer/server/format`:\n * that one takes no locale argument, so there is no way to hand it the ambient\n * locale — it would read the server context alone and format with the default\n * locale on any render the provider did not reach.\n *\n * The options argument is either a preset name or an options object, so the\n * preset is resolved before the locale is merged in — spreading the string\n * itself would scatter its characters and drop the preset.\n */\nexport const useDate = () => {\n const locale = resolveAmbientLocale();\n\n return (...args: Parameters<typeof date>) =>\n date(\n args[0],\n typeof args[1] === 'string'\n ? { ...presets[args[1]], locale }\n : { ...args[1], locale: args[1]?.locale ?? locale }\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAiBA,MAAa,gBAAgB;CAC3B,MAAM,SAASA,kDAAqB;CAEpC,QAAQ,GAAG,aACTC,gCACE,KAAK,IACL,OAAO,KAAK,OAAO,WACf;EAAE,GAAGC,kCAAQ,KAAK;EAAK;CAAO,IAC9B;EAAE,GAAG,KAAK;EAAI,QAAQ,KAAK,EAAE,EAAE,UAAU;CAAO,CACtD;AACJ"}
@@ -0,0 +1,26 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_server_ambientLocale = require('../ambientLocale.cjs');
3
+ let _intlayer_core_formatters = require("@intlayer/core/formatters");
4
+
5
+ //#region src/server/format/useList.ts
6
+ /**
7
+ * On the server side, hook returning a `list` formatter bound to the ambient
8
+ * locale: the server context, falling back to the locale carried by the
9
+ * request. A per-call `locale` option still wins.
10
+ *
11
+ * Reimplemented rather than re-exported from `react-intlayer/server/format`:
12
+ * that one takes no locale argument, so there is no way to hand it the ambient
13
+ * locale — it would read the server context alone and format with the default
14
+ * locale on any render the provider did not reach.
15
+ */
16
+ const useList = () => {
17
+ const locale = require_server_ambientLocale.resolveAmbientLocale();
18
+ return (...args) => (0, _intlayer_core_formatters.list)(args[0], {
19
+ ...args[1],
20
+ locale: args[1]?.locale ?? locale
21
+ });
22
+ };
23
+
24
+ //#endregion
25
+ exports.useList = useList;
26
+ //# sourceMappingURL=useList.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useList.cjs","names":["resolveAmbientLocale","list"],"sources":["../../../../src/server/format/useList.ts"],"sourcesContent":["import { list } from '@intlayer/core/formatters';\nimport { resolveAmbientLocale } from '../ambientLocale';\n\n/**\n * On the server side, hook returning a `list` formatter bound to the ambient\n * locale: the server context, falling back to the locale carried by the\n * request. A per-call `locale` option still wins.\n *\n * Reimplemented rather than re-exported from `react-intlayer/server/format`:\n * that one takes no locale argument, so there is no way to hand it the ambient\n * locale — it would read the server context alone and format with the default\n * locale on any render the provider did not reach.\n */\nexport const useList = () => {\n const locale = resolveAmbientLocale();\n\n return (...args: Parameters<typeof list>) =>\n list(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;AAaA,MAAa,gBAAgB;CAC3B,MAAM,SAASA,kDAAqB;CAEpC,QAAQ,GAAG,aACTC,gCAAK,KAAK,IAAI;EACZ,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
@@ -0,0 +1,26 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_server_ambientLocale = require('../ambientLocale.cjs');
3
+ let _intlayer_core_formatters = require("@intlayer/core/formatters");
4
+
5
+ //#region src/server/format/useNumber.ts
6
+ /**
7
+ * On the server side, hook returning a `number` formatter bound to the ambient
8
+ * locale: the server context, falling back to the locale carried by the
9
+ * request. A per-call `locale` option still wins.
10
+ *
11
+ * Reimplemented rather than re-exported from `react-intlayer/server/format`:
12
+ * that one takes no locale argument, so there is no way to hand it the ambient
13
+ * locale — it would read the server context alone and format with the default
14
+ * locale on any render the provider did not reach.
15
+ */
16
+ const useNumber = () => {
17
+ const locale = require_server_ambientLocale.resolveAmbientLocale();
18
+ return (...args) => (0, _intlayer_core_formatters.number)(args[0], {
19
+ ...args[1],
20
+ locale: args[1]?.locale ?? locale
21
+ });
22
+ };
23
+
24
+ //#endregion
25
+ exports.useNumber = useNumber;
26
+ //# sourceMappingURL=useNumber.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useNumber.cjs","names":["resolveAmbientLocale","number"],"sources":["../../../../src/server/format/useNumber.ts"],"sourcesContent":["import { number } from '@intlayer/core/formatters';\nimport { resolveAmbientLocale } from '../ambientLocale';\n\n/**\n * On the server side, hook returning a `number` formatter bound to the ambient\n * locale: the server context, falling back to the locale carried by the\n * request. A per-call `locale` option still wins.\n *\n * Reimplemented rather than re-exported from `react-intlayer/server/format`:\n * that one takes no locale argument, so there is no way to hand it the ambient\n * locale — it would read the server context alone and format with the default\n * locale on any render the provider did not reach.\n */\nexport const useNumber = () => {\n const locale = resolveAmbientLocale();\n\n return (...args: Parameters<typeof number>) =>\n number(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;AAaA,MAAa,kBAAkB;CAC7B,MAAM,SAASA,kDAAqB;CAEpC,QAAQ,GAAG,aACTC,kCAAO,KAAK,IAAI;EACd,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
@@ -0,0 +1,26 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_server_ambientLocale = require('../ambientLocale.cjs');
3
+ let _intlayer_core_formatters = require("@intlayer/core/formatters");
4
+
5
+ //#region src/server/format/usePercentage.ts
6
+ /**
7
+ * On the server side, hook returning a `percentage` formatter bound to the ambient
8
+ * locale: the server context, falling back to the locale carried by the
9
+ * request. A per-call `locale` option still wins.
10
+ *
11
+ * Reimplemented rather than re-exported from `react-intlayer/server/format`:
12
+ * that one takes no locale argument, so there is no way to hand it the ambient
13
+ * locale — it would read the server context alone and format with the default
14
+ * locale on any render the provider did not reach.
15
+ */
16
+ const usePercentage = () => {
17
+ const locale = require_server_ambientLocale.resolveAmbientLocale();
18
+ return (...args) => (0, _intlayer_core_formatters.percentage)(args[0], {
19
+ ...args[1],
20
+ locale: args[1]?.locale ?? locale
21
+ });
22
+ };
23
+
24
+ //#endregion
25
+ exports.usePercentage = usePercentage;
26
+ //# sourceMappingURL=usePercentage.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePercentage.cjs","names":["resolveAmbientLocale","percentage"],"sources":["../../../../src/server/format/usePercentage.ts"],"sourcesContent":["import { percentage } from '@intlayer/core/formatters';\nimport { resolveAmbientLocale } from '../ambientLocale';\n\n/**\n * On the server side, hook returning a `percentage` formatter bound to the ambient\n * locale: the server context, falling back to the locale carried by the\n * request. A per-call `locale` option still wins.\n *\n * Reimplemented rather than re-exported from `react-intlayer/server/format`:\n * that one takes no locale argument, so there is no way to hand it the ambient\n * locale — it would read the server context alone and format with the default\n * locale on any render the provider did not reach.\n */\nexport const usePercentage = () => {\n const locale = resolveAmbientLocale();\n\n return (...args: Parameters<typeof percentage>) =>\n percentage(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;AAaA,MAAa,sBAAsB;CACjC,MAAM,SAASA,kDAAqB;CAEpC,QAAQ,GAAG,aACTC,sCAAW,KAAK,IAAI;EAClB,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
@@ -0,0 +1,26 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_server_ambientLocale = require('../ambientLocale.cjs');
3
+ let _intlayer_core_formatters = require("@intlayer/core/formatters");
4
+
5
+ //#region src/server/format/useRelativeTime.ts
6
+ /**
7
+ * On the server side, hook returning a `relativeTime` formatter bound to the ambient
8
+ * locale: the server context, falling back to the locale carried by the
9
+ * request. A per-call `locale` option still wins.
10
+ *
11
+ * Reimplemented rather than re-exported from `react-intlayer/server/format`:
12
+ * that one takes no locale argument, so there is no way to hand it the ambient
13
+ * locale — it would read the server context alone and format with the default
14
+ * locale on any render the provider did not reach.
15
+ */
16
+ const useRelativeTime = () => {
17
+ const locale = require_server_ambientLocale.resolveAmbientLocale();
18
+ return (...args) => (0, _intlayer_core_formatters.relativeTime)(args[0], args[1] ?? /* @__PURE__ */ new Date(), {
19
+ ...args[2],
20
+ locale: args[2]?.locale ?? locale
21
+ });
22
+ };
23
+
24
+ //#endregion
25
+ exports.useRelativeTime = useRelativeTime;
26
+ //# sourceMappingURL=useRelativeTime.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRelativeTime.cjs","names":["resolveAmbientLocale","relativeTime"],"sources":["../../../../src/server/format/useRelativeTime.ts"],"sourcesContent":["import { relativeTime } from '@intlayer/core/formatters';\nimport { resolveAmbientLocale } from '../ambientLocale';\n\n/**\n * On the server side, hook returning a `relativeTime` formatter bound to the ambient\n * locale: the server context, falling back to the locale carried by the\n * request. A per-call `locale` option still wins.\n *\n * Reimplemented rather than re-exported from `react-intlayer/server/format`:\n * that one takes no locale argument, so there is no way to hand it the ambient\n * locale — it would read the server context alone and format with the default\n * locale on any render the provider did not reach.\n */\nexport const useRelativeTime = () => {\n const locale = resolveAmbientLocale();\n\n return (...args: Parameters<typeof relativeTime>) =>\n relativeTime(args[0], args[1] ?? new Date(), {\n ...args[2],\n locale: args[2]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;AAaA,MAAa,wBAAwB;CACnC,MAAM,SAASA,kDAAqB;CAEpC,QAAQ,GAAG,aACTC,wCAAa,KAAK,IAAI,KAAK,sBAAM,IAAI,KAAK,GAAG;EAC3C,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
@@ -0,0 +1,26 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_server_ambientLocale = require('../ambientLocale.cjs');
3
+ let _intlayer_core_formatters = require("@intlayer/core/formatters");
4
+
5
+ //#region src/server/format/useUnit.ts
6
+ /**
7
+ * On the server side, hook returning a `units` formatter bound to the ambient
8
+ * locale: the server context, falling back to the locale carried by the
9
+ * request. A per-call `locale` option still wins.
10
+ *
11
+ * Reimplemented rather than re-exported from `react-intlayer/server/format`:
12
+ * that one takes no locale argument, so there is no way to hand it the ambient
13
+ * locale — it would read the server context alone and format with the default
14
+ * locale on any render the provider did not reach.
15
+ */
16
+ const useUnit = () => {
17
+ const locale = require_server_ambientLocale.resolveAmbientLocale();
18
+ return (...args) => (0, _intlayer_core_formatters.units)(args[0], {
19
+ ...args[1],
20
+ locale: args[1]?.locale ?? locale
21
+ });
22
+ };
23
+
24
+ //#endregion
25
+ exports.useUnit = useUnit;
26
+ //# sourceMappingURL=useUnit.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUnit.cjs","names":["resolveAmbientLocale","units"],"sources":["../../../../src/server/format/useUnit.ts"],"sourcesContent":["import { units } from '@intlayer/core/formatters';\nimport { resolveAmbientLocale } from '../ambientLocale';\n\n/**\n * On the server side, hook returning a `units` formatter bound to the ambient\n * locale: the server context, falling back to the locale carried by the\n * request. A per-call `locale` option still wins.\n *\n * Reimplemented rather than re-exported from `react-intlayer/server/format`:\n * that one takes no locale argument, so there is no way to hand it the ambient\n * locale — it would read the server context alone and format with the default\n * locale on any render the provider did not reach.\n */\nexport const useUnit = () => {\n const locale = resolveAmbientLocale();\n\n return (...args: Parameters<typeof units>) =>\n units(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;AAaA,MAAa,gBAAgB;CAC3B,MAAM,SAASA,kDAAqB;CAEpC,QAAQ,GAAG,aACTC,iCAAM,KAAK,IAAI;EACb,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}