react-intlayer 3.5.3 → 3.5.5

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 (109) hide show
  1. package/README.md +5 -5
  2. package/dist/cjs/cli/react-intlayer.cjs +4 -4
  3. package/dist/cjs/cli/react-intlayer.cjs.map +1 -1
  4. package/dist/cjs/client/index.cjs +3 -0
  5. package/dist/cjs/client/index.cjs.map +1 -1
  6. package/dist/cjs/client/useDictionary.cjs +3 -3
  7. package/dist/cjs/client/useDictionary.cjs.map +1 -1
  8. package/dist/cjs/client/useIntlayer.cjs +3 -3
  9. package/dist/cjs/client/useIntlayer.cjs.map +1 -1
  10. package/dist/cjs/client/useIntlayerAsync.cjs +55 -0
  11. package/dist/cjs/client/useIntlayerAsync.cjs.map +1 -0
  12. package/dist/cjs/distantDictionary/fetchDistantDictionary.cjs +59 -0
  13. package/dist/cjs/distantDictionary/fetchDistantDictionary.cjs.map +1 -0
  14. package/dist/cjs/editor/ContentSelectorWrapper.cjs.map +1 -1
  15. package/dist/cjs/editor/IntlayerEditorProvider.cjs +5 -1
  16. package/dist/cjs/editor/IntlayerEditorProvider.cjs.map +1 -1
  17. package/dist/cjs/editor/renderContentEditor.cjs +1 -1
  18. package/dist/cjs/editor/renderContentEditor.cjs.map +1 -1
  19. package/dist/cjs/{useDictionaryBase.cjs → getDictionary.cjs} +20 -19
  20. package/dist/cjs/getDictionary.cjs.map +1 -0
  21. package/dist/cjs/{useIntlayerBase.cjs → getIntlayer.cjs} +13 -11
  22. package/dist/cjs/getIntlayer.cjs.map +1 -0
  23. package/dist/cjs/getIntlayerAsync.cjs +42 -0
  24. package/dist/cjs/getIntlayerAsync.cjs.map +1 -0
  25. package/dist/cjs/index.cjs +8 -0
  26. package/dist/cjs/index.cjs.map +1 -1
  27. package/dist/cjs/processDictionary/contentDictionary.cjs.map +1 -1
  28. package/dist/cjs/processDictionary/index.cjs +13 -13
  29. package/dist/cjs/processDictionary/index.cjs.map +1 -1
  30. package/dist/cjs/server/useDictionary.cjs +3 -3
  31. package/dist/cjs/server/useDictionary.cjs.map +1 -1
  32. package/dist/cjs/server/useIntlayer.cjs +3 -3
  33. package/dist/cjs/server/useIntlayer.cjs.map +1 -1
  34. package/dist/cjs/utils/PoweredByMeta/index.cjs +40 -0
  35. package/dist/cjs/utils/PoweredByMeta/index.cjs.map +1 -0
  36. package/dist/esm/cli/react-intlayer.mjs +5 -5
  37. package/dist/esm/cli/react-intlayer.mjs.map +1 -1
  38. package/dist/esm/client/index.mjs +2 -0
  39. package/dist/esm/client/index.mjs.map +1 -1
  40. package/dist/esm/client/useDictionary.mjs +3 -3
  41. package/dist/esm/client/useDictionary.mjs.map +1 -1
  42. package/dist/esm/client/useIntlayer.mjs +4 -4
  43. package/dist/esm/client/useIntlayer.mjs.map +1 -1
  44. package/dist/esm/client/useIntlayerAsync.mjs +34 -0
  45. package/dist/esm/client/useIntlayerAsync.mjs.map +1 -0
  46. package/dist/esm/distantDictionary/fetchDistantDictionary.mjs +36 -0
  47. package/dist/esm/distantDictionary/fetchDistantDictionary.mjs.map +1 -0
  48. package/dist/esm/editor/ContentSelectorWrapper.mjs.map +1 -1
  49. package/dist/esm/editor/IntlayerEditorProvider.mjs +6 -2
  50. package/dist/esm/editor/IntlayerEditorProvider.mjs.map +1 -1
  51. package/dist/esm/editor/renderContentEditor.mjs +1 -1
  52. package/dist/esm/editor/renderContentEditor.mjs.map +1 -1
  53. package/dist/esm/{useDictionaryBase.mjs → getDictionary.mjs} +17 -14
  54. package/dist/esm/getDictionary.mjs.map +1 -0
  55. package/dist/esm/{useIntlayerBase.mjs → getIntlayer.mjs} +9 -7
  56. package/dist/esm/getIntlayer.mjs.map +1 -0
  57. package/dist/esm/getIntlayerAsync.mjs +19 -0
  58. package/dist/esm/getIntlayerAsync.mjs.map +1 -0
  59. package/dist/esm/index.mjs +6 -0
  60. package/dist/esm/index.mjs.map +1 -1
  61. package/dist/esm/processDictionary/index.mjs +13 -13
  62. package/dist/esm/processDictionary/index.mjs.map +1 -1
  63. package/dist/esm/server/useDictionary.mjs +3 -3
  64. package/dist/esm/server/useDictionary.mjs.map +1 -1
  65. package/dist/esm/server/useIntlayer.mjs +4 -4
  66. package/dist/esm/server/useIntlayer.mjs.map +1 -1
  67. package/dist/esm/utils/PoweredByMeta/index.mjs +17 -0
  68. package/dist/esm/utils/PoweredByMeta/index.mjs.map +1 -0
  69. package/dist/types/client/index.d.ts +1 -0
  70. package/dist/types/client/index.d.ts.map +1 -1
  71. package/dist/types/client/useDictionary.d.ts +1 -1
  72. package/dist/types/client/useDictionary.d.ts.map +1 -1
  73. package/dist/types/client/useIntlayer.d.ts +2 -2
  74. package/dist/types/client/useIntlayer.d.ts.map +1 -1
  75. package/dist/types/client/useIntlayerAsync.d.ts +15 -0
  76. package/dist/types/client/useIntlayerAsync.d.ts.map +1 -0
  77. package/dist/types/distantDictionary/fetchDistantDictionary.d.ts +6 -0
  78. package/dist/types/distantDictionary/fetchDistantDictionary.d.ts.map +1 -0
  79. package/dist/types/editor/ContentSelectorWrapper.d.ts +1 -1
  80. package/dist/types/editor/ContentSelectorWrapper.d.ts.map +1 -1
  81. package/dist/types/editor/IntlayerEditorProvider.d.ts.map +1 -1
  82. package/dist/types/editor/renderContentEditor.d.ts +4 -4
  83. package/dist/types/editor/renderContentEditor.d.ts.map +1 -1
  84. package/dist/types/getDictionary.d.ts +35 -0
  85. package/dist/types/getDictionary.d.ts.map +1 -0
  86. package/dist/types/{useIntlayerBase.d.ts → getIntlayer.d.ts} +6 -10
  87. package/dist/types/getIntlayer.d.ts.map +1 -0
  88. package/dist/types/getIntlayerAsync.d.ts +13 -0
  89. package/dist/types/getIntlayerAsync.d.ts.map +1 -0
  90. package/dist/types/index.d.ts +4 -2
  91. package/dist/types/index.d.ts.map +1 -1
  92. package/dist/types/processDictionary/contentDictionary.d.ts +1 -1
  93. package/dist/types/processDictionary/contentDictionary.d.ts.map +1 -1
  94. package/dist/types/processDictionary/index.d.ts +2 -2
  95. package/dist/types/processDictionary/index.d.ts.map +1 -1
  96. package/dist/types/server/useDictionary.d.ts +1 -1
  97. package/dist/types/server/useDictionary.d.ts.map +1 -1
  98. package/dist/types/server/useIntlayer.d.ts +2 -2
  99. package/dist/types/server/useIntlayer.d.ts.map +1 -1
  100. package/dist/types/utils/PoweredByMeta/index.d.ts +3 -0
  101. package/dist/types/utils/PoweredByMeta/index.d.ts.map +1 -0
  102. package/package.json +15 -14
  103. package/dist/cjs/useDictionaryBase.cjs.map +0 -1
  104. package/dist/cjs/useIntlayerBase.cjs.map +0 -1
  105. package/dist/esm/useDictionaryBase.mjs.map +0 -1
  106. package/dist/esm/useIntlayerBase.mjs.map +0 -1
  107. package/dist/types/useDictionaryBase.d.ts +0 -37
  108. package/dist/types/useDictionaryBase.d.ts.map +0 -1
  109. package/dist/types/useIntlayerBase.d.ts.map +0 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <div align="center">
2
2
  <a href="https://www.npmjs.com/package/react-intlayer">
3
- <img src="docs/assets/logo.png" width="500" alt="intlayer" />
3
+ <img src="https://raw.githubusercontent.com/aymericzip/intlayer/572ae9c9acafb74307b81530c1931a8e98990aef/docs/assets/logo.png" width="500" alt="intlayer" />
4
4
  </a>
5
5
  </div>
6
6
 
@@ -36,7 +36,7 @@
36
36
  ```tsx
37
37
  // ./Component1/index.content.ts
38
38
 
39
- import { DeclarationContent, t } from "intlayer";
39
+ import { type DeclarationContent, t } from "intlayer";
40
40
 
41
41
  const component1Content = {
42
42
  key: "component1",
@@ -115,7 +115,7 @@ const config: IntlayerConfig = {
115
115
  export default config;
116
116
  ```
117
117
 
118
- To see all available parameters, refer to the [configuration documentation here](https://github.com/aymericzip/intlayer/blob/main/docs/docs/configuration_en.md).
118
+ To see all available parameters, refer to the [configuration documentation here](https://github.com/aymericzip/intlayer/blob/main/docs/en/configuration.md).
119
119
 
120
120
  ## Step 3: Integrate Intlayer in Your CRA Configuration
121
121
 
@@ -174,7 +174,7 @@ const appContent = {
174
174
  export default appContent;
175
175
  ```
176
176
 
177
- [See how to declare your Intlayer declaration files](https://github.com/aymericzip/intlayer/blob/main/docs/docs/content_declaration/get_started_en.md).
177
+ [See how to declare your Intlayer declaration files](https://github.com/aymericzip/intlayer/blob/main/docs/en/content_declaration/get_started.md)
178
178
 
179
179
  ## Step 5: Utilize Intlayer in Your Code
180
180
 
@@ -272,4 +272,4 @@ Ensure your TypeScript configuration includes the autogenerated types.
272
272
 
273
273
  # Getting Started with Intlayer and Vite + React
274
274
 
275
- For integration with Vite + React, refer to the [setup guide](https://github.com/aymericzip/intlayer/blob/main/docs/docs/intlayer_with_vite_react_en.md).
275
+ For integration with Vite + React, refer to the [setup guide](https://github.com/aymericzip/intlayer/blob/main/docs/en/intlayer_with_vite_react.md)
@@ -48,13 +48,13 @@ switch (script) {
48
48
  });
49
49
  if (child.signal) {
50
50
  if (child.signal === "SIGKILL") {
51
- console.info(`
51
+ (0, import_config.appLogger)(`
52
52
  The build failed because the process exited too early.
53
53
  This probably means the system ran out of memory or someone called
54
54
  \`kill -9\` on the process.
55
55
  `);
56
56
  } else if (child.signal === "SIGTERM") {
57
- console.info(`
57
+ (0, import_config.appLogger)(`
58
58
  The build failed because the process exited too early.
59
59
  Someone might have called \`kill\` or \`killall\`, or the system could
60
60
  be shutting down.
@@ -66,8 +66,8 @@ switch (script) {
66
66
  break;
67
67
  }
68
68
  default:
69
- console.info(`Unknown script "${script}".`);
70
- console.info("Perhaps you need to update craco?");
69
+ (0, import_config.appLogger)(`Unknown script "${script}".`);
70
+ (0, import_config.appLogger)("Perhaps you need to update craco?");
71
71
  break;
72
72
  }
73
73
  //# sourceMappingURL=react-intlayer.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/cli/react-intlayer.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * To make the setup easier, we are using craco to override the webpack configuration.\n * This script is used to run the craco scripts with the custom configuration.\n *\n * The script is based on the original craco script from create-react-app.\n */\n\nimport { ESMxCJSRequire } from '@intlayer/config';\nimport spawn from 'cross-spawn';\n\nconst args = process.argv.slice(2);\nconst scriptIndex = args.findIndex(\n (x) => x === 'build' || x === 'start' || x === 'test'\n);\nconst script = scriptIndex === -1 ? args[0] : args[scriptIndex];\n\nswitch (script) {\n case 'build':\n case 'start':\n case 'test': {\n const nodeArgs = scriptIndex > 0 ? args.slice(0, scriptIndex) : [];\n const scriptPath = ESMxCJSRequire.resolve(\n `@craco/craco/dist/scripts/${script}`\n );\n\n const scriptArgs = args.slice(scriptIndex + 1);\n const processArgs = nodeArgs\n .concat(scriptPath)\n .concat([\n ...scriptArgs,\n '--config',\n './node_modules/react-intlayer/dist/cjs/craco/craco.config.cjs',\n ]);\n\n const child = spawn.sync('node', processArgs, {\n stdio: 'inherit',\n });\n\n if (child.signal) {\n if (child.signal === 'SIGKILL') {\n console.info(`\n The build failed because the process exited too early.\n This probably means the system ran out of memory or someone called\n \\`kill -9\\` on the process.\n `);\n } else if (child.signal === 'SIGTERM') {\n console.info(`\n The build failed because the process exited too early.\n Someone might have called \\`kill\\` or \\`killall\\`, or the system could\n be shutting down.\n `);\n }\n\n process.exit(1);\n }\n\n process.exit(child.status ?? undefined);\n break;\n }\n default:\n console.info(`Unknown script \"${script}\".`);\n console.info('Perhaps you need to update craco?');\n break;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AASA,oBAA+B;AAC/B,yBAAkB;AAElB,MAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AACjC,MAAM,cAAc,KAAK;AAAA,EACvB,CAAC,MAAM,MAAM,WAAW,MAAM,WAAW,MAAM;AACjD;AACA,MAAM,SAAS,gBAAgB,KAAK,KAAK,CAAC,IAAI,KAAK,WAAW;AAE9D,QAAQ,QAAQ;AAAA,EACd,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK,QAAQ;AACX,UAAM,WAAW,cAAc,IAAI,KAAK,MAAM,GAAG,WAAW,IAAI,CAAC;AACjE,UAAM,aAAa,6BAAe;AAAA,MAChC,6BAA6B,MAAM;AAAA,IACrC;AAEA,UAAM,aAAa,KAAK,MAAM,cAAc,CAAC;AAC7C,UAAM,cAAc,SACjB,OAAO,UAAU,EACjB,OAAO;AAAA,MACN,GAAG;AAAA,MACH;AAAA,MACA;AAAA,IACF,CAAC;AAEH,UAAM,QAAQ,mBAAAA,QAAM,KAAK,QAAQ,aAAa;AAAA,MAC5C,OAAO;AAAA,IACT,CAAC;AAED,QAAI,MAAM,QAAQ;AAChB,UAAI,MAAM,WAAW,WAAW;AAC9B,gBAAQ,KAAK;AAAA;AAAA;AAAA;AAAA,aAIR;AAAA,MACP,WAAW,MAAM,WAAW,WAAW;AACrC,gBAAQ,KAAK;AAAA;AAAA;AAAA;AAAA,aAIR;AAAA,MACP;AAEA,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,YAAQ,KAAK,MAAM,UAAU,MAAS;AACtC;AAAA,EACF;AAAA,EACA;AACE,YAAQ,KAAK,mBAAmB,MAAM,IAAI;AAC1C,YAAQ,KAAK,mCAAmC;AAChD;AACJ;","names":["spawn"]}
1
+ {"version":3,"sources":["../../../src/cli/react-intlayer.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * To make the setup easier, we are using craco to override the webpack configuration.\n * This script is used to run the craco scripts with the custom configuration.\n *\n * The script is based on the original craco script from create-react-app.\n */\n\nimport { ESMxCJSRequire, appLogger } from '@intlayer/config';\nimport spawn from 'cross-spawn';\n\nconst args = process.argv.slice(2);\nconst scriptIndex = args.findIndex(\n (x) => x === 'build' || x === 'start' || x === 'test'\n);\nconst script = scriptIndex === -1 ? args[0] : args[scriptIndex];\n\nswitch (script) {\n case 'build':\n case 'start':\n case 'test': {\n const nodeArgs = scriptIndex > 0 ? args.slice(0, scriptIndex) : [];\n const scriptPath = ESMxCJSRequire.resolve(\n `@craco/craco/dist/scripts/${script}`\n );\n\n const scriptArgs = args.slice(scriptIndex + 1);\n const processArgs = nodeArgs\n .concat(scriptPath)\n .concat([\n ...scriptArgs,\n '--config',\n './node_modules/react-intlayer/dist/cjs/craco/craco.config.cjs',\n ]);\n\n const child = spawn.sync('node', processArgs, {\n stdio: 'inherit',\n });\n\n if (child.signal) {\n if (child.signal === 'SIGKILL') {\n appLogger(`\n The build failed because the process exited too early.\n This probably means the system ran out of memory or someone called\n \\`kill -9\\` on the process.\n `);\n } else if (child.signal === 'SIGTERM') {\n appLogger(`\n The build failed because the process exited too early.\n Someone might have called \\`kill\\` or \\`killall\\`, or the system could\n be shutting down.\n `);\n }\n\n process.exit(1);\n }\n\n process.exit(child.status ?? undefined);\n break;\n }\n default:\n appLogger(`Unknown script \"${script}\".`);\n appLogger('Perhaps you need to update craco?');\n break;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AASA,oBAA0C;AAC1C,yBAAkB;AAElB,MAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AACjC,MAAM,cAAc,KAAK;AAAA,EACvB,CAAC,MAAM,MAAM,WAAW,MAAM,WAAW,MAAM;AACjD;AACA,MAAM,SAAS,gBAAgB,KAAK,KAAK,CAAC,IAAI,KAAK,WAAW;AAE9D,QAAQ,QAAQ;AAAA,EACd,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK,QAAQ;AACX,UAAM,WAAW,cAAc,IAAI,KAAK,MAAM,GAAG,WAAW,IAAI,CAAC;AACjE,UAAM,aAAa,6BAAe;AAAA,MAChC,6BAA6B,MAAM;AAAA,IACrC;AAEA,UAAM,aAAa,KAAK,MAAM,cAAc,CAAC;AAC7C,UAAM,cAAc,SACjB,OAAO,UAAU,EACjB,OAAO;AAAA,MACN,GAAG;AAAA,MACH;AAAA,MACA;AAAA,IACF,CAAC;AAEH,UAAM,QAAQ,mBAAAA,QAAM,KAAK,QAAQ,aAAa;AAAA,MAC5C,OAAO;AAAA,IACT,CAAC;AAED,QAAI,MAAM,QAAQ;AAChB,UAAI,MAAM,WAAW,WAAW;AAC9B,qCAAU;AAAA;AAAA;AAAA;AAAA,aAIL;AAAA,MACP,WAAW,MAAM,WAAW,WAAW;AACrC,qCAAU;AAAA;AAAA;AAAA;AAAA,aAIL;AAAA,MACP;AAEA,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,YAAQ,KAAK,MAAM,UAAU,MAAS;AACtC;AAAA,EACF;AAAA,EACA;AACE,iCAAU,mBAAmB,MAAM,IAAI;AACvC,iCAAU,mCAAmC;AAC7C;AACJ;","names":["spawn"]}
@@ -26,6 +26,7 @@ __export(client_exports, {
26
26
  t: () => import_t.t,
27
27
  useDictionary: () => import_useDictionary.useDictionary,
28
28
  useIntlayer: () => import_useIntlayer.useIntlayer,
29
+ useIntlayerAsync: () => import_useIntlayerAsync.useIntlayerAsync,
29
30
  useIntlayerContext: () => import_IntlayerProvider.useIntlayerContext,
30
31
  useLocale: () => import_useLocale.useLocale,
31
32
  useLocaleBase: () => import_useLocaleBase.useLocaleBase,
@@ -35,6 +36,7 @@ __export(client_exports, {
35
36
  module.exports = __toCommonJS(client_exports);
36
37
  var import_IntlayerProvider = require('./IntlayerProvider.cjs');
37
38
  var import_useIntlayer = require('./useIntlayer.cjs');
39
+ var import_useIntlayerAsync = require('./useIntlayerAsync.cjs');
38
40
  var import_useDictionary = require('./useDictionary.cjs');
39
41
  var import_useLocaleBase = require('./useLocaleBase.cjs');
40
42
  var import_useLocale = require('./useLocale.cjs');
@@ -52,6 +54,7 @@ var import_t = require('./t.cjs');
52
54
  t,
53
55
  useDictionary,
54
56
  useIntlayer,
57
+ useIntlayerAsync,
55
58
  useIntlayerContext,
56
59
  useLocale,
57
60
  useLocaleBase,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/index.ts"],"sourcesContent":["export {\n type IntlayerProviderProps,\n IntlayerClientContext,\n useIntlayerContext,\n IntlayerProvider,\n} from './IntlayerProvider';\nexport { useIntlayer } from './useIntlayer';\nexport { useDictionary } from './useDictionary';\nexport { useLocaleBase } from './useLocaleBase';\nexport { useLocale } from './useLocale';\nexport { useTraduction } from './useTraduction';\nexport {\n useLocaleCookie,\n localeCookie,\n setLocaleCookie,\n} from './useLocaleCookie';\nexport { getBrowserLocale } from './getBrowserLocale';\nexport { t } from './t';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAKO;AACP,yBAA4B;AAC5B,2BAA8B;AAC9B,2BAA8B;AAC9B,uBAA0B;AAC1B,2BAA8B;AAC9B,6BAIO;AACP,8BAAiC;AACjC,eAAkB;","names":[]}
1
+ {"version":3,"sources":["../../../src/client/index.ts"],"sourcesContent":["export {\n type IntlayerProviderProps,\n IntlayerClientContext,\n useIntlayerContext,\n IntlayerProvider,\n} from './IntlayerProvider';\nexport { useIntlayer } from './useIntlayer';\nexport { useIntlayerAsync } from './useIntlayerAsync';\nexport { useDictionary } from './useDictionary';\nexport { useLocaleBase } from './useLocaleBase';\nexport { useLocale } from './useLocale';\nexport { useTraduction } from './useTraduction';\nexport {\n useLocaleCookie,\n localeCookie,\n setLocaleCookie,\n} from './useLocaleCookie';\nexport { getBrowserLocale } from './getBrowserLocale';\nexport { t } from './t';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAKO;AACP,yBAA4B;AAC5B,8BAAiC;AACjC,2BAA8B;AAC9B,2BAA8B;AAC9B,uBAA0B;AAC1B,2BAA8B;AAC9B,6BAIO;AACP,8BAAiC;AACjC,eAAkB;","names":[]}
@@ -23,12 +23,12 @@ __export(useDictionary_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(useDictionary_exports);
25
25
  var import_react = require("react");
26
- var import_useDictionaryBase = require('../useDictionaryBase.cjs');
26
+ var import_getDictionary = require('../getDictionary.cjs');
27
27
  var import_IntlayerProvider = require('./IntlayerProvider.cjs');
28
- const useDictionary = (dictionary, locale) => {
28
+ const useDictionary = (dictionary, locale, isRenderEditor = false) => {
29
29
  const { locale: currentLocale } = (0, import_react.useContext)(import_IntlayerProvider.IntlayerClientContext);
30
30
  const localeTarget = locale ?? currentLocale;
31
- return (0, import_useDictionaryBase.useDictionaryBase)(dictionary, localeTarget);
31
+ return (0, import_getDictionary.getDictionary)(dictionary, localeTarget, isRenderEditor);
32
32
  };
33
33
  // Annotate the CommonJS export names for ESM import in node:
34
34
  0 && (module.exports = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/useDictionary.ts"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { DeclarationContent } from '@intlayer/core';\nimport { useContext } from 'react';\nimport { useDictionaryBase, type UseDictionary } from '../useDictionaryBase';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\n/**\n * On the server side, Hook that transform a dictionary and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useDictionary: UseDictionary = <T extends DeclarationContent>(\n dictionary: T,\n locale?: Locales\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n const localeTarget = locale ?? currentLocale;\n\n return useDictionaryBase(dictionary, localeTarget);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,mBAA2B;AAC3B,+BAAsD;AACtD,8BAAsC;AAO/B,MAAM,gBAA+B,CAC1C,YACA,WACG;AACH,QAAM,EAAE,QAAQ,cAAc,QAAI,yBAAW,6CAAqB;AAClE,QAAM,eAAe,UAAU;AAE/B,aAAO,4CAAkB,YAAY,YAAY;AACnD;","names":[]}
1
+ {"version":3,"sources":["../../../src/client/useDictionary.ts"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { DeclarationContent } from '@intlayer/core';\nimport { useContext } from 'react';\nimport { getDictionary, type UseDictionary } from '../getDictionary';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\n/**\n * On the server side, Hook that transform a dictionary and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useDictionary: UseDictionary = <T extends DeclarationContent>(\n dictionary: T,\n locale?: Locales,\n isRenderEditor = false\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n const localeTarget = locale ?? currentLocale;\n\n return getDictionary(dictionary, localeTarget, isRenderEditor);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,mBAA2B;AAC3B,2BAAkD;AAClD,8BAAsC;AAO/B,MAAM,gBAA+B,CAC1C,YACA,QACA,iBAAiB,UACd;AACH,QAAM,EAAE,QAAQ,cAAc,QAAI,yBAAW,6CAAqB;AAClE,QAAM,eAAe,UAAU;AAE/B,aAAO,oCAAc,YAAY,cAAc,cAAc;AAC/D;","names":[]}
@@ -23,12 +23,12 @@ __export(useIntlayer_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(useIntlayer_exports);
25
25
  var import_react = require("react");
26
- var import_useIntlayerBase = require('../useIntlayerBase.cjs');
26
+ var import_getIntlayer = require('../getIntlayer.cjs');
27
27
  var import_IntlayerProvider = require('./IntlayerProvider.cjs');
28
- const useIntlayer = (key, locale) => {
28
+ const useIntlayer = (key, locale, isRenderEditor = true) => {
29
29
  const { locale: currentLocale } = (0, import_react.useContext)(import_IntlayerProvider.IntlayerClientContext);
30
30
  const localeTarget = locale ?? currentLocale;
31
- return (0, import_useIntlayerBase.useIntlayerBase)(key, localeTarget);
31
+ return (0, import_getIntlayer.getIntlayer)(key, localeTarget, isRenderEditor);
32
32
  };
33
33
  // Annotate the CommonJS export names for ESM import in node:
34
34
  0 && (module.exports = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/useIntlayer.ts"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport { useContext } from 'react';\nimport {\n type DictionaryKeys,\n useIntlayerBase,\n type UseIntlayer,\n} from '../useIntlayerBase';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\n/**\n * On the client side, Hook that picking one dictionary by its key and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useIntlayer: UseIntlayer = <T extends DictionaryKeys>(\n key: T,\n locale?: Locales\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n const localeTarget = locale ?? currentLocale;\n\n return useIntlayerBase(key, localeTarget);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAA2B;AAC3B,6BAIO;AACP,8BAAsC;AAO/B,MAAM,cAA2B,CACtC,KACA,WACG;AACH,QAAM,EAAE,QAAQ,cAAc,QAAI,yBAAW,6CAAqB;AAClE,QAAM,eAAe,UAAU;AAE/B,aAAO,wCAAgB,KAAK,YAAY;AAC1C;","names":[]}
1
+ {"version":3,"sources":["../../../src/client/useIntlayer.ts"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport { useContext } from 'react';\nimport {\n type DictionaryKeys,\n getIntlayer,\n type UseIntlayerEditable,\n} from '../getIntlayer';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\n/**\n * On the client side, Hook that picking one dictionary by its key and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useIntlayer: UseIntlayerEditable = <T extends DictionaryKeys>(\n key: T,\n locale?: Locales,\n isRenderEditor = true\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n const localeTarget = locale ?? currentLocale;\n\n return getIntlayer(key, localeTarget, isRenderEditor);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAA2B;AAC3B,yBAIO;AACP,8BAAsC;AAO/B,MAAM,cAAmC,CAC9C,KACA,QACA,iBAAiB,SACd;AACH,QAAM,EAAE,QAAQ,cAAc,QAAI,yBAAW,6CAAqB;AAClE,QAAM,eAAe,UAAU;AAE/B,aAAO,gCAAY,KAAK,cAAc,cAAc;AACtD;","names":[]}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var useIntlayerAsync_exports = {};
21
+ __export(useIntlayerAsync_exports, {
22
+ useIntlayerAsync: () => useIntlayerAsync
23
+ });
24
+ module.exports = __toCommonJS(useIntlayerAsync_exports);
25
+ var import_react = require("react");
26
+ var import_getIntlayer = require('../getIntlayer.cjs');
27
+ var import_getIntlayerAsync = require('../getIntlayerAsync.cjs');
28
+ var import_IntlayerProvider = require('./IntlayerProvider.cjs');
29
+ const useIntlayerAsync = (key, locale, isRenderEditor = true) => {
30
+ const { locale: currentLocale } = (0, import_react.useContext)(import_IntlayerProvider.IntlayerClientContext);
31
+ const localeTarget = locale ?? currentLocale;
32
+ const localeDictionary = (0, import_getIntlayer.getIntlayer)(key, localeTarget, isRenderEditor);
33
+ const [distantDictionary, setDistantDictionary] = (0, import_react.useState)(void 0);
34
+ const [isLoading, setIsLoading] = (0, import_react.useState)(false);
35
+ (0, import_react.useEffect)(() => {
36
+ setIsLoading(true);
37
+ (0, import_getIntlayerAsync.getIntlayerAsync)(key).then((distantDictionary2) => {
38
+ if (distantDictionary2) {
39
+ setDistantDictionary(distantDictionary2);
40
+ }
41
+ }).finally(() => {
42
+ setIsLoading(false);
43
+ });
44
+ }, []);
45
+ const dictionary = (0, import_react.useMemo)(
46
+ () => distantDictionary ?? localeDictionary,
47
+ [distantDictionary, localeDictionary]
48
+ );
49
+ return { ...dictionary, isLoading };
50
+ };
51
+ // Annotate the CommonJS export names for ESM import in node:
52
+ 0 && (module.exports = {
53
+ useIntlayerAsync
54
+ });
55
+ //# sourceMappingURL=useIntlayerAsync.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/client/useIntlayerAsync.ts"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport { useContext, useEffect, useMemo, useState } from 'react';\nimport {\n DataFromDictionaryKey,\n type DictionaryKeys,\n getIntlayer,\n} from '../getIntlayer';\nimport { getIntlayerAsync } from '../getIntlayerAsync';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\nexport type UseIntlayerAsync = <\n T extends DictionaryKeys,\n L extends Locales,\n R extends boolean = true,\n>(\n key: T,\n locale?: L,\n isRenderEditor?: R\n) => DataFromDictionaryKey<T, L, R> & { isLoading: boolean };\n\n/**\n * On the client side, Hook that picking one dictionary by its key and return the content\n *\n * This hook will prerender the locale dictionary and fetch simultaneously the distant dictionaries to hydrate it.\n *\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useIntlayerAsync: UseIntlayerAsync = <T extends DictionaryKeys>(\n key: T,\n locale?: Locales,\n isRenderEditor = true\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n const localeTarget = locale ?? currentLocale;\n const localeDictionary = getIntlayer(key, localeTarget, isRenderEditor);\n const [distantDictionary, setDistantDictionary] = useState<\n typeof localeDictionary | null | undefined\n >(undefined);\n const [isLoading, setIsLoading] = useState(false);\n\n useEffect(() => {\n setIsLoading(true);\n\n getIntlayerAsync(key)\n .then((distantDictionary) => {\n if (distantDictionary) {\n setDistantDictionary(distantDictionary);\n }\n })\n .finally(() => {\n setIsLoading(false);\n });\n }, []);\n\n const dictionary = useMemo(\n () => distantDictionary ?? localeDictionary,\n [distantDictionary, localeDictionary]\n );\n\n return { ...dictionary, isLoading };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAAyD;AACzD,yBAIO;AACP,8BAAiC;AACjC,8BAAsC;AAoB/B,MAAM,mBAAqC,CAChD,KACA,QACA,iBAAiB,SACd;AACH,QAAM,EAAE,QAAQ,cAAc,QAAI,yBAAW,6CAAqB;AAClE,QAAM,eAAe,UAAU;AAC/B,QAAM,uBAAmB,gCAAY,KAAK,cAAc,cAAc;AACtE,QAAM,CAAC,mBAAmB,oBAAoB,QAAI,uBAEhD,MAAS;AACX,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAS,KAAK;AAEhD,8BAAU,MAAM;AACd,iBAAa,IAAI;AAEjB,kDAAiB,GAAG,EACjB,KAAK,CAACA,uBAAsB;AAC3B,UAAIA,oBAAmB;AACrB,6BAAqBA,kBAAiB;AAAA,MACxC;AAAA,IACF,CAAC,EACA,QAAQ,MAAM;AACb,mBAAa,KAAK;AAAA,IACpB,CAAC;AAAA,EACL,GAAG,CAAC,CAAC;AAEL,QAAM,iBAAa;AAAA,IACjB,MAAM,qBAAqB;AAAA,IAC3B,CAAC,mBAAmB,gBAAgB;AAAA,EACtC;AAEA,SAAO,EAAE,GAAG,YAAY,UAAU;AACpC;","names":["distantDictionary"]}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var fetchDistantDictionary_exports = {};
20
+ __export(fetchDistantDictionary_exports, {
21
+ fetchDistantDictionary: () => fetchDistantDictionary
22
+ });
23
+ module.exports = __toCommonJS(fetchDistantDictionary_exports);
24
+ var import_client = require("@intlayer/config/client");
25
+ var import_libs = require("@intlayer/design-system/libs");
26
+ const fetchDistantDictionary = async (dictionaryKey) => {
27
+ try {
28
+ const config = (0, import_client.getConfiguration)();
29
+ const { clientId, clientSecret } = config.editor;
30
+ const intlayerAPI = (0, import_libs.getIntlayerAPI)(void 0, config);
31
+ if (!clientId || !clientSecret) {
32
+ throw new Error(
33
+ "Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project."
34
+ );
35
+ }
36
+ const oAuth2TokenResult = await intlayerAPI.auth.getOAuth2AccessToken();
37
+ const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;
38
+ const getDictionaryResult = await intlayerAPI.dictionary.getDictionary(
39
+ dictionaryKey,
40
+ void 0,
41
+ {
42
+ headers: { Authorization: `Bearer ${oAuth2AccessToken}` }
43
+ }
44
+ );
45
+ const distantDictionary = getDictionaryResult.data;
46
+ if (!distantDictionary) {
47
+ throw new Error(`Dictionary ${dictionaryKey} not found on remote`);
48
+ }
49
+ return distantDictionary;
50
+ } catch (error) {
51
+ console.error(error);
52
+ return void 0;
53
+ }
54
+ };
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+ 0 && (module.exports = {
57
+ fetchDistantDictionary
58
+ });
59
+ //# sourceMappingURL=fetchDistantDictionary.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/distantDictionary/fetchDistantDictionary.ts"],"sourcesContent":["// @ts-ignore @intlayer/backend not build yet\nimport { type DictionaryAPI } from '@intlayer/backend';\nimport { getConfiguration } from '@intlayer/config/client';\n// @ts-ignore @intlayer/design-system not build yet\nimport { getIntlayerAPI } from '@intlayer/design-system/libs';\n\n/**\n * Fetch distant dictionary\n */\nexport const fetchDistantDictionary = async (\n dictionaryKey: string\n): Promise<DictionaryAPI> => {\n try {\n const config = getConfiguration();\n const { clientId, clientSecret } = config.editor;\n const intlayerAPI = getIntlayerAPI(undefined, config);\n\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const oAuth2TokenResult = await intlayerAPI.auth.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n // Fetch the dictionary\n const getDictionaryResult = await intlayerAPI.dictionary.getDictionary(\n dictionaryKey,\n undefined,\n {\n headers: { Authorization: `Bearer ${oAuth2AccessToken}` },\n }\n );\n\n const distantDictionary = getDictionaryResult.data;\n\n if (!distantDictionary) {\n throw new Error(`Dictionary ${dictionaryKey} not found on remote`);\n }\n\n return distantDictionary;\n } catch (error) {\n console.error(error);\n return undefined;\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAAiC;AAEjC,kBAA+B;AAKxB,MAAM,yBAAyB,OACpC,kBAC2B;AAC3B,MAAI;AACF,UAAM,aAAS,gCAAiB;AAChC,UAAM,EAAE,UAAU,aAAa,IAAI,OAAO;AAC1C,UAAM,kBAAc,4BAAe,QAAW,MAAM;AAEpD,QAAI,CAAC,YAAY,CAAC,cAAc;AAC9B,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,UAAM,oBAAoB,MAAM,YAAY,KAAK,qBAAqB;AAEtE,UAAM,oBAAoB,kBAAkB,MAAM;AAGlD,UAAM,sBAAsB,MAAM,YAAY,WAAW;AAAA,MACvD;AAAA,MACA;AAAA,MACA;AAAA,QACE,SAAS,EAAE,eAAe,UAAU,iBAAiB,GAAG;AAAA,MAC1D;AAAA,IACF;AAEA,UAAM,oBAAoB,oBAAoB;AAE9C,QAAI,CAAC,mBAAmB;AACtB,YAAM,IAAI,MAAM,cAAc,aAAa,sBAAsB;AAAA,IACnE;AAEA,WAAO;AAAA,EACT,SAAS,OAAO;AACd,YAAQ,MAAM,KAAK;AACnB,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/editor/ContentSelectorWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { type KeyPath } from '@intlayer/core';\nimport { type FC, type ReactNode } from 'react';\n\nexport type ContentSelectorWrapperProps = {\n children: ReactNode;\n dictionaryId: string;\n dictionaryPath: string;\n keyPath: KeyPath[];\n};\n\nexport const ContentSelectorWrapper: FC<ContentSelectorWrapperProps> = ({\n children,\n}) => <>{children}</>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAcM;AAFC,MAAM,yBAA0D,CAAC;AAAA,EACtE;AACF,MAAM,2EAAG,UAAS;","names":[]}
1
+ {"version":3,"sources":["../../../src/editor/ContentSelectorWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { type KeyPath } from '@intlayer/core';\nimport { type FC, type ReactNode } from 'react';\n\nexport type ContentSelectorWrapperProps = {\n children: ReactNode;\n dictionaryKey: string;\n dictionaryPath: string;\n keyPath: KeyPath[];\n};\n\nexport const ContentSelectorWrapper: FC<ContentSelectorWrapperProps> = ({\n children,\n}) => <>{children}</>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAcM;AAFC,MAAM,yBAA0D,CAAC;AAAA,EACtE;AACF,MAAM,2EAAG,UAAS;","names":[]}
@@ -22,8 +22,12 @@ __export(IntlayerEditorProvider_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(IntlayerEditorProvider_exports);
24
24
  var import_jsx_runtime = require("react/jsx-runtime");
25
+ var import_PoweredByMeta = require('../utils/PoweredByMeta/index.cjs');
25
26
  var import_ContentSelectorConnector = require('./ContentSelectorConnector.cjs');
26
- const IntlayerEditorProvider = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ContentSelectorConnector.ContentSelectorProvider, { children });
27
+ const IntlayerEditorProvider = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ContentSelectorConnector.ContentSelectorProvider, { children: [
28
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_PoweredByMeta.PoweredByMeta, {}),
29
+ children
30
+ ] });
27
31
  // Annotate the CommonJS export names for ESM import in node:
28
32
  0 && (module.exports = {
29
33
  IntlayerEditorProvider
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"sourcesContent":["import { FC, PropsWithChildren } from 'react';\nimport { ContentSelectorProvider } from './ContentSelectorConnector';\n\nexport const IntlayerEditorProvider: FC<PropsWithChildren> = ({ children }) => (\n <ContentSelectorProvider>{children}</ContentSelectorProvider>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIE;AAHF,sCAAwC;AAEjC,MAAM,yBAAgD,CAAC,EAAE,SAAS,MACvE,4CAAC,2DAAyB,UAAS;","names":[]}
1
+ {"version":3,"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"sourcesContent":["import { FC, PropsWithChildren } from 'react';\nimport { PoweredByMeta } from '../utils/PoweredByMeta/index';\nimport { ContentSelectorProvider } from './ContentSelectorConnector';\n\nexport const IntlayerEditorProvider: FC<PropsWithChildren> = ({ children }) => (\n <ContentSelectorProvider>\n <PoweredByMeta />\n {children}\n </ContentSelectorProvider>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKE;AAJF,2BAA8B;AAC9B,sCAAwC;AAEjC,MAAM,yBAAgD,CAAC,EAAE,SAAS,MACvE,6CAAC,2DACC;AAAA,8CAAC,sCAAc;AAAA,EACd;AAAA,GACH;","names":[]}
@@ -37,7 +37,7 @@ const IntlayerEditorElement = ({
37
37
  }
38
38
  return content;
39
39
  };
40
- const renderIntlayerEditor = (data, isContentSelectable) => {
40
+ const renderIntlayerEditor = (data, isContentSelectable = true) => {
41
41
  const Result = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
42
42
  IntlayerEditorElement,
43
43
  {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/editor/renderContentEditor.tsx"],"sourcesContent":["import { getConfiguration } from '@intlayer/config/client';\nimport type { KeyPath } from '@intlayer/core';\nimport type { FC, ReactNode } from 'react';\nimport { ContentSelectorConnector } from './ContentSelectorConnector';\n\nconst {\n editor: { enabled },\n} = getConfiguration();\n\nexport type IntlayerEditorElementProps = {\n content: string;\n dictionaryId: string;\n dictionaryPath: string;\n keyPath: KeyPath[];\n isContentSelectable: boolean;\n};\n\nconst IntlayerEditorElement: FC<IntlayerEditorElementProps> = ({\n content,\n isContentSelectable,\n ...props\n}) => {\n if (enabled && isContentSelectable) {\n return (\n <ContentSelectorConnector {...props}>{content}</ContentSelectorConnector>\n );\n }\n return content;\n};\n\nexport type RenderIntlayerEditorResult = ReactNode & { value: string };\n\nexport const renderIntlayerEditor = (\n data: IntlayerEditorElementProps,\n isContentSelectable: boolean\n): RenderIntlayerEditorResult => {\n const Result = (\n <IntlayerEditorElement\n {...data}\n isContentSelectable={isContentSelectable}\n />\n );\n\n return { ...Result, value: data.content };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBM;AAxBN,oBAAiC;AAGjC,sCAAyC;AAEzC,MAAM;AAAA,EACJ,QAAQ,EAAE,QAAQ;AACpB,QAAI,gCAAiB;AAUrB,MAAM,wBAAwD,CAAC;AAAA,EAC7D;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,MAAI,WAAW,qBAAqB;AAClC,WACE,4CAAC,4DAA0B,GAAG,OAAQ,mBAAQ;AAAA,EAElD;AACA,SAAO;AACT;AAIO,MAAM,uBAAuB,CAClC,MACA,wBAC+B;AAC/B,QAAM,SACJ;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA;AAAA,EACF;AAGF,SAAO,EAAE,GAAG,QAAQ,OAAO,KAAK,QAAQ;AAC1C;","names":[]}
1
+ {"version":3,"sources":["../../../src/editor/renderContentEditor.tsx"],"sourcesContent":["import { getConfiguration } from '@intlayer/config/client';\nimport type { KeyPath } from '@intlayer/core';\nimport type { FC, ReactNode } from 'react';\nimport { ContentSelectorConnector } from './ContentSelectorConnector';\n\nconst {\n editor: { enabled },\n} = getConfiguration();\n\nexport type IntlayerEditorElementProps = {\n content: string;\n dictionaryKey: string;\n dictionaryPath: string;\n keyPath: KeyPath[];\n isContentSelectable: boolean;\n};\n\nconst IntlayerEditorElement: FC<IntlayerEditorElementProps> = ({\n content,\n isContentSelectable,\n ...props\n}) => {\n if (enabled && isContentSelectable) {\n return (\n <ContentSelectorConnector {...props}>{content}</ContentSelectorConnector>\n );\n }\n return content;\n};\n\nexport type IntlayerNode<T = string> = ReactNode & {\n value: T;\n};\n\nexport const renderIntlayerEditor = (\n data: IntlayerEditorElementProps,\n isContentSelectable = true\n): IntlayerNode => {\n const Result = (\n <IntlayerEditorElement\n {...data}\n isContentSelectable={isContentSelectable}\n />\n );\n\n return { ...Result, value: data.content };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBM;AAxBN,oBAAiC;AAGjC,sCAAyC;AAEzC,MAAM;AAAA,EACJ,QAAQ,EAAE,QAAQ;AACpB,QAAI,gCAAiB;AAUrB,MAAM,wBAAwD,CAAC;AAAA,EAC7D;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,MAAI,WAAW,qBAAqB;AAClC,WACE,4CAAC,4DAA0B,GAAG,OAAQ,mBAAQ;AAAA,EAElD;AACA,SAAO;AACT;AAMO,MAAM,uBAAuB,CAClC,MACA,sBAAsB,SACL;AACjB,QAAM,SACJ;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA;AAAA,EACF;AAGF,SAAO,EAAE,GAAG,QAAQ,OAAO,KAAK,QAAQ;AAC1C;","names":[]}
@@ -16,39 +16,40 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var useDictionaryBase_exports = {};
20
- __export(useDictionaryBase_exports, {
21
- recursiveTransformContent: () => recursiveTransformContent,
22
- useDictionaryBase: () => useDictionaryBase
19
+ var getDictionary_exports = {};
20
+ __export(getDictionary_exports, {
21
+ getDictionary: () => getDictionary,
22
+ recursiveTransformContent: () => recursiveTransformContent
23
23
  });
24
- module.exports = __toCommonJS(useDictionaryBase_exports);
24
+ module.exports = __toCommonJS(getDictionary_exports);
25
25
  var import_react = require("react");
26
- var import_processDictionary = require('./processDictionary/index.cjs');
27
26
  var import_renderContentEditor = require('./editor/renderContentEditor.cjs');
28
- const recursiveTransformContent = (value, isContentSelectable = false) => {
27
+ var import_processDictionary = require('./processDictionary/index.cjs');
28
+ const recursiveTransformContent = (value, isRenderEditor = false) => {
29
29
  if (typeof value === "function") {
30
- return (props) => recursiveTransformContent(value(props), isContentSelectable);
30
+ return (props) => recursiveTransformContent(value(props), isRenderEditor);
31
31
  } else if (typeof value === "object") {
32
- if (typeof value.dictionaryId !== "undefined") {
33
- return (0, import_renderContentEditor.renderIntlayerEditor)(value, isContentSelectable);
32
+ if (typeof value.dictionaryKey !== "undefined") {
33
+ if (isRenderEditor) {
34
+ return (0, import_renderContentEditor.renderIntlayerEditor)(value);
35
+ }
36
+ return value.content;
34
37
  } else if (Array.isArray(value)) {
35
- return value.map(
36
- (el) => recursiveTransformContent(el, isContentSelectable)
37
- );
38
+ return value.map((el) => recursiveTransformContent(el, isRenderEditor));
38
39
  } else if ((0, import_react.isValidElement)(value)) {
39
40
  return value;
40
41
  }
41
42
  return Object.entries(value).reduce(
42
43
  (acc, [key, value2]) => ({
43
44
  ...acc,
44
- [key]: recursiveTransformContent(value2, isContentSelectable)
45
+ [key]: recursiveTransformContent(value2, isRenderEditor)
45
46
  }),
46
47
  {}
47
48
  );
48
49
  }
49
50
  return value;
50
51
  };
51
- const useDictionaryBase = (dictionary, locale, isContentSelectable = false) => {
52
+ const getDictionary = (dictionary, locale, isRenderEditor = false) => {
52
53
  const result = (0, import_processDictionary.processDictionary)(
53
54
  dictionary.content,
54
55
  dictionary.key,
@@ -58,12 +59,12 @@ const useDictionaryBase = (dictionary, locale, isContentSelectable = false) => {
58
59
  );
59
60
  return recursiveTransformContent(
60
61
  result,
61
- isContentSelectable
62
+ isRenderEditor
62
63
  );
63
64
  };
64
65
  // Annotate the CommonJS export names for ESM import in node:
65
66
  0 && (module.exports = {
66
- recursiveTransformContent,
67
- useDictionaryBase
67
+ getDictionary,
68
+ recursiveTransformContent
68
69
  });
69
- //# sourceMappingURL=useDictionaryBase.cjs.map
70
+ //# sourceMappingURL=getDictionary.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/getDictionary.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { Locales } from '@intlayer/config';\nimport type {\n DeclarationContent,\n DictionaryValue,\n NodeType,\n} from '@intlayer/core';\nimport { isValidElement, type ReactNode } from 'react';\nimport {\n type IntlayerNode,\n renderIntlayerEditor,\n} from './editor/renderContentEditor';\nimport { processDictionary } from './processDictionary/index';\n\ntype TransformNodeType<T, L extends Locales, R extends boolean> = T extends {\n [NodeType.Enumeration]: { '1': any };\n}\n ? (\n quantity: number\n ) => DeepTransformContent<T[NodeType.Enumeration]['1'], L, R>\n : T extends {\n [NodeType.Translation]: object;\n }\n ? L extends keyof T[NodeType.Translation]\n ? DeepTransformContent<T[NodeType.Translation][L], L, R>\n : never\n : T;\n\nexport type DeepTransformContent<\n T,\n L extends Locales,\n R extends boolean,\n> = T extends object // Check if the property is an object\n ? T extends (infer U)[] // If it's an array, infer the type of array elements\n ? DeepTransformContent<U, L, R>[] // Apply DeepTransformContent recursively to each element of the array\n : T extends {\n nodeType: NodeType | string;\n }\n ? TransformNodeType<T, L, R>\n : T extends { _owner: any; key: any; props: any; ref: any }\n ? ReactNode\n : {\n [K in keyof T]: DeepTransformContent<T[K], L, R>;\n }\n : T extends undefined\n ? never\n : R extends true\n ? IntlayerNode<T>\n : T;\n\n/**\n * Go through the object. If a object has a keyPath, render the intlayer editor if editor enabled.\n */\nexport const recursiveTransformContent = (\n value: any,\n isRenderEditor = false\n): object => {\n if (typeof value === 'function') {\n return (props: any) =>\n recursiveTransformContent(value(props), isRenderEditor);\n } else if (typeof value === 'object') {\n if (typeof value.dictionaryKey !== 'undefined') {\n if (isRenderEditor) {\n return renderIntlayerEditor(value);\n }\n return value.content;\n } else if (Array.isArray(value)) {\n return value.map((el) => recursiveTransformContent(el, isRenderEditor));\n } else if (isValidElement(value)) {\n return value;\n }\n\n return Object.entries(value).reduce(\n (acc, [key, value]) => ({\n ...acc,\n [key]: recursiveTransformContent(value, isRenderEditor),\n }),\n {} as object\n );\n }\n\n return value;\n};\n\ntype DataFromDictionary<\n T extends DeclarationContent,\n K extends Locales,\n R extends boolean = false,\n> = DeepTransformContent<T['content'], K, R>;\n\nexport type UseDictionary = <\n T extends DeclarationContent,\n L extends Locales,\n R extends boolean = false,\n>(\n dictionary: T,\n locale?: L,\n isRenderEditor?: R\n) => DataFromDictionary<T, L, R>;\n\n/**\n * Hook that picks one dictionary by its id and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const getDictionary: UseDictionary = <\n T extends DeclarationContent,\n L extends Locales,\n R extends boolean = false,\n>(\n dictionary: T,\n locale?: L,\n isRenderEditor: R = false as R\n) => {\n const result = processDictionary(\n dictionary.content as DictionaryValue,\n dictionary.key,\n dictionary.filePath,\n [],\n locale\n );\n\n return recursiveTransformContent(\n result,\n isRenderEditor\n ) as DataFromDictionary<T, L, R>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,mBAA+C;AAC/C,iCAGO;AACP,+BAAkC;AAyC3B,MAAM,4BAA4B,CACvC,OACA,iBAAiB,UACN;AACX,MAAI,OAAO,UAAU,YAAY;AAC/B,WAAO,CAAC,UACN,0BAA0B,MAAM,KAAK,GAAG,cAAc;AAAA,EAC1D,WAAW,OAAO,UAAU,UAAU;AACpC,QAAI,OAAO,MAAM,kBAAkB,aAAa;AAC9C,UAAI,gBAAgB;AAClB,mBAAO,iDAAqB,KAAK;AAAA,MACnC;AACA,aAAO,MAAM;AAAA,IACf,WAAW,MAAM,QAAQ,KAAK,GAAG;AAC/B,aAAO,MAAM,IAAI,CAAC,OAAO,0BAA0B,IAAI,cAAc,CAAC;AAAA,IACxE,eAAW,6BAAe,KAAK,GAAG;AAChC,aAAO;AAAA,IACT;AAEA,WAAO,OAAO,QAAQ,KAAK,EAAE;AAAA,MAC3B,CAAC,KAAK,CAAC,KAAKA,MAAK,OAAO;AAAA,QACtB,GAAG;AAAA,QACH,CAAC,GAAG,GAAG,0BAA0BA,QAAO,cAAc;AAAA,MACxD;AAAA,MACA,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AACT;AAuBO,MAAM,gBAA+B,CAK1C,YACA,QACA,iBAAoB,UACjB;AACH,QAAM,aAAS;AAAA,IACb,WAAW;AAAA,IACX,WAAW;AAAA,IACX,WAAW;AAAA,IACX,CAAC;AAAA,IACD;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;","names":["value"]}
@@ -26,16 +26,19 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var useIntlayerBase_exports = {};
30
- __export(useIntlayerBase_exports, {
31
- useIntlayerBase: () => useIntlayerBase
29
+ var getIntlayer_exports = {};
30
+ __export(getIntlayer_exports, {
31
+ getIntlayer: () => getIntlayer
32
32
  });
33
- module.exports = __toCommonJS(useIntlayerBase_exports);
33
+ module.exports = __toCommonJS(getIntlayer_exports);
34
34
  var import_dictionaries_entry = __toESM(require("@intlayer/dictionaries-entry"));
35
+ var import_getDictionary = require('./getDictionary.cjs');
35
36
  var import_processDictionary = require('./processDictionary/index.cjs');
36
- var import_useDictionaryBase = require('./useDictionaryBase.cjs');
37
- const useIntlayerBase = (key, locale) => {
37
+ const getIntlayer = (key, locale, isRenderEditor = false) => {
38
38
  const dictionary = import_dictionaries_entry.default[key];
39
+ if (!dictionary) {
40
+ throw new Error(`Dictionary ${key} not found`, import_dictionaries_entry.default);
41
+ }
39
42
  const result = (0, import_processDictionary.processDictionary)(
40
43
  dictionary.content,
41
44
  dictionary.key,
@@ -43,14 +46,13 @@ const useIntlayerBase = (key, locale) => {
43
46
  [],
44
47
  locale
45
48
  );
46
- const isContentSelectable = true;
47
- return (0, import_useDictionaryBase.recursiveTransformContent)(
49
+ return (0, import_getDictionary.recursiveTransformContent)(
48
50
  result,
49
- isContentSelectable
51
+ isRenderEditor
50
52
  );
51
53
  };
52
54
  // Annotate the CommonJS export names for ESM import in node:
53
55
  0 && (module.exports = {
54
- useIntlayerBase
56
+ getIntlayer
55
57
  });
56
- //# sourceMappingURL=useIntlayerBase.cjs.map
58
+ //# sourceMappingURL=getIntlayer.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/getIntlayer.ts"],"sourcesContent":["import type { Locales } from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\nimport dictionaries from '@intlayer/dictionaries-entry';\nimport type { IntlayerDictionaryTypesConnector } from 'intlayer';\nimport {\n type DeepTransformContent,\n recursiveTransformContent,\n} from './getDictionary';\nimport { processDictionary } from './processDictionary/index';\n\n/**\n * Provides a fallback to string type if the generic type T is never,\n * otherwise returns T. This is useful for handling cases where no keys are found.\n * Example: StringFallback<never> -> string; StringFallback<'key'> -> 'key'\n */\nexport type StringFallback<T> = T extends never ? string : T; // If no keys are found, return string to disable error, and accept any string as dictionary key\n\n/**\n * Represents the keys of the IntlayerDictionaryTypesConnector,\n * ensuring they are valid dictionary keys or fallback to string if none exist.\n *\n * Example:\n * ```ts\n * DictionaryKeys -> 'key1' | 'key2'\n * // or if IntlayerDictionaryTypesConnector is not defined,\n * DictionaryKeys -> string\n * ```\n */\nexport type DictionaryKeys = StringFallback<\n keyof IntlayerDictionaryTypesConnector\n>;\n\n/**\n * Represents the data type returned by the useIntlayer hook,\n * excluding the 'id' and 'filePath' keys from the dictionary content.\n */\nexport type DataFromDictionaryKey<\n T extends DictionaryKeys,\n K extends Locales,\n R extends boolean = false,\n> = DeepTransformContent<IntlayerDictionaryTypesConnector[T]['content'], K, R>;\n\n/**\n * Type definition for the useIntlayer hook, which takes a dictionary ID and an optional locale,\n * and returns the deeply transformed dictionary content.\n *\n */\nexport type UseIntlayer = <\n T extends DictionaryKeys,\n L extends Locales,\n R extends boolean = false,\n>(\n key: T,\n locale?: L,\n isRenderEditor?: R\n) => DataFromDictionaryKey<T, L, R>;\n\nexport type UseIntlayerEditable = <\n T extends DictionaryKeys,\n L extends Locales,\n R extends boolean = true,\n>(\n key: T,\n locale?: L,\n isRenderEditor?: R\n) => DataFromDictionaryKey<T, L, R>;\n\nexport const getIntlayer: UseIntlayer = <\n T extends DictionaryKeys,\n L extends Locales,\n R extends boolean = false,\n>(\n key: T,\n locale?: L,\n isRenderEditor: R = false as R\n) => {\n const dictionary: Dictionary = dictionaries[key as keyof typeof dictionaries];\n\n if (!dictionary) {\n throw new Error(`Dictionary ${key} not found`, dictionaries);\n }\n\n const result = processDictionary(\n dictionary.content,\n dictionary.key,\n dictionary.filePath,\n [],\n locale\n );\n\n return recursiveTransformContent(\n result,\n isRenderEditor\n ) as DataFromDictionaryKey<T, L, R>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,gCAAyB;AAEzB,2BAGO;AACP,+BAAkC;AA2D3B,MAAM,cAA2B,CAKtC,KACA,QACA,iBAAoB,UACjB;AACH,QAAM,aAAyB,0BAAAA,QAAa,GAAgC;AAE5E,MAAI,CAAC,YAAY;AACf,UAAM,IAAI,MAAM,cAAc,GAAG,cAAc,0BAAAA,OAAY;AAAA,EAC7D;AAEA,QAAM,aAAS;AAAA,IACb,WAAW;AAAA,IACX,WAAW;AAAA,IACX,WAAW;AAAA,IACX,CAAC;AAAA,IACD;AAAA,EACF;AAEA,aAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;","names":["dictionaries"]}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var getIntlayerAsync_exports = {};
21
+ __export(getIntlayerAsync_exports, {
22
+ getIntlayerAsync: () => getIntlayerAsync
23
+ });
24
+ module.exports = __toCommonJS(getIntlayerAsync_exports);
25
+ var import_fetchDistantDictionary = require('./distantDictionary/fetchDistantDictionary.cjs');
26
+ var import_getDictionary = require('./getDictionary.cjs');
27
+ const getIntlayerAsync = async (key, locale, isRenderEditor = true) => {
28
+ const jsonDistantDictionary = await (0, import_fetchDistantDictionary.fetchDistantDictionary)(key);
29
+ if (jsonDistantDictionary) {
30
+ return (0, import_getDictionary.getDictionary)(
31
+ jsonDistantDictionary,
32
+ locale,
33
+ isRenderEditor
34
+ );
35
+ }
36
+ return null;
37
+ };
38
+ // Annotate the CommonJS export names for ESM import in node:
39
+ 0 && (module.exports = {
40
+ getIntlayerAsync
41
+ });
42
+ //# sourceMappingURL=getIntlayerAsync.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/getIntlayerAsync.ts"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport { DeclarationContent } from 'intlayer';\nimport { fetchDistantDictionary } from './distantDictionary/fetchDistantDictionary';\nimport { getDictionary } from './getDictionary';\nimport { DictionaryKeys, DataFromDictionaryKey } from './getIntlayer';\n\nexport type GetIntlayerAsync = <\n T extends DictionaryKeys,\n L extends Locales,\n R extends boolean = true,\n>(\n key: T,\n locale?: L,\n isRenderEditor?: R\n) => Promise<DataFromDictionaryKey<T, L, R> | null>;\n\n/**\n * On the client side, Hook that picking one dictionary by its key and return the content\n *\n * This hook will prerender the locale dictionary and fetch simultaneously the distant dictionaries to hydrate it.\n *\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const getIntlayerAsync: GetIntlayerAsync = async <\n T extends DictionaryKeys,\n L extends Locales,\n R extends boolean = true,\n>(\n key: T,\n locale?: L,\n isRenderEditor = true as R\n) => {\n const jsonDistantDictionary = await fetchDistantDictionary(key);\n\n if (jsonDistantDictionary) {\n return getDictionary(\n jsonDistantDictionary as unknown as DeclarationContent,\n locale,\n isRenderEditor\n ) as DataFromDictionaryKey<T, L, R>;\n }\n\n return null;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,oCAAuC;AACvC,2BAA8B;AAqBvB,MAAM,mBAAqC,OAKhD,KACA,QACA,iBAAiB,SACd;AACH,QAAM,wBAAwB,UAAM,sDAAuB,GAAG;AAE9D,MAAI,uBAAuB;AACzB,eAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -21,12 +21,15 @@ __export(src_exports, {
21
21
  IntlayerClientContext: () => import_client.IntlayerClientContext,
22
22
  IntlayerProvider: () => import_client.IntlayerProvider,
23
23
  getBrowserLocale: () => import_client.getBrowserLocale,
24
+ getDictionary: () => import_getDictionary.getDictionary,
25
+ getIntlayer: () => import_getIntlayer.getIntlayer,
24
26
  getTranslation: () => import_getTranslation.getTranslation,
25
27
  localeCookie: () => import_client.localeCookie,
26
28
  setLocaleCookie: () => import_client.setLocaleCookie,
27
29
  t: () => import_client.t,
28
30
  useDictionary: () => import_client.useDictionary,
29
31
  useIntlayer: () => import_client.useIntlayer,
32
+ useIntlayerAsync: () => import_client.useIntlayerAsync,
30
33
  useIntlayerContext: () => import_client.useIntlayerContext,
31
34
  useLocale: () => import_client.useLocale,
32
35
  useLocaleBase: () => import_client.useLocaleBase,
@@ -36,17 +39,22 @@ __export(src_exports, {
36
39
  module.exports = __toCommonJS(src_exports);
37
40
  var import_getTranslation = require('./getTranslation.cjs');
38
41
  var import_client = require('./client/index.cjs');
42
+ var import_getDictionary = require('./getDictionary.cjs');
43
+ var import_getIntlayer = require('./getIntlayer.cjs');
39
44
  // Annotate the CommonJS export names for ESM import in node:
40
45
  0 && (module.exports = {
41
46
  IntlayerClientContext,
42
47
  IntlayerProvider,
43
48
  getBrowserLocale,
49
+ getDictionary,
50
+ getIntlayer,
44
51
  getTranslation,
45
52
  localeCookie,
46
53
  setLocaleCookie,
47
54
  t,
48
55
  useDictionary,
49
56
  useIntlayer,
57
+ useIntlayerAsync,
50
58
  useIntlayerContext,
51
59
  useLocale,
52
60
  useLocaleBase,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { getTranslation } from './getTranslation';\nexport {\n IntlayerProvider,\n type IntlayerProviderProps,\n IntlayerClientContext,\n useIntlayer,\n useDictionary,\n useLocale,\n useTraduction,\n useLocaleCookie,\n useIntlayerContext,\n localeCookie,\n setLocaleCookie,\n getBrowserLocale,\n useLocaleBase,\n t,\n} from './client/index';\nexport { type IntlayerNode } from './useDictionaryBase';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA+B;AAC/B,oBAeO;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { getTranslation } from './getTranslation';\nexport {\n IntlayerProvider,\n type IntlayerProviderProps,\n IntlayerClientContext,\n useIntlayer,\n useIntlayerAsync,\n useDictionary,\n useLocale,\n useTraduction,\n useLocaleCookie,\n useIntlayerContext,\n localeCookie,\n setLocaleCookie,\n getBrowserLocale,\n useLocaleBase,\n t,\n} from './client/index';\nexport { getDictionary } from './getDictionary';\nexport { getIntlayer } from './getIntlayer';\nexport { type IntlayerNode } from './editor/renderContentEditor';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA+B;AAC/B,oBAgBO;AACP,2BAA8B;AAC9B,yBAA4B;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/processDictionary/contentDictionary.ts"],"sourcesContent":["import type { KeyPath, Locales } from '@intlayer/core';\nimport type { ReactNode } from 'react';\n\nexport type TransformedContentValue =\n | string\n | ReactNode\n | {\n [key: string]: TransformedContentValue;\n }\n | undefined\n | ((quantity: number) => TransformedContentValue);\n\nexport type TransformedContentObject = {\n dictionaryId: string;\n dictionaryPath: string;\n keyPath: KeyPath[];\n locale: Locales;\n content: TransformedContentValue | TransformedContentValue[] | undefined;\n};\n\nexport type TransformedContent =\n | Record<\n string,\n | TransformedContentValue\n | TransformedContentValue[]\n | TransformedContentObject\n | undefined\n >\n | ReactNode;\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../../src/processDictionary/contentDictionary.ts"],"sourcesContent":["import type { KeyPath, Locales } from '@intlayer/core';\nimport type { ReactNode } from 'react';\n\nexport type TransformedContentValue =\n | string\n | ReactNode\n | {\n [key: string]: TransformedContentValue;\n }\n | undefined\n | ((quantity: number) => TransformedContentValue);\n\nexport type TransformedContentObject = {\n dictionaryKey: string;\n dictionaryPath: string;\n keyPath: KeyPath[];\n locale: Locales;\n content: TransformedContentValue | TransformedContentValue[] | undefined;\n};\n\nexport type TransformedContent =\n | Record<\n string,\n | TransformedContentValue\n | TransformedContentValue[]\n | TransformedContentObject\n | undefined\n >\n | ReactNode;\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}